From 1324da06f6e221633942dec5fbd8e92aeeedbd96 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 3 Jun 2024 22:09:22 +0530 Subject: [PATCH 1/2] Float structure members and buffers cleanup --- apps/decoder.c | 4 +- lib_dec/ivas_dirac_dec.c | 73 ++------- lib_dec/ivas_dirac_output_synthesis_cov.c | 72 ++------- lib_dec/ivas_jbm_dec.c | 70 +++------ lib_dec/ivas_mc_param_dec.c | 107 +++++-------- lib_dec/ivas_stat_dec.h | 173 +++++++++++---------- lib_dec/lib_dec_fx.c | 17 +- lib_rend/ivas_dirac_output_synthesis_dec.c | 39 +---- lib_rend/ivas_dirac_rend.c | 30 +--- lib_rend/ivas_reverb_utils.c | 14 ++ lib_rend/ivas_stat_rend.h | 21 ++- lib_rend/lib_rend.c | 48 ++---- 12 files changed, 224 insertions(+), 444 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 38d513d86..ba40717a7 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2485,13 +2485,13 @@ static ivas_error decodeVoIP( } } - frame++; + //frame++; if ( !arg.quietModeEnabled ) { fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); } vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len; - // frame++; + frame++; systemTime_ms += systemTimeInc_ms; #ifdef WMOPS #ifndef DONT_COUNT diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 04e80efe2..5c8f35298 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3489,6 +3489,7 @@ void ivas_dirac_dec_render_sf_fx( Word16 num_channels_dir, exp; Word16 q_diffuseness_vector = Q31, q_reference_power_smooth = Q31; Word16 proto_power_smooth_len = 0; + Word16 tmp1; push_wmops( "ivas_dirac_dec_render" ); @@ -3511,46 +3512,22 @@ void ivas_dirac_dec_render_sf_fx( //////////////////////////////////////////////////////////////////////////// to be removed /////////////////////////////////////////////////////////////////// IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { - floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); IF( hDirACRend->masa_stereo_type_detect ) { hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = 0; hDirACRend->masa_stereo_type_detect->q_subtract_power_y = Q31; } } - ELSE IF( NE_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_GAIN_SHD ) ) - { - SWITCH( nchan_transport ) - { - case 11: - case 8: - case 6: - case 4: - floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_diff ); - BREAK; - case 2: - IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) - { - floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 3, hSpatParamRendCom->num_freq_bands ) ); - } - ELSE - { - floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); - } - BREAK; - case 1: - floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands ); - BREAK; - } - } IF( L_or( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ), EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) ) { if ( hDirACRend->h_output_synthesis_psd_params.max_band_decorr != 0 ) { DIRAC_OUTPUT_SYNTHESIS_STATE *state = &( hDirACRend->h_output_synthesis_psd_state ); - f2me_buf( state->proto_power_diff_smooth, state->proto_power_diff_smooth_fx, &state->proto_power_diff_smooth_q, state->proto_power_diff_smooth_len ); - state->proto_power_diff_smooth_q = 31 - state->proto_power_diff_smooth_q; + tmp1 = L_norm_arr( state->proto_power_diff_smooth_fx, state->proto_power_diff_smooth_len ); + + scale_sig32( state->proto_power_diff_smooth_fx, state->proto_power_diff_smooth_len, tmp1 ); + state->proto_power_diff_smooth_q += tmp1; } } @@ -3674,13 +3651,15 @@ void ivas_dirac_dec_render_sf_fx( 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 ); - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + tmp1 = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands, tmp1 ); + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q += tmp1; - IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) + IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx != 0 ) { - hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); + tmp1 = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE, tmp1 ); + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q += tmp1; } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -5065,7 +5044,6 @@ void ivas_dirac_dec_render_sf_fx( ELSE IF( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_MONO ) ) { // fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], i_mult( 4, hSpatParamRendCom->num_freq_bands ) ) ); - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); // fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); } @@ -5078,7 +5056,6 @@ void ivas_dirac_dec_render_sf_fx( case 6: case 4: // fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( i_mult( 2, hSpatParamRendCom->subframe_nbslots[subframe_idx] ), i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) ); - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ); me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_outputs_diff ) ) ); // fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); BREAK; @@ -5086,19 +5063,16 @@ void ivas_dirac_dec_render_sf_fx( IF( hDirACRend->hOutSetup.is_loudspeaker_setup ) { // fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], i_mult( 6, hSpatParamRendCom->num_freq_bands ) ) ); - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 3, hSpatParamRendCom->num_freq_bands ) ); } ELSE { // fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], i_mult( 4, hSpatParamRendCom->num_freq_bands ) ) ); - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, i_mult( 2, hSpatParamRendCom->num_freq_bands ) ); } me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 6, hSpatParamRendCom->num_freq_bands ) ); // fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); BREAK; case 1: // fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, i_mult( hSpatParamRendCom->subframe_nbslots[subframe_idx], i_mult( 2, hSpatParamRendCom->num_freq_bands ) ) ); - fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hSpatParamRendCom->num_freq_bands ); me2f_buf( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f, i_mult( 2, i_mult( hSpatParamRendCom->num_freq_bands, hDirACRend->num_protos_diff ) ) ); // fixedToFloat_arrL32( reference_power_fx, DirAC_mem.reference_power, DirAC_mem.reference_power_q, hSpatParamRendCom->num_freq_bands ); BREAK; @@ -5127,21 +5101,6 @@ void ivas_dirac_dec_render_sf_fx( hDirACRend->proto_frame_dec_f = hDirACRend->proto_frame_f; } } - IF( L_or( EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_LS ), EQ_16( hDirACRend->synthesisConf, DIRAC_SYNTHESIS_PSD_SHD ) ) ) - { - if ( hDirACRend->h_output_synthesis_psd_params.max_band_decorr != 0 ) - { - DIRAC_OUTPUT_SYNTHESIS_STATE *state = &( hDirACRend->h_output_synthesis_psd_state ); - me2f_buf( state->proto_power_diff_smooth_fx, - 31 - state->proto_power_diff_smooth_q, - state->proto_power_diff_smooth, - state->proto_power_diff_smooth_len ); - /* me2f_buf( state->proto_diffuse_buffer_f_fx, - 31 - state->proto_diffuse_buffer_f_q, - state->proto_diffuse_buffer_f, - state->proto_diffuse_buffer_f_len );*/ - } - } if ( hDirAC->hConfig->dec_param_estim == FALSE && hodirac_flag ) { @@ -5215,14 +5174,6 @@ void ivas_dirac_dec_render_sf_fx( 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 ); fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); - - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); - IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_params.max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE ); - } } if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index b9774af5b..f6fc9b330 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -120,6 +120,7 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) ); } set_zero_fx( h_dirac_output_synthesis_state->mixing_matrix_fx[idx], nchan_out * nchan_in ); + h_dirac_output_synthesis_state->mixing_matrix_len = i_mult(nchan_out, nchan_in); } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { @@ -141,7 +142,8 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) ); } - set_zero_fx( h_dirac_output_synthesis_state->mixing_matrix_res_fx[idx], nchan_out * nchan_out ); + set_zero_fx( h_dirac_output_synthesis_state->mixing_matrix_res_fx[idx],nchan_out * nchan_out ); + h_dirac_output_synthesis_state->mixing_matrix_res_len = i_mult(nchan_out, nchan_out); } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { @@ -205,34 +207,6 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis covariance\n" ) ); } - - /* cov buffers */ - for ( idx = 0; idx < num_param_bands; idx++ ) - { - - if ( ( h_dirac_output_synthesis_state->mixing_matrix[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) ); - } - set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in ); - } - for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) - { - h_dirac_output_synthesis_state->mixing_matrix[idx] = NULL; - } - - for ( idx = 0; idx < num_param_bands_residual; idx++ ) - { - if ( ( h_dirac_output_synthesis_state->mixing_matrix_res[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) ); - } - set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out ); - } - for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) - { - h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL; - } #endif return IVAS_ERR_OK; } @@ -439,16 +413,16 @@ void ivas_dirac_dec_output_synthesis_cov_init_fx( set16_fx( h_dirac_output_synthesis_state->mixing_matrix_exp, 0, CLDFB_NO_CHANNELS_MAX ); set16_fx( h_dirac_output_synthesis_state->mixing_matrix_res_old_exp, 0, CLDFB_NO_CHANNELS_MAX ); set16_fx( h_dirac_output_synthesis_state->mixing_matrix_res_exp, 0, CLDFB_NO_CHANNELS_MAX ); -#if 1 /*TODO: To be removed :Floating point initializations*/ - FOR( idx = 0; idx < n_param_bands; idx++ ) - { - set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in ); - } - - FOR( idx = 0; idx < n_param_bands_res; idx++ ) - { - set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out ); - } +#if 1/*TODO: To be removed :Floating point initializations*/ + //FOR ( idx = 0; idx < n_param_bands; idx++ ) + //{ + // set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in ); + //} + + //FOR ( idx = 0; idx < n_param_bands_res; idx++ ) + //{ + // set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out ); + //} #endif return; @@ -606,22 +580,6 @@ void ivas_dirac_dec_output_synthesis_cov_close_fx( free( h_dirac_output_synthesis_params->proto_matrix ); h_dirac_output_synthesis_params->proto_matrix = NULL; } - - /* free cov buffers */ - FOR( idx = 0; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) - { - IF( h_dirac_output_synthesis_state->mixing_matrix[idx] != NULL ) - { - free( h_dirac_output_synthesis_state->mixing_matrix[idx] ); - h_dirac_output_synthesis_state->mixing_matrix[idx] = NULL; - } - - IF( h_dirac_output_synthesis_state->mixing_matrix_res[idx] != NULL ) - { - free( h_dirac_output_synthesis_state->mixing_matrix_res[idx] ); - h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL; - } - } #endif return; } @@ -2806,9 +2764,9 @@ Word16 computeMixingMatricesISM_fx( } ELSE { - Word32 reg_fac = BASOP_Util_Divide3232_Scale_cadence( MAX_32, EPSILON_FX_M, &temp_e[i] ); + Word32 reg_fac = BASOP_Util_Divide3232_Scale_cadence(MAX_32, EPSILON_FX_M, &temp_e[i]); Kx_reg_inv_fx[i] = reg_fac; - temp_e[i] = sub( temp_e[i], EPSILON_FX_E ); + temp_e[i] = sub(temp_e[i], EPSILON_FX_E); } } Kx_reg_inv_e = temp_e[0]; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 81f83a3af..0103bcd25 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2327,17 +2327,7 @@ void ivas_jbm_dec_feed_tc_to_renderer( ELSE IF( EQ_16( st_ivas->mc_mode, MC_MODE_PARAMMC ) ) { #ifdef IVAS_FLOAT_FIXED - Word16 cldfb_slots, j; - cldfb_slots = DEFAULT_JBM_CLDFB_TIMESLOTS; - if ( st_ivas->hDecoderConfig->Opt_tsm ) - { - cldfb_slots = MAX_JBM_CLDFB_TIMESLOTS; - } - - f2me_buf( st_ivas->hParamMC->Cldfb_RealBuffer_tc, st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx, &st_ivas->hParamMC->Cldfb_RealBuffer_tc_e, cldfb_slots * st_ivas->nchan_transport * st_ivas->hParamMC->num_freq_bands ); - f2me_buf( st_ivas->hParamMC->Cldfb_ImagBuffer_tc, st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx, &st_ivas->hParamMC->Cldfb_ImagBuffer_tc_e, cldfb_slots * st_ivas->nchan_transport * st_ivas->hParamMC->num_freq_bands ); - - + Word16 j; Word16 max_e = 0, input_q[MAX_CLDFB_DIGEST_CHANNELS], in_q; FOR( i = 0; i < MAX_CLDFB_DIGEST_CHANNELS; i++ ) { @@ -2399,15 +2389,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( scale_sig32( st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_fx[param_band_idx], nchan_out_cov * nchan_out_cov, shift ); st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx] = sub( st_ivas->hParamMC->h_output_synthesis_cov_state.cy_old_e[param_band_idx], shift ); } - - FOR( Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++ ) - { - me2f_buf( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], nchan_out_cov * nchan_transport ); - IF( st_ivas->hParamMC->band_grouping[param_band_idx] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr ) - { - me2f_buf( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], nchan_out_cov * nchan_out_cov ); - } - } #else ivas_param_mc_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, p_data_f ); #endif @@ -3505,15 +3486,9 @@ ivas_error ivas_jbm_dec_render( nchan_out_cldfb = nchan_out_transport; set_s( channel_active_fx, 1, nchan_out_cov ); } - - // ftf for ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx - FOR( i = 0; i < 16 * nchan_transport_tmp * st_ivas->hParamMC->num_freq_bands; i++ ) - { - st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx[i] = floatToFixed( st_ivas->hParamMC->Cldfb_RealBuffer_tc[i], Q6 ); - st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx[i] = floatToFixed( st_ivas->hParamMC->Cldfb_ImagBuffer_tc[i], Q6 ); - } - // ftf changes - if ( st_ivas->hParamMC->max_band_decorr > 0 ) + //ftf for ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx + //ftf changes + if (st_ivas->hParamMC->max_band_decorr > 0) { // ftf for param_mc_protoSignalComputation_fx FOR( Word16 x = 0; x < st_ivas->hParamMC->diff_proto_info->num_protos_diff; x++ ) @@ -3529,20 +3504,7 @@ ivas_error ivas_jbm_dec_render( f2me_buf( st_ivas->hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer, st_ivas->hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer_fx, &tmp_e, st_ivas->hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer_len ); st_ivas->hParamMC->h_freq_domain_decorr_ap_state->q_decorr_buffer = 31 - tmp_e; } - - FOR( Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++ ) - { - - - f2me_buf( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx], nchan_transport * nchan_out_cov ); - - IF( st_ivas->hParamMC->band_grouping[param_band_idx] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr ) - { - f2me_buf( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], nchan_out_cov * nchan_out_cov ); - } - } - - if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) + if ((st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM)) { if ( st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { @@ -3560,16 +3522,21 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q5; } } - - if ( st_ivas->hParamMC->slots_rendered == st_ivas->hParamMC->num_slots ) + + Word16 tempp; + FOR( Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++ ) { - FOR( Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->hMetadataPMC->nbands_coded; param_band_idx++ ) + + + tempp = getScaleFactor32(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], nchan_transport * nchan_out_cov); + scale_sig32(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], nchan_transport * nchan_out_cov, tempp); + st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx] = sub(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx], tempp); + + IF( st_ivas->hParamMC->band_grouping[param_band_idx] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr ) { - f2me_buf( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx], nchan_transport_tmp * nchan_out_cov ); - IF( st_ivas->hParamMC->band_grouping[param_band_idx] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr ) - { - f2me_buf( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res[param_band_idx], st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], &st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], nchan_transport_tmp * nchan_out_cov ); - } + tempp = getScaleFactor32(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], nchan_transport * nchan_out_cov); + scale_sig32(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], nchan_transport * nchan_out_cov, tempp); + st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx] = sub(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], tempp); } } #endif @@ -6663,7 +6630,6 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( * * *--------------------------------------------------------------------------*/ - #ifndef IVAS_FLOAT_FIXED void ivas_jbm_dec_copy_tc_no_tsm( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 1e03ab40d..feba808ea 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -550,20 +550,7 @@ ivas_error ivas_param_mc_dec_open_fx( hParamMC->sz = n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands; -#if 1 /*TODO: To be removed later(floating point malloc)*/ - if ( ( hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); - } - set_zero( hParamMC->Cldfb_RealBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); - if ( ( hParamMC->Cldfb_ImagBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); - } - set_zero( hParamMC->Cldfb_ImagBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); -#endif - - IF( st_ivas->hTcBuffer == NULL ) + IF ( st_ivas->hTcBuffer == NULL ) { IF( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) { @@ -575,10 +562,6 @@ ivas_error ivas_param_mc_dec_open_fx( { hParamMC->Cldfb_RealBuffer_tc_fx = NULL; hParamMC->Cldfb_ImagBuffer_tc_fx = NULL; -#if 1 /*TODO: To be removed later*/ - hParamMC->Cldfb_RealBuffer_tc = NULL; - hParamMC->Cldfb_ImagBuffer_tc = NULL; -#endif } hParamMC->subframes_rendered = 0; @@ -1539,19 +1522,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( IF( NE_16( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) { Word16 n_cldfb_slots; -#if 1 /*TODO: To be removed later*/ - IF( hParamMC->Cldfb_RealBuffer_tc != NULL ) - { - free( hParamMC->Cldfb_RealBuffer_tc ); - hParamMC->Cldfb_RealBuffer_tc = NULL; - } - IF( hParamMC->Cldfb_ImagBuffer_tc != NULL ) - { - free( hParamMC->Cldfb_ImagBuffer_tc ); - hParamMC->Cldfb_ImagBuffer_tc = NULL; - } -#endif - IF( hParamMC->Cldfb_RealBuffer_tc_fx != NULL ) + IF ( hParamMC->Cldfb_RealBuffer_tc_fx != NULL ) { free( hParamMC->Cldfb_RealBuffer_tc_fx ); hParamMC->Cldfb_RealBuffer_tc_fx = NULL; @@ -1567,20 +1538,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( { n_cldfb_slots = MAX_JBM_CLDFB_TIMESLOTS; } -#if 1 /*TODO: To be removed later*/ - IF( ( hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); - } - set_zero( hParamMC->Cldfb_RealBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); - - IF( ( hParamMC->Cldfb_ImagBuffer_tc = (float *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); - } - set_zero( hParamMC->Cldfb_ImagBuffer_tc, n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands ); -#endif - IF( ( hParamMC->Cldfb_RealBuffer_tc_fx = (Word32 *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) + IF ( ( hParamMC->Cldfb_RealBuffer_tc_fx = (Word32 *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof(Word32) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); } @@ -1594,19 +1552,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( } ELSE { -#if 1 /*TODO:To be removed later(floating point memory dealloc)*/ - IF( hParamMC->Cldfb_RealBuffer_tc != NULL ) - { - free( hParamMC->Cldfb_RealBuffer_tc ); - hParamMC->Cldfb_RealBuffer_tc = NULL; - } - IF( hParamMC->Cldfb_ImagBuffer_tc != NULL ) - { - free( hParamMC->Cldfb_ImagBuffer_tc ); - hParamMC->Cldfb_ImagBuffer_tc = NULL; - } -#endif - IF( hParamMC->Cldfb_RealBuffer_tc_fx != NULL ) + IF ( hParamMC->Cldfb_RealBuffer_tc_fx != NULL ) { free( hParamMC->Cldfb_RealBuffer_tc_fx ); hParamMC->Cldfb_RealBuffer_tc_fx = NULL; @@ -2306,16 +2252,6 @@ void ivas_param_mc_dec_close_fx( free( hParamMC->hoa_encoder ); hParamMC->hoa_encoder = NULL; } - IF( hParamMC->Cldfb_RealBuffer_tc != NULL ) - { - free( hParamMC->Cldfb_RealBuffer_tc ); - hParamMC->Cldfb_RealBuffer_tc = NULL; - } - IF( hParamMC->Cldfb_ImagBuffer_tc != NULL ) - { - free( hParamMC->Cldfb_ImagBuffer_tc ); - hParamMC->Cldfb_ImagBuffer_tc = NULL; - } #endif /***********************************ends here************************************************/ free( *hParamMC_out ); @@ -3022,9 +2958,9 @@ void ivas_param_mc_dec_digest_tc_fx( IF( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex ) { ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( &hParamMC->Cldfb_RealBuffer_tc_fx[slot_idx * hParamMC->num_freq_bands * nchan_transport], - hParamMC->Cldfb_RealBuffer_tc_e, + /*hParamMC->Cldfb_RealBuffer_tc_e*/ Q31 - Q6, &hParamMC->Cldfb_ImagBuffer_tc_fx[slot_idx * hParamMC->num_freq_bands * nchan_transport], - hParamMC->Cldfb_ImagBuffer_tc_e, + /*hParamMC->Cldfb_ImagBuffer_tc_e*/ Q31 - Q6, cx_fx, &cx_e, cx_imag_fx, @@ -3487,7 +3423,38 @@ void ivas_param_mc_dec_render_fx( } slot_idx_start = hParamMC->slots_rendered; slot_idx_start_cldfb_synth = 0; + + Flag is_zero = 1; move16(); + FOR(j = 0; j < st_ivas->hParamMC->hMetadataPMC->nbands_coded; j++) + { + is_zero = 1; move16(); + FOR(i = 0; i < hParamMC->h_output_synthesis_cov_state.mixing_matrix_len; i++) + { + IF(NE_32(hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[j][i], 0)) + { + is_zero = 0; move16(); + } + } + IF(is_zero) + { + hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[j] = 0; move16(); + } + is_zero = 1; move16(); + IF(st_ivas->hParamMC->band_grouping[j] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr) { + FOR(i = 0; i < hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_len; i++) + { + IF(NE_32(hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[j][i], 0)) + { + is_zero = 0; move16(); + } + } + } + IF(is_zero) + { + hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[j] = 0; move16(); + } + } FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) { FOR( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots[subframe_idx]; ( slot_idx++, hParamMC->slots_rendered++ ) ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index c6c307fda..114dac57c 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -106,31 +106,31 @@ typedef struct stereo_dft_dec_data_struct #endif - int16_t dft32ms_ovl; /* Overlap size */ + int16_t dft32ms_ovl; /* Overlap size */ #ifndef IVAS_FLOAT_FIXED const float *win32ms; /* DFT window */ const float *win32ms_12k8; /* DFT window */ const float *win32ms_16k; /* DFT window */ const float *win32ms_8k; /* DFT window */ #else - const Word16 *win32ms_fx; /* DFT window */ /* Q15 */ - const Word16 *win32ms_12k8_fx; /* DFT window */ /* Q15 */ - const Word16 *win32ms_16k_fx; /* DFT window */ /* Q15 */ - const Word16 *win32ms_8k_fx; /* DFT window */ /* Q15 */ + const Word16 *win32ms_fx; /* DFT window */ /* Q15 */ + const Word16 *win32ms_12k8_fx; /* DFT window */ /* Q15 */ + const Word16 *win32ms_16k_fx; /* DFT window */ /* Q15 */ + const Word16 *win32ms_8k_fx; /* DFT window */ /* Q15 */ #endif - int16_t dft32ms_ovl2; /* Overlap2 size */ + int16_t dft32ms_ovl2; /* Overlap2 size */ #ifndef IVAS_FLOAT_FIXED const float *win232ms; /* DFT window */ const float *win232ms_12k8; /* DFT window */ const float *win232ms_16k; /* DFT window */ const float *win232ms_8k; /* DFT window */ #else - const Word16 *win232ms_fx; /* DFT window */ /* Q15 */ - const Word16 *win232ms_12k8_fx; /* DFT window */ /* Q15 */ - const Word16 *win232ms_16k_fx; /* DFT window */ /* Q15 */ - const Word16 *win232ms_8k_fx; /* DFT window */ /* Q15 */ - const Word16 *win_8k_fx; /* DFT window residual */ /* Q15 */ + const Word16 *win232ms_fx; /* DFT window */ /* Q15 */ + const Word16 *win232ms_12k8_fx; /* DFT window */ /* Q15 */ + const Word16 *win232ms_16k_fx; /* DFT window */ /* Q15 */ + const Word16 *win232ms_8k_fx; /* DFT window */ /* Q15 */ + const Word16 *win_8k_fx; /* DFT window residual */ /* Q15 */ #endif #ifndef IVAS_FLOAT_FIXED @@ -149,7 +149,7 @@ typedef struct stereo_dft_dec_data_struct #ifndef IVAS_FLOAT_FIXED float side_gain[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; #else - Word32 side_gain_fx[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; /* Q31 */ + Word32 side_gain_fx[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; /* Q31 */ #endif int16_t side_gain_flag_1; int16_t side_gain_flag_2; @@ -159,7 +159,7 @@ typedef struct stereo_dft_dec_data_struct #ifndef IVAS_FLOAT_FIXED float gipd[STEREO_DFT_DEC_DFT_NB]; #else - Word32 gipd_fx[STEREO_DFT_DEC_DFT_NB]; /* Q13 */ + Word32 gipd_fx[STEREO_DFT_DEC_DFT_NB]; /* Q13 */ #endif int16_t no_ipd_flag; /* flag to indicate when no IPD gets used */ @@ -186,7 +186,7 @@ typedef struct stereo_dft_dec_data_struct #endif /*residual prediction*/ - int16_t res_pred_mode[STEREO_DFT_DEC_DFT_NB]; /* residual prediction mode: 0(off), 1(stereo filling only), 2(enhanced stereo filling) */ + int16_t res_pred_mode[STEREO_DFT_DEC_DFT_NB]; /* residual prediction mode: 0(off), 1(stereo filling only), 2(enhanced stereo filling) */ #ifndef IVAS_FLOAT_FIXED float res_pred_gain[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; /* prediction gain for the residual HFs */ #endif @@ -202,9 +202,9 @@ typedef struct stereo_dft_dec_data_struct Word32 ipd_xfade_prev_fx; /* Q13 */ Word32 res_pred_gain_fx[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; /* prediction gain for the residual HFs */ /* Q31 */ #endif - int16_t res_pred_band_min; /* Band min for prediction of residual */ + int16_t res_pred_band_min; /* Band min for prediction of residual */ #ifndef IVAS_FLOAT_FIXED - float DFT_past_DMX[STEREO_DFT_PAST_MAX][STEREO_DFT32MS_N_32k]; /* Past DMX for residual prediction */ + float DFT_past_DMX[STEREO_DFT_PAST_MAX][STEREO_DFT32MS_N_32k]; /* Past DMX for residual prediction */ #endif int16_t past_DMX_pos; int16_t res_pred_flag_0; @@ -243,7 +243,7 @@ typedef struct stereo_dft_dec_data_struct Word16 q_smoothed_nrg; Word16 q_DFT_past_DMX_fx[STEREO_DFT_PAST_MAX]; Word32 res_global_gain_fx; /* Q15 */ -#endif // IVAS_FLOAT_FIXED +#endif // IVAS_FLOAT_FIXED #ifndef IVAS_FLOAT_FIXED float res_cod_mem[STEREO_DFT_OVL_8k]; float buff_LBTCX_mem[NS2SA( 16000, STEREO_DFT32MS_OVL_NS )]; @@ -330,7 +330,7 @@ typedef struct stereo_dft_dec_data_struct #ifndef IVAS_FLOAT_FIXED float g_state[STEREO_DFT_BAND_MAX]; #else - Word16 g_state_fx[STEREO_DFT_BAND_MAX]; /* Q15 */ + Word16 g_state_fx[STEREO_DFT_BAND_MAX]; /* Q15 */ #endif int16_t frame_sid_nodata; int16_t frame_nodata; @@ -339,7 +339,7 @@ typedef struct stereo_dft_dec_data_struct #ifndef IVAS_FLOAT_FIXED float scale; #else - Word16 scale_fx; /* Q15 */ + Word16 scale_fx; /* Q15 */ #endif /* PLC on residual signal */ @@ -378,10 +378,10 @@ typedef struct stereo_dft_dec_data_struct float g_R_prev; const float *max_smooth_gains, *min_smooth_gains; #else - Word32 mixer_mat_smooth_fx[2][4][2 * IVAS_MAX_NUM_BANDS]; /* Q31 */ - Word32 g_L_prev_fx; /* Q31 */ - Word32 g_R_prev_fx; /* Q31 */ - const Word16 *max_smooth_gains_fx, *min_smooth_gains_fx; /* Q15 */ + Word32 mixer_mat_smooth_fx[2][4][2 * IVAS_MAX_NUM_BANDS]; /* Q31 */ + Word32 g_L_prev_fx; /* Q31 */ + Word32 g_R_prev_fx; /* Q31 */ + const Word16 *max_smooth_gains_fx, *min_smooth_gains_fx; /* Q15 */ #endif } STEREO_DFT_DEC_DATA, *STEREO_DFT_DEC_DATA_HANDLE; @@ -394,16 +394,16 @@ typedef struct stereo_dft_dmx_out_data_structure float targetGain; /* TCA gain norm applied on target (or right) channel in current frame */ float prevTargetGain; /* TCA gain norm applied on target (or right) channel in previous frame */ #else - Word32 targetGain_fx; /* Q29 */ - Word32 prevTargetGain_fx; /* Q29 */ + Word32 targetGain_fx; /* Q29 */ + Word32 prevTargetGain_fx; /* Q29 */ #endif #ifndef IVAS_FLOAT_FIXED float memOutHB[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; float memTransitionHB[NS2SA( 48000, STEREO_DFT32MS_OVL_NS )]; #else - Word32 memOutHB_fx[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; /* Q11 */ - Word32 memTransitionHB_fx[NS2SA( 48000, STEREO_DFT32MS_OVL_NS )]; /* Q11 */ + Word32 memOutHB_fx[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; /* Q11 */ + Word32 memTransitionHB_fx[NS2SA( 48000, STEREO_DFT32MS_OVL_NS )]; /* Q11 */ #endif } STEREO_DFT_DMX_DATA, *STEREO_DFT_DMX_DATA_HANDLE; @@ -483,14 +483,14 @@ typedef struct stereo_td_dec_data_structure #ifndef IVAS_FLOAT_FIXED float TCX_old_syn_Overl[L_FRAME16k / 2]; /* past ovrl buffer for possible switching from TD stereo ACELP to MDCT stereo TCX frame */ - float prevSP_ratio; /* previous SP ratio */ - float SP_ratio_LT; /* longterm SP ratio */ - float c_LR_LT; /* left-right cross-correlation */ + float prevSP_ratio; /* previous SP ratio */ + float SP_ratio_LT; /* longterm SP ratio */ + float c_LR_LT; /* left-right cross-correlation */ #else Word32 TCX_old_syn_Overl_fx[L_FRAME16k / 2]; /* past ovrl buffer for possible switching from TD stereo ACELP to MDCT stereo TCX frame */ /* Q11 */ - Word16 prevSP_ratio_fx; /* previous SP ratio */ - Word32 SP_ratio_LT_fx; /* longterm SP ratio */ - Word32 c_LR_LT_fx; /* left-right cross-correlation */ + Word16 prevSP_ratio_fx; /* previous SP ratio */ + Word32 SP_ratio_LT_fx; /* longterm SP ratio */ + Word32 c_LR_LT_fx; /* left-right cross-correlation */ #endif } STEREO_TD_DEC_DATA, *STEREO_TD_DEC_DATA_HANDLE; @@ -519,21 +519,21 @@ typedef struct stereo_mdct_dec_data_structure #ifndef IVAS_FLOAT_FIXED float itd; #else - Word32 itd_fx; /* Q15 */ + Word32 itd_fx; /* Q15 */ #endif int16_t reverse_dmx; #ifndef IVAS_FLOAT_FIXED float smooth_ratio; #else - Word32 smooth_ratio_fx; /* Q26 */ + Word32 smooth_ratio_fx; /* Q26 */ #endif int16_t prev_ms_mask[NB_DIV][MAX_SFB]; #ifndef IVAS_FLOAT_FIXED float lastCoh; #else - Word16 lastCoh_fx; /* Q14 */ + Word16 lastCoh_fx; /* Q14 */ #endif int16_t noise_seeds_channels[CPE_CHANNELS]; int16_t noise_seed_common; @@ -556,8 +556,8 @@ typedef struct stereo_tca_dec_data_structure float targetGain; /* gain norm applied on target (or right) channel in current frame */ float prevTargetGain; /* gain norm applied on target (or right) channel in previous frame */ #else - Word32 targetGain_fx; /* gain norm applied on target (or right) channel in current frame */ // Q29 - Word32 prevTargetGain_fx; /* gain norm applied on target (or right) channel in previous frame */ // Q29 + Word32 targetGain_fx; /* gain norm applied on target (or right) channel in current frame */ // Q29 + Word32 prevTargetGain_fx; /* gain norm applied on target (or right) channel in previous frame */ // Q29 #endif int16_t corrLagStats; /* corr lag stats in current frame */ @@ -571,8 +571,8 @@ typedef struct stereo_tca_dec_data_structure Word32 memChanL_fx[L_DEC_MEM_LEN_ICA]; /* left channel input to correct at the cross-over for Fixed */ Word32 memChanR_fx[L_DEC_MEM_LEN_ICA]; /* right channel input to correct at the cross-over for Fixed */ #else - float memChanL[L_DEC_MEM_LEN_ICA]; /* left channel input to correct at the cross-over */ - float memChanR[L_DEC_MEM_LEN_ICA]; /* right channel input to correct at the cross-over */ + float memChanL[L_DEC_MEM_LEN_ICA]; /* left channel input to correct at the cross-over */ + float memChanR[L_DEC_MEM_LEN_ICA]; /* right channel input to correct at the cross-over */ #endif } STEREO_TCA_DEC_DATA, *STEREO_TCA_DEC_HANDLE; @@ -594,9 +594,9 @@ typedef struct stereo_icbwe_dec_data_structure float memTransitionHB[CPE_CHANNELS][NS2SA( 48000, STEREO_DFT32MS_OVL_NS )]; #else - Word32 memOutHB_fx[CPE_CHANNELS][NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; /* Q11 */ + Word32 memOutHB_fx[CPE_CHANNELS][NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; /* Q11 */ - Word32 memTransitionHB_fx[CPE_CHANNELS][NS2SA( 48000, STEREO_DFT32MS_OVL_NS )]; /* Q11 */ + Word32 memTransitionHB_fx[CPE_CHANNELS][NS2SA( 48000, STEREO_DFT32MS_OVL_NS )]; /* Q11 */ #endif /* unscaled & scaled SHB synthesis memory */ @@ -605,9 +605,9 @@ typedef struct stereo_icbwe_dec_data_structure float mem_lpc_shbsynth_nonref[LPC_SHB_ORDER]; float mem_syn_shb_ola_nonref[L_SHB_LAHEAD]; #else - Word32 mem_syn_shb_nonref_fx[L_SHB_LAHEAD]; /* Q(prev_Q_syn_shb_nonref) */ - Word32 mem_lpc_shbsynth_nonref_fx[LPC_SHB_ORDER]; /* Q(prev_Q_lpc_shbsynth_nonref) */ - Word32 mem_syn_shb_ola_nonref_fx[L_SHB_LAHEAD]; /* Q(prev_Q_syn_shb_ola_nonref) */ + Word32 mem_syn_shb_nonref_fx[L_SHB_LAHEAD]; /* Q(prev_Q_syn_shb_nonref) */ + Word32 mem_lpc_shbsynth_nonref_fx[LPC_SHB_ORDER]; /* Q(prev_Q_lpc_shbsynth_nonref) */ + Word32 mem_syn_shb_ola_nonref_fx[L_SHB_LAHEAD]; /* Q(prev_Q_syn_shb_ola_nonref) */ Word16 prev_Q_syn_shb_nonref; Word16 prev_Q_lpc_shbsynth_nonref; @@ -646,7 +646,7 @@ typedef struct stereo_icbwe_dec_data_structure #ifndef IVAS_FLOAT_FIXED float icbweM2Ref_prev; #else - Word16 icbweM2Ref_prev_fx; /* Q14 */ + Word16 icbweM2Ref_prev_fx; /* Q14 */ #endif #ifndef IVAS_FLOAT_FIXED @@ -784,9 +784,9 @@ typedef struct dirac_output_synthesis_cov_state_structure float *cy_old[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_old[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_res_old[CLDFB_NO_CHANNELS_MAX]; -#endif float *mixing_matrix[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_res[CLDFB_NO_CHANNELS_MAX]; +#endif #ifdef IVAS_FLOAT_FIXED Word32 *cx_old_fx[CLDFB_NO_CHANNELS_MAX]; Word16 cx_old_len; @@ -797,12 +797,14 @@ typedef struct dirac_output_synthesis_cov_state_structure Word32 *mixing_matrix_res_old_fx[CLDFB_NO_CHANNELS_MAX]; Word32 *mixing_matrix_res_fx[CLDFB_NO_CHANNELS_MAX]; - Word16 *cx_old_e; - Word16 *cy_old_e; + Word16 * cx_old_e; + Word16 *cy_old_e; Word16 *mixing_matrix_old_exp; Word16 *mixing_matrix_res_old_exp; Word16 *mixing_matrix_exp; + Word16 mixing_matrix_len; Word16 *mixing_matrix_res_exp; + Word16 mixing_matrix_res_len; #endif // IVAS_FLOAT_FIXED } DIRAC_OUTPUT_SYNTHESIS_COV_STATE; @@ -829,14 +831,15 @@ typedef struct ivas_param_mc_diff_proto_info_structure typedef struct ivas_param_mc_dec_data_structure { int16_t slot_size; - float *Cldfb_RealBuffer_tc; - float *Cldfb_ImagBuffer_tc; #ifdef IVAS_FLOAT_FIXED - Word32 *Cldfb_RealBuffer_tc_fx; // Q12 + Word32 *Cldfb_RealBuffer_tc_fx; // Q12 Word16 Cldfb_RealBuffer_tc_e; - Word32 *Cldfb_ImagBuffer_tc_fx; // Q12 + Word32 *Cldfb_ImagBuffer_tc_fx; // Q12 Word16 Cldfb_ImagBuffer_tc_e; Word16 sz; +#else + float *Cldfb_RealBuffer_tc; + float *Cldfb_ImagBuffer_tc; #endif int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; int16_t nb_subframes; @@ -874,8 +877,8 @@ typedef struct ivas_param_mc_dec_data_structure float *icc_q; /* ICC parameters*/ float *icld_q; #else - Word16 *icc_q_fx; /* ICC parameters*/ /* Q15 */ - Word16 *icld_q_fx; /* Q8 */ + Word16 *icc_q_fx; /* ICC parameters*/ /* Q15 */ + Word16 *icld_q_fx; /* Q8 */ #endif int16_t max_param_band_abs_cov; #ifndef IVAS_FLOAT_FIXED @@ -917,14 +920,14 @@ typedef struct ivas_mc_paramupmix_dec_data_structure #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 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 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 + 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]; @@ -1008,7 +1011,7 @@ typedef struct ivas_agc_dec_chan_state_t #ifndef IVAS_FLOAT_FIXED float lastGain; #else - Word16 lastGain_fx; /* Q15 */ + Word16 lastGain_fx; /* Q15 */ #endif // IVAS_FLOAT_FIXED Word16 gainExpVal; @@ -1159,7 +1162,7 @@ typedef struct cpe_dec_data_structure #endif #ifdef IVAS_FLOAT_FIXED - Word32 lt_es_em_fx; // 24 + Word32 lt_es_em_fx;//24 Word32 prev_hb_synth_fx[CPE_CHANNELS][NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; Word32 prev_synth_fx[CPE_CHANNELS][NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS )]; @@ -1229,7 +1232,7 @@ typedef struct ivas_lfe_dec_data_structure #ifndef IVAS_FLOAT_FIXED float lfe_block_delay_s; #else - Word16 lfe_block_delay_s_fx; /* Q15 */ + Word16 lfe_block_delay_s_fx; /* Q15 */ #endif Word16 lfe_prior_buf_len; #ifndef IVAS_FLOAT_FIXED @@ -1278,17 +1281,17 @@ typedef struct ivas_binaural_rendering_struct IVAS_OUTPUT_SETUP_HANDLE hInputSetup; /* pointer to input spatial format for binaural renderer*/ EFAP_HANDLE hEFAPdata; /* EFAP structure*/ #ifndef IVAS_FLOAT_FIXED - float *hoa_dec_mtx; /* pointer to HOA decoder mtx */ + float *hoa_dec_mtx; /* pointer to HOA decoder mtx */ #else - Word32 *hoa_dec_mtx; /* pointer to HOA decoder mtx */ + Word32 *hoa_dec_mtx; /* pointer to HOA decoder mtx */ #endif - int8_t rotInCldfb; /* Flag to enable rotation within bin Renderer in CLDFB*/ - int16_t max_band; /* band upto which rendering is performed */ - int16_t conv_band; /* band upto which convolution in cldfb domain is performed */ - int16_t timeSlots; /* number of time slots of binaural renderer */ - int16_t nInChannels; /* number input channels */ - int8_t render_lfe; /* Flag to render LFE in binaural rendering*/ - IVAS_FORMAT ivas_format; /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */ + int8_t rotInCldfb; /* Flag to enable rotation within bin Renderer in CLDFB*/ + int16_t max_band; /* band upto which rendering is performed */ + int16_t conv_band; /* band upto which convolution in cldfb domain is performed */ + int16_t timeSlots; /* number of time slots of binaural renderer */ + int16_t nInChannels; /* number input channels */ + int8_t render_lfe; /* Flag to render LFE in binaural rendering*/ + IVAS_FORMAT ivas_format; /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */ /* Convolution module structure */ #ifndef IVAS_FLOAT_FIXED @@ -1334,7 +1337,7 @@ typedef struct ivas_masa_decoder_data_struct #ifndef IVAS_FLOAT_FIXED float dir_decode_quality; #else - Word16 dir_decode_quality_fx; /* Q15 */ + Word16 dir_decode_quality_fx; /* Q15 */ #endif } MASA_DECODER_DATA; @@ -1397,7 +1400,7 @@ typedef struct ivas_masa_ism_data_structure #ifndef IVAS_FLOAT_FIXED float **delayBuffer; #else - Word32 **delayBuffer_fx; /* Q11 */ + Word32 **delayBuffer_fx; /* Q11 */ #endif int16_t delayBuffer_size; int16_t delayBuffer_nchan; @@ -1415,22 +1418,22 @@ typedef struct decoder_tc_buffer_structure float *tc_buffer; /* the buffer itself */ float *tc[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc */ // VE2SB: TBV #else - Word32 *tc_buffer_fx; /* the buffer itself */ - Word16 tc_buff_len; /*stores memory length of tc buffer*/ + Word32 *tc_buffer_fx; /* the buffer itself */ + Word16 tc_buff_len;/*stores memory length of tc buffer*/ Word32 *tc_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc Q11 for ivas */ // VE2SB: TBV #ifdef MSAN_FIX Word16 no_channels; /*Stores no of channels in tc_fx with values*/ #endif Word16 q_tc_fx; #endif - TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ - int16_t nchan_transport_jbm; /* number of TCs after TC decoding */ - int16_t nchan_transport_internal; /* total number of TC buffer channels, can include e.g. TD decorr data */ - int16_t nchan_buffer_full; /* number of channels to be fully buffered */ - int16_t n_samples_available; /* samples still available for rendering in the current frame */ - int16_t n_samples_buffered; /* full number of samples in the buffer (including spill to next frame) */ - int16_t n_samples_rendered; /* samples already rendered in the current frame */ - int16_t n_samples_granularity; /* render granularity */ + TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ + int16_t nchan_transport_jbm; /* number of TCs after TC decoding */ + int16_t nchan_transport_internal; /* total number of TC buffer channels, can include e.g. TD decorr data */ + int16_t nchan_buffer_full; /* number of channels to be fully buffered */ + int16_t n_samples_available; /* samples still available for rendering in the current frame */ + int16_t n_samples_buffered; /* full number of samples in the buffer (including spill to next frame) */ + int16_t n_samples_rendered; /* samples already rendered in the current frame */ + int16_t n_samples_granularity; /* render granularity */ int16_t n_samples_flushed; int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; int16_t nb_subframes; diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 78b694122..5f25a4eeb 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1461,10 +1461,10 @@ static ivas_error IVAS_DEC_GetTcSamples( Word16 length = 15 * num_freq_bands * n_ch_cldfb_tmp + num_freq_bands * ( n_ch_cldfb_tmp - 1 ) + st_ivas->cldfbAnaDec[lp]->no_channels; FOR( Word16 lp2 = 0; lp2 < length; lp2++ ) { - st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx[lp2] = - floatToFixed( st_ivas->hParamMC->Cldfb_RealBuffer_tc[lp2], 6 ); + /*st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx[lp2] = + floatToFixed(st_ivas->hParamMC->Cldfb_RealBuffer_tc[lp2], 6); st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx[lp2] = - floatToFixed( st_ivas->hParamMC->Cldfb_ImagBuffer_tc[lp2], 6 ); + floatToFixed(st_ivas->hParamMC->Cldfb_ImagBuffer_tc[lp2], 6);*/ } } } @@ -1518,17 +1518,6 @@ static ivas_error IVAS_DEC_GetTcSamples( { num_freq_bands = st_ivas->hParamMC->num_freq_bands; } - FOR( Word16 lp = 0; lp < n_ch_cldfb_tmp; lp++ ) - { - Word16 length = 15 * num_freq_bands * n_ch_cldfb_tmp + num_freq_bands * ( n_ch_cldfb_tmp - 1 ) + st_ivas->cldfbAnaDec[lp]->no_channels; - FOR( Word16 lp2 = 0; lp2 < length; lp2++ ) - { - st_ivas->hParamMC->Cldfb_RealBuffer_tc[lp2] = - fixedToFloat( st_ivas->hParamMC->Cldfb_RealBuffer_tc_fx[lp2], 6 ); - st_ivas->hParamMC->Cldfb_ImagBuffer_tc[lp2] = - fixedToFloat( st_ivas->hParamMC->Cldfb_ImagBuffer_tc_fx[lp2], 6 ); - } - } } /*------------------------fix 2 flt----------------------*/ } diff --git a/lib_rend/ivas_dirac_output_synthesis_dec.c b/lib_rend/ivas_dirac_output_synthesis_dec.c index c9148973b..de26b93ab 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec.c @@ -181,16 +181,10 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( } /* prototype power buffers */ - dirac_output_synthesis_state->proto_power_smooth_prev = NULL; dirac_output_synthesis_state->proto_power_smooth_prev_fx = NULL; IF( hDirACRend->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { - /*TODO : remove float code*/ - if ( ( dirac_output_synthesis_state->proto_power_smooth_prev = (float *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_protos_dir * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); - } IF( ( dirac_output_synthesis_state->proto_power_smooth_prev_fx = (Word32 *) malloc( hSpatParamRendCom->num_freq_bands * hDirACRend->num_protos_dir * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); @@ -199,11 +193,6 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( } IF( dirac_output_synthesis_params->max_band_decorr > 0 && ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_LS || hDirACRend->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD ) ) { - /*TODO : remove float code*/ - if ( ( dirac_output_synthesis_state->proto_power_diff_smooth_prev = (float *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); - } IF( ( dirac_output_synthesis_state->proto_power_diff_smooth_prev_fx = (Word32 *) malloc( dirac_output_synthesis_params->max_band_decorr * hDirACRend->hOutSetup.nchan_out_woLFE * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); @@ -212,8 +201,6 @@ ivas_error ivas_dirac_dec_output_synthesis_open_fx( } ELSE { - /*TODO : remove float code*/ - dirac_output_synthesis_state->proto_power_diff_smooth_prev = NULL; dirac_output_synthesis_state->proto_power_diff_smooth_prev_fx = NULL; } @@ -743,6 +730,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open( * *------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED void ivas_dirac_dec_output_synthesis_init( SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ @@ -813,8 +801,7 @@ void ivas_dirac_dec_output_synthesis_init( return; } - -#ifdef IVAS_FLOAT_FIXED +#else void ivas_dirac_dec_output_synthesis_init_fx( SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom, /* i/o: common spatial renderer data handle */ DIRAC_REND_HANDLE hDirACRend, /* i/o: DirAC renderer handle */ @@ -863,10 +850,6 @@ void ivas_dirac_dec_output_synthesis_init_fx( set_zero( h_dirac_output_synthesis_state->cy_auto_diff_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir ); } - if ( h_dirac_output_synthesis_state->proto_power_smooth_prev != NULL ) - { - set_zero( h_dirac_output_synthesis_state->proto_power_smooth_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_protos_dir ); - } set_zero( h_dirac_output_synthesis_state->gains_dir_prev, size ); if ( hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) @@ -878,11 +861,6 @@ void ivas_dirac_dec_output_synthesis_init_fx( set_zero( h_dirac_output_synthesis_state->gains_diff_prev, hSpatParamRendCom->num_freq_bands * hDirACRend->num_outputs_dir ); } - if ( h_dirac_output_synthesis_state->proto_power_diff_smooth_prev != NULL ) - { - set_zero( h_dirac_output_synthesis_state->proto_power_diff_smooth_prev, h_dirac_output_synthesis_params->max_band_decorr * nchan_out_woLFE ); - } - #ifdef IVAS_FLOAT_FIXED IF( h_dirac_output_synthesis_state->cy_auto_dir_smooth_prev_fx != NULL ) { @@ -1057,19 +1035,6 @@ void ivas_dirac_dec_output_synthesis_close_fx( * memory deallocation *-----------------------------------------------------------------*/ - /* free power buffers */ - if ( ( dirac_output_synthesis_state )->proto_power_smooth_prev != NULL ) - { - free( ( dirac_output_synthesis_state )->proto_power_smooth_prev ); - ( dirac_output_synthesis_state )->proto_power_smooth_prev = NULL; - } - - if ( ( dirac_output_synthesis_state )->proto_power_diff_smooth_prev != NULL ) - { - free( ( dirac_output_synthesis_state )->proto_power_diff_smooth_prev ); - ( dirac_output_synthesis_state )->proto_power_diff_smooth_prev = NULL; - } - /* free target power buffers */ if ( ( dirac_output_synthesis_state )->cy_auto_dir_smooth_prev != NULL ) { diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 9cc95548d..2e8ae2cb8 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -1270,10 +1270,6 @@ ivas_error ivas_dirac_alloc_mem( hDirAC_mem->cy_auto_dir_smooth = NULL; #ifdef IVAS_FLOAT_FIXED hDirAC_mem->cy_auto_dir_smooth_fx = NULL; -#endif - hDirAC_mem->proto_power_smooth = NULL; - hDirAC_mem->proto_power_diff_smooth = NULL; -#ifdef IVAS_FLOAT_FIXED hDirAC_mem->proto_power_smooth_fx = NULL; hDirAC_mem->proto_power_diff_smooth_fx = NULL; hDirAC_mem->direct_responses_square_fx = NULL; @@ -1301,11 +1297,6 @@ ivas_error ivas_dirac_alloc_mem( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_len = size; #endif - 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 ); #ifdef IVAS_FLOAT_FIXED if ( ( hDirAC_mem->proto_power_smooth_fx = (Word32 *) malloc( sizeof( Word32 ) * size ) ) == NULL ) { @@ -1313,20 +1304,13 @@ ivas_error ivas_dirac_alloc_mem( } set_zero_fx( hDirAC_mem->proto_power_smooth_fx, size ); hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len = size; -#endif - 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 ); -#ifdef IVAS_FLOAT_FIXED if ( ( hDirAC_mem->proto_power_diff_smooth_fx = (Word32 *) malloc( sizeof( Word32 ) * size ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate stack memory for DirAC\n" ) ); } set_zero_fx( hDirAC_mem->proto_power_diff_smooth_fx, size ); hDirAC_mem->proto_power_diff_smooth_len = size; - hDirAC_mem->proto_power_diff_smooth_q = 31; + hDirAC_mem->proto_power_diff_smooth_q = Q31; #endif #ifndef IVAS_FLOAT_FIXED @@ -1361,8 +1345,6 @@ ivas_error ivas_dirac_alloc_mem( #endif } } - 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; @@ -1705,20 +1687,10 @@ void ivas_dirac_free_mem_fx( { free( hDirAC_mem->cy_auto_dir_smooth_fx ); } - IF( hDirAC_mem->proto_power_smooth != NULL ) - { - free( hDirAC_mem->proto_power_smooth ); - } IF( hDirAC_mem->proto_power_smooth_fx != NULL ) { free( hDirAC_mem->proto_power_smooth_fx ); } -#if 1 /* todo: remove float */ - IF( hDirAC_mem->proto_power_diff_smooth != NULL ) - { - free( hDirAC_mem->proto_power_diff_smooth ); - } -#endif IF( hDirAC_mem->proto_power_diff_smooth_fx != NULL ) { free( hDirAC_mem->proto_power_diff_smooth_fx ); diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index c1e22ff1c..d3c06eba4 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -160,6 +160,7 @@ ivas_error ivas_reverb_prepare_cldfb_params( * Function for convolving CLDFB-domain data with filter taps *-----------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static void ivas_cldfb_convolver( cldfb_convolver_state *convolver_state, /* i/o: pointer to convolver state structure */ float out_CLDFB_real[BINAURAL_CHANNELS][CLDFB_NO_CHANNELS_MAX], /* o : real part of binaural signals */ @@ -218,6 +219,7 @@ static void ivas_cldfb_convolver( return; } +#endif // DEBUG /*-----------------------------------------------------------------------------------------* @@ -226,6 +228,7 @@ static void ivas_cldfb_convolver( * Function converts CLDFB filter taps into time-domain data *-----------------------------------------------------------------------------------------*/ +#ifndef IVAS_FLOAT_FIXED static ivas_error get_IR_from_filter_taps( const HRTFS_FASTCONV_HANDLE hHrtfFastConv, const int16_t hrtf_idx, @@ -400,6 +403,7 @@ static ivas_error get_IR_from_filter_taps( return IVAS_ERR_OK; } +#endif /*-----------------------------------------------------------------------------------------* * Function ivas_reverb_get_cldfb_hrtf_set_properties() @@ -423,6 +427,9 @@ static ivas_error ivas_reverb_get_cldfb_hrtf_set_properties( float hrtf_count_inverted; int16_t fft_size, IR_length, log2_fft_size, half_fft_size, freq_count; ivas_error error; +#ifdef IVAS_FLOAT_FIXED/*Resolving the extra warnings added*/ + UNUSED_PARAM( error ); +#endif // !IVAS_FLOAT_FIXED fft_size = RV_FILTER_MAX_FFT_SIZE; IR_length = CLDFB_NO_CHANNELS_MAX * ( ( fft_size + CLDFB_NO_CHANNELS_MAX - 1 ) / CLDFB_NO_CHANNELS_MAX ); @@ -456,10 +463,17 @@ static ivas_error ivas_reverb_get_cldfb_hrtf_set_properties( Loop over all the HRTFs available */ for ( hrtf_idx = 0; hrtf_idx < hrtf_count; hrtf_idx++ ) { +#ifndef IVAS_FLOAT_FIXED if ( ( error = get_IR_from_filter_taps( hHrtfFastConv, hrtf_idx, input_audio_config, use_brir, sampling_rate, IR_length, current_HRTF_data_L, current_HRTF_data_R ) ) != IVAS_ERR_OK ) { return error; } +#else + UNUSED_PARAM( hHrtfFastConv ); + UNUSED_PARAM(use_brir); + UNUSED_PARAM(sampling_rate); + UNUSED_PARAM( IR_length ); +#endif /* Perform forward FFT on both L/R channels */ fft_rel( current_HRTF_data_L, (int16_t) fft_size, (int16_t) log2_fft_size ); diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 7e5eb9471..c7964bdee 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -269,8 +269,10 @@ typedef struct dirac_dec_stack_mem #endif /*Prototype NRGs*/ +#ifndef IVAS_FLOAT_FIXED float *proto_power_smooth; float *proto_power_diff_smooth; +#endif /*Gain or power factors for directional and diffuse streams*/ float *direct_power_factor; @@ -376,11 +378,15 @@ typedef struct dirac_output_synthesis_state_structure float *direct_power_factor; float *diffuse_power_factor; +#ifndef IVAS_FLOAT_FIXED float *proto_power_smooth; /* Smoothed power of the prototype signals. Size: num_freq_bands*num_channels. */ float *proto_power_smooth_prev; /* Smoothed power of the prototype signals of the previous synthesis block. Size: num_freq_bands*num_channels. */ +#endif +#ifndef IVAS_FLOAT_FIXED float *proto_power_diff_smooth; float *proto_power_diff_smooth_prev; +#endif /* only pointer to local buffers */ #ifndef IVAS_FLOAT_FIXED @@ -2084,22 +2090,24 @@ typedef struct ivas_hrtfs_fastconv_struct Word32 ***leftHRIRImag_HOA3_fx; Word32 ***rightHRIRReal_HOA3_fx; Word32 ***rightHRIRImag_HOA3_fx; -#endif +#else float ***leftHRIRReal_HOA3; float ***leftHRIRImag_HOA3; float ***rightHRIRReal_HOA3; float ***rightHRIRImag_HOA3; +#endif #ifdef IVAS_FLOAT_FIXED Word32 ***leftHRIRReal_fx; Word32 ***leftHRIRImag_fx; Word32 ***rightHRIRReal_fx; Word32 ***rightHRIRImag_fx; -#endif +#else float ***leftHRIRReal; float ***leftHRIRImag; float ***rightHRIRReal; float ***rightHRIRImag; +#endif #ifdef IVAS_FLOAT_FIXED Word32 ***leftBRIRReal_fx; @@ -2107,11 +2115,12 @@ typedef struct ivas_hrtfs_fastconv_struct Word32 ***rightBRIRReal_fx; Word32 ***rightBRIRImag_fx; Word32 FASTCONV_BRIR_latency_s_fx; -#endif +#else float ***leftBRIRReal; float ***leftBRIRImag; float ***rightBRIRReal; float ***rightBRIRImag; +#endif #ifndef IVAS_FLOAT_FIXED float FASTCONV_BRIR_latency_s; #endif @@ -2122,11 +2131,12 @@ typedef struct ivas_hrtfs_fastconv_struct Word32 ***rightHRIRReal_HOA2_fx; Word32 ***rightHRIRImag_HOA2_fx; Word32 FASTCONV_HOA2_latency_s_fx; -#endif +#else float ***leftHRIRReal_HOA2; float ***leftHRIRImag_HOA2; float ***rightHRIRReal_HOA2; float ***rightHRIRImag_HOA2; +#endif #ifndef IVAS_FLOAT_FIXED float FASTCONV_HOA2_latency_s; #endif @@ -2137,11 +2147,12 @@ typedef struct ivas_hrtfs_fastconv_struct Word32 ***rightHRIRReal_FOA_fx; Word32 ***rightHRIRImag_FOA_fx; Word32 FASTCONV_FOA_latency_s_fx; -#endif +#else float ***leftHRIRReal_FOA; float ***leftHRIRImag_FOA; float ***rightHRIRReal_FOA; float ***rightHRIRImag_FOA; +#endif #ifndef IVAS_FLOAT_FIXED float FASTCONV_FOA_latency_s; #endif diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4468ddfbe..925265558 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -14744,6 +14744,7 @@ static void intermidiate_ext_dirac_render( int16_t slot_idx; int16_t nchan_transport; int16_t masa_band_mapping[MASA_FREQUENCY_BANDS + 1]; + Word16 tmp; hDirACRend = hMasaExtRend->hDirACRend; hSpatParamRendCom = hMasaExtRend->hSpatParamRendCom; @@ -14852,7 +14853,6 @@ static void intermidiate_ext_dirac_render( 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 ); } - floatToFixed_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len ); if ( hDirACRend->proto_signal_decorr_on == 1 ) { Word16 tmp_e; @@ -14889,21 +14889,26 @@ static void intermidiate_ext_dirac_render( // //f2me_buf(DirAC_mem.frame_dec_f, DirAC_mem.frame_dec_f_fx, &hDirACRend->proto_frame_dec_f_q, DirAC_mem.frame_dec_f_len); // } hDirACRend->proto_frame_dec_f_q = 31 - hDirACRend->proto_frame_dec_f_q; - if ( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth ) + + if ( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx ) { - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); - hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_len ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len ); + tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len, tmp ); + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q += tmp; + tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->num_protos_dir * hSpatParamRendCom->num_freq_bands ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_len, tmp ); + hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q += tmp; } - hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len ); + tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len, tmp ); + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q += tmp; - if ( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) + if ( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx != 0 ) { - hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len ); - floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len ); + tmp = L_norm_arr( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len ); + scale_sig32( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len, tmp ); + hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_q += tmp; } } else @@ -14960,18 +14965,6 @@ static void intermidiate_ext_dirac_render( { fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, 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.proto_power_smooth ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len ); - } - if ( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, 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.proto_power_smooth ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_len ); - } // fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_direct_buffer_f_len); if ( hDirACRend->proto_signal_decorr_on == 1 ) { @@ -14995,15 +14988,6 @@ static void intermidiate_ext_dirac_render( hMasaExtRend->cldfbAnaRend[ch]->Q_cldfb_state = Q11; } } - if ( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_q, hDirACRend->h_output_synthesis_psd_state.proto_power_smooth_prev_len ); - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_len ); - } - IF( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev != 0 ) - { - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_q, hDirACRend->h_output_synthesis_psd_state.proto_power_diff_smooth_prev_len ); - } for ( ch = 0; ch < hDirACRend->hOutSetup.nchan_out_woLFE + hDirACRend->hOutSetup.num_lfe; ch++ ) { -- GitLab From 566e7b4e4924e9fa555fcfdf29089846b2c61f2d Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 3 Jun 2024 22:12:54 +0530 Subject: [PATCH 2/2] Clang formatting changes --- apps/decoder.c | 4 +- lib_dec/ivas_dirac_output_synthesis_cov.c | 24 ++-- lib_dec/ivas_jbm_dec.c | 22 +-- lib_dec/ivas_mc_param_dec.c | 58 ++++---- lib_dec/ivas_stat_dec.h | 164 +++++++++++----------- lib_rend/ivas_reverb_utils.c | 6 +- 6 files changed, 143 insertions(+), 135 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index ba40717a7..abe1788de 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2485,13 +2485,13 @@ static ivas_error decodeVoIP( } } - //frame++; + // frame++; if ( !arg.quietModeEnabled ) { fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame ); } vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len; - frame++; + frame++; systemTime_ms += systemTimeInc_ms; #ifdef WMOPS #ifndef DONT_COUNT diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index f6fc9b330..1374393e3 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -120,7 +120,7 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) ); } set_zero_fx( h_dirac_output_synthesis_state->mixing_matrix_fx[idx], nchan_out * nchan_in ); - h_dirac_output_synthesis_state->mixing_matrix_len = i_mult(nchan_out, nchan_in); + h_dirac_output_synthesis_state->mixing_matrix_len = i_mult( nchan_out, nchan_in ); } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { @@ -142,8 +142,8 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) ); } - set_zero_fx( h_dirac_output_synthesis_state->mixing_matrix_res_fx[idx],nchan_out * nchan_out ); - h_dirac_output_synthesis_state->mixing_matrix_res_len = i_mult(nchan_out, nchan_out); + set_zero_fx( h_dirac_output_synthesis_state->mixing_matrix_res_fx[idx], nchan_out * nchan_out ); + h_dirac_output_synthesis_state->mixing_matrix_res_len = i_mult( nchan_out, nchan_out ); } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { @@ -413,16 +413,16 @@ void ivas_dirac_dec_output_synthesis_cov_init_fx( set16_fx( h_dirac_output_synthesis_state->mixing_matrix_exp, 0, CLDFB_NO_CHANNELS_MAX ); set16_fx( h_dirac_output_synthesis_state->mixing_matrix_res_old_exp, 0, CLDFB_NO_CHANNELS_MAX ); set16_fx( h_dirac_output_synthesis_state->mixing_matrix_res_exp, 0, CLDFB_NO_CHANNELS_MAX ); -#if 1/*TODO: To be removed :Floating point initializations*/ - //FOR ( idx = 0; idx < n_param_bands; idx++ ) +#if 1 /*TODO: To be removed :Floating point initializations*/ + // FOR ( idx = 0; idx < n_param_bands; idx++ ) //{ - // set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in ); - //} + // set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in ); + // } - //FOR ( idx = 0; idx < n_param_bands_res; idx++ ) + // FOR ( idx = 0; idx < n_param_bands_res; idx++ ) //{ - // set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out ); - //} + // set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out ); + // } #endif return; @@ -2764,9 +2764,9 @@ Word16 computeMixingMatricesISM_fx( } ELSE { - Word32 reg_fac = BASOP_Util_Divide3232_Scale_cadence(MAX_32, EPSILON_FX_M, &temp_e[i]); + Word32 reg_fac = BASOP_Util_Divide3232_Scale_cadence( MAX_32, EPSILON_FX_M, &temp_e[i] ); Kx_reg_inv_fx[i] = reg_fac; - temp_e[i] = sub(temp_e[i], EPSILON_FX_E); + temp_e[i] = sub( temp_e[i], EPSILON_FX_E ); } } Kx_reg_inv_e = temp_e[0]; diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 0103bcd25..0d4ef85ff 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -3486,9 +3486,9 @@ ivas_error ivas_jbm_dec_render( nchan_out_cldfb = nchan_out_transport; set_s( channel_active_fx, 1, nchan_out_cov ); } - //ftf for ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx - //ftf changes - if (st_ivas->hParamMC->max_band_decorr > 0) + // ftf for ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx + // ftf changes + if ( st_ivas->hParamMC->max_band_decorr > 0 ) { // ftf for param_mc_protoSignalComputation_fx FOR( Word16 x = 0; x < st_ivas->hParamMC->diff_proto_info->num_protos_diff; x++ ) @@ -3504,7 +3504,7 @@ ivas_error ivas_jbm_dec_render( f2me_buf( st_ivas->hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer, st_ivas->hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer_fx, &tmp_e, st_ivas->hParamMC->h_freq_domain_decorr_ap_state->decorr_buffer_len ); st_ivas->hParamMC->h_freq_domain_decorr_ap_state->q_decorr_buffer = 31 - tmp_e; } - if ((st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM)) + if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) { if ( st_ivas->hCombinedOrientationData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { @@ -3522,21 +3522,21 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbSynDec[ch]->Q_cldfb_state = Q5; } } - + Word16 tempp; FOR( Word16 param_band_idx = 0; param_band_idx < st_ivas->hParamMC->num_param_bands_synth; param_band_idx++ ) { - tempp = getScaleFactor32(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], nchan_transport * nchan_out_cov); - scale_sig32(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], nchan_transport * nchan_out_cov, tempp); - st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx] = sub(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx], tempp); + tempp = getScaleFactor32( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], nchan_transport * nchan_out_cov ); + scale_sig32( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[param_band_idx], nchan_transport * nchan_out_cov, tempp ); + st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx] = sub( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[param_band_idx], tempp ); IF( st_ivas->hParamMC->band_grouping[param_band_idx] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr ) { - tempp = getScaleFactor32(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], nchan_transport * nchan_out_cov); - scale_sig32(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], nchan_transport * nchan_out_cov, tempp); - st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx] = sub(st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], tempp); + tempp = getScaleFactor32( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], nchan_transport * nchan_out_cov ); + scale_sig32( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[param_band_idx], nchan_transport * nchan_out_cov, tempp ); + st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx] = sub( st_ivas->hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[param_band_idx], tempp ); } } #endif diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index feba808ea..23d454fbd 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -550,7 +550,7 @@ ivas_error ivas_param_mc_dec_open_fx( hParamMC->sz = n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands; - IF ( st_ivas->hTcBuffer == NULL ) + IF( st_ivas->hTcBuffer == NULL ) { IF( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, 0, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK ) { @@ -1522,7 +1522,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( IF( NE_16( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) { Word16 n_cldfb_slots; - IF ( hParamMC->Cldfb_RealBuffer_tc_fx != NULL ) + IF( hParamMC->Cldfb_RealBuffer_tc_fx != NULL ) { free( hParamMC->Cldfb_RealBuffer_tc_fx ); hParamMC->Cldfb_RealBuffer_tc_fx = NULL; @@ -1538,7 +1538,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( { n_cldfb_slots = MAX_JBM_CLDFB_TIMESLOTS; } - IF ( ( hParamMC->Cldfb_RealBuffer_tc_fx = (Word32 *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof(Word32) ) ) == NULL ) + IF( ( hParamMC->Cldfb_RealBuffer_tc_fx = (Word32 *) malloc( n_cldfb_slots * nchan_transport * hParamMC->num_freq_bands * sizeof( Word32 ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Parametric MC JBM\n" ) ); } @@ -1552,7 +1552,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( } ELSE { - IF ( hParamMC->Cldfb_RealBuffer_tc_fx != NULL ) + IF( hParamMC->Cldfb_RealBuffer_tc_fx != NULL ) { free( hParamMC->Cldfb_RealBuffer_tc_fx ); hParamMC->Cldfb_RealBuffer_tc_fx = NULL; @@ -2960,7 +2960,7 @@ void ivas_param_mc_dec_digest_tc_fx( ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot_fx( &hParamMC->Cldfb_RealBuffer_tc_fx[slot_idx * hParamMC->num_freq_bands * nchan_transport], /*hParamMC->Cldfb_RealBuffer_tc_e*/ Q31 - Q6, &hParamMC->Cldfb_ImagBuffer_tc_fx[slot_idx * hParamMC->num_freq_bands * nchan_transport], - /*hParamMC->Cldfb_ImagBuffer_tc_e*/ Q31 - Q6, + /*hParamMC->Cldfb_ImagBuffer_tc_e*/ Q31 - Q6, cx_fx, &cx_e, cx_imag_fx, @@ -3423,36 +3423,44 @@ void ivas_param_mc_dec_render_fx( } slot_idx_start = hParamMC->slots_rendered; slot_idx_start_cldfb_synth = 0; - - Flag is_zero = 1; move16(); - FOR(j = 0; j < st_ivas->hParamMC->hMetadataPMC->nbands_coded; j++) + + Flag is_zero = 1; + move16(); + FOR( j = 0; j < st_ivas->hParamMC->hMetadataPMC->nbands_coded; j++ ) { - is_zero = 1; move16(); - FOR(i = 0; i < hParamMC->h_output_synthesis_cov_state.mixing_matrix_len; i++) + is_zero = 1; + move16(); + FOR( i = 0; i < hParamMC->h_output_synthesis_cov_state.mixing_matrix_len; i++ ) { - IF(NE_32(hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[j][i], 0)) - { - is_zero = 0; move16(); - } + IF( NE_32( hParamMC->h_output_synthesis_cov_state.mixing_matrix_fx[j][i], 0 ) ) + { + is_zero = 0; + move16(); + } } - IF(is_zero) + IF( is_zero ) { - hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[j] = 0; move16(); + hParamMC->h_output_synthesis_cov_state.mixing_matrix_exp[j] = 0; + move16(); } - is_zero = 1; move16(); - IF(st_ivas->hParamMC->band_grouping[j] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr) { - FOR(i = 0; i < hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_len; i++) + is_zero = 1; + move16(); + IF( st_ivas->hParamMC->band_grouping[j] < st_ivas->hParamMC->h_output_synthesis_params.max_band_decorr ) + { + FOR( i = 0; i < hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_len; i++ ) { - IF(NE_32(hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[j][i], 0)) - { - is_zero = 0; move16(); - } + IF( NE_32( hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_fx[j][i], 0 ) ) + { + is_zero = 0; + move16(); + } } } - IF(is_zero) + IF( is_zero ) { - hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[j] = 0; move16(); + hParamMC->h_output_synthesis_cov_state.mixing_matrix_res_exp[j] = 0; + move16(); } } FOR( subframe_idx = first_sf; subframe_idx < last_sf; subframe_idx++ ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 114dac57c..51786e21a 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -106,31 +106,31 @@ typedef struct stereo_dft_dec_data_struct #endif - int16_t dft32ms_ovl; /* Overlap size */ + int16_t dft32ms_ovl; /* Overlap size */ #ifndef IVAS_FLOAT_FIXED const float *win32ms; /* DFT window */ const float *win32ms_12k8; /* DFT window */ const float *win32ms_16k; /* DFT window */ const float *win32ms_8k; /* DFT window */ #else - const Word16 *win32ms_fx; /* DFT window */ /* Q15 */ - const Word16 *win32ms_12k8_fx; /* DFT window */ /* Q15 */ - const Word16 *win32ms_16k_fx; /* DFT window */ /* Q15 */ - const Word16 *win32ms_8k_fx; /* DFT window */ /* Q15 */ + const Word16 *win32ms_fx; /* DFT window */ /* Q15 */ + const Word16 *win32ms_12k8_fx; /* DFT window */ /* Q15 */ + const Word16 *win32ms_16k_fx; /* DFT window */ /* Q15 */ + const Word16 *win32ms_8k_fx; /* DFT window */ /* Q15 */ #endif - int16_t dft32ms_ovl2; /* Overlap2 size */ + int16_t dft32ms_ovl2; /* Overlap2 size */ #ifndef IVAS_FLOAT_FIXED const float *win232ms; /* DFT window */ const float *win232ms_12k8; /* DFT window */ const float *win232ms_16k; /* DFT window */ const float *win232ms_8k; /* DFT window */ #else - const Word16 *win232ms_fx; /* DFT window */ /* Q15 */ - const Word16 *win232ms_12k8_fx; /* DFT window */ /* Q15 */ - const Word16 *win232ms_16k_fx; /* DFT window */ /* Q15 */ - const Word16 *win232ms_8k_fx; /* DFT window */ /* Q15 */ - const Word16 *win_8k_fx; /* DFT window residual */ /* Q15 */ + const Word16 *win232ms_fx; /* DFT window */ /* Q15 */ + const Word16 *win232ms_12k8_fx; /* DFT window */ /* Q15 */ + const Word16 *win232ms_16k_fx; /* DFT window */ /* Q15 */ + const Word16 *win232ms_8k_fx; /* DFT window */ /* Q15 */ + const Word16 *win_8k_fx; /* DFT window residual */ /* Q15 */ #endif #ifndef IVAS_FLOAT_FIXED @@ -149,7 +149,7 @@ typedef struct stereo_dft_dec_data_struct #ifndef IVAS_FLOAT_FIXED float side_gain[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; #else - Word32 side_gain_fx[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; /* Q31 */ + Word32 side_gain_fx[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; /* Q31 */ #endif int16_t side_gain_flag_1; int16_t side_gain_flag_2; @@ -159,7 +159,7 @@ typedef struct stereo_dft_dec_data_struct #ifndef IVAS_FLOAT_FIXED float gipd[STEREO_DFT_DEC_DFT_NB]; #else - Word32 gipd_fx[STEREO_DFT_DEC_DFT_NB]; /* Q13 */ + Word32 gipd_fx[STEREO_DFT_DEC_DFT_NB]; /* Q13 */ #endif int16_t no_ipd_flag; /* flag to indicate when no IPD gets used */ @@ -186,7 +186,7 @@ typedef struct stereo_dft_dec_data_struct #endif /*residual prediction*/ - int16_t res_pred_mode[STEREO_DFT_DEC_DFT_NB]; /* residual prediction mode: 0(off), 1(stereo filling only), 2(enhanced stereo filling) */ + int16_t res_pred_mode[STEREO_DFT_DEC_DFT_NB]; /* residual prediction mode: 0(off), 1(stereo filling only), 2(enhanced stereo filling) */ #ifndef IVAS_FLOAT_FIXED float res_pred_gain[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; /* prediction gain for the residual HFs */ #endif @@ -202,9 +202,9 @@ typedef struct stereo_dft_dec_data_struct Word32 ipd_xfade_prev_fx; /* Q13 */ Word32 res_pred_gain_fx[STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX]; /* prediction gain for the residual HFs */ /* Q31 */ #endif - int16_t res_pred_band_min; /* Band min for prediction of residual */ + int16_t res_pred_band_min; /* Band min for prediction of residual */ #ifndef IVAS_FLOAT_FIXED - float DFT_past_DMX[STEREO_DFT_PAST_MAX][STEREO_DFT32MS_N_32k]; /* Past DMX for residual prediction */ + float DFT_past_DMX[STEREO_DFT_PAST_MAX][STEREO_DFT32MS_N_32k]; /* Past DMX for residual prediction */ #endif int16_t past_DMX_pos; int16_t res_pred_flag_0; @@ -243,7 +243,7 @@ typedef struct stereo_dft_dec_data_struct Word16 q_smoothed_nrg; Word16 q_DFT_past_DMX_fx[STEREO_DFT_PAST_MAX]; Word32 res_global_gain_fx; /* Q15 */ -#endif // IVAS_FLOAT_FIXED +#endif // IVAS_FLOAT_FIXED #ifndef IVAS_FLOAT_FIXED float res_cod_mem[STEREO_DFT_OVL_8k]; float buff_LBTCX_mem[NS2SA( 16000, STEREO_DFT32MS_OVL_NS )]; @@ -330,7 +330,7 @@ typedef struct stereo_dft_dec_data_struct #ifndef IVAS_FLOAT_FIXED float g_state[STEREO_DFT_BAND_MAX]; #else - Word16 g_state_fx[STEREO_DFT_BAND_MAX]; /* Q15 */ + Word16 g_state_fx[STEREO_DFT_BAND_MAX]; /* Q15 */ #endif int16_t frame_sid_nodata; int16_t frame_nodata; @@ -339,7 +339,7 @@ typedef struct stereo_dft_dec_data_struct #ifndef IVAS_FLOAT_FIXED float scale; #else - Word16 scale_fx; /* Q15 */ + Word16 scale_fx; /* Q15 */ #endif /* PLC on residual signal */ @@ -378,10 +378,10 @@ typedef struct stereo_dft_dec_data_struct float g_R_prev; const float *max_smooth_gains, *min_smooth_gains; #else - Word32 mixer_mat_smooth_fx[2][4][2 * IVAS_MAX_NUM_BANDS]; /* Q31 */ - Word32 g_L_prev_fx; /* Q31 */ - Word32 g_R_prev_fx; /* Q31 */ - const Word16 *max_smooth_gains_fx, *min_smooth_gains_fx; /* Q15 */ + Word32 mixer_mat_smooth_fx[2][4][2 * IVAS_MAX_NUM_BANDS]; /* Q31 */ + Word32 g_L_prev_fx; /* Q31 */ + Word32 g_R_prev_fx; /* Q31 */ + const Word16 *max_smooth_gains_fx, *min_smooth_gains_fx; /* Q15 */ #endif } STEREO_DFT_DEC_DATA, *STEREO_DFT_DEC_DATA_HANDLE; @@ -394,16 +394,16 @@ typedef struct stereo_dft_dmx_out_data_structure float targetGain; /* TCA gain norm applied on target (or right) channel in current frame */ float prevTargetGain; /* TCA gain norm applied on target (or right) channel in previous frame */ #else - Word32 targetGain_fx; /* Q29 */ - Word32 prevTargetGain_fx; /* Q29 */ + Word32 targetGain_fx; /* Q29 */ + Word32 prevTargetGain_fx; /* Q29 */ #endif #ifndef IVAS_FLOAT_FIXED float memOutHB[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; float memTransitionHB[NS2SA( 48000, STEREO_DFT32MS_OVL_NS )]; #else - Word32 memOutHB_fx[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; /* Q11 */ - Word32 memTransitionHB_fx[NS2SA( 48000, STEREO_DFT32MS_OVL_NS )]; /* Q11 */ + Word32 memOutHB_fx[NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; /* Q11 */ + Word32 memTransitionHB_fx[NS2SA( 48000, STEREO_DFT32MS_OVL_NS )]; /* Q11 */ #endif } STEREO_DFT_DMX_DATA, *STEREO_DFT_DMX_DATA_HANDLE; @@ -483,14 +483,14 @@ typedef struct stereo_td_dec_data_structure #ifndef IVAS_FLOAT_FIXED float TCX_old_syn_Overl[L_FRAME16k / 2]; /* past ovrl buffer for possible switching from TD stereo ACELP to MDCT stereo TCX frame */ - float prevSP_ratio; /* previous SP ratio */ - float SP_ratio_LT; /* longterm SP ratio */ - float c_LR_LT; /* left-right cross-correlation */ + float prevSP_ratio; /* previous SP ratio */ + float SP_ratio_LT; /* longterm SP ratio */ + float c_LR_LT; /* left-right cross-correlation */ #else Word32 TCX_old_syn_Overl_fx[L_FRAME16k / 2]; /* past ovrl buffer for possible switching from TD stereo ACELP to MDCT stereo TCX frame */ /* Q11 */ - Word16 prevSP_ratio_fx; /* previous SP ratio */ - Word32 SP_ratio_LT_fx; /* longterm SP ratio */ - Word32 c_LR_LT_fx; /* left-right cross-correlation */ + Word16 prevSP_ratio_fx; /* previous SP ratio */ + Word32 SP_ratio_LT_fx; /* longterm SP ratio */ + Word32 c_LR_LT_fx; /* left-right cross-correlation */ #endif } STEREO_TD_DEC_DATA, *STEREO_TD_DEC_DATA_HANDLE; @@ -519,21 +519,21 @@ typedef struct stereo_mdct_dec_data_structure #ifndef IVAS_FLOAT_FIXED float itd; #else - Word32 itd_fx; /* Q15 */ + Word32 itd_fx; /* Q15 */ #endif int16_t reverse_dmx; #ifndef IVAS_FLOAT_FIXED float smooth_ratio; #else - Word32 smooth_ratio_fx; /* Q26 */ + Word32 smooth_ratio_fx; /* Q26 */ #endif int16_t prev_ms_mask[NB_DIV][MAX_SFB]; #ifndef IVAS_FLOAT_FIXED float lastCoh; #else - Word16 lastCoh_fx; /* Q14 */ + Word16 lastCoh_fx; /* Q14 */ #endif int16_t noise_seeds_channels[CPE_CHANNELS]; int16_t noise_seed_common; @@ -556,8 +556,8 @@ typedef struct stereo_tca_dec_data_structure float targetGain; /* gain norm applied on target (or right) channel in current frame */ float prevTargetGain; /* gain norm applied on target (or right) channel in previous frame */ #else - Word32 targetGain_fx; /* gain norm applied on target (or right) channel in current frame */ // Q29 - Word32 prevTargetGain_fx; /* gain norm applied on target (or right) channel in previous frame */ // Q29 + Word32 targetGain_fx; /* gain norm applied on target (or right) channel in current frame */ // Q29 + Word32 prevTargetGain_fx; /* gain norm applied on target (or right) channel in previous frame */ // Q29 #endif int16_t corrLagStats; /* corr lag stats in current frame */ @@ -571,8 +571,8 @@ typedef struct stereo_tca_dec_data_structure Word32 memChanL_fx[L_DEC_MEM_LEN_ICA]; /* left channel input to correct at the cross-over for Fixed */ Word32 memChanR_fx[L_DEC_MEM_LEN_ICA]; /* right channel input to correct at the cross-over for Fixed */ #else - float memChanL[L_DEC_MEM_LEN_ICA]; /* left channel input to correct at the cross-over */ - float memChanR[L_DEC_MEM_LEN_ICA]; /* right channel input to correct at the cross-over */ + float memChanL[L_DEC_MEM_LEN_ICA]; /* left channel input to correct at the cross-over */ + float memChanR[L_DEC_MEM_LEN_ICA]; /* right channel input to correct at the cross-over */ #endif } STEREO_TCA_DEC_DATA, *STEREO_TCA_DEC_HANDLE; @@ -594,9 +594,9 @@ typedef struct stereo_icbwe_dec_data_structure float memTransitionHB[CPE_CHANNELS][NS2SA( 48000, STEREO_DFT32MS_OVL_NS )]; #else - Word32 memOutHB_fx[CPE_CHANNELS][NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; /* Q11 */ + Word32 memOutHB_fx[CPE_CHANNELS][NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; /* Q11 */ - Word32 memTransitionHB_fx[CPE_CHANNELS][NS2SA( 48000, STEREO_DFT32MS_OVL_NS )]; /* Q11 */ + Word32 memTransitionHB_fx[CPE_CHANNELS][NS2SA( 48000, STEREO_DFT32MS_OVL_NS )]; /* Q11 */ #endif /* unscaled & scaled SHB synthesis memory */ @@ -605,9 +605,9 @@ typedef struct stereo_icbwe_dec_data_structure float mem_lpc_shbsynth_nonref[LPC_SHB_ORDER]; float mem_syn_shb_ola_nonref[L_SHB_LAHEAD]; #else - Word32 mem_syn_shb_nonref_fx[L_SHB_LAHEAD]; /* Q(prev_Q_syn_shb_nonref) */ - Word32 mem_lpc_shbsynth_nonref_fx[LPC_SHB_ORDER]; /* Q(prev_Q_lpc_shbsynth_nonref) */ - Word32 mem_syn_shb_ola_nonref_fx[L_SHB_LAHEAD]; /* Q(prev_Q_syn_shb_ola_nonref) */ + Word32 mem_syn_shb_nonref_fx[L_SHB_LAHEAD]; /* Q(prev_Q_syn_shb_nonref) */ + Word32 mem_lpc_shbsynth_nonref_fx[LPC_SHB_ORDER]; /* Q(prev_Q_lpc_shbsynth_nonref) */ + Word32 mem_syn_shb_ola_nonref_fx[L_SHB_LAHEAD]; /* Q(prev_Q_syn_shb_ola_nonref) */ Word16 prev_Q_syn_shb_nonref; Word16 prev_Q_lpc_shbsynth_nonref; @@ -646,7 +646,7 @@ typedef struct stereo_icbwe_dec_data_structure #ifndef IVAS_FLOAT_FIXED float icbweM2Ref_prev; #else - Word16 icbweM2Ref_prev_fx; /* Q14 */ + Word16 icbweM2Ref_prev_fx; /* Q14 */ #endif #ifndef IVAS_FLOAT_FIXED @@ -797,8 +797,8 @@ typedef struct dirac_output_synthesis_cov_state_structure Word32 *mixing_matrix_res_old_fx[CLDFB_NO_CHANNELS_MAX]; Word32 *mixing_matrix_res_fx[CLDFB_NO_CHANNELS_MAX]; - Word16 * cx_old_e; - Word16 *cy_old_e; + Word16 *cx_old_e; + Word16 *cy_old_e; Word16 *mixing_matrix_old_exp; Word16 *mixing_matrix_res_old_exp; Word16 *mixing_matrix_exp; @@ -832,9 +832,9 @@ typedef struct ivas_param_mc_dec_data_structure { int16_t slot_size; #ifdef IVAS_FLOAT_FIXED - Word32 *Cldfb_RealBuffer_tc_fx; // Q12 + Word32 *Cldfb_RealBuffer_tc_fx; // Q12 Word16 Cldfb_RealBuffer_tc_e; - Word32 *Cldfb_ImagBuffer_tc_fx; // Q12 + Word32 *Cldfb_ImagBuffer_tc_fx; // Q12 Word16 Cldfb_ImagBuffer_tc_e; Word16 sz; #else @@ -865,8 +865,8 @@ typedef struct ivas_param_mc_dec_data_structure float *proto_frame_f; float *proto_frame_dec_f; #else - Word32 *proto_frame_f_fx; /* Q11 */ - Word32 *proto_frame_dec_f_fx; /* Q11 */ + Word32 *proto_frame_f_fx; /* Q11 */ + Word32 *proto_frame_dec_f_fx; /* Q11 */ #endif DIRAC_OUTPUT_SYNTHESIS_COV_STATE h_output_synthesis_cov_state; @@ -920,14 +920,14 @@ typedef struct ivas_mc_paramupmix_dec_data_structure #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 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 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 + 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]; @@ -1011,7 +1011,7 @@ typedef struct ivas_agc_dec_chan_state_t #ifndef IVAS_FLOAT_FIXED float lastGain; #else - Word16 lastGain_fx; /* Q15 */ + Word16 lastGain_fx; /* Q15 */ #endif // IVAS_FLOAT_FIXED Word16 gainExpVal; @@ -1162,7 +1162,7 @@ typedef struct cpe_dec_data_structure #endif #ifdef IVAS_FLOAT_FIXED - Word32 lt_es_em_fx;//24 + Word32 lt_es_em_fx; // 24 Word32 prev_hb_synth_fx[CPE_CHANNELS][NS2SA( 48000, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS )]; Word32 prev_synth_fx[CPE_CHANNELS][NS2SA( 48000, IVAS_DEC_DELAY_NS - STEREO_DFT32MS_OVL_NS )]; @@ -1232,7 +1232,7 @@ typedef struct ivas_lfe_dec_data_structure #ifndef IVAS_FLOAT_FIXED float lfe_block_delay_s; #else - Word16 lfe_block_delay_s_fx; /* Q15 */ + Word16 lfe_block_delay_s_fx; /* Q15 */ #endif Word16 lfe_prior_buf_len; #ifndef IVAS_FLOAT_FIXED @@ -1281,17 +1281,17 @@ typedef struct ivas_binaural_rendering_struct IVAS_OUTPUT_SETUP_HANDLE hInputSetup; /* pointer to input spatial format for binaural renderer*/ EFAP_HANDLE hEFAPdata; /* EFAP structure*/ #ifndef IVAS_FLOAT_FIXED - float *hoa_dec_mtx; /* pointer to HOA decoder mtx */ + float *hoa_dec_mtx; /* pointer to HOA decoder mtx */ #else - Word32 *hoa_dec_mtx; /* pointer to HOA decoder mtx */ + Word32 *hoa_dec_mtx; /* pointer to HOA decoder mtx */ #endif - int8_t rotInCldfb; /* Flag to enable rotation within bin Renderer in CLDFB*/ - int16_t max_band; /* band upto which rendering is performed */ - int16_t conv_band; /* band upto which convolution in cldfb domain is performed */ - int16_t timeSlots; /* number of time slots of binaural renderer */ - int16_t nInChannels; /* number input channels */ - int8_t render_lfe; /* Flag to render LFE in binaural rendering*/ - IVAS_FORMAT ivas_format; /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */ + int8_t rotInCldfb; /* Flag to enable rotation within bin Renderer in CLDFB*/ + int16_t max_band; /* band upto which rendering is performed */ + int16_t conv_band; /* band upto which convolution in cldfb domain is performed */ + int16_t timeSlots; /* number of time slots of binaural renderer */ + int16_t nInChannels; /* number input channels */ + int8_t render_lfe; /* Flag to render LFE in binaural rendering*/ + IVAS_FORMAT ivas_format; /* format; corresponds to st_ivas->ivas_format, unless the signal gets transormed to a different domain for rendering */ /* Convolution module structure */ #ifndef IVAS_FLOAT_FIXED @@ -1337,7 +1337,7 @@ typedef struct ivas_masa_decoder_data_struct #ifndef IVAS_FLOAT_FIXED float dir_decode_quality; #else - Word16 dir_decode_quality_fx; /* Q15 */ + Word16 dir_decode_quality_fx; /* Q15 */ #endif } MASA_DECODER_DATA; @@ -1400,7 +1400,7 @@ typedef struct ivas_masa_ism_data_structure #ifndef IVAS_FLOAT_FIXED float **delayBuffer; #else - Word32 **delayBuffer_fx; /* Q11 */ + Word32 **delayBuffer_fx; /* Q11 */ #endif int16_t delayBuffer_size; int16_t delayBuffer_nchan; @@ -1418,22 +1418,22 @@ typedef struct decoder_tc_buffer_structure float *tc_buffer; /* the buffer itself */ float *tc[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc */ // VE2SB: TBV #else - Word32 *tc_buffer_fx; /* the buffer itself */ - Word16 tc_buff_len;/*stores memory length of tc buffer*/ + Word32 *tc_buffer_fx; /* the buffer itself */ + Word16 tc_buff_len; /*stores memory length of tc buffer*/ Word32 *tc_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; /* pointers into the buffer to the beginning of each tc Q11 for ivas */ // VE2SB: TBV #ifdef MSAN_FIX Word16 no_channels; /*Stores no of channels in tc_fx with values*/ #endif Word16 q_tc_fx; #endif - TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ - int16_t nchan_transport_jbm; /* number of TCs after TC decoding */ - int16_t nchan_transport_internal; /* total number of TC buffer channels, can include e.g. TD decorr data */ - int16_t nchan_buffer_full; /* number of channels to be fully buffered */ - int16_t n_samples_available; /* samples still available for rendering in the current frame */ - int16_t n_samples_buffered; /* full number of samples in the buffer (including spill to next frame) */ - int16_t n_samples_rendered; /* samples already rendered in the current frame */ - int16_t n_samples_granularity; /* render granularity */ + TC_BUFFER_MODE tc_buffer_mode; /* mode of the buffer (no buffering, render buffering, out buffering) */ + int16_t nchan_transport_jbm; /* number of TCs after TC decoding */ + int16_t nchan_transport_internal; /* total number of TC buffer channels, can include e.g. TD decorr data */ + int16_t nchan_buffer_full; /* number of channels to be fully buffered */ + int16_t n_samples_available; /* samples still available for rendering in the current frame */ + int16_t n_samples_buffered; /* full number of samples in the buffer (including spill to next frame) */ + int16_t n_samples_rendered; /* samples already rendered in the current frame */ + int16_t n_samples_granularity; /* render granularity */ int16_t n_samples_flushed; int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; int16_t nb_subframes; diff --git a/lib_rend/ivas_reverb_utils.c b/lib_rend/ivas_reverb_utils.c index d3c06eba4..7f4af7703 100644 --- a/lib_rend/ivas_reverb_utils.c +++ b/lib_rend/ivas_reverb_utils.c @@ -427,7 +427,7 @@ static ivas_error ivas_reverb_get_cldfb_hrtf_set_properties( float hrtf_count_inverted; int16_t fft_size, IR_length, log2_fft_size, half_fft_size, freq_count; ivas_error error; -#ifdef IVAS_FLOAT_FIXED/*Resolving the extra warnings added*/ +#ifdef IVAS_FLOAT_FIXED /*Resolving the extra warnings added*/ UNUSED_PARAM( error ); #endif // !IVAS_FLOAT_FIXED @@ -470,8 +470,8 @@ static ivas_error ivas_reverb_get_cldfb_hrtf_set_properties( } #else UNUSED_PARAM( hHrtfFastConv ); - UNUSED_PARAM(use_brir); - UNUSED_PARAM(sampling_rate); + UNUSED_PARAM( use_brir ); + UNUSED_PARAM( sampling_rate ); UNUSED_PARAM( IR_length ); #endif -- GitLab