From 4a973cc407a272256d24ea5c5ef1cfae0eb33cf9 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 8 Aug 2024 16:24:07 +0530 Subject: [PATCH 1/3] Float code cleanup, Instrumentation and BASOP addition --- apps/decoder.c | 7 + lib_com/ACcontextMapping.c | 2 +- lib_com/ari_hm.c | 39 +- lib_com/basop_util.c | 3 +- lib_com/bits_alloc_fx.c | 20 +- lib_com/cldfb.c | 24 +- lib_com/core_com_config.c | 2 +- lib_com/fd_cng_com_fx.c | 2 +- lib_com/fft.c | 3 +- lib_com/fft_cldfb_fx.c | 25 -- lib_com/fft_evs.c | 38 -- lib_com/fft_fx.c | 324 +--------------- lib_com/fft_fx_evs.c | 4 +- lib_com/fft_rel.c | 180 --------- lib_com/fft_rel_fx.c | 1 - lib_com/fill_spectrum.c | 6 +- lib_com/findpulse.c | 12 +- lib_com/fine_gain_bits_fx.c | 3 +- lib_com/frame_ener.c | 4 +- lib_com/gain_inov_fx.c | 1 - lib_com/get_gain.c | 7 +- lib_com/gs_bitallocation.c | 11 +- lib_com/gs_bitallocation_fx.c | 10 +- lib_com/gs_gains_fx.c | 27 +- lib_com/gs_inact_switching_fx.c | 2 + lib_com/gs_noisefill_fx.c | 23 +- lib_com/gs_preech.c | 3 + lib_com/guided_plc_util_fx.c | 6 +- lib_com/hp50.c | 162 +------- lib_com/hq2_bit_alloc.c | 247 ------------- lib_com/hq2_core_com.c | 52 ++- lib_com/hq2_core_com_fx.c | 11 +- lib_com/hq_bit_allocation_fx.c | 4 - lib_com/hvq_pvq_bitalloc_fx.c | 1 - lib_com/ifft_rel.c | 365 ------------------- lib_com/igf_base.c | 9 - lib_com/igf_base_fx.c | 6 - lib_com/interleave_spectrum.c | 5 +- lib_com/interpol.c | 1 - lib_com/isf_dec_amr_wb_fx.c | 1 - lib_com/ivas_agc_com_fx.c | 29 +- lib_com/ivas_dirac_com.c | 11 +- lib_com/ivas_fb_mixer.c | 304 +++------------ lib_com/ivas_masa_com.c | 2 +- lib_com/ivas_mc_param_com.c | 31 +- lib_com/ivas_mdct_imdct.c | 3 +- lib_com/ivas_mdft_imdft.c | 30 +- lib_com/ivas_pca_tools.c | 2 + lib_com/ivas_prot.h | 11 +- lib_com/ivas_prot_fx.h | 25 +- lib_com/ivas_sns_com_fx.c | 9 +- lib_com/ivas_spar_com_quant_util.c | 23 +- lib_com/ivas_stereo_eclvq_com_fx.c | 2 + lib_com/ivas_stereo_mdct_bands_com.c | 3 +- lib_com/ivas_stereo_psychlpc_com.c | 104 +++++- lib_com/ivas_stereo_td_bit_alloc.c | 44 +-- lib_com/ivas_tools.c | 31 +- lib_com/ivas_transient_det.c | 160 ++++---- lib_com/lag_wind.c | 1 + lib_com/lerp.c | 2 - lib_com/limit_t0_fx.c | 2 +- lib_com/log2.h | 1 - lib_com/low_rate_band_att_fx.c | 3 +- lib_com/lpc_tools_fx.c | 3 +- lib_com/lsf_dec_bfi_fx.c | 1 - lib_com/lsf_tools_fx.c | 2 +- lib_com/modif_fs_fx.c | 3 +- lib_com/nelp_fx.c | 1 - lib_com/oper_32b.c | 1 + lib_com/oper_32b.h | 1 - lib_com/options.h | 1 + lib_com/parameter_bitmaping_fx.c | 5 +- lib_com/phase_dispersion_fx.c | 7 +- lib_com/prot.h | 34 +- lib_com/prot_fx.h | 86 ++--- lib_com/pvq_com.c | 2 +- lib_com/pvq_com_fx.c | 4 +- lib_com/range_com_fx.c | 1 - lib_com/re8_util_fx.c | 1 + lib_com/residu.c | 3 + lib_com/residu_fx.c | 1 + lib_com/rom_basic_math.c | 1 - lib_com/rom_basic_math.h | 1 - lib_com/rom_basop_util.c | 1 - lib_com/rom_basop_util.h | 3 +- lib_com/rom_com_fx.c | 19 - lib_com/swb_bwe_com_fx.c | 21 +- lib_com/swb_bwe_com_hr.c | 6 + lib_com/swb_bwe_com_lr_fx.c | 1 - lib_com/swb_tbe_com_fx.c | 4 +- lib_com/tcq_position_arith.c | 22 +- lib_com/tcx_ltp_fx.c | 134 ++++--- lib_com/tcx_mdct_window.c | 8 +- lib_com/tcx_utils_fx.c | 5 +- lib_com/tec_com.c | 29 +- lib_com/tools.c | 10 +- lib_com/tools_fx.c | 23 +- lib_com/trans_inv_fx.c | 1 - lib_com/window.c | 3 +- lib_com/window_fx.c | 2 +- lib_dec/FEC_clas_estim.c | 2 +- lib_dec/FEC_lsf_estim_fx.c | 3 +- lib_dec/FEC_scale_syn.c | 2 +- lib_dec/LD_music_post_filter_fx.c | 2 + lib_dec/acelp_core_dec_ivas_fx.c | 34 +- lib_dec/avq_dec_fx.c | 2 +- lib_dec/core_dec_reconf_fx.c | 4 + lib_dec/core_dec_switch_fx.c | 5 +- lib_dec/dec_ace_fx.c | 2 +- lib_dec/dec_acelp_fx.c | 4 +- lib_dec/dec_post_fx.c | 2 - lib_dec/dlpc_avq_fx.c | 2 - lib_dec/dlpc_stoch_fx.c | 3 - lib_dec/evs_dec.c | 4 - lib_dec/gs_dec_amr_wb_fx.c | 11 +- lib_dec/hdecnrm_fx.c | 3 +- lib_dec/hq_env_dec_fx.c | 2 + lib_dec/init_dec.c | 3 - lib_dec/init_dec_fx.c | 22 +- lib_dec/inov_dec_fx.c | 12 - lib_dec/ivas_binRenderer_internal.c | 9 +- lib_dec/ivas_dirac_dec.c | 13 +- lib_dec/ivas_dirac_output_synthesis_cov.c | 17 +- lib_dec/ivas_init_dec.c | 2 +- lib_dec/ivas_ism_dtx_dec.c | 10 +- lib_dec/ivas_ism_renderer.c | 13 +- lib_dec/ivas_mc_param_dec.c | 8 +- lib_dec/ivas_sba_dirac_stereo_dec_fx.c | 5 + lib_dec/ivas_sce_dec.c | 3 - lib_dec/ivas_sns_dec_fx.c | 2 - lib_dec/ivas_stereo_cng_dec.c | 4 +- lib_dec/ivas_stereo_mdct_stereo_dec.c | 3 - lib_dec/lead_deindexing.c | 3 +- lib_dec/lead_deindexing_fx.c | 3 +- lib_dec/lp_exc_d.c | 3 + lib_dec/lp_exc_d_fx.c | 2 + lib_dec/lsf_dec_fx.c | 1 - lib_dec/lsf_msvq_ma_dec_fx.c | 2 + lib_dec/nelp_dec_fx.c | 2 + lib_dec/peak_vq_dec_fx.c | 13 +- lib_dec/pit_dec_fx.c | 3 +- lib_dec/pitch_extr_fx.c | 11 +- lib_dec/post_dec_fx.c | 9 - lib_dec/ppp_dec_fx.c | 2 + lib_dec/pvq_core_dec_fx.c | 4 +- lib_dec/pvq_decode_fx.c | 4 + lib_dec/range_dec_fx.c | 2 + lib_dec/re8_dec.c | 3 +- lib_dec/re8_dec_fx.c | 2 + lib_dec/rom_dec.c | 20 +- lib_dec/rom_dec.h | 7 +- lib_dec/rst_dec_fx.c | 2 + lib_dec/swb_bwe_dec.c | 15 - lib_dec/tonalMDCTconcealment_fx.c | 4 +- lib_enc/enc_gen_voic_fx.c | 1 - lib_enc/evs_enc_fx.c | 3 +- lib_enc/hq_core_enc_fx.c | 2 + lib_enc/hq_hr_enc_fx.c | 3 +- lib_enc/pvq_core_enc_fx.c | 3 +- lib_rend/ivas_allrad_dec.c | 1 - lib_rend/ivas_crend.c | 62 ++-- lib_rend/ivas_dirac_ana.c | 2 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 193 +++------- lib_rend/ivas_dirac_decorr_dec.c | 44 +-- lib_rend/ivas_dirac_onsets_dec.c | 17 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 2 +- lib_rend/ivas_dirac_rend.c | 14 +- lib_rend/ivas_efap.c | 11 +- lib_rend/ivas_mcmasa_ana.c | 2 +- lib_rend/ivas_objectRenderer.c | 2 +- lib_rend/ivas_objectRenderer_mix.c | 3 +- lib_rend/ivas_objectRenderer_sources.c | 2 + lib_rend/ivas_objectRenderer_vec.c | 7 + lib_rend/ivas_omasa_ana.c | 4 + lib_rend/ivas_output_init.c | 28 -- lib_rend/ivas_prot_rend.h | 5 + lib_rend/ivas_reflections.c | 5 +- lib_rend/ivas_reverb.c | 20 +- lib_rend/ivas_reverb_delay_line.c | 2 - lib_rend/ivas_reverb_fft_filter.c | 14 +- lib_rend/ivas_reverb_filter_design.c | 11 +- lib_rend/ivas_reverb_iir_filter.c | 2 +- lib_rend/ivas_rotation.c | 8 +- lib_rend/ivas_sba_rendering.c | 4 +- lib_rend/ivas_shoebox.c | 11 +- lib_rend/lib_rend.c | 91 ++--- lib_util/test_fft.c | 7 +- lib_util/test_mdct.c | 2 + 188 files changed, 1150 insertions(+), 2705 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 80c33f9ee..0155a305a 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -134,8 +134,10 @@ static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec ); +#if 0 void run_fft_unit_test( void ); void run_mdct_unit_test( void ); +#endif /*------------------------------------------------------------------------------------------* * main() @@ -163,7 +165,9 @@ int main( RenderConfigReader *renderConfigReader = NULL; int16_t *pcmBuf = NULL; IVAS_RENDER_FRAMESIZE asked_frame_size; +#if 0 int16_t run_unit_tests = 0; +#endif #ifdef WMOPS reset_wmops(); @@ -176,6 +180,7 @@ int main( IVAS_DEC_PrintDisclaimer(); +#if 0 if ( run_unit_tests ) { run_fft_unit_test(); @@ -183,6 +188,8 @@ int main( return 0; } +#endif + if ( !parseCmdlIVAS_dec( (int16_t) argc, argv, &arg ) ) { /* Error printout done in parseCmdlIVAS_dec() */ diff --git a/lib_com/ACcontextMapping.c b/lib_com/ACcontextMapping.c index 54f5e18fe..1af3286bf 100644 --- a/lib_com/ACcontextMapping.c +++ b/lib_com/ACcontextMapping.c @@ -76,7 +76,7 @@ Word16 get_next_coeff_mapped_ivas( UWord32 p; p = s_and( sub( ii[1], hm_cfg->numPeakIndices ), sub( hm_cfg->indexBuffer[ii[1]], hm_cfg->indexBuffer[ii[0]] ) ); - p >>= sub( sizeof( p ) * 8, 1 ); + p = UL_lshr( p, sub( sizeof( p ) * 8, 1 ) ); *pp = p; move32(); *idx = ii[p]; diff --git a/lib_com/ari_hm.c b/lib_com/ari_hm.c index a072974d9..8306376e2 100644 --- a/lib_com/ari_hm.c +++ b/lib_com/ari_hm.c @@ -289,13 +289,13 @@ Word16 CountIndexBits_fx( * *-------------------------------------------------------------------*/ -int16_t tcx_hm_render_ivas( - const int16_t lag, /* i : pitch lag */ - const int16_t fract_res, /* i : fractional resolution of the lag */ - Word16 p[] /* o : harmonic model (Q13) */ +Word16 tcx_hm_render_ivas( + const Word16 lag, /* i : pitch lag */ + const Word16 fract_res, /* i : fractional resolution of the lag */ + Word16 p[] /* o : harmonic model (Q13) */ ) { - int16_t k; + Word16 k; Word32 f0, tmp32; Word16 height, PeakDeviation, tmp; @@ -327,13 +327,14 @@ int16_t tcx_hm_render_ivas( /* Render the prototype peak */ p[kTcxHmParabolaHalfWidth] = height; + move16(); - for ( k = 1; k <= kTcxHmParabolaHalfWidth; ++k ) + FOR( k = 1; k <= kTcxHmParabolaHalfWidth; ++k ) { p[kTcxHmParabolaHalfWidth + k] = round_fx( Mpy_32_16_1( BASOP_Util_InvLog2( L_shl( L_mult0( mult0( negate( k ), k ), tmp ), 10 ) ), height ) ); } /* Mirror */ - for ( k = -kTcxHmParabolaHalfWidth; k < 0; ++k ) + FOR( k = -kTcxHmParabolaHalfWidth; k < 0; ++k ) { p[kTcxHmParabolaHalfWidth + k] = p[kTcxHmParabolaHalfWidth - k]; } @@ -405,14 +406,14 @@ Word32 tcx_hm_render_fx( void tcx_hm_modify_envelope_ivas( const Word16 gain, /* i : HM gain (Q11) */ - const int16_t lag, - const int16_t fract_res, - const Word16 p[], /* i : harmonic model (Q13) */ - Word32 env[], /* i/o: envelope (Q16) */ - const int16_t L_frame /* i : number of spectral lines */ + const Word16 lag, + const Word16 fract_res, + const Word16 p[], /* i : harmonic model (Q13) */ + Word32 env[], /* i/o: envelope (Q16) */ + const Word16 L_frame /* i : number of spectral lines */ ) { - int16_t k, h, x; + Word16 k, h, x; Word16 inv_shape[2 * kTcxHmParabolaHalfWidth + 1]; /* Q15 */ if ( gain == 0 ) @@ -420,23 +421,25 @@ void tcx_hm_modify_envelope_ivas( return; } - for ( k = 0; k < 2 * kTcxHmParabolaHalfWidth + 1; ++k ) + FOR( k = 0; k < 2 * kTcxHmParabolaHalfWidth + 1; ++k ) { inv_shape[k] = div_s( 512, add( 512, round_fx( L_mult( gain, p[k] ) ) ) ); + move16(); } h = 1; - k = lag >> fract_res; + k = shr( lag, fract_res ); - while ( k <= L_frame + kTcxHmParabolaHalfWidth - 1 ) + WHILE( k <= L_frame + kTcxHmParabolaHalfWidth - 1 ) { - for ( x = max( 0, k - kTcxHmParabolaHalfWidth ); x <= min( k + kTcxHmParabolaHalfWidth, L_frame - 1 ); ++x ) + FOR( x = max( 0, k - kTcxHmParabolaHalfWidth ); x <= min( k + kTcxHmParabolaHalfWidth, L_frame - 1 ); ++x ) { env[x] = Mpy_32_16_1( env[x], inv_shape[x - k + kTcxHmParabolaHalfWidth] ); + move32(); } ++h; - k = ( h * lag ) >> fract_res; + k = extract_l( L_shr( L_mult0( h, lag ), fract_res ) ); } return; diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 0085d0c2e..fcaff0505 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -945,8 +945,9 @@ Word16 BASOP_Util_Divide3232_uu_1616_Scale( Word32 x, Word32 y, Word16 *s ) Word32 div_w( Word32 L_num, Word32 L_den ) { - Word32 L_var_out = (Word32) 0; + Word32 L_var_out = 0; Word16 iteration; + move32(); IF( L_den == 0 ) diff --git a/lib_com/bits_alloc_fx.c b/lib_com/bits_alloc_fx.c index 1e1fd7552..7e18b92a5 100644 --- a/lib_com/bits_alloc_fx.c +++ b/lib_com/bits_alloc_fx.c @@ -762,14 +762,14 @@ ivas_error config_acelp1( core_brate = brate_intermed_tbl[i]; move32(); - if ( element_mode > EVS_MONO ) + if ( GT_16( element_mode, EVS_MONO ) ) { flag_hardcoded = 0; /* use automatic and flexible ACELP bit-budget allocation */ move16(); } test(); - if ( core != ACELP_CORE && element_mode == EVS_MONO ) /* needed for mode1 core switching in EVS mono */ + if ( NE_16( core, ACELP_CORE ) && EQ_16( element_mode, EVS_MONO ) ) /* needed for mode1 core switching in EVS mono */ { flag_hardcoded = 1; move16(); @@ -1109,7 +1109,7 @@ ivas_error config_acelp1( { IF( EQ_16( tc_subfr, TC_0_0 ) ) { - if ( enc_dec == ENC ) + if ( EQ_16( enc_dec, ENC ) ) { bits = sub( bits, 1 ); /* TC signalling */ } @@ -1121,7 +1121,7 @@ ivas_error config_acelp1( } ELSE IF( EQ_16( tc_subfr, TC_0_64 ) ) { - if ( enc_dec == ENC ) + if ( EQ_16( enc_dec, ENC ) ) { bits = sub( bits, 4 ); /* TC signalling */ } @@ -1133,7 +1133,7 @@ ivas_error config_acelp1( } ELSE IF( EQ_16( tc_subfr, TC_0_128 ) ) { - if ( enc_dec == ENC ) + if ( EQ_16( enc_dec, ENC ) ) { bits = sub( bits, 4 ); /* TC signalling */ } @@ -1145,7 +1145,7 @@ ivas_error config_acelp1( } ELSE IF( EQ_16( tc_subfr, TC_0_192 ) ) { - if ( enc_dec == ENC ) + if ( EQ_16( enc_dec, ENC ) ) { bits = sub( bits, 3 ); /* TC signalling */ } @@ -1157,7 +1157,7 @@ ivas_error config_acelp1( } ELSE IF( EQ_16( tc_subfr, L_SUBFR ) ) { - if ( enc_dec == ENC ) + if ( EQ_16( enc_dec, ENC ) ) { bits = sub( bits, 3 ); /* TC signalling */ } @@ -1169,7 +1169,7 @@ ivas_error config_acelp1( } ELSE { - if ( enc_dec == ENC ) + if ( EQ_16( enc_dec, ENC ) ) { bits = sub( bits, 4 ); /* TC signalling */ } @@ -1182,7 +1182,7 @@ ivas_error config_acelp1( } ELSE /* L_frame == L_FRAME16k */ { - IF( enc_dec == ENC ) + IF( EQ_16( enc_dec, ENC ) ) { IF( LE_16( tc_subfr, 2 * L_SUBFR ) ) { @@ -1223,7 +1223,7 @@ ivas_error config_acelp1( test(); test(); test(); - IF( EQ_16( element_mode, IVAS_CPE_TD ) && EQ_16( tdm_low_rate_mode, 1 ) && coder_type != INACTIVE && NE_16( coder_type, UNVOICED ) ) /* GENERIC low rate mode for secondary channel */ + IF( EQ_16( element_mode, IVAS_CPE_TD ) && EQ_16( tdm_low_rate_mode, 1 ) && NE_16( coder_type, INACTIVE ) && NE_16( coder_type, UNVOICED ) ) /* GENERIC low rate mode for secondary channel */ { set16_fx( acelp_cfg->pitch_bits, 0, NB_SUBFR16k ); set16_fx( acelp_cfg->gains_mode, 0, NB_SUBFR16k ); diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c index 844cf8887..6bbd3e152 100644 --- a/lib_com/cldfb.c +++ b/lib_com/cldfb.c @@ -1728,8 +1728,6 @@ ivas_error openCldfb_ivas_fx( move16(); hs->prototype = prototype; move16(); - - // configureCldfb_ivas( hs, sampling_rate ); configureCldfb_ivas_fx( hs, sampling_rate ); hs->memory32 = NULL; hs->FilterStates = NULL; @@ -1752,18 +1750,12 @@ ivas_error openCldfb_ivas_fx( } hs->cldfb_state_length = buf_len; // Temporarily added to store the length of buffer - hs->cldfb_size = buf_len; /*for having original size at intermediatery conversion, will be removed on removing conversion*/ + move16(); + hs->cldfb_size = buf_len; /*for having original size at intermediatery conversion, will be removed on removing conversion*/ + move16(); set32_fx( hs->cldfb_state_fx, 0, buf_len ); hs->Q_cldfb_state = Q11; - /* TODO: remove the floating point dependency */ - - /*IF( ( hs->cldfb_state = (float *) malloc( buf_len * sizeof( float ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB" ); - }*/ - - // set_f( hs->cldfb_state, 0.0f, buf_len ); - + move16(); *h_cldfb = hs; move16(); @@ -1987,6 +1979,8 @@ void analysisCldfbEncoder_ivas_fx( enerScale.lb_scale = negate( scale->lb_scale ); enerScale.lb_scale16 = negate( scale->lb_scale ); + move16(); + move16(); AnalysisPostSpectrumScaling_Fx( st->cldfbAnaEnc, ppBuf_Real, ppBuf_Imag, ppBuf_Real16, ppBuf_Imag16, &enerScale.lb_scale16 ); @@ -2125,12 +2119,6 @@ void deleteCldfb_ivas_fx( { free( hs->cldfb_state_fx ); } -#ifdef IVAS_FLOAT_FIXED // TODO : Will be removed later - // IF( hs->cldfb_state ) - //{ - // free( hs->cldfb_state ); - // } -#endif free( hs ); *h_cldfb = NULL; diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index 4b16b0b53..eb705127f 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -1618,7 +1618,7 @@ void init_tcx_cfg_fx( } /*Set bandwidth scale*/ - IF( bwidth == NB ) + IF( EQ_16( bwidth, NB ) ) { na_scale_bwidth = NB; } diff --git a/lib_com/fd_cng_com_fx.c b/lib_com/fd_cng_com_fx.c index 3acd8991a..825d13cbb 100644 --- a/lib_com/fd_cng_com_fx.c +++ b/lib_com/fd_cng_com_fx.c @@ -2804,7 +2804,7 @@ void SynthesisSTFT_dirac( **************************************************************************************/ void mhvals( const Word16 d, - Word16 *m /*, float * h*/ + Word16 *m /*, Word16 * h*/ ) { Word16 i, j; diff --git a/lib_com/fft.c b/lib_com/fft.c index c40556298..7ae89b7d5 100644 --- a/lib_com/fft.c +++ b/lib_com/fft.c @@ -6389,10 +6389,8 @@ void rfft( return; } - #define WMC_TOOL_SKIP - #define SHC( x ) ( (Word16) x ) #define FFTC( x ) WORD322WORD16( (Word32) x ) @@ -6702,4 +6700,5 @@ void BASOP_cfft_ivas( return; } + #undef WMC_TOOL_SKIP diff --git a/lib_com/fft_cldfb_fx.c b/lib_com/fft_cldfb_fx.c index dcc86b94f..ba5ca4e1e 100644 --- a/lib_com/fft_cldfb_fx.c +++ b/lib_com/fft_cldfb_fx.c @@ -709,12 +709,6 @@ static void fft30_with_cmplx_data( cmplx *inp ) y[14] = CL_mac_j( rs1, rs2 ); y[12] = CL_mac_j( rs3, rs4 ); y[13] = CL_msu_j( rs3, rs4 ); - /*for (i=10; i<15; i++) - { - printf("%d,\t %d,\t",y[i].re, y[i].im); - } - printf("\n\n");*/ - /* 1. FFT3 stage */ /* real part */ @@ -765,13 +759,7 @@ static void fft30_with_cmplx_data( cmplx *inp ) z[4] = CL_mac_j( rs1, rs2 ); z[14] = CL_msu_j( rs1, rs2 ); - /*for (i=0; i<15; i++) - printf("%d,\t %d,\t",z[i].re, z[i].im); - printf("\n\n");*/ - - /* 2. FFT15 stage */ - x[0] = CL_shr( inp[15], SCALEFACTOR30_1 ); x[1] = CL_shr( inp[3], SCALEFACTOR30_1 ); x[2] = CL_shr( inp[21], SCALEFACTOR30_1 ); @@ -854,12 +842,6 @@ static void fft30_with_cmplx_data( cmplx *inp ) y[14] = CL_mac_j( rs1, rs2 ); y[12] = CL_mac_j( rs3, rs4 ); y[13] = CL_msu_j( rs3, rs4 ); - /*for (i=10; i<15; i++) - { - printf("%d,\t %d,\t",y[i].re, y[i].im); - } - printf("\n\n");*/ - /* 1. FFT3 stage */ /* real part */ @@ -910,11 +892,6 @@ static void fft30_with_cmplx_data( cmplx *inp ) z[19] = CL_mac_j( rs1, rs2 ); z[29] = CL_msu_j( rs1, rs2 ); - /*for (i=0; i<30; i++) - printf("%d,\t %d,\t",z[i].re, z[i].im); - printf("\n\n");*/ - - /* 1. FFT2 stage */ rs1 = CL_shr( z[0], SCALEFACTOR30_2 ); rs2 = CL_shr( z[15], SCALEFACTOR30_2 ); @@ -931,7 +908,6 @@ static void fft30_with_cmplx_data( cmplx *inp ) l += 1; h += 1; - /* 3. FFT2 stage */ rs1 = CL_shr( z[1], SCALEFACTOR30_2 ); rs2 = CL_shr( z[16], SCALEFACTOR30_2 ); @@ -940,7 +916,6 @@ static void fft30_with_cmplx_data( cmplx *inp ) l += 1; h += 1; - /* 4. FFT2 stage */ rs1 = CL_shr( z[9], SCALEFACTOR30_2 ); rs2 = CL_shr( z[24], SCALEFACTOR30_2 ); diff --git a/lib_com/fft_evs.c b/lib_com/fft_evs.c index 0a59cbb64..cffdac16b 100644 --- a/lib_com/fft_evs.c +++ b/lib_com/fft_evs.c @@ -12,43 +12,6 @@ /************************************************************************/ /* FFT */ /************************************************************************/ -#if 0 -#define SCALEFACTORN2 ( 3 ) -#define SCALEFACTOR2 ( 2 ) -#define SCALEFACTOR3 ( 3 ) -#define SCALEFACTOR4 ( 3 ) -#define SCALEFACTOR5 ( 4 ) -#define SCALEFACTOR8 ( 4 ) -#define SCALEFACTOR10 ( 5 ) -#define SCALEFACTOR12 ( 5 ) -#define SCALEFACTOR15 ( 5 ) -#define SCALEFACTOR16 ( 5 ) -#define SCALEFACTOR20 ( 5 ) -#define SCALEFACTOR24 ( 6 ) -#define SCALEFACTOR30 ( 6 ) -#define SCALEFACTOR30_1 ( 5 ) -#define SCALEFACTOR30_2 ( 1 ) -#define SCALEFACTOR32 ( 6 ) -#define SCALEFACTOR32_1 ( 5 ) -#define SCALEFACTOR32_2 ( 1 ) -#define SCALEFACTOR40 ( 7 ) -#define SCALEFACTOR60 ( 7 ) -#define SCALEFACTOR64 ( 7 ) -#define SCALEFACTOR80 ( 8 ) -#define SCALEFACTOR100 ( 10 ) -#define SCALEFACTOR120 ( 8 ) -#define SCALEFACTOR128 ( 8 ) -#define SCALEFACTOR160 ( 8 ) -#define SCALEFACTOR192 ( 10 ) -#define SCALEFACTOR200 ( 10 ) -#define SCALEFACTOR240 ( 9 ) -#define SCALEFACTOR256 ( 9 ) -#define SCALEFACTOR320 ( 10 ) -#define SCALEFACTOR400 ( 10 ) -#define SCALEFACTOR480 ( 11 ) -#define SCALEFACTOR600 ( 10 ) -#endif -// Todo: Resolve include of these constants. Some of them are included via prot_fx1.h, cnst.h. #define SCALEFACTOR16 ( 5 ) #define SCALEFACTOR20 ( 5 ) @@ -479,7 +442,6 @@ static void fft15_with_cmplx_data( cmplx *inp_data ) /* 1. FFT3 stage */ - c_y1 = CL_add( c_z5, c_z10 ); c_y2 = CL_scale_t( CL_sub( c_z5, c_z10 ), C31 ); inp_data[0] = CL_add( c_z0, c_y1 ); diff --git a/lib_com/fft_fx.c b/lib_com/fft_fx.c index 024221ca6..1126af70a 100644 --- a/lib_com/fft_fx.c +++ b/lib_com/fft_fx.c @@ -6527,6 +6527,7 @@ static void fft_lenN( { { y[0] = xx[i]; // y[0] = xx[i + 0 * dim1] + move64(); }; IF( i == 0 ) { @@ -6806,6 +6807,7 @@ static void fft_lenN( { { y[j] = xx[0 + i_mult( j, dim1 )]; /*y[j] = xx[0 + j * dim1];*/ + move64(); }; } fft_len10( &y[0] ); @@ -6834,6 +6836,7 @@ static void fft_lenN( FOR( j = 0; j < dim2; j++ ) { x[add( i, i_mult( j, dim1 ) )] = y[j]; + move64(); } } BREAK; @@ -6854,12 +6857,14 @@ static void fft_lenN( FOR( j = 0; j < dim2; j++ ) { x[0 + i_mult( j, dim1 )] = y[j]; + move64(); } FOR( i = 1; i < dim1; i++ ) { { y[( 0 + 0 )] = xx[i + ( 0 + 0 ) * dim1]; + move64(); } FOR( j = 1; j < dim2; j++ ) @@ -7304,322 +7309,3 @@ Flag is_zero_arr( Word32 *arr, Word16 size ) return 1; } - -#if 0 -/* Functions are already in fixed point and available in fft.c file */ - -#define WMC_TOOL_SKIP - -#define SHC( x ) ( (Word16) x ) -#ifndef FFTC -#define FFTC( x ) WORD322WORD16( (Word32) x ) -#endif - -#define C81_FX ( FFTC( 0x5a82799a ) ) /* FL2WORD32( 7.071067811865475e-1) */ -#define C82_FX ( FFTC( 0xa57d8666 ) ) /* FL2WORD32(-7.071067811865475e-1) */ - -#define cplxMpy4_8_0( re, im, a, b, c, d ) \ - re = L_shr( L_sub( Mpy_32_16_1( a, c ), Mpy_32_16_1( b, d ) ), 1 ); \ - im = L_shr( L_add( Mpy_32_16_1( a, d ), Mpy_32_16_1( b, c ) ), 1 ); - -#define cplxMpy4_8_1( re, im, a, b ) \ - re = L_shr( a, 1 ); \ - im = L_shr( b, 1 ); - - -/** - * \brief Twiddle factors are unscaled - */ -/*-----------------------------------------------------------------* - * BASOP_fft8() - * - * Function performs a complex 8-point FFT - * The FFT is performed inplace. The result of the FFT - * is scaled by SCALEFACTOR8 bits. - * - * WOPS with 32x16 bit multiplications: 108 cycles - *-----------------------------------------------------------------*/ - -static void BASOP_fft8( - Word32 *re, - Word32 *im, - Word16 s ) -{ - Word32 x00, x01, x02, x03, x04, x05, x06, x07; - Word32 x08, x09, x10, x11, x12, x13, x14, x15; - Word32 t00, t01, t02, t03, t04, t05, t06, t07; - Word32 t08, t09, t10, t11, t12, t13, t14, t15; - Word32 s00, s01, s02, s03, s04, s05, s06, s07; - Word32 s08, s09, s10, s11, s12, s13, s14, s15; - - - /* Pre-additions */ - - x00 = L_shr( re[s * 0], SCALEFACTOR8 ); - x01 = L_shr( im[s * 0], SCALEFACTOR8 ); - x02 = L_shr( re[s * 1], SCALEFACTOR8 ); - x03 = L_shr( im[s * 1], SCALEFACTOR8 ); - x04 = L_shr( re[s * 2], SCALEFACTOR8 ); - x05 = L_shr( im[s * 2], SCALEFACTOR8 ); - x06 = L_shr( re[s * 3], SCALEFACTOR8 ); - x07 = L_shr( im[s * 3], SCALEFACTOR8 ); - x08 = L_shr( re[s * 4], SCALEFACTOR8 ); - x09 = L_shr( im[s * 4], SCALEFACTOR8 ); - x10 = L_shr( re[s * 5], SCALEFACTOR8 ); - x11 = L_shr( im[s * 5], SCALEFACTOR8 ); - x12 = L_shr( re[s * 6], SCALEFACTOR8 ); - x13 = L_shr( im[s * 6], SCALEFACTOR8 ); - x14 = L_shr( re[s * 7], SCALEFACTOR8 ); - x15 = L_shr( im[s * 7], SCALEFACTOR8 ); - - t00 = L_add( x00, x08 ); - t02 = L_sub( x00, x08 ); - t01 = L_add( x01, x09 ); - t03 = L_sub( x01, x09 ); - t04 = L_add( x02, x10 ); - t06 = L_sub( x02, x10 ); - t05 = L_add( x03, x11 ); - t07 = L_sub( x03, x11 ); - t08 = L_add( x04, x12 ); - t10 = L_sub( x04, x12 ); - t09 = L_add( x05, x13 ); - t11 = L_sub( x05, x13 ); - t12 = L_add( x06, x14 ); - t14 = L_sub( x06, x14 ); - t13 = L_add( x07, x15 ); - t15 = L_sub( x07, x15 ); - - /* Pre-additions and core multiplications */ - - s00 = L_add( t00, t08 ); - s04 = L_sub( t00, t08 ); - s01 = L_add( t01, t09 ); - s05 = L_sub( t01, t09 ); - s08 = L_sub( t02, t11 ); - s10 = L_add( t02, t11 ); - s09 = L_add( t03, t10 ); - s11 = L_sub( t03, t10 ); - s02 = L_add( t04, t12 ); - s07 = L_sub( t04, t12 ); - s03 = L_add( t05, t13 ); - s06 = L_sub( t13, t05 ); - - t01 = L_add( t06, t14 ); - t02 = L_sub( t06, t14 ); - t00 = L_add( t07, t15 ); - t03 = L_sub( t07, t15 ); - - s12 = Mpy_32_16_1( L_add( t00, t02 ), C81_FX ); - s14 = Mpy_32_16_1( L_sub( t00, t02 ), C81_FX ); - s13 = Mpy_32_16_1( L_sub( t03, t01 ), C81_FX ); - s15 = Mpy_32_16_1( L_add( t01, t03 ), C82_FX ); - - /* Post-additions */ - - re[s * 0] = L_add( s00, s02 ); - move32(); - re[s * 4] = L_sub( s00, s02 ); - move32(); - im[s * 0] = L_add( s01, s03 ); - move32(); - im[s * 4] = L_sub( s01, s03 ); - move32(); - re[s * 2] = L_sub( s04, s06 ); - move32(); - re[s * 6] = L_add( s04, s06 ); - move32(); - im[s * 2] = L_sub( s05, s07 ); - move32(); - im[s * 6] = L_add( s05, s07 ); - move32(); - re[s * 3] = L_add( s08, s14 ); - move32(); - re[s * 7] = L_sub( s08, s14 ); - move32(); - im[s * 3] = L_add( s09, s15 ); - move32(); - im[s * 7] = L_sub( s09, s15 ); - move32(); - re[s * 1] = L_add( s10, s12 ); - move32(); - re[s * 5] = L_sub( s10, s12 ); - move32(); - im[s * 1] = L_add( s11, s13 ); - move32(); - im[s * 5] = L_sub( s11, s13 ); - move32(); - - return; -} - - -/*-----------------------------------------------------------------* - * fftN2() - * - * Combined FFT - *-----------------------------------------------------------------*/ - -static void BASOP_fftN2( - Word32 *re, /* i/o: real part */ - Word32 *im, /* i/o: imag part */ - const Word16 *W, /* i : rotation factor */ - Word16 dim1, /* i : length of fft1 */ - Word16 dim2, /* i : length of fft2 */ - Word16 sx, /* i : stride real and imag part */ - Word16 sc, /* i : stride phase rotation coefficients */ - Word32 *x, /* tmp: 32-bit workbuffer */ - Word16 Woff /* i : offset for addressing the rotation vector table */ -) -{ - Word16 i, j; - Word32 x00, x01, x02, x03, x04, x05, x06, x07, x08, x09, x10, x11, x12, x13, x14, x15; - Word32 t00, t01, t02, t03, t04, t05, t06, t07, t08, t09, t10, t11, t12, t13, t14, t15; - Word32 s00, s01, s02, s03, s04, s05, s06, s07, s08, s09, s10, s11, s12, s13, s14, s15; - - FOR ( i = 0; i < dim2; i++ ) - { - FOR ( j = 0; j < dim1; j++ ) - { - x[2 * i * dim1 + 2 * j] = re[sx * i + sx * j * dim2]; - move32(); - x[2 * i * dim1 + 2 * j + 1] = im[sx * i + sx * j * dim2]; - move32(); - } - } - - /* dim1 == 8 */ - FOR ( i = 0; i < dim2; i++ ) - { - BASOP_fft8( &x[i * 2 * dim1], &x[i * 2 * dim1 + 1], 2 ); - } - - /* dim2 == 8 */ - FOR ( i = 0; i < dim1; i++ ) - { - cplxMpy4_8_1( x00, x01, x[2 * i + 2 * 0 * dim1], x[2 * i + 2 * 0 * dim1 + 1] ); - - IF( EQ_16( i, 0 ) ) - { - cplxMpy4_8_1( x02, x03, x[2 * i + 2 * 1 * dim1], x[2 * i + 2 * 1 * dim1 + 1] ); - cplxMpy4_8_1( x04, x05, x[2 * i + 2 * 2 * dim1], x[2 * i + 2 * 2 * dim1 + 1] ); - cplxMpy4_8_1( x06, x07, x[2 * i + 2 * 3 * dim1], x[2 * i + 2 * 3 * dim1 + 1] ); - cplxMpy4_8_1( x08, x09, x[2 * i + 2 * 4 * dim1], x[2 * i + 2 * 4 * dim1 + 1] ); - cplxMpy4_8_1( x10, x11, x[2 * i + 2 * 5 * dim1], x[2 * i + 2 * 5 * dim1 + 1] ); - cplxMpy4_8_1( x12, x13, x[2 * i + 2 * 6 * dim1], x[2 * i + 2 * 6 * dim1 + 1] ); - cplxMpy4_8_1( x14, x15, x[2 * i + 2 * 7 * dim1], x[2 * i + 2 * 7 * dim1 + 1] ); - } - ELSE - { - cplxMpy4_8_0( x02, x03, x[2 * i + 2 * 1 * dim1], x[2 * i + 2 * 1 * dim1 + 1], W[sc * i + sc * 1 * dim1 - Woff], W[sc * i + sc * 1 * dim1 + 1 - Woff] ); - cplxMpy4_8_0( x04, x05, x[2 * i + 2 * 2 * dim1], x[2 * i + 2 * 2 * dim1 + 1], W[sc * i + sc * 2 * dim1 - Woff], W[sc * i + sc * 2 * dim1 + 1 - Woff] ); - cplxMpy4_8_0( x06, x07, x[2 * i + 2 * 3 * dim1], x[2 * i + 2 * 3 * dim1 + 1], W[sc * i + sc * 3 * dim1 - Woff], W[sc * i + sc * 3 * dim1 + 1 - Woff] ); - cplxMpy4_8_0( x08, x09, x[2 * i + 2 * 4 * dim1], x[2 * i + 2 * 4 * dim1 + 1], W[sc * i + sc * 4 * dim1 - Woff], W[sc * i + sc * 4 * dim1 + 1 - Woff] ); - cplxMpy4_8_0( x10, x11, x[2 * i + 2 * 5 * dim1], x[2 * i + 2 * 5 * dim1 + 1], W[sc * i + sc * 5 * dim1 - Woff], W[sc * i + sc * 5 * dim1 + 1 - Woff] ); - cplxMpy4_8_0( x12, x13, x[2 * i + 2 * 6 * dim1], x[2 * i + 2 * 6 * dim1 + 1], W[sc * i + sc * 6 * dim1 - Woff], W[sc * i + sc * 6 * dim1 + 1 - Woff] ); - cplxMpy4_8_0( x14, x15, x[2 * i + 2 * 7 * dim1], x[2 * i + 2 * 7 * dim1 + 1], W[sc * i + sc * 7 * dim1 - Woff], W[sc * i + sc * 7 * dim1 + 1 - Woff] ); - } - t00 = L_shr( L_add( x00, x08 ), SCALEFACTORN2 - 1 ); - t02 = L_shr( L_sub( x00, x08 ), SCALEFACTORN2 - 1 ); - t01 = L_shr( L_add( x01, x09 ), SCALEFACTORN2 - 1 ); - t03 = L_shr( L_sub( x01, x09 ), SCALEFACTORN2 - 1 ); - t04 = L_shr( L_add( x02, x10 ), SCALEFACTORN2 - 1 ); - t06 = L_sub( x02, x10 ); - t05 = L_shr( L_add( x03, x11 ), SCALEFACTORN2 - 1 ); - t07 = L_sub( x03, x11 ); - t08 = L_shr( L_add( x04, x12 ), SCALEFACTORN2 - 1 ); - t10 = L_shr( L_sub( x04, x12 ), SCALEFACTORN2 - 1 ); - t09 = L_shr( L_add( x05, x13 ), SCALEFACTORN2 - 1 ); - t11 = L_shr( L_sub( x05, x13 ), SCALEFACTORN2 - 1 ); - t12 = L_shr( L_add( x06, x14 ), SCALEFACTORN2 - 1 ); - t14 = L_sub( x06, x14 ); - t13 = L_shr( L_add( x07, x15 ), SCALEFACTORN2 - 1 ); - t15 = L_sub( x07, x15 ); - - s00 = L_add( t00, t08 ); - s04 = L_sub( t00, t08 ); - s01 = L_add( t01, t09 ); - s05 = L_sub( t01, t09 ); - s08 = L_sub( t02, t11 ); - s10 = L_add( t02, t11 ); - s09 = L_add( t03, t10 ); - s11 = L_sub( t03, t10 ); - s02 = L_add( t04, t12 ); - s07 = L_sub( t04, t12 ); - s03 = L_add( t05, t13 ); - s06 = L_sub( t13, t05 ); - - t01 = L_shr( L_add( t06, t14 ), SCALEFACTORN2 - 1 ); - t02 = L_shr( L_sub( t06, t14 ), SCALEFACTORN2 - 1 ); - t00 = L_shr( L_add( t07, t15 ), SCALEFACTORN2 - 1 ); - t03 = L_shr( L_sub( t07, t15 ), SCALEFACTORN2 - 1 ); - - s12 = Mpy_32_16_1( L_add( t00, t02 ), C81_FX ); - s14 = Mpy_32_16_1( L_sub( t00, t02 ), C81_FX ); - s13 = Mpy_32_16_1( L_sub( t03, t01 ), C81_FX ); - s15 = Mpy_32_16_1( L_add( t01, t03 ), C82_FX ); - - re[sx * i + sx * 0 * dim1] = L_add( s00, s02 ); - move32(); - im[sx * i + sx * 0 * dim1] = L_add( s01, s03 ); - move32(); - re[sx * i + sx * 1 * dim1] = L_add( s10, s12 ); - move32(); - im[sx * i + sx * 1 * dim1] = L_add( s11, s13 ); - move32(); - re[sx * i + sx * 2 * dim1] = L_sub( s04, s06 ); - move32(); - im[sx * i + sx * 2 * dim1] = L_sub( s05, s07 ); - move32(); - re[sx * i + sx * 3 * dim1] = L_add( s08, s14 ); - move32(); - im[sx * i + sx * 3 * dim1] = L_add( s09, s15 ); - move32(); - re[sx * i + sx * 4 * dim1] = L_sub( s00, s02 ); - move32(); - im[sx * i + sx * 4 * dim1] = L_sub( s01, s03 ); - move32(); - re[sx * i + sx * 5 * dim1] = L_sub( s10, s12 ); - move32(); - im[sx * i + sx * 5 * dim1] = L_sub( s11, s13 ); - move32(); - re[sx * i + sx * 6 * dim1] = L_add( s04, s06 ); - move32(); - im[sx * i + sx * 6 * dim1] = L_add( s05, s07 ); - move32(); - re[sx * i + sx * 7 * dim1] = L_sub( s08, s14 ); - move32(); - im[sx * i + sx * 7 * dim1] = L_sub( s09, s15 ); - move32(); - } - - return; -} - - -/*-----------------------------------------------------------------* - * BASOP_cfft_fx() - * - * Complex valued FFT - *-----------------------------------------------------------------*/ - -void BASOP_cfft_fx( - Word32 *re, /* i/o: real part */ - Word32 *im, /* i/o: imag part */ - Word16 s, /* i : stride real and imag part */ - Word16 *scale /* i : scalefactor */ -) -{ - Word32 x[2 * 64]; - - /* FFT for len = FDNS_NPTS */ - BASOP_fftN2( re, im, RotVector_256, 8, 8, s, 8, x, 64 ); - s = add( *scale, SCALEFACTOR64 ); - - *scale = s; - move16(); - - return; -} - -#undef WMC_TOOL_SKIP -#endif diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c index c17de3643..20bef242b 100644 --- a/lib_com/fft_fx_evs.c +++ b/lib_com/fft_fx_evs.c @@ -145,14 +145,14 @@ static void bitrv2_SR_fx( m = 1; move16(); - WHILE( shl( m, 3 ) < l ) + WHILE( LE_16( shl( m, 3 ), l ) ) { l = shr( l, 1 ); m = shl( m, 1 ); } m2 = shl( m, 1 ); - IF( shl( m, 3 ) == l ) + IF( EQ_16( shl( m, 3 ), l ) ) { FOR( k = 0; k < m; k++ ) { diff --git a/lib_com/fft_rel.c b/lib_com/fft_rel.c index 4682fb65e..bad84753f 100644 --- a/lib_com/fft_rel.c +++ b/lib_com/fft_rel.c @@ -481,185 +481,6 @@ void fft_rel_fx( return; } -#if 0 -void fft_rel_fx32( - Word32 x[], /* i/o: input/output vector */ - const Word16 n, /* i : vector length */ - const Word16 m /* i : log2 of vector length */ -) -{ - Word16 i, j, k, n1, n2, n4; - Word16 step; - Word32 xt, t1, t2; - Word32 *x0, *x1, *x2; - const Word16 *s, *c; - Word32 *xi2, *xi3, *xi4, *xi1; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif - - - /*-----------------------------------------------------------------* - * Digit reverse counter - *-----------------------------------------------------------------*/ - - j = 0; - move16(); - x0 = &x[0]; - move32(); - FOR(i = 0; i < n - 1; i++) - { - IF(LT_16(i, j)) - { - xt = x[j]; - move32(); - x[j] = *x0; - move32(); - *x0 = xt; - move32(); - } - x0++; - k = shr(n, 1); - WHILE(LE_16(k, j)) - { - j = sub(j, k); - k = shr(k, 1); - } - j = add(j, k); - } - - /*-----------------------------------------------------------------* - * Length two butterflies - *-----------------------------------------------------------------*/ - - x0 = &x[0]; - move32(); - x1 = &x[1]; - move32(); - FOR(i = 0; i < n / 2; i++) - { - xt = *x0; - move32(); -#ifdef BASOP_NOGLOB - *x0 = L_add_o(xt, *x1, &Overflow); -#else - *x0 = L_add(xt, *x1); -#endif - move32(); -#ifdef BASOP_NOGLOB - *x1 = L_sub_o(xt, *x1, &Overflow); -#else - *x1 = L_sub(xt, *x1); -#endif - move32(); - x0++; - x0++; - x1++; - x1++; - } - - /*-----------------------------------------------------------------* - * Other butterflies - * - * The implementation described in [1] has been changed by using - * table lookup for evaluating sine and cosine functions. The - * variable ind and its increment step are needed to access table - * entries. Note that this implementation assumes n4 to be so - * small that ind will never exceed the table. Thus the input - * argument n and the constant N_MAX_SAS must be set properly. - *-----------------------------------------------------------------*/ - - n2 = 1; - move16(); - /* step = N_MAX_SAS/4; */ - FOR(k = 2; k <= m; k++) - { - n4 = n2; - move16(); - n2 = shl(n4, 1); - n1 = shl(n2, 1); - - step = N_MAX_SAS / n1; - - x0 = x; - x1 = x + n2; - x2 = x + add(n2, n4); - FOR(i = 0; i < n; i += n1) - { - xt = *x0; - move32(); /* xt = x[i]; */ -#ifdef BASOP_NOGLOB - *x0 = L_add_o(xt, *x1, &Overflow); -#else /* BASOP_NOGLOB */ - *x0 = L_add(xt, *x1); -#endif /* BASOP_NOGLOB */ - move32(); /* x[i] = xt + x[i+n2]; */ -#ifdef BASOP_NOGLOB - *x1 = L_sub_o(xt, *x1, &Overflow); -#else /* BASOP_NOGLOB */ - *x1 = L_sub(xt, *x1); -#endif /* BASOP_NOGLOB */ - move32(); /* x[i+n2] = xt - x[i+n2]; */ - *x2 = L_negate(*x2); - move32(); /* x[i+n2+n4] = -x[i+n2+n4]; */ - - - s = sincos_t_fx + step; - c = s + 64; - xi1 = x + add(i, 1); - xi3 = xi1 + n2; - xi2 = xi3 - 2; - xi4 = xi1 + sub(n1, 2); - - FOR(j = 1; j < n4; j++) - { -#ifdef BASOP_NOGLOB - t1 = L_add_o(Mpy_32_16_1(*xi3, *c), Mpy_32_16_1(*xi4, *s), &Overflow); /* t1 = *xi3**(pt_c+ind) + *xi4**(pt_s+ind); */ - t2 = L_sub_o(Mpy_32_16_1(*xi3, *s), Mpy_32_16_1(*xi4, *c), &Overflow); /* t2 = *xi3**(pt_s+ind) - *xi4**(pt_c+ind); */ - *xi4 = L_sub_o(*xi2, t2, &Overflow); -#else /* BASOP_NOGLOB */ - t1 = L_add(Mpy_32_16_1(*xi3, *c), Mpy_32_16_1(*xi4, *s)); /* t1 = *xi3**(pt_c+ind) + *xi4**(pt_s+ind); */ - t2 = L_sub(Mpy_32_16_1(*xi3, *s), Mpy_32_16_1(*xi4, *c)); /* t2 = *xi3**(pt_s+ind) - *xi4**(pt_c+ind); */ - *xi4 = L_sub(*xi2, t2); -#endif /* BASOP_NOGLOB */ - move16(); -#ifdef BASOP_NOGLOB - *xi3 = L_negate(L_add_o(*xi2, t2, &Overflow)); -#else /* BASOP_NOGLOB */ - *xi3 = L_negate(L_add(*xi2, t2)); -#endif /* BASOP_NOGLOB */ - move32(); -#ifdef BASOP_NOGLOB - *xi2 = L_sub_o(*xi1, t1, &Overflow); -#else /* BASOP_NOGLOB */ - *xi2 = L_sub(*xi1, t1); -#endif /* BASOP_NOGLOB */ - move32(); -#ifdef BASOP_NOGLOB - *xi1 = L_add_o(*xi1, t1, &Overflow); -#else /* BASOP_NOGLOB */ - *xi1 = L_add(*xi1, t1); -#endif /* BASOP_NOGLOB */ - move32(); - - xi4--; - xi2--; - xi3++; - xi1++; - c += step; - s += step; /* autoincrement by ar0 */ - } - - x0 += n1; - x1 += n1; - x2 += n1; - } - /* step = shr(step, 1); */ - } - - return; -} -#else void fft_rel_fx32( Word32 x[], /* i/o: input/output vector */ const Word16 n, /* i : vector length */ @@ -928,4 +749,3 @@ void fft_rel_fx32( return; } -#endif diff --git a/lib_com/fft_rel_fx.c b/lib_com/fft_rel_fx.c index b07cb3acb..85a5a3224 100644 --- a/lib_com/fft_rel_fx.c +++ b/lib_com/fft_rel_fx.c @@ -6,7 +6,6 @@ #include "prot_fx.h" /* Function prototypes */ #include "rom_com.h" /* Static table prototypes */ #include "stl.h" - #include "stdint.h" /*------------------------------------------------------------------ * diff --git a/lib_com/fill_spectrum.c b/lib_com/fill_spectrum.c index b75a67017..5fe270c3c 100644 --- a/lib_com/fill_spectrum.c +++ b/lib_com/fill_spectrum.c @@ -437,7 +437,7 @@ void ivas_fill_spectrum_fx( * Normal mode BWE *----------------------------------------------------------------*/ - IF( HQ_mode == HQ_NORMAL ) + IF( EQ_16( HQ_mode, HQ_NORMAL ) ) { hq_fold_bwe_fx( last_sfm, sfm_end, num_sfm, coeff ); } @@ -531,7 +531,6 @@ void ivas_fill_spectrum_fx( return; } -#endif void fill_spectrum_fx( Word16 *coeff, /* i/o: normalized MLT spectrum / nf spectrum Q12 */ @@ -698,7 +697,7 @@ void fill_spectrum_fx( * Normal mode BWE *----------------------------------------------------------------*/ - IF( HQ_mode == HQ_NORMAL ) + IF( EQ_16( HQ_mode, HQ_NORMAL ) ) { hq_fold_bwe_fx( last_sfm, sfm_end, num_sfm, coeff ); } @@ -792,3 +791,4 @@ void fill_spectrum_fx( return; } +#endif diff --git a/lib_com/findpulse.c b/lib_com/findpulse.c index e7104810c..72f1b3990 100644 --- a/lib_com/findpulse.c +++ b/lib_com/findpulse.c @@ -140,7 +140,7 @@ int16_t findpulse( return ( maxi ); } - +#ifdef IVAS_FLOAT_FIXED Word16 findpulse_fx( /* o : pulse position */ const Word16 L_frame, /* i : length of the frame */ const Word16 res[], /* i : Residual signal <12 bits */ @@ -155,7 +155,7 @@ Word16 findpulse_fx( /* o : pulse position Word32 Ltmp; Word16 resf[L_FRAME16k]; /* Low pass filtered residual */ - IF( enc != DEC ) + IF( NE_16( enc, DEC ) ) { /*------------------------------------------------------------------------* * 1. Very simple LP filter @@ -196,13 +196,6 @@ Word16 findpulse_fx( /* o : pulse position move16(); } } - /* - *sign = 1; move16(); - test(); - if (ptr[-maxi] >= 0) - { - *sign = 0; move16(); - }*/ *sign = negate( shr( ptr[-maxi], 15 ) ); move16(); } @@ -243,3 +236,4 @@ Word16 findpulse_fx( /* o : pulse position return maxi; } +#endif diff --git a/lib_com/fine_gain_bits_fx.c b/lib_com/fine_gain_bits_fx.c index 627eda6e0..8e3fd2244 100644 --- a/lib_com/fine_gain_bits_fx.c +++ b/lib_com/fine_gain_bits_fx.c @@ -16,7 +16,7 @@ * * HQ core encoder *--------------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED static void subband_gain_bits_fx( const Word16 *Rk, /* i : bit allocation per band Q3 */ const Word16 N, /* i : number of bands */ @@ -105,7 +105,6 @@ Word16 assign_gain_bits_fx( /* o : Number of assigned return gain_bits_tot; } -#ifdef IVAS_FLOAT_FIXED static void ivas_subband_gain_bits_fx( const Word16 *Rk, /* i : bit allocation per band Q3 */ const Word16 N, /* i : number of bands */ diff --git a/lib_com/frame_ener.c b/lib_com/frame_ener.c index 5af9eed54..6666c856f 100644 --- a/lib_com/frame_ener.c +++ b/lib_com/frame_ener.c @@ -98,7 +98,7 @@ void fer_energy_fx( { Word16 len, shift, exp; const Word32 *pt_synth; - Word16 enr_tmp; + Word16 enr_tmp, i; Word64 W_tmp; test(); @@ -126,7 +126,7 @@ void fer_energy_fx( W_tmp = 0; move64(); - FOR( int i = 0; i < L_frame / 2; i++ ) + FOR( i = 0; i < L_frame / 2; i++ ) { W_tmp = W_add( W_tmp, W_mult0_32_32( pt_synth[i], pt_synth[i] ) ); // Q = q_synth * 2 } diff --git a/lib_com/gain_inov_fx.c b/lib_com/gain_inov_fx.c index e2f65421a..cd0d34290 100644 --- a/lib_com/gain_inov_fx.c +++ b/lib_com/gain_inov_fx.c @@ -9,7 +9,6 @@ #include "basop_util.h" #include "rom_com.h" - Word32 calc_gain_inov( /* returns innovation gain Q16 */ const Word16 *code, /* i : algebraic excitation Q9 */ const Word16 lcode, /* i : Subframe size Q0 */ diff --git a/lib_com/get_gain.c b/lib_com/get_gain.c index 5f9c8f56a..33739f0cd 100644 --- a/lib_com/get_gain.c +++ b/lib_com/get_gain.c @@ -71,11 +71,7 @@ float get_gain_flt( return ( corr / ener ); } -#if 0 -//Below is fixed implmentation -//TO DO rename get_gain_flt to get_gain once macro introduced -#endif - +#ifdef IVAS_FLOAT_FIXED Word32 get_gain( /* output: codebook gain (adaptive or fixed) Q16 */ const Word16 x[], /* input : target signal */ const Word16 y[], /* input : filtered codebook excitation */ @@ -180,3 +176,4 @@ Word32 get_gain2( /* output: codebook gain (adaptive or fixed) return Lgain; } +#endif diff --git a/lib_com/gs_bitallocation.c b/lib_com/gs_bitallocation.c index 3898daf95..f1f9840da 100644 --- a/lib_com/gs_bitallocation.c +++ b/lib_com/gs_bitallocation.c @@ -1242,21 +1242,24 @@ static Word16 maximum_fx( /* o : index of the maximum val Word16 *max_fx /* o : maximum value in the input vector */ ) { - Word16 j, ind; - Word16 tmp; + Word16 j, ind, tmp; ind = 0; + move16(); tmp = vec_fx[0]; + move16(); - for ( j = 1; j < lvec_fx; j++ ) + FOR( j = 1; j < lvec_fx; j++ ) { - if ( vec_fx[j] > tmp ) + if ( GT_16( vec_fx[j], tmp ) ) { ind = j; + move16(); } tmp = s_max( tmp, vec_fx[j] ); } *max_fx = tmp; + move16(); return ind; } diff --git a/lib_com/gs_bitallocation_fx.c b/lib_com/gs_bitallocation_fx.c index 943291cec..5bd82fdab 100644 --- a/lib_com/gs_bitallocation_fx.c +++ b/lib_com/gs_bitallocation_fx.c @@ -551,7 +551,7 @@ void bands_and_bit_alloc_fx( { nb_bands_max = sub( nb_bands_max, 2 ); } - ELSE if ( GE_16( noise_lev, NOISE_LEVEL_SP1 ) ) /* Very low dynamic, tend to speech, code less HF */ + ELSE IF( GE_16( noise_lev, NOISE_LEVEL_SP1 ) ) /* Very low dynamic, tend to speech, code less HF */ { nb_bands_max = sub( nb_bands_max, 1 ); } @@ -578,7 +578,7 @@ void bands_and_bit_alloc_fx( #endif test(); - if ( ( bwidth == NB ) && GT_16( nb_bands_max, 10 ) ) + if ( ( EQ_16( bwidth, NB ) ) && GT_16( nb_bands_max, 10 ) ) { nb_bands_max = 10; move16(); @@ -708,8 +708,8 @@ void bands_and_bit_alloc_fx( { bandoffset = sub( bandoffset, 1 ); } - ELSE if ( ( LE_32( core_brate, ACELP_13k20 ) && ( EQ_16( coder_type, INACTIVE ) || GE_16( noise_lev, NOISE_LEVEL_SP3 ) ) ) || - ( LE_32( core_brate, ACELP_13k20 ) && GE_32( core_brate, ACELP_9k60 ) && cor_strong_limit == 0 ) ) + ELSE IF( ( LE_32( core_brate, ACELP_13k20 ) && ( EQ_16( coder_type, INACTIVE ) || GE_16( noise_lev, NOISE_LEVEL_SP3 ) ) ) || + ( LE_32( core_brate, ACELP_13k20 ) && GE_32( core_brate, ACELP_9k60 ) && cor_strong_limit == 0 ) ) { bandoffset = add( bandoffset, 1 ); } @@ -817,7 +817,7 @@ void bands_and_bit_alloc_fx( move32(); j = add( i, 1 ); } - ELSE if ( GT_32( L_add( bits_per_bands[i], L_tmp ), 29360128 ) ) /* Q18 */ + ELSE IF( GT_32( L_add( bits_per_bands[i], L_tmp ), 29360128 ) ) /* Q18 */ { j = add( i, 1 ); } diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c index 4de024088..ae7661c0e 100644 --- a/lib_com/gs_gains_fx.c +++ b/lib_com/gs_gains_fx.c @@ -182,11 +182,7 @@ static Word16 Comp_band_log_ener( /* o : Band gain Q12 */ { Word32 L_tmp; Word16 e_tmp, f_tmp, tmp16, ener_exp; - - /*for(i = 0; i < 8; i++){etmp += (*pt * *pt);pt++;}*/ L_tmp = Calc_Energy_Autoscaled( pt_fx, Q_sc, Len, &ener_exp ); - - /*y_gain4[j] = (float)log10(sqrt(etmp<L_frame, L_FRAME16k ) ) { Mbands_gn = MBANDS_GN16k; + move16(); } test(); @@ -717,7 +710,6 @@ Word16 gsc_gaindec_ivas_fx( /* o : average frequenc ifft_rel_fx( y_gainQ_fx + 8, 8, 3 ); FOR( i = 8; i < 16; i++ ) { - /*y_gainQ_fx[i] *= 1.41f;*/ y_gainQ_fx[i] = round_fx( L_shl( L_mult( y_gainQ_fx[i], 23101 ), 1 ) ); /*Q12 */ move16(); } @@ -792,7 +784,9 @@ Word16 gsc_gainQ_fx( /*Q12*/ { Word16 y_gain_tmp[MBANDS_GN], y_gain_tmp2[MBANDS_GN]; Word16 i, idx_g = 0; + move16(); Word16 mean_4g[1] = { 0 }, tmp16, tmp1, tmp2; + move16(); Word16 Mbands_gn = MBANDS_GN; Word16 y_gain_tmp3[MBANDS_GN]; Word16 cnt; @@ -905,10 +899,8 @@ Word16 gsc_gainQ_fx( /*Q12*/ { y_gain_tmp2[i] = y_gain4[i]; move16(); - /*if(y_gain4[i] < ftmp1-0.6f)*/ y_gain_tmp2[i] = s_max( y_gain_tmp2[i], tmp1 ); move16(); - /*else if(y_gain4[i] > ftmp1+0.6f)*/ y_gain_tmp2[i] = s_min( y_gain_tmp2[i], tmp2 ); move16(); L_tmp = L_mac( L_tmp, y_gain_tmp2[i], 2048 ); @@ -917,10 +909,8 @@ Word16 gsc_gainQ_fx( /*Q12*/ { y_gain_tmp2[i] = y_gain4[i]; move16(); - /*if(y_gain4[i] < ftmp1-0.6f)*/ y_gain_tmp2[i] = s_max( y_gain_tmp2[i], tmp1 ); /* Just the last move is needed, because s_max and s_min could be done in 1 line*/ move16(); - /*else if(y_gain4[i] > ftmp1+0.6f)*/ y_gain_tmp2[i] = s_min( y_gain_tmp2[i], tmp2 ); move16(); } @@ -929,8 +919,6 @@ Word16 gsc_gainQ_fx( /*Q12*/ mean_4g[0] = round_fx( L_tmp ); move16(); - - /*idx_g = (short)vquant(mean_4g, mean_m, mean_4g, mean_gain_dic, 1, 64);*/ idx_g = vquant_fx( mean_4g, mean_m_fx, mean_4g, mean_gain_dic_fx, 1, 64 ); push_indice_fx( hBstr, IND_MEAN_GAIN2, idx_g, 6 ); @@ -957,16 +945,12 @@ Word16 gsc_gainQ_fx( /*Q12*/ idx_g = 0; move16(); - /*idx_g = (short)vquant(y_gain_tmp2, YGain_mean_LR, y_gain_tmp2, YGain_dic1_LR, 3, 32);*/ idx_g = vquant_fx( y_gain_tmp2, YGain_mean_LR_fx, y_gain_tmp2, YGain_dic1_LR_fx, 3, 32 ); push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); - /*idx_g = (short)vquant(y_gain_tmp2+3, YGain_mean_LR+3, y_gain_tmp2+3, YGain_dic2_LR, 4, 32);*/ idx_g = vquant_fx( y_gain_tmp2 + 3, YGain_mean_LR_fx + 3, y_gain_tmp2 + 3, YGain_dic2_LR_fx, 4, 32 ); push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); - /*idx_g = (short)vquant(y_gain_tmp2+7, YGain_mean_LR+7, y_gain_tmp2+7, YGain_dic3_LR, 5, 32);*/ idx_g = vquant_fx( y_gain_tmp2 + 7, YGain_mean_LR_fx + 7, y_gain_tmp2 + 7, YGain_dic3_LR_fx, 5, 32 ); push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 ); - /*set_f(y_gain_tmp2+12, 0, MBANDS_GN-12);*/ set16_fx( y_gain_tmp2 + 12, 0, MBANDS_GN - 12 ); /* Update to quantized vector */ @@ -983,7 +967,6 @@ Word16 gsc_gainQ_fx( /*Q12*/ FOR( i = 8; i < 16; i++ ) { - /*y_gain_tmp[i] *= 1.41f;*/ y_gain_tmp[i] = shl( mult_r( y_gain_tmp[i], 23101 ), 1 ); move16(); } diff --git a/lib_com/gs_inact_switching_fx.c b/lib_com/gs_inact_switching_fx.c index 01a055620..aa7b647bd 100644 --- a/lib_com/gs_inact_switching_fx.c +++ b/lib_com/gs_inact_switching_fx.c @@ -12,6 +12,7 @@ * Local constants *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED #define ALPHA0_FX 13107 #define BETA0_FX ( 32768 - ALPHA0_FX ) @@ -290,3 +291,4 @@ void Inac_switch_ematch_ivas_fx( return; } +#endif diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c index 2dea2adef..05b0440b6 100644 --- a/lib_com/gs_noisefill_fx.c +++ b/lib_com/gs_noisefill_fx.c @@ -6,6 +6,7 @@ #include "rom_com.h" #include "prot_fx.h" +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * gs_noisf() * @@ -26,6 +27,7 @@ static void gs_noisf_fx( Word16 i, k; Word16 NB_zer; Word32 const_1 = 1; + move32(); Word16 tmp; NB_zer = shr( NB_Qbins, 1 ); @@ -159,7 +161,7 @@ static void EstimateNoiseLevel_fx( const Word16 pit_band_idx, /* i : bin position of the cut-off frequency */ Word16 last_bin, /* i : the last bin of bit allocation */ Word16 bwidth, - const int16_t L_frame /* i : frame length */ + const Word16 L_frame /* i : frame length */ ) { Word16 i_band; @@ -320,7 +322,7 @@ void freq_dnw_scaling_fx( const Word32 core_brate, /* i : Core bitrate */ Word16 fy_norm[], /* i/o: Frequency quantized parameter */ Word16 Qx, /* Q format of fy_norm*/ - const int16_t L_frame /* i : frame length */ + const Word16 L_frame /* i : frame length */ ) { @@ -682,24 +684,27 @@ void highband_exc_dct_in_fx( Word16 Q_exc, const Word16 GSC_noisy_speech, Word16 *lt_ener_per_band_fx, /* i/o: Average per band energy */ - const int16_t L_frame, /* i : frame length */ - const int16_t element_mode, /* i : IVAS element mode */ - const int16_t GSC_IVAS_mode /* i : GSC IVAS mode */ + const Word16 L_frame, /* i : frame length */ + const Word16 element_mode, /* i : IVAS element mode */ + const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */ ) { Word16 i, j, k; Word16 MAX_Bin = 0; Word16 last_bin_tmp, ener = 0; + move16(); Word16 noisepb[MBANDS_GN16k]; Word16 Ener_per_bd_yQ[MBANDS_GN16k]; Word16 *src, *dst; Word32 L_tmp; Word16 length_bin, bwe_flag = 0, tmp; + move16(); Word16 frac, exp, tmp1; Word16 tmp2; Word16 *end, Q_hb_exc; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move16(); #endif FOR( j = 10; j < MBANDS_GN; j++ ) @@ -772,6 +777,10 @@ void highband_exc_dct_in_fx( move16(); } + test(); + test(); + test(); + test(); IF( bfi || LT_32( core_brate, 6000 ) || ( LT_32( core_brate, 8600 ) && EQ_16( coder_type, UNVOICED ) ) ) { set16_fx( noisepb, 13107, MBANDS_GN ); /*0.4 in Q15 */ @@ -1104,7 +1113,6 @@ void highband_exc_dct_in_fx( return; } -#ifdef IVAS_FLOAT_FIXED void highband_exc_dct_in_ivas_fx( const Word32 core_brate, /* i : core bitrate */ const Word16 *mfreq_bindiv, /* i : bin per bands tables */ @@ -1140,16 +1148,19 @@ void highband_exc_dct_in_ivas_fx( Word16 i, j, k; Word16 MAX_Bin = 0; Word16 last_bin_tmp, ener = 0; + move16(); Word16 noisepb[MBANDS_GN16k]; Word16 Ener_per_bd_yQ[MBANDS_GN16k]; Word16 *src, *dst; Word32 L_tmp; Word16 length_bin, bwe_flag = 0, tmp; + move16(); Word16 frac, exp, tmp1; Word16 tmp2; Word16 *end, Q_hb_exc; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move16(); #endif FOR( j = 10; j < MBANDS_GN; j++ ) diff --git a/lib_com/gs_preech.c b/lib_com/gs_preech.c index 1c3c3ccfe..7508f1e68 100644 --- a/lib_com/gs_preech.c +++ b/lib_com/gs_preech.c @@ -139,6 +139,7 @@ void pre_echo_att( return; } +#ifdef IVAS_FLOAT_FIXED void pre_echo_att_fx( Word32 *Last_frame_ener_fx, /* i/o: Energy of the last frame 2*Q_new+1*/ Word16 *exc_fx, /* i/o: Excitation of the current frame Q_new*/ @@ -150,6 +151,7 @@ void pre_echo_att_fx( { Word32 etmp_fx; Word32 finc_fx[ATT_LENGHT16k] = { 0 }; + move16(); Word16 ratio_fx; Word16 attack_pos_fx, i; Word32 L_tmp, L_tmp1; @@ -261,3 +263,4 @@ void pre_echo_att_fx( return; } +#endif diff --git a/lib_com/guided_plc_util_fx.c b/lib_com/guided_plc_util_fx.c index 2610a7693..b7eba5d7e 100644 --- a/lib_com/guided_plc_util_fx.c +++ b/lib_com/guided_plc_util_fx.c @@ -9,6 +9,7 @@ #include "basop_util.h" #include "rom_basop_util.h" +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------------*/ @@ -30,6 +31,8 @@ void getLookAheadResSig( Word16 *p_A; Word16 i_subfr; Word16 subfr_len[2] = { L_SUBFR, L_SUBFR }; + move16(); + move16(); if ( GT_16( L_FRAME16k, L_frame ) ) { @@ -97,7 +100,7 @@ void getConcealedLP( Word32 int_fs; lsf = memDecState->lsf_con; - + move16(); dlpc_bfi( L_frame, &lsf[0], memDecState->lsfold_14Q1, last_good, 1, memDecState->mem_MA_14Q1, memDecState->mem_AR, &( memDecState->stab_fac_Q15 ), memDecState->lsf_adaptive_mean_14Q1, @@ -357,3 +360,4 @@ static void reorder_lsfs( return; } +#endif diff --git a/lib_com/hp50.c b/lib_com/hp50.c index dbabd5632..64501b178 100644 --- a/lib_com/hp50.c +++ b/lib_com/hp50.c @@ -131,14 +131,8 @@ void hp20_flt( } -#if 0 -//Below is fixed implmentation -//TO DO rename hp20_flt to hp20 once macro introduced -#endif - - #define HP20_COEFF_SCALE ( 2 ) - +#ifdef IVAS_FLOAT_FIXED /* * hp20 * @@ -442,160 +436,6 @@ void hp20( Word16 signal[], /* i/o: signal to filter any * } -#if 0 -void hp20_fix32( - Word32 signal_fx[], - const Word16 lg, - Word32 mem_fx[], - const Word32 Fs ) -{ - Word16 i; - Word32 a1_fx, a2_fx, b1_fx, b2_fx; - Word16 Qx0, Qx1, Qx2, Qy1, Qprev_y1, Qy2, Qprev_y2, Qmin; - Word64 x0_fx64, x1_fx64, x2_fx64, y0_fx64, y1_fx64, y2_fx64, R1, R2, R3, R4, R5; - - if ( Fs == 8000 ) - { - /* hp filter 20Hz at 3dB for 8000KHz input sampling rate - [b,a] = butter(2, 20.0/4000.0, 'high'); - b = [0.988954248067140 -1.977908496134280 0.988954248067140] - a =[1.000000000000000 -1.977786483776764 0.978030508491796]*/ - a1_fx = 1061816033l /* 1.977786483776764 Q29*/; - a2_fx = -525076131l /*-0.978030508491796 Q29*/; - b1_fx = -1061881538l /*-1.977908496134280 Q29*/; - b2_fx = 530940769l /* 0.988954248067140 Q29*/; - } - else if ( Fs == 16000 ) - { - /* hp filter 20Hz at 3dB for 16000KHz sampling rate - [b,a] = butter(2, 20.0/8000.0, 'high'); - b =[ 0.994461788958195 -1.988923577916390 0.994461788958195] - a =[1.000000000000000 -1.988892905899653 0.988954249933127] */ - a1_fx = 1067778748l /* 1.988892905899653 Q29*/; - a2_fx = -530940770l /*-0.988954249933127 Q29*/; - b1_fx = -1067795215l /*-1.988923577916390 Q29*/; - b2_fx = 533897608l /* 0.994461788958195 Q29*/; - } - else if ( Fs == 32000 ) - { - /* hp filter 20Hz at 3dB for 32000KHz sampling rate - [b,a] = butter(2, 20.0/16000.0, 'high'); - b =[0.997227049904470 -1.994454099808940 0.997227049904470] - a =[1.000000000000000 -1.994446410541927 0.994461789075954]*/ - a1_fx = 1070760263l /* 1.994446410541927 Q29*/; - a2_fx = -533897608l /*-0.994461789075954 Q29*/; - b1_fx = -1070764392l /*-1.994454099808940 Q29*/; - b2_fx = 535382196l /* 0.997227049904470 Q29*/; - } - else - { - /* hp filter 20Hz at 3dB for 48000KHz sampling rate - [b,a] = butter(2, 20.0/24000.0, 'high'); - b =[ 0.998150511190452 -1.996301022380904 0.998150511190452] - a =[1.000000000000000 -1.996297601769122 0.996304442992686]*/ - a1_fx = 1071754114l /* 1.996297601769122 Q29*/; - a2_fx = -534886875l /*-0.996304442992686 Q29*/; - b1_fx = -1071755951l /*-1.996301022380904 Q29*/; - b2_fx = 535877975l /* 0.998150511190452 Q29*/; - } - - Qprev_y1 = extract_l( mem_fx[4] ); - Qprev_y2 = extract_l( mem_fx[5] ); - y1_fx64 = mem_fx[0]; - y2_fx64 = mem_fx[1]; - x0_fx64 = mem_fx[2]; - x1_fx64 = mem_fx[3]; - - for ( i = 0; i < lg; i++ ) - { - x2_fx64 = x1_fx64; - x1_fx64 = x0_fx64; - x0_fx64 = signal_fx[i]; - - Qy1 = W_norm( y1_fx64 ); - if ( y1_fx64 == 0 ) - { - Qy1 = 62; - } - Qy1 = Qy1 - 34; - R1 = W_shl( y1_fx64, Qy1 ) * a1_fx; - Qy1 += Qprev_y1; - - Qy2 = W_norm( y2_fx64 ); - if ( y2_fx64 == 0 ) - { - Qy2 = 62; - } - Qy2 = Qy2 - 34; - R2 = W_shl( y2_fx64, Qy2 ) * a2_fx; - Qy2 += Qprev_y2; - - Qx0 = W_norm( x0_fx64 ); - if ( x0_fx64 == 0 ) - { - Qx0 = 62; - } - Qx0 = Qx0 - 34; - R3 = W_shl( x0_fx64, Qx0 ) * b2_fx; - - Qx1 = W_norm( x1_fx64 ); - if ( x1_fx64 == 0 ) - { - Qx1 = 62; - } - Qx1 = Qx1 - 34; - R4 = W_shl( x1_fx64, Qx1 ) * b1_fx; - - Qx2 = W_norm( x2_fx64 ); - if ( x2_fx64 == 0 ) - { - Qx2 = 62; - } - Qx2 = Qx2 - 34; - R5 = W_shl( x2_fx64, Qx2 ) * b2_fx; - - Qmin = min( Qy1, Qy2 ); - y0_fx64 = ( R1 >> ( Qy1 - Qmin ) ) + ( R2 >> ( Qy2 - Qmin ) ); - Qmin = min( Qmin, Qx0 ); - Qmin = min( Qmin, Qx1 ); - Qmin = min( Qmin, Qx2 ); - y0_fx64 = ( y0_fx64 >> ( min( Qy1, Qy2 ) - Qmin ) ) + ( R3 >> ( Qx0 - Qmin ) ) + ( R4 >> ( Qx1 - Qmin ) ) + ( R5 >> ( Qx2 - Qmin ) ); - y0_fx64 = y0_fx64 >> 29; - - signal_fx[i] = W_extract_l( W_shr( y0_fx64, Qmin ) ); - - y2_fx64 = y1_fx64; - y1_fx64 = y0_fx64; - Qprev_y2 = Qprev_y1; - Qprev_y1 = Qmin; - } - - Qy1 = W_norm( y1_fx64 ); - if ( y1_fx64 != 0 && Qy1 < 32 ) - { - y1_fx64 = y1_fx64 >> ( 32 - Qy1 ); - Qprev_y1 -= ( 32 - Qy1 ); - } - - Qy2 = W_norm( y2_fx64 ); - if ( y2_fx64 != 0 && Qy2 < 32 ) - { - y2_fx64 = y2_fx64 >> ( 32 - Qy2 ); - Qprev_y2 -= ( 32 - Qy2 ); - } - - mem_fx[0] = W_extract_l( y1_fx64 ); - mem_fx[1] = W_extract_l( y2_fx64 ); - mem_fx[2] = W_extract_l( x0_fx64 ); - mem_fx[3] = W_extract_l( x1_fx64 ); - mem_fx[4] = Qprev_y1; - mem_fx[5] = Qprev_y2; - - return; -} -#endif - -#ifdef IVAS_FLOAT_FIXED void hp20_fix32( Word32 signal_fx[], const Word16 lg, diff --git a/lib_com/hq2_bit_alloc.c b/lib_com/hq2_bit_alloc.c index 3b1cda25d..e98a680bf 100644 --- a/lib_com/hq2_bit_alloc.c +++ b/lib_com/hq2_bit_alloc.c @@ -62,254 +62,7 @@ #define BITS_FACT_0p92 ( Word16 )( 0.92f * (float) pow( 2, Qbf ) + 0.5f ) #define L_Comp( hi, lo ) L_mac( L_deposit_h( hi ), lo, 1 ) -#if 0 // functions already present in hq2_bit_alloc_fx.c -/*------------------------------------------------------------------- - * div_s_ss() - * - * - *-------------------------------------------------------------------*/ - -/*! r: result of division (Word16 Q0) */ -static Word16 div_s_ss( - const Word16 n, /* i : numerator (Word16 Q0 */ - const Word16 d /* i : denominator (Word16 Q0) */ -) -{ - Word16 norm_n, norm_d; - Word16 ns, ds; - Word16 res; - Word16 tmp; - - test(); - IF( n == 0 || d == 0 ) - { - return 0; - } - - norm_n = norm_s( n ); - norm_n = sub( norm_n, 1 ); - ns = shl( n, norm_n ); - - norm_d = norm_s( d ); - ds = shl( d, norm_d ); - - tmp = div_s( ns, ds ); - res = shr( tmp, add( sub( norm_n, norm_d ), 15 ) ); - - return res; -} - - -/*-------------------------------------------------------------------* - * Bits2indvsb() - * - * Bit allocation to individual SB's in a group - *-------------------------------------------------------------------*/ -static void Bits2indvsb_fx( - const Word32 *L_be, /* i : Qbe Band Energy of sub-band */ - const Word16 start_band, /* i : Q0 start band indices */ - const Word16 end_band, /* i : Q0 end band indices */ - const Word16 Bits, /* i : Q0 Total number of bits allocated to a group */ - const Word32 L_Bits_needed, /* i : QRk smallest bit number for allocation in group */ - Word32 *L_Rsubband, /* o : QRk bit allocation of sub-band */ - Word16 *p2aflags_fx /* i/o: Q0 peaky/noise subband flag */ -) -{ - Word16 i, j, k; - Word32 L_R_temp[14]; /* QRk = QL_Rsubband; */ - Word16 Ravg_fx; - Word16 QRavg; - - const Word32 *L_y_ptr; - Word32 *L_R_ptr; - - Word16 Bits_avg_fx; - Word16 QBavg; - Word16 scale_fact_fx; - - Word16 band_num_fx; - Word16 index_fx[14]; - - Word16 y_index_fx[14]; - - Word16 be_sum_fx; /* Q0 */ - - Word16 exp_normn, exp_normd; - Word16 enr_diffcnt_fx; - Word16 th_5_fx; - Word16 Rcnt_fx; - - Word16 be_cnt_fx; - Word16 *p2aflags_fx_ptr; - - Word32 L_temp1; - Word32 L_temp2; - - band_num_fx = sub( end_band, start_band ); - L_y_ptr = L_be + start_band; - L_R_ptr = L_Rsubband + start_band; - p2aflags_fx_ptr = p2aflags_fx + start_band; - - FOR( i = 0; i < band_num_fx; i++ ) - { - y_index_fx[i] = extract_h( L_shr( L_y_ptr[i], sub( SWB_BWE_LR_Qbe, 16 ) ) ); - move16(); - index_fx[i] = i; - move16(); - } - - - /* Rearrange norm vector in decreasing order */ - reordvct( y_index_fx, band_num_fx, index_fx ); - - be_sum_fx = 0; - move16(); - be_cnt_fx = 0; - move16(); - FOR( j = 0; j < band_num_fx; j++ ) - { - test(); - IF( y_index_fx[j] <= 0 || p2aflags_fx_ptr[index_fx[j]] == 0 ) - { - y_index_fx[j] = 0; - move16(); - L_R_temp[j] = 0x0L; - move32(); - } - ELSE - { - L_R_temp[j] = C1_QRk; - move32(); /* filled not zero value */ - be_cnt_fx = add( be_cnt_fx, 1 ); - } - } - - i = sub( be_cnt_fx, 1 ); - FOR( k = 0; k <= i; k++ ) - { - test(); - if ( L_R_temp[k] > 0 ) - { - be_sum_fx = add( be_sum_fx, y_index_fx[k] ); - } - } - QBavg = 0; - move16(); - - /*Ravg = (float) be_sum/be_cnt;*/ - Ravg_fx = 0; - move16(); - QRavg = 0; - move16(); - IF( be_cnt_fx != 0x0 ) - { - exp_normn = norm_s( be_sum_fx ); - exp_normn = sub( exp_normn, 1 ); - exp_normd = norm_s( be_cnt_fx ); - Ravg_fx = div_s( shl( be_sum_fx, exp_normn ), shl( be_cnt_fx, exp_normd ) ); - - Ravg_fx = shr( Ravg_fx, 2 ); /* safe shift */ - QRavg = add( sub( exp_normn, exp_normd ), 15 - 2 ); - } - - enr_diffcnt_fx = 0; - move16(); - th_5_fx = shl( 5, QRavg ); - FOR( j = 0; j < be_cnt_fx; j++ ) - { - if ( sub( abs_s( sub( Ravg_fx, shl( y_index_fx[j], QRavg ) ) ), th_5_fx ) > 0 ) - { - enr_diffcnt_fx = add( enr_diffcnt_fx, 1 ); - } - } - - IF( enr_diffcnt_fx > 0 ) - { - scale_fact_fx = 11468; - move16(); /* 0.35f 11468.8(Q15) */ - } - ELSE - { - scale_fact_fx = 19661; - move16(); /* 0.60f 19660.8(Q15) */ - } - - /* Bits allocation to individual SB's in a group based on Band Energies */ - FOR( j = 0; j < be_cnt_fx; j++ ) - { - Rcnt_fx = add( i, 1 ); - - /* Ravg = (float) be_sum/Rcnt; */ - exp_normn = norm_s( be_sum_fx ); - exp_normn = sub( exp_normn, 1 ); - exp_normd = norm_s( Rcnt_fx ); - Ravg_fx = div_s( shl( be_sum_fx, exp_normn ), shl( Rcnt_fx, exp_normd ) ); - Ravg_fx = shr( Ravg_fx, 2 ); /* safe shift */ - QRavg = add( sub( exp_normn, exp_normd ), 15 - 2 ); - - test(); - if ( be_sum_fx <= 0 ) - { - be_sum_fx = 1; - move16(); - } - /* Bits_avg = (float) Bits/(be_sum+EPSILON); */ - Bits_avg_fx = 0; - move16(); - QBavg = 0; - move16(); - IF( Bits != 0 ) - { - exp_normn = norm_s( Bits ); - exp_normn = sub( exp_normn, 1 ); - exp_normd = norm_s( be_sum_fx ); - Bits_avg_fx = div_s( shl( Bits, exp_normn ), shl( be_sum_fx, exp_normd ) ); - Bits_avg_fx = shr( Bits_avg_fx, 2 ); /* safe_shift */ - QBavg = add( sub( exp_normn, exp_normd ), 15 - 2 ); - } - FOR( k = 0; k <= i; k++ ) - { - IF( L_R_temp[k] > 0 ) /* Rtemp -> SWB_BWE_LR_QRk */ - { - /* Allocate more bits to SB, if SB bandenergy is higher than average energy */ - /* R_temp[k] = (float)( Bits_avg * y_index[k]+( scale_fact * (y_index[k] - Ravg))); */ - L_temp1 = L_mult( Bits_avg_fx, y_index_fx[k] ); /* QBavg+1 */ - L_temp2 = L_mult( scale_fact_fx, sub( shl( y_index_fx[k], QRavg ), Ravg_fx ) ); /* 15+QRavg+1 */ - L_R_temp[k] = L_add( L_shr( L_temp1, sub( add( QBavg, 1 ), SWB_BWE_LR_QRk ) ), L_shr( L_temp2, sub( add( QRavg, 16 ), SWB_BWE_LR_QRk ) ) ); /* SWB_BWE_LR_QRk */ - } - } - IF( L_sub( L_R_temp[i], L_Bits_needed ) < 0 ) - { - L_R_temp[i] = 0x0L; - move32(); - - p2aflags_fx_ptr[index_fx[i]] = 0; - move16(); - - /* be_sum -= y_index[i]; */ - be_sum_fx = sub( be_sum_fx, y_index_fx[i] ); - - i = sub( i, 1 ); - } - ELSE - { - BREAK; - } - } - - /* Rearrange the bit allocation to align with original */ - FOR( k = 0; k < band_num_fx; k++ ) - { - j = index_fx[k]; - move16(); - L_R_ptr[j] = L_R_temp[k]; - move32(); - } - - return; -} -#endif /*-------------------------------------------------------------------* * hq2_bit_alloc_har() * diff --git a/lib_com/hq2_core_com.c b/lib_com/hq2_core_com.c index 6407a2a25..59ad832f7 100644 --- a/lib_com/hq2_core_com.c +++ b/lib_com/hq2_core_com.c @@ -324,10 +324,12 @@ void bit_allocation_second_fx2( Word16 tmp; Word32 L_tmp; - for ( k = 0; k < BANDS; k++ ) + FOR( k = 0; k < BANDS; k++ ) { - if ( ( ( sub( k_sort[k], sub( BANDS, p2a_bands ) ) >= 0 ) && ( sub( p2a_flags[k_sort[k]], 1 ) == 0 ) ) || - ( ( sub( k_sort[k], sub( BANDS, 2 ) ) >= 0 ) && ( sub( last_bitalloc[sub( k_sort[k], sub( BANDS, 2 ) )], 1 ) == 0 ) ) ) + test(); + test(); + IF( ( ( sub( k_sort[k], sub( BANDS, p2a_bands ) ) >= 0 ) && ( sub( p2a_flags[k_sort[k]], 1 ) == 0 ) ) || + ( ( sub( k_sort[k], sub( BANDS, 2 ) ) >= 0 ) && ( sub( last_bitalloc[sub( k_sort[k], sub( BANDS, 2 ) )], 1 ) == 0 ) ) ) { exp = norm_s( band_width[k_sort[k]] ); tmp = shl( band_width[k_sort[k]], exp ); /*Q(exp) */ @@ -339,15 +341,19 @@ void bit_allocation_second_fx2( { rk_temp = ever_bits[k]; k2 = k; + move16(); + move16(); } class_flag = 1; + move16(); } } - if ( class_flag == 0 || sub( input_frame, L_FRAME8k ) == 0 ) + IF( class_flag == 0 || sub( input_frame, L_FRAME8k ) == 0 ) { - for ( k = 0; k < BANDS; k++ ) + FOR( k = 0; k < BANDS; k++ ) { - if ( sub( k_sort[k], sub( BANDS, p2a_bands ) ) < 0 && Rk_sort[k] > 0 ) + test(); + IF( sub( k_sort[k], sub( BANDS, p2a_bands ) ) < 0 && Rk_sort[k] > 0 ) { exp = norm_s( band_width[k_sort[k]] ); tmp = shl( band_width[k_sort[k]], exp ); /*Q(exp) */ @@ -355,55 +361,63 @@ void bit_allocation_second_fx2( L_tmp = Mult_32_16( Rk_sort[k], tmp ); /* Q(16+29-exp-15 = 30-exp) */ tmp = sub( 18, exp ); ever_sort[k] = extract_l( L_shr( L_tmp, tmp ) ); /*Q12 */ + move16(); IF( sub( ever_sort[k], ever_temp ) < 0 ) { ever_temp = ever_sort[k]; + move16(); k2 = k; + move16(); } } } } k_num[0] = k2; - if ( sub( k_sort[k2], sub( BANDS, 1 ) ) == 0 ) + move16(); + IF( sub( k_sort[k2], sub( BANDS, 1 ) ) == 0 ) { - for ( k = 0; k < BANDS; k++ ) + FOR( k = 0; k < BANDS; k++ ) { - if ( sub( k_sort[k], sub( k_sort[k2], 1 ) ) == 0 ) + IF( sub( k_sort[k], sub( k_sort[k2], 1 ) ) == 0 ) { k_num[1] = k; + move16(); } } } - else if ( k_sort[k2] == 0 ) + ELSE IF( k_sort[k2] == 0 ) { - for ( k = 0; k < BANDS; k++ ) + FOR( k = 0; k < BANDS; k++ ) { - if ( sub( k_sort[k], add( k_sort[k2], 1 ) ) == 0 ) + IF( sub( k_sort[k], add( k_sort[k2], 1 ) ) == 0 ) { k_num[1] = k; + move16(); } } } - else + ELSE { - if ( L_sub( Rk[sub( k_sort[k2], 1 )], Rk[add( k_sort[k2], 1 )] ) < 0 ) + IF( L_sub( Rk[sub( k_sort[k2], 1 )], Rk[add( k_sort[k2], 1 )] ) < 0 ) { - for ( k = 0; k < BANDS; k++ ) + FOR( k = 0; k < BANDS; k++ ) { - if ( sub( k_sort[k], sub( k_sort[k2], 1 ) ) == 0 ) + IF( sub( k_sort[k], sub( k_sort[k2], 1 ) ) == 0 ) { k_num[1] = k; + move16(); } } } - else + ELSE { - for ( k = 0; k < BANDS; k++ ) + FOR( k = 0; k < BANDS; k++ ) { - if ( sub( k_sort[k], add( k_sort[k2], 1 ) ) == 0 ) + IF( sub( k_sort[k], add( k_sort[k2], 1 ) ) == 0 ) { k_num[1] = k; + move16(); } } } diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c index 206a37bc8..58bc1934b 100644 --- a/lib_com/hq2_core_com_fx.c +++ b/lib_com/hq2_core_com_fx.c @@ -37,7 +37,6 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" - /*--------------------------------------------------------------------------* * mdct_spectrum_denorm() * @@ -324,7 +323,7 @@ void hq2_core_configure_fx( xcore_config_fx = &xcore_config_16kHz_013200bps_short; move16(); } - ELSE if ( LE_16( num_bits, ACELP_16k40 / FRAMES_PER_SEC ) ) + ELSE IF( LE_16( num_bits, ACELP_16k40 / FRAMES_PER_SEC ) ) { xcore_config_fx = &xcore_config_16kHz_016400bps_short; move16(); @@ -337,7 +336,7 @@ void hq2_core_configure_fx( xcore_config_fx = &xcore_config_16kHz_013200bps_long; move16(); } - ELSE if ( LE_16( num_bits, ACELP_16k40 / FRAMES_PER_SEC ) ) + ELSE IF( LE_16( num_bits, ACELP_16k40 / FRAMES_PER_SEC ) ) { xcore_config_fx = &xcore_config_16kHz_016400bps_long; move16(); @@ -351,7 +350,7 @@ void hq2_core_configure_fx( xcore_config_fx = &xcore_config_32kHz_013200bps_short; move16(); } -ELSE if ( LE_32( L_bwe_br, ACELP_16k40 ) ) +ELSE IF( LE_32( L_bwe_br, ACELP_16k40 ) ) { xcore_config_fx = &xcore_config_32kHz_016400bps_short; move16(); @@ -364,7 +363,7 @@ ELSE xcore_config_fx = &xcore_config_32kHz_013200bps_long; move16(); } - ELSE if ( LE_32( L_bwe_br, ACELP_16k40 ) ) + ELSE IF( LE_32( L_bwe_br, ACELP_16k40 ) ) { xcore_config_fx = &xcore_config_32kHz_016400bps_long; move16(); @@ -740,6 +739,7 @@ void bit_allocation_second_fx( move16(); } class_flag = 1; + move16(); } } test(); @@ -768,6 +768,7 @@ void bit_allocation_second_fx( } k_num[0] = k2; + move16(); IF( EQ_16( k_sort[k2], sub( BANDS, 1 ) ) ) { FOR( k = 0; k < BANDS; k++ ) diff --git a/lib_com/hq_bit_allocation_fx.c b/lib_com/hq_bit_allocation_fx.c index 4ac2252f8..ef2f13e05 100644 --- a/lib_com/hq_bit_allocation_fx.c +++ b/lib_com/hq_bit_allocation_fx.c @@ -6,9 +6,7 @@ #include "stl.h" /* required for wmc_tool */ #include "prot_fx.h" /* Function prototypes */ #include "cnst.h" /* Common constants */ -#ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" -#endif /*--------------------------------------------------------------------------* * hq_bit_allocation_fx() @@ -16,7 +14,6 @@ * Assign bits for HQ fine structure coding with PVQ *--------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED void ivas_hq_bit_allocation_fx( const Word32 core_brate, /* i : Core bit-rate Q0 */ const Word16 length, /* i : Frame length Q0 */ @@ -230,7 +227,6 @@ move16(); return; } -#endif void hq_bit_allocation_fx( const Word32 core_brate, /* i : Core bit-rate Q0 */ diff --git a/lib_com/hvq_pvq_bitalloc_fx.c b/lib_com/hvq_pvq_bitalloc_fx.c index 4775f1b78..003f7864c 100644 --- a/lib_com/hvq_pvq_bitalloc_fx.c +++ b/lib_com/hvq_pvq_bitalloc_fx.c @@ -15,7 +15,6 @@ /* Calculate the number of PVQ bands to code and allocate bits based on */ /* the number of available bits. */ /*--------------------------------------------------------------------------*/ - Word16 hvq_pvq_bitalloc_fx( Word16 num_bits, /* i/o: Number of available bits (including gain bits) */ const Word32 core_brate, /* i : core bitrate */ diff --git a/lib_com/ifft_rel.c b/lib_com/ifft_rel.c index 43aa3f122..41599cdd8 100644 --- a/lib_com/ifft_rel.c +++ b/lib_com/ifft_rel.c @@ -287,7 +287,6 @@ void ifft_rel( return; } - void ifft_rel_fx( Word16 io[], /* i/o: input/output vector */ const Word16 n, /* i : vector length */ @@ -651,369 +650,6 @@ void ifft_rel_fx( return; } -#if 0 -void ifft_rel_fx32( - Word32 io[], /* i/o: input/output vector */ - const Word16 n, /* i : vector length */ - const Word16 m /* i : log2 of vector length */ -) -{ - Word16 i, j, k; - Word16 step; - Word16 n2, n4, n8, i0; - Word16 is, id; - Word32 *x, *xi0, *xi1, *xi2, *xi3, *xi4, *xup1, *xdn6, *xup3, *xdn8; - Word32 xt; - Word32 r1; - Word32 t1, t2, t3, t4, t5; - const Word16 *s, *c, *s3, *c3; - - Word16 cc1, cc3, ss1, ss3; - Word16 tmp; -#ifdef BASOP_NOGLOB_DECLARE_LOCAL - Flag Overflow = 0; -#endif - - - /*-----------------------------------------------------------------* - * ifft - *-----------------------------------------------------------------*/ - - x = &io[-1]; - move32(); - n2 = shl(n, 1); - FOR(k = 1; k < m; k++) - { - is = 0; - move16(); - id = n2; - move16(); - n2 = shr(n2, 1); - move16(); - n4 = shr(n2, 2); - move16(); - n8 = shr(n4, 1); - move16(); - tmp = sub(n, 1); - WHILE(LT_16(is, tmp)) - { - xi1 = x + is + 1; - move32(); - xi2 = xi1 + n4; - move32(); - xi3 = xi2 + n4; - move32(); - xi4 = xi3 + n4; - move32(); - - FOR(i = is; i < n; i += id) - { -#ifdef BASOP_NOGLOB - t1 = L_sub_o(*xi1, *xi3, &Overflow); - *xi1 = L_add_o(*xi1, *xi3, &Overflow); -#else /* BASOP_NOGLOB */ - t1 = L_sub(*xi1, *xi3); - *xi1 = L_add(*xi1, *xi3); -#endif /* BASOP_NOGLOB */ - move32(); -#ifdef BASOP_NOGLOB - *xi2 = L_shl_o(*xi2, 1, &Overflow); -#else /* BASOP_NOGLOB */ - *xi2 = L_shl(*xi2, 1); -#endif /* BASOP_NOGLOB */ - move32(); -#ifdef BASOP_NOGLOB - *xi3 = L_sub_o(t1, L_shl_o(*xi4, 1, &Overflow), &Overflow); -#else /* BASOP_NOGLOB */ - *xi3 = L_sub(t1, L_shl(*xi4, 1)); -#endif /* BASOP_NOGLOB */ - move32(); -#ifdef BASOP_NOGLOB - *xi4 = L_add_o(t1, L_shl_o(*xi4, 1, &Overflow), &Overflow); -#else /* BASOP_NOGLOB */ - *xi4 = L_add(t1, L_shl(*xi4, 1)); -#endif /* BASOP_NOGLOB */ - move32(); - - IF(NE_16(n4, 1)) - { -#ifdef BASOP_NOGLOB - t1 = Mpy_32_16_1(L_sub_o(*(xi2 + n8), *(xi1 + n8), &Overflow), INV_SQR2_FX); - t2 = Mpy_32_16_1(L_add_o(*(xi4 + n8), *(xi3 + n8), &Overflow), INV_SQR2_FX); -#else /* BASOP_NOGLOB */ - t1 = Mpy_32_16_1(L_sub(*(xi2 + n8), *(xi1 + n8)), INV_SQR2_FX); - t2 = Mpy_32_16_1(L_add(*(xi4 + n8), *(xi3 + n8)), INV_SQR2_FX); -#endif /* BASOP_NOGLOB */ - -#ifdef BASOP_NOGLOB - *(xi1 + n8) = L_add_o(*(xi1 + n8), *(xi2 + n8), &Overflow); -#else /* BASOP_NOGLOB */ - *(xi1 + n8) = add(*(xi1 + n8), *(xi2 + n8)); -#endif /* BASOP_NOGLOB */ - move32(); -#ifdef BASOP_NOGLOB - *(xi2 + n8) = L_sub_o(*(xi4 + n8), *(xi3 + n8), &Overflow); -#else /* BASOP_NOGLOB */ - *(xi2 + n8) = L_sub(*(xi4 + n8), *(xi3 + n8)); -#endif /* BASOP_NOGLOB */ - move32(); -#ifdef BASOP_NOGLOB - *(xi3 + n8) = L_negate(L_shl_o(L_add_o(t2, t1, &Overflow), 1, &Overflow)); -#else /* BASOP_NOGLOB */ - *(xi3 + n8) = L_negate(shl(add(t2, t1), 1)); -#endif /* BASOP_NOGLOB */ - move32(); -#ifdef BASOP_NOGLOB - *(xi4 + n8) = L_shl_o(L_sub_o(t1, t2, &Overflow), 1, &Overflow); -#else /* BASOP_NOGLOB */ - *(xi4 + n8) = L_shl(L_sub(t1, t2), 1); -#endif /* BASOP_NOGLOB */ - move32(); - } - xi1 += id; - move32(); - xi2 += id; - move32(); - xi3 += id; - move32(); - xi4 += id; - move32(); - } - is = sub(shl(id, 1), n2); - id = shl(id, 2); - } - /*Can be acheived with a shr */ - step = N_MAX_SAS / n2; - move16(); - - s = sincos_t_fx + step; - move16(); - c = s + 64; - move16(); - s3 = sincos_t_fx + i_mult2(step, 3); - move16(); - c3 = s3 + 64; - move16(); - FOR(j = 2; j <= n8; j++) - { - cc1 = *c; - move16(); - ss1 = *s; - move16(); - cc3 = *c3; - move16(); - ss3 = *s3; - move16(); - - is = 0; - move16(); - id = shl(n2, 1); - - c += step; - move16(); - s += step; - move16(); - - c3 += 3 * step; - move16(); - s3 += 3 * step; - move16(); - WHILE(LT_16(is, sub(n, 1))) - { - xup1 = x + j + is; - move32(); - xup3 = xup1 + shl(n4, 1); - move32(); - xdn6 = xup3 - shl(j, 1) + 2; - move32(); - - xdn8 = xdn6 + shl(n4, 1); - move32(); - - FOR(i = is; i < n; i += id) - { -#ifdef BASOP_NOGLOB - t1 = L_sub_o(*xup1, *xdn6, &Overflow); - *xup1 = L_add_o(*xup1, *xdn6, &Overflow); -#else /* BASOP_NOGLOB */ - t1 = L_sub(*xup1, *xdn6); - *xup1 = L_add(*xup1, *xdn6); -#endif /* BASOP_NOGLOB */ - move32(); - xup1 += n4; - move32(); - xdn6 -= n4; - move32(); - -#ifdef BASOP_NOGLOB - t2 = L_sub_o(*xdn6, *xup1, &Overflow); - *xdn6 = L_add_o(*xup1, *xdn6, &Overflow); -#else /* BASOP_NOGLOB */ - t2 = L_sub(*xdn6, *xup1); - *xdn6 = L_add(*xup1, *xdn6); -#endif /* BASOP_NOGLOB */ - move32(); - - xdn6 += n4; - move32(); -#ifdef BASOP_NOGLOB - t3 = L_add_o(*xdn8, *xup3, &Overflow); - *xdn6 = L_sub_o(*xdn8, *xup3, &Overflow); -#else /* BASOP_NOGLOB */ - t3 = L_add(*xdn8, *xup3); - *xdn6 = L_sub(*xdn8, *xup3); -#endif /* BASOP_NOGLOB */ - move32(); - - xup3 += n4; - move32(); - xdn8 -= n4; - move32(); - -#ifdef BASOP_NOGLOB - t4 = L_add_o(*xup3, *xdn8, &Overflow); - *xup1 = L_sub_o(*xup3, *xdn8, &Overflow); -#else /* BASOP_NOGLOB */ - t4 = L_add(*xup3, *xdn8); - *xup1 = L_sub(*xup3, *xdn8); -#endif /* BASOP_NOGLOB */ - move32(); - -#ifdef BASOP_NOGLOB - t5 = L_sub_o(t1, t4, &Overflow); - t1 = L_add_o(t1, t4, &Overflow); - t4 = L_sub_o(t2, t3, &Overflow); - t2 = L_add_o(t2, t3, &Overflow); - *xup3 = L_sub_o(Mpy_32_16_1(t1, cc3), Mpy_32_16_1(t2, ss3), &Overflow); -#else /* BASOP_NOGLOB */ - t5 = L_sub(t1, t4); - t1 = L_add(t1, t4); - t4 = L_sub(t2, t3); - t2 = L_add(t2, t3); - *xup3 = L_sub(Mpy_32_16_1(t1, cc3), Mpy_32_16_1(t2, ss3)); -#endif /* BASOP_NOGLOB */ - move32(); - xup3 -= n4; - move32(); -#ifdef BASOP_NOGLOB - *xup3 = L_add_o(Mpy_32_16_1(t5, cc1), Mpy_32_16_1(t4, ss1), &Overflow); -#else /* BASOP_NOGLOB */ - *xup3 = L_add(Mpy_32_16_1(t5, cc1), Mpy_32_16_1(t4, ss1)); -#endif /* BASOP_NOGLOB */ - move32(); -#ifdef BASOP_NOGLOB - *xdn8 = L_sub_o(Mpy_32_16_1(t5, ss1), Mpy_32_16_1(t4, cc1), &Overflow); -#else /* BASOP_NOGLOB */ - *xdn8 = L_sub(Mpy_32_16_1(t5, ss1), Mpy_32_16_1(t4, cc1)); -#endif /* BASOP_NOGLOB */ - move32(); - - xdn8 += n4; - move32(); -#ifdef BASOP_NOGLOB - *xdn8 = L_add_o(Mpy_32_16_1(t2, cc3), Mpy_32_16_1(t1, ss3), &Overflow); -#else /* BASOP_NOGLOB */ - *xdn8 = L_add(Mpy_32_16_1(t2, cc3), Mpy_32_16_1(t1, ss3)); -#endif /* BASOP_NOGLOB */ - move32(); - - xup1 -= n4; - move32(); - xup1 += id; - move32(); - xup3 += id; - move32(); - xdn6 += id; - move32(); - xdn8 += id; - move32(); - } - is = sub(shl(id, 1), n2); - id = shl(id, 2); - } - } - } - - /*-----------------------------------------------------------------* - * Length two butterflies - *-----------------------------------------------------------------*/ - - is = 1; - move16(); - id = 4; - move16(); - WHILE(is < n) - { - xi0 = x + is; - move32(); - xi1 = xi0 + 1; - move32(); - - FOR(i0 = is; i0 <= n; i0 += id) - { - r1 = *xi0; - move32(); -#ifdef BASOP_NOGLOB - *xi0 = L_add_o(r1, *xi1, &Overflow); -#else /* BASOP_NOGLOB */ - *xi0 = add(r1, *xi1); -#endif /* BASOP_NOGLOB */ - move32(); -#ifdef BASOP_NOGLOB - *xi1 = L_sub_o(r1, *xi1, &Overflow); -#else /* BASOP_NOGLOB */ - *xi1 = sub(r1, *xi1); -#endif - move32(); - xi0 += id; - move32(); - xi1 += id; - move32(); - } - is = sub(shl(id, 1), 1); - id = shl(id, 2); - } - - /*-----------------------------------------------------------------* - * Digit reverse counter - *-----------------------------------------------------------------*/ - - j = 1; - move16(); - FOR(i = 1; i < n; i++) - { - IF(LT_16(i, j)) - { - xt = x[j]; - move32(); - x[j] = x[i]; - move32(); - x[i] = xt; - move32(); - } - k = shr(n, 1); - WHILE(LT_16(k, j)) - { - j = sub(j, k); - k = shr(k, 1); - } - j = add(j, k); - } - - /*-----------------------------------------------------------------* - * Normalization - *-----------------------------------------------------------------*/ - - tmp = div_s(1, n); /*Q15 */ - FOR(i = 1; i <= n; i++) - { - x[i] = Mpy_32_16_1(x[i], tmp); - move32(); - } - - return; -} -#else #define INV_SQRT_2_16 ( Word16 )( 0x5A82 ) void ifft_rel_fx32( Word32 io[], /* i/o: input/output vector */ @@ -1292,4 +928,3 @@ void ifft_rel_fx32( return; } -#endif diff --git a/lib_com/igf_base.c b/lib_com/igf_base.c index 637dd0270..48985e9a9 100644 --- a/lib_com/igf_base.c +++ b/lib_com/igf_base.c @@ -40,9 +40,6 @@ #include "prot.h" #include "rom_com.h" #include "wmc_auto.h" -#ifdef IVAS_FLOAT_FIXED -#include "prot_fx.h" -#endif /*---------------------------------------------------------------------* * IGF_ApplyTransFac_flt() @@ -507,12 +504,6 @@ static void IGF_gridSetUp_flt( hGrid->sfbWrap[t] = 0; } -#ifdef IVAS_FLOAT_FIXED - // hGrid->fFactor = float_to_fix16(hGrid->fFactor_flt, Q14); - // hGrid->lFactor = float_to_fix16(hGrid->lFactor_flt, Q14); - // hGrid->gFactor = float_to_fix16(hGrid->gFactor_flt, Q14); -#endif - return; } diff --git a/lib_com/igf_base_fx.c b/lib_com/igf_base_fx.c index 022720707..7796c5cb9 100644 --- a/lib_com/igf_base_fx.c +++ b/lib_com/igf_base_fx.c @@ -1308,9 +1308,6 @@ Word16 IGFCommonFuncsIGFConfiguration( move16(); hIGFInfo->maxHopsize = maxHopsize; move16(); -#if 0 - //100820 temp fix -#endif hIGFInfo->nfSeedBuf[0] = 0; move16(); hIGFInfo->nfSeedBuf[1] = 0; @@ -1391,9 +1388,6 @@ Word16 IGFCommonFuncsIGFConfiguration_ivas_fx( move16(); hIGFInfo->maxHopsize = maxHopsize; move16(); -#if 0 - //100820 temp fix -#endif hIGFInfo->nfSeedBuf[0] = 0; move16(); hIGFInfo->nfSeedBuf[1] = 0; diff --git a/lib_com/interleave_spectrum.c b/lib_com/interleave_spectrum.c index 9fdba4c77..5ae7c421a 100644 --- a/lib_com/interleave_spectrum.c +++ b/lib_com/interleave_spectrum.c @@ -127,6 +127,7 @@ void interleave_spectrum( return; } +#ifdef IVAS_FLOAT_FIXED void interleave_spectrum_fx( Word32 *coefs, /* i/o: input and output coefficients Q12 */ const Word16 length /* i : length of spectrum Q0 */ @@ -211,7 +212,7 @@ void interleave_spectrum_fx( return; } - +#endif /*--------------------------------------------------------------------------* * de_interleave_spectrum() @@ -293,7 +294,6 @@ void de_interleave_spectrum( return; } -#ifdef IVAS_FLOAT_FIXED void ivas_de_interleave_spectrum_fx( Word32 *coefs, /* i/o: input and output coefficients Q12 */ const Word16 length /* i : length of spectrum Q0 */ @@ -382,7 +382,6 @@ void ivas_de_interleave_spectrum_fx( return; } -#endif void 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 f4e42de2c..d063baadc 100644 --- a/lib_com/interpol.c +++ b/lib_com/interpol.c @@ -79,7 +79,6 @@ float interpolation( return s; } - Word32 Interpol_lc_fx( /* o : interpolated value Qx+16 */ const Word16 *x, /* i : input vector Q0 */ const Word16 *win, /* i : interpolation window Q14 */ diff --git a/lib_com/isf_dec_amr_wb_fx.c b/lib_com/isf_dec_amr_wb_fx.c index a054e08ca..54ab5c16f 100644 --- a/lib_com/isf_dec_amr_wb_fx.c +++ b/lib_com/isf_dec_amr_wb_fx.c @@ -40,7 +40,6 @@ void E_LPC_isf_isp_conversion( const Word16 isf[], Word16 isp[], const Word16 m ); #endif - /*---------------------------------------------------------------------* * isf_dec_amr_wb() * diff --git a/lib_com/ivas_agc_com_fx.c b/lib_com/ivas_agc_com_fx.c index c173e79a2..db5ae0d21 100644 --- a/lib_com/ivas_agc_com_fx.c +++ b/lib_com/ivas_agc_com_fx.c @@ -40,17 +40,13 @@ #include "wmc_auto.h" #include "prot.h" #include "rom_com.h" - +#ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------------------------* * Local constants *------------------------------------------------------------------------------------------*/ -//#define SQRKMAX ( 1.5f ) -//#define NBITS_DIFFG ( 2 ) -//#define DBSTEP ( -6.f ) /* desired dB step value in dB*/ -#define ABS_EMIN_MAX ( 3 ) -#define MAXATTEXP ( 1 ) /* the desired maximum attenuation exponent range per frame*/ - +#define ABS_EMIN_MAX ( 3 ) +#define MAXATTEXP ( 1 ) /* the desired maximum attenuation exponent range per frame*/ #define LOG2_NUMCOEFF_SQRKMAX ( 3 ) /* ceilf(logf(ceilf(SQRKMAX * numCoeffs)) * INV_LOG_2) in Q0 */ #define LOG2_4 ( 2 ) /* ceilf(logf(totExp) * INV_LOG_2)in Q0 */ #define A_FX ( 8172 ) /* 0.5f * ( 1.f - powf( 10.f, DBSTEP / 20.f ) ) in Q15 */ @@ -109,29 +105,11 @@ void ivas_agc_calcGainParams_fx( UWord16 *maxAttExp, const Word16 numCoeffs ) { - // Word16 totExp; - // Word16 Bm; - // Word16 nbits; - - // nbits = NBITS_DIFFG; assert( numCoeffs == IVAS_SPAR_MAX_DMX_CHS ); *absEmin = s_max( ABS_EMIN_MAX, LOG2_NUMCOEFF_SQRKMAX ); move16(); - - // totExp = add( add( *absEmin, AGC_EMAX ), 1 ); - /**betaE = (UWord16)ceilf(logf(totExp) * INV_LOG_2);*/ *betaE = (UWord16) LOG2_4; move16(); - - /*Bm = (UWord16)ceilf(logf((AGC_EMAX + 1 + 1)) * INV_LOG_2);*/ - // Bm = 1; - - // IF( GT_16( nbits, 0 ) ) - //{ - // Bm = s_min( AGC_BITS_PER_CH - 1, NBITS_DIFFG ); - // } - - /**maxAttExp = ((UWord16) powf( 2, Bm ) ) - 2;*/ *maxAttExp = sub( shl( 2, 1 ), 2 ); *maxAttExp = s_min( MAXATTEXP, *maxAttExp ); move16(); @@ -139,3 +117,4 @@ void ivas_agc_calcGainParams_fx( return; } +#endif diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index c265cad78..adfe5b666 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -50,10 +50,11 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -static uint16_t deindex_sph_idx_general( const int16_t idx_sph, const int16_t no_bits, float *theta_dec, float *phi_dec, uint16_t *p_id_phi, const MC_LS_SETUP mc_format ); #ifdef IVAS_FLOAT_FIXED static UWord16 deindex_sph_idx_general_fx( const Word16 idx_sph, const Word16 no_bits, Word32 *theta_dec_fx, Word32 *phi_dec_fx, UWord16 *p_id_phi, const MC_LS_SETUP mc_format ); +#else +static uint16_t deindex_sph_idx_general( const int16_t idx_sph, const int16_t no_bits, float *theta_dec, float *phi_dec, uint16_t *p_id_phi, const MC_LS_SETUP mc_format ); #endif /*------------------------------------------------------------------------- @@ -1678,6 +1679,7 @@ Word32 deindex_azimuth_fx( * decoding the spherical index for one tile *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void deindex_spherical_component( const uint16_t sph_idx, /* i : spherical index */ float *az, /* o : decoded azimuth value */ @@ -1716,8 +1718,7 @@ void deindex_spherical_component( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void deindex_spherical_component_fx( const UWord16 sph_idx, /* i : spherical index */ Word32 *az_fx, /* o : decoded azimuth value */ @@ -1981,6 +1982,7 @@ void calculate_hodirac_sector_parameters( * deindex the spherical index for more than 2 bits for the spherical grid *----------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED /*! r: decoded elevation index */ static uint16_t deindex_sph_idx_general( const int16_t idx_sph, /* i : spherical index */ @@ -2093,8 +2095,7 @@ static uint16_t deindex_sph_idx_general( return id_th; } - -#ifdef IVAS_FLOAT_FIXED +#else static UWord16 deindex_sph_idx_general_fx( const Word16 idx_sph, /* i : spherical index */ const Word16 no_bits, /* i : number of bits in the spherical grid*/ diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index d3fd6af80..419a19992 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -52,6 +52,7 @@ static void ivas_get_active_bins( const int16_t **pActive_bins, const int16_t **pActive_bins_abs, const int16_t **pStart_offset, const int16_t **pStart_offset_ab, const int32_t sampling_rate ); static void ivas_get_ld_fb_resp( float **ppIdeal_FRs_re, float **ppIdeal_FRs_im, float **ppNew_FRs_re, float **ppNew_FRs_im, const int16_t *pActive_bins, const int16_t *pStart_offset, const int16_t num_bands, const int16_t delay, const int32_t sampling_rate ); #ifdef IVAS_FLOAT_FIXED +static void ivas_get_active_bins_fx( const Word16 **pActive_bins, const Word16 **pActive_bins_abs, const Word16 **pStart_offset, const Word16 **pStart_offset_ab, const Word32 sampling_rate ); static void ivas_get_ld_fb_resp_fx( Word32 **ppIdeal_FRs_re_fx, Word32 **ppIdeal_FRs_im_fx, Word32 **ppNew_FRs_re_fx, Word32 **ppNew_FRs_im_fx, const Word16 *pActive_bins, const Word16 *pStart_offset, const Word16 num_bands, const Word16 delay, const Word32 sampling_rate ); #endif static ivas_error ivas_filterbank_setup( IVAS_FB_MIXER_HANDLE hFbMixer, const int32_t sampling_rate ); @@ -116,11 +117,7 @@ int16_t ivas_get_num_bands_from_bw_idx( static Word16 ivas_get_num_bands( const Word32 sampling_rate ) { -#ifdef IVAS_FLOAT_FIXED Word16 bwidth = ivas_get_bw_idx_from_sample_rate_fx( sampling_rate ); -#else - Word16 bwidth = ivas_get_bw_idx_from_sample_rate( sampling_rate ); -#endif Word16 num_active_bands = ivas_get_num_bands_from_bw_idx( bwidth ); return num_active_bands; @@ -178,9 +175,9 @@ ivas_error ivas_fb_set_cfg( IF( EQ_16( ivas_format, ISM_FORMAT ) ) { - pFb_cfg->fb_latency = NS2SA( sampling_rate, DELAY_FB_4_NS ); - pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_4_NS ); - pFb_cfg->prior_input_length = NS2SA( sampling_rate, DELAY_DIRAC_ENC_CMP_NS_PARAM_ISM ) + NS2SA( sampling_rate, DIRAC_SLOT_ENC_NS ); + pFb_cfg->fb_latency = NS2SA_FX2( sampling_rate, DELAY_FB_4_NS ); + pFb_cfg->fade_len = NS2SA_FX2( sampling_rate, DELAY_FB_4_NS ); + pFb_cfg->prior_input_length = add( NS2SA_FX2( sampling_rate, DELAY_DIRAC_ENC_CMP_NS_PARAM_ISM ), NS2SA_FX2( sampling_rate, DIRAC_SLOT_ENC_NS ) ); move16(); move16(); @@ -188,21 +185,23 @@ ivas_error ivas_fb_set_cfg( } ELSE IF( EQ_16( ivas_format, SBA_FORMAT ) ) { - pFb_cfg->fb_latency = NS2SA( sampling_rate, DELAY_FB_1_NS ); - - pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_4_NS ); - pFb_cfg->prior_input_length = NS2SA( sampling_rate, FRAME_SIZE_NS ); - pFb_cfg->windowed_fr_offset = (Word16) ( (float) ( sampling_rate / FRAMES_PER_SEC ) * 3.0f / 4.0f ) - NS2SA( sampling_rate, DELAY_DIRAC_SPAR_ENC_CMP_NS ); + pFb_cfg->fb_latency = NS2SA_FX2( sampling_rate, DELAY_FB_1_NS ); + pFb_cfg->fade_len = NS2SA_FX2( sampling_rate, DELAY_FB_4_NS ); + pFb_cfg->prior_input_length = NS2SA_FX2( sampling_rate, FRAME_SIZE_NS ); + Word16 tmp = shl( div_l( sampling_rate, FRAMES_PER_SEC ), 1 ); // Q0 + tmp = mult0( tmp, 3 ); // Q0 + tmp = shr( tmp, 2 ); // Q0 + pFb_cfg->windowed_fr_offset = (Word16) ( tmp - NS2SA_FX2( sampling_rate, DELAY_DIRAC_SPAR_ENC_CMP_NS ) ); move16(); move16(); move16(); } ELSE IF( EQ_16( ivas_format, MASA_FORMAT ) ) { - pFb_cfg->fb_latency = NS2SA( sampling_rate, DELAY_FB_1_NS ); - pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_1_NS ); - pFb_cfg->prior_input_length = NS2SA( sampling_rate, DELAY_DIRAC_ENC_CMP_NS ) + NS2SA( sampling_rate, DIRAC_SLOT_ENC_NS ); + pFb_cfg->fb_latency = NS2SA_FX2( sampling_rate, DELAY_FB_1_NS ); + pFb_cfg->fade_len = NS2SA_FX2( sampling_rate, DELAY_FB_1_NS ); + pFb_cfg->prior_input_length = add( NS2SA_FX2( sampling_rate, DELAY_DIRAC_ENC_CMP_NS ), NS2SA_FX2( sampling_rate, DIRAC_SLOT_ENC_NS ) ); move16(); move16(); @@ -210,9 +209,9 @@ ivas_error ivas_fb_set_cfg( } ELSE IF( EQ_16( ivas_format, MC_FORMAT ) ) { - pFb_cfg->fb_latency = NS2SA( sampling_rate, DELAY_FB_1_NS ); - pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_1_NS ); - pFb_cfg->prior_input_length = NS2SA( sampling_rate, DELAY_DIRAC_ENC_CMP_NS ) + NS2SA( sampling_rate, PARAM_MC_SLOT_ENC_NS ); + pFb_cfg->fb_latency = NS2SA_FX2( sampling_rate, DELAY_FB_1_NS ); + pFb_cfg->fade_len = NS2SA_FX2( sampling_rate, DELAY_FB_1_NS ); + pFb_cfg->prior_input_length = add( NS2SA_FX2( sampling_rate, DELAY_DIRAC_ENC_CMP_NS ), NS2SA_FX2( sampling_rate, PARAM_MC_SLOT_ENC_NS ) ); move16(); move16(); @@ -540,30 +539,6 @@ ivas_error ivas_FB_mixer_open_fx( move16(); } -#ifndef IVAS_FLOAT_FIXED /////////////////////////////// FLOAT /////////////////////////////////////////////// - for ( i = 0; i < num_chs_alloc; i++ ) - { - if ( fb_cfg->num_out_chans == 0 ) - { - hFbMixer->ppFilterbank_inFR_re[i] = NULL; - hFbMixer->ppFilterbank_inFR_im[i] = NULL; - } - else - { - j = fb_cfg->remix_order[i]; - - if ( ( hFbMixer->ppFilterbank_inFR_re[j] = (float *) malloc( sizeof( float ) * frame_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); - } - - if ( ( hFbMixer->ppFilterbank_inFR_im[j] = (float *) malloc( sizeof( float ) * frame_len ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); - } - } - } -#else FOR( i = 0; i < num_chs_alloc; i++ ) { IF( fb_cfg->num_out_chans == 0 ) @@ -586,7 +561,6 @@ ivas_error ivas_FB_mixer_open_fx( } } } -#endif IF( EQ_16( fb_cfg->active_w_mixing, -1 ) ) { @@ -598,16 +572,6 @@ ivas_error ivas_FB_mixer_open_fx( num_chs_alloc = s_max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in ); } -#ifndef IVAS_FLOAT_FIXED //////////////////////////// Float ////////////////////////////////////// - for ( i = 0; i < num_chs_alloc; i++ ) - { - if ( ( hFbMixer->ppFilterbank_prior_input[i] = (float *) malloc( sizeof( float ) * fb_cfg->prior_input_length ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); - } - set_f( hFbMixer->ppFilterbank_prior_input[i], 0, fb_cfg->prior_input_length ); - } -#else FOR( i = 0; i < num_chs_alloc; i++ ) { IF( ( hFbMixer->ppFilterbank_prior_input_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * fb_cfg->prior_input_length ) ) == NULL ) @@ -616,27 +580,10 @@ ivas_error ivas_FB_mixer_open_fx( } set32_fx( hFbMixer->ppFilterbank_prior_input_fx[i], 0, fb_cfg->prior_input_length ); } -#endif test(); IF( ( NE_16( fb_cfg->active_w_mixing, -1 ) ) && ( fb_cfg->num_out_chans > 0 ) ) { -#ifndef IVAS_FLOAT_FIXED ////////////////////////////////////////// FLOAT ////////////////////////////////////////////////////// - float *pTemp_mem; - if ( ( pTemp_mem = (float *) malloc( sizeof( float ) * fb_cfg->num_out_chans * max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in ) * IVAS_MAX_NUM_BANDS ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer" ); - } - for ( i = 0; i < fb_cfg->num_out_chans; i++ ) - { - for ( j = 0; j < fb_cfg->num_in_chans; j++ ) - { - hFbMixer->prior_mixer[i][j] = pTemp_mem; - pTemp_mem += IVAS_MAX_NUM_BANDS; - set_f( hFbMixer->prior_mixer[i][j], 0, IVAS_MAX_NUM_BANDS ); - } - } -#else Word32 *pTemp_mem_fx; IF( ( pTemp_mem_fx = (Word32 *) malloc( sizeof( Word32 ) * fb_cfg->num_out_chans * max( fb_cfg->num_in_chans, fb_cfg->nchan_fb_in ) * IVAS_MAX_NUM_BANDS ) ) == NULL ) { @@ -651,7 +598,6 @@ ivas_error ivas_FB_mixer_open_fx( set32_fx( hFbMixer->prior_mixer_fx[i][j], 0, IVAS_MAX_NUM_BANDS ); } } -#endif } IF( !spar_reconfig_flag ) @@ -662,18 +608,12 @@ ivas_error ivas_FB_mixer_open_fx( num_bands = ivas_get_num_bands( sampling_rate ); - ivas_get_active_bins( &pActive_bins_per_band, &pActive_bins_per_band_abs, &pStart_offset, &pStart_offset_abs, sampling_rate ); + ivas_get_active_bins_fx( &pActive_bins_per_band, &pActive_bins_per_band_abs, &pStart_offset, &pStart_offset_abs, sampling_rate ); IF( NE_16( fb_cfg->active_w_mixing, -1 ) ) { FOR( i = 0; i < num_bands; i++ ) { -#if 0 ///////////////// FLOAT //////////////////////////////////////// - if ((hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[i] = (float *)malloc(sizeof(float) * pActive_bins_per_band_abs[i])) == NULL) - { - return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder"); - } -#endif IF( ( hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band_fx[i] = (Word32 *) malloc( sizeof( Word32 ) * pActive_bins_per_band_abs[i] ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder fixed" ); @@ -694,17 +634,6 @@ ivas_error ivas_FB_mixer_open_fx( FOR( j = start_diff_band_non48k; j < num_bands; j++ ) { -#if 0 ////////////////////////////////// FLOAT //////////////////////// - if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); - } - - if ( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j] = (float *) malloc( sizeof( float ) * pActive_bins_per_band[j] ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); - } -#endif IF( ( hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k_fx[0][j] = (Word32 *) malloc( sizeof( Word32 ) * pActive_bins_per_band[j] ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FB mixer encoder" ); @@ -731,168 +660,12 @@ ivas_error ivas_FB_mixer_open_fx( IF( !spar_reconfig_flag ) { -#ifdef IVAS_FLOAT_FIXED -#if 1 /*********************Intermediate Conversion that needs to remove *****************************/ - // const Word16 *pAll_bins_per_band_48k = NULL; - - // const float *pAll_fb_fr[2]; - - // IF( hFbMixer->fb_cfg->num_out_chans > 0 ) - //{ - // IF( hFbMixer->fb_cfg->fb_latency == NS2SA( sampling_rate, DELAY_FB_1_NS ) ) - // { - // pAll_fb_fr[0] = ivas_fb_fr_12band_1ms_re; - // pAll_fb_fr[1] = ivas_fb_fr_12band_1ms_im; - // } - // pAll_bins_per_band_48k = ivas_fb_bins_per_band_12band_1ms[0]; - // } - - /************************************* Float table is gettin assigned here **************************************/ - // if ((error = ivas_fb_mixer_get_window(hFbMixer->fb_cfg->fb_latency, sampling_rate, &(hFbMixer->pAna_window))) != IVAS_ERR_OK) - //{ - // return error; - // } - - /************************************* Float table is gettin assigned here **************************************/ - IF( NE_32( ( error = ivas_fb_mixer_get_window( hFbMixer->fb_cfg->fade_len, sampling_rate, &( hFbMixer->pFilterbank_cross_fade ) ) ), IVAS_ERR_OK ) ) - { - return error; - } - -#if 0 - IF(hFbMixer->fb_cfg->num_out_chans > 0) - { - Word16 offset = 0; - - IF(sampling_rate == 48000) - { - FOR(j = 0; j < hFbMixer->pFb->filterbank_num_bands; j++) - { - hFbMixer->pFb->fb_consts.ppFilterbank_FRs[0][j] = &pAll_fb_fr[0][offset]; - hFbMixer->pFb->fb_consts.ppFilterbank_FRs[1][j] = &pAll_fb_fr[1][offset]; - - offset += hFbMixer->pFb->fb_consts.pFilterbank_bins_per_band[j]; - } - } - ELSE - { - Word16 active_bins_temp[MAX_NUM_BANDS_DIFF_NON48K]; - Word16 start_offset_temp[MAX_NUM_BANDS_DIFF_NON48K]; - Word16 num_diff_bands, start_diff_band_non48k; - - num_diff_bands = MAX_NUM_BANDS_DIFF_NON48K; - start_diff_band_non48k = hFbMixer->pFb->filterbank_num_bands - num_diff_bands; - - FOR(j = 0; j < hFbMixer->pFb->filterbank_num_bands; j++) - { - Word16 num_active_bins = hFbMixer->pFb->fb_consts.pFilterbank_bins_per_band[j]; - - IF(j < start_diff_band_non48k) - { - hFbMixer->pFb->fb_consts.ppFilterbank_FRs[0][j] = &pAll_fb_fr[0][offset]; - hFbMixer->pFb->fb_consts.ppFilterbank_FRs[1][j] = &pAll_fb_fr[1][offset]; - } - ELSE - { - mvr2r(&pAll_fb_fr[0][offset], hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j], num_active_bins); - mvr2r(&pAll_fb_fr[1][offset], hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j], num_active_bins); - } - - offset += pAll_bins_per_band_48k[j]; - } - - } - } -#endif - Word16 index[IVAS_MAX_NUM_FB_BANDS]; - set16_fx( index, 0, IVAS_MAX_NUM_FB_BANDS ); -#endif /*********************Intermediate Conversion that needs to remove *****************************/ IF( NE_32( ( error = ivas_filterbank_setup_fx( hFbMixer, sampling_rate, index ) ), IVAS_ERR_OK ) ) { return error; } - -#if 0 /*********************Intermediate Conversion that needs to remove *****************************/ - IF(hFbMixer->fb_cfg->num_out_chans > 0) - { - IF(sampling_rate != 48000) - { - const Word16 *pAll_bins_start_offset = NULL; - const Word16 *pAll_bins_per_band = NULL; - const Word16 *pAll_bins_start_offset_abs = NULL; - const Word16 *pAll_bins_per_band_abs = NULL; - - ivas_get_active_bins(&pAll_bins_per_band, &pAll_bins_per_band_abs, &pAll_bins_start_offset, &pAll_bins_start_offset_abs, sampling_rate); - - Word16 num_diff_bands, start_diff_band_non48k; - - num_diff_bands = MAX_NUM_BANDS_DIFF_NON48K; - start_diff_band_non48k = hFbMixer->pFb->filterbank_num_bands - num_diff_bands; - - FOR(j = start_diff_band_non48k; j < hFbMixer->pFb->filterbank_num_bands; j++) - { - fixedToFloat_arrL(hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k_fx[0][j], hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[0][j], Q30, pAll_bins_per_band[j]); - fixedToFloat_arrL(hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k_fx[1][j], hFbMixer->pFb->fb_consts.ppFilterbank_FRs_non48k[1][j], Q30, pAll_bins_per_band[j]); - - } - } - } -#endif -#if 0 - fixedToFloat_arrL(hFbMixer->pFb->fb_bin_to_band.p_short_stride_bin_to_band_fx, hFbMixer->pFb->fb_bin_to_band.p_short_stride_bin_to_band, Q22, 2 * MDFT_FB_BANDS_240); - - Word16 x, y; - - FOR(x = 0; x < IVAS_MAX_NUM_FB_BANDS; x++) - { - IF(hFbMixer->pFb->fb_bin_to_band.pp_short_stride_bin_to_band_fx[x] != NULL) - { - hFbMixer->pFb->fb_bin_to_band.pp_short_stride_bin_to_band[x] = &hFbMixer->pFb->fb_bin_to_band.p_short_stride_bin_to_band[index[x]]; - } - } - Word16 bands = hFbMixer->pFb->filterbank_num_bands; - - FOR(x = 0; x < bands; x++) - { - Word16 start_offset = hFbMixer->pFb->fb_consts.pFilterbank_bins_start_offset[x]; - Word16 num_bins = hFbMixer->pFb->fb_consts.pFilterbank_bins_per_band[x]; - Word16 idx = 0; - Word16 abs_active_bins = hFbMixer->pFb->fb_bin_to_band.pFb_active_bins_per_band[x]; - Word16 abs_start_offset = hFbMixer->pFb->fb_bin_to_band.pFb_start_bin_per_band[x]; - - FOR(y = start_offset; y < num_bins + start_offset; y++) - { - IF(y < (abs_active_bins + abs_start_offset) && y >= abs_start_offset && hFbMixer->fb_cfg->active_w_mixing != -1) - { - hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[x][idx] = fix_to_float(hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band_fx[x][idx], Q22); - idx = add(idx, 1); - - } - } - } - - IF(hFbMixer->fb_cfg->active_w_mixing != -1) - { - FOR(y = 0; y < bands; y++) - { - Word16 abs_active_bins = hFbMixer->pFb->fb_bin_to_band.pFb_active_bins_per_band[y]; - - FOR(x = 0; x < abs_active_bins; x++) - { - hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band[y][x] = me2f(hFbMixer->pFb->fb_bin_to_band.pFb_bin_to_band_fx[y][x], Q22); - } - } - - } -#endif /*********************Intermediate Conversion that needs to remove *****************************/ -#else - if ( ( error = ivas_filterbank_setup( hFbMixer, sampling_rate ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } *hFbMixer_out = hFbMixer; @@ -2128,6 +1901,45 @@ static void ivas_get_active_bins( return; } +#ifdef IVAS_FLOAT_FIXED +static void ivas_get_active_bins_fx( + const Word16 **pActive_bins, + const Word16 **pActive_bins_abs, + const Word16 **pStart_offset, + const Word16 **pStart_offset_abs, + const Word32 sampling_rate ) +{ + Word16 sr_idx; + + IF( EQ_32( sampling_rate, 32000 ) ) + { + sr_idx = 1; + move16(); + } + ELSE IF( EQ_32( sampling_rate, 16000 ) ) + { + sr_idx = 2; + move16(); + } + ELSE + { + sr_idx = 0; + move16(); + } + + *pActive_bins_abs = ivas_fb_abs_bins_per_band_12band_1ms[sr_idx]; + move16(); + *pActive_bins = ivas_fb_bins_per_band_12band_1ms[sr_idx]; + move16(); + *pStart_offset_abs = ivas_fb_abs_bins_start_offset_12band_1ms[sr_idx]; + move16(); + *pStart_offset = ivas_fb_bins_start_offset_12band_1ms[sr_idx]; + move16(); + + return; +} +#endif + /*-----------------------------------------------------------------------------------------* * Function ivas_filterbank_setup() @@ -2315,7 +2127,7 @@ static ivas_error ivas_filterbank_setup_fx( hFbMixer->pFb->filterbank_num_bands = ivas_get_num_bands( sampling_rate ); move16(); - ivas_get_active_bins( &pAll_bins_per_band, &pAll_bins_per_band_abs, &pAll_bins_start_offset, &pAll_bins_start_offset_abs, sampling_rate ); + ivas_get_active_bins_fx( &pAll_bins_per_band, &pAll_bins_per_band_abs, &pAll_bins_start_offset, &pAll_bins_start_offset_abs, sampling_rate ); IF( EQ_16( pCfg->fb_latency, NS2SA( sampling_rate, DELAY_FB_1_NS ) ) ) { diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index e0005e4b8..a1efc805b 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -65,7 +65,7 @@ static int16_t quantize_phi_masa( float phi, const int16_t flag_delta, float *ph #else static Word16 quantize_theta_masa_fx( const Word32 x_fx, const Word16 no_cb, Word32 *xhat_fx ); -static int16_t quantize_phi_masa_fx( const Word32 phi, const Word16 flag_delta, Word32 *phi_hat, const Word16 n ); +static Word16 quantize_phi_masa_fx( const Word32 phi, const Word16 flag_delta, Word32 *phi_hat, const Word16 n ); #endif diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index 1b19b9037..379fe5562 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -43,6 +43,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_rom_com_fx.h" +#include "ivas_prot_fx.h" #endif @@ -52,6 +53,9 @@ static void ivas_param_mc_set_coding_scheme( const MC_LS_SETUP mc_ls_setup, const int32_t ivas_total_brate, HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC ); +#ifdef IVAS_FLOAT_FIXED +static void ivas_param_mc_set_coding_scheme_fx( const MC_LS_SETUP mc_ls_setup, const Word32 ivas_total_brate, HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC ); +#endif /*------------------------------------------------------------------------- * ivas_param_mc_get_configuration_index() @@ -104,7 +108,7 @@ uint16_t ivas_param_mc_get_configuration_index( *------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -void ivas_param_mc_metadata_open( +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 */ @@ -127,7 +131,7 @@ void ivas_param_mc_metadata_open( set16_fx( hMetadataPMC->coding_band_mapping, 0, PARAM_MC_MAX_PARAMETER_BANDS ); /* set coding scheme */ - ivas_param_mc_set_coding_scheme( mc_ls_setup, ivas_total_brate, hMetadataPMC ); + ivas_param_mc_set_coding_scheme_fx( mc_ls_setup, ivas_total_brate, hMetadataPMC ); /* get configuration index */ config_index = ivas_param_mc_get_configuration_index( mc_ls_setup, ivas_total_brate ); @@ -159,7 +163,6 @@ void ivas_param_mc_metadata_open( #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 = ivas_param_mc_conf[config_index].ild_factors; // float hMetadataPMC->ild_factors_fx = ivas_param_mc_conf[config_index].ild_factors_fx; #ifndef FIX_901_PARAMMC_DEAD_CODE /* set default ICC maps */ @@ -192,11 +195,12 @@ void ivas_param_mc_metadata_open( return; } -#else +#endif + void ivas_param_mc_metadata_open( - const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ + 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 */ + 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 */ @@ -275,7 +279,6 @@ void ivas_param_mc_metadata_open( return; } -#endif /*------------------------------------------------------------------------- * ivas_param_mc_set_coded_bands() @@ -811,7 +814,7 @@ static int16_t ivas_param_mc_get_num_param_bands( *------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -static void ivas_param_mc_set_coding_scheme( +static void ivas_param_mc_set_coding_scheme_fx( 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 /* i/o: Parametric MC metadata handle */ @@ -826,7 +829,6 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->icc_coding.sym_freq = &ivas_param_mc_sym_freq_icc_cicp6_48_16bits[0]; hMetadataPMC->icc_coding.cum_freq_delta = &ivas_param_mc_cum_freq_icc_delta_cicp6_48_16bits[0]; hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_cicp6_48_16bits[0]; - hMetadataPMC->icc_coding.quantizer = &ivas_param_mc_quant_icc[0]; // float hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; move16(); @@ -837,7 +839,6 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->ild_coding.sym_freq = &ivas_param_mc_sym_freq_ild_cicp6_48_16bits[0]; hMetadataPMC->ild_coding.cum_freq_delta = &ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[0]; hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_cicp6_48_16bits[0]; - hMetadataPMC->ild_coding.quantizer = &ivas_param_mc_quant_ild_5d1_48[0]; // float hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; move16(); @@ -850,7 +851,6 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->icc_coding.sym_freq = &ivas_param_mc_sym_freq_icc_cicp12_48_16bits[0]; hMetadataPMC->icc_coding.cum_freq_delta = &ivas_param_mc_cum_freq_icc_delta_cicp12_48_16bits[0]; hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_cicp12_48_16bits[0]; - hMetadataPMC->icc_coding.quantizer = &ivas_param_mc_quant_icc[0]; // float hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; move16(); @@ -861,7 +861,6 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->ild_coding.sym_freq = &ivas_param_mc_sym_freq_ild_cicp12_48_16bits[0]; hMetadataPMC->ild_coding.cum_freq_delta = &ivas_param_mc_cum_freq_ild_delta_cicp12_48_16bits[0]; hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_cicp12_48_16bits[0]; - hMetadataPMC->ild_coding.quantizer = &ivas_param_mc_quant_ild_5d1_48[0]; // float hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; move16(); @@ -874,7 +873,6 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->icc_coding.sym_freq = &ivas_param_mc_sym_freq_icc_cicp14_48_16bits[0]; hMetadataPMC->icc_coding.cum_freq_delta = &ivas_param_mc_cum_freq_icc_delta_cicp14_48_16bits[0]; hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_cicp14_48_16bits[0]; - hMetadataPMC->icc_coding.quantizer = &ivas_param_mc_quant_icc[0]; // float hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; move16(); @@ -885,7 +883,6 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->ild_coding.sym_freq = &ivas_param_mc_sym_freq_ild_cicp14_48_16bits[0]; hMetadataPMC->ild_coding.cum_freq_delta = &ivas_param_mc_cum_freq_ild_delta_cicp14_48_16bits[0]; hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_cicp14_48_16bits[0]; - hMetadataPMC->ild_coding.quantizer = &ivas_param_mc_quant_ild_5d1_48[0]; // float hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; move16(); @@ -899,7 +896,6 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->icc_coding.sym_freq = &ivas_param_mc_sym_freq_icc_combined_48_16bits[0]; hMetadataPMC->icc_coding.cum_freq_delta = &ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[0]; hMetadataPMC->icc_coding.sym_freq_delta = &ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[0]; - hMetadataPMC->icc_coding.quantizer = &ivas_param_mc_quant_icc[0]; // float hMetadataPMC->icc_coding.quantizer_fx = &ivas_param_mc_quant_icc_fx[0]; hMetadataPMC->icc_coding.quantizer_size = PARAM_MC_SZ_ICC_QUANTIZER; move16(); @@ -910,7 +906,6 @@ static void ivas_param_mc_set_coding_scheme( hMetadataPMC->ild_coding.sym_freq = &ivas_param_mc_sym_freq_ild_combined_48_16bits[0]; hMetadataPMC->ild_coding.cum_freq_delta = &ivas_param_mc_cum_freq_ild_delta_combined_48_16bits[0]; hMetadataPMC->ild_coding.sym_freq_delta = &ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[0]; - hMetadataPMC->ild_coding.quantizer = &ivas_param_mc_quant_ild_5d1_48[0]; // float hMetadataPMC->ild_coding.quantizer_fx = &ivas_param_mc_quant_ild_5d1_48_fx[0]; hMetadataPMC->ild_coding.quantizer_size = PARAM_MC_SZ_ILD_QUANTIZER_4BITS; move16(); @@ -925,7 +920,7 @@ static void ivas_param_mc_set_coding_scheme( return; } -#else +#endif static void ivas_param_mc_set_coding_scheme( const MC_LS_SETUP mc_ls_setup, /* i : MC ls setup */ @@ -1017,5 +1012,3 @@ static void ivas_param_mc_set_coding_scheme( return; } - -#endif diff --git a/lib_com/ivas_mdct_imdct.c b/lib_com/ivas_mdct_imdct.c index 7aa5416de..d4e756775 100644 --- a/lib_com/ivas_mdct_imdct.c +++ b/lib_com/ivas_mdct_imdct.c @@ -56,6 +56,7 @@ * Time domain aliasing *-----------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_tda( const float *pIn, /* i : time domain buffer of size 2*length */ float *pOut, /* o : time domain buffer of size length */ @@ -73,7 +74,7 @@ void ivas_tda( return; } - +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_dct_windowing() diff --git a/lib_com/ivas_mdft_imdft.c b/lib_com/ivas_mdft_imdft.c index 564285b09..579efe5da 100644 --- a/lib_com/ivas_mdft_imdft.c +++ b/lib_com/ivas_mdft_imdft.c @@ -83,31 +83,31 @@ static void ivas_get_mdft_twid_factors_fx( { case L_FRAME48k: *ppTwid = &ivas_mdft_coeff_cos_twid_960_fx[0]; - break; + BREAK; case L_FRAME32k: *ppTwid = &ivas_mdft_coeff_cos_twid_640_fx[0]; - break; + BREAK; case L_FRAME16k: *ppTwid = &ivas_mdft_coeff_cos_twid_320_fx[0]; - break; + BREAK; case IVAS_240_PT_LEN: *ppTwid = &ivas_mdft_coeff_cos_twid_240_fx[0]; - break; + BREAK; case IVAS_160_PT_LEN: *ppTwid = &ivas_mdft_coeff_cos_twid_160_fx[0]; - break; + BREAK; case IVAS_120_PT_LEN: *ppTwid = &ivas_mdft_coeff_cos_twid_120_fx[0]; - break; + BREAK; case IVAS_80_PT_LEN: *ppTwid = &ivas_mdft_coeff_cos_twid_80_fx[0]; - break; + BREAK; case IVAS_40_PT_LEN: *ppTwid = &ivas_mdft_coeff_cos_twid_40_fx[0]; - break; + BREAK; default: assert( !"Not supported FFT length!" ); - break; + BREAK; } return; @@ -126,22 +126,22 @@ static void ivas_get_imdft_twid_factors_fx( { case L_FRAME48k: *ppTwid = ivas_mdft_coeff_cos_twid_960_fx; - break; + BREAK; case L_FRAME32k: *ppTwid = ivas_mdft_coeff_cos_twid_640_fx; - break; + BREAK; case L_FRAME16k: *ppTwid = ivas_mdft_coeff_cos_twid_320_fx; - break; + BREAK; case 240: *ppTwid = ivas_mdft_coeff_cos_twid_240_fx; - break; + BREAK; case 160: *ppTwid = ivas_mdft_coeff_cos_twid_160_fx; - break; + BREAK; case 80: *ppTwid = ivas_mdft_coeff_cos_twid_80_fx; - break; + BREAK; default: assert( !"Not supported FFT length!" ); } diff --git a/lib_com/ivas_pca_tools.c b/lib_com/ivas_pca_tools.c index f2c6d8d0e..9ee54da4f 100644 --- a/lib_com/ivas_pca_tools.c +++ b/lib_com/ivas_pca_tools.c @@ -1377,6 +1377,7 @@ void pca_enc_s3( * *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void pca_dec_s3( const int32_t index, float *q ) @@ -1449,6 +1450,7 @@ void pca_dec_s3( return; } +#endif #ifdef IVAS_FLOAT_FIXED // Not tested diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 1f22a9355..91f723c35 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3264,10 +3264,11 @@ void IGFDecReplicateTCX10State_flt( IGF_DEC_INSTANCE_HANDLE hIGFDec /* i/o: instance handle of IGF Decoder */ ); + void InitPsychLPC( - const Word32 sr_core, /* i : sampling rate of core-coder */ - const Word16 L_frame, /* i : frame length */ - const TCX_CONFIG_HANDLE hTcxCfg /* i : TCX configuration handle */ + const int32_t sr_core, /* i : sampling rate of core-coder */ + const int16_t L_frame, /* i : frame length */ + const TCX_CONFIG_HANDLE hTcxCfg /* i : TCX configuration handle */ ); #ifndef IVAS_FLOAT_FIXED @@ -4480,8 +4481,7 @@ void deindex_spherical_component_fx( const UWord16 no_bits, /* i : number of bits for the spherical grid */ const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); -#endif - +#else void deindex_spherical_component( const uint16_t sph_idx, /* i : spherical index */ float *az, /* o : decoded azimuth value */ @@ -4491,6 +4491,7 @@ void deindex_spherical_component( const uint16_t no_bits, /* i : number of bits for the spherical grid */ const MC_LS_SETUP mc_format /* i : channel format if in MC-mode */ ); +#endif #ifndef IVAS_FLOAT_FIXED void small_reduction_direction( diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 20f8cf369..bceefbb76 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -254,6 +254,7 @@ void ivas_agc_read_bits_fx( const Word16 AGC_flag /* i : AGC on/off flag */ ); +#ifdef IVAS_FLOAT_FIXED // ivas_agc_com_fx.c void ivas_agc_initWindowFunc_fx( Word16 *pWinFunc, @@ -265,7 +266,6 @@ void ivas_agc_calcGainParams_fx( UWord16 *maxAttExp, const Word16 numCoeffs ); -#ifdef IVAS_FLOAT_FIXED void ivas_transient_det_process_fx( ivas_trans_det_state_t *hTranDet, /* i/o: SPAR TD handle */ Word32 *pIn_pcm, /* i : input audio channels */ @@ -2255,6 +2255,20 @@ Word16 param_mc_get_num_cldfb_syntheses_fx( Decoder_Struct *st_ivas /* i : Parametric MC handle */ ); +void InitPsychLPC_fx( + const Word32 sr_core, /* i : sampling rate of core-coder */ + const Word16 L_frame, /* i : frame length */ + const TCX_CONFIG_HANDLE hTcxCfg /* i : TCX configuration handle */ +); + +ivas_error PsychoacousticParameters_Init_fx( + const Word32 sr_core, /* i : sampling rate of core-coder */ + const Word16 nBins, /* i : Number of bins (spectral lines) */ + const Word8 nBands, /* i : Number of spectrum subbands */ + const Word16 isTCX20, /* i : Flag indicating if the subband division is for TCX20 or TCX10 */ + const Word16 isWarped, /* i : Flag indicating if the scale is linear or warped */ + PsychoacousticParameters *pPsychParams ); + ivas_error ivas_FB_mixer_open_fx( IVAS_FB_MIXER_HANDLE *hFbMixer_out, /* i/o: FB mixer handle */ const Word32 sampling_rate, /* i : sampling rate */ @@ -2600,3 +2614,12 @@ void tdm_configure_dec_fx( Word16 *tdm_ratio_idx, /* o : ratio index */ const Word16 nb_bits_metadata /* i : number of metadata bits */ ); + +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 Word32 ivas_total_brate, /* i : IVAS total bitrate */ + HANDLE_IVAS_PARAM_MC_METADATA hMetadataPMC /* o : handle for the Parametric MC parameter coding state */ +); diff --git a/lib_com/ivas_sns_com_fx.c b/lib_com/ivas_sns_com_fx.c index ee29a001d..76e67fb7d 100644 --- a/lib_com/ivas_sns_com_fx.c +++ b/lib_com/ivas_sns_com_fx.c @@ -43,7 +43,6 @@ #include "wmc_auto.h" #include "ivas_prot_fx.h" - /*------------------------------------------------------------------- * sns_compute_scf_fx() * @@ -276,6 +275,8 @@ void sns_interpolate_scalefactors_fx( /* Interpolation */ scf_int[0] = scf[0]; scf_int[1] = scf[0]; + move32(); + move32(); FOR( n = 0; n <= M - 2; n++ ) { @@ -283,10 +284,16 @@ void sns_interpolate_scalefactors_fx( scf_int[add( n * 4, 3 )] = Madd_32_16( scf[n], L_sub( scf[n + 1], scf[n] ), 12288 ); /* 12288 -> 3/8 in Q15 */ scf_int[add( n * 4, 4 )] = Madd_32_16( scf[n], L_sub( scf[n + 1], scf[n] ), 20480 ); /* 20480 -> 5/8 in Q15 */ scf_int[add( n * 4, 5 )] = Madd_32_16( scf[n], L_sub( scf[n + 1], scf[n] ), 28672 ); /* 28672 -> 7/8 in Q15 */ + move32(); + move32(); + move32(); + move32(); } scf_int[FDNS_NPTS - 2] = Madd_32_16( scf[M - 1], L_sub( scf[M - 1], scf[M - 2] ), 4096 ); scf_int[FDNS_NPTS - 1] = Madd_32_16( scf[M - 1], L_sub( scf[M - 1], scf[M - 2] ), 12288 ); + move32(); + move32(); /* Inversion at encoder-side */ IF( encoder_side == ENC ) diff --git a/lib_com/ivas_spar_com_quant_util.c b/lib_com/ivas_spar_com_quant_util.c index 78541fd9d..6bd4a833c 100644 --- a/lib_com/ivas_spar_com_quant_util.c +++ b/lib_com/ivas_spar_com_quant_util.c @@ -90,6 +90,7 @@ void ivas_quantise_real_values( return; } +#ifdef IVAS_FLOAT_FIXED void ivas_quantise_real_values_fx( const Word32 *values_fx, const Word16 q_levels, @@ -140,7 +141,7 @@ void ivas_quantise_real_values_fx( } return; } - +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_spar_get_uniform_quant_strat() @@ -555,6 +556,7 @@ void ivas_clear_band_coeffs( return; } +#ifdef IVAS_FLOAT_FIXED void ivas_clear_band_coeffs_fx( ivas_band_coeffs_t *pband_coeffs, const UWord16 num_bands ) @@ -573,13 +575,29 @@ void ivas_clear_band_coeffs_fx( return; } - +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_clear_band_coeff_idx() * * clear band coeffs index array in SPAR MD *-----------------------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +void ivas_clear_band_coeff_idx( + ivas_band_coeffs_ind_t *pband_coeff_idx, + const UWord16 num_bands ) +{ + UWord16 i; + FOR( i = 0; i < num_bands; i++ ) + { + set16_fx( pband_coeff_idx[i].pred_index_re, 0, ( sub( IVAS_SPAR_MAX_CH, 1 ) ) ); + set16_fx( pband_coeff_idx[i].drct_index_re, 0, IVAS_SPAR_MAX_C_COEFF ); + set16_fx( pband_coeff_idx[i].decd_index_re, 0, sub( IVAS_SPAR_MAX_CH, 1 ) ); + } + + return; +} +#else void ivas_clear_band_coeff_idx( ivas_band_coeffs_ind_t *pband_coeff_idx, const UWord16 num_bands ) @@ -594,3 +612,4 @@ void ivas_clear_band_coeff_idx( return; } +#endif \ No newline at end of file diff --git a/lib_com/ivas_stereo_eclvq_com_fx.c b/lib_com/ivas_stereo_eclvq_com_fx.c index c72cc5510..828ea6b40 100644 --- a/lib_com/ivas_stereo_eclvq_com_fx.c +++ b/lib_com/ivas_stereo_eclvq_com_fx.c @@ -40,6 +40,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifdef IVAS_FLOAT_FIXED /*--------------------------------------------------------------- * ECSQ_init_instance_fx() * @@ -112,3 +113,4 @@ void ECSQ_dequantize_vector_fx( return; } +#endif \ No newline at end of file diff --git a/lib_com/ivas_stereo_mdct_bands_com.c b/lib_com/ivas_stereo_mdct_bands_com.c index 1cc569461..80153b619 100644 --- a/lib_com/ivas_stereo_mdct_bands_com.c +++ b/lib_com/ivas_stereo_mdct_bands_com.c @@ -303,9 +303,10 @@ void stereo_mdct_init_bands_fx( IF( LT_16( sfbOffset[*sfbCnt], L_frameTCX ) ) { Word16 nMissingBins = sub( L_frameTCX, sfbOffset[*sfbCnt] ); - if ( LT_16( shr( sfbWidths[i], 1 ), nMissingBins ) ) + IF ( LT_16( shr( sfbWidths[i], 1 ), nMissingBins ) ) { *sfbCnt = add( *sfbCnt, 1 ); + move16(); } sfbOffset[*sfbCnt] = L_frameTCX; move16(); diff --git a/lib_com/ivas_stereo_psychlpc_com.c b/lib_com/ivas_stereo_psychlpc_com.c index 33b6c20db..8ca07965d 100644 --- a/lib_com/ivas_stereo_psychlpc_com.c +++ b/lib_com/ivas_stereo_psychlpc_com.c @@ -39,13 +39,18 @@ #include "wmc_auto.h" #include +#ifdef IVAS_FLOAT_FIXED +#include "ivas_prot_fx.h" +#endif + /*-------------------------------------------------------------------* * SpectrumWeighting_Init() * * *-------------------------------------------------------------------*/ -static void SpectrumWeighting_Init( +#ifdef IVAS_FLOAT_FIXED +static void SpectrumWeighting_Init_fx( SpectrumWarping const *pSpectrumWarping, const Word16 isTCX20, PsychoacousticParameters *pPsychParams ) @@ -61,6 +66,25 @@ static void SpectrumWeighting_Init( return; } +#endif + +static void SpectrumWeighting_Init( + SpectrumWarping const *pSpectrumWarping, + const int16_t isTCX20, + PsychoacousticParameters *pPsychParams ) +{ + if ( isTCX20 ) + { + pPsychParams->bandLengths = pSpectrumWarping->bandLengthsTCX20; + } + else + { + pPsychParams->bandLengths = pSpectrumWarping->bandLengthsTCX10; + } + + return; +} + /*-------------------------------------------------------------------* * PsychoacousticParameters_Init() @@ -68,7 +92,8 @@ static void SpectrumWeighting_Init( * initialize a PsychoacousticParameters structure *-------------------------------------------------------------------*/ -ivas_error PsychoacousticParameters_Init( +#ifdef IVAS_FLOAT_FIXED +ivas_error PsychoacousticParameters_Init_fx( const Word32 sr_core, /* i : sampling rate of core-coder */ const Word16 nBins, /* i : Number of bins (spectral lines) */ const Word8 nBands, /* i : Number of spectrum subbands */ @@ -97,13 +122,13 @@ ivas_error PsychoacousticParameters_Init( SWITCH( sr_core ) { case 16000: - SpectrumWeighting_Init( sw16000Hz, isTCX20, pPsychParams ); + SpectrumWeighting_Init_fx( sw16000Hz, isTCX20, pPsychParams ); BREAK; case 25600: - SpectrumWeighting_Init( sw25600Hz, isTCX20, pPsychParams ); + SpectrumWeighting_Init_fx( sw25600Hz, isTCX20, pPsychParams ); BREAK; case 32000: - SpectrumWeighting_Init( sw32000Hz, isTCX20, pPsychParams ); + SpectrumWeighting_Init_fx( sw32000Hz, isTCX20, pPsychParams ); BREAK; default: return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Subband division not defined for this sampling rate" ); @@ -112,6 +137,51 @@ ivas_error PsychoacousticParameters_Init( return IVAS_ERR_OK; } +#endif + + +ivas_error PsychoacousticParameters_Init( + const int32_t sr_core, /* i : sampling rate of core-coder */ + const int16_t nBins, /* i : Number of bins (spectral lines) */ + const int8_t nBands, /* i : Number of spectrum subbands */ + const int16_t isTCX20, /* i : Flag indicating if the subband division is for TCX20 or TCX10 */ + const int16_t isWarped, /* i : Flag indicating if the scale is linear or warped */ + PsychoacousticParameters *pPsychParams ) +{ + + if ( pPsychParams == NULL ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "PsychParams handle is NULL" ); + } + + pPsychParams->nBins = nBins; + pPsychParams->nBands = nBands; + + if ( !isWarped ) + { + pPsychParams->bandLengths = NULL; + } + else + { + assert( pPsychParams->nBands == 64 ); + switch ( sr_core ) + { + case 16000: + SpectrumWeighting_Init( sw16000Hz, isTCX20, pPsychParams ); + break; + case 25600: + SpectrumWeighting_Init( sw25600Hz, isTCX20, pPsychParams ); + break; + case 32000: + SpectrumWeighting_Init( sw32000Hz, isTCX20, pPsychParams ); + break; + default: + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Subband division not defined for this sampling rate" ); + } + } + + return IVAS_ERR_OK; +} /*-------------------------------------------------------------------* * InitPsychLPC() @@ -119,7 +189,8 @@ ivas_error PsychoacousticParameters_Init( * *-------------------------------------------------------------------*/ -void InitPsychLPC( +#ifdef IVAS_FLOAT_FIXED +void InitPsychLPC_fx( const Word32 sr_core, /* i : sampling rate of core-coder */ const Word16 L_frame, /* i : frame length */ const TCX_CONFIG_HANDLE hTcxCfg /* i : TCX configuration handle */ @@ -129,13 +200,32 @@ void InitPsychLPC( hTcxCfg->psychParamsCurrent = NULL; - PsychoacousticParameters_Init( sr_core, shr( L_frame, 1 ), 64, 0, 1, &hTcxCfg->psychParamsTCX10 ); + PsychoacousticParameters_Init_fx( sr_core, shr( L_frame, 1 ), 64, 0, 1, &hTcxCfg->psychParamsTCX10 ); + PsychoacousticParameters_Init_fx( sr_core, L_frame, 64, 1, 1, &hTcxCfg->psychParamsTCX20 ); + PsychoacousticParameters_Init_fx( sr_core, L_frame_ext, 64, 1, 0, &hTcxCfg->psychParamsTCX20AfterACELP ); + + return; +} +#endif + +void InitPsychLPC( + const int32_t sr_core, /* i : sampling rate of core-coder */ + const int16_t L_frame, /* i : frame length */ + const TCX_CONFIG_HANDLE hTcxCfg /* i : TCX configuration handle */ +) +{ + int16_t L_frame_ext = L_frame + L_frame / 4; + + hTcxCfg->psychParamsCurrent = NULL; + + PsychoacousticParameters_Init( sr_core, L_frame / 2, 64, 0, 1, &hTcxCfg->psychParamsTCX10 ); PsychoacousticParameters_Init( sr_core, L_frame, 64, 1, 1, &hTcxCfg->psychParamsTCX20 ); PsychoacousticParameters_Init( sr_core, L_frame_ext, 64, 1, 0, &hTcxCfg->psychParamsTCX20AfterACELP ); return; } + /*-------------------------------------------------------------------* * SetCurrentPsychParams() * diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index ed136930d..fd2d11522 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -538,7 +538,7 @@ void tdm_bit_alloc( { res_fix = L_negate( res_fix ); } - *total_brate_sec = max( *total_brate_sec, res_fix ); + *total_brate_sec = L_max( *total_brate_sec, res_fix ); move32(); tmp_bits = imult1616( negate( abs_s( sub( tdm_inst_ratio_idx, 16 ) ) ), imult1616( idx, 200 ) ); @@ -553,7 +553,7 @@ void tdm_bit_alloc( { res_fix = L_negate( res_fix ); } - *total_brate_sec = max( *total_brate_sec, res_fix ); + *total_brate_sec = L_max( *total_brate_sec, res_fix ); move32(); tmp_bits = imult1616( negate( abs_s( sub( tdm_inst_ratio_idx, 16 ) ) ), imult1616( 100, idx ) ); @@ -604,13 +604,13 @@ void tdm_bit_alloc( *total_brate_sec = L_add( *total_brate_sec, temp ); move32(); - *total_brate_sec = max( *total_brate_sec, tdm_bit_allc_tbl[idx][coder_type] ); + *total_brate_sec = L_max( *total_brate_sec, tdm_bit_allc_tbl[idx][coder_type] ); move32(); test(); IF( ( coder_type == INACTIVE ) && tdm_LRTD_flag == 0 ) { - *total_brate_sec = min( *total_brate_sec, MIN_BRATE_SWB_BWE ); + *total_brate_sec = L_min( *total_brate_sec, MIN_BRATE_SWB_BWE ); move32(); } @@ -634,35 +634,35 @@ void tdm_bit_alloc( IF( LE_32( element_brate_wo_meta, IVAS_13k2 ) ) { - *total_brate_sec = max( *total_brate_sec, add( 5600, delta_brate ) ); /* ~42-47 % of the total bitrate */ + *total_brate_sec = L_max( *total_brate_sec, add( 5600, delta_brate ) ); /* ~42-47 % of the total bitrate */ move32(); } ELSE IF( LE_32( element_brate_wo_meta, IVAS_16k4 ) ) { - *total_brate_sec = max( *total_brate_sec, add( 6500, delta_brate ) ); /* ~40-43 % of the total bitrate */ + *total_brate_sec = L_max( *total_brate_sec, add( 6500, delta_brate ) ); /* ~40-43 % of the total bitrate */ move32(); } ELSE IF( LE_32( element_brate_wo_meta, IVAS_24k4 ) ) { - *total_brate_sec = max( *total_brate_sec, add( 9000, delta_brate ) ); /* ~37-39 % of the total bitrate */ + *total_brate_sec = L_max( *total_brate_sec, add( 9000, delta_brate ) ); /* ~37-39 % of the total bitrate */ move32(); } ELSE { - *total_brate_sec = max( *total_brate_sec, add( 9600, delta_brate ) ); /* ~30-32% of the total bitrate */ + *total_brate_sec = L_max( *total_brate_sec, add( 9600, delta_brate ) ); /* ~30-32% of the total bitrate */ move32(); } } ELSE { - *total_brate_sec = min( *total_brate_sec, Mpy_32_32( 9663677, element_brate_wo_meta ) * 100 ); + *total_brate_sec = L_min( *total_brate_sec, Mpy_32_32( 9663677, element_brate_wo_meta ) * 100 ); move32(); } - *total_brate_sec = min( *total_brate_sec, 18000 ); + *total_brate_sec = L_min( *total_brate_sec, 18000 ); move32(); } - ELSE IF( coder_type == UNVOICED ) + ELSE IF( EQ_16( coder_type, UNVOICED ) ) { IF( tdm_lp_reuse_flag == 0 ) { @@ -671,9 +671,9 @@ void tdm_bit_alloc( } } - IF( coder_type <= UNVOICED ) + IF( LE_16( coder_type, UNVOICED ) ) { - *total_brate_sec = min( *total_brate_sec, MAX_TDM_UC_BRATE ); + *total_brate_sec = L_min( *total_brate_sec, MAX_TDM_UC_BRATE ); move32(); test(); @@ -757,29 +757,29 @@ void tdm_bit_alloc( { IF( GT_32( element_brate_wo_meta, IVAS_13k2 ) ) { - *total_brate_sec = min( *total_brate_sec, L_sub( element_brate_wo_meta, L_add( ACELP_8k00, BWE_brate ) ) ); + *total_brate_sec = L_min( *total_brate_sec, L_sub( element_brate_wo_meta, L_add( ACELP_8k00, BWE_brate ) ) ); move32(); } ELSE { - *total_brate_sec = min( *total_brate_sec, L_sub( element_brate_wo_meta, L_add( ACELP_7k20, BWE_brate ) ) ); + *total_brate_sec = L_min( *total_brate_sec, L_sub( element_brate_wo_meta, L_add( ACELP_7k20, BWE_brate ) ) ); move32(); } } ELSE { - *total_brate_sec = min( *total_brate_sec, L_sub( element_brate_wo_meta, L_add( 5900, BWE_brate ) ) ); + *total_brate_sec = L_min( *total_brate_sec, L_sub( element_brate_wo_meta, L_add( 5900, BWE_brate ) ) ); move32(); } IF( coder_type == INACTIVE ) { - *total_brate_sec = max( *total_brate_sec, tdm_bit_allc_tbl[0][0] ); /* sanity check to ensure the secondary channel always gets the minimal bitrate it needs */ + *total_brate_sec = L_max( *total_brate_sec, tdm_bit_allc_tbl[0][0] ); /* sanity check to ensure the secondary channel always gets the minimal bitrate it needs */ move32(); } ELSE { - *total_brate_sec = max( *total_brate_sec, 3500 ); /* sanity check to ensure the secondary channel always gets the minimal bitrate it needs */ + *total_brate_sec = L_max( *total_brate_sec, 3500 ); /* sanity check to ensure the secondary channel always gets the minimal bitrate it needs */ move32(); } @@ -796,26 +796,26 @@ void tdm_bit_alloc( /* Pitch is transmitted as well, further increase the bitrate */ IF( tdm_Pitch_reuse_flag == 0 ) { - *total_brate_sec = max( *total_brate_sec, MIN_FCB_SECRATE2 + MIN_SEC_ACB_RATE + MIN_SEC_LPC_RATE + MIN_SIGN_RATE ); + *total_brate_sec = L_max( *total_brate_sec, MIN_FCB_SECRATE2 + MIN_SEC_ACB_RATE + MIN_SEC_LPC_RATE + MIN_SIGN_RATE ); move32(); test(); IF( EQ_16( tdm_LRTD_flag, 1 ) && EQ_16( bwidth_sec, SWB ) ) { /* ensure that there are enough bits to code SWB TBE_1k10 as well */ - *total_brate_sec = max( *total_brate_sec, MIN_FCB_SECRATE2 + MIN_SEC_ACB_RATE + MIN_SEC_LPC_RATE + MIN_SIGN_RATE + SWB_TBE_1k10 ); + *total_brate_sec = L_max( *total_brate_sec, MIN_FCB_SECRATE2 + MIN_SEC_ACB_RATE + MIN_SEC_LPC_RATE + MIN_SIGN_RATE + SWB_TBE_1k10 ); move32(); } } ELSE /* only LPC is tranmitted -> IF ( *total_brate_sec < MIN_SEC_BRATE+MIN_SEC_LPC_RATE ) */ { - *total_brate_sec = max( *total_brate_sec, MIN_FCB_SECRATE2 + MIN_SEC_LPC_RATE + MIN_SIGN_RATE ); + *total_brate_sec = L_max( *total_brate_sec, MIN_FCB_SECRATE2 + MIN_SEC_LPC_RATE + MIN_SIGN_RATE ); move32(); } } ELSE IF( /*tdm_lp_reuse_flag == 1*/ tdm_Pitch_reuse_flag == 0 ) { - *total_brate_sec = max( *total_brate_sec, MIN_FCB_SECRATE2 + MIN_SEC_ACB_RATE + MIN_SIGN_RATE ); + *total_brate_sec = L_max( *total_brate_sec, MIN_FCB_SECRATE2 + MIN_SEC_ACB_RATE + MIN_SIGN_RATE ); move32(); } diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index 7f6c56bbf..d36b935cb 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -333,7 +333,7 @@ void mvr2r_inc_fixed( Word16 ix; Word16 iy; - IF( LE_16( n, 0 ) ) + IF( n <= 0 ) { /* cannot transfer vectors with size 0 */ return; @@ -798,7 +798,11 @@ 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] ); move16(); @@ -819,9 +823,14 @@ 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] ); + move32(); } return; @@ -941,15 +950,18 @@ void v_mult_mat_fixed( { pt_x = x; *pt_y = 0; + move32(); FOR( j = 0; j < Nr; j++ ) { *pt_y = L_add( *pt_y, L_shr( Mpy_32_32( ( *pt_x++ ), ( *pt_A++ ) ), guardbits ) ); + move32(); } pt_y++; } MVR2R_WORD32( tmp_y, y, Nc ); } + Word32 dot_product_cholesky_fx( const Word32 *x, /* i : vector x */ const Word32 *A, /* i : Cholesky matrix A */ @@ -1024,7 +1036,7 @@ void v_mult_mat_fx( { temp = Mpy_32_32( *pt_x_fx++, *pt_A_fx++ ); temp_q = sub( add( x_q_fx[j], A_q_fx[Nr * i + j] ), 31 ); - IF( EQ_16( j, 0 ) ) + IF( j == 0 ) { *pt_y_fx = temp; move32(); @@ -1218,6 +1230,7 @@ Word32 lin_interp32_fx( temp_div = L_deposit_h( BASOP_Util_Divide3232_Scale( temp32, L_sub( x2, x1 ), &temp_e ) ); // 31-temp_e + 2*Qin -31 - Qin = Qin-temp_e temp32 = BASOP_Util_Add_Mant32Exp( y1, sub( 31, *Q_io ), temp_div, sub( 31, sub( *Q_io, temp_e ) ), &exp_out ); // Qin-temp_e *Q_io = sub( 31, exp_out ); + move16(); return temp32; } @@ -1322,7 +1335,7 @@ Word32 check_bounds_l( { Word32 value_adj; - value_adj = min( max( value, low ), high ); + value_adj = L_min( L_max( value, low ), high ); return value_adj; } @@ -2714,6 +2727,7 @@ void lls_interp_n( return; } +#ifdef IVAS_FLOAT_FIXED void lls_interp_n_fx( Word16 x_fx[], /* i/o: input/output vector */ const Word16 N, /* i : length of the input vector */ @@ -2788,7 +2802,12 @@ 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] ); } @@ -2831,6 +2850,7 @@ void lls_interp_n_fx( return; } +#endif /* helper function for panning_wrap_angles */ @@ -3134,6 +3154,7 @@ int16_t is_IVAS_bitrate( return 1; } +#ifdef IVAS_FLOAT_FIXED Word16 is_IVAS_bitrate_fx( const Word32 ivas_total_brate /* i : IVAS total bitrate */ ) @@ -3157,6 +3178,7 @@ Word16 is_IVAS_bitrate_fx( return 1; } +#endif /*-------------------------------------------------------------------* * is_DTXrate() @@ -3302,7 +3324,7 @@ Word16 rand_triangular_signed_fx( return tmp2; } } -#endif + /*-------------------------------------------------------------------* * ceil_log_2() * @@ -3616,3 +3638,4 @@ Word64 var_32_fx( return var; } +#endif \ No newline at end of file diff --git a/lib_com/ivas_transient_det.c b/lib_com/ivas_transient_det.c index 86093edcd..55af71d0f 100644 --- a/lib_com/ivas_transient_det.c +++ b/lib_com/ivas_transient_det.c @@ -124,93 +124,28 @@ * Trans det init fucntion *-----------------------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static void ivas_transient_det_init( ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ - const int32_t sampling_rate /* i : sampling rate */ + const Word32 sampling_rate /* i : sampling rate */ ) { - int16_t i; -#ifndef IVAS_FLOAT_FIXED - float filt_coeff_arr[3][IVAS_BIQUAD_FILT_LEN << 1]; -#else + Word16 i; Word32 filt_coeff_arr_fx[3][IVAS_BIQUAD_FILT_LEN << 1]; const Word16 *filt_coeff_arr_e = NULL; -#endif -#ifdef IVAS_FLOAT_FIXED hTranDet->in_duck_gain = 1073741824; // Q30 move32(); hTranDet->out_duck_gain = 1073741824; // Q30 move32(); -#else - hTranDet->in_duck_gain = 1.0f; - hTranDet->out_duck_gain = 1.0f; -#endif FOR( i = 0; i < 3; i++ ) { -#ifndef IVAS_FLOAT_FIXED - set_zero( filt_coeff_arr[i], IVAS_BIQUAD_FILT_LEN << 1 ); -#else set32_fx( filt_coeff_arr_fx[i], 0, IVAS_BIQUAD_FILT_LEN << 1 ); -#endif } SWITCH( sampling_rate ) { -#ifndef IVAS_FLOAT_FIXED - case 48000: - /*env_hpf*/ - filt_coeff_arr[0][0] = IVAS_C_HPF_48k; - filt_coeff_arr[0][1] = -IVAS_C_HPF_48k; - filt_coeff_arr[0][3] = 1.0f; - filt_coeff_arr[0][4] = -IVAS_C_HPF_48k; - /*env_fast*/ - filt_coeff_arr[1][0] = 1.0f - IVAS_C_FAST_48k; - filt_coeff_arr[1][3] = 1.0f; - filt_coeff_arr[1][4] = -IVAS_C_FAST_48k; - /*env_slow*/ - filt_coeff_arr[2][0] = 1.0f - IVAS_C_SLOW_48k; - filt_coeff_arr[2][3] = 1.0f; - filt_coeff_arr[2][4] = -IVAS_C_SLOW_48k; - hTranDet->in_duck_coeff = IVAS_C_IN_DUCK_48k; - hTranDet->out_duck_coeff = IVAS_C_OUT_DUCK_48k; - break; - case 32000: - /*env_hpf*/ - filt_coeff_arr[0][0] = IVAS_C_HPF_32k; - filt_coeff_arr[0][1] = -IVAS_C_HPF_32k; - filt_coeff_arr[0][3] = 1.0f; - filt_coeff_arr[0][4] = -IVAS_C_HPF_32k; - /*env_fast*/ - filt_coeff_arr[1][0] = 1.0f - IVAS_C_FAST_32k; - filt_coeff_arr[1][3] = 1.0f; - filt_coeff_arr[1][4] = -IVAS_C_FAST_32k; - /*env_slow*/ - filt_coeff_arr[2][0] = 1.0f - IVAS_C_SLOW_32k; - filt_coeff_arr[2][3] = 1.0f; - filt_coeff_arr[2][4] = -IVAS_C_SLOW_32k; - hTranDet->in_duck_coeff = IVAS_C_IN_DUCK_32k; - hTranDet->out_duck_coeff = IVAS_C_OUT_DUCK_32k; - break; - case 16000: - /*env_hpf*/ - filt_coeff_arr[0][0] = IVAS_C_HPF_16k; - filt_coeff_arr[0][1] = -IVAS_C_HPF_16k; - filt_coeff_arr[0][3] = 1.0f; - filt_coeff_arr[0][4] = -IVAS_C_HPF_16k; - /*env_fast*/ - filt_coeff_arr[1][0] = 1.0f - IVAS_C_FAST_16k; - filt_coeff_arr[1][3] = 1.0f; - filt_coeff_arr[1][4] = -IVAS_C_FAST_16k; - /*env_slow*/ - filt_coeff_arr[2][0] = 1.0f - IVAS_C_SLOW_16k; - filt_coeff_arr[2][3] = 1.0f; - filt_coeff_arr[2][4] = -IVAS_C_SLOW_16k; - hTranDet->in_duck_coeff = IVAS_C_IN_DUCK_16k; - hTranDet->out_duck_coeff = IVAS_C_OUT_DUCK_16k; - break; -#else case 48000: /*env_hpf*/ filt_coeff_arr_fx[0][0] = IVAS_C_HPF_48k_fx; @@ -315,19 +250,93 @@ static void ivas_transient_det_init( BREAK; -#endif } -#ifndef IVAS_FLOAT_FIXED - ivas_filters_init( &hTranDet->env_hpf, (const float *) filt_coeff_arr[0], IVAS_FILTER_ORDER_1 ); - ivas_filters_init( &hTranDet->env_fast, (const float *) filt_coeff_arr[1], IVAS_FILTER_ORDER_1 ); - ivas_filters_init( &hTranDet->env_slow, (const float *) filt_coeff_arr[2], IVAS_FILTER_ORDER_1 ); -#else ivas_filters_init_fx( &hTranDet->env_hpf, (const Word32 *) filt_coeff_arr_fx[0], filt_coeff_arr_e, IVAS_FILTER_ORDER_1 ); ivas_filters_init_fx( &hTranDet->env_fast, (const Word32 *) filt_coeff_arr_fx[1], filt_coeff_arr_e, IVAS_FILTER_ORDER_1 ); ivas_filters_init_fx( &hTranDet->env_slow, (const Word32 *) filt_coeff_arr_fx[2], filt_coeff_arr_e, IVAS_FILTER_ORDER_1 ); -#endif + hTranDet->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC; + move32(); + + return; +} +#else +static void ivas_transient_det_init( + ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ + const int32_t sampling_rate /* i : sampling rate */ +) +{ + int16_t i; + float filt_coeff_arr[3][IVAS_BIQUAD_FILT_LEN << 1]; + + hTranDet->in_duck_gain = 1.0f; + hTranDet->out_duck_gain = 1.0f; + + FOR( i = 0; i < 3; i++ ) + { + set_zero( filt_coeff_arr[i], IVAS_BIQUAD_FILT_LEN << 1 ); + } + + SWITCH( sampling_rate ) + { + case 48000: + /*env_hpf*/ + filt_coeff_arr[0][0] = IVAS_C_HPF_48k; + filt_coeff_arr[0][1] = -IVAS_C_HPF_48k; + filt_coeff_arr[0][3] = 1.0f; + filt_coeff_arr[0][4] = -IVAS_C_HPF_48k; + /*env_fast*/ + filt_coeff_arr[1][0] = 1.0f - IVAS_C_FAST_48k; + filt_coeff_arr[1][3] = 1.0f; + filt_coeff_arr[1][4] = -IVAS_C_FAST_48k; + /*env_slow*/ + filt_coeff_arr[2][0] = 1.0f - IVAS_C_SLOW_48k; + filt_coeff_arr[2][3] = 1.0f; + filt_coeff_arr[2][4] = -IVAS_C_SLOW_48k; + hTranDet->in_duck_coeff = IVAS_C_IN_DUCK_48k; + hTranDet->out_duck_coeff = IVAS_C_OUT_DUCK_48k; + break; + case 32000: + /*env_hpf*/ + filt_coeff_arr[0][0] = IVAS_C_HPF_32k; + filt_coeff_arr[0][1] = -IVAS_C_HPF_32k; + filt_coeff_arr[0][3] = 1.0f; + filt_coeff_arr[0][4] = -IVAS_C_HPF_32k; + /*env_fast*/ + filt_coeff_arr[1][0] = 1.0f - IVAS_C_FAST_32k; + filt_coeff_arr[1][3] = 1.0f; + filt_coeff_arr[1][4] = -IVAS_C_FAST_32k; + /*env_slow*/ + filt_coeff_arr[2][0] = 1.0f - IVAS_C_SLOW_32k; + filt_coeff_arr[2][3] = 1.0f; + filt_coeff_arr[2][4] = -IVAS_C_SLOW_32k; + hTranDet->in_duck_coeff = IVAS_C_IN_DUCK_32k; + hTranDet->out_duck_coeff = IVAS_C_OUT_DUCK_32k; + break; + case 16000: + /*env_hpf*/ + filt_coeff_arr[0][0] = IVAS_C_HPF_16k; + filt_coeff_arr[0][1] = -IVAS_C_HPF_16k; + filt_coeff_arr[0][3] = 1.0f; + filt_coeff_arr[0][4] = -IVAS_C_HPF_16k; + /*env_fast*/ + filt_coeff_arr[1][0] = 1.0f - IVAS_C_FAST_16k; + filt_coeff_arr[1][3] = 1.0f; + filt_coeff_arr[1][4] = -IVAS_C_FAST_16k; + /*env_slow*/ + filt_coeff_arr[2][0] = 1.0f - IVAS_C_SLOW_16k; + filt_coeff_arr[2][3] = 1.0f; + filt_coeff_arr[2][4] = -IVAS_C_SLOW_16k; + hTranDet->in_duck_coeff = IVAS_C_IN_DUCK_16k; + hTranDet->out_duck_coeff = IVAS_C_OUT_DUCK_16k; + break; + + } + + ivas_filters_init( &hTranDet->env_hpf, (const float *) filt_coeff_arr[0], IVAS_FILTER_ORDER_1 ); + ivas_filters_init( &hTranDet->env_fast, (const float *) filt_coeff_arr[1], IVAS_FILTER_ORDER_1 ); + ivas_filters_init( &hTranDet->env_slow, (const float *) filt_coeff_arr[2], IVAS_FILTER_ORDER_1 ); hTranDet->duck_mult_fac = IVAS_TDET_DUCK_MULT_FAC; move32(); @@ -335,6 +344,7 @@ static void ivas_transient_det_init( return; } +#endif /*------------------------------------------------------------------------- * ivas_transient_det_open() diff --git a/lib_com/lag_wind.c b/lib_com/lag_wind.c index 9cd51345a..2d1ec48da 100644 --- a/lib_com/lag_wind.c +++ b/lib_com/lag_wind.c @@ -288,6 +288,7 @@ void lag_wind_32( } } + void adapt_lag_wind( Word16 r_h[], /* in/out: autocorrelations */ Word16 r_l[], /* in/out: autocorrelations */ diff --git a/lib_com/lerp.c b/lib_com/lerp.c index 80e789c4c..42c44ef12 100644 --- a/lib_com/lerp.c +++ b/lib_com/lerp.c @@ -381,7 +381,6 @@ static void lerp_proc( const Word16 *f, Word16 *f_out, Word16 bufferNewSize, Wor } -#ifdef IVAS_FLOAT_FIXED static void lerp_proc32( Word32 *f, Word32 *f_out, Word16 bufferNewSize, Word16 bufferOldSize ) { @@ -680,4 +679,3 @@ static void L_lerp_proc_fx( return; } -#endif diff --git a/lib_com/limit_t0_fx.c b/lib_com/limit_t0_fx.c index 6573a7925..9fc8ac789 100644 --- a/lib_com/limit_t0_fx.c +++ b/lib_com/limit_t0_fx.c @@ -22,7 +22,6 @@ * Close-loop pitch lag search limitation *-------------------------------------------------*/ - void limit_T0_fx( const Word16 L_frame, /* i : length of the frame */ const Word16 delta, /* i : Half the close-loop searched interval */ @@ -69,6 +68,7 @@ void limit_T0_fx( move16(); *T0_min = s_max( *T0_min, pit_min ); + move16(); *T0_max = add( *T0_min, delta2 ); move16(); diff --git a/lib_com/log2.h b/lib_com/log2.h index ade28f994..9dc2b01ab 100644 --- a/lib_com/log2.h +++ b/lib_com/log2.h @@ -15,7 +15,6 @@ */ #include "typedef.h" #include "log2.h" - /* ******************************************************************************** * DEFINITION OF DATA TYPES diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index e7bf74116..22d91e392 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -16,7 +16,6 @@ * * Fine gain prediction *--------------------------------------------------------------------------*/ - #ifdef IVAS_FLOAT_FIXED void ivas_fine_gain_pred_fx( const Word16 *sfm_start, /* i : Sub band start indices */ @@ -135,7 +134,6 @@ void ivas_fine_gain_pred_fx( return; } -#endif void fine_gain_pred_fx( const Word16 *sfm_start, /* i : Sub band start indices */ @@ -350,3 +348,4 @@ void fine_gain_dec_fx( return; } +#endif \ No newline at end of file diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index d4c01f46c..d550f0940 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -46,7 +46,6 @@ /*-----------------------------------------------------------------* * Local constants *-----------------------------------------------------------------*/ - #define MAX_LEN_LP 960 /* maximum length in samples of the LP analysis window */ /*-----------------------------------------------------------------* @@ -1447,4 +1446,4 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs, Word16 *lsf, const Word16 *o lsf[lpcOrder - 1] = shr( lsf[lpcOrder - 1], 1 ); move16(); } -} +} \ No newline at end of file diff --git a/lib_com/lsf_dec_bfi_fx.c b/lib_com/lsf_dec_bfi_fx.c index 14b842115..b41fa9de9 100644 --- a/lib_com/lsf_dec_bfi_fx.c +++ b/lib_com/lsf_dec_bfi_fx.c @@ -10,7 +10,6 @@ #include "cnst.h" #include "prot_fx.h" - /*---------------------------------------------------------------------* * routine: lsf_dec_bfi() * diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c index 5b6b612ca..a5e3f8669 100644 --- a/lib_com/lsf_tools_fx.c +++ b/lib_com/lsf_tools_fx.c @@ -39,7 +39,6 @@ #include "prot_fx.h" #include "ivas_error.h" - /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -3850,6 +3849,7 @@ void v_sort( return; } + #ifdef IVAS_MSVQ /*-------------------------------------------------------------------* diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 1e64cc13b..3f3210eb9 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -1153,7 +1153,6 @@ void interpolate_3_over_2_allpass_fx( * Interpolate 3/1 using allpass iir polyphase filter. Delay 4 samples @48k *-------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED void ivas_interpolate_3_over_1_allpass_fx( const Word16 *input_fx, /* i : input signal */ /* Q_input */ @@ -1247,7 +1246,6 @@ void ivas_interpolate_3_over_1_allpass_fx( } return; } -#endif void interpolate_3_over_1_allpass_fx( const Word16 *input_fx, @@ -1641,3 +1639,4 @@ void retro_interp5_4_fx( return; } + diff --git a/lib_com/nelp_fx.c b/lib_com/nelp_fx.c index 690db5865..a357b7455 100644 --- a/lib_com/nelp_fx.c +++ b/lib_com/nelp_fx.c @@ -35,7 +35,6 @@ #include "rom_com.h" #include "prot_fx.h" - /*===================================================================*/ /* FUNCTION : dequantize_uvg_fx() */ /*-------------------------------------------------------------------*/ diff --git a/lib_com/oper_32b.c b/lib_com/oper_32b.c index 30b97811b..0b01cf957 100644 --- a/lib_com/oper_32b.c +++ b/lib_com/oper_32b.c @@ -409,4 +409,5 @@ Word32 Div_32( Word32 L_num, Word16 denom_hi, Word16 denom_lo ) #endif return ( L_32 ); } + #undef WMC_TOOL_SKIP diff --git a/lib_com/oper_32b.h b/lib_com/oper_32b.h index a874bc10e..d68fb5d68 100644 --- a/lib_com/oper_32b.h +++ b/lib_com/oper_32b.h @@ -14,5 +14,4 @@ Word32 Mpy_32_16( Word16 hi, Word16 lo, Word16 n ); Word32 Mac_32_16( Word32 L_num, Word16 hi, Word16 lo, Word16 n ); Word32 Msu_32_16( Word32 L_num, Word16 hi, Word16 lo, Word16 n ); Word32 Div_32( Word32 L_num, Word16 denom_hi, Word16 denom_lo ); - #endif diff --git a/lib_com/options.h b/lib_com/options.h index 134412481..e87c8d257 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -109,6 +109,7 @@ #ifdef IVAS_FLOAT_FIXED #define MSAN_FIX #define FIX_818_COMPLEXITY_IMPROV /* Fix for issue 818 */ +#define FIX_805_VERIFICATION /* Fix for issue 805 */ #endif #define ISM_DISABLE #define FIX_TMP_714 diff --git a/lib_com/parameter_bitmaping_fx.c b/lib_com/parameter_bitmaping_fx.c index e66d7b603..cc33f8c51 100644 --- a/lib_com/parameter_bitmaping_fx.c +++ b/lib_com/parameter_bitmaping_fx.c @@ -57,7 +57,7 @@ void ReadFromBitstream_fx( param = ¶msBitMap->params[iParam]; test(); test(); - fShiftValue = s_and( (Word16) EQ_16( param->fZeroAllowed, 0 ), param->EncodeValue == NULL ); + fShiftValue = s_and( (Word16) param->fZeroAllowed == 0 , param->EncodeValue == NULL ); value = GetFromBitstream( st, param->DecodeValue, index, param->nBits, pStream ); IF( fShiftValue ) { @@ -65,7 +65,8 @@ void ReadFromBitstream_fx( value = add( value, 1 ); } - IF( ( param->pSubParamBitMap != NULL ) && GT_16( value, 0 ) ) + test(); + IF( ( param->pSubParamBitMap != NULL ) && value > 0 ) { ReadFromBitstream_fx( param->pSubParamBitMap, value, st, pStream, pnSize ); } diff --git a/lib_com/phase_dispersion_fx.c b/lib_com/phase_dispersion_fx.c index b7ca7b739..a695c57ba 100644 --- a/lib_com/phase_dispersion_fx.c +++ b/lib_com/phase_dispersion_fx.c @@ -63,7 +63,7 @@ void phase_dispersion( IF( GT_32( gain_code, L_add( *prev_gain_code, L_shl( *prev_gain_code, 1 ) ) ) ) #endif { - if ( LT_16( state, 2 ) ) + IF ( LT_16( state, 2 ) ) { state = add( state, 1 ); } @@ -74,7 +74,7 @@ void phase_dispersion( FOR( i = 0; i < 6; i++ ) { - if ( LT_32( prev_gain_pit[i], 9830 /*0.6f Q14*/ ) ) + IF ( LT_32( prev_gain_pit[i], 9830 /*0.6f Q14*/ ) ) { j = add( j, 1 ); } @@ -86,7 +86,7 @@ void phase_dispersion( state = 0; } - if ( GT_16( sub( state, *prev_state ), 1 ) ) + IF ( GT_16( sub( state, *prev_state ), 1 ) ) { state = sub( state, 1 ); } @@ -176,6 +176,7 @@ void phase_dispersion( { #ifdef BASOP_NOGLOB code[i] = round_fx_o( L_shl_o( x32[i], scale2, &Overflow ), &Overflow ); + move16(); #else code[i] = round_fx( L_shl( x32[i], scale2 ) ); #endif diff --git a/lib_com/prot.h b/lib_com/prot.h index 13b0042da..66bb6a966 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -1150,6 +1150,7 @@ void residu( const int16_t l /* i : size of filtering */ ); +#ifdef IVAS_FLOAT_FIXED void residu_ivas_fx( const Word16 *a, /* i : LP filter coefficients */ const Word16 a_exp, @@ -1158,6 +1159,7 @@ void residu_ivas_fx( Word32 *y, /* o : output signal (usually residual) */ const Word16 l /* i : size of filtering */ ); +#endif void calc_residu( const float *speech, /* i : weighted speech signal */ @@ -2906,6 +2908,7 @@ void swb_bwe_dec_hr( const float pitch_buf[] /* i : pitch buffer */ ); +#ifndef IVAS_FLOAT_FIXED void swb_hr_noise_fill( const int16_t is_transient, /* i : transient flag */ const int16_t spect_start, /* i : spectrum start point */ @@ -2917,13 +2920,16 @@ void swb_hr_noise_fill( int16_t *bwe_highrate_seed, /* i/o: seed of random noise */ float *t_audio /* i/o: mdct spectrum */ ); +#endif +#ifndef IVAS_FLOAT_FIXED /*! r: gain */ float td_postprocess( float hb_synth[], /* i/o: high-band synthesis */ const int16_t input_frame, /* i : frame length */ const int16_t last_extl /* i : last extension layer */ ); +#endif void calc_normal_length( const int16_t core, /* i : core */ @@ -4842,6 +4848,7 @@ void pit16k_Q_dec_flt( int16_t *BER_detect /* o : BER detect flag */ ); +#ifndef IVAS_FLOAT_FIXED void lp_filt_exc_dec( Decoder_State *st, /* i/o: decoder state structure */ const int16_t codec_mode, /* i : codec mode */ @@ -4851,6 +4858,7 @@ void lp_filt_exc_dec( int16_t lp_flag, /* i : operation mode signaling */ float *exc /* i/o: pointer to the excitation signal frame */ ); +#endif void inov_decode( Decoder_State *st, /* i/o: decoder state structure */ @@ -5130,6 +5138,7 @@ void AVQ_demuxdec( int16_t trgtSvPos /* i : target SV for AVQ bit savings */ ); +#ifndef IVAS_FLOAT_FIXED void re8_dec( int16_t nq, /* i : codebook number (*n is an integer defined in {0,2,3,4,..,n_max}) */ const uint16_t I, /* i : index of c (pointer to unsigned 16-bit word) */ @@ -5142,6 +5151,7 @@ void re8_decode_base_index( uint16_t I, /* i : index of c (pointer to unsigned 16-bit word) */ int16_t *x /* o : point in RE8 (8-dimensional integer vector) */ ); +#endif void Init_post_filter_ivas( PFSTAT_HANDLE hPFstat /* i : post-filter state memories */ @@ -6810,10 +6820,12 @@ void hp20_flt( Float32 mem[], const Word32 Fs ); +#ifndef IVAS_FLOAT_FIXED void ham_cos_window_flt( float *fh, const int16_t n1, const int16_t n2 ); +#endif /*! r: noise dependent voicing correction */ float correlation_shift( @@ -6862,7 +6874,6 @@ void getTCXWindowing_ivas( TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX configuration handle */ Decoder_State *st0 /* i : bitstream */ ); -//#endif void getLPCparam_ivas( Decoder_State *st, /* i/o: decoder memory state */ @@ -9012,43 +9023,22 @@ void ReadFromBitstream( int16_t **pStream, int16_t *pnSize ); -// void const *GetTnsFilterOrder_flt( void const *p, const int16_t index, int16_t *pValue ); -// void *SetTnsFilterOrder_flt( void *p, const int16_t index, const int16_t value ); void const *GetNumOfTnsFilters_flt( void const *p, const int16_t index, int16_t *pValue ); void *SetNumOfTnsFilters_flt( void *p, const int16_t index, const int16_t value ); -// void const *GetTnsEnabled_flt( void const *p, const int16_t index, int16_t *pValue ); -// void *SetTnsEnabled_flt( void *p, const int16_t index, const int16_t value ); -// void const *GetTnsEnabledSingleFilter_flt( void const *p, const int16_t index, int16_t *pValue ); -// void *SetTnsEnabledSingleFilter_flt( void *p, const int16_t index, const int16_t value ); -// void const *GetTnsFilterCoeff_flt( void const *p, const int16_t index, int16_t *pValue ); -// void *SetTnsFilterCoeff_flt( void *p, const int16_t index, const int16_t value ); - void const *GetTnsOnWhite( void const *p, const int16_t index, int16_t *pValue ); void *SetTnsOnWhite( void *p, const int16_t index, const int16_t value ); -// int16_t GetSWBTCX10TnsFilterCoeffBits_flt( const int16_t value, const int16_t index ); -// int16_t EncodeSWBTCX10TnsFilterCoeff_flt( const int16_t value, const int16_t index ); int16_t DecodeSWBTCX10TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); -// int16_t GetSWBTCX20TnsFilterCoeffBits_flt( const int16_t value, const int16_t index ); -// int16_t EncodeSWBTCX20TnsFilterCoeff_flt( const int16_t value, const int16_t index ); int16_t DecodeSWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); -// int16_t GetWBTCX20TnsFilterCoeffBits_flt( const int16_t value, const int16_t index ); -// int16_t EncodeWBTCX20TnsFilterCoeff_flt( const int16_t, const int16_t index ); int16_t DecodeWBTCX20TnsFilterCoeff_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); -// int16_t GetTnsFilterOrderBitsSWBTCX10_flt( const int16_t value, const int16_t index ); -// int16_t EncodeTnsFilterOrderSWBTCX10_flt( const int16_t value, const int16_t index ); int16_t DecodeTnsFilterOrderSWBTCX10_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); -// int16_t GetTnsFilterOrderBitsSWBTCX20_flt( const int16_t value, const int16_t index ); -// int16_t EncodeTnsFilterOrderSWBTCX20_flt( const int16_t value, const int16_t index ); int16_t DecodeTnsFilterOrderSWBTCX20_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); int16_t EncodeTnsFilterOrderSWBTCX10_flt( const int16_t value, const int16_t index ); int16_t GetTnsFilterOrderBitsSWBTCX10_flt( const int16_t value, const int16_t index ); -// int16_t GetTnsFilterOrderBits_flt( const int16_t value, const int16_t index ); -// int16_t EncodeTnsFilterOrder_flt( const int16_t value, const int16_t index ); int16_t DecodeTnsFilterOrder_flt( Decoder_State *st, const int16_t index, int16_t *pValue ); void ResetTnsData_flt( diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index b59be8072..bbad9c4dc 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -1106,11 +1106,6 @@ UWord16 get_next_indice_1_fx( /* o : value of the indice * Decoder_State *st_fx /* i/o: decoder state structure */ ); -// UWord16 get_next_indice( /* o : value of the indice */ -// Decoder_State *st_fx, /* i/o: decoder state structure */ -// Word16 nb_bits /* i : number of bits that were used to quantize the indice */ -//); - UWord16 get_next_indice_1( /* o : value of the indice */ Decoder_State *st_fx /* i/o: decoder state structure */ ); @@ -1513,7 +1508,6 @@ void interleave_spectrum_fx( Word32 *coefs, /* i/o: i and output coefficients Q? */ const Word16 length /* i : length of spectrum Q0 */ ); - // findpulse.c Word16 findpulse_fx( /* o : pulse position */ @@ -1929,7 +1923,6 @@ void FindNBiggest2_simple_fx_har( Word16 get_usebit_npswb_fx( Word16 hqswb_clas_fx ); - /*========================================================================================================/ isf_dec_amr_wb_fx.c /========================================================================================================*/ @@ -2073,7 +2066,6 @@ void deemph_lpc_fx( /*========================================================================================================/ hq2_core_com_fx.c /========================================================================================================*/ - void mdct_spectrum_denorm_fx( const Word16 inp_vector[], /* i : Q0 : */ Word32 L_y2[], /* i/o : Qs : decoded spectrum */ @@ -2163,7 +2155,6 @@ void bit_allocation_second_fx( const Word16 p2a_bands, const Word16 *last_bitalloc, const Word16 input_frame ); - // synth_filt_fix.c Word32 syn_kern_16( @@ -2224,7 +2215,6 @@ void L_lerp_fx_q11( Word32 *f, Word32 *f_out, Word16 bufferNewSize, Word16 buffe void L_lerp_fx( Word32 *f, Word32 *f_out, Word16 bufferNewSize, Word16 bufferOldSize, Word16 *q ); // index_pvq_opt.c - PvqEntry mpvq_encode_vec_fx( /* o : leading_sign_index, index, size, k_val */ const Word16 *vec_in, /* i : signed pulse train */ Word16 dim_in, /* i : dimension */ @@ -2240,7 +2230,6 @@ void mpvq_decode_vec_fx( /* o : void UWord32 *h_mem, /* i : A/U offsets */ Word16 *vec_out /* o : pulse train */ ); - // weight_a_fx.c void weight_a_subfr_fx( const Word16 nb_subfr, /* i : number of subframes */ @@ -2296,7 +2285,6 @@ void calc_residu_fx( Word16 *res, /* o : residual signal */ const Word16 *p_Aq /* i : quantized LP filter coefficients */ ); - // inerpol_lc.c Word32 Interpol_lc_fx( /* o : interpolated value Qx+16 */ const Word16 *x, /* i : input vector Q0 */ @@ -2306,7 +2294,6 @@ Word32 Interpol_lc_fx( /* o : interpolated value const Word16 nb_coef /* i : number of coefficients Q0 */ ); - // modif_fs_fx.c Word16 modify_Fs_fx( /* o : length of output Q0 */ const Word16 sigIn_fx[], /* i : signal to decimate Q0 */ @@ -5081,6 +5068,7 @@ void fill_spectrum_fx( Word16 *prev_env_Q, const Word16 num_env_bands, const Word16 element_mode ); + // hq_bit_allocation_fx.c" void hq_bit_allocation_fx( const Word32 core_brate, /* i : Core bit-rate */ @@ -5366,7 +5354,7 @@ Word16 IGFCommonFuncsIGFConfiguration( H_IGF_INFO hIGFInfo, /* o : IGF info handle */ const Word16 rf_mode /* i : flag to signal the RF mode */ ); -#ifdef IVAS_FLOAT_FIXED + Word16 IGFCommonFuncsIGFConfiguration_ivas_fx( const Word32 total_brate, /* i : bitrate in bs e.g. 9600 for 9.6kbs */ const Word16 bwidth, /* i : audio bandwidth */ @@ -5374,7 +5362,7 @@ Word16 IGFCommonFuncsIGFConfiguration_ivas_fx( H_IGF_INFO hIGFInfo, /* o : IGF info handle */ const Word16 rf_mode /* i : flag to signal the RF mode */ ); -#endif // IVAS_FOAT_FIXED + Word16 IGFCommonFuncsIGFGetCFTables( const Word32 total_brate, /* i : bitrate in bs e.g. 9600 for 9.6kbs */ const Word16 bwidth, /* i : audio bandwidth */ @@ -5438,7 +5426,6 @@ Word32 calc_gain_inov( /* returns innovation gain Word32 *dotp, /* o : intermediate result Q31-e */ Word16 *dotp_e /* o : intermediate result exponent Q0 */ ); - /////////////////////////////////// /* Lib_dec */ ////////////////////////////////// @@ -5868,11 +5855,11 @@ void RefineTonalComponents( ); ivas_error PsychoacousticParameters_Init( - const Word32 sr_core, /* i : sampling rate of core-coder */ - const Word16 nBins, /* i : Number of bins (spectral lines) */ - const Word8 nBands, /* i : Number of spectrum subbands */ - const Word16 isTCX20, /* i : Flag indicating if the subband division is for TCX20 or TCX10 */ - const Word16 isWarped, /* i : Flag indicating if the scale is linear or warped */ + const int32_t sr_core, /* i : sampling rate of core-coder */ + const int16_t nBins, /* i : Number of bins (spectral lines) */ + const int8_t nBands, /* i : Number of spectrum subbands */ + const int16_t isTCX20, /* i : Flag indicating if the subband division is for TCX20 or TCX10 */ + const int16_t isWarped, /* i : Flag indicating if the scale is linear or warped */ PsychoacousticParameters *pPsychParams ); // TonalIMDCTconcealment_fx.c @@ -6505,6 +6492,7 @@ void AVQ_dec_lpc( Word16 Nsv ); /* i : number of subvectors (lg=Nsv*8) */ +#ifdef IVAS_FLOAT_FIXED // re8_dec_fx.c void re8_dec_fx( Word16 n, /* i : codebook number (*n is an integer defined in {0,2,3,4,..,n_max}) */ @@ -6514,8 +6502,8 @@ void re8_dec_fx( ); // lead_deindexing_fx.c - void re8_decode_base_index_fx( const Word16 n, UWord16 I, Word16 *x ); +#endif // re8_utils_fx.c void re8_k2y_fx( @@ -6577,8 +6565,8 @@ void dec_pit_exc_ivas_fx( #endif ); +#ifdef IVAS_FLOAT_FIXED // pit_dec_fx.c - Word32 Mode2_pit_decode( /* o: floating pitch value */ const Word16 coder_type, /* i: coding model */ Word16 i_subfr, /* i: subframe index */ @@ -6699,6 +6687,7 @@ void delta_pit_dec_fx( Word16 *T0_frac, /* o : pitch fraction */ const Word16 T0_min /* i : delta search min */ ); +#endif // limit_t0_fx.c void limit_T0_fx( @@ -6896,6 +6885,7 @@ void decode_energies_fx( Word16 dim, const Word16 strict_bits ); +#ifdef IVAS_FLOAT_FIXED // range_drc_fx.c void rc_dec_init_fx( Decoder_State *st_fx, /* i/o: Decoder State */ @@ -6908,7 +6898,6 @@ UWord32 rc_decode_fx( /* o : Decoded cumulative frequency PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ UWord32 tot /* i : Total cumulative frequency */ ); - void rc_dec_update_fx( Decoder_State *st_fx, /* i/o: Decoder State */ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */ @@ -6934,6 +6923,7 @@ void rc_dec_finish_fx( Decoder_State *st_fx, PVQ_DEC_HANDLE hPVQ /* i/o: PVQ decoder handle */ ); +#endif // pvq_decode_fx.c void pvq_decode_fx( @@ -6946,6 +6936,7 @@ void pvq_decode_fx( const Word16 neg_gain /* i: Gain (negated to fit 1.0 in Q15 as -1.0) */ ); +#ifdef IVAS_FLOAT_FIXED // nelp_dec_fx.c void nelp_decoder_fx( Decoder_State *st, /* i/o: decoder static memory */ @@ -6957,6 +6948,7 @@ void nelp_decoder_fx( , Word16 *gain_buf /*Q14*/ ); +#endif // dec_nelp_fx.c void decod_nelp_fx( @@ -6974,6 +6966,7 @@ void decod_nelp_fx( ); // lp_filt_exc_dec_fx +#ifdef IVAS_FLOAT_FIXED void lp_filt_exc_dec_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ const Word16 codec_mode, /* i : coder mode */ @@ -6991,6 +6984,7 @@ void FEC_lsf2lsp_interp( Word16 *lsf, /* o : estimated LSF vector */ Word16 *lsp /* o : estimated LSP vector */ ); +#endif // fd_cng_dec_fx.c @@ -7274,6 +7268,7 @@ void dequantize_norms_fx( Word16 *normqlg2 /* o : Log2 of decoded norms */ ); +#ifdef IVAS_FLOAT_FIXED // hdecnrm_fx.c void hdecnrm_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ @@ -7314,6 +7309,7 @@ void hdecnrm_tran_fx( const Word16 N, /* i : number of norms */ Word16 *index /* o : indices of quantized norms */ ); +#endif // tcq_core_dec_fx.c void tcq_core_LR_dec_fx( @@ -7402,6 +7398,7 @@ Word16 hq_classifier_dec_fx( /* o : Consumed bits ); // peak_vq_dec_fx.c +#ifdef IVAS_FLOAT_FIXED void hvq_dec_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ const Word16 num_bits, /* i : Number of available bits */ @@ -7413,6 +7410,7 @@ void hvq_dec_fx( Word16 *Npeaks, /* o : Total number of peaks */ Word32 *coefsq_norm, /* o : Output vector in Q12 */ const Word16 core ); +#endif // hvq_pvq_bitalloc_fx.c Word16 hvq_pvq_bitalloc_fx( @@ -7669,6 +7667,7 @@ void FEC_scale_syn_fx( const Word16 force_scaling /* i: force scaling */ ); +#ifdef IVAS_FLOAT_FIXED // LD_music_post_filter_fx.c void LD_music_post_filter_fx( MUSIC_POSTFILT_HANDLE hMusicPF, /* i/o: LD music postfilter handle */ @@ -7745,7 +7744,6 @@ void improv_amr_wb_gs_fx( #endif ); -#ifdef IVAS_FLOAT_FIXED // dec_amr_wb_fx.c void decod_amr_wb_fx( Decoder_State *st_fx, /* i/o: decoder static memory */ @@ -7780,6 +7778,7 @@ void sc_vbr_dec_init( ); // ppp_dec_fx.c +#ifdef IVAS_FLOAT_FIXED ivas_error ppp_quarter_decoder_fx( DTFS_STRUCTURE *CURRCW_Q_DTFS_FX, /* i/o: Current CW DTFS */ Word16 prevCW_lag_fx, /* i : Previous lag */ @@ -7791,6 +7790,7 @@ ivas_error ppp_quarter_decoder_fx( Word16 *C_fx, /* i : cosine table, Q15 */ DTFS_STRUCTURE PREV_CW_D_FX, /* i : Previous DTFS */ Decoder_State *st_fx ); +#endif // core_dec_init_fx.c void open_decoder_LPD_fx( @@ -9967,26 +9967,26 @@ Word16 swb_bwe_dec_fx32( ivas_error acelp_core_dec_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ - Word16 output[], /* o : synthesis @internal Fs */ - Word16 synth[], /* o : synthesis */ - Word16 save_hb_synth[], /* o : HB synthesis */ - Word32 bwe_exc_extended[], /* i/o: bandwidth extended excitation */ - Word16 *voice_factors, /* o : voicing factors */ - Word16 old_syn_12k8_16k[], /* o : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE */ - const int16_t sharpFlag, /* i : formant sharpening flag */ - Word16 pitch_buf[NB_SUBFR16k], /* o : floating pitch for each subframe */ - int16_t *unbits, /* o : number of unused bits */ - int16_t *sid_bw, /* o : 0-NB/WB, 1-SWB SID */ + Word16 output_fx[], /* o : synthesis @internal Fs */ + Word16 synth_fx16[], /* o : synthesis */ + Word16 save_hb_synth_fx16[], /* o : HB synthesis */ + Word32 bwe_exc_extended_fx[], /* i/o: bandwidth extended excitation */ + Word16 *voice_factors_fx, /* o : voicing factors */ + Word16 old_syn_12k8_16k_fx[], /* o : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE */ + const Word16 sharpFlag, /* i : formant sharpening flag */ + Word16 pitch_buf_fx[NB_SUBFR16k], /* o : floating pitch for each subframe */ + Word16 *unbits, /* o : number of unused bits */ + Word16 *sid_bw, /* o : 0-NB/WB, 1-SWB SID */ STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ - const Word16 tdm_lspQ_PCh[M], /* i : Q LSPs for primary channel */ - const Word16 tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel */ - const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ - const int16_t last_element_mode, /* i : last element mode */ - const int32_t last_element_brate, /* i : last element bitrate */ - const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ - const int16_t nchan_out, /* i : number of output channels */ + const Word16 tdm_lspQ_PCh_fx[M], /* i : Q LSPs for primary channel */ + const Word16 tdm_lsfQ_PCh_fx[M], /* i : Q LSFs for primary channel */ + const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ + const Word16 last_element_mode, /* i : last element mode */ + const Word32 last_element_brate, /* i : last element bitrate */ + const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */ + const Word16 nchan_out, /* i : number of output channels */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ - const int16_t read_sid_info /* i : read SID info flag */ + const Word16 read_sid_info /* i : read SID info flag */ ); void destroy_cldfb_decoder_ivas_fx( diff --git a/lib_com/pvq_com.c b/lib_com/pvq_com.c index cf8859c3c..ade4b4616 100644 --- a/lib_com/pvq_com.c +++ b/lib_com/pvq_com.c @@ -433,7 +433,7 @@ void densityAngle2RmsProjDec( int32_t L_2xPhiQ14q; int16_t oppTail, nearTail; - phiQ14q = (int16_t) intLimCDivPos( labs( indexphi ) << 13, D >> 1 ); + phiQ14q = (int16_t) intLimCDivPos( abs( indexphi ) << 13, D >> 1 ); if ( ( 0xFFFe & D ) == 0 ) /* even -> positive, odd -> 0 */ { phiQ14q = 1 << 13; /* one op */ diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 23c42119b..8a0a25dd4 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -142,14 +142,14 @@ void dsDiracPerQuanta_fx( move16(); t_quanta_o = sub( t_quanta, QUANTAQ3OFFSET ); - if ( GE_16( t_quanta_o, sv[nsv] ) ) + IF ( GE_16( t_quanta_o, sv[nsv] ) ) { *DsIdx = nsv; move16(); return; } - if ( LE_16( t_quanta_o, sv[1] ) ) + IF ( LE_16( t_quanta_o, sv[1] ) ) { *DsIdx = 1; move16(); diff --git a/lib_com/range_com_fx.c b/lib_com/range_com_fx.c index 22a7fb8ea..3eebfa3c9 100644 --- a/lib_com/range_com_fx.c +++ b/lib_com/range_com_fx.c @@ -7,7 +7,6 @@ #include "cnst.h" /* Common constants */ #include "prot_fx.h" /* Function prototypes */ - /*-------------------------------------------------------------------* * rc_get_bits2() * diff --git a/lib_com/re8_util_fx.c b/lib_com/re8_util_fx.c index 00909e2f5..686343aea 100644 --- a/lib_com/re8_util_fx.c +++ b/lib_com/re8_util_fx.c @@ -388,3 +388,4 @@ static void re8_coord_fx( return; } + diff --git a/lib_com/residu.c b/lib_com/residu.c index 2a3ad964d..e05210598 100644 --- a/lib_com/residu.c +++ b/lib_com/residu.c @@ -77,6 +77,7 @@ void residu( * Compute the LP residual by filtering the input speech through A(z) *--------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void residu_ivas_fx( const Word16 *a, /* i : LP filter coefficients */ const Word16 a_exp, @@ -103,6 +104,8 @@ void residu_ivas_fx( return; } +#endif + /*--------------------------------------------------------------------* * calc_residu() * diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index e06ef40ea..4ac900e8a 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -212,3 +212,4 @@ void calc_residu_fx( } return; } + diff --git a/lib_com/rom_basic_math.c b/lib_com/rom_basic_math.c index ceb89163f..07535d524 100644 --- a/lib_com/rom_basic_math.c +++ b/lib_com/rom_basic_math.c @@ -1,7 +1,6 @@ #include "options.h" /* Compilation switches */ #include "cnst.h" /* Decoder static structure */ #include "stl.h" - /* math_op.c */ const Word32 L_table_isqrt[48] = { 2147418112L, 2083389440L, 2024669184L, 1970667520L, diff --git a/lib_com/rom_basic_math.h b/lib_com/rom_basic_math.h index 0cf6d6dd3..93f9a825c 100644 --- a/lib_com/rom_basic_math.h +++ b/lib_com/rom_basic_math.h @@ -2,7 +2,6 @@ #include "cnst.h" /* Decoder static structure */ #include "stl.h" - /* math_op.c */ extern const Word32 L_table_isqrt[48]; diff --git a/lib_com/rom_basop_util.c b/lib_com/rom_basop_util.c index 9c5fd7552..350543b8c 100644 --- a/lib_com/rom_basop_util.c +++ b/lib_com/rom_basop_util.c @@ -36,7 +36,6 @@ #include #include "options.h" - #define STC( x ) WORD322WORD16( x ) #define STCP( a, b ) \ diff --git a/lib_com/rom_basop_util.h b/lib_com/rom_basop_util.h index e32ce0cc7..3e25469d0 100644 --- a/lib_com/rom_basop_util.h +++ b/lib_com/rom_basop_util.h @@ -40,7 +40,6 @@ #include "typedef.h" #include "basop_util.h" - extern const PWord16 SineTable512[257]; extern const PWord16 SineTable320[161]; @@ -51,4 +50,4 @@ extern const PWord16 SineTable320[161]; void BASOP_getTables( const PWord16 **ptwiddle, const PWord16 **sin_twiddle, Word16 *sin_step, Word16 length ); const PWord16 *getSineWindowTable( Word16 length ); -#endif +#endif \ No newline at end of file diff --git a/lib_com/rom_com_fx.c b/lib_com/rom_com_fx.c index d9c3822d7..2497e496f 100644 --- a/lib_com/rom_com_fx.c +++ b/lib_com/rom_com_fx.c @@ -6178,22 +6178,3 @@ const Word16 sin_twiddle_table_16_8_2[16] = { SHC( 0x0000 ), SHC( 0xcf05 ), }; - -#if 0 -#define Flt2Word16( a ) SHC( (Word16) ( a * 32768.0 ) ) - - -const Word16 w_edct2_64_fx[80] = -{ - SHC(0x7FFF), Flt2Word16(0.00000000f), Flt2Word16(0.70710678f), Flt2Word16(0.70710678f), Flt2Word16(0.92387953f), Flt2Word16(0.38268343f), Flt2Word16(0.38268343f), Flt2Word16(0.92387953f), - Flt2Word16(0.98078528f), Flt2Word16(0.19509032f), Flt2Word16(0.55557023f), Flt2Word16(0.83146961f), Flt2Word16(0.83146961f), Flt2Word16(0.55557023f), Flt2Word16(0.19509032f), Flt2Word16(0.98078528f), - Flt2Word16(0.70710678f), Flt2Word16(0.49984940f), Flt2Word16(0.49939772f), Flt2Word16(0.49864522f), Flt2Word16(0.49759236f), Flt2Word16(0.49623976f), Flt2Word16(0.49458825f), Flt2Word16(0.49263882f), - Flt2Word16(0.49039264f), Flt2Word16(0.48785106f), Flt2Word16(0.48501562f), Flt2Word16(0.48188803f), Flt2Word16(0.47847016f), Flt2Word16(0.47476409f), Flt2Word16(0.47077203f), Flt2Word16(0.46649639f), - Flt2Word16(0.46193976f), Flt2Word16(0.45710487f), Flt2Word16(0.45199464f), Flt2Word16(0.44661215f), Flt2Word16(0.44096063f), Flt2Word16(0.43504349f), Flt2Word16(0.42886430f), Flt2Word16(0.42242678f), - Flt2Word16(0.41573480f), Flt2Word16(0.40879240f), Flt2Word16(0.40160376f), Flt2Word16(0.39417321f), Flt2Word16(0.38650522f), Flt2Word16(0.37860442f), Flt2Word16(0.37047556f), Flt2Word16(0.36212354f), - Flt2Word16(0.35355339f), Flt2Word16(0.34477027f), Flt2Word16(0.33577947f), Flt2Word16(0.32658642f), Flt2Word16(0.31719664f), Flt2Word16(0.30761579f), Flt2Word16(0.29784965f), Flt2Word16(0.28790409f), - Flt2Word16(0.27778511f), Flt2Word16(0.26749880f), Flt2Word16(0.25705137f), Flt2Word16(0.24644909f), Flt2Word16(0.23569836f), Flt2Word16(0.22480566f), Flt2Word16(0.21377754f), Flt2Word16(0.20262065f), - Flt2Word16(0.19134171f), Flt2Word16(0.17994751f), Flt2Word16(0.16844492f), Flt2Word16(0.15684087f), Flt2Word16(0.14514233f), Flt2Word16(0.13335637f), Flt2Word16(0.12149008f), Flt2Word16(0.10955062f), - Flt2Word16(0.09754516f), Flt2Word16(0.08548094f), Flt2Word16(0.07336523f), Flt2Word16(0.06120533f), Flt2Word16(0.04900857f), Flt2Word16(0.03678228f), Flt2Word16(0.02453383f), Flt2Word16(0.01227061f) -}; -#endif diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index 879e76e07..ac75dc55d 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -363,7 +363,7 @@ Word16 WB_BWE_gain_pred_fx( move16(); } - IF( env_var_flag == 1 ) + IF( EQ_16( env_var_flag, 1 ) ) { WB_fenv[1] = add( WB_fenv[0], mult_r( WB_fenv[0], 16384 ) ); move16(); @@ -421,6 +421,7 @@ static void calc_norm_envelop_lf_fx( IF( LT_16( add( shl( sub( 328, *efreq ), 1 ), 1 ), *L_swb_norm ) ) { *L_swb_norm = add( shl( sub( 328, *efreq ), 1 ), 1 ); + move16(); } } ELSE @@ -1912,7 +1913,7 @@ IF( EQ_16( mode, HARMONIC ) ) pit1 -= 16; FOR( n_freq = 0; n_freq < 16; n_freq++ ) { - if ( LT_16( abs_s( *pit1 ), mean ) ) + IF ( LT_16( abs_s( *pit1 ), mean ) ) { *pit1 = mult_r( *pit1, 6554 ); /*Q15*/ move16(); @@ -2200,7 +2201,7 @@ void time_envelop_shaping_fx( } ELSE { - pit -= L / 4; + pit -= shr( L, 2 ); move16(); tmp_ener = 0; move16(); @@ -2315,7 +2316,7 @@ void time_reduce_pre_echo_fx( IF( pos > 0 ) { - if ( LT_16( pos, 3 ) ) + IF ( LT_16( pos, 3 ) ) { pos = add( pos, 1 ); } @@ -2506,13 +2507,13 @@ void calc_normal_length_fx_32( L_tmp1 = Mult_32_16( peak, shl( add( 15, THRES ), 10 ) ); L_tmp2 = Mult_32_16( mean, shl( THRES, 10 ) ); test(); - if ( GT_32( L_tmp1, L_tmp2 ) && GT_32( peak, 40960 ) ) + IF ( GT_32( L_tmp1, L_tmp2 ) && GT_32( peak, 40960 ) ) { n_band = add( n_band, 1 ); } } - IF( core == ACELP_CORE ) + IF( core == ACELP_CORE ) { L_swb_norm_trans = add( 4, shr( n_band, 2 ) ); L_swb_norm_norm = add( 8, shr( n_band, 1 ) ); @@ -2596,7 +2597,7 @@ void calc_norm_envelop_fx_32( #endif move32(); } - env_index++; + env_index = add( env_index, 1 ); } i = 0; move16(); @@ -2733,7 +2734,7 @@ void hq_generic_decoding_fx( } tmp = sub( efidx, sfidx ); - IF( EQ_16( tmp, 0 ) ) + IF( tmp == 0 ) { nband_lf = 0; move16(); @@ -3170,7 +3171,7 @@ void hq_generic_decoding_fx( L_tmp = Mult_32_16( coeff_out_fx[n_freq], tmp ); /*12 + 15 + 11 + cs - 16 - 15 */ coeff_out_fx[n_freq] = L_shl( L_tmp, sub( 5, cs ) ); move32(); /*12 */ - n_freq++; + n_freq = add( n_freq, 1 ); } } @@ -3216,7 +3217,7 @@ void save_old_syn_fx( move16(); } Copy( old_syn_mem, old_syn, tmps ); - Copy( syn, old_syn + tmps, L_frame - tmps ); + Copy( syn, old_syn + tmps, sub( L_frame, tmps ) ); Copy( syn + L_frame - tmps, old_syn_mem, tmps ); deemph_fx( old_syn, preemph_fac, L_frame, mem_deemph ); diff --git a/lib_com/swb_bwe_com_hr.c b/lib_com/swb_bwe_com_hr.c index cdd155678..7da87d12d 100644 --- a/lib_com/swb_bwe_com_hr.c +++ b/lib_com/swb_bwe_com_hr.c @@ -46,6 +46,7 @@ * SWB BWE HR noise filling of zero subbands *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void swb_hr_nonzero_subband_noise_fill( const float tilt_wb, /* i : tilt of wideband signal */ float *t_audio, /* i/o: mdct spectrum */ @@ -101,7 +102,9 @@ static void swb_hr_nonzero_subband_noise_fill( return; } +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * swb_hr_noise_fill() * @@ -239,8 +242,10 @@ void swb_hr_noise_fill( return; } +#endif +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * td_postprocess() * @@ -318,3 +323,4 @@ float td_postprocess( return ( gain ); } +#endif \ No newline at end of file diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c index adc98d36a..c9b4a27fa 100644 --- a/lib_com/swb_bwe_com_lr_fx.c +++ b/lib_com/swb_bwe_com_lr_fx.c @@ -38,7 +38,6 @@ #include - /*-------------------------------------------------------------------* * GetPredictedSignal() * diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c index 282317cde..59bde6cdf 100644 --- a/lib_com/swb_tbe_com_fx.c +++ b/lib_com/swb_tbe_com_fx.c @@ -454,7 +454,7 @@ void flip_and_downmix_generic_fx( Copy32( tmp_R + length, mem2_ext + HILBERT_ORDER2, HILBERT_ORDER2 ); Copy32( tmp_I + length, mem3_ext + HILBERT_ORDER2, HILBERT_ORDER2 ); - if ( *phase_state >= period ) + if ( GE_16( *phase_state, period ) ) { *phase_state = 0; move16(); @@ -477,7 +477,7 @@ void flip_and_downmix_generic_fx( j++; } - if ( j >= period ) + if ( GE_16( j, period ) ) { j = 0; move16(); diff --git a/lib_com/tcq_position_arith.c b/lib_com/tcq_position_arith.c index 4368c569f..e7a76d51f 100644 --- a/lib_com/tcq_position_arith.c +++ b/lib_com/tcq_position_arith.c @@ -99,6 +99,7 @@ Word32 ar_div_ivas( num = L_abs( num ); denum = L_abs( denum ); + test(); IF( L_sub( num, denum ) < 0 || denum == 0 ) { return 0; @@ -341,10 +342,12 @@ void decode_position_ari_fx_ivas( { Word16 tmp; mode_num_nz[0] = MAX_AR_FREQ; + move16(); FOR( i = 0; i < size; i++ ) { tmp = div_l( L_deposit_h( sub( sub( size, i ), 1 ) ), size ); mode_num_nz[i + 1] = round_fx( L_shr( L_deposit_h( tmp ), 1 ) ); + move16(); } position[ar_decode( pardec, mode_num_nz )] = 1; @@ -380,6 +383,7 @@ void decode_position_ari_fx_ivas( scp = Mult_32_16( scp, extract_l( cp ) ); mode_num_nz[sub( sub( add( i, 1 ), storepos ), stpos )] = round_fx( L_shl( scp, 6 ) ); + test(); test(); IF( ( mode_num_nz[sub( sub( add( i, 1 ), storepos ), stpos )] == 0 && scp > 0 ) || EQ_16( mode_num_nz[sub( sub( i, storepos ), stpos )], mode_num_nz[sub( sub( add( i, 1 ), storepos ), stpos )] ) ) { ovrflag = 1; @@ -523,9 +527,9 @@ void decode_magnitude_usq_fx_ivas( cp = L_sub( fxone, tmp ); } - if ( EQ_32( cp, fxone ) ) + IF ( EQ_32( cp, fxone ) ) { - break; + BREAK; } scp = Mult_32_16( scp, extract_l( cp ) ); @@ -649,6 +653,8 @@ void decode_mangitude_tcq_fx_ivas( Word16 i, j, symbol, st; Word16 leftp = npulses; /*pulsesnum; */ Word16 leftnz = nzpos; /*nzpos; */ + move16(); + move16(); Word16 magn_mode[3] = { MAX_AR_FREQ, 0, 0 }; move16(); move16(); @@ -713,12 +719,13 @@ void decode_mangitude_tcq_fx_ivas( IF( L_sub( sub( leftp, j ), leftnz ) == 0 ) { symbol = add( j, 1 ); - break; + BREAK; } quantum1_fx = quantize_fx_ivas( shl( add( j, 1 ), 10 ), ddec[st][0] ); quantum2_fx = quantize_fx_ivas( shl( add( j, 1 ), 10 ), ddec[st][1] ); + test(); if ( sub( quantum1_fx, add( j, 1 ) ) != 0 && sub( quantum2_fx, add( j, 1 ) ) != 0 ) { prob0_fx = MAX_16; @@ -726,10 +733,12 @@ void decode_mangitude_tcq_fx_ivas( prob1_fx = 0; move16(); } + + test(); if ( sub( prob0_fx, MAX_16 ) == 0 || sub( prob1_fx, MAX_16 ) == 0 ) { symbol = add( j, 1 ); - continue; + CONTINUE; } /*magn_mode[1] = (int16_t)(prob1 * MAX_AR_FREQ); */ @@ -780,14 +789,15 @@ void decode_mangitude_tcq_fx_ivas( { out[i] = 0; move32(); - if ( positions[i] != 0 ) + IF ( positions[i] != 0 ) { out[i] = add( sub( leftp, leftnz ), 1 ); move32(); } } - if ( sub( nzpos, npulses ) != 0 && sub( nzpos, 1 ) > 0 ) + test(); + IF ( sub( nzpos, npulses ) != 0 && sub( nzpos, 1 ) > 0 ) { /*update the surplus */ *surplus_fx = L_add( *surplus_fx, L_sub( tcq_bits_fx, L_shl( bits_fx, 1 ) ) ); diff --git a/lib_com/tcx_ltp_fx.c b/lib_com/tcx_ltp_fx.c index fb5a8e27d..35884afaf 100644 --- a/lib_com/tcx_ltp_fx.c +++ b/lib_com/tcx_ltp_fx.c @@ -736,20 +736,21 @@ static void tcx_ltp_synth_filter_10( move16(); gain_step = negate( gain ) / length; - for ( j = 0; j < length; j++ ) + FOR( j = 0; j < length; j++ ) { s = 0; s2 = 0; - - for ( i = 0, k = 0; i < L; i++, k += pitch_res ) + move32(); + move32(); + k = 0; + move16(); + FOR( i = 0; i < L; i++ ) { - // s += w0[k] * x0[i] + w1[k] * x1[-i]; - // s2 += v0[k] * y0[i] + v1[k] * y1[-i]; s = L_mac_sat( L_mac_sat( s, w0[k], x0[i] ), w1[k], x1[-i] ); s2 = L_mac_sat( L_mac_sat( s2, v0[k], y0[i] ), v1[k], y1[-i] ); + k = add( k, pitch_res ); } - // out[j] = in[j] - curr_gain * s2 * ALPHA + curr_gain * s; out[j] = add_sat( in[j], mult_r_sat( curr_gain, sub_sat( round_fx_sat( s ), mult_r_sat( round_fx_sat( s2 ), ALPHA ) ) ) ); x0++; @@ -798,22 +799,21 @@ static void tcx_ltp_synth_filter_10_fx( move16(); gain_step = idiv1616( negate( gain ), length ); // TODO - for ( j = 0; j < length; j++ ) + FOR( j = 0; j < length; j++ ) { s = 0; move16(); s2 = 0; move16(); - - for ( i = 0, k = 0; i < L; i++, k += pitch_res ) + k = 0; + move16(); + FOR( i = 0; i < L; i++ ) { - // s += w0[k] * x0[i] + w1[k] * x1[-i]; - // s2 += v0[k] * y0[i] + v1[k] * y1[-i]; s = Madd_32_16_r( Madd_32_16_r( s, x0[i], w0[k] ), x1[-i], w1[k] ); s2 = Madd_32_16_r( Madd_32_16_r( s2, y0[i], v0[k] ), y1[-i], v1[k] ); + k = add( k, pitch_res ); } - // out[j] = in[j] - curr_gain * s2 * ALPHA + curr_gain * s; out[j] = L_add_sat( in[j], Mpy_32_16_1( L_sub_sat( s, Mpy_32_16_1( s2, ALPHA ) ), curr_gain ) ); move32(); x0++; @@ -860,7 +860,6 @@ static void tcx_ltp_synth_filter_01( curr_gain = 0; move16(); - // gain_step = gain / length; // TODO gain_step = idiv1616( gain, length ); // TODO for ( j = 0; j < length; j++ ) @@ -872,13 +871,10 @@ static void tcx_ltp_synth_filter_01( for ( i = 0, k = 0; i < L; i++, k = add( k, pitch_res ) ) { - // s += w0[k] * x0[i] + w1[k] * x1[-i]; - // s2 += v0[k] * y0[i] + v1[k] * y1[-i]; s = L_mac_sat( L_mac_sat( s, w0[k], x0[i] ), w1[k], x1[-i] ); s2 = L_mac_sat( L_mac_sat( s2, v0[k], y0[i] ), v1[k], y1[-i] ); } - // out[j] = in[j] - curr_gain * s2 * ALPHA + curr_gain * s; out[j] = add_sat( in[j], mult_r_sat( curr_gain, sub_sat( round_fx_sat( s ), mult_r_sat( round_fx_sat( s2 ), ALPHA ) ) ) ); move32(); @@ -926,25 +922,23 @@ static void tcx_ltp_synth_filter_01_fx( curr_gain = 0; move16(); - // gain_step = gain / length; // TODO - gain_step = idiv1616( gain, length ); // TODO + gain_step = idiv1616( gain, length ); - for ( j = 0; j < length; j++ ) + FOR( j = 0; j < length; j++ ) { s = 0; move16(); s2 = 0; move16(); - - for ( i = 0, k = 0; i < L; i++, k = add( k, pitch_res ) ) + k = 0; + move16(); + FOR( i = 0; i < L; i++ ) { - // s += w0[k] * x0[i] + w1[k] * x1[-i]; - // s2 += v0[k] * y0[i] + v1[k] * y1[-i]; s = Madd_32_16_r( Madd_32_16_r( s, x0[i], w0[k] ), x1[-i], w1[k] ); s2 = Madd_32_16_r( Madd_32_16_r( s2, y0[i], v0[k] ), y1[-i], v1[k] ); + k = add( k, pitch_res ); } - // out[j] = in[j] - curr_gain * s2 * ALPHA + curr_gain * s; out[j] = L_add_sat( in[j], Mpy_32_16_r( L_sub_sat( s, Mpy_32_16_1( s2, ALPHA ) ), curr_gain ) ); move32(); @@ -1026,25 +1020,23 @@ static void tcx_ltp_synth_filter_11_unequal_pitch( /* 1. decreasing gain filter. The first filter unit with the parameters associated to the previous interval and scaling towards 0 */ gain = prev_gain; move16(); - // gain_step = negate( prev_gain ) / length; // TODO - gain_step = idiv1616( negate( prev_gain ), length ); // TODO + gain_step = idiv1616( negate( prev_gain ), length ); - for ( j = 0; j < length; j++ ) + FOR( j = 0; j < length; j++ ) { s = 0; move16(); s2 = 0; move16(); - - for ( i = 0, k = 0; i < prev_L; i++, k += prev_pitch_res ) + k = 0; + move16(); + FOR( i = 0; i < prev_L; i++ ) { - // s += w0[k] * x0[i] + w1[k] * x1[-i]; - // s2 += v0[k] * y0[i] + v1[k] * y1[-i]; s = L_mac_sat( L_mac_sat( s, w0[k], x0[i] ), w1[k], x1[-i] ); s2 = L_mac_sat( L_mac_sat( s2, v0[k], y0[i] ), v1[k], y1[-i] ); + k = add( k, prev_pitch_res ); } - // out[j] = in[j] - gain * s2 * ALPHA + gain * s; out[j] = add_sat( in[j], mult_r_sat( gain, sub_sat( round_fx_sat( s ), mult_r_sat( round_fx_sat( s2 ), ALPHA ) ) ) ); x0++; @@ -1067,24 +1059,23 @@ static void tcx_ltp_synth_filter_11_unequal_pitch( /* 2. increasing gain filter. The second filter unit with the parameters associated to the current interval and scaling from 0 towards current gain */ gain = 0; move16(); - gain_step = cur_gain / length; // TODO + gain_step = idiv1616( cur_gain, length ); - for ( j = 0; j < length; j++ ) + FOR( j = 0; j < length; j++ ) { s3 = 0; move16(); s4 = 0; move16(); - - for ( i = 0, k = 0; i < L; i++, k += pitch_res ) + k = 0; + move16(); + FOR( i = 0; i < L; i++ ) { - // s3 += p0[k] * l0[i] + p1[k] * l1[-i]; - // s4 += q0[k] * m0[i] + q1[k] * m1[-i]; s3 = L_mac_sat( L_mac_sat( s3, p0[k], l0[i] ), p1[k], l1[-i] ); s4 = L_mac_sat( L_mac_sat( s4, q0[k], m0[i] ), q1[k], m1[-i] ); + k = add( k, pitch_res ); } - // out[j] = *(temp_ptr + j) - gain * s4 * ALPHA + gain * s3; out[j] = add_sat( *( temp_ptr + j ), mult_r_sat( gain, sub_sat( round_fx_sat( s3 ), mult_r_sat( round_fx_sat( s4 ), ALPHA ) ) ) ); move32(); @@ -1157,22 +1148,21 @@ static void tcx_ltp_synth_filter_11_unequal_pitch_fx( move16(); gain_step = idiv1616( negate( prev_gain ), length ); // TODOD - for ( j = 0; j < length; j++ ) + FOR( j = 0; j < length; j++ ) { s = 0; move16(); s2 = 0; move16(); - - for ( i = 0, k = 0; i < prev_L; i++, k += prev_pitch_res ) + k = 0; + move16(); + FOR( i = 0; i < prev_L; i++ ) { - // s += w0[k] * x0[i] + w1[k] * x1[-i]; - // s2 += v0[k] * y0[i] + v1[k] * y1[-i]; s = Madd_32_16_r( Madd_32_16_r( s, x0[i], w0[k] ), x1[-i], w1[k] ); s2 = Madd_32_16_r( Madd_32_16_r( s2, y0[i], v0[k] ), y1[-i], v1[k] ); + k = add( k, prev_pitch_res ); } - // out[j] = in[j] - gain * s2 * ALPHA + gain * s; out[j] = L_add_sat( in[j], Mpy_32_16_r( L_sub_sat( s, Mpy_32_16_1( s2, ALPHA ) ), gain ) ); move32(); x0++; @@ -1195,24 +1185,22 @@ static void tcx_ltp_synth_filter_11_unequal_pitch_fx( /* 2. increasing gain filter. The second filter unit with the parameters associated to the current interval and scaling from 0 towards current gain */ gain = 0; move16(); - gain_step = cur_gain / length; // TODO + gain_step = idiv1616( cur_gain, length ); - for ( j = 0; j < length; j++ ) + FOR( j = 0; j < length; j++ ) { s3 = 0; move16(); s4 = 0; move16(); - - for ( i = 0, k = 0; i < L; i++, k += pitch_res ) + k = 0; + FOR( i = 0; i < L; i++ ) { - // s3 += p0[k] * l0[i] + p1[k] * l1[-i]; - // s4 += q0[k] * m0[i] + q1[k] * m1[-i]; s3 = Madd_32_16_r( Madd_32_16_r( s3, l0[i], p0[k] ), l1[-i], p1[k] ); s4 = Madd_32_16_r( Madd_32_16_r( s4, m0[i], q0[k] ), m1[-i], q1[k] ); + k = add( k, pitch_res ); } - // out[j] = *(temp_ptr + j) - gain * s4 * ALPHA + gain * s3; out[j] = L_add_sat( *( temp_ptr + j ), Mpy_32_16_r( L_sub_sat( s3, Mpy_32_16_1( s4, ALPHA ) ), gain ) ); move32(); @@ -1334,7 +1322,7 @@ void tcx_ltp_post( move32(); IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) { - total_brate = st->bits_frame_nominal * FRAMES_PER_SEC; + total_brate = L_mult0( st->bits_frame_nominal, FRAMES_PER_SEC ); move32(); } @@ -1358,7 +1346,7 @@ void tcx_ltp_post( move16(); } - IF( core == ACELP_CORE ) + IF( EQ_16( core, ACELP_CORE ) ) { bfi = 0; move16(); @@ -1394,7 +1382,7 @@ void tcx_ltp_post( sig_in = buf_in + tcx_buf_len; Copy( hTcxLtpDec->tcxltp_mem_in, buf_in, tcx_buf_len ); Copy( sig, buf_in + tcx_buf_len, output_frame ); - IF( core > ACELP_CORE ) + IF( GT_16( core, ACELP_CORE ) ) { Copy( tcx_buf, sig_in + output_frame, tcx_buf_len ); } @@ -1459,7 +1447,7 @@ void tcx_ltp_post( { /* PLC: [TCX: Fade-out] * PLC: LTP and bad frame (concealment) */ - IF( st->pit_res_max == st->pit_res_max_past ) /* ensure consistent core SR to previous frame; otherwise, set gain to 0 */ + IF( EQ_16( st->pit_res_max, st->pit_res_max_past ) ) /* ensure consistent core SR to previous frame; otherwise, set gain to 0 */ { pitch_int = hTcxLtpDec->tcxltp_pitch_int_post_prev; move16(); @@ -1578,7 +1566,7 @@ void tcx_ltp_post( test(); test(); // #ifdef IVAS_CODE_TCX_LTP - if ( st->element_mode != EVS_MONO ) + IF( NE_16( st->element_mode, EVS_MONO ) ) { test(); test(); @@ -1614,7 +1602,6 @@ void tcx_ltp_post( } } ELSE - // #endif { test(); test(); @@ -1698,7 +1685,7 @@ void tcx_ltp_post32( move32(); IF( EQ_16( st->element_mode, IVAS_CPE_MDCT ) ) { - total_brate = st->bits_frame_nominal * FRAMES_PER_SEC; // TDO + total_brate = L_mult0( st->bits_frame_nominal, FRAMES_PER_SEC ); // TDO move32(); } @@ -1936,33 +1923,36 @@ void tcx_ltp_post32( st->pit_res_max_past, NULL, 0, hTcxLtpDec->tcxltp_filt_idx_prev ); /******** Transition part ********/ - - test(); - test(); - test(); - // #ifdef IVAS_CODE_TCX_LTP - if ( st->element_mode != EVS_MONO ) + IF( NE_16( st->element_mode, EVS_MONO ) ) { - if ( gain == 0 && hTcxLtpDec->tcxltp_gain_post_prev == 0 ) + test(); + test(); + test(); + test(); + test(); + test(); + test(); + test(); + IF( gain == 0 && hTcxLtpDec->tcxltp_gain_post_prev == 0 ) { /* The filtering is deactivated, just copy input to the output */ Copy32( sig_in + delay, sig_out + delay, L_transition ); } - else if ( gain == 0 && hTcxLtpDec->tcxltp_gain_post_prev != 0 ) + ELSE IF( gain == 0 && hTcxLtpDec->tcxltp_gain_post_prev != 0 ) { /* Filtering with the first filter unit */ tcx_ltp_synth_filter_10_fx( sig_out + delay, sig_in + delay, L_transition, hTcxLtpDec->tcxltp_pitch_int_post_prev, hTcxLtpDec->tcxltp_pitch_fr_post_prev, hTcxLtpDec->tcxltp_gain_post_prev, st->pit_res_max_past, hTcxLtpDec->tcxltp_filt_idx_prev ); } - else if ( gain != 0 && hTcxLtpDec->tcxltp_gain_post_prev == 0 ) + ELSE IF( gain != 0 && hTcxLtpDec->tcxltp_gain_post_prev == 0 ) { /* Filtering with the second filter unit */ tcx_ltp_synth_filter_01_fx( sig_out + delay, sig_in + delay, L_transition, pitch_int, pitch_fr, gain, st->pit_res_max, filtIdx ); } - else if ( gain == hTcxLtpDec->tcxltp_gain_post_prev && pitch_int == hTcxLtpDec->tcxltp_pitch_int_post_prev && pitch_fr == hTcxLtpDec->tcxltp_pitch_fr_post_prev && st->pit_res_max == st->pit_res_max_past && filtIdx == hTcxLtpDec->tcxltp_filt_idx_prev ) + ELSE IF( EQ_16( gain, hTcxLtpDec->tcxltp_gain_post_prev ) && EQ_16( pitch_int, hTcxLtpDec->tcxltp_pitch_int_post_prev ) && EQ_16( pitch_fr, hTcxLtpDec->tcxltp_pitch_fr_post_prev ) && EQ_16( st->pit_res_max, st->pit_res_max_past ) && EQ_16( filtIdx, hTcxLtpDec->tcxltp_filt_idx_prev ) ) { tcx_ltp_synth_filter32( sig_out + delay, sig_in + delay, L_transition, pitch_int, pitch_fr, gain, st->pit_res_max, NULL, 0, filtIdx ); } - else + ELSE { /* Filtering with the first filter unit, followed by the filtering with the second filter unit */ tcx_ltp_synth_filter_11_unequal_pitch_fx( sig_out + delay, sig_in + delay, L_transition, pitch_int, pitch_fr, gain, st->pit_res_max, filtIdx, @@ -1970,8 +1960,10 @@ void tcx_ltp_post32( } } ELSE - // #endif { + test(); + test(); + test(); IF( gain == 0 && hTcxLtpDec->tcxltp_gain_post_prev == 0 ) { Copy32( sig_in + delay, sig_out + delay, L_transition ); diff --git a/lib_com/tcx_mdct_window.c b/lib_com/tcx_mdct_window.c index 65fb6a1a0..adda4b8d2 100644 --- a/lib_com/tcx_mdct_window.c +++ b/lib_com/tcx_mdct_window.c @@ -54,9 +54,9 @@ const PWord16 *getSineWindowTable( Word16 length ); void mdct_window_sine_flt( float *window, const int32_t Fs, - const Word16 n, - const Word16 window_type, - const Word16 element_mode ) + const int16_t n, + const int16_t window_type, + const int16_t element_mode ) { if ( element_mode == EVS_MONO ) { @@ -73,7 +73,7 @@ void mdct_window_sine_flt( else { const float *window_table = 0; - Word16 buf_in_size = 0; + int16_t buf_in_size = 0; switch ( window_type ) { case FULL_OVERLAP: diff --git a/lib_com/tcx_utils_fx.c b/lib_com/tcx_utils_fx.c index 60f26d303..d6002cb42 100644 --- a/lib_com/tcx_utils_fx.c +++ b/lib_com/tcx_utils_fx.c @@ -623,7 +623,6 @@ void tcx_windowing_synthesis_past_frame( Word16 i, n; - IF( EQ_16( right_mode, 2 ) ) /* min. overlap */ { signal += shr( sub( window_length, window_min_length ), 1 ); @@ -1508,7 +1507,7 @@ void AdaptLowFreqDeemph( Word32 v2, v4, tmp32; tmp32 = 0; /* to avoid compilation warnings */ - + move32(); IF( tcx_lpc_shaped_ari == 0 ) { @@ -1527,6 +1526,7 @@ void AdaptLowFreqDeemph( /* Debug initialization to catch illegal x[i] values. */ tmp32 = 0; + move32(); if ( x[i] < 0 ) tmp32 = L_add( x[i], v2 ); @@ -2030,6 +2030,7 @@ void tcx_noise_filling_with_shift( } *Q_e = max_e; + move16(); } diff --git a/lib_com/tec_com.c b/lib_com/tec_com.c index 32c6e9fef..1d20ae9f6 100644 --- a/lib_com/tec_com.c +++ b/lib_com/tec_com.c @@ -13,7 +13,6 @@ * Local constants *-------------------------------------------------------------------*/ -/*#define EPS ( 1e-12f)*/ #define ENV_SCALE_OFFSET_1_FX 1515133568l /*90.309f/128.0 Q31*/ /* 10*log10(2^30) */ /* scaled by 1/128.0 */ #define MAX_TEC_BW_LO ( 12 ) #define MAX_NB_TEC_LOW_BAND ( 3 ) @@ -32,7 +31,6 @@ void resetTecDec_Fx( set16_fx( hTecDec->pGainTemp_m, 0, CLDFB_NO_COL_MAX ); set16_fx( hTecDec->pGainTemp_e, 0, CLDFB_NO_COL_MAX ); - set16_fx( hTecDec->loBuffer, 0, CLDFB_NO_COL_MAX + MAX_TEC_SMOOTHING_DEG ); return; @@ -171,8 +169,6 @@ static Word32 calcCorrelationCoefficient2_Fix( Word32 sqrtVal1; Word32 sqrtVal2; - - exp1 = norm_l( var_x ); if ( ( exp1 & 0x1 ) != 0 ) { @@ -184,23 +180,16 @@ static Word32 calcCorrelationCoefficient2_Fix( exp2 = sub( exp2, 1 ); } - sqrtVal1 = Sqrt_l( L_shl( var_x, exp1 ), &exp3 ); - sqrtVal1 = L_shr( sqrtVal1, ( shr( add( exp1, 24 ), 1 ) ) ); - sqrtVal2 = Sqrt_l( L_shl( var_y, exp2 ), &exp4 ); sqrtVal2 = L_shr( sqrtVal2, ( shr( add( exp2, 24 ), 1 ) ) ); - exp1 = norm_l( sqrtVal1 ); exp2 = norm_l( sqrtVal2 ); - r_sft = sub( add( exp1, exp2 ), 24 ); Val2 = L_shr( Mpy_32_32( L_shl( sqrtVal1, exp1 ), L_shl( sqrtVal2, exp2 ) ), r_sft ); - - exp1 = sub( norm_l( Val1 ), 1 ); exp2 = norm_l( Val2 ); @@ -1045,7 +1034,7 @@ static Word16 procTec_Fx( move16(); exp_syn = sub( s, min_shift ); - if ( exp_syn > 15 ) + if ( GT_16( exp_syn, 15 ) ) { exp_syn = 15; move16(); @@ -1175,7 +1164,7 @@ static Word16 procTfa_Fx( s = exp_syn; move16(); exp_syn = sub( s, min_shift ); - if ( exp_syn > 15 ) + if ( GT_16( exp_syn, 15 ) ) { exp_syn = 15; move16(); @@ -1268,9 +1257,9 @@ void calcHiEnvLoBuff_Fix( const Word16 noCols, const Word16 *pFreqBandTable, /*!< freqbandTable. */ const Word16 nSfb, /*!< Number of scalefactors. */ - Word32 **pCldfbPow_Fix /*float** pCldfbPow*/, - Word16 *loBuffer_Fix /*float* loBuffer Q8*/, - Word16 *hiTempEnvOrig_Fix /*float* hiTempEnvOrig*/, + Word32 **pCldfbPow_Fix /*Word32** pCldfbPow*/, + Word16 *loBuffer_Fix /*Word32* loBuffer Q8*/, + Word16 *hiTempEnvOrig_Fix /*Word32* hiTempEnvOrig*/, Word16 pCldfbPow_FixScale ) { const Word16 BW_LO = TecLowBandTable[NBTECLOWBAND]; @@ -1317,10 +1306,10 @@ void calcHiEnvLoBuff_Fix( void calcLoEnvCheckCorrHiLo_Fix( const Word16 noCols, const Word16 *pFreqBandTable, /*!< freqbandTable. */ - Word16 *loBuffer_Fix /*float* loBuffer Q8*/, - Word16 *loTempEnv_Fix /*float* loTempEnv Q7*/, - Word16 *loTempEnv_ns_Fix /* float* loTempEnv_ns*/, - Word16 *hiTempEnvOrig_Fix /*float* hiTempEnvOrig*/, + Word16 *loBuffer_Fix /*Word16* loBuffer Q8*/, + Word16 *loTempEnv_Fix /*Word16* loTempEnv Q7*/, + Word16 *loTempEnv_ns_Fix /* Word16* loTempEnv_ns*/, + Word16 *hiTempEnvOrig_Fix /*Word16* hiTempEnvOrig*/, Word16 *corrFlag /*int* corrFlag*/ ) { diff --git a/lib_com/tools.c b/lib_com/tools.c index b184b15f1..834fbfdb8 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -741,7 +741,7 @@ Word16 maximum_l( } } - IF( max_val != NULL ) + if ( max_val != NULL ) { *max_val = tmp; move32(); @@ -1773,16 +1773,18 @@ void sort( Word16 i; UWord16 j, tempr; - FOR( i = sub( len, 2 ); i >= 0; i-- ) + FOR( i = len - 2; i >= 0; i-- ) { tempr = x[i]; - test(); - FOR( j = add( i, 1 ); ( j < len ) && ( tempr > x[j] ); j++ ) + move16(); + FOR( j = i + 1; ( j < len ) && ( tempr > x[j] ); j++ ) { test(); x[j - 1] = x[j]; + move16(); } x[j - 1] = tempr; + move16(); } return; diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index a1ececc58..90c2a1406 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -284,7 +284,7 @@ Word16 usdequant_fx( /* Qx*/ #ifdef BASOP_NOGLOB g = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ #else - g = round_fx( L_shl( L_tmp, 16 ) ); /*Qx */ + g = round_fx( L_shl( L_tmp, 16 ) ); /*Qx */ #endif return ( g ); } @@ -334,7 +334,7 @@ Word16 usquant_fx( /* o: index of the winning codeword */ #ifdef BASOP_NOGLOB *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ #else - *xq = round_fx( L_shl( L_tmp, 16 ) ); /*Qx */ + *xq = round_fx( L_shl( L_tmp, 16 ) ); /*Qx */ #endif return idx; } @@ -411,7 +411,7 @@ Word32 sum2_fx( /* o : sum of all squared vector elements #ifdef BASOP_NOGLOB L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ #else /* BASOP_NOGLOB */ - L_tmp = L_mac( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ + L_tmp = L_mac( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ #endif /* BASOP_NOGLOB */ } @@ -1516,8 +1516,8 @@ Word16 var_fx( /* o: variance of vector Qx*/ tmp = sub_sat( x[i], m ); /*Qx */ v = L_mac0_sat( v, tmp, tmp ); /*(Qx+Qx) */ #else - tmp = sub( x[i], m ); /*Qx */ - v = L_mac0( v, tmp, tmp ); /*(Qx+Qx) */ + tmp = sub( x[i], m ); /*Qx */ + v = L_mac0( v, tmp, tmp ); /*(Qx+Qx) */ #endif } L_tmp = Mult_32_16( v, inv_len ); /*Q(14-exp+Qx+Qx) */ @@ -2011,7 +2011,7 @@ Word32 sum32_fx( /* o : sum of all vector elements #ifdef BASOP_NOGLOB tmp = L_add_sat( tmp, vec[i] ); /*Qx */ #else /* BASOP_NOGLOB */ - tmp = L_add( tmp, vec[i] ); /*Qx */ + tmp = L_add( tmp, vec[i] ); /*Qx */ #endif /* BASOP_NOGLOB */ } @@ -2031,7 +2031,7 @@ Word16 sum16_fx( /* o : sum of all vector elements #ifdef BASOP_NOGLOB tmp = add_sat( tmp, vec[i] ); /*Qx */ #else - tmp = add( tmp, vec[i] ); /*Qx */ + tmp = add( tmp, vec[i] ); /*Qx */ #endif } @@ -2731,7 +2731,7 @@ void pz_filter_dp_fx( #ifdef BASOP_NOGLOB Ltemp1 = L_shr_sat( Lacc, s ); /* Ltemp1 in Qc+Qa+Qn=Q(16+Qn) */ #else - Ltemp1 = L_shr( Lacc, s ); /* Ltemp1 in Qc+Qa+Qn=Q(16+Qn) */ + Ltemp1 = L_shr( Lacc, s ); /* Ltemp1 in Qc+Qa+Qn=Q(16+Qn) */ #endif y[i] = extract_h( Ltemp1 ); /* y[i] in Qn */ move16(); @@ -3681,6 +3681,7 @@ void hp400_12k8_fx( return; } +#ifndef FIX_805_VERIFICATION #if 0 void hp400_12k8_ivas_fx( Word16 signal[], /* i/o: input signal / output is divided by 16 */ @@ -3757,6 +3758,7 @@ void hp400_12k8_ivas_fx( return; } #endif +#endif Word16 dot_prod_satcontr( const Word16 *x, const Word16 *y, Word16 qx, Word16 qy, Word16 *qo, Word16 len ) { @@ -4008,7 +4010,7 @@ Word16 floor_log_2( Word32 num ) : 21; #endif - IF( EQ_32( num, 0 ) ) + IF( num == 0 ) { return 0; } @@ -4401,7 +4403,7 @@ Word32 ceil_fixed( Word32 x, Word16 exp ) Word32 step; // step = x / L_shl( 1, exp ); step = L_shr( x, exp ); - if ( ( x % L_shl( 1, exp ) ) > 0 ) + IF( ( x % L_shl( 1, exp ) ) > 0 ) { step = L_add( step, 1 ); } @@ -4419,6 +4421,7 @@ void sort_l( FOR( i = len - 2; i >= 0; i-- ) { tempr = x[i]; + move32(); FOR( j = i + 1; ( j < len ) && ( tempr > x[j] ); j++ ) { x[j - 1] = x[j]; diff --git a/lib_com/trans_inv_fx.c b/lib_com/trans_inv_fx.c index f79443862..6916a6cdb 100644 --- a/lib_com/trans_inv_fx.c +++ b/lib_com/trans_inv_fx.c @@ -17,7 +17,6 @@ #define NUMSF_M2 ( NUMSF - 2 ) #define NUMSF_S2 ( NUMSF / 2 ) #define LOG2_NUMSF 3 -#define INV_NUMSF (float) 0.125 /*--------------------------------------------------------------------------* * preecho_sb() diff --git a/lib_com/window.c b/lib_com/window.c index e01ff2670..79e0f9160 100644 --- a/lib_com/window.c +++ b/lib_com/window.c @@ -41,12 +41,12 @@ #define WMC_TOOL_SKIP +#ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------- * ham_cos_window_flt() * * *-------------------------------------------------------------------*/ - void ham_cos_window_flt( float *fh, const int16_t n1, @@ -73,5 +73,6 @@ void ham_cos_window_flt( return; } +#endif #undef WMC_TOOL_SKIP diff --git a/lib_com/window_fx.c b/lib_com/window_fx.c index 97443e3b5..2efbe5622 100644 --- a/lib_com/window_fx.c +++ b/lib_com/window_fx.c @@ -107,7 +107,7 @@ void ham_cos_window_ivas( // cte_fx = div_s(1, sub(shl(n2, 2), 1)); cc_fx = 0; move16(); - for ( i = 0; i < n2; i++ ) + FOR( i = 0; i < n2; i++ ) { *fh++ = getCosWord16R2( cc_fx ); move16(); diff --git a/lib_dec/FEC_clas_estim.c b/lib_dec/FEC_clas_estim.c index b293bdf9a..c6b4cd1a0 100644 --- a/lib_dec/FEC_clas_estim.c +++ b/lib_dec/FEC_clas_estim.c @@ -43,6 +43,7 @@ #include "stat_dec.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -65,7 +66,6 @@ /*-------------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------------*/ -#ifndef IVAS_FLOAT_FIXED static float calculate_zero_crossings( const float *synth, const int16_t L_frame ); static float calculate_pitch_synchr_norm_correlation( const float *pitch, const float *synth, const int16_t L_frame, const int16_t L_subfr ); diff --git a/lib_dec/FEC_lsf_estim_fx.c b/lib_dec/FEC_lsf_estim_fx.c index d79d90c85..730014f0d 100644 --- a/lib_dec/FEC_lsf_estim_fx.c +++ b/lib_dec/FEC_lsf_estim_fx.c @@ -6,9 +6,9 @@ #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ +#ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" /* Function prototypes */ - /*-------------------------------------------------------------------* * FEC_lsf_estim() * @@ -57,3 +57,4 @@ void FEC_lsf2lsp_interp( return; } +#endif diff --git a/lib_dec/FEC_scale_syn.c b/lib_dec/FEC_scale_syn.c index 58d0dbc96..f48fecced 100644 --- a/lib_dec/FEC_scale_syn.c +++ b/lib_dec/FEC_scale_syn.c @@ -41,6 +41,7 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED #define SCLSYN_LAMBDA 0.3f /*-------------------------------------------------------------------* @@ -49,7 +50,6 @@ * Smooth speech energy evolution when recovering after erasure(s) *-------------------------------------------------------------------*/ -#ifndef IVAS_FLOAT_FIXED void FEC_scale_syn( const int16_t L_frame, /* i : length of the frame */ int16_t clas, /* i/o: frame classification */ diff --git a/lib_dec/LD_music_post_filter_fx.c b/lib_dec/LD_music_post_filter_fx.c index 02f629317..f5d492f72 100644 --- a/lib_dec/LD_music_post_filter_fx.c +++ b/lib_dec/LD_music_post_filter_fx.c @@ -8,6 +8,7 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Local constants @@ -1096,3 +1097,4 @@ void music_postfilt_init( return; } +#endif diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 9d715d30b..feabac6f8 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -61,34 +61,34 @@ ivas_error acelp_core_dec_ivas_fx( Word32 bwe_exc_extended_fx[], /* i/o: bandwidth extended excitation */ Word16 *voice_factors_fx, /* o : voicing factors */ Word16 old_syn_12k8_16k_fx[], /* o : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE */ - const int16_t sharpFlag, /* i : formant sharpening flag */ + const Word16 sharpFlag, /* i : formant sharpening flag */ Word16 pitch_buf_fx[NB_SUBFR16k], /* o : floating pitch for each subframe */ - int16_t *unbits, /* o : number of unused bits */ - int16_t *sid_bw, /* o : 0-NB/WB, 1-SWB SID */ + Word16 *unbits, /* o : number of unused bits */ + Word16 *sid_bw, /* o : 0-NB/WB, 1-SWB SID */ STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */ const Word16 tdm_lspQ_PCh_fx[M], /* i : Q LSPs for primary channel */ const Word16 tdm_lsfQ_PCh_fx[M], /* i : Q LSFs for primary channel */ - const int16_t use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ - const int16_t last_element_mode, /* i : last element mode */ - const int32_t last_element_brate, /* i : last element bitrate */ - const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ - const int16_t nchan_out, /* i : number of output channels */ + const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */ + const Word16 last_element_mode, /* i : last element mode */ + const Word32 last_element_brate, /* i : last element bitrate */ + const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */ + const Word16 nchan_out, /* i : number of output channels */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ - const int16_t read_sid_info /* i : read SID info flag */ + const Word16 read_sid_info /* i : read SID info flag */ ) { Word32 synth_fx[960], save_hb_synth_fx[960] /*, bwe_exc_extended_fx[L_FRAME32k + NL_BUFF_OFFSET]*/; Word16 old_exc_fx[L_EXC_DEC], *exc_fx; /* excitation signal buffer */ Word16 syn_tmp_fx[L_FRAME16k + L_SUBFR], *psyn_fx; /* synthesis signal buffer */ - int16_t output_frame; /* frame length at output sampling freq. */ + Word16 output_frame; /* frame length at output sampling freq. */ Word16 lsf_new_fx[M]; /* LSFs at the end of the frame Qlog2(2.56) */ Word16 lsp_new_fx[M]; /* LSPs at the end of the frame Q15 */ Word16 lsp_mid_fx[M]; /* LSPs in the middle of the frame */ #ifdef MSAN_FIX Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )] = { 0 }; /* A(q) quantized for the 4 subframes */ #else - Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )]; /* A(q) quantized for the 4 subframes */ + Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )]; /* A(q) quantized for the 4 subframes */ #endif Word16 old_exc2_fx[L_FRAME16k + L_EXC_MEM], *exc2_fx; /* total excitation buffer */ Word16 mem_tmp_fx[M]; /* temporary synthesis filter memory */ @@ -145,6 +145,7 @@ ivas_error acelp_core_dec_ivas_fx( Word16 tmp; error = IVAS_ERR_OK; + move32(); test(); test(); test(); @@ -170,6 +171,7 @@ ivas_error acelp_core_dec_ivas_fx( { configureFdCngDec_fx( st->hFdCngDec, st->bwidth, ACELP_14k25, st->L_frame, st->last_L_frame, st->element_mode ); Word16 old_NoiseEstExp = st->hFdCngDec->hFdCngCom->sidNoiseEstExp; + move16(); /* Only run parameter decoding in SID frames */ IF( EQ_32( st->core_brate, SID_2k40 ) ) { @@ -626,7 +628,7 @@ ivas_error acelp_core_dec_ivas_fx( { test(); test(); - if ( EQ_16( st->coder_type, AUDIO ) || ( st->coder_type == INACTIVE && LE_32( st->total_brate, MAX_GSC_INACTIVE_BRATE ) ) ) + IF( EQ_16( st->coder_type, AUDIO ) || ( st->coder_type == INACTIVE && LE_32( st->total_brate, MAX_GSC_INACTIVE_BRATE ) ) ) { st->GSC_IVAS_mode = get_next_indice_fx( st, 2 ); move16(); @@ -1046,7 +1048,7 @@ ivas_error acelp_core_dec_ivas_fx( { decod_gen_2sbfr_ivas_fx( st, sharpFlag, Aq_fx, pitch_buf_fx, voice_factors_fx, exc_fx, exc2_fx, bwe_exc_fx, gain_buf_fx, tdm_Pitch_reuse_flag, p_tdm_Pri_pitch_buf_fx ); - if ( EQ_16( st->element_mode, IVAS_CPE_TD ) ) + IF( EQ_16( st->element_mode, IVAS_CPE_TD ) ) { tmp_noise_fx = shr_r( st->lp_gainc_fx, 3 ); /*Q0*/ } @@ -1074,7 +1076,7 @@ ivas_error acelp_core_dec_ivas_fx( st->Q_exc = 0; move16(); /* SC-VBR - PPP frames */ - IF( ( error = decod_ppp_fx( st, Aq_fx, pitch_buf_fx, exc_fx, exc2_fx, st->bfi, gain_buf_fx, voice_factors_fx, bwe_exc_fx ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = decod_ppp_fx( st, Aq_fx, pitch_buf_fx, exc_fx, exc2_fx, st->bfi, gain_buf_fx, voice_factors_fx, bwe_exc_fx ) ), IVAS_ERR_OK ) ) { return error; } @@ -1104,7 +1106,7 @@ ivas_error acelp_core_dec_ivas_fx( return error; } - if ( EQ_16( st->element_mode, IVAS_CPE_TD ) ) + IF( EQ_16( st->element_mode, IVAS_CPE_TD ) ) { tmp_noise_fx = shr_r( st->lp_gainc_fx, 3 ); /*Q0*/ } @@ -1997,7 +1999,7 @@ ivas_error acelp_core_dec_ivas_fx( cldfbSynthesis_ivas_fx( realBuffer_fx, imagBuffer_fx, synth_fx, -1, st->cldfbSyn ); #ifdef MSAN_FIX - scale_sig32( synth_fx, output_frame, -sub( Q_real, 1 ) ); + scale_sig32( synth_fx, output_frame, negate( sub( Q_real, 1 ) ) ); #else Scale_sig32( synth_fx, L_FRAME48k, -( Q_real - 1 ) ); #endif diff --git a/lib_dec/avq_dec_fx.c b/lib_dec/avq_dec_fx.c index fa865d0ed..da9e4720c 100644 --- a/lib_dec/avq_dec_fx.c +++ b/lib_dec/avq_dec_fx.c @@ -314,7 +314,7 @@ void AVQ_demuxdec_fx( FOR( i = 0; i < Nsv; i++ ) { /* multi-rate RE8 decoder */ - re8_dec( nq[i], I[i], &kv[8 * i], code ); + re8_dec_fx( nq[i], I[i], &kv[8 * i], code ); /* write decoded RE8 vector to decoded subvector #i */ FOR( j = 0; j < 8; j++ ) diff --git a/lib_dec/core_dec_reconf_fx.c b/lib_dec/core_dec_reconf_fx.c index 13ddbe6f2..19b4e08e0 100644 --- a/lib_dec/core_dec_reconf_fx.c +++ b/lib_dec/core_dec_reconf_fx.c @@ -105,6 +105,8 @@ void reconfig_decoder_LPD_ivas_fx( /*if its not the first frame resample overlap buffer to new sampling rate */ IF( ( st->ini_frame != 0 ) ) { + test(); + test(); test(); test(); test(); @@ -297,6 +299,8 @@ void reconfig_decoder_LPD_fx( /*if its not the first frame resample overlap buffer to new sampling rate */ IF( ( st->ini_frame != 0 ) ) { + test(); + test(); test(); test(); test(); diff --git a/lib_dec/core_dec_switch_fx.c b/lib_dec/core_dec_switch_fx.c index 835b93097..8e13b3bb3 100644 --- a/lib_dec/core_dec_switch_fx.c +++ b/lib_dec/core_dec_switch_fx.c @@ -8,11 +8,9 @@ #include "basop_util.h" #include "prot_fx.h" #include "rom_com.h" - -// Temporarily added #include "prot.h" - +#ifdef IVAS_FLOAT_FIXED void mode_switch_decoder_LPD_fx( Decoder_State *st, /* i/o: decoder state structure */ Word16 bwidth, /* i : audio bandwidth */ @@ -265,7 +263,6 @@ void mode_switch_decoder_LPD_fx( st->dec_glr_idx = 0; } -#ifdef IVAS_FLOAT_FIXED void mode_switch_decoder_LPD_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word16 bwidth, /* i : audio bandwidth */ diff --git a/lib_dec/dec_ace_fx.c b/lib_dec/dec_ace_fx.c index 7c3de901a..a42578389 100644 --- a/lib_dec/dec_ace_fx.c +++ b/lib_dec/dec_ace_fx.c @@ -130,7 +130,7 @@ void decoder_acelp_fx( weights[1] = 4369 /*(float)2/15 Q15*/; weights[2] = 6554 /*(float)3/15 Q15*/; weights[3] = 8738 /*(float)4/15 Q15*/; - weights[4] = 10923 /*(float)5/15 Q15*/; + weights[4] = 10923 /*float)5/15 Q15*/; } st->Mode2_lp_gainp = L_deposit_l( 0 ); st->Mode2_lp_gainc = L_deposit_l( 0 ); diff --git a/lib_dec/dec_acelp_fx.c b/lib_dec/dec_acelp_fx.c index b05086d9f..2ddb63658 100644 --- a/lib_dec/dec_acelp_fx.c +++ b/lib_dec/dec_acelp_fx.c @@ -231,11 +231,11 @@ static void D_ACELP_decode_arithtrack_fx( Word16 v[], Word32 s, Word16 p, Word16 } ELSE /* this is the first pulse here -> determine sign */ { - v[idx] = +_1_CODE; /* place a negative pulse here */ + v[idx] = _1_CODE; /* place a negative pulse here */ move16(); IF( L_and( s, 0x1 ) != 0 ) { - v[idx] = -_1_CODE; /* place a negative pulse here */ + v[idx] = negate( _1_CODE ); /* place a negative pulse here */ move16(); } s = L_lshr( s, 1 ); diff --git a/lib_dec/dec_post_fx.c b/lib_dec/dec_post_fx.c index 7826cabc4..78e685e7d 100644 --- a/lib_dec/dec_post_fx.c +++ b/lib_dec/dec_post_fx.c @@ -36,11 +36,9 @@ static void modify_pst_param_fx( const Word16 lp_noise, Word16 *g1, Word16 *g2, static void Dec_formant_postfilt_fx( PFSTAT_HANDLE hPFstat, Word16 *signal_ptr, Word16 *coeff, Word16 *sig_out, Word16 gamma1, Word16 gamma2 ); -#ifdef IVAS_FLOAT_FIXED static void Dec_formant_postfilt_ivas_fx( PFSTAT_HANDLE hPFstat, Word16 *signal_ptr, Word16 *coeff, Word16 *sig_out, Word16 gamma1, Word16 gamma2 ); static void calc_st_filt_ivas_fx( Word16 *apond2, Word16 *apond1, Word16 *parcor0, Word16 *sig_ltp_ptr, Word16 *mem_zero, const Word16 extl ); -#endif /*-------------------------------------------------------------------------- diff --git a/lib_dec/dlpc_avq_fx.c b/lib_dec/dlpc_avq_fx.c index 1cb91e22f..1f4a7117b 100644 --- a/lib_dec/dlpc_avq_fx.c +++ b/lib_dec/dlpc_avq_fx.c @@ -352,7 +352,6 @@ Word16 decode_lpc_avq_ivas_fx( Word16 start_bit_pos; Word16 stereo_mode = 0; - // #endif move16(); move16(); move16(); @@ -393,7 +392,6 @@ Word16 decode_lpc_avq_ivas_fx( j = add( j, 1 ); move16(); } - // #endif /* Decode quantization indices */ IF( q_type == 0 ) diff --git a/lib_dec/dlpc_stoch_fx.c b/lib_dec/dlpc_stoch_fx.c index f42d7d457..e06a2d515 100644 --- a/lib_dec/dlpc_stoch_fx.c +++ b/lib_dec/dlpc_stoch_fx.c @@ -12,9 +12,6 @@ #ifdef IVAS_FLOAT_FIXED /* Constants */ #define M 16 -#ifndef IVAS_FLOAT_FIXED -#define BFI_FAC 0.9f -#endif void lpc_unquantize_fx( Decoder_State *st, diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index d5498c622..6daf1f3b6 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -41,10 +41,6 @@ #include "rom_com.h" #include "prot.h" #include "wmc_auto.h" -#ifdef IVAS_FLOAT_FIXED -#include "prot_fx.h" -#include "ivas_prot_fx.h" -#endif #ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * evs_dec() diff --git a/lib_dec/gs_dec_amr_wb_fx.c b/lib_dec/gs_dec_amr_wb_fx.c index 5864c697c..d57411ff4 100644 --- a/lib_dec/gs_dec_amr_wb_fx.c +++ b/lib_dec/gs_dec_amr_wb_fx.c @@ -8,7 +8,7 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ - +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -274,7 +274,7 @@ static void gs_dec_amr_wb_fx( test(); test(); - IF( ( EQ_16( coder_type, INACTIVE ) || EQ_16( clas, VOICED_TRANSITION ) ) && LT_16( temp, 20 ) ) + IF( ( ( coder_type == INACTIVE ) || EQ_16( clas, VOICED_TRANSITION ) ) && LT_16( temp, 20 ) ) { FOR( i = 0; i < CRIT_NOIS_BAND; i++ ) { @@ -439,8 +439,8 @@ void improv_amr_wb_gs_fx( #else IF( ( locattack == 0 && LE_32( core_brate, ACELP_12k65 ) ) && ( ( LT_32( core_brate, ACELP_8k85 ) && NE_16( clas, AUDIO_CLAS ) && - ( clas == UNVOICED_CLAS || EQ_16( clas, VOICED_TRANSITION ) ) ) || - ( coder_type == INACTIVE ) ) ) + ( ( clas == UNVOICED_CLAS ) || EQ_16( clas, VOICED_TRANSITION ) ) ) || + ( EQ_16( coder_type, INACTIVE ) ) ) ) #endif { /*------------------------------------------------------------* @@ -455,7 +455,7 @@ void improv_amr_wb_gs_fx( test(); test(); test(); - IF( coder_type == INACTIVE && GT_16( Last_ener_fx, -3 * 256 ) && EQ_16( last_coder_type, UNVOICED ) && rate_switching_reset == 0 ) /* 3.0 x 256 to Go to Q8 */ + IF( EQ_16( coder_type, INACTIVE ) && GT_16( Last_ener_fx, -3 * 256 ) && EQ_16( last_coder_type, UNVOICED ) && rate_switching_reset == 0 ) /* 3.0 x 256 to Go to Q8 */ { FOR( i = 0; i < NB_SUBFR; i++ ) @@ -533,3 +533,4 @@ void improv_amr_wb_gs_fx( return; } +#endif diff --git a/lib_dec/hdecnrm_fx.c b/lib_dec/hdecnrm_fx.c index 28aeeceb4..2ecb3a3b5 100644 --- a/lib_dec/hdecnrm_fx.c +++ b/lib_dec/hdecnrm_fx.c @@ -5,7 +5,7 @@ #include "options.h" /* Compilation switches */ #include "prot_fx.h" #include "rom_dec.h" - +#ifdef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------*/ /* Function hdecnrm_fx */ /* ~~~~~~~~~~~~~~~~~~~~ */ @@ -393,3 +393,4 @@ move16(); return; } +#endif diff --git a/lib_dec/hq_env_dec_fx.c b/lib_dec/hq_env_dec_fx.c index db710413e..81385aaaa 100644 --- a/lib_dec/hq_env_dec_fx.c +++ b/lib_dec/hq_env_dec_fx.c @@ -36,11 +36,13 @@ Word16 decode_envelope_indices_fx( /* o : Number of b { LCmode = (Word16) get_next_indice_fx( st_fx, BITS_DE_HMODE ); difidx[start_norm] = (Word16) get_next_indice_fx( st_fx, BITS_DE_FCOMP ); + move16(); } ELSE { LCmode = (Word16) get_next_indice_fx( st_fx, 2 ); difidx[start_norm] = (Word16) get_next_indice_fx( st_fx, NORM0_BITS ); + move16(); } test(); diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 908738df3..4e4e2c3ba 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -41,10 +41,7 @@ #include "rom_com.h" #include "prot.h" #include "wmc_auto.h" -#ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" -#include "ivas_prot_fx.h" -#endif /*----------------------------------------------------------------------* * init_decoder() diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index bed5c11bb..a59d884e9 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -11,8 +11,6 @@ #include "prot.h" #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" -#endif -#ifdef IVAS_FLOAT_FIXED /*----------------------------------------------------------------------* * init_decoder() @@ -168,7 +166,7 @@ ivas_error init_decoder_fx( * HR SWB BWE parameters *-----------------------------------------------------------------*/ - IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) + IF( st_fx->element_mode == EVS_MONO ) { IF( ( st_fx->hBWE_FD_HR = (HR_BWE_DEC_HANDLE) malloc( sizeof( HR_BWE_DEC_DATA ) ) ) == NULL ) { @@ -625,7 +623,7 @@ ivas_error init_decoder_fx( * AMR-WB IO mode parameters *----------------------------------------------------------------------------------*/ test(); - IF( st_fx->Opt_AMR_WB || st_fx->element_mode == EVS_MONO ) + IF( st_fx->Opt_AMR_WB || ( st_fx->element_mode == EVS_MONO ) ) { IF( ( st_fx->hAmrwb_IO = (AMRWB_IO_DEC_HANDLE) malloc( sizeof( AMRWB_IO_DEC_DATA ) ) ) == NULL ) { @@ -841,7 +839,6 @@ ivas_error init_decoder_fx( /*----------------------------------------------------------------------------------* * Stereo/IVAS parameters *----------------------------------------------------------------------------------*/ -#if 1 // IVAS_CODE -> To be verified st_fx->tdm_LRTD_flag = 0; /* LRTD stereo mode flag */ move16(); st_fx->cna_dirac_flag = 0; /* CNA in DirAC flag */ @@ -858,10 +855,7 @@ ivas_error init_decoder_fx( move16(); st_fx->last_low_rate_mode = 0; /* low-rate mode flag */ move16(); - // st_fx->cng_ism_flag = 0; - // st_fx->coder_type = GENERIC; /* low-rate mode flag */ -#endif #ifdef DEBUGGING st_fx->id_element = -1; /* element ID */ #endif @@ -1229,7 +1223,7 @@ ivas_error init_decoder_ivas_fx( test(); test(); test(); - IF( idchan == 0 && ( EQ_16( st_fx->element_mode, EVS_MONO ) || EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) ) + IF( idchan == 0 && ( ( st_fx->element_mode == EVS_MONO ) || EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) ) ) { IF( ( st_fx->hTdCngDec = (TD_CNG_DEC_HANDLE) malloc( sizeof( TD_CNG_DEC_DATA ) ) ) == NULL ) { @@ -1261,7 +1255,7 @@ ivas_error init_decoder_ivas_fx( set32_fx( st_fx->delay_buf_out32_fx, 0, HQ_DELTA_MAX * HQ_DELAY_COMP ); set32_fx( st_fx->previoussynth_fx_32, 0, L_FRAME48k ); - IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) + IF( st_fx->element_mode == EVS_MONO ) { set16_fx( st_fx->old_synth_sw_fx, 0, NS2SA( 48000, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS ) ); } @@ -1279,7 +1273,7 @@ ivas_error init_decoder_ivas_fx( /* HQ core initialization */ HQ_core_dec_init_fx( st_fx->hHQ_core ); - IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) + IF( st_fx->element_mode == EVS_MONO ) { /* HQ NB FEC initialization */ IF( ( st_fx->hHQ_nbfec = (HQ_NBFEC_HANDLE) malloc( sizeof( HQ_NBFEC_DATA ) ) ) == NULL ) @@ -1394,7 +1388,7 @@ ivas_error init_decoder_ivas_fx( * AMR-WB IO mode parameters *----------------------------------------------------------------------------------*/ test(); - IF( st_fx->Opt_AMR_WB || EQ_16( st_fx->element_mode, EVS_MONO ) ) + IF( st_fx->Opt_AMR_WB || ( st_fx->element_mode == EVS_MONO ) ) { IF( ( st_fx->hAmrwb_IO = (AMRWB_IO_DEC_HANDLE) malloc( sizeof( AMRWB_IO_DEC_DATA ) ) ) == NULL ) { @@ -1530,7 +1524,7 @@ ivas_error init_decoder_ivas_fx( * SC-VBR parameters *-----------------------------------------------------------------*/ - IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) + IF( st_fx->element_mode == EVS_MONO ) { IF( ( st_fx->hSC_VBR = (SC_VBR_DEC_HANDLE) malloc( sizeof( SC_VBR_DEC_DATA ) ) ) == NULL ) { @@ -1664,7 +1658,7 @@ ivas_error init_decoder_ivas_fx( st_fx->hPlcInfo = NULL; } - IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) + IF( st_fx->element_mode == EVS_MONO ) { IF( ( st_fx->hTECDec = (TEC_DEC_HANDLE) malloc( sizeof( TEC_DEC_DATA ) ) ) == NULL ) { diff --git a/lib_dec/inov_dec_fx.c b/lib_dec/inov_dec_fx.c index 49461af4d..eb7134db5 100644 --- a/lib_dec/inov_dec_fx.c +++ b/lib_dec/inov_dec_fx.c @@ -90,12 +90,10 @@ void inov_decode_fx( IF( EQ_16( nBits, 8 ) ) { - // dec_acelp_1t64(st_fx, code, L_subfr); dec_acelp_1t64_fx( st_fx, code, L_subfr ); } ELSE { - // dec_acelp_fast(st_fx, nBits, code, L_subfr); dec_acelp_fast_fx( st_fx, nBits, code, L_subfr ); } } @@ -103,12 +101,10 @@ void inov_decode_fx( { IF( st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR] == 0 ) { - // dec_acelp_1t64(st_fx, code, L_SUBFR); dec_acelp_1t64_fx( st_fx, code, L_SUBFR ); } ELSE { - // dec_acelp_fast(st_fx, st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR], code, L_SUBFR); dec_acelp_fast_fx( st_fx, st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR], code, L_SUBFR ); } } @@ -197,7 +193,6 @@ void inov_decode_fx( return; } -#ifdef IVAS_FLOAT_FIXED /*======================================================================*/ /* FUNCTION : inov_decode_ivas_fx() */ /*-----------------------------------------------------------------------*/ @@ -263,7 +258,6 @@ void inov_decode_ivas_fx( IF( !Opt_AMR_WB ) { -#if 1 // def IVAS_CODE IF( st_fx->acelp_cfg.fcb_mode ) { Word16 i; @@ -280,12 +274,10 @@ void inov_decode_ivas_fx( IF( EQ_16( nBits, 8 ) ) { - // dec_acelp_1t64(st_fx, code, L_subfr); dec_acelp_1t64_fx( st_fx, code, L_subfr ); } ELSE { - // dec_acelp_fast(st_fx, nBits, code, L_subfr); dec_acelp_fast_fx( st_fx, nBits, code, L_subfr ); } } @@ -293,12 +285,10 @@ void inov_decode_ivas_fx( { IF( st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR] == 0 ) { - // dec_acelp_1t64(st_fx, code, L_SUBFR); dec_acelp_1t64_fx( st_fx, code, L_SUBFR ); } ELSE { - // dec_acelp_fast(st_fx, st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR], code, L_SUBFR); dec_acelp_fast_fx( st_fx, st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR], code, L_SUBFR ); } } @@ -327,7 +317,6 @@ void inov_decode_ivas_fx( } } ELSE -#endif { nBits = st_fx->acelp_cfg.fixed_cdk_index[i_subfr / L_SUBFR]; move16(); @@ -386,4 +375,3 @@ void inov_decode_ivas_fx( return; } #endif -#endif diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index 109c076dd..b677a0891 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -47,6 +47,10 @@ #include "prot_fx.h" #include "ivas_rom_com_fx.h" #include "debug.h" +#define NUM_TAPS_F0_6 ( Word16 )( 58 ) // (int16_t) ceil( 0.6f * hBinRenConvModule->numTaps ) +#define NUM_TAPS_F0_5 ( Word16 )( 48 ) // (int16_t) ceil( 0.5f * hBinRenConvModule->numTaps ) +#define NUM_TAPS_F0_4 ( Word16 )( 39 ) // (int16_t) ceil( 0.4f * hBinRenConvModule->numTaps ) +#define NUM_TAPS_F0_3 ( Word16 )( 29 ) // (int16_t) ceil( 0.3f * hBinRenConvModule->numTaps ) #endif #ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- @@ -242,11 +246,6 @@ static void ivas_binRenderer_filterModule_fx( * Open convolution module handle of fastconv binaural renderer *-------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -#define NUM_TAPS_F0_6 ( Word16 )( 58 ) // (int16_t) ceil( 0.6f * hBinRenConvModule->numTaps ) -#define NUM_TAPS_F0_5 ( Word16 )( 48 ) // (int16_t) ceil( 0.5f * hBinRenConvModule->numTaps ) -#define NUM_TAPS_F0_4 ( Word16 )( 39 ) // (int16_t) ceil( 0.4f * hBinRenConvModule->numTaps ) -#define NUM_TAPS_F0_3 ( Word16 )( 29 ) // (int16_t) ceil( 0.3f * hBinRenConvModule->numTaps ) - static ivas_error ivas_binRenderer_convModuleOpen( BINAURAL_RENDERER_HANDLE hBinRenderer, const Word16 renderer_type, diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 9565fe6b3..d2b3a69ff 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -949,7 +949,7 @@ static ivas_error ivas_dirac_rend_config_fx( test(); test(); test(); - IF( ( EQ_16( flag_config, DIRAC_OPEN ) && hDirAC->hConfig->dec_param_estim == TRUE ) || ( EQ_16( flag_config, DIRAC_RECONFIGURE ) && ( hDirAC->hConfig->dec_param_estim == TRUE && dec_param_estim_old == FALSE ) ) ) + IF( ( EQ_16( flag_config, DIRAC_OPEN ) && EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) ) || ( EQ_16( flag_config, DIRAC_RECONFIGURE ) && ( EQ_16( hDirAC->hConfig->dec_param_estim, TRUE ) && ( dec_param_estim_old == FALSE ) ) ) ) { hDirACRend->index_buffer_intensity = 0; move16(); @@ -975,7 +975,7 @@ static ivas_error ivas_dirac_rend_config_fx( set32_fx( hDirACRend->buffer_energy_fx, 0, DIRAC_NO_COL_AVG_DIFF * CLDFB_NO_CHANNELS_MAX ); set16_fx( hDirACRend->q_buffer_energy, Q31, DIRAC_NO_COL_AVG_DIFF ); } - ELSE IF( ( EQ_16( flag_config, DIRAC_OPEN ) && hDirAC->hConfig->dec_param_estim == FALSE ) || ( EQ_16( flag_config, DIRAC_RECONFIGURE ) && ( hDirAC->hConfig->dec_param_estim == FALSE && dec_param_estim_old == TRUE ) ) ) + ELSE IF( ( EQ_16( flag_config, DIRAC_OPEN ) && EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) ) || ( EQ_16( flag_config, DIRAC_RECONFIGURE ) && ( EQ_16( hDirAC->hConfig->dec_param_estim, FALSE ) && EQ_16( dec_param_estim_old, TRUE ) ) ) ) { FOR( i = 0; i < DIRAC_NUM_DIMS; i++ ) { @@ -1702,7 +1702,7 @@ ivas_error ivas_dirac_dec_config_fx( move16(); test(); test(); - IF( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_FOA && st_ivas->ivas_format == SBA_FORMAT && !hodirac_flag ) + IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_FOA ) && EQ_16( st_ivas->ivas_format, SBA_FORMAT ) && !hodirac_flag ) { sparfoa_flag = 1; move16(); @@ -1811,8 +1811,7 @@ ivas_error ivas_dirac_dec_config_fx( { IF( NE_16( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { - /*WIP*/ - IF( NE_32( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_dirac_dec_binaural_copy_hrtfs_fx( &st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) ) { return error; } @@ -3250,7 +3249,7 @@ void ivas_dirac_dec_set_md_map( test(); test(); test(); - IF( ( st_ivas->ivas_format != MASA_ISM_FORMAT || st_ivas->ism_mode != ISM_MASA_MODE_DISC ) && !( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) ) + IF( ( NE_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) || NE_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) && !( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) ) { st_ivas->hTcBuffer->nb_subframes = hSpatParamRendCom->nb_subframes; move16(); @@ -3404,7 +3403,7 @@ void ivas_dirac_dec_set_md_map_fx( test(); test(); test(); - IF( ( st_ivas->ivas_format != MASA_ISM_FORMAT || st_ivas->ism_mode != ISM_MASA_MODE_DISC ) && !( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) ) + IF( ( NE_16( st_ivas->ivas_format, MASA_ISM_FORMAT ) || NE_16( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) && !( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) ) { st_ivas->hTcBuffer->nb_subframes = hSpatParamRendCom->nb_subframes; move16(); diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index de856c872..41a206cdc 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -127,17 +127,17 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( FOR( idx = 0; idx < num_param_bands_residual; idx++ ) { - IF( ( h_dirac_output_synthesis_state->mixing_matrix_res_old_fx[idx] = (Word32 *) malloc( nchan_out * nchan_out * sizeof( Word32 ) ) ) == NULL ) + IF( ( h_dirac_output_synthesis_state->mixing_matrix_res_old_fx[idx] = (Word32 *) malloc( imult1616( nchan_out, nchan_out ) * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); } - set_zero_fx( h_dirac_output_synthesis_state->mixing_matrix_res_old_fx[idx], nchan_out * nchan_out ); + set_zero_fx( h_dirac_output_synthesis_state->mixing_matrix_res_old_fx[idx], imult1616( nchan_out, nchan_out ) ); - IF( ( h_dirac_output_synthesis_state->mixing_matrix_res_fx[idx] = (Word32 *) malloc( nchan_out * nchan_out * sizeof( Word32 ) ) ) == NULL ) + IF( ( h_dirac_output_synthesis_state->mixing_matrix_res_fx[idx] = (Word32 *) malloc( imult1616( nchan_out, nchan_out ) * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) ); } - set_zero_fx( h_dirac_output_synthesis_state->mixing_matrix_res_fx[idx], nchan_out * nchan_out ); + set_zero_fx( h_dirac_output_synthesis_state->mixing_matrix_res_fx[idx], imult1616( nchan_out, nchan_out ) ); h_dirac_output_synthesis_state->mixing_matrix_res_len = i_mult( nchan_out, nchan_out ); } FOR( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) @@ -195,7 +195,7 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( { h_dirac_output_synthesis_params->interpolator_fx[idx - 1] = div_s( idx, interp_length ); } - Copy32( proto_matrix, h_dirac_output_synthesis_params->proto_matrix_fx, nchan_in * nchan_out ); + Copy32( proto_matrix, h_dirac_output_synthesis_params->proto_matrix_fx, imult1616( nchan_in, nchan_out ) ); h_dirac_output_synthesis_params->proto_matrix_e = 5; move16(); return IVAS_ERR_OK; @@ -792,8 +792,8 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( move16(); imag_in_e = ImagBuffer_e; move16(); - shift_real = sub( L_norm_arr( real_in_buffer_fx, num_bands * nchan_in ), find_guarded_bits_fx( num_bands + 1 ) ); - shift_imag = sub( L_norm_arr( imag_in_buffer_fx, num_bands * nchan_in ), find_guarded_bits_fx( num_bands + 1 ) ); + 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 ); @@ -1498,7 +1498,6 @@ Word16 computeMixingMatrices_fx( Word32 adj_fx[MAX_OUTPUT_CHANNELS]; Word16 adj_e[MAX_OUTPUT_CHANNELS]; Word32 *adj_fx_p; - // Word32 adj_buff_fx[MAX_OUTPUT_CHANNELS]; Word16 adj_fx_e; Word32 *Cr_p_fx, *Cy_tilde_p_fx, *Cy_p_fx; @@ -2878,7 +2877,6 @@ Word16 computeMixingMatricesISM_fx( temp_e[i] = 0; move16(); } - // G_hat[i] = sqrtf( Cy_diag[i] / Cy_hat_diag[i] ); } G_hat_e = temp_e[0]; move16(); @@ -2993,7 +2991,6 @@ Word16 computeMixingMatricesISM_fx( } } - // if ( adj[i] > 4.0f ) IF( BASOP_Util_Cmp_Mant32Exp( adj_fx[i], temp_e[i], MAX_32, 2 ) > 0 ) { adj_fx[i] = MAX_32; diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 853a93d83..168cb4fa1 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2740,7 +2740,7 @@ ivas_error ivas_init_decoder_fx( { IF( NE_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) ) { - IF( NE_32( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_dirac_dec_binaural_copy_hrtfs_fx( &st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 7a1494764..d33c88eed 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -269,7 +269,7 @@ void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( { IF( EQ_16( ch, sce_id_dtx ) ) { - continue; + CONTINUE; } hFdCngCom = hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom; cng_noise_level_len = sub( hFdCngCom->stopFFTbin, hFdCngCom->startBand ); @@ -277,9 +277,9 @@ void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( cng_noise_nrg_obj_fx = dotp_fixed_o( hFdCngCom->cngNoiseLevel, hFdCngCom->cngNoiseLevel, cng_noise_level_len, 9, &Q_cng_noise_nrg_obj ); /*Resultant Q_cng_noise_nrg_obj= (Q_cng_noise_nrg_obj-x)<=31*/ IF( GT_32( cng_noise_nrg_obj_fx, cng_noise_nrg_dominant_fx ) ) { - Word32 temp = divide3232( L_shr( cng_noise_nrg_dominant_fx, 1 ), cng_noise_nrg_obj_fx ); /*Stores value of cng_noise_nrg_dominant_fx/cng_noise_nrg_obj_fx*/ - Word16 Q_temp = Q_cng_noise_nrg_dominant - 1 - Q_cng_noise_nrg_obj + 15; /*Stores resultant Q after divide3232 operation above*/ - IF( Q_temp % 2 == 1 ) /*Making Q_temp even for sqrt function*/ + Word32 temp = divide3232( L_shr( cng_noise_nrg_dominant_fx, 1 ), cng_noise_nrg_obj_fx ); /*Stores value of cng_noise_nrg_dominant_fx/cng_noise_nrg_obj_fx*/ + Word16 Q_temp = add( sub( sub( Q_cng_noise_nrg_dominant, 1 ), Q_cng_noise_nrg_obj ), 15 ); /*Stores resultant Q after divide3232 operation above*/ + IF( EQ_16( Q_temp % 2, 1 ) ) /*Making Q_temp even for sqrt function*/ { Q_temp = sub( Q_temp, 1 ); temp = L_shr( temp, 1 ); @@ -287,7 +287,7 @@ void ivas_ism_dtx_limit_noise_energy_for_near_silence_fx( fac_fx = getSqrtWord32( temp ); /*Resultant Q=Q_temp/2*/ Q_fac = shr( Q_temp, 1 ); v_multc_fixed( hFdCngCom->cngNoiseLevel, fac_fx, hFdCngCom->cngNoiseLevel, cng_noise_level_len ); /*Resultant Q of cngNoiseLevel is Q_cngNoiseLevel for ch*/ - scale_sig32( hFdCngCom->cngNoiseLevel, cng_noise_level_len, negate( 31 - Q_fac ) ); /*Restoring Q of hFdCngCom->cngNoiseLevel to Q_cngNoiseLevel */ + scale_sig32( hFdCngCom->cngNoiseLevel, cng_noise_level_len, negate( sub( 31, Q_fac ) ) ); /*Restoring Q of hFdCngCom->cngNoiseLevel to Q_cngNoiseLevel */ } } } diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 8f3576ff3..cdd469225 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -113,6 +113,9 @@ ivas_error ivas_ism_renderer_open( } #else +#define SIN_NEG_30_DEGREES_Q15 ( (Word16) 0xC000 ) +#define SIN_30_DEGREES_Q15 ( (Word16) 0x4000 ) + ivas_error ivas_ism_renderer_open_fx( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) @@ -508,9 +511,6 @@ void ivas_ism_render_sf_fx( *-------------------------------------------------------------------------*/ #ifdef IVAS_FLOAT_FIXED -#define SIN_NEG_30_DEGREES_Q15 ( (Word16) 0xC000 ) -#define SIN_30_DEGREES_Q15 ( (Word16) 0x4000 ) - void ivas_ism_get_stereo_gains_fx( const Word16 aziDeg, /* i : object azimuth */ const Word16 eleDeg, /* i : object elevation */ @@ -541,9 +541,7 @@ void ivas_ism_get_stereo_gains_fx( { azSubEl = add( azSubEl, 360 ); } - // sin_az_cos_el = (ptr_sin_az[azAddEl] + ptr_sin_az[azSubEl])/2; Word16 sin_az_cos_el = extract_l( L_shr( L_add( L_deposit_l( ptr_sin_az[azAddEl + 180] ), L_deposit_l( ptr_sin_az[azSubEl + 180] ) ), 1 ) ); - // Word16 sin_az_cos_el = extract_l( L_shr( L_add( L_deposit_l( ptr_sin_az[azAddEl] ), L_deposit_l( ptr_sin_az[azSubEl] ) ), 1 ) ); IF( GE_16( sin_az_cos_el, SIN_30_DEGREES_Q15 ) ) { /* Left side */ @@ -704,11 +702,8 @@ ivas_error ivas_omasa_separate_object_renderer_open( move16(); st_ivas->hIsmRendererData->interpolator_fx = (Word16 *) malloc( sizeof( Word16 ) * init_interpolator_length ); - -#if 1 /*TODO: To be removed later: Stores length of interpolator_fx*/ st_ivas->hIsmRendererData->interpolator_len = init_interpolator_length; move16(); -#endif FOR( i = 0; i < interpolator_length; i++ ) { st_ivas->hIsmRendererData->interpolator_fx[i] = div_s( i, interpolator_length ); @@ -1053,6 +1048,7 @@ void ivas_omasa_separate_object_render_jbm_fx( FOR( obj = 0; obj < num_objects; obj++ ) { input_fx[obj] = &st_ivas->hTcBuffer->tc_fx[obj + 2][offsetSamples]; + move32(); } } ELSE @@ -1060,6 +1056,7 @@ void ivas_omasa_separate_object_render_jbm_fx( FOR( obj = 0; obj < num_objects; obj++ ) { input_fx[obj] = input_fx_in[obj]; + move32(); } } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index c8771a8db..7246f4010 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -329,9 +329,9 @@ ivas_error ivas_param_mc_dec_open_fx( hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; move16(); #ifndef FIX_901_PARAMMC_DEAD_CODE - ivas_param_mc_metadata_open( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); + ivas_param_mc_metadata_open_fx( 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 ); + ivas_param_mc_metadata_open_fx( mc_ls_setup, ivas_total_brate, hParamMC->hMetadataPMC ); #endif /* init arrays for quantized parameters */ @@ -1229,9 +1229,9 @@ ivas_error ivas_param_mc_dec_reconfig_fx( #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( mc_ls_setup, hTransportSetup.index_lfe[0], ivas_total_brate, hParamMC->hMetadataPMC ); + ivas_param_mc_metadata_open_fx( 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 ); + 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 ) ) diff --git a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c index 1088e44c0..3804609bf 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec_fx.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec_fx.c @@ -64,10 +64,14 @@ Word16 ivas_get_sba_dirac_stereo_flag( output_config = st_ivas->hDecoderConfig->output_config; move16(); + test(); + test(); IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) || ( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) ) { IF( EQ_16( st_ivas->ivas_format, SBA_FORMAT ) ) { + test(); + test(); if ( EQ_16( output_config, IVAS_AUDIO_CONFIG_STEREO ) || ( EQ_16( output_config, IVAS_AUDIO_CONFIG_MONO ) && EQ_16( st_ivas->nchan_transport, 1 ) ) ) { sba_dirac_stereo_flag = 1; @@ -76,6 +80,7 @@ Word16 ivas_get_sba_dirac_stereo_flag( } ELSE { + test(); if ( EQ_16( st_ivas->nchan_transport, 1 ) && EQ_16( output_config, IVAS_AUDIO_CONFIG_STEREO ) ) { sba_dirac_stereo_flag = 1; diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 8c2ee04ba..c2b77519f 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -41,9 +41,6 @@ #include "ivas_prot.h" #include "ivas_rom_com.h" #include "wmc_auto.h" -#ifdef IVAS_FLOAT_FIXED -#include "ivas_prot_fx.h" -#endif #ifndef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* diff --git a/lib_dec/ivas_sns_dec_fx.c b/lib_dec/ivas_sns_dec_fx.c index ff96b6c06..aa6906fb5 100644 --- a/lib_dec/ivas_sns_dec_fx.c +++ b/lib_dec/ivas_sns_dec_fx.c @@ -41,9 +41,7 @@ #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" -#ifdef IVAS_FLOAT_FIXED #include "ivas_rom_com_fx.h" -#endif /*------------------------------------------------------------------- * sns_1st_dec_fx() diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 29664009e..728709de5 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -1176,7 +1176,7 @@ static void stereo_dft_generate_comfort_noise_fx( tmp32_1 = *ptr_shb; move32(); q_shift = norm_l( tmp32_1 ); - if ( GT_16( q_shift, sub( 31, q_shb_shape ) ) ) + IF( GT_16( q_shift, sub( 31, q_shb_shape ) ) ) { q_shift = sub( 31, q_shb_shape ); } @@ -1197,7 +1197,7 @@ static void stereo_dft_generate_comfort_noise_fx( /* rescale */ tmp32_1 = L_mult0( scale, shr( output_frame, 1 ) ); q_shift = norm_l( tmp32_1 ); - if ( GT_16( q_shift, add( Q16, q_div ) ) ) + IF( GT_16( q_shift, add( Q16, q_div ) ) ) { q_shift = add( Q16, q_div ); } diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec.c b/lib_dec/ivas_stereo_mdct_stereo_dec.c index a745752bd..d0fefa50c 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec.c @@ -963,9 +963,6 @@ ivas_error initMdctStereoDtxData_fx( } /* Init FD-CNG */ -#if 1 /*TODO: To be removed later*/ - initFdCngDec( st ); -#endif initFdCngDec_ivas_fx( st, st->cldfbSyn->scale ); } diff --git a/lib_dec/lead_deindexing.c b/lib_dec/lead_deindexing.c index 158de754e..b21446a5c 100644 --- a/lib_dec/lead_deindexing.c +++ b/lib_dec/lead_deindexing.c @@ -45,7 +45,7 @@ /*-------------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void fcb_decode_pos( const int16_t index, int16_t pos_vector[], const int16_t pulse_num, const int16_t pos_num ); @@ -278,3 +278,4 @@ static void fcb_decode_pos( return; } +#endif diff --git a/lib_dec/lead_deindexing_fx.c b/lib_dec/lead_deindexing_fx.c index 80508277f..068d60bb1 100644 --- a/lib_dec/lead_deindexing_fx.c +++ b/lib_dec/lead_deindexing_fx.c @@ -8,7 +8,7 @@ #include "rom_com.h" #include "rom_dec.h" #include "prot_fx.h" - +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * Local function prototype *-------------------------------------------------------------------*/ @@ -294,3 +294,4 @@ static void fcb_decode_pos_fx( pos_vector[i] = add( l, k ); move16(); } +#endif diff --git a/lib_dec/lp_exc_d.c b/lib_dec/lp_exc_d.c index 99ccd578a..9644c50d1 100644 --- a/lib_dec/lp_exc_d.c +++ b/lib_dec/lp_exc_d.c @@ -40,6 +40,8 @@ #include "prot.h" #include "wmc_auto.h" +#ifndef IVAS_FLOAT_FIXED + /*---------------------------------------------------------------------* * lp_filt_exc_dec() * @@ -98,3 +100,4 @@ void lp_filt_exc_dec( return; } +#endif diff --git a/lib_dec/lp_exc_d_fx.c b/lib_dec/lp_exc_d_fx.c index 56deb5dd5..e0bcb2c60 100644 --- a/lib_dec/lp_exc_d_fx.c +++ b/lib_dec/lp_exc_d_fx.c @@ -6,6 +6,7 @@ #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ #include "prot_fx.h" /* Function prototypes */ +#ifdef IVAS_FLOAT_FIXED /*======================================================================*/ /* FUNCTION : lp_filt_exc_dec_fx() */ @@ -85,3 +86,4 @@ void lp_filt_exc_dec_fx( Copy( code, &exc[i_subfr], L_subfr ); } } +#endif diff --git a/lib_dec/lsf_dec_fx.c b/lib_dec/lsf_dec_fx.c index 4d9a93586..5d7313b21 100644 --- a/lib_dec/lsf_dec_fx.c +++ b/lib_dec/lsf_dec_fx.c @@ -9,7 +9,6 @@ #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_rom_com.h" #endif #ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* diff --git a/lib_dec/lsf_msvq_ma_dec_fx.c b/lib_dec/lsf_msvq_ma_dec_fx.c index 3fc69d588..167f71d4d 100644 --- a/lib_dec/lsf_msvq_ma_dec_fx.c +++ b/lib_dec/lsf_msvq_ma_dec_fx.c @@ -10,6 +10,7 @@ #include "basop_util.h" #include "rom_com.h" +#ifdef IVAS_FLOAT_FIXED #ifndef swap #define swap( x, y, type ) \ { \ @@ -302,3 +303,4 @@ Word16 dec_lsf_tcxlpc( } return sub( st->next_bit_pos, start_bit_pos ); } +#endif diff --git a/lib_dec/nelp_dec_fx.c b/lib_dec/nelp_dec_fx.c index b873d398d..c6714cb6d 100644 --- a/lib_dec/nelp_dec_fx.c +++ b/lib_dec/nelp_dec_fx.c @@ -27,6 +27,7 @@ /* RETURN ARGUMENTS : */ /* _ None */ /*===================================================================*/ +#ifdef IVAS_FLOAT_FIXED static void normalize_arr( Word16 *arr, Word16 *qf, Word16 size, Word16 hdr ) { Word16 i; @@ -424,3 +425,4 @@ void nelp_decoder_fx( Decoder_State *st_fx, Word16 *exc_nelp, Word16 *exc, Word1 set16_fx( gain_buf, 0, NB_SUBFR16k ); return; } +#endif diff --git a/lib_dec/peak_vq_dec_fx.c b/lib_dec/peak_vq_dec_fx.c index 5658d7ef1..d5a5073fe 100644 --- a/lib_dec/peak_vq_dec_fx.c +++ b/lib_dec/peak_vq_dec_fx.c @@ -8,7 +8,7 @@ #include "rom_com.h" #include "enh64.h" - +#ifdef IVAS_FLOAT_FIXED #define PK_VQ_NOISE_DELTA ( (Word16) 3277 ) /* 0.1 in Q15 */ /*------------------------------------------------------------------------* @@ -115,16 +115,6 @@ static void peak_vq_dec_fx( assert( ( core_brate > HQ_16k40 && core_brate <= HQ_48k ) && "HVQ rate not supported" ); // PMT("max_peaks equation needs to be converted") max_peaks = extract_l( Mpy_32_32( ( L_add( imult3216( core_brate, HVQ_PEAKS_PER_DELTA ), HVQ_PEAKS_PER_DELTA_OFFS ) ), 282564 ) ); /* 1 / HVQ_PEAKS_BPS_DELTA in Q31 = 282564*/ - /*max_peaks = ((core_brate * HVQ_PEAKS_PER_DELTA / HVQ_PEAKS_BPS_DELTA + HVQ_PEAKS_PER_DELTA_OFFS / HVQ_PEAKS_BPS_DELTA) );*/ -#if 0 - { -#define INV_HVQ_PEAKS_BPS_DELTA_Q31 ( Word32 )( ( 1.0f / HVQ_PEAKS_BPS_DELTA ) * ( 1 << 31 ) ) -#define DELTAINV_HVQ_PEAKS_BPS_DELTA_Q31 ( Word32 )( ( (float) HVQ_PEAKS_PER_DELTA / HVQ_PEAKS_BPS_DELTA ) * ( 1 << 31 ) ) - - max_peaks = W_round32_s(W_add(W_mult_32_32(HVQ_PEAKS_PER_DELTA_OFFS, INV_HVQ_PEAKS_BPS_DELTA_Q31), W_mult_32_32(core_brate, DELTAINV_HVQ_PEAKS_BPS_DELTA_Q31))); - printf("Fixed point code needed to be completed"); - } -#endif bin_th = HVQ_THRES_BIN_24k; move16(); bin_th2 = HVQ_THRES_BIN_24k / HVQ_NF_GROUPS; @@ -626,3 +616,4 @@ static Word16 sparse_dec_pos_fx( return bits; } +#endif diff --git a/lib_dec/pit_dec_fx.c b/lib_dec/pit_dec_fx.c index f99c8ac16..7acfa264d 100644 --- a/lib_dec/pit_dec_fx.c +++ b/lib_dec/pit_dec_fx.c @@ -8,7 +8,7 @@ #include "cnst.h" #include "prot_fx.h" #include "rom_com.h" - +#ifdef IVAS_FLOAT_FIXED #define inv_T0_res InvIntTable /*----------------------------------------------------------* @@ -1294,3 +1294,4 @@ void delta_pit_dec_fx( return; } +#endif diff --git a/lib_dec/pitch_extr_fx.c b/lib_dec/pitch_extr_fx.c index 9b42a9b57..4831d087c 100644 --- a/lib_dec/pitch_extr_fx.c +++ b/lib_dec/pitch_extr_fx.c @@ -9,7 +9,7 @@ #include "cnst.h" #include "prot_fx.h" #include "basop_util.h" - +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * - num x 32768 @@ -31,17 +31,17 @@ void pitch_pred_linear_fit( /* i: bfi counter */ /*Q0 */ const Word16 /*short*/ last_good, /* i: last classification type */ /*Q0 */ - Word32 /*float*/ *old_pitch_buf, + Word32 /*Word32*/ *old_pitch_buf, /* i: pitch lag buffer */ /*Q16*/ - Word32 /*float*/ *old_fpitch, + Word32 /*Word32*/ *old_fpitch, /* i: */ /*Q16*/ - Word32 /*float*/ *T0_out, + Word32 /*Word32*/ *T0_out, /* o: estimated close loop pitch */ /*Q16*/ Word16 /* int*/ pit_min, /* i: Minimum pitch lag */ /*Q0 */ Word16 /* int*/ pit_max, /* i: Maximum pitch lag */ /*Q0 */ - Word16 /*float*/ *mem_pitch_gain, + Word16 /*Word16*/ *mem_pitch_gain, /* i: pitch gain [0] is the most recent subfr gain */ /*Q14*/ Word16 /* int*/ limitation, Word16 /*short*/ plc_use_future_lag, @@ -348,3 +348,4 @@ void get_subframe_pitch( move32(); } } +#endif diff --git a/lib_dec/post_dec_fx.c b/lib_dec/post_dec_fx.c index 071bc5188..14ea5b9e3 100644 --- a/lib_dec/post_dec_fx.c +++ b/lib_dec/post_dec_fx.c @@ -42,13 +42,6 @@ void post_decoder( Word16 coder_type = st->coder_type; move16(); - // if (st->hPFstat != NULL || st->hBPF == NULL) - // { - //#ifdef DEBUGGING - // IVAS_ERROR(IVAS_ERR_INTERNAL, "ERROR::: In function post_decoder, at least one post filter handle is not initialized, at frame %d\n", frame); - //#endif - // return; - // } hBPF = st->hBPF; L_frame = st->L_frame; move16(); @@ -179,7 +172,6 @@ void post_decoder( return; } -#ifdef IVAS_FLOAT_FIXED void post_decoder_ivas_fx( Decoder_State *st, Word16 synth_buf[], @@ -344,7 +336,6 @@ void post_decoder_ivas_fx( return; } -#endif /*---------------------------------------------------------------------* * bass_pf_1sf_delay() diff --git a/lib_dec/ppp_dec_fx.c b/lib_dec/ppp_dec_fx.c index 7d8bcb005..88cc99e2c 100644 --- a/lib_dec/ppp_dec_fx.c +++ b/lib_dec/ppp_dec_fx.c @@ -6,6 +6,7 @@ #include "options.h" #include "prot_fx.h" #include "rom_com.h" +#ifdef IVAS_FLOAT_FIXED /*===================================================================*/ /* FUNCTION : struct DTFS_fx::dequant_cw_fx () */ @@ -368,3 +369,4 @@ ivas_error ppp_quarter_decoder_fx( free( PREVDTFS_FX ); return error; } +#endif diff --git a/lib_dec/pvq_core_dec_fx.c b/lib_dec/pvq_core_dec_fx.c index cf904fac6..8584ea63e 100644 --- a/lib_dec/pvq_core_dec_fx.c +++ b/lib_dec/pvq_core_dec_fx.c @@ -9,7 +9,6 @@ #include "rom_com.h" /* Static table prototypes */ #ifdef IVAS_FLOAT_FIXED #include "ivas_prot_fx.h" -#endif /*-------------------------------------------------------------------* * Local prototypes @@ -204,7 +203,6 @@ void pvq_decode_frame_fx( * *-------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED Word16 ivas_pvq_core_dec_fx( Decoder_State *st_fx, const Word16 *sfm_start, @@ -283,7 +281,6 @@ Word16 ivas_pvq_core_dec_fx( return bits_tot; } -#endif Word16 pvq_core_dec_fx( Decoder_State *st_fx, @@ -663,3 +660,4 @@ static Word16 get_pvq_splits_fx( /* o : Number of segme Np = s_min( sfmsize, Np ); /* The code line assumes that MIN_BAND_SIZE is 1 */ return Np; } +#endif diff --git a/lib_dec/pvq_decode_fx.c b/lib_dec/pvq_decode_fx.c index 24aa0cfac..12170735f 100644 --- a/lib_dec/pvq_decode_fx.c +++ b/lib_dec/pvq_decode_fx.c @@ -4,6 +4,7 @@ #include #include "options.h" /* Compilation switches */ +#ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" #include "rom_com.h" @@ -35,6 +36,7 @@ void pvq_decode_fx( UWord16 u16_tmp; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move16(); #endif entry = get_size_mpvq_calc_offset_fx( dim, k_val, h_mem ); /* get size & prepare H(adaptive table for entry.size=N_MPVQ(dim,k_val) */ @@ -101,6 +103,7 @@ void pvq_decode_fx( #ifdef BASOP_NOGLOB L_tmp = L_shr_o( L_tmp, shift_tot, &Overflow ); xq[i] = round_fx_o( L_tmp, &Overflow ); /* Q15 , array move */ + move16(); #else L_tmp = L_shr( L_tmp, shift_tot ); xq[i] = round_fx( L_tmp ); /* Q15 , array move */ @@ -111,3 +114,4 @@ void pvq_decode_fx( return; } +#endif diff --git a/lib_dec/range_dec_fx.c b/lib_dec/range_dec_fx.c index 960662e76..e53e5cc58 100644 --- a/lib_dec/range_dec_fx.c +++ b/lib_dec/range_dec_fx.c @@ -6,6 +6,7 @@ #include "options.h" /* Compilation switches */ #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ +#ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" /* Function prototypes */ @@ -222,3 +223,4 @@ static Word16 rc_dec_read_fx( return get_next_indice_fx( st_fx, 8 ); } } +#endif diff --git a/lib_dec/re8_dec.c b/lib_dec/re8_dec.c index a66c9036c..88a8b51e2 100644 --- a/lib_dec/re8_dec.c +++ b/lib_dec/re8_dec.c @@ -39,7 +39,7 @@ #include "prot.h" #include "wmc_auto.h" - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------- re8_dec(n, I, k, y) @@ -103,3 +103,4 @@ void re8_dec( return; } +#endif diff --git a/lib_dec/re8_dec_fx.c b/lib_dec/re8_dec_fx.c index e6c35e293..fbc76f67d 100644 --- a/lib_dec/re8_dec_fx.c +++ b/lib_dec/re8_dec_fx.c @@ -4,6 +4,7 @@ #include #include "options.h" /* Compilation switches */ +#ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" /* Function prototypes */ /*-------------------------------------------------------------------------- @@ -70,3 +71,4 @@ void re8_dec_fx( return; } +#endif diff --git a/lib_dec/rom_dec.c b/lib_dec/rom_dec.c index 8a2169f80..8ae4a7462 100644 --- a/lib_dec/rom_dec.c +++ b/lib_dec/rom_dec.c @@ -46,7 +46,9 @@ * construction after frame error concealment *----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED const float h_low[5] = { -0.0125f, 0.1090f, 0.7813f, 0.1090f, -0.0125f }; +#endif const Word16 h_low_fx[5] = { -410, 3572, 25602, 3572, -410 @@ -91,10 +93,10 @@ const Word16 sqi[15] = 256 /* 16 */ }; /* RE8 related tables */ -const int16_t mult_avq_tab[7] = {1,1,1,342,1,1,171}; -const int16_t shift_avq_tab[7] = {0,0,1, 10,2,0, 10}; +const Word16 mult_avq_tab[7] = {1,1,1,342,1,1,171}; +const Word16 shift_avq_tab[7] = {0,0,1, 10,2,0, 10}; -const int16_t hntable[55]= +const Word16 hntable[55]= { 0X13, -0X10, -0X0F, -0X11, 0X51, 0X61, -0X0E, -0X12, 0X51, 0X61, -0X13, -0X0D, 0X51, 0X62, -0X14, 0X81, -0X0C, 0X81, -0X15, -0X17, @@ -104,7 +106,7 @@ const int16_t hntable[55]= 0X11, -0X02, 0X11, -0X01, 0X00 }; -const int16_t hetable[57]= +const Word16 hetable[57]= { 0X12, 0X41, -0X0F, 0X41, -0X10, -0X0E, 0X31, -0X11, 0X31, 0X41, -0X0D, 0X41, -0X12, 0X42, -0x0C, 0X61, -0X13, 0X61, 0X71, -0X0A, @@ -114,17 +116,19 @@ const int16_t hetable[57]= 0X11, 0X00, 0X11, -0X1D, 0X11, -0X1E, -0X1F }; -const int16_t hestable[15]= +const Word16 hestable[15]= { 0X11, 0X21, -0X04, 0X21, -0X03, 0X21, -0X02, -0X05, 0X11, 0X21, -0X01, -0X06, 0X11, -0X07, -0X00 }; +#ifndef IVAS_FLOAT_FIXED const float lsf_tab[LPC_SHB_ORDER] = { 0.070633653f, 0.11962059f, 0.16925794f, 0.20627696f, 0.24345790f, 0.31293656f, 0.34594478f, 0.38072862f, 0.410051247f, 0.44525622f }; +#endif const Word16 lsf_tab_fx[LPC_SHB_ORDER] = { 2315, 3920, 5546, 6759, 7978, @@ -145,7 +149,7 @@ const Word16 POW_ATT_TABLE1[OFF_FRAMES_LIMIT + 1] = }; /* frequency group start bins for transient analysis */ /* 125 375 750 1250 2000 4000 8000 16000 24000 */ -const int16_t gw[LGW_MAX] = { 1, 3, 6, 10, 16, 32, 64, 128, 192 }; +const Word16 gw[LGW_MAX] = { 1, 3, 6, 10, 16, 32, 64, 128, 192 }; const Word16 gw_fx[LGW_MAX] = { 1, 3, 6, 10, 16, 32, 64, 128, 192 }; /* frequency group start bins for transient analysis */ const Word16 gw_len_inv_fx[LGW_MAX - 1] = /* Q15 */ @@ -158,8 +162,9 @@ const Word16 GR_POW_HEADROOM[LGW_MAX] = /* in Q0-- Number of bits down-shiftin 0, 0, 1, 2, 2, 3, 4, 4, 4 }; /* 31.25 343.75 718.75 1218.75 1968.75 4000 8000 16000 24000 */ -const int16_t ivas_gwlpr[LGW_MAX] = { 1, 3*QUOT_LPR_LTR-1, 6*QUOT_LPR_LTR-1, 10*QUOT_LPR_LTR-1, 16*QUOT_LPR_LTR-1, 32*QUOT_LPR_LTR, 64*QUOT_LPR_LTR, 128*QUOT_LPR_LTR, 192*QUOT_LPR_LTR }; +const Word16 ivas_gwlpr[LGW_MAX] = { 1, 3*QUOT_LPR_LTR-1, 6*QUOT_LPR_LTR-1, 10*QUOT_LPR_LTR-1, 16*QUOT_LPR_LTR-1, 32*QUOT_LPR_LTR, 64*QUOT_LPR_LTR, 128*QUOT_LPR_LTR, 192*QUOT_LPR_LTR }; +#ifndef IVAS_FLOAT_FIXED const float w_hamm48k_2[L_TRANA48k/2] = { 0.080000000000000f, 0.080061898522781f, 0.080247577432747f, 0.080556986759243f, 0.080990043232791f, 0.081546630307495f, 0.082226598192408f, 0.083029763891845f, @@ -219,6 +224,7 @@ const float w_hamm16k_2[L_TRANA16k/2] = 0.871247419904816f, 0.886626693045890f, 0.901157712584333f, 0.914804918680351f, 0.927534914333744f, 0.939316547111965f, 0.950120985385339f, 0.959921788882895f, 0.968694973396140f, 0.976419069472435f, 0.983075174954342f, 0.988647001236375f, 0.993120913125941f, 0.996485962210947f, 0.998733913652397f, 0.999859266336418f }; +#endif const Word16 w_hamm48k_2_fx[L_TRANA48k / 2] = { diff --git a/lib_dec/rom_dec.h b/lib_dec/rom_dec.h index dca09eedf..908a7f289 100644 --- a/lib_dec/rom_dec.h +++ b/lib_dec/rom_dec.h @@ -41,7 +41,9 @@ #include "options.h" #include "cnst.h" +#ifndef IVAS_FLOAT_FIXED extern const float h_low[]; /* LP filter for filtering periodic part of excitation in artificial onset construction after FEC */ +#endif extern const Word16 h_low_fx[5]; extern const Word16 inv_sqi[15]; extern const Word16 sqi[15]; @@ -51,8 +53,9 @@ extern const int16_t shift_avq_tab[]; extern const int16_t hntable[55]; extern const int16_t hetable[57]; extern const int16_t hestable[15]; - +#ifndef IVAS_FLOAT_FIXED extern const float lsf_tab[LPC_SHB_ORDER]; +#endif extern const Word16 lsf_tab_fx[LPC_SHB_ORDER]; extern const Word16 POW_ATT_TABLE0[]; @@ -62,9 +65,11 @@ extern const Word16 gw_fx[LGW_MAX]; extern const Word16 gw_len_inv_fx[LGW_MAX - 1]; extern const Word16 GR_POW_HEADROOM[]; extern const int16_t ivas_gwlpr[LGW_MAX]; +#ifndef IVAS_FLOAT_FIXED extern const float w_hamm48k_2[L_TRANA48k / 2]; extern const float w_hamm32k_2[L_TRANA32k / 2]; extern const float w_hamm16k_2[L_TRANA16k / 2]; +#endif extern const Word16 w_hamm48k_2_fx[]; extern const Word16 w_hamm32k_2_fx[]; extern const Word16 w_hamm16k_2_fx[]; diff --git a/lib_dec/rst_dec_fx.c b/lib_dec/rst_dec_fx.c index 50aa1b906..f348b56bc 100644 --- a/lib_dec/rst_dec_fx.c +++ b/lib_dec/rst_dec_fx.c @@ -6,6 +6,7 @@ #include "stl.h" #include "cnst.h" /* Common constants */ #include "rom_com.h" /* Static table prototypes */ +#ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" /* Function prototypes */ /*----------------------------------------------------------------------------------* @@ -92,3 +93,4 @@ void CNG_reset_dec_fx( return; } +#endif diff --git a/lib_dec/swb_bwe_dec.c b/lib_dec/swb_bwe_dec.c index 967070b78..798a022a3 100644 --- a/lib_dec/swb_bwe_dec.c +++ b/lib_dec/swb_bwe_dec.c @@ -254,10 +254,6 @@ static Word16 para_pred_bws_fx( { mag_fx = abs_s( *input_hi_fx ); peak_fx = s_max( peak_fx, mag_fx ); - /*IF (sub(mag_fx, peak_fx) > 0) */ - /*{ */ - /* peak_fx = mag_fx; */ - /*} */ mean_fx[i] = L_add( mean_fx[i], L_deposit_l( mag_fx ) ); move32(); input_hi_fx++; @@ -325,14 +321,6 @@ static Word16 para_pred_bws_fx( } min_fx = L_min( min_fx, mean_fx[i] ); peak_32_fx = L_max( peak_32_fx, mean_fx[i] ); - /*IF(L_sub(mean_fx[i], min_fx) < 0) */ - /*{ */ - /* min_fx = mean_fx[i]; */ - /*} */ - /*IF(L_sub(mean_fx[i], peak_32_fx) > 0) */ - /*{ */ - /* peak_32_fx = mean_fx[i]; */ - /*} */ } IF( GT_16( st_fx->tilt_wb_fx, 16384 ) ) @@ -427,13 +415,11 @@ static Word16 para_pred_bws_fx( test(); IF( NE_16( st_fx->prev_coder_type, coder_type ) && GT_16( mult_r( SWB_fenv_fx[i], 16384 ), st_fx->prev_SWB_fenv_fx[i] ) ) { - /*SWB_fenv_fx[i] = add(mult_r(SWB_fenv_fx[i], 3277), mult_r(st_fx->prev_SWB_fenv_fx[i], 29491)); */ SWB_fenv_fx[i] = round_fx( L_mac( L_mult( SWB_fenv_fx[i], 3277 ), st_fx->prev_SWB_fenv_fx[i], 29491 ) ); move16(); } ELSE { - /*SWB_fenv_fx[i] = add(mult_r(SWB_fenv_fx[i], st_fx->attenu_fx), mult_r(st_fx->prev_SWB_fenv_fx[i], sub(32767, st_fx->attenu_fx))); */ SWB_fenv_fx[i] = round_fx( L_mac( L_mult( SWB_fenv_fx[i], st_fx->attenu_fx ), st_fx->prev_SWB_fenv_fx[i], sub( 32767, st_fx->attenu_fx ) ) ); move16(); } @@ -466,7 +452,6 @@ static Word16 para_pred_bws_fx( FOR( i = 0; i < SWB_FENV; i++ ) { - /*SWB_fenv_fx[i] = add(mult_r(SWB_fenv_fx[i], 29491), mult_r(st_fx->prev_SWB_fenv_fx[i], 3277)); */ SWB_fenv_fx[i] = round_fx( L_mac( L_mult( SWB_fenv_fx[i], 29491 ), st_fx->prev_SWB_fenv_fx[i], 3277 ) ); move16(); } diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 9b40b90f3..13da71352 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -209,8 +209,8 @@ ivas_error TonalMDCTConceal_Init_ivas_fx( // To be uncommented when field of fixed type is added for scaleFactorsBackground set32_fx( hTonalMDCTConc->scaleFactorsBackground_fx, 0, FDNS_NPTS ); hTonalMDCTConc->scf_fadeout = 16384 /*1.000000 Q14*/; - PsychoacousticParameters_Init( INT_FS_16k, L_FRAME16k, 64, 1, 1, &hTonalMDCTConc->psychParamsTCX20 ); - PsychoacousticParameters_Init( INT_FS_16k, L_FRAME16k / 2, 64, 0, 1, &hTonalMDCTConc->psychParamsTCX10 ); + PsychoacousticParameters_Init_fx( INT_FS_16k, L_FRAME16k, 64, 1, 1, &hTonalMDCTConc->psychParamsTCX20 ); + PsychoacousticParameters_Init_fx( INT_FS_16k, L_FRAME16k / 2, 64, 0, 1, &hTonalMDCTConc->psychParamsTCX10 ); hTonalMDCTConc->psychParams = NULL; hTonalMDCTConc->last_block_nrg = 0; diff --git a/lib_enc/enc_gen_voic_fx.c b/lib_enc/enc_gen_voic_fx.c index 8b7d12fba..b0a9264ae 100644 --- a/lib_enc/enc_gen_voic_fx.c +++ b/lib_enc/enc_gen_voic_fx.c @@ -10,7 +10,6 @@ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ - /*======================================================================*/ /* FUNCTION : encod_gen_voic_fx() */ /*----------------------------------------------------------------------*/ diff --git a/lib_enc/evs_enc_fx.c b/lib_enc/evs_enc_fx.c index 40b1d7b56..e234c0c23 100644 --- a/lib_enc/evs_enc_fx.c +++ b/lib_enc/evs_enc_fx.c @@ -14,7 +14,7 @@ /*-------------------------------------------------------------------* * Local function prototypes *-------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED static void initFrameHeader_loc( Encoder_State *st ); static void writeFrameHeader_loc( Encoder_State *st ); static void configure_core_coder_loc( Encoder_State *st ); @@ -740,3 +740,4 @@ static void configure_core_coder_loc( return; } +#endif diff --git a/lib_enc/hq_core_enc_fx.c b/lib_enc/hq_core_enc_fx.c index 55e37a3b5..ae408f846 100644 --- a/lib_enc/hq_core_enc_fx.c +++ b/lib_enc/hq_core_enc_fx.c @@ -10,6 +10,7 @@ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ +#ifdef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------------- * hq_core_enc() * @@ -371,3 +372,4 @@ void HQ_core_enc_init_fx( return; } +#endif diff --git a/lib_enc/hq_hr_enc_fx.c b/lib_enc/hq_hr_enc_fx.c index ca7d941ee..043e917ca 100644 --- a/lib_enc/hq_hr_enc_fx.c +++ b/lib_enc/hq_hr_enc_fx.c @@ -9,7 +9,7 @@ #include "rom_com.h" /* Static table prototypes */ #include "prot_fx.h" /* Function prototypes */ #include "prot_fx_enc.h" /* Function prototypes */ - +#ifdef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* * hq_hr_enc_fx() * @@ -255,3 +255,4 @@ void hq_hr_enc_fx( return; } +#endif diff --git a/lib_enc/pvq_core_enc_fx.c b/lib_enc/pvq_core_enc_fx.c index e87ae006f..040853d5d 100644 --- a/lib_enc/pvq_core_enc_fx.c +++ b/lib_enc/pvq_core_enc_fx.c @@ -14,7 +14,7 @@ /*-------------------------------------------------------------------* * Local function prototypes *--------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED static Word16 calc_pvq_splits_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ, const Word16 band_bits, const Word16 sfmsize, const Word16 *y, const Word16 Q_y, Word16 *bits ); static void densityIndexSymbolEncode_fx( BSTR_ENC_HANDLE hBstr, PVQ_ENC_HANDLE hPVQ, const Word16 density, const Word16 r_dim, const Word16 l_dim, const Word16 index_phi ); @@ -656,3 +656,4 @@ static Word16 calc_pvq_splits_fx( /* o : Number of segm Np = s_min( sfmsize, Np ); /* The code line assumes that MIN_BAND_SIZE is 1 */ return Np; } +#endif diff --git a/lib_rend/ivas_allrad_dec.c b/lib_rend/ivas_allrad_dec.c index b97e877b3..6b780f9bb 100644 --- a/lib_rend/ivas_allrad_dec.c +++ b/lib_rend/ivas_allrad_dec.c @@ -289,7 +289,6 @@ ivas_error ivas_sba_get_hoa_dec_matrix_fx( dec_mtx_temp = Mpy_32_32( G_td_int[j], Y_td_int[k] ); // Q27 *p_dec_mtx = L_add( *p_dec_mtx, L_shr( dec_mtx_temp, 2 ) ); // Q25 move32(); - // printf( "\n%f", ((float)*p_dec_mtx)/ ONE_IN_Q25 ); p_dec_mtx++; } p_dec_mtx += sub( SBA_NHARM_HOA3, num_harm ); diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 95260d7b1..e3b5c8cee 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -176,7 +176,7 @@ static ivas_error ivas_hrtf_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR decoder\n" ); } - IF( ( error = ivas_hrtf_init( hHrtf ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_hrtf_init( hHrtf ) ), IVAS_ERR_OK ) ) { return error; } @@ -282,13 +282,13 @@ static ivas_error ivas_rend_initCrend_fx( IF( hHrtf == NULL ) { - IF( ivas_hrtf_open( &hHrtf ) != IVAS_ERR_OK ) + IF( NE_32( ivas_hrtf_open( &hHrtf ), IVAS_ERR_OK ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for HRTF handle" ); } } - IF( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ), IVAS_ERR_OK ) ) { return error; } @@ -302,7 +302,7 @@ static ivas_error ivas_rend_initCrend_fx( IF( hSetOfHRTF == NULL ) { - IF( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF( EQ_32( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { hHrtf->max_num_ir = sub( hHrtf->max_num_ir, 1 ); /* subtract LFE */ move16(); @@ -2047,22 +2047,22 @@ static ivas_error ivas_shoebox_output_init( move16(); move16(); - IF( ( error = ivas_shoebox_data_init( &hShoeboxOutput->times ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_shoebox_data_init( &hShoeboxOutput->times ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = ivas_shoebox_data_init( &hShoeboxOutput->gains ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_shoebox_data_init( &hShoeboxOutput->gains ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = ivas_shoebox_data_init( &hShoeboxOutput->az_angle ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_shoebox_data_init( &hShoeboxOutput->az_angle ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = ivas_shoebox_data_init( &hShoeboxOutput->el_angle ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_shoebox_data_init( &hShoeboxOutput->el_angle ) ), IVAS_ERR_OK ) ) { return error; } @@ -2236,7 +2236,7 @@ static ivas_error ivas_shoebox_obj_init( move32(); move32(); - IF( ( error = ivas_shoebox_config_init_params( &hShoeboxObj->cal ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_shoebox_config_init_params( &hShoeboxObj->cal ) ), IVAS_ERR_OK ) ) { return error; } @@ -2348,11 +2348,11 @@ static ivas_error ivas_er_init_handle( reflections->circ_buffers = NULL; reflections->closest_ch_idx = NULL; - IF( ( error = ivas_shoebox_output_init( &reflections->shoebox_data ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_shoebox_output_init( &reflections->shoebox_data ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = ivas_shoebox_obj_init( &reflections->shoebox_lib ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_shoebox_obj_init( &reflections->shoebox_lib ) ), IVAS_ERR_OK ) ) { return error; } @@ -2459,9 +2459,7 @@ ivas_error ivas_rend_initCrendWrapper( hCrend->prev_out_buffer_fx[i] = NULL; } -#if 1 hCrend->hTrack = NULL; -#endif hCrend->freq_buffer_re_diffuse_fx = NULL; hCrend->freq_buffer_im_diffuse_fx = NULL; hCrend->hReverb = NULL; @@ -2570,7 +2568,7 @@ ivas_error ivas_rend_openCrend( error = IVAS_ERR_OK; move16(); - IF( ( error = ivas_rend_initCrendWrapper( pCrend ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_rend_initCrendWrapper( pCrend ) ), IVAS_ERR_OK ) ) { return error; } @@ -2578,7 +2576,7 @@ ivas_error ivas_rend_openCrend( subframe_length = extract_l( Mult_32_16( output_Fs, 164 ) ); /*( output_Fs / FRAMES_PER_SEC ) / MAX_PARAM_SPATIAL_SUBFRAMES(i/o:164=(32768/FRAMES_PER_SEC)/MAX_PARAM_SPATIAL_SUBFRAMES*/ IF( ( *pCrend )->hHrtfCrend == NULL ){ - IF( ( error = ivas_rend_initCrend_fx( *pCrend, inConfig, outConfig, hSetOfHRTF, output_Fs ) ) != IVAS_ERR_OK ){ + IF( NE_32( ( error = ivas_rend_initCrend_fx( *pCrend, inConfig, outConfig, hSetOfHRTF, output_Fs ) ), IVAS_ERR_OK ) ){ return error; } } @@ -2651,7 +2649,7 @@ ivas_error ivas_rend_openCrend( IF( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { - IF( ( error = ivas_reverb_open_fx( &( hCrend->hReverb ), inConfig, ( *pCrend )->hHrtfCrend, NULL, hRendCfg, output_Fs ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_reverb_open_fx( &( hCrend->hReverb ), inConfig, ( *pCrend )->hHrtfCrend, NULL, hRendCfg, output_Fs ) ), IVAS_ERR_OK ) ) { return error; } @@ -2665,7 +2663,7 @@ ivas_error ivas_rend_openCrend( { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Early Reflections" ); } - IF( ( error = ivas_er_init_handle( hCrend->reflections ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_er_init_handle( hCrend->reflections ) ), IVAS_ERR_OK ) ) { return error; } @@ -2687,7 +2685,7 @@ ivas_error ivas_rend_openCrend( ivas_shoebox_config_init( &hCrend->reflections->shoebox_lib.cal, hRendCfg ); /* Init and compute Reflections */ - IF( ( error = ivas_er_init( hCrend->reflections, inConfig ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_er_init( hCrend->reflections, inConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -2760,14 +2758,6 @@ void ivas_rend_closeCrend( } } -#ifdef IVAS_FLOAT_FIXED_s - IF( hCrend->lfe_delay_line_fx != NULL ) - { - free( hCrend->lfe_delay_line_fx ); - hCrend->lfe_delay_line_fx = NULL; - } -#endif - IF( hCrend->lfe_delay_line_fx != NULL ) { free( hCrend->lfe_delay_line_fx ); @@ -3133,7 +3123,7 @@ static ivas_error ivas_rend_crendConvolver( lfe_idx_in = -1; move16(); - IF( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF( EQ_32( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { IF( NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { @@ -3498,7 +3488,7 @@ ivas_error ivas_rend_crendProcess( push_wmops( "ivas_rend_crendProcess" ); inConfigType = getAudioConfigType( inConfig ); - IF( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ), IVAS_ERR_OK ) ) { return error; } @@ -3540,7 +3530,7 @@ ivas_error ivas_rend_crendProcess( test(); IF( EQ_16( hCrend->reflections->use_er, 1 ) && EQ_16( hCrend->reflections->is_ready, 1 ) ) { - IF( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output_fx, inConfig ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_er_process( hCrend->reflections, subframe_len, subframe_idx, output_fx, inConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -3573,14 +3563,14 @@ ivas_error ivas_rend_crendProcess( IF( EQ_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || EQ_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { - IF( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output_fx, p_pcm_tmp_fx, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, output_fx, p_pcm_tmp_fx, output_Fs, subframe_idx ) ), IVAS_ERR_OK ) ) { return error; } IF( hCrend->hReverb != NULL ) { - IF( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, output_fx, p_pcm_tmp_fx, subframe_idx ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, output_fx, p_pcm_tmp_fx, subframe_idx ) ), IVAS_ERR_OK ) ) { return error; } @@ -3773,12 +3763,12 @@ ivas_error ivas_rend_crendProcessSubframe( push_wmops( "ivas_rend_crendProcessSubframe" ); inConfigType = getAudioConfigType( inConfig ); - IF( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( outConfig, &nchan_out ) ), IVAS_ERR_OK ) ) { return error; } - IF( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ), IVAS_ERR_OK ) ) { return error; } @@ -3815,7 +3805,7 @@ ivas_error ivas_rend_crendProcessSubframe( test(); IF( EQ_32( hCrend->reflections->use_er, 1 ) && EQ_32( hCrend->reflections->is_ready, 1 ) ) { - IF( ( error = ivas_er_process( hCrend->reflections, subframe_len, 0, tc_local_fx, inConfig ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_er_process( hCrend->reflections, subframe_len, 0, tc_local_fx, inConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -3847,7 +3837,7 @@ ivas_error ivas_rend_crendProcessSubframe( IF( EQ_32( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || EQ_32( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { - IF( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, tc_local_fx, p_pcm_tmp_fx, output_Fs, 0 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_rend_crendConvolver( pCrend, inConfig, outConfig, tc_local_fx, p_pcm_tmp_fx, output_Fs, 0 ) ), IVAS_ERR_OK ) ) { return error; @@ -3855,7 +3845,7 @@ ivas_error ivas_rend_crendProcessSubframe( IF( pCrend->hCrend->hReverb != NULL ) { - IF( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, tc_local_fx, p_pcm_tmp_fx, 0 ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_reverb_process_fx( pCrend->hCrend->hReverb, inConfig, 1, tc_local_fx, p_pcm_tmp_fx, 0 ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_dirac_ana.c b/lib_rend/ivas_dirac_ana.c index f32414199..ec9a05dbd 100644 --- a/lib_rend/ivas_dirac_ana.c +++ b/lib_rend/ivas_dirac_ana.c @@ -117,7 +117,7 @@ ivas_error ivas_dirac_ana_open_fx( move16(); FOR( i = 0; i < hDirAC->num_Cldfb_instances; i++ ) { - IF( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = openCldfb_ivas_fx( &( hDirAC->cldfbAnaEnc[i] ), CLDFB_ANALYSIS, input_Fs, CLDFB_PROTOTYPE_5_00MS ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 3308970ea..fa1a8c530 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -91,8 +91,9 @@ typedef struct hrtfGainCache int16_t azi; int16_t ele; +#ifndef IVAS_FLOAT_FIXED float shVec[HRTF_SH_CHANNELS]; -#ifdef IVAS_FLOAT_FIXED +#else Word32 shVec_fx[HRTF_SH_CHANNELS]; #endif @@ -501,7 +502,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( IF( hDiracDecBin->hReverb == NULL ) { /* Todo Philips: Room acoustics should be passed here once the underlying part works. Probably enough to pick it from st_ivas but you know best. */ - IF( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) ) { return error; } @@ -534,7 +535,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( ivas_dirac_dec_decorr_close_fx( &hDiracDecBin->h_freq_domain_decorr_ap_params, &hDiracDecBin->h_freq_domain_decorr_ap_state ); } - IF( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( hDiracDecBin->hTdDecorr ), &( hDiracDecBin->useTdDecorr ) ) ), IVAS_ERR_OK ) ) { return error; } @@ -546,7 +547,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( Word16 frequency_axis_fx[CLDFB_NO_CHANNELS_MAX]; ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, output_Fs, nBins ); - IF( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + IF( NE_32( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), &( hDiracDecBin->h_freq_domain_decorr_ap_state ), nBins, BINAURAL_CHANNELS, @@ -554,7 +555,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( DIRAC_SYNTHESIS_PSD_LS, frequency_axis_fx, BINAURAL_CHANNELS, - output_Fs ) ) != IVAS_ERR_OK ) + output_Fs ) ), IVAS_ERR_OK ) ) { return error; } @@ -587,7 +588,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( n_samples_granularity = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); /* Use the same granularity as tdrend */ } - IF( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, ivas_jbm_dec_get_num_tc_channels( st_ivas ), nchan_to_allocate, nchan_to_allocate, n_samples_granularity ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, ivas_jbm_dec_get_num_tc_channels( st_ivas ), nchan_to_allocate, nchan_to_allocate, n_samples_granularity ) ), IVAS_ERR_OK ) ) { return error; } @@ -701,47 +702,7 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs_fx( } #endif // IVAS_FLOAT_FIXED -#ifdef IVAS_FLOAT_FIXED -ivas_error ivas_dirac_dec_binaural_copy_hrtfs( - HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ -) -{ - Word16 i, j; - test(); - IF( hHrtfParambin != NULL && *hHrtfParambin != NULL ) - { - /* Tables already loaded from file */ - return IVAS_ERR_OK; - } - ELSE - { - /* Initialise tables from ROM */ - HRTFS_PARAMBIN *hrtfParambin; - - IF( ( hrtfParambin = (HRTFS_PARAMBIN *) malloc( sizeof( HRTFS_PARAMBIN ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for parametric binauralizer HRTF tables" ); - } - - FOR( i = 0; i < BINAURAL_CHANNELS; i++ ) - { - FOR( j = 0; j < HRTF_SH_CHANNELS; j++ ) - { - Copy( hrtfShCoeffsRe_fx[i][j], hrtfParambin->hrtfShCoeffsRe_fx[i][j], HRTF_NUM_BINS ); - Copy( hrtfShCoeffsIm_fx[i][j], hrtfParambin->hrtfShCoeffsIm_fx[i][j], HRTF_NUM_BINS ); - } - } - - Copy32( parametricReverberationTimes_fx, hrtfParambin->parametricReverberationTimes_fx, CLDFB_NO_CHANNELS_MAX ); - Copy32( parametricReverberationEneCorrections_fx, hrtfParambin->parametricReverberationEneCorrections_fx, CLDFB_NO_CHANNELS_MAX ); - Copy32( parametricEarlyPartEneCorrection_fx, hrtfParambin->parametricEarlyPartEneCorrection_fx, CLDFB_NO_CHANNELS_MAX ); - - *hHrtfParambin = hrtfParambin; - } - - return IVAS_ERR_OK; -} -#else +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_dirac_dec_binaural_copy_hrtfs( HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ ) @@ -897,7 +858,7 @@ void ivas_dirac_dec_binaural_render_fx( move16(); move16(); - WHILE( GT_16( slots_to_render, 0 ) ) + WHILE( slots_to_render > 0 ) { slots_to_render = sub( slots_to_render, hSpatParamRendCom->subframe_nbslots[last_sf] ); last_sf = add( last_sf, 1 ); @@ -974,6 +935,7 @@ void ivas_dirac_dec_binaural_sba_gain_fx( } #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED void ivas_dirac_dec_binaural_sba_gain( float *output[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_remapped, /* i : num channels after remapping of TCs */ @@ -999,7 +961,7 @@ void ivas_dirac_dec_binaural_sba_gain( return; } - +#endif /*------------------------------------------------------------------------- * Local functions @@ -1252,31 +1214,15 @@ static void ivas_dirac_dec_binaural_internal_fx( Decoder_Struct *st_ivas, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, Word32 *output_fx[], - const int16_t nchan_transport, - const int16_t subframe ) + const Word16 nchan_transport, + const Word16 subframe ) { -#if 1 Word16 q_input = 11; move16(); -#ifdef MSAN_FIX_ - Word16 nchan_tc; - - nchan_tc = 0; - move16(); - IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) - { - IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - nchan_tc = st_ivas->nchan_ism; - move16(); - } - } - nchan_tc = add( nchan_tc, ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); -#endif IF( st_ivas->hSCE[0] ) { Word16 shift = getScaleFactor32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN ); - if ( LT_16( sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ), 4 ) ) + IF ( LT_16( sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ), 4 ) ) { shift = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4 ); } @@ -1294,7 +1240,7 @@ static void ivas_dirac_dec_binaural_internal_fx( move16(); } } -#endif + DIRAC_DEC_BIN_HANDLE hDiracDecBin; SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom; PARAMBIN_REND_CONFIG config_data; @@ -1537,12 +1483,12 @@ static void ivas_dirac_dec_binaural_internal_fx( Scale_sig( st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, CLDFB_NO_COL_MAX, Q15 - st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q ); st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q = Q15; move16(); - FOR( int idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) + FOR( Word16 idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { Scale_sig32( st_ivas->hSpar->hFbMixer->pFb->fb_bin_to_band.pp_cldfb_weights_per_spar_band_fx[idx], IVAS_MAX_NUM_FB_BANDS, Q31 - Q22 ); } ivas_sba_prototype_renderer_fx( st_ivas, Cldfb_RealBuffer_in_fx, Cldfb_ImagBuffer_in_fx, q_cldfb, subframe ); - FOR( int idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) + FOR( Word16 idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { Scale_sig32( st_ivas->hSpar->hFbMixer->pFb->fb_bin_to_band.pp_cldfb_weights_per_spar_band_fx[idx], IVAS_MAX_NUM_FB_BANDS, Q22 - Q31 ); } @@ -2565,7 +2511,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric * for non-2dir it is zero. As the whole direction contribution is multiplied with * the ratio, a very small ratio does not contribute any energy to output. Thus, * it is better to save complexity. */ - continue; + CONTINUE; } aziDeg = hSpatParamRendCom->azimuth2[dirac_read_idx][bin]; move16(); @@ -2922,7 +2868,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric den = L_max( 1, den ); IIReneLimiter_fx = BASOP_Util_Divide3232_Scale_cadence( num, den, &e ); e = add( sub( num_e, den_e ), add( 5, e ) ); - if ( L_shr_sat( IIReneLimiter_fx, sub( 31, e ) ) > 0 ) + IF ( L_shr_sat( IIReneLimiter_fx, sub( 31, e ) ) > 0 ) { IIReneLimiter_fx = ONE_IN_Q31; move32(); @@ -3951,7 +3897,7 @@ static void ivas_dirac_dec_binaural_process_output_fx( move16(); } test(); - IF( !hDiracDecBin->useTdDecorr && ( GT_16( max_band_decorr, 0 ) ) ) + IF( !hDiracDecBin->useTdDecorr && ( max_band_decorr > 0 ) ) { ivas_dirac_dec_decorrelate_slot_fx( hDiracDecBin, nBins, slot, inRe_fx, inIm_fx, q_inp_mix, decSlotRe_fx, decSlotIm_fx ); } @@ -4203,6 +4149,7 @@ static void adaptTransportSignalsHeadtracked_fx( Word16 e_div; move16(); move16(); + move16(); FOR( Word16 i = 0; i < 6; i++ ) { @@ -4297,7 +4244,7 @@ static void adaptTransportSignalsHeadtracked_fx( } ELSE { - temp = L_sub( temp, L_shl( abs( e_div ), 25 ) ); // Q25 + temp = L_sub( temp, L_shl( L_abs( e_div ), 25 ) ); // Q25 } temp = Mpy_32_32( temp, 646462464 ); // logx base 10 = 0.30103* logx base 2// @@ -4998,14 +4945,14 @@ static void eig2x2_fx( pm_fx = 0.5 * sqrt(max(0, 4 * crossSquare_fx)) = sqrt(0, crossSquare_fx)*/ test(); test(); - IF( EQ_32( c_re, 0 ) || LT_32( abs( c_re ), ONE_IN_Q15 ) ) + IF( EQ_32( c_re, 0 ) || LT_32( L_abs( c_re ), ONE_IN_Q15 ) ) { /* if c_re = 0, then crossSquare_fx = c_im^2 => pm_fx = max(0, c_im) */ pm_fx = L_max( 0, L_abs( c_im ) ); q_tmp2 = q_c; move16(); } - ELSE IF( c_im == 0 || LT_32( abs( c_im ), ONE_IN_Q15 ) ) + ELSE IF( c_im == 0 || LT_32( L_abs( c_im ), ONE_IN_Q15 ) ) { /* if c_im = 0, then crossSquare_fx = c_re^2 => pm_fx = max(0, c_re) */ pm_fx = L_max( 0, L_abs( c_re ) ); @@ -5143,7 +5090,7 @@ static void eig2x2_fx( move16(); } - IF( GT_32( abs( tmp2 ), abs( tmp1 ) ) ) + IF( GT_32( L_abs( tmp2 ), L_abs( tmp1 ) ) ) { s_fx = tmp2; move32(); @@ -5418,7 +5365,7 @@ static void matrixMul_fx( } ELSE { - tmp1 = L_negate( Mpy_32_32( abs( Are_fx[chA][0] ), abs( Bre_fx[0][chB] ) ) ); + tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][0] ), L_abs( Bre_fx[0][chB] ) ) ); } test(); test(); @@ -5429,9 +5376,8 @@ static void matrixMul_fx( } ELSE { - tmp2 = L_negate( Mpy_32_32( abs( Are_fx[chA][1] ), abs( Bre_fx[1][chB] ) ) ); + tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][1] ), L_abs( Bre_fx[1][chB] ) ) ); } - // outRe_fx[chA][chB] = Madd_32_32( Mpy_32_32( Are_fx[chA][0], Bre_fx[0][chB] ), Are_fx[chA][1], Bre_fx[1][chB] ); outRe_fx[chA][chB] = L_add( tmp1, tmp2 ); move32(); @@ -5444,7 +5390,7 @@ static void matrixMul_fx( } ELSE { - tmp1 = L_negate( Mpy_32_32( abs( Aim_fx[chA][0] ), abs( Bim_fx[0][chB] ) ) ); + tmp1 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][0] ), L_abs( Bim_fx[0][chB] ) ) ); } test(); test(); @@ -5455,9 +5401,8 @@ static void matrixMul_fx( } ELSE { - tmp2 = L_negate( Mpy_32_32( abs( Aim_fx[chA][1] ), abs( Bim_fx[1][chB] ) ) ); + tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][1] ), L_abs( Bim_fx[1][chB] ) ) ); } - // outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], Madd_32_32( Mpy_32_32( Aim_fx[chA][0], Bim_fx[0][chB] ), Aim_fx[chA][1], Bim_fx[1][chB] ) ); outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], L_add( tmp1, tmp2 ) ); move32(); test(); @@ -5469,7 +5414,7 @@ static void matrixMul_fx( } ELSE { - tmp1 = L_negate( Mpy_32_32( abs( Aim_fx[chA][0] ), abs( Bre_fx[0][chB] ) ) ); + tmp1 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][0] ), L_abs( Bre_fx[0][chB] ) ) ); } test(); test(); @@ -5480,9 +5425,8 @@ static void matrixMul_fx( } ELSE { - tmp2 = L_negate( Mpy_32_32( abs( Aim_fx[chA][1] ), abs( Bre_fx[1][chB] ) ) ); + tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][1] ), L_abs( Bre_fx[1][chB] ) ) ); } - // outIm_fx[chA][chB] = Madd_32_32( Mpy_32_32( Aim_fx[chA][0], Bre_fx[0][chB] ), Aim_fx[chA][1], Bre_fx[1][chB] ); outIm_fx[chA][chB] = L_add( tmp1, tmp2 ); move32(); @@ -5495,7 +5439,7 @@ static void matrixMul_fx( } ELSE { - tmp1 = L_negate( Mpy_32_32( abs( Are_fx[chA][0] ), abs( Bim_fx[0][chB] ) ) ); + tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][0] ), L_abs( Bim_fx[0][chB] ) ) ); } test(); test(); @@ -5506,9 +5450,8 @@ static void matrixMul_fx( } ELSE { - tmp2 = L_negate( Mpy_32_32( abs( Are_fx[chA][1] ), abs( Bim_fx[1][chB] ) ) ); + tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][1] ), L_abs( Bim_fx[1][chB] ) ) ); } - // outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], Madd_32_32( Mpy_32_32( Are_fx[chA][0], Bim_fx[0][chB] ), Are_fx[chA][1], Bim_fx[1][chB] ) ); outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); move32(); } @@ -5576,15 +5519,14 @@ static void matrixTransp1Mul_fx( IF( ( ( ( Are_fx[0][chA] >= 0 ) && ( Bre_fx[0][chB] >= 0 ) ) || ( ( Are_fx[0][chA] < 0 ) && ( Bre_fx[0][chB] < 0 ) ) ) ) tmp1 = Mpy_32_32( Are_fx[0][chA], Bre_fx[0][chB] ); ELSE - tmp1 = L_negate( Mpy_32_32( abs( Are_fx[0][chA] ), abs( Bre_fx[0][chB] ) ) ); + tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[0][chA] ), L_abs( Bre_fx[0][chB] ) ) ); test(); test(); test(); IF( ( ( ( Are_fx[1][chA] >= 0 ) && ( Bre_fx[1][chB] >= 0 ) ) || ( ( Are_fx[1][chA] < 0 ) && ( Bre_fx[1][chB] < 0 ) ) ) ) tmp2 = Mpy_32_32( Are_fx[1][chA], Bre_fx[1][chB] ); ELSE - tmp2 = L_negate( Mpy_32_32( abs( Are_fx[1][chA] ), abs( Bre_fx[1][chB] ) ) ); - // outRe_fx[chA][chB] = Madd_32_32( Mpy_32_32( Are_fx[0][chA], Bre_fx[0][chB] ), Are_fx[1][chA], Bre_fx[1][chB] ); + tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[1][chA] ), L_abs( Bre_fx[1][chB] ) ) ); outRe_fx[chA][chB] = L_add( tmp1, tmp2 ); move32(); test(); @@ -5593,15 +5535,14 @@ static void matrixTransp1Mul_fx( IF( ( ( ( L_negate( Aim_fx[0][chA] ) >= 0 ) && ( Bim_fx[0][chB] >= 0 ) ) || ( ( L_negate( Aim_fx[0][chA] ) < 0 ) && ( Bim_fx[0][chB] < 0 ) ) ) ) tmp1 = Mpy_32_32( -Aim_fx[0][chA], Bim_fx[0][chB] ); ELSE - tmp1 = L_negate( Mpy_32_32( abs( -Aim_fx[0][chA] ), abs( Bim_fx[0][chB] ) ) ); + tmp1 = L_negate( Mpy_32_32( L_abs( -Aim_fx[0][chA] ), L_abs( Bim_fx[0][chB] ) ) ); test(); test(); test(); IF( ( ( ( Aim_fx[1][chA] >= 0 ) && ( Bim_fx[1][chB] >= 0 ) ) || ( ( Aim_fx[1][chA] < 0 ) && ( Bim_fx[1][chB] < 0 ) ) ) ) tmp2 = Mpy_32_32( Aim_fx[1][chA], Bim_fx[1][chB] ); ELSE - tmp2 = L_negate( Mpy_32_32( abs( Aim_fx[1][chA] ), abs( Bim_fx[1][chB] ) ) ); - // outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], Msub_32_32( Mpy_32_32( -Aim_fx[0][chA], Bim_fx[0][chB] ), Aim_fx[1][chA], Bim_fx[1][chB] ) ); + tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[1][chA] ), L_abs( Bim_fx[1][chB] ) ) ); outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], L_sub( tmp1, tmp2 ) ); move32(); @@ -5611,15 +5552,14 @@ static void matrixTransp1Mul_fx( IF( ( ( ( L_negate( Aim_fx[0][chA] ) >= 0 ) && ( Bre_fx[0][chB] >= 0 ) ) || ( ( L_negate( Aim_fx[0][chA] ) < 0 ) && ( Bre_fx[0][chB] < 0 ) ) ) ) tmp1 = Mpy_32_32( -Aim_fx[0][chA], Bre_fx[0][chB] ); ELSE - tmp1 = L_negate( Mpy_32_32( abs( -Aim_fx[0][chA] ), abs( Bre_fx[0][chB] ) ) ); + tmp1 = L_negate( Mpy_32_32( L_abs( -Aim_fx[0][chA] ), L_abs( Bre_fx[0][chB] ) ) ); test(); test(); test(); IF( ( ( ( Aim_fx[1][chA] >= 0 ) && ( Bre_fx[1][chB] >= 0 ) ) || ( ( Aim_fx[1][chA] < 0 ) && ( Bre_fx[1][chB] < 0 ) ) ) ) tmp2 = Mpy_32_32( Aim_fx[1][chA], Bre_fx[1][chB] ); ELSE - tmp2 = L_negate( Mpy_32_32( abs( Aim_fx[1][chA] ), abs( Bre_fx[1][chB] ) ) ); - // outIm_fx[chA][chB] = Msub_32_32( Mpy_32_32( -Aim_fx[0][chA], Bre_fx[0][chB] ), Aim_fx[1][chA], Bre_fx[1][chB] ); + tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[1][chA] ), L_abs( Bre_fx[1][chB] ) ) ); outIm_fx[chA][chB] = L_sub( tmp1, tmp2 ); move32(); @@ -5629,15 +5569,14 @@ static void matrixTransp1Mul_fx( IF( ( ( ( Are_fx[0][chA] >= 0 ) && ( Bim_fx[0][chB] >= 0 ) ) || ( ( Are_fx[0][chA] < 0 ) && ( Bim_fx[0][chB] < 0 ) ) ) ) tmp1 = Mpy_32_32( Are_fx[0][chA], Bim_fx[0][chB] ); ELSE - tmp1 = L_negate( Mpy_32_32( abs( Are_fx[0][chA] ), abs( Bim_fx[0][chB] ) ) ); + tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[0][chA] ), L_abs( Bim_fx[0][chB] ) ) ); test(); test(); test(); IF( ( ( ( Are_fx[1][chA] >= 0 ) && ( Bim_fx[1][chB] >= 0 ) ) || ( ( Are_fx[1][chA] < 0 ) && ( Bim_fx[1][chB] < 0 ) ) ) ) tmp2 = Mpy_32_32( Are_fx[1][chA], Bim_fx[1][chB] ); ELSE - tmp2 = L_negate( Mpy_32_32( abs( Are_fx[1][chA] ), abs( Bim_fx[1][chB] ) ) ); - // outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], Madd_32_32( Mpy_32_32( Are_fx[0][chA], Bim_fx[0][chB] ), Are_fx[1][chA], Bim_fx[1][chB] ) ); + tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[1][chA] ), L_abs( Bim_fx[1][chB] ) ) ); outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); move32(); } @@ -5717,15 +5656,14 @@ static void matrixTransp2Mul_fx( IF( ( Are_fx[chA][0] >= 0 && Bre_fx[chB][0] >= 0 ) || ( Are_fx[chA][0] < 0 && Bre_fx[chB][0] < 0 ) ) tmp1 = Mpy_32_32( Are_fx[chA][0], Bre_fx[chB][0] ); ELSE - tmp1 = L_negate( Mpy_32_32( abs( Are_fx[chA][0] ), abs( Bre_fx[chB][0] ) ) ); + tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][0] ), L_abs( Bre_fx[chB][0] ) ) ); test(); test(); test(); IF( ( Are_fx[chA][1] >= 0 && Bre_fx[chB][1] >= 0 ) || ( Are_fx[chA][1] < 0 && Bre_fx[chB][1] < 0 ) ) tmp2 = Mpy_32_32( Are_fx[chA][1], Bre_fx[chB][1] ); ELSE - tmp2 = L_negate( Mpy_32_32( abs( Are_fx[chA][1] ), abs( Bre_fx[chB][1] ) ) ); - // outRe_fx[chA][chB] = Madd_32_32( Mpy_32_32( Are_fx[chA][0], Bre_fx[chB][0] ), Are_fx[chA][1], Bre_fx[chB][1] ); + tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][1] ), L_abs( Bre_fx[chB][1] ) ) ); outRe_fx[chA][chB] = L_add( tmp1, tmp2 ); move32(); @@ -5735,15 +5673,14 @@ static void matrixTransp2Mul_fx( IF( ( Aim_fx[chA][0] >= 0 && L_negate( Bim_fx[chB][0] ) >= 0 ) || ( Aim_fx[chA][0] < 0 && L_negate( Bim_fx[chB][0] ) < 0 ) ) tmp1 = Mpy_32_32( Aim_fx[chA][0], -Bim_fx[chB][0] ); ELSE - tmp1 = L_negate( Mpy_32_32( abs( Aim_fx[chA][0] ), abs( -Bim_fx[chB][0] ) ) ); + tmp1 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][0] ), L_abs( -Bim_fx[chB][0] ) ) ); test(); test(); test(); IF( ( Aim_fx[chA][1] >= 0 && L_negate( Bim_fx[chB][1] ) >= 0 ) || ( Aim_fx[chA][1] < 0 && L_negate( Bim_fx[chB][1] ) < 0 ) ) tmp2 = Mpy_32_32( Aim_fx[chA][1], -Bim_fx[chB][1] ); ELSE - tmp2 = L_negate( Mpy_32_32( abs( Aim_fx[chA][1] ), abs( -Bim_fx[chB][1] ) ) ); - // outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], Madd_32_32( Mpy_32_32( Aim_fx[chA][0], -Bim_fx[chB][0] ), Aim_fx[chA][1], -Bim_fx[chB][1] ) ); + tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][1] ), L_abs( -Bim_fx[chB][1] ) ) ); outRe_fx[chA][chB] = L_sub( outRe_fx[chA][chB], L_add( tmp1, tmp2 ) ); move32(); @@ -5753,15 +5690,14 @@ static void matrixTransp2Mul_fx( IF( ( Aim_fx[chA][0] >= 0 && Bre_fx[chB][0] >= 0 ) || ( Aim_fx[chA][0] < 0 && Bre_fx[chB][0] < 0 ) ) tmp1 = Mpy_32_32( Aim_fx[chA][0], Bre_fx[chB][0] ); ELSE - tmp1 = L_negate( Mpy_32_32( abs( Aim_fx[chA][0] ), abs( Bre_fx[chB][0] ) ) ); + tmp1 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][0] ), L_abs( Bre_fx[chB][0] ) ) ); test(); test(); test(); IF( ( Aim_fx[chA][1] >= 0 && Bre_fx[chB][1] >= 0 ) || ( Aim_fx[chA][1] < 0 && Bre_fx[chB][1] < 0 ) ) tmp2 = Mpy_32_32( Aim_fx[chA][1], Bre_fx[chB][1] ); ELSE - tmp2 = L_negate( Mpy_32_32( abs( Aim_fx[chA][1] ), abs( Bre_fx[chB][1] ) ) ); - // outIm_fx[chA][chB] = Madd_32_32( Mpy_32_32( Aim_fx[chA][0], Bre_fx[chB][0] ), Aim_fx[chA][1], Bre_fx[chB][1] ); + tmp2 = L_negate( Mpy_32_32( L_abs( Aim_fx[chA][1] ), L_abs( Bre_fx[chB][1] ) ) ); outIm_fx[chA][chB] = L_add( tmp1, tmp2 ); move32(); @@ -5771,15 +5707,14 @@ static void matrixTransp2Mul_fx( IF( ( Are_fx[chA][0] >= 0 && L_negate( Bim_fx[chB][0] ) >= 0 ) || ( Are_fx[chA][0] < 0 && L_negate( Bim_fx[chB][0] ) < 0 ) ) tmp1 = Mpy_32_32( Are_fx[chA][0], -Bim_fx[chB][0] ); ELSE - tmp1 = L_negate( Mpy_32_32( abs( Are_fx[chA][0] ), abs( -Bim_fx[chB][0] ) ) ); + tmp1 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][0] ), L_abs( -Bim_fx[chB][0] ) ) ); test(); test(); test(); IF( ( Are_fx[chA][1] >= 0 && L_negate( Bim_fx[chB][1] ) >= 0 ) || ( Are_fx[chA][1] < 0 && L_negate( Bim_fx[chB][1] ) < 0 ) ) tmp2 = Mpy_32_32( Are_fx[chA][1], -Bim_fx[chB][1] ); ELSE - tmp2 = L_negate( Mpy_32_32( abs( Are_fx[chA][1] ), abs( -Bim_fx[chB][1] ) ) ); - // outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], Madd_32_32( Mpy_32_32( Are_fx[chA][0], -Bim_fx[chB][0] ), Are_fx[chA][1], -Bim_fx[chB][1] ) ); + tmp2 = L_negate( Mpy_32_32( L_abs( Are_fx[chA][1] ), L_abs( -Bim_fx[chB][1] ) ) ); outIm_fx[chA][chB] = L_add( outIm_fx[chA][chB], L_add( tmp1, tmp2 ) ); move32(); } @@ -6089,12 +6024,6 @@ static void formulate2x2MixingMatrix( float Ghat[BINAURAL_CHANNELS]; float GhatQ[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; float Pre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], Pim[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; -#ifdef IVAS_FLOAT_FIXED - Word32 E_out1, E_out2, Cout_re, Cout_im; - Word32 KyRe_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS], KyIm_fx[BINAURAL_CHANNELS][BINAURAL_CHANNELS]; - Word16 q_eout, q_cout, q_ky = 0; - Word16 exp1 = 0, exp2 = 0; -#endif /* Normalize energy values */ maxEne = Ein1; maxEne = max( maxEne, Ein2 ); @@ -6111,29 +6040,7 @@ static void formulate2x2MixingMatrix( CoutIm *= maxEneDiv; /* Cholesky decomposition of target / output covariance matrix */ -#ifdef IVAS_FLOAT_FIXED - /////////////// to be removed //////////////////////////// - f2me( Eout1, &E_out1, &exp1 ); - f2me( Eout2, &E_out2, &exp2 ); - q_eout = sub( 31, s_max( exp1, exp2 ) ); - E_out1 = L_shr( E_out1, sub( sub( 31, exp1 ), q_eout ) ); - E_out2 = L_shr( E_out2, sub( sub( 31, exp2 ), q_eout ) ); - f2me( CoutRe, &Cout_re, &exp1 ); - f2me( CoutIm, &Cout_im, &exp2 ); - q_cout = sub( 31, s_max( exp1, exp2 ) ); - Cout_re = L_shr( Cout_re, sub( sub( 31, exp1 ), q_cout ) ); - Cout_im = L_shr( Cout_im, sub( sub( 31, exp2 ), q_cout ) ); - ///////////////////////////////////////////////////////// - - chol2x2_fx( E_out1, E_out2, q_eout, Cout_re, Cout_im, q_cout, KyRe_fx, KyIm_fx, &q_ky ); - - ///////////////// to be removed ///////////////////////// - fixedToFloat_arrL32( KyRe_fx[0], KyRe[0], q_ky, i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ); - fixedToFloat_arrL32( KyIm_fx[0], KyIm[0], q_ky, i_mult( BINAURAL_CHANNELS, BINAURAL_CHANNELS ) ); - ///////////////////////////////////////////////////////// -#else chol2x2( Eout1, Eout2, CoutRe, CoutIm, KyRe, KyIm ); -#endif /* Eigendecomposition of input covariance matrix */ eig2x2( Ein1, Ein2, CinRe, CinIm, Uxre, Uxim, Sx ); @@ -6990,6 +6897,7 @@ static void hrtfShGetHrtf( *------------------------------------------------------------------------*/ /*! r: Configured reqularization factor value */ +#ifndef IVAS_FLOAT_FIXED float configure_reqularization_factor( const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int32_t ivas_total_brate /* i : IVAS total bitrate */ @@ -7050,6 +6958,7 @@ float configure_reqularization_factor( return reqularizationFactor; } +#endif #ifdef IVAS_FLOAT_FIXED Word16 configure_reqularization_factor_fx( diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index 99c17d529..473263519 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -438,14 +438,14 @@ ivas_error ivas_dirac_dec_decorr_open_fx( IF( EQ_32( synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { /*Onset detector up to Nyquist and not only up to max_band_decorr*/ - IF( ( error = ivas_dirac_dec_onset_detection_open_fx( num_protos_diff, num_freq_bands, num_freq_bands, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_dirac_dec_onset_detection_open_fx( num_protos_diff, num_freq_bands, num_freq_bands, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state ) ), IVAS_ERR_OK ) ) { return error; } } ELSE { - IF( ( error = ivas_dirac_dec_onset_detection_open_fx( num_protos_diff, num_freq_bands, freq_domain_decorr_ap_params->max_band_decorr, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_dirac_dec_onset_detection_open_fx( num_protos_diff, num_freq_bands, freq_domain_decorr_ap_params->max_band_decorr, &freq_domain_decorr_ap_params->h_onset_detection_power_params, &freq_domain_decorr_ap_state->h_onset_detection_power_state ) ), IVAS_ERR_OK ) ) { return error; } @@ -517,11 +517,15 @@ ivas_error ivas_dirac_dec_decorr_open_fx( IF( num_outputs_diff > 0 ) { buffer_size_decorr = add( ap_pre_delay[split_band_index_start], ap_filter_length[split_band_index_start] ); + move16(); + IF( ( freq_domain_decorr_ap_state->decorr_buffer_fx = (Word32 *) malloc( sizeof( Word32 ) * shl( imult1616( buffer_size_decorr, imult1616( num_outputs_diff, freq_domain_decorr_ap_params->max_band_decorr ) ), 1 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } freq_domain_decorr_ap_state->decorr_buffer_len = imult1616( 2, imult1616( buffer_size_decorr, imult1616( num_outputs_diff, freq_domain_decorr_ap_params->max_band_decorr ) ) ); + move16(); + set32_fx( freq_domain_decorr_ap_state->decorr_buffer_fx, 0, imult1616( 2, imult1616( buffer_size_decorr, imult1616( num_outputs_diff, freq_domain_decorr_ap_params->max_band_decorr ) ) ) ); freq_domain_decorr_ap_state->q_decorr_buffer = Q31; move16(); @@ -582,6 +586,8 @@ ivas_error ivas_dirac_dec_decorr_open_fx( freq_domain_decorr_ap_params->pre_delay[k] = ap_pre_delay[band_table_idx]; move16(); move16(); + move16(); + move16(); FOR( l = 0; l < num_outputs_diff; l++ ) { @@ -953,19 +959,19 @@ void ivas_dirac_dec_decorr_process_fx( /* check handles */ test(); - if ( h_freq_domain_decorr_ap_params == NULL || h_freq_domain_decorr_ap_state == NULL ) + IF ( h_freq_domain_decorr_ap_params == NULL || h_freq_domain_decorr_ap_state == NULL ) { return; } /* check input data */ - if ( input_frame_fx == NULL ) + IF ( input_frame_fx == NULL ) { return; } /* check result arrays */ - if ( frame_dec_fx == NULL ) + IF ( frame_dec_fx == NULL ) { return; } @@ -979,7 +985,7 @@ void ivas_dirac_dec_decorr_process_fx( * collect some often used parameters *-----------------------------------------------------------------*/ - if ( EQ_32( synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + IF ( EQ_32( synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { num_channels = sub( num_channels, nchan_transport ); } @@ -993,21 +999,7 @@ void ivas_dirac_dec_decorr_process_fx( q_onset_dec = h_freq_domain_decorr_ap_state->h_onset_detection_power_state.q_onset_detector; move16(); guarded_bits = find_guarded_bits_fx( 2 ); -#if 0 - FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) - { - v_mult_fixed( &input_frame_fx[2 * ch_idx * num_freq_bands], &input_frame_fx[2 * ch_idx * num_freq_bands], &aux_buffer_fx[2 * ch_idx * max_band_decorr_temp], 2 * max_band_decorr_temp ); - } - q_aux_buffer = q_input_frame + q_input_frame - 31; - q_shift = getScaleFactor32( aux_buffer_fx, 2 * num_protos_dir * max_band_decorr_temp ) - guarded_bits; - - FOR( Word16 j = 0; j < 2 * num_protos_dir * max_band_decorr_temp; j++ ) - { - aux_buffer_fx[j] = L_shl( aux_buffer_fx[j], q_shift ); - } - q_aux_buffer += q_shift; -#else (void) maximum_abs_32_fx( &input_frame_fx[0], imult1616( 2, imult1616( num_protos_dir, num_freq_bands ) ), &max_abs_val ); q_shift = sub( getScaleFactor32( &input_frame_fx[0], imult1616( 2, imult1616( num_protos_dir, num_freq_bands ) ) ), guarded_bits ); test(); @@ -1030,14 +1022,13 @@ void ivas_dirac_dec_decorr_process_fx( } q_aux_buffer = sub( add( add( add( q_input_frame, q_input_frame ), q_shift ), q_shift ), 31 ); -#endif - FOR( ch_idx = 0; ch_idx < num_protos_dir; ch_idx++ ) { v_add_inc_fx( &aux_buffer_fx[imult1616( 2, imult1616( ch_idx, max_band_decorr_temp ) )], 2, &aux_buffer_fx[add( imult1616( 2, imult1616( ch_idx, max_band_decorr_temp ) ), 1 )], 2, &aux_buffer_fx[imult1616( ch_idx, max_band_decorr_temp )], 1, max_band_decorr_temp ); } /* compute onset filter */ max_band_decorr = h_freq_domain_decorr_ap_params->max_band_decorr; + move16(); set32_fx( onset_filter_fx, ONE_IN_Q31, imult1616( num_protos_diff, num_freq_bands ) ); @@ -1176,6 +1167,11 @@ void ivas_dirac_dec_decorr_process_fx( pre_delay = h_freq_domain_decorr_ap_params->pre_delay[split_bands_idx]; decorr_buffer_step = imult1616( num_channels, max_band_decorr ); + move16(); + move16(); + move16(); + move16(); + FOR( k = 0; k < num_bands; ++k ) { band_idx = add( k_1, k ); @@ -1497,13 +1493,13 @@ void ivas_dirac_dec_decorr_close_fx( *-----------------------------------------------------------------*/ test(); - if ( ph_freq_domain_decorr_ap_params == NULL || ph_freq_domain_decorr_ap_state == NULL ) + IF ( ph_freq_domain_decorr_ap_params == NULL || ph_freq_domain_decorr_ap_state == NULL ) { return; } test(); - if ( *ph_freq_domain_decorr_ap_params == NULL || *ph_freq_domain_decorr_ap_state == NULL ) + IF ( *ph_freq_domain_decorr_ap_params == NULL || *ph_freq_domain_decorr_ap_state == NULL ) { return; } diff --git a/lib_rend/ivas_dirac_onsets_dec.c b/lib_rend/ivas_dirac_onsets_dec.c index c7e4a6ff6..3dc47926f 100644 --- a/lib_rend/ivas_dirac_onsets_dec.c +++ b/lib_rend/ivas_dirac_onsets_dec.c @@ -68,16 +68,24 @@ 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 ) + IF ( shift ) + { a_m = L_shl( a_m, shift ); - if ( shift ) + } + IF ( shift ) + { a_e = sub( a_e, shift ); + } shift = norm_l( b_m ); - if ( shift ) + IF ( shift ) + { b_m = L_shl( b_m, shift ); - if ( shift ) + } + IF ( shift ) + { b_e = sub( b_e, shift ); + } /* align exponent, if any mantissa is zero */ if ( !a_m ) @@ -104,6 +112,7 @@ 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 = -1; + move16(); IF( a_m >= 0 ) { diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 36b13ed58..2eae9eb94 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -174,7 +174,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } } - ELSE IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) + ELSE IF( NE_32( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { IF( ( dirac_output_synthesis_state->diffuse_responses_square_fx = (Word32 *) malloc( hDirACRend->hOutSetup.nchan_out_woLFE * sizeof( Word32 ) ) ) == NULL ) { diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index bd89b50bd..c4405c0e4 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1423,6 +1423,7 @@ ivas_error ivas_dirac_alloc_mem_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len = imult1616( imult1616( 2 * MAX_PARAM_SPATIAL_SUBFRAMES, num_protos_dir ), num_freq_bands ); + move16(); IF( hDirACRend->proto_signal_decorr_on ) { @@ -1433,6 +1434,7 @@ ivas_error ivas_dirac_alloc_mem_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } hDirAC_mem->proto_diffuse_buffer_f_len = imult1616( 2 * MAX_PARAM_SPATIAL_SUBFRAMES, size ); + move16(); } ELSE { @@ -1496,6 +1498,7 @@ ivas_error ivas_dirac_alloc_mem_fx( } hDirAC_mem->reference_power_len = imult1616( 2, num_freq_bands ); + move16(); hDirAC_mem->reference_power_q = Q31; move16(); hDirAC_mem->reference_power_smooth_q = Q31; @@ -5016,12 +5019,12 @@ void ivas_lfe_synth_with_cldfb_fx( FOR( i = 0; i < nchan_transport; i++ ) { - if ( RealBuffer_fx[i][0][0] ) + IF ( RealBuffer_fx[i][0][0] ) { exp = norm_l( RealBuffer_fx[i][0][0] ); } min_q_shift = s_min( min_q_shift, exp ); - if ( ImagBuffer_fx[i][0][0] ) + IF ( ImagBuffer_fx[i][0][0] ) { exp = norm_l( ImagBuffer_fx[i][0][0] ); } @@ -6281,7 +6284,6 @@ static void ivas_masa_ext_dirac_render_sf_fx( } ELSE { -#if 1 IF( hDirACRend->proto_signal_decorr_on ) { Word16 new_proto_diffuse_buffer_f_q = getScaleFactor32( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len ); @@ -6294,7 +6296,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q = add( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, new_proto_diffuse_buffer_f_q ); move16(); } -#endif + /*Buffer Scaling*/ FOR( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE; ch++ ) { @@ -6455,9 +6457,9 @@ static void ivas_masa_ext_dirac_render_sf_fx( /* No LFE for MASA rendering */ set32_fx( &( output_f_fx[ch][imult1616( index_slot, hSpatParamRendCom->num_freq_bands )] ), 0, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); - if ( LT_16( idx_lfe, sub( hDirACRend->hOutSetup.num_lfe, 1 ) ) ) + IF ( LT_16( idx_lfe, sub( hDirACRend->hOutSetup.num_lfe, 1 ) ) ) { - idx_lfe++; + idx_lfe = add( idx_lfe, 1 ); } } ELSE diff --git a/lib_rend/ivas_efap.c b/lib_rend/ivas_efap.c index 5229164dd..8fe45bac0 100644 --- a/lib_rend/ivas_efap.c +++ b/lib_rend/ivas_efap.c @@ -674,7 +674,7 @@ static ivas_error poly_init_fx( } /* Computing the different ghost vertex, the downmix matrix and the triangle array */ - IF( ( error = sphere_triangulation_fx( efap->numSpk, &efap->vtxData, &efap->polyData, &efap->dmTranspose_fx, &efap->numTot, efip_flag ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = sphere_triangulation_fx( efap->numSpk, &efap->vtxData, &efap->polyData, &efap->dmTranspose_fx, &efap->numTot, efip_flag ) ), IVAS_ERR_OK ) ) { return error; } @@ -1165,6 +1165,7 @@ static void initial_polyeder_fx( EQ_32( vtxData->vertexArray[tetrahedron[0]].ele, vtxData->vertexArray[tetrahedron[1]].ele ) ) { tetrahedron[1] = add( tetrahedron[1], 1 ); + move16(); assert( tetrahedron[1] < numVtx && "EFAP: convex hull construction failed, vertices are coincident!" ); } @@ -1522,7 +1523,6 @@ static void add_ghost_speakers_fx( add_vertex_fx( vertexArray, 0, -Q22_90_DEG, add( numVertex, a ), vtxDmxType ); lengthVertGhst = add( lengthVertGhst, 1 ); - ; a = add( a, 1 ); } @@ -1570,7 +1570,7 @@ static void add_ghost_speakers_fx( sectors[i] = ceil_fixed( Mpy_32_32( tmpAngleDiff[i], maxAngle ), Q22 ); move32(); - if ( GT_32( sectors[i], Q22_1 ) ) + IF ( GT_32( sectors[i], Q22_1 ) ) { lengthHorGhst = add( lengthHorGhst, 1 ); } @@ -1579,7 +1579,7 @@ static void add_ghost_speakers_fx( sectors[sub( k, 1 )] = ceil_fixed( Mpy_32_32( tmpAngleDiff[sub( k, 1 )], maxAngle ), Q22 ); - if ( GT_32( sectors[sub( k, 1 )], Q22_1 ) ) + IF ( GT_32( sectors[sub( k, 1 )], Q22_1 ) ) { lengthHorGhst = add( lengthHorGhst, 1 ); } @@ -1599,7 +1599,7 @@ static void add_ghost_speakers_fx( add_vertex_fx( vertexArray, newAzi, 0, add( numVertex, a ), EFAP_DMX_INTENSITY ); a = add( a, 1 ); - if ( j > 0 ) + IF ( j > 0 ) { lengthHorGhst = add( lengthHorGhst, 1 ); } @@ -2962,6 +2962,7 @@ static void add_vertex_fx( tmp = efap_32mod32( L_sub( Q22_180_DEG, azi ), Q22_360_DEG ); vtxArray[pos].azi = L_sub( Q22_180_DEG, tmp ); + move32(); tmp = ( LT_32( Q22_180_DEG, ele ) ? Q22_180_DEG : ele ); move32(); diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c index 08c01b3b7..7046f3a8d 100644 --- a/lib_rend/ivas_mcmasa_ana.c +++ b/lib_rend/ivas_mcmasa_ana.c @@ -656,7 +656,7 @@ void ivas_mcmasa_ana_close( Word16 i, j; test(); - if ( hMcMasa == NULL || *hMcMasa == NULL ) + IF ( hMcMasa == NULL || *hMcMasa == NULL ) { return; } diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 0a12e65b3..59db41f7d 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -1531,7 +1531,7 @@ ivas_error ivas_td_binaural_renderer_ext_fx( ( *hCombinedOrientationData )->listenerPos[idx].q_fact = pos_q; move16(); } - FOR( int i = 0; i < 3; i++ ) + FOR( Word16 i = 0; i < 3; i++ ) { pTDRend->hBinRendererTd->Listener_p->Pos_fx[i] = L_shr( pTDRend->hBinRendererTd->Listener_p->Pos_fx[i], sub( pTDRend->hBinRendererTd->Listener_p->Pos_q, pos_q ) ); pTDRend->hBinRendererTd->Listener_p->Pos_q = pos_q; diff --git a/lib_rend/ivas_objectRenderer_mix.c b/lib_rend/ivas_objectRenderer_mix.c index 7e142afe7..72b35aa90 100644 --- a/lib_rend/ivas_objectRenderer_mix.c +++ b/lib_rend/ivas_objectRenderer_mix.c @@ -43,7 +43,6 @@ #include "prot_fx.h" #endif - /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ @@ -175,6 +174,8 @@ ivas_error TDREND_MIX_LIST_SetOrient_fx( return ( IVAS_ERROR( IVAS_ERR_INTERNAL, "Zero up vector. Command is ignored!\n" ) ); } + test(); + test(); /* Get listener */ List_p = hBinRendererTd->Listener_p; diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 743b98a1d..4c1c03850 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -148,6 +148,8 @@ ivas_error TDREND_MIX_SRC_SetDir_fx( { TDREND_SRC_SPATIAL_t *SrcSpatial_p; /* Value verification */ + test(); + test(); IF( EQ_32( Vec_p[0], 0 ) && EQ_32( Vec_p[1], 0 ) && EQ_32( Vec_p[2], 0 ) ) { return ( IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Zero direction vector. Command is ignored!\n" ) ); diff --git a/lib_rend/ivas_objectRenderer_vec.c b/lib_rend/ivas_objectRenderer_vec.c index f24edf8bd..5491d10bc 100644 --- a/lib_rend/ivas_objectRenderer_vec.c +++ b/lib_rend/ivas_objectRenderer_vec.c @@ -63,6 +63,8 @@ void TDREND_SPATIAL_VecInit_fx( return; } #endif // IVAS_FLOAT_FIXED + +#ifndef IVAS_FLOAT_FIXED void TDREND_SPATIAL_VecInit( float *Pos_p, /* o : Output vector */ const float PosX, /* i : X value */ @@ -76,6 +78,7 @@ void TDREND_SPATIAL_VecInit( return; } +#endif /*-------------------------------------------------------------------* @@ -106,12 +109,14 @@ Word32 TDREND_SPATIAL_VecNorm_fx( #endif +#ifndef IVAS_FLOAT_FIXED float TDREND_SPATIAL_VecNorm( const float *Vec_p /* i : Vector for norm calculation */ ) { return sqrtf( Vec_p[0] * Vec_p[0] + Vec_p[1] * Vec_p[1] + Vec_p[2] * Vec_p[2] ); } +#endif /*-------------------------------------------------------------------* @@ -228,6 +233,7 @@ void TDREND_SPATIAL_VecMapToNewCoordSystem( *-------------------------------------------------------------------*/ /*! r: Flag if the orientation has been updated */ +#ifndef IVAS_FLOAT_FIXED int16_t TDREND_SPATIAL_EvalOrthonormOrient( float *FrontVecON_p, /* o : Normalized front vector */ float *UpVecON_p, /* o : Normalized up vector */ @@ -275,6 +281,7 @@ int16_t TDREND_SPATIAL_EvalOrthonormOrient( return orientation_updated; } +#endif #ifdef IVAS_FLOAT_FIXED Word16 TDREND_SPATIAL_EvalOrthonormOrient_fx( diff --git a/lib_rend/ivas_omasa_ana.c b/lib_rend/ivas_omasa_ana.c index 9778dc30f..4101ecec0 100644 --- a/lib_rend/ivas_omasa_ana.c +++ b/lib_rend/ivas_omasa_ana.c @@ -1297,6 +1297,7 @@ void computeIntensityVector_ana_fx( * *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void computeIntensityVector_ana( const int16_t *band_grouping, /* i : Band grouping for estimation */ float Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal */ @@ -1334,6 +1335,7 @@ void computeIntensityVector_ana( return; } +#endif #ifdef IVAS_FLOAT_FIXED /*--------------------------------------------------------------------------* @@ -1387,6 +1389,7 @@ void computeReferencePower_ana_fx( * *--------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void computeReferencePower_ana( const int16_t *band_grouping, /* i : Band grouping for estimation */ float Cldfb_RealBuffer[FOA_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* i : Real part of input signal */ @@ -1418,3 +1421,4 @@ void computeReferencePower_ana( return; } +#endif \ No newline at end of file diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index 485e96a2a..32af0e015 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -401,10 +401,6 @@ void ivas_output_init( /* Set default values for all other than custom LS setup */ hOutSetup->ls_azimuth = NULL; hOutSetup->ls_elevation = NULL; -#ifdef IVAS_FLOAT_FIXED - hOutSetup->ls_azimuth_fx = NULL; - hOutSetup->ls_elevation_fx = NULL; -#endif hOutSetup->num_lfe = 0; hOutSetup->index_lfe[0] = -1; hOutSetup->is_planar_setup = 0; @@ -419,10 +415,6 @@ void ivas_output_init( hOutSetup->is_loudspeaker_setup = 1; hOutSetup->ls_azimuth = ls_azimuth_CICP2; hOutSetup->ls_elevation = ls_elevation_CICP2; -#ifdef IVAS_FLOAT_FIXED - hOutSetup->ls_azimuth_fx = ls_azimuth_CICP2_fx; - hOutSetup->ls_elevation_fx = ls_elevation_CICP2_fx; -#endif break; case IVAS_AUDIO_CONFIG_FOA: hOutSetup->ambisonics_order = SBA_FOA_ORDER; @@ -439,10 +431,6 @@ void ivas_output_init( hOutSetup->is_loudspeaker_setup = 1; hOutSetup->ls_azimuth = ls_azimuth_CICP6; hOutSetup->ls_elevation = ls_elevation_CICP6; -#ifdef IVAS_FLOAT_FIXED - hOutSetup->ls_azimuth_fx = ls_azimuth_CICP6_fx; - hOutSetup->ls_elevation_fx = ls_elevation_CICP6_fx; -#endif hOutSetup->is_planar_setup = 1; break; case IVAS_AUDIO_CONFIG_7_1: @@ -451,10 +439,6 @@ void ivas_output_init( hOutSetup->is_loudspeaker_setup = 1; hOutSetup->ls_azimuth = ls_azimuth_CICP12; hOutSetup->ls_elevation = ls_elevation_CICP12; -#ifdef IVAS_FLOAT_FIXED - hOutSetup->ls_azimuth_fx = ls_azimuth_CICP12_fx; - hOutSetup->ls_elevation_fx = ls_elevation_CICP12_fx; -#endif hOutSetup->is_planar_setup = 1; break; case IVAS_AUDIO_CONFIG_5_1_2: @@ -463,10 +447,6 @@ void ivas_output_init( hOutSetup->is_loudspeaker_setup = 1; hOutSetup->ls_azimuth = ls_azimuth_CICP14; hOutSetup->ls_elevation = ls_elevation_CICP14; -#ifdef IVAS_FLOAT_FIXED - hOutSetup->ls_azimuth_fx = ls_azimuth_CICP14_fx; - hOutSetup->ls_elevation_fx = ls_elevation_CICP14_fx; -#endif hOutSetup->is_planar_setup = 0; break; case IVAS_AUDIO_CONFIG_5_1_4: @@ -475,10 +455,6 @@ void ivas_output_init( hOutSetup->is_loudspeaker_setup = 1; hOutSetup->ls_azimuth = ls_azimuth_CICP16; hOutSetup->ls_elevation = ls_elevation_CICP16; -#ifdef IVAS_FLOAT_FIXED - hOutSetup->ls_azimuth_fx = ls_azimuth_CICP16_fx; - hOutSetup->ls_elevation_fx = ls_elevation_CICP16_fx; -#endif hOutSetup->is_planar_setup = 0; break; case IVAS_AUDIO_CONFIG_7_1_4: @@ -487,10 +463,6 @@ void ivas_output_init( hOutSetup->is_loudspeaker_setup = 1; hOutSetup->ls_azimuth = ls_azimuth_CICP19; hOutSetup->ls_elevation = ls_elevation_CICP19; -#ifdef IVAS_FLOAT_FIXED - hOutSetup->ls_azimuth_fx = ls_azimuth_CICP19_fx; - hOutSetup->ls_elevation_fx = ls_elevation_CICP19_fx; -#endif hOutSetup->is_planar_setup = 0; break; case IVAS_AUDIO_CONFIG_BINAURAL: diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 206700c49..9951ca32a 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -396,11 +396,13 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs( HRTFS_PARAMBIN_HANDLE *hHrtfParambin /* i/o: HRTF structure for rendering */ ); +#ifndef IVAS_FLOAT_FIXED /*! r: Configured reqularization factor value */ float configure_reqularization_factor( const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int32_t ivas_total_brate /* i : total IVAS bitrate */ ); +#endif #ifndef IVAS_FLOAT_FIXED ivas_error ivas_dirac_alloc_mem( @@ -1522,9 +1524,12 @@ void TDREND_SPATIAL_VecInit_fx( #endif // IVAS_FLOAT_FIXED /*! r: Euclidian norm value */ +#ifndef IVAS_FLOAT_FIXED float TDREND_SPATIAL_VecNorm( const float *Vec_p /* i : Vector for norm calculation */ ); +#endif + #ifdef IVAS_FLOAT_FIXED void TDREND_SPATIAL_VecNormalize_fx( const Word32 *Vec_p_fx, /* i : Input vector Qx */ diff --git a/lib_rend/ivas_reflections.c b/lib_rend/ivas_reflections.c index c684c29c4..510a2a0fa 100644 --- a/lib_rend/ivas_reflections.c +++ b/lib_rend/ivas_reflections.c @@ -45,8 +45,6 @@ #ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" #include "debug.h" -#define float_to_fix( n, factor ) ( round( n * ( 1 << factor ) ) ) -#define fix_to_float( n, factor ) ( (float) n / ( 1 << factor ) ) #endif #ifdef IVAS_FLOAT_FIXED #include "ivas_rom_com_fx.h" @@ -202,7 +200,7 @@ ivas_error ivas_er_init( } /* Initialize Encoder */ - IF( ( error = ivas_er_encoder_init( reflections ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = ivas_er_encoder_init( reflections ) ), IVAS_ERR_OK ) ) { return error; } @@ -230,6 +228,7 @@ ivas_error ivas_er_set_reflections_mode( ivas_error error; UWord16 ch; error = IVAS_ERR_OK; + move32(); IF( EQ_32( reflections->audio_config, inConfig ) ) { diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index f1a8205a7..20eed1a88 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -50,6 +50,8 @@ static Word16 wrap_rad_fixed( Word32 angle /* Q13 */ ) { Word32 L_tmp = angle; + move32(); + /* Wrap azimuth value */ WHILE( GT_32( L_tmp, EVS_PI_FX ) ) { @@ -1033,6 +1035,7 @@ static ivas_error compute_t60_coeffs_fx( Word16 *pCoeffs_a_fx, *pCoeffs_b_fx, *targetT60_e; Word16 target_gains_db_exp[RV_LENGTH_NR_FC]; error = IVAS_ERR_OK; + move32(); tf_T60_len = nr_fc_fft_filter; move16(); len = add( pParams->t60_filter_order, 1 ); @@ -1688,6 +1691,7 @@ static ivas_error set_feedback_delay_fx( } hReverb->delay_line[branch].Delay = fb_delay; + move16(); return IVAS_ERR_OK; } @@ -2554,7 +2558,7 @@ ivas_error ivas_reverb_open_fx( Word32 *pT60_filter_coeff = (Word32 *) malloc( ( lenT60_filter_coeff ) * sizeof( Word32 * ) ); - FOR( int i = 0; i < nr_fc_fft_filter; i++ ) + FOR( Word16 i = 0; i < nr_fc_fft_filter; i++ ) { params.pDsr_fx[i] = L_shl( params.pDsr_fx[i], params.pDsr_e[i] ); move32(); @@ -2563,7 +2567,7 @@ ivas_error ivas_reverb_open_fx( pHrtf_avg_pwr_response_r_const[i] = L_shl( params.pHrtf_avg_pwr_response_r_const_fx[i], 5 ); /*Q23+5*/ move32(); } - FOR( int i = 0; i < lenT60_filter_coeff; i++ ) + FOR( Word16 i = 0; i < lenT60_filter_coeff; i++ ) { pT60_filter_coeff[i] = L_shl_sat( params.pT60_filter_coeff_fx[i], 17 ); move32(); @@ -2670,14 +2674,14 @@ ivas_error ivas_reverb_open_fx( /* Computing coloration filters on the basis of target responses */ ivas_reverb_calc_color_filters_fx( pColor_target_l_fx, pColor_target_r_fx, pTime_window_fx, pState->fft_size, 0, pFft_wf_filter_ch0_fx, pFft_wf_filter_ch1_fx, &q_pFft_wf_filter_ch0_fx, &q_pFft_wf_filter_ch1_fx ); - FOR( int i = 0; i < nr_fc_fft_filter; i++ ) + FOR( Word16 i = 0; i < nr_fc_fft_filter; i++ ) { pFft_wf_filter_ch0_fx[i][0] = L_shl( pFft_wf_filter_ch0_fx[i][0], sub( 31, q_pFft_wf_filter_ch0_fx ) ); move32(); pFft_wf_filter_ch0_fx[i][1] = L_shl( pFft_wf_filter_ch0_fx[i][1], sub( 31, q_pFft_wf_filter_ch0_fx ) ); move32(); } - FOR( int i = 0; i < nr_fc_fft_filter; i++ ) + FOR( Word16 i = 0; i < nr_fc_fft_filter; i++ ) { pFft_wf_filter_ch1_fx[i][0] = L_shl( pFft_wf_filter_ch1_fx[i][0], sub( 31, q_pFft_wf_filter_ch1_fx ) ); move32(); @@ -3061,12 +3065,14 @@ static void reverb_block_fx( UWord16 bsize = hReverb->full_block_size; UWord16 inner_bsize = INNER_BLK_SIZE; UWord16 i, j, k, ns, branch_idx, blk_idx, start_sample_idx; - Word32 *pFFT_buf[2], FFT_buf_1[RV_FILTER_MAX_FFT_SIZE], FFT_buf_2[RV_FILTER_MAX_FFT_SIZE]; Word32 pFeedback_input_fx[INNER_BLK_SIZE]; Word32 pTemp_fx[INNER_BLK_SIZE]; Word32 *ppOutput_fx[IVAS_REV_MAX_NR_BRANCHES]; Word32 Output_fx[IVAS_REV_MAX_NR_BRANCHES][INNER_BLK_SIZE]; + move16(); + move16(); + move16(); pFFT_buf[0] = &FFT_buf_1[0]; pFFT_buf[1] = &FFT_buf_2[0]; @@ -3147,7 +3153,7 @@ static void reverb_block_fx( /* Applying FFT filter to each sub-frame */ FOR( blk_idx = 0; blk_idx < hReverb->num_fft_subblocks; blk_idx++ ) { - start_sample_idx = blk_idx * hReverb->fft_subblock_size; + start_sample_idx = imult1616( blk_idx, hReverb->fft_subblock_size ); post_fft_filter_fx( hReverb, pOut0_fx + start_sample_idx, pOut1_fx + start_sample_idx, pFFT_buf[0], pFFT_buf[1] ); } @@ -3408,7 +3414,7 @@ static void predelay_block_fx( idx = 0; move16(); n_samples = hReverb->full_block_size; - WHILE( GT_16( n_samples, 0 ) ) + WHILE( n_samples > 0 ) { blk_size = n_samples; move16(); diff --git a/lib_rend/ivas_reverb_delay_line.c b/lib_rend/ivas_reverb_delay_line.c index 425afce0f..32599fd27 100644 --- a/lib_rend/ivas_reverb_delay_line.c +++ b/lib_rend/ivas_reverb_delay_line.c @@ -39,8 +39,6 @@ #ifdef IVAS_FLOAT_FIXED #include "prot_fx.h" #include "debug.h" -#define float_to_fix( n, factor ) ( round( n * ( 1 << factor ) ) ) -#define fix_to_float( n, factor ) ( (float) n / ( 1 << factor ) ) #endif #ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* diff --git a/lib_rend/ivas_reverb_fft_filter.c b/lib_rend/ivas_reverb_fft_filter.c index 1889974cd..db0706e99 100644 --- a/lib_rend/ivas_reverb_fft_filter.c +++ b/lib_rend/ivas_reverb_fft_filter.c @@ -69,23 +69,24 @@ UWord16 int_log2( UWord32 powerOf2 ) { Word16 l2 = 15; + move16(); - if ( powerOf2 & 0x00FF ) + IF ( powerOf2 & 0x00FF ) { l2 = sub( l2, 8 ); } - if ( powerOf2 & 0x0F0F ) + IF ( powerOf2 & 0x0F0F ) { l2 = sub( l2, 4 ); } - if ( powerOf2 & 0x3333 ) + IF ( powerOf2 & 0x3333 ) { l2 = sub( l2, 2 ); } - if ( powerOf2 & 0x5555 ) + IF ( powerOf2 & 0x5555 ) { l2 = sub( l2, 1 ); } @@ -618,6 +619,7 @@ Word16 ivas_reverb_fft_filter_init( } fft_filter->fft_size = fft_size; + move16(); return 0; } @@ -744,6 +746,7 @@ void ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR_fx( } #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED void ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( rv_fftwf_type_complex *spectrum, float *fft_real, @@ -762,6 +765,7 @@ void ivas_reverb_fft_filter_ConvertFFTWF_2_FFTR( return; } +#endif #ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------------------------* @@ -797,6 +801,7 @@ void ivas_reverb_fft_filter_CrossMix_fx( * buffer0 and 1 are cross mixed *-----------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_reverb_fft_filter_CrossMix( float *buffer0, float *buffer1, @@ -814,3 +819,4 @@ void ivas_reverb_fft_filter_CrossMix( return; } +#endif diff --git a/lib_rend/ivas_reverb_filter_design.c b/lib_rend/ivas_reverb_filter_design.c index ba6c43a09..a5fc6dc5c 100644 --- a/lib_rend/ivas_reverb_filter_design.c +++ b/lib_rend/ivas_reverb_filter_design.c @@ -526,6 +526,8 @@ static void apply_window_fft_fx( move32(); } *q_pFilter = 31; + move16(); + /* Do inverse fft to go to the time domain */ Word16 guarded_bits, temp; guarded_bits = find_guarded_bits_fx( fft_size ); @@ -548,10 +550,12 @@ static void apply_window_fft_fx( pFilter[idx] = Mpy_32_32( pWindow[idx], pFilter[idx] ); // q = q_pFilter + 30 - 31 move32(); } - *q_pFilter = add( *q_pFilter, sub( 30, 31 ) ); + *q_pFilter = add( *q_pFilter, 30 - 31 ); + move16(); + /* Convert back to the frequency domain */ temp = sub( L_norm_arr( pFilter, fft_size ), guarded_bits ); - IF( LT_16( temp, 0 ) ) + IF( temp < 0 ) { FOR( Word16 j = 0; j < fft_size; j++ ) { @@ -559,6 +563,7 @@ static void apply_window_fft_fx( move32(); } *q_pFilter = add( *q_pFilter, temp ); + move16(); } fft_rel_fx32( pFilter, fft_size, log2_fft_size ); // q = q_pFilter @@ -926,7 +931,7 @@ Word16 ivas_reverb_calc_color_filters_fx( FOR( idx = 0; idx <= half_fft_size; idx++ ) { test(); - IF( LT_32( pTargetL[idx], 0 ) || LT_32( pTargetR[idx], 0 ) ) /* Shouldn't have negative gains. */ + IF( pTargetL[idx] < 0 || pTargetR[idx] < 0 ) /* Shouldn't have negative gains. */ { return 1; } diff --git a/lib_rend/ivas_reverb_iir_filter.c b/lib_rend/ivas_reverb_iir_filter.c index 4129a61e6..be793fb35 100644 --- a/lib_rend/ivas_reverb_iir_filter.c +++ b/lib_rend/ivas_reverb_iir_filter.c @@ -219,7 +219,7 @@ void ivas_reverb_iir_filt_2taps_feed_blk_fx( move32(); Word32 flt_pBuffer_1_fx = iirFilter->pBuffer_fx[1]; move32(); - for ( i = 0; i < blk_size; i++ ) + FOR ( i = 0; i < blk_size; i++ ) { flt_output_fx = L_add( Mpy_32_32( L_shl( input[i], 1 ), flt_CoefB_0_fx ), flt_pBuffer_0_fx ); flt_pBuffer_0_fx = L_sub( L_add( flt_pBuffer_1_fx, Mpy_32_32( L_shl( input[i], 1 ), flt_CoefB_1_fx ) ), Mpy_32_32( L_shl( flt_output_fx, 1 ), flt_CoefA_1_fx ) ); diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 40cec0198..874fa8bf0 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -641,7 +641,7 @@ void rotateAziEle_fx_frac_az_el( Word32 angle; Word16 azi_in_q13, ele_in_q13; /*Conversion spherical to cartesian coordinates*/ - IF( GT_32( abs( azi_in ), _180_IN_Q22 ) ) + IF( GT_32( L_abs( azi_in ), _180_IN_Q22 ) ) { IF( azi_in > 0 ) { @@ -714,7 +714,7 @@ void rotateAziEle_fx_frac_az_el( move32(); *azi = L_shl( L_shr( L_add( *azi, ONE_IN_Q21 ), Q22 ), Q22 ); move32(); - if ( LT_32( abs( *azi ), ONE_IN_Q22 ) ) + if ( LT_32( L_abs( *azi ), ONE_IN_Q22 ) ) { move32(); *azi = 0; @@ -735,7 +735,7 @@ void rotateAziEle_fx_frac_az_el( move32(); *ele = L_shl( L_shr( L_add( *ele, ONE_IN_Q21 ), Q22 ), Q22 ); move32(); - if ( LT_32( abs( *ele ), ONE_IN_Q22 ) ) + if ( LT_32( L_abs( *ele ), ONE_IN_Q22 ) ) { *ele = 0; move32(); @@ -3598,7 +3598,7 @@ void SHrotmatgen_fx( d = 1; move16(); } - absm = extract_l( abs( m ) ); + absm = extract_l( L_abs( m ) ); sql2mm2 = square_root30_q12[sub( imult1616( l, l ), imult1616( m, m ) )]; move16(); diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index 9c95a2d8c..380faaf9f 100644 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -250,7 +250,7 @@ void ivas_sba_prototype_renderer_fx( ELSE IF( EQ_16( st_ivas->nchan_transport, 2 ) ) /* Opposing cardioids */ { Word32 temp_signal_fx[CLDFB_NO_CHANNELS_MAX]; - FOR( int idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) + FOR( Word16 idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { temp_signal_fx[idx] = L_add( L_shr( inRe_fx[0][ts][idx], 1 ), L_shr( inRe_fx[1][ts][idx], 1 ) ); move32(); @@ -260,7 +260,7 @@ void ivas_sba_prototype_renderer_fx( move32(); } - FOR( int idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) + FOR( Word16 idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { temp_signal_fx[idx] = L_add( L_shr( inIm_fx[0][ts][idx], 1 ), L_shr( inIm_fx[1][ts][idx], 1 ) ); move32(); diff --git a/lib_rend/ivas_shoebox.c b/lib_rend/ivas_shoebox.c index 5464c4882..ef31d384b 100644 --- a/lib_rend/ivas_shoebox.c +++ b/lib_rend/ivas_shoebox.c @@ -501,15 +501,6 @@ static void shoebox_get_coord_fx( IF( obj->isCartesian == 0 ) { /* Convert Spherical to Cartesian */ -#if 0 - IF ( obj->isRadians == 0 ) - { - FOR ( n = 0; n < loop_ub; n++ ) - { - fcnOutput_data[n] = deg2rad( src_pos_data[k + n] ); // not needed - } - } -#endif tmp_data[2] = Mpy_32_32( fcnOutput_data[2], shoebox_sin_cos_tbl_fx[fcnOutput_data[1]][0] ); //.29 = .30 * .30 move32(); rcoselev = Mpy_32_32( fcnOutput_data[2], shoebox_sin_cos_tbl_fx[fcnOutput_data[1]][1] ); //.29 = .30 * .30 @@ -915,7 +906,7 @@ void ivas_shoebox_set_scene( move32(); move32(); /* ---------- ADJUST LISTENER ------------- */ - if ( obj->isZHeight != 0 ) + IF ( obj->isZHeight != 0 ) { obj->list_pos_fx[2] = L_sub( list_pos_fx[2], L_shr( obj->cal.room_H_fx, 1 ) ); // Q.22 move32(); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 55efe1826..e718568f1 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -170,7 +170,9 @@ typedef struct #endif Word32 *bufferData_fx; Word16 nonDiegeticPan; +#ifndef IVAS_FLOAT_FIXED float nonDiegeticPanGain; +#endif #ifdef IVAS_FLOAT_FIXED Word32 nonDiegeticPanGain_fx; #endif @@ -658,6 +660,7 @@ static Word32 limitRendererOutput_fx( Word32 **channels; Word16 num_channels; Word32 numClipping = 0; + move32(); /* return early if given bad parameters */ test(); @@ -1164,8 +1167,13 @@ 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 ); @@ -1365,6 +1373,8 @@ static ivas_error getAmbisonicsOrder_fx( return IVAS_ERR_OK; } #endif + +#ifndef IVAS_FLOAT_FIXED static ivas_error getAmbisonicsOrder( AUDIO_CONFIG config, int16_t *order ) @@ -1386,6 +1396,7 @@ static ivas_error getAmbisonicsOrder( return IVAS_ERR_OK; } +#endif #ifdef IVAS_FLOAT_FIXED static Word16 getNumLfeChannels( @@ -2199,17 +2210,6 @@ static IVAS_ISM_METADATA defaultObjectPosition( move32(); pos.pitch_fx = 0; move32(); -#if 0 /*TODO: To be removed*/ - pos.azimuth = 0.0f; - pos.elevation = 0.0f; - pos.radius = 1.0f; - pos.spread = 0.0f; - pos.gainFactor = 1.0f; - pos.yaw = 0.0f; - pos.pitch = 0.0f; - pos.non_diegetic_flag = 0; -#endif - return pos; } @@ -2230,7 +2230,7 @@ static IVAS_ISM_METADATA defaultObjectPosition( return pos; } -#endif // DEBUG +#endif // IVAS_FLOAT_FIXED static int8_t checkObjectPositionChanged( IVAS_ISM_METADATA *currentPos, @@ -2363,11 +2363,7 @@ static ivas_error initIsmMasaRendering( IF( inputIsm->tdRendWrapper.hBinRendererTd != NULL ) { -#ifdef IVAS_FLOAT_FIXED - ivas_td_binaural_close_fx( &inputIsm->tdRendWrapper.hBinRendererTd ); -#else ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); -#endif // IVAS_FLOAT_FIXED inputIsm->tdRendWrapper.hHrtfTD = NULL; } @@ -4114,7 +4110,7 @@ static ivas_error initMcBinauralRendering( move16(); test(); - IF( ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) && NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) + IF( ( EQ_32( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) && NE_16( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) ) { nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */ } @@ -5299,7 +5295,7 @@ static ivas_error setRendInputActiveMasa( } ELSE { - IF( ( error = initMasaExtRenderer( inputMasa, outConfig ) ) != IVAS_ERR_OK ) + IF( NE_32( ( error = initMasaExtRenderer( inputMasa, outConfig ) ), IVAS_ERR_OK ) ) { return error; } @@ -5442,9 +5438,6 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsIsm[i].crendWrapper = NULL; hIvasRend->inputsIsm[i].hReverb = NULL; hIvasRend->inputsIsm[i].tdRendWrapper.hBinRendererTd = NULL; -#if 0 - hIvasRend->inputsIsm[i].bufferData = NULL; -#endif hIvasRend->inputsIsm[i].nonDiegeticPan = nonDiegeticPan; move16(); hIvasRend->inputsIsm[i].nonDiegeticPanGain_fx = nonDiegeticPanGain; @@ -5461,9 +5454,6 @@ ivas_error IVAS_REND_Open( hIvasRend->inputsMc[i].crendWrapper = NULL; hIvasRend->inputsMc[i].hReverb = NULL; hIvasRend->inputsMc[i].tdRendWrapper.hBinRendererTd = NULL; -#if 0 - hIvasRend->inputsMc[i].bufferData = NULL; -#endif hIvasRend->inputsMc[i].bufferData_fx = NULL; hIvasRend->inputsMc[i].lfeDelayBuffer_fx = NULL; hIvasRend->inputsMc[i].nonDiegeticPan = nonDiegeticPan; @@ -5478,9 +5468,6 @@ ivas_error IVAS_REND_Open( initRendInputBase_fx( &hIvasRend->inputsSba[i].base, IVAS_AUDIO_CONFIG_INVALID, 0, getRendCtx( hIvasRend ), NULL, 0 ); hIvasRend->inputsSba[i].crendWrapper = NULL; -#if 0 - hIvasRend->inputsSba[i].bufferData = NULL; -#endif hIvasRend->inputsSba[i].bufferData_fx = NULL; hIvasRend->inputsSba[i].hDirAC = NULL; } @@ -10019,7 +10006,7 @@ static ivas_error renderIsmToSba( return error; } - IF( NE_32( ( error = getAmbisonicsOrder( outConfig, &ambiOrderOut ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = getAmbisonicsOrder_fx( outConfig, &ambiOrderOut ) ), IVAS_ERR_OK ) ) { return error; } @@ -10171,7 +10158,7 @@ static void renderIsmToMasa( FOR( i = 1; i < MAX_NUM_OBJECTS; i++ ) { - IF( max_e < input_e[0] ) + IF( LT_16( max_e, input_e[0] ) ) max_e = input_e[i]; move16(); } @@ -10186,7 +10173,7 @@ static void renderIsmToMasa( } max_e = add( max_e, guard_bits ); - q_fact = sub( 31, max_e ); + q_fact = sub( Q31, max_e ); ivas_omasa_ana_fx( ismInput->hOMasa, tmpRendBuffer_fx, &q_fact, ismInput->base.inputBuffer.config.numSamplesPerChannel, outAudio.config.numChannels, ismInput->base.inputBuffer.config.numChannels ); @@ -10232,6 +10219,7 @@ static ivas_error renderInputIsm( move16(); error = IVAS_ERR_OK; + move32(); inAudio = ismInput->base.inputBuffer; IF( NE_32( ismInput->base.numNewSamplesPerChannel, outAudio.config.numSamplesPerChannel ) ) @@ -10243,7 +10231,7 @@ static ivas_error renderInputIsm( /* Apply input gain to new audio */ v_multc_fixed( inAudio.data_fx, ismInput->base.gain_fx, inAudio.data_fx, imult1616( inAudio.config.numSamplesPerChannel, inAudio.config.numChannels ) ); - *outAudio.pq_fact = sub( *outAudio.pq_fact, 1 ); + *outAudio.pq_fact = sub( *outAudio.pq_fact, Q1 ); exp = *outAudio.pq_fact; move16(); @@ -10400,12 +10388,6 @@ static ivas_error renderActiveInputsIsm( *outAudio.pq_fact = sub( input_q, 1 ); move16(); } -#if 0 /*To be removed later when dependency on data is removed*/ - FOR( Word16 j = 0; j < outAudio.config.numSamplesPerChannel * outAudio.config.numChannels; ++j ) - { - outAudio.data[j] = fixedToFloat( outAudio.data_fx[j], input_q - 1 ); - } -#endif return IVAS_ERR_OK; } #else @@ -10637,7 +10619,7 @@ static ivas_error renderMcToBinaural( FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) { - Scale_sig32( tmpRendBuffer_fx[i], L_FRAME48k, -sub( 11, exp ) ); + Scale_sig32( tmpRendBuffer_fx[i], L_FRAME48k, -sub( Q11, exp ) ); } } ELSE @@ -10836,7 +10818,7 @@ static ivas_error renderMcToBinauralRoom( FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) { - Scale_sig32( tmpRendBuffer[i], L_FRAME48k, sub( 11, exp ) ); + Scale_sig32( tmpRendBuffer[i], L_FRAME48k, sub( Q11, exp ) ); } IF( NE_32( ( error = ivas_td_binaural_renderer_ext_fx( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput, mcInput->base.ctx.pCombinedOrientationData, NULL, mcInput->hReverb, @@ -10848,7 +10830,7 @@ static ivas_error renderMcToBinauralRoom( FOR( i = 0; i < MAX_OUTPUT_CHANNELS; ++i ) { - Scale_sig32( tmpRendBuffer[i], L_FRAME48k, -sub( 11, exp ) ); + Scale_sig32( tmpRendBuffer[i], L_FRAME48k, -sub( Q11, exp ) ); } //*outAudio.pq_fact = exp; } @@ -10891,7 +10873,7 @@ static ivas_error renderMcToBinauralRoom( } IF( hCrend->hReverb != NULL ) { - exp = sub( exp, 2 ); + exp = sub( exp, Q2 ); } } @@ -11054,7 +11036,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( { return error; } - exp = sub( *outAudio.pq_fact, 1 ); + exp = sub( *outAudio.pq_fact, Q1 ); } /* intermediate conversion to 7_1_4 */ @@ -11334,7 +11316,7 @@ static ivas_error renderInputMc( mcInput->base.numNewSamplesPerChannel = 0; move32(); v_multc_fixed( inAudio.data_fx, mcInput->base.gain_fx, inAudio.data_fx, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); - *outAudio.pq_fact = sub( *outAudio.pq_fact, 1 ); // reducing the Q by 1 compensating for the v_mult_fixed done + *outAudio.pq_fact = sub( *outAudio.pq_fact, Q1 ); // reducing the Q by 1 compensating for the v_mult_fixed done /* set combined orientation subframe info to start info */ ivas_combined_orientation_set_to_start_index( *( mcInput->base.ctx.pCombinedOrientationData ) ); @@ -11642,7 +11624,7 @@ static ivas_error renderSbaToBinaural( } IF( hCrend->hReverb != NULL ) { - *outAudio.pq_fact = sub( *outAudio.pq_fact, 2 ); + *outAudio.pq_fact = sub( *outAudio.pq_fact, Q2 ); move16(); } accumulate2dArrayToBuffer_fx( output_buffer_fx, &outAudio ); @@ -11771,7 +11753,7 @@ static ivas_error renderSbaToBinauralRoom( { combinedOrientationEnabled = 1; move16(); - break; + BREAK; } } } @@ -12595,6 +12577,7 @@ static ivas_error renderInputMasa( /* Apply input gain to new audio */ v_multc_fixed( inAudio.data_fx, masaInput->base.gain_fx, inAudio.data_fx, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); *outAudio.pq_fact = sub( *outAudio.pq_fact, 1 ); // to compensate for the qfactor reduction in gain multiplication. + move16(); maxBin = extract_l( Mpy_32_32( *masaInput->base.ctx.pOutSampleRate, INV_CLDFB_BANDWIDTH_Q31 ) ); @@ -12624,9 +12607,7 @@ static ivas_error renderInputMasa( case RENDERER_DIRAC: copyMasaMetadataToDiracRenderer_fx( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); -#if 1 // TOBE REMOVED intermidiate_ext_dirac_render( masaInput->hMasaExtRend, 1 ); -#endif FOR( ch = 0; ch < masaInput->hMasaExtRend->hDirACRend->hOutSetup.nchan_out_woLFE + masaInput->hMasaExtRend->hDirACRend->hOutSetup.num_lfe; ch++ ) { masaInput->hMasaExtRend->cldfbAnaRend[0]->Q_cldfb_state = Q11; @@ -12646,9 +12627,7 @@ static ivas_error renderInputMasa( masaInput->hMasaExtRend->cldfbAnaRend[0]->Q_cldfb_state = Q11; } -#if 1 // TOBE REMOVED intermidiate_ext_dirac_render( masaInput->hMasaExtRend, 0 ); -#endif BREAK; case RENDERER_STEREO_PARAMETRIC: case RENDERER_BINAURAL_PARAMETRIC: @@ -13263,7 +13242,11 @@ 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 ) ) { @@ -14914,12 +14897,6 @@ static ivas_error initMasaExtRenderer( { return error; } -#if 1 /*TODO: To be removed later after dependency on floating buffers in hHrtfParambin is removed*/ - IF( NE_32( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &inputMasa->hMasaExtRend->hHrtfParambin ) ), IVAS_ERR_OK ) ) - { - return error; - } -#endif // IVAS_FLOAT_FIXED } IF( NE_32( ( error = ivas_masa_ext_rend_parambin_init( inputMasa ) ), IVAS_ERR_OK ) ) @@ -15130,6 +15107,7 @@ static void intermidiate_ext_dirac_render( h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); subframe_idx = hSpatParamRendCom->subframes_rendered; + move16(); DirAC_mem = hDirACRend->stack_mem; @@ -15150,12 +15128,14 @@ static void intermidiate_ext_dirac_render( Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len ); scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len, shift ); hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = add( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, shift ); + move16(); } IF( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx ) { Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len ); scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len, shift ); hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = add( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, shift ); + move16(); } IF( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx ) @@ -15163,6 +15143,7 @@ static void intermidiate_ext_dirac_render( Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands ); scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len, shift ); hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth = add( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, shift ); + move16(); } Word16 num_channels_dir = hDirACRend->num_outputs_dir; diff --git a/lib_util/test_fft.c b/lib_util/test_fft.c index 9f787ccee..51c824a1b 100644 --- a/lib_util/test_fft.c +++ b/lib_util/test_fft.c @@ -30,7 +30,6 @@ *******************************************************************************************************/ - #include #include #include @@ -51,6 +50,7 @@ #define max( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) #endif +#if 0 extern const float fftSineTab640[321]; void DoFFT_fx( @@ -120,13 +120,12 @@ void run_fft_unit_test( void ); extern const Word16 fftSineTab640_fx[321]; -#if 0 void fft_rel_fx32( Word32 x[], /* i/o: input/output vector */ const Word16 n, /* i : vector length */ const Word16 m /* i : log2 of vector length */ ); -#else + void fft_rel_fx32( Word32 *x, /* i/o: input/output vector */ const Word16 n, /* i : vector length */ @@ -137,7 +136,6 @@ void ifft_rel_fx32( const Word16 n, /* i : vector length */ const Word16 m /* i : log2 of vector length */ ); -#endif void fft_cldfb( float *data, /* i/o: input/output vector */ @@ -831,3 +829,4 @@ void run_fft_unit_test( void ) test_main( &fft_fft3_lengths[0], sizeof( fft_fft3_lengths ) / sizeof( fft_fft3_lengths[0] ), TYPE_fft_ifft3 ); return; } +#endif diff --git a/lib_util/test_mdct.c b/lib_util/test_mdct.c index ec4e170bd..339681819 100644 --- a/lib_util/test_mdct.c +++ b/lib_util/test_mdct.c @@ -49,6 +49,7 @@ typedef short int16_t; #define ALLOWED_DEVIATION ( 0.05 ) #define Q31 ( 2147483647.0f ) +#if 0 extern const int16_t ip_edct2_64[6]; extern const float w_edct2_64[80]; extern const Word16 w_edct2_64_fx[80]; @@ -231,3 +232,4 @@ void run_mdct_unit_test( void ) test_main( &edct2_lengths[0], 1, TYPE_NEG_EDCT2 ); return; } +#endif -- GitLab From d50d77313fd12e1d36b13cab9cf81b7708adc8dc Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 8 Aug 2024 16:27:33 +0530 Subject: [PATCH 2/3] Clang formatting changes added --- lib_com/ivas_spar_com_quant_util.c | 2 +- lib_com/ivas_stereo_eclvq_com_fx.c | 2 +- lib_com/ivas_stereo_mdct_bands_com.c | 2 +- lib_com/ivas_tools.c | 8 +++--- lib_com/ivas_transient_det.c | 3 +-- lib_com/low_rate_band_att_fx.c | 2 +- lib_com/lpc_tools_fx.c | 2 +- lib_com/modif_fs_fx.c | 1 - lib_com/parameter_bitmaping_fx.c | 2 +- lib_com/phase_dispersion_fx.c | 8 +++--- lib_com/pvq_com_fx.c | 4 +-- lib_com/re8_util_fx.c | 1 - lib_com/residu_fx.c | 1 - lib_com/rom_basop_util.h | 2 +- lib_com/swb_bwe_com_fx.c | 10 +++---- lib_com/swb_bwe_com_hr.c | 2 +- lib_com/tcq_position_arith.c | 25 ++++++++--------- lib_com/tools_fx.c | 16 +++++------ lib_dec/acelp_core_dec_ivas_fx.c | 2 +- lib_rend/ivas_dirac_dec_binaural_functions.c | 21 ++++++++------- lib_rend/ivas_dirac_decorr_dec.c | 28 ++++++++++---------- lib_rend/ivas_dirac_onsets_dec.c | 26 +++++++++--------- lib_rend/ivas_dirac_rend.c | 12 ++++----- lib_rend/ivas_efap.c | 10 +++---- lib_rend/ivas_mcmasa_ana.c | 2 +- lib_rend/ivas_objectRenderer_sources.c | 4 +-- lib_rend/ivas_omasa_ana.c | 2 +- lib_rend/ivas_reflections.c | 2 +- lib_rend/ivas_reverb.c | 6 ++--- lib_rend/ivas_reverb_fft_filter.c | 12 ++++----- lib_rend/ivas_reverb_filter_design.c | 6 ++--- lib_rend/ivas_reverb_iir_filter.c | 2 +- lib_rend/ivas_shoebox.c | 2 +- lib_rend/lib_rend.c | 14 +++++----- 34 files changed, 121 insertions(+), 123 deletions(-) diff --git a/lib_com/ivas_spar_com_quant_util.c b/lib_com/ivas_spar_com_quant_util.c index 6bd4a833c..a40f8c2ac 100644 --- a/lib_com/ivas_spar_com_quant_util.c +++ b/lib_com/ivas_spar_com_quant_util.c @@ -612,4 +612,4 @@ void ivas_clear_band_coeff_idx( return; } -#endif \ No newline at end of file +#endif diff --git a/lib_com/ivas_stereo_eclvq_com_fx.c b/lib_com/ivas_stereo_eclvq_com_fx.c index 828ea6b40..deebbe7b8 100644 --- a/lib_com/ivas_stereo_eclvq_com_fx.c +++ b/lib_com/ivas_stereo_eclvq_com_fx.c @@ -113,4 +113,4 @@ void ECSQ_dequantize_vector_fx( return; } -#endif \ No newline at end of file +#endif diff --git a/lib_com/ivas_stereo_mdct_bands_com.c b/lib_com/ivas_stereo_mdct_bands_com.c index 80153b619..ab2357d24 100644 --- a/lib_com/ivas_stereo_mdct_bands_com.c +++ b/lib_com/ivas_stereo_mdct_bands_com.c @@ -303,7 +303,7 @@ void stereo_mdct_init_bands_fx( IF( LT_16( sfbOffset[*sfbCnt], L_frameTCX ) ) { Word16 nMissingBins = sub( L_frameTCX, sfbOffset[*sfbCnt] ); - IF ( LT_16( shr( sfbWidths[i], 1 ), nMissingBins ) ) + IF( LT_16( shr( sfbWidths[i], 1 ), nMissingBins ) ) { *sfbCnt = add( *sfbCnt, 1 ); move16(); diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index d36b935cb..288db9193 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -950,11 +950,11 @@ void v_mult_mat_fixed( { pt_x = x; *pt_y = 0; - move32(); + move32(); FOR( j = 0; j < Nr; j++ ) { *pt_y = L_add( *pt_y, L_shr( Mpy_32_32( ( *pt_x++ ), ( *pt_A++ ) ), guardbits ) ); - move32(); + move32(); } pt_y++; } @@ -1230,7 +1230,7 @@ Word32 lin_interp32_fx( temp_div = L_deposit_h( BASOP_Util_Divide3232_Scale( temp32, L_sub( x2, x1 ), &temp_e ) ); // 31-temp_e + 2*Qin -31 - Qin = Qin-temp_e temp32 = BASOP_Util_Add_Mant32Exp( y1, sub( 31, *Q_io ), temp_div, sub( 31, sub( *Q_io, temp_e ) ), &exp_out ); // Qin-temp_e *Q_io = sub( 31, exp_out ); - move16(); + move16(); return temp32; } @@ -3638,4 +3638,4 @@ Word64 var_32_fx( return var; } -#endif \ No newline at end of file +#endif diff --git a/lib_com/ivas_transient_det.c b/lib_com/ivas_transient_det.c index 55af71d0f..65bb7f72b 100644 --- a/lib_com/ivas_transient_det.c +++ b/lib_com/ivas_transient_det.c @@ -127,7 +127,7 @@ #ifdef IVAS_FLOAT_FIXED static void ivas_transient_det_init( ivas_trans_det_state_t *hTranDet, /* i/o: Transient detector handle */ - const Word32 sampling_rate /* i : sampling rate */ + const Word32 sampling_rate /* i : sampling rate */ ) { Word16 i; @@ -331,7 +331,6 @@ static void ivas_transient_det_init( hTranDet->in_duck_coeff = IVAS_C_IN_DUCK_16k; hTranDet->out_duck_coeff = IVAS_C_OUT_DUCK_16k; break; - } ivas_filters_init( &hTranDet->env_hpf, (const float *) filt_coeff_arr[0], IVAS_FILTER_ORDER_1 ); diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c index 22d91e392..5efed0d03 100644 --- a/lib_com/low_rate_band_att_fx.c +++ b/lib_com/low_rate_band_att_fx.c @@ -348,4 +348,4 @@ void fine_gain_dec_fx( return; } -#endif \ No newline at end of file +#endif diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index d550f0940..26a9549d6 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -1446,4 +1446,4 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs, Word16 *lsf, const Word16 *o lsf[lpcOrder - 1] = shr( lsf[lpcOrder - 1], 1 ); move16(); } -} \ No newline at end of file +} diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c index 3f3210eb9..c84dc802a 100644 --- a/lib_com/modif_fs_fx.c +++ b/lib_com/modif_fs_fx.c @@ -1639,4 +1639,3 @@ void retro_interp5_4_fx( return; } - diff --git a/lib_com/parameter_bitmaping_fx.c b/lib_com/parameter_bitmaping_fx.c index cc33f8c51..6c661efa8 100644 --- a/lib_com/parameter_bitmaping_fx.c +++ b/lib_com/parameter_bitmaping_fx.c @@ -57,7 +57,7 @@ void ReadFromBitstream_fx( param = ¶msBitMap->params[iParam]; test(); test(); - fShiftValue = s_and( (Word16) param->fZeroAllowed == 0 , param->EncodeValue == NULL ); + fShiftValue = s_and( (Word16) param->fZeroAllowed == 0, param->EncodeValue == NULL ); value = GetFromBitstream( st, param->DecodeValue, index, param->nBits, pStream ); IF( fShiftValue ) { diff --git a/lib_com/phase_dispersion_fx.c b/lib_com/phase_dispersion_fx.c index a695c57ba..16feab191 100644 --- a/lib_com/phase_dispersion_fx.c +++ b/lib_com/phase_dispersion_fx.c @@ -63,7 +63,7 @@ void phase_dispersion( IF( GT_32( gain_code, L_add( *prev_gain_code, L_shl( *prev_gain_code, 1 ) ) ) ) #endif { - IF ( LT_16( state, 2 ) ) + IF( LT_16( state, 2 ) ) { state = add( state, 1 ); } @@ -74,7 +74,7 @@ void phase_dispersion( FOR( i = 0; i < 6; i++ ) { - IF ( LT_32( prev_gain_pit[i], 9830 /*0.6f Q14*/ ) ) + IF( LT_32( prev_gain_pit[i], 9830 /*0.6f Q14*/ ) ) { j = add( j, 1 ); } @@ -86,7 +86,7 @@ void phase_dispersion( state = 0; } - IF ( GT_16( sub( state, *prev_state ), 1 ) ) + IF( GT_16( sub( state, *prev_state ), 1 ) ) { state = sub( state, 1 ); } @@ -176,7 +176,7 @@ void phase_dispersion( { #ifdef BASOP_NOGLOB code[i] = round_fx_o( L_shl_o( x32[i], scale2, &Overflow ), &Overflow ); - move16(); + move16(); #else code[i] = round_fx( L_shl( x32[i], scale2 ) ); #endif diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c index 8a0a25dd4..b97cd6767 100644 --- a/lib_com/pvq_com_fx.c +++ b/lib_com/pvq_com_fx.c @@ -142,14 +142,14 @@ void dsDiracPerQuanta_fx( move16(); t_quanta_o = sub( t_quanta, QUANTAQ3OFFSET ); - IF ( GE_16( t_quanta_o, sv[nsv] ) ) + IF( GE_16( t_quanta_o, sv[nsv] ) ) { *DsIdx = nsv; move16(); return; } - IF ( LE_16( t_quanta_o, sv[1] ) ) + IF( LE_16( t_quanta_o, sv[1] ) ) { *DsIdx = 1; move16(); diff --git a/lib_com/re8_util_fx.c b/lib_com/re8_util_fx.c index 686343aea..00909e2f5 100644 --- a/lib_com/re8_util_fx.c +++ b/lib_com/re8_util_fx.c @@ -388,4 +388,3 @@ static void re8_coord_fx( return; } - diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index 4ac900e8a..e06ef40ea 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -212,4 +212,3 @@ void calc_residu_fx( } return; } - diff --git a/lib_com/rom_basop_util.h b/lib_com/rom_basop_util.h index 3e25469d0..2626f6f43 100644 --- a/lib_com/rom_basop_util.h +++ b/lib_com/rom_basop_util.h @@ -50,4 +50,4 @@ extern const PWord16 SineTable320[161]; void BASOP_getTables( const PWord16 **ptwiddle, const PWord16 **sin_twiddle, Word16 *sin_step, Word16 length ); const PWord16 *getSineWindowTable( Word16 length ); -#endif \ No newline at end of file +#endif diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c index ac75dc55d..399106de3 100644 --- a/lib_com/swb_bwe_com_fx.c +++ b/lib_com/swb_bwe_com_fx.c @@ -421,7 +421,7 @@ static void calc_norm_envelop_lf_fx( IF( LT_16( add( shl( sub( 328, *efreq ), 1 ), 1 ), *L_swb_norm ) ) { *L_swb_norm = add( shl( sub( 328, *efreq ), 1 ), 1 ); - move16(); + move16(); } } ELSE @@ -1913,7 +1913,7 @@ IF( EQ_16( mode, HARMONIC ) ) pit1 -= 16; FOR( n_freq = 0; n_freq < 16; n_freq++ ) { - IF ( LT_16( abs_s( *pit1 ), mean ) ) + IF( LT_16( abs_s( *pit1 ), mean ) ) { *pit1 = mult_r( *pit1, 6554 ); /*Q15*/ move16(); @@ -2316,7 +2316,7 @@ void time_reduce_pre_echo_fx( IF( pos > 0 ) { - IF ( LT_16( pos, 3 ) ) + IF( LT_16( pos, 3 ) ) { pos = add( pos, 1 ); } @@ -2507,13 +2507,13 @@ void calc_normal_length_fx_32( L_tmp1 = Mult_32_16( peak, shl( add( 15, THRES ), 10 ) ); L_tmp2 = Mult_32_16( mean, shl( THRES, 10 ) ); test(); - IF ( GT_32( L_tmp1, L_tmp2 ) && GT_32( peak, 40960 ) ) + IF( GT_32( L_tmp1, L_tmp2 ) && GT_32( peak, 40960 ) ) { n_band = add( n_band, 1 ); } } - IF( core == ACELP_CORE ) + IF( core == ACELP_CORE ) { L_swb_norm_trans = add( 4, shr( n_band, 2 ) ); L_swb_norm_norm = add( 8, shr( n_band, 1 ) ); diff --git a/lib_com/swb_bwe_com_hr.c b/lib_com/swb_bwe_com_hr.c index 7da87d12d..7286ffc4f 100644 --- a/lib_com/swb_bwe_com_hr.c +++ b/lib_com/swb_bwe_com_hr.c @@ -323,4 +323,4 @@ float td_postprocess( return ( gain ); } -#endif \ No newline at end of file +#endif diff --git a/lib_com/tcq_position_arith.c b/lib_com/tcq_position_arith.c index e7a76d51f..7d26888d3 100644 --- a/lib_com/tcq_position_arith.c +++ b/lib_com/tcq_position_arith.c @@ -99,7 +99,7 @@ Word32 ar_div_ivas( num = L_abs( num ); denum = L_abs( denum ); - test(); + test(); IF( L_sub( num, denum ) < 0 || denum == 0 ) { return 0; @@ -342,12 +342,12 @@ void decode_position_ari_fx_ivas( { Word16 tmp; mode_num_nz[0] = MAX_AR_FREQ; - move16(); + move16(); FOR( i = 0; i < size; i++ ) { tmp = div_l( L_deposit_h( sub( sub( size, i ), 1 ) ), size ); mode_num_nz[i + 1] = round_fx( L_shr( L_deposit_h( tmp ), 1 ) ); - move16(); + move16(); } position[ar_decode( pardec, mode_num_nz )] = 1; @@ -383,7 +383,8 @@ void decode_position_ari_fx_ivas( scp = Mult_32_16( scp, extract_l( cp ) ); mode_num_nz[sub( sub( add( i, 1 ), storepos ), stpos )] = round_fx( L_shl( scp, 6 ) ); - test(); test(); + test(); + test(); IF( ( mode_num_nz[sub( sub( add( i, 1 ), storepos ), stpos )] == 0 && scp > 0 ) || EQ_16( mode_num_nz[sub( sub( i, storepos ), stpos )], mode_num_nz[sub( sub( add( i, 1 ), storepos ), stpos )] ) ) { ovrflag = 1; @@ -527,7 +528,7 @@ void decode_magnitude_usq_fx_ivas( cp = L_sub( fxone, tmp ); } - IF ( EQ_32( cp, fxone ) ) + IF( EQ_32( cp, fxone ) ) { BREAK; } @@ -653,8 +654,8 @@ void decode_mangitude_tcq_fx_ivas( Word16 i, j, symbol, st; Word16 leftp = npulses; /*pulsesnum; */ Word16 leftnz = nzpos; /*nzpos; */ - move16(); - move16(); + move16(); + move16(); Word16 magn_mode[3] = { MAX_AR_FREQ, 0, 0 }; move16(); move16(); @@ -725,7 +726,7 @@ void decode_mangitude_tcq_fx_ivas( quantum1_fx = quantize_fx_ivas( shl( add( j, 1 ), 10 ), ddec[st][0] ); quantum2_fx = quantize_fx_ivas( shl( add( j, 1 ), 10 ), ddec[st][1] ); - test(); + test(); if ( sub( quantum1_fx, add( j, 1 ) ) != 0 && sub( quantum2_fx, add( j, 1 ) ) != 0 ) { prob0_fx = MAX_16; @@ -734,7 +735,7 @@ void decode_mangitude_tcq_fx_ivas( move16(); } - test(); + test(); if ( sub( prob0_fx, MAX_16 ) == 0 || sub( prob1_fx, MAX_16 ) == 0 ) { symbol = add( j, 1 ); @@ -789,15 +790,15 @@ void decode_mangitude_tcq_fx_ivas( { out[i] = 0; move32(); - IF ( positions[i] != 0 ) + IF( positions[i] != 0 ) { out[i] = add( sub( leftp, leftnz ), 1 ); move32(); } } - test(); - IF ( sub( nzpos, npulses ) != 0 && sub( nzpos, 1 ) > 0 ) + test(); + IF( sub( nzpos, npulses ) != 0 && sub( nzpos, 1 ) > 0 ) { /*update the surplus */ *surplus_fx = L_add( *surplus_fx, L_sub( tcq_bits_fx, L_shl( bits_fx, 1 ) ) ); diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c index 90c2a1406..d0b3dd0dd 100644 --- a/lib_com/tools_fx.c +++ b/lib_com/tools_fx.c @@ -284,7 +284,7 @@ Word16 usdequant_fx( /* Qx*/ #ifdef BASOP_NOGLOB g = round_fx_sat( L_shl_sat( L_tmp, 16 ) ); /*Qx */ #else - g = round_fx( L_shl( L_tmp, 16 ) ); /*Qx */ + g = round_fx( L_shl( L_tmp, 16 ) ); /*Qx */ #endif return ( g ); } @@ -334,7 +334,7 @@ Word16 usquant_fx( /* o: index of the winning codeword */ #ifdef BASOP_NOGLOB *xq = round_fx_o( L_shl_o( L_tmp, 16, &Overflow ), &Overflow ); /*Qx */ #else - *xq = round_fx( L_shl( L_tmp, 16 ) ); /*Qx */ + *xq = round_fx( L_shl( L_tmp, 16 ) ); /*Qx */ #endif return idx; } @@ -411,7 +411,7 @@ Word32 sum2_fx( /* o : sum of all squared vector elements #ifdef BASOP_NOGLOB L_tmp = L_mac_o( L_tmp, vec[i], vec[i], &Overflow ); /*Q(2x+1) */ #else /* BASOP_NOGLOB */ - L_tmp = L_mac( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ + L_tmp = L_mac( L_tmp, vec[i], vec[i] ); /*Q(2x+1) */ #endif /* BASOP_NOGLOB */ } @@ -1516,8 +1516,8 @@ Word16 var_fx( /* o: variance of vector Qx*/ tmp = sub_sat( x[i], m ); /*Qx */ v = L_mac0_sat( v, tmp, tmp ); /*(Qx+Qx) */ #else - tmp = sub( x[i], m ); /*Qx */ - v = L_mac0( v, tmp, tmp ); /*(Qx+Qx) */ + tmp = sub( x[i], m ); /*Qx */ + v = L_mac0( v, tmp, tmp ); /*(Qx+Qx) */ #endif } L_tmp = Mult_32_16( v, inv_len ); /*Q(14-exp+Qx+Qx) */ @@ -2011,7 +2011,7 @@ Word32 sum32_fx( /* o : sum of all vector elements #ifdef BASOP_NOGLOB tmp = L_add_sat( tmp, vec[i] ); /*Qx */ #else /* BASOP_NOGLOB */ - tmp = L_add( tmp, vec[i] ); /*Qx */ + tmp = L_add( tmp, vec[i] ); /*Qx */ #endif /* BASOP_NOGLOB */ } @@ -2031,7 +2031,7 @@ Word16 sum16_fx( /* o : sum of all vector elements #ifdef BASOP_NOGLOB tmp = add_sat( tmp, vec[i] ); /*Qx */ #else - tmp = add( tmp, vec[i] ); /*Qx */ + tmp = add( tmp, vec[i] ); /*Qx */ #endif } @@ -2731,7 +2731,7 @@ void pz_filter_dp_fx( #ifdef BASOP_NOGLOB Ltemp1 = L_shr_sat( Lacc, s ); /* Ltemp1 in Qc+Qa+Qn=Q(16+Qn) */ #else - Ltemp1 = L_shr( Lacc, s ); /* Ltemp1 in Qc+Qa+Qn=Q(16+Qn) */ + Ltemp1 = L_shr( Lacc, s ); /* Ltemp1 in Qc+Qa+Qn=Q(16+Qn) */ #endif y[i] = extract_h( Ltemp1 ); /* y[i] in Qn */ move16(); diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index feabac6f8..9dbac8dd6 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -88,7 +88,7 @@ ivas_error acelp_core_dec_ivas_fx( #ifdef MSAN_FIX Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )] = { 0 }; /* A(q) quantized for the 4 subframes */ #else - Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )]; /* A(q) quantized for the 4 subframes */ + Word16 Aq_fx[NB_SUBFR16k * ( M + 1 )]; /* A(q) quantized for the 4 subframes */ #endif Word16 old_exc2_fx[L_FRAME16k + L_EXC_MEM], *exc2_fx; /* total excitation buffer */ Word16 mem_tmp_fx[M]; /* temporary synthesis filter memory */ diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index fa1a8c530..bfa3ccf23 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -548,14 +548,15 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx( ivas_dirac_dec_get_frequency_axis_fx( frequency_axis_fx, output_Fs, nBins ); IF( NE_32( ( error = ivas_dirac_dec_decorr_open_fx( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), - &( hDiracDecBin->h_freq_domain_decorr_ap_state ), - nBins, - BINAURAL_CHANNELS, - BINAURAL_CHANNELS, - DIRAC_SYNTHESIS_PSD_LS, - frequency_axis_fx, - BINAURAL_CHANNELS, - output_Fs ) ), IVAS_ERR_OK ) ) + &( hDiracDecBin->h_freq_domain_decorr_ap_state ), + nBins, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis_fx, + BINAURAL_CHANNELS, + output_Fs ) ), + IVAS_ERR_OK ) ) { return error; } @@ -1222,7 +1223,7 @@ static void ivas_dirac_dec_binaural_internal_fx( IF( st_ivas->hSCE[0] ) { Word16 shift = getScaleFactor32( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN ); - IF ( LT_16( sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ), 4 ) ) + IF( LT_16( sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift ), 4 ) ) { shift = sub( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4 ); } @@ -2868,7 +2869,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric den = L_max( 1, den ); IIReneLimiter_fx = BASOP_Util_Divide3232_Scale_cadence( num, den, &e ); e = add( sub( num_e, den_e ), add( 5, e ) ); - IF ( L_shr_sat( IIReneLimiter_fx, sub( 31, e ) ) > 0 ) + IF( L_shr_sat( IIReneLimiter_fx, sub( 31, e ) ) > 0 ) { IIReneLimiter_fx = ONE_IN_Q31; move32(); diff --git a/lib_rend/ivas_dirac_decorr_dec.c b/lib_rend/ivas_dirac_decorr_dec.c index 473263519..9fff1878e 100644 --- a/lib_rend/ivas_dirac_decorr_dec.c +++ b/lib_rend/ivas_dirac_decorr_dec.c @@ -517,14 +517,14 @@ ivas_error ivas_dirac_dec_decorr_open_fx( IF( num_outputs_diff > 0 ) { buffer_size_decorr = add( ap_pre_delay[split_band_index_start], ap_filter_length[split_band_index_start] ); - move16(); + move16(); IF( ( freq_domain_decorr_ap_state->decorr_buffer_fx = (Word32 *) malloc( sizeof( Word32 ) * shl( imult1616( buffer_size_decorr, imult1616( num_outputs_diff, freq_domain_decorr_ap_params->max_band_decorr ) ), 1 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD decorrelator\n" ) ); } freq_domain_decorr_ap_state->decorr_buffer_len = imult1616( 2, imult1616( buffer_size_decorr, imult1616( num_outputs_diff, freq_domain_decorr_ap_params->max_band_decorr ) ) ); - move16(); + move16(); set32_fx( freq_domain_decorr_ap_state->decorr_buffer_fx, 0, imult1616( 2, imult1616( buffer_size_decorr, imult1616( num_outputs_diff, freq_domain_decorr_ap_params->max_band_decorr ) ) ) ); freq_domain_decorr_ap_state->q_decorr_buffer = Q31; @@ -586,8 +586,8 @@ ivas_error ivas_dirac_dec_decorr_open_fx( freq_domain_decorr_ap_params->pre_delay[k] = ap_pre_delay[band_table_idx]; move16(); move16(); - move16(); - move16(); + move16(); + move16(); FOR( l = 0; l < num_outputs_diff; l++ ) { @@ -959,19 +959,19 @@ void ivas_dirac_dec_decorr_process_fx( /* check handles */ test(); - IF ( h_freq_domain_decorr_ap_params == NULL || h_freq_domain_decorr_ap_state == NULL ) + IF( h_freq_domain_decorr_ap_params == NULL || h_freq_domain_decorr_ap_state == NULL ) { return; } /* check input data */ - IF ( input_frame_fx == NULL ) + IF( input_frame_fx == NULL ) { return; } /* check result arrays */ - IF ( frame_dec_fx == NULL ) + IF( frame_dec_fx == NULL ) { return; } @@ -985,7 +985,7 @@ void ivas_dirac_dec_decorr_process_fx( * collect some often used parameters *-----------------------------------------------------------------*/ - IF ( EQ_32( synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) + IF( EQ_32( synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { num_channels = sub( num_channels, nchan_transport ); } @@ -1167,10 +1167,10 @@ void ivas_dirac_dec_decorr_process_fx( pre_delay = h_freq_domain_decorr_ap_params->pre_delay[split_bands_idx]; decorr_buffer_step = imult1616( num_channels, max_band_decorr ); - move16(); - move16(); - move16(); - move16(); + move16(); + move16(); + move16(); + move16(); FOR( k = 0; k < num_bands; ++k ) { @@ -1493,13 +1493,13 @@ void ivas_dirac_dec_decorr_close_fx( *-----------------------------------------------------------------*/ test(); - IF ( ph_freq_domain_decorr_ap_params == NULL || ph_freq_domain_decorr_ap_state == NULL ) + IF( ph_freq_domain_decorr_ap_params == NULL || ph_freq_domain_decorr_ap_state == NULL ) { return; } test(); - IF ( *ph_freq_domain_decorr_ap_params == NULL || *ph_freq_domain_decorr_ap_state == NULL ) + IF( *ph_freq_domain_decorr_ap_params == NULL || *ph_freq_domain_decorr_ap_state == NULL ) { return; } diff --git a/lib_rend/ivas_dirac_onsets_dec.c b/lib_rend/ivas_dirac_onsets_dec.c index 3dc47926f..5241666a7 100644 --- a/lib_rend/ivas_dirac_onsets_dec.c +++ b/lib_rend/ivas_dirac_onsets_dec.c @@ -68,24 +68,24 @@ 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 ) - { + IF( shift ) + { a_m = L_shl( a_m, shift ); - } - IF ( shift ) - { + } + IF( shift ) + { a_e = sub( a_e, shift ); - } + } shift = norm_l( b_m ); - IF ( shift ) - { + IF( shift ) + { b_m = L_shl( b_m, shift ); - } - IF ( shift ) - { + } + IF( shift ) + { b_e = sub( b_e, shift ); - } + } /* align exponent, if any mantissa is zero */ if ( !a_m ) @@ -112,7 +112,7 @@ 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 = -1; - move16(); + move16(); IF( a_m >= 0 ) { diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index c4405c0e4..bf3a28e73 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1423,7 +1423,7 @@ ivas_error ivas_dirac_alloc_mem_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len = imult1616( imult1616( 2 * MAX_PARAM_SPATIAL_SUBFRAMES, num_protos_dir ), num_freq_bands ); - move16(); + move16(); IF( hDirACRend->proto_signal_decorr_on ) { @@ -1434,7 +1434,7 @@ ivas_error ivas_dirac_alloc_mem_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } hDirAC_mem->proto_diffuse_buffer_f_len = imult1616( 2 * MAX_PARAM_SPATIAL_SUBFRAMES, size ); - move16(); + move16(); } ELSE { @@ -1498,7 +1498,7 @@ ivas_error ivas_dirac_alloc_mem_fx( } hDirAC_mem->reference_power_len = imult1616( 2, num_freq_bands ); - move16(); + move16(); hDirAC_mem->reference_power_q = Q31; move16(); hDirAC_mem->reference_power_smooth_q = Q31; @@ -5019,12 +5019,12 @@ void ivas_lfe_synth_with_cldfb_fx( FOR( i = 0; i < nchan_transport; i++ ) { - IF ( RealBuffer_fx[i][0][0] ) + IF( RealBuffer_fx[i][0][0] ) { exp = norm_l( RealBuffer_fx[i][0][0] ); } min_q_shift = s_min( min_q_shift, exp ); - IF ( ImagBuffer_fx[i][0][0] ) + IF( ImagBuffer_fx[i][0][0] ) { exp = norm_l( ImagBuffer_fx[i][0][0] ); } @@ -6457,7 +6457,7 @@ static void ivas_masa_ext_dirac_render_sf_fx( /* No LFE for MASA rendering */ set32_fx( &( output_f_fx[ch][imult1616( index_slot, hSpatParamRendCom->num_freq_bands )] ), 0, hSpatParamRendCom->subframe_nbslots[subframe_idx] * hSpatParamRendCom->num_freq_bands ); - IF ( LT_16( idx_lfe, sub( hDirACRend->hOutSetup.num_lfe, 1 ) ) ) + IF( LT_16( idx_lfe, sub( hDirACRend->hOutSetup.num_lfe, 1 ) ) ) { idx_lfe = add( idx_lfe, 1 ); } diff --git a/lib_rend/ivas_efap.c b/lib_rend/ivas_efap.c index 8fe45bac0..1b0f31f9b 100644 --- a/lib_rend/ivas_efap.c +++ b/lib_rend/ivas_efap.c @@ -1165,7 +1165,7 @@ static void initial_polyeder_fx( EQ_32( vtxData->vertexArray[tetrahedron[0]].ele, vtxData->vertexArray[tetrahedron[1]].ele ) ) { tetrahedron[1] = add( tetrahedron[1], 1 ); - move16(); + move16(); assert( tetrahedron[1] < numVtx && "EFAP: convex hull construction failed, vertices are coincident!" ); } @@ -1570,7 +1570,7 @@ static void add_ghost_speakers_fx( sectors[i] = ceil_fixed( Mpy_32_32( tmpAngleDiff[i], maxAngle ), Q22 ); move32(); - IF ( GT_32( sectors[i], Q22_1 ) ) + IF( GT_32( sectors[i], Q22_1 ) ) { lengthHorGhst = add( lengthHorGhst, 1 ); } @@ -1579,7 +1579,7 @@ static void add_ghost_speakers_fx( sectors[sub( k, 1 )] = ceil_fixed( Mpy_32_32( tmpAngleDiff[sub( k, 1 )], maxAngle ), Q22 ); - IF ( GT_32( sectors[sub( k, 1 )], Q22_1 ) ) + IF( GT_32( sectors[sub( k, 1 )], Q22_1 ) ) { lengthHorGhst = add( lengthHorGhst, 1 ); } @@ -1599,7 +1599,7 @@ static void add_ghost_speakers_fx( add_vertex_fx( vertexArray, newAzi, 0, add( numVertex, a ), EFAP_DMX_INTENSITY ); a = add( a, 1 ); - IF ( j > 0 ) + IF( j > 0 ) { lengthHorGhst = add( lengthHorGhst, 1 ); } @@ -2962,7 +2962,7 @@ static void add_vertex_fx( tmp = efap_32mod32( L_sub( Q22_180_DEG, azi ), Q22_360_DEG ); vtxArray[pos].azi = L_sub( Q22_180_DEG, tmp ); - move32(); + move32(); tmp = ( LT_32( Q22_180_DEG, ele ) ? Q22_180_DEG : ele ); move32(); diff --git a/lib_rend/ivas_mcmasa_ana.c b/lib_rend/ivas_mcmasa_ana.c index 7046f3a8d..625fb006f 100644 --- a/lib_rend/ivas_mcmasa_ana.c +++ b/lib_rend/ivas_mcmasa_ana.c @@ -656,7 +656,7 @@ void ivas_mcmasa_ana_close( Word16 i, j; test(); - IF ( hMcMasa == NULL || *hMcMasa == NULL ) + IF( hMcMasa == NULL || *hMcMasa == NULL ) { return; } diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 4c1c03850..066e77796 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -148,8 +148,8 @@ ivas_error TDREND_MIX_SRC_SetDir_fx( { TDREND_SRC_SPATIAL_t *SrcSpatial_p; /* Value verification */ - test(); - test(); + test(); + test(); IF( EQ_32( Vec_p[0], 0 ) && EQ_32( Vec_p[1], 0 ) && EQ_32( Vec_p[2], 0 ) ) { return ( IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "Zero direction vector. Command is ignored!\n" ) ); diff --git a/lib_rend/ivas_omasa_ana.c b/lib_rend/ivas_omasa_ana.c index 4101ecec0..c43a960e2 100644 --- a/lib_rend/ivas_omasa_ana.c +++ b/lib_rend/ivas_omasa_ana.c @@ -1421,4 +1421,4 @@ void computeReferencePower_ana( return; } -#endif \ No newline at end of file +#endif diff --git a/lib_rend/ivas_reflections.c b/lib_rend/ivas_reflections.c index 510a2a0fa..8a8bc44ca 100644 --- a/lib_rend/ivas_reflections.c +++ b/lib_rend/ivas_reflections.c @@ -228,7 +228,7 @@ ivas_error ivas_er_set_reflections_mode( ivas_error error; UWord16 ch; error = IVAS_ERR_OK; - move32(); + move32(); IF( EQ_32( reflections->audio_config, inConfig ) ) { diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 20eed1a88..347374d87 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -50,7 +50,7 @@ static Word16 wrap_rad_fixed( Word32 angle /* Q13 */ ) { Word32 L_tmp = angle; - move32(); + move32(); /* Wrap azimuth value */ WHILE( GT_32( L_tmp, EVS_PI_FX ) ) @@ -1035,7 +1035,7 @@ static ivas_error compute_t60_coeffs_fx( Word16 *pCoeffs_a_fx, *pCoeffs_b_fx, *targetT60_e; Word16 target_gains_db_exp[RV_LENGTH_NR_FC]; error = IVAS_ERR_OK; - move32(); + move32(); tf_T60_len = nr_fc_fft_filter; move16(); len = add( pParams->t60_filter_order, 1 ); @@ -1691,7 +1691,7 @@ static ivas_error set_feedback_delay_fx( } hReverb->delay_line[branch].Delay = fb_delay; - move16(); + move16(); return IVAS_ERR_OK; } diff --git a/lib_rend/ivas_reverb_fft_filter.c b/lib_rend/ivas_reverb_fft_filter.c index db0706e99..2e9ce6cda 100644 --- a/lib_rend/ivas_reverb_fft_filter.c +++ b/lib_rend/ivas_reverb_fft_filter.c @@ -69,24 +69,24 @@ UWord16 int_log2( UWord32 powerOf2 ) { Word16 l2 = 15; - move16(); + move16(); - IF ( powerOf2 & 0x00FF ) + IF( powerOf2 & 0x00FF ) { l2 = sub( l2, 8 ); } - IF ( powerOf2 & 0x0F0F ) + IF( powerOf2 & 0x0F0F ) { l2 = sub( l2, 4 ); } - IF ( powerOf2 & 0x3333 ) + IF( powerOf2 & 0x3333 ) { l2 = sub( l2, 2 ); } - IF ( powerOf2 & 0x5555 ) + IF( powerOf2 & 0x5555 ) { l2 = sub( l2, 1 ); } @@ -619,7 +619,7 @@ Word16 ivas_reverb_fft_filter_init( } fft_filter->fft_size = fft_size; - move16(); + move16(); return 0; } diff --git a/lib_rend/ivas_reverb_filter_design.c b/lib_rend/ivas_reverb_filter_design.c index a5fc6dc5c..6d2e87098 100644 --- a/lib_rend/ivas_reverb_filter_design.c +++ b/lib_rend/ivas_reverb_filter_design.c @@ -526,7 +526,7 @@ static void apply_window_fft_fx( move32(); } *q_pFilter = 31; - move16(); + move16(); /* Do inverse fft to go to the time domain */ Word16 guarded_bits, temp; @@ -551,7 +551,7 @@ static void apply_window_fft_fx( move32(); } *q_pFilter = add( *q_pFilter, 30 - 31 ); - move16(); + move16(); /* Convert back to the frequency domain */ temp = sub( L_norm_arr( pFilter, fft_size ), guarded_bits ); @@ -563,7 +563,7 @@ static void apply_window_fft_fx( move32(); } *q_pFilter = add( *q_pFilter, temp ); - move16(); + move16(); } fft_rel_fx32( pFilter, fft_size, log2_fft_size ); // q = q_pFilter diff --git a/lib_rend/ivas_reverb_iir_filter.c b/lib_rend/ivas_reverb_iir_filter.c index be793fb35..454e2930a 100644 --- a/lib_rend/ivas_reverb_iir_filter.c +++ b/lib_rend/ivas_reverb_iir_filter.c @@ -219,7 +219,7 @@ void ivas_reverb_iir_filt_2taps_feed_blk_fx( move32(); Word32 flt_pBuffer_1_fx = iirFilter->pBuffer_fx[1]; move32(); - FOR ( i = 0; i < blk_size; i++ ) + FOR( i = 0; i < blk_size; i++ ) { flt_output_fx = L_add( Mpy_32_32( L_shl( input[i], 1 ), flt_CoefB_0_fx ), flt_pBuffer_0_fx ); flt_pBuffer_0_fx = L_sub( L_add( flt_pBuffer_1_fx, Mpy_32_32( L_shl( input[i], 1 ), flt_CoefB_1_fx ) ), Mpy_32_32( L_shl( flt_output_fx, 1 ), flt_CoefA_1_fx ) ); diff --git a/lib_rend/ivas_shoebox.c b/lib_rend/ivas_shoebox.c index ef31d384b..6d6b685a8 100644 --- a/lib_rend/ivas_shoebox.c +++ b/lib_rend/ivas_shoebox.c @@ -906,7 +906,7 @@ void ivas_shoebox_set_scene( move32(); move32(); /* ---------- ADJUST LISTENER ------------- */ - IF ( obj->isZHeight != 0 ) + IF( obj->isZHeight != 0 ) { obj->list_pos_fx[2] = L_sub( list_pos_fx[2], L_shr( obj->cal.room_H_fx, 1 ) ); // Q.22 move32(); diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index e718568f1..606f003ca 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -660,7 +660,7 @@ static Word32 limitRendererOutput_fx( Word32 **channels; Word16 num_channels; Word32 numClipping = 0; - move32(); + move32(); /* return early if given bad parameters */ test(); @@ -10219,7 +10219,7 @@ static ivas_error renderInputIsm( move16(); error = IVAS_ERR_OK; - move32(); + move32(); inAudio = ismInput->base.inputBuffer; IF( NE_32( ismInput->base.numNewSamplesPerChannel, outAudio.config.numSamplesPerChannel ) ) @@ -12577,7 +12577,7 @@ static ivas_error renderInputMasa( /* Apply input gain to new audio */ v_multc_fixed( inAudio.data_fx, masaInput->base.gain_fx, inAudio.data_fx, inAudio.config.numSamplesPerChannel * inAudio.config.numChannels ); *outAudio.pq_fact = sub( *outAudio.pq_fact, 1 ); // to compensate for the qfactor reduction in gain multiplication. - move16(); + move16(); maxBin = extract_l( Mpy_32_32( *masaInput->base.ctx.pOutSampleRate, INV_CLDFB_BANDWIDTH_Q31 ) ); @@ -15107,7 +15107,7 @@ static void intermidiate_ext_dirac_render( h_dirac_output_synthesis_state = &( hDirACRend->h_output_synthesis_psd_state ); subframe_idx = hSpatParamRendCom->subframes_rendered; - move16(); + move16(); DirAC_mem = hDirACRend->stack_mem; @@ -15128,14 +15128,14 @@ static void intermidiate_ext_dirac_render( Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len ); scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len, shift ); hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = add( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, shift ); - move16(); + move16(); } IF( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx ) { Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len ); scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len, shift ); hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = add( hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, shift ); - move16(); + move16(); } IF( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx ) @@ -15143,7 +15143,7 @@ static void intermidiate_ext_dirac_render( Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands ); scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len, shift ); hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth = add( hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, shift ); - move16(); + move16(); } Word16 num_channels_dir = hDirACRend->num_outputs_dir; -- GitLab From e0bcf09fb0e54059ad6369a95fbbda3dba29ac5e Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 8 Aug 2024 17:17:02 +0530 Subject: [PATCH 3/3] EVS BE fix --- lib_com/fft_fx_evs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/fft_fx_evs.c b/lib_com/fft_fx_evs.c index 20bef242b..b09b41379 100644 --- a/lib_com/fft_fx_evs.c +++ b/lib_com/fft_fx_evs.c @@ -145,7 +145,7 @@ static void bitrv2_SR_fx( m = 1; move16(); - WHILE( LE_16( shl( m, 3 ), l ) ) + WHILE( LT_16( shl( m, 3 ), l ) ) { l = shr( l, 1 ); m = shl( m, 1 ); -- GitLab