diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index dbcda4b56a94d6c119c323b159274ec4d0d9fa34..e1aa643d62f0203d0ae5dc74fc673f57b402eb57 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -1460,7 +1460,7 @@ void deindex_sph_idx( return; } - +#ifdef IVAS_FLOAT_FIXED void deindex_sph_idx_fx( const UWord16 sphIndex, /* i : Spherical index */ const SPHERICAL_GRID_DATA *gridData, /* i : Prepared spherical grid */ @@ -1683,7 +1683,7 @@ void deindex_sph_idx_fx( } return; } - +#endif /*--------------------------------------------------------------- * valid_ratio_index() * diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 66921d415ad2cb4f2a3534fbec376d3408684bd2..7a8054ca17b63459aa0fcb6c1a0c83761a0efb37 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -1388,7 +1388,8 @@ void decoder_tcx_tns_fx( STnsData *tnsData, const Word16 bfi, /* i : Bad frame indicator */ const Word16 frame_cnt, /* i : frame counter in the super frame */ - const Word16 whitenedDomain ); + const Word16 whitenedDomain, + Word16 *length ); void ivas_mdct_core_tns_ns_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ diff --git a/lib_com/ivas_rom_com_fx.c b/lib_com/ivas_rom_com_fx.c index 31e156bcd5ff2e7767df5db1a44031a18cfe763c..6dddb795f36a3dbf7f495ee7c42f97220c702cc0 100644 --- a/lib_com/ivas_rom_com_fx.c +++ b/lib_com/ivas_rom_com_fx.c @@ -3516,7 +3516,7 @@ const Word16 *const ivas_sns_cdbks_side_tcx10_fx[SNS_MSVQ_NSTAGES_SIDE] = { /*----------------------------------------------------------------------* * MC ParamUpmix ROM tables *-----------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_alpha_quant_table_fx = { 33, /* nquant */ 16, /* offset */ @@ -3583,7 +3583,7 @@ const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_beta_quant_table_fx[9] = { { 0, 15938355, 36909876, 62914560, 93952408, 130023424, 171127600, 217264944, 268435456 } /* data in Q28 */ } }; - +#endif /* Q Factor is 31*/ const Word32 ivas_han_win_48k_fx[L_FRAME32k] = { 5760, 22976, 51712, 91904, 143552, 206784, 281408, 367552, 465216, diff --git a/lib_com/ivas_rom_com_fx.h b/lib_com/ivas_rom_com_fx.h index 26940e6765802c9073f6bcf06e0d87e78f91689d..049dd0aadf00cdc043345b456e2ad1ad1bbf27ca 100644 --- a/lib_com/ivas_rom_com_fx.h +++ b/lib_com/ivas_rom_com_fx.h @@ -40,7 +40,6 @@ #include "stat_com.h" #include "ivas_stat_com.h" -#ifdef IVAS_FLOAT_FIXED extern const Word16 ivas_sin_twiddle_480_fx[IVAS_480_PT_LEN >> 1]; extern const Word16 ivas_cos_twiddle_480_fx[IVAS_480_PT_LEN >> 1]; @@ -50,6 +49,7 @@ extern const Word16 ivas_sin_twiddle_160_fx[IVAS_160_PT_LEN >> 1]; extern const Word16 ivas_cos_twiddle_160_fx[IVAS_160_PT_LEN >> 1]; extern const Word16 ivas_sin_twiddle_80_fx[IVAS_80_PT_LEN >> 1]; extern const Word16 ivas_cos_twiddle_80_fx[IVAS_80_PT_LEN >> 1]; +#ifdef IVAS_FLOAT_FIXED extern const Word16 nf_tw_smoothing_coeffs_fx[N_LTP_GAIN_MEMS]; extern const Word32 dft_res_gains_q_fx[][2]; extern const Word16 dft_res_cod_alpha_fx[STEREO_DFT_BAND_MAX]; diff --git a/lib_com/ivas_stereo_ica_com_fx.c b/lib_com/ivas_stereo_ica_com_fx.c index 0b3920c8ef7b9727c1a0ffefd9f7665221a8e560..6ffce03e4c8c772f40d070b16fdc1e93c9c36aa1 100644 --- a/lib_com/ivas_stereo_ica_com_fx.c +++ b/lib_com/ivas_stereo_ica_com_fx.c @@ -118,6 +118,7 @@ Word32 inv_table_145[N_MAX_SHIFT_CHANGE + 1] = { Word32 tableD1_145[N_MAX_SHIFT_CHANGE + 1] = { 0, 15027, 120219, 405740, 961755, 1878428, 3245924, 5154407, 7694041, 10954993, 15027425, 20001503, 25967392, 33015256, 41235259, 50717555, 61552334, 73829752, 87639951, 103073111, 120219402 }; +#ifdef IVAS_FLOAT_FIXED static void interpTargetChannel_fx( Word32 *target_fx, const Word16 prevShift, @@ -300,14 +301,14 @@ static void interpTargetChannel_fx( return; } - +#endif /*--------------------------------------------------------------- * Function targetCh_AlignStereoDFT() * * Align target channel in DFT stereo to correct FOR shift variations * ---------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED static void targetCh_AlignStereoDFT_fx( Word32 *target_fx, const Word16 prevShift, @@ -368,14 +369,14 @@ static void targetCh_AlignStereoDFT_fx( return; } - +#endif /*--------------------------------------------------------------- * adjustTargetSignal() * * Target signal correction FOR shift variations. * ---------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED void adjustTargetSignal_fx( Word32 *target_fx, const Word16 prevShift, @@ -396,3 +397,4 @@ void adjustTargetSignal_fx( return; } +#endif diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index 921e84976d7eaaeb324e6af7cbe9189d821f861b..17ce5672dfd8f0f696767082b1a5d104c292b148 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -1568,7 +1568,8 @@ void decoder_tcx_tns_fx( STnsData *tnsData, const Word16 bfi, /* i : Bad frame indicator */ const Word16 frame_cnt, /* i : frame counter in the super frame */ - const Word16 whitenedDomain ) + const Word16 whitenedDomain, + Word16 *length ) { Word16 index, isTCX5, L; TCX_CONFIG_HANDLE hTcxCfg = st->hTcxCfg; @@ -1581,8 +1582,11 @@ void decoder_tcx_tns_fx( L = L_frameTCX; move16(); + test(); IF( EQ_16( L_frame, shr( st->L_frame, 1 ) ) && NE_16( st->tcxonly, 0 ) ) { + test(); + test(); IF( NE_16( frame_cnt, 0 ) && EQ_16( bfi, 0 ) && NE_16( st->last_core, ACELP_CORE ) ) { /* fix sub-window overlap */ @@ -1590,12 +1594,22 @@ void decoder_tcx_tns_fx( move16(); } + test(); + test(); + test(); IF( ( NE_16( hTcxCfg->fIsTNSAllowed, 0 ) && NE_16( fUseTns, 0 ) && NE_16( bfi, 1 ) ) || GT_16( L_spec, L_frameTCX ) ) { L = L_spec; move16(); } + test(); + test(); + test(); + test(); + test(); + test(); + test(); IF( ( EQ_16( bfi, 0 ) && ( NE_16( hTcxCfg->tcx_last_overlap_mode, FULL_OVERLAP ) || ( EQ_16( hTcxCfg->tcx_curr_overlap_mode, FULL_OVERLAP ) && EQ_16( frame_cnt, 0 ) && EQ_16( index, 0 ) ) ) ) || ( NE_16( bfi, 0 ) && ( NE_16( hTcxCfg->tcx_last_overlap_mode, FULL_OVERLAP ) && @@ -1613,11 +1627,16 @@ void decoder_tcx_tns_fx( *-----------------------------------------------------------*/ + test(); + test(); + test(); IF( NE_16( hTcxCfg->fIsTNSAllowed, 0 ) && NE_16( fUseTns, 0 ) && NE_16( bfi, 1 ) && EQ_16( tnsData->tnsOnWhitenedSpectra, whitenedDomain ) ) { /* Apply TNS to get the reconstructed signal */ SetTnsConfig( hTcxCfg, L_frame_glob == st->L_frame, ( st->last_core == ACELP_CORE ) && ( frame_cnt == 0 ) ); + test(); + test(); IF( EQ_16( L_frame, shr( st->L_frame, 1 ) ) && NE_16( st->tcxonly, 0 ) && NE_16( isTCX5, 0 ) ) { tcx5TnsGrouping_fx( shr( L, 1 ), shr( hTcxCfg->tnsConfig[0][0].iFilterBorders[0], 1 ), x_fx ); @@ -1625,8 +1644,11 @@ void decoder_tcx_tns_fx( ApplyTnsFilter( hTcxCfg->pCurrentTnsConfig, tnsData, x_fx, 0 ); + test(); + test(); IF( EQ_16( L_frame, shr( st->L_frame, 1 ) ) && NE_16( st->tcxonly, 0 ) && NE_16( isTCX5, 0 ) ) { + test(); IF( EQ_16( st->element_mode, EVS_MONO ) || LT_16( L_spec, L_frameTCX ) ) /* todo: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */ { tcx5TnsUngrouping_fx( shr( L_frameTCX, 1 ), shr( hTcxCfg->tnsConfig[0][0].iFilterBorders[0], 1 ), x_fx, DEC ); @@ -1637,12 +1659,17 @@ void decoder_tcx_tns_fx( } } } + test(); IF( NE_16( whitenedDomain, 0 ) && NE_16( isTCX5, 0 ) ) { tcx5SpectrumInterleaving_fx( shr( L, 1 ), x_fx ); } /* restore index */ + test(); + test(); + test(); + test(); IF( EQ_16( L_frame, shr( st->L_frame, 1 ) ) && NE_16( st->tcxonly, 0 ) && NE_16( frame_cnt, 0 ) && EQ_16( bfi, 0 ) && NE_16( st->last_core, ACELP_CORE ) ) { /* restore sub-window overlap */ @@ -1650,6 +1677,12 @@ void decoder_tcx_tns_fx( move16(); } + if ( length != NULL ) + { + *length = L; + move16(); + } + return; } #endif diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index f521839cdbd05572fe831b473a662225729a0905..96fcfb25db8faa7b441d4f69edb6bcc92af6a612 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3726,7 +3726,7 @@ void decoder_tcx_ivas_fx( x_e = sub( x_e, shift ); move16(); - decoder_tcx_tns_fx( st, L_frame_glob, L_spec, L_frame, L_frameTCX, x_fx, fUseTns, &tnsData, bfi, frame_cnt, 0 ); + decoder_tcx_tns_fx( st, L_frame_glob, L_spec, L_frame, L_frameTCX, x_fx, fUseTns, &tnsData, bfi, frame_cnt, 0, NULL ); Scale_sig32( x_fx, N_MAX, sub( x_e, 20 ) ); // Scaling x_fx to Q11 Scale_sig( xn_buf_fx, L_MDCT_OVLP_MAX + L_FRAME_PLUS + L_MDCT_OVLP_MAX, sub( st->Q_syn, 14 ) ); // Scaling xn_buf_fx to Q_syn diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 72c1985d84ebafc165da12028d11da237b3fe4a3..6c2bc239ec6072247c82b9057e17308b27b5fffa 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -150,6 +150,7 @@ void mdct_read_IGF_bits( } #endif + /*-----------------------------------------------------------------* * Function dec_prm_tcx_sidebits() * @@ -296,8 +297,7 @@ static void dec_prm_tcx_sidebits_fx( return; } -#endif -#ifndef IVAS_FLOAT_FIXED +#else static void dec_prm_tcx_sidebits( int16_t param[], /* o : decoded parameters */ Decoder_State *st, /* i/o: decoder memory state */ @@ -398,11 +398,13 @@ static void dec_prm_tcx_sidebits( } #endif + /*-----------------------------------------------------------------* * Function dec_prm_tcx_spec() * * decode TCX core parameters *-----------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED static void dec_prm_tcx_spec_fx( Decoder_State *st, /* i/o: decoder memory state */ @@ -482,8 +484,7 @@ static void dec_prm_tcx_spec_fx( return; } -#endif -#ifndef IVAS_FLOAT_FIXED +#else static void dec_prm_tcx_spec( Decoder_State *st, /* i/o: decoder memory state */ int16_t param[], /* o : decoded parameters */ @@ -545,6 +546,7 @@ static void dec_prm_tcx_spec( } #endif + /*-----------------------------------------------------------------* * Function ivas_mdct_dec_side_bits_frame_channel() * @@ -815,8 +817,7 @@ void ivas_mdct_dec_side_bits_frame_channel_fx( return; } -#endif -#ifndef IVAS_FLOAT_FIXED +#else void ivas_mdct_dec_side_bits_frame_channel( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t param_lpc[CPE_CHANNELS][NPRM_LPC_NEW], /* o : lpc_parameters */ @@ -848,16 +849,7 @@ void ivas_mdct_dec_side_bits_frame_channel( if ( MCT_flag ) { /* Initialization or re-configuration of Stereo TCX */ -#ifdef IVAS_FLOAT_FIXED - /* stereo_tcx_dec_mode_switch_reconf_To_fixed is for intermediatery conversions which is needed to be removed */ - stereo_tcx_dec_mode_switch_reconf_To_fixed( sts[ch], 1, hCPE->last_element_mode ); - /*============*/ - stereo_tcx_init_dec_fx( sts[ch], 1, hCPE->last_element_mode ); - /*============*/ - stereo_tcx_dec_mode_switch_reconf_To_fixed( sts[ch], 0, hCPE->last_element_mode ); -#else stereo_tcx_init_dec( sts[ch], 1, hCPE->last_element_mode ); -#endif // IVAS_FLOAT_FIXED } sts[ch]->enablePlcWaveadjust = 0; } @@ -1018,11 +1010,13 @@ void ivas_mdct_dec_side_bits_frame_channel( } #endif + /*-----------------------------------------------------------------* * ivas_mdct_core_invQ() * * Inverse processing steps up to inverse quantization *-----------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED void ivas_mdct_core_invQ_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE handle */ @@ -2288,13 +2282,13 @@ void ivas_mdct_core_reconstruct_fx( #endif -#ifndef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------* * ivas_mdct_core_tns_ns() * * reconstruct time signal *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_mdct_core_tns_ns( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ int16_t fUseTns[CPE_CHANNELS][NB_DIV], /* i : two entries for each channel in TCX10 */ @@ -2352,55 +2346,11 @@ void ivas_mdct_core_tns_ns( if ( !bfi ) { -#ifdef IVAS_FLOAT_FIXED - Word32 sns_int_scf_fx[FDNS_NPTS], Aq_fx[SNS_NPTS]; - FOR( int c = 0; c < SNS_NPTS; c++ ) - { - Aq_fx[c] = (Word32) ( Aq[ch][k * M + c] * ONE_IN_Q16 ); - } - - sns_interpolate_scalefactors_fx( sns_int_scf_fx, Aq_fx, DEC ); - - FOR( int c = 0; c < FDNS_NPTS; c++ ) - { - sns_int_scf[c] = ( (float) sns_int_scf_fx[c] / ONE_IN_Q16 ); - } -#else sns_interpolate_scalefactors( &sns_int_scf[0], &Aq[ch][k * M], DEC ); -#endif // IVAS_FLOAT_FIXED if ( MCT_flag && st->hTonalMDCTConc != NULL && ( ( k + 1 ) == nSubframes[ch] ) ) { -#ifdef IVAS_FLOAT_FIXED - Word32 x_fx[N_MAX]; - Word16 x_e, scf_fx[FDNS_NPTS], scf_e[FDNS_NPTS]; - f2me_buf( x[ch][k], x_fx, &x_e, L_frameTCX[ch] ); - /*for ( int j = 0; j < st->hTonalMDCTConc->nScaleFactors; j++ ) - { - f2me_16( sns_int_scf[j], &scf_fx[j], &scf_e[j] ); - }*/ - Word16 q_shift; - FOR( Word16 ind = 0; ind < st->hTonalMDCTConc->nScaleFactors; ind++ ) - { - q_shift = norm_l( sns_int_scf_fx[ind] ); - scf_fx[ind] = extract_h( L_shl( sns_int_scf_fx[ind], q_shift ) ); - scf_e[ind] = 15 - q_shift; - } - /*float maxim = 0; - FOR(Word16 ind = 0; ind < L_frameTCX[ch]; ind++) { - maxim = fmaxf(maxim, fabsf(x[ch][k][ind])); - } - if (maxim >= 1) q_x = norm_l((Word32)maxim); - FOR(Word16 ind = 0; ind < L_frameTCX[ch]; ind++) { - x_fx[ind] = (Word32)(x[ch][k][ind] * (1 << q_x)); - } - x_e = 31 - q_x;*/ - - TonalMDCTConceal_SaveFreqSignal_ivas_fx( st->hTonalMDCTConc, x_fx, x_e, L_frameTCX[ch], L_frame[ch], &scf_fx[0], scf_e, 0, get_igf_startline( st, L_frame[ch], L_frameTCX[ch] ) ); - // st->hTonalMDCTConc->last_block_nrg_flt = me2f( st->hTonalMDCTConc->last_block_nrg, st->hTonalMDCTConc->last_block_nrg_exp ); -#else TonalMDCTConceal_SaveFreqSignal_ivas( st->hTonalMDCTConc, x[ch][k], L_frameTCX[ch], L_frame[ch], &sns_int_scf[0], get_igf_startline_flt( st, L_frame[ch], L_frameTCX[ch] ) ); -#endif } } else @@ -2409,6 +2359,7 @@ void ivas_mdct_core_tns_ns( { if ( !MCT_flag && st->hTcxDec->cummulative_damping_tcx_float < 0.99f ) // if ( !MCT_flag && st->hTcxDec->cummulative_damping_tcx_float != 1.f ) + { float *scf_last, *scf_bg; float fade_in, fade_out; @@ -2434,66 +2385,9 @@ void ivas_mdct_core_tns_ns( } } -#ifdef IVAS_FLOAT_FIXED - Word32 x_fx_[1200]; - Word16 q = 26; - float maximum = 0; - FOR( Word16 ind = 0; ind < st->hTcxCfg->pCurrentTnsConfig->iFilterBorders[0]; ind++ ) - maximum = fmaxf( maximum, fabsf( x[ch][k][ind] ) ); - if ( maximum >= 1.f ) - q = norm_l( (Word32) maximum ) - 5; - FOR( Word16 ind = 0; ind < s_max( s_max( L_frameTCX[ch], L_spec[ch] ), st->hTcxCfg->pCurrentTnsConfig->iFilterBorders[0] ); ind++ ) - x_fx_[ind] = (Word32) ( x[ch][k][ind] * ( 1 << q ) ); - decoder_tcx_tns_fx( st, L_frame_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], x_fx_, fUseTns[ch][k], &tnsData[ch][k], bfi, k, 1 ); - FOR( Word16 ind = 0; ind < s_max( s_max( L_frameTCX[ch], L_spec[ch] ), st->hTcxCfg->pCurrentTnsConfig->iFilterBorders[0] ); ind++ ) - x[ch][k][ind] = (float) ( x_fx_[ind] ) / (float) ( 1 << q ); -#else decoder_tcx_tns( st, L_frame_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], &x[ch][k][0], fUseTns[ch][k], &tnsData[ch][k], bfi, k, 1 ); -#endif -#ifdef IVAS_FLOAT_FIXED - Word32 x_fx[L_FRAME48k], sns_int_scf_fx[FDNS_NPTS]; - Word16 q_x = 31, q_sns_int_scf = 31; - FOR( Word16 c = 0; c < L_FRAME16k; c++ ) - { - if ( abs( (Word32) x[ch][k][c] ) != 0 ) - q_x = s_min( q_x, norm_l( (Word32) x[ch][k][c] ) ); - } - FOR( Word16 c = 0; c < FDNS_NPTS; c++ ) - { - if ( abs( (Word32) sns_int_scf[c] ) != 0 ) - q_sns_int_scf = s_min( q_sns_int_scf, norm_l( (Word32) sns_int_scf[c] ) ); - } - q_x -= 1; - q_sns_int_scf -= 1; - FOR( Word16 c = 0; c < st->hTcxCfg->psychParamsCurrent->nBins; c++ ) - { - x_fx[c] = (Word32) ( x[ch][k][c] * ( 1 << q_x ) ); - } - FOR( Word16 c = 0; c < FDNS_NPTS; c++ ) - { - sns_int_scf_fx[c] = (Word32) ( sns_int_scf[c] * ( 1 << q_sns_int_scf ) ); - } - - sns_shape_spectrum_fx( x_fx, &q_x, st->hTcxCfg->psychParamsCurrent, sns_int_scf_fx, q_sns_int_scf, st->hTcxCfg->psychParamsCurrent->nBins ); - - IF( q_x + 1 < 31 ) - { - FOR( Word16 c = 0; c < st->hTcxCfg->psychParamsCurrent->nBins; c++ ) - { - x[ch][k][c] = ( (float) x_fx[c] / ( 1 << ( q_x + 1 ) ) ); - } - } - ELSE - { - FOR( Word16 c = 0; c < st->hTcxCfg->psychParamsCurrent->nBins; c++ ) - { - x[ch][k][c] = ( (float) x_fx[c] / ONE_IN_Q31 ); - } - } -#else sns_shape_spectrum( x[ch][k], st->hTcxCfg->psychParamsCurrent, &sns_int_scf[0], st->hTcxCfg->psychParamsCurrent->nBins ); -#endif // IVAS_FLOAT_FIXED v_multc( x[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, sns_int_scf[FDNS_NPTS - 1], x[ch][k] + st->hTcxCfg->psychParamsCurrent->nBins, L_spec[ch] - st->hTcxCfg->psychParamsCurrent->nBins ); decoder_tcx_tns( st, L_frame_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], &x[ch][k][0], fUseTns[ch][k], &tnsData[ch][k], bfi, k, 0 ); @@ -2512,8 +2406,7 @@ void ivas_mdct_core_tns_ns( return; } -#endif -#ifdef IVAS_FLOAT_FIXED +#else /* Has a missing dependency: TonalMDCTConceal_Apply. Currently not used anywhere and untested.*/ void ivas_mdct_core_tns_ns_fx( CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ @@ -2537,7 +2430,7 @@ void ivas_mdct_core_tns_ns_fx( Word16 left_rect[CPE_CHANNELS]; Word16 L_spec[CPE_CHANNELS]; Word32 sns_int_scf_fx[FDNS_NPTS]; - Word16 exp; + Word16 exp, length; /* Initializations */ sts = hCPE->hCoreCoder; @@ -2656,16 +2549,28 @@ void ivas_mdct_core_tns_ns_fx( } Word16 norm_x; q_x = sub( q_x, 5 ); - Scale_sig32( &x_fx[ch][k][0], L_spec[ch], -5 ); - decoder_tcx_tns_fx( st, L_frame_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], x_fx[ch][k], fUseTns[ch][k], &tnsData[ch][k], bfi, k, 1 ); - norm_x = getScaleFactor32( &x_fx[ch][k][0], L_spec[ch] ); - Scale_sig32( &x_fx[ch][k][0], L_spec[ch], norm_x ); + length = L_frameTCX[ch]; + move16(); + test(); + test(); + test(); + test(); + test(); + if ( EQ_16( L_frame[ch], shr( st->L_frame, 1 ) ) && NE_16( st->tcxonly, 0 ) && ( ( NE_16( st->hTcxCfg->fIsTNSAllowed, 0 ) && NE_16( fUseTns[ch][k], 0 ) && NE_16( bfi, 1 ) ) || GT_16( L_spec[ch], L_frameTCX[ch] ) ) ) + { + length = L_spec[ch]; + move16(); + } + Scale_sig32( &x_fx[ch][k][0], length, -5 ); + decoder_tcx_tns_fx( st, L_frame_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], x_fx[ch][k], fUseTns[ch][k], &tnsData[ch][k], bfi, k, 1, &length ); + norm_x = getScaleFactor32( &x_fx[ch][k][0], length ); + Scale_sig32( &x_fx[ch][k][0], length, norm_x ); q_x = add( q_x, norm_x ); x_e[ch][k] = sub( 31, q_x ); move16(); Word16 q_sns_int_scf; - Word16 q_2, length; + Word16 q_2; q_sns_int_scf = add( 16 - 1, getScaleFactor32( sns_int_scf_fx, FDNS_NPTS ) ); // q_sns_int_scf -= 1; FOR( Word16 c = 0; c < FDNS_NPTS; c++ ) @@ -2700,10 +2605,22 @@ void ivas_mdct_core_tns_ns_fx( move16(); q_x = sub( q_x, 5 ); - Scale_sig32( &x_fx[ch][k][0], L_spec[ch], -5 ); - decoder_tcx_tns_fx( st, L_frame_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], &x_fx[ch][k][0], fUseTns[ch][k], &tnsData[ch][k], bfi, k, 0 ); - norm_x = getScaleFactor32( &x_fx[ch][k][0], L_spec[ch] ); - Scale_sig32( &x_fx[ch][k][0], L_spec[ch], norm_x ); + length = L_frameTCX[ch]; + move16(); + test(); + test(); + test(); + test(); + test(); + if ( EQ_16( L_frame[ch], shr( st->L_frame, 1 ) ) && NE_16( st->tcxonly, 0 ) && ( ( NE_16( st->hTcxCfg->fIsTNSAllowed, 0 ) && NE_16( fUseTns[ch][k], 0 ) && NE_16( bfi, 1 ) ) || GT_16( L_spec[ch], L_frameTCX[ch] ) ) ) + { + length = L_spec[ch]; + move16(); + } + Scale_sig32( &x_fx[ch][k][0], length, -5 ); + decoder_tcx_tns_fx( st, L_frame_global[ch], L_spec[ch], L_frame[ch], L_frameTCX[ch], &x_fx[ch][k][0], fUseTns[ch][k], &tnsData[ch][k], bfi, k, 0, &length ); + norm_x = getScaleFactor32( &x_fx[ch][k][0], length ); + Scale_sig32( &x_fx[ch][k][0], length, norm_x ); q_x = add( q_x, norm_x ); x_e[ch][k] = sub( 31, q_x ); move16(); diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 7337086579ff713fbdc5eb63e5c48d6c425ca7dc..c1c049cbd04921d9827f46745f024c0d4ac788fd 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -1282,7 +1282,7 @@ ivas_error stereo_memory_dec_fx( DEC_CORE_HANDLE st; Word16 i, n, delay_comp_DFT; ivas_error error; - Word16 div_m, div_e; + Word16 div_m, div_e, tmp16; error = IVAS_ERR_OK; @@ -1764,7 +1764,16 @@ ivas_error stereo_memory_dec_fx( IF( hCPE->hCoreCoder[0]->bfi == 0 ) { st = hCPE->hCoreCoder[1]; - hCPE->hStereoTD->tdm_LRTD_flag = get_indice_st( hCPE->hCoreCoder[0], L_add( hCPE->element_brate, hCPE->brate_surplus ), ( sub( add( sub( extract_l( Mpy_32_16_1( hCPE->element_brate, INV_FRAME_PER_SEC_Q15 ) ), nb_bits_metadata ), extract_l( Mpy_32_16_1( hCPE->brate_surplus, INV_FRAME_PER_SEC_Q15 ) ) ), ( TDM_SECONDARY_SIGNALLING + TDM_RATIO_BITS + TDM_LP_REUSE_BITS + TDM_LR_CONTENT_BITS ) ) ), TDM_LR_CONTENT_BITS ); + IF( hCPE->brate_surplus < 0 ) + { + tmp16 = extract_l( L_negate( Mpy_32_32( L_abs( hCPE->brate_surplus ), ONE_BY_FRAMES_PER_SEC_Q31 ) ) ); + } + ELSE + { + tmp16 = extract_l( Mpy_32_32( hCPE->brate_surplus, ONE_BY_FRAMES_PER_SEC_Q31 ) ); + } + + hCPE->hStereoTD->tdm_LRTD_flag = get_indice_st( hCPE->hCoreCoder[0], L_add( hCPE->element_brate, hCPE->brate_surplus ), ( sub( add( sub( extract_l( Mpy_32_16_1( hCPE->element_brate, INV_FRAME_PER_SEC_Q15 ) ), nb_bits_metadata ), tmp16 ), ( TDM_SECONDARY_SIGNALLING + TDM_RATIO_BITS + TDM_LP_REUSE_BITS + TDM_LR_CONTENT_BITS ) ) ), TDM_LR_CONTENT_BITS ); move16(); IF( hCPE->hStereoTD->tdm_LRTD_flag != 0 ) @@ -3096,7 +3105,7 @@ void stereo_switching_dec( test(); test(); test(); - IF( GT_32( ivas_total_brate, IVAS_SID_5k2 ) || n == 0 || EQ_16( hCPE->last_element_mode, IVAS_CPE_TD ) || EQ_16( hCPE->nchan_out, 1 ) ) + IF( GT_32( ivas_total_brate, IVAS_SID_5k2 ) || n == 0 || NE_16( hCPE->last_element_mode, IVAS_CPE_TD ) || EQ_16( hCPE->nchan_out, 1 ) ) { FOR( i = 0; i < dft32ms_ovl; i++ ) { diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc.c b/lib_enc/ivas_stereo_mdct_stereo_enc.c index 1c6aa5e8668ba512a53de31d1ed4becf76fa5222..ea78be94ecf3dbcfa446ef6edd655332bd7f4087 100644 --- a/lib_enc/ivas_stereo_mdct_stereo_enc.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc.c @@ -108,7 +108,7 @@ static void dft_ana_init( return; } - +#ifdef IVAS_FLOAT_FIXED static void dft_ana_init_fx( DFT_ANA_HANDLE hDft_ana, /*i : DFT analysis handle */ const Word32 input_Fs /*i : Input sampling frequency */ @@ -147,7 +147,7 @@ static void dft_ana_init_fx( return; } - +#endif /*-------------------------------------------------------------------* * write_itd_data() * @@ -1190,7 +1190,7 @@ ivas_error initMdctItdHandling( return IVAS_ERR_OK; } - +#ifdef IVAS_FLOAT_FIXED ivas_error initMdctItdHandling_fx( STEREO_MDCT_ENC_DATA *hStereoMdct, /* i/o: mdct stereo parameters structure */ const Word32 input_Fs /* i : input sampling rate */ @@ -1220,6 +1220,7 @@ ivas_error initMdctItdHandling_fx( return IVAS_ERR_OK; } +#endif /*------------------------------------------------------------------------- * stereo_mdct_enc_destroy() * diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 2ce92589289cd2d1bb515560d8d700615f5bbce2..bd7ebe21d73c8db2c96093b9b2aa392017aa69f1 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -13564,8 +13564,8 @@ void IVAS_REND_Close( closeHeadRotation( hIvasRend ); - ivas_external_orientation_close_fx( &hIvasRend->hExternalOrientationData ); - ivas_combined_orientation_close_fx( &hIvasRend->hCombinedOrientationData ); + ivas_external_orientation_close( &hIvasRend->hExternalOrientationData ); + ivas_combined_orientation_close( &hIvasRend->hCombinedOrientationData ); free( hIvasRend ); *phIvasRend = NULL; @@ -14804,7 +14804,7 @@ static ivas_error initMasaExtRenderer( { for ( i = 0; i < hMasaExtRend->nchan_input; i++ ) { - if ( ( error = openCldfb( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + if ( ( error = openCldfb_ivas( &( hMasaExtRend->cldfbAnaRend[i] ), CLDFB_ANALYSIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { return error; } @@ -14812,7 +14812,7 @@ static ivas_error initMasaExtRenderer( for ( i = 0; i < hMasaExtRend->nchan_output; i++ ) { - if ( ( error = openCldfb( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + if ( ( error = openCldfb_ivas( &( hMasaExtRend->cldfbSynRend[i] ), CLDFB_SYNTHESIS, *inputMasa->base.ctx.pOutSampleRate, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) { return error; }