From 6ee3ca6c582753a350fec7bfca9e97da5e6f3cf2 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 10 Jun 2024 11:24:50 +0530 Subject: [PATCH 1/2] dirac_dec_stack_mem cleanup [x] Float stucture members DIRAC_DEC_STACK_MEM cleared [x] ivas_dirac_alloc_mem updates for float build --- lib_dec/ivas_dirac_dec.c | 88 ++++++++++++++-------- lib_rend/ivas_dirac_output_synthesis_dec.c | 26 +++---- lib_rend/ivas_dirac_rend.c | 74 +++++++++++------- lib_rend/ivas_stat_rend.h | 13 +++- lib_rend/lib_rend.c | 62 ++++++++++----- 5 files changed, 166 insertions(+), 97 deletions(-) diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 5c8f35298..1dbb0e8ee 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3548,11 +3548,19 @@ void ivas_dirac_dec_render_sf_fx( if ( hDirAC->hConfig->dec_param_estim == TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - h_dirac_output_synthesis_state->q_cy_auto_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + Word16 shift = L_norm_arr( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + scale_sig32( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, num_channels_dir * hSpatParamRendCom->num_freq_bands, shift ); + h_dirac_output_synthesis_state->q_cy_auto_dir_smooth += shift; - h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + // h_dirac_output_synthesis_state->q_cy_auto_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + // floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + + shift = L_norm_arr( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + scale_sig32( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, num_channels_dir * hSpatParamRendCom->num_freq_bands, shift ); + h_dirac_output_synthesis_state->q_cy_cross_dir_smooth += shift; + + /*h_dirac_output_synthesis_state->q_cy_cross_dir_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + floatToFixed_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands );*/ h_dirac_output_synthesis_state->q_cy_auto_diff_smooth = L_get_q_buf( h_dirac_output_synthesis_state->cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); @@ -3626,11 +3634,18 @@ void ivas_dirac_dec_render_sf_fx( floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, size ); IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, size_ho ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); + Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, size_ho ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, size_ho, shift ); + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth += shift; + // hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, size_ho ); + // floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); + + scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, size_ho, Q26 - hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev ); hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = Q26; - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); + + // hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = Q26; + // floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth = Q26; floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); @@ -3642,11 +3657,20 @@ void ivas_dirac_dec_render_sf_fx( { floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); - hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, size_ho ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, size_ho ); + Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, size_ho ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, size_ho, shift ); + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev += shift; + + /*hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, size_ho ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, size_ho );*/ + + shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, size_ho ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, size_ho, shift ); + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev += shift; + - hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, size_ho ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); + /*hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, size_ho ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho );*/ hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); @@ -5006,13 +5030,13 @@ void ivas_dirac_dec_render_sf_fx( { IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hSpatParamRendCom->num_freq_bands ); + // fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, hSpatParamRendCom->num_freq_bands ); + // fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hSpatParamRendCom->num_freq_bands ); } ELSE { - me2f_buf( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, 31 - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hSpatParamRendCom->num_freq_bands ); - me2f_buf( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, 31 - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hSpatParamRendCom->num_freq_bands ); + // me2f_buf( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx, 31 - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q, hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, hSpatParamRendCom->num_freq_bands ); + // me2f_buf( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx, 31 - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q, hDirACRend->h_output_synthesis_psd_state.direct_power_factor, hSpatParamRendCom->num_freq_bands ); } } IF( st_ivas->hMasa == NULL && EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) @@ -5106,15 +5130,15 @@ void ivas_dirac_dec_render_sf_fx( { if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { - fixedToFloat_arrL( h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->direct_power_factor_q, 2 * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_q, 2 * hSpatParamRendCom->num_freq_bands ); + // fixedToFloat_arrL( h_dirac_output_synthesis_state->direct_power_factor_fx, h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->direct_power_factor_q, 2 * hSpatParamRendCom->num_freq_bands ); + // fixedToFloat_arrL( h_dirac_output_synthesis_state->diffuse_power_factor_fx, h_dirac_output_synthesis_state->diffuse_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor_q, 2 * hSpatParamRendCom->num_freq_bands ); } else { FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); + // hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); + // hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); } } } @@ -5124,17 +5148,17 @@ void ivas_dirac_dec_render_sf_fx( { FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->direct_power_factor_q ); - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->diffuse_power_factor_q ); + // hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->direct_power_factor_q ); + // hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = me2f( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], 31 - h_dirac_output_synthesis_state->diffuse_power_factor_q ); } - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, (num_channels_dir) *hSpatParamRendCom->num_freq_bands ); + // fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, (num_channels_dir) *hSpatParamRendCom->num_freq_bands ); } else { FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); + // hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); + // hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); } } } @@ -5146,16 +5170,16 @@ void ivas_dirac_dec_render_sf_fx( if ( hDirAC->hConfig->dec_param_estim == TRUE && hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + // fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_dir_smooth_fx, h_dirac_output_synthesis_state->cy_auto_dir_smooth, h_dirac_output_synthesis_state->q_cy_auto_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); + // fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_cross_dir_smooth_fx, h_dirac_output_synthesis_state->cy_cross_dir_smooth, h_dirac_output_synthesis_state->q_cy_cross_dir_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); fixedToFloat_arrL( h_dirac_output_synthesis_state->cy_auto_diff_smooth_fx, h_dirac_output_synthesis_state->cy_auto_diff_smooth, h_dirac_output_synthesis_state->q_cy_auto_diff_smooth, num_channels_dir * hSpatParamRendCom->num_freq_bands ); } IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); + // fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); + // fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hDirACRend->num_outputs_diff * hDirACRend->h_output_synthesis_psd_params.max_band_decorr ); hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q = hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev; @@ -5165,11 +5189,11 @@ void ivas_dirac_dec_render_sf_fx( } ELSE { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, size ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); + // fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, size ); + // fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, size ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, size ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); + // fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, size ); + // fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, size_ho ); fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, size ); diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index de26b93ab..9fb7daee0 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -220,10 +220,10 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( size = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir; } /*TODO : remove float code*/ - if ( ( dirac_output_synthesis_state->cy_cross_dir_smooth_prev = (float *) malloc( size * sizeof( float ) ) ) == NULL ) + /*if ( ( dirac_output_synthesis_state->cy_cross_dir_smooth_prev = (float *) malloc( size * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); - } + }*/ IF( ( dirac_output_synthesis_state->cy_cross_dir_smooth_prev_fx = (Word32 *) malloc( size * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); @@ -232,7 +232,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( IF( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { /*TODO : remove float code*/ - dirac_output_synthesis_state->cy_auto_dir_smooth_prev = NULL; + //dirac_output_synthesis_state->cy_auto_dir_smooth_prev = NULL; if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); @@ -246,12 +246,6 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( } ELSE { - /*TODO : remove float code*/ - if ( ( dirac_output_synthesis_state->cy_auto_dir_smooth_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); - } - if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) { if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir * sizeof( float ) ) ) == NULL ) @@ -822,10 +816,10 @@ void ivas_dirac_dec_output_synthesis_init_fx( *-----------------------------------------------------------------*/ /* initialize buffers */ - if ( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev != NULL ) + /*if ( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev != NULL ) { set_zero( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir ); - } + }*/ if ( hodirac_flag ) { @@ -835,7 +829,7 @@ void ivas_dirac_dec_output_synthesis_init_fx( { size = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir; } - set_zero( h_dirac_output_synthesis_state->cy_cross_dir_smooth_prev, size ); + //set_zero( h_dirac_output_synthesis_state->cy_cross_dir_smooth_prev, size ); if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { @@ -1036,16 +1030,16 @@ void ivas_dirac_dec_output_synthesis_close_fx( *-----------------------------------------------------------------*/ /* free target power buffers */ - if ( ( dirac_output_synthesis_state )->cy_auto_dir_smooth_prev != NULL ) + /*if ( ( dirac_output_synthesis_state )->cy_auto_dir_smooth_prev != NULL ) { free( ( dirac_output_synthesis_state )->cy_auto_dir_smooth_prev ); ( dirac_output_synthesis_state )->cy_auto_dir_smooth_prev = NULL; - } - if ( ( dirac_output_synthesis_state )->cy_cross_dir_smooth_prev != NULL ) + }*/ + /*if ( ( dirac_output_synthesis_state )->cy_cross_dir_smooth_prev != NULL ) { free( ( dirac_output_synthesis_state )->cy_cross_dir_smooth_prev ); ( dirac_output_synthesis_state )->cy_cross_dir_smooth_prev = NULL; - } + }*/ if ( ( dirac_output_synthesis_state )->cy_auto_diff_smooth_prev != NULL ) { free( ( dirac_output_synthesis_state )->cy_auto_diff_smooth_prev ); diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 2e8ae2cb8..744035fa6 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1267,28 +1267,32 @@ ivas_error ivas_dirac_alloc_mem( } /* PSD related buffers */ - hDirAC_mem->cy_auto_dir_smooth = NULL; #ifdef IVAS_FLOAT_FIXED hDirAC_mem->cy_auto_dir_smooth_fx = NULL; hDirAC_mem->proto_power_smooth_fx = NULL; hDirAC_mem->proto_power_diff_smooth_fx = NULL; hDirAC_mem->direct_responses_square_fx = NULL; #else + hDirAC_mem->cy_auto_dir_smooth = NULL; hDirAC_mem->direct_responses_square = NULL; #endif #ifdef IVAS_FLOAT_FIXED hDirAC_mem->frame_dec_f_fx = NULL; #else + hDirAC_mem->proto_power_smooth = NULL; + hDirAC_mem->proto_power_diff_smooth = NULL; + hDirAC_mem->direct_responses_square = NULL; hDirAC_mem->frame_dec_f = NULL; #endif if ( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { +#ifndef IVAS_FLOAT_FIXED if ( ( hDirAC_mem->cy_auto_dir_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } set_zero( hDirAC_mem->cy_auto_dir_smooth, size ); -#ifdef IVAS_FLOAT_FIXED +#else if ( ( hDirAC_mem->cy_auto_dir_smooth_fx = (Word32 *) malloc( sizeof( Word32 ) * size ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); @@ -1297,7 +1301,19 @@ ivas_error ivas_dirac_alloc_mem( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len = size; #endif -#ifdef IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED + if ( ( hDirAC_mem->proto_power_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->proto_power_smooth, size ); + + if ( ( hDirAC_mem->proto_power_diff_smooth = (float *) malloc( sizeof( float ) * size ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); + } + set_zero( hDirAC_mem->proto_power_diff_smooth, size ); +#else if ( ( hDirAC_mem->proto_power_smooth_fx = (Word32 *) malloc( sizeof( Word32 ) * size ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); @@ -1345,28 +1361,29 @@ ivas_error ivas_dirac_alloc_mem( #endif } } +#ifndef IVAS_FLOAT_FIXED + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth = hDirAC_mem->proto_power_smooth; + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth = hDirAC_mem->proto_power_diff_smooth; hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth = hDirAC_mem->cy_auto_dir_smooth; -#ifdef IVAS_FLOAT_FIXED - hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx = hDirAC_mem->proto_power_diff_smooth_fx; - hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = hDirAC_mem->proto_power_diff_smooth_q; - hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len = hDirAC_mem->proto_power_diff_smooth_len; - hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx = hDirAC_mem->cy_auto_dir_smooth_fx; - hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth = 0; - move16(); -#else hDirACRend->h_output_synthesis_psd_state.direct_responses_square = hDirAC_mem->direct_responses_square; -#endif -#ifdef IVAS_FLOAT_FIXED +#else hDirACRend->h_output_synthesis_psd_state.direct_responses_square_fx = hDirAC_mem->direct_responses_square_fx; hDirACRend->h_output_synthesis_psd_state.direct_responses_square_q = Q31; hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx = hDirAC_mem->proto_power_smooth_fx; hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = Q31; hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = Q31; + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx = hDirAC_mem->proto_power_diff_smooth_fx; + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = hDirAC_mem->proto_power_diff_smooth_q; + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len = hDirAC_mem->proto_power_diff_smooth_len; hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = Q31; hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = Q31; + hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx = hDirAC_mem->cy_auto_dir_smooth_fx; + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth = 0; + move16(); #endif /* Target and smoothed nrg factors/gains */ +#ifndef IVAS_FLOAT_FIXED if ( ( hDirAC_mem->cy_cross_dir_smooth = (float *) malloc( sizeof( float ) * size_ho ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); @@ -1376,6 +1393,7 @@ ivas_error ivas_dirac_alloc_mem( #else set_zero( hDirAC_mem->cy_cross_dir_smooth, size ); #endif +#endif #ifdef IVAS_FLOAT_FIXED if ( ( hDirAC_mem->cy_cross_dir_smooth_fx = (Word32 *) malloc( sizeof( Word32 ) * size_ho ) ) == NULL ) { @@ -1422,7 +1440,6 @@ ivas_error ivas_dirac_alloc_mem( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_len = num_outputs_diff * num_freq_bands_diff; #endif } - hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth = hDirAC_mem->cy_cross_dir_smooth; hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth = hDirAC_mem->cy_auto_diff_smooth; #ifdef IVAS_FLOAT_FIXED hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx = hDirAC_mem->cy_cross_dir_smooth_fx; @@ -1431,6 +1448,8 @@ ivas_error ivas_dirac_alloc_mem( move16(); hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth = 0; move16(); +#else + hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth = hDirAC_mem->cy_cross_dir_smooth; #endif /*Responses (gains/factors)*/ @@ -1528,16 +1547,18 @@ ivas_error ivas_dirac_alloc_mem( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f = hDirAC_mem->proto_direct_buffer_f; #endif /* Gains/power factors*/ - hDirAC_mem->direct_power_factor = NULL; - hDirAC_mem->diffuse_power_factor = NULL; #ifdef IVAS_FLOAT_FIXED hDirAC_mem->direct_power_factor_fx = NULL; hDirAC_mem->diffuse_power_factor_fx = NULL; +#else + hDirAC_mem->direct_power_factor = NULL; + hDirAC_mem->diffuse_power_factor = NULL; #endif if ( renderer_type != RENDERER_BINAURAL_PARAMETRIC && renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && renderer_type != RENDERER_STEREO_PARAMETRIC ) { +#ifndef IVAS_FLOAT_FIXED if ( ( hDirAC_mem->direct_power_factor = (float *) malloc( sizeof( float ) * size_pf ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); @@ -1546,7 +1567,7 @@ ivas_error ivas_dirac_alloc_mem( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } -#ifdef IVAS_FLOAT_FIXED +#else IF( ( hDirAC_mem->direct_power_factor_fx = (Word32 *) malloc( sizeof( Word32 ) * size_pf ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); @@ -1558,10 +1579,6 @@ ivas_error ivas_dirac_alloc_mem( #endif } - hDirACRend->h_output_synthesis_psd_state.direct_power_factor = hDirAC_mem->direct_power_factor; - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor = hDirAC_mem->diffuse_power_factor; - set_zero( hDirACRend->h_output_synthesis_psd_state.direct_power_factor, size_pf ); - set_zero( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, size_pf ); #ifdef IVAS_FLOAT_FIXED hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx = hDirAC_mem->direct_power_factor_fx; hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx = hDirAC_mem->diffuse_power_factor_fx; @@ -1571,6 +1588,11 @@ ivas_error ivas_dirac_alloc_mem( move16(); hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q = Q31; move16(); +#else + hDirACRend->h_output_synthesis_psd_state.direct_power_factor = hDirAC_mem->direct_power_factor; + hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor = hDirAC_mem->diffuse_power_factor; + set_zero( hDirACRend->h_output_synthesis_psd_state.direct_power_factor, size_pf ); + set_zero( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor, size_pf ); #endif #ifndef IVAS_FLOAT_FIXED @@ -1679,10 +1701,6 @@ ivas_error ivas_dirac_alloc_mem( void ivas_dirac_free_mem_fx( DIRAC_DEC_STACK_MEM_HANDLE hDirAC_mem ) { - IF( hDirAC_mem->cy_auto_dir_smooth != NULL ) - { - free( hDirAC_mem->cy_auto_dir_smooth ); - } IF( hDirAC_mem->cy_auto_dir_smooth_fx != NULL ) { free( hDirAC_mem->cy_auto_dir_smooth_fx ); @@ -1713,10 +1731,6 @@ void ivas_dirac_free_mem_fx( free( hDirAC_mem->frame_dec_f ); } #endif - IF( hDirAC_mem->cy_cross_dir_smooth != NULL ) - { - free( hDirAC_mem->cy_cross_dir_smooth ); - } IF( hDirAC_mem->cy_cross_dir_smooth_fx != NULL ) { free( hDirAC_mem->cy_cross_dir_smooth_fx ); @@ -1755,6 +1769,7 @@ void ivas_dirac_free_mem_fx( { free( hDirAC_mem->proto_diffuse_buffer_f_fx ); } +#ifndef IVAS_FLOAT_FIXED IF( hDirAC_mem->direct_power_factor != NULL ) { free( hDirAC_mem->direct_power_factor ); @@ -1763,6 +1778,7 @@ void ivas_dirac_free_mem_fx( { free( hDirAC_mem->diffuse_power_factor ); } +#endif IF( hDirAC_mem->direct_power_factor_fx != NULL ) { free( hDirAC_mem->direct_power_factor_fx ); diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index c7964bdee..6cbd09ebb 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -275,8 +275,10 @@ typedef struct dirac_dec_stack_mem #endif /*Gain or power factors for directional and diffuse streams*/ +#ifndef IVAS_FLOAT_FIXED float *direct_power_factor; float *diffuse_power_factor; +#endif #ifdef IVAS_FLOAT_FIXED /*Prototypes*/ @@ -305,13 +307,14 @@ typedef struct dirac_dec_stack_mem Word32 *direct_responses_square_fx; #endif /* Target co-variance mtx */ - float *cy_auto_dir_smooth; - float *cy_cross_dir_smooth; float *cy_auto_diff_smooth; #ifdef IVAS_FLOAT_FIXED Word32 *cy_auto_dir_smooth_fx; Word32 *cy_cross_dir_smooth_fx; Word32 *cy_auto_diff_smooth_fx; +#else + float *cy_cross_dir_smooth; + float *cy_auto_dir_smooth; #endif #ifndef IVAS_FLOAT_FIXED @@ -375,8 +378,10 @@ typedef struct dirac_output_synthesis_state_structure #endif /* only pointer to local buffers */ +#ifndef IVAS_FLOAT_FIXED float *direct_power_factor; float *diffuse_power_factor; +#endif #ifndef IVAS_FLOAT_FIXED float *proto_power_smooth; /* Smoothed power of the prototype signals. Size: num_freq_bands*num_channels. */ @@ -399,13 +404,17 @@ typedef struct dirac_output_synthesis_state_structure float *gains_diff_prev; /* Diffuse sound gains of previous synthesis block. Size: num_freq_bands*num_channel. */ /* only pointer to local buffers */ +#ifndef IVAS_FLOAT_FIXED float *cy_auto_dir_smooth; /* Target auto PSD of direct sound. Size: num_freq_bands*num_channels. */ float *cy_cross_dir_smooth; /* Target cross PSD of direct sound. Size: num_freq_bands*num_channels. */ +#endif float *cy_auto_diff_smooth; /* Target auto PSD of diffuse sound. Size: num_freq_bands*num_channels. */ /* PSD memories */ +#ifndef IVAS_FLOAT_FIXED float *cy_auto_dir_smooth_prev; /* Target auto PSD of direct sound of previous synthesis block. Size: num_freq_bands*num_channels. */ float *cy_cross_dir_smooth_prev; /* Target cross PSD of direct sound of previous synthesis block. Size: num_freq_bands*num_channels. */ +#endif float *cy_auto_diff_smooth_prev; /* Target auto PSD of diffuse sound of previous synthesis block. Size: num_freq_bands*num_channels. */ #ifndef IVAS_FLOAT_FIXED diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 925265558..135522e3b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -14807,23 +14807,42 @@ static void intermidiate_ext_dirac_render( } } - if ( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth ) + if ( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx ) + { + Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len, shift ); + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth += shift; + } + if ( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx ) + { + Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len, shift ); + hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev += shift; + } + + /*if ( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth ) { hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len ); floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len ); - } + }*/ - if ( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev ) + /*if ( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev ) { hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len ); ; floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len ); + }*/ + if ( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx ) + { + Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len, shift ); + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth += shift; } - if ( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth ) + /*if ( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth ) { hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->num_outputs_dir * hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len ); - } + }*/ Word16 num_channels_dir = hDirACRend->num_outputs_dir; if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS ) @@ -14847,12 +14866,19 @@ static void intermidiate_ext_dirac_render( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q = Q26; floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_dir_prev, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_q, hDirACRend->h_output_synthesis_psd_state.gains_dir_prev_len ); floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_len ); - if ( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev ) + + if ( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx ) { - hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_len ); + Word16 shift = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_len, shift ); + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev += shift; } + /*if ( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev ) + { + hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir ); + floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_len ); + }*/ if ( hDirACRend->proto_signal_decorr_on == 1 ) { Word16 tmp_e; @@ -14915,8 +14941,8 @@ static void intermidiate_ext_dirac_render( { FOR( i = 0; i < hSpatParamRendCom->num_freq_bands; i++ ) { - hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); - hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); + // hDirACRend->h_output_synthesis_psd_state.direct_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.direct_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.direct_power_factor_q ); + // hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor[i] = fix_to_float( hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_fx[i], hDirACRend->h_output_synthesis_psd_state.diffuse_power_factor_q ); } /* @@ -14933,22 +14959,22 @@ static void intermidiate_ext_dirac_render( } } }*/ - if ( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev ) + /*if ( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev ) { fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_len ); - } - if ( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth ) + }*/ + /*if ( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth ) { fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_len ); - } - if ( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev ) + }*/ + /*if ( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev ) { fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_prev_len ); - } - if ( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth ) + }*/ + /*if ( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth ) { fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len ); - } + }*/ if ( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth ) { fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_len ); -- GitLab From 81615393009f2b23b620d3cc5f4abc3d71e8a10c Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 10 Jun 2024 11:30:19 +0530 Subject: [PATCH 2/2] Clang formatting changes --- lib_rend/ivas_dirac_output_synthesis_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index 9fb7daee0..73154c600 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -232,7 +232,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( IF( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { /*TODO : remove float code*/ - //dirac_output_synthesis_state->cy_auto_dir_smooth_prev = NULL; + // dirac_output_synthesis_state->cy_auto_dir_smooth_prev = NULL; if ( ( dirac_output_synthesis_state->cy_auto_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirACRend->num_outputs_diff * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); @@ -829,7 +829,7 @@ void ivas_dirac_dec_output_synthesis_init_fx( { size = hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir; } - //set_zero( h_dirac_output_synthesis_state->cy_cross_dir_smooth_prev, size ); + // set_zero( h_dirac_output_synthesis_state->cy_cross_dir_smooth_prev, size ); if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { -- GitLab