Commit 4a9fe0c5 authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into ENC_BUFFERS_SCALING

parents 5709d4ff b21e60d2
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -75,7 +75,6 @@
/*#define DISABLE_LIMITER*/

/* ################### Start MAINTENANCE switches ########################### */
#define FIX_2255_ISAR_RENDER_POSES                           /* VA: issue 2255: fix missing check in isar_render_poses() */

/* ################### Start BE switches ################################# */
/* only BE switches wrt wrt. TS 26.251 V3.0 */
@@ -85,6 +84,7 @@
#define FIX_1999_TEMPORARY_DISABLE_DIST_ATT_CHECK       /* Eri: Issue 1999: Range check on float values of distance attenuation, while the float values are not propagated to this function. The test is not correct, but configurable distance attenuation is not used in Characterization.*/
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_2255_ISAR_RENDER_POSES                      /* VA: issue 2255: fix missing check in isar_render_poses() */
#define FIX_1904_HARM_GSC_ENC                           /* VA: #1904 Harmonization of EVS and IVAS GSC code */
#define FIX_1478_UNINIT_ON_BFI                          /* VA: Fix issue 1478 where a vector is partly un-initialized during bfi */
#define FIX_2318_CLANG_DECODER                          /* VA: basop issue 2318: Initialize command-line parameter arg.non_diegetic_pan_gain_fx */
@@ -101,12 +101,17 @@
#define FIX_BASOP_2332_ASAN_OVERFLOW_IN_EXT_DIRAC_REND  /* Nokia: basop issue 2332: Uses predefined memory sizes instead computing wrong */
#define FIX_BASOP_2333_MCMASA_ANA_MEMORY_LEAK           /* Nokia: basop issue 2333: Add missing free for direction_vector_e to ivas_mcmasa_ana_fx.c */
#define HARM_COREDECODER_FUNCTIONS                      /* VA: basop issue 2347: Remove various duplicated code in core-decoder  */
#define FIX_BASOP_2358_SCALING_OOB                      /* Eri: Basip issue 2358: Clang-18 reports OOB access where scaling is applied to L_FRAME48k instead of output_frame */
#define FIX_BASOP_2351_EXTREND_SCALE                    /* FhG: basop issue 2351: Only scale initialized samples in renderer, related to 2326 */
#define FIX_2331_CLANG18_MSAN_UNINIT_VARIABLE           /* FhG: Fix issue 2331: Uninitialized variable */
#define FIX_2362_TOTAL_BRATE_CALCULATION                /* FhG: basop issue 2362: fix calculation of st->total_brate in ivas_cpe_enc_fx() */
#define FIX_2330_CLANG_18_WARNINGS_REND                 /* FhG: Fix renderer warnings */
#define FIX_BASOP_2350_HARM_0B_BWE                      /* VA: basop issue 2350: harmonization of the 0b BWE */
#define FIX_BASOP_2350_HARM_0B_BWE_2                    /* VA: basop issue 2350: Simplify calling of hf_synth_fx() */
#define FIX_2349_HARM_FIND_UV                           /* VA: basop issue 2349: harmonization of find_uv() function */
#define FIX_2364_HARM_MULT_HARM                         /* VA: basop issue 2364 : harmonizing multi_harm_fx function */
#define FIX_2370_UNUSED_BUFFERS_CORE_ENC                /* VA: basop issue 2370: remove temporary input buffers in core-encoder  */
#define FIX_2376_FIX_USAN_PRE_PROC                      /* VA: basop issue 2376: Resolve "USAN: SEGV in ivas_compute_core_buffers_fx() */
#define REMOVE_SCALING_SHB_SPEECH                       /* VA: remove unnecessary scaling and 32-bit buffers from ivas_core_enc_fx() */

/* #################### End BE switches ################################## */
@@ -120,10 +125,10 @@
#define FIX_1500_ISM_MD_DTX                             /* VA: float issue 1500: fix ISM elevation metadata smoothing in DTX */
#define FIX_2348_REPLACE_FEC_ENC                        /* VA: basop issue 2348: replace FEC_encode_ivas_fx with FEC_encode_fx  */
#define FIX_2338_HARM_GSC_GAIN_COMP                     /* VA: basop issue 2338: harmonization of band gain computation for both EVS and IVAS */
#define FIX_BASOP_2317_UNINIT_VALUE_IN_STEREO_CNG       /* Eri: Basop issue 2317: Uninitialized value read in case of DTX and BW switching   */

/* ##################### End NON-BE switches ########################### */


/* ################## End MAINTENANCE switches ######################### */

/* clang-format on */
+19 −2
Original line number Diff line number Diff line
@@ -74,7 +74,9 @@ ivas_error acelp_core_dec_fx(
    const Word16 read_sid_info           /* i  : read SID info flag                          */
)
{
#ifndef FIX_BASOP_2350_HARM_0B_BWE_2
    Word32 synth_fx[960], save_hb_synth_fx[960] /*, bwe_exc_extended_fx[L_FRAME32k + NL_BUFF_OFFSET]*/;
#endif
    Word16 old_exc_fx[L_EXC_DEC], *exc_fx;                                           /* excitation signal buffer              */
    Word16 syn_tmp_fx[L_FRAME16k + L_SUBFR], *psyn_fx;                               /* synthesis signal buffer               */
    Word16 output_frame;                                                             /* frame length at output sampling freq. */
@@ -1896,6 +1898,9 @@ ivas_error acelp_core_dec_fx(
                              st->stab_fac_fx, &st->stab_fac_smooth_fx, st->coder_type, st->Q_syn, bpf_error_signal_16fx );
        }

#ifdef FIX_BASOP_2350_HARM_0B_BWE_2
        Word32 synth_fx[L_FRAME48k];
#endif
        Word32 syn_tmp_32_fx[L_FRAME16k + L_SUBFR], *syn_32_fx;
        set32_fx( syn_tmp_32_fx, 0, L_FRAME16k + L_SUBFR );
        syn_32_fx = syn_tmp_32_fx + L_SUBFR;
@@ -2049,7 +2054,11 @@ ivas_error acelp_core_dec_fx(
                    }
                }

                cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, save_hb_synth_fx, -1, sub( Q11, Q_real ), -10, st->cldfbSynHB );
                cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx /*tmp buffer for save_hb_synth_fx[] */, -1, sub( Q11, Q_real ), -10, st->cldfbSynHB );

#ifdef FIX_BASOP_2350_HARM_0B_BWE_2
                Copy_Scale_sig_32_16( synth_fx, save_hb_synth_fx16, output_frame, 0 ); // Q0
#endif

                /* restore lowband */
                FOR( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
@@ -2197,6 +2206,9 @@ ivas_error acelp_core_dec_fx(
            Copy( psyn_fx, output_fx, st->L_frame ); /*Q_syn*/
        }

#ifdef FIX_BASOP_2350_HARM_0B_BWE_2
        Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q_syn2
#endif
        st->Q_syn2 = 0;
        move16();
    }
@@ -2217,6 +2229,9 @@ ivas_error acelp_core_dec_fx(
        IF( ( EQ_16( st->L_frame, L_FRAME ) && ( st->bwidth != NB ) && GE_16( output_frame, L_FRAME16k ) &&
              ( EQ_16( st->extl, -1 ) || EQ_16( st->extl, SWB_CNG ) || ( EQ_16( st->extl, WB_BWE ) && st->extl_brate == 0 && NE_16( st->coder_type, AUDIO ) ) ) ) )
        {
#ifdef FIX_BASOP_2350_HARM_0B_BWE_2
            hf_synth_fx( st->hBWE_zero, st->element_mode, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2 );
#else
            IF( EQ_16( st->element_mode, EVS_MONO ) )
            {
#ifndef FIX_BASOP_2350_HARM_0B_BWE
@@ -2235,6 +2250,7 @@ ivas_error acelp_core_dec_fx(
#endif
                Copy_Scale_sig_16_32_DEPREC( synth_fx16, synth_fx, output_frame, 0 );
            }
#endif
        }
        ELSE
        {
@@ -2352,6 +2368,7 @@ ivas_error acelp_core_dec_fx(
        }
    }

#ifndef FIX_BASOP_2350_HARM_0B_BWE_2
    IF( NE_16( st->element_mode, EVS_MONO ) )
    {
        IF( save_hb_synth_fx16 != NULL )
@@ -2360,7 +2377,7 @@ ivas_error acelp_core_dec_fx(
        }
        Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q_syn2
    }

#endif
    pop_wmops();
    return error;
}
+30 −2
Original line number Diff line number Diff line
@@ -634,8 +634,9 @@ ivas_error ivas_core_enc_fx(
     * Postprocessing, BWEs and Updates
     *---------------------------------------------------------------------*/

#ifndef FIX_2370_UNUSED_BUFFERS_CORE_ENC
    Word16 tmp_input_fx[L_FRAME48k], tmp_old_input_fx[L_FRAME48k], q_inp[2];

#endif
    FOR( n = 0; n < n_CoreChannels; n++ )
    {
        st = sts[n];
@@ -650,6 +651,7 @@ ivas_error ivas_core_enc_fx(
            move16();
        }

#ifndef FIX_2370_UNUSED_BUFFERS_CORE_ENC
        Copy( st->input_fx - input_frame, tmp_old_input_fx, input_frame );
        Copy( st->input_fx, tmp_input_fx, input_frame );
        q_inp[0] = st->q_old_inp;
@@ -660,7 +662,7 @@ ivas_error ivas_core_enc_fx(
        move16();
        st->q_old_inp = -1;
        move16();

#endif
        /*---------------------------------------------------------------------*
         * Postprocessing for ACELP/HQ core switching
         *---------------------------------------------------------------------*/
@@ -700,6 +702,21 @@ ivas_error ivas_core_enc_fx(
         * SWB(FB) BWE encoding
         *---------------------------------------------------------------------*/

#ifdef FIX_2370_UNUSED_BUFFERS_CORE_ENC
        Word16 q_inp_orig;
        q_inp_orig = st->q_inp;
        move16();
        test();
        IF( GE_32( input_Fs, 32000 ) && st->hBWE_TD != NULL )
        {
            st->q_inp = -1;
            st->q_old_inp = -1;
            move16();
            move16();
            Scale_sig( st->input_fx - input_frame, shl( input_frame, 1 ), sub( st->q_inp, q_inp_orig ) );
        }
#endif

#ifndef REMOVE_SCALING_SHB_SPEECH
        new_swb_speech_fx = new_swb_speech_buffer_fx + STEREO_DFT_OVL_MAX;
#endif
@@ -813,6 +830,15 @@ ivas_error ivas_core_enc_fx(

        Scale_sig( old_syn_12k8_16k_fx[n], L_FRAME16k, sub( Q1, Q_new[n] ) ); // Q0

#ifdef FIX_2370_UNUSED_BUFFERS_CORE_ENC
        IF( GE_32( input_Fs, 32000 ) && st->hBWE_TD != NULL )
        {
            Scale_sig( st->input_fx, input_frame, sub( q_inp_orig, st->q_inp ) );
            st->q_inp = q_inp_orig;
            move16();
        }

#endif
        /*---------------------------------------------------------------------*
         * SWB DTX/CNG encoding
         *---------------------------------------------------------------------*/
@@ -877,6 +903,7 @@ ivas_error ivas_core_enc_fx(
            }
        }

#ifndef FIX_2370_UNUSED_BUFFERS_CORE_ENC
        Copy( tmp_old_input_fx, st->input_fx - input_frame, input_frame );
        Copy( tmp_input_fx, st->input_fx, input_frame );
        st->q_old_inp = q_inp[0];
@@ -884,6 +911,7 @@ ivas_error ivas_core_enc_fx(
        st->q_inp = q_inp[1];
        move16();

#endif
        /*---------------------------------------------------------------------*
         * Common updates
         *---------------------------------------------------------------------*/
+4 −0
Original line number Diff line number Diff line
@@ -786,7 +786,11 @@ ivas_error ivas_compute_core_buffers_fx(
#endif
    Word16 *preemp_start_idx = NULL;
#ifdef FIX_2344_ALIGN_PREPROC
#ifdef FIX_2376_FIX_USAN_PRE_PROC
    Word32 sig_out[STEREO_DFT_OVL_16k + L_FRAME16k + L_FILT16k], max_32;
#else
    Word32 sig_out[STEREO_DFT_OVL_16k + L_FRAME16k /* = max( L_FRAME16k + STEREO_DFT_OVL_16k, L_FRAME16k + L_FILT16k + lMemRecalc_16k ) */], max_32;
#endif
#else
    Word32 sig_out[960], max_32;
#endif
+4 −0
Original line number Diff line number Diff line
@@ -698,7 +698,11 @@ ivas_error front_vad_spar_fx(
            {
                cor_strong_limit = &dummy_int;
            }
#ifndef FIX_2364_HARM_MULT_HARM
            loc_harm = multi_harm_fx( st->lgBin_E_fx, hFrontVad->hNoiseEst->old_S_fx, hFrontVad->hNoiseEst->cor_map_fx, &hFrontVad->hNoiseEst->multi_harm_limit_fx, st->total_brate, st->bwidth, cor_strong_limit, &st->hSpMusClas->mean_avr_dyn_fx, &st->hSpMusClas->last_sw_dyn_fx, &cor_map_sum_fx, &dummy_fx, S_map_fx ); /* Q0 */
#else
            loc_harm = multi_harm_fx( EVS_MONO, st->lgBin_E_fx, hFrontVad->hNoiseEst->old_S_fx, hFrontVad->hNoiseEst->cor_map_fx, &hFrontVad->hNoiseEst->multi_harm_limit_fx, st->total_brate, st->bwidth, cor_strong_limit, &st->hSpMusClas->mean_avr_dyn_fx, &st->hSpMusClas->last_sw_dyn_fx, &cor_map_sum_fx, &dummy_fx, S_map_fx ); /* Q0 */
#endif
        }

        scale = getScaleFactor32( epsP_fx, M + 1 );
Loading