diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 8ed6c56c09d140a6ec4dfb7309aaef22b7b2c3bc..62c15f1f1436b2b748fcae6106358bda3c6e2866 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -371,8 +371,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( st->hHQ_core->Q_old_out = Q_factor_arr( st->hHQ_core->old_out, L_FRAME48k ); st->hHQ_core->Q_old_outLB = Q_factor_arr( st->hHQ_core->old_outLB, L_FRAME32k ); st->hHQ_core->Q_fer_samples = 0; - floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k ); - floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k ); + //floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k ); + //floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k ); } IF( st->cldfbAna ) { @@ -461,8 +461,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( IF( st->hHQ_core ) { - fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_out, L_FRAME48k ); - fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k ); + //fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_out, L_FRAME48k ); + //fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k ); } IF( st->cldfbAna ) { @@ -591,8 +591,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st->hHQ_core->Q_old_out = 0; st->hHQ_core->Q_old_outLB = 0; st->hHQ_core->Q_fer_samples = 0; - floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k ); - floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k ); + //floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_out, L_FRAME48k ); + //floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_outLB, L_FRAME32k ); } IF( st->cldfbAna ) { @@ -684,8 +684,8 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( IF( st->hHQ_core ) { - fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_out, L_FRAME48k ); - fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k ); + //fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_wtda, L_FRAME48k ); + //fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_outLB, L_FRAME32k ); } IF( st->cldfbAna ) { @@ -763,7 +763,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( //hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( hTcxDec->tcxltp_last_gain_unmodified_float, Q15 ); } - floatToFixed_arr( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hHQ_core->old_out_fx + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), 0, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + //floatToFixed_arr( st->hHQ_core->old_out + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hHQ_core->old_out_fx + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), 0, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); //if ( !st->tcxonly ) //{ @@ -833,17 +833,17 @@ void fixed_to_float_stereo_tcx_core_dec( { if (st->hHQ_core->Q_old_wtda >= 0) { - for ( int p = 0; p < st->L_frame; p++ ) + for ( int p = 0; p < 960; p++ ) { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); - st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); + //st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); + //st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->hHQ_core->Q_old_wtda ); } } else{ - for ( int p = 0; p < st->L_frame; p++ ) + for ( int p = 0; p < 960; p++ ) { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) ); - st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) ); + //st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) ); + //st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->hHQ_core->Q_old_wtda) ); } } } @@ -868,7 +868,7 @@ void fixed_to_float_stereo_tcx_core_dec( { for ( int p = 0; p < st->hFdCngDec->npart_shaping; p++ ) { - st->hFdCngDec->msNoiseEst_float[p] = (float) st->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) ); + //st->hFdCngDec->msNoiseEst_float[p] = (float) st->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - st->hFdCngDec->msNoiseEst_exp ) ); } } @@ -877,13 +877,21 @@ void fixed_to_float_stereo_tcx_core_dec( IF( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) ) { - FOR( Word16 ind = 0; ind < 640; ind++ ) + //FOR( Word16 ind = 0; ind < 640; ind++ ) + //{ + // st->hHQ_core->old_outLB[ind] = (float) st->hHQ_core->old_out_LB_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) ); + //} + //FOR( Word16 ind = 0; ind < 960; ind++ ) + //{ + // st->hHQ_core->old_out[ind] = (float) st->hHQ_core->old_out_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) ); + //} + FOR( Word16 ind = 0; ind < L_FRAME32k / 2; ind++ ) { - st->hHQ_core->old_outLB[ind] = (float) st->hHQ_core->old_out_LB_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) ); + //st->hTcxDec->syn_Overl_float[ind] = (float) st->hTcxDec->syn_Overl[ind] / ( (float) pow( 2, st->Q_syn + 1 ) ); } - FOR( Word16 ind = 0; ind < 960; ind++ ) + FOR( Word16 ind = 0; ind < L_FRAME_MAX / 2; ind++ ) { - st->hHQ_core->old_out[ind] = (float) st->hHQ_core->old_out_fx[ind] / ( (float) pow( 2, st->hHQ_core->Q_old_wtda ) ); + //st->hTcxDec->syn_OverlFB_float[ind] = (float) st->hTcxDec->syn_OverlFB[ind] / ( (float) pow( 2, st->Q_syn ) ); } } } diff --git a/lib_com/ivas_sns_com_fx.c b/lib_com/ivas_sns_com_fx.c index d192118d970603e8b98b1d1e0b7de13f3f25324f..3d96e481981ca840aaf4195c52093b38bbd20b00 100644 --- a/lib_com/ivas_sns_com_fx.c +++ b/lib_com/ivas_sns_com_fx.c @@ -138,7 +138,7 @@ void sns_compute_scf_fx( FOR( i = 0; i < FDNS_NPTS; i++ ) { xs[i] = Mpy_32_16_1( xs[i], pow_tilt[i] ); - xs[i] = L_shl( xs[i], Q6 ); // xs => Q10 + xs[i] = L_shl( xs[i], Q4 ); // xs => Q8 } /* Noise floor at -40dB */ diff --git a/lib_com/prot.h b/lib_com/prot.h index b4ef842c5cf96db0f9fa0079f8234a5a302ce92f..f47b3d91728d38509572f80bc2fbedf82f73aa84 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -4623,6 +4623,7 @@ void signaling_enc_rf( Encoder_State *st /* i/o: encoder state structure */ ); +#ifndef IVAS_FLOAT_FIXED ivas_error acelp_core_dec( Decoder_State *st, /* i/o: Decoder state structure */ float output[], /* o : synthesis @internal Fs */ @@ -4646,6 +4647,7 @@ ivas_error acelp_core_dec( STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */ const int16_t read_sid_info /* i : read SID info flag */ ); +#endif #ifdef IVAS_FLOAT_FIXED ivas_error acelp_core_dec_ivas_fx( @@ -7437,6 +7439,7 @@ void ACcontextMapping_encode2_no_mem_s17_LC( int16_t resQMaxBits, CONTEXT_HM_CONFIG *hm_cfg ); +#ifndef IVAS_FLOAT_FIXED int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas( Decoder_State *st, /* i/o: decoder state */ int16_t *x, /* o : decoded spectrum */ @@ -7445,6 +7448,7 @@ int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas( int16_t resQMaxBits, /* i : residual coding maximum bits */ CONTEXT_HM_CONFIG *hm_cfg /* i : context-based harmonic model configuration */ ); +#endif int16_t ACcontextMapping_encode2_estimate_no_mem_s17_LC( const int16_t *x, @@ -7464,6 +7468,7 @@ void RCcontextMapping_encode2_no_mem_s17_LCS( const int16_t resQMaxBits, CONTEXT_HM_CONFIG *hm_cfg ); +#ifndef IVAS_FLOAT_FIXED int16_t RCcontextMapping_decode2_no_mem_s17_LCS( Decoder_State *st, /* i/o: decoder state */ int16_t *x, /* o : decoded spectrum */ @@ -7472,6 +7477,7 @@ int16_t RCcontextMapping_decode2_no_mem_s17_LCS( const int16_t resQMaxBits, /* i : residual coding maximum bits */ CONTEXT_HM_CONFIG *hm_cfg /* i : context-based harmonic model configuration */ ); +#endif int16_t RCcontextMapping_encode2_estimate_no_mem_s17_LCS( int16_t *x, /* Spectral coefficients */ @@ -7822,11 +7828,13 @@ int16_t ari_start_decoding_14bits_prm_ivas( int16_t bp, Tastat *s ); +#ifdef IVAS_FLOAT_FIXED Word16 ari_start_decoding_14bits_prm_ivas_fx( const Word16 *ptr, Word16 bp, Tastat *s ); +#endif void ari_decode_14bits_s17_ext_ivas( Decoder_State *st, @@ -9880,12 +9888,14 @@ int16_t GetPLCModeDecision( Decoder_State *st /* i/o: decoder memory state pointer */ ); +#ifndef IVAS_FLOAT_FIXED void addBassPostFilter( const float *harm_timeIn, const int16_t samplesToProcess, float **rAnalysis, float **iAnalysis, HANDLE_CLDFB_FILTER_BANK cldfb ); +#endif ivas_error TonalMDCTConceal_Init_ivas( TonalMDCTConcealPtr hTonalMDCTConc, diff --git a/lib_com/prot_fx2.h b/lib_com/prot_fx2.h index cedbc4b7d4c76e316f02454c333c33bf68c9fdd4..3eebc5bc4cdbc7f152b3f53b6c7f3e930cf99027 100644 --- a/lib_com/prot_fx2.h +++ b/lib_com/prot_fx2.h @@ -8970,6 +8970,7 @@ void decoder_acelp_fx( #endif //d_gain2p.c +#ifdef IVAS_FLOAT_FIXED void decode_acelp_gains_fx( Word16 *code, Word16 gains_mode, @@ -8984,6 +8985,7 @@ void decode_acelp_gains_fx( Word16 *code2, Word32 *gain_code2 ); +#endif void d_gain_pred_fx( Word16 nrg_mode, /* i : NRG mode */ diff --git a/lib_dec/ACcontextMapping_dec.c b/lib_dec/ACcontextMapping_dec.c index 6b400d02cc4ea8e3eb6b87d08c5ff8711a49eb67..cb3863a5e8b4c9bfa5db3c5d65b2cb01b482e83a 100644 --- a/lib_dec/ACcontextMapping_dec.c +++ b/lib_dec/ACcontextMapping_dec.c @@ -51,6 +51,7 @@ *-------------------------------------------------------------------*/ /*! r: resQBits */ +#ifndef IVAS_FLOAT_FIXED int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas( Decoder_State *st, /* i/o: decoder state */ int16_t *x, /* o : decoded spectrum */ @@ -318,7 +319,7 @@ int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas( return resQBits; } - +#endif /*-------------------------------------------------------------------* * RCcontextMapping_decode2_no_mem_s17_LCS() @@ -327,6 +328,7 @@ int16_t ACcontextMapping_decode2_no_mem_s17_LC_ivas( *-------------------------------------------------------------------*/ /*! r: resQBits */ +#ifndef IVAS_FLOAT_FIXED int16_t RCcontextMapping_decode2_no_mem_s17_LCS( Decoder_State *st, /* i/o: decoder state */ int16_t *x, /* o : decoded spectrum */ @@ -670,3 +672,4 @@ int16_t RCcontextMapping_decode2_no_mem_s17_LCS( return resQBits; } +#endif \ No newline at end of file diff --git a/lib_dec/ACcontextMapping_dec_fx.c b/lib_dec/ACcontextMapping_dec_fx.c index 5e668d2e97061cdba027081ce2b7dd80e09faf97..cdb1d1a17f5ed3051dbeea5a3f8aee57bf3add37 100644 --- a/lib_dec/ACcontextMapping_dec_fx.c +++ b/lib_dec/ACcontextMapping_dec_fx.c @@ -20,6 +20,7 @@ * Arithmetic decoder *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED Word16 ACcontextMapping_decode2_no_mem_s17_LC( Decoder_State *st,/* i/o: decoder state */ Word16 *x, /* o: decoded spectrum */ @@ -323,6 +324,9 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC( return resQBits; } +#endif + +#ifdef IVAS_FLOAT_FIXED #define IVAS_CONTEXT_MAPPING #ifdef IVAS_CONTEXT_MAPPING @@ -690,4 +694,5 @@ Word16 RCcontextMapping_decode2_no_mem_s17_LCS_fx( } #endif -#undef IVAS_CONTEXT_MAPPING \ No newline at end of file +#undef IVAS_CONTEXT_MAPPING +#endif \ No newline at end of file diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c index e101096e934cd083ced18b6d07d1dbf23d1a19bd..63caeaaf997b8e734124448e055672948c162f0a 100644 --- a/lib_dec/FEC_HQ_core_fx.c +++ b/lib_dec/FEC_HQ_core_fx.c @@ -15,7 +15,7 @@ /*---------------------------------------------------------------------* * Local function prototypes *---------------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED static Word16 FEC_phase_matching_fx(HQ_NBFEC_HANDLE st_fx, Word32* ImdctOut_fx, Word16* auOut_fx, Word16* OldauOut_fx, Word16 OldauOut_pha_fx[2][N_LEAD_NB]); static void FEC_phase_matching_nextgood_fx(const Word32* ImdctOut_fx, Word16* auOut_fx, Word16* OldauOut_fx, Word16 OldauOut_pha_fx[2][N_LEAD_NB],Word16 mean_en_high_fx); static void FEC_phase_matching_burst_fx(const Word32* ImdctOut_fx, Word16* auOut_fx, Word16* OldauOut_fx, Word16 OldauOut_pha_fx[2][N_LEAD_NB], Word16* prev_oldauOut_fx ); @@ -28,13 +28,14 @@ static void Windowing_2nd_NB_fx(Word16* ImdctOutWin_fx, const Word32* ImdctOut_ static void Scaledown_fx(Word16 x[], Word16 y[], Word16 scale_v,const Word16 N ); static void Next_good_after_burst_erasures_fx(const Word32* ImdctOut_fx, Word16* auOut_fx,Word16* OldauOut_fx, const Word16 ol_size); static void common_overlapping_fx(Word16* auOut_fx, Word16* ImdctOutWin_fx, Word16* OldauOut_fx, Word16 end1, Word16 offset1, Word16 start2, Word16 end2, Word16 offset_i2, Word16 offset2); - +#endif /*--------------------------------------------------------------------------* * Regression_Anal() * * *--------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static void Regression_Anal_fx( const Word32 *values_fx, /* i : Previous values */ Word32 *r_p_fx, /* o : Output r[a b] array : y=ax+b */ @@ -400,6 +401,7 @@ void HQ_FEC_processing_fx( return; } +#endif #ifdef IVAS_FLOAT_FIXED void ivas_HQ_FEC_Mem_update_fx( @@ -688,6 +690,7 @@ void ivas_HQ_FEC_Mem_update_fx( } #endif +#ifdef IVAS_FLOAT_FIXED void HQ_FEC_Mem_update_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ Word32 *t_audio_q_fx, /*Q12*/ @@ -981,8 +984,9 @@ void HQ_FEC_Mem_update_fx( return; } +#endif - +#ifdef IVAS_FLOAT_FIXED static Word16 find_best_delay_fx( Word16 *mu_o_fx, Word16 *in_fx, @@ -1388,7 +1392,9 @@ static void FEC_phase_matching_nextgood_fx( return; } +#endif +#ifdef IVAS_FLOAT_FIXED static void FEC_phase_matching_burst_fx( const Word32 *ImdctOut_fx, /* i : input */ Word16 *auOut_fx, /* o : output audio */ @@ -1964,6 +1970,7 @@ static void Next_good_after_burst_erasures_fx( return; } +#endif #ifdef ADD_IVAS_HQ_CODE_FEC /*-------------------------------------------------------------------------- diff --git a/lib_dec/FEC_HQ_phase_ecu.c b/lib_dec/FEC_HQ_phase_ecu.c index 5208ca9b2e1772e530d4a416da41d4b8e4894886..5c8e917b6a5eff40c0b03b5d3eec6d986eb0e0f5 100644 --- a/lib_dec/FEC_HQ_phase_ecu.c +++ b/lib_dec/FEC_HQ_phase_ecu.c @@ -452,6 +452,7 @@ static void trans_ana( * Peak-picking algorithm *------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void peakfinder( const float *x0, /* i : vector from which the maxima will be found */ const int16_t len0, /* i : length of input vector */ @@ -648,7 +649,7 @@ void peakfinder( return; } - +#endif /*-------------------------------------------------------------------* * imax_pos() @@ -657,6 +658,7 @@ void peakfinder( *-------------------------------------------------------------------*/ /*! r: interpolated maximum position */ +#ifndef IVAS_FLOAT_FIXED float imax_pos( const float *y /* i : Input vector for peak interpolation */ ) @@ -698,7 +700,7 @@ float imax_pos( return posi + 1.0f; } - +#endif /*-------------------------------------------------------------------* * spec_ana() diff --git a/lib_dec/FEC_HQ_phase_ecu_fx.c b/lib_dec/FEC_HQ_phase_ecu_fx.c index 8a5efde94d9463ea34ea02eba4a413d2310952cc..71f7860d8997739ee42fc2c550ac12078d9b3dab 100644 --- a/lib_dec/FEC_HQ_phase_ecu_fx.c +++ b/lib_dec/FEC_HQ_phase_ecu_fx.c @@ -73,7 +73,7 @@ #define FEC_HQ_WIN_A0 FEC_HQ_HAMM_A0 #define FEC_HQ_WIN_A1 FEC_HQ_HAMM_A1 - +#ifdef IVAS_FLOAT_FIXED static Word16 sqrt2ndOrder(const Word16); static void windowing(const Word16*, Word16*, const Word16*, const Word16, const Word16); @@ -93,7 +93,9 @@ static void spec_ana_fx(const Word16* prevsynth, Word16* plocs, Word32* plocsi, ); static void subst_spec_fx(const Word16*, const Word32*, Word16*, const Word16, Word16*, const Word16*, const Word16, const Word16*, const Word16, Word16* ,const Word16*, const Word16*, Word16, const Word16*); +#ifdef IVAS_FLOAT_FIXED static Word16 rand_phase_fx(const Word16 seed, Word16 *sin_F, Word16 *cos_F); +#endif #ifdef IVAS_FEC_ECU_TO_COMPLETE static float imax2_jacobsen_mag(const float* y_re, const float* y_im); #endif @@ -103,6 +105,7 @@ static float imax2_jacobsen_mag(const float* y_re, const float* y_im); * * randomized phase in form of sin and cos components *------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static Word16 rand_phase_fx(const Word16 seed, Word16 *sin_F, Word16 *cos_F) { const Word16 *sincos = sincos_t_ext_fx + 128; @@ -127,6 +130,7 @@ static Word16 rand_phase_fx(const Word16 seed, Word16 *sin_F, Word16 *cos_F) return seed2; } +#endif #ifdef IVAS_FLOAT_FIXED /*! r: The location, relative to the middle of the 3 given data point, of the maximum. (Q15)*/ @@ -5392,3 +5396,4 @@ static void windowing_ROM_optimized( pSine += downSamples; /* Increment address counter */ } } +#endif \ No newline at end of file diff --git a/lib_dec/FEC_adapt_codebook.c b/lib_dec/FEC_adapt_codebook.c index 4db1f06e222c2dbf9511d110cf9b4f2b9d2002e5..bb638b3a4647288d7cb77a53a784f9bd3686d8c3 100644 --- a/lib_dec/FEC_adapt_codebook.c +++ b/lib_dec/FEC_adapt_codebook.c @@ -49,6 +49,7 @@ *------------------------------------------------------------------------*/ /*! r: do_WI flag */ +#ifndef IVAS_FLOAT_FIXED static int16_t FEC_synchro_exc( const int16_t L_frame, /* i : length of the frame */ float *exc, /* i/o: exc vector to modify */ @@ -491,3 +492,4 @@ int16_t FEC_enhACB( return do_WI; } +#endif \ No newline at end of file diff --git a/lib_dec/FEC_adapt_codebook_fx.c b/lib_dec/FEC_adapt_codebook_fx.c index af58ed75728f9e45fd4aef9bec63fcdb8e6215cb..fab0dfe432b75d0f41e8fcd288ec4b506a6d3c31 100644 --- a/lib_dec/FEC_adapt_codebook_fx.c +++ b/lib_dec/FEC_adapt_codebook_fx.c @@ -15,6 +15,7 @@ * * Create an artificial onset when it is lost *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED Word16 FEC_SinOnset_fx ( Word16 *exc, /* i/o : exc vector to modify */ Word16 puls_pos, /* i : last pulse position desired */ @@ -533,4 +534,5 @@ Word16 FEC_synchro_exc_fx( /* o : do_WI flag return 1; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/lib_dec/FEC_clas_estim.c b/lib_dec/FEC_clas_estim.c index 9f2633a20a38ce1712e8b4dd6b54ab0ee3d4d990..1fb0e735bb8812e34733c94cf2af3716905b4179 100644 --- a/lib_dec/FEC_clas_estim.c +++ b/lib_dec/FEC_clas_estim.c @@ -65,7 +65,7 @@ /*-------------------------------------------------------------------* * 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 ); @@ -799,3 +799,4 @@ int16_t FEC_pos_dec( return T0; } +#endif \ No newline at end of file diff --git a/lib_dec/FEC_clas_estim_fx.c b/lib_dec/FEC_clas_estim_fx.c index e5f9f34b732168d16072ea518f0c939989a1b009..74606fb86241aadeccfecff3528c7d6fb8f22b81 100644 --- a/lib_dec/FEC_clas_estim_fx.c +++ b/lib_dec/FEC_clas_estim_fx.c @@ -47,6 +47,7 @@ static void Corre(const Word16 *x,const Word16 *y,const Word16 l,Word16 *gain); /* */ /*======================================================================*/ +#ifdef IVAS_FLOAT_FIXED void FEC_clas_estim_fx( Decoder_State *st_fx , /* i/o: decoder state handle */ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ /*A*/ @@ -931,4 +932,4 @@ static void Corre( #endif move16(); } - +#endif diff --git a/lib_dec/FEC_pitch_estim_fx.c b/lib_dec/FEC_pitch_estim_fx.c index 2b5446093a3235c7128de9a4f7ad5a6678be3661..713e4c5799496ebf6d46e416819cb87e100af633 100644 --- a/lib_dec/FEC_pitch_estim_fx.c +++ b/lib_dec/FEC_pitch_estim_fx.c @@ -35,6 +35,7 @@ /* RETURN ARGUMENTS : */ /* _ None */ /*========================================================================*/ +#ifdef IVAS_FLOAT_FIXED void FEC_pitch_estim_fx( const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ const Word16 last_core, /* i : last core */ @@ -108,4 +109,4 @@ void FEC_pitch_estim_fx( } } } - +#endif diff --git a/lib_dec/FEC_scale_syn.c b/lib_dec/FEC_scale_syn.c index c91081b2e30169662076f2729fe63dbc2dd9944b..cd6feb24da05906e561b2fd7ac31130e64f56f9e 100644 --- a/lib_dec/FEC_scale_syn.c +++ b/lib_dec/FEC_scale_syn.c @@ -49,6 +49,7 @@ * 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 */ @@ -439,3 +440,4 @@ void FEC_scale_syn( return; } +#endif \ No newline at end of file diff --git a/lib_dec/FEC_scale_syn_fx.c b/lib_dec/FEC_scale_syn_fx.c index a547be7e7760d41a81822dd4b8ef820fee9d8994..120855b127e29740d0f513a763de561423e29033 100644 --- a/lib_dec/FEC_scale_syn_fx.c +++ b/lib_dec/FEC_scale_syn_fx.c @@ -51,7 +51,7 @@ /* _ None */ /*========================================================================*/ - +#ifdef IVAS_FLOAT_FIXED void FEC_scale_syn_fx( const Word16 L_frame, /* i : length of the frame */ Word16 *update_flg, /* o: flag indicating re-synthesis after scaling*/ @@ -666,3 +666,4 @@ void FEC_scale_syn_fx( return; } +#endif \ No newline at end of file diff --git a/lib_dec/LD_music_post_filter.c b/lib_dec/LD_music_post_filter.c index 494fa1357813d11e24ce88c4e2b8405b9e3b0bf9..58cf9c869f0ee4955209bb54fcb564c23ae7836e 100644 --- a/lib_dec/LD_music_post_filter.c +++ b/lib_dec/LD_music_post_filter.c @@ -802,7 +802,7 @@ void music_postfilt_init_flt( #endif } - set_f( hMusicPF->filt_lfE, 1.0f, DCT_L_POST ); + //set_f( hMusicPF->filt_lfE, 1.0f, DCT_L_POST ); hMusicPF->last_nonfull_music = 0; #ifdef IVAS_FLOAT_FIXED hMusicPF->Old_ener_Q = 0; diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index baebf97be03edd1b83e5d5587d70211c062945ac..35cec94d942ba5b48f849ac058333f8aeaf14045 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -2021,7 +2021,7 @@ void acelp_decoder_state_fix2float(Decoder_State *st) { ((st->m_frame_type == ZERO_FRAME) && (st != NULL && st->cng_type == LP_CNG)) ) { - fixedToFloat_arrL(st->hFdCngDec->msNoiseEst, st->hFdCngDec->msNoiseEst_float, Q31 - st->hFdCngDec->msNoiseEst_exp, st->hFdCngDec->npart_shaping); + //fixedToFloat_arrL(st->hFdCngDec->msNoiseEst, st->hFdCngDec->msNoiseEst_float, Q31 - st->hFdCngDec->msNoiseEst_exp, st->hFdCngDec->npart_shaping); } } } diff --git a/lib_dec/amr_wb_dec.c b/lib_dec/amr_wb_dec.c index 90bbfede8c2e70ccf97c850a4de8b0a206e4dbba..81ec8ebedc4f95f8658b0fb8baf78b7a397dd1ca 100644 --- a/lib_dec/amr_wb_dec.c +++ b/lib_dec/amr_wb_dec.c @@ -816,7 +816,6 @@ ivas_error amr_wb_dec( return error; } -#endif /*------------------------------------------------------------------* * amr_wb_dec_init() @@ -847,3 +846,4 @@ void amr_wb_dec_init( return; } +#endif \ No newline at end of file diff --git a/lib_dec/ari_dec.c b/lib_dec/ari_dec.c index b8604b6e6ac80a6c631b60335e4a3a22538c9371..8757e5c12b5e5b646ea752d206e3c001f188b013 100644 --- a/lib_dec/ari_dec.c +++ b/lib_dec/ari_dec.c @@ -100,6 +100,7 @@ int16_t ari_start_decoding_14bits_prm_ivas( return bp; } +#ifdef IVAS_FLOAT_FIXED Word16 ari_start_decoding_14bits_prm_ivas_fx( const Word16 *ptr, Word16 bp, @@ -126,6 +127,7 @@ Word16 ari_start_decoding_14bits_prm_ivas_fx( return add(bp, i); } +#endif /*--------------------------------------------------------------- * ari_decode_14bits_s17_ext_ivas() diff --git a/lib_dec/ari_hm_dec.c b/lib_dec/ari_hm_dec.c index d0069e5c3d31f100403db9df9f57a05af060e7c9..0072f3c6967774cfc81d623e4608d9e0dea317f0 100644 --- a/lib_dec/ari_hm_dec.c +++ b/lib_dec/ari_hm_dec.c @@ -77,6 +77,8 @@ int16_t DecodeIndex( } } #endif + +#ifdef IVAS_FLOAT_FIXED Word16 DecodeIndex_fx( Decoder_State *st, @@ -111,7 +113,7 @@ DecodeIndex_fx( return 8; } } - +#endif /*-------------------------------------------------------------------* * tcx_hm_dequantize_gain() @@ -299,4 +301,4 @@ void tcx_hm_decode( return; -} \ No newline at end of file +} diff --git a/lib_dec/arith_coder_dec.c b/lib_dec/arith_coder_dec.c index 12abd4d92e02e85b4ba54b487b68c8a163c853cf..5cb38bf24dc7aaa852f311ad6b0bbc3f1a007b4b 100644 --- a/lib_dec/arith_coder_dec.c +++ b/lib_dec/arith_coder_dec.c @@ -118,6 +118,7 @@ static int16_t tcx_arith_decode( } #endif +#ifdef IVAS_FLOAT_FIXED static Word16 tcx_arith_decode_ivas_fx( const Word16 L_frame, /* i : number of spectral lines */ const Word16 envelope[], /* i : scaled envelope (Q15-e) */ @@ -186,7 +187,7 @@ static Word16 tcx_arith_decode_ivas_fx( return bp; } - +#endif /*-------------------------------------------------------* * tcx_arith_decode_envelope() @@ -293,6 +294,8 @@ void tcx_arith_decode_envelope( return; } #endif + +#ifdef IVAS_FLOAT_FIXED void tcx_arith_decode_envelope_ivas_fx( Decoder_State *st, /* i/o: coder state */ Word32 q_spectrum[], /* o : quantised MDCT coefficients */ @@ -405,3 +408,4 @@ void tcx_arith_decode_envelope_ivas_fx( return; } +#endif diff --git a/lib_dec/arith_coder_dec_fx.c b/lib_dec/arith_coder_dec_fx.c index 7cc34f46e8ac03240d4cbaf67decaf6c0d0e0980..475f87572be3aa7cab3f0f865d5fc7db6011381d 100644 --- a/lib_dec/arith_coder_dec_fx.c +++ b/lib_dec/arith_coder_dec_fx.c @@ -11,6 +11,7 @@ #include "prot_fx2.h" /* Returns: number of bits consumed */ +#ifdef IVAS_FLOAT_FIXED static Word16 tcx_arith_decode_fx( Word16 L_frame, /* i: number of spectral lines Q0 */ const Word16 envelope[], /* i: scaled envelope Q15-e */ @@ -92,7 +93,9 @@ static Word16 tcx_arith_decode_fx( return bp; } +#endif +#ifdef IVAS_FLOAT_FIXED void tcx_arith_decode_envelope_fx( Word32 q_spectrum[], /* o: quantised MDCT coefficients Q31-e */ Word16 *q_spectrum_e, /* o: MDCT exponent Q0 */ @@ -208,3 +211,4 @@ void tcx_arith_decode_envelope_fx( set32_fx(q_spectrum + L_spec, 0, sub(L_frame, L_spec)); } +#endif \ No newline at end of file diff --git a/lib_dec/avq_dec.c b/lib_dec/avq_dec.c index 43372eddb3a173013a4907ca5d6f6bed5b21b38e..10cd09cd7b827f69f4a45e8661f7592fa62bebcd 100644 --- a/lib_dec/avq_dec.c +++ b/lib_dec/avq_dec.c @@ -44,8 +44,9 @@ /*-------------------------------------------------------------------* * Local prototypes *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void read_cv( Decoder_State *st, uint16_t *I, int16_t *kv, int16_t nq, int16_t *nbits ); +#endif /*-----------------------------------------------------------------* * AVQ_demuxdec() @@ -54,6 +55,7 @@ static void read_cv( Decoder_State *st, uint16_t *I, int16_t *kv, int16_t nq, in * split algebraic vector dequantizer based on RE8 latice. *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void AVQ_demuxdec( Decoder_State *st, /* i/o: decoder state structure */ int16_t xriq[], /* o : decoded subvectors [0..8*Nsv-1]*/ @@ -283,7 +285,7 @@ void AVQ_demuxdec( return; } - +#endif /*-----------------------------------------------------------------* * AVQ_dec_lpc_ivas() @@ -371,6 +373,7 @@ void AVQ_dec_lpc_ivas( * read codebook indices (rank I and event. Voronoi index kv) *-----------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void read_cv( Decoder_State *st, /* i/o: decoder state structure */ uint16_t *I, /* o : rank I code book index */ @@ -422,3 +425,4 @@ static void read_cv( return; } +#endif \ No newline at end of file diff --git a/lib_dec/avq_dec_fx.c b/lib_dec/avq_dec_fx.c index ab73ea4b037bcc63c765ab149dc690d50c620c82..62a55190973621449ce3cd348bbd062ededcb501 100644 --- a/lib_dec/avq_dec_fx.c +++ b/lib_dec/avq_dec_fx.c @@ -24,6 +24,7 @@ static void read_cv_fx( Decoder_State *st, UWord16 *I, Word16 *kv, Word16 nq, Wo * split algebraic vector dequantizer based on RE8 latice. *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void AVQ_demuxdec_fx( Decoder_State *st, /* i/o: decoder state structure */ Word16 xriq[], /* o : decoded subvectors [0..8*Nsv-1]*/ @@ -272,7 +273,7 @@ void AVQ_demuxdec_fx( return; } - +#endif /*-----------------------------------------------------------------* @@ -282,6 +283,7 @@ void AVQ_demuxdec_fx( * using split algebraic vector dequantizer *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void AVQ_dec_lpc( Word16 *indx, /* input: index[] (4 bits per words) */ Word16 *nvecq, /* output: vector quantized */ @@ -363,7 +365,7 @@ void AVQ_dec_lpc( return; } - +#endif /*-----------------------------------------------------------------* * read_cv_fx() @@ -371,6 +373,7 @@ void AVQ_dec_lpc( * read codebook indices (rank I and event. Voronoi index kv) *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static void read_cv_fx( Decoder_State *st, /* i/o: decoder state structure */ UWord16 *I, /* o : rank I code book index */ @@ -422,3 +425,4 @@ static void read_cv_fx( return; } +#endif \ No newline at end of file diff --git a/lib_dec/bass_psfilter.c b/lib_dec/bass_psfilter.c index ac9a9d60899702decc7668e10867403768e4d3a0..a58000d626810f4169613196bf960b48707a3b45 100644 --- a/lib_dec/bass_psfilter.c +++ b/lib_dec/bass_psfilter.c @@ -461,6 +461,7 @@ static int16_t Pit_track( * Add BPF component in cldfb domain *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void addBassPostFilter( const float *harm_timeIn, const int16_t samplesToProcess, @@ -519,6 +520,7 @@ void addBassPostFilter( return; } +#endif #ifdef IVAS_FLOAT_FIXED void addBassPostFilter_ivas_fx( @@ -652,7 +654,7 @@ int16_t res_bpf_adapt( return res_bpf_flag; } -#else +#endif /*---------------------------------------------------------------------* * res_bpf_adapt_ivas_fx() * @@ -661,6 +663,7 @@ int16_t res_bpf_adapt( *---------------------------------------------------------------------*/ /*! r: Decision to enable or disable BPF on DFT stereo residual */ +#ifdef IVAS_FLOAT_FIXED Word16 res_bpf_adapt_ivas_fx( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: DFT stereo decoder handle */ const Word32 *bpf_error_signal_8k, /* i : BPF modification signal */ @@ -772,6 +775,8 @@ void bpf_pitch_coherence( return; } #endif + +#ifdef IVAS_FLOAT_FIXED void bpf_pitch_coherence_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ const Word32 pitch_buf[] /* i : pitch for every subfr [0,1,2,3] */ @@ -838,3 +843,4 @@ void bpf_pitch_coherence_ivas_fx( return; } +#endif \ No newline at end of file diff --git a/lib_dec/bass_psfilter_fx.c b/lib_dec/bass_psfilter_fx.c index e843018a8b96e0e0d799814703b83159808e9a22..36655d69165c233262feb6841de6d4fd9e0975fa 100644 --- a/lib_dec/bass_psfilter_fx.c +++ b/lib_dec/bass_psfilter_fx.c @@ -29,6 +29,7 @@ static Word16 Pit_track_fx(Word16 syn[], Word16 T); * * Initialisation of postfiltering variables *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void bass_psfilter_init_fx( BPF_DEC_HANDLE hBPF /* o : BPF data handle */ ) @@ -46,6 +47,7 @@ void bass_psfilter_init_fx( return; } +#endif /*=========================================================================*/ /* FUNCTION : void bass_psfilter_fx () */ @@ -75,6 +77,7 @@ void bass_psfilter_init_fx( /* CALLED FROM : TX/RX */ /*=========================================================================*/ +#ifdef IVAS_FLOAT_FIXED void bass_psfilter_fx( BPF_DEC_HANDLE hBPF, /* i/o: BPF data handle */ const Word16 Opt_AMR_WB, /* i : AMR-WB IO flag */ @@ -737,6 +740,7 @@ void bass_psfilter_fx( return; } +#endif /*==============================================================================*/ /* FUNCTION : Word16 Pit_track_fx ( ) */ @@ -753,6 +757,7 @@ void bass_psfilter_fx( /* CALLED FROM : TX/RX */ /*==============================================================================*/ +#ifdef IVAS_FLOAT_FIXED static Word16 Pit_track_fx( /* o : Pitch */ Word16 syn[], /* i : synthesis [-PIT_MAX..L_SUBFR] */ Word16 T /* i : pitch period (>= PIT_MIN) */ @@ -875,6 +880,7 @@ static Word16 Pit_track_fx( /* o : Pitch */ return T; } +#endif /*---------------------------------------------------------------------* * addBassPostFilter() @@ -882,6 +888,7 @@ static Word16 Pit_track_fx( /* o : Pitch */ * Add BPF component in cldfb domain *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void addBassPostFilter_fx( const Word16 *harm_timeIn_Fx, Word32 **rAnalysis_Fx, @@ -975,6 +982,8 @@ void addBassPostFilter_fx( return; } +#endif + #ifdef ADD_BPF_ADAPT /*---------------------------------------------------------------------* * res_bpf_adapt() diff --git a/lib_dec/cng_dec_fx.c b/lib_dec/cng_dec_fx.c index abb6fd16601469eed35fb6bef5d6c475a7dc4184..daa78915377f245de5e0eb05037f4db92c84923e 100644 --- a/lib_dec/cng_dec_fx.c +++ b/lib_dec/cng_dec_fx.c @@ -19,7 +19,9 @@ void E_LPC_f_lsp_a_conversion(const Word16 *isp, Word16 *a, const Word16 m); * Local function prototypes *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static void shb_CNG_decod_fx( Decoder_State *st_fx, const Word16 *synth_fx, Word16 *shb_synth_fx, const Word16 sid_bw,const Word16 Qsyn); +#endif #ifdef IVAS_FLOAT_FIXED static void shb_CNG_decod_ivas_fx( Decoder_State *st_fx, const Word16 *synth_fx, Word16 *shb_synth_fx, const Word16 sid_bw, const Word16 Qsyn ); @@ -29,6 +31,7 @@ static void shb_CNG_decod_ivas_fx( Decoder_State *st_fx, const Word16 *synth_fx, * Decode residual signal energy *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void CNG_dec_fx( Decoder_State *st_fx, /* i/o: State structure */ const Word16 last_element_mode, /* i : last element mode Q0 */ @@ -698,11 +701,14 @@ void CNG_dec_fx( return; } +#endif + /*---------------------------------------------------------------------* * swb_CNG_dec() * * Comfort noise generation for SHB signal *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void swb_CNG_dec_fx( Decoder_State *st_fx, /* i/o: State structure */ const Word16 *synth_fx, /* i : ACELP core synthesis at 32kHz */ @@ -739,6 +745,7 @@ void swb_CNG_dec_fx( return; } +#endif #ifdef IVAS_FLOAT_FIXED void swb_CNG_dec_ivas_fx( @@ -784,6 +791,7 @@ void swb_CNG_dec_ivas_fx( * * Main routine of SHB SID decoding and CNG *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static void shb_CNG_decod_fx( Decoder_State *st_fx, /* i/o: State structure */ const Word16 *synth_fx, /* i : ACELP core synthesis at 32kHz */ @@ -1063,6 +1071,7 @@ static void shb_CNG_decod_fx( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void shb_CNG_decod_ivas_fx( @@ -1237,7 +1246,11 @@ static void shb_CNG_decod_ivas_fx( L_tmp = L_shl(L_tmp, q); q = sub(q, 32); ener_excSHB_fx = round_fx(L_tmp); /*Qq */ +#ifdef MSAN_FIX + IF ( EQ_16(st->last_vad_fx, 1)) +#else IF ( EQ_16(st->last_vad, 1)) +#endif { st->hTdCngDec->trans_cnt = 0; move16(); @@ -1334,6 +1347,7 @@ static void shb_CNG_decod_ivas_fx( * *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void td_cng_dec_init_fx( DEC_CORE_HANDLE st /* i/o: decoder state structure */ ) @@ -1407,6 +1421,7 @@ void td_cng_dec_init_fx( return; } +#endif #ifdef IVAS_FLOAT_FIXED void td_cng_dec_init_ivas_fx( diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index 7c773725ecd3daf905cc6cd7b5c38a4df66c4b18..3d9ae2933c48c55c3ab572b12fa3c578e2bebdf0 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -682,7 +682,7 @@ void open_decoder_LPD( if (st->ini_frame == 0 || (st->last_codec_mode == MODE1 && st->element_mode == EVS_MONO)) { - hTcxDec->tcxltp_last_gain_unmodified_float = 0.f; + //hTcxDec->tcxltp_last_gain_unmodified_float = 0.f; } /* TCX */ @@ -1489,8 +1489,8 @@ void tcxltp_dec_init( if ( ini_frame == 0 ) { - set_f( hTcxLtpDec->tcxltp_mem_in_float, 0.0f, TCXLTP_MAX_DELAY ); - set_f( hTcxLtpDec->tcxltp_mem_out_float, 0.0f, L_FRAME48k ); + //set_f( hTcxLtpDec->tcxltp_mem_in_float, 0.0f, TCXLTP_MAX_DELAY ); + //set_f( hTcxLtpDec->tcxltp_mem_out_float, 0.0f, L_FRAME48k ); #ifdef IVAS_FLOAT_FIXED set32_fx(hTcxLtpDec->tcxltp_mem_in_32, 0, TCXLTP_MAX_DELAY); set32_fx(hTcxLtpDec->tcxltp_mem_out_32, 0, L_FRAME48k); @@ -1558,6 +1558,8 @@ void reset_tcx_overl_buf( return; } #endif + +#ifdef IVAS_FLOAT_FIXED void reset_tcx_overl_buf_fx( TCX_DEC_HANDLE hTcxDec /* i/o: TCX decoder handle */ ) @@ -1572,6 +1574,7 @@ void reset_tcx_overl_buf_fx( hTcxDec->Q_syn_Overl_TDACFB = 0; return; } +#endif /*-----------------------------------------------------------------------* * acelp_plc_mdct_transition() diff --git a/lib_dec/core_dec_init_fx.c b/lib_dec/core_dec_init_fx.c index eb47d384997beffb9d1167245a8270f15cb2a289..ab367e3a4a7660c263e3afa27e5708b4d7e1b5c7 100644 --- a/lib_dec/core_dec_init_fx.c +++ b/lib_dec/core_dec_init_fx.c @@ -1012,6 +1012,7 @@ void open_decoder_LPD_fx( return; } +#ifdef IVAS_FLOAT_FIXED void tcxltp_dec_init_fx( TCX_LTP_DEC_HANDLE hTcxLtpDec, const Word16 ini_frame, @@ -1042,6 +1043,9 @@ void tcxltp_dec_init_fx( return; } +#endif + +#ifdef IVAS_FLOAT_FIXED void acelp_plc_mdct_transition_fx( Decoder_State *st /* i/o: Decoder state */ ) @@ -1088,6 +1092,8 @@ void acelp_plc_mdct_transition_fx( return; } +#endif + #ifdef IVAS_FLOAT_FIXED void open_decoder_LPD_ivas_fx( Decoder_State *st, /* i/o: decoder state structure */ diff --git a/lib_dec/core_dec_reconf.c b/lib_dec/core_dec_reconf.c index 3718a38d8435987444db854516ea64d71872263a..4448e13106d4227b6a00cdd8b0a1a3893529a4e7 100644 --- a/lib_dec/core_dec_reconf.c +++ b/lib_dec/core_dec_reconf.c @@ -72,9 +72,6 @@ void reconfig_decoder_LPD_ivas( st->narrowBand = 0; } -#ifdef IVAS_FLOAT_FIXED - BITS_ALLOC_init_config_acelp(st->total_brate, st->narrowBand, st->nb_subfr, &(st->acelp_cfg)); -#endif // IVAS_Fixed BITS_ALLOC_init_config_acelp_IVAS( st->total_brate, st->narrowBand, st->nb_subfr, &( st->acelp_cfg ) ); @@ -170,17 +167,13 @@ void reconfig_decoder_LPD_ivas( oldLen = L_SYN_MEM_CLAS_ESTIM; newLen = L_SYN_MEM_CLAS_ESTIM * st->L_frame / st->last_L_frame; } -#ifndef IVAS_FLOAT_FIXED lerp_flt(&st->mem_syn_clas_estim[L_SYN_MEM_CLAS_ESTIM - oldLen], &st->mem_syn_clas_estim[L_SYN_MEM_CLAS_ESTIM - newLen], newLen, oldLen); -#endif // #ifndef IVAS_FLOAT_FIXED } } -#ifndef IVAS_FLOAT_FIXED else { set_zero(st->mem_syn_clas_estim, L_SYN_MEM_CLAS_ESTIM); } -#endif // #ifndef IVAS_FLOAT_FIXED } } diff --git a/lib_dec/core_dec_reconf_fx.c b/lib_dec/core_dec_reconf_fx.c index 116bd7f238a505793f93a734efa3b93220270324..a99c92ddb94ab7a16e9597a98e577ce858174dd5 100644 --- a/lib_dec/core_dec_reconf_fx.c +++ b/lib_dec/core_dec_reconf_fx.c @@ -178,6 +178,7 @@ void reconfig_decoder_LPD_ivas_fx( } #endif +#ifdef IVAS_FLOAT_FIXED void reconfig_decoder_LPD_fx( Decoder_State *st, /* i/o: decoder state structure */ Word16 bits_frame, /* i : bit budget */ @@ -357,3 +358,4 @@ void reconfig_decoder_LPD_fx( return; } +#endif \ No newline at end of file diff --git a/lib_dec/core_dec_switch.c b/lib_dec/core_dec_switch.c index a6e1ef2588616ea021526e74165892e696375267..67dcade7ee9ec1ed96a1dab6ead70fdbbe2ec4bb 100644 --- a/lib_dec/core_dec_switch.c +++ b/lib_dec/core_dec_switch.c @@ -64,6 +64,7 @@ void open_decoder_LPD_ivas_fx( Word16* Q_old_outLB, Word16* Q_old_Aq_12_8); #endif // IVAS_FLOAT_FIXED + #ifndef IVAS_FLOAT_FIXED void mode_switch_decoder_LPD( Decoder_State *st, /* i/o: decoder state structure */ @@ -75,190 +76,171 @@ void mode_switch_decoder_LPD( const int16_t last_element_mode /* i : last element mode */ ) { - int16_t fscale, switchWB; - int32_t sr_core; - int16_t bSwitchFromAmrwbIO; - int16_t frame_size; - TCX_DEC_HANDLE hTcxDec = st->hTcxDec; - - switchWB = 0; - bSwitchFromAmrwbIO = 0; - if ( st->last_core == AMR_WB_CORE ) - { - bSwitchFromAmrwbIO = 1; - } - sr_core = getCoreSamplerateMode2_flt( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format ); - fscale = sr2fscale( sr_core ); - - /* set number of coded lines */ - st->hTcxCfg->tcx_coded_lines = getNumTcxCodedLines( bwidth ); - - if ( ( bwidth >= WB ) && ( fscale == ( FSCALE_DENOM * 16000 ) / 12800 ) && ( fscale == st->fscale ) ) - { - if ( ( ( total_brate > ACELP_32k ) && ( st->tcxonly == 0 ) ) || ( ( total_brate <= ACELP_32k ) && ( st->tcxonly == 1 ) ) ) - { - switchWB = 1; - } - } - - if ( st->last_L_frame > L_FRAME16k && total_brate <= ACELP_32k ) - { - switchWB = 1; /*force init when coming from MODE1*/ - } - - st->igf = getIgfPresent( st->element_mode, total_brate, bwidth, st->rf_flag ); - - if ( st->hIGFDec != NULL ) - { - st->hIGFDec->infoIGFStopFreq = -1; - } - - if ( st->igf && ( st->idchan == 0 || st->element_mode == IVAS_CPE_MDCT ) ) - { - /* switch IGF configuration */ - IGFDecSetMode_flt( st->hIGFDec, total_brate, bwidth, st->element_mode, -1, -1, st->rf_flag ); - } - - if ( fscale != st->fscale || switchWB || bSwitchFromAmrwbIO || st->last_codec_mode == MODE1 || st->force_lpd_reset ) - { - /* Init Decoder */ -#ifdef IVAS_FLOAT_FIXED - Word16 Q_syn_Overl_TDAC = 0, Q_fer_samples = 0, Q_syn_Overl = 0, Q_syn_Overl_TDACFB = 0, Q_syn_OverlFB = 0, Q_old_out = 0, Q_old_outLB = 0, Q_old_Aq_12_8 = 0; - open_decoder_LPD_ivas_fx(st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0, &Q_syn_Overl_TDAC, &Q_fer_samples, &Q_syn_Overl, &Q_syn_Overl_TDACFB, &Q_syn_OverlFB, &Q_old_out, &Q_old_outLB, &Q_old_Aq_12_8); -#endif - open_decoder_LPD( st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0 ); - } - else - { - assert( fscale > ( FSCALE_DENOM / 2 ) ); - st->fscale_old = st->fscale; - st->fscale = fscale; - st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); - if ( st->hTcxDec != NULL ) - { - st->hTcxDec->L_frameTCX = (int16_t) ( st->output_Fs / FRAMES_PER_SEC ); - } - - if ( st->hTcxCfg != NULL ) - { - st->hTcxCfg->ctx_hm = getCtxHm( st->element_mode, total_brate, st->rf_flag ); - st->hTcxCfg->resq = getResq( total_brate ); - } - - hTcxDec->tcx_lpc_shaped_ari = getTcxLpcShapedAri( total_brate, st->rf_flag, st->element_mode ); - - if ( bwidth == NB ) - { - st->narrowBand = 1; - } - else - { - st->narrowBand = 0; - } -#ifndef IVAS_FLOAT_FIXED - st->TcxBandwidth_float = getTcxBandwidth_flt( bwidth ); -#endif - if ( st->hTcxCfg != NULL ) - { - st->hTcxCfg->pCurrentTnsConfig = NULL; - st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( total_brate, st->igf, st->element_mode ); - } +int16_t fscale, switchWB; +int32_t sr_core; +int16_t bSwitchFromAmrwbIO; +int16_t frame_size; +TCX_DEC_HANDLE hTcxDec = st->hTcxDec; + +switchWB = 0; +bSwitchFromAmrwbIO = 0; +if (st->last_core == AMR_WB_CORE) +{ + bSwitchFromAmrwbIO = 1; +} +sr_core = getCoreSamplerateMode2_flt(st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag, st->is_ism_format); - if ( st->hTcxCfg->fIsTNSAllowed && st->hIGFDec != NULL && st->hTcxCfg != NULL ) - { - InitTnsConfigs_flt( bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, MCT_flag ); +fscale = sr2fscale(sr_core); - SetAllowTnsOnWhite_flt( st->hTcxCfg->tnsConfig, st->element_mode == IVAS_CPE_MDCT ); - } - } +/* set number of coded lines */ +st->hTcxCfg->tcx_coded_lines = getNumTcxCodedLines(bwidth); - frame_size = FrameSizeConfig[frame_size_index].frame_net_bits; - reconfig_decoder_LPD_ivas( st, frame_size, bwidth, total_brate, st->last_L_frame ); +if ((bwidth >= WB) && (fscale == (FSCALE_DENOM * 16000) / 12800) && (fscale == st->fscale)) +{ + if (((total_brate > ACELP_32k) && (st->tcxonly == 0)) || ((total_brate <= ACELP_32k) && (st->tcxonly == 1))) + { + switchWB = 1; + } +} -#ifndef IVAS_FLOAT_FIXED - if ( hTcxDec->envWeighted && !hTcxDec->enableTcxLpc ) - { - mvr2r( st->lspold_uw_float, st->lsp_old, M ); - mvr2r( st->lsfold_uw_float, st->lsf_old, M ); - hTcxDec->envWeighted = 0; - } - - /* update PLC LSF memories */ - lsp2lsf( st->lsp_old, st->lsfoldbfi1, M, st->sr_core ); - mvr2r( st->lsfoldbfi1, st->lsfoldbfi0, M ); - mvr2r( st->lsfoldbfi1, st->lsf_adaptive_mean, M ); -#endif // #ifndef IVAS_FLOAT_FIXED - - if ( st->igf && st->hBWE_TD != NULL ) - { - /* reset TBE */ - if ( ( st->bwidth == WB && st->last_extl != WB_TBE ) || - ( st->bwidth == SWB && st->last_extl != SWB_TBE ) || - ( st->bwidth == FB && st->last_extl != FB_TBE ) ) - { - TBEreset_dec( st ); - } - else - { -#ifndef IVAS_FLOAT_FIXED - set_f( st->hBWE_TD->state_lpc_syn, 0.0f, LPC_SHB_ORDER ); - set_f( st->hBWE_TD->state_syn_shbexc, 0.0f, L_SHB_LAHEAD ); - set_f( st->hBWE_TD->mem_stp_swb, 0.0f, LPC_SHB_ORDER ); - set_f( st->hBWE_TD->mem_zero_swb, 0, LPC_SHB_ORDER ); - st->hBWE_TD->gain_prec_swb = 1.0f; -#endif -#ifdef IVAS_FLOAT_FIXED - set_val_Word16(st->hBWE_TD->state_lpc_syn_fx, 0, LPC_SHB_ORDER); - set_val_Word16( st->hBWE_TD->state_syn_shbexc_fx, 0, L_SHB_LAHEAD ); - set_val_Word16( st->hBWE_TD->mem_stp_swb_fx, 0, LPC_SHB_ORDER ); - set_val_Word16( st->hBWE_TD->mem_zero_swb_fx, 0, LPC_SHB_ORDER ); - st->hBWE_TD->gain_prec_swb_fx = 16384; -#endif - } - } +if (st->last_L_frame > L_FRAME16k && total_brate <= ACELP_32k) +{ + switchWB = 1; /*force init when coming from MODE1*/ +} - if ( bwidth == SWB && ( total_brate == ACELP_16k40 || total_brate == ACELP_24k40 ) && st->element_mode == EVS_MONO ) - { - if ( st->tec_tfa == 0 && st->hTECDec != NULL ) - { -#ifndef IVAS_FLOAT_FIXED - set_zero( st->hTECDec->loBuffer_flt, MAX_TEC_SMOOTHING_DEG ); -#endif -#ifdef IVAS_FLOAT_FIXED - set_val_Word16( st->hTECDec->loBuffer, 0, MAX_TEC_SMOOTHING_DEG ); -#endif - } - st->tec_tfa = 1; - } - else - { - st->tec_tfa = 0; - } - - st->tec_flag = 0; - st->tfa_flag = 0; - - /* needed in decoder to read the bitstream */ - if ( bwidth >= WB && total_brate == ACELP_24k40 && st->element_mode == EVS_MONO ) - { - st->enableGplc = 1; - } - else - { - st->enableGplc = 0; - } - - if ( ( total_brate == ACELP_9k60 || total_brate == ACELP_16k40 || total_brate == ACELP_24k40 ) && st->element_mode == EVS_MONO ) - { - st->dec_glr = 1; - } - else - { - st->dec_glr = 0; - } - - st->dec_glr_idx = 0; - - return; +st->igf = getIgfPresent(st->element_mode, total_brate, bwidth, st->rf_flag); + +if (st->hIGFDec != NULL) +{ + st->hIGFDec->infoIGFStopFreq = -1; +} + +if (st->igf && (st->idchan == 0 || st->element_mode == IVAS_CPE_MDCT)) +{ + /* switch IGF configuration */ + IGFDecSetMode_flt(st->hIGFDec, total_brate, bwidth, st->element_mode, -1, -1, st->rf_flag); + +} + +if (fscale != st->fscale || switchWB || bSwitchFromAmrwbIO || st->last_codec_mode == MODE1 || st->force_lpd_reset) +{ + open_decoder_LPD(st, total_brate, last_total_brate, bwidth, MCT_flag, last_element_mode, 0); +} +else +{ + assert(fscale > (FSCALE_DENOM / 2)); + st->fscale_old = st->fscale; + st->fscale = fscale; + st->L_frame = (int16_t)(st->sr_core / FRAMES_PER_SEC); + if (st->hTcxDec != NULL) + { + st->hTcxDec->L_frameTCX = (int16_t)(st->output_Fs / FRAMES_PER_SEC); + } + + if (st->hTcxCfg != NULL) + { + st->hTcxCfg->ctx_hm = getCtxHm(st->element_mode, total_brate, st->rf_flag); + st->hTcxCfg->resq = getResq(total_brate); + } + + hTcxDec->tcx_lpc_shaped_ari = getTcxLpcShapedAri(total_brate, st->rf_flag, st->element_mode); + + if (bwidth == NB) + { + st->narrowBand = 1; + } + else + { + st->narrowBand = 0; + } + st->TcxBandwidth = getTcxBandwidth_flt(bwidth); + + if (st->hTcxCfg != NULL) + { + st->hTcxCfg->pCurrentTnsConfig = NULL; + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed(total_brate, st->igf, st->element_mode); + } + + if (st->hTcxCfg->fIsTNSAllowed && st->hIGFDec != NULL && st->hTcxCfg != NULL) + { + InitTnsConfigs_flt(bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFDec->infoIGFStopFreq, total_brate, st->element_mode, MCT_flag); + + SetAllowTnsOnWhite_flt(st->hTcxCfg->tnsConfig, st->element_mode == IVAS_CPE_MDCT); + + } +} + +frame_size = FrameSizeConfig[frame_size_index].frame_net_bits; +reconfig_decoder_LPD_ivas(st, frame_size, bwidth, total_brate, st->last_L_frame); + +if (hTcxDec->envWeighted && !hTcxDec->enableTcxLpc) +{ + mvr2r(st->lspold_uw, st->lsp_old, M); + mvr2r(st->lsfold_uw, st->lsf_old, M); + hTcxDec->envWeighted = 0; +} + +/* update PLC LSF memories */ +lsp2lsf(st->lsp_old, st->lsfoldbfi1, M, st->sr_core); +mvr2r(st->lsfoldbfi1, st->lsfoldbfi0, M); +mvr2r(st->lsfoldbfi1, st->lsf_adaptive_mean, M); + +if (st->igf && st->hBWE_TD != NULL) +{ + /* reset TBE */ + if ((st->bwidth == WB && st->last_extl != WB_TBE) || + (st->bwidth == SWB && st->last_extl != SWB_TBE) || + (st->bwidth == FB && st->last_extl != FB_TBE)) + { + TBEreset_dec(st); + } + else + { + set_f(st->hBWE_TD->state_lpc_syn, 0.0f, LPC_SHB_ORDER); + set_f(st->hBWE_TD->state_syn_shbexc, 0.0f, L_SHB_LAHEAD); + set_f(st->hBWE_TD->mem_stp_swb, 0.0f, LPC_SHB_ORDER); + set_f(st->hBWE_TD->mem_zero_swb, 0, LPC_SHB_ORDER); + st->hBWE_TD->gain_prec_swb = 1.0f; + } +} + +if (bwidth == SWB && (total_brate == ACELP_16k40 || total_brate == ACELP_24k40) && st->element_mode == EVS_MONO) +{ + if (st->tec_tfa == 0 && st->hTECDec != NULL) + { + set_zero(st->hTECDec->loBuffer, MAX_TEC_SMOOTHING_DEG); + } + st->tec_tfa = 1; +} +else +{ + st->tec_tfa = 0; +} + +st->tec_flag = 0; +st->tfa_flag = 0; + +/* needed in decoder to read the bitstream */ +if (bwidth >= WB && total_brate == ACELP_24k40 && st->element_mode == EVS_MONO) +{ + st->enableGplc = 1; +} +else +{ + st->enableGplc = 0; +} + +if ((total_brate == ACELP_9k60 || total_brate == ACELP_16k40 || total_brate == ACELP_24k40) && st->element_mode == EVS_MONO) +{ + st->dec_glr = 1; +} +else +{ + st->dec_glr = 0; +} + +st->dec_glr_idx = 0; + +return; } #endif diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 18bd70f5142748919768222962c43e48ce13b81e..654fd229310e90e74f2c87f3ed9061a8783928ee 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -573,6 +573,7 @@ ivas_error core_switching_pre_dec_ivas_fx( #endif // 1 set16_fx( st->hHQ_core->old_out_fx, 0, output_frame ); set32_fx( st->hHQ_core->old_outLB_fx, 0, L_FRAME16k ); + set16_fx(st->hHQ_core->old_out_LB_fx, 0, L_FRAME16k); } st->hHQ_core->no_att_hangover = 0; diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 2cf9bcc3a26452b2c3c4c752edc296fe233ce5f8..bed7107f60ed0383b289990750e1170f724f4404 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -29,6 +29,7 @@ static void smoothTransitionDtxToTcx_fx(Word16 synth[], const Word16 output_fram static void core_switch_lb_upsamp_fx(Decoder_State* st, Word32* output); #endif +#ifdef IVAS_FLOAT_FIXED void bandwidth_switching_detect_fx( Decoder_State *st_fx /* i/o: encoder state structure */ ) @@ -141,6 +142,7 @@ void bandwidth_switching_detect_fx( return; } +#endif /*---------------------------------------------------------------------* * Calc_freq_ener_fx() @@ -148,6 +150,7 @@ void bandwidth_switching_detect_fx( * *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED static Word32 Calc_freq_ener_fx(Word32 L_tmp, const Word16 Q_syn2) { Word32 enerLL_fx; @@ -170,6 +173,7 @@ static Word32 Calc_freq_ener_fx(Word32 L_tmp, const Word16 Q_syn2) } return enerLL_fx; } +#endif /*---------------------------------------------------------------------* * bw_switching_pre_proc_fx() @@ -177,6 +181,7 @@ static Word32 Calc_freq_ener_fx(Word32 L_tmp, const Word16 Q_syn2) * *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void bw_switching_pre_proc_fx( const Word16 *old_syn_12k8_16k_fx, /* i : ACELP core synthesis at 12.8kHz or 16kHz */ Decoder_State *st_fx /* i/o: decoder state structure */ @@ -330,6 +335,7 @@ void bw_switching_pre_proc_fx( } return; } +#endif #ifdef IVAS_CODE_SWITCHING @@ -479,6 +485,7 @@ static void smoothTransitionMdctStereoDtx( * * Preprocessing/preparation for ACELP/HQ core switching *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED ivas_error core_switching_pre_dec_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ const Word16 output_frame /* i : frame length */ @@ -1093,6 +1100,7 @@ ivas_error core_switching_pre_dec_fx( return error; } +#endif /*---------------------------------------------------------------------* * core_switching_post_dec() @@ -1100,6 +1108,7 @@ ivas_error core_switching_pre_dec_fx( * Postprocessing for ACELP/HQ core switching *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED ivas_error core_switching_post_dec_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ Word16 *synth, /* i/o: output synthesis Qsynth */ @@ -1499,6 +1508,7 @@ ivas_error core_switching_post_dec_fx( return error; } +#endif #ifdef IVAS_FLOAT_FIXED ivas_error core_switching_post_dec_ivas_fx( @@ -1854,7 +1864,10 @@ ivas_error core_switching_post_dec_ivas_fx( hHQ_core->Q_old_wtda = Qtmp; move16(); } - Scale_sig( output_mem_fx, NS2SA( st_fx->output_Fs, STEREO_DFT32MS_OVL_NS ), Qtmp ); + IF ( output_mem_fx != NULL ) + { + Scale_sig( output_mem_fx, NS2SA( st_fx->output_Fs, STEREO_DFT32MS_OVL_NS ), Qtmp ); + } *Qsynth = Qtmp; move16(); @@ -2095,6 +2108,7 @@ ivas_error core_switching_post_dec_ivas_fx( * - modify bit allocation for HQ core by removing CELP subframe budget *---------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void core_switching_hq_prepare_dec_fx( Decoder_State *st_fx, /* i/o: encoder state structure */ Word16 *num_bits, /* i/o: bit budget update */ @@ -2165,6 +2179,7 @@ void core_switching_hq_prepare_dec_fx( return; } +#endif #ifdef IVAS_FLOAT_FIXED static void core_switch_lb_upsamp_fx( diff --git a/lib_dec/d_gain2p.c b/lib_dec/d_gain2p.c index 8d675a4d9d05639d1530c379b20f51310862b0af..bd2366c9a5fb008cb98c66f24674da625a7bcb6a 100644 --- a/lib_dec/d_gain2p.c +++ b/lib_dec/d_gain2p.c @@ -47,7 +47,7 @@ * * Decoding of pitch and codebook gains without updating long term energies *-------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void Mode2_gain_dec_mless_flt( const int16_t index, /* i : index of quantizer */ const float code[], /* i : Innovative code vector */ @@ -132,6 +132,7 @@ static void Mode2_gain_dec_mless_flt( return; } +#endif /*---------------------------------------------------------------------* @@ -139,7 +140,7 @@ static void Mode2_gain_dec_mless_flt( * * Decoding of pitch and codebook gains for Unvoiced mode *---------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void gain_dec_uv( const int16_t index, /* i/o: Quantization index vector */ const float *code, /* i : algebraic code excitation */ @@ -178,6 +179,7 @@ static void gain_dec_uv( return; } +#endif /*---------------------------------------------------------------------* @@ -185,7 +187,7 @@ static void gain_dec_uv( * * Decoding of pitch and codebook gains for Unvoiced mode *---------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void gain_dec_gacelp_uv( int16_t index, /* i/o: Quantization index vector */ const float *code, /* i : algebraic code excitation */ @@ -237,6 +239,7 @@ void gain_dec_gacelp_uv( return; } +#endif /*---------------------------------------------------------------------* @@ -244,7 +247,7 @@ void gain_dec_gacelp_uv( * * *---------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void decode_acelp_gains( const float *code, const int16_t gains_mode, @@ -286,3 +289,4 @@ void decode_acelp_gains( return; } +#endif diff --git a/lib_dec/dec2t32.c b/lib_dec/dec2t32.c index afb8fd8f591e07773ed102a2fb9abd545492f423..a794e5618aace1af3c153cd3bf4107eb50916ab5 100644 --- a/lib_dec/dec2t32.c +++ b/lib_dec/dec2t32.c @@ -53,7 +53,7 @@ * * See cod2t32.c for more details of the algebraic code. *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void dec_acelp_2t32( Decoder_State *st, /* i/o: decoder state structure */ float code[] /* o : algebraic (fixed) codebook excitation */ @@ -86,7 +86,6 @@ void dec_acelp_2t32( return; } - /*----------------------------------------------------------------------------------* * dec_acelp_1t64() * @@ -129,3 +128,4 @@ void dec_acelp_1t64( return; } +#endif diff --git a/lib_dec/dec2t32_fx.c b/lib_dec/dec2t32_fx.c index b1cd2af3a63cde8ae7b0d68c9c4b35715158e8f6..85181bb88cccd68992ace6a977a508fa746179c3 100644 --- a/lib_dec/dec2t32_fx.c +++ b/lib_dec/dec2t32_fx.c @@ -33,7 +33,7 @@ /* CALLED FROM : */ /*==========================================================================*/ - +#ifdef IVAS_FLOAT_FIXED void dec_acelp_2t32_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ Word16 code[] /* o: algebraic (fixed) codebook excitation */ @@ -74,7 +74,6 @@ void dec_acelp_2t32_fx( } - /*==========================================================================*/ /* FUNCTION : void dec_acelp_1t64_fx () */ /*--------------------------------------------------------------------------*/ @@ -133,3 +132,4 @@ void dec_acelp_1t64_fx( return; } +#endif diff --git a/lib_dec/dec4t64.c b/lib_dec/dec4t64.c index be4ab425dc4319e615e2dc525de2a6b981530fb4..4b02cfb2fdf8c975d9efbba146a9636acc7a6e3d 100644 --- a/lib_dec/dec4t64.c +++ b/lib_dec/dec4t64.c @@ -46,6 +46,7 @@ * Local function prototypes *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void add_pulses( const int16_t pos[], const int16_t nb_pulse, const int16_t track, float code[] ); static void dec_1p_N1( const int32_t index, const int16_t N, const int16_t offset, int16_t pos[] ); static void dec_2p_2N1( const int32_t index, const int16_t N, const int16_t offset, int16_t pos[] ); @@ -55,7 +56,7 @@ static void dec_4p_4N( const int32_t index, const int16_t N, const int16_t offse static void dec_5p_5N( const int32_t index, const int16_t N, const int16_t offset, int16_t pos[] ); static void dec_6p_6N2( const int32_t index, const int16_t N, const int16_t offset, int16_t pos[] ); static void fcb_decode_PI( int32_t code_index, int16_t sector_6p[], const int16_t pulse_num ); - +#endif /*----------------------------------------------------------------------------------* * dec_acelp_4t64() @@ -72,6 +73,7 @@ static void fcb_decode_PI( int32_t code_index, int16_t sector_6p[], const int16_ * See cod4t64.c for more details of the algebraic code. *----------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void dec_acelp_4t64( Decoder_State *st, /* i/o: decoder state structure */ int16_t nbbits, /* i : number of bits per codebook */ @@ -262,6 +264,7 @@ void dec_acelp_4t64( return; } +#endif /*-------------------------------------------------------* * add_pulses() @@ -269,6 +272,7 @@ void dec_acelp_4t64( * Add decoded pulses to the codeword *-------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void add_pulses( const int16_t pos[], /* i : pulse position */ const int16_t nb_pulse, /* i : nb. of pulses */ @@ -293,13 +297,14 @@ static void add_pulses( return; } +#endif /*-------------------------------------------------------* * dec_1p_N1() * * Decode 1 pulse with N+1 bits *-------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void dec_1p_N1( const int32_t index, /* i : quantization index */ const int16_t N, /* i : nb. of bits */ @@ -372,6 +377,8 @@ void dec_2p_2N1( return; } +#endif + /*-------------------------------------------------------* * dec_3p_3N1() @@ -379,6 +386,7 @@ void dec_2p_2N1( * Decode 3 pulses with 3*N+1 bits: *-------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void dec_3p_3N1( const int32_t index, /* i : quantization index */ const int16_t N, /* i : nb. of bits */ @@ -526,13 +534,14 @@ static void dec_5p_5N( return; } +#endif /*-------------------------------------------------------* * dec_6p_6N2() * * Decode 6 pulses with 6*N+2 bits: *-------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED static void dec_6p_6N2( const int32_t index, /* i : quantization index */ const int16_t N, /* i : nb. of bits */ @@ -688,6 +697,7 @@ static void fcb_decode_position( return; } +#endif /*---------------------------------------------------------------------* * fcb_decode_PI() @@ -696,6 +706,7 @@ static void fcb_decode_position( *---------------------------------------------------------------------*/ /*! r: return pulse position number */ +#ifndef IVAS_FLOAT_FIXED static void fcb_decode_PI( int32_t code_index, /* i : fcb index information */ int16_t sector_6p[], /* o : decoded pulse position */ @@ -735,11 +746,13 @@ static void fcb_decode_PI( return; } +#endif /*---------------------------------------------------------------------* * Read FCB index * *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void D_ACELP_decode_43bit( uint16_t idxs[], float code[], @@ -775,6 +788,7 @@ void D_ACELP_decode_43bit( return; } +#endif /*-------------------------------------------------------* * dec_1p_N1() @@ -782,6 +796,7 @@ void D_ACELP_decode_43bit( * Decode 1 pulse with N+1 bits *-------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void dec_1p_N1_L_subfr( const int32_t index, /* i : quantization index */ const int16_t nb_pos, /* i : number of positions */ @@ -805,6 +820,7 @@ static void dec_1p_N1_L_subfr( return; } +#endif /*-------------------------------------------------------* * add_pulses() @@ -812,6 +828,7 @@ static void dec_1p_N1_L_subfr( * Add decoded pulses to the codeword *-------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void add_pulses_L_subfr( const int16_t nb_pos, /* i : number of positions */ const int16_t pos[], /* i : pulse position */ @@ -837,13 +854,14 @@ static void add_pulses_L_subfr( return; } +#endif /*----------------------------------------------------------------------------------* * dec_acelp_fast() * * fast algebraic codebook decoder *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void dec_acelp_fast( Decoder_State *st, /* i/o: decoder state structure */ const int16_t cdk_index, /* i : codebook index */ @@ -1009,3 +1027,4 @@ void dec_acelp_fast( return; } +#endif \ No newline at end of file diff --git a/lib_dec/dec_acelp.c b/lib_dec/dec_acelp.c index 2a4c44b7d731d35a17158bf9d5f99b37a1021986..3480a77940676b1997fa3759b4e827c0262e6a96 100644 --- a/lib_dec/dec_acelp.c +++ b/lib_dec/dec_acelp.c @@ -45,6 +45,7 @@ * Local function prototypes *---------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void D_ACELP_decode_arithtrack_ivas( float v[], uint32_t s, int16_t p, const int16_t trackstep, const int16_t tracklen ); /*---------------------------------------------------------------------* @@ -243,7 +244,6 @@ static void D_ACELP_decode_arithtrack_ivas( return; } - void fcb_pulse_track_joint_decode_ivas( uint16_t *idxs, const int16_t wordcnt, @@ -365,3 +365,4 @@ void fcb_pulse_track_joint_decode_ivas( return; } +#endif \ No newline at end of file diff --git a/lib_dec/dec_acelp_tcx_main.c b/lib_dec/dec_acelp_tcx_main.c index ab9447b9a6300ad2773156f41e3e28cc4a252256..f04ce92f9affb19ce0ae5668f6777aac17e79dd8 100644 --- a/lib_dec/dec_acelp_tcx_main.c +++ b/lib_dec/dec_acelp_tcx_main.c @@ -53,224 +53,216 @@ static void decode_frame_type_flt( STEREO_CNG_DEC_HANDLE hStereoCng /* i/o: Stereo CNG data structure */ ) { - int16_t frame_size_index, n; - int32_t total_brate; + int16_t frame_size_index, n; + int32_t total_brate; - frame_size_index = 0; - total_brate = st->total_brate; + frame_size_index = 0; + total_brate = st->total_brate; - /* Get Frame Type (NULL,SID,ACTIVE) and Frame Mode (2kbps, 4kbps,...) */ + /* Get Frame Type (NULL,SID,ACTIVE) and Frame Mode (2kbps, 4kbps,...) */ - if ( st->mdct_sw == MODE1 ) - { - st->m_frame_type = ACTIVE_FRAME; + if (st->mdct_sw == MODE1) + { + st->m_frame_type = ACTIVE_FRAME; - for ( n = 0; n < FRAME_SIZE_NB; n++ ) - { - if ( FrameSizeConfig[n].frame_bits == st->total_brate / FRAMES_PER_SEC ) - { - frame_size_index = n; - break; - } - } + for (n = 0; n < FRAME_SIZE_NB; n++) + { + if (FrameSizeConfig[n].frame_bits == st->total_brate / FRAMES_PER_SEC) + { + frame_size_index = n; + break; + } } - else + } + else + { + /* ZERO Frame */ + if (st->total_brate == FRAME_NO_DATA) + { + st->bwidth = st->last_bwidth; + st->m_frame_type = ZERO_FRAME; + } + + /* SID frame */ + else if (st->total_brate == SID_2k40) { - /* ZERO Frame */ - if ( st->total_brate == FRAME_NO_DATA ) + uint16_t frame_len_indicator; + + st->cng_type = get_next_indice(st, 1); + + if (st->cng_type != FD_CNG) + { + st->BER_detect = 1; + st->cng_type = FD_CNG; + } + st->m_frame_type = SID_FRAME; + frame_size_index = 1; + st->bwidth = get_next_indice(st, 2); + + frame_len_indicator = get_next_indice(st, 1); + if (st->bwidth == NB) + { + if (frame_len_indicator) { - st->bwidth = st->last_bwidth; - st->m_frame_type = ZERO_FRAME; + st->BER_detect = 1; } - - /* SID frame */ - else if ( st->total_brate == SID_2k40 ) + frame_len_indicator = 0; + } + if (frame_len_indicator == 0) + { + st->L_frame = L_FRAME; + st->total_brate = ACELP_9k60; + } + else + { + st->L_frame = L_FRAME16k; + if (st->last_total_brate == ACELP_16k40 || st->last_total_brate == ACELP_24k40) { - uint16_t frame_len_indicator; - - st->cng_type = get_next_indice( st, 1 ); - - if ( st->cng_type != FD_CNG ) - { - st->BER_detect = 1; - st->cng_type = FD_CNG; - } - st->m_frame_type = SID_FRAME; - frame_size_index = 1; - st->bwidth = get_next_indice( st, 2 ); - - frame_len_indicator = get_next_indice( st, 1 ); - if ( st->bwidth == NB ) - { - if ( frame_len_indicator ) - { - st->BER_detect = 1; - } - frame_len_indicator = 0; - } - if ( frame_len_indicator == 0 ) - { - st->L_frame = L_FRAME; - st->total_brate = ACELP_9k60; - } - else - { - st->L_frame = L_FRAME16k; - if ( st->last_total_brate == ACELP_16k40 || st->last_total_brate == ACELP_24k40 ) - { - st->total_brate = st->last_total_brate; - } - else - { - st->total_brate = 16400; - } - } - - for ( n = 0; n < FRAME_SIZE_NB; n++ ) - { - if ( FrameSizeConfig[n].frame_bits == st->total_brate / FRAMES_PER_SEC ) - { - frame_size_index = n; - break; - } - } + st->total_brate = st->last_total_brate; } - /* EVS MODES */ else { - /* Get Frame mode */ - st->m_frame_type = ACTIVE_FRAME; - - for ( n = 0; n < FRAME_SIZE_NB; n++ ) - { - if ( FrameSizeConfig[n].frame_bits == st->total_brate / FRAMES_PER_SEC ) - { - frame_size_index = n; - break; - } - } - - if ( st->rf_flag == 0 ) - { - /* Get bandwidth info */ - st->bwidth = get_next_indice( st, FrameSizeConfig[frame_size_index].bandwidth_bits ); - st->bwidth += FrameSizeConfig[frame_size_index].bandwidth_min; - } - else - { - st->bwidth += FrameSizeConfig[frame_size_index].bandwidth_min; - } - - if ( st->bwidth > FB ) - { - st->bwidth = FB; - st->BER_detect = 1; - } - - if ( st->bwidth > SWB && st->total_brate < ACELP_16k40 ) - { - st->bwidth = SWB; - st->BER_detect = 1; - } + st->total_brate = 16400; + } + } - /* Get reserved bit */ - if ( FrameSizeConfig[frame_size_index].reserved_bits && st->rf_flag == 0 ) - { - if ( get_next_indice( st, 1 ) != 0 ) - { - st->BER_detect = 1; - } - assert( FrameSizeConfig[frame_size_index].reserved_bits == 1 ); - } + for (n = 0; n < FRAME_SIZE_NB; n++) + { + if (FrameSizeConfig[n].frame_bits == st->total_brate / FRAMES_PER_SEC) + { + frame_size_index = n; + break; } + } } - - st->rate_switching_init = 0; - - if ( st->last_codec_mode != MODE2 || !st->BER_detect ) + /* EVS MODES */ + else { - /* Mode or Rate Change */ - if ( ( st->m_frame_type == ACTIVE_FRAME || st->m_frame_type == SID_FRAME ) && ( ( st->total_brate != st->last_total_brate ) || ( st->bwidth != st->last_bwidth ) || ( st->last_codec_mode == MODE1 ) || ( st->rf_flag != st->rf_flag_last ) || st->force_lpd_reset ) ) + /* Get Frame mode */ + st->m_frame_type = ACTIVE_FRAME; + + for (n = 0; n < FRAME_SIZE_NB; n++) + { + if (FrameSizeConfig[n].frame_bits == st->total_brate / FRAMES_PER_SEC) { - st->rate_switching_init = 1; + frame_size_index = n; + break; + } + } + + if (st->rf_flag == 0) + { + /* Get bandwidth info */ + st->bwidth = get_next_indice(st, FrameSizeConfig[frame_size_index].bandwidth_bits); + st->bwidth += FrameSizeConfig[frame_size_index].bandwidth_min; + } + else + { + st->bwidth += FrameSizeConfig[frame_size_index].bandwidth_min; + } + + if (st->bwidth > FB) + { + st->bwidth = FB; + st->BER_detect = 1; + } + + if (st->bwidth > SWB && st->total_brate < ACELP_16k40) + { + st->bwidth = SWB; + st->BER_detect = 1; + } + + /* Get reserved bit */ + if (FrameSizeConfig[frame_size_index].reserved_bits && st->rf_flag == 0) + { + if (get_next_indice(st, 1) != 0) + { + st->BER_detect = 1; + } + assert(FrameSizeConfig[frame_size_index].reserved_bits == 1); + } + } + } - /* Reconf Core */ - mode_switch_decoder_LPD( st, st->bwidth, st->total_brate, st->last_total_brate, frame_size_index, 0, st->element_mode ); + st->rate_switching_init = 0; - /* Reconf. CLDFB: check if the CLDFB works on the right sample rate */ - if ( ( st->cldfbAna->no_channels * st->cldfbAna->no_col ) != st->L_frame ) - { - resampleCldfb_ivas( st->cldfbAna, ( st->L_frame * FRAMES_PER_SEC ) ); - if ( st->L_frame <= L_FRAME16k ) - { - resampleCldfb_ivas( st->cldfbBPF, ( st->L_frame * FRAMES_PER_SEC ) ); - } - } - if ( st->bwidth == NB ) - { - int16_t nBand_nb = (int16_t) ( 8000 * st->cldfbSyn->no_channels / st->output_Fs ); - st->cldfbSyn->bandsToZero = st->cldfbSyn->no_channels - nBand_nb; - } - else - { - st->cldfbSyn->bandsToZero = 0; - } + if (st->last_codec_mode != MODE2 || !st->BER_detect) + { + /* Mode or Rate Change */ + if ((st->m_frame_type == ACTIVE_FRAME || st->m_frame_type == SID_FRAME) && ((st->total_brate != st->last_total_brate) || (st->bwidth != st->last_bwidth) || (st->last_codec_mode == MODE1) || (st->rf_flag != st->rf_flag_last) || st->force_lpd_reset)) + { + st->rate_switching_init = 1; - /*Reconf Frequency-domain based CNG*/ - configureFdCngDec( st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode ); - if ( st->last_L_frame != st->L_frame && st->L_frame <= L_FRAME16k && st->last_L_frame <= L_FRAME16k ) - { - lerp_flt( st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, st->L_frame * 2, st->last_L_frame * 2 ); - if ( st->m_frame_type == SID_FRAME && st->hFdCngDec->hFdCngCom->frame_type_previous != ACTIVE_FRAME ) - { - lerp_flt( st->hFdCngDec->hFdCngCom->olapBufferSynth_flt, st->hFdCngDec->hFdCngCom->olapBufferSynth_flt, st->L_frame * 2, st->last_L_frame * 2 ); - lerp_flt( hStereoCng->olapBufferSynth22, hStereoCng->olapBufferSynth22, st->L_frame * 2, st->last_L_frame * 2 ); - - if ( st->L_frame == L_FRAME ) - { - for ( n = 0; n < st->L_frame * 2; n++ ) - { - st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[n] = st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[n] * 1.25f; - } - } - else - { - for ( n = 0; n < st->L_frame * 2; n++ ) - { - st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[n] = st->hFdCngDec->hFdCngCom->olapBufferSynth_flt[n] / 1.25f; - } - } - } - } + /* Reconf Core */ + mode_switch_decoder_LPD(st, st->bwidth, st->total_brate, st->last_total_brate, frame_size_index, 0, st->element_mode); - if ( st->bwidth != st->last_bwidth ) - { - st->hFdCngDec->hFdCngCom->msFrCnt_init_counter = 0; - st->hFdCngDec->hFdCngCom->init_old_flt = FLT_MAX; - } + /* Reconf. CLDFB: check if the CLDFB works on the right sample rate */ + if ((st->cldfbAna->no_channels * st->cldfbAna->no_col) != st->L_frame) + { + resampleCldfb_ivas(st->cldfbAna, (st->L_frame * FRAMES_PER_SEC)); + if (st->L_frame <= L_FRAME16k) + { + resampleCldfb_ivas(st->cldfbBPF, (st->L_frame * FRAMES_PER_SEC)); + } + } + if (st->bwidth == NB) + { + int16_t nBand_nb = (int16_t)(8000 * st->cldfbSyn->no_channels / st->output_Fs); + st->cldfbSyn->bandsToZero = st->cldfbSyn->no_channels - nBand_nb; + } + else + { + st->cldfbSyn->bandsToZero = 0; + } + + /*Reconf Frequency-domain based CNG*/ + configureFdCngDec(st->hFdCngDec, st->bwidth, st->rf_flag == 1 && st->total_brate == ACELP_13k20 ? ACELP_9k60 : st->total_brate, st->L_frame, st->last_L_frame, st->element_mode); + if (st->last_L_frame != st->L_frame && st->L_frame <= L_FRAME16k && st->last_L_frame <= L_FRAME16k) + { + lerp_flt(st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->hFdCngDec->hFdCngCom->olapBufferSynth2, st->L_frame * 2, st->last_L_frame * 2); + if (st->m_frame_type == SID_FRAME && st->hFdCngDec->hFdCngCom->frame_type_previous != ACTIVE_FRAME) + { + lerp_flt(st->hFdCngDec->hFdCngCom->olapBufferSynth, st->hFdCngDec->hFdCngCom->olapBufferSynth, st->L_frame * 2, st->last_L_frame * 2); + lerp_flt(hStereoCng->olapBufferSynth22, hStereoCng->olapBufferSynth22, st->L_frame * 2, st->last_L_frame * 2); - if ( st->tcxonly ) + if (st->L_frame == L_FRAME) + { + for (n = 0; n < st->L_frame * 2; n++) { - st->p_bpf_noise_buf_float = NULL; -#ifdef IVAS_FLOAT_FIXED - st->p_bpf_noise_buf_32 = NULL; -#endif - + st->hFdCngDec->hFdCngCom->olapBufferSynth[n] = st->hFdCngDec->hFdCngCom->olapBufferSynth[n] * 1.25f; } - else + } + else + { + for (n = 0; n < st->L_frame * 2; n++) { - st->p_bpf_noise_buf_float = st->bpf_noise_buf_float; -#ifdef IVAS_FLOAT_FIXED - st->p_bpf_noise_buf_32 = st->bpf_noise_buf_32; -#endif - + st->hFdCngDec->hFdCngCom->olapBufferSynth[n] = st->hFdCngDec->hFdCngCom->olapBufferSynth[n] / 1.25f; } + } } + } + + if (st->bwidth != st->last_bwidth) + { + st->hFdCngDec->hFdCngCom->msFrCnt_init_counter = 0; + st->hFdCngDec->hFdCngCom->init_old = FLT_MAX; + } + + if (st->tcxonly) + { + st->p_bpf_noise_buf = NULL; + } + else + { + st->p_bpf_noise_buf = st->bpf_noise_buf; + } } + } - st->total_brate = total_brate; + st->total_brate = total_brate; - return; + return; } diff --git a/lib_dec/dec_higher_acelp_fx.c b/lib_dec/dec_higher_acelp_fx.c index af41df50854d6af54b035964a77fa72853d63c24..dc20741ad2233327faaac2b53f9dcb3ffd079afb 100644 --- a/lib_dec/dec_higher_acelp_fx.c +++ b/lib_dec/dec_higher_acelp_fx.c @@ -15,6 +15,7 @@ * transf_cdbk_dec() * Transform domain contribution decoding *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void transf_cdbk_dec_fx( Decoder_State *st_fx, /* i/o: decoder state structure */ const Word16 harm_flag_acelp,/* i : harmonic flag for higher rates ACELP */ @@ -238,6 +239,7 @@ void transf_cdbk_dec_fx( return; } +#endif /*==========================================================================*/ /* FUNCTION : Word16 gain_dequant_fx () */ @@ -262,6 +264,7 @@ void transf_cdbk_dec_fx( /*--------------------------------------------------------------------------*/ /* CALLED FROM : */ /*==========================================================================*/ +#ifdef IVAS_FLOAT_FIXED Word16 gain_dequant_fx( /* o: decoded gain */ Word16 index, /* i: quantization index */ const Word16 min_val, /* i: value of lower limit */ @@ -322,3 +325,4 @@ Word16 gain_dequant_fx( /* o: decoded gain */ return( gain ); } +#endif \ No newline at end of file diff --git a/lib_dec/dec_prm.c b/lib_dec/dec_prm.c index cf84280904bccbd895b98b5ed4a9c858db903fcd..f16965fa63e2b0f4476bfaa0c7b897cb82349542 100644 --- a/lib_dec/dec_prm.c +++ b/lib_dec/dec_prm.c @@ -329,6 +329,7 @@ void getTCXWindowing_ivas( * get LPC parameters *--------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void getLPCparam_ivas( Decoder_State *st, /* i/o: decoder memory state */ int16_t param_lpc[], /* o : LTP parameters */ @@ -402,6 +403,8 @@ void getLPCparam_ivas( return; } +#endif + #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * getTCXparam_ivas() diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index aa9170ca735ba5bfbd117d70f42235a127a1194d..c995f2a50df51f22bf70cc3b783d7093c0919c51 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -1489,7 +1489,7 @@ void decoder_tcx_noiseshaping_igf( * * TCX: TNS application *-------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void decoder_tcx_tns( Decoder_State *st, /* i/o: coder memory state */ const int16_t L_frame_glob, /* i : frame length */ @@ -1579,6 +1579,7 @@ void decoder_tcx_tns( return; } +#endif #ifdef IVAS_FLOAT_FIXED void decoder_tcx_tns_fx( diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 2b8d3209cf19d18d296e20a5010b8654ae5017b7..1c8b8ec1d0ebcabc6b8f3777bcbe5ee0e0e3f5d4 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3637,9 +3637,9 @@ void decoder_tcx_ivas_fx( decoder_tcx_noiseshaping_igf_fx( st, L_spec, L_frame, L_frameTCX, left_rect, x_fx, &x_e, &x_len, gainlpc2_fx, gainlpc2_e, &tmp_concealment_method, bfi ); - shift = Find_Max_Norm32( x_fx, N_MAX ) - 5; + shift = sub(Find_Max_Norm32( x_fx, N_MAX ) , 6); //6 -> guardbits// move16(); - Scale_sig32( x_fx, N_MAX, shift ); + Scale_sig32( x_fx, N_MAX, shift); x_e = sub( x_e, shift ); move16(); diff --git a/lib_dec/decision_matrix_dec.c b/lib_dec/decision_matrix_dec.c index 02f552450c0618dedc75758619f0f421ff4894d6..8f540d8fa872cfcbaaa003b3c31f914ca8691975 100644 --- a/lib_dec/decision_matrix_dec.c +++ b/lib_dec/decision_matrix_dec.c @@ -48,7 +48,7 @@ * Read ACELP signaling bits from the bitstream * Set extension layers *-----------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED void decision_matrix_dec( Decoder_State *st, /* i/o: decoder state structure */ int16_t *sharpFlag, /* o : formant sharpening flag */ @@ -567,3 +567,4 @@ void decision_matrix_dec( return; } +#endif \ No newline at end of file diff --git a/lib_dec/decision_matrix_dec_fx.c b/lib_dec/decision_matrix_dec_fx.c index 44b34f3fd7ea7b97fdf650602a42f23c98cdb470..bb2a0546e2745912d5cf5eca76922e081d2d83b9 100644 --- a/lib_dec/decision_matrix_dec_fx.c +++ b/lib_dec/decision_matrix_dec_fx.c @@ -18,7 +18,7 @@ * Read ACELP signaling bits from the bitstream * Set extension layers *-----------------------------------------------------------------*/ - +#ifdef IVAS_FLOAT_FIXED void decision_matrix_dec_fx( Decoder_State *st, /* i/o: decoder state structure */ Word16 *sharpFlag, /* o : formant sharpening flag */ @@ -709,3 +709,4 @@ void decision_matrix_dec_fx( return; } +#endif \ No newline at end of file diff --git a/lib_dec/dlpc_avq.c b/lib_dec/dlpc_avq.c index 6e161254c455d7c59313c752bf5f80c842ad9615..0a9dfe053e2c3200ed9d0189ee1343ff766b7b6e 100644 --- a/lib_dec/dlpc_avq.c +++ b/lib_dec/dlpc_avq.c @@ -46,6 +46,7 @@ * Variable bitrate multiple LPC un-quantizer *------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED int16_t dlpc_avq( int16_t *index, /* i : Quantization indices */ float *LSF_Q, /* o : Quantized LSF vectors */ @@ -321,3 +322,4 @@ int16_t decode_lpc_avq( return st->next_bit_pos - start_bit_pos; } +#endif \ No newline at end of file diff --git a/lib_dec/er_scale_syn.c b/lib_dec/er_scale_syn.c index 1a4cd333473432451e6ec407b14f1754d6b30f31..06947c5a41f889f9290151ffc49d12ab647333a3 100644 --- a/lib_dec/er_scale_syn.c +++ b/lib_dec/er_scale_syn.c @@ -47,7 +47,7 @@ * * Estimate damping factor *----------------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED float Damping_fact_flt( const int16_t coder_type, const int16_t nbLostCmpt, @@ -138,3 +138,4 @@ float Damping_fact_flt( return alpha; } +#endif \ No newline at end of file diff --git a/lib_dec/er_sync_exc.c b/lib_dec/er_sync_exc.c index 70b930f183a379e679bf424262b89e25e0a68644..f419be7642ed408eb5816e9e0ba4915f150d2100 100644 --- a/lib_dec/er_sync_exc.c +++ b/lib_dec/er_sync_exc.c @@ -56,6 +56,7 @@ *--------------------------------------------------------------------*/ /*! r: Index of the position of the minimum energy, that is the position i where filter(x[i-filterLength/2],...,x[i+(filterLength-filterLength/2)-1]) is at maximum. */ +#ifndef IVAS_FLOAT_FIXED static int16_t GetMinimumPosition( const float *x, /* i : input signal */ const int16_t length, /* i : length of the filter length used for the energy calculation */ @@ -333,3 +334,4 @@ void PulseResynchronization( return; } +#endif \ No newline at end of file diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 102dde8cd4bcfec0ecf32817b197ab426fc1b65a..7cdbfbc2bd30dc0bb7351790a10e9412f916f2cd 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -84,6 +84,7 @@ static void perform_noise_estimation_dec( const float *timeDomainInput, float *p * Create an instance of type FD_CNG *-------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED ivas_error createFdCngDec( HANDLE_FD_CNG_DEC *hFdCngDec ) { @@ -109,7 +110,7 @@ ivas_error createFdCngDec( return error; } - +#endif /*------------------------------------------------------------------- * initFdCngDec() diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index 22ae6ea998e66409cdfbb9815002b8dc4bbec608..290e0f5be3e84b2d14b4bd07332a54c1d9891452 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -44,6 +44,7 @@ const Word16 stages_37bits = FD_CNG_stages_37bits; Function: create an instance of type FD_CNG */ +#ifdef IVAS_FLOAT_FIXED ivas_error createFdCngDec_fx (HANDLE_FD_CNG_DEC *hFdCngDec) { HANDLE_FD_CNG_DEC hs; @@ -65,6 +66,7 @@ ivas_error createFdCngDec_fx (HANDLE_FD_CNG_DEC *hFdCngDec) *hFdCngDec = hs; return error; } +#endif #ifdef IVAS_FLOAT_FIXED void initFdCngDec_ivas_fx( @@ -183,7 +185,7 @@ void initFdCngDec_ivas_fx( Copy( st->lsp_old_fx, st->lspCNG_fx, M ); return; } -#endif + void initFdCngDec_fx( DEC_CORE_HANDLE st, /* i/o: decoder state structure */ Word16 scale @@ -294,7 +296,7 @@ void initFdCngDec_fx( return; } - +#endif /* configureFdCngDec_fx @@ -883,7 +885,7 @@ Word16 ApplyFdCng_fx ( #else if (st->element_mode == IVAS_CPE_MDCT && st->core != ACELP_CORE) { - float scf[SNS_NPTS]; + float scf[SNS_NPTS]; float scf_int[FDNS_NPTS]; float whitenend_noise_shape[L_FRAME16k]; int16_t inc, start_idx, stop_idx; @@ -2985,6 +2987,7 @@ void perform_noise_estimation_dec_ivas_fx( Returns: void */ +#ifdef IVAS_FLOAT_FIXED void FdCng_decodeSID_fx (HANDLE_FD_CNG_COM st, Decoder_State *corest) { Word16 i, N, index; @@ -3110,7 +3113,7 @@ void FdCng_decodeSID_fx (HANDLE_FD_CNG_COM st, Decoder_State *corest) } - +#endif /* noisy_speech_detection_fx @@ -3132,6 +3135,7 @@ void FdCng_decodeSID_fx (HANDLE_FD_CNG_COM st, Decoder_State *corest) void */ +#ifdef IVAS_FLOAT_FIXED void noisy_speech_detection_fx ( HANDLE_FD_CNG_DEC hFdCngDec,/* i/o: FD_CNG structure */ const Word16 vad, @@ -3240,8 +3244,9 @@ void noisy_speech_detection_fx ( return; } +#endif - +#ifdef IVAS_FLOAT_FIXED void generate_comfort_noise_dec_fx ( Word32 **bufferReal, /* o : matrix to real part of input bands */ @@ -3729,7 +3734,6 @@ generate_comfort_noise_dec_hf_fx ( } } - void generate_comfort_noise_dec_hf_ivas_fx( Word32 **bufferReal, /* o : matrix to real part of input bands */ Word32 **bufferImag, /* o : matrix to imaginary part of input bands */ @@ -3856,7 +3860,7 @@ void generate_comfort_noise_dec_hf_ivas_fx( return; } - +#endif /* @@ -3875,6 +3879,7 @@ void generate_comfort_noise_dec_hf_ivas_fx( void */ +#ifdef IVAS_FLOAT_FIXED void generate_masking_noise_fx ( Word16 *timeDomainBuffer, /* i/o : pointer to time domain output buffer 15Q0 */ Word16 Q, @@ -4059,6 +4064,7 @@ void generate_masking_noise_fx ( } } +#endif /*------------------------------------------------------------------- * generate_masking_noise_update_seed_fx() @@ -4067,6 +4073,7 @@ void generate_masking_noise_fx ( * not called based on signal statistics *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void generate_masking_noise_update_seed_fx ( HANDLE_FD_CNG_COM hFdCngCom /* i/o : pointer to FD_CNG_COM structure */ ) @@ -4094,11 +4101,12 @@ void generate_masking_noise_update_seed_fx ( return; } - +#endif /************************************************************ * Generate additional comfort noise (kind of noise filling) * ************************************************************/ +#ifdef IVAS_FLOAT_FIXED void generate_masking_noise_mdct_fx ( Word32 *mdctBuffer, /* i/o: time-domain signal */ Word16 *mdctBuffer_e, /* i/o: exponent time-domain signal */ @@ -4266,6 +4274,7 @@ void generate_masking_noise_mdct_fx ( } } +#endif #ifdef IVAS_CODE_CNG diff --git a/lib_dec/hf_synth.c b/lib_dec/hf_synth.c index 66b39ade42eb3b458aacf3dcf43fb0f81ca83a58..38aaab11ffe715db0edd2c8805e101619e797728 100644 --- a/lib_dec/hf_synth.c +++ b/lib_dec/hf_synth.c @@ -102,7 +102,7 @@ void hf_synth_init( } #endif - +#ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * hf_synth_amr_wb_init() * @@ -130,7 +130,7 @@ void hf_synth_amr_wb_init( return; } - +#endif #ifndef IVAS_FLOAT_FIXED /*-------------------------------------------------------------------* * hf_synth_amr_wb_reset() diff --git a/lib_dec/hq_core_dec.c b/lib_dec/hq_core_dec.c index 839d6b299d6e6d1babd598e8c2471242229d1b55..a1f61cf3c622fe3120e9e53ebad8b01df9daea08 100644 --- a/lib_dec/hq_core_dec.c +++ b/lib_dec/hq_core_dec.c @@ -42,12 +42,6 @@ #include "rom_com.h" #include "wmc_auto.h" #include "ivas_prot.h" -#ifdef IVAS_FLOAT_FIXED -#include "prot_fx1.h" -#include "prot_fx2.h" -#include "ivas_prot_fx.h" -#endif - /*-------------------------------------------------------------------------- * hq_core_dec() @@ -83,9 +77,7 @@ void hq_core_dec( int16_t index, left_rect, tcx_offsetFB, overlapFB, L_frameTCX; int16_t tcx_offset, overlap, L_frame, L_spec, fscaleFB; int16_t L_frameTCX_glob, L_frame_glob; -#ifndef IVAS_FLOAT_FIXED float acelp_zir[L_FRAME_MAX / 2]; -#endif int16_t encoderLookahead, encoderLookaheadFB; int16_t hq_recovery_flag; int16_t mdctWindowLength; @@ -152,17 +144,10 @@ void hq_core_dec( } } -#ifdef IVAS_FLOAT_FIXED - IF( hq_recovery_flag ) - { - acelp_plc_mdct_transition_fx( st ); - } -#else if ( hq_recovery_flag ) { acelp_plc_mdct_transition( st ); } -#endif /* subtract signaling bits */ num_bits -= st->next_bit_pos; @@ -324,88 +309,6 @@ void hq_core_dec( * Pre-echo reduction *--------------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED - IF( st->element_mode > EVS_MONO && ( core_switching_flag || hq_recovery_flag ) ) - { - // Float to fix code - Word32 t_audio_q_fx[L_FRAME48k_EXT]; /* Q12 */ - Word16 Q_audio = Q12; - Word16 E_audio = 31 - Q_audio; - Word16 wtda_audio_16_fx[2 * L_FRAME48k]; - Word16 acelp_zir_fx[L_FRAME_MAX / 2]; - Word16 output_fx[L_FRAME48k]; - Word16 synth_fx[L_FRAME48k]; - - Word16 Q_old_syn_Overl = -1; - //Word16 Q_old_Aq_12_8 = 12; - floatToFixed_arrL( t_audio_q, t_audio_q_fx, Q_audio, L_FRAME48k_EXT ); - floatToFixed_arr( hHQ_core->old_out, hHQ_core->old_out_fx, hHQ_core->Q_old_wtda, L_FRAME48k ); - floatToFixed_arr( hHQ_core->old_outLB, hHQ_core->old_out_LB_fx, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, Q_old_syn_Overl, L_FRAME32k / 2 ); - //floatToFixed_arr( st->old_Aq_12_8, st->old_Aq_12_8_fx, Q_old_Aq_12_8, M + 1 ); - - /* Initializations for TCX MDCT framework, to be used for switching frame */ - tcx_cfg = st->hTcxCfg; - L_frameTCX_glob = hTcxDec->L_frameTCX; - L_frame_glob = st->L_frame; - L_spec = hTcxDec->L_frameTCX; - st->fscale = sr2fscale( st->sr_core ); - fscaleFB = sr2fscale( st->output_Fs ); - encoderLookahead = ( L_LOOK_12k8 * st->fscale ) / FSCALE_DENOM; - encoderLookaheadFB = ( L_LOOK_12k8 * fscaleFB ) / FSCALE_DENOM; - mdctWindowLength = getMdctWindowLength( st->fscale ); - mdctWindowLengthFB = (int16_t) ( mdctWindowLength * st->output_Fs / st->sr_core ); - IF( core_switching_flag ) - { - tcx_cfg->tcx_last_overlap_mode = TRANSITION_OVERLAP; - tcx_cfg->tcx_curr_overlap_mode = FULL_OVERLAP; - } - ELSE - { - tcx_cfg->tcx_last_overlap_mode = ALDO_WINDOW; - tcx_cfg->tcx_curr_overlap_mode = ALDO_WINDOW; - st->last_core = HQ_CORE; /* Needed to decode non-transition frame */ - } - - init_tcx_window_cfg_fx( tcx_cfg, st->sr_core, st->output_Fs, st->L_frame, hTcxDec->L_frameTCX, mdctWindowLength, mdctWindowLengthFB, st->element_mode ); - - init_tcx_info_fx( st, L_frame_glob, L_frameTCX_glob, 0, st->bfi, &tcx_offset, &tcx_offsetFB, &L_frame, &L_frameTCX, &left_rect, &L_spec ); - - overlap = tcx_cfg->tcx_mdct_window_length; - overlapFB = tcx_cfg->tcx_mdct_window_lengthFB; - index = tcx_cfg->tcx_last_overlap_mode; - - /* LB synthesis */ - - IMDCT_fx( t_audio_q_fx, E_audio, hTcxDec->syn_Overl, hTcxDec->syn_Overl_TDAC, wtda_audio_16_fx, tcx_cfg->tcx_aldo_window_1, tcx_cfg->tcx_aldo_window_1_trunc, tcx_cfg->tcx_aldo_window_2, tcx_cfg->tcx_mdct_window_half, tcx_cfg->tcx_mdct_window_minimum, tcx_cfg->tcx_mdct_window_trans, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, - left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, 0, st->bfi, hHQ_core->old_out_LB_fx, &hHQ_core->Q_old_wtda_LB, st, 0, acelp_zir_fx ); - - Scale_sig( wtda_audio_16_fx + L_frame, overlap, Q1 ); - - Copy( wtda_audio_16_fx + ( overlap >> 1 ) - tcx_offset, output_fx, L_frame_glob ); // output Q - Q0 - - /* FB synthesis */ - - IMDCT_fx( t_audio_q_fx, E_audio, hTcxDec->syn_OverlFB, hTcxDec->syn_Overl_TDACFB, wtda_audio_16_fx, tcx_cfg->tcx_aldo_window_1_FB, tcx_cfg->tcx_aldo_window_1_FB_trunc, tcx_cfg->tcx_aldo_window_2_FB, tcx_cfg->tcx_mdct_window_halfFB, tcx_cfg->tcx_mdct_window_minimumFB, tcx_cfg->tcx_mdct_window_transFB, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, - left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, 0, st->bfi, hHQ_core->old_out_fx, &hHQ_core->Q_old_wtda, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir_fx ); - - Scale_sig( wtda_audio_16_fx + L_frameTCX, overlapFB, Q1 ); - - Copy( wtda_audio_16_fx + ( overlapFB >> 1 ) - tcx_offsetFB, synth_fx, L_frameTCX_glob ); - - IF( !core_switching_flag ) - { - st->last_core = ACELP_CORE; /* Restore last core */ - } - // Fixed to Float - fixedToFloat_arrL( t_audio_q_fx, t_audio_q, Q_audio, L_FRAME48k_EXT ); - //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, Q_old_syn_Overl, L_FRAME32k / 2 ); - fixedToFloat_arr( hHQ_core->old_out_LB_fx, hHQ_core->old_outLB, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - fixedToFloat_arr( hHQ_core->old_out_fx, hHQ_core->old_out, hHQ_core->Q_old_wtda, L_FRAME48k ); - fixedToFloat_arr( output_fx, output, 0, L_frame_glob ); - fixedToFloat_arr( synth_fx, synth, 0, L_frameTCX_glob ); - } -#else if ( st->element_mode > EVS_MONO && ( core_switching_flag || hq_recovery_flag ) ) { /* Initializations for TCX MDCT framework, to be used for switching frame */ @@ -440,14 +343,12 @@ void hq_core_dec( index = tcx_cfg->tcx_last_overlap_mode; /* LB synthesis */ - IMDCT( t_audio_q, hTcxDec->syn_Overl_float, hTcxDec->syn_Overl_TDAC_float, wtda_audio, tcx_cfg->tcx_aldo_window_1_trunc_flt, tcx_cfg->tcx_aldo_window_2_flt, tcx_cfg->tcx_mdct_window_half_flt, tcx_cfg->tcx_mdct_window_minimum_flt, tcx_cfg->tcx_mdct_window_trans_flt, tcx_cfg->tcx_mdct_window_half_length, tcx_cfg->tcx_mdct_window_min_length, index, MDCT_IV, left_rect, tcx_offset, overlap, L_frame, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frame_glob, 0, st->bfi, hHQ_core->old_outLB, 0, st, 0, acelp_zir ); mvr2r( wtda_audio + ( overlap >> 1 ) - tcx_offset, output, L_frame_glob ); /* FB synthesis */ - IMDCT( t_audio_q, hTcxDec->syn_OverlFB_float, hTcxDec->syn_Overl_TDACFB_float, wtda_audio, tcx_cfg->tcx_aldo_window_1_FB_trunc_flt, tcx_cfg->tcx_aldo_window_2_FB_flt, tcx_cfg->tcx_mdct_window_halfFB_flt, tcx_cfg->tcx_mdct_window_minimumFB_flt, tcx_cfg->tcx_mdct_window_transFB_flt, tcx_cfg->tcx_mdct_window_half_lengthFB, tcx_cfg->tcx_mdct_window_min_lengthFB, index, MDCT_IV, left_rect, tcx_offsetFB, overlapFB, L_frameTCX, L_frameTCX, max( L_frameTCX, L_spec ) >> 1, L_frameTCX_glob, 0, st->bfi, hHQ_core->old_out, 1, st, FSCALE_DENOM * L_frameTCX_glob / L_frame_glob, acelp_zir ); @@ -458,7 +359,6 @@ void hq_core_dec( st->last_core = ACELP_CORE; /* Restore last core */ } } -#endif else { if ( output_frame == L_FRAME8k || st->bfi == 0 ) @@ -475,33 +375,6 @@ void hq_core_dec( if ( st->element_mode > EVS_MONO ) { -#ifdef IVAS_FLOAT_FIXED - Word16 ener_match_fx; /* Q13 */ - Word32 t_audio_q_fx[L_FRAME48k_EXT]; /* Q12 */ - Word16 Q_audio = Q12; - Word32 wtda_audio_LB_fx[2 * L_FRAME16k]; - Word16 tmp, tmp_e; - floatToFixed_arrL( t_audio_q, t_audio_q_fx, Q_audio, L_FRAME48k_EXT ); - IF( st->bfi ) - { - /* Rough resampling, but reduces energy loss in case of switch to ACELP in first good frame */ - L_lerp_fx_q11( t_audio_q_fx, wtda_audio_LB_fx, st->L_frame, inner_frame ); - v_multc_fixed_16( t_audio_q_fx, ONE_IN_Q14, wtda_audio_LB_fx, st->L_frame ); - } - ELSE - { - /* LB synthesis for potential switch to ACELP */ - tmp = BASOP_Util_Divide1616_Scale( st->L_frame, output_frame, &tmp_e ); - tmp = Sqrt16( tmp, &tmp_e ); - ener_match_fx = shr( tmp, 2 - tmp_e ); // Q13 - - v_multc_fixed_16( t_audio_q_fx, ener_match_fx, t_audio_q_fx, inner_frame ); // Q - - Scale_sig32( t_audio_q_fx, inner_frame, Q2 ); - Inverse_Transform( t_audio_q_fx, &Q_audio, wtda_audio_LB_fx, is_transient, st->L_frame, inner_frame, st->element_mode ); - } - fixedToFloat_arrL( wtda_audio_LB_fx, wtda_audio_LB, Q_audio, 2 * L_FRAME16k ); -#else if ( st->bfi ) { /* Rough resampling, but reduces energy loss in case of switch to ACELP in first good frame */ @@ -515,7 +388,6 @@ void hq_core_dec( v_multc( t_audio_q, ener_match, t_audio_q, inner_frame ); inverse_transform( t_audio_q, wtda_audio_LB, is_transient, st->L_frame, inner_frame, st->element_mode ); } -#endif } if ( output_frame == L_FRAME8k ) @@ -558,27 +430,7 @@ void hq_core_dec( if ( st->element_mode > EVS_MONO ) { /* LB synthesis for potential switch to ACELP */ -#ifdef IVAS_FLOAT_FIXED - Word16 Q_audio = Q15; - Word32 wtda_audio_LB_fx[2 * L_FRAME16k]; - Word16 output_fx[L_FRAME48k]; - Word16 Q_output, Q_oldgapsynth, Q_wtda_audio; - Q_wtda_audio = Q_audio; - - Q_output = Q_factor_arr( output, L_FRAME48k ); - Q_oldgapsynth = Q_factor_arr( hHQ_core->oldgapsynth, L_FRAME48k ); - floatToFixed_arrL( wtda_audio_LB, wtda_audio_LB_fx, Q_wtda_audio, 2 * L_FRAME16k ); - floatToFixed_arr( output, output_fx, Q_output, L_FRAME48k ); - floatToFixed_arr( hHQ_core->old_outLB, hHQ_core->old_out_LB_fx, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); - floatToFixed_arr( hHQ_core->oldgapsynth, hHQ_core->oldgapsynth_fx, Q_oldgapsynth, L_FRAME32k ); - - window_ola_fx( wtda_audio_LB_fx, output_fx, &Q_output, hHQ_core->old_out_LB_fx, &hHQ_core->Q_old_wtda_LB, L_FRAME16k, st->hTcxCfg->tcx_last_overlap_mode, st->hTcxCfg->tcx_curr_overlap_mode, st->prev_bfi && !hHQ_core->ph_ecu_active, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth_fx ); - - fixedToFloat_arr( output_fx, output, Q_output, L_FRAME48k ); - fixedToFloat_arr( hHQ_core->old_out_LB_fx, hHQ_core->old_outLB, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); -#else window_ola( wtda_audio_LB, output, hHQ_core->old_outLB, L_FRAME16k, st->hTcxCfg->tcx_last_overlap_mode, st->hTcxCfg->tcx_curr_overlap_mode, st->prev_bfi && !hHQ_core->ph_ecu_active, hHQ_core->oldHqVoicing, hHQ_core->oldgapsynth ); -#endif } if ( ( !st->bfi && !st->prev_bfi ) || ( !( output_frame >= L_FRAME16k ) ) ) @@ -649,103 +501,7 @@ void hq_core_dec( * * Initialize HQ core state structure *-------------------------------------------------------------------*/ -#ifdef IVAS_FLOAT_FIXED -void HQ_core_dec_init_flt( - HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ -) -{ - - set_f( hHQ_core->old_out, 0, L_FRAME48k ); - set_f( hHQ_core->old_outLB, 0, L_FRAME32k ); - set_s( hHQ_core->old_is_transient, 0, 3 ); - -#ifdef IVAS_FLOAT_FIXED - hHQ_core->Q_old_wtda = 0; - hHQ_core->Q_old_wtda_LB = 0; -#endif - - hHQ_core->oldHqVoicing = 0; - -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->prev_noise_level, 0.0f, 2 ); -#endif - hHQ_core->prev_R = 0; -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->prev_coeff_out, 0, L_HQ_WB_BWE ); -#endif - set_s( hHQ_core->prev_SWB_peak_pos, 0, SPT_SHORTEN_SBNUM ); - - /* HQ GENERIC */ - hHQ_core->hq_generic_seed = RANDOM_INITSEED; - - hHQ_core->mem_norm[0] = 31; - set_s( hHQ_core->mem_norm + 1, 39, SFM_N_ENV_STAB - 1 ); - hHQ_core->mem_env_delta = 0; - hHQ_core->no_att_hangover = 0; - //hHQ_core->energy_lt = 300.0f; - - hHQ_core->HqVoicing = 0; -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->fer_samples, 0, L_FRAME48k ); - set_f( hHQ_core->prev_env, 0, SFM_N_WB ); - set_f( hHQ_core->prev_normq, 0, SFM_N_WB ); -#endif - hHQ_core->prev_hqswb_clas = HQ_NORMAL; - -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->last_ni_gain, 0, BANDS_MAX ); - set_f( hHQ_core->last_env, 0, BANDS_MAX ); -#endif - hHQ_core->last_max_pos_pulse = 0; - hHQ_core->prev_frm_hfe2 = 0; - hHQ_core->prev_stab_hfe2 = 0; #ifndef IVAS_FLOAT_FIXED - hHQ_core->prev_ni_ratio = 0.5f; - set_f( hHQ_core->prev_En_sb, 0.0f, NB_SWB_SUBBANDS ); -#endif - - - /*----------------------------------------------------------------------------------* - * HQ FEC - *----------------------------------------------------------------------------------*/ - -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->X_sav, 0.0f, PH_ECU_SPEC_SIZE ); -#endif - hHQ_core->num_p = 0; - hHQ_core->ph_ecu_active = 0; - hHQ_core->ni_seed_forfec = 0; - hHQ_core->last_fec = 0; - hHQ_core->ph_ecu_HqVoicing = 0; -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->oldgapsynth, 0.0f, L_FRAME48k ); - hHQ_core->env_stab = 0.75f; -#endif - hHQ_core->mem_norm_hqfec[0] = 31; - set_s( hHQ_core->mem_norm_hqfec + 1, 39, SFM_N_ENV_STAB - 1 ); - hHQ_core->mem_env_delta_hqfec = 0; -#ifndef IVAS_FLOAT_FIXED - hHQ_core->env_stab_plc = 0.0f; - set_f( hHQ_core->env_stab_state_p, 1.0f / NUM_ENV_STAB_PLC_STATES, NUM_ENV_STAB_PLC_STATES ); -#endif - hHQ_core->envstabplc_hocnt = 0; - -#ifndef IVAS_FLOAT_FIXED - set_f( hHQ_core->mag_chg_1st, 1.0f, LGW_MAX ); - set_f( hHQ_core->Xavg, 0.0f, LGW_MAX ); - hHQ_core->beta_mute = BETA_MUTE_FAC_INI_FLT; -#endif - - hHQ_core->time_offs = 0; - hHQ_core->ber_occured_in_pvq = 0; - - hHQ_core->last_hq_core_type = -1; - - reset_preecho_dec( hHQ_core ); - - return; -} -#else void HQ_core_dec_init_flt( HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ ) diff --git a/lib_dec/hq_core_dec_fx.c b/lib_dec/hq_core_dec_fx.c index a3d31ee09270015fc15d8546013b3bea209987d4..bc433d63068f7b6036da2adb6a969d9aae082915 100644 --- a/lib_dec/hq_core_dec_fx.c +++ b/lib_dec/hq_core_dec_fx.c @@ -1209,14 +1209,15 @@ void HQ_core_dec_init_fx( HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */ ) { - +#if 1 //TOBE Removed later + set_f( hHQ_core->old_out, 0, L_FRAME48k ); + set_f( hHQ_core->old_outLB, 0, L_FRAME32k ); +#endif set16_fx(hHQ_core->old_out_fx, 0, L_FRAME48k); set16_fx(hHQ_core->old_out_LB_fx, 0, L_FRAME32k); -#ifdef IVAS_FLOAT_FIXED set32_fx(hHQ_core->oldOut_fx, 0, L_FRAME48k); set32_fx(hHQ_core->old_outLB_fx, 0, L_FRAME32k); -#endif - hHQ_core->Q_old_wtda = 15; + hHQ_core->Q_old_wtda = 15; hHQ_core->Q_old_postdec = 0; hHQ_core->Q_old_wtda_LB = 0; hHQ_core->Q_old_out = 0; diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 332eef94e30d5ce808860de20825103a67984d01..9f74296f3c4dd0ed2e7523a5d61fda1e3c7f03e7 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -1225,9 +1225,6 @@ ivas_error init_decoder_ivas_fx( } /* HQ core initialization */ -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. - HQ_core_dec_init_flt( st_fx->hHQ_core ); -#endif HQ_core_dec_init_fx( st_fx->hHQ_core ); IF( EQ_16( st_fx->element_mode, EVS_MONO ) ) diff --git a/lib_dec/inov_dec.c b/lib_dec/inov_dec.c index 482d867d969f585b9727a63b70eb92fc1027870d..83b66adf8d7232c9e6b078e6910c5f9ddfed14f5 100644 --- a/lib_dec/inov_dec.c +++ b/lib_dec/inov_dec.c @@ -49,6 +49,7 @@ * Decode the algebraic innovation and do pitch sharpening *----------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void inov_decode( Decoder_State *st, /* i/o: decoder state structure */ const int32_t core_brate, /* i : core bitrate */ @@ -191,3 +192,4 @@ void inov_decode( return; } +#endif \ No newline at end of file diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index e25cfe2bc9cdaee908278048ef758c5f8c732aa9..2129ca3db0460ce6c371cb7d6dcc5ff13e35d9c5 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -233,7 +233,7 @@ ivas_error ivas_core_dec( L_tmp = L_shl( L_tmp, st->last_concealed_gain_syn_deemph_e ); st->hHQ_core->old_out_LB_fx[i] = extract_l( L_tmp ); // Q0 } - Copy_Scale_sig_16_32( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB_fx, st->L_frame, 11 ); + //Copy_Scale_sig_16_32( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB_fx, st->L_frame, 11 ); } set16_fx( voice_factors_fx[n], 0, NB_SUBFR16k ); @@ -272,8 +272,9 @@ ivas_error ivas_core_dec( Word16 ovl, fade_len; IF( sts[0]->L_frame != sts[0]->last_L_frame ) { + Copy_Scale_sig_16_32( sts[0]->hHQ_core->old_out_LB_fx, sts[0]->hHQ_core->old_outLB_fx, L_FRAME32k, Q11 - sts[0]->hHQ_core->Q_old_wtda_LB ); L_lerp_fx_q11( sts[0]->hHQ_core->old_outLB_fx, sts[0]->hHQ_core->old_outLB_fx, sts[0]->L_frame, sts[0]->last_L_frame ); - Copy_Scale_sig_32_16( sts[0]->hHQ_core->old_outLB_fx, sts[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, -11 ); + Copy_Scale_sig_32_16( sts[0]->hHQ_core->old_outLB_fx, sts[0]->hHQ_core->old_out_LB_fx, L_FRAME32k, sts[0]->hHQ_core->Q_old_wtda_LB - Q11); } IF( sts[0]->L_frame != L_FRAME16k ) { @@ -324,18 +325,6 @@ ivas_error ivas_core_dec( ivas_combined_format_brate_sanity( hCPE->element_brate, sts[0]->core, sts[0]->total_brate, &( sts[0]->core_brate ), &( sts[0]->inactive_coder_type_flag ), &tmps ); } -#ifndef TO_BE_REMOVED_CONVERSION - for (Word16 k = 0; k < n_channels; k++ ) - { - if ( sts[k]->hTcxDec != NULL ) - { - fixedToFloat_arr( sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->old_out, 0, L_FRAME48k ); - fixedToFloat_arr( sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->old_outLB, 0, L_FRAME32k ); - } - } - -#endif - /*------------------------------------------------------------------* * Core Decoding *-----------------------------------------------------------------*/ @@ -477,16 +466,18 @@ ivas_error ivas_core_dec( stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st, 1, last_element_mode, frameMode[n]); /* TCX decoder */ - Scale_sig(st->hPFstat->mem_stp, L_SUBFR, -Qsyn_temp); - Scale_sig(st->hPFstat->mem_pf_in, L_SUBFR, -Qsyn_temp); - Scale_sig32(st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub(st->hFdCngDec->msNoiseEst_exp, 27)); + Scale_sig( st->hPFstat->mem_stp, L_SUBFR, -Qsyn_temp ); + Scale_sig( st->hPFstat->mem_pf_in, L_SUBFR, -Qsyn_temp ); + Scale_sig32( st->hFdCngDec->msNoiseEst, NPART_SHAPING, sub( st->hFdCngDec->msNoiseEst_exp, 27 ) ); st->hFdCngDec->msNoiseEst_exp = 27; + Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, -st->hHQ_core->Q_old_wtda_LB ); + Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, -st->hHQ_core->Q_old_wtda ); stereo_tcx_core_dec_fx( st, frameMode[n], output_16_fx[n], synth_16_fx[n], pitch_buf_fx[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format ); + st->hHQ_core->Q_old_wtda_LB = st->hHQ_core->Q_old_wtda; + Copy_Scale_sig_16_32( output_16_fx[n], output_32_fx[n], L_FRAME48k, Q11 ); - Copy_Scale_sig_16_32(output_16_fx[n],output_32_fx[n],L_FRAME48k,Q11); - - stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st, 0, last_element_mode, frameMode[n]); + stereo_tcx_dec_mode_switch_reconf_To_fixed_2( st, 0, last_element_mode, frameMode[n] ); fixed_to_float_stereo_tcx_core_dec( st, output_16_fx[n] ); } @@ -495,17 +486,9 @@ ivas_error ivas_core_dec( /* HQ core decoder */ Q_synth = 0; Word16 Q_output = 0; - HQ_DEC_HANDLE hHQ_core; - - hHQ_core = st->hHQ_core; - - st->hHQ_core->Q_old_wtda = -1; - st->hHQ_core->Q_old_wtda_LB = -1; + //HQ_DEC_HANDLE hHQ_core; -#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED - floatToFixed_arr( hHQ_core->old_out, hHQ_core->old_out_fx, hHQ_core->Q_old_wtda, L_FRAME48k ); - floatToFixed_arr( hHQ_core->old_outLB, hHQ_core->old_out_LB_fx, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); -#endif + //hHQ_core = st->hHQ_core; ivas_hq_core_dec_fx( st, synth_16_fx[n], &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); @@ -518,8 +501,8 @@ ivas_error ivas_core_dec( Scale_sig(output_16_fx[n], L_FRAME48k, -Q_output); #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED - fixedToFloat_arr( hHQ_core->old_out_fx, hHQ_core->old_out, hHQ_core->Q_old_wtda, L_FRAME48k ); - fixedToFloat_arr( hHQ_core->old_out_LB_fx, hHQ_core->old_outLB, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); + //fixedToFloat_arr( hHQ_core->old_out_fx, hHQ_core->old_out, hHQ_core->Q_old_wtda, L_FRAME48k ); + //fixedToFloat_arr( hHQ_core->old_out_LB_fx, hHQ_core->old_outLB, hHQ_core->Q_old_wtda_LB, L_FRAME32k ); #endif } @@ -573,11 +556,14 @@ ivas_error ivas_core_dec( st->prev_Q_syn = st->Q_syn; - IF( st->hHQ_core ) - floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->Q_syn, L_FRAME32k ); + Scale_sig(st->hHQ_core->old_out_LB_fx, L_FRAME32k, st->Q_syn - st->hHQ_core->Q_old_wtda_LB); + Scale_sig(st->hHQ_core->old_out_fx, L_FRAME48k, st->Q_syn - st->hHQ_core->Q_old_wtda); + + //IF( st->hHQ_core ) + //floatToFixed_arr( st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->Q_syn, L_FRAME32k ); - IF( st->hHQ_core ) - floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->Q_syn, 960 ); + //IF( st->hHQ_core ) + //floatToFixed_arr( st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->Q_syn, 960 ); //if ( st->hTcxDec && st->hTcxDec->conLastFrameLevel_e < 0 ) //{ // st->hTcxDec->conLastFrameLevel_e = 0; @@ -607,6 +593,8 @@ ivas_error ivas_core_dec( #endif stereo_mdct_core_dec_fx( st_ivas, hCPE, output_32_fx, synth_16_fx ); + + #if 1 // Fix to float conversion //IF( st_ivas->hLsSetUpConversion ) //me2f_buf( st_ivas->hLsSetUpConversion->targetEnergyPrev_fx[0], st_ivas->hLsSetUpConversion->te_prev_exp, st_ivas->hLsSetUpConversion->targetEnergyPrev[0], st_ivas->hLsSetUpConversion->sfbCnt ); @@ -625,31 +613,32 @@ ivas_error ivas_core_dec( { for ( int p = 0; p < s_min( 62, sts[ch]->hFdCngDec->npart_shaping ); p++ ) { - sts[ch]->hFdCngDec->msNoiseEst_float[p] = ( (float) sts[ch]->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - sts[ch]->hFdCngDec->msNoiseEst_exp ) ) ); + //sts[ch]->hFdCngDec->msNoiseEst_float[p] = ( (float) sts[ch]->hFdCngDec->msNoiseEst[p] / ( 1u << ( 31 - sts[ch]->hFdCngDec->msNoiseEst_exp ) ) ); } } } - + st->hHQ_core->Q_old_wtda_LB = st->Q_syn; + st->hHQ_core->Q_old_wtda = st->Q_syn; if(st->Q_syn >= 0){ - for ( int p = 0; p < 640; p++ ) - { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); - } - - for ( int p = 0; p < 960; p++ ) - { - st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->Q_syn ); - } + //for ( int p = 0; p < 640; p++ ) + //{ + // st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] / ( 1u << st->Q_syn ); + //} + + //for ( int p = 0; p < 960; p++ ) + //{ + // st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] / ( 1u << st->Q_syn ); + //} }else{ - for ( int p = 0; p < 640; p++ ) - { - st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->Q_syn) ); - } - - for ( int p = 0; p < 960; p++ ) - { - st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->Q_syn) ); - } + //for ( int p = 0; p < 640; p++ ) + //{ + // st->hHQ_core->old_outLB[p] = (float) st->hHQ_core->old_out_LB_fx[p] * ( 1u << (-st->Q_syn) ); + //} + + //for ( int p = 0; p < 960; p++ ) + //{ + // st->hHQ_core->old_out[p] = (float) st->hHQ_core->old_out_fx[p] * ( 1u << (-st->Q_syn) ); + //} } } @@ -673,15 +662,19 @@ ivas_error ivas_core_dec( if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) { - f2me_buf_16( sts[0]->hHQ_core->old_out, sts[0]->hHQ_core->old_out_fx, &sts[0]->hHQ_core->exp_old_out, L_FRAME48k ); - f2me_buf_16( sts[1]->hHQ_core->old_out, sts[1]->hHQ_core->old_out_fx, &sts[1]->hHQ_core->exp_old_out, L_FRAME48k ); + sts[0]->hHQ_core->exp_old_out = 15 - sts[0]->hHQ_core->Q_old_wtda; + sts[1]->hHQ_core->exp_old_out = 15 - sts[1]->hHQ_core->Q_old_wtda; + // f2me_buf_16( sts[0]->hHQ_core->old_out, sts[0]->hHQ_core->old_out_fx, &sts[0]->hHQ_core->exp_old_out, L_FRAME48k ); + // f2me_buf_16( sts[1]->hHQ_core->old_out, sts[1]->hHQ_core->old_out_fx, &sts[1]->hHQ_core->exp_old_out, L_FRAME48k ); } updateBuffersForDmxMdctStereo_fx( hCPE, output_frame, output_32_fx[0], output_32_fx[1], synth_16_fx ); if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) { - me2f_buf_16( sts[0]->hHQ_core->old_out_fx, sts[0]->hHQ_core->exp_old_out, sts[0]->hHQ_core->old_out, L_FRAME48k ); - me2f_buf_16( sts[1]->hHQ_core->old_out_fx, sts[1]->hHQ_core->exp_old_out, sts[1]->hHQ_core->old_out, L_FRAME48k ); + sts[0]->hHQ_core->Q_old_wtda = 15 - sts[0]->hHQ_core->exp_old_out; + sts[1]->hHQ_core->Q_old_wtda = 15 - sts[1]->hHQ_core->exp_old_out; + //me2f_buf_16( sts[0]->hHQ_core->old_out_fx, sts[0]->hHQ_core->exp_old_out, sts[0]->hHQ_core->old_out, L_FRAME48k ); + //me2f_buf_16( sts[1]->hHQ_core->old_out_fx, sts[1]->hHQ_core->exp_old_out, sts[1]->hHQ_core->old_out, L_FRAME48k ); } #else @@ -744,7 +737,7 @@ ivas_error ivas_core_dec( if (st->hHQ_core != NULL) { st->hHQ_core->Q_old_postdec = 0; - st->hHQ_core->Q_old_wtda = 0; + //st->hHQ_core->Q_old_wtda = 0; } /*------------------fix-to-fix-end-----------------------*/ @@ -765,9 +758,12 @@ ivas_error ivas_core_dec( Scale_sig32(output_32_fx[n], L_FRAME48k, Q4 - Q11); - IF(st->hHQ_core != NULL) + IF( st->hHQ_core != NULL ) { - floatToFixed_arr(st->hHQ_core->old_out, st->hHQ_core->old_out_fx, 0, L_FRAME48k); + Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, -st->hHQ_core->Q_old_wtda ); + st->hHQ_core->Q_old_wtda = 0; + + //floatToFixed_arr(st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_wtda, L_FRAME48k); } /*size of synth is choosen as delay comp to start with*/ @@ -888,10 +884,10 @@ ivas_error ivas_core_dec( #else Scale_sig(synth_16_fx[n], L_FRAME48k, negate(Q_synth)); #endif - IF(st->hHQ_core != NULL) { - fixedToFloat_arr(st->hHQ_core->old_out_fx, st->hHQ_core->old_out, 0, L_FRAME48k); + //st->hHQ_core->Q_old_wtda = 0; + //fixedToFloat_arr(st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_wtda, L_FRAME48k); } @@ -1291,34 +1287,38 @@ ivas_error ivas_core_dec( { if (hCPE->hCoreCoder[ch_ind]->hHQ_core != NULL) { - FOR(int ind = 0; ind < L_FRAME32k; ind++) - { - hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB_fx[ind] = (Word32)(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB[ind] * (1 << 11)); - } - FOR(int ind = 0; ind < L_FRAME48k; ind++) - { - hCPE->hCoreCoder[ch_ind]->hHQ_core->oldOut_fx[ind] = (Word32)(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out[ind] * (1 << 11)); - } + Copy_Scale_sig_16_32(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out_LB_fx, hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB_fx, L_FRAME32k, Q11 - hCPE->hCoreCoder[ch_ind]->hHQ_core->Q_old_wtda_LB); + //FOR(int ind = 0; ind < L_FRAME32k; ind++) + //{ + // hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB_fx[ind] = (Word32)(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB[ind] * (1 << 11)); + //} + Copy_Scale_sig_16_32(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out_fx, hCPE->hCoreCoder[ch_ind]->hHQ_core->oldOut_fx, L_FRAME48k, Q11 - hCPE->hCoreCoder[ch_ind]->hHQ_core->Q_old_wtda); + //FOR(int ind = 0; ind < L_FRAME48k; ind++) + //{ + // hCPE->hCoreCoder[ch_ind]->hHQ_core->oldOut_fx[ind] = (Word32)(hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out[ind] * (1 << 11)); + //} } } } } - if (hSCE != NULL) + if ( hSCE != NULL ) { - if (hSCE->hCoreCoder[0] != NULL) - { - if (hSCE->hCoreCoder[0]->hHQ_core != NULL) + if ( hSCE->hCoreCoder[0] != NULL ) { - FOR(int ind = 0; ind < L_FRAME32k; ind++) - { - hSCE->hCoreCoder[0]->hHQ_core->old_outLB_fx[ind] = (Word32)(hSCE->hCoreCoder[0]->hHQ_core->old_outLB[ind] * (1 << 11)); - } - FOR(int ind = 0; ind < L_FRAME48k; ind++) - { - hSCE->hCoreCoder[0]->hHQ_core->oldOut_fx[ind] = (Word32)(hSCE->hCoreCoder[0]->hHQ_core->old_out[ind] * (1 << 11)); - } + if ( hSCE->hCoreCoder[0]->hHQ_core != NULL ) + { + Copy_Scale_sig_16_32( hSCE->hCoreCoder[0]->hHQ_core->old_out_LB_fx, hSCE->hCoreCoder[0]->hHQ_core->old_outLB_fx, L_FRAME32k, Q11 - hSCE->hCoreCoder[0]->hHQ_core->Q_old_wtda_LB ); + /*FOR( int ind = 0; ind < L_FRAME32k; ind++ ) + { + hSCE->hCoreCoder[0]->hHQ_core->old_outLB_fx[ind] = (Word32) ( hSCE->hCoreCoder[0]->hHQ_core->old_outLB[ind] * ( 1 << 11 ) ); + }*/ + Copy_Scale_sig_16_32( hSCE->hCoreCoder[0]->hHQ_core->old_out_fx, hSCE->hCoreCoder[0]->hHQ_core->oldOut_fx, L_FRAME48k, Q11 - hSCE->hCoreCoder[0]->hHQ_core->Q_old_wtda ); + /*FOR( int ind = 0; ind < L_FRAME48k; ind++ ) + { + hSCE->hCoreCoder[0]->hHQ_core->oldOut_fx[ind] = (Word32) ( hSCE->hCoreCoder[0]->hHQ_core->old_out[ind] * ( 1 << 11 ) ); + }*/ + } } - } } Word16 exp_max = 0; @@ -1418,50 +1418,17 @@ ivas_error ivas_core_dec( Scale_sig( st->delay_buf_out_fx, NS2SA( st->output_Fs, DELAY_CLDFB_NS ), -exp_max ); -#ifdef IVAS_FLOAT_FIXED - - if ( hCPE != NULL ) - { + } /* n_channels loop */ - FOR( int ch_ind = 0; ch_ind < n_channels; ch_ind++ ) - { - if ( hCPE->hCoreCoder[ch_ind] != NULL ) - { - if ( hCPE->hCoreCoder[ch_ind]->hHQ_core != NULL ) - { - FOR( int ind = 0; ind < L_FRAME32k; ind++ ) - { - hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB[ind] = (float) hCPE->hCoreCoder[ch_ind]->hHQ_core->old_outLB_fx[ind] / (float) ( 1 << 11 ); - } - FOR( int ind = 0; ind < L_FRAME48k; ind++ ) - { - hCPE->hCoreCoder[ch_ind]->hHQ_core->old_out[ind] = (float) hCPE->hCoreCoder[ch_ind]->hHQ_core->oldOut_fx[ind] / (float) ( 1 << 11 ); - } - } - } - } - } - if ( hSCE != NULL ) + for ( Word16 k = 0; k < n_channels; k++ ) + { + if ( sts[k]->hHQ_core != NULL ) { - if ( hSCE->hCoreCoder[0] != NULL ) - { - if ( hSCE->hCoreCoder[0]->hHQ_core != NULL ) - { - FOR( int ind = 0; ind < L_FRAME32k; ind++ ) - { - hSCE->hCoreCoder[0]->hHQ_core->old_outLB[ind] = (float) hSCE->hCoreCoder[0]->hHQ_core->old_outLB_fx[ind] / (float) ( 1 << 11 ); - } - FOR( int ind = 0; ind < L_FRAME48k; ind++ ) - { - hSCE->hCoreCoder[0]->hHQ_core->old_out[ind] = (float) hSCE->hCoreCoder[0]->hHQ_core->oldOut_fx[ind] / (float) ( 1 << 11 ); - } - } - } + fixedToFloat_arr( sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); + //fixedToFloat_arr( sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); } -#endif - } /* n_channels loop */ - + } pop_wmops(); return error; diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 2fa7507558e3c1dd31b481535fed30b5cb06bcfd..26cefab728edc69914e6e783133a7ac1105d1225 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -545,10 +545,10 @@ ivas_error ivas_cpe_dec_fx( Word16 k; for ( k = 0; k < n_channels; k++ ) { - if ( sts[k]->hTcxDec != NULL ) + if ( sts[k]->hHQ_core != NULL ) { - floatToFixed_arr( sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->old_out_fx, 0, L_FRAME48k ); - floatToFixed_arr( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_out_LB_fx, 0, L_FRAME32k ); + floatToFixed_arr( sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); + floatToFixed_arr( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); floatToFixed_arrL( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_outLB_fx, 11, L_FRAME32k ); } } @@ -557,6 +557,15 @@ ivas_error ivas_cpe_dec_fx( { return error; } + + for ( k = 0; k < n_channels; k++ ) + { + if ( sts[k]->hHQ_core != NULL ) + { + fixedToFloat_arr( sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); + fixedToFloat_arr( sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); + } + } } IF( st_ivas->hMCT ) @@ -581,10 +590,10 @@ ivas_error ivas_cpe_dec_fx( Word16 k; for ( k = 0; k < n_channels; k++ ) { - if ( sts[k]->hTcxDec != NULL ) + if ( sts[k]->hHQ_core != NULL ) { - floatToFixed_arr( sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->old_out_fx, 0, L_FRAME48k ); - floatToFixed_arr( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_out_LB_fx, 0, L_FRAME32k ); + floatToFixed_arr( sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); + floatToFixed_arr( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); floatToFixed_arrL( sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->old_outLB_fx, 11, L_FRAME32k ); } } @@ -597,6 +606,15 @@ ivas_error ivas_cpe_dec_fx( return error; } + for ( k = 0; k < n_channels; k++ ) + { + if ( sts[k]->hHQ_core != NULL ) + { + fixedToFloat_arr( sts[k]->hHQ_core->old_out_fx, sts[k]->hHQ_core->old_out, sts[k]->hHQ_core->Q_old_wtda, L_FRAME48k ); + fixedToFloat_arr( sts[k]->hHQ_core->old_out_LB_fx, sts[k]->hHQ_core->old_outLB, sts[k]->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); + } + } + // Scaling of DFT's Word16 shift; Word32 tmp1, tmp2; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 039e42cfab5b832f6744b0b3b9b4aa40085cb135..7be2449801e98ca1d8a524d00431643779c18b24 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1766,9 +1766,6 @@ static ivas_error ivas_mc_dec_reconfig( } /* HQ core initialization */ -#if 1/*TODO: To be removed later*/ - HQ_core_dec_init_flt( st->hHQ_core ); -#endif HQ_core_dec_init_fx( st->hHQ_core ); } diff --git a/lib_dec/ivas_sce_dec_fx.c b/lib_dec/ivas_sce_dec_fx.c index c49a1fac37fce3ec0b88fbc139f688e6e4c86c9f..139edc693595cdf7c9e104e1f63e5106a8855176 100644 --- a/lib_dec/ivas_sce_dec_fx.c +++ b/lib_dec/ivas_sce_dec_fx.c @@ -237,10 +237,10 @@ ivas_error ivas_sce_dec_fx( * Decoder *----------------------------------------------------------------*/ #ifndef TO_BE_REMOVED_CONVERSION - if (st->hTcxDec != NULL) + if (st->hHQ_core != NULL) { - floatToFixed_arr(st->hHQ_core->old_out, st->hHQ_core->old_out_fx, 0, L_FRAME48k); - floatToFixed_arr(st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, 0, L_FRAME32k); + floatToFixed_arr(st->hHQ_core->old_out, st->hHQ_core->old_out_fx, st->hHQ_core->Q_old_wtda, L_FRAME48k); + floatToFixed_arr(st->hHQ_core->old_outLB, st->hHQ_core->old_out_LB_fx, st->hHQ_core->Q_old_wtda_LB, L_FRAME32k); floatToFixed_arrL(st->hHQ_core->old_outLB, st->hHQ_core->old_outLB_fx, 11, L_FRAME32k); } #endif @@ -251,6 +251,12 @@ ivas_error ivas_sce_dec_fx( return error; } + IF ( st->hHQ_core != NULL ) + { + fixedToFloat_arr( st->hHQ_core->old_out_fx, st->hHQ_core->old_out, st->hHQ_core->Q_old_wtda, L_FRAME48k ); + fixedToFloat_arr( st->hHQ_core->old_out_LB_fx, st->hHQ_core->old_outLB, st->hHQ_core->Q_old_wtda_LB, L_FRAME32k ); + } + IF( st_ivas->sba_dirac_stereo_flag && ( GT_32( st->core_brate, SID_2k40 ) || EQ_16( st->cng_type, LP_CNG ) ) ) { /* skip addition of ACELP BWE for now, will be done after upmix */ diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 5215ba636e14bb399bde44374f8f40783447d89d..207232428e0c7a2ed680a3786b16df1520a750f7 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -456,7 +456,12 @@ void stereo_mdct_core_dec_fx( IF(sts[ch]->hFdCngDec && sts[ch]->hFdCngDec->hFdCngCom) { s = getScaleFactor32(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); - Scale_sig32(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, s); + IF(GT_16(s, sub(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4))) + { + s = sub(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, 4); + move16(); + } + scale_sig32(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, s); sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(sts[ch]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, s); } IF(sts[ch]->hFdCngDec && sts[ch]->hFdCngDec->hFdCngCom) { diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 36689712de0b314c9b58ae32ca42a4541be81c8b..55f04691e76008390f7d6fb97e9130c58f24a3e9 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -191,9 +191,6 @@ static ivas_error allocate_CoreCoder_TCX_fx( } HQ_core_dec_init_fx( st->hHQ_core ); -#if 1 // TODO: To be removed later - HQ_core_dec_init_flt( st->hHQ_core ); -#endif } IF ( st->hIGFDec == NULL ) @@ -1402,9 +1399,6 @@ ivas_error stereo_memory_dec_fx( } HQ_core_dec_init_fx( st->hHQ_core ); -#if 1 // TODO: to be removed later - HQ_core_dec_init_flt( st->hHQ_core ); -#endif } /* allocate TD CNG handle */ diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 105e3349913ba96e7936c64d4a83489cc29b9ece..45b8bbcfc1003ef004e741d4d21f8a4981b76cac 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -144,10 +144,10 @@ typedef struct float msNoiseFloor_float[NPART_SHAPING]; /* Estimated noise floor */ #endif Word16 msNoiseFloor[NPART_SHAPING]; /* Estimated noise floor */ - +#ifndef IVAS_FLOAT_FIXED float msNoiseEst_float[NPART_SHAPING]; /* Estimated noise level */ +#endif Word32 msNoiseEst[NPART_SHAPING]; /* Estimated noise level */ - Word16 msNoiseEst_exp; #ifndef IVAS_FLOAT_FIXED float msLogPeriodog_float[NPART_SHAPING]; /* Periodogram */ @@ -335,8 +335,9 @@ typedef struct Word16 * spectralData; Word16 spectralData_exp; - +#ifndef IVAS_FLOAT_FIXED float *scaleFactors_float; +#endif Word16 * scaleFactors; Word16 * scaleFactors_exp; @@ -611,15 +612,17 @@ typedef struct tcx_ltp_dec_structure int16_t tcxltp_pitch_int; int16_t tcxltp_pitch_fr; - +#ifndef IVAS_FLOAT_FIXED float tcxltp_mem_in_float[TCXLTP_MAX_DELAY]; +#endif Word16 tcxltp_mem_in[TCXLTP_MAX_DELAY]; Word32 tcxltp_mem_in_32[TCXLTP_MAX_DELAY]; #ifdef IVAS_FLOAT_FIXED Word16 exp_tcxltp_mem_in; #endif - +#ifndef IVAS_FLOAT_FIXED float tcxltp_mem_out_float[L_FRAME48k]; +#endif Word16 tcxltp_mem_out[L_FRAME48k]; Word32 tcxltp_mem_out_32[L_FRAME48k]; #ifdef IVAS_FLOAT_FIXED @@ -657,8 +660,9 @@ typedef struct tcx_dec_structure Word32 tcxltp_second_last_pitch; Word32 tcxltp_third_last_pitch; - +#ifndef IVAS_FLOAT_FIXED float tcxltp_last_gain_unmodified_float; +#endif Word16 tcxltp_last_gain_unmodified; int16_t tcx_hm_LtpPitchLag; @@ -930,8 +934,9 @@ typedef struct ld_music_postfilt_structure float LDm_bckr_noise[MBANDS_GN_LD]; /* LD music post-filter - background noise estimation per critical band */ #endif Word32 LDm_bckr_noise_fx[MBANDS_GN_LD]; /* LD music post-filter - background noise estimation per critical band */ - +#ifndef IVAS_FLOAT_FIXED float filt_lfE[DCT_L_POST]; +#endif Word16 filt_lfE_fx[DCT_L_POST]; int16_t last_nonfull_music; @@ -2055,33 +2060,48 @@ typedef struct pvq_dec_structure typedef struct amrwb_io_dec_structure { +#ifndef IVAS_FLOAT_FIXED float past_qua_en[GAIN_PRED_ORDER]; /* gain quantization memory (used also in AMR-WB IO mode) */ +#endif Word16 past_qua_en_fx[GAIN_PRED_ORDER]; /* gain quantization memory (used also in AMR-WB IO mode) */ +#ifndef IVAS_FLOAT_FIXED float prev_r; /* HF BWE - previous sub-frame gain */ +#endif Word16 prev_r_fx; /* HF BWE - previous sub-frame gain */ - + +#ifndef IVAS_FLOAT_FIXED float fmerit_w_sm; /* HF BWE - fmerit parameter memory */ - Word16 fmerit_w_sm_fx; /* HF BWE - fmerit parameter memory */ - +#endif + Word16 fmerit_w_sm_fx; /* HF BWE - fmerit parameter memory */ + int16_t frame_count; /* HF BWE - frame count */ Word16 frame_count_fx; /* HF BWE - frame count */ - +#ifndef IVAS_FLOAT_FIXED float ne_min; /* HF BWE - minimum Noise gate - short-term energy */ - Word16 ne_min_fx; /* HF BWE - minimum Noise gate - short-term energy */ - +#endif + Word16 ne_min_fx; /* HF BWE - minimum Noise gate - short-term energy */ + +#ifndef IVAS_FLOAT_FIXED float fmerit_m_sm; /* HF BWE - memory of fmerit_m param */ - Word16 fmerit_m_sm_fx; /* HF BWE - memory of fmerit_m param */ - +#endif + Word16 fmerit_m_sm_fx; /* HF BWE - memory of fmerit_m param */ + +#ifndef IVAS_FLOAT_FIXED float voice_fac_amr_wb_hf_float; /* HF BWE - voice factor */ - Word16 voice_fac_amr_wb_hf; /* HF BWE - voice factor */ - +#endif + Word16 voice_fac_amr_wb_hf; /* HF BWE - voice factor */ + +#ifndef IVAS_FLOAT_FIXED float unvoicing; /* HF BWE - unvoiced parameter */ - Word16 unvoicing_fx; /* HF BWE - unvoiced parameter */ - +#endif + Word16 unvoicing_fx; /* HF BWE - unvoiced parameter */ + +#ifndef IVAS_FLOAT_FIXED float unvoicing_sm; /* HF BWE - smoothed unvoiced parameter */ - Word16 unvoicing_sm_fx; /* HF BWE - smoothed unvoiced parameter */ - +#endif + Word16 unvoicing_sm_fx; /* HF BWE - smoothed unvoiced parameter */ + int16_t unvoicing_flag; /* HF BWE - unvoiced flag */ Word16 unvoicing_flag_fx; /* HF BWE - unvoiced flag */ @@ -2090,30 +2110,38 @@ typedef struct amrwb_io_dec_structure int16_t start_band_old; /* HF BWE - previous start point for copying frequency band */ Word16 start_band_old_fx; /* HF BWE - previous start point for copying frequency band */ - +#ifndef IVAS_FLOAT_FIXED float OptCrit_old; /* HF BWE - previous criterion value for deciding the start point */ - Word32 OptCrit_old_fx; /* HF BWE - previous criterion value for deciding the start point */ - +#endif + Word32 OptCrit_old_fx; /* HF BWE - previous criterion value for deciding the start point */ /* Improvement of unvoiced and audio signals in AMR-WB IO mode */ int16_t UV_cnt; /* number of consecutives frames classified as UV */ Word16 UV_cnt_fx; /* number of consecutives frames classified as UV */ - +#ifndef IVAS_FLOAT_FIXED float LT_UV_cnt; /* long-term consecutives frames classified as UV */ - Word16 LT_UV_cnt_fx; /* long-term consecutives frames classified as UV */ - +#endif + Word16 LT_UV_cnt_fx; /* long-term consecutives frames classified as UV */ + +#ifndef IVAS_FLOAT_FIXED float Last_ener; /* last_energy frame */ - Word16 Last_ener_fx; /* last_energy frame */ - +#endif + Word16 Last_ener_fx; /* last_energy frame */ + +#ifndef IVAS_FLOAT_FIXED float lt_diff_etot[MAX_LT]; /* stability estimation - long-term total energy variation */ - Word16 lt_diff_etot_fx[MAX_LT]; /* stability estimation - long-term total energy variation */ - +#endif + Word16 lt_diff_etot_fx[MAX_LT]; /* stability estimation - long-term total energy variation */ + +#ifndef IVAS_FLOAT_FIXED float old_Aq[NB_SUBFR * ( M + 1 )]; /* old LPC filter coefficient */ - Word16 old_Aq_fx[68]; /* old LPC filter coefficient */ - - float lt_voice_fac; /* average voice factor over 4 sub-frames */ - Word16 lt_voice_fac_fx; /* average voice factor over 4 sub-frames */ +#endif + Word16 old_Aq_fx[68]; /* old LPC filter coefficient */ +#ifndef IVAS_FLOAT_FIXED + float lt_voice_fac; /* average voice factor over 4 sub-frames */ +#endif + Word16 lt_voice_fac_fx; /* average voice factor over 4 sub-frames */ } AMRWB_IO_DEC_DATA, *AMRWB_IO_DEC_HANDLE; @@ -2819,8 +2847,9 @@ typedef struct Decoder_State #ifndef IVAS_FLOAT_FIXED float *acelp_zir; #endif // !IVAS_FLOAT_FIXED - +#ifndef IVAS_FLOAT_FIXED float syn_float[M + 1]; +#endif Word16 syn[M + 1]; int16_t bpf_gain_param; /* bass post-filter gain factor parameter (0->noBpf)*/ diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index 01e97442fda9db11ea2840b6a531df04e6a3fa7a..adc92af830fc53e5f82ee60b8cabc155c3347735 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -413,7 +413,7 @@ static void ivas_binaural_reverb_setReverbTimes_fx( tmp = BASOP_Util_Divide3232_Scale(L_deposit_h(tmp), L_deposit_h(hReverb->numBins), &exp); exp = add( exp, sub( tmp_exp, 15) ); L_tmp = Mpy_32_16_1(output_Fs, tmp); - binCenterFreq_exp = sub(31, exp); + binCenterFreq_exp = add(31, exp); binCenterFreq_fx = L_shr(L_tmp, 1); // divide by 2 IF ( EQ_16( bin, 0 ) ) { @@ -498,7 +498,7 @@ static void ivas_binaural_reverb_setReverbTimes_fx( scale = norm_l(hReverb->loopBufLength[bin]); tmp_mul = L_shl(hReverb->loopBufLength[bin], scale); L_tmp = BASOP_Util_Log2( attenuationFactorPerSample_fx ); - L_tmp = L_add(L_tmp, L_shl( attenuationFactorPerSample_exp, 25)); + L_tmp = L_add(L_tmp, L_shl( (Word32)attenuationFactorPerSample_exp, 25)); L_tmp = Mpy_32_32(L_tmp, tmp_mul); hReverb->loopAttenuationFactor_fx[bin] = BASOP_util_Pow2(L_tmp, 6 + 31 - scale, &exp); hReverb->loopAttenuationFactor_fx[bin] = L_shl(hReverb->loopAttenuationFactor_fx[bin], exp); // making as Q31 diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 4c5c7da2e896410a2a2d959b7f666ab61a1748da..c2d84fab9e533804cbdce763ede5fead36bd68fb 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -3359,8 +3359,8 @@ void SHrotmatgen_fx( d = ( m == 0 ) ? 1 : 0; absm = (Word16) abs( m ); - sql2mm2 = square_root30_q12[imult1616(shl(l, 1), sub(shl(l, 1), 1))]; - sqdabsm = square_root30_q12[imult1616((1 + d), imult1616(sub(add( l, absm), 1), add(l, absm)))]; + sql2mm2 = square_root30_q12[sub( imult1616(l, l), imult1616(m, m))]; + sqdabsm = square_root30_q12[imult1616(add(1, d), imult1616(sub(add( l, absm), 1), add(l, absm)))]; sqlabsm = square_root30_q12[imult1616( sub( l, sub( absm, 1 ) ), sub( l, absm ) )]; FOR ( n = -l; n <= l; n++ ) @@ -3417,7 +3417,7 @@ void SHrotmatgen_fx( } } - band_idx = add( shl( l, 1 ), 1 ); + band_idx = add( band_idx, add( shl( l, 1 ), 1 ) ); } return;