Commit 5ab46f75 authored by norvell's avatar norvell
Browse files

Merge branch 'main' into 'float-1474-usan-out-of-bounds-index-in-lib_com-trans_inv-c-841-33'

# Conflicts:
#   lib_com/options.h
parents 610d14d7 96ae0d1c
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -102,6 +102,8 @@
#define FIX_2287_MCT_MDCT_STEREO_DATA_MALLOC_SIZE       /* FhG: correct allocation size for STEREO_MDCT_DEC_DATA struct */
#define FIX_1904_HARM_GSC_ENC                           /* VA: #1904 Harmonization of EVS and IVAS GSC code */
#define FIX_1474_USAN_TRANS_INV                         /* Eri: Float issue 1474: Fix USAN out-of-bounds warning. No OOB occurs, but the pointer is set to point to uninitialized memory. */
#define FIX_2271_OOB_INDEXING_IN_PIT_OL2                /* VA: Fix for issue 2271, to silence clang18 */
#define FIX_2273_OOB_INDEXING_IN_PIT_FR4                /* VA: Fix to silence clang on ptr init */

/* #################### End BE switches ################################## */

@@ -115,7 +117,9 @@
#define FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT  /* Dolby: Issue 2250:  random vector generation in GenShapedSHBExcitation() */
#define FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE  /* VA: Precision improvement without increasing complexity, or complexity reduction that might be not BE on the LSB */
#define FIX_2252_LP_CNG_STARTS_SID                      /* VA: issues 2251 and 2252: fix LP CNG uninitialized value in bitstream that starts with an SID */
#define FIX_1466_EXTREND                                /* FhG: float issue 1466: enable rendering of mono/stereo to other formats in the external renderer */
#define FIX_1381_BWD                                    /* VA: issue 1381: apply no hysteresis in BWD at higher bitrates also in mono MASA and OMASA */
#define FIX_2285_CODE_DECODER_INIT_BW                   /* VA: basop issue 2285: fix core-decoder initialization bandwidth */

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

+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ ivas_error init_decoder_fx(
    }
    ELSE
    {
#if 0 // keep deactivated for the moment to keep BE
#ifdef FIX_2285_CODE_DECODER_INIT_BW
        st_fx->bwidth = WB;
        move16();
        st_fx->last_bwidth = WB;
+18 −0
Original line number Diff line number Diff line
@@ -283,14 +283,22 @@ void ivas_renderer_select(
     * Non-binaural rendering configurations
     *-----------------------------------------------------------------*/

#ifdef FIX_1435_MOVE_STEREO_PANNING
    ELSE IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) || EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) )
#else
    ELSE IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) )
#endif
    {
        test();
        test();
        test();
        test();
        test();
#ifdef FIX_1435_MOVE_STEREO_PANNING
        IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) && EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
#else
        IF( EQ_32( output_config, IVAS_AUDIO_CONFIG_STEREO ) )
#endif
        {
            *renderer_type = RENDERER_NON_DIEGETIC_DOWNMIX;
            move16();
@@ -300,7 +308,16 @@ void ivas_renderer_select(
            *renderer_type = RENDERER_MC;
            move16();
        }
#ifdef FIX_1435_MOVE_STEREO_PANNING
        ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) &&
                 ( EQ_32( output_config, IVAS_AUDIO_CONFIG_FOA ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA2 ) || EQ_32( output_config, IVAS_AUDIO_CONFIG_HOA3 ) ) )
        {
            *renderer_type = RENDERER_SBA_LINEAR_ENC;
            move16();
        }
#endif
    }
#ifndef FIX_1435_MOVE_STEREO_PANNING
    ELSE IF( EQ_32( st_ivas->ivas_format, STEREO_FORMAT ) )
    {
        test();
@@ -322,6 +339,7 @@ void ivas_renderer_select(
            move16();
        }
    }
#endif
    ELSE IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) )
    {
        test();
+54 −0
Original line number Diff line number Diff line
@@ -762,6 +762,9 @@ Word16 pitch_fr4_fx(
    Word16 corr_v[15 + 2 * L_INTERPOL1 + 1]; /* Total length = t0_max-t0_min+1+2*L_inter */
    Word16 pit_min;
    Word16 cor_max;
#ifdef FIX_2273_OOB_INDEXING_IN_PIT_FR4
    Word16 corr_off;
#endif

    /* initialization */
    IF( limit_flag == 0 )
@@ -805,8 +808,17 @@ Word16 pitch_fr4_fx(

    t_min = sub( t0_min, L_INTERPOL1 );
    t_max = add( t0_max, L_INTERPOL1 );

#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
    corr = &corr_v[-t_min];
#else
    corr = corr_v;
    corr_off = -t_min;
    move16();
#endif

    /* corr[t_min..t_max] */
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
    if ( element_mode > EVS_MONO )
    {
        norm_corr_ivas_fx( exc, xn, h, t_min, t_max, corr, L_subfr, Q_new );
@@ -815,24 +827,46 @@ Word16 pitch_fr4_fx(
    {
        norm_corr_fx( exc, xn, h, t_min, t_max, corr, L_subfr );
    }
#else
    if ( element_mode > EVS_MONO )
    {
        norm_corr_ivas_fx( exc, xn, h, t_min, t_max, corr + corr_off, L_subfr, Q_new );
    }
    else
    {
        norm_corr_fx( exc, xn, h, t_min, t_max, corr + corr_off, L_subfr );
    }
#endif

    /*-----------------------------------------------------------------*
     * Find integer pitch
     *-----------------------------------------------------------------*/

#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
    max_val = corr[t0_min];
#else
    max_val = corr[t0_min + corr_off];
#endif
    move16();
    t0 = t0_min;
    move16();

    FOR( i = t0_min + 1; i <= t0_max; i++ )
    {
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
        if ( GE_16( corr[i], max_val ) )
#else
        if ( GE_16( corr[i + corr_off], max_val ) )
#endif
        {
            t0 = i;
            move16();
        }
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
        max_val = s_max( corr[i], max_val );
#else
        max_val = s_max( corr[i + corr_off], max_val );
#endif
    }

    IF( EQ_16( t0_fr1, pit_min ) )
@@ -846,7 +880,11 @@ Word16 pitch_fr4_fx(
            {
                i = sub( i, 2 );
            }
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
            IF( GT_16( corr[i], corr[i + 2] ) )
#else
            IF( GT_16( corr[i + corr_off], corr[i + 2 + corr_off] ) )
#endif
            {
                t0 = i;
                move16();
@@ -897,15 +935,27 @@ Word16 pitch_fr4_fx(
    {
        fraction = 0;
        move16();
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
        cor_max = Interpol_4( &corr[t0], fraction );
#else
        cor_max = Interpol_4( &corr[t0 + corr_off], fraction );
#endif
    }
    ELSE
    {
        t0 = sub( t0, 1 );
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
        cor_max = Interpol_4( &corr[t0], fraction );
#else
        cor_max = Interpol_4( &corr[t0 + corr_off], fraction );
#endif
        FOR( i = fraction + step; i <= 3; i = ( i + step ) )
        {
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
            temp = Interpol_4( &corr[t0], i );
#else
            temp = Interpol_4( &corr[t0 + corr_off], i );
#endif
            IF( GT_16( temp, cor_max ) )
            {
                cor_max = temp;
@@ -918,7 +968,11 @@ Word16 pitch_fr4_fx(

    FOR( i = 0; i <= 3; i = ( i + step ) )
    {
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
        temp = Interpol_4( &corr[t1], i );
#else
        temp = Interpol_4( &corr[t1 + corr_off], i );
#endif
        IF( GT_16( temp, cor_max ) )
        {
            cor_max = temp;
+24 −2
Original line number Diff line number Diff line
@@ -50,7 +50,9 @@ void pitch_ol2_fx(
    Word32 R1, R2;
    Word16 R0, exp_R0, exp_R1, exp_R2, j;
    Word16 pit_max;

#ifdef FIX_2271_OOB_INDEXING_IN_PIT_OL2
    Word16 base_idx;
#endif
    /* initialization */
    pit_max = PIT_MAX;
    move16();
@@ -104,9 +106,14 @@ void pitch_ol2_fx(
     * search the fractions around t0 and choose the one which maximizes
     * the interpolated normalized correlation.
     *----------------------------------------------------------------*/
#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2
    pt_cor_fx = cor_fx + sub( L_INTERPOL1, t0_min );
#endif
    t0s = t1s;
    move16();
#ifdef FIX_2271_OOB_INDEXING_IN_PIT_OL2
    base_idx = sub( L_INTERPOL1, t0_min );
#endif

    step = 1;
    move16(); /* 1/4 subsample resolution */
@@ -116,10 +123,18 @@ void pitch_ol2_fx(
    IF( NE_16( t0s, t0_min ) ) /* Process negative fractions */
    {
        t0s = sub( t0s, 1 );
#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2
        cor_max_fx = Interpol_4( &pt_cor_fx[t0s], fraction );
#else
        cor_max_fx = Interpol_4( &cor_fx[t0s + base_idx], fraction );
#endif
        FOR( i = fraction + step; i <= 3; i += step )
        {
#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2
            temp_fx = Interpol_4( &pt_cor_fx[t0s], i );
#else
            temp_fx = Interpol_4( &cor_fx[t0s + base_idx], i );
#endif
            if ( GT_16( temp_fx, cor_max_fx ) )
            {
                fraction = i;
@@ -132,13 +147,20 @@ void pitch_ol2_fx(
    {
        fraction = 0;
        move16();
#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2
        cor_max_fx = Interpol_4( &pt_cor_fx[t0s], fraction );
#else
        cor_max_fx = Interpol_4( &cor_fx[t0s + base_idx], fraction );
#endif
        move16();
    }
    FOR( i = 0; i <= 3; i += step ) /* Process positive fractions */
    {
#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2
        temp_fx = Interpol_4( &pt_cor_fx[t1s], i );

#else
        temp_fx = Interpol_4( &cor_fx[t1s + base_idx], i );
#endif
        IF( GT_16( temp_fx, cor_max_fx ) )
        {
            cor_max_fx = temp_fx;
Loading