Commit 6c3c58e6 authored by Manuel Jander's avatar Manuel Jander
Browse files

Make q_win dependent on multichannel mode to avoid saturation of downmix signals.

parent 11531186
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@
#define TEST_HR
#define REMOVE_EVS_DUPLICATES                   /* remove core-coder duplicated functions, ACELP low-band decoder */

//#define FIX_1348_BIT_PRECISION_IMPROVEMENT
//#define FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
#define FIX_1348_BIT_PRECISION_IMPROVEMENT
#define FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD
//#define FIX_1348_BIT_PRECISION_IMPROVEMENT_ROUND_OLD_BUFF
#endif
+3 −0
Original line number Diff line number Diff line
@@ -10004,6 +10004,9 @@ void ivas_mdct_core_reconstruct_fx(
    /* o  : synthesis @output_FS                */ // e_sig
    Word16 fUseTns[CPE_CHANNELS][NB_DIV],          /* i  : flage TNS enabled                   */
    const Word16 MCT_flag,                         /* i  : hMCT handle allocated (1) or not (0)*/
#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
    const Word16 isParamMC,
#endif
    Word16 q_x,
    Word16 e_sig[CPE_CHANNELS] );
+4 −0
Original line number Diff line number Diff line
@@ -346,7 +346,11 @@ ivas_error ivas_mct_dec_fx(
        }
        Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->old_Aq_12_8_fx, hCPE->hCoreCoder[0]->old_Aq_12_8_fx_32, add( M, 1 ), sub( 28, sub( 15, norm_s( sub( hCPE->hCoreCoder[0]->old_Aq_12_8_fx[0], 1 ) ) ) ) );
        Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[1]->old_Aq_12_8_fx, hCPE->hCoreCoder[1]->old_Aq_12_8_fx_32, add( M, 1 ), sub( 28, sub( 15, norm_s( sub( hCPE->hCoreCoder[1]->old_Aq_12_8_fx[0], 1 ) ) ) ) );
#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
        ivas_mdct_core_reconstruct_fx( hCPE, x_fx, synth_fx, fUseTns[cpe_id], 1, st_ivas->mc_mode == MC_MODE_PARAMMC, q_output, e_sig );
#else
        ivas_mdct_core_reconstruct_fx( hCPE, x_fx, synth_fx, fUseTns[cpe_id], 1, q_output, e_sig );
#endif

        Word16 hdrm, sh;
        hdrm = getScaleFactor16( synth_fx[0], hCPE->hCoreCoder[0]->hTcxDec->L_frameTCX );
+9 −1
Original line number Diff line number Diff line
@@ -1083,6 +1083,9 @@ void ivas_mdct_core_reconstruct_fx(
    /* o  : synthesis @output_FS                */ // e_sig
    Word16 fUseTns[CPE_CHANNELS][NB_DIV],          /* i  : flage TNS enabled                   */
    const Word16 MCT_flag,                         /* i  : hMCT handle allocated (1) or not (0)*/
#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
    const Word16 isParamMC,
#endif
    Word16 q_x,
    Word16 e_sig[CPE_CHANNELS] )
{
@@ -1122,6 +1125,11 @@ void ivas_mdct_core_reconstruct_fx(
    bfi = sts[0]->bfi;
    move16();

#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
    if ( isParamMC )
        q_win = -2;
#endif

    /* TNS, ITF, IMDCT and updates */
    FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
    {
@@ -1265,7 +1273,7 @@ void ivas_mdct_core_reconstruct_fx(
            st->hHQ_core->Q_old_wtda_LB = st->Q_syn;
            move16();
#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
            Scale_sig( st->mem_syn2_fx, M, -1 ); // -1 should be calculated from q_win.
            Scale_sig( st->mem_syn2_fx, M, sub( negate( q_win ), 2 ) );
#endif
        }
        ELSE /*ACELP core for ACELP-PLC */
+4 −0
Original line number Diff line number Diff line
@@ -550,7 +550,11 @@ void stereo_mdct_core_dec_fx(
    }
    Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[0]->old_Aq_12_8_fx, hCPE->hCoreCoder[0]->old_Aq_12_8_fx_32, M + 1, sub( 28, sub( 15, norm_s( sub( hCPE->hCoreCoder[0]->old_Aq_12_8_fx[0], 1 ) ) ) ) ); /* Q28 */
    Copy_Scale_sig_16_32_no_sat( hCPE->hCoreCoder[1]->old_Aq_12_8_fx, hCPE->hCoreCoder[1]->old_Aq_12_8_fx_32, M + 1, sub( 28, sub( 15, norm_s( sub( hCPE->hCoreCoder[1]->old_Aq_12_8_fx[0], 1 ) ) ) ) ); /* Q28 */
#ifdef FIX_1348_BIT_PRECISION_IMPROVEMENT
    ivas_mdct_core_reconstruct_fx( hCPE, x_fx, signal_outFB_tmp_fx, fUseTns, 0, st_ivas->mc_mode == MC_MODE_PARAMMC, Q11, e_sigFB );
#else
    ivas_mdct_core_reconstruct_fx( hCPE, x_fx, signal_outFB_tmp_fx, fUseTns, 0, Q11, e_sigFB );
#endif

    Copy32( signal_out_tmp_fx[0], signal_out_fx[0], L_FRAME48k ); /* Q11 */
    Copy32( signal_out_tmp_fx[1], signal_out_fx[1], L_FRAME48k ); /* Q11 */