Commit 0a9de2d3 authored by Dominik Weckbecker's avatar Dominik Weckbecker 💬
Browse files

wrap changes into preprocessor macros more cleanly

parent 035afb94
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2757,7 +2757,9 @@ void ivas_dirac_dec(
            {
                switch ( nchan_transport )
                {
#ifdef HODIRAC
                    case 11:
#endif
                    case 8:
                    case 6:
                    case 4:
+6 −5
Original line number Diff line number Diff line
@@ -108,7 +108,6 @@ ivas_error ivas_sba_dec_reconfigure(
    AUDIO_CONFIG intern_config_old;
    int16_t numCldfbAnalyses_old, numCldfbSyntheses_old;
    int16_t sba_dirac_stereo_flag_old;

    int32_t ivas_total_brate;
#ifdef HODIRAC
    int32_t last_ivas_total_brate;
@@ -117,7 +116,6 @@ ivas_error ivas_sba_dec_reconfigure(
    RENDERER_TYPE old_renderer_type;
    DECODER_CONFIG_HANDLE hDecoderConfig;
    ivas_error error;

    error = IVAS_ERR_OK;

    hDecoderConfig = st_ivas->hDecoderConfig;
@@ -159,10 +157,12 @@ ivas_error ivas_sba_dec_reconfigure(

        if ( nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal )
#ifdef HODIRAC
             || ( last_ivas_total_brate >= IVAS_512k && ivas_total_brate < IVAS_512k ) || ( last_ivas_total_brate < IVAS_512k && ivas_total_brate >= IVAS_512k )
             || ( last_ivas_total_brate >= IVAS_512k && ivas_total_brate < IVAS_512k )
             || ( last_ivas_total_brate < IVAS_512k && ivas_total_brate >= IVAS_512k )
#endif
        )
        {

            ivas_spar_dec_close( &( st_ivas->hSpar ), hDecoderConfig->output_Fs, 1 );

            if ( ( error = ivas_spar_dec_open( st_ivas, 1 ) ) != IVAS_ERR_OK )
@@ -249,7 +249,8 @@ ivas_error ivas_sba_dec_reconfigure(

    if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO ) && ( st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) )
#ifdef HODIRAC
         || ( last_ivas_total_brate > IVAS_256k && ivas_total_brate <= IVAS_256k ) || ( last_ivas_total_brate <= IVAS_256k && ivas_total_brate > IVAS_256k )
         || ( last_ivas_total_brate > IVAS_256k && ivas_total_brate <= IVAS_256k ) 
         || ( last_ivas_total_brate <= IVAS_256k && ivas_total_brate > IVAS_256k )
#endif
    )
    {
@@ -276,7 +277,7 @@ ivas_error ivas_sba_dec_reconfigure(
               st_ivas->sba_analysis_order,
               st_ivas->sba_mode,
#ifdef HODIRAC
               st_ivas->sba_analysis_order > 1 && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND )
               ( st_ivas->sba_analysis_order > 1 && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND )
#else
               IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND
#endif
+6 −6
Original line number Diff line number Diff line
@@ -877,7 +877,6 @@ void ivas_spar_get_parameters(
                {
                    if ( hSpar->i_subframe > 3 )
                    {

                        par_mat[out_ch][in_ch][spar_band] = ( 1.0f - weight ) * hSpar->hMdDec->mixer_mat_prev[ts0][out_ch][in_ch][spar_band] +
                                                            weight * hSpar->hMdDec->mixer_mat_prev[ts1][out_ch][in_ch][spar_band];
                    }
@@ -1130,7 +1129,8 @@ void ivas_spar_dec_upmixer(
            for ( i = 0; i < nchan_transport; i++ )
            {
                tmp = roundf( output[i][j] * PCM16_TO_FLT_FAC );
                pcm = ( tmp > MAX16B_FLT ) ? MAX16B : ( tmp < MIN16B_FLT ) ? MIN16B : (short) tmp;
                pcm = ( tmp > MAX16B_FLT ) ? MAX16B : ( tmp < MIN16B_FLT ) ? MIN16B
                                                                           : (short) tmp;
                dbgwrite( &pcm, sizeof( int16_t ), 1, 1, "dmx_dec.raw" );
            }
        }
+29 −6
Original line number Diff line number Diff line
@@ -130,7 +130,11 @@ static ivas_error ivas_spar_md_dec_matrix_open(
    num_md_sub_frames = MAX_PARAM_SPATIAL_SUBFRAMES;
#endif

#ifdef SPAR_TUNING
    if ( ( hMdDec->spar_md.band_coeffs = (ivas_band_coeffs_t *) malloc( IVAS_MAX_NUM_BANDS * num_md_sub_frames * sizeof( ivas_band_coeffs_t ) ) ) == NULL )
#else
    if ( ( hMdDec->spar_md.band_coeffs = (ivas_band_coeffs_t *) malloc( IVAS_MAX_NUM_BANDS * MAX_PARAM_SPATIAL_SUBFRAMES * sizeof( ivas_band_coeffs_t ) ) ) == NULL )
#endif
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for band_coeffs in SPAR MD" );
    }
@@ -146,7 +150,11 @@ static ivas_error ivas_spar_md_dec_matrix_open(
        }
        for ( j = 0; j < num_channels; j++ )
        {
#ifdef SPAR_TUNING
            if ( ( hMdDec->mixer_mat[i][j] = (float *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL )
#else
            if ( ( hMdDec->mixer_mat[i][j] = (float *) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL )
#endif
           {
                return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" );
            }
@@ -165,7 +173,11 @@ static ivas_error ivas_spar_md_dec_matrix_open(
        }
        for ( j = 0; j < num_channels; j++ )
        {
#ifdef SPAR_TUNING
            if ( ( hMdDec->spar_coeffs.C_re[i][j] = (float *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL )
#else
            if ( ( hMdDec->spar_coeffs.C_re[i][j] = (float *) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL )
#endif
            {
                return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" );
            }
@@ -184,7 +196,11 @@ static ivas_error ivas_spar_md_dec_matrix_open(
        }
        for ( j = 0; j < num_channels; j++ )
        {
#ifdef SPAR_TUNING
            if ( ( hMdDec->spar_coeffs.P_re[i][j] = (float *) malloc( num_md_sub_frames * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL )
#else
            if ( ( hMdDec->spar_coeffs.P_re[i][j] = (float *) malloc( MAX_PARAM_SPATIAL_SUBFRAMES * IVAS_MAX_NUM_BANDS * sizeof( float ) ) ) == NULL )
#endif
            {
                return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR MD matrix" );
            }
@@ -276,7 +292,6 @@ int16_t ivas_get_spar_dec_md_num_subframes(
    const int32_t ivas_total_brate )
{
    int16_t num_subframes;

    num_subframes = MAX_PARAM_SPATIAL_SUBFRAMES;
    if ( sba_order > SBA_FOA_ORDER )
    {
@@ -288,6 +303,7 @@ int16_t ivas_get_spar_dec_md_num_subframes(
    return ( num_subframes );
}
#endif

/*-------------------------------------------------------------------------
 * ivas_spar_md_dec_open()
 *
@@ -499,6 +515,7 @@ ivas_error ivas_spar_md_dec_init(
    int16_t i, j, k;
    int16_t nchan_transport;
    float pFC[IVAS_MAX_NUM_BANDS], PR_minmax[2];

#ifdef SPAR_TUNING
    ivas_sba_get_spar_hoa_md_flag( sba_order, hDecoderConfig->ivas_total_brate, &hMdDec->spar_hoa_md_flag, &hMdDec->spar_hoa_dirac2spar_md_flag );
#else
@@ -875,8 +892,6 @@ void ivas_spar_md_dec_process(
    /* SPAR to DirAC conversion */
#ifdef SPAR_TUNING
    if ( hMdDec->spar_hoa_dirac2spar_md_flag == 1 )
#else
    if ( hMdDec->spar_hoa_md_flag == 0 )
#endif
    {
        ivas_spar_to_dirac( st_ivas, hMdDec, dtx_vad, num_bands_out, bw );
@@ -1012,7 +1027,11 @@ void ivas_spar_md_dec_process(
    }*/
#endif
    /* expand DirAC MD to all time slots */
#ifdef SPAR_TUNING
    for ( i_ts = 1; i_ts < num_md_sub_frames; i_ts++ )
#else
    for ( i_ts = 1; i_ts < MAX_PARAM_SPATIAL_SUBFRAMES; i_ts++ )
#endif
    {
        for ( b = 0; b < hMdDec->spar_md.num_bands; b++ )
        {
@@ -1036,7 +1055,11 @@ void ivas_spar_md_dec_process(
        }
    }

#ifdef SPAR_TUNING
    ivas_get_spar_matrices( hMdDec, num_bands_out, num_md_sub_frames, bw, dtx_vad, nB,
#else
    ivas_get_spar_matrices( hMdDec, num_bands_out, MAX_PARAM_SPATIAL_SUBFRAMES, bw, dtx_vad, nB,
#endif
#ifdef SPAR_TUNING
                            num_md_chs,
#else
@@ -1334,6 +1357,7 @@ static void ivas_get_spar_matrices(
    int16_t i, j, k, m, b, i_ts, active_w;
    const int16_t *order;
    float active_w_dm_fac, re;

#ifndef SPAR_TUNING
    numch_out = ivas_sba_get_nchan_metadata( sba_order );
#endif
@@ -2159,7 +2183,6 @@ static void ivas_decode_arith_bs(
    {
        ndm = hMdDec->spar_md_cfg.num_dmx_chans_per_band[bands_bw * i];
        ndec = hMdDec->spar_md_cfg.num_decorr_per_band[bands_bw * i];

        if ( ( ivas_total_brate < IVAS_24k4 ) && ( strat > 3 ) && ( ( ( i % 2 == 1 ) && ( strat % 2 == 0 ) ) || ( ( i % 2 == 0 ) && ( strat % 2 == 1 ) ) ) )
        {
            pred_cell_dims[i].dim1 = 0;
@@ -2594,6 +2617,7 @@ static void ivas_spar_md_fill_invalid_bands(
    float w = 0;
#ifndef SPAR_TUNING
    int16_t num_channels;

    num_channels = ivas_sba_get_nchan_metadata( sba_order );
#endif
    set_s( valid_band_idx, 0, IVAS_MAX_NUM_BANDS );
@@ -3259,7 +3283,6 @@ void ivas_spar_to_dirac(
            }
        }
    }

    /* expand DirAC TC 20ms MD for residual channels to all subframes*/
    for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ )
    {
+1 −0
Original line number Diff line number Diff line
@@ -869,6 +869,7 @@ typedef struct ivas_spar_dec_lib_t
    int16_t numOutChannels;
    int16_t pca_ingest_channels;
#endif

} SPAR_DEC_DATA, *SPAR_DEC_HANDLE;