Commit c8e47d17 authored by vaclav's avatar vaclav
Browse files

Merge branch...

Merge branch 'basop-2585-bit-allocation-corner-cases-miss-alignment-between-float-and-fix' into 'main'

Resolve "bit allocation corner cases miss-alignment between float and fix"

See merge request !2634
parents b9803bbe 9ec61ece
Loading
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ static void reajust_bits( float *bits_per_bands, const int16_t st_band, const in

static Word16 Find_norm_inv( const Word32 ToDivide, Word16 *e_div );

static Word16 Find_bit_alloc_IVAS_int( const Word32 core_brate, const Word16 GSC_IVAS_mode, const Word16 Diff_len, const Word16 nb_tot_bands, const Word16 L_frame, Word16 *bit, Word16 *max_ener_band, float *ener_vec, float *bits_per_bands );
static Word16 Find_bit_alloc_IVAS( const Word32 core_brate, const Word16 GSC_IVAS_mode, const Word16 Diff_len, const Word16 nb_tot_bands, const Word16 L_frame, Word16 *bit, Word16 *max_ener_band, float *ener_vec, float *bits_per_bands );

static Word16 maximum_fx( const Word16 *vec_fx, const Word16 lvec_fx, Word16 *max_fx );

@@ -223,7 +223,7 @@ void bands_and_bit_alloc(
    {
        if ( GSC_IVAS_mode > 0 )
        {
            nb_tot_bands = (int16_t) Find_bit_alloc_IVAS_int( (Word32) core_brate, (Word16) GSC_IVAS_mode, (Word16) Diff_len, (Word16) nb_tot_bands, (Word16) L_frame, (Word16 *) bit, (Word16 *) max_ener_band, ener_vec, bits_per_bands );
            nb_tot_bands = (int16_t) Find_bit_alloc_IVAS( (Word32) core_brate, (Word16) GSC_IVAS_mode, (Word16) Diff_len, (Word16) nb_tot_bands, (Word16) L_frame, (Word16 *) bit, (Word16 *) max_ener_band, ener_vec, bits_per_bands );
            nb_bands = nb_tot_bands;
        }
        else if ( GSC_noisy_speech )
@@ -789,13 +789,13 @@ static float Find_bit_frac(


/*-------------------------------------------------------------------*
 * Find_bit_alloc_IVAS_int()
 * Find_bit_alloc_IVAS()
 *
 *
 *-------------------------------------------------------------------*/

/*! r: Number of bands to encode */
static Word16 Find_bit_alloc_IVAS_int(
static Word16 Find_bit_alloc_IVAS(
    const Word32 core_brate,      /* i  : core bit rate                                         */
    const Word16 GSC_IVAS_mode,   /* i  : GSC IVAS mode                                         */
    const Word16 Diff_len,        /* i  : Length of the difference signal (before pure spectral)*/
@@ -1022,13 +1022,21 @@ static Word16 Find_bit_alloc_IVAS_int(
            sum_bit = L_add( sum_bit, L_sub( bits_per_bands[i], Q18_112 ) );
            /* bits_per_bands[i] = 112; */
            bits_per_bands[i] = Q18_112;
#ifndef FIX_2585_BIT_ALLOCATION_DIFF
            j = add( j, add( i, 1 ) );
#else
            j = add( i, 1 );
#endif
        }
        /* safety check for overage bit reallocation */
        /* else if (bits_per_bands[i] + sum_bit / 3 > 112) */
        else if ( L_add( bits_per_bands[i], Mpy_32_16_1( sum_bit, Q15_0_33 ) ) > Q18_112 )
        {
#ifndef FIX_2585_BIT_ALLOCATION_DIFF
            j = add( j, add( i, 1 ) );
#else
            j = add( i, 1 );
#endif
        }
    }

+1 −0
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@
#define FIX_FMSW_DEC_2                                  /* float issue 1575: fix crash for format switching when bitsream starts with EVS */
#define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW     /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */
#define FIX_FLOAT_1578_OMASA_REND_SPIKES                /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */
#define FIX_2585_BIT_ALLOCATION_DIFF                    /* VA : issue 2585, bit allocation different behaviors between float and fixed-point for corner cases */

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