diff --git a/lib_com/bitalloc.c b/lib_com/bitalloc.c index 0daed8fc5c1be53d1aee2ba3ccb7bb04b389f832..61a666e6ae4ed78e1d7c1975238c22447d82f553 100644 --- a/lib_com/bitalloc.c +++ b/lib_com/bitalloc.c @@ -43,6 +43,7 @@ #include "basop_proto_func.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------- * bitalloc() * @@ -530,6 +531,7 @@ int16_t BitAllocF( return shr( tmp, 3 ); } +#endif /*-------------------------------------------------------------------* * Bit_group() diff --git a/lib_com/bitallocsum.c b/lib_com/bitallocsum.c index 0b46e5cc99636b8541ce892090aaa64da72710cd..e3eb13723bed6bc5670ea3e14c5e0d8cce505670 100644 --- a/lib_com/bitallocsum.c +++ b/lib_com/bitallocsum.c @@ -40,6 +40,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------- * bitallocsum() * @@ -91,3 +92,4 @@ void bitallocsum( return; } +#endif diff --git a/lib_com/bits_alloc_fx.c b/lib_com/bits_alloc_fx.c index 1c247a9fb84c3a915cff6b6449c8c7efd6bcb079..8025ca53db48b2009b1e7be04d15cf3614618d13 100644 --- a/lib_com/bits_alloc_fx.c +++ b/lib_com/bits_alloc_fx.c @@ -1064,12 +1064,10 @@ ivas_error config_acelp1( bits = sub( bits, acelp_cfg->mid_lsf_bits ); } -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE ELSE IF( EQ_16( tdm_lp_reuse_flag, 1 ) && EQ_16( idchan, 1 ) && NE_16( active_cnt, 1 ) ) { bits = sub( bits, TDM_IC_LSF_PRED_BITS ); } -#endif /* gain Q bit-budget - part 1 */ test(); test(); @@ -1789,7 +1787,6 @@ ivas_error config_acelp1( test(); IF( idchan > 0 && EQ_16( element_mode, IVAS_CPE_TD ) ) { -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE IF( !tdm_lp_reuse_flag ) { acelp_cfg->lsf_bits = add( acelp_cfg->lsf_bits, bits ); /* increase LSF Q bits */ @@ -1824,33 +1821,7 @@ ivas_error config_acelp1( bits = sub( bits, allocate_unused( core_brate, coder_type, bits, 1, 0, LSFPRM, &acelp_cfg->lsf_bits ) ); } } -#else - Word16 nb_prm = 4; - - if ( tdm_low_rate_mode == 1 ) - { - nb_prm = 2; - } - - /* First add remaining bits on gains */ - if ( !( *uc_two_stage_flag ) ) - { - bits -= allocate_unused( core_brate, coder_type, bits, nb_prm, 0, GAINSPRM, acelp_cfg->gains_mode ); - } - - /* Then, Increase pitch bit budget */ - if ( tdm_Pitch_reuse_flag == 0 && bits > 0 ) - { - bits -= allocate_unused( core_brate, coder_type, bits, nb_prm, 0, PITCHPRM, acelp_cfg->pitch_bits ); - } - /* Increase mid-lsf bit budget */ - if ( tdm_lp_reuse_flag == 0 && bits > 0 ) - { - bits -= allocate_unused( core_brate, coder_type, bits, 1, 0, MID_LSFSPRM, &acelp_cfg->mid_lsf_bits ); - bits -= allocate_unused( core_brate, coder_type, bits, 1, 0, LSFPRM, &acelp_cfg->lsf_bits ); - } -#endif #ifdef DEBUGGING if ( idchan > 0 && bits > 0 && ( coder_type > UNVOICED || tdm_low_rate_mode == 0 ) ) { diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index 467ae9a8a74c2c91e8ee00ffbf25939883e2edab..1acf69c2ab60437244c65c92cde2df396f7fa7ef 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -220,7 +220,7 @@ Word16 rate2EVSmode( *is_amr_wb = 0; move16(); } - switch ( brate ) + SWITCH( brate ) { /* EVS Primary modes */ case FRAME_NO_DATA: @@ -252,7 +252,7 @@ Word16 rate2EVSmode( case HQ_128k: return PRIMARY_128000; default: - break; + BREAK; } if ( is_amr_wb != NULL ) { diff --git a/lib_com/calc_st_com.c b/lib_com/calc_st_com.c index 3c263838cbfb0044091735334ef9d4d1d58c656e..0c226076ee5100b1a36c2886a1ac5b25d9665c0a 100644 --- a/lib_com/calc_st_com.c +++ b/lib_com/calc_st_com.c @@ -42,6 +42,7 @@ #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------------- * calc_rc0_h() * @@ -93,7 +94,6 @@ static void calc_rc0_h( return; } - /*---------------------------------------------------------------------------- * calc_st_filt() * @@ -151,7 +151,6 @@ void calc_st_filt( return; } - /*---------------------------------------------------------------------------- * filt_mu() * @@ -305,3 +304,4 @@ void blend_subfr2_flt( return; } +#endif diff --git a/lib_com/cb_shape.c b/lib_com/cb_shape.c index 8f7fa62264eae9eecdbffa131be1937465d7b126..0f87b8c0a2abaa70891f6a61dbfe8d9cf5f28682 100644 --- a/lib_com/cb_shape.c +++ b/lib_com/cb_shape.c @@ -40,6 +40,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * cb_shape() * @@ -120,3 +121,4 @@ void cb_shape( return; } +#endif diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 264973581d499c2bca37e191fb92b03541747fde..52d4bbbb88646e822135f863d49e685bc5599a01 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -1629,6 +1629,7 @@ void cldfbSynthesis_ivas_fx( } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * configureClfdb() * @@ -1652,6 +1653,7 @@ void configureCldfb_ivas( return; } +#endif #ifdef IVAS_FLOAT_FIXED void configureCldfb_ivas_enc_fx( diff --git a/lib_com/cng_exc.c b/lib_com/cng_exc.c index 716750db83f3b14ac11c7c41d8468b8b7da25a12..dc7acaa8cce3ceb6bd6576920577c44e2a0762e7 100644 --- a/lib_com/cng_exc.c +++ b/lib_com/cng_exc.c @@ -583,7 +583,7 @@ void cng_params_upd( } #endif - +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * get_cng_mode_ivas() * @@ -619,3 +619,4 @@ int16_t get_cng_mode_ivas( return ( CNG_mode ); } +#endif diff --git a/lib_com/cnst.h b/lib_com/cnst.h index 7ee29ab3dc8aa86a572aefe6777b1db357beed6f..a7d92629c5fe669907f6b53875a5a634395dfad0 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -731,9 +731,7 @@ enum #define L_SUBFR16k ( L_FRAME16k / NB_SUBFR ) /* subframe size at 16kHz */ #define L_HALFR16k ( 2 * L_SUBFR16k ) /* half-frame size at 16kHz */ -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT #define MAX_LP_FILTER_ORDER 20 /* Max order of an LP filter */ -#endif #define L_INTERPOL2 16 /* Length of filter for interpolation */ #define L_INTERPOL ( L_INTERPOL2 + 1 ) /* Length of filter for interpolation */ #define TILT_FAC 0.68f /* tilt factor (denominator) */ diff --git a/lib_com/codec_tcx_common_flt.c b/lib_com/codec_tcx_common_flt.c index a9314e871522aa830b23aa958b94faa95c78bab9..801bb57460699821fa91618585df5a19940a1691 100644 --- a/lib_com/codec_tcx_common_flt.c +++ b/lib_com/codec_tcx_common_flt.c @@ -40,6 +40,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * tcxGetNoiseFillingTilt() * @@ -201,7 +202,6 @@ void tcxInvertWindowGrouping_flt( return; } - /*-------------------------------------------------------------------* * tcx5SpectrumInterleaving() * @@ -330,3 +330,4 @@ void tcx5TnsUngrouping( return; } +#endif diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index 8a0c058aaccf29d1cf31b0b4a2849791dd5c1d6e..1b9c3f6b4f0d39f60bac73376271f1d04a215d23 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -788,6 +788,7 @@ Word16 getTcxBandwidth( return tcxBandwidth; /*Q15*/ } +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * getTcxBandwidth_flt() * @@ -807,6 +808,7 @@ float getTcxBandwidth_flt( return tcxBandwidth; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -1012,6 +1014,7 @@ Word16 getIgfPresent_fx( } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * getCnaPresent() * @@ -1051,6 +1054,7 @@ int16_t getCnaPresent( return flag_cna; } +#endif Word16 getCnaPresent_fx( const Word16 element_mode, /* i : element mode Q0*/ diff --git a/lib_com/deemph.c b/lib_com/deemph.c index 30ffda2a2999785037ca51f959290cd3ad1bc912..61f442b434fc19749afcc5eee7fd1bf247d13b9f 100644 --- a/lib_com/deemph.c +++ b/lib_com/deemph.c @@ -39,6 +39,8 @@ #include "prot.h" #include "wmc_auto.h" #include "prot_fx.h" + +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * deemph() * @@ -69,6 +71,7 @@ void deemph( return; } +#endif void deemph_fx_32( Word16 shift, /*scaled output*/ diff --git a/lib_com/dlpc_bfi.c b/lib_com/dlpc_bfi.c index caf29485447242aa4bc03c89dbee9d3941d3431b..5aa8396804154dd8c910bf3b237e7f55119490c8 100644 --- a/lib_com/dlpc_bfi.c +++ b/lib_com/dlpc_bfi.c @@ -41,6 +41,7 @@ #include "rom_com.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * routine: dlpc_bfi_flt() * @@ -75,3 +76,4 @@ void dlpc_bfi_flt( return; } +#endif diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index de6d747c90fac5852bfcc38362c0476f4eaeaf5d..e6fa452dbdcf7e9a01ed3cb2469a178d9fa2f9f7 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -1359,12 +1359,7 @@ void minimum_statistics_fx( scalar16 = shl( scalar16, s3 ); scalar16 = s_max( scalar16, MSALPHACORMAX ); -#ifdef IVAS_ENH32_CADENCE_CHANGES hFdCngCom->msAlphaCor[cnt] = Madd_32_16( L_mult( scalar16, msAlphaCorAlpha2 ), hFdCngCom->msAlphaCor[cnt], msAlphaCorAlpha ); -#else - hFdCngCom->msAlphaCor[cnt] = L_add( Mpy_32_16_1( hFdCngCom->msAlphaCor[cnt], msAlphaCorAlpha ), - L_mult( scalar16, msAlphaCorAlpha2 ) ); -#endif move32(); } @@ -1450,12 +1445,7 @@ void minimum_statistics_fx( } /* Compute the PSD (smoothed periodogram) in each band */ -#ifdef IVAS_ENH32_CADENCE_CHANGES msPsd[j] = round_fx( Madd_32_16( Mpy_32_16_1( msAlpha[j], msPsd[j] ), L_sub( 2147483647l /*1.0 Q31*/, msAlpha[j] ), msPeriodog[j] ) ); -#else - msPsd[j] = round_fx( L_add( Mpy_32_16_1( msAlpha[j], msPsd[j] ), - Mpy_32_16_1( L_sub( 2147483647l /*1.0 Q31*/, msAlpha[j] ), msPeriodog[j] ) ) ); -#endif move16(); } msPsdSum[cnt] = dotp_s_fx( msPsd + start, psize + start, current_len, CNG_HS ); @@ -1534,21 +1524,13 @@ void minimum_statistics_fx( /* Compute bias correction Bmin */ tmp0 = Mpy_32_16_1( scalar, QeqInv ); -#ifdef IVAS_ENH32_CADENCE_CHANGES tmp1 = L_msu( 1073741824l /*0.5 Q31*/, msM_win, QeqInv ); -#else - tmp1 = L_sub( 1073741824l /*0.5 Q31*/, L_mult( msM_win, QeqInv ) ); -#endif tmp16 = BASOP_Util_Divide3232_uu_1616_Scale( tmp0, tmp1, &s ); msBminWin[j] = L_add( 134217728l /*1.0 Q27*/, L_shl( L_deposit_h( tmp16 ), add( s, 7 - 4 ) ) ); move32(); tmp0 = Mpy_32_16_1( scalar2, QeqInv ); -#ifdef IVAS_ENH32_CADENCE_CHANGES tmp1 = L_msu( 1073741824l /*0.5 Q31*/, msM_subwin, QeqInv ); -#else - tmp1 = L_sub( 1073741824l /*0.5 Q31*/, L_mult( msM_subwin, QeqInv ) ); -#endif tmp16 = BASOP_Util_Divide3232_uu_1616_Scale( tmp0, tmp1, &s ); msBminSubWin[j] = L_add( 134217728l /*1.0 Q27*/, L_shl( L_deposit_h( tmp16 ), s ) ); move32(); diff --git a/lib_com/fill_spectrum.c b/lib_com/fill_spectrum.c index d9f24d8d551c3ff568dc04d2c36c3d78fa5bcd23..3e15bb26e1e6e231f784a34d7253042814e375ec 100644 --- a/lib_com/fill_spectrum.c +++ b/lib_com/fill_spectrum.c @@ -45,6 +45,7 @@ #include "ivas_prot_fx.h" #endif +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * fill_spectrum() * @@ -268,6 +269,7 @@ void fill_spectrum( return; } +#endif #ifdef IVAS_FLOAT_FIXED void ivas_fill_spectrum_fx( diff --git a/lib_com/gs_bitallocation.c b/lib_com/gs_bitallocation.c index f1f9840da045d5859666f581b17d5a523cfd0560..5e121db56d29cab1e4ff07af4b149f2f3390d755 100644 --- a/lib_com/gs_bitallocation.c +++ b/lib_com/gs_bitallocation.c @@ -52,7 +52,6 @@ static float Find_bit_frac( const int16_t nb_band, const int16_t remaining_bits static void reajust_bits( float *bits_per_bands, const int16_t st_band, const int16_t end_band, const int16_t sum_bit_in, const int16_t bit_bdgt_in ); -#ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING #define Q15_0_33 10922 /* 0.33 */ #define Q18_0_1 26214 /* 0.1 */ #define Q18_0_50 131072 /* 0.50 */ @@ -74,7 +73,6 @@ 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 maximum_fx( const Word16 *vec_fx, const Word16 lvec_fx, Word16 *max_fx ); -#endif /*-------------------------------------------------------------------* * bands_and_bit_alloc() @@ -113,12 +111,7 @@ void bands_and_bit_alloc( int16_t pos, band; float SWB_bit_budget; float bits_per_bands[MBANDS_GN_BITALLOC16k]; -#ifndef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING - float fzero_val, mp, mb, nb_bands_adj, bit_adj; - int16_t nb_pulse_per_band[MBANDS_GN_BITALLOC16k]; -#else float fzero_val; -#endif /* initializations */ nb_tot_bands = 16; @@ -218,189 +211,8 @@ void bands_and_bit_alloc( { if ( GSC_IVAS_mode > 0 ) { -#ifndef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING - SWB_bit_budget = *bit; - st_band = 5; - - set_f( bits_per_bands, 0, MBANDS_GN_BITALLOC16k ); - - /* 2- Decide the pourcentage of bits allocated to LF (between 50-75%) depending of the temporal contribution in GSC */ - bit_fracf = ( -0.125f * Diff_len + 76.0f ) / 100; - bit_fracf = check_bounds( bit_fracf, 0.50f, 0.75f ); - - /* Adjusment of the bitrate between LF and HF base on the content type */ - /* 1 = new GSC bit alloc - 2 = GSC bit alloc for tc frame - 3 = more music like (should not happen often given music is coded with dft) */ - - if ( GSC_IVAS_mode <= 3 ) - { - nb_bands_max -= 6; - } - - if ( GSC_IVAS_mode == 2 ) - { - bit_fracf += 0.1f; - nb_bands_max--; - } - - if ( GSC_IVAS_mode == 3 ) - { - bit_fracf -= 0.1f; - nb_bands_max += 3; - } - - /* First find how much we want to share between LF and HF, at low bitrate, a miminum of bits is needed in LF by limitating the number of bands*/ - /* Adjust the number of band based on the content type and bitrate */ - nb_bands_adj = 1.0f; - if ( GSC_IVAS_mode == 1 && core_brate < GSC_L_RATE_STG ) - { - nb_bands_adj = 0.0125f * SWB_bit_budget - 0.75f; - } - else if ( GSC_IVAS_mode != 2 && core_brate > GSC_H_RATE_STG ) - { - nb_bands_adj = 0.02f * SWB_bit_budget - 1.2f; - } - nb_bands_max = (int16_t) ( nb_bands_max * nb_bands_adj + 0.5f ); - nb_bands_max = check_bounds_s( nb_bands_max, 5, nb_tot_bands ); - - bit_fracf *= SWB_bit_budget; - - /* Estimation of the number of bit used in HF */ - /* with only the first weigthing The number of bits in max_ener_band[st_band-1] = 17% of bit_fracf */ - mb = .17f * bit_fracf; - mp = ( 2.0f * DSR_NB_PULSE ); - if ( core_brate < GSC_L_RATE_STG && GSC_IVAS_mode == 3 ) - { - mp = 1.5f * DSR_NB_PULSE; - } - else if ( core_brate < GSC_L_RATE_STG ) - { - mp = DSR_NB_PULSE; - } - - /* We want max_ener_band[st_band] <= max_ener_band[st_band-1] and max_ener_band[nb_bands_max-1] <= max_ener_band[st_band]*/ - /* We will estimate the number of bits to allocate of HF and put the remaining bits, if any, back on LF */ - /* compute the total possible number of band to be coded */ - nb_tot_bands = (int16_t) ( ( SWB_bit_budget - bit_fracf ) / ( mp + ( mb - mp ) / 2.0f ) ); - mp = min( mp, mb ); - if ( nb_tot_bands + st_band > nb_bands_max ) - { - bit_adj = ( ( mb + mp ) / 2 ) * ( nb_tot_bands + st_band - nb_bands_max ); - bit_adj = max( 0, bit_adj ); - nb_tot_bands = nb_bands_max - st_band; - bit_fracf += bit_adj; - } - nb_tot_bands += st_band; - - /* Allocate bits to LF */ - etmp = 0.23f; - for ( j = 0; j < st_band; j++ ) - { - i = j; - max_ener_band[j] = i; - ener_vec[i] = MIN16B; - bits_per_bands[j] = etmp * bit_fracf; - etmp -= 0.015f; - } - - SWB_bit_budget -= bit_fracf; - - /* Find low energy band in HF */ - set_s( nb_pulse_per_band, 2, MBANDS_GN_BITALLOC16k ); - for ( i = st_band + 2; i < nb_tot_bands - 1; i++ ) - { - if ( ener_vec[i] < ener_vec[i - 1] && ener_vec[i] < ener_vec[i + 1] ) - { - nb_pulse_per_band[i] = 1; - } - } - for ( j = st_band; j < nb_tot_bands; j++ ) - { - if ( j > 6 ) - { - i = maximum( ener_vec, nb_tot_bands, &etmp ); - } - else - { - i = j; - } - - max_ener_band[j] = i; - ener_vec[i] = MIN16B; - } - - /* Recompute the final bit distribution for HF */ - if ( nb_tot_bands > st_band ) - { - bit_fracf = DSR_NB_PULSE; - mb = ( SWB_bit_budget * 2 / ( nb_tot_bands - st_band ) ) - mp; - bit_fracf = ( mb - mp ) / ( nb_tot_bands - st_band ); - mb -= bit_fracf; - /* Do the distribution */ - for ( j = st_band; j < nb_tot_bands; j++ ) - { - if ( nb_pulse_per_band[max_ener_band[j]] > 1 ) - { - bits_per_bands[max_ener_band[j]] = mb; - } - else - { - bits_per_bands[max_ener_band[j]] = 4.5f; - } - mb -= bit_fracf; - SWB_bit_budget -= bits_per_bands[max_ener_band[j]]; - } - } - - /* Series of verification in case bit allocated != the budget */ - if ( SWB_bit_budget > 0 ) - { - i = st_band - 1; - while ( SWB_bit_budget > 0 ) - { - bits_per_bands[i]++; - SWB_bit_budget--; - i--; - if ( i == -1 ) - { - i = st_band - 1; - } - } - } - - nb_bands = nb_tot_bands; - - sum_bit = 0; - j = 0; - for ( i = 0; i < nb_bands; i++ ) - { - if ( bits_per_bands[i] > 112 ) - { - sum_bit += bits_per_bands[i] - 112; - bits_per_bands[i] = 112; - j = i + 1; - } - - /* safety check for overage bit reallocation */ - else if ( bits_per_bands[i] + sum_bit / 3 > 112 ) - { - j = i + 1; - } - } - - if ( sum_bit != 0 ) - { - sum_bit /= ( nb_bands - j ); - for ( i = j; i < nb_bands; i++ ) - { - bits_per_bands[i] += sum_bit; - } - } -#else nb_tot_bands = Find_bit_alloc_IVAS_int( core_brate, GSC_IVAS_mode, Diff_len, nb_tot_bands, L_frame, bit, max_ener_band, ener_vec, bits_per_bands ); nb_bands = nb_tot_bands; -#endif } else if ( GSC_noisy_speech ) { @@ -961,7 +773,6 @@ static float Find_bit_frac( return ( var_out ); } -#ifdef NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING static Word16 Find_bit_alloc_IVAS_int( /* o : Number of band to encode */ const Word32 core_brate, /* i : core bit rate */ const Word16 GSC_IVAS_mode, /* i : GSC IVAS mode */ @@ -1263,4 +1074,3 @@ static Word16 maximum_fx( /* o : index of the maximum val return ind; } -#endif diff --git a/lib_com/gs_bitallocation_ivas_fx.c b/lib_com/gs_bitallocation_ivas_fx.c index 9ae92e61ff1bcf658acf5354191a1a6d844c87fa..38c4e19f95a276a5ddce5a1b0fd9e55f2aa8399e 100644 --- a/lib_com/gs_bitallocation_ivas_fx.c +++ b/lib_com/gs_bitallocation_ivas_fx.c @@ -14,7 +14,6 @@ static void reajust_bits_fx( Word32 *bits_per_bands, const Word16 st_band, const Word16 end_band, const Word16 sum_bit_in, const Word16 bit_bdgt_in ); -#ifdef FIX_802_1137_1137_GSC_IVAS_FXFLT_DECODING /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -41,10 +40,7 @@ static void reajust_bits_fx( Word32 *bits_per_bands, const Word16 st_band, const *-----------------------------------------------------------------*/ static Word16 Find_norm_inv( const Word32 ToDivide, Word16 *e_div ); static Word16 Find_bit_alloc_IVAS( const Word32 core_brate, const Word16 GSC_IVAS_mode, const Word16 Diff_len, const Word16 nb_tot_bands, Word16 *bit, Word16 *max_ener_band, Word16 *ener_vec, Word32 *bits_per_bands ); -#endif -#ifdef FIX_802__NON_BE_DECODING static Word32 Find_bit_frac( const Word16 nb_band, const Word16 remaining_bits ); -#endif /*==================================================================================*/ /* FUNCTION : void bands_and_bit_alloc_ivas_fx(); */ /*----------------------------------------------------------------------------------*/ @@ -111,10 +107,6 @@ void bands_and_bit_alloc_ivas_fx( Word32 bits_per_bands[MBANDS_GN_BITALLOC16k]; // Q18 Word16 w_sum_bit; Word16 fzero_val; -#ifndef FIX_802_1137_1137_GSC_IVAS_FXFLT_DECODING - Word32 mp, mb, nb_bands_adj, bit_adj; - Word16 nb_pulse_per_band[MBANDS_GN_BITALLOC16k]; -#endif #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; #endif @@ -251,241 +243,8 @@ void bands_and_bit_alloc_ivas_fx( { IF( GSC_IVAS_mode > 0 ) { -#ifndef FIX_802_1137_1137_GSC_IVAS_FXFLT_DECODING - SWB_bit_budget = *bit; // Q0 - move16(); - st_band = 5; - move16(); - - set_l( bits_per_bands, 0, MBANDS_GN_BITALLOC16k ); - - /* 2- Decide the pourcentage of bits allocated to LF (between 50-75%) depending of the temporal contribution in GSC */ - // bit_fracf = (-0.125f * Diff_len + 76.0f) / 100; - bit_fracf = L_add( Mpy_32_32( -2684355, L_shl( Diff_len, Q18 ) ), 199229 ); // Q18 - // bit_fracf = check_bounds(bit_fracf, 0.50f, 0.75f); - bit_fracf = check_bounds_l( bit_fracf, 131072, 196608 ); // Q18 - - /* Adjusment of the bitrate between LF and HF base on the content type */ - /* 1 = new GSC bit alloc - 2 = GSC bit alloc for tc frame - 3 = more music like (should not happen often given music is coded with dft) */ - - if ( LE_16( GSC_IVAS_mode, 3 ) ) - { - nb_bands_max = sub( nb_bands_max, 6 ); - } - - IF( EQ_16( GSC_IVAS_mode, 2 ) ) - { - // bit_fracf += 0.1f; - bit_fracf = L_add( bit_fracf, 26214 ); // Q18 - nb_bands_max = sub( nb_bands_max, 1 ); - } - - IF( EQ_16( GSC_IVAS_mode, 3 ) ) - { - // bit_fracf -= 0.1f; - bit_fracf = L_sub( bit_fracf, 26214 ); // Q18 - nb_bands_max = add( nb_bands_max, 3 ); - } - - /* First find how much we want to share between LF and HF, at low bitrate, a miminum of bits is needed in LF by limitating the number of bands*/ - /* Adjust the number of band based on the content type and bitrate */ - // nb_bands_adj = 1.0f; - nb_bands_adj = ONE_IN_Q18; - move32(); - test(); - test(); - IF( EQ_16( GSC_IVAS_mode, 1 ) && LT_32( core_brate, GSC_L_RATE_STG ) ) - { - // nb_bands_adj = 0.0125f * SWB_bit_budget - 0.75f; - nb_bands_adj = L_sub( Mpy_32_32( 26843546, L_shl( SWB_bit_budget, Q18 ) ), 196608 ); // Q18 - } - ELSE IF( NE_16( GSC_IVAS_mode, 2 ) && GT_32( core_brate, GSC_H_RATE_STG ) ) - { - // nb_bands_adj = 0.02f * SWB_bit_budget - 1.2f; - nb_bands_adj = L_sub( Mpy_32_32( 42949673, L_shl( SWB_bit_budget, Q18 ) ), 314572 ); // Q18 - } - // nb_bands_max = (int16_t)(nb_bands_max * nb_bands_adj + 0.5f); - nb_bands_max = extract_l( L_shr_r( nb_bands_max * nb_bands_adj, Q18 ) ); // Q0 - nb_bands_max = check_bounds_s( nb_bands_max, 5, nb_tot_bands ); - - // bit_fracf *= SWB_bit_budget; - bit_fracf = imult3216( bit_fracf, extract_l( SWB_bit_budget ) ); // Q18 - - /* Estimation of the number of bit used in HF */ - /* with only the first weigthing The number of bits in max_ener_band[st_band-1] = 17% of bit_fracf */ - // mb = .17f * bit_fracf; - mb = Mpy_32_32( 365072220, bit_fracf ); // Q18 - // mp = 2 * DSR_NB_PULSE); - mp = 2359296; // Q18 - move32(); - test(); - IF( LT_32( core_brate, GSC_L_RATE_STG ) && EQ_16( GSC_IVAS_mode, 3 ) ) - { - // mp = 1.5f * DSR_NB_PULSE; - mp = 1769472; // Q18 - move32(); - } - ELSE IF( LT_32( core_brate, GSC_L_RATE_STG ) ) - { - // mp = DSR_NB_PULSE; - mp = DSR_NB_PULSE_Q18; - move32(); - } - - /* We want max_ener_band[st_band] <= max_ener_band[st_band-1] and max_ener_band[nb_bands_max-1] <= max_ener_band[st_band]*/ - /* We will estimate the number of bits to allocate of HF and put the remaining bits, if any, back on LF */ - /* compute the total possible number of band to be coded */ - // nb_tot_bands = (int16_t)((SWB_bit_budget - bit_fracf) / (mp + (mb - mp) / 2.0f)); - nb_tot_bands = extract_l( L_sub( L_shl( SWB_bit_budget, Q18 ), bit_fracf ) / L_add( mp, L_shr( L_sub( mb, mp ), 1 ) ) ); - mp = L_min( mp, mb ); - IF( GT_16( add( nb_tot_bands, st_band ), nb_bands_max ) ) - { - bit_adj = imult3216( L_shr( L_add( mb, mp ), 1 ), sub( add( nb_tot_bands, st_band ), nb_bands_max ) ); - bit_adj = L_max( 0, bit_adj ); - nb_tot_bands = sub( nb_bands_max, st_band ); - // bit_fracf += bit_adj; - bit_fracf = L_add( bit_fracf, bit_adj ); // Q18 - } - nb_tot_bands = add( nb_tot_bands, st_band ); - - /* Allocate bits to LF */ - // etmp = 0.23f; - Word32 etmp_32fx = 493921239; // Q15 - move32(); - FOR( j = 0; j < st_band; j++ ) - { - i = j; - move16(); - max_ener_band[j] = i; - move16(); - ener_vec[i] = MIN16B; - move16(); - // bits_per_bands[j] = etmp * bit_fracf; - bits_per_bands[j] = Mpy_32_32( bit_fracf, etmp_32fx ); // 33 - 15 = Q18 - move32(); - // etmp -= 0.015f; - etmp_32fx = L_sub( etmp_32fx, 32212255 ); - } - - // SWB_bit_budget -= bit_fracf; - SWB_bit_budget = L_sub( L_shl( SWB_bit_budget, Q18 ), bit_fracf ); // Q0->Q18 - - /* Find low energy band in HF */ - set_s( nb_pulse_per_band, 2, MBANDS_GN_BITALLOC16k ); - FOR( i = st_band + 2; i < nb_tot_bands - 1; i++ ) - { - test(); - if ( LT_16( ener_vec[i], ener_vec[i - 1] ) && LT_16( ener_vec[i], ener_vec[i + 1] ) ) - { - nb_pulse_per_band[i] = 1; - move16(); - } - } - FOR( j = st_band; j < nb_tot_bands; j++ ) - { - IF( GT_16( j, 6 ) ) - { - i = maximum_fx( ener_vec, nb_tot_bands, &etmp ); - } - ELSE - { - i = j; - move16(); - } - - max_ener_band[j] = i; - move16(); - ener_vec[i] = MIN16B; - move16(); - } - - /* Recompute the final bit distribution for HF */ - IF( GT_16( nb_tot_bands, st_band ) ) - { - // bit_fracf = DSR_NB_PULSE; - mb = ( L_shl( SWB_bit_budget, 1 ) / sub( nb_tot_bands, st_band ) ) - mp; // Q18 - bit_fracf = L_sub( mb, mp ) / sub( nb_tot_bands, st_band ); - mb = L_sub( mb, bit_fracf ); - /* Do the distribution */ - FOR( j = st_band; j < nb_tot_bands; j++ ) - { - IF( GT_16( nb_pulse_per_band[max_ener_band[j]], 1 ) ) - { - bits_per_bands[max_ener_band[j]] = mb; - move32(); - } - ELSE - { - // bits_per_bands[max_ener_band[j]] = 4.5f; - bits_per_bands[max_ener_band[j]] = 1179648; - move32(); - } - mb = L_sub( mb, bit_fracf ); - SWB_bit_budget = L_sub( SWB_bit_budget, bits_per_bands[max_ener_band[j]] ); // Q18 - } - } - - /* Series of verification in case bit allocated != the budget */ - IF( SWB_bit_budget > 0 ) - { - i = sub( st_band, 1 ); - WHILE( SWB_bit_budget > 0 ) - { - // bits_per_bands[i]++; - bits_per_bands[i] = L_add( bits_per_bands[i], 262144 ); - // SWB_bit_budget--; - SWB_bit_budget = L_sub( SWB_bit_budget, 262144 ); - i = sub( i, 1 ); - IF( EQ_16( i, -1 ) ) - { - i = sub( st_band, 1 ); - } - } - } - - nb_bands = nb_tot_bands; - move16(); - - sum_bit = 0; - move32(); - j = 0; - move16(); - FOR( i = 0; i < nb_bands; i++ ) - { - // if (bits_per_bands[i] > 112) - IF( GT_32( bits_per_bands[i], 29360128 ) ) - { - sum_bit = L_add( sum_bit, L_sub( bits_per_bands[i], 112 ) ); - sum_bit = L_add( sum_bit, L_sub( bits_per_bands[i], 29360128 ) ); - // bits_per_bands[i] = 112; - bits_per_bands[i] = 29360128; - move32(); - j = add( i, 1 ); - } - - /* 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], divide3216( L_shl( sum_bit, 1 ), 3 ) ), 29360128 ) ) - { - j = add( i, 1 ); - } - } - - IF( sum_bit != 0 ) - { - // sum_bit /= (nb_bands - j); - sum_bit = divide3216( L_shl( sum_bit, 1 ), sub( nb_bands, j ) ); - FOR( i = j; i < nb_bands; i++ ) - { - bits_per_bands[i] = L_add( bits_per_bands[i], sum_bit ); - } - } -#else nb_tot_bands = Find_bit_alloc_IVAS( core_brate, GSC_IVAS_mode, Diff_len, nb_tot_bands, bit, max_ener_band, ener_vec, bits_per_bands ); nb_bands = nb_tot_bands; -#endif } ELSE #endif @@ -533,11 +292,7 @@ void bands_and_bit_alloc_ivas_fx( set32_fx( bits_per_bands, 0, MBANDS_GN ); /*bit_fracf = (1.0f/nb_bands)*(SWB_bit_budget); */ -#ifdef FIX_802__NON_BE_DECODING bit_fracf = Find_bit_frac( nb_bands, extract_l( SWB_bit_budget ) ); /*Q18*/ -#else - bit_fracf = L_mult( div_s( 1, nb_bands ), shl( (Word16) SWB_bit_budget, 2 ) ); /* Q18 */ -#endif nb_tot_bands = sub( nb_bands_max, 6 ); nb_tot_bands = s_min( nb_tot_bands, 16 ); @@ -731,11 +486,7 @@ void bands_and_bit_alloc_ivas_fx( ELSE #endif { -#ifdef FIX_802__NON_BE_DECODING bit_fracf = Find_bit_frac( st_band, bit_tmp ); /*Q18*/ -#else - bit_fracf = L_mult( div_s( 1, st_band ), shl( bit_tmp, 2 ) ); /* Q18 */ -#endif } /*------------------------------------------------------------------------ * Complete the bit allocation per frequency band @@ -1125,7 +876,6 @@ static void reajust_bits_fx( return; } -#ifdef FIX_802__NON_BE_DECODING /*-------------------------------------------------------------------* * Find_bit_frac() @@ -1177,8 +927,7 @@ static Word32 Find_bit_frac( return ( L_out ); } -#endif -#ifdef FIX_802_1137_1137_GSC_IVAS_FXFLT_DECODING + static Word16 Find_bit_alloc_IVAS( /*o: Number of band to encode */ const Word32 core_brate, /* i : core bit rate */ const Word16 GSC_IVAS_mode, /* i : GSC IVAS mode */ @@ -1461,4 +1210,3 @@ static Word16 Find_norm_inv( const Word32 ToDivide, Word16 *e_div ) /* Find norm return d_tmp; } #endif -#endif diff --git a/lib_com/hq2_bit_alloc.c b/lib_com/hq2_bit_alloc.c index e98a680bfc659c9eafe078aca4cc7e03b60652df..a6fbf716109e536469add9e1634f6464bd826f42 100644 --- a/lib_com/hq2_bit_alloc.c +++ b/lib_com/hq2_bit_alloc.c @@ -44,6 +44,7 @@ #include "stl.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED #define WMC_TOOL_SKIP /*------------------------------------------------------------------- @@ -802,3 +803,4 @@ void hq2_bit_alloc( } #undef WMC_TOOL_SKIP +#endif diff --git a/lib_com/hq2_core_com.c b/lib_com/hq2_core_com.c index e238ac7243c8a55c03d4313d5d72f73029fe3157..abfcba9230a9d75de8c194297d6b321fc85a6dfd 100644 --- a/lib_com/hq2_core_com.c +++ b/lib_com/hq2_core_com.c @@ -44,6 +44,7 @@ #include "basop_proto_func.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * mdct_spectrum_denorm() * @@ -95,6 +96,7 @@ void mdct_spectrum_denorm( return; } + /*--------------------------------------------------------------------------* * hq2_core_configure() * @@ -302,6 +304,8 @@ void reverse_transient_frame_energies( return; } +#endif + #define WMC_TOOL_SKIP void bit_allocation_second_fx2( @@ -434,6 +438,7 @@ void bit_allocation_second_fx2( #undef WMC_TOOL_SKIP +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * spt_shorten_domain_pre() * @@ -599,3 +604,4 @@ void spt_swb_peakpos_tmp_save( return; } +#endif diff --git a/lib_com/hq2_noise_inject.c b/lib_com/hq2_noise_inject.c index d7cded1bc990d081df7be5d3cdd94485c61f954a..53cc626e96556eeb623e890c15383c624adfaddc 100644 --- a/lib_com/hq2_noise_inject.c +++ b/lib_com/hq2_noise_inject.c @@ -40,6 +40,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * hq2_noise_inject() * @@ -273,3 +274,4 @@ void hq2_noise_inject( return; } +#endif diff --git a/lib_com/hq_bit_allocation.c b/lib_com/hq_bit_allocation.c index 6c094eebcb86826459c146c16035af455c8e8c6f..4df337011e2928e81b584e4e30ef560d1eb74565 100644 --- a/lib_com/hq_bit_allocation.c +++ b/lib_com/hq_bit_allocation.c @@ -41,6 +41,7 @@ #include "rom_com.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * hq_bit_allocation() * @@ -218,3 +219,4 @@ void hq_bit_allocation( return; } +#endif diff --git a/lib_com/hq_conf.c b/lib_com/hq_conf.c index e99e89ba7d6224a79a5231e9be61434995c4cfa0..a676220973ff0ddf86cf009662b8b8d9330540f8 100644 --- a/lib_com/hq_conf.c +++ b/lib_com/hq_conf.c @@ -42,6 +42,7 @@ #include "wmc_auto.h" #include "prot_fx.h" +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * hq_configure() * @@ -254,6 +255,7 @@ void hq_configure( return; } +#endif void hq_configure_fx( const Word16 length, /* i : Frame length Q0 */ diff --git a/lib_com/hq_tools.c b/lib_com/hq_tools.c index b314991c2082ca6e5887c080f733302f6cfdf254..ce65b1777a80f38265b78c06395b6530c459865a 100644 --- a/lib_com/hq_tools.c +++ b/lib_com/hq_tools.c @@ -41,12 +41,15 @@ #include "rom_com.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * Local function prototypes *--------------------------------------------------------------------------*/ static void overlap_hq_bwe( const float *hq_swb_overlap_buf, float *coeff_out1, const int16_t n_swb_overlap_offset, const int16_t n_swb_overlap, const int16_t *R, const int16_t num_env_bands, const int16_t num_sfm, const int16_t *sfm_end ); +#endif +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * hq_swb_harmonic_calc_norm_envelop() * @@ -1040,7 +1043,6 @@ void hvq_concat_bands( return; } - /*--------------------------------------------------------------------------* * map_hq_generic_fenv_norm() * @@ -1120,7 +1122,6 @@ void map_hq_generic_fenv_norm( return; } - /*-------------------------------------------------------------------* * update_rsubband() * @@ -1152,8 +1153,9 @@ static void update_rsubband( return; } +#endif - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * get_nor_delta_hf() * @@ -1201,8 +1203,9 @@ int16_t get_nor_delta_hf( return add_bits_denv; } +#endif - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * calc_nor_delta_hf() * @@ -1294,7 +1297,9 @@ int16_t calc_nor_delta_hf( return add_bits_denv; } +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * hq_generic_bwe() * @@ -1330,7 +1335,6 @@ void hq_generic_bwe( return; } - /*--------------------------------------------------------------------------* * hq_wb_nf_bwe() * @@ -1667,8 +1671,9 @@ static void overlap_hq_bwe( return; } +#endif - +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * apply_envelope() * @@ -1743,8 +1748,9 @@ void apply_envelope( return; } +#endif - +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * apply_envelope_enc() * @@ -1775,8 +1781,9 @@ void apply_envelope_enc( return; } +#endif - +#ifndef IVAS_FLOAT_FIXED /*----------------------------------------------------------------------------- * floating_point_add() * @@ -1822,3 +1829,4 @@ void floating_point_add_float( return; } +#endif diff --git a/lib_com/hvq_pvq_bitalloc.c b/lib_com/hvq_pvq_bitalloc.c index d95ee0a7a794cf52025a2f450b00d58c4c658156..594e9f2604e67d97b62d20bbc100a3284d3300a8 100644 --- a/lib_com/hvq_pvq_bitalloc.c +++ b/lib_com/hvq_pvq_bitalloc.c @@ -41,6 +41,7 @@ #include "rom_com.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------*/ /* Function hvq_pvq_bitalloc */ /* ~~~~~~~~~~~~~~~~~~~~~~~~ */ @@ -185,3 +186,4 @@ int16_t hvq_pvq_bitalloc( return num_bands; } +#endif diff --git a/lib_com/igf_base.c b/lib_com/igf_base.c index 5aa8e8c3fd28751c47bfeef3ef62a0138381974f..0d44859a40e86b61e43e7c4ab238d33784346a10 100644 --- a/lib_com/igf_base.c +++ b/lib_com/igf_base.c @@ -66,7 +66,7 @@ int16_t IGF_ApplyTransFac_flt( } #endif - +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * IGF_MapBitRateToIndex_flt() * @@ -358,6 +358,7 @@ int16_t IGF_MapBitRateToIndex_flt( return bitRateIndex; } +#endif #ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* @@ -572,7 +573,7 @@ int16_t IGFCommonFuncsIGFConfiguration_flt( } #endif - +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * IGFCommonFuncsIGFGetCFTables_flt() * @@ -738,3 +739,4 @@ int16_t IGFCommonFuncsIGFGetCFTables_flt( return retValue; } +#endif diff --git a/lib_com/index_pvq_opt.c b/lib_com/index_pvq_opt.c index 5cf521c0554f51a46f9bd5905ea6ff1b5f3f604f..bac22e723954945e02242c4359b6c366275e962e 100644 --- a/lib_com/index_pvq_opt.c +++ b/lib_com/index_pvq_opt.c @@ -43,6 +43,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * LOCAL DEFINITIONS *-------------------------------------------------------------------*/ @@ -56,10 +57,12 @@ typedef uint32_t ( *NFUNCM )( int16_t ); typedef uint32_t ( *H_FUNCM )( uint32_t ); typedef void ( *IND2VECFUNCM )( int16_t, int16_t, uint32_t, int16_t * ); typedef void ( *NDIM_FUNCM )( int16_t, int16_t, uint32_t, int16_t * ); +#endif /* local constants for indexing functions c-code clarity */ +#ifndef IVAS_FLOAT_FIXED #ifndef ONE_U - +#endif #define ZERO 0 #define ONE 1 #define ONE_U 1u @@ -70,8 +73,8 @@ typedef void ( *NDIM_FUNCM )( int16_t, int16_t, uint32_t, int16_t * ); #define MINNEG 0xffffffffL #define UDIVBY3 2863311531U - - +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * local_norm_l_opt * @@ -139,7 +142,8 @@ uint32_t floor_sqrt_exact( return x; } - +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * f_odd_exact_div_opt() * @@ -1032,7 +1036,8 @@ static void vec2mind_four( return; } - +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * vec2mind_five() *-------------------------------------------------------------------*/ @@ -1048,8 +1053,8 @@ static void vec2mind_five( return; } - - +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * vec2mind() *-------------------------------------------------------------------*/ @@ -1113,7 +1118,8 @@ static void vec2mind( return; } - +#endif +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * mpvq_encode_vec() * @@ -1149,7 +1155,8 @@ PvqEntry mpvq_encode_vec( return result; } - +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * get_size_mpvq_calc_offset() * @@ -1182,7 +1189,9 @@ PvqEntry get_size_mpvq_calc_offset( return entry; } +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * mpvq_decode_vec() *-------------------------------------------------------------------*/ @@ -1224,6 +1233,8 @@ void mpvq_decode_vec( return; } +#endif +#ifndef IVAS_FLOAT_FIXED #ifdef ONE_U #undef ZERO diff --git a/lib_com/int_lsp.c b/lib_com/int_lsp.c index 75d76eb946286ccf0acd2e95a653535293ebf285..0fee8af99839ff5bef5246d68dba1c7ee1587103 100644 --- a/lib_com/int_lsp.c +++ b/lib_com/int_lsp.c @@ -42,6 +42,7 @@ #include "wmc_auto.h" #include "prot_fx.h" +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * int_lsp() * @@ -95,6 +96,7 @@ void int_lsp( return; } +#endif void int_lsp_fx( const Word16 L_frame, /* i : length of the frame */ @@ -156,7 +158,7 @@ void int_lsp_fx( return; } - +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * int_lsp4() * @@ -237,6 +239,7 @@ void int_lsp4( return; } +#endif void int_lsp4_fx( const Word16 L_frame, /* i : length of the frame */ diff --git a/lib_com/interleave_spectrum.c b/lib_com/interleave_spectrum.c index 1cf7d5ce6d0d89e82bf2c817cd5095d29eda66bb..c38de90af58d778015284b05f58be1be6cc996ce 100644 --- a/lib_com/interleave_spectrum.c +++ b/lib_com/interleave_spectrum.c @@ -45,6 +45,7 @@ #include "ivas_prot_fx.h" #endif +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * interleave_spectrum() * @@ -126,6 +127,7 @@ void interleave_spectrum( return; } +#endif #ifdef IVAS_FLOAT_FIXED void interleave_spectrum_fx( @@ -302,6 +304,7 @@ void interleave_spectrum_ivas_fx( } #endif +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * de_interleave_spectrum() * @@ -381,6 +384,7 @@ void de_interleave_spectrum( return; } +#endif void ivas_de_interleave_spectrum_fx( Word32 *coefs, /* i/o: input and output coefficients Q12 */ diff --git a/lib_com/interpol.c b/lib_com/interpol.c index 67292ad17f4bd844f353d683e2a736454c70a543..25b4f7c8e76340d443bf9b0498ef265b823b0b7a 100644 --- a/lib_com/interpol.c +++ b/lib_com/interpol.c @@ -42,6 +42,7 @@ #include "prot_fx.h" #include "prot_fx_enc.h" +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * interpolation() * @@ -78,6 +79,7 @@ float interpolation( return s; } +#endif Word32 Interpol_lc_fx( /* o : interpolated value Q15 */ const Word16 *x, /* i : input vector Q0 */ diff --git a/lib_com/isf_dec_amr_wb.c b/lib_com/isf_dec_amr_wb.c index 194354a386bbac2e8636dada74e64798a5ad92d4..b8b25d0073fd83355506041d877d49db34d73f91 100644 --- a/lib_com/isf_dec_amr_wb.c +++ b/lib_com/isf_dec_amr_wb.c @@ -146,6 +146,7 @@ void isf_dec_amr_wb( return; } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * disf_ns_28b() * @@ -284,3 +285,4 @@ void disf_2s_36b( return; } +#endif diff --git a/lib_com/ivas_agc_com.c b/lib_com/ivas_agc_com.c index 97cad5ed72ac81f3e702eca04fe8104506a35431..8e06c1418543ec356efb7c492532848cf932075e 100644 --- a/lib_com/ivas_agc_com.c +++ b/lib_com/ivas_agc_com.c @@ -39,6 +39,7 @@ #include "wmc_auto.h" #include "prot.h" +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------------------------* * Local constants *------------------------------------------------------------------------------------------*/ @@ -109,3 +110,4 @@ void ivas_agc_calcGainParams( return; } +#endif diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 546675368e4bb9020eaa6d8cc9e1f890bd29282a..873581d075066ea81c8314efc0a592cb9fdb7bdb 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1238,11 +1238,6 @@ enum #define MASA_MAXIMUM_DIRECTIONS 2 #define MASA_MAX_TRANSPORT_CHANNELS 2 -#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP -#define MASA_SUR_COH_THRESHOLD 1e-7f -#define MASA_SUR_COH_PRECISION 1e7f -#endif - #define MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS 5 #define MASA_DELTA_AZI_DCT0 30 @@ -1250,11 +1245,6 @@ enum #define MASA_TRANSP_BITS 1 #define NO_BITS_MASA_ISM_NO_OBJ 2 -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL -#define MASA2TOTAL_THR 0.9799999f -#else -#define MASA2TOTAL_THR 0.98f -#endif #ifdef IVAS_FLOAT_FIXED #define MASA2TOTAL_THR_Q30 1052266987 // 0.98f in Q30 //Maximum error in float to fixed conversion : 0.005% @@ -1353,10 +1343,8 @@ enum #define MASA_JBM_RINGBUFFER_FRAMES 3 -#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC #define TOLERANCE_360_Q22 1510033326 /* 360 in Q22 + 0.02 in Q22*/ #define MINUS_TOLERANCE_360_Q22 -1510033326 /* - (360 in Q22 + 0.02 in Q22) */ -#endif typedef enum { MASA_STEREO_NOT_DEFINED, @@ -1550,17 +1538,9 @@ typedef enum #define PARAM_MC_ICC_ERROR_BIAS_FAC (1.15f) /* factor for favouring past ICC maps in the adaptive ICC map decision */ #define PARAM_MC_TRANSIENT_BAND_STEP 2 /* Number of parameter bands combined in case of a transient frame*/ #define PARAM_MC_MAX_DECORR_CLDFB_BANDS 20 /* Maximum number of CLDFB bands with decorrelation */ -#ifdef FIX_901_PARAMMC_DEAD_CODE #define PARAM_MC_MAX_TRANSPORT_CHANS 3 /* Number of down mix channels */ -#else -#define PARAM_MC_MAX_TRANSPORT_CHANS 4 /* Number of down mix channels */ -#endif #define PARAM_MC_MAX_ILD_REF_CHANNELS 2 /* Maximum number of reference channels for a coded ILD */ -#ifdef FIX_901_PARAMMC_DEAD_CODE #define PARAM_MC_NUM_CONFIGS 14 /* Number of available Parametric MC configurations */ -#else -#define PARAM_MC_NUM_CONFIGS 15 /* Number of available Parametric MC configurations */ -#endif #define PARAM_MC_MAX_BAND_LFE 1 /* Number of parameter bands for LFE coding */ #define PARAM_MC_SZ_ICC_MAP 11 /* Maximum number of transmitted ICCs per parameter band */ #define PARAM_MC_SZ_ILD_MAP 12 /* Maximum number of transmitted channel energies per band*/ @@ -1643,11 +1623,7 @@ typedef enum /* LFE PLC */ #define LFE_PLC_BUFLEN 240 #define LFE_PLC_FS 1600 -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT #define L_FRAME_1k6 ( LFE_PLC_FS / FRAMES_PER_SEC ) -#else -#define L_FRAME_1k6 ( 20 * LFE_PLC_FS / 1000 ) -#endif #define LFE_PLC_LENANA LFE_PLC_BUFLEN #define LFE_PLC_FDEL 300 diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index aea7d76644f7a9e5b64d74ed3e540f2931d03bab..5e9c2d2b48fecd2d9fd67a4a461e802ac3b9a8bb 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -1171,6 +1171,7 @@ void computeDirectionVectors_fx( } #endif +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * computeDirectionVectors() * @@ -1217,6 +1218,7 @@ void computeDirectionVectors( return; } +#endif #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * computeDiffuseness() @@ -1502,6 +1504,7 @@ void computeDiffuseness_fixed( } #endif +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * computeDiffuseness() * @@ -1630,6 +1633,7 @@ float deindex_azimuth( } return phi_hat; } +#endif #ifdef IVAS_FLOAT_FIXED Word32 deindex_azimuth_fx( /* o : output Q22 */ diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index a20b9b3af18a034c94bcda57a39c8ff150dbf317..f945695debcf7ad35bfc03a6096ac6569f161de3 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -110,23 +110,12 @@ uint16_t ivas_param_mc_get_configuration_index( #ifdef IVAS_FLOAT_FIXED void ivas_param_mc_metadata_open_fx( - const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ -#ifndef FIX_901_PARAMMC_DEAD_CODE - const Word16 lfe_index, /* i : channel index of LFE */ -#endif + const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ const Word32 ivas_total_brate, /* i : IVAS total bitrate */ HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* o : handle for the Parametric MC parameter coding state */ ) { -#ifndef FIX_901_PARAMMC_DEAD_CODE - Word16 i; -#endif UWord16 config_index; -#ifndef FIX_901_PARAMMC_DEAD_CODE - Word16 nchan_setup; - - nchan_setup = ivas_mc_ls_setup_get_num_channels_fx( mc_ls_setup ); -#endif /* get coding band mappings */ set16_fx( hMetadataPMC->coding_band_mapping, 0, PARAM_MC_MAX_PARAMETER_BANDS ); @@ -158,27 +147,13 @@ void ivas_param_mc_metadata_open_fx( { assert( 0 && "nbands must be 20 or 14!" ); } -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* create map of all possible ICCs */ - ivas_param_mc_create_full_icc_mapping( nchan_setup, lfe_index, hMetadataPMC->icc_map_full, &hMetadataPMC->icc_map_size_full ); -#endif hMetadataPMC->icc_mapping_conf = ivas_param_mc_conf[config_index].icc_mapping_conf; hMetadataPMC->ild_mapping_conf = ivas_param_mc_conf[config_index].ild_mapping_conf; hMetadataPMC->ild_factors_fx = ivas_param_mc_conf[config_index].ild_factors_fx; -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* set default ICC maps */ - FOR( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) - { - ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[i] ); - } -#endif + /* init remaining flags and indices */ hMetadataPMC->param_frame_idx = 0; move16(); -#ifndef FIX_901_PARAMMC_DEAD_CODE - hMetadataPMC->flag_use_adaptive_icc_map = 0; - move16(); -#endif hMetadataPMC->bAttackPresent = 0; move16(); hMetadataPMC->attackIndex = 0; @@ -199,22 +174,11 @@ void ivas_param_mc_metadata_open_fx( #else void ivas_param_mc_metadata_open( const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ -#ifndef FIX_901_PARAMMC_DEAD_CODE - const int16_t lfe_index, /* i : channel index of LFE */ -#endif const int32_t ivas_total_brate, /* i : IVAS total bitrate */ HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* o : handle for the Parametric MC parameter coding state */ ) { -#ifndef FIX_901_PARAMMC_DEAD_CODE - int16_t i; -#endif uint16_t config_index; -#ifndef FIX_901_PARAMMC_DEAD_CODE - int16_t nchan_setup; - - nchan_setup = ivas_mc_ls_setup_get_num_channels( mc_ls_setup ); -#endif /* get coding band mappings */ set_s( hMetadataPMC->coding_band_mapping, 0, PARAM_MC_MAX_PARAMETER_BANDS ); @@ -247,10 +211,6 @@ void ivas_param_mc_metadata_open( assert( 0 && "nbands must be 20 or 14!" ); } -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* create map of all possible ICCs */ - ivas_param_mc_create_full_icc_mapping( nchan_setup, lfe_index, hMetadataPMC->icc_map_full, &hMetadataPMC->icc_map_size_full ); -#endif hMetadataPMC->icc_mapping_conf = ivas_param_mc_conf[config_index].icc_mapping_conf; hMetadataPMC->ild_mapping_conf = ivas_param_mc_conf[config_index].ild_mapping_conf; #ifdef IVAS_FLOAT_FIXED @@ -259,18 +219,8 @@ void ivas_param_mc_metadata_open( hMetadataPMC->ild_factors = ivas_param_mc_conf[config_index].ild_factors; #endif -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* set default ICC maps */ - for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) - { - ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[i] ); - } -#endif /* init remaining flags and indices */ hMetadataPMC->param_frame_idx = 0; -#ifndef FIX_901_PARAMMC_DEAD_CODE - hMetadataPMC->flag_use_adaptive_icc_map = 0; -#endif hMetadataPMC->bAttackPresent = 0; hMetadataPMC->attackIndex = 0; hMetadataPMC->lfe_on = 1; @@ -365,54 +315,6 @@ void ivas_param_mc_set_coded_bands( } #endif -#ifndef FIX_901_PARAMMC_DEAD_CODE -/*------------------------------------------------------------------------- - * ivas_param_mc_metadata_close() - * - * Parametric MC parameter coding state close function - *------------------------------------------------------------------------*/ - -#ifdef IVAS_FLOAT_FIXED -void ivas_param_mc_metadata_close( - HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ -) -{ - UWord16 i; - - /* adaptive ICC mapping */ - FOR( i = 0; i < 2; i++ ) - { - IF( hMetadataPMC->icc_map_full[i] ) - { - free( hMetadataPMC->icc_map_full[i] ); - hMetadataPMC->icc_map_full[i] = NULL; - } - } - - return; -} -#else -void ivas_param_mc_metadata_close( - HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ -) -{ - uint16_t i; - - /* adaptive ICC mapping */ - for ( i = 0; i < 2; i++ ) - { - if ( hMetadataPMC->icc_map_full[i] ) - { - free( hMetadataPMC->icc_map_full[i] ); - hMetadataPMC->icc_map_full[i] = NULL; - } - } - - return; -} -#endif - -#endif /*------------------------------------------------------------------------- * ivas_param_mc_getNumTransportChannels() * @@ -453,163 +355,6 @@ int16_t ivas_param_mc_getNumTransportChannels( } #endif - -#ifndef FIX_901_PARAMMC_DEAD_CODE -/*------------------------------------------------------------------------- - * ivas_param_mc_create_full_icc_mapping() - * - * create the map of all possible ICCs for a certain internal setup - * indicated by the number of channels and LFE index - *------------------------------------------------------------------------*/ - -#ifdef IVAS_FLOAT_FIXED -void ivas_param_mc_create_full_icc_mapping( - const Word16 n_channels, /* i : number of channels with LFE for the internal setup */ - const Word16 lfe_index, /* i : channel index of the LFE */ - Word16 *icc_map[2], /* o : map of all possible ICCs */ - Word16 *icc_map_size_full /* o : number of all possible ICCs */ -) -{ - Word16 i, k, l; - - l = 0; - move16(); - - /* number of all possible ICCs is the number of non-diagonal upper elements of a - * ICC matrix for all channels not including the LFE plus one static ICC for the - * combination (LFE/center) */ - *icc_map_size_full = add( shr( i_mult( ( sub( n_channels, 2 ) ), sub( n_channels, 1 ) ), 1 ), 1 ); - - /* allocate memory for the map */ - FOR( i = 0; i < 2; i++ ) - { - icc_map[i] = (Word16 *) malloc( *icc_map_size_full * sizeof( Word16 ) ); - } - - /* create map (non-LFE ICCs) */ - FOR( i = 0; i < n_channels; i++ ) - { - IF( NE_16( i, lfe_index ) ) - { - FOR( k = i + 1; k < n_channels; k++ ) - { - IF( NE_16( k, lfe_index ) ) - { - icc_map[0][l] = i; - move16(); - icc_map[1][l] = k; - move16(); - l++; - } - } - } - } - - /* last one is the fixed mapping center -> LFE */ - assert( l == *icc_map_size_full - 1 ); - - icc_map[0][l] = 2; - move16(); - icc_map[1][l] = lfe_index; - move16(); - - return; -} -#else -void ivas_param_mc_create_full_icc_mapping( - const int16_t n_channels, /* i : number of channels with LFE for the internal setup */ - const int16_t lfe_index, /* i : channel index of the LFE */ - int16_t *icc_map[2], /* o : map of all possible ICCs */ - int16_t *icc_map_size_full /* o : number of all possible ICCs */ -) -{ - int16_t i, k, l; - - l = 0; - - /* number of all possible ICCs is the number of non-diagonal upper elements of a - * ICC matrix for all channels not including the LFE plus one static ICC for the - * combination (LFE/center) */ - *icc_map_size_full = ( n_channels - 2 ) * ( n_channels - 1 ) / 2 + 1; - - /* allocate memory for the map */ - for ( i = 0; i < 2; i++ ) - { - icc_map[i] = (int16_t *) malloc( *icc_map_size_full * sizeof( int16_t ) ); - } - - /* create map (non-LFE ICCs) */ - for ( i = 0; i < n_channels; i++ ) - { - if ( i != lfe_index ) - { - for ( k = i + 1; k < n_channels; k++ ) - { - if ( k != lfe_index ) - { - icc_map[0][l] = i; - icc_map[1][l] = k; - l++; - } - } - } - } - - /* last one is the fixed mapping center -> LFE */ - assert( l == *icc_map_size_full - 1 ); - - icc_map[0][l] = 2; - icc_map[1][l] = lfe_index; - - return; -} -#endif - - -/*------------------------------------------------------------------------- - * ivas_param_mc_default_icc_map() - * - * get the default ICC map for a certain internal setup - * indicated by the number of channels from the table ROM - *------------------------------------------------------------------------*/ - -#ifdef IVAS_FLOAT_FIXED -void ivas_param_mc_default_icc_map( - const PARAM_MC_ICC_MAPPING *hIccMapping, /* i : ICC mapping table */ - Word16 icc_map[PARAM_MC_SZ_ICC_MAP][2] /* o : copy of map from ROM table */ -) -{ - Word16 i; - - FOR( i = 0; i < hIccMapping->icc_map_size_lfe; i++ ) - { - icc_map[i][0] = hIccMapping->icc_mapping[i][0]; - move16(); - icc_map[i][1] = hIccMapping->icc_mapping[i][1]; - move16(); - } - - return; -} -#else -void ivas_param_mc_default_icc_map( - const PARAM_MC_ICC_MAPPING *hIccMapping, /* i : ICC mapping table */ - int16_t icc_map[PARAM_MC_SZ_ICC_MAP][2] /* o : copy of map from ROM table */ -) -{ - int16_t i; - - for ( i = 0; i < hIccMapping->icc_map_size_lfe; i++ ) - { - icc_map[i][0] = hIccMapping->icc_mapping[i][0]; - icc_map[i][1] = hIccMapping->icc_mapping[i][1]; - } - - return; -} -#endif -#endif - /*------------------------------------------------------------------------- * ivas_param_mc_get_num_param_bands() * @@ -702,12 +447,6 @@ static Word16 ivas_param_mc_get_num_param_bands( num_parameter_bands = 14; move16(); BREAK; -#ifndef FIX_901_PARAMMC_DEAD_CODE - case IVAS_160k: - num_parameter_bands = 20; - move16(); - BREAK; -#endif } BREAK; default: @@ -792,11 +531,6 @@ static int16_t ivas_param_mc_get_num_param_bands( case IVAS_128k: num_parameter_bands = 14; break; -#ifndef FIX_901_PARAMMC_DEAD_CODE - case IVAS_160k: - num_parameter_bands = 20; - break; -#endif } break; default: diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 7f4b8dc8230982a09140413fb10e5df591abf123..fcd3e2f646fccb72cd24e7734140af207ab9f5bc 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -281,45 +281,35 @@ ivas_error pre_proc_front_ivas_fx( ); #ifdef IVAS_FLOAT_FIXED ivas_error pre_proc_ivas( - Encoder_State *st, /* i/o: encoder state structure */ - const int16_t last_element_mode, /* i : last element mode */ - const int32_t element_brate, /* i : element bitrate */ - const int32_t last_element_brate, /* i : last element bitrate */ - const int16_t input_frame, /* i : frame length */ - Word16 old_inp_12k8_fx[], /* i/o: buffer of old input signal */ - Word16 old_inp_16k_fx[], /* i/o: buffer of old input signal @ 16kHz */ - Word16 **inp_fx, /* o : ptr. to inp. signal in the current frame*/ - Word32 *ener_fx, /* o : residual energy from Levinson-Durbin Q6 */ - Word16 A[NB_SUBFR16k * ( M + 1 )], /* i/o: A(z) unquantized for the 4 subframes */ - Word16 Aw[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes */ - Word32 epsP_fx[M + 1], /* i : LP prediction errors epsP_fx_q */ - Word16 *epsP_fx_q, /* i : LP prediction errors */ - Word16 lsp_new[M], /* i/o: LSPs at the end of the frame */ - Word16 lsp_mid[M], /* i/o: LSPs in the middle of the frame */ - Word16 *new_inp_resamp16k_fx, /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ - int16_t *Voicing_flag, /* o : voicing flag for HQ FEC */ - Word16 old_wsp_fx[], /* i : weighted input signal buffer */ + Encoder_State *st, /* i/o: encoder state structure */ + const Word16 last_element_mode, /* i : last element mode */ + const Word32 element_brate, /* i : element bitrate */ + const Word32 last_element_brate, /* i : last element bitrate */ + const Word16 input_frame, /* i : frame length */ + Word16 old_inp_12k8_fx[], /* i/o: buffer of old input signal */ + Word16 old_inp_16k_fx[], /* i/o: buffer of old input signal @ 16kHz */ + Word16 **inp_fx, /* o : ptr. to inp. signal in the current frame*/ + Word32 *ener_fx, /* o : residual energy from Levinson-Durbin Q6 */ + Word16 A_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: A(z) unquantized for the 4 subframes */ + Word16 Aw_fx[NB_SUBFR16k * ( M + 1 )], /* i/o: weighted A(z) unquantized for subframes */ + Word32 epsP_fx[M + 1], /* i : LP prediction errors epsP_fx_q */ + Word16 *epsP_fx_q, /* i : LP prediction errors */ + Word16 lsp_new_fx[M], /* i/o: LSPs at the end of the frame */ + Word16 lsp_mid_fx[M], /* i/o: LSPs in the middle of the frame */ + Word16 *new_inp_resamp16k_fx, /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */ + Word16 *Voicing_flag, /* o : voicing flag for HQ FEC */ + Word16 old_wsp_fx[], /* i : weighted input signal buffer */ Word16 e_old_wsp, - const int16_t loc_harm, /* i : harmonicity flag */ -#ifndef IVAS_FLOAT_FIXED - const float cor_map_sum, /* i : speech/music clasif. parameter */ -#endif - const int16_t vad_flag_dtx, /* i : HE-SAD flag with additional DTX HO */ -#ifndef IVAS_FLOAT_FIXED - /*const*/ float enerBuffer[CLDFB_NO_CHANNELS_MAX], /* i : energy buffer */ - /*const*/ float fft_buff[2 * L_FFT], /* i : FFT buffer */ -#endif - const int16_t MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ - const int16_t vad_hover_flag, /* i : VAD hangover flag */ - const int16_t flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz */ -#ifdef IVAS_FLOAT_FIXED - , + const Word16 loc_harm, /* i : harmonicity flag */ + const Word16 vad_flag_dtx, /* i : HE-SAD flag with additional DTX HO */ + const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ + const Word16 vad_hover_flag, /* i : VAD hangover flag */ + const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz */ Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX], Word16 e_enerBuffer, Word16 fft_buff_fx[2 * L_FFT], - Word16 cor_map_sum_fx, //Q8 + Word16 cor_map_sum_fx, // Q8 Word16 *Q_new -#endif ); #else ivas_error pre_proc_ivas( @@ -753,7 +743,7 @@ int16_t set_bw_mct( CPE_ENC_HANDLE hCPE[MCT_MAX_BLOCKS], /* i/o: CPE encoder structures */ const int16_t nCPE /* i : number of CPEs */ ); - +#ifndef IVAS_FLOAT_FIXED void acelp_fast( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const int16_t cdk_index, /* i : codebook index */ @@ -764,7 +754,7 @@ void acelp_fast( float y[], /* o : filtered fixed codebook excitation */ const int16_t L_subfr /* i : subframe length */ ); - +#endif void dec_acelp_fast( Decoder_State *st, /* i/o: decoder state structure */ const int16_t cdk_index, /* i : codebook index */ @@ -1485,6 +1475,7 @@ void stereo_dft_cng_side_gain( const int16_t bwidth /* i : audio band-width */ ); +#ifndef IVAS_FLOAT_FIXED void stereo_dft_quantize_res_gains( const float *g, const float *r, @@ -1493,6 +1484,7 @@ void stereo_dft_quantize_res_gains( int16_t *ig, int16_t *ir ); +#endif void stereo_dft_dequantize_itd( int16_t *ind, @@ -2398,6 +2390,7 @@ void first_VQstages( int16_t indices_VQstage[] ); +#ifndef IVAS_FLOAT_FIXED UWord32 index_lvq_SHB( const int16_t idx_lead, const int16_t idx_scale, @@ -2405,6 +2398,7 @@ UWord32 index_lvq_SHB( float *lat_cv, const int16_t mode ); +#endif void deindex_lvq_SHB( UWord32 index, @@ -3986,6 +3980,7 @@ void ivas_dirac_dec_render_sf( float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] ); +#ifndef IVAS_FLOAT_FIXED void computeDiffuseness_mdft( float **buffer_intensity[DIRAC_NUM_DIMS], const float *buffer_energy, @@ -3993,6 +3988,7 @@ void computeDiffuseness_mdft( const uint16_t no_col_avg_diff, float *diffuseness ); +#endif void computeDirectionVectors( float *intensity_real_x, @@ -4084,9 +4080,6 @@ void ivas_mc_paramupmix_dec_render( ); void ivas_param_mc_metadata_open( const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ -#ifndef FIX_901_PARAMMC_DEAD_CODE - const int16_t lfe_index, /* i : channel index of LFE */ -#endif const int32_t ivas_total_brate, /* i : IVAS total bitrate */ HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* o : handle for the Parametric MC parameter coding state */ ); @@ -4096,18 +4089,6 @@ void ivas_param_mc_set_coded_bands( HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ ); -#ifndef FIX_901_PARAMMC_DEAD_CODE -void ivas_param_mc_metadata_close( - HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* i/o: handle for the Parametric MC parameter coding state */ -); - -void ivas_param_mc_create_full_icc_mapping( - const int16_t n_channels, /* i : number of channels with LFE for the internal setup */ - const int16_t lfe_index, /* i : channel index of the LFE */ - int16_t *icc_map[2], /* o : map of all possible ICCs */ - int16_t *icc_map_size_full /* o : number of all possible ICCs */ -); -#endif /*! r: number of IVAS transport channels */ #ifndef IVAS_FLOAT_FIXED int16_t ivas_param_mc_getNumTransportChannels( @@ -4178,13 +4159,6 @@ void ivas_param_mc_dec( float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); -#ifndef FIX_901_PARAMMC_DEAD_CODE -void ivas_param_mc_default_icc_map( - const PARAM_MC_ICC_MAPPING * hIccMapping, /* i : handle to ICC mapping configuration */ - int16_t icc_map[PARAM_MC_SZ_ICC_MAP][2] /* o : copy of map from the configuration */ -); - -#endif /*! r: number of cldfb synthesis instances */ int16_t param_mc_get_num_cldfb_syntheses( Decoder_Struct *st_ivas /* i : IVAS decoder structure */ @@ -5743,13 +5717,14 @@ void ivas_mcmasa_dmx_modify_fx( const Word16 n_chnls_dmx_old, /* i : number of downmix channels in the old format Q0*/ const Word16 n_chnls_dmx_new /* i : number of downmix channels in the target format Q0*/ ); -#endif +#else void ivas_mcmasa_dmx_modify( const int16_t n_samples, /* i : input frame length in samples */ float dmx[][L_FRAME48k + NS2SA( 48000, IVAS_FB_ENC_DELAY_NS )], /* i/o: downmix signal to be transformed into another format */ const int16_t n_chnls_dmx_old, /* i : number of downmix channels in the old format */ const int16_t n_chnls_dmx_new /* i : number of downmix channels in the target format */ ); +#endif void v_multc_acc( const float x[], /* i : Input vector */ @@ -5766,6 +5741,7 @@ void lls_interp_n( const int16_t upd /* i : use 1 to update x[] with the interpolated output*/ ); +#ifndef IVAS_FLOAT_FIXED void computeReferencePower_enc( const int16_t *band_grouping, /* i : Band grouping for estimation */ float Cldfb_RealBuffer[][DIRAC_NO_FB_BANDS_MAX], /* i : Real part of input signal */ @@ -5779,6 +5755,7 @@ void computeReferencePower_enc( int16_t *mono_frame_count, int16_t *dirac_mono_flag ); +#endif ivas_error ivas_mono_dmx_renderer_open( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -5873,11 +5850,7 @@ void ivas_lfe_dec( #endif void ivas_lfe_tdplc( LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT float *prevsynth, /* i : previous frame synthesis */ -#else - double *prevsynth, /* i : previous frame synthesis */ -#endif float *ytda, /* o : output time-domain buffer */ const int16_t output_frame /* i : output frame length */ ); diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 668aca945216955c6120356c8b4dc1eba488eab2..5892c80f5ff526bbb00bbc76120e2ea559cc8845 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -808,10 +808,6 @@ ivas_error ivas_cpe_dec_fx( Word32 *output[CPE_CHANNELS], /* o : output synthesis signal */ const Word16 output_frame, /* i : output frame length per channel */ const Word16 nb_bits_metadata /* i : number of metadata bits */ -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - , - Word16 *q_output /* i/o : Q of output synthesis signal */ -#endif ); void ivas_post_proc_fx( @@ -865,10 +861,6 @@ void td_stereo_param_updt_fx( Word16 tdm_Pri_pitch_buf_fx[], /* o : pitch values for primary channel Q6 */ const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */ const Word16 tdm_use_IAWB_Ave_lpc /* i : flag to indicate the usage of mean inactive LP coefficients */ -#ifndef FIX_798_WRONG_CPY_OF_PITCH - , - Word16 Q_var -#endif ); void updt_enc_common_ivas_fx( @@ -1462,10 +1454,6 @@ void stereo_icBWE_decproc_fx( const Word16 last_core, /* i : last core, primary channel */ const Word16 last_bwidth, /* i : last bandwidth */ const Word16 output_frame /* i : frame length */ -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - , - Word16 q_output /* i : Q-fac of output */ -#endif ); void add_HB_to_mono_dmx_fx( @@ -1535,11 +1523,8 @@ void stereo_icBWE_dec_fx( const Word16 *fb_synth_ref_fx, /* i : ref. high-band synthesis 16-20 kHz */ const Word16 *voice_factors_fx, /* i : voicing factors */ const Word16 output_frame, /* i : frame length */ - Word16 *Q_syn -#ifdef FIX_839_FB_CONTENT_SOMETIME_MISSING - , + Word16 *Q_syn, const Word16 Q_white_exc /* i : Q of fb_synth_ref_fx */ -#endif ); void decoder_tcx_tns_fx( @@ -1820,7 +1805,6 @@ void synchro_synthesis_fx( // ivas_dirac_output_synthesis_cov void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( -#ifdef FIX_835_PARAMMC_BUFFER_VALUES Word32 *RealBuffer_fx, /* i : input channel filter bank samples (real part) */ Word16 RealBuffer_e, /* i : exponent input channel filter bank samples (real part)*/ Word32 *ImagBuffer_fx, /* i : input channel filter bank samples (imaginary part */ @@ -1832,18 +1816,6 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ const Word16 param_band, /* i : parameter band */ const Word16 nchan_in /* i : number of input channels */ -#else - Word32 *RealBuffer_fx, /* i : input channel filter bank samples (real part) */ - Word16 RealBuffer_e, /* i : exponent input channel filter bank samples (real part)*/ - Word32 *ImagBuffer_fx, /* i : input channel filter bank samples (imaginary part */ - Word16 ImagBuffer_e, /* i : exponent input channel filter bank samples (real part)*/ - Word32 cx_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ - Word16 *cx_e, /* i : exponent for accumulated input covariance (real part) */ - Word32 cx_imag_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (imaginary part) */ - Word16 *cx_imag_e, /* i : exponent accumulated input covariance (imag part) */ - PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ - const Word16 nchan_in /* i : number of input channels */ -#endif ); void configureFdCngDec_ivas_fx( @@ -2815,10 +2787,7 @@ void tdm_configure_dec_fx( ); void ivas_param_mc_metadata_open_fx( - const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ -#ifndef FIX_901_PARAMMC_DEAD_CODE - const Word16 lfe_index, /* i : channel index of LFE */ -#endif + const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ const Word32 ivas_total_brate, /* i : IVAS total bitrate */ HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* o : handle for the Parametric MC parameter coding state */ ); @@ -4851,7 +4820,7 @@ void deindex_spherical_component_fx( const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); -void ivas_dirac_param_est_enc( +void ivas_dirac_param_est_enc_fx( DIRAC_ENC_HANDLE hDirAC, IVAS_QDIRECTION *q_direction, const UWord8 useLowerRes, diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 20529b3d4a52982e5305234be829377a4e32de40..c31605f4e9cae22d22431cd6965b40c5273c40a7 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -256,6 +256,7 @@ const Word32 dft_res_gains_q_Q31[][2] = {2147440640, 13580687 } }; + const float dft_res_gains_q[][2] = { /* quantization points for joint quantization of prediction gain and residual energy */ @@ -421,6 +422,7 @@ const float dft_res_gains_q[][2] = { 0.999980f, 0.006324f } }; +#ifndef IVAS_FLOAT_FIXED const float dft_trigo_12k8[STEREO_DFT_N_12k8_ENC / 4 + 1] = { 0.0000000f, 0.0122715f, 0.0245412f, 0.0368072f, 0.0490677f, 0.0613207f, 0.0735646f, 0.0857973f, 0.0980171f, 0.1102222f, 0.1224107f, 0.1345807f, 0.1467305f, 0.1588581f, @@ -500,6 +502,7 @@ const float dft_trigo_48k[STEREO_DFT_N_MAX_ENC / 4 + 1] = 0.9982656f, 0.9984529f, 0.9986295f, 0.9987955f, 0.9989507f, 0.9990952f, 0.9992290f, 0.9993522f, 0.9994646f, 0.9995663f, 0.9996573f, 0.9997376f, 0.9998072f, 0.9998661f, 0.9999143f, 0.9999518f, 0.9999786f, 0.9999946f, 1.0000000f }; +#endif /* tables for adaptive Golomb-Rice coding of DFT stereo parameters */ const Word16 dft_code_itd[] = @@ -717,7 +720,6 @@ const UWord16 ECSQ_tab_inverse[1 + ECSQ_SEGMENT_SIZE] = /*------------------------------------------------------------------------- * Stereo ICA analysis ROM tables *------------------------------------------------------------------------*/ - const float ica_sincInterp2[2*SINC_ORDER1+1] = { 0.0f,-0.002323f,0.0f, 0.003486f, 0.0f,-0.005865f,0.0f, 0.009735f, 0.0f,-0.015447f,0.0f, 0.023503f, @@ -733,6 +735,7 @@ const float ica_sincInterp4[2*SINC_ORDER1+1] = 0.0f,-0.033239f,-0.038282f,-0.021845f, 0.0f, 0.013767f, 0.015189f, 0.008295f, 0.0f,-0.004930f,-0.005537f,-0.003285f, 0.0f }; +#ifndef IVAS_FLOAT_FIXED const float ica_sincInterp6[2*SINC_ORDER1+1] = { 0.0f,-0.003484f,-0.007192f,-0.010460f,-0.011712f,-0.008798f, 0.0f, 0.014603f, 0.032045f, 0.046341f, 0.049731f, 0.035255f, @@ -792,6 +795,7 @@ const float tdm_den_ratio_tabl[TDM_NQ+1] = /* 1.0f/(2*LR_ratio*LR_ratio-2*LR_ra 1.9784f, 1.9171f, 1.8257f, 1.7161f, 1.6000f, 1.4864f, 1.3815f, 1.2884f, 1.2088f, 1.1429f, 1.0902f, 1.0501f, 1.0221f, 1.0000f, 1.0000f, 1.0000f }; +#endif const Word16 tdm_bit_allc_tbl[5][6] = { @@ -803,6 +807,7 @@ const Word16 tdm_bit_allc_tbl[5][6] = { 1650, 6050, 0, 13000, 0, 14000 } /* IVAS_48k */ }; +#ifndef IVAS_FLOAT_FIXED /* LSFs Intra-frame prediction tables */ const float tdm_LSF_MEAN_RE_USE_OUT[M] = { @@ -844,6 +849,7 @@ const float tdm_RE_USE_adaptive_beta_prd_diag_3[15 + 16 + 15] = 0.2043f, 0.6317f, 0.0543f, 0.1767f, 0.5396f, }; +#endif const float tdm_LSF_MEAN_PRED_QNT[M] = { @@ -953,6 +959,7 @@ const MDCTStereoBands_config mdctStereoBands_32000_640[] = {33, 29, 26, 18}/*number of bands for frame lengths 480, 320, 256, 160 respectively*/ }}; +#ifndef IVAS_FLOAT_FIXED const float nf_tw_smoothing_coeffs[N_LTP_GAIN_MEMS] = { 0.4f,0.2f,0.2f,0.2f @@ -970,6 +977,7 @@ const float dft_cng_coh_pred[STEREO_DFT_N_COH_PRED][STEREO_DFT_COH_PRED_COEFFS] { 0.202543f, 0.048819f, 0.263407f, 0.023538f, 0.092021f, 0.395655f, 0.013064f, -0.011127f, 0.035466f, 0.976055f, 0.009968f, 0.162957f, 0.383185f, -0.365493f, 2.534677f}, { 1.393664f, -0.131401f, 0.989429f, 0.738330f, 0.683865f, 0.001677f, -0.225448f, -0.012158f, 1.084608f, -0.115464f, 0.022371f, -0.045560f, -0.336230f, 0.422742f, 0.499163f} }; +#endif const Word16 dft_cng_coh_u2i[9] = { 4, 5, 3, 6, 2, 7, 1, 8, 0 }; /* Coherence unary codeword -> residual codeword conversion table */ @@ -977,6 +985,7 @@ const Word16 dft_cng_coh_i2u[9] = { 8, 6, 4, 2, 0, 1, 3, 5, 7 }; /* Coherence re const Word16 dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1] = { 15, 16, 17, 18 }; +#ifndef IVAS_FLOAT_FIXED const float dft_cng_alpha_bits[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS] = { { 0.1f, 0.6f }, @@ -1015,6 +1024,7 @@ const float diffuseness_thresholds[DIRAC_DIFFUSE_LEVELS + 1] = 0.734619140625f, 2.0f /* out-of-range large value to make searching easier */ }; +#endif const Word16 DirAC_band_grouping_12[12 + 1] = { @@ -1044,8 +1054,9 @@ const Word16 DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES + 1] = #ifdef IVAS_FLOAT_FIXED const Word32 c_weights_fx[DIRAC_NO_FB_BANDS_MAX] /* Q30 */ = { 106970960, 1033798336, 1065867776, 1071704704, 1073381888, 1073741824, 1073494016, 1072883072, 1072012032, 1070930560, 1069665600, 1068232640, 1066641792, 1064899968, 1063012224, 1060982464, 1058814144, 1056510016, 1054072832, 1051505280, 1048809664, 1045988480, 1043044160, 1039979072, 1036795776, 1033496576, 1030084096, 1026560960, 1022929600, 1019192512, 1015352576, 1011412416, 1007374720, 1003242112, 999017472, 994703488, 990302976, 985818688, 981253568, 976610304, 971891712, 967100672, 962240064, 957312576, 952321088, 947268224, 942156992, 936990080, 931770048, 926499840, 921182016, 915819200, 910414208, 904969344, 899487488, 893970944, 888422272, 882843840, 877238144, 871607552, 865954432, 860280896, 854589184, 848881728, 843160384, 837427328, 831684672, 825934208, 820178240, 814418240, 808656320, 802894208, 797133568, 791376192, 785623744, 779877568, 774139520, 768410880, 762693184, 756987904, 751296064, 745619328, 739958784, 734315584, 728691008, 723086208, 717502016, 711939712, 706400064, 700884096, 695392768, 689926912, 684487232, 679074688, 673689856, 668333504, 663006464, 657709056, 652442176, 647206144, 642001600, 636828992, 631688896, 626581696, 621507776, 616467520, 611461184, 606489344, 601552064, 596649792, 591782528, 586950784, 582154560, 577394112, 572669696, 567981312, 563329088, 558713152, 554133568, 549590464, 545083840, 540613760, 536180160, 531783104, 527422528, 523098464, 518810784, 514559520, 510344672, 506165856, 502023360, 497916832, 493846304, 489811488, 485812448, 481848832, 477920672, 474027808, 470169952, 466347008, 462558848, 458805152, 455085920, 451400736, 447749600, 444132160, 440548320, 436997792, 433480416, 429995904, 426544032, 423124608, 419737376, 416382144, 413058720, 409766720, 406505984, 403276288, 400077280, 396908768, 393770656, 390662496, 387584064, 384535200, 381515616, 378525024, 375563200, 372629952, 369724864, 366847872, 363998592, 361176672, 358382176, 355614592, 352873760, 350159456, 347471328, 344809216, 342172864, 339562048, 336976384, 334415808, 331879840, 329368576, 326881472, 324418432, 321979104, 319563392, 317170976, 314801664, 312455232, 310131328, 307829856, 305550528, 303293088, 301057440, 298843168, 296650176, 294478304, 292327168, 290196672, 288086432, 285996512, 283926432, 281876224, 279845472, 277834016, 275841792, 273868480, 271913856, 269977792, 268059968, 266160304, 264278672, 262414768, 260568368, 258739360, 256927520, 255132768, 253354752, 251593392, 249848448, 248119936, 246407424, 244710816, 243030080, 241364928, 239715120, 238080672, 236461248, 234856752, 233267088, 231692016, 230131440, 228585136, 227053024, 225534848, 224030544, 222539872, 221062832 }; -#endif +#else const float c_weights[DIRAC_NO_FB_BANDS_MAX] = { 9.962447e-02f, 9.627997e-01f, 9.926667e-01f, 9.981028e-01f, 9.996648e-01f, 1.000000e+00f, 9.997692e-01f, 9.992002e-01f, 9.983890e-01f, 9.973818e-01f, 9.962037e-01f, 9.948692e-01f, 9.933876e-01f, 9.917654e-01f, 9.900073e-01f, 9.881169e-01f, 9.860975e-01f, 9.839516e-01f, 9.816818e-01f, 9.792906e-01f, 9.767801e-01f, 9.741527e-01f, 9.714106e-01f, 9.685560e-01f, 9.655913e-01f, 9.625187e-01f, 9.593406e-01f, 9.560594e-01f, 9.526774e-01f, 9.491970e-01f, 9.456208e-01f, 9.419512e-01f, 9.381908e-01f, 9.343420e-01f, 9.304075e-01f, 9.263898e-01f, 9.222915e-01f, 9.181152e-01f, 9.138636e-01f, 9.095392e-01f, 9.051447e-01f, 9.006827e-01f, 8.961559e-01f, 8.915668e-01f, 8.869181e-01f, 8.822123e-01f, 8.774521e-01f, 8.726400e-01f, 8.677785e-01f, 8.628702e-01f, 8.579176e-01f, 8.529231e-01f, 8.478893e-01f, 8.428184e-01f, 8.377130e-01f, 8.325753e-01f, 8.274077e-01f, 8.222124e-01f, 8.169917e-01f, 8.117478e-01f, 8.064829e-01f, 8.011990e-01f, 7.958982e-01f, 7.905827e-01f, 7.852543e-01f, 7.799150e-01f, 7.745667e-01f, 7.692112e-01f, 7.638505e-01f, 7.584861e-01f, 7.531199e-01f, 7.477535e-01f, 7.423885e-01f, 7.370265e-01f, 7.316691e-01f, 7.263176e-01f, 7.209736e-01f, 7.156384e-01f, 7.103134e-01f, 7.049999e-01f, 6.996990e-01f, 6.944121e-01f, 6.891403e-01f, 6.838847e-01f, 6.786464e-01f, 6.734265e-01f, 6.682258e-01f, 6.630455e-01f, 6.578863e-01f, 6.527492e-01f, 6.476350e-01f, 6.425445e-01f, 6.374784e-01f, 6.324376e-01f, 6.274226e-01f, 6.224341e-01f, 6.174729e-01f, 6.125393e-01f, 6.076341e-01f, 6.027577e-01f, 5.979106e-01f, 5.930932e-01f, 5.883061e-01f, 5.835497e-01f, 5.788242e-01f, 5.741301e-01f, 5.694676e-01f, 5.648372e-01f, 5.602390e-01f, 5.556734e-01f, 5.511404e-01f, 5.466405e-01f, 5.421737e-01f, 5.377402e-01f, 5.333402e-01f, 5.289738e-01f, 5.246411e-01f, 5.203422e-01f, 5.160771e-01f, 5.118460e-01f, 5.076489e-01f, 5.034858e-01f, 4.993567e-01f, 4.952616e-01f, 4.912005e-01f, 4.871734e-01f, 4.831802e-01f, 4.792209e-01f, 4.752955e-01f, 4.714037e-01f, 4.675457e-01f, 4.637212e-01f, 4.599302e-01f, 4.561725e-01f, 4.524481e-01f, 4.487567e-01f, 4.450983e-01f, 4.414728e-01f, 4.378799e-01f, 4.343195e-01f, 4.307915e-01f, 4.272956e-01f, 4.238318e-01f, 4.203997e-01f, 4.169993e-01f, 4.136303e-01f, 4.102926e-01f, 4.069859e-01f, 4.037101e-01f, 4.004649e-01f, 3.972501e-01f, 3.940655e-01f, 3.909109e-01f, 3.877861e-01f, 3.846909e-01f, 3.816250e-01f, 3.785882e-01f, 3.755803e-01f, 3.726010e-01f, 3.696501e-01f, 3.667275e-01f, 3.638328e-01f, 3.609658e-01f, 3.581263e-01f, 3.553141e-01f, 3.525289e-01f, 3.497705e-01f, 3.470387e-01f, 3.443331e-01f, 3.416537e-01f, 3.390001e-01f, 3.363720e-01f, 3.337694e-01f, 3.311919e-01f, 3.286393e-01f, 3.261114e-01f, 3.236079e-01f, 3.211286e-01f, 3.186733e-01f, 3.162418e-01f, 3.138337e-01f, 3.114490e-01f, 3.090872e-01f, 3.067484e-01f, 3.044321e-01f, 3.021382e-01f, 2.998664e-01f, 2.976166e-01f, 2.953885e-01f, 2.931819e-01f, 2.909966e-01f, 2.888323e-01f, 2.866889e-01f, 2.845661e-01f, 2.824637e-01f, 2.803816e-01f, 2.783194e-01f, 2.762770e-01f, 2.742543e-01f, 2.722509e-01f, 2.702667e-01f, 2.683014e-01f, 2.663550e-01f, 2.644271e-01f, 2.625177e-01f, 2.606264e-01f, 2.587531e-01f, 2.568977e-01f, 2.550599e-01f, 2.532395e-01f, 2.514364e-01f, 2.496503e-01f, 2.478811e-01f, 2.461287e-01f, 2.443928e-01f, 2.426732e-01f, 2.409698e-01f, 2.392824e-01f, 2.376109e-01f, 2.359550e-01f, 2.343146e-01f, 2.326895e-01f, 2.310797e-01f, 2.294848e-01f, 2.279047e-01f, 2.263394e-01f, 2.247886e-01f, 2.232521e-01f, 2.217299e-01f, 2.202217e-01f, 2.187274e-01f, 2.172469e-01f, 2.157800e-01f, 2.143266e-01f, 2.128865e-01f, 2.114596e-01f, 2.100457e-01f, 2.086447e-01f, 2.072564e-01f, 2.058808e-01f }; +#endif /*----------------------------------------------------------------------* * SPAR ROM tables @@ -1686,7 +1697,9 @@ const ivas_huff_models_t ivas_huff_decd_r_consts[TOTAL_DECD_QUANT_STRATS] = /* DTX quantization and bitstream constants */ +#ifndef IVAS_FLOAT_FIXED const float dtx_pd_real_min_max[2] = { 0, 1.6f }; +#endif const Word16 dtx_pd_real_q_levels[3][3] = { { 7,7,7 },{ 7,7,0 },{ 3,0,0 } }; const Word16 dtx_pr_real_q_levels[3][3] = { { 9,9,9 },{ 9,7,9 },{ 9,5,7 } }; const Word16 pr_pr_idx_pairs[3][3][2] = { { { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 1, 3 },{ 0, 0 } } }; @@ -1705,7 +1718,7 @@ const Word16 HOA_keep_ind_spar512[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 5, 6, 7, * PCA ROM tables *-----------------------------------------------------------------------*/ -const int32_t ivas_pca_offset_index1[IVAS_PCA_N1 + 1] = +const Word32 ivas_pca_offset_index1[IVAS_PCA_N1 + 1] = { 0, 1, 9, 61, 163, 359, 685, 1125, 1747, 2519, 3521, 4713, 6183, 7883, 9809, 12093, 14633, 17575, @@ -2006,7 +2019,6 @@ const Word16 ivas_pca_offset_n2[IVAS_PCA_N1] = 5216, 5236, 5254, 5268, 5278, 5286, 5290 }; -#ifdef IVAS_FLOAT_FIXED const Word16 ph1_q_n2_tbl[IVAS_PCA_N1][2] = { /* ph1_q : Q13, n2 : Q0 */ { 0, 1 }, { 286, 3 }, @@ -2100,7 +2112,6 @@ const Word16 ph1_q_n2_tbl[IVAS_PCA_N1][2] = { /* ph1_q : Q13, n2 : Q0 */ { 25450, 3 }, { 25736, 1 } }; -#endif /*----------------------------------------------------------------------------------* @@ -2158,6 +2169,7 @@ const Word16 Param_MC_index[MAX_CICP_CHANNELS] = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; +#ifndef IVAS_FLOAT_FIXED const float ivas_param_mc_dmx_fac_CICP6_2tc[12] = { 1.0f, 0.0f, INV_SQRT2, INV_SQRT2, 1.0f, 0.0f, /*Lt*/ @@ -2210,8 +2222,9 @@ const float ivas_param_mc_dmx_fac_CICP19_4tc[48] = 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, /*Lut*/ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, /*Rut*/ }; -#ifdef IVAS_FLOAT_FIXED +#endif +#ifdef IVAS_FLOAT_FIXED const Word32 ivas_param_mc_dmx_fac_CICP6_2tc_fx[12] = { 2147483647,0,1518500224,1518500224,2147483647,0, /*Lt*/ @@ -2267,6 +2280,7 @@ const Word32 ivas_param_mc_dmx_fac_CICP19_4tc_fx[48] = #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED /* Coefficient for Parametric MC ILD factorization */ const float ivas_param_mc_ild_fac_CICP6_2tc[6] = { @@ -2277,6 +2291,7 @@ const float ivas_param_mc_ild_fac_CICP6_2tc[6] = 0.323713613305539f, 0.208150823035836f, }; +#endif //Q15 const Word16 ivas_param_mc_ild_fac_CICP6_2tc_fx[6] = { @@ -2288,6 +2303,7 @@ const Word16 ivas_param_mc_ild_fac_CICP6_2tc_fx[6] = 6820 }; +#ifndef IVAS_FLOAT_FIXED const float ivas_param_mc_ild_fac_CICP12_2tc[8] = { 0.365151211522008f, @@ -2299,6 +2315,7 @@ const float ivas_param_mc_ild_fac_CICP12_2tc[8] = 0.171473949468979f, 0.208008958987949f }; +#endif //Q15 const Word16 ivas_param_mc_ild_fac_CICP12_2tc_fx[8] = { @@ -2311,7 +2328,7 @@ const Word16 ivas_param_mc_ild_fac_CICP12_2tc_fx[8] = 5619, 6816 }; - +#ifndef IVAS_FLOAT_FIXED const float ivas_param_mc_ild_fac_CICP12_3tc[8] = { 0.5f, @@ -2323,6 +2340,8 @@ const float ivas_param_mc_ild_fac_CICP12_3tc[8] = 1.0f, 0.25f }; +#endif + //Q15 const Word16 ivas_param_mc_ild_fac_CICP12_3tc_fx[8] = { @@ -2335,7 +2354,7 @@ const Word16 ivas_param_mc_ild_fac_CICP12_3tc_fx[8] = 32767, 8192 }; - +#ifndef IVAS_FLOAT_FIXED const float ivas_param_mc_ild_fac_CICP14_2tc[8] = { 0.36427054f, @@ -2347,6 +2366,7 @@ const float ivas_param_mc_ild_fac_CICP14_2tc[8] = 0.24564756f, 0.20800895f }; +#endif //Q15 const Word16 ivas_param_mc_ild_fac_CICP14_2tc_fx[8] = { @@ -2360,6 +2380,7 @@ const Word16 ivas_param_mc_ild_fac_CICP14_2tc_fx[8] = 6816 }; +#ifndef IVAS_FLOAT_FIXED const float ivas_param_mc_ild_fac_CICP14_3tc[8] = { 0.49716263f, @@ -2371,6 +2392,7 @@ const float ivas_param_mc_ild_fac_CICP14_3tc[8] = 1.0f, 0.25f }; +#endif //Q15 const Word16 ivas_param_mc_ild_fac_CICP14_3tc_fx[8] = { @@ -2383,7 +2405,7 @@ const Word16 ivas_param_mc_ild_fac_CICP14_3tc_fx[8] = 32767, 8192 }; - +#ifndef IVAS_FLOAT_FIXED const float ivas_param_mc_ild_fac_CICP16_3tc[10] = { 0.34f, @@ -2397,6 +2419,8 @@ const float ivas_param_mc_ild_fac_CICP16_3tc[10] = 1.0f, 0.25f, }; +#endif + //Q15 const Word16 ivas_param_mc_ild_fac_CICP16_3tc_fx[10] = { @@ -2411,7 +2435,7 @@ const Word16 ivas_param_mc_ild_fac_CICP16_3tc_fx[10] = 32767, 8192 }; - +#ifndef IVAS_FLOAT_FIXED const float ivas_param_mc_ild_fac_CICP19_3tc[12] = { 0.3f, @@ -2427,6 +2451,8 @@ const float ivas_param_mc_ild_fac_CICP19_3tc[12] = 1.0f, 0.5f }; +#endif + //Q15 const Word16 ivas_param_mc_ild_fac_CICP19_3tc_fx[12] = { @@ -2444,40 +2470,6 @@ const Word16 ivas_param_mc_ild_fac_CICP19_3tc_fx[12] = 16384 }; -#ifndef FIX_901_PARAMMC_DEAD_CODE -const float ivas_param_mc_ild_fac_CICP19_4tc[12] = -{ - 0.35f, - 0.35f, - 0.17f, - 0.22f, - 0.2f, - 0.2f, - 0.2f, - 0.5f, - 0.5f, - 0.5f, - 0.5f, - 0.2f, -}; -//Q15 -const Word16 ivas_param_mc_ild_fac_CICP19_4tc_fx[12] = -{ - 11468, - 11468, - 5570, - 7209, - 6553, - 6553, - 6553, - 16384, - 16384, - 16384, - 16384, - 6553 -}; - -#endif const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP6_2tc = { 5, @@ -2541,17 +2533,6 @@ const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP19_3tc = {{0},{1},{0},{1},{0},{1},{0},{1},{0},{1},{2},{2}} }; -#ifndef FIX_901_PARAMMC_DEAD_CODE -const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP19_4tc = -{ - 11, - 12, - {0,1,2,4,5,6,7,8,9,10,11,3}, - {1,1,2,1,1,1,1,1,1,1,1,2}, - {{0},{1},{0,1},{0},{1},{0},{1},{2},{3},{2},{3},{0,1}} -}; - -#endif const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP6_2tc = { 4, @@ -2652,24 +2633,6 @@ const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_3tc = } }; -#ifndef FIX_901_PARAMMC_DEAD_CODE -const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_4tc = -{ - 8, - 9, - { { 0, 4 }, /* L/LS */ - { 1, 5 }, /* R/RS */ - { 0, 2 }, /* L/C */ - { 1, 2 }, /* R/C */ - { 0, 6 }, /* L/LBS */ - { 1, 7 }, /* R/RBS */ - { 8, 10 }, /*UFL/UBL */ - { 9, 11 }, /*UFR/UBR */ - { 2, 3 } /* C/LFE */ - } -}; - -#endif const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] = { /* CICP6 48000 */ @@ -2896,26 +2859,9 @@ const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] = &ivas_param_mc_dmx_fac_CICP19_3tc[0], #endif } -#ifndef FIX_901_PARAMMC_DEAD_CODE - , - /* CICP19 160000 */ - { - MC_LS_SETUP_7_1_4, - 12, - 4, - IVAS_160k, - &ivas_param_mc_ild_mapping_CICP19_4tc, - &ivas_param_mc_icc_mapping_CICP19_4tc, - &ivas_param_mc_dmx_fac_CICP19_4tc[0], - &ivas_param_mc_ild_fac_CICP19_4tc[0], -#ifdef IVAS_FLOAT_FIXED - &ivas_param_mc_ild_fac_CICP19_4tc_fx[0], - &ivas_param_mc_dmx_fac_CICP19_4tc_fx[0] -#endif - } -#endif }; +#ifndef IVAS_FLOAT_FIXED const float ivas_param_mc_quant_ild_5d1_48[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] = { -100.0f, -20.0f, -13.0f, -10.0f, @@ -2927,6 +2873,7 @@ const float ivas_param_mc_quant_icc[PARAM_MC_SZ_ICC_QUANTIZER] = { -0.99f, -0.589f, 0.0f, 0.36764f, 0.60092f, 0.84118f, 0.937f, 1.0f }; +#endif /* Alphabet for delta coding for the ICCs in Parametric MC processing */ const UWord16 ivas_param_mc_cum_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] = @@ -3092,7 +3039,7 @@ const UWord16 ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_S /*----------------------------------------------------------------------------------* * MASA ROM tables *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float diffuseness_reconstructions_hr[HR_MASA_ER_LEVELS] = { 0.00f, @@ -3132,6 +3079,8 @@ const float diffuseness_thresholds_hr[HR_MASA_ER_LEVELS + 1] = 0.8673095703125f, 2.0f /* out-of-range large value to make searching easier */ }; +#endif + const Word64 diffuseness_reconstructions_hr_fx[HR_MASA_ER_LEVELS] = { /* Q62 */ 0, 65865144550293504, @@ -3183,7 +3132,7 @@ const Word16 bits_direction_masa[DIRAC_DIFFUSE_LEVELS] = 3 }; - +#ifndef IVAS_FLOAT_FIXED const float coherence_cb0_masa[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH] = { /* this is the same */ @@ -3232,10 +3181,11 @@ const float coherence_cb1_masa[MASA_NO_CV_COH1*MASA_MAXIMUM_CODING_SUBBANDS] = -0.0004f, 0.2546f, -0.2579f, 0.6851f, -0.6743f, 0.0017f, 0.2521f, -0.2479f, 0.7217f, -0.7157f }; +#endif const Word16 len_cb_dct0_masa[DIRAC_DIFFUSE_LEVELS] = { 7, 6, 5, 4, 4, 4, 3, 2 }; -const uint8_t sur_coherence_cb_masa[MASA_MAX_NO_CV_SUR_COH*MASA_NO_CB_SUR_COH] = +const UWord8 sur_coherence_cb_masa[MASA_MAX_NO_CV_SUR_COH*MASA_NO_CB_SUR_COH] = { 16, 99, 0, 0, 0, 0, 0, 0, 12, 64, 167, 0, 0, 0, 0, 0, @@ -3288,10 +3238,12 @@ const float delta_theta_masa[NO_SPHERICAL_GRIDS - 2] = 1 () 2 */ +#ifndef IVAS_FLOAT_FIXED const float azimuth_cb[8] = { 0.0f, -180.0f, -90.0f, 90.0f, -45.0f, 45.0f, -135.0f, 135.0f }; +#endif const Word16 MASA_band_grouping_24[24 + 1] = { @@ -3375,6 +3327,7 @@ const uint8_t masa_twodir_bands_joined[IVAS_NUM_ACTIVE_BRATES] = }; +#ifndef IVAS_FLOAT_FIXED /*----------------------------------------------------------------------------------* * Multi-channel LS setups *----------------------------------------------------------------------------------*/ @@ -3403,9 +3356,11 @@ const float shoebox_sin_cos_tbl[11][2] ={{0.00000000f, 1.00000000f }, //0 {1.00000000f , 0.00000000f} , { -1.00000000f, 0.00000000f }, //90, -90 {0.939692616f , -0.342020124f}, {-0.939692616f,-0.342020124f},//110,-110 {0.707106769f , -0.707106769f}, {-0.707106769f,-0.707106769f}}; //135, -135 +#endif const float cb_azi_chan[] = { 0.0f, 30.0f, 110.0f, 135.0f }; +#ifndef IVAS_FLOAT_FIXED const float McMASA_LFEGain_vectors[64] = { 0.38f, 0.33f, 0.19f, 0.20f, /* 1st bit */ @@ -3425,12 +3380,13 @@ const float McMASA_LFEGain_vectors[64] = -0.80f, -1.58f, 0.82f, 1.42f, -2.14f, 0.26f, 0.84f, 1.02f }; +#endif /*----------------------------------------------------------------------------------* * OMASA ROM tables *----------------------------------------------------------------------------------*/ -const int32_t sep_object_brate[][MAX_NUM_OBJECTS] = +const Word32 sep_object_brate[][MAX_NUM_OBJECTS] = { {0, 0, 0, 0}, /* 13k2 */ {0, 0, 0, 0}, /* 16k4 */ @@ -3449,6 +3405,7 @@ const int32_t sep_object_brate[][MAX_NUM_OBJECTS] = }; /* column wise DCT matrices for 4 5, and 8 dim */ +#ifndef IVAS_FLOAT_FIXED const float dct4[4*4] = { 0.5000f, 0.6533f, 0.5000f, 0.2706f, @@ -3508,6 +3465,7 @@ const float ism_elevation_borders[4] = ISM_ELEVATION_MIN, ISM_ELEVATION_LOW_BORDER, ISM_ELEVATION_HIGH_BORDER, ISM_ELEVATION_MAX }; +#endif /*----------------------------------------------------------------------------------* * Param ISM ROM tables *----------------------------------------------------------------------------------*/ @@ -3520,7 +3478,7 @@ const Word16 Param_ISM_band_grouping[MAX_PARAM_ISM_NBANDS + 1] = /*----------------------------------------------------------------------------------* * LFE coding ROM tables *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float ivas_lfe_window_coeff_48k[IVAS_LFE_FADE_LEN_48K] = { 0.000111037183489911f, 0.000184173600662723f, 0.000260431056232165f, 0.000343096680773904f, @@ -3760,6 +3718,7 @@ const float ivas_lpf_2_butter_48k[IVAS_BIQUAD_FILT_LEN << 1] = { 7.15317998432330e-05f, 0.000143063599686466f, 7.15317998432330e-05f, 1.f, -1.97593552482925f, 0.976221652028620f }; +#endif const ivas_lfe_freq_models ivas_str_lfe_freq_models = { @@ -3809,9 +3768,11 @@ const Word16 ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 8 const Word16 ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 1, 0 }; +#ifndef IVAS_FLOAT_FIXED const float ivas_lfe_lpf_delay[2] = { 0.00175f, 0.0035f }; +#endif const Word16 ivas_lfe_lpf_delay_Q15[2] = { 57, 114 }; -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT +#ifndef IVAS_FLOAT_FIXED const float hamm_lfe_plc[LFE_PLC_LENANA / 2] = { 0.08000000000000002f, 0.08015895227847719f, 0.08063569926248770f, 0.08142991147368656f, 0.08254104003450596f, 0.08396831704748331f, 0.08571075612595230f, 0.08776715307573196f, @@ -3830,7 +3791,6 @@ const float hamm_lfe_plc[LFE_PLC_LENANA / 2] = 0.96233504613317988f, 0.96698111571154954f, 0.97133209998031445f, 0.97538499198789563f, 0.97913699079334116f, 0.98258550340204664f, 0.98572814655776630f, 0.98856274838967395f, 0.99108734991333569f, 0.99330020638455863f, 0.99519978850517732f, 0.99678478347994692f, 0.99805409592381300f, 0.99900684861892730f, 0.99964238312089115f, 0.99996026021380402f }; -#else const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2] = { 0.08000000000000002, 0.08015895227847719, 0.08063569926248770, 0.08142991147368656, 0.08254104003450596, 0.08396831704748331, 0.08571075612595230, 0.08776715307573196, @@ -4393,6 +4353,7 @@ const float ivas_mdft_coeff_cos_twid_240[IVAS_240_PT_LEN + 1] = 0.0392598158f, 0.0327190828f, 0.0261769483f, 0.0196336925f, 0.0130895956f, 0.0065449380f, 0.000000000f }; + const float ivas_mdft_coeff_cos_twid_160[IVAS_160_PT_LEN + 1] = { 1.0000000000f, 0.9999518090f, 0.9998072405f, 0.9995663085f, 0.9992290362f, 0.9987954562f, @@ -4453,6 +4414,7 @@ const float ivas_mdft_coeff_cos_twid_40[IVAS_40_PT_LEN + 1] = 0.1564344650f, 0.1175373975f, 0.0784590957f, 0.0392598158f, 0.000000000f }; +#ifndef IVAS_FLOAT_FIXED const float ivas_sin_twiddle_480[IVAS_480_PT_LEN >> 1] = { -0.000818122995607253f, -0.00736304124977957f, -0.0139076440957708f, -0.0204516511845773f, @@ -4716,6 +4678,7 @@ const float ivas_cos_twiddle_160[IVAS_160_PT_LEN >> 1] = 0.154009844397046f, 0.134580708507126f, 0.115099689192216f, 0.0955742967560992f, 0.0760120586092433f, 0.0564205163668375f, 0.0368072229413588f, 0.0171797396307788f }; +#endif const float ivas_mdft_coeff_cos_twid_120[IVAS_120_PT_LEN + 1] = { @@ -4739,6 +4702,7 @@ const float ivas_mdft_coeff_cos_twid_120[IVAS_120_PT_LEN + 1] = 0.0130895956f, 0.0000000000f }; +#ifndef IVAS_FLOAT_FIXED const float ivas_sin_twiddle_80[IVAS_80_PT_LEN >> 1] = { -0.00490871880799799f, -0.0441642771270674f, -0.0833517373318975f, -0.122410675199216f, @@ -4766,6 +4730,8 @@ const float ivas_cos_twiddle_80[IVAS_80_PT_LEN >> 1] = 0.304344802380877f, 0.266712757474898f, 0.228669460828619f, 0.190273572448036f, 0.151584296010041f, 0.112661287574648f, 0.0735645635996675f, 0.0343544083996823f }; +#endif + const Word16 dirac_gains_P_idx[16] = { @@ -5060,7 +5026,7 @@ const float dirac_gains_trg_term[181][2] = /*----------------------------------------------------------------------------------* * FB ROM tables *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float ivas_fb_cf_4ms_48k[IVAS_FB_4MS_48K_SAMP] = { 0.0000167330f, 0.0001505907f, 0.0004182700f, 0.0008196995f, 0.0013547717f, 0.0020233432f, 0.0028252351f, 0.0037602327f, @@ -5127,6 +5093,7 @@ const float ivas_fb_fcs_12band_1ms[IVAS_FB_BANDS_12] = 0.0750000000f, 0.0916666667f, 0.1083333333f, 0.1416666667f, 0.2166666667f, 0.3333333333f, 0.5083333333f, 0.8083333333f }; +#endif const Word32 ivas_fb_fcs_12band_1ms_fx[IVAS_FB_BANDS_12] = { @@ -5223,6 +5190,7 @@ const Word16 ivas_fb_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB }, }; +#ifndef IVAS_FLOAT_FIXED const float ivas_fb_cf_1ms_48k[IVAS_FB_1MS_48K_SAMP] = { 0.0002677063f, 0.0024076367f, 0.0066783340f, 0.0130615104f, 0.0215298321f, 0.0320470366f, 0.0445680875f, 0.0590393678f, @@ -6289,6 +6257,7 @@ const float ivas_fb_resp_cheby_ramp_16del[IVAS_FB_1MS_16K_SAMP + 1] = 0.299758845354607f, 0.347229042543433f, 0.396890172892483f, 0.448063390053926f, 0.500000000000000f }; +#endif const Word16 ivas_num_active_bands[FB - WB + 1] = { @@ -6304,6 +6273,7 @@ const Word16 ivas_sns_cdbks_tcx20_levels[SNS_MSVQ_NSTAGES_TCX20] = { 128, 64, 32 const Word16 ivas_sns_cdbks_tcx20_bits[SNS_MSVQ_NSTAGES_TCX20] = { 7, 6, 5, 5 }; /* pre-rounded codebook vectors for singed Q4.12 represantation */ +#ifndef IVAS_FLOAT_FIXED const float ivas_sns_cdbk_tcx20_stage1[ 128 * 16 ] = { -1.8305664f, -2.0878906f, -0.9638672f, 2.8059082f, 2.668213f, 1.1638184f, 1.390625f, 1.217041f, 1.3850098f, 0.44555664f, -0.47045898f, -0.5307617f, -0.810791f, -1.1647949f, -1.4560547f, -1.7612305f, @@ -6577,11 +6547,13 @@ const float ivas_sns_cdbk_tcx20_stage4[ 32 * 16 ] = }; const float *const ivas_sns_cdbks_tcx20[SNS_MSVQ_NSTAGES_TCX20] = { ivas_sns_cdbk_tcx20_stage1, ivas_sns_cdbk_tcx20_stage2, ivas_sns_cdbk_tcx20_stage3, ivas_sns_cdbk_tcx20_stage4 }; +#endif const Word16 ivas_sns_cdbks_tcx10_levels[SNS_MSVQ_NSTAGES_TCX10] = { 128, 32, 8 }; const Word16 ivas_sns_cdbks_tcx10_bits[SNS_MSVQ_NSTAGES_TCX10] = { 7, 5, 3 }; +#ifndef IVAS_FLOAT_FIXED const float ivas_sns_cdbk_tcx10_stage1[ 128 * 16 ] = { 1.0144043f, 1.1826172f, 0.3269043f, -0.6411133f, -1.2163086f, -1.1411133f, -1.1525879f, -0.8898926f, -0.19604492f, 0.7402344f, 1.1782227f, 1.0830078f, 0.78222656f, 0.26953125f, -0.33203125f, -1.0080566f, @@ -6763,12 +6735,14 @@ const float ivas_sns_cdbk_tcx10_stage3[ 8 * 16 ] = }; const float *const ivas_sns_cdbks_tcx10[SNS_MSVQ_NSTAGES_TCX10] = { ivas_sns_cdbk_tcx10_stage1, ivas_sns_cdbk_tcx10_stage2, ivas_sns_cdbk_tcx10_stage3}; +#endif const Word16 ivas_sns_cdbks_side_tcx20_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 32 }; const Word16 ivas_sns_cdbks_side_tcx20_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 5 }; const Word16 ivas_sns_cdbks_side_tcx10_levels[SNS_MSVQ_NSTAGES_SIDE] = { 32, 8 }; const Word16 ivas_sns_cdbks_side_tcx10_bits[SNS_MSVQ_NSTAGES_SIDE] = { 5, 3 }; +#ifndef IVAS_FLOAT_FIXED const float ivas_sns_cdbks_side_tcx20_stage1[ 32 * 16 ] = { -0.11376953f, -0.06591797f, 0.041992188f, 0.044677734f, 0.17871094f, -0.02758789f, -0.32592773f, -0.21069336f, -0.049072266f, 0.0126953125f, 0.012939453f, 0.015136719f, 0.08203125f, 0.12670898f, 0.12695312f, 0.15112305f, @@ -6893,6 +6867,7 @@ const float ivas_sns_cdbks_side_tcx10_stage2[ 8 * 16 ] = }; const float *const ivas_sns_cdbks_side_tcx10[SNS_MSVQ_NSTAGES_SIDE] = { ivas_sns_cdbks_side_tcx10_stage1, ivas_sns_cdbks_side_tcx10_stage2 }; +#endif const Word16 sns_1st_cdbk[2][2][8 * 32] = { diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index f70ad79371b06cafb434be54abbeacedadcd5920..c57fafae39cef6f8b402f33d4e7d1cbe61264380 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -59,11 +59,11 @@ extern const Word16 dft_band_res_cod[3][4]; extern const float dft_res_gains_q[][2]; #ifndef IVAS_FLOAT_FIXED extern const float dft_res_cod_alpha[STEREO_DFT_BAND_MAX]; -#endif extern const float dft_trigo_12k8[STEREO_DFT_N_12k8_ENC / 4 + 1]; extern const float dft_trigo_32k[STEREO_DFT_N_32k_ENC / 4 + 1]; extern const float dft_trigo_48k[STEREO_DFT_N_MAX_ENC / 4 + 1]; +#endif /* Golomb-Rice encoding tables */ extern const Word16 dft_maps_rpg[]; @@ -87,9 +87,9 @@ extern const UWord16 ECSQ_tab_inverse[1 + ECSQ_SEGMENT_SIZE]; /*----------------------------------------------------------------------------------* * Stereo ICA ROM tables *----------------------------------------------------------------------------------*/ - -extern const float ica_sincInterp2[]; extern const float ica_sincInterp4[]; +extern const float ica_sincInterp2[]; +#ifndef IVAS_FLOAT_FIXED extern const float ica_sincInterp6[]; /*----------------------------------------------------------------------------------* @@ -105,6 +105,7 @@ extern const float icbwe_gsMappingDFT_tbl[]; extern const float tdm_ratio_tabl[]; extern const float tdm_den_ratio_tabl[]; +#endif extern const Word16 tdm_bit_allc_tbl[5][6]; /* LSFs Intra-frame prediction tables */ @@ -125,6 +126,8 @@ extern const Word16 tdm_LSF_MEAN_PRED_QNT_IN_fx[M]; extern const Word16 tdm_LSF_MEAN_PRED_QNT_fx[M]; extern const Word16 tdm_PRED_QNT_fixed_beta_prd_diag_3_fx[15 + 16 + 15]; #endif + +#ifndef IVAS_FLOAT_FIXED extern const float tdm_LSF_MEAN_RE_USE_OUT[M]; extern const float tdm_LSF_MEAN_RE_USE_IN[M]; extern const float tdm_LSF_MEAN_RE_USE[M]; @@ -135,6 +138,7 @@ extern const float tdm_Beta_Q1bit_re_use_24k4_32k[2]; extern const float tdm_Beta_Q1bit_re_use_48k[2]; extern const float tdm_RE_USE_adaptive_beta_prd_diag_3[15 + 16 + 15]; +#endif extern const float tdm_LSF_MEAN_PRED_QNT_OUT[M]; extern const float tdm_LSF_MEAN_PRED_QNT_IN[M]; @@ -153,26 +157,30 @@ extern const SpectrumWarping sw25600Hz[]; /* PsychLPC */ extern const SpectrumWarping sw32000Hz[]; /* PsychLPC */ extern const MDCTStereoBands_config mdctStereoBands_32000_640[]; +#ifndef IVAS_FLOAT_FIXED extern const float nf_tw_smoothing_coeffs[N_LTP_GAIN_MEMS]; +#endif /*----------------------------------------------------------------------------------* * Stereo DTX ROM tables *----------------------------------------------------------------------------------*/ - -extern const Word16 dft_cng_coh_pred_fx[][STEREO_DFT_COH_PRED_COEFFS]; +#ifndef IVAS_FLOAT_FIXED extern const float dft_cng_coh_pred[][STEREO_DFT_COH_PRED_COEFFS]; +extern const float dft_cng_alpha_bits[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]; +#endif +extern const Word16 dft_cng_coh_pred_fx[][STEREO_DFT_COH_PRED_COEFFS]; extern const Word16 dft_cng_coh_u2i[9]; extern const Word16 dft_cng_coh_i2u[9]; extern const Word16 dft_cng_alpha_bits_fx[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]; -extern const float dft_cng_alpha_bits[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS]; extern const Word16 dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1]; /*----------------------------------------------------------------------------------* * DirAC ROM tables *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED extern const float diffuseness_reconstructions[DIRAC_DIFFUSE_LEVELS]; extern const float diffuseness_thresholds[DIRAC_DIFFUSE_LEVELS + 1]; +#endif extern const Word16 DirAC_band_grouping_12[12 + 1]; extern const Word16 DirAC_band_grouping_6[6 + 1]; extern const Word16 DirAC_band_grouping_5[5 + 1]; @@ -181,8 +189,9 @@ extern const Word16 DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES + #ifdef IVAS_FLOAT_FIXED extern const Word32 c_weights_fx[DIRAC_NO_FB_BANDS_MAX]; // Q30 -#endif +#else extern const float c_weights[DIRAC_NO_FB_BANDS_MAX]; +#endif extern const float w_nm[NUM_ANA_SECTORS][9]; extern const float x_nm[NUM_ANA_SECTORS][9]; @@ -206,7 +215,9 @@ extern const Word16 HOA_keep_ind[IVAS_SPAR_MAX_FB_IN_CHAN]; extern const Word16 HOA_keep_ind_spar[IVAS_SPAR_MAX_CH]; extern const Word16 HOA_keep_ind_spar512[IVAS_SPAR_MAX_CH]; +#ifndef IVAS_FLOAT_FIXED extern const float dtx_pd_real_min_max[2]; +#endif extern const Word16 dtx_pd_real_q_levels[3][3]; extern const Word16 dtx_pr_real_q_levels[3][3]; extern const Word16 pr_pr_idx_pairs[3][3][2]; @@ -243,8 +254,10 @@ extern const Word16 param_mc_start_bin_per_band_10[10]; extern const Word16 param_mc_active_bins_per_band_10[10]; extern const Word16 Param_MC_index[MAX_CICP_CHANNELS]; extern const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS]; +#ifndef IVAS_FLOAT_FIXED extern const float ivas_param_mc_quant_ild_5d1_48[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; extern const float ivas_param_mc_quant_icc[PARAM_MC_SZ_ICC_QUANTIZER]; +#endif extern const UWord16 ivas_param_mc_cum_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1]; extern const UWord16 ivas_param_mc_sym_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; extern const UWord16 ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS]; @@ -292,9 +305,11 @@ extern const Word16 no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA]; extern const float delta_theta_masa[NO_SPHERICAL_GRIDS - 2]; +#ifndef IVAS_FLOAT_FIXED extern const float azimuth_cb[8]; extern const float coherence_cb0_masa[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH]; extern const float coherence_cb1_masa[MASA_NO_CV_COH1 * MASA_MAXIMUM_CODING_SUBBANDS]; /* 25 */ +#endif extern const Word16 len_cb_dct0_masa[DIRAC_DIFFUSE_LEVELS]; extern const UWord8 sur_coherence_cb_masa[MASA_NO_CB_SUR_COH * MASA_MAX_NO_CV_SUR_COH]; extern const Word16 idx_cb_sur_coh_masa[MASA_NO_CV_COH]; @@ -319,12 +334,15 @@ extern const UWord8 masa_joined_nbands[]; extern const UWord8 masa_twodir_bands[]; extern const UWord8 masa_twodir_bands_joined[]; +#ifndef IVAS_FLOAT_FIXED extern const float diffuseness_reconstructions_hr[HR_MASA_ER_LEVELS]; extern const float diffuseness_thresholds_hr[HR_MASA_ER_LEVELS + 1]; +#endif extern const Word64 diffuseness_reconstructions_hr_fx[HR_MASA_ER_LEVELS]; extern const Word32 diffuseness_thresholds_hr_fx[HR_MASA_ER_LEVELS + 1]; /* Multi-channel input and output setups */ +#ifndef IVAS_FLOAT_FIXED extern const float ls_azimuth_CICP2[2]; extern const float ls_elevation_CICP2[2]; extern const float ls_azimuth_CICP6[5]; @@ -339,15 +357,19 @@ extern const float ls_azimuth_CICP19[11]; extern const float ls_elevation_CICP19[11]; extern const float shoebox_sin_cos_tbl[11][2]; +#endif extern const float cb_azi_chan[]; +#ifndef IVAS_FLOAT_FIXED extern const float McMASA_LFEGain_vectors[64]; +#endif /*----------------------------------------------------------------------------------* * MASA and ISM (OMASA) combined format ROM tables *----------------------------------------------------------------------------------*/ extern const Word32 sep_object_brate[][MAX_NUM_OBJECTS]; +#ifndef IVAS_FLOAT_FIXED extern const float dct4[]; extern const float dct5[]; extern const float dct8[]; @@ -359,6 +381,7 @@ extern const float dct12[]; extern const float ism_azimuth_borders[4]; extern const float ism_elevation_borders[4]; +#endif /*----------------------------------------------------------------------------------* * Param ISM ROM tables @@ -370,6 +393,7 @@ extern const Word16 Param_ISM_band_grouping[MAX_PARAM_ISM_NBANDS + 1]; * LFE coding ROM tables *----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED extern const float ivas_lpf_4_butter_16k_sos[IVAS_BIQUAD_FILT_LEN << 2]; extern const float ivas_lpf_4_butter_32k_sos[IVAS_BIQUAD_FILT_LEN << 2]; extern const float ivas_lpf_4_butter_48k_sos[IVAS_BIQUAD_FILT_LEN << 2]; @@ -380,19 +404,18 @@ extern const float ivas_lpf_2_butter_48k[IVAS_BIQUAD_FILT_LEN << 1]; extern const float ivas_lfe_window_coeff_48k[IVAS_LFE_FADE_LEN_48K]; extern const float ivas_lfe_window_coeff_32k[IVAS_LFE_FADE_LEN_32K]; extern const float ivas_lfe_window_coeff_16k[IVAS_LFE_FADE_LEN_16K]; +#endif extern const Word16 ivas_lfe_num_ele_in_coder_models[2][4]; extern const Word16 ivas_lfe_log2_num_ele_in_coder_models_fx[2][4]; extern const Word16 ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP]; extern const Word16 ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP]; extern const ivas_lfe_freq_models ivas_str_lfe_freq_models; -extern const float ivas_lfe_lpf_delay[2]; extern const Word16 ivas_lfe_lpf_delay_Q15[2]; -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT + +#ifndef IVAS_FLOAT_FIXED +extern const float ivas_lfe_lpf_delay[2]; extern const float hamm_lfe_plc[LFE_PLC_LENANA / 2]; -#else -extern const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2]; -#endif extern const float ivas_sin_twiddle_480[IVAS_480_PT_LEN >> 1]; extern const float ivas_cos_twiddle_480[IVAS_480_PT_LEN >> 1]; extern const float ivas_sin_twiddle_320[IVAS_320_PT_LEN >> 1]; @@ -401,6 +424,7 @@ extern const float ivas_sin_twiddle_160[IVAS_160_PT_LEN >> 1]; extern const float ivas_cos_twiddle_160[IVAS_160_PT_LEN >> 1]; extern const float ivas_sin_twiddle_80[IVAS_80_PT_LEN >> 1]; extern const float ivas_cos_twiddle_80[IVAS_80_PT_LEN >> 1]; +#endif /*------------------------------------------------------------------------------------------* * MDFT/iMDFT ROM tables @@ -423,17 +447,20 @@ extern const float dirac_gains_trg_term[181][2]; * FB ROM tables *------------------------------------------------------------------------------------------*/ -extern const float ivas_fb_fcs_12band_1ms[IVAS_FB_BANDS_12]; extern const Word32 ivas_fb_fcs_12band_1ms_fx[IVAS_FB_BANDS_12]; +#ifndef IVAS_FLOAT_FIXED +extern const float ivas_fb_fcs_12band_1ms[IVAS_FB_BANDS_12]; extern const float ivas_fb_fr_12band_1ms_re[IVAS_FB_12_1MS_LEN]; extern const float ivas_fb_fr_12band_1ms_im[IVAS_FB_12_1MS_LEN]; +#endif extern const Word16 ivas_fb_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12]; extern const Word16 ivas_fb_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12]; extern const Word16 ivas_fb_abs_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12]; extern const Word16 ivas_fb_abs_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12]; +#ifndef IVAS_FLOAT_FIXED extern const float ivas_fb_cf_4ms_48k[IVAS_FB_4MS_48K_SAMP]; extern const float ivas_fb_cf_1ms_48k[IVAS_FB_1MS_48K_SAMP]; extern const float ivas_fb_cf_4ms_32k[IVAS_FB_4MS_32K_SAMP]; @@ -443,6 +470,7 @@ extern const float ivas_fb_cf_1ms_16k[IVAS_FB_1MS_16K_SAMP]; extern const float ivas_fb_resp_cheby_ramp_32del[IVAS_FB_1MS_32K_SAMP + 1]; extern const float ivas_fb_resp_cheby_ramp_16del[IVAS_FB_1MS_16K_SAMP + 1]; +#endif extern const Word16 ivas_num_active_bands[FB - WB + 1]; @@ -456,16 +484,20 @@ extern const Word16 ivas_sns_cdbks_tcx20_bits[]; extern const Word16 ivas_sns_cdbks_tcx10_levels[]; extern const Word16 ivas_sns_cdbks_tcx10_bits[]; +#ifndef IVAS_FLOAT_FIXED extern const float *const ivas_sns_cdbks_tcx20[]; extern const float *const ivas_sns_cdbks_tcx10[]; +#endif extern const Word16 ivas_sns_cdbks_side_tcx20_levels[]; extern const Word16 ivas_sns_cdbks_side_tcx20_bits[]; extern const Word16 ivas_sns_cdbks_side_tcx10_levels[]; extern const Word16 ivas_sns_cdbks_side_tcx10_bits[]; +#ifndef IVAS_FLOAT_FIXED extern const float *const ivas_sns_cdbks_side_tcx20[]; extern const float *const ivas_sns_cdbks_side_tcx10[]; +#endif /* means and codebooks for the split VQ in the 2-stage SNS VQ */ extern const Word16 sns_1st_cdbk[2][2][8 * 32]; diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index a050f7675ecbf727225b97386f5366fedab19f3e..0482e55094f747a80ed926e7dcac63fcf76e8642 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -693,15 +693,8 @@ typedef struct ivas_parametric_mc_metadata_struct { const PARAM_MC_ILD_MAPPING *ild_mapping_conf; const PARAM_MC_ICC_MAPPING *icc_mapping_conf; -#ifndef FIX_901_PARAMMC_DEAD_CODE - int16_t icc_mapping[PARAM_MC_PARAMETER_FRAMES][PARAM_MC_SZ_ICC_MAP][2]; - int16_t *icc_map_full[2]; -#endif Word16 icc_map_size_full; Word16 param_frame_idx; -#ifndef FIX_901_PARAMMC_DEAD_CODE - int16_t flag_use_adaptive_icc_map; -#endif #ifdef IVAS_FLOAT_FIXED const Word16 *ild_factors_fx; #else diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index 2168a6755c54c450af8fc3c42c4741b6d826f8ae..355f77620b44d977a659c75937f3d9ca2931e186 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -976,10 +976,6 @@ void td_stereo_param_updt_fx( Word16 tdm_Pri_pitch_buf_fx[], /* o : pitch values for primary channel Q6 */ const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag Q0*/ const Word16 tdm_use_IAWB_Ave_lpc /* i : flag to indicate the usage of mean inactive LP coefficients Q0*/ -#ifndef FIX_798_WRONG_CPY_OF_PITCH - , - Word16 Q_var -#endif ) { Word16 i; @@ -1001,7 +997,6 @@ void td_stereo_param_updt_fx( Copy( lsp_old_PCh_fx, tdm_lspQ_PCh_fx, M ); /*Q15*/ Copy( lsf_old_PCh_fx, tdm_lsfQ_PCh_fx, M ); /*Qlog2(2.56)*/ } -#ifdef FIX_798_WRONG_CPY_OF_PITCH IF( EQ_16( flag_ACELP16k, 1 ) ) { Word16 tmp16; @@ -1019,33 +1014,6 @@ void td_stereo_param_updt_fx( Copy( pitch_buf_PCh_fx, tdm_Pri_pitch_buf_fx, NB_SUBFR ); /*Q6*/ } -#else - /* This is only to keep the buffer up-to-date */ - Word16 mult_factor = 26214 /*0.8f in Q15*/; - Word16 min_tdm_Pri_pitch_buf_fx = 0; - Word16 Flag = 0; - IF( flag_ACELP16k == 1 ) - { - FOR( i = 0; i < NB_SUBFR; i++ ) - { - tdm_Pri_pitch_buf_fx[i] = mult( pitch_buf_PCh_fx[i], mult_factor ); - min_tdm_Pri_pitch_buf_fx = s_min( tdm_Pri_pitch_buf_fx[i], min_tdm_Pri_pitch_buf_fx ); - } - Flag = BASOP_Util_Cmp_Mant32Exp( L_deposit_l( min_tdm_Pri_pitch_buf_fx ), 31 - Q_var, PIT_MIN, 31 ); - IF( Flag == -1 ) - { - FOR( i = 0; i < NB_SUBFR; i++ ) - { - - tdm_Pri_pitch_buf_fx[i] = s_max( tdm_Pri_pitch_buf_fx[i], shr( PIT_MIN, Q_var ) ); - } - } - } - ELSE - { - Copy( pitch_buf_PCh_fx, tdm_Pri_pitch_buf_fx, NB_SUBFR ); - } -#endif return; } #endif diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index bead42ab91920b9fd5507c22d0a5cc3880f66b62..3130bd1603c40b956619255a3023eb7c783233c4 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -798,11 +798,7 @@ void v_sub_s16_fx( { Word16 i; -#ifdef FIX_805_VERIFICATION FOR( i = 0; i < N; i++ ) -#else - FOR( i = 0; LT_16( i, N ); i++ ) -#endif { y[i] = sub( x1[i], x2[i] ); /*Qx*/ move16(); @@ -823,11 +819,7 @@ void v_sub32_fx( { Word16 i; -#ifdef FIX_805_VERIFICATION FOR( i = 0; i < N; i++ ) -#else - FOR( i = 0; LT_16( i, N ); i++ ) -#endif { y[i] = L_sub( x1[i], x2[i] ); /*Qx*/ move32(); @@ -2867,12 +2859,8 @@ void lls_interp_n_fx( sum_x_fx = 0; move32(); -#ifdef FIX_805_VERIFICATION Word16 idx; FOR( idx = 0; idx < N; idx++ ) -#else - FOR( int idx = 0; idx < N; idx++ ) -#endif { sum_x_fx = L_add( sum_x_fx, x_fx[idx] ); /*Q15*/ } diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c index b2be1b0433aa82597228b8685ace47ef70a8ff24..eee60928b2df6fa9985bf472e3cf5f802faacdb5 100644 --- a/lib_com/lsf_tools.c +++ b/lib_com/lsf_tools.c @@ -949,22 +949,14 @@ void isp2isf( * Convert from LPC to reflection coeff *-------------------------------------------------------------------*/ -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -void a2rc( -#else /*! r: stability flag */ uint16_t a2rc( -#endif const float *a, /* i : LPC coefficients */ float *refl, /* o : Reflection co-efficients */ const int16_t lpcorder /* i : LPC order */ ) { -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - float f[M]; -#else float f[MAX_LP_FILTER_ORDER]; -#endif int16_t m, j, n; float km, denom, x; @@ -983,11 +975,7 @@ uint16_t a2rc( { refl[j] = 0.f; } -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - return; -#else return 0; -#endif } refl[m] = -km; @@ -1006,11 +994,7 @@ uint16_t a2rc( f[j] = denom * f[j] + km * denom * f[j]; } } -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - return; -#else return 1; -#endif } diff --git a/lib_com/modif_fs.c b/lib_com/modif_fs.c index f0b9b45e886ed843f58366796b3cf943bdc2f77e..61adc1c3407ad34e14d01f04b7eb39a024d018ff 100644 --- a/lib_com/modif_fs.c +++ b/lib_com/modif_fs.c @@ -43,6 +43,7 @@ #include "wmc_auto.h" #include "prot_fx.h" +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * modify_Fs() * @@ -224,6 +225,7 @@ int16_t modify_Fs( return lg_out; } +#endif #ifndef IVAS_FLOAT_FIXED @@ -477,7 +479,7 @@ int16_t modify_Fs_intcub3m_sup( } #endif - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Interpolate_allpass_steep() * @@ -530,6 +532,7 @@ void Interpolate_allpass_steep( return; } +#endif #ifdef IVAS_FLOAT_FIXED void Interpolate_allpass_steep_32( const Word32 *in_fx, /* i : input array of size N Qx */ @@ -541,7 +544,6 @@ void Interpolate_allpass_steep_32( Word16 n, k; Word32 temp_fx[ALLPASSSECTIONS_STEEP - 1]; -#ifdef IVAS_ENH32_CADENCE_CHANGES /* upper allpass filter chain */ FOR( k = 0; k < N; k++ ) { @@ -587,57 +589,11 @@ void Interpolate_allpass_steep_32( mem_fx[2 * ALLPASSSECTIONS_STEEP - 1] = Msub_32_16( temp_fx[ALLPASSSECTIONS_STEEP - 2], out_fx[2 * k], AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ); // Qx move32(); } -#else - /* upper allpass filter chain */ - FOR( k = 0; k < N; k++ ) - { - temp_fx[0] = L_add( mem_fx[0], Mpy_32_16_1( in_fx[k], AP2_STEEP_FX[0] ) ); - move32(); - mem_fx[0] = L_sub( in_fx[k], Mpy_32_16_1( temp_fx[0], AP2_STEEP_FX[0] ) ); - move32(); - - /* for better performance, unroll this loop */ - FOR( n = 1; n < ALLPASSSECTIONS_STEEP - 1; n++ ) - { - temp_fx[n] = L_add( mem_fx[n], Mpy_32_16_1( temp_fx[n - 1], AP2_STEEP_FX[n] ) ); - move32(); - mem_fx[n] = L_sub( temp_fx[n - 1], Mpy_32_16_1( temp_fx[n], AP2_STEEP_FX[n] ) ); - move32(); - } - - out_fx[add( shl( k, 1 ), 1 )] = L_add( mem_fx[ALLPASSSECTIONS_STEEP - 1], Mpy_32_16_1( temp_fx[ALLPASSSECTIONS_STEEP - 2], AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); - move32(); - mem_fx[ALLPASSSECTIONS_STEEP - 1] = L_sub( temp_fx[ALLPASSSECTIONS_STEEP - 2], Mpy_32_16_1( out_fx[add( shl( k, 1 ), 1 )], AP2_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); - move32(); - } - - /* lower allpass filter chain */ - FOR( k = 0; k < N; k++ ) - { - temp_fx[0] = L_add( mem_fx[ALLPASSSECTIONS_STEEP], Mpy_32_16_1( in_fx[k], AP1_STEEP_FX[0] ) ); - move32(); - mem_fx[ALLPASSSECTIONS_STEEP] = L_sub( in_fx[k], Mpy_32_16_1( temp_fx[0], AP1_STEEP_FX[0] ) ); - move32(); - - /* for better performance, unroll this loop */ - FOR( n = 1; n < ALLPASSSECTIONS_STEEP - 1; n++ ) - { - temp_fx[n] = L_add( mem_fx[ALLPASSSECTIONS_STEEP + n], Mpy_32_16_1( temp_fx[n - 1], AP1_STEEP_FX[n] ) ); - move32(); - mem_fx[ALLPASSSECTIONS_STEEP + n] = L_sub( temp_fx[n - 1], Mpy_32_16_1( temp_fx[n], AP1_STEEP_FX[n] ) ); - move32(); - } - - out_fx[2 * k] = L_add( mem_fx[2 * ALLPASSSECTIONS_STEEP - 1], Mpy_32_16_1( temp_fx[ALLPASSSECTIONS_STEEP - 2], AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); - move32(); - mem_fx[2 * ALLPASSSECTIONS_STEEP - 1] = L_sub( temp_fx[ALLPASSSECTIONS_STEEP - 2], Mpy_32_16_1( out_fx[2 * k], AP1_STEEP_FX[ALLPASSSECTIONS_STEEP - 1] ) ); - move32(); - } -#endif return; } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Decimate_allpass_steep() * @@ -725,6 +681,7 @@ void Decimate_allpass_steep( return; } +#endif #ifdef IVAS_FLOAT_FIXED void Decimate_allpass_steep_fx32( const Word32 *in, /* i : input array of size N Qx */ @@ -817,6 +774,7 @@ void Decimate_allpass_steep_fx32( return; } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * interpolate_3_over_2_allpass() * @@ -887,6 +845,7 @@ void interpolate_3_over_2_allpass( return; } +#endif #ifdef IVAS_FLOAT_FIXED void interpolate_3_over_2_allpass_32( const Word32 *input, /* i : input signal Qx*/ @@ -980,6 +939,7 @@ void interpolate_3_over_2_allpass_32( return; } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * decimate_2_over_3_allpass() * @@ -1061,7 +1021,9 @@ void decimate_2_over_3_allpass( return; } +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * interpolate_3_over_1_allpass() * @@ -1126,6 +1088,7 @@ void interpolate_3_over_1_allpass( return; } +#endif #ifdef IVAS_FLOAT_FIXED void interpolate_3_over_1_allpass_32( @@ -1214,6 +1177,7 @@ void interpolate_3_over_1_allpass_32( } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * retro_interp4_5() * @@ -1248,8 +1212,9 @@ void retro_interp4_5( return; } +#endif - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * retro_interp5_4() * @@ -1277,3 +1242,4 @@ void retro_interp5_4( return; } +#endif diff --git a/lib_com/mslvq_com.c b/lib_com/mslvq_com.c index d7d4c427be231228e23c01dcdf7beb0f7448e97c..fd871304e161265ba338f7e2b1fc1ad554933cff 100644 --- a/lib_com/mslvq_com.c +++ b/lib_com/mslvq_com.c @@ -921,11 +921,7 @@ void deindex_lvq_SHB( /* find idx_leader */ i = 1; -#ifdef NONBE_FIX_1054_NEGATIVE_LVQ_INDEX while ( index > table_no_cv[i] ) -#else - while ( index >= table_no_cv[i] ) -#endif { i++; } diff --git a/lib_com/mslvq_com_fx.c b/lib_com/mslvq_com_fx.c index 3ff688d7ba6d9de2e4a5e1f449b9c728400e2c87..7c6658e8fbc6e75464f0e5d791875c32a71f488f 100644 --- a/lib_com/mslvq_com_fx.c +++ b/lib_com/mslvq_com_fx.c @@ -911,14 +911,12 @@ static void decode_comb_fx( ) { Word16 idx_sign; -#ifdef FIX_961_CRASH_DIV_L IF( LT_32( L_shl( index, 1 ), pi0[idx_lead] ) ) { idx_sign = 0; move16(); } ELSE -#endif { idx_sign = extract_l( div_l( L_shl( index, 1 ), pi0[idx_lead] ) ); /*(index/pi0_fx[idx_lead]); */ } @@ -1320,11 +1318,7 @@ void deindex_lvq_SHB_fx( { Word32 temp = Mpy_32_16_1( sigma_BWE_fx[add( i_mult( mode, LATTICE_DIM ), i )], scale ); temp = Mpy_32_16_1( temp, out[i] ); -#ifndef FIX_800_PROPOSAL_HB_LPC_COEFFICIENT - out[i] = extract_h( temp ); -#else out[i] = extract_l( temp ); /* Q15 output*/ -#endif move16(); // out[i] *= scale * sigma_BWE_fx[mode * LATTICE_DIM + i]; } diff --git a/lib_com/options.h b/lib_com/options.h index 21e92468881cdfed3b1f6e78423d4ed411d6c998..f5785f099801cbe1b78e4c0941e0117ede314c07 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -62,145 +62,22 @@ /* #################### End DEBUGGING switches ############################ */ -/* ################### Start FIXES switches ########################### */ - -#define NON_BE_FIX_1048_THRESHOLD_COH_BASOP /* Nokia: Fix 1048 replace comparison with 0 with comparison to threshold, to align with BASOP*/ -#define NONBE_FIX_1054_NEGATIVE_LVQ_INDEX /* Nokia: issue 1054: Input to decode_comb in deindex_lvq_SHB should be positive */ -#define FIX_1033_MEMORY_LEAK_OMASA /* Nokia / Orange: issue #1033: Memory leak in OMASA to BINAURAL with HRTF with bitrate switching */ -#define FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* Ericsson: premature cast to unsigned detected by USAN corrected */ -#define FIX_1027_GSC_INT_OVERFLOW /* VA: issue 2207: overflow in GSC */ -#define NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* FhG: avoid sidegain DFT-Stereo param to be larger than 1 when converting from Dirac parameters */ -#define NON_BE_1055_RESET_LP_MEMORIES /* VA: issue 1055: Correctly reset LP filter MA and AR memories in bitrate switching */ -#define NON_BE_FIX_1137_GSC_IVAS_FXFLT_DECODING /* VA: Add fix point bit allocation for special GSC mode such that float and fixed point have the same final bit allocation */ -#define NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE /* VA: issue 1132: prevent division by extremely low energy value in SWB TBE */ -#define NON_BE_FIX_807_MASA_DTX_BRSW /* Nokia: adds fix to check existence of DTX encoder for secondary channel in TD mode */ -#define FIX_BASOP_812_NAN_COHSNR /* FhG: BASOP issue 812: fix nan values in sparse frames for cohSNR value in ITD estimation*/ -#define FIX_828_PORT_1152_FROM_FLT_REPO /* FhG: fix for issue 828 - fix uninitialized value used in BASOP */ -/* #################### End FIXES switches ############################ */ - #define BASOP_NOGLOB /* Disable global symbols in BASOPs, Overflow/Carry in BASOPs disabled, additional BASOPs in case of Overflow */ - -/* ################### Start BE switches ################################# */ -/* only BE switches wrt selection floating point code */ - -/*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ - -#define FIX_854_ARRAY_SIZE_MISMATCH /* VA: issue 854: correct the mismatch between definition and declaration of `ivas_core_dec() */ -#define FIX_785_REMOVE_DEAD_CODE /* VA: issue 785: remove dead code */ -#define FIX_852_FIX_HANDLE_DEREF /* VA: issue 852: Fix missing handle dereferencing of hIsmMetadaData in ivas_ism_metadata_close() */ -#define FIX_901_PARAMMC_DEAD_CODE /* FhG: issue 901: remove dead ParamMC code */ -#define IVAS_ENH32_CADENCE_CHANGES - -/* #################### End BE switches ################################## */ - - -/* #################### Start NON-BE switches ############################ */ -/* any switch which is non-be wrt selection floating point code */ -/* all switches in this category should start with "NONBE_" */ - -#define NONBE_FIX_838_CRASH_24_4_WB /* FhG: Issue 838: fix encoder crashes for Unified Stereo and MASA 2 TC at 24.4 kbps WB due to missing IGF (re-) allocation */ -#define NONBE_FIX_839_MC_RS_CHANNEL_ALLOC /* FhG: Issues #839: problems with reallocation of the channels on the heap in case of MC RS */ -#define BE_FIX_832_ASAN_ERROR_EFAP_OSBA /* FhG: issue #832: fix ASAN error caused by re-allocating EFAP memories in OSBA*/ -#define NONBE_FIX_819_DOUBLE_PREC_COMB_FORMATS /* VA: issue 820: Double precision arithmetic in combined formats */ -#define NONBE_FIX_849_OMASA_BFI_CRASH /* VA: issue 849: fix OMASA 2TC and FEC crashes */ -#define NONBE_FIX_738_QUATERNION_SLERP_PRECISION /* Quaternion slerp changes*/ #define IVAS_FLOAT_FIXED #define IVAS_FLOAT_FIXED_CONVERSIONS /* Temporary macro to keep track of intermediate flt to fixed and fixed to flt conversions */ #ifdef IVAS_FLOAT_FIXED #define MSAN_FIX -#define FIX_818_COMPLEXITY_IMPROV /* Fix for issue 818 */ -#define FIX_805_VERIFICATION /* Fix for issue 805 */ -#define FIX_827_HIGH_MLD /* Fix for issue 827 */ -//#define HP20_FIX32_RECODING /* Improved hp20 filtering code */ #endif #define ISM_DISABLE #define FIX_TMP_714 #define BASOP_NOGLOB_TMP_715 #define EVS_FUNC_MODIFIED //#define EVS_FLOAT_ENC -#define FIX_667_DISABLE_INITIAL_PLC_SUPPRESSION #define IVAS_CNST #define REMOVE_IVAS_UNUSED_PARAMETERS_WARNING /*temporary operation on unused EVS parameters to remove warnings, these parameters will be used in IVAS */ - #define MOD_BIT_ALLOC_ROM_TABLE /* Just to highlight modification in bit allocation table and to ensure these modifications doesn't affect EVS modes*/ #define SIMPLIFY_CODE_BE // Simplify synthesis loop - #define CR_2109_to_2112_cd0_ce0 /* This is related to the CRs include in the 26.444 package of 21-12. Concerns lead_deindexing and */ - -#define FIX_ISSUE_723_INFO_TCX_NOISE /*FhG: Issue 723: fix for IGF that introduces wrong noise filling behavion*/ - #define FIX_QMETADATA_PENALTY /* Nokia: transform penalty calculation in qmetadata into integer operations */ - -#define NONBE_MDCT_ST_DTX_SKIP_DEWHITENING_OF_NOISE_SHAPES_ON_SID_FRAMES /* FhG: issue 1133: skip de-whitening of bg noise shape after frameloss period if the first good frame is an SID */ -#define NONBE_MDCT_ST_PLC_DO_NOT_SCALE_OLD_OUT_IF_FIRST_GOOD_IS_SID /* FhG: issue 1133: in TCX PLC, don't scale hHQ_core->old_out after applying fade to noise in burst frame error */ -#define NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL -#define FIX_903_ZERO_OUT_IMDCT_BUFFERS_FOR_MCT_IGNORE /* FhG: zero out all relevant imdct buffers in MCT decoding of channels with mct_chan_mode == MCT_CHAN_MODE_IGNORE */ - -/* ##################### End NON-BE switches ########################### */ -#define FIX_740_HQ_CORE_OVA // Proposed fix to solve overlap and add issue for HQ_CORE -#define FIX_746 // proposed fix to solve low bit-rate frame boundaries issues -#define FIX_SATURATION_725 // Propose fix for saturation in AVQ -#define FIX_737_HQ_ACELP_SWITCH_SCALING_ERROR /* Eri: Proposed fix for issue 737: scaling error in excitation memory after HQ->ACELP switch */ -#define FIX_736_BWE_SECT_C // Solves an issue where the BWE was disappearing, problem related to wrong scaling in ic-BWE -#define FIX_734_MISSING_SUBFR_LOW_RATE_ACELP -#define FIX_747_TDBWE_ENERGY_BURST -#define FIX_770_DISCONTINUITIES_SW_TCX2ACELP // Fix discontinuities when switching from TCX to ACELP -#define FIX_680_CNG_FRAME_BOUNDARIES_ISSUE /* Step was right shift by 2, which made the OVA wrong */ -#define NONBE_FIX_1069_SVD_TUNING /* FhG: issue 1069: tune SVD constants */ -#define FIX_778_STEREO_BRATE_SWITCHING -#define FIX_774_ENERGY_BURST /* Fix 0 bit BWE */ -#define FIX_729_MISSING_RESCALING -#define FIX_798_LSF_SECONDARY_CH_MISSING_CODE /* Adding the missing code to properly render the secondary channel of TD stereo*/ -#define FIX_798_WRONG_CPY_OF_PITCH /* The copy of the pitch from primary to secondary channel was wrong AND safety check was really wrong */ -#define FIX_800_PROPOSAL_HB_LPC_COEFFICIENT /* Proposal to fix wrong shape of TDBWE, #800 */ - -#define FIX_802__NON_BE_DECODING /* Fix possible difference float and fixed point when computing the GSC bit allocation */ -#define FIX_802_1137_1137_GSC_IVAS_FXFLT_DECODING /* VA: ISSUES 802 and 1137 Made sure that float and fixed point GCS bit allocation is the same during IVAS modes */ -#define FIX_810_PREVENT_UNECESSARY_SAT_IN_TC /* VA : Prevent an unnecessary saturation that can happen in TC, have a minimal impact on most cases. Significant improvement for the last segment of LTV when TC is triggered */ -#define FIX_826_PRECISION_LOST_AND_COMPL /* VA : Fix lost of precision that leads to unnecessary high noise floor and to some framing artifacts */ -#ifdef FIX_826_PRECISION_LOST_AND_COMPL -#define FIX_833_CORRECTION_to_826 /* VA : fix indexing error introduced in 826 */ -#endif -#define NONE_BE_FIX_816_LFE_PLC_FLOAT /* DLB: issue 816: reduce required precision to float for LFE-PLC*/ -#define FIX_844_Q_SYN_INIT /* VA : proposed fix to 844, initializing q_old_synth when switching to MDCT*/ -#define FIX_839_FB_CONTENT_SOMETIME_MISSING /* VA : Fix scaling error for FB TB BWE */ -#define FIX_846_TILT_BWE /* VA : Proposed fix to 846, to solve saturation */ -#define FIX_843_LOW_RATE_BWE /* VA : Proposed fix to 843 to solve mid band noise */ -#define FIX851_RANGE_DEC_PRECISION /* VA : 851 Proposed fix to keep precision during UL_div*/ -#define FX_834_OVFL_JBM_CROSSCORR /* FhG: Proposed fix to 834, allow overflows in calculation */ - - -#define FIX_854_HILBERT_SCALING /* VA: reduce lost of precision due to unnecessary scaling, reduce a lot the 2 kHz tone */ -#define FIX_856_EXTRACT_L /* VA: Fix undesirable wrap-around */ -#define FIX_835_PARAMMC_BUFFER_VALUES /* FhG: issue 835: wide range of buffer values for cx in ParamMC */ - -#define FIX_860_FER_CRASH /* VA: fix crash issues caused by saturation within shl */ -#define FIX_961_CRASH_DIV_L /* VA: fix to potential crash in div_l when index is <= 0 */ - -#define FIX_869_WRONG_UVGAIN_STEP /* VA: Fix wrong decoding of uv gain quantizer for td-stereo*/ - -#define FIX_871_REMOVE_UNNECESSARY_CONDITION /* VA: remove a condition that is not needed and prevented correct frame classification of the secondary channel of the TD stereo */ - -#define FIX_874_INCREASE_IPD_PRECISION /*VA : Fix issue 874 by increasing ITD precision already when decoding index */ -#define FIX_874_INCREASE_IPD_PRECISION_A /*VA : Fix a possible issue where 2*PI should be used instead of PI (to be confirmed) */ -#define FIX_875_SATURATION_DURING_ROUNDING /* VA: fix a possible saturation when rounding */ -#define FIX_882_LOW_LEVEL_DISCONTINUITIES /* VA: Fix 882, discontinuities for low level signal by adding a scaling function that uses rounding, this function is more complex than normal one, has to be used only when necessary*/ -#define FIX_879_DIFF_CONCEAL_PATH /* FhG: Fix for issue 879 and different concelalment paths that led to crash */ -#define FIX_907_MEM_UPDATE_ISSUE /* VA: fix for 907, multiples issues surrounding mem_syn_r and update of mem_syn2 when FS is changing */ -#define FIX_918_WRONG_SCALING_ON_MODE_SWITCHING /* VA: Fix wrong scaling of secondary channel when switching from stereo DFT to TD */ -#define FIX_924_IGF_ROUNDFX_SAT -#define FIX_930_JBM_BUFSIZE_MULT /* FhG: Fix 930, Word16 too small for apa_buffer_size */ -#define NONBE_FIX_943_PORT_1208_DFT_STEREO_PLC_BURST /* Ericsson: BASOP Issue 943, Float Issue 1208, fix for overflow of sample offset counter for burst error in DFT Stereo PLC. */ -#define FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC /* Nokia: Fixes ivas_decode_masaism_metadata decision logic change due to precision difference; needs corresponding fix in floating point */ -#define FIX_953_WRONG_ENERGY_RATIO_MASA_EXT /* Nok: Fix 953 wrong energy ratio value after shift and cast to Word8 */ -#define FIX_982_WRONG_DECODED_ENERGY_RATIO /* Nokia: Fix 982 wrong energy in EXT mode and in second direction when present */ -#define FIX_999_WRONG_ISM_EXTENDED_METADATA /* VA: fix 999: fix ISM extended metadata decoding */ -#define NONBE_FIX_1205_TD_STEREO_MOD_CT /* VA: fix mismatch of coder_type (mod_ct) btw. TD stereo encoder and decoder */ -#define NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING /* FhG: fixes for decoder-side noise level estimation in MDCT-Stereo to prevent noise bursts in stereo switching */ -/* ################## End DEVELOPMENT switches ######################### */ - -/* clang-format on */ -#define NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO - #endif diff --git a/lib_com/prot.h b/lib_com/prot.h index f7bc0463b28ebe4648d015a34967899c59f140b3..92e6134e90bb74c60eb47d5271b4acb6a49f505f 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -194,12 +194,10 @@ void set_zero_fx( Word32 *vec, /* o : input vector */ const Word16 lvec /* i : length of the vector */ ); -#ifdef FIX_930_JBM_BUFSIZE_MULT void set_zero2_fx( Word32 *vec, /* o : input vector */ const Word32 lvec /* i : length of the vector */ ); -#endif void set16_zero_fx( Word16 *vec, /* o : input vector */ const Word16 lvec /* i : length of the vector */ @@ -801,26 +799,7 @@ void hf_synth( float *synth, /* i/o: 12.8kHz synthesis signal */ float *synth16k /* i/o: 16kHz synthesis signal */ ); -#ifndef FIX_774_ENERGY_BURST -#ifdef IVAS_FLOAT_FIXED -void hf_synth_ivas_fx( - ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ - const Word32 core_brate, /* i : core bitrate */ - const Word16 output_frame, /* i : output frame length */ - const Word16 *Aq, /* i : quantized Az */ - const Word16 *exc, /* i : excitation at 12.8 kHz */ - Word16 *synth, /* i : 12.8kHz synthesis signal */ - Word16 *synth16k, /* o : 16kHz synthesis signal */ - const Word16 Q_exc, /* i : excitation scaling */ - const Word16 Q_syn2, /* i : synthesis scaling */ - Word16 *delay_syn_hf, /*i/o: HF synthesis memory */ - Word16 *memExp1, /* o : HF excitation exponent */ - Word16 *mem_hp_interp, /* i/o: interpol. memory */ - const Word16 extl, /* i : flag indicating BWE */ - const Word16 CNG_mode, /* i : CNG_mode */ - Word16 element_mode ); -#endif -#endif + int16_t lsp_convert_poly( float w[], /* i/o: LSP or ISP parameters */ const int16_t L_frame, /* i : flag for up or down conversion */ @@ -1270,11 +1249,13 @@ int16_t qlsf_ARSN_tcvq_Dec_16k( const int16_t nBits /* i : number of bits */ ); +#ifndef IVAS_FLOAT_FIXED int16_t lsf_bctcvq_encprm( BSTR_ENC_HANDLE hBstr, const int16_t *param_lpc, const int16_t *bits_param_lpc, const int16_t no_indices ); +#endif int16_t lsf_bctcvq_decprm_ivas( Decoder_State *st, @@ -2269,7 +2250,7 @@ void read_next_bwidth( int32_t *bwidth_profile_cnt, /* i/o: counter of frames for bandwidth switching profile file */ int32_t input_Fs /* i : input sampling rate */ ); - +#ifndef IVAS_FLOAT_FIXED ivas_error init_encoder( Encoder_State *st, /* i/o: state structure */ @@ -2282,6 +2263,7 @@ ivas_error init_encoder( , const int32_t element_brate /* element bitrate */ ); +#endif ivas_error init_encoder_ivas_fx( Encoder_State *st, /* i/o: state structure */ @@ -2447,14 +2429,14 @@ void retro_interp4_5( void retro_interp5_4( float *pst_old_syn ); - +#ifndef IVAS_FLOAT_FIXED void core_switching_hq_prepare_enc( Encoder_State *st, /* i/o: encoder state structure */ int16_t *num_bits, /* i/o: bit budget update */ const int16_t input_frame, /* i : input frame length */ float *wtda_audio, const float *audio ); - +#endif void core_switching_hq_prepare_dec( Decoder_State *st, /* i/o: decoder state structure */ int16_t *num_bits, /* i/o: bit budget update */ @@ -3060,17 +3042,14 @@ void a2isf( const float *old_isf, const int16_t lpcOrder ); -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -void a2rc( -#else /*! r: stability flag */ uint16_t a2rc( -#endif const float *a, /* i : LPC coefficients */ float *refl, /* o : Reflection co-efficients */ const int16_t lpcorder /* i : LPC order */ ); +#ifndef IVAS_FLOAT_FIXED int16_t lp_filt_exc_enc( const int16_t codec_mode, /* i : codec mode */ const int16_t coder_type, /* i : coding type */ @@ -3087,7 +3066,9 @@ int16_t lp_filt_exc_enc( float *gain_pit, /* o : adaptive excitation gain */ int16_t *lp_flag /* i/o: mode selection */ ); +#endif +#ifndef IVAS_FLOAT_FIXED void updt_tar( const float *x, /* i : old target (for pitch search) */ float *x2, /* o : new target (for codebook search) */ @@ -3095,6 +3076,7 @@ void updt_tar( const float gain, /* i : adaptive codebook gain */ const int16_t L /* i : subframe size */ ); +#endif void analy_sp( const int16_t element_mode, /* i : element mode */ @@ -3189,7 +3171,7 @@ void inov_encode( int16_t *unbits, /* o : number of unused bits for EVS_PI */ const int16_t L_subfr /* i : subframe length */ ); -#endif + void acelp_1t64( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ @@ -3208,7 +3190,7 @@ void acelp_2t32( float y[] /* o : filtered fixed codebook excitation */ ); -#ifndef IVAS_FLOAT_FIXED + int16_t acelp_4t64( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ float dn[], /* i : corr. between target and h[]. */ @@ -3222,7 +3204,7 @@ int16_t acelp_4t64( const int16_t cmpl_flag, /* i : coomplexity reduction flag */ const int16_t Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */ ); -#endif + /*! r: return (2*N)+1 bits */ int16_t quant_2p_2N1( @@ -3230,14 +3212,20 @@ int16_t quant_2p_2N1( const int16_t pos2, /* i : position of the pulse 2 */ const int16_t N /* i : number of bits for position */ ); - +#endif +Word16 quant_2p_2N1_fx( /* o: return (2*N)+1 bits */ + const Word16 pos1, /* i: position of the pulse 1 */ + const Word16 pos2, /* i: position of the pulse 2 */ + const Word16 N /* i: number of bits FOR position */ +); +#ifndef IVAS_FLOAT_FIXED void corr_xh( const float *x, /* i : target signal */ float *y, /* o : correlation between x[] and h[] */ const float *h, /* i : impulse response of weighted synthesis filter */ const int16_t L_subfr /* i : length of the subframe */ ); - +#endif void find_tilt( const float fr_bands[], /* i : energy in frequency bands */ const float bckr[], /* i : per band background noise energy estimate */ @@ -3386,6 +3374,7 @@ void vad_param_updt( const int16_t n_channels /* i : number of channels */ ); +#ifndef IVAS_FLOAT_FIXED /*! r: frame multi-harmonicity (1-harmonic, 0-not) */ int16_t multi_harm( const float Bin_E[], /* i : log energy spectrum of the current frame */ @@ -3401,6 +3390,7 @@ int16_t multi_harm( float *sp_floor, /* o : noise floor estimate */ float S_map[] /* o : short-term correlation map */ ); +#endif void lp_gain_updt( const int16_t i_subfr, /* i : subframe number */ @@ -3736,7 +3726,7 @@ void find_wsp( const float gamma, /* i : weighting factor */ const int16_t L_look /* i : look-ahead */ ); - +#ifndef IVAS_FLOAT_FIXED void pitch_ol_init( float *old_thres, /* o : threshold for reinforcement of past pitch influence */ int16_t *old_pitch, /* o : pitch of the 1st half-frame of previous frame */ @@ -3792,6 +3782,7 @@ void pitchDoubling_det( int16_t *pitch_ol, float *pitch_fr, float *voicing_fr ); +#endif void gain_enc_amr_wb( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ @@ -3881,6 +3872,7 @@ void E_corr_xy2( const int16_t L_subfr /* i : subframe size */ ); +#ifndef IVAS_FLOAT_FIXED /*! r: Floating pitch for each subframe */ float pit_encode( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ @@ -3903,6 +3895,7 @@ float pit_encode( const int16_t tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */ const float tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */ ); +#endif /*! r: coding type */ int16_t find_uv( @@ -3938,10 +3931,12 @@ void select_TC( const int16_t localVAD /* i : VAD without hangover */ ); +#ifndef IVAS_FLOAT_FIXED void coder_type_modif( Encoder_State *st, /* i/o: encoder state structure */ const float relE /* i : frame relative E to the long term average */ ); +#endif void wb_vad_init( VAD_HANDLE hVAD /* i/o: VAD data handle */ @@ -4080,6 +4075,7 @@ void tc_classif_enc( const float *res /* i : pointer to the LP residual signal frame */ ); +#ifndef IVAS_FLOAT_FIXED void set_impulse( const float xn[], /* i : target signal */ const float h_orig[], /* i : impulse response of weighted synthesis filter */ @@ -4089,6 +4085,7 @@ void set_impulse( int16_t *imp_pos, /* o : position of the glottal impulse center index */ float *gain_trans /* o : transition gain */ ); +#endif void gain_enc_tc( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ @@ -4104,6 +4101,7 @@ void gain_enc_tc( float *norm_gain_code /* o : norm. gain of the codebook excitation */ ); +#ifndef IVAS_FLOAT_FIXED /*! r: pitch gain (0..GAIN_PIT_MAX) */ float corr_xy1( const float xn[], /* i : target signal */ @@ -4112,7 +4110,9 @@ float corr_xy1( const int16_t L_subfr, /* i : subframe length */ const int16_t norm_flag /* i : flag for constraining pitch contribution */ ); +#endif +#ifndef IVAS_FLOAT_FIXED void norm_corr( const float exc[], /* i : excitation buffer */ const float xn[], /* i : target signal */ @@ -4177,6 +4177,7 @@ int16_t delta_pit_enc( const int16_t T0_frac, /* i : pitch fraction */ const int16_t T0_min /* i : delta search min */ ); +#endif /*! r: comfort noise gain factor */ float AVQ_cod( @@ -5381,6 +5382,7 @@ void direct_transform( const int16_t element_mode /* i : IVAS element mode */ ); +#ifndef IVAS_FLOAT_FIXED /*! r: index of noise attenuation */ int16_t noise_adjust( const float *coeffs_norm, /* i : normalized coefficients */ @@ -5389,6 +5391,7 @@ int16_t noise_adjust( const int16_t *sfm_end, /* i : End of bands */ const int16_t core_sfm /* i : index of the end band for core */ ); +#endif void interleave_spectrum( float *coefs, /* i/o: input and output coefficients */ @@ -5452,7 +5455,7 @@ void diffcod_lrmdct( int16_t *difidx, /* o : differential code */ const int16_t is_transient /* i : transient flag */ ); - +#ifndef IVAS_FLOAT_FIXED void normalizecoefs( float *coefs, /* i/o: MDCT coefficients */ const int16_t *ynrm, /* i : quantization indices for norms */ @@ -5460,6 +5463,7 @@ void normalizecoefs( const int16_t *band_start, /* i : Start of bands */ const int16_t *band_end /* i : End of bands */ ); +#endif void bitallocsum( int16_t *R, /* i : bit-allocation vector */ @@ -5994,7 +5998,7 @@ float env_stab_smo( float *env_stab_state_p, /* i/o: env_stab state probabilities */ int16_t *ho_cnt /* i/o: hangover counter for speech state */ ); - +#ifndef IVAS_FLOAT_FIXED void core_switching_pre_enc( Encoder_State *st, /* i/o: encoder state structure */ #ifndef IVAS_FLOAT_FIXED @@ -6004,6 +6008,7 @@ void core_switching_pre_enc( const int16_t active_cnt, /* i : Active frame counter */ const int16_t last_element_mode /* i : last_element_mode */ ); +#endif #ifndef IVAS_FLOAT_FIXED void core_switching_post_enc( Encoder_State *st, /* i/o: encoder state structure */ @@ -6327,6 +6332,7 @@ void reverse_transient_frame_energies( const int16_t bands /* i : number of bands */ ); +#ifndef IVAS_FLOAT_FIXED int16_t peak_vq_enc( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ const int16_t bwidth, /* i : audio bandwidth */ @@ -6340,6 +6346,7 @@ int16_t peak_vq_enc( int16_t *vq_peak_idx, /* i : Peak index vector */ float *nf_gains /* i : Estimated noise floor gains */ ); +#endif void hvq_dec( Decoder_State *st, /* i/o: decoder state structure */ @@ -6725,6 +6732,7 @@ void E_LPC_int_lpc_tcx_float( float a[] /* o : interpolated LP coefficients */ ); +#ifndef IVAS_FLOAT_FIXED int16_t E_GAIN_closed_loop_search( float exc[], float xn[], @@ -6742,12 +6750,13 @@ int16_t E_GAIN_closed_loop_search( const int16_t pit_fr2, const int16_t pit_fr1, const int16_t L_subfr ); +#endif void E_ACELP_toeplitz_mul( const float R[], const float c[], float d[] ); - +#ifndef IVAS_FLOAT_FIXED void acelp_pulsesign( const float cn[], float dn[], @@ -6756,7 +6765,6 @@ void acelp_pulsesign( float vec[], const float alp ); -#ifndef IVAS_FLOAT_FIXED void E_ACELP_4t( float dn[], float cn[], @@ -6789,7 +6797,7 @@ void E_ACELP_4tsearchx( PulseConfig *config, int16_t ind[] ); #endif - +#ifndef IVAS_FLOAT_FIXED int16_t E_ACELP_indexing( float code[], PulseConfig config, @@ -6802,7 +6810,7 @@ void acelp_findcandidates( int16_t pos_max[], const int16_t L_subfr, const int16_t tracks ); - +#endif void E_ACELP_innovative_codebook( const float *exc, /* i : pointer to the excitation frame */ const int16_t T0, /* i : integer pitch lag */ @@ -6831,14 +6839,14 @@ int16_t E_ACELP_code43bit( uint32_t *ps, int16_t *p, uint16_t idxs[] ); - +#ifndef IVAS_FLOAT_FIXED void fcb_pulse_track_joint( uint16_t *idxs, const int16_t wordcnt, uint32_t *index_n, const int16_t *pulse_num, const int16_t track_num ); - +#endif void D_ACELP_indexing_ivas( float code[], PulseConfig config, @@ -6884,13 +6892,13 @@ void ham_cos_window_flt( float *fh, const int16_t n1, const int16_t n2 ); -#endif + /*! r: noise dependent voicing correction */ float correlation_shift( const float totalNoise /* i : noise estimate over all critical bands */ ); - +#endif void init_coder_ace_plus( Encoder_State *st, /* i : Encoder state handle */ const int32_t last_total_brate, /* i : last total bitrate */ @@ -7111,7 +7119,7 @@ void gain_dec_gacelp_uv( float *past_gcode, /* i/o: past energy of code */ float *gain_inov /* o : unscaled innovation gain */ ); - +#ifndef IVAS_FLOAT_FIXED void Mode2_pit_encode( const int16_t coder_type, /* i : coding model */ const int16_t i_subfr, /* i : subframe index */ @@ -7133,6 +7141,7 @@ void Mode2_pit_encode( const int16_t pit_fr2, const int16_t pit_max, const int16_t pit_res_max ); +#endif void limit_T0_voiced_ivas( const int16_t nbits, @@ -7148,6 +7157,7 @@ void limit_T0_voiced_ivas( const int16_t pit_max /* i : Maximum pitch lag */ ); +#ifndef IVAS_FLOAT_FIXED void Mode2_abs_pit_enc( const int16_t T0, /* i : integer pitch lag */ const int16_t T0_frac, /* i : pitch fraction */ @@ -7156,7 +7166,6 @@ void Mode2_abs_pit_enc( const int16_t pit_fr1, const int16_t pit_fr2, const int16_t pit_res_max ); - void Mode2_delta_pit_enc( const int16_t T0, /* i : integer pitch lag */ const int16_t T0_frac, /* i : pitch fraction */ @@ -7165,6 +7174,7 @@ void Mode2_delta_pit_enc( const int16_t T0_min_frac, /* i : delta search min */ int16_t **pt_indice /* o : pointer to Vector of Q indexes */ ); +#endif /*! r: floating pitch value */ float Mode2_pit_decode_flt( @@ -7217,6 +7227,7 @@ void formant_post_filt_ivas( const int16_t off_flag /* i : Off flag */ ); +#ifndef IVAS_FLOAT_FIXED void qlpc_avq( const float *lsp, /* i : Input LSF vectors */ const float *lspmid, /* i : Input mid-LSF vectors */ @@ -7228,7 +7239,9 @@ void qlpc_avq( const int16_t core, /* i : core */ const int32_t sr_core /* i : internal sampling rate */ ); +#endif +#ifndef IVAS_FLOAT_FIXED int16_t encode_lpc_avq( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ const int16_t numlpc, /* i : Number of sets of lpc */ @@ -7236,6 +7249,7 @@ int16_t encode_lpc_avq( const int16_t core, /* i : core */ const int16_t element_mode /* i : element mode */ ); +#endif int16_t dlpc_avq( int16_t *index, /* i : Quantization indices */ @@ -7253,6 +7267,7 @@ int16_t decode_lpc_avq( const int16_t sns_low_br_mode /* i : SNS low-bitrate mode */ ); +#ifndef IVAS_FLOAT_FIXED /*! r: codebook index */ int16_t vlpc_1st_cod( const float *lsf, /* i : vector to quantize */ @@ -7269,6 +7284,7 @@ int16_t vlpc_2st_cod( const int16_t mode, /* i : 0=abs, >0=rel */ const int32_t sr_core /* i : internal sampling rate */ ); +#endif void vlpc_2st_dec_flt( float *lsfq, /* i/o: i:1st stage o:1st+2nd stage */ @@ -7576,6 +7592,7 @@ void mdct_noiseShaping_flt( const float gains[], const int16_t nBands ); +#ifndef IVAS_FLOAT_FIXED void AdaptLowFreqEmph( float x[], int16_t xq[], @@ -7583,10 +7600,13 @@ void AdaptLowFreqEmph( const int16_t tcx_lpc_shaped_ari, const float lpcGains[], const int16_t lg ); +#endif +#ifndef IVAS_FLOAT_FIXED void PsychAdaptLowFreqEmph( float x[], const float lpcGains[] ); +#endif void PsychAdaptLowFreqDeemph_flt( float x[], @@ -7600,21 +7620,25 @@ void AdaptLowFreqDeemph_flt( const int16_t lg, float lf_deemph_factors[] ); +#ifndef IVAS_FLOAT_FIXED /*! r: SQ gain */ float SQ_gain( const float x[], /* i : vector to quantize */ const int16_t nbitsSQ, /* i : number of bits targeted */ const int16_t lg /* i : vector size (2048 max) */ ); +#endif +#ifndef IVAS_FLOAT_FIXED /*! r: SQ gain */ float SQ_gain_estimate( const float x[], /* i : vector to quantize */ const int16_t nbitsSQ, /* i : number of bits targeted */ const int16_t lg /* i : vector size (2048 max) */ ); +#endif - +#ifndef IVAS_FLOAT_FIXED void tcx_scalar_quantization( float *x, /* i : input coefficients */ int16_t *xq, /* o : quantized coefficients */ @@ -7623,7 +7647,9 @@ void tcx_scalar_quantization( const float offset, /* i : rounding offset (deadzone) */ int8_t *memQuantZeros, /* o : coefficients set to 0 */ const int16_t tcxonly ); +#endif +#ifndef IVAS_FLOAT_FIXED int16_t tcx_scalar_quantization_rateloop( float *x, /* i : input coefficients */ int16_t *xq, /* o : quantized coefficients */ @@ -7642,12 +7668,16 @@ int16_t tcx_scalar_quantization_rateloop( CONTEXT_HM_CONFIG *hm_cfg, const int16_t iter_max, const int16_t element_mode ); +#endif +#ifndef IVAS_FLOAT_FIXED void tcx_QuantizeGain( const int16_t n, float *pGain, int16_t *pQuantizedGain ); +#endif +#ifndef IVAS_FLOAT_FIXED void tcx_noise_factor( const float *x_orig, /* i : unquantized mdct coefficients */ float *sqQ, /* i/o: quantized mdct coefficients */ @@ -7661,6 +7691,7 @@ void tcx_noise_factor( int16_t *quantized_fac_ns, /* o : quantized noise factor */ const int16_t element_mode /* i : IVAS element mode */ ); +#endif void tcx_noise_filling_flt( float *Q, @@ -7675,12 +7706,14 @@ void tcx_noise_filling_flt( const int16_t element_mode /* i : IVAS element mode */ ); +#ifndef IVAS_FLOAT_FIXED void tcx_encoder_memory_update( Encoder_State *st, /* i/o: encoder memory state */ float *xn_buf, /* i/o: mdct output buffer/TD weigthed synthesis */ const float *Ai, /* i : Unquantized (interpolated) LPC coefficients */ const float *A /* i : Quantized LPC coefficients */ ); +#endif void tcx_decoder_memory_update_flt( Decoder_State *st, /* i/o: decoder memory state */ @@ -7689,6 +7722,7 @@ void tcx_decoder_memory_update_flt( const float *A /* i : Quantized LPC coefficients */ ); +#ifndef IVAS_FLOAT_FIXED /*! r: number of bits used (including "bits") */ int16_t tcx_ari_res_Q_spec( const float x_orig[], /* i : original spectrum */ @@ -7702,6 +7736,7 @@ int16_t tcx_ari_res_Q_spec( const float deadzone, /* i : quantizer deadzone */ const float x_fac[] /* i : spectrum post-quantization factors */ ); +#endif /*! r: number of bits used (including "bits") */ int16_t tcx_ari_res_invQ_spec_flt( @@ -8206,7 +8241,7 @@ void dec_prm_ivas( int16_t param_lpc[], /* i : LPC parameters */ int16_t *total_nbbits, /* i/o: number of bits / decoded bits */ int16_t *bitsRead ); - +#ifndef IVAS_FLOAT_FIXED void gauss_L2( const float h[], /* i : weighted LP filter impulse response */ float code[], /* o : gaussian excitation */ @@ -8219,7 +8254,7 @@ void gauss_L2( float formant_enh_num, /* i : formant enhancement factor */ int16_t *seed_acelp /* i/o: random seed */ ); - +#endif void gaus_L2_dec_flt( float *code, /* o : decoded gaussian codevector */ float tilt_code, @@ -8280,11 +8315,14 @@ int16_t tcx_ltp_decode_params_flt( const int16_t pitmax, const int16_t pitres ); +#ifndef IVAS_FLOAT_FIXED int16_t enc_lsf_tcxlpc( const int16_t **indices, /* i : Ptr to VQ indices */ BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */ ); +#endif +#ifndef IVAS_FLOAT_FIXED void msvq_enc( const float *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) */ const int16_t dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */ @@ -8300,6 +8338,7 @@ void msvq_enc( float *invTrfMatrix, /* i/o: expanded synthesis matrix */ int16_t Idx[] /* o : Indices */ ); +#endif void msvq_dec_float( const float *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) */ @@ -8353,6 +8392,7 @@ void extend_dctN_input( const DCTTYPE dcttype /* i : matrix operation type */ ); +#ifndef IVAS_FLOAT_FIXED /*! r: (p_max , best candidate sofar ) */ int16_t msvq_stage1_dct_search( const float *u, /* i : target */ @@ -8379,7 +8419,9 @@ int16_t msvq_stage1_dct_search( float *st1_syn_vec_ptr, /* i/o: buffer for IDCT24 synthesis */ float *dist1_ptr /* o : resulting stage 1 MSEs in DCT-N domain */ ); +#endif +#ifndef IVAS_FLOAT_FIXED /*! r: (updated p_max) */ int16_t msvq_stage1_dct_recalc_candidates_fdcng_wb( const float *st1_syn_vec_ptr, /* i : IDCT24 synthesis vectors */ @@ -8387,6 +8429,7 @@ int16_t msvq_stage1_dct_recalc_candidates_fdcng_wb( const int16_t maxC_st1, /* i : number of candidates in stage1 */ float *dist_ptr /* i/o: updated MSE vector for stage1 */ ); +#endif void PulseResynchronization( const float *src_exc, /* i : Input excitation buffer */ @@ -8424,6 +8467,7 @@ int16_t tcxlpc_get_cdk_float( const int16_t coder_type /* i : GC/VC indicator */ ); +#ifndef IVAS_FLOAT_FIXED int16_t lsf_msvq_ma_encprm( BSTR_ENC_HANDLE hBstr, const int16_t *param_lpc, @@ -8432,6 +8476,7 @@ int16_t lsf_msvq_ma_encprm( const int16_t acelp_midLpc, const int16_t bits_param_lpc[], const int16_t no_indices ); +#endif int16_t lsf_msvq_ma_decprm_ivas( Decoder_State *st, @@ -8636,11 +8681,13 @@ int16_t vad_proc( const int16_t vada_flag /* i : VAD flag */ ); +#ifndef IVAS_FLOAT_FIXED void subband_FFT( float Sr[16][60], /* i : real part */ float Si[16][60], /* i : imag part */ float *spec_amp /* o : spectral amplitude */ ); +#endif int16_t update_decision( VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */ @@ -8658,12 +8705,14 @@ void frame_spec_dif_cor_rate( float f_tonality_rate[] /* o : tonality rate */ ); +#ifndef IVAS_FLOAT_FIXED void ltd_stable( float frames_power[], /* i/o: energy of several frames */ float ltd_stable_rate[], /* o : time-domain stable rate */ const float frame_energy, /* i : current frame energy */ const int16_t frameloop /* i : number of frames */ ); +#endif void SNR_calc( const float frame_sb_energy[], /* i : energy of sub-band divided non-uniformly*/ @@ -8697,6 +8746,7 @@ void est_energy( const int16_t bw /* i : bandwidth */ ); +#ifndef IVAS_FLOAT_FIXED void spec_center( float spec_power[], /* i : energy of sub-band divided uniformly */ float sp_center[], /* o : spectral center */ @@ -8708,6 +8758,7 @@ void spec_flatness( float smooth_spec_amp[], /* i : smoothed spectral amplitude */ float sSFM[] /* o : spectral flatness rate */ ); +#endif int16_t comvad_decision( VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */ @@ -9017,12 +9068,12 @@ void deleteFdCngEnc( HANDLE_FD_CNG_ENC *hFdCngEnc /* i/o: FD_CNG structure */ ); +#ifndef IVAS_FLOAT_FIXED void configureFdCngEnc( HANDLE_FD_CNG_ENC hFdCngEnc, /* i/o: Contains the variables related to the FD-based CNG process */ const int16_t bwidth, const int32_t total_brate ); -#ifndef IVAS_FLOAT_FIXED void initFdCngEnc( HANDLE_FD_CNG_ENC hFdCngEnc, /* i/o: Contains the variables related to the FD-based CNG process */ const int32_t input_Fs, /* i : input signal sampling frequency in Hz */ @@ -9448,7 +9499,7 @@ void post_decoder_flt( const int16_t pitch[], float signal_out[], float bpf_noise_buf[] ); - +#ifndef IVAS_FLOAT_FIXED float bass_pf_enc( const float *orig, /* i : 12.8kHz original signal */ const float *syn, /* i : 12.8kHz synthesis to postfilter */ @@ -9463,7 +9514,7 @@ float bass_pf_enc( float *mem_deemph_err, /* i/o: Error deemphasis memory */ float *lp_ener /* i/o: long_term error signal energy */ ); - +#endif void cldfb_synth_set_bandsToZero_flt( Decoder_State *st, /* i/o: decoder state structure */ float **rAnalysis, @@ -9735,15 +9786,19 @@ void calcLoEnvCheckCorrHiLo( int16_t *corr_flag /* o : 0 for original, 1 for TEC */ ); +#ifndef IVAS_FLOAT_FIXED void tfaCalcEnv( const float *shb_speech, float *enr ); +#endif +#ifndef IVAS_FLOAT_FIXED int16_t tfaEnc_TBE( const float *enr, const int16_t last_core, const float *voicing, const float *pitch_buf ); +#endif void tecEnc_TBE( int16_t *corrFlag, diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 2c3a6d59344245afb796b6eb3641a01f49822cb7..e609a0d916706637fd1d90befe1ed0628a7deb93 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -1385,13 +1385,11 @@ void scale_sig32( const Word16 lg, /* i : size of x[] Q0 */ const Word16 exp0 /* i : exponent: x = round(x << exp) Qx xx exp */ ); -#ifdef FIX_882_LOW_LEVEL_DISCONTINUITIES void scale_sig32_r( Word32 x[], /* i/o: signal to scale Qx */ const Word16 lg, /* i : size of x[] Q0 */ const Word16 exp0 /* i : exponent: x = round(x << exp) Qx exp */ ); -#endif Word16 rescale_mem( const Word16 *Q_exc, /* i : current excitation scaling (>=0) */ Word16 *prev_Q_syn, /* i/o : scaling factor of previous frame */ @@ -2416,12 +2414,7 @@ void ivas_synth_mem_updt2_fx( Word16 mem_syn_r[], /* i/o: synthesis filter memory */ Word16 mem_syn2[], /* o : synthesis filter memory for find_target */ Word16 mem_syn[], /* o : synthesis filter memory for find_target */ - const Word16 dec -#ifndef FIX_907_MEM_UPDATE_ISSUE - , /* i : flag for decoder indication */ - Word16 Q -#endif -); + const Word16 dec ); #endif @@ -6018,10 +6011,8 @@ void lsf_dec_fx( Word16 *lsp_new, /* o : de-quantized LSP vector Q15*/ Word16 *lsp_mid, /* o : de-quantized mid-frame LSP vector Q15*/ const Word16 tdm_low_rate_mode /* i : secondary channel low rate mode flag Q0*/ -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel Qx*/ -#endif ); void lsf_dec_ivas_fx( @@ -6033,10 +6024,8 @@ void lsf_dec_ivas_fx( Word16 *lsp_new, /* o : de-quantized LSP vector Q15*/ Word16 *lsp_mid, /* o : de-quantized mid-frame LSP vector Q15*/ const Word16 tdm_low_rate_mode /* i : secondary channel low rate mode flag Q0*/ -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel Qx*/ -#endif ); /*! r: index of the maximum value in the input vector */ @@ -6172,10 +6161,8 @@ void lsf_end_dec_fx( Word16 *lpc_param, /* i : LPC parameters Q0*/ Word16 *LSF_Q_prediction, /* o : LSF prediction mode Q0*/ Word16 *nb_indices /* o : number of indices Q0*/ -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel Qx*/ -#endif ); void lsf_mid_dec_fx( @@ -8131,12 +8118,8 @@ void FEC_clas_estim_fx( Word16 *lt_diff_etot, /* i/o: long-term total energy variation */ /*A*/ Word16 *amr_io_class, -/* i/o: classification for AMR-WB IO mode */ /*A*/ -#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION - const Word32 bitrate, -/* i : Decoded bitrate */ /*A*/ -#endif - Word16 Q_syn, /* i : Synthesis scaling */ + /* i/o: classification for AMR-WB IO mode */ /*A*/ + Word16 Q_syn, /* i : Synthesis scaling */ Word16 *class_para, /* o : classification para. fmerit1 */ /*A*/ Word16 *mem_syn_clas_estim, /* i/o: memory of the synthesis signal for frame class estimation */ diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 4f3f61e998b36684053550eda860f02b7250df43..0913ad5ac5f89d6a64d8c43c43e950a4ae71733d 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -487,8 +487,8 @@ void apply_gain_fx( const Word16 *band_start, /* i : Sub band start indices Q0 */ const Word16 *band_end, /* i : Sub band end indices Q0 */ const Word16 num_sfm, /* i : Number of bands Q0 */ - const Word16 *gains, /* i : Band gain vector Q12 */ - Word16 *xq /* i/o: Float synthesis / Gain adjusted synth Q15/Q12 */ + const Word16 *gains, /* i : Band gain vector Qx */ + Word16 *xq /* i/o: Float synthesis / Gain adjusted synth Q15/Qx */ ) { Word16 band, i; @@ -520,7 +520,7 @@ void fine_gain_quant_ivas_fx( const Word16 *ord, /* i : Indices for energy order Q0 */ const Word16 num_sfm, /* i : Number of bands Q0 */ const Word16 *gain_bits, /* i : Gain adjustment bits per sub band Q0 */ - Word16 *fg_pred, /* i/o: Predicted gains / Corrected gains Q12 */ + Word16 *fg_pred, /* i/o: Predicted gains / Corrected gains Q11 */ const Word16 *gopt /* i : Optimal gains Q12 */ ) { @@ -575,7 +575,7 @@ void fine_gain_quant_ivas_fx( exp1 = sub( 14, exp1 ); L_tmp = L_mult0( fg_pred[band], tmp1 ); /*12+exp1 */ - fg_pred[band] = round_fx( L_shl( L_tmp, sub( 16, exp1 ) ) ); /*12+exp1+16-exp1-16=12 */ + fg_pred[band] = round_fx( L_shl( L_tmp, sub( 15, exp1 ) ) ); /*12+exp1+16-exp1-16=12 - 1-> Q11*/ move16(); } } diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index c2c92f2f41c5ba48cb7d643eb9952005f60028f7..3f343a5e4113af619e1c338c14642813184ac40d 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -489,11 +489,15 @@ const Word32 crit_bands_fx[] =//Q0 9500, 12000, 15500, 40000 }; #endif + +#ifndef IVAS_FLOAT_FIXED const float crit_bins_corr[CRIT_NOIS_BAND] = { 0.9f, 0.9f, 0.85f, 0.8f, 0.775f, 0.75f, 0.725f, 0.7f, 0.675f, 0.65f, 0.625f, 0.60f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f }; +#endif + const Word16 crit_bins_corr_fx[CRIT_NOIS_BAND] = {//Q15 /*.9f, .9f, .85f, .8f, .775f, .75f, .725f , .7f , .675f, .65f, .625f , .60f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f*/ @@ -505,16 +509,20 @@ const Word16 crit_bins[CRIT_NOIS_BAND] = // Q0 4, 4, 4, 4, 4, 5, 6, 6, 6, 8, 8, 10, 11, 13, 15, 18, 22, 16, 16, 20, 20, 20, 16 }; +#ifndef IVAS_FLOAT_FIXED const float crit_bands_loc[CRIT_NOIS_BAND] = { 100.0f, 200.0f, 300.0f, 400.0f, 510.0f, 630.0f, 770.0f, 920.0f, 1080.0f, 1270.0f, 1480.0f, 1720.0f, 2000.0f, 2320.0f, 2700.0f, 3150.0f, 3700.0f, 4100.0f, 4500.0f, 5000.0f, 5500.0f, 6000.0f, 6375.0f }; +#endif + const Word16 crit_bands_loc_fx[CRIT_NOIS_BAND] = {//Q0 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480, 1720, 2000, 2320, 2700, 3150, 3700, 4100, 4500, 5000, 5500, 6000, 6375 }; + const float inv_tbl[130] = { 0.0f, /* unused */ @@ -660,7 +668,9 @@ const Word16 mfreq_loc_LD_fx[] = { 100, 200, 300, 400, 510, 630, 770, 920, 1080, }; const Word16 mfreq_bindiv_LD[] = {10, 10, 10, 10, 11, 12, 14, 15, 16, 19, 21, 24, 28, 32, 38, 45, 55, 70, 90, 110}; // Q0 +#ifndef IVAS_FLOAT_FIXED const float sc_qnoise[] = {0.1f,0.1f,0.1f,0.1f,0.1f,0.1f,0.09091f,0.09091f,0.09091f,0.09091f,0.09091f,0.09091f,0.09091f,0.09091f,0.09091f,0.06667f,0.06667f,0.06667f,0.06667f,0.06667f}; +#endif const Word16 sc_qnoise_fx[] = { 3277, 3277, 3277, 3277, 3277, 3277, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2185, 2185, 2185, 2185, 2185 };//Q15 const Word16 inv_mfreq_bindiv_LD_fx[] = { 3277, 3277, 3277, 3277, 2979, 2731, 2341, 2185, 2048, 1725, 1560, 1365, 1170, 1024, 862, 728, 596, 468, 364, 298 }; /*Q15 */ @@ -693,6 +703,7 @@ const float post_dct_wind[OFFSET2] = 0.016078f, 0.014080f, 0.012212f, 0.010476f, 0.008872f, 0.007400f, 0.006060f, 0.004853f, 0.003780f, 0.002840f, 0.002034f, 0.001362f, 0.000824f, 0.000420f, 0.000151f, 0.000017f }; + const Word16 post_dct_wind_fx[OFFSET2] = /*Q15 */ { 32767, 32766, 32759, 32748, 32733, 32713, 32689, 32660, @@ -721,8 +732,10 @@ const Word16 post_dct_wind_fx[OFFSET2] = /*Q15 */ 124, 93, 67, 45, 27, 14, 5, 1 }; +#ifndef IVAS_FLOAT_FIXED const float MAX_SNR_SNR1_tab[MBANDS_GN_LD] = { 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.02631627f, 1.043478f, 1.043478f, 1.043478f, 1.043478f}; const float INV_MAX_SNR_tab[MBANDS_GN_LD] = { .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .043478f, .043478f, .043478f, .043478f}; +#endif const Word16 MAX_SNR_SNR1_tab_FX[MBANDS_GN_LD] = { 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 17096, 17096, 17096, 17096 };//Q14 const Word16 INV_MAX_SNR_tab_FX[MBANDS_GN_LD] = { 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 1425, 1425, 1425, 1425 };//Q15 @@ -745,6 +758,7 @@ const float wind_sss[LEN_WIN_SSS] = /* window for subsampling */ 0.989767f, 0.992307f, 0.994488f, 0.996307f, 0.997765f, 0.998859f, 0.999589f, 0.999954f, 1.000000f, 0.979530f, 0.918958f, 0.820763f, 0.688967f, 0.528964f, 0.347305f, 0.151428f }; + const Word16 wind_sss_fx[LEN_WIN_SSS] = /*window for subsampling*/ {//Q15 2621, 2627, 2645, 2675, 2717, 2771, 2836, 2914, @@ -1391,6 +1405,7 @@ const Word16 grid40_fx[(GRID40_POINTS - 1) / 2 - 1] = #endif + const float grid100[GRID100_POINTS+1] = { 1.0000000000f, 0.9995065331f, 0.9980267286f, 0.9955619574f, 0.9921147227f, @@ -1587,6 +1602,7 @@ const float sincos_t_ext[641] = -0.639124444863776f, -0.643831542889791f, -0.648514401022112f, -0.653172842953777f, -0.657806693297079f, -0.662415777590172f, -0.666999922303637f, -0.671558954847018f, -0.676092703575316f, -0.680600997795453f, -0.685083667772700f, -0.689540544737067f, -0.693971460889654f, -0.698376249408973f, -0.702754744457225f, -0.707106781186547f }; + const Word16 sincos_t_ext_fx[641] = {//Q15 0, 201, 402, 603, 804, 1005, 1206, 1407, @@ -1672,7 +1688,7 @@ const Word16 sincos_t_ext_fx[641] = -23028 };/*Q15*/ - +#ifndef IVAS_FLOAT_FIXED const float Asr_LP32[41] = { 0.00000000f, 0.00074311f, 0.00168152f, 0.00177319f, -0.00000000f, -0.00345938f, -0.00653664f, -0.00604727f, @@ -1701,6 +1717,7 @@ const float Asr_LP48[61] = 0.00000000f, -0.00310585f, -0.00452368f, -0.00435776f, -0.00311928f, -0.00147233f, -0.00000000f, 0.00094416f, 0.00127506f, 0.00112101f, 0.00071673f, 0.00029287f, 0.00000000f }; +#endif const Word16 Asr_LP16_fx[21] = { @@ -1758,7 +1775,7 @@ const Word16 fft256_read_indexes[]= // Q0 /*----------------------------------------------------------------------------------* * Sinus & Cosinus - table for the DCT-IV based 2 *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float sin_table256[] = { 0.003067957f, 0.009203755f, 0.015339206f, 0.02147408f, 0.027608146f, 0.033741172f, 0.039872928f, 0.046003182f, 0.052131705f, @@ -1791,6 +1808,7 @@ const float sin_table256[] = 0.99706007f, 0.997511456f, 0.997925286f, 0.998301545f, 0.998640218f, 0.998941293f, 0.999204759f, 0.999430605f, 0.999618822f, 0.999769405f, 0.999882347f, 0.999957645f, 0.999995294f }; +#endif const Word16 sin_table256_fx[] = {//Q15 @@ -1827,7 +1845,7 @@ const Word16 sin_table256_fx[] = /*----------------------------------------------------------------------------------* * 1/4 resolution interpolation filter (-3 dB at 0.913*fs/2) *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float inter4_2[65] = { 0.940000f, @@ -1848,6 +1866,7 @@ const float inter4_2[65] = -0.000618f, -0.000434f, -0.000133f, 0.000063f, 0.000098f, 0.000048f, 0.000007f, 0.000000f }; +#endif const Word16 inter4_2_fx_Q15[65] = @@ -1942,7 +1961,7 @@ const Word16 pitch_inter4_1[UP_SAMP * L_INTERPOL1 + 1] = /*----------------------------------------------------------------------------------* * 1/6 resolution interpolation filter (-3 dB at 0.95*fs/2) *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float inter6_2[PIT_FIR_SIZE6_2] = { 0.949986374119862F, 0.911081104469830F, 0.800115099292852F, 0.633320673120883F, 0.434558462154083F, 0.231177017786780F, @@ -1964,6 +1983,8 @@ const float inter6_2[PIT_FIR_SIZE6_2] = -0.000132755824518F, -0.000148377158880F, -0.000112937171810F, -0.000061132514471F, -0.000019974224468F, -0.000000460344975F, 0.000001976848453F }; +#endif + /* 1/6 resolution interpolation filter (-3 dB at 0.95*fs/2) */ const Word16 pitch_inter6_2[PIT_FIR_SIZE6_2] = { @@ -2620,9 +2641,11 @@ const Resampling_cfg resampling_cfg_tbl[] = * LSP interpolation coefficients *----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED const float interpol_frac2[NB_SUBFR] = { 0.5f, 0.5f, 1.0f, 1.0f }; +#endif const Word16 interpol_frac2_fx[NB_SUBFR] = {//Q15 16384, 16384, 32767, 32767 @@ -2642,9 +2665,11 @@ const Word16 interpol_frac2_mid_fx[NB_SUBFR * 3] = {//Q15 0, 8191, 24575 };/*Q15*/ +#ifndef IVAS_FLOAT_FIXED const float interpol_frac_12k8[NB_SUBFR] = { 0.25f, 0.5f, 0.75f, 1.0f }; +#endif const Word16 interpol_frac_12k8_fx[NB_SUBFR] = {//Q15 8191, 16383, 24575, 32767 @@ -2652,7 +2677,6 @@ const Word16 interpol_frac_12k8_fx[NB_SUBFR] = {//Q15 const Word16 interpol_frac_fx[NB_SUBFR] = { 8192, 16384, 24576,32767 };/*Q15*/ - const float interpol_isp_amr_wb[NB_SUBFR] = { 0.45f, 0.8f, 0.96f, 1.0f }; @@ -2663,16 +2687,15 @@ const float interpol_frac_16k[NB_SUBFR16k] = { 0.2f, 0.4f, 0.6f, 0.8f, 1.0f }; - const Word16 interpol_frac_16k_fx[NB_SUBFR16k] = { 6554, 13107, 19661, 26214, 32767 };//Q15 - const float interpol_frac_mid[NB_SUBFR*3] = { 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f }; + const Word16 interpol_frac_mid_fx[NB_SUBFR * 3] = { 16384, 16384, 0,//Q15 0, 32767, 0, 0, 16384, 16384, @@ -2686,12 +2709,14 @@ const float interpol_frac_mid_16k[NB_SUBFR16k*3] = { 0.0f, 0.35f, 0.65f, 0.0f, 0.0f, 1.0f }; + const Word16 interpol_frac_mid_16k_fx[NB_SUBFR16k * 3] = { 18022, 14746, 0,//Q15 4915, 27853, 0, 0, 24576, 8192, 0, 11469, 21299, 0, 0, 32767 }; + const float interpol_frac_mid_relaxprev_12k8[NB_SUBFR*3] = { 0.0f, 0.7f, 0.3f, 0.0f, 0.0f, 1.0f, @@ -2704,31 +2729,32 @@ const Word16 interpol_frac_mid_relaxprev_12k8_fx[NB_SUBFR * 3] = { 0, 22938, 983 0, 0, 32767, 0, 0, 32767 };/*Q15*/ + const float interpol_frac_mid_FEC[NB_SUBFR*3] = { 0.25f, 0.55f, 0.20f, 0.00f, 0.70f, 0.30f, 0.00f, 0.45f, 0.55f, 0.00f, 0.00f, 1.00f }; + const Word16 interpol_frac_mid_FEC_fx[NB_SUBFR * 3] = { 8192, 18022, 6554,//Q15 0, 22938, 9830, 0, 14746, 18022, 0, 0, 32767 };/*Q15*/ - const float interpol_frac_mid_relaxprev_pred_12k8[NB_SUBFR*3] = { 0.15f, 0.70f, 0.15f, 0.05f, 0.65f, 0.30f, 0.00f, 0.50f, 0.50f, 0.00f, 0.0f, 1.00f }; + const Word16 interpol_frac_mid_relaxprev_pred_12k8_fx[NB_SUBFR * 3] = { 4915, 22938, 4915,//Q15 1638, 21299, 9830, 0, 16384, 16384, 0, 0, 32767 }; - const float interpol_frac_mid_relaxprev_16k[NB_SUBFR16k*3] = { 0.0f, 0.7f, 0.3f, 0.0f, 0.0f, 1.0f, @@ -2736,6 +2762,7 @@ const float interpol_frac_mid_relaxprev_16k[NB_SUBFR16k*3] = { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f }; + const Word16 interpol_frac_mid_relaxprev_16k_fx[NB_SUBFR16k * 3] = { 0, 22938, 9830,//Q15 0, 0, 32767, 0, 0, 32767, @@ -2743,7 +2770,6 @@ const Word16 interpol_frac_mid_relaxprev_16k_fx[NB_SUBFR16k * 3] = { 0, 22938, 9 0, 0, 32767 };/*Q15*/ - const float interpol_frac_mid_16k_FEC[NB_SUBFR16k*3] = { 0.4f, 0.40f, 0.2f, 0.0f, 0.80f, 0.20f, @@ -2751,6 +2777,7 @@ const float interpol_frac_mid_16k_FEC[NB_SUBFR16k*3] = { 0.0f, 0.15f, 0.85f, 0.0f, 0.00f, 1.00f }; + const Word16 interpol_frac_mid_16k_FEC_fx[NB_SUBFR16k * 3] = { 13107, 13107, 6554,//Q15 0, 26214, 6554, 0, 21299, 11469, @@ -2765,6 +2792,7 @@ const float interpol_frac_mid_relaxprev_pred_16k[NB_SUBFR16k*3] = { 0.00f, 0.15f, 0.85f, 0.00f, 0.0f, 1.00f }; + const Word16 interpol_frac_mid_relaxprev_pred_16k_fx[NB_SUBFR16k * 3] = { 4915, 22938, 4915,//Q15 1638, 21299, 9830, 0, 16384, 16384, @@ -2903,7 +2931,6 @@ const uint32_t pulsestostates[17][9] = /*----------------------------------------------------------------------------------* * Gain quantization table for memory-less gain quantizer *----------------------------------------------------------------------------------*/ - const float gain_qua_mless_7b[128*2] = { 0.0256f, 0.0555f, @@ -3035,6 +3062,7 @@ const float gain_qua_mless_7b[128*2] = 1.2210f, 0.7314f, 1.2298f, 1.0376f }; + const Word16 gain_qua_mless_7b_fx[128*2] = {//Q14 419, 28, @@ -3166,6 +3194,7 @@ const Word16 gain_qua_mless_7b_fx[128*2] = 20005, 374, 20149, 531, }; + const float gain_qua_mless_6b_stereo[64*2]= { 0.034851F,1.358887F, @@ -3369,6 +3398,7 @@ const float gain_qua_mless_6b[64*2] = 1.1893f, 1.0872f, 1.1911f, 0.6722f }; + const Word16 gain_qua_mless_6b_fx[64 * 2] = {//Q14 1676, 71, @@ -3436,6 +3466,7 @@ const Word16 gain_qua_mless_6b_fx[64 * 2] = 19485, 557, 19515, 344, }; + const float gain_qua_mless_5b[32*2] = { 0.1645f, 0.2137f, @@ -3471,6 +3502,7 @@ const float gain_qua_mless_5b[32*2] = 1.1376f, 0.6895f, 1.1529f, 0.9632f }; + const Word16 gain_qua_mless_5b_fx[32 * 2] = {//Q14 2695, 109, @@ -3747,13 +3779,15 @@ const Word16 E_ROM_qua_gain7b_const[NB_QUA_GAIN7B * 2] = * MA predicition coefficients for gain quantizer *----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED const float pred_gain[GAIN_PRED_ORDER] = { 0.5f, 0.4f, 0.3f, 0.2f }; +#endif const Word16 pred_gain_fx[GAIN_PRED_ORDER] = { 8192, 6554, 4915, 3277 };//Q14 /*----------------------------------------------------------------------------------* * 6-bit gain quantization table (only for AMR-WB IO mode) *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float t_qua_gain6b[64*2] = { 0.095577f, 0.650507f, @@ -3821,6 +3855,8 @@ const float t_qua_gain6b[64*2] = 1.187154f, 4.421983f, 1.243327f, 7.268204f }; +#endif + const Word16 t_qua_gain6b_fx[64 * 2] = {//Q14 1566, 1332, @@ -3893,7 +3929,7 @@ const Word16 t_qua_gain6b_fx[64 * 2] = /*----------------------------------------------------------------------------------* * 7-bit gain quantization table (only for AMR-WB IO mode) *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float t_qua_gain7b[128*2] = { 0.012445f, 0.215546f, @@ -4025,6 +4061,8 @@ const float t_qua_gain7b[128*2] = 1.223150f, 1.387102f, 1.296012f, 9.684225f }; +#endif + const Word16 t_qua_gain7b_fx[128 * 2] = {//Q14 204, 441, @@ -4160,7 +4198,6 @@ const Word16 t_qua_gain7b_fx[128 * 2] = /*----------------------------------------------------------------------------------* * Quantization table for scaled innovation energy prediciton *----------------------------------------------------------------------------------*/ - const float Es_pred_qua_5b[32] = { -8.0000f, @@ -4196,6 +4233,7 @@ const float Es_pred_qua_5b[32] = 59.9748f, 65.0000f }; + const Word16 Es_pred_qua_5b_fx[32] = {//Q8 -2048, @@ -4232,7 +4270,6 @@ const Word16 Es_pred_qua_5b_fx[32] = 16640, }; - const float Es_pred_qua_4b[16] = { -8.0000f, @@ -4252,6 +4289,7 @@ const float Es_pred_qua_4b[16] = 58.0552f, 65.0000f }; + const Word16 Es_pred_qua_4b_fx[16] = {//Q8 -2048, @@ -4273,7 +4311,6 @@ const Word16 Es_pred_qua_4b_fx[16] = 16640 }; - const float Es_pred_qua_3b[8] = { 5.9422f, @@ -4285,6 +4322,7 @@ const float Es_pred_qua_3b[8] = 50.2442f, 58.7164f }; + const Word16 Es_pred_qua_3b_fx[8] = { 1521/* 5.9422f Q8*/, @@ -4316,6 +4354,7 @@ const float Es_pred_qua_4b_no_ltp[16] = 65.f, 70.f }; + const Word16 Es_pred_qua_4b_no_ltp_fx[16] = { -1280/*-5.f Q8*/, @@ -4343,6 +4382,7 @@ const float b_1sfr[2] = { 2.36736f, -0.22452f }; + const Word16 b_1sfr_fx[2] = /*Q12 */ { 9697, -920 @@ -4352,6 +4392,7 @@ const float b_2sfr[4] = { -0.00027f, 0.01703f, 0.91879f, 0.13234f }; + const Word16 b_2sfr_fx[4] = /*Q12 */ { -1, 70, 3763, 542 @@ -4361,11 +4402,11 @@ const float b_3sfr[6] = { -0.11658f, 0.02674f, 0.13513f, 0.79682f, 0.02241f, 0.17815f }; + const Word16 b_3sfr_fx[6] =//Q12 { -478, 110, 553, 3264, 92, 730 }; - const float b_4sfr[8] = { -0.09296f, 0.01578f, -0.06606f, 0.20416f, 0.79254f, 0.00829f, 0.03499f, 0.15859f @@ -6506,7 +6547,6 @@ const Word16 gp_gamma_4sfr_6b_fx[2 * 64] = /*Q14/Q9 */ /*----------------------------------------------------------------------------------* * Transition coding - gain quantization table *----------------------------------------------------------------------------------*/ - const float tbl_gain_code_tc[N_GAIN_CODE_TC] = { 0.36201f, @@ -6518,6 +6558,7 @@ const float tbl_gain_code_tc[N_GAIN_CODE_TC] = 2.0743f, 3.3301f }; + const Word16 tbl_gain_code_tc_fx[N_GAIN_CODE_TC] = /*q13 */ { 2966, @@ -6537,7 +6578,7 @@ const Word16 tbl_gain_code_tc_quant_mean[N_GAIN_CODE_TC - 1] = /*-----------------------------------------------------------------* * Transition coding - gain quantization table for g_trans *-----------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float tbl_gain_trans_tc[N_GAIN_TC] = { 35.8449f, @@ -6549,6 +6590,7 @@ const float tbl_gain_trans_tc[N_GAIN_TC] = 819.6746f, 1500.0f }; +#endif const Word16 tbl_gain_trans_tc_fx[N_GAIN_TC] = { 4588, 11109, 19212, 29862,/*<- Q7 @@ -6557,7 +6599,6 @@ Q4 ->*/ 5536, 8184, 13115, 24000 /*-----------------------------------------------------------------* * Transition coding - table of prototype glottal impulses *-----------------------------------------------------------------*/ - const float glottal_cdbk[L_IMPULSE*NUM_IMPULSE] = { /* impulse 0 */ @@ -6593,6 +6634,7 @@ const float glottal_cdbk[L_IMPULSE*NUM_IMPULSE] = -0.3975f, 0.2925f, 0.9839f, 0.6334f, -0.0121f, -0.0045f, 0.1349f, -0.0815f, -0.1751f, -0.0072f, -0.0099f }; + const Word16 Glottal_cdbk_fx[L_IMPULSE*NUM_IMPULSE] = /*Q13*/ { /* impulse 0 */ @@ -6639,7 +6681,7 @@ const Word16 Glottal_cdbk_fx[L_IMPULSE*NUM_IMPULSE] = /*Q13*/ /*----------------------------------------------------------------------------------* * AMR-WB IO WB BWE - deemphasis *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float deem_tab[56] = { 0.630730419421360f, 0.629416164964296f, 0.628129905227103f, 0.626871385453679f, 0.625640357452226f, 0.624436579475560f, 0.623259816105156f, @@ -6651,6 +6693,7 @@ const float deem_tab[56] = 0.597360736860508f, 0.597067605984399f, 0.596796395803217f, 0.596547058296428f, 0.596319549358454f, 0.596113828780239f, 0.595929860232466f, 0.595767611250409f, 0.595627053220407f, 0.595508161367956f, 0.595410914747406f, 0.595335296233253f, 0.595281292513031f, 0.595248894081778f }; +#endif const Word16 deem_tab_fx[56] = {//Q15 20668, 20625, 20583, 20541, 20501, 20462, 20423, 20385, @@ -6662,7 +6705,7 @@ const Word16 deem_tab_fx[56] = 19527, 19522, 19518, 19514, 19510, 19508, 19506, 19505 }; - +#ifndef IVAS_FLOAT_FIXED const float filt_hp[56] = { 0.001610570549503f, 0.004682981184545f, 0.008349027644995f, 0.012654118680910f, 0.017642537255539f, 0.023357023549788f, @@ -6676,6 +6719,8 @@ const float filt_hp[56] = 0.899298867069991f, 0.916826276367851f, 0.933053294896263f, 0.947917712517199f, 0.961362480671352f, 0.973335999426038f, 0.983792375705577f, 0.992691651376520f }; +#endif + const Word16 filt_hp_fx[56] = {//Q15 53, 153, 274, 415, 578, 765, 978, 1217, 1483, 1778, 2102, @@ -6686,8 +6731,8 @@ const Word16 filt_hp_fx[56] = 29468, 30043, 30574, 31061, 31502, 31894, 32237, 32529 }; - /* table of values exp(-j*w*i) */ +#ifndef IVAS_FLOAT_FIXED const float exp_tab_q[34] = { 1.000000000000000f, -0.980785280403230f, 0.923879532511287f, -0.831469612302544f, @@ -6700,6 +6745,8 @@ const float exp_tab_q[34] = -0.831469612302543f, 0.707106781186542f, -0.555570233019599f, 0.382683432365084f, -0.195090322016126f, -0.000000000000005f }; +#endif + const Word16 exp_tab_q_fx[34] = /*Q14 */ { 16384, -16068, 15137, -13622, @@ -6713,6 +6760,7 @@ const Word16 exp_tab_q_fx[34] = /*Q14 */ -3195, 0 }; +#ifndef IVAS_FLOAT_FIXED const float exp_tab_p[34] = { 1.000000000000000f, -0.707106781186548f, -0.000000000000000f, 0.707106781186548f, @@ -6725,6 +6773,8 @@ const float exp_tab_p[34] = -0.707106781186548f, 0.000000000000000f, 0.707106781186549f, -1.000000000000000f, 0.707106781186547f, 0.000000000000000f }; +#endif + const Word16 exp_tab_p_fx[34] = /*Q14 */ { 16384, -11584, 0, 11585, @@ -6746,6 +6796,7 @@ const float HP_gain[16] = 0.342102050781250f, 0.372497558593750f, 0.408660888671875f, 0.453002929687500f, 0.511779785156250f, 0.599822998046875f, 0.741241455078125f, 0.998779296875000f }; + const Word16 HP_gain_fx[16] = {//Q15 3624, 4673, 5597, 6479, 7425, 8378, 9324, 10264, @@ -6784,7 +6835,6 @@ const float fir_6k_8k[31]= const float b_hp400[3] = { 0.893554687f, -1.787109375f, 0.893554687f }; const float a_hp400[3] = { 1.000000000f, 1.787109375f, -0.864257812f }; - /*----------------------------------------------------------------------------------* * 15th-order band-pass 6kHz to 7kHz FIR filter. * @@ -6793,7 +6843,6 @@ const float a_hp400[3] = { 1.000000000f, 1.787109375f, -0.864257812f }; * * gain = 4.0 *----------------------------------------------------------------------------------*/ - const float fir_6k_7k[31] = { -0.001005f, 0.001428f, 0.000965f, -0.000863f, -0.011296f, @@ -6804,6 +6853,7 @@ const float fir_6k_7k[31] = 0.034231f, -0.011296f, -0.000863f, 0.000965f, 0.001428f, -0.001005f }; + const Word16 fir_6k_7k_fx[31] = {//Q15 -32, 47, 32, -27, -369, @@ -7120,7 +7170,6 @@ const Word16 no_lead_p_fx[][MAX_NO_SCALES * 2] = // Q0 /*----------------------------------------------------------------------------------* * Enhacer - 2.0 - 6.4 kHz impulse response with phase dispersion in freq. domain *----------------------------------------------------------------------------------*/ - const float low_H_flt[L_SUBFR] = { 1.000300f, 0.999812f, 1.000125f, 0.999868f, 0.999879f, 0.999935f, 0.999838f, 0.999992f, 1.000076f, 0.626554f, 0.619763f, 0.603882f, 0.857647f, 0.997470f, -0.032403f, @@ -7129,6 +7178,7 @@ const float low_H_flt[L_SUBFR] = -0.229682f, -0.818972f, -0.322274f, 0.031800f, -0.591141f, -0.999439f, -0.074385f, 0.514882f, -0.797032f, -0.784999f, -0.779712f, -0.000028f, 0.000164f, 0.000029f, -0.000135f, -0.000047f, -0.000033f, -0.000080f, 0.000099f }; + const Word16 low_H[64] = /* (1Q14) */ { 16388, 16380, 16386, 16381, 16382, 16382, 16381, 16383, 16385, 10265, @@ -7154,7 +7204,6 @@ const Word16 low_H16k[80] = /* (1Q14) */ /*----------------------------------------------------------------------------------* * Enhancer - 3.2 - 6.4 kHz impulse response with phase dispersion in freq. domain *----------------------------------------------------------------------------------*/ - const float mid_H_flt[L_SUBFR] = { 0.999900f, 0.999848f, 1.000003f, 1.000048f, 1.000107f, 1.000242f, 1.000165f, 0.999909f, 1.000212f, 0.999933f, 1.000099f, 1.000100f, 1.000113f, 1.000018f, 0.999901f, 1.000267f, @@ -7163,6 +7212,7 @@ const float mid_H_flt[L_SUBFR] = -0.808928f, -0.422500f, 0.000219f, -0.000261f, -0.000086f, -0.000313f, 0.000080f, 0.000406f, 0.000351f, -0.000449f, -0.000065f, 0.000214f, -0.000254f, 0.000002f, -0.000090f, -0.000198f, 0.000193f }; + const Word16 mid_H[64] = /* (1Q14) */ { 16382, 16381, 16384, 16384, 16385, 16387, 16386, 16382, 16387, 16382, @@ -7191,7 +7241,7 @@ const Word16 mid_H16k[80] = /* (1Q14) */ * response : 0dB @ 50Hz, -6dB @ 500Hz, -45dB @ 1kHz) * filter parameters: fs/2=8000, fc=500, gain=1.0, n=16 *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float tab_hup_l[SIZ_TAB_HUP_L] = { -0.001246f, 0.002200f, -0.004791f, 0.009621f, -0.017685f, 0.031212f, -0.057225f, 0.135470f, 0.973955f, -0.103495f, 0.048663f, -0.027090f, 0.015280f, -0.008160f, @@ -7209,6 +7259,7 @@ const float tab_hup_s[SIZ_TAB_HUP_S] = -0.005772f, 0.087669f, 0.965882f, -0.048753f, -0.014793f, 0.214886f, 0.868791f, -0.065537f, -0.028507f, 0.374334f, 0.723418f, -0.060834f, -0.045567f, 0.550847f, 0.550847f, -0.045567f, -0.060834f, 0.723418f, 0.374334f, -0.028507f, -0.065537f, 0.868791f, 0.214886f, -0.014793f, -0.048753f, 0.965882f, 0.087669f, -0.005772f }; +#endif /*-------------------------------------------------------------------* * Bass post-filter @@ -7235,6 +7286,7 @@ const float filt_lp_16kHz[1+L_FILT16k] = 0.042378f, 0.034577f, 0.027022f, 0.020078f, 0.014031f, 0.009070f, 0.005276f, 0.002625f, 0.000999f, 0.000205f }; + const Word16 filt_lp_16kHz_fx[1 + L_FILT16k] = { 2340/*0.071410f Q15*/, 2308/*0.070433f Q15*/, 2214/*0.067568f Q15*/, 2064/*0.062999f Q15*/, @@ -8328,7 +8380,6 @@ const Word16 edct_table_160_16fx[160] =//Q15 /*----------------------------------------------------------------------------------* * Mean ISF vector for active signal (only for AMR-WB IO mode) *----------------------------------------------------------------------------------*/ - const float mean_isf_amr_wb[M] = { 288.411774f, @@ -8358,7 +8409,6 @@ const Word16 mean_isf_amr_wb_fx[M] =/*Qlog2(2.56)*/ /*----------------------------------------------------------------------------------* * Mean ISF vector for SID frames (only in AMR-WB IO mode) *----------------------------------------------------------------------------------*/ - const float mean_isf_noise_amr_wb[M] = { 186.625259f, @@ -8429,12 +8479,13 @@ const Word16 Indirect_dico1[SIZE_BK1] = // Q0 /*----------------------------------------------------------------------------------* * Initial LSF memory *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float lsf_init[16] = { 375.0, 750.0, 1125.0, 1500.0, 1875.0, 2250.0, 2625.0, 3000.0, 3375.0, 3750.0, 4125.0, 4500.0, 4875.0, 5250.0, 5625.0, 6000.0 }; +#endif const Word16 lsf_init_fx[16] = /*14Q1*1.28*/ { @@ -8444,7 +8495,6 @@ const Word16 lsf_init_fx[16] = /*14Q1*1.28*/ /*----------------------------------------------------------------------------------* * Gaussian codebook *----------------------------------------------------------------------------------*/ - const float gaus_dico[190] = { -0.0973f, -0.0306f, 0.1278f, -0.1138f, 0.0744f, -0.1606f, @@ -8544,6 +8594,7 @@ const float gaus_dico_swb[256] = 0.02153429f, 0.22880882f, -0.13646534f, 0.03881640f, -0.02896636f, 0.09774253f, -0.13509314f, -0.08713179f, 0.13485038f, 0.06968338f, 0.19561967f, 0.07884958f, -0.10365590f, -0.10321335f, -0.09081125f, -0.00147976f }; + const Word16 gaus_dico_swb_fx[256] = { /*Q15 */ @@ -8589,6 +8640,7 @@ const Word16 gaus_dico_swb_fx[256] = const Word16 freqTable[2] = {20, 40}; // Q0 /* SNR: 109.44, PHASE: 3.500000000000000 */ +#ifndef IVAS_FLOAT_FIXED const float CLDFB80_10_flt[100] = { 0.0000033382f, -0.0000023292f, -0.0000006582f, 0.0000001464f, -0.0000010899f, -0.0000009664f, @@ -9412,6 +9464,7 @@ const float LDQMF_60[] = { -0.0053142183f, -0.0046856776f, -0.0040914025f, -0.0035321070f, -0.0030089030f, -0.0025271603f, -0.0020749648f, -0.0016621647f, -0.0012705614f, -0.0008115423f }; +#endif #ifdef IVAS_FLOAT_FIXED /* SNR: 109.44, PHASE: 3.500000000000000 */ @@ -9743,6 +9796,7 @@ const Word32 rot_vec_ana_im_L60_fx[30] = // q = 29 }; #endif +#ifndef IVAS_FLOAT_FIXED const float rot_vec_delay_re_LDQMF[60] = { -0.7071067812f,0.7071067812f,0.7071067812f,-0.7071067812f,-0.7071067812f, @@ -9870,6 +9924,7 @@ const float rot_vec_ana_im_L60[30] = -0.9385945043f,-0.9725086932f,-1.0037573034f,-1.0322546845f,-1.0579227273f,-1.0806910775f, -1.1004973285f,-1.1172871929f,-1.1310146507f,-1.1416420760f,-1.1491403397f,-1.1534888896f, }; +#endif /*! * \brief CLDFB prototype filter @@ -10602,10 +10657,13 @@ const Word16 cldfb_scale_5_0ms[7] = 21581/*88.028412 Q8*/ /* 30 bands */ }; #endif + +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_re_L10[5] = { 0.1117172025f,0.1048929802f,0.0878011021f,0.0621146404f,0.0303479649f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_re_L10_fx[5] = @@ -10613,11 +10671,12 @@ const Word32 rot_vec_syn_re_L10_fx[5] = 239910864 ,225255952 ,188551424 ,133390176 ,65171760 , }; - +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_im_L10[5] = { -0.0043893808f,-0.0386970634f,-0.0692168078f,-0.0929611287f,-0.1076057667f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_im_L10_fx[5] = @@ -10625,11 +10684,13 @@ const Word32 rot_vec_syn_im_L10_fx[5] = -9426123 ,-83101312 ,-148641968 ,-199632496 ,-231081632 , }; +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_re_L16[8] = { 0.1117697258f,0.1090868144f,0.1022117580f,0.0914087610f,0.0770929766f,0.0598145523f, 0.0402374883f,0.0191141202f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_re_L16_fx[8] = @@ -10637,12 +10698,13 @@ const Word32 rot_vec_syn_re_L16_fx[8] = 240023664 ,234262144 ,219498080 ,196298816 ,165555904 ,128450776 ,86409352 ,41047260 , }; - +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_im_L16[8] = { -0.0027437928f,-0.0244962633f,-0.0453073563f,-0.0643773129f,-0.0809732855f,-0.0944575001f, -0.1043117660f,-0.1101573893f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_im_L16_fx[8] = @@ -10650,11 +10712,13 @@ const Word32 rot_vec_syn_im_L16_fx[8] = -5892250 ,-52605324 ,-97296808 ,-138249232 ,-173888800 ,-202845936 ,-224007808 ,-236561200 , }; +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_re_L20[10] = { 0.1117818477f,0.1100622363f,0.1056325273f,0.0986017949f,0.0891431591f,0.0774895228f, 0.0639278374f,0.0487920364f,0.0324548136f,0.0153184455f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_re_L20_fx[10] = @@ -10662,11 +10726,13 @@ const Word32 rot_vec_syn_re_L20_fx[10] = 240049696 ,236356848 ,226844128 ,211745744 ,191433472 ,166407488 ,137283984 ,104780104 ,69696184 ,32896112 , }; +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_im_L20[10] = { -0.0021951135f,-0.0196546216f,-0.0366301676f,-0.0527037574f,-0.0674796057f,-0.0805938822f, -0.0917236698f,-0.1005949163f,-0.1069891821f,-0.1107490191f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_im_L20_fx[10] = @@ -10674,12 +10740,14 @@ const Word32 rot_vec_syn_im_L20_fx[10] = -4713971 ,-42207980 ,-78662688 ,-113180456 ,-144911344 ,-173074048 ,-196975088 ,-216025936 ,-229757520 ,-237831712 , }; +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_re_L30[15] = { 0.1117938204f,0.1110284288f,0.1090465865f,0.1058700070f,0.1015334935f,0.0960845578f, 0.0895828996f,0.0820997524f,0.0737171032f,0.0645267939f,0.0546295156f,0.0441337048f, 0.0331543560f,0.0218117611f,0.0102301920f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_re_L30_fx[15] = @@ -10688,12 +10756,14 @@ const Word32 rot_vec_syn_re_L30_fx[15] = 158306272 ,138570240 ,117315992 ,94776408 ,71198440 ,46840400 ,21969170 , }; +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_im_L30[15] = { -0.0014634613f,-0.0131410805f,-0.0246747234f,-0.0359380248f,-0.0468075816f,-0.0571643048f, -0.0668947240f,-0.0758922305f,-0.0840582459f,-0.0913033015f,-0.0975480191f,-0.1027239802f, -0.1067744758f,-0.1096551279f,-0.1113343755f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_im_L30_fx[15] = @@ -10702,12 +10772,14 @@ const Word32 rot_vec_syn_im_L30_fx[15] = -180513712 ,-196072352 ,-209482768 ,-220598064 ,-229296448 ,-235482592 ,-239088752 , }; +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_re_L32[16] = { 0.1117949803f,0.1111221774f,0.1093792072f,0.1065828555f,0.1027600526f,0.0979476142f, 0.0921918867f,0.0855483010f,0.0780808384f,0.0698614146f,0.0609691872f,0.0514897932f, 0.0415145243f,0.0311394479f,0.0204644816f,0.0095924311f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_re_L32_fx[16] = @@ -10716,12 +10788,14 @@ const Word32 rot_vec_syn_re_L32_fx[16] = 167677328 ,150026240 ,130930336 ,110573488 ,89151760 ,66871456 ,43947140 ,20599588 , }; +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_im_L32[16] = { -0.0013719997f,-0.0123232174f,-0.0231557558f,-0.0337652916f,-0.0440496492f,-0.0539097846f, -0.0632507393f,-0.0719825548f,-0.0800211389f,-0.0872890758f,-0.0937163711f,-0.0992411265f, -0.1038101357f,-0.1073793965f,-0.1099145349f,-0.1113911364f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_im_L32_fx[16] = @@ -10730,6 +10804,7 @@ const Word32 rot_vec_syn_im_L32_fx[16] = -171844080 ,-187451856 ,-201254368 ,-213118704 ,-222930576 ,-230595504 ,-236039664 ,-239210640 , }; +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_re_L40[20] = { 0.1117980110f,0.1113672575f,0.1102498879f,0.1084527911f,0.1059870468f,0.1028678571f, @@ -10737,6 +10812,7 @@ const float rot_vec_syn_re_L40[20] = 0.0648252372f,0.0574784342f,0.0497772575f,0.0417691875f,0.0335035965f,0.0250314447f, 0.0164049658f,0.0076773447f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_re_L40_fx[20] = @@ -10746,6 +10822,7 @@ const Word32 rot_vec_syn_re_L40_fx[20] = 71948424 ,53754620 ,35229396 ,16486972 , }; +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_im_L40[20] = { -0.0010976097f,-0.0098657969f,-0.0185731583f,-0.0271660100f,-0.0355913742f,-0.0437973057f, @@ -10753,6 +10830,7 @@ const float rot_vec_syn_im_L40[20] = -0.0910916496f,-0.0958969739f,-0.1001110615f,-0.1037079311f,-0.1066654069f,-0.1089652549f, -0.1105932959f,-0.1115394925f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_im_L40_fx[20] = @@ -10762,6 +10840,7 @@ const Word32 rot_vec_syn_im_L40_fx[20] = -229062224 ,-234001104 ,-237497296 ,-239529232 , }; +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_re_L60[30] = { 0.1118010042f,0.1116094882f,0.1111120583f,0.1103100780f,0.1092057454f,0.1078020875f, @@ -10770,6 +10849,7 @@ const float rot_vec_syn_re_L60[30] = 0.0651229863f,0.0602774970f,0.0552667912f,0.0501046030f,0.0448050816f,0.0393827526f, 0.0338524782f,0.0282294165f,0.0225289799f,0.0167667930f,0.0109586494f,0.0051204690f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_re_L60_fx[30] = @@ -10780,6 +10860,7 @@ const Word32 rot_vec_syn_re_L60_fx[30] = 36006412 ,23533520 ,10996123 , }; +#ifndef IVAS_FLOAT_FIXED const float rot_vec_syn_im_L60[30] = { -0.0007317463f,-0.0065819559f,-0.0124141249f,-0.0182122676f,-0.0239604917f,-0.0296430418f, @@ -10788,6 +10869,7 @@ const float rot_vec_syn_im_L60[30] = -0.0908790221f,-0.0941627493f,-0.0971883830f,-0.0999476301f,-0.1024329276f,-0.1046374636f, -0.1065551956f,-0.1081808673f,-0.1095100227f,-0.1105390187f,-0.1112650350f,-0.1116860815f, }; +#endif /*Q31*/ const Word32 rot_vec_syn_im_L60_fx[30] = @@ -10798,12 +10880,14 @@ const Word32 rot_vec_syn_im_L60_fx[30] = -232316640 ,-235170976 ,-237380736 ,-238939840 ,-239844032 , }; - +#ifndef IVAS_FLOAT_FIXED const float bpf_weights_16[CLDFB_NO_COL_MAX] = { 1.000040f, 0.702561f, 0.208838f, 0.001553f, 0.001777f, 0.001370f, 0.000926f, 0.000554f, 0.000270f, 0.000080f, 0.000030f, 0.000082f, 0.000081f, 0.000052f, 0.000017f, 0.000016f }; +#endif + const Word16 bpf_weights_16_Fx[16] = { 16385/*0.500020f Q15*/, 23022/*0.702561f Q15*/, 6843/*0.208838f Q15*/, 51/*0.001553f Q15*/, @@ -10831,7 +10915,7 @@ const Word32 bpf_weights_16_ivas_fx_32[16] = /*-------------------------------------------------------------------* * LP CNG excitation details code book *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float CNG_details_codebook[64][NUM_ENV_CNG]= { { @@ -11155,6 +11239,7 @@ const float CNG_details_codebook[64][NUM_ENV_CNG]= 12.711823f,12.611643f,11.904738f,12.176199f } }; +#endif const Word16 CNG_details_codebook_fx[64][NUM_ENV_CNG] = /* Q6 */ { @@ -11227,14 +11312,18 @@ const Word16 CNG_details_codebook_fx[64][NUM_ENV_CNG] = /* Q6 */ * FD CNG *-------------------------------------------------------------------*/ -const int16_t d_array[SIZE_SCALE_TABLE_CN] = { 1, 2, 5, 8, 10, 15, 20, 30, 40, 60, 80, 120, 140, 160, 180, 220, 260, 300 }; +const Word16 d_array[SIZE_SCALE_TABLE_CN] = { 1, 2, 5, 8, 10, 15, 20, 30, 40, 60, 80, 120, 140, 160, 180, 220, 260, 300 }; +#ifndef IVAS_FLOAT_FIXED const float m_array_flt[SIZE_SCALE_TABLE_CN] = { 0.000f, 0.260f, 0.480f, 0.580f, 0.610f, 0.668f, 0.705f, 0.762f, 0.800f, 0.841f, 0.865f, 0.890f, 0.900f, 0.910f, 0.920f, 0.930f, 0.935f, 0.940f }; +#endif const Word16 m_array[SIZE_SCALE_TABLE_CN] = { 0/*0.000f Q15*/, 8520/*0.260f Q15*/, 15729/*0.480f Q15*/, 19005/*0.580f Q15*/, 19988/*0.610f Q15*/, 21889/*0.668f Q15*/, 23101/*0.705f Q15*/, 24969/*0.762f Q15*/, 26214/*0.800f Q15*/, 27558/*0.841f Q15*/, 28344/*0.865f Q15*/, 29164/*0.890f Q15*/, 29491/*0.900f Q15*/, 29819/*0.910f Q15*/, 30147/*0.920f Q15*/, 30474/*0.930f Q15*/, 30638/*0.935f Q15*/, 30802/*0.940f Q15*/ }; - +#ifndef IVAS_FLOAT_FIXED const float msQeqInvAv_thresh_flt[3] = { 0.01f, 0.03f, 0.05f }; +#endif const Word16 msQeqInvAv_thresh[3] = { 328/*0.01f Q15*/, 983/*0.03f Q15*/, 1638/*0.05f Q15*/ }; - +#ifndef IVAS_FLOAT_FIXED const float msNoiseSlopeMax_flt[4] = { 2.f, 1.6f, 1.3f, 1.1f }; +#endif const Word16 msNoiseSlopeMax[4] = { 32767/*2.f Q14*/, 26214/*1.6f Q14*/, 21299/*1.3f Q14*/, 18022/*1.1f Q14*/ }; @@ -11327,12 +11416,14 @@ const SCALE_SETUP scaleTable_cn_dirac[15] = { 2, 24400, 32000, /*-1.5f,*/ 6759/*0.4125375748 Q14*/ /*-1.5f*/, 6759 }, { 2, 32000,512001, /* 0.0f,*/ 0/*0.0000000000 Q14*/ /* 0.0f*/, 0 } }; +#ifndef IVAS_FLOAT_FIXED const float scaleTable_cn_only_amrwbio_flt[SIZE_SCALE_TABLE_CN_AMRWB][2] = { { ACELP_6k60, -4.0f }, { ACELP_8k85, -3.0f }, { ACELP_12k65, -2.0f } }; +#endif const Word16 scaleTable_cn_only_amrwbio[3][2] = { { ACELP_6k60, 24771/*1.5118864315 Q14*/ }, @@ -11391,7 +11482,6 @@ const Word16 /* segment inner DCT trunc_len */ cdk1_ivas_trunc_dct_cols_per_segm /* to get back to FDCNG VQ domain for segment S use : idct as follows */ /* cdk1r_vec[col, row] = cdk1r_tr_midQ_truncQ(col 1:24 ) + invScaleFQ * idctMat( cdk1_ivas_dct_sS_W8[1:col]<fftlen/2+1; j++) hs->fftSineTab[j] = (float)sin(2.0*EVS_PI*j/hs->fftlen); */ - +#ifndef IVAS_FLOAT_FIXED const float fftSineTab640[321] = { 0.0000000000000000000000000f, 0.0098173199221491814000000f, 0.0196336936205625530000000f, 0.0294481739401817320000000f, 0.0392598174512386320000000f, 0.0490676760673522950000000f, 0.0588708035647869110000000f, 0.0686682611703872680000000f, 0.0784590989351272580000000f, 0.0882423743605613710000000f, @@ -13701,6 +13792,7 @@ const float olapWinAna640[640] = 0.1351623386144638100000000f, 0.1282505095005035400000000f, 0.1213355958461761500000000f, 0.1144177615642547600000000f, 0.1074971556663513200000000f, 0.1005739644169807400000000f, 0.0936483591794967650000000f, 0.0867204889655113220000000f, 0.0797905325889587400000000f, 0.0728586539626121520000000f, 0.0659250169992446900000000f, 0.0589897930622100830000000f, 0.0520531460642814640000000f, 0.0451152473688125610000000f, 0.0381762608885765080000000f, 0.0312363542616367340000000f, 0.0242956969887018200000000f, 0.0173544511198997500000000f, 0.0104127889499068260000000f, 0.0034708750899881124000000f }; +#endif #ifdef IVAS_FLOAT_FIXED const Word32 olapWinAna512_fx[512] = { /* Q30 */ @@ -13856,6 +13948,7 @@ const Word32 olapWinAna640_fx[640] = { /* Q30 */ /* Synthesis windows for overlap-add */ /* for (j=0; jfftlen; j++) hs->olapWinSyn[j] = (float)sin(EVS_PI*((float)j+0.5f)/(float)(hs->fftlen); */ +#ifndef IVAS_FLOAT_FIXED const float olapWinSyn256[256] = { 0.0061358846f, @@ -14115,6 +14208,8 @@ const float olapWinSyn256[256] = 0.0184067299f, 0.0061358846f }; +#endif + const Word16 olapWinSyn256_fx[256] = {//Q15 201, 603, 1005, 1407, 1808, 2210, 2611, 3011, 3411, 3811, 4210, 4609, 5006, 5403, 5800, 6195, @@ -14135,6 +14230,7 @@ const Word16 olapWinSyn256_fx[256] = 6195, 5800, 5403, 5006, 4609, 4210, 3811, 3411, 3011, 2611, 2210, 1808, 1407, 1005, 603, 201 }; +#ifndef IVAS_FLOAT_FIXED const float olapWinSyn320[320] = { 0.0049087191000580788000000f, 0.0147256832569837570000000f, 0.0245412290096282960000000f, 0.0343544110655784610000000f, 0.0441642776131629940000000f, 0.0539698898792266850000000f, 0.0637703016400337220000000f, 0.0735645666718482970000000f, 0.0833517387509346010000000f, 0.0931308791041374210000000f, @@ -14170,6 +14266,7 @@ const float olapWinSyn320[320] = 0.1902734935283660900000000f, 0.1806263476610183700000000f, 0.1709618121385574300000000f, 0.1612807810306549100000000f, 0.1515842080116272000000000f, 0.1418730318546295200000000f, 0.1321481764316558800000000f, 0.1224105954170227100000000f, 0.1126612052321434000000000f, 0.1029009595513343800000000f, 0.0931307896971702580000000f, 0.0833516493439674380000000f, 0.0735644772648811340000000f, 0.0637702122330665590000000f, 0.0539698041975498200000000f, 0.0441641919314861300000000f, 0.0343543216586112980000000f, 0.0245411414653062820000000f, 0.0147255966439843180000000f, 0.0049086315557360649000000f }; +#endif const Word16 olapWinSyn320_fx[320] = {//Q15 @@ -14220,7 +14317,6 @@ const Word16 olapWinSyn320_fx[320] = /*-------------------------------------------------------------------* * 1nd stage, 1st split: ISF0 to ISF8 *-------------------------------------------------------------------*/ - const float dico1_isf[] = { 226.1477f, 422.2338f, 404.4563f, 152.3442f, 1.2553f, -102.5648f, -77.5073f, -32.1403f, 14.9134f, @@ -14772,7 +14868,6 @@ const Word16 dico1_isf_fx[] = /*-------------------------------------------------------------------* * 1nd stage, 2nd split: ISF9 to ISF15 *-------------------------------------------------------------------*/ - const float dico2_isf[] = { 530.1115f, 512.7983f, 443.8771f, 306.1447f, 171.2327f, 70.8250f, 56.8183f, @@ -15310,7 +15405,6 @@ const Word16 dico2_isf_fx[] = /*-------------------------------------------------------------------* * 2nd stage, 1st split: ISF0 to ISF2 *-------------------------------------------------------------------*/ - const float dico21_isf_46b[] = { 128.4688f, 159.8148f, 97.2755f, @@ -15451,7 +15545,6 @@ const Word16 dico21_isf_46b_fx[] = /*-------------------------------------------------------------------* * 2nd stage, 2nd split: ISF3 to ISF5 *-------------------------------------------------------------------*/ - const float dico22_isf_46b[] = { -49.5271f, 121.1295f, 16.4769f, @@ -15720,7 +15813,6 @@ const Word16 dico22_isf_46b_fx[] = /*-------------------------------------------------------------------* * 2nd stage, 3rd split: ISF6 to ISF8 *-------------------------------------------------------------------*/ - const float dico23_isf_46b[] = { -3.8995f, 58.9472f, 140.2168f, @@ -15989,7 +16081,7 @@ const Word16 dico23_isf_46b_fx[] = /*-------------------------------------------------------------------* * 2nd stage, 4th split: ISF9 to ISF11 *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float dico24_isf_46b[] = { -30.8071f, -34.8458f, -1.7377f, @@ -16025,6 +16117,7 @@ const float dico24_isf_46b[] = 21.0362f, -11.6205f, 9.0680f, 9.3252f, 52.8599f, 21.3451f }; +#endif /* ISF codebook - 46b, 2nd stage, 4th split (only in AMR-WB IO mode) */ const Word16 dico24_isf_46b_fx[] = @@ -16066,7 +16159,7 @@ const Word16 dico24_isf_46b_fx[] = /*-------------------------------------------------------------------* * 2nd stage, 1st split: ISF12 to ISF15 *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float dico25_isf_46b[] = { 65.8574f, 55.5896f, -46.5520f, 44.9019f, @@ -16102,6 +16195,7 @@ const float dico25_isf_46b[] = -81.6581f, 43.6873f, -8.6894f, -65.0775f, -35.4129f, -58.9663f, 65.8078f, -102.2045f }; +#endif /* ISF codebook - 46b, 2nd stage, 5th split (only in AMR-WB IO mode) */ const Word16 dico25_isf_46b_fx[] = @@ -16155,7 +16249,6 @@ const Word16 dico25_isf_46b_fx[] = /*-------------------------------------------------------------------* * 2nd stage, 1st split: ISF0 to ISF4 *-------------------------------------------------------------------*/ - const float dico21_isf_36b[] = { -20.3147f, -37.6762f, 82.8575f, 122.9161f, -28.4468f, @@ -16424,7 +16517,6 @@ const Word16 dico21_isf_36b_fx[] = /*-------------------------------------------------------------------* * 2nd stage, 2nd split: ISF5 to ISF8 *-------------------------------------------------------------------*/ - const float dico22_isf_36b[] = { -116.4826f, -2.3267f, 37.0276f, 11.9585f, @@ -16846,7 +16938,6 @@ const Word16 dico23_isf_36b_fx[] = /*-------------------------------------------------------------------* * 1st stage, 1st split: ISF0 to ISF1 *-------------------------------------------------------------------*/ - const float dico1_ns_28b[64*2] = { -105.0619f, -262.8448f, @@ -16987,7 +17078,6 @@ const Word16 dico1_ns_28b_fx[] = /*-------------------------------------------------------------------* * 1st stage, 2ndt split: ISF2 to ISF4 *-------------------------------------------------------------------*/ - const float dico2_ns_28b[64*3] = { -322.0252f, -345.3659f, -370.7835f, @@ -17128,7 +17218,6 @@ const Word16 dico2_ns_28b_fx[] = /*-------------------------------------------------------------------* * 1st stage, 3rd split: ISF5 to ISF7 *-------------------------------------------------------------------*/ - const float dico3_ns_28b[64*3] = { -314.4522f, -327.3454f, -302.2017f, @@ -17269,7 +17358,6 @@ const Word16 dico3_ns_28b_fx[] = /*-------------------------------------------------------------------* * 1st stage, 4th split: ISF8 to ISF11 *-------------------------------------------------------------------*/ - const float dico4_ns_28b[32*4] = { -303.1361f, -333.7803f, -347.8725f, -359.4826f, @@ -17346,7 +17434,6 @@ const Word16 dico4_ns_28b_fx[] = /*-------------------------------------------------------------------* * 1st stage, 5th split: ISF12 to ISF15 *-------------------------------------------------------------------*/ - const float dico5_ns_28b[32*4] = { -316.2941f, -343.3920f, -368.9643f, -99.0392f, @@ -17425,7 +17512,9 @@ const Word16 means_wb_31bits_ma_lsf[16] = { 818 /*319.5312f*1.28f Q1*/, 1403 /*5 const Word16 *lsf_means[2] = { means_wb_31bits_ma_lsf, means_nb_31bits_ma_lsf }; +#ifndef IVAS_FLOAT_FIXED const float * const lsf_means_float[2] = { means_wb_31bits_ma_lsf_float, means_nb_31bits_ma_lsf_float }; +#endif const lsp_unw_triplet_flt p16_gamma0_92to1_float[16] = { @@ -17507,6 +17596,7 @@ const lsp_unw_triplet p16_gamma0_94to1[16] = /* Q14 */ { -5473, 10245, 0 } }; +#ifndef IVAS_FLOAT_FIXED const float dico_lsf_abs_8b_flt[256*M] = { 377.3749f, 688.0079f, 1147.3799f, 1461.0438f, 1786.7794f, 2143.6711f, 2522.1946f, 2889.7402f, 3263.6023f, 3628.4624f, 4005.4351f, 4379.4170f, 4783.9556f, 5157.1753f, 5555.1797f, 5926.6816f, @@ -17766,6 +17856,8 @@ const float dico_lsf_abs_8b_flt[256*M] = 227.3320f, 323.2667f, 752.3189f, 1572.3750f, 1930.6083f, 2355.0117f, 2717.6223f, 2968.3215f, 3233.4026f, 3551.9622f, 3918.5608f, 4346.0190f, 4778.6880f, 5159.6172f, 5568.5566f, 5980.8086f, 307.9120f, 439.7297f, 660.0276f, 1243.3854f, 1532.3577f, 1796.3936f, 2437.3232f, 2691.4072f, 3030.3025f, 3524.1379f, 3771.7576f, 4083.2375f, 4601.1567f, 4963.4697f, 5434.8530f, 5942.8315f }; +#endif + const Word16 dico_lsf_abs_8b[256 * M] = /*14Q1*1.28*/ { 966, 1761, 2937, 3740, 4574, 5488, 6457, 7398, 8355, 9289, 10254, 11211, 12247, 13202, 14221, 15172, @@ -18026,6 +18118,7 @@ const Word16 dico_lsf_abs_8b[256 * M] = /*14Q1*1.28*/ 788, 1126, 1690, 3183, 3923, 4599, 6240, 6890, 7758, 9022, 9656, 10453, 11779, 12706, 13913, 15214 }; +#ifndef IVAS_FLOAT_FIXED const float lsf_cdk_nb_gc_stg1_flt[] = { -50.2820f, -20.3699f, -85.9016f, -168.2552f, -219.7203f, -228.3721f, -209.7385f, -115.7139f, -70.1936f, 2.9143f, 53.7331f, 204.0881f, 324.2565f, 283.0311f, 194.2415f, 55.6127f, @@ -18341,6 +18434,7 @@ const float * const lsf_codebook_flt[2][2][TCXLPC_NUMSTAGES] = { lsf_cdk_nb_vc_stg1_flt, lsf_cdk_nb_vc_stg2_flt, lsf_cdk_nb_vc_stg3_flt } } }; +#endif const Word16 lsf_cdk_nb_gc_stg1[] = /* 14Q1*1.28 */ { @@ -18654,6 +18748,7 @@ const Word16 lsf_offs_ivas[TCXLPC_NUMSTAGES] = { 0, 0, 6 }; // Q0 const Word16 lsf_dims[TCXLPC_NUMSTAGES] = { 16, 8, 12 }; // Q0 const Word16 lsf_offs[TCXLPC_NUMSTAGES] = { 0, 0, 4 }; // Q0 +#ifndef IVAS_FLOAT_FIXED const float lsf_ind_cdk_nb_gc_stg4_flt[] = { -33.5099f, -17.2439f, @@ -18691,6 +18786,7 @@ const float * const lsf_ind_codebook_flt[2][2][TCXLPC_IND_NUMSTAGES] = { { lsf_ind_cdk_wb_gc_stg4_flt }, { lsf_ind_cdk_wb_vc_stg4_flt } }, { { lsf_ind_cdk_nb_gc_stg4_flt }, { lsf_ind_cdk_nb_vc_stg4_flt } } }; +#endif const Word16 lsf_ind_cdk_nb_gc_stg4[] = /* 14Q1*1.28 */ { @@ -18739,7 +18835,7 @@ const Word16 min_distance_thr[2][2] = /* 14Q1*1.28 */ /* WB */ { 580, 580 }, /* NB */ {1000, 580 } }; - +#ifndef IVAS_FLOAT_FIXED const float lsf_q_diff_cb_8b_rf_flt[256*16] = { -49.142456f, 13.490689f, -21.704788f, 63.851589f, 17.341200f, 49.889275f, 4.535705f, -49.377617f, 12.881550f, 3.317029f, -45.874687f, -91.048477f, -159.075317f, -244.532806f, -208.950378f, -60.136238f, @@ -18999,6 +19095,7 @@ const float lsf_q_diff_cb_8b_rf_flt[256*16] = -19.139826f, 222.586807f, 160.578033f, 15.308187f, 37.928532f, 2.810670f, 89.260468f, 73.903893f, -14.074634f, 9.220748f, 52.358765f, 29.237804f, 68.572754f, 74.369972f, 135.163269f, 53.634529f, 27.498774f, 55.932766f, 90.594849f, 106.451241f, 66.339134f, 276.491119f, 112.921783f, 68.186401f, 34.717724f, 217.367447f, 183.300674f, 171.332642f, 233.111526f, 113.635857f, -94.105415f, 101.164040f }; +#endif const Word16 lsf_q_diff_cb_8b_rf[256 * 16] = /* Q6 */ { -3145, 863, -1389, 4087, 1110, 3193, 290, -3160, 824, 212, -2936, -5827, -10181, -15650, -13373, -3849, @@ -19262,12 +19359,13 @@ const Word16 lsf_q_diff_cb_8b_rf[256 * 16] = /* Q6 */ /*----------------------------------------------------------------------------------* * LSF quantization - Scaling factors *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED /* stable ISP vector */ const float stable_ISP[M] = { 0.9808f, 0.9239f, 0.8315f, 0.7071f, 0.5556f, 0.3827f, 0.1951f, 0.0f, -0.195f, -0.3826f, -0.5555f, -0.7071f, -0.8314f, -0.9238f, -0.9808f, 0.045f }; +#endif /* stable ISF vector */ const float stable_ISF[M] = @@ -19309,8 +19407,7 @@ const Word16 means_swb_cleanspeech_lsf25k6[16] = { 786, 1840, 2892, 3833, 4778, /* Length 16 vector in Scale = 2.56f */ const Word16 means_swb_cleanspeech_lsf32k0[16] = { 757, 1855, 2862, 3798, 4705, 5661, 6742, 7692, 8658, 9577, 10513, 11401, 12358, 13269, 14275, 15149 }; - - +#ifndef IVAS_FLOAT_FIXED /* An 16-by-1 matrix */ const float SVWB2_Ave[16] = { @@ -19352,21 +19449,6 @@ const float SVWB_Ave[16] = 325.0000f, 487.5000f, 761.3281f, 1204.2969f, 1613.6719f, 1998.8281f, 2413.6719f, 2760.5469f, 3128.1250f, 3485.1563f, 3857.4219f, 4195.7031f, 4603.5156f, 5023.4375f, 5456.2500f, 5878.1250f }; /* An 16-by-1 matrix */ -const float GEWB_Ave[16] = -{ - 289.8438f, 527.3438f, 919.5313f, 1365.2344f, 1736.7188f, 2131.2500f, 2513.2813f, 2863.6719f, 3245.7031f, 3600.7813f, 3962.8906f, 4314.0625f, 4703.9063f, 5102.7344f, 5508.2031f, 5899.6094f -}; -/* An 16-by-1 matrix */ -const float GEWB2_Ave[16] = -{ - 355.0781f, 696.4844f, 1260.5469f, 1735.5469f, 2220.7031f, 2676.1719f, 3123.4375f, 3560.9375f, 3989.4531f, 4399.6094f, 4869.1406f, 5372.6563f, 5894.5313f, 6364.4531f, 6883.2031f, 7302.7344f -}; -/* An 16-by-1 matrix */ -const float GENB_Ave[16] = -{ - 326.5625f, 525.0000f, 881.6406f, 1274.6094f, 1630.0781f, 1965.2344f, 2324.2188f, 2619.9219f, 2935.1563f, 3216.4063f, 3469.1406f, 3687.1094f, 4059.7656f, 4775.7813f, 5412.1094f, 5912.1094f -}; -/* An 16-by-1 matrix */ const float TRNB_Ave[16] = { 358.9844f, 521.4844f, 822.6563f, 1227.3438f, 1598.4375f, 1928.9063f, 2306.6406f, 2605.4688f, 2925.7813f, 3202.7344f, 3464.0625f, 3689.0625f, 4118.7500f, 4837.1094f, 5429.6875f, 5920.3125f @@ -19396,6 +19478,23 @@ const float AUWB2_Ave[16] = { 364.4531f, 681.6406f, 1187.5000f, 1623.8281f, 2101.1719f, 2535.1563f, 2986.7188f, 3408.2031f, 3848.4375f, 4269.5313f, 4771.0938f, 5330.8594f, 5883.5938f, 6366.0156f, 6889.0625f, 7331.2500f }; +#endif + +/* An 16-by-1 matrix */ +const float GEWB_Ave[16] = +{ + 289.8438f, 527.3438f, 919.5313f, 1365.2344f, 1736.7188f, 2131.2500f, 2513.2813f, 2863.6719f, 3245.7031f, 3600.7813f, 3962.8906f, 4314.0625f, 4703.9063f, 5102.7344f, 5508.2031f, 5899.6094f +}; +/* An 16-by-1 matrix */ +const float GEWB2_Ave[16] = +{ + 355.0781f, 696.4844f, 1260.5469f, 1735.5469f, 2220.7031f, 2676.1719f, 3123.4375f, 3560.9375f, 3989.4531f, 4399.6094f, 4869.1406f, 5372.6563f, 5894.5313f, 6364.4531f, 6883.2031f, 7302.7344f +}; +/* An 16-by-1 matrix */ +const float GENB_Ave[16] = +{ + 326.5625f, 525.0000f, 881.6406f, 1274.6094f, 1630.0781f, 1965.2344f, 2324.2188f, 2619.9219f, 2935.1563f, 3216.4063f, 3469.1406f, 3687.1094f, 4059.7656f, 4775.7813f, 5412.1094f, 5912.1094f +}; const Word16 SVWB2_Ave_fx[16] = { 998, 1488, 2682, 3823, 5084, 6305, 7485, 8686, 9861, 11004, 12339, 13664, 15088, 16330, 17663, 18754 }; // Q2.56 /* An 16-by-1 matrix */ @@ -19443,6 +19542,7 @@ const Word16 AUWB2_Ave_fx[16] = { 933, 1745, 3040, 4157, 5379, 6490, 7646, 8725, +#ifndef IVAS_FLOAT_FIXED /* An 16-by-1 matrix */ const float Predictor0[16] = { @@ -19488,6 +19588,7 @@ const float Predictor8[16] = { 0.75500f, 0.75500f, 0.75500f, 0.75000f, 0.75000f, 0.75000f, 0.73499f, 0.72751f, 0.72000f, 0.71301f, 0.72751f, 0.72751f, 0.71301f, 0.70499f, 0.70499f, 0.67499f }; +#endif /* Length 16 vector in Q = 15 */ const Word16 Predictor0_fx[16] = { 27361, 27361, 27361, 27197, 27197, 27197, 26378, 26460, 26214, 25985, 26460, 26460, 25985, 25723, 25723, 24740 }; @@ -19508,7 +19609,6 @@ const Word16 Predictor7_fx[16] = { 24347, 24084, 24347, 24347, 24347, 24084, 243 /* Length 16 vector in Q = 15 */ const Word16 Predictor8_fx[16] = { 24740, 24740, 24740, 24576, 24576, 24576, 24084, 23839, 23593, 23364, 23839, 23839, 23364, 23101, 23101, 22118 }; - /* An 16-by-16 matrix */ const float UVD_MA1[256] = { @@ -20272,12 +20372,14 @@ const Word16 CB_p_lsf[] = }; // Q0 +#ifndef IVAS_FLOAT_FIXED const float * const ModeMeans[] = {IANB_Ave, UVNB_Ave, SVNB_Ave, GENB_Ave, TRNB_Ave, AUNB_Ave, IAWB_Ave, UVWB_Ave, SVWB_Ave, GEWB_Ave, TRWB_Ave, AUWB_Ave, IAWB2_Ave, NULL, SVWB2_Ave, GEWB2_Ave, TRWB2_Ave, AUWB2_Ave }; const float * const Predictors[] = {Predictor6, NULL, Predictor1, Predictor3, NULL, Predictor6,Predictor5, NULL, Predictor0, Predictor2, NULL, Predictor5, Predictor7, NULL, Predictor8, Predictor4, NULL, Predictor7 }; +#endif const Word16 *const ModeMeans_fx[] = { IANB_Ave_fx, UVNB_Ave_fx, SVNB_Ave_fx, GENB_Ave_fx, TRNB_Ave_fx, AUNB_Ave_fx, IAWB_Ave_fx, UVWB_Ave_fx, SVWB_Ave_fx, GEWB_Ave_fx, TRWB_Ave_fx, AUWB_Ave_fx, IAWB2_Ave_fx, NULL, SVWB2_Ave_fx, GEWB2_Ave_fx, TRWB2_Ave_fx, AUWB2_Ave_fx }; //Qlog2(2.56) @@ -21036,6 +21138,7 @@ const float vals[NO_LEADERS][MAX_NO_VALS]= {2.5f, 1.5f, 0.5f, 0.0f}, {3.5f, 1.5f, 0.5f, 0.0f} }; + const Word16 vals_fx[NO_LEADERS][MAX_NO_VALS] = /*Q1 */ { {2, 0, 0, 0}, @@ -21145,7 +21248,7 @@ const Word16 no_vals_ind[NO_LEADERS][MAX_NO_VALS]= }; // Q0 -const int16_t C_VQ[LATTICE_DIM+1][LATTICE_DIM+1] = +const Word16 C_VQ[LATTICE_DIM+1][LATTICE_DIM+1] = { {1,0,0,0,0,0,0,0,0}, {1,1,0,0,0,0,0,0,0}, @@ -21192,7 +21295,6 @@ const Word16 pi0[] = }; // Q0 - const float pl_HQ[] = /* vectors in first layers */ { 1, 1, 0, 0, 0, 0, 0, 0, /* 112, 4, 28 */ @@ -21335,7 +21437,6 @@ const Word16 pl_par[] = /* 1 if even number of signs */ 0, 0, 0, 0, -1, 1, -1, 1, 0, 0, 0, 0, 0, 1, -1, 1, -1 }; // Q0 - const float scales[][MAX_NO_SCALES*2]= /* 2 subvectors */ { {1.528f, 0.000f, 0.000f, 1.532f, 0.000f, 0.000f, }, /* 14 */ @@ -22126,6 +22227,7 @@ const float sigma_MSLVQ[][16] = {97.1679688f, 101.0253906f, 104.3945313f, 110.4003906f, 108.7890625f, 107.4707031f, 97.8515625f, 92.6757813f, 79.1503906f, 81.6406250f, 77.1972656f, 108.8867188f, 212.2070313f, 198.8281250f, 47.4609375f, 35.3515625f }, {74.8535156f, 97.3632813f, 100.1464844f, 91.6992188f, 90.3808594f, 89.6484375f, 83.2031250f, 84.0820313f, 81.9335938f, 96.4355469f, 110.9863281f, 92.6757813f, 83.4960938f, 82.1289063f, 77.8808594f, 70.8984375f} }; + const Word16 sigma_MSLVQ_fx[][16] = {//Qlog2(2.56) {3}, @@ -23070,25 +23172,25 @@ const UWord8 no_lead_p_idx[][2] = { // Q0 { 8, 181}, }; -const int16_t min_lat_bits_SN[] = {-1, -1, 17, 12, 17, 17, -1, -1, 17, 12, 17, 17, -1, -1, 22, -1, 32, 26 }; +const Word16 min_lat_bits_SN[] = {-1, -1, 17, 12, 17, 17, -1, -1, 17, 12, 17, 17, -1, -1, 22, -1, 32, 26 }; //Q0 const Word16 min_lat_bits_SN_fx[] = { -1, -1, 17, 12, 17, 17, -1, -1, 17, 12, 17, 17, -1, -1, 22, -1, 32, 26 }; -const int16_t min_lat_bits_pred[] = {17, 18, 9, 15, -1, 21, 17, 14, 9, 15, -1, 21, 17, -1, 24, 26, -1, 26, 16}; +const Word16 min_lat_bits_pred[] = {17, 18, 9, 15, -1, 21, 17, 14, 9, 15, -1, 21, 17, -1, 24, 26, -1, 26, 16}; //Q0 const Word16 min_lat_bits_pred_fx[] = { 17, 18, 9, 15, -1, 21, 17, 14, 9, 15, -1, 21, 17, -1, 24, 26, -1, 26, 16 }; -const int16_t offset_lvq_modes_SN[] = {-1,-1,33,64,96, 129,-1,-1,12,43,79,109,-1,-1,137,-1,107,135, +const Word16 offset_lvq_modes_SN[] = {-1,-1,33,64,96, 129,-1,-1,12,43,79,109,-1,-1,137,-1,107,135, 112 }; /* CNG */ //Q0 const Word16 offset_lvq_modes_SN_fx[] = { -1,-1,26,51,77,96,-1,-1,12,36,66,90,-1,-1,105,-1,88,102,112 }; /* CNG */ -const int16_t offset_lvq_modes_pred[] = {119, 153, 31, 67, -1, 102, 126, 160, 0, 46, -1, 82, 146, -1, 175, 191, -1, 225, 203}; +const Word16 offset_lvq_modes_pred[] = {119, 153, 31, 67, -1, 102, 126, 160, 0, 46, -1, 82, 146, -1, 175, 191, -1, 225, 203}; //Qlog2(1.6) const Word16 offset_lvq_modes_pred_fx[] = { 74, 95, 15, 45, -1, 66, 81, 102, 0, 30, -1, 60, 88, -1, 109, 117, -1, 139, 124 }; -const int16_t offset_in_lvq_mode_SN[][21] = +const Word16 offset_in_lvq_mode_SN[][21] = { {0}, /* I NB */ {0,1,1,1,1,1,2,3,3,3,3,4,4,4,5}, /* UV NB*/ @@ -23205,6 +23307,7 @@ const Word16 FixBranch_tbl[4][4][N_STAGE_VQ - 4] = }; // Q0 /* Intra-Prediction */ +#ifndef IVAS_FLOAT_FIXED const float AR_IntraCoeff[N_STAGE_VQ-1][2][2] = { {{-0.292479f, 0.676331f}, {-0.422648f, 0.217490f}}, @@ -23226,6 +23329,7 @@ const float SN_IntraCoeff[N_STAGE_VQ-1][2][2] = {{ 0.005058f, 0.550614f}, {-0.006786f, 0.296984f}}, {{-0.023860f, 0.611144f}, {-0.162706f, 0.576228f}} }; +#endif const Word16 SN_IntraCoeff_fx[N_STAGE_VQ - 1][2][2] = /* Q15 */ { @@ -23249,13 +23353,17 @@ const Word16 AR_IntraCoeff_fx[N_STAGE_VQ - 1][2][2] = /* Q15 */ {{ 1226, 11040}, { -794, 6137}} }; +#ifndef IVAS_FLOAT_FIXED const float scale_ARSN[M] = {1.8307f, 1.8404f, 1.8009f, 1.7416f, 1.7240f, 1.7467f, 1.6106f, 1.6497f, 1.5702f, 1.5548f, 1.5745f, 1.6199f, 1.5633f, 1.5239f, 1.5796f, 1.5615f}; +#endif const Word16 scale_ARSN_fx[M] = /* Q14 */ { 29994, 30153, 29506, 28534, 28246, 28618, 26388, 27029, 25726, 25474, 25797, 26540, 25613, 24968, 25880, 25584 }; +#ifndef IVAS_FLOAT_FIXED const float scale_inv_ARSN[M] = {0.5462f, 0.5434f, 0.5553f, 0.5742f, 0.5800f, 0.5725f, 0.6209f, 0.6062f, 0.6369f, 0.6432f, 0.6351f, 0.6173f, 0.6397f, 0.6562f, 0.6331f, 0.6404f}; +#endif const Word16 scale_inv_ARSN_fx[M] = /* Q15 */ { @@ -23264,6 +23372,7 @@ const Word16 scale_inv_ARSN_fx[M] = /* Q15 */ }; /* TCVQ Codebook */ +#ifndef IVAS_FLOAT_FIXED const float AR_TCVQ_CB_SUB1[2][128][2] = { { @@ -23360,6 +23469,7 @@ const float AR_TCVQ_CB_SUB3[4][32][2] = {72.765700F,16.633700F,},{26.847700F,-102.3211F,},{104.45050F,-37.68410F,},{15.601300F,31.425000F,},{32.724900F,50.955400F,},{264.88060F,147.81980F,},{316.65590F,175.13690F,},{359.29350F,211.19690F,}, } }; +#endif const Word16 AR_TCVQ_CB_SUB1_fx[2][128][2] = /* x2.65 */ {//Qlog2(2.56) @@ -23451,7 +23561,7 @@ const Word16 AR_TCVQ_CB_SUB3_fx[4][32][2] = } }; - +#ifndef IVAS_FLOAT_FIXED const float SN_TCVQ_CB_SUB1[2][128][2] = { { @@ -23548,6 +23658,7 @@ const float SN_TCVQ_CB_SUB3[4][32][2] = {66.165600F,144.72830F,},{-183.0404F,-407.2658F,},{268.25850F,163.71400F,},{219.75790F,95.572100F,},{411.11030F,329.38500F,},{101.35990F,133.20170F,},{415.09750F,248.72830F,},{337.80520F,255.31020F,}, } }; +#endif const Word16 SN_TCVQ_CB_SUB1_fx[2][128][2] = {//Qlog2(2.56) @@ -23640,7 +23751,7 @@ const Word16 SN_TCVQ_CB_SUB3_fx[4][32][2] = } }; - +#ifndef IVAS_FLOAT_FIXED const float AR_SVQ_CB1[32][8] = { {-0.339000F, 1.5012220F, 6.1853590F, 1.6161480F, 17.3955550F, -42.95738F, 3.77089400F, 65.3032460F}, @@ -23696,6 +23807,7 @@ const float AR_SVQ_CB2[16][8] = {4.8071940F, -49.02123F, 4.8164340F, 21.801281F, 39.0447200F, -62.45168F, -33.871502F, -1.336098F}, {-2.572755F, -7.192194F, -2.623712F, -2.309371F, 14.2487590F, -21.16166F, 68.2372970F, -68.92265F}, }; +#endif const Word16 AR_SVQ_CB1_fx[32][8] = /* x2.56 */ {//Qlog2(2.56) @@ -23753,28 +23865,36 @@ const Word16 AR_SVQ_CB2_fx[16][8] = /* x2.56 */ { -7, -18, -7, -6, 36, -54, 175, -176, } }; - +#ifndef IVAS_FLOAT_FIXED const float W_DTX_HO[HO_HIST_SIZE] = { 0.2f, 0.16f, 0.128f, 0.1024f, 0.08192f, 0.065536f, 0.0524288f, 0.01048576f }; +#endif const Word16 W_DTX_HO_FX[HO_HIST_SIZE] = /* Q15 */ { 6554, 5243, 4194, 3355, 2684, 2147, 1718, 344 }; + +#ifndef IVAS_FLOAT_FIXED const float ENR_ATT[5] = { 1.7938412f, 1.3952098f, 1.0962363f, 0.9965784f, 0.9965784f }; +#endif + const Word16 ENR_ATT_fx[5] = /*Q8*/ { 459, 357, 281, 255, 255 }; + +#ifndef IVAS_FLOAT_FIXED const float HO_ATT[5] = { 0.5370318f, 0.6165950f, 0.6839116f, 0.7079458f, 0.7079458f }; +#endif const Word16 HO_ATT_FX[5] = /* Q15 */ { @@ -23788,6 +23908,7 @@ const Word16 uniform_model[] = { MAX_AR_FREQ, MAX_AR_FREQ / 2, 0 }; // Q0 * LSF quantization - mid-frame quantization tables *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED const float tbl_mid_gen_wb_2b[] = { 0.4656f, 0.6281f, 0.7148f, 0.6457f, 0.6442f, 0.5957f, 0.5953f, 0.5216f, 0.4722f, 0.4609f, 0.4141f, 0.3861f, 0.3809f, 0.3685f, 0.4144f, 0.7097f, @@ -23795,6 +23916,8 @@ const float tbl_mid_gen_wb_2b[] = 0.4828f, 0.4701f, 0.1855f, 0.2034f, 0.1897f, 0.1691f, 0.1876f, 0.1558f, 0.1762f, 0.1863f, 0.1950f, 0.1997f, 0.2279f, 0.2492f, 0.3031f, 0.2513f, 0.8591f, 0.9902f, 0.8941f, 0.8507f, 0.8395f, 0.8579f, 0.8529f, 0.8665f, 0.8549f, 0.8490f, 0.8456f, 0.8310f, 0.8161f, 0.7884f, 0.7167f, 0.7381f }; +#endif + const Word16 tbl_mid_gen_wb_2b_fx[] =//Q13 { 3814, 5145, 5856, 5290, 5277, 4880, 4877, 4273, 3868, 3776, 3392, 3163, 3120, 3019, 3395, 5814, @@ -23802,6 +23925,7 @@ const Word16 tbl_mid_gen_wb_2b_fx[] =//Q13 3955, 3851, 1520, 1666, 1554, 1385, 1537, 1276, 1443, 1526, 1597, 1636, 1867, 2041, 2483, 2059, 7038, 8112, 7324, 6969, 6877, 7028, 6987, 7098, 7003, 6955, 6927, 6808, 6685, 6459, 5871, 6047, }; +#ifndef IVAS_FLOAT_FIXED const float tbl_mid_gen_wb_4b[] = { 0.6754f, 0.6266f, 0.2594f, 0.4293f, 0.5988f, 0.6866f, 0.7737f, 0.8446f, 0.8367f, 0.7757f, 0.6525f, 0.4878f, 0.4399f, 0.6822f, 0.8499f, 0.9169f, @@ -23821,6 +23945,7 @@ const float tbl_mid_gen_wb_4b[] = 1.0371f, 1.1706f, 1.0188f, 0.9709f, 0.9345f, 0.9754f, 0.9875f, 1.0269f, 1.0413f, 1.0355f, 1.0280f, 1.0279f, 1.0333f, 1.0062f, 0.9397f, 0.8962f, 0.3767f, 0.3565f, 0.3735f, 0.3687f, 0.1498f, -0.0124f, -0.0510f, -0.1065f, -0.0239f, 0.1375f, 0.2156f, 0.3068f, 0.3234f, 0.4213f, 0.5425f, 0.2117f }; +#endif const Word16 tbl_mid_gen_wb_4b_fx[] = {//Q13 @@ -23842,6 +23967,7 @@ const Word16 tbl_mid_gen_wb_4b_fx[] = 3085, 2920, 3059, 3020, 1227, -101, -417, -872, -195, 1126, 1766, 2513, 2649, 3451, 4444, 1734 }; +#ifndef IVAS_FLOAT_FIXED const float tbl_mid_gen_wb_5b[] = { 0.7947f, 0.9837f, 0.8671f, 0.7440f, 0.7914f, 0.7161f, 0.7356f, 0.7865f, 0.8401f, 0.8431f, 0.8563f, 0.8033f, 0.6896f, 0.4937f, 0.3437f, 0.3075f, @@ -23877,6 +24003,8 @@ const float tbl_mid_gen_wb_5b[] = 0.0608f, 0.0258f, 0.3738f, 0.8259f, 0.8728f, 0.9939f, 0.9193f, 0.9188f, 0.9589f, 0.8421f, 0.8073f, 0.7910f, 0.6457f, 0.5261f, 0.6520f, 0.5040f, 0.3360f, 0.8495f, 0.8652f, 0.5642f, 0.3230f, 0.2924f, 0.2144f, 0.0397f, 0.0596f, 0.0316f, -0.0152f, -0.0704f, -0.0675f, 0.0751f, 0.0680f, 0.5636f }; +#endif + const Word16 tbl_mid_gen_wb_5b_fx[] = {//Q13 6510, 8058, 7103, 6095, 6483, 5866, 6026, 6443, 6882, 6907, 7015, 6581, 5649, 4044, 2816, 2519, @@ -23914,7 +24042,7 @@ const Word16 tbl_mid_gen_wb_5b_fx[] = }; - +#ifndef IVAS_FLOAT_FIXED const float tbl_mid_voi_wb_1b[] = { 0.5556f, 0.5614f, 0.5803f, 0.6146f, 0.6082f, 0.6382f, 0.6492f, 0.6840f, 0.6957f, 0.6899f, 0.6887f, 0.7039f, 0.7110f, 0.7170f, 0.7103f, 0.7392f, @@ -23975,6 +24103,8 @@ const float tbl_mid_voi_wb_5b[] = 0.4576f, 0.3876f, 0.1800f, 0.0838f, 0.2449f, 0.2391f, 0.1902f, 0.3734f, 0.6560f, 0.6120f, 0.2977f, 0.2925f, 0.3012f, 0.2707f, 0.1258f, 0.9602f, 0.2486f, 0.0856f, 0.0151f, 0.0339f, 0.0400f, 0.0309f, 0.0806f, 0.0645f, 0.1008f, 0.0578f, 0.0978f, 0.0977f, 0.1286f, 0.1623f, 0.0981f, 0.1181f }; +#endif + const Word16 tbl_mid_voi_wb_1b_fx[] = /* Q13*/ { 4551, 4599, 4754, 5035, 4982, 5228, 5318, 5603, 5699, 5652, 5642, 5766, 5825, 5874, 5819, 6056, @@ -24035,7 +24165,7 @@ const Word16 tbl_mid_voi_wb_5b_fx[] =//Q13 2037, 701, 124, 278, 328, 253, 660, 528, 826, 473, 801, 800, 1053, 1330, 804, 967, }; - +#ifndef IVAS_FLOAT_FIXED const float tbl_mid_unv_wb_4b[] = { 0.6335f, 0.3837f, 0.0061f, 0.3077f, 0.6323f, 0.7715f, 0.4749f, 0.4108f, 0.4372f, 0.4293f, 0.4158f, 0.3722f, 0.3496f, 0.1979f, 0.2359f, -0.1160f, @@ -24091,6 +24221,8 @@ const float tbl_mid_unv_wb_5b[] = 0.5444f, 0.5385f, 0.4809f, 0.5395f, 1.1487f, -0.3404f, -0.3082f, -0.3512f, -0.2280f, 0.3479f, 0.5481f, 0.4996f, 0.3860f, 0.4747f, 0.4639f, 0.4263f, 0.7822f, 1.0122f, 1.0295f, 1.0430f, 1.0629f, 1.1165f, 1.1447f, 1.1354f, 1.1063f, 1.0919f, 1.0188f, 0.9977f, 0.8758f, 0.8855f, 0.7471f, 0.9058f }; +#endif + const Word16 tbl_mid_unv_wb_4b_fx[] =//Q13 { 5190, 3143, 50, 2521, 5180, 6320, 3890, 3365, 3582, 3517, 3406, 3049, 2864, 1621, 1932, -950, @@ -24256,7 +24388,9 @@ const Word16 Da_nq[NB_LEADER+2] = const Word16 skip_bands_SWB_TBE[NUM_SHB_SUBFR+1] = {0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320}; /* bands for SWB TBE quantisation Q0*/ const Word16 skip_bands_WB_TBE[NUM_SHB_SUBFR/2+1] = {0, 10, 20, 30, 40, 50, 60, 70, 80}; /* bands for WB TBE quantisation Q0*/ +#ifndef IVAS_FLOAT_FIXED const float interpol_frac_shb_flt[NB_SUBFR*2] = { 0.7f, 0.3f, 0.4f, 0.6f, 0.1f, 0.9f, 0.0f, 1.0f }; +#endif const Word16 interpol_frac_shb[NB_SUBFR * 2] = { 22938, 9830, 13107, 19660, 3277, 29490, 0, 32767 /* Q15*/ @@ -24271,7 +24405,7 @@ const float AP2_STEEP[ALLPASSSECTIONS_STEEP] = const Word16 AP1_STEEP_FX[ALLPASSSECTIONS_STEEP] = { 1985, 14072, 26500 }; /*Q15 Format */ const Word16 AP2_STEEP_FX[ALLPASSSECTIONS_STEEP] = { 7230, 20838, 30852 }; /*Q15 Format */ - +#ifndef IVAS_FLOAT_FIXED const float cos_fb_exc[32] = { 9.536743164062500e-007f,9.353497034680913e-007f,8.810801546133007e-007f,7.929511980364623e-007f,6.743495646333031e-007f,5.298330165715015e-007f,3.649553264040151e-007f,1.860525884467279e-007f, @@ -24279,7 +24413,7 @@ const float cos_fb_exc[32] = -9.536743164062500e-007f,-9.353497034680913e-007f,-8.810801546133007e-007f,-7.929511411930434e-007f,-6.743495077898842e-007f,-5.298329597280826e-007f,-3.649552411388868e-007f,-1.860525173924543e-007f, 0.000000000000000e+000f,1.860527589769845e-007f,3.649554969342717e-007f,5.298331871017581e-007f,6.743496783201408e-007f,7.929513117233000e-007f,8.810802683001384e-007f,9.353497603115102e-007f }; - +#endif const Word16 cos_fb_exc_fx[32] = /* Q15 */ { /*Q35*/ @@ -24288,6 +24422,7 @@ const Word16 cos_fb_exc_fx[32] = /* Q15 */ -32768, -32138, -30274, -27246, -23170, -18205, -12540, -6393, 0, 6393, 12540, 18205, 23170, 27246, 30274, 32138, }; +const float STEPS[4] = { 0.00635f, 0.003175f, 0.0015875f, 0.00079375f}; const float recip_order[15] = { @@ -24296,8 +24431,7 @@ const float recip_order[15] = 0.1000000f, 0.0909091f, 0.0833333f, 0.0769231f, 0.0714286f }; -const float STEPS[4] = { 0.00635f, 0.003175f, 0.0015875f, 0.00079375f}; - +#ifndef IVAS_FLOAT_FIXED const float Hilbert_coeffs[4*NUM_HILBERTS][HILBERT_ORDER1+1] = { { 0.0f, 0.8740234375f, 0.0f, -1.87371826171875f, 0.0f, 1.0f}, /* num_Real[0] */ @@ -24309,6 +24443,7 @@ const float Hilbert_coeffs[4*NUM_HILBERTS][HILBERT_ORDER1+1] = { 1.0f, 0.0f, -1.45599365234375f, 0.0f, 0.46820068359375f, 0.0f}, /* den_Real[1] */ { 1.0f, 0.0f, -1.10711669921875f, 0.0f, 0.15289306640625f, 0.0f} /* den_Imag[1] */ }; +#endif const Word16 Hilbert_coeffs_fx[4 * NUM_HILBERTS][HILBERT_ORDER1 + 1] = /* Q14 */ { @@ -24324,11 +24459,13 @@ const Word16 Hilbert_coeffs_fx[4 * NUM_HILBERTS][HILBERT_ORDER1 + 1] = /* Q14 */ /* Overlap add window for SHB excitation used in analysis and synthesis */ +#ifndef IVAS_FLOAT_FIXED const float window_shb[L_SHB_LAHEAD]= /* sin, 1, sin */ { 4.618346E-02f, 1.381564E-01f, 2.289505E-01f, 3.177914E-01f, 4.039210E-01f, 4.866045E-01f, 5.651364E-01f, 6.388468E-01f, 7.071068E-01f, 7.693340E-01f, 8.249975E-01f, 8.736224E-01f, 9.147939E-01f, 9.481606E-01f, 9.734381E-01f, 9.904104E-01f, 9.989330E-01f, 1.000000e+000f, 1.000000e+000f, 1.000000e+000f }; +#endif const Word16 window_shb_fx[L_SHB_LAHEAD] = /*sin, 1, sin */ { @@ -24338,6 +24475,7 @@ const Word16 window_shb_fx[L_SHB_LAHEAD] = /*sin, 1, sin */ }; /* Upsampled overlap add window for SHB excitation used transition generation */ +#ifndef IVAS_FLOAT_FIXED const float window_shb_32k[2*L_SHB_LAHEAD]= { 4.618346E-02f, 9.216993E-02f, 1.381564E-01f, 1.835534E-01f, 2.289505E-01f, 2.733710E-01f, 3.177914E-01f, 3.608562E-01f, 4.039210E-01f, 4.452628E-01f, @@ -24345,6 +24483,8 @@ const float window_shb_32k[2*L_SHB_LAHEAD]= 8.249975E-01f, 8.493099E-01f, 8.736224E-01f, 8.942082E-01f, 9.147939E-01f, 9.314773E-01f, 9.481606E-01f, 9.607993E-01f, 9.734381E-01f, 9.819242E-01f, 9.904104E-01f, 9.946717E-01f, 9.989330E-01f, 9.994665E-01f, 1.000000e+000f, 1.000000e+000f, 1.000000e+000f, 1.000000e+000f, 1.000000e+000f, 1.000000e+000f }; +#endif + const Word16 window_shb_32k_fx[2 * L_SHB_LAHEAD] = { /*Q15(round) */ @@ -24355,6 +24495,7 @@ const Word16 window_shb_32k_fx[2 * L_SHB_LAHEAD] = }; /* Short overlap add window for SHB excitation used in anal and synth */ +#ifndef IVAS_FLOAT_FIXED const float subwin_shb[SHB_OVERLAP_LEN+1]= { 0.000000000f, 0.006155830f, 0.024471742f, 0.054496738f, 0.095491503f, @@ -24363,6 +24504,8 @@ const float subwin_shb[SHB_OVERLAP_LEN+1]= 0.853553391f, 0.904508497f, 0.945503262f, 0.975528258f, 0.993844170f, 1.000000000f }; +#endif + const Word16 subwin_shb_fx[SHB_OVERLAP_LEN + 1] = { /*Q15(round) */ @@ -24372,18 +24515,25 @@ const Word16 subwin_shb_fx[SHB_OVERLAP_LEN + 1] = 27969, 29639, 30982, 31966, 32566, 32767 }; + +#ifndef IVAS_FLOAT_FIXED const float window_wb[L_SHB_LAHEAD/4]=/* sin, 1 */ { 2.289505E-001f, 5.651364E-001f, 8.249975E-001f, 9.734381E-001f, 1.000000e+000f}; +#endif const Word16 window_wb_fx[L_SHB_LAHEAD / 4] =/*sin, 1 */ { 7502, 18518, 27034, 31898, 32767 }; /*Q15*/ /* Short overlap add window for SHB excitation used in anal and synth */ +#ifndef IVAS_FLOAT_FIXED const float subwin_wb[SHB_OVERLAP_LEN/2+1]= {0.00000000f, 0.15643448f, 0.30901700f, 0.45399052f, 0.58778524f, 0.70710677f, 0.80901700f, 0.89100653f, 0.95105654f, 0.98768836f, 1.0000000f}; +#endif + const Word16 subwin_wb_fx[SHB_OVERLAP_LEN / 2 + 1] = { 0, 5126, 10126, 14876, 19261, 23170, 26510, 29197, 31164, 32365, 32767 }; // Q15 /* Window for calculating SHB LPC coeffs */ +#ifndef IVAS_FLOAT_FIXED const float win_lpc_shb[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5/8]= { 0.0000337210f, 0.0001348794f, 0.0003034616f, 0.0005394449f, 0.0008427974f, 0.0012134782f, 0.0016514373f, 0.0021566156f, 0.0027289450f, 0.0033683483f, @@ -24414,6 +24564,7 @@ const float win_lpc_shb[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5/8]= 0.9872321612f, 0.9885031920f, 0.9897083316f, 0.9908474173f, 0.9919202956f, 0.9929268217f, 0.9938668599f, 0.9947402834f, 0.9955469743f, 0.9962868239f, 0.9969597324f, 0.9975656090f, 0.9981043719f, 0.9985759486f, 0.9989802753f, 0.9993172977f, 0.9995869701f, 0.9997892562f, 0.9999241288f, 0.9999915697f }; +#endif const Word16 win_lpc_shb_fx[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5 / 8] = { @@ -24444,6 +24595,7 @@ const Word16 win_lpc_shb_fx[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5 / 8] = 32753, 32760, 32765, 32767 }; +#ifndef IVAS_FLOAT_FIXED const float win_lpc_hb_wb[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5/32]= { 0.000171338f, 0.001541333f, 0.004277569f, 0.008372546f, 0.01381504f, 0.020590133f, 0.028679254f, 0.038060234f, @@ -24455,6 +24607,8 @@ const float win_lpc_hb_wb[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5/32]= 0.912063094f, 0.926320082f, 0.939408556f, 0.951292642f, 0.961939766f, 0.971320746f, 0.979409867f, 0.98618496f, 0.991627454f, 0.995722431f, 0.998458667f, 0.999828662f }; +#endif + const Word16 win_lpc_hb_wb_fx[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5 / 32] = {//Q15 17, 70, 157, 279, 435, 625, 849, 1106, @@ -24468,7 +24622,7 @@ const Word16 win_lpc_hb_wb_fx[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5 / 32] = 32611, 32698, 32751 }; - +#ifndef IVAS_FLOAT_FIXED const float ola_win_shb_switch_fold[L_SUBFR16k] = { 0.009817319f, 0.029448173f, 0.049067674f, 0.068668259f, 0.088242371f, 0.107782463f, 0.127281003f, 0.146730474f, @@ -24482,6 +24636,8 @@ const float ola_win_shb_switch_fold[L_SUBFR16k] = 0.954044402f, 0.959744037f, 0.965073672f, 0.970031253f, 0.974614869f, 0.978822751f, 0.982653279f, 0.986104976f, 0.989176510f, 0.991866698f, 0.994174502f, 0.996099033f, 0.997639549f, 0.998795456f, 0.999566309f, 0.999951809f }; +#endif + const Word16 ola_win_shb_switch_fold_fx[L_SUBFR16k] = {//Q15 322, 965, 1608, 2250, 2892, 3532, 4171, 4808, @@ -24497,6 +24653,7 @@ const Word16 ola_win_shb_switch_fold_fx[L_SUBFR16k] = }; /* Window for calculating whitening filter for SHB excitation */ +#ifndef IVAS_FLOAT_FIXED const float win_flatten[ L_FRAME16k/2]= { 9.57802E-05f, 0.000383084f, 0.000861802f, 0.00153175f, 0.002392671f, 0.003444236f, 0.004686042f, 0.006117614f, @@ -24520,6 +24677,8 @@ const float win_flatten[ L_FRAME16k/2]= 0.977164044f, 0.97999639f, 0.982644839f, 0.985108376f, 0.987386059f, 0.989477014f, 0.99138044f, 0.993095607f, 0.99462186f, 0.995958613f, 0.997105353f, 0.998061642f, 0.998827114f, 0.999401474f, 0.999784503f, 0.999976054f }; +#endif + const Word16 win_flatten_fx[L_FRAME16k / 2] = /*Q15 */ { 3, 13, 28, 50, 78, 113, 154, 200, 254, 313, @@ -24539,6 +24698,7 @@ const Word16 win_flatten_fx[L_FRAME16k / 2] = /*Q15 */ 31589, 31705, 31816, 31921, 32020, 32113, 32199, 32280, 32355, 32423, 32486, 32542, 32592, 32636, 32673, 32704, 32730, 32748, 32761, 32767 }; + const float win_flatten_4k[ L_FRAME16k/8]= { 0.000385482f, 0.003465772f, 0.00960736f, 0.018772382f, 0.030904332f, 0.045928413f, 0.063751996f, 0.084265194f, @@ -24547,6 +24707,7 @@ const float win_flatten_4k[ L_FRAME16k/8]= 0.673058529f, 0.709329869f, 0.744310621f, 0.777785117f, 0.809546975f, 0.839400373f, 0.867161255f, 0.892658465f, 0.915734806f, 0.936248004f, 0.954071587f, 0.969095668f, 0.981227618f, 0.99039264f, 0.996534228f, 0.999614518f }; + const Word16 win_flatten_4k_fx[L_FRAME16k / 8] = /*Q15 */ { 13, 114, 315, 615, 1013, 1505, 2089, 2761, @@ -24555,6 +24716,7 @@ const Word16 win_flatten_4k_fx[L_FRAME16k / 8] = /*Q15 */ 22055, 23243, 24390, 25486, 26527, 27505, 28415, 29251, 30007, 30679, 31263, 31755, 32153, 32453, 32654, 32755 }; +#ifndef IVAS_FLOAT_FIXED const float wb_bwe_lsfvq_cbook_8bit[256*6] = { 0.064311408f, 0.10468847f, 0.15634165f, 0.20375369f, 0.28696818f, 0.40275119f, @@ -24814,6 +24976,8 @@ const float wb_bwe_lsfvq_cbook_8bit[256*6] = 0.136313630f, 0.18429069f, 0.26984493f, 0.34070980f, 0.40759216f, 0.45475266f, 0.240476170f, 0.27948010f, 0.32327234f, 0.37258368f, 0.41532038f, 0.45744253f }; +#endif + const Word16 wb_bwe_lsfvq_cbook_8bit_fx[256 * 6] = {//Q15 2107, 3430, 5123, 6677, 9403, 13197, @@ -25074,7 +25238,7 @@ const Word16 wb_bwe_lsfvq_cbook_8bit_fx[256 * 6] = 7880, 9158, 10593, 12209, 13609, 14989, }; - +#ifndef IVAS_FLOAT_FIXED const float swb_tbe_lsfvq_cbook_8b_flt[256*LPC_SHB_ORDER] = { 0.052035f, 0.098557f, 0.128235f, 0.155222f, 0.187634f, 0.220354f, 0.248003f, 0.327378f, 0.416763f, 0.468886f, @@ -25334,6 +25498,7 @@ const float swb_tbe_lsfvq_cbook_8b_flt[256*LPC_SHB_ORDER] = 0.065840f, 0.126504f, 0.164612f, 0.196957f, 0.220935f, 0.267816f, 0.338526f, 0.391567f, 0.453372f, 0.479359f, 0.044781f, 0.115425f, 0.177337f, 0.247881f, 0.284229f, 0.319088f, 0.355269f, 0.403159f, 0.444401f, 0.467850f }; +#endif const Word16 swb_tbe_lsfvq_cbook_8b[256 * LPC_SHB_ORDER] = /* Q15 */ { 1705, 3230, 4202, 5086, 6148, 7221, 8127, 10728, 13656, 15364, @@ -25594,13 +25759,15 @@ const Word16 swb_tbe_lsfvq_cbook_8b[256 * LPC_SHB_ORDER] = /* Q15 */ 1467, 3782, 5811, 8123, 9314, 10456, 11641, 13211, 14562, 15331, }; - +#ifndef IVAS_FLOAT_FIXED const float wac_swb[LPC_SHB_ORDER + 1] = { 1.00030000f, 0.99972246f, 0.99889029f, 0.99750487f, 0.99556853f, 0.99308446f, 0.99005679f, 0.98649053f, 0.98239158f, 0.97776669f, 0.97262346f }; +#endif + const Word16 wac_swb_h[LPC_SHB_ORDER] = {//Q15 32758, @@ -25629,11 +25796,13 @@ const Word16 wac_swb_l[LPC_SHB_ORDER] = 30328 }; +#ifndef IVAS_FLOAT_FIXED const float lbr_wb_bwe_lsfvq_cbook_2bit[4*4] = {0.11829331f, 0.18065347f, 0.27315149f, 0.36268139f, 0.20006990f, 0.24350365f, 0.33066865f, 0.40078221f, 0.13430431f, 0.20694768f, 0.32580520f, 0.41176145f, 0.25797083f, 0.29579351f, 0.36694117f, 0.42482337f }; +#endif const Word16 lbr_wb_bwe_lsfvq_cbook_2bit_fx[4 * 4] = { @@ -25652,6 +25821,7 @@ const float wac[LPC_SHB_ORDER + 1] = { 1.000030000f, 0.999876638f, 0.987738783f }; +#ifndef IVAS_FLOAT_FIXED /* 5-bit TD SWB BWE temporal shaping codebook */ const float SHBCB_SubGain5bit[128] = { @@ -25688,6 +25858,8 @@ const float SHBCB_SubGain5bit[128] = -0.3547296f, -0.3050630f, -0.2355810f, -0.3526833f, -1.0319320f, -0.3646283f, -0.2706210f, -0.1999401f }; +#endif + const Word16 SHBCB_SubGain5bit_fx[128] = { /*Q14 */ @@ -25725,7 +25897,7 @@ const Word16 SHBCB_SubGain5bit_fx[128] = -16907, -5974, -4434, -3276, }; - +#ifndef IVAS_FLOAT_FIXED /* 5-bit TD WB BWE temporal shaping codebook */ const float HBCB_SubGain5bit[128] = { @@ -25762,6 +25934,8 @@ const float HBCB_SubGain5bit[128] = -6.772878f, -4.939885f, -7.817589f, -3.977276f, -2.728315f, -6.770474f, -8.485444f, -4.669493f }; +#endif + const Word16 HBCB_SubGain5bit_fx[128] = {//Q8 -15224, -17789, -9897, -5048, -456, -1232, -2238, -2782, @@ -25783,7 +25957,7 @@ const Word16 HBCB_SubGain5bit_fx[128] = }; - +#ifndef IVAS_FLOAT_FIXED /* 6 bit Quantizer table for SHB overall gain */ const float SHBCB_FrameGain64[64]= { @@ -25796,6 +25970,8 @@ const float SHBCB_FrameGain64[64]= 14.56494800f, 16.38657700f, 18.56994600f, 21.17650800f, 24.29317200f, 27.95810000f, 32.33308400f, 37.72507700f, 44.44091200f, 52.62181300f, 62.89529200f, 76.21739000f, 94.34608600f, 119.5521800f, 160.0594500f, 245.1366400f }; +#endif + const Word32 SHBCB_FrameGain64_fx[64] = { /* Q18 */ @@ -25810,6 +25986,7 @@ const Word32 SHBCB_FrameGain64_fx[64] = }; /* 4 bit Quantizer table for SHB overall gain */ +#ifndef IVAS_FLOAT_FIXED const float SHBCB_FrameGain16[16]= { 0.148650413f, @@ -25829,6 +26006,7 @@ const float SHBCB_FrameGain16[16]= 409.9269865f, 735.8126500f }; +#endif const Word32 SHBCB_FrameGain16_fx[16] = { @@ -25838,6 +26016,7 @@ const Word32 SHBCB_FrameGain16_fx[16] = }; /* 18th order elliptic Bandpass filter at 14.15 to 20 kHz sampled at 48 kHz b0,b1,b2,a0,a1,a2 */ +#ifndef IVAS_FLOAT_FIXED const float full_band_bpf_1[6][5] = { { 9.6362039055508E-02f, 9.7862105350605E-02f, 3.0245537519444E-02f, 9.7862105350605E-02f, 9.6362039055508E-02f}, @@ -25847,6 +26026,7 @@ const float full_band_bpf_1[6][5] = { 1.0000000000000E+00f, 1.8724727524876E+00f, 2.4558672940808E+00f, 1.6868952908597E+00f, 7.5556052044790E-01f}, { 1.0000000000000E+00f, 2.5823882989829E+00f, 3.2419903202957E+00f, 2.1041782509434E+00f, 6.8348510539492E-01f} }; +#endif const Word16 full_band_bpf_1_fx[6][5] = /*in Q13*/ { @@ -25859,6 +26039,7 @@ const Word16 full_band_bpf_1_fx[6][5] = /*in Q13*/ }; /* 12th order elliptic Bandpass filter at 16.3 to 19.8 kHz sampled at 48 kHz b0,b1,b2,a0,a1,a2 */ +#ifndef IVAS_FLOAT_FIXED const float full_band_bpf_2[6][5] = { { 6.0003889556380E-02f, 1.1128037231775E-01f, 1.1894140617207E-01f, 1.1128037231775E-01f, 6.0003889556380E-02f}, @@ -25868,6 +26049,7 @@ const float full_band_bpf_2[6][5] = { 1.0000000000000E+00f, 2.4858753840930E+00f, 3.3360972572945E+00f, 2.3002595115472E+00f, 8.4059566462167E-01f}, { 1.0000000000000E+00f, 2.8681737877693E+00f, 3.8085295994769E+00f, 2.5421873471575E+00f, 7.9182537841461E-01f} }; +#endif const Word16 full_band_bpf_2_fx[6][5] = /*in Q13*/ { @@ -25880,6 +26062,7 @@ const Word16 full_band_bpf_2_fx[6][5] = /*in Q13*/ }; /* 12th order elliptic Bandpass filter at 15.4 to 20.0 kHz sampled at 48 kHz b0,b1,b2,a0,a1,a2 */ +#ifndef IVAS_FLOAT_FIXED const float full_band_bpf_3[6][5] = { {7.4636437949154E-02f, 1.0834902081890E-01f, 8.7514468139390E-02f, 1.0834902081890E-01f, 7.4636437949154E-02f}, @@ -25889,6 +26072,7 @@ const float full_band_bpf_3[6][5] = {1.0000000000000E+00f, 2.2507856816983E+00f, 2.9756720931932E+00f, 2.0502894449026E+00f, 8.0167514850932E-01f}, {1.0000000000000E+00f, 2.7689100300130E+00f, 3.5940097427365E+00f, 2.3681560760262E+00f, 7.4233948915492E-01f} }; +#endif const Word16 full_band_bpf_3_fx[6][5] = /*in Q13*/ { @@ -25901,6 +26085,7 @@ const Word16 full_band_bpf_3_fx[6][5] = /*in Q13*/ }; /* 4-bit/3-bit TD SWB BWE differential LSF scalar quantizer tables */ +#ifndef IVAS_FLOAT_FIXED const float lsf_q_cb_4b[16] = { 0.01798018f, 0.02359377f, 0.02790103f, 0.03181538f, @@ -25916,14 +26101,19 @@ const float lsf_q_cb_3b[8] = }; const float * const lsf_q_cb[NUM_Q_LSF] = { lsf_q_cb_4b, lsf_q_cb_4b, lsf_q_cb_3b, lsf_q_cb_3b, lsf_q_cb_3b }; +#endif const Word16 lsf_q_cb_size[NUM_Q_LSF] = {16, 16, 8, 8, 8}; // Q0 const Word16 lsf_q_num_bits[NUM_Q_LSF] = { 4, 4, 3, 3, 3 }; // Q0 /* Tables for approximation of upper half of SWB LSFs */ +#ifndef IVAS_FLOAT_FIXED const float mirror_point_q_cb[MIRROR_POINT_Q_CB_SIZE] = { 0.01436178f, 0.02111641f, 0.02735687f, 0.03712105f }; +#endif + const Word16 mirror_point_q_cb_fx[MIRROR_POINT_Q_CB_SIZE] = { 471, 692, 896, 1216 }; // Q15 +#ifndef IVAS_FLOAT_FIXED const float lsf_grid[4][5] = { { 0.15998503f, 0.31215086f, 0.47349756f, 0.66540429f, 0.84043882f }, @@ -25933,6 +26123,7 @@ const float lsf_grid[4][5] = }; const float grid_smoothing[5] = { 0.2f, 0.35f, 0.5f, 0.75f, 0.8f }; +#endif const float allpass_poles_3_ov_2_flt[9] = { @@ -25959,6 +26150,7 @@ const Word16 allpass_poles_3_ov_2[9] = /* Q15 */ 14384, 32472 }; + const float decimate_3_ov_2_lowpass_num[3] = { 0.195271809895833f, @@ -25966,6 +26158,7 @@ const float decimate_3_ov_2_lowpass_num[3] = 0.195271809895833f }; + const Word16 decimate_3_ov_2_lowpass_num_fx[3] = /* Q15 */ { 6399, @@ -25991,7 +26184,7 @@ const Word16 decimate_3_ov_2_lowpass_den_fx[3] = /* Q15 */ /*------------------------------------------------------------------------------* * WB BWE tables *------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float F_2_5[64] = { 1.1606680f, 0.6594560f, @@ -26027,6 +26220,7 @@ const float F_2_5[64] = 18.706564f, 18.308905f, 23.010420f, 22.915377f }; +#endif const Word16 F_2_5_fx[64] = /*Q10 */ { 1189, 675, -5106, -5293, 10476, -12, 10860, 10026, @@ -26051,21 +26245,25 @@ const Word16 sqrt_swb_bwe_subband_fx_L1[SWB_FENV] = { 16384, 20066, 16384, 20066 const Word16 sqrt_swb_bwe_subband_fx_L2[SWB_FENV / 2] = { 25905, 25905, 25905, 25905, 28378, 28378, 32767 }; /*Q12 */ +const float smooth_factor[SWB_FENV-1] = {0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.0417f, 0.0417f, 0.0417f, 0.0417f, 0.03125f, 0.03125f}; +const float fb_smooth_factor[DIM_FB] = {0.03125f, 0.0250f, 0.015625f}; +#ifndef IVAS_FLOAT_FIXED +const float swb_inv_bwe_subband_width[SWB_FENV] = {0.0625f, 0.04167f, 0.0625f, 0.04167f, 0.0625f, 0.04167f, 0.0625f, 0.04167f, 0.04167f, 0.04167f, 0.04167f, 0.04167f, 0.03125f, 0.03125f}; +const float fb_inv_bwe_subband_width[DIM_FB] = {0.0250f, 0.0250f, 0.0125f}; +#endif const Word16 swb_bwe_subband[SWB_FENV+1] = {240, 256, 280, 296, 320, 336, 360, 376, 400, 424, 448, 472, 496, 528, 560}; // Q0 const Word16 fb_bwe_subband[DIM_FB + 1] = { 640, 680, 720, 800 }; // Q0 const Word16 fb_bwe_sm_subband[DIM_FB] = { 656, 696, 760 }; // Q0 -const float swb_inv_bwe_subband_width[SWB_FENV] = {0.0625f, 0.04167f, 0.0625f, 0.04167f, 0.0625f, 0.04167f, 0.0625f, 0.04167f, 0.04167f, 0.04167f, 0.04167f, 0.04167f, 0.03125f, 0.03125f}; const Word16 swb_inv_bwe_subband_width_fx[SWB_FENV] = { 2048,1365,2048,1365,2048,1365,2048,1365,1365,1365,1365,1365,1024,1024 };//Q15 const Word16 swb_bwe_sm_subband[SWB_FENV] = {248, 268, 288, 308, 328, 348, 368, 388, 412, 436, 460, 484, 512, 544}; // Q0 -const float smooth_factor[SWB_FENV-1] = {0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.0417f, 0.0417f, 0.0417f, 0.0417f, 0.03125f, 0.03125f}; const Word16 smooth_factor_fx[SWB_FENV - 1] = { 1638, 1638, 1638, 1638, 1638, 1638, 1638, 1366, 1366, 1366, 1366, 1024, 1024 };//Q15 const Word16 fb_bwe_subband_float[DIM_FB+1] = {640, 680, 720, 800}; // Q0 -const float fb_inv_bwe_subband_width[DIM_FB] = {0.0250f, 0.0250f, 0.0125f}; const Word16 fb_inv_bwe_subband_width_fx[DIM_FB] = { 819, 819, 409 };//Q15 const Word16 fb_bwe_sm_subband_float[DIM_FB] = {656, 696, 760}; // Q0 -const float fb_smooth_factor[DIM_FB] = {0.03125f, 0.0250f, 0.015625f}; const Word16 fb_smooth_factor_fx[DIM_FB] = { 1024, 819, 512 };//Q15 + +#ifndef IVAS_FLOAT_FIXED const float EnvCdbk11 [N_CB11 * DIM11] = { -8.6703f, 0.1116f, 4.5639f, 8.2950f, 8.5148f, 4.7195f, 2.8963f, @@ -26405,6 +26603,7 @@ const float EnvCdbk4th [N_CB4TH * DIM4TH] = -3.5645f, 0.2107f, -1.7811f, -2.7432f, -1.3301f, 3.6876f, 0.6120f, 0.3900f, }; +#endif const Word16 EnvCdbk11_fx[N_CB11 * DIM11] = /*Q8 */ { @@ -26746,6 +26945,7 @@ const Word16 EnvCdbk4th_fx[N_CB4TH * DIM4TH] = /*Q8 */ -341, 944, 157, 100, }; +#ifndef IVAS_FLOAT_FIXED const float EnvCdbkFB [N_CB_FB * DIM_FB] = { -16.6120f, -9.7056f, -7.3815f, @@ -26781,6 +26981,8 @@ const float EnvCdbkFB [N_CB_FB * DIM_FB] = 32.8420f, 38.8016f, 38.3823f, 7.4425f, 11.3804f, 9.7292f }; +#endif + const Word16 EnvCdbkFB_fx[N_CB_FB * DIM_FB] = /*Q7 */ { -2126, -1242, -945, @@ -26817,21 +27019,22 @@ const Word16 EnvCdbkFB_fx[N_CB_FB * DIM_FB] = /*Q7 */ 953, 1457, 1245 }; -const float Mean_env_fb[DIM_FB] = {13.75f, 6.29f, 3.70f}; const Word16 Mean_env_fb_fx[DIM_FB] = { 1760, 805, 473 }; /*Q8 */ -const float w_NOR[SWB_FENV] = {1.f,0.97826087f,0.957446809f,0.9375f,0.918367347f,0.9f,0.882352941f,0.865384615f,0.849056604f,0.833333333f,0.818181818f,0.803571429f,0.789473684f,0.775862069f}; const Word16 w_NOR_fx[SWB_FENV] = /*Q15 */ { 32767, 32056, 31374, 30720, 30093, 29491, 28913, 28357, 27822, 27307, 26810, 26331, 25869, 25423, }; -const float Mean_env[SWB_FENV] = {28.62f, 28.96f, 28.05f, 27.97f, 26.91f, 26.82f, 26.35f, 25.98f, 24.94f, 24.03f, 22.94f, 22.14f, 21.23f, 20.40f}; const Word16 Mean_env_fx[SWB_FENV] = /*Q8 */ { 7327, 7414, 7181, 7160, 6889, 6866, 6746, 6651, 6385, 6152, 5873, 5668, 5435, 5222, }; +#ifndef IVAS_FLOAT_FIXED +const float w_NOR[SWB_FENV] = {1.f,0.97826087f,0.957446809f,0.9375f,0.918367347f,0.9f,0.882352941f,0.865384615f,0.849056604f,0.833333333f,0.818181818f,0.803571429f,0.789473684f,0.775862069f}; +const float Mean_env_fb[DIM_FB] = {13.75f, 6.29f, 3.70f}; +const float Mean_env[SWB_FENV] = {28.62f, 28.96f, 28.05f, 27.97f, 26.91f, 26.82f, 26.35f, 25.98f, 24.94f, 24.03f, 22.94f, 22.14f, 21.23f, 20.40f}; const float Env_TR_Cdbk1 [N_CB_TR1 * DIM_TR1] = { 0.8936f, -9.1696f, @@ -27032,6 +27235,9 @@ const float Env_TR_Cdbk2 [N_CB_TR2 * DIM_TR2] = -0.0134f, 0.0015f }; +const float Mean_env_tr[5] = { 27.23f, 23.81f, 23.87f, 19.51f }; +#endif + const Word16 Env_TR_Cdbk1_fx[N_CB_TR1 * DIM_TR1] = /*Q8 */ { 229, -2347, @@ -27232,15 +27438,15 @@ const Word16 Env_TR_Cdbk2_fx[N_CB_TR2 * DIM_TR2] = /*Q8 */ -3, 0, }; -const float Mean_env_tr[5] = { 27.23f, 23.81f, 23.87f, 19.51f }; const Word16 Mean_env_tr_fx[5] = { 6971, 6095, 6111, 4995 }; /*Q8 */ - /*------------------------------------------------------------------------------* * LR MDCT SWB BWE coding tables *------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED const float gain_table_SWB_BWE[NB_SWB_SUBBANDS] = {-0.4f, 0.1f, 0.6f, 1.1f}; +#endif const Word16 gain_table_SWB_BWE_fx[NB_SWB_SUBBANDS] = { -6554/*-0.4f*/, 1638/*0.1f*/, 9830/*0.6f*/, 18022/*1.1f*/ }; /* Q14 */ @@ -27296,7 +27502,6 @@ const Word16 subband_search_offsets_16p4kbps_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB] /*------------------------------------------------------------------------------* * HQ core tables *------------------------------------------------------------------------------*/ - const float wscw16q15[] = { -1.0f, -0.999939f, -0.999878f, -0.999725f, -0.999573f, -0.999359f, -0.999084f, -0.99881f, @@ -27767,7 +27972,6 @@ const Word32 SQRT_DIM_fx[65] = /* sqrt(x) for x = 0, 1, ..., 64. in Q15 */ * HQ core tables for SWB signals *------------------------------------------------------------------------------*/ - const float window_8_16_32kHz[370] = { 0.00009609f, 0.00028765f, 0.00058708f, 0.00099202f, 0.00150079f, 0.00211209f, 0.00282484f, 0.00363808f, @@ -28124,7 +28328,6 @@ const float window_48kHz[1110] = 0.02774685f, 0.02338280f, 0.01896129f, 0.01446831f, 0.00987977f, 0.00514389f }; - const float short_window_8kHz[80] = { 0.01963369f, 0.05887080f, 0.09801714f, 0.13701234f, 0.17579628f, 0.21430915f, 0.25249158f, 0.29028468f, @@ -28430,7 +28633,6 @@ const Word16 env_stab_tp_fx[2][2] = /* Q15 */ {32735, 16384}, {33, 16384} }; - const float att_step[NB_G] = { 4.0000000f, 2.0000000f, 1.3333333f, 1.0000000f}; const Word16 att_step_fx[4] = /* Q=13 */ @@ -34439,13 +34641,13 @@ const Word16 sinc_fx[8][12] = /* sinc for warp/extrapolate, in Q14 */ /*----------------------------------------------------------------------------------* * Highrate SWB BWE tables *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float overlap_coefs_48kHz[NSV_OVERLAP*WIDTH_BAND] = { 0.30f, 0.34f, 0.36f, 0.39f, 0.42f, 0.44f, 0.46f, 0.475f, 0.49f, 0.51f, 0.54f, 0.57f, 0.62f, 0.72f, 0.83f, 0.95f }; const float overlap_coefs[NSV_OVERLAP*WIDTH_BAND] = { 0.2700f, 0.3060f, 0.3240f, 0.3510f, 0.3780f, 0.3960f, 0.4140f, 0.4275f, 0.4410f, 0.4590f, 0.4860f, 0.5130f, 0.5580f, 0.6480f, 0.7470f, 0.855f }; - +#endif const Word16 overlap_coefs_48kHz_fx[NSV_OVERLAP*WIDTH_BAND] = /* in Q15 */ { 9830, 11141, 11796, 12780, 13763, 14418, 15073, 15565, 16056, 16712, 17695, 18678, 20316, 23593, 27197, 31130 @@ -34456,6 +34658,7 @@ const Word16 overlap_coefs_fx[NSV_OVERLAP*WIDTH_BAND] = /* in Q15 */ 8847, 10027, 10617, 11502, 12386, 12976, 13566, 14008, 14451, 15041, 15925, 16810, 18285, 21234, 24478, 28017 }; +#ifndef IVAS_FLOAT_FIXED const float swb_hr_env_code1[NUM_ENVLOPE_CODE_HR1*2] = { 0.044983f, 0.041700f, @@ -34579,6 +34782,7 @@ const float swb_hr_env_code3[NUM_ENVLOPE_CODE_HR_TR*N_BANDS_TRANS_BWE_HR] = 10.845836f, 2.664596f, 11.724073f, 1.637023f }; +#endif const Word16 swb_hr_env_code1_fx[NUM_ENVLOPE_CODE_HR1 * 2] = /* in Q9 */ { diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h index 833ae46b6ab570b1e1209e2f7374e9e73b287014..961425a990091c612ee03cd5149c7e4cf1c43100 100644 --- a/lib_com/rom_com.h +++ b/lib_com/rom_com.h @@ -182,31 +182,35 @@ extern const Word16 dicnlg2[40]; // Q0 extern const Resampling_cfg resampling_cfg_tbl[]; /* table of resampling configurations */ extern const FrameSizeParams FrameSizeConfig[FRAME_SIZE_NB]; -extern const float h_high[]; /* HP filter for filtering random part of excitation in FEC */ -extern const Word16 h_high_fx[5]; // Q15 +#ifndef IVAS_FLOAT_FIXED +extern const float h_high[]; /* HP filter for filtering random part of excitation in FEC */ +#endif +extern const Word16 h_high_fx[5]; // Q15 +extern const Word16 sincos_t_fx[161]; // Q15 +extern const Word16 sincos_t_ext_fx[]; // Q15 #ifdef IVAS_FLOAT_FIXED extern const Word32 crit_bands_fx[]; -#endif // IVAS_FLOAT_FIXED -extern const float crit_bands[]; /* Table of critical bands */ -extern const float sincos_t[]; /* FFT - sinus and cosinus tables */ -extern const Word16 sincos_t_fx[161]; // Q15 +#endif // IVAS_FLOAT_FIXED +extern const float crit_bands[]; /* Table of critical bands */ +#ifndef IVAS_FLOAT_FIXED +extern const float sincos_t[]; /* FFT - sinus and cosinus tables */ +extern const float inter4_2[]; /* 1/4 resolution interpolation filter */ +#endif +extern const float LP_assym_window[]; /* Assymetric window for LP analysis @12.8kHz */ +extern const float LP_assym_window_16k[]; /* Assymetric window for LP analysis @16kHz */ +extern const float hamcos_window[]; /* Hamming-Cosinus window */ extern const float sincos_t_ext[]; -extern const Word16 sincos_t_ext_fx[]; // Q15 extern const float sincos_t_rad3[]; +extern const float grid50[]; /* Table of grid points for evaluating Chebyshev polynomials */ +extern const float grid40[]; /* Table of grid points for evaluating Chebyshev polynomials */ extern const Word16 sincos_t_rad3_fx[]; // Q15 extern const Word16 fft256_read_indexes[]; /* FFT Q0*/ -extern const float inter4_2[]; /* 1/4 resolution interpolation filter */ extern const Word16 inter4_2_fx_Q15[]; // Q15 /* 1/4 resolution interpolation filter */ extern const Word16 inter4_2_fx[]; extern const Word16 pitch_inter4_1[UP_SAMP * L_INTERPOL1 + 1]; /*1Q14*/ extern const Word16 pitch_inter4_2[PIT_FIR_SIZE2]; /*1Q14*/ -extern const float LP_assym_window[]; /* Assymetric window for LP analysis @12.8kHz */ -extern const float LP_assym_window_16k[]; /* Assymetric window for LP analysis @16kHz */ extern const Word16 Assym_window_W16fx[]; // Q15 extern const Word16 assym_window_16k_fx[]; // Q15 -extern const float hamcos_window[]; /* Hamming-Cosinus window */ -extern const float grid50[]; /* Table of grid points for evaluating Chebyshev polynomials */ -extern const float grid40[]; /* Table of grid points for evaluating Chebyshev polynomials */ #ifdef IVAS_FLOAT_FIXED extern const Word16 grid50_fx[( GRID50_POINTS - 1 ) / 2 - 1]; // Q15 extern const Word16 grid40_fx[( GRID40_POINTS - 1 ) / 2 - 1]; // Q15 @@ -240,38 +244,44 @@ extern const Word32 lag_window_16k_32[NUM_LAGW_STRENGTHS][16]; // Q31 extern const Word32 lag_window_25k6_32[NUM_LAGW_STRENGTHS][16]; // Q31 extern const Word32 lag_window_32k_32[NUM_LAGW_STRENGTHS][16]; // Q31 extern const Word32 lag_window_48k_32[16]; // Q31 -extern const float interpol_frac2[]; /* LPC interpolation coefficients for two-subframe mode */ -extern const float interpol_frac2_mid[]; /* LPC interpolation coefficients with mid-ISFs for two-subframe mode */ -extern const float interpol_frac_12k8[]; /* LPC interpolation coefficients */ extern const Word16 interpol_frac2_fx[]; // Q15 /* LPC interpolation coefficients for two-subframe mode */ extern const Word16 interpol_frac2_mid_fx[]; // Q15 /* LPC interpolation coefficients with mid-ISFs for two-subframe mode */ extern const Word16 interpol_frac_12k8_fx[]; // Q15 /* LPC interpolation coefficients */ extern const Word16 interpol_frac_fx[NB_SUBFR]; // Q15 -extern const float interpol_isp_amr_wb[]; /* LPC interpolation coefficients for AMR-WB interoperable mode */ +#ifndef IVAS_FLOAT_FIXED +extern const float interpol_frac2[]; /* LPC interpolation coefficients for two-subframe mode */ +extern const float interpol_frac_12k8[]; /* LPC interpolation coefficients */ +#endif +extern const float interpol_isp_amr_wb[]; /* LPC interpolation coefficients for AMR-WB interoperable mode */ +extern const float interpol_frac2_mid[]; /* LPC interpolation coefficients with mid-ISFs for two-subframe mode */ extern const Word16 interpol_isp_amr_wb_fx[]; // Q15 -extern const float interpol_frac_16k[]; /* LPC interpolation coefficients @ 16kHz */ -extern const Word16 interpol_frac_16k_fx[NB_SUBFR16k]; // Q15 -extern const float interpol_frac_mid[]; /* LPC interpolation coefficients with mid-ISFs */ -extern const Word16 interpol_frac_mid_fx[NB_SUBFR * 3]; // Q15 -extern const float interpol_frac_mid_16k[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz */ -extern const Word16 interpol_frac_mid_16k_fx[NB_SUBFR16k * 3]; // Q15 -extern const float interpol_frac_mid_relaxprev_12k8[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz - relaxed prev frame interp */ -extern const Word16 interpol_frac_mid_relaxprev_12k8_fx[NB_SUBFR * 3]; // Q15 -extern const float interpol_frac_mid_FEC[]; /* LPC interpolation coefficients with mid-ISFs - FEC */ -extern const Word16 interpol_frac_mid_FEC_fx[NB_SUBFR * 3]; // Q15 -extern const float interpol_frac_mid_relaxprev_16k[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz - relaxed prev frame interp */ -extern const Word16 interpol_frac_mid_relaxprev_16k_fx[NB_SUBFR16k * 3]; // Q15 -extern const float interpol_frac_mid_16k_FEC[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz - FEC */ -extern const Word16 interpol_frac_mid_16k_FEC_fx[NB_SUBFR16k * 3]; // Q15 +extern const float interpol_frac_16k[]; /* LPC interpolation coefficients @ 16kHz */ +extern const float interpol_frac_mid[]; /* LPC interpolation coefficients with mid-ISFs */ +extern const float interpol_frac_mid_16k[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz */ +extern const float interpol_frac_mid_relaxprev_12k8[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz - relaxed prev frame interp */ +extern const float interpol_frac_mid_FEC[]; /* LPC interpolation coefficients with mid-ISFs - FEC */ +extern const float interpol_frac_mid_relaxprev_16k[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz - relaxed prev frame interp */ +extern const float interpol_frac_mid_16k_FEC[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz - FEC */ extern const float interpol_frac_mid_relaxprev_pred_12k8[]; -extern const Word16 interpol_frac_mid_relaxprev_pred_12k8_fx[NB_SUBFR * 3]; // Q15 extern const float interpol_frac_mid_relaxprev_pred_16k[]; +extern const Word16 interpol_frac_16k_fx[NB_SUBFR16k]; // Q15 +extern const Word16 interpol_frac_mid_fx[NB_SUBFR * 3]; // Q15 +extern const Word16 interpol_frac_mid_16k_fx[NB_SUBFR16k * 3]; // Q15 +extern const Word16 interpol_frac_mid_relaxprev_12k8_fx[NB_SUBFR * 3]; // Q15 +extern const Word16 interpol_frac_mid_FEC_fx[NB_SUBFR * 3]; // Q15 +extern const Word16 interpol_frac_mid_relaxprev_16k_fx[NB_SUBFR16k * 3]; // Q15 +extern const Word16 interpol_frac_mid_16k_FEC_fx[NB_SUBFR16k * 3]; // Q15 +extern const Word16 interpol_frac_mid_relaxprev_pred_12k8_fx[NB_SUBFR * 3]; // Q15 extern const Word16 interpol_frac_mid_relaxprev_pred_16k_fx[NB_SUBFR16k * 3]; // Q15 +#ifndef IVAS_FLOAT_FIXED extern const float inter6_2[PIT_FIR_SIZE6_2]; +#endif +#ifdef IVAS_FLOAT_FIXED extern const Word16 pitch_inter6_2[PIT_FIR_SIZE6_2]; /*1Q14*/ +#endif extern const float inter4_2tcx2_flt[4][4]; extern const float inter6_2tcx2_flt[6][4]; @@ -292,16 +302,18 @@ extern const TCX_LTP_FILTER tcxLtpFilters[12]; extern const float gain_qua_mless_7b[]; /* Gain quantization - gain quantization table */ extern const float gain_qua_mless_6b_stereo[]; /* Gain quantization - gain quantization table in IVAS */ -extern const Word16 gain_qua_mless_6b_stereo_fx[]; // Q14 /* Gain quantization - gain quantization table in IVAS */ extern const float gain_qua_mless_6b[]; /* Gain quantization - gain quantization table */ extern const float gain_qua_mless_5b[]; /* Gain quantization - gain quantization table */ +extern const Word16 gain_qua_mless_6b_stereo_fx[]; // Q14 /* Gain quantization - gain quantization table in IVAS */ extern const Word16 gain_qua_mless_7b_fx[]; // Q14 extern const Word16 gain_qua_mless_6b_fx[]; // Q14 extern const Word16 gain_qua_mless_5b_fx[]; // Q14 -extern const float pred_gain[]; /* Gain quantization - MA predicition coefficients for gain quantizer */ -extern const float t_qua_gain6b[]; /* Gain quantization - gain quantization table for AMR-WB interoperable mode */ -extern const float t_qua_gain7b[]; /* Gain quantization - gain quantization table for AMR-WB interoperable mode */ +#ifndef IVAS_FLOAT_FIXED +extern const float pred_gain[]; /* Gain quantization - MA predicition coefficients for gain quantizer */ +extern const float t_qua_gain6b[]; /* Gain quantization - gain quantization table for AMR-WB interoperable mode */ +extern const float t_qua_gain7b[]; /* Gain quantization - gain quantization table for AMR-WB interoperable mode */ +#endif extern const Word16 pred_gain_fx[GAIN_PRED_ORDER]; // Q14 extern const Word16 t_qua_gain6b_fx[64 * 2]; // Q14 extern const Word16 t_qua_gain7b_fx[128 * 2]; // Q14 @@ -324,7 +336,6 @@ extern const Word16 b_2sfr_fx[]; // Q12 extern const Word16 b_3sfr_fx[]; // Q12 extern const Word16 b_4sfr_fx[]; // Q12 - extern const float gp_gamma_1sfr_8b[]; /* Gain quantization - gain quantization table for gain quantizer at 7.2 and 8.0 kbps */ extern const float gp_gamma_1sfr_7b[]; /* Gain quantization - gain quantization table for gain quantizer at 7.2 and 8.0 kbps */ @@ -354,39 +365,42 @@ extern const int16_t E_ROM_qua_gain7b_const[]; extern const float gain_qua_mless[]; +#ifndef IVAS_FLOAT_FIXED +extern const float tbl_gain_trans_tc[]; /* TC - gain quantization table for g_trans */ +#endif extern const float tbl_gain_code_tc[]; /* TC - code gain quantization table */ +extern const float glottal_cdbk[]; /* TC - table of prototype glottal impulses */ extern const Word16 tbl_gain_code_tc_fx[N_GAIN_CODE_TC]; // Q13 extern const Word16 tbl_gain_code_tc_quant_mean[N_GAIN_CODE_TC - 1]; // Q13 -extern const float tbl_gain_trans_tc[]; /* TC - gain quantization table for g_trans */ -extern const float glottal_cdbk[]; /* TC - table of prototype glottal impulses */ extern const Word16 tbl_gain_trans_tc_fx[]; // Q7/Q4 extern const Word16 Glottal_cdbk_fx[]; // Q13 extern const Word32 PI_select_table[23][8]; /* selection table for Pulse indexing Q0*/ -extern const int32_t PI_offset[8][8]; /* offset table for Pulse indexing Q0*/ +extern const Word32 PI_offset[8][8]; /* offset table for Pulse indexing Q0*/ extern const Word16 PI_factor[]; /* EVS_PI factor table for Pulse indexing Q0*/ /* ACELP pulse coding */ -extern const Word16 hi_to_low_tmpl[10]; // Q0 -extern const uint16_t low_len[10]; // Q0 -extern const uint16_t low_mask[10]; // Q0 -extern const uint16_t indx_fact[10]; // Q0 -extern const int16_t index_len[3]; // Q0 -extern const int16_t index_mask_ACELP[3]; // Q0 - - -extern const float deem_tab[]; /* HF BWE - de-emphasis coefficients */ -extern const Word16 deem_tab_fx[]; // Q15 +extern const Word16 hi_to_low_tmpl[10]; // Q0 +extern const UWord16 low_len[10]; // Q0 +extern const UWord16 low_mask[10]; // Q0 +extern const UWord16 indx_fact[10]; // Q0 +extern const Word16 index_len[3]; // Q0 +extern const Word16 index_mask_ACELP[3]; // Q0 + +#ifndef IVAS_FLOAT_FIXED +extern const float deem_tab[]; /* HF BWE - de-emphasis coefficients */ extern const float filt_hp[]; +extern const float exp_tab_p[]; /* HF BWE - Table of values exp(-j*w*i) */ +extern const float exp_tab_q[]; /* HF BWE - Table of values exp(-j*w*i) */ +#endif +extern const float fir_6k_8k[]; /* HF BWE - band-pass filter coefficients */ +extern const float HP_gain[]; /* HF BWE - quantization table for 23.85 */ +extern const Word16 deem_tab_fx[]; // Q15 extern const Word16 filt_hp_fx[]; // Q15 -extern const float exp_tab_p[]; /* HF BWE - Table of values exp(-j*w*i) */ extern const Word16 exp_tab_p_fx[]; // Q14 -extern const float exp_tab_q[]; /* HF BWE - Table of values exp(-j*w*i) */ extern const Word16 exp_tab_q_fx[]; // Q14 -extern const float HP_gain[]; /* HF BWE - quantization table for 23.85 */ extern const Word16 HP_gain_fx[]; // Q15 -extern const float fir_6k_8k[]; /* HF BWE - band-pass filter coefficients */ extern const float b_hp400[]; /* HF (6-7kHz) BWE - 400Hz HP filter coefficients */ extern const float a_hp400[]; /* HF (6-7kHz) BWE - 400Hz HP filter coefficients */ @@ -402,14 +416,16 @@ extern const Word16 low_H[64]; // Q14 extern const Word16 low_H16k[80]; // Q14 extern const Word16 mid_H[64]; // Q14 extern const Word16 mid_H16k[80]; // Q14 - extern const float filt_lp[1 + L_FILT]; -extern const Word16 filt_lp_fx[1 + L_FILT]; // Q15 + extern const float filt_lp_16kHz[1 + L_FILT16k]; +extern const Word16 filt_lp_fx[1 + L_FILT]; // Q15 extern const Word16 filt_lp_16kHz_fx[1 + L_FILT16k]; // Q15 +#ifndef IVAS_FLOAT_FIXED extern const float tab_hup_l[SIZ_TAB_HUP_L]; /* NB post-filter */ extern const float tab_hup_s[SIZ_TAB_HUP_S]; /* NB post-filter */ +#endif extern const float edct_table_80[]; /* EDCT */ extern const float edct_table_120[]; /* EDCT */ @@ -445,31 +461,34 @@ extern const Word16 edct_table_160_16fx[160]; // Q15 extern const Word16 edct_table_128_16fx[128]; // Q15 extern const Word16 edct_table_320_16fx[320]; // Q16 - -extern const int16_t crit_bins[]; /* (used only in AMR-WB IO mode) */ +#ifndef IVAS_FLOAT_FIXED extern const float crit_bins_corr[CRIT_NOIS_BAND]; -extern const Word16 crit_bins_corr_fx[]; // Q15 -extern const float crit_bands_loc[]; /* (used only in AMR-WB IO mode) */ -extern const Word16 crit_bands_loc_fx[]; // Q0 -extern const float mfreq_loc_LD[]; /* LD music post-filter */ -extern const Word16 mfreq_loc_LD_fx[]; // Q0 -extern const Word16 mfreq_bindiv_LD[]; // Q0 -extern const float post_dct_wind[OFFSET2]; -extern const Word16 post_dct_wind_fx[]; // Q15 +extern const float crit_bands_loc[]; /* (used only in AMR-WB IO mode) */ extern const float MAX_SNR_SNR1_tab[]; extern const float INV_MAX_SNR_tab[]; -extern const Word16 MAX_SNR_SNR1_tab_FX[MBANDS_GN_LD]; // Q14 -extern const Word16 INV_MAX_SNR_tab_FX[MBANDS_GN_LD]; // Q15 extern const float sc_qnoise[]; -extern const Word16 sc_qnoise_fx[]; // Q15 -extern const Word16 inv_mfreq_bindiv_LD_fx[]; // Q15 -extern const Word16 inv_mfreq_bindiv_LD_M1_fx[]; // Q15 -extern const float W_DTX_HO[HO_HIST_SIZE]; -extern const Word16 W_DTX_HO_FX[HO_HIST_SIZE]; // Q15 extern const float ENR_ATT[5]; -extern const Word16 ENR_ATT_fx[5]; // Q8 +extern const float W_DTX_HO[HO_HIST_SIZE]; +#endif +extern const float mfreq_loc_LD[]; /* LD music post-filter */ +extern const float post_dct_wind[OFFSET2]; +extern const int16_t crit_bins[]; /* (used only in AMR-WB IO mode) */ +extern const Word16 crit_bins_corr_fx[]; // Q15 +extern const Word16 crit_bands_loc_fx[]; // Q0 +extern const Word16 mfreq_loc_LD_fx[]; // Q0 +extern const Word16 mfreq_bindiv_LD[]; // Q0 +extern const Word16 post_dct_wind_fx[]; // Q15 +extern const Word16 MAX_SNR_SNR1_tab_FX[MBANDS_GN_LD]; // Q14 +extern const Word16 INV_MAX_SNR_tab_FX[MBANDS_GN_LD]; // Q15 +extern const Word16 sc_qnoise_fx[]; // Q15 +extern const Word16 inv_mfreq_bindiv_LD_fx[]; // Q15 +extern const Word16 inv_mfreq_bindiv_LD_M1_fx[]; // Q15 +extern const Word16 W_DTX_HO_FX[HO_HIST_SIZE]; // Q15 +extern const Word16 ENR_ATT_fx[5]; // Q8 +#ifndef IVAS_FLOAT_FIXED extern const float HO_ATT[5]; +#endif extern const Word16 HO_ATT_FX[5]; // Q15 extern const Word16 hq_swb_bwe_nb_bits[]; // Q0 @@ -477,27 +496,24 @@ extern const Word16 hq_swb_bwe_nb_bits[]; // Q0 /*----------------------------------------------------------------------------------* * ISF quantization (AMR-WB IO mode) *----------------------------------------------------------------------------------*/ -extern const Word16 Indirect_dico1[SIZE_BK1]; // Q0 +extern const float mean_isf_amr_wb[M]; /* Mean ISF vector (only in AMR-WB IO mode) */ +extern const float mean_isf_noise_amr_wb[]; /* Mean ISF vector for SID frame (only in AMR-WB IO mode) */ +extern const float gaus_dico[]; /* Gaussian codebook */ +extern const float gaus_dico_swb[]; /* Gaussian codebook for SWB TBE */ +extern const float dico1_isf[]; /* ISF codebook - common 1st stage, 1st split (only in AMR-WB IO mode) */ +extern const float dico2_isf[]; /* ISF codebook - common 1st stage, 2nd split (only in AMR-WB IO mode) */ -extern const float mean_isf_amr_wb[M]; /* Mean ISF vector (only in AMR-WB IO mode) */ +extern const Word16 Indirect_dico1[SIZE_BK1]; // Q0 extern const Word16 mean_isf_amr_wb_fx[M]; /*Qlog2(2.56)*/ /* Mean ISF vector (only in AMR-WB IO mode) */ -extern const float mean_isf_noise_amr_wb[]; /* Mean ISF vector for SID frame (only in AMR-WB IO mode) */ - extern const Word16 mean_isf_noise_amr_wb_fx[]; /*Qlog2(2.56)*/ /* Mean ISF vector for SID frame (only in AMR-WB IO mode) */ -extern const float gaus_dico[]; /* Gaussian codebook */ extern const Word16 gaus_dico_fx[]; // Q12 -extern const float gaus_dico_swb[]; /* Gaussian codebook for SWB TBE */ extern const Word16 gaus_dico_swb_fx[]; // Q15 -extern const float dico1_isf[]; /* ISF codebook - common 1st stage, 1st split (only in AMR-WB IO mode) */ - extern const Word16 dico1_isf_fx[]; /* ISF codebook - common 1st stage, 1st split (only in AMR-WB IO mode) Qlog2(2.56)*/ -extern const float dico2_isf[]; /* ISF codebook - common 1st stage, 2nd split (only in AMR-WB IO mode) */ - extern const Word16 dico2_isf_fx[]; /* ISF codebook - common 1st stage, 2nd split (only in AMR-WB IO mode) Qlog2(2.56)*/ extern const float dico21_isf_46b[]; /* ISF codebook - 46b, 2nd stage, 1st split (only in AMR-WB IO mode) */ @@ -513,15 +529,13 @@ extern const Word16 dico24_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 4th s extern const Word16 dico25_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 5th split (only in AMR-WB IO mode) Qlog2(2.56)*/ extern const float dico21_isf_36b[]; /* ISF codebook - 36b, 2nd stage, 1st split (only in AMR-WB IO mode) */ +extern const float dico22_isf_36b[]; /* ISF codebook - 36b, 2nd stage, 2nd split (only in AMR-WB IO mode) */ +extern const float dico23_isf_36b[]; /* ISF codebook - 36b, 2nd stage, 3rd split (only in AMR-WB IO mode) */ extern const Word16 dico21_isf_36b_fx[]; /* ISF codebook - 36b, 2nd stage, 1st split (only in AMR-WB IO mode) Qlog2(2.56)*/ -extern const float dico22_isf_36b[]; /* ISF codebook - 36b, 2nd stage, 2nd split (only in AMR-WB IO mode) */ - extern const Word16 dico22_isf_36b_fx[]; /* ISF codebook - 36b, 2nd stage, 2nd split (only in AMR-WB IO mode) Qlog2(2.56)*/ -extern const float dico23_isf_36b[]; /* ISF codebook - 36b, 2nd stage, 3rd split (only in AMR-WB IO mode) */ - extern const Word16 dico23_isf_36b_fx[]; /* ISF codebook - 36b, 2nd stage, 3rd split (only in AMR-WB IO mode) Qlog2(2.56)*/ extern const float dico1_ns_28b[]; /* ISF codebook for SID frames - 28b, 1st split */ @@ -546,24 +560,28 @@ extern const float dico5_cng_ev[]; * LSF quantization - MSVQ tables *----------------------------------------------------------------------------------*/ -extern const float stable_ISP[]; -extern const float stable_LSP[]; extern const float stable_ISF[]; +extern const float stable_LSP[]; +#ifndef IVAS_FLOAT_FIXED +extern const float stable_ISP[]; +#endif extern const Word16 stable_ISP_fx[]; /*Q15*/ extern const Word16 stable_ISF_fx[]; /*15Q16*/ extern const Word16 stable_LSP_fx[]; /*Q15*/ +#ifndef IVAS_FLOAT_FIXED extern const float UVWB_Ave[]; extern const float UVNB_Ave[]; extern const float SVWB_Ave[]; extern const float SVNB_Ave[]; extern const float IAWB_Ave[]; extern const float IANB_Ave[]; +extern const float TRWB_Ave[]; +extern const float TRWB2_Ave[]; +#endif extern const float GENB_Ave[]; extern const float GEWB_Ave[]; extern const float GEWB2_Ave[]; -extern const float TRWB_Ave[]; -extern const float TRWB2_Ave[]; extern const Word16 UVWB_Ave_fx[]; // Qlog2(2.56) extern const Word16 UVNB_Ave_fx[]; // Qlog2(2.56) extern const Word16 SVWB_Ave_fx[]; // Qlog2(2.56) @@ -585,6 +603,7 @@ extern const Word16 means_swb_cleanspeech_lsf25k6[]; // Qlog2(2.56) extern const Word16 means_swb_cleanspeech_lsf32k0[]; // Qlog2(2.56) extern const float ModeMean12[]; +#ifndef IVAS_FLOAT_FIXED extern const float Predictor0[]; extern const float Predictor1[]; extern const float Predictor2[]; @@ -594,6 +613,7 @@ extern const float Predictor5[]; extern const float Predictor6[]; extern const float Predictor7[]; extern const float Predictor8[]; +#endif extern const Word16 Predictor0_fx[]; // Q15 extern const Word16 Predictor1_fx[]; // Q15 extern const Word16 Predictor2_fx[]; // Q15 @@ -608,8 +628,10 @@ extern const float CNG_SN1[]; extern const Word16 CNG_SN1_fx[]; // Qlog2(2.56) extern const Word16 CB_lsf[]; // Q0 extern const Word16 CB_p_lsf[]; // Q0 +#ifndef IVAS_FLOAT_FIXED extern const float *const ModeMeans[]; extern const float *const Predictors[]; +#endif extern const Word16 *const ModeMeans_fx[]; // Qlog2(2.56) extern const Word16 *const Predictors_fx[]; // Q15 extern const Word16 CBsizes[]; // Q0 @@ -628,31 +650,31 @@ extern const Word16 no_vals_ind[NO_LEADERS][MAX_NO_VALS]; // Q0 extern const Word16 C_VQ[LATTICE_DIM + 1][LATTICE_DIM + 1]; // Q0 // extern const Word16 C_VQ_fx[LATTICE_DIM + 1][LATTICE_DIM + 1]; -extern const Word16 BitsVQ[]; // Q0 -extern const Word16 BitsVQ_p[]; // Q0 -extern const UWord8 no_lead_idx[][2]; // Q0 -extern const UWord8 no_lead_p_idx[][2]; // Q0 -extern const Word8 leaders_short[][MAX_NO_SCALES]; // Q0 extern const float sigma_MSLVQ[][16]; -extern const Word16 sigma_MSLVQ_fx[][16]; // Qlog2(2.56) extern const float sigma_p[][16]; -extern const Word16 sigma_p_fx[][16]; // Qlog2(2.56) -extern const Word16 sigma_p_ivas_fx[][16]; // Qlog2(2.56) extern const float inv_sigma_MSLVQ[][16]; -extern const Word16 inv_sigma_MSLVQ_fx[][16]; // Q15 extern const float inv_sigma_p[][16]; -extern const Word16 inv_sigma_p_fx[][16]; // Q15 -extern const Word16 inv_sigma_p_ivas_fx[][16]; // Qlog2(2.56) extern const float scales[][MAX_NO_SCALES * 2]; extern const float scales_p[][MAX_NO_SCALES * 2]; +extern const float pl_HQ[]; +extern const Word16 BitsVQ[]; // Q0 +extern const Word16 BitsVQ_p[]; // Q0 +extern const UWord8 no_lead_idx[][2]; // Q0 +extern const UWord8 no_lead_p_idx[][2]; // Q0 +extern const Word8 leaders_short[][MAX_NO_SCALES]; // Q0 +extern const Word16 sigma_MSLVQ_fx[][16]; // Qlog2(2.56) +extern const Word16 sigma_p_fx[][16]; // Qlog2(2.56) +extern const Word16 sigma_p_ivas_fx[][16]; // Qlog2(2.56) +extern const Word16 inv_sigma_MSLVQ_fx[][16]; // Q15 +extern const Word16 inv_sigma_p_fx[][16]; // Q15 +extern const Word16 inv_sigma_p_ivas_fx[][16]; // Qlog2(2.56) extern const Word16 scales_fx[][MAX_NO_SCALES * 2]; // Q11 extern const Word16 scales_ivas_fx[][MAX_NO_SCALES * 2]; // Q11 extern const Word16 scales_p_ivas_fx[][MAX_NO_SCALES * 2]; // Q11 extern const Word16 scales_p_fx[][MAX_NO_SCALES * 2]; // Q11 -extern const int16_t predmode_tab_float[][6]; +extern const Word16 predmode_tab_float[][6]; extern const Word16 predmode_tab[][6]; // Q0 -extern const float pl_HQ[]; -extern const Word16 pl_HQ_fx[]; // Q1 +extern const Word16 pl_HQ_fx[]; // Q1 extern const Word16 pi0[]; // Q0 // extern const Word16 pi0_fx[]; @@ -674,22 +696,22 @@ extern const Word16 cng_sort[]; // Q0 extern const Word16 perm_MSLVQ[][4]; // Q0 // extern const Word16 perm_MSLVQ_fx[][4]; -extern const int16_t min_lat_bits_SN[]; +extern const Word16 min_lat_bits_SN[]; extern const Word16 min_lat_bits_SN_fx[]; // Q0 -extern const int16_t min_lat_bits_pred[]; +extern const Word16 min_lat_bits_pred[]; extern const Word16 min_lat_bits_pred_fx[]; // Q0 -extern const int16_t offset_in_lvq_mode_SN[][21]; +extern const Word16 offset_in_lvq_mode_SN[][21]; extern const Word16 offset_in_lvq_mode_SN_fx[][21]; // Q0 -extern const int16_t offset_in_lvq_mode_pred[][32]; +extern const Word16 offset_in_lvq_mode_pred[][32]; extern const Word16 offset_in_lvq_mode_pred_fx[][32]; // Q0 -extern const int16_t offset_lvq_modes_SN[]; +extern const Word16 offset_lvq_modes_SN[]; extern const Word16 offset_lvq_modes_SN_fx[]; // Q0 -extern const int16_t offset_lvq_modes_pred[]; +extern const Word16 offset_lvq_modes_pred[]; extern const Word16 offset_lvq_modes_pred_fx[]; // Qlog2(1.6) /*-----------------------------------------------------------------* @@ -703,37 +725,49 @@ extern const Word16 BC_TCVQ_BIT_ALLOC_40B[]; // Q0 extern const Word16 NTRANS[4][16]; // Q0 extern const Word16 NTRANS2[4][16]; // Q0 +#ifndef IVAS_FLOAT_FIXED extern const float AR_IntraCoeff[N_STAGE_VQ - 1][2][2]; extern const float SN_IntraCoeff[N_STAGE_VQ - 1][2][2]; +#endif extern const Word16 AR_IntraCoeff_fx[N_STAGE_VQ - 1][2][2]; /* Q15 */ extern const Word16 SN_IntraCoeff_fx[N_STAGE_VQ - 1][2][2]; // Q15 +#ifndef IVAS_FLOAT_FIXED extern const float scale_ARSN[]; -extern const Word16 scale_ARSN_fx[]; /* Q14 */ extern const float scale_inv_ARSN[]; +#endif +extern const Word16 scale_ARSN_fx[]; /* Q14 */ extern const Word16 scale_inv_ARSN_fx[]; // Q15 +#ifndef IVAS_FLOAT_FIXED extern const float AR_TCVQ_CB_SUB1[2][128][2]; extern const float AR_TCVQ_CB_SUB2[2][64][2]; extern const float AR_TCVQ_CB_SUB3[4][32][2]; +#endif extern const Word16 AR_TCVQ_CB_SUB1_fx[2][128][2]; // Qlog2(2.56) extern const Word16 AR_TCVQ_CB_SUB2_fx[2][64][2]; // Qlog2(2.56) extern const Word16 AR_TCVQ_CB_SUB3_fx[4][32][2]; // Qlog2(2.56) + +#ifndef IVAS_FLOAT_FIXED extern const float SN_TCVQ_CB_SUB1[2][128][2]; extern const float SN_TCVQ_CB_SUB2[2][64][2]; extern const float SN_TCVQ_CB_SUB3[4][32][2]; +#endif extern const Word16 SN_TCVQ_CB_SUB1_fx[2][128][2]; // Qlog2(2.56) extern const Word16 SN_TCVQ_CB_SUB2_fx[2][64][2]; // Qlog2(2.56) extern const Word16 SN_TCVQ_CB_SUB3_fx[4][32][2]; // Qlog2(2.56) + +#ifndef IVAS_FLOAT_FIXED extern const float AR_SVQ_CB1[32][8]; extern const float AR_SVQ_CB2[16][8]; +#endif extern const Word16 AR_SVQ_CB1_fx[32][8]; // Qlog2(2.56) extern const Word16 AR_SVQ_CB2_fx[16][8]; // Qlog2(2.56) -extern const int16_t uniform_model[]; +extern const Word16 uniform_model[]; /*-----------------------------------------------------------------* * LSF quantization - mid-frame quantization tables @@ -858,7 +892,9 @@ extern const Word16 Da_nq[]; /* Codebook number for each absolute leader */ extern const Word16 skip_bands_SWB_TBE[]; /* bands for SWB TBE quantisation Q0*/ extern const Word16 skip_bands_WB_TBE[]; /* bands for WB TBE quantisation Q0*/ +#ifndef IVAS_FLOAT_FIXED extern const float interpol_frac_shb_flt[]; +#endif extern const Word16 interpol_frac_shb[NB_SUBFR * 2]; // Q15 extern const float AP1_STEEP[]; /* All pass filter coeffs for interpolation and decimation by a factor of 2 */ @@ -868,97 +904,118 @@ extern const Word16 AP2_STEEP_FX[]; // Q15 /* All pass filter coeffs for interpo extern const float STEPS[]; /* Granuality in conversion from lpc to lsp */ +#ifndef IVAS_FLOAT_FIXED extern const float cos_fb_exc[]; -extern const Word16 cos_fb_exc_fx[32]; // Q15 +#endif extern const float recip_order[]; +extern const Word16 cos_fb_exc_fx[32]; // Q15 -extern const float win_lpc_shb[]; /* Window for calculating SHB LPC coeffs */ -extern const Word16 win_lpc_shb_fx[]; // Q15 /* Window for calculating SHB LPC coeffs */ -extern const float win_lpc_hb_wb[]; -extern const Word16 win_lpc_hb_wb_fx[]; // Q15 -extern const float ola_win_shb_switch_fold[]; +extern const Word16 win_lpc_shb_fx[]; // Q15 /* Window for calculating SHB LPC coeffs */ +extern const Word16 win_lpc_hb_wb_fx[]; // Q15 extern const Word16 ola_win_shb_switch_fold_fx[]; // Q15 -extern const float win_flatten[]; /* Window for calculating whitening filter for SHB excitation */ extern const Word16 win_flatten_fx[]; // Q15 -extern const float win_flatten_4k[]; /* Window for calculating whitening filter for WB excitation */ extern const Word16 win_flatten_4k_fx[]; // Q15 -extern const float window_shb[]; /* Overlap add window for SHB excitation used in anal and synth */ -extern const Word16 window_shb_fx[]; // Q15 -extern const float window_shb_32k[]; /* Upsampled overlap add window for SHB excitation used transition generation */ -extern const Word16 window_shb_32k_fx[]; // Q15 -extern const float subwin_shb[]; /* Short overlap add window for SHB excitation used in anal and synth */ -extern const Word16 subwin_shb_fx[]; // Q15 /* Short overlap add window for SHB excitation used in anal and synth */ +extern const float win_flatten_4k[]; /* Window for calculating whitening filter for WB excitation */ +#ifndef IVAS_FLOAT_FIXED +extern const float win_lpc_shb[]; /* Window for calculating SHB LPC coeffs */ +extern const float win_lpc_hb_wb[]; +extern const float ola_win_shb_switch_fold[]; +extern const float win_flatten[]; /* Window for calculating whitening filter for SHB excitation */ +extern const float window_shb[]; /* Overlap add window for SHB excitation used in anal and synth */ +extern const float window_shb_32k[]; /* Upsampled overlap add window for SHB excitation used transition generation */ +extern const float subwin_shb[]; /* Short overlap add window for SHB excitation used in anal and synth */ extern const float window_wb[]; -extern const float subwin_wb[]; /* Short overlap add window for SHB excitation used in anal and synth */ -extern const Word16 window_wb_fx[]; // Q15 -extern const Word16 subwin_wb_fx[]; // Q15 +extern const float subwin_wb[]; /* Short overlap add window for SHB excitation used in anal and synth */ +#endif +extern const Word16 window_shb_fx[]; // Q15 +extern const Word16 window_shb_32k_fx[]; // Q15 +extern const Word16 subwin_shb_fx[]; // Q15 /* Short overlap add window for SHB excitation used in anal and synth */ +extern const Word16 window_wb_fx[]; // Q15 +extern const Word16 subwin_wb_fx[]; // Q15 +#ifndef IVAS_FLOAT_FIXED extern const float Hilbert_coeffs[4 * NUM_HILBERTS][HILBERT_ORDER1 + 1]; +#endif extern const Word16 Hilbert_coeffs_fx[4 * NUM_HILBERTS][HILBERT_ORDER1 + 1]; // Q14 extern const float wac[]; +#ifndef IVAS_FLOAT_FIXED extern const float wac_swb[]; +#endif extern const Word16 wac_swb_h[]; // Q15 extern const Word16 wac_swb_l[]; // Q15 +#ifndef IVAS_FLOAT_FIXED extern const float wb_bwe_lsfvq_cbook_8bit[]; -extern const Word16 wb_bwe_lsfvq_cbook_8bit_fx[]; // Q15 extern const float lbr_wb_bwe_lsfvq_cbook_2bit[]; -extern const Word16 lbr_wb_bwe_lsfvq_cbook_2bit_fx[]; // Q15 extern const float swb_tbe_lsfvq_cbook_8b_flt[]; -extern const Word16 swb_tbe_lsfvq_cbook_8b[]; // Q15 -extern const float SHBCB_SubGain5bit[]; /* 5 bit Quantizer table for SHB gain shapes */ -extern const Word16 SHBCB_SubGain5bit_fx[]; // Q14 -extern const float HBCB_SubGain5bit[]; /* 5-bit TD WB BWE temporal shaping codebook */ -extern const Word16 HBCB_SubGain5bit_fx[]; // Q8 -extern const float SHBCB_FrameGain64[]; /* 6 bit Quantizer table for SHB overall gain */ -extern const Word32 SHBCB_FrameGain64_fx[]; // Q18 +extern const float SHBCB_SubGain5bit[]; /* 5 bit Quantizer table for SHB gain shapes */ +extern const float HBCB_SubGain5bit[]; /* 5-bit TD WB BWE temporal shaping codebook */ +extern const float SHBCB_FrameGain64[]; /* 6 bit Quantizer table for SHB overall gain */ extern const float SHBCB_FrameGain16[]; -extern const Word32 SHBCB_FrameGain16_fx[]; /*Q18*/ +#endif +extern const Word16 wb_bwe_lsfvq_cbook_8bit_fx[]; // Q15 +extern const Word16 lbr_wb_bwe_lsfvq_cbook_2bit_fx[]; // Q15 +extern const Word16 swb_tbe_lsfvq_cbook_8b[]; // Q15 +extern const Word16 SHBCB_SubGain5bit_fx[]; // Q14 +extern const Word16 HBCB_SubGain5bit_fx[]; // Q8 +extern const Word32 SHBCB_FrameGain64_fx[]; // Q18 +extern const Word32 SHBCB_FrameGain16_fx[]; /*Q18*/ +#ifndef IVAS_FLOAT_FIXED extern const float full_band_bpf_1[][5]; extern const float full_band_bpf_2[][5]; extern const float full_band_bpf_3[][5]; +#endif extern const Word16 full_band_bpf_1_fx[][5]; /*Q13*/ extern const Word16 full_band_bpf_2_fx[][5]; /*Q13*/ extern const Word16 full_band_bpf_3_fx[][5]; /*Q13*/ -extern const float lsf_q_cb_4b[]; /* 4 bit differential scalar quantizer table for TD SWB BWE LSFs 1 and 2*/ -extern const float lsf_q_cb_3b[]; /* 3 bit differential scalar quantizer table for TD SWB BWE LSFs 3, 4 and 5*/ -extern const float *const lsf_q_cb[]; /* Codebook array for each LSF */ -extern const Word16 *const lsf_q_cb_fx[]; // Q15 -extern const Word16 lsf_q_cb_size[]; /* Size of each element of the above Q0*/ -extern const Word16 lsf_q_num_bits[]; /* Size of each element of the above, in bits Q0*/ -extern const float mirror_point_q_cb[]; /* LSF mirroring point codebook */ -extern const Word16 mirror_point_q_cb_fx[]; // Q15 -extern const float lsf_grid[4][5]; /* LSF mirroring adjustment grid */ -extern const Word16 lsf_grid_fx[4][5]; // Q15 -extern const float grid_smoothing[]; /* LSF mirroring smoothing table */ -extern const Word16 grid_smoothing_fx[]; /* LSF mirroring smoothing table Q15*/ - -extern const float overlap_coefs[]; /* HR SWB BWE - overlap coefficients */ -extern const float overlap_coefs_48kHz[]; /* HR SWB BWE - overlap coefficients @48kHz */ +#ifndef IVAS_FLOAT_FIXED +extern const float lsf_q_cb_4b[]; /* 4 bit differential scalar quantizer table for TD SWB BWE LSFs 1 and 2*/ +extern const float lsf_q_cb_3b[]; /* 3 bit differential scalar quantizer table for TD SWB BWE LSFs 3, 4 and 5*/ +extern const float *const lsf_q_cb[]; /* Codebook array for each LSF */ +#endif +extern const Word16 *const lsf_q_cb_fx[]; // Q15 +extern const Word16 lsf_q_cb_size[]; /* Size of each element of the above Q0*/ +extern const Word16 lsf_q_num_bits[]; /* Size of each element of the above, in bits Q0*/ +extern const Word16 mirror_point_q_cb_fx[]; // Q15 +#ifndef IVAS_FLOAT_FIXED +extern const float mirror_point_q_cb[]; /* LSF mirroring point codebook */ +extern const float lsf_grid[4][5]; /* LSF mirroring adjustment grid */ +extern const float grid_smoothing[]; /* LSF mirroring smoothing table */ +#endif +extern const Word16 lsf_grid_fx[4][5]; // Q15 +extern const Word16 grid_smoothing_fx[]; /* LSF mirroring smoothing table Q15*/ + +#ifndef IVAS_FLOAT_FIXED +extern const float overlap_coefs[]; /* HR SWB BWE - overlap coefficients */ +extern const float overlap_coefs_48kHz[]; /* HR SWB BWE - overlap coefficients @48kHz */ +#endif extern const Word16 overlap_coefs_fx[NSV_OVERLAP * WIDTH_BAND]; /* in Q15 */ extern const Word16 overlap_coefs_48kHz_fx[NSV_OVERLAP * WIDTH_BAND]; /* in Q15 */ -extern const float swb_hr_env_code1[]; /* HR SWB BWE - envelope Q table - first two subabnds in non-transient frames */ -extern const float swb_hr_env_code2[]; /* HR SWB BWE - envelope Q table - second two subabnds in non-transient frames*/ -extern const float swb_hr_env_code3[]; /* HR SWB BWE - envelope Q table - two subabnds in transient frames */ +#ifndef IVAS_FLOAT_FIXED +extern const float swb_hr_env_code1[]; /* HR SWB BWE - envelope Q table - first two subabnds in non-transient frames */ +extern const float swb_hr_env_code2[]; /* HR SWB BWE - envelope Q table - second two subabnds in non-transient frames*/ +extern const float swb_hr_env_code3[]; /* HR SWB BWE - envelope Q table - two subabnds in transient frames */ +#endif extern const Word16 swb_hr_env_code1_fx[]; /* HR SWB BWE - envelope Q table - first two subabnds in non-transient frames Q9*/ extern const Word16 swb_hr_env_code2_fx[]; /* HR SWB BWE - envelope Q table - second two subabnds in non-transient frames Q9*/ extern const Word16 swb_hr_env_code3_fx[]; /* HR SWB BWE - envelope Q table - two subands in transient frames Q9*/ extern const float allpass_poles_3_ov_2_flt[]; -extern const Word16 allpass_poles_3_ov_2[]; /*Q15*/ extern const float decimate_3_ov_2_lowpass_num[]; -extern const Word16 decimate_3_ov_2_lowpass_num_fx[]; /*Q15*/ extern const float decimate_3_ov_2_lowpass_den[]; +extern const Word16 allpass_poles_3_ov_2[]; /*Q15*/ +extern const Word16 decimate_3_ov_2_lowpass_num_fx[]; /*Q15*/ extern const Word16 decimate_3_ov_2_lowpass_den_fx[]; /*Q15*/ /*------------------------------------------------------------------------------* * WB BWE tables *------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED extern const float F_2_5[64]; +#endif extern const Word16 F_2_5_fx[64]; /*Q10*/ /*------------------------------------------------------------------------------* * SWB BWE tables @@ -971,45 +1028,51 @@ extern const Word16 sqrt_swb_bwe_trans_subband_width_fx[]; // Q11 extern const Word16 sqrt_swb_bwe_subband_fx_L1[]; // Q12 extern const Word16 sqrt_swb_bwe_subband_fx_L2[]; // Q12 -extern const Word16 swb_bwe_subband[]; // Q0 -extern const Word16 fb_bwe_subband[]; // Q0 -extern const Word16 fb_bwe_sm_subband[]; // Q0 +extern const float smooth_factor[]; +extern const float fb_smooth_factor[]; +#ifndef IVAS_FLOAT_FIXED extern const float swb_inv_bwe_subband_width[]; +extern const float fb_inv_bwe_subband_width[]; +#endif +extern const Word16 swb_bwe_subband[]; // Q0 +extern const Word16 fb_bwe_subband[]; // Q0 +extern const Word16 fb_bwe_sm_subband[]; // Q0 extern const Word16 swb_inv_bwe_subband_width_fx[]; // Q15 extern const Word16 swb_bwe_sm_subband[]; // Q0 -extern const float smooth_factor[]; -extern const Word16 smooth_factor_fx[]; // Q15 -extern const Word16 fb_bwe_subband_float[]; // Q0 -extern const float fb_inv_bwe_subband_width[]; -extern const Word16 fb_inv_bwe_subband_width_fx[]; // Q15 -extern const Word16 fb_bwe_sm_subband_float[]; // Q0 -extern const float fb_smooth_factor[]; -extern const Word16 fb_smooth_factor_fx[]; // Q15 +extern const Word16 smooth_factor_fx[]; // Q15 +extern const Word16 fb_bwe_subband_float[]; // Q0 +extern const Word16 fb_inv_bwe_subband_width_fx[]; // Q15 +extern const Word16 fb_bwe_sm_subband_float[]; // Q0 +extern const Word16 fb_smooth_factor_fx[]; // Q15 +#ifndef IVAS_FLOAT_FIXED extern const float EnvCdbk11[]; extern const float EnvCdbk1st[]; extern const float EnvCdbk2nd[]; extern const float EnvCdbk3rd[]; extern const float EnvCdbk4th[]; +#endif extern const Word16 EnvCdbk11_fx[]; /*Q8 */ extern const Word16 EnvCdbk1st_fx[]; /*Q8 */ extern const Word16 EnvCdbk2nd_fx[]; /*Q8 */ extern const Word16 EnvCdbk3rd_fx[]; /*Q8 */ extern const Word16 EnvCdbk4th_fx[]; /*Q8 */ +#ifndef IVAS_FLOAT_FIXED extern const float EnvCdbkFB[]; -extern const Word16 EnvCdbkFB_fx[]; /*Q7 */ extern const float Env_TR_Cdbk1[]; extern const float Env_TR_Cdbk2[]; -extern const Word16 Env_TR_Cdbk1_fx[]; /*Q8 */ -extern const Word16 Env_TR_Cdbk2_fx[]; /*Q8 */ extern const float w_NOR[]; -extern const Word16 w_NOR_fx[]; // Q15 extern const float Mean_env[]; -extern const Word16 Mean_env_fx[]; // Q8 extern const float Mean_env_fb[]; -extern const Word16 Mean_env_fb_fx[]; /*Q8 */ extern const float Mean_env_tr[]; -extern const Word16 Mean_env_tr_fx[]; /*Q8 */ +#endif +extern const Word16 EnvCdbkFB_fx[]; /*Q7 */ +extern const Word16 Env_TR_Cdbk1_fx[]; /*Q8 */ +extern const Word16 Env_TR_Cdbk2_fx[]; /*Q8 */ +extern const Word16 w_NOR_fx[]; // Q15 +extern const Word16 Mean_env_fx[]; // Q8 +extern const Word16 Mean_env_fb_fx[]; /*Q8 */ +extern const Word16 Mean_env_tr_fx[]; /*Q8 */ /*------------------------------------------------------------------------------* * ACEPL/HQ core switching tables *------------------------------------------------------------------------------*/ @@ -1085,7 +1148,6 @@ extern const Word16 intl_cnt_48[N_INTL_GRP_48]; // Q0 extern const Word16 norm_order_48[NB_SFM]; // Q0 extern const Word16 norm_order_32[SFM_N_SWB]; // Q0 extern const Word16 norm_order_16[SFM_N_WB]; // Q0 - extern const float dicn_pg[45]; extern const Word32 dicn_pg_fx[]; /*Q12 */ extern const Word16 expPkEnrg_tbl[45]; // Q0 @@ -1093,11 +1155,9 @@ extern const Word32 manPkEnrg_tbl[45]; // Q0 extern const Word32 E_max5_tbl[40]; // Q0 extern const float thren_pg[44]; -#ifdef IVAS_FLOAT_FIXED extern const Word32 thren_pg_fx[44]; -#endif -extern const float dicn[40]; extern const Word32 dicn_fx[40]; /*Q14 */ +extern const float dicn[40]; extern const float dicn_inv[40]; extern const float thren_HQ[39]; #ifdef IVAS_FLOAT_FIXED @@ -1280,20 +1340,22 @@ extern const Word16 fg_inv_tbl_fx[13]; // Q0 extern const UWord32 exactdivodd[ODD_DIV_SIZE]; // Q0 extern const float gain_att[]; -extern const Word16 gain_att_fx[40]; // Q15 +extern const float stab_trans[]; +extern const float env_stab_tp[2][2]; extern const float att_step[]; -extern const Word16 att_step_fx[4]; // Q13 extern const float gain_qlow[]; +extern const Word16 gain_att_fx[40]; // Q15 +extern const Word16 att_step_fx[4]; // Q13 extern const int16_t gain_cb_size[]; -extern const float stab_trans[]; -extern const Word16 stab_trans_fx[]; // Q15 -extern const float env_stab_tp[2][2]; +extern const Word16 stab_trans_fx[]; // Q15 extern const Word16 env_stab_tp_fx[2][2]; // Q15 /*----------------------------------------------------------------------------------* * SWB BWE for LR MDCT core *----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED extern const float gain_table_SWB_BWE[NB_SWB_SUBBANDS]; +#endif extern const Word16 gain_table_SWB_BWE_fx[NB_SWB_SUBBANDS]; /*Q14 */ /* HQ_NORMAL mode */ @@ -1430,8 +1492,9 @@ extern const Word16 hvq_cp_huff_tab[52]; // Q0 /*------------------------------------------------------------------------------* * GSC mode *------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED extern const float sin_table256[]; +#endif extern const Word16 sin_table256_fx[]; // Q15 extern const Word16 gsc_sfm_start[]; // Q0 extern const Word16 gsc_sfm_end[]; // Q0 @@ -1565,10 +1628,11 @@ extern const float FFT_RotVector_960[1860]; /*----------------------------------------------------------------------------------* * FEC for HQ core *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED extern const float Asr_LP32[41]; extern const float Asr_LP16[21]; extern const float Asr_LP48[61]; +#endif extern const Word16 Asr_LP32_fx[41]; // Q15 extern const Word16 Asr_LP16_fx[21]; // Q15 extern const Word16 Asr_LP48_fx[61]; // Q15 diff --git a/lib_com/scale_mem_fx.c b/lib_com/scale_mem_fx.c index 49e6aef999006740c24dbf125510930080f424fb..9dd997680bf4a009fc03d4e30d3a29f2b9e91eb9 100644 --- a/lib_com/scale_mem_fx.c +++ b/lib_com/scale_mem_fx.c @@ -309,7 +309,6 @@ void scale_sig32( move32(); } } -#ifdef FIX_882_LOW_LEVEL_DISCONTINUITIES void scale_sig32_r( Word32 x[], /* i/o: signal to scale Qx */ const Word16 lg, /* i : size of x[] Q0 */ @@ -325,7 +324,6 @@ void scale_sig32_r( move32(); } } -#endif /*-------------------------------------------------------------------* * Rescale_mem: diff --git a/lib_com/swb_bwe_com.c b/lib_com/swb_bwe_com.c index 3d0881e4408184504a848cde4b2cfbe98f7d7c00..8b1cd00baf296145d87003cf387c16625da1c475 100644 --- a/lib_com/swb_bwe_com.c +++ b/lib_com/swb_bwe_com.c @@ -42,6 +42,7 @@ #include "rom_com.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * WB_BWE_gain_pred() * @@ -173,6 +174,7 @@ int16_t WB_BWE_gain_pred( return ( mode ); } +#endif /*-------------------------------------------------------------------* * calc_normal_length() @@ -275,6 +277,7 @@ void calc_normal_length( return; } +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * calc_tilt_bwe() * @@ -309,6 +312,7 @@ void calc_tilt_bwe( return; } +#endif /*-------------------------------------------------------------------* * calc_norm_envelop() @@ -423,6 +427,7 @@ static void calc_norm_envelop_lf( return; } +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * WB_BWE_decoding() * @@ -1073,6 +1078,7 @@ void SWB_BWE_decoding( return; } + /*-------------------------------------------------------------------* * time_envelop_shaping() * @@ -1118,6 +1124,7 @@ void time_envelop_shaping( return; } + /*-------------------------------------------------------------------* * time_reduce_pre_echo() * @@ -1201,6 +1208,7 @@ void time_reduce_pre_echo( return; } +#endif /*-------------------------------------------------------------------* * hq_generic_hf_decoding() @@ -1508,7 +1516,7 @@ void hq_generic_hf_decoding( return; } - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * save_old_syn() * @@ -1544,3 +1552,4 @@ void save_old_syn( return; } +#endif diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index 08c72e016754548aef7c7d52f6bfc758d9400e03..b4f8f0ad9346b9e8d485e74c22edf0faba3cf839 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -766,23 +766,6 @@ Word16 ivas_calc_tilt_bwe_fx( /* o : Tilt in Q24 ptr = sp; L_ener_tot = L_deposit_l( 1 ); -#ifndef FIX_846_TILT_BWE - /* Divide Frame Length by 32 */ - FOR( j = shr( N, 5 ); j > 0; j-- ) - { - Word32 tmp = *ptr++; /* Divide by 4 */ - L_ener = Mpy_32_32( tmp, tmp ); - /* With the shift by 4 and the L_mult0, no overflow possible for 32 samples */ - FOR( i = 1; i < 32; i++ ) - { - tmp1 = *ptr++; /* Divide by 4 */ - L_ener = Madd_32_32( L_ener, tmp1, tmp1 ); - } - L_temp = L_add( L_ener_tot, L_ener ); - - L_ener_tot = L_add( L_ener_tot, L_ener ); - } -#else /* Divide Frame Length by 32 */ Word64 W_ener; W_ener = Mpy_32_32( *ptr, *ptr ); @@ -795,8 +778,6 @@ Word16 ivas_calc_tilt_bwe_fx( /* o : Tilt in Q24 } L_ener_tot = W_round64_L( W_ener ); L_ener_tot = L_max( L_ener_tot, 1 ); /* L_ener_tot is energy, it is always positive, but have to be > 0 for the following division */ - -#endif L_ener = L_abs( L_sub( sp[1], sp[0] ) ); FOR( i = 2; i < N; i++ ) @@ -839,11 +820,7 @@ Word16 ivas_calc_tilt_bwe_fx( /* o : Tilt in Q24 L_temp = L_shl( L_temp, sub( exp2, 4 ) ); // Output is expected in Q11 } BASOP_SATURATE_WARNING_ON_EVS -#ifdef FIX_856_EXTRACT_L return extract_h( L_shl_sat( L_temp, 16 ) ); -#else - return extract_l( L_temp ); -#endif } #endif diff --git a/lib_com/swb_tbe_com.c b/lib_com/swb_tbe_com.c index 18e5b1f2a5ac463f40f3215a7566767ef6870b43..69497dad4a1e98cbcfe6adf7015148f1f656feba 100644 --- a/lib_com/swb_tbe_com.c +++ b/lib_com/swb_tbe_com.c @@ -45,15 +45,15 @@ #include "ivas_prot.h" #include -#define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ -#define THR_ENV_ERROR_PLOSIVE 200.0f /* threshold for envelope error used in plosive detection */ /*-----------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------*/ -static void create_random_vector( float output[], const int16_t length, int16_t seed[] ); #ifndef IVAS_FLOAT_FIXED +#define POW_EXC16k_WHTND 1.14e11f /* power of random excitation, length 320 samples, uniform distribution */ +#define THR_ENV_ERROR_PLOSIVE 200.0f /* threshold for envelope error used in plosive detection */ +static void create_random_vector( float output[], const int16_t length, int16_t seed[] ); static void flip_spectrum( const float input[], float output[], const int16_t length ); static void Hilbert_transform( float tmp_R[], float tmp_I[], float *tmpi_R, float *tmpi_I, const int16_t length, const int16_t HB_stage_id ); static void Estimate_mix_factors( const float *shb_res, const float *exc16kWhtnd, const float *White_exc16k, const float pow1, const float pow22, float *vf_modified, int16_t *vf_ind ); @@ -92,6 +92,7 @@ void swb_tbe_reset( #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * swb_tbe_reset_synth() * @@ -128,7 +129,6 @@ int16_t tbe_celp_exc_offset_flt( } -#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * flip_and_downmix_generic() * @@ -315,6 +315,7 @@ void flip_spectrum( * *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void flip_spectrum_and_decimby4( const float input[], /* i : input spectrum */ float output[], /* o : output spectrum */ @@ -493,6 +494,7 @@ void GenShapedWBExcitation( return; } +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* @@ -1255,6 +1257,7 @@ void GenSHBSynth_fx_32( return; } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ScaleShapedSHB() * @@ -1368,6 +1371,7 @@ void ScaleShapedSHB( return; } +#endif #ifdef IVAS_FLOAT_FIXED void ScaleShapedSHB_32( const Word16 length, /* i : SHB overlap length */ @@ -1525,6 +1529,7 @@ void ScaleShapedSHB_32( return; } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * non_linearity() * @@ -1699,8 +1704,9 @@ void non_linearity( return; } +#endif - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * create_random_vector() * @@ -1754,8 +1760,10 @@ void create_random_vector( return; } +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * interp_code_5over2() * @@ -1841,7 +1849,6 @@ void fb_tbe_reset_synth( return; } -#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * wb_tbe_extras_reset() * @@ -1859,6 +1866,7 @@ void wb_tbe_extras_reset( } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * wb_tbe_extras_reset_synth() * @@ -1877,7 +1885,6 @@ void wb_tbe_extras_reset_synth( return; } -#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * elliptic_bpf_48k_generic() * @@ -2075,6 +2082,7 @@ static void Estimate_mix_factors( } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * tbe_celp_exc_flt() * * * @@ -2125,7 +2133,9 @@ void tbe_celp_exc_flt( return; } +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * prep_tbe_exc() * * * @@ -2205,8 +2215,9 @@ void prep_tbe_exc( return; } +#endif - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * get_tbe_bits() * * * @@ -2276,3 +2287,4 @@ int16_t get_tbe_bits( return bits; } +#endif diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index de8dfc459f7dadfc1b2da38c398f457f71d0b97c..c46c84bd422cb80af5d20ff2ae4b8e1d00baaf05 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -947,10 +947,8 @@ static void filt_mu_fx( Word16 mu, ga, temp; const Word16 *ptrs; Word16 tmp, exp; -#ifdef FIX_729_MISSING_RESCALING Flag Overflow = 0; move32(); -#endif IF( EQ_16( SubFrameLength, L_SUBFR ) ) @@ -991,11 +989,7 @@ static void filt_mu_fx( { temp = mult_r( mu, ( *ptrs++ ) ); temp = add( temp, *ptrs ); /*Q12 */ -#ifdef FIX_729_MISSING_RESCALING sig_out[n] = shl_o( mult_r( ga, temp ), 1, &Overflow ); -#else - sig_out[n] = shl( mult_r( ga, temp ), 1 ); -#endif move16(); /*Q12 */ } @@ -4049,11 +4043,7 @@ void GenShapedSHBExcitation_ivas_enc_fx( { FOR( j = 0; j < 32; ++j ) { -#ifndef FIX_875_SATURATION_DURING_ROUNDING - White_exc16k_FB_temp[i * 32 + j] = mult_r( White_exc16k_FB_temp[i * 32 + j], cos_fb_exc_fx[j] ); -#else White_exc16k_FB_temp[i * 32 + j] = mult_r_sat( White_exc16k_FB_temp[i * 32 + j], cos_fb_exc_fx[j] ); -#endif move16(); } } @@ -5156,11 +5146,7 @@ void GenShapedSHBExcitation_ivas_dec_fx( { FOR( j = 0; j < 32; ++j ) { -#ifndef FIX_875_SATURATION_DURING_ROUNDING - White_exc16k_FB_temp[i * 32 + j] = mult_r( White_exc16k_FB_temp[i * 32 + j], cos_fb_exc_fx[j] ); -#else White_exc16k_FB_temp[i * 32 + j] = mult_r_sat( White_exc16k_FB_temp[i * 32 + j], cos_fb_exc_fx[j] ); -#endif move16(); } } diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c index f1fe24feb2910cb218a4c7367b702d64892abdd0..6075e8151cc5020fb05d1d3939a00d84e87bb455 100644 --- a/lib_com/syn_filt_fx.c +++ b/lib_com/syn_filt_fx.c @@ -537,20 +537,11 @@ void ivas_synth_mem_updt2_fx( Word16 mem_syn_r[], /* i/o: synthesis filter memory st->Q_syn */ Word16 mem_syn2[], /* o : synthesis filter memory for find_target st->Q_syn */ Word16 mem_syn[], /* o : synthesis filter memory for find_target st->Q_syn */ - const Word16 dec -#ifndef FIX_907_MEM_UPDATE_ISSUE - , /* i : flag for decoder indication */ - Word16 Q -#endif -) + const Word16 dec ) { Word16 mem_syn_r_size_old, mem_syn_r_size_new; Word32 en1, en2; -#ifndef FIX_907_MEM_UPDATE_ISSUE - Word16 en1_e, en2_e, loc_rat, loc_rat_e, tmp, tmp_e, i; -#else Word16 en1_e, en2_e, loc_rat, tmp, i; -#endif Word32 tmp1, tmp2; /* Residual and update old_exc */ @@ -562,43 +553,7 @@ void ivas_synth_mem_updt2_fx( { lerp( old_exc + L_EXC_MEM - last_L_frame, old_exc + L_EXC_MEM - L_frame, L_frame, last_L_frame ); } -#ifndef FIX_907_MEM_UPDATE_ISSUE - IF( EQ_16( dec, DEC_IVAS ) ) - { - IF( EQ_16( L_frame, L_FRAME16k ) ) - { - /* find scaling factor */ - // en1 = 1.25f * sum2_f( mem_syn2, M ); - en1 = Mpy_32_32( 1342177280 /*1.25f in Q30*/, sum2_f_16_fx( mem_syn2, M ) ); /* 2 * Q - 1 */ - en2 = L_shr( sum2_f_16_fx( mem_syn_r + L_SYN_MEM - M, M ), 1 ); /* 2 * Q - 1 */ - - // loc_rat = sqrtf( en2 ) / ( sqrtf( en1 ) + 0.01f ); - IF( EQ_32( en1, 0 ) ) - { - loc_rat = 0; - move16(); - } - ELSE - { - en1_e = sub( 30, shl( Q, 1 ) ); - en2_e = sub( 30, shl( Q, 1 ) ); - tmp1 = Sqrt32( en1, &en1_e ); - tmp2 = Sqrt32( en2, &en2_e ); - tmp = BASOP_Util_Divide3232_Scale( tmp1, tmp2, &tmp_e ); - loc_rat_e = add( sub( en1_e, en2_e ), tmp_e ); - loc_rat = shl_sat( tmp, loc_rat_e ); // Q15 - } - /* scale synthesis filter memory */ - FOR( i = 0; i < M; i++ ) - { - // mem_syn_r[L_SYN_MEM - M + i] *= loc_rat; - mem_syn_r[L_SYN_MEM - M + i] = mult_r( mem_syn_r[L_SYN_MEM - M + i], loc_rat ); - move16(); - } - } - } -#endif /*Resamp memory*/ /*Size of LPC syn memory*/ /* 1.25/20.0 = 1.0/16.0 -> shift 4 to the right. */ @@ -606,7 +561,6 @@ void ivas_synth_mem_updt2_fx( mem_syn_r_size_new = shr( L_frame, 4 ); lerp( mem_syn_r + L_SYN_MEM - mem_syn_r_size_old, mem_syn_r + L_SYN_MEM - mem_syn_r_size_new, mem_syn_r_size_new, mem_syn_r_size_old ); -#ifdef FIX_907_MEM_UPDATE_ISSUE IF( EQ_16( dec, DEC_IVAS ) ) { IF( EQ_16( L_frame, L_FRAME16k ) ) @@ -644,7 +598,6 @@ void ivas_synth_mem_updt2_fx( } } } -#endif Copy( mem_syn_r + L_SYN_MEM - M, mem_syn2, M ); IF( mem_syn != NULL ) diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index fdff0ea7b8ba86b7f05aae0c68f561916be99a70..97de24f656053556ae468227fa3ad737cf11793c 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -3927,83 +3927,6 @@ void hp400_12k8_fx( return; } -#ifndef FIX_805_VERIFICATION -void hp400_12k8_ivas_fx( - Word16 signal[], /* i/o: input signal / output is divided by 16 */ - const Word16 lg, /* i : lenght of signal */ - Word16 mem[] /* i/o: filter memory [6] */ -) -{ - Word16 i; - Word16 y1_hi, y1_lo; - Word32 L_tmp, L_tmp2, L_tmp3; - - y1_hi = mem[2]; - move16(); - y1_lo = mem[3]; - move16(); - - L_tmp3 = L_mac( 16384L, mem[1], a_hp400_ivas_fx[2] ); /* rounding to maximize precision */ - L_tmp3 = L_mac( L_tmp3, y1_lo, a_hp400_ivas_fx[1] ); - L_tmp3 = L_shr( L_tmp3, 15 ); - L_tmp2 = L_mac( L_tmp3, mem[0], a_hp400_ivas_fx[2] ); - L_tmp2 = L_mac( L_tmp2, mem[5], b_hp400_fx[2] ); - L_tmp2 = L_mac( L_tmp2, mem[4], b_hp400_fx[1] ); - L_tmp3 = L_mult( mem[4], b_hp400_fx[2] ); - - mem[5] = signal[lg - 2]; - - FOR( i = 1; i < lg; i++ ) - { - /* y[i] = b[0]*x[i] + b[1]*x[i-1] + b[2]*x[i-2] */ - /* + a[1]*y[i-1] + a[2] * y[i-2] */ - - L_tmp = L_mac( L_tmp2, y1_hi, a_hp400_ivas_fx[1] ); - L_tmp = L_mac( L_tmp, *signal, b_hp400_fx[0] ); - - L_tmp = L_shl( L_tmp, 1 ); /* coeff Q12 --> Q13 */ - - L_tmp2 = L_mac( L_tmp3, y1_hi, a_hp400_ivas_fx[2] ); - L_tmp2 = L_mac( L_tmp2, *signal, b_hp400_fx[1] ); - L_tmp3 = L_mac( 16384L, y1_lo, a_hp400_ivas_fx[2] ); /* rounding to maximize precision */ - - y1_lo = L_Extract_lc( L_tmp, &y1_hi ); - - L_tmp3 = L_mac( L_tmp3, y1_lo, a_hp400_ivas_fx[1] ); - L_tmp3 = L_shr( L_tmp3, 15 ); - - L_tmp2 = L_add( L_tmp3, L_tmp2 ); - - L_tmp3 = L_mult( *signal, b_hp400_fx[2] ); - - /* signal is divided by 16 to avoid overflow in energy computation */ - *signal++ = round_fx( L_tmp ); - } - - /* y[i] = b[0]*x[i] + b[1]*x[i-1] + b[2]*x[i-2] */ - /* + a[1]*y[i-1] + a[2] * y[i-2] */ - - L_tmp = L_mac( L_tmp2, y1_hi, a_hp400_ivas_fx[1] ); - - mem[4] = *signal; - move16(); - L_tmp = L_mac( L_tmp, mem[4], b_hp400_fx[0] ); - - L_tmp = L_shl( L_tmp, 1 ); /* coeff Q12 --> Q13 */ - - mem[0] = y1_hi; - move16(); - mem[1] = y1_lo; - move16(); - L_Extract( L_tmp, &mem[2], &mem[3] ); - - /* signal is divided by 16 to avoid overflow in energy computation */ - *signal++ = round_fx( L_tmp ); - - return; -} -#endif - Word16 dot_prod_satcontr( const Word16 *x, const Word16 *y, Word16 qx, Word16 qy, Word16 *qo, Word16 len ) { Word16 tmp_tab_x[L_FRAME16k]; @@ -4438,7 +4361,6 @@ void set_zero_fx( return; } -#ifdef FIX_930_JBM_BUFSIZE_MULT void set_zero2_fx( Word32 *vec, /* o : input vector */ const Word32 lvec /* i : length of the vector */ @@ -4454,7 +4376,7 @@ void set_zero2_fx( return; } -#endif + void set16_zero_fx( Word16 *vec, /* o : input vector */ const Word16 lvec /* i : length of the vector */ diff --git a/lib_dec/FEC_HQ_core.c b/lib_dec/FEC_HQ_core.c index e9695a9efc0c2fa649b8c03af983f748d5a659ce..1ffc43db47747c7e25b87399854202df0e8cae39 100644 --- a/lib_dec/FEC_HQ_core.c +++ b/lib_dec/FEC_HQ_core.c @@ -1582,11 +1582,7 @@ void save_synthesis_hq_fec_fx( Copy( st->hTcxDec->synth_history_fx + output_frame, st->hTcxDec->synth_history_fx, add( sub( output_frame, post_hq_delay ), NS2SA_FX2( st->output_Fs, PH_ECU_MEM_NS ) ) ); FOR( Word16 i = 0; i < output_frame; i++ ) { -#ifdef FIX_856_EXTRACT_L st->hTcxDec->old_synthFB_fx[( ( i + output_frame ) - post_hq_delay )] = extract_h( L_shl_sat( output_fx[i], 16 ) ); // Q16 -#else - st->hTcxDec->old_synthFB_fx[sub( add( i, output_frame ), post_hq_delay )] = extract_l( output_fx[i] ); -#endif move16(); } diff --git a/lib_dec/FEC_clas_estim_fx.c b/lib_dec/FEC_clas_estim_fx.c index 1363d2469d21b8c4eabd331942513f28cb1527c8..8907b45253e1e1402c604b11fb322a43510410a3 100644 --- a/lib_dec/FEC_clas_estim_fx.c +++ b/lib_dec/FEC_clas_estim_fx.c @@ -71,11 +71,7 @@ void FEC_clas_estim_fx( Word16 *lt_diff_etot, // Q8 /* i/o: long-term total energy variation */ /*A*/ Word16 *amr_io_class, -/* i/o: classification for AMR-WB IO mode */ /*A*/ -#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION - const Word32 bitrate, -/* i : Decoded bitrate */ /*A*/ -#endif + /* i/o: classification for AMR-WB IO mode */ /*A*/ Word16 Q_syn, /* i : Synthesis scaling */ Word16 *class_para, // Q14 /* o : classification para. fmerit1 */ /*A*/ @@ -473,13 +469,7 @@ void FEC_clas_estim_fx( /*------------------------------------------------------------------------* * frame classification *------------------------------------------------------------------------*/ -#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION - test(); - test(); - IF( ( NE_16( coder_type, VOICED ) && LT_32( bitrate, ACELP_11k60 ) ) || Opt_AMR_WB ) -#else IF( NE_16( coder_type, VOICED ) ) -#endif { Word16 result = UNVOICED_CLAS; move16(); diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 75c61452a904df7c8794776453d04d659c2c253d..8cdad3653beabb8abdcf7b25d9453b7a8f2bf24a 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -232,11 +232,7 @@ ivas_error acelp_core_dec( st->hGSCDec->Last_frame_ener = (float) MAX_32; } -#ifdef NON_BE_FIX_807_MASA_DTX_BRSW if ( st->hFdCngDec != NULL && ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && ( st->last_core_brate == SID_2k40 || st->last_core_brate == FRAME_NO_DATA ) ) -#else - if ( ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && ( st->last_core_brate == SID_2k40 || st->last_core_brate == FRAME_NO_DATA ) ) -#endif { set_zero( st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, FFTLEN ); set_zero( hStereoCng->olapBufferSynth22, FFTLEN ); diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index b9789ab84e0436f67b66106e5cbd4015063bc857..01093178e438f97ca1dd82dd431aa564a289d147 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -270,11 +270,7 @@ ivas_error acelp_core_dec_fx( } } #ifdef IVAS_CODE -#ifdef NON_BE_FIX_807_MASA_DTX_BRSW if ( st->hFdCngDec != NULL && ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && ( st->last_core_brate == SID_2k40 || st->last_core_brate == FRAME_NO_DATA ) ) -#else - if ( ( st->element_mode == IVAS_CPE_DFT || st->element_mode == IVAS_CPE_TD ) && ( st->last_core_brate == SID_2k40 || st->last_core_brate == FRAME_NO_DATA ) ) -#endif { set_zero( st->hFdCngDec->hFdCngCom->olapBufferSynth2, FFTLEN ); set_zero( hStereoCng->olapBufferSynth22, FFTLEN ); @@ -832,12 +828,8 @@ ivas_error acelp_core_dec_fx( if ( !tdm_lp_reuse_flag ) #endif { - lsf_dec_fx( st_fx, tc_subfr_fx, Aq_fx, &LSF_Q_prediction, lsf_new_fx, lsp_new_fx, lsp_mid_fx, tdm_low_rate_mode -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE - , - tdm_lsfQ_PCh -#endif - ); + lsf_dec_fx( st_fx, tc_subfr_fx, Aq_fx, &LSF_Q_prediction, lsf_new_fx, lsp_new_fx, lsp_mid_fx, tdm_low_rate_mode, + tdm_lsfQ_PCh ); } #ifdef ADD_LRTD else @@ -1170,19 +1162,11 @@ ivas_error acelp_core_dec_fx( * FEC - Estimate the classification information *------------------------------------------------------------*/ -#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION - FEC_clas_estim_fx( st_fx, st_fx->Opt_AMR_WB, st_fx->L_frame, &st_fx->clas_dec, st_fx->coder_type, pitch_buf_fx, - syn_fx, &st_fx->lp_ener_FER_fx, &st_fx->decision_hyst, - NULL, NULL, NULL, NULL, 0, NULL, st_fx->core_brate, st_fx->Q_syn, temp_buf_fx, - st_fx->mem_syn_clas_estim_fx, &st_fx->classifier_Q_mem_syn, - 0, 0, 0, st_fx->last_core_brate, st_fx->acelp_cfg.FEC_mode ); -#else FEC_clas_estim_fx( st_fx, st_fx->Opt_AMR_WB, st_fx->L_frame, &st_fx->clas_dec, st_fx->coder_type, pitch_buf_fx, syn_fx, &st_fx->lp_ener_FER_fx, &st_fx->decision_hyst, NULL, NULL, NULL, NULL, 0, NULL, st_fx->Q_syn, temp_buf_fx, st_fx->mem_syn_clas_estim_fx, &st_fx->classifier_Q_mem_syn, 0, 0, 0, st_fx->last_core_brate, st_fx->acelp_cfg.FEC_mode ); -#endif /*------------------------------------------------------------* * FEC - Estimate pitch *------------------------------------------------------------*/ @@ -1874,13 +1858,8 @@ ivas_error acelp_core_dec_fx( IF( ( EQ_16( st_fx->L_frame, L_FRAME ) && NE_16( st_fx->bwidth, NB ) && GE_16( output_frame, L_FRAME16k ) && ( EQ_16( st_fx->extl, -1 ) || EQ_16( st_fx->extl, SWB_CNG ) || ( EQ_16( st_fx->extl, WB_BWE ) && st_fx->extl_brate == 0 && NE_16( st_fx->coder_type, AUDIO ) ) ) ) ) { -#ifdef FIX_774_ENERGY_BURST hf_synth_fx( st_fx->hBWE_zero, st_fx->core_brate, output_frame, Aq_fx, exc2_fx, syn_fx, synth_out, st_fx->Q_exc, st_fx->Q_syn2, st_fx->hBWE_zero->delay_syn_hf_fx, &st_fx->hBWE_zero->memExp1, st_fx->hBWE_zero->mem_hp_interp_fx, st_fx->extl, st_fx->CNG_mode ); -#else - hf_synth_fx( st_fx->hBWE_zero, st_fx->core_brate, output_frame, Aq_fx, exc2_fx, syn_fx, synth_out, st_fx->Q_exc, - st_fx->Q_syn2, st_fx->hBWE_zero->delay_syn_hf_fx, &hBWE_FD->memExp1, st_fx->hBWE_zero->mem_hp_interp_fx, st_fx->extl, st_fx->CNG_mode ); -#endif } ELSE { diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 7a7db41a750b4a8b4d5178f5be72ab9861d13a94..12be03035a9ff99bee6f25e6542158ccf0125b5f 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -183,21 +183,12 @@ ivas_error acelp_core_dec_ivas_fx( FdCng_decodeSID_ivas_fx( st ); rescale_fdCngDec( st->hFdCngDec, sub( old_NoiseEstExp, st->hFdCngDec->hFdCngCom->sidNoiseEstExp ) ); } -#ifdef IVAS_ENH32_CADENCE_CHANGES FOR( i = 0; i < NPART; i++ ) { st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] = Madd_32_32( Mpy_32_32( STEREO_DFT_FD_FILT_Q31, st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] ), STEREO_DFT_FD_FILT_COMP_Q31, st->hFdCngDec->hFdCngCom->sidNoiseEst[i] ); move32(); } -#else - FOR( i = 0; i < NPART; i++ ) - { - st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] = L_add( Mpy_32_32( STEREO_DFT_FD_FILT_Q31, st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] ), - Mpy_32_32( STEREO_DFT_FD_FILT_COMP_Q31, st->hFdCngDec->hFdCngCom->sidNoiseEst[i] ) ); - move32(); - } -#endif ApplyFdCng_ivas_fx( NULL, 0, NULL, 0, NULL, NULL, NULL, st, 0, 0 ); } ELSE @@ -290,12 +281,8 @@ ivas_error acelp_core_dec_ivas_fx( test(); test(); test(); -#ifdef NON_BE_FIX_807_MASA_DTX_BRSW test(); IF( st->hFdCngDec != NULL && ( EQ_16( st->element_mode, IVAS_CPE_DFT ) || EQ_16( st->element_mode, IVAS_CPE_TD ) ) && ( EQ_32( st->last_core_brate, SID_2k40 ) || st->last_core_brate == FRAME_NO_DATA ) ) -#else - IF( ( EQ_16( st->element_mode, IVAS_CPE_DFT ) || EQ_16( st->element_mode, IVAS_CPE_TD ) ) && ( EQ_32( st->last_core_brate, SID_2k40 ) || st->last_core_brate == FRAME_NO_DATA ) ) -#endif { set16_fx( st->hFdCngDec->hFdCngCom->olapBufferSynth2, 0, FFTLEN ); set16_fx( hStereoCng->olapBufferSynth22_fx, 0, FFTLEN ); @@ -459,11 +446,7 @@ ivas_error acelp_core_dec_ivas_fx( dec = DEC_IVAS; move16(); } -#ifndef FIX_907_MEM_UPDATE_ISSUE - synth_mem_updt2( st->L_frame, st->last_L_frame, st->old_exc_fx, st->mem_syn_r, st->mem_syn2_fx, NULL, dec ); -#else ivas_synth_mem_updt2_fx( st->L_frame, st->last_L_frame, st->old_exc_fx, st->mem_syn_r, st->mem_syn2_fx, NULL, dec ); -#endif Copy( st->old_exc_fx, old_exc_fx, L_EXC_MEM_DEC ); /*Q_exc*/ Copy_Scale_sig( st->mem_syn2_fx, st->mem_syn1_fx, M, sub( -1, st->Q_syn ) ); /*Q-1*/ Copy( st->mem_syn2_fx, st->mem_syn3_fx, M ); /*Q_syn*/ @@ -684,21 +667,12 @@ ivas_error acelp_core_dec_ivas_fx( { assert( nchan_out == 1 ); -#ifdef IVAS_ENH32_CADENCE_CHANGES FOR( i = 0; i < NPART; i++ ) { st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] = Madd_32_32( Mpy_32_32( STEREO_DFT_FD_FILT_Q31, st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] ), STEREO_DFT_FD_FILT_COMP_Q31, st->hFdCngDec->hFdCngCom->sidNoiseEst[i] ); move32(); } -#else - FOR( i = 0; i < NPART; i++ ) - { - st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] = L_add( Mpy_32_32( STEREO_DFT_FD_FILT_Q31, st->hFdCngDec->hFdCngCom->sidNoiseEstLp[i] ), - Mpy_32_32( STEREO_DFT_FD_FILT_COMP_Q31, st->hFdCngDec->hFdCngCom->sidNoiseEst[i] ) ); - move32(); - } -#endif ApplyFdCng_ivas_fx( psyn_fx, st->Q_syn, NULL, 0, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); Word16 new_sidNoiseEstExp = 31 - Q4; move16(); @@ -891,11 +865,7 @@ ivas_error acelp_core_dec_ivas_fx( IF( !tdm_lp_reuse_flag ) { -#ifdef FIX_798_LSF_SECONDARY_CH_MISSING_CODE lsf_dec_ivas_fx( st, tc_subfr, Aq_fx, &LSF_Q_prediction, lsf_new_fx, lsp_new_fx, lsp_mid_fx, tdm_low_rate_mode, tdm_lsfQ_PCh_fx ); -#else - lsf_dec_ivas_fx( st, tc_subfr, Aq_fx, &LSF_Q_prediction, lsf_new_fx, lsp_new_fx, lsp_mid_fx, tdm_low_rate_mode /*, tdm_lsfQ_PCh*/ ); -#endif } ELSE { @@ -962,9 +932,7 @@ ivas_error acelp_core_dec_ivas_fx( Copy( old_exc_s_fx + sub( st->L_frame, M ), st->mem_syn2_fx, M ); Scale_sig( st->mem_syn2_fx, M, st->Q_syn ); /* Q0 -> Q_syn */ Residu3_fx( Aq_fx, old_exc_s_fx, old_exc_fx + sub( L_EXC_MEM_DEC, st->L_frame ), st->L_frame, 0 ); -#ifdef FIX_737_HQ_ACELP_SWITCH_SCALING_ERROR Scale_sig( old_exc_fx + sub( L_EXC_MEM_DEC, st->L_frame ), st->L_frame, st->Q_exc ); /* Q0 -> Q_exc */ -#endif } test(); IF( st->last_core != ACELP_CORE && st->element_mode > EVS_MONO ) @@ -1192,11 +1160,7 @@ ivas_error acelp_core_dec_ivas_fx( i = 1; move16(); test(); -#ifdef FIX_843_LOW_RATE_BWE if ( st->coder_type == INACTIVE && st->element_mode == EVS_MONO ) -#else - if ( st->coder_type == INACTIVE ) -#endif { i = 0; move16(); @@ -1231,20 +1195,11 @@ ivas_error acelp_core_dec_ivas_fx( /*------------------------------------------------------------* * FEC - Estimate the classification information *------------------------------------------------------------*/ - -#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION - FEC_clas_estim_fx( st, st->Opt_AMR_WB, st->L_frame, &st->clas_dec, st->coder_type, pitch_buf_fx, - psyn_fx, &st->lp_ener_FER_fx, &st->decision_hyst, - NULL, NULL, NULL, NULL, 0, NULL, st->core_brate, st->Q_syn, temp_buf_fx, - st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, - 0, 0, 0, st->last_core_brate, st->acelp_cfg.FEC_mode ); -#else FEC_clas_estim_fx( st, st->Opt_AMR_WB, st->L_frame, &st->clas_dec, st->coder_type, pitch_buf_fx, psyn_fx, &st->lp_ener_FER_fx, &st->decision_hyst, NULL, NULL, NULL, NULL, 0, NULL, st->Q_syn, temp_buf_fx, st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, 0, 0, 0, st->last_core_brate, st->acelp_cfg.FEC_mode ); -#endif /*------------------------------------------------------------* * FEC - Estimate pitch *------------------------------------------------------------*/ @@ -1901,11 +1856,7 @@ ivas_error acelp_core_dec_ivas_fx( scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real ); // Q_real scale_sig32( imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_imag ); // Q_imag } -#ifdef FIX_882_LOW_LEVEL_DISCONTINUITIES scale_sig32_r( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); // (Q_real-1) -#else - scale_sig32( st->cldfbSynHB->cldfb_state_fx, st->cldfbSynHB->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); // (Q_real-1) -#endif st->cldfbSynHB->Q_cldfb_state = sub( Q_real, 1 ); move16(); Scale_sig32( save_hb_synth_fx, L_FRAME48k, sub( Q_real, 1 ) ); // Q_real-1 @@ -1984,11 +1935,7 @@ ivas_error acelp_core_dec_ivas_fx( scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real ); // Q_real scale_sig32( imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real ); // Q_real } -#ifdef FIX_882_LOW_LEVEL_DISCONTINUITIES scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) -#else - scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) -#endif st->cldfbSyn->Q_cldfb_state = sub( Q_real, 1 ); move16(); #ifndef MSAN_FIX @@ -2091,11 +2038,7 @@ ivas_error acelp_core_dec_ivas_fx( scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real ); // Q_real scale_sig32( imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real ); // Q_real } -#ifdef FIX_882_LOW_LEVEL_DISCONTINUITIES scale_sig32_r( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) -#else - scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( sub( Q_real, 1 ), Q10 ) ); //(Q_real - 1) -#endif #ifndef MSAN_FIX Scale_sig32( synth_fx, L_FRAME48k, Q_real - 1 ); #endif @@ -2149,45 +2092,18 @@ ivas_error acelp_core_dec_ivas_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 ) ) ) ) ) { -#ifndef FIX_774_ENERGY_BURST - Word16 tmp_exp = 0; - move16(); -#endif #ifdef MSAN_FIX Copy_Scale_sig_32_16( synth_fx, synth_fx16, output_frame, 0 ); // Q0 #else Copy_Scale_sig_32_16( synth_fx, synth_fx16, L_FRAME48k, 0 ); #endif -#ifdef FIX_774_ENERGY_BURST -#ifdef FIX_843_LOW_RATE_BWE hf_synth_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc2_fx, psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &st->hBWE_zero->memExp1, st->hBWE_zero->mem_hp_interp_fx, st->extl, st->CNG_mode ); -#else - hf_synth_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc_fx, - psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &st->hBWE_zero->memExp1, - st->hBWE_zero->mem_hp_interp_fx, st->extl, st->CNG_mode ); -#endif -#else - hf_synth_ivas_fx( st->hBWE_zero, st->core_brate, output_frame, Aq_fx, exc_fx, - psyn_fx, synth_fx16, st->Q_exc, st->Q_syn2, st->hBWE_zero->delay_syn_hf_fx, &tmp_exp, - st->hBWE_zero->mem_hp_interp_fx, st->extl, st->CNG_mode, st->element_mode ); -#endif #ifdef MSAN_FIX Copy_Scale_sig_16_32( synth_fx16, synth_fx, output_frame, 0 ); #else Copy_Scale_sig_16_32( synth_fx16, synth_fx, L_FRAME48k, 0 ); -#endif -#ifndef FIX_774_ENERGY_BURST - IF( st->hBWE_FD != NULL ) - { - st->hBWE_FD->memExp1 = tmp_exp; - move16(); - } - ELSE - { - Scale_sig( st->hBWE_zero->mem_hf_fx, sub( L_FIR, 1 ), -tmp_exp ); - } #endif } ELSE diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index bedc88438dcb6eb8109fde157cf5c8cbbd1bfce5..a40fff278c6d05f714c40b08d0fe4de5123694a1 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -637,9 +637,7 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( MUSIC_POSTFILT_HANDLE hMusicPF; BPF_DEC_HANDLE hBPF; ivas_error error; -#ifdef FIX_907_MEM_UPDATE_ISSUE Word16 Prev_Q_syn_r; -#endif hMusicPF = st_fx->hMusicPF; hBPF = st_fx->hBPF; error = IVAS_ERR_OK; @@ -766,15 +764,11 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( /*------------------------------------------------------------------* * Synthesis *-----------------------------------------------------------------*/ -#ifdef FIX_907_MEM_UPDATE_ISSUE Prev_Q_syn_r = st_fx->Q_syn; move16(); -#endif Rescale_mem( Q_exc, &st_fx->prev_Q_syn, &st_fx->Q_syn, st_fx->mem_syn2_fx, st_fx->mem_syn_clas_estim_fx, 4, &st_fx->mem_deemph_fx, hBPF->pst_old_syn_fx, &hBPF->pst_mem_deemp_err_fx, &st_fx->agc_mem_fx[1], st_fx->hPFstat, 1, 0, NULL ); -#ifdef FIX_907_MEM_UPDATE_ISSUE Scale_sig( st_fx->mem_syn_r, L_SYN_MEM, sub( st_fx->Q_syn, Prev_Q_syn_r ) ); // Q_syn -#endif Copy( st_fx->mem_syn2_fx, tmp1, M ); syn_12k8_fx( st_fx->L_frame, Aq, exc2, syn, tmp1, 1, Q_exc, st_fx->Q_syn ); diff --git a/lib_dec/amr_wb_dec_fx.c b/lib_dec/amr_wb_dec_fx.c index 201347eb93268940cd9eca76b94c3e70877c2d02..c17c0f6030758ed0ed30295fdbf57561aa116d1e 100644 --- a/lib_dec/amr_wb_dec_fx.c +++ b/lib_dec/amr_wb_dec_fx.c @@ -549,19 +549,11 @@ ivas_error amr_wb_dec_fx( * FEC - Estimate the classification information *------------------------------------------------------------*/ -#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION - FEC_clas_estim_fx( st_fx, 1, L_FRAME, &st_fx->clas_dec, st_fx->coder_type, pitch_buf_fx, - syn_fx, &st_fx->lp_ener_FER_fx, - &st_fx->decision_hyst, &st_fx->hAmrwb_IO->UV_cnt_fx, &st_fx->hAmrwb_IO->LT_UV_cnt_fx, &st_fx->hAmrwb_IO->Last_ener_fx, &locattack, st_fx->hAmrwb_IO->lt_diff_etot_fx, - &amr_io_class, st_fx->core_brate, st_fx->Q_syn, &class_para_fx, st_fx->mem_syn_clas_estim_fx, &st_fx->classifier_Q_mem_syn, - 0, 0, 0, st_fx->last_core_brate, -1 ); -#else FEC_clas_estim_fx( st_fx, 1, L_FRAME, &st_fx->clas_dec, st_fx->coder_type, pitch_buf_fx, syn_fx, &st_fx->lp_ener_FER_fx, &st_fx->decision_hyst, &st_fx->hAmrwb_IO->UV_cnt_fx, &st_fx->hAmrwb_IO->LT_UV_cnt_fx, &st_fx->hAmrwb_IO->Last_ener_fx, &locattack, st_fx->hAmrwb_IO->lt_diff_etot_fx, &amr_io_class, st_fx->Q_syn, &class_para_fx, st_fx->mem_syn_clas_estim_fx, &st_fx->classifier_Q_mem_syn, 0, 0, 0, st_fx->last_core_brate, -1 ); -#endif /* update past excitation signals for LD music post-filter */ Copy( hMusicPF->dct_post_old_exc_fx + L_FRAME, hMusicPF->dct_post_old_exc_fx, DCT_L_POST - L_FRAME - OFFSET2 ); /*Q_exc*/ Copy( exc2_fx, hMusicPF->dct_post_old_exc_fx + ( DCT_L_POST - L_FRAME - OFFSET2 ), L_FRAME ); /*Q_exc*/ diff --git a/lib_dec/bass_psfilter.c b/lib_dec/bass_psfilter.c index 9d148712562bfc1ab35be32f8bc92bf3a7db6103..f32e8db9d4e559f4be82e6b8c11618be472fafb6 100644 --- a/lib_dec/bass_psfilter.c +++ b/lib_dec/bass_psfilter.c @@ -571,7 +571,6 @@ void addBassPostFilter_ivas_fx( cldfbAnalysis_ivas_fx( harm_timeIn_fx, tmp_R_fx, tmp_I_fx, samplesToProcess, cldfb ); -#ifdef IVAS_ENH32_CADENCE_CHANGES /* now do the subtraction */ FOR( i = 0; i < nColToProcess; i++ ) { @@ -584,20 +583,6 @@ void addBassPostFilter_ivas_fx( move32(); } } -#else - /* now do the subtraction */ - FOR( i = 0; i < nColToProcess; i++ ) - { - /* loop over low frequency bands */ - FOR( b = 0; b < maxBand; b++ ) - { - rAnalysis_fx[i][b] = L_sub( rAnalysis_fx[i][b], Mpy_32_32( tmp_R_fx[i][b], weights_fx[b] ) ); // Qx - 6 - move32(); - iAnalysis_fx[i][b] = L_sub( iAnalysis_fx[i][b], Mpy_32_32( tmp_I_fx[i][b], weights_fx[b] ) ); // Qx - 6 - move32(); - } - } -#endif return; } diff --git a/lib_dec/cng_dec_fx.c b/lib_dec/cng_dec_fx.c index 258bde6d7a98fd907b09238b70b15fe09f9ff1d6..70b05672f713652ed857a9563844f1069443f739 100644 --- a/lib_dec/cng_dec_fx.c +++ b/lib_dec/cng_dec_fx.c @@ -109,12 +109,8 @@ void CNG_dec_fx( } ELSE { - lsf_dec_fx( st_fx, 0, Aq, &LSF_Q_prediction, lsf_new, lsp_new, 0, 0 -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE - , - NULL -#endif - ); + lsf_dec_fx( st_fx, 0, Aq, &LSF_Q_prediction, lsf_new, lsp_new, 0, 0, + NULL ); /* check IF LSPs may trigger too much synthesis energy */ E_LPC_f_lsp_a_conversion( lsp_new, Aq_tmp, M ); @@ -808,12 +804,8 @@ void CNG_dec_ivas_fx( } ELSE { - lsf_dec_ivas_fx( st_fx, 0, Aq, &LSF_Q_prediction, lsf_new, lsp_new, 0, 0 -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE - , - NULL -#endif - ); + lsf_dec_ivas_fx( st_fx, 0, Aq, &LSF_Q_prediction, lsf_new, lsp_new, 0, 0, + NULL ); /* check IF LSPs may trigger too much synthesis energy */ E_LPC_f_lsp_a_conversion( lsp_new, Aq_tmp, M ); diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index b723bea2c82955641d129408d0e8d10a4583365e..6842fe16f7f591e5b23127bdb7a392f529f37660 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -1685,11 +1685,7 @@ void open_decoder_LPD_ivas_fx( move16(); IF( !st->last_con_tcx ) { -#ifndef FIX_907_MEM_UPDATE_ISSUE - ivas_synth_mem_updt2_fx( st->L_frame, st->last_L_frame, st->old_exc_fx, st->mem_syn_r, st->mem_syn2_fx, NULL, DEC, st->Q_syn ); -#else ivas_synth_mem_updt2_fx( st->L_frame, st->last_L_frame, st->old_exc_fx, st->mem_syn_r, st->mem_syn2_fx, NULL, DEC ); -#endif } /*mem of deemphasis stayed unchanged.*/ diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 47ab012a9d332c717f90105df617394403f8c15c..9a1e0202ceaed50c5d1ee18f2e73c62364b0b1af 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -88,20 +88,6 @@ ivas_error core_switching_pre_dec_ivas_fx( test(); IF( EQ_16( st->last_codec_mode, MODE2 ) || ( ( EQ_16( st->last_core, TCX_20_CORE ) || EQ_16( st->last_core, TCX_10_CORE ) ) && ( st->element_mode > EVS_MONO ) ) ) { -#ifndef FIX_770_DISCONTINUITIES_SW_TCX2ACELP - Copy( st->mem_syn2_fx, st->mem_syn1_fx, M ); - set16_fx( st->agc_mem_fx, 0, 2 ); - st->mem_deemph_fx = st->syn[M]; - move16(); - st->bpf_off = 1; - move16(); - IF( st->hBPF != NULL ) - { - set16_fx( st->hBPF->pst_old_syn_fx, 0, NBPSF_PIT_MAX ); - st->hBPF->pst_mem_deemp_err_fx = 0; - move32(); - } -#else st->mem_deemph_fx = st->syn[M]; move16(); set16_fx( st->agc_mem_fx, 0, 2 ); @@ -125,7 +111,6 @@ ivas_error core_switching_pre_dec_ivas_fx( move16(); move16(); } -#endif st->psf_lp_noise_fx = round_fx( L_shl( st->lp_noise, 1 ) ); // Q(23+1-16)->Q8 move16(); diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index d1ace99f7ad36e07e8f5dded56b1b07ec759c6ef..9fe83efc7ca3a6892c99063fb394eb746d6e452a 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -2165,16 +2165,9 @@ ivas_error core_switching_post_dec_ivas_fx( test(); test(); -#ifdef FIX_747_TDBWE_ENERGY_BURST IF( ( ( EQ_16( st_fx->extl, SWB_TBE ) || EQ_16( st_fx->extl, FB_TBE ) || EQ_16( st_fx->extl, SWB_CNG ) ) && ( NE_16( st_fx->L_frame, st_fx->last_L_frame ) || ( NE_16( st_fx->last_extl, SWB_TBE ) && NE_16( st_fx->last_extl, FB_TBE ) && NE_16( st_fx->last_core, TCX_20_CORE ) && NE_16( st_fx->last_core, TCX_10_CORE ) ) || EQ_16( st_fx->last_core, HQ_CORE ) ) ) || ( LT_16( st_fx->bwidth, st_fx->last_bwidth ) && NE_16( st_fx->last_extl, SWB_TBE ) ) || st_fx->old_ppp_mode || ( ( EQ_16( st_fx->prev_coder_type, AUDIO ) || EQ_16( st_fx->prev_coder_type, INACTIVE ) ) && st_fx->bws_cnt > 0 ) || ( st_fx->bws_cnt == 0 && EQ_16( st_fx->prev_bws_cnt, N_WS2N_FRAMES ) ) ) -#else - IF( ( ( EQ_16( st_fx->extl, SWB_TBE ) || EQ_16( st_fx->extl, FB_TBE ) || EQ_16( st_fx->extl, SWB_CNG ) ) && - ( NE_16( st_fx->L_frame, st_fx->last_L_frame ) || ( NE_16( st_fx->last_extl, SWB_TBE ) && NE_16( st_fx->last_extl, FB_TBE ) ) || EQ_16( st_fx->last_core, HQ_CORE ) ) ) || - ( LT_16( st_fx->bwidth, st_fx->last_bwidth ) && NE_16( st_fx->last_extl, SWB_TBE ) ) || st_fx->old_ppp_mode || ( ( EQ_16( st_fx->prev_coder_type, AUDIO ) || EQ_16( st_fx->prev_coder_type, INACTIVE ) ) && st_fx->bws_cnt > 0 ) || ( st_fx->bws_cnt == 0 && EQ_16( st_fx->prev_bws_cnt, N_WS2N_FRAMES ) ) ) - -#endif { swb_tbe_reset_fx( hBWE_TD->mem_csfilt_fx, hBWE_TD->mem_genSHBexc_filt_down_shb_fx, hBWE_TD->state_lpc_syn_fx, hBWE_TD->syn_overlap_fx, hBWE_TD->state_syn_shbexc_fx, &( hBWE_TD->tbe_demph_fx ), &( hBWE_TD->tbe_premph_fx ), hBWE_TD->mem_stp_swb_fx, &( hBWE_TD->gain_prec_swb_fx ) ); @@ -2486,9 +2479,6 @@ static void smoothTransitionDtxToTcx_fx( /* apply fades around transition */ step = div_s( 1, delay_comp ); -#ifndef FIX_680_CNG_FRAME_BOUNDARIES_ISSUE /* Step has to be in Q15, not in Q13 */ - step = shr( step, 2 ); -#endif fade_in = extract_l( 0 ); FOR( i = 0; i < delay_comp; i++ ) { diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c index 8e65aaa8ef170697e105f6ce919ed7637082555b..516662308ab44ef0451bd6bd7aa5881bc0d31321 100644 --- a/lib_dec/dec_LPD_fx.c +++ b/lib_dec/dec_LPD_fx.c @@ -826,7 +826,6 @@ void decoder_LPD_fx( } -#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION FEC_clas_estim_fx( st, /*Opt_AMR_WB*/ 0, /*A*/ @@ -843,7 +842,6 @@ void decoder_LPD_fx( /**locattack*/ NULL, /* i/o: detection of attack (mainly to localized speech burst) */ /**lt_diff_etot*/ NULL, /* i/o: long-term total energy variation */ /**amr_io_class*/ NULL, /* i/o: classification for AMR-WB IO mode */ - /*bitrate*/ 0, /* i : Decoded bitrate */ 0, /* i : Synthesis scaling */ /**class_para*/ NULL, /* o : classification para. fmerit1 */ st->mem_syn_clas_estim_fx, /* i/o: memory of the synthesis signal for frame class estimation */ @@ -853,33 +851,6 @@ void decoder_LPD_fx( bfi, /* i : bad frame indicator */ st->last_core_brate, /* i : bitrate of previous frame */ -1 ); -#else - FEC_clas_estim_fx( - st, - /*Opt_AMR_WB*/ 0, /*A*/ - st->L_frame, - &( st->clas_dec ), - core_ext_mode, - pitch_C, - synth, - &st->lp_ener_FER_fx, - /**decision_hyst*/ NULL, /* i/o: hysteresis of the music/speech decision */ - /**UV_cnt*/ NULL, /* i/o: number of consecutive frames classified as */ - /**LT_UV_cnt*/ NULL, /* i/o: long term consecutive frames classified as UV */ - /**Last_ener*/ NULL, /* i/o: last_energy frame */ - /**locattack*/ NULL, /* i/o: detection of attack (mainly to localized speech burst) */ - /**lt_diff_etot*/ NULL, /* i/o: long-term total energy variation */ - /**amr_io_class*/ NULL, /* i/o: classification for AMR-WB IO mode */ - 0, /* i : Synthesis scaling */ - /**class_para*/ NULL, /* o : classification para. fmerit1 */ - st->mem_syn_clas_estim_fx, /* i/o: memory of the synthesis signal for frame class estimation */ - &st->classifier_Q_mem_syn, /* i/o: exponent for memory of synthesis signal for frame class estimation */ - LTP_Gain, /* i : means LTP Gain */ - 1 /*CLASSIFIER_TCX*/, /* i : signal classifier mode */ - bfi, /* i : bad frame indicator */ - st->last_core_brate, /* i : bitrate of previous frame */ - -1 ); -#endif } } diff --git a/lib_dec/dec_ace_fx.c b/lib_dec/dec_ace_fx.c index 81f2f14fd323aeafe8cf57fe44f44fd6cc85c6e1..864c87805eec1c351b526557bf40181b6408913b 100644 --- a/lib_dec/dec_ace_fx.c +++ b/lib_dec/dec_ace_fx.c @@ -659,17 +659,10 @@ void decoder_acelp_fx( move16(); } -#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION - FEC_clas_estim_fx( st, /*Opt_AMR_WB*/ 0, st->L_frame, &( st->clas_dec ), st->core_ext_mode, pit16, syn, - &st->lp_ener_FER_fx, /**decision_hyst*/ NULL, /**UV_cnt*/ NULL, /**LT_UV_cnt*/ NULL, /**Last_ener*/ NULL, /**locattack*/ NULL, - /**lt_diff_etot*/ NULL, /**amr_io_class*/ NULL, /*bitrate*/ 0, st->Q_syn, /**class_para*/ NULL, st->mem_syn_clas_estim_fx, - &st->classifier_Q_mem_syn, -32768 /*-1.f Q15*/, 0 /*CLASSIFIER_ACELP*/, 0 /*bfi*/, st->last_core_brate, -1 ); -#else FEC_clas_estim_fx( st, /*Opt_AMR_WB*/ 0, st->L_frame, &( st->clas_dec ), st->core_ext_mode, pit16, syn, &st->lp_ener_FER_fx, /**decision_hyst*/ NULL, /**UV_cnt*/ NULL, /**LT_UV_cnt*/ NULL, /**Last_ener*/ NULL, /**locattack*/ NULL, /**lt_diff_etot*/ NULL, /**amr_io_class*/ NULL, st->Q_syn, /**class_para*/ NULL, st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, -32768 /*-1.f Q15*/, 0 /*CLASSIFIER_ACELP*/, 0 /*bfi*/, st->last_core_brate, -1 ); -#endif } /* Update Pitch Lag memory */ diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 29d4b5e1ffb99759255fe7dce3e490d658180b5b..33b967071aa80adc835e5f989ddcad6a251296f9 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -4609,38 +4609,11 @@ void decoder_tcx_noisefilling_fx( nf_seed = extract_l( tmp32 ); } pInfoTCXNoise = NULL; -#ifndef FIX_ISSUE_723_INFO_TCX_NOISE - Word16 tmp_infoTCXNoiseBuf[IGF_START_MX]; - if ( st->igf ) - { - for ( int j = 0; j < IGF_START_MX; j++ ) - { - tmp_infoTCXNoiseBuf[j] = (Word16) st->hIGFDec->infoTCXNoise[j]; - } - pInfoTCXNoise = tmp_infoTCXNoiseBuf; - move16(); - } -#else if ( st->igf ) { pInfoTCXNoise = st->hIGFDec->infoTCXNoise_ptr; } -#endif tcx_noise_filling_with_shift( x, x_e, nf_seed, firstLine, noiseFillingSize, noiseTransWidth, L_frame, noiseTiltFactor, fac_ns, pInfoTCXNoise, st->element_mode ); - -#ifndef FIX_ISSUE_723_INFO_TCX_NOISE - if ( pInfoTCXNoise ) - { - for ( int j = 0; j < IGF_START_MX; j++ ) - { -#ifndef FIX_ISSUE_723_INFO_TCX_NOISE - st->hIGFDec->infoTCXNoise[j] = (UWord8) tmp_infoTCXNoiseBuf[j]; -#else - st->hIGFDec->infoTCXNoise_evs[j] = (UWord8) tmp_infoTCXNoiseBuf[j]; -#endif - } - } -#endif st->seed_tcx_plc = nf_seed; move16(); } diff --git a/lib_dec/dec_tran_fx.c b/lib_dec/dec_tran_fx.c index a9ea119ba5e99585ba43805b0a23cd2b10c1509c..c597f683b66a5ed21223da5d6e80d534ebf81d25 100644 --- a/lib_dec/dec_tran_fx.c +++ b/lib_dec/dec_tran_fx.c @@ -7,12 +7,10 @@ #include "prot_fx.h" /* Function prototypes */ #ifdef IVAS_FLOAT_FIXED -#ifdef FIX_810_PREVENT_UNECESSARY_SAT_IN_TC #define Q3_4 ( 4 << Q3 ) #define Q3_17 ( 17 << Q3 ) #define Q16_8 ( 8 << Q16 ) #define Q16_30 ( 30 << Q16 ) -#endif /*======================================================================*/ /* FUNCTION : decod_tran_fx() */ @@ -188,7 +186,6 @@ void decod_tran_fx( /*----------------------------------------------------------------------* * Find the total excitation *----------------------------------------------------------------------*/ -#ifdef FIX_810_PREVENT_UNECESSARY_SAT_IN_TC test(); test(); test(); @@ -208,7 +205,6 @@ void decod_tran_fx( move16(); } } -#endif IF( EQ_16( L_frame_fx, L_FRAME ) ) /* Rescaling for 12.8k core */ { Rescale_exc( hMusicPF->dct_post_old_exc_fx, &exc_fx[i_subfr], &bwe_exc_fx[( ( i_subfr * 2 * HIBND_ACB_L_FAC ) >> 1 )], hGSCDec->last_exc_dct_in_fx, diff --git a/lib_dec/dlpc_stoch_fx.c b/lib_dec/dlpc_stoch_fx.c index 6583c91de99e8f71c5efafefd99e1fa83764fdd1..af0e9ee3aaf425e8c4c15c780c066c2f19f861ca 100644 --- a/lib_dec/dlpc_stoch_fx.c +++ b/lib_dec/dlpc_stoch_fx.c @@ -47,32 +47,20 @@ void lpc_unquantize_fx( test(); IF( ( EQ_32( st->sr_core, INT_FS_16k ) ) && ( EQ_16( coder_type, UNVOICED ) ) ) { - lsf_end_dec_fx( st, 1, GENERIC, sub( 1, st->narrowBand ) /* st->bwidth */, ENDLSF_NBITS, &lsf[m], param_lpc, LSF_Q_prediction, &nb_indices -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE - , - NULL -#endif - ); + lsf_end_dec_fx( st, 1, GENERIC, sub( 1, st->narrowBand ) /* st->bwidth */, ENDLSF_NBITS, &lsf[m], param_lpc, LSF_Q_prediction, &nb_indices, + NULL ); } ELSE { IF( EQ_16( st->core, TCX_20_CORE ) ) { - lsf_end_dec_fx( st, 1, AUDIO, sub( 1, st->narrowBand ) /* st->bwidth */, ENDLSF_NBITS, &lsf[m], param_lpc, LSF_Q_prediction, &nb_indices -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE - , - NULL -#endif - ); + lsf_end_dec_fx( st, 1, AUDIO, sub( 1, st->narrowBand ) /* st->bwidth */, ENDLSF_NBITS, &lsf[m], param_lpc, LSF_Q_prediction, &nb_indices, + NULL ); } ELSE { - lsf_end_dec_fx( st, 1, coder_type, sub( 1, st->narrowBand ) /* st->bwidth */, ENDLSF_NBITS, &lsf[m], param_lpc, LSF_Q_prediction, &nb_indices -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE - , - NULL -#endif - ); + lsf_end_dec_fx( st, 1, coder_type, sub( 1, st->narrowBand ) /* st->bwidth */, ENDLSF_NBITS, &lsf[m], param_lpc, LSF_Q_prediction, &nb_indices, + NULL ); } } diff --git a/lib_dec/er_dec_acelp_fx.c b/lib_dec/er_dec_acelp_fx.c index 3d2fdee1cbff346020cada7cf88f2c394c118839..6ef740761f9173a17f3c4697a55aaf37ca405aa2 100644 --- a/lib_dec/er_dec_acelp_fx.c +++ b/lib_dec/er_dec_acelp_fx.c @@ -1015,7 +1015,6 @@ void con_acelp_fx( move16(); } -#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION FEC_clas_estim_fx( st, /*Opt_AMR_WB*/ 0, /*A*/ @@ -1032,7 +1031,6 @@ void con_acelp_fx( /**locattack*/ NULL, /* i/o: detection of attack (mainly to localized speech burst) */ /**lt_diff_etot*/ NULL, /* i/o: long-term total energy variation */ /**amr_io_class*/ NULL, /* i/o: classification for AMR-WB IO mode */ - /*bitrate*/ 0, /* i : Decoded bitrate */ Qf_syn, /* i : Synthesis scaling */ /**class_para*/ NULL, /* o : classification para. fmerit1 */ st->mem_syn_clas_estim_fx, /* i/o: memory of the synthesis signal for frame class estimation */ @@ -1042,33 +1040,6 @@ void con_acelp_fx( 1 /*bfi*/, /* i : bad frame indicator */ st->last_core_brate, /* i : bitrate of previous frame */ -1 ); -#else - FEC_clas_estim_fx( - st, - /*Opt_AMR_WB*/ 0, /*A*/ - st->L_frame, - &( st->clas_dec ), - coder_type, - pit16, - syn, - &st->lp_ener_FER_fx, - /**decision_hyst*/ NULL, /* i/o: hysteresis of the music/speech decision */ - /**UV_cnt*/ NULL, /* i/o: number of consecutives frames classified as UV */ - /**LT_UV_cnt*/ NULL, /* i/o: long term consecutives frames classified as UV */ - /**Last_ener*/ NULL, /* i/o: last_energy frame */ - /**locattack*/ NULL, /* i/o: detection of attack (mainly to localized speech burst) */ - /**lt_diff_etot*/ NULL, /* i/o: long-term total energy variation */ - /**amr_io_class*/ NULL, /* i/o: classification for AMR-WB IO mode */ - Qf_syn, /* i : Synthesis scaling */ - /**class_para*/ NULL, /* o : classification para. fmerit1 */ - st->mem_syn_clas_estim_fx, /* i/o: memory of the synthesis signal for frame class estimation */ - &st->classifier_Q_mem_syn, /*i/o : exponent for memory of synthesis signal for frame class estimation */ - -32768 /*-1.f Q15*/, /* i : LTP Gain */ - 0 /*CLASSIFIER_ACELP*/, /* i : signal classifier mode */ - 1 /*bfi*/, /* i : bad frame indicator */ - st->last_core_brate, /* i : bitrate of previous frame */ - -1 ); -#endif } /* Update Pitch Lag memory */ diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index bba782c1f8e585e1574eba22161fad79ad5a323d..c1d6382b647f9cfa00ad44f37b2e77ee7645c54c 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -2698,12 +2698,8 @@ void perform_noise_estimation_dec_ivas_fx( } ELSE { -#ifdef IVAS_ENH32_CADENCE_CHANGES temp = L_shl( msPeriodog[p], q_shift ); /*Q31 - hFdCngDec->hFdCngCom->periodog_exp*/ hFdCngDec->msPeriodog_ST_fx[p] = Madd_32_16( Mpy_32_16_1( hFdCngDec->msPeriodog_ST_fx[p], ST_PERIODOG_FACT_Q15 ), temp, MAX_16 - ST_PERIODOG_FACT_Q15 ); /*Q31 - hFdCngDec->msPeriodog_ST_exp*/ -#else - hFdCngDec->msPeriodog_ST_fx[p] = L_add( Mpy_32_16_1( hFdCngDec->msPeriodog_ST_fx[p], ST_PERIODOG_FACT_Q15 ), Mpy_32_16_1( temp, sub( MAX_16, ST_PERIODOG_FACT_Q15 ) ) ); -#endif move32(); } } @@ -2790,11 +2786,7 @@ void perform_noise_estimation_dec_ivas_fx( FOR( p = 0; p < npart; p++ ) { temp = L_shl( msPeriodog[p], q_shift ); -#ifdef IVAS_ENH32_CADENCE_CHANGES msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], sub( MAX_16, alpha ) ), temp, alpha ); /*Q31 - hFdCngDec->msNoiseEst_exp*/ -#else - msNoiseEst[p] = L_add( Mpy_32_16_1( msNoiseEst[p], sub( MAX_16, alpha ) ), Mpy_32_16_1( temp, alpha ) ); -#endif move32(); } } @@ -2866,11 +2858,7 @@ void perform_noise_estimation_dec_ivas_fx( L_tmp = L_shr( msPeriodog[p], sub( sub( 31, hFdCngDec->hFdCngCom->periodog_exp ), 4 ) ); IF( LT_32( L_tmp, msNoiseEst[p] ) ) { -#ifdef IVAS_ENH32_CADENCE_CHANGES msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], wght ), L_tmp, (Word16) L_sub( shr( MAX_16, sub( 15, scale ) ), wght ) ); /*temp_q_msNoiseEst[p]*/ -#else - msNoiseEst[p] = L_add( Mpy_32_16_1( msNoiseEst[p], wght ), Mpy_32_16_1( L_tmp, (Word16) L_sub( shr( MAX_16, sub( 15, scale ) ), wght ) ) ); -#endif move32(); temp_q_msNoiseEst[p] = sub( add( hFdCngDec->msNoiseEst_exp, scale ), 15 ); move16(); @@ -2893,11 +2881,7 @@ void perform_noise_estimation_dec_ivas_fx( L_tmp = L_shr_sat( hFdCngDec->msPeriodog_ST_fx[p], sub( hFdCngDec->msNoiseEst_exp, hFdCngDec->msPeriodog_ST_exp ) ); /*Q31 - hFdCngDec->msPeriodog_ST_exp*/ IF( LT_32( L_tmp, msNoiseEst[p] ) ) { -#ifdef IVAS_ENH32_CADENCE_CHANGES msNoiseEst[p] = Madd_32_16( Mpy_32_16_1( msNoiseEst[p], CNA_ACT_DN_FACT_Q15 ), L_tmp, ONE_IN_Q15 - CNA_ACT_DN_FACT_Q15 ); /*Q31 - hFdCngDec->msNoiseEst_exp*/ -#else - msNoiseEst[p] = L_add( Mpy_32_16_1( msNoiseEst[p], CNA_ACT_DN_FACT_Q15 ), Mpy_32_16_1( L_tmp, ONE_IN_Q15 - CNA_ACT_DN_FACT_Q15 ) ); -#endif move32(); } } @@ -2978,7 +2962,6 @@ void perform_noise_estimation_dec_ivas_fx( *ptr_per = 0; move32(); } -#ifdef IVAS_ENH32_CADENCE_CHANGES IF( enr ) { q_shift = sub( enr_e, hFdCngDec->msNoiseEst_exp ); @@ -2999,9 +2982,6 @@ void perform_noise_estimation_dec_ivas_fx( } *ptr_per = Madd_32_16( ( *ptr_per ), enr, sub( MAX_16, alpha ) ); /*Q31 - enr_e*/ move32(); -#else - *ptr_per = L_add( ( *ptr_per ), Mpy_32_16_1( enr, sub( MAX_16, alpha ) ) ); -#endif ptr_per++; } diff --git a/lib_dec/gain_dec_fx.c b/lib_dec/gain_dec_fx.c index e118b787dd0770d5764960a0b96a00cbd06214d9..c1566bf41566f7b08db7f8e196d3fe00e3b7d796 100644 --- a/lib_dec/gain_dec_fx.c +++ b/lib_dec/gain_dec_fx.c @@ -1658,26 +1658,13 @@ Word32 gain_dec_gaus_fx( /* o : quantized codebook { Word16 stepSize, gain, expg, frac, expi, tmp_igi; Word32 L_tmp, L_enr_q, L_gain; -#ifdef FIX_869_WRONG_UVGAIN_STEP Word16 stepSize_Exp; stepSize_Exp = 14; move16(); -#endif /*------------------------------------------------------------------------------------------* * Quantize linearly the log E *------------------------------------------------------------------------------------------*/ -#ifndef FIX_869_WRONG_UVGAIN_STEP - stepSize = shl( sub( topBound, lowBound ), sub( 14, bits ) ); /* Q14 */ - - /*------------------------------------------------------------------------------------------* - * Gaussian codebook gain - *------------------------------------------------------------------------------------------*/ - /* enr_q = (float)index*stepSize ,lowBound); */ - L_enr_q = L_mult( index, stepSize ); /* Q0 * Q14 -> Q15 */ - L_enr_q = L_shl( L_enr_q, 9 ); /* Q15 -> Q24 */ - L_enr_q = L_add( L_enr_q, L_shl( L_deposit_h( lowBound ), 8 ) ); /* Q24 */ -#else if ( EQ_16( bits, 6 ) ) { stepSize_Exp = sub( stepSize_Exp, 1 ); @@ -1692,7 +1679,6 @@ Word32 gain_dec_gaus_fx( /* o : quantized codebook L_enr_q = L_mult( index, stepSize ); /* Q0 * QstepSize_Exp -> QstepSize_Exp+1 */ L_enr_q = L_shl( L_enr_q, sub( 24 - 1, stepSize_Exp ) ); /* QstepSize_Exp+1 -> Q24 */ L_enr_q = L_add( L_enr_q, L_shl( L_deposit_h( lowBound ), 8 ) ); /* Q24 */ -#endif /*------------------------------------------------------------* * gain = pow(10.0, enr/20) * = pow(2, 3.321928*enr/20) @@ -1710,7 +1696,7 @@ Word32 gain_dec_gaus_fx( /* o : quantized codebook #ifdef BASOP_NOGLOB L_gain = L_shl_sat( L_gain, expg ); /* In Q16*/ #else - L_gain = L_shl( L_gain, expg ); /* In Q16*/ + L_gain = L_shl( L_gain, expg ); /* In Q16*/ #endif /* *norm_gain_code = gain / *inv_gain_inov;*/ expi = norm_s( inv_gain_inov ); diff --git a/lib_dec/gs_dec.c b/lib_dec/gs_dec.c index dccecfe0c0624ec3e1f05dc2c261784f68eca130..69bcd1de5a4d951dcd5879fd379aa10a5f69869e 100644 --- a/lib_dec/gs_dec.c +++ b/lib_dec/gs_dec.c @@ -639,11 +639,7 @@ void gsc_dec( } if ( concat_out[j] < 0 ) { -#ifdef FIX_1027_GSC_INT_OVERFLOW seed_init = (int16_t) ( (int32_t) seed_init + 3 ); -#else - seed_init += 3; -#endif } } diff --git a/lib_dec/hf_synth_fx.c b/lib_dec/hf_synth_fx.c index 9af04d1f22cb2b4b12ca4e2aec494612ad792dba..e931ae229eafdbb14229cc16da6c2620fa4ba92e 100644 --- a/lib_dec/hf_synth_fx.c +++ b/lib_dec/hf_synth_fx.c @@ -21,14 +21,7 @@ *---------------------------------------------------------------------*/ static void filt_6k_7k_scale_fx( Word16 signal[], Word16 lg, Word16 mem[], Word16 fact, Word16 exp ); - static void hf_synthesis_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word32 core_brate, const Word16 output_subfr, const Word16 Aq[], const Word16 exc[], const Word16 Q_exc, Word16 synth[], Word16 synth16k[], const Word16 Q_syn, Word16 *delay_syn_hf, Word16 *memExp1, Word16 *mem_hp_interp, const Word16 extl, const Word16 CNG_mode ); -#ifndef FIX_774_ENERGY_BURST -#ifdef IVAS_FLOAT_FIXED -static void hf_synthesis_ivas_fx( ZERO_BWE_DEC_HANDLE hBWE_zero, const Word32 core_brate, const Word16 output_subfr, const Word16 Aq[], const Word16 exc[], const Word16 Q_exc, Word16 synth[], Word16 synth16k[], const Word16 Q_syn, Word16 *delay_syn_hf, Word16 *memExp1, Word16 *mem_hp_interp, const Word16 extl, const Word16 CNG_mode, Word16 element_mode ); -#endif -#endif - static void hf_synthesis_amr_wb_fx( const Word32 core_brate, const Word16 output_subfr, const Word16 Ap[], Word16 exc16k[], Word16 synth_out[], Word16 *mem_syn_hf, Word16 *delay_syn_hf, Word16 *mem_hp_interp, Word16 p_r, Word16 HF_corr_gain, Word16 til, Word16 voice_factors, const Word16 exc[], const Word16 Q_exc, const Word16 Q_out, Word16 qhf ); static void envelope_fx( AMRWB_IO_DEC_HANDLE hAmrwb_IO, const Word32 core_brate, const Word16 Aq[], Word16 Ap[], Word16 *r, Word16 tilt0, Word16 tilt, Word16 voice_factor ); static void AdaptiveStartBand_fx( Word16 *start_band, const Word32 rate, const Word16 *lsf, const Word16 voicing_fac, const Word16 clas, Word16 *voicing_flag, Word16 *start_band_old, Word32 *OptCrit_old ); @@ -53,10 +46,8 @@ void hf_synth_init_fx( set16_fx( hBWE_zero->mem_hp400_fx, 0, 4 ); set16_fx( hBWE_zero->delay_syn_hf_fx, 0, NS2SA( 16000, DELAY_CLDFB_NS ) ); set16_fx( hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN ); -#ifdef FIX_774_ENERGY_BURST hBWE_zero->memExp1 = 0; move16(); -#endif return; } void hf_synth_reset_fx( @@ -76,10 +67,8 @@ void hf_synth_reset_fx( set16_fx( hBWE_zero->delay_syn_hf_fx, 0, NS2SA( 16000, DELAY_CLDFB_NS ) ); set16_fx( hBWE_zero->mem_hp_interp_fx, 0, INTERP_3_1_MEM_LEN ); -#ifdef FIX_774_ENERGY_BURST hBWE_zero->memExp1 = 0; move16(); -#endif return; } @@ -123,46 +112,7 @@ void hf_synth_fx( return; } -#ifndef FIX_774_ENERGY_BURST -#ifdef IVAS_FLOAT_FIXED -void hf_synth_ivas_fx( - ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */ - const Word32 core_brate, /* i : core bitrate */ - const Word16 output_frame, /* i : output frame length */ - const Word16 *Aq, /* i : quantized Az */ - const Word16 *exc, /* i : excitation at 12.8 kHz */ - Word16 *synth, /* i : 12.8kHz synthesis signal */ - Word16 *synth16k, /* o : 16kHz synthesis signal */ - const Word16 Q_exc, /* i : excitation scaling */ - const Word16 Q_syn2, /* i : synthesis scaling */ - Word16 *delay_syn_hf, /*i/o: HF synthesis memory */ - Word16 *memExp1, /* o : HF excitation exponent */ - Word16 *mem_hp_interp, /* i/o: interpol. memory */ - const Word16 extl, /* i : flag indicating BWE */ - const Word16 CNG_mode, /* i : CNG_mode */ - Word16 element_mode ) -{ - const Word16 *p_Aq; - Word16 i_subfr, output_subfr; - - output_subfr = output_frame / NB_SUBFR; - move16(); - p_Aq = Aq; - move16(); - - FOR( i_subfr = 0; i_subfr < L_FRAME; i_subfr += L_SUBFR ) - { - hf_synthesis_ivas_fx( hBWE_zero, core_brate, output_subfr, p_Aq, &exc[i_subfr], Q_exc, &synth[i_subfr], &synth16k[i_subfr * output_subfr / L_SUBFR], - Q_syn2, delay_syn_hf, memExp1, mem_hp_interp, extl, CNG_mode, element_mode ); - p_Aq += ( M + 1 ); - move16(); - } - - return; -} -#endif -#endif /*-----------------------------------------------------------------------------------* * hf_synthesis() * @@ -391,234 +341,6 @@ static void hf_synthesis_fx( return; } -#ifndef FIX_774_ENERGY_BURST -#ifdef IVAS_FLOAT_FIXED -static void hf_synthesis_ivas_fx( - ZERO_BWE_DEC_HANDLE hBWE_zero, - const Word32 core_brate, /* i : core bitrate */ - const Word16 output_subfr, /* i : output sub-frame length */ - const Word16 Aq[], /* i : quantized Az Q12 */ - const Word16 exc[], /* i : excitation at 12.8 kHz Q_exc */ - const Word16 Q_exc, /* i : excitation scaling */ - Word16 synth[], /* i : 12.8kHz synthesis signal Q_syn */ - Word16 synth16k[], /* i/o: 16kHz synthesis signal Q_syn */ - const Word16 Q_syn, /* i : synthesis scaling */ - Word16 *delay_syn_hf, /* i/o: HF synthesis memory Q_syn */ - Word16 *memExp1, /* o : HF excitation scaling exponent */ - Word16 *mem_hp_interp, /* i/o: interpol. memory */ - const Word16 extl, /* i : flag indicating BWE */ - const Word16 CNG_mode, /* i : CNG_mode */ - Word16 element_mode ) -{ - Word16 i; - Word16 HF_syn[L_SUBFR16k], upsampled_HF_syn[L_FRAME48k / NB_SUBFR]; - Word16 HF_exc[L_SUBFR16k]; - Word16 temp_buffer[NS2SA( 16000, DELAY_CLDFB_NS ) - L_FILT16k]; - Word16 tmp, ener, exp1, exp2, scale, delay; - Word32 L_tmp; - Word16 Ap[M16k + 1]; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif - (void) extl; - (void) CNG_mode; - - /*-----------------------------------------------------------------* - * generate white noise vector - *-----------------------------------------------------------------*/ - - Random_Fill( &hBWE_zero->seed2, L_SUBFR16k, HF_exc, 3 ); /* 3 = Shift Right by 3 */ - - /* o: HF_exc in Q-3 */ - - /*-----------------------------------------------------------------* - * calculate energy scaling factor so that white noise would have the - * same energy as exc12k8 - *-----------------------------------------------------------------*/ - - /*ener = sum2_f( exc, L_SUBFR ) + 0.01f*/ - ener = extract_h( Dot_product12( exc, exc, L_SUBFR, &exp2 ) ); - exp2 = sub( exp2, add( Q_exc, Q_exc ) ); - - /*tmp = round_fx(Dot_product12(HF_exc, HF_exc, output_subfr, &exp1)); */ - L_tmp = Dot_product12( HF_exc, HF_exc, L_SUBFR16k, &exp1 ); - tmp = round_fx( L_tmp ); - /* tmp = (float)(sqrt(ener/tmp)) */ - /* scale is -1 if tmp > ener */ - scale = shr( sub( ener, tmp ), 15 ); - tmp = shl( tmp, scale ); - exp1 = sub( exp1, scale ); - - tmp = div_s( tmp, ener ); - exp1 = sub( exp1, exp2 ); - - L_tmp = L_deposit_h( tmp ); - - L_tmp = Isqrt_lc( L_tmp, &exp1 ); - scale = round_fx( L_tmp ); /* Q18 when Q_exc=-1, HF_exc in Q-3 */ - - exp2 = sub( *memExp1, exp1 ); - move16(); - *memExp1 = exp1; - move16(); - - /*-----------------------------------------------------------------* - * calculate energy scaling factor to respect tilt of synth12k8 - * (tilt: 1=voiced, -1=unvoiced) - *-----------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED - IF( element_mode == EVS_MONO ) - { - hp400_12k8_fx( synth, L_SUBFR, hBWE_zero->mem_hp400_fx ); - } - ELSE - { - hp400_12k8_ivas_fx( synth, L_SUBFR, hBWE_zero->mem_hp400_fx ); - } -#else - hp400_12k8_fx( synth, L_SUBFR, hBWE_zero->mem_hp400_fx ); -#endif - /* i: mem_hp400 in Q_syn */ - /* i: synth in Q_syn */ - /* o: synth in Q_syn-3 */ - - L_tmp = L_mac( 1L, synth[0], synth[0] ); - FOR( i = 1; i < L_SUBFR; i++ ) - { -#ifdef BASOP_NOGLOB - L_tmp = L_mac_sat( L_tmp, synth[i], synth[i] ); -#else - L_tmp = L_mac( L_tmp, synth[i], synth[i] ); -#endif - } - tmp = norm_l( L_tmp ); - ener = extract_h( L_shl( L_tmp, tmp ) ); /* ener = r[0] */ - /*ener in Q = 2*(Q_syn-3)+1 = Q-5 when Q_syn=0*/ - - L_tmp = L_mac( 1L, synth[1], synth[0] ); - FOR( i = 2; i < L_SUBFR; i++ ) - { -#ifdef BASOP_NOGLOB - L_tmp = L_mac_sat( L_tmp, synth[i], synth[i - 1] ); -#else - L_tmp = L_mac( L_tmp, synth[i], synth[i - 1] ); -#endif - } - tmp = extract_h( L_shl( L_tmp, tmp ) ); /* tmp = r[1] */ - /*tmp in Q = 2*(Q_syn-3)+1 = Q-5 when Q_syn=0 */ - /*we use the same normalization factor for both ener and tmp, */ - /*if the headroom in "tmp" is less than "ener", tmp can saturate */ - /*but this is ok since below we apply some thresholds to tmp */ - - tmp = s_max( 0, tmp ); - if ( tmp > 0 ) - { - tmp = div_s( tmp, ener ); - } - - /*-----------------------------------------------------------------* - * modify energy of white noise according to synthesis tilt - *-----------------------------------------------------------------*/ - - /* tmp = 1.0 - fac */ -#ifdef BASOP_NOGLOB - tmp = add_o( 1, sub( 32767, tmp ), &Overflow ); -#else - tmp = add( 1, sub( 32767, tmp ) ); -#endif - test(); - if ( EQ_32( core_brate, FRAME_NO_DATA ) || EQ_32( core_brate, SID_2k40 ) ) - { - /* emphasize HF noise in CNG */ - /*fac *= 2.0f;*/ -#ifdef BASOP_NOGLOB - tmp = add_o( tmp, tmp, &Overflow ); -#else - tmp = add( tmp, tmp ); -#endif - } - tmp = s_max( tmp, 3277 ); /* 0.1 in Q15 */ - - /*scale *= fac;*/ - tmp = mult_r( scale, tmp ); - /*-----------------------------------------------------------------* - * modify HF excitation according to both calculated scaling factors - * high pass filtering (0.94ms of delay) - *-----------------------------------------------------------------*/ - - filt_6k_7k_scale_fx( HF_exc, L_SUBFR16k, hBWE_zero->mem_hf_fx, tmp, exp2 ); - /* i: input HF_exc is scaled in float, here scaling is done inside this filter */ - /* i: mem_hf in Q-2 */ - /* o: HF_exc in Q0 */ - - /*-----------------------------------------------------------------* - * synthesis of noise: 4.8kHz..5.6kHz --> 6kHz..7kHz - *-----------------------------------------------------------------*/ - - /*weight_a( Aq, Ap, 0.6f, M );*/ - weight_a_lc_fx( Aq, Ap, Gamma_19661_Tbl_fx, M ); - /* o: Ap in Q14 */ - - Syn_filt_s( 0, Ap, M, HF_exc, HF_syn, L_SUBFR16k, hBWE_zero->mem_syn_hf_fx, 1 ); - /* i: Ap in Q14 */ - /* i: HF_exc in Q0 */ - /* o: HF_syn in Q0 */ - /* i/o: mem_syn_hf in Q0 */ - - Scale_sig( HF_syn, L_SUBFR16k, ( add( Q_syn, exp1 ) ) ); /* bring HF_syn to (Q_syn+exp1) */ - - /*-----------------------------------------------------------------* - * add filtered HF noise to speech synthesis - *-----------------------------------------------------------------*/ - - /* delay by 5 samples @16kHz to compensate CLDFB resampling delay (20samples) and HP filtering delay (roughly 15 samples) */ - delay = NS2SA( 16000, DELAY_CLDFB_NS ) - 15; - Copy( HF_syn + L_SUBFR16k - delay, temp_buffer, delay ); - Copy( HF_syn, HF_syn + delay, L_SUBFR16k - delay ); - Copy( delay_syn_hf, HF_syn, delay ); - Copy( temp_buffer, delay_syn_hf, delay ); - - /* interpolate the HF synthesis */ - IF( EQ_16( output_subfr, L_SUBFR48k ) ) /* 48kHz sampled output */ - { - { - Word16 s; - s = s_max( s_min( sub( s_min( Find_Max_Norm16( HF_syn, L_SUBFR16k ), Find_Max_Norm16( mem_hp_interp, INTERP_3_1_MEM_LEN - 3 ) ), 3 ), - sub( Find_Max_Norm16( mem_hp_interp + INTERP_3_1_MEM_LEN - 3, 3 ), 1 ) ), - 0 ); - Scale_sig( HF_syn, L_SUBFR16k, s ); - Scale_sig( mem_hp_interp, INTERP_3_1_MEM_LEN, s ); - interpolate_3_over_1_allpass_fx( HF_syn, L_SUBFR16k, upsampled_HF_syn, mem_hp_interp ); - Scale_sig( upsampled_HF_syn, 3 * L_SUBFR16k, -s ); - Scale_sig( mem_hp_interp, INTERP_3_1_MEM_LEN, -s ); - Scale_sig( HF_syn, L_SUBFR16k, -s ); - } - Scale_sig( upsampled_HF_syn, L_SUBFR48k, -1 ); - } - ELSE IF( EQ_16( output_subfr, L_SUBFR32k ) ) /* 32kHz sampled output */ - { - { - Word16 s; - s = s_max( sub( s_min( Find_Max_Norm16( HF_syn, L_SUBFR16k ), Find_Max_Norm16( mem_hp_interp, 2 * ALLPASSSECTIONS_STEEP ) ), 2 ), 0 ); - Scale_sig( HF_syn, L_SUBFR16k, s ); - Scale_sig( mem_hp_interp, 2 * ALLPASSSECTIONS_STEEP, s ); - Interpolate_allpass_steep_fx( HF_syn, mem_hp_interp, L_SUBFR16k, upsampled_HF_syn ); - Scale_sig( upsampled_HF_syn, 2 * L_SUBFR16k, -s ); - Scale_sig( mem_hp_interp, 2 * ALLPASSSECTIONS_STEEP, -s ); - Scale_sig( HF_syn, L_SUBFR16k, -s ); - } - } - ELSE /* 16kHz sampled output */ - { - Copy( HF_syn, upsampled_HF_syn, L_SUBFR16k ); - } - - Vr_add( synth16k, upsampled_HF_syn, synth16k, output_subfr ); - - return; -} -#endif -#endif /*-------------------------------------------------------------------* * filt_6k_7k: diff --git a/lib_dec/igf_dec_fx.c b/lib_dec/igf_dec_fx.c index 463875a1c5cadcff4c4de119bbf8b225dfd842b0..cc407c72f60331d2f0d7b4e34233f7785613013c 100644 --- a/lib_dec/igf_dec_fx.c +++ b/lib_dec/igf_dec_fx.c @@ -2488,11 +2488,7 @@ static void IGF_appl_ivas( IGF_DEC_PRIVATE_DATA_HANDLE hPrivateData, /**< in /* calc square root of L_tmp and store result in dN */ L_tmp = Sqrt32( L_tmp, &L_tmp_e ); -#ifdef FIX_924_IGF_ROUNDFX_SAT dN[sfb] = round_fx_sat( L_tmp ); -#else - dN[sfb] = round_fx( L_tmp ); -#endif move16(); dN_e[sfb] = L_tmp_e; move16(); diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index d8f9a8b90de44039525bd88890fa66092c603e16..73b877015575002df3ba73bd58b7ac0c6f76f63c 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -685,12 +685,7 @@ ivas_error ivas_core_dec_fx( Copy_Scale_sig_32_16( hCPE->hCoreCoder[0]->old_pitch_buf_fx, hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, add( imult1616( 2, NB_SUBFR16k ), 2 ), -Q10 ); // Q6 td_stereo_param_updt_fx( st->lsp_old_fx, st->lsf_old_fx, st->old_pitch_buf_16_fx + st->nb_subfr, - tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc -#ifndef FIX_798_WRONG_CPY_OF_PITCH - , - Q6 -#endif - ); + tdm_lspQ_PCh_fx, tdm_lsfQ_PCh_fx, hStereoTD->tdm_Pri_pitch_buf_fx, st->flag_ACELP16k, hStereoTD->tdm_use_IAWB_Ave_lpc ); Copy_Scale_sig_16_32( hCPE->hCoreCoder[0]->old_pitch_buf_16_fx, hCPE->hCoreCoder[0]->old_pitch_buf_fx, add( imult1616( 2, NB_SUBFR16k ), 2 ), Q10 ); // Q16 } @@ -749,7 +744,6 @@ ivas_error ivas_core_dec_fx( st->hHQ_core->Q_fer_samples = 0; move16(); } -#ifdef FIX_778_STEREO_BRATE_SWITCHING IF( NE_16( st->core, st->last_core ) ) { IF( st->hTcxDec ) @@ -759,7 +753,6 @@ ivas_error ivas_core_dec_fx( st->Q_syn = 0; move16(); } -#endif st->prev_Q_syn = st->Q_syn; move16(); @@ -1215,10 +1208,7 @@ ivas_error ivas_core_dec_fx( #else Copy_Scale_sig_32_16( synth_32_fx[n], synth_fxl, L_FRAME48k, negate( add( Q11, q ) ) ); #endif - Scale_sig( st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, sub( Q8, st->prev_Q_bwe_syn ) ); // Q8 -#ifndef FIX_854_HILBERT_SCALING - Scale_sig32( st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx, HILBERT_MEM_SIZE, sub( st->prev_Q_bwe_syn2, Q11 ) ); -#endif + Scale_sig( st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, sub( Q8, st->prev_Q_bwe_syn ) ); // Q8 Copy_Scale_sig_32_16( st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, ( 2 * ALLPASSSECTIONS_STEEP ), sub( st->prev_Q_bwe_syn2, Q11 ) ); // prev_Q_bew_syn2 swb_CNG_dec_ivas_fx( st, synth_fxl, hb_synth_16_fx[n], sid_bw[n], negate( q ) ); @@ -1229,13 +1219,7 @@ ivas_error ivas_core_dec_fx( Copy_Scale_sig_16_32( hb_synth_16_fx[n], hb_synth_32_fx[n], L_FRAME48k, ( Q11 ) ); // Q11 } -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - Copy_Scale_sig_16_32( synth_fxl, synth_32_fx[n], L_FRAME48k, ( Q11 + q ) ); -#endif Scale_sig( st->hBWE_TD->state_lpc_syn_fx, LPC_SHB_ORDER, negate( sub( Q8, st->prev_Q_bwe_syn ) ) ); // Q0 -#ifndef FIX_854_HILBERT_SCALING - Scale_sig32( st->hBWE_TD->genSHBsynth_Hilbert_Mem_fx, HILBERT_MEM_SIZE, -( st->prev_Q_bwe_syn2 - Q11 ) ); -#endif Copy_Scale_sig_16_32_no_sat( st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx, st->hBWE_TD->genSHBsynth_state_lsyn_filt_shb_local_fx_32, 2 * ALLPASSSECTIONS_STEEP, negate( sub( st->prev_Q_bwe_syn2, Q11 ) ) ); } @@ -1254,12 +1238,7 @@ ivas_error ivas_core_dec_fx( hCPE->hStereoDft->td_gain_fx[0] = 1; move32(); } -#ifndef FIX_839_FB_CONTENT_SOMETIME_MISSING - Scale_sig( tmp_buffer_fx, L_FRAME48k, sub( Q11, Q_white_exc ) ); // for small value, this was just mostly p - stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q ); -#else stereo_icBWE_dec_fx( hCPE, hb_synth_32_fx[0], hb_synth_32_fx[1], tmp_buffer_fx /*fb_synth_ref*/, voice_factors_fx[0], output_frame, &q, Q_white_exc ); -#endif #ifdef MSAN_FIX test(); test(); @@ -1380,16 +1359,8 @@ ivas_error ivas_core_dec_fx( FOR( i = 0; i < tmps; i++ ) { -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - tmp_buffer_fx[i] = round_fx( L_add( L_shr( L_mult( st->hb_prev_synth_buffer_fx[i], sin_table256_fx[255 - tmp16] ), 1 ), L_shr( L_mult( st->hb_prev_synth_buffer_fx[st->old_bwe_delay - 1 - i], sin_table256_fx[tmp16] ), 1 ) ) ); - move16(); - tmp_buffer_fx[i] = shl_sat( tmp_buffer_fx[i], 1 ); - move16(); -#else tmp_buffer_fx[i] = round_fx_sat( L_mac_sat( L_mult( st->hb_prev_synth_buffer_fx[i], sin_table256_fx[255 - tmp16] ), st->hb_prev_synth_buffer_fx[st->old_bwe_delay - 1 - i], sin_table256_fx[tmp16] ) ); // Q0 (0+15-15) move16(); -#endif - tmp16 = add( tmp16, incr ); } Copy( tmp_buffer_fx, st->hb_prev_synth_buffer_fx, tmps ); @@ -1621,9 +1592,6 @@ ivas_error ivas_core_dec_fx( exp_old_out = Find_Max_Norm16( st->hHQ_core->old_out_fx + NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS ), sub( add( NS2SA_FX2( st->output_Fs, N_ZERO_MDCT_NS ), NS2SA_FX2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ), NS2SA( st->output_Fs, N_ZERO_MDCT_NS ) ) ); exp_delay_buf_out = Find_Max_Norm16( st->delay_buf_out_fx, NS2SA_FX2( st->output_Fs, DELAY_CLDFB_NS ) ); exp_synth_history = Find_Max_Norm16( st->hTcxDec->synth_history_fx + output_frame, sub( add( sub( imult1616( 2, output_frame ), NS2SA_FX2( st->output_Fs, DELAY_CLDFB_NS ) ), NS2SA_FX2( st->output_Fs, PH_ECU_MEM_NS ) ), output_frame ) ); -#ifndef FIX_740_HQ_CORE_OVA - exp_synth_history += st->hTcxDec->q_synth_history_fx; -#endif exp_max = s_min( exp_synth_history, exp_ouput ); exp_max = s_min( exp_max, exp_prev_synth_buffer ); exp_max = s_min( exp_max, exp_old_out ); diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 9705b77012b9287a16237762da31f1be91fdaf09..d62b24f81d498788c17c50b78e4690058a5bf443 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -67,10 +67,6 @@ ivas_error ivas_cpe_dec_fx( Word32 *output[CPE_CHANNELS], /* o : output synthesis signal Q11*/ const Word16 output_frame, /* i : output frame length per channel */ const Word16 nb_bits_metadata /* i : number of metadata bits */ -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - , - Word16 *q_output /* i/o : Q of output synthesis signal */ -#endif ) { Word16 i, n, n_channels; @@ -844,12 +840,7 @@ ivas_error ivas_cpe_dec_fx( * IC-BWE: output LB and HB mix in ACELP mode *----------------------------------------------------------------*/ -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - stereo_icBWE_decproc_fx( hCPE, output, outputHB_fx, last_core, last_bwidth, output_frame, *q_output ); -#else stereo_icBWE_decproc_fx( hCPE, output, outputHB_fx, last_core, last_bwidth, output_frame ); -#endif - smooth_dft2td_transition_fx( hCPE, output, output_frame ); /*----------------------------------------------------------------* diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index 4bcfdc3e6d4a85ad28f35a167fab7dd67044f684..949612a29bc9b2c2327b348d4c4c4c4df3175037 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -735,7 +735,6 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( * * collect the multi channel input covariance for one filter bank time slot *-------------------------------------------------------------------*/ -#ifdef FIX_835_PARAMMC_BUFFER_VALUES void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( Word32 *RealBuffer_fx, /* i : input channel filter bank samples (real part) Q(31- RealBuffer_e)*/ Word16 RealBuffer_e, /* i : exponent input channel filter bank samples (real part)*/ @@ -848,129 +847,6 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( return; } -#else -void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( - Word32 *RealBuffer_fx, /* i : input channel filter bank samples (real part) */ - Word16 RealBuffer_e, /* i : exponent input channel filter bank samples (real part)*/ - Word32 *ImagBuffer_fx, /* i : input channel filter bank samples (imaginary part */ - Word16 ImagBuffer_e, /* i : exponent input channel filter bank samples (real part)*/ - Word32 cx_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ - Word16 *cx_e, /* i : exponent for accumulated input covariance (real part) */ - Word32 cx_imag_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (imaginary part) */ - Word16 *cx_imag_e, /* i : exponent accumulated input covariance (imag part) */ - PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ - const Word16 nchan_in /* i : number of input channels */ -) -{ - Word16 cx_init_e[PARAM_MC_MAX_PARAMETER_BANDS]; - Word16 cx_init_imag_e[PARAM_MC_MAX_PARAMETER_BANDS]; - Word16 param_band, band_idx, ch_idx; - Word16 brange[2]; - Word32 real_in_buffer_fx[PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND * MAX_TRANSPORT_CHANNELS]; - Word16 real_in_e; - Word32 imag_in_buffer_fx[PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND * MAX_TRANSPORT_CHANNELS]; - Word16 imag_in_e; - Word32 real_buffer_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - Word32 imag_buffer_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - Word16 output_e; - Word16 i, j, tmp1, tmp2, tmp1_e, tmp2_e, shift_imag, shift_real; - Word32 L_tmp; - Word16 band, num_bands; - - /* estimate input covariance */ - FOR( param_band = 0; param_band < hParamMC->num_param_bands_synth; param_band++ ) - { - /* Already stack here instead of in the process_subframe */ - - /* collect input frame */ - brange[0] = hParamMC->band_grouping[param_band]; - move16(); - brange[1] = hParamMC->band_grouping[param_band + 1]; - move16(); - num_bands = sub( brange[1], brange[0] ); - - FOR( band_idx = 0; band_idx < num_bands; band_idx++ ) - { - band = add( brange[0], band_idx ); - FOR( ch_idx = 0; ch_idx < nchan_in; ch_idx++ ) - { - real_in_buffer_fx[add( band_idx, imult1616( num_bands, ch_idx ) )] = RealBuffer_fx[add( imult1616( ch_idx, hParamMC->num_freq_bands ), band )]; - move32(); - imag_in_buffer_fx[add( band_idx, imult1616( num_bands, ch_idx ) )] = ImagBuffer_fx[add( imult1616( ch_idx, hParamMC->num_freq_bands ), band )]; - move32(); - } - } - - real_in_e = RealBuffer_e; - move16(); - imag_in_e = ImagBuffer_e; - move16(); - shift_real = sub( L_norm_arr( real_in_buffer_fx, imult1616( num_bands, nchan_in ) ), find_guarded_bits_fx( num_bands + 1 ) ); - shift_imag = sub( L_norm_arr( imag_in_buffer_fx, imult1616( num_bands, nchan_in ) ), find_guarded_bits_fx( num_bands + 1 ) ); - - real_in_e = sub( real_in_e, shift_real ); - imag_in_e = sub( imag_in_e, shift_imag ); - - - output_e = s_max( real_in_e, imag_in_e ); - - FOR( i = 0; i < num_bands * nchan_in; ++i ) - { - real_in_buffer_fx[i] = L_shr( real_in_buffer_fx[i], sub( output_e, RealBuffer_e ) ); - move32(); - imag_in_buffer_fx[i] = L_shr( imag_in_buffer_fx[i], sub( output_e, ImagBuffer_e ) ); - move32(); - } - - cmplx_matrix_square_fx( real_in_buffer_fx, imag_in_buffer_fx, num_bands, nchan_in, real_buffer_fx, imag_buffer_fx, output_e, &output_e ); - - v_add_fixed_me( cx_fx[param_band], *cx_e, real_buffer_fx, output_e, cx_fx[param_band], &tmp1_e, imult1616( nchan_in, nchan_in ), 1 ); - - v_add_fixed_me( cx_imag_fx[param_band], *cx_imag_e, imag_buffer_fx, output_e, cx_imag_fx[param_band], &tmp2_e, imult1616( nchan_in, nchan_in ), 1 ); - - cx_init_e[param_band] = tmp1_e; - move16(); - cx_init_imag_e[param_band] = tmp2_e; - move16(); - } - - // normalizing both the matrices to a common exponent for a better precision - tmp1 = 0; - move16(); - tmp2 = 0; - move16(); - FOR( i = 0; i < PARAM_MC_MAX_PARAMETER_BANDS; i++ ) - { - FOR( j = 0; j < PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS; j++ ) - { - L_tmp = BASOP_Util_Add_Mant32Exp( cx_fx[i][j], cx_init_e[i], 0, 0, &tmp1_e ); - L_tmp = BASOP_Util_Add_Mant32Exp( cx_imag_fx[i][j], cx_init_imag_e[i], 0, 0, &tmp2_e ); - tmp1 = s_max( tmp1, tmp1_e ); - tmp2 = s_max( tmp2, tmp2_e ); - } - } - - FOR( i = 0; i < PARAM_MC_MAX_PARAMETER_BANDS; i++ ) - { - FOR( j = 0; j < PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS; j++ ) - { - L_tmp = BASOP_Util_Add_Mant32Exp( cx_fx[i][j], cx_init_e[i], 0, 0, &tmp1_e ); - cx_fx[i][j] = L_shr( L_tmp, sub( tmp1, tmp1_e ) ); - move32(); - L_tmp = BASOP_Util_Add_Mant32Exp( cx_imag_fx[i][j], cx_init_imag_e[i], 0, 0, &tmp2_e ); - cx_imag_fx[i][j] = L_shr( L_tmp, sub( tmp2, tmp2_e ) ); - move32(); - } - } - - *cx_e = tmp1; - move16(); - *cx_imag_e = tmp2; - move16(); - - return; -} -#endif #endif /*-------------------------------------------------------------------* @@ -1775,20 +1651,10 @@ Word16 computeMixingMatrices_fx( limit_e = Cy_hat_diag_e; move16(); } - -#ifndef FIX_827_HIGH_MLD - L_tmp = Mpy_32_32( limit_fx, reg_ghat_fx ); - limit_fx = L_add( L_tmp, EPSILON_FX ); - limit_e = add( limit_e, reg_ghat_e ); - move16(); -#endif } -#ifdef FIX_827_HIGH_MLD L_tmp = Mpy_32_32( limit_fx, reg_ghat_fx ); // limit_e+ reg_ghat_e limit_fx = L_add( L_tmp, EPSILON_FX ); limit_e = add( limit_e, reg_ghat_e ); -#endif - FOR( i = 0; i < lengthCy; ++i ) { @@ -2578,13 +2444,8 @@ Word16 computeMixingMatricesResidual_fx( FOR( j = 0; j < num_outputs; j++ ) { -#ifdef FIX_827_HIGH_MLD L_tmp = Mpy_32_32( mat_mult_buffer1_fx[j + i * num_outputs], fac_fx ); // Q(31-mat_mult_buffer1_e+Kx_reg_inv_e) mixing_matrix_fx[j + i * num_outputs] = L_tmp; -#else - L_tmp = Mpy_32_32( mat_mult_buffer1_fx[j + j * num_outputs], fac_fx ); // mat_mult_buffer1_e+Kx_reg_inv_e - mixing_matrix_fx[j + j * num_outputs] = L_tmp; -#endif move32(); mixing_matrix_fx_e[j + i * num_outputs] = add( mat_mult_buffer1_buff_e[j + i * num_outputs], Kx_reg_inv_e[i] ); move16(); diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 1aac7e9008b6f93e2dfca51a5d2615021fb996b9..750a0a23ecf218fd8ad4d3742461aa9f7f5692a2 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -1081,11 +1081,7 @@ ivas_error ivas_ism_metadata_dec_fx( idx_angle2 = hIsmMetaData->orientation_angle.last_angle2_idx; move16(); yaw_fx = ism_dequant_meta_fx( idx_angle1, ism_azimuth_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, ( 1 << ISM_AZIMUTH_NBITS ) ); -#ifdef FIX_999_WRONG_ISM_EXTENDED_METADATA pitch_fx = ism_dequant_meta_fx( idx_angle2, ism_elevation_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, ( 1 << ISM_ELEVATION_NBITS ) ); -#else - pitch_fx = ism_dequant_meta_fx( idx_angle2, ism_elevation_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, ( 1 << ISM_AZIMUTH_NBITS ) ); -#endif idx_radius = decode_radius_fx( st0, &hIsmMetaData->last_radius_idx, &flag_abs_radius ); radius_fx = usdequant_fx( idx_radius, ISM_RADIUS_MIN_Q9, ISM_RADIUS_DELTA_Q8 ); diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 106affd0851a4c5e24cbd14dbb40ceb8aacafc4f..c85cfdf4d0a81a7b30fc0526f90833577e42c35a 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -179,11 +179,7 @@ ivas_error ivas_jbm_dec_tc_fx( set32_fx( &p_output_fx[0][0], 0, L_FRAME48k ); set32_fx( &p_output_fx[1][0], 0, L_FRAME48k ); -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, 0, &q_output ) ) != IVAS_ERR_OK ) -#else IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -368,11 +364,7 @@ ivas_error ivas_jbm_dec_tc_fx( set32_fx( &p_output_fx[0][0], 0, L_FRAME48k ); set32_fx( &p_output_fx[1][0], 0, L_FRAME48k ); -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0], &q_output ) ) != IVAS_ERR_OK ) -#else IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -810,11 +802,7 @@ ivas_error ivas_jbm_dec_tc_fx( } /* decode MASA channels */ -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, p_output_fx, output_frame, nb_bits_metadata[0], &q_output ) ) != IVAS_ERR_OK ) -#else IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, p_output_fx, output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -924,11 +912,7 @@ ivas_error ivas_jbm_dec_tc_fx( ELSE IF( EQ_16( st_ivas->nCPE, 1 ) ) { -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] + nb_bits_metadata[1], &q_output ) ) != IVAS_ERR_OK ) -#else IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, add( nb_bits_metadata[0], nb_bits_metadata[1] ) ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -1284,11 +1268,7 @@ ivas_error ivas_jbm_dec_tc_fx( Word16 q_output = 11; move16(); -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0], &q_output ) ) != IVAS_ERR_OK ) -#else IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -1350,11 +1330,7 @@ ivas_error ivas_jbm_dec_tc_fx( Word16 q_output = 11; move16(); -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0], &q_output ) ) != IVAS_ERR_OK ) -#else IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -1412,11 +1388,7 @@ ivas_error ivas_jbm_dec_tc_fx( ELSE IF( EQ_16( st_ivas->nCPE, 1 ) ) { -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - IF( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0], &q_output ) ) != IVAS_ERR_OK ) -#else IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, 0, &p_output_fx[0], output_frame, nb_bits_metadata[0] ) ), IVAS_ERR_OK ) ) -#endif { return error; } diff --git a/lib_dec/ivas_lfe_plc.c b/lib_dec/ivas_lfe_plc.c index 206cb95aaef64dd6937cf23541f06639ce968ce8..96ee0967c46ec0971d0779ee7def4c6126f05fcb 100644 --- a/lib_dec/ivas_lfe_plc.c +++ b/lib_dec/ivas_lfe_plc.c @@ -46,202 +46,15 @@ *------------------------------------------------------------------------------------------*/ #ifndef IVAS_FLOAT_FIXED -#define LFE_PLC_DSF ( 48000 / LFE_PLC_FS ) -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -#define LFE_PLC_LPCORD ( 20 ) -#else -#define LFE_PLC_LPCORD ( MAX_LP_FILTER_ORDER ) -#endif +#define LFE_PLC_DSF ( 48000 / LFE_PLC_FS ) +#define LFE_PLC_LPCORD ( MAX_LP_FILTER_ORDER ) #define POW_THR ( 1.0e-8f ) #define LFE_PLC_RECLEN_48K ( ( IVAS_LFE_NUM_COEFFS_IN_SUBGRP + 1 ) * L_FRAME48k / IVAS_LFE_NUM_COEFFS_IN_SUBGRP + LFE_PLC_FDEL ) #define LFE_PLC_RECLEN ( ( LFE_PLC_RECLEN_48K / LFE_PLC_DSF ) ) #define LFE_PLC_MUTE_THR ( 10 ) -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT -#define LFE_PLC_BURST_ATT ( powf( powf( 10.0f, -3.0f / 20.0f ), 1.0f / ( LFE_PLC_FS * 20 / 1000 ) ) ) /* attenuate 3dB per frame starting with 10th consecutive loss */ -#define EPS_STOP 1e-5f -#else -#define LFE_PLC_BURST_ATT ( pow( pow( 10.0, -3.0 / 20.0 ), 1.0 / ( LFE_PLC_FS * 0.02 ) ) ) /* attenuate 3dB per frame starting with 10th consecutive loss */ -#define MAX_LEN_LP 960 -#define EPS_STOP 1e-5 -#endif - -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -/*------------------------------------------------------------------------------------------* - * Static function declarations - * - * Note (DLB): the local double precision functions defined below are replica of corresponding - * float functions defined in tools.c, lpc_tools.c and syn_filt.c. - * Double precision arithmetic is required for proper functioning of the lfe_plc. - *------------------------------------------------------------------------------------------*/ - -static void mvr2d( - const float x[], /* i : input vector */ - double y[], /* o : output vector */ - const int16_t n /* i : vector size */ -) -{ - int16_t i; - - if ( n <= 0 ) - { - /* cannot transfer vectors with size 0 */ - return; - } - - for ( i = n - 1; i >= 0; i-- ) - { - y[i] = x[i]; - } - - return; -} - - -/*---------------------------------------------------------------------* - * autocorr() - * - * Compute autocorrelations of input signal - *---------------------------------------------------------------------*/ - -static void d_autocorr( - const double *x, /* i : input signal */ - double *r, /* o : autocorrelations vector */ - const int16_t m, /* i : order of LP filter */ - const int16_t len, /* i : window size */ - const double *wind, /* i : window */ - const int16_t rev_flag, /* i : flag to reverse window */ - const int16_t sym_flag, /* i : symmetric window flag */ - const int16_t no_thr /* i : flag to avoid thresholding */ -) -{ - double t[MAX_LEN_LP]; - double s; - int16_t i, j; - - /* Windowing of signal */ - if ( rev_flag == 1 ) - { - /* time reversed window */ - for ( i = 0; i < len; i++ ) - { - t[i] = x[i] * wind[len - i - 1]; - } - } - else if ( sym_flag == 1 ) - { - /* symmetric window of even length */ - for ( i = 0; i < len / 2; i++ ) - { - t[i] = x[i] * wind[i]; - } - - for ( ; i < len; i++ ) - { - t[i] = x[i] * wind[len - 1 - i]; - } - } - else /* assymetric window */ - { - for ( i = 0; i < len; i++ ) - { - t[i] = x[i] * wind[i]; - } - } - - /* Compute r[1] to r[m] */ - for ( i = 0; i <= m; i++ ) - { - s = t[0] * t[i]; - for ( j = 1; j < len - i; j++ ) - { - s += t[j] * t[i + j]; - } - r[i] = s; - } - - if ( r[0] < 100.0f && no_thr == 0 ) - { - r[0] = 100.0f; - } - - return; -} - - -/*---------------------------------------------------------------------* - * lev_dur() - * - * Wiener-Levinson-Durbin algorithm to compute LP parameters from the autocorrelations - * of input signal - *---------------------------------------------------------------------*/ - -/*! r: energy of prediction error */ -static int16_t d_lev_dur( - double *a, /* o : LP coefficients (a[0] = 1.0) */ - const double *r, /* i : vector of autocorrelations */ - const int16_t m, /* i : order of LP filter */ - double epsP[] /* o : prediction error energy */ -) -{ - int16_t i, j, l; - double buf[TCXLTP_LTP_ORDER]; - double *rc; /* reflection coefficients 0,...,m-1 */ - double s, at, err; - int16_t flag = 0; - - rc = &buf[0]; - rc[0] = ( -r[1] ) / r[0]; - a[0] = 1.0; - a[1] = rc[0]; - err = r[0] + r[1] * rc[0]; - - if ( epsP != NULL ) - { - epsP[0] = r[0]; - epsP[1] = err; - } - - for ( i = 2; i <= m; i++ ) - { - s = 0.0; - for ( j = 0; j < i; j++ ) - { - s += r[i - j] * a[j]; - } - - rc[i - 1] = ( -s ) / err; - - if ( fabs( rc[i - 1] ) > 0.99945f ) - { - flag = 1; /* Test for unstable filter. If unstable keep old A(z) */ - } - - for ( j = 1; j <= i / 2; j++ ) - { - l = i - j; - at = a[j] + rc[i - 1] * a[l]; - a[l] += rc[i - 1] * a[j]; - a[j] = at; - } - - a[i] = rc[i - 1]; - - err += rc[i - 1] * s; - - if ( err <= 0.0f ) - { - err = 0.01f; - } - - if ( epsP != NULL ) - { - epsP[i] = err; - } - } +#define LFE_PLC_BURST_ATT ( powf( powf( 10.0f, -3.0f / 20.0f ), 1.0f / ( LFE_PLC_FS * 20 / 1000 ) ) ) /* attenuate 3dB per frame starting with 10th consecutive loss */ +#define EPS_STOP 1e-5f - return ( flag ); -} -#else /*---------------------------------------------------------------------* * lfeplc_lev_dur() * @@ -309,104 +122,6 @@ static int16_t lfeplc_lev_dur( return 0; } -#endif - -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -/*-------------------------------------------------------------------* - * a2rc() - * - * Convert from LPC to reflection coeff - *-------------------------------------------------------------------*/ -static uint16_t d_a2rc( - const double *a, /* i : LPC coefficients */ - double *refl, /* o : Reflection co-efficients */ - const int16_t lpcorder /* i : LPC order */ -) -{ - double ff[LFE_PLC_LPCORD]; - double km, denom, x; - int16_t m, j, n; - - for ( m = 0; m < lpcorder; m++ ) - { - ff[m] = -a[m]; - } - - /* Initialization */ - for ( m = lpcorder - 1; m >= 0; m-- ) - { - km = ff[m]; - if ( km <= -1.0 || km >= 1.0 ) - { - for ( j = 0; j < lpcorder; j++ ) - { - refl[j] = 0.0; - } - - return 0; - } - - refl[m] = -km; - denom = 1.0 / ( 1.0 - km * km ); - for ( j = 0; j < m / 2; j++ ) - { - n = m - 1 - j; - x = denom * ff[j] + km * denom * ff[n]; - ff[n] = denom * ff[n] + km * denom * ff[j]; - ff[j] = x; - } - - if ( m & 1 ) - { - ff[j] = denom * ff[j] + km * denom * ff[j]; - } - } - - return 1; -} - -static void d_syn_filt( - const double a[], /* i : LP filter coefficients */ - const int16_t m, /* i : order of LP filter */ - const float x[], /* i : input signal */ - float y[], /* o : output signal */ - const int16_t l, /* i : size of filtering */ - const float mem[] /* i : initial filter states */ -) -{ - int16_t i, j; - double buf[LFE_PLC_LPCORD + LFE_PLC_RECLEN]; /* temporary synthesis buffer */ - double s, *yy; - - yy = &buf[0]; - - /*------------------------------------------------------------------* - * copy initial filter states into synthesis buffer and do synthesis - *------------------------------------------------------------------*/ - for ( i = 0; i < m; i++ ) - { - *yy++ = mem[i]; - } - - /*-----------------------------------------------------------------------* - * Do the filtering - *-----------------------------------------------------------------------*/ - - for ( i = 0; i < l; i++ ) - { - s = x[i]; - for ( j = 1; j <= m; j++ ) - { - s -= a[j] * yy[i - j]; - } - - yy[i] = s; - y[i] = (float) s; - } - - return; -} -#endif /*-----------------------------------------------------------------------------------------* * Function check_stab() @@ -414,15 +129,6 @@ static void d_syn_filt( * LPC filter stability check applying given sharpening value delta *-----------------------------------------------------------------------------------------*/ -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -static uint16_t check_stab( - const double *a, - double delta ) -{ - double amod[LFE_PLC_LPCORD], refl[LFE_PLC_LPCORD]; - double fac; - double fac1; -#else static uint16_t check_stab( const float *a, const float delta ) @@ -430,15 +136,10 @@ static uint16_t check_stab( float amod[LFE_PLC_LPCORD], refl[LFE_PLC_LPCORD]; float fac; float fac1; -#endif int16_t i; uint16_t stable; -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - fac = 1.0 + delta; -#else fac = 1.0f + delta; -#endif fac1 = fac; for ( i = 0; i < LFE_PLC_LPCORD; i++ ) @@ -447,11 +148,7 @@ static uint16_t check_stab( fac *= fac1; } -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - stable = d_a2rc( amod, refl, LFE_PLC_LPCORD ); -#else stable = a2rc( amod, refl, LFE_PLC_LPCORD ); -#endif return stable; } @@ -463,30 +160,17 @@ static uint16_t check_stab( * Find maximum LPC filter sharpening by iteration to get a filter that is almost instable *-----------------------------------------------------------------------------------------*/ -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -static double find_max_delta( - double *a ) -{ - double delta; - double eps; - double fac; -#else + static float find_max_delta( float *a ) { float delta; float eps; float fac; -#endif uint16_t stable; -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - delta = 0.0; - eps = 0.01; -#else delta = 0.0f; eps = 0.01f; -#endif fac = 2; stable = FALSE; @@ -496,11 +180,7 @@ static float find_max_delta( eps *= fac; stable = TRUE; } -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - fac = 0.5; -#else fac = 0.5f; -#endif if ( stable ) { @@ -522,27 +202,6 @@ static float find_max_delta( delta += eps; stable = check_stab( a, delta ); -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - if ( !stable ) - { - if ( fabs( eps ) > EPS_STOP ) - { - eps = -fabs( eps ) * fac; - } - else - { - eps = -fabs( eps ); - } - } - else - { - if ( fabs( eps ) < EPS_STOP ) - { - break; - } - eps = fabs( eps ) * fac; - } -#else if ( !stable ) { if ( fabsf( eps ) > EPS_STOP ) @@ -562,7 +221,6 @@ static float find_max_delta( } eps = fabsf( eps ) * fac; } -#endif } return delta; @@ -577,54 +235,28 @@ static float find_max_delta( static void recover_samples( const int16_t bfi_count, -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - const float *outbuf, -#else float *outbuf, -#endif float *rec_frame ) { int16_t i; float zeroes[LFE_PLC_RECLEN]; -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - double delta, fac, att; - double d_outbuf[LFE_PLC_BUFLEN], d_r[LFE_PLC_LPCORD + 1], d_a[LFE_PLC_LPCORD + 1], d_pee[LFE_PLC_LPCORD + 1]; - - - mvr2d( outbuf, d_outbuf, LFE_PLC_BUFLEN ); - d_autocorr( d_outbuf, d_r, LFE_PLC_LPCORD, LFE_PLC_BUFLEN, d_hamm_lfe_plc, 0, 1, 1 ); -#else float delta, fac, att; float r[LFE_PLC_LPCORD + 1], a[LFE_PLC_LPCORD + 1]; autocorr( outbuf, r, LFE_PLC_LPCORD, LFE_PLC_BUFLEN, hamm_lfe_plc, 0, 1, 1 ); -#endif -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - if ( d_r[0] < POW_THR * LFE_PLC_BUFLEN ) -#else if ( r[0] < POW_THR * LFE_PLC_BUFLEN ) -#endif { set_zero( rec_frame, LFE_PLC_RECLEN ); return; } -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - d_lev_dur( d_a, d_r, LFE_PLC_LPCORD, d_pee ); - - delta = find_max_delta( d_a + 1 ); - - fac = 1.0 + delta; - att = 1.0; -#else lfeplc_lev_dur( a, r, LFE_PLC_LPCORD ); delta = find_max_delta( a + 1 ); fac = 1.0f + delta; att = 1.0f; -#endif if ( bfi_count >= LFE_PLC_MUTE_THR ) { @@ -634,22 +266,13 @@ static void recover_samples( for ( i = 1; i <= LFE_PLC_LPCORD; i++ ) { -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - d_a[i] = d_a[i] * fac; - fac *= att * ( 1.0 + delta ); -#else a[i] = a[i] * fac; fac *= att * ( 1.0f + delta ); -#endif } set_zero( zeroes, LFE_PLC_RECLEN ); -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT - d_syn_filt( d_a, LFE_PLC_LPCORD, zeroes, rec_frame, LFE_PLC_RECLEN, outbuf + LFE_PLC_BUFLEN - LFE_PLC_LPCORD ); -#else syn_filt( a, LFE_PLC_LPCORD, zeroes, rec_frame, LFE_PLC_RECLEN, outbuf + LFE_PLC_BUFLEN - LFE_PLC_LPCORD, 0 ); -#endif return; } @@ -662,12 +285,8 @@ static void recover_samples( *-----------------------------------------------------------------------------------------*/ void ivas_lfe_tdplc( - LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT - float *prevsynth, /* i : previous frame synthesis */ -#else - double *prevsynth, /* i : previous frame synthesis */ -#endif + LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */ + float *prevsynth, /* i : previous frame synthesis */ float *ytda, /* o : output time-domain buffer */ const int16_t output_frame /* i : output frame length */ ) diff --git a/lib_dec/ivas_lfe_plc_fx.c b/lib_dec/ivas_lfe_plc_fx.c index 52b94b46fb5e77d1dce0ee982853c535d4d6f264..7db91b681302c68b5c19ae00f5dada427f7a67e9 100644 --- a/lib_dec/ivas_lfe_plc_fx.c +++ b/lib_dec/ivas_lfe_plc_fx.c @@ -47,12 +47,8 @@ * Local constants *------------------------------------------------------------------------------------------*/ -#define LFE_PLC_DSF ( 48000 / LFE_PLC_FS ) -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -#define LFE_PLC_LPCORD ( 20 ) -#else -#define LFE_PLC_LPCORD ( MAX_LP_FILTER_ORDER ) -#endif +#define LFE_PLC_DSF ( 48000 / LFE_PLC_FS ) +#define LFE_PLC_LPCORD ( MAX_LP_FILTER_ORDER ) #define LFE_PLC_MAXITER ( 10 ) #define LFE_PLC_RECLEN_48K ( ( IVAS_LFE_NUM_COEFFS_IN_SUBGRP + 1 ) * L_FRAME48k / IVAS_LFE_NUM_COEFFS_IN_SUBGRP + LFE_PLC_FDEL ) #define LFE_PLC_RECLEN ( ( LFE_PLC_RECLEN_48K / LFE_PLC_DSF ) ) @@ -186,235 +182,7 @@ static void d_autocorr_fx( return; } -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -/*---------------------------------------------------------------------* - * lev_dur_fx() - * - * Wiener-Levinson-Durbin algorithm to compute LP parameters from the autocorrelations - * of input signal - *---------------------------------------------------------------------*/ - -/*! r: energy of prediction error */ -static Word16 d_lev_dur_fx( - Word32 *a_fx, /* o : LP coefficients (a[0] = 1.0) */ - Word16 *a_q_fx, - Word32 *r_fx, /* i : vector of autocorrelations */ - Word16 *r_q_fx, - const Word16 m, /* i : order of LP filter */ - Word32 *epsP_fx, /* o : prediction error energy */ - Word16 *epsP_q_fx ) -{ - Word16 i, j, l; - Word16 flag = 0; - move16(); - Word32 buf_fx[TCXLTP_LTP_ORDER]; - Word16 rc_q_fx[TCXLTP_LTP_ORDER]; - Word32 *rc_fx; /* reflection coefficients 0,...,m-1 */ - Word32 temp1, temp2, err_fx, at_fx, s; - Word16 temp_q1, temp_q2, s_q_fx, err_q_fx, exp1, exp2; - Word64 s_fx; - - s_q_fx = 0; - move16(); - - rc_fx = &buf_fx[0]; - rc_fx[0] = BASOP_Util_Divide3232_Scale_cadence( -r_fx[1], r_fx[0], &temp_q2 ); - move32(); - rc_q_fx[0] = add( sub( r_q_fx[1], r_q_fx[0] ), sub( 31, temp_q2 ) ); - move16(); - - a_fx[0] = ONE_IN_Q30; - move32(); - a_q_fx[0] = 30; - move16(); - a_fx[1] = rc_fx[0]; - move32(); - a_q_fx[1] = rc_q_fx[0]; - move32(); - - temp1 = Mpy_32_32( r_fx[1], rc_fx[0] ); - temp_q1 = sub( add( r_q_fx[1], rc_q_fx[0] ), 31 ); - - IF( LT_16( temp_q1, r_q_fx[0] ) ) - { - err_fx = L_add( L_shr( r_fx[0], sub( r_q_fx[0], temp_q1 ) ), temp1 ); - err_q_fx = temp_q1; - move16(); - } - ELSE - { - err_fx = L_add( r_fx[0], L_shr( temp1, sub( temp_q1, r_q_fx[0] ) ) ); - err_q_fx = r_q_fx[0]; - move16(); - } - - IF( epsP_fx != NULL ) - { - epsP_fx[0] = r_fx[0]; - move32(); - epsP_q_fx[0] = r_q_fx[0]; - move16(); - epsP_fx[1] = err_fx; - move32(); - epsP_q_fx[1] = err_q_fx; - move16(); - } - - FOR( i = 2; i <= m; i++ ) - { - s_fx = 0; - move64(); - - FOR( j = 0; j < i; j++ ) - { - exp1 = norm_l( r_fx[i - j] ); - exp2 = norm_l( a_fx[j] ); - temp1 = Mpy_32_32( L_shl( r_fx[i - j], exp1 ), L_shl( a_fx[j], exp2 ) ); - temp_q1 = sub( add( add( r_q_fx[i - j], exp1 ), add( a_q_fx[j], exp2 ) ), 31 ); - - IF( EQ_16( j, 0 ) ) - { - s_fx = W_deposit32_l( temp1 ); - s_q_fx = temp_q1; - move16(); - } - ELSE - { - IF( LT_16( temp_q1, s_q_fx ) ) - { - s_fx = W_add( W_shr( s_fx, sub( s_q_fx, temp_q1 ) ), W_deposit32_l( temp1 ) ); - s_q_fx = temp_q1; - move16(); - } - ELSE - { - s_fx = W_add( s_fx, W_shr( W_deposit32_l( temp1 ), sub( temp_q1, s_q_fx ) ) ); - } - } - } - exp1 = W_norm( s_fx ); - s = W_extract_h( W_shl( s_fx, exp1 ) ); - s_q_fx = sub( add( s_q_fx, exp1 ), 32 ); - - rc_fx[i - 1] = L_shr( BASOP_Util_Divide3232_Scale_cadence( -s, err_fx, &temp_q2 ), 1 ); - move32(); - rc_q_fx[i - 1] = sub( add( sub( s_q_fx, err_q_fx ), sub( 31, temp_q2 ) ), 1 ); - move16(); - - IF( LT_16( rc_q_fx[i - 1], 31 ) ) - { - if ( GT_32( abs( rc_fx[i - 1] ), L_shr( 2146302532, sub( 31, rc_q_fx[i - 1] ) ) ) ) // 2146302532 = 0.99945f in Q31 - { - flag = 1; /* Test for unstable filter. If unstable keep old A(z) */ - move16(); - } - } - ELSE - { - if ( GT_32( abs( L_shr( rc_fx[i - 1], sub( rc_q_fx[i - 1], 31 ) ) ), 2146302532 ) ) // 2146302532 = 0.00045f in Q31 - { - flag = 1; /* Test for unstable filter. If unstable keep old A(z) */ - move16(); - } - } - - FOR( j = 1; j <= i / 2; j++ ) - { - l = sub( i, j ); - exp1 = sub( norm_l( rc_fx[sub( i, 1 )] ), 1 ); - exp2 = sub( norm_l( a_fx[l] ), 1 ); - rc_fx[sub( i, 1 )] = L_shl( rc_fx[sub( i, 1 )], exp1 ); - move32(); - rc_q_fx[sub( i, 1 )] = add( rc_q_fx[sub( i, 1 )], exp1 ); - move16(); - a_fx[l] = L_shl( a_fx[l], exp2 ); - move32(); - a_q_fx[l] = add( a_q_fx[l], exp2 ); - move16(); - - exp2 = sub( norm_l( a_fx[j] ), 1 ); - a_fx[j] = L_shl( a_fx[j], exp2 ); - move32(); - a_q_fx[j] = add( a_q_fx[j], exp2 ); - move16(); - - temp2 = Mpy_32_32( rc_fx[sub( i, 1 )], a_fx[l] ); - temp_q2 = sub( add( rc_q_fx[sub( i, 1 )], a_q_fx[l] ), 31 ); - - IF( LT_16( temp_q2, a_q_fx[j] ) ) - { - at_fx = L_add( L_shr( a_fx[j], sub( a_q_fx[j], temp_q2 ) ), temp2 ); - temp_q1 = temp_q2; - move16(); - } - ELSE - { - at_fx = L_add( a_fx[j], L_shr( temp2, sub( temp_q2, a_q_fx[j] ) ) ); - temp_q1 = a_q_fx[j]; - move16(); - } - - temp2 = Mpy_32_32( rc_fx[sub( i, 1 )], a_fx[j] ); - temp_q2 = sub( add( rc_q_fx[sub( i, 1 )], a_q_fx[j] ), 31 ); - - IF( LT_16( temp_q2, a_q_fx[l] ) ) - { - a_fx[l] = L_add( L_shr( a_fx[l], sub( a_q_fx[l], temp_q2 ) ), temp2 ); - move32(); - a_q_fx[l] = temp_q2; - move16(); - } - ELSE - { - a_fx[l] = L_add( a_fx[l], L_shr( temp2, sub( temp_q2, a_q_fx[l] ) ) ); - move16(); - } - a_fx[j] = at_fx; - move32(); - a_q_fx[j] = temp_q1; - move16(); - } - a_fx[i] = rc_fx[sub( i, 1 )]; - move32(); - a_q_fx[i] = rc_q_fx[sub( i, 1 )]; - move16(); - - exp1 = sub( norm_l( rc_fx[sub( i, 1 )] ), 1 ); - exp2 = norm_l( s ); - temp1 = Mpy_32_32( L_shl( rc_fx[sub( i, 1 )], exp1 ), L_shl( s, exp2 ) ); - temp_q1 = sub( add( add( rc_q_fx[sub( i, 1 )], exp1 ), add( s_q_fx, exp2 ) ), 31 ); - - IF( LT_16( temp_q1, err_q_fx ) ) - { - err_fx = L_add( L_shr( err_fx, sub( err_q_fx, temp_q1 ) ), temp1 ); - err_q_fx = temp_q1; - move16(); - } - ELSE - { - err_fx = L_add( err_fx, L_shr( temp1, sub( temp_q1, err_q_fx ) ) ); - } - - IF( err_fx <= 0 ) - { - err_fx = 21474836; // 0.01 in Q31 - move32(); - err_q_fx = Q31; - move16(); - } - IF( epsP_fx != NULL ) - { - epsP_fx[i] = err_fx; - move32(); - epsP_q_fx[i] = err_q_fx; - move16(); - } - } - - return ( flag ); -} -#else /*---------------------------------------------------------------------* * lfeplc_lev_dur() * @@ -667,7 +435,6 @@ static Word16 lfeplc_lev_dur_fx( } return 0; } -#endif /*-------------------------------------------------------------------* * a2rc_fx() * @@ -1099,96 +866,7 @@ static Word32 find_max_delta_fx( * * recover lost samples by extrapolation of signal buffer *-----------------------------------------------------------------------------------------*/ -#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT -static void recover_samples_fx( - const Word16 bfi_count, - const Word32 *outbuf_fx, - Word16 outbuf_q_fx, - Word32 *rec_frame_fx, - Word16 *rec_frame_q_fx ) -{ - Word16 i; - Word32 d_outbuf_fx[LFE_PLC_BUFLEN], d_a_fx[LFE_PLC_LPCORD + 1], d_pee_fx[LFE_PLC_LPCORD + 1]; - Word16 d_r_q_fx[LFE_PLC_LPCORD + 1], d_a_q_fx[LFE_PLC_LPCORD + 1], d_pee_q_fx[LFE_PLC_LPCORD + 1]; - Word32 d_r_fx[LFE_PLC_LPCORD + 1], zeroes_fx[LFE_PLC_RECLEN]; - Word32 delta_fx, fac_fx, att_fx, temp; - Word16 delta_q_fx, fac_q_fx, att_q_fx, temp_q, exp1, exp2; - - Copy32( outbuf_fx, d_outbuf_fx, LFE_PLC_BUFLEN ); - - d_autocorr_fx( d_outbuf_fx, outbuf_q_fx, d_r_fx, d_r_q_fx, LFE_PLC_LPCORD, LFE_PLC_BUFLEN, d_hamm_lfe_plc_fx, 0, 1, 1 ); - IF( LT_64( W_shr( d_r_fx[0], sub( d_r_q_fx[0], Q19 ) ), W_deposit32_l( Mpy_32_32( POW_THR_Q50, LFE_PLC_BUFLEN ) ) ) ) - { - set_zero_fx( rec_frame_fx, LFE_PLC_RECLEN ); - return; - } - - d_lev_dur_fx( d_a_fx, d_a_q_fx, d_r_fx, d_r_q_fx, LFE_PLC_LPCORD, d_pee_fx, d_pee_q_fx ); - - delta_fx = find_max_delta_fx( d_a_fx + 1, d_a_q_fx + 1, &delta_q_fx ); - - IF( LT_16( delta_q_fx, Q29 ) ) - { - fac_fx = L_add( L_shr( ONE_IN_Q29, sub( Q29, delta_q_fx ) ), delta_fx ); - fac_q_fx = delta_q_fx; - move16(); - } - ELSE - { - fac_fx = L_add( ONE_IN_Q29, L_shr( delta_fx, sub( delta_q_fx, Q29 ) ) ); - fac_q_fx = Q29; - move16(); - } - att_fx = ONE_IN_Q30; - move32(); - att_q_fx = Q30; - move16(); - - IF( GE_16( bfi_count, LFE_PLC_MUTE_THR ) ) - { - att_fx = LFE_PLC_BURST_ATT_Q31; - move32(); - fac_fx = Mpy_32_32( fac_fx, att_fx ); - fac_q_fx = sub( add( fac_q_fx, att_q_fx ), 31 ); - } - - FOR( i = 1; i <= LFE_PLC_LPCORD; i++ ) - { - d_a_fx[i] = Mpy_32_32( d_a_fx[i], fac_fx ); - move32(); - d_a_q_fx[i] = sub( add( d_a_q_fx[i], fac_q_fx ), 31 ); - move16(); - IF( LT_16( delta_q_fx, Q30 ) ) - { - temp = L_add( L_shr( ONE_IN_Q30, sub( Q30, delta_q_fx ) ), delta_fx ); - temp_q = delta_q_fx; - move16(); - } - ELSE - { - temp = L_add( ONE_IN_Q30, L_shr( delta_fx, sub( delta_q_fx, Q30 ) ) ); - temp_q = Q30; - move16(); - } - exp1 = norm_l( att_fx ); - exp2 = norm_l( temp ); - temp = Mpy_32_32( L_shl( att_fx, exp1 ), L_shl( temp, exp2 ) ); - temp_q = sub( add( add( att_q_fx, exp1 ), add( temp_q, exp2 ) ), 31 ); - - exp1 = norm_l( fac_fx ); - exp2 = norm_l( temp ); - fac_fx = Mpy_32_32( L_shl( fac_fx, exp1 ), L_shl( temp, exp2 ) ); - fac_q_fx = sub( add( add( fac_q_fx, exp1 ), add( temp_q, exp2 ) ), 31 ); - } - - set_zero_fx( zeroes_fx, LFE_PLC_RECLEN ); - - d_syn_filt_fx( d_a_fx, d_a_q_fx, LFE_PLC_LPCORD, zeroes_fx, rec_frame_fx, rec_frame_q_fx, LFE_PLC_RECLEN, outbuf_fx + LFE_PLC_BUFLEN - LFE_PLC_LPCORD, outbuf_q_fx ); - - return; -} -#else static void recover_samples_fx( const Word16 bfi_count, const Word32 *outbuf_fx, @@ -1278,7 +956,6 @@ static void recover_samples_fx( return; } -#endif /*-----------------------------------------------------------------------------------------* * Function ivas_lfe_tdplc_fx() * diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index da6d2360ef5923ef10002b579c5a50437368d483..87f156270a6010182eb804013ab8ad7a327cdb23 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -4377,12 +4377,10 @@ static void create_masa_ext_out_meta_fx( { FOR( b_new = bandMap[b_old]; b_new < bandMap[b_old + 1]; b_new++ ) { -#ifdef FIX_982_WRONG_DECODED_ENERGY_RATIO IF( EQ_32( hQMetaData->q_direction[dir].band_data[b_old].energy_ratio_fx[sf], ONE_IN_Q30 ) ) { hQMetaData->q_direction[dir].band_data[b_old].energy_ratio_fx[sf]--; } -#endif UWord8 tmp = (UWord8) L_shr( hQMetaData->q_direction[dir].band_data[b_old].energy_ratio_fx[sf], Q30 - 8 ); // Q8 move16(); extOutMeta->directToTotalRatio[dir][sf][b_new] = tmp; // Q8 @@ -4444,13 +4442,11 @@ static void create_masa_ext_out_meta_fx( move16(); FOR( dir = 0; dir < numDirections; dir++ ) { -#ifdef FIX_953_WRONG_ENERGY_RATIO_MASA_EXT /* todo: not optimal, but less invasive */ IF( EQ_32( hQMetaData->q_direction[dir].band_data[b_old].energy_ratio_fx[sf], ONE_IN_Q30 ) ) { hQMetaData->q_direction[dir].band_data[b_old].energy_ratio_fx[sf]--; } -#endif UWord8 tmp = (UWord8) L_shr( hQMetaData->q_direction[dir].band_data[b_old].energy_ratio_fx[sf], Q30 - 8 ); // Q8 move16(); extOutMeta->diffuseToTotalRatio[sf][b_new] = (UWord8) sub( extOutMeta->diffuseToTotalRatio[sf][b_new], tmp ); // Q8 @@ -5599,26 +5595,18 @@ static Word16 ivas_decode_masaism_metadata_fx( delta_phi = L_deposit_h( BASOP_Util_Divide1616_Scale( 180, no_phi_masa[bits_ism[obj] - 1][idx_el], &tmp_e ) ); delta_phi = L_shr( delta_phi, sub( 9, tmp_e ) ); /* to maintain Q22 */ -#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC Word32 tmp_32; Word64 tmp_64; tmp_32 = L_sub( azimuth, hMasaIsmData->q_azimuth_old_fx[obj] ); tmp_64 = W_mult_32_16( tmp_32, no_phi_masa[bits_ism[obj] - 1][idx_el] ); IF( GT_64( tmp_64, TOLERANCE_360_Q22 ) ) /* >= 360 in Q22 (because there is an additional shift left in W_mult_32_16) + 0.02 in Q22 to counteract for precision loss, */ -#else - IF( GT_32( L_sub( azimuth, hMasaIsmData->q_azimuth_old_fx[obj] ), delta_phi ) ) -#endif { azimuth = L_sub( azimuth, delta_phi ); } ELSE { -#ifdef FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC IF( GT_64( MINUS_TOLERANCE_360_Q22, tmp_64 ) ) -#else - if ( GT_32( L_sub( hMasaIsmData->q_azimuth_old_fx[obj], azimuth ), delta_phi ) ) -#endif { azimuth = L_add( azimuth, delta_phi ); } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 3db20e090d1cb36c05421f183b06058391e2f6eb..7eb03a3762fd7291ce7d670557352ef53edd8dfe 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -115,14 +115,9 @@ static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, IVA static void ivas_param_mc_get_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, -#ifdef FIX_835_PARAMMC_BUFFER_VALUES Word32 Cx_in_fixed[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : input covariance for all parameter bands */ Word16 Cx_in_e, const Word16 param_band_idx, -#else - Word32 Cx_in_fixed[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : input covariance for all parameter bands */ - Word16 Cx_in_e, -#endif Word32 *mixing_matrix_fx[], Word16 *mixing_matrix_e, Word32 *mixing_matrix_res_fx[], @@ -188,9 +183,6 @@ ivas_error ivas_param_mc_dec_open_fx( { Word16 k, nchan_transport; PARAM_MC_DEC_HANDLE hParamMC; -#ifndef FIX_901_PARAMMC_DEAD_CODE - IVAS_OUTPUT_SETUP hTransportSetup; -#endif Word16 nchan_out_transport; Word16 nchan_out_cov; Word32 proto_matrix_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -226,9 +218,6 @@ ivas_error ivas_param_mc_dec_open_fx( move32(); ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; move32(); -#ifndef FIX_901_PARAMMC_DEAD_CODE - hTransportSetup = st_ivas->hTransSetup; -#endif mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ); nchan_out_transport = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ); hParamMC->hoa_encoder_fx = NULL; @@ -339,11 +328,7 @@ ivas_error ivas_param_mc_dec_open_fx( move16(); hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; move16(); -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_open_fx( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); -#else ivas_param_mc_metadata_open_fx( mc_ls_setup, ivas_total_brate, hParamMC->hMetadataPMC ); -#endif /* init arrays for quantized parameters */ @@ -637,9 +622,6 @@ ivas_error ivas_param_mc_dec_open( { int16_t k, nchan_transport; PARAM_MC_DEC_HANDLE hParamMC; -#ifndef FIX_901_PARAMMC_DEAD_CODE - IVAS_OUTPUT_SETUP hTransportSetup; -#endif int16_t nchan_out_transport; int16_t nchan_out_cov; float proto_matrix[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -671,9 +653,6 @@ ivas_error ivas_param_mc_dec_open( output_Fs = st_ivas->hDecoderConfig->output_Fs; output_config = st_ivas->hDecoderConfig->output_config; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; -#ifndef FIX_901_PARAMMC_DEAD_CODE - hTransportSetup = st_ivas->hTransSetup; -#endif mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; hParamMC->hoa_encoder = NULL; @@ -750,11 +729,7 @@ ivas_error ivas_param_mc_dec_open( hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_open( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); -#else ivas_param_mc_metadata_open( mc_ls_setup, ivas_total_brate, hParamMC->hMetadataPMC ); -#endif /* init arrays for quantized parameters */ if ( ( hParamMC->icc_q = (float *) malloc( hParamMC->hMetadataPMC->num_parameter_bands * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe * sizeof( float ) ) ) == NULL ) @@ -1139,9 +1114,6 @@ ivas_error ivas_param_mc_dec_reconfig_fx( { Word16 k, nchan_transport; PARAM_MC_DEC_HANDLE hParamMC; -#ifndef FIX_901_PARAMMC_DEAD_CODE - IVAS_OUTPUT_SETUP hTransportSetup; -#endif Word16 nchan_out_transport; Word16 nchan_out_cov; Word32 proto_matrix_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -1173,9 +1145,6 @@ ivas_error ivas_param_mc_dec_reconfig_fx( move32(); ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; move32(); -#ifndef FIX_901_PARAMMC_DEAD_CODE - hTransportSetup = st_ivas->hTransSetup; -#endif mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ); nchan_out_transport = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ); @@ -1226,24 +1195,8 @@ ivas_error ivas_param_mc_dec_reconfig_fx( hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; move16(); -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* deallocate the full icc map, gets newly allocated in the metadata open function */ - - FOR( k = 0; k < 2; k++ ) - { - IF( hParamMC->hMetadataPMC->icc_map_full[k] != NULL ) - { - free( hParamMC->hMetadataPMC->icc_map_full[k] ); - hParamMC->hMetadataPMC->icc_map_full[k] = NULL; - } - } -#endif Copy( hParamMC->band_grouping, band_grouping_old, add( hParamMC->hMetadataPMC->num_parameter_bands, 1 ) ); -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_open_fx( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); -#else ivas_param_mc_metadata_open_fx( mc_ls_setup, ivas_total_brate, hParamMC->hMetadataPMC ); -#endif /* Band Grouping */ IF( EQ_16( hParamMC->hMetadataPMC->num_parameter_bands, 20 ) ) { @@ -1669,9 +1622,6 @@ ivas_error ivas_param_mc_dec_reconfig( { int16_t k, nchan_transport; PARAM_MC_DEC_HANDLE hParamMC; -#ifndef FIX_901_PARAMMC_DEAD_CODE - IVAS_OUTPUT_SETUP hTransportSetup; -#endif int16_t nchan_out_transport; int16_t nchan_out_cov; float proto_matrix[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -1700,9 +1650,6 @@ ivas_error ivas_param_mc_dec_reconfig( output_Fs = st_ivas->hDecoderConfig->output_Fs; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; -#ifndef FIX_901_PARAMMC_DEAD_CODE - hTransportSetup = st_ivas->hTransSetup; -#endif mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; @@ -1742,25 +1689,9 @@ ivas_error ivas_param_mc_dec_reconfig( hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* deallocate the full icc map, gets newly allocated in the metadata open function */ - - for ( k = 0; k < 2; k++ ) - { - if ( hParamMC->hMetadataPMC->icc_map_full[k] != NULL ) - { - free( hParamMC->hMetadataPMC->icc_map_full[k] ); - hParamMC->hMetadataPMC->icc_map_full[k] = NULL; - } - } -#endif mvs2s( hParamMC->band_grouping, band_grouping_old, hParamMC->hMetadataPMC->num_parameter_bands + 1 ); -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_open( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); -#else ivas_param_mc_metadata_open( mc_ls_setup, ivas_total_brate, hParamMC->hMetadataPMC ); -#endif /* Band Grouping */ if ( hParamMC->hMetadataPMC->num_parameter_bands == 20 ) @@ -2248,9 +2179,6 @@ void ivas_param_mc_dec_close_fx( /* parameter decoding */ IF( hParamMC->hMetadataPMC != NULL ) { -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_close( hParamMC->hMetadataPMC ); -#endif free( hParamMC->hMetadataPMC ); hParamMC->hMetadataPMC = NULL; } @@ -2365,9 +2293,6 @@ void ivas_param_mc_dec_close( /* parameter decoding */ if ( hParamMC->hMetadataPMC != NULL ) { -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_close( hParamMC->hMetadataPMC ); -#endif free( hParamMC->hMetadataPMC ); hParamMC->hMetadataPMC = NULL; } @@ -2486,9 +2411,6 @@ void ivas_param_mc_dec_read_BS_fx( Word16 num_param_bands; Word16 metadata_bit_pos; Word16 i, j, k; -#ifndef FIX_901_PARAMMC_DEAD_CODE - int16_t l; -#endif Word16 icc_map_size; Word16 icc_map_size_wo_lfe; Word16 ild_map_size; @@ -2632,67 +2554,6 @@ void ivas_param_mc_dec_read_BS_fx( move16(); } -#ifndef FIX_901_PARAMMC_DEAD_CODE - if ( hMetadataPMC->flag_use_adaptive_icc_map == 1 ) - { - int16_t icc_mapping_index[PARAM_MC_SZ_ICC_MAP]; - - k = 0; - for ( i = 0; i < hMetadataPMC->icc_map_size_full - 1; i++ ) - { - if ( bit_buffer[bit_pos++] == 1 ) - { - icc_mapping_index[k++] = i; - } - } - - /* last one is always C/LFE */ - icc_mapping_index[k] = hMetadataPMC->icc_map_size_full - 1; - - /* save icc mapping of the previous frame*/ - /* build icc map for the current frame */ - for ( k = 0; k < icc_map_size; k++ ) - { - hMetadataPMC->icc_mapping[param_frame_idx][k][0] = hMetadataPMC->icc_map_full[0][icc_mapping_index[k]]; - hMetadataPMC->icc_mapping[param_frame_idx][k][1] = hMetadataPMC->icc_map_full[1][icc_mapping_index[k]]; - } - - if ( hMetadataPMC->bAttackPresent ) - { - for ( k = 0; k < icc_map_size; k++ ) - { - for ( l = 0; l < PARAM_MC_PARAMETER_FRAMES; l++ ) - { - hMetadataPMC->icc_mapping[l][k][0] = hMetadataPMC->icc_map_full[0][icc_mapping_index[k]]; - hMetadataPMC->icc_mapping[l][k][1] = hMetadataPMC->icc_map_full[1][icc_mapping_index[k]]; - } - } - } - else - { - for ( k = 0; k < icc_map_size; k++ ) - { - hMetadataPMC->icc_mapping[hMetadataPMC->param_frame_idx][k][0] = hMetadataPMC->icc_map_full[0][icc_mapping_index[k]]; - hMetadataPMC->icc_mapping[hMetadataPMC->param_frame_idx][k][1] = hMetadataPMC->icc_map_full[1][icc_mapping_index[k]]; - } - } - } - else - { - if ( hMetadataPMC->bAttackPresent ) - { - for ( l = 0; l < PARAM_MC_PARAMETER_FRAMES; l++ ) - { - ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[param_frame_idx] ); - } - } - else - { - ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[hMetadataPMC->param_frame_idx] ); - } - } - -#endif ivas_param_mc_bs_decode_parameter_values_fx( bit_buffer, &bit_pos, bits_to_copy, &st->BER_detect, hMetadataPMC, &hMetadataPMC->icc_coding, icc_map_size_wo_lfe, icc_map_size, num_lfe_bands, band_step, num_param_bands, hParamMC->icc_q_fx ); @@ -2748,9 +2609,6 @@ void ivas_param_mc_dec_read_BS( int16_t num_param_bands; int16_t metadata_bit_pos; int16_t i, j, k; -#ifndef FIX_901_PARAMMC_DEAD_CODE - int16_t l; -#endif int16_t icc_map_size; int16_t icc_map_size_wo_lfe; int16_t ild_map_size; @@ -2839,67 +2697,6 @@ void ivas_param_mc_dec_read_BS( num_lfe_bands = 0; } -#ifndef FIX_901_PARAMMC_DEAD_CODE - if ( hMetadataPMC->flag_use_adaptive_icc_map == 1 ) - { - int16_t icc_mapping_index[PARAM_MC_SZ_ICC_MAP]; - - k = 0; - for ( i = 0; i < hMetadataPMC->icc_map_size_full - 1; i++ ) - { - if ( bit_buffer[bit_pos++] == 1 ) - { - icc_mapping_index[k++] = i; - } - } - - /* last one is always C/LFE */ - icc_mapping_index[k] = hMetadataPMC->icc_map_size_full - 1; - - /* save icc mapping of the previous frame*/ - /* build icc map for the current frame */ - for ( k = 0; k < icc_map_size; k++ ) - { - hMetadataPMC->icc_mapping[param_frame_idx][k][0] = hMetadataPMC->icc_map_full[0][icc_mapping_index[k]]; - hMetadataPMC->icc_mapping[param_frame_idx][k][1] = hMetadataPMC->icc_map_full[1][icc_mapping_index[k]]; - } - - if ( hMetadataPMC->bAttackPresent ) - { - for ( k = 0; k < icc_map_size; k++ ) - { - for ( l = 0; l < PARAM_MC_PARAMETER_FRAMES; l++ ) - { - hMetadataPMC->icc_mapping[l][k][0] = hMetadataPMC->icc_map_full[0][icc_mapping_index[k]]; - hMetadataPMC->icc_mapping[l][k][1] = hMetadataPMC->icc_map_full[1][icc_mapping_index[k]]; - } - } - } - else - { - for ( k = 0; k < icc_map_size; k++ ) - { - hMetadataPMC->icc_mapping[hMetadataPMC->param_frame_idx][k][0] = hMetadataPMC->icc_map_full[0][icc_mapping_index[k]]; - hMetadataPMC->icc_mapping[hMetadataPMC->param_frame_idx][k][1] = hMetadataPMC->icc_map_full[1][icc_mapping_index[k]]; - } - } - } - else - { - if ( hMetadataPMC->bAttackPresent ) - { - for ( l = 0; l < PARAM_MC_PARAMETER_FRAMES; l++ ) - { - ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[param_frame_idx] ); - } - } - else - { - ivas_param_mc_default_icc_map( hMetadataPMC->icc_mapping_conf, hMetadataPMC->icc_mapping[hMetadataPMC->param_frame_idx] ); - } - } - -#endif ivas_param_mc_bs_decode_parameter_values( bit_buffer, &bit_pos, bits_to_copy, &st->BER_detect, hMetadataPMC, &hMetadataPMC->icc_coding, icc_map_size_wo_lfe, icc_map_size, num_lfe_bands, band_step, num_param_bands, hParamMC->icc_q ); if ( !st->BER_detect ) @@ -2942,7 +2739,6 @@ void ivas_param_mc_dec_read_BS( *------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -#ifdef FIX_835_PARAMMC_BUFFER_VALUES void ivas_param_mc_dec_digest_tc_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ @@ -3253,388 +3049,153 @@ void ivas_param_mc_dec_digest_tc_fx( return; } #else -void ivas_param_mc_dec_digest_tc_fx( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - Word32 *transport_channels_f_fx[], - Word16 transport_f_e ) +void ivas_param_mc_dec_digest_tc( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ + const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ + float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ +) { PARAM_MC_DEC_HANDLE hParamMC; - Word16 i, ch; - Word16 slot_idx, param_band_idx; - Word16 nchan_transport, nchan_out_transport, nchan_out_cldfb; - Word16 nchan_out_cov; + int16_t i, ch; + int16_t slot_idx, param_band_idx; + int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb; + int16_t nchan_out_cov; /*CLDFB*/ + float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; + float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; + float real_part, imag_part; /* format converter */ - Word16 channel_active[MAX_OUTPUT_CHANNELS]; + int16_t channel_active[MAX_OUTPUT_CHANNELS]; IVAS_OUTPUT_SETUP *hSynthesisOutputSetup; hParamMC = st_ivas->hParamMC; assert( hParamMC ); - Word32 cx_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - Word16 cx_buff_e[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - Word16 cx_e; - - Word32 cx_imag_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - Word16 cx_imag_e, tmp_e; - Word16 qout = 0; - - Word32 real_part_fx, imag_part_fx, L_tmp1, L_tmp2; - - Word16 max_e; - push_wmops( "param_mc_dec_digest_tc" ); - set16_fx( channel_active, 0, MAX_CICP_CHANNELS ); + set_s( channel_active, 0, MAX_CICP_CHANNELS ); nchan_transport = st_ivas->nchan_transport; - move16(); - nchan_out_transport = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ); + nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - test(); - test(); - IF( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) + if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { nchan_out_cldfb = BINAURAL_CHANNELS; - move16(); - set16_fx( channel_active, 1, nchan_out_cldfb ); - nchan_out_cov = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ); + set_s( channel_active, 1, nchan_out_cldfb ); + nchan_out_cov = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; hSynthesisOutputSetup = &st_ivas->hTransSetup; } - ELSE IF( EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_CLDFB ) ) + else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) { nchan_out_cov = nchan_out_transport; - move16(); - nchan_out_cldfb = add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe ); + nchan_out_cldfb = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; hSynthesisOutputSetup = &st_ivas->hTransSetup; } - ELSE IF( EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_COV ) || EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) + else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) { - nchan_out_cov = add( st_ivas->hOutSetup.nchan_out_woLFE, st_ivas->hOutSetup.num_lfe ); + nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; nchan_out_cldfb = nchan_out_cov; - move16(); - set16_fx( channel_active, 1, nchan_out_cov ); + set_s( channel_active, 1, nchan_out_cov ); hSynthesisOutputSetup = &st_ivas->hOutSetup; } - ELSE + else { nchan_out_cov = nchan_out_transport; - move16(); nchan_out_cldfb = nchan_out_transport; - move16(); - set16_fx( channel_active, 1, nchan_out_cov ); + set_s( channel_active, 1, nchan_out_cov ); hSynthesisOutputSetup = &st_ivas->hTransSetup; } /* adapt transient position */ - IF( hParamMC->hMetadataPMC->bAttackPresent ) + if ( hParamMC->hMetadataPMC->bAttackPresent ) { - hParamMC->hMetadataPMC->attackIndex = s_max( 0, add( hParamMC->hMetadataPMC->attackIndex, shr( sub( nCldfbSlots, DEFAULT_JBM_CLDFB_TIMESLOTS ), 1 ) ) ); - move16(); + hParamMC->hMetadataPMC->attackIndex = (int16_t) max( 0, hParamMC->hMetadataPMC->attackIndex + ( ( nCldfbSlots - DEFAULT_JBM_CLDFB_TIMESLOTS ) / 2 ) ); } /* adapt subframes */ hParamMC->num_slots = nCldfbSlots; - move16(); hParamMC->slots_rendered = 0; - move16(); hParamMC->subframes_rendered = 0; - move16(); ivas_jbm_dec_get_adapted_subframes( nCldfbSlots, hParamMC->subframe_nbslots, &hParamMC->nb_subframes ); st_ivas->hTcBuffer->nb_subframes = hParamMC->nb_subframes; - move16(); - Copy( hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, hParamMC->nb_subframes ); + mvs2s( hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, hParamMC->nb_subframes ); - ivas_param_mc_dec_compute_interpolator_fx( hParamMC->hMetadataPMC->bAttackPresent, hParamMC->hMetadataPMC->attackIndex, nCldfbSlots, hParamMC->h_output_synthesis_params.interpolator_fx ); + ivas_param_mc_dec_compute_interpolator( hParamMC->hMetadataPMC->bAttackPresent, hParamMC->hMetadataPMC->attackIndex, nCldfbSlots, hParamMC->h_output_synthesis_params.interpolator ); - FOR( param_band_idx = 0; param_band_idx < PARAM_MC_MAX_PARAMETER_BANDS; param_band_idx++ ) + for ( param_band_idx = 0; param_band_idx < PARAM_MC_MAX_PARAMETER_BANDS; param_band_idx++ ) { - set_zero_fx( cx_fx[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); - set_zero_fx( cx_imag_fx[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); + set_zero( cx[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); + set_zero( cx_imag[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); } - cx_e = 0; - move16(); - cx_imag_e = 0; - move16(); - // cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; - move16(); - /* slot loop for gathering the input data */ - FOR( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) + for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) { - IF( st_ivas->hDecoderConfig->Opt_tsm ) + if ( st_ivas->hDecoderConfig->Opt_tsm ) { - Word32 RealBuffer_fx[CLDFB_NO_CHANNELS_MAX]; - Word32 ImagBuffer_fx[CLDFB_NO_CHANNELS_MAX]; + float RealBuffer[CLDFB_NO_CHANNELS_MAX]; + float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; /* CLDFB Analysis*/ - FOR( ch = 0; ch < nchan_transport; ch++ ) + for ( ch = 0; ch < nchan_transport; ch++ ) { - qout = transport_f_e; - move16(); - cldfbAnalysis_ts_fx_fixed_q( &( transport_channels_f_fx[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer_fx, ImagBuffer_fx, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch], &qout ); + cldfbAnalysis_ts_ivas( &( transport_channels_f[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - Copy32( RealBuffer_fx, &hParamMC->Cldfb_RealBuffer_tc_fx[L_add( L_mult0( imult1616( slot_idx, hParamMC->num_freq_bands ), nchan_transport ), L_mult0( ch, hParamMC->num_freq_bands ) )], hParamMC->num_freq_bands ); - Copy32( ImagBuffer_fx, &hParamMC->Cldfb_ImagBuffer_tc_fx[L_add( L_mult0( imult1616( slot_idx, hParamMC->num_freq_bands ), nchan_transport ), L_mult0( ch, hParamMC->num_freq_bands ) )], hParamMC->num_freq_bands ); + mvr2r( RealBuffer, &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); + mvr2r( ImagBuffer, &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); } - - hParamMC->Cldfb_ImagBuffer_tc_e = qout; - move16(); } - IF( GE_16( slot_idx, shl( hParamMC->hMetadataPMC->attackIndex, 1 ) ) ) + if ( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex ) { - ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( &hParamMC->Cldfb_RealBuffer_tc_fx[L_mult0( imult1616( slot_idx, hParamMC->num_freq_bands ), nchan_transport )], - /*hParamMC->Cldfb_RealBuffer_tc_e*/ Q31 - Q6, - &hParamMC->Cldfb_ImagBuffer_tc_fx[L_mult0( imult1616( slot_idx, hParamMC->num_freq_bands ), nchan_transport )], - /*hParamMC->Cldfb_ImagBuffer_tc_e*/ Q31 - Q6, - cx_fx, - &cx_e, - cx_imag_fx, - &cx_imag_e, - hParamMC, - nchan_transport ); + ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport], &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport], cx, cx_imag, hParamMC, nchan_transport ); } } /* map from complex input covariance to real values */ - - FOR( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) + for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) { /* Cx for transport channels */ - FOR( i = 0; i < imult1616( nchan_transport, nchan_transport ); i++ ) + for ( i = 0; i < nchan_transport * nchan_transport; i++ ) { - - real_part_fx = cx_fx[param_band_idx][i]; - move16(); - imag_part_fx = cx_imag_fx[param_band_idx][i]; - move16(); - cx_buff_e[param_band_idx][i] = cx_e; - move16(); + real_part = cx[param_band_idx][i]; + imag_part = cx_imag[param_band_idx][i]; /* (a-ib)(c+id) = ac + bd + i(ad-bc) */ - IF( LT_16( param_band_idx, hParamMC->max_param_band_abs_cov ) ) + if ( param_band_idx < hParamMC->max_param_band_abs_cov ) { - L_tmp1 = Mpy_32_32( real_part_fx, real_part_fx ); - L_tmp2 = Mpy_32_32( imag_part_fx, imag_part_fx ); - L_tmp1 = BASOP_Util_Add_Mant32Exp( L_tmp1, add( cx_e, cx_e ), L_tmp2, add( cx_imag_e, cx_imag_e ), &tmp_e ); - cx_fx[param_band_idx][i] = Sqrt32( L_tmp1, &tmp_e ); - move32(); - cx_buff_e[param_band_idx][i] = tmp_e; - move16(); + cx[param_band_idx][i] = sqrtf( real_part * real_part + imag_part * imag_part ); } - ELSE + else { - cx_fx[param_band_idx][i] = real_part_fx; - move32(); - cx_buff_e[param_band_idx][i] = cx_e; - move16(); + cx[param_band_idx][i] = real_part; } } } - max_e = cx_buff_e[0][0]; - move16(); - - FOR( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) + /* we have to do it similar to the encoder in case of attacks (i.e. accumulate two bands) to ensure correct DMX of the target covariance*/ + if ( hParamMC->hMetadataPMC->bAttackPresent && ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) ) { - /* Cx for transport channels */ - FOR( i = 0; i < imult1616( nchan_transport, nchan_transport ); i++ ) + for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 ) { - - IF( LT_16( max_e, cx_buff_e[param_band_idx][i] ) ) - { - max_e = cx_buff_e[param_band_idx][i]; - } + v_add( cx[param_band_idx], cx[param_band_idx + 1], cx[param_band_idx], nchan_transport * nchan_transport ); + mvr2r( cx[param_band_idx], cx[param_band_idx + 1], nchan_transport * nchan_transport ); } } - FOR( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) - { - /* Cx for transport channels */ - FOR( i = 0; i < imult1616( nchan_transport, nchan_transport ); i++ ) - { - cx_fx[param_band_idx][i] = L_shr( cx_fx[param_band_idx][i], sub( max_e, cx_buff_e[param_band_idx][i] ) ); - move32(); - } + if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) + { + ivas_param_mc_get_mono_stereo_mixing_matrices( hParamMC, cx, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_out_transport, nchan_transport, nchan_out_cov ); + } + else + { + /* generate mixing matrices */ + ivas_param_mc_get_mixing_matrices( hParamMC, hSynthesisOutputSetup, cx, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); } - cx_e = max_e; - move16(); + pop_wmops(); - - /* we have to do it similar to the encoder in case of attacks (i.e. accumulate two bands) to ensure correct DMX of the target covariance*/ - - test(); - test(); - IF( hParamMC->hMetadataPMC->bAttackPresent && ( EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_COV ) || EQ_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) ) - { - FOR( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 ) - { - v_add_fx( cx_fx[param_band_idx], cx_fx[add( param_band_idx, 1 )], cx_fx[param_band_idx], imult1616( nchan_transport, nchan_transport ) ); - Copy32( cx_fx[param_band_idx], cx_fx[add( param_band_idx, 1 )], imult1616( nchan_transport, nchan_transport ) ); - } - } - - IF( NE_32( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) - { - - ivas_param_mc_get_mixing_matrices_fx( hParamMC, hSynthesisOutputSetup, cx_fx, cx_e, hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); - } - - pop_wmops(); - - return; -} -#endif -#else -void ivas_param_mc_dec_digest_tc( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ - float *transport_channels_f[] /* i : synthesized core-coder transport channels/DirAC output */ -) -{ - PARAM_MC_DEC_HANDLE hParamMC; - int16_t i, ch; - int16_t slot_idx, param_band_idx; - int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb; - int16_t nchan_out_cov; - /*CLDFB*/ - float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - float real_part, imag_part; - /* format converter */ - int16_t channel_active[MAX_OUTPUT_CHANNELS]; - IVAS_OUTPUT_SETUP *hSynthesisOutputSetup; - - hParamMC = st_ivas->hParamMC; - assert( hParamMC ); - - push_wmops( "param_mc_dec_digest_tc" ); - - set_s( channel_active, 0, MAX_CICP_CHANNELS ); - nchan_transport = st_ivas->nchan_transport; - nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - nchan_out_cldfb = BINAURAL_CHANNELS; - set_s( channel_active, 1, nchan_out_cldfb ); - nchan_out_cov = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - hSynthesisOutputSetup = &st_ivas->hTransSetup; - } - else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) - { - nchan_out_cov = nchan_out_transport; - nchan_out_cldfb = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - hSynthesisOutputSetup = &st_ivas->hTransSetup; - } - else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - nchan_out_cldfb = nchan_out_cov; - set_s( channel_active, 1, nchan_out_cov ); - hSynthesisOutputSetup = &st_ivas->hOutSetup; - } - else - { - nchan_out_cov = nchan_out_transport; - nchan_out_cldfb = nchan_out_transport; - set_s( channel_active, 1, nchan_out_cov ); - hSynthesisOutputSetup = &st_ivas->hTransSetup; - } - - /* adapt transient position */ - if ( hParamMC->hMetadataPMC->bAttackPresent ) - { - hParamMC->hMetadataPMC->attackIndex = (int16_t) max( 0, hParamMC->hMetadataPMC->attackIndex + ( ( nCldfbSlots - DEFAULT_JBM_CLDFB_TIMESLOTS ) / 2 ) ); - } - /* adapt subframes */ - hParamMC->num_slots = nCldfbSlots; - hParamMC->slots_rendered = 0; - hParamMC->subframes_rendered = 0; - ivas_jbm_dec_get_adapted_subframes( nCldfbSlots, hParamMC->subframe_nbslots, &hParamMC->nb_subframes ); - st_ivas->hTcBuffer->nb_subframes = hParamMC->nb_subframes; - mvs2s( hParamMC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, hParamMC->nb_subframes ); - - ivas_param_mc_dec_compute_interpolator( hParamMC->hMetadataPMC->bAttackPresent, hParamMC->hMetadataPMC->attackIndex, nCldfbSlots, hParamMC->h_output_synthesis_params.interpolator ); - - for ( param_band_idx = 0; param_band_idx < PARAM_MC_MAX_PARAMETER_BANDS; param_band_idx++ ) - { - set_zero( cx[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); - set_zero( cx_imag[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); - } - - /* slot loop for gathering the input data */ - for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ ) - { - if ( st_ivas->hDecoderConfig->Opt_tsm ) - { - float RealBuffer[CLDFB_NO_CHANNELS_MAX]; - float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; - - /* CLDFB Analysis*/ - for ( ch = 0; ch < nchan_transport; ch++ ) - { - cldfbAnalysis_ts_ivas( &( transport_channels_f[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - - mvr2r( RealBuffer, &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); - mvr2r( ImagBuffer, &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands ); - } - } - if ( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex ) - { - ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport], &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport], cx, cx_imag, hParamMC, nchan_transport ); - } - } - - /* map from complex input covariance to real values */ - for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) - { - /* Cx for transport channels */ - for ( i = 0; i < nchan_transport * nchan_transport; i++ ) - { - real_part = cx[param_band_idx][i]; - imag_part = cx_imag[param_band_idx][i]; - - /* (a-ib)(c+id) = ac + bd + i(ad-bc) */ - if ( param_band_idx < hParamMC->max_param_band_abs_cov ) - { - cx[param_band_idx][i] = sqrtf( real_part * real_part + imag_part * imag_part ); - } - else - { - cx[param_band_idx][i] = real_part; - } - } - } - - /* we have to do it similar to the encoder in case of attacks (i.e. accumulate two bands) to ensure correct DMX of the target covariance*/ - if ( hParamMC->hMetadataPMC->bAttackPresent && ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) ) - { - for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 ) - { - v_add( cx[param_band_idx], cx[param_band_idx + 1], cx[param_band_idx], nchan_transport * nchan_transport ); - mvr2r( cx[param_band_idx], cx[param_band_idx + 1], nchan_transport * nchan_transport ); - } - } - - - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - ivas_param_mc_get_mono_stereo_mixing_matrices( hParamMC, cx, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_out_transport, nchan_transport, nchan_out_cov ); - } - else - { - /* generate mixing matrices */ - ivas_param_mc_get_mixing_matrices( hParamMC, hSynthesisOutputSetup, cx, hParamMC->h_output_synthesis_cov_state.mixing_matrix, hParamMC->h_output_synthesis_cov_state.mixing_matrix_res, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); - } - - pop_wmops(); - - return; -} -#endif + return; +} +#endif /*------------------------------------------------------------------------- @@ -5280,7 +4841,6 @@ static void ivas_param_mc_get_mixing_matrices( return; } #else -#ifdef FIX_835_PARAMMC_BUFFER_VALUES static void ivas_param_mc_get_mixing_matrices_fx( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, @@ -5689,404 +5249,6 @@ static void ivas_param_mc_get_mixing_matrices_fx( return; } -#else -static void ivas_param_mc_get_mixing_matrices_fx( - PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ - IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, - Word32 Cx_in_fixed[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : input covariance for all parameter bands */ - Word16 Cx_in_e, - Word32 *mixing_matrix_fx[], - Word16 *mixing_matrix_e, - Word32 *mixing_matrix_res_fx[], - Word16 *mixing_matrix_res_e, - const Word16 nY_intern, /* i : number of channels in the transported format */ - const PARAM_MC_SYNTHESIS_CONF synth_config, /* i : Parametric MC synthesis config */ - const Word16 nX, /* i : number of transport channels */ - const Word16 nY_cov /* i : number of covariance synthesis output channels */ -) -{ - Word16 matSize = MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS; - Word16 param_band_idx; - Word16 nY_band; - Word16 num_lfe_bands; - Word16 brange[2]; - uint16_t i; - Word16 ch_idx1, ch_idx2, lfe_idx1, lfe_idx2; - Word16 remove_lfe; - Word16 lfe_indices[PARAM_MC_LOCAL_SZ_LFE_MAP]; - - Word32 Cx_fx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - Word32 Cy_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - - Word32 Cy_full_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - - Word32 Cr_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - Word16 Cr_e; - Word32 Cy_diag_fx[MAX_OUTPUT_CHANNELS]; - Word16 Cy_diag_buff_e[MAX_OUTPUT_CHANNELS]; - Word32 mixing_matrix_local_fx[MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; - Word16 Cy_diag_e = 0, mixing_matrix_local_e = 0; - Word32 Cproto_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - Word16 Cproto_e; - Word32 *proto_matrix_ptr_fx; - Word32 *Cx_state_fx; - Word32 *Cx_old_state_fx; - Word32 Cy_state_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - Word32 *Cy_old_state_fx; - Word16 Cx_state_e; - Word16 Cy_state_e; - Word32 mixing_matrix_res_local_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - Word16 mixing_matrix_res_local_e; - Word32 L_tmp; - Word16 tmp_e, tmp; - - Word16 proto_matrix_e = hParamMC->h_output_synthesis_params.proto_matrix_e; - move16(); - Word32 proto_matrix_noLFE_fx[PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS]; - - Word32 mat_mult_buffer1_fx[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - - Word32 Cproto_diag_fx[MAX_CICP_CHANNELS]; - Word16 mat_mult_buffer1_e, proto_matrix_ptr_e, Cproto_diag_e; - - Word32 *ptrMM_fx; - Word32 *ptrMM_out_fx; - - Word16 Cy_e, Cx_e; - Word16 Cy_full_e; - - set_zero_fx( Cproto_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); - set_zero_fx( mat_mult_buffer1_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); - set_zero_fx( proto_matrix_noLFE_fx, PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS ); -#ifdef MSAN_FIX - set_zero_fx( mixing_matrix_res_local_fx, MAX_CICP_CHANNELS * MAX_CICP_CHANNELS ); -#endif - Word16 proto_matrix_noLFE_e = 0; - move16(); - - Word32 Cx_in_fx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - - - FOR( i = 0; i < PARAM_MC_MAX_PARAMETER_BANDS; i++ ) - Copy32( Cx_in_fixed[i], Cx_in_fx[i], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); - - nY_band = nY_cov; - move16(); - num_lfe_bands = 0; - move16(); - remove_lfe = 0; - move16(); - - set16_fx( lfe_indices, -1, PARAM_MC_LOCAL_SZ_LFE_MAP ); - IF( hSynthesisOutputSetup->num_lfe ) - { - Word32 *proto_matrix_ptr_in_fx; - FOR( lfe_idx1 = 0; lfe_idx1 < hSynthesisOutputSetup->num_lfe; lfe_idx1++ ) - { - lfe_indices[lfe_idx1 + 1] = hSynthesisOutputSetup->index_lfe[lfe_idx1]; - move16(); - } - lfe_indices[add( hSynthesisOutputSetup->num_lfe, 1 )] = nY_cov; - move16(); - proto_matrix_ptr_fx = &proto_matrix_noLFE_fx[0]; - proto_matrix_ptr_in_fx = &hParamMC->h_output_synthesis_params.proto_matrix_fx[0]; - proto_matrix_noLFE_e = proto_matrix_e; - move16(); - - set_zero_fx( proto_matrix_noLFE_fx, PARAM_MC_MAX_TRANSPORT_CHANS * MAX_CICP_CHANNELS ); - - FOR( ch_idx1 = 0; ch_idx1 < nX; ch_idx1++ ) - { - FOR( lfe_idx1 = 0; lfe_idx1 < add( hSynthesisOutputSetup->num_lfe, 1 ); lfe_idx1++ ) - { - FOR( ch_idx2 = add( lfe_indices[lfe_idx1], 1 ); ch_idx2 < lfe_indices[lfe_idx1 + 1]; ch_idx2++ ) - { - *( proto_matrix_ptr_fx++ ) = *( proto_matrix_ptr_in_fx++ ); - move32(); - } - proto_matrix_ptr_in_fx++; - } - proto_matrix_ptr_in_fx--; - } - - proto_matrix_ptr_e = proto_matrix_e; - move16(); - } - - if ( hParamMC->hMetadataPMC->lfe_on ) - { - num_lfe_bands = PARAM_MC_MAX_BAND_LFE; - move16(); - } - - FOR( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) - { - IF( hSynthesisOutputSetup->num_lfe > 0 && param_band_idx >= num_lfe_bands ) - { - remove_lfe = 1; - move16(); - nY_band = sub( nY_cov, hSynthesisOutputSetup->num_lfe ); - proto_matrix_ptr_fx = proto_matrix_noLFE_fx; - proto_matrix_ptr_e = proto_matrix_noLFE_e; - move16(); - } - ELSE - { - proto_matrix_ptr_fx = hParamMC->h_output_synthesis_params.proto_matrix_fx; - proto_matrix_ptr_e = hParamMC->h_output_synthesis_params.proto_matrix_e; - move16(); - } - - brange[0] = hParamMC->band_grouping[param_band_idx]; - move16(); - brange[1] = hParamMC->band_grouping[param_band_idx + 1]; - move16(); - - Cx_state_fx = Cx_in_fx[param_band_idx]; - Cx_old_state_fx = hParamMC->h_output_synthesis_cov_state.cx_old_fx[param_band_idx]; - Cy_old_state_fx = hParamMC->h_output_synthesis_cov_state.cy_old_fx[param_band_idx]; - - - /* Getting mixing mtx */ - /* estimate target cov from input cov and proto_matrix */ - - Cx_state_e = Cx_in_e; - move16(); - matrix_product_fx( hParamMC->proto_matrix_int_fx, nY_intern, nX, 0, Cx_state_fx, nX, nX, 0, mat_mult_buffer1_fx ); - mat_mult_buffer1_e = add( hParamMC->proto_matrix_int_e, Cx_in_e ); - - matrix_product_fx( mat_mult_buffer1_fx, nY_intern, nX, 0, hParamMC->proto_matrix_int_fx, nY_intern, nX, 1, Cproto_fx ); - Cproto_e = add( mat_mult_buffer1_e, hParamMC->proto_matrix_int_e ); - - FOR( ch_idx1 = 0; ch_idx1 < nY_intern; ch_idx1++ ) - { - IF( BASOP_Util_Cmp_Mant32Exp( Cproto_fx[L_add( ch_idx1, L_mult0( ch_idx1, nY_intern ) )], Cproto_e, 0, 0 ) < 0 ) - { - Cproto_fx[L_add( ch_idx1, L_mult0( ch_idx1, nY_intern ) )] = 0; - move32(); - } - } - - set_zero_fx( Cy_state_fx, matSize ); - Cy_state_e = 0; - move16(); - - ivas_param_mc_dequantize_cov_fx( hParamMC, - hParamMC->icld_q_fx + L_mult0( param_band_idx, hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe ), - hParamMC->icc_q_fx + L_mult0( param_band_idx, hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe ), - param_band_idx, nY_cov, - synth_config, - nY_intern, - nX, Cx_state_fx, Cx_state_e, Cproto_fx, Cproto_e, Cy_state_fx, &Cy_state_e ); - - // dbgwrite2_txt(Cy_state_fx,nY_intern*nY_intern,"../cy_state_fx.txt"); - - /* Smoothing: Sum over two buffers */ - IF( hParamMC->hMetadataPMC->bAttackPresent ) - { - /* no smoothing on attacks */ - Copy32( Cx_state_fx, Cx_fx, imult1616( nX, nX ) ); - Copy32( Cy_state_fx, Cy_full_fx, imult1616( nY_cov, nY_cov ) ); - Cy_full_e = Cy_state_e; - move16(); - Cx_e = Cx_state_e; - move16(); - } - ELSE - { - /* smoothing gains are now identical to one, simply add up */ - // v_add( Cy_state, Cy_old_state, Cy_full, nY_cov * nY_cov ); - - v_add_fixed_me( Cx_state_fx, Cx_state_e, Cx_old_state_fx, hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx], Cx_fx, &Cx_e, imult1616( nX, nX ), 1 ); - v_add_fixed_me( Cy_state_fx, Cy_state_e, Cy_old_state_fx, hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx], Cy_full_fx, &Cy_full_e, imult1616( nY_cov, nY_cov ), 1 ); - } - - Copy32( Cx_state_fx, Cx_old_state_fx, imult1616( nX, nX ) ); - - Copy32( Cy_state_fx, Cy_old_state_fx, imult1616( nY_cov, nY_cov ) ); - - Word16 new_e = 0; - move16(); - - hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx] = Cx_state_e; - move16(); - hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx] = Cy_state_e; - move16(); - - FOR( i = 0; i < imult1616( nX, nX ); i++ ) - { - if ( Cx_old_state_fx[i] != 0 ) - { - new_e = hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx]; - move16(); - } - } - - hParamMC->h_output_synthesis_cov_state.cx_old_e[param_band_idx] = new_e; - move16(); - - new_e = 0; - move16(); - - FOR( i = 0; i < imult1616( nY_cov, nY_cov ); i++ ) - { - if ( Cy_old_state_fx[i] != 0 ) - { - new_e = hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx]; - move16(); - } - } - - hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx] = new_e; - move16(); - - /* remove LFE IF necessary */ - IF( remove_lfe ) - { - - Cy_e = Cy_full_e; - remove_lfe_from_cy_fx( nY_cov, lfe_indices, hSynthesisOutputSetup->num_lfe, Cy_full_fx, Cy_fx ); - } - ELSE - { - Copy32( Cy_full_fx, Cy_fx, imult1616( nY_band, nY_band ) ); - Cy_e = Cy_full_e; - move16(); - } - - matrix_product_fx( proto_matrix_ptr_fx, nY_band, nX, 0, Cx_fx, nX, nX, 0, mat_mult_buffer1_fx ); - mat_mult_buffer1_e = add( proto_matrix_ptr_e, Cx_e ); - - matrix_product_diag_fx( mat_mult_buffer1_fx, mat_mult_buffer1_e, nY_band, nX, 0, proto_matrix_ptr_fx, proto_matrix_ptr_e, nY_band, nX, 1, Cproto_diag_fx, &Cproto_diag_e ); - - /* make sure we have no negative entries in Cproto_diag due to rounding errors */ - - FOR( ch_idx1 = 0; ch_idx1 < nY_band; ch_idx1++ ) - { - if ( BASOP_Util_Cmp_Mant32Exp( Cproto_diag_fx[ch_idx1], Cproto_diag_e, 0, 0 ) < 0 ) - { - Cproto_diag_fx[ch_idx1] = 0; - move16(); - } - } - - - /* Computing the mixing matrices */ - - /* bands with decorr */ - IF( LT_16( brange[0], hParamMC->h_output_synthesis_params.max_band_decorr ) ) - { - computeMixingMatrices_fx( nX, nY_band, Cx_fx, Cx_e, Cy_fx, Cy_e, proto_matrix_ptr_fx, proto_matrix_ptr_e, 0, PARAM_MC_REG_SX_FX, 0, PARAM_MC_REG_GHAT_FX, 0, mixing_matrix_local_fx, &mixing_matrix_local_e, Cr_fx, &Cr_e ); - /* Compute mixing matrix FOR residual */ - computeMixingMatricesResidual_fx( nY_band, Cproto_diag_fx, Cproto_diag_e, Cr_fx, Cr_e, PARAM_MC_REG_SX_FX, 0, PARAM_MC_REG_GHAT_FX, 0, mixing_matrix_res_local_fx, &mixing_matrix_res_local_e ); - - IF( remove_lfe ) - { - set_zero_fx( mixing_matrix_res_fx[param_band_idx], imult1616( nY_cov, nY_cov ) ); - - ptrMM_fx = mixing_matrix_res_local_fx; - ptrMM_out_fx = mixing_matrix_res_fx[param_band_idx]; - FOR( lfe_idx1 = 0; lfe_idx1 < add( hSynthesisOutputSetup->num_lfe, 1 ); lfe_idx1++ ) - { - FOR( ch_idx1 = add( lfe_indices[lfe_idx1], 1 ); ch_idx1 < lfe_indices[lfe_idx1 + 1]; ch_idx1++ ) - { - FOR( lfe_idx2 = 0; lfe_idx2 < add( hSynthesisOutputSetup->num_lfe, 1 ); lfe_idx2++ ) - { - FOR( ch_idx2 = add( lfe_indices[lfe_idx2], 1 ); ch_idx2 < lfe_indices[lfe_idx2 + 1]; ch_idx2++ ) - { - *( ptrMM_out_fx++ ) = *( ptrMM_fx++ ); - move32(); - } - ptrMM_out_fx++; - } - ptrMM_out_fx--; - } - ptrMM_out_fx += nY_cov; - } - mixing_matrix_res_e[param_band_idx] = mixing_matrix_res_local_e; - move16(); - } - ELSE - { - Copy32( mixing_matrix_res_local_fx, mixing_matrix_res_fx[param_band_idx], imult1616( nY_cov, nY_cov ) ); - mixing_matrix_res_e[param_band_idx] = mixing_matrix_res_local_e; - move16(); - } - } - ELSE IF( brange[0] < hParamMC->max_band_energy_compensation ) - { - /* Compute mixing matrices (energy compensation only) */ - computeMixingMatrices_fx( nX, nY_band, Cx_fx, Cx_e, Cy_fx, Cy_e, proto_matrix_ptr_fx, proto_matrix_ptr_e, 1, PARAM_MC_REG_SX_FX, 0, PARAM_MC_REG_GHAT_FX, 0, mixing_matrix_local_fx, &mixing_matrix_local_e, Cr_fx, &Cr_e ); - } - ELSE - { - /*IF neither decorrelation nor energy compensation is applied*/ - FOR( i = 0; i < nY_band; i++ ) - { - tmp = BASOP_Util_Divide3232_Scale( Cy_fx[i], L_add( Cproto_diag_fx[i], EPSILON_FX ), &tmp_e ); - tmp_e = add( Cy_diag_e, Cproto_diag_e ); - L_tmp = Sqrt32( L_deposit_h( tmp ), &tmp_e ); - Cy_diag_fx[i] = L_tmp; - move32(); - Cy_diag_buff_e[i] = tmp_e; - move16(); - } - - - Cy_diag_e = Cy_diag_buff_e[0]; - move16(); - - FOR( i = 1; i < nY_band; i++ ) - { - if ( LT_16( Cy_diag_e, Cy_diag_buff_e[i] ) ) - { - Cy_diag_e = Cy_diag_buff_e[i]; - move16(); - } - } - - FOR( i = 0; i < nY_band; i++ ) - { - Cy_diag_fx[i] = L_shr( Cy_diag_fx[i], sub( Cy_diag_e, Cy_diag_buff_e[i] ) ); - move32(); - } - - diag_matrix_product_fx( Cy_diag_fx, Cy_diag_e, nY_band, proto_matrix_ptr_fx, proto_matrix_ptr_e, nY_band, nX, 0, mixing_matrix_local_fx, &mixing_matrix_local_e ); - } - - IF( remove_lfe ) - { - set_zero_fx( mixing_matrix_fx[param_band_idx], imult1616( nX, nY_cov ) ); - ptrMM_fx = mixing_matrix_local_fx; - ptrMM_out_fx = mixing_matrix_fx[param_band_idx]; - FOR( ch_idx1 = 0; ch_idx1 < nX; ch_idx1++ ) - { - FOR( lfe_idx1 = 0; lfe_idx1 < add( hSynthesisOutputSetup->num_lfe, 1 ); lfe_idx1++ ) - { - FOR( ch_idx2 = add( lfe_indices[lfe_idx1], 1 ); ch_idx2 < lfe_indices[lfe_idx1 + 1]; ch_idx2++ ) - { - *( ptrMM_out_fx++ ) = *( ptrMM_fx++ ); - move32(); - } - ptrMM_out_fx++; - } - ptrMM_out_fx--; - } - - mixing_matrix_e[param_band_idx] = mixing_matrix_local_e; - move16(); - } - ELSE - { - Copy32( mixing_matrix_local_fx, mixing_matrix_fx[param_band_idx], imult1616( nY_cov, nX ) ); - mixing_matrix_e[param_band_idx] = mixing_matrix_local_e; - move16(); - } - } - - return; -} -#endif #endif @@ -6309,15 +5471,9 @@ static void ivas_param_mc_dequantize_cov( int16_t l; float *Cyp; float ap; -#ifndef FIX_901_PARAMMC_DEAD_CODE - int16_t param_frame_idx; -#endif const PARAM_MC_ILD_MAPPING *h_ild_mapping; float Cy_state_int[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; -#ifndef FIX_901_PARAMMC_DEAD_CODE - param_frame_idx = hParamMC->hMetadataPMC->param_frame_idx; -#endif set_zero( Nrqq, MAX_OUTPUT_CHANNELS ); h_ild_mapping = hParamMC->hMetadataPMC->ild_mapping_conf; @@ -6359,13 +5515,8 @@ static void ivas_param_mc_dequantize_cov( /* replace some estimated ICCs with transmitted values */ for ( k = 0; k < hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe; k++ ) { -#ifndef FIX_901_PARAMMC_DEAD_CODE - Cy_state_int[hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][0] + nY_int * hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][1]] = icc_q[k]; - Cy_state_int[hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][1] + nY_int * hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][0]] = icc_q[k]; -#else Cy_state_int[hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][0] + nY_int * hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][1]] = icc_q[k]; Cy_state_int[hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][1] + nY_int * hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][0]] = icc_q[k]; -#endif } if ( param_band_index >= PARAM_MC_MAX_BAND_LFE || !hParamMC->hMetadataPMC->lfe_on ) @@ -6489,9 +5640,6 @@ static void ivas_param_mc_dequantize_cov_fx( Word16 *Cyp_e; Word32 ap_fx; // Q(31 - ap_e) Word16 ap_e; -#ifndef FIX_901_PARAMMC_DEAD_CODE - Word16 param_frame_idx; -#endif Word32 L_tmp; Word16 tmp, tmp_e; const PARAM_MC_ILD_MAPPING *h_ild_mapping; @@ -6499,9 +5647,6 @@ static void ivas_param_mc_dequantize_cov_fx( Word16 Cy_state_int_e[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; set16_fx( Cp_buf_e, Cproto_e, MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS ); -#ifndef FIX_901_PARAMMC_DEAD_CODE - param_frame_idx = hParamMC->hMetadataPMC->param_frame_idx; -#endif set32_fx( Nrqq_fx, 0, MAX_OUTPUT_CHANNELS ); set16_fx( Nrqq_e, 0, MAX_OUTPUT_CHANNELS ); h_ild_mapping = hParamMC->hMetadataPMC->ild_mapping_conf; @@ -6596,16 +5741,6 @@ static void ivas_param_mc_dequantize_cov_fx( /* replace some estimated ICCs with transmitted values */ FOR( k = 0; k < hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe; k++ ) { -#ifndef FIX_901_PARAMMC_DEAD_CODE - Cy_state_int_fx[hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][0] + nY_int * hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][1]] = L_shr( L_deposit_h( icc_q_fx[k] ), tmp ); - move32(); - Cy_state_int_e[hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][0] + nY_int * hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][1]] = tmp; - move16(); - Cy_state_int_fx[hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][1] + nY_int * hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][0]] = L_shr( L_deposit_h( icc_q_fx[k] ), tmp ); - move32(); - Cy_state_int_e[hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][1] + nY_int * hParamMC->hMetadataPMC->icc_mapping[param_frame_idx][k][0]] = tmp; - move16(); -#else Cy_state_int_fx[hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][0] + ( nY_int * hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][1] )] = L_shr( L_deposit_h( icc_q_fx[k] ), tmp ); move32(); Cy_state_int_e[hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][0] + ( nY_int * hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][1] )] = tmp; @@ -6614,7 +5749,6 @@ static void ivas_param_mc_dequantize_cov_fx( move32(); Cy_state_int_e[hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][1] + ( nY_int * hParamMC->hMetadataPMC->icc_mapping_conf->icc_mapping[k][0] )] = tmp; move16(); -#endif } test(); diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index ae5057bc1c5604d32776b115b2a740b3c33e9457..98c883bb0a500a847903e1ec28746d1f29d71b60 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -367,11 +367,7 @@ ivas_error ivas_mct_dec_fx( set32_fx( &output_fx[0][0], 0, L_FRAME48k ); set32_fx( &output_fx[1][0], 0, L_FRAME48k ); -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, cpe_id, &output_fx[0], output_frame, 0, &q_output ) ), IVAS_ERR_OK ) ) -#else IF( NE_32( ( error = ivas_cpe_dec_fx( st_ivas, cpe_id, &output_fx[0], output_frame, 0 ) ), IVAS_ERR_OK ) ) -#endif { return error; } @@ -2066,188 +2062,186 @@ static ivas_error ivas_mc_dec_reconfig_fx( } test(); - IF( st_ivas->hBinRendererTd != NULL && ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) ) ){ -#ifdef FIX_1033_MEMORY_LEAK_OMASA - IF( EQ_16( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM, TRUE ) ){ -#endif + IF( st_ivas->hBinRendererTd != NULL && ( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) ) ) + { + IF( EQ_16( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM, TRUE ) ) + { ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); - st_ivas->hHrtfTD = NULL; -#ifdef FIX_1033_MEMORY_LEAK_OMASA - } -#endif - } + st_ivas->hHrtfTD = NULL; + } + } - IF( st_ivas->hDiracDecBin != NULL ) - { - test(); - test(); - IF( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) && NE_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) - { - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - } - } + IF( st_ivas->hDiracDecBin != NULL ) + { + test(); + test(); + IF( NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) && NE_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) && NE_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) + { + ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); + } + } - /* init necessary new renderers */ - test(); - test(); - test(); - test(); - test(); - IF( st_ivas->hBinRenderer == NULL && ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) ) - { - IF( ( error = ivas_binRenderer_open_fx( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - ELSE IF( st_ivas->hBinRendererTd == NULL && EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) ) - { - IF( ( error = ivas_td_binaural_open_fx( st_ivas, &st_ivas->SrcInd[0], &st_ivas->num_src ) ) != IVAS_ERR_OK ) - { - return error; - } - IF( EQ_16( st_ivas->hIntSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - { - IF( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) + /* init necessary new renderers */ + test(); + test(); + test(); + test(); + test(); + IF( st_ivas->hBinRenderer == NULL && ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); + IF( ( error = ivas_binRenderer_open_fx( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } } + ELSE IF( st_ivas->hBinRendererTd == NULL && EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_OBJECTS_TD ) ) + { + IF( ( error = ivas_td_binaural_open_fx( st_ivas, &st_ivas->SrcInd[0], &st_ivas->num_src ) ) != IVAS_ERR_OK ) + { + return error; + } + IF( EQ_16( st_ivas->hIntSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + IF( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); + } - st_ivas->hCrendWrapper->hCrend = NULL; - st_ivas->hCrendWrapper->hHrtfCrend = NULL; - IF( ( st_ivas->hCrendWrapper->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) + st_ivas->hCrendWrapper->hCrend = NULL; + st_ivas->hCrendWrapper->hHrtfCrend = NULL; + IF( ( st_ivas->hCrendWrapper->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); + } + } + } + ELSE IF( st_ivas->hCrendWrapper == NULL && ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); + IF( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; + move32(); } } } - ELSE IF( st_ivas->hCrendWrapper == NULL && ( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV_ROOM ) ) ) + /*-----------------------------------------------------------------* + * CLDFB instances + *-----------------------------------------------------------------*/ + + IF( NE_32( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ), IVAS_ERR_OK ) ) { - IF( ( error = ivas_rend_openCrend( &( st_ivas->hCrendWrapper ), st_ivas->intern_config, st_ivas->hDecoderConfig->output_config, st_ivas->hRenderConfig, st_ivas->hSetOfHRTF, st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; - move32(); + return error; } -} -} -/*-----------------------------------------------------------------* - * CLDFB instances - *-----------------------------------------------------------------*/ - -IF( NE_32( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, nchan_transport_old, numCldfbAnalyses_old, numCldfbSyntheses_old ) ), IVAS_ERR_OK ) ) -{ - return error; -} - -/*-----------------------------------------------------------------* - * JBM TC buffers - *-----------------------------------------------------------------*/ -{ - Word16 tc_nchan_full_new; - DECODER_TC_BUFFER_HANDLE hTcBuffer; - - hTcBuffer = st_ivas->hTcBuffer; - tc_buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas ); - tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); - tc_nchan_allocate_new = tc_nchan_tc_new; - move16(); - tc_nchan_full_new = tc_nchan_tc_new; - move16(); + /*-----------------------------------------------------------------* + * JBM TC buffers + *-----------------------------------------------------------------*/ - test(); - test(); - IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { - tc_nchan_allocate_new = BINAURAL_CHANNELS * 2; - move16(); - tc_nchan_full_new = tc_nchan_allocate_new; - move16(); - } + Word16 tc_nchan_full_new; + DECODER_TC_BUFFER_HANDLE hTcBuffer; - test(); - test(); - IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMMC ) && NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) ) - { - tc_nchan_full_new = 0; + hTcBuffer = st_ivas->hTcBuffer; + tc_buffer_mode_new = ivas_jbm_dec_get_tc_buffer_mode( st_ivas ); + tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas ); + tc_nchan_allocate_new = tc_nchan_tc_new; move16(); - } - ELSE IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) - { - tc_nchan_allocate_new = MC_PARAMUPMIX_MAX_INPUT_CHANS; + tc_nchan_full_new = tc_nchan_tc_new; move16(); - tc_buffer_mode_new = TC_BUFFER_MODE_RENDERER; - move32(); + test(); - IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) ) + test(); + IF( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) || EQ_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { - tc_buffer_mode_new = TC_BUFFER_MODE_BUFFER; - move32(); - tc_nchan_tc_new = st_ivas->hDecoderConfig->nchan_out; + tc_nchan_allocate_new = BINAURAL_CHANNELS * 2; move16(); - tc_nchan_allocate_new = tc_nchan_tc_new; + tc_nchan_full_new = tc_nchan_allocate_new; move16(); } - tc_nchan_full_new = tc_nchan_allocate_new; - move16(); - } - /* reconfigure buffer */ - test(); - test(); - test(); - test(); - IF( NE_16( hTcBuffer->tc_buffer_mode, tc_buffer_mode_new ) || NE_16( hTcBuffer->nchan_transport_jbm, tc_nchan_tc_new ) || - NE_16( hTcBuffer->nchan_buffer_full, tc_nchan_full_new ) || NE_16( hTcBuffer->nchan_transport_internal, tc_nchan_allocate_new ) || - NE_16( tc_granularity_new, hTcBuffer->n_samples_granularity ) ) - { - IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_reconfigure_fx( st_ivas, tc_buffer_mode_new, tc_nchan_tc_new, tc_nchan_allocate_new, tc_nchan_full_new, tc_granularity_new ) ), IVAS_ERR_OK ) ) + test(); + test(); + IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMMC ) && NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) && NE_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) ) { - return error; + tc_nchan_full_new = 0; + move16(); + } + ELSE IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) + { + tc_nchan_allocate_new = MC_PARAMUPMIX_MAX_INPUT_CHANS; + move16(); + tc_buffer_mode_new = TC_BUFFER_MODE_RENDERER; + move32(); + test(); + IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_STEREO ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_MONO ) ) + { + tc_buffer_mode_new = TC_BUFFER_MODE_BUFFER; + move32(); + tc_nchan_tc_new = st_ivas->hDecoderConfig->nchan_out; + move16(); + tc_nchan_allocate_new = tc_nchan_tc_new; + move16(); + } + tc_nchan_full_new = tc_nchan_allocate_new; + move16(); + } + + /* reconfigure buffer */ + test(); + test(); + test(); + test(); + IF( NE_16( hTcBuffer->tc_buffer_mode, tc_buffer_mode_new ) || NE_16( hTcBuffer->nchan_transport_jbm, tc_nchan_tc_new ) || + NE_16( hTcBuffer->nchan_buffer_full, tc_nchan_full_new ) || NE_16( hTcBuffer->nchan_transport_internal, tc_nchan_allocate_new ) || + NE_16( tc_granularity_new, hTcBuffer->n_samples_granularity ) ) + { + IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_reconfigure_fx( st_ivas, tc_buffer_mode_new, tc_nchan_tc_new, tc_nchan_allocate_new, tc_nchan_full_new, tc_granularity_new ) ), IVAS_ERR_OK ) ) + { + return error; + } + } + /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ + IF( st_ivas->hSpatParamRendCom != NULL ) + { + st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + move16(); + st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + move16(); + st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; + move16(); + st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + move16(); + Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); + } + ELSE IF( st_ivas->hParamMC != NULL ) + { + st_ivas->hParamMC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; + move16(); + st_ivas->hParamMC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; + move16(); + st_ivas->hParamMC->num_slots = st_ivas->hTcBuffer->num_slots; + move16(); + st_ivas->hParamMC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; + move16(); + Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hParamMC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } - /* transfer subframe info from central tc buffer to ParamMC or McMASA (DirAC) */ - IF( st_ivas->hSpatParamRendCom != NULL ) - { - st_ivas->hSpatParamRendCom->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - move16(); - st_ivas->hSpatParamRendCom->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - move16(); - st_ivas->hSpatParamRendCom->num_slots = st_ivas->hTcBuffer->num_slots; - move16(); - st_ivas->hSpatParamRendCom->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - move16(); - Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpatParamRendCom->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); - } - ELSE IF( st_ivas->hParamMC != NULL ) - { - st_ivas->hParamMC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; - move16(); - st_ivas->hParamMC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; - move16(); - st_ivas->hParamMC->num_slots = st_ivas->hTcBuffer->num_slots; - move16(); - st_ivas->hParamMC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; - move16(); - Copy( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hParamMC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); - } -} -/*-----------------------------------------------------------------* - * floating-point output audio buffers - *-----------------------------------------------------------------*/ + /*-----------------------------------------------------------------* + * floating-point output audio buffers + *-----------------------------------------------------------------*/ -nchan_out_buff = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); + nchan_out_buff = ivas_get_nchan_buffers_dec_ivas_fx( st_ivas, -1, -1 ); -IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) -{ + IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) + { + return error; + } return error; } -return error; -} #else static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -2722,15 +2716,11 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) { -#ifdef FIX_1033_MEMORY_LEAK_OMASA if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) { -#endif ivas_td_binaural_close( &st_ivas->hBinRendererTd ); st_ivas->hHrtfTD = NULL; -#ifdef FIX_1033_MEMORY_LEAK_OMASA } -#endif } if ( st_ivas->hDiracDecBin != NULL ) diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index bc011058c9380f6c49795bd6fe2e11bb0ea398d7..d822005039b2d790cf605b8e84142172d79d42fe 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -1862,7 +1862,6 @@ void ivas_mdct_core_reconstruct( { set_f( &synth[k * L_frame[ch]], 0.f, L_frame[ch] ); set_f( &synthFB[k * L_frame[ch]], 0.f, L_frameTCX[ch] ); -#ifdef FIX_903_ZERO_OUT_IMDCT_BUFFERS_FOR_MCT_IGNORE /* Note: these buffers are not subframe-based, hence no indexing with k */ set_f( &st->hHQ_core->old_outLB[0], 0.f, L_frame[ch] ); set_f( &st->hHQ_core->old_out[0], 0.f, L_frameTCX[ch] ); @@ -1870,7 +1869,6 @@ void ivas_mdct_core_reconstruct( set_f( &st->hTcxDec->syn_OverlFB[0], 0.f, L_frameTCX[ch] / 2 ); set_f( &st->hTcxDec->syn_Overl_TDAC[0], 0.f, L_frame[ch] / 2 ); set_f( &st->hTcxDec->syn_Overl_TDACFB[0], 0.f, L_frameTCX[ch] / 2 ); -#endif } } @@ -2102,7 +2100,6 @@ void ivas_mdct_core_reconstruct_fx( { set16_fx( &synth_fx[k * L_frame[ch]], 0, L_frame[ch] ); set16_fx( &synthFB_fx[k * L_frame[ch]], 0, L_frameTCX[ch] ); -#ifdef FIX_903_ZERO_OUT_IMDCT_BUFFERS_FOR_MCT_IGNORE /* Note: these buffers are not subframe-based, hence no indexing with k */ set16_fx( &st->hHQ_core->old_out_LB_fx[0], 0, L_frame[ch] ); set16_fx( &st->hHQ_core->old_out_fx[0], 0, L_frameTCX[ch] ); @@ -2110,7 +2107,6 @@ void ivas_mdct_core_reconstruct_fx( set16_fx( &st->hTcxDec->syn_OverlFB[0], 0, shr( L_frameTCX[ch], 1 ) ); set16_fx( &st->hTcxDec->syn_Overl_TDAC[0], 0, shr( L_frame[ch], 1 ) ); set16_fx( &st->hTcxDec->syn_Overl_TDACFB[0], 0, shr( L_frameTCX[ch], 1 ) ); -#endif } } diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 4771a8055dbf15d0c999ee1f8ba99dd976924df6..ab2a81673f3f74b81a349bd86f5f49c96d82436f 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -452,17 +452,13 @@ ivas_error ivas_omasa_dec_config_fx( IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { /* Allocate TD renderer for the objects in DISC mode */ -#ifdef FIX_1033_MEMORY_LEAK_OMASA IF( st_ivas->hBinRendererTd == NULL ) { -#endif IF( NE_32( ( error = ivas_td_binaural_open_fx( st_ivas, SrcInd, num_src ) ), IVAS_ERR_OK ) ) { return error; } -#ifdef FIX_1033_MEMORY_LEAK_OMASA } -#endif /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) ) @@ -473,17 +469,13 @@ ivas_error ivas_omasa_dec_config_fx( ELSE { /* TD renderer handle */ -#ifdef FIX_1033_MEMORY_LEAK_OMASA test(); IF( st_ivas->hBinRendererTd != NULL && EQ_16( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM, TRUE ) ) { -#endif ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); st_ivas->hHrtfTD = NULL; -#ifdef FIX_1033_MEMORY_LEAK_OMASA } -#endif /* ISM renderer handle + ISM data handle */ ivas_omasa_separate_object_renderer_close( st_ivas ); @@ -713,18 +705,14 @@ ivas_error ivas_omasa_dec_config( { if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { -#ifdef FIX_1033_MEMORY_LEAK_OMASA if ( st_ivas->hBinRendererTd == NULL ) { -#endif /* Allocate TD renderer for the objects in DISC mode */ if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#ifdef FIX_1033_MEMORY_LEAK_OMASA } -#endif /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ if ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -735,15 +723,11 @@ ivas_error ivas_omasa_dec_config( else { /* TD renderer handle */ -#ifdef FIX_1033_MEMORY_LEAK_OMASA if ( st_ivas->hBinRendererTd != NULL && st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) { -#endif ivas_td_binaural_close( &st_ivas->hBinRendererTd ); st_ivas->hHrtfTD = NULL; -#ifdef FIX_1033_MEMORY_LEAK_OMASA } -#endif /* ISM renderer handle + ISM data handle */ ivas_omasa_separate_object_renderer_close( st_ivas ); diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 37315192ff4137caf0dbdcc6002ccd54d4653370..47f1bdb60c1670e9c41d8896a98866390a1ff628 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -1725,7 +1725,6 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512( IF( EQ_32( hQMetaData->no_directions, 2 ) ) { #ifdef MSAN_FIX -#ifdef FIX_982_WRONG_DECODED_ENERGY_RATIO FOR( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { FOR( m = 0; m < hQMetaData->q_direction[0].cfg.nblocks; m++ ) @@ -1734,16 +1733,6 @@ Word16 ivas_qmetadata_dec_decode_hr_384_512( move32(); } } -#else - FOR( b = 0; b < hQMetaData->q_direction[1].cfg.nbands; b++ ) - { - FOR( m = 0; m < hQMetaData->q_direction[1].cfg.nblocks; m++ ) - { - hQMetaData->q_direction[1].band_data[b].energy_ratio_fx[m] = W_round64_L( W_nrg_ratio[1][b][m] ); /*Q30*/ - move32(); - } - } -#endif #else FOR( b = 0; b < MASA_MAXIMUM_CODING_SUBBANDS; b++ ) { @@ -8054,9 +8043,7 @@ static int16_t read_surround_coherence_hr( IVAS_QDIRECTION *q_direction; int16_t min_index; int16_t d, idx; -#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP int32_t int_error_ratio_surr; -#endif coding_subbands = hQMetaData->q_direction[0].cfg.nbands; q_direction = hQMetaData->q_direction; @@ -8080,10 +8067,8 @@ static int16_t read_surround_coherence_hr( error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[sf]; } -#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP int_error_ratio_surr = (int32_t) ( MASA_SUR_COH_PRECISION * error_ratio_surr ); error_ratio_surr = (float) ( int_error_ratio_surr * MASA_SUR_COH_THRESHOLD ); -#endif if ( error_ratio_surr <= 0 ) { @@ -8784,9 +8769,7 @@ void ivas_omasa_decode_masa_to_total( float q_dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS], dct_data_tmp[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; int16_t n_streams, len_stream; -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL int32_t int_tmp; -#endif /* Setup coding parameters */ n_streams = 1; @@ -8841,10 +8824,8 @@ void ivas_omasa_decode_masa_to_total( { masa_to_total_energy_ratio[i][j] = max( 0.0f, q_dct_data[k] ); masa_to_total_energy_ratio[i][j] = min( 1.0f, masa_to_total_energy_ratio[i][j] ); -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL int_tmp = (int32_t) ( MASA_SUR_COH_PRECISION * masa_to_total_energy_ratio[i][j] ); masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA_SUR_COH_THRESHOLD ); -#endif k++; } } @@ -8856,10 +8837,8 @@ void ivas_omasa_decode_masa_to_total( for ( j = 0; j < nbands; j++ ) { masa_to_total_energy_ratio[i][j] = masa_to_total_energy_ratio[0][j]; -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL int_tmp = (int32_t) ( MASA_SUR_COH_PRECISION * masa_to_total_energy_ratio[i][j] ); masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA_SUR_COH_THRESHOLD ); -#endif } } } @@ -8871,10 +8850,8 @@ void ivas_omasa_decode_masa_to_total( for ( i = 0; i < nblocks; i++ ) { masa_to_total_energy_ratio[i][j] = masa_to_total_energy_ratio[i][0]; -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL int_tmp = (int32_t) ( MASA_SUR_COH_PRECISION * masa_to_total_energy_ratio[i][j] ); masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA_SUR_COH_THRESHOLD ); -#endif } } } diff --git a/lib_dec/ivas_range_uni_dec.c b/lib_dec/ivas_range_uni_dec.c index b2e00ffc20c04a800b27a8e801d3aceeacec1db7..3da1c5a199669d4c7e48a97e1956dbf429e15090 100644 --- a/lib_dec/ivas_range_uni_dec.c +++ b/lib_dec/ivas_range_uni_dec.c @@ -632,27 +632,18 @@ UWord16 rc_uni_dec_read_bits( UWord32 range; /* local copy (4 to 7 uses) */ Word16 norm_range; UWord32 temp1, temp2; -#ifdef FIX851_RANGE_DEC_PRECISION Word16 exp_temp1; -#endif low = rc_st_dec->rc_low; /*Q0*/ range = rc_st_dec->rc_range; /*Q0*/ move32(); move32(); range = (UWord32) W_shr( range, bits ); /*range >>= bits*/ -#ifdef FIX851_RANGE_DEC_PRECISION exp_temp1 = sub( W_norm( low ), 31 + 1 ); temp1 = (UWord32) W_shl( low, exp_temp1 ); /*Q : W_norm( low ) - 32*/ norm_range = sub( W_norm( range ), 31 ); temp2 = (UWord32) W_shl( range, norm_range ); /*Q : W_norm( range ) - 31*/ val = (UWord32) W_shr( UL_div( temp1, temp2 ), sub( add( 32, exp_temp1 ), norm_range ) ); /*Q0*/ -#else - temp1 = (UWord32) W_shr( low, 1 ); - norm_range = sub( W_norm( range ), 31 ); - temp2 = (UWord32) W_shl( range, norm_range ); - val = (UWord32) W_shr( UL_div( temp1, temp2 ), sub( 32 - 1, norm_range ) ); -#endif /* in case of bitstream errors it is possible that val >= (1 << bits) */ IF( W_shr( val, bits ) != 0 ) /* equivalent condition */ diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index 4e669a80347637705c3944e59b54fcfbdd4f2e47..8baa08aa34fca382c23e1c85284aedb1ec6fe1b1 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -385,8 +385,6 @@ static void map_params_dirac_to_stereo( side_gain[b + STEREO_DFT_BAND_MAX] += nrg_norm2 * block_nrg[block] * sinf( azimuth[block][b] * EVS_PI / 180 ) * cosf( elevation[block][b] * EVS_PI / 180 ); } } - -#ifdef NONBE_FIX_1096_NAN_VALUES_IN_DIRAC_TO_STEREO /* Clamp values here. [-1, 1] is the allowed range, but due to precision issues they can be slightly off which can cause problems later. */ side_gain[b] *= sqrtf( 1.f - diffuseness[b] ); side_gain[b] = max( min( side_gain[b], 1 ), -1 ); @@ -397,12 +395,6 @@ static void map_params_dirac_to_stereo( res_pred_gain[b] = max( min( res_pred_gain[b], 1 ), 0 ); res_pred_gain[b + STEREO_DFT_BAND_MAX] = diffuseness[b] * ( 1.0f - surrCoh[b] ); res_pred_gain[b + STEREO_DFT_BAND_MAX] = max( min( res_pred_gain[b + STEREO_DFT_BAND_MAX], 1 ), 0 ); -#else - side_gain[b] *= sqrtf( 1.f - diffuseness[b] ); - side_gain[b + STEREO_DFT_BAND_MAX] *= sqrtf( 1.f - diffuseness[b] ); - res_pred_gain[b] = diffuseness[b] * ( 1.0f - surrCoh[b] ); - res_pred_gain[b + STEREO_DFT_BAND_MAX] = diffuseness[b] * ( 1.0f - surrCoh[b] ); -#endif } } diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index 36562cc4db10060cccd10b27afa04a6e85a1201c..a38a6f3b26acb15dcf3dc43b982a4a553b4c8fe9 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -656,7 +656,6 @@ void ivas_ism2sba_sf_fx( move32(); prev_gain_fx = hIsmRendererData->prev_gains_fx[i][j]; /*Q29*/ move32(); -#ifdef IVAS_ENH32_CADENCE_CHANGES FOR( k = 0; k < n_samples_to_render; k++ ) { g1_fx = sub( 32767, *g2_fx ); /*Q15*/ @@ -666,17 +665,6 @@ void ivas_ism2sba_sf_fx( tc_fx++; out_fx++; } -#else - FOR( k = 0; k < n_samples_to_render; k++ ) - { - g1_fx = sub( 32767, *g2_fx ); - *( out_fx ) = L_add( *( out_fx ), Mult_32_32( ( Mult_32_16( gain_fx, ( *( g2_fx ) ) ) + Mult_32_16( prev_gain_fx, g1_fx ) ), ( *( tc_fx ) ) ) ); /*Q_buffer_in + 29 - 31*/ - move32(); - g2_fx++; - tc_fx++; - out_fx++; - } -#endif } } FOR( j = 0; j < sba_num_chans; j++ ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 07d7fd3c5d80952316f11882d816eb4eafc7fc03..11de05c5d0cb21dd274692ee2f27f283e8b2d96b 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -322,11 +322,7 @@ typedef struct stereo_dft_dec_data_struct Word16 Q_nrg_subr; Word16 prev_Q_stefi_sig; -#ifdef FIX_826_PRECISION_LOST_AND_COMPL Word16 q_td_gain[STEREO_DFT_CORE_HIST_MAX]; -#else - Word32 q_td_gain[STEREO_DFT_CORE_HIST_MAX]; -#endif Word16 q_hb_stefi_sig_fx; #endif diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 3d4adac216f7951f58f5211566bcadd6639405a0..2f7b109570aa015e1624eaea82ba1dd0ffe104e3 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -3063,11 +3063,7 @@ void stereo_dft_dec_smooth_parameters( if ( hStereoDft->frame_sid_nodata ) { /* set new xfade target if new itd received */ -#ifdef NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO if ( hStereoDft->ipd_xfade_counter < STEREO_DFT_ITD_CNG_XFADE ) -#else - if ( hStereoDft->gipd[k + k_offset] != hStereoDft->ipd_xfade_target ) -#endif { if ( ( hStereoDft->gipd[k + k_offset] - hStereoDft->ipd_xfade_prev ) > EVS_PI ) { @@ -3113,11 +3109,7 @@ void stereo_dft_dec_smooth_parameters( if ( hStereoDft->frame_sid_nodata ) { /* set new xfade target if new itd received */ -#ifdef NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO if ( hStereoDft->itd_xfade_counter < STEREO_DFT_ITD_CNG_XFADE ) -#else - if ( hStereoDft->itd[k + k_offset] != hStereoDft->itd_xfade_target ) -#endif { hStereoDft->itd_xfade_target = hStereoDft->itd[k + k_offset]; hStereoDft->itd_xfade_step = ( hStereoDft->itd_xfade_target - hStereoDft->itd_xfade_prev ) / ( STEREO_DFT_ITD_CNG_XFADE - hStereoDft->itd_xfade_counter ); diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index 71aaec7dfcc375ddb1c60a8d7a5e7088382aaefc..efdd353a090ff41f626f6234477b95bd05456641 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -208,11 +208,7 @@ void stereo_dft_dec_reset_fx( set32_fx( hStereoDft->hb_stefi_sig_fx, 0, L_FRAME48k + NS2SA( 48000, STEREO_DFT_TD_STEFI_DELAY_NS ) ); set32_fx( hStereoDft->hb_nrg_fx, 0, STEREO_DFT_CORE_HIST_MAX ); set32_fx( hStereoDft->td_gain_fx, 0, STEREO_DFT_CORE_HIST_MAX ); -#ifdef FIX_826_PRECISION_LOST_AND_COMPL set16_fx( hStereoDft->q_td_gain, 0, STEREO_DFT_CORE_HIST_MAX ); -#else - set32_fx( hStereoDft->q_td_gain, 0, STEREO_DFT_CORE_HIST_MAX ); -#endif hStereoDft->q_dft = 0; move16(); @@ -677,11 +673,7 @@ void stereo_dft_dec_update_fx( Copy32( hStereoDft->hb_stefi_sig_fx + output_frame, hStereoDft->hb_stefi_sig_fx, hStereoDft->hb_stefi_delay ); /* Qx */ Copy32( hStereoDft->hb_nrg_fx, hStereoDft->hb_nrg_fx + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); /* Qx */ Copy32( hStereoDft->td_gain_fx, hStereoDft->td_gain_fx + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); /* q_td_gain */ -#ifdef FIX_826_PRECISION_LOST_AND_COMPL Copy( hStereoDft->q_td_gain, hStereoDft->q_td_gain + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); -#else - Copy32( hStereoDft->q_td_gain, hStereoDft->q_td_gain + 1, STEREO_DFT_CORE_HIST_MAX - 1 ); -#endif IF( sba_dirac_stereo_flag ) { @@ -900,18 +892,14 @@ void stereo_dft_dec_smooth_parameters_fx( Word32 diff_ipd; Word16 nbands; Word32 max_res_pred_ind; -#ifdef FIX_874_INCREASE_IPD_PRECISION Word32 PI_round; -#endif N_div = STEREO_DFT_NBDIV; move16(); k_offset = STEREO_DFT_OFFSET; move16(); -#ifdef FIX_874_INCREASE_IPD_PRECISION PI_round = EVS_PI_FX_Q27 + EPSILLON_FX; /*add error corrections when comparing ipds with exactly a difference of pi*/ move32(); -#endif test(); IF( hStereoDft->frame_sid_nodata || prev_sid_nodata ) @@ -926,20 +914,12 @@ void stereo_dft_dec_smooth_parameters_fx( IF( hStereoDft->frame_sid_nodata ) { /* set new xfade target if new itd received */ -#ifdef NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO IF( LT_16( hStereoDft->ipd_xfade_counter, STEREO_DFT_ITD_CNG_XFADE ) ) -#else - IF( NE_32( hStereoDft->gipd_fx[add( k, k_offset )], hStereoDft->ipd_xfade_target_fx ) ) -#endif { Word16 q_val; IF( GT_32( L_sub( hStereoDft->gipd_fx[k + k_offset], hStereoDft->ipd_xfade_prev_fx ), EVS_PI_FX_Q27 ) ) { -#ifdef FIX_874_INCREASE_IPD_PRECISION_A hStereoDft->ipd_xfade_target_fx = L_sub( hStereoDft->gipd_fx[k + k_offset], EVS_PI_FX_Q27 << 1 ); /* Q27 */ -#else - hStereoDft->ipd_xfade_target_fx = L_sub( hStereoDft->gipd_fx[add( k, k_offset )], EVS_PI_FX_Q27 ); -#endif move32(); hStereoDft->ipd_xfade_step_fx = BASOP_Util_Divide3232_Scale( L_sub( hStereoDft->ipd_xfade_target_fx, hStereoDft->ipd_xfade_prev_fx ), L_shl( L_sub( STEREO_DFT_ITD_CNG_XFADE, hStereoDft->ipd_xfade_counter ), Q24 ), &q_val ); /* Q27 */ move32(); @@ -958,11 +938,7 @@ void stereo_dft_dec_smooth_parameters_fx( } ELSE IF( GT_32( L_sub( hStereoDft->ipd_xfade_prev_fx, hStereoDft->gipd_fx[k + k_offset] ), EVS_PI_FX_Q27 ) ) { -#ifndef FIX_874_INCREASE_IPD_PRECISION_A - hStereoDft->ipd_xfade_target_fx = L_add( hStereoDft->gipd_fx[add( k, k_offset )], L_shl( EVS_PI_FX_Q27, 1 ) ); -#else hStereoDft->ipd_xfade_target_fx = L_add( hStereoDft->gipd_fx[k + k_offset], EVS_PI_FX_Q27 << 1 ); /* Q27 */ -#endif move32(); hStereoDft->ipd_xfade_step_fx = BASOP_Util_Divide3232_Scale( L_sub( hStereoDft->ipd_xfade_target_fx, hStereoDft->ipd_xfade_prev_fx ), L_shl( L_sub( STEREO_DFT_ITD_CNG_XFADE, hStereoDft->ipd_xfade_counter ), Q24 ), &q_val ); /* Q27 */ q_val = add( q_val, Q9 ); /* Q27 - (Q15 - q_val + (-3))*/ @@ -1032,11 +1008,7 @@ void stereo_dft_dec_smooth_parameters_fx( IF( hStereoDft->frame_sid_nodata ) { /* set new xfade target if new itd received */ -#ifdef NONBE_FIX_1010_STEREO_CNG_DIV_BY_ZERO IF( LT_16( hStereoDft->itd_xfade_counter, STEREO_DFT_ITD_CNG_XFADE ) ) -#else - IF( NE_32( hStereoDft->itd_fx[add( k, k_offset )], hStereoDft->itd_xfade_target_fx ) ) -#endif { Word16 q_val; hStereoDft->itd_xfade_target_fx = hStereoDft->itd_fx[k + k_offset]; /* Q15 */ @@ -1251,20 +1223,12 @@ void stereo_dft_dec_smooth_parameters_fx( /* Smoothing of IPDs*/ pgIpd = hStereoDft->gipd_fx + ( add( k, k_offset ) ); diff_ipd = L_sub( pgIpd[0], pgIpd[-hStereoDft->prm_res[k + k_offset]] ); /* Q27 */ -#ifndef FIX_874_INCREASE_IPD_PRECISION - IF( LT_32( diff_ipd, -EVS_PI_FX_Q27 ) ) -#else IF( LT_32( diff_ipd, -PI_round ) ) -#endif { pgIpd[0] = L_add( pgIpd[0], EVS_2PI_FX_Q27 ); /* Q27 */ move32(); } -#ifndef FIX_874_INCREASE_IPD_PRECISION - ELSE IF( GT_32( diff_ipd, EVS_PI_FX_Q27 ) ) -#else ELSE IF( GT_32( diff_ipd, PI_round ) ) -#endif { pgIpd[0] = L_sub( pgIpd[0], EVS_2PI_FX_Q27 ); /* Q27 */ move32(); @@ -2474,19 +2438,12 @@ static void stereo_dft_compute_td_stefi_params_fx( } static void stereo_dft_dequantize_ipd_fx( - Word16 *ind, /* Q0 */ - Word32 *out_fx, /* Q27 */ -#ifndef FIX_874_INCREASE_IPD_PRECISION - const Word16 N, -#endif + Word16 *ind, /* Q0 */ + Word32 *out_fx, /* Q27 */ const Word16 bits /* Q0 */ ) { Word16 delta_fx; -#ifndef FIX_874_INCREASE_IPD_PRECISION - Word16 i; - Word32 temp_out; -#endif IF( EQ_16( bits, 2 ) ) /* 2-bit phase quantization for the highest frequency band only */ { delta_fx = ( EVS_PI_FX ) >> 1; /* Q13 */ @@ -2509,17 +2466,8 @@ static void stereo_dft_dequantize_ipd_fx( assert( 0 ); } -#ifndef FIX_874_INCREASE_IPD_PRECISION - FOR( i = 0; i < N; i++ ) - { - temp_out = L_sub( L_mult0( ind[i], delta_fx ), ( EVS_PI_FX ) ); /* Q13 */ - *out_fx = L_shl( temp_out, 14 ); /* Q27 */ - move32(); - } -#else *out_fx = L_sub( W_sat_l( W_mult_32_16( L_shl( ind[0], 13 ), delta_fx ) ), EVS_PI_FX_Q27 ); move32(); -#endif return; } @@ -3748,11 +3696,7 @@ void stereo_dft_dec_read_BS_fx( { hStereoDft->side_gain_index_previous[b] = ind1[b]; /* Q0 */ move16(); -#ifdef FIX_860_FER_CRASH hStereoDft->res_gains_ind_fx[0][b + STEREO_DFT_BAND_MAX] = L_shl_sat( ind1[b], 26 ); /* Q26 */ -#else - hStereoDft->res_gains_ind_fx[0][b + STEREO_DFT_BAND_MAX] = L_shl( ind1[b], 26 ); -#endif move32(); } @@ -3822,11 +3766,7 @@ void stereo_dft_dec_read_BS_fx( move16(); nb = add( nb, STEREO_DFT_GIPD_NBITS ); /* Q0 */ n_bits = add( n_bits, STEREO_DFT_GIPD_NBITS ); /* Q0 */ -#ifndef FIX_874_INCREASE_IPD_PRECISION - stereo_dft_dequantize_ipd_fx( &ind1_ipd[0], hStereoDft->gipd_fx + add( k, k_offset ), 1, STEREO_DFT_GIPD_NBITS ); -#else stereo_dft_dequantize_ipd_fx( &ind1_ipd[0], hStereoDft->gipd_fx + add( k, k_offset ), STEREO_DFT_GIPD_NBITS ); -#endif } } ELSE IF( LE_16( *nb_bits, ( ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - STEREO_DFT_FLAG_BITS - STEREO_DFT_SID_GIPD_NBITS - SID_FORMAT_NBITS ) ) ) @@ -3842,11 +3782,7 @@ void stereo_dft_dec_read_BS_fx( move16(); nb = add( nb, STEREO_DFT_SID_GIPD_NBITS ); /* Q0 */ n_bits = add( n_bits, STEREO_DFT_SID_GIPD_NBITS ); /* Q0 */ -#ifndef FIX_874_INCREASE_IPD_PRECISION - stereo_dft_dequantize_ipd_fx( &ind1_ipd[0], hStereoDft->gipd_fx + add( k, k_offset ), 1, STEREO_DFT_SID_GIPD_NBITS ); -#else stereo_dft_dequantize_ipd_fx( &ind1_ipd[0], hStereoDft->gipd_fx + add( k, k_offset ), STEREO_DFT_SID_GIPD_NBITS ); -#endif } } ELSE @@ -3950,11 +3886,7 @@ void stereo_dft_dec_read_BS_fx( stereo_dft_dequantize_res_gains_fx( ind1 + b, &I, hStereoDft->side_gain_fx + add( i_mult( add( k, k_offset ), STEREO_DFT_BAND_MAX ), b ), hStereoDft->res_pred_gain_fx + add( i_mult( add( k, k_offset ), STEREO_DFT_BAND_MAX ), b ), 1 ); hStereoDft->res_pred_index_previous[b] = I; /* Q0 */ move16(); -#ifdef FIX_860_FER_CRASH hStereoDft->res_gains_ind_fx[1][b + STEREO_DFT_BAND_MAX] = L_shl_sat( I, 26 ); /* Q26 */ -#else - hStereoDft->res_gains_ind_fx[1][b + STEREO_DFT_BAND_MAX] = L_shl( I, 26 ); -#endif move32(); } @@ -3979,11 +3911,7 @@ void stereo_dft_dec_read_BS_fx( stereo_dft_dequantize_res_gains_fx( ind1 + b, &I, hStereoDft->side_gain_fx + add( i_mult( add( k, k_offset ), STEREO_DFT_BAND_MAX ), b ), hStereoDft->res_pred_gain_fx + add( i_mult( add( k, k_offset ), STEREO_DFT_BAND_MAX ), b ), 1 ); hStereoDft->res_pred_index_previous[b] = I; /* Q0 */ move16(); -#ifdef FIX_860_FER_CRASH hStereoDft->res_gains_ind_fx[1][b + STEREO_DFT_BAND_MAX] = L_shl_sat( I, 26 ); /* Q26 */ -#else - hStereoDft->res_gains_ind_fx[1][b + STEREO_DFT_BAND_MAX] = L_shl( I, 26 ); -#endif move32(); } } diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index 875f50ac555399d92b0b88eab5a6e08142db76cc..71d88b4885f81a95f4c9c07d9df89a6bfb6a23b9 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -83,9 +83,7 @@ void stereo_dft_res_ecu_fx( Word16 trigo_dec[STEREO_DFT32MS_N_8k / 2 + 1]; Word16 trigo_step; Word16 q_fac; -#ifdef NONBE_FIX_943_PORT_1208_DFT_STEREO_PLC_BURST Word16 time_offs; -#endif set32_fx( pDFT_RES, 0, L_FRAME8k ); @@ -125,12 +123,8 @@ void stereo_dft_res_ecu_fx( IF( k == 0 ) { Copy32( pDFT_RES, res_buf, L_FRAME8k ); /* hStereoDft->q_dft */ -#ifdef NONBE_FIX_943_PORT_1208_DFT_STEREO_PLC_BURST time_offs = add_sat( hStereoDft->time_offs, output_frame ); stereo_dft_res_subst_spec_fx( hStereoDft, res_buf, DFT_PRED_RES, time_offs, L_res, L_FRAME8k, k, num_plocs, plocs, plocsi, FALSE ); -#else - stereo_dft_res_subst_spec_fx( hStereoDft, res_buf, DFT_PRED_RES, hStereoDft->time_offs + output_frame, L_res, L_FRAME8k, k, num_plocs, plocs, plocsi, FALSE ); -#endif rfft_fx( res_buf, trigo_dec, L_FRAME8k, +1 ); @@ -170,11 +164,7 @@ void stereo_dft_res_ecu_fx( } /*in case of burst error*/ -#ifdef NONBE_FIX_943_PORT_1208_DFT_STEREO_PLC_BURST hStereoDft->time_offs = add_sat( hStereoDft->time_offs, L_FRAME8k ); /* Q0 */ -#else - hStereoDft->time_offs = add( hStereoDft->time_offs, L_FRAME8k ); /* Q0 */ -#endif move16(); } diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index b79d52d7eb08a1762bc0cd9144f068ad607f81a6..5c189de72f5d1f094cb3d231aa26cb423baa3053 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -560,10 +560,8 @@ void stereo_icBWE_dec_fx( const Word16 *voice_factors_fx, /* i : voicing factors Q15 */ const Word16 output_frame, /* i : frame length Q0 */ Word16 *Q_syn /* i : Q of synth and synthRef buffers */ -#ifdef FIX_839_FB_CONTENT_SOMETIME_MISSING , const Word16 Q_white_exc /* i : Q of fb_synth_ref_fx */ -#endif ) { Word16 i, j, k, nbSubFr; @@ -582,11 +580,7 @@ void stereo_icBWE_dec_fx( Word16 temp1_fx, temp2_fx; Word16 icbweM2Ref_fx, ratio_L_fx; Word16 gsMapping_fx; -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - Word32 hb_nrg_fx, hb_nrg2_fx; -#else Word32 hb_nrg_fx; -#endif Word16 Q_syn_shb; Word16 shift_prev_pow, synthRef_shift; Word32 L_tmp; @@ -634,9 +628,6 @@ void stereo_icBWE_dec_fx( { hb_nrg_fx = 0; move32(); -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - hb_nrg2_fx = 0; -#endif move32(); maximum_abs_32_fx( synthRef_fx, output_frame, &maxVal ); synthRef_shift = norm_l( maxVal ); @@ -645,31 +636,19 @@ void stereo_icBWE_dec_fx( synthRef_shift = 31; move16(); } -#ifndef FIX_826_PRECISION_LOST_AND_COMPL /* Not needed Q11 is already enough */ - synthRef_shift = sub( synthRef_shift, shr( add( find_guarded_bits_fx( output_frame ), 1 ), 1 ) ); -#else synthRef_shift = sub( synthRef_shift, shr( add( find_guarded_bits_fx( shr( output_frame, 1 ) ), 1 ), 1 ) ); -#endif test(); IF( EQ_16( st->core, ACELP_CORE ) || EQ_16( st->last_core, ACELP_CORE ) ) { -#ifdef FIX_826_PRECISION_LOST_AND_COMPL Word64 W_tmp = 0; move64(); tmp = shl_sat( 1, synthRef_shift ); -#endif FOR( i = 0; i < output_frame / 2; i++ ) { // needed to be adjusted for q -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - L_tmp = L_shl( synthRef_fx[i], synthRef_shift ); - hb_nrg2_fx = L_add( hb_nrg2_fx, Mpy_32_32( L_tmp, L_tmp ) ); // 2*(Qx + SynthRef_shift) - 31 -#else L_tmp = Mpy_32_16_1( synthRef_fx[i], tmp ); /* Qsyn + SynthRef_shift - 15 */ W_tmp = W_mac_32_32( W_tmp, L_tmp, L_tmp ); /* 2 * (Qsyn + SynthRef_shift) - 29 */ -#endif } -#ifdef FIX_826_PRECISION_LOST_AND_COMPL hb_nrg_fx = W_round48_L( W_tmp ); /* 2 * (Qsyn + SynthRef_shift) - 45 */ hCPE->hStereoDft->hb_nrg_subr_fx[0] = hb_nrg_fx; /* 2 * (Qsyn + SynthRef_shift) - 45 */ move32(); @@ -685,30 +664,9 @@ void stereo_icBWE_dec_fx( hCPE->hStereoDft->hb_nrg_subr_fx[1] = W_round48_L( W_tmp ); // 2 * (Qsyn + SynthRef_shift) - 45 hb_nrg_fx = L_add( hCPE->hStereoDft->hb_nrg_subr_fx[0], hCPE->hStereoDft->hb_nrg_subr_fx[1] ); // 2 * (Qsyn + SynthRef_shift) - 45 -#else - hCPE->hStereoDft->hb_nrg_subr_fx[0] = hb_nrg2_fx; - move32(); - hStereoDft->q_hb_nrg_subr = sub( add( *Q_syn, synthRef_shift ), 31 ); - hb_nrg_fx = L_add( hb_nrg_fx, hb_nrg2_fx ); - hb_nrg2_fx = 0; - move32(); - - FOR( ; i < output_frame; i++ ) - { - L_tmp = L_shl( synthRef_fx[i], synthRef_shift ); - hb_nrg2_fx = L_add( hb_nrg2_fx, Mpy_32_32( L_tmp, L_tmp ) ); - } - - hCPE->hStereoDft->hb_nrg_subr_fx[1] = hb_nrg2_fx; // 2*(Qx + SynthRef_shift) - 31 - move32(); - hb_nrg_fx = L_add( hb_nrg_fx, hb_nrg2_fx ); -#endif Copy32( synthRef_fx, hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, output_frame ); /* Qsynth */ -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - Scale_sig32( hCPE->hStereoDft->hb_stefi_sig_fx + hCPE->hStereoDft->hb_stefi_delay, output_frame, -5 ); -#endif } ELSE { @@ -724,11 +682,7 @@ void stereo_icBWE_dec_fx( move32(); hCPE->hStereoDft->hb_nrg_subr_fx[1] = ( Mpy_32_16_1( hCPE->hStereoDft->hb_nrg_subr_fx[1], shl( shr( hCPE->hStereoDft->NFFT, 1 ), 6 ) ) ); // 2 * (Qsynth + SynthRef_shift) - 40 move32(); -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - hCPE->hStereoDft->q_hb_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 40 ); -#else hCPE->hStereoDft->q_hb_nrg_subr = sub( shl( ( *Q_syn + synthRef_shift ), 1 ), 45 + 9 ); -#endif hCPE->hStereoDft->hb_nrg_fx[0] = hb_nrg_fx; // 2 * (Qx + SynthRef_shift) - 31 move32(); hCPE->hStereoDft->td_gain_fx[0] = 0; @@ -807,22 +761,6 @@ void stereo_icBWE_dec_fx( move16(); FOR( i = 0; i < winLen_fx; i++ ) { -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - L_tmp = L_mult0( alpha_fx, icbweM2Ref_fx ); // Q15 + Q14 - L_tmp = L_mac0( L_tmp, sub( 32767, alpha_fx ), ( hStereoICBWE->icbweM2Ref_prev_fx ) ); // Q15 + Q14; - tmp = shl( round_fx( L_tmp ), 1 ); // Q = 15 + 14 - 16 + 1 = Q14 - synthRef_fx[i] = Mpy_32_16_1( synthRef_fx[i], tmp ); - move32(); - L_tmp = L_mult0( alpha_fx, gsMapping_fx ); - L_tmp = L_mac0( L_tmp, ( sub( 32767, alpha_fx ) ), ( prevgsMapping_fx ) ); - tmp = shl( round_fx( L_tmp ), 1 ); // Q = 15 + 14 - 16 + 1 = Q14 - synth_fx[i] = Mpy_32_16_1( synth_fx[i], tmp ); - move32(); - IF( LE_16( alpha_fx, sub( 32767, winSlope_fx ) ) ) - { - alpha_fx = add( alpha_fx, winSlope_fx ); - } -#else /*synthRef[i] *= ( alpha * ( icbweM2Ref ) + ( 1.0f - alpha ) * ( hStereoICBWE->icbweM2Ref_prev ) );*/ temp1_fx = sub( 32767, alpha_fx ); /* 1.f in Q15 */ L_tmp = L_mult( alpha_fx, icbweM2Ref_fx ); // Q15 + Q14 + 1 @@ -834,8 +772,7 @@ void stereo_icBWE_dec_fx( L_tmp = L_mac( L_tmp, temp1_fx, prevgsMapping_fx ); // Q15 + Q14 +1 synth_fx[i] = L_shl( Mpy_32_32( synth_fx[i], L_tmp ), 1 ); // Qsynth move32(); - alpha_fx = add_sat( alpha_fx, winSlope_fx ); /* Q15 */ -#endif + alpha_fx = add_sat( alpha_fx, winSlope_fx ); /* Q15 */ } FOR( ; i < NS2SA( st->output_Fs, FRAME_SIZE_NS ); i++ ) { @@ -988,11 +925,7 @@ void stereo_icBWE_dec_fx( L_nlExc16k = L_deposit_l( hStereoICBWE->nlExc16k_fx[k] ); // prev_q_bwe_exc - 16 L_mixExc16k = L_deposit_l( hStereoICBWE->mixExc16k_fx[k] ); // Q_exc L_nlExc16k = L_shl( L_nlExc16k, sub( Q_icBWE, ( sub( st->prev_Q_bwe_exc, 16 ) ) ) ); // Q_icBWE -#ifndef FIX_736_BWE_SECT_C - L_mixExc16k = L_shl( L_mixExc16k, Q_icBWE - st->Q_exc ); // Q_icBWE -#else - L_mixExc16k = L_shl( L_mixExc16k, sub( Q_icBWE, ( sub( st->prev_Q_bwe_exc, 25 ) ) ) ); // Q_icBWE -#endif + L_mixExc16k = L_shl( L_mixExc16k, sub( Q_icBWE, ( sub( st->prev_Q_bwe_exc, 25 ) ) ) ); // Q_icBWE excSHB_nonref_fx[k] = L_add( Mpy_32_16_1( L_nlExc16k, temp1_fx ), Mpy_32_16_1( L_mixExc16k, temp2_fx ) ); // Q_icBWE move32(); k++; @@ -1210,11 +1143,7 @@ void stereo_icBWE_dec_fx( tmp = shl( tmp, 2 ); /* Q13 + Q2 */ icbweM2Ref_fx = Sqrt16( sub( 16384 /* 0.5 in Q15 */, tmp ), &temp1_fx ); icbweM2Ref_fx = BASOP_Util_Divide1616_Scale( icbweM2Ref_fx, ratio_L_fx, &temp2_fx ); -#ifdef FIX_860_FER_CRASH icbweM2Ref_fx = shl_sat( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 -#else - icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 -#endif } ELSE { @@ -1230,7 +1159,7 @@ void stereo_icBWE_dec_fx( #ifdef FIX_TMP_714 tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 #else - tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 + tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 #endif tmp = mult_r( tmp, gsMapping_fx ); // Q14 tmp = mult_r( tmp, gsMapping_fx ); // Q13 @@ -1243,11 +1172,7 @@ void stereo_icBWE_dec_fx( tmp = shl( tmp, 2 ); icbweM2Ref_fx = Sqrt16( sub( 16384 /* 0.5 in Q15 */, tmp ), &temp1_fx ); icbweM2Ref_fx = BASOP_Util_Divide1616_Scale( icbweM2Ref_fx, sub( 32767, ratio_L_fx ), &temp2_fx ); -#ifdef FIX_860_FER_CRASH icbweM2Ref_fx = shl_sat( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 -#else - icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 -#endif } ELSE { @@ -1334,7 +1259,7 @@ void stereo_icBWE_dec_fx( #ifndef MSAN_FIX Scale_sig32( synth_fx, L_FRAME48k, sub( *Q_syn, add( 1, tmp ) ) ); #else - Scale_sig32( synth_fx, output_frame, sub( *Q_syn, add( 1, tmp ) ) ); /* Qsyn - 1 */ + Scale_sig32( synth_fx, output_frame, sub( *Q_syn, add( 1, tmp ) ) ); /* Qsyn - 1 */ #endif *Q_syn = sub( *Q_syn, 1 ); @@ -1344,7 +1269,6 @@ void stereo_icBWE_dec_fx( { // v_add( fb_synth_nonref_fx, synth_fx, synth_fx, L_FRAME48k, 0 ); -#ifdef FIX_839_FB_CONTENT_SOMETIME_MISSING tmp = shl_sat( 1, sub( Q11 + 15, Q_white_exc ) ); /* 29 - Q_white_exc */ IF( tmp != 0 ) { @@ -1353,13 +1277,6 @@ void stereo_icBWE_dec_fx( synth_fx[i] = L_mac( synth_fx[i], fb_synth_nonref_fx[i], tmp ); /* Q_syn */ } } -#else - FOR( i = 0; i < L_FRAME48k; i++ ) - { - synth_fx[i] = L_add( synth_fx[i], L_deposit_l( fb_synth_nonref_fx[i] ) ); - move32(); - } -#endif } /* copy to outputHB and reset hb_synth values */ @@ -1409,7 +1326,7 @@ void stereo_icBWE_dec_fx( #ifdef FIX_TMP_714 tmp = mult_r( ratio_L_fx, ratio_L_fx ); // Q15 #else - tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 + tmp = mult_r( sub( 32767, ratio_L_fx ), sub( 32767, ratio_L_fx ) ); // Q15 #endif tmp = mult_r( tmp, gsMapping_fx ); // Q14 tmp = mult_r( tmp, gsMapping_fx ); // Q13 @@ -1759,21 +1676,13 @@ void stereo_icBWE_decproc_fx( const Word16 last_core, /* i : last core, primary channel Q0*/ const Word16 last_bwidth, /* i : last bandwidth Q0*/ const Word16 output_frame /* i : frame length Q0*/ -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - , - Word16 q_output /* i : Q-fac of output */ -#endif ) { Word16 i, j, n, decoderDelay, icbweOLASize, dftOvlLen; Word16 core, memOffset, refChanIndx_bwe; Word32 temp0_fx[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )], temp1_fx[L_FRAME48k + NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; -#if defined FIX_826_PRECISION_LOST_AND_COMPL Word16 winSlope_fx = 0, alpha_fx; -#else - Word32 winSlope_fx = 0, alpha_fx; -#endif move32(); const Word16 *win_dft_fx; Word32 extl_brate, output_Fs; @@ -1844,11 +1753,7 @@ void stereo_icBWE_decproc_fx( /* stereo to mono downmix */ FOR( i = 0; i < output_frame; i++ ) { -#ifdef FIX_826_PRECISION_LOST_AND_COMPL outputHB[0][i] = W_extract_l( W_shr( W_mac_32_16( W_mult_32_16( outputHB[0][i], 16384 ), outputHB[1][i], 16384 ), Q16 ) ); /* Q11 */ -#else - outputHB[0][i] = L_shr( ( outputHB[0][i] + outputHB[1][i] ), 1 ); -#endif move32(); } v_add_32( output[0], outputHB[0], output[0], output_frame ); @@ -1903,7 +1808,6 @@ void stereo_icBWE_decproc_fx( { SWITCH( memOffset ) { -#if defined FIX_826_PRECISION_LOST_AND_COMPL case 15: winSlope_fx = 2185; /* 0.06 in Q15 */ move32(); @@ -1916,20 +1820,6 @@ void stereo_icBWE_decproc_fx( winSlope_fx = 728; /* 0.02 in Q15 */ move32(); BREAK; -#else - case 15: - winSlope_fx = 71582792; - move32(); - BREAK; - case 30: - winSlope_fx = 35791396; - move32(); - BREAK; - case 45: - winSlope_fx = 23860930; - move32(); - BREAK; -#endif } // memOffset for 16K 32K 48K are 15 30 45 respectively.camera } @@ -1938,20 +1828,12 @@ void stereo_icBWE_decproc_fx( winSlope_fx = 0; move32(); } -#if defined FIX_826_PRECISION_LOST_AND_COMPL alpha_fx = 0; move16(); -#endif FOR( i = 0; i < memOffset; i++ ) { -#if defined FIX_826_PRECISION_LOST_AND_COMPL alpha_fx = add_sat( alpha_fx, winSlope_fx ); /* Q15 */ outputHB[refChanIndx_bwe][i] = W_round48_L( W_mult_32_16( outputHB[refChanIndx_bwe][i] /* Q11 + Q15 + 1 - 16 = Q11)*/, winSlope_fx ) ); // Q11 -#else - Word32 mul_win = Mpy_32_16_1( winSlope_fx, ( i + 1 ) ); // Q30 + Q0 - 15 = Q15 - mul_win = L_shl( mul_win, 15 ); // Q30 - outputHB[refChanIndx_bwe][i] = L_shl( Mpy_32_32( outputHB[refChanIndx_bwe][i] /* Q11 + Q30 - 31 = Q10)*/, mul_win ), 1 ); // -#endif move32(); } } @@ -1978,7 +1860,6 @@ void stereo_icBWE_decproc_fx( assert( icbweOLASize > 0 ); SWITCH( icbweOLASize ) { -#if defined FIX_826_PRECISION_LOST_AND_COMPL case 60: winSlope_fx = 546; /* 0.0166 in Q15 */ move16(); @@ -1995,38 +1876,16 @@ void stereo_icBWE_decproc_fx( fprintf( stderr, "icbweOLASize of size %d not implemented \n", icbweOLASize ); assert( 0 ); BREAK; -#else - case 60: - winSlope_fx = 17895698; - move32(); - BREAK; - case 40: - winSlope_fx = 26843546; - move32(); - BREAK; - case 20: - winSlope_fx = 53687092; - move32(); - BREAK; -#endif } alpha_fx = winSlope_fx; // Q15 move32(); FOR( ; i < add( decoderDelay, icbweOLASize ); i++ ) { -#if defined FIX_826_PRECISION_LOST_AND_COMPL temp0_fx[i] = W_round48_L( W_mult_32_16( temp0_fx[i], alpha_fx ) ); // Q11 move32(); temp1_fx[i] = W_round48_L( W_mult_32_16( temp1_fx[i], alpha_fx ) ); // Q11 move32(); alpha_fx = add_sat( alpha_fx, winSlope_fx ); // Q15 -#else - temp0_fx[i] = L_shl_sat( Mpy_32_32( temp0_fx[i], alpha_fx ), 1 ); // Q11 - move32(); - temp1_fx[i] = L_shl_sat( Mpy_32_32( temp1_fx[i], alpha_fx ), 1 ); - move32(); - alpha_fx = L_add( alpha_fx, winSlope_fx ); -#endif } } ELSE @@ -2037,7 +1896,6 @@ void stereo_icBWE_decproc_fx( { SWITCH( memOffset ) { -#if defined FIX_826_PRECISION_LOST_AND_COMPL case 15: winSlope_fx = 2185; /* 0.06 in Q15 */ move16(); @@ -2050,20 +1908,6 @@ void stereo_icBWE_decproc_fx( winSlope_fx = 728; /* 0.022 in Q15 */ move16(); BREAK; -#else - case 15: - winSlope_fx = 71582792; - move32(); - BREAK; - case 30: - winSlope_fx = 35791396; - move32(); - BREAK; - case 45: - winSlope_fx = 23860930; // Q30 - move32(); - BREAK; -#endif } // memOffset for 16K 32K 48K are 15 30 45 respectively.camera } @@ -2072,27 +1916,16 @@ void stereo_icBWE_decproc_fx( winSlope_fx = 0; move32(); } -#if defined FIX_826_PRECISION_LOST_AND_COMPL Word16 Incr = 0; Word16 Decr = MAX_16; -#endif move16(); move16(); FOR( i = 0; i < memOffset; i++ ) { -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - temp0_fx[i] = L_add( L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( i + 1 ) ), hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i] ), 16 ), - L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, 1 - ( i + 1 ) ), hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i] ), 16 ) ); - move32(); - - temp1_fx[i] = L_add( L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( i + 1 ) ), hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i] ), 16 ), - L_shl( Mpy_32_32( Mpy_32_16_1( winSlope_fx, ( 1 - ( i + 1 ) ) ), hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i] ), 16 ) ); -#else Incr = add_sat( Incr, winSlope_fx ); /* Q15 */ Decr = sub( Decr, winSlope_fx ); /* Q15 */ temp0_fx[i] = W_round48_L( W_mac_32_16( W_mult_32_16( hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i], Incr ), hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i], Decr ) ); /* Q11 */ temp1_fx[i] = W_round48_L( W_mac_32_16( W_mult_32_16( hStereoICBWE->memOutHB_fx[hStereoICBWE->prev_refChanIndx_bwe][i], Incr ), hStereoICBWE->memOutHB_fx[refChanIndx_bwe][i], Decr ) ); /* Q11 */ -#endif move32(); } } @@ -2105,25 +1938,14 @@ void stereo_icBWE_decproc_fx( IF( EQ_16( hCPE->nchan_out, 1 ) ) { -#ifdef FIX_826_PRECISION_LOST_AND_COMPL Word64 W_tmp; -#endif /* stereo to mono downmix */ FOR( i = 0; i < output_frame; i++ ) { -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - temp0_fx[i] = L_add( temp0_fx[i], temp1_fx[i] ); + W_tmp = W_mult_32_16( output[0][i], 32767 /* 1.0 in Q15*/ ); /* Q11 */ + W_tmp = W_mac_32_16( W_tmp, temp0_fx[i], 16384 /* 0.5 in Q15*/ ); /* Q11*/ + output[0][i] = W_round48_L( W_mac_32_16( W_tmp, temp1_fx[i], 16384 /* 0.5 in Q15*/ ) ); /* Q11 */ move32(); - temp0_fx[i] = L_shr( temp0_fx[i], 1 ); - move32(); - output[0][i] = L_add( output[0][i], temp0_fx[i] ); -#else - W_tmp = W_mult_32_16( output[0][i], 32767 /* 1.0 in Q15*/ ); /* Q11 */ - W_tmp = W_mac_32_16( W_tmp, temp0_fx[i], 16384 /* 0.5 in Q15*/ ); /* Q11*/ - output[0][i] = W_round48_L( W_mac_32_16( W_tmp, temp1_fx[i], 16384 /* 0.5 in Q15*/ ) ); /* Q11 */ - move32(); - -#endif move32(); } } @@ -2145,52 +1967,25 @@ void stereo_icBWE_decproc_fx( /* Preparing buffers in anticipation of an ACELP to TCX switch */ -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - j = 0; - move16(); -#else j = sub( dftOvlLen, 1 ); -#endif FOR( i = 0; i < memOffset; i++ ) { -#ifndef FIX_826_PRECISION_LOST_AND_COMPL - Word16 tmp_mul = mult0( STEREO_DFT32MS_STEP, ( sub( dftOvlLen, add( 1, j ) ) ) ); - hStereoICBWE->memTransitionHB_fx[0][i] = Mpy_32_16_1( hStereoICBWE->memOutHB_fx[0][i], win_dft_fx[tmp_mul] ); - move32(); - hStereoICBWE->memTransitionHB_fx[1][i] = Mpy_32_16_1( hStereoICBWE->memOutHB_fx[1][i], win_dft_fx[tmp_mul] ); - move32(); - j = add( j, 1 ); -#else Word16 tmp_mul = i_mult( STEREO_DFT32MS_STEP, j ); hStereoICBWE->memTransitionHB_fx[0][i] = Mpy_32_16_1( hStereoICBWE->memOutHB_fx[0][i], win_dft_fx[tmp_mul] ); /* Q11 */ move32(); hStereoICBWE->memTransitionHB_fx[1][i] = Mpy_32_16_1( hStereoICBWE->memOutHB_fx[1][i], win_dft_fx[tmp_mul] ); /* Q11 */ move32(); j = sub( j, 1 ); -#endif } -#if !defined FIX_826_PRECISION_LOST_AND_COMPL || defined FIX_833_CORRECTION_to_826 FOR( i = 0; j < dftOvlLen; i++ ) -#else - FOR( i = 0; i < dftOvlLen; i++ ) -#endif { -#if !defined FIX_826_PRECISION_LOST_AND_COMPL || defined FIX_833_CORRECTION_to_826 Word16 tmp_mul = mult0( STEREO_DFT32MS_STEP, ( sub( dftOvlLen, add( 1, j ) ) ) ); hStereoICBWE->memTransitionHB_fx[0][memOffset + i] = Mpy_32_16_1( outputHB[0][output_frame - i - 1], win_dft_fx[tmp_mul] ); /* Q11 */ move32(); hStereoICBWE->memTransitionHB_fx[1][memOffset + i] = Mpy_32_16_1( outputHB[1][output_frame - i - 1], win_dft_fx[tmp_mul] ); /* Q11 */ move32(); j = add( j, 1 ); -#else - Word16 tmp_mul = i_mult( STEREO_DFT32MS_STEP, j ); - hStereoICBWE->memTransitionHB_fx[0][memOffset + i] = Mpy_32_16_1( outputHB[0][output_frame - i - 1], win_dft_fx[tmp_mul] ); - move32(); - hStereoICBWE->memTransitionHB_fx[1][memOffset + i] = Mpy_32_16_1( outputHB[1][output_frame - i - 1], win_dft_fx[tmp_mul] ); - move32(); - j = sub( j, 1 ); -#endif } } @@ -2245,12 +2040,8 @@ void stereo_icBWE_decproc_fx( test(); IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) && GT_32( L_max( hCPE->hStereoDft->td_gain_fx[0], hCPE->hStereoDft->td_gain_fx[1] ), 0 ) ) { -#ifdef FIX_826_PRECISION_LOST_AND_COMPL Word32 win_in_fx, win_out_fx, tmp_fx; Word64 W_tmp, W_tmp1; -#else - Word32 win_in_fx, win_out_fx, tmp_fx, gain0_fx, gain1_fx; -#endif win_dft_fx = hCPE->hStereoDft->win32ms_fx; /* Q15 */ dftOvlLen = hCPE->hStereoDft->dft32ms_ovl; /* Q0 */ move16(); @@ -2259,7 +2050,6 @@ void stereo_icBWE_decproc_fx( FOR( i = 0; i < dftOvlLen; i++ ) { -#ifdef FIX_826_PRECISION_LOST_AND_COMPL j = i_mult( STEREO_DFT32MS_STEP, i ); win_in_fx = L_mult( win_dft_fx[j], win_dft_fx[j] ); /* Q31 */ win_out_fx = L_sub( ONE_IN_Q31, win_in_fx ); /* Q31 */ @@ -2283,39 +2073,10 @@ void stereo_icBWE_decproc_fx( move32(); output[1][i] = L_sub_sat( output[1][i], tmp_fx ); /* Q11 */ move32(); -#else - win_in_fx = L_mult( win_dft_fx[mult0( STEREO_DFT32MS_STEP, i )], win_dft_fx[mult0( STEREO_DFT32MS_STEP, i )] ); /* Q31 */ - win_out_fx = L_sub( ONE_IN_Q31, win_in_fx ); /* Q31 */ - - gain0_fx = Mpy_32_32( win_in_fx, hCPE->hStereoDft->td_gain_fx[0] ); /* Q --> q_td_gain[0] */ -#ifdef FIX_736_BWE_SECT_C - gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ - gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ - gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ -#else - gain0_fx = (Word32) W_shr( ( (Word64) gain0_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ - gain1_fx = Mpy_32_32( win_out_fx, hCPE->hStereoDft->td_gain_fx[1] ); /* Q --> q_td_gain[1] */ - gain1_fx = (Word32) W_shr( ( (Word64) gain1_fx * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[1], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ -#endif - tmp_fx = L_add_sat( gain0_fx, gain1_fx ); /* Q --> q_output */ - - output[0][i] = L_add_sat( output[0][i], tmp_fx ); - move32(); - output[1][i] = L_sub_sat( output[1][i], tmp_fx ); - move32(); -#endif } FOR( i = dftOvlLen; i < output_frame; i++ ) { -#ifdef FIX_826_PRECISION_LOST_AND_COMPL tmp_fx = W_extract_h( W_mult_32_32( hCPE->hStereoDft->td_gain_fx[0], hCPE->hStereoDft->hb_stefi_sig_fx[i] ) ); /* Q11 --> Q11 */ -#else -#ifdef FIX_736_BWE_SECT_C - tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), 2 * q_output + 14 ) ); /* Q --> q_output */ -#else - tmp_fx = (Word32) W_shr( ( (Word64) hCPE->hStereoDft->td_gain_fx[0] * hCPE->hStereoDft->hb_stefi_sig_fx[i] ), sub( add( (Word16) hCPE->hStereoDft->q_td_gain[0], hCPE->hStereoDft->q_hb_stefi_sig_fx ), q_output ) ); /* Q --> q_output */ -#endif -#endif output[0][i] = L_add_sat( output[0][i], tmp_fx ); /* Q11 */ move32(); output[1][i] = L_sub_sat( output[1][i], tmp_fx ); /* Q11 */ diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 60e9c62dbf8016829cad15be202f1a3d20defb7d..2e46e04f5652f938161c812d657a667b029b9ef7 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -1045,7 +1045,6 @@ static void run_min_stats_fx( { Word16 tmp16 = getScaleFactor32( spec_in, L_FRAME16k ); -#ifdef NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING Word32 power_spec_scale_fac; /* calculate power spectrum from MDCT coefficients and estimated MDST coeffs */ @@ -1055,37 +1054,18 @@ static void run_min_stats_fx( move32(); power_spec[L_FRAME16k - 1] = Mpy_32_32( W_extract_h( W_shl( W_mult_32_32( spec_in[L_FRAME16k - 1], spec_in[L_FRAME16k - 1] ), sub( tmp16, 4 ) ) ), power_spec_scale_fac ); /* 2 * (Q31 - x_e) + tmp16 - Q4 - Q31 */ move32(); -#else - /* calculate power spectrum from MDCT coefficients and estimated MDST coeffs */ - power_spec[0] = W_extract_h( W_shl( W_mult_32_32( spec_in[0], spec_in[0] ), sub( tmp16, 4 ) ) ); /* 2 * (Q31 - x_e) + tmp16 - Q4 - Q31 */ - power_spec[L_FRAME16k - 1] = W_extract_h( W_shl( W_mult_32_32( spec_in[L_FRAME16k - 1], spec_in[L_FRAME16k - 1] ), sub( tmp16, 4 ) ) ); /* 2 * (Q31 - x_e) + tmp16 - Q4 - Q31 */ -#endif FOR( Word16 i = 1; i < L_FRAME16k - 1; i++ ) { Word32 mdst; mdst = L_sub( spec_in[i + 1], spec_in[i - 1] ); /* Q31 - x_e */ -#ifdef NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING power_spec[i] = Mpy_32_32( L_add( W_extract_h( W_shl( W_mult_32_32( spec_in[i], spec_in[i] ), sub( tmp16, 4 ) ) ), W_extract_h( W_shl( W_mult_32_32( mdst, mdst ), sub( tmp16, 4 ) ) ) ), power_spec_scale_fac ); /* 2 * (Q31 - x_e) + tmp16 - Q4 - Q31*/ -#else - power_spec[i] = L_add( W_extract_h( W_shl( W_mult_32_32( spec_in[i], spec_in[i] ), sub( tmp16, 4 ) ) ), W_extract_h( W_shl( W_mult_32_32( mdst, mdst ), sub( tmp16, 4 ) ) ) ); /* 2 * (Q31 - x_e) + tmp16 - Q4 - Q31*/ -#endif move32(); } power_spec_e = sub( add( 4, shl( spec_e, 1 ) ), tmp16 ); } - -#ifndef NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING - noisy_speech_detection_fx( st->hFdCngDec, st->VAD && st->m_frame_type == ACTIVE_FRAME, power_spec_16, sub( 15, power_spec_e ) ); - - st->hFdCngDec->hFdCngCom->likelihood_noisy_speech = add( mult_r( 32440 /* 0.99 in Q15 */, st->hFdCngDec->hFdCngCom->likelihood_noisy_speech ), mult_r( st->hFdCngDec->hFdCngCom->flag_noisy_speech, 328 /* 0.01 in Q15 */ ) ); /* Q15 */ - move16(); - st->lp_noise = st->hFdCngDec->lp_noise; /* Q9.23 */ - move32(); -#endif } -#ifdef NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING IF( EQ_16( st->core, TCX_20_CORE ) ) { Word16 x_fx_16[L_FRAME16k]; @@ -1098,7 +1078,6 @@ static void run_min_stats_fx( st->lp_noise = st->hFdCngDec->lp_noise; /* Q9.23 */ move32(); } -#endif test(); test(); diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 5f15ccba8f09d4c4953a308b52dd30badbe16034..2f94715af31b8d6eb66a7cbabd208823060f2caf 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -1699,10 +1699,8 @@ ivas_error stereo_memory_dec_fx( Copy32( tmpF_buff, st->hTcxDec->old_syn_Overl_32, L_FRAME16k / 2 ); /* Q11 */ Copy_Scale_sig32_16( st->hTcxDec->old_syn_Overl_32, st->hTcxDec->old_syn_Overl, L_FRAME16k / 2, add( st->Q_syn, 5 ) ); //(st->Qsyn - (11 - 16)) } -#ifdef FIX_844_Q_SYN_INIT st->hTcxDec->q_old_synth = st->Q_syn; move16(); -#endif set16_fx( st->hTcxDec->FBTCXdelayBuf, 0, 111 ); set32_fx( st->hTcxDec->FBTCXdelayBuf_32, 0, 111 ); st->hTcxDec->old_synthFB_fx = st->hTcxDec->synth_history_fx + NS2SA_FX2( st->output_Fs, PH_ECU_MEM_NS ); /* q_synth_history_fx */ @@ -3256,9 +3254,6 @@ void stereo_switching_dec( sts[1]->last_L_frame = sts[0]->last_L_frame; /* Q0 */ move16(); -#ifndef FIX_918_WRONG_SCALING_ON_MODE_SWITCHING - Copy_Scale_sig( sts[0]->old_exc_fx, sts[1]->old_exc_fx, L_EXC_MEM_DEC, sub( sts[1]->Q_exc, sts[0]->Q_exc ) ); -#else /* Should not force sts[1]->Q_exc on the data of st[0], instead it better to just reuse the current scaling of st[0]*/ Copy( sts[0]->old_exc_fx, sts[1]->old_exc_fx, L_EXC_MEM_DEC ); /* Q_exc */ sts[1]->Q_exc = sts[0]->Q_exc; @@ -3291,7 +3286,6 @@ void stereo_switching_dec( sts[1]->prev_Q_syn = sts[0]->prev_Q_syn; move16(); -#endif Copy( sts[0]->lsf_old_fx, sts[1]->lsf_old_fx, M ); /* Q2.56 */ Copy( sts[0]->lsp_old_fx, sts[1]->lsp_old_fx, M ); /* Q15 */ IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) ) diff --git a/lib_dec/ivas_svd_dec.c b/lib_dec/ivas_svd_dec.c index 35ff45986ff96a9673e40948bd4683c39877fb54..e48408fbe0d74b5c15f4ffd755d133fe42c2b595 100644 --- a/lib_dec/ivas_svd_dec.c +++ b/lib_dec/ivas_svd_dec.c @@ -46,22 +46,10 @@ *-----------------------------------------------------------------------*/ /* The SVD is sensitive to changes to the following constants, so please be careful when trying to tune things */ -#define SVD_MAX_NUM_ITERATION 75 /* maximum number of interations before exiting the SVD */ -#ifndef IVAS_FLOAT_FIXED -#ifdef NONBE_FIX_1069_SVD_TUNING -#define SVD_MINIMUM_VALUE 1e-32f /* minimum value */ -#define CONVERGENCE_FACTOR 1.0e-04f /* factor for SVD convergence */ -#define SVD_ZERO_FLUSH_THRESHOLD 1.0e-20f -#else -#define SVD_MINIMUM_VALUE 1e-32f /* minimum value */ -#define CONVERGENCE_FACTOR 1.19209290e-07f /* factor for SVD convergence */ -#define SVD_ZERO_FLUSH_THRESHOLD 1.0e-20f -#endif -#else +#define SVD_MAX_NUM_ITERATION 75 /* maximum number of interations before exiting the SVD */ #define SVD_MINIMUM_VALUE_FX ( 2 ) /* minimum value */ #define SVD_ZERO_FLUSH_THRESHOLD_FX ( 0 ) #define CONVERGENCE_FACTOR_FX 214748 /* factor for SVD convergence (as per latest float code: 1.0e-04f) */ -#endif /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ @@ -715,11 +703,7 @@ static Word16 BidagonalDiagonalisation_fx( } ELSE { -#ifdef FIX_827_HIGH_MLD IF( GE_16( iteration, SVD_MAX_NUM_ITERATION ) ) -#else - IF( GT_16( iteration, SVD_MAX_NUM_ITERATION ) ) -#endif { IF( LT_32( singularValues_fx[iCh], 0 ) ) { @@ -1407,12 +1391,8 @@ IF( LT_16( currChannel, nChannelsL ) ) /* i <= m */ move32(); } - r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), sing_exp[currChannel], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ -#ifdef FIX_827_HIGH_MLD + r = BASOP_Util_Add_Mant32Exp( Mpy_32_32( ( *g ), singularVectors[currChannel][idx] ), sing_exp[currChannel], -norm_x, norm_x_e, &r_e ); /* exp(r_e) */ singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], sing_exp[currChannel], -( *g ), 0, &sing_exp[currChannel] ); /* sing_exp */ -#else - singularVectors[currChannel][idx] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][idx], sing_exp[idx], -( *g ), 0, &sing_exp[currChannel] ); -#endif move32(); FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */ diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 25d6b9fea8cf9d3d21edecd7607ad31e5b73c4e6..26484158f0f6562db744aebd49ee11940f0cc2a7 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -792,19 +792,11 @@ void stereo_tcx_core_dec_fx( move16(); IF( st->tcxonly ) { -#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION - FEC_clas_estim_fx( st, 0, st->L_frame, &st->clas_dec, GENERIC, pitch_C, synth_fx, &st->lp_ener_FER_fx, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 /*st->core_brate*/, 0, NULL, st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, hTcxLtpDec->tcxltp ? hTcxDec->tcxltp_last_gain_unmodified : MIN_16, CLASSIFIER_TCX, bfi, st->last_core_brate, -1 ); -#else FEC_clas_estim_fx( st, 0, st->L_frame, &st->clas_dec, GENERIC, pitch_C, synth_fx, &st->lp_ener_FER_fx, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, hTcxLtpDec->tcxltp ? hTcxDec->tcxltp_last_gain_unmodified : MIN_16, CLASSIFIER_TCX, bfi, st->last_core_brate, -1 ); -#endif } ELSE { -#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION - FEC_clas_estim_fx( st, 0, st->L_frame, &st->clas_dec, st->core_ext_mode, pitch_C, synth_fx, &st->lp_ener_FER_fx, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 /*st->core_brate*/, 0, NULL, st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, hTcxLtpDec->tcxltp ? hTcxDec->tcxltp_last_gain_unmodified : MIN_16, CLASSIFIER_TCX, bfi, st->last_core_brate, -1 ); -#else FEC_clas_estim_fx( st, 0, st->L_frame, &st->clas_dec, st->core_ext_mode, pitch_C, synth_fx, &st->lp_ener_FER_fx, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, st->mem_syn_clas_estim_fx, &st->classifier_Q_mem_syn, hTcxLtpDec->tcxltp ? hTcxDec->tcxltp_last_gain_unmodified : MIN_16, CLASSIFIER_TCX, bfi, st->last_core_brate, -1 ); -#endif } st->codec_mode = prev_codec_mode; /* Q0 */ move16(); diff --git a/lib_dec/ivas_td_low_rate_dec.c b/lib_dec/ivas_td_low_rate_dec.c index 73214cb3cadd4a2897532bded7d9af5e2e015fa9..bdba962520089f85e6640057f70fd096c04c8afc 100644 --- a/lib_dec/ivas_td_low_rate_dec.c +++ b/lib_dec/ivas_td_low_rate_dec.c @@ -316,10 +316,8 @@ void tdm_low_rate_dec_fx( edct_16fx( exc_wo_nf_fx, exc_wo_nf_fx, L_FRAME, find_guarded_bits_fx( L_FRAME ), IVAS_CPE_TD ); -#ifdef FIX_843_LOW_RATE_BWE Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, &exc[0], &bwe_exc[0], st->hGSCDec->last_exc_dct_in_fx, L_FRAME, L_FRAME * HIBND_ACB_L_FAC, L_shl( st->lp_gainc_fx, 13 /* Q3 -> Q16*/ ), &( st->Q_exc ), st->Q_subfr, NULL, 0, st->coder_type ); -#endif /*----------------------------------------------------------------------* * Remove potential pre-echo in case an onset has been detected *----------------------------------------------------------------------*/ @@ -613,40 +611,16 @@ void decod_gen_2sbfr_ivas_fx( /*----------------------------------------------------------------------* * Find the total excitation *----------------------------------------------------------------------*/ -#ifdef FIX_734_MISSING_SUBFR_LOW_RATE_ACELP /* Don't need the if/else as here L_frame==L_FRAME all the time */ Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, &exc[i_subfr], ( bwe_exc != NULL ) ? &bwe_exc[i_subfr * HIBND_ACB_L_FAC] : NULL, st->hGSCDec->last_exc_dct_in_fx, 2 * L_SUBFR, 2 * L_SUBFR * HIBND_ACB_L_FAC, gain_code, &( st->Q_exc ), st->Q_subfr, exc2, i_subfr, st->coder_type ); -#else - - IF( EQ_16( st->L_frame, L_FRAME ) ) - { - Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, &exc[i_subfr], ( bwe_exc != NULL ) ? &bwe_exc[i_subfr * HIBND_ACB_L_FAC] : NULL, st->hGSCDec->last_exc_dct_in_fx, - L_SUBFR, L_SUBFR * HIBND_ACB_L_FAC, gain_code, &( st->Q_exc ), st->Q_subfr, exc2, i_subfr, st->coder_type ); - } - ELSE - { - Rescale_exc( st->hMusicPF->dct_post_old_exc_fx, &exc[i_subfr], ( bwe_exc != NULL ) ? &bwe_exc[i_subfr * 2] : NULL, st->hGSCDec->last_exc_dct_in_fx, - L_SUBFR, L_SUBFR * 2, gain_code, &( st->Q_exc ), st->Q_subfr, exc2, i_subfr, st->coder_type ); - } -#endif Word16 gain_code16 = round_fx( L_shl( gain_code, st->Q_exc ) ); /*Q_exc*/ -#ifdef FIX_734_MISSING_SUBFR_LOW_RATE_ACELP Acelp_dec_total_exc( exc, exc2, gain_code16, gain_pit, i_subfr, code, 2 * L_SUBFR ); -#else - Acelp_dec_total_exc( exc, exc2, gain_code16, gain_pit, i_subfr, code, L_SUBFR ); -#endif /*-----------------------------------------------------------------* * Prepare TBE excitation *-----------------------------------------------------------------*/ -#ifdef FIX_734_MISSING_SUBFR_LOW_RATE_ACELP prep_tbe_exc_ivas_fx( L_frame, 2 * L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR /*i_subfr / L_SUBFR*/], bwe_exc, 0, NULL, st->Q_exc, T0, T0_frac, GENERIC, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag ); -#else - // prep_tbe_exc(L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc, 0, NULL, T0, GENERIC, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag); - // prep_tbe_exc_fx(L_frame, /*L_SUBFR,*/ i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc, 0, NULL, Q_exc, T0, T0_frac, GENERIC, st->core_brate/*, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag*/); - prep_tbe_exc_ivas_fx( L_frame, L_SUBFR, i_subfr, gain_pit, gain_code, code, voice_fac, &voice_factors[i_subfr / L_SUBFR], bwe_exc, 0, NULL, st->Q_exc, T0, T0_frac, GENERIC, st->core_brate, st->element_mode, st->idchan, st->hBWE_TD != NULL, st->tdm_LRTD_flag ); -#endif voice_factors[i_subfr / L_SUBFR + 1] = voice_factors[i_subfr / L_SUBFR /*i_subfr / L_SUBFR*/]; /* Q15 */ move16(); @@ -654,19 +628,10 @@ void decod_gen_2sbfr_ivas_fx( * Excitation enhancements (update of total excitation signal) * called twice because adapting it to double the subfr length would need lot of modifications *----------------------------------------------------------------*/ -#if 1 // def FIX_734_MISSING_SUBFR_LOW_RATE_ACELP enhancer_ivas_fx2( st->core_brate, 0, GENERIC, i_subfr, L_frame, voice_fac, st->stab_fac_fx, norm_gain_code, gain_inov, &st->gc_threshold_fx, code, exc2, gain_pit, &st->dm_fx, st->Q_exc ); enhancer_ivas_fx2( st->core_brate, 0, GENERIC, i_subfr, L_frame, voice_fac, st->stab_fac_fx, norm_gain_code, gain_inov, &st->gc_threshold_fx, code + L_SUBFR, exc2 + L_SUBFR, gain_pit, &st->dm_fx, st->Q_exc ); -#else - // enhancer(MODE1, st->core_brate, -1, 0, GENERIC, L_frame, voice_fac, st->stab_fac, norm_gain_code, gain_inov, &st->gc_threshold, code, exc2 + i_subfr, gain_pit, st->dispMem); - // enhancer_fx(MODE1, st->core_brate, -1, 0, GENERIC, L_frame, voice_fac, st->stab_fac, norm_gain_code, gain_inov, &st->gc_threshold, code, exc2 + i_subfr, gain_pit, st->dispMem); - enhancer_fx( st->core_brate, 0, GENERIC, i_subfr, L_frame, voice_fac, st->stab_fac_fx, norm_gain_code, gain_inov, &st->gc_threshold_fx, code, exc2, gain_pit, &st->dm_fx, st->Q_exc ); - // enhancer(MODE1, st->core_brate, -1, 0, GENERIC, L_frame, voice_fac, st->stab_fac, norm_gain_code, gain_inov, &st->gc_threshold, code + L_SUBFR, exc2 + i_subfr + L_SUBFR, gain_pit, st->dispMem); - // enhancer_fx(MODE1, st->core_brate, -1, 0, GENERIC, L_frame, voice_fac, st->stab_fac, norm_gain_code, gain_inov, &st->gc_threshold, code + L_SUBFR, exc2 + i_subfr + L_SUBFR, gain_pit, st->dispMem); - enhancer_fx( st->core_brate, 0, GENERIC, i_subfr, L_frame, voice_fac, st->stab_fac_fx, norm_gain_code, gain_inov, &st->gc_threshold_fx, code + L_SUBFR, exc2 + L_SUBFR, gain_pit, &st->dm_fx, st->Q_exc ); -#endif p_Aq += 2 * ( M + 1 ); /* Q12 */ pt_pitch++; diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 51b5af294eaf9cf63081ef228578247df9e12d8d..b3c3cf37e8bedd3619eafd87ebf42e7eced44787 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -202,9 +202,7 @@ ivas_error IVAS_DEC_Open( st_ivas->transport_config = IVAS_AUDIO_CONFIG_INVALID; st_ivas->intern_config = IVAS_AUDIO_CONFIG_INVALID; st_ivas->writeFECoffset = 0; -#ifdef FIX_667_DISABLE_INITIAL_PLC_SUPPRESSION hIvasDec->hasDecodedFirstGoodFrame = true; /* Functionality to suppress output for initial lost frames is disabled in EVS operation */ -#endif return IVAS_ERR_OK; } diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 77cc8710f70ad551ac6b58e484ef1a39cfcecc6a..5e3e4051126f3fff8969d0d875f9c448046d77ed 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -223,9 +223,7 @@ ivas_error IVAS_DEC_Open( st_ivas->transport_config = IVAS_AUDIO_CONFIG_INVALID; st_ivas->intern_config = IVAS_AUDIO_CONFIG_INVALID; st_ivas->writeFECoffset = 0; -#ifdef FIX_667_DISABLE_INITIAL_PLC_SUPPRESSION hIvasDec->hasDecodedFirstGoodFrame = true; /* Functionality to suppress output for initial lost frames is disabled in EVS operation */ -#endif move16(); move16(); move16(); @@ -3701,20 +3699,12 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( } } -#ifdef FIX_930_JBM_BUFSIZE_MULT IF( ( hIvasDec->apaExecBuffer_fx = malloc( sizeof( Word32 ) * L_mult0( apa_buffer_size, (Word16) nTransportChannels ) ) ) == NULL ) -#else - IF( ( hIvasDec->apaExecBuffer_fx = malloc( sizeof( Word32 ) * imult1616( apa_buffer_size, (Word16) nTransportChannels ) ) ) == NULL ) -#endif { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); } -#ifdef FIX_930_JBM_BUFSIZE_MULT set_zero2_fx( hIvasDec->apaExecBuffer_fx, L_mult0( apa_buffer_size, (Word16) nTransportChannels ) ); -#else - set_zero_fx( hIvasDec->apaExecBuffer_fx, imult1616( apa_buffer_size, (Word16) nTransportChannels ) ); -#endif } } ELSE @@ -3736,19 +3726,11 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( set_zero( hIvasDec->apaExecBuffer, apa_buffer_size * nTransportChannels ); #else free( hIvasDec->apaExecBuffer_fx ); -#ifdef FIX_930_JBM_BUFSIZE_MULT IF( ( hIvasDec->apaExecBuffer_fx = malloc( sizeof( Word32 ) * L_mult0( apa_buffer_size, (Word16) nTransportChannels ) ) ) == NULL ) -#else - IF( ( hIvasDec->apaExecBuffer_fx = malloc( sizeof( Word32 ) * imult1616( apa_buffer_size, (Word16) nTransportChannels ) ) ) == NULL ) -#endif { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); } -#ifdef FIX_930_JBM_BUFSIZE_MULT set_zero2_fx( hIvasDec->apaExecBuffer_fx, L_mult0( apa_buffer_size, (Word16) nTransportChannels ) ); -#else - set_zero_fx( hIvasDec->apaExecBuffer_fx, imult1616( apa_buffer_size, (Word16) nTransportChannels ) ); -#endif #endif } /* realloc apa_exe_buffer */ diff --git a/lib_dec/lsf_dec_fx.c b/lib_dec/lsf_dec_fx.c index 3f92a69728828db55c6a30902fb701b4a36bacce..31002b8bca0375b24fae61b8ab4fba978d56f7dc 100644 --- a/lib_dec/lsf_dec_fx.c +++ b/lib_dec/lsf_dec_fx.c @@ -7,10 +7,8 @@ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE #include "ivas_prot.h" #include "ivas_prot_fx.h" -#endif #ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Local functions @@ -112,10 +110,8 @@ void lsf_dec_fx( Word16 *lsp_new, /* o : de-quantized LSP vector Q15*/ Word16 *lsp_mid, /* o : de-quantized mid-frame LSP vector Q15*/ const Word16 tdm_low_rate_mode /* i : secondary channel low rate mode flag Q0*/ -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel Qx*/ -#endif ) { Word16 i; @@ -183,12 +179,8 @@ void lsf_dec_fx( } /* LSF de-quantization */ - lsf_end_dec_fx( st_fx, 0, coder_type, st_fx->bwidth, nBits, lsf_new, param_lpc, LSF_Q_prediction, &no_param_lpc -#ifdef FIX_798_LSF_SECONDARY_CH_MISSING_CODE - , - tdm_lsfQ_PCh -#endif - ); + lsf_end_dec_fx( st_fx, 0, coder_type, st_fx->bwidth, nBits, lsf_new, param_lpc, LSF_Q_prediction, &no_param_lpc, + tdm_lsfQ_PCh ); /* convert quantized LSFs to LSPs */ @@ -372,10 +364,8 @@ void lsf_dec_ivas_fx( Word16 *lsp_new, /* o : de-quantized LSP vector Q15*/ Word16 *lsp_mid, /* o : de-quantized mid-frame LSP vector Q15*/ const Word16 tdm_low_rate_mode /* i : secondary channel low rate mode flag Q0*/ -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel Qx*/ -#endif ) { Word16 i; @@ -443,12 +433,8 @@ void lsf_dec_ivas_fx( } /* LSF de-quantization */ - lsf_end_dec_fx( st_fx, 0, coder_type, st_fx->bwidth, nBits, lsf_new, param_lpc, LSF_Q_prediction, &no_param_lpc -#ifdef FIX_798_LSF_SECONDARY_CH_MISSING_CODE - , - tdm_lsfQ_PCh -#endif - ); + lsf_end_dec_fx( st_fx, 0, coder_type, st_fx->bwidth, nBits, lsf_new, param_lpc, LSF_Q_prediction, &no_param_lpc, + tdm_lsfQ_PCh ); /* convert quantized LSFs to LSPs */ @@ -642,10 +628,8 @@ void lsf_end_dec_fx( Word16 *lpc_param, /* i : LPC parameters Q0*/ Word16 *LSF_Q_prediction, /* o : LSF prediction mode Q0*/ Word16 *nb_indices /* o : number of indices Q0*/ -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE , const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel Qx*/ -#endif ) { Word16 pred0[M]; /* Prediction for the safety-net quantizer (usually mean)*/ @@ -670,9 +654,7 @@ void lsf_end_dec_fx( Word16 coder_type; Word16 ber_flag; Word16 flag_1bit_gran; -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE Word16 pred3[M]; -#endif flag_1bit_gran = (Word16) ( st->element_mode > EVS_MONO ); /* Q0 */ nBits = nBits_in; /* Q0 */ @@ -732,7 +714,6 @@ void lsf_end_dec_fx( /*--------------------------------------------------------------------------* * Select safety_net or predictive mode *--------------------------------------------------------------------------*/ -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE test(); test(); IF( st->tdm_LRTD_flag == 0 && EQ_16( st->idchan, 1 ) && tdm_lsfQ_PCh != NULL ) @@ -741,7 +722,6 @@ void lsf_end_dec_fx( /*predmode += 3;*/ predmode = add( predmode, 3 ); /* Q0 */ } -#endif p_lpc_param = lpc_param; /* Q0 */ @@ -780,7 +760,6 @@ void lsf_end_dec_fx( /*--------------------------------------------------------------------------* * Read indices from array *--------------------------------------------------------------------------*/ -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE test(); /* Make sure there are the correct bit allocations */ IF( EQ_16( st->idchan, 1 ) && GT_16( predmode, 2 ) ) @@ -791,7 +770,6 @@ void lsf_end_dec_fx( Copy( levels1, levels0, stages0 ); /* Q0 */ Copy( bits1, bits0, stages0 ); /* Q0 */ } -#endif test(); test(); @@ -965,17 +943,14 @@ void lsf_end_dec_fx( pred1[i] = add( pred0[i], mult_r( MU_MA_FX, st->mem_MA_fx[i] ) ); /* Q2.56 */ move16(); } -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE /* TD stereo SCh: perform intra-frame prediction with pulling-to-mean */ IF( st->tdm_LRTD_flag == 0 && EQ_16( st->idchan, 1 ) && tdm_lsfQ_PCh != NULL ) { tdm_SCh_LSF_intra_pred_fx( st->element_brate, tdm_lsfQ_PCh, pred3 ); } -#endif IF( safety_net ) { /* LVQ */ -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE test(); test(); IF( st->tdm_LRTD_flag == 0 && EQ_16( st->idchan, 1 ) && tdm_lsfQ_PCh != NULL ) @@ -990,7 +965,6 @@ void lsf_end_dec_fx( Vr_subt( qlsf, pred1, st->mem_MA_fx, M ); } ELSE -#endif { IF( st->element_mode != EVS_MONO ) { @@ -1010,7 +984,6 @@ void lsf_end_dec_fx( } ELSE { -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE IF( EQ_16( predmode, 4 ) ) { mode_lvq_p = 9; @@ -1018,7 +991,6 @@ void lsf_end_dec_fx( move16(); move16(); } -#endif IF( st->element_mode != EVS_MONO ) { ber_flag = vq_dec_lvq_ivas_fx( 0, qlsf, &lindice[1], stages1, M, mode_lvq_p, levels1[stages1 - 1] ); /* Q0 */ @@ -1031,12 +1003,8 @@ void lsf_end_dec_fx( } st->BER_detect = s_or( st->BER_detect, ber_flag ); /* Q0 */ move16(); -#if defined LSF_RE_USE_SECONDARY_CHANNEL || defined FIX_798_LSF_SECONDARY_CH_MISSING_CODE test(); IF( EQ_16( predmode, 1 ) || EQ_16( predmode, 4 ) ) /* MA only */ -#else - IF( EQ_16( predmode, 1 ) ) /* MA only */ -#endif { Copy( qlsf, st->mem_MA_fx, M ); /* Q2.56 */ Vr_add( qlsf, pred1, qlsf, M ); /* Q2.56 */ diff --git a/lib_dec/pvq_core_dec.c b/lib_dec/pvq_core_dec.c index 5d66001daba27bd341627ba011728d82a17233cb..2ed83e60fa8c820d12b70980112b968275b45921 100644 --- a/lib_dec/pvq_core_dec.c +++ b/lib_dec/pvq_core_dec.c @@ -110,17 +110,11 @@ static void pvq_decode_band( for ( j = 0; j < Np; j++ ) { -#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR g_part[j] = -( (float) g_part_s[j] ) / 32768; /* note: here g_part needs to be become exactly 1.0(float) thus in BASOP Word16 g_part_s is in the negative Q15 domain */ -#endif -#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR /* aligned to BASOP to avoid USAN undefined negation warning for -(-32768) */ g_part_s[j] = negate( g_part_s[j] ); -#else - g_part_s[j] = -g_part_s[j]; -#endif } srt_vec_ind( g_part_s, sg_part, idx_sort, Np ); @@ -426,11 +420,7 @@ static void densitySymbolIndexDecode( { tot = res * ( res + 1 ) + 1; dec_freq = rc_decode( &st->BER_detect, hPVQ, tot ); -#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR alpha = (int16_t) floor_sqrt_exact( (uint32_t) ( ( res + 1 ) * ( res + 1 ) - dec_freq ) ) + res + 1; -#else - alpha = (int16_t) floor_sqrt_exact( (uint32_t) ( res + 1 ) * ( res + 1 ) - dec_freq ) + res + 1; -#endif sym_freq = 2 * ( res - alpha ) + 1; cum_freq = alpha * ( 2 * ( res + 1 ) - alpha ); } @@ -448,11 +438,7 @@ static void densitySymbolIndexDecode( dec_freq = rc_decode( &st->BER_detect, hPVQ, tot ); if ( dec_freq < tot - ( res + 1 ) - ( res - ( c + 1 ) ) * ( res - c ) * c + c + 1 ) { -#ifdef FIX_976_USAN_PVQ_ENC_DEC_EVS_CR alpha = ( res_c - 1 + (int16_t) floor_sqrt_exact( (uint32_t) ( res_c * ( res_c + 4 * dec_freq - 2 ) + 1 ) ) ) / ( 2 * res_c ); -#else - alpha = ( res_c - 1 + (int16_t) floor_sqrt_exact( (uint32_t) res_c * ( res_c + 4 * dec_freq - 2 ) + 1 ) ) / ( 2 * res_c ); -#endif sym_freq = 2 * alpha * res_c + 1; cum_freq = alpha * ( ( alpha - 1 ) * res_c + 1 ); } diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 19ad7dfae445d32efc2812eb7443fc586e30f984..00f489024974ecce6c788acd7d370e0a2fd7d9bb 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1514,9 +1514,7 @@ typedef struct zero_bwe_dec_structure Word16 delay_syn_hf_fx[NS2SA( 16000, DELAY_CLDFB_NS )]; /* HF (6-7kHz) BWE - To synchronise BWE content with postfiltered synthesis Q0*/ Word16 mem_hp_interp_fx[INTERP_3_1_MEM_LEN]; /* HF (6-7 kHz) BWE - interp. memory */ -#ifdef FIX_774_ENERGY_BURST - Word16 memExp1; /* Exponent for mem_hf_fx scaling*/ -#endif + Word16 memExp1; /* Exponent for mem_hf_fx scaling*/ } ZERO_BWE_DEC_DATA, *ZERO_BWE_DEC_HANDLE; diff --git a/lib_dec/swb_bwe_dec_fx.c b/lib_dec/swb_bwe_dec_fx.c index 6e9fd80dc897310069043a29b4fce7dde2007787..4f35db6558606d02b60c8a87a57d8193ed159918 100644 --- a/lib_dec/swb_bwe_dec_fx.c +++ b/lib_dec/swb_bwe_dec_fx.c @@ -369,9 +369,7 @@ Word16 ivas_wb_bwe_dec_fx( /* o : Word16 scl, new_input_fx_exp; Word16 i; FD_BWE_DEC_HANDLE hBWE_FD; -#ifdef FIX_843_LOW_RATE_BWE Word16 ysynth_frame_size; -#endif Word16 coder_type = st_fx->coder_type; move16(); @@ -392,9 +390,7 @@ Word16 ivas_wb_bwe_dec_fx( /* o : *Qpost = sub( new_input_fx_exp, 15 ); move16(); direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, /*st->L_frame*/ L_FRAME16k, &new_input_fx_exp, st_fx->element_mode ); -#ifdef FIX_843_LOW_RATE_BWE ysynth_frame_size = L_FRAME16k; -#endif } ELSE { @@ -404,16 +400,8 @@ Word16 ivas_wb_bwe_dec_fx( /* o : *Qpost = sub( new_input_fx_exp, 15 ); move16(); /* DCT of the ACELP core synthesis */ -#ifdef FIX_843_LOW_RATE_BWE direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, output_frame, &new_input_fx_exp, st_fx->element_mode ); ysynth_frame_size = output_frame; -#else -#ifdef MSAN_FIX - direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, L_FRAME16k, &new_input_fx_exp, st_fx->element_mode ); -#else - direct_transform_fx( L_wtda_synth_fx, ysynth_32, 0, output_frame, &new_input_fx_exp, st_fx->element_mode ); -#endif -#endif } /* Convert to 16 Bits (Calc Shift Required to Stay within MAX_Q_NEW_INPUT) */ scl = sub( 16 + MAX_Q_NEW_INPUT, new_input_fx_exp ); @@ -422,27 +410,11 @@ Word16 ivas_wb_bwe_dec_fx( /* o : { /* Yes */ /* Calc Room to Upscale */ -#ifdef FIX_843_LOW_RATE_BWE Q_syn = Find_Max_Norm32( ysynth_32, ysynth_frame_size ); -#else -#ifdef MSAN_FIX - Q_syn = Find_Max_Norm32( ysynth_32, L_FRAME16k ); -#else - Q_syn = Find_Max_Norm32( ysynth_32, output_frame ); -#endif -#endif /* Stay within MAX_Q_NEW_INPUT */ scl = s_min( Q_syn, scl ); } -#ifdef FIX_843_LOW_RATE_BWE Copy_Scale_sig32_16( ysynth_32, ysynth_fx, ysynth_frame_size, scl ); -#else -#ifdef MSAN_FIX - Copy_Scale_sig32_16( ysynth_32, ysynth_fx, L_FRAME16k, scl ); -#else - Copy_Scale_sig32_16( ysynth_32, ysynth_fx, output_frame, scl ); -#endif -#endif Q_syn = add( sub( new_input_fx_exp, 16 ), scl ); IF( !st_fx->bfi ) { diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index 87f22ae930bc472b813cc8751debb1fc25ba7765..942a229f75be27ed93d20168c939d5ae530c6153 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -337,14 +337,12 @@ void wb_tbe_dec( prev_pow = sum2_f( shaped_wb_excitation, L_SHB_LAHEAD / 4 ); curr_pow = sum2_f( shaped_wb_excitation + L_SHB_LAHEAD / 4, L_SHB_LAHEAD / 4 ); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE if ( st->element_mode > EVS_MONO ) { /* prevent too low values of energy */ prev_pow = max( 0.00001f, prev_pow ); curr_pow = max( 0.00001f, curr_pow ); } -#endif if ( voice_factors[0] > 0.75f ) { @@ -1121,11 +1119,7 @@ void ivas_swb_tbe_dec_fx( /* find tilt */ calc_tilt_bwe_fx_loc( old_syn_12k8_16k_fx, &tilt_swb_fec_32_fx, &tilt_swb_fec_fx_q, L_FRAME ); -#ifdef FIX_856_EXTRACT_L tilt_swb_fec_fx = round_fx_sat( L_shl_sat( tilt_swb_fec_32_fx, sub( 11 + 16, tilt_swb_fec_fx_q ) ) ); -#else - tilt_swb_fec_fx = extract_l( L_shr( tilt_swb_fec_32_fx, sub( tilt_swb_fec_fx_q, 11 ) ) ); -#endif test(); if ( st->bfi && st->clas_dec != UNVOICED_CLAS ) { @@ -1797,14 +1791,12 @@ void ivas_swb_tbe_dec_fx( move16(); } -#ifdef FIX_729_MISSING_RESCALING /* rescale the TBE post proc memory */ FOR( i = 0; i < LPC_SHB_ORDER; i++ ) { hBWE_TD->mem_stp_swb_fx[i] = shl_sat( hBWE_TD->mem_stp_swb_fx[i], sub( Q_bwe_exc, st->prev_Q_bwe_syn ) ); move16(); } -#endif /* fill-in missing SHB excitation */ test(); test(); @@ -3417,15 +3409,12 @@ void swb_tbe_dec( prev_pow = sum2_f( shaped_shb_excitation, L_SHB_LAHEAD + 10 ); curr_pow = sum2_f( shaped_shb_excitation + L_SHB_LAHEAD + 10, L_SHB_LAHEAD + 10 ); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE if ( st->element_mode > EVS_MONO ) { /* prevent too low values of energy */ prev_pow = max( 0.00001f, prev_pow ); curr_pow = max( 0.00001f, curr_pow ); } -#endif - if ( voice_factors[0] > 0.75f ) { curr_pow *= 0.25; diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index cb3ae52a8f466df02fc8eb9c40328586f5512f8b..eab335e4e9bcdf8e220003639d6fea67035f91de 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -906,17 +906,15 @@ void ivas_wb_tbe_dec_fx( prev_pow = 0; move32(); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE IF( st_fx->element_mode > EVS_MONO ) { tmp = sub( shl( sub( st_fx->prev_Q_bwe_exc, 16 ), 1 ), 31 + 16 ); #ifdef BASOP_NOGLOB prev_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/ #else - prev_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/ + prev_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/ #endif } -#endif FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ ) { prev_pow = L_mac0( prev_pow, hBWE_TD->state_syn_shbexc_fx[i], hBWE_TD->state_syn_shbexc_fx[i] ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/ @@ -942,17 +940,15 @@ void ivas_wb_tbe_dec_fx( curr_pow = 0; move32(); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE IF( st_fx->element_mode > EVS_MONO ) { tmp = sub( shl( Q_bwe_exc_ext, 1 ), 31 + 16 ); #ifdef BASOP_NOGLOB curr_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(Q_bwe_exc_ext))*/ #else - curr_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /* 2*(Q_bwe_exc_ext) */ + curr_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /* 2*(Q_bwe_exc_ext) */ #endif } -#endif FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ ) { #ifdef BASOP_NOGLOB @@ -1586,17 +1582,15 @@ void wb_tbe_dec_fx( prev_pow = 0; move32(); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE IF( st_fx->element_mode > EVS_MONO ) { tmp = sub( shl( sub( st_fx->prev_Q_bwe_exc, 16 ), 1 ), 31 + 16 ); #ifdef BASOP_NOGLOB prev_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/ #else - prev_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/ + prev_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/ #endif } -#endif FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ ) { #ifdef BASOP_NOGLOB @@ -1631,17 +1625,15 @@ void wb_tbe_dec_fx( curr_pow = 0; move32(); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE IF( st_fx->element_mode > EVS_MONO ) { tmp = sub( shl( Q_bwe_exc_ext, 1 ), 31 + 16 ); #ifdef BASOP_NOGLOB curr_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(Q_bwe_exc_ext))*/ #else - curr_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /* 2*(Q_bwe_exc_ext) */ + curr_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /* 2*(Q_bwe_exc_ext) */ #endif } -#endif FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ ) { #ifdef BASOP_NOGLOB @@ -4966,11 +4958,7 @@ void fb_tbe_dec_ivas_fx( test(); IF( GE_16( st->element_mode, IVAS_CPE_DFT ) && ( st->idchan == 0 ) ) { -#ifdef FIX_839_FB_CONTENT_SOMETIME_MISSING Copy_Scale_sig( fb_synth, fb_synth_ref, L_FRAME48k, sub( Q_fb_synth_ref, add( hb_synth_exp, 16 ) ) ); // scaling is required -#else - Copy_Scale_sig( fb_synth, fb_synth_ref, L_FRAME48k, sub( Q_fb_synth_ref, hb_synth_exp ) ); // scaling is required -#endif } /* add the fb_synth component to the hb_synth component */ /* v_add_fx( hb_synth, fb_synth, hb_synth, L_FRAME48k );*/ diff --git a/lib_dec/tcx_utils_dec_fx.c b/lib_dec/tcx_utils_dec_fx.c index 1c7bee57be3dd1a64b67569233d49e06c3924dbf..5bffdada43cc269ea72dc414f04889c83ba78249 100644 --- a/lib_dec/tcx_utils_dec_fx.c +++ b/lib_dec/tcx_utils_dec_fx.c @@ -48,9 +48,6 @@ void tcx_decoder_memory_update( Copy( xn_buf, synth, L_frame_glob ); Copy( synth + sub( L_frame_glob, M + 1 ), st->syn, M + 1 ); -#ifndef FIX_778_STEREO_BRATE_SWITCHING - IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) ) -#endif { IF( !fb ) /* TV2FhG -> Condition differs from floating point */ { @@ -58,16 +55,13 @@ void tcx_decoder_memory_update( /* Emphasis of synth -> synth_pe */ tmp = synth[-M - 1]; move16(); -#ifdef FIX_778_STEREO_BRATE_SWITCHING IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { -#endif st->Q_syn = E_UTIL_f_preemph3( synth - M, preemph, add( M, L_frame_glob ), &tmp, 1 ); move16(); st->prev_Q_syn = st->Q_syn = sub( st->Q_syn, 1 ); move16(); move16(); -#ifdef FIX_778_STEREO_BRATE_SWITCHING } ELSE { @@ -76,13 +70,10 @@ void tcx_decoder_memory_update( move16(); move16(); } -#endif Copy( synth + sub( L_frame_glob, M ), st->mem_syn2_fx, M ); Copy( synth + sub( L_frame_glob, L_SYN_MEM ), st->mem_syn_r, L_SYN_MEM ); -#ifdef FIX_778_STEREO_BRATE_SWITCHING IF( NE_16( st->element_mode, IVAS_CPE_MDCT ) ) { -#endif test(); IF( ( st->tcxonly == 0 ) || LE_16( L_frame_glob, L_FRAME16k ) ) { @@ -106,9 +97,7 @@ void tcx_decoder_memory_update( } /* Update old_Aq */ Copy( A, st->old_Aq_12_8_fx /*Q12*/, M + 1 ); -#ifdef FIX_778_STEREO_BRATE_SWITCHING } -#endif } } return; diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 6e3ddcfd2916ada892db0589652dfcae98a92332..a94f65309f3cfe35b03183e35948504e27173ed7 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -2029,11 +2029,7 @@ ELSE FOR( i = 1; i < hTonalMDCTConc->pTCI->numIndexes; i++ ) { tmp = round_fx( BASOP_Util_fPow( L_deposit_h( tiltFactor ), 0, L_deposit_h( (UWord16) L_add( L_sub( hTonalMDCTConc->pTCI->upperIndex[i - 1], hTonalMDCTConc->pTCI->lowerIndex[i - 1] ), 1 ) ), 15, &exp ) ); -#ifdef FIX_879_DIFF_CONCEAL_PATH tmp = shl_sat( tmp, exp ); -#else - tmp = shl( tmp, exp ); -#endif tilt = mult_r( tilt, tmp ); // Q15 FOR( l = hTonalMDCTConc->pTCI->lowerIndex[i]; l <= hTonalMDCTConc->pTCI->upperIndex[i]; l++ ) diff --git a/lib_dec/updt_dec.c b/lib_dec/updt_dec.c index 70c049e0f67b40f33cb74c4dd5169c264afba23a..ac44966d58c0953f72031ecbc72d26eec97566fb 100644 --- a/lib_dec/updt_dec.c +++ b/lib_dec/updt_dec.c @@ -518,11 +518,7 @@ void updt_dec_common( st->stab_fac_smooth_lt = ENV_SMOOTH_FAC * st->stab_fac + ( 1.0f - ENV_SMOOTH_FAC ) * st->stab_fac_smooth_lt; } -#ifdef NON_BE_1055_RESET_LP_MEMORIES if ( ( st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) ) ) -#else - if ( ( st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && st->codec_mode == MODE2 ) ) -#endif { /* reset LP memories */ set_zero( st->mem_MA, M ); diff --git a/lib_dec/updt_dec_fx.c b/lib_dec/updt_dec_fx.c index d21bde643519cc50e71a1cc135f844207764cdbb..38cc6d4b2155ecf305f7c51a324ade7c167b6ce0 100644 --- a/lib_dec/updt_dec_fx.c +++ b/lib_dec/updt_dec_fx.c @@ -1018,12 +1018,8 @@ void ivas_updt_dec_common_fx( test(); test(); test(); -#ifdef NON_BE_1055_RESET_LP_MEMORIES test(); IF( ( LE_32( st_fx->core_brate, SID_2k40 ) && EQ_16( st_fx->cng_type, FD_CNG ) ) || ( st_fx->tcxonly && ( EQ_16( st_fx->codec_mode, MODE2 ) || ( st_fx->element_mode > EVS_MONO ) ) ) ) -#else - IF( ( ( LE_32( st_fx->core_brate, SID_2k40 ) ) && EQ_16( st_fx->cng_type, FD_CNG ) ) || ( st_fx->tcxonly && EQ_16( st_fx->codec_mode, MODE2 ) ) ) -#endif { /* reset LP memories */ set16_fx( st_fx->mem_MA_fx, 0, M ); @@ -1352,34 +1348,6 @@ void update_decoder_LPD_cng( set16_fx( pitch, shl( L_SUBFR, 6 ), NB_SUBFR16k ); -#ifndef FIX_871_REMOVE_UNNECESSARY_CONDITION - FEC_clas_estim_fx( - st, - /*Opt_AMR_WB*/ 0, /*A*/ - st->L_frame, - &( st->clas_dec ), - coder_type, - pitch, - synth, - &st->lp_ener_FER_fx, - /**decision_hyst*/ NULL, /* i/o: hysteresis of the music/speech decision */ - /**UV_cnt*/ NULL, /* i/o: number of consecutives frames classified as UV */ - /**LT_UV_cnt*/ NULL, /* i/o: long term consecutives frames classified as UV */ - /**Last_ener*/ NULL, /* i/o: last_energy frame */ - /**locattack*/ NULL, /* i/o: detection of attack (mainly to localized speech burst) */ - /**lt_diff_etot*/ NULL, /* i/o: long-term total energy variation */ - /**amr_io_class*/ NULL, /* i/o: classification for AMR-WB IO mode */ - /*bitrate*/ 0, /* i : Decoded bitrate */ - st->Q_syn, /* i : Synthesis scaling */ - /**class_para*/ NULL, /* o : classification para. fmerit1 */ - st->mem_syn_clas_estim_fx, /* i/o: memory of the synthesis signal for frame class estimation */ - &st->classifier_Q_mem_syn, /*i/o : exponent for memory of synthesis signal for frame class estimation */ - -32768 /*-1.f Q15*/, /* i : LTP Gain */ - 0 /*CLASSIFIER_ACELP*/, /* i : signal classifier mode */ - 0 /*bfi*/, /* i : bad frame indicator */ - st->last_core_brate, /* i : bitrate of previous frame */ - -1 ); -#else FEC_clas_estim_fx( st, /*Opt_AMR_WB*/ 0, /*A*/ @@ -1405,7 +1373,6 @@ void update_decoder_LPD_cng( 0 /*bfi*/, /* i : bad frame indicator */ st->last_core_brate, /* i : bitrate of previous frame */ -1 ); -#endif /* Postfiltering */ set16_fx( pf_pitch, L_SUBFR, NB_SUBFR16k ); set16_fx( pf_gain, 0, NB_SUBFR16k ); diff --git a/lib_dec/vlpc_2st_dec_fx.c b/lib_dec/vlpc_2st_dec_fx.c index 74b53369ca3a7d236bb510d88982bc95d4fd62f6..871e8cde14d855a02fa648b833f1307ce941492b 100644 --- a/lib_dec/vlpc_2st_dec_fx.c +++ b/lib_dec/vlpc_2st_dec_fx.c @@ -34,16 +34,11 @@ void vlpc_2st_dec( FOR( i = 0; i < M; i++ ) { -#ifdef FIX_SATURATION_725 //#ifdef DEBUGGING to be removed assert( abs_s( xq[i] ) <= 32 ); /* If xq > 32 for IVAS, we might need a different loop implementation */ //#endif lsfq[i] = add( lsfq[i], shl( mult_r( w[i], shl_sat( xq[i], 10 ) ), 2 ) ); /*14Q1*1.28*/ move16(); -#else - lsfq[i] = add( lsfq[i], shl( mult_r( w[i], shl( xq[i], 10 ) ), 2 ) ); /*14Q1*1.28*/ - move16(); -#endif } /* reorder */ diff --git a/lib_enc/ACcontextMapping_enc.c b/lib_enc/ACcontextMapping_enc.c index c33b5f3d5117b4f985075ba9984e2ae07a8f9308..1a49c9492dfe9a5ebd9700c5259eb1d096d7291c 100644 --- a/lib_enc/ACcontextMapping_enc.c +++ b/lib_enc/ACcontextMapping_enc.c @@ -54,7 +54,7 @@ * * Arithmetic encoder *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void ACcontextMapping_encode2_no_mem_s17_LC( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ int16_t *x, @@ -367,7 +367,7 @@ void ACcontextMapping_encode2_no_mem_s17_LC( return; } - +#endif /*-------------------------------------------------------------------* * find_last_nz_pair() * @@ -471,7 +471,7 @@ static Word16 find_last_nz_pair( * * *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED int16_t ACcontextMapping_encode2_estimate_no_mem_s17_LC( const int16_t *x, const int16_t nt, @@ -1055,7 +1055,7 @@ void RCcontextMapping_encode2_no_mem_s17_LCS( /* return (bp+nbbits_lsbs);*/ /*return only for debug plot*/ return; } - +#endif /*-------------------------------------------------------------------* * RCcontextMapping_encode2_estimate_no_mem_s17_LCS() * diff --git a/lib_enc/acelp_core_enc.c b/lib_enc/acelp_core_enc.c index b6717e6821db72a199140e1ec7ab78339f8ae377..7bd509e8b65728774b9e8047ca5cf68993cbbd94 100644 --- a/lib_enc/acelp_core_enc.c +++ b/lib_enc/acelp_core_enc.c @@ -539,11 +539,7 @@ ivas_error acelp_core_enc( test(); test(); -#ifdef NON_BE_FIX_807_MASA_DTX_BRSW IF( st->hDtxEnc != NULL && ( st->last_core_brate == FRAME_NO_DATA || EQ_32( st->last_core_brate, SID_2k40 ) ) ) -#else - IF( st->last_core_brate == FRAME_NO_DATA || EQ_32( st->last_core_brate, SID_2k40 ) ) -#endif { Copy( st->hDtxEnc->lspCNG_fx, st->lsp_old_fx, M ); // Q15 lsp2lsf_fx( st->hDtxEnc->lspCNG_fx, st->lsf_old_fx, M, int_fs ); @@ -1213,11 +1209,7 @@ else * After inactive period, use the most up-to-date ISPs *-----------------------------------------------------------------*/ -#ifdef NON_BE_FIX_807_MASA_DTX_BRSW if ( st->hDtxEnc != NULL && ( st->last_core_brate == FRAME_NO_DATA || st->last_core_brate == SID_2k40 ) ) -#else - if ( st->last_core_brate == FRAME_NO_DATA || st->last_core_brate == SID_2k40 ) -#endif { mvr2r( st->hDtxEnc->lspCNG, st->lsp_old, M ); lsp2lsf( st->hDtxEnc->lspCNG, st->lsf_old, M, int_fs ); @@ -1645,11 +1637,7 @@ else * After inactive period, use the most up-to-date ISPs *-----------------------------------------------------------------*/ -#ifdef NON_BE_FIX_807_MASA_DTX_BRSW if ( st->hDtxEnc != NULL && ( st->last_core_brate == FRAME_NO_DATA || st->last_core_brate == SID_2k40 ) ) -#else - if ( st->last_core_brate == FRAME_NO_DATA || st->last_core_brate == SID_2k40 ) -#endif { mvr2r( st->hDtxEnc->lspCNG, st->lsp_old, M ); lsp2lsf( st->hDtxEnc->lspCNG, st->lsf_old, M, int_fs ); diff --git a/lib_enc/acelp_core_enc_fx.c b/lib_enc/acelp_core_enc_fx.c index a21f4adbb08c9233c87999f3dcf7a8c561252f26..66e34e2a58b614dace296d7eaea7ec8ceb7cc31b 100644 --- a/lib_enc/acelp_core_enc_fx.c +++ b/lib_enc/acelp_core_enc_fx.c @@ -405,12 +405,8 @@ ivas_error acelp_core_enc_fx( *-----------------------------------------------------------------*/ test(); -#ifdef NON_BE_FIX_807_MASA_DTX_BRSW test(); IF( st_fx->hDtxEnc != NULL && ( st_fx->last_core_brate == FRAME_NO_DATA || EQ_32( st_fx->last_core_brate, SID_2k40 ) ) ) -#else - IF( EQ_32( st_fx->last_core_brate, FRAME_NO_DATA ) || EQ_32( st_fx->last_core_brate, SID_2k40 ) ) -#endif { Copy( hDtxEnc->lspCNG_fx, st_fx->lsp_old_fx, M ); diff --git a/lib_enc/acelp_enc_util.c b/lib_enc/acelp_enc_util.c index f00ff6dd0641082a09bd22d7b9712ad7328f706c..8b8cc587801061941f1f958978e4c2f74b345dcf 100644 --- a/lib_enc/acelp_enc_util.c +++ b/lib_enc/acelp_enc_util.c @@ -46,7 +46,7 @@ * * Multiplication of Toeplitz matrix with vector c, such that d = toeplitz(R)*c *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void E_ACELP_toeplitz_mul( const float R[], const float c[], @@ -73,3 +73,4 @@ void E_ACELP_toeplitz_mul( return; } +#endif diff --git a/lib_enc/analy_lp.c b/lib_enc/analy_lp.c index ba32866dbf9c9e853beb3549e28a0d0e64fb88f7..88cba99f29df315cbe245c27672ae0fe28ba1541 100644 --- a/lib_enc/analy_lp.c +++ b/lib_enc/analy_lp.c @@ -52,7 +52,7 @@ * - find interpolated LSPs and convert back to A(z) for all subframes * - update LSPs for the next frame *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void analy_lp( const float speech[], /* i : pointer to the speech frame */ const int16_t L_frame, /* i : length of the frame */ @@ -181,3 +181,4 @@ void analy_lp_AMR_WB( return; } +#endif diff --git a/lib_enc/ari_enc.c b/lib_enc/ari_enc.c index 8646c79b9de44bf473205a0c04dddaf241b40092..e6132980916e6d4b0e7815a6d7eec57faea02d99 100644 --- a/lib_enc/ari_enc.c +++ b/lib_enc/ari_enc.c @@ -321,7 +321,7 @@ int16_t ari_encode_14bits_ext( * * Encode an cumulative frequency interval. *-------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED int16_t ari_encode_14bits_range( int16_t *ptr, int16_t bp, @@ -397,7 +397,7 @@ int16_t ari_encode_14bits_range( return bp; } - +#endif /*------------------------------------------------------------------------ * Function: ari_encode_14bits_sign() * @@ -563,7 +563,7 @@ int16_t ari_encode_14bits_sign( * * Finish up encoding in CBR mode. *-------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED int16_t ari_done_cbr_encoding_14bits( int16_t *ptr, int16_t bp, @@ -643,3 +643,4 @@ int16_t ari_done_cbr_encoding_14bits( return bp; } +#endif diff --git a/lib_enc/ari_hm_enc.c b/lib_enc/ari_hm_enc.c index 838ae078902acd5e6a829eabe99fad82677c7893..8dadbd61de83425acc64f79a509ae63cde0e134c 100644 --- a/lib_enc/ari_hm_enc.c +++ b/lib_enc/ari_hm_enc.c @@ -51,7 +51,7 @@ * * *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED int16_t EncodeIndex( const int16_t Bandwidth, int16_t PeriodicityIndex, @@ -74,7 +74,6 @@ int16_t EncodeIndex( } } - /*-------------------------------------------------------------------* * GetWeight() * @@ -616,3 +615,4 @@ void tcx_hm_analyse( return; } +#endif diff --git a/lib_enc/arith_coder_enc.c b/lib_enc/arith_coder_enc.c index 21d36d21727a036ac45c587a0950936414cd6270..42abaf867b72a5f63d840a02dd01a4612ae770c6 100644 --- a/lib_enc/arith_coder_enc.c +++ b/lib_enc/arith_coder_enc.c @@ -51,7 +51,7 @@ /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED #define kMaxNumHeapElems 10 typedef struct HeapElem @@ -66,7 +66,6 @@ typedef struct Heap } Heap; -#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * tcx_arith_estimate_scale() * diff --git a/lib_enc/avq_cod.c b/lib_enc/avq_cod.c index ac88560f5e8b9f7cfdec9ba5fe9e7f10adbdab28..b97e2496c3f29745f5db6e14f94a1f6ee9fe57b5 100644 --- a/lib_enc/avq_cod.c +++ b/lib_enc/avq_cod.c @@ -40,7 +40,7 @@ #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Local prototypes *-------------------------------------------------------------------*/ @@ -594,3 +594,4 @@ static void wrte_cv( *nbits = bits; return; } +#endif diff --git a/lib_enc/bass_psfilter_enc.c b/lib_enc/bass_psfilter_enc.c index 60f1cf028e98802235ea42767c4826c52d4820fc..2458a5979494eb56e30b0e1c64bdaa7729899a79 100644 --- a/lib_enc/bass_psfilter_enc.c +++ b/lib_enc/bass_psfilter_enc.c @@ -41,7 +41,7 @@ #include "rom_com.h" #include "wmc_auto.h" - +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * bass_pf_enc() * @@ -255,3 +255,4 @@ float bass_pf_enc( return ( snr ); } +#endif diff --git a/lib_enc/cod2t32.c b/lib_enc/cod2t32.c index 35379385445da22f2deb53b72560d3015cda560d..60a3d541a9ca0c7e24eb6449fb5003ecd834c9f1 100644 --- a/lib_enc/cod2t32.c +++ b/lib_enc/cod2t32.c @@ -39,7 +39,7 @@ #include "cnst.h" #include "prot.h" #include "wmc_auto.h" - +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * Local constants *---------------------------------------------------------------------*/ @@ -343,3 +343,4 @@ void acelp_1t64( return; } +#endif diff --git a/lib_enc/cod4t64.c b/lib_enc/cod4t64.c index 5c609ad9dffef491947d8adb19216ba9cae90334..3fc92925a0d836a14597bcccae8ed95e11f4760d 100644 --- a/lib_enc/cod4t64.c +++ b/lib_enc/cod4t64.c @@ -53,13 +53,12 @@ static int16_t quant_3p_3N1( const int16_t pos1, const int16_t pos2, const int16 static int32_t quant_4p_4N( const int16_t pos[], const int16_t N ); static int32_t quant_5p_5N( const int16_t pos[], const int16_t N ); static int32_t quant_6p_6N_2( const int16_t pos[], const int16_t N ); -#endif + static int16_t pre_process( const float v[], int16_t pos_vector[], int16_t pos_vector_num[], int16_t *pulse_pos_num ); static int32_t fcb_encode_position( const int16_t pos_vector[], int16_t n, const int16_t pos_num, const int16_t flag ); static int32_t fcb_encode_class( const int16_t buffer[], const int16_t pulse_num, const int16_t pos_num ); static int32_t fcb_encode_PI( const float v[], const int16_t pulse_num ); - /*---------------------------------------------------------------------* * ACELP_4t64() * @@ -80,7 +79,6 @@ static int32_t fcb_encode_PI( const float v[], const int16_t pulse_num ); * Each pulse can have sixteen (16) possible positions. *---------------------------------------------------------------------*/ -#ifndef IVAS_FLOAT_FIXED int16_t acelp_4t64( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ float dn[], /* i : corr. between target and h[]. */ @@ -435,11 +433,10 @@ static int16_t quant_1p_N1( return index; } - /*---------------------------------------------------------------------* * Quantization of 2 pulses with 2*N+1 bits: * *---------------------------------------------------------------------*/ -#endif + /*! r: return (2*N)+1 bits */ int16_t quant_2p_2N1( @@ -497,7 +494,7 @@ int16_t quant_2p_2N1( return index; } - +#endif #ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * Quantization of 3 pulses with 3*N+1 bits: * @@ -772,7 +769,7 @@ static int32_t quant_6p_6N_2( return ( index ); } -#endif + /*---------------------------------------------------------------------* *order the pulse position * @@ -1021,3 +1018,4 @@ int16_t E_ACELP_code43bit( return saved_bits; } +#endif diff --git a/lib_enc/cod4t64_fast.c b/lib_enc/cod4t64_fast.c index 3b68230f55fcb8f84a8b9d2973c399d7cf33db7c..2af4510a8b213375f40ff0dc28fc7c542ec599d5 100644 --- a/lib_enc/cod4t64_fast.c +++ b/lib_enc/cod4t64_fast.c @@ -101,6 +101,7 @@ static Word16 quant_1p_N1_L_subfr( return index; } #endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Function find_best_pulse() * @@ -135,7 +136,7 @@ static int16_t find_best_pulse( return m; } - +#endif static Word16 find_best_pulse_fx( const Word16 L_subfr, const Word16 nb_tracks, @@ -170,7 +171,7 @@ static Word16 find_best_pulse_fx( return m; } - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Function acelp_fast() * @@ -809,7 +810,7 @@ void acelp_fast( return; } - +#endif /*-------------------------------------------------------------------* * Function acelp_fast() * @@ -1693,7 +1694,7 @@ void acelp_fast_fx( j = i_mult( q, NPMAXPT ); IF( EQ_16( q, skip_track_max ) ) { - idx = quant_2p_2N1( ind_stream[j], ind_stream[j + 1], bits_track ); + idx = quant_2p_2N1_fx( ind_stream[j], ind_stream[j + 1], bits_track ); push_indice( hBstr, IND_ALG_CDBK_4T64, idx, add( shl( bits_track, 1 ), 1 ) ); } ELSE diff --git a/lib_enc/cod4t64_fx.c b/lib_enc/cod4t64_fx.c index 19b195615230f2ac42adf0b1c94ee35265f8c7a1..92db2139b7b4c08b412056294c6f194875c646fc 100644 --- a/lib_enc/cod4t64_fx.c +++ b/lib_enc/cod4t64_fx.c @@ -24,7 +24,6 @@ * Local function prototypes *-------------------------------------------------------------------*/ static Word16 quant_1p_N1_fx( const Word16 pos, const Word16 N ); -static Word16 quant_2p_2N1_fx( const Word16 pos1, const Word16 pos2, const Word16 N ); static Word16 quant_3p_3N1_fx( const Word16 pos1, const Word16 pos2, const Word16 pos3, const Word16 N ); static Word32 quant_4p_4N_fx( const Word16 pos[], const Word16 N ); static Word32 quant_5p_5N_fx( const Word16 pos[], const Word16 N ); @@ -1053,10 +1052,10 @@ static Word16 quant_1p_N1_fx( /* o : return N+1 bits * * Quantization of 2 pulses with 2*N+1 bits: *-------------------------------------------------------------*/ -static Word16 quant_2p_2N1_fx( /* o: return (2*N)+1 bits */ - const Word16 pos1, /* i: position of the pulse 1 */ - const Word16 pos2, /* i: position of the pulse 2 */ - const Word16 N /* i: number of bits FOR position */ +Word16 quant_2p_2N1_fx( /* o: return (2*N)+1 bits */ + const Word16 pos1, /* i: position of the pulse 1 */ + const Word16 pos2, /* i: position of the pulse 2 */ + const Word16 N /* i: number of bits FOR position */ ) { Word16 mask, tmp; diff --git a/lib_enc/cod_uv.c b/lib_enc/cod_uv.c index 2e07e89bed831695b20dd4339f9777e89c574d67..01bd16c6541be4daa3858b60f6c0b986b18fecf2 100644 --- a/lib_enc/cod_uv.c +++ b/lib_enc/cod_uv.c @@ -38,7 +38,7 @@ #include "options.h" #include "prot.h" #include "wmc_auto.h" - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * gauss_L2: * @@ -88,3 +88,4 @@ void gauss_L2( return; } +#endif diff --git a/lib_enc/cor_shif.c b/lib_enc/cor_shif.c index cc5bb50a651c36a98d8cf82042b57efa3bdf703a..2946cd0fa28ee2ebdb042dfd077dce81910d5030 100644 --- a/lib_enc/cor_shif.c +++ b/lib_enc/cor_shif.c @@ -39,7 +39,7 @@ #include #include "prot.h" #include "wmc_auto.h" - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Correlation_shift * @@ -70,3 +70,4 @@ float correlation_shift( } return corr_shift; } +#endif diff --git a/lib_enc/core_enc_updt.c b/lib_enc/core_enc_updt.c index 4c525bd6dae00994f29794a202cc1404e3df7d5f..03c64249264d6e55715702219362eb0444a6b2d0 100644 --- a/lib_enc/core_enc_updt.c +++ b/lib_enc/core_enc_updt.c @@ -93,11 +93,7 @@ void core_encode_update( } } -#ifdef NON_BE_1055_RESET_LP_MEMORIES if ( ( st->Opt_DTX_ON && st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && ( st->codec_mode == MODE2 || st->element_mode > EVS_MONO ) ) ) -#else - if ( ( st->Opt_DTX_ON && st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && st->codec_mode == MODE2 ) ) -#endif { /* reset LP memories */ set_zero( st->mem_MA, M ); @@ -160,15 +156,11 @@ void core_encode_update_ivas_fx( } } -#ifdef NON_BE_1055_RESET_LP_MEMORIES test(); test(); test(); test(); IF( ( st->Opt_DTX_ON && LE_32( st->core_brate, SID_2k40 ) && EQ_16( st->cng_type, FD_CNG ) ) || ( st->tcxonly && ( EQ_16( st->codec_mode, MODE2 ) || GT_16( st->element_mode, EVS_MONO ) ) ) ) -#else - if ( ( st->Opt_DTX_ON && st->core_brate <= SID_2k40 && st->cng_type == FD_CNG ) || ( st->tcxonly && st->codec_mode == MODE2 ) ) -#endif { /* reset LP memories */ set16_fx( st->mem_MA_fx, 0, M ); diff --git a/lib_enc/core_switching_enc.c b/lib_enc/core_switching_enc.c index d3820e677eac0020faa3f0d80e5c5b8d089c3b0b..f1d9bbf4473ab8ca1b98ef0b7f43a36e61acef48 100644 --- a/lib_enc/core_switching_enc.c +++ b/lib_enc/core_switching_enc.c @@ -48,7 +48,7 @@ #include "ivas_prot_fx.h" #endif - +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * core_switching_pre_enc() * @@ -454,6 +454,7 @@ void core_switching_pre_enc( return; } +#endif #ifdef IVAS_FLOAT_FIXED void core_switching_pre_enc_ivas_fx( Encoder_State *st_fx, /* i/o: encoder state structure */ @@ -1080,7 +1081,7 @@ void core_switching_post_enc_ivas_fx( return; } #endif - +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * core_switching_hq_prepare_enc() * @@ -1198,3 +1199,4 @@ void core_switching_hq_prepare_enc( return; } +#endif diff --git a/lib_enc/corr_xh.c b/lib_enc/corr_xh.c index 983cd736133318ac936e5bb32a37dd5c9855c9a0..cb17bcf9206780b2d5d159c7e64ca10e677ebd52 100644 --- a/lib_enc/corr_xh.c +++ b/lib_enc/corr_xh.c @@ -39,7 +39,7 @@ #include "prot.h" #include "cnst.h" #include "wmc_auto.h" - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * corr_xh() * @@ -72,3 +72,4 @@ void corr_xh( return; } +#endif diff --git a/lib_enc/enc_acelp.c b/lib_enc/enc_acelp.c index e2eff084b2345a4419e4149fead24aea3eb15bba..9f4f9d81fd3729376937d7f239133d7d7ddddff0 100644 --- a/lib_enc/enc_acelp.c +++ b/lib_enc/enc_acelp.c @@ -34,6 +34,7 @@ EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0 ====================================================================================*/ + #include #include #include "options.h" @@ -42,8 +43,7 @@ #include "rom_com.h" #include "rom_enc.h" #include "wmc_auto.h" - - +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * Local function prototypes *---------------------------------------------------------------------*/ @@ -74,7 +74,7 @@ static void E_ACELP_codearithp( const float v[], uint32_t *n, uint32_t *ps, int1 * Returns: * void */ -#ifndef IVAS_FLOAT_FIXED + static void acelp_h_vec_corr1( float h[], float vec[], @@ -328,7 +328,7 @@ static void E_ACELP_1pulse_search( } #endif - +#ifndef IVAS_FLOAT_FIXED /* * acelp_pulsesign * @@ -422,8 +422,6 @@ void acelp_findcandidates( return; } - -#ifndef IVAS_FLOAT_FIXED static void acelp_hbuf( float *h_buf, float **h, @@ -1013,7 +1011,6 @@ void E_ACELP_4tsearch( return; } -#endif /* @@ -1051,7 +1048,6 @@ void E_ACELP_4tsearch( * void */ -#ifndef IVAS_FLOAT_FIXED void E_ACELP_4t( float dn[], float cn[], @@ -1097,7 +1093,6 @@ void E_ACELP_4t( return; } -#endif int16_t E_ACELP_indexing( @@ -1230,8 +1225,6 @@ int16_t E_ACELP_indexing( return ( saved_bits ); } - -#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * E_ACELP_innovative_codebook * @@ -1328,7 +1321,6 @@ void E_ACELP_innovative_codebook( return; } -#endif /*--------------------------------------------------------------------------* @@ -1527,3 +1519,4 @@ void fcb_pulse_track_joint( return; } +#endif diff --git a/lib_enc/enc_gain.c b/lib_enc/enc_gain.c index e91c271d4a52643bc697f94b82fd1c30a26b4bc6..37ef9d3bdfe0bfdd91a7fed3b106e02a7c4fc328 100644 --- a/lib_enc/enc_gain.c +++ b/lib_enc/enc_gain.c @@ -42,7 +42,7 @@ #include "rom_com.h" #include "wmc_auto.h" - +#ifndef IVAS_FLOAT_FIXED /* * E_GAIN_norm_corr_interpolate * @@ -56,6 +56,7 @@ * Returns: * interpolated value */ +#ifndef IVAS_FLOAT_FIXED static float E_GAIN_norm_corr_interpolate( float *x, int16_t frac ) @@ -105,6 +106,7 @@ static float E_GAIN_norm_corr_interpolate6( return s; } +#endif /* * E_GAIN_closed_loop_search @@ -268,3 +270,4 @@ int16_t E_GAIN_closed_loop_search( return ( t0 ); } +#endif diff --git a/lib_enc/eval_pit_contr_fx.c b/lib_enc/eval_pit_contr_fx.c index f557f65bd8a4c01ada4c21243009accadad89111..a438b79a69d7c00f4014be221038ba6ef65b1921 100644 --- a/lib_enc/eval_pit_contr_fx.c +++ b/lib_enc/eval_pit_contr_fx.c @@ -765,7 +765,7 @@ Word16 Pit_exc_contribution_len_ivas_fx( /* o : bin wher { delete_indice( hBstr, i ); } - delete_indice( hBstr, i ); + delete_indice( hBstr, IND_ES_PRED ); } IF( LT_32( st_fx->core_brate, CFREQ_BITRATE ) ) { diff --git a/lib_enc/fd_cng_enc.c b/lib_enc/fd_cng_enc.c index 3af2bd9f363ca7a5947b050a1fbde8f5a9bb5b0b..204e807b483e406d5a056f8835a14510925d0a79 100644 --- a/lib_enc/fd_cng_enc.c +++ b/lib_enc/fd_cng_enc.c @@ -128,7 +128,6 @@ void initFdCngEnc( return; } -#endif /*-------------------------------------------------------------------* * configureFdCngEnc() @@ -217,34 +216,14 @@ void configureFdCngEnc( switch ( hsCom->fftlen ) { case 512: -#ifndef IVAS_FLOAT_FIXED hsCom->fftSineTab_flt = NULL; hsCom->olapWinAna_flt = olapWinAna512; hsCom->olapWinSyn_flt = olapWinSyn256; -#else - hsCom->fftSineTab_fx = NULL; - hsCom->olapWinAna_fx = olapWinAna512_fx; - hsCom->olapWinSyn_fx = olapWinSyn256_fx; - hsCom->fftlenShift = 8; - move16(); - hsCom->fftlenFac = 32767 /*1.0 Q15*/; - move16(); -#endif break; case 640: -#ifndef IVAS_FLOAT_FIXED hsCom->fftSineTab_flt = fftSineTab640; hsCom->olapWinAna_flt = olapWinAna640; hsCom->olapWinSyn_flt = olapWinSyn320; -#else - hsCom->fftSineTab_fx = fftSineTab640_fx; - hsCom->olapWinAna_fx = olapWinAna640_fx; - hsCom->olapWinSyn_fx = olapWinSyn320_fx; - hsCom->fftlenShift = 9; - move16(); - hsCom->fftlenFac = 20480 /*0.625 Q15*/; - move16(); -#endif break; default: assert( !"Unsupported FFT length for FD-based CNG" ); @@ -254,6 +233,7 @@ void configureFdCngEnc( return; } +#endif /*-------------------------------------------------------------------* * deleteFdCngEnc() diff --git a/lib_enc/gs_enc.c b/lib_enc/gs_enc.c index e53617798d0fc93d1e995de7024b083803f1d231..2bd0c49b1b3279dfb84bad2064d8a2c2c4d2ff8b 100644 --- a/lib_enc/gs_enc.c +++ b/lib_enc/gs_enc.c @@ -544,11 +544,7 @@ void gsc_enc( } if ( concat_out[j] < 0 ) { -#ifdef FIX_1027_GSC_INT_OVERFLOW seed_init = (int16_t) ( (int32_t) seed_init + 3 ); -#else - seed_init += 3; -#endif } } diff --git a/lib_enc/gs_enc_fx.c b/lib_enc/gs_enc_fx.c index 6c7fc4d1f7ee54ebaf463fcd8d9d841b8eedbf0a..c09aa8b0a36b313ff2482b19a190957a5e001351 100644 --- a/lib_enc/gs_enc_fx.c +++ b/lib_enc/gs_enc_fx.c @@ -1200,11 +1200,7 @@ void gsc_enc_ivas_fx( } IF( concat_out_fx[j] < 0 ) { -#ifdef FIX_1027_GSC_INT_OVERFLOW seed_init = (Word16) L_add( seed_init, 3 ); -#else - seed_init += 3; -#endif move16(); } } diff --git a/lib_enc/igf_scf_enc.c b/lib_enc/igf_scf_enc.c index 00c17e1916ae179807eddaaa87d9e5b4861dcd4a..09e2ba1b77219a2e1d2509cd32d87559b10ee9aa 100644 --- a/lib_enc/igf_scf_enc.c +++ b/lib_enc/igf_scf_enc.c @@ -46,7 +46,7 @@ #include "prot_fx_enc.h" #endif // IVAS_FLOAT_FIXED - +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * IGFSCFEncoderOpen() * @@ -82,6 +82,7 @@ void IGFSCFEncoderOpen( return; } +#endif /*---------------------------------------------------------------------* @@ -90,22 +91,22 @@ void IGFSCFEncoderOpen( * *---------------------------------------------------------------------*/ -static int16_t quant_ctx( - const int16_t ctx ) +static Word16 quant_ctx( + const Word16 ctx ) { /* ctx ... -5 -4 -3 -2 -1 0 1 2 3 4 5 ... Q(ctx)... -3 -3 -3 -2 -1 0 1 2 3 3 3 ... */ - if ( abs( ctx ) <= 3 ) + IF( LE_16( abs_s( ctx ), 3 ) ) { return ctx; } - else if ( ctx > 3 ) + ELSE IF( GT_16( ctx, 3 ) ) { return 3; } - else /* ctx < -3 */ + ELSE /* ctx < -3 */ { return -3; } @@ -455,7 +456,7 @@ static void encode_sfe_vector( } #endif // IVAS_FLOAT_FIXED - +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * IGFSCFEncoderReset() * @@ -472,6 +473,7 @@ void IGFSCFEncoderReset( return; } +#endif /*---------------------------------------------------------------------* @@ -577,7 +579,7 @@ int16_t IGFSCFEncoderEncode( } #endif - +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * IGFSCFEncoderSaveContextState() * @@ -614,3 +616,4 @@ void IGFSCFEncoderRestoreContextState( return; } +#endif diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 97e17265f2a00815b02d0e70514ab1e37d752284..84b73c6c8fa77c43a51f658e2889d14a58ec466a 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -48,7 +48,7 @@ #include "ivas_prot_fx.h" #endif #include "prot_fx_enc.h" - +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------* * init_encoder() * @@ -1188,7 +1188,7 @@ ivas_error init_encoder( #endif st->totalNoise_increase_len = 0; - init_coder_ace_plus( st, st->last_total_brate, 0 /* initialization value */ ); + init_coder_ace_plus_ivas_fx( st, st->last_total_brate, 0 /* initialization value */ ); /*-----------------------------------------------------------------* * FD-CNG encoder @@ -1206,7 +1206,24 @@ ivas_error init_encoder( /* initialization for IVAS modes happens in first frame pre-processing */ if ( st->element_mode == EVS_MONO ) { +#ifdef IVAS_FLOAT_FIXED + Word32 total_brate; + + test(); + IF( st->rf_mode && EQ_32( st->total_brate, ACELP_13k20 ) ) + { + total_brate = ACELP_9k60; + move32(); + } + ELSE + { + total_brate = st->total_brate; + move32(); + } + configureFdCngEnc_ivas_fx( st->hFdCngEnc, st->bwidth, total_brate ); +#else configureFdCngEnc( st->hFdCngEnc, st->bwidth, st->rf_mode && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate ); +#endif } } else @@ -1269,6 +1286,7 @@ ivas_error init_encoder( #endif return error; } +#endif #ifdef IVAS_FLOAT_FIXED ivas_error init_encoder_ivas_fx( Encoder_State *st, /* i/o: state structure */ @@ -2386,10 +2404,7 @@ ivas_error init_encoder_ivas_fx( move32(); } - configureFdCngEnc_fx( st->hFdCngEnc, st->bwidth, total_brate ); -#if 1 - configureFdCngEnc( st->hFdCngEnc, st->bwidth, st->rf_mode && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate ); -#endif + configureFdCngEnc_ivas_fx( st->hFdCngEnc, st->bwidth, total_brate ); } } ELSE diff --git a/lib_enc/ivas_agc_enc.c b/lib_enc/ivas_agc_enc.c index 17bc8c2fee5696448147dd45a7116e832c1327db..f13a8ba89bcbdbe1c089f310faecedafb9ce65ec 100644 --- a/lib_enc/ivas_agc_enc.c +++ b/lib_enc/ivas_agc_enc.c @@ -48,11 +48,12 @@ * Local constants *------------------------------------------------------------------------------------------*/ -#define AGC_MIN_DELTA ( 4.656612873077393e-10f ) /*2^-31*/ #ifdef IVAS_FLOAT_FIXED #define AGC_MIN_DELTA_FX 1 // q31 #define TWO_IN_Q29 1073741824 #define ONE_MINUS_M_DELTA_PROD_FLT_FC 1073741824 // Q15 +#else +#define AGC_MIN_DELTA ( 4.656612873077393e-10f ) /*2^-31*/ #endif #ifdef IVAS_FLOAT_FIXED @@ -63,18 +64,17 @@ static Word16 ceil_fx( Word16 inp, Word16 Q ) { Word16 ret; Word32 ret_32; - IF( GT_16( inp, 0 ) ) + IF( inp > 0 ) { IF( EQ_16( Q, 15 ) ) { - ret = 1; - return ret; + return 1; } ELSE { ret_32 = L_add( inp, sub( shl( 1, Q ), 1 ) ); //(inp+(pow(2,q)-1))/pow(2,q)// ret_32 = L_shr( ret_32, Q ); - return (Word16) ( ret_32 ); + return extract_l( ret_32 ); } } ELSE @@ -108,16 +108,16 @@ Word16 BASOP_Util_Cmp_Mant32Exp_sat /*!< o: flag: result of comparison */ /* Check, if both mantissa and exponents are identical, when normalized: return 0 */ shift = norm_l( a_m ); - if ( shift ) - a_m = L_shl( a_m, shift ); - if ( shift ) - a_e = sub( a_e, shift ); + IF( shift ) + a_m = L_shl( a_m, shift ); + IF( shift ) + a_e = sub( a_e, shift ); shift = norm_l( b_m ); - if ( shift ) - b_m = L_shl( b_m, shift ); - if ( shift ) - b_e = sub( b_e, shift ); + IF( shift ) + b_m = L_shl( b_m, shift ); + IF( shift ) + b_e = sub( b_e, shift ); /* align exponent, if any mantissa is zero */ if ( !a_m ) @@ -143,7 +143,8 @@ Word16 BASOP_Util_Cmp_Mant32Exp_sat /*!< o: flag: result of comparison */ } /* Check sign, exponent and mantissa to identify, whether a is greater b or not */ - result = sub( 0, 1 ); + result = -1; // sub( 0, 1 ); + move16(); IF( a_m >= 0 ) { @@ -185,7 +186,7 @@ Word32 pow32_fx( Word16 inp, Word16 indx ) { return L_deposit_h( inp ); } - ELSE IF( EQ_16( indx, 0 ) ) + ELSE IF( indx == 0 ) { return ONE_IN_Q31; } @@ -193,7 +194,8 @@ Word32 pow32_fx( Word16 inp, Word16 indx ) { temp_1 = L_mult( inp, inp ); // Q31 temp_2 = temp_1; - FOR( int i = 0; i < ( shr( indx, 1 ) ); i++ ) + move32(); + FOR( Word16 i = 0; i < ( indx >> 1 ); i++ ) { temp_1 = Mpy_32_32( temp_1, temp_1 ); // Q31 } @@ -235,8 +237,13 @@ Word16 ivas_agc_enc_get_flag( Word16 agc_flag; /* AGC is enabled only if there is one transport channel. */ - agc_flag = (Word16) ( nchan_transport == 1 ); - + agc_flag = 0; + move16(); + if ( EQ_16( nchan_transport, 1 ) ) + { + agc_flag = 1; + move16(); + } return agc_flag; } @@ -302,33 +309,49 @@ static void ivas_agc_enc_init_fx( ivas_agc_chan_data_t *ptr = hAgcEnc->gain_data; hAgcEnc->agc_com.in_delay = delay; + move16(); hAgcEnc->agc_com.num_coeff = FOA_CHANNELS; + move16(); ivas_agc_calcGainParams_fx( &hAgcEnc->agc_com.absEmin, &hAgcEnc->agc_com.betaE, &hAgcEnc->agc_com.maxAttExp, hAgcEnc->agc_com.num_coeff ); - ivas_agc_initWindowFunc_fx( hAgcEnc->agc_com.winFunc_fx, input_frame - hAgcEnc->agc_com.in_delay ); + ivas_agc_initWindowFunc_fx( hAgcEnc->agc_com.winFunc_fx, sub( input_frame, hAgcEnc->agc_com.in_delay ) ); hAgcEnc->minDelta_fx = AGC_MIN_DELTA_FX; + move32(); hAgcEnc->smFact_fx = 214748368; // q31 + move32(); - for ( i = 0; i < nchan_inp; i++ ) + FOR( i = 0; i < nchan_inp; i++ ) { /* gain_state */ ptrG->lastExp = 0; + move16(); ptrG->prevExp = 0; + move16(); ptrG->lastGain_fx = ONE_IN_Q31; + move32(); ptrG->q_lastGain_fx = Q31; + move16(); ptrG->lastMaxAbs_fx = 0; + move32(); ptrG->q_lastMaxAbs_fx = Q31; + move16(); ptrG->gainExpVal = 0; + move16(); ptrG->MaxAbsVal_del_fx = 0; + move32(); ptrG->q_MaxAbsVal_del_fx = Q31; + move16(); ptrG->MaxAbsValIdx_del = 0; + move32(); ptrG++; /* gain_data */ ptr->absGainExp = hAgcEnc->agc_com.absEmin; + move16(); ptr->absGainExpCurr = hAgcEnc->agc_com.absEmin; + move16(); ptr++; } @@ -397,7 +420,7 @@ ivas_error ivas_spar_agc_enc_open_fx( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR AGC encoder" ); } - input_frame = (Word16) Mpy_32_16_1( input_Fs, INV_FRAME_PER_SEC_Q15 ); + input_frame = extract_l( Mpy_32_16_1( input_Fs, INV_FRAME_PER_SEC_Q15 ) ); delay = NS2SA_FX2( input_Fs, ( IVAS_ENC_DELAY_NS + IVAS_DEC_DELAY_NS ) ); IF( ( hAgc->agc_com.winFunc_fx = (Word16 *) malloc( sizeof( Word16 ) * ( input_frame - delay ) ) ) == NULL ) @@ -740,103 +763,138 @@ void ivas_agc_enc_process_fx( Word16 i, j, idx, input_frame, offset; Word16 per_ch_bit[FOA_CHANNELS], AGC_flag; Word16 extendedExpVal = FALSE; + move16(); Word16 isGainAdjusted; Word16 q_predMaxAbsVal, q_MaxAbsVal; ivas_agc_enc_state_t *pState = hAgcEnc; - input_frame = (Word16) Mpy_32_16_1( hEncoderConfig->input_Fs, INV_FRAME_PER_SEC_Q15 ); - offset = input_frame - pState->agc_com.in_delay; + input_frame = extract_l( Mpy_32_16_1( hEncoderConfig->input_Fs, INV_FRAME_PER_SEC_Q15 ) ); + offset = sub( input_frame, pState->agc_com.in_delay ); AGC_flag = 0; + move16(); FOR( i = 0; i < n_channels; i++ ) { Word16 q_pcm = q_ppPcm[i]; + move16(); Word32 sampleAbsVal; Word16 isClipped = FALSE; + move16(); Word16 clippedIdx = 0; + move16(); Word16 MaxAbsValIdx = 0; + move16(); Word16 q_sampleAbsVal, gain_norm; Word32 MaxAbsVal = pState->gain_state[i].MaxAbsVal_del_fx; + move32(); Word32 predMaxAbsVal = L_abs( ppPcm_in[i][offset] ); q_predMaxAbsVal = q_ppPcm[i]; + move16(); q_MaxAbsVal = pState->gain_state[i].q_MaxAbsVal_del_fx; + move16(); - IF( LT_16( pState->gain_state[i].q_lastGain_fx, 31 ) ) + IF( LT_16( pState->gain_state[i].q_lastGain_fx, Q31 ) ) { gain_norm = norm_l( L_abs( pState->gain_state[i].lastGain_fx ) ); pState->gain_state[i].lastGain_fx = L_shl( pState->gain_state[i].lastGain_fx, gain_norm ); - pState->gain_state[i].q_lastGain_fx = pState->gain_state[i].q_lastGain_fx + gain_norm; + move32(); + pState->gain_state[i].q_lastGain_fx = add( pState->gain_state[i].q_lastGain_fx, gain_norm ); + move16(); } FOR( j = 0; j < input_frame; j++ ) { sampleAbsVal = L_abs( ppPcm_in[i][j] ); q_sampleAbsVal = q_ppPcm[i]; + move16(); - IF( EQ_16( ( BASOP_Util_Cmp_Mant32Exp_sat( sampleAbsVal, 31 - q_sampleAbsVal, MaxAbsVal, 31 - q_MaxAbsVal ) ), 1 ) ) + IF( EQ_16( BASOP_Util_Cmp_Mant32Exp_sat( sampleAbsVal, sub( Q31, q_sampleAbsVal ), MaxAbsVal, sub( Q31, q_MaxAbsVal ) ), 1 ) ) { MaxAbsVal = sampleAbsVal; + move32(); q_MaxAbsVal = q_sampleAbsVal; + move16(); MaxAbsValIdx = j; + move16(); } IF( GT_16( j, offset ) ) { - IF( EQ_16( ( BASOP_Util_Cmp_Mant32Exp_sat( sampleAbsVal, 31 - q_sampleAbsVal, predMaxAbsVal, 31 - q_predMaxAbsVal ) ), 1 ) ) + IF( EQ_16( BASOP_Util_Cmp_Mant32Exp_sat( sampleAbsVal, sub( Q31, q_sampleAbsVal ), predMaxAbsVal, sub( Q31, q_predMaxAbsVal ) ), 1 ) ) { predMaxAbsVal = sampleAbsVal; + move32(); q_predMaxAbsVal = q_sampleAbsVal; + move16(); } } ppPcm_out[i][j] = Mpy_32_32( ppPcm_in[i][j], pState->gain_state[i].lastGain_fx ); - q_pcm = q_ppPcm[i] + ( pState->gain_state[i].q_lastGain_fx ) - 31; + move32(); + q_pcm = add( q_ppPcm[i], sub( pState->gain_state[i].q_lastGain_fx, Q31 ) ); IF( !isClipped ) { Word16 comp_flag_1 = 0; - comp_flag_1 = BASOP_Util_Cmp_Mant32Exp_sat( ppPcm_in[i][j], ( 31 - q_pcm ), ONE_MINUS_M_DELTA_PROD_FLT_FC, 16 ); + move16(); + comp_flag_1 = BASOP_Util_Cmp_Mant32Exp_sat( ppPcm_in[i][j], sub( Q31, q_pcm ), ONE_MINUS_M_DELTA_PROD_FLT_FC, Q16 ); IF( EQ_16( comp_flag_1, 1 ) ) { comp_flag_1 = 1; + move16(); } ELSE { comp_flag_1 = 0; + move16(); } - Word16 comp_flag_2 = BASOP_Util_Cmp_Mant32Exp_sat( MIN16B_FLT_FX_IN_Q15, 16, ppPcm_in[i][j], ( 31 - q_pcm ) ); + Word16 comp_flag_2 = BASOP_Util_Cmp_Mant32Exp_sat( MIN16B_FLT_FX_IN_Q15, Q16, ppPcm_in[i][j], sub( Q31, q_pcm ) ); IF( EQ_16( comp_flag_2, 1 ) ) { comp_flag_2 = 1; + move16(); } ELSE { comp_flag_2 = 0; + move16(); } + test(); IF( ( comp_flag_1 ) || ( comp_flag_2 ) ) { clippedIdx = j; + move16(); isClipped = TRUE; + move16(); } } } pState->gain_state[i].MaxAbsVal_del_fx = predMaxAbsVal; + move32(); pState->gain_state[i].q_MaxAbsVal_del_fx = q_predMaxAbsVal; + move16(); isGainAdjusted = FALSE; + move16(); IF( !isClipped ) { // CHECK THIS PART AGAIN MaxAbsVal < FLT_MIN Word16 flag = 0; - IF( LE_32( MaxAbsVal, 0 ) ) + move16(); + if ( MaxAbsVal <= 0 ) { flag = 1; + move16(); } - IF( ( EQ_16( pState->gain_state[i].lastExp, 0 ) ) || ( flag ) ) + test(); + IF( ( pState->gain_state[i].lastExp == 0 ) || ( flag ) ) { pState->gain_state[i].gainExpVal = 0; + move16(); pState->gain_state[i].prevExp = pState->gain_state[i].lastExp; + move16(); isGainAdjusted = TRUE; + move16(); } ELSE { @@ -847,84 +905,100 @@ void ivas_agc_enc_process_fx( temp1 = Mpy_32_32( pState->smFact_fx, MaxAbsVal ); // q_MaxAbsVal temp2 = Mpy_32_32( ( L_sub( ONE_IN_Q31, pState->smFact_fx ) ), pState->gain_state[i].lastMaxAbs_fx ); // q_lastMaxAbs_fx - smoothedMaxAbsVal = BASOP_Util_Add_Mant32Exp( temp1, ( 31 - q_MaxAbsVal ), temp2, ( 31 - pState->gain_state[i].q_lastMaxAbs_fx ), &e_result ); - q_smoothedMaxAbsVal = 31 - e_result; + smoothedMaxAbsVal = BASOP_Util_Add_Mant32Exp( temp1, sub( Q31, q_MaxAbsVal ), temp2, sub( Q31, pState->gain_state[i].q_lastMaxAbs_fx ), &e_result ); + q_smoothedMaxAbsVal = sub( Q31, e_result ); pState->gain_state[i].lastMaxAbs_fx = smoothedMaxAbsVal; + move32(); pState->gain_state[i].q_lastMaxAbs_fx = q_smoothedMaxAbsVal; + move16(); - Comp_flag = BASOP_Util_Cmp_Mant32Exp_sat( smoothedMaxAbsVal, 31 - q_smoothedMaxAbsVal, MaxAbsVal, 31 - q_MaxAbsVal ); + Comp_flag = BASOP_Util_Cmp_Mant32Exp_sat( smoothedMaxAbsVal, sub( Q31, q_smoothedMaxAbsVal ), MaxAbsVal, sub( Q31, q_MaxAbsVal ) ); IF( EQ_16( Comp_flag, 1 ) ) { temp1 = smoothedMaxAbsVal; + move32(); q_temp = q_smoothedMaxAbsVal; + move16(); } ELSE { temp1 = MaxAbsVal; + move32(); q_temp = q_MaxAbsVal; + move16(); } temp1 = Mpy_32_32( temp1, TWO_IN_Q29 ); - q_temp = q_temp + 29 - 31; + q_temp = add( q_temp, Q29 - Q31 ); maxGain = Mpy_32_32( temp1, pState->gain_state[i].lastGain_fx ); - q_maxGain = q_temp + ( pState->gain_state[i].q_lastGain_fx ) - 31; + q_maxGain = add( q_temp, sub( pState->gain_state[i].q_lastGain_fx, Q31 ) ); temp2 = ONE_MINUS_M_DELTA_PROD_FLT_FC; // Q15 - Comp_flag = BASOP_Util_Cmp_Mant32Exp_sat( temp2, 16, maxGain, 31 - q_maxGain ); + move16(); + Comp_flag = BASOP_Util_Cmp_Mant32Exp_sat( temp2, Q16, maxGain, sub( Q31, q_maxGain ) ); IF( EQ_16( Comp_flag, 1 ) ) { pState->gain_state[i].gainExpVal = -1; + move16(); } ELSE { pState->gain_state[i].gainExpVal = 0; + move16(); } } } ELSE { pState->gain_state[i].lastMaxAbs_fx = MaxAbsVal; + move32(); pState->gain_state[i].q_lastMaxAbs_fx = q_MaxAbsVal; + move16(); } IF( !isGainAdjusted ) { Word32 actualMaxAbsVal = 0; + move16(); Word16 currMaxAttExp, q_actualMaxAbsVal; - currMaxAttExp = min( ( add( pState->gain_state[i].lastExp, pState->agc_com.absEmin ) ), pState->agc_com.maxAttExp ); + currMaxAttExp = s_min( ( add( pState->gain_state[i].lastExp, pState->agc_com.absEmin ) ), pState->agc_com.maxAttExp ); extendedExpVal = FALSE; + move16(); IF( isClipped ) { Word16 isCompensated = FALSE; Word32 temp1, temp2; actualMaxAbsVal = Mpy_32_32( pState->gain_state[i].lastMaxAbs_fx, pState->gain_state[i].lastGain_fx ); // QlastGain_fx - q_actualMaxAbsVal = pState->gain_state[i].q_lastMaxAbs_fx + ( pState->gain_state[i].q_lastGain_fx ) - 31; - idx = min( offset - 1, MaxAbsValIdx ); + q_actualMaxAbsVal = add( pState->gain_state[i].q_lastMaxAbs_fx, sub( pState->gain_state[i].q_lastGain_fx, Q31 ) ); + idx = s_min( sub( offset, 1 ), MaxAbsValIdx ); q_actualMaxAbsVal = add( q_actualMaxAbsVal, norm_l( actualMaxAbsVal ) ); temp1 = L_shl( actualMaxAbsVal, norm_l( actualMaxAbsVal ) ); temp1 = BASOP_Util_Log2( temp1 ); // Q25 - temp1 = L_add( temp1, L_shl( ( Q31 - q_actualMaxAbsVal ), 25 ) ); // Q25 + temp1 = L_add( temp1, L_shl( sub( Q31, q_actualMaxAbsVal ), 25 ) ); // Q25 temp1 = L_negate( L_add( temp1, LOG2_MDFT_NORM_SCALING_FX ) ); // Q25 temp2 = BASOP_Util_Log2( L_deposit_h( pState->agc_com.winFunc_fx[idx] ) ); // Q25 Word16 temp_16, div_e; - IF( EQ_32( temp2, 0 ) ) + IF( temp2 == 0 ) { temp_16 = 0; + move16(); } ELSE { temp_16 = BASOP_Util_Divide3232_Scale( temp1, temp2, &div_e ); - IF( LT_16( div_e, 0 ) ) + IF( div_e < 0 ) { temp_16 = shr( temp_16, (Word16) abs( div_e ) ); div_e = 0; + move16(); } - temp_16 = ceil_fx( temp_16, 15 - div_e ); + temp_16 = ceil_fx( temp_16, sub( Q15, div_e ) ); } pState->gain_state[i].gainExpVal = temp_16; + move16(); WHILE( !isCompensated ) { @@ -932,17 +1006,21 @@ void ivas_agc_enc_process_fx( Word16 q_tmpSignal; isCompensated = TRUE; Word16 tmp_1, q_tmp_2 = 31, e_div; + move16(); Word32 tmp_2 = ONE_IN_Q31; + move16(); tmp_1 = pState->gain_state[i].gainExpVal; + move16(); FOR( idx = clippedIdx; idx <= MaxAbsValIdx; idx++ ) { IF( GE_16( idx, offset ) ) { idx = MaxAbsValIdx; - IF( LT_16( tmp_1, 0 ) ) + move16(); + IF( tmp_1 < 0 ) { tmp_2 = pow32_fx( pState->agc_com.winFunc_fx[offset - 1], ( negate( tmp_1 ) ) ); - IF( LT_32( tmp_2, 0 ) ) + IF( tmp_2 < 0 ) { tmp_2 = L_deposit_h( BASOP_Util_Divide3232_Scale( ONE_IN_Q31, L_negate( tmp_2 ), &e_div ) ); tmp_2 = L_negate( tmp_2 ); @@ -951,20 +1029,21 @@ void ivas_agc_enc_process_fx( { tmp_2 = L_deposit_h( BASOP_Util_Divide3232_Scale( ONE_IN_Q31, tmp_2, &e_div ) ); } - q_tmp_2 = Q31 - e_div; + q_tmp_2 = sub( Q31, e_div ); } ELSE { tmp_2 = pow32_fx( pState->agc_com.winFunc_fx[offset - 1], tmp_1 ); q_tmp_2 = Q31; + move16(); } } ELSE { - IF( LT_16( tmp_1, 0 ) ) + IF( tmp_1 < 0 ) { tmp_2 = pow32_fx( pState->agc_com.winFunc_fx[idx], ( negate( tmp_1 ) ) ); - IF( LT_32( tmp_2, 0 ) ) + IF( tmp_2 < 0 ) { tmp_2 = L_deposit_h( BASOP_Util_Divide3232_Scale( ONE_IN_Q31, L_negate( tmp_2 ), &e_div ) ); tmp_2 = L_negate( tmp_2 ); @@ -973,51 +1052,60 @@ void ivas_agc_enc_process_fx( { tmp_2 = L_deposit_h( BASOP_Util_Divide3232_Scale( ONE_IN_Q31, tmp_2, &e_div ) ); } - q_tmp_2 = Q31 - e_div; + q_tmp_2 = sub( Q31, e_div ); } ELSE { tmp_2 = pow32_fx( pState->agc_com.winFunc_fx[idx], tmp_1 ); q_tmp_2 = Q31; + move16(); } } tmpSignal = Mpy_32_32( ppPcm_out[i][idx], tmp_2 ); - q_tmpSignal = q_pcm + (q_tmp_2) -31; + q_tmpSignal = add( q_pcm, sub( q_tmp_2, 31 ) ); - Word16 comp_flag_1 = BASOP_Util_Cmp_Mant32Exp_sat( tmpSignal, 31 - q_tmpSignal, ONE_MINUS_M_DELTA_PROD_FLT_FC, 16 ); + Word16 comp_flag_1 = BASOP_Util_Cmp_Mant32Exp_sat( tmpSignal, sub( Q31, q_tmpSignal ), ONE_MINUS_M_DELTA_PROD_FLT_FC, Q16 ); IF( EQ_16( comp_flag_1, 1 ) ) { comp_flag_1 = 1; + move16(); } ELSE { comp_flag_1 = 0; + move16(); } - Word16 comp_flag_2 = BASOP_Util_Cmp_Mant32Exp_sat( MIN16B_FLT_FX_IN_Q15, 16, tmpSignal, 31 - q_tmpSignal ); + Word16 comp_flag_2 = BASOP_Util_Cmp_Mant32Exp_sat( MIN16B_FLT_FX_IN_Q15, Q16, tmpSignal, sub( Q31, q_tmpSignal ) ); IF( EQ_16( comp_flag_2, 1 ) ) { comp_flag_2 = 1; + move16(); } ELSE { comp_flag_2 = 0; + move16(); } + test(); IF( ( comp_flag_1 ) || ( comp_flag_2 ) ) { isCompensated = FALSE; - break; + move16(); + BREAK; } } IF( !isCompensated ) { pState->gain_state[i].gainExpVal = add( pState->gain_state[i].gainExpVal, 1 ); + move16(); } IF( GT_16( pState->gain_state[i].gainExpVal, currMaxAttExp ) ) { - pState->gain_state[i].gainExpVal = min( pState->gain_state[i].gainExpVal, currMaxAttExp ); + pState->gain_state[i].gainExpVal = s_min( pState->gain_state[i].gainExpVal, currMaxAttExp ); + move16(); BREAK; } } @@ -1029,13 +1117,14 @@ void ivas_agc_enc_process_fx( Word16 tmp_1, q_tmp_2, e_div; Word32 tmp_2; tmp_1 = pState->gain_state[i].gainExpVal; + move16(); IF( GT_16( offset, idx ) ) { - IF( LT_16( tmp_1, 0 ) ) + IF( tmp_1 < 0 ) { tmp_2 = pow32_fx( pState->agc_com.winFunc_fx[idx], ( negate( tmp_1 ) ) ); - IF( LT_32( tmp_2, 0 ) ) + IF( tmp_2 < 0 ) { tmp_2 = L_deposit_h( BASOP_Util_Divide3232_Scale( ONE_IN_Q31, L_negate( tmp_2 ), &e_div ) ); tmp_2 = L_negate( tmp_2 ); @@ -1044,20 +1133,21 @@ void ivas_agc_enc_process_fx( { tmp_2 = L_deposit_h( BASOP_Util_Divide3232_Scale( ONE_IN_Q31, tmp_2, &e_div ) ); } - q_tmp_2 = Q31 - e_div; + q_tmp_2 = sub( Q31, e_div ); } ELSE { tmp_2 = pow32_fx( pState->agc_com.winFunc_fx[idx], tmp_1 ); q_tmp_2 = Q31; + move16(); } } ELSE { - IF( LT_16( tmp_1, 0 ) ) + IF( tmp_1 < 0 ) { tmp_2 = pow32_fx( pState->agc_com.winFunc_fx[offset - 1], ( negate( tmp_1 ) ) ); - IF( LT_32( tmp_2, 0 ) ) + IF( tmp_2 < 0 ) { tmp_2 = L_deposit_h( BASOP_Util_Divide3232_Scale( ONE_IN_Q31, L_negate( tmp_2 ), &e_div ) ); tmp_2 = L_negate( tmp_2 ); @@ -1066,27 +1156,30 @@ void ivas_agc_enc_process_fx( { tmp_2 = L_deposit_h( BASOP_Util_Divide3232_Scale( ONE_IN_Q31, tmp_2, &e_div ) ); } - q_tmp_2 = Q31 - e_div; + q_tmp_2 = sub( Q31, e_div ); } ELSE { tmp_2 = pow32_fx( pState->agc_com.winFunc_fx[offset - 1], tmp_1 ); q_tmp_2 = Q31; + move16(); } } // gain = tmp_2; ppPcm_out[i][idx] = Mpy_32_32( ppPcm_out[i][idx], tmp_2 ); // Q remains same - q_pcm = q_pcm_tmp + (q_tmp_2) -31; + move32(); + q_pcm = add( q_pcm_tmp, sub( q_tmp_2, Q31 ) ); } Word16 tmp_1, q_tmp_2, e_div; Word32 tmp_2; tmp_1 = pState->gain_state[i].gainExpVal; - IF( LT_16( tmp_1, 0 ) ) + move16(); + IF( tmp_1 < 0 ) { tmp_2 = pow32_fx( pState->agc_com.winFunc_fx[offset - 1], ( negate( tmp_1 ) ) ); - IF( LT_32( tmp_2, 0 ) ) + IF( tmp_2 < 0 ) { tmp_2 = L_deposit_h( BASOP_Util_Divide3232_Scale( ONE_IN_Q31, L_negate( tmp_2 ), &e_div ) ); tmp_2 = L_negate( tmp_2 ); @@ -1095,44 +1188,55 @@ void ivas_agc_enc_process_fx( { tmp_2 = L_deposit_h( BASOP_Util_Divide3232_Scale( ONE_IN_Q31, tmp_2, &e_div ) ); } - q_tmp_2 = Q31 - e_div; + q_tmp_2 = sub( Q31, e_div ); } ELSE { tmp_2 = pow32_fx( pState->agc_com.winFunc_fx[offset - 1], tmp_1 ); q_tmp_2 = Q31; + move16(); } pState->gain_state[i].lastGain_fx = Mpy_32_32( pState->gain_state[i].lastGain_fx, tmp_2 ); - pState->gain_state[i].q_lastGain_fx = pState->gain_state[i].q_lastGain_fx + (q_tmp_2) -31; + move32(); + pState->gain_state[i].q_lastGain_fx = add( pState->gain_state[i].q_lastGain_fx, sub( q_tmp_2, Q31 ) ); + move16(); /*safety check starts*/ - IF( EQ_16( pState->gain_state[i].gainExpVal, ( pState->agc_com.maxAttExp + 1 ) ) ) + if ( EQ_16( pState->gain_state[i].gainExpVal, add( pState->agc_com.maxAttExp, 1 ) ) ) { extendedExpVal = TRUE; + move16(); } /*safety check ends*/ pState->gain_state[i].prevExp = pState->gain_state[i].lastExp; + move16(); - pState->gain_state[i].lastExp -= pState->gain_state[i].gainExpVal; - IF( extendedExpVal ) + pState->gain_state[i].lastExp = sub( pState->gain_state[i].lastExp, pState->gain_state[i].gainExpVal ); + move16(); + if ( extendedExpVal ) { pState->gain_state[i].gainExpVal = -1; + move16(); } } pState->gain_data[i].absGainExp = add( pState->gain_state[i].prevExp, pState->agc_com.absEmin ); + move16(); IF( extendedExpVal ) { - IF( LE_16( pState->gain_state[i].gainExpVal, 0 ) ) + IF( pState->gain_state[i].gainExpVal <= 0 ) { pState->gain_state[i].gainExpVal = add( pState->agc_com.maxAttExp, 1 ); + move16(); } } - pState->gain_data[i].absGainExpCurr = pState->gain_data[i].absGainExp - pState->gain_state[i].gainExpVal; + pState->gain_data[i].absGainExpCurr = sub( pState->gain_data[i].absGainExp, pState->gain_state[i].gainExpVal ); + move16(); - if ( ( pState->gain_data[i].absGainExpCurr > pState->agc_com.absEmin ) || ( pState->gain_data[i].absGainExpCurr < 0 ) ) + test(); + IF( GT_16( pState->gain_data[i].absGainExpCurr, pState->agc_com.absEmin ) || ( pState->gain_data[i].absGainExpCurr < 0 ) ) { assert( 0 ); } @@ -1140,13 +1244,17 @@ void ivas_agc_enc_process_fx( IF( EQ_16( pState->gain_data[i].absGainExpCurr, pState->agc_com.absEmin ) ) { per_ch_bit[i] = 0; + move16(); } ELSE { per_ch_bit[i] = 1; + move16(); AGC_flag = 1; + move16(); } q_ppPcm[i] = q_pcm; + move16(); } push_next_indice( hMetaData, AGC_flag, 1 ); @@ -1166,7 +1274,7 @@ void ivas_agc_enc_process_fx( { IF( EQ_16( per_ch_bit[i], 1 ) ) { - push_next_indice( hMetaData, (Word16) pState->gain_data[i].absGainExpCurr, (Word16) pState->agc_com.betaE ); + push_next_indice( hMetaData, (UWord16) pState->gain_data[i].absGainExpCurr, (Word16) pState->agc_com.betaE ); } } } diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index c0cc8e3643764fbad9cbee80d0ba469ec13e6029..a33647bf77f67b79202ce54c6f85c2611e890413 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -94,6 +94,8 @@ ivas_error ivas_core_enc( STEREO_ICBWE_ENC_HANDLE hStereoICBWE; STEREO_TD_ENC_DATA_HANDLE hStereoTD; Word16 Q_new[CPE_CHANNELS] = { 0 }; + move16(); + move16(); Word16 voice_factors_fx[CPE_CHANNELS][NB_SUBFR16k]; /* Q15 */ Word32 shb_speech_fx32[L_FRAME16k]; Word32 *new_swb_speech_fx; @@ -133,6 +135,7 @@ ivas_error ivas_core_enc( push_wmops( "ivas_core_enc" ); error = IVAS_ERR_OK; + move32(); Q_shb_spch = 0; move16(); @@ -248,13 +251,24 @@ ivas_error ivas_core_enc( Scale_sig( &A_fx[n][i * ( M + 1 )], M + 1, sub( norm_s( A_fx[n][i * ( M + 1 )] ), 2 ) ); // scaling to Q12 Scale_sig( &Aw_fx[n][i * ( M + 1 )], M + 1, sub( norm_s( Aw_fx[n][i * ( M + 1 )] ), 2 ) ); // scaling to Q12 } - IF( ( error = pre_proc_ivas( st, last_element_mode, element_brate, ivas_format == SBA_FORMAT ? last_element_brate : element_brate, input_frame, old_inp_12k8_fx[n] /* i: -1, o: Q_new - 1 */, old_inp_16k_fx[n] /* i: -1, o: Q_new - 1 */, - &inp_fx[n], &ener_fx[n], A_fx[n], Aw_fx[n], epsP_fx[n], &epsP_fx_q[n], lsp_new_fx[n], lsp_mid_fx[n], new_inp_resamp16k_fx[n], &Voicing_flag[n], old_wsp_fx[n], e_old_wsp[n], loc_harm[n], - vad_flag_dtx[n], MCT_flag, vad_hover_flag[n], flag_16k_smc, enerBuffer_fx[n], enerBuffer_fx_exp[n], fft_buff_fx[n], cor_map_sum_fx[n], &Q_new[n] ) ) != IVAS_ERR_OK ) + IF( EQ_32( ivas_format, SBA_FORMAT ) ) { - return error; + IF( ( error = pre_proc_ivas( st, last_element_mode, element_brate, last_element_brate, input_frame, old_inp_12k8_fx[n] /* i: -1, o: Q_new - 1 */, old_inp_16k_fx[n] /* i: -1, o: Q_new - 1 */, + &inp_fx[n], &ener_fx[n], A_fx[n], Aw_fx[n], epsP_fx[n], &epsP_fx_q[n], lsp_new_fx[n], lsp_mid_fx[n], new_inp_resamp16k_fx[n], &Voicing_flag[n], old_wsp_fx[n], e_old_wsp[n], loc_harm[n], + vad_flag_dtx[n], MCT_flag, vad_hover_flag[n], flag_16k_smc, enerBuffer_fx[n], enerBuffer_fx_exp[n], fft_buff_fx[n], cor_map_sum_fx[n], &Q_new[n] ) ) != IVAS_ERR_OK ) + { + return error; + } + } + ELSE + { + IF( ( error = pre_proc_ivas( st, last_element_mode, element_brate, element_brate, input_frame, old_inp_12k8_fx[n] /* i: -1, o: Q_new - 1 */, old_inp_16k_fx[n] /* i: -1, o: Q_new - 1 */, + &inp_fx[n], &ener_fx[n], A_fx[n], Aw_fx[n], epsP_fx[n], &epsP_fx_q[n], lsp_new_fx[n], lsp_mid_fx[n], new_inp_resamp16k_fx[n], &Voicing_flag[n], old_wsp_fx[n], e_old_wsp[n], loc_harm[n], + vad_flag_dtx[n], MCT_flag, vad_hover_flag[n], flag_16k_smc, enerBuffer_fx[n], enerBuffer_fx_exp[n], fft_buff_fx[n], cor_map_sum_fx[n], &Q_new[n] ) ) != IVAS_ERR_OK ) + { + return error; + } } - test(); IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) || EQ_16( st->element_mode, IVAS_SCE ) ) { @@ -329,7 +343,7 @@ ivas_error ivas_core_enc( /* ACELP core encoder */ Word16 Q_old_syn_12k8_16k = 0; move16(); - IF( ( error = acelp_core_enc( st, inp_fx[n], /*ener[n],*/ A_fx[n], Aw_fx[n], epsP_fx[n], lsp_new_fx[n], lsp_mid_fx[n], vad_hover_flag[0], attack_flag[n], bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx[n], &Q_old_syn_12k8_16k, pitch_buf_fx[n], &unbits[n], hStereoTD, tdm_lsfQ_PCh_fx, Q_new[n] ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = acelp_core_enc( st, inp_fx[n], /*ener[n],*/ A_fx[n], Aw_fx[n], epsP_fx[n], lsp_new_fx[n], lsp_mid_fx[n], vad_hover_flag[0], attack_flag[n], bwe_exc_extended_fx[n], voice_factors_fx[n], old_syn_12k8_16k_fx[n], &Q_old_syn_12k8_16k, pitch_buf_fx[n], &unbits[n], hStereoTD, tdm_lsfQ_PCh_fx, Q_new[n] ) ), IVAS_ERR_OK ) ) { return error; } @@ -362,7 +376,7 @@ ivas_error ivas_core_enc( Scale_sig( old_inp_12k8_fx[n], L_INP_12k8, sub( Q_new[n], Q1 ) ); // Q_new[n] - 1 Scale_sig( old_inp_16k_fx[n], L_INP, sub( Q_new[n], Q1 ) ); // Q_new[n] - 1 - Scale_sig( st->hTcxEnc->old_out_fx, L_FRAME32k, -st->hTcxEnc->Q_old_out ); // scaling back to Q0 + Scale_sig( st->hTcxEnc->old_out_fx, L_FRAME32k, negate( st->hTcxEnc->Q_old_out ) ); // scaling back to Q0 st->hTcxEnc->Q_old_out = 0; move16(); @@ -385,7 +399,7 @@ ivas_error ivas_core_enc( L_spec = shr( st->hTcxCfg->tcx_coded_lines, 1 ); scale_sig32( hTcxEnc->spectrum_fx[0], L_spec, sub( hTcxEnc->spectrum_e[0], e_max ) ); // exp(e_max) scale_sig32( hTcxEnc->spectrum_fx[1], L_spec, sub( hTcxEnc->spectrum_e[1], e_max ) ); // exp(e_max) - scale_sig32( hTcxEnc->spectrum_fx[0] + L_spec, N_TCX10_MAX - L_spec, sub( Q_spec_old, e_max ) ); // exp(e_max) + scale_sig32( hTcxEnc->spectrum_fx[0] + L_spec, sub( N_TCX10_MAX, L_spec ), sub( Q_spec_old, e_max ) ); // exp(e_max) scale_sig32( hTcxEnc->spectrum_fx[1] + L_spec, sub( N_MAX - N_TCX10_MAX, L_spec ), sub( Q_spec_old, e_max ) ); // exp(e_max) hTcxEnc->spectrum_long_e = s_max( Q_spec_old, s_max( hTcxEnc->spectrum_e[0], hTcxEnc->spectrum_e[1] ) ); @@ -597,7 +611,14 @@ ivas_error ivas_core_enc( test(); IF( ( NE_16( st->hFdCngEnc->hFdCngCom->frameSize, st->L_frame ) ) || ( NE_16( st->hFdCngEnc->hFdCngCom->CngBandwidth, st->bwidth ) ) ) { - configureFdCngEnc( st->hFdCngEnc, s_max( st->bwidth, WB ), EQ_16( st->L_frame, L_FRAME16k ) ? ACELP_16k40 : ACELP_9k60 ); + IF( EQ_16( st->L_frame, L_FRAME16k ) ) + { + configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_16k40 ); + } + ELSE + { + configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->bwidth, WB ), ACELP_9k60 ); + } } } @@ -626,7 +647,7 @@ ivas_error ivas_core_enc( move16(); move16(); - IF( st->hTcxEnc != NULL ) + if ( st->hTcxEnc != NULL ) { st->hTcxEnc->exp_buf_speech_ltp = 31; // Q0 move16(); diff --git a/lib_enc/ivas_core_pre_proc.c b/lib_enc/ivas_core_pre_proc.c index 65362dd66e07da20f912ffd98ffb0ea8f44fca71..98250da87edd4303df70ce7a9d962447ee2d942d 100644 --- a/lib_enc/ivas_core_pre_proc.c +++ b/lib_enc/ivas_core_pre_proc.c @@ -75,16 +75,12 @@ ivas_error pre_proc_ivas( const Word16 vad_flag_dtx, /* i : HE-SAD flag with additional DTX HO */ const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0) */ const Word16 vad_hover_flag, /* i : VAD hangover flag */ - const Word16 flag_16k_smc /* i : flag to indicate if the OL SMC is run at 16 kHz */ -#ifdef IVAS_FLOAT_FIXED - , + const Word16 flag_16k_smc, /* i : flag to indicate if the OL SMC is run at 16 kHz */ Word32 enerBuffer_fx[CLDFB_NO_CHANNELS_MAX], Word16 e_enerBuffer, Word16 fft_buff_fx[2 * L_FFT], Word16 cor_map_sum_fx, // Q8 - Word16 *Q_new -#endif -) + Word16 *Q_new ) { Word16 L_look, element_mode, lMemRecalc_12k8; Word16 *inp_16k_fx, *new_inp_12k8_fx, *inp_12k8_fx; /* pointers to current frame and new data */ diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 6735fc66a8954e00e65024f63327e1447134ac29..f7f54891e3d93700000eba0e583ffee4444b2caf 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -933,15 +933,17 @@ ivas_error pre_proc_front_ivas_fx( shift = getScaleFactor16( old_inp_12k8_fx, 496 ); Scale_sig( old_inp_12k8_fx, 496, shift ); old_inp_12k8_e = sub( Q16, shift ); - if ( old_inp_12k8_e > st->exp_old_inp_12k8 ) + IF( GT_16( old_inp_12k8_e, st->exp_old_inp_12k8 ) ) { - Scale_sig( st->old_inp_12k8_fx, 240, st->exp_old_inp_12k8 - old_inp_12k8_e ); + Scale_sig( st->old_inp_12k8_fx, 240, sub( st->exp_old_inp_12k8, old_inp_12k8_e ) ); st->exp_old_inp_12k8 = old_inp_12k8_e; + move16(); } - else + ELSE { - Scale_sig( old_inp_12k8_fx, 496, old_inp_12k8_e - st->exp_old_inp_12k8 ); + Scale_sig( old_inp_12k8_fx, 496, sub( old_inp_12k8_e, st->exp_old_inp_12k8 ) ); old_inp_12k8_e = st->exp_old_inp_12k8; + move16(); } #endif // IVAS_FLOAT_FIXED_TO_BE_REMOVED @@ -1033,6 +1035,7 @@ ivas_error pre_proc_front_ivas_fx( move16(); Scale_sig( hSCE->hCoreCoder[n]->input_fx, input_frame, sub( -1, hSCE->hCoreCoder[n]->q_inp ) ); hSCE->hCoreCoder[n]->q_inp = -1; + move16(); Scale_sig( hSCE->hCoreCoder[n]->old_input_signal_fx, input_frame, sub( -1, hSCE->hCoreCoder[n]->q_old_inp ) ); hSCE->hCoreCoder[n]->q_old_inp = -1; move16(); @@ -1045,6 +1048,7 @@ ivas_error pre_proc_front_ivas_fx( move16(); Scale_sig( hCPE->hCoreCoder[n]->input_fx, input_frame, sub( -1, hCPE->hCoreCoder[n]->q_inp ) ); hCPE->hCoreCoder[n]->q_inp = -1; + move16(); Scale_sig( hCPE->hCoreCoder[n]->old_input_signal_fx, input_frame, sub( -1, hCPE->hCoreCoder[n]->q_old_inp ) ); hCPE->hCoreCoder[n]->q_old_inp = -1; move16(); @@ -1053,9 +1057,6 @@ ivas_error pre_proc_front_ivas_fx( FOR( Word16 k = 0; k < CLDFB_NO_COL_MAX; k++ ) { set32_fx( realBuffer_fx[k], 0, CLDFB_NO_CHANNELS_MAX ); - } - FOR( Word16 k = 0; k < CLDFB_NO_COL_MAX; k++ ) - { set32_fx( imagBuffer_fx[k], 0, CLDFB_NO_CHANNELS_MAX ); } #endif @@ -1063,7 +1064,11 @@ ivas_error pre_proc_front_ivas_fx( #ifdef IVAS_FLOAT_FIXED_CONVERSIONS Word16 Q_to_be_looked_into = -1; + move16(); Word16 headroom = 0, preemp_len = 0, inp_max = 0; + move16(); + move16(); + move16(); Word16 *preemp_start_idx = NULL; Word32 sig_out[960], max_32; #endif @@ -1128,12 +1133,13 @@ ivas_error pre_proc_front_ivas_fx( move32(); move16(); test(); - IF( hCPE->hFrontVad[0] != NULL && NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) ) + if ( hCPE->hFrontVad[0] != NULL && NE_16( hCPE->element_mode, IVAS_CPE_MDCT ) ) { lr_vad_enabled = 1; move16(); } + test(); IF( lr_vad_enabled && n == 0 ) { /* Combine localVAD and vad_flag from LR processing */ @@ -1179,7 +1185,7 @@ ivas_error pre_proc_front_ivas_fx( move16(); move16(); - IF( hSCE != NULL ) + if ( hSCE != NULL ) { *vad_hover_flag = 0; move16(); @@ -1190,7 +1196,7 @@ ivas_error pre_proc_front_ivas_fx( move16(); move16(); move16(); - IF( st->hGSCEnc != NULL ) + if ( st->hGSCEnc != NULL ) { st->hGSCEnc->noise_lev = NOISE_LEVEL_SP0; move16(); @@ -1223,20 +1229,20 @@ ivas_error pre_proc_front_ivas_fx( new_inp_12k8_fx = old_inp_12k8_fx + L_INP_MEM; /* pointer to new samples of the input signal in 12.8kHz core */ inp_12k8_fx = new_inp_12k8_fx - L_look; /* pointer to the current frame of input signal in 12.8kHz core */ - if ( NE_16( element_mode, IVAS_CPE_DFT ) ) + IF( NE_16( element_mode, IVAS_CPE_DFT ) ) { new_inp_12k8_fx -= L_FILT; } - if ( element_mode == IVAS_CPE_DFT ) + IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { Copy( st->old_inp_12k8_fx, old_inp_12k8_fx, L_INP_MEM - STEREO_DFT_OVL_12k8 ); } - else if ( element_mode == IVAS_CPE_TD ) + ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) ) { - Copy( st->old_inp_12k8_fx, old_inp_12k8_fx, L_INP_MEM - lMemRecalc_12k8 - L_FILT ); + Copy( st->old_inp_12k8_fx, old_inp_12k8_fx, sub( L_INP_MEM - L_FILT, lMemRecalc_12k8 ) ); } - else + ELSE { Copy( st->old_inp_12k8_fx, old_inp_12k8_fx, L_INP_MEM - L_FILT ); } @@ -1304,13 +1310,13 @@ ivas_error pre_proc_front_ivas_fx( { /* reconstruct past segment of the Secondary channel input signal when switching from DFT stereo */ test(); - IF( hCPE->last_element_mode == IVAS_CPE_DFT && st->idchan == 1 ) + IF( EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) && EQ_16( st->idchan, 1 ) ) { Word16 length_inp = NS2SA_FX2( input_Fs, L_MEM_RECALC_SCH_NS ); Word16 length_12k8 = NS2SA_FX2( INT_FS_12k8, L_MEM_RECALC_SCH_NS ); - new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx - add( lMemRecalc, length_inp ), length_inp, input_Fs, new_inp_12k8_fx - add( lMemRecalc_12k8, length_12k8 ), INT_FS_12k8, st->mem_decim_fx, 0, &Q_new_inp, &mem_decim_size ); - Scale_sig( new_inp_12k8_fx - add( lMemRecalc_12k8, length_12k8 ), new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to Q_to_be_looked_into*/ + new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc - length_inp, length_inp, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, INT_FS_12k8, st->mem_decim_fx, 0, &Q_new_inp, &mem_decim_size ); + Scale_sig( new_inp_12k8_fx - lMemRecalc_12k8 - length_12k8, new_inp_out_size, negate( Q_new_inp ) ); /* scaling back to Q_to_be_looked_into*/ } new_inp_out_size = modify_Fs_ivas_fx( signal_in_fx - lMemRecalc, input_frame, input_Fs, new_inp_12k8_fx - lMemRecalc_12k8, INT_FS_12k8, st->mem_decim_fx, ( st->max_bwidth == NB ), &Q_new_inp, &mem_decim_size ); @@ -1332,20 +1338,21 @@ ivas_error pre_proc_front_ivas_fx( Copy( signal_in_fx + sub( input_frame, add( NS2SA_FX2( input_Fs, L_MEM_RECALC_NS ), 2 * NS2SA( input_Fs, DELAY_FIR_RESAMPL_NS ) ) ), st->mem_decim_fx, 2 * NS2SA_FX2( input_Fs, DELAY_FIR_RESAMPL_NS ) ); } - Scale_sig( st->buf_speech_enc, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, -1 - ( 15 - st->exp_buf_speech_enc ) ); + Scale_sig( st->buf_speech_enc, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, sub( -1, sub( 15, st->exp_buf_speech_enc ) ) ); st->exp_buf_speech_enc = 16; move16(); /* save input resampled at 12.8kHz, non-preemhasised */ - if ( element_mode == IVAS_CPE_DFT ) + test(); + IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { Copy( new_inp_12k8_fx - STEREO_DFT_OVL_12k8, st->buf_speech_enc + L_FRAME32k - STEREO_DFT_OVL_12k8, L_FRAME + STEREO_DFT_OVL_12k8 ); } - else if ( element_mode == IVAS_CPE_TD || element_mode == IVAS_CPE_MDCT ) + ELSE IF( EQ_16( element_mode, IVAS_CPE_TD ) || EQ_16( element_mode, IVAS_CPE_MDCT ) ) { - Copy( new_inp_12k8_fx - lMemRecalc_12k8, st->buf_speech_enc + L_FRAME32k - lMemRecalc_12k8 - L_FILT, L_FRAME + lMemRecalc_12k8 + L_FILT ); + Copy( new_inp_12k8_fx - lMemRecalc_12k8, st->buf_speech_enc + L_FRAME32k - lMemRecalc_12k8 - L_FILT, add( L_FRAME + L_FILT, lMemRecalc_12k8 ) ); } - else + ELSE { Copy( new_inp_12k8_fx, st->buf_speech_enc + L_FRAME32k, L_FRAME ); } @@ -1355,6 +1362,7 @@ ivas_error pre_proc_front_ivas_fx( *-----------------------------------------------------------------*/ Word16 Q_new = 1; + move16(); IF( Q_new ) { @@ -1363,12 +1371,16 @@ ivas_error pre_proc_front_ivas_fx( set32_fx( sig_out, 0, 960 ); headroom = 1; + move16(); - if ( ( ( EQ_16( st->bwidth, NB ) ) || ( EQ_16( st->max_bwidth, NB ) ) ) && ( GT_32( st->input_Fs, 8000 ) ) ) + test(); + test(); + IF( ( st->bwidth == NB || st->max_bwidth == NB ) && GT_32( st->input_Fs, 8000 ) ) { headroom = add( headroom, 1 ); } + test(); IF( EQ_16( element_mode, IVAS_CPE_DFT ) ) { Copy( new_inp_12k8_fx - STEREO_DFT_OVL_12k8 + L_FRAME, st->inp_12k8_mem_stereo_sw_fx, STEREO_DFT_OVL_12k8 - L_MEM_RECALC_12K8 - L_FILT ); /* memory for TD/DFT stereo switching */ @@ -1408,6 +1420,7 @@ ivas_error pre_proc_front_ivas_fx( } st->mem_preemph_DFT_fx = old_inp_12k8_fx[L_INP_MEM - STEREO_DFT_OVL_12k8 + L_FRAME - 1]; /* == inp_12k8[L_FRAME-1] */ + move16(); } /* preemphasise past segment of the Secondary channel input signal when switching from DFT stereo */ @@ -1430,6 +1443,7 @@ ivas_error pre_proc_front_ivas_fx( // PREEMPH_FX( new_inp_12k8_fx - lMemRecalc_12k8 + L_FRAME, PREEMPH_FAC, lMemRecalc_12k8 + L_FILT, &dummy_fx ); PREEMPH_32FX( new_inp_12k8_fx - lMemRecalc_12k8 + L_FRAME, sig_out, PREEMPH_FAC, lMemRecalc_12k8 + L_FILT, &dummy_fx ); + test(); IF( preemp_start_idx && preemp_len ) { preemp_len = add( preemp_len, add( L_FRAME + L_FILT, lMemRecalc_12k8 ) ); @@ -1488,11 +1502,12 @@ ivas_error pre_proc_front_ivas_fx( Q_new = add( Q_new, Q_to_be_looked_into ); } - else + ELSE { // See if needed } cldfbScale.hb_scale = cldfbScale.lb_scale; + move16(); /*-------------------------------------------------------------------------* * Spectral analysis @@ -1501,7 +1516,7 @@ ivas_error pre_proc_front_ivas_fx( #ifdef IVAS_FLOAT_FIXED_CONVERSIONS Word16 *lgBin_E_fx; Word32 PS_fx[128]; - Word32 band_energies_fx[2 * NB_BANDS] = { 0 }; + Word32 band_energies_fx[2 * NB_BANDS]; lgBin_E_fx = NULL; if ( st != NULL ) { @@ -1509,6 +1524,8 @@ ivas_error pre_proc_front_ivas_fx( } Word16 Scale_fac[2] = { 0 }; + move16(); + move16(); #endif Scale_sig32( st->Bin_E_fx, L_FFT, sub( add( Q_new, Q_SCALE - 2 ), st->q_Bin_E ) ); st->q_Bin_E = add( Q_new, Q_SCALE - 2 ); @@ -1527,26 +1544,28 @@ ivas_error pre_proc_front_ivas_fx( } Word16 min_q = MAX_16, fft_q[2]; - FOR( int i_sbfr = 0; i_sbfr < 2; i_sbfr++ ) + Word16 i_sbfr; + FOR( i_sbfr = 0; i_sbfr < 2; i_sbfr++ ) { fft_q[i_sbfr] = add( Q_new, Scale_fac[i_sbfr] ); move16(); min_q = s_min( min_q, fft_q[i_sbfr] ); } - FOR( int i_sbfr = 0; i_sbfr < 2; i_sbfr++ ) + FOR( i_sbfr = 0; i_sbfr < 2; i_sbfr++ ) { Scale_sig( fft_buff_fx + i_sbfr * L_FFT, L_FFT, sub( min_q, fft_q[i_sbfr] ) ); } *fft_buff_fx_q = min_q; + move16(); Word16 Q_bands0 = 0, Q_bands1 = 0; move16(); move16(); - Scale_sig32( st->hNoiseEst->bckr_fx, NB_BANDS, sub( Q_new + QSCALE, st->hNoiseEst->q_bckr ) ); + Scale_sig32( st->hNoiseEst->bckr_fx, NB_BANDS, sub( add( Q_new, QSCALE ), st->hNoiseEst->q_bckr ) ); st->hNoiseEst->q_bckr = add( Q_new, QSCALE ); move16(); - Scale_sig32( st->hNoiseEst->enrO_fx, NB_BANDS, sub( Q_new + QSCALE, st->hNoiseEst->q_enrO ) ); + Scale_sig32( st->hNoiseEst->enrO_fx, NB_BANDS, sub( add( Q_new, QSCALE ), st->hNoiseEst->q_enrO ) ); st->hNoiseEst->q_enrO = add( Q_new, QSCALE ); move16(); @@ -1570,7 +1589,14 @@ ivas_error pre_proc_front_ivas_fx( * SAD (1-signal, 0-noise) *----------------------------------------------------------------*/ - noise_est_pre_32fx( L_deposit_h( Etot_fx ), st->ini_frame, st->hNoiseEst, st->idchan, element_mode, hCPE != NULL ? hCPE->last_element_mode : element_mode ); + IF( hCPE != NULL ) + { + noise_est_pre_32fx( L_deposit_h( Etot_fx ), st->ini_frame, st->hNoiseEst, st->idchan, element_mode, hCPE->last_element_mode ); + } + ELSE + { + noise_est_pre_32fx( L_deposit_h( Etot_fx ), st->ini_frame, st->hNoiseEst, st->idchan, element_mode, element_mode ); + } test(); test(); @@ -1583,8 +1609,6 @@ ivas_error pre_proc_front_ivas_fx( st->vad_flag = wb_vad_ivas_fx( st, fr_bands_fx, &i, &i, &i, &snr_sum_he_fx, &localVAD_HE_SAD, &( st->flag_noisy_speech_snr ), Q_new, NULL, NULL, -MAX_16, -MAX_16 ); //-100000f == max 16bit float move16(); - move16(); - move16(); test(); IF( EQ_16( force_front_vad, 1 ) || EQ_16( front_vad_flag, 1 ) ) @@ -1637,7 +1661,7 @@ ivas_error pre_proc_front_ivas_fx( } test(); - IF( EQ_16( st->idchan, 0 ) && NE_16( element_mode, IVAS_CPE_MDCT ) ) + IF( st->idchan == 0 && NE_16( element_mode, IVAS_CPE_MDCT ) ) { Scale_sig( st->input_fx, 480, negate( Q_to_be_looked_into ) ); /*scaling from Q_to_be_looked_into to q0*/ @@ -1751,7 +1775,7 @@ ivas_error pre_proc_front_ivas_fx( #endif perform_noise_estimation_enc_ivas_fx( band_energies_LR_fx, sub( Q31, band_energies_LR_fx_q ), enerBuffer_fx, *enerBuffer_fx_exp, st->hFdCngEnc, input_Fs, hCPE ); } - else + ELSE { Word16 normmsPeriodog_fx = Q31, zero_flag = 0; move16(); @@ -1784,11 +1808,13 @@ ivas_error pre_proc_front_ivas_fx( move16(); zero_flag = get_zero_flag( st->hFdCngEnc->hFdCngCom->periodog, PERIODOGLEN ); Word16 normmsperiodog = 31; + move16(); IF( zero_flag ) { normmsperiodog = getScaleFactor32( st->hFdCngEnc->hFdCngCom->periodog, PERIODOGLEN ); } st->hFdCngEnc->hFdCngCom->exp_cldfb_periodog = sub( 31, normmsperiodog ); + /* Bug : Next line overflows. Revisit later. */ st->hFdCngEnc->hFdCngCom->scalingFactor = (Word16) ( st->hFdCngEnc->hFdCngCom->scalingFactor * ( 1 << 30 ) ); move16(); move16(); @@ -1848,7 +1874,6 @@ ivas_error pre_proc_front_ivas_fx( { total_brate = imult3216( FRAMES_PER_SEC, st->bits_frame_nominal ); } - configureFdCngEnc( st->hFdCngEnc, max( st->input_bwidth, WB ), total_brate ); configureFdCngEnc_ivas_fx( st->hFdCngEnc, s_max( st->input_bwidth, WB ), total_brate ); IF( hCPE != NULL ) { @@ -1871,6 +1896,7 @@ ivas_error pre_proc_front_ivas_fx( msPeriodog_fx_Q = sub( sub( 31, msPeriodog_fx_Q ), st->hFdCngEnc->msPeriodog_fx_exp ); Scale_sig32( st->hFdCngEnc->msPeriodog_fx, NPART, sub( sub( 31, msPeriodog_fx_Q ), st->hFdCngEnc->msPeriodog_fx_exp ) ); st->hFdCngEnc->msPeriodog_fx_exp = sub( 31, msPeriodog_fx_Q ); + move16(); Word16 energy_ho_fx_Q = Q31; move16(); @@ -1881,6 +1907,7 @@ ivas_error pre_proc_front_ivas_fx( } Scale_sig32( st->hFdCngEnc->energy_ho_fx, NPART, energy_ho_fx_Q ); + /* Bug : Next line overflows. Revisit later. */ st->hFdCngEnc->energy_ho_fx_exp = st->hFdCngEnc->energy_ho_fx_exp - energy_ho_fx_Q; Word16 msNoiseEst_old_Q = Q31; @@ -1892,8 +1919,11 @@ ivas_error pre_proc_front_ivas_fx( } Scale_sig32( st->hFdCngEnc->msNoiseEst_old_fx, NPART, energy_ho_fx_Q ); + /* Bug : Next line overflows. Revisit later. */ st->hFdCngEnc->msNoiseEst_old_fx_exp = st->hFdCngEnc->msNoiseEst_old_fx_exp - msNoiseEst_old_Q; st->hFdCngEnc->msPeriodog_fx_exp_fft = st->hFdCngEnc->msPeriodog_fx_exp_cldfb = st->hFdCngEnc->msPeriodog_fx_exp; + move16(); + move16(); AdjustFirstSID_fx( st->hFdCngEnc->hFdCngCom->npart, st->hFdCngEnc->msPeriodog_fx, st->hFdCngEnc->msPeriodog_fx_exp, st->hFdCngEnc->energy_ho_fx, &st->hFdCngEnc->energy_ho_fx_exp, st->hFdCngEnc->msNoiseEst_fx, &st->hFdCngEnc->msNoiseEst_fx_exp, st->hFdCngEnc->msNoiseEst_old_fx, @@ -1933,12 +1963,13 @@ ivas_error pre_proc_front_ivas_fx( analy_lp_ivas_fx( inp_12k8_fx, L_FRAME, L_look, ener_fx, A_fx, epsP_h, epsP_l, lsp_new_fx, lsp_mid_fx, st->lsp_old1_fx, alw_pitch_lag_12k8, alw_voicing_fx, INT_FS_12k8, i, Q_new_loc, Q_r ); - FOR( int idx = 0; idx < M + 1; idx++ ) + FOR( Word16 idx = 0; idx < M + 1; idx++ ) { epsP_fx[idx] = L_Comp( epsP_h[idx], epsP_l[idx] ); // Q_r[0] + 1 move32(); } *epsP_fx_q = add( Q_r[0], 1 ); + move16(); lsp2lsf_fx( lsp_new_fx, lsf_new_fx, M, INT_FS_12k8 ); @@ -1946,7 +1977,8 @@ ivas_error pre_proc_front_ivas_fx( Copy( lsf_new_fx, st->lsf_old1_fx, M ); - if ( element_mode == IVAS_CPE_TD && st->idchan == 1 ) + test(); + IF( EQ_16( element_mode, IVAS_CPE_TD ) && EQ_16( st->idchan, 1 ) ) { /*----------------------------------------------------------------* * Comparison of the LP coefficents to determine if it is possible @@ -1976,7 +2008,7 @@ ivas_error pre_proc_front_ivas_fx( Word16 Q_wsp = Q_new; move16(); - IF( EQ_16( st->vad_flag, 0 ) ) + IF( st->vad_flag == 0 ) { /* reset the OL pitch tracker memories during inactive frames */ pitch_ol_init_fx( &st->old_thres_fx, &st->old_pitch, &st->delta_pit, &st->old_corr_fx ); @@ -2014,10 +2046,12 @@ ivas_error pre_proc_front_ivas_fx( shift = getScaleFactor32( tmpN_LR_fx[i], NB_BANDS ); scale_sig32( tmpN_LR_fx[i], NB_BANDS, shift ); q_tmpN_LR[i] = add( q_tmpN_LR[i], shift ); + move16(); shift = getScaleFactor32( tmpE_LR_fx[i], NB_BANDS ); scale_sig32( tmpE_LR_fx[i], NB_BANDS, shift ); q_tmpE_LR[i] = add( q_tmpE_LR[i], shift ); + move16(); } } shift = getScaleFactor32( tmpN_fx, NB_BANDS ); @@ -2034,6 +2068,7 @@ ivas_error pre_proc_front_ivas_fx( shift = sub( getScaleFactor16( old_wsp_fx, L_WSP ), 3 ); Scale_sig( old_wsp_fx, L_WSP, shift ); *q_old_wsp = add( *q_old_wsp, shift ); + move16(); Q_wsp = *q_old_wsp; move16(); Word16 q_fr_bands = Q30; @@ -2049,7 +2084,7 @@ ivas_error pre_proc_front_ivas_fx( test(); IF( lr_vad_enabled && st->idchan == 0 ) { - FOR( int j = 0; j < 2; j++ ) + FOR( Word16 j = 0; j < 2; j++ ) { q_fr_bands = s_min( q_fr_bands, add( lf_E_LR_fx_q, 2 ) ); q_fr_bands = s_min( q_fr_bands, q_tmpN_LR[j] ); @@ -2231,6 +2266,7 @@ ivas_error pre_proc_front_ivas_fx( *-----------------------------------------------------------------*/ vad_param_updt_fx( st, old_pitch1, corr_shift_fx, corr_shift_fx, A_fx, NULL, 1 ); + test(); IF( lr_vad_enabled && st->idchan == 0 ) { vad_param_updt_fx( st, old_pitch1, corr_shiftL_fx, corr_shiftR_fx, A_fx, &hCPE->hFrontVad[0], CPE_CHANNELS ); @@ -2285,10 +2321,15 @@ ivas_error pre_proc_front_ivas_fx( #endif // IVAS_FLOAT_FIXED_CONVERSIONS max_e_Etot = s_max( hStereoClassif->e_Etot_buf_fx, s_max( hStereoClassif->Etot_up_e, hStereoClassif->Etot_dn_e ) ); - scale_sig32( hStereoClassif->Etot_buf_fx, 3, hStereoClassif->e_Etot_buf_fx - max_e_Etot ); - hStereoClassif->Etot_up_fx = L_shr( hStereoClassif->Etot_up_fx, max_e_Etot - hStereoClassif->Etot_up_e ); - hStereoClassif->Etot_dn_fx = L_shr( hStereoClassif->Etot_dn_fx, max_e_Etot - hStereoClassif->Etot_dn_e ); + scale_sig32( hStereoClassif->Etot_buf_fx, 3, sub( hStereoClassif->e_Etot_buf_fx, max_e_Etot ) ); + hStereoClassif->Etot_up_fx = L_shr( hStereoClassif->Etot_up_fx, sub( max_e_Etot, hStereoClassif->Etot_up_e ) ); + move32(); + hStereoClassif->Etot_dn_fx = L_shr( hStereoClassif->Etot_dn_fx, sub( max_e_Etot, hStereoClassif->Etot_dn_e ) ); + move32(); hStereoClassif->Etot_up_e = hStereoClassif->Etot_dn_e = hStereoClassif->e_Etot_buf_fx = max_e_Etot; + move16(); + move16(); + move16(); stereo_classifier_features_ivas_fx( hStereoClassif, st->idchan, element_mode, localVAD_HE_SAD, lsf_new_fx, epsP_fx, st->pitch, st->voicing_fx, *cor_map_sum_fx, non_staX_fx, sp_div_fx, st->clas, sub( 31, *epsP_fx_q ), ( 15 - Q8 ) /* exp of cor_map_sum */, ( 15 - Q8 ) /* exp of non_staX_fx */, sub( 15, q_sp_div ) ); @@ -2355,19 +2396,33 @@ ivas_error pre_proc_front_ivas_fx( } ELSE IF( NE_16( element_mode, IVAS_CPE_MDCT ) ) { + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); /* SNR-based speech/music classification */ - if ( ( element_mode >= IVAS_CPE_DFT && element_brate >= IVAS_24k4 ) || ( element_mode == IVAS_SCE && element_brate >= SCE_SMC_THR ) ) + IF( ( GE_16( element_mode, IVAS_CPE_DFT ) && GE_32( element_brate, IVAS_24k4 ) ) || ( EQ_16( element_mode, IVAS_SCE ) && GE_32( element_brate, SCE_SMC_THR ) ) ) { - if ( ivas_format == SBA_FORMAT && st->core_brate != FRAME_NO_DATA && st->last_core_brate == FRAME_NO_DATA && st->sba_br_sw_while_no_data ) + test(); + test(); + test(); + test(); + test(); + IF( EQ_32( ivas_format, SBA_FORMAT ) && NE_32( st->core_brate, FRAME_NO_DATA ) && EQ_32( st->last_core_brate, FRAME_NO_DATA ) && st->sba_br_sw_while_no_data ) { SetModeIndex_ivas_fx( st, L_mult0( st->bits_frame_nominal, FRAMES_PER_SEC ), element_mode, MCT_flag ); st->sba_br_sw_while_no_data = 0; move16(); } - else if ( ivas_format == SBA_FORMAT && st->core_brate == FRAME_NO_DATA && element_brate != last_element_brate ) + ELSE IF( EQ_32( ivas_format, SBA_FORMAT ) && EQ_32( st->core_brate, FRAME_NO_DATA ) && NE_32( element_brate, last_element_brate ) ) { st->sba_br_sw_while_no_data = 1; + move16(); } IF( flag_16k_smc ) @@ -2388,14 +2443,16 @@ ivas_error pre_proc_front_ivas_fx( { #ifdef IVAS_FLOAT_FIXED_CONVERSIONS Word16 Q_old_inp_16k = -1; + move16(); Scale_sig( st->old_inp_16k_fx, L_INP_MEM, sub( Q_old_inp_16k, sub( Q15, Q_old_inp_16k ) ) ); st->exp_old_inp_16k = sub( Q15, Q_old_inp_16k ); - if ( st->hBWE_FD != NULL ) + IF( st->hBWE_FD != NULL ) { Scale_sig( st->hBWE_FD->L_old_wtda_swb_fx, L_FRAME48k, sub( -1, st->Q_old_wtda ) ); st->Q_old_wtda = -1; // This reset needs to be looked into + move16(); } #endif st->mem_preemph_enc = shl( st->mem_preemph_enc, sub( Q_old_inp_16k, sub( Q15, st->exp_mem_preemph_enc ) ) ); @@ -2404,6 +2461,7 @@ ivas_error pre_proc_front_ivas_fx( move16(); Scale_sig( st->buf_wspeech_enc, L_FRAME16k + L_SUBFR + L_FRAME16k + L_NEXT_MAX_16k + 320, sub( Q_old_inp_16k, sub( Q15, st->exp_buf_wspeech_enc ) ) ); st->exp_buf_wspeech_enc = sub( Q15, Q_old_inp_16k ); + move16(); Scale_sig( st->buf_speech_enc_pe, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, sub( Q_old_inp_16k, sub( Q15, st->exp_buf_speech_enc_pe ) ) ); st->exp_buf_speech_enc_pe = sub( Q15, Q_old_inp_16k ); move16(); @@ -2415,16 +2473,17 @@ ivas_error pre_proc_front_ivas_fx( A_fx, Aw_fx, epsP_fx, lsp_new_fx, lsp_mid_fx, Q_old_inp_16k, Q_r, NULL ); - if ( error != IVAS_ERR_OK ) + IF( error != IVAS_ERR_OK ) { return error; } *epsP_fx_q = add( Q_r[0], 1 ); + move16(); Scale_sig( st->buf_speech_enc, L_PAST_MAX_32k + L_FRAME32k + L_NEXT_MAX_32k, sub( Q15, st->exp_buf_speech_enc ) ); smc_dec = ivas_acelp_tcx20_switching_fx( st, st->speech_enc, 0, st->wspeech_enc, non_staX_fx, pitch_fr_fx, voicing_fr_fx, currFlatness_fx, lsp_mid_fx, stab_fac_fx, res_cod_SNR_M_fx, res_cod_SNR_M_fx_e, flag_16k_smc ); } - else + ELSE { #ifdef IVAS_FLOAT_FIXED_CONVERSIONS #define ATT_SEG_LEN ( L_FRAME / ATT_NSEG ) @@ -2438,7 +2497,7 @@ ivas_error pre_proc_front_ivas_fx( } } /* Switch to ACELP for non-harmonic transient signals */ - else if ( ( ( element_mode >= IVAS_CPE_DFT && element_brate <= IVAS_16k4 ) || ( element_mode == IVAS_SCE && element_brate < SCE_SMC_THR ) ) && ( loc_harm[0] != 1 ) && smc_dec == MUSIC ) + ELSE IF( ( ( GE_16( element_mode, IVAS_CPE_DFT ) && LE_32( element_brate, IVAS_16k4 ) ) || ( EQ_16( element_mode, IVAS_SCE ) && LT_32( element_brate, SCE_SMC_THR ) ) ) && NE_16( loc_harm[0], 1 ) && EQ_16( smc_dec, MUSIC ) ) { IF( EQ_16( element_mode, IVAS_SCE ) ) { @@ -2474,9 +2533,11 @@ ivas_error pre_proc_front_ivas_fx( * rewrite the VAD flag by VAD flag with DTX hangover for further processing) *----------------------------------------------------------------*/ - if ( st->Opt_DTX_ON && element_mode != IVAS_CPE_DFT ) + test(); + if ( st->Opt_DTX_ON && NE_16( element_mode, IVAS_CPE_DFT ) ) { st->vad_flag = *vad_flag_dtx; + move16(); } /*-----------------------------------------------------------------* @@ -2485,6 +2546,7 @@ ivas_error pre_proc_front_ivas_fx( shift = getScaleFactor16( &old_inp_12k8_fx[L_FRAME], L_INP_MEM ); Copy_Scale_sig( &old_inp_12k8_fx[L_FRAME], st->old_inp_12k8_fx, L_INP_MEM, shift ); st->exp_old_inp_12k8 = sub( Q15, add( Q_new, shift ) ); + move16(); Scale_sig( old_inp_12k8_fx, L_INP_12k8, negate( add( Q_new, 1 ) ) ); @@ -2584,21 +2646,25 @@ static void calculate_energy_buffer_ivas_fx( Flag overflow = 0; max_abs_nrg_DMX_fx = 0; - Word16 temp_q1 = norm_l( input_Fs ) - 1; + move64(); + Word16 temp_q1 = sub( norm_l( input_Fs ), 1 ); Word16 temp_q2 = norm_s( hCPE->hStereoDft->NFFT ); band_res_dft_fx = div_l( L_shl( input_Fs, temp_q1 ), shl( hCPE->hStereoDft->NFFT, temp_q2 ) ); /* chan_width_f = 24000.f / CLDFB_NO_CHANNELS_MAX; */ chan_width_f_fx = 24000 / CLDFB_NO_CHANNELS_MAX; - chan_width_bins_fx = L_shl( (Word32) div_s( chan_width_f_fx, band_res_dft_fx ), ( sub( temp_q1, temp_q2 ) ) ); // Q16 + move16(); + chan_width_bins_fx = L_shl( L_deposit_l( div_s( chan_width_f_fx, band_res_dft_fx ) ), sub( temp_q1, temp_q2 ) ); // Q16 set64_fx( nrg_DMX_fx, 0, CLDFB_NO_CHANNELS_MAX ); start = 1; + move16(); pDFT_DMX_fx = hCPE->hStereoDft->DFT_fx[0]; /*q_DFT_DMX_fx = 31-hCPE->hStereoDft->DFT_fx_e[0]*/ p_nrg_DMX_fx = nrg_DMX_fx; *p_nrg_DMX_fx = Mpy_32_32( pDFT_DMX_fx[0], pDFT_DMX_fx[0] ); /*2 * q_DFT_DMX_fx -31 */ + move64(); FOR( i = 0; i < no_channels; i++ ) { @@ -2606,11 +2672,15 @@ static void calculate_energy_buffer_ivas_fx( FOR( j = start; j < stop; j++ ) { *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, Mpy_32_32( pDFT_DMX_fx[2 * j], pDFT_DMX_fx[2 * j] ) ); /*2 * q_DFT_DMX_fx -31 */ + move64(); *p_nrg_DMX_fx = W_add( *p_nrg_DMX_fx, Mpy_32_32( pDFT_DMX_fx[2 * j + 1], pDFT_DMX_fx[2 * j + 1] ) ); + move64(); // 2 * DFT_fx_e } - if ( GT_64( W_abs( *p_nrg_DMX_fx ), max_abs_nrg_DMX_fx ) ) + IF( GT_64( W_abs( *p_nrg_DMX_fx ), max_abs_nrg_DMX_fx ) ) + { max_abs_nrg_DMX_fx = W_abs( *p_nrg_DMX_fx ); + } start = stop; move16(); p_nrg_DMX_fx++; @@ -2620,13 +2690,17 @@ static void calculate_energy_buffer_ivas_fx( FOR( i = 0; i < no_channels; i++ ) /* Consider only used channels, dependent on Fs */ { enerBuffer_dft_fx[i] = W_extract_h( W_shl_o( nrg_DMX_fx[i], norm_nrg_DMX_fx, &overflow ) ) / 3; /*q_enerBuffer_dft_fx=2 * q_DFT_DMX_fx -31+ norm_nrg_DMX_fx -32*/ + move32(); } *enerBuffer_dft_e = sub( add( 32, shl( hCPE->hStereoDft->DFT_fx_e[0], 1 ) ), norm_nrg_DMX_fx ); /*31-q_enerBuffer_dft_fx*/ + move16(); + /* Set remaining entries of enerBuffer to zero */ FOR( ; i < CLDFB_NO_CHANNELS_MAX; i++ ) { enerBuffer_dft_fx[i] = 0; + move32(); } return; } diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 6798a87bb875b701fe5a559f9d99a9ec54ab484c..ec106e5ccd44004f6f6309aa731f212a3823968c 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -653,7 +653,7 @@ ivas_error ivas_cpe_enc_fx( /* DFT stereo processing */ stereo_dft_enc_process_fx( hCPE, vad_flag_dtx, vad_hover_flag, input_frame ); } - else if ( hCPE->element_mode == IVAS_CPE_TD ) + else if ( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) ) { Scale_sig( sts[0]->input_fx, input_frame, negate( sts[0]->q_inp ) ); sts[0]->q_inp = 0; @@ -2046,7 +2046,7 @@ ivas_error ivas_cpe_enc( * * Create, allocate and initialize IVAS encoder CPE handle *-------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error create_cpe_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t cpe_id, /* i : CPE # identifier */ @@ -2328,7 +2328,7 @@ ivas_error create_cpe_enc( return error; } -#ifdef IVAS_FLOAT_FIXED +#else ivas_error create_cpe_enc_fx( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const Word16 cpe_id, /* i : CPE # identifier */ @@ -2344,17 +2344,16 @@ ivas_error create_cpe_enc_fx( ivas_error error; error = IVAS_ERR_OK; - move32(); hEncoderConfig = st_ivas->hEncoderConfig; ivas_format = hEncoderConfig->ivas_format; + move16(); element_mode_init = hEncoderConfig->element_mode_init; - input_Fs = hEncoderConfig->input_Fs; - max_bwidth = hEncoderConfig->max_bwidth; move16(); + input_Fs = hEncoderConfig->input_Fs; move16(); - move32(); + max_bwidth = hEncoderConfig->max_bwidth; move16(); /*-----------------------------------------------------------------* @@ -2371,14 +2370,14 @@ ivas_error create_cpe_enc_fx( *-----------------------------------------------------------------*/ hCPE->cpe_id = cpe_id; + move16(); hCPE->element_brate = element_brate; + move16(); hCPE->last_element_brate = hCPE->element_brate; - hCPE->element_mode = element_mode_init; - hCPE->last_element_mode = element_mode_init; move16(); - move32(); - move32(); + hCPE->element_mode = element_mode_init; move16(); + hCPE->last_element_mode = element_mode_init; move16(); hCPE->hStereoDft = NULL; @@ -2393,8 +2392,7 @@ ivas_error create_cpe_enc_fx( hCPE->hFrontVad[1] = NULL; hCPE->brate_surplus = 0; - move32(); - + move16(); /*-----------------------------------------------------------------* * Input memory buffer: allocate and initialize *-----------------------------------------------------------------*/ @@ -2411,16 +2409,17 @@ ivas_error create_cpe_enc_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DFT stereo memory\n" ) ); } + set16_zero_fx( hCPE->input_mem_fx[n], NS2SA( input_Fs, STEREO_DFT_OVL_NS ) ); } ELSE { hCPE->input_mem_fx[n] = NULL; } + } #ifdef MSAN_FIX - set16_fx( hCPE->q_input_mem, Q31, CPE_CHANNELS ); + set16_fx( hCPE->q_input_mem, Q15, CPE_CHANNELS ); #endif - } /*-----------------------------------------------------------------* * stereo classifier: allocate and initialize @@ -2439,7 +2438,7 @@ ivas_error create_cpe_enc_fx( IF( EQ_16( cpe_id, sub( st_ivas->nCPE, 1 ) ) ) { - IF( NE_32( ( error = ivas_initialize_MD_bstr_enc( &( hCPE->hMetaData ), st_ivas ) ), IVAS_ERR_OK ) ) + IF( ( error = ivas_initialize_MD_bstr_enc( &( hCPE->hMetaData ), st_ivas ) ) != IVAS_ERR_OK ) { return error; } @@ -2465,13 +2464,12 @@ ivas_error create_cpe_enc_fx( } ELSE { - st->total_brate = L_shr( hCPE->element_brate, CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ + st->total_brate = L_shr( hCPE->element_brate, 1 ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ move32(); } st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; - move32(); - - IF( NE_32( ( error = init_encoder_ivas_fx( st, st_ivas, n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0, ISM_MODE_NONE, hCPE->element_brate ) ), IVAS_ERR_OK ) ) + move16(); + IF( ( error = init_encoder_ivas_fx( st, st_ivas, n, hEncoderConfig->var_SID_rate_flag, hEncoderConfig->interval_SID, 0, ISM_MODE_NONE, hCPE->element_brate ) ) != IVAS_ERR_OK ) { return error; } @@ -2479,7 +2477,6 @@ ivas_error create_cpe_enc_fx( IF( st->hFdCngEnc != NULL ) { st->hFdCngEnc->hFdCngCom->CngBitrate = L_sub( hCPE->element_brate, 1 ); - move32(); } hCPE->hCoreCoder[n] = st; @@ -2507,12 +2504,11 @@ ivas_error create_cpe_enc_fx( hCPE->hStereoCng = NULL; } - test(); - IF( hEncoderConfig->Opt_DTX_ON && EQ_16( element_mode_init, IVAS_CPE_MDCT ) ) + IF( hEncoderConfig->Opt_DTX_ON && NE_16( element_mode_init, IVAS_CPE_MDCT ) ) { FOR( n = 0; n < CPE_CHANNELS; n++ ) { - IF( NE_32( ( error = front_vad_create_fx( &( hCPE->hFrontVad[n] ), hEncoderConfig ) ), IVAS_ERR_OK ) ) + IF( ( error = front_vad_create_fx( &( hCPE->hFrontVad[n] ), hEncoderConfig ) ) != IVAS_ERR_OK ) { return error; } @@ -2532,7 +2528,7 @@ ivas_error create_cpe_enc_fx( IF( EQ_16( hCPE->element_mode, IVAS_CPE_DFT ) ) { - IF( NE_32( ( error = stereo_dft_enc_create_fx( &( hCPE->hStereoDft ), input_Fs, max_bwidth ) ), IVAS_ERR_OK ) ) + IF( ( error = stereo_dft_enc_create_fx( &( hCPE->hStereoDft ), input_Fs, max_bwidth ) ) != IVAS_ERR_OK ) { return error; } @@ -2572,18 +2568,17 @@ ivas_error create_cpe_enc_fx( IF( EQ_16( hCPE->element_mode, IVAS_CPE_TD ) ) { - IF( ( hCPE->hStereoTD = (STEREO_TD_ENC_DATA_HANDLE) malloc( sizeof( STEREO_TD_ENC_DATA ) ) ) == NULL ) + if ( ( hCPE->hStereoTD = (STEREO_TD_ENC_DATA_HANDLE) malloc( sizeof( STEREO_TD_ENC_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD Stereo\n" ) ); } - stereo_td_init_enc_fx( hCPE->hStereoTD, hCPE->last_element_mode ); } /*-----------------------------------------------------------------* * MDCT stereo initialization *-----------------------------------------------------------------*/ - test(); + IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) && EQ_16( st_ivas->nCPE, 1 ) ) { IF( ( hCPE->hStereoMdct = (STEREO_MDCT_ENC_DATA_HANDLE) malloc( sizeof( STEREO_MDCT_ENC_DATA ) ) ) == NULL ) @@ -2592,16 +2587,12 @@ ivas_error create_cpe_enc_fx( } initMdctStereoEncData_fx( hCPE->hStereoMdct, ivas_format, hCPE->element_mode, hCPE->element_brate, max_bwidth, 0, NULL, 1 ); - test(); - test(); hCPE->hStereoMdct->isSBAStereoMode = ( ( EQ_16( ivas_format, SBA_FORMAT ) || EQ_16( ivas_format, SBA_ISM_FORMAT ) ) && EQ_16( st_ivas->nchan_transport, 2 ) ); - move16(); - test(); test(); IF( EQ_16( hCPE->element_mode, IVAS_CPE_MDCT ) && LE_32( element_brate, MAX_MDCT_ITD_BRATE ) && EQ_16( ivas_format, STEREO_FORMAT ) ) { - IF( NE_32( ( error = initMdctItdHandling_fx( hCPE->hStereoMdct, input_Fs ) ), IVAS_ERR_OK ) ) + IF( ( error = initMdctItdHandling_fx( hCPE->hStereoMdct, input_Fs ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index 3f9ab4f9b8a8b818c628fe224e9321b4b22b2c72..5d01bfe3010c6a295858b030761a2eb709f2c200 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -499,7 +499,6 @@ void ivas_decision_matrix_enc_fx( { st->core = ACELP_CORE; -#ifdef NONBE_FIX_1205_TD_STEREO_MOD_CT test(); test(); test(); @@ -510,10 +509,6 @@ void ivas_decision_matrix_enc_fx( st->coder_type = AUDIO; move16(); } -#else - st->coder_type = AUDIO; - move16(); -#endif st->sp_aud_decision2 = 0; move16(); @@ -858,7 +853,6 @@ void ivas_signaling_enc_fx( IF( EQ_16( st->core, ACELP_CORE ) ) { -#ifdef NONBE_FIX_1205_TD_STEREO_MOD_CT /* write coder type */ push_indice( hBstr, IND_ACELP_SIGNALLING, st->coder_type, 3 ); @@ -867,20 +861,6 @@ void ivas_signaling_enc_fx( /* write sharpening flag */ push_indice( hBstr, IND_SHARP_FLAG, st->sharpFlag, 1 ); } -#else - IF( LT_32( element_brate, FRMT_SHP_MIN_BRATE_IVAS ) ) - { - push_indice( hBstr, IND_ACELP_SIGNALLING, st->coder_type, 3 ); - } - ELSE - { - /* write coder type */ - push_indice( hBstr, IND_ACELP_SIGNALLING, st->coder_type, 3 ); - - /* write sharpening flag */ - push_indice( hBstr, IND_SHARP_FLAG, st->sharpFlag, 1 ); - } -#endif /* write extension layer flag to distinguish between TBE (0) and BWE (1) */ IF( st->extl_brate > 0 ) diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 36abcd18fd1e3a9415eb85659a702c69d75f8cee..70252e3d8dd03a07daa5cf30d1d21b4ce6982dc4 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -146,6 +146,7 @@ ivas_error ivas_dirac_enc_open_fx( move16(); Word16 tmp = BASOP_Util_Divide3232_Scale( (Word32) DIRAC_NO_COL_AVG_DIFF_NS, dirac_slot_ns, &tmp_e ); hDirAC->no_col_avg_diff = shr( tmp, sub( 15, tmp_e ) ); + move16(); set16_fx( (Word16 *) hDirAC->buffer_energy_q, 0, DIRAC_NO_COL_AVG_DIFF * DIRAC_MAX_NBANDS ); set16_fx( (Word16 *) hDirAC->buffer_intensity_real_q, 0, DIRAC_NUM_DIMS * DIRAC_NO_COL_AVG_DIFF * DIRAC_MAX_NBANDS ); @@ -325,6 +326,7 @@ ivas_error ivas_dirac_enc_reconfigure( ivas_error error; error = IVAS_ERR_OK; + move32(); hDirAC = st_ivas->hDirAC; @@ -401,6 +403,7 @@ void ivas_dirac_enc_close_fx( Word16 i, j; DIRAC_ENC_HANDLE hDirAC; + test(); IF( hDirAC_out == NULL || *hDirAC_out == NULL ) { return; @@ -573,11 +576,12 @@ ivas_error ivas_dirac_enc_fx( Word16 nchan_fb_in = hodirac_flag ? HOA2_CHANNELS : FOA_CHANNELS; move16(); - ivas_dirac_param_est_enc( hDirAC, hQMetaData->q_direction, hQMetaData->useLowerRes, data_f_fx, pp_fr_real_fx, pp_fr_imag_fx, pp_fr_q, input_frame, ivas_format, hodirac_flag, nchan_fb_in, &( hDirAC->mono_frame_count ), &( hQMetaData->dirac_mono_flag ) ); + ivas_dirac_param_est_enc_fx( hDirAC, hQMetaData->q_direction, hQMetaData->useLowerRes, data_f_fx, pp_fr_real_fx, pp_fr_imag_fx, pp_fr_q, input_frame, ivas_format, hodirac_flag, nchan_fb_in, &( hDirAC->mono_frame_count ), &( hQMetaData->dirac_mono_flag ) ); IF( hQMetaData->q_direction->cfg.nbands > 0 ) { orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; + move16(); IF( EQ_16( dtx_vad, 1 ) ) { @@ -1072,7 +1076,7 @@ static Word16 ivas_dirac_get_mono_flag_fx( return 0; } } - +#else static int16_t ivas_dirac_get_mono_flag( const int16_t *band_grouping, /* i : Band grouping for estimation */ float Cldfb_RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : Real part of input signal */ @@ -1182,6 +1186,7 @@ static int16_t ivas_dirac_get_mono_flag( } #endif +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * computeReferencePower_enc() * @@ -1247,9 +1252,9 @@ void computeReferencePower_enc( return; } -#ifdef IVAS_FLOAT_FIXED +#else /*------------------------------------------------------------------------- - * computeReferencePower_enc() + * computeReferencePower_enc_fx_dirac() * * *-------------------------------------------------------------------------*/ @@ -1455,7 +1460,7 @@ void computeReferencePower_enc_fx( *------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -void ivas_dirac_param_est_enc( +void ivas_dirac_param_est_enc_fx( DIRAC_ENC_HANDLE hDirAC, IVAS_QDIRECTION *q_direction, const UWord8 useLowerRes, @@ -2246,8 +2251,11 @@ static void computeIntensityVector_enc_fx( } intensity_real[0][i] = W_extract_h( tmp_1 ); // output Q= 2* input_q + 1 - 32 + move32(); intensity_real[1][i] = W_extract_h( tmp_2 ); // output Q= 2* input_q + 1 - 32 + move32(); intensity_real[2][i] = W_extract_h( tmp_3 ); // output Q= 2* input_q + 1 - 32 + move32(); } return; @@ -2292,6 +2300,7 @@ static void computeIntensityVector_enc( } #endif +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * computeDiffuseness_mdft() * @@ -2360,7 +2369,7 @@ void computeDiffuseness_mdft( return; } -#ifdef IVAS_FLOAT_FIXED +#else /*------------------------------------------------------------------------- * computeDiffuseness_mdft() * diff --git a/lib_enc/ivas_entropy_coder.c b/lib_enc/ivas_entropy_coder.c index d296a4f01c5a3e1c2178d74ad98549011981814f..bcef80e89a7dd755da1bacd855a9fd0e812aa215 100644 --- a/lib_enc/ivas_entropy_coder.c +++ b/lib_enc/ivas_entropy_coder.c @@ -141,27 +141,34 @@ static ivas_error ivas_get_dyn_freq_model_fx( Word16 i, n[IVAS_MAX_QUANT_LEVELS + 1], model_idx; Word32 curr_bps, curr_bps_min, curr_bps_new; Word16 range = pArith->range; - Word16 m, offset = -pArith->vals[0]; + Word16 m; + Word16 offset = negate( pArith->vals[0] ); ivas_error error; error = IVAS_ERR_OK; + move32(); FOR( i = 0; i < range + 1; i++ ) { n[i] = 0; + move16(); } FOR( i = 0; i < length; i++ ) { n[pInput[i] + offset] = add( n[pInput[i] + offset], 1 ); + move16(); } curr_bps = 0; + move32(); FOR( i = 0; i < range; i++ ) { - curr_dist[i] = (Word32) n[i]; + curr_dist[i] = L_deposit_l( n[i] ); + move32(); curr_bps = L_sub( curr_bps, curr_dist[i] * pArith->saved_dist_arr[0][i] ); } curr_bps_min = curr_bps; + move32(); #ifdef DEBUGGING { float a = curr_bps_min / 32768.0f; @@ -169,10 +176,12 @@ static ivas_error ivas_get_dyn_freq_model_fx( } #endif model_idx = 0; + move16(); FOR( m = 0; m < pArith->num_models - 1; m++ ) { curr_bps_new = 0; + move32(); FOR( i = 0; i < range; i++ ) { curr_bps_new = L_sub( curr_bps_new, ( curr_dist[i] * pArith->saved_dist_arr[m + 1][i] ) ); @@ -186,7 +195,9 @@ static ivas_error ivas_get_dyn_freq_model_fx( IF( LT_32( curr_bps_new, curr_bps_min ) ) { model_idx = m; + move16(); curr_bps_min = curr_bps_new; + move32(); } } @@ -202,6 +213,7 @@ static ivas_error ivas_get_dyn_freq_model_fx( } *model_index = model_idx; + move16(); return error; } @@ -223,9 +235,9 @@ static Word16 ivas_arith_encode_array( Word16 *pCum_freq = NULL; Tastat as; - IF( GT_16( in_len, 0 ) && GT_16( pArith->range, 1 ) ) + IF( in_len > 0 && GT_16( pArith->range, 1 ) ) { - IF( GT_16( pArith->dyn_model_bits, 0 ) ) + IF( pArith->dyn_model_bits > 0 ) { #ifdef IVAS_FLOAT_FIXED ivas_get_dyn_freq_model_fx( pInput, in_len, &model_index, pArith, &pCum_freq ); @@ -292,11 +304,12 @@ static Word16 ivas_arithCoder_encode_array_diff( Word16 n; Word16 arith_result; - IF( GT_16( length, 0 ) ) + IF( length > 0 ) { FOR( n = 0; n < length; n++ ) { pIn_old_scratch[n] = sub( pIn_new[n], pIn_old_scratch[n] ); + move16(); } #ifndef IVAS_FLOAT_FIXED @@ -306,7 +319,7 @@ static Word16 ivas_arithCoder_encode_array_diff( #endif arith_result = ivas_arith_encode_array( pIn_old_scratch, pArith_diff, hMetaData, length, wc_strat_arith ); - IF( LT_16( arith_result, 0 ) ) + IF( arith_result < 0 ) { return -1; } @@ -332,10 +345,13 @@ void ivas_huffman_encode( const Word16 *codebook; min_sym_val = huff_cfg->codebook[0]; + move16(); codebook = &huff_cfg->codebook[3 * ( in - min_sym_val )]; *hlen = codebook[1]; + move16(); *hcode = codebook[2]; + move16(); return; } @@ -356,22 +372,23 @@ static Word16 arith_encode_cell_array( const Word16 wc_strat_arith ) { Word16 total_symbol_len = 0; + move16(); Word16 i; Word16 arith_result; FOR( i = 0; i < nB; i++ ) { - total_symbol_len += ( pCell_dims[i].dim1 * pCell_dims[i].dim2 ); + total_symbol_len = add( total_symbol_len, imult1616( pCell_dims[i].dim1, pCell_dims[i].dim2 ) ); } assert( LE_16( total_symbol_len, ( IVAS_MAX_INPUT_LEN ) ) ); - IF( GT_16( total_symbol_len, 0 ) ) + IF( total_symbol_len > 0 ) { IF( GT_16( pArith->range, 1 ) ) { arith_result = ivas_arith_encode_array( pSymbol, pArith, hMetaData, total_symbol_len, wc_strat_arith ); - IF( LT_16( arith_result, 0 ) ) + IF( arith_result < 0 ) { return -1; } @@ -409,12 +426,12 @@ static Word16 arith_encode_cell_array_diff( assert( LE_16( total_symbol_len, ( IVAS_MAX_INPUT_LEN ) ) ); - IF( GT_16( total_symbol_len, 0 ) ) + IF( total_symbol_len > 0 ) { IF( GT_16( pArith_diff->range, 1 ) ) { arith_result = ivas_arithCoder_encode_array_diff( pArith_diff, pSymbol, pSymbol_old, total_symbol_len, hMetaData, wc_strat_arith ); - IF( LT_16( arith_result, 0 ) ) + IF( arith_result < 0 ) { return -1; } @@ -463,7 +480,7 @@ Word16 ivas_arith_encode_cmplx_cell_array( { len = ( imult1616( pCell_dims[i].dim1, pCell_dims[i].dim2 ) ); move16(); - IF( NE_16( pDo_diff[i], 0 ) ) + IF( pDo_diff[i] != 0 ) { FOR( j = 0; j < len; j++ ) { @@ -501,14 +518,14 @@ Word16 ivas_arith_encode_cmplx_cell_array( } arith_result = arith_encode_cell_array( cell_dim, hMetaData, nB, pArith_re, input, wc_strat_arith ); - IF( LT_16( arith_result, 0 ) ) + IF( arith_result < 0 ) { return -1; } arith_result = arith_encode_cell_array_diff( cell_dim_diff, hMetaData, nB, pArith_re_diff, input_old, input_new, wc_strat_arith ); move16(); - IF( LT_16( arith_result, 0 ) ) + IF( arith_result < 0 ) { return -1; } @@ -516,7 +533,7 @@ Word16 ivas_arith_encode_cmplx_cell_array( ELSE { arith_result = arith_encode_cell_array( pCell_dims, hMetaData, nB, pArith_re, pSymbol_re, wc_strat_arith ); - IF( LT_16( arith_result, 0 ) ) + IF( arith_result < 0 ) { return -1; } diff --git a/lib_enc/ivas_front_vad.c b/lib_enc/ivas_front_vad.c index 98da900f887e4d7e72aff10ab572037f2c20c680..d94336666fccf5dd2b450bccc73948f8ac762817 100644 --- a/lib_enc/ivas_front_vad.c +++ b/lib_enc/ivas_front_vad.c @@ -506,7 +506,7 @@ ivas_error front_vad_fx( * * Allocate and initialize Standalone front-VAD module *-----------------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error front_vad_create( FRONT_VAD_ENC_HANDLE *hFrontVad_out, /* i/o: front-VAD handle */ const ENCODER_CONFIG_HANDLE hEncoderConfig /* i : configuration structure */ @@ -584,7 +584,8 @@ ivas_error front_vad_create( return IVAS_ERR_OK; } -#ifdef IVAS_FLOAT_FIXED + +#else ivas_error front_vad_create_fx( FRONT_VAD_ENC_HANDLE *hFrontVad_out, /* i/o: front-VAD handle */ const ENCODER_CONFIG_HANDLE hEncoderConfig /* i : configuration structure */ @@ -609,7 +610,7 @@ ivas_error front_vad_create_fx( } wb_vad_init_ivas_fx( hFrontVad->hVAD ); - hFrontVad->lp_speech_fx = 23040; // Q9/* Initialize the long-term active speech level in dB */ + hFrontVad->lp_speech_fx = 11520; // Q9/* Initialize the long-term active speech level in dB */ move16(); hFrontVad->lp_noise_fx = 0; /* Initialize the long-term noise level in dB */ move16(); @@ -619,6 +620,8 @@ ivas_error front_vad_create_fx( move16(); hFrontVad->q_mem_preemph_fx = Q15; move16(); + hFrontVad->q_buffer_12k8 = Q31; + hFrontVad->q_mem_decim = Q31; hFrontVad->ini_frame = 0; move16(); hFrontVad->hVAD->vad_flag = 1; diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index aeec8f5682bbccc524cd0a1fef6ea2bd334e7056..cdb4bffea727fb9d31252ad4646234e7b8af9554 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -791,7 +791,7 @@ ivas_error ivas_init_encoder( st_ivas->nchan_transport = CPE_CHANNELS; cpe_id = 0; - if ( ( error = create_cpe_enc( st_ivas, cpe_id, ivas_total_brate ) ) != IVAS_ERR_OK ) + if ( ( error = create_cpe_enc_fx( st_ivas, cpe_id, ivas_total_brate ) ) != IVAS_ERR_OK ) { return error; } @@ -844,7 +844,7 @@ ivas_error ivas_init_encoder( st_ivas->sba_analysis_order = ivas_sba_get_analysis_order_fx( ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); #endif - if ( ( error = ivas_spar_enc_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_enc_open_fx( st_ivas, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -893,7 +893,7 @@ ivas_error ivas_init_encoder( for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - if ( ( error = create_cpe_enc( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + if ( ( error = create_cpe_enc_fx( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) { return error; } @@ -993,7 +993,7 @@ ivas_error ivas_init_encoder( st_ivas->hEncoderConfig->element_mode_init = IVAS_CPE_DFT; } - if ( ( error = create_cpe_enc( st_ivas, 0, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) + if ( ( error = create_cpe_enc_fx( st_ivas, 0, ivas_total_brate - ism_total_brate ) ) != IVAS_ERR_OK ) { return error; } @@ -1024,7 +1024,7 @@ ivas_error ivas_init_encoder( st_ivas->sba_analysis_order = ivas_sba_get_analysis_order_fx( ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); #endif - if ( ( error = ivas_spar_enc_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_spar_enc_open_fx( st_ivas, 0 ) ) != IVAS_ERR_OK ) { return error; } @@ -1064,7 +1064,7 @@ ivas_error ivas_init_encoder( for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - if ( ( error = create_cpe_enc( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + if ( ( error = create_cpe_enc_fx( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) { return error; } @@ -1085,7 +1085,7 @@ ivas_error ivas_init_encoder( for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - if ( ( error = create_cpe_enc( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) + if ( ( error = create_cpe_enc_fx( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) { return error; } @@ -1132,7 +1132,7 @@ ivas_error ivas_init_encoder( for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - if ( ( error = create_cpe_enc( st_ivas, cpe_id, ( ivas_total_brate / ( hEncoderConfig->nchan_inp - 1 ) * CPE_CHANNELS ) ) ) != IVAS_ERR_OK ) + if ( ( error = create_cpe_enc_fx( st_ivas, cpe_id, ( ivas_total_brate / ( hEncoderConfig->nchan_inp - 1 ) * CPE_CHANNELS ) ) ) != IVAS_ERR_OK ) { return error; } @@ -1167,7 +1167,7 @@ ivas_error ivas_init_encoder( for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - if ( ( error = create_cpe_enc( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) + if ( ( error = create_cpe_enc_fx( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) { return error; } @@ -1196,7 +1196,7 @@ ivas_error ivas_init_encoder( for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - if ( ( error = create_cpe_enc( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nCPE + st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) + if ( ( error = create_cpe_enc_fx( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nCPE + st_ivas->nSCE ) ) ) != IVAS_ERR_OK ) { return error; } @@ -1269,7 +1269,7 @@ ivas_error ivas_init_encoder( { hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; - if ( ( error = create_cpe_enc( st_ivas, cpe_id, brate_cpe ) ) != IVAS_ERR_OK ) + if ( ( error = create_cpe_enc_fx( st_ivas, cpe_id, brate_cpe ) ) != IVAS_ERR_OK ) { return error; } @@ -1507,7 +1507,7 @@ ivas_error ivas_init_encoder_fx( cpe_id = 0; move16(); - IF( NE_32( ( error = create_cpe_enc( st_ivas, cpe_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = create_cpe_enc_fx( st_ivas, cpe_id, ivas_total_brate ) ), IVAS_ERR_OK ) ) { return error; } @@ -1683,7 +1683,7 @@ ivas_error ivas_init_encoder_fx( move16(); } - IF( NE_32( ( error = create_cpe_enc( st_ivas, 0, L_sub( ivas_total_brate, ism_total_brate ) ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = create_cpe_enc_fx( st_ivas, 0, L_sub( ivas_total_brate, ism_total_brate ) ) ), IVAS_ERR_OK ) ) { return error; } @@ -1737,7 +1737,7 @@ ivas_error ivas_init_encoder_fx( { Word32 res_dec, res_frac; iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 ); - IF( NE_32( ( error = create_cpe_enc( st_ivas, cpe_id, imult3216( res_dec, CPE_CHANNELS ) ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = create_cpe_enc_fx( st_ivas, cpe_id, imult3216( res_dec, CPE_CHANNELS ) ) ), IVAS_ERR_OK ) ) { return error; } @@ -1760,7 +1760,7 @@ ivas_error ivas_init_encoder_fx( { Word32 res_dec, res_frac; iDiv_and_mod_32( ivas_total_brate, st_ivas->nchan_transport, &res_dec, &res_frac, 0 ); - IF( NE_32( ( error = create_cpe_enc( st_ivas, cpe_id, imult3216( res_dec, CPE_CHANNELS ) ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = create_cpe_enc_fx( st_ivas, cpe_id, imult3216( res_dec, CPE_CHANNELS ) ) ), IVAS_ERR_OK ) ) { return error; } @@ -1797,7 +1797,7 @@ ivas_error ivas_init_encoder_fx( { Word32 res_dec, res_frac; iDiv_and_mod_32( ivas_total_brate, sub( hEncoderConfig->nchan_inp, 1 ), &res_dec, &res_frac, 0 ); - IF( NE_32( ( error = create_cpe_enc( st_ivas, cpe_id, imult3216( res_dec, CPE_CHANNELS ) ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = create_cpe_enc_fx( st_ivas, cpe_id, imult3216( res_dec, CPE_CHANNELS ) ) ), IVAS_ERR_OK ) ) { return error; } @@ -1834,7 +1834,7 @@ ivas_error ivas_init_encoder_fx( { Word32 res_dec, res_frac; iDiv_and_mod_32( ivas_total_brate, st_ivas->nCPE, &res_dec, &res_frac, 0 ); - IF( NE_32( ( error = create_cpe_enc( st_ivas, cpe_id, res_dec ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = create_cpe_enc_fx( st_ivas, cpe_id, res_dec ) ), IVAS_ERR_OK ) ) { return error; } @@ -1859,7 +1859,7 @@ ivas_error ivas_init_encoder_fx( FOR( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) { - IF( NE_32( ( error = create_cpe_enc( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nCPE + st_ivas->nSCE ) ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = create_cpe_enc_fx( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nCPE + st_ivas->nSCE ) ) ), IVAS_ERR_OK ) ) { return error; } @@ -1915,7 +1915,7 @@ ivas_error ivas_init_encoder_fx( hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; move16(); - IF( NE_32( ( error = create_cpe_enc( st_ivas, cpe_id, brate_cpe ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = create_cpe_enc_fx( st_ivas, cpe_id, brate_cpe ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 32b0e99366e13404b1859cd62dc8436dc42eef2c..3f666b70277db45cf873fd49f472e1f55862b90a 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -795,7 +795,7 @@ ivas_error ivas_ism_enc_fx( Scale_sig( old_wsp_fx[sce_id][0], L_WSP, sub( e_old_wsp[sce_id][0], Q16 ) ); e_old_wsp[sce_id][0] = 16; move16(); - IF( ( error = ivas_core_enc( hSCE, NULL, NULL, 1, old_inp_12k8_fx[sce_id], old_inp_16k_fx[sce_id], ener_fx[sce_id], A_fx[sce_id], Aw_fx[sce_id], epsP_fx[sce_id], epsP_fx_q[sce_id], lsp_new_fx[sce_id], lsp_mid_fx[sce_id], vad_hover_flag[sce_id], attack_flag[sce_id], realBuffer_fx[sce_id], imagBuffer_fx[sce_id], &q_re_im_buf[sce_id], old_wsp_fx[sce_id], e_old_wsp[sce_id], loc_harm[sce_id], cor_map_sum_fx[sce_id], vad_flag_dtx[sce_id], enerBuffer_fx[sce_id], enerBuffer_fx_exp[sce_id], fft_buff_fx[sce_id], 0, ISM_FORMAT, 0 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_core_enc( hSCE, NULL, NULL, 1, old_inp_12k8_fx[sce_id], old_inp_16k_fx[sce_id], ener_fx[sce_id], A_fx[sce_id], Aw_fx[sce_id], epsP_fx[sce_id], epsP_fx_q[sce_id], lsp_new_fx[sce_id], lsp_mid_fx[sce_id], vad_hover_flag[sce_id], attack_flag[sce_id], realBuffer_fx[sce_id], imagBuffer_fx[sce_id], &q_re_im_buf[sce_id], old_wsp_fx[sce_id], e_old_wsp[sce_id], loc_harm[sce_id], cor_map_sum_fx[sce_id], vad_flag_dtx[sce_id], enerBuffer_fx[sce_id], enerBuffer_fx_exp[sce_id], fft_buff_fx[sce_id], 0, ISM_FORMAT, 0 ) ), IVAS_ERR_OK ) ) { return error; } @@ -964,12 +964,12 @@ ivas_error ivas_ism_enc_config( st_ivas->nCPE = 0; move16(); - IF( ( error = ivas_ism_config_fx( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_ism_config_fx( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL, 0 ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = ivas_corecoder_enc_reconfig_fx( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport, imult3216( ( st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport ), CPE_CHANNELS ), MC_MODE_NONE ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_corecoder_enc_reconfig_fx( st_ivas, nSCE_old, nCPE_old, nchan_transport_old, st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport, imult3216( ( st_ivas->hEncoderConfig->ivas_total_brate / st_ivas->nchan_transport ), CPE_CHANNELS ), MC_MODE_NONE ) ), IVAS_ERR_OK ) ) { return error; } @@ -978,7 +978,7 @@ ivas_error ivas_ism_enc_config( IF( EQ_16( st_ivas->ism_mode, ISM_MODE_PARAM ) && EQ_16( last_ism_mode, ISM_MODE_DISC ) ) { /* Allocate and Initialize the memory used by ParamISM when switch from Discrete ISM */ - IF( ( error = ivas_param_ism_enc_open( st_ivas ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_param_ism_enc_open( st_ivas ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 64f64b721158678695df1473687a49e284fd5821..6d11340b6a9aa3b55d491ddd4d75d6db9597a066 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -172,10 +172,11 @@ static void rate_ism_importance( FOR( ch = 0; ch < nchan_transport; ch++ ) { ctype = hSCE[ch]->hCoreCoder[0]->coder_type_raw; + move16(); IF( hSCE[ch]->hCoreCoder[0]->tcxonly ) { - IF( EQ_16( hSCE[ch]->hCoreCoder[0]->localVAD, 0 ) ) + IF( hSCE[ch]->hCoreCoder[0]->localVAD == 0 ) { ctype = INACTIVE; move16(); @@ -190,12 +191,12 @@ static void rate_ism_importance( test(); test(); test(); - IF( ( EQ_16( hIsmMeta[ch]->ism_metadata_flag, 0 ) || EQ_16( lowrate_metadata_flag[ch], 1 ) ) && EQ_16( hSCE[ch]->hCoreCoder[0]->localVAD, 0 ) ) + IF( ( hIsmMeta[ch]->ism_metadata_flag == 0 || EQ_16( lowrate_metadata_flag[ch], 1 ) ) && hSCE[ch]->hCoreCoder[0]->localVAD == 0 ) { ism_imp[ch] = ISM_NO_META; move16(); } - ELSE IF( EQ_16( ctype, INACTIVE ) || EQ_16( ctype, UNVOICED ) ) + ELSE IF( ctype == INACTIVE || EQ_16( ctype, UNVOICED ) ) { ism_imp[ch] = ISM_LOW_IMP; move16(); @@ -318,14 +319,14 @@ ivas_error ivas_ism_metadata_enc( non_diegetic_flag_global = 0; move16(); move16(); - set_s( nb_bits_metadata, 0, nchan_transport ); - set_s( flag_abs_azimuth, 0, nchan_ism ); - set_s( flag_abs_elevation, 0, nchan_ism ); - set_s( flag_abs_yaw, 0, nchan_ism ); - set_s( flag_abs_pitch, 0, nchan_ism ); - set_s( flag_abs_radius, 0, nchan_ism ); - set_s( null_metadata_flag, 0, nchan_ism ); - set_s( lowrate_metadata_flag, 0, nchan_ism ); + set16_fx( nb_bits_metadata, 0, nchan_transport ); + set16_fx( flag_abs_azimuth, 0, nchan_ism ); + set16_fx( flag_abs_elevation, 0, nchan_ism ); + set16_fx( flag_abs_yaw, 0, nchan_ism ); + set16_fx( flag_abs_pitch, 0, nchan_ism ); + set16_fx( flag_abs_radius, 0, nchan_ism ); + set16_fx( null_metadata_flag, 0, nchan_ism ); + set16_fx( lowrate_metadata_flag, 0, nchan_ism ); test(); @@ -361,6 +362,8 @@ ivas_error ivas_ism_metadata_enc( IF( NE_16( ism_mode, ISM_SBA_MODE_DISC ) ) { /* In case of low level noise for low bitrate inactive frames, do not sent metadata */ + test(); + test(); hIsmMeta[ch]->ism_metadata_flag = vad_flag[ch] || GT_16( hSCE[ch]->hCoreCoder[0]->lp_noise_fx, 2560 /*10 Q8*/ ) || hSCE[ch]->hCoreCoder[0]->tcxonly; move16(); } @@ -436,9 +439,9 @@ ivas_error ivas_ism_metadata_enc( FOR( ch = 0; ch < nchan_ism; ch++ ) { - ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; - ism_metadata_flag_global |= lowrate_metadata_flag[ch]; - non_diegetic_flag_global |= hIsmMeta[ch]->non_diegetic_flag; + ism_metadata_flag_global = s_or( ism_metadata_flag_global, hIsmMeta[ch]->ism_metadata_flag ); + ism_metadata_flag_global = s_or( ism_metadata_flag_global, lowrate_metadata_flag[ch] ); + non_diegetic_flag_global = s_or( non_diegetic_flag_global, hIsmMeta[ch]->non_diegetic_flag ); } /* write extended metadata presence flag */ @@ -491,7 +494,7 @@ ivas_error ivas_ism_metadata_enc( { push_indice( hBstr, IND_ISM_METADATA_FLAG, ism_imp[ch], ISM_METADATA_FLAG_BITS ); - IF( EQ_16( ism_imp[ch], ISM_NO_META ) ) + IF( ism_imp[ch] == ISM_NO_META ) { /* signal low-rate ISM_NO_META frame */ push_indice( hBstr, IND_ISM_MD_NULL_FLAG, 0, ISM_METADATA_MD_FLAG_BITS ); @@ -533,7 +536,7 @@ ivas_error ivas_ism_metadata_enc( test(); test(); test(); - IF( EQ_16( ism_mode, ISM_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_16( ism_mode, ISM_SBA_MODE_DISC ) ) + if ( EQ_16( ism_mode, ISM_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_16( ism_mode, ISM_SBA_MODE_DISC ) ) { nb_bits_start = hBstr->nb_bits_tot; move16(); @@ -560,17 +563,13 @@ ivas_error ivas_ism_metadata_enc( move32(); } - IF( LT_32( hIsmMetaData->azimuth_fx, L_negate( 377487360 ) ) ) + IF( LT_32( hIsmMetaData->azimuth_fx, L_negate( 377487360 ) /*-90.0f Q22*/ ) ) { - hIsmMetaData->azimuth_fx = L_sub( L_negate( 754974720 ), hIsmMetaData->azimuth_fx ); + hIsmMetaData->azimuth_fx = L_sub( L_negate( 754974720 ) /*-180.0f Q22*/, hIsmMetaData->azimuth_fx ); move32(); } -#ifdef IVAS_FLOAT_FIXED idx_angle1_abs = ism_quant_meta_fx( hIsmMetaData->azimuth_fx, &valQ_fx, ism_azimuth_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, 1 << ISM_AZIMUTH_NBITS ); -#else - idx_angle1_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); -#endif encode_angle_indices( hBstr, &( hIsmMetaData->position_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, 0, &flag_abs_azimuth[ch], NULL ); } ELSE @@ -580,14 +579,9 @@ ivas_error ivas_ism_metadata_enc( test(); IF( EQ_16( ism_mode, ISM_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_16( ism_mode, ISM_SBA_MODE_DISC ) ) { -#ifdef IVAS_FLOAT_FIXED idx_angle1_abs = ism_quant_meta_fx( hIsmMetaData->azimuth_fx, &valQ_fx, ism_azimuth_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, 1 << ISM_AZIMUTH_NBITS ); idx_angle2_abs = ism_quant_meta_fx( hIsmMetaData->elevation_fx, &valQ_fx, ism_elevation_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, 1 << ISM_ELEVATION_NBITS ); // valQ = fixedToFloat( valQ_fx, Q22 ); -#else - idx_angle1_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); - idx_angle2_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#endif } ELSE /* ISM_MODE_PARAM */ { @@ -604,18 +598,12 @@ ivas_error ivas_ism_metadata_enc( test(); IF( ( EQ_16( ism_mode, ISM_MODE_DISC ) || EQ_16( ism_mode, ISM_SBA_MODE_DISC ) ) && ism_extended_metadata_flag ) { -#ifdef IVAS_FLOAT_FIXED idx_angle1_abs = ism_quant_meta_fx( hIsmMetaData->yaw_fx, &valQ_fx, ism_azimuth_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, 1 << ISM_AZIMUTH_NBITS ); idx_angle2_abs = ism_quant_meta_fx( hIsmMetaData->pitch_fx, &valQ_fx, ism_elevation_borders_fx, ISM_Q_STEP_FX, ISM_Q_STEP_BORDER_FX, 1 << ISM_ELEVATION_NBITS ); Word16 valQ_fx_tmp = extract_h( valQ_fx ); // 22 - 16 = 6 idx_radius_abs = usquant_fx( hIsmMetaData->radius_fx, &valQ_fx_tmp, ISM_RADIUS_MIN_Q9, ISM_RADIUS_DELTA_Q8, 1 << ISM_RADIUS_NBITS ); valQ_fx = L_shr( L_deposit_h( valQ_fx_tmp ), 3 ); // Q22 // valQ = fixedToFloat( valQ_fx, Q22 ); -#else - idx_angle1_abs = ism_quant_meta( hIsmMetaData->yaw, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); - idx_angle2_abs = ism_quant_meta( hIsmMetaData->pitch, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); - idx_radius_abs = usquant( hIsmMetaData->radius, &valQ, ISM_RADIUS_MIN, ISM_RADIUS_DELTA, 1 << ISM_RADIUS_NBITS ); -#endif encode_angle_indices( hBstr, &( hIsmMetaData->orientation_angle ), hIsmMetaData->last_ism_metadata_flag, ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_yaw[ch], &flag_abs_pitch[ch] ); encode_radius( hBstr, &hIsmMetaData->last_radius_idx, &hIsmMetaData->radius_diff_cnt, hIsmMetaData->last_ism_metadata_flag, idx_radius_abs, &flag_abs_radius[ch] ); } @@ -627,7 +615,8 @@ ivas_error ivas_ism_metadata_enc( test(); IF( EQ_16( ism_mode, ISM_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_16( ism_mode, ISM_SBA_MODE_DISC ) ) { - nb_bits_metadata[ch] = hBstr->nb_bits_tot - nb_bits_start; + nb_bits_metadata[ch] = sub( hBstr->nb_bits_tot, nb_bits_start ); + move16(); } /* Updates */ @@ -646,25 +635,27 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ i = 0; - WHILE( i == 0 || i < nchan_ism / INTER_OBJECT_PARAM_CHECK ) + move16(); + test(); + WHILE( i == 0 || i < idiv1616( nchan_ism, INTER_OBJECT_PARAM_CHECK ) ) { Word16 num, abs_num, abs_first, abs_next, pos_zero; Word16 abs_matrice[INTER_OBJECT_PARAM_CHECK * ISM_NUM_PARAM]; - num = min( INTER_OBJECT_PARAM_CHECK, nchan_ism - i * INTER_OBJECT_PARAM_CHECK ); - i++; + num = s_min( INTER_OBJECT_PARAM_CHECK, sub( nchan_ism, imult1616( i, INTER_OBJECT_PARAM_CHECK ) ) ); + i = add( i, 1 ); - set_s( abs_matrice, 0, INTER_OBJECT_PARAM_CHECK * ISM_NUM_PARAM ); + set16_fx( abs_matrice, 0, INTER_OBJECT_PARAM_CHECK * ISM_NUM_PARAM ); FOR( ch = 0; ch < num; ch++ ) { - IF( EQ_16( flag_abs_azimuth[ch], 1 ) ) + if ( EQ_16( flag_abs_azimuth[ch], 1 ) ) { abs_matrice[ch * ISM_NUM_PARAM] = 1; move16(); } - IF( EQ_16( flag_abs_elevation[ch], 1 ) ) + if ( EQ_16( flag_abs_elevation[ch], 1 ) ) { abs_matrice[ch * ISM_NUM_PARAM + 1] = 1; move16(); @@ -679,61 +670,69 @@ ivas_error ivas_ism_metadata_enc( /* find first "1" entry */ WHILE( abs_matrice[abs_first] == 0 ) { - abs_first++; + abs_first = add( abs_first, 1 ); } /* find next "1" entry */ - abs_next = abs_first + 1; + abs_next = add( abs_first, 1 ); WHILE( abs_matrice[abs_next] == 0 ) { - abs_next++; + abs_next = add( abs_next, 1 ); } /* find "0" position */ pos_zero = 0; - WHILE( abs_matrice[pos_zero] == 1 ) + move16(); + WHILE( EQ_16( abs_matrice[pos_zero], 1 ) ) { - pos_zero++; + pos_zero = add( pos_zero, 1 ); } - ch = abs_next / ISM_NUM_PARAM; + ch = idiv1616( abs_next, ISM_NUM_PARAM ); IF( abs_next % ISM_NUM_PARAM == 0 ) { - hIsmMeta[ch]->position_angle.angle1_diff_cnt = abs_num - 1; + hIsmMeta[ch]->position_angle.angle1_diff_cnt = sub( abs_num, 1 ); + move16(); } IF( abs_next % ISM_NUM_PARAM == 1 ) { - hIsmMeta[ch]->position_angle.angle2_diff_cnt = abs_num - 1; + hIsmMeta[ch]->position_angle.angle2_diff_cnt = sub( abs_num, 1 ); + move16(); /*hIsmMeta[ch]->elevation_diff_cnt = min( hIsmMeta[ch]->elevation_diff_cnt, ISM_FEC_MAX );*/ } - abs_first++; - abs_num--; + abs_first = add( abs_first, 1 ); + abs_num = sub( abs_num, 1 ); } + test(); } IF( EQ_16( ism_mode, ISM_SBA_MODE_DISC ) ) { Word16 md_diff_flag[MAX_NUM_OBJECTS]; - set_s( md_diff_flag, 1, nchan_ism ); + set16_fx( md_diff_flag, 1, nchan_ism ); FOR( ch = 0; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; + move16(); IF( hIsmMeta[ch]->ism_metadata_flag == 0 ) { - hIsmMeta[ch]->ism_md_fec_cnt_enc++; + hIsmMeta[ch]->ism_md_fec_cnt_enc = add( hIsmMeta[ch]->ism_md_fec_cnt_enc, 1 ); + move16(); } ELSE { hIsmMeta[ch]->ism_md_fec_cnt_enc = 0; move16(); } - hIsmMeta[ch]->ism_md_inc_diff_cnt++; - hIsmMeta[ch]->ism_md_inc_diff_cnt = min( hIsmMeta[ch]->ism_md_inc_diff_cnt, ISM_MD_INC_DIFF_CNT_MAX ); + hIsmMeta[ch]->ism_md_inc_diff_cnt = add( hIsmMeta[ch]->ism_md_inc_diff_cnt, 1 ); + move16(); + hIsmMeta[ch]->ism_md_inc_diff_cnt = s_min( hIsmMeta[ch]->ism_md_inc_diff_cnt, ISM_MD_INC_DIFF_CNT_MAX ); + move16(); } update_last_metadata_fx( nchan_ism, hIsmMeta, md_diff_flag ); @@ -772,20 +771,24 @@ ivas_error ivas_ism_metadata_enc( total_bits_metadata = sub( hBstr->nb_bits_tot, nb_bits_start ); /* bits per ISM*/ - bits_metadata_ism = (Word16) ( total_bits_metadata / nchan_transport ); + bits_metadata_ism = idiv1616( total_bits_metadata, nchan_transport ); /* Divide the metadata bits into n_Isms*/ nb_bits_objcod_written = 0; + move16(); FOR( ch = 0; ch < nchan_transport; ch++ ) { IF( EQ_16( ch, sub( nchan_transport, 1 ) ) ) { - nb_bits_metadata[ch] = total_bits_metadata - nb_bits_objcod_written; + nb_bits_metadata[ch] = sub( total_bits_metadata, nb_bits_objcod_written ); + move16(); } ELSE { nb_bits_metadata[ch] = bits_metadata_ism; - nb_bits_objcod_written += bits_metadata_ism; + move16(); + nb_bits_objcod_written = add( nb_bits_objcod_written, bits_metadata_ism ); + move16(); } } } @@ -806,33 +809,36 @@ ivas_error ivas_ism_metadata_enc( Word16 brate_limit_flag; Word32 ism_total_brate_ref; ism_total_brate_ref = *ism_total_brate; -#ifndef IVAS_FLOAT_FIXED - brate_limit_flag = calculate_brate_limit_flag( ism_imp, nchan_ism ); -#else + move32(); brate_limit_flag = calculate_brate_limit_flag_fx( ism_imp, nchan_ism ); -#endif - bits_ism = (Word16) ( *ism_total_brate / FRAMES_PER_SEC ); - set_s( bits_element, bits_ism / nchan_ism, nchan_ism ); - bits_element[nchan_ism - 1] += bits_ism % nchan_ism; + bits_ism = extract_l( div_l( *ism_total_brate, FRAMES_PER_SEC >> 1 ) ); + set16_fx( bits_element, idiv1616( bits_ism, nchan_ism ), nchan_ism ); + bits_element[nchan_ism - 1] = add( bits_element[nchan_ism - 1], bits_ism % nchan_ism ); + move16(); bitbudget_to_brate( bits_element, element_brate, nchan_ism ); *ism_total_brate = 0; + move32(); FOR( ch = 0; ch < nchan_ism; ch++ ) { -#ifndef IVAS_FLOAT_FIXED - *ism_total_brate += ivas_interformat_brate( ism_mode, nchan_ism, hSCE[ch]->element_brate, ism_imp[ch], brate_limit_flag ); -#else *ism_total_brate = L_add( *ism_total_brate, ivas_interformat_brate_fx( ism_mode, nchan_ism, hSCE[ch]->element_brate, ism_imp[ch], brate_limit_flag ) ); -#endif + move32(); + test(); + test(); IF( GT_16( ism_imp[ch], 1 ) && EQ_16( flag_omasa_ener_brate, 1 ) && brate_limit_flag >= 0 ) { - *ism_total_brate -= ADJUST_ISM_BRATE_NEG; + *ism_total_brate = L_sub( *ism_total_brate, ADJUST_ISM_BRATE_NEG ); + move32(); } + test(); + test(); + test(); IF( EQ_16( brate_limit_flag, -1 ) && GE_16( ism_imp[ch], 1 ) && GE_16( nchan_ism, 3 ) && ( GT_32( L_sub( ism_total_brate_ref, *ism_total_brate ), IVAS_48k ) ) ) { - *ism_total_brate += ADJUST_ISM_BRATE_POS; + *ism_total_brate = L_add( *ism_total_brate, ADJUST_ISM_BRATE_POS ); + move32(); } } ism_metadata_flag_global = 1; @@ -841,12 +847,13 @@ ivas_error ivas_ism_metadata_enc( IF( EQ_16( ism_mode, ISM_MASA_MODE_DISC ) ) { brate_limit_flag = 0; + move16(); FOR( Word16 n = 0; n < nchan_ism; n++ ) { - brate_limit_flag += ism_imp[n]; + brate_limit_flag = add( brate_limit_flag, ism_imp[n] ); } - IF( brate_limit_flag >= nchan_ism * ISM_HIGH_IMP - 2 ) + if ( GE_16( brate_limit_flag, sub( imult1616( nchan_ism, ISM_HIGH_IMP ), 2 ) ) ) { *omasa_stereo_sw_cnt = OMASA_STEREO_SW_CNT_MAX; move16(); @@ -858,16 +865,17 @@ ivas_error ivas_ism_metadata_enc( * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ + test(); IF( EQ_16( ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { - IF( ( error = ivas_ism_config( *ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, ism_extended_metadata_flag, null_metadata_flag, ism_imp, element_brate, total_brate, nb_bits_metadata, 1 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_ism_config( *ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, ism_extended_metadata_flag, null_metadata_flag, ism_imp, element_brate, total_brate, nb_bits_metadata, 1 ) ), IVAS_ERR_OK ) ) { return error; } } ELSE { - IF( ( error = ivas_ism_config( *ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, ism_extended_metadata_flag, null_metadata_flag, ism_imp, element_brate, total_brate, nb_bits_metadata, 0 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_ism_config( *ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, ism_extended_metadata_flag, null_metadata_flag, ism_imp, element_brate, total_brate, nb_bits_metadata, 0 ) ), IVAS_ERR_OK ) ) { return error; } @@ -880,25 +888,33 @@ ivas_error ivas_ism_metadata_enc( IF( hIsmMeta[ch]->ism_metadata_flag == 0 ) { - hIsmMeta[ch]->ism_md_fec_cnt_enc++; + hIsmMeta[ch]->ism_md_fec_cnt_enc = add( hIsmMeta[ch]->ism_md_fec_cnt_enc, 1 ); + move16(); } ELSE { hIsmMeta[ch]->ism_md_fec_cnt_enc = 0; move16(); } - hIsmMeta[ch]->ism_md_inc_diff_cnt++; + hIsmMeta[ch]->ism_md_inc_diff_cnt = add( hIsmMeta[ch]->ism_md_inc_diff_cnt, 1 ); + move16(); hIsmMeta[ch]->ism_md_inc_diff_cnt = s_min( hIsmMeta[ch]->ism_md_inc_diff_cnt, ISM_MD_INC_DIFF_CNT_MAX ); + move16(); } FOR( ch = 0; ch < nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; move16(); + test(); IF( EQ_16( ism_mode, ISM_MODE_DISC ) ) { - IF( EQ_16( ism_imp[ch], ISM_NO_META ) && ( ( LT_32( total_brate[ch], ACELP_8k00 ) && LT_32( element_brate[ch], SCE_CORE_16k_LOW_LIMIT ) ) || - ( LE_32( total_brate[ch], ACELP_16k_LOW_LIMIT ) && GE_32( element_brate[ch], SCE_CORE_16k_LOW_LIMIT ) ) ) ) + test(); + test(); + test(); + test(); + if ( EQ_16( ism_imp[ch], ISM_NO_META ) && ( ( LT_32( total_brate[ch], ACELP_8k00 ) && LT_32( element_brate[ch], SCE_CORE_16k_LOW_LIMIT ) ) || + ( LE_32( total_brate[ch], ACELP_16k_LOW_LIMIT ) && GE_32( element_brate[ch], SCE_CORE_16k_LOW_LIMIT ) ) ) ) { hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; move16(); @@ -909,7 +925,7 @@ ivas_error ivas_ism_metadata_enc( } ELSE IF( EQ_16( ism_mode, ISM_MASA_MODE_DISC ) || EQ_16( ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) ) { - IF( EQ_16( ism_imp[ch], ISM_INACTIVE_IMP ) ) + IF( ism_imp[ch] == ISM_INACTIVE_IMP ) { hSCE[ch]->hCoreCoder[0]->low_rate_mode = 1; move16(); @@ -1818,8 +1834,8 @@ static void encode_radius( move16(); test(); - IF( EQ_16( *radius_diff_cnt, ISM_FEC_MAX ) /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ - || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ + if ( EQ_16( *radius_diff_cnt, ISM_FEC_MAX ) /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ + || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ ) { *flag_abs_radius = 1; @@ -1829,9 +1845,9 @@ static void encode_radius( diff = sub( idx_radius_abs, *last_radius_idx ); /* try differential coding */ - IF( EQ_16( *flag_abs_radius, 0 ) ) + IF( *flag_abs_radius == 0 ) { - IF( EQ_16( diff, 0 ) ) + IF( diff == 0 ) { idx_radius = 0; move16(); @@ -1840,11 +1856,12 @@ static void encode_radius( } ELSE IF( LE_16( ABSVAL( diff ), ISM_MAX_RADIUS_DIFF_IDX ) ) { - idx_radius = shl( 1, 1 ); + idx_radius = 2; // shl( 1, 1 ); + move16(); nbits_diff_radius = 1; move16(); - IF( LT_16( diff, 0 ) ) + IF( diff < 0 ) { idx_radius = add( idx_radius, 1 ); /* negative sign */ diff = imult1616( diff, -1 ); @@ -1876,10 +1893,12 @@ static void encode_radius( } /* update counter */ - IF( EQ_16( *flag_abs_radius, 0 ) ) + IF( *flag_abs_radius == 0 ) { - ( *radius_diff_cnt )++; - *radius_diff_cnt = min( *radius_diff_cnt, ISM_FEC_MAX ); + *radius_diff_cnt = add( *radius_diff_cnt, 1 ); + move16(); + *radius_diff_cnt = s_min( *radius_diff_cnt, ISM_FEC_MAX ); + move16(); } ELSE { @@ -2029,6 +2048,7 @@ static void encode_angle_indices( *----------------------------------------------------------------*/ idx_angle1 = idx_angle1_abs; + move16(); nbits_diff_angle1 = 0; move16(); @@ -2048,7 +2068,7 @@ static void encode_angle_indices( diff = sub( idx_angle1_abs, angle->last_angle1_idx ); /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ - IF( abs( diff ) > ( ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - ISM_MAX_AZIMUTH_DIFF_IDX ) + IF( GT_16( abs_s( diff ), ( ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - ISM_MAX_AZIMUTH_DIFF_IDX ) ) { IF( diff > 0 ) { @@ -2067,9 +2087,10 @@ static void encode_angle_indices( nbits_diff_angle1 = 1; move16(); } - ELSE IF( LT_16( ABSVAL( diff ), ISM_MAX_AZIMUTH_DIFF_IDX ) ) /* when diff bits >= abs bits, prefer abs */ + ELSE IF( LT_16( abs_s( diff ), ISM_MAX_AZIMUTH_DIFF_IDX ) ) /* when diff bits >= abs bits, prefer abs */ { - idx_angle1 = shl( 1, 1 ); + idx_angle1 = 2; // shl( 1, 1 ); + move16(); nbits_diff_angle1 = 1; move16(); @@ -2108,7 +2129,9 @@ static void encode_angle_indices( IF( *flag_abs_angle1 == 0 ) { angle->angle1_diff_cnt = add( angle->angle1_diff_cnt, 1 ); + move16(); angle->angle1_diff_cnt = s_min( angle->angle1_diff_cnt, ISM_FEC_MAX ); + move16(); } ELSE { @@ -2140,8 +2163,8 @@ static void encode_angle_indices( move16(); *flag_abs_angle2 = 0; /* differential coding by default */ move16(); - IF( EQ_16( angle->angle2_diff_cnt, ISM_FEC_MAX ) /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ - || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ + if ( EQ_16( angle->angle2_diff_cnt, ISM_FEC_MAX ) /* make differential encoding in ISM_FEC_MAX consecutive frames at maximum (in order to control the decoding in FEC) */ + || last_ism_metadata_flag == 0 /* If last frame had no metadata coded, do not use differential coding */ ) { *flag_abs_angle2 = 1; @@ -2170,14 +2193,15 @@ static void encode_angle_indices( IF( diff >= 0 ) { - diff = min( diff, ISM_MAX_ELEVATION_DIFF_IDX ); + diff = s_min( diff, ISM_MAX_ELEVATION_DIFF_IDX ); } ELSE { - diff = imult1616( -1, min( -diff, ISM_MAX_ELEVATION_DIFF_IDX ) ); + diff = imult1616( -1, s_min( -diff, ISM_MAX_ELEVATION_DIFF_IDX ) ); } - IF( last_ism_metadata_flag == 0 || abs( diff_orig - diff ) > ISM_MAX_ELEVATION_DIFF_IDX ) + test(); + if ( last_ism_metadata_flag == 0 || GT_16( abs_s( sub( diff_orig, diff ) ), ISM_MAX_ELEVATION_DIFF_IDX ) ) { angle->angle2_diff_cnt = ISM_FEC_MAX - 1; move16(); @@ -2194,9 +2218,10 @@ static void encode_angle_indices( nbits_diff_angle2 = 1; move16(); } - ELSE IF( LE_16( ABSVAL( diff ), ISM_MAX_ELEVATION_DIFF_IDX ) ) + ELSE IF( LE_16( abs_s( diff ), ISM_MAX_ELEVATION_DIFF_IDX ) ) { - idx_angle2 = shl( 1, 1 ); + idx_angle2 = 2; // shl( 1, 1 ); + move16(); nbits_diff_angle2 = 1; move16(); @@ -2235,7 +2260,9 @@ static void encode_angle_indices( IF( *flag_abs_angle2 == 0 ) { angle->angle2_diff_cnt = add( angle->angle2_diff_cnt, 1 ); + move16(); angle->angle2_diff_cnt = s_min( angle->angle2_diff_cnt, ISM_FEC_MAX ); + move16(); } ELSE { @@ -2542,8 +2569,10 @@ void ivas_ism_metadata_sid_enc( IF( sid_flag ) { nBits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + move16(); nBits = sub( nBits, SID_FORMAT_NBITS ); nBits_start = hBstr->nb_bits_tot; + move16(); /*----------------------------------------------------------------* * Write ISm common signaling @@ -2589,6 +2618,7 @@ void ivas_ism_metadata_sid_enc( /* write noisy speech flag */ push_indice( hBstr, IND_ISM_NOISY_SPEECH_FLAG, flag_noisy_speech, 1 ); nBits_sce_id = 1; + move16(); } } @@ -2606,7 +2636,7 @@ void ivas_ism_metadata_sid_enc( } Word32 tmp = Mpy_32_32( L_shr( L_deposit_h( hISMDTX->coh_fx[ch] ), 1 ) /*Q30*/, L_deposit_h( sub( shl( 1, nBits_coh ), 1 ) ) ); // Q15 Word32 tmp_2 = L_add( tmp, 16384 /*0.5f in Q15*/ ); - idx = (Word16) L_shr( tmp_2, Q15 ); + idx = extract_l( L_shr( tmp_2, Q15 ) ); // idx = (Word16) ( hISMDTX->coh[ch] * sub( shl( 1, nBits_coh ), 1 ) + 0.5f ); assert( ( idx >= 0 ) && ( idx <= ( ( 1 << nBits_coh ) - 1 ) ) ); push_indice( hBstr, IND_ISM_DTX_COH_SCA, idx, nBits_coh ); @@ -2619,17 +2649,12 @@ void ivas_ism_metadata_sid_enc( FOR( ch = 0; ch < nchan_ism; ch++ ) { - IF( md_diff_flag[ch] == 1 ) + IF( EQ_16( md_diff_flag[ch], 1 ) ) { hIsmMetaData = hIsmMeta[ch]; -#ifdef IVAS_FLOAT_FIXED - idx_azimuth = ism_quant_meta_fx( hIsmMetaData->azimuth_fx, &valQ_fx, ism_azimuth_borders_fx, q_step_fx, q_step_border_fx, 1 << nBits_azimuth ); - idx_elevation = ism_quant_meta_fx( hIsmMetaData->elevation_fx, &valQ_fx, ism_elevation_borders_fx, q_step_fx, q_step_border_fx, 1 << nBits_elevation ); -#else - idx_azimuth = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth ); - idx_elevation = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation ); -#endif + idx_azimuth = ism_quant_meta_fx( hIsmMetaData->azimuth_fx, &valQ_fx, ism_azimuth_borders_fx, q_step_fx, q_step_border_fx, shl( 1, nBits_azimuth ) ); + idx_elevation = ism_quant_meta_fx( hIsmMetaData->elevation_fx, &valQ_fx, ism_elevation_borders_fx, q_step_fx, q_step_border_fx, shl( 1, nBits_elevation ) ); push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nBits_azimuth ); push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nBits_elevation ); @@ -2637,16 +2662,22 @@ void ivas_ism_metadata_sid_enc( IF( GT_16( nBits_azimuth, ISM_AZIMUTH_NBITS ) ) { hIsmMetaData->position_angle.last_angle1_idx = shr( idx_azimuth, sub( nBits_azimuth, ISM_AZIMUTH_NBITS ) ); + move16(); hIsmMetaData->position_angle.last_angle2_idx = shr( idx_elevation, sub( nBits_elevation, ISM_ELEVATION_NBITS ) ); + move16(); } ELSE { hIsmMetaData->position_angle.last_angle1_idx = shl( idx_azimuth, sub( ISM_AZIMUTH_NBITS, nBits_azimuth ) ); + move16(); hIsmMetaData->position_angle.last_angle2_idx = shl( idx_elevation, sub( ISM_ELEVATION_NBITS, nBits_elevation ) ); + move16(); } hIsmMetaData->ism_md_fec_cnt_enc = 0; + move16(); hIsmMeta[ch]->ism_md_inc_diff_cnt = ISM_MD_INC_DIFF_CNT_MAX; + move16(); } } @@ -2654,12 +2685,13 @@ void ivas_ism_metadata_sid_enc( nBits_unused = sub( nBits, hBstr->nb_bits_tot ); WHILE( nBits_unused > 0 ) { - i = min( nBits_unused, 16 ); + i = s_min( nBits_unused, 16 ); push_indice( hBstr, IND_UNUSED, 0, i ); nBits_unused = sub( nBits_unused, i ); } nb_bits_metadata[0] = sub( hBstr->nb_bits_tot, nBits_start ); + move16(); } return; diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index d1b83331ef933735bbb16814b6a2a3fd163e19c5..6c3fc8ece5c273de196358e6d05d436ff26b5c8c 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -803,13 +803,13 @@ ivas_error ivas_param_ism_enc_open( /* set FB config. */ - IF( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs, 0 ) ), IVAS_ERR_OK ) ) { return error; } /* Allocate and initialize FB mixer handle */ - IF( ( error = ivas_FB_mixer_open_fx( &( hParamIsm->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_FB_mixer_open_fx( &( hParamIsm->hFbMixer ), input_Fs, fb_cfg, 0 ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c index ced67ef50ec705e9330dfb0e8789ffd3f0fcf178..5127a97970dbcec4c6b4e1b55d1c66645d8a90ab 100644 --- a/lib_enc/ivas_lfe_enc.c +++ b/lib_enc/ivas_lfe_enc.c @@ -102,7 +102,6 @@ static void ivas_lfe_arith_coding_fx( num_groups = shr( ivas_lfe_num_dct_pass_bins_tbl[quant_strategy], 1 ); move16(); move16(); - move16(); FOR( i = 0; i < num_groups; i++ ) { @@ -113,9 +112,9 @@ static void ivas_lfe_arith_coding_fx( FOR( index = 0; index < num_ele_per_grp; index++ ) { - IF( values[index + offset] > max_value ) + if ( GT_16( values[index + offset], max_value ) ) { - values[add( index, offset )] = max_value; + values[index + offset] = max_value; move16(); } ivas_ari_encode_14bits_ext_fx( hBstr, &as, values[index + offset], hLFE->cum_freq_models[quant_strategy][i] ); @@ -206,11 +205,7 @@ static void ivas_lfe_enc_quant( } else { -#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT shift = (int16_t) floorf( IVAS_LFE_SHIFTS_PER_DOUBLE * log2_f( max_value / lfe_abs_sum ) ); -#else - shift = (int16_t) floor( IVAS_LFE_SHIFTS_PER_DOUBLE * log2_f( max_value / lfe_abs_sum ) ); -#endif } shift = max( min_shift * IVAS_LFE_SHIFTS_PER_DOUBLE, min( max_shift, shift ) ); @@ -428,8 +423,8 @@ static void ivas_lfe_enc_quant_fx( move16(); min_shift = ivas_lfe_min_shift_tbl[quant_strategy]; move16(); - max_shift = (UWord16) L_add( min_shift * IVAS_LFE_SHIFTS_PER_DOUBLE, sub( shl( 1, shift_bits ), 1 ) ); - num_lfe_ele = num_dct_pass_bins * IVAS_LFE_NUM_COEFFS_IN_SUBGRP; + max_shift = (UWord16) L_add( L_mult0( min_shift, IVAS_LFE_SHIFTS_PER_DOUBLE ), sub( shl( 1, shift_bits ), 1 ) ); + num_lfe_ele = imult1616( num_dct_pass_bins, IVAS_LFE_NUM_COEFFS_IN_SUBGRP ); move16(); all_zeros_dct = 0; move16(); @@ -483,7 +478,7 @@ static void ivas_lfe_enc_quant_fx( shift = extract_l( L_shr( tmp, 10 ) ); /* Q0 */ } - shift = max( min_shift * IVAS_LFE_SHIFTS_PER_DOUBLE, min( max_shift, shift ) ); + shift = s_max( imult1616( min_shift, IVAS_LFE_SHIFTS_PER_DOUBLE ), s_min( max_shift, shift ) ); move16(); WHILE( 1 ) @@ -510,7 +505,7 @@ static void ivas_lfe_enc_quant_fx( tmp = Mpy_32_32( temp_lfe_dct[i], tmp ); /* q_tmp + q_pLfe_dct - 31 */ q_tmp = sub( add( q_tmp, q_pLfe_dct ), 31 ); - IF( LT_32( tmp, 0 ) ) + IF( tmp < 0 ) { values[i] = add( extract_l( L_shr( L_sub( tmp, L_shl( 1 /*0.5 Q1-> 1*/, sub( q_tmp, 1 ) ) ), q_tmp ) ), 1 ); move16(); @@ -550,16 +545,18 @@ static void ivas_lfe_enc_quant_fx( { push_next_indice( hBstr, all_zeros_dct, 1 ); hLFE->lfe_bits = sub( hBstr->nb_bits_tot, bits_written ); + move16(); return; } FOR( i = 0; i < num_lfe_ele; i++ ) { - IF( LT_16( values[i], 0 ) ) + IF( values[i] < 0 ) { write_bit = 1; move16(); values[i] = add( values[i], 1 ); + move16(); } ELSE { @@ -567,7 +564,7 @@ static void ivas_lfe_enc_quant_fx( move16(); } - values[i] = (Word16) abs( values[i] ); + values[i] = abs_s( values[i] ); move16(); push_next_indice( hBstr, write_bit, 1 ); @@ -612,16 +609,16 @@ static void ivas_lfe_enc_quant_fx( { Word16 base2_write_bits = hLFE->lfe_enc_indices_coeffs_tbl[quant_strategy][i]; move16(); - Word16 offset = 4 * i; + Word16 offset = imult1616( 4, i ); move16(); max_value = ivas_lfe_num_ele_in_coder_models[quant_strategy][i]; move16(); FOR( j = 0; j < num_ele_per_grp; j++ ) { - IF( values[L_add( j, offset )] > max_value ) + if ( GT_16( values[j + offset], max_value ) ) { - values[L_add( j, offset )] = max_value; + values[j + offset] = max_value; move16(); } push_next_indice( hBstr, values[j + offset], base2_write_bits ); @@ -657,6 +654,7 @@ static void ivas_lfe_enc_quant_fx( /* bits spent for LFE coding */ hLFE->lfe_bits = sub( hBstr->nb_bits_tot, bits_written ); + move16(); return; } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 0faf067787846c20caaa47c8ee3898f7dae047fd..7437ccd5cc8d6379c38d780610cf7a64bc6e1d06 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -209,7 +209,7 @@ ivas_error ivas_masa_enc_open( FOR( i = 0; i < hMasa->data.num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_enc( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = openCldfb_ivas_enc( &( hMasa->data.cldfbAnaEnc[i] ), CLDFB_ANALYSIS, hEncoderConfig->input_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) { return error; } @@ -1730,14 +1730,14 @@ ivas_error ivas_masa_enc_config_fx( test(); IF( EQ_16( hMasa->config.numberOfDirections, 2 ) && hMasa->config.numTwoDirBands != 0 ) { - IF( ( error = ivas_qmetadata_allocate_memory( hQMetaData, hMasa->config.numCodingBands, 2, hMasa->config.useCoherence ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_qmetadata_allocate_memory( hQMetaData, hMasa->config.numCodingBands, 2, hMasa->config.useCoherence ) ), IVAS_ERR_OK ) ) { return error; } } ELSE { - IF( ( error = ivas_qmetadata_allocate_memory( hQMetaData, hMasa->config.numCodingBands, 1, hMasa->config.useCoherence ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_qmetadata_allocate_memory( hQMetaData, hMasa->config.numCodingBands, 1, hMasa->config.useCoherence ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index 1fbfa6ae0e6259215676423b217286837f0a8ac1..aa14cf8a3226afec2906de851134c1cbb1f9e012 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -54,13 +54,6 @@ * Local function prototypes *------------------------------------------------------------------------*/ - -#ifndef FIX_901_PARAMMC_DEAD_CODE -static void ivas_param_mc_enc_find_icc_map( PARAM_MC_ENC_HANDLE hParamMC, float Cx_sum[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], float Cy_sum[][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], float ILD_q[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_SZ_ILD_MAP], const int16_t nchan_input, const int16_t nchan_transport ); - -#endif - - static void ivas_param_mc_write_bs( const PARAM_MC_ENC_HANDLE hParamMC, int16_t *ILD_idx, int16_t *ICC_idx, uint16_t bit_buffer[PARAM_MC_MAX_BITS], int16_t *bit_pos ); static void ivas_param_mc_dec2bin( const int16_t val, const int16_t N, uint16_t bits[PARAM_MC_MAX_BITS] ); @@ -112,9 +105,6 @@ ivas_error ivas_param_mc_enc_open_fx( ) { Word16 i; -#ifndef FIX_901_PARAMMC_DEAD_CODE - int16_t k, l; -#endif IVAS_FB_CFG *fb_cfg; PARAM_MC_ENC_HANDLE hParamMC; UWord16 config_index; @@ -191,29 +181,7 @@ ivas_error ivas_param_mc_enc_open_fx( } /* open/init parameter coding */ -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_open( mc_input_setup, hParamMC->lfe_index, ivas_total_brate, &hParamMC->hMetadataPMC ); -#else ivas_param_mc_metadata_open_fx( mc_input_setup, ivas_total_brate, &hParamMC->hMetadataPMC ); -#endif -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* init icc index states */ - for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) - { - set_s( hParamMC->icc_map_index[i], -1, PARAM_MC_SZ_ICC_MAP ); - - for ( l = 0; l < hParamMC->hMetadataPMC.icc_mapping_conf->icc_map_size_lfe; l++ ) - { - for ( k = 0; k < hParamMC->hMetadataPMC.icc_map_size_full; k++ ) - { - if ( hParamMC->hMetadataPMC.icc_mapping[i][l][0] == hParamMC->hMetadataPMC.icc_map_full[0][k] && hParamMC->hMetadataPMC.icc_mapping[i][l][1] == hParamMC->hMetadataPMC.icc_map_full[1][k] ) - { - hParamMC->icc_map_index[i][l] = k; - } - } - } - } -#endif /* Band Grouping */ IF( EQ_16( hParamMC->hMetadataPMC.num_parameter_bands, 20 ) ) @@ -285,9 +253,6 @@ ivas_error ivas_param_mc_enc_open( ) { int16_t i; -#ifndef FIX_901_PARAMMC_DEAD_CODE - int16_t k, l; -#endif IVAS_FB_CFG *fb_cfg; PARAM_MC_ENC_HANDLE hParamMC; uint16_t config_index; @@ -352,29 +317,7 @@ ivas_error ivas_param_mc_enc_open( } /* open/init parameter coding */ -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_open( mc_input_setup, hParamMC->lfe_index, ivas_total_brate, &hParamMC->hMetadataPMC ); -#else ivas_param_mc_metadata_open( mc_input_setup, ivas_total_brate, &hParamMC->hMetadataPMC ); -#endif -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* init icc index states */ - for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) - { - set_s( hParamMC->icc_map_index[i], -1, PARAM_MC_SZ_ICC_MAP ); - - for ( l = 0; l < hParamMC->hMetadataPMC.icc_mapping_conf->icc_map_size_lfe; l++ ) - { - for ( k = 0; k < hParamMC->hMetadataPMC.icc_map_size_full; k++ ) - { - if ( hParamMC->hMetadataPMC.icc_mapping[i][l][0] == hParamMC->hMetadataPMC.icc_map_full[0][k] && hParamMC->hMetadataPMC.icc_mapping[i][l][1] == hParamMC->hMetadataPMC.icc_map_full[1][k] ) - { - hParamMC->icc_map_index[i][l] = k; - } - } - } - } -#endif /* Band Grouping */ if ( hParamMC->hMetadataPMC.num_parameter_bands == 20 ) @@ -449,9 +392,6 @@ ivas_error ivas_param_mc_enc_reconfig_fx( ) { Word16 i; -#ifndef FIX_901_PARAMMC_DEAD_CODE - int16_t k, l; -#endif PARAM_MC_ENC_HANDLE hParamMC; UWord16 config_index; MC_LS_SETUP mc_input_setup; @@ -505,44 +445,9 @@ ivas_error ivas_param_mc_enc_reconfig_fx( /* get dmx factors */ hParamMC->dmx_factors_fx = ivas_param_mc_conf[config_index].dmx_fac_fx; -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* deallocate the full icc map, gets newly allocated in the metadata open function */ - for ( i = 0; i < 2; i++ ) - { - if ( hParamMC->hMetadataPMC.icc_map_full[i] != NULL ) - { - free( hParamMC->hMetadataPMC.icc_map_full[i] ); - hParamMC->hMetadataPMC.icc_map_full[i] = NULL; - } - } - -#endif /* open/init parameter coding */ -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_open( mc_input_setup, hParamMC->lfe_index, ivas_total_brate, &hParamMC->hMetadataPMC ); -#else ivas_param_mc_metadata_open_fx( mc_input_setup, ivas_total_brate, &hParamMC->hMetadataPMC ); -#endif - -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* init icc index states */ - for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) - { - set_s( hParamMC->icc_map_index[i], -1, PARAM_MC_SZ_ICC_MAP ); - for ( l = 0; l < hParamMC->hMetadataPMC.icc_mapping_conf->icc_map_size_lfe; l++ ) - { - for ( k = 0; k < hParamMC->hMetadataPMC.icc_map_size_full; k++ ) - { - if ( hParamMC->hMetadataPMC.icc_mapping[i][l][0] == hParamMC->hMetadataPMC.icc_map_full[0][k] && hParamMC->hMetadataPMC.icc_mapping[i][l][1] == hParamMC->hMetadataPMC.icc_map_full[1][k] ) - { - hParamMC->icc_map_index[i][l] = k; - } - } - } - } - -#endif /* Band Grouping */ IF( EQ_16( hParamMC->hMetadataPMC.num_parameter_bands, 20 ) ) { @@ -606,9 +511,6 @@ ivas_error ivas_param_mc_enc_reconfig( ) { int16_t i; -#ifndef FIX_901_PARAMMC_DEAD_CODE - int16_t k, l; -#endif PARAM_MC_ENC_HANDLE hParamMC; uint16_t config_index; MC_LS_SETUP mc_input_setup; @@ -652,44 +554,9 @@ ivas_error ivas_param_mc_enc_reconfig( hParamMC->dmx_factors_fx = ivas_param_mc_conf[config_index].dmx_fac_fx; #endif -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* deallocate the full icc map, gets newly allocated in the metadata open function */ - for ( i = 0; i < 2; i++ ) - { - if ( hParamMC->hMetadataPMC.icc_map_full[i] != NULL ) - { - free( hParamMC->hMetadataPMC.icc_map_full[i] ); - hParamMC->hMetadataPMC.icc_map_full[i] = NULL; - } - } - -#endif /* open/init parameter coding */ -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_open( mc_input_setup, hParamMC->lfe_index, ivas_total_brate, &hParamMC->hMetadataPMC ); -#else ivas_param_mc_metadata_open( mc_input_setup, ivas_total_brate, &hParamMC->hMetadataPMC ); -#endif - -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* init icc index states */ - for ( i = 0; i < PARAM_MC_PARAMETER_FRAMES; i++ ) - { - set_s( hParamMC->icc_map_index[i], -1, PARAM_MC_SZ_ICC_MAP ); - - for ( l = 0; l < hParamMC->hMetadataPMC.icc_mapping_conf->icc_map_size_lfe; l++ ) - { - for ( k = 0; k < hParamMC->hMetadataPMC.icc_map_size_full; k++ ) - { - if ( hParamMC->hMetadataPMC.icc_mapping[i][l][0] == hParamMC->hMetadataPMC.icc_map_full[0][k] && hParamMC->hMetadataPMC.icc_mapping[i][l][1] == hParamMC->hMetadataPMC.icc_map_full[1][k] ) - { - hParamMC->icc_map_index[i][l] = k; - } - } - } - } -#endif /* Band Grouping */ if ( hParamMC->hMetadataPMC.num_parameter_bands == 20 ) { @@ -758,9 +625,6 @@ void ivas_param_mc_enc_close_fx( return; } -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_close( &( *hParamMC )->hMetadataPMC ); -#endif ivas_FB_mixer_close_fx( &( *hParamMC )->hFbMixer, sampling_rate, 0 ); free( ( *hParamMC ) ); @@ -778,9 +642,6 @@ void ivas_param_mc_enc_close( return; } -#ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_close( &( *hParamMC )->hMetadataPMC ); -#endif ivas_FB_mixer_close( &( *hParamMC )->hFbMixer, sampling_rate, 0 ); free( ( *hParamMC ) ); @@ -937,18 +798,6 @@ void ivas_param_mc_enc_fx( ivas_param_mc_quantize_ilds_fx( hParamMC, Cy_sum_fx[k], Cy_sum_e[k], Cx_sum_fx[k], Cx_sum_e[k], k, nchan_inp, st_ivas->nchan_transport, ILD_idx, ILD_q_fx[k] ); } -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* get icc map */ - if ( hParamMC->hMetadataPMC.flag_use_adaptive_icc_map == 1 ) - { - ivas_param_mc_enc_find_icc_map( hParamMC, Cx_sum, Cy_sum, ILD_q, nchan_inp, st_ivas->nchan_transport ); - } - else - { - ivas_param_mc_default_icc_map( hParamMC->hMetadataPMC.icc_mapping_conf, hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx] ); - } - -#endif /* ICC parameter quantization */ FOR( k = 0; k < hParamMC->hMetadataPMC.nbands_coded; k += band_step ) { @@ -1163,18 +1012,6 @@ void ivas_param_mc_enc( ivas_param_mc_quantize_ilds( hParamMC, Cy_sum[k], Cx_sum[k], k, nchan_inp, st_ivas->nchan_transport, ILD_idx, ILD_q[k] ); } -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* get icc map */ - if ( hParamMC->hMetadataPMC.flag_use_adaptive_icc_map == 1 ) - { - ivas_param_mc_enc_find_icc_map( hParamMC, Cx_sum, Cy_sum, ILD_q, nchan_inp, st_ivas->nchan_transport ); - } - else - { - ivas_param_mc_default_icc_map( hParamMC->hMetadataPMC.icc_mapping_conf, hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx] ); - } - -#endif /* ICC parameter quantization */ for ( k = 0; k < hParamMC->hMetadataPMC.nbands_coded; k += band_step ) { @@ -2299,231 +2136,6 @@ static void ivas_param_mc_param_est_enc( } #endif -#ifndef FIX_901_PARAMMC_DEAD_CODE -/*------------------------------------------------------------------------- - * ivas_param_mc_enc_find_icc_map() - * - * decide which ICCs out of all possible ICCs should be sent - *------------------------------------------------------------------------*/ - -static void ivas_param_mc_enc_find_icc_map( - PARAM_MC_ENC_HANDLE hParamMC, /* i/o: Parametric MC encoder handle */ - float Cx_sum[][PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_TRANSPORT_CHANS], /* i : Covariance matrix for the downmixed frame */ - float Cy_sum[][MAX_CICP_CHANNELS][MAX_CICP_CHANNELS], /* i : Covariance matrix for the original frame */ - float ILD_q[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_SZ_ILD_MAP], /* i : quantized ILDs */ - const int16_t nchan_input, /* i : number of input channels */ - const int16_t nchan_transport /* i : number of transport channels */ -) -{ - float Cproto_band[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - float Cx_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - float mat_mult_buffer1[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - float mapped_error[55]; /* max number of possible mappings for 7.1+4 */ - int16_t icc_map_index[PARAM_MC_SZ_ICC_MAP]; - int16_t map_idx; - float *sorted_error_desc[PARAM_MC_SZ_ICC_MAP]; - int16_t cur_param_band, k, m, i; - int16_t bandstep; - int16_t last_element, el; - int16_t num_parameter_bands; - int16_t ch_idx1, ch_idx2; - int16_t icc_map_size; - int16_t icc_map_size_wo_lfe; - float Nrqq[MAX_OUTPUT_CHANNELS]; - float a[MAX_OUTPUT_CHANNELS]; - float Cy_band[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; - - /* Initialisations */ - num_parameter_bands = hParamMC->hMetadataPMC.nbands_coded; - bandstep = hParamMC->hMetadataPMC.bAttackPresent ? 2 : 1; - set_f( mapped_error, 0.0f, 55 ); - set_s( icc_map_index, -1, PARAM_MC_SZ_ICC_MAP ); - icc_map_size_wo_lfe = hParamMC->hMetadataPMC.icc_mapping_conf->icc_map_size_wo_lfe; - icc_map_size = hParamMC->hMetadataPMC.icc_mapping_conf->icc_map_size_lfe; - - set_zero( Cy_band, nchan_input * nchan_input ); - - /* Estimate the target covariance like in the decoder using the - * already available qunantised ICLDs */ - for ( cur_param_band = 0; cur_param_band < num_parameter_bands; cur_param_band += bandstep ) - { - if ( hParamMC->hMetadataPMC.bAttackPresent || hParamMC->hMetadataPMC.coding_band_mapping[cur_param_band] == hParamMC->hMetadataPMC.param_frame_idx ) - { - /* transfer Cx_sum band to columnwise matrix */ - for ( ch_idx1 = 0; ch_idx1 < nchan_transport; ++ch_idx1 ) - { - for ( ch_idx2 = 0; ch_idx2 < nchan_transport; ++ch_idx2 ) - { - Cx_band[ch_idx1 + nchan_transport * ch_idx2] = Cx_sum[cur_param_band][ch_idx1][ch_idx2]; - } - } - - /* get estimated Cy from Cx and proto matrix */ - matrix_product( hParamMC->dmx_factors, nchan_input, nchan_transport, 0, - Cx_band, nchan_transport, nchan_transport, 0, - mat_mult_buffer1 ); - - matrix_product( mat_mult_buffer1, nchan_input, nchan_transport, 0, - hParamMC->dmx_factors, nchan_input, nchan_transport, 1, - Cproto_band ); - - set_zero( Nrqq, MAX_OUTPUT_CHANNELS ); - - /*get back Nrg*/ - for ( k = 0; k < nchan_input; k++ ) - { - float ref_ener = 0.0f; - int16_t ref_channel_cnt; - int16_t ref_channel_idx; - - for ( ref_channel_cnt = 0; ref_channel_cnt < hParamMC->hMetadataPMC.ild_mapping_conf->num_ref_channels[k]; ref_channel_cnt++ ) - { - ref_channel_idx = hParamMC->hMetadataPMC.ild_mapping_conf->ref_channel_idx[k][ref_channel_cnt]; - ref_ener += Cx_band[ref_channel_idx + ref_channel_idx * nchan_transport]; - } - Nrqq[hParamMC->hMetadataPMC.ild_mapping_conf->ild_index[k]] = powf( 10, ILD_q[cur_param_band][k] / 10.0f ) * hParamMC->hMetadataPMC.ild_factors[k] * ref_ener; - } - - /* apply quantized ICLDs in the estimated covariance */ - for ( k = 0; k < nchan_input; k++ ) - { - a[k] = sqrtf( Nrqq[k] ) / ( sqrtf( Cproto_band[k + nchan_input * k] ) + EPSILON ); - v_multc( Cproto_band + k * nchan_input, a[k], Cproto_band + k * nchan_input, nchan_input ); - } - - for ( k = 0; k < nchan_input; k++ ) - { - int16_t l; - float *Cyp = Cproto_band + k; - float ap = a[k]; - - for ( l = 0; l < nchan_input; l++ ) - { - ( *Cyp ) *= ap; - Cyp += nchan_input; - } - } - - /* transfer Cy_sum band to columnwise matrix */ - for ( ch_idx1 = 0; ch_idx1 < nchan_input; ++ch_idx1 ) - { - for ( ch_idx2 = 0; ch_idx2 < nchan_input; ++ch_idx2 ) - { - Cy_band[ch_idx1 + nchan_transport * ch_idx2] = Cy_sum[cur_param_band][ch_idx1][ch_idx2]; - } - } - - /* apply quantized ICLDs on the input covariance */ - for ( k = 0; k < nchan_input; k++ ) - { - a[k] = sqrtf( Nrqq[k] ) / ( sqrtf( Cy_band[k + nchan_input * k] ) + EPSILON ); - v_multc( Cy_band + k * nchan_input, a[k], Cy_band + k * nchan_input, nchan_input ); - } - - for ( k = 0; k < nchan_input; k++ ) - { - int16_t l; - float *Cyp = Cy_band + k; - float ap = a[k]; - - for ( l = 0; l < nchan_input; l++ ) - { - ( *Cyp ) *= ap; - Cyp += nchan_input; - } - } - - /* for all possible mappings, get the cumulated error between estimated and real Cy */ - for ( map_idx = 0; map_idx < hParamMC->hMetadataPMC.icc_map_size_full - 1; map_idx++ ) - { - int16_t idx0 = hParamMC->hMetadataPMC.icc_map_full[0][map_idx]; - int16_t idx1 = hParamMC->hMetadataPMC.icc_map_full[1][map_idx]; - mapped_error[map_idx] += fabsf( Cproto_band[idx0 + idx1 * nchan_input] - Cy_band[idx0 + idx1 * nchan_input] ); - } - } - } - - /* put a small bias on the error for the past transmitted indices*/ - if ( !hParamMC->hMetadataPMC.bAttackPresent ) - { - for ( i = 0; i < icc_map_size_wo_lfe; i++ ) - { - mapped_error[hParamMC->icc_map_index[hParamMC->hMetadataPMC.param_frame_idx][i]] *= PARAM_MC_ICC_ERROR_BIAS_FAC; - } - } - - /* get the mappings with the biggest expected errors as those who will be transmitted */ - for ( i = 0; i < hParamMC->hMetadataPMC.icc_map_size_full - 1; i++ ) - { - for ( k = 0; k < icc_map_size_wo_lfe; k++ ) - { - if ( icc_map_index[k] == -1 ) - { - /* not filled yet, take the value */ - icc_map_index[k] = i; - sorted_error_desc[k] = &mapped_error[i]; - break; - } - else if ( mapped_error[i] > *sorted_error_desc[k] ) - { - /* push all others down and insert value here */ - for ( m = icc_map_size_wo_lfe - 1; m >= k + 1; m-- ) - { - icc_map_index[m] = icc_map_index[m - 1]; - sorted_error_desc[m] = sorted_error_desc[m - 1]; - } - icc_map_index[k] = i; - sorted_error_desc[k] = &mapped_error[i]; - break; - } - } - } - - /* the indices in ascending order, simple bubble sort */ - for ( last_element = icc_map_size_wo_lfe - 1; last_element >= 0; last_element-- ) - { - for ( el = 0; el < last_element; el++ ) - { - if ( icc_map_index[el] > icc_map_index[el + 1] ) - { - int16_t swp_el = icc_map_index[el]; - icc_map_index[el] = icc_map_index[el + 1]; - icc_map_index[el + 1] = swp_el; - } - } - } - - /* last icc map element is always the C/LFE icc */ - icc_map_index[icc_map_size - 1] = hParamMC->hMetadataPMC.icc_map_size_full - 1; - - /* create map and map index, map index is sorted in ascending order*/ - if ( hParamMC->hMetadataPMC.bAttackPresent ) - { - for ( k = 0; k < PARAM_MC_PARAMETER_FRAMES; k++ ) - { - for ( i = 0; i < icc_map_size; i++ ) - { - hParamMC->hMetadataPMC.icc_mapping[k][i][0] = hParamMC->hMetadataPMC.icc_map_full[0][icc_map_index[i]]; - hParamMC->hMetadataPMC.icc_mapping[k][i][1] = hParamMC->hMetadataPMC.icc_map_full[1][icc_map_index[i]]; - } - mvs2s( icc_map_index, hParamMC->icc_map_index[k], icc_map_size ); - } - } - else - { - for ( i = 0; i < icc_map_size; i++ ) - { - hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx][i][0] = hParamMC->hMetadataPMC.icc_map_full[0][icc_map_index[i]]; - hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx][i][1] = hParamMC->hMetadataPMC.icc_map_full[1][icc_map_index[i]]; - } - - mvs2s( icc_map_index, hParamMC->icc_map_index[hParamMC->hMetadataPMC.param_frame_idx], icc_map_size ); - } - - return; -} -#endif - /*------------------------------------------------------------------------- * ivas_param_mc_quantize_ilds() * @@ -3022,15 +2634,10 @@ static void ivas_param_mc_quantize_iccs_fx( /* Reduce set of parameters and quantize them */ FOR( k = 0; k < num_iccs_to_code; ++k ) { -#ifndef FIX_901_PARAMMC_DEAD_CODE - tmp_map[0] = hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx][k][0]; - tmp_map[1] = hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx][k][1]; -#else tmp_map[0] = hParamMC->hMetadataPMC.icc_mapping_conf->icc_mapping[k][0]; move16(); tmp_map[1] = hParamMC->hMetadataPMC.icc_mapping_conf->icc_mapping[k][1]; move16(); -#endif ICC_vect_fx[k] = Cy_fx[tmp_map[0]][tmp_map[1]]; move32(); ICC_vect_e[k] = Cy_e[tmp_map[0]][tmp_map[1]]; @@ -3123,13 +2730,8 @@ static void ivas_param_mc_quantize_iccs( /* Reduce set of parameters and quantize them */ for ( k = 0; k < num_iccs_to_code; ++k ) { -#ifndef FIX_901_PARAMMC_DEAD_CODE - tmp_map[0] = hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx][k][0]; - tmp_map[1] = hParamMC->hMetadataPMC.icc_mapping[hParamMC->hMetadataPMC.param_frame_idx][k][1]; -#else tmp_map[0] = hParamMC->hMetadataPMC.icc_mapping_conf->icc_mapping[k][0]; tmp_map[1] = hParamMC->hMetadataPMC.icc_mapping_conf->icc_mapping[k][1]; -#endif ICC_vect[k] = Cy[tmp_map[0]][tmp_map[1]]; } @@ -3444,26 +3046,6 @@ static void ivas_param_mc_write_bs( } } -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* Encoding of the ICC mapping done as simple bitmap */ - if ( hParamMC->hMetadataPMC.flag_use_adaptive_icc_map == 1 ) - { - uint16_t *bit_buffer_icc_mapping = &bit_buffer[*bit_pos]; - - for ( i = 0; i < hParamMC->hMetadataPMC.icc_map_size_full - 1; i++ ) - { - bit_buffer_icc_mapping[i] = 0; - } - - for ( i = 0; i < icc_map_size_wo_lfe; i++ ) - { - bit_buffer_icc_mapping[hParamMC->icc_map_index[hParamMC->hMetadataPMC.param_frame_idx][i]] = 1; - } - - *bit_pos += hParamMC->hMetadataPMC.icc_map_size_full - 1; - } - -#endif ivas_param_mc_encode_parameter( ICC_idx, &hParamMC->hMetadataPMC, &hParamMC->hMetadataPMC.icc_coding, nbands, band_step, icc_map_size_wo_lfe, icc_map_size, bit_buffer, bit_pos ); @@ -3534,26 +3116,6 @@ static void ivas_param_mc_write_bs( nbands = hParamMC->hMetadataPMC.nbands_coded / band_step + ( ( hParamMC->hMetadataPMC.nbands_coded % band_step ) ? 1 : 0 ); } -#ifndef FIX_901_PARAMMC_DEAD_CODE - /* Encoding of the ICC mapping done as simple bitmap */ - if ( hParamMC->hMetadataPMC.flag_use_adaptive_icc_map == 1 ) - { - uint16_t *bit_buffer_icc_mapping = &bit_buffer[*bit_pos]; - - for ( i = 0; i < hParamMC->hMetadataPMC.icc_map_size_full - 1; i++ ) - { - bit_buffer_icc_mapping[i] = 0; - } - - for ( i = 0; i < icc_map_size_wo_lfe; i++ ) - { - bit_buffer_icc_mapping[hParamMC->icc_map_index[hParamMC->hMetadataPMC.param_frame_idx][i]] = 1; - } - - *bit_pos += hParamMC->hMetadataPMC.icc_map_size_full - 1; - } - -#endif ivas_param_mc_encode_parameter( ICC_idx, &hParamMC->hMetadataPMC, &hParamMC->hMetadataPMC.icc_coding, nbands, band_step, icc_map_size_wo_lfe, icc_map_size, bit_buffer, bit_pos ); diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c index 335ef7b9113742f5eb859c2bc7f2d8ca849b955c..c48a0a9c4e97cec54038e86c01512a6e747af4cc 100644 --- a/lib_enc/ivas_mc_paramupmix_enc.c +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -258,7 +258,7 @@ ivas_error ivas_mc_paramupmix_enc_open( /* Transient Detector handle */ FOR( i = 0; i < MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH; i++ ) { - IF( ( error = ivas_transient_det_open_fx( &( hMCParamUpmix->hTranDet[i] ), input_Fs ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_transient_det_open_fx( &( hMCParamUpmix->hTranDet[i] ), input_Fs ) ), IVAS_ERR_OK ) ) { return error; } @@ -266,7 +266,7 @@ ivas_error ivas_mc_paramupmix_enc_open( /* set FB config. */ /* need to set num output channels to a value > 0 to get pFb != NULL */ - IF( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH, MC_PARAMUPMIX_COMBINATIONS, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH, MC_PARAMUPMIX_COMBINATIONS, 0, input_Fs, 0 ) ), IVAS_ERR_OK ) ) { return error; } @@ -281,7 +281,7 @@ ivas_error ivas_mc_paramupmix_enc_open( fb_cfg->prior_input_length = (int16_t) max( fb_cfg->prior_input_length, input_frame / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Allocate and initialize FB mixer handle */ - IF( ( error = ivas_FB_mixer_open_fx( &( hMCParamUpmix->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_FB_mixer_open_fx( &( hMCParamUpmix->hFbMixer ), input_Fs, fb_cfg, 0 ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index 48895fdec294c3c58b0297553587dcded3ff49b3..2bf34200f5295568cf639f892b53ca5ebd8b6d98 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -55,11 +55,12 @@ * Local constants *------------------------------------------------------------------------*/ -#define NEAR_HORIZONTAL_PLANE_ELEVATION 17.5f -#define VERTICAL_ENERGY_RATIO_OFFSET 0.15f #ifdef IVAS_FLOAT_FIXED #define NEAR_HORIZONTAL_PLANE_ELEVATION_FX 73400320 /*Q22*/ #define VERTICAL_ENERGY_RATIO_OFFSET_FX 4915 /*Q15*/ +#else +#define NEAR_HORIZONTAL_PLANE_ELEVATION 17.5f +#define VERTICAL_ENERGY_RATIO_OFFSET 0.15f #endif /*------------------------------------------------------------------------- @@ -506,7 +507,7 @@ ivas_error ivas_mcmasa_enc_open_fx( azi_diff = L_add( azi_diff, 360 << 22 ); } test(); - IF( LT_32( azi_diff, left_min ) && GT_32( azi_diff, 0 ) ) + IF( LT_32( azi_diff, left_min ) && azi_diff > 0 ) { hMcMasa->leftNearest[i] = j; move16(); @@ -514,7 +515,7 @@ ivas_error ivas_mcmasa_enc_open_fx( move32(); } test(); - IF( GT_32( azi_diff, right_min ) && LT_32( azi_diff, 0 ) ) + IF( GT_32( azi_diff, right_min ) && azi_diff < 0 ) { hMcMasa->rightNearest[i] = j; move16(); @@ -3001,8 +3002,7 @@ void ivas_mcmasa_dmx_modify_fx( return; } -#endif - +#else void ivas_mcmasa_dmx_modify( const int16_t n_samples, /* i : input frame length in samples */ float dmx[][L_FRAME48k + NS2SA( 48000, IVAS_FB_ENC_DELAY_NS )], /* i/o: downmix signal to be transformed into another format */ @@ -3075,6 +3075,7 @@ void ivas_mcmasa_dmx_modify( return; } +#endif /*--------------------------------------------------------------------------* diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 1b7f19f7ff2eab272520788cf3ca04cb7afc355a..62334813db3d379a3dcfa02caf0de0400329bbb2 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -2293,8 +2293,14 @@ static void ivas_omasa_energy_and_ratio_est_fx( { FOR( k = 0; k < nchan_ism; k++ ) { - tftile_energy_fx = L_add( Mpy_32_32( Chnl_RealBuffer_fx[k][j], Chnl_RealBuffer_fx[k][j] ), Mpy_32_32( Chnl_ImagBuffer_fx[k][j], Chnl_ImagBuffer_fx[k][j] ) ); /*2*q_cldfb-31*/ - tftile_energy_e = sub( 62, shl( q_cldfb, 1 ) ); + Word64 tmp64; + Word16 tmpNorm; + tmp64 = W_add( W_mult0_32_32( Chnl_RealBuffer_fx[k][j], Chnl_RealBuffer_fx[k][j] ), W_mult0_32_32( Chnl_ImagBuffer_fx[k][j], Chnl_ImagBuffer_fx[k][j] ) ); // exp: 2 * (31 - q_cldfb) + 1 + tftile_energy_e = sub( 63, shl( q_cldfb, 1 ) ); + tmpNorm = W_norm( tmp64 ); + tmp64 = W_shl( tmp64, tmpNorm ); + tftile_energy_fx = W_extract_h( tmp64 ); + tftile_energy_e = sub( tftile_energy_e, tmpNorm ); hOmasaData->energy_ism_fx[block_m_idx][i] = BASOP_Util_Add_Mant32Exp( hOmasaData->energy_ism_fx[block_m_idx][i], hOmasaData->energy_ism_fx_e[block_m_idx][i], tftile_energy_fx, tftile_energy_e, &hOmasaData->energy_ism_fx_e[block_m_idx][i] ); hOmasaData->energy_ratio_ism_fx[block_m_idx][i][k] = BASOP_Util_Add_Mant32Exp( hOmasaData->energy_ratio_ism_fx[block_m_idx][i][k], energy_ratio_ism_e[block_m_idx][i][k], tftile_energy_fx, tftile_energy_e, &energy_ratio_ism_e[block_m_idx][i][k] ); move32(); @@ -2311,11 +2317,11 @@ static void ivas_omasa_energy_and_ratio_est_fx( move64(); FOR( j = 0; j < nchan_ism; j++ ) { - hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] = BASOP_Util_Divide3232_Scale( hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j], L_add( hOmasaData->energy_ism_fx[block_m_idx][i], EPSILON_FX ), &temp_e ); - temp_e = add( temp_e, sub( energy_ratio_ism_e[block_m_idx][i][j], hOmasaData->energy_ism_fx_e[block_m_idx][i] ) ); + hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] = L_deposit_h( BASOP_Util_Divide3232_Scale( hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j], L_add( hOmasaData->energy_ism_fx[block_m_idx][i], EPSILON_FX ), &temp_e ) ); move32(); - // TO be checked for saturation - hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] = L_min( ONE_IN_Q30, L_shl_sat( hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j], add( 15, temp_e ) ) ); /* scaling to q30*/ + temp_e = add( temp_e, sub( energy_ratio_ism_e[block_m_idx][i][j], hOmasaData->energy_ism_fx_e[block_m_idx][i] ) ); + + hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] = L_shl( hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j], sub( temp_e, 1 ) ); /* scaling to q30 */ move32(); ism_ratio_sum_fx = W_add( ism_ratio_sum_fx, hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] ); } @@ -2324,7 +2330,7 @@ static void ivas_omasa_energy_and_ratio_est_fx( Word16 temp_ism_ratio = BASOP_Util_Divide1616_Scale( 1, nchan_ism, &temp_e ); FOR( j = 0; j < nchan_ism; j++ ) { - hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] = L_min( ONE_IN_Q30, L_shl( temp_ism_ratio, add( 15, temp_e ) ) ); /*scaling to q30*/ + hOmasaData->energy_ratio_ism_fx[block_m_idx][i][j] = L_shl( temp_ism_ratio, add( temp_e, 15 ) ); /*scaling to q30*/ move32(); } } diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 7c5a22c8e420e03606d7fdf3934d3989780a035e..866f13ce240d4232ff547baf8c577720f0621ac8 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -434,7 +434,7 @@ ivas_error ivas_osba_enc_reconfig( move16(); ivas_spar_enc_close_fx( &( st_ivas->hSpar ), hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp, spar_reconfig_flag ); - IF( NE_32( ( error = ivas_spar_enc_open( st_ivas, spar_reconfig_flag ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_spar_enc_open_fx( st_ivas, spar_reconfig_flag ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 8b5f9cd16cf6bd51b202a890e61f04230debe680..498c2a8341c8c52996cc909b0801c80417e5c171 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -2348,8 +2348,8 @@ Word16 quantize_direction2D_fx( return idx_sph; } -#endif +#else int16_t quantize_direction2D( float phi, /* i : input azimuth value */ const int16_t no_cw, /* i : number of bits */ @@ -2382,7 +2382,7 @@ int16_t quantize_direction2D( return idx_sph; } - +#endif #ifdef IVAS_FLOAT_FIXED static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr_512_fx( IVAS_QMETADATA_HANDLE hQMetaData, @@ -9735,12 +9735,8 @@ static Word16 encode_surround_coherence_hr_fx( error_ratio_surr = L_sub( ONE_IN_Q30, q_direction[0].band_data[j].energy_ratio_fx[sf] ); } -#ifndef NON_BE_FIX_1048_THRESHOLD_COH_BASOP - IF( error_ratio_surr <= 0 ) -#else /* if ( error_ratio_surr <= 0 ) Restricting precision to 7 decimal places */ IF( LE_32( error_ratio_surr, 107 /* 1e-7 in Q30 */ ) ) -#endif { error_ratio_surr = 0; idx_sur_coh[j] = 0; @@ -9925,9 +9921,7 @@ static int16_t encode_surround_coherence_hr( int16_t max_val = 0, nbits_max; int16_t no_cv_shift[MASA_MAXIMUM_CODING_SUBBANDS], min_idx; int16_t idx16; -#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP int32_t int_error_ratio_surr; -#endif coding_subbands = hQMetaData->q_direction[0].cfg.nbands; all_coherence_zero = hQMetaData->all_coherence_zero; @@ -9957,10 +9951,8 @@ static int16_t encode_surround_coherence_hr( { error_ratio_surr = 1.0f - q_direction[0].band_data[j].energy_ratio[sf]; } -#ifdef NON_BE_FIX_1048_THRESHOLD_COH_BASOP int_error_ratio_surr = (int32_t) ( MASA_SUR_COH_PRECISION * error_ratio_surr ); error_ratio_surr = (float) ( int_error_ratio_surr * MASA_SUR_COH_THRESHOLD ); -#endif if ( error_ratio_surr <= 0 ) { @@ -11957,9 +11949,7 @@ void ivas_omasa_encode_masa_to_total( float dct_data[MAX_PARAM_SPATIAL_SUBFRAMES * MASA_FREQUENCY_BANDS]; int16_t bits_pos, nb_bits; int16_t n_streams, len_stream; -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL int32_t int_tmp; -#endif bits_pos = hMetaData->nb_bits_tot; k = 0; @@ -12110,10 +12100,8 @@ void ivas_omasa_encode_masa_to_total( { masa_to_total_energy_ratio[i][j] = max( 0.0f, q_dct_data[k] ); masa_to_total_energy_ratio[i][j] = min( 1.0f, masa_to_total_energy_ratio[i][j] ); -#ifdef NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL int_tmp = (int32_t) ( MASA_SUR_COH_PRECISION * masa_to_total_energy_ratio[i][j] ); masa_to_total_energy_ratio[i][j] = (float) ( int_tmp * MASA_SUR_COH_THRESHOLD ); -#endif k++; } } diff --git a/lib_enc/ivas_qspherical_enc.c b/lib_enc/ivas_qspherical_enc.c index 48e4bb93dc27e704d6826d5b956cdc054e5afab1..c0d065d63ab54849bc54660a9558672906f34eb8 100644 --- a/lib_enc/ivas_qspherical_enc.c +++ b/lib_enc/ivas_qspherical_enc.c @@ -50,12 +50,12 @@ /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static float quantize_theta_phi( float *theta_cb, const int16_t no_th, const int16_t *no_phi_loc, const float abs_theta, int16_t *id_phi, int16_t *id_phi_remap, float *phi_hat, const float phi, const int16_t no_bits, int16_t *id_theta, float *phi_q, const int16_t remap, const MC_LS_SETUP mc_format ); static float direction_distance_cp( float theta, float theta_hat, float theta_hat1, const float phi, const float phi_hat, const float phi_hat1, float *d1 ); -#ifdef IVAS_FLOAT_FIXED +#else static Word32 quantize_theta_phi_fx( Word32 *theta_cb, const Word16 no_th, const Word16 *no_phi_loc, const Word32 abs_theta, Word16 *id_phi, Word16 *id_phi_remap, Word32 *phi_hat, const Word32 phi, const Word16 no_bits, Word16 *id_theta, Word32 *phi_q, const Word16 remap, const MC_LS_SETUP mc_format ); static Word16 direction_distance_cp_fx( Word32 theta, Word32 theta_hat, Word32 theta_hat1, const Word32 phi, const Word32 phi_hat, const Word32 phi_hat1, Word16 *d1 ); @@ -510,7 +510,7 @@ void small_requantize_direction_frame( * * *----------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED /*! r: quantized spherical index */ uint16_t quantize_direction( const float theta, /* i : input elevation value */ @@ -730,7 +730,7 @@ uint16_t quantize_direction( return idx_sph; } -#ifdef IVAS_FLOAT_FIXED +#else /*! r: quantized spherical index */ UWord16 quantize_direction_fx( const Word32 theta, /* i : input elevation value, Q22 */ @@ -1006,7 +1006,7 @@ return idx_sph; * * quantization distortion calculated on the sphere *----------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED /*! r: distortion value */ static float direction_distance_cp( float theta, /* i : elevation absolute value */ @@ -1032,7 +1032,7 @@ static float direction_distance_cp( return d; } -#ifdef IVAS_FLOAT_FIXED +#else /*! r: distortion value */ static Word16 direction_distance_cp_fx( // Q14 Word32 theta, /* i : elevation absolute value, Q22 */ @@ -1128,7 +1128,7 @@ static Word16 direction_distance_cp_fx( // Q14 * * joint quantization of elevation and azimuth *----------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED /*! r: quantized elevation value */ static float quantize_theta_phi( float *theta_cb, /* i : elevation codebook */ @@ -1257,7 +1257,7 @@ static float quantize_theta_phi( return theta_hat; } -#ifdef IVAS_FLOAT_FIXED +#else /*! r: quantized elevation value */ static Word32 quantize_theta_phi_fx( // Q22 Word32 *theta_cb, /* i : elevation codebook, Q22 */ diff --git a/lib_enc/ivas_rom_enc.c b/lib_enc/ivas_rom_enc.c index ee6fc5bf0007eb3b515423a6db0d465c94172d4a..0a23fce18e81d770635ab6b75e16e4906d25ac62 100644 --- a/lib_enc/ivas_rom_enc.c +++ b/lib_enc/ivas_rom_enc.c @@ -182,49 +182,50 @@ const int16_t xtalk_isel_dft[SIZE_XTALK_ISEL_DFT] = { E_clas, E_gainILD, E_gainIPD, E_angle_rot, E_g_pred, E_d_prodL_prodR, E_sum_xcorr, E_xcorr_itd_value, E_gphat_d_itd2, E_gphat_ratio_m1_m2, E_gphat_m2_m2 }; - +#ifndef IVAS_FLOAT_FIXED const float xtalk_mean_dft[SIZE_XTALK_ISEL_DFT] = { 1.852478f, 0.211747f, -3.253483f, 0.758069f, 23.766095f, 1.634010f, -3115.264805f, 0.423402f, 14.629498f, 0.000570f, 0.011686f }; - +#endif const Word32 xtalk_mean_dft_q15[SIZE_XTALK_ISEL_DFT] = { 60702, 6939, -106610, 24840, 778767, 53543, -102081000, 13874, 479379, 19, 383 }; - +#ifndef IVAS_FLOAT_FIXED const float xtalk_scale_dft[SIZE_XTALK_ISEL_DFT] = { 1.507352f, 0.159956f, 2.497517f, 0.469123f, 2.825375f, 0.932028f, 261.555949f, 0.205413f, 35.216496f, 0.001153f, 0.025744f }; - +#else const Word32 xtalk_scale_dft_q15[SIZE_XTALK_ISEL_DFT] = { 49393, 5241, 81839, 15372, 92582, 30541, 8570665, 6731, 1153974, 38, 844 }; - +#endif +#ifndef IVAS_FLOAT_FIXED const float xtalk_coef_dft[SIZE_XTALK_ISEL_DFT] = { -0.082911f, -0.057949f, 0.089754f, -0.167106f, 1.289470f, 0.054620f, 0.667244f, -0.358486f, 0.032200f, 1.141818f, 1.824479f }; - +#else const Word32 xtalk_coef_dft_q30[SIZE_XTALK_ISEL_DFT] = { -89025008, -62222264, 96372624, -179428704, 1384557824, 58647780, 716447808, -384921408, 34574488, 1226017792, 1959019392 }; - +#endif /*----------------------------------------------------------------------------------* * Stereo IC-BWE ROM tables *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED const float icbwe_thr_TDM[7] = { -1.22828f, -1.55314f, -0.998893f, 0.856996f, 0.836244f, 0.872327f, 0.972167f }; const float icbwe_thr_DFT[7] = { -1.19952f, -1.42293f, -1.074940f, -1.63089f, 0.889989f, 0.893530f, 0.975288f }; const float icbwe_regressionValuesTDM[8] = { 0.104430f, 0.025943f, 0.50332f, 0.12767f, 0.80566f, 0.27640f, 0.98366f, 0.35556f }; const float icbwe_regressionValuesDFT[8] = { 0.030371f, 0.155500f, 0.52510f, 0.10623f, 0.79167f, 0.23188f, 0.98325f, 0.00000f }; - +#endif #ifdef IVAS_FLOAT_FIXED #define FLOAT_2_FIX_Q30(a) ((Word32)(a * 1024.0 * 1024.0 * 1024.0)) #define FLOAT_2_FIX_Q31(a) ((Word32)(a * 1024.0 * 1024.0 * 1024.0 * 2.0)) @@ -291,7 +292,7 @@ const float Wn_table[50] = }; #endif - +#ifndef IVAS_FLOAT_FIXED const float win_ana_8k[STEREO_DFT_OVL_8k] = { 0.1059233f, 0.1834491f, 0.2367920f, 0.2801055f, 0.3175031f, 0.3508655f, 0.3812388f, 0.4092752f, 0.4354137f, 0.4599658f, 0.4831618f, 0.5051779f, 0.5261516f, 0.5461931f, 0.5653920f, 0.5838222f, 0.6015455f, 0.6186141f, 0.6350726f, 0.6509591f, 0.6663070f, 0.6811452f, 0.6954990f, 0.7093909f, 0.7228406f, 0.7358659f, 0.7484825f, 0.7607045f, @@ -379,6 +380,7 @@ const float win_ana_48k[STEREO_DFT_OVL_MAX] = { 0.9973543f, 0.9975433f, 0.9977253f, 0.9979003f, 0.9980682f, 0.9982292f, 0.9983831f, 0.9985301f, 0.9986700f, 0.9988030f, 0.9989289f, 0.9990478f, 0.9991598f, 0.9992647f, 0.9993626f, 0.9994536f, 0.9995375f, 0.9996144f, 0.9996844f, 0.9997473f, 0.9998033f, 0.9998523f, 0.9998942f, 0.9999292f, 0.9999572f, 0.9999781f, 0.9999921f, 0.9999991f }; +#endif const Word16 win_ana_8k_fx[STEREO_DFT_OVL_8k] = { 3471, 6011, 7759, 9178, 10404, 11497, 12492, 13411, 14268, 15072, 15832, 16554, 17241, 17898, 18527, 19131, 19711, 20271, @@ -456,7 +458,7 @@ const Word16 win_ana_48k_fx[STEREO_DFT_OVL_MAX] = { 32699, 32705, 32710, 32715, 32720, 32724, 32729, 32733, 32737, 32740, 32744, 32747, 32750, 32753, 32755, 32758, 32760, 32762, 32763, 32765, 32766, 32767, 32767, 32767, 32767 }; - +#ifndef IVAS_FLOAT_FIXED const float win_syn_8k[STEREO_DFT_OVL_8k] = { 0.0011884f, 0.0061737f, 0.0132770f, 0.0219768f, 0.0320069f, 0.0431939f, 0.0554104f, 0.0685561f, 0.0825479f, 0.0973143f, 0.1127919f, 0.1289238f, 0.1456574f, 0.1629441f, 0.1807378f, 0.1989949f, 0.2176735f, 0.2367334f, 0.2561357f, 0.2758425f, 0.2958170f, 0.3160233f, 0.3364260f, 0.3569906f, 0.3776832f, 0.3984704f, 0.4193193f, 0.4401978f, @@ -552,7 +554,7 @@ const float win_mdct_8k[STEREO_DFT_OVL_8k] = { 0.8155609f, 0.8283398f, 0.8407016f, 0.8526402f, 0.8641494f, 0.8752234f, 0.8858568f, 0.8960441f, 0.9057802f, 0.9150603f, 0.9238795f, 0.9322336f, 0.9401183f, 0.9475296f, 0.9544637f, 0.9609173f, 0.9668870f, 0.9723699f, 0.9773632f, 0.9818643f, 0.9858710f, 0.9893813f, 0.9923935f, 0.9949059f, 0.9969173f, 0.9984268f, 0.9994336f, 0.9999371f }; - +#endif const Word32 win_syn_8k_fx[STEREO_DFT_OVL_8k] = { 2552069, 13257920, 28512140, 47194820, 68734296, 92758192, 118992928, 147223104, 177270272, 208980864, 242218768, 276861760, 312796896, 349919776, 388131456, 427338304, 467450272, 508381120, 550047232, 592367232, 635262144, 678654848, 722469312, 766631488, 811068480, 855708672, 900481344, 945317568, 990149120, @@ -668,30 +670,31 @@ const int16_t log2_1px_table[65] = 827, 840, 853, 866, 879, 891, 904, 916, 929, 941, 953, 965, 977, 989, 1001, 1012, 1024 }; - +#ifndef IVAS_FLOAT_FIXED /* table with log2(T(2 ^ param)), where T(x) = x * (exp(0.5 / x) - exp(-0.5 / x)), for param = -2 .. 10 */ /* the last two entries present are zero, like all values for larger param values */ const float log2TB[ECSQ_log2TB_SIZE] = { 0.858721f, 0.232908f, 0.059619f, 0.014997f, 0.003755f, 0.000939f, 0.000235f, 0.000059f, 0.000015f, 0.000004f, 0.000001f, 0.000000f, 0.000000f }; - +#else const Word32 log2TB_Q31[ECSQ_log2TB_SIZE] = { 1844089344, 500166112, 128030824, 32205812, 8063801, 2016487, 504658, 126701, 32212, 8589, 2147, 0, 0 }; - +#endif +#ifndef IVAS_FLOAT_FIXED /* precomuputed table for log_2(factorial(i)), for i in {0, .., ECSQ_SEGMENT_SIZE} */ const float ECSQ_log2_fact[1 + ECSQ_SEGMENT_SIZE] = { 0.0000000f, 0.0000000f, 1.0000000f, 2.5849625f, 4.5849625f, 6.9068906f, 9.4918531f, 12.2992080f, 15.2992080f }; - +#else const Word16 ECSQ_log2_fact_Q10[1 + ECSQ_SEGMENT_SIZE] = { 0, 0, 1024, 2647, 4695, 7072, 9719, 12594, 15666 }; - +#endif const uint16_t ECSQ_tab_param[ECSQ_CONFIG_COUNT][1 + ECSQ_PARAM_COUNT] = { { 16384, 15360, 14336, 13312, 12288, 11264, 10240, 9216, 8192, 7168, 6144, 5120, 4096, 3072, 2048, 1024, 0 }, /* un-optimized (reserved) */ @@ -756,7 +759,7 @@ const uint16_t * const ECSQ_tab_abs_lsbs[1 + 4] = /*------------------------------------------------------------------------- * Range Coder ROM tables *------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED /* Bit-estimation table which maps entropy directly to the bit-demand */ const float ari_bit_estimate_s17_LC[RANGE_N_CONTEXT][RANGE_N_SYMBOLS] = { @@ -825,8 +828,7 @@ const float ari_bit_estimate_s17_LC[RANGE_N_CONTEXT][RANGE_N_SYMBOLS] = { 0.92268f,3.07f,6.2252f,8.5737f,2.7604f,3.5365f,6.1296f,8.2186f,5.4493f,5.6337f,7.4922f,9.1926f,7.3853f,7.2721f,8.7146f,10.093f,5.6469f }, { 1.2858f,2.9245f,5.1959f,6.8503f,2.9659f,3.2823f,5.0458f,6.4686f,5.1703f,5.0458f,6.3065f,7.6781f,6.8301f,6.5324f,7.6601f,8.7521f,4.3982f } }; - -#ifdef IVAS_FLOAT_FIXED +#else const Word32 ari_bit_estimate_s17_LC_fx[RANGE_N_CONTEXT][RANGE_N_SYMBOLS] = // Q23 { {83886080, 75881672, 61002796, 63255136, 77113120, 68724512, 57378916, 59202600, 63963136, 59104456, 60121992, 61117720, 66920960, 61587484, 62456544, 63393548, 1051931 }, @@ -905,13 +907,12 @@ const Word32 Stereo_dmx_s_wnd_coef_16k_fx[L_FRAME16k >> 4] = { 3309988, 29667578, 81733728, 158226416, 257262128, 376402368, 512713184, 662838656, 823081792, 989497088, 1157986560, 1324401920, 1484645120, 1634770560, 1771081600, 1890221568, 1989257344, 2065750016, 2117816064, 2144173568 }; -#endif - +#else const float Stereo_dmx_s_wnd_coef_16k[L_FRAME16k >> 4] = { 0.00154133327f, 0.0138150426f, 0.0380602330f, 0.0736799166f, 0.119797014f, 0.175276011f, 0.238750681f, 0.308658302f, 0.383277327f, 0.460770488f, 0.539229512f, 0.616722703f, 0.691341758f, 0.761249363f, 0.824724138f, 0.880203009f, 0.926320136f, 0.961939812f, 0.986184955f, 0.998458624f, }; - +#endif #ifdef IVAS_FLOAT_FIXED // Q31 const Word32 Stereo_dmx_s_wnd_coef_32k_fx[L_FRAME32k >> 4] = { @@ -920,15 +921,14 @@ const Word32 Stereo_dmx_s_wnd_coef_32k_fx[L_FRAME32k >> 4] = { 1115896832, 1199946752, 1283218432, 1365198592, 1445382400, 1523274368, 1598395136, 1670280960, 1738488832, 1802598528, 1862214528, 1916969472, 1966525568, 2010577280, 2048853120, 2081117056, 2107170304, 2126851968, 2140040960, 2146655872 }; -#endif - +#else const float Stereo_dmx_s_wnd_coef_32k[L_FRAME32k >> 4] = { 0.000385481922f, 0.00346577191f, 0.00960735977f, 0.0187723786f, 0.0309043285f, 0.0459284224f, 0.0637519881f, 0.0842651874f, 0.107341543f, 0.132838756f, 0.160599619f, 0.190453023f, 0.222214893f, 0.255689442f, 0.290670186f, 0.326941460f, 0.364279807f, 0.402454913f, 0.441231340f, 0.480370134f, 0.519629955f, 0.558768749f, 0.597545147f, 0.635720134f, 0.673058629f, 0.709329903f, 0.744310737f, 0.777785182f, 0.809546947f, 0.839400351f, 0.867161214f, 0.892658472f, 0.915734828f, 0.936248004f, 0.954071581f, 0.969095647f, 0.981227636f, 0.990392625f, 0.996534228f, 0.999614537f }; - +#endif #ifdef IVAS_FLOAT_FIXED // Q31 const Word32 Stereo_dmx_s_wnd_coef_48k_fx[L_FRAME48k >> 4] = { @@ -939,8 +939,7 @@ const Word32 Stereo_dmx_s_wnd_coef_48k_fx[L_FRAME48k >> 4] = { 1634770560, 1681915904, 1727394560, 1771081600, 1812856960, 1852606720, 1890221568, 1925598592, 1958640640, 1989257344, 2017364480, 2042885504, 2065750016, 2085895424, 2103266688, 2117816064, 2129503616, 2138297728, 2144173568, 2147115776 }; -#endif - +#else const float Stereo_dmx_s_wnd_coef_48k[L_FRAME48k >> 4] = { 0.000171337553f, 0.00154133327f, 0.00427756971f, 0.00837254710f, 0.0138150426f, 0.0205901340f, 0.0286792554f, 0.0380602330f, 0.0487073623f, 0.0605914444f, 0.0736799166f, 0.0879369006f, 0.103323318f, 0.119797014f, 0.137312800f, 0.155822709f, 0.175276011f, 0.195619285f, 0.216796920f, 0.238750681f, @@ -949,7 +948,7 @@ const float Stereo_dmx_s_wnd_coef_48k[L_FRAME48k >> 4] = { 0.761249363f, 0.783203125f, 0.804380774f, 0.824724138f, 0.844177306f, 0.862687230f, 0.880203009f, 0.896676719f, 0.912063122f, 0.926320136f, 0.939408541f, 0.951292694f, 0.961939812f, 0.971320748f, 0.979409873f, 0.986184955f, 0.991627395f, 0.995722473f, 0.998458624f, 0.999828696f }; - +#endif #ifdef IVAS_FLOAT_FIXED // Q31 const Word32 Stereo_dmx_wnd_coef_32k_fx[L_FRAME32k] = { @@ -1018,8 +1017,7 @@ const Word32 Stereo_dmx_wnd_coef_32k_fx[L_FRAME32k] = { 205244320, 194748592, 184248144, 173743280, 163234208, 152721728, 142205056, 131684952, 121161680, 110635488, 100107136, 89576376, 79042944, 68507608, 57970624, 47432244, 36893228, 26352814, 15811765, 5270335 }; -#endif - +#else const float Stereo_dmx_wnd_coef_32k[L_FRAME32k] = { 0.00245436677f, 0.00736304140f, 0.0122715384f, 0.0171797406f, 0.0220875274f, 0.0269947834f, 0.0319013894f, 0.0368072242f, 0.0417121723f, 0.0466161147f, 0.0515189394f, 0.0564205162f, 0.0613207407f, 0.0662194863f, 0.0711166263f, 0.0760120600f, 0.0809056610f, 0.0857973173f, 0.0906868950f, 0.0955742970f, @@ -1086,7 +1084,7 @@ const float Stereo_dmx_wnd_coef_32k[L_FRAME32k] = { 0.0955743343f, 0.0906868801f, 0.0857972279f, 0.0809055194f, 0.0760118514f, 0.0711165965f, 0.0662193894f, 0.0613205843f, 0.0564203039f, 0.0515186638f, 0.0466160178f, 0.0417122506f, 0.0368072391f, 0.0319013409f, 0.0269946754f, 0.0220873598f, 0.0171797480f, 0.0122714853f, 0.00736292684f, 0.00245419098f }; - +#endif #ifdef IVAS_FLOAT_FIXED // Q31 const Word32 Stereo_dmx_wnd_coef_48k_fx[L_FRAME48k] = { @@ -1187,8 +1185,7 @@ const Word32 Stereo_dmx_wnd_coef_48k_fx[L_FRAME48k] = { 136945664, 129931544, 122916024, 115899184, 108881112, 101861864, 94841528, 87820688, 80798400, 73775248, 66751300, 59726636, 52701336, 45675472, 38649628, 31623374, 24596266, 17568896, 10541338, 3513666 }; -#endif - +#else const float Stereo_dmx_wnd_coef_48k[L_FRAME48k] = { 0.00163624552f, 0.00490871910f, 0.00818113983f, 0.0114534730f, 0.0147256833f, 0.0179977361f, 0.0212695971f, 0.0245412290f, 0.0278125983f, 0.0310836714f, 0.0343544111f, 0.0376247801f, 0.0408947468f, 0.0441642813f, 0.0474333353f, 0.0507018827f, 0.0539698936f, 0.0572373196f, 0.0605041310f, 0.0637703016f, @@ -1287,7 +1284,7 @@ const float Stereo_dmx_wnd_coef_48k[L_FRAME48k] = { 0.0637702942f, 0.0605040900f, 0.0572372340f, 0.0539697632f, 0.0507017188f, 0.0474331267f, 0.0441640280f, 0.0408946946f, 0.0376246870f, 0.0343542770f, 0.0310834963f, 0.0278123822f, 0.0245409720f, 0.0212692991f, 0.0179976355f, 0.0147257810f, 0.0114535289f, 0.00818115473f, 0.00490869302f, 0.00163617858f }; - +#endif /*----------------------------------------------------------------------------------* * ParamUpmix ROM tables @@ -1342,11 +1339,11 @@ const int16_t mc_paramupmix_fb_remix_order[4] = {0, 1, 2, 3}; /*----------------------------------------------------------------------------------* * ParamMC ROM tables *----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED const float param_mc_ild_diff_threshold[20] = { 8.0f, 8.0f, 10.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f, 20.0f }; - -#ifdef IVAS_FLOAT_FIXED +#else //Q21 const Word32 param_mc_ild_diff_threshold_fx[20] = { 16777216, 16777216, 20971520, 41943040, 41943040, 41943040, 41943040, 41943040, diff --git a/lib_enc/ivas_rom_enc.h b/lib_enc/ivas_rom_enc.h index 34c3e2562e1f7ab1fbdeed83027ab9095fe2223c..edd9a963794ae92bd9ff619be5eb244fd8bad1ff 100644 --- a/lib_enc/ivas_rom_enc.h +++ b/lib_enc/ivas_rom_enc.h @@ -65,14 +65,16 @@ extern const float xtalk_mean_td[]; extern const float xtalk_scale_td[]; extern const float xtalk_coef_td[]; #endif - -extern const int16_t xtalk_isel_dft[]; +#ifndef IVAS_FLOAT_FIXED extern const float xtalk_mean_dft[]; -extern const Word32 xtalk_mean_dft_q15[]; extern const float xtalk_scale_dft[]; -extern const Word32 xtalk_scale_dft_q15[]; extern const float xtalk_coef_dft[]; +#else +extern const int16_t xtalk_isel_dft[]; +extern const Word32 xtalk_mean_dft_q15[]; +extern const Word32 xtalk_scale_dft_q15[]; extern const Word32 xtalk_coef_dft_q30[]; +#endif extern const int16_t unclr_isel_dft[]; #ifdef IVAS_FLOAT_FIXED @@ -89,12 +91,12 @@ extern const float unclr_coef_dft[]; * Stereo IC-BWE ROM tables *----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED extern const float icbwe_thr_TDM[]; extern const float icbwe_thr_DFT[]; extern const float icbwe_regressionValuesTDM[]; extern const float icbwe_regressionValuesDFT[]; - -#ifdef IVAS_FLOAT_FIXED +#else extern const Word32 icbwe_thr_TDM_fx[]; extern const Word32 icbwe_thr_DFT_fx[]; extern const Word32 icbwe_regressionValuesTDM_fx[]; @@ -116,6 +118,7 @@ extern const Word32 Wn_table_fx[50]; extern const float Wn_table[]; #endif +#ifndef IVAS_FLOAT_FIXED extern const float win_ana_8k[STEREO_DFT_OVL_8k]; extern const float win_ana_12k8[STEREO_DFT_OVL_12k8]; extern const float win_ana_16k[STEREO_DFT_OVL_16k]; @@ -129,7 +132,7 @@ extern const float win_syn_32k[STEREO_DFT_OVL_32k]; extern const float win_syn_48k[STEREO_DFT_OVL_MAX]; extern const float win_mdct_8k[STEREO_DFT_OVL_8k]; - +#else extern const Word16 win_ana_8k_fx[STEREO_DFT_OVL_8k]; extern const Word16 win_ana_12k8_fx[STEREO_DFT_OVL_12k8]; extern const Word16 win_ana_16k_fx[STEREO_DFT_OVL_16k]; @@ -143,42 +146,48 @@ extern const Word32 win_syn_32k_fx[STEREO_DFT_OVL_32k]; extern const Word32 win_syn_48k_fx[STEREO_DFT_OVL_MAX]; extern const Word32 win_mdct_8k_fx[STEREO_DFT_OVL_8k]; - +#endif /*----------------------------------------------------------------------------------* * Range Coder ROM tables *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED extern const float ari_bit_estimate_s17_LC[RANGE_N_CONTEXT][RANGE_N_SYMBOLS]; +#else extern const Word32 ari_bit_estimate_s17_LC_fx[RANGE_N_CONTEXT][RANGE_N_SYMBOLS]; +#endif /*----------------------------------------------------------------------------------* * ECLVQ Stereo ROM tables *----------------------------------------------------------------------------------*/ - -extern const int16_t log2_1px_table[65]; +#ifndef IVAS_FLOAT_FIXED extern const float log2TB[ECSQ_log2TB_SIZE]; -extern const Word32 log2TB_Q31[ECSQ_log2TB_SIZE]; extern const float ECSQ_log2_fact[1 + ECSQ_SEGMENT_SIZE]; +#else +extern const int16_t log2_1px_table[65]; +extern const Word32 log2TB_Q31[ECSQ_log2TB_SIZE]; extern const Word16 ECSQ_log2_fact_Q10[1 + ECSQ_SEGMENT_SIZE]; extern const uint16_t ECSQ_tab_param[ECSQ_CONFIG_COUNT][1 + ECSQ_PARAM_COUNT]; extern const uint16_t *const ECSQ_tab_abs_lsbs[1 + 4]; extern const uint16_t ECSQ_tab_vals[ECSQ_PARAM_COUNT - 1][1 + ECSQ_TAB_VALS_SIZE]; +#endif /*----------------------------------------------------------------------------------* * Stereo downmix to EVS ROM tables *----------------------------------------------------------------------------------*/ - -extern const Word32 Stereo_dmx_s_wnd_coef_16k_fx[L_FRAME16k >> 4]; +#ifndef IVAS_FLOAT_FIXED extern const float Stereo_dmx_s_wnd_coef_16k[L_FRAME16k >> 4]; -extern const Word32 Stereo_dmx_s_wnd_coef_32k_fx[L_FRAME32k >> 4]; extern const float Stereo_dmx_s_wnd_coef_32k[L_FRAME32k >> 4]; -extern const Word32 Stereo_dmx_s_wnd_coef_48k_fx[L_FRAME48k >> 4]; extern const float Stereo_dmx_s_wnd_coef_48k[L_FRAME48k >> 4]; -extern const Word32 Stereo_dmx_wnd_coef_32k_fx[L_FRAME32k]; extern const float Stereo_dmx_wnd_coef_32k[L_FRAME32k]; -extern const Word32 Stereo_dmx_wnd_coef_48k_fx[L_FRAME48k]; extern const float Stereo_dmx_wnd_coef_48k[L_FRAME48k]; +#else +extern const Word32 Stereo_dmx_s_wnd_coef_16k_fx[L_FRAME16k >> 4]; +extern const Word32 Stereo_dmx_s_wnd_coef_32k_fx[L_FRAME32k >> 4]; +extern const Word32 Stereo_dmx_s_wnd_coef_48k_fx[L_FRAME48k >> 4]; +extern const Word32 Stereo_dmx_wnd_coef_32k_fx[L_FRAME32k]; +extern const Word32 Stereo_dmx_wnd_coef_48k_fx[L_FRAME48k]; +#endif /*----------------------------------------------------------------------------------* * ParamUpmix ROM tables *----------------------------------------------------------------------------------*/ @@ -190,8 +199,11 @@ extern const int16_t mc_paramupmix_fb_remix_order[4]; /*----------------------------------------------------------------------------------* * ParamMC ROM tables *----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED extern const float param_mc_ild_diff_threshold[20]; +#else extern const Word32 param_mc_ild_diff_threshold_fx[20]; +#endif #endif diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index 7f5ed53581680de6abab1e6c4c9599ad1b058008..f0ecb4101eac2017e849b289c73f67c7666a846b 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -264,7 +264,7 @@ ivas_error ivas_sba_enc_reconfigure( move16(); ivas_spar_enc_close_fx( &( st_ivas->hSpar ), hEncoderConfig->input_Fs, hEncoderConfig->nchan_inp, spar_reconfig_flag ); - IF( ( error = ivas_spar_enc_open( st_ivas, spar_reconfig_flag ) ) != IVAS_ERR_OK ) + IF( ( error = ivas_spar_enc_open_fx( st_ivas, spar_reconfig_flag ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 60704d0d7205a962ba06679395cdde3ad1c57809..d21a9f3eb4427a6128d844639d5828864011762e 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -60,7 +60,7 @@ static ivas_error ivas_spar_enc_process_fx( Encoder_Struct *st_ivas, const ENCOD * * Allocate and initialize SPAR encoder handle and sub-handles *------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_spar_enc_open( Encoder_Struct *st_ivas, /* i/o: IVAS encoder handle */ const int16_t spar_reconfig_flag /* i : SPAR reconfiguration flag */ @@ -241,7 +241,7 @@ ivas_error ivas_spar_enc_open( if ( hEncoderConfig->Opt_DTX_ON ) { - if ( ( error = front_vad_create( &( hSpar->hFrontVad ), hEncoderConfig ) ) != IVAS_ERR_OK ) + if ( ( error = front_vad_create_fx( &( hSpar->hFrontVad ), hEncoderConfig ) ) != IVAS_ERR_OK ) { return error; } @@ -276,7 +276,7 @@ ivas_error ivas_spar_enc_open( return error; } -#ifdef IVAS_FLOAT_FIXED +#else ivas_error ivas_spar_enc_open_fx( Encoder_Struct *st_ivas, /* i/o: IVAS encoder handle */ const Word16 spar_reconfig_flag /* i : SPAR reconfiguration flag */ diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index 9314e80ba12f442046901a5f976ec51be9d04e58..f208b2d5c57a2df421b379b17ce023bf9ceaf055 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -335,6 +335,7 @@ void stereo_dft_quantize_res_gains_fx( return; } #endif +#ifndef IVAS_FLOAT_FIXED void stereo_dft_quantize_res_gains( const float *g, const float *r, @@ -427,6 +428,8 @@ void stereo_dft_quantize_res_gains( return; } +#endif + /*------------------------------------------------------------------------- * stereo_dft_quantize_ipd() diff --git a/lib_enc/ivas_stereo_dft_enc_itd.c b/lib_enc/ivas_stereo_dft_enc_itd.c index a048b0141a6ae0f6de72a47f6859a5df60c0afaa..7e077fe2212e69eb2556e5b0f2b3ce6e86b886bd 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd.c +++ b/lib_enc/ivas_stereo_dft_enc_itd.c @@ -568,13 +568,9 @@ static Word16 stereo_dft_enc_itd_vad_fx( Word32 Spd[STEREO_DFT_N_16k_ENC / 2 + 1]; Word16 Spd_e[STEREO_DFT_N_16k_ENC / 2 + 1]; -#ifdef FIX_828_PORT_1152_FROM_FLT_REPO /* Spd is later only used starting at itd_vad_band_tbl[0], so only compute values starting from there */ /* -> this avoids uninitialized values in Spd_L and Spd_R at index 0 to be used */ FOR( i = itd_vad_band_tbl[0]; i < STEREO_DFT_N_16k_ENC / 2; i++ ) -#else - FOR( i = 0; i <= STEREO_DFT_N_16k_ENC / 2; i++ ) -#endif { // Spd[i] = 0.5f * ( Spd_L[i] + Spd_R[i] ); Spd[i] = BASOP_Util_Add_Mant32Exp( Spd_L[i], Spd_L_e[i], Spd_R[i], Spd_R_e[i], &Spd_e[i] ); @@ -617,13 +613,9 @@ static int16_t stereo_dft_enc_itd_vad( float Spd[STEREO_DFT_N_16k_ENC / 2 + 1]; -#ifdef FIX_828_PORT_1152_FROM_FLT_REPO /* Spd is later only used starting at itd_vad_band_tbl[0], so only compute values starting from there */ /* -> this avoids uninitialized values in Spd_L and Spd_R at index 0 to be used */ for ( i = itd_vad_band_tbl[0]; i < STEREO_DFT_N_16k_ENC / 2; i++ ) -#else - for ( i = 0; i <= STEREO_DFT_N_16k_ENC / 2; i++ ) -#endif { Spd[i] = 0.5f * ( Spd_L[i] + Spd_R[i] ); } @@ -2453,19 +2445,15 @@ void stereo_dft_enc_compute_itd_fx( /*calculate total cohSNR for frame in dB*/ // THIS PART NEEDS TO BE RECHECKED AGAINST NEW FLOAT CODE -#ifdef FIX_BASOP_812_NAN_COHSNR IF( BASOP_Util_Cmp_Mant32Exp( mEr, mEr_e, MAX_32, 0 ) > 0 ) { -#endif cohSNR = Mpy_32_32( 83886080, BASOP_Util_Log10( mEr, mEr_e ) ); // Q16 (cohSNR = 20 * log10f( mEr );) -#ifdef FIX_BASOP_812_NAN_COHSNR } ELSE { cohSNR = 0; move32(); } -#endif /* collect UNCLR classifier parameters */ { @@ -3500,18 +3488,14 @@ void stereo_dft_enc_compute_itd( } /*calculate total cohSNR for frame in dB*/ -#ifdef FIX_BASOP_812_NAN_COHSNR if ( mEr > 1.0f ) { -#endif cohSNR = 20 * log10f( mEr ); -#ifdef FIX_BASOP_812_NAN_COHSNR } else { cohSNR = 0; } -#endif /* collect UNCLR classifier parameters */ { diff --git a/lib_enc/ivas_stereo_td_analysis.c b/lib_enc/ivas_stereo_td_analysis.c index 1af59b460ecf151c9d9c75d533a898b8e19c7092..15fe8860a5008568b5ff19dd666ef6f2701ef4b0 100644 --- a/lib_enc/ivas_stereo_td_analysis.c +++ b/lib_enc/ivas_stereo_td_analysis.c @@ -1237,33 +1237,20 @@ static void Get_LR_rms_fx( { Word32 ener_l, ener_r; Word32 ener_l_tmp, ener_r_tmp; -#ifdef FIX_818_COMPLEXITY_IMPROV Word16 guard_bits; Word64 W_ener_l_tmp, W_ener_r_tmp; -#else - Word64 ener_l_tmp_64bit, ener_r_tmp_64bit; - Word16 q_shift; -#endif Word16 i; Word16 exp_out_l, exp_out_r, exp_diff; -#ifdef FIX_818_COMPLEXITY_IMPROV W_ener_l_tmp = 0; move64(); W_ener_r_tmp = 0; move64(); -#else - ener_l_tmp_64bit = 0; - move64(); - ener_r_tmp_64bit = 0; - move64(); -#endif ener_l = ONE_BY_100_Q31; move32(); ener_r = ONE_BY_100_Q31; move32(); -#ifdef FIX_818_COMPLEXITY_IMPROV guard_bits = sub( 32, find_guarded_bits_fx( input_frame ) ); FOR( i = 0; i < input_frame; i++ ) { @@ -1273,43 +1260,9 @@ static void Get_LR_rms_fx( /* Scaling back to the original proposal */ ener_l_tmp = W_extract_h( W_shl( W_ener_l_tmp, guard_bits ) ); // guard_bits - 32 ener_r_tmp = W_extract_h( W_shl( W_ener_r_tmp, guard_bits ) ); // guard_bits - 32 -#else - FOR( i = 0; i < input_frame; i++ ) - { - ener_l_tmp_64bit = W_add( ener_l_tmp_64bit, W_deposit32_l( L_mult0( Left_in[i], Left_in[i] ) ) ); // Q0 - ener_r_tmp_64bit = W_add( ener_r_tmp_64bit, W_deposit32_l( L_mult0( Right_in[i], Right_in[i] ) ) ); // Q0 - } - - q_shift = 31; - move16(); - IF( ener_l_tmp_64bit != 0 ) - { - q_shift = s_min( q_shift, W_norm( ener_l_tmp_64bit ) ); - } - IF( ener_r_tmp_64bit != 0 ) - { - q_shift = s_min( q_shift, W_norm( ener_r_tmp_64bit ) ); - } - ener_l_tmp = W_extract_l( W_shl_nosat( ener_l_tmp_64bit, sub( q_shift, 32 ) ) ); // (q_shift - 32) - ener_r_tmp = W_extract_l( W_shl_nosat( ener_r_tmp_64bit, sub( q_shift, 32 ) ) ); // (q_shift - 32) - /* perform rounding towards lower value for negative results */ - IF( ener_l_tmp < 0 ) - { - ener_l_tmp = L_add( ener_l_tmp, 1 ); - } - IF( ener_r_tmp < 0 ) - { - ener_r_tmp = L_add( ener_r_tmp, 1 ); - } -#endif -#ifdef FIX_818_COMPLEXITY_IMPROV ener_l = BASOP_Util_Add_Mant32Exp( ener_l, 0, ener_l_tmp, sub( Q31, sub( guard_bits, 32 ) ), &exp_out_l ); ener_r = BASOP_Util_Add_Mant32Exp( ener_r, 0, ener_r_tmp, sub( Q31, sub( guard_bits, 32 ) ), &exp_out_r ); -#else - ener_l = BASOP_Util_Add_Mant32Exp( ener_l, 0, ener_l_tmp, sub( Q31, sub( q_shift, 32 ) ), &exp_out_l ); - ener_r = BASOP_Util_Add_Mant32Exp( ener_r, 0, ener_r_tmp, sub( Q31, sub( q_shift, 32 ) ), &exp_out_r ); -#endif ener_l_tmp = BASOP_Util_Divide3232_Scale( ener_l, input_frame, &exp_diff ); exp_out_l = sub( add( exp_diff, exp_out_l ), Q15 ); @@ -3206,11 +3159,8 @@ static void Get_corr_n_fx( Word16 exp_diff; Word32 L_tmp; Word16 guard_bits; -#ifdef FIX_818_COMPLEXITY_IMPROV Word64 W_corrL, W_corrR, W_ener, W_ener_side; -#endif -#ifdef FIX_818_COMPLEXITY_IMPROV W_corrL = 0; move64(); W_corrR = 0; @@ -3220,17 +3170,6 @@ static void Get_corr_n_fx( W_ener_side = EPSILON_FX; move64(); guard_bits = sub( 32, find_guarded_bits_fx( len ) ); -#else - corrL = 0; - move32(); - corrR = 0; - move32(); - ener = EPSILON_FX; - move32(); - ener_side = EPSILON_FX; - move32(); - guard_bits = find_guarded_bits_fx( len ); -#endif /*----------------------------------------------------------------* * Find the normalized correlation between: left/mono and right/mono based @@ -3238,7 +3177,6 @@ static void Get_corr_n_fx( IF( tdm_SM_calc_flag ) { -#ifdef FIX_818_COMPLEXITY_IMPROV FOR( i = 0; i < len; i++ ) { mono_i = round_fx( L_msu( L_mult( L[i], ONE_IN_Q14 ), R[i], ONE_IN_Q14 ) ); // q_in @@ -3253,21 +3191,9 @@ static void Get_corr_n_fx( corrR = W_extract_h( W_shl( W_corrR, guard_bits ) ); ener = W_extract_h( W_shl( W_ener, guard_bits ) ); ener_side = W_extract_h( W_shl( W_ener_side, guard_bits ) ); -#else - FOR( i = 0; i < len; i++ ) - { - mono_i = sub( shr( L[i], Q1 ), shr( R[i], Q1 ) ); // q_in - corrL = L_add( corrL, L_shr( L_mult0( abs_s( L[i] ), abs_s( mono_i ) ), guard_bits ) ); // (q_in + q_in - guard_bits) - corrR = L_add( corrR, L_shr( L_mult0( abs_s( R[i] ), abs_s( mono_i ) ), guard_bits ) ); // (q_in + q_in - guard_bits) - ener = L_add( ener, L_shr( L_mult0( mono_i, mono_i ), guard_bits ) ); // (q_in + q_in - guard_bits) - side_i = add( shr( L[i], Q1 ), shr( R[i], Q1 ) ); // q_in - ener_side = L_add( ener_side, L_shr( L_mult0( side_i, side_i ), guard_bits ) ); // (q_in + q_in - guard_bits) - } -#endif } ELSE { -#ifdef FIX_818_COMPLEXITY_IMPROV FOR( i = 0; i < len; i++ ) { mono_i = round_fx( L_mac( L_mult( L[i], ONE_IN_Q14 ), R[i], ONE_IN_Q14 ) ); // q_in @@ -3282,17 +3208,6 @@ static void Get_corr_n_fx( corrR = W_extract_h( W_shl( W_corrR, guard_bits ) ); ener = W_extract_h( W_shl( W_ener, guard_bits ) ); ener_side = W_extract_h( W_shl( W_ener_side, guard_bits ) ); -#else - FOR( i = 0; i < len; i++ ) - { - mono_i = add( shr( L[i], Q1 ), shr( R[i], Q1 ) ); // q_in - corrL = L_add( corrL, L_shr( L_mult0( L[i], mono_i ), guard_bits ) ); // (q_in + q_in - guard_bits) - corrR = L_add( corrR, L_shr( L_mult0( R[i], mono_i ), guard_bits ) ); // (q_in + q_in - guard_bits) - ener = L_add( ener, L_shr( L_mult0( mono_i, mono_i ), guard_bits ) ); // (q_in + q_in - guard_bits) - side_i = sub( shr( L[i], Q1 ), shr( R[i], Q1 ) ); // q_in - ener_side = L_add( ener_side, L_shr( L_mult0( side_i, side_i ), guard_bits ) ); // (q_in + q_in - guard_bits) - } -#endif } IF( ener == 0 ) diff --git a/lib_enc/ivas_stereo_td_enc.c b/lib_enc/ivas_stereo_td_enc.c index d80e2bf6faa138a6a91802681c6e5bae23db48be..a142ef22567618ba8b454945ac6b749b3c29fde6 100644 --- a/lib_enc/ivas_stereo_td_enc.c +++ b/lib_enc/ivas_stereo_td_enc.c @@ -827,7 +827,6 @@ void tdm_configure_enc_fx( mod_ct = AUDIO; move16(); -#ifdef NONBE_FIX_1205_TD_STEREO_MOD_CT IF( LT_32( hCPE->element_brate, IVAS_24k4 ) ) { test(); @@ -852,33 +851,7 @@ void tdm_configure_enc_fx( move16(); } } -#else - IF( LT_32( hCPE->element_brate, IVAS_24k4 ) ) - { - mod_ct = sts[0]->coder_type; - move16(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - test(); - /* Only sure TRANSITION coding modes are important for bit allocation, otherwise mod_ct is set to AUDIO only to easy debugging if needed */ - IF( ( ( GE_16( sts[0]->last_L_frame, L_FRAME16k ) && EQ_16( sts[0]->flag_ACELP16k, 0 ) ) || ( EQ_16( sts[0]->last_L_frame, L_FRAME ) && EQ_16( sts[0]->flag_ACELP16k, 1 ) ) ) && NE_32( sts[0]->last_core_brate, FRAME_NO_DATA ) && NE_32( sts[0]->last_core_brate, SID_2k40 ) && NE_32( sts[0]->coder_type_raw, VOICED ) /*in case of CNG, this code is not reached sts[0]->core_brate != FRAME_NO_DATA && sts[0]->core_brate != SID_2k40 &&*/ ) - { - mod_ct = TRANSITION; - move16(); - } - ELSE IF( EQ_16( sts[0]->sp_aud_decision1, 1 ) || EQ_16( sts[0]->sp_aud_decision2, 1 ) || NE_16( mod_ct, TRANSITION ) ) - { - mod_ct = AUDIO; - move16(); - } - } -#endif /* Correction of tdm_inst_ratio_idx in case of TC in the seecondary channel */ test(); diff --git a/lib_enc/lp_exc_e.c b/lib_enc/lp_exc_e.c index c6abda210968e5d36839cb0228336aee56c2bf6c..7f72670b563923f3c53ad58f3266480b21662cf1 100644 --- a/lib_enc/lp_exc_e.c +++ b/lib_enc/lp_exc_e.c @@ -41,6 +41,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -297,3 +298,4 @@ float corr_xy1( return gain; } +#endif diff --git a/lib_enc/lp_exc_e_fx.c b/lib_enc/lp_exc_e_fx.c index d45f959731fb4dda19f657afce18dffbd3d4e6db..f29f4c47880c5b4b9c8443072bfae55cf726ed96 100644 --- a/lib_enc/lp_exc_e_fx.c +++ b/lib_enc/lp_exc_e_fx.c @@ -13,9 +13,12 @@ * Local constants *-------------------------------------------------------------------*/ -#define GAIN_PIT_MAX 19661 +#define GAIN_PIT_MAX 19661 + +#ifndef IVAS_FLOAT_FIXED #define HIGH_LTP_LIMIT 1.0f #define LOW_LTP_LIMIT 0.55f +#endif /*-------------------------------------------------------------------* * Local function prototypes diff --git a/lib_enc/lsf_msvq_ma_enc.c b/lib_enc/lsf_msvq_ma_enc.c index d3433c41034cd8103566878c8ac290ba77bdc9d7..89e7f8bcd4f147d3e39e4cf6ef536ebebc142219 100644 --- a/lib_enc/lsf_msvq_ma_enc.c +++ b/lib_enc/lsf_msvq_ma_enc.c @@ -354,6 +354,7 @@ Word16 msvq_stage1_dct_search_fx( } #endif +#ifndef IVAS_FLOAT_FIXED int16_t msvq_stage1_dct_search( const float *u, /* i : target */ const int16_t N, /* i : target length and IDCT synthesis length */ @@ -561,6 +562,7 @@ int16_t msvq_stage1_dct_search( return p_max; /*ptr to worst performing candidate */ } +#endif /*--------------------------------------------------------------------------* @@ -572,6 +574,7 @@ int16_t msvq_stage1_dct_search( *--------------------------------------------------------------------------*/ /*! r: (updated p_max) */ +#ifndef IVAS_FLOAT_FIXED int16_t msvq_stage1_dct_recalc_candidates_fdcng_wb( const float *st1_syn_vec_ptr, /* i : IDCT24 synthesis vectors */ const float *u, /* i : target signal */ @@ -599,6 +602,7 @@ int16_t msvq_stage1_dct_recalc_candidates_fdcng_wb( return p_max_local; } +#endif #ifdef IVAS_FLOAT_FIXED Word16 msvq_stage1_dct_recalc_candidates_fdcng_wb_fx( const Word32 *st1_syn_vec_ptr_fx, /* i : IDCT24 synthesis vectors */ @@ -675,6 +679,7 @@ Word16 msvq_stage1_dct_recalc_candidates_fdcng_wb_fx( * MSVQ encoder *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void msvq_enc( const float *const *cb, /* i : Codebook (indexed cb[*stages][levels][p]) */ const int16_t dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */ @@ -954,6 +959,7 @@ void msvq_enc( return; } +#endif #ifdef IVAS_FLOAT_FIXED void msvq_enc_ivas_fx( @@ -1315,6 +1321,7 @@ excludes the waveform contributions at pos 21,22,23 to the MSE, important to kee * *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED int16_t lsf_msvq_ma_encprm( BSTR_ENC_HANDLE hBstr, const int16_t *param_lpc, @@ -1346,6 +1353,7 @@ int16_t lsf_msvq_ma_encprm( return nbits_lpc; } +#endif #ifndef IVAS_FLOAT_FIXED @@ -1517,6 +1525,7 @@ int16_t Q_lsf_tcxlpc( #endif +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * enc_lsf_tcxlpc() * @@ -1553,8 +1562,10 @@ int16_t enc_lsf_tcxlpc( return NumBits; } +#endif +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * lsf_bctcvq_encprm() * @@ -1580,3 +1591,4 @@ int16_t lsf_bctcvq_encprm( return nbits_lpc; } +#endif diff --git a/lib_enc/ltd_stable.c b/lib_enc/ltd_stable.c index cbc7d02e65b58112d4654e15efc9e3aa020baba7..111fb1cea1d9337ef4f8cc2cfbdbb16c29980925 100644 --- a/lib_enc/ltd_stable.c +++ b/lib_enc/ltd_stable.c @@ -40,6 +40,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * ltd_stable() * @@ -131,3 +132,4 @@ void ltd_stable( return; } +#endif diff --git a/lib_enc/mslvq_enc.c b/lib_enc/mslvq_enc.c index b15eacd1e708a426e9c42eb8a319c328fead2e11..736ffea39fb2d2cfe5e16ef3e28d57bb66c6b601 100644 --- a/lib_enc/mslvq_enc.c +++ b/lib_enc/mslvq_enc.c @@ -48,6 +48,7 @@ * Local function prototypes *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static float quantize_data( float *data, const float *w_in, float *qin, float *cv_out, int16_t *idx_lead, int16_t *idx_scale, const float *sigma, const float *inv_sigma, const float *scales, Word8 *no_leaders ); static float q_data( float *pTmp1, const float *w1, float *quant, float *cv_out, int16_t *idx_lead, int16_t *idx_scale, const float *p_inv_sigma, const float *p_sigma, const float *p_scales, Word8 *no_leaders ); static void prepare_data( float *xsort, int16_t *sign, float *data, float *w, const float *w_in, const float *sigma, const float *inv_sigma, int16_t *p_sig ); @@ -55,11 +56,12 @@ static float calculate_min_dist( float cv_pot[LATTICE_DIM], const float *scale, static int16_t find_pos( float *c, const int16_t len, float arg, int16_t *p ); static void take_out_val( float *v, float *v_out, const float val, const int16_t len ); static UWord32 index_leaders( float *cv, int16_t idx_lead, const int16_t dim ); -static UWord32 c2idx( const int16_t n, int16_t *p, const int16_t k ); -static UWord32 encode_sign_pc1( const int16_t parity, float *cv ); static UWord32 encode_comb( float *cv, const int16_t idx_lead ); - +static UWord32 encode_sign_pc1( const Word16 parity, float *cv ); +static UWord32 c2idx( const Word16 n, Word16 *p, const Word16 k ); +#else Word32 quantize_data_ivas_fx( Word16 *data, const Word16 *w_in, Word16 *qin, Word16 *cv_out, Word16 *idx_lead, Word16 *idx_scale, const Word16 *sigma, const Word16 *inv_sigma, const Word16 *scales, const Word16 *no_lead ); +#endif /*-----------------------------------------------------------------* * mslvq() @@ -67,6 +69,7 @@ Word32 quantize_data_ivas_fx( Word16 *data, const Word16 *w_in, Word16 *qin, Wor * Encodes the LSF residual *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED float mslvq( float *pTmp, /* i : M-dimensional input vector */ float *quant, /* o : quantized vector */ @@ -175,7 +178,7 @@ float mslvq( return dist; } -#ifdef IVAS_FLOAT_FIXED +#else Word32 mslvq_ivas_16( Word16 *pTmp, /* i : M-dimensional input vector */ Word16 *quant, /* o : quantized vector */ @@ -300,8 +303,8 @@ Word32 mslvq_ivas_16( return dist; } - #endif +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------* * q_data() * @@ -328,13 +331,14 @@ static float q_data( return dist; } +#endif /*-----------------------------------------------------------------* * mslvq_cng() * * Encodes the LSF residual in SID frames *-----------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED float mslvq_cng( int16_t idx_cv, /* i : index of cv from previous stage */ float *pTmp, /* i : 16 dimensional input vector */ @@ -404,11 +408,14 @@ float mslvq_cng( return dist; } +#endif + /*-----------------------------------------------------------------* * prepare_data() * *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void prepare_data( float *xsort, int16_t *sign, @@ -449,12 +456,14 @@ static void prepare_data( return; } +#endif /*-----------------------------------------------------------------* * calculate_min_dist() * *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static float calculate_min_dist( float cv_pot[LATTICE_DIM], const float *scale, @@ -567,6 +576,7 @@ static float calculate_min_dist( return min_dist; } +#endif /*-----------------------------------------------------------------* @@ -574,6 +584,7 @@ static float calculate_min_dist( * *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static float quantize_data( float *data, /* i : residual LSF data to quantize */ const float *w_in, /* i : weights */ @@ -653,6 +664,7 @@ static float quantize_data( return min_dist; } +#endif /*-----------------------------------------------------------------* * index_lvq() @@ -660,6 +672,7 @@ static float quantize_data( * sorts in descending order and computes indices in the sorted vector *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void index_lvq( float *quant, /* i : codevector to be indexed (2 8-dim subvectors) */ int16_t *idx_lead, /* i : leader class index for each subvector */ @@ -706,6 +719,7 @@ void index_lvq( return; } +#endif /*-----------------------------------------------------------------* @@ -714,6 +728,7 @@ void index_lvq( * creates an index for the lattice codevector *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: index of the absolute valued codevector */ static UWord32 encode_comb( float *cv, /* i : codevector to be indexed */ @@ -728,6 +743,7 @@ static UWord32 encode_comb( return idx_sign * (UWord32) pi0[idx_lead] + idx_ld_class; } +#endif /*-----------------------------------------------------------------* @@ -736,6 +752,7 @@ static UWord32 encode_comb( * gives the index in a class of leaders without considering the sign yet *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: index */ static UWord32 index_leaders( float *cv, /* i : codevector to be indexed */ @@ -791,6 +808,7 @@ static UWord32 index_leaders( return index; } +#endif /*-----------------------------------------------------------------* * find_pos() @@ -799,6 +817,7 @@ static UWord32 index_leaders( * It returns the number of such positions and their values in the array 'p'. *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: number of positions */ int16_t find_pos( float *c, /* i : input vector */ @@ -820,6 +839,7 @@ int16_t find_pos( return j; } +#endif /*-----------------------------------------------------------------* * encode_sign_pc1() @@ -829,6 +849,7 @@ int16_t find_pos( * and positive sign stands for 1. *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: index of signs */ static UWord32 encode_sign_pc1( const int16_t parity, /* i : parity of the leader class to which the codevector belongs */ @@ -862,6 +883,7 @@ static UWord32 encode_sign_pc1( return idx_sign; } +#endif /*-----------------------------------------------------------------* * take_out_val() @@ -869,6 +891,7 @@ static UWord32 encode_sign_pc1( * removes the value val from the vector v *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void take_out_val( float *v, /* i : input vector */ float *v_out, /* o : output vector without the value val*/ @@ -890,6 +913,7 @@ static void take_out_val( return; } +#endif /*-----------------------------------------------------------------* @@ -897,6 +921,7 @@ static void take_out_val( * *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static UWord32 c2idx( const int16_t n, int16_t *p, @@ -926,12 +951,14 @@ static UWord32 c2idx( return skip + c2idx( n - p0 - 1, p + 1, k - 1 ); } } +#endif /*-----------------------------------------------------------------* * index_lvq_SHB() * *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED UWord32 index_lvq_SHB( const int16_t idx_lead, const int16_t idx_scale, @@ -971,6 +998,7 @@ UWord32 index_lvq_SHB( return index; } +#endif UWord32 index_lvq_SHB_fx( diff --git a/lib_enc/multi_harm.c b/lib_enc/multi_harm.c index 7de9c208348dbd0b3de03750ccf509f931649569..cfc8a6f3aee1a202ebcff1acdc4d17c76f5d28d9 100644 --- a/lib_enc/multi_harm.c +++ b/lib_enc/multi_harm.c @@ -41,6 +41,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------* * Local constants *-----------------------------------------------------------------*/ @@ -324,3 +325,4 @@ int16_t multi_harm( return harm; } +#endif diff --git a/lib_enc/nois_est.c b/lib_enc/nois_est.c index d6ebcc603fc5af430c084182da032a7187e1d238..e0d629b49d6ee27af61c0539bb33c9b3a5bc59c4 100644 --- a/lib_enc/nois_est.c +++ b/lib_enc/nois_est.c @@ -45,6 +45,7 @@ * Local constants *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED #define ALPHA 0.1f #define COR_MIN8 0.65f @@ -85,7 +86,6 @@ * * Initialization of Noise estimator *-----------------------------------------------------------------*/ -#ifndef IVAS_FLOAT_FIXED void noise_est_init( NOISE_EST_HANDLE hNoiseEst /* i/o: Noise estimation handle */ ) diff --git a/lib_enc/noise_adjust.c b/lib_enc/noise_adjust.c index 6fc15e01fadd6423847bae0ccdd3b2e4c123f4fb..6bf9beae77dd29c7b22340330e96e2824d760424 100644 --- a/lib_enc/noise_adjust.c +++ b/lib_enc/noise_adjust.c @@ -42,6 +42,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * noise_adjust() * @@ -114,3 +115,4 @@ int16_t noise_adjust( return nf_idx; } +#endif diff --git a/lib_enc/normalizecoefs.c b/lib_enc/normalizecoefs.c index a69a83352a7c30a3279db3483eb05b6cde2c579c..58e7067713dcc5f696942f3108cbab72e3da206b 100644 --- a/lib_enc/normalizecoefs.c +++ b/lib_enc/normalizecoefs.c @@ -45,7 +45,7 @@ * * Normalize MDCT coefficients with quantized norms *--------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void normalizecoefs( float *coefs, /* i/o: MDCT coefficients */ const int16_t *ynrm, /* i : quantization indices for norms */ @@ -69,3 +69,4 @@ void normalizecoefs( return; } +#endif diff --git a/lib_enc/peak_vq_enc.c b/lib_enc/peak_vq_enc.c index c75b073a9a721a50845e983c94793a8c3b9c6160..03230986b1efe690f1a22ca3dd34809492740f2a 100644 --- a/lib_enc/peak_vq_enc.c +++ b/lib_enc/peak_vq_enc.c @@ -42,7 +42,7 @@ #include "rom_com.h" #include "wmc_auto.h" #include - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------- * Local function prototypes *--------------------------------------------------------------------------*/ @@ -631,3 +631,4 @@ static int16_t hvq_code_pos( return bits; } +#endif diff --git a/lib_enc/pit_enc.c b/lib_enc/pit_enc.c index 17fd9dc044edb60e5110cc1edb45c5e40215e610..1c08fe869fba4a3096cf3c07e8151af07b17d370 100644 --- a/lib_enc/pit_enc.c +++ b/lib_enc/pit_enc.c @@ -43,14 +43,13 @@ #include "rom_enc.h" #include "rom_com.h" #include "wmc_auto.h" - +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------* * pit_encode() * * Close-loop pitch lag search and pitch lag quantization * Adaptive excitation construction *------------------------------------------------------------------*/ - /*! r: Fractional pitch for each subframe */ float pit_encode( BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ @@ -1384,3 +1383,4 @@ void Mode2_delta_pit_enc( return; } +#endif diff --git a/lib_enc/pitch_ol.c b/lib_enc/pitch_ol.c index bb2415d0a7c42ae1e4cd1484f9c0da80e4160f53..8db4b02f576f608602168f8ac28f67add4c48a21 100644 --- a/lib_enc/pitch_ol.c +++ b/lib_enc/pitch_ol.c @@ -46,6 +46,7 @@ /*---------------------------------------------------------------------* * Local constants *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED #define PIT_MIN2 20 /* pit_min for pitch tracking */ #define PIT_MIN_1 44 /* pitch tracking */ @@ -79,7 +80,6 @@ static int16_t pitch_coherence( const int16_t pitch0, const int16_t pitch1, cons static void lp_decim2( const float x[], float y[], const int16_t l, float *mem ); -#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------* * pitch_ol_init * @@ -100,7 +100,6 @@ void pitch_ol_init( return; } -#endif /*-----------------------------------------------------------------* * pitch_ol() @@ -992,3 +991,4 @@ static void lp_decim2( } return; } +#endif diff --git a/lib_enc/pitch_ol2.c b/lib_enc/pitch_ol2.c index 17be8dec67fa6cfaba0f820ab4713f504e5a2656..2ed68795047ac90236144483507262cbf068fbcf 100644 --- a/lib_enc/pitch_ol2.c +++ b/lib_enc/pitch_ol2.c @@ -52,7 +52,6 @@ #define MAX_DELTA 16 /* half-length of the delta search */ #define COR_BUF_LEN ( L_INTERPOL1 * 2 + MAX_DELTA * 2 + 1 ) - /*-------------------------------------------------------------------* * pitch_ol2() * @@ -60,7 +59,7 @@ * The pitch is searched in the interval element_mode > EVS_MONO ) { /* prevent too low values of energy */ prev_pow = max( 0.00001f, prev_pow ); curr_pow = max( 0.00001f, curr_pow ); } -#endif if ( voice_factors[0] > 0.75f ) { @@ -1060,14 +1058,12 @@ void swb_tbe_enc( prev_pow = sum2_f( shaped_shb_excitation, L_SHB_LAHEAD + 10 ); curr_pow = sum2_f( shaped_shb_excitation + L_SHB_LAHEAD + 10, L_SHB_LAHEAD + 10 ); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE if ( st->element_mode > EVS_MONO ) { /* prevent too low values of energy */ prev_pow = max( 0.00001f, prev_pow ); curr_pow = max( 0.00001f, curr_pow ); } -#endif if ( voice_factors[0] > 0.75f ) { diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index c4f402234be0eac93273337223456c098c1fb239..96d9fa399ef7a0936cc13e543ccb47cdedf3dd4f 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -988,17 +988,15 @@ void wb_tbe_enc_fx( prev_pow = 0; move32(); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE IF( st_fx->element_mode > EVS_MONO ) { tmp = sub( shl( sub( st_fx->prev_Q_bwe_exc, 16 ), 1 ), 31 + 16 ); #ifdef BASOP_NOGLOB prev_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/ #else - prev_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/ + prev_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/ #endif } -#endif FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ ) { prev_pow = L_mac0( prev_pow, hBWE_TD->state_syn_shbexc_fx[i], hBWE_TD->state_syn_shbexc_fx[i] ); /* Q(2*st_fx->prev_Q_bwe_exc) */ @@ -1026,17 +1024,15 @@ void wb_tbe_enc_fx( curr_pow = 0; move16(); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE IF( st_fx->element_mode > EVS_MONO ) { tmp = sub( shl( Q_bwe_exc_ext, 1 ), 31 + 16 ); #ifdef BASOP_NOGLOB curr_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(Q_bwe_exc_ext))*/ #else - curr_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /* 2*(Q_bwe_exc_ext) */ + curr_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /* 2*(Q_bwe_exc_ext) */ #endif } -#endif FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ ) { curr_pow = L_mac0( curr_pow, shaped_wb_excitation[i + L_SHB_LAHEAD / 4], shaped_wb_excitation[i + L_SHB_LAHEAD / 4] ); /* Q(2*Q_bwe_exc_ext) */ @@ -1594,17 +1590,15 @@ void wb_tbe_enc_ivas_fx( prev_pow = 0; move32(); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE IF( st_fx->element_mode > EVS_MONO ) { tmp = sub( shl( sub( st_fx->prev_Q_bwe_exc, 16 ), 1 ), 31 + 16 ); #ifdef BASOP_NOGLOB prev_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/ #else - prev_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/ + prev_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(st_fx->prev_Q_bwe_exc-16))*/ #endif } -#endif FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ ) { prev_pow = L_mac0( prev_pow, hBWE_TD->state_syn_shbexc_fx[i], hBWE_TD->state_syn_shbexc_fx[i] ); /* Q(2*st_fx->prev_Q_bwe_exc) */ @@ -1631,17 +1625,15 @@ void wb_tbe_enc_ivas_fx( curr_pow = 0; move32(); -#ifdef NONBE_FIX_1132_THRESHOLD_POW_IN_SWB_TBE IF( st_fx->element_mode > EVS_MONO ) { tmp = sub( shl( Q_bwe_exc_ext, 1 ), 31 + 16 ); #ifdef BASOP_NOGLOB curr_pow = L_shl_sat( 1407374848l /*0.00001f Q47*/, tmp ); /*Q(2*(Q_bwe_exc_ext))*/ #else - curr_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /* 2*(Q_bwe_exc_ext) */ + curr_pow = L_shl( 1407374848l /*0.00001f Q47*/, tmp ); /* 2*(Q_bwe_exc_ext) */ #endif } -#endif FOR( i = 0; i < L_SHB_LAHEAD / 4; i++ ) { curr_pow = L_mac0( curr_pow, shaped_wb_excitation[i + L_SHB_LAHEAD / 4], shaped_wb_excitation[i + L_SHB_LAHEAD / 4] ); /* Q(2*Q_bwe_exc_ext) */ diff --git a/lib_enc/tcx_utils_enc.c b/lib_enc/tcx_utils_enc.c index 90ffd2f2fc479243619fe079262bc98aa0948bc1..721ef3fb9a33d4bd17bc0a4805ad00a571f57edf 100644 --- a/lib_enc/tcx_utils_enc.c +++ b/lib_enc/tcx_utils_enc.c @@ -295,7 +295,7 @@ void mdct_preShaping( * * *---------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void AdaptLowFreqEmph( float x[], int16_t xq[], @@ -398,8 +398,9 @@ void AdaptLowFreqEmph( return; } +#endif - +#ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* * PsychAdaptLowFreqEmph() * @@ -441,6 +442,7 @@ void PsychAdaptLowFreqEmph( return; } +#endif #ifndef IVAS_FLOAT_FIXED /*---------------------------------------------------------------------* diff --git a/lib_enc/tfa_enc.c b/lib_enc/tfa_enc.c index bbf2b2514fe355718d4644b6739da261de940107..3522fa0c488cdb257a70228a6609a98a6bc55863 100644 --- a/lib_enc/tfa_enc.c +++ b/lib_enc/tfa_enc.c @@ -40,6 +40,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * tfaCalcEnv() * @@ -118,3 +119,4 @@ int16_t tfaEnc_TBE( return tfa_flag; } +#endif diff --git a/lib_enc/updt_tar.c b/lib_enc/updt_tar.c index b32d63d9766f67c221b1c6c4f7e26f1508a5b8f6..284113b7d1b7f72f7842a9b751963ea8088348bc 100644 --- a/lib_enc/updt_tar.c +++ b/lib_enc/updt_tar.c @@ -39,6 +39,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*----------------------------------------------------------------------------------* * procedure updt_tar() * @@ -63,3 +64,4 @@ void updt_tar( return; } +#endif diff --git a/lib_enc/vlpc_1st_cod.c b/lib_enc/vlpc_1st_cod.c index 756a4524ff2c76c44275d11a8fdb10c0b081b8c6..7023ee5196ed31dd33baa6de2d486b33b4dd29a4 100644 --- a/lib_enc/vlpc_1st_cod.c +++ b/lib_enc/vlpc_1st_cod.c @@ -41,7 +41,7 @@ #include "rom_com.h" #include "wmc_auto.h" - +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------* * lsf_weight() * @@ -84,7 +84,6 @@ static void lsf_weight( * * *------------------------------------------------------------------*/ - /*! r: codebook index */ int16_t vlpc_1st_cod( const float *lsf, /* i : vector to quantize */ @@ -144,3 +143,4 @@ int16_t vlpc_1st_cod( return index; } +#endif diff --git a/lib_enc/vlpc_2st_cod.c b/lib_enc/vlpc_2st_cod.c index def496121b4ab315cd1e0619a3ad346ebd04ab2d..f27fb6831987c1657affe7300a8f18ac5696e48a 100644 --- a/lib_enc/vlpc_2st_cod.c +++ b/lib_enc/vlpc_2st_cod.c @@ -40,6 +40,8 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED + /*------------------------------------------------------------------* * vlpc_2st_cod() * @@ -145,3 +147,5 @@ int16_t vlpc_2st_cod( return ( nbits ); } + +#endif diff --git a/lib_enc/waveadjust_fec_cod.c b/lib_enc/waveadjust_fec_cod.c index d29bc907826c851b73ed482e280b7ad8eeef96ae..e6a1e42d7f82d21ccb427b5c6cf472ab44175a63 100644 --- a/lib_enc/waveadjust_fec_cod.c +++ b/lib_enc/waveadjust_fec_cod.c @@ -40,6 +40,8 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED + /*-------------------------------------------------------------------* * SFM_Cal() * @@ -71,3 +73,5 @@ float SFM_Cal( return (float) SFM; } + +#endif diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 6ff9685bf2e4851bd041c88d6e6a1b5e1a41406d..12d3c503878b49f736619c0f5245939654b910a2 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -3920,7 +3920,6 @@ static void ivas_dirac_dec_binaural_process_output_fx( FOR( bin = 0; bin < nBins; bin++ ) { Word16 gain; -#ifdef IVAS_ENH32_CADENCE_CHANGES /* Mixing using the formulated processing matrix M */ gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxRe_fx[chA][chB][bin] ) ); // Q11 @@ -3937,29 +3936,11 @@ static void ivas_dirac_dec_binaural_process_output_fx( move32(); move32(); -#else - /* Mixing using the formulated processing matrix M */ - gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxRe_fx[chA][chB][bin] ) ); // Q11 - - outSlotRe_fx[bin] = L_add( outSlotRe_fx[bin], Mpy_32_16_1( inRe_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result - outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( inIm_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result - move32(); - move32(); - gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxIm_fx[chA][chB][bin] ) ); // Q11 - - // interpVal * hDiracDecBin->processMtxIm[chA][chB][bin]; - outSlotRe_fx[bin] = L_sub( outSlotRe_fx[bin], Mpy_32_16_1( inIm_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result - outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( inRe_fx[chB][slot][bin], gain ) ); // q_inp_mix-4//q_result - - move32(); - move32(); -#endif /* #ifdef IVAS_ENH32_CADENCE_CHANGES */ /* Mixing decorrelated signals using the formulated residual processing matrix Mdec */ test(); IF( LT_16( bin, max_band_decorr ) && LT_16( chB, 2 ) ) { -#ifdef IVAS_ENH32_CADENCE_CHANGES gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecRe_fx[chA][chB][bin] ) ); // Q11 // interpVal * hDiracDecBin->processMtxDecRe[chA][chB][bin]; outSlotRe_fx[bin] = Madd_32_16( outSlotRe_fx[bin], decSlotRePointer_fx[bin], gain ); // q_inp_mix-4//q_result @@ -3973,22 +3954,6 @@ static void ivas_dirac_dec_binaural_process_output_fx( outSlotIm_fx[bin] = Madd_32_16( outSlotIm_fx[bin], decSlotRePointer_fx[bin], gain ); // q_inp_mix-4//q_result move32(); move32(); - -#else - gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecRePrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecRe_fx[chA][chB][bin] ) ); - // interpVal * hDiracDecBin->processMtxDecRe[chA][chB][bin]; - outSlotRe_fx[bin] = L_add( outSlotRe_fx[bin], Mpy_32_16_1( decSlotRePointer_fx[bin], gain ) ); // q_inp_mix-4//q_result - outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( decSlotImPointer_fx[bin], gain ) ); // q_inp_mix-4//q_result - move32(); - move32(); - - - gain = add( mult( sub( 32767, interpVal_fx ), hDiracDecBin->processMtxDecImPrev_fx[chA][chB][bin] ), mult( interpVal_fx, hDiracDecBin->processMtxDecIm_fx[chA][chB][bin] ) ); - outSlotRe_fx[bin] = L_sub( outSlotRe_fx[bin], Mpy_32_16_1( decSlotImPointer_fx[bin], gain ) ); // q_inp_mix-4//q_result - outSlotIm_fx[bin] = L_add( outSlotIm_fx[bin], Mpy_32_16_1( decSlotRePointer_fx[bin], gain ) ); // q_inp_mix-4//q_result - move32(); - move32(); -#endif /* #ifdef IVAS_ENH32_CADENCE_CHANGES */ } } } @@ -6868,17 +6833,10 @@ static void hrtfShGetHrtf_fx( FOR( k = 0; k < HRTF_SH_CHANNELS; k++ ) { -#ifdef IVAS_ENH32_CADENCE_CHANGES *lRealp = Madd_32_16( *lRealp, shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ); // Q28 *lImagp = Madd_32_16( *lImagp, shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ); // Q28 *rRealp = Madd_32_16( *rRealp, shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ); // Q28 *rImagp = Madd_32_16( *rImagp, shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ); // Q28 -#else - *lRealp = L_add( *lRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ), 1 ) ); // Q28 - *lImagp = L_add( *lImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ) ); // Q28 - *rRealp = L_add( *rRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ), 1 ) ); // Q28 - *rImagp = L_add( *rImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ) ); // Q28 -#endif /* #ifdef IVAS_ENH32_CADENCE_CHANGES */ move32(); move32(); move32(); @@ -6897,19 +6855,11 @@ static void hrtfShGetHrtf_fx( FOR( k = 0; k < HRTF_SH_CHANNELS; k++ ) { -#ifdef IVAS_ENH32_CADENCE_CHANGES *lRealp = Madd_32_16( *lRealp, shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ); // Q28 *lImagp = Madd_32_16( *lImagp, shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ); // Q28 *rRealp = Madd_32_16( *rRealp, shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ); // Q28 *rImagp = Madd_32_16( *rImagp, shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ); // Q28 -#else - *lRealp = L_add( *lRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ), 1 ) ); // Q28 - *lImagp = L_add( *lImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ) ); // Q28 - *rRealp = L_add( *rRealp, L_shr( Mpy_32_16_1( shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ), 1 ) ); // Q28 - *rImagp = L_add( *rImagp, Mpy_32_16_1( shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ) ); // Q28 -#endif /* #ifdef IVAS_ENH32_CADENCE_CHANGES */ - - gainCache->shVec_fx[k] = shVec[k]; // Q29 + gainCache->shVec_fx[k] = shVec[k]; // Q29 move32(); move32(); move32(); diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index 334f52ee3d9177ec945e7aa4d726977b53a4d2c0..3bfdf47f7b160c9fa120ca40e0ca42f4f456aab8 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -47,10 +47,6 @@ * Local constants *------------------------------------------------------------------------------------------*/ -#define OTR_UPDATE_RATE (float) FRAMES_PER_SEC /* rate of the Process() calls [Hz]; 1x per IVAS frame */ -#ifdef NONBE_FIX_738_QUATERNION_SLERP_PRECISION -#define COS_ONE_TENTH_DEGREE ( 0.999998476913288f ) -#endif #define COS_ONE_TENTH_DEGREE_FX 2147480320 // Q31 @@ -283,7 +279,6 @@ void QuaternionSlerp( const float t, IVAS_QUATERNION *const r ) { -#ifdef NONBE_FIX_738_QUATERNION_SLERP_PRECISION IVAS_QUATERNION r1, r2; float phi, sinPhi, cosPhi, s1, s2; @@ -322,15 +317,7 @@ void QuaternionSlerp( r->y = ( s1 * r1.y + s2 * r2.y ) / sinPhi; r->z = ( s1 * r1.z + s2 * r2.z ) / sinPhi; } -#else - float angle, denom, s, s2; - s = QuaternionDotProduct( q1, q2 ); - r->y = ( q1.y * s + q2.y * s2 ) / denom; - r->z = ( q1.z * s + q2.z * s2 ) / denom; - r->w = ( q1.w * s + q2.w * s2 ) / denom; - -#endif QuaternionNormalize( *r, r ); return; diff --git a/lib_rend/ivas_rom_binauralRenderer.c b/lib_rend/ivas_rom_binauralRenderer.c index fa39b67b3af2708db64822a9ba537020b7a75d37..0bd40babd6b55d9fbba3f7308d59153d33c43479 100644 --- a/lib_rend/ivas_rom_binauralRenderer.c +++ b/lib_rend/ivas_rom_binauralRenderer.c @@ -21039,7 +21039,6 @@ const float rightHRIRImag[BINAURAL_CONVBANDS][HRTF_LS_CHANNELS][BINAURAL_NTAPS]= #endif #ifdef IVAS_FLOAT_FIXED -#ifdef IVAS_ENH32_CADENCE_CHANGES const Word16 hrtfShCoeffsRe_fx[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS] /* Q14 */= { { @@ -21144,111 +21143,6 @@ const Word16 hrtfShCoeffsRe_fx[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BIN } }; #else -const Word16 hrtfShCoeffsRe_fx[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS] /* Q15 */ = -{ -{ -{ -30525, 19316, 7802, -2837, -12416, 30083, 29763, 29321, 28409, 27406, 26838, 26491, 26190, 25722, 25023, 24866, 25465, 26164, 26457, 26206, 25714, 25348, 25071, 24773, 24489, 24309, 24446, 24860, 25155, 25139, 24881, 24470, 23998, 23549, 23170, 22859, 22652, 22619, 22731, 22849, 22875, 22843, 22877, 23069, 23406, 23823, 24256, 24614, 24856, 25014, 25121, 15606, 706, 466, 371, 318, 282, 258, 240, 228, -}, -{ -5025,14146,7327,-9865,-23665,18251,18517,18003,19099,21384,23781,25198,25788,26065,26211,26288,26561,26861,26860,26589,26549,26990,27781,28932,30026,30247,29397,27932,26462,25512,25060,24715,24319,23987,23748,23548,23517,23876,24644,25554,26302,26765,27026,27227,27405,27524,27605,27673,27722,27736,27709,17018,448,138,20,-57,-114,-156,-187,-207, -}, -{ -3819,982,-2980,-3625,-3879,5391,5144,4626,4236,3669,4844,6687,9405,13117,16329,17051,14808,10480,5373,1060,-1394,-1970,-1335,-452,4,-176,-918,-1855,-2495,-2351,-1184,728,2618,3841,4356,4501,4484,4308,4002,3696,3501,3341,2977,2264,1235,-51,-1514,-2920,-4088,-5011,-5666,-3822,-134,-52,-17,2,16,25,32,37, -}, -{ -2705,1499,-3290,-5394,-7278,7044,9475,12017,15303,17573,17685,17065,15861,13994,12999,12353,11073,9346,7116,4325,1518,-730,-2299,-3023,-2536,-584,2696,6573,10026,12584,14324,15637,16892,18107,18902,18877,18112,17082,16223,15741,15605,15670,15783,15803,15601,15067,14195,13184,12241,11452,10878,6442,289,200,164,143,129,120,113,108, -}, -{ -115,-1514,-5543,-8070,-8474,4049,6348,9097,11747,13532,12304,10981,10277,9576,9491,9813,9974,9410,7736,4719,1075,-2305,-4899,-6142,-5899,-4727,-3349,-2044,-779,490,1694,2945,4492,6087,6891,6434,5242,4327,4324,5203,6509,7777,8753,9457,10029,10516,10822,10892,10773,10512,10186,6140,179,62,14,-16,-38,-53,-65,-72, -}, -{ --455,671,-5804,-5041,-4039,1187,398,-1949,-3889,-4338,-2744,-944,342,2413,4951,5873,4003,-177,-5616,-10482,-13314,-14112,-13500,-11650,-8244,-3747,231,2459,2971,2660,2440,2653,2963,2766,1969,998,198,-363,-674,-627,-122,675,1362,1607,1322,542,-584,-1762,-2777,-3601,-4203,-2874,-176,-120,-97,-83,-73,-66,-60,-56, -}, -{ --362,2237,5637,7369,6683,-4641,-5829,-5683,-5078,-5818,-6328,-6575,-6756,-7039,-6194,-3118,1346,5276,7328,7128,4730,647,-4206,-8656,-11224,-11214,-9658,-8205,-8020,-9318,-11368,-13293,-14805,-16120,-17196,-17685,-17418,-16616,-15656,-14795,-14091,-13434,-12636,-11580,-10286,-8860,-7493,-6399,-5644,-5149,-4837,-2904,-88,-24,-3,10,20,27,33,36, -}, -{ -417,-4011,-5314,-1604,-389,-205,-1937,-2467,-1292,-446,1489,2625,3389,4141,4708,4739,4956,6091,7811,9622,10657,10172,8136,4122,-2149,-9158,-14600,-17331,-17463,-15757,-13181,-10425,-7650,-4789,-2061,113,1547,2473,3266,4073,4787,5268,5494,5589,5744,6088,6575,7047,7412,7651,7745,4800,210,116,76,51,34,21,12,6, -}, -{ -964,8360,12714,10633,5887,5580,6523,8098,7052,3518,273,-1492,-2405,-3340,-4779,-6166,-7161,-7533,-7442,-7009,-6487,-6133,-5837,-6005,-7006,-7964,-7246,-4447,-732,2510,4974,7015,8827,10314,11279,11634,11354,10531,9373,8115,6967,6067,5462,5100,4881,4698,4450,4115,3753,3422,3201,1768,143,163,167,172,176,180,183,185, -}, -{ --1347,-8079,-14864,-18954,-15938,2788,2547,3444,3178,1486,682,532,1079,1396,1106,537,-249,-981,-1624,-2359,-3011,-3030,-2244,-1545,-1928,-3225,-4324,-4302,-3167,-1482,528,2910,5543,7946,9433,9752,9330,8906,8993,9578,10329,10944,11332,11622,11957,12354,12659,12731,12591,12271,11816,7084,122,-47,-114,-158,-191,-215,-234,-246, -}, -{ --51,1127,-3246,-1874,195,286,93,-777,76,1543,2337,2032,1851,2488,3140,3661,4266,5199,6305,7494,8610,9341,9034,6701,2476,-2023,-5452,-7588,-8656,-8991,-8945,-8758,-8352,-7612,-6725,-6056,-5820,-5797,-5488,-4562,-3035,-1209,524,1874,2788,3455,4137,4914,5702,6449,7076,4714,213,120,81,58,42,30,21,15, -}, -{ --929,-5189,-12693,-6859,-4537,817,2492,2253,2847,741,-1537,-3233,-5172,-7101,-7552,-5830,-1859,3257,7538,9603,9000,6188,1776,-3937,-9662,-12915,-12389,-9197,-5601,-3037,-1631,-1194,-1720,-3078,-4672,-5756,-6045,-5821,-5590,-5689,-6115,-6562,-6649,-6177,-5212,-3960,-2682,-1649,-948,-525,-349,-153,-49,-81,-95,-105,-114,-121,-127,-130, -}, -{ --410,-803,875,3285,988,-623,-64,1750,2055,1402,1230,1408,1069,-208,-2292,-4280,-4743,-3141,641,5426,9429,11770,12135,10255,6792,3387,1122,86,20,564,1451,2295,2518,1647,-473,-3383,-6227,-8382,-9745,-10550,-11062,-11400,-11545,-11445,-11104,-10550,-9734,-8723,-7698,-6742,-5941,-3273,-144,-100,-78,-64,-55,-49,-45,-42, -}, -{ --1171,-927,1849,4728,2888,-1743,-2912,-2581,-2745,-2322,-1444,-2112,-2752,-2284,-2161,-2153,-939,1348,3314,4898,5840,6205,6894,8484,10745,12128,10932,7228,2475,-2159,-6157,-9328,-11461,-12361,-11947,-10471,-8586,-6929,-5789,-5094,-4531,-3758,-2631,-1334,-243,365,485,350,169,55,46,33,-28,-14,-7,-2,1,4,7,8, -}, -{ -217,-943,-3629,1776,1627,-2683,-1036,88,2582,3327,2462,1489,1797,2350,2265,1984,2306,3567,5646,7830,9315,10067,10491,10105,7511,2265,-4065,-9415,-12757,-14021,-13668,-12245,-9921,-6437,-2006,2402,5870,8151,9499,10143,10078,9305,7982,6383,4839,3630,2831,2373,2140,2027,1955,1125,59,42,36,31,27,23,21,18, -}, -{ -2,465,-1031,-409,551,-748,-2652,-4332,-4323,-4502,-3094,-1393,-1079,-1513,-1590,-1958,-2778,-2909,-2000,-463,1323,3262,5119,6331,6329,5423,4850,5384,6509,7532,8340,9012,9404,9620,10246,11546,12992,13693,13157,11582,9559,7654,6203,5166,4193,2987,1542,119,-1057,-1925,-2451,-1745,-73,-25,0,15,25,33,39,42, -}, -}, -{ -{ -30525,19316,7802,-2837,-12416,30083,29763,29321,28409,27406,26838,26491,26190,25722,25023,24866,25465,26164,26457,26206,25714,25348,25071,24773,24489,24309,24446,24860,25155,25139,24881,24470,23998,23549,23170,22859,22652,22619,22731,22849,22875,22843,22877,23069,23406,23823,24256,24614,24856,25014,25121,15606,706,466,371,318,282,258,240,228, -}, -{ --5025,-14146,-7327,9865,23665,-18251,-18517,-18003,-19099,-21384,-23781,-25198,-25788,-26065,-26211,-26288,-26561,-26861,-26860,-26589,-26549,-26990,-27781,-28932,-30026,-30247,-29397,-27932,-26462,-25512,-25060,-24715,-24319,-23987,-23748,-23548,-23517,-23876,-24644,-25554,-26302,-26765,-27026,-27227,-27405,-27524,-27605,-27673,-27722,-27736,-27709,-17018,-448,-138,-20,57,114,156,187,207, -}, -{ -3819,982,-2980,-3625,-3879,5391,5144,4626,4236,3669,4844,6687,9405,13117,16329,17051,14808,10480,5373,1060,-1394,-1970,-1335,-452,4,-176,-918,-1855,-2495,-2351,-1184,728,2618,3841,4356,4501,4484,4308,4002,3696,3501,3341,2977,2264,1235,-51,-1514,-2920,-4088,-5011,-5666,-3822,-134,-52,-17,2,16,25,32,37, -}, -{ -2705,1499,-3290,-5394,-7278,7044,9475,12017,15303,17573,17685,17065,15861,13994,12999,12353,11073,9346,7116,4325,1518,-730,-2299,-3023,-2536,-584,2696,6573,10026,12584,14324,15637,16892,18107,18902,18877,18112,17082,16223,15741,15605,15670,15783,15803,15601,15067,14195,13184,12241,11452,10878,6442,289,200,164,143,129,120,113,108, -}, -{ --115,1514,5543,8070,8474,-4049,-6348,-9097,-11747,-13532,-12304,-10981,-10277,-9576,-9491,-9813,-9974,-9410,-7736,-4719,-1075,2305,4899,6142,5899,4727,3349,2044,779,-490,-1694,-2945,-4492,-6087,-6891,-6434,-5242,-4327,-4324,-5203,-6509,-7777,-8753,-9457,-10029,-10516,-10822,-10892,-10773,-10512,-10186,-6140,-179,-62,-14,16,38,53,65,72, -}, -{ -455,-671,5804,5041,4039,-1187,-398,1949,3889,4338,2744,944,-342,-2413,-4951,-5873,-4003,177,5616,10482,13314,14112,13500,11650,8244,3747,-231,-2459,-2971,-2660,-2440,-2653,-2963,-2766,-1969,-998,-198,363,674,627,122,-675,-1362,-1607,-1322,-542,584,1762,2777,3601,4203,2874,176,120,97,83,73,66,60,56, -}, -{ --362,2237,5637,7369,6683,-4641,-5829,-5683,-5078,-5818,-6328,-6575,-6756,-7039,-6194,-3118,1346,5276,7328,7128,4730,647,-4206,-8656,-11224,-11214,-9658,-8205,-8020,-9318,-11368,-13293,-14805,-16120,-17196,-17685,-17418,-16616,-15656,-14795,-14091,-13434,-12636,-11580,-10286,-8860,-7493,-6399,-5644,-5149,-4837,-2904,-88,-24,-3,10,20,27,33,36, -}, -{ -417,-4011,-5314,-1604,-389,-205,-1937,-2467,-1292,-446,1489,2625,3389,4141,4708,4739,4956,6091,7811,9622,10657,10172,8136,4122,-2149,-9158,-14600,-17331,-17463,-15757,-13181,-10425,-7650,-4789,-2061,113,1547,2473,3266,4073,4787,5268,5494,5589,5744,6088,6575,7047,7412,7651,7745,4800,210,116,76,51,34,21,12,6, -}, -{ -964,8360,12714,10633,5887,5580,6523,8098,7052,3518,273,-1492,-2405,-3340,-4779,-6166,-7161,-7533,-7442,-7009,-6487,-6133,-5837,-6005,-7006,-7964,-7246,-4447,-732,2510,4974,7015,8827,10314,11279,11634,11354,10531,9373,8115,6967,6067,5462,5100,4881,4698,4450,4115,3753,3422,3201,1768,143,163,167,172,176,180,183,185, -}, -{ -1347,8079,14864,18954,15938,-2788,-2547,-3444,-3178,-1486,-682,-532,-1079,-1396,-1106,-537,249,981,1624,2359,3011,3030,2244,1545,1928,3225,4324,4302,3167,1482,-528,-2910,-5543,-7946,-9433,-9752,-9330,-8906,-8993,-9578,-10329,-10944,-11332,-11622,-11957,-12354,-12659,-12731,-12591,-12271,-11816,-7084,-122,47,114,158,191,215,234,246, -}, -{ -51,-1127,3246,1874,-195,-286,-93,777,-76,-1543,-2337,-2032,-1851,-2488,-3140,-3661,-4266,-5199,-6305,-7494,-8610,-9341,-9034,-6701,-2476,2023,5452,7588,8656,8991,8945,8758,8352,7612,6725,6056,5820,5797,5488,4562,3035,1209,-524,-1874,-2788,-3455,-4137,-4914,-5702,-6449,-7076,-4714,-213,-120,-81,-58,-42,-30,-21,-15, -}, -{ -929,5189,12693,6859,4537,-817,-2492,-2253,-2847,-741,1537,3233,5172,7101,7552,5830,1859,-3257,-7538,-9603,-9000,-6188,-1776,3937,9662,12915,12389,9197,5601,3037,1631,1194,1720,3078,4672,5756,6045,5821,5590,5689,6115,6562,6649,6177,5212,3960,2682,1649,948,525,349,153,49,81,95,105,114,121,127,130, -}, -{ --410,-803,875,3285,988,-623,-64,1750,2055,1402,1230,1408,1069,-208,-2292,-4280,-4743,-3141,641,5426,9429,11770,12135,10255,6792,3387,1122,86,20,564,1451,2295,2518,1647,-473,-3383,-6227,-8382,-9745,-10550,-11062,-11400,-11545,-11445,-11104,-10550,-9734,-8723,-7698,-6742,-5941,-3273,-144,-100,-78,-64,-55,-49,-45,-42, -}, -{ --1171,-927,1849,4728,2888,-1743,-2912,-2581,-2745,-2322,-1444,-2112,-2752,-2284,-2161,-2153,-939,1348,3314,4898,5840,6205,6894,8484,10745,12128,10932,7228,2475,-2159,-6157,-9328,-11461,-12361,-11947,-10471,-8586,-6929,-5789,-5094,-4531,-3758,-2631,-1334,-243,365,485,350,169,55,46,33,-28,-14,-7,-2,1,4,7,8, -}, -{ -217,-943,-3629,1776,1627,-2683,-1036,88,2582,3327,2462,1489,1797,2350,2265,1984,2306,3567,5646,7830,9315,10067,10491,10105,7511,2265,-4065,-9415,-12757,-14021,-13668,-12245,-9921,-6437,-2006,2402,5870,8151,9499,10143,10078,9305,7982,6383,4839,3630,2831,2373,2140,2027,1955,1125,59,42,36,31,27,23,21,18, -}, -{ -2,465,-1031,-409,551,-748,-2652,-4332,-4323,-4502,-3094,-1393,-1079,-1513,-1590,-1958,-2778,-2909,-2000,-463,1323,3262,5119,6331,6329,5423,4850,5384,6509,7532,8340,9012,9404,9620,10246,11546,12992,13693,13157,11582,9559,7654,6203,5166,4193,2987,1542,119,-1057,-1925,-2451,-1745,-73,-25,0,15,25,33,39,42, -} -} -}; -#endif -#else const float hrtfShCoeffsRe[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS]= { { diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 8abafc8f8ecdca91a09d5417670be1c99dc90f2b..1292d629602536d27f848b42b09f759bbdbb1da7 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1169,13 +1169,8 @@ static LSSETUP_CUSTOM_STRUCT defaultCustomLs( ls.num_spk = 1; move16(); move16(); -#ifdef FIX_805_VERIFICATION set32_fx( ls.ls_azimuth_fx, 0, MAX_OUTPUT_CHANNELS ); set32_fx( ls.ls_elevation_fx, 0, MAX_OUTPUT_CHANNELS ); -#else - set_val_Word32( ls.ls_azimuth_fx, 0, MAX_OUTPUT_CHANNELS ); - set_val_Word32( ls.ls_elevation_fx, 0, MAX_OUTPUT_CHANNELS ); -#endif ls.num_lfe = 0; move16(); set16_fx( ls.lfe_idx, 0, MAX_OUTPUT_CHANNELS ); @@ -13334,11 +13329,7 @@ static ivas_error getSamplesInternal( } /* Clear original output buffer */ -#ifdef FIX_805_VERIFICATION set32_fx( outAudio.data_fx, 0, imult1616( outAudio.config.numChannels, outAudio.config.numSamplesPerChannel ) ); -#else - set_val_Word32( outAudio.data_fx, 0, imult1616( outAudio.config.numChannels, outAudio.config.numSamplesPerChannel ) ); -#endif IF( NE_32( ( error = renderActiveInputsIsm( hIvasRend, outAudio ) ), IVAS_ERR_OK ) ) {