Commit 221c8143 authored by multrus's avatar multrus
Browse files

Merge branch...

Merge branch 'basop-2549-old_inp_16k_fx-potentially-wrong-scale-in-stereo_mdct_core_enc_fx' into 'main'

[non-BE] Resolve "old_inp_16k_fx potentially wrong scale in stereo_mdct_core_enc_fx()"

Closes #2549

See merge request !2968
parents daee8078 c0e4fc38
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -6099,7 +6099,12 @@ UWord16 get_indice_st(

void stereo_mdct_core_enc_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                   */
#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
    Word16 new_samples[CPE_CHANNELS][L_INP],                    /* i  : new samples                new_samples_q*/
    Word16 *new_samples_q,
#else
    Word16 new_samples[CPE_CHANNELS][L_INP],                    /* i  : new samples                       Qnew-1*/
#endif
    Word16 old_wsp[CPE_CHANNELS][L_WSP],                        /* i  : 12.8kHz weighted speech (for LTP      Qx*/
    Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k]              /* o  : floating pitch for each subframe      Q6*/
);
@@ -6146,7 +6151,12 @@ void stereo_switching_dec_fx(

void ivas_mdct_core_whitening_enc_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                   */
#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
    Word16 new_samples_fx[CPE_CHANNELS][L_INP],                 /* i  : new samples                    Q_new[]-1*/
    Word16 *Q_new,                                              /* i  : new samples q                           */
#else
    Word16 new_samples_fx[CPE_CHANNELS][L_INP],                 /* i  : new samples                             */
#endif
    Word16 old_wsp_fx[CPE_CHANNELS][L_WSP],                     /* i  : 12.8kHz weighted speech (for LTP        */
    Word16 pitch_buf[CPE_CHANNELS][NB_SUBFR16k],                /* o  : floating pitch for each subframe        */
    Word32 *mdst_spectrum_long[CPE_CHANNELS],                   /* o  : buffer for MDST spectrum                */
+1 −0
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@
#define FIX_FLOAT_1573_POSITION_UPDATE                  /* Eri: Float issue 1573: For static orientation and listener movement, the PoseUpdated flag is cleared and prevents 5 ms update rate. */
#define FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS         /* FhG: BASOP issue 2521: Fix wrong porting for determination of first subframe length in ivas_sba_dirac_stereo_compute_td_stefi_nrgs() */
#define FIX_1452_DEFAULT_REVERB                         /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */
#define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549       /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */
#define FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC        /* VA : Basop issue 2547: Align conditions in core sw dec */
#define FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC_EVS    /* VA : Basop issue 2547: Align conditions in core sw dec, condition that could affect EVS as well, but adapted to keep EVS BE */
#define FIX_BASOP_2548_ProcessIGF_fx_PREDICTIONGAIN     /* FhG: fixes obvious bug for IVAS path. For EVS path, issue is still not resolved */
+1 −1
Original line number Diff line number Diff line
@@ -474,7 +474,7 @@ void core_signal_analysis_high_bitrate_fx(

void core_signal_analysis_high_bitrate_ivas_fx(
#ifdef NONBE_FIX_ISSUE_2206
    const Word16 *new_samples, /*i  : *Q_new */
    const Word16 *new_samples, /*i  : *Q_new-1 */
#else
    const Word16 *new_samples, /*i : Q0 */
#endif
+16 −1
Original line number Diff line number Diff line
@@ -433,7 +433,7 @@ ivas_error ivas_core_enc_fx(
                FOR( n = 0; n < n_CoreChannels; n++ )
                {
                    st = sts[n];
#ifndef NONBE_FIX_ISSUE_2206
#ifndef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
                    Scale_sig( old_inp_16k_fx[n], L_INP, sub( Q1, Q_new[n] ) ); // Q0
#endif
                    IF( NE_16( st->element_mode, IVAS_CPE_DFT ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) )
@@ -448,15 +448,22 @@ ivas_error ivas_core_enc_fx(
                Q_spec_old[1] = hCPE->hCoreCoder[1]->hTcxEnc->spectrum_long_e;
                move16();

#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
                ivas_mdct_core_whitening_enc_fx( hCPE, old_inp_16k_fx, Q_new, old_wsp_fx, pitch_buf_fx_new, hMCT->p_mdst_spectrum_long_fx[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long_fx[cpe_id],
                                                 hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, 1, hMCT->nchan_out_woLFE, mdst_spectrum_e, orig_spectrum_e );
#else
                ivas_mdct_core_whitening_enc_fx( hCPE, old_inp_16k_fx, old_wsp_fx, pitch_buf_fx_new, hMCT->p_mdst_spectrum_long_fx[cpe_id], hMCT->tnsBits[cpe_id], hMCT->p_orig_spectrum_long_fx[cpe_id],
                                                 hMCT->tnsSize[cpe_id], hMCT->p_param[cpe_id], hMCT->hBstr, 1, hMCT->nchan_out_woLFE, mdst_spectrum_e, orig_spectrum_e );
#endif

                FOR( i = 0; i < CPE_CHANNELS; i++ )
                {
                    st = sts[i];
                    Word16 nSubframes = NB_DIV;
                    move16();
#ifndef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
                    Scale_sig( old_inp_16k_fx[i], L_INP, sub( Q_new[i], Q1 ) ); // Q_new[n] - 1
#endif
                    if ( EQ_16( st->hTcxEnc->tcxMode, TCX_20 ) )
                    {
                        nSubframes = 1;
@@ -521,7 +528,9 @@ ivas_error ivas_core_enc_fx(
                FOR( i = 0; i < CPE_CHANNELS; i++ )
                {
                    st = sts[i];
#ifndef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
                    Scale_sig( old_inp_16k_fx[i], L_INP, sub( Q1, Q_new[i] ) ); // Q0
#endif

                    test();
                    IF( NE_16( st->element_mode, IVAS_CPE_DFT ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) )
@@ -556,11 +565,17 @@ ivas_error ivas_core_enc_fx(
                Q_spec_old[1] = hCPE->hCoreCoder[1]->hTcxEnc->spectrum_long_e;
                move16();

#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
                stereo_mdct_core_enc_fx( hCPE, old_inp_16k_fx, Q_new, old_wsp_fx, pitch_buf_fx );
#else
                stereo_mdct_core_enc_fx( hCPE, old_inp_16k_fx, old_wsp_fx, pitch_buf_fx );
#endif

                FOR( i = 0; i < CPE_CHANNELS; i++ )
                {
#ifndef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
                    Scale_sig( old_inp_16k_fx[i], L_INP, sub( Q_new[i], Q1 ) ); // Q_new[n] - 1
#endif
                    st = sts[i];
                    IF( EQ_16( st->hTcxEnc->tcxMode, TCX_20 ) )
                    {
+15 −4
Original line number Diff line number Diff line
@@ -1164,7 +1164,12 @@ static void compute_power_spec(

void ivas_mdct_core_whitening_enc_fx(
    CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure                 */
#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
    Word16 new_samples_fx[CPE_CHANNELS][L_INP], /* i  : new samples                      Q_new[]-1*/
    Word16 *Q_new,                              /* i  : new samples q                             */
#else
    Word16 new_samples_fx[CPE_CHANNELS][L_INP], /* i  : new samples                             Q0*/
#endif
    Word16 old_wsp_fx[CPE_CHANNELS][L_WSP],         /* i  : 12.8kHz weighted speech (for LTP    Qx*/
    Word16 pitch_buf_fx[CPE_CHANNELS][NB_SUBFR16k], /* o  : floating pitch for each subframe    Q6*/
    Word32 *mdst_spectrum_long_fx[CPE_CHANNELS],    /* o  : buffer for MDST spectrum              mdst_spectrum_e*/
@@ -1204,7 +1209,9 @@ void ivas_mdct_core_whitening_enc_fx(
    Word16 zero_side_flag[NB_DIV];
    Word16 q_com, q_min;
    Word32 *mdst_spectrum_fx[CPE_CHANNELS][NB_DIV];
#ifndef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
    Word16 Q_new;
#endif
    Word16 q_windowedSignal[CPE_CHANNELS];
    Word16 shift = 0; /* 0 for one subframe and 1 for two subframes*/
    Word16 *speech;
@@ -1323,10 +1330,14 @@ void ivas_mdct_core_whitening_enc_fx(

        tcx_ltp_encode_ivas_fx( st, st->hTcxEnc->tcxMode, L_FRAME, old_wsp_fx[ch] + L_WSP_MEM + L_LOOK_12k8, NULL, old_wsp_fx[ch] + L_WSP_MEM + L_LOOK_12k8, T_op[ch], &param_core[ch][1 + NOISE_FILL_RANGES], &ltpBits[ch], NULL, 0, IVAS_CPE_MDCT );

#ifdef NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549
        core_signal_analysis_high_bitrate_ivas_fx( new_samples_fx[ch] + L_INP_MEM, T_op[ch], NULL, NULL, st, tnsSize[ch], tnsBits[ch], param_core[ch], &ltpBits[ch], windowedSignal_fx[ch], st->L_frame, st->hTcxEnc->L_frameTCX, hCPE->last_element_mode, 0, mdst_spectrum_fx[ch], mdst_spectrum_e[ch], Q_new, &q_windowedSignal[ch] );
#else
        Q_new = 0;
        move16();

        core_signal_analysis_high_bitrate_ivas_fx( new_samples_fx[ch] + L_INP_MEM, T_op[ch], NULL, NULL, st, tnsSize[ch], tnsBits[ch], param_core[ch], &ltpBits[ch], windowedSignal_fx[ch], st->L_frame, st->hTcxEnc->L_frameTCX, hCPE->last_element_mode, 0, mdst_spectrum_fx[ch], mdst_spectrum_e[ch], &Q_new, &q_windowedSignal[ch] );
#endif

        /* BWD in MDCT domain */
        IF( NE_16( st->hTcxCfg->tcx_last_overlap_mode, TRANSITION_OVERLAP ) )
Loading