Commit 1b02d8c2 authored by Manuel Jander's avatar Manuel Jander
Browse files

Remove all q_old_out_something variables and use Q_old_wtda/Q_old_wtda_LB...

Remove all q_old_out_something variables and use Q_old_wtda/Q_old_wtda_LB instead. Cleanup some not needed rescaling of old_out buffers. Resolves some regression cases.
parent 016e1193
Loading
Loading
Loading
Loading
Loading
+9 −12
Original line number Diff line number Diff line
@@ -3665,12 +3665,14 @@ void decoder_tcx_ivas_fx(
    Scale_sig( st->hTcxDec->syn_Overl_TDAC, L_FRAME32k / 2, sub( st->Q_syn, st->hTcxDec->Q_syn_Overl_TDAC ) ); // Scaling to Q_syn
    st->hTcxDec->Q_syn_Overl_TDAC = st->Q_syn;
    move16();
    Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, negate( st->hHQ_core->Q_old_wtda ) );       // Scaling to Q_syn
    Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, negate( st->hHQ_core->Q_old_wtda_LB ) ); // Scaling to Q_syn
#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
    Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, negate( st->hHQ_core->Q_old_wtda ) );       // Scaling to Q0
    Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, negate( st->hHQ_core->Q_old_wtda_LB ) ); // Scaling to Q0
    st->hHQ_core->Q_old_wtda = 0;
    move16();
    st->hHQ_core->Q_old_wtda_LB = 0;
    move16();
#endif

    Scale_sig( st->hTcxDec->old_syn_Overl, 320, st->Q_syn - st->hTcxDec->Q_old_syn_Overl ); // Scaling to Q_syn
    st->hTcxDec->Q_old_syn_Overl = st->Q_syn;
@@ -3686,12 +3688,7 @@ void decoder_tcx_ivas_fx(
    Scale_sig( synth_fx, L_frame_glob, negate( st->Q_syn ) );
    Scale_sig( synthFB_fx, L_frameTCX_glob, negate( st->Q_syn ) );
    // Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, 1 );
#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
    st->hHQ_core->Q_old_wtda = st->hHQ_core->q_old_out_fx;
    // Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, ( sub( st->hHQ_core->Q_old_wtda, st->Q_syn ) ) );
    st->hHQ_core->Q_old_wtda_LB = st->hHQ_core->q_old_out_LB_fx;
    // Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, ( sub( st->hHQ_core->Q_old_wtda, st->Q_syn ) ) );
#else
#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
    st->hHQ_core->Q_old_wtda = st->Q_syn;
    // Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, ( sub( st->hHQ_core->Q_old_wtda, st->Q_syn ) ) );
    st->hHQ_core->Q_old_wtda_LB = st->Q_syn;
@@ -5267,7 +5264,7 @@ void decoder_tcx_imdct_fx(
        IMDCT_ivas_fx( xn_bufFB_fx, q_x, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf_fx, hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2,
                       hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index,
#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
                       kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, &st->hHQ_core->q_old_out_LB_fx, 0, st, 0, acelp_zir_fx, q_win );
                       kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, &st->hHQ_core->Q_old_wtda_LB, 0, st, 0, acelp_zir_fx, q_win );
#else
                       kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, 0, st, 0, acelp_zir_fx, q_win );
#endif
@@ -5293,7 +5290,7 @@ void decoder_tcx_imdct_fx(

        IMDCT_ivas_fx( xn_bufFB_fx, q_x, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, xn_buf_fx, hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_half_length, hTcxCfg->tcx_mdct_window_min_length, index,
#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
                       kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, &st->hHQ_core->q_old_out_LB_fx, 0, st, 0, acelp_zir_fx, q_win );
                       kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, &st->hHQ_core->Q_old_wtda_LB, 0, st, 0, acelp_zir_fx, q_win );
#else
                       kernelType, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frame_glob, frame_cnt, bfi, st->hHQ_core->old_out_LB_fx, 0, st, 0, acelp_zir_fx, q_win );
#endif
@@ -5314,7 +5311,7 @@ void decoder_tcx_imdct_fx(
        IMDCT_ivas_fx( x_tmp_fx, q_x, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB_fx_16, hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB,
                       hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index,
#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
                       kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, &st->hHQ_core->q_old_out_fx, 1, st, ratio, acelp_zir_fx, q_win );
                       kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, &st->hHQ_core->Q_old_wtda, 1, st, ratio, acelp_zir_fx, q_win );
#else
                       kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, 1, st, ratio, acelp_zir_fx, q_win );
#endif
@@ -5324,7 +5321,7 @@ void decoder_tcx_imdct_fx(

        IMDCT_ivas_fx( x_fx, q_x, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, xn_bufFB_fx_16, hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_half_lengthFB, hTcxCfg->tcx_mdct_window_min_lengthFB, index,
#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
                       kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, &st->hHQ_core->q_old_out_fx, 1, st, ratio, acelp_zir_fx, q_win );
                       kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, &st->hHQ_core->Q_old_wtda, 1, st, ratio, acelp_zir_fx, q_win );
#else
                       kernelType, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, shr( s_max( L_frameTCX, L_spec ), 1 ), L_frameTCX_glob, frame_cnt, bfi, st->hHQ_core->old_out_fx, 1, st, ratio, acelp_zir_fx, q_win );
#endif
+0 −4
Original line number Diff line number Diff line
@@ -1202,10 +1202,6 @@ void HQ_core_dec_init_fx(
    hHQ_core->Q_old_wtda = 15;
    hHQ_core->Q_old_postdec = 0;
    hHQ_core->Q_old_wtda_LB = 0;
#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
    hHQ_core->q_old_out_fx = 0;
    hHQ_core->q_old_out_LB_fx = 0;
#endif
    move16();
    move16();
    move16();
+2 −0
Original line number Diff line number Diff line
@@ -578,12 +578,14 @@ ivas_error ivas_core_dec_fx(
            /* TCX decoder */
            Scale_sig( st->hPFstat->mem_stp, L_SUBFR, -Qsyn_temp );                             // Q0
            Scale_sig( st->hPFstat->mem_pf_in, L_SUBFR, -Qsyn_temp );                           // Q0
#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT
            Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, -st->hHQ_core->Q_old_wtda_LB ); // Q0
            Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, -st->hHQ_core->Q_old_wtda );       // Q0
            st->hHQ_core->Q_old_wtda_LB = 0;
            move16();
            st->hHQ_core->Q_old_wtda = 0;
            move16();
#endif

            IF( st_ivas == NULL )
            {
+2 −0
Original line number Diff line number Diff line
@@ -132,7 +132,9 @@ ivas_error ivas_cpe_dec_fx(
        IF( hCPE->hCoreCoder[ind1]->hHQ_core )
        {
            Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[ind1]->hHQ_core->old_out_LB_fx32, L_FRAME32k, sub( Q11, hCPE->hCoreCoder[ind1]->hHQ_core->Q_old_wtda_LB ) ); // Q11
#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT
            hCPE->hCoreCoder[ind1]->hHQ_core->q_old_outLB_fx = Q11;
#endif
            move16();
        }
    }
+6 −1
Original line number Diff line number Diff line
@@ -434,8 +434,10 @@ ivas_error ivas_jbm_dec_tc_fx(
                {
                    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
                    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
#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT
                    hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q;
                    move16();
#endif
                }
                IF( hCPE->hStereoDft != NULL )
                {
@@ -950,8 +952,10 @@ ivas_error ivas_jbm_dec_tc_fx(
                {
                    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, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ) ); // q
                    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, sub( q, hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda ) );          // q
#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT
                    hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q;
                    move16();
#endif
                }
                IF( hCPE->hStereoDft != NULL )
                {
@@ -996,7 +1000,6 @@ ivas_error ivas_jbm_dec_tc_fx(

                IF( hCPE->hCoreCoder[0] != NULL )
                {

                    Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, sub( hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB, q ) ); // Q_old_wtda_LB
                    Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->hHQ_core->old_out_fx32, hCPE->hCoreCoder[0]->hHQ_core->old_out_fx, L_FRAME48k, sub( hCPE->hCoreCoder[0]->hHQ_core->Q_old_wtda, q ) );          // Q_old_wtda
                }
@@ -1386,8 +1389,10 @@ ivas_error ivas_jbm_dec_tc_fx(
                {
                    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
                    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
#ifndef FIX_1348_BIT_PRECISION_IMPROVEMENT
                    hCPE->hCoreCoder[0]->hHQ_core->q_old_outLB_fx = q;
                    move16();
#endif
                }
                IF( hCPE->hStereoDft != NULL )
                {
Loading