diff --git a/Workspace_msvc/lib_com.vcxproj b/Workspace_msvc/lib_com.vcxproj
index 7403719a8e6a601e174c755a3dd101d836969b79..fba796c7c63e8a6e1e913f76203477e3326ce4e0 100644
--- a/Workspace_msvc/lib_com.vcxproj
+++ b/Workspace_msvc/lib_com.vcxproj
@@ -192,6 +192,7 @@
+
diff --git a/Workspace_msvc/lib_com.vcxproj.filters b/Workspace_msvc/lib_com.vcxproj.filters
index 02b89d239320bfa5f5a975d62fc5bfa11c2bb2c1..7a8f8e013bc27c7ca256c1f5945d88fd49176f28 100644
--- a/Workspace_msvc/lib_com.vcxproj.filters
+++ b/Workspace_msvc/lib_com.vcxproj.filters
@@ -469,6 +469,9 @@
common_ivas_c
+
+ common_ivas_c
+
diff --git a/lib_com/ivas_lfe_com.c b/lib_com/ivas_lfe_com.c
new file mode 100644
index 0000000000000000000000000000000000000000..45dcae7c07a16f87259decd40f4bc1886422fe11
--- /dev/null
+++ b/lib_com/ivas_lfe_com.c
@@ -0,0 +1,142 @@
+/******************************************************************************************************
+
+ (C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository. All Rights Reserved.
+
+ This software is protected by copyright law and by international treaties.
+ The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
+ Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
+ Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
+ Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+ contributors to this repository retain full ownership rights in their respective contributions in
+ the software. This notice grants no license of any kind, including but not limited to patent
+ license, nor is any license granted by implication, estoppel or otherwise.
+
+ Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
+ contributions.
+
+ This software is provided "AS IS", without any express or implied warranties. The software is in the
+ development stage. It is intended exclusively for experts who have experience with such software and
+ solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
+ and fitness for a particular purpose are hereby disclaimed and excluded.
+
+ Any dispute, controversy or claim arising under or in relation to providing this software shall be
+ submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
+ accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
+ the United Nations Convention on Contracts on the International Sales of Goods.
+
+*******************************************************************************************************/
+
+#include
+#include "math.h"
+#include "options.h"
+#ifdef DEBUGGING
+#include "debug.h"
+#endif
+#include "ivas_stat_com.h"
+#include "prot.h"
+#include "ivas_prot.h"
+#include "rom_com.h"
+#include "ivas_rom_com.h"
+#include "cnst.h"
+#include
+#include "wmc_auto.h"
+
+
+/*-----------------------------------------------------------------------------------------*
+ * Function ivas_lfe_lpf_select_filt_coeff()
+ *
+ * Selects LFE filter coeff based on config.
+ *-----------------------------------------------------------------------------------------*/
+
+void ivas_lfe_lpf_select_filt_coeff(
+ const int32_t sampling_rate, /* i : sampling rate */
+ const int16_t order, /* i : filter order */
+ const float **ppFilt_coeff /* o : filter coefficients */
+)
+{
+ switch ( order )
+ {
+ case IVAS_FILTER_ORDER_2:
+ switch ( sampling_rate )
+ {
+ case 16000:
+ *ppFilt_coeff = ivas_lpf_2_butter_16k;
+ break;
+ case 32000:
+ *ppFilt_coeff = ivas_lpf_2_butter_32k;
+ break;
+ case 48000:
+ *ppFilt_coeff = ivas_lpf_2_butter_48k;
+ break;
+ default:
+ break;
+ }
+ break;
+ case IVAS_FILTER_ORDER_4:
+ switch ( sampling_rate )
+ {
+ case 16000:
+ *ppFilt_coeff = ivas_lpf_4_butter_16k_sos;
+ break;
+ case 32000:
+ *ppFilt_coeff = ivas_lpf_4_butter_32k_sos;
+ break;
+ case 48000:
+ *ppFilt_coeff = ivas_lpf_4_butter_48k_sos;
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ assert( !"Unsupported LFE Filter order" );
+ }
+
+ return;
+}
+
+
+/*-----------------------------------------------------------------------------------------*
+ * Function ivas_lfe_window_init()
+ *
+ * Initialize LFE window
+ *-----------------------------------------------------------------------------------------*/
+
+void ivas_lfe_window_init(
+ LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */
+ const int32_t sampling_rate, /* i : sampling rate */
+ const int16_t frame_len /* i : frame length in samples */
+)
+{
+ /* Set window coefficients */
+ if ( sampling_rate == 48000 )
+ {
+ hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_48k;
+ }
+ else if ( sampling_rate == 32000 )
+ {
+ hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_32k;
+ }
+ else if ( sampling_rate == 16000 )
+ {
+ hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_16k;
+ }
+ else
+ {
+ assert( !"8kHz LFE Window not supported" );
+ }
+
+ /* 10ms stride, MDCT will be done in two iterations */
+ hLFEWindow->dct_len = frame_len >> 1;
+
+ /* 8ms of latency */
+ hLFEWindow->fade_len = NS2SA( sampling_rate, IVAS_LFE_FADE_NS );
+ hLFEWindow->zero_pad_len = (int16_t) ( IVAS_ZERO_PAD_LEN_MULT_FAC * ( hLFEWindow->dct_len - hLFEWindow->fade_len ) );
+ hLFEWindow->full_len = hLFEWindow->zero_pad_len + hLFEWindow->fade_len + hLFEWindow->dct_len;
+
+ return;
+}
diff --git a/lib_com/ivas_mdct_imdct.c b/lib_com/ivas_mdct_imdct.c
index 5580973ed02eba244e3d2050d1e403598e34dc7c..5dcd850c2ee1bbc4a42b48e252c9248c5e9b93a0 100644
--- a/lib_com/ivas_mdct_imdct.c
+++ b/lib_com/ivas_mdct_imdct.c
@@ -34,6 +34,7 @@
#include "options.h"
#include "prot.h"
#include "ivas_prot.h"
+#include "ivas_rom_com.h"
#ifdef DEBUGGING
#include "debug.h"
#endif
@@ -45,6 +46,10 @@
* Local constants
*------------------------------------------------------------------------------------------*/
+#define IVAS_MDCT_SCALING_GAIN_48k 1.9699011974118126e-06f
+#define IVAS_MDCT_SCALING_GAIN_32k 2.9548517961177197e-06f
+#define IVAS_MDCT_SCALING_GAIN_16k 5.909703592235439e-06f
+
#define IVAS_IMDCT_SCALING_GAIN 2115.165304808f
@@ -296,3 +301,82 @@ void ivas_imdct(
return;
}
+
+
+/*-----------------------------------------------------------------------------------------*
+ * Function ivas_get_twid_factors()
+ *
+ * Sets/Maps the fft twiddle tables based on fft length
+ *-----------------------------------------------------------------------------------------*/
+
+void ivas_get_twid_factors(
+ const int16_t length,
+ const float **pTwid_re,
+ const float **pTwid_im )
+{
+ if ( length == 480 )
+ {
+ *pTwid_re = &ivas_cos_twiddle_480[0];
+ *pTwid_im = &ivas_sin_twiddle_480[0];
+ }
+ else if ( length == 320 )
+ {
+ *pTwid_re = &ivas_cos_twiddle_320[0];
+ *pTwid_im = &ivas_sin_twiddle_320[0];
+ }
+ else if ( length == 160 )
+ {
+ *pTwid_re = &ivas_cos_twiddle_160[0];
+ *pTwid_im = &ivas_sin_twiddle_160[0];
+ }
+ else if ( length == 80 )
+ {
+ *pTwid_re = &ivas_cos_twiddle_80[0];
+ *pTwid_im = &ivas_sin_twiddle_80[0];
+ }
+ else
+ {
+ assert( !"Not supported FFT length!" );
+ }
+
+ return;
+}
+
+
+/*-----------------------------------------------------------------------------------------*
+ * Function ivas_get_mdct_scaling_gain()
+ *
+ * Get scaling gain for MDCT functions
+ *-----------------------------------------------------------------------------------------*/
+
+float ivas_get_mdct_scaling_gain(
+ const int16_t dct_len_by_2 )
+{
+ float gain = 0.0f;
+
+ switch ( dct_len_by_2 )
+ {
+ case L_FRAME48k >> 2:
+ {
+ gain = IVAS_MDCT_SCALING_GAIN_48k;
+ break;
+ }
+ case L_FRAME32k >> 2:
+ {
+ gain = IVAS_MDCT_SCALING_GAIN_32k;
+ break;
+ }
+ case L_FRAME16k >> 2:
+ {
+ gain = IVAS_MDCT_SCALING_GAIN_16k;
+ break;
+ }
+ default:
+ {
+ assert( !"Unsupported frame length!" );
+ break;
+ }
+ }
+
+ return gain;
+}
diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h
index 74b79ef9a9d6b46ff93d6e5eab1aeb18ed73dc4f..f57e92a634d890087f17e5f9663b1414b6698d42 100755
--- a/lib_com/ivas_prot.h
+++ b/lib_com/ivas_prot.h
@@ -5643,14 +5643,14 @@ void ivas_lfe_dec(
float output_lfe_ch[] /* o : output LFE synthesis */
);
-void LFE_tdplc(
+void ivas_lfe_tdplc(
LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */
const float *prevsynth, /* i : previous frame synthesis */
float *ytda, /* o : output time-domain buffer */
const int16_t output_frame /* i : output frame length */
);
-void lfe_window_init(
+void ivas_lfe_window_init(
LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */
const int32_t sampling_rate, /* i : sampling rate */
const int16_t frame_len /* i : frame length in samples */
diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c
index af183c2b74ff00b2a0e08d48eaed8a07d2bdeed9..90dc1b0a841bb6800a542fe593e97e2c057a9e00 100644
--- a/lib_com/ivas_spar_com.c
+++ b/lib_com/ivas_spar_com.c
@@ -50,10 +50,6 @@
* Local constants
*------------------------------------------------------------------------------------------*/
-#define IVAS_MDCT_SCALING_GAIN_48k 1.9699011974118126e-06f
-#define IVAS_MDCT_SCALING_GAIN_32k 2.9548517961177197e-06f
-#define IVAS_MDCT_SCALING_GAIN_16k 5.909703592235439e-06f
-
#define IVAS_FLT_EPS ( 1e-10F )
#define IVAS_DBL_EPS ( (double) 1e-20 )
@@ -90,139 +86,6 @@ static int16_t ivas_is_mat_inv( float in_re[MAX_MAT_DIM][MAX_MAT_DIM], const int
static void ivas_calc_mat_inv( float in_re[MAX_MAT_DIM][MAX_MAT_DIM], const int16_t dim, float out_re[MAX_MAT_DIM][MAX_MAT_DIM] );
-/*-----------------------------------------------------------------------------------------*
- * Function ivas_get_twid_factors()
- *
- * Sets/Maps the fft twiddle tables based on fft length
- *-----------------------------------------------------------------------------------------*/
-
-void ivas_get_twid_factors(
- const int16_t length,
- const float **pTwid_re,
- const float **pTwid_im )
-{
- if ( length == 480 )
- {
- *pTwid_re = &ivas_cos_twiddle_480[0];
- *pTwid_im = &ivas_sin_twiddle_480[0];
- }
- else if ( length == 320 )
- {
- *pTwid_re = &ivas_cos_twiddle_320[0];
- *pTwid_im = &ivas_sin_twiddle_320[0];
- }
- else if ( length == 160 )
- {
- *pTwid_re = &ivas_cos_twiddle_160[0];
- *pTwid_im = &ivas_sin_twiddle_160[0];
- }
- else if ( length == 80 )
- {
- *pTwid_re = &ivas_cos_twiddle_80[0];
- *pTwid_im = &ivas_sin_twiddle_80[0];
- }
- else
- {
- assert( !"Not supported FFT length!" );
- }
-
- return;
-}
-
-
-/*-----------------------------------------------------------------------------------------*
- * Function ivas_get_mdct_scaling_gain()
- *
- * Get scaling gain for MDCT functions
- *-----------------------------------------------------------------------------------------*/
-
-float ivas_get_mdct_scaling_gain(
- const int16_t dct_len_by_2 )
-{
- float gain = 0.0f;
-
- switch ( dct_len_by_2 )
- {
- case L_FRAME48k >> 2:
- {
- gain = IVAS_MDCT_SCALING_GAIN_48k;
- break;
- }
- case L_FRAME32k >> 2:
- {
- gain = IVAS_MDCT_SCALING_GAIN_32k;
- break;
- }
- case L_FRAME16k >> 2:
- {
- gain = IVAS_MDCT_SCALING_GAIN_16k;
- break;
- }
- default:
- {
- assert( !"Unsupported frame length!" );
- break;
- }
- }
-
- return gain;
-}
-
-
-/*-----------------------------------------------------------------------------------------*
- * Function ivas_lfe_lpf_select_filt_coeff()
- *
- * Selects LFE filter coeff based on config.
- *-----------------------------------------------------------------------------------------*/
-
-void ivas_lfe_lpf_select_filt_coeff(
- const int32_t sampling_rate, /* i : sampling rate */
- const int16_t order, /* i : filter order */
- const float **ppFilt_coeff /* o : filter coefficients */
-)
-{
- switch ( order )
- {
- case IVAS_FILTER_ORDER_2:
- switch ( sampling_rate )
- {
- case 16000:
- *ppFilt_coeff = ivas_lpf_2_butter_16k;
- break;
- case 32000:
- *ppFilt_coeff = ivas_lpf_2_butter_32k;
- break;
- case 48000:
- *ppFilt_coeff = ivas_lpf_2_butter_48k;
- break;
- default:
- break;
- }
- break;
- case IVAS_FILTER_ORDER_4:
- switch ( sampling_rate )
- {
- case 16000:
- *ppFilt_coeff = ivas_lpf_4_butter_16k_sos;
- break;
- case 32000:
- *ppFilt_coeff = ivas_lpf_4_butter_32k_sos;
- break;
- case 48000:
- *ppFilt_coeff = ivas_lpf_4_butter_48k_sos;
- break;
- default:
- break;
- }
- break;
- default:
- assert( !"Unsupported LFE Filter order" );
- }
-
- return;
-}
-
-
/*-----------------------------------------------------------------------------------------*
* Function ivas_get_bw_idx_from_sample_rate()
*
@@ -255,48 +118,6 @@ int16_t ivas_get_bw_idx_from_sample_rate(
}
-/*-----------------------------------------------------------------------------------------*
- * Function lfe_window_init()
- *
- * Initialize LFE window
- *-----------------------------------------------------------------------------------------*/
-
-void lfe_window_init(
- LFE_WINDOW_HANDLE hLFEWindow, /* i/o: LFE window handle */
- const int32_t sampling_rate, /* i : sampling rate */
- const int16_t frame_len /* i : frame length in samples */
-)
-{
- /* Set window coefficients */
- if ( sampling_rate == 48000 )
- {
- hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_48k;
- }
- else if ( sampling_rate == 32000 )
- {
- hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_32k;
- }
- else if ( sampling_rate == 16000 )
- {
- hLFEWindow->pWindow_coeffs = ivas_lfe_window_coeff_16k;
- }
- else
- {
- assert( !"8kHz LFE Window not supported" );
- }
-
- /* 10ms stride, MDCT will be done in two iterations */
- hLFEWindow->dct_len = frame_len >> 1;
-
- /* 8ms of latency */
- hLFEWindow->fade_len = NS2SA( sampling_rate, IVAS_LFE_FADE_NS );
- hLFEWindow->zero_pad_len = (int16_t) ( IVAS_ZERO_PAD_LEN_MULT_FAC * ( hLFEWindow->dct_len - hLFEWindow->fade_len ) );
- hLFEWindow->full_len = hLFEWindow->zero_pad_len + hLFEWindow->fade_len + hLFEWindow->dct_len;
-
- return;
-}
-
-
/*-------------------------------------------------------------------------
* ivas_spar_config()
*
diff --git a/lib_dec/ivas_lfe_dec.c b/lib_dec/ivas_lfe_dec.c
index 5c250286eedfd2291b691c92b3587f71ea484674..2641a32ae53ac67383b12ce01040af7672a478b8 100644
--- a/lib_dec/ivas_lfe_dec.c
+++ b/lib_dec/ivas_lfe_dec.c
@@ -307,7 +307,7 @@ void ivas_lfe_dec(
{
/* note: in BFI branch, buffer 't_audio' is in time-domain ('wtda' signal) */
hLFE->bfi_count++;
- LFE_tdplc( hLFE, hLFE->prevsynth_buf, t_audio, output_frame );
+ ivas_lfe_tdplc( hLFE, hLFE->prevsynth_buf, t_audio, output_frame );
ivas_itda( t_audio, out, dct_len );
ivas_lfe_dec_windowing( hLFE, out );
@@ -386,7 +386,7 @@ ivas_error ivas_create_lfe_dec(
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LFE window structure\n" ) );
}
- lfe_window_init( hLFE->pWindow_state, output_Fs, output_frame );
+ ivas_lfe_window_init( hLFE->pWindow_state, output_Fs, output_frame );
/* Initialization for entropy coding */
hLFE->cum_freq_models[0][0] = ivas_str_lfe_freq_models.entropy_coder_model_fine_sg1;
diff --git a/lib_dec/ivas_lfe_plc.c b/lib_dec/ivas_lfe_plc.c
index e89453686feeee5ac20a55f1ebf14bdb9245027f..491121af385a9d463315fe2e26377434a765fc34 100644
--- a/lib_dec/ivas_lfe_plc.c
+++ b/lib_dec/ivas_lfe_plc.c
@@ -483,12 +483,12 @@ static void recover_samples(
/*-----------------------------------------------------------------------------------------*
- * Function LFE_tdplc()
+ * Function ivas_lfe_tdplc()
*
* MDCT interface recover lost samples by extrapolation of signal buffer
*-----------------------------------------------------------------------------------------*/
-void LFE_tdplc(
+void ivas_lfe_tdplc(
LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */
const float *prevsynth, /* i : previous frame synthesis */
float *ytda, /* o : output time-domain buffer */
diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c
index 82a6338dd4099b0256d64b57f84ceef0fe1873f1..2ff49cb1f671cb6314d1cf71d3b7d1c2eb156b10 100644
--- a/lib_enc/ivas_lfe_enc.c
+++ b/lib_enc/ivas_lfe_enc.c
@@ -417,8 +417,7 @@ ivas_error ivas_create_lfe_enc(
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for LFE window structure\n" ) );
}
- lfe_window_init( hLFE->pWindow_state, input_Fs, input_frame );
-
+ ivas_lfe_window_init( hLFE->pWindow_state, input_Fs, input_frame );
/* Initialization for entropy coding */
hLFE->cum_freq_models[0][0] = ivas_str_lfe_freq_models.entropy_coder_model_fine_sg1;