diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index 4199156fb0b553801ce80d91a4ac057f8f985ec9..4dcfa932cbbdbdf99a92646dc2e1be5683d6d970 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -302,17 +302,17 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( IF( st->hTcxDec ) { - st->hTcxDec->Q_old_syn_Overl = Q_factor_arr( st->hTcxDec->old_syn_Overl_float, L_FRAME32k / 2 ) - 1; - st->hTcxDec->Q_syn_Overl_TDAC = Q_factor_arr( st->hTcxDec->syn_Overl_TDAC_float, L_FRAME32k / 2 ) - 1; - st->hTcxDec->Q_syn_Overl = Q_factor_arr( st->hTcxDec->syn_Overl_float, L_FRAME32k / 2 ) - 1; - st->hTcxDec->Q_syn_Overl_TDACFB = Q_factor_arr( st->hTcxDec->syn_Overl_TDACFB_float, L_FRAME32k / 2 ); + //st->hTcxDec->Q_old_syn_Overl = Q_factor_arr( st->hTcxDec->old_syn_Overl_float, L_FRAME32k / 2 ) - 1; + //st->hTcxDec->Q_syn_Overl_TDAC = Q_factor_arr( st->hTcxDec->syn_Overl_TDAC_float, L_FRAME32k / 2 ) - 1; + //st->hTcxDec->Q_syn_Overl = Q_factor_arr( st->hTcxDec->syn_Overl_float, L_FRAME32k / 2 ) - 1; + //st->hTcxDec->Q_syn_Overl_TDACFB = Q_factor_arr( st->hTcxDec->syn_Overl_TDACFB_float, L_FRAME32k / 2 ); //st->hTcxDec->Q_syn_OverlFB = Q_factor_arr( st->hTcxDec->syn_OverlFB_float, L_FRAME_MAX / 2 ); Q_old_synth = Q_syn; //Q_synth_history = Q_factor_arr( st->hTcxDec->synth_history, L_PROT48k + L_FRAME_MAX ); - floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); - floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->Q_syn_Overl_TDAC, L_FRAME32k / 2 ); - floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->hTcxDec->Q_syn_Overl, L_FRAME32k / 2 ); - floatToFixed_arr( st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->Q_syn_Overl_TDACFB, L_FRAME_MAX / 2 ); + //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); + //floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->Q_syn_Overl_TDAC, L_FRAME32k / 2 ); + //floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->hTcxDec->Q_syn_Overl, L_FRAME32k / 2 ); + //floatToFixed_arr( st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->Q_syn_Overl_TDACFB, L_FRAME_MAX / 2 ); //floatToFixed_arr( st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->hTcxDec->Q_syn_OverlFB, L_FRAME_MAX / 2 ); //floatToFixed_arr( st->hTcxDec->old_synth_float, st->hTcxDec->old_synth, Q_old_synth, OLD_SYNTH_INTERNAL_DEC ); //floatToFixed_arr( st->hTcxDec->synth_history, st->hTcxDec->synth_history_fx, Q_synth_history, L_PROT48k + L_FRAME_MAX ); @@ -401,12 +401,12 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed( IF( st->hTcxDec ) { Q_old_synth = Q_syn; - Q_synth_history = Q_factor_arr( st->hTcxDec->synth_history, L_PROT48k + L_FRAME_MAX ); - st->hTcxDec->Q_old_syn_Overl = Q_factor_arr( st->hTcxDec->old_syn_Overl_float, L_FRAME32k / 2 ) - 1; - fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); - fixedToFloat_arr( st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->Q_syn_Overl_TDAC, 320 ); - fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->hTcxDec->Q_syn_Overl, 320 ); - fixedToFloat_arr( st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->Q_syn_Overl_TDACFB, 480 ); + //Q_synth_history = Q_factor_arr( st->hTcxDec->synth_history, L_PROT48k + L_FRAME_MAX ); + //st->hTcxDec->Q_old_syn_Overl = Q_factor_arr( st->hTcxDec->old_syn_Overl_float, L_FRAME32k / 2 ) - 1; + //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); + //fixedToFloat_arr( st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->Q_syn_Overl_TDAC, 320 ); + //fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->hTcxDec->Q_syn_Overl, 320 ); + //fixedToFloat_arr( st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->Q_syn_Overl_TDACFB, 480 ); //fixedToFloat_arr( st->hTcxDec->syn_OverlFB, st->hTcxDec->syn_OverlFB_float, st->hTcxDec->Q_syn_OverlFB, 480 ); //fixedToFloat_arr( st->hTcxDec->old_synth, st->hTcxDec->old_synth_float, Q_old_synth, OLD_SYNTH_INTERNAL_DEC ); //fixedToFloat_arr( st->hTcxDec->synth_history_fx, st->hTcxDec->synth_history, Q_synth_history, L_PROT48k + L_FRAME_MAX ); @@ -525,17 +525,17 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( IF( st->hTcxDec ) { - st->hTcxDec->Q_old_syn_Overl = 0; - st->hTcxDec->Q_syn_Overl_TDAC = 0; - st->hTcxDec->Q_syn_Overl = 0; - st->hTcxDec->Q_syn_Overl_TDACFB = 0; + //st->hTcxDec->Q_old_syn_Overl = 0; + //st->hTcxDec->Q_syn_Overl_TDAC = 0; + //st->hTcxDec->Q_syn_Overl = 0; + //st->hTcxDec->Q_syn_Overl_TDACFB = 0; //st->hTcxDec->Q_syn_OverlFB = 0; Q_old_synth = 0; Q_synth_history = 0; - floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); - floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->Q_syn_Overl_TDAC, L_FRAME32k / 2 ); - floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->hTcxDec->Q_syn_Overl, L_FRAME32k / 2 ); - floatToFixed_arr( st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->Q_syn_Overl_TDACFB, L_FRAME_MAX / 2 ); + //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); + //floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->Q_syn_Overl_TDAC, L_FRAME32k / 2 ); + //floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->hTcxDec->Q_syn_Overl, L_FRAME32k / 2 ); + //floatToFixed_arr( st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->Q_syn_Overl_TDACFB, L_FRAME_MAX / 2 ); //floatToFixed_arr( st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->hTcxDec->Q_syn_OverlFB, L_FRAME_MAX / 2 ); //floatToFixed_arr( st->hTcxDec->old_synth_float, st->hTcxDec->old_synth, Q_old_synth, OLD_SYNTH_INTERNAL_DEC ); //floatToFixed_arr( st->hTcxDec->synth_history, st->hTcxDec->synth_history_fx, Q_synth_history, L_PROT48k + L_FRAME_MAX ); @@ -624,11 +624,11 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( { Q_old_synth = Q_syn; Q_synth_history = 0; - st->hTcxDec->Q_old_syn_Overl = st->Q_syn + 1; - fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); - fixedToFloat_arr( st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->Q_syn_Overl_TDAC, 320 ); - fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->hTcxDec->Q_syn_Overl, 320 ); - fixedToFloat_arr( st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->Q_syn_Overl_TDACFB, 480 ); + //st->hTcxDec->Q_old_syn_Overl = st->Q_syn + 1; + //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, st->hTcxDec->Q_old_syn_Overl, L_FRAME32k / 2 ); + //fixedToFloat_arr( st->hTcxDec->syn_Overl_TDAC, st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->Q_syn_Overl_TDAC, 320 ); + //fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->hTcxDec->Q_syn_Overl, 320 ); + //fixedToFloat_arr( st->hTcxDec->syn_Overl_TDACFB, st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->Q_syn_Overl_TDACFB, 480 ); //fixedToFloat_arr( st->hTcxDec->syn_OverlFB, st->hTcxDec->syn_OverlFB_float, st->hTcxDec->Q_syn_OverlFB, 480 ); //fixedToFloat_arr( st->hTcxDec->old_synth, st->hTcxDec->old_synth_float, Q_old_synth, OLD_SYNTH_INTERNAL_DEC ); //fixedToFloat_arr( st->hTcxDec->synth_history_fx, st->hTcxDec->synth_history, Q_synth_history, L_PROT48k + L_FRAME_MAX ); @@ -696,7 +696,7 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( } for ( int p = 0; p < hTcxDec->old_synth_lenFB; p++ ) { - hTcxDec->old_synthFB_fx[p] = (Word16) ( hTcxDec->old_synthFB[p] ); + //hTcxDec->old_synthFB_fx[p] = (Word16) ( hTcxDec->old_synthFB[p] ); } //st->hTcxDec->tcxltp_last_gain_unmodified = (Word16) floatToFixed( st->hTcxDec->tcxltp_last_gain_unmodified_float, 15 ); @@ -779,10 +779,10 @@ void stereo_tcx_dec_mode_switch_reconf_To_fixed_2( //st->hFdCngDec->hFdCngCom->likelihood_noisy_speech = float_to_fix16(st->hFdCngDec->hFdCngCom->likelihood_noisy_speech_flt, 15); - floatToFixed_arr(st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->Q_syn + 1, L_FRAME32k / 2); - floatToFixed_arr(st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->Q_syn, 320); - floatToFixed_arr(st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->Q_syn+1, 320); - floatToFixed_arr(st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, st->Q_syn, 480); + //floatToFixed_arr(st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, st->Q_syn + 1, L_FRAME32k / 2); + //floatToFixed_arr(st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, st->Q_syn, 320); + //floatToFixed_arr(st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->Q_syn+1, 320); + //floatToFixed_arr(st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, st->Q_syn, 480); //floatToFixed_arr(st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->Q_syn, 480); } } @@ -801,10 +801,10 @@ void fixed_to_float_stereo_tcx_core_dec( for ( int p = 0; p < st->L_frame / 2; p++ ) { //st->hTcxDec->syn_OverlFB_float[p] = (float) st->hTcxDec->syn_OverlFB[p] / (float) pow( 2, st->Q_syn ); - st->hTcxDec->syn_Overl_float[p] = (float) st->hTcxDec->syn_Overl[p] / (float) pow( 2, st->Q_syn ); - st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); - st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); - st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); + //st->hTcxDec->syn_Overl_float[p] = (float) st->hTcxDec->syn_Overl[p] / (float) pow( 2, st->Q_syn ); + //st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); + //st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); + //st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); } for ( int p = 0; p < st->L_frame; p++ ) { @@ -833,7 +833,7 @@ void fixed_to_float_stereo_tcx_core_dec( //fixedToFloat_arr( hTcxDec->synth_history_fx, hTcxDec->synth_history, 0, NS2SA_fx2( st->output_Fs, PH_ECU_MEM_NS ) ); //st->hTcxDec->q_synth_history_fx = 0; - fixedToFloat_arr( hTcxDec->old_synthFB_fx, hTcxDec->old_synthFB, 0, NS2SA_fx2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) + hTcxDec->old_synth_lenFB ); + //fixedToFloat_arr( hTcxDec->old_synthFB_fx, hTcxDec->old_synthFB, 0, NS2SA_fx2( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) + hTcxDec->old_synth_lenFB ); if ( !st->tcxonly ) { @@ -918,7 +918,7 @@ void fixed_to_float_stereo_tcx_core_dec( } FOR( Word16 ind = 0; ind < L_FRAME32k / 2; ind++ ) { - st->hTcxDec->syn_Overl_float[ind] = (float) st->hTcxDec->syn_Overl[ind] / ( (float) pow( 2, st->Q_syn + 1 ) ); + //st->hTcxDec->syn_Overl_float[ind] = (float) st->hTcxDec->syn_Overl[ind] / ( (float) pow( 2, st->Q_syn + 1 ) ); } FOR( Word16 ind = 0; ind < L_FRAME_MAX / 2; ind++ ) { diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index be05cc7c3742b399093838e6636d011d04bdd893..fde8083d8c827106fee9147aeb308f94143a36b7 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1420,6 +1420,15 @@ typedef struct { int16_t offset; float data[35]; } ACPL_QUANT_TABLE; + +#ifdef IVAS_FLOAT_FIXED +typedef struct { + Word16 nquant; + Word16 offset; + Word32 data[35]; +} ACPL_QUANT_TABLE_FX; +#endif // IVAS_FLOAT_FIXED + typedef struct { const int16_t (*alpha)[2]; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 16a1cd00550ccfeb44467174543090fc3db89950..d77274a759b7a6f09bc467ea0cadc065e33aeece 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4526,8 +4526,8 @@ void ivas_mc_paramupmix_dec_render( const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - float *input_f[], /* i : core-coder transport channels */ - float *output_f[] /* i/o: synthesized core-coder transport channels */ + Word32 *input_fx[], /* i : core-coder transport channels */ + Word32 *output_fx[] /* i/o: synthesized core-coder transport channels */ ); void ivas_param_mc_metadata_open( @@ -6349,6 +6349,17 @@ void ivas_binRenderer( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX] /* i : LS signals */ ); +void ivas_binRenderer_fx( + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/ + const int16_t numTimeSlots, /* i : number of time slots to render */ + Word32 Cldfb_RealBuffer_Binaural_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + Word32 Cldfb_ImagBuffer_Binaural_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + Word32 RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + Word32 ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + Word16 *Q_in /* i : LS signals exp */ +); + void ivas_binaural_add_LFE( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t output_frame, /* i : length of input frame */ diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 038c09f5d4d98ec1abc94fd75acb30818ad32866..b9129c4bf8010a4c53d131f40b4908b6c045a3f4 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -9021,6 +9021,70 @@ const ACPL_QUANT_TABLE ivas_mc_paramupmix_beta_quant_table[9] = } }; +#ifdef IVAS_FLOAT_FIXED +const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_alpha_quant_table_fx = +{ + 33, /* nquant */ + 16, /* offset */ + { + -536870912, -485700416, -439563072, -398458880, -362387872, -331350016, -305345344, + -284373824, -268435456, -252497104, -231525584, -205520896, -174483040, -138412032, + -97307856, -51170508, 0, 51170508, 97307856, 138412032, 174483040, + 205520896, 231525584, 252497104, 268435456, 284373824, 305345344, 331350016, + 362387872, 398458880, 439563072, 485700416, 536870912, 0, 0 + } /* data in Q28 */ +}; + +const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_beta_quant_table_fx[9] = +{ + { + 9, /* nquant */ + 0, /* offset */ + { 0, 63753420, 147639504, 251658240, 375809632, 520093696, 684510400, 869059776, 1073741824 } /* data in Q28 */ + }, + { /* Beta #2 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 54638668, 126531672, 215678976, 322080672, 445736544, 586646912, 744811456, 920230272 } /* data in Q28 */ + }, + { /* Beta #3 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 46420464, 107500024, 183238656, 273636384, 378693184, 498409216, 632784256, 781818240 } /* data in Q28 */ + }, + { /* Beta #4 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 39098780, 90544544, 154337280, 230477024, 318963584, 419797344, 532978048, 658505728 } /* data in Q28 */ + }, + { /* Beta #5 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 32673642, 75665248, 128974864, 192602432, 266548032, 350811584, 445393216, 550292672 } /* data in Q28 */ + }, + { /* Beta #6 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 27144998, 62862136, 107151352, 160012704, 221446144, 291451648, 370029408, 457179136 } /* data in Q28 */ + }, + { /* Beta #7 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 22512928, 52135212, 88866816, 132707776, 183658096, 241717760, 306886688, 379165088 } /* data in Q28 */ + }, + { /* Beta #8 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 18777374, 43484452, 74121200, 110687696, 153183840, 201609712, 255965264, 316250528 } /* data in Q28 */ + }, + { /* Beta #9 */ + 9, /* nquant */ + 0, /* offset */ + { 0, 15938355, 36909876, 62914560, 93952408, 130023424, 171127600, 217264944, 268435456 } /* data in Q28 */ + } +}; +#endif // IVAS_FLOAT_FIXED + const Word32 one_by_q_level[64] = { 0, 2147483647, 1073741824, 715827904, 536870912, 429496736, 357913952, 306783392, 268435456, 238609296, 214748368, diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index cbbe264584ec2ce03c92e3344b570e6ba57e6370..dff83ec21b1849793f58aa98ce350f47d01246be 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -567,5 +567,9 @@ extern const int16_t ivas_param_upmx_mx_qmap[33]; extern const ACPL_QUANT_TABLE ivas_mc_paramupmix_alpha_quant_table; extern const ACPL_QUANT_TABLE ivas_mc_paramupmix_beta_quant_table[9]; +#ifdef IVAS_FLOAT_FIXED +extern const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_alpha_quant_table_fx; +extern const ACPL_QUANT_TABLE_FX ivas_mc_paramupmix_beta_quant_table_fx[9]; +#endif // IVAS_FLOAT_FIXED /* IVAS_ROM_COM_H */ #endif diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index 8e668182cace2a1acd224774b500d3899f017844..8635dc75301d4fb81816c9dcdf953b24f32712fa 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -2666,8 +2666,8 @@ void acelp_decoder_state_float2fix(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte /*TCX_DEC_HANDLE*/ if (st->hTcxDec) { - floatToFixed_arr(st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, 0, L_FRAME32k / 2); - floatToFixed_arr(st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, -1, st->L_frame / 2); + //floatToFixed_arr(st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, 0, L_FRAME32k / 2); + //floatToFixed_arr(st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, -1, st->L_frame / 2); } } @@ -2748,8 +2748,8 @@ void acelp_decoder_state_fix2float(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte /*TCX_DEC_HANDLE*/ if (st->hTcxDec) { - fixedToFloat_arr(st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, 0, L_FRAME32k / 2); - fixedToFloat_arr(st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, -1, st->L_frame / 2); + //fixedToFloat_arr(st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, 0, L_FRAME32k / 2); + //fixedToFloat_arr(st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, -1, st->L_frame / 2); } } diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index f6466bba240314babccc64097f6b85b734d54402..85d6e9247a4df18cdbadf3bee412607c4350e6f1 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -242,7 +242,7 @@ void open_decoder_LPD_flt( st->last_is_cng = 0; st->rate_switching_reset = 0; - +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) if (st->hTcxDec != NULL) { reset_tcx_overl_buf(st->hTcxDec); @@ -252,7 +252,7 @@ void open_decoder_LPD_flt( set_zero(st->hTcxDec->synth_history, L_PROT48k + L_FRAME_MAX); } - +#endif #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) set_zero(st->syn_float, M + 1); @@ -267,11 +267,12 @@ void open_decoder_LPD_flt( else { /* Reset old_synth in case of core sampling rate switching and Mode 1/2 switching*/ +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) if (st->hTcxDec != NULL && ((st->L_frame != st->last_L_frame) || (st->last_codec_mode == MODE1 && st->element_mode == EVS_MONO))) { set_zero(st->hTcxDec->old_synth_float, OLD_SYNTH_INTERNAL_DEC); } - +#endif /*Compute size of old and new memories*/ mem_syn_r_size_old = (int16_t)(1.25 * st->last_L_frame / 20.f); mem_syn_r_size_new = (int16_t)(1.25 * st->L_frame / 20.f); @@ -310,7 +311,9 @@ void open_decoder_LPD_flt( { /* Switching from Mode 1 ACELP */ st->last_core_bfi = ACELP_CORE; +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) acelp_plc_mdct_transition(st); +#endif } if (st->last_codec_mode == MODE2 && @@ -334,17 +337,19 @@ void open_decoder_LPD_flt( set_zero(st->mem_syn2, M); set_zero(st->syn_float, 1 + M); #endif - +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) /*OLA -> zero */ if (st->hTcxDec != NULL) { reset_tcx_overl_buf(st->hTcxDec); } - +#endif if (st->hTcxCfg != NULL) { +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) mvr2r(st->hHQ_core->old_out + NS2SA(st->output_Fs, N_ZERO_MDCT_NS), st->hTcxDec->syn_OverlFB_float, st->hTcxCfg->tcx_mdct_window_lengthFB); +#endif st->hTcxCfg->last_aldo = 1; /*It was previously ALDO*/ st->hTcxCfg->tcx_curr_overlap_mode = ALDO_WINDOW; } @@ -829,7 +834,7 @@ void tcxltp_dec_init( * * Reset TCX core overlap buffers *-----------------------------------------------------------------------*/ - +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) void reset_tcx_overl_buf( TCX_DEC_HANDLE hTcxDec /* i/o: TCX decoder handle */ ) @@ -841,7 +846,7 @@ void reset_tcx_overl_buf( return; } - +#endif void reset_tcx_overl_buf_fx( TCX_DEC_HANDLE hTcxDec /* i/o: TCX decoder handle */ ) @@ -862,7 +867,7 @@ void reset_tcx_overl_buf_fx( * * Prepare MDCT OLA memories in TCX/HQ after ACELP PLC *-----------------------------------------------------------------------*/ - +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) void acelp_plc_mdct_transition( Decoder_State *st /* i/o: Decoder state */ ) @@ -879,7 +884,6 @@ void acelp_plc_mdct_transition( nz = NS2SA( st->output_Fs, N_ZERO_MDCT_NS ); delay_comp = NS2SA( st->output_Fs, DELAY_CLDFB_NS ); /*CLDFB delay*/ - mvr2r( st->hHQ_core->fer_samples + delay_comp, st->hTcxDec->syn_OverlFB_float, st->hTcxDec->L_frameTCX / 2 ); lerp_flt( st->hHQ_core->fer_samples + delay_comp, st->hTcxDec->syn_Overl_float, st->L_frame / 2, st->hTcxDec->L_frameTCX / 2 ); /*ACELP(bfi)->TCX(rect)*/ /*old_out needed for MODE1 routine and syn_Overl_TDAC for MODE2 routine*/ @@ -901,3 +905,4 @@ void acelp_plc_mdct_transition( return; } +#endif \ No newline at end of file diff --git a/lib_dec/core_dec_reconf.c b/lib_dec/core_dec_reconf.c index 7f46f5b7ae1ac91632838bf5717bac4a5abf21d2..9f3354b09b67958068c45e947beaf03044a7f999 100644 --- a/lib_dec/core_dec_reconf.c +++ b/lib_dec/core_dec_reconf.c @@ -140,7 +140,7 @@ void reconfig_decoder_LPD_ivas( newLen = st->L_frame / 2; oldLen = L_frame_old / 2; } - +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) if ( st->hTcxDec != NULL ) { lerp_flt( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl_float, newLen, oldLen ); @@ -151,6 +151,7 @@ void reconfig_decoder_LPD_ivas( lerp_flt( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC_float, newLen, oldLen ); } } +#endif } if ( st->L_frame <= L_FRAME16k ) diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index b4286d8a2072e7ca2a954d4cc616692dfff6a5a5..95c92a80910a81af028ac0683e261447657ae85a 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -1602,7 +1602,7 @@ ivas_error core_switching_post_dec( * Preprocessing in the first HQ frame after ACELP frame * Modify bit allocation for HQ core by removing ACELP subframe budget *---------------------------------------------------------------------*/ - +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) void core_switching_hq_prepare_dec( Decoder_State *st, /* i/o: decoder state structure */ int16_t *num_bits, /* i/o: bit budget update */ @@ -1675,7 +1675,7 @@ void core_switching_hq_prepare_dec( return; } - +#endif /*---------------------------------------------------------------------* * bandwidth_switching_detect() diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 6eb4dc4a850ab6d9785246446b8f01301734313b..b726fa3c1e490faf7113d1f64bdd32d8d4003e8d 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3661,7 +3661,7 @@ void decoder_tcx_fx( Scale_sig( st->hTcxDec->syn_Overl_TDAC, 320, -( st->Q_syn + 2 ) ); // Scaling to Q-2 Scale_sig( st->hTcxDec->syn_Overl_TDACFB, 480, -( st->Q_syn + 2 ) ); // Scaling to Q-2 Scale_sig( st->hTcxDec->syn_OverlFB, 480, -( st->Q_syn + 2 ) ); // Scaling to Q-2 - Scale_sig( st->hTcxDec->old_syn_Overl, 320, -( st->Q_syn + 1 + 2 ) ); // Scaling to Q-2 + Scale_sig( st->hTcxDec->old_syn_Overl, 320, -( st->Q_syn + 1 + 0 ) ); // Scaling to Q-2 Scale_sig( st->hHQ_core->old_out_LB_fx, 640, -( st->hHQ_core->Q_old_wtda + 2 ) ); // Scaling to Q-2 Scale_sig( st->hHQ_core->old_out_fx, 960, -( st->hHQ_core->Q_old_wtda + 2 ) ); // Scaling to Q-2 @@ -3680,6 +3680,7 @@ void decoder_tcx_fx( Scale_sig( st->hTcxDec->syn_Overl, L_FRAME32k / 2, ( st->Q_syn + 1 + 2 ) ); Scale_sig( st->hHQ_core->old_out_LB_fx, L_FRAME32k, ( st->hHQ_core->Q_old_wtda + 2 ) ); Scale_sig( st->hHQ_core->old_out_fx, L_FRAME48k, ( st->hHQ_core->Q_old_wtda + 2 ) ); + //Scale_sig( st->hTcxDec->old_syn_Overl, 320, ( st->Q_syn + 1 + 2 ) ); // Scaling to Q-2 } #endif diff --git a/lib_dec/hq_core_dec.c b/lib_dec/hq_core_dec.c index 6e85b92aa4bfadb2427fcc7feed90d0ac10656d6..d642249df7d81a83ac23d1b5c2048049449477dd 100644 --- a/lib_dec/hq_core_dec.c +++ b/lib_dec/hq_core_dec.c @@ -341,7 +341,7 @@ void hq_core_dec( 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->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 */ @@ -399,7 +399,7 @@ void hq_core_dec( } // 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( 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 ); @@ -685,8 +685,8 @@ void HQ_core_dec_init_flt( //hHQ_core->energy_lt = 300.0f; hHQ_core->HqVoicing = 0; - set_f( hHQ_core->fer_samples, 0, L_FRAME48k ); #if (defined EVS_FLOAT) || !(defined 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 diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 5ce6305013aad325bc5029c42a0b42bc37f497a1..4a4d9a3a7d355df6766bc0b167e148d4a11e3d02 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -1786,9 +1786,9 @@ ivas_error init_decoder_ivas_fx( return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for hTcxDec\n")); } -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) set_f(st_fx->hTcxDec->FBTCXdelayBuf_float, 0.0f, 111); - + // st_fx->hTcxDec->old_synthFB = st_fx->hTcxDec->synth_history + NS2SA(st_fx->output_Fs, PH_ECU_MEM_NS); st_fx->hTcxDec->prev_good_synth = st_fx->hTcxDec->old_synthFB + NS2SA(st_fx->output_Fs, PH_ECU_LOOKAHEAD_NS); #endif diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index d952c32114cdd0cbbd36c144996eaeea4500ab04..389a14d20a0695b44e0b7cb51411af16b011d8d7 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -2178,3 +2178,129 @@ void ivas_binRenderer( pop_wmops(); return; } + + +void ivas_binRenderer_fx( + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ + COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i : combined head and external orientation handle*/ + const int16_t numTimeSlots, /* i : number of time slots to render */ + Word32 Cldfb_RealBuffer_Binaural_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + Word32 Cldfb_ImagBuffer_Binaural_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ + Word32 RealBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + Word32 ImagBuffer_fx[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ + Word16 *Q_in /* i : LS signals exp */ +) +{ + Word16 chIdx, i, j, k; + //to be checked: feasibility with 32 bit buffers + Word64 Cldfb_RealBuffer_Binaural_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word64 Cldfb_ImagBuffer_Binaural_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + push_wmops("fastconv_binaural_rendering"); + + /* Compute Convolution */ + /* memory reset for the binaural output */ + FOR(chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++) + { + FOR(k = 0; k < numTimeSlots; k++) + { + set32_fx(Cldfb_RealBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX); + set32_fx(Cldfb_ImagBuffer_Binaural_fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX); + set64_fx(Cldfb_RealBuffer_Binaural_64fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX); + set64_fx(Cldfb_ImagBuffer_Binaural_64fx[chIdx][k], 0, CLDFB_NO_CHANNELS_MAX); + } + } + + /* Head rotation in HOA3 or CICPx */ + IF(hCombinedOrientationData != NULL && hCombinedOrientationData->enableCombinedOrientation[hCombinedOrientationData->subframe_idx] && hBinRenderer->rotInCldfb) + { + IF(hBinRenderer->hInputSetup->is_loudspeaker_setup == 0) + { + /* Rotation in SHD (HOA3) */ + IF(hCombinedOrientationData->shd_rot_max_order == -1) + { + rotateFrame_shd_cldfb(RealBuffer_fx, ImagBuffer_fx, hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3); + *Q_in = sub(*Q_in, 1); //( Q_in + 14 - 15 ) + } + ELSE IF(hCombinedOrientationData->shd_rot_max_order > 0) + { + rotateFrame_shd_cldfb(RealBuffer_fx, ImagBuffer_fx, hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hCombinedOrientationData->shd_rot_max_order); + *Q_in = sub(*Q_in, 1); //( Q_in + 14 - 15 ) + } + } + ELSE + { + /* Rotation in SD (CICPx) */ + rotateFrame_sd_cldfb_fixed(hCombinedOrientationData->Rmat_fx[hCombinedOrientationData->subframe_idx], RealBuffer_fx, ImagBuffer_fx, + hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band); + } + } + + /* HOA decoding to CICP19 if needed*/ + IF(hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && hBinRenderer->nInChannels != 16) + { + ivas_sba2mc_cldfb_fixed(*(hBinRenderer->hInputSetup), RealBuffer_fx, ImagBuffer_fx, + hBinRenderer->nInChannels, hBinRenderer->conv_band, numTimeSlots, hBinRenderer->hoa_dec_mtx); + } + ivas_binRenderer_filterModule_fixed(Cldfb_RealBuffer_Binaural_64fx, Cldfb_ImagBuffer_Binaural_64fx, RealBuffer_fx, ImagBuffer_fx, numTimeSlots, hBinRenderer, *Q_in); + + FOR(i = 0; i < BINAURAL_CHANNELS; i++) + { + FOR(j = 0; j < MAX_PARAM_SPATIAL_SUBFRAMES; j++) + { + FOR(k = 0; k < CLDFB_NO_CHANNELS_MAX; k++) + { + Cldfb_RealBuffer_Binaural_fx[i][j][k] = W_extract_l( W_shr( Cldfb_RealBuffer_Binaural_64fx[i][j][k], 29 ) ); //(*Q_in + 29) - 29 + Cldfb_ImagBuffer_Binaural_fx[i][j][k] = W_extract_l( W_shr( Cldfb_ImagBuffer_Binaural_64fx[i][j][k], 29 ) ); //(*Q_in + 29) - 29 + } + } + } + /* Obtain the binaural dmx and compute the reverb */ + IF(hBinRenderer->hReverb != NULL) + { + Word32 reverbRe_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + Word32 reverbIm_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + Word32 inRe_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + Word32 inIm_fx[BINAURAL_CHANNELS][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + + ivas_binaural_obtain_DMX_fx(numTimeSlots, hBinRenderer, RealBuffer_fx, ImagBuffer_fx, inRe_fx, inIm_fx); + // inRe_fx, inIm_fx Q = *Q_in - Q1 + + FOR(chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++) + { + FOR(k = 0; k < numTimeSlots; k++) + { + set32_fx(reverbRe_fx[chIdx][k], 0, hBinRenderer->max_band); + set32_fx(reverbIm_fx[chIdx][k], 0, hBinRenderer->max_band); + } + } + + ivas_binaural_reverb_processSubframe_fx(hBinRenderer->hReverb, BINAURAL_CHANNELS, numTimeSlots, inRe_fx, inIm_fx, reverbRe_fx, reverbIm_fx); + // reverbRe_fx, reverbIm_fx Q = *Q_in - 1 // + + FOR(i = 0; i < BINAURAL_CHANNELS; i++) + { + FOR(j = 0; j < numTimeSlots; j++) + { + + FOR(k = 0; k < hBinRenderer->hReverb->numBins; k++) + { + reverbRe_fx[i][j][k] = L_shl(reverbRe_fx[i][j][k], 1); //*Q_in + reverbIm_fx[i][j][k] = L_shl(reverbIm_fx[i][j][k], 1); //*Q_in + } + } + } + + /* Add the conv module and reverb module output */ + FOR(chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++) + { + FOR(k = 0; k < numTimeSlots; k++) + { + /* Combine first and second parts to generate binaural output signal with room effect */ + v_add_32(Cldfb_RealBuffer_Binaural_fx[chIdx][k], reverbRe_fx[chIdx][k], Cldfb_RealBuffer_Binaural_fx[chIdx][k], hBinRenderer->conv_band); + v_add_32(Cldfb_ImagBuffer_Binaural_fx[chIdx][k], reverbIm_fx[chIdx][k], Cldfb_ImagBuffer_Binaural_fx[chIdx][k], hBinRenderer->conv_band); + } + } + } + pop_wmops(); + return; +} \ No newline at end of file diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 11febe2605e173972dd5c4e0fcbd2e2e3e6c4ab7..7d5a85cd5b0f2dcca7b8ef361f6a28853a0f00fa 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -538,10 +538,10 @@ ivas_error ivas_core_dec( //Q_FBTCXdelayBuf = Q_factor_arr( st->hTcxDec->FBTCXdelayBuf_float, 111 ); //Q_prev_synth_buffer = s_min( Q_prev_synth_buffer, Q_FBTCXdelayBuf ); //Q_prev_synth_buffer = s_min( Q_prev_synth_buffer, 11 ); - Q_syn_Overl = Q_factor_arr( st->hTcxDec->syn_Overl_float, 320 ); - Q_old_syn_Overl = Q_factor_arr( st->hTcxDec->old_syn_Overl_float, L_FRAME32k / 2 ) - 1; + //Q_syn_Overl = Q_factor_arr( st->hTcxDec->syn_Overl_float, 320 ); + //Q_old_syn_Overl = Q_factor_arr( st->hTcxDec->old_syn_Overl_float, L_FRAME32k / 2 ) - 1; } - Q_syn_Overl = s_min( 0, Q_syn_Overl ) - 1; + //Q_syn_Overl = s_min( 0, Q_syn_Overl ) - 1; //IF( st->hHQ_core ) //{ @@ -550,8 +550,8 @@ ivas_error ivas_core_dec( { //floatToFixed_arr16( st->hTcxDec->FBTCXdelayBuf_float, st->hTcxDec->FBTCXdelayBuf, Q_prev_synth_buffer, 111 ); //floatToFixed_arrL( st->hTcxDec->FBTCXdelayBuf_float, st->hTcxDec->FBTCXdelayBuf_32, OUTPUT_Q, 111 ); - floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, Q_syn_Overl, 320 ); - floatToFixed_arr16( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, Q_old_syn_Overl, L_FRAME32k / 2 ); + //floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, Q_syn_Overl, 320 ); + //floatToFixed_arr16( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, Q_old_syn_Overl, L_FRAME32k / 2 ); } //floatToFixed_arr16( st->prev_synth_buffer, st->prev_synth_buffer_fx, Q_prev_synth_buffer, 96 ); //floatToFixed_arr16( st->prev_synth_buffer, st->prev_synth_buffer_fx, 0, 96 ); @@ -577,14 +577,14 @@ ivas_error ivas_core_dec( { IF( EQ_16( nchan_out, 1 ) && EQ_16( st->element_mode, IVAS_CPE_DFT ) && LE_32( st->element_brate, IVAS_24k4 ) && GT_32( last_element_brate, IVAS_24k4 ) ) { - Q_old_synthFB = Q_factor_arr( st->hTcxDec->old_synthFB, st->hTcxDec->old_synth_lenFB ) - 1; - floatToFixed_arr16( st->hTcxDec->old_synthFB, st->hTcxDec->old_synthFB_fx, Q_old_synthFB, st->hTcxDec->old_synth_lenFB ); + //Q_old_synthFB = Q_factor_arr( st->hTcxDec->old_synthFB, st->hTcxDec->old_synth_lenFB ) - 1; + //floatToFixed_arr16( st->hTcxDec->old_synthFB, st->hTcxDec->old_synthFB_fx, Q_old_synthFB, st->hTcxDec->old_synth_lenFB ); } } #endif Copy_Scale_sig_16_32( st->previoussynth_fx, st->previoussynth_fx_32, L_FRAME48k, 0 ); - IF ( ( error = core_switching_pre_dec_ivas_fx( st, output_frame, sts[0]->last_core_brate, nchan_out, last_element_mode, last_element_brate, Q_old_synthFB, &Q_olapBufferSynth, &Q_olapBufferSynth2) ) != IVAS_ERR_OK ) + IF ( ( error = core_switching_pre_dec_ivas_fx( st, output_frame, sts[0]->last_core_brate, nchan_out, last_element_mode, last_element_brate, st->Q_syn, &Q_olapBufferSynth, &Q_olapBufferSynth2) ) != IVAS_ERR_OK ) { return error; } @@ -597,7 +597,7 @@ ivas_error ivas_core_dec( IF( st->hTcxDec ) { - fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, Q_old_syn_Overl, L_FRAME32k / 2 ); + //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, Q_old_syn_Overl, L_FRAME32k / 2 ); } IF( st->cldfbAna ) @@ -726,8 +726,8 @@ ivas_error ivas_core_dec( #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 ); - floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, -1, L_FRAME32k / 2 ); - floatToFixed_arr( st->hTcxDec->prev_good_synth - tmp_size, st->hTcxDec->prev_good_synth_fx - tmp_size, 0, 2 * output_frame + tmp_size ); + //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, -1, L_FRAME32k / 2 ); + //floatToFixed_arr( st->hTcxDec->prev_good_synth - tmp_size, st->hTcxDec->prev_good_synth_fx - tmp_size, 0, 2 * output_frame + tmp_size ); #endif ivas_hq_core_dec_fx( st, synth_fxl, &Q_synth, output_frame, NORMAL_HQ_CORE, core_switching_flag[n], output_16_fx[n], &Q_output ); @@ -740,8 +740,8 @@ ivas_error ivas_core_dec( #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( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, -1, L_FRAME32k / 2 ); - fixedToFloat_arr( st->hTcxDec->prev_good_synth_fx - tmp_size, st->hTcxDec->prev_good_synth - tmp_size, 0, 2 * output_frame + tmp_size ); + //fixedToFloat_arr( st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, -1, L_FRAME32k / 2 ); + //fixedToFloat_arr( st->hTcxDec->prev_good_synth_fx - tmp_size, st->hTcxDec->prev_good_synth - tmp_size, 0, 2 * output_frame + tmp_size ); #endif @@ -860,8 +860,8 @@ ivas_error ivas_core_dec( //} } - IF( st->hTcxDec ) - floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->Q_syn, L_FRAME32k / 2 ); + //IF( st->hTcxDec ) + //floatToFixed_arr( st->hTcxDec->syn_Overl_float, st->hTcxDec->syn_Overl, st->Q_syn, L_FRAME32k / 2 ); //IF( st->hTcxDec ) //floatToFixed_arr( st->hTcxDec->syn_OverlFB_float, st->hTcxDec->syn_OverlFB, st->Q_syn, L_FRAME_MAX / 2 ); @@ -869,12 +869,12 @@ ivas_error ivas_core_dec( 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->hTcxDec ) - floatToFixed_arr( st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, -1 - st->Q_syn, L_FRAME_MAX / 2 ); - IF( st->hTcxDec ) - floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, -1 - st->Q_syn, L_FRAME32k / 2 ); - IF( st->hTcxDec ) - floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, -1 - st->Q_syn, L_FRAME32k / 2 ); + //IF( st->hTcxDec ) + //floatToFixed_arr( st->hTcxDec->syn_Overl_TDACFB_float, st->hTcxDec->syn_Overl_TDACFB, -1 - st->Q_syn, L_FRAME_MAX / 2 ); + //IF( st->hTcxDec ) + //floatToFixed_arr( st->hTcxDec->syn_Overl_TDAC_float, st->hTcxDec->syn_Overl_TDAC, -1 - st->Q_syn, L_FRAME32k / 2 ); + //IF( st->hTcxDec ) + //floatToFixed_arr( st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, -1 - st->Q_syn, L_FRAME32k / 2 ); //IF( st->hTcxDec ) //floatToFixed_arr( st->hTcxDec->old_excFB, st->hTcxDec->old_excFB_fx, st->Q_exc, s_min( 960, st->L_frame ) ); @@ -942,7 +942,7 @@ ivas_error ivas_core_dec( //me2f_buf( sts[ch]->hIGFDec->virtualSpec, sts[ch]->hIGFDec->virtualSpec_e, sts[ch]->hIGFDec->virtualSpec_float, ( N_MAX_TCX - IGF_START_MN ) ); st = hCPE->hCoreCoder[ch]; //fixedToFloat_arr( st->hTcxDec->syn_OverlFB, st->hTcxDec->syn_OverlFB_float, st->Q_syn, L_FRAME_MAX / 2 ); - fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); + //fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); //st->hTcxDec->tcxltp_last_gain_unmodified_float = fix16_to_float( st->hTcxDec->tcxltp_last_gain_unmodified, Q15 ); //st->hTcxDec->conceal_eof_gain_float = fix16_to_float( st->hTcxDec->conceal_eof_gain, Q14 ); @@ -1031,9 +1031,9 @@ ivas_error ivas_core_dec( for ( int p = 0; p < s_min( 320, st->L_frame / 2 ); p++ ) { - st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); - st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) ( (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * pow( 2, st->Q_syn ) ); - st->hTcxDec->syn_Overl_TDAC_float[p] = (float) ( (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * pow( 2, st->Q_syn ) ); + //st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); + //st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) ( (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * pow( 2, st->Q_syn ) ); + //st->hTcxDec->syn_Overl_TDAC_float[p] = (float) ( (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * pow( 2, st->Q_syn ) ); } for ( int p = 0; p < 640; p++ ) { @@ -1048,7 +1048,7 @@ ivas_error ivas_core_dec( //fixedToFloat_arr( st->hTcxDec->old_synth, st->hTcxDec->old_synth_float, st->Q_syn, 1280 ); //fixedToFloat_arr( st->hTcxDec->synth_history_fx, st->hTcxDec->synth_history, st->Q_syn, s_min( 2496, NS2SA( st->output_Fs, PH_ECU_MEM_NS ) ) ); - fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, s_min( 2496, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ) ); + //fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, s_min( 2496, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ) ); for ( int p = 0; p < 960; p++ ) { diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index c64f5907e9d85b653e9802062b7cb47ac11a1705..0234e0b4081088cd627f7194b81d7cb77fd6b2bb 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -204,10 +204,10 @@ ivas_error ivas_cpe_dec_fx( hCPE->hCoreCoder[ind2]->cldfbSyn->scale = (Word16)(hCPE->hCoreCoder[ind2]->cldfbSyn->scale_flt * (1u << norm_s((Word16)hCPE->hCoreCoder[0]->cldfbSyn->scale_flt))); } FOR(Word16 ind = 0; ind < L_FRAME16k / 2; ind++) { - IF(hCPE->hCoreCoder[0] && hCPE->hCoreCoder[0]->hTcxDec) - hCPE->hCoreCoder[0]->hTcxDec->old_syn_Overl_32[ind] = (Word32)(hCPE->hCoreCoder[0]->hTcxDec->old_syn_Overl_float[ind] * (ONE_IN_Q11)); - IF(hCPE->hCoreCoder[1] && hCPE->hCoreCoder[1]->hTcxDec) - hCPE->hCoreCoder[1]->hTcxDec->old_syn_Overl_32[ind] = (Word32)(hCPE->hCoreCoder[1]->hTcxDec->old_syn_Overl_float[ind] * (ONE_IN_Q11)); + //IF(hCPE->hCoreCoder[0] && hCPE->hCoreCoder[0]->hTcxDec) + //hCPE->hCoreCoder[0]->hTcxDec->old_syn_Overl_32[ind] = (Word32)(hCPE->hCoreCoder[0]->hTcxDec->old_syn_Overl_float[ind] * (ONE_IN_Q11)); + //IF(hCPE->hCoreCoder[1] && hCPE->hCoreCoder[1]->hTcxDec) + //hCPE->hCoreCoder[1]->hTcxDec->old_syn_Overl_32[ind] = (Word32)(hCPE->hCoreCoder[1]->hTcxDec->old_syn_Overl_float[ind] * (ONE_IN_Q11)); } IF(hCPE->hStereoTD) FOR(Word16 ind = 0; ind < L_FRAME16k / 2; ind++) { @@ -266,10 +266,10 @@ ivas_error ivas_cpe_dec_fx( } } FOR(Word16 ind = 0; ind < L_FRAME16k / 2; ind++) { - IF(hCPE->hCoreCoder[0] && hCPE->hCoreCoder[0]->hTcxDec) - hCPE->hCoreCoder[0]->hTcxDec->old_syn_Overl_float[ind] = (float)hCPE->hCoreCoder[0]->hTcxDec->old_syn_Overl_32[ind] / (float)(ONE_IN_Q11); - IF(hCPE->hCoreCoder[1] && hCPE->hCoreCoder[1]->hTcxDec) - hCPE->hCoreCoder[1]->hTcxDec->old_syn_Overl_float[ind] = (float)hCPE->hCoreCoder[1]->hTcxDec->old_syn_Overl_32[ind] / (float)(ONE_IN_Q11); + //IF(hCPE->hCoreCoder[0] && hCPE->hCoreCoder[0]->hTcxDec) + //hCPE->hCoreCoder[0]->hTcxDec->old_syn_Overl_float[ind] = (float)hCPE->hCoreCoder[0]->hTcxDec->old_syn_Overl_32[ind] / (float)(ONE_IN_Q11); + //IF(hCPE->hCoreCoder[1] && hCPE->hCoreCoder[1]->hTcxDec) + //hCPE->hCoreCoder[1]->hTcxDec->old_syn_Overl_float[ind] = (float)hCPE->hCoreCoder[1]->hTcxDec->old_syn_Overl_32[ind] / (float)(ONE_IN_Q11); } #endif // Fix to float conversions #endif diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index e6e7a11d944caf5e02e068c3c331a0f1376dcdaa..7b18f4fc8911df416621fb93b4671881569d95b0 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -639,13 +639,14 @@ ivas_error ivas_jbm_dec_tc( fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, st->hTonalMDCTConc->nSamples ); IF( sts[0]->bfi == 0 && !st->hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, st->hTonalMDCTConc->nSamples / 2 ); - fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + + //fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); for ( int p = 0; p < st->L_frame / 2; p++ ) { - st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); - st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); - st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); + //st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); + //st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); + //st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); } for ( int p = 0; p < 640; p++ ) { @@ -656,7 +657,8 @@ ivas_error ivas_jbm_dec_tc( { fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); } - fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); + + //fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); /*-------------------cldfb-start-------------------------*/ @@ -1667,12 +1669,14 @@ ivas_error ivas_jbm_dec_tc( fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, st->hTonalMDCTConc->nSamples ); IF( sts[0]->bfi == 0 && !st->hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, st->hTonalMDCTConc->nSamples / 2 ); - fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + + //fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + for ( int p = 0; p < st->L_frame / 2; p++ ) { - st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); - st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); - st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); + //st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); + //st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); + //st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); } for ( int p = 0; p < 640; p++ ) { @@ -1684,7 +1688,7 @@ ivas_error ivas_jbm_dec_tc( fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); } - fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); + //fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); /*-------------------cldfb-start-------------------------*/ @@ -2397,12 +2401,14 @@ ivas_error ivas_jbm_dec_tc( fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, st->hTonalMDCTConc->nSamples ); IF( sts[0]->bfi == 0 && !st->hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, st->hTonalMDCTConc->nSamples / 2 ); - fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + + //fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + for ( int p = 0; p < st->L_frame / 2; p++ ) { - st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); - st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); - st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); + //st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); + //st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); + //st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); } for ( int p = 0; p < 640; p++ ) { @@ -2414,7 +2420,8 @@ ivas_error ivas_jbm_dec_tc( fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); } - fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); + //fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); + /*-------------------cldfb-start-------------------------*/ /*note : cldfb_size here signifies the original size which was assigned to cldfb_state_fx buffer not its current size*/ @@ -2717,12 +2724,14 @@ ivas_error ivas_jbm_dec_tc( fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, st->hTonalMDCTConc->nSamples ); IF( sts[0]->bfi == 0 && !st->hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, st->hTonalMDCTConc->nSamples / 2 ); - fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + + //fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + for ( int p = 0; p < st->L_frame / 2; p++ ) { - st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); - st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); - st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); + //st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); + //st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); + //st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); } for ( int p = 0; p < 640; p++ ) { @@ -2733,7 +2742,8 @@ ivas_error ivas_jbm_dec_tc( { fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); } - fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); + + //fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); /*-------------------cldfb-start-------------------------*/ @@ -3045,12 +3055,14 @@ ivas_error ivas_jbm_dec_tc( fixedToFloat_arr( st->hTonalMDCTConc->lastPcmOut, st->hTonalMDCTConc->lastPcmOut_float, 0, st->hTonalMDCTConc->nSamples ); IF( sts[0]->bfi == 0 && !st->hTonalMDCTConc->secondLastBlockData.tonalConcealmentActive ) fixedToFloat_arr( st->hTonalMDCTConc->secondLastPcmOut, st->hTonalMDCTConc->secondLastPcmOut_float, 0, st->hTonalMDCTConc->nSamples / 2 ); - fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + + //fixedToFloat_arr( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synthFB, st->Q_syn, st->hTcxDec->old_synth_lenFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); + for ( int p = 0; p < st->L_frame / 2; p++ ) { - st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); - st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); - st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); + //st->hTcxDec->old_syn_Overl_float[p] = (float) st->hTcxDec->old_syn_Overl[p] * 2 * ( 1u << st->Q_syn ); + //st->hTcxDec->syn_Overl_TDACFB_float[p] = (float) st->hTcxDec->syn_Overl_TDACFB[p] * 2 * (float) pow( 2, st->Q_syn ); + //st->hTcxDec->syn_Overl_TDAC_float[p] = (float) st->hTcxDec->syn_Overl_TDAC[p] * 2 * (float) pow( 2, st->Q_syn ); } for ( int p = 0; p < 640; p++ ) { @@ -3061,7 +3073,8 @@ ivas_error ivas_jbm_dec_tc( { fixedToFloat_arr( st->p_bpf_noise_buf, st->p_bpf_noise_buf_float, 0, L_FRAME_16k ); } - fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); + + //fixedToFloat_arr( st->hTcxDec->syn_Overl, st->hTcxDec->syn_Overl_float, st->Q_syn, L_FRAME32k / 2 ); /*-------------------cldfb-start-------------------------*/ @@ -3328,7 +3341,7 @@ ivas_error ivas_jbm_dec_tc( /* Delay the separated channel to sync with the DirAC rendering */ delay_signal_float( p_output[n], output_frame, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC, st_ivas->hMasa->hMasaLfeSynth->delayBuffer_syncDirAC_size ); } - FOR( Word16 i = 0; i < 12; i++ ) + FOR( i = 0; i < 12; i++ ) { floatToFixed_arrL( p_output[i], p_output_fx[i], Q11, output_frame ); } @@ -5497,7 +5510,18 @@ void ivas_jbm_dec_feed_tc_to_renderer( } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { + st_ivas->hTcBuffer->q_tc_fx = 11; + //for (int ch_idx = 0; ch_idx < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++) + //All transport channels retain same q11 function doesnt change ouptut q + for (int ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS; ch_idx++) + { + floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->q_tc_fx, L_FRAME48k); + } ivas_mc_paramupmix_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); + for (int ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS; ch_idx++) + { + fixedToFloat_arrL(st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->q_tc_fx, L_FRAME48k); + } } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) { @@ -5758,8 +5782,8 @@ ivas_error ivas_jbm_dec_render( AUDIO_CONFIG output_config; int16_t nSamplesAskedLocal; ivas_error error; - float *p_output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; - float *p_tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS]; + float *p_output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS] = { NULL }; + float *p_tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS] = { NULL }; #ifdef IVAS_FLOAT_FIXED Word32 *p_output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; Word32 tmp_buffer_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k] = { 0 }; @@ -7217,8 +7241,41 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { - ivas_mc_paramupmix_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_tc, p_output ); + FOR(i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++) + { + if (p_output[i] != NULL) + { + //fixedToFloat_arrL(p_output_fx[i], p_output[i], 11, 960); + floatToFixed_arrL(p_output[i], p_output_fx[i], 11, 960); + } + } + FOR(i = 0; i < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; i++) + { + if (p_tc[i] != NULL) + { + //fixedToFloat_arrL(p_tc_fx[i], p_tc[i], 11, 960); + floatToFixed_arrL(p_tc[i], p_tc_fx[i], 11, 960); + } + } + + ivas_mc_paramupmix_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_tc_fx, p_output_fx); + FOR(i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++) + { + if (p_output[i] != NULL) + { + //fixedToFloat_arrL(p_output_fx[i], p_output[i], 11, 960); + fixedToFloat_arrL(p_output_fx[i], p_output[i], 11, 960); + } + } + FOR(i = 0; i < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; i++) + { + if (p_tc[i] != NULL) + { + + fixedToFloat_arrL(p_tc_fx[i], p_tc[i], 11, 960); + } + } /* Rendering */ if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && !st_ivas->hDecoderConfig->Opt_Headrotation ) diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 6bcec446d138ad680623d3e33e9fdf3fc2dccb8d..60c23232de45cda2c4773e864dfac5c9acc3a772 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -35,6 +35,8 @@ #include #include "cnst.h" #include "prot.h" +#include "prot_fx1.h" +#include "prot_fx2.h" #ifdef IVAS_FLOAT_FIXED #include "prot_fx2.h" #include "ivas_prot_fx.h" @@ -48,7 +50,7 @@ #include "wmc_auto.h" #include "rom_dec.h" - +#ifdef IVAS_FLOAT_FIXED /*-----------------------------------------------------------------------* * Local arrays *-----------------------------------------------------------------------*/ @@ -62,21 +64,23 @@ const int16_t MC_PARAMUPMIX_CHIDX2[MC_PARAMUPMIX_COMBINATIONS] = { 2, 3, 6, 7 }; * Local function prototypes *-----------------------------------------------------------------------*/ -static void ps_pred_process_sf( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, DECODER_TC_BUFFER_HANDLE hTcBuffer, float qmf_mod_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_mod_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_side_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float qmf_side_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float *param_interpol, const int16_t ch, const int16_t slots_rendered ); +static void ps_pred_process_sf( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, DECODER_TC_BUFFER_HANDLE hTcBuffer, + Word32 qmf_mod_re_fx[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 qmf_mod_im_fx[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 qmf_side_re_fx[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 qmf_side_im_fx[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + Word16 *param_interpol_fx, const int16_t ch, const int16_t slots_rendered ); -static void ivas_mc_paramupmix_dec_sf( Decoder_Struct *st_ivas, float *output_f[MAX_OUTPUT_CHANNELS] ); +static void ivas_mc_paramupmix_dec_sf( Decoder_Struct *st_ivas, Word32 *output_fx[MAX_OUTPUT_CHANNELS]); static void ivas_param_upmix_dec_decorr_subframes( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering ); static int16_t huff_read( Decoder_State *st, const int16_t ( *ht )[2] ); -static void huffman_decode( Decoder_State *st, const PAR_TYPE parType, int32_t *vq ); +static void huffman_decode( Decoder_State *st, const PAR_TYPE parType, Word32 *vq ); -static void dequant_alpha( int32_t *vq, float *v ); +static void dequant_alpha(Word32 *vq, Word32 *v); -static void dequant_beta( int32_t *aq, int32_t *bq, float *beta ); +static void dequant_beta(Word32 *aq, Word32 *bq, Word32 *beta); -static void get_ec_data( Decoder_State *st, const PAR_TYPE parType, int32_t *parQ, int32_t *alphaQEnv, float ab[IVAS_MAX_NUM_BANDS] ); +static void get_ec_data(Decoder_State *st, const PAR_TYPE parType, Word32 *parQ, Word32 *alphaQEnv, Word32 ab[IVAS_MAX_NUM_BANDS]); /*------------------------------------------------------------------------- @@ -86,75 +90,76 @@ static void get_ec_data( Decoder_State *st, const PAR_TYPE parType, int32_t *par *------------------------------------------------------------------------*/ void ivas_mc_paramupmix_dec_read_BS( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - Decoder_State *st0, /* i/o: decoder state structure */ - MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ - int16_t *nb_bits /* o : number of bits written */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_State *st0, /* i/o: decoder state structure */ + MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, /* i/o: decoder MC Param-Upmix handle */ + Word16 *nb_bits /* o : number of bits written */ ) { - int16_t i, k; - int32_t alpha_quant[IVAS_MAX_NUM_BANDS]; - int16_t nb_bits_read_orig; - int16_t next_bit_pos_orig, last_bit_pos; - uint16_t bstr_meta[MAX_BITS_METADATA], *bit_stream_orig; - - push_wmops( "mc_paramupmix_read_bs" ); - *nb_bits = 0; - - if ( st0->bfi ) - { - for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) - { - for ( k = 0; k < IVAS_MAX_NUM_BANDS; k++ ) - { - hMCParamUpmix->alphas[i][k] = hMCParamUpmix->alpha_prev[i][k]; - hMCParamUpmix->betas[i][k] = hMCParamUpmix->beta_prev[i][k]; - } - } - hMCParamUpmix->first_frame = 1; - } - else /* if (!st->bfi) */ + Word16 i, k; + Word32 alpha_quant[IVAS_MAX_NUM_BANDS]; + Word16 nb_bits_read_orig; + Word16 next_bit_pos_orig, last_bit_pos; + UWord16 bstr_meta[MAX_BITS_METADATA], *bit_stream_orig; + + push_wmops("mc_paramupmix_read_bs"); + *nb_bits = 0; + + IF(st0->bfi) + { + FOR(i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++) { - bit_stream_orig = st0->bit_stream; - next_bit_pos_orig = st0->next_bit_pos; - last_bit_pos = (int16_t) ( ( st_ivas->hDecoderConfig->ivas_total_brate / FRAMES_PER_SEC ) - 1 ); - nb_bits_read_orig = 0; - last_bit_pos -= nb_bits_read_orig; /* reverse the bitstream for easier reading of indices */ - for ( i = 0; i < min( MAX_BITS_METADATA, last_bit_pos ); i++ ) - { - bstr_meta[i] = st_ivas->bit_stream[last_bit_pos - i]; - } - st0->bit_stream = bstr_meta; - st0->next_bit_pos = 0; - st0->bits_frame = min( MAX_BITS_METADATA, last_bit_pos + 1 ); - st0->total_brate = st_ivas->hDecoderConfig->ivas_total_brate; /* to avoid BER detect */ - - for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) - { - get_ec_data( st0, ALPHA, hMCParamUpmix->alpha_quant[i], alpha_quant, hMCParamUpmix->alphas[i] ); - - get_ec_data( st0, BETA, hMCParamUpmix->beta_quant[i], alpha_quant, hMCParamUpmix->betas[i] ); - } - *nb_bits += st0->next_bit_pos; - st0->bit_stream = bit_stream_orig; - st0->next_bit_pos = next_bit_pos_orig; - - if ( hMCParamUpmix->first_frame ) - { - for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) - { - mvr2r( hMCParamUpmix->alphas[i], hMCParamUpmix->alpha_prev[i], IVAS_MAX_NUM_BANDS ); - mvr2r( hMCParamUpmix->betas[i], hMCParamUpmix->beta_prev[i], IVAS_MAX_NUM_BANDS ); - } - hMCParamUpmix->first_frame = 0; - } + FOR(k = 0; k < IVAS_MAX_NUM_BANDS; k++) + { + hMCParamUpmix->alphas_fx[i][k] = hMCParamUpmix->alpha_prev_fx[i][k]; + hMCParamUpmix->betas_fx[i][k] = hMCParamUpmix->beta_prev_fx[i][k]; + } } - - pop_wmops(); - return; + hMCParamUpmix->first_frame = 1; + } + ELSE /* IF (!st->bfi) */ + { + bit_stream_orig = st0->bit_stream; + next_bit_pos_orig = st0->next_bit_pos; + last_bit_pos = (Word16)L_sub((st_ivas->hDecoderConfig->ivas_total_brate / FRAMES_PER_SEC), 1); + nb_bits_read_orig = 0; + last_bit_pos = sub(last_bit_pos, nb_bits_read_orig); /* reverse the bitstream for easier reading of indices */ + FOR(i = 0; i < s_min(MAX_BITS_METADATA, last_bit_pos); i++) + { + bstr_meta[i] = st_ivas->bit_stream[sub(last_bit_pos, i)]; + } + st0->bit_stream = bstr_meta; + st0->next_bit_pos = 0; + st0->bits_frame = s_min(MAX_BITS_METADATA, add(last_bit_pos, 1)); + st0->total_brate = st_ivas->hDecoderConfig->ivas_total_brate; /* to avoid BER detect */ + + FOR(i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++) + { + get_ec_data(st0, ALPHA, hMCParamUpmix->alpha_quant[i], alpha_quant, hMCParamUpmix->alphas_fx[i]); + + get_ec_data(st0, BETA, hMCParamUpmix->beta_quant[i], alpha_quant, hMCParamUpmix->betas_fx[i]); + } + *nb_bits = add(*nb_bits, st0->next_bit_pos); + st0->bit_stream = bit_stream_orig; + st0->next_bit_pos = next_bit_pos_orig; + + IF(hMCParamUpmix->first_frame) + { + FOR(i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++) + { + Copy32(hMCParamUpmix->alphas_fx[i], hMCParamUpmix->alpha_prev_fx[i], IVAS_MAX_NUM_BANDS); + Copy32(hMCParamUpmix->betas_fx[i], hMCParamUpmix->beta_prev_fx[i], IVAS_MAX_NUM_BANDS); + } + hMCParamUpmix->first_frame = 0; + } + } + + pop_wmops(); + return; } + /*------------------------------------------------------------------------- * ivas_mc_paramupmix_dec_digest_tc() * @@ -177,7 +182,7 @@ void ivas_mc_paramupmix_dec_digest_tc( /* adapt subframes */ ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); - ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hMCParamUpmix->param_interpolator ); + ivas_jbm_dec_get_adapted_linear_interpolator_fx( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hMCParamUpmix->param_interpolator_fx ); pop_wmops(); return; @@ -195,13 +200,13 @@ void ivas_mc_paramupmix_dec_render( const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ uint16_t *nSamplesRendered, /* o : number of CLDFB slots rendered */ uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ - float *input_f[], /* i : core-coder transport channels */ - float *output_f[] /* i/o: synthesized core-coder transport channels */ + Word32 *input_fx[], /* i : core-coder transport channels */ + Word32 *output_fx[] /* i/o: synthesized core-coder transport channels */ ) { int16_t slots_to_render, first_sf, last_sf, subframe_idx; uint16_t slot_size, ch; - float *output_f_local[MAX_OUTPUT_CHANNELS]; + Word32 *output_local_fx[MAX_OUTPUT_CHANNELS]; MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; hMCParamUpmix = st_ivas->hMCParamUpmix; @@ -211,7 +216,7 @@ void ivas_mc_paramupmix_dec_render( for ( ch = 0; ch < MAX_OUTPUT_CHANNELS; ch++ ) { - output_f_local[ch] = output_f[ch]; + output_local_fx[ch] = output_fx[ch]; } slot_size = st_ivas->hTcBuffer->n_samples_granularity; @@ -224,7 +229,7 @@ void ivas_mc_paramupmix_dec_render( for ( ch = 0; ch < MAX_TRANSPORT_CHANNELS; ch++ ) { - mvr2r( input_f[ch], output_f_local[ch], *nSamplesRendered ); + Copy32( input_fx[ch], output_local_fx[ch], *nSamplesRendered ); } while ( slots_to_render > 0 ) @@ -236,29 +241,28 @@ void ivas_mc_paramupmix_dec_render( for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) { - mvr2r( hMCParamUpmix->alpha_prev[ch], hMCParamUpmix->alpha_sf[ch], IVAS_MAX_NUM_BANDS ); - mvr2r( hMCParamUpmix->beta_prev[ch], hMCParamUpmix->beta_sf[ch], IVAS_MAX_NUM_BANDS ); + Copy32(hMCParamUpmix->alpha_prev_fx[ch], hMCParamUpmix->alpha_sf_fx[ch], IVAS_MAX_NUM_BANDS); + Copy32(hMCParamUpmix->beta_prev_fx[ch], hMCParamUpmix->beta_sf_fx[ch], IVAS_MAX_NUM_BANDS); } for ( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { int16_t n_samples_sf = slot_size * st_ivas->hTcBuffer->subframe_nbslots[subframe_idx]; - ivas_mc_paramupmix_dec_sf( st_ivas, output_f_local ); + ivas_mc_paramupmix_dec_sf( st_ivas, output_local_fx ); for ( ch = 0; ch < min( MAX_OUTPUT_CHANNELS, ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ) ); ch++ ) { - output_f_local[ch] += n_samples_sf; + output_local_fx[ch] += n_samples_sf; } /* update combined orientation access index */ ivas_combined_orientation_update_index( st_ivas->hCombinedOrientationData, n_samples_sf ); } - for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) { - mvr2r( hMCParamUpmix->alphas[ch], hMCParamUpmix->alpha_prev[ch], IVAS_MAX_NUM_BANDS ); - mvr2r( hMCParamUpmix->betas[ch], hMCParamUpmix->beta_prev[ch], IVAS_MAX_NUM_BANDS ); + Copy32(hMCParamUpmix->alphas_fx[ch], hMCParamUpmix->alpha_prev_fx[ch], IVAS_MAX_NUM_BANDS); + Copy32(hMCParamUpmix->betas_fx[ch], hMCParamUpmix->beta_prev_fx[ch], IVAS_MAX_NUM_BANDS); } } @@ -280,18 +284,19 @@ ivas_error ivas_mc_paramupmix_dec_open( ) { MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; - int32_t output_Fs; - int16_t nchan_transport; - uint16_t i; + Word32 output_Fs; + Word16 nchan_transport; + UWord16 i; ivas_error error; error = IVAS_ERR_OK; + /*-----------------------------------------------------------------* * prepare library opening *-----------------------------------------------------------------*/ - if ( ( hMCParamUpmix = (MC_PARAMUPMIX_DEC_HANDLE) malloc( sizeof( MC_PARAMUPMIX_DEC_DATA ) ) ) == NULL ) + IF( ( hMCParamUpmix = (MC_PARAMUPMIX_DEC_HANDLE) malloc( sizeof( MC_PARAMUPMIX_DEC_DATA ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param-Upmix MC\n" ) ); } @@ -300,16 +305,16 @@ ivas_error ivas_mc_paramupmix_dec_open( st_ivas->nchan_transport = MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; nchan_transport = st_ivas->nchan_transport; - switch ( nchan_transport ) + SWITCH( nchan_transport ) { case 8: st_ivas->nCPE = 4; st_ivas->nSCE = 0; st_ivas->element_mode_init = IVAS_CPE_MDCT; - break; + BREAK; } - hMCParamUpmix->hoa_encoder = NULL; + hMCParamUpmix->hoa_encoder_fx = NULL; /*-----------------------------------------------------------------* * set input parameters @@ -319,43 +324,41 @@ ivas_error ivas_mc_paramupmix_dec_open( for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) { -#ifdef IVAS_FLOAT_FIXED ivas_td_decorr_dec_open_fx( &( hMCParamUpmix->hTdDecorr[i] ), output_Fs, 2, 1 ); -#else - ivas_td_decorr_dec_open( &( hMCParamUpmix->hTdDecorr[i] ), output_Fs, 2, 1 ); -#endif } - for ( i = 0; i < MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; i++ ) + FOR( i = 0; i < MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; i++ ) { - if ( ( hMCParamUpmix->pcm_delay[i] = (float *) malloc( NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ) * sizeof( float ) ) ) == NULL ) + IF( ( hMCParamUpmix->pcm_delay_fx[i] = (Word32 *) malloc( NS2SA_fx2( output_Fs, IVAS_FB_DEC_DELAY_NS ) * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for delay buffer\n" ) ); } - set_zero( hMCParamUpmix->pcm_delay[i], NS2SA( output_Fs, IVAS_FB_DEC_DELAY_NS ) ); + set32_fx( hMCParamUpmix->pcm_delay_fx[i], 0, NS2SA_fx2( output_Fs, IVAS_FB_DEC_DELAY_NS ) ); } /* Head or external rotation */ - if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) + IF( ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) ) && ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) { - if ( ( hMCParamUpmix->hoa_encoder = (float *) malloc( st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof( float ) ) ) == NULL ) + + IF( ( hMCParamUpmix->hoa_encoder_fx = (Word32 *) malloc( st_ivas->hTransSetup.nchan_out_woLFE * MAX_INTERN_CHANNELS * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC\n" ) ); } - compute_hoa_encoder_mtx( st_ivas->hTransSetup.ls_azimuth, st_ivas->hTransSetup.ls_elevation, hMCParamUpmix->hoa_encoder, st_ivas->hTransSetup.nchan_out_woLFE, HEAD_ROTATION_HOA_ORDER ); + compute_hoa_encoder_mtx_fx( st_ivas->hTransSetup.ls_azimuth_fx, st_ivas->hTransSetup.ls_elevation_fx, hMCParamUpmix->hoa_encoder_fx, st_ivas->hTransSetup.nchan_out_woLFE, HEAD_ROTATION_HOA_ORDER ); + // compute_hoa_encoder_mtx( st_ivas->hTransSetup.ls_azimuth, st_ivas->hTransSetup.ls_elevation, hMCParamUpmix->hoa_encoder, st_ivas->hTransSetup.nchan_out_woLFE, HEAD_ROTATION_HOA_ORDER ); + Scale_sig32(hMCParamUpmix->hoa_encoder_fx, st_ivas->hTransSetup.nchan_out_woLFE*MAX_INTERN_CHANNELS, Q2);//Q29=>Q31 } /* allocate transport channels*/ hMCParamUpmix->free_param_interpolator = 0; - hMCParamUpmix->param_interpolator = NULL; - - if ( ( hMCParamUpmix->param_interpolator = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for interpolator\n" ) ); - } - hMCParamUpmix->free_param_interpolator = 1; - ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, DEFAULT_JBM_CLDFB_TIMESLOTS, hMCParamUpmix->param_interpolator ); + IF((hMCParamUpmix->param_interpolator_fx = (Word16 *)malloc(MAX_JBM_CLDFB_TIMESLOTS * sizeof(Word16))) == NULL) + { + return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for interpolator\n")); + } + hMCParamUpmix->free_param_interpolator = 1; + + ivas_jbm_dec_get_adapted_linear_interpolator_fx( DEFAULT_JBM_CLDFB_TIMESLOTS, DEFAULT_JBM_CLDFB_TIMESLOTS, hMCParamUpmix->param_interpolator_fx ); if ( st_ivas->hTcBuffer == NULL ) { @@ -378,11 +381,7 @@ ivas_error ivas_mc_paramupmix_dec_open( nchan_to_allocate = MC_PARAMUPMIX_MAX_INPUT_CHANS; } -#ifdef IVAS_FLOAT_FIXED if ( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -415,22 +414,22 @@ void ivas_mc_paramupmix_dec_close( } for ( i = 0; i < MC_PARAMUPMIX_MAX_TRANSPORT_CHANS; i++ ) { - if ( ( *hMCParamUpmix )->pcm_delay[i] != NULL ) + IF( ( *hMCParamUpmix )->pcm_delay_fx[i] != NULL ) { - free( ( *hMCParamUpmix )->pcm_delay[i] ); + free( ( *hMCParamUpmix )->pcm_delay_fx[i] ); } } - if ( ( *hMCParamUpmix )->param_interpolator != NULL ) + if ((*hMCParamUpmix)->param_interpolator_fx != NULL) { - if ( ( *hMCParamUpmix )->free_param_interpolator == 1 ) - { - free( ( *hMCParamUpmix )->param_interpolator ); - } + if ((*hMCParamUpmix)->free_param_interpolator == 1) + { + free((*hMCParamUpmix)->param_interpolator_fx); + } } - if ( ( *hMCParamUpmix )->hoa_encoder != NULL ) + if ((*hMCParamUpmix)->hoa_encoder_fx != NULL) { - free( ( *hMCParamUpmix )->hoa_encoder ); - ( *hMCParamUpmix )->hoa_encoder = NULL; + free((*hMCParamUpmix)->hoa_encoder_fx); + (*hMCParamUpmix)->hoa_encoder_fx = NULL; } free( *hMCParamUpmix ); @@ -439,7 +438,7 @@ void ivas_mc_paramupmix_dec_close( return; } -#ifdef IVAS_FLOAT_FIXED + /*------------------------------------------------------------------------- * paramupmix_td_decorr_process_jbm_fx() * @@ -494,59 +493,6 @@ static void paramupmix_td_decorr_process_jbm_fx( return; } -#else -/*------------------------------------------------------------------------- - * paramupmix_td_decorr_process_jbm() - * - * - *------------------------------------------------------------------------*/ - -static void paramupmix_td_decorr_process_jbm( - ivas_td_decorr_state_t *hTdDecorr[], /* i/o: SPAR Covar. decoder handle */ - float *pcm_in[], /* i : input audio channels */ - float **pp_out_pcm, /* o : output audio channels */ - const int16_t output_frame /* i : output frame length */ -) -{ - int16_t j, k; - int16_t offset; - float in_duck_gain[L_FRAME48k], out_duck_gain[L_FRAME48k]; - - offset = (int16_t) ( output_frame * FRAMES_PER_SEC * IVAS_DECORR_PARM_LOOKAHEAD_TAU ); - - /* Look-ahead delay */ - for ( k = 0; k < MC_PARAMUPMIX_COMBINATIONS; k++ ) - { - mvr2r( pcm_in[k], pp_out_pcm[k], output_frame ); - delay_signal_float( pp_out_pcm[k], output_frame, hTdDecorr[k]->look_ahead_buf, offset ); - - /* In ducking gains */ - if ( hTdDecorr[k]->ducking_flag ) - { - ivas_td_decorr_get_ducking_gains( hTdDecorr[k]->pTrans_det, pcm_in[k], in_duck_gain, out_duck_gain, output_frame, 0 ); - - for ( j = 0; j < output_frame; j++ ) - { - pp_out_pcm[k][j] = pp_out_pcm[k][j] * in_duck_gain[j]; - } - } - - /* All pass delay section */ - ivas_td_decorr_APD_iir_filter( &hTdDecorr[k]->APD_filt_state[0], pp_out_pcm[k], hTdDecorr[k]->num_apd_sections, output_frame ); - - /* Out ducking gains */ - if ( hTdDecorr[k]->ducking_flag ) - { - for ( j = 0; j < output_frame; j++ ) - { - pp_out_pcm[k][j] = pp_out_pcm[k][j] * out_duck_gain[j]; - } - } - } - - return; -} -#endif /*------------------------------------------------------------------------- * ivas_param_upmix_dec_decorr_subframes() @@ -559,8 +505,8 @@ static void ivas_param_upmix_dec_decorr_subframes( const int16_t nSamplesForRendering ) { MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; - float *pPcm_tmp[MC_PARAMUPMIX_COMBINATIONS]; - float *p_tc[MC_PARAMUPMIX_COMBINATIONS]; + Word32 *pPcm_tmp_fx[MC_PARAMUPMIX_COMBINATIONS]; + Word32 *p_tc_fx[MC_PARAMUPMIX_COMBINATIONS]; int16_t nchan_internal, ch; int16_t nSamplesLeftForTD, default_frame; @@ -576,60 +522,32 @@ static void ivas_param_upmix_dec_decorr_subframes( for ( ch = 0; ch < nchan_internal; ch++ ) { - pPcm_tmp[ch] = st_ivas->hTcBuffer->tc[ch + 8]; - p_tc[ch] = st_ivas->hTcBuffer->tc[ch + 4]; + pPcm_tmp_fx[ch] = st_ivas->hTcBuffer->tc_fx[ch + 8]; + p_tc_fx[ch] = st_ivas->hTcBuffer->tc_fx[ch + 4]; } while ( nSamplesLeftForTD ) { int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); -#ifdef IVAS_FLOAT_FIXED { - Word32 *pPcm_tmp_fx[MC_PARAMUPMIX_COMBINATIONS]; - Word32 *p_tc_fx[MC_PARAMUPMIX_COMBINATIONS]; - Word32 tmp_fx[MC_PARAMUPMIX_COMBINATIONS][L_FRAME48k]; - Word32 tc_fx[MC_PARAMUPMIX_COMBINATIONS][L_FRAME48k]; - Word32 i, j, q_format[MC_PARAMUPMIX_COMBINATIONS]; + Word32 i, q_format[MC_PARAMUPMIX_COMBINATIONS]; FOR( i = 0; i < nchan_internal; i++ ) { - pPcm_tmp_fx[i] = tmp_fx[i]; - p_tc_fx[i] = tc_fx[i]; - q_format[i] = Q14; - FOR( j = 0; j < nSamplesToDecorr; j++ ) - { - pPcm_tmp_fx[i][j] = (Word32) ( pPcm_tmp[i][j] * ( 1 << q_format[i] ) ); - p_tc_fx[i][j] = (Word32) ( p_tc[i][j] * ( 1 << q_format[i] ) ); - } + q_format[i] = Q11; } paramupmix_td_decorr_process_jbm_fx( hMCParamUpmix->hTdDecorr, p_tc_fx, pPcm_tmp_fx, nSamplesToDecorr, q_format ); FOR( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) { - FOR( j = 0; j < nSamplesToDecorr; j++ ) - { - pPcm_tmp[i][j] = pPcm_tmp_fx[i][j] / (float) ( 1 << q_format[i] ); - } -#ifdef DUMPS_ENABLED - dbgwrite_txt( pp_out_pcm[k], nSamplesToDecorr, "fixed.txt", NULL ); -#endif + Scale_sig32(pPcm_tmp_fx[i], nSamplesToDecorr, Q11- q_format[i]); } } -#else - paramupmix_td_decorr_process_jbm( hMCParamUpmix->hTdDecorr, p_tc, pPcm_tmp, nSamplesToDecorr ); - -#ifdef DUMPS_ENABLED - for ( j = 0; j < MC_PARAMUPMIX_COMBINATIONS; j++ ) - { - dbgwrite_txt( pp_out_pcm[k], nSamplesToDecorr, "float.txt", NULL ); - } -#endif -#endif for ( ch = 0; ch < nchan_internal; ch++ ) { - p_tc[ch] += nSamplesToDecorr; + p_tc_fx[ch] += nSamplesToDecorr; } nSamplesLeftForTD -= nSamplesToDecorr; @@ -647,26 +565,27 @@ static void ivas_param_upmix_dec_decorr_subframes( static void ps_pred_process_sf( MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix, DECODER_TC_BUFFER_HANDLE hTcBuffer, - float qmf_mod_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* in/out */ - float qmf_mod_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float qmf_side_re[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* in/out */ - float qmf_side_im[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], - float *param_interpol, + Word32 qmf_mod_re_fx[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* in/out */ + Word32 qmf_mod_im_fx[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + Word32 qmf_side_re_fx[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* in/out */ + Word32 qmf_side_im_fx[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], + Word16 *param_interpol_fx, const int16_t ch, const int16_t slots_rendered ) { - float vmre, vmim, vsre, vsim; + Word32 vmre_fx, vmim_fx, vsre_fx, vsim_fx; int16_t iqmf, ipar, ismp, iismp; - float alpha_smp, beta_smp; - float *alpha1, *alpha2; - float *beta1, *beta2; - float *alpha_prev = hMCParamUpmix->alpha_prev[ch]; - float *beta_prev = hMCParamUpmix->beta_prev[ch]; - float *alpha_sf = hMCParamUpmix->alpha_sf[ch]; - float *beta_sf = hMCParamUpmix->beta_sf[ch]; - float dalpha, dbeta, ifac; - float alpha_start[IVAS_MAX_NUM_BANDS], beta_start[IVAS_MAX_NUM_BANDS]; - + Word32 alpha_smp_fx, beta_smp_fx; + Word32 *alpha1_fx, *alpha2_fx; + Word32 *beta1_fx, *beta2_fx; + Word32 *alpha_prev_fx = hMCParamUpmix->alpha_prev_fx[ch]; + Word32 *beta_prev_fx = hMCParamUpmix->beta_prev_fx[ch]; + Word32 *alpha_sf_fx = hMCParamUpmix->alpha_sf_fx[ch]; + Word32 *beta_sf_fx = hMCParamUpmix->beta_sf_fx[ch]; + Word32 dalpha_fx, dbeta_fx; + Word16 ifac_fx; + Word32 alpha_start_fx[IVAS_MAX_NUM_BANDS], beta_start_fx[IVAS_MAX_NUM_BANDS]; + Word32 res_a, res_b; const int16_t qmf_to_par_band[] = { 0, 1, 2, 3, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, @@ -676,48 +595,53 @@ static void ps_pred_process_sf( 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 }; - mvr2r( alpha_sf, alpha_start, IVAS_MAX_NUM_BANDS ); - mvr2r( beta_sf, beta_start, IVAS_MAX_NUM_BANDS ); + Copy32(alpha_sf_fx, alpha_start_fx, IVAS_MAX_NUM_BANDS); + Copy32(beta_sf_fx, beta_start_fx, IVAS_MAX_NUM_BANDS); for ( iqmf = 0; iqmf < CLDFB_NO_CHANNELS_MAX; iqmf++ ) { ipar = qmf_to_par_band[iqmf]; - alpha1 = alpha_prev; - beta1 = beta_prev; + alpha1_fx = alpha_prev_fx; + beta1_fx = beta_prev_fx; ismp = 0; - alpha2 = hMCParamUpmix->alphas[ch]; - beta2 = hMCParamUpmix->betas[ch]; - alpha_smp = alpha_start[ipar]; - beta_smp = beta_start[ipar]; + alpha2_fx = hMCParamUpmix->alphas_fx[ch]; + beta2_fx = hMCParamUpmix->betas_fx[ch]; + alpha_smp_fx = alpha_start_fx[ipar]; + beta_smp_fx = beta_start_fx[ipar]; for ( iismp = 0; iismp < hTcBuffer->subframe_nbslots[hTcBuffer->subframes_rendered]; iismp++ ) { if ( ( slots_rendered == 0 ) && ( iismp == 0 ) ) { - ifac = param_interpol[iismp]; + ifac_fx = param_interpol_fx[iismp]; } else { - ifac = param_interpol[iismp] - param_interpol[iismp - 1]; + ifac_fx = sub(param_interpol_fx[iismp], param_interpol_fx[iismp - 1]); } - dalpha = ( alpha2[ipar] - alpha1[ipar] ) * ifac; - dbeta = ( beta2[ipar] - beta1[ipar] ) * ifac; + dalpha_fx = Mpy_32_16_1(L_sub( alpha2_fx[ipar], alpha1_fx[ipar] ), ifac_fx); + dbeta_fx = Mpy_32_16_1(L_sub( beta2_fx[ipar], beta1_fx[ipar] ), ifac_fx); - alpha_smp += dalpha; - beta_smp += dbeta; + alpha_smp_fx = L_add(alpha_smp_fx, dalpha_fx); + beta_smp_fx = L_add(dbeta_fx, beta_smp_fx); - vmre = qmf_mod_re[ismp][iqmf]; - vmim = qmf_mod_im[ismp][iqmf]; - vsre = qmf_side_re[ismp][iqmf]; - vsim = qmf_side_im[ismp][iqmf]; + vmre_fx = qmf_mod_re_fx[ismp][iqmf]; + vmim_fx = qmf_mod_im_fx[ismp][iqmf]; + vsre_fx = qmf_side_re_fx[ismp][iqmf]; + vsim_fx = qmf_side_im_fx[ismp][iqmf]; - qmf_side_re[ismp][iqmf] = alpha_smp * vmre + beta_smp * vsre; - qmf_side_im[ismp][iqmf] = alpha_smp * vmim + beta_smp * vsim; + res_a = L_shl_sat(Mpy_32_32(alpha_smp_fx, vmre_fx), Q31 - Q28); + res_b = L_shl_sat(Mpy_32_32(beta_smp_fx, vsre_fx), Q31 - Q28); + qmf_side_re_fx[ismp][iqmf] = L_add_sat(res_a, res_b); + + res_a = L_shl_sat(Mpy_32_32(alpha_smp_fx, vmim_fx), Q31 - Q28); + res_b = L_shl_sat(Mpy_32_32(beta_smp_fx, vsim_fx), Q31 - Q28); + qmf_side_re_fx[ismp][iqmf] = L_add_sat(res_a, res_b); ismp++; } - alpha_sf[ipar] = alpha_smp; - beta_sf[ipar] = beta_smp; + alpha_sf_fx[ipar] = alpha_smp_fx; + beta_sf_fx[ipar] = beta_smp_fx; } return; @@ -726,21 +650,22 @@ static void ps_pred_process_sf( static void ivas_mc_paramupmix_dec_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float *output_f[MAX_OUTPUT_CHANNELS] /* i/o: synthesized core-coder transport channels */ + Word32 *output_fx[MAX_OUTPUT_CHANNELS] /* i/o: synthesized core-coder transport channels */ ) { int16_t i, ch, slot_idx, k; - float *pPcm_temp[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ + Word32 *pPcm_temp_fx[MC_PARAMUPMIX_COMBINATIONS * 2]; /* decorrelated and undecorrelated*/ /*CLDFB*/ - float Cldfb_RealBuffer[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_RealBuffer_fx[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX] = { 0 }; + Word32 Cldfb_ImagBuffer_fx[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS][JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX] = { 0 }; + int16_t noparamupmix_delay, n_samples_rendered; MC_PARAMUPMIX_DEC_HANDLE hMCParamUpmix; int16_t subframeIdx, idx_in, maxBand; - float Cldfb_RealBuffer_subfr[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_subfr[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_RealBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_ImagBuffer_subfr_fx[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_RealBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; + Word32 Cldfb_ImagBuffer_Binaural_fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; hMCParamUpmix = st_ivas->hMCParamUpmix; assert( hMCParamUpmix ); @@ -748,8 +673,8 @@ static void ivas_mc_paramupmix_dec_sf( for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) { - pPcm_temp[2 * i] = output_f[i + 4]; /* un-decorrelated */ - pPcm_temp[2 * i + 1] = output_f[i + 8]; /* decorrelated */ + pPcm_temp_fx[2 * i] = output_fx[i + 4]; /* un-decorrelated */ + pPcm_temp_fx[2 * i + 1] = output_fx[i + 8]; /* decorrelated */ } /* CLDFB Analysis*/ @@ -758,18 +683,26 @@ static void ivas_mc_paramupmix_dec_sf( /* slot loop for gathering the input data */ for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ ) { - cldfbAnalysis_ts_ivas( &( pPcm_temp[ch][hMCParamUpmix->num_freq_bands * slot_idx] ), Cldfb_RealBuffer[ch][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], hMCParamUpmix->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); + for (i = 0; i < st_ivas->cldfbAnaDec[ch]->p_filter_length - st_ivas->cldfbAnaDec[ch]->no_channels; i++) { + st_ivas->cldfbAnaDec[ch]->cldfb_state_fx[i] = (Word32)(st_ivas->cldfbAnaDec[ch]->cldfb_state[i] * (1LL << (11))); + } + Word16 q_cldfb = 11; + cldfbAnalysis_ts_fx_fixed_q( &( pPcm_temp_fx[ch][hMCParamUpmix->num_freq_bands * slot_idx] ), Cldfb_RealBuffer_fx[ch][slot_idx], Cldfb_ImagBuffer_fx[ch][slot_idx], hMCParamUpmix->num_freq_bands, st_ivas->cldfbAnaDec[ch], &q_cldfb); + for (i = 0; i < st_ivas->cldfbAnaDec[ch]->p_filter_length - st_ivas->cldfbAnaDec[ch]->no_channels; i++) { + st_ivas->cldfbAnaDec[ch]->cldfb_state[i] = ((float)st_ivas->cldfbAnaDec[ch]->cldfb_state_fx[i]/ (1LL << (11))); + } } } + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) { ps_pred_process_sf( hMCParamUpmix, st_ivas->hTcBuffer, - Cldfb_RealBuffer[2 * ch], /* in/out */ - Cldfb_ImagBuffer[2 * ch], - Cldfb_RealBuffer[2 * ch + 1], /* in/out decorr */ - Cldfb_ImagBuffer[2 * ch + 1], - &hMCParamUpmix->param_interpolator[st_ivas->hTcBuffer->slots_rendered], + Cldfb_RealBuffer_fx[2 * ch], /* in/out */ + Cldfb_ImagBuffer_fx[2 * ch], + Cldfb_RealBuffer_fx[2 * ch + 1], /* in/out decorr */ + Cldfb_ImagBuffer_fx[2 * ch + 1], + &hMCParamUpmix->param_interpolator_fx[st_ivas->hTcBuffer->slots_rendered], ch, st_ivas->hTcBuffer->slots_rendered ); @@ -778,15 +711,15 @@ static void ivas_mc_paramupmix_dec_sf( { for ( k = 0; k < CLDFB_NO_CHANNELS_MAX; k++ ) { - float qlre = Cldfb_RealBuffer[2 * ch][slot_idx][k]; - float qlim = Cldfb_ImagBuffer[2 * ch][slot_idx][k]; - float qrre = Cldfb_RealBuffer[2 * ch + 1][slot_idx][k]; - float qrim = Cldfb_ImagBuffer[2 * ch + 1][slot_idx][k]; - - Cldfb_RealBuffer[2 * ch][slot_idx][k] = qlre + qrre; - Cldfb_ImagBuffer[2 * ch][slot_idx][k] = qlim + qrim; - Cldfb_RealBuffer[2 * ch + 1][slot_idx][k] = qlre - qrre; - Cldfb_ImagBuffer[2 * ch + 1][slot_idx][k] = qlim - qrim; + Word32 qlre_fx = Cldfb_RealBuffer_fx[2 * ch][slot_idx][k]; + Word32 qlim_fx = Cldfb_ImagBuffer_fx[2 * ch][slot_idx][k]; + Word32 qrre_fx = Cldfb_RealBuffer_fx[2 * ch + 1][slot_idx][k]; + Word32 qrim_fx = Cldfb_ImagBuffer_fx[2 * ch + 1][slot_idx][k]; + + Cldfb_RealBuffer_fx[2 * ch][slot_idx][k] = L_add_sat(qlre_fx, qrre_fx); + Cldfb_ImagBuffer_fx[2 * ch][slot_idx][k] = L_add_sat(qlim_fx, qrim_fx); + Cldfb_RealBuffer_fx[2 * ch + 1][slot_idx][k] = L_sub_sat(qlre_fx, qrre_fx); + Cldfb_ImagBuffer_fx[2 * ch + 1][slot_idx][k] = L_sub_sat(qlim_fx, qrim_fx); } } } @@ -802,28 +735,37 @@ static void ivas_mc_paramupmix_dec_sf( { if ( st_ivas->hIntSetup.index_lfe[0] != ch ) { - pPcm_temp[ch] = output_f[ch]; + pPcm_temp_fx[ch] = output_fx[ch]; /* slot loop for gathering the input data */ for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ ) { - cldfbAnalysis_ts_ivas( &( pPcm_temp[ch][hMCParamUpmix->num_freq_bands * slot_idx] ), - Cldfb_RealBuffer_subfr[idx_in][slot_idx], - Cldfb_ImagBuffer_subfr[idx_in][slot_idx], - maxBand, st_ivas->cldfbAnaDec[2 * MC_PARAMUPMIX_COMBINATIONS + idx_in] ); + for (i = 0; i < st_ivas->cldfbAnaDec[ch]->p_filter_length - st_ivas->cldfbAnaDec[ch]->no_channels; i++) { + st_ivas->cldfbAnaDec[2 * MC_PARAMUPMIX_COMBINATIONS + idx_in]->cldfb_state_fx[i] = (Word32)(st_ivas->cldfbAnaDec[2 * MC_PARAMUPMIX_COMBINATIONS + idx_in]->cldfb_state[i] * (1LL << (11))); + } + Word16 q_cldfb = 11; + + cldfbAnalysis_ts_fx_fixed_q(&(pPcm_temp_fx[ch][hMCParamUpmix->num_freq_bands * slot_idx]), + Cldfb_RealBuffer_subfr_fx[idx_in][slot_idx], + Cldfb_ImagBuffer_subfr_fx[idx_in][slot_idx], + maxBand, st_ivas->cldfbAnaDec[2 * MC_PARAMUPMIX_COMBINATIONS + idx_in],&q_cldfb); + for (i = 0; i < st_ivas->cldfbAnaDec[ch]->p_filter_length - st_ivas->cldfbAnaDec[ch]->no_channels; i++) { + st_ivas->cldfbAnaDec[2 * MC_PARAMUPMIX_COMBINATIONS + idx_in]->cldfb_state[i] = ((float)st_ivas->cldfbAnaDec[2 * MC_PARAMUPMIX_COMBINATIONS + idx_in]->cldfb_state_fx[i]/ (1LL << (11))); + } } idx_in++; } } + /* copy and reorder cldfb analysis of coupled channels */ for ( ch = 0; ch < MAX_PARAM_SPATIAL_SUBFRAMES; ch++ ) { for ( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ ) { - mvr2r( Cldfb_RealBuffer[MC_PARAMUPMIX_CHIDX1[ch]][slot_idx], Cldfb_RealBuffer_subfr[idx_in][slot_idx], CLDFB_NO_CHANNELS_MAX ); - mvr2r( Cldfb_ImagBuffer[MC_PARAMUPMIX_CHIDX1[ch]][slot_idx], Cldfb_ImagBuffer_subfr[idx_in][slot_idx], CLDFB_NO_CHANNELS_MAX ); - mvr2r( Cldfb_RealBuffer[MC_PARAMUPMIX_CHIDX2[ch]][slot_idx], Cldfb_RealBuffer_subfr[idx_in + 1][slot_idx], CLDFB_NO_CHANNELS_MAX ); - mvr2r( Cldfb_ImagBuffer[MC_PARAMUPMIX_CHIDX2[ch]][slot_idx], Cldfb_ImagBuffer_subfr[idx_in + 1][slot_idx], CLDFB_NO_CHANNELS_MAX ); + Copy32(Cldfb_RealBuffer_fx[MC_PARAMUPMIX_CHIDX1[ch]][slot_idx], Cldfb_RealBuffer_subfr_fx[idx_in][slot_idx], CLDFB_NO_CHANNELS_MAX); + Copy32(Cldfb_ImagBuffer_fx[MC_PARAMUPMIX_CHIDX1[ch]][slot_idx], Cldfb_ImagBuffer_subfr_fx[idx_in][slot_idx], CLDFB_NO_CHANNELS_MAX); + Copy32(Cldfb_RealBuffer_fx[MC_PARAMUPMIX_CHIDX2[ch]][slot_idx], Cldfb_RealBuffer_subfr_fx[idx_in + 1][slot_idx], CLDFB_NO_CHANNELS_MAX); + Copy32(Cldfb_ImagBuffer_fx[MC_PARAMUPMIX_CHIDX2[ch]][slot_idx], Cldfb_ImagBuffer_subfr_fx[idx_in + 1][slot_idx], CLDFB_NO_CHANNELS_MAX); } idx_in += 2; } @@ -832,60 +774,107 @@ static void ivas_mc_paramupmix_dec_sf( { for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ ) { - ivas_param_mc_mc2sba_cldfb( st_ivas->hTransSetup, hMCParamUpmix->hoa_encoder, slot_idx, Cldfb_RealBuffer_subfr, Cldfb_ImagBuffer_subfr, maxBand, GAIN_LFE ); + ivas_param_mc_mc2sba_cldfb_fx( st_ivas->hTransSetup, hMCParamUpmix->hoa_encoder_fx, slot_idx, Cldfb_RealBuffer_subfr_fx, Cldfb_ImagBuffer_subfr_fx, maxBand, GAIN_LFE_FX); } } - /* Implement binaural rendering */ - ivas_binRenderer( st_ivas->hBinRenderer, - st_ivas->hCombinedOrientationData, - st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], - Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - Cldfb_RealBuffer_subfr, - Cldfb_ImagBuffer_subfr ); + //to be deleted + if (st_ivas->hCombinedOrientationData) + { + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + + st_ivas->hCombinedOrientationData->Rmat_fx[st_ivas->hCombinedOrientationData->subframe_idx][i][j] = (Word32)float_to_fix(st_ivas->hCombinedOrientationData->Rmat[st_ivas->hCombinedOrientationData->subframe_idx][i][j], 30); + } + } + } + /* Implement binaural rendering */ + Word32 input_q = 6; + /* Implement binaural rendering */ + ivas_binRenderer_fx(st_ivas->hBinRenderer, + st_ivas->hCombinedOrientationData, + st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], + Cldfb_RealBuffer_Binaural_fx, Cldfb_ImagBuffer_Binaural_fx, + Cldfb_RealBuffer_subfr_fx, + Cldfb_ImagBuffer_subfr_fx,&input_q); + + for (int idx1 = 0; idx1 < BINAURAL_CHANNELS; idx1++) + { + for (int idx2 = 0; idx2 < MAX_PARAM_SPATIAL_SUBFRAMES; idx2++) + { + Scale_sig32(Cldfb_RealBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, 6- input_q); + Scale_sig32(Cldfb_ImagBuffer_Binaural_fx[idx1][idx2], CLDFB_NO_CHANNELS_MAX, 6- input_q); + } + } /* Implement CLDFB synthesis */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { - float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; - float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; + Word32 *RealBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; + Word32 *ImagBuffer_fx[MAX_PARAM_SPATIAL_SUBFRAMES]; for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[subframeIdx]; slot_idx++ ) { - RealBuffer[slot_idx] = Cldfb_RealBuffer_Binaural[ch][slot_idx]; - ImagBuffer[slot_idx] = Cldfb_ImagBuffer_Binaural[ch][slot_idx]; + RealBuffer_fx[slot_idx] = Cldfb_RealBuffer_Binaural_fx[ch][slot_idx]; + ImagBuffer_fx[slot_idx] = Cldfb_ImagBuffer_Binaural_fx[ch][slot_idx]; + } + for (i = 0; i < st_ivas->cldfbSynDec[ch]->p_filter_length; i++) { + st_ivas->cldfbSynDec[ch]->cldfb_state_fx[i] = (Word32)(st_ivas->cldfbSynDec[ch]->cldfb_state[i] * (1LL << (5))); + } + cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch][0] ), maxBand * st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], st_ivas->cldfbSynDec[ch] ); + for (i = 0; i < st_ivas->cldfbSynDec[ch]->p_filter_length; i++) + { + st_ivas->cldfbSynDec[ch]->cldfb_state[i] = ((float)st_ivas->cldfbSynDec[ch]->cldfb_state_fx[i] / (1LL << (5))); } - - cldfbSynthesis_ivas( RealBuffer, ImagBuffer, &( output_f[ch][0] ), maxBand * st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], st_ivas->cldfbSynDec[ch] ); + } + for (ch = 0; ch < BINAURAL_CHANNELS; ch++) + { + Scale_sig32(output_fx[ch], maxBand * st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], 6); } } else { /* boxes = { 0 1 2 3 [4 6] [5 7] [8 10] [9 11] }; */ - pPcm_temp[0] = output_f[4]; - pPcm_temp[1] = output_f[6]; - pPcm_temp[2] = output_f[5]; - pPcm_temp[3] = output_f[7]; - pPcm_temp[4] = output_f[8]; - pPcm_temp[5] = output_f[10]; - pPcm_temp[6] = output_f[9]; - pPcm_temp[7] = output_f[11]; + pPcm_temp_fx[0] = output_fx[4]; + pPcm_temp_fx[1] = output_fx[6]; + pPcm_temp_fx[2] = output_fx[5]; + pPcm_temp_fx[3] = output_fx[7]; + pPcm_temp_fx[4] = output_fx[8]; + pPcm_temp_fx[5] = output_fx[10]; + pPcm_temp_fx[6] = output_fx[9]; + pPcm_temp_fx[7] = output_fx[11]; /* CLDFB synthesis */ for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS * 2; ch++ ) { for ( slot_idx = 0; slot_idx < st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; slot_idx++ ) { - float *ptr_im[1], *ptr_re[1]; - ptr_re[0] = Cldfb_RealBuffer[ch][slot_idx]; - ptr_im[0] = Cldfb_ImagBuffer[ch][slot_idx]; + Word32 *ptr_im_fx[1], *ptr_re_fx[1]; + + ptr_re_fx[0] = Cldfb_RealBuffer_fx[ch][slot_idx]; + ptr_im_fx[0] = Cldfb_ImagBuffer_fx[ch][slot_idx]; - cldfbSynthesis_ivas( ptr_re, ptr_im, &( pPcm_temp[ch][hMCParamUpmix->num_freq_bands * slot_idx] ), - hMCParamUpmix->num_freq_bands, st_ivas->cldfbSynDec[ch] ); + for (i = 0; i < st_ivas->cldfbSynDec[ch]->p_filter_length; i++) { + st_ivas->cldfbSynDec[ch]->cldfb_state_fx[i] = (Word32)(st_ivas->cldfbSynDec[ch]->cldfb_state[i] * (1LL << (5))); + } + + cldfbSynthesis_ivas_fx(ptr_re_fx, ptr_im_fx, &(pPcm_temp_fx[ch][hMCParamUpmix->num_freq_bands * slot_idx]), + hMCParamUpmix->num_freq_bands, st_ivas->cldfbSynDec[ch]); + for (i = 0; i < st_ivas->cldfbSynDec[ch]->p_filter_length; i++) + { + st_ivas->cldfbSynDec[ch]->cldfb_state[i] = ((float)st_ivas->cldfbSynDec[ch]->cldfb_state_fx[i] / (1LL << (5))); + } } } + //Done to keep entire buffer in q11 + for (ch = 4; ch < 12; ch++) + { + Scale_sig32(output_fx[ch], hMCParamUpmix->num_freq_bands * st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered], 6); + } /* adjust delay of other channels */ noparamupmix_delay = NS2SA( st_ivas->hDecoderConfig->output_Fs, IVAS_FB_DEC_DELAY_NS ); n_samples_rendered = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered] * hMCParamUpmix->num_freq_bands; @@ -893,24 +882,25 @@ static void ivas_mc_paramupmix_dec_sf( { for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) { - float tmp_buf[L_SUBFRAME5MS_48k]; - mvr2r( &output_f[ch][n_samples_rendered - noparamupmix_delay], tmp_buf, noparamupmix_delay ); - mvr2r( output_f[ch], &output_f[ch][noparamupmix_delay], n_samples_rendered - noparamupmix_delay ); - mvr2r( hMCParamUpmix->pcm_delay[ch], output_f[ch], noparamupmix_delay ); - mvr2r( tmp_buf, hMCParamUpmix->pcm_delay[ch], noparamupmix_delay ); + Word32 tmp_buf_fx[L_SUBFRAME5MS_48k]; + Copy32(&output_fx[ch][n_samples_rendered - noparamupmix_delay], tmp_buf_fx, noparamupmix_delay); + Copy32(output_fx[ch], &output_fx[ch][noparamupmix_delay], n_samples_rendered - noparamupmix_delay); + Copy32(hMCParamUpmix->pcm_delay_fx[ch], output_fx[ch], noparamupmix_delay); + Copy32(tmp_buf_fx, hMCParamUpmix->pcm_delay_fx[ch], noparamupmix_delay); } } else { for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) { - float tmp_buf[L_SUBFRAME5MS_48k]; - mvr2r( &output_f[ch][0], tmp_buf, n_samples_rendered ); - mvr2r( hMCParamUpmix->pcm_delay[ch], output_f[ch], n_samples_rendered ); - mvr2r( &hMCParamUpmix->pcm_delay[ch][n_samples_rendered], &hMCParamUpmix->pcm_delay[ch][0], noparamupmix_delay - n_samples_rendered ); - mvr2r( tmp_buf, &hMCParamUpmix->pcm_delay[ch][noparamupmix_delay - n_samples_rendered], n_samples_rendered ); + Word32 tmp_buf_fx[L_SUBFRAME5MS_48k]; + Copy32(&output_fx[ch][0], tmp_buf_fx, n_samples_rendered); + Copy32(hMCParamUpmix->pcm_delay_fx[ch], output_fx[ch], n_samples_rendered); + Copy32(&hMCParamUpmix->pcm_delay_fx[ch][n_samples_rendered], &hMCParamUpmix->pcm_delay_fx[ch][0], noparamupmix_delay - n_samples_rendered); + Copy32(tmp_buf_fx, &hMCParamUpmix->pcm_delay_fx[ch][noparamupmix_delay - n_samples_rendered], n_samples_rendered); } } + } st_ivas->hTcBuffer->slots_rendered += st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered]; @@ -921,135 +911,138 @@ static void ivas_mc_paramupmix_dec_sf( } -static int16_t huff_read( - Decoder_State *st, - const int16_t ( *ht )[2] ) +static Word16 huff_read( + Decoder_State *st, + const Word16(*ht)[2]) { - int16_t node = 0; - uint16_t next_bit = 0; - - do - { - next_bit = st->bit_stream[st->next_bit_pos]; - st->next_bit_pos++; - node = ht[node][next_bit]; - } while ( node > 0 ); - - return -( node + 1 ); + Word16 node = 0; + UWord16 next_bit = 0; + + DO + { + next_bit = st->bit_stream[st->next_bit_pos]; + st->next_bit_pos++; + node = ht[node][next_bit]; + } + WHILE(GT_16(node, 0)); + + return negate(add(node, 1)); } static void huffman_decode( - Decoder_State *st, - const PAR_TYPE parType, - int32_t *vq ) + Decoder_State *st, + const PAR_TYPE parType, + Word32 *vq) { - const int16_t( *huff_node_table )[2]; - int16_t iv, nquant, offset; + const Word16(*huff_node_table)[2]; + Word16 iv, nquant, offset; - nquant = 0; - switch ( parType ) - { + nquant = 0; + SWITCH(parType) + { case ALPHA: - nquant = ivas_mc_paramupmix_alpha_quant_table.nquant; - break; + nquant = ivas_mc_paramupmix_alpha_quant_table_fx.nquant; + BREAK; case BETA: - nquant = ivas_mc_paramupmix_beta_quant_table[0].nquant; - break; + nquant = ivas_mc_paramupmix_beta_quant_table_fx[0].nquant; + BREAK; default: - assert( 0 ); - } + assert(0); + } - offset = nquant - 1; /* range of df [-(nquant - 1), nquant - 1] */ + offset = sub(nquant, 1); /* range of df [-(nquant - 1), nquant - 1] */ - st->next_bit_pos++; - switch ( parType ) - { + st->next_bit_pos++; + SWITCH(parType) + { case ALPHA: - huff_node_table = ivas_mc_paramupmix_huff_nodes_df0.alpha; - break; + huff_node_table = ivas_mc_paramupmix_huff_nodes_df0.alpha; + BREAK; case BETA: - huff_node_table = ivas_mc_paramupmix_huff_nodes_df0.beta; - break; + huff_node_table = ivas_mc_paramupmix_huff_nodes_df0.beta; + BREAK; default: - huff_node_table = NULL; - assert( 0 ); - } - vq[0] = huff_read( st, huff_node_table ); + huff_node_table = NULL; + assert(0); + } + vq[0] = huff_read(st, huff_node_table); - switch ( parType ) - { + SWITCH(parType) + { case ALPHA: - huff_node_table = ivas_mc_paramupmix_huff_nodes_df.alpha; - break; + huff_node_table = ivas_mc_paramupmix_huff_nodes_df.alpha; + BREAK; case BETA: - huff_node_table = ivas_mc_paramupmix_huff_nodes_df.beta; - break; + huff_node_table = ivas_mc_paramupmix_huff_nodes_df.beta; + BREAK; default: - assert( 0 ); - } + assert(0); + } - for ( iv = 1; iv < IVAS_MAX_NUM_BANDS; iv++ ) - { - vq[iv] = huff_read( st, huff_node_table ) + vq[iv - 1] - offset; - } + FOR(iv = 1; iv < IVAS_MAX_NUM_BANDS; iv++) + { + vq[iv] = L_sub(L_add(huff_read(st, huff_node_table), vq[sub(iv, 1)]), offset); + } - return; + return; } static void dequant_alpha( - int32_t *vq, - float *v ) + Word32 *vq, + Word32 *v) { - int16_t iv; - const ACPL_QUANT_TABLE *quant_table = &ivas_mc_paramupmix_alpha_quant_table; + Word16 iv; + const ACPL_QUANT_TABLE_FX *quant_table = &ivas_mc_paramupmix_alpha_quant_table_fx; - for ( iv = 0; iv < IVAS_MAX_NUM_BANDS; iv++ ) - { - v[iv] = quant_table->data[vq[iv]]; - } + FOR(iv = 0; iv < IVAS_MAX_NUM_BANDS; iv++) + { + v[iv] = quant_table->data[vq[iv]]; + } - return; + return; } static void dequant_beta( - int32_t *aq, - int32_t *bq, - float *beta ) + Word32 *aq, + Word32 *bq, + Word32 *beta) { - int16_t iv; - const ACPL_QUANT_TABLE *quant_table; + Word16 iv; + const ACPL_QUANT_TABLE_FX *quant_table; - for ( iv = 0; iv < IVAS_MAX_NUM_BANDS; iv++ ) - { - quant_table = &ivas_mc_paramupmix_beta_quant_table[ivas_param_upmx_mx_qmap[aq[iv]]]; - beta[iv] = quant_table->data[bq[iv]]; - } + FOR(iv = 0; iv < IVAS_MAX_NUM_BANDS; iv++) + { + quant_table = &ivas_mc_paramupmix_beta_quant_table_fx[ivas_param_upmx_mx_qmap[aq[iv]]]; + beta[iv] = quant_table->data[bq[iv]]; + } - return; + return; } static void get_ec_data( - Decoder_State *st, - const PAR_TYPE parType, - int32_t *parQ, - int32_t *alphaQEnv, - float ab[IVAS_MAX_NUM_BANDS] ) + Decoder_State *st, + const PAR_TYPE parType, + Word32 *parQ, + Word32 *alphaQEnv, + Word32 ab[IVAS_MAX_NUM_BANDS]) { - huffman_decode( st, parType, parQ ); - - if ( parType == ALPHA ) - { - dequant_alpha( parQ, ab ); - mvl2l( parQ, alphaQEnv, (int16_t) IVAS_MAX_NUM_BANDS ); - } - else - { - dequant_beta( alphaQEnv, parQ, ab ); - } - - return; + huffman_decode(st, parType, parQ); + + IF(EQ_32(parType, ALPHA)) + { + dequant_alpha(parQ, ab); + mvl2l(parQ, alphaQEnv, (Word16)IVAS_MAX_NUM_BANDS); + } + ELSE + { + dequant_beta(alphaQEnv, parQ, ab); + } + + return; } + +#endif \ No newline at end of file diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index fd45271bf4e7f0b9c4a8e1a19a99d2e5ccd29cb6..2a0f4457cbafc376be6d559745d0819f3ee38e0e 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -871,20 +871,33 @@ typedef struct ivas_mc_paramupmix_dec_data_structure { int16_t num_freq_bands; ivas_td_decorr_state_t *hTdDecorr[MC_PARAMUPMIX_COMBINATIONS]; + int32_t alpha_quant[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + int32_t beta_quant[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; + int16_t first_frame; + int16_t free_param_interpolator; + + +#ifdef IVAS_FLOAT_FIXED + Word32 alphas_fx[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; // Q28 + Word32 betas_fx[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; // Q28 + Word32 alpha_prev_fx[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; // Q28 + Word32 beta_prev_fx[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; // Q28 + Word32 *pcm_delay_fx[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS]; + Word16 *param_interpolator_fx; // Q15 + Word32 alpha_sf_fx[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS];//Q28 + Word32 beta_sf_fx[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS];//Q28 + Word32 *hoa_encoder_fx; +#else float alphas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; float betas[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; float alpha_prev[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; float beta_prev[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; - int32_t alpha_quant[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; - int32_t beta_quant[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; - int16_t first_frame; float *pcm_delay[MC_PARAMUPMIX_MAX_TRANSPORT_CHANS]; float *param_interpolator; float alpha_sf[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; float beta_sf[MC_PARAMUPMIX_COMBINATIONS][IVAS_MAX_NUM_BANDS]; - int16_t free_param_interpolator; float *hoa_encoder; - +#endif // IVAS_FLOAT_FIXED } MC_PARAMUPMIX_DEC_DATA, *MC_PARAMUPMIX_DEC_HANDLE; diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec.c b/lib_dec/ivas_stereo_mdct_stereo_dec.c index db3b2733f1d0121288b7abac3b9f67f557908433..87a1e1bfbfec856c7068a2d6b3a3bef4dadfb85f 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec.c @@ -1210,11 +1210,11 @@ void updateBuffersForDmxMdctStereo_fx( Word16 sum_tcx_ltp = 0, sum_delay_buf = 0, sum_tcx_ltp_out = 0, sum_old_out = 0; - Copy_Scale_sig_32_16(&sts[0]->hTcxLtpDec->tcxltp_mem_in_32, &sts[0]->hTcxLtpDec->tcxltp_mem_in, TCXLTP_MAX_DELAY, -11); - Copy_Scale_sig_32_16(&sts[1]->hTcxLtpDec->tcxltp_mem_in_32, &sts[1]->hTcxLtpDec->tcxltp_mem_in, TCXLTP_MAX_DELAY, -11); + Copy_Scale_sig_32_16(&sts[0]->hTcxLtpDec->tcxltp_mem_in_32[0], &sts[0]->hTcxLtpDec->tcxltp_mem_in[0], TCXLTP_MAX_DELAY, -11); + Copy_Scale_sig_32_16(&sts[1]->hTcxLtpDec->tcxltp_mem_in_32[0], &sts[1]->hTcxLtpDec->tcxltp_mem_in[0], TCXLTP_MAX_DELAY, -11); - Copy_Scale_sig_32_16(&sts[0]->hTcxLtpDec->tcxltp_mem_out_32, &sts[0]->hTcxLtpDec->tcxltp_mem_out, L_FRAME48k, -11); - Copy_Scale_sig_32_16(&sts[1]->hTcxLtpDec->tcxltp_mem_out_32, &sts[1]->hTcxLtpDec->tcxltp_mem_out, L_FRAME48k, -11); + Copy_Scale_sig_32_16(&sts[0]->hTcxLtpDec->tcxltp_mem_out_32[0], &sts[0]->hTcxLtpDec->tcxltp_mem_out[0], L_FRAME48k, -11); + Copy_Scale_sig_32_16(&sts[1]->hTcxLtpDec->tcxltp_mem_out_32[0], &sts[1]->hTcxLtpDec->tcxltp_mem_out[0], L_FRAME48k, -11); sts[0]->hTcxLtpDec->exp_tcxltp_mem_in = 15 - norm_arr(sts[0]->hTcxLtpDec->tcxltp_mem_in, TCXLTP_MAX_DELAY); sts[1]->hTcxLtpDec->exp_tcxltp_mem_in = 15 - norm_arr(sts[1]->hTcxLtpDec->tcxltp_mem_in, TCXLTP_MAX_DELAY); @@ -1224,11 +1224,11 @@ void updateBuffersForDmxMdctStereo_fx( - Scale_sig(&sts[0]->hTcxLtpDec->tcxltp_mem_in, TCXLTP_MAX_DELAY, sub(15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_in)); - Scale_sig(&sts[1]->hTcxLtpDec->tcxltp_mem_in, TCXLTP_MAX_DELAY, sub(15, sts[1]->hTcxLtpDec->exp_tcxltp_mem_in)); + Scale_sig(&sts[0]->hTcxLtpDec->tcxltp_mem_in[0], TCXLTP_MAX_DELAY, sub(15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_in)); + Scale_sig(&sts[1]->hTcxLtpDec->tcxltp_mem_in[0], TCXLTP_MAX_DELAY, sub(15, sts[1]->hTcxLtpDec->exp_tcxltp_mem_in)); - Scale_sig(&sts[0]->hTcxLtpDec->tcxltp_mem_out, TCXLTP_MAX_DELAY, sub(15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_out)); - Scale_sig(&sts[1]->hTcxLtpDec->tcxltp_mem_out, TCXLTP_MAX_DELAY, sub(15, sts[1]->hTcxLtpDec->exp_tcxltp_mem_out)); + Scale_sig(&sts[0]->hTcxLtpDec->tcxltp_mem_out[0], TCXLTP_MAX_DELAY, sub(15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_out)); + Scale_sig(&sts[1]->hTcxLtpDec->tcxltp_mem_out[0], TCXLTP_MAX_DELAY, sub(15, sts[1]->hTcxLtpDec->exp_tcxltp_mem_out)); update_exp( &sts[0]->hTcxLtpDec->exp_tcxltp_mem_in, &sts[1]->hTcxLtpDec->exp_tcxltp_mem_in, @@ -1280,8 +1280,8 @@ void updateBuffersForDmxMdctStereo_fx( sts[0]->hHQ_core->exp_old_out = add( sts[0]->hHQ_core->exp_old_out, 1 ); sts[0]->hTcxLtpDec->exp_tcxltp_mem_out = add( sts[0]->hTcxLtpDec->exp_tcxltp_mem_out, 1 ); - Copy_Scale_sig_16_32(&sts[0]->hTcxLtpDec->tcxltp_mem_in, &sts[0]->hTcxLtpDec->tcxltp_mem_in_32, TCXLTP_MAX_DELAY, sub(11, sub(15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_in))); - Copy_Scale_sig_16_32(&sts[0]->hTcxLtpDec->tcxltp_mem_out, &sts[0]->hTcxLtpDec->tcxltp_mem_out_32, TCXLTP_MAX_DELAY, sub(11, sub(15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_out))); + Copy_Scale_sig_16_32(&sts[0]->hTcxLtpDec->tcxltp_mem_in[0], &sts[0]->hTcxLtpDec->tcxltp_mem_in_32[0], TCXLTP_MAX_DELAY, sub(11, sub(15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_in))); + Copy_Scale_sig_16_32(&sts[0]->hTcxLtpDec->tcxltp_mem_out[0], &sts[0]->hTcxLtpDec->tcxltp_mem_out_32[0], TCXLTP_MAX_DELAY, sub(11, sub(15, sts[0]->hTcxLtpDec->exp_tcxltp_mem_out))); } return; diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 6a4c51ae53ee6f71b1b152210ebf4166ed2ae327..536f216c7307a073ce5b9c63dee834c020bf76a6 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -63,6 +63,7 @@ static ivas_error allocate_CoreCoder_TCX( DEC_CORE_HANDLE st /* i/o: Core decoder state structure */ ) { +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) if ( st->hTcxDec == NULL ) { if ( ( st->hTcxDec = (TCX_DEC_HANDLE) malloc( sizeof( TCX_DEC_DATA ) ) ) == NULL ) @@ -76,7 +77,7 @@ static ivas_error allocate_CoreCoder_TCX( set_zero( st->hTcxDec->old_synth_float, OLD_SYNTH_INTERNAL_DEC ); set_zero( st->hTcxDec->synth_history, L_PROT48k + L_FRAME48k ); } - +#endif if ( st->hTcxCfg == NULL ) { if ( ( st->hTcxCfg = (TCX_CONFIG_HANDLE) malloc( sizeof( TCX_config ) ) ) == NULL ) @@ -151,10 +152,10 @@ static ivas_error allocate_CoreCoder_TCX_fx( set16_fx( st->hTcxDec->synth_history_fx, 0, L_PROT48k + L_FRAME48k ); #if 1 // TODO: TO be removed later - reset_tcx_overl_buf( st->hTcxDec ); - set_zero( st->hTcxDec->syn_OverlFB_float, L_FRAME48k / 2 ); - set_zero( st->hTcxDec->old_synth_float, OLD_SYNTH_INTERNAL_DEC ); - set_zero( st->hTcxDec->synth_history, L_PROT48k + L_FRAME48k ); + //reset_tcx_overl_buf( st->hTcxDec ); + //set_zero( st->hTcxDec->syn_OverlFB_float, L_FRAME48k / 2 ); + //set_zero( st->hTcxDec->old_synth_float, OLD_SYNTH_INTERNAL_DEC ); + //set_zero( st->hTcxDec->synth_history, L_PROT48k + L_FRAME48k ); #endif } @@ -1724,9 +1725,9 @@ ivas_error stereo_memory_dec_fx( st->hTcxDec->prev_good_synth_fx = st->hTcxDec->old_synthFB_fx + NS2SA(st->output_Fs, PH_ECU_LOOKAHEAD_NS); #if 1 // To be removed later - set_f( st->hTcxDec->FBTCXdelayBuf_float, 0.0f, 111 ); - st->hTcxDec->old_synthFB = st->hTcxDec->synth_history + NS2SA( st->output_Fs, PH_ECU_MEM_NS ); - st->hTcxDec->prev_good_synth = st->hTcxDec->old_synthFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ); + //set_f( st->hTcxDec->FBTCXdelayBuf_float, 0.0f, 111 ); + //st->hTcxDec->old_synthFB = st->hTcxDec->synth_history + NS2SA( st->output_Fs, PH_ECU_MEM_NS ); + //st->hTcxDec->prev_good_synth = st->hTcxDec->old_synthFB + NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ); #endif /* allocate and initialize MDCT stereo structure */ @@ -3371,7 +3372,7 @@ void stereo_switching_dec( #ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED mvr2r( sts[0]->hHQ_core->old_out, sts[1]->hHQ_core->old_out, L_FRAME48k ); - mvr2r( sts[0]->hTcxDec->old_syn_Overl_float, sts[1]->hTcxDec->old_syn_Overl_float, 256 ); + //mvr2r( sts[0]->hTcxDec->old_syn_Overl_float, sts[1]->hTcxDec->old_syn_Overl_float, 256 ); #endif #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) mvr2r(sts[0]->delay_buf_out, sts[1]->delay_buf_out, HQ_DELTA_MAX * HQ_DELAY_COMP); diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index b898d294eb0761a70681b04403bb7afe8ab040a5..3b6e633373212426afd34fc37105ecb4d83ace66 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -673,36 +673,52 @@ typedef struct tcx_dec_structure int16_t old_synth_len; int16_t old_synth_lenFB; - +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) float old_synth_float[OLD_SYNTH_INTERNAL_DEC]; /* synthesis memory */ +#endif Word16 old_synth[OLD_SYNTH_INTERNAL_DEC]; /* synthesis memory */ - +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) float synth_history[L_PROT48k + L_FRAME_MAX]; /* unified synthesis memory */ +#endif Word16 synth_history_fx[L_PROT48k + L_FRAME_MAX]; /*TCX unified synthesis memory */ Word16 q_synth_history_fx; +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) float *old_synthFB; +#endif Word16* old_synthFB_fx; - +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) float *prev_good_synth; +#endif Word16* prev_good_synth_fx; - +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) float old_syn_Overl_float[L_FRAME32k / 2]; +#endif Word16 old_syn_Overl[L_FRAME32k / 2]; Word32 old_syn_Overl_32[L_FRAME32k / 2]; Word16 Q_old_syn_Overl; +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) float syn_Overl_TDAC_float[L_FRAME32k / 2]; +#endif Word16 syn_Overl_TDAC[L_FRAME32k / 2]; Word16 Q_syn_Overl_TDAC; +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) float syn_Overl_TDACFB_float[L_FRAME_MAX / 2]; +#endif Word16 syn_Overl_TDACFB[L_FRAME_MAX / 2]; Word16 Q_syn_Overl_TDACFB; +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) float syn_Overl_float[L_FRAME32k / 2]; +#endif Word16 syn_Overl[L_FRAME32k / 2]; Word16 Q_syn_Overl; +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) float syn_OverlFB_float[L_FRAME_MAX / 2]; +#endif Word16 syn_OverlFB[L_FRAME_MAX / 2]; Word16 Q_syn_OverlFB; +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) float FBTCXdelayBuf_float[111]; /* 2.3125ms at 48kHz -> 111 samples */ +#endif Word16 FBTCXdelayBuf[111]; /* 2.3125ms at 48kHz -> 111 samples */ Word32 FBTCXdelayBuf_32[111]; /* 2.3125ms at 48kHz -> 111 samples */ @@ -1368,8 +1384,9 @@ typedef struct hq_dec_structure //int16_t HqVoicing; Word16 HqVoicing; - +#if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED) float fer_samples[L_FRAME48k]; +#endif Word16 fer_samples_fx[L_FRAME48k]; Word16 Q_fer_samples; #if (defined EVS_FLOAT) || !(defined IVAS_FLOAT_FIXED)