Commit 9431fd35 authored by Manuel Jander's avatar Manuel Jander
Browse files

Merge from main

parent 7739e6e6
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -2665,6 +2665,12 @@ void ms_inv_mask_processing_fx(
    const Word32 x_1_fx[],                   /* i  : spectrum 2                              */
    Word32 x_inv_0_fx[],                     /* o  : inverse spectrum 1                      */
    Word32 x_inv_1_fx[],                     /* o  : inverse spectrum 2                      */
#ifdef FIX_1464_NO_SINGLE_SPEC_Q
    Word16 *x_0_e,
    Word16 *x_1_e,
    Word16 *x_inv_0_e,
    Word16 *x_inv_1_e,
#endif
    Word16 maxSfb                            /* i  : number of stereo frequency bands        */
);

@@ -2675,6 +2681,10 @@ void ms_processing_fx(
    const Word16 iSubframe,                  /* i  : subframe number                 */
    Word32 x_0_fx[],                         /* i/o: spectrum 1                      */
    Word32 x_1_fx[],                         /* i/o: spectrum 1                      */
#ifdef FIX_1464_NO_SINGLE_SPEC_Q
    Word16 *x_0_e,
    Word16 *x_1_e,
#endif
    Word16 maxSfb                            /* i  : number of stereo frequency bands*/
);

@@ -2682,6 +2692,10 @@ void convertToMS_fx(
    const Word16 L_frame, /* i  : frame length                    */
    Word32 x0[],          /* i/o: mid/left channel coefficients   */
    Word32 x1[],          /* i/o: side/right channel coefficients */
#ifdef FIX_1464_NO_SINGLE_SPEC_Q
    Word16 *x0_e,
    Word16 *x1_e,
#endif
    const Word32 norm_fac /* i  : normalization factor            */
);

@@ -2695,7 +2709,12 @@ void IGFEncStereoEncoder_fx(
    const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i  : IGF handle                              */
    const Word32 *mdctSpectrumL_fx,        /* i  : left spectrum                           */
    const Word32 *mdctSpectrumR_fx,        /* i  : right spectrum                          */
#ifdef FIX_1464_NO_SINGLE_SPEC_Q
    const Word16 mdctSpectrumL_e,
    const Word16 mdctSpectrumR_e,
#else
    Word16 q_mdctSpectrum,
#endif
    Word16 *msMask,                /* i/o: MS mask                                 */
    Word16 *igfStereoMode,         /* o  : IGF stereo mode                         */
    const Word16 mdct_stereo_mode, /* i  : MDCT stereo mode                        */
@@ -2711,7 +2730,13 @@ void stereo_coder_tcx_fx(
    Word32 *inv_spectrum_fx[CPE_CHANNELS][NB_DIV],      /* i/o: inverse spectrum                */
    Word32 *inv_mdst_spectrum_fx[CPE_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum           */
    const Word16 mct_on,                                /* i  : flag mct block (1) or stereo (0)  */
#ifdef FIX_1464_NO_SINGLE_SPEC_Q
    Word16 mdst_spectrum_e[CPE_CHANNELS][NB_DIV],
    Word16 inv_spectrum_e[CPE_CHANNELS][NB_DIV],
    Word16 inv_mdst_spectrum_e[CPE_CHANNELS][NB_DIV]);
#else
    Word16 q_spec );
#endif

// bw_detect_fx.c
Word16 set_bw_mct_fx(
@@ -2740,6 +2765,11 @@ void apply_MCT_enc_fx(
    Word32 *mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV],     /* i/o: MDST spectrum                       */
    Word32 *inv_spectrum[MCT_MAX_CHANNELS][NB_DIV],      /* i/o: inverse spectrum                    */
    Word32 *inv_mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum               */
 #ifdef FIX_1464_NO_SINGLE_SPEC_Q
    Word16 mdst_spectrum_e[MCT_MAX_CHANNELS][NB_DIV],     /* i/o: MDST spectrum exponent             Q0*/
    Word16 inv_spectrum_e[MCT_MAX_CHANNELS][NB_DIV],      /* i/o: inv spectrum exponent             Q0*/
    Word16 inv_mdst_spectrum_e[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum exponent     Q0*/
 #endif
    const Word16 nchan                                   /* i  : number of channels                  */
);

+93 −116
Original line number Diff line number Diff line
@@ -71,35 +71,10 @@

#define FIX_1378_ACELP_OUT_OF_BOUNDS

#define FIX_1464_SQ_GAIN_PRECISION
#define FIX_1464_NO_SINGLE_SPEC_Q

/* Note: each compile switch (FIX_1101_...) is independent from the other ones */
#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_MADD_ADD_WEIGHTS  /* FhG: Defines 1.0f-weight variables, uses Madd operation instead of L_add_sat */
#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_SPLIT_LOOPS           /* FhG: Splits single loop with IF-statements into two low-complex loops */
#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_HQ_CONSTANTS          /* FhG: IMPROVE PRECISION: Uses 1/6 and 1/20 in full-precise Q31 constants instead of Q15 */
#define FIX_1101_IVAS_SPAR_DEC_UPMIXER_SF_USE_UNIQUE_SHL        /* FhG: Uses unique shift amount in each loop iteration */
#define FIX_11_1_IVAS_SPAR_DEC_UPMIXER_SF_RND_COEFFS            /* FhG  ivas_spar_com.c: Zeroes very small negative coeffs via L_shr_r (was L_shr) */
#define FIX_ISSUE_1237                          /* VA: replacement of Copy_Scale_sig_16_32_DEPREC() that are doing 16 bits left shift by Copy_Scale_sig_16_32_no_sat() */
#define FIX_ISSUE_1237_KEEP_EVS_BE              /* VA: Fix to keep EVS bitexactness to 26.444 */
#define FIX_ISSUE_1214                          /* Ittiam: Fix for issue 1214: Energy leakage in IGF tiles for MDCT-stereo @64kbps SWB*/
#define FIX_881_HILBERT_FILTER                  /* VA: improve the precision of the Hilbert filter to remove 2kHz unwanted tone */
#define FIX_ISSUE_1245                          /* Ittiam: Fix for issue 1245: Basop Encoder: Audible noise for silent Stereo input DTX on @24.4 kbps, @32 kbps*/
#define FIX_ISSUE_1291                          /* Ittiam: Wrong use of imult1616() in ACELP rescaling */
#define FIX_920_IGF_INIT_ERROR                  /* FhG: issue 920: fix bitrate mismatch in initial IGF config to avoid error message in same cases */
#define FIX_MINOR_SVD_WMOPS_MR1010X             /* FhG: Minor WMOPS tuning, bit-exact to previous version, saves about 8.2 WMOPS for MR1010 */
#define SVD_WMOPS_OPT                           /* Ittiam : SVD related optimizations */
#define NONBE_FIX_1087_OOB_SBA_DTX_RS           /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */
#define FIX_ISSUE_1279                          /* VA: correction of wrong scaling update */
#define FIX_ISSUE_1247
#define NONBE_FIX_1087_OOB_SBA_DTX_RS                   /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */
#define FIX_1285_DECODER_CRASH
#define FIX_1072_SPEEDUP_gainpanning            /* FhG: Minor WMOPS tuning, nonbe */
#define FIX_1072_SPEEDUP_COMPUTEDIFUSENESS      /* FhG: Minor WMOPS tuning, nonbe */
#define FIX_1320_LOWRATE_ACELP
#define FIX_1297_OVERFLOW                       /* VA: fixes issue with overflows in pre-processing */
#define FIX_1298                                /* VA: fix possible assert in gaus_enc */
#define FIX_1300_ICA_SHIFT_QUANT_IMPROV         /* VA: Fix to 1300 to improve precision of the lag quantizer */
#define FIX_1301_CORRECT_TD_CNST                /* VA: Fix 1301, correct wrong constant in TD stereo */
#define NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD      /* VA/Eri: FLP issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP */
#define NONBE_FIX_708_OSBA_BR_SWITCHING_CRASH   /* FhG: issue 708: fix crash in OSBA BR switching with long test vectors */
//#define OPT_STEREO_32KBPS_V1                    /* Optimization made in stereo decoding path for 32kbps decoding */
#define OPT_AVOID_STATE_BUF_RESCALE             /* Optimization made to avoid rescale of synth state buffer */
#define FIX_1310_SPEEDUP_ivas_dirac_dec_get_response_fx                 /*FhG: WMOPS tuning, nonbe*/
@@ -110,6 +85,8 @@
#define HARM_PUSH_BIT
#define HARM_ENC_INIT
//#define HARM_SCE_INIT
#define DIV32_OPT_NEWTON                               /* FhG: faster 32 by 32 bit division */ 
#define	MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE /* FhG: reduce WMOPS of Cy calculation in ivas_param_mc_param_est_enc_fx() by using 64 Bit addition. Obsoletes IMPROVE_HIGH_COMPLEXITY_PARAM_MC_PRM_EST_NONBE. */

#define TEST_HR

+24 −0
Original line number Diff line number Diff line
@@ -2864,7 +2864,12 @@ void FdCngEncodeMDCTStereoSID_fx(
    /* M/S transform on log envelopes */
    IF( is_inp_ms == 0 )
    {
#ifdef FIX_1464_NO_SINGLE_SPEC_Q
        Word16 ms_e = 8;
        convertToMS_fx( N, ms_ptr_fx[0], ms_ptr_fx[1], &ms_e, &ms_e, ONE_IN_Q30 ); // ms_ptr_e = Q23;
#else
        convertToMS_fx( N, ms_ptr_fx[0], ms_ptr_fx[1], ONE_IN_Q30 ); // ms_ptr_e = Q23;
#endif
    }

    gb = find_guarded_bits_fx( N );
@@ -2967,7 +2972,12 @@ void FdCngEncodeMDCTStereoSID_fx(
    /* undo M/S */
    IF( is_inp_ms == 0 )
    {
#ifdef FIX_1464_NO_SINGLE_SPEC_Q
        Word16 ms_e = 0;
        convertToMS_fx( N, ms_ptr_fx[0], ms_ptr_fx[1], &ms_e, &ms_e, ONE_IN_Q31 );
#else
        convertToMS_fx( N, ms_ptr_fx[0], ms_ptr_fx[1], ONE_IN_Q31 );
#endif
    }

    /* Compute gain against original left and right channels */
@@ -3151,7 +3161,14 @@ void FdCngEncodeDiracMDCTStereoSID_fx(
    move16();

    /* M/S transform on log envelopes */
#ifdef FIX_1464_NO_SINGLE_SPEC_Q
    {
        Word16 ms_e = 0;
        convertToMS_fx( N[0], ms_ptr_fx[0], ms_ptr_fx[1], &ms_e, &ms_e, ONE_IN_Q30 );
    }
#else
    convertToMS_fx( N[0], ms_ptr_fx[0], ms_ptr_fx[1], ONE_IN_Q30 );
#endif
    E_fx[0] = 0;
    move32();
    FOR( p = 0; p < N[0]; p++ )
@@ -3234,7 +3251,14 @@ void FdCngEncodeDiracMDCTStereoSID_fx(
    move32();

    /* undo M/S */
#ifdef FIX_1464_NO_SINGLE_SPEC_Q
    {
        Word16 ms_e = 0;
        convertToMS_fx( NPART, ms_ptr_fx[0], ms_ptr_fx[1], &ms_e, &ms_e, ONE_IN_Q31 );
    }
#else
    convertToMS_fx( NPART, ms_ptr_fx[0], ms_ptr_fx[1], ONE_IN_Q31 );
#endif

    /* restore channel noise envelopes */
    FOR( ch = 0; ch < CPE_CHANNELS; ch++ )
+10 −1
Original line number Diff line number Diff line
@@ -241,6 +241,11 @@ void ivas_mct_core_enc_fx(
    Word32 *inv_mdst_spectrum_fx[MCT_MAX_CHANNELS][2];
    Word32 *inv_spectrum_fx[MCT_MAX_CHANNELS][2];
    Word32 *mdst_spectrum_fx[MCT_MAX_CHANNELS][2] = { { NULL } };
#ifdef FIX_1464_NO_SINGLE_SPEC_Q
    Word16 inv_mdst_spectrum_e[MCT_MAX_CHANNELS][2];
    Word16 inv_spectrum_e[MCT_MAX_CHANNELS][2];
    Word16 mdst_spectrum_e[MCT_MAX_CHANNELS][2];
#endif
    Word32 inv_spectrum_long_fx[MCT_MAX_CHANNELS][L_FRAME48k]; /* quantized MDCT spectrum, inv ms mask mdst spectrum, scratch for MS spectra in the MS decision */
    Word16 total_side_bits;
    Word16 chBitRatios[MCT_MAX_CHANNELS];
@@ -398,8 +403,12 @@ void ivas_mct_core_enc_fx(
    /*--------------------------------------------------------------*
     * MCT algorithm
     *---------------------------------------------------------------*/

#ifdef FIX_1464_NO_SINGLE_SPEC_Q
    apply_MCT_enc_fx( hMCT, sts, mdst_spectrum_fx, inv_spectrum_fx, inv_mdst_spectrum_fx, 
        mdst_spectrum_e, inv_spectrum_e, inv_mdst_spectrum_e, nChannels );
#else
    apply_MCT_enc_fx( hMCT, sts, mdst_spectrum_fx, inv_spectrum_fx, inv_mdst_spectrum_fx, nChannels );
#endif

    /*--------------------------------------------------------------*
     * Power spectrum calculation for Noise Estimation
+19 −1
Original line number Diff line number Diff line
@@ -359,7 +359,13 @@ static void getBlockValues_fx(
    Word32 *mdst_spectrum[MCT_MAX_CHANNELS][2],     /* i/o: MDST spectrum, Q = q_spec                     */
    Word32 *inv_spectrum[MCT_MAX_CHANNELS][2],      /* i/o: inverse spectrum, Q = q_spec                  */
    Word32 *inv_mdst_spectrum[MCT_MAX_CHANNELS][2], /* i/o: invers MDST spectrum, Q = q_spec              */
#ifdef FIX_1464_NO_SINGLE_SPEC_Q
    Word16 mdst_spectrum_e[MCT_MAX_CHANNELS][2],
    Word16 inv_spectrum_e[MCT_MAX_CHANNELS][2],
    Word16 inv_mdst_spectrum_e[MCT_MAX_CHANNELS][2]
#else
    Word16 q_spec                                   /* i  : common Q factor of the above spectrum buffers */
#endif
)
{
    Word16 n;
@@ -385,7 +391,11 @@ static void getBlockValues_fx(
    p_st[0] = sts[ch1];
    p_st[1] = sts[ch2];

#ifdef FIX_1464_NO_SINGLE_SPEC_Q
    stereo_coder_tcx_fx( hBlock->hStereoMdct, p_st, hBlock->mask, p_mdst_spectrum, p_inv_spectrum, p_inv_mdst_spectrum, 1, mdst_spectrum_e, inv_spectrum_e, inv_mdst_spectrum_e );
#else
    stereo_coder_tcx_fx( hBlock->hStereoMdct, p_st, hBlock->mask, p_mdst_spectrum, p_inv_spectrum, p_inv_mdst_spectrum, 1, q_spec );
#endif

    test();
    test();
@@ -629,6 +639,11 @@ void apply_MCT_enc_fx(
    Word32 *mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV],     /* i/o: MDST spectrum                       Qx*/
    Word32 *inv_spectrum[MCT_MAX_CHANNELS][NB_DIV],      /* i/o: inverse spectrum                    Qx*/
    Word32 *inv_mdst_spectrum[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum               Qx*/
 #ifdef FIX_1464_NO_SINGLE_SPEC_Q
    Word16 mdst_spectrum_e[MCT_MAX_CHANNELS][NB_DIV],     /* i/o: MDST spectrum exponent             Q0*/
    Word16 inv_spectrum_e[MCT_MAX_CHANNELS][NB_DIV],      /* i/o: inv spectrum exponent             Q0*/
    Word16 inv_mdst_spectrum_e[MCT_MAX_CHANNELS][NB_DIV], /* i/o: inverse MDST spectrum exponent     Q0*/
 #endif
    const Word16 nchan                                   /* i  : number of channels                  */
)
{
@@ -803,8 +818,11 @@ void apply_MCT_enc_fx(
                /* calculate all related values: */
                assert( sts[ch1]->mct_chan_mode != MCT_CHAN_MODE_IGNORE && sts[ch2]->mct_chan_mode != MCT_CHAN_MODE_IGNORE );

#ifdef FIX_1464_NO_SINGLE_SPEC_Q
                getBlockValues_fx( sts, ch1, ch2, hMCT->hBlockData[currBlockDataCnt], mdst_spectrum, inv_spectrum, inv_mdst_spectrum,  mdst_spectrum_e, inv_spectrum_e, inv_mdst_spectrum_e );
#else
                getBlockValues_fx( sts, ch1, ch2, hMCT->hBlockData[currBlockDataCnt], mdst_spectrum, inv_spectrum, inv_mdst_spectrum, sub( 31, sts[0]->hTcxEnc->spectrum_e[0] ) );

#endif
                IF( hMCT->hBlockData[currBlockDataCnt]->isActive == 0 )
                {
                    inactiveBlockDetected = add( inactiveBlockDetected, 1 );
Loading