Commit b231f50a authored by vaclav's avatar vaclav
Browse files

fix

parent 5791d093
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ ivas_error ivas_jbm_dec_tc_fx(
     *----------------------------------------------------------------*/

    test();
#ifndef REMOVE_UNUSED_CODE_IVAS_DEC
#ifndef REMOVE_UNUSED_CODE_IVAS_DECaa
    test();
    IF( st_ivas->bfi != 0 && st_ivas->ini_frame == 0 )
    {
@@ -894,7 +894,7 @@ ivas_error ivas_jbm_dec_tc_fx(
                return error;
            }
        }
#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
#ifdef REMOVE_UNUSED_CODE_IVAS_DEC // this is just to keep formatting correct (clang-format otherwise brekas the indentation)
        ELSE IF( EQ_16( st_ivas->nCPE, 1 ) )
        {
            IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, add( nb_bits_metadata[0], nb_bits_metadata[1] ) ) ), IVAS_ERR_OK ) )
+37 −25
Original line number Diff line number Diff line
@@ -1241,6 +1241,7 @@ void ivas_sba_dirac_stereo_dec_fx(
    Word16 dtx_flag, fd_cng_flag;
    Word16 sba_mono_flag;
    Word16 memOffset;
    Word32 output_Fs;
    Word32 tmp_buf[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )];
    Word32 tmp_synth[L_FRAME16k];
    Word32 hb_gain[NB_DIV];
@@ -1265,6 +1266,9 @@ void ivas_sba_dirac_stereo_dec_fx(
    }
#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];
@@ -1312,7 +1316,7 @@ void ivas_sba_dirac_stereo_dec_fx(
    FOR( i = 0; i < CPE_CHANNELS; ++i )
    {
        scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( hStereoDft->q_dft, Q11 ) );                     // q_dft
        scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hStereoDft->q_dft, Q11 ) ); // q_dft
        scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hStereoDft->q_dft, Q11 ) ); // q_dft
    }
    IF( hCPE->hCoreCoder[0] != NULL )
    {
@@ -1327,7 +1331,11 @@ void ivas_sba_dirac_stereo_dec_fx(
    }
    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();
@@ -1369,7 +1377,7 @@ void ivas_sba_dirac_stereo_dec_fx(
                    test();
                    IF( ( LE_16( st->last_L_frame, L_FRAME16k ) && LE_16( st->L_frame, L_FRAME16k ) ) || ( st_ivas->sba_dirac_stereo_flag && EQ_32( st->core_brate, SID_2k40 ) && EQ_16( st->cng_type, FD_CNG ) ) )
                    {
                        scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft
                        scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( hStereoDft->q_dft, Q11 ) ); // q_dft
                    }
                }
            }
@@ -1397,22 +1405,22 @@ void ivas_sba_dirac_stereo_dec_fx(

    IF( hSCE != NULL )
    {
        Scale_sig32( &hSCE->save_hb_synth_fx[0], extract_l( Mult_32_16( hCPE->hCoreCoder[0]->output_Fs, INV_FRAME_PER_SEC_Q15 ) ), sub( hStereoDft->q_dft, hSCE->q_save_hb_synth_fx ) ); // q_dft
        Scale_sig32( &hSCE->save_hb_synth_fx[0], extract_l( Mult_32_16( output_Fs, INV_FRAME_PER_SEC_Q15 ) ), sub( hStereoDft->q_dft, hSCE->q_save_hb_synth_fx ) ); // q_dft
        hSCE->q_save_hb_synth_fx = hStereoDft->q_dft;
        move16();
        Scale_sig32( &hSCE->save_synth_fx[0], extract_l( Mult_32_16( hCPE->hCoreCoder[0]->output_Fs, INV_FRAME_PER_SEC_Q15 ) ), sub( hStereoDft->q_dft, hSCE->q_save_synth_fx ) ); // q_dft
        Scale_sig32( &hSCE->save_synth_fx[0], extract_l( Mult_32_16( output_Fs, INV_FRAME_PER_SEC_Q15 ) ), sub( hStereoDft->q_dft, hSCE->q_save_synth_fx ) ); // q_dft
        hSCE->q_save_synth_fx = hStereoDft->q_dft;
        move16();
    }
    FOR( ii = 0; ii < CPE_CHANNELS; ii++ )
    {
        scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hCPE->hStereoDft->q_dft, Q11 ) ); // q_dft
        scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( output_Fs, STEREO_DFT32MS_OVL_NS ), sub( hStereoDft->q_dft, Q11 ) ); // q_dft
        hCPE->q_output_mem_fx[ii] = hStereoDft->q_dft;
        move16();
    }
    FOR( ii = 0; ii < CPE_CHANNELS; ii++ )
    {
        Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx
        Scale_sig32( &hCPE->prev_synth_fx[ii][0], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( hCPE->q_prev_synth_fx, Q11 ) ); // q_prev_synth_fx
    }

    /*----------------------------------------------------------------*
@@ -1441,10 +1449,10 @@ void ivas_sba_dirac_stereo_dec_fx(
    q_dft[1] = hStereoDft->q_dft;
    move16();

    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*/
    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*/
    IF( hSCE != NULL )
    {
        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*/
        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*/
        hSCE->q_prev_hb_synth_fx = hStereoDft->q_dft;
        move16();
    }
@@ -1474,7 +1482,7 @@ void ivas_sba_dirac_stereo_dec_fx(
    ivas_sba_dirac_stereo_config( hStereoDft->hConfig );
    test();
    test();
    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 ) );
    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 ) );
    stereo_dft_dec_update_fx( hStereoDft, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ );
    IF( GT_16( st_ivas->nchan_transport, 1 ) )
    {
@@ -1516,7 +1524,7 @@ void ivas_sba_dirac_stereo_dec_fx(

    /* DFT Stereo upmix */
    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 ) );
                       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 ) );

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

    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*/
    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*/
    IF( hSCE != NULL )
    {
        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*/
        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*/
        hSCE->q_prev_hb_synth_fx = Q11;
        move16();
    }
@@ -1598,14 +1606,14 @@ void ivas_sba_dirac_stereo_dec_fx(

    FOR( ii = 0; ii < CPE_CHANNELS; ii++ )
    {
        Scale_sig32( hCPE->prev_synth_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->q_prev_synth_fx ) ); // Q11
        Scale_sig32( hCPE->prev_synth_fx[ii], NS2SA_FX2( output_Fs, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->q_prev_synth_fx ) ); // Q11
    }

    scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) );
    scale_sig32( hCPE->input_mem_BPF_fx[0], STEREO_DFT32MS_OVL_16k, sub( Q11, hStereoDft->q_dft ) );
    FOR( i = 0; i < CPE_CHANNELS; ++i )
    {
        scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hCPE->hStereoDft->q_dft ) );                                          // Q11
        scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11
        scale_sig32( hCPE->input_mem_LB_fx[i], STEREO_DFT32MS_OVL_16k, sub( Q11, hStereoDft->q_dft ) );                     // Q11
        scale_sig32( hCPE->input_mem_fx[i], NS2SA_FX2( output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hStereoDft->q_dft ) ); // Q11
    }

    IF( hCPE->hCoreCoder[0] != NULL )
@@ -1617,9 +1625,13 @@ void ivas_sba_dirac_stereo_dec_fx(
        Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, L_FRAME48k, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda - q ); // Q_old_wtda_LB
#endif
    }
    IF( hCPE->hStereoDft != NULL )
    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();
@@ -1639,13 +1651,13 @@ void ivas_sba_dirac_stereo_dec_fx(
                test();
                IF( ( ( st->last_core != ACELP_CORE || ( EQ_16( st->prev_bfi, 1 ) && st->last_core == ACELP_CORE && EQ_16( st->last_con_tcx, 1 ) ) ) && NE_16( st->last_core, AMR_WB_CORE ) ) || ( st_ivas->sba_dirac_stereo_flag && EQ_16( st->cng_type, FD_CNG ) ) ) /* TCX / HQ-CORE -> TCX / HQ-CORE */
                {
                    scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11
                    scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( Q11, hStereoDft->q_dft ) ); // Q11
                }
                ELSE IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) || EQ_16( st->core, HQ_CORE ) ) /* ACELP -> TCX/HQ */
                {
                    IF( !st->tcxonly )
                    {
                        scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11
                        scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( Q11, hStereoDft->q_dft ) ); // Q11
                    }
                }
            }
@@ -1661,7 +1673,7 @@ void ivas_sba_dirac_stereo_dec_fx(
                    test();
                    IF( ( LE_16( st->last_L_frame, L_FRAME16k ) && LE_16( st->L_frame, L_FRAME16k ) ) || ( st_ivas->sba_dirac_stereo_flag && EQ_32( st->core_brate, SID_2k40 ) && EQ_16( st->cng_type, FD_CNG ) ) )
                    {
                        scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11
                        scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA_FX2( L_mult0( s_max( hCPE->hCoreCoder[0]->L_frame, hCPE->hCoreCoder[0]->last_L_frame ), FRAMES_PER_SEC ), STEREO_DFT32MS_OVL_NS ), sub( Q11, hStereoDft->q_dft ) ); // Q11
                    }
                }
            }
@@ -1670,11 +1682,11 @@ void ivas_sba_dirac_stereo_dec_fx(
#ifdef REMOVE_UNUSED_CODE_IVAS_DEC
        IF( NE_32( st_ivas->ivas_format, SBA_FORMAT ) )
        {
            scale_sig32( hCPE->hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11
            scale_sig32( hStereoDft->buff_LBTCX_mem_fx, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ), sub( Q11, hStereoDft->q_dft ) ); // Q11
        }
#endif
        scale_sig32( hCPE->hStereoDft->ap_delay_mem_fx, NS2SA_FX2( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hCPE->hStereoDft->q_ap_fade_mem_fx ) ); // Q11
        hCPE->hStereoDft->q_ap_fade_mem_fx = Q11;
        scale_sig32( hStereoDft->ap_delay_mem_fx, NS2SA_FX2( 16000, DELAY_BWE_TOTAL_NS ), sub( Q11, hStereoDft->q_ap_fade_mem_fx ) ); // Q11
        hStereoDft->q_ap_fade_mem_fx = Q11;
        test();
    }

@@ -1688,7 +1700,7 @@ void ivas_sba_dirac_stereo_dec_fx(

    FOR( ii = 0; ii < CPE_CHANNELS; ii++ )
    {
        scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hCPE->hStereoDft->q_dft ) ); // Q11
        scale_sig32( hCPE->output_mem_fx[ii], NS2SA_FX2( output_Fs, STEREO_DFT32MS_OVL_NS ), sub( Q11, hStereoDft->q_dft ) ); // Q11
        hCPE->q_output_mem_fx[ii] = Q11;
        move16();
    }