Commit 2f70a563 authored by vaclav's avatar vaclav
Browse files

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

- Merge remote-tracking branch 'remotes/origin/main' into basop-2392-clang18-msan-use-of-uninitialized-value-in-use-of-uninitialized-value-in
parents ec3d2e41 785e2f24
Loading
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1713,9 +1713,13 @@ static ivas_error initOnFirstGoodFrame(
        if ( arg.rtpOutSR && srRtp != NULL )
        {
            FILE *fParamsSR = NULL;
            char srParamsFile[FILENAME_MAX], *ext = ".sr.txt";
            strncpy( srParamsFile, arg.outputWavFilename, FILENAME_MAX - sizeof( ext ) );
            strncat( srParamsFile, ext, sizeof( ext ) + 1 );
            char srParamsFile[FILENAME_MAX];
            const char *ext = ".sr.txt";

            strncpy( srParamsFile, arg.outputWavFilename, FILENAME_MAX - strlen( ext ) - 1 );
            srParamsFile[FILENAME_MAX - strlen( ext ) - 1] = '\0';
            strncat( srParamsFile, ext, strlen( ext ) );
            srParamsFile[FILENAME_MAX - 1] = '\0';

            /* Write the Split Rendering Params passed from SDP to srParamsFile */
            fParamsSR = fopen( srParamsFile, "w" );
+0 −2
Original line number Diff line number Diff line
@@ -996,10 +996,8 @@ ivas_error openCldfb(
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" );
    }

#ifdef FIX_2319_CLDFB_INIT_FLAGS
    hs->flags = 0;
    move16();
#endif

    hs->type = type;
    move16();
+64 −9
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ static Word16 VDQ_vec_fx( Word16 *Qvec_out_fx, const Word16 *mean_dic_fx, const


/*========================================================================*/
/* FUNCTION : void Comp_and_apply_gain_enc_fx                             */
/* FUNCTION : void Comp_and_apply_gain_fx                                 */
/*------------------------------------------------------------------------*/
/* PURPOSE :  Compute and apply the quantized per band gain               */
/*------------------------------------------------------------------------*/
@@ -70,12 +70,19 @@ static Word16 VDQ_vec_fx( Word16 *Qvec_out_fx, const Word16 *mean_dic_fx, const
/* _ None                                                                 */
/*========================================================================*/

#ifdef FIX_2380_HARM_GSC_GAIN_COMP_FX
Word16 Comp_and_apply_gain_fx(
#else
void Comp_and_apply_gain_fx(
#endif
    Word16 exc_diffQ[],      /* i/o: Quantized excitation                  */
    Word16 Ener_per_bd_iQ[], /* i  : Target ener per band              Q13 */
    Word16 Ener_per_bd_yQ[], /* i/o: Ener per band for norm vector   i->Q13/o->Q13 */
    Word16 Mbands_gn,        /* i  : number of bands                       */
    const Word16 ReUseGain,  /* i  : Reuse the gain in Ener_per_bd_yQ      */
#ifdef FIX_2380_HARM_GSC_GAIN_COMP_FX
    const Word16 Flag_adj_q_exc, /* i  : Flag allowing Q_exc adjustment   */
#endif
    Word16 Qexc_diff,
    Word16 Q_exc )
{
@@ -83,6 +90,11 @@ void Comp_and_apply_gain_fx(
    Word16 StartBin, NB_Qbins;
    Word16 y_gain;
    Word16 L16, frac, exp1, tmp_exp;
#ifdef FIX_2380_HARM_GSC_GAIN_COMP_FX
    Word16 Q_adapt;
    Word16 Q_exc_diffQ[L_FRAME16k];
    Word32 exc_diffQ32[L_FRAME16k];
#endif
    Word32 L32;

    /* Recreate excitation for local synthesis and decoder */
@@ -92,6 +104,7 @@ void Comp_and_apply_gain_fx(
    move16();

    tmp_exp = add( 14, sub( Q_exc, Qexc_diff ) ); /* In case of reuse, it can be computed outside the loop*/

    FOR( i_band = 0; i_band < Mbands_gn; i_band++ )
    {
        StartBin = add( StartBin, NB_Qbins );
@@ -126,7 +139,24 @@ void Comp_and_apply_gain_fx(
            Ener_per_bd_yQ[i_band] = shl_sat( y_gain, sub( exp1, 13 ) );
            move16(); /*Q1     */
            tmp_exp = add( add( exp1, 1 ), sub( Q_exc, Qexc_diff ) );

#ifdef FIX_2380_HARM_GSC_GAIN_COMP_FX
            IF( Flag_adj_q_exc != 0 )
            {
                FOR( i = StartBin; i < NB_Qbins + StartBin; i++ )
                {
                    exc_diffQ32[i] = L_mult( exc_diffQ[i], y_gain ); /*Qexc_diff+15 */
                    move32();
                    Q_exc_diffQ[i] = Q_exc;
                    if ( exc_diffQ[i] )
                    {
                        Q_exc_diffQ[i] = sub( Q_exc_diffQ[i], tmp_exp );
                        move16();
                    }
                }
            }
            ELSE
#endif
            {
                FOR( i = StartBin; i < NB_Qbins + StartBin; i++ )
                {
                    L32 = L_mult( exc_diffQ[i], y_gain );                     /*Qexc_diff+15 */
@@ -135,8 +165,29 @@ void Comp_and_apply_gain_fx(
                }
            }
        }

    }
#ifdef FIX_2380_HARM_GSC_GAIN_COMP_FX
    Q_adapt = Q_exc;
    move16();
    test();
    IF( EQ_16( ReUseGain, 0 ) && Flag_adj_q_exc != 0 )
    {
        Word16 total_bins = add( StartBin, NB_Qbins );
        move16();
        FOR( i = 0; i < total_bins; i++ )
        {
            Q_adapt = s_min( Q_adapt, add( Q_exc_diffQ[i], norm_l( exc_diffQ32[i] ) ) );
            move16();
        }
        FOR( i = 0; i < total_bins; i++ )
        {
            exc_diffQ[i] = round_fx( L_shl( exc_diffQ32[i], sub( Q_adapt, Q_exc_diffQ[i] ) ) ); /*Q_exc*/
        }
    }
    return Q_adapt;
#else
    return;
#endif
}
#ifndef FIX_2338_HARM_GSC_GAIN_COMP

@@ -422,7 +473,7 @@ static void GSC_gain_adj(
    }
    ELSE
    {
        Gain_off = 0;
        Gain_off = 0; /* For higher bitrate, thus for L_frame == L_FRAME16k as well */
        move16();

        test();
@@ -460,7 +511,11 @@ static void GSC_gain_adj(
        }

        /*mimic ACELP decay of energy for low rates*/
#ifndef FIX_2406_FIX_GAIN_ON_INACTIVE
        FOR( i = 0; i < MBANDS_GN; i++ )
#else
        FOR( i = 0; i < Mbands_gn; i++ )
#endif
        {
            old_y_gain[i] = y_gain_tmp[i];
            move16();
@@ -475,7 +530,7 @@ static void GSC_gain_adj(


/*==========================================================================*/
/* FUNCTION : Word16 gsc_gaindec_ivas_fx()                                  */
/* FUNCTION : Word16 gsc_gaindec_fx()                                       */
/*--------------------------------------------------------------------------*/
/* PURPOSE  :  Generic signal frequency band decoding and application       */
/*--------------------------------------------------------------------------*/
+31 −27
Original line number Diff line number Diff line
@@ -751,19 +751,11 @@ void highband_exc_dct_in_fx(
    test();
    IF( bfi || LT_32( core_brate, 6000 ) || ( LT_32( core_brate, 8600 ) && EQ_16( coder_type, UNVOICED ) ) )
    {
#ifndef FIX_1478_UNINIT_ON_BFI
        set16_fx( noisepb, 13107, MBANDS_GN ); /*0.4 in Q15 */
#else
        set16_fx( noisepb, 13107, last_bin ); /*0.4 in Q15 */
#endif
    }
    ELSE IF( EQ_16( GSC_IVAS_mode, 3 ) || ( GSC_IVAS_mode > 0 && EQ_16( GSC_noisy_speech, 1 ) ) )
    {
#ifndef FIX_1478_UNINIT_ON_BFI
        set16_fx( noisepb, 13107 /*0.4f*/, MBANDS_GN16k );
#else
        set16_fx( noisepb, 13107 /*0.4f*/, last_bin );
#endif
    }
    ELSE
    {
@@ -780,11 +772,7 @@ void highband_exc_dct_in_fx(
    test();
    IF( GSC_IVAS_mode == 0 && GSC_noisy_speech && !bfi && LE_16( element_mode, IVAS_SCE ) )
    {
#ifndef FIX_1478_UNINIT_ON_BFI
        set16_fx( noisepb, 3277, MBANDS_GN );
#else
        set16_fx( noisepb, 3277, last_bin );
#endif
    }
    test();
    IF( LT_32( core_brate, 6000 ) && LE_16( coder_type, UNVOICED ) )
@@ -1081,6 +1069,9 @@ void highband_exc_dct_in_ivas_fx(
    Word16 frac, exp, tmp1;
    Word16 tmp2;
    Word16 *end, Q_hb_exc;
#ifdef FIX_2380_HARM_GSC_GAIN_COMP_FX
    Word16 Flag_adj_q_exc, old_Q_exc;
#endif

    FOR( j = 10; j < MBANDS_GN; j++ )
    {
@@ -1150,19 +1141,11 @@ void highband_exc_dct_in_ivas_fx(
    test();
    IF( bfi || LT_32( core_brate, 6000 ) || ( LT_32( core_brate, 8600 ) && EQ_16( coder_type, UNVOICED ) ) )
    {
#ifndef FIX_1478_UNINIT_ON_BFI
        set16_fx( noisepb, 13107, MBANDS_GN ); /*0.4 in Q15 */
#else
        set16_fx( noisepb, 13107, last_bin ); /*0.4 in Q15 */
#endif
    }
    ELSE IF( EQ_16( GSC_IVAS_mode, 3 ) || ( GSC_IVAS_mode > 0 && EQ_16( GSC_noisy_speech, 1 ) ) )
    {
#ifndef FIX_1478_UNINIT_ON_BFI
        set16_fx( noisepb, 13107 /*0.4f*/, MBANDS_GN16k );
#else
        set16_fx( noisepb, 13107 /*0.4f*/, last_bin );
#endif
    }
    ELSE
    {
@@ -1179,11 +1162,7 @@ void highband_exc_dct_in_ivas_fx(

    IF( GSC_IVAS_mode == 0 && GSC_noisy_speech && !bfi && LE_16( element_mode, IVAS_SCE ) )
    {
#ifndef FIX_1478_UNINIT_ON_BFI
        set16_fx( noisepb, 3277, MBANDS_GN );
#else
        set16_fx( noisepb, 3277, last_bin );
#endif
    }

    test();
@@ -1364,10 +1343,9 @@ void highband_exc_dct_in_ivas_fx(
            move16();
        }
    }
#ifndef FIX_2338_HARM_GSC_GAIN_COMP
#if !defined FIX_2338_HARM_GSC_GAIN_COMP && !defined FIX_2380_HARM_GSC_GAIN_COMP_FX
    IF( EQ_16( element_mode, EVS_MONO ) )
    {
#endif
        Comp_and_apply_gain_fx( exc_diffQ, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 0, Qexc_diffQ, *Q_exc );

        IF( exc_wo_nf != NULL )
@@ -1375,7 +1353,6 @@ void highband_exc_dct_in_ivas_fx(
            Comp_and_apply_gain_fx( exc_wo_nf, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 1, Qexc_diffQ, *Q_exc );
            Vr_add( exc_dct_in, exc_wo_nf, exc_wo_nf, L_frame );
        }
#ifndef FIX_2338_HARM_GSC_GAIN_COMP
    }
    ELSE
    {
@@ -1406,7 +1383,34 @@ void highband_exc_dct_in_ivas_fx(
            Scale_sig( exc_dct_in, L_frame, sub( *Q_exc, Q_old ) );
        }
    }
#elif defined FIX_2380_HARM_GSC_GAIN_COMP_FX
    Flag_adj_q_exc = 0;
    move16();
    IF( NE_16( element_mode, EVS_MONO ) && lt_ener_per_band_fx != NULL ) /* to keep all EVS BE */
    {
        Flag_adj_q_exc = 1;
        move16();
    }
    old_Q_exc = *Q_exc;
    move16();
    *Q_exc = Comp_and_apply_gain_fx( exc_diffQ, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 0, Flag_adj_q_exc, Qexc_diffQ, *Q_exc );
    Scale_sig( exc_dct_in, L_frame, sub( *Q_exc, old_Q_exc ) );

    IF( exc_wo_nf != NULL )
    {
        Comp_and_apply_gain_fx( exc_wo_nf, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 1, Flag_adj_q_exc, Qexc_diffQ, *Q_exc );
        Vr_add( exc_dct_in, exc_wo_nf, exc_wo_nf, L_frame );
    }
#else /* #if defined FIX_2338_HARM_GSC_GAIN_COMP */
        Comp_and_apply_gain_fx( exc_diffQ, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 0, Qexc_diffQ, *Q_exc );

        IF( exc_wo_nf != NULL )
        {
            Comp_and_apply_gain_fx( exc_wo_nf, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 1, Qexc_diffQ, *Q_exc );
            Vr_add( exc_dct_in, exc_wo_nf, exc_wo_nf, L_frame );
        }
#endif

    /*--------------------------------------------------------------------------------------*
     * add the correction layer to the LF bins,
     * and add the quantized pulses or the noise for the higher part of the spectrum
+12 −10
Original line number Diff line number Diff line
@@ -1359,20 +1359,10 @@ void stereo_tcx_init_dec_fx(

void stereo_icBWE_enc_fx(
    CPE_ENC_HANDLE hCPE,                                        /* i/o: CPE encoder structure                */
#ifdef REMOVE_SCALING_SHB_SPEECH
    const Word16 shb_speech_ref_fx16[],                         /* i  : SHB speech ref channel             Q0*/
    Word16 shb_speech_nonref_fx_16[],                           /* i/o: SHB speech non-ref channel         shb_speech_nonref_e*/
#else
    const Word32 shb_speech_ref_fx[],                           /* i  : SHB speech ref channel               */
    const Word16 shb_speech_ref_e,                              /* i  : SHB speech ref channel               */
    Word32 shb_speech_nonref_fx[],                              /* i/o: SHB speech non-ref channel           */
#endif
    Word16 shb_speech_nonref_e,                                 /* i/o: SHB speech non-ref channel           */
#ifdef REMOVE_SCALING_SHB_SPEECH
    const Word16 *voice_factors_fx                              /* i  : voicing factors                  Q15 */
#else
    const Word32 *voice_factors_fx                              /* i  : voicing factors                     Q31 */
#endif
);

void initMdctStereoDecData_fx(
@@ -1597,8 +1587,12 @@ void ivas_hq_core_dec_fx(
    const Word16 output_frame,                                  /* i  : output frame length                     */
    const Word16 hq_core_type,                                  /* i  : HQ core type                            */
    const Word16 core_switching_flag,                           /* i  : ACELP->HQ switching frame flag          */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 *output_32_fx                                        /* o  : synthesis @internal_Fs, Q11             */
#else
    Word16 output[],
    Word16 *Q_output 
#endif
);

#ifndef HARMONIZE_TBE
@@ -1900,7 +1894,11 @@ void GenShapedWBExcitation_ivas_fx(
/* o : Q_syn_hb*/
Word16 ivas_wb_bwe_dec_fx(
    Decoder_State *st_fx,                                       /* i/o: decoder state structure                 */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 output_fx32[],                                       /* o  : synthesis @internal Fs               Q11*/
#else
    const Word16 output[],                                      /* i  : suntehsis @ internal Fs Q_input         */
    #endif
    Word16 *synth_fx,                                           /* i/o: ACELP core synthesis/final synthesis   Q0/Qpost */
    Word16 *hb_synth_fx,                                        /* o  : SHB synthesis/final synthesis          Q_syn_hb */
    const Word16 use_cldfb_for_dft,                             /* i  : flag to use of CLDFB for DFT Stereo     */
@@ -2098,7 +2096,11 @@ void ivas_buffer_deinterleaved_to_interleaved_fx(
void stereo_tcx_core_dec_fx(
    Decoder_State *st,                                          /* i/o: decoder state structure                     */
    const FRAME_MODE frameMode,                                 /* i  : Decoder frame mode                          */
#ifdef FIX_2280_REDUCTION_UNNECESSARY_SCALING
    Word32 *signal_out_32_fx,                                   /* o  : synthesis @internal_Fs, Q11                 */
#else
    Word16 *signal_out,                                         /* o  : synthesis @internal_Fs, Q0                  */
#endif
    Word16 *signal_outFB,                                       /* o  : synthesis @output_Fs, Q0                    */
    Word16 pitch_buf[],                                         /* o  : floating pitch for each subframe, Q6        */
    const Word16 sba_dirac_stereo_flag,                         /* i  : signal stereo output for SBA DirAC          */
Loading