diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj
index 29658b452400064cfec17a459957e1e6ac7f12dd..cdf577df2f1c6e9a9e44ae29b846500a4f73689c 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 6bc0ffe04b5362a5a229d50458d96bcc95108214..a719959802cc618915d6e5023c8f2e9b38fb9eea 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 672c6dfac2b9e0a769e5554cd6e5d70974861b01..f248ab541afc02ffaef4c7d2d96a132f66eaf949 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 6d71aabf0312f96b44483dcb109d1a7293389a38..942c63712f66e57821488868f81981d3042c56b0 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 a554ff3408757a91d32c7fa831795e98983b82aa..9a1273a4258044b30ffb1b18553f337b07a70e73 100755
--- a/lib_com/ivas_prot.h
+++ b/lib_com/ivas_prot.h
@@ -3714,6 +3714,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 */
@@ -3723,6 +3724,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,
@@ -4655,6 +4657,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 */
@@ -4680,6 +4683,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 26e26ec6d67aeaf8fc94004efdc148b0f20391db..1b598d099679cc6205ebcefea92da2e080683f02 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 54389fefef7840087f1770e37f590aafe8004ded..b1a9d0b6f7d90c8ad65dacd2c699ec735768cf3f 100644
--- a/lib_com/options.h
+++ b/lib_com/options.h
@@ -151,8 +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 */
+
/* #################### End BE switches ################################## */
diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h
index 5abd6b000d0191ad95f17486653795f2b5c0063a..81612f51068d2407b9bc364da5a072f93433d7d3 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 1f6dfe5079e26a32c40c177f7d6b315d8cc95a29..e461f17311a4b62fa3cfa0351d25bde9ef67d554 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 d443129ab2de9596ee63544dc9ff798a5fdbdd42..680eedb7a483f2e0d7fe52f7c62ff1ff4a39893c 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 length /* i : output frame length */
+)
{
int16_t i, k;
int16_t idx;
@@ -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 */