Commit e68cb3c4 authored by vaclav's avatar vaclav
Browse files

address reviewer's comments

parent 337c4839
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@
#define FIX_1904_HARM_GSC_ENC                           /* VA: #1904 Harmonization of EVS and IVAS GSC code */
#define FIX_2271_OOB_INDEXING_IN_PIT_OL2                /* VA: Fix for issue 2271, to silence clang18 */
#define FIX_2273_OOB_INDEXING_IN_PIT_FR4                /* VA: Fix to silence clang on ptr init */
#define REMOVE_UNUSED_CODE_IVAS_DEC                     /* VA: remove unused code in ivas_jbm_dec_tc_fx() */()
#define REMOVE_UNUSED_CODE_IVAS_DEC                     /* VA: remove unused code in ivas_jbm_dec_tc_fx() */

/* #################### End BE switches ################################## */

+44 −29
Original line number Diff line number Diff line
@@ -1241,7 +1241,9 @@ void ivas_sba_dirac_stereo_dec_fx(
    Word16 dtx_flag, fd_cng_flag;
    Word16 sba_mono_flag;
    Word16 memOffset;
#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
    Word32 output_Fs;
#endif
    Word32 tmp_buf[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )];
    Word32 tmp_synth[L_FRAME16k];
    Word32 hb_gain[NB_DIV];
@@ -1257,19 +1259,12 @@ void ivas_sba_dirac_stereo_dec_fx(
#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
    Word16 mcmasa;

    mcmasa = 0;
    move16();
    if ( EQ_32( st_ivas->ivas_format, MC_FORMAT ) )
    {
        mcmasa = 1;
    mcmasa = EQ_32( st_ivas->ivas_format, MC_FORMAT);
    move16();
    }
#endif

    output_Fs = st_ivas->hDecoderConfig->output_Fs;
    move32();

#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
    hCPE = st_ivas->hCPE[0];
    hSCE = st_ivas->hSCE[0];
    hStereoDft = hCPE->hStereoDft;
@@ -1293,11 +1288,7 @@ void ivas_sba_dirac_stereo_dec_fx(
    }
    FOR( i = 0; i < CPE_CHANNELS; i++ )
    {
#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
        Scale_sig32( output[i], output_frame, s ); // Q(11+s)
#else
        Scale_sig32( output[i], L_FRAME48k, s );                                                                                                                                          // Q(11+s)
#endif
    }
    hStereoDft->q_dft = add( Q11, s );
    move16();
@@ -1321,21 +1312,13 @@ void ivas_sba_dirac_stereo_dec_fx(
    IF( hCPE->hCoreCoder[0] != NULL )
    {
        Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, L_FRAME32k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); // q
#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
        Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, output_frame, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q
#else
        Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, L_FRAME48k, q - hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); // q
#endif
        hCPE->hCoreCoder[0]->hHQ_core->Q_old_out_fx32 = q;
        move16();
    }
    IF( hStereoDft != NULL )
    {
#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
        IF( LE_16( st_ivas->nchan_transport, 1 ) && EQ_32( st_ivas->ivas_format, SBA_FORMAT ) )
#else
        IF( LE_16( st_ivas->nchan_transport, 1 ) )
#endif
        {
            st = hCPE->hCoreCoder[0];
            test();
@@ -1383,25 +1366,21 @@ void ivas_sba_dirac_stereo_dec_fx(
            }
        }

#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
        IF( NE_32( st_ivas->ivas_format, SBA_FORMAT ) )
        {
            scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( hStereoDft->q_dft, Q11 ) ); // q_dft
        }
#endif
        scale_sig32( hStereoDft->ap_delay_mem_fx, NS2SA_FX2( 16000, DELAY_BWE_TOTAL_NS ), sub( hStereoDft->q_dft, hStereoDft->q_ap_fade_mem_fx ) ); // q_dft
        hStereoDft->q_ap_fade_mem_fx = hStereoDft->q_dft;
        move16();
    }

#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
    test();
    if ( st_ivas->hSpar != NULL && EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
    {
        st_ivas->hSpar->hMdDec->Q_mixer_mat = Q30;
        move16();
    }
#endif

    IF( hSCE != NULL )
    {
@@ -1437,22 +1416,38 @@ void ivas_sba_dirac_stereo_dec_fx(
        set32_fx( DFT[i], 0, STEREO_DFT_BUF_MAX );
    }

#ifndef REMOVE_UNUSED_CODE_IVAS_DEC
    hSCE = st_ivas->hSCE[0];
    hCPE = st_ivas->hCPE[0];
    hStereoDft = hCPE->hStereoDft;
#endif
#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
    q = hStereoDft->q_dft;
    move16();
    q_dft[0] = hStereoDft->q_dft;
    move16();
    q_dft[1] = hStereoDft->q_dft;
    move16();
#else
    hSCE = st_ivas->hSCE[0];
    hCPE = st_ivas->hCPE[0];
    hStereoDft = hCPE->hStereoDft;

    q = hCPE->hStereoDft->q_dft;
    move16();
    q_dft[0] = hCPE->hStereoDft->q_dft;
    move16();
    q_dft[1] = hCPE->hStereoDft->q_dft;
    move16();
#endif

#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
    Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hStereoDft->q_dft ) ) ); /*hSCE->q_prev_hb_synth_fx + hStereoDft->q_dft - Q11*/
#else
    Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) );  /*hSCE->q_prev_hb_synth_fx + hCPE->hStereoDft->q_dft - Q11*/
#endif
    IF( hSCE != NULL )
    {
#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
        Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hStereoDft->q_dft ) ) ); /*hSCE->q_prev_hb_synth_fx + hStereoDft->q_dft - Q11*/
#else
        Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), negate( sub( Q11, hCPE->hStereoDft->q_dft ) ) ); /*hSCE->q_prev_hb_synth_fx + hCPE->hStereoDft->q_dft - Q11*/
#endif
        hSCE->q_prev_hb_synth_fx = hStereoDft->q_dft;
        move16();
    }
@@ -1480,10 +1475,17 @@ void ivas_sba_dirac_stereo_dec_fx(
    move16();

    ivas_sba_dirac_stereo_config( hStereoDft->hConfig );

    test();
    test();
#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
    hStereoDft->nbands = ivas_sba_dirac_stereo_band_config( hStereoDft->band_limits, output_Fs, hStereoDft->NFFT, ( ( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) && !mcmasa ) );
#else
    hStereoDft->nbands = ivas_sba_dirac_stereo_band_config( hStereoDft->band_limits, st_ivas->hDecoderConfig->output_Fs, hStereoDft->NFFT, ( ( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) && !mcmasa ) );
#endif

    stereo_dft_dec_update_fx( hStereoDft, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ );

    IF( GT_16( st_ivas->nchan_transport, 1 ) )
    {
        stereo_dft_dec_analyze_fx( hCPE, output[0], DFT, 0, output_frame, output_frame, DFT_STEREO_DEC_ANA_FB, 0, 0, &q, &q_dft[0] );
@@ -1523,8 +1525,13 @@ void ivas_sba_dirac_stereo_dec_fx(
    }

    /* DFT Stereo upmix */
#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
    stereo_dft_dec_fx( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/, sba_mono_flag, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : NULL, ( st_ivas->hSpar != NULL && ( !mcmasa ) ) ? st_ivas->hSpar->hFbMixer->cross_fade_start_offset : 0,
                       output_Fs, st_ivas->nchan_transport, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) );
#else
    stereo_dft_dec_fx( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/, sba_mono_flag, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : NULL, ( st_ivas->hSpar != NULL && ( !mcmasa ) ) ? st_ivas->hSpar->hFbMixer->cross_fade_start_offset : 0,
                       st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ) );
#endif

    /* DFT synthesis */
    stereo_dft_dec_synthesize_fx( hCPE, DFT, 0, output[0], output_frame );
@@ -1582,10 +1589,18 @@ void ivas_sba_dirac_stereo_dec_fx(
        set32_fx( output[ch], 0, output_frame );
    }

#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
    Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), sub( Q11, hStereoDft->q_dft ) ); /*hSCE->q_prev_hb_synth_fx + Q11 - hStereoDft->q_dft*/
#else
    Scale_sig32( hCPE->prev_hb_synth_fx[0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); /*hSCE->q_prev_hb_synth_fx + Q11 - hCPE->hStereoDft->q_dft*/
#endif
    IF( hSCE != NULL )
    {
#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
        Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), sub( Q11, hStereoDft->q_dft ) ); /*hSCE->q_prev_hb_synth_fx + Q11 - hStereoDft->q_dft*/
#else
        Scale_sig32( hSCE->prev_hb_synth_fx, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); /*hSCE->q_prev_hb_synth_fx + Q11 - hCPE->hStereoDft->q_dft*/
#endif
        hSCE->q_prev_hb_synth_fx = Q11;
        move16();
    }