diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 0a7e7967b8c2dbac22176cc3046a5a4d48cf0bda..f3666bd4ef58e9295b03a5af2abb2ce2321db8b2 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -826,11 +826,6 @@ void masa_sample_rate_band_correction_fx( { FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { -#if 1 /* TODO: remove float code */ - hQMetaData->q_direction[0].band_data[band].azimuth[sf] = 0.0f; - hQMetaData->q_direction[0].band_data[band].elevation[sf] = 0.0f; - hQMetaData->q_direction[0].band_data[band].energy_ratio[sf] = 0.0f; -#endif hQMetaData->q_direction[0].band_data[band].azimuth_fx[sf] = 0; move32(); hQMetaData->q_direction[0].band_data[band].elevation_fx[sf] = 0; @@ -845,11 +840,6 @@ void masa_sample_rate_band_correction_fx( IF( EQ_16( (Word16) hQMetaData->no_directions, 2 ) ) { -#if 1 /* TODO: remove float code */ - hQMetaData->q_direction[1].band_data[band].azimuth[sf] = 0.0f; - hQMetaData->q_direction[1].band_data[band].elevation[sf] = 0.0f; - hQMetaData->q_direction[1].band_data[band].energy_ratio[sf] = 0.0f; -#endif hQMetaData->q_direction[1].band_data[band].azimuth_fx[sf] = 0; move32(); hQMetaData->q_direction[1].band_data[band].elevation_fx[sf] = 0; diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index efd2b299d4eed181600c497a455a85843b8496e2..47ab659aa68e92cfc82aff722959fd67e56812a6 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -60,11 +60,11 @@ typedef struct int16_t last_ism_metadata_flag; /* last frame ism_metadata_flag */ #ifdef IVAS_FLOAT_FIXED - Word32 azimuth_fx; /* azimuth value read from the input metadata file */ // q = 22 - Word32 elevation_fx; /* elevation value read from the input metadata file */ // q = 22 - Word16 radius_fx; /* radius value read from the input metadata file */ // q = 9 - Word32 yaw_fx; /* yaw value read from the input metadata file */ // q = 22 - Word32 pitch_fx; /* pitch value read from the input metadata file */ // q = 22 + Word32 azimuth_fx; /* azimuth value read from the input metadata file */ /* Q22 */ + Word32 elevation_fx; /* elevation value read from the input metadata file */ /* Q22 */ + Word16 radius_fx; /* radius value read from the input metadata file */ /* Q9 */ + Word32 yaw_fx; /* yaw value read from the input metadata file */ /* Q22 */ + Word32 pitch_fx; /* pitch value read from the input metadata file */ /* Q22 */ #endif float azimuth; /* azimuth value read from the input metadata file */ float elevation; /* elevation value read from the input metadata file */ @@ -84,10 +84,10 @@ typedef struct float last_true_azimuth; /* MD smoothing in DTX- last true Q azimuth value */ float last_true_elevation; /* MD smoothing in DTX- last true Q elevation value */ #ifdef IVAS_FLOAT_FIXED - Word32 last_azimuth_fx; /* MD smoothing in DTX- last Q azimuth value */ - Word32 last_elevation_fx; /* MD smoothing in DTX - last Q elevation value */ - Word32 last_true_azimuth_fx; /* MD smoothing in DTX- last true Q azimuth value */ - Word32 last_true_elevation_fx; /* MD smoothing in DTX- last true Q elevation value */ + Word32 last_azimuth_fx; /* MD smoothing in DTX- last Q azimuth value */ /* Q22 */ + Word32 last_elevation_fx; /* MD smoothing in DTX - last Q elevation value */ /* Q22 */ + Word32 last_true_azimuth_fx; /* MD smoothing in DTX- last true Q azimuth value */ /* Q22 */ + Word32 last_true_elevation_fx; /* MD smoothing in DTX- last true Q elevation value */ /* Q22 */ #endif int16_t ism_md_fec_cnt_enc; /* counter of continuous frames where MD are not transmitted */ @@ -232,9 +232,9 @@ typedef struct ivas_spar_md_prev_t typedef struct ivas_quant_coeffs_t { float min; - Word32 min_fx; + Word32 min_fx; /* Q28 */ float max; - Word32 max_fx; + Word32 max_fx; /* Q28 */ int16_t q_levels[2]; } ivas_quant_coeffs_t; @@ -375,20 +375,21 @@ typedef struct ivas_cov_smooth_state_t int16_t num_bins; #ifdef IVAS_FLOAT_FIXED Word32 *pPrior_cov_real_fx[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; - Word32 *pSmoothing_factor_fx; + Word32 *pSmoothing_factor_fx; /* Q31 */ #endif } ivas_cov_smooth_state_t; typedef struct ivas_cov_smooth_cfg_t { +#ifndef IVAS_FLOAT_FIXED float max_update_rate; +#else + Word32 max_update_rate_fx; /* Q31 */ +#endif int16_t min_pool_size; int16_t max_bands; int16_t num_bins; -#ifdef IVAS_FLOAT_FIXED - Word32 max_update_rate_fx; -#endif } ivas_cov_smooth_cfg_t; @@ -636,7 +637,7 @@ typedef struct ivas_param_mc_conf_struct /* structure for ROM Table */ const float *ild_factors; #ifdef IVAS_FLOAT_FIXED const Word16 *ild_factors_fx; - const Word32 *dmx_fac_fx; + const Word32 *dmx_fac_fx; /* Q31 */ #endif } PARAM_MC_CONF; diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index ee995a291a3e1410cc9192a1f562167725466599..06fed1a79e30cb2a80da6fb2194e3e0c35810ba0 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -3514,7 +3514,7 @@ void ivas_dirac_dec_render_sf_fx( offset = i_mult( hSpatParamRendCom->num_freq_bands, add( hSpatParamRendCom->slots_rendered, slot_idx ) ); FOR( ch = 0; ch < nchan_transport; ch++ ) { - floatToFixed_arrL32( &st_ivas->hTcBuffer->tc[hDirACRend->sba_map_tc[ch]][offset], &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], Q11, hSpatParamRendCom->num_freq_bands ); + //floatToFixed_arrL32( &st_ivas->hTcBuffer->tc[hDirACRend->sba_map_tc[ch]][offset], &st_ivas->hTcBuffer->tc_fx[hDirACRend->sba_map_tc[ch]][offset], Q11, hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL32( st_ivas->cldfbAnaDec[ch]->cldfb_state, st_ivas->cldfbAnaDec[ch]->cldfb_state_fx, Q11, ( st_ivas->cldfbAnaDec[ch]->p_filter_length - st_ivas->cldfbAnaDec[ch]->no_channels ) ); } } @@ -3522,7 +3522,6 @@ void ivas_dirac_dec_render_sf_fx( IF( EQ_16( st_ivas->nchan_transport, 1 ) && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && !( L_or( EQ_16( st_ivas->ivas_format, SBA_FORMAT ), EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) ) ) { - floatToFixed_arrL32( st_ivas->hTcBuffer->tc[1], st_ivas->hTcBuffer->tc_fx[1], Q11, hSpatParamRendCom->num_freq_bands ); floatToFixed_arrL32( st_ivas->cldfbAnaDec[1]->cldfb_state, st_ivas->cldfbAnaDec[1]->cldfb_state_fx, Q11, ( st_ivas->cldfbAnaDec[1]->p_filter_length - st_ivas->cldfbAnaDec[1]->no_channels ) ); } @@ -3553,10 +3552,6 @@ void ivas_dirac_dec_render_sf_fx( 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 ) ); - IF( hDirACRend->masa_stereo_type_detect ) - { - hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = floatToFixed(hDirACRend->masa_stereo_type_detect->subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y); - } } BREAK; case 1: @@ -3688,15 +3683,6 @@ void ivas_dirac_dec_render_sf_fx( ELSE { floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.gains_diff_prev, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_fx, hDirACRend->h_output_synthesis_psd_state.gains_diff_prev_q, hSpatParamRendCom->num_freq_bands * hDirACRend->hOutSetup.nchan_out_woLFE ); - IF( hDirACRend->masa_stereo_type_detect != NULL ) - { - hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth = L_get_q( hDirACRend->masa_stereo_type_detect->target_power_y_smooth ); - hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->target_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); - hDirACRend->masa_stereo_type_detect->q_subtract_power_y = L_get_q( hDirACRend->masa_stereo_type_detect->subtract_power_y ); - hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth = L_get_q( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth ); - hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth ); - hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - } hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev = L_get_q_buf1( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, size_ho ); floatToFixed_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_prev_fx, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth_prev, size_ho ); @@ -5108,10 +5094,6 @@ void ivas_dirac_dec_render_sf_fx( 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 ); - IF( hDirACRend->masa_stereo_type_detect ) - { - hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat_32( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - } } ELSE { @@ -5136,10 +5118,6 @@ void ivas_dirac_dec_render_sf_fx( { 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 ) ); - IF( hDirACRend->masa_stereo_type_detect ) - { - hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat_32( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - } } 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 ); @@ -5254,13 +5232,6 @@ void ivas_dirac_dec_render_sf_fx( } ELSE { - IF( hDirACRend->masa_stereo_type_detect != NULL ) - { - hDirACRend->masa_stereo_type_detect->target_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); - hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - } - fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_dir_smooth, size ); fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_cross_dir_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_cross_dir_smooth, size_ho ); fixedToFloat_arrL( hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth_fx, hDirACRend->h_output_synthesis_psd_state.cy_auto_diff_smooth, hDirACRend->h_output_synthesis_psd_state.q_cy_auto_diff_smooth, size ); diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index 42d1c3ce94a3f4bcfa28f5a7277df8a7de5d1e13..b87204eea25af976da4520e3f7a676f0a4adcaf7 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -2304,7 +2304,11 @@ Word16 computeMixingMatricesResidual_fx( Word32 mat_mult_buffer3_fx[MAX_OUTPUT_CHANNELS * MAX_OUTPUT_CHANNELS]; Word16 mixing_matrix_e = 0, mat_mult_buffer1_e, adj_e, mat_mult_buffer3_e, mat_mult_buffer2_e; +#ifdef MSAN_FIX + Word32 svd_s_buffer_fx[MAX_OUTPUT_CHANNELS] = { 0 }; +#else Word32 svd_s_buffer_fx[MAX_OUTPUT_CHANNELS]; +#endif Word16 svd_s_buffer_fx_e; Word32 L_tmp; Word16 tmp_e; diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 67998d4ba275f43f13f76004483e776820ca6a84..0543b1519fe3f9391d2b9ccfbab8c90a4e5d1b45 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -1370,12 +1370,6 @@ ivas_error ivas_ism_metadata_dec_create_fx( move32(); st_ivas->hIsmMetaData[ch]->last_elevation_fx = 0; move32(); -#ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED - st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0; - st_ivas->hIsmMetaData[ch]->last_true_elevation = 0; - st_ivas->hIsmMetaData[ch]->last_azimuth = 0; - st_ivas->hIsmMetaData[ch]->last_elevation = 0; -#endif st_ivas->hIsmMetaData[ch]->ism_imp = -1; move16(); diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 5a6f0494911c70bad11efd5b532b0664376b7e49..8085781fdb4ed59216f84a84ab8bd24e3fd5beca 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -924,7 +924,6 @@ ivas_error ivas_param_ism_dec_open_fx( ivas_param_ism_config_fx( hParamIsmDec->hParamIsm, st_ivas->nchan_ism ); // assuming Q14 for gains; #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED hParamIsmDec->hParamIsm->last_dmx_gain = 1.0f; - set_f(hParamIsmDec->hParamIsm->last_cardioid_left, 1.0f, MAX_NUM_OBJECTS ); #endif /*-----------------------------------------------------------------* diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index ce35f0b0e2c070a3c71d6af4ca7060fd1028fe7f..c3c7c05fd21b750fc6fc20fbf538c0a09c024746 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2089,6 +2089,13 @@ void ivas_jbm_dec_feed_tc_to_renderer( Word32 *p_data_f_fx[MAX_CLDFB_DIGEST_CHANNELS]; Word32* data_fx; data_fx = (Word32*)malloc(8640 * sizeof(Word32)); + + IF(st_ivas->hTcBuffer){ + st_ivas->hTcBuffer->q_tc_fx = 11; + } + IF(st_ivas->hSpar){ + st_ivas->hSpar->hMdDec->Q_mixer_mat = 31; + } #endif Word16 n, n_render_timeslots, i; @@ -2106,21 +2113,14 @@ void ivas_jbm_dec_feed_tc_to_renderer( #ifdef IVAS_FLOAT_FIXED #if 1 floatToFixed_arrL(data, data_fx, 11, s_min(3, st_ivas->hTcBuffer->nchan_transport_jbm)*2880); - Word16 temp = st_ivas->hTcBuffer->n_samples_buffered - st_ivas->hTcBuffer->n_samples_rendered; //Thsese values get updated in function - #endif ivas_jbm_dec_copy_tc( st_ivas, nSamplesForRendering, nSamplesResidual, data_fx, p_data_f_fx, 11); #if 1 //To-be-removed Word16 ch; - FOR (ch = 0; ch < min( st_ivas->hTcBuffer->nchan_transport_jbm, st_ivas->hTcBuffer->nchan_buffer_full ); ch++ ) - { - fixedToFloat_arrL(st_ivas->hTcBuffer->tc_fx[ch], st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->q_tc_fx, nSamplesForRendering + temp); - } - if ( st_ivas->hTcBuffer->nchan_transport_jbm - st_ivas->hTcBuffer->nchan_buffer_full > 0 ) { - for ( ; ch < st_ivas->hTcBuffer->nchan_transport_jbm; ch++ ) + for (ch = min( st_ivas->hTcBuffer->nchan_transport_jbm, st_ivas->hTcBuffer->nchan_buffer_full ) ; ch < st_ivas->hTcBuffer->nchan_transport_jbm; ch++ ) { fixedToFloat_arrL(p_data_f_fx[ch], p_data_f[ch], st_ivas->hTcBuffer->q_tc_fx, MAX_JBM_L_FRAME48k); } @@ -2202,57 +2202,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( ELSE IF ( EQ_16(st_ivas->ivas_format, SBA_FORMAT) || EQ_16(st_ivas->ivas_format, MASA_FORMAT )) { #if 1 - Word16 nchan_transport = 0; - SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; - if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) - { - nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - hSpar->hMdDec->Q_mixer_mat = 31; - - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) - { - Word16 ch_sba_idx = 0; - IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) - { - IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - ch_sba_idx = st_ivas->nchan_ism; - move16(); - } - } - st_ivas->hTcBuffer->q_tc_fx = 11; - for ( i = 0; i < ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) + ch_sba_idx; i++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], st_ivas->hTcBuffer->q_tc_fx, min( nSamplesForRendering, (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) ) ); - } - } - } - - if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->hDiracDecBin->useTdDecorr ) ) - { - st_ivas->hTcBuffer->q_tc_fx = 11; - Word16 nSamplesLeftForTD, default_frame; - default_frame = (Word16) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - nSamplesLeftForTD = nSamplesForRendering; - Word16 size = 0; - - while ( nSamplesLeftForTD ) - { - Word16 nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); - size += nSamplesToDecorr; - nSamplesLeftForTD -= nSamplesToDecorr; - } - size = s_max( size, default_frame ); - for ( int ch_idx = 0; ch_idx < BINAURAL_CHANNELS + 2; ch_idx++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->q_tc_fx, size ); - } - } - nchan_transport = st_ivas->nchan_transport; - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && ( st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 || ( st_ivas->hDecoderConfig->ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE > 0 && st_ivas->hCPE[0]->nchan_out == 1 ) ) ) - { - nchan_transport = 1; /* Only one channel transported */ - } IF(st_ivas->hSCE[0]) { Word16 shift = getScaleFactor32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); @@ -2265,81 +2214,30 @@ void ivas_jbm_dec_feed_tc_to_renderer( } #endif ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); - -#if 1 - if (st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) - { - IF(hSpar->hMdDec->td_decorr_flag && !(EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC) || EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM))) - { - Word16 ch_sba_idx = 0; - IF(EQ_16(st_ivas->ivas_format, SBA_ISM_FORMAT)) - { - IF(EQ_16(st_ivas->ism_mode, ISM_SBA_MODE_DISC)) - { - ch_sba_idx = st_ivas->nchan_ism; move16(); - } - } - for ( i = 0; i < ivas_sba_get_nchan_metadata(st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate) + ch_sba_idx; i++) - { - fixedToFloat_arrL(st_ivas->hTcBuffer->tc_fx[i], st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->q_tc_fx, min(nSamplesForRendering, (int16_t)(st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC))); - } - } - } - - if (st_ivas->hDiracDecBin != NULL && (st_ivas->hDiracDecBin->useTdDecorr)) - { - st_ivas->hTcBuffer->q_tc_fx = 11; - int16_t nSamplesLeftForTD, default_frame; - default_frame = (int16_t)(st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC); - nSamplesLeftForTD = nSamplesForRendering; - Word16 size = 0; - - while (nSamplesLeftForTD) - { - int16_t nSamplesToDecorr = min(nSamplesLeftForTD, default_frame); - size += nSamplesToDecorr; - nSamplesLeftForTD -= nSamplesToDecorr; - } - size = s_max(size, default_frame); - for (int ch_idx = 0; ch_idx < BINAURAL_CHANNELS + 2; ch_idx++) - { - fixedToFloat_arrL(st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->q_tc_fx, size); - } - } - - if (((st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT) && st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag) || - ((st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC) && (nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag))) - { - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - fixedToFloat_arrL(st_ivas->hTcBuffer->tc_fx[1], st_ivas->hTcBuffer->tc[1], 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize); - } -#endif } - else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) + ELSE IF ( EQ_16(st_ivas->ivas_format, SBA_ISM_FORMAT )) { - if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + IF ( EQ_16(st_ivas->ism_mode, ISM_SBA_MODE_DISC )) { ivas_ism_dec_digest_tc_fx( st_ivas ); + test();test();test();test(); /* delay the objects here for all renderers where it is needed */ - if ( - st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || - st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || - st_ivas->renderer_type == RENDERER_OSBA_AMBI || - st_ivas->renderer_type == RENDERER_OSBA_LS || - st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) + IF ( + EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV) || + EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM) || + EQ_16(st_ivas->renderer_type, RENDERER_OSBA_AMBI) || + EQ_16(st_ivas->renderer_type, RENDERER_OSBA_LS) || + EQ_16(st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL) ) { - for ( n = 0; n < st_ivas->nchan_ism; n++ ) + FOR ( n = 0; n < st_ivas->nchan_ism; n++ ) { #if 1 - st_ivas->hTcBuffer->q_tc_fx = 11; - floatToFixed_arrL( st_ivas->hTcBuffer->tc[n], st_ivas->hTcBuffer->tc_fx[n], st_ivas->hTcBuffer->q_tc_fx, st_ivas->hTcBuffer->n_samples_available ); floatToFixed_arrL( st_ivas->hSbaIsmData->delayBuffer[n], st_ivas->hSbaIsmData->delayBuffer_fx[n], st_ivas->hTcBuffer->q_tc_fx, st_ivas->hSbaIsmData->delayBuffer_size ); delay_signal_fx( st_ivas->hTcBuffer->tc_fx[n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hSbaIsmData->delayBuffer_fx[n], st_ivas->hSbaIsmData->delayBuffer_size ); - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[n], st_ivas->hTcBuffer->tc[n], st_ivas->hTcBuffer->q_tc_fx, st_ivas->hTcBuffer->n_samples_available ); fixedToFloat_arrL( st_ivas->hSbaIsmData->delayBuffer_fx[n], st_ivas->hSbaIsmData->delayBuffer[n], st_ivas->hTcBuffer->q_tc_fx, st_ivas->hSbaIsmData->delayBuffer_size ); #else delay_signal_float( st_ivas->hTcBuffer->tc[n], st_ivas->hTcBuffer->n_samples_available, st_ivas->hSbaIsmData->delayBuffer[n], st_ivas->hSbaIsmData->delayBuffer_size ); @@ -2347,66 +2245,13 @@ void ivas_jbm_dec_feed_tc_to_renderer( } } - if ( !st_ivas->sba_dirac_stereo_flag ) + IF ( !st_ivas->sba_dirac_stereo_flag ) { - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) + IF ( EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV) ) { n_render_timeslots *= ( st_ivas->hTcBuffer->n_samples_granularity / st_ivas->hSpatParamRendCom->slot_size ); } -#if 1 - Word16 nchan_transport = 0; - SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; - if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) - { - nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - hSpar->hMdDec->Q_mixer_mat = 31; - - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) - { - Word16 ch_sba_idx = 0; - IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) - { - IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - ch_sba_idx = st_ivas->nchan_ism; - move16(); - } - } - st_ivas->hTcBuffer->q_tc_fx = 11; - for ( i = 0; i < ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) + ch_sba_idx; i++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], st_ivas->hTcBuffer->q_tc_fx, min( nSamplesForRendering, (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) ) ); - } - } - } - - if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->hDiracDecBin->useTdDecorr ) ) - { - st_ivas->hTcBuffer->q_tc_fx = 11; - Word16 nSamplesLeftForTD, default_frame; - default_frame = (Word16) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - nSamplesLeftForTD = nSamplesForRendering; - Word16 size = 0; - - while ( nSamplesLeftForTD ) - { - Word16 nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); - size += nSamplesToDecorr; - nSamplesLeftForTD -= nSamplesToDecorr; - } - size = s_max( size, default_frame ); - for ( int ch_idx = 0; ch_idx < BINAURAL_CHANNELS + 2; ch_idx++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->q_tc_fx, size ); - } - } - nchan_transport = st_ivas->nchan_transport; - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && ( st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 || ( st_ivas->hDecoderConfig->ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE > 0 && st_ivas->hCPE[0]->nchan_out == 1 ) ) ) - { - nchan_transport = 1; /* Only one channel transported */ - } -#endif IF(st_ivas->hSCE[0]) { Word16 shift = getScaleFactor32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); @@ -2418,118 +2263,12 @@ void ivas_jbm_dec_feed_tc_to_renderer( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift); } ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); -#if 1 - if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) - { - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) - { - Word16 ch_sba_idx = 0; - IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) - { - IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - ch_sba_idx = st_ivas->nchan_ism; - move16(); - } - } - for ( i = 0; i < ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) + ch_sba_idx; i++ ) - { - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[i], st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->q_tc_fx, min( nSamplesForRendering, (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) ) ); - } - } - } - - if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->hDiracDecBin->useTdDecorr ) ) - { - st_ivas->hTcBuffer->q_tc_fx = 11; - int16_t nSamplesLeftForTD, default_frame; - default_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - nSamplesLeftForTD = nSamplesForRendering; - Word16 size = 0; - - while ( nSamplesLeftForTD ) - { - int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); - size += nSamplesToDecorr; - nSamplesLeftForTD -= nSamplesToDecorr; - } - size = s_max( size, default_frame ); - for ( int ch_idx = 0; ch_idx < BINAURAL_CHANNELS + 2; ch_idx++ ) - { - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->q_tc_fx, size ); - } - } - - if ( ( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) && st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag ) || - ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) && ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) ) ) - { - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - //fixedToFloat_arrL(st->hFdCngDec->hFdCngCom->olapBufferSynth2_fx, st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt, 15, st->hFdCngDec->hFdCngCom->fftlen); - - //fixedToFloat_arrL( st->hFdCngDec->hFdCngCom->exc_cng_32fx, st->hFdCngDec->hFdCngCom->exc_cng_flt, 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize ); - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[1], st_ivas->hTcBuffer->tc[1], 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize ); - } -#endif - } } - else + ELSE { ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); -#if 1 - Word16 nchan_transport = 0; - SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; - if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) - { - - nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - hSpar->hMdDec->Q_mixer_mat = 31; - - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) - { - Word16 ch_sba_idx = 0; - IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) - { - IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - ch_sba_idx = st_ivas->nchan_ism; - move16(); - } - } - st_ivas->hTcBuffer->q_tc_fx = 11; - for ( i = 0; i < ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) + ch_sba_idx; i++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], st_ivas->hTcBuffer->q_tc_fx, min( nSamplesForRendering, (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) ) ); - } - } - } - - if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->hDiracDecBin->useTdDecorr ) ) - { - st_ivas->hTcBuffer->q_tc_fx = 11; - Word16 nSamplesLeftForTD, default_frame; - default_frame = (Word16) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - nSamplesLeftForTD = nSamplesForRendering; - Word16 size = 0; - while ( nSamplesLeftForTD ) - { - Word16 nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); - size += nSamplesToDecorr; - nSamplesLeftForTD -= nSamplesToDecorr; - } - size = s_max( size, default_frame ); - for ( int ch_idx = 0; ch_idx < BINAURAL_CHANNELS + 2; ch_idx++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->q_tc_fx, size ); - } - } - nchan_transport = st_ivas->nchan_transport; - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && ( st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 || ( st_ivas->hDecoderConfig->ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE > 0 && st_ivas->hCPE[0]->nchan_out == 1 ) ) ) - { - nchan_transport = 1; /* Only one channel transported */ - } -#endif IF(st_ivas->hSCE[0]) { Word16 shift = getScaleFactor32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); @@ -2541,116 +2280,15 @@ void ivas_jbm_dec_feed_tc_to_renderer( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift); } ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); -#if 1 - if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) - { - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) - { - Word16 ch_sba_idx = 0; - IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) - { - IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - ch_sba_idx = st_ivas->nchan_ism; - move16(); - } - } - for ( i = 0; i < ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) + ch_sba_idx; i++ ) - { - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[i], st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->q_tc_fx, min( nSamplesForRendering, (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) ) ); - } - } - } - - if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->hDiracDecBin->useTdDecorr ) ) - { - st_ivas->hTcBuffer->q_tc_fx = 11; - int16_t nSamplesLeftForTD, default_frame; - default_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - nSamplesLeftForTD = nSamplesForRendering; - Word16 size = 0; - - while ( nSamplesLeftForTD ) - { - int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); - size += nSamplesToDecorr; - nSamplesLeftForTD -= nSamplesToDecorr; - } - size = s_max( size, default_frame ); - for ( int ch_idx = 0; ch_idx < BINAURAL_CHANNELS + 2; ch_idx++ ) - { - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->q_tc_fx, size ); - } - } - - if ( ( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) && st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag ) || - ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) && ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) ) ) - { - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[1], st_ivas->hTcBuffer->tc[1], 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize ); - } -#endif } } - else if ( st_ivas->ivas_format == MASA_ISM_FORMAT ) + ELSE IF (EQ_16( st_ivas->ivas_format, MASA_ISM_FORMAT )) { - if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + IF ( EQ_16(st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC) && EQ_16(st_ivas->ism_mode, ISM_MASA_MODE_DISC) ) { - n_render_timeslots *= ( st_ivas->hTcBuffer->n_samples_granularity / st_ivas->hSpatParamRendCom->slot_size ); + n_render_timeslots = i_mult(n_render_timeslots, idiv1616( st_ivas->hTcBuffer->n_samples_granularity, st_ivas->hSpatParamRendCom->slot_size )); } -#if 1 - Word16 nchan_transport = 0; - SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; - if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) - { - nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - hSpar->hMdDec->Q_mixer_mat = 31; - - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) - { - Word16 ch_sba_idx = 0; - IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) - { - IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - ch_sba_idx = st_ivas->nchan_ism; - move16(); - } - } - st_ivas->hTcBuffer->q_tc_fx = 11; - for ( i = 0; i < ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) + ch_sba_idx; i++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], st_ivas->hTcBuffer->q_tc_fx, min( nSamplesForRendering, (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) ) ); - } - } - } - - if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->hDiracDecBin->useTdDecorr ) ) - { - st_ivas->hTcBuffer->q_tc_fx = 11; - Word16 nSamplesLeftForTD, default_frame; - default_frame = (Word16) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - nSamplesLeftForTD = nSamplesForRendering; - Word16 size = 0; - while ( nSamplesLeftForTD ) - { - Word16 nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); - size += nSamplesToDecorr; - nSamplesLeftForTD -= nSamplesToDecorr; - } - size = s_max( size, default_frame ); - for ( int ch_idx = 0; ch_idx < BINAURAL_CHANNELS + 2; ch_idx++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->q_tc_fx, size ); - } - } - nchan_transport = st_ivas->nchan_transport; - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && ( st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 || ( st_ivas->hDecoderConfig->ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE > 0 && st_ivas->hCPE[0]->nchan_out == 1 ) ) ) - { - nchan_transport = 1; /* Only one channel transported */ - } -#endif IF(st_ivas->hSCE[0]) { Word16 shift = getScaleFactor32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); @@ -2662,80 +2300,23 @@ void ivas_jbm_dec_feed_tc_to_renderer( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift); } ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); -#if 1 - if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) - { - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) - { - Word16 ch_sba_idx = 0; - IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) - { - IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - ch_sba_idx = st_ivas->nchan_ism; - move16(); - } - } - for ( i = 0; i < ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) + ch_sba_idx; i++ ) - { - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[i], st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->q_tc_fx, min( nSamplesForRendering, (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) ) ); - } - } - } - - if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->hDiracDecBin->useTdDecorr ) ) - { - st_ivas->hTcBuffer->q_tc_fx = 11; - int16_t nSamplesLeftForTD, default_frame; - default_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - nSamplesLeftForTD = nSamplesForRendering; - Word16 size = 0; - - while ( nSamplesLeftForTD ) - { - int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); - size += nSamplesToDecorr; - nSamplesLeftForTD -= nSamplesToDecorr; - } - size = s_max( size, default_frame ); - for ( int ch_idx = 0; ch_idx < BINAURAL_CHANNELS + 2; ch_idx++ ) - { - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->q_tc_fx, size ); - } - } - if ( ( ( st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT ) && st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag ) || - ( ( st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC ) && ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) ) ) - { - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[1], st_ivas->hTcBuffer->tc[1], 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize ); - } -#endif - if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) + IF ( EQ_16(st_ivas->ism_mode, ISM_MASA_MODE_DISC )) { ivas_ism_dec_digest_tc_fx( st_ivas ); } } - else if ( st_ivas->ivas_format == MC_FORMAT ) + ELSE IF ( EQ_16(st_ivas->ivas_format, MC_FORMAT )) { - if ( st_ivas->mc_mode == MC_MODE_MCT ) + IF ( EQ_16(st_ivas->mc_mode, MC_MODE_MCT )) { ivas_jbm_dec_td_renderers_adapt_subframes( st_ivas ); } - else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) + ELSE IF ( EQ_16(st_ivas->mc_mode, MC_MODE_PARAMUPMIX )) { - st_ivas->hTcBuffer->q_tc_fx = 11; - for (int ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS; ch_idx++) - { - floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->q_tc_fx, L_FRAME48k); - } ivas_mc_paramupmix_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); - for (int ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS; ch_idx++) - { - fixedToFloat_arrL(st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->q_tc_fx, L_FRAME48k); - } } - else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) + ELSE IF ( EQ_16(st_ivas->mc_mode, MC_MODE_PARAMMC )) { #ifdef IVAS_FLOAT_FIXED Word16 cldfb_slots, j; @@ -2824,62 +2405,8 @@ void ivas_jbm_dec_feed_tc_to_renderer( ivas_param_mc_dec_digest_tc( st_ivas, (uint8_t) n_render_timeslots, p_data_f ); #endif } - else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) + ELSE IF ( EQ_16(st_ivas->mc_mode, MC_MODE_MCMASA )) { - -#if 1 - Word16 nchan_transport = 0; - SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; - if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) - { - nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; - hSpar->hMdDec->Q_mixer_mat = 31; - - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) - { - Word16 ch_sba_idx = 0; - IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) - { - IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - ch_sba_idx = st_ivas->nchan_ism; - move16(); - } - } - st_ivas->hTcBuffer->q_tc_fx = 11; - for ( i = 0; i < ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) + ch_sba_idx; i++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], st_ivas->hTcBuffer->q_tc_fx, min( nSamplesForRendering, (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) ) ); - } - } - } - - if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->hDiracDecBin->useTdDecorr ) ) - { - st_ivas->hTcBuffer->q_tc_fx = 11; - Word16 nSamplesLeftForTD, default_frame; - default_frame = (Word16) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - nSamplesLeftForTD = nSamplesForRendering; - Word16 size = 0; - - while ( nSamplesLeftForTD ) - { - Word16 nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); - size += nSamplesToDecorr; - nSamplesLeftForTD -= nSamplesToDecorr; - } - size = s_max( size, default_frame ); - for ( int ch_idx = 0; ch_idx < BINAURAL_CHANNELS + 2; ch_idx++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->q_tc_fx, size ); - } - } - nchan_transport = st_ivas->nchan_transport; - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && ( st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 || ( st_ivas->hDecoderConfig->ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE > 0 && st_ivas->hCPE[0]->nchan_out == 1 ) ) ) - { - nchan_transport = 1; /* Only one channel transported */ - } -#endif IF(st_ivas->hSCE[0]) { Word16 shift = getScaleFactor32(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN); @@ -2891,55 +2418,6 @@ void ivas_jbm_dec_feed_tc_to_renderer( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp = sub(st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->cngNoiseLevelExp, shift); } ivas_sba_dec_digest_tc_fx( st_ivas, n_render_timeslots, st_ivas->hTcBuffer->n_samples_available ); -#if 1 - if ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) - { - IF( hSpar->hMdDec->td_decorr_flag && !( EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_16( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) ) - { - Word16 ch_sba_idx = 0; - IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ) - { - IF( EQ_16( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) - { - ch_sba_idx = st_ivas->nchan_ism; - move16(); - } - } - for ( i = 0; i < ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) + ch_sba_idx; i++ ) - { - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[i], st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->q_tc_fx, min( nSamplesForRendering, (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) ) ); - } - } - } - - if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->hDiracDecBin->useTdDecorr ) ) - { - st_ivas->hTcBuffer->q_tc_fx = 11; - int16_t nSamplesLeftForTD, default_frame; - default_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - nSamplesLeftForTD = nSamplesForRendering; - Word16 size = 0; - - while ( nSamplesLeftForTD ) - { - int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); - size += nSamplesToDecorr; - nSamplesLeftForTD -= nSamplesToDecorr; - } - size = s_max( size, default_frame ); - for ( int ch_idx = 0; ch_idx < BINAURAL_CHANNELS + 2; ch_idx++ ) - { - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[ch_idx], st_ivas->hTcBuffer->tc[ch_idx], st_ivas->hTcBuffer->q_tc_fx, size ); - } - } - - if (((st_ivas->ivas_format != SBA_FORMAT && st_ivas->ivas_format != SBA_ISM_FORMAT) && st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag) || - ((st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC) && (nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag))) - { - Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[1], st_ivas->hTcBuffer->tc[1], 31 - st->hFdCngDec->hFdCngCom->fftBuffer_exp - 9, st->hFdCngDec->hFdCngCom->frameSize ); - } -#endif } } free( data_fx ); @@ -3114,7 +2592,7 @@ ivas_error ivas_jbm_dec_render( int16_t nSamplesAskedLocal; ivas_error error; float *p_output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS] = { NULL }; - float *p_tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS] = { NULL }; + //float *p_tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS] = { NULL }; Word32 *p_output_fx[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS]; Word32 tmp_buffer_fx[MAX_OUTPUT_CHANNELS][L_FRAME48k] = { 0 }; Word32 *p_temp_fx[MAX_OUTPUT_CHANNELS]; @@ -3148,13 +2626,11 @@ ivas_error ivas_jbm_dec_render( { for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) { - p_tc[n] = p_output[n]; p_tc_fx[n] = p_output_fx[n]; } for ( n = 0; n < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; n++ ) { - st_ivas->hTcBuffer->tc[n] = p_output[n]; st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; } } @@ -3162,7 +2638,6 @@ ivas_error ivas_jbm_dec_render( { for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ ) { - p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered]; p_tc_fx[n] = &st_ivas->hTcBuffer->tc_fx[n][st_ivas->hTcBuffer->n_samples_rendered]; } } @@ -3183,7 +2658,7 @@ ivas_error ivas_jbm_dec_render( } /*----------------------------------------------------------------* - * Rendering + * Rendering *----------------------------------------------------------------*/ if ( st_ivas->ivas_format == UNDEFINED_FORMAT ) @@ -3192,19 +2667,16 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_BUFFER ) { - Word16 slot_size, slots_to_render, tmp, e, nSamplesRendered_tmp; + Word16 slot_size, tmp, e; slot_size = st_ivas->hTcBuffer->n_samples_granularity; /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */ tmp = BASOP_Util_Divide1616_Scale( nSamplesAsked, slot_size, &e ); tmp = shr( tmp, sub( 15, e ) ); - slots_to_render = s_min( sub( st_ivas->hTcBuffer->num_slots, st_ivas->hTcBuffer->slots_rendered ), tmp ); //slots_rendered = add( st_ivas->hTcBuffer->slots_rendered, slots_to_render ); - nSamplesRendered_tmp = (UWord16) L_mult0( slots_to_render, slot_size ); FOR( Word16 ind = 0; ind < st_ivas->hTcBuffer->nchan_transport_jbm; ind++ ) { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[ind] + st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hTcBuffer->tc_fx[ind] + st_ivas->hTcBuffer->n_samples_rendered, Q11, nSamplesRendered_tmp ); floatToFixed_arrL( p_output[ind], p_output_fx[ind], Q11, s_max( *nSamplesRendered, nSamplesAskedLocal ) ); } @@ -3222,19 +2694,9 @@ ivas_error ivas_jbm_dec_render( if ( st_ivas->renderer_type == RENDERER_MC ) { *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); - Word16 q = Q16; - q = q - find_guarded_bits_fx( st_ivas->nchan_transport ); - FOR( i = 0; i < st_ivas->nchan_transport; ++i ) - { - floatToFixed_arrL( p_tc[i], p_tc_fx[i], q, *nSamplesRendered ); - } - FOR( i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++ ) - { - FOR( j = 0; j < st_ivas->nchan_transport; j++ ) - { - //st_ivas->hLsSetUpConversion->dmxMtx_fx[j][i] = float_to_fix( st_ivas->hLsSetUpConversion->dmxMtx[j][i], Q30 ); - } - } + Word16 q; + q = 11; + ivas_ls_setup_conversion_fx( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc_fx, p_output_fx ); FOR( i = 0; i < st_ivas->hDecoderConfig->nchan_out; ++i ) { @@ -3360,18 +2822,6 @@ ivas_error ivas_jbm_dec_render( { /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ Word16 q = 11; - FOR( Word16 ind1 = 0; ind1 < s_max( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe, s_max( st_ivas->nchan_transport, st_ivas->nchan_ism ) ); ind1++ ) - { - FOR( Word16 ind2 = 0; ind2 < *nSamplesRendered; ind2++ ) - { - p_output_fx[ind1][ind2] = (Word16) ( p_output[ind1][ind2] * ( 1 << q ) ); - } - FOR( Word16 ind2 = 0; ind2 < *nSamplesRendered; ind2++ ) - { - st_ivas->hTcBuffer->tc_fx[ind1][ind2] = (Word32) ( st_ivas->hTcBuffer->tc[ind1][ind2] * ( 1 << q ) ); - } - } - ivas_ism_render_sf_fx( st_ivas, p_output_fx, *nSamplesRendered ); FOR( Word16 ind1 = 0; ind1 < s_max( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe, s_max( st_ivas->nchan_transport, st_ivas->nchan_ism ) ); ind1++ ) { @@ -3418,15 +2868,7 @@ ivas_error ivas_jbm_dec_render( } } #endif - Word16 Q_buffer_in = 31; - FOR( i = 0; i < st_ivas->nchan_transport; i++ ) - { - Q_buffer_in = s_min( Q_buffer_in, Q_factor_arrL( st_ivas->hTcBuffer->tc[i], L_FRAME48k ) ); - } - FOR( i = 0; i < st_ivas->nchan_transport; i++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q_buffer_in, L_FRAME48k ); - } + Word16 Q_buffer_in = 11; ivas_ism2sba_sf_fx( st_ivas->hTcBuffer->tc_fx, p_output_fx, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order ); Word16 sba_num_chans = imult1616( add( st_ivas->hIntSetup.ambisonics_order, 1 ), add( st_ivas->hIntSetup.ambisonics_order, 1 ) ); FOR( j = 0; j < sba_num_chans; j++ ) @@ -3465,10 +2907,6 @@ ivas_error ivas_jbm_dec_render( p_output_fx[i][j] = floatToFixed( p_output[i][j], Q11 ); } } - for ( int ch = 0; ch < st_ivas->hTcBuffer->nchan_transport_internal; ch++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k ); - } IF( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_output_fx, output_q_factor, *nSamplesRendered ) ) != IVAS_ERR_OK ) { return error; @@ -3532,15 +2970,13 @@ ivas_error ivas_jbm_dec_render( *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); for ( n = 0; n < nchan_remapped; n++ ) { +#if 1 + Copy32( st_ivas->hTcBuffer->tc_fx[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output_fx[n], *nSamplesRendered ); +#else mvr2r( st_ivas->hTcBuffer->tc[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output[n], *nSamplesRendered ); +#endif } #ifdef IVAS_FLOAT_FIXED -#if 1//To Be removed - for ( n = 0; n < st_ivas->p_out_len; n++ ) - { - floatToFixed_arr32( p_output[n], p_output_fx[n], Q11, 960 ); - } -#endif IF ( ( error = ivas_sba_linear_renderer_fx( p_output_fx, *nSamplesRendered, nchan_remapped, 0, output_config, st_ivas->hOutSetup ) ) != IVAS_ERR_OK ) { return error; @@ -3565,10 +3001,6 @@ ivas_error ivas_jbm_dec_render( } else { - for ( n = 0; n < st_ivas->p_out_len; n++ ) - { - floatToFixed_arr32( p_output[n], p_output_fx[n], Q11, 960 ); - } #if 1 /*Float to fixed conversion*/ SPAR_DEC_HANDLE hSpar; hSpar = st_ivas->hSpar; @@ -3581,15 +3013,7 @@ ivas_error ivas_jbm_dec_render( hDecoderConfig = st_ivas->hDecoderConfig; Word16 numch_out_dirac = hDecoderConfig->nchan_out; -#ifdef MSAN_FIX - for ( i = 0; i < st_ivas->hTcBuffer->nchan_transport_internal; i++ ) -#else - for ( i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) -#endif - { - floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); - } - hSpar->hMdDec->Q_mixer_mat = 30; + hSpar->hMdDec->Q_mixer_mat = 30; for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -3597,14 +3021,7 @@ ivas_error ivas_jbm_dec_render( st_ivas->cldfbAnaDec[in_ch]->cldfb_state_fx[i] = (Word32) ( st_ivas->cldfbAnaDec[in_ch]->cldfb_state[i] * ( 1LL << ( Q11 ) ) ); } } - //if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_HOA3 ) ) ) - //{ - // for ( i = 0; i < IVAS_MAX_NUM_BANDS; i++ ) - // { - // floatToFixed_arrL( hSpar->hMdDec->smooth_buf[i], hSpar->hMdDec->smooth_buf_fx[i], 0, 2 * SBA_DIRAC_NRG_SMOOTH_LONG + 1 ); - // } - // floatToFixed_arr( hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_fac_fx, Q15, IVAS_MAX_NUM_BANDS ); - //} + FOR( Word16 out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { IF( st_ivas->cldfbSynDec[out_ch] ) @@ -3677,25 +3094,15 @@ ivas_error ivas_jbm_dec_render( { if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { - for ( n = 0; n < st_ivas->p_out_len; n++ ) - { - floatToFixed_arr32( p_output[n], p_output_fx[n], 11, 960 ); - } #if 1 /*Float to fixed conversion*/ SPAR_DEC_HANDLE hSpar; hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; Word16 numch_out_dirac = hDecoderConfig->nchan_out; - for ( i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) - { - floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); - } - hSpar->hMdDec->Q_mixer_mat = 30; + hSpar->hMdDec->Q_mixer_mat = 30; for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -3715,18 +3122,6 @@ ivas_error ivas_jbm_dec_render( } #endif // -#if 1 /* NOTE: remove float to fix conversion */ - Word16 n_tc; - if ( st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT ) - n_tc = st_ivas->nchan_ism; - else - n_tc = st_ivas->hTcBuffer->nchan_transport_internal; - for ( int ch = 0; ch < n_tc; ch++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k ); - } -#endif - IF( ( error = ivas_osba_dirac_td_binaural_jbm_fx( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx, output_q_factor, 960 ) ) != IVAS_ERR_OK ) { return error; @@ -3773,27 +3168,24 @@ ivas_error ivas_jbm_dec_render( /* shift SBA channels to avoid overwrite by ISM upmix in 1 object case and non-TSM unified channel memory*/ if ( st_ivas->nchan_ism == 1 && st_ivas->hDecoderConfig->Opt_tsm == 0 ) { +#ifdef IVAS_FLOAT_FIXED + Copy32( p_tc_fx[2], p_output_fx[3], *nSamplesRendered ); + Copy32( p_tc_fx[1], p_output_fx[2], *nSamplesRendered ); + p_tc_fx[1] = p_output_fx[2]; + p_tc_fx[2] = p_output_fx[3]; + + fixedToFloat_arrL( p_output_fx[2], p_output[2], 11, *nSamplesRendered ); + fixedToFloat_arrL( p_output_fx[3], p_output[3], 11, *nSamplesRendered ); +#else mvr2r( p_tc[2], p_output[3], *nSamplesRendered ); mvr2r( p_tc[1], p_output[2], *nSamplesRendered ); p_tc[1] = p_output[2]; p_tc[2] = p_output[3]; +#endif } /* render objects */ - Word16 q = 15; - FOR( Word16 ind1 = 0; ind1 < s_max( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe, s_max( st_ivas->nchan_transport, st_ivas->nchan_ism ) ); ind1++ ) - { - FOR( Word16 ind2 = 0; ind2 < *nSamplesRendered; ind2++ ) - { - p_output_fx[ind1][ind2] = (Word16) ( p_output[ind1][ind2] * ( 1 << q ) ); - } - IF( st_ivas->hTcBuffer->tc ) - FOR( Word16 ind2 = 0; ind2 < *nSamplesRendered; ind2++ ) - { - st_ivas->hTcBuffer->tc_fx[ind1][ind2] = (Word32) ( st_ivas->hTcBuffer->tc[ind1][ind2] * ( 1 << q ) ); - } - } - + Word16 q = 11; ivas_ism_render_sf_fx( st_ivas, p_output_fx, *nSamplesRendered ); FOR( Word16 ind1 = 0; ind1 < s_max( st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe, s_max( st_ivas->nchan_transport, st_ivas->nchan_ism ) ); ind1++ ) { @@ -3806,26 +3198,18 @@ ivas_error ivas_jbm_dec_render( /* add already rendered SBA part */ for ( n = 0; n < nchan_out; n++ ) { +#ifdef IVAS_FLOAT_FIXED + v_add_fixed( p_output_fx[n], p_tc_fx[n + st_ivas->nchan_ism], p_output_fx[n], *nSamplesRendered, 0); + + fixedToFloat_arrL( p_output_fx[n], p_output[n], 11, *nSamplesRendered ); +#else v_add( p_output[n], p_tc[n + st_ivas->nchan_ism], p_output[n], *nSamplesRendered ); +#endif } } else if ( st_ivas->renderer_type == RENDERER_OSBA_AMBI || st_ivas->renderer_type == RENDERER_OSBA_LS || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { - Word16 q = 15; - FOR(Word16 ind1 = 0; ind1 < s_max(st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe, s_max(st_ivas->nchan_transport, st_ivas->nchan_ism)); ind1++) - { - FOR(Word16 ind2 = 0; ind2 < L_FRAME48k; ind2++) - { - p_output_fx[ind1][ind2] = (Word32)(p_output[ind1][ind2] * (1 << q)); - } - IF(st_ivas->hTcBuffer->tc) - { - FOR(Word16 ind2 = 0; ind2 < L_FRAME48k; ind2++) - { - st_ivas->hTcBuffer->tc_fx[ind1][ind2] = (Word32)(st_ivas->hTcBuffer->tc[ind1][ind2] * (1 << q)); - } - } - } + Word16 q = 11; IF((error = ivas_osba_render_sf_fx(st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output_fx)) != IVAS_ERR_OK) { return error; @@ -3841,25 +3225,14 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) /*EXT output = individual objects + HOA3*/ { - for ( n = 0; n < st_ivas->p_out_len; n++ ) - { - floatToFixed_arr32( p_output[n], p_output_fx[n], Q11, 960 ); - } #if 1 /*Float to fixed conversion*/ SPAR_DEC_HANDLE hSpar; hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; Word16 numch_out_dirac = hDecoderConfig->nchan_out; - - for ( i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) - { - floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); - } - hSpar->hMdDec->Q_mixer_mat = 30; + hSpar->hMdDec->Q_mixer_mat = 30; for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -3908,7 +3281,13 @@ ivas_error ivas_jbm_dec_render( for ( n = 0; n < st_ivas->nchan_ism; n++ ) { +#if 1 + Copy32( st_ivas->hTcBuffer->tc_fx[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output_fx[n], *nSamplesRendered ); + + fixedToFloat_arrL( p_output_fx[n], p_output[n], 11, *nSamplesRendered ); +#else mvr2r( st_ivas->hTcBuffer->tc[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output[n], *nSamplesRendered ); +#endif } } else @@ -3920,18 +3299,11 @@ ivas_error ivas_jbm_dec_render( #if 1 /*Float to fixed conversion*/ SPAR_DEC_HANDLE hSpar; hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; Word16 numch_out_dirac = hDecoderConfig->nchan_out; - - for ( i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) - { - floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); - } - hSpar->hMdDec->Q_mixer_mat = 30; + hSpar->hMdDec->Q_mixer_mat = 30; for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -3985,24 +3357,14 @@ ivas_error ivas_jbm_dec_render( } else { - for ( n = 0; n < st_ivas->p_out_len; n++ ) - { - floatToFixed_arr32( p_output[n], p_output_fx[n], Q11, 960 ); - } #if 1 /*Float to fixed conversion*/ SPAR_DEC_HANDLE hSpar; hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; Word16 numch_out_dirac = hDecoderConfig->nchan_out; - for ( i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) - { - floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); - } for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -4132,19 +3494,7 @@ ivas_error ivas_jbm_dec_render( else if ( st_ivas->renderer_type == RENDERER_MC ) { *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); - Word16 q = Q16; - q = q - find_guarded_bits_fx( st_ivas->nchan_transport ); - FOR( i = 0; i < st_ivas->nchan_transport; ++i ) - { - floatToFixed_arrL( p_tc[i], p_tc_fx[i], q, *nSamplesRendered ); - } - FOR( i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++ ) - { - FOR( j = 0; j < st_ivas->nchan_transport; j++ ) - { - //st_ivas->hLsSetUpConversion->dmxMtx_fx[j][i] = float_to_fix( st_ivas->hLsSetUpConversion->dmxMtx[j][i], Q30 ); - } - } + Word16 q = 11; ivas_ls_setup_conversion_fx( st_ivas, st_ivas->nchan_transport, *nSamplesRendered, p_tc_fx, p_output_fx ); FOR( i = 0; i < st_ivas->hDecoderConfig->nchan_out; ++i ) { @@ -4176,10 +3526,6 @@ ivas_error ivas_jbm_dec_render( p_output_fx[i][j] = floatToFixed( p_output[i][j], output_q_factor ); } } - for ( int ch = 0; ch < st_ivas->hTcBuffer->nchan_transport_internal; ch++ ) - { - floatToFixed_arrL( st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k ); - } #endif IF( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_output_fx, output_q_factor, *nSamplesRendered ) ) != IVAS_ERR_OK ) { @@ -4196,21 +3542,12 @@ ivas_error ivas_jbm_dec_render( } #endif - Word16 q = Q16; - q = q - find_guarded_bits_fx( *nSamplesRendered ); - FOR( i = 0; i < st_ivas->nchan_transport; ++i ) - { - // p_tc and pout point to same location - floatToFixed_arrL( p_tc[i], p_tc_fx[i], q, *nSamplesRendered ); - floatToFixed_arrL( p_output[i], p_output_fx[i], q, *nSamplesRendered ); - } + Word16 q = 11; ivas_binaural_add_LFE_fx( st_ivas, *nSamplesRendered, p_tc_fx, p_output_fx ); FOR( i = 0; i < st_ivas->nchan_transport; ++i ) { - // p_tc and pout point to same location - fixedToFloat_arrL( p_tc_fx[i], p_tc[i], q, *nSamplesRendered ); fixedToFloat_arrL( p_output_fx[i], p_output[i], q, *nSamplesRendered ); } } @@ -4225,44 +3562,22 @@ ivas_error ivas_jbm_dec_render( floatToFixed_arrL(p_output[i], p_output_fx[i], 11, 960); } } - FOR(i = 0; i < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; i++) - { - if (p_tc[i] != NULL) - { - //fixedToFloat_arrL(p_tc_fx[i], p_tc[i], 11, 960); - floatToFixed_arrL(p_tc[i], p_tc_fx[i], 11, 960); - } - } - + ivas_mc_paramupmix_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_tc_fx, p_output_fx); FOR(i = 0; i < MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS; i++) { if (p_output[i] != NULL) { - //fixedToFloat_arrL(p_output_fx[i], p_output[i], 11, 960); fixedToFloat_arrL(p_output_fx[i], p_output[i], 11, 960); } } - FOR(i = 0; i < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; i++) - { - if (p_tc[i] != NULL) - { - - fixedToFloat_arrL(p_tc_fx[i], p_tc[i], 11, 960); - } - } /* Rendering */ if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && !st_ivas->hDecoderConfig->Opt_Headrotation ) { { - Word16 q = Q16; - q = q - find_guarded_bits_fx( *nSamplesRendered ); - FOR( i = 0; i < max( st_ivas->hDecoderConfig->nchan_out, MC_PARAMUPMIX_MAX_INPUT_CHANS ); ++i ) - { - floatToFixed_arrL( p_output[i], p_output_fx[i], q, *nSamplesRendered ); - } + Word16 q = 11; ivas_binaural_add_LFE_fx( st_ivas, *nSamplesRendered, p_output_fx, p_output_fx ); @@ -4274,19 +3589,8 @@ ivas_error ivas_jbm_dec_render( } else if ( st_ivas->renderer_type == RENDERER_MC ) { - Word16 q = Q16; - q = q - find_guarded_bits_fx( MC_PARAMUPMIX_MAX_INPUT_CHANS ); - FOR( i = 0; i < max( st_ivas->hDecoderConfig->nchan_out, MC_PARAMUPMIX_MAX_INPUT_CHANS ); ++i ) - { - floatToFixed_arrL( p_output[i], p_output_fx[i], q, *nSamplesRendered ); - } - FOR( i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++ ) - { - FOR( j = 0; j < MC_PARAMUPMIX_MAX_INPUT_CHANS; j++ ) - { - //st_ivas->hLsSetUpConversion->dmxMtx_fx[j][i] = float_to_fix( st_ivas->hLsSetUpConversion->dmxMtx[j][i], Q30 ); - } - } + Word16 q = 11; + ivas_ls_setup_conversion_fx( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, *nSamplesRendered, p_output_fx, p_output_fx ); FOR( i = 0; i < max( st_ivas->hDecoderConfig->nchan_out, MC_PARAMUPMIX_MAX_INPUT_CHANS ); ++i ) { @@ -4296,10 +3600,6 @@ ivas_error ivas_jbm_dec_render( else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { #ifdef IVAS_FLOAT_FIXED - FOR( i = 0; i < st_ivas->hIntSetup.nchan_out_woLFE + st_ivas->hIntSetup.num_lfe; i++ ) - { - floatToFixed_arrL( p_output[i], p_output_fx[i], Q11, *nSamplesRendered ); - } ivas_mc2sba_fx( st_ivas->hIntSetup, p_output_fx, p_output_fx, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0 ); #if 1 FOR( i = 0; i < ( st_ivas->hOutSetup.ambisonics_order + 1 ) * ( st_ivas->hOutSetup.ambisonics_order + 1 ); i++ ) @@ -4417,12 +3717,7 @@ ivas_error ivas_jbm_dec_render( } #endif - Word16 q = Q16; - q = q - find_guarded_bits_fx( *nSamplesRendered ); - FOR( i = 0; i < max( st_ivas->hDecoderConfig->nchan_out, MC_PARAMUPMIX_MAX_INPUT_CHANS ); ++i ) - { - floatToFixed_arrL( p_output[i], p_output_fx[i], q, *nSamplesRendered ); - } + Word16 q = 11; ivas_binaural_add_LFE_fx( st_ivas, *nSamplesRendered, p_output_fx, p_output_fx ); @@ -4471,11 +3766,6 @@ ivas_error ivas_jbm_dec_render( set_s(channel_active_fx, 1, nchan_out_cov); } - FOR( i = 0; i < nchan_out_cldfb; ++i ) - { - floatToFixed_arrL( p_output[i], p_output_fx[i], Q11, L_FRAME48k ); - } - //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++) { @@ -4613,7 +3903,13 @@ ivas_error ivas_jbm_dec_render( /* we still need to copy the separate channel if available */ if ( st_ivas->hOutSetup.separateChannelEnabled ) { +#if 1 + Copy32( st_ivas->hTcBuffer->tc_fx[LFE_CHANNEL - 1] + offset, p_output_fx[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); + + fixedToFloat_arrL( p_output_fx[st_ivas->hOutSetup.separateChannelIndex], p_output[st_ivas->hOutSetup.separateChannelIndex], Q11, *nSamplesRendered ); +#else mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); +#endif } #ifdef IVAS_FLOAT_FIXED @@ -4648,13 +3944,26 @@ ivas_error ivas_jbm_dec_render( output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1_4 || output_config == IVAS_AUDIO_CONFIG_5_1_2 || ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) ) { +#if 1 + Copy32( st_ivas->hTcBuffer->tc_fx[LFE_CHANNEL] + offset, p_output_fx[LFE_CHANNEL], *nSamplesRendered ); + Copy32( st_ivas->hTcBuffer->tc_fx[LFE_CHANNEL - 1] + offset, p_output_fx[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); + + fixedToFloat_arrL( p_output_fx[LFE_CHANNEL], p_output[LFE_CHANNEL], Q11, *nSamplesRendered ); + fixedToFloat_arrL( p_output_fx[st_ivas->hOutSetup.separateChannelIndex], p_output[st_ivas->hOutSetup.separateChannelIndex], Q11, *nSamplesRendered ); +#else mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL] + offset, p_output[LFE_CHANNEL], *nSamplesRendered ); mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); +#endif } else if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe == 0 ) { /* Delay the separated channel to sync with the DirAC rendering */ +#if 1 + Copy32( st_ivas->hTcBuffer->tc_fx[LFE_CHANNEL - 1] + offset, p_output_fx[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); + fixedToFloat_arrL( p_output_fx[st_ivas->hOutSetup.separateChannelIndex], p_output[st_ivas->hOutSetup.separateChannelIndex], Q11, *nSamplesRendered ); +#else mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered ); +#endif } } } @@ -4698,6 +4007,7 @@ ivas_error ivas_jbm_dec_render( exp = s_min( exp, Q_factor_arrL( p_output[ch_idx], *nSamplesRendered ) ); } exp -= 2; + exp = 11; for ( ch_idx = 0; ch_idx < nchan_out; ch_idx++ ) { for ( j = 0; j < *nSamplesRendered; j++ ) @@ -6892,12 +6202,6 @@ ivas_error ivas_jbm_dec_tc_buffer_open( if ( hTcBuffer->tc_buffer_mode == TC_BUFFER_MODE_NONE ) { - hTcBuffer->tc_buffer = NULL; - - for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) - { - hTcBuffer->tc[ch_idx] = NULL; - } #ifdef IVAS_FLOAT_FIXED hTcBuffer->tc_buffer_fx = NULL; @@ -6935,22 +6239,17 @@ ivas_error ivas_jbm_dec_tc_buffer_open( hTcBuffer->tc_fx[ch_idx] = NULL; } #endif - hTcBuffer->tc_buffer = NULL; + //hTcBuffer->tc_buffer = NULL; for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) { - hTcBuffer->tc[ch_idx] = NULL; + //hTcBuffer->tc[ch_idx] = NULL; } } else { if ( st_ivas->hDecoderConfig->Opt_tsm ) { - if ( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); - } - set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); #ifdef IVAS_FLOAT_FIXED hTcBuffer->tc_buff_len = nsamp_to_allocate; IF( ( hTcBuffer->tc_buffer_fx = (Word32 *) malloc( nsamp_to_allocate * sizeof( Word32 ) ) ) == NULL ) @@ -6963,7 +6262,6 @@ ivas_error ivas_jbm_dec_tc_buffer_open( offset = 0; for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) { - hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; #ifdef IVAS_FLOAT_FIXED hTcBuffer->tc_fx[ch_idx] = &hTcBuffer->tc_buffer_fx[offset]; #endif @@ -6971,7 +6269,6 @@ ivas_error ivas_jbm_dec_tc_buffer_open( } for ( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) { - hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; #ifdef IVAS_FLOAT_FIXED hTcBuffer->tc_fx[ch_idx] = &hTcBuffer->tc_buffer_fx[offset]; #endif @@ -6979,7 +6276,6 @@ ivas_error ivas_jbm_dec_tc_buffer_open( } for ( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) { - hTcBuffer->tc[ch_idx] = NULL; #ifdef IVAS_FLOAT_FIXED hTcBuffer->tc_fx[ch_idx] = NULL; #endif @@ -6990,7 +6286,6 @@ ivas_error ivas_jbm_dec_tc_buffer_open( } else { - hTcBuffer->tc_buffer = NULL; #ifdef IVAS_FLOAT_FIXED hTcBuffer->tc_buffer_fx = NULL; #endif @@ -7070,14 +6365,6 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx( IF( EQ_16( hTcBuffer->tc_buffer_mode, TC_BUFFER_MODE_NONE ) ) { -#if 1 /* TODO: remove float code */ - hTcBuffer->tc_buffer = NULL; - - FOR( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) - { - hTcBuffer->tc[ch_idx] = NULL; - } -#endif hTcBuffer->tc_buffer_fx = NULL; FOR( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) @@ -7107,14 +6394,6 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx( IF( EQ_16( nsamp_to_allocate, 0 ) ) { -#if 1 /* TODO: remove float code */ - hTcBuffer->tc_buffer = NULL; - - FOR( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) - { - hTcBuffer->tc[ch_idx] = NULL; - } -#endif hTcBuffer->tc_buffer_fx = NULL; FOR( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) @@ -7127,12 +6406,7 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx( IF( st_ivas->hDecoderConfig->Opt_tsm ) { #if 1 /* TODO: remove float memory allocation */ - IF( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); - } hTcBuffer->tc_buff_len = nsamp_to_allocate; - set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); #endif IF( ( hTcBuffer->tc_buffer_fx = (Word32 *) malloc( nsamp_to_allocate * sizeof( Word32 ) ) ) == NULL ) { @@ -7144,33 +6418,21 @@ ivas_error ivas_jbm_dec_tc_buffer_open_fx( move16(); FOR( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) { -#if 1 /* TODO: remove float code */ - hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; -#endif hTcBuffer->tc_fx[ch_idx] = &hTcBuffer->tc_buffer_fx[offset]; offset = L_add( offset, n_samp_full ); } FOR( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) { -#if 1 /* TODO: remove float code */ - hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; -#endif hTcBuffer->tc_fx[ch_idx] = &hTcBuffer->tc_buffer_fx[offset]; offset = L_add( offset, n_samp_residual ); } FOR( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) { -#if 1 /* TODO: remove float code */ - hTcBuffer->tc[ch_idx] = NULL; -#endif hTcBuffer->tc_fx[ch_idx] = NULL; } } ELSE { -#if 1 /* TODO: remove float code */ - hTcBuffer->tc_buffer = NULL; -#endif hTcBuffer->tc_buffer_fx = NULL; } } @@ -7231,11 +6493,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( hTcBuffer->n_samples_granularity = n_samples_granularity; /* realloc buffers */ - if ( hTcBuffer->tc_buffer != NULL ) - { - free( hTcBuffer->tc_buffer ); - hTcBuffer->tc_buffer = NULL; - } #ifdef IVAS_FLOAT_FIXED IF( ( hTcBuffer )->tc_buffer_fx != NULL ) { @@ -7259,11 +6516,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( if ( nsamp_to_allocate == 0 ) { - hTcBuffer->tc_buffer = NULL; - for ( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) - { - hTcBuffer->tc[ch_idx] = NULL; - } #ifdef IVAS_FLOAT_FIXED hTcBuffer->tc_buffer_fx = NULL; FOR( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) @@ -7276,11 +6528,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( { if ( st_ivas->hDecoderConfig->Opt_tsm ) { - if ( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM TC Buffer\n" ) ); - } - set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); #ifdef IVAS_FLOAT_FIXED hTcBuffer->tc_buff_len = nsamp_to_allocate; if ( ( hTcBuffer->tc_buffer_fx = (Word32 *) malloc( nsamp_to_allocate * sizeof( Word32 ) ) ) == NULL ) @@ -7293,7 +6540,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( offset = 0; for ( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) { - hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; #ifdef IVAS_FLOAT_FIXED hTcBuffer->tc_fx[ch_idx] = &hTcBuffer->tc_buffer_fx[offset]; #endif @@ -7301,7 +6547,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( } for ( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) { - hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; #ifdef IVAS_FLOAT_FIXED hTcBuffer->tc_fx[ch_idx] = &hTcBuffer->tc_buffer_fx[offset]; #endif @@ -7309,7 +6554,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( } for ( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) { - hTcBuffer->tc[ch_idx] = NULL; #ifdef IVAS_FLOAT_FIXED hTcBuffer->tc_fx[ch_idx] = NULL; #endif @@ -7317,7 +6561,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( } else { - hTcBuffer->tc_buffer = NULL; + //hTcBuffer->tc_buffer = NULL; #ifdef IVAS_FLOAT_FIXED hTcBuffer->tc_buffer_fx = NULL; #endif @@ -7377,10 +6621,10 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx( move16(); /* realloc buffers */ - IF( hTcBuffer->tc_buffer != NULL ) + IF( hTcBuffer->tc_buffer_fx != NULL ) { - free( hTcBuffer->tc_buffer ); - hTcBuffer->tc_buffer = NULL; + free( hTcBuffer->tc_buffer_fx ); + hTcBuffer->tc_buffer_fx = NULL; } IF( st_ivas->hDecoderConfig->Opt_tsm ) @@ -7399,10 +6643,10 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx( IF( EQ_16( nsamp_to_allocate, 0 ) ) { - hTcBuffer->tc_buffer = NULL; + hTcBuffer->tc_buffer_fx = NULL; FOR( ch_idx = 0; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) { - hTcBuffer->tc[ch_idx] = NULL; + hTcBuffer->tc_fx[ch_idx] = NULL; } } ELSE @@ -7434,28 +6678,28 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx( } /* TODO: remove the floating point dependency */ - IF( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL ) + //IF( ( hTcBuffer->tc_buffer = (float *) malloc( nsamp_to_allocate * sizeof( float ) ) ) == NULL ) { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory FOR JBM TC Buffer\n" ) ); + //return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory FOR JBM TC Buffer\n" ) ); } hTcBuffer->tc_buff_len = nsamp_to_allocate; - set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); + //set_zero( hTcBuffer->tc_buffer, nsamp_to_allocate ); offset = 0; move16(); FOR( ch_idx = 0; ch_idx < hTcBuffer->nchan_buffer_full; ch_idx++ ) { - hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; + //hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; offset = add( offset, n_samp_full ); } FOR( ; ch_idx < hTcBuffer->nchan_transport_internal; ch_idx++ ) { - hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; + //hTcBuffer->tc[ch_idx] = &hTcBuffer->tc_buffer[offset]; offset = add( offset, n_samp_residual ); } FOR( ; ch_idx < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; ch_idx++ ) { - hTcBuffer->tc[ch_idx] = NULL; + //hTcBuffer->tc[ch_idx] = NULL; } } ELSE @@ -7463,7 +6707,7 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure_fx( hTcBuffer->tc_buffer_fx = NULL; /* TODO: remove floating point dependency */ - hTcBuffer->tc_buffer = NULL; + // hTcBuffer->tc_buffer = NULL; } } @@ -7566,13 +6810,13 @@ void ivas_jbm_dec_tc_buffer_close( { for ( i = 0; i < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; i++ ) { - ( *phTcBuffer )->tc[i] = NULL; + //( *phTcBuffer )->tc[i] = NULL; } - if ( ( *phTcBuffer )->tc_buffer != NULL ) + //if ( ( *phTcBuffer )->tc_buffer != NULL ) { - free( ( *phTcBuffer )->tc_buffer ); - ( *phTcBuffer )->tc_buffer = NULL; + //free( ( *phTcBuffer )->tc_buffer ); + //( *phTcBuffer )->tc_buffer = NULL; } #ifdef IVAS_FLOAT_FIXED @@ -7918,7 +7162,13 @@ void ivas_jbm_dec_copy_tc_no_tsm( { for ( ch_idx = 0; ch_idx < n_ch_full_copy; ch_idx++ ) { +#ifdef IVAS_FLOAT_FIXED + Word32 tc_fx[960]; + floatToFixed_arrL(tc[ch_idx], tc_fx, Q11, hTcBuffer->n_samples_buffered); + Copy32( tc_fx, st_ivas->hTcBuffer->tc_fx[ch_idx], hTcBuffer->n_samples_buffered ); +#else mvr2r( tc[ch_idx], st_ivas->hTcBuffer->tc[ch_idx], hTcBuffer->n_samples_buffered ); +#endif } } ch_idx = 0; diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 3ccf653e93fb4831e6e336ebc82cc1a7a7c0f11e..99b0440f0e06848fe7b83af29cf323270746b608 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -52,6 +52,7 @@ *------------------------------------------------------------------------*/ #define OMASA_TDREND_MATCHING_GAIN 0.7943f +#define OMASA_TDREND_MATCHING_GAIN_FX 26026 /*-------------------------------------------------------------------* * ivas_omasa_data_open() @@ -245,6 +246,7 @@ void ivas_omasa_data_close_fx( * * oMASA decoder configuration *--------------------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED ivas_error ivas_omasa_dec_config_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -315,8 +317,6 @@ ivas_error ivas_omasa_dec_config_fx( Word16 n_samples_granularity; n_samples_granularity = NS2SA(st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS); - DECODER_TC_BUFFER_HANDLE hTcBuffer; - hTcBuffer = st_ivas->hTcBuffer; DECODER_CONFIG_HANDLE hDecoderConfig = NULL; Word16 numch_out_dirac = 0; SPAR_DEC_HANDLE hSpar = NULL; @@ -363,15 +363,6 @@ ivas_error ivas_omasa_dec_config_fx( } } } - Word16 n_tc; - if (st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) - n_tc = st_ivas->nchan_ism; - else - n_tc = st_ivas->hTcBuffer->nchan_transport_internal; - for (int ch = 0; ch < n_tc; ch++) - { - floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k); - } } } } @@ -381,8 +372,6 @@ ivas_error ivas_omasa_dec_config_fx( return error; } //////////////////////////// local fix2flt: to be removed - if (hTcBuffer->tc_buffer) - fixedToFloat_arrL(hTcBuffer->tc_buffer_fx, hTcBuffer->tc_buffer, Q11, hTcBuffer->tc_buff_len); IF(hSpar) { numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; @@ -1312,26 +1301,6 @@ void ivas_omasa_dirac_rend_jbm( output_fx[ind][ind2] = floatToFixed(output_f[ind][ind2] , q_output); } } - Word16 len; - IF( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ ) - { - len = 1; - } - ELSE - { - len = st_ivas->nchan_ism; - } - IF( st_ivas->hDecoderConfig->Opt_tsm ) - { - FOR( Word16 ind1 = 0; ind1 < len + 2; ind1++ ) - { - FOR( Word16 ind2 = 0; ind2 < 960; ind2++ ) - { - //st_ivas->hTcBuffer->tc_fx[ind1][ind2] = (Word32) ( st_ivas->hTcBuffer->tc[ind1][ind2] * ( 1 << q_output ) ); - st_ivas->hTcBuffer->tc_fx[ind1][ind2] = floatToFixed( st_ivas->hTcBuffer->tc[ind1][ind2] ,q_output ); - } - } - } #ifdef MSAN_FIX FOR( Word16 ind1 = 0; ind1 < MAX_NUM_OBJECTS; ind1++ ) #else @@ -1365,16 +1334,6 @@ void ivas_omasa_dirac_rend_jbm( { st_ivas->hIsmRendererData->prev_gains_fx[ind1][ind2] = L_shl(st_ivas->hIsmRendererData->prev_gains_fx[ind1][ind2], 1); // Q29 -> Q30 } - } - IF( st_ivas->hDecoderConfig->Opt_tsm ) - { - FOR( Word16 ind1 = 0; ind1 < len + 2; ind1++ ) - { - FOR( Word16 ind2 = 0; ind2 < 960; ind2++ ) - { - st_ivas->hTcBuffer->tc[ind1][ind2] = fixedToFloat(st_ivas->hTcBuffer->tc_fx[ind1][ind2], q_output); - } - } } //dbgwrite2_txt(output_f[1],960,"../omasa_soutput_f.txt"); #else @@ -1401,10 +1360,18 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( { int16_t n; float data_separated_objects[MAX_NUM_OBJECTS][L_FRAME48k]; +#ifdef IVAS_FLOAT_FIXED + Word16 gain_fx = OMASA_TDREND_MATCHING_GAIN_FX; +#else float gain = OMASA_TDREND_MATCHING_GAIN; +#endif ivas_error error; float *p_sepobj[MAX_NUM_OBJECTS]; +#ifdef IVAS_FLOAT_FIXED + Word32 *tc_local_fx[MAX_TRANSPORT_CHANNELS]; +#else float *tc_local[MAX_TRANSPORT_CHANNELS]; +#endif #ifdef MSAN_FIX Word32 *p_sepobj_fx[MAX_NUM_OBJECTS]; Word32 data_separated_objects_fx[MAX_NUM_OBJECTS][L_FRAME48k]; @@ -1427,15 +1394,14 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( for ( n = 0; n < st_ivas->nchan_ism; n++ ) { - tc_local[n] = st_ivas->hTcBuffer->tc[n + 2]; - v_multc( tc_local[n], gain, tc_local[n], tcBufferSize ); #ifdef IVAS_FLOAT_FIXED - floatToFixed_arr32( st_ivas->hTcBuffer->tc[n + 2], st_ivas->hTcBuffer->tc_fx[n + 2], 11, st_ivas->hSpatParamRendCom->num_slots * st_ivas->hSpatParamRendCom->slot_size ); - Word32 *tc_local_fx[MAX_TRANSPORT_CHANNELS]; tc_local_fx[n] = st_ivas->hTcBuffer->tc_fx[n + 2]; + v_multc_fixed_16( tc_local_fx[n], gain_fx, tc_local_fx[n], tcBufferSize ); + delay_signal_fx( tc_local_fx[n], tcBufferSize, st_ivas->hMasaIsmData->delayBuffer_fx[n], st_ivas->hMasaIsmData->delayBuffer_size ); - fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[n + 2], st_ivas->hTcBuffer->tc[n + 2], 11, st_ivas->hSpatParamRendCom->num_slots * st_ivas->hSpatParamRendCom->slot_size ); #else + tc_local[n] = st_ivas->hTcBuffer->tc[n + 2]; + v_multc( tc_local[n], gain, tc_local[n], tcBufferSize ); delay_signal_float( tc_local[n], tcBufferSize, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); #endif // IVAS_FLOAT_FIXED } @@ -1461,15 +1427,6 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( } } #endif - Word16 n_tc; - if (st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) - n_tc = st_ivas->nchan_ism; - else - n_tc = st_ivas->hTcBuffer->nchan_transport_internal; - for (int ch = 0; ch < n_tc; ch++) - { - floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k); - } #endif #ifdef MSAN_FIX IF( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_sepobj_fx, q_factor, *nSamplesRendered ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 771685410ca44acdd5e20a429c11bc80fb60d716..1691bfe040948e3bee8c9c838e35c10b11ca57fe 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -392,24 +392,17 @@ ivas_error ivas_osba_render_sf_fx( FOR(n = 0; n < st_ivas->nchan_ism; n++) { - v_shr(p_output[n], sub(Q15, Q11), output_ism[n], nSamplesAsked); + v_shr(p_output[n], sub(Q11, Q11), output_ism[n], nSamplesAsked); } #if 1 /*Float to fixed conversion*/ SPAR_DEC_HANDLE hSpar; hSpar = st_ivas->hSpar; - uint16_t nchan_internal; - nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); Word16 numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; DECODER_CONFIG_HANDLE hDecoderConfig; hDecoderConfig = st_ivas->hDecoderConfig; Word16 numch_out_dirac = hDecoderConfig->nchan_out; - - for ( int i = 0; i < s_max( st_ivas->nchan_ism, 0 ) + nchan_internal; i++ ) - { - floatToFixed_arr32( st_ivas->hTcBuffer->tc[i], st_ivas->hTcBuffer->tc_fx[i], Q11, st_ivas->hTcBuffer->n_samples_available ); - } - hSpar->hMdDec->Q_mixer_mat = Q30; + hSpar->hMdDec->Q_mixer_mat = Q30; for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( int i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 031e9b251695bbcfc3b99d8ff79d2514c1a8481c..7e854a90f66492348a38a093162daf13aa57afef 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -1008,8 +1008,6 @@ ivas_error ivas_sba_dec_reconfigure_fx( #ifdef IVAS_FLOAT_FIXED #if 1 /*Float to fixed conversion*/ - DECODER_TC_BUFFER_HANDLE hTcBuffer; - hTcBuffer = st_ivas->hTcBuffer; if ( st_ivas->hIsmRendererData ) { FOR( Word16 ind1 = 0; ind1 < st_ivas->hIsmRendererData->interpolator_len; ind1++ ) @@ -1045,29 +1043,6 @@ ivas_error ivas_sba_dec_reconfigure_fx( numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate, st_ivas->last_active_ivas_total_brate ); hSpar->hMdDec->Q_mixer_mat = 30; - //for ( int l = 0; l < numch_out; l++ ) - //{ - // for ( int j = 0; j < numch_in; j++ ) - // { - // for ( int k = 0; k < num_md_sub_frames * IVAS_MAX_NUM_BANDS; k++ ) - // { - // hSpar->hMdDec->mixer_mat_fx[l][j][k] = floatToFixed( hSpar->hMdDec->mixer_mat[l][j][k], q1 ); - // } - // } - //} - //for ( int m = 0; m < MAX_PARAM_SPATIAL_SUBFRAMES + 1; m++ ) - //{ - // for ( int j = 0; j < IVAS_MAX_FB_MIXER_OUT_CH; j++ ) - // { - // for ( int k = 0; k < IVAS_MAX_SPAR_FB_MIXER_IN_CH; k++ ) - // { - // for ( int l = 0; l < IVAS_MAX_NUM_BANDS; l++ ) - // { - // hSpar->hMdDec->mixer_mat_prev_fx[m][j][k][l] = floatToFixed( hSpar->hMdDec->mixer_mat_prev[m][j][k][l], q2 ); - // } - // } - // } - //} for ( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) { for ( Word16 i = 0; i < st_ivas->cldfbAnaDec[in_ch]->p_filter_length - st_ivas->cldfbAnaDec[in_ch]->no_channels; i++ ) @@ -1086,23 +1061,12 @@ ivas_error ivas_sba_dec_reconfigure_fx( } } } - Word16 n_tc; - if (st_ivas->ivas_format == MASA_ISM_FORMAT || st_ivas->ivas_format == SBA_ISM_FORMAT) - n_tc = st_ivas->nchan_ism; - else - n_tc = st_ivas->hTcBuffer->nchan_transport_internal; - for (int ch = 0; ch < n_tc; ch++) - { - floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k); - } #endif if ( ( error = ivas_jbm_dec_flush_renderer_fx( st_ivas, granularity_new, st_ivas->renderer_type, st_ivas->intern_config, &st_ivas->hIntSetup, st_ivas->mc_mode, ism_mode_old, nSamplesFlushed, data ) ) != IVAS_ERR_OK ) { return error; } #if 1 /*Fixed to float */ - if ( hTcBuffer->tc_buffer ) - fixedToFloat_arrL( hTcBuffer->tc_buffer_fx, hTcBuffer->tc_buffer, Q11, hTcBuffer->tc_buff_len ); IF( hSpar ) { FOR( Word16 in_ch = 0; in_ch < numch_in; in_ch++ ) @@ -1570,11 +1534,13 @@ ivas_error ivas_sba_dec_reconfigure_fx( IF( st_ivas->cldfbAnaDec[i] ) floatToFixed_arrL32( st_ivas->cldfbAnaDec[i]->cldfb_state, st_ivas->cldfbAnaDec[i]->cldfb_state_fx, 11, st_ivas->cldfbAnaDec[i]->cldfb_size ); } +#ifndef MSAN_FIX IF( st_ivas->hSpar ) { st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q = Q_factor_arr( st_ivas->hSpar->hFbMixer->cldfb_cross_fade, 16 ); floatToFixed_arr( st_ivas->hSpar->hFbMixer->cldfb_cross_fade, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_fx, st_ivas->hSpar->hFbMixer->cldfb_cross_fade_q, 16 ); } +#endif // MSAN_FIX IF( st_ivas->cldfbSynDec[0] ) { floatToFixed_arrL32( st_ivas->cldfbSynDec[0]->cldfb_state, st_ivas->cldfbSynDec[0]->cldfb_state_fx, Q11, st_ivas->cldfbSynDec[0]->cldfb_size ); diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index e9a06232a8e49455f62a84ec74b412227511c6da..7c4e50bce8f99d86408e4ee2a5a3700e09ebfb0d 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -574,35 +574,6 @@ ivas_error ivas_spar_dec_fx( error = IVAS_ERR_OK; hDecoderConfig = st_ivas->hDecoderConfig; -#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED - Word16 j, k, d; - IF( st_ivas->hQMetaData != NULL ) - { - // To do remove this code once ivas_spar_dec_MD is done - FOR( d = 0; d < st_ivas->hQMetaData->no_directions; d++ ) - { - IVAS_QDIRECTION *q_direction; - q_direction = &st_ivas->hQMetaData->q_direction[d]; - int nbands = q_direction->cfg.nbands; - FOR( j = 0; j < nbands; j++ ) - { - FOR( k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ ) - { - Word32 tmp = 0; - tmp = (Word32) ( q_direction->band_data[j].elevation[k] * ( 1 << 22 ) ); - if ( GT_32( L_abs( L_sub( tmp, q_direction->band_data[j].elevation_fx[k] ) ), 1 << Q5 ) ) - { - assert( 0 ); - } - q_direction->band_data[j].elevation_fx[k] = (Word32) ( q_direction->band_data[j].elevation[k] * ( 1 << 22 ) ); - q_direction->band_data[j].azimuth_fx[k] = (Word32) ( q_direction->band_data[j].azimuth[k] * ( 1 << 22 ) ); - q_direction->band_data[j].energy_ratio_fx[k] = (Word32) ( q_direction->band_data[j].energy_ratio[k] * ( 1 << 30 ) ); - } - } - } - } -#endif - st0 = GT_16( st_ivas->nSCE, 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; bit_stream_orig = st0->bit_stream; move16(); @@ -663,36 +634,10 @@ ivas_error ivas_spar_dec_fx( move32(); } -#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED - IF( st_ivas->hQMetaData != NULL ) - { - // To do remove this code once ivas_spar_dec_MD is done - FOR( d = 0; d < st_ivas->hQMetaData->no_directions; d++ ) - { - IVAS_QDIRECTION *q_direction; - q_direction = &st_ivas->hQMetaData->q_direction[d]; - int nbands = q_direction->cfg.nbands; - FOR( j = 0; j < nbands; j++ ) - { - FOR( k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ ) - { - q_direction->band_data[j].elevation[k] = ( (float) q_direction->band_data[j].elevation_fx[k] / ( 1 << 22 ) ); - q_direction->band_data[j].azimuth[k] = ( (float) q_direction->band_data[j].azimuth_fx[k] / ( 1 << 22 ) ); - q_direction->band_data[j].energy_ratio[k] = ( (float) q_direction->band_data[j].energy_ratio_fx[k] / ( 1 << 30 ) ); - } - } - } - } -#endif - /*---------------------------------------------------------------------* * Decode SPAR metadata *---------------------------------------------------------------------*/ - //IF( ( error = ivas_spar_dec_MD( st_ivas, st0 ) ) != IVAS_ERR_OK ) - //{ - // return error; - //} IF( ( error = ivas_spar_dec_MD_fx( st_ivas, st0 ) ) != IVAS_ERR_OK ) { return error; @@ -932,8 +877,7 @@ static Word16 get_random_number_fx( *seed = x; return x; } -#endif // IVAS_FLOAT_FIXED - +#else static float get_random_number( int16_t *seed ) { @@ -941,6 +885,7 @@ static float get_random_number( return x; } +#endif // IVAS_FLOAT_FIXED #ifdef IVAS_FLOAT_FIXED static Word32 matrix_det_fx( @@ -1262,6 +1207,7 @@ void ivas_spar_get_cldfb_gains_fx( } #endif // IVAS_FLOAT_FIXED +#ifndef IVAS_FLOAT_FIXED void ivas_spar_get_cldfb_gains( SPAR_DEC_HANDLE hSpar, HANDLE_CLDFB_FILTER_BANK cldfbAnaDec0, @@ -1461,6 +1407,7 @@ void ivas_spar_get_cldfb_gains( return; } +#endif /*---------------------------------------------------------------------* diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index 1b05166dc9263d226fc4929453a2617b1522274f..097ff9bb33cf73ab1d57ea70aa3f61085b466b7f 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -1314,9 +1314,6 @@ static void ivas_dec_mono_sba_handling_fx( /* Set Energy Ratio values to be zero */ FOR( b = 0; b < st_ivas->hQMetaData->q_direction[0].cfg.nbands; b++ ) { -#ifndef IVAS_FLOAT_FIXED_TO_BE_REMOVED - set_zero( st_ivas->hQMetaData->q_direction[0].band_data[b].energy_ratio, MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif set32_fx( st_ivas->hQMetaData->q_direction[0].band_data[b].energy_ratio_fx, 0, MAX_PARAM_SPATIAL_SUBFRAMES ); } IF( st_ivas->hDirAC != NULL ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index ca390f8947d9bd3218cb1ad0b22202b1d03db936..ba4ff1d583ea9175b626494bd11f99812277ea27 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1414,9 +1414,10 @@ typedef struct ivas_masa_ism_data_structure typedef struct decoder_tc_buffer_structure { +#ifndef IVAS_FLOAT_FIXED 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 -#ifdef IVAS_FLOAT_FIXED +#else 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 diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index f3614d3ce4669d290da6e7036703e9ddde1a05a7..35535e8cfd819918f6a10d94751936b884685683 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1100,8 +1100,6 @@ static ivas_error IVAS_DEC_Setup( Word16 n_samples_granularity; n_samples_granularity = NS2SA(st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS); - DECODER_TC_BUFFER_HANDLE hTcBuffer; - hTcBuffer = st_ivas->hTcBuffer; DECODER_CONFIG_HANDLE hDecoderConfig = NULL; Word16 numch_out_dirac = 0; SPAR_DEC_HANDLE hSpar = NULL; @@ -1157,7 +1155,7 @@ static ivas_error IVAS_DEC_Setup( n_tc = st_ivas->hTcBuffer->nchan_transport_internal; FOR (Word16 ch = 0; ch < n_tc; ch++) { - floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k); + //floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k); } } } @@ -1222,11 +1220,6 @@ static ivas_error IVAS_DEC_Setup( } IF(EQ_16(is_DTXrate(ivas_total_brate), 0) && (st_ivas->ivas_format == MC_FORMAT)) { - IF(st_ivas->hTcBuffer) - FOR(Word16 ch = 0; ch < st_ivas->hTcBuffer->nchan_transport_internal; ch++) - { - floatToFixed_arrL(st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->tc_fx[ch], Q11, L_FRAME48k); - } IF (st_ivas->mc_mode == MC_MODE_PARAMMC) { IF (st_ivas->hParamMC) @@ -1300,10 +1293,10 @@ static ivas_error IVAS_DEC_Setup( } } - IF(EQ_16(is_DTXrate(ivas_total_brate), 0) && (!(EQ_16(st_ivas->ini_active_frame, 0) && NE_32(ivas_total_brate, FRAME_NO_DATA) && LT_32(ivas_total_brate, MASA_STEREO_MIN_BITRATE) && EQ_16(st_ivas->nCPE, 1))) && st_ivas->bit_stream[(ivas_total_brate / FRAMES_PER_SEC) - 1] && st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format == MASA_FORMAT && ((GT_32(ivas_total_brate, IVAS_SID_5k2) && NE_32(ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate)) || EQ_16(st_ivas->ini_active_frame, 0))) + IF(EQ_16(is_DTXrate(ivas_total_brate), 0) && (!(EQ_16(st_ivas->ini_active_frame, 0) && NE_32(ivas_total_brate, FRAME_NO_DATA) && LT_32(ivas_total_brate, MASA_STEREO_MIN_BITRATE) && EQ_16(st_ivas->nCPE, 1))) && st_ivas->bit_stream[(ivas_total_brate / FRAMES_PER_SEC) - 1] && st_ivas->ivas_format == MASA_FORMAT && ((GT_32(ivas_total_brate, IVAS_SID_5k2) && NE_32(ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate)) || EQ_16(st_ivas->ini_active_frame, 0))) { - IF (hTcBuffer->tc_buffer) - fixedToFloat_arrL(hTcBuffer->tc_buffer_fx, hTcBuffer->tc_buffer, Q11, hTcBuffer->tc_buff_len); + //IF (hTcBuffer->tc_buffer) + //fixedToFloat_arrL(hTcBuffer->tc_buffer_fx, hTcBuffer->tc_buffer, Q11, hTcBuffer->tc_buff_len); IF(hSpar) { numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; @@ -1327,7 +1320,7 @@ static ivas_error IVAS_DEC_Setup( } } - IF(EQ_16(is_DTXrate(ivas_total_brate), 0) && (!(EQ_16(st_ivas->ini_active_frame, 0) && NE_32(ivas_total_brate, FRAME_NO_DATA) && LT_32(ivas_total_brate, MASA_STEREO_MIN_BITRATE) && EQ_16(st_ivas->nCPE, 1))) && st_ivas->bit_stream[(ivas_total_brate / FRAMES_PER_SEC) - 1] && st_ivas->ivas_format == MASA_FORMAT && st_ivas->last_ivas_format != MASA_FORMAT && ((GT_32(ivas_total_brate, IVAS_SID_5k2) && NE_32(ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate)) || EQ_16(st_ivas->ini_active_frame, 0))) { + IF(EQ_16(is_DTXrate(ivas_total_brate), 0) && (!(EQ_16(st_ivas->ini_active_frame, 0) && NE_32(ivas_total_brate, FRAME_NO_DATA) && LT_32(ivas_total_brate, MASA_STEREO_MIN_BITRATE) && EQ_16(st_ivas->nCPE, 1))) && st_ivas->bit_stream[(ivas_total_brate / FRAMES_PER_SEC) - 1] && st_ivas->ivas_format == MASA_FORMAT && ((GT_32(ivas_total_brate, IVAS_SID_5k2) && NE_32(ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate)) || EQ_16(st_ivas->ini_active_frame, 0))) { IF(EQ_16(st_ivas->ism_mode, ISM_MASA_MODE_DISC)) { Word16 nchan_rend = num_src; @@ -1464,8 +1457,6 @@ static ivas_error IVAS_DEC_GetTcSamples( hMCT = st_ivas->hMCT; Word16 num_freq_bands = 0; /* Float to Fixed */ - - Word16 n_ch_full_copy_temp = s_min(hTcBuffer->nchan_transport_jbm, hTcBuffer->nchan_buffer_full); IF(pcmBuf != NULL) { floatToFixed_arrL(pcmBuf, pcmBuf_fx, 11, (Word16)(st_ivas->hTcBuffer->nchan_transport_jbm * st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC)); @@ -1475,7 +1466,8 @@ static ivas_error IVAS_DEC_GetTcSamples( FOR( n = 0; n < ivas_get_nchan_buffers_dec_ivas_fx(st_ivas, st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate); n++) { set_zero(st_ivas->p_output_f[n], L_FRAME48k); - st_ivas->hTcBuffer->tc[n] = st_ivas->p_output_f[n]; + set32_fx(st_ivas->p_output_fx[n], 0, L_FRAME48k); + st_ivas->hTcBuffer->tc_fx[n] = st_ivas->p_output_fx[n]; } } @@ -1602,11 +1594,6 @@ static ivas_error IVAS_DEC_GetTcSamples( IF( NE_16( st_ivas->hDecoderConfig->Opt_tsm, 1 ) ) { - FOR(Word16 lp = 0; lp < n_ch_full_copy_temp; lp++) - { - fixedToFloat_arrL(st_ivas->hTcBuffer->tc_fx[lp], st_ivas->hTcBuffer->tc[lp], Q11, st_ivas->hTcBuffer->n_samples_buffered); - } - FOR( ch = 0; ch < n_ch_cldfb_tmp; ch++) { Word16 cldfb_size = st_ivas->cldfbAnaDec[ch]->cldfb_size; @@ -3600,6 +3587,9 @@ static ivas_error evs_dec_main( { DEC_CORE_HANDLE *hCoreCoder; float mixer_left, mixer_rigth; +#ifdef IVAS_FLOAT_FIXED + Word32 *p_output_fx[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; +#endif float *p_output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; Word16 ch; ivas_error error; @@ -3613,6 +3603,9 @@ static ivas_error evs_dec_main( FOR( ch = 0; ch < MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; ch++ ) { p_output[ch] = st_ivas->p_output_f[ch]; +#ifdef IVAS_FLOAT_FIXED + p_output_fx[ch] = st_ivas->p_output_fx[ch]; +#endif } #ifdef IVAS_FLOAT_FIXED Word16 output_16[L_FRAME48k]; @@ -3698,7 +3691,15 @@ static ivas_error evs_dec_main( IF( !st_ivas->hDecoderConfig->Opt_tsm ) { +#ifdef IVAS_FLOAT_FIXED + for(int i = 0; i < st_ivas->hDecoderConfig->nchan_out; i++) + { + floatToFixed_arrL(p_output[i], p_output_fx[i], Q11, nOutSamples); + } + ivas_jbm_dec_copy_tc_no_tsm_fx( st_ivas, p_output_fx, nOutSamples ); +#else ivas_jbm_dec_copy_tc_no_tsm( st_ivas, p_output, nOutSamples ); +#endif } ELSE IF( floatBuf != NULL ) { diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 831c127e375e63f7ce99c04349a70d76be5ef0d8..6b4029be87b838d53daacb3c338e77f2eadb939d 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -1133,20 +1133,6 @@ static void ivas_dirac_dec_binaural_internal( nchan_tc = add( nchan_tc, ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); #endif -#ifdef MSAN_FIX - // FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) - FOR( Word16 cha = 0; cha < st_ivas->hTcBuffer->no_channels; cha++ ) -#else - FOR( Word16 cha = 0; cha < 3 + max( 1, st_ivas->nchan_ism ); cha++ ) -#endif - { - FOR( Word16 ind = 0; ind < st_ivas->hTcBuffer->n_samples_available; ind++ ) - IF( st_ivas->hTcBuffer->tc[cha] ) - { - st_ivas->hTcBuffer->tc_fx[cha][ind] = (Word32) ( st_ivas->hTcBuffer->tc[cha][ind] * ( 1 << q_input ) ); - } - } - #ifdef MSAN_FIX // FOR( Word16 cha = 0; cha < nchan_tc; cha++ ) FOR( Word16 cha = 0; cha < MAX_INTERN_CHANNELS; cha++ ) @@ -3486,8 +3472,6 @@ static void adaptTransportSignalsHeadtracked_fx( { hHeadTrackData->chEneIIR_fx[ch][band_idx] = L_add( L_shr( hHeadTrackData->chEneIIR_fx[ch][band_idx], sub( hHeadTrackData->q_chEneIIR, q_temp ) ), temp ); } - - hHeadTrackData->chEneIIR[ch][band_idx] = fixedToFloat_32( hHeadTrackData->chEneIIR_fx[ch][band_idx], s_min( hHeadTrackData->q_chEneIIR, q_temp ) ); } q_chEneIIR = s_min( hHeadTrackData->q_chEneIIR, q_temp ); /* Determine ILD */ @@ -3552,11 +3536,6 @@ static void adaptTransportSignalsHeadtracked_fx( } hHeadTrackData->procChEneIIR_fx[ch][band_idx] = Mpy_32_16_1( hHeadTrackData->procChEneIIR_fx[ch][band_idx], ADAPT_HTPROTO_IIR_FAC_FX ); - hHeadTrackData->procChEneIIR[ch][band_idx] = fixedToFloat_32( hHeadTrackData->procChEneIIR_fx[ch][band_idx], hHeadTrackData->q_procChEneIIR ); - - if ( ( ch == 0 && band_idx == 1 ) || ( ch == 1 && band_idx == 0 ) ) - ch = ch; - temp = Mpy_32_16_1( band_nrg, sub( 32767, ADAPT_HTPROTO_IIR_FAC_FX ) ); IF( LT_16( hHeadTrackData->q_procChEneIIR, q_temp ) ) { @@ -3582,8 +3561,6 @@ static void adaptTransportSignalsHeadtracked_fx( hHeadTrackData->procChEneIIR_fx[ch][band_idx] = L_add( L_shr( hHeadTrackData->procChEneIIR_fx[ch][band_idx], sub( hHeadTrackData->q_procChEneIIR, q_temp ) ), temp ); } } - - hHeadTrackData->procChEneIIR[ch][band_idx] = fixedToFloat_32( hHeadTrackData->procChEneIIR_fx[ch][band_idx], s_min( hHeadTrackData->q_procChEneIIR, q_temp ) ); } q_procChEneIIR = s_min( hHeadTrackData->q_procChEneIIR, q_temp ); diff --git a/lib_rend/ivas_dirac_rend.c b/lib_rend/ivas_dirac_rend.c index 566513aeb97ed44d242320dcfd300f32f47405a9..23522ead2ba7a3e3769d0193415e516b1d441dd3 100644 --- a/lib_rend/ivas_dirac_rend.c +++ b/lib_rend/ivas_dirac_rend.c @@ -4409,33 +4409,17 @@ void computeDirectionAngles( } #endif + /*------------------------------------------------------------------------- * ivas_masa_init_stereotype_detection() * * Initialize stereo transport signal type detection *------------------------------------------------------------------------*/ + #ifdef IVAS_FLOAT_FIXED void ivas_masa_init_stereotype_detection_fx( MASA_STEREO_TYPE_DETECT *stereo_type_detect) { - /*TODO : to clean up float code*/ - stereo_type_detect->left_bb_power = 0.0f; /* Broadband estimates */ - stereo_type_detect->right_bb_power = 0.0f; - stereo_type_detect->total_bb_power = 0.0f; - - stereo_type_detect->left_hi_power = 0.0f; /* High-frequency estimates */ - stereo_type_detect->right_hi_power = 0.0f; - stereo_type_detect->total_hi_power = 0.0f; - - set_zero(stereo_type_detect->sum_power, MASA_SUM_FREQ_RANGE_BINS); - set_zero(stereo_type_detect->total_power, MASA_SUM_FREQ_RANGE_BINS); - - stereo_type_detect->subtract_power_y = 0.0f; - stereo_type_detect->subtract_power_y_smooth = 0.0f; - stereo_type_detect->target_power_y_smooth = 0.0f; - - /*--------------------------------------------*/ - stereo_type_detect->masa_stereo_type = MASA_STEREO_DOWNMIX; stereo_type_detect->current_stereo_type = MASA_STEREO_DOWNMIX; stereo_type_detect->type_change_direction = MASA_STEREO_DOWNMIX; @@ -4516,6 +4500,8 @@ void ivas_masa_init_stereotype_detection( return; } #endif + + #ifdef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * ivas_masa_stereotype_detection_fx() diff --git a/lib_rend/ivas_limiter.c b/lib_rend/ivas_limiter.c index 1ecf2342b5eea3ac4c9dc19220fa51d6901bedcb..0caee4ed25b02918c06160b1c32bbedd1da6d6ea 100644 --- a/lib_rend/ivas_limiter.c +++ b/lib_rend/ivas_limiter.c @@ -617,7 +617,7 @@ void limiter_process_fx( sample = &output[c][i]; /* Apply gain */ - *sample = Mpy_32_32(L_shl( *sample,1 ),gain ) ;//q_factor + *sample = Mpy_32_32(L_shl_sat( *sample,1 ),gain ) ;//q_factor } } } diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 609d85be7ebe17a558b525294effe2b40eea0581..718f453aa31e5794c04e70124986b8701704adfa 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -496,20 +496,54 @@ typedef struct int16_t dipole_freq_range[2]; +#ifndef IVAS_FLOAT_FIXED float left_bb_power; float right_bb_power; float total_bb_power; +#else + Word32 left_bb_power_fx; /* Q(q_left_bb_power) */ + Word16 q_left_bb_power; + Word32 right_bb_power_fx; /* Q(q_right_bb_power) */ + Word16 q_right_bb_power; + Word32 total_bb_power_fx; /* Q(q_total_bb_power) */ + Word16 q_total_bb_power; +#endif +#ifndef IVAS_FLOAT_FIXED float left_hi_power; float right_hi_power; float total_hi_power; +#else + Word32 left_hi_power_fx; /* Q(q_left_hi_power) */ + Word16 q_left_hi_power; + Word32 right_hi_power_fx; /* Q(q_left_hi_power) */ + Word16 q_right_hi_power; + Word32 total_hi_power_fx; /* Q(q_total_hi_power) */ + Word16 q_total_hi_power; +#endif +#ifndef IVAS_FLOAT_FIXED float sum_power[MASA_SUM_FREQ_RANGE_BINS]; float total_power[MASA_SUM_FREQ_RANGE_BINS]; +#else + Word32 sum_power_fx[MASA_SUM_FREQ_RANGE_BINS]; /* Q(q_sum_power) */ + Word16 q_sum_power; + Word32 total_power_fx[MASA_SUM_FREQ_RANGE_BINS]; /* Q(q_total_power) */ + Word16 q_total_power; +#endif +#ifndef IVAS_FLOAT_FIXED float subtract_power_y; float subtract_power_y_smooth; float target_power_y_smooth; +#else + Word32 subtract_power_y_fx; /* Q(q_subtract_power_y) */ + Word16 q_subtract_power_y; + Word32 subtract_power_y_smooth_fx; /* Q(q_subtract_power_y_smooth) */ + Word16 q_subtract_power_y_smooth; + Word32 target_power_y_smooth_fx; /* Q(q_target_power_y_smooth) */ + Word16 q_target_power_y_smooth; +#endif #ifndef IVAS_FLOAT_FIXED float lr_total_bb_ratio_db; @@ -523,35 +557,6 @@ typedef struct Word32 subtract_target_ratio_db_fx; /* Q21 */ #endif -#ifdef IVAS_FLOAT_FIXED - Word32 left_bb_power_fx; - Word16 q_left_bb_power; - Word32 right_bb_power_fx; - Word16 q_right_bb_power; - Word32 total_bb_power_fx; - Word16 q_total_bb_power; - - Word32 left_hi_power_fx; - Word16 q_left_hi_power; - Word32 right_hi_power_fx; - Word16 q_right_hi_power; - Word32 total_hi_power_fx; - Word16 q_total_hi_power; - - Word32 sum_power_fx[MASA_SUM_FREQ_RANGE_BINS]; - Word16 q_sum_power; - Word32 total_power_fx[MASA_SUM_FREQ_RANGE_BINS]; - Word16 q_total_power; - - Word32 subtract_power_y_fx; - Word32 subtract_power_y_smooth_fx; - Word32 target_power_y_smooth_fx; - - Word16 q_subtract_power_y; - Word16 q_subtract_power_y_smooth; - Word16 q_target_power_y_smooth; -#endif - int16_t counter; int16_t interpolator; @@ -1197,16 +1202,14 @@ typedef struct ivas_combined_orientation_struct #ifndef IVAS_FLOAT_FIXED float Rmat[MAX_PARAM_SPATIAL_SUBFRAMES][3][3]; float Rmat_prev[3][3]; + float chEneIIR[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ + float procChEneIIR[2][MASA_FREQUENCY_BANDS]; #else Word32 Rmat_fx[MAX_PARAM_SPATIAL_SUBFRAMES][3][3]; /* Q30 */ Word32 Rmat_prev_fx[3][3]; /* Q30 */ -#endif - float chEneIIR[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ - float procChEneIIR[2][MASA_FREQUENCY_BANDS]; -#ifdef IVAS_FLOAT_FIXED - Word32 chEneIIR_fx[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ + Word32 chEneIIR_fx[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */ /* Q(q_chEneIIR) */ Word16 q_chEneIIR; - Word32 procChEneIIR_fx[2][MASA_FREQUENCY_BANDS]; + Word32 procChEneIIR_fx[2][MASA_FREQUENCY_BANDS]; /* Q(q_procChEneIIR) */ Word16 q_procChEneIIR; #endif Word16 shd_rot_max_order; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 01944f9c26a2f2e1f57b5edc6c4fccdafaee88a9..31b4712da2c8f44b59dd1842294a835355c4302e 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -14833,21 +14833,7 @@ static void intermidiate_ext_dirac_render( f2me_buf(hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, &hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len); hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q = 31 - hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q; - - if( hDirACRend->masa_stereo_type_detect != NULL ) - { - hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth = L_get_q( hDirACRend->masa_stereo_type_detect->target_power_y_smooth ); - hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->target_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); - - hDirACRend->masa_stereo_type_detect->q_subtract_power_y = L_get_q(hDirACRend->masa_stereo_type_detect->subtract_power_y); - - hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth = L_get_q(hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth); - - hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth, hDirACRend->masa_stereo_type_detect->q_subtract_power_y_smooth ); - hDirACRend->masa_stereo_type_detect->subtract_power_y_fx = floatToFixed( hDirACRend->masa_stereo_type_detect->subtract_power_y, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - } - //floatToFixed_arrL32( hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f_len ); - + FOR ( slot_idx = 0; slot_idx < hSpatParamRendCom->subframe_nbslots[subframe_idx]; slot_idx++ ) { /* CLDFB Analysis*/ @@ -14956,12 +14942,6 @@ static void intermidiate_ext_dirac_render( } } fixedToFloat_arrL32( hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_fx, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_q, hDirACRend->h_output_synthesis_psd_state.proto_diffuse_buffer_f_len); - IF( hDirACRend->masa_stereo_type_detect != NULL ) - { - hDirACRend->masa_stereo_type_detect->target_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->target_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_target_power_y_smooth ); - hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_smooth_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - hDirACRend->masa_stereo_type_detect->subtract_power_y = fixedToFloat( hDirACRend->masa_stereo_type_detect->subtract_power_y_fx, hDirACRend->masa_stereo_type_detect->q_subtract_power_y ); - } fixedToFloat_arrL32( hDirACRend->proto_frame_f_fx, hDirACRend->proto_frame_f, hDirACRend->proto_frame_f_q, hDirACRend->proto_frame_f_len ); //fixedToFloat_arrL32(DirAC_mem.frame_dec_f_fx, DirAC_mem.frame_dec_f, DirAC_mem.frame_dec_f_q, DirAC_mem.frame_dec_f_len);