Loading lib_com/gs_bitallocation_fx.c +26 −7 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "assert.h" /* Debug prototypes */ #include "stl.h" #include "ivas_prot_fx.h" Loading Loading @@ -375,9 +374,10 @@ void bands_and_bit_alloc_fx( nb_bands_max = s_min( nb_bands_max, MBANDS_GN_BITALLOC16k ); /*------------------------------------------------------------------------ * Ajustement of the maximum number of bands in function of the * Adjustement of the maximum number of bands in function of the * dynamics of the spectrum (more or less speech like) *-----------------------------------------------------------------------*/ test(); test(); test(); Loading Loading @@ -444,6 +444,7 @@ void bands_and_bit_alloc_fx( /*------------------------------------------------------------------------ * Find extra number of band to code according to bit rate availables *-----------------------------------------------------------------------*/ test(); WHILE( GE_16( bit_tmp, bit_new_bands ) && LE_16( nb_bands, sub( nb_bands_max, 1 ) ) ) { Loading @@ -470,6 +471,7 @@ void bands_and_bit_alloc_fx( /*------------------------------------------------------------------------ * Complete the bit allocation per frequency band *-----------------------------------------------------------------------*/ imax = 5; move16(); Loading Loading @@ -587,6 +589,7 @@ void bands_and_bit_alloc_fx( * For the first x bands to be included in th final sorted vector * Sort the remaining bands in decrease energy order *--------------------------------------------------------------------------*/ FOR( j = 0; j < nb_tot_bands; j++ ) { max_ener_band[j] = -10; Loading Loading @@ -669,6 +672,7 @@ void bands_and_bit_alloc_fx( * The maximum number of bits per band of length 16 is 112 * Redistribute the overage bits if needed *--------------------------------------------------------------------------*/ sum_bit = 0; move16(); j = 0; Loading Loading @@ -736,6 +740,7 @@ void bands_and_bit_alloc_fx( /*-------------------------------------------------------------------------- * Recompute the real number/length of frequency bands to encode *--------------------------------------------------------------------------*/ *nb_subbands = nb_bands; move16(); *pvq_len = shl( *nb_subbands, 4 ); Loading @@ -744,6 +749,7 @@ void bands_and_bit_alloc_fx( /*-------------------------------------------------------------------------- * Concatenate bands (encoder only) *--------------------------------------------------------------------------*/ IF( exc_diff != NULL ) { FOR( j = 0; j < nb_bands; j++ ) Loading Loading @@ -834,6 +840,7 @@ static void reajust_bits_fx( return; } /*-------------------------------------------------------------------* * Find_bit_frac() * Loading Loading @@ -886,6 +893,12 @@ static Word32 Find_bit_frac_fx( } /*-------------------------------------------------------------------* * Find_bit_alloc_IVAS() * * *-------------------------------------------------------------------*/ /* o : Number of band to encode */ static Word16 Find_bit_alloc_IVAS_fx( const Word32 core_brate, /* i : core bit rate */ Loading @@ -907,12 +920,10 @@ static Word16 Find_bit_alloc_IVAS_fx( Word16 d_tmp, e_div, tmp16; Word32 Ltmp, etmp_32fx; SWB_bit_budgetQ18 = L_shl( *bit, 18 ); /* Q0 -> Q18 */ SWB_bit_budgetQ5 = L_shl( *bit, 5 ); /* Q0 -> Q5 */ SWB_bit_budgetQ18 = L_shl( *bit, Q18 ); /* Q0 -> Q18 */ SWB_bit_budgetQ5 = L_shl( *bit, Q5 ); /* Q0 -> Q5 */ st_band = 5; nb_bands_max = nb_tot_bands_in; move16(); move16(); move16(); Loading Loading @@ -1135,14 +1146,22 @@ static Word16 Find_bit_alloc_IVAS_fx( /* bits_per_bands[i] = 112; */ bits_per_bands[i] = Q18_112; move32(); #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( GT_32( 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 } } Loading lib_com/ivas_stereo_td_bit_alloc_fx.c +21 −1 Original line number Diff line number Diff line Loading @@ -204,13 +204,25 @@ void tdm_bit_alloc( } ELSE { #ifdef FIX_2585_BIT_ALLOCATION_DIFF Word16 neg = 0; move16(); if ( bit_rate_diff_fx < 0 ) { neg = 1; move16(); } #endif IF( LT_16( ener_ratio_idx, LRTD_STEREO_MID_IS_PRIM ) ) { bit_rate_diff_fx = imult3216( bit_rate_diff_fx, sub( LRTD_STEREO_MID_IS_PRIM, ener_ratio_idx ) ); /*Q0*/ bit_rate_diff_fx = L_shr( bit_rate_diff_fx, 1 ); /*Q0*/ bit_rate_diff_fx = Mpy_32_16_1( L_abs( bit_rate_diff_fx ), 3277 /*0.1f in Q15*/ ); /*Q0*/ #ifdef FIX_2585_BIT_ALLOCATION_DIFF if ( neg != 0 ) #else if ( bit_rate_diff_fx < 0 ) #endif { bit_rate_diff_fx = L_negate( bit_rate_diff_fx ); } Loading @@ -220,7 +232,11 @@ void tdm_bit_alloc( bit_rate_diff_fx = imult3216( bit_rate_diff_fx, sub( ener_ratio_idx, LRTD_STEREO_MID_IS_PRIM ) ); /*Q0*/ bit_rate_diff_fx = L_shr( bit_rate_diff_fx, 1 ); /*Q0*/ bit_rate_diff_fx = Mpy_32_16_1( L_abs( bit_rate_diff_fx ), 3277 /*0.1f in Q15*/ ); /*Q0*/ #ifdef FIX_2585_BIT_ALLOCATION_DIFF if ( neg != 0 ) #else if ( bit_rate_diff_fx < 0 ) #endif { bit_rate_diff_fx = L_negate( bit_rate_diff_fx ); } Loading Loading @@ -322,7 +338,11 @@ void tdm_bit_alloc( *tdm_low_rate_mode = 0; move16(); } #ifndef FIX_2585_BIT_ALLOCATION_DIFF ELSE IF( ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, TDM_UC_NORMAL_MODE_MINBR_LP_R ) && EQ_16( coder_type, UNVOICED ) ) || ( tdm_lp_reuse_flag == 0 && LE_32( *total_brate_sec, L_deposit_l( add( tdm_bit_allc_tbl[idx][0], MID_LP_BRATE ) ) ) ) ) #else ELSE IF( ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, TDM_UC_NORMAL_MODE_MINBR_LP_R ) && EQ_16( coder_type, UNVOICED ) ) || ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, L_deposit_l( add( tdm_bit_allc_tbl[idx][0], MID_LP_BRATE ) ) ) ) ) #endif { *total_brate_sec = L_add( *total_brate_sec, MID_LP_BRATE ); /*Q0*/ move32(); Loading lib_com/options.h +2 −1 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ #define NONBE_FIX_2575 /* Fhg: Fix issue 2575, precision loss in FD CNG */ #define FIX_2584_TD_SM_ISSUE /* VA: Fix inconsistencies in the SM part of the TD stereo */ #define FIX_2556_ALIGN_CONDITIONS /* VA: Fix different conditions that were not exact between float and fix, BE on self-test */ #define FIX_2585_BIT_ALLOCATION_DIFF /* VA : issue 2585, bit allocation different behaviors between float and fixed-point for corner cases */ #define FIX_NONBE_2579_INCORRECT_LAG_CALCULATION /* Dolby: fix 2579: Incorrect lag calculation */ /* Macros for issue 1966 are independent, phase diff is always BE for EVS_MONO */ Loading Loading
lib_com/gs_bitallocation_fx.c +26 −7 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "assert.h" /* Debug prototypes */ #include "stl.h" #include "ivas_prot_fx.h" Loading Loading @@ -375,9 +374,10 @@ void bands_and_bit_alloc_fx( nb_bands_max = s_min( nb_bands_max, MBANDS_GN_BITALLOC16k ); /*------------------------------------------------------------------------ * Ajustement of the maximum number of bands in function of the * Adjustement of the maximum number of bands in function of the * dynamics of the spectrum (more or less speech like) *-----------------------------------------------------------------------*/ test(); test(); test(); Loading Loading @@ -444,6 +444,7 @@ void bands_and_bit_alloc_fx( /*------------------------------------------------------------------------ * Find extra number of band to code according to bit rate availables *-----------------------------------------------------------------------*/ test(); WHILE( GE_16( bit_tmp, bit_new_bands ) && LE_16( nb_bands, sub( nb_bands_max, 1 ) ) ) { Loading @@ -470,6 +471,7 @@ void bands_and_bit_alloc_fx( /*------------------------------------------------------------------------ * Complete the bit allocation per frequency band *-----------------------------------------------------------------------*/ imax = 5; move16(); Loading Loading @@ -587,6 +589,7 @@ void bands_and_bit_alloc_fx( * For the first x bands to be included in th final sorted vector * Sort the remaining bands in decrease energy order *--------------------------------------------------------------------------*/ FOR( j = 0; j < nb_tot_bands; j++ ) { max_ener_band[j] = -10; Loading Loading @@ -669,6 +672,7 @@ void bands_and_bit_alloc_fx( * The maximum number of bits per band of length 16 is 112 * Redistribute the overage bits if needed *--------------------------------------------------------------------------*/ sum_bit = 0; move16(); j = 0; Loading Loading @@ -736,6 +740,7 @@ void bands_and_bit_alloc_fx( /*-------------------------------------------------------------------------- * Recompute the real number/length of frequency bands to encode *--------------------------------------------------------------------------*/ *nb_subbands = nb_bands; move16(); *pvq_len = shl( *nb_subbands, 4 ); Loading @@ -744,6 +749,7 @@ void bands_and_bit_alloc_fx( /*-------------------------------------------------------------------------- * Concatenate bands (encoder only) *--------------------------------------------------------------------------*/ IF( exc_diff != NULL ) { FOR( j = 0; j < nb_bands; j++ ) Loading Loading @@ -834,6 +840,7 @@ static void reajust_bits_fx( return; } /*-------------------------------------------------------------------* * Find_bit_frac() * Loading Loading @@ -886,6 +893,12 @@ static Word32 Find_bit_frac_fx( } /*-------------------------------------------------------------------* * Find_bit_alloc_IVAS() * * *-------------------------------------------------------------------*/ /* o : Number of band to encode */ static Word16 Find_bit_alloc_IVAS_fx( const Word32 core_brate, /* i : core bit rate */ Loading @@ -907,12 +920,10 @@ static Word16 Find_bit_alloc_IVAS_fx( Word16 d_tmp, e_div, tmp16; Word32 Ltmp, etmp_32fx; SWB_bit_budgetQ18 = L_shl( *bit, 18 ); /* Q0 -> Q18 */ SWB_bit_budgetQ5 = L_shl( *bit, 5 ); /* Q0 -> Q5 */ SWB_bit_budgetQ18 = L_shl( *bit, Q18 ); /* Q0 -> Q18 */ SWB_bit_budgetQ5 = L_shl( *bit, Q5 ); /* Q0 -> Q5 */ st_band = 5; nb_bands_max = nb_tot_bands_in; move16(); move16(); move16(); Loading Loading @@ -1135,14 +1146,22 @@ static Word16 Find_bit_alloc_IVAS_fx( /* bits_per_bands[i] = 112; */ bits_per_bands[i] = Q18_112; move32(); #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( GT_32( 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 } } Loading
lib_com/ivas_stereo_td_bit_alloc_fx.c +21 −1 Original line number Diff line number Diff line Loading @@ -204,13 +204,25 @@ void tdm_bit_alloc( } ELSE { #ifdef FIX_2585_BIT_ALLOCATION_DIFF Word16 neg = 0; move16(); if ( bit_rate_diff_fx < 0 ) { neg = 1; move16(); } #endif IF( LT_16( ener_ratio_idx, LRTD_STEREO_MID_IS_PRIM ) ) { bit_rate_diff_fx = imult3216( bit_rate_diff_fx, sub( LRTD_STEREO_MID_IS_PRIM, ener_ratio_idx ) ); /*Q0*/ bit_rate_diff_fx = L_shr( bit_rate_diff_fx, 1 ); /*Q0*/ bit_rate_diff_fx = Mpy_32_16_1( L_abs( bit_rate_diff_fx ), 3277 /*0.1f in Q15*/ ); /*Q0*/ #ifdef FIX_2585_BIT_ALLOCATION_DIFF if ( neg != 0 ) #else if ( bit_rate_diff_fx < 0 ) #endif { bit_rate_diff_fx = L_negate( bit_rate_diff_fx ); } Loading @@ -220,7 +232,11 @@ void tdm_bit_alloc( bit_rate_diff_fx = imult3216( bit_rate_diff_fx, sub( ener_ratio_idx, LRTD_STEREO_MID_IS_PRIM ) ); /*Q0*/ bit_rate_diff_fx = L_shr( bit_rate_diff_fx, 1 ); /*Q0*/ bit_rate_diff_fx = Mpy_32_16_1( L_abs( bit_rate_diff_fx ), 3277 /*0.1f in Q15*/ ); /*Q0*/ #ifdef FIX_2585_BIT_ALLOCATION_DIFF if ( neg != 0 ) #else if ( bit_rate_diff_fx < 0 ) #endif { bit_rate_diff_fx = L_negate( bit_rate_diff_fx ); } Loading Loading @@ -322,7 +338,11 @@ void tdm_bit_alloc( *tdm_low_rate_mode = 0; move16(); } #ifndef FIX_2585_BIT_ALLOCATION_DIFF ELSE IF( ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, TDM_UC_NORMAL_MODE_MINBR_LP_R ) && EQ_16( coder_type, UNVOICED ) ) || ( tdm_lp_reuse_flag == 0 && LE_32( *total_brate_sec, L_deposit_l( add( tdm_bit_allc_tbl[idx][0], MID_LP_BRATE ) ) ) ) ) #else ELSE IF( ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, TDM_UC_NORMAL_MODE_MINBR_LP_R ) && EQ_16( coder_type, UNVOICED ) ) || ( tdm_lp_reuse_flag == 0 && LT_32( *total_brate_sec, L_deposit_l( add( tdm_bit_allc_tbl[idx][0], MID_LP_BRATE ) ) ) ) ) #endif { *total_brate_sec = L_add( *total_brate_sec, MID_LP_BRATE ); /*Q0*/ move32(); Loading
lib_com/options.h +2 −1 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ #define NONBE_FIX_2575 /* Fhg: Fix issue 2575, precision loss in FD CNG */ #define FIX_2584_TD_SM_ISSUE /* VA: Fix inconsistencies in the SM part of the TD stereo */ #define FIX_2556_ALIGN_CONDITIONS /* VA: Fix different conditions that were not exact between float and fix, BE on self-test */ #define FIX_2585_BIT_ALLOCATION_DIFF /* VA : issue 2585, bit allocation different behaviors between float and fixed-point for corner cases */ #define FIX_NONBE_2579_INCORRECT_LAG_CALCULATION /* Dolby: fix 2579: Incorrect lag calculation */ /* Macros for issue 1966 are independent, phase diff is always BE for EVS_MONO */ Loading