From 6fa2007370b69e487c06207e3068625caf8a720b Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 25 Oct 2023 10:34:59 +0200 Subject: [PATCH 1/3] issue 865: Move ivas_td_decorr.c from lib_com to lib_rend; under FIX_865_MOVE_TD_DECORR --- Workspace_msvc/lib_com.vcxproj | 1 - Workspace_msvc/lib_com.vcxproj.filters | 3 -- Workspace_msvc/lib_rend.vcxproj | 1 + Workspace_msvc/lib_rend.vcxproj.filters | 3 ++ lib_com/ivas_prot.h | 4 +++ lib_com/ivas_stat_com.h | 3 ++ lib_com/options.h | 1 + lib_rend/ivas_prot_rend.h | 40 +++++++++++++++++++++++++ lib_rend/ivas_stat_rend.h | 30 +++++++++++++++++++ {lib_com => lib_rend}/ivas_td_decorr.c | 30 +++++++++++-------- 10 files changed, 100 insertions(+), 16 deletions(-) rename {lib_com => lib_rend}/ivas_td_decorr.c (94%) diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj index 29658b4524..cdf577df2f 100644 --- a/Workspace_msvc/lib_com.vcxproj +++ b/Workspace_msvc/lib_com.vcxproj @@ -217,7 +217,6 @@ - diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters index 6bc0ffe04b..a719959802 100644 --- a/Workspace_msvc/lib_com.vcxproj.filters +++ b/Workspace_msvc/lib_com.vcxproj.filters @@ -460,9 +460,6 @@ common_ivas_c - - common_ivas_c - common_ivas_c diff --git a/Workspace_msvc/lib_rend.vcxproj b/Workspace_msvc/lib_rend.vcxproj index 672c6dfac2..f248ab541a 100644 --- a/Workspace_msvc/lib_rend.vcxproj +++ b/Workspace_msvc/lib_rend.vcxproj @@ -191,6 +191,7 @@ + diff --git a/Workspace_msvc/lib_rend.vcxproj.filters b/Workspace_msvc/lib_rend.vcxproj.filters index 6d71aabf03..942c63712f 100644 --- a/Workspace_msvc/lib_rend.vcxproj.filters +++ b/Workspace_msvc/lib_rend.vcxproj.filters @@ -170,6 +170,9 @@ rend_c + + rend_c + diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 4502f8dd6a..7a0715e85e 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -3712,6 +3712,7 @@ void ivas_dirac_dec_render_sf( float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] ); +#ifndef FIX_865_MOVE_TD_DECORR ivas_error ivas_td_decorr_reconfig_dec( const IVAS_FORMAT ivas_format, /* i : IVAS format */ const int32_t ivas_total_brate, /* i : total IVAS bitrate */ @@ -3721,6 +3722,7 @@ ivas_error ivas_td_decorr_reconfig_dec( uint16_t *useTdDecorr /* i/o: TD decorrelator flag */ ); +#endif void computeDiffuseness_mdft( float **buffer_intensity[DIRAC_NUM_DIMS], const float *buffer_energy, @@ -4653,6 +4655,7 @@ void ivas_td_decorr_get_ducking_gains( const int16_t tdet_flag ); +#ifndef FIX_865_MOVE_TD_DECORR ivas_error ivas_td_decorr_dec_open( ivas_td_decorr_state_t **hTdDecorr, /* i/o: TD decorrelator handle */ const int32_t output_Fs, /* i : output sampling rate */ @@ -4678,6 +4681,7 @@ void ivas_td_decorr_APD_iir_filter( const int16_t length ); +#endif #define IVAS_CMULT_FLOAT( in1_re, in1_im, in2_re, in2_im, out1_re, out1_im ) \ out1_re = ( in1_re * in2_re ) - ( in1_im * in2_im ); MAC(1); MULT(1); \ out1_im = ( in1_re * in2_im ) + ( in2_re * in1_im ); MAC(1); MULT(1); diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 26e26ec6d6..1b598d0996 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -672,6 +672,8 @@ typedef struct ivas_trans_det_state_t } ivas_trans_det_state_t; +#ifndef FIX_865_MOVE_TD_DECORR + /*----------------------------------------------------------------------------------* * Time domain decorrelator *----------------------------------------------------------------------------------*/ @@ -699,6 +701,7 @@ typedef struct ivas_td_decorr_state_t } ivas_td_decorr_state_t; +#endif /*----------------------------------------------------------------------------------* * Filter Bank (FB) structures diff --git a/lib_com/options.h b/lib_com/options.h index 20d8ccce14..c4d201d6b6 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,6 +151,7 @@ /*#define SPLIT_REND_WITH_HEAD_ROT */ /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #define FIX_879_USAN_ERROR_IN_MASA_DECODING /* FhG: Issue 879 : avoid arithmetic with NULL pointer in the DirAC decoder to fix USAN error */ +#define FIX_865_MOVE_TD_DECORR /* VA: issue 865: Move ivas_td_decorr.c from lib_com to lib_rend */ /* #################### End BE switches ################################## */ diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 5abd6b000d..81612f5106 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -109,6 +109,46 @@ void limiter_process( int16_t *strong_saturation_cnt /* i/o: counter of strong saturations (can be NULL) */ ); +#ifdef FIX_865_MOVE_TD_DECORR +/*----------------------------------------------------------------------------------* + * TD decorr. function prototypes + *----------------------------------------------------------------------------------*/ + +ivas_error ivas_td_decorr_dec_open( + ivas_td_decorr_state_t **hTdDecorr, /* i/o: TD decorrelator handle */ + const int32_t output_Fs, /* i : output sampling rate */ + const int16_t nchan_internal, /* i : number of internal channels */ + const int16_t ducking_flag /* i : ducking flag */ +); + +void ivas_td_decorr_dec_close( + ivas_td_decorr_state_t **hTdDecorr /* i/o: TD decorrelator handle */ +); + +void ivas_td_decorr_process( + ivas_td_decorr_state_t *hTdDecorr, /* i/o: TD decoderrelator handle */ + float *pcm_in[], /* i : input audio channels */ + float **ppOut_pcm, /* o : output audio channels */ + const int16_t output_frame /* i : output frame length */ +); + +ivas_error ivas_td_decorr_reconfig_dec( + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int32_t ivas_total_brate, /* i : total IVAS bitrate */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int32_t output_Fs, /* i : output sampling rate */ + ivas_td_decorr_state_t **hTdDecorr, /* i/o: TD decorrelator handle */ + uint16_t *useTdDecorr /* i/o: TD decorrelator flag */ +); + +void ivas_td_decorr_APD_iir_filter( + ivas_td_decorr_APD_filt_state_t *filter_state, /* i/o: TD decorrelator filter handle */ + float *pIn_out, /* i/o: audio channels */ + const int16_t num_APD_sections, /* i : numbef of APD sections */ + const int16_t output_frame /* i : output frame length */ +); + +#endif /*----------------------------------------------------------------------------------* * Amplitude Panning EFAP prototypes diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 1f6dfe5079..e461f17311 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -73,6 +73,36 @@ typedef struct ivas_output_setup_structure } IVAS_OUTPUT_SETUP, *IVAS_OUTPUT_SETUP_HANDLE; +#ifdef FIX_865_MOVE_TD_DECORR +/*----------------------------------------------------------------------------------* + * Time domain decorrelator structures + *----------------------------------------------------------------------------------*/ + +typedef struct ivas_td_decorr_APD_filt_state_t +{ + int16_t order[IVAS_MAX_DECORR_APD_SECTIONS]; + int16_t idx[IVAS_MAX_DECORR_APD_SECTIONS]; + float coeffs[IVAS_MAX_DECORR_APD_SECTIONS]; + float *state[IVAS_MAX_DECORR_APD_SECTIONS]; + +} ivas_td_decorr_APD_filt_state_t; + +typedef struct ivas_td_decorr_state_t +{ + ivas_trans_det_state_t *pTrans_det; + float *look_ahead_buf; + ivas_td_decorr_APD_filt_state_t APD_filt_state[IVAS_MAX_DECORR_CHS]; + + int16_t num_apd_outputs; + int16_t num_apd_sections; + int16_t ducking_flag; + + int16_t offset; + +} ivas_td_decorr_state_t; +#endif + + /*----------------------------------------------------------------------------------* * Spatial parametric rendering common structures *----------------------------------------------------------------------------------*/ diff --git a/lib_com/ivas_td_decorr.c b/lib_rend/ivas_td_decorr.c similarity index 94% rename from lib_com/ivas_td_decorr.c rename to lib_rend/ivas_td_decorr.c index d443129ab2..a3bb82560e 100644 --- a/lib_com/ivas_td_decorr.c +++ b/lib_rend/ivas_td_decorr.c @@ -34,6 +34,9 @@ #include "options.h" #include "prot.h" #include "ivas_prot.h" +#ifdef FIX_865_MOVE_TD_DECORR +#include "ivas_prot_rend.h" +#endif #ifdef DEBUGGING #include "debug.h" #endif @@ -358,9 +361,10 @@ static int16_t ivas_get_APD_filt_orders( *-----------------------------------------------------------------------------------------*/ static void ivas_td_decorr_init( - ivas_td_decorr_state_t *hTdDecorr, - const int16_t num_out_chans, - const int16_t ducking_flag ) + ivas_td_decorr_state_t *hTdDecorr, /* i/o: TD decorrelator handle */ + const int16_t num_out_chans, /* i : number of channels */ + const int16_t ducking_flag /* i : TD ducking flag */ +) { int16_t i, j; @@ -388,10 +392,11 @@ static void ivas_td_decorr_init( *-----------------------------------------------------------------------------------------*/ void ivas_td_decorr_APD_iir_filter( - ivas_td_decorr_APD_filt_state_t *filter_state, - float *pIn_out, - const int16_t num_APD_sections, - const int16_t length ) + ivas_td_decorr_APD_filt_state_t *filter_state, /* i/o: TD decorrelator filter handle */ + float *pIn_out, /* i/o: audio channels */ + const int16_t num_APD_sections, /* i : numbef of APD sections */ + const int16_t output_frame /* i : output frame length */ +) { int16_t i, k; int16_t idx; @@ -407,7 +412,7 @@ void ivas_td_decorr_APD_iir_filter( idx = filter_state->idx[k]; - for ( i = 0; i < length; i++ ) + for ( i = 0; i < output_frame; i++ ) { tmp_pIn_buf_i = pIn[i]; @@ -434,9 +439,10 @@ void ivas_td_decorr_APD_iir_filter( *-----------------------------------------------------------------------------------------*/ static void ivas_td_decorr_APD_sections( - ivas_td_decorr_state_t *hTdDecorr, - float **ppOut_pcm, - const int16_t output_frame ) + ivas_td_decorr_state_t *hTdDecorr, /* i/o: TD decorrelator handle */ + float **ppOut_pcm, /* i/o: audio channels */ + const int16_t output_frame /* i : output frame length */ +) { int16_t i; @@ -456,7 +462,7 @@ static void ivas_td_decorr_APD_sections( *-----------------------------------------------------------------------------------------*/ void ivas_td_decorr_process( - ivas_td_decorr_state_t *hTdDecorr, /* i/o: SPAR Covar. decoder handle */ + ivas_td_decorr_state_t *hTdDecorr, /* i/o: TD decorrelator handle */ float *pcm_in[], /* i : input audio channels */ float **ppOut_pcm, /* o : output audio channels */ const int16_t output_frame /* i : output frame length */ -- GitLab From b35fe7435cd02c5ce62ea9ad94f9f32145f7c544 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 26 Oct 2023 05:32:55 +0000 Subject: [PATCH 2/3] Update ivas_td_decorr.c --- lib_rend/ivas_td_decorr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/ivas_td_decorr.c b/lib_rend/ivas_td_decorr.c index a3bb82560e..680eedb7a4 100644 --- a/lib_rend/ivas_td_decorr.c +++ b/lib_rend/ivas_td_decorr.c @@ -395,7 +395,7 @@ void ivas_td_decorr_APD_iir_filter( ivas_td_decorr_APD_filt_state_t *filter_state, /* i/o: TD decorrelator filter handle */ float *pIn_out, /* i/o: audio channels */ const int16_t num_APD_sections, /* i : numbef of APD sections */ - const int16_t output_frame /* i : output frame length */ + const int16_t length /* i : output frame length */ ) { int16_t i, k; @@ -412,7 +412,7 @@ void ivas_td_decorr_APD_iir_filter( idx = filter_state->idx[k]; - for ( i = 0; i < output_frame; i++ ) + for ( i = 0; i < length; i++ ) { tmp_pIn_buf_i = pIn[i]; -- GitLab From 6b18396e4389b989f24857181169b7230cefc02b Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 30 Oct 2023 10:15:01 +0100 Subject: [PATCH 3/3] rearrange switches order --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index ba978d3199..b1a9d0b6f7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,9 +151,9 @@ /*#define SPLIT_REND_WITH_HEAD_ROT */ /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #define FIX_879_USAN_ERROR_IN_MASA_DECODING /* FhG: Issue 879 : avoid arithmetic with NULL pointer in the DirAC decoder to fix USAN error */ +#define FIX_740_MASA_PREREND_VALIDITY_CHECK /* Nokia: issue 740: fix incorrect validity check in lib_rend to allow use of MASA prerenderer */ #define FIX_865_MOVE_TD_DECORR /* VA: issue 865: Move ivas_td_decorr.c from lib_com to lib_rend */ -#define FIX_740_MASA_PREREND_VALIDITY_CHECK /* Nokia: issue 740: fix incorrect validity check in lib_rend to allow use of MASA prerenderer */ /* #################### End BE switches ################################## */ -- GitLab