From b313fedab38835796f6052ad0e91d640614fa9e2 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 29 Jan 2025 11:21:13 +0100 Subject: [PATCH 1/2] fix check for td stereo second channel --- lib_enc/ivas_core_pre_proc_front.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 38651b5be..3f87786f9 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -294,14 +294,20 @@ ivas_error pre_proc_front_ivas_fx( } #ifdef DEBUG_MODE_INFO - if ( !( hCPE->hStereoTD != NULL && ch_idx > 0 ) ) { - int16_t tmpF[L_FRAME48k]; - for ( int16_t isample = 0; isample < input_frame; isample++ ) + int16_t is_td_stereo_second_channel; + is_td_stereo_second_channel = hCPE != NULL && hCPE->hStereoTD != NULL && ch_idx > 0; + + /* for TD stereo only write out first channel. The existence of a second channel can vary, this is just easier to handle */ + if ( !is_td_stereo_second_channel ) { - tmpF[isample] = (int16_t) ( (float) in_buff_temp[isample - NS2SA( st->input_Fs, ACELP_LOOK_NS )] / ( (float) ( 1 << in_q_temp ) ) ); + int16_t tmpF[L_FRAME48k]; + for ( int16_t isample = 0; isample < input_frame; isample++ ) + { + tmpF[isample] = (int16_t) ( (float) in_buff_temp[isample - NS2SA( st->input_Fs, ACELP_LOOK_NS )] / ( (float) ( 1 << in_q_temp ) ) ); + } + dbgwrite( &tmpF, sizeof( int16_t ), input_frame, 1, strcat( fname( debug_dir, "ivas_input_dmx", 0, ch_idx + 1, ENC ), ".pcm" ) ); } - dbgwrite( &tmpF, sizeof( int16_t ), input_frame, 1, strcat( fname( debug_dir, "ivas_input_dmx", 0, ch_idx + 1, ENC ), ".pcm" ) ); } #endif -- GitLab From 1d6c1fb6ef0032ea8df7622e6311c32e2b42e091 Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Wed, 29 Jan 2025 17:00:47 +0100 Subject: [PATCH 2/2] simplify if() condition --- lib_enc/ivas_core_pre_proc_front.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 3f87786f9..46c3b8be6 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -294,20 +294,15 @@ ivas_error pre_proc_front_ivas_fx( } #ifdef DEBUG_MODE_INFO + if ( !( hCPE != NULL && hCPE->hStereoTD != NULL && ch_idx > 0 ) ) { - int16_t is_td_stereo_second_channel; - is_td_stereo_second_channel = hCPE != NULL && hCPE->hStereoTD != NULL && ch_idx > 0; - /* for TD stereo only write out first channel. The existence of a second channel can vary, this is just easier to handle */ - if ( !is_td_stereo_second_channel ) + int16_t tmpF[L_FRAME48k]; + for ( int16_t isample = 0; isample < input_frame; isample++ ) { - int16_t tmpF[L_FRAME48k]; - for ( int16_t isample = 0; isample < input_frame; isample++ ) - { - tmpF[isample] = (int16_t) ( (float) in_buff_temp[isample - NS2SA( st->input_Fs, ACELP_LOOK_NS )] / ( (float) ( 1 << in_q_temp ) ) ); - } - dbgwrite( &tmpF, sizeof( int16_t ), input_frame, 1, strcat( fname( debug_dir, "ivas_input_dmx", 0, ch_idx + 1, ENC ), ".pcm" ) ); + tmpF[isample] = (int16_t) ( (float) in_buff_temp[isample - NS2SA( st->input_Fs, ACELP_LOOK_NS )] / ( (float) ( 1 << in_q_temp ) ) ); } + dbgwrite( &tmpF, sizeof( int16_t ), input_frame, 1, strcat( fname( debug_dir, "ivas_input_dmx", 0, ch_idx + 1, ENC ), ".pcm" ) ); } #endif -- GitLab