diff --git a/Workspace_msvc/common.vcxproj b/Workspace_msvc/common.vcxproj
index 946a2e096d8ec277e0b20e441e788c0dc92a6d85..277f0d455169b234b2826120b4409ecd9944c8a5 100644
--- a/Workspace_msvc/common.vcxproj
+++ b/Workspace_msvc/common.vcxproj
@@ -169,6 +169,8 @@
+
+
@@ -231,6 +233,10 @@
+
+
+
+
diff --git a/Workspace_msvc/evs_dec.vcxproj b/Workspace_msvc/evs_dec.vcxproj
index 410ecd8d252bcc100724131045cdd890b3d04742..43baef8284588c0d1374c3ee5e99e9e251f09499 100644
--- a/Workspace_msvc/evs_dec.vcxproj
+++ b/Workspace_msvc/evs_dec.vcxproj
@@ -48,7 +48,7 @@
.\Debug_Dec\
false
false
- EVS_dec
+ IVAS_dec
..\
@@ -88,7 +88,7 @@
- ..\EVS_dec.exe
+ ..\IVAS_dec.exe
true
true
diff --git a/Workspace_msvc/evs_enc.vcxproj b/Workspace_msvc/evs_enc.vcxproj
index 7da24732f846abf975d0a69885025ca1c86e89a5..656b52d5673d0871baf93285c0b8c90b58f629b3 100644
--- a/Workspace_msvc/evs_enc.vcxproj
+++ b/Workspace_msvc/evs_enc.vcxproj
@@ -55,7 +55,7 @@
.\Debug_Enc\
false
false
- EVS_cod
+ IVAS_cod
@@ -140,7 +140,7 @@
- ..\EVS_cod.exe
+ ..\IVAS_cod.exe
true
false
diff --git a/lib_com/ACcontextMapping.c b/lib_com/ACcontextMapping.c
index 154618f6a3a5a8743ad987ee0226ffcf5ade3c22..9195b02c81da70126d5dd02abb9a57cec6500c4a 100644
--- a/lib_com/ACcontextMapping.c
+++ b/lib_com/ACcontextMapping.c
@@ -2,16 +2,12 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
-#include
-#include
-#include
+#include
#include "options.h"
#include "basop_util.h"
#include "cnst_fx.h"
#include "prot_fx.h"
#include "rom_com_fx.h"
-#include "stl.h"
/* Returns: index of next coefficient */
Word16 get_next_coeff_mapped(
diff --git a/lib_com/ari.c b/lib_com/ari.c
index edf6e473c1c234b4c281e5e68a8d4850e785f8aa..4d0eb662c6c6701d984a1176b454bcdd676e1df0 100644
--- a/lib_com/ari.c
+++ b/lib_com/ari.c
@@ -2,12 +2,12 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
+#include
#include "assert.h"
+#include "options.h"
#include "prot_fx.h"
#include "basop_mpy.h"
#include "cnst_fx.h"
-#include "stl.h"
/**
* \brief 31x16 Bit multiply (x*y)
diff --git a/lib_com/ari_hm.c b/lib_com/ari_hm.c
index 80f2d70c6e5c064a5f978777fddb94442720eeae..b2b464be555ec9f299ac52cee0bfa73b91fe72c2 100644
--- a/lib_com/ari_hm.c
+++ b/lib_com/ari_hm.c
@@ -3,11 +3,9 @@
====================================================================================*/
-#include
-#include
-#include
+#include
#include
-#include "stl.h"
+#include "options.h"
#include "cnst_fx.h"
#include "basop_util.h"
#include "rom_com_fx.h"
@@ -19,7 +17,8 @@ void UnmapIndex(
Word16 LtpPitchLag,
Word8 SmallerLags,
Word16 *FractionalResolution,
- Word32 *Lag)
+ Word32 *Lag
+)
{
Word16 LtpPitchIndex, Multiplier;
Word16 Lag16;
@@ -166,7 +165,8 @@ void ConfigureContextHm(
Word16 CountIndexBits(
Word16 Bandwidth,
- Word16 PeriodicityIndex)
+ Word16 PeriodicityIndex
+)
{
Word16 result;
Word16 PeriodicityIndexS;
diff --git a/lib_com/arith_coder.c b/lib_com/arith_coder.c
index 6c4739da2df8628997f6dbcbe92eeec2c2dae82a..97a945b61da7f27c61fcc5969d97b46222d1ca72 100644
--- a/lib_com/arith_coder.c
+++ b/lib_com/arith_coder.c
@@ -2,21 +2,17 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
-#include
-#include
+#include
#include
-
+#include "options.h"
#include "prot_fx.h"
#include "basop_util.h"
-#include "options.h"
#include "cnst_fx.h"
-#include "stl.h"
/* Fixed point implementation of exp(negate()) */
Word32 expfp( /* o: Q31 */
- Word16 x, /* i: mantissa Q-e */
- Word16 x_e) /* i: exponent Q0 */
+ const Word16 x, /* i: mantissa Q-e */
+ const Word16 x_e) /* i: exponent Q0 */
{
Word16 xi, xf, tmp;
Word16 b0, b1, b2, b3;
@@ -55,10 +51,22 @@ Word32 expfp( /* o: Q31 */
b2 = s_and(xi, 4);
b3 = s_and(xi, 8);
- if (b0 != 0) y = Mpy_32_16_1(y, 24109); /* exp(-1) in -1Q16 */
- if (b1 != 0) y = Mpy_32_16_1(y, 17739); /* exp(-2) in -2Q17 */
- if (b2 != 0) y = Mpy_32_16_1(y, 19205); /* exp(-4) in -5Q20 */
- if (b3 != 0) y = Mpy_32_16_1(y, 22513); /* exp(-8) in -11Q26 */
+ if (b0 != 0)
+ {
+ y = Mpy_32_16_1(y, 24109); /* exp(-1) in -1Q16 */
+ }
+ if (b1 != 0)
+ {
+ y = Mpy_32_16_1(y, 17739); /* exp(-2) in -2Q17 */
+ }
+ if (b2 != 0)
+ {
+ y = Mpy_32_16_1(y, 19205); /* exp(-4) in -5Q20 */
+ }
+ if (b3 != 0)
+ {
+ y = Mpy_32_16_1(y, 22513); /* exp(-8) in -11Q26 */
+ }
/* scaling: -1*b0 - 2*b1 -5*b2 -11*b3 */
y = L_shr(y, add(add(xi, shr(xi, 2)), shr(b3, 3)));
@@ -79,10 +87,12 @@ Word32 expfp( /* o: Q31 */
* *pout2 = ( (base/65536)^(2*exp + 1) ) * 65536
*
* NOTE: This function must be in sync with ari_decode_14bits_pow() */
-void powfp_odd2(Word16 base, /* Q15 */
- Word16 exp, /* Q0 */
- Word16 *pout1, /* Q15 */
- Word16 *pout2) /* Q15 */
+void powfp_odd2(
+ const Word16 base, /* Q15 */
+ const Word16 exp, /* Q0 */
+ Word16 *pout1, /* Q15 */
+ Word16 *pout2 /* Q15 */
+)
{
/* this version is in sync with ari_enc_14bits_pow()
* that is, we have to start multiplication from the largest power-of-two, in order to
@@ -168,11 +178,11 @@ void powfp_odd2(Word16 base, /* Q15 */
* and decoder remain synchronized.
*-------------------------------------------------------------------------*/
void tcx_arith_scale_envelope(
- Word16 L_spec_core, /* i: number of lines to scale Q0 */
+ const Word16 L_spec_core, /* i: number of lines to scale Q0 */
Word16 L_frame, /* i: number of lines Q0 */
- Word32 env[], /* i: unscaled envelope Q16 */
+ const Word32 env[], /* i: unscaled envelope Q16 */
Word16 target_bits, /* i: number of available bits Q0 */
- Word16 low_complexity, /* i: low-complexity flag Q0 */
+ const Word16 low_complexity,/* i: low-complexity flag Q0 */
Word16 s_env[], /* o: scaled envelope Q15-e */
Word16 *s_env_e /* o: scaled envelope exponent Q0 */
)
@@ -417,11 +427,11 @@ void tcx_arith_scale_envelope(
*-------------------------------------------------------------------------*/
void tcx_arith_render_envelope(
const Word16 A_ind[], /* i: LPC coefficients of signal envelope */
- Word16 L_frame, /* i: number of spectral lines */
- Word16 L_spec,
- Word16 preemph_fac, /* i: pre-emphasis factor */
- Word16 gamma_w, /* i: A_ind -> weighted envelope factor */
- Word16 gamma_uw, /* i: A_ind -> non-weighted envelope factor */
+ const Word16 L_frame, /* i: number of spectral lines */
+ const Word16 L_spec,
+ const Word16 preemph_fac, /* i: pre-emphasis factor */
+ const Word16 gamma_w, /* i: A_ind -> weighted envelope factor */
+ const Word16 gamma_uw, /* i: A_ind -> non-weighted envelope factor */
Word32 env[] /* o: shaped signal envelope */
)
{
@@ -434,12 +444,12 @@ void tcx_arith_render_envelope(
/* Compute perceptual LPC envelope, transform it into freq.-domain gains */
weight_a_fx( A_ind, tmpA, gamma_w, M );
- lpc2mdct( tmpA, M, NULL, NULL, gainlpc, gainlpc_e );
+ lpc2mdct( tmpA, M, NULL, NULL, gainlpc, gainlpc_e, FDNS_NPTS, 0);
/* Add pre-emphasis tilt to LPC envelope, transform LPC into MDCT gains */
E_LPC_a_weight_inv(A_ind, signal_env, gamma_uw, M);
E_LPC_a_add_tilt(signal_env, tmpA, preemph_fac, M);
- lpc2mdct(tmpA, M+1, signal_env, signal_env_e, NULL, NULL);
+ lpc2mdct(tmpA, M+1, signal_env, signal_env_e, NULL, NULL, FDNS_NPTS, 0);
/* Compute weighted signal envelope in perceptual domain */
FOR (k = 0; k < FDNS_NPTS; k++)
diff --git a/lib_com/bitalloc_fx.c b/lib_com/bitalloc_fx.c
index e875265f99d80e8261c59748cd0ff56ee64349c2..42c6dd3e44b80bb26202f084ab1cb60171926e28 100644
--- a/lib_com/bitalloc_fx.c
+++ b/lib_com/bitalloc_fx.c
@@ -2,12 +2,11 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "rom_com_fx.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h" /* required for wmc_tool */
void bitalloc_fx (
Word16 *y, /* i : reordered norm of sub-vectors Q0 */
@@ -16,8 +15,8 @@ void bitalloc_fx (
Word16 N, /* i : number of norms Q0 */
Word16 K, /* i : maximum number of bits per dimension Q0 */
Word16 *r, /* o : bit-allacation vector Q0 */
- const Word16 *sfmsize, /* i : band length Q0 */
- const Word16 hqswb_clas /* i : signal classification flag Q0 */
+ const Word16 *sfmsize, /* i : band length Q0 */
+ const Word16 hqswb_clas /* i : signal classification flag Q0 */
)
{
Word16 i, j, k, n, m, v, im;
@@ -101,7 +100,7 @@ void bitalloc_fx (
}
test();
- IF ( (LT_16(sum, WID_G1))||(EQ_16(diff,sum)))
+ IF ( (LT_16(sum, sfmsize[SFM_G1 - 1]))||(EQ_16(diff,sum))) /* sfmsize[SFM_G1-1] matches WID_G1, but also allows for extended BWs used in ACELP->HQ switching. */
{
BREAK;
}
@@ -127,7 +126,7 @@ void bitalloc_fx (
}
- IF ( GE_16(sum, WID_G2))
+ IF ( GE_16(sum, sfmsize[SFM_G1])) /* sfmsize[SFM_G1] matches WID_G2, but also allows for extended BWs used in ACELP->HQ switching. */
{
FOR (i=0; i<=N; i++)
{
@@ -139,8 +138,8 @@ void bitalloc_fx (
{
r[j] = 1;
move16();
- sum = sub(sum, WID_G2);
- IF (LT_16(sum, WID_G2))
+ sum = sub(sum, sfmsize[j]);
+ IF (LT_16(sum, sfmsize[SFM_G1]))
{
BREAK;
}
@@ -148,7 +147,7 @@ void bitalloc_fx (
}
}
- IF ( GE_16(sum, WID_G2))
+ IF ( GE_16(sum, sfmsize[SFM_G1]))
{
FOR (i=0; i<=N; i++)
{
@@ -160,8 +159,8 @@ void bitalloc_fx (
{
r[j] = 2;
move16();
- sum = sub(sum, WID_G2);
- IF ( LT_16(sum, WID_G2))
+ sum = sub(sum, sfmsize[j]);
+ IF ( LT_16(sum, sfmsize[SFM_G1]))
{
BREAK;
}
@@ -169,7 +168,7 @@ void bitalloc_fx (
}
}
- IF ( GE_16(sum, WID_G1))
+ IF ( GE_16(sum, sfmsize[SFM_G1-1]))
{
FOR (i=0; i<=N; i++)
{
@@ -180,8 +179,8 @@ void bitalloc_fx (
{
r[j] = 1;
move16();
- sum = sub(sum, WID_G1);
- IF ( LT_16(sum, WID_G1))
+ sum = sub(sum, sfmsize[j]);
+ IF ( LT_16(sum, sfmsize[SFM_G1-1]))
{
BREAK;
}
@@ -189,7 +188,7 @@ void bitalloc_fx (
}
}
- IF ( GE_16(sum, WID_G1))
+ IF ( GE_16(sum, sfmsize[SFM_G1-1]))
{
FOR (i=0; i<=N; i++)
{
@@ -200,8 +199,8 @@ void bitalloc_fx (
{
r[j] = 2;
move16();
- sum = sub(sum, WID_G1);
- IF ( LT_16(sum, WID_G1))
+ sum = sub(sum, sfmsize[j]);
+ IF ( LT_16(sum, sfmsize[SFM_G1-1]))
{
BREAK;
}
diff --git a/lib_com/bitallocsum_fx.c b/lib_com/bitallocsum_fx.c
index cb8cf09a15ef902c3f9f7e38a78cbd7d3a36f164..9860058330458a19f91e0c9c61453c13dc544bb6 100644
--- a/lib_com/bitallocsum_fx.c
+++ b/lib_com/bitallocsum_fx.c
@@ -1,11 +1,10 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h" /* Common constants */
/*--------------------------------------------------------------------------
* bitallocsum_fx()
@@ -14,12 +13,12 @@
*--------------------------------------------------------------------------*/
void bitallocsum_fx(
Word16 *R, /* i : bit-allocation vector Q0 */
- const Word16 nb_sfm, /* i : number of sub-vectors Q0 */
+ const Word16 nb_sfm, /* i : number of sub-vectors Q0 */
Word16 *sum, /* o : total number of bits allocated Q0 */
Word16 *Rsubband, /* o : rate per subband Q3 */
- const Word16 v, /* i : bit rate Q0 */
- const Word16 length, /* i : length of spectrum (32 or 48 kHz samplerate) Q0 */
- const Word16 *sfmsize /* i : band length Q0 */
+ const Word16 num_bits,/* i : number of bits Q0 */
+ const Word16 length, /* i : length of spectrum (32 or 48 kHz samplerate) Q0 */
+ const Word16 *sfmsize /* i : band length Q0 */
)
{
Word16 i;
@@ -39,7 +38,7 @@ void bitallocsum_fx(
IF ( LE_16(length, L_FRAME32k))
{
- diff = sub(v, *sum);
+ diff = sub(num_bits, *sum);
i = (Word16)0;
move16();
WHILE ( diff > 0 )
diff --git a/lib_com/bits_alloc.c b/lib_com/bits_alloc.c
index 69b71c6b49ee344f997da4b8af16d08268461463..02eb0f9af46a0b63677dfb7ebd6d8d4ed1c08866 100644
--- a/lib_com/bits_alloc.c
+++ b/lib_com/bits_alloc.c
@@ -1,16 +1,31 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include
#include
#include "options.h"
#include "prot_fx.h"
#include "basop_util.h"
-#include "stl.h"
-#include "options.h"
#include "rom_com_fx.h"
+#include "ivas_cnst.h"
+#include "ivas_rom_com.h"
+
+ /*-------------------------------------------------------------------*
+ * Local function prototypes
+ *--------------------------------------------------------------------*/
+static Word16 BITS_ALLOC_adjust_acelp_fixed_cdk(const Word16 bits_frame, Word16* fixed_cdk_index, const Word16 nb_subfr );
+static Word16 BITS_ALLOC_adjust_generic(const Word16 bits_frame, Word16* fixed_cdk_index, const Word16 nb_subfr, const Word16* pulseconfigbits, const Word16 pulseconfig_size);
+static Word16 allocate_unused(const Word32 core_brate, const Word16 coder_type, const Word16 unused_bits, const Word16 nb_prm, const Word16 subfr, const Word16 prm_type, Word16* prm_bit_mode);
+
+typedef enum
+{
+ GAINSPRM = 0x0,
+ PITCHPRM = 0x1,
+ MID_LSFSPRM = 0x3,
+ LSFPRM = 0x4
+} PRM_TYPES;
/*
* function BITS_ALLOC_init_config_acelp()
@@ -97,16 +112,16 @@ void BITS_ALLOC_init_config_acelp(
/*
* function BITS_ALLOC_config_acelp()
*
- * description: configure all acelp modes and allocate the bits
+ * description: configure all Mode 2 ACELP coder types and allocate the bits
*
* return: bit demand
*/
Word16 BITS_ALLOC_config_acelp(
- const Word16 bits_frame, /*i: remaining bit budget for the frame*/
- const Word16 coder_type, /*i: acelp coder type*/
- ACELP_config *pConfigAcelp, /*i/o: configuration structure of ACELP*/
- const Word16 narrowBand,
- const Word16 nb_subfr
+ const Word16 bits_frame, /* i: remaining bit budget for the frame*/
+ const Word16 coder_type, /* i: acelp coder type*/
+ ACELP_config *pConfigAcelp, /* i/o: configuration structure of ACELP*/
+ const Word16 narrowBand, /* i : narrowband flag */
+ const Word16 nb_subfr /* i : number of subframes */
)
{
Word16 mode_index;
@@ -288,8 +303,7 @@ Word16 BITS_ALLOC_config_acelp(
}
-static
-Word16 BITS_ALLOC_adjust_generic(
+static Word16 BITS_ALLOC_adjust_generic(
const Word16 bits_frame, /*i: bit budget*/
Word16 *fixed_cdk_index,
const Word16 nb_subfr,
@@ -367,7 +381,7 @@ Word16 BITS_ALLOC_adjust_generic(
return mult_r(bitsused, inb_subfr);
}
-Word16 BITS_ALLOC_adjust_acelp_fixed_cdk(
+static Word16 BITS_ALLOC_adjust_acelp_fixed_cdk(
const Word16 bits_frame, /*i: bit budget*/
Word16 *fixed_cdk_index,
const Word16 nb_subfr
@@ -382,3 +396,1233 @@ Word16 BITS_ALLOC_adjust_acelp_fixed_cdk(
return bitsused;
}
+/*#ifdef IVAS_CODE Below basop operators are missing */
+/*-------------------------------------------------------------------*
+ * fcb_table()
+ *
+ * Selection of fixed innovation codebook bitbudget table
+ *--------------------------------------------------------------------*/
+
+static Word16 fcb_table(
+ const Word16 n,
+ const Word16 L_subfr)
+{
+ Word16 out;
+ PMT("Not floating point computation, but fixed point operator are still missing ")
+
+ out = PulseConfTable[n].bits;
+ if (L_subfr > L_SUBFR)
+ {
+ out = fast_FCB_bits_2sfr[n];
+ }
+
+ return (out);
+}
+
+/*-------------------------------------------------------------------*
+ * acelp_FCB_allocator()
+ *
+ * Routine to allocate fixed innovation codebook bit-budget
+ *--------------------------------------------------------------------*/
+
+static ivas_error acelp_FCB_allocator(
+ Word16* nBits, /* i/o: available bit-budget */
+ Word16 fixed_cdk_index[], /* o : codebook index */
+ Word16 nb_subfr, /* i : number of subframes */
+ const Word16 L_subfr, /* i : subframe length */
+ const Word16 coder_type, /* i : coder type */
+ const Word16 tc_subfr, /* i : TC subframe index */
+ const Word16 fix_first /* i : flag to indicate whether the first subframe bit-budget was fixed */
+)
+{
+ Word16 cdbk, sfr, step;
+ Word16 nBits_tmp;
+ Word16* p_fixed_cdk_index;
+ Word16 max_n;
+ ivas_error error;
+ PMT("Not floating point computation, but fixed point operator are still missing ")
+
+ error = IVAS_ERR_OK;
+
+ cdbk = coder_type; /* just to avoid warning when DEBUGGING is deactivated */
+
+ p_fixed_cdk_index = fixed_cdk_index;
+
+ /* TRANSITION coding: first subframe bit-budget was already fixed, glottal pulse not in the first subframe */
+ if (tc_subfr >= L_SUBFR && fix_first)
+ {
+ Word16 i;
+
+ for (i = 0; i < nb_subfr; i++)
+ {
+ *nBits -= ACELP_FIXED_CDK_BITS(fixed_cdk_index[i]);
+ }
+ return error;
+ }
+
+ /* TRANSITION coding: first subframe bit-budget was already fixed, glottal pulse in the first subframe */
+ sfr = 0;
+ if (fix_first)
+ {
+ *nBits -= ACELP_FIXED_CDK_BITS(fixed_cdk_index[0]);
+ sfr = 1;
+ p_fixed_cdk_index++;
+ nb_subfr = 3;
+ }
+
+ /* distribute the bit-budget equally between subframes */
+ if (L_subfr > L_SUBFR) /* access fast_FCB_bits_2sfr */
+ {
+ max_n = 6;
+ }
+ else
+ {
+ max_n = ACELP_FIXED_CDK_NB;
+ }
+ for (cdbk = 0; cdbk < max_n; cdbk++)
+ {
+ if (fcb_table(cdbk, L_subfr) * nb_subfr > *nBits)
+ {
+ break;
+ }
+ }
+ cdbk--;
+
+#if defined DEBUGGING
+ if (cdbk < 0 && coder_type != TRANSITION)
+ {
+ return IVAS_ERROR(IVAS_ERR_INTERNAL_FATAL, "Error: Too low bit-budget for fixed innovation codebook (frame = %d). Exiting! \n", frame);
+ }
+ if ((L_subfr == L_SUBFR && cdbk >= ACELP_FIXED_CDK_NB) || (L_subfr == 2 * L_SUBFR && fcb_table(cdbk, L_subfr) == 128 /*stop value*/))
+ {
+ return IVAS_ERROR(IVAS_ERR_INTERNAL_FATAL, "Error: Too high bit-budget for fixed innovation codebook (frame = %d). Exiting! \n", frame);
+ }
+#endif
+
+ set16_fx(p_fixed_cdk_index, cdbk, nb_subfr);
+ nBits_tmp = 0;
+ if (cdbk >= 0)
+ {
+ nBits_tmp = fcb_table(cdbk, L_subfr);
+ }
+ else
+ {
+ nBits_tmp = 0;
+ }
+ *nBits -= nBits_tmp * nb_subfr;
+
+ /* try to increase the FCB bit-budget of the first subframe(s) */
+ if (cdbk < ACELP_FIXED_CDK_NB - 1)
+ {
+ step = fcb_table(cdbk + 1, L_subfr) - nBits_tmp;
+ while (*nBits >= step)
+ {
+ (*p_fixed_cdk_index)++;
+ *nBits -= step;
+ p_fixed_cdk_index++;
+ }
+
+ /* try to increase the FCB of the first subframe in cases when the next step is lower than the current step */
+ step = fcb_table(fixed_cdk_index[sfr] + 1, L_subfr) - fcb_table(fixed_cdk_index[sfr], L_subfr);
+ if (*nBits >= step && cdbk >= 0)
+ {
+ fixed_cdk_index[sfr]++;
+ *nBits -= step;
+
+ if (*nBits >= step && fixed_cdk_index[sfr + 1] == fixed_cdk_index[sfr] - 1)
+ {
+ sfr++;
+ fixed_cdk_index[sfr]++;
+ *nBits -= step;
+ }
+ }
+ }
+ /* TRANSITION coding: allocate highest FCBQ bit-budget to the subframe with the glottal-shape codebook */
+ if (tc_subfr >= L_SUBFR)
+ {
+ Word16 tempr;
+
+ SWAP(fixed_cdk_index[0], fixed_cdk_index[tc_subfr / L_SUBFR]);
+
+ /* TRANSITION coding: allocate second highest FCBQ bit-budget to the last subframe */
+ if (tc_subfr / L_SUBFR < nb_subfr - 1)
+ {
+ SWAP(fixed_cdk_index[(tc_subfr - L_SUBFR) / L_SUBFR], fixed_cdk_index[nb_subfr - 1]);
+ }
+ }
+
+ /* when subframe length > L_SUBFR, number of bits instead of codebook index is signalled */
+ if (L_subfr > L_SUBFR)
+ {
+ Word16 i, j;
+ for (i = 0; i < nb_subfr; i++)
+ {
+ j = fixed_cdk_index[i];
+ fixed_cdk_index[i] = fast_FCB_bits_2sfr[j];
+ }
+ }
+
+ return error;
+}
+
+
+/*-------------------------------------------------------------------*
+ * config_acelp1()
+ *
+ * Configure ACELP bit allocation
+ * - should be in range of <6700; 24350> for ACELP@12.8kHz
+ * - per channel bitrate minimum is 13250 kbps for ACELP@16kHz
+ *--------------------------------------------------------------------*/
+
+ivas_error config_acelp1(
+ const Word16 enc_dec, /* i : encoder/decoder flag */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word32 core_brate_inp, /* i : core bitrate */
+ const Word16 core, /* i : core */
+ const Word16 extl, /* i : extension layer */
+ const Word32 extl_brate, /* i : extension layer bitrate */
+ const Word16 L_frame, /* i : frame length at internal Fs */
+ const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */
+ ACELP_config* acelp_cfg, /* i : ACELP bit-allocation */
+ const Word16 signalling_bits, /* i : number of signalling bits */
+ const Word16 coder_type, /* i : coder type */
+ const Word16 tc_subfr, /* i : TC subfr ID */
+ const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */
+ Word16* nBits_es_Pred, /* o : number of bits for Es_pred Q */
+ Word16* unbits, /* o : number of unused bits */
+ const Word16 element_mode, /* i : element mode */
+ Word16* uc_two_stage_flag, /* o : flag undicating two-stage UC */
+ const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */
+ const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */
+ const Word16 idchan, /* i : stereo channel ID */
+ const Word16 active_cnt, /* i : Active frame counter */
+ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/
+ const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */
+ const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */
+)
+{
+ Word16 i, bits, nb_subfr;
+ Word16 flag_hardcoded, coder_type_sw, fix_first;
+ Word32 core_brate;
+#ifdef DEBUGGING
+ Word32 core_brate_inpI = core_brate_inp;
+#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING
+ MY_UNUSED_Word(active_cnt)
+#endif
+#endif
+ ivas_error error;
+
+ error = IVAS_ERR_OK;
+ PMT("Not floating point computation, but fixed point operator are still missing ")
+ /*-----------------------------------------------------------------*
+ * Set the flag indicating two-stage Unvoiced (UC) frame
+ *-----------------------------------------------------------------*/
+
+ *uc_two_stage_flag = 0;
+ if (coder_type == UNVOICED)
+ {
+ if (total_brate >= MIN_UNVOICED_TWO_STAGE_BRATE && element_mode > EVS_MONO && (idchan == 0 || ((total_brate >= 8500 || extl_brate == 0) && tdm_LRTD_flag == 1)))
+ {
+ *uc_two_stage_flag = 1;
+ }
+ }
+
+ /*-----------------------------------------------------------------*
+ * Set the number of subframes
+ *-----------------------------------------------------------------*/
+
+ if (L_frame == L_FRAME)
+ {
+ nb_subfr = NB_SUBFR;
+
+#if defined DEBUGGING
+ if (((core_brate_inp < 5900 && coder_type > UNVOICED) && !(core_brate_inp < MIN_TC_BRATE && coder_type == TRANSITION)) && !(idchan > 0 && element_mode == IVAS_CPE_TD) && !(element_mode == IVAS_SCE && tdm_low_rate_mode))
+ {
+ return IVAS_ERROR(IVAS_ERR_INTERNAL_FATAL, "Error: Too low bitrate (%d bps) for ACELP@12k8 in frame %d. Exiting!\n", core_brate_inpI, frame);
+ }
+
+ if (core_brate_inp > ACELP_12k8_HIGH_LIMIT && core == ACELP_CORE)
+ {
+ return IVAS_ERROR(IVAS_ERR_INTERNAL_FATAL, "Error: Too high bitrate (%d bps) for ACELP@12k8 in frame %d. Exiting!\n", core_brate_inpI, frame);
+ }
+#endif
+ }
+ else /* L_frame == L_FRAME16k */
+ {
+ nb_subfr = NB_SUBFR16k;
+
+#if defined DEBUGGING
+ if (core_brate_inp < ACELP_16k_LOW_LIMIT && core == ACELP_CORE)
+ {
+ return IVAS_ERROR(IVAS_ERR_INTERNAL_FATAL, "Error: Too low bitrate (%d bps) for ACELP@16k in frame %d. Exiting!\n", core_brate_inpI, frame);
+ }
+#endif
+ }
+
+ coder_type_sw = coder_type;
+ if (core != ACELP_CORE)
+ {
+ /* used in acelp_core_switch_enc() */
+ nb_subfr = 1;
+ if (L_frame == L_FRAME)
+ {
+ coder_type_sw = TRANSITION;
+ }
+ }
+
+ /*-----------------------------------------------------------------*
+ * Check if the core_brate is hard coded (to keep BE for mono core) or not
+ *-----------------------------------------------------------------*/
+
+ flag_hardcoded = 0;
+ i = 0;
+
+ while (i < SIZE_BRATE_INTERMED_TBL)
+ {
+ if (core_brate_inp == brate_intermed_tbl[i])
+ {
+ flag_hardcoded = 1;
+ break;
+ }
+
+ if (core_brate_inp < brate_intermed_tbl[i])
+ {
+ flag_hardcoded = 0;
+ break;
+ }
+
+ i++;
+ }
+
+ if (element_mode == IVAS_CPE_TD && coder_type == AUDIO &&
+ core_brate_inp <= STEREO_GSC_BIT_RATE_ALLOC && brate_intermed_tbl[i] == ACELP_9k60) /* Bit allocation should be mapped to 8 kb/s instead of 9.6 kb/s in this case */
+ {
+ i--;
+ }
+
+ core_brate = brate_intermed_tbl[i];
+
+ if (element_mode > EVS_MONO)
+ {
+ flag_hardcoded = 0; /* use automatic and flexible ACELP bit-budget allocation */
+ }
+
+ if (core != ACELP_CORE && element_mode == EVS_MONO) /* needed for mode1 core switching in EVS mono */
+ {
+ flag_hardcoded = 1;
+ }
+
+ /*-----------------------------------------------------------------*
+ * ACELP bit allocation
+ *-----------------------------------------------------------------*/
+
+ if (!(coder_type == TRANSITION && tc_subfr != -1) || enc_dec == DEC)
+ {
+ /* Set the bit-budget */
+ bits = (Word16)(core_brate_inp / FRAMES_PER_SEC);
+
+ if (coder_type == TRANSITION && enc_dec == DEC && tc_call == 1)
+ {
+ bits += *nBits_es_Pred; /* equalize for 4th signaling bit estimated at the encoder in TC_0_192 */
+ }
+
+ /* Subtract signalling bits */
+ if (enc_dec == DEC && idchan == 1 && element_mode > EVS_MONO)
+ {
+ bits -= TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS;
+
+ if (tdm_LRTD_flag == 1)
+ {
+ bits += STEREO_BITS_TCA;
+ }
+
+ /* subtract TBE/BWE flag */
+ if (extl_brate > 0 && (extl == WB_TBE || extl == SWB_TBE || extl == FB_TBE || extl == WB_BWE || extl == SWB_BWE || extl == FB_BWE))
+ {
+ bits--;
+ }
+ }
+ else
+ {
+ /* Subtract signalling bits */
+ bits -= signalling_bits;
+ }
+
+ if (extl_brate > 0 && (extl == WB_TBE || extl == SWB_TBE || extl == FB_TBE || extl == WB_BWE || extl == SWB_BWE || extl == FB_BWE))
+ {
+ /* extension layer signalling bit is counted in the extension layer bitbudget */
+ bits++;
+ }
+
+ /*-----------------------------------------------------------------*
+ * LSF Q bit-budget
+ *-----------------------------------------------------------------*/
+
+ if (!tdm_lp_reuse_flag || idchan == 0)
+ {
+ /* LSF Q bit-budget */
+ acelp_cfg->lsf_bits = LSF_bits_tbl[LSF_BIT_ALLOC_IDX_fx(core_brate, coder_type)];
+
+ if (!flag_hardcoded)
+ {
+ if (L_frame == L_FRAME)
+ {
+ if (element_mode == IVAS_SCE && tdm_low_rate_mode)
+ {
+ acelp_cfg->lsf_bits = LSF_bits_tbl[LSF_BIT_ALLOC_IDX_fx(core_brate, coder_type)];
+ }
+ else if ((total_brate < 7200 || coder_type == INACTIVE || coder_type == AUDIO) && idchan == 1)
+ {
+ /* TD stereo, secondary channel: do nothing */
+ acelp_cfg->lsf_bits = LSF_bits_tbl[LSF_BIT_ALLOC_IDX_fx(core_brate, coder_type)];
+ }
+ else if (element_mode > EVS_MONO && coder_type == AUDIO && brate_intermed_tbl[i] < ACELP_9k60)
+ {
+ /* primary channel: do nothing */
+ }
+ else if (element_mode > EVS_MONO && coder_type == AUDIO /*&& brate_intermed_tbl[i] >= ACELP_9k60*/)
+ {
+ acelp_cfg->lsf_bits = 42;
+ }
+ else if (total_brate <= 9600 || coder_type == UNVOICED)
+ {
+ acelp_cfg->lsf_bits = 31;
+ }
+ else if (total_brate <= 20000)
+ {
+ acelp_cfg->lsf_bits = 36;
+ }
+ else
+ {
+ acelp_cfg->lsf_bits = 41;
+ }
+ }
+ else /* L_frame == L_FRAME16k */
+ {
+ acelp_cfg->lsf_bits = 41;
+ }
+ }
+
+ bits -= acelp_cfg->lsf_bits;
+
+ /* mid-LSF Q bit-budget */
+ acelp_cfg->mid_lsf_bits = mid_LSF_bits_tbl[LSF_BIT_ALLOC_IDX_fx(core_brate, coder_type)];
+
+ if (element_mode > EVS_MONO && coder_type == AUDIO /*&& brate_intermed_tbl[i] < ACELP_9k60*/)
+ {
+ acelp_cfg->mid_lsf_bits = 5;
+ /* primary channel: do nothing */
+ }
+
+ bits -= acelp_cfg->mid_lsf_bits;
+ }
+#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+ else if (tdm_lp_reuse_flag == 1 && idchan == 1 && active_cnt != 1 )
+ {
+ bits -= TDM_IC_LSF_PRED_BITS;
+ }
+#endif
+ /* gain Q bit-budget - part 1 */
+ if ((coder_type != UNVOICED && coder_type != AUDIO && coder_type != INACTIVE && !(core_brate <= ACELP_8k00 && coder_type != TRANSITION)) || (coder_type == INACTIVE && total_brate > MAX_GSC_INACTIVE_BRATE))
+ {
+ *nBits_es_Pred = Es_pred_bits_tbl[BIT_ALLOC_IDX_fx(core_brate, coder_type, -1, -1)];
+ bits -= *nBits_es_Pred;
+ }
+ else if (*uc_two_stage_flag)
+ {
+ *nBits_es_Pred = 4;
+ bits -= *nBits_es_Pred;
+ }
+ }
+ else
+ {
+ bits = *unbits;
+ }
+
+ if (coder_type == TRANSITION && tc_call == 0)
+ {
+ *unbits = bits;
+ return error;
+ }
+
+ /*-----------------------------------------------------------------*
+ * Low-rate mode - bits are allocated in tdm_low_rate_enc()
+ *-----------------------------------------------------------------*/
+
+ if (element_mode == IVAS_SCE && tdm_low_rate_mode)
+ {
+ acelp_cfg->FEC_mode = 0;
+ acelp_cfg->ltf_mode = FULL_BAND;
+ *nBits_es_Pred = 0;
+ *unbits = 0;
+ acelp_cfg->ubits = 0;
+
+ return error;
+ }
+
+ /*-----------------------------------------------------------------*
+ * Supplementary information for FEC
+ *-----------------------------------------------------------------*/
+
+ acelp_cfg->FEC_mode = 0;
+ if (core_brate >= ACELP_11k60 && (idchan == 0 || element_mode == EVS_MONO))
+ {
+ acelp_cfg->FEC_mode = 1;
+
+ if (coder_type > UNVOICED && coder_type < AUDIO && coder_type != VOICED)
+ {
+ bits -= FEC_BITS_CLS;
+ }
+
+ if (coder_type != TRANSITION)
+ {
+ if (total_brate >= ACELP_16k40)
+ {
+ acelp_cfg->FEC_mode = 2;
+
+ if (coder_type > UNVOICED && coder_type < AUDIO)
+ {
+ bits -= FEC_BITS_ENR;
+ }
+ }
+
+ if (total_brate >= ACELP_32k)
+ {
+ acelp_cfg->FEC_mode = 3;
+
+ if (coder_type > UNVOICED && coder_type < AUDIO)
+ {
+ bits -= FEC_BITS_POS;
+ }
+ }
+ }
+ }
+
+ /*-----------------------------------------------------------------*
+ * LP filtering of the adaptive excitation
+ *-----------------------------------------------------------------*/
+
+ if (idchan > 0 && element_mode > EVS_MONO)
+ {
+ acelp_cfg->ltf_mode = FULL_BAND;
+ }
+ else if (coder_type == UNVOICED)
+ {
+ acelp_cfg->ltf_mode = FULL_BAND;
+ }
+ else if ((coder_type == GENERIC || coder_type == TRANSITION) && core_brate < ACELP_11k60)
+ {
+ acelp_cfg->ltf_mode = LOW_PASS;
+ }
+ else if (core_brate >= ACELP_11k60 && (coder_type != AUDIO && !(coder_type == INACTIVE && L_frame == L_FRAME)))
+ {
+ if (coder_type == INACTIVE && L_frame == L_FRAME16k && total_brate <= MAX_GSC_INACTIVE_BRATE) /* GSC Inactive @16kHz */
+ {
+ acelp_cfg->ltf_mode = FULL_BAND;
+ }
+ else
+ {
+ acelp_cfg->ltf_mode = NORMAL_OPERATION;
+ if (coder_type != TRANSITION)
+ {
+ bits -= nb_subfr;
+ }
+ }
+ }
+ else
+ {
+ acelp_cfg->ltf_mode = FULL_BAND;
+ }
+
+ /*-----------------------------------------------------------------*
+ * UC bit-budget
+ *-----------------------------------------------------------------*/
+
+ if (((coder_type == UNVOICED && !(*uc_two_stage_flag)) || (coder_type == INACTIVE && core_brate <= ACELP_9k60)) && (idchan == 0 || element_mode == EVS_MONO))
+ {
+ bits -= NBITS_NOISENESS; /* noiseness */
+ }
+ if (coder_type == UNVOICED && !(*uc_two_stage_flag))
+ {
+ bits -= (3 * NB_SUBFR); /* tilt factor */
+ }
+
+ /*-----------------------------------------------------------------*
+ * TC bit-budget
+ *-----------------------------------------------------------------*/
+
+ fix_first = 0;
+ if (coder_type == TRANSITION)
+ {
+ if (tc_call == 2)
+ {
+ fix_first = 1;
+ }
+
+ /* TC signalling */
+ if (L_frame == L_FRAME)
+ {
+ if (tc_subfr == TC_0_0)
+ {
+ if (enc_dec == ENC)
+ {
+ bits -= 1; /* TC signalling */
+ }
+
+ if (acelp_cfg->ltf_mode == NORMAL_OPERATION)
+ {
+ bits -= 3; /* LP filtering flag */
+ }
+ }
+ else if (tc_subfr == TC_0_64)
+ {
+ if (enc_dec == ENC)
+ {
+ bits -= 4; /* TC signalling */
+ }
+
+ if (acelp_cfg->ltf_mode == NORMAL_OPERATION)
+ {
+ bits -= 3; /* LP filtering flag */
+ }
+ }
+ else if (tc_subfr == TC_0_128)
+ {
+ if (enc_dec == ENC)
+ {
+ bits -= 4; /* TC signalling */
+ }
+
+ if (acelp_cfg->ltf_mode == NORMAL_OPERATION)
+ {
+ bits -= 2; /* LP filtering flag */
+ }
+ }
+ else if (tc_subfr == TC_0_192)
+ {
+ if (enc_dec == ENC)
+ {
+ bits -= 3; /* TC signalling */
+ }
+
+ if (acelp_cfg->ltf_mode == NORMAL_OPERATION)
+ {
+ bits -= 1; /* LP filtering flag */
+ }
+ }
+ else if (tc_subfr == L_SUBFR)
+ {
+ if (enc_dec == ENC)
+ {
+ bits -= 3; /* TC signalling */
+ }
+
+ if (acelp_cfg->ltf_mode == NORMAL_OPERATION)
+ {
+ bits -= (L_FRAME - tc_subfr - L_SUBFR) / L_SUBFR; /* LP filtering flag */
+ }
+ }
+ else
+ {
+ if (enc_dec == ENC)
+ {
+ bits -= 4; /* TC signalling */
+ }
+
+ if (acelp_cfg->ltf_mode == NORMAL_OPERATION)
+ {
+ bits -= (L_FRAME - tc_subfr - L_SUBFR) / L_SUBFR; /* LP filtering flag */
+ }
+ }
+ }
+ else /* L_frame == L_FRAME16k */
+ {
+ if (enc_dec == ENC)
+ {
+ if (tc_subfr <= 2 * L_SUBFR)
+ {
+ bits -= 2; /* TC signalling */
+ }
+ else
+ {
+ bits -= 3; /* TC signalling */
+ }
+ }
+
+ bits -= (L_FRAME16k - tc_subfr - L_SUBFR) / L_SUBFR; /* LP filtering flag */
+ }
+
+ /* glottal-shape codebook bits */
+ bits -= (3 + 6 + 1 + 3);
+ }
+
+ /*-----------------------------------------------------------------*
+ * pitch, innovation, gains bit-budget
+ *-----------------------------------------------------------------*/
+
+ acelp_cfg->fcb_mode = 0;
+
+ if (element_mode == IVAS_CPE_TD && tdm_low_rate_mode == 1 && coder_type != INACTIVE && coder_type != UNVOICED) /* GENERIC low rate mode for secondary channel */
+ {
+ set16_fx(acelp_cfg->pitch_bits, 0, NB_SUBFR16k);
+ set16_fx(acelp_cfg->gains_mode, 0, NB_SUBFR16k);
+
+ for (i = 0; i < 2; i++)
+ {
+ acelp_cfg->pitch_bits[i] = 0;
+ if (tdm_Pitch_reuse_flag == 0)
+ {
+ acelp_cfg->pitch_bits[i] = ACB_bits_tbl[BIT_ALLOC_IDX_fx(ACELP_7k20, GENERIC, 2 * i * L_SUBFR, TC_SUBFR2IDX_fx(tc_subfr))];
+ bits -= acelp_cfg->pitch_bits[i];
+ }
+ acelp_cfg->gains_mode[i] = gain_bits_tbl[BIT_ALLOC_IDX_fx(ACELP_7k20, GENERIC, i * L_SUBFR, TC_SUBFR2IDX_fx(tc_subfr))];
+ bits -= acelp_cfg->gains_mode[i];
+ }
+ acelp_cfg->fcb_mode = 1;
+
+#ifdef DEBUGGING
+ if (bits >= 55)
+ {
+ printf("too much bits -> %d, LPC = %d and pitch = %d\n", bits, tdm_lp_reuse_flag, tdm_Pitch_reuse_flag);
+ acelp_FCB_allocator(&bits, acelp_cfg->fixed_cdk_index, 2, 2 * L_SUBFR, GENERIC, -1, 0);
+ }
+ else
+#endif
+ if (bits >= 16)
+ {
+ acelp_FCB_allocator(&bits, acelp_cfg->fixed_cdk_index, 2, 2 * L_SUBFR, GENERIC, -1, 0);
+ }
+ else
+ {
+ acelp_FCB_allocator(&bits, acelp_cfg->fixed_cdk_index, 2, 2 * L_SUBFR, GENERIC, -1, 0);
+ acelp_cfg->fixed_cdk_index[1] = -1;
+ }
+ acelp_cfg->fixed_cdk_index[2] = -1;
+ acelp_cfg->fixed_cdk_index[3] = -1;
+ }
+ else if ((coder_type != INACTIVE && nb_subfr == NB_SUBFR && coder_type != AUDIO) || (nb_subfr == NB_SUBFR16k && (total_brate > MAX_GSC_INACTIVE_BRATE || coder_type != INACTIVE)) || core == HQ_CORE)
+ {
+ /* pitch Q & gain Q bit-budget - part 2*/
+ for (i = 0; i < nb_subfr; i++)
+ {
+ if (L_frame == L_FRAME)
+ {
+ if (tdm_Pitch_reuse_flag == 1 && idchan == 1)
+ {
+ acelp_cfg->pitch_bits[i] = 0;
+ }
+ else
+ {
+ acelp_cfg->pitch_bits[i] = ACB_bits_tbl[BIT_ALLOC_IDX_fx(core_brate, coder_type, i * L_SUBFR, TC_SUBFR2IDX_fx(tc_subfr))];
+ }
+ acelp_cfg->gains_mode[i] = gain_bits_tbl[BIT_ALLOC_IDX_fx(core_brate, coder_type_sw, i * L_SUBFR, TC_SUBFR2IDX_fx(tc_subfr))];
+ }
+ else /* L_frame == L_FRAME16k */
+ {
+ if (tdm_Pitch_reuse_flag == 1 && idchan == 1)
+ {
+ acelp_cfg->pitch_bits[i] = 0;
+ }
+ else
+ {
+ acelp_cfg->pitch_bits[i] = ACB_bits_16kHz_tbl[BIT_ALLOC_IDX_16KHZ_fx(core_brate, coder_type, i * L_SUBFR, TC_SUBFR2IDX_16KHZ_fx(tc_subfr))];
+ }
+ acelp_cfg->gains_mode[i] = gain_bits_16kHz_tbl[BIT_ALLOC_IDX_16KHZ_fx(core_brate, coder_type_sw, i * L_SUBFR, TC_SUBFR2IDX_16KHZ_fx(tc_subfr))];
+ }
+
+ bits -= acelp_cfg->pitch_bits[i];
+
+ if (coder_type == INACTIVE && acelp_cfg->gains_mode[i] == 6 /* VQ vs. SQ threshold @32 kbps */)
+ {
+ bits -= 5;
+ }
+ else
+ {
+ if (*uc_two_stage_flag == 1)
+ {
+ acelp_cfg->gains_mode[i] = 7;
+ }
+
+ bits -= acelp_cfg->gains_mode[i];
+ }
+ }
+
+ /* algebraic codebook bit-budget */
+ if (flag_hardcoded || (core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE) || (total_brate > MAX_GSC_INACTIVE_BRATE && coder_type == INACTIVE))
+ {
+ for (i = 0; i < nb_subfr; i++)
+ {
+ if (L_frame == L_FRAME)
+ {
+ acelp_cfg->fixed_cdk_index[i] = FCB_bits_tbl[BIT_ALLOC_IDX_fx(core_brate, coder_type, i * L_SUBFR, TC_SUBFR2IDX_fx(tc_subfr))];
+ }
+ else /* L_frame == L_FRAME16k */
+ {
+ acelp_cfg->fixed_cdk_index[i] = FCB_bits_16kHz_tbl[BIT_ALLOC_IDX_16KHZ_fx(core_brate, coder_type, i * L_SUBFR, TC_SUBFR2IDX_16KHZ_fx(tc_subfr))];
+ }
+ bits -= acelp_cfg->fixed_cdk_index[i];
+ }
+ }
+ else if (!(coder_type == UNVOICED && tdm_low_rate_mode == 1 && element_mode == IVAS_CPE_TD))
+ {
+ if (coder_type == UNVOICED && !(*uc_two_stage_flag))
+ {
+ i = bits / NB_SUBFR;
+ if (i % 2 == 0)
+ {
+ i--; /* must be odd */
+ }
+ i = s_min(i, 13);
+#ifdef DEBUG_MODE_TD
+ if (i < 0)
+ IVAS_ERROR(IVAS_ERR_INTERNAL, "ERROR::: UC negative index should not happen at frame %d\n", frame);
+#endif
+ i = s_max(i, 0); /* If i == 0-> random noise generator will be used as FCB */
+ set16_fx(acelp_cfg->fixed_cdk_index, i, NB_SUBFR);
+ bits -= (i * NB_SUBFR);
+ }
+ else
+ {
+
+ acelp_cfg->fcb_mode = 1;
+ if (element_mode == IVAS_CPE_TD)
+ {
+ if (bits >= ACELP_FIXED_CDK_BITS(0) * (nb_subfr)) /* enough bits for all fcb */
+ {
+ acelp_FCB_allocator(&bits, acelp_cfg->fixed_cdk_index, nb_subfr, L_SUBFR, coder_type, tc_subfr, fix_first);
+ }
+ else if (bits >= ACELP_FIXED_CDK_BITS(0) * (nb_subfr - 1))
+ {
+ acelp_FCB_allocator(&bits, acelp_cfg->fixed_cdk_index, nb_subfr - 1, L_SUBFR, coder_type, tc_subfr, fix_first);
+ acelp_cfg->fixed_cdk_index[3] = -1;
+ }
+ else if (bits >= ACELP_FIXED_CDK_BITS(0) * (nb_subfr - 2))
+ {
+ acelp_FCB_allocator(&bits, acelp_cfg->fixed_cdk_index, nb_subfr - 2, L_SUBFR, coder_type, tc_subfr, fix_first);
+ acelp_cfg->fixed_cdk_index[2] = acelp_cfg->fixed_cdk_index[1];
+ acelp_cfg->fixed_cdk_index[1] = -1;
+ acelp_cfg->fixed_cdk_index[3] = -1;
+ }
+ else if (bits >= ACELP_FIXED_CDK_BITS(0))
+ {
+ acelp_FCB_allocator(&bits, acelp_cfg->fixed_cdk_index, 1, L_SUBFR, coder_type, tc_subfr, fix_first);
+ acelp_cfg->fixed_cdk_index[1] = acelp_cfg->fixed_cdk_index[0];
+ acelp_cfg->fixed_cdk_index[0] = -1;
+ acelp_cfg->fixed_cdk_index[2] = -1;
+ acelp_cfg->fixed_cdk_index[3] = -1;
+ }
+ else /* No FCB */
+ {
+#if defined DEBUGGING
+ IVAS_ERROR(IVAS_ERR_INTERNAL, "WARNING!!!, No bit allocated to FCB, check frame %d\n", frame);
+#endif
+ acelp_cfg->fixed_cdk_index[0] = -1;
+ acelp_cfg->fixed_cdk_index[1] = -1;
+ acelp_cfg->fixed_cdk_index[2] = -1;
+ acelp_cfg->fixed_cdk_index[3] = -1;
+ }
+ }
+ else if (element_mode != IVAS_CPE_TD && GSC_IVAS_mode > 0 && L_frame == L_FRAME16k)
+ {
+ bits = 100; /* 9 kbps for fcb */
+ acelp_FCB_allocator(&bits, acelp_cfg->fixed_cdk_index, nb_subfr, L_SUBFR, coder_type, tc_subfr, fix_first);
+ }
+ else
+ {
+ acelp_FCB_allocator(&bits, acelp_cfg->fixed_cdk_index, nb_subfr, L_SUBFR, coder_type, tc_subfr, fix_first);
+ }
+ }
+ }
+
+ /* AVQ codebook */
+ if ((core_brate_inp >= MIN_BRATE_AVQ_EXC && coder_type != INACTIVE) || (total_brate > MAX_GSC_INACTIVE_BRATE && coder_type == INACTIVE))
+ {
+ for (i = 0; i < nb_subfr; i++)
+ {
+ if (flag_hardcoded)
+ {
+ acelp_cfg->AVQ_cdk_bits[i] = AVQ_bits_16kHz_tbl[BIT_ALLOC_IDX_16KHZ_fx(core_brate, coder_type, i * L_SUBFR, TC_SUBFR2IDX_16KHZ_fx(tc_subfr))];
+ {
+ bits -= acelp_cfg->AVQ_cdk_bits[i];
+ }
+ }
+
+ bits -= G_AVQ_BITS;
+ }
+
+ if (core_brate_inp >= MIN_BRATE_AVQ_EXC && core_brate_inp <= MAX_BRATE_AVQ_EXC_TD && coder_type == GENERIC)
+ {
+ /* harm. flag ACELP AVQ */
+ bits--;
+ }
+
+ if (!flag_hardcoded)
+ {
+ Word16 bit_tmp;
+
+ bit_tmp = bits / nb_subfr;
+ set16_fx(acelp_cfg->AVQ_cdk_bits, bit_tmp, nb_subfr);
+ bits -= bit_tmp * nb_subfr;
+
+ bit_tmp = bits % nb_subfr;
+ acelp_cfg->AVQ_cdk_bits[0] += bit_tmp;
+ bits -= bit_tmp;
+ }
+ }
+ }
+ else if ((coder_type == UNVOICED && tdm_low_rate_mode == 1 && element_mode == IVAS_CPE_TD) || ((coder_type == INACTIVE || coder_type == AUDIO) && nb_subfr == NB_SUBFR) || (coder_type == INACTIVE && total_brate <= MAX_GSC_INACTIVE_BRATE))
+ {
+ Word32 Local_BR, Pitch_BR;
+ Word16 Pitch_CT;
+
+ /* as defined at the beginning of [enc,dec]_pit_exc() */
+ if (GSC_IVAS_mode > 0 && (GSC_noisy_speech || core_brate > GSC_H_RATE_STG))
+ {
+ Local_BR = ACELP_8k00;
+ Pitch_CT = GENERIC;
+ Pitch_BR = ACELP_8k00;
+ if (L_frame == L_FRAME16k)
+ {
+ Local_BR = ACELP_14k80;
+ if (GSC_IVAS_mode > 0 && core_brate < IVAS_24k4)
+ {
+ Local_BR = ACELP_9k60;
+ }
+ Pitch_BR = core_brate;
+ }
+ }
+ else if (GSC_noisy_speech)
+ {
+ Local_BR = ACELP_7k20;
+ Pitch_CT = GENERIC;
+ Pitch_BR = ACELP_7k20;
+ if (L_frame == L_FRAME16k)
+ {
+ Pitch_BR = core_brate;
+ }
+ }
+ else
+ {
+ Local_BR = ACELP_7k20;
+ Pitch_CT = AUDIO;
+ Pitch_BR = core_brate;
+
+ if (L_frame == L_FRAME16k)
+ {
+ Local_BR = ACELP_13k20;
+ Pitch_CT = GENERIC;
+ }
+ }
+
+ for (i = 0; i < nb_subfr; i++)
+ {
+ if (L_frame == L_FRAME16k)
+ {
+ acelp_cfg->pitch_bits[i] = ACB_bits_16kHz_tbl[BIT_ALLOC_IDX_16KHZ_fx(Pitch_BR, Pitch_CT, i * L_SUBFR, 0)];
+ acelp_cfg->fixed_cdk_index[i] = FCB_bits_tbl[BIT_ALLOC_IDX_fx(Local_BR, LOCAL_CT, i * L_SUBFR, 0)];
+ }
+ else
+ {
+ acelp_cfg->pitch_bits[i] = ACB_bits_tbl[BIT_ALLOC_IDX_fx(Pitch_BR, Pitch_CT, i * L_SUBFR, 0)];
+ acelp_cfg->fixed_cdk_index[i] = FCB_bits_tbl[BIT_ALLOC_IDX_fx(Local_BR, LOCAL_CT, i * L_SUBFR, 0)];
+ acelp_cfg->gains_mode[i] = gain_bits_tbl[BIT_ALLOC_IDX_fx(ACELP_7k20, LOCAL_CT, i * L_SUBFR, 0)];
+ }
+ }
+ }
+
+ if (coder_type == TRANSITION && (tc_call == 1 && tc_subfr == 0 && L_frame == L_FRAME))
+ {
+ return error;
+ }
+
+ /*-----------------------------------------------------------------*
+ * unused bits handling
+ *-----------------------------------------------------------------*/
+
+ acelp_cfg->ubits = 0; /* these bits could be reused for something else */
+
+ if (flag_hardcoded && core_brate != PPP_NELP_2k80)
+ {
+ /* unused bits */
+ if (coder_type == AUDIO || (coder_type == INACTIVE && core_brate <= ACELP_24k40))
+ {
+ acelp_cfg->ubits = 0;
+ }
+ else if (L_frame == L_FRAME)
+ {
+ acelp_cfg->ubits = reserved_bits_tbl[BIT_ALLOC_IDX_fx(core_brate, coder_type, -1, TC_SUBFR2IDX_fx(tc_subfr))];
+ }
+ else
+ {
+ acelp_cfg->ubits = 0;
+ }
+
+ bits -= acelp_cfg->ubits;
+ }
+
+ /* sanity check */
+ if ((coder_type != INACTIVE && nb_subfr == NB_SUBFR && coder_type != AUDIO) || nb_subfr == NB_SUBFR16k)
+ {
+ if ((L_frame == L_FRAME16k && coder_type == INACTIVE && total_brate <= MAX_GSC_INACTIVE_BRATE) || (GSC_IVAS_mode > 0 && L_frame == L_FRAME16k)) /* GSC Inactive @16kHz */
+ {
+ acelp_cfg->ubits = 0;
+ }
+ else if (flag_hardcoded && core == ACELP_CORE && bits != 0)
+ {
+#if defined DEBUGGING
+ IVAS_ERROR(IVAS_ERR_INTERNAL, "ERROR: bit-budget incorrect (%d bits) in frame %d.\n", (Word32)bits, frame);
+#endif
+ }
+ else if (bits > 0 && !(coder_type == UNVOICED && tdm_low_rate_mode == 1 && element_mode == IVAS_CPE_TD))
+ {
+ if (idchan > 0 && element_mode == IVAS_CPE_TD)
+ {
+#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+ if (!tdm_lp_reuse_flag)
+ {
+ acelp_cfg->lsf_bits += bits; /* increase LSF Q bits */
+ bits = 0;
+ }
+ else
+ {
+ Word16 nb_prm = 4;
+ if (tdm_low_rate_mode == 1)
+ {
+ nb_prm = 2;
+ }
+ /* First add remaining bits on gains */
+ bits -= allocate_unused(core_brate, coder_type, bits, nb_prm, 0, GAINSPRM, acelp_cfg->gains_mode);
+
+ /* Then, Increase pitch bit budget */
+ if (tdm_Pitch_reuse_flag == 0 && bits > 0)
+ {
+ bits -= allocate_unused(core_brate, coder_type, bits, nb_prm, 0, PITCHPRM, acelp_cfg->pitch_bits);
+ }
+
+ /* Increase mid-lsf bit budget */
+ if (tdm_lp_reuse_flag == 0 && bits > 0)
+ {
+ bits -= allocate_unused(core_brate, coder_type, bits, 1, 0, MID_LSFSPRM, &acelp_cfg->mid_lsf_bits);
+ bits -= allocate_unused(core_brate, coder_type, bits, 1, 0, LSFPRM, &acelp_cfg->lsf_bits);
+ }
+ }
+#else
+ Word16 nb_prm = 4;
+
+ if (tdm_low_rate_mode == 1)
+ {
+ nb_prm = 2;
+ }
+
+ /* First add remaining bits on gains */
+ if (!(*uc_two_stage_flag))
+ {
+ bits -= allocate_unused(core_brate, coder_type, bits, nb_prm, 0, GAINSPRM, acelp_cfg->gains_mode);
+ }
+
+ /* Then, Increase pitch bit budget */
+ if (tdm_Pitch_reuse_flag == 0 && bits > 0)
+ {
+ bits -= allocate_unused(core_brate, coder_type, bits, nb_prm, 0, PITCHPRM, acelp_cfg->pitch_bits);
+ }
+
+ /* Increase mid-lsf bit budget */
+ if (tdm_lp_reuse_flag == 0 && bits > 0)
+ {
+ bits -= allocate_unused(core_brate, coder_type, bits, 1, 0, MID_LSFSPRM, &acelp_cfg->mid_lsf_bits);
+ bits -= allocate_unused(core_brate, coder_type, bits, 1, 0, LSFPRM, &acelp_cfg->lsf_bits);
+ }
+#endif
+#if defined DEBUGGING
+ if (idchan > 0 && bits > 0 && (coder_type > UNVOICED || tdm_low_rate_mode == 0))
+ {
+ IVAS_ERROR(IVAS_ERR_INTERNAL, "WARNING !! Unused bits in secondary channel at frame %d\n", frame);
+ }
+#endif
+ }
+
+ else if (core == ACELP_CORE && coder_type >= UNVOICED && coder_type <= GENERIC && L_frame == L_FRAME)
+ {
+ acelp_cfg->lsf_bits += bits; /* increase LSF Q bits */
+
+ if (acelp_cfg->lsf_bits > 46)
+ {
+ acelp_cfg->ubits = acelp_cfg->lsf_bits - 46;
+ acelp_cfg->lsf_bits = 46;
+ }
+ else if (acelp_cfg->lsf_bits > 42 && L_frame == L_FRAME)
+ {
+ acelp_cfg->ubits = acelp_cfg->lsf_bits - 42;
+ acelp_cfg->lsf_bits = 42;
+ }
+ }
+ else
+ {
+ acelp_cfg->ubits = bits;
+ }
+ }
+ else if (bits < 0 && !(coder_type == UNVOICED && tdm_low_rate_mode == 1 && element_mode == IVAS_CPE_TD))
+ {
+#if defined DEBUGGING
+ IVAS_ERROR(IVAS_ERR_INTERNAL, "ERROR: bit-budget incorrect (%d bits) in frame %d.\n", (Word32)bits, frame);
+#endif
+ }
+ }
+
+ return error;
+}
+
+/*-------------------------------------------------------------------*
+ * allocate_unused()
+ *
+ * Allocate unused bits
+ *--------------------------------------------------------------------*/
+
+static Word16 allocate_unused(
+ const Word32 core_brate,
+ const Word16 coder_type,
+ const Word16 unused_bits,
+ const Word16 nb_prm,
+ const Word16 subfr,
+ const Word16 prm_type,
+ Word16* prm_bit_mode)
+{
+ Word16 max_bit_per_pos = 0, bit_added = 0;
+ PMT("Not floating point computation, but fixed point operator are still missing ")
+
+ if (prm_type == GAINSPRM)
+ {
+ max_bit_per_pos = 6;
+ if (core_brate > ACELP_8k00)
+ {
+ max_bit_per_pos = 7;
+ }
+ else if (coder_type != UNVOICED)
+ {
+ if (subfr >= 1)
+ {
+ max_bit_per_pos = 7;
+ }
+ else if (subfr == 0)
+ {
+ max_bit_per_pos = 8;
+ }
+ }
+ else if (coder_type == UNVOICED)
+ {
+ max_bit_per_pos = 9; /* No real limit on UC gain bit budget of the secondary channel */
+ }
+ }
+ else if (prm_type == PITCHPRM)
+ {
+ max_bit_per_pos = 6;
+ if (subfr == 0 || subfr == 2 || nb_prm == 2)
+ {
+ max_bit_per_pos = 10;
+ }
+
+ if (coder_type == UNVOICED)
+ {
+ max_bit_per_pos = 0; /* Should not allocate bits in case of unvoiced coder type */
+ }
+ }
+ else if (prm_type == MID_LSFSPRM)
+ {
+ max_bit_per_pos = 5;
+ }
+ else if (prm_type == LSFPRM)
+ {
+ max_bit_per_pos = 42;
+ }
+ else
+ {
+#ifdef DEBUG_MODE_TD
+ IVAS_ERROR(IVAS_ERR_WRONG_MODE, "unknown mode in bit_alloc.c");
+#endif
+ }
+
+ max_bit_per_pos = s_min(unused_bits, max_bit_per_pos - prm_bit_mode[subfr]);
+ if (max_bit_per_pos < 0)
+ {
+ return 0;
+ }
+ else if (max_bit_per_pos >= 0 && subfr == (nb_prm - 1))
+ {
+ prm_bit_mode[subfr] += max_bit_per_pos;
+ }
+ else
+ {
+ prm_bit_mode[subfr] += max_bit_per_pos;
+ bit_added += allocate_unused(core_brate, coder_type, unused_bits - max_bit_per_pos, nb_prm, subfr + 1, prm_type, &prm_bit_mode[0]);
+ }
+
+ return bit_added + max_bit_per_pos;
+}
+
+
+/*-------------------------------------------------------------------*
+ * set_ACELP_flag()
+ *
+ * set ACELP@16kHz flag
+ *--------------------------------------------------------------------*/
+
+ /*! r: ACELP16k flag */
+Word16 set_ACELP_flag(
+ const Word16 element_mode, /* i : element mode */
+ const Word32 element_brate, /* i : element bitrate */
+ const Word32 total_brate, /* i : total bitrate per channel */
+ const Word16 idchan, /* i : Channel id */
+ const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 cng_type /* i : CNG type */
+)
+{
+ PMT("Not floating point computation, but fixed point operator are still missing ")
+ if (element_mode == IVAS_CPE_DFT && idchan == 0 && total_brate <= SID_2k40 && bwidth == WB && cng_type == LP_CNG)
+ {
+
+ return 1;
+ }
+ else if (element_mode == IVAS_CPE_TD)
+ {
+ if (element_brate >= IVAS_24k4 && idchan == 0 && (tdm_LRTD_flag == 0 || element_brate > IVAS_24k4))
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else if (element_mode == IVAS_CPE_DFT)
+ {
+ if (element_brate >= IVAS_24k4)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else if (element_mode == IVAS_SCE)
+ {
+ if (element_brate >= SCE_CORE_16k_LOW_LIMIT)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else if (total_brate >= ACELP_16k_LOW_LIMIT) /* EVS_MONO */
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+/*#endif IVAS_CODE*/
\ No newline at end of file
diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c
index c734eb4ceac70c80e02ddcbe1a558e8068dc2fdb..56c3c43c0978bcd160bf3be9323fcba1a6a278cd 100644
--- a/lib_com/bitstream_fx.c
+++ b/lib_com/bitstream_fx.c
@@ -4,21 +4,24 @@
#include
#include
-#include "stl.h"
+#include "options.h"
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
-#include "options.h"
#include "basop_util.h"
#include "rom_com_fx.h"
#include "mime.h"
+//#include "ivas_prot.h"
+#include "ivas_cnst.h"
+#include "ivas_rom_com.h"
#ifdef DEBUGGING
/*-------------------------------------------------------------------*
* Global variables
*--------------------------------------------------------------------*/
int16_t FEC_seed = 12558; /* Seed for random FEC generator */
-float FEC_random = 0; /* FEC rate in percent (for simulation of FEC) */
FILE* FEC_pattern = NULL; /* FEC pattern file (for simulation of FEC) */
+#ifndef IVAS_CODE
+float FEC_random = 0; /* FEC rate in percent (for simulation of FEC) */
/*-------------------------------------------------------------------*
* file_read_FECpattern()
*
@@ -74,6 +77,7 @@ static int16_t file_read_FECpattern(void)
return bfi;
}
#endif
+#endif
/*-------------------------------------------------------------------*
* pack_bit()
*
@@ -131,10 +135,10 @@ static Word16 unpack_bit(
* lookup AMRWB IO mode
*-------------------------------------------------------------------*/
static Word16 rate2AMRWB_IOmode(
- Word32 rate /* i: bit rate */
+ Word32 brate /* i: bitrate */
)
{
- switch ( rate )
+ switch ( brate )
{
/* EVS AMR-WB IO modes */
case SID_1k75 :
@@ -158,8 +162,9 @@ static Word16 rate2AMRWB_IOmode(
case ACELP_23k85 :
return AMRWB_IO_2385;
default:
- return -1;
+ break;
}
+ return -1;
}
/*-------------------------------------------------------------------*
@@ -167,11 +172,16 @@ static Word16 rate2AMRWB_IOmode(
*
* lookup EVS mode
*-------------------------------------------------------------------*/
-static Word16 rate2EVSmode(
- Word32 rate /* i: bit rate */
+Word16 rate2EVSmode(
+ Word32 brate, /* i: bitrate */
+ Word16* is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */
)
{
- switch ( rate )
+ if (is_amr_wb != NULL)
+ {
+ *is_amr_wb = 0;
+ }
+ switch ( brate )
{
/* EVS Primary modes */
case FRAME_NO_DATA :
@@ -202,9 +212,14 @@ static Word16 rate2EVSmode(
return PRIMARY_96000;
case HQ_128k :
return PRIMARY_128000;
- default :
- return rate2AMRWB_IOmode(rate);
+ default :
+ break;
}
+ if (is_amr_wb != NULL)
+ {
+ *is_amr_wb = 1;
+ }
+ return rate2AMRWB_IOmode(brate);
}
/*-------------------------------------------------------------------*
@@ -214,7 +229,7 @@ static Word16 rate2EVSmode(
*-------------------------------------------------------------------*/
void push_indice_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr , /* i/o: encoder state structure */
Word16 id, /* i : ID of the indice */
UWord16 value, /* i : value of the quantized indice */
Word16 nb_bits /* i : number of bits used to quantize the indice */
@@ -223,33 +238,33 @@ void push_indice_fx(
Word16 i;
- IF ( EQ_16(st_fx->last_ind_fx, id))
+ IF ( EQ_16(hBstr->last_ind_fx, id))
{
/* indice with the same name as the previous one */
- i = st_fx->next_ind_fx;
+ i = hBstr->next_ind_fx;
}
ELSE
{
/* new indice - find an empty slot in the list */
i = id;
move16();
- WHILE (NE_16(st_fx->ind_list_fx[i].nb_bits, -1))
+ WHILE (NE_16(hBstr->ind_list_fx[i].nb_bits, -1))
{
i = add(i, 1);
}
}
/* store the values in the list */
- st_fx->ind_list_fx[i].value = value;
+ hBstr->ind_list_fx[i].value = value;
move16();
- st_fx->ind_list_fx[i].nb_bits = nb_bits;
+ hBstr->ind_list_fx[i].nb_bits = nb_bits;
move16();
/* updates */
- st_fx->next_ind_fx = add(i, 1);
- st_fx->last_ind_fx = id;
+ hBstr->next_ind_fx = add(i, 1);
+ hBstr->last_ind_fx = id;
move16();
- st_fx->nb_bits_tot_fx = add(st_fx->nb_bits_tot_fx, nb_bits);
+ hBstr->nb_bits_tot_fx = add(hBstr->nb_bits_tot_fx, nb_bits);
return;
}
@@ -260,22 +275,22 @@ void push_indice_fx(
*-------------------------------------------------------------------*/
void push_next_indice_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */
UWord16 value, /* i : value of the quantized indice */
Word16 nb_bits /* i : number of bits used to quantize the indice */
)
{
/* store the values in the list */
- st_fx->ind_list_fx[st_fx->next_ind_fx].value = value;
+ hBstr->ind_list_fx[hBstr->next_ind_fx].value = value;
move16();
- st_fx->ind_list_fx[st_fx->next_ind_fx].nb_bits = nb_bits;
+ hBstr->ind_list_fx[hBstr->next_ind_fx].nb_bits = nb_bits;
move16();
- st_fx->next_ind_fx = add(st_fx->next_ind_fx, 1);
+ hBstr->next_ind_fx = add(hBstr->next_ind_fx, 1);
/* update the total number of bits already written */
- st_fx->nb_bits_tot_fx = add(st_fx->nb_bits_tot_fx, nb_bits);
+ hBstr->nb_bits_tot_fx = add(hBstr->nb_bits_tot_fx, nb_bits);
return;
}
@@ -287,7 +302,7 @@ void push_next_indice_fx(
*-------------------------------------------------------------------*/
void push_next_bits_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */
Word16 bits[], /* i : bit buffer to pack, sequence of single bits */
Word16 nb_bits /* i : number of bits to pack */
)
@@ -296,7 +311,7 @@ void push_next_bits_fx(
Word16 i, nb_bits_m15;
Indice_fx *ptr;
- ptr = &st_fx->ind_list_fx[st_fx->next_ind_fx];
+ ptr = &hBstr->ind_list_fx[hBstr->next_ind_fx];
nb_bits_m15 = sub(nb_bits, 15);
i = 0;
move16();
@@ -327,8 +342,8 @@ void push_next_bits_fx(
++ptr;
}
}
- st_fx->next_ind_fx = (Word16)(ptr - st_fx->ind_list_fx);
- st_fx->nb_bits_tot_fx = add(st_fx->nb_bits_tot_fx, nb_bits);
+ hBstr->next_ind_fx = (Word16)(ptr - hBstr->ind_list_fx);
+ hBstr->nb_bits_tot_fx = add(hBstr->nb_bits_tot_fx, nb_bits);
}
/*-------------------------------------------------------------------*
@@ -474,21 +489,21 @@ UWord16 get_indice_1_fx( /* o : value of the indice */
*-------------------------------------------------------------------*/
void reset_indices_enc_fx(
- Encoder_State_fx *st_fx
-)
+ BSTR_ENC_HANDLE hBstr /* i/o: encoder state structure */
+ )
{
Word16 i;
- st_fx->nb_bits_tot_fx = 0;
+ hBstr->nb_bits_tot_fx = 0;
move16();
- st_fx->next_ind_fx = 0;
+ hBstr->next_ind_fx = 0;
move16();
- st_fx->last_ind_fx = -1;
+ hBstr->last_ind_fx = -1;
move16();
FOR (i=0; iind_list_fx[i].nb_bits = -1;
+ hBstr->ind_list_fx[i].nb_bits = -1;
move16();
}
@@ -520,6 +535,7 @@ void reset_indices_dec_fx(
void write_indices_fx(
Encoder_State_fx *st_fx, /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */
FILE *file /* i : output bitstream file */
, UWord8 *pFrame, /* i: byte array with bit packet and byte aligned coded speech data */
Word16 pFrame_size /* i: size of the binary encoded access unit [bits] */
@@ -529,6 +545,7 @@ void write_indices_fx(
Word16 stream[2+MAX_BITS_PER_FRAME], *pt_stream;
Word32 mask;
UWord8 header;
+ Word16 isAmrWb = 0;
if( st_fx->bitstreamformat == G192 )
{
@@ -541,7 +558,7 @@ void write_indices_fx(
stream[i] = 0;
}
*pt_stream++ = (Word16)SYNC_GOOD_FRAME;
- *pt_stream++ = st_fx->nb_bits_tot_fx;
+ *pt_stream++ = hBstr->nb_bits_tot_fx;
/*----------------------------------------------------------------*
* Bitstream packing (conversion of individual indices into a serial stream)
@@ -550,15 +567,15 @@ void write_indices_fx(
for (i=0; iind_list_fx[i].nb_bits != -1)
+ if (hBstr->ind_list_fx[i].nb_bits != -1)
{
/* mask from MSB to LSB */
- mask = 1 << (st_fx->ind_list_fx[i].nb_bits - 1);
+ mask = 1 << (hBstr->ind_list_fx[i].nb_bits - 1);
/* write bit by bit */
- for (k=0; k < st_fx->ind_list_fx[i].nb_bits; k++)
+ for (k=0; k < hBstr->ind_list_fx[i].nb_bits; k++)
{
- if ( st_fx->ind_list_fx[i].value & mask )
+ if (hBstr->ind_list_fx[i].value & mask )
{
*pt_stream++ = G192_BIN1;
}
@@ -577,7 +594,7 @@ void write_indices_fx(
{
/* Create and write ToC header */
/* qbit always set to 1 on encoder side for AMRWBIO , no qbit in use for EVS, but set to 0(bad) */
- header = (UWord8)(st_fx->Opt_AMR_WB_fx << 5 | st_fx->Opt_AMR_WB_fx << 4 | rate2EVSmode(st_fx->nb_bits_tot_fx * 50));
+ header = (UWord8)(st_fx->Opt_AMR_WB_fx << 5 | st_fx->Opt_AMR_WB_fx << 4 | rate2EVSmode(hBstr->nb_bits_tot_fx * 50, &isAmrWb));
fwrite( &header, sizeof(UWord8), 1, file );
/* Write speech bits */
fwrite( pFrame, sizeof(UWord8), (pFrame_size + 7)>>3, file );
@@ -586,7 +603,7 @@ void write_indices_fx(
/* Clearing of indices */
FOR (i=0; iind_list_fx[i].nb_bits = -1;
+ hBstr->ind_list_fx[i].nb_bits = -1;
move16();
}
@@ -597,9 +614,9 @@ void write_indices_fx(
fwrite( stream, sizeof(unsigned short), 2+stream[1], file );
}
/* reset index pointers */
- st_fx->nb_bits_tot_fx = 0;
- st_fx->next_ind_fx = 0;
- st_fx->last_ind_fx = -1;
+ hBstr->nb_bits_tot_fx = 0;
+ hBstr->next_ind_fx = 0;
+ hBstr->last_ind_fx = -1;
return;
}
@@ -612,6 +629,7 @@ void write_indices_fx(
void indices_to_serial(
const Encoder_State_fx *st_fx, /* i: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */
UWord8 *pFrame, /* o: byte array with bit packet and byte aligned coded speech data */
Word16 *pFrame_size /* o: size of the binary encoded access unit [bits] */
)
@@ -622,31 +640,32 @@ void indices_to_serial(
Word16 amrwb_bits[(ACELP_23k85 / 50)];
UWord8 omask= 0x80;
UWord8 *pt_pFrame=pFrame;
+ Word16 isAmrWb = 0;
if ( st_fx->Opt_AMR_WB_fx )
{
- cmi = rate2EVSmode(st_fx->total_brate_fx);
- core_mode = rate2EVSmode(st_fx->nb_bits_tot_fx * 50);
+ cmi = rate2EVSmode(st_fx->total_brate_fx, &isAmrWb);
+ core_mode = rate2EVSmode(hBstr->nb_bits_tot_fx * 50, &isAmrWb);
j=0;
for (i=0; iind_list_fx[i].nb_bits != -1)
+ if (hBstr->ind_list_fx[i].nb_bits != -1)
{
/* mask from MSB to LSB */
- mask = 1 << (st_fx->ind_list_fx[i].nb_bits - 1);
+ mask = 1 << (hBstr->ind_list_fx[i].nb_bits - 1);
/* temporarily save bit */
- for (k=0; k < st_fx->ind_list_fx[i].nb_bits; k++)
+ for (k=0; k < hBstr->ind_list_fx[i].nb_bits; k++)
{
- amrwb_bits[j++] = (st_fx->ind_list_fx[i].value & mask) > 0;
+ amrwb_bits[j++] = (hBstr->ind_list_fx[i].value & mask) > 0;
mask >>= 1;
}
}
}
}
- *pFrame_size = st_fx->nb_bits_tot_fx;
+ *pFrame_size = hBstr->nb_bits_tot_fx;
/*----------------------------------------------------------------*
* Bitstream packing (conversion of individual indices into a serial stream)
@@ -654,13 +673,13 @@ void indices_to_serial(
j=0;
for (i=0; iind_list_fx[i].nb_bits != -1)
+ if (hBstr->ind_list_fx[i].nb_bits != -1)
{
/* mask from MSB to LSB */
- mask = 1 << (st_fx->ind_list_fx[i].nb_bits - 1);
+ mask = 1 << (hBstr->ind_list_fx[i].nb_bits - 1);
/* write bit by bit */
- for (k=0; k < st_fx->ind_list_fx[i].nb_bits; k++)
+ for (k=0; k < hBstr->ind_list_fx[i].nb_bits; k++)
{
if (st_fx->Opt_AMR_WB_fx )
{
@@ -668,7 +687,7 @@ void indices_to_serial(
}
else
{
- pack_bit(st_fx->ind_list_fx[i].value & mask, &pt_pFrame, &omask);
+ pack_bit(hBstr->ind_list_fx[i].value & mask, &pt_pFrame, &omask);
j++;
}
mask >>= 1;
@@ -880,7 +899,7 @@ static void decoder_selectCodec(
move16();
}
}
- st->last_cng_type_fx = st->cng_type_fx; /* CNG type switching at the first correctly received SID frame */
+ st->hTdCngDec->last_cng_type_fx = st->cng_type_fx; /* CNG type switching at the first correctly received SID frame */
}
@@ -1223,6 +1242,7 @@ static void mdct_switching_dec(
Word16 BRATE2IDX_fx(Word32 brate)
{
+
Word32 L_temp;
Word32 L_idx;
#define START 9
@@ -1428,7 +1448,7 @@ Word16 read_indices_fx( /* o : 1 = reading OK, 0 = problem
/* verify that a valid num bits value is present in the G.192 file */
/* only AMRWB or EVS bit rates or 0(NO DATA) are allowed in G.192 file frame reading */
- if( rate2EVSmode(total_brate) < 0 ) /* negative value means that a valid rate was not found */
+ if( rate2EVSmode(total_brate, NULL) < 0 ) /* negative value means that a valid rate was not found */
{
fprintf(stderr, "\nError, illegal bit rate (%d) in the G.192 frame ! Exiting ! \n", total_brate);
exit(-1);
@@ -1577,10 +1597,11 @@ Word16 read_indices_fx( /* o : 1 = reading OK, 0 = problem
/* st->total brate= total_brate ; updated in a good frame below */
} /* rew_flag */
+
+ /* get total bit-rate */
#ifdef DEBUGGING
st->bfi_fx |= file_read_FECpattern();
#endif
- /* get total bit-rate */
if ( st->bfi_fx == 0 && !rew_flag )
{
/* select MODE1 or MODE2 */
@@ -1622,7 +1643,18 @@ Word16 read_indices_fx( /* o : 1 = reading OK, 0 = problem
mdct_switching_dec(st);
}
+#ifdef DEBUGGING
+ else
+ {
+ bit_stream_ptr = st->bit_stream_fx;
+
+ for (k = 0; k < num_bits+ 2 * 8; ++k)
+ {
+ *bit_stream_ptr++ = 0;
+ }
+ }
+#endif
return 1;
}
@@ -2139,7 +2171,6 @@ void getPartialCopyInfo(
st->core_fx = 0;
}
}
-
/* check for bit errors */
berCheck( st, coder_type );
diff --git a/lib_com/cb_shape_fx.c b/lib_com/cb_shape_fx.c
index b4751363bffdcb913b704c639b727b6a9dedbc8d..475f9ddecc41014bba48b6e519484008780b7af0 100644
--- a/lib_com/cb_shape_fx.c
+++ b/lib_com/cb_shape_fx.c
@@ -1,14 +1,12 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "rom_com_fx.h" /* */
-#include "stl.h"
-
/*
* E_GAIN_f_pitch_sharpening
*
@@ -52,29 +50,31 @@ void cb_shape_fx(
const Word16 g1, /* i : formant sharpening numerator weighting */
const Word16 g2, /* i : formant sharpening denominator weighting */
const Word16 *p_Aq, /* i : LP filter coefficients */
- Word16 *code, /* i/o: signal to shape */
+ Word16 *code, /* i/o: signal to shape */
const Word16 tilt_code, /* i : tilt of code */
const Word16 pt_pitch, /* i : pointer to current subframe fractional pitch */
- const Word16 shift
+ const Word16 shift,
+ const Word16 L_subfr /* i : subframe lenght */
)
{
- Word16 tmp, buff[L_SUBFR+M], A_num[M+1], A_den[M+1];
+ Word16 tmp, buff[2*L_SUBFR + M], A_num[M + 1], A_den[M + 1];
Word16 i;
Word32 L_tmp;
Word16 tilt, mu;
tmp = 0;
+
move16();
/* Pre-emphasis */
IF( preemphFlag )
{
- preemph_copy_fx(code, code, tilt_code, L_SUBFR, &tmp);
+ preemph_copy_fx(code, code, tilt_code, L_subfr, &tmp);
}
/* pitch sharpening */
IF( pitchFlag )
{
- E_GAIN_f_pitch_sharpening( code, pt_pitch, L_SUBFR );
+ E_GAIN_f_pitch_sharpening( code, pt_pitch, L_subfr);
}
/* phase scrambling filter */
@@ -82,7 +82,7 @@ void cb_shape_fx(
{
buff[0] = code[0];
move16();
- FOR (i = 1; i < L_SUBFR; i++)
+ FOR (i = 1; i < L_subfr; i++)
{
buff[i]=code[i];
move16();
@@ -99,32 +99,32 @@ void cb_shape_fx(
{
weight_a_fx( p_Aq, A_num, g1, M );
weight_a_fx( p_Aq, A_den, g2, M );
- set16_fx(buff, 0, M+L_SUBFR);
+ set16_fx(buff, 0, M+ L_subfr);
IF( formantTiltFlag )
{
Copy(A_num, buff+M, M+1);
- E_UTIL_synthesis(1, A_den, buff+M, buff+M, L_SUBFR, buff, 0, M);
+ E_UTIL_synthesis(1, A_den, buff+M, buff+M, L_subfr, buff, 0, M);
/*Compute tilt of formant enhancement*/
- tilt = extract_l(L_shr(get_gain(buff+M+1, buff+M, L_SUBFR-1),1));
+ tilt = extract_l(L_shr(get_gain(buff+M+1, buff+M, L_subfr -1),1));
/*Combine tilt of code and fe*/
tmp = 0;
move16();
/*mu = 0.5f*tilt_code-0.25f*tilt;*/
mu = sub(shr(tilt_code,1),shr(tilt,2));
- preemph_copy_fx(code, code, mu, L_SUBFR, &tmp);
+ preemph_copy_fx(code, code, mu, L_subfr, &tmp);
}
ELSE
{
- Copy( code, buff, L_SUBFR );
+ Copy( code, buff, L_subfr);
Overflow = 0;
move16();
- Residu3_lc_fx(A_num, M, buff, code, L_SUBFR, shift);
+ Residu3_lc_fx(A_num, M, buff, code, L_subfr, shift);
{
- syn_filt_s_lc_fx(shift, A_den, code, code, L_SUBFR);
+ syn_filt_s_lc_fx(shift, A_den, code, code, L_subfr);
}
}
}
diff --git a/lib_com/cldfb.c b/lib_com/cldfb.c
index a05236eb85670703cc1da268d1b371d434289ba3..788c0b1f0126b9490323245a958450ff2eaafa4f 100644
--- a/lib_com/cldfb.c
+++ b/lib_com/cldfb.c
@@ -977,27 +977,41 @@ void configureCldfb ( HANDLE_CLDFB_FILTER_BANK h_cldfb, /*!< Returns han
*
* open and configures a CLDFB handle
*--------------------------------------------------------------------*/
-void openCldfb ( HANDLE_CLDFB_FILTER_BANK *h_cldfb, /*!< Returns handle */
- const Word16 type, /*!< analysis or synthesis */
- const Word16 maxCldfbBands, /*!< number of cldfb bands */
- const Word16 frameSize /*!< FrameSize */
- )
+ivas_error openCldfb (
+ HANDLE_CLDFB_FILTER_BANK *h_cldfb, /*!< Returns handle */
+ const Word16 type, /*!< analysis or synthesis */
+ const Word16 maxCldfbBands, /*!< number of cldfb bands */
+ const Word16 frameSize /*!< FrameSize */
+#ifdef ADD_IVAS_CLDFB
+ ,CLDFB_PROTOTYPE prototype /* i : CLDFB version (1.25ms/5ms delay) */
+#endif
+)
{
HANDLE_CLDFB_FILTER_BANK hs;
- hs = (HANDLE_CLDFB_FILTER_BANK) calloc(1, sizeof (struct CLDFB_FILTER_BANK));
-
+ hs = (HANDLE_CLDFB_FILTER_BANK)count_malloc(sizeof (struct CLDFB_FILTER_BANK));
+ if (hs == NULL)
+ {
+ return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB");
+ }
hs->type = type;
+#ifdef ADD_IVAS_CLDFB
+ hs->prototype = prototype;
+#endif
move16();
IF (type == CLDFB_ANALYSIS)
{
- hs->FilterStates = (Word16 *) calloc(STATE_BUFFER_SIZE*maxCldfbBands, sizeof (Word16));
+ hs->FilterStates = (Word16 *)count_malloc(STATE_BUFFER_SIZE*maxCldfbBands* sizeof (Word16));
}
ELSE
{
- hs->FilterStates = (Word16 *) calloc( 2 * STATE_BUFFER_SIZE * maxCldfbBands, sizeof (Word16));
+ hs->FilterStates = (Word16 *)count_malloc( 2 * STATE_BUFFER_SIZE * maxCldfbBands* sizeof (Word16));
+ }
+ if (hs->FilterStates == NULL)
+ {
+ return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for CLDFB");
}
hs->flags &= ~CLDFB_FLAG_KEEP_STATES;
@@ -1037,7 +1051,7 @@ void openCldfb ( HANDLE_CLDFB_FILTER_BANK *h_cldfb, /*!< Returns handle */
*h_cldfb = hs;
}
- return;
+ return IVAS_ERR_OK;
}
@@ -1212,7 +1226,7 @@ void analysisCldfbEncoder_fx(
&st_fx->currEnergyHF_e_fx,
enerBuffSum,
enerBuffSum_exp,
- &st_fx->tecEnc
+ st_fx->hTECEnc
);
return;
@@ -1231,7 +1245,7 @@ GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead) | p
Word16 *energyHF_Exp, /*!< o: pointer to exponent of HF energy */
Word32 *energyValuesSum, /*!< o: Q(2*sf_Values-4) | pointer to sum array of energy values, not initialized*/
Word16 *energyValuesSum_Exp,/*!< o: pointer to exponents of energyValuesSum, not initialized */
- HANDLE_TEC_ENC_FX hTecEnc
+ TEC_ENC_HANDLE_FX hTecEnc
)
{
Word16 j;
@@ -1450,9 +1464,9 @@ deleteCldfb (HANDLE_CLDFB_FILTER_BANK * h_cldfb) /* i: cldfb handle
{
IF ( (*h_cldfb)->FilterStates != NULL )
{
- free((*h_cldfb)->FilterStates);
+ count_free((*h_cldfb)->FilterStates);
}
- free(*h_cldfb);
+ count_free(*h_cldfb);
}
*h_cldfb = NULL;
}
@@ -1590,21 +1604,28 @@ cldfb_init_proto_and_twiddles(HANDLE_CLDFB_FILTER_BANK hs) /* i: cldfb handl
*
* Save the memory of filter; to be restored with cldfb_restore_memory()
*--------------------------------------------------------------------*/
-void
+ivas_error
cldfb_save_memory (HANDLE_CLDFB_FILTER_BANK hs) /* i: cldfb handle */
{
+ if (hs->memory != NULL || hs->memory_length != 0)
+ {
+ /* memory already stored; Free memory first */
+ return IVAS_ERR_OK;
+ }
hs->memory_length = cldfb_get_memory_length(hs);
hs->memory = (Word16 *) calloc( hs->memory_length + CLDFB_MEM_EXPONENTS + 1, sizeof (Word16));
-
/* save the memory */
Copy (hs->FilterStates, hs->memory, hs->memory_length);
Copy (hs->FilterStates_e, hs->memory+hs->memory_length, CLDFB_MEM_EXPONENTS);
hs->memory[hs->memory_length+CLDFB_MEM_EXPONENTS] = hs->FilterStates_eg;
move16();
-
- return;
+ if (hs->memory == NULL)
+ {
+ return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CLDFB\n");
+ }
+ return IVAS_ERR_OK;
}
@@ -1628,6 +1649,7 @@ cldfb_restore_memory (HANDLE_CLDFB_FILTER_BANK hs) /* i/o: cldfb handle */
hs->FilterStates_eg = hs->memory[hs->memory_length+CLDFB_MEM_EXPONENTS];
move16();
+
/* adjust sample rate if it was changed in the meanwhile */
IF (NE_16 (hs->memory_length,size))
{
@@ -1635,7 +1657,7 @@ cldfb_restore_memory (HANDLE_CLDFB_FILTER_BANK hs) /* i/o: cldfb handle */
}
hs->memory_length = 0;
- free(hs->memory);
+ count_free(hs->memory);
hs->memory = NULL;
return;
@@ -1657,5 +1679,6 @@ cldfb_reset_memory (HANDLE_CLDFB_FILTER_BANK hs) /* i/o: cldfb handle */
set16_fx (hs->FilterStates_e, 0, sizeof(hs->FilterStates_e)/sizeof(hs->FilterStates_e[0]));
hs->FilterStates_eg = 0;
move16();
+ return;
}
diff --git a/lib_com/cng_exc_fx.c b/lib_com/cng_exc_fx.c
index b0249f69ef874f5474c4b54106511726ab22b2e5..245270c7e70d1f3b7097d16b8f3347516fb649c6 100644
--- a/lib_com/cng_exc_fx.c
+++ b/lib_com/cng_exc_fx.c
@@ -1,11 +1,10 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h"
#include "rom_com_fx.h"
/*---------------------------------------------------------------------*
@@ -22,31 +21,32 @@
*-------------------------------------------------------*/
void CNG_exc_fx(
- const Word32 core_brate, /* i : core bitrate */
- const Word16 L_frame, /* i : length of the frame */
- Word32 *Enew, /* i/o: decoded SID energy Q6 */
- Word16 *seed, /* i/o: random generator seed */
- Word16 exc[], /* o : current non-enhanced excitation Q_new */
- Word16 exc2[], /* o : current enhanced excitation Q_new */
- Word32 *lp_ener, /* i/o: LP filtered E */
- const Word32 last_core_brate, /* i : previous frame core bitrate */
- Word16 *first_CNG, /* i/o: first CNG frame flag for energy init. */
- Word16 *cng_ener_seed, /* i/o: random generator seed for CNG energy */
- Word16 bwe_exc[], /* o : excitation for SWB TBE */
- const Word16 allow_cn_step, /* i : allow CN step */
- Word16 *last_allow_cn_step, /* i/o: last allow step */
- const Word16 OldQ_exc, /* i : Old excitation scaling */
- const Word16 Q_exc /* i : excitation scaling */
- , const Word16 num_ho /* i : number of selected hangover frames */
- ,Word32 q_env[]
- ,Word32 *lp_env
- ,Word32 *old_env
- ,Word16 *exc_mem
- ,Word16 *exc_mem1
- ,Word16 *sid_bw
- ,Word16 *cng_ener_seed1
- ,Word16 exc3[]
- ,Word16 Opt_AMR_WB
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16 L_frame, /* i : length of the frame */
+ Word32 *Enew, /* i/o: decoded SID energy Q6 */
+ Word16 *seed, /* i/o: random generator seed */
+ Word16 exc[], /* o : current non-enhanced excitation Q_new */
+ Word16 exc2[], /* o : current enhanced excitation Q_new */
+ Word32 *lp_ener, /* i/o: LP filtered E */
+ const Word32 last_core_brate,/* i : previous frame core bitrate */
+ Word16 *first_CNG, /* i/o: first CNG frame flag for energy init. */
+ Word16 *cng_ener_seed, /* i/o: random generator seed for CNG energy */
+ Word16 bwe_exc[], /* o : excitation for SWB TBE */
+ const Word16 allow_cn_step, /* i : allow CN step */
+ Word16 *last_allow_cn_step, /* i/o: last allow step */
+ const Word16 OldQ_exc, /* i : Old excitation scaling */
+ const Word16 Q_exc, /* i : excitation scaling */
+ const Word16 num_ho, /* i : number of selected hangover frames */
+ Word32 q_env[],
+ Word32 *lp_env,
+ Word32 *old_env,
+ Word16 *exc_mem,
+ Word16 *exc_mem1,
+ Word16 *sid_bw,
+ Word16 *cng_ener_seed1,
+ Word16 exc3[],
+ Word16 Opt_AMR_WB,
+ const int16_t element_mode /* i : IVAS Element mode */
)
{
Word16 i, tmp, tmp2, exp, exp2, Q_ener;
@@ -100,8 +100,11 @@ void CNG_exc_fx(
move32();
}
- *lp_ener = *Enew;
- move32();
+ if (EQ_16(element_mode, EVS_MONO))
+ {
+ *lp_ener = *Enew;
+ move32();
+ }
}
/*---------------------------------------------------------------------*
@@ -169,7 +172,11 @@ void CNG_exc_fx(
*last_allow_cn_step = 1;
move16();
}
-
+ /* If not mono, skip CNG here */
+ if (GT_16(element_mode, IVAS_SCE))
+ {
+ return;
+ }
/*---------------------------------------------------------------------*
* Generate white noise vector
*---------------------------------------------------------------------*/
@@ -581,11 +588,15 @@ void CNG_exc_fx(
*-------------------------------------------------------*/
void cng_params_postupd_fx(
const Word16 ho_circ_ptr, /* i : pointer for CNG averaging buffers Q0 */
- Word16 *cng_buf_cnt, /* i/o: counter for CNG store buffers Q0 */
+ Word16 *cng_buf_cnt, /* i/o: counter for CNG store buffers Q0 */
const Word16 *const cng_exc2_buf, /* i : Excitation buffer Q_exc */
const Word16 *const cng_Qexc_buf, /* i : Q_exc buffer Q0 */
const Word32 *const cng_brate_buf, /* i : bit rate buffer Q0 */
- Word32 ho_env_circ[] /* i/o: Envelope buffer */
+ Word32 ho_env_circ[] /* i/o: Envelope buffer */
+#ifdef IVAS_CODE_CNG_COM
+ ,const Word16 element_mode, /* i : Element mode */
+ const Word16 bwidth /* i : Audio bandwidth */
+#endif
)
{
Word16 i, j;
@@ -610,9 +621,9 @@ void cng_params_postupd_fx(
ptr = add(ptr, HO_HIST_SIZE);
}
- FOR( j = 0; j < *cng_buf_cnt; j++ )
+ FOR(j = 0; j < *cng_buf_cnt; j++)
{
- exc2 = &cng_exc2_buf[ptr*L_FFT];
+ exc2 = &cng_exc2_buf[ptr * L_FFT];
Q_exc = cng_Qexc_buf[ptr];
last_active_brate = cng_brate_buf[ptr];
@@ -622,57 +633,50 @@ void cng_params_postupd_fx(
fft_rel_fx(fft_io, L_FFT, LOG2_L_FFT);
ptR = &fft_io[1];
- ptI = &fft_io[L_FFT-1];
- FOR (i=0; iTCX/HQ */
+#define INV_CLDFB_BANDWIDTH ( 1.f / 800.f )
+
+#define L_FILT_2OVER3 12
+#define L_FILT_2OVER3_LP 3
+#endif
+
#define CLDFB_ANALYSIS 0
#define CLDFB_SYNTHESIS 1
@@ -754,6 +785,10 @@ enum
#define G_CODE_MIN_TC192_FX 4915 /* Q13 */
#define G_CODE_MAX_TC192_Q0 41
+
+#define BIT_SAVING_LOW_THR 10
+#define BIT_SAVING_HIGH_THR 80
+
/*--------------------------------------------------------------*
* ACELP constants
*---------------------------------------------------------------*/
@@ -781,12 +816,16 @@ enum
#define TCXLTP_LTP_ORDER 24
#define TCX_RES_Q_BITS_GAIN 3
+#define LPC_SHAPED_ARI_MAX_RATE_CPE ACELP_13k20
#define LPC_SHAPED_ARI_MAX_RATE ACELP_9k60
#define N_MAX_ARI 800
#define SPEC_EXP_DEC 20 /* initial decoder spectrum exponent */
+
+#define N_TCX_STARTLINE_NOISE_WB 11
+#define N_TCX_STARTLINE_NOISE_SWB 9
/*----------------------------------------------------------------------------------*
* TNS constants
*----------------------------------------------------------------------------------*/
@@ -808,7 +847,8 @@ enum
#define DEC_NPRM_DIV NPRM_DIV /* Total number of quantized parameter in 1 division (decoder side) */
#define NPRM_LPC_NEW 2*(4+2*NB_SPHERE) /* LPC total number of quantized parameters */
-#define BITBUFSIZE (128000/50)
+#define BITBUFSIZE (IVAS_BRATE_MAX/FRAMES_PER_SEC)
+#define IGF_BITBUFSIZE ( HQ_128k / FRAMES_PER_SEC )
#define TNS_COEF_RES 4 /* Bit resolution of the coefficients. */
#define INDEX_SHIFT (1 << (TNS_COEF_RES-1)) /* For shifting the index so that index 0 points to 0. */
@@ -862,6 +902,12 @@ enum
#define MAX_NO_MODES_p 145
#define NO_CODING_MODES 6
#define LVQ_COD_MODES 18
+
+#ifdef MSVQ_ROM
+#define LIMIT_LEADER 19
+#define DELTA_LEADER 256
+#endif
+
/* BC-TCQ */
#define N_STAGE_VQ 8
#define N_DIM 2
@@ -1209,6 +1255,12 @@ enum
/*----------------------------------------------------------------------------------*
* FD CNG
*----------------------------------------------------------------------------------*/
+#define SIZE_SCALE_TABLE_MONO 20
+#define SIZE_SCALE_TABLE_STEREO 27
+#define SIZE_SCALE_TABLE_CN 18
+#define SIZE_SCALE_TABLE_CN_AMRWB 3
+#define SIZE_SCALE_TABLE_TCX 13
+
#define DELTA 1e-20f
#define DELTA_MANTISSA_W16 0x5e73
#define DELTA_MANTISSA_W32 0x5e728433
@@ -1335,6 +1387,13 @@ enum
#define N_FEATURES_2 3 /* number of features */
+#ifdef IVAS_CODE
+#define TOD_NSPEC 80 /* number of spectral bins of the tonal detector */
+#define TOD_THR_MASS 0.86f /* initial value for the adaptive threshold of the tonal detector */
+#define P2A_FACT 0.9f /* long-term averaging factor for peak-to-average ratio */
+#define THR_P2A_HIGH 95.0f /* higher threshold to detect strongly peaky signals at low bitrates*/
+#define THR_P2A 80.0f /* lower threshold to detect strongly peaky signals at higher bitrates */
+#endif
/*----------------------------------------------------------------------------------*
* LD music post-filter constants
*----------------------------------------------------------------------------------*/
@@ -1373,8 +1432,14 @@ enum
#define SSF 32 /* Sub-subframe length for energy estimation in UC decision */
#define NB_SSF (L_FRAME / SSF) /* number of sub-subframes per frame */
+//IVAS_CODE
+#define GSC_LRES_GAINQ_LIMIT 3000 /* Bitrate where the low resolution quantization starts for the GSC */
+#define GSC_LRES_NB_NITS 10 /* Number of bits gained by using the low resolution quantization */
-#define MBANDS_GN 16 /* Number of band for gain coding in GSC */
+
+#define MBANDS_GN16k 18 /* Number of band for gain coding in GSC */
+#define MBANDS_GN 16 /* Number of band for gain coding in GSC */
+#define MBANDS_GN_BITALLOC16k 20 /* Number of band for gain coding in GSC */
#define BAND1k2 3
#define MBANDS_LOC (MBANDS_GN-1)
@@ -1549,12 +1614,33 @@ enum
#define HVQ_MAX_PEAKS_32k 23
#define HVQ_MAX_PEAKS_24k 17
#define HVQ_MAX_PEAKS_24k_CLAS 20 /* Limit for HVQ mode */
+#ifdef IVAS_CNST
+#define HVQ_MAX_PEAKS (HVQ_MAX_PEAKS_32k + 1 + 11 )
+#else
#define HVQ_MAX_PEAKS HVQ_MAX_PEAKS_32k + 1
+#endif
#define HVQ_NUM_SFM_24k (SFM_N_HARMONIC - 1 - HVQ_THRES_SFM_24k)
#define HVQ_NUM_SFM_32k (SFM_N_HARMONIC - 1 - HVQ_THRES_SFM_32k)
#define HVQ_MAX_RATE 32000
+#ifdef IVAS_CNST
+#define HQ_BWE_CROSSOVER_BRATE 26000 /* HQ crossover bitrate between 24.4 and 32 kbps BWE tunings */
+#define HVQ_PEAKS_BPS_DELTA ( HQ_32k - HQ_24k40 )
+#define HVQ_PEAKS_PER_DELTA ( HVQ_MAX_PEAKS_32k - HVQ_MAX_PEAKS_24k )
+#define HVQ_PEAKS_PER_DELTA_THR ( HVQ_MAX_PEAKS_32k - HVQ_MAX_PEAKS_24k_CLAS )
+#define HVQ_PEAKS_PER_DELTA_OFFS ( HVQ_MAX_PEAKS_24k * HVQ_PEAKS_BPS_DELTA - HQ_24k40 * HVQ_PEAKS_PER_DELTA )
+#define HVQ_PEAKS_PER_DELTA_THR_OFFS ( HVQ_MAX_PEAKS_24k_CLAS * HVQ_PEAKS_BPS_DELTA - HQ_24k40 * HVQ_PEAKS_PER_DELTA_THR )
+#define L_SPEC48k 800 /* HQ spectrum length at 48kHz */
+#define L_SPEC32k 640 /* HQ spectrum length at 32kHz */
+#define L_SPEC16k 320 /* HQ spectrum length at 16kHz */
+#define L_SPEC8k 160 /* HQ spectrum length at 8kHz */
+#define L_SPEC48k_EXT 1000 /* Extended HQ spectrum length at 48kHz, for ACELP->HQ switching */
+#define L_SPEC32k_EXT 800 /* Extended HQ spectrum length at 32kHz, for ACELP->HQ switching */
+#define L_SPEC16k_EXT 400 /* Extended HQ spectrum length at 16kHz, for ACELP->HQ switching */
+#define L_FRAME48k_EXT 1200 /* Extended MDCT frame size in samples at 48kHz */
+
+#endif
#define NUMNRMIBITS_SWB_HVQ_24k 35
@@ -1619,7 +1705,7 @@ enum
#define MAX_SPLITS 10 /* Maximum number of PVQ band splits */
#define QUANTAQ3OFFSET 1
-enum QuantaMode { NEAREST = 0, CONS };
+enum QuantaMode { PVQ_NEAREST = 0, PVQ_CONS };
#define PYR_OFFSET 1
#define RCF_INIT_SHIFT 14
@@ -1835,6 +1921,9 @@ enum QuantaMode { NEAREST = 0, CONS };
#define kTcxSnrOffsetGc 0x08 /* 0.03125f (7Q8) */
#define kTcxSnrOffsetVc 0x20 /* 0.125f (7Q8) */
+/*IVAS_CNST_AND_ROM*/
+#define LOWRATE_TCXLPC_MAX_BR_CPE ACELP_13k20
+/*End of IVAS_CNST_AND_ROM*/
#define LOWRATE_TCXLPC_MAX_BR ACELP_9k60
/*--------------------------------------------------------------*
@@ -1863,23 +1952,62 @@ enum QuantaMode { NEAREST = 0, CONS };
#define IGF_MODE_FB 3
-#define IGF_BITRATE_WB_9600 0
-#define IGF_BITRATE_RF_WB_13200 1
-#define IGF_BITRATE_SWB_9600 2
-#define IGF_BITRATE_SWB_13200 3
-#define IGF_BITRATE_RF_SWB_13200 4
-#define IGF_BITRATE_SWB_16400 5
-#define IGF_BITRATE_SWB_24400 6
-#define IGF_BITRATE_SWB_32000 7
-#define IGF_BITRATE_SWB_48000 8
-#define IGF_BITRATE_FB_16400 9
-#define IGF_BITRATE_FB_24400 10
-#define IGF_BITRATE_FB_32000 11
-#define IGF_BITRATE_FB_48000 12
-#define IGF_BITRATE_FB_96000 13
-#define IGF_BITRATE_FB_128000 14
-#define IGF_BITRATE_UNKNOWN 15
-
+//#define IGF_BITRATE_WB_9600 0
+//#define IGF_BITRATE_RF_WB_13200 1
+//#define IGF_BITRATE_SWB_9600 2
+//#define IGF_BITRATE_SWB_13200 3
+//#define IGF_BITRATE_RF_SWB_13200 4
+//#define IGF_BITRATE_SWB_16400 5
+//#define IGF_BITRATE_SWB_24400 6
+//#define IGF_BITRATE_SWB_32000 7
+//#define IGF_BITRATE_SWB_48000 8
+//#define IGF_BITRATE_FB_16400 9
+//#define IGF_BITRATE_FB_24400 10
+//#define IGF_BITRATE_FB_32000 11
+//#define IGF_BITRATE_FB_48000 12
+//#define IGF_BITRATE_FB_96000 13
+//#define IGF_BITRATE_FB_128000 14
+//#define IGF_BITRATE_UNKNOWN 15
+enum
+{
+ IGF_BITRATE_WB_9600,
+ IGF_BITRATE_RF_WB_13200,
+ IGF_BITRATE_SWB_9600,
+ IGF_BITRATE_SWB_13200,
+ IGF_BITRATE_RF_SWB_13200,
+ IGF_BITRATE_SWB_16400,
+ IGF_BITRATE_SWB_24400,
+ IGF_BITRATE_SWB_32000,
+ IGF_BITRATE_SWB_48000,
+ IGF_BITRATE_SWB_64000,
+ IGF_BITRATE_FB_16400,
+ IGF_BITRATE_FB_24400,
+ IGF_BITRATE_FB_32000,
+ IGF_BITRATE_FB_48000,
+ IGF_BITRATE_FB_64000,
+ IGF_BITRATE_FB_96000,
+ IGF_BITRATE_FB_128000,
+ IGF_BITRATE_WB_13200_CPE,
+ IGF_BITRATE_WB_16400_CPE,
+ IGF_BITRATE_SWB_13200_CPE,
+ IGF_BITRATE_SWB_16400_CPE,
+ IGF_BITRATE_SWB_24400_CPE,
+ IGF_BITRATE_SWB_32000_CPE,
+ IGF_BITRATE_SWB_48000_CPE,
+ IGF_BITRATE_SWB_48000_CPE_TCX10,
+ IGF_BITRATE_SWB_64000_CPE,
+ IGF_BITRATE_SWB_80000_CPE,
+ IGF_BITRATE_SWB_96000_CPE,
+ IGF_BITRATE_FB_24400_CPE,
+ IGF_BITRATE_FB_32000_CPE,
+ IGF_BITRATE_FB_48000_CPE,
+ IGF_BITRATE_FB_48000_CPE_TCX10,
+ IGF_BITRATE_FB_64000_CPE,
+ IGF_BITRATE_FB_80000_CPE,
+ IGF_BITRATE_FB_96000_CPE,
+ IGF_BITRATE_FB_128000_CPE,
+ IGF_BITRATE_UNKNOWN
+};
#define IGF_WHITENING_OFF 0
#define IGF_WHITENING_MID 1
diff --git a/lib_com/codec_tcx_common.c b/lib_com/codec_tcx_common.c
index 5f5f1db1bf0cca57579ef9bf3200e8d9890a4a7b..8fddaf651018884710683d948068a4733693e5ce 100644
--- a/lib_com/codec_tcx_common.c
+++ b/lib_com/codec_tcx_common.c
@@ -2,19 +2,22 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include
-#include "prot_fx.h"
#include "options.h"
-
-#include "stl.h"
#include "prot_fx.h"
#include "basop_util.h"
#include "rom_basop_util.h"
-#define inv_int InvIntTable
-
+#define inv_int InvIntTable
-Word16 tcxGetNoiseFillingTilt(Word16 A[], Word16 lpcorder, Word16 L_frame, Word16 mode, Word16 *noiseTiltFactor)
+Word16 tcxGetNoiseFillingTilt(
+ const Word16 A[],
+ const Word16 lpcorder,
+ const Word16 L_frame,
+ const Word16 mode,
+ Word16 *noiseTiltFactor
+)
{
Word16 firstLine;
Word32 tmp;
@@ -46,10 +49,12 @@ Word16 tcxGetNoiseFillingTilt(Word16 A[], Word16 lpcorder, Word16 L_frame, Word1
void tcxFormantEnhancement(
Word16 xn_buf[],
- Word16 gainlpc[], Word16 gainlpc_e[],
- Word32 spectrum[], Word16 *spectrum_e,
- Word16 L_frame,
- Word16 L_frameTCX
+ const Word16 gainlpc[],
+ const Word16 gainlpc_e[],
+ Word32 spectrum[],
+ Word16 *spectrum_e,
+ const Word16 L_frame,
+ const Word16 L_frameTCX
)
{
Word16 i, j, k, l, n;
@@ -202,43 +207,39 @@ void tcxFormantEnhancement(
}
-void tcxInvertWindowGrouping(TCX_config *tcx_cfg,
- Word32 xn_buf[],
- Word32 spectrum[],
- Word16 L_frame,
- Word8 fUseTns,
- Word16 last_core,
- Word16 index,
- Word16 frame_cnt,
- Word16 bfi)
+void tcxInvertWindowGrouping(
+ TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */
+ Word32 xn_buf[],
+ Word32 spectrum[],
+ const Word16 L_frame,
+ const Word8 fUseTns,
+ const Word16 last_core,
+ const Word16 index,
+ const Word16 frame_cnt,
+ const Word16 bfi
+)
{
Word16 i, L_win, L_spec;
Word32 *p;
L_win = shr(L_frame, 1);
- L_spec = tcx_cfg->tnsConfig[0][0].iFilterBorders[0];
+ L_spec = hTcxCfg->tnsConfig[0][0].iFilterBorders[0];
move16();
test();
test();
- if ((frame_cnt != 0) && (bfi == 0) && (last_core != ACELP_CORE)) /* fix sub-window overlap */
+ if ((frame_cnt != 0) && (bfi == 0) && NE_16(last_core, ACELP_CORE)) /* fix sub-window overlap */
{
- tcx_cfg->tcx_last_overlap_mode = tcx_cfg->tcx_curr_overlap_mode;
+ hTcxCfg->tcx_last_overlap_mode = hTcxCfg->tcx_curr_overlap_mode;
move16();
}
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- IF (((bfi==0) &&((tcx_cfg->tcx_last_overlap_mode != FULL_OVERLAP) ||
- ((tcx_cfg->tcx_curr_overlap_mode == FULL_OVERLAP) && (frame_cnt == 0) && (index == 0))))
+ test();test();test();test();test();test();test();
+ IF (((bfi==0) &&((hTcxCfg->tcx_last_overlap_mode != FULL_OVERLAP) ||
+ ((hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP) && (frame_cnt == 0) && (index == 0))))
||
- ((bfi!=0) &&((tcx_cfg->tcx_last_overlap_mode != FULL_OVERLAP) &&
- !(tcx_cfg->tcx_curr_overlap_mode == FULL_OVERLAP))))
+ ((bfi!=0) &&((hTcxCfg->tcx_last_overlap_mode != FULL_OVERLAP) &&
+ !(hTcxCfg->tcx_curr_overlap_mode == FULL_OVERLAP))))
{
/* ungroup sub-windows: deinterleave MDCT bins into separate windows */
p = xn_buf;
@@ -265,7 +266,7 @@ void tcxInvertWindowGrouping(TCX_config *tcx_cfg,
test();
test();
- IF ((tcx_cfg->fIsTNSAllowed != 0) && (bfi == 0) && (fUseTns != 0))
+ IF ((hTcxCfg->fIsTNSAllowed != 0) && (bfi == 0) && (fUseTns != 0))
{
/* rearrange LF sub-window lines prior to TNS synthesis filtering */
IF (LT_16(L_spec, L_frame))
@@ -285,4 +286,135 @@ void tcxInvertWindowGrouping(TCX_config *tcx_cfg,
}
+#ifdef IVAS_CODE_TCX_COM
+
+/*-------------------------------------------------------------------*
+ * tcx5SpectrumInterleaving()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void tcx5SpectrumInterleaving(
+ const int16_t tcx5Size,
+ float* spectrum)
+{
+ int16_t i;
+ float interleaveBuf[N_TCX10_MAX];
+
+ set_f(interleaveBuf, 0.0f, N_TCX10_MAX);
+
+ /* group sub-windows: interleave bins according to their frequencies */
+ for (i = 0; i < tcx5Size; i++)
+ {
+ interleaveBuf[2 * i] = spectrum[i];
+ interleaveBuf[2 * i + 1] = spectrum[tcx5Size + i];
+ }
+
+ mvr2r(interleaveBuf, spectrum, 2 * tcx5Size);
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * tcx5SpectrumDeinterleaving()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void tcx5SpectrumDeinterleaving(
+ const int16_t tcx5Size,
+ float* spectrum)
+{
+ int16_t i;
+ float interleaveBuf[N_TCX10_MAX];
+
+ set_f(interleaveBuf, 0.0f, N_TCX10_MAX);
+
+ /* ungroup sub-windows: interleave bins according to their frequencies */
+ for (i = 0; i < tcx5Size; i++)
+ {
+ interleaveBuf[i] = spectrum[2 * i];
+ interleaveBuf[tcx5Size + i] = spectrum[2 * i + 1];
+ }
+
+ mvr2r(interleaveBuf, spectrum, 2 * tcx5Size);
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * tcx5TnsGrouping()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void tcx5TnsGrouping(
+ const int16_t L_frame, /* i : frame length (TCX5) */
+ const int16_t L_spec, /* i : coded spec length (TCX5, derived from filter borders*/
+ float* spectrum)
+{
+ /* rearrange LF sub-window lines prior to TNS synthesis filtering */
+ if (L_spec < L_frame)
+ {
+ mvr2r(spectrum + 8, spectrum + 16, L_spec - 8);
+ mvr2r(spectrum + L_frame, spectrum + 8, 8);
+ mvr2r(spectrum + L_frame + 8, spectrum + L_spec + 8, L_spec - 8);
+ }
+ else
+ {
+ float buff[8]; /* Buffer for the rearrangement of LF TCX5 */
+ mvr2r(spectrum + L_spec, buff, 8);
+ mvr2r(spectrum + 8, spectrum + 16, L_spec - 8);
+ mvr2r(buff, spectrum + 8, 8);
+ }
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * tcx5TnsUngrouping()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void tcx5TnsUngrouping(
+ const int16_t L_frame, /* i : frame length (TCX5) */
+ const int16_t L_spec, /* i : coded spec length (TCX5, derived from filter borders*/
+ float* spectrum,
+ const int16_t enc_dec /* i : 0: encoder, else decoder */
+)
+{
+ /* undo rearrangement of LF sub-window lines prior to TNS analysis */
+ if (L_spec < L_frame)
+ {
+ mvr2r(spectrum + L_spec + 8, spectrum + L_frame + 8, L_spec - 8);
+ mvr2r(spectrum + 8, spectrum + L_frame, 8);
+ mvr2r(spectrum + 16, spectrum + 8, L_spec - 8);
+ set_zero(spectrum + L_spec, L_frame - L_spec);
+ set_zero(spectrum + L_frame + L_spec, L_frame - L_spec);
+ }
+ else
+ {
+ float buff[8]; /* Buffer for the rearrangement of LF TCX5 */
+
+ mvr2r(spectrum + 8, buff, 8);
+
+ if (enc_dec == ENC)
+ {
+ mvr2r(spectrum + 16, spectrum + 8, L_frame - 8);
+ mvr2r(buff, spectrum + L_frame, 8);
+ }
+ else
+ {
+ mvr2r(spectrum + 16, spectrum + 8, L_spec - 8);
+ mvr2r(buff, spectrum + L_spec, 8);
+ }
+ }
+
+ return;
+}
+#endif
diff --git a/lib_com/core_com_config_fx.c b/lib_com/core_com_config_fx.c
index a287157d950b9c214353b44f8c238d36ffc30b73..c5c5b02300dcc869a977d3a864cb913304fc364e 100644
--- a/lib_com/core_com_config_fx.c
+++ b/lib_com/core_com_config_fx.c
@@ -2,43 +2,203 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
-#include
-#include
#include
-
+#include
#include "options.h"
-#include "stl.h"
#include "basop_util.h"
#include "prot_fx.h"
#include "rom_com_fx.h"
+#if 1//def IVAS_CODE_COM_CONFIG_P1
+
+ /*-------------------------------------------------------------------*
+ * is_EVS_bitrate()
+ *
+ * check if the bitrate is EVS supported active bitrate
+ *-------------------------------------------------------------------*/
-Word8 getTcxonly(const Word32 bitrate)
+ /*! r: flag indicating a valid bitrate */
+Word16 is_EVS_bitrate(
+ const Word32 ivas_total_brate, /* i : EVS total bitrate */
+ Word16* Opt_AMR_WB /* i : AMR-WB IO flag */
+)
{
+ Word16 j;
- Word8 tcxonly;
+ j = 0;
+ while (j < SIZE_BRATE_TBL && ivas_total_brate != brate_tbl[j])
+ {
+ j++;
+ }
- tcxonly = 0;
- move16();
- if( GT_32(bitrate,32000))
+ /* AMR-WB IO mode/EVS primary mode determination */
+ if (j >= SIZE_BRATE_TBL)
{
- tcxonly = 1;
- move16();
+ switch (ivas_total_brate)
+ {
+ case ACELP_6k60:
+ case ACELP_8k85:
+ case ACELP_12k65:
+ case ACELP_14k25:
+ case ACELP_15k85:
+ case ACELP_18k25:
+ case ACELP_19k85:
+ case ACELP_23k05:
+ case ACELP_23k85:
+ break;
+ default:
+ {
+ return 0;
+ }
+ break;
+ }
+
+ *Opt_AMR_WB = 1;
+ }
+ else
+ {
+ *Opt_AMR_WB = 0;
+ }
+
+ return 1;
+}
+
+
+/*-------------------------------------------------------------------*
+ * get_codec_mode()
+ *
+ * Get codec_mode (MODE1 or MODE2)
+ *-------------------------------------------------------------------*/
+
+ /*! r: codec mode */
+Word16 get_codec_mode(
+ const Word32 total_brate /* i : total bitrate */
+)
+{
+ Word16 codec_mode = -1;
+
+ SWITCH (total_brate)
+ {
+ case 5900:
+ codec_mode = MODE1; move16();
+ BREAK;
+ case 7200:
+ codec_mode = MODE1; move16();
+ BREAK;
+ case 8000:
+ codec_mode = MODE1; move16();
+ BREAK;
+ case 9600:
+ codec_mode = MODE2; move16();
+ BREAK;
+ case 13200:
+ codec_mode = MODE1; move16();
+ BREAK;
+ case 16400:
+ codec_mode = MODE2; move16();
+ BREAK;
+ case 24400:
+ codec_mode = MODE2; move16();
+ BREAK;
+ case 32000:
+ codec_mode = MODE1; move16();
+ BREAK;
+ case 48000:
+ codec_mode = MODE2; move16();
+ BREAK;
+ case 64000:
+ codec_mode = MODE1; move16();
+ BREAK;
+ case 96000:
+ codec_mode = MODE2; move16();
+ BREAK;
+ case 128000:
+ codec_mode = MODE2; move16();
+ BREAK;
}
+ return codec_mode;
+}
+
+#endif
+
+Word16 getTcxonly(
+#ifdef IVAS_CODE_SWITCHING
+ const Word16 element_mode, /* i : IVAS element mode */
+#endif
+ const Word32 total_brate /* i : total bitrate */
+#ifdef IVAS_CODE_SWITCHING
+ ,const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
+ const int16_t is_ism_format /* i : flag indicating ISM format */
+#endif
+)
+{
+
+ Word16 tcxonly;
+ tcxonly = 0;
+ move16();
+#ifdef IVAS_CODE_SWITCHING
+ SWITCH(element_mode)
+ {
+ case EVS_MONO:
+#endif
+ if (GT_32(total_brate, 32000))
+ {
+ tcxonly = 1;
+ move16();
+ }
+#ifdef IVAS_CODE_SWITCHING
+ break;
+ case IVAS_SCE:
+ if (is_ism_format)
+ {
+ if (total_brate > MAX_ACELP_BRATE_ISM)
+ {
+ tcxonly = 1;
+ }
+ }
+ else
+ {
+ if (total_brate > MAX_ACELP_BRATE)
+ {
+ tcxonly = 1;
+ }
+ }
+ break;
+
+ case IVAS_CPE_DFT:
+ case IVAS_CPE_TD:
+ if (total_brate > MAX_ACELP_BRATE)
+ {
+ tcxonly = 1;
+ }
+ break;
+ case IVAS_CPE_MDCT:
+ if (total_brate >= (MCT_flag ? IVAS_32k : IVAS_48k))
+ {
+ tcxonly = 1;
+ }
+ break;
+#endif
return tcxonly;
}
-Word8 getCtxHm(const Word32 bitrate, const Word16 rf_flag)
+Word8 getCtxHm(
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 rf_flag /* i : flag to signal the RF mode */
+)
{
Word8 ctx_hm;
ctx_hm = 0;
move16();
- test();
- if( (bitrate > LPC_SHAPED_ARI_MAX_RATE) && (bitrate <= 64000) && !rf_flag)
+ test(); test(); test(); test(); test(); test(); test(); test();
+ if (((LE_16(element_mode, IVAS_SCE) && GT_32(total_brate, LPC_SHAPED_ARI_MAX_RATE)) ||
+ (GT_16(element_mode, IVAS_SCE) && GT_32(total_brate, LPC_SHAPED_ARI_MAX_RATE_CPE))) && !rf_flag &&
+ ((LE_32(total_brate, IVAS_64k) && NE_16(element_mode, IVAS_CPE_DFT)) ||
+ (LT_32(total_brate, IVAS_24k4) && EQ_16(element_mode, IVAS_CPE_DFT))) && NE_16(element_mode, IVAS_CPE_MDCT))
{
ctx_hm = 1;
@@ -50,14 +210,16 @@ Word8 getCtxHm(const Word32 bitrate, const Word16 rf_flag)
}
-Word8 getResq(const Word32 bitrate)
+Word8 getResq(
+ const Word32 total_brate /* i : total bitrate */
+)
{
Word8 resq;
resq = 0;
move16();
- if (LE_32(bitrate,64000))
+ if (LE_32(total_brate, IVAS_64k))
{
resq = 1;
move16();
@@ -67,17 +229,19 @@ Word8 getResq(const Word32 bitrate)
}
-Word8 getTnsAllowed(const Word32 bitrate
- ,const Word16 igf
- )
+Word16 getTnsAllowed(
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 igf, /* i : flag indicating IGF activity*/
+ const int16_t element_mode /* i : IVAS element mode */
+)
{
Word8 tnsAllowed;
tnsAllowed = 0;
move16();
- IF ( igf != 0 )
+ IF(igf != 0)
{
- if( GT_32(bitrate, HQ_16k40))
+ if (GT_32(total_brate, HQ_16k40) || (GT_32(total_brate, HQ_13k20) && EQ_16(element_mode, IVAS_CPE_DFT)))
{
tnsAllowed = 1;
move16();
@@ -85,18 +249,21 @@ Word8 getTnsAllowed(const Word32 bitrate
}
ELSE
{
- if( GT_32(bitrate, HQ_32k))
+ if (GT_32(total_brate, HQ_32k))
{
tnsAllowed = 1;
move16();
}
}
-
return tnsAllowed;
}
-Word8 getRestrictedMode(const Word32 bitrate, const Word16 Opt_AMR_WB)
+Word8 getRestrictedMode(
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */
+)
{
Word8 restrictedMode;
@@ -105,7 +272,12 @@ Word8 getRestrictedMode(const Word32 bitrate, const Word16 Opt_AMR_WB)
move16();
test();
- IF ( (Opt_AMR_WB == 0) && (GT_32(bitrate,32000)))
+ IF ( (Opt_AMR_WB == 0) && (GT_32(total_brate, HQ_32k) && NE_16(element_mode, IVAS_SCE)))
+ {
+ restrictedMode = 6;
+ move16();
+ }
+ ELSE IF (Opt_AMR_WB == 0 && (GT_32(total_brate, HQ_48k) && EQ_16(element_mode, IVAS_SCE)))
{
restrictedMode = 6;
move16();
@@ -120,11 +292,13 @@ Word8 getRestrictedMode(const Word32 bitrate, const Word16 Opt_AMR_WB)
}
-Word16 sr2fscale(const Word32 sr)
+Word16 sr2fscale(
+ const Word32 sr_core /* i : internal sampling rate */
+)
{
Word16 fscale;
- SWITCH(sr)
+ SWITCH(sr_core)
{
case 8000:
fscale = (FSCALE_DENOM*8000)/12800;
@@ -164,45 +338,66 @@ Word16 sr2fscale(const Word32 sr)
return fscale;
}
-Word32 getCoreSamplerateMode2(const Word32 bitrate, const Word16 bandwidth, const Word16 rf_mode)
+Word32 getCoreSamplerateMode2(
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */
+ const Word16 rf_mode, /* i : flag to signal the RF mode */
+ const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */
+)
{
Word32 sr_core;
+ Word16 bwd_swb_or_fb_flag;
sr_core = -1; /* to suppress MSVC warning */ move32();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
- test();
-
- IF( EQ_32( bandwidth,NB))
+ bwd_swb_or_fb_flag = s_or((Word16)EQ_16(bwidth, SWB), (Word16)EQ_16(bwidth, FB));
+ test();test();test();test();test();test();test();test();test();test();
+ test();test();test();test();test();test();test();
+ test();test();test();test();test();
+ IF( EQ_32( bwidth,NB))
{
- sr_core = 12800;
+ sr_core = INT_FS_12k8;
move32();
}
+ ELSE IF ( EQ_16(element_mode, EVS_MONO) && ( L_and(EQ_32(bwidth,WB),LT_32(total_brate, ACELP_13k20))||
+ L_and(EQ_32(bwidth,SWB), LE_32(total_brate, ACELP_13k20)) || EQ_16(rf_mode,1) ) )
- ELSE IF ( L_and(EQ_32(bandwidth,WB),LT_32(bitrate,13200))||
- L_and(EQ_32(bandwidth,SWB), LE_32(bitrate,13200)) || EQ_16(rf_mode,1) )
-
{
- sr_core = 12800;
+ sr_core = INT_FS_12k8;
+ move32();
+ }
+ ELSE IF (GT_16(element_mode, EVS_MONO) && flag_ACELP16k == 0)
+ {
+ sr_core = INT_FS_12k8;
+ move32();
+ }
+ ELSE IF (EQ_32(bwidth,WB)||((LE_32(total_brate, ACELP_32k))&&((EQ_32(bwidth,SWB))||(EQ_32(bwidth,FB)))))
+ {
+ sr_core = INT_FS_16k;
move32();
}
- ELSE IF (EQ_32(bandwidth,WB)||((LE_32(bitrate,32000))&&((EQ_32(bandwidth,SWB))||(EQ_32(bandwidth,FB)))))
+ ELSE IF (bwd_swb_or_fb_flag && LE_32(total_brate, MAX_ACELP_BRATE) && EQ_16(element_mode, IVAS_SCE) && !is_ism_format)
{
- sr_core = 16000;
+ sr_core = INT_FS_16k;
move32();
}
- ELSE IF ( ((EQ_32(bandwidth,SWB))||(EQ_32(bandwidth,FB)))&&(LE_32(bitrate,64000)))
+ ELSE IF (bwd_swb_or_fb_flag && LE_32(total_brate, MAX_ACELP_BRATE_ISM) && EQ_16(element_mode, IVAS_SCE) && is_ism_format)
+ {
+ sr_core = INT_FS_16k;
+ }
+ else if (bwd_swb_or_fb_flag && LE_32(total_brate, MAX_ACELP_BRATE) && EQ_16(element_mode, IVAS_SCE) && is_ism_format)
+ {
+ sr_core = 25600;
+ }
+ ELSE IF ( (EQ_16(element_mode, EVS_MONO) && (bwd_swb_or_fb_flag && LE_32(total_brate, HQ_64k)))
+ || (GT_16(element_mode, IVAS_SCE) && ((EQ_16(bwidth, SWB) && LE_32(total_brate, IVAS_96k)) || (EQ_16(bwidth, FB) && LE_32(total_brate, IVAS_96k)))))
{
sr_core = 25600;
move32();
}
- ELSE IF (EQ_32(bandwidth,SWB)||EQ_32(bandwidth,FB))
+ ELSE IF (bwd_swb_or_fb_flag)
{
sr_core = 32000;
move32();
@@ -215,14 +410,16 @@ Word32 getCoreSamplerateMode2(const Word32 bitrate, const Word16 bandwidth, cons
return sr_core;
}
-Word16 getTcxBandwidth(const Word16 bandwidth)
+Word16 getTcxBandwidth(
+ const Word16 bwidth /* i : audio bandwidth */
+)
{
Word16 tcxBandwidth;
tcxBandwidth = 16384/*0.5f Q15*/;
move16();
- if(EQ_16(bandwidth, NB))
+ if(EQ_16(bwidth, NB))
{
tcxBandwidth = 10240/*0.3125f Q15*/;
move16();
@@ -231,12 +428,17 @@ Word16 getTcxBandwidth(const Word16 bandwidth)
return tcxBandwidth;
}
-
-
-Word8 getIgfPresent(
- const Word32 bitrate,
- const Word16 bandwidth
- ,const Word16 rf_mode
+/*-------------------------------------------------------------------*
+ * getIgfPresent()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+Word16 getIgfPresent(
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 rf_mode /* i : flag to signal the RF mode */
)
{
Word8 igfPresent;
@@ -244,32 +446,91 @@ Word8 getIgfPresent(
igfPresent = 0;
move16();
- test();
- test();
- if( (EQ_16(bandwidth, SWB))&&(GE_32(bitrate,ACELP_9k60))&&(LT_32(bitrate,HQ_64k)))
+ IF (EQ_16(bwidth, SWB))
{
- igfPresent = 1;
- move16();
+ SWITCH (element_mode)
+ {
+ case EVS_MONO:
+ case IVAS_SCE:
+ if (LE_32(total_brate, HQ_64k))
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
+ case IVAS_CPE_DFT:
+ case IVAS_CPE_TD:
+ if (LE_32(total_brate, HQ_48k))
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
+ case IVAS_CPE_MDCT:
+ if (LE_32(total_brate, IVAS_96k))
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
+ }
}
-
- test();
- if( EQ_16(bandwidth, FB)&&(GE_32(bitrate,ACELP_16k40)))
+ else if (bwidth == FB)
{
- igfPresent = 1;
- move16();
+ SWITCH(element_mode)
+ {
+ case EVS_MONO:
+ case IVAS_SCE:
+ if (LE_32(total_brate, IVAS_128k))
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
+ case IVAS_CPE_DFT:
+ case IVAS_CPE_TD:
+ if (LE_32(total_brate, HQ_48k))
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
+ case IVAS_CPE_MDCT:
+ if (LE_32(total_brate, IVAS_128k))
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
+ }
}
-
- test();
- if( (EQ_16(bandwidth, WB))&&(EQ_32(bitrate,ACELP_9k60)))
+ else if (bwidth == WB)
{
- igfPresent = 1;
- move16();
+ SWITCH(element_mode)
+ {
+ case EVS_MONO:
+ case IVAS_SCE:
+ if (LE_32(total_brate, ACELP_9k60))
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
+ case IVAS_CPE_DFT:
+ case IVAS_CPE_TD:
+ case IVAS_CPE_MDCT:
+ if (LE_32(total_brate, ACELP_13k20))
+ {
+ igfPresent = 1;
+ move16();
+ }
+ BREAK;
+ }
}
-
test();
test();
test();
- if( ((EQ_16(bandwidth, WB))||(EQ_16(bandwidth,SWB)))&&(EQ_16(rf_mode,1))&&(EQ_32(bitrate,ACELP_13k20)))
+ if (((EQ_16(bwidth, WB)) || (EQ_16(bwidth, SWB))) && (EQ_16(rf_mode, 1)) && (EQ_32(total_brate, ACELP_13k20)))
{
igfPresent = 1;
move16();
@@ -279,40 +540,37 @@ Word8 getIgfPresent(
}
-Word8 getCnaPresent(
- const Word32 bitrate,
- const Word16 bandwidth
+Word16 getCnaPresent(
+ const Word16 element_mode, /* i : element mode */
+ const Word32 element_brate, /* i : element bitrate */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 bwidth /* i : audio bandwidth */
)
{
Word8 flag_cna = 0;
flag_cna = 0;
- move16();
- test();
- if( EQ_16(bandwidth, NB)&&(LE_32(bitrate,ACELP_13k20)))
+ IF (EQ_16(element_mode, IVAS_CPE_DFT) && LE_32(element_brate, CNA_MAX_BRATE_DFT_STEREO))
{
flag_cna = 1;
- move16();
- }
-
- test();
- if( (EQ_16(bandwidth, WB))&&(LE_32(bitrate,ACELP_13k20)))
- {
- flag_cna = 1;
- move16();
}
-
- test();
- if( (EQ_16(bandwidth, SWB))&&(LE_32(bitrate,ACELP_13k20)))
+ ELSE
{
- flag_cna = 1;
move16();
+ test();
+ if (LE_16(bwidth, SWB) && (LE_32(total_brate, ACELP_13k20)))
+ {
+ flag_cna = 1;
+ move16();
+ }
}
return flag_cna;
}
-Word8 getTcxLtp(const Word32 sr_core)
+Word8 getTcxLtp(
+ const Word32 sr_core /* i : internal sampling rate */
+)
{
Word8 tcxltp = 0;
@@ -342,7 +600,7 @@ Word16 initPitchLagParameters(
Word16 pit_res_max;
- IF (EQ_32(sr_core, 12800))
+ IF (EQ_32(sr_core, INT_FS_12k8))
{
*pit_min = PIT_MIN_12k8;
@@ -359,7 +617,7 @@ Word16 initPitchLagParameters(
move16();
}
- ELSE IF (EQ_32(sr_core, 16000))
+ ELSE IF (EQ_32(sr_core, INT_FS_16k))
{
*pit_min = PIT_MIN_16k;
@@ -413,7 +671,9 @@ Word16 initPitchLagParameters(
return pit_res_max;
}
-Word16 getNumTcxCodedLines(const Word16 bwidth)
+Word16 getNumTcxCodedLines(
+ const Word16 bwidth /* i : audio bandwidth */
+)
{
Word16 tcx_coded_lines;
@@ -449,18 +709,17 @@ Word16 getNumTcxCodedLines(const Word16 bwidth)
}
Word16 getTcxLpcShapedAri(
- const Word32 total_brate,
- const Word16 bwidth
- ,const Word16 rf_mode
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 rf_mode, /* i : flag to signal the RF mode */
+ const Word16 element_mode /* i : IVAS element mode */
)
{
Word16 tcx_lpc_shaped_ari = 0;
move16();
-
- (void) bwidth;
-
- test();
- if( (LE_32(total_brate, LPC_SHAPED_ARI_MAX_RATE))||rf_mode)
+ test(); test(); test();
+ if (((LE_16(element_mode, IVAS_SCE) && LE_32(total_brate, LPC_SHAPED_ARI_MAX_RATE)) ||
+ (GT_16(element_mode, IVAS_SCE) && LE_32(total_brate, LPC_SHAPED_ARI_MAX_RATE_CPE))) ||
+ rf_mode)
{
tcx_lpc_shaped_ari = 1;
move16();
@@ -469,3 +728,236 @@ Word16 getTcxLpcShapedAri(
return tcx_lpc_shaped_ari;
}
+#ifdef IVAS_CODE_COM_CONFIG_P1
+/*-----------------------------------------------------------------------*
+ * init_tcx_window_cfg()
+ *
+ * Initialization of TCX windows
+ *-----------------------------------------------------------------------*/
+
+void init_tcx_window_cfg(
+ TCX_CONFIG_HANDLE hTcxCfg, /* i/o: TCX Config handle */
+ const int32_t sr_core, /* i : SR core */
+ const int32_t input_Fs, /* i : input/output SR */
+ const int16_t L_frame, /* i : L_frame at sr_core */
+ const int16_t L_frameTCX, /* i : L_frame at i/o SR */
+ const int16_t encoderLookahead_enc, /* i : encoder LA at sr_core */
+ const int16_t encoderLookahead_FB, /* i : encoder LA at i/o SR */
+ const int16_t mdctWindowLength, /* i : window length at sr_core */
+ const int16_t mdctWindowLengthFB, /* i : window length at i/o SR */
+ const int16_t element_mode /* i : mode of CPE/SCE */
+)
+{
+ /* Symmetric window = sine LD window*/
+ hTcxCfg->tcx_mdct_window_delay = mdctWindowLength;
+ hTcxCfg->tcx_mdct_window_delayFB = mdctWindowLengthFB;
+ hTcxCfg->tcx_mdct_window_length = mdctWindowLength;
+ hTcxCfg->tcx_mdct_window_lengthFB = mdctWindowLengthFB;
+
+ mdct_window_sine(hTcxCfg->tcx_mdct_window, sr_core, hTcxCfg->tcx_mdct_window_length, FULL_OVERLAP, element_mode);
+ if (hTcxCfg->tcx_mdct_window_length == hTcxCfg->tcx_mdct_window_lengthFB)
+ {
+ mvr2r(hTcxCfg->tcx_mdct_window, hTcxCfg->tcx_mdct_windowFB, hTcxCfg->tcx_mdct_window_length);
+ }
+ else
+ {
+ mdct_window_sine(hTcxCfg->tcx_mdct_windowFB, input_Fs, hTcxCfg->tcx_mdct_window_lengthFB, FULL_OVERLAP, element_mode);
+ }
+
+ /*ALDO windows for MODE2*/
+ mdct_window_aldo(hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_2, L_frame);
+ mdct_window_aldo(hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_2_FB, NS2SA(input_Fs, FRAME_SIZE_NS));
+ hTcxCfg->tcx_aldo_window_1_trunc = hTcxCfg->tcx_aldo_window_1 + NS2SA(sr_core, N_ZERO_MDCT_NS);
+ hTcxCfg->tcx_aldo_window_1_FB_trunc = hTcxCfg->tcx_aldo_window_1_FB + NS2SA(input_Fs, N_ZERO_MDCT_NS);
+
+ /*1.25ms transition window for ACELP->TCX*/
+ hTcxCfg->tcx_mdct_window_trans_length = NS2SA(sr_core, ACELP_TCX_TRANS_NS);
+ mdct_window_sine(hTcxCfg->tcx_mdct_window_trans, sr_core, hTcxCfg->tcx_mdct_window_trans_length, TRANSITION_OVERLAP, element_mode);
+ hTcxCfg->tcx_mdct_window_trans_lengthFB = NS2SA(input_Fs, ACELP_TCX_TRANS_NS);
+ if (hTcxCfg->tcx_mdct_window_trans_length == hTcxCfg->tcx_mdct_window_trans_lengthFB)
+ {
+ mvr2r(hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_trans_length);
+ }
+ else
+ {
+ mdct_window_sine(hTcxCfg->tcx_mdct_window_transFB, input_Fs, hTcxCfg->tcx_mdct_window_trans_lengthFB, TRANSITION_OVERLAP, element_mode);
+ }
+
+ /*Mid-OLA*/
+ /*compute minimum length for "half" window: lookahead - 5ms. It must be also multiple of 2*/
+ hTcxCfg->tcx_mdct_window_half_length = 2 * ((encoderLookahead_enc - (int16_t)(0.005f * sr_core + 0.5f)) >> 1);
+ hTcxCfg->tcx_mdct_window_half_lengthFB = 2 * ((encoderLookahead_FB - (int16_t)(0.005f * input_Fs + 0.5f)) >> 1);
+ assert((hTcxCfg->tcx_mdct_window_half_length > 16) && "Half window can not be large enough!");
+
+ mdct_window_sine(hTcxCfg->tcx_mdct_window_half, sr_core, hTcxCfg->tcx_mdct_window_half_length, HALF_OVERLAP, element_mode);
+ if (hTcxCfg->tcx_mdct_window_half_length == hTcxCfg->tcx_mdct_window_half_lengthFB)
+ {
+ mvr2r(hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_half_length);
+ }
+ else
+ {
+ mdct_window_sine(hTcxCfg->tcx_mdct_window_halfFB, input_Fs, hTcxCfg->tcx_mdct_window_half_lengthFB, HALF_OVERLAP, element_mode);
+ }
+
+ /* minimum overlap 1.25 ms */
+ hTcxCfg->tcx_mdct_window_min_length = (int16_t)(sr_core * INV_CLDFB_BANDWIDTH);
+ hTcxCfg->tcx_mdct_window_min_lengthFB = (int16_t)(input_Fs * INV_CLDFB_BANDWIDTH);
+ /* save complexity by copying the small windows if they have the same length */
+ if (hTcxCfg->tcx_mdct_window_min_length == hTcxCfg->tcx_mdct_window_trans_length)
+ {
+ mvr2r(hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_min_length);
+ }
+ else
+ {
+ mdct_window_sine(hTcxCfg->tcx_mdct_window_minimum, sr_core, hTcxCfg->tcx_mdct_window_min_length, MIN_OVERLAP, element_mode);
+ }
+
+ if (hTcxCfg->tcx_mdct_window_min_lengthFB == hTcxCfg->tcx_mdct_window_trans_lengthFB)
+ {
+ mvr2r(hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_min_lengthFB);
+ }
+ else if (hTcxCfg->tcx_mdct_window_min_length == hTcxCfg->tcx_mdct_window_min_lengthFB)
+ {
+ mvr2r(hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_min_lengthFB);
+ }
+ else
+ {
+ mdct_window_sine(hTcxCfg->tcx_mdct_window_minimumFB, input_Fs, hTcxCfg->tcx_mdct_window_min_lengthFB, MIN_OVERLAP, element_mode);
+ }
+
+ /* TCX Offset */
+ hTcxCfg->tcx_offset = (hTcxCfg->tcx_mdct_window_delay >> 1);
+ hTcxCfg->tcx_offsetFB = (hTcxCfg->tcx_mdct_window_delayFB >> 1);
+ /*<0 rectangular transition with optimized window size = L_frame+L_frame/4*/
+ hTcxCfg->lfacNext = hTcxCfg->tcx_offset - L_frame / 4;
+ hTcxCfg->lfacNextFB = hTcxCfg->tcx_offsetFB - L_frameTCX / 4;
+
+ return;
+}
+
+/*-----------------------------------------------------------------------*
+ * init_tcx()
+ *
+ * Initialization of TCX
+ *-----------------------------------------------------------------------*/
+
+void init_tcx_cfg(
+ TCX_CONFIG_HANDLE hTcxCfg,
+ const int32_t total_brate,
+ const int32_t sr_core,
+ const int32_t input_Fs,
+ const int16_t L_frame,
+ const int16_t bwidth,
+ const int16_t L_frameTCX,
+ const int16_t fscale,
+ const int16_t encoderLookahead_enc,
+ const int16_t encoderLookahead_FB,
+ const float preemph_fac,
+ const int16_t tcxonly,
+ const int16_t rf_mode,
+ const int16_t igf,
+ const int16_t infoIGFStopFreq,
+ const int16_t element_mode,
+ const int16_t ini_frame,
+ const int16_t is_mct
+)
+{
+ int16_t i;
+ int16_t mdctWindowLength;
+ int16_t mdctWindowLengthFB;
+ int16_t na_scale_bwidth;
+
+ hTcxCfg->preemph_fac = preemph_fac;
+ hTcxCfg->tcx5Size = NS2SA(sr_core, FRAME_SIZE_NS / 4); /* Always 5 ms */
+ hTcxCfg->tcx5SizeFB = NS2SA(input_Fs, FRAME_SIZE_NS / 4); /* Always 5 ms */
+
+ hTcxCfg->tcx_mdct_window_length_old = hTcxCfg->tcx_mdct_window_length;
+ mdctWindowLength = getMdctWindowLength(fscale);
+ mdctWindowLengthFB = (int16_t)(mdctWindowLength * input_Fs / sr_core);
+
+ init_tcx_window_cfg(hTcxCfg, sr_core, input_Fs, L_frame, L_frameTCX, encoderLookahead_enc, encoderLookahead_FB, mdctWindowLength, mdctWindowLengthFB, element_mode);
+
+ /* SQ deadzone & memory quantization*/
+ hTcxCfg->sq_rounding = 0.375f; /*deadzone of 1.25->rounding=1-1.25/2 (No deadzone=0.5)*/
+
+ /* TCX rate loop */
+ hTcxCfg->tcxRateLoopOpt = (tcxonly) ? 2 : 0;
+ hTcxCfg->tcxRateLoopOpt = (element_mode == IVAS_CPE_MDCT) ? 3 : hTcxCfg->tcxRateLoopOpt;
+
+ /* TCX bandwidth */
+ hTcxCfg->bandwidth = getTcxBandwidth(bwidth);
+
+ /* set number of coded lines */
+ hTcxCfg->tcx_coded_lines = getNumTcxCodedLines(bwidth);
+
+ /* TNS in TCX */
+ hTcxCfg->pCurrentTnsConfig = NULL;
+ hTcxCfg->fIsTNSAllowed = getTnsAllowed(total_brate, igf, element_mode);
+
+ if (hTcxCfg->fIsTNSAllowed)
+ {
+ InitTnsConfigs(bwidth, hTcxCfg->tcx_coded_lines, hTcxCfg->tnsConfig, infoIGFStopFreq, total_brate, element_mode, is_mct);
+
+ SetAllowTnsOnWhite(hTcxCfg->tnsConfig, element_mode == IVAS_CPE_MDCT);
+ }
+
+ if (ini_frame == 0)
+ {
+ hTcxCfg->tcx_curr_overlap_mode = hTcxCfg->tcx_last_overlap_mode = ALDO_WINDOW;
+ hTcxCfg->last_aldo = 1;
+ }
+
+ /* Context HM*/
+ hTcxCfg->ctx_hm = getCtxHm(element_mode, total_brate, rf_mode);
+
+ /* Residual Coding*/
+ hTcxCfg->resq = getResq(total_brate);
+ hTcxCfg->tcxRateLoopOpt = (hTcxCfg->resq && !tcxonly) ? 1 : hTcxCfg->tcxRateLoopOpt;
+
+ /*Set bandwidth scale*/
+ if (bwidth == NB)
+ {
+ na_scale_bwidth = NB;
+ }
+ else if (sr_core <= INT_FS_16k)
+ {
+ na_scale_bwidth = WB;
+ }
+ else
+ {
+ na_scale_bwidth = SWB;
+ }
+
+ /* Scale TCX for non-active frames to adjust loudness with ACELP*/
+ hTcxCfg->na_scale = 1.f;
+
+ if (na_scale_bwidth < SWB && !tcxonly)
+ {
+ for (i = 0; i < SIZE_SCALE_TABLE_TCX; i++)
+ {
+ if ((na_scale_bwidth == scaleTcxTable[i].bwmode) &&
+ (total_brate >= scaleTcxTable[i].bitrateFrom) &&
+ (total_brate < scaleTcxTable[i].bitrateTo))
+ {
+ if (rf_mode)
+ {
+ i--;
+ }
+ hTcxCfg->na_scale = scaleTcxTable[i].scale;
+ break;
+ }
+ }
+ }
+
+ if (tcxonly)
+ {
+ InitPsychLPC(sr_core, L_frame, hTcxCfg);
+ }
+ else
+ {
+ hTcxCfg->psychParamsCurrent = NULL;
+ }
+
+ return;
+}
+#endif
\ No newline at end of file
diff --git a/lib_com/deemph_fx.c b/lib_com/deemph_fx.c
index 56e32fc65a8d80c444eb10c01f518613cdf4da19..5b2f5ae294f8d71493e4de988d07b8d61f443aca 100644
--- a/lib_com/deemph_fx.c
+++ b/lib_com/deemph_fx.c
@@ -1,10 +1,9 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h"
#include "basop_util.h"
/*========================================================================*/
diff --git a/lib_com/delay_comp.c b/lib_com/delay_comp.c
index f67b752c4c5ab1af305a634f92673fbdab2754ed..52962fe47c926728d30558bda86cb8fbf6d8a255 100644
--- a/lib_com/delay_comp.c
+++ b/lib_com/delay_comp.c
@@ -2,40 +2,91 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h" /* Compilation switches */
-#include "stl.h"
#include "prot_fx.h"
+#include "ivas_cnst.h"
/*--------------------------------------------------------------------------
* get_delay_fx()
*
-* Function returns various types of delays in the codec in ms.
+* Function returns various types of delays in the codec in ns.
*--------------------------------------------------------------------------*/
-Word32 get_delay_fx( /* o : delay value in ms */
- const Word16 what_delay, /* i : what delay? (ENC or DEC) */
- const Word32 io_fs /* i : input/output sampling frequency */
+Word32 get_delay_fx( /* o : delay value in ms */
+ const Word16 what_delay, /* i : what delay? (ENC or DEC) */
+ const Word32 io_fs, /* i : input/output sampling frequency */
+ const IVAS_FORMAT ivas_format, /* i : IVAS format */
+ HANDLE_CLDFB_FILTER_BANK hCldfb /* i : Handle of Cldfb analysis */
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+ ,
+ const AUDIO_CONFIG output_config /* i : decoder output config */
+#endif
)
{
- Word32 delay = 0;
+ Word32 delay = 0;
IF( EQ_16(what_delay,ENC))
{
- delay = (DELAY_FIR_RESAMPL_NS + ACELP_LOOK_NS);
- move32();
+ IF (EQ_16(ivas_format, MONO_FORMAT)) /* EVS mono */
+ {
+ delay = (DELAY_FIR_RESAMPL_NS + ACELP_LOOK_NS);
+ move32();
+ }
+ ELSE
+ {
+ delay = IVAS_ENC_DELAY_NS;
+ test();
+ IF (EQ_16(ivas_format, MASA_FORMAT) || EQ_16(ivas_format, MASA_ISM_FORMAT) )
+ {
+ delay = 0; /* All delay is compensated in the decoder with MASA */
+ }
+ }
+ test();
+ IF (EQ_16(ivas_format, SBA_FORMAT) || EQ_16(ivas_format, SBA_ISM_FORMAT))
+ {
+ /* compensate for DirAC/SPAR filterbank delay */
+ delay += IVAS_FB_ENC_DELAY_NS;
+ }
}
ELSE
{
- IF( EQ_32(io_fs,8000))
+ IF (EQ_16(ivas_format, MONO_FORMAT)) /* EVS mono */
{
- delay = DELAY_CLDFB_NS;
- move32();
+ IF(EQ_32(io_fs,8000))
+ {
+ delay = DELAY_CLDFB_NS;
+ move32();
+ }
+ ELSE
+ {
+ delay = DELAY_BWE_TOTAL_NS;
+ move32();
+ }
}
- ELSE
+ ELSE /* IVAS */
{
- delay = DELAY_BWE_TOTAL_NS;
- move32();
+ delay = IVAS_DEC_DELAY_NS;
+
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+
+ IF (NE_16(output_config, AUDIO_CONFIG_BINAURAL_SPLIT_CODED))
+ {
+#endif
+ IF (hCldfb != NULL)
+ {
+ /* compensate for filterbank delay */
+ delay += IVAS_FB_DEC_DELAY_NS;
+ }
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+ }
+#endif
+ test();
+ IF (EQ_16(ivas_format, MASA_FORMAT) || EQ_16(ivas_format, MASA_ISM_FORMAT) )
+ {
+ delay += IVAS_ENC_DELAY_NS; /* Compensate also the encoder delay in the decoder with MASA */
+ }
}
}
diff --git a/lib_com/dlpc_bfi.c b/lib_com/dlpc_bfi.c
index 4271e1cec393eef5c8b89098018a11d09f4dba97..7b79911e1466ca30398c08c196b4fc7062c12819 100644
--- a/lib_com/dlpc_bfi.c
+++ b/lib_com/dlpc_bfi.c
@@ -4,24 +4,22 @@
/* Header files */
-#include
-#include
-#include
+#include
+#include "options.h"
#include "prot_fx.h"
-#include "stl.h"
#include "prot_fx.h"
void dlpc_bfi(
const Word16 L_frame,
Word16 *lsf_q, /* o : quantized LSFs */
- const Word16 *lsfold, /* i : past quantized LSF */
- const Word16 last_good, /* i : last good received frame */
- const Word16 nbLostCmpt, /* i : counter of consecutive bad frames */
+ const Word16 *lsfold, /* i : past quantized LSF */
+ const Word16 last_good, /* i : last good received frame */
+ const Word16 nbLostCmpt, /* i : counter of consecutive bad frames */
Word16 mem_MA[], /* i/o: quantizer memory for MA model */
Word16 mem_AR[], /* i/o: quantizer memory for AR model */
Word16 *stab_fac, /* i : LSF stability factor */
Word16 *lsf_adaptive_mean,/* i : LSF adaptive mean, updated when BFI==0 */
- Word16 numlpc, /* i : Number of division per superframe */
+ Word16 numlpc, /* i : Number of division per superframe */
Word16 lsf_cng[],
Word8 plcBackgroundNoiseUpdated,
Word16 *lsf_q_cng, /* o : quantized LSFs */
@@ -31,24 +29,14 @@ void dlpc_bfi(
)
{
- lsf_dec_bfi(
- MODE2,
- &lsf_q[0], lsfold, lsf_adaptive_mean, lsfBase, mem_MA, mem_AR, *stab_fac,
- 0, L_frame, last_good, nbLostCmpt,
- plcBackgroundNoiseUpdated, lsf_q_cng, lsf_cng, old_lsf_q_cng, 0, 0, tcxonly
- ,0
+ lsf_dec_bfi(MODE2, &lsf_q[0], lsfold, lsf_adaptive_mean, lsfBase, mem_MA, mem_AR, *stab_fac,
+ 0, L_frame, last_good, nbLostCmpt, plcBackgroundNoiseUpdated, lsf_q_cng, lsf_cng, old_lsf_q_cng, 0, 0, tcxonly, 0);
- );
IF ( EQ_16(numlpc,2))
{
/* Decode the second LPC */
- lsf_dec_bfi(
- MODE2,
- &lsf_q[M], &lsf_q[0], lsf_adaptive_mean, lsfBase, mem_MA, mem_AR, *stab_fac,
- 0, L_frame, last_good, nbLostCmpt+1,
- plcBackgroundNoiseUpdated, lsf_q_cng, lsf_cng, old_lsf_q_cng, 0, 0, tcxonly
- ,0
- );
+ lsf_dec_bfi(MODE2, &lsf_q[M], &lsf_q[0], lsf_adaptive_mean, lsfBase, mem_MA, mem_AR, *stab_fac,
+ 0, L_frame, last_good, nbLostCmpt+1, plcBackgroundNoiseUpdated, lsf_q_cng, lsf_cng, old_lsf_q_cng, 0, 0, tcxonly, 0);
}
/**/ /*No local variabvles defined*/
}
diff --git a/lib_com/edct_fx.c b/lib_com/edct_fx.c
index f45a54fa36dff4b351bc343a59ebb81a9f0637d4..685f62be7aaf78a94f29f08b7c87b8adfbea6ff4 100644
--- a/lib_com/edct_fx.c
+++ b/lib_com/edct_fx.c
@@ -209,7 +209,6 @@ void edst_fx(
return;
}
-
/*========================================================================*/
/* FUNCTION : edct_fx() */
/*------------------------------------------------------------------------*/
@@ -231,10 +230,12 @@ void edst_fx(
/* _ None */
/*========================================================================*/
void edct_16fx(
- const Word16 *x, /* i : input signal Qx */
- Word16 *y, /* o : output transform Qx */
- Word16 length, /* i : length */
- Word16 bh /* bit-headroom */
+ const Word16 *x, /* i : input signal Qx */
+ Word16 *y, /* o : output transform Qx */
+ Word16 length, /* i : length */
+ Word16 bh, /* bit-headroom */
+ const Word16 element_mode
+
)
{
Word16 i;
@@ -250,7 +251,9 @@ void edct_16fx(
Word16 Len2, i2;
const Word16 *px, *pt;
Word16 *py;
-
+#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING
+ MY_UNUSED_Word(element_mode)
+#endif
/*COMPLETE: some eDCT sub function are missing */
IF (EQ_16(length,L_FRAME32k))
diff --git a/lib_com/enhancer_fx.c b/lib_com/enhancer_fx.c
index 81b8097abbcce4af3a8ecde7192d01fbc61f2b30..9f74f578287dc814b8b3b34db17286bb74ea24d2 100644
--- a/lib_com/enhancer_fx.c
+++ b/lib_com/enhancer_fx.c
@@ -1,12 +1,11 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "rom_com_fx.h" /* Static table prototypes */
-#include "stl.h"
#include "basop_util.h"
/*---------------------------------------------------------------------*
@@ -125,6 +124,7 @@ void enhancer_fx(
move16(); /* low dispersion */
}
}
+
phase_dispersion_fx(norm_gain_code, gain_pit, code, i, dm_fx);
/*------------------------------------------------------------
diff --git a/lib_com/enr_1_az_fx.c b/lib_com/enr_1_az_fx.c
index 47f6c0e7eaa314363c99940c7c846ed0f401cad6..6a608f674d4859c6bab0a3864f3358688dd3265e 100644
--- a/lib_com/enr_1_az_fx.c
+++ b/lib_com/enr_1_az_fx.c
@@ -1,11 +1,10 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h"
/*-------------------------------------------------------------------*
* Enr_1_Az_fx_12Q3()
diff --git a/lib_com/env_adj_fx.c b/lib_com/env_adj_fx.c
index 1ad3c62f02824e120f3ce24e4e9b6e23e19119d3..897c3e14a22f9e99ad4741c17d9a3a74c14be4ae 100644
--- a/lib_com/env_adj_fx.c
+++ b/lib_com/env_adj_fx.c
@@ -1,7 +1,7 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "rom_com_fx.h" /* Static table prototypes */
@@ -18,7 +18,7 @@ void env_adj_fx
const Word16 *pulses, /* i : number of pulses per band Q0 */
const Word16 length, /* i : length of spectrum Q0 */
const Word16 last_sfm, /* i : index of the last band Q0 */
- Word16 *adj, /* o : adjustment factors for the envelope Q15 */
+ Word16 *adj, /* o : adjustment factors for the envelope Q15 */
const Word16 env_stab, /* i : envelope stability Q15 */
const Word16 *sfmsize /* i : subband sizes Q0 */
)
diff --git a/lib_com/env_stab_fx.c b/lib_com/env_stab_fx.c
index e3e8c63297f0c51402ac555e456a91360aa4df45..f9ec7d4467c467cf98eb9c9816234d1cf14f3778 100644
--- a/lib_com/env_stab_fx.c
+++ b/lib_com/env_stab_fx.c
@@ -1,12 +1,11 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
-#include "options.h" /* Compilation switches */
-#include "cnst_fx.h" /* Common constants */
-#include "prot_fx.h" /* Function prototypes */
-#include "rom_com_fx.h" /* Static table prototypes */
-#include "stl.h" /* required by wmc_tool */
+#include
+#include "options.h" /* Compilation switches */
+#include "cnst_fx.h" /* Common constants */
+#include "prot_fx.h" /* Function prototypes */
+#include "rom_com_fx.h" /* Static table prototypes */
/*--------------------------------------------------------------------------*
* Local constants
@@ -20,11 +19,12 @@
/* Envelope stability measure */
/*--------------------------------------------------------------------------*/
-Word16 env_stability_fx( /* in Q15 */
- const Word16 *ynrm, /*i: Norm vector for current frame */
- const Word16 nb_sfm, /*i: Number of sub-bands */
- Word16 *mem_norm, /*i/o: Norm vector memory from past frame */
- Word16 *mem_env_delta /*i/o: Envelope stability memory for smoothing in Q12 */
+Word16 env_stability_fx( /* in Q15 */
+ const Word16* ynrm, /*i: Norm vector for current frame */
+ const Word16 nb_sfm, /*i: Number of sub-bands */
+ Word16* mem_norm, /*i/o: Norm vector memory from past frame */
+ Word16* mem_env_delta, /*i/o: Envelope stability memory for smoothing in Q12 */
+ const Word16 core_switching_flag/* i : Core switching flag */
)
{
Word16 env_delta;
@@ -36,43 +36,54 @@ Word16 env_stability_fx( /* in Q15 */
Word32 L_tmp, L_env_delta;
Word16 inv_nb_sfm;
- /* Calculate envelope stability parameter */
- L_env_delta = L_deposit_l(0);
- FOR (i = 0; i < nb_sfm; i++)
+ IF (core_switching_flag)
{
- tmp = sub(mem_norm[i],ynrm[i]);
- L_env_delta = L_mac0(L_env_delta, tmp, tmp);
- mem_norm[i] = ynrm[i];
- move16();
+ FOR (i = 0; i < nb_sfm; i++)
+ {
+ mem_norm[i] = ynrm[i]; move16();
+ }
+ Overflow = 0; move16();
+ env_delta = shl(*mem_env_delta, 1);
}
-
- inv_nb_sfm = 19418; /* Q19 */ move16();
- if (nb_sfm == 26)
+ ELSE
{
- inv_nb_sfm = 20165; /* Q19 */ move16();
- }
- exp = norm_l(L_env_delta);
- L_env_delta = Mult_32_16(L_shl(L_env_delta, exp), inv_nb_sfm); /* 0+exp+19-15 */
+ /* Calculate envelope stability parameter */
+ L_env_delta = L_deposit_l(0);
+ FOR(i = 0; i < nb_sfm; i++)
+ {
+ tmp = sub(mem_norm[i], ynrm[i]);
+ L_env_delta = L_mac0(L_env_delta, tmp, tmp);
+ mem_norm[i] = ynrm[i];
+ move16();
+ }
- L_tmp = Sqrt_l(L_env_delta, &exp2); /* exp+4+31+exp2 */
+ inv_nb_sfm = 19418; /* Q19 */ move16();
+ if (nb_sfm == 26)
+ {
+ inv_nb_sfm = 20165; /* Q19 */ move16();
+ }
+ exp = norm_l(L_env_delta);
+ L_env_delta = Mult_32_16(L_shl(L_env_delta, exp), inv_nb_sfm); /* 0+exp+19-15 */
- exp = add(35, add(exp, exp2));
- if ( EQ_16(s_and(exp, 1), 1))
- {
- L_tmp = Mult_32_16(L_tmp, 23170); /* 1/sqrt(2) in Q15 */
- }
- exp = shr(exp, 1);
+ L_tmp = Sqrt_l(L_env_delta, &exp2); /* exp+4+31+exp2 */
- env_delta = round_fx(L_shl(L_tmp, sub(26, exp))); /* Q10 */
+ exp = add(35, add(exp, exp2));
+ if (EQ_16(s_and(exp, 1), 1))
+ {
+ L_tmp = Mult_32_16(L_tmp, 23170); /* 1/sqrt(2) in Q15 */
+ }
+ exp = shr(exp, 1);
- L_tmp = L_mult0(26214, env_delta); /* 26214 is 0.1 in Q18. Q28 */
- L_tmp = L_mac(L_tmp, 29491, *mem_env_delta); /* 29491 is 0.9 in Q15. Q28 */
+ env_delta = round_fx(L_shl(L_tmp, sub(26, exp))); /* Q10 */
- *mem_env_delta = round_fx(L_tmp); /* Q12 */
- Overflow = 0;
- move16();
- env_delta = round_fx(L_shl(L_tmp, 1)); /* Q13 */
+ L_tmp = L_mult0(26214, env_delta); /* 26214 is 0.1 in Q18. Q28 */
+ L_tmp = L_mac(L_tmp, 29491, *mem_env_delta); /* 29491 is 0.9 in Q15. Q28 */
+ *mem_env_delta = round_fx(L_tmp); /* Q12 */
+ Overflow = 0;
+ move16();
+ env_delta = round_fx(L_shl(L_tmp, 1)); /* Q13 */
+ }
IF (Overflow != 0) /* Saturated due to the above up-shifting operation. */
{
return stab_trans_fx[L_STAB_TBL-1]; /* The highest quantized index. */
diff --git a/lib_com/env_stab_trans_fx.c b/lib_com/env_stab_trans_fx.c
index 6e86bca565b2981cb1b1d0eeedba19517d571c28..da31fc71ede5e2f4dfaa21c6c54920f4cbe4c22b 100644
--- a/lib_com/env_stab_trans_fx.c
+++ b/lib_com/env_stab_trans_fx.c
@@ -1,13 +1,12 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "rom_com_fx.h" /* Static table prototypes */
#include "math_op.h" /* WMOPS macros */
-#include "stl.h" /* required by wmc_tool */
/*--------------------------------------------------------------------------*
* env_stab_transient_detect()
@@ -16,15 +15,15 @@
*--------------------------------------------------------------------------*/
void env_stab_transient_detect_fx(
- const Word16 is_transient, /* i: Transient flag */
- const Word16 length, /* i : Length of spectrum (32 or 48 kHz) */
- const Word16 norm[], /* i : quantization indices for norms */
- Word16 *no_att_hangover, /* i/o: Frame counter for attenuation hangover (Q0) */
- Word32 *L_energy_lt, /* i/o: Long-term energy measure for transient detection (Q13) */
- const Word16 HQ_mode, /* i : HQ coding mode */
- const Word16 bin_th, /* i : HVQ cross-over frequency bin */
- const Word32 *L_coeff, /* i : Coded spectral coefficients */
- const Word16 Qcoeff /* i : Q of coded spectral coefficients */
+ const Word16 is_transient, /* i: Transient flag */
+ const Word16 length, /* i : Length of spectrum (32 or 48 kHz) */
+ const Word16 norm[], /* i : quantization indices for norms */
+ Word16 *no_att_hangover, /* i/o: Frame counter for attenuation hangover (Q0) */
+ Word32 *L_energy_lt, /* i/o: Long-term energy measure for transient detection (Q13) */
+ const Word16 HQ_mode, /* i : HQ coding mode */
+ const Word16 bin_th, /* i : HVQ cross-over frequency bin */
+ const Word32 *L_coeff, /* i : Coded spectral coefficients */
+ const Word16 Qcoeff /* i : Q of coded spectral coefficients */
)
{
Word16 i, blk, norm_ind, sqrt_exp, bin_th_1, temp, sh;
diff --git a/lib_com/est_tilt_fx.c b/lib_com/est_tilt_fx.c
index 07a7ac03db0ce8d384756e1ed0938f01f393c99d..3fcb1ac07ffbfbf3fe1fed0fdb5032f4e69dd1a3 100644
--- a/lib_com/est_tilt_fx.c
+++ b/lib_com/est_tilt_fx.c
@@ -34,19 +34,24 @@
/* RETURN ARGUMENTS : */
/* _ (Word16) tolt_code : tilt of the code Q15 */
/*=======================================================================*/
-Word16 est_tilt_fx( /* o : tilt of the code Q15 */
- const Word16 *exc, /* i : adaptive excitation vector Qx */
- const Word16 gain_pit, /* i : adaptive gain Q14 */
- const Word16 *code, /* i : algebraic exctitation vector Q9 */
- const Word32 gain_code, /* i : algebraic code gain Q16 */
- Word16 *voice_fac, /* o : voicing factor Q15 */
- const Word16 Q_exc /* i : Scaling factor of excitation Q0 */
+Word16 est_tilt_fx( /* o : tilt of the code Q15 */
+ const Word16 *exc, /* i : adaptive excitation vector Qx */
+ const Word16 gain_pit, /* i : adaptive gain Q14 */
+ const Word16 *code, /* i : algebraic excitation vector Q9 */
+ const Word32 gain_code, /* i : algebraic code gain Q16 */
+ Word16 *voice_fac, /* o : voicing factor Q15 */
+ const Word16 Q_exc /* i : Scaling factor of excitation Q0 */
+#ifdef ADD_LRTD
+ ,const Word16 L_subfr /* i : Sub frame length */
+#endif
)
{
Word16 i, tmp, exp, ener1, exp1, ener2, exp2;
Word32 L_tmp;
Word16 tilt_code;
-
+#ifdef ADD_LRTD
+ PMT("FIX POINT NEED to be adapted for 16 kHz frame length ")
+#endif
ener1 = extract_h(Dot_product12(exc, exc, L_SUBFR, &exp1));
exp1 = sub(exp1, add(Q_exc, Q_exc));
L_tmp = L_mult(gain_pit, gain_pit); /* energy of pitch excitation */
diff --git a/lib_com/fd_cng_com.c b/lib_com/fd_cng_com.c
index 400a41d8e78c6647600445e9e622d653ab601d77..7432d05d3bd5fbc795ade6ce42d419f585f82f5c 100644
--- a/lib_com/fd_cng_com.c
+++ b/lib_com/fd_cng_com.c
@@ -3,130 +3,152 @@
====================================================================================*/
#include
-#include "stl.h"
+#include
+#include "options.h"
#include "basop_util.h"
#include "options.h"
-#include "stl.h"
#include "rom_basop_util.h"
#include "rom_com_fx.h"
#include "prot_fx.h"
#define DELTA_SHIFT 2
#define DELTA_SHIFT_LD64 67108864l/*DELTA_SHIFT/64.0 Q31*/
+#define CNG_HS 4 /* 4 bit headroom for dot product */
+#define CNG_S 6 /* 1 sign bit, 6 bit integer part, 9 bit frational part for input and output data */
-
-
-/*****************************************
-* Create an instance of type FD_CNG_COM *
-*****************************************/
-void createFdCngCom(HANDLE_FD_CNG_COM * hFdCngCom)
+ /*-------------------------------------------------------------------
+ * Local function prototypes
+ *-------------------------------------------------------------------*/
+static void getmidbands(const Word16* part, const Word16 npart, Word16* midband, Word16* psize,
+ Word16* psize_norm, Word16* psize_norm_exp, Word16* psize_inv);
+
+
+
+ /*-------------------------------------------------------------------
+ * createFdCngCom()
+ *
+ * Create an instance of type FD_CNG_COM
+ *-------------------------------------------------------------------*/
+ivas_error createFdCngCom(
+ HANDLE_FD_CNG_COM * hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */
+)
{
HANDLE_FD_CNG_COM hs;
/* Allocate memory */
- hs = (HANDLE_FD_CNG_COM) calloc(1, sizeof (FD_CNG_COM));
- move16();
+ hs = (HANDLE_FD_CNG_COM)count_malloc(sizeof(FD_CNG_COM));
+ if (hs == NULL)
+ {
+ return IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for FD CNG COM");
+ }
*hFdCngCom = hs;
- move16();
- return;
+
+ return IVAS_ERR_OK;
}
+/*-------------------------------------------------------------------
+ * initFdCngCom()
+ *
+ *
+ *-------------------------------------------------------------------*/
-void initFdCngCom(HANDLE_FD_CNG_COM hs, Word16 scale)
+void initFdCngCom(HANDLE_FD_CNG_COM hFdCngCom, Word16 scale)
{
/* Calculate CLDFB scaling factor */
/* shl(i_mult2(scale, scale), 3) does not fit in 16 bit */
- /*hs->scalingFactor = div_s(1, shl(i_mult2(scale, scale), 3));*/
+ /*hFdCngCom->scalingFactor = div_s(1, shl(i_mult2(scale, scale), 3));*/
assert(2048/*1.0/(1<<4) Q15*/ < mult(scale, scale));
/* Exponent invScalingFactor: -16 = -(2*7 (scale) + 2 (8.0) */
- hs->invScalingFactor = shl(mult(scale,scale),1);
+ hFdCngCom->invScalingFactor = shl(mult(scale,scale),1);
/* Exponent scalingFactor: -15 = -(2*7 (scale) + 2 (8.0) - 1 (1.0)) */
- hs->scalingFactor = div_s(0x4000,hs->invScalingFactor);
+ hFdCngCom->scalingFactor = div_s(0x4000,hFdCngCom->invScalingFactor);
/* Initialize the overlap-add */
- set16_fx( hs->timeDomainBuffer, 0, L_FRAME16k );
- hs->olapBufferAna = NULL;
+ set16_fx( hFdCngCom->timeDomainBuffer, 0, L_FRAME16k );
+ hFdCngCom->olapBufferAna = NULL;
move16();
- set16_fx( hs->olapBufferSynth, 0, FFTLEN );
- hs->olapBufferSynth2 = NULL;
+ set16_fx( hFdCngCom->olapBufferSynth, 0, FFTLEN );
+ hFdCngCom->olapBufferSynth2 = NULL;
move16();
/* Initialize the comfort noise generation */
- set32_fx( hs->fftBuffer, 0, FFTLEN );
- set32_fx( hs->cngNoiseLevel, 0, FFTCLDFBLEN );
+ set32_fx( hFdCngCom->fftBuffer, 0, FFTLEN );
+ set32_fx( hFdCngCom->cngNoiseLevel, 0, FFTCLDFBLEN );
/* Initialize quantizer */
- set32_fx( hs->sidNoiseEst, 0, NPART );
- set16_fx( hs->A_cng, 0, M+1 );
- hs->A_cng[0] = 4096/*1.f Q12*/; /* 3Q12 */ move16();
+ set32_fx( hFdCngCom->sidNoiseEst, 0, NPART );
+ set16_fx( hFdCngCom->A_cng, 0, M+1 );
+ hFdCngCom->A_cng[0] = 4096/*1.f Q12*/; /* 3Q12 */ move16();
/* Set some counters and flags */
- hs->inactive_frame_counter = 0; /* Either SID or zero frames */ move16();
- hs->active_frame_counter = 0;
+ hFdCngCom->inactive_frame_counter = 0; /* Either SID or zero frames */ move16();
+ hFdCngCom->active_frame_counter = 0;
move16();
- hs->frame_type_previous = ACTIVE_FRAME;
+ hFdCngCom->frame_type_previous = ACTIVE_FRAME;
move16();
- hs->flag_noisy_speech = 0;
+ hFdCngCom->flag_noisy_speech = 0;
move16();
- hs->likelihood_noisy_speech = 0;
+ hFdCngCom->likelihood_noisy_speech = 0;
move16();
- hs->numCoreBands = 0;
+ hFdCngCom->numCoreBands = 0;
move16();
- hs->stopBand = 0;
+ hFdCngCom->stopBand = 0;
move16();
- hs->startBand = 0;
+ hFdCngCom->startBand = 0;
move16();
- hs->stopFFTbin = 0;
+ hFdCngCom->stopFFTbin = 0;
move16();
- hs->frameSize = 0;
+ hFdCngCom->frameSize = 0;
move16();
- hs->fftlen = 0;
+ hFdCngCom->fftlen = 0;
move16();
/* Initialize noise estimation algorithm */
- set32_fx( hs->periodog, 0, PERIODOGLEN );
- mhvals(MSNUMSUBFR*MSSUBFRLEN, &(hs->msM_win));
- mhvals(MSSUBFRLEN, &(hs->msM_subwin));
- set32_fx( hs->msPeriodogSum, 0, 2 );
- hs->msPeriodogSum_exp[0] = 0;
+ set32_fx( hFdCngCom->periodog, 0, PERIODOGLEN );
+ mhvals(MSNUMSUBFR*MSSUBFRLEN, &(hFdCngCom->msM_win));
+ mhvals(MSSUBFRLEN, &(hFdCngCom->msM_subwin));
+ set32_fx( hFdCngCom->msPeriodogSum, 0, 2 );
+ hFdCngCom->msPeriodogSum_exp[0] = 0;
move16();
- hs->msPeriodogSum_exp[1] = 0;
+ hFdCngCom->msPeriodogSum_exp[1] = 0;
move16();
- set32_fx( hs->msPsdSum, 0, 2 );
- set16_fx( hs->msSlope, 0, 2 );
- set32_fx( hs->msQeqInvAv, 0, 2 );
- hs->msQeqInvAv_exp[0] = 0;
+ set32_fx( hFdCngCom->msPsdSum, 0, 2 );
+ set16_fx( hFdCngCom->msSlope, 0, 2 );
+ set32_fx( hFdCngCom->msQeqInvAv, 0, 2 );
+ hFdCngCom->msQeqInvAv_exp[0] = 0;
move16();
- hs->msQeqInvAv_exp[1] = 0;
+ hFdCngCom->msQeqInvAv_exp[1] = 0;
move16();
- hs->msFrCnt_init_counter = 0;
+ hFdCngCom->msFrCnt_init_counter = 0;
move16();
- hs->msFrCnt_init_thresh = 1;
+ hFdCngCom->msFrCnt_init_thresh = 1;
move16();
- hs->init_old = 0;
+ hFdCngCom->init_old = 0;
move16();
- hs->offsetflag = 0;
+ hFdCngCom->offsetflag = 0;
move16();
- hs->msFrCnt = MSSUBFRLEN;
+ hFdCngCom->msFrCnt = MSSUBFRLEN;
move16();
- hs->msMinBufferPtr = 0;
+ hFdCngCom->msMinBufferPtr = 0;
move16();
- hs->msAlphaCor[0] = 644245120l/*0.3f Q31*/;
+ hFdCngCom->msAlphaCor[0] = 644245120l/*0.3f Q31*/;
move16();
- hs->msAlphaCor[1] = 644245120l/*0.3f Q31*/;
+ hFdCngCom->msAlphaCor[1] = 644245120l/*0.3f Q31*/;
move16();
/* Initialize exponents */
- hs->exp_cldfb_periodog = 0;
+ hFdCngCom->exp_cldfb_periodog = 0;
move16();
return;
}
-/*****************************************
-* Delete an instance of type FD_CNG_COM *
-*****************************************/
+/*-------------------------------------------------------------------
+ * deleteFdCngCom()
+ *
+ * Delete an instance of type FD_CNG_COM
+ *-------------------------------------------------------------------*/
void deleteFdCngCom(HANDLE_FD_CNG_COM * hFdCngCom) /* i/o: Contains the variables related to the CLDFB-based CNG process */
{
HANDLE_FD_CNG_COM hsCom;
@@ -134,28 +156,31 @@ void deleteFdCngCom(HANDLE_FD_CNG_COM * hFdCngCom) /* i/o: Contains the variable
move16();
IF (hsCom != NULL)
{
- free(hsCom);
+ count_free(hsCom);
*hFdCngCom = NULL;
move16();
}
}
-/***************************************
-* Initialize the spectral partitioning *
-****************************************/
-void initPartitions( const Word16* part_in,
- Word16 npart_in,
- Word16 startBand,
- Word16 stopBand,
- Word16* part_out,
- Word16* npart_out,
- Word16* midband,
- Word16* psize,
- Word16* psize_norm,
- Word16* psize_norm_exp,
- Word16* psize_inv,
- Word16 stopBandFR
- )
+/*-------------------------------------------------------------------
+ * initPartitions()
+ *
+ * Initialize the spectral partitioning
+ *-------------------------------------------------------------------*/
+void initPartitions(
+ const Word16* part_in,
+ const Word16 npart_in,
+ const Word16 startBand,
+ const Word16 stopBand,
+ Word16* part_out,
+ Word16* npart_out,
+ Word16* midband,
+ Word16* psize,
+ Word16* psize_norm,
+ Word16* psize_norm_exp,
+ Word16* psize_inv,
+ const Word16 stopBandFR
+)
{
Word16 i, j, len_out, tmp16;
@@ -204,20 +229,17 @@ void initPartitions( const Word16* part_in,
}
-#define CNG_HS 4 /* 4 bit headroom for dot product */
-#define CNG_S 6 /* 1 sign bit, 6 bit integer part, 9 bit frational part for input and output data */
-
-
-
-/********************************************************
-* Apply some dynamic range compression based on the log *
-********************************************************/
+/*-------------------------------------------------------------------
+ * compress_range()
+ *
+ * Apply some dynamic range compression based on the log
+ *-------------------------------------------------------------------*/
void compress_range(
Word32 *in,
- Word16 in_exp,
+ Word16 in_exp,
Word16 *out,
- Word16 len
+ const Word16 len
)
{
Word16 i;
@@ -276,14 +298,16 @@ void compress_range(
}
-/*************************************************************
-* Apply some dynamic range expansion to undo the compression *
-*************************************************************/
+/*-------------------------------------------------------------------
+ * expand_range()
+ *
+ * Apply some dynamic range expansion to undo the compression
+ *-------------------------------------------------------------------*/
void expand_range(
Word16 *in,
Word32 *out,
Word16 *out_exp,
- Word16 len
+ const Word16 len
)
{
Word16 i;
@@ -330,12 +354,15 @@ void expand_range(
}
-/*************************************************
-* Noise estimation using Minimum Statistics (MS) *
-*************************************************/
+/*-------------------------------------------------------------------
+ * minimum_statistics()
+ *
+ * Noise estimation using Minimum Statistics (MS)
+ *-------------------------------------------------------------------*/
+
void minimum_statistics (
- Word16 len, /* i : Total number of partitions (CLDFB or FFT) */
- Word16 lenFFT, /* i : Number of FFT partitions */
+ const Word16 len, /* i : Total number of partitions (CLDFB or FFT) */
+ const Word16 lenFFT, /* i : Number of FFT partitions */
Word16 *psize, /* i : Partition sizes, fractional */
Word16 *msPeriodog, /* i : Periodogram (energies) */
Word16 *msNoiseFloor, /* i/o: Noise floors (energies) */
@@ -354,7 +381,11 @@ void minimum_statistics (
Word16 *msNewMinFlag, /* i : Binary flag */
Word16 *msPeriodogBuf, /* i/o: Buffer of periodograms (energies) */
Word16 *msPeriodogBufPtr, /* i/o: Counter */
- HANDLE_FD_CNG_COM st /* i/o: FD_CNG structure containing buffers and variables */
+ HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */
+#ifdef IVAS_CODE_CNG
+ ,const Word16 enc_dec, /* i : encoder/decoder indicator */
+ const Word16 element_mode /* i : IVAS element mode type */
+#endif
)
{
Word16 i,j,k,s,s1,s2,s3;
@@ -391,9 +422,9 @@ void minimum_statistics (
len2 = i_mult(MSNUMSUBFR,len);
- msM_win = st->msM_win;
+ msM_win = hFdCngCom->msM_win;
move16();
- msM_subwin = st->msM_subwin;
+ msM_subwin = hFdCngCom->msM_subwin;
move16();
msAlphaCorAlpha = MSALPHACORALPHA;
@@ -401,11 +432,11 @@ void minimum_statistics (
msAlphaCorAlpha2 = MSALPHACORALPHA2;
move16();
- msPsdSum = st->msPsdSum;
- msPeriodogSum = st->msPeriodogSum;
+ msPsdSum = hFdCngCom->msPsdSum;
+ msPeriodogSum = hFdCngCom->msPeriodogSum;
/* No minimum statistics at initialization */
- IF ( LT_16(st->msFrCnt_init_counter,st->msFrCnt_init_thresh))
+ IF ( LT_16(hFdCngCom->msFrCnt_init_counter,hFdCngCom->msFrCnt_init_thresh))
{
Copy(msPeriodog, msPsd, len); /* 6Q9 */
Copy(msPeriodog, msNoiseFloor, len); /* 6Q9 */
@@ -426,17 +457,17 @@ void minimum_statistics (
/* Increment frame counter at initialization */
/* Some frames are sometimes zero at initialization => ignore them */
- IF ( LT_16(msPeriodog[0],st->init_old))
+ IF ( LT_16(msPeriodog[0],hFdCngCom->init_old))
{
set32_fx(msCurrentMinOut, 2147483647l/*1.0 Q31*/, len); /* 16Q15 */
set32_fx(msCurrentMin, 2147483647l/*1.0 Q31*/, len); /* 16Q15 */
set32_fx(msMinBuf, 2147483647l/*1.0 Q31*/, len2); /* 16Q15 */
set32_fx(msCurrentMinSubWindow, 2147483647l/*1.0 Q31*/, len); /* 16Q15 */
- st->msFrCnt_init_counter = add(st->msFrCnt_init_counter,1);
+ hFdCngCom->msFrCnt_init_counter = add(hFdCngCom->msFrCnt_init_counter,1);
move16();
}
- st->init_old = msPeriodog[0]; /* 6Q9 */ move16();
+ hFdCngCom->init_old = msPeriodog[0]; /* 6Q9 */ move16();
}
ELSE
{
@@ -449,7 +480,7 @@ void minimum_statistics (
move16();
stop = lenFFT;
move16();
- totsize = sub(st->stopFFTbin,st->startBand);
+ totsize = sub(hFdCngCom->stopFFTbin,hFdCngCom->startBand);
WHILE ( GT_16(stop,start))
{
current_len = sub(stop,start);
@@ -462,7 +493,7 @@ void minimum_statistics (
IF ( msPeriodogSum[cnt] == 0 )
{
- st->msAlphaCor[cnt] = Mpy_32_16_1(st->msAlphaCor[cnt], msAlphaCorAlpha);
+ hFdCngCom->msAlphaCor[cnt] = Mpy_32_16_1(hFdCngCom->msAlphaCor[cnt], msAlphaCorAlpha);
move32();
}
ELSE
@@ -510,7 +541,7 @@ void minimum_statistics (
scalar16 = shl(scalar16,s3);
scalar16 = s_max(scalar16, MSALPHACORMAX);
- st->msAlphaCor[cnt] = L_add(Mpy_32_16_1(st->msAlphaCor[cnt], msAlphaCorAlpha),
+ hFdCngCom->msAlphaCor[cnt] = L_add(Mpy_32_16_1(hFdCngCom->msAlphaCor[cnt], msAlphaCorAlpha),
L_mult(scalar16, msAlphaCorAlpha2));
move32();
}
@@ -533,7 +564,7 @@ void minimum_statistics (
msAlphaHatMin2 = MSALPHAHATMIN;
move32();
}
- scalar = Mpy_32_16_1(st->msAlphaCor[cnt], MSALPHAMAX);
+ scalar = Mpy_32_16_1(hFdCngCom->msAlphaCor[cnt], MSALPHAMAX);
FOR (j=start; jmsQeqInvAv[cnt] = QeqInvAv;
+ hFdCngCom->msQeqInvAv[cnt] = QeqInvAv;
move32();
/* New minimum? */
@@ -727,17 +758,17 @@ void minimum_statistics (
}
/* This is used later to identify local minima */
- IF ( GE_16(st->msFrCnt,MSSUBFRLEN))
+ IF ( GE_16(hFdCngCom->msFrCnt,MSSUBFRLEN))
{
FOR ( i = 0; i < 3; i++ )
{
- IF ( LT_32(st->msQeqInvAv[cnt],L_shr(L_deposit_h(msQeqInvAv_thresh[i]),CNG_S))/*0.0 Q31*/)
+ IF ( LT_32(hFdCngCom->msQeqInvAv[cnt],L_shr(L_deposit_h(msQeqInvAv_thresh[i]),CNG_S))/*0.0 Q31*/)
{
BREAK;
}
}
/* format 1Q30 */
- st->msSlope[cnt] = msNoiseSlopeMax[i];
+ hFdCngCom->msSlope[cnt] = msNoiseSlopeMax[i];
move32();
}
@@ -746,13 +777,13 @@ void minimum_statistics (
move16();
stop = len;
move16();
- totsize = sub(st->stopBand,st->stopFFTbin);
+ totsize = sub(hFdCngCom->stopBand,hFdCngCom->stopFFTbin);
cnt = add(cnt,1);
} /*while (stop > start)*/
/* Update minimum between sub windows */
test();
- IF ( GT_16(st->msFrCnt,1)&<_16(st->msFrCnt,MSSUBFRLEN))
+ IF ( GT_16(hFdCngCom->msFrCnt,1)&<_16(hFdCngCom->msFrCnt,MSSUBFRLEN))
{
FOR (j=0; jmsFrCnt,MSSUBFRLEN))
+ IF ( GE_16(hFdCngCom->msFrCnt,MSSUBFRLEN))
{
/* Collect buffers */
- Copy32(msCurrentMinSubWindow, msMinBuf+len*st->msMinBufferPtr, len);
+ Copy32(msCurrentMinSubWindow, msMinBuf+len*hFdCngCom->msMinBufferPtr, len);
/* Compute minimum among all buffers */
Copy32(msMinBuf, msCurrentMinOut, len);
@@ -795,13 +826,13 @@ void minimum_statistics (
}
/* Take over local minima */
- slope = st->msSlope[0];
+ slope = hFdCngCom->msSlope[0];
move16();
FOR (j=0; jmsSlope[1];
+ slope = hFdCngCom->msSlope[1];
move16();
}
test();
@@ -839,14 +870,14 @@ void minimum_statistics (
/* Detect sudden offsets based on the FFT bins (core bandwidth) */
IF ( GT_32(Mpy_32_16_1(msPsdSum[0],655/*0.02 Q15*/), msPeriodogSum[0])/*0.0 Q31*/)
{
- IF ( st->offsetflag > 0 )
+ IF ( hFdCngCom->offsetflag > 0 )
{
Copy(msPeriodog, msPsd, len);
FOR (j=0; j < len; j++)
{
msCurrentMinOut[j] = L_deposit_h(msPeriodog[j]);
}
- set32_fx(st->msAlphaCor, 2147483647l/*1.0 Q31*/, cnt);
+ set32_fx(hFdCngCom->msAlphaCor, 2147483647l/*1.0 Q31*/, cnt);
set32_fx(msAlpha, 0l/*0.0 Q31*/, len);
Copy(msPeriodog, msPsdFirstMoment, len);
set32_fx(msPsdSecondMoment, 0l/*0.0 Q31*/, len);
@@ -859,32 +890,32 @@ void minimum_statistics (
move32();
}
}
- st->offsetflag = 1;
+ hFdCngCom->offsetflag = 1;
move16();
}
ELSE
{
- st->offsetflag = 0;
+ hFdCngCom->offsetflag = 0;
move16();
}
/* Increment frame counter */
- IF ( EQ_16(st->msFrCnt,MSSUBFRLEN))
+ IF ( EQ_16(hFdCngCom->msFrCnt,MSSUBFRLEN))
{
- st->msFrCnt = 1;
+ hFdCngCom->msFrCnt = 1;
move16();
- st->msMinBufferPtr = add(st->msMinBufferPtr,1);
+ hFdCngCom->msMinBufferPtr = add(hFdCngCom->msMinBufferPtr,1);
move16();
- if ( EQ_16(st->msMinBufferPtr,MSNUMSUBFR))
+ if ( EQ_16(hFdCngCom->msMinBufferPtr,MSNUMSUBFR))
{
- st->msMinBufferPtr = 0;
+ hFdCngCom->msMinBufferPtr = 0;
move16();
}
}
ELSE
{
- st->msFrCnt = add(st->msFrCnt,1);
+ hFdCngCom->msFrCnt = add(hFdCngCom->msFrCnt,1);
}
/* Smooth noise estimate during CNG phases */
@@ -893,7 +924,12 @@ void minimum_statistics (
msNoiseEst[j] = round_fx(L_mac(L_mult(31130/*0.95 Q15*/, msNoiseEst[j]), 1638/*0.05 Q15*/, msNoiseFloor[j]));
}
}
-
+#ifdef IVAS_CODE_CNG_COM
+ if (enc_dec == DEC && element_mode == IVAS_CPE_TD)
+ {
+ v_multc(msNoiseEst, 1.4125f, msNoiseEst, NPART_SHAPING);
+ }
+#endif
/* Collect buffers */
Copy(msPeriodog, msPeriodogBuf+len*(*msPeriodogBufPtr), len);
@@ -926,17 +962,21 @@ void minimum_statistics (
}
-
-/***********************************
-* Apply bitrate-dependant scale *
-***********************************/
-void apply_scale(Word32 *scale, Word16 bwmode, Word32 bitrate)
+/*-------------------------------------------------------------------
+ * apply_scale()
+ *
+ * Apply bitrate-dependent scale
+ *-------------------------------------------------------------------*/
+void apply_scale(
+ Word32 *scale, /* o : scalefactor */
+ const Word16 bwmode, /* i : audio bandwidth */
+ const Word32 bitrate, /* i : Bit rate */
+ const SCALE_SETUP* scaleTable, /* i : Scale table */
+ const Word16 scaleTableSize /* i : Size of scale table */
+)
{
Word16 i;
- Word16 scaleTableSize = sizeof (scaleTable) / sizeof (scaleTable[0]);
-
-
-
+PMT("Verifiy if the basop ued are ok for stereo too")
FOR (i=0; i < scaleTableSize; i++)
{
cast16();
@@ -955,18 +995,21 @@ void apply_scale(Word32 *scale, Word16 bwmode, Word32 bitrate)
}
-
-/***************************************
-* Compute the power for each partition *
-***************************************/
-void bandcombinepow(Word32* bandpow, /* i : Power for each band */
- Word16 exp_bandpow, /* i : exponent of bandpow */
- Word16 nband, /* i : Number of bands */
- Word16* part, /* i : Partition upper boundaries (band indices starting from 0) */
- Word16 npart, /* i : Number of partitions */
- Word16* psize_inv, /* i : Inverse partition sizes */
- Word32* partpow, /* o : Power for each partition */
- Word16* exp_partpow)
+/*-------------------------------------------------------------------
+ * bandcombinepow()
+ *
+ * Compute the power for each partition
+ *-------------------------------------------------------------------*/
+void bandcombinepow(
+ const Word32* bandpow, /* i : Power for each band */
+ const Word16 exp_bandpow, /* i : exponent of bandpow */
+ const Word16 nband, /* i : Number of bands */
+ Word16* part, /* i : Partition upper boundaries (band indices starting from 0) */
+ const Word16 npart, /* i : Number of partitions */
+ const Word16* psize_inv, /* i : Inverse partition sizes */
+ Word32* partpow, /* o : Power for each partition */
+ Word16* exp_partpow
+)
{
Word16 i, p;
@@ -1024,19 +1067,21 @@ void bandcombinepow(Word32* bandpow, /* i : Power for
move16();
}
-
-/************************************
-* Scale partitions (with smoothing) *
-************************************/
-void scalebands (Word32 *partpow, /* i : Power for each partition */
- Word16 *part, /* i : Partition upper boundaries (band indices starting from 0) */
- Word16 npart, /* i : Number of partitions */
- Word16 *midband, /* i : Central band of each partition */
- Word16 nFFTpart, /* i : Number of FFT partitions */
- Word16 nband, /* i : Number of bands */
- Word32 *bandpow, /* o : Power for each band */
- Word16 flag_fft_en
- )
+/*-------------------------------------------------------------------
+ * scalebands()
+ *
+ * Scale partitions (with smoothing)
+ *-------------------------------------------------------------------*/
+void scalebands (
+ const Word32 *partpow, /* i : Power for each partition */
+ Word16 *part, /* i : Partition upper boundaries (band indices starting from 0) */
+ const Word16 npart, /* i : Number of partitions */
+ Word16 *midband, /* i : Central band of each partition */
+ const Word16 nFFTpart, /* i : Number of FFT partitions */
+ const Word16 nband, /* i : Number of bands */
+ Word32 *bandpow, /* o : Power for each band */
+ const Word16 flag_fft_en
+)
{
Word16 i, j, s, s1, nint, delta, delta_cmp, delta_s;
Word16 startBand, startPart, stopPart, stopPartM1;
@@ -1168,17 +1213,20 @@ void scalebands (Word32 *partpow, /* i : Power for each partition */
}
-
-/**************************************
-* Get central band for each partition *
-**************************************/
-void getmidbands(Word16* part, /* i : Partition upper boundaries (band indices starting from 0) */
- Word16 npart, /* i : Number of partitions */
- Word16* midband, /* o : Central band of each partition */
- Word16* psize, /* o : Partition sizes */
- Word16* psize_norm, /* o : Partition sizes, fractional values */
- Word16* psize_norm_exp, /* o : Exponent for fractional partition sizes */
- Word16* psize_inv) /* o : Inverse of partition sizes */
+/*-------------------------------------------------------------------
+ * getmidbands()
+ *
+ * Get central band for each partition
+ *-------------------------------------------------------------------*/
+static void getmidbands(
+ const Word16* part, /* i : Partition upper boundaries (band indices starting from 0) */
+ const Word16 npart, /* i : Number of partitions */
+ Word16* midband, /* o : Central band of each partition */
+ Word16* psize, /* o : Partition sizes */
+ Word16* psize_norm, /* o : Partition sizes, fractional values */
+ Word16* psize_norm_exp, /* o : Exponent for fractional partition sizes */
+ Word16* psize_inv /* o : Inverse of partition sizes */
+)
{
Word16 j, max_psize, shift;
@@ -1220,29 +1268,19 @@ void getmidbands(Word16* part, /* i : Partition upper boundaries (
assert(norm_s(-max_psize) >= 9 );
}
-
-/*
- AnalysisSTFT
-
- Parameters:
-
- timeDomainInput, i : pointer to time signal
- fftBuffer, o : FFT bins
- fftBufferExp, i : exponent of FFT bins
- st i/o: FD_CNG structure containing all buffers and variables
-
- Function:
- STFT analysis filterbank
-
- Returns:
- void
-*/
-void AnalysisSTFT (const Word16 *timeDomainInput, /* i : pointer to time signal */
- Word16 Q,
- Word32 *fftBuffer, /* o : FFT bins */
- Word16 *fftBuffer_exp, /* i : exponent of FFT bins */
- HANDLE_FD_CNG_COM st /* i/o: FD_CNG structure containing all buffers and variables */
- )
+/*-------------------------------------------------------------------
+ * AnalysisSTFT()
+ *
+ * STFT analysis filterbank
+ *-------------------------------------------------------------------*/
+
+void AnalysisSTFT (
+ const Word16 *timeDomainInput, /* i : pointer to time signal */
+ Word16 Q,
+ Word32 *fftBuffer, /* o : FFT bins */
+ Word16 *fftBuffer_exp, /* i : exponent of FFT bins */
+ HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */
+)
{
Word16 i, len;
Word16 len2;
@@ -1251,17 +1289,17 @@ void AnalysisSTFT (const Word16 *timeDomainInput, /* i : pointer to time signal
- assert( (st->fftlen>>1) == st->frameSize);
+ assert( (hFdCngCom->fftlen>>1) == hFdCngCom->frameSize);
/* pointer inititialization */
- assert(st->olapBufferAna != NULL);
- olapBuffer = st->olapBufferAna;
- olapWin = st->olapWinAna;
+ assert(hFdCngCom->olapBufferAna != NULL);
+ olapBuffer = hFdCngCom->olapBufferAna;
+ olapWin = hFdCngCom->olapWinAna;
/* olapWin factor is scaled with one bit */
*fftBuffer_exp = 1;
move16();
- len = sub(st->fftlen,st->frameSize);
+ len = sub(hFdCngCom->fftlen,hFdCngCom->frameSize);
assert(len <= 320); /* see size of olapBuffer */
/* Window the signal */
@@ -1273,7 +1311,7 @@ void AnalysisSTFT (const Word16 *timeDomainInput, /* i : pointer to time signal
fftBuffer[i] = L_mult(olapBuffer[i], mult_r(olapWin[i].v.im, 23170/*1.4142135623730950488016887242097 Q14*/));
fftBuffer[i+len2] = L_mult(olapBuffer[i+len2], mult_r(olapWin[len2-1-i].v.re, 23170/*1.4142135623730950488016887242097 Q14*/));
}
- len2 = shr(st->frameSize,1);
+ len2 = shr(hFdCngCom->frameSize,1);
FOR (i=0; i fftlen, fftBuffer_exp, -1);
+ BASOP_rfft(fftBuffer, hFdCngCom->fftlen, fftBuffer_exp, -1);
FOR (i=0; i frameSize,len)+i], Q );
+ olapBuffer[i] = shr( timeDomainInput[sub(hFdCngCom->frameSize,len)+i], Q );
move16();
}
}
-/*
- SynthesisSTFT
-
- Parameters:
-
- fftBuffer i : pointer to FFT bins
- fftBufferExp i : exponent of FFT bins
- timeDomainOutput o : pointer to time domain signal
- timeDomainOutputExp o : pointer to exponent of time domain output
- olapBuffer i/o : pointer to overlap buffer
- olapWin i : pointer to overlap window
- st i/o : pointer to FD_CNG structure containing all buffers and variables
-
- Function:
- STFT synthesis filterbank
-
- Returns:
- void
-*/
-void
-SynthesisSTFT (Word32 *fftBuffer, /* i : pointer to FFT bins */
- Word16 fftBufferExp, /* i : exponent of FFT bins */
- Word16 *timeDomainOutput, /* o : pointer to time domain signal */
- Word16 *olapBuffer, /* i/o : pointer to overlap buffer */
- const PWord16 *olapWin, /* i : pointer to overlap window */
- Word16 tcx_transition,
- HANDLE_FD_CNG_COM st, /* i/o : pointer to FD_CNG structure containing all buffers and variables */
- Word16 gen_exc,
- Word16 *Q_new
- )
+/*-------------------------------------------------------------------
+ * SynthesisSTFT()
+ *
+ * STFT synthesis filterbank
+ *-------------------------------------------------------------------*/
+
+void SynthesisSTFT (
+ Word32 *fftBuffer, /* i : pointer to FFT bins */
+ Word16 fftBufferExp, /* i : exponent of FFT bins */
+ Word16 *timeDomainOutput, /* o : pointer to time domain signal */
+ Word16 *olapBuffer, /* i/o : pointer to overlap buffer */
+ const PWord16 *olapWin, /* i : pointer to overlap window */
+ Word16 tcx_transition,
+ HANDLE_FD_CNG_COM hFdCngCom, /* i/o : pointer to FD_CNG structure containing all buffers and variables */
+ Word16 gen_exc,
+ Word16 *Q_new,
+ const Word16 element_mode, /* i : element mode */
+ const Word16 nchan_out /* i : number of output channels */
+)
{
Word16 i, len, scale, tmp;
Word16 len2, len3, len4;
@@ -1332,18 +1359,26 @@ SynthesisSTFT (Word32 *fftBuffer, /* i : pointer to FFT bins */
/* Perform IFFT */
scale = 0;
- BASOP_rfft(fftBuffer, st->fftlen, &scale, 1);
+ BASOP_rfft(fftBuffer, hFdCngCom->fftlen, &scale, 1);
fftBufferExp = add(fftBufferExp, scale);
- fftBufferExp = add(fftBufferExp, st->fftlenShift);
+ fftBufferExp = add(fftBufferExp, hFdCngCom->fftlenShift);
/* Perform overlap-add */
- Copy(olapBuffer+st->frameSize, olapBuffer, st->frameSize);
- set16_fx(olapBuffer+st->frameSize, 0, st->frameSize);
-
- len2 = shr(st->fftlen,2);
- len4 = shr(st->fftlen,3);
+ /* Handle overlap in P/S domain for stereo */
+ IF ((EQ_16(element_mode, IVAS_CPE_TD) || EQ_16(element_mode, IVAS_CPE_DFT)) && EQ_16(nchan_out, 2) )
+ {
+ Copy(olapBuffer + 3 * hFdCngCom->frameSize / 4 - (M + 1), buf, hFdCngCom->frameSize + M + 1);
+ set16_fx(olapBuffer, 0, hFdCngCom->fftlen);
+ }
+ ELSE
+ {
+ Copy(olapBuffer + hFdCngCom->frameSize, olapBuffer, hFdCngCom->frameSize);
+ set16_fx(olapBuffer + hFdCngCom->frameSize, 0, hFdCngCom->frameSize);
+ }
+ len2 = shr(hFdCngCom->fftlen,2);
+ len4 = shr(hFdCngCom->fftlen,3);
len3 = add(len2,len4);
- len = add(st->frameSize,len4);
+ len = add(hFdCngCom->frameSize,len4);
IF ( tcx_transition )
{
FOR (i=0; i < len; i++)
@@ -1375,55 +1410,131 @@ SynthesisSTFT (Word32 *fftBuffer, /* i : pointer to FFT bins */
}
len = add( len, len2 );
- FOR (i=len; i < st->fftlen ; i++)
+ FOR (i=len; i < hFdCngCom->fftlen ; i++)
{
olapBuffer[i] = 0;
move16();
}
/* Get time-domain signal */
- FOR (i=0; i < st->frameSize; i++)
+ FOR (i=0; i < hFdCngCom->frameSize; i++)
{
- timeDomainOutput[i] = mult_r( olapBuffer[i+len4], st->fftlenFac );
+ timeDomainOutput[i] = mult_r( olapBuffer[i+len4], hFdCngCom->fftlenFac );
move16();
}
-
/* Generate excitation */
- IF ( EQ_16( gen_exc, 1 ))
+#ifdef IVAS_CODE_CNG_COM
+ PME()
+ if ((element_mode == IVAS_CPE_TD || element_mode == IVAS_CPE_DFT) && nchan_out == 2)
{
- FOR (i=0; i < M+1+st->frameSize; i++)
+ for (i = 0; i < hFdCngCom->frameSize / 2; i++)
{
- buf[i] = mult_r( olapBuffer[i+len4-M-1], st->fftlenFac );
- move16();
+ buf[i + (M + 1)] += olapBuffer[i + hFdCngCom->frameSize / 4];
}
- tmp = buf[0];
- E_UTIL_f_preemph2( *Q_new-1, buf+1, PREEMPH_FAC, M+st->frameSize, &tmp );
- Residu3_fx( st->A_cng, buf+1+M, st->exc_cng, st->frameSize, 1 );
+ v_multc(buf, (float)(hFdCngCom->fftlen / 2), buf, M + 1 + hFdCngCom->frameSize);
}
- IF ( EQ_16( gen_exc, 2 ))
+ else
+#endif
{
- FOR (i=0; i < M+1+st->frameSize; i++)
+ FOR(i = 0; i < M + 1 + hFdCngCom->frameSize; i++)
{
- buf[i] = mult_r( olapBuffer[i+len4-M-1], st->fftlenFac );
+ buf[i] = mult_r(olapBuffer[i + len4 - M - 1], hFdCngCom->fftlenFac);
move16();
}
tmp = buf[0];
- *Q_new = E_UTIL_f_preemph3( buf+1, PREEMPH_FAC, M+st->frameSize, &tmp, 1 );
- Residu3_fx( st->A_cng, buf+1+M, st->exc_cng, st->frameSize, 1 );
+ }
+ IF ( EQ_16( gen_exc, 1 ))
+ {
+
+ E_UTIL_f_preemph2( *Q_new-1, buf+1, PREEMPH_FAC, M+hFdCngCom->frameSize, &tmp );
+ Residu3_fx( hFdCngCom->A_cng, buf+1+M, hFdCngCom->exc_cng, hFdCngCom->frameSize, 1 );
+ }
+ IF ( EQ_16( gen_exc, 2 ))
+ {
+ *Q_new = E_UTIL_f_preemph3( buf+1, PREEMPH_FAC, M+hFdCngCom->frameSize, &tmp, 1 );
+ Residu3_fx( hFdCngCom->A_cng, buf+1+M, hFdCngCom->exc_cng, hFdCngCom->frameSize, 1 );
}
}
+#ifdef IVAS_CODE_CNG_COM
+/*-------------------------------------------------------------------
+ * SynthesisSTFT_dirac()
+ *
+ * STFT synthesis filterbank
+ *-------------------------------------------------------------------*/
+
+void SynthesisSTFT_dirac(
+ float* fftBuffer, /* i : FFT bins */
+ float* timeDomainOutput,
+ float* olapBuffer,
+ const float* olapWin,
+ const int16_t samples_out,
+ HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */
+)
+{
+ int16_t i;
+ float buf[M + 1 + 320], tmp;
+
+ /* Perform IFFT */
+ RFFTN(fftBuffer, hFdCngCom->fftSineTab, hFdCngCom->fftlen, 1);
+
+ /* Handle overlap in P/S domain for stereo */
+ mvr2r(olapBuffer + hFdCngCom->frameSize, olapBuffer, hFdCngCom->frameSize);
+ set_f(olapBuffer + hFdCngCom->frameSize, 0.0f, hFdCngCom->frameSize); /*olapBuffer, fftBuffer, olapWin*/
+
+ for (i = hFdCngCom->frameSize / 4; i < 3 * hFdCngCom->frameSize / 4; i++)
+ {
+ olapBuffer[i] += fftBuffer[i] * olapWin[i - hFdCngCom->frameSize / 4];
+ }
+ for (; i < 5 * hFdCngCom->frameSize / 4; i++)
+ {
+ olapBuffer[i] = fftBuffer[i];
+ }
+
+ for (; i < 7 * hFdCngCom->frameSize / 4; i++)
+ {
+ olapBuffer[i] = fftBuffer[i];
+ }
+
+ for (; i < hFdCngCom->fftlen; i++)
+ {
+ olapBuffer[i] = 0;
+ }
+
+ /* Get time-domain signal */
+ v_multc(olapBuffer + hFdCngCom->frameSize / 4, (float)(hFdCngCom->fftlen / 2), timeDomainOutput, samples_out);
+
+ /* Get excitation */
+ v_multc(olapBuffer + hFdCngCom->frameSize / 4 - (M + 1), (float)(hFdCngCom->fftlen / 2), buf, M + 1 + hFdCngCom->frameSize);
+ tmp = buf[0];
+ preemph(buf + 1, PREEMPH_FAC, M + hFdCngCom->frameSize, &tmp);
+ residu(hFdCngCom->A_cng, M, buf + 1 + M, hFdCngCom->exc_cng, hFdCngCom->frameSize);
+
+ /* update and window olapBuf if we have a output frame that is shorter than the default frame size...*/
+ if (samples_out < hFdCngCom->frameSize)
+ {
+ mvr2r(olapBuffer + samples_out, olapBuffer + hFdCngCom->frameSize, 3 * hFdCngCom->frameSize / 4);
+ }
+ for (i = 5 * hFdCngCom->frameSize / 4; i < 7 * hFdCngCom->frameSize / 4; i++)
+ {
+ olapBuffer[i] *= olapWin[i - 3 * hFdCngCom->frameSize / 4];
+ }
+ return;
+}
+#endif
/**************************************************************************************
* Compute some values used in the bias correction of the minimum statistics algorithm *
**************************************************************************************/
-void mhvals(Word16 d,
- Word16 * m /*, float * h*/
- )
+void mhvals(
+ const Word16 d,
+ Word16 * m /*, float * h*/
+)
{
Word16 i, j;
- Word16 len = sizeof(d_array)/sizeof(Word16);
+ Word16 len = SIZE_SCALE_TABLE_CN;
+ move16();
assert( d==72 || d==12); /* function only tested for d==72 and d==12) */
@@ -1496,27 +1607,18 @@ void mhvals(Word16 d,
}
}
-
-/*
- rand_gauss
-
- Parameters:
-
- seed i/o : pointer to seed
-
- Function:
- Random generator with Gaussian distribution with mean 0 and std 1
-
- Returns:
- random signal format Q3.29
-*/
+/*-------------------------------------------------------------------
+ * rand_gauss()
+ *
+ * Random generator with Gaussian distribution with mean 0 and std 1
+ * Returns:
+ * random signal format Q3.29
+ *-------------------------------------------------------------------*/
Word32 rand_gauss (Word16 *seed)
{
Word32 temp;
Word16 loc_seed;
-
-
/* This unrolled version reduces the cycles from 17 to 10 */
loc_seed = extract_l(L_mac0(13849, *seed, 31821));
temp = L_deposit_l(loc_seed);
@@ -1532,43 +1634,29 @@ Word32 rand_gauss (Word16 *seed)
return L_shl(temp,WORD16_BITS-CNG_RAND_GAUSS_SHIFT);
}
-
-/*
- lpc_from_spectrum
-
- Parameters:
-
- powspec i : pointer to noise levels format Q5.27
- start i : start band
- stop i : stop band
- fftlen i : size of fft
- A o : lpc coefficients format Q3.12
- s i : lpc order
- preemph_fac i : preemphase factor format Q1.15
-
-
- Function:
- calculate lpc coefficients from the spectrum
-
- Returns:
- void
-*/
-void lpc_from_spectrum (Word32 *powspec,
- Word16 powspec_exp,
- Word16 start,
- Word16 stop,
- Word16 fftlen,
- Word16 *A,
- Word16 lpcorder,
- Word16 preemph_fac
- )
+/*-------------------------------------------------------------------
+ * lpc_from_spectrum()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void lpc_from_spectrum (
+ HANDLE_FD_CNG_COM hFdCngCom,
+ const Word16 start, /*i : start band*/
+ const Word16 stop, /*i : stop band*/
+ const Word16 preemph_fac /*i : preemphase factor format Q1.15*/
+)
{
Word16 i, s1, s2, s3, fftlen2, scale, fftlen4, fftlen8, len, step, preemph_fac2;
Word32 maxVal, r[32], fftBuffer[FFTLEN], *ptr, *pti, nf;
Word16 tmp, r_h[32], r_l[32];
const PWord16 *table;
-
+ Word32* powspec = hFdCngCom->cngNoiseLevel; /*i : pointer to noise levels format Q5.27*/
+ Word16 powspec_exp = hFdCngCom->cngNoiseLevelExp;
+ Word16 fftlen = hFdCngCom->fftlen; /*i : size of fft*/
+ Word16*A = hFdCngCom->A_cng; /*o : lpc coefficients format Q3.12*/
+ Word16 lpcorder = M;
scale = 0;
move16();
@@ -1734,17 +1822,18 @@ void lpc_from_spectrum (Word32 *powspec,
Returns:
void
*/
-void msvq_decoder (const Word16 *const cb[], /* i : Codebook (indexed cb[*stages][levels][p]) */
- Word16 stages, /* i : Number of stages */
- Word16 N, /* i : Vector dimension */
- Word16 maxN, /* i : Codebook vector dimension */
- Word16 Idx[], /* i : Indices */
- Word16 *uq /* o : quantized vector */
- )
+void msvq_decoder (
+ const Word16 *const cb[], /* i : Codebook (indexed cb[*stages][levels][p]) */
+ const Word16 stages, /* i : Number of stages */
+ const Word16 N, /* i : Vector dimension */
+ const Word16 maxN, /* i : Codebook vector dimension */
+ const Word16 Idx[], /* i : Indices */
+ Word16 *uq /* o : quantized vector */
+)
{
Word16 s, i, offset;
-
+PMT("msvq_decoder Not verified")
offset = i_mult(Idx[0], maxN);
FOR (i=0; iA_cng, Aq+i*(M+1), M+1 );
+ Copy( hFdCngCom->A_cng, Aq+i*(M+1), M+1 );
}
E_LPC_a_lsp_conversion( Aq, lsp_new, lsp_old, M );
@@ -1811,16 +1905,18 @@ void FdCng_exc(
{
E_LPC_lsp_lsf_conversion( lsp_new, lsf_new, M );
}
- Copy( hs->exc_cng, exc, L_frame );
- Copy( hs->exc_cng, exc2, L_frame );
-
- IF( EQ_16(L_frame,L_FRAME))
+ Copy( hFdCngCom->exc_cng, exc, L_frame );
+ Copy( hFdCngCom->exc_cng, exc2, L_frame );
+ IF (bwe_exc != NULL)
{
- interp_code_5over2_fx( exc2, bwe_exc, L_frame );
- }
- ELSE
- {
- interp_code_4over2_fx( exc2, bwe_exc, L_frame );
+ IF(EQ_16(L_frame, L_FRAME))
+ {
+ interp_code_5over2_fx(exc2, bwe_exc, L_frame);
+ }
+ ELSE
+ {
+ interp_code_4over2_fx(exc2, bwe_exc, L_frame);
+ }
}
}
diff --git a/lib_com/fill_spectrum_fx.c b/lib_com/fill_spectrum_fx.c
index ae947af6a06d0ed45dcec0eb2742e067078803f5..fea44d955c136517fda23aec6ae050dad1b3ed28 100644
--- a/lib_com/fill_spectrum_fx.c
+++ b/lib_com/fill_spectrum_fx.c
@@ -1,12 +1,11 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h" /* required for wmc_tool */
/*--------------------------------------------------------------------------*
* fill_spectrum()
@@ -17,42 +16,43 @@
*--------------------------------------------------------------------------*/
void fill_spectrum_fx(
- Word16 *coeff, /* i/o: normalized MLT spectrum / nf spectrum Q12 */
- Word32 *L_coeff_out, /* i/o: Noisefilled MLT spectrum Q12 */
- const Word16 *R, /* i : number of pulses per band Q0 */
- const Word16 is_transient, /* i : transient flag Q0 */
- Word16 norm[], /* i : quantization indices for norms Q0 */
- const Word16 *hq_generic_fenv, /* i : HQ GENERIC envelope Q1 */
- const Word16 hq_generic_offset, /* i : HQ GENERIC offset Q0 */
- const Word16 nf_idx, /* i : noise fill index Q0 */
- const Word16 length, /* i : Length of spectrum (32 or 48 kHz) Q0 */
- const Word16 env_stab, /* i : Envelope stability measure [0..1] Q15 */
- Word16 *no_att_hangover, /* i/o: Frame counter for attenuation hangover Q0 */
- Word32 *L_energy_lt, /* i/o: Long-term energy measure for transient detection Q13 */
- Word16 *bwe_seed, /* i/o: random seed for generating BWE input Q0 */
- const Word16 hq_generic_exc_clas, /* i : BWE excitation class Q0 */
- const Word16 core_sfm, /* i : index of the end band for core Q0 */
- const Word16 HQ_mode, /* i : HQ mode Q0 */
- Word16 noise_level[], /* i : noise levels for harmonic modes Q15 */
- const Word32 L_core_brate, /* i : target bit-rate Q0 */
- Word16 prev_noise_level[], /* i/o: noise factor in previous frame Q15 */
- Word16 *prev_R, /* i/o: bit allocation info. in previous frame Q0 */
- Word32 *prev_coeff_out, /* i/o: decoded spectrum in previous frame Q12 */
- const Word16 *peak_idx, /* i : peak indices for hvq Q0 */
- const Word16 Npeaks, /* i : number of peaks in hvq Q0 */
- const Word16 *npulses, /* i : number of pulses per band Q0 */
- const Word16 prev_is_transient, /* i : previous transient flag Q0 */
- Word32 *prev_normq, /* i/o: previous norms Q14 */
- Word32 *prev_env, /* i/o: previous noise envelopes Q(prev_env_Q) */
- const Word16 prev_bfi, /* i : previous bad frame indicator Q0 */
- const Word16 *sfmsize, /* i : Length of bands Q0 */
- const Word16 *sfm_start, /* i : Start of bands Q0 */
- const Word16 *sfm_end, /* i : End of bands Q0 */
- Word16 *prev_L_swb_norm, /* i/o: HVQ/Harmonic mode normalization length Q0 */
- const Word16 prev_hq_mode, /* i : Previous HQ mode Q0 */
- const Word16 num_sfm /* i : Total number of bands Q0 */
- ,Word16 *prev_env_Q
- ,const Word16 num_env_bands /* i : Number sub bands to be encoded for HQ_GEN Q0 */
+ Word16 *coeff, /* i/o: normalized MLT spectrum / nf spectrum Q12 */
+ Word32 *L_coeff_out, /* i/o: Noisefilled MLT spectrum Q12 */
+ const Word16 *R, /* i : number of pulses per band Q0 */
+ const Word16 is_transient, /* i : transient flag Q0 */
+ Word16 norm[], /* i : quantization indices for norms Q0 */
+ const Word16 *hq_generic_fenv, /* i : HQ GENERIC envelope Q1 */
+ const Word16 hq_generic_offset, /* i : HQ GENERIC offset Q0 */
+ const Word16 nf_idx, /* i : noise fill index Q0 */
+ const Word16 length, /* i : Length of spectrum (32 or 48 kHz) Q0 */
+ const Word16 env_stab, /* i : Envelope stability measure [0..1] Q15 */
+ Word16 *no_att_hangover, /* i/o: Frame counter for attenuation hangover Q0 */
+ Word32 *L_energy_lt, /* i/o: Long-term energy measure for transient detection Q13 */
+ Word16 *bwe_seed, /* i/o: random seed for generating BWE input Q0 */
+ const Word16 hq_generic_exc_clas, /* i : BWE excitation class Q0 */
+ const Word16 core_sfm, /* i : index of the end band for core Q0 */
+ const Word16 HQ_mode, /* i : HQ mode Q0 */
+ Word16 noise_level[], /* i : noise levels for harmonic modes Q15 */
+ const Word32 L_core_brate, /* i : target bit-rate Q0 */
+ Word16 prev_noise_level[], /* i/o: noise factor in previous frame Q15 */
+ Word16 *prev_R, /* i/o: bit allocation info. in previous frame Q0 */
+ Word32 *prev_coeff_out, /* i/o: decoded spectrum in previous frame Q12 */
+ const Word16 *peak_idx, /* i : peak indices for hvq Q0 */
+ const Word16 Npeaks, /* i : number of peaks in hvq Q0 */
+ const Word16 *npulses, /* i : number of pulses per band Q0 */
+ const Word16 prev_is_transient, /* i : previous transient flag Q0 */
+ Word32 *prev_normq, /* i/o: previous norms Q14 */
+ Word32 *prev_env, /* i/o: previous noise envelopes Q(prev_env_Q) */
+ const Word16 prev_bfi, /* i : previous bad frame indicator Q0 */
+ const Word16 *sfmsize, /* i : Length of bands Q0 */
+ const Word16 *sfm_start, /* i : Start of bands Q0 */
+ const Word16 *sfm_end, /* i : End of bands Q0 */
+ Word16 *prev_L_swb_norm, /* i/o: HVQ/Harmonic mode normalization length Q0 */
+ const Word16 prev_hq_mode, /* i : Previous HQ mode Q0 */
+ const Word16 num_sfm, /* i : Total number of bands Q0 */
+ Word16 *prev_env_Q,
+ const Word16 num_env_bands, /* i : Number sub bands to be encoded for HQ_GEN Q0 */
+ const Word16 element_mode /* i : IVAS element mode */
)
{
Word16 CodeBook[FREQ_LENGTH]; /* Q12 */
@@ -66,9 +66,8 @@ void fill_spectrum_fx(
Word16 peak_pos[L_HARMONIC_EXC];
Word16 bwe_peaks[L_FRAME48k];
Word32 L_normq_v[NB_SFM]; /*Q14 */
- Word16 coeff_fine[L_FRAME48k]; /*Q15 */
- Word32 L_coeff_out1[L_FRAME48k]; /*Q12 */
-
+ Word16 coeff_fine[L_SPEC48k_EXT]; /*Q15 */
+ Word32 L_coeff_out1[L_SPEC48k_EXT]; /*Q12 */
set16_fx( peak_pos, 0, L_HARMONIC_EXC );
set16_fx( bwe_peaks, 0, L_FRAME48k );
set16_fx(norm_adj, 32767, num_sfm); /* 1.0, Q15 */
@@ -96,9 +95,9 @@ void fill_spectrum_fx(
IF ( EQ_16(HQ_mode, HQ_HARMONIC))
{
- /*high_sfm = (core_brate == HQ_24k40) ? HVQ_THRES_SFM_24k-1 : HVQ_THRES_SFM_32k-3; */
+ /*high_sfm = (core_brate == HQ_BWE_CROSSOVER_BRATE) ? HVQ_THRES_SFM_24k-1 : HVQ_THRES_SFM_32k-3; */
high_sfm = sub(HVQ_THRES_SFM_32k, 1);
- if (EQ_32(L_core_brate, HQ_24k40))
+ if (LT_32(L_core_brate, HQ_BWE_CROSSOVER_BRATE))
{
high_sfm = sub(HVQ_THRES_SFM_24k, 1);
}
@@ -225,12 +224,11 @@ void fill_spectrum_fx(
test();
IF ( EQ_16(HQ_mode, HQ_HARMONIC))
{
- harm_bwe_fx( coeff_fine, coeff, num_sfm, sfm_start, sfm_end, last_sfm, R, prev_hq_mode, norm, noise_level, prev_noise_level, bwe_seed, L_coeff_out );
+ harm_bwe_fx( coeff_fine, coeff, num_sfm, sfm_start, sfm_end, last_sfm, R, prev_hq_mode, norm, noise_level, prev_noise_level, bwe_seed, L_coeff_out, element_mode );
}
ELSE IF ( EQ_16(HQ_mode, HQ_HVQ))
{
- hvq_bwe_fx( L_coeff_out, coeff_fine, sfm_start, sfm_end, sfmsize, last_sfm,
- prev_hq_mode, bwe_peaks, bin_th, num_sfm, L_core_brate, R, norm,
+ hvq_bwe_fx( L_coeff_out, coeff_fine, sfm_start, sfm_end, sfmsize, last_sfm, prev_hq_mode, bwe_peaks, bin_th, num_sfm, L_core_brate, R, norm,
noise_level, prev_noise_level, bwe_seed, L_coeff_out, 15, 12 );
}
ELSE IF ( EQ_16(HQ_mode, HQ_GEN_SWB)||EQ_16(HQ_mode,HQ_GEN_FB))
@@ -242,7 +240,7 @@ void fill_spectrum_fx(
* HQ WB BWE refinements
*----------------------------------------------------------------*/
test();
- IF ( EQ_16(length, L_FRAME16k)&&EQ_32(L_core_brate,HQ_32k))
+ IF ( EQ_16(length, L_FRAME16k) && LE_32(L_core_brate,HQ_32k))
{
hq_wb_nf_bwe_fx( coeff, is_transient, prev_bfi, L_normq_v, num_sfm, sfm_start, sfm_end, sfmsize, last_sfm, R,
prev_is_transient, prev_normq, prev_env, bwe_seed, prev_coeff_out, prev_R, L_coeff_out, prev_env_Q );
@@ -253,7 +251,7 @@ void fill_spectrum_fx(
*----------------------------------------------------------------*/
test();
- IF ( NE_16(HQ_mode, HQ_HARMONIC)&&NE_16(HQ_mode,HQ_HVQ))
+ IF ( NE_16(HQ_mode, HQ_HARMONIC) && NE_16(HQ_mode,HQ_HVQ))
{
prev_noise_level[0] = 3277;
move16();/* 0.1 in Q15 */
@@ -261,14 +259,14 @@ void fill_spectrum_fx(
move16();/* 0.1 in Q15 */
}
test();
- IF ( !(EQ_16(length, L_FRAME16k)&&EQ_32(L_core_brate,HQ_32k)))
+ IF ( !(EQ_16(length, L_FRAME16k) && LE_32(L_core_brate,HQ_32k)))
{
set32_fx( prev_env, 0, SFM_N_WB );
set32_fx( prev_normq, 0, SFM_N_WB );
}
test();
- IF ( EQ_16(length, L_FRAME32k)&&LE_32(L_core_brate,HQ_32k))
+ IF ( EQ_16(length, L_FRAME32k) && LE_32(L_core_brate,HQ_32k))
{
*prev_R = R[SFM_N_WB-1];
Copy32( L_coeff_out + L_FRAME16k - L_HQ_WB_BWE, prev_coeff_out, L_HQ_WB_BWE );
diff --git a/lib_com/findpulse_fx.c b/lib_com/findpulse_fx.c
index f292b65847cd9d05a3d68d700555079d608d65e1..2afb93d24339dc081ea63789743fb13c32141124 100644
--- a/lib_com/findpulse_fx.c
+++ b/lib_com/findpulse_fx.c
@@ -2,10 +2,10 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h"
/*----------------------------------------------------------------------------------*
* findpulse()
diff --git a/lib_com/fine_gain_bits_fx.c b/lib_com/fine_gain_bits_fx.c
index d6db7260ea16b162cd85c43514c21d3b8ace3166..ea39568f4b90e9621861cc73f1a448b958a6c6dd 100644
--- a/lib_com/fine_gain_bits_fx.c
+++ b/lib_com/fine_gain_bits_fx.c
@@ -2,10 +2,10 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h" /* Compilation switches */
#include "rom_com_fx.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h" /* required for wmc_tool */
/*--------------------------------------------------------------------------
@@ -14,11 +14,11 @@
* HQ core encoder
*--------------------------------------------------------------------------*/
-void subband_gain_bits_fx(
- const Word16 *Rk, /* i : bit allocation per band Q3 */
- const Word16 N, /* i : number of bands */
- Word16 *bits, /* o : gain bits per band */
- const Word16 *sfmsize /* i : Size of bands */
+static void subband_gain_bits_fx(
+ const Word16 *Rk, /* i : bit allocation per band Q3 */
+ const Word16 N, /* i : number of bands */
+ Word16 *bits, /* o : gain bits per band */
+ const Word16 *sfmsize /* i : Size of bands */
)
{
Word16 i,b,tot;
@@ -69,7 +69,6 @@ Word16 assign_gain_bits_fx( /* o : Number of assigned gain bits
Word16 *Rcalc /* o : Bit budget for shape quantizer Q3 */
)
{
- Word16 subband_cnt;
Word16 gain_bits_tot;
Word16 i;
@@ -84,7 +83,6 @@ Word16 assign_gain_bits_fx( /* o : Number of assigned gain bits
}
/* Re-adjust bit budget for gain quantization */
- subband_cnt = 0;
move16();
gain_bits_tot = 0;
move16();
@@ -94,7 +92,6 @@ Word16 assign_gain_bits_fx( /* o : Number of assigned gain bits
{
IF (Rk[i] > 0)
{
- subband_cnt = add(subband_cnt, 1);
Rk[i] = sub(Rk[i], shl(gain_bits_array[i], 3));
move16();
gain_bits_tot = add(gain_bits_tot, gain_bits_array[i]);
diff --git a/lib_com/frame_ener_fx.c b/lib_com/frame_ener_fx.c
index a70235e53e4b69a8413455723d99b51c4928e826..5f6b42a42f6e54b3acc5e399375daa34264ab615 100644
--- a/lib_com/frame_ener_fx.c
+++ b/lib_com/frame_ener_fx.c
@@ -2,6 +2,7 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
@@ -18,10 +19,10 @@ Word16 frame_ener_fx(
const Word16 clas, /* i : frame classification */
const Word16 *synth, /* i : synthesized speech at Fs = 12k8 Hz Q_new */
const Word16 pitch, /* i : pitch period Q0 */
- Word32 *enr_q, /* o : pitch-synchronous or half_frame energy Q0 */
+ Word32 *enr_q, /* o : pitch-synchronous or half_frame energy Q0 */
const Word16 offset, /* i : speech pointer offset (0 or L_FRAME) */
const Word16 Q_new, /* i : Scaling factor */
- Word16 shift, /* i : Shift need to obtain 12 bits vectors */
+ Word16 shift, /* i : Shift need to obtain 12 bits vectors */
const Word16 enc /* i : Encoder/decoder */
)
{
@@ -142,7 +143,7 @@ Word16 frame_energy_fx( /* o : Frame energy in
const Word16 *pitch, /* i : pitch values for each subframe Q6 */
const Word16 *speech, /* i : pointer to speech signal for E computation Q_syn*/
const Word16 lp_speech, /* i : long term active speech energy average Q8 */
- Word16 *frame_ener, /* o : pitch-synchronous energy at frame end Q8 */
+ Word16 *frame_ener, /* o : pitch-synchronous energy at frame end Q8 */
const Word16 Q_syn /* i : Synthesis scaling */
)
{
diff --git a/lib_com/gain_inov.c b/lib_com/gain_inov.c
index 703054cc05030a0adc532b3e57f5c7dc69f1903a..21142b53007917d01bea5c05e52a93cf254223ed 100644
--- a/lib_com/gain_inov.c
+++ b/lib_com/gain_inov.c
@@ -2,16 +2,17 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include
+#include "options.h"
#include "prot_fx.h"
-#include "stl.h"
#include "basop_util.h"
#include "rom_com_fx.h"
-Word32 calc_gain_inov( /* returns innovation gain Q16 */
+Word32 calc_gain_inov( /* returns innovation gain Q16 */
const Word16 *code, /* i : algebraic excitation Q9 */
- Word16 lcode, /* i : Subframe size Q0 */
+ const Word16 lcode, /* i : Subframe size Q0 */
Word32 *dotp, /* o : intermediate result Q31-e */
Word16 *dotp_e /* o : intermediate result exponent Q0 */
)
diff --git a/lib_com/get_gain.c b/lib_com/get_gain.c
index 9db8199567f9a798b2ab5742134d02df68500ba9..672e5f99936c0690421111b92aea1cd5610b2091 100644
--- a/lib_com/get_gain.c
+++ b/lib_com/get_gain.c
@@ -2,15 +2,20 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h"
#include "prot_fx.h"
-#include "stl.h"
#include "basop_util.h"
+/*----------------------------------------------------------------------------------*
+ * get_gain()
+ *
+ *
+ *----------------------------------------------------------------------------------*/
Word32 get_gain( /* output: codebook gain (adaptive or fixed) Q16 */
- Word16 x[], /* input : target signal */
- Word16 y[], /* input : filtered codebook excitation */
- Word16 n /* input : segment length */
+ const Word16 x[], /* input : target signal */
+ const Word16 y[], /* input : filtered codebook excitation */
+ const Word16 n /* input : segment length */
)
{
Word32 tcorr, tener, Lgain;
@@ -36,9 +41,9 @@ Word32 get_gain( /* output: codebook gain (adaptive or fixed) Q16 */
}
Word32 get_gain2( /* output: codebook gain (adaptive or fixed) Q16 */
- Word16 x[], /* input : target signal */
- Word16 y[], /* input : filtered codebook excitation */
- Word16 n /* input : segment length */
+ const Word16 x[], /* input : target signal */
+ const Word16 y[], /* input : filtered codebook excitation */
+ const Word16 n /* input : segment length */
)
{
Word32 tcorr, tener, Lgain;
diff --git a/lib_com/gs_bitallocation_fx.c b/lib_com/gs_bitallocation_fx.c
index f82fb3f2440533834e20398ae7f3f10803382af8..f05e78f7847a1413f84726d15745ca312e8b0ce3 100644
--- a/lib_com/gs_bitallocation_fx.c
+++ b/lib_com/gs_bitallocation_fx.c
@@ -1,7 +1,7 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "rom_com_fx.h" /* Static table prototypes */
@@ -45,44 +45,65 @@ void bands_and_bit_alloc_fx(
const Word32 core_brate, /* i : core bit rate */
const Word16 Diff_len, /* i : Lenght of the difference signal (before pure spectral)*/
const Word16 bits_used, /* i : Number of bit used before frequency Q */
- Word16 *bit, /* i/o: Number of bit allowed for frequency quantization */
+ Word16 *bit, /* i/o: Number of bit allowed for frequency quantization */
const Word16 *Ener_per_bd_iQ, /* i/o: Quantized energy vector */
- Word16 *max_ener_band, /* o : Sorted order */
- Word16 *out_bits_per_bands, /* i/o: Number of bit allowed per allowed subband Q3 */
- Word16 *nb_subbands, /* o : Number of subband allowed */
+ Word16 *max_ener_band, /* o : Sorted order */
+ Word16 *out_bits_per_bands, /* i/o: Number of bit allowed per allowed subband Q3 */
+ Word16 *nb_subbands, /* o : Number of subband allowed */
const Word16 *exc_diff, /* i : Difference signal to quantize (encoder side only) */
- Word16 *concat_in, /* o : Concatened PVQ's input vector (encoder side only) */
- Word16 *pvq_len, /* o : Number of bin covered with the PVQ */
+ Word16 *concat_in, /* o : Concatened PVQ's input vector (encoder side only) */
+ Word16 *pvq_len, /* o : Number of bin covered with the PVQ */
const Word16 coder_type, /* i : coding type */
const Word16 bwidth, /* i : input signal bandwidth */
- const Word16 GSC_noisy_speech
+ const Word16 GSC_noisy_speech, /* i : GSC noisy speech flag */
+ const Word16 L_frame, /* i : frame length */
+ const Word16 element_mode, /* i : element mode */
+ const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */
)
{
Word16 bandoffset, i, j, nb_bands_max, bit_new_bands, bit_tmp, st_band, nb_bands;
- Word16 ener_vec[MBANDS_GN]; /*Q12 */
+ Word16 ener_vec[MBANDS_GN_BITALLOC16k]; /*Q12 */
Word16 nb_tot_bands = 16;
Word16 bit_index, bit_index_mem, imax;
Word32 L_tmp;
Word32 sum_bit, bit_fracf;
Word16 etmp;
Word16 tmp;
- Word16 Ener_per_bd_iQ_tmp[MBANDS_GN];
+ Word16 Ener_per_bd_iQ_tmp[MBANDS_GN_BITALLOC16k];
Word16 pos, band;
Word16 SWB_bit_budget;
- Word32 bits_per_bands[MBANDS_GN];
+ Word32 bits_per_bands[MBANDS_GN_BITALLOC16k];
Word16 w_sum_bit;
+#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING
+ MY_UNUSED_Word(GSC_IVAS_mode)
+ MY_UNUSED_Word(element_mode)
+#endif
+ nb_tot_bands = MBANDS_GN;
+ move16();
+ if (EQ_16(L_frame, L_FRAME16k))
+ {
+ nb_tot_bands = MBANDS_GN_BITALLOC16k;
+ move16();
+ }
+ Copy( Ener_per_bd_iQ, Ener_per_bd_iQ_tmp, nb_tot_bands);
- Copy( Ener_per_bd_iQ, Ener_per_bd_iQ_tmp, MBANDS_GN );
-
- set32_fx( bits_per_bands, 0, MBANDS_GN );
- set16_fx( out_bits_per_bands, 0, MBANDS_GN );
+ set32_fx( bits_per_bands, 0, MBANDS_GN_BITALLOC16k);
+ set16_fx( out_bits_per_bands, 0, MBANDS_GN_BITALLOC16k);
/* To adapt current energy band to PVQ freq band for sorting*/
ener_vec[0] = add(Ener_per_bd_iQ[0],Ener_per_bd_iQ[1]); /*Q12 */
- Copy( Ener_per_bd_iQ_tmp+1, ener_vec, 15 ); /*Q12 */
- ener_vec[15] = ener_vec[14];
+ Copy( Ener_per_bd_iQ_tmp+1, ener_vec, MBANDS_GN-1); /*Q12 */
+ ener_vec[MBANDS_GN-1] = ener_vec[MBANDS_GN-2];
move16();
+ IF (EQ_16(L_frame, L_FRAME16k))
+ {
+ ener_vec[16] = Ener_per_bd_iQ[16];
+ ener_vec[17] = mac_r(L_mult(Ener_per_bd_iQ[16], 16384), Ener_per_bd_iQ[17],16384);
+ ener_vec[18] = Ener_per_bd_iQ[17];
+ ener_vec[19] = mult_r(Ener_per_bd_iQ[17], 26214);
+ move16(); move16(); move16(); move16();
+ }
/*------------------------------------------------------------------------
* Determination of the number of bits available to the frequency domain
@@ -93,8 +114,40 @@ void bands_and_bit_alloc_fx(
move16();
bit_new_bands = 5;
move16();
+#ifdef ADD_LRTD
+ if (GT_32(core_brate, ACELP_16k40) && EQ_16(L_frame, L_FRAME16k))
+ {
+ bit_new_bands = 7;
+ move16();
+ }
+
+ i = 0;
+ move16();
+ WHILE (LT_16(i, SIZE_BRATE_INTERMED_TBL))
+ {
+ IF (LE_32(core_brate, brate_intermed_tbl[i]))
+ {
+ BREAK;
+ }
+
+ IF (EQ_32(brate_intermed_tbl[i], ACELP_24k40))
+ {
+ BREAK;
+ }
+
+ i = add(i,1);
+ }
+ if (GT_16(element_mode, EVS_MONO) && EQ_16(coder_type, AUDIO) &&
+ LE_32(core_brate, STEREO_GSC_BIT_RATE_ALLOC) && EQ_32(brate_intermed_tbl[i], ACELP_9k60)) /* Bit allocation should be mapped to 8 kb/s instead of 9.6 kb/s in this case */
+ {
+ i = sub(i,1);
+ }
+
+ bit_index = i_mult2( BRATE2IDX_fx(brate_intermed_tbl[i]), 17);
+#else
bit_index = i_mult2(BRATE2IDX_fx(core_brate),17);
+#endif
bit_index_mem = bit_index;
move16();
@@ -130,352 +183,762 @@ void bands_and_bit_alloc_fx(
move16();
}
- IF( EQ_16(GSC_noisy_speech,1))
- {
- SWB_bit_budget = *bit;
- move16();
- nb_bands = 5;
- move16();
- st_band = nb_bands;
- move16();
-
- set32_fx( bits_per_bands, 0, MBANDS_GN );
- /*bit_fracf = (1.0f/nb_bands)*(SWB_bit_budget); */
- bit_fracf = L_mult(div_s(1,nb_bands),shl(SWB_bit_budget,2)); /* Q18 */
-
- nb_tot_bands = sub(nb_bands_max,6);
- nb_tot_bands = s_min(nb_tot_bands, 16);
-
- FOR(j = 0; j < 2; j++)
+#ifdef ADD_LRTD
+ if (L_frame == L_FRAME16k)
{
- i = j;
- move16();
- max_ener_band[j] = i;
- move16();
- ener_vec[i] = 0;
- move16();
- }
-
- FOR(; j < nb_bands; j++)
- {
- i = maximum_fx(ener_vec, nb_tot_bands, &etmp);
- max_ener_band[j] = i;
- move16();
- ener_vec[i] = 0;
- move16();
+ *bit -= 8;
}
- set32_fx(bits_per_bands, bit_fracf, nb_bands);
- }
- ELSE
+ if (coder_type == INACTIVE && core_brate <= GSC_LRES_GAINQ_LIMIT) /* can happen only for 2nd channel inactive */
{
- bit_index++;
- bit_tmp = sub(*bit,GSC_freq_bits[bit_index]);
- bit_index++;
- nb_bands_max = add(nb_bands_max,GSC_freq_bits[bit_index]);
- bit_index++;
-
- *pvq_len = 112;
- move16();
- st_band = 7;
- move16();
+ *bit += GSC_LRES_NB_NITS;
+ }
- IF( LE_32(core_brate,ACELP_9k60))
+ if (*bit > 0)
+ {
+ if (GSC_IVAS_mode > 0)
{
- *pvq_len = 80;
- move16();
+ SWB_bit_budget = *bit;
st_band = 5;
- move16();
- IF( Diff_len == 0 )
+ set_f(bits_per_bands, 0, MBANDS_GN_BITALLOC16k);
+
+ /* 2- Decide the pourcentage of bits allocated to LF (between 50-75%) depending of the temporal contribution in GSC */
+ bit_fracf = (-0.125f * Diff_len + 76.0f) / 100;
+ bit_fracf = check_bounds(bit_fracf, 0.50f, 0.75f);
+
+ /* Adjusment of the bitrate between LF and HF base on the content type */
+ /* 1 = new GSC bit alloc
+ 2 = GSC bit alloc for tc frame
+ 3 = more music like (should not happen often given music is coded with dft) */
+
+ if (GSC_IVAS_mode <= 3)
{
- nb_bands_max = add(nb_bands_max,2);
- bit_tmp = sub(bit_tmp,13);
+ nb_bands_max -= 6;
}
- }
- ELSE IF( Diff_len == 0 )
- {
- nb_bands_max = add(nb_bands_max,2);
- bit_tmp = sub(bit_tmp,17);
- }
+ if (GSC_IVAS_mode == 2)
+ {
+ bit_fracf += 0.1f;
+ nb_bands_max--;
+ }
- nb_bands = shr(*pvq_len,4);
-
- /*------------------------------------------------------------------------
- * Ajustement of the maximum number of bands in function of the
- * dynamics of the spectrum (more or less speech like)
- *-----------------------------------------------------------------------*/
- test();
- test();
- test();
- test();
- IF( EQ_16(coder_type,INACTIVE)||GE_16(noise_lev,NOISE_LEVEL_SP3))
- {
- /* Probably classification error -> concentrate bits on LF */
- nb_bands_max = nb_bands;
- move16();
- if( GE_32(core_brate,ACELP_8k00))
+ if (GSC_IVAS_mode == 3)
{
- nb_bands_max = add(nb_bands,1);
+ bit_fracf -= 0.1f;
+ nb_bands_max += 3;
}
- }
- ELSE IF( GE_16(noise_lev,NOISE_LEVEL_SP2)||
- (LE_32(core_brate,ACELP_13k20) && GE_32(core_brate,ACELP_9k60) && cor_strong_limit == 0) ) /* Very low dynamic, tend to speech, do not try to code HF at all */
- {
- nb_bands_max = sub(nb_bands_max,2);
- }
- ELSE if( GE_16(noise_lev,NOISE_LEVEL_SP1)) /* Very low dynamic, tend to speech, code less HF */
- {
- nb_bands_max = sub(nb_bands_max,1);
- }
- test();
- if( EQ_16(bwidth,NB)&>_16(nb_bands_max,10))
- {
- nb_bands_max = 10;
- move16();
- }
+ /* First find how much we want to share between LF and HF, at low bitrate, a miminum of bits is needed in LF by limitating the number of bands*/
+ /* Adjust the number of band based on the content type and bitrate */
+ nb_bands_adj = 1.0f;
+ if (GSC_IVAS_mode == 1 && core_brate < GSC_L_RATE_STG)
+ {
+ nb_bands_adj = 0.0125f * SWB_bit_budget - 0.75f;
+ }
+ else if (GSC_IVAS_mode != 2 && core_brate > GSC_H_RATE_STG)
+ {
+ nb_bands_adj = 0.02f * SWB_bit_budget - 1.2f;
+ }
+ nb_bands_max = (int16_t)(nb_bands_max * nb_bands_adj + 0.5f);
+ nb_bands_max = check_bounds_s(nb_bands_max, 5, nb_tot_bands);
- /*------------------------------------------------------------------------
- * Find extra number of band to code according to bit rate availables
- *-----------------------------------------------------------------------*/
- WHILE ( GE_16(bit_tmp,bit_new_bands)&&LE_16(nb_bands,sub(nb_bands_max,1)))
- {
- bit_tmp = sub(bit_tmp,bit_new_bands);
- nb_bands = add(nb_bands,1);
- }
+ bit_fracf *= SWB_bit_budget;
- /*------------------------------------------------------------------------
- * Fractional bits to distribute on the first x bands
- *-----------------------------------------------------------------------*/
+ /* Estimation of the number of bit used in HF */
+ /* with only the first weigthing The number of bits in max_ener_band[st_band-1] = 17% of bit_fracf */
+ mb = .17f * bit_fracf;
+ mp = (2.0f * DSR_NB_PULSE);
+ if (core_brate < GSC_L_RATE_STG && GSC_IVAS_mode == 3)
+ {
+ mp = 1.5f * DSR_NB_PULSE;
+ }
+ else if (core_brate < GSC_L_RATE_STG)
+ {
+ mp = DSR_NB_PULSE;
+ }
- bit_fracf = L_mult(div_s(1,st_band),shl(bit_tmp,2)); /* Q18 */
+ /* We want max_ener_band[st_band] <= max_ener_band[st_band-1] and max_ener_band[nb_bands_max-1] <= max_ener_band[st_band]*/
+ /* We will estimate the number of bits to allocate of HF and put the remaining bits, if any, back on LF */
+ /* compute the total possible number of band to be coded */
+ nb_tot_bands = (int16_t)((SWB_bit_budget - bit_fracf) / (mp + (mb - mp) / 2.0f));
+ mp = min(mp, mb);
+ if (nb_tot_bands + st_band > nb_bands_max)
+ {
+ bit_adj = ((mb + mp) / 2) * (nb_tot_bands + st_band - nb_bands_max);
+ bit_adj = max(0, bit_adj);
+ nb_tot_bands = nb_bands_max - st_band;
+ bit_fracf += bit_adj;
+ }
+ nb_tot_bands += st_band;
- /*------------------------------------------------------------------------
- * Complete the bit allocation per frequency band
- *-----------------------------------------------------------------------*/
- imax = 5;
- move16();
+ /* Allocate bits to LF */
+ etmp = 0.23f;
+ for (j = 0; j < st_band; j++)
+ {
+ i = j;
+ max_ener_band[j] = i;
+ ener_vec[i] = MIN16B;
+ bits_per_bands[j] = etmp * bit_fracf;
+ etmp -= 0.015f;
+ }
- if( GT_32(core_brate,ACELP_9k60))
- {
- imax = 7;
- move16();
- }
- FOR(i = 0; i < imax; i++)
- {
- bits_per_bands[i] = L_add(GSC_freq_bits_fx[bit_index],bit_fracf);
- move32();/* Q18 */
- bit_index = add(bit_index,1);
- }
+ SWB_bit_budget -= bit_fracf;
- IF( Diff_len == 0 )
- {
- bit_index = add(bit_index_mem,10);
- FOR( i = 0; i < 7; i++ )
+ /* Find low energy band in HF */
+ set_s(nb_pulse_per_band, 2, MBANDS_GN_BITALLOC16k);
+ for (i = st_band + 2; i < nb_tot_bands - 1; i++)
{
- bits_per_bands[i] = L_add(bits_per_bands[i],GSC_freq_bits_fx[bit_index]);
- move32();/*chk Q18 */
- bit_index = add(bit_index,1);
+ if (ener_vec[i] < ener_vec[i - 1] && ener_vec[i] < ener_vec[i + 1])
+ {
+ nb_pulse_per_band[i] = 1;
+ }
}
- }
+ for (j = st_band; j < nb_tot_bands; j++)
+ {
+ if (j > 6)
+ {
+ i = maximum(ener_vec, nb_tot_bands, &etmp);
+ }
+ else
+ {
+ i = j;
+ }
- /*--------------------------------------------------------------------------
- * Complete the bit allocation per frequency band for 16kHz high brate mode
- *--------------------------------------------------------------------------*/
+ max_ener_band[j] = i;
+ ener_vec[i] = MIN16B;
+ }
- FOR( j = st_band; j < nb_bands; j++ )
- {
- bits_per_bands[j] = L_shl(bit_new_bands,18);
- move32(); /*chk Q18 */
- }
+ /* Recompute the final bit distribution for HF */
+ if (nb_tot_bands > st_band)
+ {
+ bit_fracf = DSR_NB_PULSE;
+ mb = (SWB_bit_budget * 2 / (nb_tot_bands - st_band)) - mp;
+ bit_fracf = (mb - mp) / (nb_tot_bands - st_band);
+ mb -= bit_fracf;
+ /* Do the distribution */
+ for (j = st_band; j < nb_tot_bands; j++)
+ {
+ if (nb_pulse_per_band[max_ener_band[j]] > 1)
+ {
+ bits_per_bands[max_ener_band[j]] = mb;
+ }
+ else
+ {
+ bits_per_bands[max_ener_band[j]] = 4.5f;
+ }
+ mb -= bit_fracf;
+ SWB_bit_budget -= bits_per_bands[max_ener_band[j]];
+ }
+ }
- /*--------------------------------------------------------------------------
- * Compute a maximum band (band offset) for the search on maximal energy
- * This is function of the spectral dynamic and the bitrate
- *--------------------------------------------------------------------------*/
+ /* Series of verification in case bit allocated != the budget */
+ if (SWB_bit_budget > 0)
+ {
+ i = st_band - 1;
+ while (SWB_bit_budget > 0)
+ {
+ bits_per_bands[i]++;
+ SWB_bit_budget--;
+ i--;
+ if (i == -1)
+ {
+ i = st_band - 1;
+ }
+ }
+ }
- bandoffset = sub(nb_tot_bands,add(nb_bands,2));
+ nb_bands = nb_tot_bands;
- test();
- test();
- test();
- test();
- test();
- IF( LE_16(noise_lev,NOISE_LEVEL_SP1a))
- {
- bandoffset = sub(bandoffset,1);
- }
- ELSE if ( (LE_32(core_brate,ACELP_13k20)&&(EQ_16(coder_type,INACTIVE)||GE_16(noise_lev,NOISE_LEVEL_SP3)))||
- (LE_32(core_brate,ACELP_13k20) && GE_32(core_brate,ACELP_9k60) && cor_strong_limit == 0) )
- {
- bandoffset = add(bandoffset,1);
- }
+ sum_bit = 0;
+ j = 0;
+ for (i = 0; i < nb_bands; i++)
+ {
+ if (bits_per_bands[i] > 112)
+ {
+ sum_bit += bits_per_bands[i] - 112;
+ bits_per_bands[i] = 112;
+ j = i + 1;
+ }
- bandoffset = s_max(bandoffset ,0);
+ /* safety check for overage bit reallocation */
+ else if (bits_per_bands[i] + sum_bit / 3 > 112)
+ {
+ j = i + 1;
+ }
+ }
- /*--------------------------------------------------------------------------
- * Initiazed sorted vector
- * For the first x bands to be included in th final sorted vector
- * Sort the remaining bands in decrease energy order
- *--------------------------------------------------------------------------*/
- FOR(j = 0; j < nb_tot_bands; j++)
- {
- max_ener_band[j] = -10;
- move16();
+ if (sum_bit != 0)
+ {
+ sum_bit /= (nb_bands - j);
+ for (i = j; i < nb_bands; i++)
+ {
+ bits_per_bands[i] += sum_bit;
+ }
+ }
}
- FOR(j = 0; j < st_band; j++)
+ else
+#endif
+ IF(EQ_16(GSC_noisy_speech, 1))
{
- max_ener_band[j] = j;
+ SWB_bit_budget = *bit;
move16();
- ener_vec[j] = -10;
+ nb_bands = 5;
move16();
+
+#ifdef ADD_LRTD
+
+ fzero_val = 0.0f;
+ if (element_mode > EVS_MONO)
+ {
+ fzero_val = MIN16B_FLT;
+ }
+
+ if (coder_type == UNVOICED && element_mode > EVS_MONO)
+ {
+ nb_bands = 3;
+ if (SWB_bit_budget > 20)
+ {
+ nb_bands = 5;
+ }
+ }
+ else if (bwidth < SWB)
+ {
+ nb_bands = 7;
+ }
+
+#endif
+
+ st_band = nb_bands;
+ move16();
+
+ set32_fx(bits_per_bands, 0, MBANDS_GN);
+ /*bit_fracf = (1.0f/nb_bands)*(SWB_bit_budget); */
+ bit_fracf = L_mult(div_s(1, nb_bands), shl(SWB_bit_budget, 2)); /* Q18 */
+
+ nb_tot_bands = sub(nb_bands_max, 6);
+ nb_tot_bands = s_min(nb_tot_bands, 16);
+
+ FOR(j = 0; j < 2; j++)
+ {
+ i = j;
+ move16();
+ max_ener_band[j] = i;
+ move16();
+ ener_vec[i] = 0;
+ move16();
+ }
+#ifdef ADD_LRTD
+ if (bwidth < SWB)
+ {
+ if (coder_type == UNVOICED && element_mode > EVS_MONO)
+ {
+ nb_tot_bands = 5;
+ }
+#endif
+ FOR(; j < nb_bands; j++)
+ {
+ i = maximum_fx(ener_vec, nb_tot_bands, &etmp);
+ max_ener_band[j] = i;
+ move16();
+ ener_vec[i] = 0;
+ move16();
+ }
+#ifdef ADD_LRTD
+ }
+ else
+ {
+ for (; j < nb_bands; j++)
+ {
+ i = maximum(ener_vec, nb_tot_bands, &etmp);
+ max_ener_band[j] = i;
+ ener_vec[i] = fzero_val;
+ }
+ }
+#endif
+ set32_fx(bits_per_bands, bit_fracf, nb_bands);
}
- pos = st_band;
- move16();
- FOR(; j < nb_bands; j++)
+ ELSE
{
- i = maximum_fx(ener_vec, sub(nb_tot_bands,bandoffset), &etmp);
- pos = s_max(pos,i);
- max_ener_band[j] = i;
+ bit_index++;
+ bit_tmp = sub(*bit,GSC_freq_bits[bit_index]);
+ bit_index++;
+ nb_bands_max = add(nb_bands_max,GSC_freq_bits[bit_index]);
+ bit_index++;
+
+ *pvq_len = 112;
move16();
- ener_vec[i] = -10;
+ st_band = 7;
move16();
- }
-
- /* re-allocate bits to the frames such that the highest band with allocated bits is higher than the threshold */
- test();
- test();
- test();
- IF( GT_16(sub(nb_tot_bands, bandoffset),nb_bands)&&(GT_16(pos,7)&&EQ_32(core_brate,ACELP_8k00))&&EQ_16(bwidth,WB))
- {
- band = sub(nb_tot_bands, add(bandoffset,nb_bands));
- FOR(j=0; j ACELP_16k40)
{
- i = maximum_fx( ener_vec, sub(nb_tot_bands,bandoffset), &etmp );
- max_ener_band[add(nb_bands,j)] = i;
+ *pvq_len = 160;
+ st_band = 10;
+ nb_bands = *pvq_len / 16;
+ bit_tmp -= 35;
+ bit_new_bands = 5;
+ }
+#endif
+ IF(LE_32(core_brate,ACELP_9k60))
+ {
+ *pvq_len = 80;
move16();
- ener_vec[i] = -10;
+ st_band = 5;
move16();
- bits_per_bands[add(nb_bands,j)] = 1310720;
- move32(); /*Q18 */
+
+ IF(Diff_len == 0)
+ {
+ nb_bands_max = add(nb_bands_max,2);
+ bit_tmp = sub(bit_tmp,13);
+ }
}
- nb_bands = add(nb_bands,band);
- bit_tmp = i_mult2(band,5);
+ ELSE IF(Diff_len == 0)
+ {
+ nb_bands_max = add(nb_bands_max,2);
+ bit_tmp = sub(bit_tmp,17);
+ }
- IF( LE_16(band,2))
+ nb_bands = shr(*pvq_len,4);
+#ifdef ADD_LRTD
+ nb_bands_max = min(nb_bands_max, MBANDS_GN_BITALLOC16k);
+#endif
+ /*------------------------------------------------------------------------
+ * Ajustement of the maximum number of bands in function of the
+ * dynamics of the spectrum (more or less speech like)
+ *-----------------------------------------------------------------------*/
+ test();
+ test();
+ test();
+ test();
+ IF(EQ_16(coder_type,INACTIVE) || GE_16(noise_lev,NOISE_LEVEL_SP3))
+ {
+ /* Probably classification error -> concentrate bits on LF */
+#ifdef ADD_LRTD
+ if (L_frame == L_FRAME16k && core_brate >= ACELP_24k40)
+ {
+ nb_bands_max = nb_tot_bands - 2;
+ }
+ else if (core_brate >= ACELP_16k40)
+ {
+ nb_bands_max = nb_bands + 2;
+ }
+ else
+#endif
+ if (GE_32(core_brate,ACELP_8k00))
+ {
+ nb_bands_max = add(nb_bands,1);
+ }
+ else
+ {
+ nb_bands_max = nb_bands;
+ move16();
+ }
+ }
+ ELSE IF(GE_16(noise_lev,NOISE_LEVEL_SP2) ||
+ (LE_32(core_brate,ACELP_13k20) && GE_32(core_brate,ACELP_9k60) && cor_strong_limit == 0)) /* Very low dynamic, tend to speech, do not try to code HF at all */
+ {
+ nb_bands_max = sub(nb_bands_max,2);
+ }
+ ELSE if (GE_16(noise_lev,NOISE_LEVEL_SP1)) /* Very low dynamic, tend to speech, code less HF */
+ {
+ nb_bands_max = sub(nb_bands_max,1);
+ }
+ #ifdef ADD_LRTD
+ if (L_frame == L_FRAME16k)
{
- FOR(j = sub(st_band,1); j < nb_bands; j++)
+ if (core_brate < ACELP_24k40)
{
- bits_per_bands[j] = L_add(bits_per_bands[j],262144); /*Q18 */ move32();
+ nb_bands_max -= 4;
+ }
+ else if (core_brate < ACELP_32k)
+ {
+ if (Diff_len > 0 || noise_lev >= NOISE_LEVEL_SP2)
+ {
+ nb_bands_max -= 2;
+ bit_new_bands *= 2;
+ }
+ }
+ else if (core_brate >= ACELP_32k)
+ {
+ bit_new_bands *= 2;
}
- bit_tmp = add(bit_tmp, add(sub(nb_bands, st_band) , 1));
}
- i = 0;
+#endif
+ test();
+ if (EQ_16(bwidth,NB) && GT_16(nb_bands_max,10))
+ {
+ nb_bands_max = 10;
+ move16();
+ }
+
+ /*------------------------------------------------------------------------
+ * Find extra number of band to code according to bit rate availables
+ *-----------------------------------------------------------------------*/
+ WHILE(GE_16(bit_tmp,bit_new_bands) && LE_16(nb_bands,sub(nb_bands_max,1)))
+ {
+ bit_tmp = sub(bit_tmp,bit_new_bands);
+ nb_bands = add(nb_bands,1);
+ }
+
+ /*------------------------------------------------------------------------
+ * Fractional bits to distribute on the first x bands
+ *-----------------------------------------------------------------------*/
+#ifdef ADD_LRTD
+ if (L_frame == L_FRAME16k && core_brate > ACELP_32k)
+ {
+ bit_fracf = 0;
+ }
+ else
+#endif
+ {
+ bit_fracf = L_mult(div_s(1, st_band), shl(bit_tmp, 2)); /* Q18 */
+ }
+ /*------------------------------------------------------------------------
+ * Complete the bit allocation per frequency band
+ *-----------------------------------------------------------------------*/
+ imax = 5;
move16();
- j = 0;
+
+ if (GT_32(core_brate,ACELP_9k60))
+ {
+ imax = 7;
+ move16();
+ }
+ FOR(i = 0; i < imax; i++)
+ {
+ bits_per_bands[i] = L_add(GSC_freq_bits_fx[bit_index],bit_fracf);
+ move32();/* Q18 */
+ bit_index = add(bit_index,1);
+ }
+#ifdef ADD_LRTD
+ if (L_frame == L_FRAME16k && core_brate > ACELP_16k40)
+ {
+ bit_index = 0;
+ i = imax - 1;
+ bits_per_bands[i] += Compl_GSC_freq_bits[bit_index];
+ i++;
+ bit_index++;
+
+ for (; i < 10; i++)
+ {
+ bits_per_bands[i] += Compl_GSC_freq_bits[bit_index] + bit_fracf;
+ bit_index++;
+ }
+ }
+#endif
+ IF(Diff_len == 0)
+ {
+ bit_index = add(bit_index_mem,10);
+ FOR(i = 0; i < 7; i++)
+ {
+ bits_per_bands[i] = L_add(bits_per_bands[i],GSC_freq_bits_fx[bit_index]);
+ move32();/*chk Q18 */
+ bit_index = add(bit_index,1);
+ }
+ }
+#ifdef ADD_LRTD
+ if (bit_fracf < 0)
+ {
+ for (j = 0; j < nb_tot_bands; j++)
+ {
+ bits_per_bands[j] = max(bits_per_bands[j], 0);
+ }
+ }
+
+#endif
+ /*--------------------------------------------------------------------------
+ * Complete the bit allocation per frequency band for 16kHz high brate mode
+ *--------------------------------------------------------------------------*/
+#ifdef ADD_LRTD
+ if (L_frame == L_FRAME16k && core_brate > ACELP_32k)
+ {
+ for (j = st_band; j < nb_bands; j++)
+ {
+ bits_per_bands[j] = bit_new_bands;
+ }
+
+ bit_fracf = (1.0f / nb_bands) * (bit_tmp);
+
+ etmp = 2.0f * bit_fracf / (nb_bands + 1);
+ bit_fracf = etmp;
+ for (j = nb_bands - 1; j >= 0; j--)
+ {
+ bits_per_bands[j] += etmp;
+ etmp += bit_fracf;
+ }
+ }
+ else
+#endif
+ {
+ FOR(j = st_band; j < nb_bands; j++)
+ {
+ bits_per_bands[j] = L_shl(bit_new_bands, 18);
+ move32(); /*chk Q18 */
+ }
+ }
+
+ /*--------------------------------------------------------------------------
+ * Compute a maximum band (band offset) for the search on maximal energy
+ * This is function of the spectral dynamic and the bitrate
+ *--------------------------------------------------------------------------*/
+
+ bandoffset = sub(nb_tot_bands,add(nb_bands,2));
+
+ test();
+ test();
+ test();
+ test();
+ test();
+ IF(LE_16(noise_lev,NOISE_LEVEL_SP1a))
+ {
+ bandoffset = sub(bandoffset,1);
+ }
+ ELSE if ((LE_32(core_brate,ACELP_13k20) && (EQ_16(coder_type,INACTIVE) || GE_16(noise_lev,NOISE_LEVEL_SP3))) ||
+ (LE_32(core_brate,ACELP_13k20) && GE_32(core_brate,ACELP_9k60) && cor_strong_limit == 0))
+ {
+ bandoffset = add(bandoffset,1);
+ }
+
+ bandoffset = s_max(bandoffset ,0);
+
+ /*--------------------------------------------------------------------------
+ * Initiazed sorted vector
+ * For the first x bands to be included in th final sorted vector
+ * Sort the remaining bands in decrease energy order
+ *--------------------------------------------------------------------------*/
+ FOR(j = 0; j < nb_tot_bands; j++)
+ {
+ max_ener_band[j] = -10;
+ move16();
+ }
+ FOR(j = 0; j < st_band; j++)
+ {
+ max_ener_band[j] = j;
+ move16();
+ ener_vec[j] = -10;
+ move16();
+ }
+ pos = st_band;
move16();
- FOR( ; bit_tmp > 0; bit_tmp--)
+ FOR(; j < nb_bands; j++)
{
- bits_per_bands[j] = L_sub(bits_per_bands[j],262144); /*Q18 */
- j = add(j,1);
- if ( EQ_16(j,sub(st_band, i)))
+ i = maximum_fx(ener_vec, sub(nb_tot_bands,bandoffset), &etmp);
+ pos = s_max(pos,i);
+ max_ener_band[j] = i;
+ move16();
+ ener_vec[i] = -10;
+ move16();
+ }
+
+ /* re-allocate bits to the frames such that the highest band with allocated bits is higher than the threshold */
+ test();
+ test();
+ test();
+ IF(GT_16(sub(nb_tot_bands, bandoffset),nb_bands) && (GT_16(pos,7) && EQ_32(core_brate,ACELP_8k00)) && EQ_16(bwidth,WB))
+ {
+ band = sub(nb_tot_bands, add(bandoffset,nb_bands));
+ FOR(j = 0; j < band; j++)
{
- j = 0;
+ i = maximum_fx(ener_vec, sub(nb_tot_bands,bandoffset), &etmp);
+ max_ener_band[add(nb_bands,j)] = i;
move16();
+ ener_vec[i] = -10;
+ move16();
+ bits_per_bands[add(nb_bands,j)] = 1310720;
+ move32(); /*Q18 */
+ }
+ nb_bands = add(nb_bands,band);
+
+ bit_tmp = i_mult2(band,5);
+
+ IF(LE_16(band,2))
+ {
+ FOR(j = sub(st_band,1); j < nb_bands; j++)
+ {
+ bits_per_bands[j] = L_add(bits_per_bands[j],262144); /*Q18 */ move32();
+ }
+ bit_tmp = add(bit_tmp, add(sub(nb_bands, st_band) , 1));
}
- test();
- if( j == 0 && LT_16(i,sub(st_band, 1)))
+
+ i = 0;
+ move16();
+ j = 0;
+ move16();
+ FOR(; bit_tmp > 0; bit_tmp--)
{
- i = add(i,1);
+ bits_per_bands[j] = L_sub(bits_per_bands[j],262144); /*Q18 */
+ j = add(j,1);
+ if (EQ_16(j,sub(st_band, i)))
+ {
+ j = 0;
+ move16();
+ }
+ test();
+ if (j == 0 && LT_16(i,sub(st_band, 1)))
+ {
+ i = add(i,1);
+ }
}
}
}
- }
- /*--------------------------------------------------------------------------
- * Bit sum verification for GSC inactive at very high rate
- * The maximum number of bits per band of length 16 is 112
- * Redistribute the overage bits if needed
- *--------------------------------------------------------------------------*/
- sum_bit = 0;
- move16();
- j = 0;
- move16();
- FOR( i = 0; i < nb_bands; i++ )
- {
- L_tmp = Mult_32_16(sum_bit,10923);
+ /*--------------------------------------------------------------------------
+ * Bit sum verification for GSC inactive at very high rate
+ * The maximum number of bits per band of length 16 is 112
+ * Redistribute the overage bits if needed
+ *--------------------------------------------------------------------------*/
+ sum_bit = 0;
+ move16();
+ j = 0;
+ move16();
+ FOR(i = 0; i < nb_bands; i++)
+ {
+ L_tmp = Mult_32_16(sum_bit, 10923);
- IF( GT_32(bits_per_bands[i],29360128)) /* 112 in Q18 */
+ IF(GT_32(bits_per_bands[i], 29360128)) /* 112 in Q18 */
+ {
+ sum_bit = L_add(sum_bit, L_sub(bits_per_bands[i], 29360128)); /* Q18 */
+ bits_per_bands[i] = 29360128;
+ move32();
+ j = add(i, 1);
+ }
+ ELSE if (GT_32(L_add(bits_per_bands[i], L_tmp), 29360128)) /* Q18 */
+ {
+ j = add(i, 1);
+ }
+ }
+
+ IF(sum_bit != 0)
{
- sum_bit = L_add(sum_bit,L_sub(bits_per_bands[i],29360128)); /* Q18 */
- bits_per_bands[i] = 29360128;
- move32();
- j = add(i,1);
+ tmp = sub(nb_bands, j);
+ sum_bit = Mult_32_16(sum_bit, div_s(1, tmp)); /* Q18 */
+ FOR(i = j; i < nb_bands; i++)
+ {
+ bits_per_bands[i] = L_add(bits_per_bands[i], sum_bit);
+ move32();/* Q18 */
+ }
}
- ELSE if( GT_32(L_add(bits_per_bands[i],L_tmp),29360128 )) /* Q18 */
+ /*--------------------------------------------------------------------------
+ * second step of bit sum verification, normally sum_bit == *bit
+ *--------------------------------------------------------------------------*/
+ w_sum_bit = 0;
+ move16();
+ FOR(i = 0; i < nb_bands; i++)
{
- j = add(i,1);
+ out_bits_per_bands[i] = shl(extract_l(L_shr(bits_per_bands[i], 18)), 3);
+ move16();
+ w_sum_bit = add(w_sum_bit, out_bits_per_bands[i]); /* Q3 */
}
- }
-
- IF( sum_bit != 0 )
- {
- tmp = sub(nb_bands,j);
- sum_bit = Mult_32_16(sum_bit,div_s(1,tmp)); /* Q18 */
- FOR( i = j; i < nb_bands; i++ )
+ tmp = shl(*bit, 3);
+#ifdef ADD_LRTD
+ if (GSC_IVAS_mode != 0 && sum_bit < *bit) /* If we need to add bits, we are doing it on the LF */
{
- bits_per_bands[i] = L_add(bits_per_bands[i],sum_bit);
- move32();/* Q18 */
+ reajust_bits(bits_per_bands, 0, nb_bands, (int16_t)sum_bit, *bit);
}
- }
- /*--------------------------------------------------------------------------
- * second step of bit sum verification, normally sum_bit == *bit
- *--------------------------------------------------------------------------*/
- w_sum_bit = 0;
- move16();
- FOR( i = 0; i < nb_bands; i++ )
- {
- out_bits_per_bands[i] = shl(extract_l(L_shr(bits_per_bands[i],18)),3);
+ else
+ {
+ reajust_bits(bits_per_bands, nb_bands - 1, 0, (int16_t)sum_bit, *bit);
+ }
+#else
+ IF(GT_16(tmp, w_sum_bit))
+ {
+ i = sub(nb_bands, 1);
+ move16();
+ FOR(; tmp > w_sum_bit; w_sum_bit += (1 << 3))
+ {
+ out_bits_per_bands[i] = add(out_bits_per_bands[i], 1 << 3);
+ move16();
+ i = sub(i, 1);
+ if (i == 0)
+ {
+ i = sub(nb_bands, 1);
+ }
+ }
+ }
+#endif
+ /*--------------------------------------------------------------------------
+ * Recompute the real number/length of frequency bands to encode
+ *--------------------------------------------------------------------------*/
+ * nb_subbands = nb_bands;
move16();
- w_sum_bit = add(w_sum_bit,out_bits_per_bands[i]); /* Q3 */
- }
- tmp = shl(*bit,3);
+ *pvq_len = shl(*nb_subbands, 4);
- IF( GT_16(tmp,w_sum_bit))
- {
- i = sub(nb_bands,1);
- move16();
- FOR( ; tmp > w_sum_bit; w_sum_bit += (1<<3) )
+ /*--------------------------------------------------------------------------
+ * Concatenate bands (encoder only)
+ *--------------------------------------------------------------------------*/
+ IF(exc_diff != NULL)
{
- out_bits_per_bands[i] = add(out_bits_per_bands[i],1<<3);
- move16();
- i = sub(i, 1);
- if(i==0)
+ FOR(j = 0; j < nb_bands; j++)
{
- i = sub(nb_bands,1);
+ Copy(exc_diff + shl(max_ener_band[j], 4), concat_in + shl(j, 4), 16);
}
}
+#ifdef ADD_LRTD
+ }
+ else /* *bit == 0 */
+ {
+ set_s(bits_per_bands_s, 0, nb_tot_bands);
+ *nb_subbands = 0;
+ *pvq_len = 0;
+ }
+#endif
+ return;
+}
+#ifdef ADD_LRTD
+/*-------------------------------------------------------------------*
+ * reajust_bits()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static void reajust_bits(
+ float* bits_per_bands,
+ const int16_t st_band,
+ const int16_t end_band,
+ const int16_t sum_bit_in,
+ const int16_t bit_bdgt_in)
+{
+ int16_t i, amount_to_add, incr;
+ int16_t bit_bdgt, sum_bit;
+
+ incr = 1;
+ if (end_band < st_band)
+ {
+ incr = -1;
+ }
+
+ if (bit_bdgt_in < sum_bit_in)
+ {
+ amount_to_add = -1;
+ bit_bdgt = sum_bit_in;
+ sum_bit = bit_bdgt_in;
+ }
+ else
+ {
+ bit_bdgt = bit_bdgt_in;
+ sum_bit = sum_bit_in;
+ amount_to_add = 1;
}
- /*--------------------------------------------------------------------------
- * Recompute the real number/length of frequency bands to encode
- *--------------------------------------------------------------------------*/
- *nb_subbands = nb_bands;
- move16();
- *pvq_len = shl(*nb_subbands,4);
- /*--------------------------------------------------------------------------
- * Concatenate bands (encoder only)
- *--------------------------------------------------------------------------*/
- IF( exc_diff != NULL )
+ i = st_band;
+ while (bit_bdgt > sum_bit)
{
- FOR( j = 0; j < nb_bands; j++ )
+ if (amount_to_add > 0 || (amount_to_add < 0 && bits_per_bands[i] > 1))
{
- Copy( exc_diff + shl(max_ener_band[j],4), concat_in+shl(j,4), 16 );
+ bits_per_bands[i] += amount_to_add;
+ sum_bit += (int16_t)abs(amount_to_add);
+ }
+
+ i += incr;
+ if (i == end_band)
+ {
+ i = st_band;
}
}
return;
}
+
+#endif
\ No newline at end of file
diff --git a/lib_com/gs_gains_fx.c b/lib_com/gs_gains_fx.c
index 438c75016d15f61410dedeefef9e6db5f83274df..43bf6c97982dc31c7293253a927729656ef030ef 100644
--- a/lib_com/gs_gains_fx.c
+++ b/lib_com/gs_gains_fx.c
@@ -421,7 +421,7 @@ Word16 gsc_gaindec_fx( /* o : average frequency gain */
* Quantization of the energy per band
*-------------------------------------------------------------------*/
Word16 gsc_gainQ_fx( /*Q12*/
- Encoder_State_fx *st_fx, /* i/o: decoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */
const Word16 y_gain4[], /* i : Energy per band Q12 */
Word16 y_gainQ[], /* o : quantized energy per band Q12 */
const Word32 core_brate, /* i : Core rate */
@@ -470,7 +470,7 @@ Word16 gsc_gainQ_fx( /*Q12*/
/* Quantized mean gain without clipping */
mean_4g[0] = round_fx(L_tmp);
idx_g = vquant_fx(mean_4g, Gain_meanNB_fx, mean_4g, Gain_mean_dicNB_fx, 1, 64);
- push_indice_fx( st_fx, IND_MEAN_GAIN2, idx_g, 6 );
+ push_indice_fx( hBstr, IND_MEAN_GAIN2, idx_g, 6 );
FOR(i = 0; i < Mbands_gn; i++)
{
@@ -482,21 +482,21 @@ Word16 gsc_gainQ_fx( /*Q12*/
move16();
set16_fx(y_gain_tmp+10, 0, MBANDS_GN-10);
idx_g = vquant_fx(y_gain_tmp, Mean_dic_NB_fx, y_gain_tmp, Gain_dic1_NB_fx, 3, 64);
- push_indice_fx( st_fx, IND_Y_GAIN_TMP, idx_g, 6 );
+ push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 6 );
IF(LT_32(core_brate,ACELP_9k60))
{
idx_g = vquant_fx(y_gain_tmp+3, Mean_dic_NB_fx+3, y_gain_tmp+3, Gain_dic2_NB_fx, 3, 32);
- push_indice_fx( st_fx, IND_Y_GAIN_TMP, idx_g, 5 );
+ push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 );
idx_g = vquant_fx(y_gain_tmp+6, Mean_dic_NB_fx+6, y_gain_tmp+6, Gain_dic3_NB_fx, 4, 16);
- push_indice_fx( st_fx, IND_Y_GAIN_TMP, idx_g, 4 );
+ push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 4 );
}
ELSE
{
idx_g = vquant_fx(y_gain_tmp+3, Mean_dic_NB_fx+3, y_gain_tmp+3, Gain_dic2_NBHR_fx, 3, 64);
- push_indice_fx( st_fx, IND_Y_GAIN_TMP, idx_g, 6 );
+ push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 6 );
idx_g = vquant_fx(y_gain_tmp+6, Mean_dic_NB_fx+6, y_gain_tmp+6, Gain_dic3_NBHR_fx, 4, 128);
- push_indice_fx( st_fx, IND_Y_GAIN_TMP, idx_g, 7 );
+ push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 7 );
}/*add end */
test();
@@ -559,7 +559,7 @@ Word16 gsc_gainQ_fx( /*Q12*/
/*idx_g = (short)vquant(mean_4g, mean_m, mean_4g, mean_gain_dic, 1, 64);*/
idx_g = vquant_fx(mean_4g, mean_m_fx, mean_4g, mean_gain_dic_fx, 1, 64);
- push_indice_fx( st_fx, IND_MEAN_GAIN2, idx_g, 6 );
+ push_indice_fx( hBstr, IND_MEAN_GAIN2, idx_g, 6 );
FOR(i = 0; i < Mbands_gn; i++)
{
@@ -585,13 +585,13 @@ Word16 gsc_gainQ_fx( /*Q12*/
/*idx_g = (short)vquant(y_gain_tmp2, YGain_mean_LR, y_gain_tmp2, YGain_dic1_LR, 3, 32);*/
idx_g = vquant_fx(y_gain_tmp2, YGain_mean_LR_fx, y_gain_tmp2, YGain_dic1_LR_fx, 3, 32 );
- push_indice_fx( st_fx, IND_Y_GAIN_TMP, idx_g, 5 );
+ push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 );
/*idx_g = (short)vquant(y_gain_tmp2+3, YGain_mean_LR+3, y_gain_tmp2+3, YGain_dic2_LR, 4, 32);*/
idx_g = vquant_fx(y_gain_tmp2+3, YGain_mean_LR_fx+3, y_gain_tmp2+3, YGain_dic2_LR_fx, 4, 32 );
- push_indice_fx( st_fx, IND_Y_GAIN_TMP, idx_g, 5 );
+ push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 );
/*idx_g = (short)vquant(y_gain_tmp2+7, YGain_mean_LR+7, y_gain_tmp2+7, YGain_dic3_LR, 5, 32);*/
idx_g = vquant_fx(y_gain_tmp2+7, YGain_mean_LR_fx+7, y_gain_tmp2+7, YGain_dic3_LR_fx, 5, 32);
- push_indice_fx( st_fx, IND_Y_GAIN_TMP, idx_g, 5 );
+ push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 );
/*set_f(y_gain_tmp2+12, 0, MBANDS_GN-12);*/
set16_fx(y_gain_tmp2+12, 0, MBANDS_GN-12);
@@ -625,13 +625,13 @@ Word16 gsc_gainQ_fx( /*Q12*/
ELSE
{
idx_g = vquant_fx(y_gain_tmp, YG_mean16_fx, y_gain_tmp, YG_dicMR_1_fx, 4, 64);
- push_indice_fx( st_fx, IND_Y_GAIN_TMP, idx_g, 6 );
+ push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 6 );
idx_g = vquant_fx(y_gain_tmp+4, YG_mean16_fx+4, y_gain_tmp+4, YG_dicMR_2_fx, 4, 32);
- push_indice_fx( st_fx, IND_Y_GAIN_TMP, idx_g, 5 );
+ push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 );
idx_g = vquant_fx(y_gain_tmp+8, YG_mean16_fx+8, y_gain_tmp+8, YG_dicMR_3_fx, 4, 32);
- push_indice_fx( st_fx, IND_Y_GAIN_TMP, idx_g, 5 );
+ push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 5 );
idx_g = vquant_fx(y_gain_tmp+12, YG_mean16_fx+12, y_gain_tmp+12, YG_dicMR_4_fx, 4, 16);
- push_indice_fx( st_fx, IND_Y_GAIN_TMP, idx_g, 4 );
+ push_indice_fx( hBstr, IND_Y_GAIN_TMP, idx_g, 4 );
}
}
diff --git a/lib_com/gs_inact_switching_fx.c b/lib_com/gs_inact_switching_fx.c
index a92a7199e7d012c1f34b3782c5128dee350f0774..73aa990f7b602bf7c9af28a7a08aca639c8680e2 100644
--- a/lib_com/gs_inact_switching_fx.c
+++ b/lib_com/gs_inact_switching_fx.c
@@ -84,7 +84,7 @@ void Inac_swtch_ematch_fx(
ELSE IF( EQ_16(coder_type,VOICED)||EQ_16(coder_type,GENERIC)||EQ_16(coder_type,TRANSITION)||NE_16(last_core,ACELP_CORE)||NE_16(last_codec_mode,MODE1))
{
/* Find spectrum and energy per band for GC and VC frames */
- edct_16fx( exc2, dct_exc_tmp, L_frame, 5 );
+ edct_16fx( exc2, dct_exc_tmp, L_frame, 5, EVS_MONO);
Ener_per_band_comp_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1);
@@ -98,7 +98,7 @@ void Inac_swtch_ematch_fx(
ELSE IF( EQ_16(coder_type,INACTIVE)&&LE_32(core_brate,ACELP_24k40))
{
/* Find spectrum and energy per band for inactive frames */
- edct_16fx( exc2, dct_exc_tmp, L_frame, 5 );
+ edct_16fx( exc2, dct_exc_tmp, L_frame, 5, EVS_MONO);
Ener_per_band_comp_fx( dct_exc_tmp, Ener_per_bd, Q_exc, MBANDS_GN, 1 );
/* More agressive smoothing in the first 50 frames */
@@ -146,7 +146,7 @@ void Inac_swtch_ematch_fx(
}
/* Going back to time */
- edct_16fx( dct_exc_tmp, exc2, L_frame, 5 );
+ edct_16fx( dct_exc_tmp, exc2, L_frame, 5 , EVS_MONO);
}
return;
diff --git a/lib_com/gs_noisefill_fx.c b/lib_com/gs_noisefill_fx.c
index 4c83b664599aa3ac5d35e3c1fe3fbc41a5f82fba..008970de68c636bf637a386a1b4d9396bab674b8 100644
--- a/lib_com/gs_noisefill_fx.c
+++ b/lib_com/gs_noisefill_fx.c
@@ -1,11 +1,10 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h"
#include "rom_com_fx.h"
#include "prot_fx.h"
-#include "stl.h"
/*-------------------------------------------------------------------*
* gs_noisf()
@@ -16,11 +15,11 @@
static void gs_noisf_fx(
const Word16 Start_BIN, /* i : First bin for noise fill */
const Word16 NB_Qbins, /* i : Number of bin per band */
- const Word16 Noise_fac, /* i : Noise level Q15 */
- const Word16 *y_norm, /* i : Quantized pulses Qn */
- Word16 *exc_diffQ, /* o : Quantized pulses with noise added Qn */
- Word16 *seed_tcx, /* i : Random generator seed */
- const Word16 coder_type, /* i : coder type */
+ const Word16 Noise_fac, /* i : Noise level Q15 */
+ const Word16 *y_norm, /* i : Quantized pulses Qn */
+ Word16 *exc_diffQ, /* o : Quantized pulses with noise added Qn */
+ Word16 *seed_tcx, /* i : Random generator seed */
+ const Word16 coder_type, /* i : coder type */
Word16 qNoise_fac
)
{
@@ -153,15 +152,16 @@ static void EstimateNoiseLevel_inner_fx(
/* _ None */
/*==========================================================================*/
static void EstimateNoiseLevel_fx(
- Word16 *noisepb, /* o : Noise per band */
- const Word32 bitrate, /* i : Bitrate of the codec */
- const Word16 Diff_len, /* i : number of bin before cut-off frequency */
- const Word16 Mbands_gn, /* i : number of bands */
- const Word16 coder_type, /* i : coder type */
- const Word16 noise_lev, /* i : pulses dynamic */
- const Word16 pit_band_idx, /* i : bin position of the cut-off frequency */
- Word16 last_bin, /* i : the last bin of bit allocation */
- Word16 bwidth
+ Word16 *noisepb, /* o : Noise per band */
+ const Word32 bitrate, /* i : Bitrate of the codec */
+ const Word16 Diff_len, /* i : number of bin before cut-off frequency */
+ const Word16 Mbands_gn, /* i : number of bands */
+ const Word16 coder_type, /* i : coder type */
+ const Word16 noise_lev, /* i : pulses dynamic */
+ const Word16 pit_band_idx, /* i : bin position of the cut-off frequency */
+ Word16 last_bin, /* i : the last bin of bit allocation */
+ Word16 bwidth,
+ const int16_t L_frame /* i : frame length */
)
{
Word16 i_band;
@@ -169,7 +169,7 @@ static void EstimateNoiseLevel_fx(
i_band = 0;
move16();
- IF( LT_16(Diff_len,L_FRAME))
+ IF( LT_16(Diff_len, L_frame))
{
EstimateNoiseLevel_inner_fx(noisepb, bitrate, i_band, MBANDS_GN);
IF( coder_type != INACTIVE )
@@ -195,7 +195,7 @@ static void EstimateNoiseLevel_fx(
}
}
test();
- IF ( (EQ_16(coder_type,INACTIVE)||GE_16(noise_lev,NOISE_LEVEL_SP3)))
+ IF ( (EQ_16(coder_type,INACTIVE)||GE_16(noise_lev,NOISE_LEVEL_SP3)) && EQ_16(L_frame, L_FRAME))
{
FOR( i_band = 9; i_band < Mbands_gn; i_band++ )
{
@@ -203,6 +203,39 @@ static void EstimateNoiseLevel_fx(
move16();/*noisepb[i_band]*1.15=noisepb[i_band] *(1 + 0.15) */
}
}
+ ELSE IF(EQ_16(L_frame, L_FRAME16k))
+ {
+ IF (EQ_32(bitrate, ACELP_13k20))
+ {
+ set16_fx(noisepb, 14746/*0.45*/, Mbands_gn);
+ }
+
+ IF (EQ_16(coder_type, INACTIVE))
+ {
+ FOR (; i_band < Mbands_gn; i_band++)
+ {
+ noisepb[i_band] = 13107/*.4f*/;
+ move16();
+ }
+ }
+ ELSE IF (LE_16(noise_lev, NOISE_LEVEL_SP1) && GT_32(bitrate, ACELP_16k40))
+ {
+ FOR (; i_band < sub(Mbands_gn, 4); i_band++)
+ {
+ noisepb[i_band] = mult_r(noisepb[i_band], 19661)/*.6f*/;
+ move16();
+ }
+ }
+ ELSE IF (LE_16(noise_lev, NOISE_LEVEL_SP2) && GT_32(bitrate, ACELP_16k40))
+ {
+ FOR (; i_band < sub(Mbands_gn, 4); i_band++)
+ {
+ noisepb[i_band] = mult_r(noisepb[i_band], 26214)/*.8f*/;
+ move16();
+ }
+ }
+ }
+
return;
}
@@ -289,7 +322,9 @@ void freq_dnw_scaling_fx(
const Word16 noise_lev, /* i : Noise level */
const Word32 core_brate, /* i : Core bitrate */
Word16 fy_norm[], /* i/o: Frequency quantized parameter */
- Word16 Qx /* Q format of fy_norm*/
+ Word16 Qx, /* Q format of fy_norm*/
+ const int16_t L_frame /* i : frame length */
+
)
{
Word16 sc_dyn;
@@ -297,7 +332,7 @@ void freq_dnw_scaling_fx(
sc_dyn = 32767;
move16(); /*Q15 */
- start_sc = L_FRAME;
+ start_sc = L_frame;
move16();
test();
IF( LE_32(core_brate,ACELP_8k00)&&EQ_16(coder_type,INACTIVE))
@@ -324,7 +359,13 @@ void freq_dnw_scaling_fx(
}
}
- FOR(i = start_sc; i < L_FRAME; i++)
+ IF (EQ_16(L_frame, L_FRAME16k) && LE_32(core_brate, ACELP_24k40))
+ {
+ /*sc_dyn += 0.125f;*/
+ sc_dyn = add(sc_dyn, 4096); /* Saturates to 1.0 */
+ }
+
+ FOR(i = start_sc; i < L_frame; i++)
{
fy_norm[i] = mult_r(fy_norm[i],sc_dyn);
move16();/*Qx */
@@ -334,7 +375,7 @@ void freq_dnw_scaling_fx(
test();
IF( (LT_32(core_brate,ACELP_13k20)&&cor_strong_limit==0)||LT_32(core_brate,ACELP_9k60))
{
- FOR(i = 160; i < L_FRAME; i++)
+ FOR(i = 160; i < L_frame; i++)
{
fy_norm[i] = s_min(fy_norm[i],shl(1,Qx));
move16();
@@ -344,7 +385,7 @@ void freq_dnw_scaling_fx(
}
ELSE IF ( LT_32(core_brate,ACELP_22k60))
{
- FOR(i = 160; i < L_FRAME; i++)
+ FOR(i = 160; i < L_frame; i++)
{
fy_norm[i] = s_min(fy_norm[i],shr_r(1536,sub(10,Qx)));
move16();
@@ -358,7 +399,7 @@ void freq_dnw_scaling_fx(
}
static void Decreas_freqPeak_fx(
- Word16 *lsf_new, /* i : ISFs at the end of the frame */
+ const Word16 *lsf_new, /* i : ISFs at the end of the frame */
Word16 *exc_diffQ, /* i/o: frequency coefficients of per band */
Word16 rat /* i : threshold of ratio between consecutive lsf_new_diff */
)
@@ -366,7 +407,7 @@ static void Decreas_freqPeak_fx(
Word16 i, j, k;
Word16 last_bin = 0;
Word16 pos = 0;
- Word16 *src, max,avrg;
+ Word16 *src, max_val,avrg;
Word32 L_avrg,L_tmp;
Word16 lsf_new_diff[M];
Word16 tmp,tmp1,exp;
@@ -382,13 +423,13 @@ static void Decreas_freqPeak_fx(
avrg = 0;
move16();
L_avrg = L_deposit_l(0);
- max = 1;
+ max_val = 1;
move16();
FOR(i=160; i 0 && EQ_16(GSC_noisy_speech, 1)))
+ {
+ set16_fx(noisepb, 13107/*0.4f*/, MBANDS_GN16k);
+ }
ELSE
{
- EstimateNoiseLevel_fx( noisepb, core_brate, Diff_len, last_bin, coder_type, noise_lev, pit_band_idx,
- last_bin_tmp, bwidth );
+ EstimateNoiseLevel_fx( noisepb, core_brate, Diff_len, last_bin, coder_type, noise_lev, pit_band_idx, last_bin_tmp, bwidth, L_frame );
}
IF( exc_wo_nf != NULL )
{
- Copy( exc_diffQ, exc_wo_nf, L_FRAME );
+ Copy( exc_diffQ, exc_wo_nf, L_frame);
}
test();
- IF( GSC_noisy_speech && !bfi )
+
+ IF(GSC_IVAS_mode == 0 && GSC_noisy_speech && !bfi && LE_16(element_mode, IVAS_SCE))
{
set16_fx( noisepb, 3277, MBANDS_GN );
}
- Apply_NoiseFill_fx( exc_diffQ, seed_tcx, noisepb, Diff_len, last_bin, coder_type, mfreq_bindiv, Qexc_diffQ );
-
+ IF (LT_32(core_brate, 6000) && LE_16(coder_type, UNVOICED))
+ {
+ FOR (i = 0; i < L_frame; i++)
+ {
+ IF (exc_diffQ[i] == 0)
+ {
+ PMT("code below to be validated for IVAS use")
+ /* exc_diffQ[i] += 2.0f * noisepb[0] * ((float)own_random(seed_tcx) / PCM16_TO_FLT_FAC);*/
+ tmp = mult(shl(noisepb[0],1), Random(seed_tcx));/*Q15 */
+ tmp = shr(tmp, sub(15, Qexc_diffQ));/*qNoise_fac */
+ exc_diffQ[i] = add(exc_diffQ[i], tmp);
+ move16();/*Q */
+ }
+ }
+ }
+ ELSE
+ {
+ Apply_NoiseFill_fx(exc_diffQ, seed_tcx, noisepb, Diff_len, last_bin, coder_type, mfreq_bindiv, Qexc_diffQ);
+ }
/*--------------------------------------------------------------------------------------*
* Quantize average gain
- * Substract Q averaged gain
+ * Subtract Q averaged gain
* VQ of remaining gain per band
*--------------------------------------------------------------------------------------*/
test();
@@ -722,7 +796,7 @@ void highband_exc_dct_in_fx(
{
Ener_per_band_comp_fx(exc_diffQ, Ener_per_bd_yQ, Qexc_diffQ, MBANDS_GN, 1 );
- IF( LT_16(nb_subfr, 4))
+ IF( LT_16(nb_subfr, 4) && LT_16(L_frame, L_FRAME16k))
{
FOR(i = L_FRAME-16; i < L_FRAME; i++)
{
@@ -777,21 +851,81 @@ void highband_exc_dct_in_fx(
/*--------------------------------------------------------------------------------------*
* Apply decoded gain onto the difference signal
*--------------------------------------------------------------------------------------*/
+#ifdef ADD_LRTD
+ if (GSC_IVAS_mode >= 1)
+ {
+ float scale_factLF = 0.9f;
+ float scale_factHF = 0.9f;
+
+ if (GSC_IVAS_mode == 1 && GSC_noisy_speech == 0)
+ {
+ scale_factHF = 0.8f;
+ }
+ else if (GSC_IVAS_mode == 2 || GSC_noisy_speech == 1)
+ {
+ scale_factHF = 0.71f;
+ }
+ else if (GSC_IVAS_mode == 3)
+ {
+ scale_factHF = 0.9f;
+ }
+ for (i = 0; i < pit_band_idx * 16; i++)
+ {
+ exc_diffQ[i] *= scale_factLF;
+ }
+ for (; i < L_frame; i++)
+ {
+ exc_diffQ[i] *= scale_factHF;
+ }
+ }
+ else if (GSC_noisy_speech)
+ {
+ float scale_fact = 0.9f;
+
+ if (element_mode == IVAS_CPE_TD)
+ {
+ if (coder_type == INACTIVE)
+ {
+ scale_fact = 1.0f;
+ }
+ else
+ {
+ scale_fact = 0.95f;
+ }
+ }
+ else if (element_mode > IVAS_SCE)
+ {
+ scale_fact = 0.71f;
+ }
+
+ for (i = 0; i < L_frame; i++)
+ {
+ exc_diffQ[i] *= scale_fact;
+ }
+ }
+ if (GSC_noisy_speech && element_mode > IVAS_SCE && core_brate < ACELP_7k20)
+ {
+ for (i = 80; i < L_frame; i++)
+ {
+ exc_diffQ[i] *= (+0.0024f * (float)i + 1.192f);
+ }
+ }
+#else
IF( GSC_noisy_speech )
{
- FOR( i= 0; i < L_FRAME; i++ )
+ FOR( i= 0; i < L_frame; i++ )
{
exc_diffQ[i] = mult_r(exc_diffQ[i], 29491);
move16();
}
}
-
+#endif
Comp_and_apply_gain_fx( exc_diffQ, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 0, Qexc_diffQ, Q_exc );
IF( exc_wo_nf != NULL )
{
Comp_and_apply_gain_fx( exc_wo_nf, Ener_per_bd_iQ, Ener_per_bd_yQ, last_bin, 1 , Qexc_diffQ, Q_exc);
- Vr_add( exc_dct_in, exc_wo_nf, exc_wo_nf, L_FRAME );
+ Vr_add( exc_dct_in, exc_wo_nf, exc_wo_nf, L_frame );
}
/*--------------------------------------------------------------------------------------*
* add the correction layer to the LF bins,
@@ -800,7 +934,7 @@ void highband_exc_dct_in_fx(
* DC is Zeroed
*--------------------------------------------------------------------------------------*/
- Vr_add( exc_dct_in, exc_diffQ, exc_dct_in, L_FRAME );
+ Vr_add( exc_dct_in, exc_diffQ, exc_dct_in, L_frame );
test();
IF( core_brate == ACELP_8k00 && bwidth != NB )
{
@@ -913,7 +1047,7 @@ void highband_exc_dct_in_fx(
}
}
- Copy( &exc_dct_in[64], &last_exc_dct_in[64], L_FRAME-64 );
+ Copy( &exc_dct_in[64], &last_exc_dct_in[64], L_frame-64 );
Copy(&bitallocation_band[4], last_bitallocation_band, 6);
*last_ener = ener;
move16();
diff --git a/lib_com/gs_preech_fx.c b/lib_com/gs_preech_fx.c
index 75928b745fcb7a5c252fda8d2f469a6191ff760b..17bf45ea2065b3fadadc2875204dd2469846b710 100644
--- a/lib_com/gs_preech_fx.c
+++ b/lib_com/gs_preech_fx.c
@@ -2,21 +2,23 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "rom_com_fx.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h"
/*-------------------------------------------------------------------*
* Local constants
*-------------------------------------------------------------------*/
+#define ATT_LENGHT16k 80
+/*#define INV_L_FRAME16k ( 1.0f / L_FRAME16k )*/
#define ATT_LENGHT 64
#define ATT_SEG_LEN (L_FRAME/ATT_LENGHT)
-#define INV_ATT_SEG_LEN (1.0f/ATT_SEG_LEN)
-#define INV_L_FRAME (1.0f/L_FRAME)
+/*#define INV_ATT_SEG_LEN (1.0f/ATT_SEG_LEN)*/
+/*#define INV_L_FRAME (1.0f/L_FRAME)*/
/*==========================================================================*/
/* FUNCTION : void pre_echo_att_fx(); */
@@ -39,38 +41,46 @@
/* _ None */
/*==========================================================================*/
void pre_echo_att_fx(
- Word32 *Last_frame_ener_fx, /* i/o: Energy of the last frame 2*Q_new+1*/
- Word16 *exc_fx, /* i/o: Excitation of the current frame Q_new*/
- const Word16 gsc_attack_flag_fx /* i : flag signalling attack encoded by AC mode (GSC) */
- ,const Word16 Q_new
- ,const Word16 last_coder_type_fx /* i : Last coding mode */
+ Word32 *Last_frame_ener_fx, /* i/o: Energy of the last frame 2*Q_new+1*/
+ Word16 *exc_fx, /* i/o: Excitation of the current frame Q_new*/
+ const Word16 gsc_attack_flag_fx, /* i : flag signalling attack encoded by AC mode (GSC) */
+ const Word16 Q_new,
+ const Word16 last_coder_type_fx, /* i : Last coding mode */
+ const Word16 L_frame /* i : Frame length*/
)
{
Word32 etmp_fx;
- Word32 finc_fx[ATT_LENGHT] = {0};
+ Word32 finc_fx[ATT_LENGHT16k] = {0};
Word16 ratio_fx;
Word16 attack_pos_fx, i;
Word32 L_tmp, L_tmp1;
Word16 tmp, n1, n2, exp, frac1, frac2;
Word32 etmp1_fx;
+ Word16 att_len;
+
test();
- IF ( EQ_16(gsc_attack_flag_fx,1)&&EQ_16(last_coder_type_fx,AUDIO)) /*gsc_attack_flag_fx does not get set for all the test cases */
+ IF ( GT_16(gsc_attack_flag_fx,0) && EQ_16(last_coder_type_fx,AUDIO)) /*gsc_attack_flag_fx does not get set for all the test cases */
{
/*-------------------------------------------------------------------------*
* Find where the onset (attack) occurs by computing the energy per section
* The inverse weighting aims to favor the first maxima in case of
* gradual onset
*-------------------------------------------------------------------------*/
- FOR(i = 0; i < ATT_LENGHT; i++)
+ att_len = ATT_LENGHT;
+ if (L_frame == L_FRAME16k)
+ {
+ att_len = ATT_LENGHT16k;
+ }
+ FOR(i = 0; i < att_len; i++)
{
L_tmp = sum2_fx(&exc_fx[shl(i,2)], ATT_SEG_LEN ); /*2*Q_new+1, //ATT_SEG_LEN=(L_FRAME/ATT_LENGHT)=4(=shl(x,2))*/
- tmp = div_s(sub(ATT_LENGHT,i),ATT_LENGHT); /*Q15 */
+ tmp = div_s(sub(att_len,i),att_len); /*Q15 */
L_tmp = Mult_32_16(L_tmp, tmp); /*2*Q_new+1 */
finc_fx[i] = L_tmp;
move32(); /*2*Q_new+1 */
}
- attack_pos_fx = maximum_32_fx(finc_fx, ATT_LENGHT, &etmp_fx);
+ attack_pos_fx = maximum_32_fx(finc_fx, att_len, &etmp_fx);
/* Scaled the maximum energy and allowed 6 dB increase*/
etmp_fx = L_shr(etmp_fx,add(2+1-4, shl(Q_new,1)));/*2*Q_new+1 //INV_ATT_SEG_LEN=1/4(=shr(x,2)) -> Q4 */
@@ -128,9 +138,13 @@ void pre_echo_att_fx(
* In normal cases, just compute the energy of the frame
*-------------------------------------------------------*/
- etmp_fx = sum2_fx( exc_fx, L_FRAME ); /*2*Q_new+1 */
-
+ etmp_fx = sum2_fx( exc_fx, L_frame ); /*2*Q_new+1 */
+#ifdef ADD_LRTD
+ PMTE()
+ etmp_fx = L_shr(etmp_fx, add(8 + 1 - 4, shl(Q_new, 1))); /*2*Q_new+1 //INV_L_FRAME = 1/256 -> Q4*/
+#else
etmp_fx = L_shr(etmp_fx,add(8+1-4, shl(Q_new,1))); /*2*Q_new+1 //INV_L_FRAME = 1/256 -> Q4*/
+#endif
*Last_frame_ener_fx = etmp_fx;
move32(); /*2*Q_new+1*/
}
diff --git a/lib_com/guided_plc_util.c b/lib_com/guided_plc_util.c
index 5c1fa7debd30a01d29742bb43b4b84fdbe417e39..12061e6bba52612ba3f00fe643edcbdfd9203537 100644
--- a/lib_com/guided_plc_util.c
+++ b/lib_com/guided_plc_util.c
@@ -2,14 +2,31 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
+#include "options.h"
#include "prot_fx.h"
-#include "stl.h"
#include "rom_com_fx.h"
-
#include "basop_util.h"
#include "rom_basop_util.h"
-void getLookAheadResSig( Word16 *speechLookAhead, Word16 *A_3Q12, Word16 *res, Word16 L_frame, Word16 numSubFrame )
+ /*-------------------------------------------------------------------*
+ * Local function prototypes
+ *-------------------------------------------------------------------*/
+static void reorder_lsfs(Word16* lsf, const Word16 min_dist, const Word16 n, const Word32 sr_core);
+
+
+/*-------------------------------------------------------------------*
+ * getLookAheadResSig()
+ *
+ *
+ *-------------------------------------------------------------------*/
+void getLookAheadResSig(
+ Word16 *speechLookAhead,
+ Word16 *A_3Q12,
+ Word16 *res,
+ const Word16 L_frame,
+ const Word16 numSubFrame
+)
{
Word16 *p_A;
Word16 i_subfr;
@@ -25,12 +42,8 @@ void getLookAheadResSig( Word16 *speechLookAhead, Word16 *A_3Q12, Word16 *res, W
FOR(i_subfr=0; i_subfrlsfoldbfi1_14Q1[i] );
L_tmp = L_mac( L_tmp, divide_by_3_Q15, decState->lsfoldbfi0_14Q1[i] );
@@ -59,8 +80,19 @@ void updateLSFForConcealment( HANDLE_PLC_ENC_EVS decState, Word16 *lsf_14Q1, Wor
return;
}
-
-void getConcealedLP( HANDLE_PLC_ENC_EVS memDecState, Word16 *AqCon, const Word16 lsfBase[], Word16 last_good, Word16 L_frame)
+/*-------------------------------------------------------------------*
+ * getConcealedLP()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void getConcealedLP(
+ PLC_ENC_EVS_HANDLE memDecState,
+ Word16 *AqCon,
+ const Word16 lsfBase[],
+ const Word16 last_good,
+ const Word16 L_frame
+)
{
Word16 *lsf;
Word16 lsp[(NB_DIV+1)*M];
@@ -72,14 +104,8 @@ void getConcealedLP( HANDLE_PLC_ENC_EVS memDecState, Word16 *AqCon, const Word16
dlpc_bfi( L_frame, &lsf[0], memDecState->lsfold_14Q1, last_good,
1, memDecState->mem_MA_14Q1, memDecState->mem_AR, &(memDecState->stab_fac_Q15), memDecState->lsf_adaptive_mean_14Q1,
- 1,
- NULL,
- 0,
- NULL,
- NULL,
- lsfBase,
- 0
- );
+ 1, NULL, 0, NULL, NULL, lsfBase, 0);
+
Copy( memDecState->lspold_Q15, lsp, M );
int_fs = INT_FS_FX;
@@ -95,29 +121,41 @@ void getConcealedLP( HANDLE_PLC_ENC_EVS memDecState, Word16 *AqCon, const Word16
return;
}
-
-void getConcealedLSF( HANDLE_PLC_ENC_EVS memDecState, const Word16 lsfBase[], Word16 last_good, Word16 L_frame)
+/*-------------------------------------------------------------------*
+ * getConcealedLSF()
+ *
+ *
+ *-------------------------------------------------------------------*/
+void getConcealedLSF(
+ PLC_ENC_EVS_HANDLE memDecState,
+ const Word16 lsfBase[],
+ const Word16 last_good,
+ const Word16 L_frame
+)
{
Word16 *lsf = memDecState->lsf_con;
dlpc_bfi( L_frame, &lsf[0], memDecState->lsfold_14Q1, last_good,
1, memDecState->mem_MA_14Q1, memDecState->mem_AR, &(memDecState->stab_fac_Q15), memDecState->lsf_adaptive_mean_14Q1,
- 1,
- NULL,
- 0,
- NULL,
- NULL,
- lsfBase,
- 0
- );
+ 1, NULL, 0, NULL, NULL, lsfBase, 0);
return;
}
-static void reorder_lsfs(Word16 *lsf, const Word16 min_dist, const Word16 n, const Word32 sr_core);
-
-void RecLpcSpecPowDiffuseLc( Word16 *lspq, Word16 *lsp_old, Word16 *lsfq, Decoder_State_fx *st, Word16 reset_q )
+/*-------------------------------------------------------------------*
+ * RecLpcSpecPowDiffuseLc()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void RecLpcSpecPowDiffuseLc(
+ Word16 *lspq,
+ Word16 *lsp_old,
+ Word16 *lsfq,
+ Decoder_State_fx *st,
+ const Word16 reset_q
+)
{
const Word16 *means;
Word16 lsf_old[M];
@@ -153,12 +191,16 @@ void RecLpcSpecPowDiffuseLc( Word16 *lspq, Word16 *lsp_old, Word16 *lsfq, Decode
return;
}
-
+/*-------------------------------------------------------------------*
+ * modify_lsf()
+ *
+ *
+ *-------------------------------------------------------------------*/
void modify_lsf(
Word16 *lsf,
const Word16 n,
- const Word32 sr_core
- , Word16 reset_q
+ const Word32 sr_core,
+ const Word16 reset_q
)
{
Word16 i, k, th_x1p28_Q14;
@@ -167,7 +209,7 @@ void modify_lsf(
th_x1p28_Q14 = 4864/*1900.0f*1.28f Q1*/;
move16();
- if( EQ_32( sr_core, 16000 ))
+ if( EQ_32( sr_core, INT_FS_16k))
{
th_x1p28_Q14 = 6080/*2375.0f*1.28f Q1*/;
move16();
@@ -176,7 +218,7 @@ void modify_lsf(
IF( reset_q == 0 )
{
th_x1p28_Q14 = 2048; /* 800.0f*1.28f Q1*/ move16();
- if( EQ_32( sr_core, 16000 ))
+ if( EQ_32( sr_core, INT_FS_16k))
{
th_x1p28_Q14 = 2560; /*1000.0f*1.28f Q1*/ move16();
}
@@ -226,7 +268,7 @@ static void reorder_lsfs(
fs2 = 16384/*6400.0 * 1.28 Q1*/;
move16();
- if(EQ_32(sr_core, 16000))
+ if(EQ_32(sr_core, INT_FS_16k))
{
fs2 = 20480/*8000.0 * 1.28 Q1*/;
move16();
@@ -235,7 +277,7 @@ static void reorder_lsfs(
/*-----------------------------------------------------------------*
* Verify the LSF ordering and minimum GAP
*-----------------------------------------------------------------*/
- IF( EQ_32( sr_core, 16000 ))
+ IF( EQ_32( sr_core, INT_FS_16k))
{
th1 = 3200;
move16();
diff --git a/lib_com/hp50.c b/lib_com/hp50.c
index 93b5219b68ae1e2efd597fe4adf368611364c5b5..a942ffdeae176d90e7ccd792a39166f1ad073114 100644
--- a/lib_com/hp50.c
+++ b/lib_com/hp50.c
@@ -3,11 +3,11 @@
====================================================================================*/
+#include
+#include "options.h"
#include
-#include "stl.h"
#include "prot_fx.h"
#include "basop_util.h"
-#include "options.h"
#define HP20_COEFF_SCALE (2)
@@ -138,17 +138,17 @@ static void filter_2nd_order(
}
-void hp20(Word16 signal[], /* i/o: signal to filter any */
- const Word16 stride, /* i : stride to be applied accessing signal */
- const Word16 lg, /* i : length of signal (integer) Q0 */
- Word32 mem[5], /* i/o: static filter memory with this layout: */
+void hp20(Word16 signal[], /* i/o: signal to filter any */
+ const Word16 stride, /* i : stride to be applied accessing signal */
+ const Word16 lg, /* i : length of signal (integer) Q0 */
+ Word32 mem[5], /* i/o: static filter memory with this layout: */
/* mem[0]: y[-2] (32-bit) */
/* mem[1]; y[-1] (32-bit) */
/* mem[2]: x[-2] << 16 */
/* mem[3]: x[-1] << 16 */
/* Note: mem[0..3] need to be scaled per frame */
/* mem[4]: states scale */
- const Word32 sFreq) /* i : input sampling rate Q0 */
+ const Word32 sFreq) /* i : input sampling rate Q0 */
{
Word32 a1, b1, a2, b2;
Word16 prescale, prescaleOld, diff;
@@ -232,15 +232,8 @@ void hp20(Word16 signal[], /* i/o: signal to filter any */
}
- filter_2nd_order(signal,
- stride,
- prescale,
- lg,
- mem,
- a1,
- a2,
- b1,
- b2);
+ filter_2nd_order(signal, stride, prescale, lg,
+ mem, a1, a2, b1, b2);
return;
}
diff --git a/lib_com/hq2_bit_alloc_fx.c b/lib_com/hq2_bit_alloc_fx.c
index 802ffc0eb4433bbb19e409c7fc66a22c63c10b24..7f1866b649d89f14a6e4759eb9c1d3e17eb6f911 100644
--- a/lib_com/hq2_bit_alloc_fx.c
+++ b/lib_com/hq2_bit_alloc_fx.c
@@ -2,9 +2,9 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h"
#include "prot_fx.h"
-#include "stl.h" /* required for wmc_tool */
#define MIN_BITS_FIX 0 /* QRk=18 */
#define HQ_16k40_BIT (HQ_16k40/50) /* 16400/50=328 */
@@ -228,12 +228,12 @@ void Bits2indvsb_fx (
void hq2_bit_alloc_har_fx (
const Word32 *L_y, /* i : Qbe band energy of sub-vectors */
- Word16 B_fx, /* i : Q0 number of available bits */
+ Word16 B_fx, /* i : Q0 number of available bits */
const Word16 N_fx, /* i : Q0 number of sub-vectors */
- Word32 *L_Rsubband, /* o : QRk sub-band bit-allocation vector */
- Word16 p2a_bands_fx, /* i : highfreq bands */
+ Word32 *L_Rsubband, /* o : QRk sub-band bit-allocation vector */
+ Word16 p2a_bands_fx, /* i : highfreq bands */
const Word32 L_core_brate, /* i : Q0 core bit rate */
- Word16 p2a_flags_fx[], /* i/o: Q0 p2a_flags */
+ Word16 p2a_flags_fx[], /* i/o: Q0 p2a_flags */
const Word16 band_width_fx[] /* i : Q0 table of band_width */
)
{
diff --git a/lib_com/hq2_core_com_fx.c b/lib_com/hq2_core_com_fx.c
index 8fd73d140b04b8f28e6b84274ce1eefe27cc11a5..497c285f38fc93c079d5bf1be2f6ba847e064836 100644
--- a/lib_com/hq2_core_com_fx.c
+++ b/lib_com/hq2_core_com_fx.c
@@ -1,12 +1,11 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h"
#include "cnst_fx.h" /* Audio core constants */
#include "rom_com_fx.h" /* Static table prototypes */
#include "prot_fx.h"
-#include "stl.h"
#include "basop_mpy.h"
/*--------------------------------------------------------------------------*
@@ -16,16 +15,16 @@
*--------------------------------------------------------------------------*/
void mdct_spectrum_denorm_fx(
- const Word16 inp_vector[], /* i : Q0 : */
- Word32 L_y2[], /* i/o : Qs : decoded spectrum */
- const Word16 band_start[], /* i : Q0 : table of start freq for every subband */
- const Word16 band_end[], /* i : Q0 : table of end freq for every subband */
- const Word16 band_width[], /* i : Q0 : table of bandwidth for every subband */
- const Word32 L_band_energy[], /* i : Qbe : band energy */
- const Word16 npulses[], /* i : Q0 : number of coded spectrum */
- const Word16 bands, /* i : Q0 : number of subbands */
- const Word16 ld_slope_fx, /* i : Q15 : */
- const Word16 pd_thresh_fx /* i : Q15 : */
+ const Word16 inp_vector[], /* i : Q0 : */
+ Word32 L_y2[], /* i/o : Qs : decoded spectrum */
+ const Word16 band_start[], /* i : Q0 : table of start freq for every subband */
+ const Word16 band_end[], /* i : Q0 : table of end freq for every subband */
+ const Word16 band_width[], /* i : Q0 : table of bandwidth for every subband */
+ const Word32 L_band_energy[], /* i : Qbe : band energy */
+ const Word16 npulses[], /* i : Q0 : number of coded spectrum */
+ const Word16 bands, /* i : Q0 : number of subbands */
+ const Word16 ld_slope_fx, /* i : Q15 : */
+ const Word16 pd_thresh_fx /* i : Q15 : */
)
{
Word16 i, k;
@@ -236,15 +235,15 @@ void hq2_core_configure_fx (
{
IF( is_transient )
{
- IF ( LE_16(num_bits, ACELP_7k20 / 50))
+ IF ( LE_16(num_bits, ACELP_7k20 / FRAMES_PER_SEC))
{
xcore_config_fx = &xcore_config_8kHz_007200bps_short_fx;
}
- ELSE IF ( LE_16(num_bits, ACELP_8k00 / 50))
+ ELSE IF ( LE_16(num_bits, ACELP_8k00 / FRAMES_PER_SEC))
{
xcore_config_fx = &xcore_config_8kHz_008000bps_short_fx;
}
- ELSE IF ( LE_16(num_bits, ACELP_13k20 / 50))
+ ELSE IF ( LE_16(num_bits, ACELP_13k20 / FRAMES_PER_SEC))
{
xcore_config_fx = &xcore_config_8kHz_013200bps_short_fx;
}
@@ -255,15 +254,15 @@ void hq2_core_configure_fx (
}
ELSE
{
- IF ( LE_16(num_bits, ACELP_7k20 / 50))
+ IF ( LE_16(num_bits, ACELP_7k20 / FRAMES_PER_SEC))
{
xcore_config_fx = &xcore_config_8kHz_007200bps_long_fx;
}
- ELSE IF ( LE_16(num_bits, ACELP_8k00 / 50))
+ ELSE IF ( LE_16(num_bits, ACELP_8k00 / FRAMES_PER_SEC))
{
xcore_config_fx = &xcore_config_8kHz_008000bps_long_fx;
}
- ELSE IF ( LE_16(num_bits, ACELP_13k20 / 50))
+ ELSE IF ( LE_16(num_bits, ACELP_13k20 / FRAMES_PER_SEC))
{
xcore_config_fx = &xcore_config_8kHz_013200bps_long_fx;
}
@@ -277,12 +276,12 @@ void hq2_core_configure_fx (
{
IF (is_transient)
{
- IF ( LE_16(num_bits, ACELP_13k20 / 50))
+ IF ( LE_16(num_bits, ACELP_13k20 / FRAMES_PER_SEC))
{
xcore_config_fx = &xcore_config_16kHz_013200bps_short_fx;
move16();
}
- ELSE if ( LE_16(num_bits, ACELP_16k40 / 50))
+ ELSE if ( LE_16(num_bits, ACELP_16k40 / FRAMES_PER_SEC))
{
xcore_config_fx = &xcore_config_16kHz_016400bps_short_fx;
move16();
@@ -290,12 +289,12 @@ void hq2_core_configure_fx (
}
ELSE
{
- IF ( LE_16(num_bits, ACELP_13k20 / 50))
+ IF ( LE_16(num_bits, ACELP_13k20 / FRAMES_PER_SEC))
{
xcore_config_fx = &xcore_config_16kHz_013200bps_long_fx;
move16();
}
- ELSE if ( LE_16(num_bits, ACELP_16k40 / 50))
+ ELSE if ( LE_16(num_bits, ACELP_16k40 / FRAMES_PER_SEC))
{
xcore_config_fx = &xcore_config_16kHz_016400bps_long_fx;
move16();
@@ -461,14 +460,14 @@ void reverse_transient_frame_energies_fx(
*--------------------------------------------------------------------------*/
void spt_shorten_domain_pre_fx(
- const Word16 band_start[], /* i: Starting position of sub band */
- const Word16 band_end[], /* i: End position of sub band */
- const Word16 prev_SWB_peak_pos[], /* i: Spectral peak */
- const Word16 BANDS, /* i: total number of bands */
- const Word32 L_bwe_br, /* i: bitrate information */
- Word16 new_band_start[], /* o: Starting position of new shorten sub band */
- Word16 new_band_end[], /* o: End position of new shorten sub band */
- Word16 new_band_width[] /* o: new sub band bandwidth */
+ const Word16 band_start[], /* i: Starting position of sub band */
+ const Word16 band_end[], /* i: End position of sub band */
+ const Word16 prev_SWB_peak_pos[], /* i: Spectral peak */
+ const Word16 BANDS, /* i: total number of bands */
+ const Word32 L_bwe_br, /* i: bitrate information */
+ Word16 new_band_start[], /* o: Starting position of new shorten sub band */
+ Word16 new_band_end[], /* o: End position of new shorten sub band */
+ Word16 new_band_width[] /* o: new sub band bandwidth */
)
{
Word16 j;
@@ -547,9 +546,9 @@ void spt_shorten_domain_band_save_fx(
const Word16 band_start[], /* i: starting position of subband */
const Word16 band_end[], /* i: end position of subband */
const Word16 band_width[], /* i: band width of subband */
- Word16 org_band_start[], /* o: starting position of subband */
- Word16 org_band_end[], /* o: end position of subband */
- Word16 org_band_width[] /* o: band width of subband */
+ Word16 org_band_start[], /* o: starting position of subband */
+ Word16 org_band_end[], /* o: end position of subband */
+ Word16 org_band_width[] /* o: band width of subband */
)
{
Word16 k;
@@ -579,9 +578,9 @@ void spt_shorten_domain_band_save_fx(
void spt_shorten_domain_band_restore_fx(
const Word16 bands, /* i: total subband */
- Word16 band_start[], /* i/o: starting position of subband */
- Word16 band_end[], /* i/o: end position of subband */
- Word16 band_width[], /* i/o: band width of subband */
+ Word16 band_start[], /* i/o: starting position of subband */
+ Word16 band_end[], /* i/o: end position of subband */
+ Word16 band_width[], /* i/o: band width of subband */
const Word16 org_band_start[], /* o: starting position of subband */
const Word16 org_band_end[], /* o: end position of subband */
const Word16 org_band_width[] /* o: band width of subband */
@@ -617,7 +616,7 @@ void spt_swb_peakpos_tmp_save_fx(
const Word16 bands, /* i: total number of bands */
const Word16 band_start[], /* i: starting position of subband */
const Word16 band_end[], /* i: end position of subband */
- Word16 prev_SWB_peak_pos_tmp[] /* o: spectral peaks */
+ Word16 prev_SWB_peak_pos_tmp[] /* o: spectral peaks */
)
{
diff --git a/lib_com/hq2_noise_inject_fx.c b/lib_com/hq2_noise_inject_fx.c
index b6de4103e92697904a6581429c84d36b2efd1b90..e73877ca43d439fd6bb64226c62c69e612aeed2c 100644
--- a/lib_com/hq2_noise_inject_fx.c
+++ b/lib_com/hq2_noise_inject_fx.c
@@ -2,8 +2,8 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h"
-#include "stl.h"
#include "prot_fx.h"
#include "math_op.h"
#include "math_32.h"
diff --git a/lib_com/hq_conf_fx.c b/lib_com/hq_conf_fx.c
index 1cacbdcf72c010f74d82bf81191d6a2097f3a6da..f8f128a4f52a0add4e0340dcf1fdfed85da052f5 100644
--- a/lib_com/hq_conf_fx.c
+++ b/lib_com/hq_conf_fx.c
@@ -2,12 +2,11 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
+#include
#include "options.h"
#include "cnst_fx.h" /* Audio core constants */
#include "rom_com_fx.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h" /* required for wmc_tool */
/*--------------------------------------------------------------------------*
* hq_configure()
@@ -16,59 +15,61 @@
*--------------------------------------------------------------------------*/
void hq_configure_fx(
- const Word16 length, /* i : Frame length Q0 */
- const Word16 hqswb_clas, /* i : HQ SWB class Q0 */
- const Word32 core_brate, /* i : Codec bitrate Q0 */
+ const Word16 length, /* i : Frame length Q0 */
+ const Word16 hqswb_clas, /* i : HQ SWB class Q0 */
+ const Word32 core_brate, /* i : Codec bitrate Q0 */
Word16 *num_sfm, /* o : Total number of subbands Q0 */
Word16 *nb_sfm, /* o : Total number of coded bands Q0 */
Word16 *start_norm, /* o : First norm to be SDE encoded Q0 */
Word16 *num_env_bands, /* o : Number coded envelope bands Q0 */
Word16 *numnrmibits, /* o : Number of bits in fall-back norm encoding Q0 */
Word16 *hq_generic_offset, /* o : Freq offset for HQ GENERIC Q0 */
- Word16 const **sfmsize, /* o : Subband bandwidths Q0 */
- Word16 const **sfm_start, /* o : Subband start coefficients Q0 */
- Word16 const **sfm_end /* o : Subband end coefficients Q0 */
+ Word16 *sfmsize, /* o : Subband bandwidths Q0 */
+ Word16 *sfm_start, /* o : Subband start coefficients Q0 */
+ Word16 *sfm_end /* o : Subband end coefficients Q0 */
)
{
+ const Word16* p_sfmsize;
+ const Word16* p_sfm_start;
+ const Word16* p_sfm_end;
+ Word16 i, bw_ext;
+
+ bw_ext = 0;
+
*start_norm = 0;
move16();
- IF ( EQ_16(length, L_FRAME48k))
+#ifndef SOLVED_COMP_ENC_DEC
+ IF(EQ_16(length, L_FRAME48k)) /*tbv SOLVED_COMP_ENC_DEC*/
+#else
+ IF ( EQ_16(length, L_SPEC48k))
+#endif
{
IF ( EQ_16(hqswb_clas, HQ_GEN_FB))
{
*num_sfm = NB_SFM;
move16();
- *sfmsize = band_len_HQ;
+ p_sfmsize = band_len_HQ;
move16();
- *sfm_start = band_start_HQ;
+ p_sfm_start = band_start_HQ;
move16();
- *sfm_end = band_end_HQ;
+ p_sfm_end = band_end_HQ;
move16();
test();
- IF ( EQ_32(core_brate, HQ_32k))
+ IF ( GE_32(core_brate, HQ_32k))
{
*hq_generic_offset = HQ_GENERIC_FOFFSET_32K;
move16();
- }
- ELSE IF ( EQ_32(core_brate, HQ_16k40)||EQ_32(core_brate,HQ_24k40))
- {
- *hq_generic_offset = HQ_GENERIC_FOFFSET_24K4;
- move16();
- }
-
- /* setting start frequency of FD BWE */
- test();
- IF ( EQ_32(core_brate, HQ_32k))
- {
*num_env_bands = SFM_N_STA_10k;
move16();
}
- ELSE IF ( EQ_32(core_brate, HQ_16k40)||EQ_32(core_brate,HQ_24k40))
+ ELSE /*IF(EQ_32(core_brate, HQ_16k40) || EQ_32(core_brate, HQ_24k40))*/
{
+ *hq_generic_offset = HQ_GENERIC_FOFFSET_24K4;
*num_env_bands = SFM_N_STA_8k;
move16();
+ move16();
}
*nb_sfm = *num_sfm;
move16();
@@ -84,28 +85,22 @@ void hq_configure_fx(
*num_env_bands = SFM_N_HARM_FB;
move16();
- *sfmsize = band_len_harm;
+ p_sfmsize = band_len_harm;
move16();
- *sfm_start = band_start_harm;
+ p_sfm_start = band_start_harm;
move16();
- *sfm_end = band_end_harm;
+ p_sfm_end = band_end_harm;
move16();
}
ELSE IF ( EQ_16(hqswb_clas, HQ_HVQ))
{
- IF ( EQ_32(core_brate, HQ_24k40))
+ IF ( LT_32(core_brate, HQ_BWE_CROSSOVER_BRATE))
{
*num_sfm = SFM_N_HARM_FB;
move16();
*nb_sfm = HVQ_THRES_SFM_24k;
move16();
*num_env_bands = sub(*num_sfm, *nb_sfm);
-
- *sfmsize = band_len_harm;
- move16();
- *sfm_start = band_start_harm;
- move16();
- *sfm_end = band_end_harm;
move16();
*start_norm = HVQ_THRES_SFM_24k;
move16();
@@ -117,16 +112,14 @@ void hq_configure_fx(
*nb_sfm = HVQ_THRES_SFM_32k;
move16();
*num_env_bands = sub(*num_sfm, *nb_sfm);
-
- *sfmsize = band_len_harm;
- move16();
- *sfm_start = band_start_harm;
move16();
*start_norm = HVQ_THRES_SFM_32k;
move16();
- *sfm_end = band_end_harm;
- move16();
}
+ p_sfmsize = band_len_harm;
+ p_sfm_start = band_start_harm;
+ p_sfm_end = band_end_harm;
+ move16();move16();move16();
}
ELSE
{
@@ -137,16 +130,16 @@ void hq_configure_fx(
*num_env_bands = NB_SFM;
move16();
- *sfmsize = band_len_HQ;
+ p_sfmsize = band_len_HQ;
move16();
- *sfm_start = band_start_HQ;
+ p_sfm_start = band_start_HQ;
move16();
- *sfm_end = band_end_HQ;
+ p_sfm_end = band_end_HQ;
move16();
}
}
}
- ELSE IF( EQ_16(length, L_FRAME32k))
+ ELSE IF( EQ_16(length, L_SPEC32k))
{
IF ( EQ_16(hqswb_clas, HQ_HARMONIC))
{
@@ -157,16 +150,16 @@ void hq_configure_fx(
*num_env_bands = SFM_N_HARM;
move16();
- *sfmsize = band_len_harm;
+ p_sfmsize = band_len_harm;
move16();
- *sfm_start = band_start_harm;
+ p_sfm_start = band_start_harm;
move16();
- *sfm_end = band_end_harm;
+ p_sfm_end = band_end_harm;
move16();
}
ELSE IF ( EQ_16(hqswb_clas, HQ_HVQ))
{
- IF ( EQ_32(core_brate, HQ_24k40))
+ IF ( LT_32(core_brate, HQ_BWE_CROSSOVER_BRATE))
{
*num_sfm = SFM_N_HARM;
move16();
@@ -174,12 +167,6 @@ void hq_configure_fx(
move16();
*num_env_bands = sub(*num_sfm, *nb_sfm);
- *sfmsize = band_len_harm;
- move16();
- *sfm_start = band_start_harm;
- move16();
- *sfm_end = band_end_harm;
- move16();
*start_norm = HVQ_THRES_SFM_24k;
move16();
}
@@ -191,46 +178,39 @@ void hq_configure_fx(
move16();
*num_env_bands = sub(*num_sfm, *nb_sfm);
- *sfmsize = band_len_harm;
- move16();
- *sfm_start = band_start_harm;
- move16();
*start_norm = HVQ_THRES_SFM_32k;
move16();
- *sfm_end = band_end_harm;
- move16();
}
+ p_sfmsize = band_len_harm;
+ move16();
+ p_sfm_start = band_start_harm;
+ move16();
+ p_sfm_end = band_end_harm;
+ move16();
+
}
ELSE IF ( EQ_16(hqswb_clas, HQ_GEN_SWB))
{
*num_sfm = SFM_N_SWB;
move16();
- *sfmsize = band_len_HQ;
+ p_sfmsize = band_len_HQ;
move16();
- *sfm_start = band_start_HQ;
+ p_sfm_start = band_start_HQ;
move16();
- *sfm_end = band_end_HQ;
+ p_sfm_end = band_end_HQ;
move16();
- IF ( EQ_32(core_brate, HQ_32k))
+ IF ( GE_32(core_brate, HQ_32k))
{
*hq_generic_offset = HQ_GENERIC_FOFFSET_32K;
move16();
- }
- ELSE if ( EQ_32(core_brate, HQ_24k40))
- {
- *hq_generic_offset = HQ_GENERIC_FOFFSET_24K4;
- move16();
- }
-
- /* setting start frequency of HQ Generic */
- IF ( EQ_32(core_brate, HQ_32k))
- {
*num_env_bands = SFM_N_STA_10k;
move16();
}
- ELSE if( EQ_32(core_brate, HQ_24k40))
+ ELSE /*if( EQ_32(core_brate, HQ_24k40))*/
{
+ *hq_generic_offset = HQ_GENERIC_FOFFSET_24K4;
+ move16();
*num_env_bands = SFM_N_STA_8k;
move16();
}
@@ -248,14 +228,32 @@ void hq_configure_fx(
*num_env_bands = SFM_N_SWB;
move16();
- *sfmsize = band_len_HQ;
+ p_sfmsize = band_len_HQ;
move16();
- *sfm_start = band_start_HQ;
+ p_sfm_start = band_start_HQ;
move16();
- *sfm_end = band_end_HQ;
+ p_sfm_end = band_end_HQ;
move16();
}
}
+ ELSE IF (EQ_16(length, L_SPEC48k_EXT ) )
+ {
+ bw_ext = 1;
+ p_sfmsize = band_len_HQ;
+ p_sfm_start = band_start_HQ;
+ p_sfm_end = band_end_HQ;
+ *num_sfm = NB_SFM;
+ move16(); move16(); move16(); move16();
+ }
+ ELSE IF (EQ_16(length, L_SPEC16k_EXT))
+ {
+ bw_ext = 1;
+ p_sfmsize = band_len_wb;
+ p_sfm_start = band_start_wb;
+ p_sfm_end = band_end_wb;
+ *num_sfm = SFM_N_WB;
+ move16();move16();move16();move16();
+ }
ELSE
{
*num_sfm = SFM_N_WB;
@@ -265,13 +263,34 @@ void hq_configure_fx(
*num_env_bands = SFM_N_WB;
move16();
- *sfmsize = band_len_wb;
+ p_sfmsize = band_len_wb;
move16();
- *sfm_start = band_start_wb;
+ p_sfm_start = band_start_wb;
move16();
- *sfm_end = band_end_wb;
+ p_sfm_end = band_end_wb;
move16();
}
+ IF (bw_ext)
+ {
+ FOR (i = 0; i < *num_sfm; i++)
+ {
+ /*sfmsize[i] = (int16_t)(1.25f * p_sfmsize[i]);*/
+ sfmsize[i] = mult_r(shl(p_sfmsize[i],1),20480);
+ /*sfm_start[i] = (int16_t)(1.25f * p_sfm_start[i]);*/
+ sfm_start[i] = mult_r(shl(p_sfm_start[i], 1), 20480);
+ /*sfm_end[i] = (int16_t)(1.25f * p_sfm_end[i]);*/
+ sfm_end[i] = mult_r(shl(p_sfm_end[i], 1), 20480);
+ }
+ *nb_sfm = *num_sfm;
+ *num_env_bands = *num_sfm;
+ move16();move16();
+ }
+ else
+ {
+ Copy(p_sfmsize, sfmsize, *num_sfm);
+ Copy(p_sfm_start, sfm_start, *num_sfm);
+ Copy(p_sfm_end, sfm_end, *num_sfm);
+ }
*numnrmibits = extract_l(L_mult0(sub(*num_env_bands, 1), NORMI_BITS));
diff --git a/lib_com/hq_tools_fx.c b/lib_com/hq_tools_fx.c
index f20cca9c493f4179132538f429da019311d751ba..f4523cac8137ffa6b45b67265cb8e628a413b189 100644
--- a/lib_com/hq_tools_fx.c
+++ b/lib_com/hq_tools_fx.c
@@ -1,7 +1,7 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include
#include "options.h" /* Compilation switches */
#include "rom_com_fx.h" /* Static table prototypes FIP version */
@@ -9,7 +9,7 @@
#include "prot_fx.h"
/*--------------------------------------------------------------------------*
- * Local functions
+ * Local function prototypes
*--------------------------------------------------------------------------*/
static void overlap_hq_bwe_fx( const Word32 *hq_swb_overlap_buf, Word32 *coeff_out, const Word16 n_swb_overlap_offset,
@@ -22,10 +22,10 @@ static void overlap_hq_bwe_fx( const Word32 *hq_swb_overlap_buf, Word32 *coeff_o
*--------------------------------------------------------------------------*/
void hq_swb_harmonic_calc_norm_envelop_fx(
- Word32 *L_SWB_signal, /* i : input signal Q=12*/
- Word32 *L_envelope, /* o : output envelope Q=12*/
- Word16 L_swb_norm, /* i : length of normaliztion */
- Word16 SWB_flength /* i : length of input signal */
+ const Word32 *L_SWB_signal, /* i : input signal Q=12*/
+ Word32 *L_envelope, /* o : output envelope Q=12*/
+ const Word16 L_swb_norm, /* i : length of normaliztion */
+ const Word16 SWB_flength /* i : length of input signal */
)
{
@@ -103,10 +103,10 @@ void hq_swb_harmonic_calc_norm_envelop_fx(
*--------------------------------------------------------------------------*/
void limit_band_noise_level_calc_fx(
- const Word16 *wnorm, /* i : reordered norm of sub-vectors */
- Word16 *limit, /* o : highest band of bit allocation */
- const Word32 core_brate, /* i : bit rate */
- Word16 *noise_level /* o : noise level Q15 */
+ const Word16 *wnorm, /* i : reordered norm of sub-vectors */
+ Word16 *limit, /* o : highest band of bit allocation */
+ const Word32 core_brate, /* i : bit rate */
+ Word16 *noise_level /* o : noise level Q15 */
)
{
Word16 ener_limit, ener_sum;
@@ -143,7 +143,7 @@ void limit_band_noise_level_calc_fx(
fact = 2022929597;
move32();
- if (EQ_32(core_brate, HQ_24k40))
+ if (LT_32(core_brate, HQ_BWE_CROSSOVER_BRATE))
{
fact = L_add(1900523029, 1);
}
@@ -195,16 +195,16 @@ void limit_band_noise_level_calc_fx(
* NOTE: Q values preliminary
*--------------------------------------------------------------------------*/
-Word16 build_nf_codebook_fx( /* o : Number of coefficients in nf codebook Q=0*/
- const Word16 flag_32K_env_ho, /* i : Envelope attenuation hangover flag Q=0*/
- const Word16 *coeff, /* i : Coded spectral coefficients Q=12*/
- const Word16 *sfm_start, /* i : Subband start indices Q=0*/
- const Word16 *sfmsize, /* i : Subband widths Q=0*/
- const Word16 *sfm_end, /* i : Subband end indices Q=0*/
- const Word16 last_sfm, /* i : Last coded band Q=0*/
- const Word16 *R, /* i : Per-band bit allocation Q=0*/
- Word16 *CodeBook, /* o : Noise-fill codebook Q=12*/
- Word16 *CodeBook_mod /* o : Densified noise-fill codebook Q=12*/
+Word16 build_nf_codebook_fx( /* o : Number of coefficients in nf codebook Q=0*/
+ const Word16 flag_32K_env_ho, /* i : Envelope attenuation hangover flag Q=0*/
+ const Word16 *coeff, /* i : Coded spectral coefficients Q=12*/
+ const Word16 *sfm_start, /* i : Subband start indices Q=0*/
+ const Word16 *sfmsize, /* i : Subband widths Q=0*/
+ const Word16 *sfm_end, /* i : Subband end indices Q=0*/
+ const Word16 last_sfm, /* i : Last coded band Q=0*/
+ const Word16 *R, /* i : Per-band bit allocation Q=0*/
+ Word16 *CodeBook, /* o : Noise-fill codebook Q=12*/
+ Word16 *CodeBook_mod /* o : Densified noise-fill codebook Q=12*/
)
{
Word16 sfm_base;
@@ -350,7 +350,7 @@ void apply_noisefill_HQ_fx(
const Word16 *sfm_start, /* i : Subband start coefficient Q0 */
const Word16 *sfm_end, /* i : Subband end coefficient Q0 */
const Word16 *sfmsize, /* i : Subband band width Q0 */
- Word16 *coeff /* i/o: coded/noisefilled spectrum Q12 */
+ Word16 *coeff /* i/o: coded/noisefilled spectrum Q12 */
)
{
Word16 sfm;
@@ -365,7 +365,7 @@ void apply_noisefill_HQ_fx(
test();
test();
- IF ( (GE_16(length, L_FRAME32k))||(GT_32(L_core_brate,HQ_32k))||(LT_32(L_core_brate,HQ_24k40)))
+ IF ( (GE_16(length, L_FRAME32k)) || (NE_32(L_core_brate,HQ_32k)))
{
/* Read from codebook */
cb_pos = 0;
@@ -459,10 +459,10 @@ void harm_bwe_fine_fx(
const Word16 *norm, /* i : quantization indices for norms */
const Word16 *sfm_start, /* i : Subband start coefficient */
const Word16 *sfm_end, /* i : Subband end coefficient */
- Word16 *prev_L_swb_norm, /* i/o: last normalize length */
- Word16 *coeff, /* i/o: coded/noisefilled normalized spectrum */
- Word32 *coeff_out /* o : coded/noisefilled spectrum */
- , Word16 *coeff_fine /* o : BWE fine structure */
+ Word16 *prev_L_swb_norm, /* i/o: last normalize length */
+ Word16 *coeff, /* i/o: coded/noisefilled normalized spectrum */
+ Word32 *coeff_out, /* o : coded/noisefilled spectrum */
+ Word16 *coeff_fine /* o : BWE fine structure */
)
{
Word16 sfm;
@@ -573,16 +573,16 @@ void harm_bwe_fine_fx(
*--------------------------------------------------------------------------*/
void hvq_bwe_fine_fx(
- const Word16 last_sfm, /* i : last coded subband Q0 */
- const Word16 num_sfm, /* i : total number of bands Q0 */
- const Word16 *sfm_end, /* i : Subband end coefficient Q0 */
- const Word16 *peak_idx, /* i : Peak index Q0 */
- const Word16 Npeaks, /* i : Number of peaks Q0 */
- Word16 *peak_pos, /* o : Peak positions Q0 */
- Word16 *prev_L_swb_norm, /* i/o: last normalize length Q0 */
- Word32 *L_coeff, /* i : coded/noisefilled normalized spectrum Q12 */
- Word16 *bwe_peaks, /* o : Positions of peaks in BWE Q0 */
- Word16 *coeff_fine /* o : HVQ BWE fine structure Q15 */
+ const Word16 last_sfm, /* i : last coded subband Q0 */
+ const Word16 num_sfm, /* i : total number of bands Q0 */
+ const Word16 *sfm_end, /* i : Subband end coefficient Q0 */
+ const Word16 *peak_idx, /* i : Peak index Q0 */
+ const Word16 Npeaks, /* i : Number of peaks Q0 */
+ Word16 *peak_pos, /* o : Peak positions Q0 */
+ Word16 *prev_L_swb_norm, /* i/o: last normalize length Q0 */
+ Word32 *L_coeff, /* i : coded/noisefilled normalized spectrum Q12 */
+ Word16 *bwe_peaks, /* o : Positions of peaks in BWE Q0 */
+ Word16 *coeff_fine /* o : HVQ BWE fine structure Q15 */
)
{
Word16 i, j;
@@ -740,12 +740,12 @@ void hq_fold_bwe_fx(
*--------------------------------------------------------------------------*/
void apply_nf_gain_fx(
- const Word16 nf_idx, /* i : noise fill gain index Q0 */
- const Word16 last_sfm, /* i : last coded subband Q0 */
- const Word16 *R, /* i : bit allocation Q0 */
- const Word16 *sfm_start, /* i : Subband start coefficient Q0 */
- const Word16 *sfm_end, /* i : Subband end coefficient Q0 */
- Word16 *coeff /* i/o: coded/noisefilled normalized spectrum Q12 */
+ const Word16 nf_idx, /* i : noise fill gain index Q0 */
+ const Word16 last_sfm, /* i : last coded subband Q0 */
+ const Word16 *R, /* i : bit allocation Q0 */
+ const Word16 *sfm_start, /* i : Subband start coefficient Q0 */
+ const Word16 *sfm_end, /* i : Subband end coefficient Q0 */
+ Word16 *coeff /* i/o: coded/noisefilled normalized spectrum Q12 */
)
{
Word16 sfm;
@@ -775,19 +775,20 @@ void apply_nf_gain_fx(
*--------------------------------------------------------------------------*/
void harm_bwe_fx(
- const Word16 *coeff_fine, /* i : fine structure for BWE */
- const Word16 *coeff, /* i : coded/noisefilled normalized spectrum */
- const Word16 num_sfm, /* i : Number of subbands */
- const Word16 *sfm_start, /* i : Subband start coefficient */
- const Word16 *sfm_end, /* i : Subband end coefficient */
- const Word16 last_sfm, /* i : last coded subband */
- const Word16 *R, /* i : bit allocation */
- const Word16 prev_hq_mode, /* i : previous hq mode */
- Word16 *norm, /* i/o: quantization indices for norms */
- Word16 *noise_level, /* i/o: noise levels for harmonic modes */
- Word16 *prev_noise_level, /* i/o: noise factor in previous frame */
- Word16 *bwe_seed, /* i/o: random seed for generating BWE input */
- Word32 *coeff_out /* o : coded/noisefilled spectrum */
+ const Word16 *coeff_fine, /* i : fine structure for BWE */
+ const Word16 *coeff, /* i : coded/noisefilled normalized spectrum */
+ const Word16 num_sfm, /* i : Number of subbands */
+ const Word16 *sfm_start, /* i : Subband start coefficient */
+ const Word16 *sfm_end, /* i : Subband end coefficient */
+ const Word16 last_sfm, /* i : last coded subband */
+ const Word16 *R, /* i : bit allocation */
+ const Word16 prev_hq_mode, /* i : previous hq mode */
+ Word16 *norm, /* i/o: quantization indices for norms */
+ Word16 *noise_level, /* i/o: noise levels for harmonic modes */
+ Word16 *prev_noise_level, /* i/o: noise factor in previous frame */
+ Word16 *bwe_seed, /* i/o: random seed for generating BWE input */
+ Word32 *coeff_out, /* o : coded/noisefilled spectrum */
+ const Word16 element_mode /* i : IVAS element mode */
)
{
Word16 i, j;
@@ -884,7 +885,16 @@ void harm_bwe_fx(
exp1 = norm_s(alfa);
tmp1 = shl(alfa, exp1);
- exp1 = add(1, exp1);
+ if (EQ_16( element_mode, EVS_MONO))
+ {
+ exp1 = add(1, exp1);
+ }
+#ifdef DEBUGGING
+ else
+ {
+ PMT("VERIFY if this really matches IVAS float")
+ }
+#endif
tmp1 = s_max(tmp1, 16384);
tmp1 = div_s(16384, tmp1);
L_tmp2 = L_deposit_h(tmp1);
@@ -943,13 +953,13 @@ void hvq_bwe_fx(
const Word16 *bwe_peaks, /* i : HVQ bwe peaks Q0 */
const Word16 bin_th, /* i : HVQ transition bin Q0 */
const Word16 num_sfm, /* i : Number of bands Q0 */
- const Word32 core_brate, /* i : Core bit-rate Q0 */
+ const Word32 core_brate, /* i : Core bitrate Q0 */
const Word16 *R, /* i : Bit allocation */
- Word16 *norm, /* i/o: quantization indices for norms Q0 */
- Word16 *noise_level, /* i/o: noise levels for harmonic modes Q15 */
- Word16 *prev_noise_level, /* i/o: noise factor in previous frame Q15 */
- Word16 *bwe_seed, /* i/o: random seed for generating BWE input Q0 */
- Word32 *L_coeff_out, /* o : coded/noisefilled spectrum Qout*/
+ Word16 *norm, /* i/o: quantization indices for norms Q0 */
+ Word16 *noise_level, /* i/o: noise levels for harmonic modes Q15 */
+ Word16 *prev_noise_level, /* i/o: noise factor in previous frame Q15 */
+ Word16 *bwe_seed, /* i/o: random seed for generating BWE input Q0 */
+ Word32 *L_coeff_out, /* o : coded/noisefilled spectrum Qout*/
const Word16 qin,
const Word16 qout
)
@@ -1004,7 +1014,7 @@ void hvq_bwe_fx(
}
norm_ind = add(last_sfm, 1);
- IF ( EQ_32(core_brate, HQ_24k40))
+ IF ( LT_32(core_brate, HQ_BWE_CROSSOVER_BRATE))
{
peak_band = 0;
move16();
@@ -1276,12 +1286,12 @@ void hvq_bwe_fx(
*--------------------------------------------------------------------------*/
void hvq_concat_bands_fx
(
- const Word16 pvq_bands, /* i : Number of bands in concatenated PVQ target */
- const Word16 *sel_bnds, /* i : Array of selected high bands */
- const Word16 n_sel_bnds, /* i : Number of selected high bands */
- Word16 *hvq_band_start, /* i : Band start indices */
- Word16 *hvq_band_width, /* i : Band widths */
- Word16 *hvq_band_end /* i : Band end indices */
+ const Word16 pvq_bands, /* i : Number of bands in concatenated PVQ target */
+ const Word16 *sel_bnds, /* i : Array of selected high bands */
+ const Word16 n_sel_bnds, /* i : Number of selected high bands */
+ Word16 *hvq_band_start, /* i : Band start indices */
+ Word16 *hvq_band_width, /* i : Band widths */
+ Word16 *hvq_band_end /* i : Band end indices */
)
{
Word16 k, k_1;
@@ -1319,14 +1329,14 @@ void hvq_concat_bands_fx
*--------------------------------------------------------------------------*/
void noise_mix_fx(
- const Word16 *coeff_fine, /* i : normalized fine structure spectrum Qin */
- const Word32 L_E, /* i : normalization factor Q17 */
- const Word32 L_normq, /* i : quantized norm Q14 */
- Word16 *seed, /* i/o: random seed Q0 */
- const Word16 istart, /* i : start coefficient Q0 */
- const Word16 iend, /* i : end coefficient Q0 */
- const Word16 noise_level, /* i : noise_level Q0 */
- Word32 *L_coeff_out, /* o : noise mixed spectrum Qout */
+ const Word16 *coeff_fine, /* i : normalized fine structure spectrum Qin */
+ const Word32 L_E, /* i : normalization factor Q17 */
+ const Word32 L_normq, /* i : quantized norm Q14 */
+ Word16 *seed, /* i/o: random seed Q0 */
+ const Word16 istart, /* i : start coefficient Q0 */
+ const Word16 iend, /* i : end coefficient Q0 */
+ const Word16 noise_level, /* i : noise_level Q0 */
+ Word32 *L_coeff_out, /* o : noise mixed spectrum Qout */
const Word16 qin,
const Word16 qout
)
@@ -1647,26 +1657,26 @@ Word16 get_nor_delta_hf_fx(
}
return add_bits_denv;
}
-
+/*-------------------------------------------------------------------*
+* calc_nor_delta_hf()
+*
+*
+*--------------------------------------------------------------------------*/
Word16 calc_nor_delta_hf_fx(
- Encoder_State_fx *st,
- const Word32 *t_audio,
- Word16 *ynrm,
- Word16 *Rsubband,
- const Word16 num_env_bands,
- const Word16 nb_sfm,
- const Word16 *sfmsize,
- const Word16 *sfm_start,
- const Word16 core_sfm
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word32* t_audio, /* i : transform-domain coefficients */
+ Word16* ynrm, /* i/o: norm indices */
+ Word16* Rsubband, /* i/o: sub-band bit allocation */
+ const Word16 num_env_bands, /* i : Number coded envelope bands */
+ const Word16 nb_sfm, /* i : Number of envelope bands */
+ const Word16* sfmsize, /* i : band length */
+ const Word16* sfm_start, /* i : Start index of bands */
+ const Word16 core_sfm /* i : index of the end band for core */
)
{
Word16 i;
Word16 ynrm_t[44],normqlg2_t[44];
Word16 delta,max_delta,min_delta,bitsforDelta,add_bits_denv;
- Word16 temp_num;
-
- temp_num=0;
- move16();
max_delta=-100;
move16();
@@ -1715,7 +1725,7 @@ Word16 calc_nor_delta_hf_fx(
/* updating norm & storing delta norm */
add_bits_denv = 2;
move16();
- push_indice_fx( st, IND_DELTA_ENV_HQ, sub(bitsforDelta,2) , 2 );
+ push_indice_fx(hBstr, IND_DELTA_ENV_HQ, sub(bitsforDelta,2) , 2 );
FOR(i=num_env_bands; i
#include "options.h" /* Compilation switches */
-#include "stl.h" /* required by wmc_tool */
-
#include "rom_com_fx.h"
#include "prot_fx.h" /* Function prototypes */
@@ -19,16 +17,16 @@
/*--------------------------------------------------------------------------*/
Word16 hvq_pvq_bitalloc_fx(
- Word16 num_bits, /* i/o: Number of available bits (including gain bits) */
- const Word32 brate, /* i : bitrate */
- const Word16 bwidth_fx, /* i : Encoded bandwidth */
- const Word16 *ynrm, /* i : Envelope coefficients */
- const Word32 manE_peak, /* i : Peak energy mantissa */
- const Word16 expE_peak, /* i : Peak energy exponent */
- Word16 *Rk, /* o : bit allocation for concatenated vector */
- Word16 *R, /* i/o: Global bit allocation */
- Word16 *sel_bands, /* o : Selected bands for encoding */
- Word16 *n_sel_bands /* o : No. of selected bands for encoding */
+ Word16 num_bits, /* i/o: Number of available bits (including gain bits) */
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16 bwidth_fx, /* i : Encoded bandwidth */
+ const Word16 *ynrm, /* i : Envelope coefficients */
+ const Word32 manE_peak, /* i : Peak energy mantissa */
+ const Word16 expE_peak, /* i : Peak energy exponent */
+ Word16 *Rk, /* o : bit allocation for concatenated vector */
+ Word16 *R, /* i/o: Global bit allocation */
+ Word16 *sel_bands, /* o : Selected bands for encoding */
+ Word16 *n_sel_bands /* o : No. of selected bands for encoding */
)
{
Word16 num_bands, band_max_bits;
@@ -52,7 +50,7 @@ Word16 hvq_pvq_bitalloc_fx(
num_sfm = SFM_N_HARM;
}
- IF ( EQ_32(brate, HQ_24k40))
+ IF ( LT_32(core_brate, HQ_BWE_CROSSOVER_BRATE))
{
band_max_bits = HVQ_BAND_MAX_BITS_24k;
move16();
diff --git a/lib_com/igf_base.c b/lib_com/igf_base.c
index 3c799c5fca00f6fe8d37c88f3977a65b551f354e..ab8ef26ae595869773c4d3eaf32380bbec696a16 100644
--- a/lib_com/igf_base.c
+++ b/lib_com/igf_base.c
@@ -38,92 +38,341 @@ static Word16 IGF_ApplyTransFac(
/**********************************************************************/ /*
maps a given bitrate to the IGF_BITRATE index
**************************************************************************/
-static Word16 IGF_MapBitRateToIndex( /**< out: Q0 | return bit rate index */
- Word32 bitRate, /**< in: | bitrate */
- Word16 mode /**< in: | bandwidth mode */
- , Word16 rf_mode /**< in: | flag to signal the RF mode */
+Word16 IGF_MapBitRateToIndex(
+ const Word32 brate, /* i : bitrate */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 element_mode, /* i : element mode */
+ const Word16 rf_mode /* i : flag to signal the RF mode */
)
{
- Word16 bitRateIndex;
-
-
- bitRateIndex = IGF_BITRATE_UNKNOWN;
+ Word16 bitRateIndex = IGF_BITRATE_UNKNOWN;
move16();
-
- switch (mode)
+ /* Stereo/CPE modes */
+ IF(GT_16(element_mode, IVAS_SCE))
{
- case IGF_MODE_WB:
- switch (bitRate)
+ switch (bwidth)
{
- case 13200:
- if (EQ_16(rf_mode,1))
+ case IGF_MODE_WB:
+ IF(LE_32(brate, IVAS_13k2) && EQ_16(rf_mode, 1))
{
bitRateIndex = IGF_BITRATE_RF_WB_13200;
+ move16();
}
- break;
- case 9600:
- bitRateIndex = IGF_BITRATE_WB_9600;
- break;
- default:
- assert(0);
+ ELSE IF(LE_32(brate, ACELP_9k60))
+ {
+ bitRateIndex = IGF_BITRATE_WB_13200_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_13k2))
+ {
+ bitRateIndex = IGF_BITRATE_WB_16400_CPE;
+ move16();
+ }
+ BREAK;
+ case IGF_MODE_SWB:
+ /* DFT and TD Stereo bitrates */
+ IF(LE_32(brate, ACELP_9k60))
+ {
+ bitRateIndex = IGF_BITRATE_SWB_13200_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_13k2))
+ {
+ IF(EQ_16(rf_mode, 1))
+ {
+ bitRateIndex = IGF_BITRATE_RF_SWB_13200;
+ move16();
+ }
+ ELSE
+ {
+ bitRateIndex = IGF_BITRATE_SWB_16400_CPE;
+ move16();
+ }
+ }
+ ELSE IF(LE_32(brate, IVAS_16k4))
+ {
+ bitRateIndex = IGF_BITRATE_SWB_24400_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_24k4) )
+ {
+ bitRateIndex = IGF_BITRATE_SWB_32000_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_32k) )
+ {
+ bitRateIndex = IGF_BITRATE_SWB_32000;
+ move16();
+ }
+ /* MDCT Stereo bitrates */
+ ELSE IF(LE_32(brate, IVAS_48k) )
+ {
+ bitRateIndex = IGF_BITRATE_SWB_48000_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_64k) )
+ {
+ bitRateIndex = IGF_BITRATE_SWB_64000_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_80k) )
+ {
+ bitRateIndex = IGF_BITRATE_SWB_80000_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_96k))
+ {
+ bitRateIndex = IGF_BITRATE_SWB_96000_CPE;
+ move16();
+ }
+ BREAK;
+ case IGF_MODE_FB:
+ /* DFT and TD Stereo bitrates */
+ IF(LE_32(brate, IVAS_16k4) )
+ {
+ bitRateIndex = IGF_BITRATE_FB_24400_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_24k4) )
+ {
+ bitRateIndex = IGF_BITRATE_FB_32000_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_32k))
+ {
+ bitRateIndex = IGF_BITRATE_FB_32000;
+ move16();
+ }
+ /* MDCT Stereo bitrates */
+ ELSE IF(LE_32(brate, IVAS_48k))
+ {
+ bitRateIndex = IGF_BITRATE_FB_48000_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_64k) )
+ {
+ bitRateIndex = IGF_BITRATE_FB_64000_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_80k) )
+ {
+ bitRateIndex = IGF_BITRATE_FB_80000_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_96k) )
+ {
+ bitRateIndex = IGF_BITRATE_FB_96000_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_128k))
+ {
+ bitRateIndex = IGF_BITRATE_FB_128000_CPE;
+ move16();
+ }
+ BREAK;
}
- break;
- case IGF_MODE_SWB:
- switch (bitRate)
+ }
+ /* SCE modes: use tunings done for DFT stereo bitrates also for according SCE bitrates, otherwise same config as mono modes */
+ ELSE IF(EQ_16(element_mode, IVAS_SCE))
+ {
+ switch (bwidth)
{
- case 9600:
- bitRateIndex = IGF_BITRATE_SWB_9600;
- break;
- case 13200:
- bitRateIndex = IGF_BITRATE_SWB_13200;
- if (EQ_16(rf_mode,1))
+ case IGF_MODE_WB:
+ IF(LE_32(brate, IVAS_13k2) && EQ_16(rf_mode, 1) )
{
- bitRateIndex = IGF_BITRATE_RF_SWB_13200;
+ bitRateIndex = IGF_BITRATE_RF_WB_13200;
+ move16();
}
- break;
- case 16400:
- bitRateIndex = IGF_BITRATE_SWB_16400;
- break;
- case 24400:
- bitRateIndex = IGF_BITRATE_SWB_24400;
- break;
- case 32000:
- bitRateIndex = IGF_BITRATE_SWB_32000;
- break;
- case 48000:
- bitRateIndex = IGF_BITRATE_SWB_48000;
- break;
- default:
- assert(0);
+ ELSE IF(LE_32(brate, ACELP_9k60)) /* bitrates 8000 and 9600 */
+ {
+ bitRateIndex = IGF_BITRATE_WB_9600;
+ move16();
+ }
+ BREAK;
+ case IGF_MODE_SWB:
+ IF(LE_32(brate, ACELP_9k60) )
+ {
+ bitRateIndex = IGF_BITRATE_SWB_13200_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_13k2) )
+ {
+ IF(EQ_16(rf_mode, 1))
+ {
+ bitRateIndex = IGF_BITRATE_RF_SWB_13200;
+ move16();
+ }
+ ELSE
+ {
+ bitRateIndex = IGF_BITRATE_SWB_16400_CPE;
+ move16();
+ }
+ }
+ ELSE IF(LE_32(brate, IVAS_16k4) )
+ {
+ bitRateIndex = IGF_BITRATE_SWB_24400_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_24k4))
+ {
+ move16();
+ bitRateIndex = IGF_BITRATE_SWB_32000_CPE;
+ }
+ ELSE IF(LE_32(brate, IVAS_32k) )
+ {
+ bitRateIndex = IGF_BITRATE_SWB_32000;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_48k))
+ {
+ bitRateIndex = IGF_BITRATE_SWB_48000;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_64k))
+ {
+ bitRateIndex = IGF_BITRATE_SWB_64000;
+ move16();
+ }
+ BREAK;
+ case IGF_MODE_FB:
+ IF(LE_32(brate, IVAS_16k4) )
+ {
+ bitRateIndex = IGF_BITRATE_FB_24400_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_24k4))
+ {
+ bitRateIndex = IGF_BITRATE_FB_32000_CPE;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_32k) )
+ {
+ bitRateIndex = IGF_BITRATE_FB_32000;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_48k))
+ {
+ bitRateIndex = IGF_BITRATE_FB_48000;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_64k))
+ {
+ bitRateIndex = IGF_BITRATE_FB_64000;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_96k))
+ {
+ bitRateIndex = IGF_BITRATE_FB_96000;
+ move16();
+ }
+ ELSE IF(LE_32(brate, IVAS_128k))
+ {
+ bitRateIndex = IGF_BITRATE_FB_128000;
+ move16();
+ }
+ BREAK;
}
- break;
- case IGF_MODE_FB:
- switch (bitRate)
+ }
+ /* EVS mono */
+ else
+ {
+ switch (bwidth)
{
- case 16400:
- bitRateIndex = IGF_BITRATE_FB_16400;
- break;
- case 24400:
- bitRateIndex = IGF_BITRATE_FB_24400;
- break;
- case 32000:
- bitRateIndex = IGF_BITRATE_FB_32000;
- break;
- case 48000:
- bitRateIndex = IGF_BITRATE_FB_48000;
- break;
- case 96000:
- bitRateIndex = IGF_BITRATE_FB_96000;
- break;
- case 128000:
- bitRateIndex = IGF_BITRATE_FB_128000;
- break;
- default:
- assert(0);
+ case IGF_MODE_WB:
+ IF(LE_32(brate, ACELP_13k20) && EQ_16(rf_mode, 1))
+ {
+ bitRateIndex = IGF_BITRATE_RF_WB_13200;
+ move16();
+ }
+ ELSE IF(LE_32(brate, ACELP_9k60)) /* bitrates 8000 and 9600 */
+ {
+ bitRateIndex = IGF_BITRATE_WB_9600;
+ move16();
+ }
+ BREAK;
+ case IGF_MODE_SWB:
+ IF(LE_32(brate, ACELP_9k60))
+ {
+ move16();
+ bitRateIndex = IGF_BITRATE_SWB_9600;
+ }
+ ELSE IF(LE_32(brate, ACELP_13k20) )
+ {
+ IF(EQ_16(rf_mode, 1))
+ {
+ bitRateIndex = IGF_BITRATE_RF_SWB_13200;
+ move16();
+ }
+ ELSE
+ {
+ bitRateIndex = IGF_BITRATE_SWB_13200;
+ move16();
+ }
+ }
+ ELSE IF(LE_32(brate, ACELP_16k40) )
+ {
+ bitRateIndex = IGF_BITRATE_SWB_16400;
+ move16();
+ }
+ ELSE IF(LE_32(brate, ACELP_24k40))
+ {
+ bitRateIndex = IGF_BITRATE_SWB_24400;
+ move16();
+ }
+ ELSE IF(LE_32(brate, ACELP_32k))
+ {
+ bitRateIndex = IGF_BITRATE_SWB_32000;
+ move16();
+ }
+ ELSE IF(LE_32(brate, ACELP_48k))
+ {
+ bitRateIndex = IGF_BITRATE_SWB_48000;
+ move16();
+ }
+ ELSE IF(LE_32(brate, ACELP_64k) )
+ {
+ bitRateIndex = IGF_BITRATE_SWB_64000;
+ move16();
+ }
+ BREAK;
+ case IGF_MODE_FB:
+ IF(LE_32(brate, ACELP_16k40) )
+ {
+ bitRateIndex = IGF_BITRATE_FB_16400;
+ move16();
+ }
+ ELSE IF(LE_32(brate, ACELP_24k40))
+ {
+ bitRateIndex = IGF_BITRATE_FB_24400;
+ move16();
+ }
+ ELSE IF(LE_32(brate, ACELP_32k) )
+ {
+ bitRateIndex = IGF_BITRATE_FB_32000;
+ move16();
+ }
+ ELSE IF(LE_32(brate, ACELP_48k) )
+ {
+ bitRateIndex = IGF_BITRATE_FB_48000;
+ move16();
+ }
+ ELSE IF(LE_32(brate, ACELP_64k))
+ {
+ bitRateIndex = IGF_BITRATE_FB_64000;
+ move16();
+ }
+ ELSE IF(LE_32(brate, HQ_96k) )
+ {
+ bitRateIndex = IGF_BITRATE_FB_96000;
+ move16();
+ }
+ ELSE IF(LE_32(brate, HQ_128k))
+ {
+ bitRateIndex = IGF_BITRATE_FB_128000;
+ move16();
+ }
+ BREAK;
}
- break;
- default:
- assert(0);
}
return bitRateIndex;
@@ -685,15 +934,16 @@ void IGFCommonFuncsMDCTSquareSpec(const Word16 sqrtBgn,
/**********************************************************************/ /*
write bits to stream
**************************************************************************/
-void IGFCommonFuncsWriteSerialBit(void *st, /**< in: | encoder/decoder state structure */
- Word16 *pBitOffset, /**< out: Q0 | bit offset */
- Word16 bit /**< in: Q0 | value of bit */
- )
+void IGFCommonFuncsWriteSerialBit(
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 *pBitOffset, /**< out: Q0 | bit offset */
+ Word16 bit /**< in: Q0 | value of bit */
+)
{
- IF (st)
+ IF (hBstr)
{
- push_next_indice_fx(st, bit, 1);
+ push_next_indice_fx(hBstr, bit, 1);
}
*pBitOffset = add(*pBitOffset, 1);
move16();
@@ -704,11 +954,12 @@ void IGFCommonFuncsWriteSerialBit(void *st,
/**********************************************************************/ /*
changes the IGF configuration
**************************************************************************/
-Word16 IGFCommonFuncsIGFConfiguration( /**< out: | error value: 0 -> error, 1 -> ok */
- Word32 bitRate, /**< in: Q0 | bitrate in bs e.g. 9600 for 9.6kbs */
- Word16 mode, /**< in: Q0 | bandwidth mode */
- H_IGF_INFO hIGFInfo /**< out: | IGF info handle */
- ,Word16 rf_mode /**< in: flag to signal the RF mode */
+Word16 IGFCommonFuncsIGFConfiguration(
+ const Word32 total_brate, /* i : bitrate in bs e.g. 9600 for 9.6kbs */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 element_mode, /* i : element mode */
+ H_IGF_INFO hIGFInfo, /* o : IGF info handle */
+ const Word16 rf_mode /* i : flag to signal the RF mode */
)
{
H_IGF_GRID hGrid;
@@ -721,9 +972,7 @@ Word16 IGFCommonFuncsIGFConfiguration(
retValue = 0; /* bitrate index is unknown -> error! */ move16();
/* interface call for reading in settings */
- hIGFInfo->bitRateIndex = IGF_MapBitRateToIndex(bitRate, mode
- ,rf_mode
- );
+ hIGFInfo->bitRateIndex = IGF_MapBitRateToIndex(total_brate, bwidth, element_mode, rf_mode);
IF (NE_16(hIGFInfo->bitRateIndex, IGF_BITRATE_UNKNOWN))
{
@@ -782,36 +1031,75 @@ Word16 IGFCommonFuncsIGFConfiguration(
/**********************************************************************/ /*
selects cumulative frequency tables and offsets for the IGF SCF arithmetic coder
**************************************************************************/
-Word16 IGFCommonFuncsIGFGetCFTables( /**< out: | error value: 0 -> error, 1 -> ok */
- Word32 bitRate, /**< in: Q0 | bitrate in bs e.g. 9600 for 9.6kbs */
- Word16 mode, /**< in: Q0 | bandwidth mode */
- Word16 rf_mode, /**< in: | flag to signal the RF mode */
- const Word16 **cf_se00, /**< out: | CF table for t == 0 and f == 0 */
- const Word16 **cf_se01, /**< out: | CF table for t == 0 and f == 1 */
- Word16 *cf_off_se01, /**< out: | offset for CF table above */
- const Word16 **cf_se02, /**< out: | CF tables for t == 0 and f >= 2 */
- const Word16 **cf_off_se02, /**< out: | offsets for CF tables above */
- const Word16 **cf_se10, /**< out: | CF table for t == 1 and f == 0 */
- Word16 *cf_off_se10, /**< out: | offset for CF table above */
- const Word16 **cf_se11, /**< out: | CF tables for t == 1 and f >= 1 */
- const Word16 **cf_off_se11 /**< out: | offsets for CF tables above */
+Word16 IGFCommonFuncsIGFGetCFTables(
+ const Word32 total_brate, /* i : bitrate in bs e.g. 9600 for 9.6kbs */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 element_mode, /* i : element mode */
+ const Word16 rf_mode, /* i : flag to signal the RF mode */
+ const Word16** cf_se00, /* o : CF table for t == 0 and f == 0 */
+ const Word16** cf_se01, /* o : CF table for t == 0 and f == 1 */
+ Word16* cf_off_se01, /* o : offset for CF table above */
+ const Word16** cf_se02, /* o : CF tables for t == 0 and f >= 2 */
+ const Word16** cf_off_se02, /* o : offsets for CF tables above */
+ const Word16** cf_se10, /* o : CF table for t == 1 and f == 0 */
+ Word16* cf_off_se10, /* o : offset for CF table above */
+ const Word16** cf_se11, /* o : CF tables for t == 1 and f >= 1 */
+ const Word16** cf_off_se11 /* o : offsets for CF tables above */
)
{
Word16 retValue;
Word16 bitRateIndex;
-Word16 temp_var;
-
- retValue = 0; /* bitrate index is unknown -> error! */ move16();
- bitRateIndex = IGF_MapBitRateToIndex(bitRate, mode
- ,rf_mode
- );
+ retValue = 0; /* bitrate index is unknown -> error! */
+ bitRateIndex = IGF_MapBitRateToIndex(total_brate, bwidth, element_mode, rf_mode);
- IF (NE_16(bitRateIndex, IGF_BITRATE_UNKNOWN))
+ IF (bitRateIndex != IGF_BITRATE_UNKNOWN)
{
- retValue = 1; /* no error */ move16();
- SWITCH(bitRateIndex)
+ retValue = 1; /* no error */
+
+ SWITCH (bitRateIndex)
+ {
+ case IGF_BITRATE_WB_13200_CPE:
+ bitRateIndex = IGF_BITRATE_WB_9600;
+ move16();
+ BREAK;
+ case IGF_BITRATE_WB_16400_CPE:
+ bitRateIndex = IGF_BITRATE_WB_9600;
+ move16();
+ BREAK;
+ case IGF_BITRATE_SWB_13200_CPE:
+ bitRateIndex = IGF_BITRATE_SWB_9600;
+ move16();
+ BREAK;
+ case IGF_BITRATE_SWB_16400_CPE:
+ bitRateIndex = IGF_BITRATE_SWB_13200;
+ move16();
+ BREAK;
+ case IGF_BITRATE_SWB_24400_CPE:
+ bitRateIndex = IGF_BITRATE_SWB_16400;
+ move16();
+ BREAK;
+ case IGF_BITRATE_FB_24400_CPE:
+ bitRateIndex = IGF_BITRATE_FB_16400;
+ move16();
+ BREAK;
+ case IGF_BITRATE_SWB_32000_CPE:
+ bitRateIndex = IGF_BITRATE_SWB_24400;
+ move16();
+ BREAK;
+ case IGF_BITRATE_FB_32000_CPE:
+ bitRateIndex = IGF_BITRATE_FB_24400;
+ move16();
+ BREAK;
+ case IGF_BITRATE_FB_48000_CPE:
+ case IGF_BITRATE_FB_64000_CPE:
+ bitRateIndex = IGF_BITRATE_FB_32000;
+ move16();
+ BREAK;
+ }
+
+ switch (bitRateIndex)
{
case IGF_BITRATE_WB_9600:
case IGF_BITRATE_RF_WB_13200:
@@ -822,115 +1110,99 @@ Word16 temp_var;
case IGF_BITRATE_SWB_24400:
case IGF_BITRATE_SWB_32000:
case IGF_BITRATE_SWB_48000:
- *cf_se00 = cf_se00_tab;
- *cf_se01 = cf_se01_tab[bitRateIndex];
- *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
- temp_var = bitRateIndex;
- if ((bitRateIndex == 0) || (bitRateIndex == 1))
- {
- bitRateIndex = 0;
- }
- else if ((bitRateIndex == 2) || (bitRateIndex == 3) || (bitRateIndex == 4) || (bitRateIndex == 5))
- {
- bitRateIndex = 1;
- }
- else if ((bitRateIndex == 6) || (bitRateIndex == 7))
- {
- bitRateIndex = 2;
- }
- else if (bitRateIndex == 8)
- {
- bitRateIndex = 3;
- }
- *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
- move16();
- bitRateIndex = temp_var;
- *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
- move16();
- *cf_se10 = &cf_se10_tab[0];
- move16();
- *cf_off_se10 = cf_off_se10_tab;
- *cf_se11 = &cf_se11_tab[0][0][0];
- move16();
- *cf_off_se11 = &cf_off_se11_tab[0][0];
- move16();
+ case IGF_BITRATE_SWB_64000:
+ *cf_se00 = cf_se00_tab;
+ *cf_se01 = cf_se01_tab[bitRateIndex];
+ *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
+ *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
+ *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
+ *cf_se10 = &cf_se10_tab[0];
+ *cf_off_se10 = cf_off_se10_tab;
+ *cf_se11 = &cf_se11_tab[0][0][0];
+ *cf_off_se11 = &cf_off_se11_tab[0][0];
+ move16();move16();move16();move16();move16();move16();move16();move16();move16();
+
BREAK;
case IGF_BITRATE_FB_16400:
case IGF_BITRATE_FB_24400:
case IGF_BITRATE_FB_32000:
- bitRateIndex = add(sub(bitRateIndex, IGF_BITRATE_FB_16400), IGF_BITRATE_SWB_16400);
- *cf_se00 = cf_se00_tab;
- *cf_se01 = cf_se01_tab[bitRateIndex];
- *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
- temp_var = bitRateIndex;
- if (bitRateIndex == 5)
- {
- bitRateIndex = 1;
- }
- else if (bitRateIndex == 6 || bitRateIndex == 7)
- {
- bitRateIndex = 2;
- }
- *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
- move16();
- bitRateIndex = temp_var;
- *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
- move16();
- *cf_se10 = &cf_se10_tab[0];
- move16();
- *cf_off_se10 = cf_off_se10_tab;
- *cf_se11 = &cf_se11_tab[0][0][0];
- move16();
- *cf_off_se11 = &cf_off_se11_tab[0][0];
- move16();
+ bitRateIndex = bitRateIndex - IGF_BITRATE_FB_16400 + IGF_BITRATE_SWB_16400;
+ *cf_se00 = cf_se00_tab;
+ *cf_se01 = cf_se01_tab[bitRateIndex];
+ *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
+ *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
+ *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
+ *cf_se10 = &cf_se10_tab[0];
+ *cf_off_se10 = cf_off_se10_tab;
+ *cf_se11 = &cf_se11_tab[0][0][0];
+ *cf_off_se11 = &cf_off_se11_tab[0][0];
+ move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16();
BREAK;
case IGF_BITRATE_FB_48000:
- bitRateIndex = add(sub(bitRateIndex, IGF_BITRATE_FB_48000), IGF_BITRATE_SWB_48000);
- *cf_se00 = cf_se00_tab;
- *cf_se01 = cf_se01_tab[bitRateIndex];
- *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
- temp_var = bitRateIndex;
- bitRateIndex = 3;
- *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
- move16();
- bitRateIndex = temp_var;
- *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
- move16();
- *cf_se10 = &cf_se10_tab[0];
- move16();
- *cf_off_se10 = cf_off_se10_tab;
- *cf_se11 = &cf_se11_tab[0][0][0];
- move16();
- *cf_off_se11 = &cf_off_se11_tab[0][0];
- move16();
+ case IGF_BITRATE_FB_64000:
+ bitRateIndex = bitRateIndex - IGF_BITRATE_FB_48000 + IGF_BITRATE_SWB_48000;
+ *cf_se00 = cf_se00_tab;
+ *cf_se01 = cf_se01_tab[bitRateIndex];
+ *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
+ *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
+ *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
+ *cf_se10 = &cf_se10_tab[0];
+ *cf_off_se10 = cf_off_se10_tab;
+ *cf_se11 = &cf_se11_tab[0][0][0];
+ *cf_off_se11 = &cf_off_se11_tab[0][0];
+ move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16();
BREAK;
case IGF_BITRATE_FB_96000:
case IGF_BITRATE_FB_128000:
- bitRateIndex = IGF_BITRATE_SWB_48000;
- move16();
- *cf_se00 = cf_se00_tab;
- *cf_se01 = cf_se01_tab[bitRateIndex];
- *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
- temp_var = bitRateIndex;
- bitRateIndex = 3;
- *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
- move16();
- bitRateIndex = temp_var;
- *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
- move16();
- *cf_se10 = &cf_se10_tab[0];
- move16();
- *cf_off_se10 = cf_off_se10_tab;
- *cf_se11 = &cf_se11_tab[0][0][0];
- move16();
- *cf_off_se11 = &cf_off_se11_tab[0][0];
- move16();
+ case IGF_BITRATE_FB_80000_CPE:
+ case IGF_BITRATE_FB_96000_CPE:
+ case IGF_BITRATE_FB_128000_CPE:
+ bitRateIndex = IGF_BITRATE_SWB_48000;
+ *cf_se00 = cf_se00_tab;
+ *cf_se01 = cf_se01_tab[bitRateIndex];
+ *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
+ *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
+ *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
+ *cf_se10 = &cf_se10_tab[0];
+ *cf_off_se10 = cf_off_se10_tab;
+ *cf_se11 = &cf_se11_tab[0][0][0];
+ *cf_off_se11 = &cf_off_se11_tab[0][0];
+ move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16();
+ BREAK;
+ case IGF_BITRATE_SWB_48000_CPE:
+ bitRateIndex = IGF_BITRATE_SWB_16400;
+ *cf_se00 = cf_se00_tab;
+ *cf_se01 = cf_se01_tab[bitRateIndex];
+ *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
+ *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
+ *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
+ *cf_se10 = &cf_se10_tab[0];
+ *cf_off_se10 = cf_off_se10_tab;
+ *cf_se11 = &cf_se11_tab[0][0][0];
+ *cf_off_se11 = &cf_off_se11_tab[0][0];
+ move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16();
+ BREAK;
+ case IGF_BITRATE_SWB_64000_CPE:
+ case IGF_BITRATE_SWB_80000_CPE:
+ case IGF_BITRATE_SWB_96000_CPE:
+ bitRateIndex = IGF_BITRATE_SWB_48000; /*bitRateIndex-IGF_BITRATE_SWB_56000+IGF_BITRATE_SWB_48000;*/
+ *cf_se00 = cf_se00_tab;
+ *cf_se01 = cf_se01_tab[bitRateIndex];
+ *cf_off_se01 = cf_off_se01_tab[bitRateIndex];
+ *cf_se02 = &cf_se02_tab[bitRateIndex][0][0];
+ *cf_off_se02 = &cf_off_se02_tab[bitRateIndex][0];
+ *cf_se10 = &cf_se10_tab[0];
+ *cf_off_se10 = cf_off_se10_tab;
+ *cf_se11 = &cf_se11_tab[0][0][0];
+ *cf_off_se11 = &cf_off_se11_tab[0][0];
+ move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16(); move16();
BREAK;
case IGF_BITRATE_UNKNOWN:
default:
assert(0);
}
}
+
return retValue;
}
diff --git a/lib_com/index_pvq_opt_fx.c b/lib_com/index_pvq_opt_fx.c
index 68297f4c2e275719115c42c1546021c32022cced..5de8567b0ec36ea2777b7990e419e0f17cb3c3b9 100644
--- a/lib_com/index_pvq_opt_fx.c
+++ b/lib_com/index_pvq_opt_fx.c
@@ -2,13 +2,13 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
+#include
#include "options.h"
#include "cnst_fx.h" /* Common constants */
#include "rom_com_fx.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h" /* required for wmc_tool */
#include "basop_util.h"
-#include
#define N_OPT_FX 5 /* complexity setting, direct functional calculation limit & low dim recursion limit */
#define TABLE_LIM_OPT_FX 96 /* odd divisor table , N-row_recursion limit setting, due to dim */
@@ -153,9 +153,7 @@ UWord32 a_four_fx( /* o: offset for dim 4 */
/* return UDIVBY3*((k_val<
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h" /* required for wmc_tool */
/*--------------------------------------------------------------------------*
* interleave_spectrum_fx()
@@ -30,8 +29,11 @@ void interleave_spectrum_fx(
/* Common inits */
p1 = coefs;
p_out = coefs_out;
-
+#ifdef SOLVED_COMP_ENC_DEC
+ IF(EQ_16(length, L_SPEC48k))
+#else
IF ( EQ_16(length, L_FRAME48k))
+#endif
{
bw = intl_bw_48;
cnt = intl_cnt_48;
@@ -41,7 +43,7 @@ void interleave_spectrum_fx(
p3 = p2 + sublen[0];
p4 = p3 + sublen[0];
}
- ELSE IF( EQ_16(length, L_FRAME32k))
+ ELSE IF( EQ_16(length, L_SPEC32k))
{
bw = intl_bw_32;
cnt = intl_cnt_32;
@@ -51,7 +53,7 @@ void interleave_spectrum_fx(
p3 = p2 + sublen[1];
p4 = p3 + sublen[1];
}
- ELSE /* length == L_FRAME16k */
+ ELSE /* length == L_SPEC16k */
{
bw = intl_bw_16;
cnt = intl_cnt_16;
@@ -112,24 +114,33 @@ void de_interleave_spectrum_fx(
Word32 coefs_out[L_FRAME48k];
Word16 sublen[] = {80, 160, 240, 320, 480, 720};
Word16 grps;
+ Word16 l_frame;
const Word16 *bw;
const Word16 *cnt;
/* common for all groups */
p1 = coefs_out;
-
+ l_frame = length;
+ move16();
+#ifdef SOLVED_COMP_ENC_DEC
+ IF(EQ_16(length, L_SPEC48k))
+#else
IF ( EQ_16(length, L_FRAME48k))
+#endif
{
bw = intl_bw_48;
cnt = intl_cnt_48;
grps = N_INTL_GRP_48;
move16();
-
+#ifdef SOLVED_COMP_ENC_DEC
+ l_frame = L_FRAME48k;
+ move16();
+#endif
p2 = coefs_out + sublen[2]; /* 240, length/4 */
p3 = coefs_out + sublen[4]; /* 480, 2*length/4 */
p4 = coefs_out + sublen[5]; /* 720, 3*length/4 */
}
- ELSE IF( EQ_16(length, L_FRAME32k))
+ ELSE IF( EQ_16(length, L_SPEC32k))
{
bw = intl_bw_32;
cnt = intl_cnt_32;
@@ -140,7 +151,7 @@ void de_interleave_spectrum_fx(
p3 = coefs_out + sublen[3]; /* 320 */
p4 = coefs_out + sublen[4]; /* 480 */
}
- ELSE /* length == L_FRAME16k */
+ ELSE /* length == L_SPEC16k */
{
bw = intl_bw_16;
cnt = intl_cnt_16;
@@ -182,7 +193,7 @@ void de_interleave_spectrum_fx(
}
}
- Copy32(coefs_out, coefs, length);
+ Copy32(coefs_out, coefs, l_frame);
return;
}
diff --git a/lib_com/interpol_fx.c b/lib_com/interpol_fx.c
index 3345bff14f8da783cc41823e636c3e3c4510ead7..522a541fc17f7ecccc485c140eba4e5c175a1ea3 100644
--- a/lib_com/interpol_fx.c
+++ b/lib_com/interpol_fx.c
@@ -1,11 +1,10 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "prot_fx.h" /* Function prototypes */
#include "rom_com_fx.h" /* tables definition */
-#include "stl.h"
Word32 Interpol_lc_fx( /* o : interpolated value Qx+16 */
diff --git a/lib_com/isf_dec_amr_wb_fx.c b/lib_com/isf_dec_amr_wb_fx.c
index 2343d59a417cc56c4a45239c2472c7178a328fad..ce049c7ff9ae7313179f8953fa4aa4274be54afb 100644
--- a/lib_com/isf_dec_amr_wb_fx.c
+++ b/lib_com/isf_dec_amr_wb_fx.c
@@ -2,11 +2,11 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "rom_com_fx.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h"
#ifdef _MSC_VER
void E_LPC_isf_isp_conversion(const Word16 isf[], Word16 isp[], const Word16 m);
@@ -260,11 +260,11 @@ void disf_2s_46b_fx(
*-------------------------------------------------------------------*/
void disf_2s_36b_fx(
- Word16 *indice, /* i : quantized indices (use indice[0] = -1 in the decoder) */
- Word16 *isf_q, /* o : quantized ISFs in the cosine domain */
- Word16 *mem_AR, /* i/o: quantizer memory for AR model */
- Word16 *mem_MA, /* i/o: quantizer memory for MA model */
- const Word16 enc_dec /* i : encoder (0), decoder (1) G722.2 FER */
+ Word16 *indice, /* i : quantized indices (use indice[0] = -1 in the decoder) */
+ Word16 *isf_q, /* o : quantized ISFs in the cosine domain */
+ Word16 *mem_AR, /* i/o: quantizer memory for AR model */
+ Word16 *mem_MA, /* i/o: quantizer memory for MA model */
+ const Word16 enc_dec /* i : encoder (0), decoder (1) G722.2 FER */
)
{
Word16 i;
diff --git a/lib_com/ivas_avq_pos_reorder_com.c b/lib_com/ivas_avq_pos_reorder_com.c
new file mode 100644
index 0000000000000000000000000000000000000000..cd682e2efef2450b629683ae8ba91b305c92cf3a
--- /dev/null
+++ b/lib_com/ivas_avq_pos_reorder_com.c
@@ -0,0 +1,68 @@
+/******************************************************************************************************
+
+ (C) 2022 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 "options.h"
+#ifdef DEBUGGING
+#include "debug.h"
+#endif
+#include "prot_fx.h"
+
+/*-----------------------------------------------------------------*
+ * ordr_esti()
+ *
+ *
+ *-----------------------------------------------------------------*/
+
+void ordr_esti(
+ const Word16 svLength, /* i : sub-vector index */
+ Word16*Mpos, /* i/o: dominant sub-vector position from ACV */
+ Word16 svOrder[], /* i/o: AVQ sub-vecotr order */
+ const Word16 Nsv /* i : total sub-vectors in a sub-frames */
+)
+{
+ Word16 i, tmp;
+
+ tmp = svOrder[0];
+ svOrder[0] = *Mpos;
+ *Mpos = sub(Nsv, 1);
+ move16();move16();move16();
+
+ FOR ( i = 1; i < svLength; i++ )
+ {
+ svOrder[i] = tmp;
+ move16();
+ tmp = add(tmp, 1);
+ }
+
+ return;
+}
diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h
new file mode 100644
index 0000000000000000000000000000000000000000..ce6709c2b593e47b07ddef2f6ff7647df74a7fba
--- /dev/null
+++ b/lib_com/ivas_cnst.h
@@ -0,0 +1,1603 @@
+/******************************************************************************************************
+
+ (C) 2022 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.
+
+*******************************************************************************************************/
+
+#ifndef IVAS_CNST_H
+#define IVAS_CNST_H
+
+#include
+#include "options.h"
+#include "cnst_fx.h"
+#include "ivas_error.h"
+
+/* clang-format off */
+
+/*----------------------------------------------------------------------------------*
+ * mathematical constants
+ *----------------------------------------------------------------------------------*/
+
+#define PI_OVER_2 ( EVS_PI / 2.0f )
+#define PI_OVER_180 ( EVS_PI / 180.0f )
+#define _180_OVER_PI ( 180.0f / EVS_PI )
+
+#define SQRT2 1.414213562373095f
+#define SQRT2_OVER_2 (SQRT2 / 2.0f)
+
+#define INV_SQRT2 7.071067811865475e-1f /* 1/sqrt(2) */
+#define INV_SQRT3 0.577350269189626f /* 1/sqrt(3) */
+
+#define LOG_10 2.30258509299f
+
+
+/*----------------------------------------------------------------------------------*
+ * IVAS formats
+ *----------------------------------------------------------------------------------*/
+
+typedef enum
+{
+ UNDEFINED_FORMAT,
+ MONO_FORMAT, /* EVS mono processing */
+ STEREO_FORMAT, /* IVAS stereo format */
+ ISM_FORMAT, /* IVAS ISM (objects-coding) format */
+ SBA_FORMAT, /* IVAS SBA (ambisonics) format */
+ MASA_FORMAT, /* IVAS MASA format */
+ MC_FORMAT, /* IVAS multi-channel format */
+ MASA_ISM_FORMAT, /* IVAS combined MASA + objects format*/
+ SBA_ISM_FORMAT /* IVAS combined SBA + objects format */
+} IVAS_FORMAT;
+
+
+/*----------------------------------------------------------------------------------*
+ * IVAS format signaling
+ *----------------------------------------------------------------------------------*/
+
+#define IVAS_FORMAT_SIGNALING_NBITS 2 /* number of bits for signaling the IVAS format */
+#define IVAS_FORMAT_SIGNALING_NBITS_SBA ( IVAS_FORMAT_SIGNALING_NBITS + 1 )
+
+
+/*----------------------------------------------------------------------------------*
+ * IVAS output audio configurations
+ *----------------------------------------------------------------------------------*/
+
+typedef enum
+{
+ AUDIO_CONFIG_INVALID,
+ AUDIO_CONFIG_MONO, /* mono output */
+ AUDIO_CONFIG_STEREO, /* stereo output */
+ AUDIO_CONFIG_5_1, /* 5.1 speakers layout CICP6 */
+ AUDIO_CONFIG_7_1, /* 7.1 speakers layout CICP12 */
+ AUDIO_CONFIG_5_1_2, /* 5.1+2 speakers layout CICP14 */
+ AUDIO_CONFIG_5_1_4, /* 5.1+4 speakers layout CICP16 */
+ AUDIO_CONFIG_7_1_4, /* 7.1+4 speakers layout CICP19 */
+ AUDIO_CONFIG_LS_CUSTOM, /* custom loudspeaker layout */
+ AUDIO_CONFIG_FOA, /* ambisonics, order 1 */
+ AUDIO_CONFIG_HOA2, /* ambisonics, order 2 */
+ AUDIO_CONFIG_HOA3, /* ambisonics, order 3 */
+ AUDIO_CONFIG_OBA, /* object based audio */
+ AUDIO_CONFIG_BINAURAL, /* binaural with HRIR */
+ AUDIO_CONFIG_BINAURAL_ROOM, /* binaural with HRIR and BRIR */
+ AUDIO_CONFIG_ISM1, /* ISM1 */
+ AUDIO_CONFIG_ISM2, /* ISM2 */
+ AUDIO_CONFIG_ISM3, /* ISM3 */
+ AUDIO_CONFIG_ISM4, /* ISM4 */
+ AUDIO_CONFIG_EXTERNAL /* external renderer */
+
+} AUDIO_CONFIG;
+
+#ifdef DEBUGGING
+typedef enum
+{
+ RENDER_TYPE_OVERRIDE_NONE,
+ RENDER_TYPE_OVERRIDE_CREND,
+ RENDER_TYPE_OVERRIDE_FASTCONV
+} ivas_renderTypeOverride;
+#endif
+
+/*----------------------------------------------------------------------------------*
+ * IVAS rendering configurations
+ *----------------------------------------------------------------------------------*/
+
+/* Rendering convention rules:
+ * 1) "st_ivas->renderer_type" reflects always the last rendering stage in the processing
+ * 2) in some configurations, more rendering stages are used
+ * - renderers at the last stage, like RENDERER_BINAURAL_xxx, consider uniquely "st_ivas->hOutputSetup"
+ * - renderers that can be followed by an additional rendering stage, e.g. RENDERER_DIRAC, consider uniquely "st_ivas->hIntSetup"
+ * 3) in case of a single rendering stage: "hIntSetup=hOutputSetup"
+ * 4) In case of no rendering stage: "hTransSetup=hIntSetup=hOutputSetup" */
+
+typedef enum
+{
+ RENDERER_DISABLE,
+ RENDERER_TD_PANNING,
+ RENDERER_BINAURAL_FASTCONV,
+ RENDERER_BINAURAL_FASTCONV_ROOM,
+ RENDERER_BINAURAL_PARAMETRIC,
+ RENDERER_BINAURAL_PARAMETRIC_ROOM,
+ RENDERER_BINAURAL_OBJECTS_TD,
+ RENDERER_DIRAC,
+ RENDERER_MC,
+ RENDERER_MC_PARAMMC,
+ RENDERER_SBA_LINEAR_DEC,
+ RENDERER_SBA_LINEAR_ENC,
+ RENDERER_STEREO_PARAMETRIC,
+ RENDERER_MONO_DOWNMIX,
+ RENDERER_MCMASA_MONO_STEREO,
+ RENDERER_PARAM_ISM,
+ RENDERER_BINAURAL_MIXER_CONV,
+ RENDERER_BINAURAL_MIXER_CONV_ROOM
+
+} RENDERER_TYPE;
+
+/*----------------------------------------------------------------------------------*
+ * IVAS general constants
+ *----------------------------------------------------------------------------------*/
+
+#define MAX_INPUT_CHANNELS 16 /* Maximum number of input channels */
+#define MAX_TRANSPORT_CHANNELS 12 /* Maximum number of transport channels */
+#define MAX_INTERN_CHANNELS 16 /* Maximum number of intern channels (HOA 3rd order) */
+#define HEAD_ROTATION_HOA_ORDER 3 /* HOA 3rd order */
+#define MAX_CICP_CHANNELS 16 /* max channels for loudspeaker layouts (16 for custom layouts)*/
+#define MAX_OUTPUT_CHANNELS 16 /* Maximum number of output channels (HOA 3rd order) */
+#define IVAS_MAX_NUM_CH 16 /* == MAX_OUTPUT_CHANNELS */
+
+#define FOA_CHANNELS 4 /* number of FOA channels */
+
+#define BINAURAL_CHANNELS 2 /* number of channels for binaural output configuration */
+#define CPE_CHANNELS 2 /* number of CPE (stereo) channels */
+#define MAX_NUM_OBJECTS 4 /* max. number of audio objects */
+
+#define MAX_SCE MAX_NUM_OBJECTS /* max. number of SCEs */
+#define MAX_CPE ( MAX_TRANSPORT_CHANNELS / CPE_CHANNELS ) /* max. number of CPEs */
+
+#define MAX_BITS_METADATA 2640 /* max. bit-budget of metadata, one channel */ /* IVAS_fmToDo: to be confirmed for final value once mature */
+#define MAX_NUM_METADATA max( 2, MAX_NUM_OBJECTS ) /* number of max. metadata (now only 2 for DirAC) */
+
+
+#define IVAS_ENC_DELAY_NS ACELP_LOOK_NS
+#define IVAS_DEC_DELAY_NS 3250000L /* 3.25 ms: IVAS decoder delay (without renderer delay) */
+
+#define DELAY_FB_1_NS 1000000L /* 1.00 ms: filter-bank delay */
+#define DELAY_FB_4_NS 4000000L /* 4.00 ms: filter-bank delay */
+
+#define IVAS_FB_ENC_DELAY_NS DELAY_FB_1_NS /* 1.00 ms: IVAS encoder filter-bank delay */
+#define IVAS_FB_DEC_DELAY_NS 5000000L /* 5.00 ms: IVAS decoder/renderer filter-bank delay */
+
+#define IVAS_MAX_SBA_ORDER 3 /* Maximum supported Ambisonics order */
+
+
+/*----------------------------------------------------------------------------------*
+ * IVAS Bitrates
+ *----------------------------------------------------------------------------------*/
+
+#define IVAS_SID_4k4 4400 /* SID frame bitrate */
+#define IVAS_SID_5k 5000 /* SBA SID frame bitrate */
+#define IVAS_13k2 13200
+#define IVAS_16k4 16400
+#define IVAS_24k4 24400
+#define IVAS_32k 32000
+#define IVAS_48k 48000
+#define IVAS_64k 64000
+#define IVAS_80k 80000
+#define IVAS_96k 96000
+#define IVAS_128k 128000
+#define IVAS_160k 160000
+#define IVAS_192k 192000
+#define IVAS_256k 256000
+#define IVAS_384k 384000
+#define IVAS_512k 512000
+
+#define IVAS_BRATE_MAX IVAS_512k
+
+#define SIZE_IVAS_BRATE_TBL 17
+#define IVAS_NUM_ACTIVE_BRATES (SIZE_IVAS_BRATE_TBL - 3)
+
+/*----------------------------------------------------------------------------------*
+ * IVAS modes : IVAS SCE, IVAS CPE modes (DFT, TD, MDCT stereo)
+ *----------------------------------------------------------------------------------*/
+
+#define EVS_MONO 0 /* EVS Mono BE operating mode */
+#define IVAS_SCE 1 /* IVAS SCE */
+#define IVAS_CPE_DFT 2 /* IVAS CPE: DFT-based parametric stereo */
+#define IVAS_CPE_TD 3 /* IVAS CPE: TD stereo */
+#define IVAS_CPE_MDCT 4 /* IVAS CPE: MDCT-based stereo */
+
+#define MIN_BRATE_MDCT_STEREO IVAS_48k /* min. CPE bitrate where MDCT stereo is supported in stereo format coding */
+
+#define PCA_BRATE IVAS_256k /* PCA supported bitrate */
+
+#define NBITS_ELEMENT_MODE 1 /* number of bits to encode the stereo element mode */
+#define NBITS_BWIDTH 2 /* number of bits to encode all audio bandwidths */
+
+/* format signalling in SID frames */
+#define SID_FORMAT_NBITS 3 /* Bit 0 | Bit 1 | Bit 2 */
+ /*-------|-------|------ */
+#define SID_DFT_STEREO 0x0 /* 0| 0| 0 */
+#define SID_MDCT_STEREO 0x1 /* 1| 0| 0 */
+#define SID_ISM 0x2 /* 0| 1| 0 */
+#define SID_MASA_1TC 0x3 /* 1| 1| 0 */
+#define SID_MULTICHANNEL 0x4 /* 0| 0| 1 */
+#define SID_SBA_1TC 0x5 /* 1| 0| 1 */
+#define SID_SBA_2TC 0x6 /* 0| 1| 1 */
+#define SID_MASA_2TC 0x7 /* 1| 1| 1 */
+
+/*----------------------------------------------------------------------------------*
+ * IVAS ACELP core constants
+ *----------------------------------------------------------------------------------*/
+
+#define MIN_UNVOICED_TWO_STAGE_BRATE 7050 /* min. per channel bitrate where two stages UNVOICED is supported */
+#define MAX_UNVOICED_BRATE ACELP_13k20 /* max. per channel bitrate where UNVOICED is supported */
+#define MAX_VOICED_BRATE ACELP_13k20 /* max. per channel bitrate where VOICED is supported */
+#define MIN_TC_BRATE 6450 /* min. per channel bitrate where TRANSITION is supported */
+#define MAX_ACELP_BRATE 48000 /* max. per channel bitrate where ACELP core is supported */
+#define MAX_ACELP_BRATE_ISM 40000 /* max. per channel bitrate where ACELP core is supported in ISM format */
+
+#define ACELP_12k8_HIGH_LIMIT 24350 /* max. per channel bitrate where the ACELP@12.8kHz is supported */
+#define ACELP_16k_LOW_LIMIT 13250 /* min. per channel bitrate where the ACELP@16kHz is supported */
+#define SCE_CORE_16k_LOW_LIMIT 17000 /* min. SCE bitrate where the ACELP@16kHz is supported; must be >= (ACELP_16k_LOW_LIMIT + SWB_TBE_1k6) */
+#define MIN_BRATE_AVQ_EXC ACELP_29k00 /* min. per channel bitrate where the AVQ excitation stage is supported */
+#define MAX_BRATE_AVQ_EXC_TD 40000 /* max. per channel bitrate where the AVQ excitation stage in time domain is supported */
+
+#define MAX_GSC_INACTIVE_BRATE 28000 /* max. per channel bitrate where GSC Inactive (@16kHz) is supported (max. 31950 to ensure BE with EVS mono) */
+
+#define FRMT_SHP_MIN_BRATE_IVAS 18000 /* min. bitrate where formant-sharpening flag is transmitted; applies both to SCE and CPE */
+
+#define CNA_MAX_BRATE_STEREO IVAS_16k4 /* max. stereo bitrate where CNA is supported */
+#define CNA_MAX_BRATE_DFT_STEREO IVAS_32k /* max. stereo bitrate where CNA is supported in DFT stereo */
+
+#define MIN_BRATE_WB_BWE 7150 /* min. per channel bitrate where WB BWE info is encoded */
+#define MIN_BRATE_SWB_BWE 7800 /* min. per channel bitrate where SWB BWE info is encoded */
+
+#define MIN_BRATE_GSC_NOISY_FLAG 12000 /* min. per channel bitrate where gsc_noisy_flag in SWB is supported */
+#define GSC_L_RATE_STG 15000 /* bitrate below will use low rate GSC settings */
+#define GSC_H_RATE_STG 20000 /* bitrates above will use high rate GSC settings */
+
+#define MIN_BRATE_SWB_SCE ACELP_9k60 /* min. SCE bitrate where SWB is supported */
+#define MIN_BRATE_SWB_STEREO IVAS_13k2 /* min. stereo bitrate where SWB is supported */
+#define MIN_BRATE_FB_STEREO IVAS_32k /* min. SCE and stereo bitrate where FB is supported */
+#define MIN_BRATE_FB_ISM 16000 /* min. SCE bitrate where FB is supported in ISM format */
+
+#define MIN_TDM_BRATE_WB_TBE_1k05 12000 /* min. per channel bitrate where WB TBE @1.05 kbps is supported (0.35kbs at lower bitrates) */
+#define MIN_BRATE_WB_TBE_1k05 9650 /* min. per channel bitrate where WB TBE @1.05 kbps is supported (0.35kbs at lower bitrates) */
+#define MIN_BRATE_SWB_TBE_1k60 13200 /* min. per channel bitrate where SWB TBE @1.60 kbps is supported (0.95 kbps at lower bitrates) */
+#define MIN_BRATE_SWB_TBE_2k80 24400 /* min. per channel bitrate where SWB TBE @2.80 kbps is supported */
+#define MIN_MIN_BRATE_LRTD_SWB_BWE 5000
+
+#define STEREO_TCX_MIN_RATE 9000 /* TCX coding down to this per channel bitrate */
+#define STEREO_GSC_BIT_RATE_ALLOC 9200
+#define HQ_MDCTCLASS_CROSSOVER_BRATE 32000 /* MDCT classifier crossover bitrate between 24.4 and 32 kbps tunings*/
+#define HQ_BWE_CROSSOVER_BRATE 26000 /* HQ crossover bitrate between 24.4 and 32 kbps BWE tunings */
+
+
+/*----------------------------------------------------------------------------------*
+ * ISm Constants
+ *----------------------------------------------------------------------------------*/
+
+#define META_LINE_LENGTH 200 /* max number of characters at one line of metadata input/output file */
+
+#define ISM_NB_BITS_METADATA_NOMINAL ( ( SCE_CORE_16k_LOW_LIMIT - ACELP_16k_LOW_LIMIT ) / FRAMES_PER_SEC ) /* nominal number of metadata bits - used for configuration of Core-Coder modules */
+
+#define ISM_METADATA_VAD_FLAG_BITS 1
+#define ISM_METADATA_FLAG_BITS 2
+
+#define ISM_NO_META 0
+#define ISM_LOW_IMP 1
+#define ISM_MEDIUM_IMP 2
+#define ISM_HIGH_IMP 3
+
+#define ISM_AZIMUTH_NBITS 7
+#define ISM_AZIMUTH_MIN -180.0f
+#define ISM_AZIMUTH_MAX 180.0f
+#define ISM_AZIMUTH_LOW_BORDER -140.0f
+#define ISM_AZIMUTH_HIGH_BORDER 135.0f
+
+#define ISM_ELEVATION_NBITS 6
+#define ISM_ELEVATION_MIN -90.0f
+#define ISM_ELEVATION_MAX 90.0f
+#define ISM_ELEVATION_LOW_BORDER -70.0f
+#define ISM_ELEVATION_HIGH_BORDER 65.0f
+#define ISM_Q_STEP 2.5f
+#define ISM_Q_STEP_BORDER 5.0f
+
+/* Parametric ISM */
+#define MAX_PARAM_ISM_NBANDS 11
+#define MAX_PARAM_ISM_NBANDS_WB 9
+#define MAX_PARAM_ISM_NBANDS_NB 7
+#define PARAM_ISM_MDFT_NO_SLOTS 4
+#define MAX_PARAM_ISM_NBLOCKS 1
+#define MAX_PARAM_ISM_WAVE 2
+#define PARAM_ISM_OBJ_IND_NBITS 2
+#define PARAM_ISM_POW_RATIO_NBITS 3
+#define PARAM_ISM_MAX_DMX 2
+#define PARAM_ISM_MAX_CHAN 16
+#define PARAM_ISM_HYS_BUF_SIZE 10
+
+typedef enum
+{
+ ISM_MODE_NONE,
+ ISM_MODE_DISC, /* discrete ISM */
+ ISM_MODE_PARAM /* parametric ISM */
+} ISM_MODE;
+
+
+/* ISm metadata bitstream */
+enum
+{
+ IND_ISM_NUM_OBJECTS,
+ IND_ISM_METADATA_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS,
+ IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS,
+
+ /* ------------- loop for objects -------------- */
+ TAG_ISM_LOOP_START = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS,
+ IND_ISM_AZIMUTH_DIFF_FLAG = TAG_ISM_LOOP_START,
+ IND_ISM_AZIMUTH = TAG_ISM_LOOP_START,
+ IND_ISM_ELEVATION_DIFF_FLAG = TAG_ISM_LOOP_START,
+ IND_ISM_ELEVATION = TAG_ISM_LOOP_START,
+ TAG_ISM_LOOP_END = TAG_ISM_LOOP_START + 100, /* IVAS_fmToDo: to be reviewed once the final metadata are defined */
+ /* --------- end of loop for objects ----------- */
+
+ ISM_MAX_NUM_INDICES
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * DFT Stereo Constants
+ *----------------------------------------------------------------------------------*/
+
+/* Coding configurations*/
+#define STEREO_DFT_DMX_ACTIVE 1 /* Enable true spatialization */
+
+/* residual coding modes */
+#define STEREO_DFT_RES_COD_OFF 0
+#define STEREO_DFT_RES_COD_1kHz 1 /* use residual coding up to 1 kHz */
+#define STEREO_DFT_RES_COD_1_6kHz 2 /* use residual coding up to 1.6 kHz */
+
+/* residual prediction modes */
+#define STEREO_DFT_RESPRED_OFF 0
+#define STEREO_DFT_RESPRED_STEFI 1 /* full-band stereo filling (above residual) */
+#define STEREO_DFT_RESPRED_ESF 2 /* enhanced stereo filling in LB, regular stereo filling in HB */
+
+/* band resolution */
+#define STEREO_DFT_BAND_RES_HIGH 1 /* use higher band resolution following ERB4 scale */
+#define STEREO_DFT_BAND_RES_LOW 2 /* use lower band resolution following ERB8 scale */
+
+/* Processing constants*/
+#define STEREO_DFT_OVL_NS ACELP_LOOK_NS /* 8.75ms */
+#define STEREO_DFT_ZP_NS 3125000L /* 3.125ms */
+#define STEREO_DFT_HOP_NS 10000000L /* 10ms */
+#define STEREO_DFT_N_NS ( STEREO_DFT_HOP_NS + ACELP_LOOK_NS + 2 * STEREO_DFT_ZP_NS )
+
+#define STEREO_DFT_ZP_NS_ENC 5625000L /* 5.625ms */
+#define STEREO_DFT_HOP_NS_ENC FRAME_SIZE_NS /* 20ms */
+#define STEREO_DFT_N_NS_ENC ( STEREO_DFT_HOP_NS_ENC + ACELP_LOOK_NS + 2 * STEREO_DFT_ZP_NS_ENC )
+
+#define STEREO_DFT_OVL_MAX NS2SA( 48000, ACELP_LOOK_NS )
+#define STEREO_DFT_HOP_MAX NS2SA( 48000, STEREO_DFT_HOP_NS )
+
+#define STEREO_DFT_ZP_MAX_ENC NS2SA( 48000, STEREO_DFT_ZP_NS_ENC )
+#define STEREO_DFT_HOP_MAX_ENC NS2SA( 48000, STEREO_DFT_HOP_NS_ENC )
+#define STEREO_DFT_N_MAX_ENC NS2SA( 48000, STEREO_DFT_N_NS_ENC )
+
+#define STEREO_DFT_OVL_32k NS2SA( 32000, ACELP_LOOK_NS )
+
+#define STEREO_DFT_ZP_32k_ENC NS2SA( 32000, STEREO_DFT_ZP_NS_ENC )
+#define STEREO_DFT_HOP_32k_ENC NS2SA( 32000, STEREO_DFT_HOP_NS_ENC )
+#define STEREO_DFT_N_32k_ENC NS2SA( 32000, STEREO_DFT_N_NS_ENC )
+
+#define STEREO_DFT_OVL_16k NS2SA( 16000, ACELP_LOOK_NS )
+
+#define STEREO_DFT_ZP_16k_ENC NS2SA( 16000, STEREO_DFT_ZP_NS_ENC )
+#define STEREO_DFT_HOP_16k_ENC NS2SA( 16000, STEREO_DFT_HOP_NS_ENC )
+#define STEREO_DFT_N_16k_ENC NS2SA( 16000, STEREO_DFT_N_NS_ENC )
+
+#define STEREO_DFT_OVL_12k8 NS2SA( 12800, ACELP_LOOK_NS )
+
+#define STEREO_DFT_ZP_12k8_ENC NS2SA( 12800, STEREO_DFT_ZP_NS_ENC )
+#define STEREO_DFT_HOP_12k8_ENC NS2SA( 12800, STEREO_DFT_HOP_NS_ENC )
+#define STEREO_DFT_N_12k8_ENC NS2SA( 12800, STEREO_DFT_N_NS_ENC )
+
+#define STEREO_DFT_OVL_8k NS2SA( 8000, ACELP_LOOK_NS )
+#define STEREO_DFT_N_8k NS2SA( 8000, STEREO_DFT_N_NS )
+
+#define STEREO_DFT_ZP_8k_ENC NS2SA( 8000, STEREO_DFT_ZP_NS_ENC )
+#define STEREO_DFT_HOP_8k_ENC NS2SA( 8000, STEREO_DFT_HOP_NS_ENC )
+#define STEREO_DFT_N_8k_ENC NS2SA( 8000, STEREO_DFT_N_NS_ENC )
+
+#define STEREO_DFT32MS_N_NS FRAME_SIZE_NS /* 20 ms */
+#define STEREO_DFT32MS_OVL_NS 3125000L /* 3.125ms - Overlap for the outer edges of windows on decoder */
+#define STEREO_DFT32MS_OVL2_NS 9375000L /* 9.375ms - Overlap for the inner edges of windows on decoder */
+#define STEREO_DFT32MS_WIN_CENTER_NS ( int32_t )( ( FRAME_SIZE_NS + STEREO_DFT32MS_OVL_NS ) * 0.5f ) /* 11.5625ms - mid point of the two windows wrt the left edge of overlap */
+#if defined( DEBUG_MODE_DFT ) || defined( DEBUG_STEREO_DFT_NOCORE )
+#define STEREO_DFT32MS_HOP_NS 10000000L /* 10ms */
+#endif
+#define STEREO_DFT32MS_ZP_NS ( int32_t )( 0.5f * ( STEREO_DFT32MS_N_NS - STEREO_DFT32MS_WIN_CENTER_NS - ( STEREO_DFT32MS_OVL2_NS * 0.5f ) ) ) /* 2 sided zp calculated such that window size is satisfied */
+
+#define STEREO_DFT32MS_OVL_MAX NS2SA( 48000, STEREO_DFT32MS_OVL_NS )
+#define STEREO_DFT32MS_OVL2_MAX NS2SA( 48000, STEREO_DFT32MS_OVL2_NS )
+#define STEREO_DFT32MS_N_MAX NS2SA( 48000, STEREO_DFT32MS_N_NS )
+
+#define STEREO_DFT32MS_N_32k NS2SA( 32000, STEREO_DFT32MS_N_NS )
+
+#define STEREO_DFT32MS_OVL_16k NS2SA( 16000, STEREO_DFT32MS_OVL_NS )
+#define STEREO_DFT32MS_OVL2_16k NS2SA( 16000, STEREO_DFT32MS_OVL2_NS )
+#define STEREO_DFT32MS_N_16k NS2SA( 16000, STEREO_DFT32MS_N_NS )
+
+#define STEREO_DFT32MS_OVL_12k8 NS2SA( 12800, STEREO_DFT32MS_OVL_NS )
+#define STEREO_DFT32MS_OVL2_12k8 NS2SA( 12800, STEREO_DFT32MS_OVL2_NS )
+#define STEREO_DFT32MS_N_12k8 NS2SA( 12800, STEREO_DFT32MS_N_NS )
+
+#define STEREO_DFT32MS_OVL_8k NS2SA( 8000, STEREO_DFT32MS_OVL_NS )
+#define STEREO_DFT32MS_OVL2_8k NS2SA( 8000, STEREO_DFT32MS_OVL2_NS )
+#define STEREO_DFT32MS_N_8k NS2SA( 8000, STEREO_DFT32MS_N_NS )
+
+#define STEREO_DFT32MS_STEP 3 /* STEREO_DFT32MS_OVL2_NS / STEREO_DFT32MS_OVL_NS */
+#define STEREO_DFT_TRIGO_DEC_STEP 2
+#define STEREO_DFT_TRIGO_SRATE_8k_STEP 4
+#define STEREO_DFT_TRIGO_SRATE_12k8_STEP 1
+#define STEREO_DFT_TRIGO_SRATE_16k_STEP 2
+#define STEREO_DFT_TRIGO_SRATE_32k_STEP 1
+#define STEREO_DFT_TRIGO_SRATE_48k_STEP 1
+
+#define STEREO_DFT_OFFSET 1
+#define STEREO_DFT_NBDIV 2
+
+#define STEREO_DFT_DELAY_DEC_BWE_NS ( STEREO_DFT_OFFSET * STEREO_DFT_HOP_NS - ACELP_LOOK_NS ) /* 1.25ms/2.5ms: max delay for core decoder*/
+
+#define STEREO_DFT_ENC_DFT_NB ( STEREO_DFT_OFFSET + 1 ) /*frame + lookahead*/
+#define STEREO_DFT_DEC_DFT_NB ( STEREO_DFT_NBDIV + STEREO_DFT_OFFSET ) /*frame + lookahead*/
+
+#define STEREO_CNA_LR_CORR_LT_FILT 0.95f /* long-term averaging factor for L/R correlation estimation */
+#define STEREO_CNA_ILD_LT_FILT 0.9f /* long-term averaging factor for ILD estimation */
+
+typedef enum
+{
+ DFT_STEREO_DEC_ANA_NOCORE = -1, /*-1: signal read from file (DEBUG mode)*/
+ DFT_STEREO_DEC_ANA_FB, /* 0: full-band signal (e.g. HQ-CORE/TCX (M), residual (S))*/
+ DFT_STEREO_DEC_ANA_FB_ADD, /* 1: full-band signal to add (e.g High-band signal of TD-BWE)*/
+ DFT_STEREO_DEC_ANA_BPF, /* 2: Bass-post-filter error signal, to add and weight*/
+ DFT_STEREO_DEC_ANA_LB, /* 3: low-band signal (e.g. ACELP (M), resiudal signal (S))*/
+ DFT_STEREO_DEC_ANA_LB_ADD, /* 4: low-band signal to add (e.g. LB-TCX)*/
+ DFT_STEREO_DEC_ANA_HB_ADD /* 5: high-band signal to add (e.g. transition to ACELP in MDCT->DFT switching) */
+} DFT_STEREO_DEC_ANA_TYPE;
+
+/*Stereo parameters*/
+
+#define STEREO_DFT_ERB4_BANDS 14
+#define STEREO_DFT_ERB8_BANDS 8
+#define STEREO_DFT_BAND_MAX ( STEREO_DFT_ERB4_BANDS - 1 ) /*Maximum number of parameter bands*/
+#define STEREO_DFT_BUF_MAX STEREO_DFT32MS_N_MAX * STEREO_DFT_NBDIV
+
+#define STEREO_DFT_NRG_PAST_LEN 3
+
+/*ITD*/
+#define STEREO_DFT_ITD_FS 32000
+#define STEREO_DFT_ITD_MAX 160 /*samples @ 32000*/
+#define STEREO_DFT_ITD_MAX_ANA 200
+#define STEREO_DFT_ITD_MIN max( STEREO_DFT_ITD_MAX - 256 + 1, 1 ) /*STEREO_DFT_ITD_MAX-pow(2,STEREO_DFT_ITD_NBITS-1)+1*/
+#define STEREO_DFT_ITD_NBITS 9 /* 1 bit for sign, the rest for the absolute value*/
+#define STEREO_DFT_ITD_MODE_NBITS 1
+
+#define STEREO_DFT_SID_ITD_NBITS 4 /* Number of ITD bits SID frames */
+#define STEREO_DFT_SID_ITD_FAC 1 /* Quantization step reduction factor */
+
+#define STEREO_DFT_FLAG_BITS 1
+#define STEREO_DFT_SIDEGAIN_NBITS 5
+#define STEREO_DFT_FEC_THRESHOLD 10
+#define STEREO_DFT_BITDIFF_LP_FAC (0.06f) /* Low-pass filter coefficient for filtering bit difference between absolute and differential coding */
+#define STEREO_DFT_BITDIFF_ABS_SELECT (0.8f) /* Constant to set tendency for selecting absolute coding mode */
+#define STEREO_DFT_BITDIFF_INIT (12.0f) /* Init value for low-pass bit difference */
+
+#define STEREO_DFT_SIDE_GAIN_NBITS 5
+#define STEREO_DFT_IPD_NBITS 3
+#define STEREO_DFT_GIPD_NBITS 4
+
+#define STEREO_DFT_ITD_VAD_BAND_NUM 20
+
+#define STEREO_DFT_XCORR_LB_MAX 24
+
+#define STEREO_DFT_N_COH_PRED 4 /* Number of intra-frame predictors for coherence vector */
+#define STEREO_DFT_COH_PRED_COEFFS 15 /* Number of coefficients per predictor */
+#define STEREO_DFT_PRED_NBITS 2 /* Bits to signal predictor (log_2(4) = 2) */
+#define STEREO_DFT_N_COH_ALPHA_STEPS 5
+#define STEREO_DFT_N_COH_ALPHA_LEVELS 2
+#define STEREO_DFT_N_COH_ALPHA_BITS 1
+#define STEREO_DFT_SG_ACT_CNT_MAX 1500
+#define STEREO_DFT_COH_MAXBAND 6
+#define STEREO_DFT_SID_GIPD_NBITS 2
+#define STEREO_DFT_FD_FILT 0.9f
+
+/*Residual prediction*/
+#define STEREO_DFT_PAST_MAX 4
+#define STEREO_DFT_RES_PRED_BAND_MAX 12
+
+#define STEREO_DFT_REVERB_MODE_NBITS 1
+#define STEREO_DFT_RES_PRED_BAND_MIN 0
+#define STEREO_DFT_RES_PRED_BAND_MIN_RED 3
+#define STEREO_DFT_RES_PRED_BAND_MIN_CONST 3
+
+#define STEREO_DFT_ALLPASS_BUFFERLEN 256
+#define STEREO_DFT_ALLPASS_FADELEN_12k8 32
+#define STEREO_DFT_ALLPASS_FADELEN_16k 40
+#define STEREO_DFT_CORE_HIST_MAX ( STEREO_DFT_PAST_MAX + 3 ) / 2
+#define STEREO_DFT_TD_STEFI_DELAY_NS FRAME_SIZE_NS + IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS
+#define STEREO_DFT_TD_STEFI_SUBFR_DELAY 2
+
+/*Residual coding*/
+#define STEREO_DFT_N_MAX_RES 800 /* Maximum of lines coded in residual coding */
+#define STEREO_DFT_RES_GLOBAL_GAIN_BITS 7
+#define STEREO_DFT_RES_GAINS_BITS 3
+
+#define STEREO_DFT_RES_COD_SNR_MIN 10
+#define STEREO_DFT_RES_COD_SNR_MAX 40
+#define STEREO_DFT_L_SUBFR_8k 32
+#define STEREO_DFT_NBPSF_PIT_MAX_8k NBPSF_PIT_MAX / 2
+
+/* Residual coding BPF */
+#define STEREO_DFT_BPF_ADAPT_ALPHA (0.61f)
+#define STEREO_DFT_BPF_ADAPT_BETA (0.68f)
+
+/* Golomb-Rice encoding */
+#define NO_SYMB_GR_SIDE_G 31
+#define NO_SYMB_GR_PRED_G 8
+
+#define STEREO_DFT_RES_BW_MAX 66 /*Maximum number of bin for residual signal in each frame (res_cod_band_max == 6 in 48kHz)*/
+#define SBA_DIRAC_STEREO_NUM_BANDS 5
+#define SBA_DIRAC_NRG_SMOOTH_LONG 10
+#define SBA_DIRAC_NRG_SMOOTH_SHORT 3
+
+/* PLC for DFT Stereo residual */
+#define STEREO_DFT_RES_N_PEAKS_MAX 15 /*Maximum number of peaks within residual signal in each frame (res_cod_band_max == 6 in 48kHz)*/
+
+/* MDCT to DFT Stereo switching */
+#define STEREO_MDCT2DFT_FADE_LEN_48k L_FRAME48k / 8
+
+/* DFT stereo side-info bitstream*/
+enum
+{
+ IND_STEREO_DFT_ATTACK_PRESENT,
+ IND_STEREO_DFT_RES_COD,
+ IND_STEREO_DFT_SIDEGAIN_FLAG,
+
+ IND_STEREO_DFT_SIDEGAINS,
+ IND_STEREO_DFT_ITD_MODE = IND_STEREO_DFT_SIDEGAINS + 4 * STEREO_DFT_BAND_MAX + 72,
+
+ IND_STEREO_DFT_ITD_HUFF,
+ IND_STEREO_DFT_ITD_NEG,
+ IND_STEREO_DFT_ITD_COD,
+
+ IND_STEREO_DFT_NO_IPD_FLAG,
+ IND_STEREO_DFT_GIPD,
+
+ IND_STEREO_DFT_IPD_FLAG,
+ IND_STEREO_DFT_IPD_COD,
+
+ IND_STEREO_DFT_REVERB_MODE = IND_STEREO_DFT_IPD_COD + 4 * STEREO_DFT_BAND_MAX + 2, /* max number for GR order 2 */
+
+ IND_STEREO_DFT_RES_PRED_FLAG,
+ IND_STEREO_DFT_PRED_GAIN_COD,
+
+ IND_STEREO_DFT_NON_USED = IND_STEREO_DFT_PRED_GAIN_COD + 4 * STEREO_DFT_RES_PRED_BAND_MAX + 2, /* max number for GR order 2 */
+
+ /* residual coding */
+ IND_STEREO_DFT_RESIDUAL_GLOBAL_GAIN,
+ IND_STEREO_DFT_RESIDUAL_COD,
+ IND_STEREO_DFT_SID_COH = IND_STEREO_DFT_RESIDUAL_COD + 56, /* max possible number of indices for residual coding */
+
+ STEREO_DFT_MAX_NUM_INDICES = IND_STEREO_DFT_SID_COH + 6 /* max possible number of indices for coherence encoding */
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Range coder constants
+ *----------------------------------------------------------------------------------*/
+
+#define RANGE_UNI_BUFFER_BYTES_MAX 1024
+#define RANGE_N_CONTEXT 64
+#define RANGE_N_SYMBOLS 17
+
+
+/*----------------------------------------------------------------------------------*
+ * ECLVQ Stereo constants
+ *----------------------------------------------------------------------------------*/
+
+#define ECSQ_VECTOR_SIZE_MAX 256
+#define ECSQ_GLOBAL_GAIN_INDEX_ALL_ZERO 127 /* indicates that all values in the vector are zero */
+
+#define ECLVQ_GLOBAL_GAIN_FACTOR ( 20.0f * 127.0f / 90.0f )
+#define ECLVQ_INV_GLOBAL_GAIN_FACTOR ( 1.0f / ( 20.0f * 127.0f / 90.0f ) )
+
+/* the currently defined configuration indexes are:
+ 0: un-optimized using uniform 4 bit parameters (reserved)
+ 1: optimized for 32 kbps target SNR
+ 2: optimized for 32 kbps target bits
+ 3: optimized for 48 kbps target SNR
+ 4: optimized for 48 kbps target bits
+ 5: optimized for 64 kbps target SNR
+ 6: optimized for 64 kbps target bits
+*/
+
+#define ECSQ_CONFIG_COUNT 7 /* number of different configurations, such as bitrates or profiles */
+#define ECSQ_PARAM_COUNT 16 /* number of different coding distributions, the first indicates only zero values */
+#define ECSQ_ALL_ZERO_PARAM -1 /* the integer exponent of the first parameter indicating only zero values */
+#define ECSQ_PROB_BITS 14 /* number of bits used for representing the probabilities in the actual AC */
+#define ECSQ_PROB_TOTAL ( 1 << ECSQ_PROB_BITS ) /* total count used for representing the probabilities in the actual AC */
+
+#define ECSQ_TAB_VALS_SIZE 16 /* 0, 1, 2, 3, ... */
+#define ECSQ_SEGMENT_SIZE 8
+#define ECSQ_log2TB_SIZE 13
+#define ECSQ_PARAM_SEARCH_RANGE 1
+#define ECSQ_NONZERO_MAX 3
+
+
+/*----------------------------------------------------------------------------------*
+ * UNCLR & cross-talk stereo classifiers
+ *----------------------------------------------------------------------------------*/
+
+#define XTALK_SCORE_BUF_LEN 5
+
+#define SSC_MAX_NFEA 58 /* Maximum number of features for stereo scene classification */
+#define SIZE_UNCLR_ISEL_TD 10
+#define SIZE_UNCLR_ISEL_DFT 8
+
+#define SIZE_XTALK_ISEL_TD 17
+#define SIZE_XTALK_ISEL_DFT 11
+
+#define UNCLR_L_ETOT 3
+#define UNCLR_L_RELE 10
+#define UNCLR_RC_ORDER 20
+#define MAX_UV_CNT 100
+
+#define XTALK_PHAT_LEN 200
+
+enum fea_names
+{
+ E_d_clas, E_d_pitch, E_d_voicing, E_sum_d_LSF, E_d_lepsP_13, E_d_cor_map_sum, E_d_dE1, E_d_nchar,
+ E_d_non_sta, E_d_ps_sta, E_d_ps_diff, E_d_sp_div, E_clas, E_pitch, E_voicing, E_lsf_1,
+ E_lsf_4, E_lsf_9, E_lsf_14, E_lepsP_13, E_cor_map_sum, E_dE1, E_nchar, E_non_sta,
+ E_ps_sta, E_ps_diff, E_sp_div, E_corrLagStats0, E_ica_corr_value0, E_ica_instTargetGain,
+ E_diff_corrLM_corrRM, E_tdm_LT_es_em, E_sum_prod, E_tdm_es_em, E_m_corrL_corrR, E_d_corrL_corrR, E_corrEst0, E_corrLagMax,
+ E_d_corrLagMax, E_corrEstMax, E_corrEst_ncorr,E_sum_xcorr, E_es_em, E_cohSNR, E_d_prodL_prodR, E_xcorr_itd_value,
+ E_angle_rot, E_g_pred, E_g_side, E_gainILD, E_gainIPD, E_IPD, E_d_IPD, E_ITD,
+ E_gphat_d_itd2, E_gphat_itd1_flip, E_gphat_ratio_m1_m2, E_gphat_m2_m2
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * ICA Stereo constants
+ *----------------------------------------------------------------------------------*/
+
+#define L_CH_INDX 0
+#define R_CH_INDX 1
+#define CORR_INTER_FS 8000
+#define L_NCSHIFT_NS 5000000L
+#define L_MEM_RECALC_NS ( L_NCSHIFT_NS * 3 ) / 2
+#define L_MEM_RECALC_TBE_NS ( L_NCSHIFT_NS + L_SAMPLES_LA_NS )
+#define L_NCSHIFTMAX NS2SA( 48000, L_NCSHIFT_NS )
+#define L_DEC_MEM_LEN_ICA L_NCSHIFTMAX + ( N_MAX_SHIFT_CHANGE + 1 ) + SINC_ORDER1 / INTERP_FACTOR1
+#define L_FRAME_DS NS2SA( CORR_INTER_FS, FRAME_SIZE_NS )
+#define L_XCORRMEM_DS NS2SA( CORR_INTER_FS, 2 * ( ACELP_LOOK_NS ) )
+#define L_NCSHIFT_DS ( int16_t )( ( ( int32_t )(CORR_INTER_FS) *L_NCSHIFTMAX ) / 48000L )
+#define L_SAMPLES_LA_NS 625000L
+
+#define L_MEM_RECALC_TBE_16K NS2SA( 16000, L_MEM_RECALC_TBE_NS )
+#define L_MEM_RECALC_48K NS2SA( 48000, L_MEM_RECALC_NS )
+#define L_MEM_RECALC_12K8 NS2SA( 12800, L_MEM_RECALC_NS )
+#define L_MEM_RECALC_16K NS2SA( 16000, L_MEM_RECALC_NS )
+#define N_MAX_SHIFT_CHANGE 20
+
+#define L_MEM_RECALC_SCH_NS ( ACELP_LOOK_NS + DELAY_FIR_RESAMPL_NS - L_MEM_RECALC_NS )
+#define L_MEM_RECALC_48k_SCH NS2SA( 48000, L_MEM_RECALC_SCH_NS )
+
+#define INTERP_FACTOR1 2
+#define SINC_ORDER1 24
+#define L_SHIFT_ADAPT_MAX 596 /* must be a multiple of 2 */
+#define L_SHIFT_ADAPT_16k 290 /* must be a multiple of 2 */
+
+#define STEREO_BITS_TCA_CHAN 1 /* ref/target channel index */
+#define STEREO_BITS_TCA_CORRSTATS 5 /* target corrStats */
+#define STEREO_BITS_TCA_GD 5 /* target gain */
+#define STEREO_TCA_GDMIN -1.0f
+#define STEREO_TCA_GDSTEP 0.05f
+#define STEREO_BITS_TCA ( STEREO_BITS_TCA_CHAN + STEREO_BITS_TCA_CORRSTATS + STEREO_BITS_TCA_GD )
+
+#define STEREO_ICBWE_MSFLAG_BITS 1 /* BWE Multi Source flag */
+
+#define STEREO_ICBWE_REFBITS 1
+#define STEREO_ICBWE_SPBITS 2
+#define STEREO_ICBWE_GSBITS 4
+#define STEREO_BITS_ICBWE ( STEREO_ICBWE_SPBITS + STEREO_ICBWE_GSBITS + STEREO_ICBWE_REFBITS )
+
+#define STEREO_ICBWE_SPBITS_DFT 2
+#define STEREO_ICBWE_GSBITS_DFT 7
+#define STEREO_BITS_ICBWE_DFT ( STEREO_ICBWE_SPBITS_DFT + STEREO_ICBWE_GSBITS_DFT + STEREO_ICBWE_REFBITS )
+
+#define MAX_DELAYREGLEN 12 /* max regression length */
+#define INV_MAX_DELAYREGLEN 0.083333333333333f /* (1/MAX_DELAYREGLEN) */
+#define MAX_INTERPOLATE 11
+#define ADDED_MEM_DS 40
+
+#define STEREO_L_TCA_OVLP_NS 5000000L /* overlap length of the ICA gain scaling */
+
+
+/*----------------------------------------------------------------------------------*
+ * TD Stereo Constants
+ *----------------------------------------------------------------------------------*/
+
+#define TDM_NQ ( 32 - 1 ) /* number of quantization steps of mixing factor */
+#define LRTD_STEREO_LEFT_IS_PRIM ( TDM_NQ - 1 ) /* Ratio index value indicating that left channel is coded as primary channel */
+#define LRTD_STEREO_RIGHT_IS_PRIM 0 /* Ratio index value indicating that right channel is coded as primary channel */
+#define LRTD_STEREO_QUARTER_RANGE ( ( TDM_NQ + 1 ) / 4 ) /* Ratio index value */
+#define LRTD_STEREO_MID_IS_PRIM ( ( TDM_NQ - 1 ) / 2 ) /* Ratio index value */
+
+#define TDM_L_NOVA_NS 5000000L /* mixing overlap length */
+
+#define TDM_SECONDARY_SIGNALLING 3 /* number of bits to code the signalling for secondary channel */
+#define TDM_RATIO_BITS 5 /* number of bits to code the correlation ratio */
+#define TDM_LP_REUSE_BITS 1 /* number of bits to code LP reuse flag for secondary channel */
+#define TDM_LR_CONTENT_BITS 1 /* number of bits to code flag when the content is LR or not */
+#define TDM_SIGNAL_BITS_READ_FROM_THE_END_OF_BS ( TDM_SECONDARY_SIGNALLING + TDM_RATIO_BITS + TDM_LP_REUSE_BITS + TDM_LR_CONTENT_BITS + STEREO_BITS_TCA )
+#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+#define TDM_IC_LSF_PRED_BITS 1 /* Number of bits to code the inter channel lsf prediction mode */
+#endif
+#endif
+
+
+/*----------------------------------------------------------------------------------*
+ * MDCT Stereo Constants
+ *----------------------------------------------------------------------------------*/
+
+/* MDCT stereo modes */
+#define SMDCT_MS_DECISION 0
+#ifdef DEBUG_FORCE_MDCT_STEREO_MODE
+#define SMDCT_FORCE_LR 1
+#define SMDCT_FORCE_MS 2
+#endif
+
+#define MAX_SFB 70 /* Maximum number of stereo frequency bands = 64 + 6 for TCX after ACELP */
+
+#define SMDCT_DUAL_MONO 0 /* Dual-mono MDCT Stereo */
+#define SMDCT_MS_FULL 1 /* MS MDCT Stereo */
+#define SMDCT_BW_MS 2 /* Band-wise MS MDCT Stereo */
+
+#define SMDCT_MINIMUM_ARITH_BITS 17 /* Minimum bits to reserve for the arithmetic coder */
+#define SMDCT_GLOBAL_ILD_BITS 4
+#define SMDCT_ILD_RANGE ( 1 << SMDCT_GLOBAL_ILD_BITS ) /* Range of the coded ILD */
+#define SMDCT_NBBITS_SPLIT_RATIO 3
+#define SMDCT_BITRATE_RATIO_RANGE ( 1 << SMDCT_NBBITS_SPLIT_RATIO ) /* Range of the coded bitrate distribution ratio */
+#define SMDCT_EQUAL_RATIO_RANGE ( SMDCT_BITRATE_RATIO_RANGE >> 1 )
+
+#define SMDCT_MAX_STEREO_BANDS_TCX20 44
+#define SMDCT_MAX_STEREO_BANDS_TCX10 33
+
+#define MAX_MDCT_ITD_BRATE IVAS_64k
+
+#define SNS_LOW_BR_MODE -1
+#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
+#define SNS_NPTS 16 /* Number of downsampled SNS parameters */
+
+#define MDCT_ST_PLC_FADEOUT_START_FRAME 3
+
+typedef enum {
+ EQUAL_CORES,
+ TCX10_IN_0_TCX20_IN_1,
+ TCX20_IN_0_TCX10_IN_1,
+} TONALMDCTCONC_NOISE_GEN_MODE;
+#endif
+
+
+/*----------------------------------------------------------------------------------*
+ * MDFT FB Constants
+ *----------------------------------------------------------------------------------*/
+
+#define MDFT_FB_BANDS_240 240
+#define CLDFB_TO_MDFT_FAC 4
+#define MDFT_NO_COL_MAX 4
+
+/*----------------------------------------------------------------------------------*
+ * General Parametric Coding Constants
+ *----------------------------------------------------------------------------------*/
+// VE: this should be renamed to e.g. N_SPATIAL_SUBFRAMES
+#define MAX_PARAM_SPATIAL_SUBFRAMES 4 /* Maximum number of subframes for parameteric spatial coding */
+
+
+/*----------------------------------------------------------------------------------*
+ * SBA Constants
+ *----------------------------------------------------------------------------------*/
+
+#define SBA_PLANAR_BITS 1
+#define SBA_ORDER_BITS 2
+#define SBA_NHARM_HOA3 16
+
+typedef enum
+{
+ SBA_MODE_NONE,
+ SBA_MODE_DIRAC,
+ SBA_MODE_SPAR, // VE: this is actually SBA_MODE_SPAR_DIRAC
+} SBA_MODE;
+
+
+/*----------------------------------------------------------------------------------*
+ * DirAC Constants
+ *----------------------------------------------------------------------------------*/
+
+#define DIRAC_MAX_ANA_CHANS 4 /* Maximum number of channels for DirAC analysis */
+#define DIRAC_MAX_TRANS_CHANS 8 /* Maximum number of transport channels for DirAC */
+
+#define DIRAC_MIN_BITRATE_8_TRANS_CHAN IVAS_384k
+#define DIRAC_MIN_BITRATE_6_TRANS_CHAN IVAS_256k
+#define DIRAC_MIN_BITRATE_4_TRANS_CHAN IVAS_160k /* minimum bitrate for sending 4 transport channels (FOA) */
+#define DIRAC_MIN_BITRATE_2_TRANS_CHAN IVAS_48k /* minimum bitrate for sending 2 transport channels (Stereo) */
+
+#define DIRAC_NUM_DIMS 3 /* number of directions to estimate (X,Y,Z) */
+#define DIRAC_MAX_NBANDS 12 /* Maximum number of frequency bands for the DirAC Side Parameter decoding */
+#define DIRAC_LOW_BANDRES_STEP 2 /* always combine two bands for low band resolution in the DirAC parameter coding */
+#define DIRAC_NO_COL_AVG_DIFF 32 /* Number of slots for averaging intensity vector for diffuseness computation */
+#define DIRAC_DIFFUSE_LEVELS 8 /* Size of the diffuseness alphabet (constant value) */
+#define DIRAC_DITH_SEED 29680
+#define DIRAC_MAX_BITS 512 /* Maximum number of bits for DirAC side information per frame */
+#define MAX_NUM_ENC_CLDFB_INSTANCES 8 /* Maximum Cldfb instances in DirAC encoder */
+#define DIRAC_NO_COL_AVG_DIFF_NS 40000000L
+#define DIRAC_NO_FB_BANDS_MAX MDFT_FB_BANDS_240
+#define DELAY_DIRAC_ENC_CMP_NS_PARAM_ISM ( IVAS_ENC_DELAY_NS + IVAS_DEC_DELAY_NS ) /* == 12 ms */
+
+
+/* DirAC renderer setup */
+typedef enum
+{
+ DIRAC_SYNTHESIS_INVALID,
+ DIRAC_SYNTHESIS_PSD_LS, /* PSD renderer in loudspeakers domain */
+ DIRAC_SYNTHESIS_GAIN_SHD, /* Gain renderer in Spherical Harmonic Domain*/
+ DIRAC_SYNTHESIS_PSD_SHD, /* PSD renderer in Spherical Harmonic Domain*/
+ DIRAC_SYNTHESIS_MONO,
+ DIRAC_SYNTHESIS_COV_MC_LS
+} DIRAC_SYNTHESIS_CONFIG;
+
+/* DirAC renderer panning setup */
+typedef enum
+{
+ DIRAC_PANNING_INVALID,
+ DIRAC_PANNING_HOA3, /* HOA3 */
+ DIRAC_PANNING_VBAP /* VBAP */
+} DIRAC_PANNING_CONFIG;
+
+#define DIRAC_DIFF_NUM_AMBI_COMP 4
+#define DIRAC_HOA_RENDERING_NUM_VIRT_DECORR_LS 8
+#define DIRAC_GAIN_LIMIT 31.622776601683793f /* 30db gain limitiation */
+#define DIRAC_MAX_NUM_DECORR_FILTERS 22
+#define DIRAC_MAX_DECORR_FILTER_LEN 20
+#define DIRAC_DECORR_NUM_SPLIT_BANDS 3
+#define DIRAC_DECORR_FILTER_LEN_1 15
+#define DIRAC_DECORR_FILTER_LEN_2 6
+#define DIRAC_DECORR_FILTER_LEN_3 3
+#define DIRAC_ONSET_ALPHA 0.95f
+#define DIRAC_ONSET_BETA 0.995f
+#define DIRAC_ONSET_GAIN 4.0f
+
+#define DELAY_DIRAC_ENC_CMP_NS 9500000L /* Delay to be compensated on DirAC encoder */
+#define DELAY_DIRAC_SPAR_ENC_CMP_NS 500000L /* here we may set the 24 samples (at 48 kHz) additional delay to something else, leave as is for now*/
+#define DELAY_DIRAC_PARAM_DEC_SFR 2 /* Delay to be compensation for DirAC parameters in the decoder (subframes) */
+
+#define DIRAC_SLOT_NS 1250000L /* time duration of a time slot, 1.25ms (==DELAY_RENERER_NS/MAX_PARAM_SPATIAL_SUBFRAMES) */
+#define DIRAC_SLOT_ENC_NS 5000000L
+
+typedef enum
+{
+ DIRAC_OPEN, /* initialize to default value */
+ DIRAC_RECONFIGURE /* HOA3 */
+} DIRAC_CONFIG_FLAG;
+
+
+/*----------------------------------------------------------------------------------*
+ * SPAR constants
+ *----------------------------------------------------------------------------------*/
+
+#define SPAR_CONFIG_BW FB
+
+#define IVAS_SPAR_MAX_CH (2*IVAS_MAX_SBA_ORDER + 2) /* FOA + planar HOA */
+
+#define IVAS_SPAR_P_LOWERTRI ((IVAS_SPAR_MAX_CH - 1) * (IVAS_SPAR_MAX_CH - 2)) >> 1
+#define IVAS_SPAR_MAX_C_COEFF (IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS) * ( IVAS_SPAR_MAX_DMX_CHS - 1)
+
+#define IVAS_SPAR_HOA3_NP_CHS 8 /* number of higher order non-planar channels */
+
+#define SPAR_NUM_CODING_STRAT_BITS ( 3 )
+
+/* AGC constants */
+#define AGC_BITS_PER_CH 3
+#define AGC_EMAX 0
+
+/* Common SPAR metadata constants */
+#define IVAS_ACTIVEW_DM_F_SCALE 0.5f
+#define IVAS_ACTIVEW_DM_F_SCALE_DTX 0.25f
+#define IVAS_SPAR_FOA_DFLT_FREQ_PER_CHAN 24000
+
+#define MAX_QUANT_STRATS 3
+#define MAX_CODING_STRATS 3
+#define IVAS_NUM_PROB_MODELS 4
+#define IVAS_MAX_INPUT_LEN ( IVAS_MAX_NUM_BANDS * ( IVAS_SPAR_P_LOWERTRI ) )
+#define IVAS_MAX_QUANT_LEVELS 32
+#define BRATE_SPAR_Q_STRAT IVAS_256k
+
+#define SPAR_SID_BITS_TAR_PER_BAND 18
+
+#ifndef FIX_SBA_CLEAN_UP_OPT
+typedef enum
+{
+ WYXZ = 0,
+ WY = 0,
+ WX,
+ WZ,
+ WYiX,
+} ivas_spar_foa_pmx_strings_t;
+#else
+typedef enum
+{
+ WYXZ = 0,
+ WY = 0,
+ WX,
+ WZ,
+ WYiX,
+} ivas_spar_pmx_strings_t;
+#endif
+
+#define NUM_MD_Q_COEFS_SET 4
+
+#define IVAS_RED_BAND_FACT 2
+
+typedef enum
+{
+ PRED_COEFF = 0,
+ DRCT_COEFF,
+ DECD_COEFF,
+ DECX_COEFF
+} ivas_coeffs_type_t;
+
+#define IVAS_SPAR_BR_TABLE_LEN 18
+
+/* TD decorr */
+enum
+{
+ IVAS_TD_DECORR_OUT_1CH = 1,
+ IVAS_TD_DECORR_OUT_2CH,
+ IVAS_TD_DECORR_OUT_3CH,
+ IVAS_TD_DECORR_OUT_4CH,
+ IVAS_TD_DECORR_OUT_5CH,
+ IVAS_TD_DECORR_OUT_6CH,
+ IVAS_TD_DECORR_OUT_7CH,
+ IVAS_TD_DECORR_OUT_8CH,
+ IVAS_TD_DECORR_OUT_9CH,
+ IVAS_TD_DECORR_OUT_10CH,
+ IVAS_TD_DECORR_OUT_11CH,
+ IVAS_TD_DECORR_OUT_12CH,
+ IVAS_TD_DECORR_OUT_13CH,
+ IVAS_TD_DECORR_OUT_14CH,
+ IVAS_TD_DECORR_OUT_15CH,
+ IVAS_TD_DECORR_OUT_16CH
+};
+
+#define IVAS_SPAR_MAX_DMX_CHS 4
+#define IVAS_MAX_DECORR_CHS IVAS_TD_DECORR_OUT_15CH
+#define IVAS_MAX_DECORR_APD_SECTIONS 16
+#define IVAS_APD_2_SECT 2
+#define IVAS_APD_4_SECT 4
+#define IVAS_APD_8_SECT 8
+#define IVAS_APD_16_SECT 16
+
+#define IVAS_DECORR_PARM_LOOKAHEAD_TAU 2e-3f
+#define IVAS_DECORR_PARM_APD_TAU 20e-3f
+
+/* IVAS PCA */
+#define IVAS_PCA_NB_SUBR 20 /* 80 -> 0.25 ms, 40 -> 0.5 ms... */
+#define IVAS_PCA_COV_THRES 1e-9f
+#define IVAS_PCA_QUAT_EPS 1e-7f
+#define IVAS_PCA_QBITS 19
+#define IVAS_PCA_N1 91
+#define IVAS_PCA_N1_EQ ( (IVAS_PCA_N1-1)/2 )
+#define IVAS_PCA_BIT_LEN ( 1 + ( IVAS_PCA_QBITS - 1 + IVAS_PCA_QBITS ) )
+#define IVAS_PCA_INTERP 4 /* 4D (Quaternion) dimension */
+#define IVAS_PCA_N_SLOTS 40 //20
+#define IVAS_PCA_LEN_INTERP_Q ( IVAS_PCA_INTERP * IVAS_PCA_N_SLOTS )
+#define IVAS_PCA_DELAY_CMP 24 // 12
+#define IVAS_PCA_LEN_INTERP_EIG_DEC ( (IVAS_PCA_N_SLOTS+IVAS_PCA_DELAY_CMP)*16)
+#define IVAS_PCA_THRES_MIN_DOT 0.8f
+#define IVAS_PCA_THRES_MIN_DOT2 0.0f
+#define IVAS_PCA_THRES_DIST_ALT 6.0f
+
+typedef enum
+{
+ PCA_MODE_ACTIVE = 0,
+ PCA_MODE_INACTIVE = 1
+} ivas_pca_bypass_mode;
+
+#ifdef FIX_SBA_CLEAN_UP_OPT
+enum
+{
+ PRED_Q_1 = 0,
+ PRED_Q_7,
+ PRED_Q_15,
+ PRED_Q_21,
+ PRED_Q_31,
+ PRED_Q_7_ACTIVE_W,
+ TOTAL_PRED_QUANT_STRATS_HUFF = 5,
+ PRED_Q_15_ACTIVE_W,
+ PRED_Q_21_ACTIVE_W,
+ TOTAL_PRED_QUANT_STRATS_ARITH
+ };
+
+enum
+{
+ DRCT_Q_1 = 0,
+ DRCT_Q_7,
+ DRCT_Q_9,
+ DRCT_Q_11,
+ TOTAL_DRCT_QUANT_STRATS
+ };
+
+enum
+{
+ DECD_Q_1 = 0,
+ DECD_Q_3,
+ DECD_Q_5,
+ DECD_Q_7,
+ DECD_Q_9,
+ DECD_Q_11,
+ TOTAL_DECD_QUANT_STRATS
+ };
+#endif
+
+/*----------------------------------------------------------------------------------*
+ * MASA constants
+ *----------------------------------------------------------------------------------*/
+
+#define MAX_NO_THETA 19
+#define NO_THETA16_MAX 122 /* number of theta values for 16 bits */
+#define NO_SPHERICAL_GRIDS 11 /* number of spherical grid structures */
+
+#define MASA_FREQUENCY_BANDS 24
+#define MASA_MAXIMUM_CODING_SUBBANDS 24
+#define MASA_MAXIMUM_DIRECTIONS 2
+#define MASA_MAX_TRANSPORT_CHANNELS 2
+#define MASA_ENC_DELAY_SLOTS 7
+#define MASA_NUM_DEFINED_SUR_SPR_COH_ENE_BINS 5
+
+#define MASA_DELTA_AZI_DCT0 30
+#define MASA_DELTA_AZI_DCT 10
+
+#define MASA_TRANSP_BITS 1
+#define MASA_HEADER_BITS 2
+#define MASA_SUBFRAME_BITS 1
+#define MASA_LOWBITRATE_MODE_BITS 1
+#define MASA_FACTOR_CV_COH 6
+
+#define MASA_GR_ORD_EL 1
+#define MASA_GR_ORD_AZ 2
+
+#define MASA_DIRECTION_MAX_BITS 11
+#define MASA_NO_INDEX 32767
+#define MASA_BITS_ER 3
+#define MASA_MIN_BITS_TF 4
+#define MASA_LIMIT_2D 2
+#define MASA_NO_CV_COH 8
+#define MASA_NO_CV_COH1 5
+#define MASA_MAX_NO_CV_SUR_COH 8
+#define MASA_NO_CB_SUR_COH 7
+#define MASA_MIN_BITS_SURR_COH 12
+
+#define MASA_SUM_FREQ_RANGE_BINS 25 /* Constant for MASA transport signal type detection */
+#define MASA_HI_FREQ_START_BIN 14 /* Constant for MASA transport signal type detection */
+#define MASA_STEREO_INTERPOLATION_SLOTS 16 /* The number of slots to interpolate when changing MASA transport signal type */
+#define MASA_SUM_PROTO_START_BIN 7 /* Constant for Ambisonics rendering from MASA */
+
+#define QMETADATA_MAXBIT_REQ_MASA 900 /* max bit-bit/direction for avoiding requantization in MASA path */
+#define QMETADATA_MAXBIT_REQ_SBA 400 /* max bit-bit/direction for avoiding requantization in SBA path */
+#define MASA_COH_LIMIT_2IDX 144 /* limit for sum of values across components for having two joint indexes */
+#define QMETADATA_MAX_NO_DIRECTIONS 2
+#define MASA_MAX_BITS 1300 /* max. bit-budget for MASA metadata */
+#define LIMIT_ER_ELEVATION_ENC 4
+#define LIMIT_ER_SIMPLE_ENC 6
+#define LIMIT_USE_COMMON 3
+
+#define MASA_COHERENCE_TOLERANCE 0.1f
+#define MASA_COHERENCE_THRESHOLD 0.1f
+#define MASA_RATIO_TOLERANCE 0.1f
+#define MASA_RATIO_THRESHOLD 0.1f
+#define MASA_ANGLE_TOLERANCE 0.5f
+#define MASA_LIMIT_NO_BANDS_SUR_COH 8
+#define MINIMUM_BIT_BUDGET_NORMAL_META 100
+#define DIFF_DFRATIO_2BIT_LIMIT_IDX 3
+#define DIFF_DFRATIO_1BIT_LIMIT_IDX 6
+#define DIFF_EC_HUFF_BAND_LIMIT 8
+#define DIFF_EC_HUFF_GR0_LIMIT 8
+#define VAR_AZI_THRESH 25
+#define MASA_LIMIT_IDX_AVG_AZI 4
+
+#define MASA_NO_POINTS_EQUATOR 430
+#define MASA_NO_CIRCLES 121
+#define MASA_ASIN_OFFSET 0.0064471690266724975f
+#define MASA_NTOT2_FAC 32768.00566947353f
+#define MASA_ANGLE_AT_EQUATOR 0.012894427382667f
+#define MASA_ANGLE_AT_EQUATOR_DEG 0.738796268264740f
+#define MASA_INV_ANGLE_AT_EQUATOR_DEG 1.353553128183453f
+#define MASA_STEREO_MIN_BITRATE IVAS_24k4
+
+#define MASA_BIT_REDUCT_PARAM 10
+
+typedef enum
+{
+ MASA_STEREO_NOT_DEFINED,
+ MASA_STEREO_SPACED_MICS,
+ MASA_STEREO_DOWNMIX
+} MASA_TRANSPORT_SIGNAL_TYPE;
+
+
+/*----------------------------------------------------------------------------------*
+ * Multichannel format
+ *----------------------------------------------------------------------------------*/
+
+#define MC_LS_SETUP_BITS 3 /* number of bits for writing the MC LS configuration */
+#define LS_SETUP_CONVERSION_NUM_MAPPINGS 35 /* number of mappings for LS setup conversion */
+
+typedef enum
+{
+ MC_MODE_NONE,
+ MC_MODE_MCT,
+ MC_MODE_PARAMMC,
+ MC_MODE_MCMASA
+} MC_MODE;
+
+typedef enum
+{
+ MC_LS_SETUP_5_1,
+ MC_LS_SETUP_7_1,
+ MC_LS_SETUP_5_1_2,
+ MC_LS_SETUP_5_1_4,
+ MC_LS_SETUP_7_1_4,
+ MC_LS_SETUP_INVALID
+} MC_LS_SETUP;
+
+
+/*----------------------------------------------------------------------------------*
+ * McMASA constants
+ *----------------------------------------------------------------------------------*/
+
+#define MCMASA_SEPARATE_BRATE IVAS_64k /* minimum bitrate from which separated channel coding is supported */
+
+#define MCMASA_MAX_ANA_CHANS 11 /* Maximum number of channels currently used in analysis of multichannel formats */
+#define MCMASA_MONOBITRATIO 0.3f
+#define MCMASA_MONOBITRATIO_64k 0.25f
+#define MC_MASA_THR_ELEVATION 40
+
+#define MCMASA_LFE_QLOW -6.5f
+#define MCMASA_LFE_DELTA 1.0f
+#define MCMASA_LFE_1BIT_THRES 0.03f
+#define MCMASA_LFE_ALPHA 0.67f
+#define MCMASA_LFE_BETA 0.09f
+#define MCMASA_LFE_THETA 1.3f
+#define MCMASA_LFE_SYNTH_ALPHA 0.95f /* Smoothing coefficient for LFE synthesis */
+
+#define NUM_ELEVATED_SPEAKERS 4
+
+#define MCMASA_MIN_SPEAKERS_SEPARATE_CENTER 4
+
+/*----------------------------------------------------------------------------------*
+ * MCT constants
+ *----------------------------------------------------------------------------------*/
+
+#define LFE_CHANNEL 3
+
+#define MIN_LFE_NRG 0.5f
+#define MCT_MAX_CHANNELS MAX_TRANSPORT_CHANNELS
+#define MCT_MAX_BLOCKS ( MCT_MAX_CHANNELS / CPE_CHANNELS ) /* max. number of channel pairs (MCT_MAX_CHANNELS/2) within MCT*/
+
+#define MAX_NUM_DATA max( MCT_MAX_CHANNELS, 4 )
+
+#define NBBITS_MCT_RATIO 4
+#define BITRATE_MCT_RATIO_RANGE ( 1 << NBBITS_MCT_RATIO ) /* Range of the coded bitrate distribution ratio */
+
+#define LFE_BITS 180
+
+#define MCT_LFE_MAX_LINE 24
+#define MCT_NUM_BLOCK_DATA_BITS 4
+
+typedef enum
+{
+ MCT_CHAN_MODE_REGULAR,
+ MCT_CHAN_MODE_LFE,
+ MCT_CHAN_MODE_IGNORE
+} MCT_CHAN_MODE;
+
+
+/*----------------------------------------------------------------------------------*
+ * Parametric MC Constants
+ *----------------------------------------------------------------------------------*/
+
+typedef enum
+{
+ PARAM_MC_SYNTH_DIRECT, /* synthesis to the transport format */
+ PARAM_MC_SYNTH_LS_CONV_COV, /* loudspeaker format conversion in the covariance domain */
+ PARAM_MC_SYNTH_LS_CONV_CLDFB, /* loudspeaker format conversion in the CLDFB domain */
+ PARAM_MC_SYNTH_MONO_STEREO /* synthesis to mono or stereo */
+} PARAM_MC_SYNTHESIS_CONF;
+
+#define PARAM_MC_REG_SX (0.2f) /* Regularization factor for mixing matrix calculation */
+#define PARAM_MC_REG_GHAT (0.001f) /* Regularization factor for mixing matrix calculation */
+#define PARAM_MC_MAX_PARAMETER_BANDS 20 /* Maximum number of parameter bands */
+#define PARAM_MC_MAX_PARAMETER_BANDS_RES 14 /* Maximum number of parameter bands with decorrelation */
+#define PARAM_MC_MAX_NSLOTS 16 /* Maximum number of CLDFB slots in a frame */
+#define PARAM_MC_MAX_NSLOTS_IN_SUBFRAME 4 /* Maximum number of CLDFB slots in a subframe */
+#define PARAM_MC_NSUBFRAMES_DEC 4 /* Number of subframes for the synthesis in the decoder */
+#define PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND 30 /* Maximum number of CLDFB frequency bands within a parameter band */
+#define PARAM_MC_PARAMETER_FRAMES 2 /* Number of frames a parameter set for a parameter band is used*/
+#define PARAM_MC_ICC_ERROR_BIAS_FAC (1.15f) /* factor for favouring past ICC maps in the adaptive ICC map decision */
+#define PARAM_MC_TRANSIENT_BAND_STEP 2 /* Number of parameter bands combined in case of a transient frame*/
+#define PARAM_MC_MAX_DECORR_CLDFB_BANDS 20 /* Maximum number of CLDFB bands with decorrelation */
+#define PARAM_MC_MAX_TRANSPORT_CHANS 4 /* Number of down mix channels */
+#define PARAM_MC_MAX_ILD_REF_CHANNELS 2 /* Maximum number of reference channels for a coded ILD */
+#define PARAM_MC_NUM_CONFIGS 15 /* Number of available Parametric MC configurations */
+#define PARAM_MC_MAX_BAND_LFE 1 /* Number of parameter bands for LFE coding */
+#define PARAM_MC_SZ_ICC_MAP 11 /* Maximum number of transmitted ICCs per parameter band */
+#define PARAM_MC_SZ_ILD_MAP 12 /* Maximum number of transmitted channel energies per band*/
+#define PARAM_MC_MAX_VAL_MAP_SIZE 12 /* Maximum number of transmitted parameters per band */
+#define PARAM_MC_RANGE_CODER_TOT_SHIFT 16 /* resolution of the range coder frequency tables */
+#define PARAM_MC_SZ_ICC_QUANTIZER 8 /* Length of the ICC quantizer for Parametric MC */
+#define PARAM_MC_NUM_BITS_ICC_SCALAR_QUANT 3 /* Number of bits for ICC uniform coding */
+#define PARAM_MC_SZ_ILD_QUANTIZER_4BITS 16 /* Length of the ILD quantizer for Parametric MC */
+#define PARAM_MC_NUM_BITS_ILD_SCALAR_QUANT 4 /* Number of bits for ILD uniform coding */
+#define PARAM_MC_DEFAULT_MIN_ILD (-92.0f) /* Default relative channel level for untransmitted channel energies */
+#define PARAM_MC_MAX_BITS 1024 /* Maximum number of bits for the Parametric MC metadata */
+#define PARAM_MC_MAX_BAND_ABS_COV_ENC 10
+#define PARAM_MC_MAX_PARAM_BAND_ABS_COV_ENC 10
+#define PARAM_MC_MAX_BAND_ABS_COV_DEC 10
+#define PARAM_MC_ENER_LIMIT_INTRAFRAME (1.5f)
+#define PARAM_MC_ENER_LIMIT_INTERFRAME (2.0f)
+#define PARAM_MC_LFE_ON_THRESH (8000.0f)
+#define PARAM_MC_BAND_TO_MDCT_BAND_RATIO 16 /* Ratio of resolution of CLDFB Bands to MDCT Bands */
+#define PARAM_MC_SLOT_ENC_NS 2500000L
+#define PARAM_MC_MDFT_NO_SLOTS 8
+
+/*----------------------------------------------------------------------------------*
+ * LFE Coding Constants
+ *----------------------------------------------------------------------------------*/
+
+#define IVAS_LFE_ID_BITS 1
+
+typedef enum
+{
+ IVAS_FILTER_STAGE_0,
+ IVAS_FILTER_STAGE_1,
+ IVAS_FILTER_MAX_STAGES /* this becomes array len while declaring the array */
+} LFE_FILTERS_STAGES;
+
+/* IIR filter orders */
+typedef enum
+{
+ IVAS_FILTER_ORDER_1 = 1,
+ IVAS_FILTER_ORDER_2 = 2,
+ IVAS_FILTER_ORDER_4 = 4,
+} ivas_filter_order;
+
+#define IVAS_BIQUAD_FILT_LEN 3
+#define IVAS_LFE_FADE_LEN_48K 384
+#define IVAS_LFE_FADE_LEN_32K 256
+#define IVAS_LFE_FADE_LEN_16K 128
+#define IVAS_LFE_FADE_LEN_8K 64
+#define IVAS_LFE_SHIFTS_PER_DOUBLE 4
+#define IVAS_LFE_NUM_COEFFS_IN_SUBGRP 2
+#define IVAS_LFE_MAX_NUM_DCT_PASS_BINS 8
+#define IVAS_LFE_MAX_NUM_DCT_COEFFS (IVAS_LFE_MAX_NUM_DCT_PASS_BINS * IVAS_LFE_NUM_COEFFS_IN_SUBGRP)
+#ifdef SBA_CLEANING
+#define IVAS_LFE_FADE_NS 8000000L /* 8.0 ms */
+#else
+#define IVAS_LFE_FADE_LEN_SEC_FLOAT ((float)0.008)
+#endif
+#define IVAS_MAX_NUM_QUANT_STRATS 2
+#define IVAS_MAX_NUM_DCT_COEF_GROUPS 4
+#define IVAS_LFE_SHIFT_BITS 5
+#define IVAS_LFE_BITRATE_5000 5000
+#define IVAS_LFE_ABS_SUM_FLT_THR (0.000001f)
+#define IVAS_ZERO_PAD_LEN_MULT_FAC (0.5f)
+
+/* LFE PLC */
+#define LFE_PLC_BUFLEN 240
+#define LFE_PLC_FS 1600
+#define L_FRAME_1k6 ( 20 * LFE_PLC_FS / 1000 )
+#define LFE_PLC_LENANA LFE_PLC_BUFLEN
+#define LFE_PLC_FDEL 300
+
+
+/*----------------------------------------------------------------------------------*
+ * Amplitude Panning (EFAP, VBAP) constants
+ *----------------------------------------------------------------------------------*/
+
+#define PANNING_AZI_RESOLUTION 2
+#define PANNING_ELE_RESOLUTION 5
+
+#define EFAP_MAX_CHAN_NUM 5 /* Maximum number of channels that constitute a polygon, 4 or 5 */
+#define EFAP_MAX_POLY_SET 70 /* Upper bound on number of polygons; with a Speaker setup of 26.0, we obtain 54 polygons/triangles in the matlab implementation. */
+
+#define EFAP_MODE_EFAP 0 /* EFAP Panning */
+#define EFAP_MODE_EFIP 1 /* EFIP Panning */
+
+typedef enum
+{
+ EFAP_DMX_NONE,
+ EFAP_DMX_AMPLITUDE,
+ EFAP_DMX_INTENSITY
+} EFAP_VTX_DMX_TYPE;
+
+#define VBAP_NUM_SEARCH_SECTORS 4
+
+/*----------------------------------------------------------------------------------*
+ * Binaural Rendering Constants
+ *----------------------------------------------------------------------------------*/
+
+#define BINAURAL_MAXBANDS 60 /* Max number of bands */
+#define BINAURAL_CONVBANDS 50 /* Bands upto which convolution is performed */
+#define BINAURAL_NTAPS_MAX 96
+
+#define HRTF_SH_ORDER 3
+#define HRTF_SH_CHANNELS 16
+#define HRTF_NUM_BINS 60
+#define REVERB_PREDELAY_MAX 20 /* Max input delay for reverb module */
+#define GAIN_LFE 1.88364911f /* Gain applied to LFE during renderering */
+#define LOW_BIT_RATE_BINAURAL_EQ_BINS 17 /* Number of bins in an EQ applied at low bit rates in binauralization */
+#define LOW_BIT_RATE_BINAURAL_EQ_OFFSET 14 /* Offset of bins where the low-bit-rate EQ starts*/
+
+#define BINAURAL_COHERENCE_DIFFERENCE_BINS 9 /* Number of bins for direction-dependent diffuse-field binaural coherence */
+
+
+/*----------------------------------------------------------------------------------*
+ * TD Binaural Object renderer
+ *----------------------------------------------------------------------------------*/
+
+#define MAX_NUM_TDREND_CHANNELS 11 /* max. number of channels in TD renderer (objects or loudspeaker channels) */
+
+#define SFX_SPAT_BIN_MAX_NO_OF_OUTPUT_SAMPLES 288 /* 288 = 6 msec @ 48 kHz. */
+#define HRTF_MODEL_N_SECTIONS 3 /* No. sections used in approximate evaluation of model */
+#define HRTF_MODEL_BSPLINE_NUM_COEFFS 4 /* No. BSpline coefficients, including zeroth order e.g. cubic -> 4 */
+#define HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ 16 /* Square of HRTF_MODEL_BSPLINE_NUM_COEFFS */
+#define SFX_SPAT_BIN_MAX_FILTER_LENGTH 256
+
+#define SPAT_BIN_MAX_INPUT_CHANNELS 1 /* Max number of input channels per source/object. Mono for now, but stereo objects may be considered. */
+
+#define BINAURAL_TD_LATENCY_S 0.00675f /* Binaural TD renderer latency in second == 324 samples in between 333 and 315 */
+
+/* ----- Enums - TD Renderer ----- */
+
+typedef enum
+{
+ TDREND_DIST_ATTEN_MODEL_INV_DIST,
+ TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED
+} TDREND_DistAttenModel_t;
+
+typedef enum
+{
+ TDREND_POSTYPE_ABSOLUTE, /* The source position is in absolute coordinates */
+ TDREND_POSTYPE_RELATIVE_TO_LISTENER /* The source position is relative to the listener */
+} TDREND_PosType_t;
+
+typedef enum
+{
+ TDREND_PLAYSTATUS_INITIAL,
+ TDREND_PLAYSTATUS_PLAYING
+} TDREND_PlayStatus_t;
+
+typedef enum
+{
+ TDREND_DeallocIndex_None,
+ TDREND_DeallocIndex_Signal,
+ TDREND_DeallocIndex_Source
+} TDREND_DeallocFnIndex;
+
+typedef enum
+{
+ TDREND_HRFILT_Method_BSplineModel
+#ifdef TDREND_HRTF_TABLE_METHODS
+ ,
+ TDREND_HRFILT_Method_Table_F,
+ TDREND_HRFILT_Method_Table_S
+#endif
+} TDREND_HRFILT_Method_t;
+
+typedef enum
+{
+ SFX_ON,
+ SFX_TRANSIENT,
+ SFX_OFF
+} SFX_OpMode_t;
+
+
+/*----------------------------------------------------------------------------------*
+ * Crend constants
+ *----------------------------------------------------------------------------------*/
+
+#define IVAS_REV_MAX_NR_BRANCHES 8 /* setup is for maximum */
+
+#define IVAS_REV_MAX_IIR_FILTER_LENGTH 4 /* maximum nr of taps - MUST BE EVEN! */
+
+#define RV_FILTER_MAX_FFT_SIZE ( 512 )
+#define RV_FILTER_MAX_HISTORY ( 512 - 160 ) /* for longest history */
+
+#define RV_LENGTH_NR_FC ( RV_FILTER_MAX_FFT_SIZE / 2 ) + 1
+
+
+/* Orientation tracking types */
+#define IVAS_ORIENT_TRK_REF 0
+#define IVAS_ORIENT_TRK_AVG 1
+
+typedef enum
+{
+ OTR_TRACKING_NONE = IVAS_ORIENT_TRK_REF-1, /* track orientation relative to external reference orientation (default: yaw=pitch=roll=0) */
+ OTR_TRACKING_REF_ORIENT = IVAS_ORIENT_TRK_REF, /* track orientation relative to external reference orientation (default: yaw=pitch=roll=0) */
+ OTR_TRACKING_AVG_ORIENT = IVAS_ORIENT_TRK_AVG /* track orientation relative to average orientation */
+} OTR_TRACKING_T;
+
+
+
+/*----------------------------------------------------------------------------------*
+ * Reverberator constants
+ *----------------------------------------------------------------------------------*/
+
+#define IVAS_REVERB_DEFAULT_N_BANDS 31
+#define IVAS_REVERB_DEFAULT_PRE_DELAY 0.016f
+#define IVAS_REVERB_DEFAULT_INPUT_DELAY 0.1f
+
+
+/*----------------------------------------------------------------------------------*
+ * FB mixer constants
+ *----------------------------------------------------------------------------------*/
+
+#define IVAS_ONE_BY_960 0.001041666666666666f
+#define IVAS_ONE_BY_640 0.0015625f
+#define IVAS_ONE_BY_320 0.003125f
+#define IVAS_ONE_BY_240 0.004166666666666667f
+#define IVAS_ONE_BY_160 0.00625f
+#define IVAS_ONE_BY_80 0.0125f
+
+#define IVAS_960_PT_LEN 960
+#define IVAS_640_PT_LEN 640
+#define IVAS_480_PT_LEN 480
+#define IVAS_320_PT_LEN 320
+#define IVAS_240_PT_LEN 240
+#define IVAS_160_PT_LEN 160
+#define IVAS_80_PT_LEN 80
+#define IVAS_40_PT_LEN 40
+
+#define IVAS_NUM_SUPPORTED_FS 3
+
+/* FB windows ovlp */
+#define IVAS_FB_4MS_48K_SAMP 192
+#define IVAS_FB_1MS_48K_SAMP 48
+#define IVAS_FB_4MS_32K_SAMP 128
+#define IVAS_FB_1MS_32K_SAMP 32
+#define IVAS_FB_4MS_16K_SAMP 64
+#define IVAS_FB_1MS_16K_SAMP 16
+
+#define IVAS_MAX_FB_MIXER_OUT_CH IVAS_SPAR_MAX_CH
+#define IVAS_MAX_SPAR_FB_MIXER_IN_CH IVAS_SPAR_MAX_CH
+#define IVAS_MAX_FB_MIXER_IN_CH MAX_CICP_CHANNELS
+
+#define MAX_NUM_BANDS_DIFF_NON48K 3
+
+#define IVAS_FB_12_1MS_48K_START_OFFSET_BAND_0 ( 0 )
+#define IVAS_FB_12_1MS_48K_START_OFFSET_BAND_1 ( 0 )
+#define IVAS_FB_12_1MS_48K_START_OFFSET_BAND_2 ( 0 )
+#define IVAS_FB_12_1MS_48K_START_OFFSET_BAND_3 ( 0 )
+#define IVAS_FB_12_1MS_48K_START_OFFSET_BAND_4 ( 0 )
+#define IVAS_FB_12_1MS_48K_START_OFFSET_BAND_5 ( 9 )
+#define IVAS_FB_12_1MS_48K_START_OFFSET_BAND_6 ( 7 )
+#define IVAS_FB_12_1MS_48K_START_OFFSET_BAND_7 ( 0 )
+#define IVAS_FB_12_1MS_48K_START_OFFSET_BAND_8 ( 0 )
+#define IVAS_FB_12_1MS_48K_START_OFFSET_BAND_9 ( 49 )
+#define IVAS_FB_12_1MS_48K_START_OFFSET_BAND_10 ( 172 )
+#define IVAS_FB_12_1MS_48K_START_OFFSET_BAND_11 ( 377 )
+
+#define IVAS_FB_12_1MS_48K_END_BINS_BAND_0 ( 179 )
+#define IVAS_FB_12_1MS_48K_END_BINS_BAND_1 ( 160 )
+#define IVAS_FB_12_1MS_48K_END_BINS_BAND_2 ( 215 )
+#define IVAS_FB_12_1MS_48K_END_BINS_BAND_3 ( 200 )
+#define IVAS_FB_12_1MS_48K_END_BINS_BAND_4 ( 186 )
+#define IVAS_FB_12_1MS_48K_END_BINS_BAND_5 ( 196 )
+#define IVAS_FB_12_1MS_48K_END_BINS_BAND_6 ( 230 )
+#define IVAS_FB_12_1MS_48K_END_BINS_BAND_7 ( 351 )
+#define IVAS_FB_12_1MS_48K_END_BINS_BAND_8 ( 456 )
+#define IVAS_FB_12_1MS_48K_END_BINS_BAND_9 ( 617 )
+#define IVAS_FB_12_1MS_48K_END_BINS_BAND_10 ( 892 )
+#define IVAS_FB_12_1MS_48K_END_BINS_BAND_11 ( 960 )
+
+#define IVAS_FB_12_1MS_32K_START_OFFSET_BAND_0 ( 0 )
+#define IVAS_FB_12_1MS_32K_START_OFFSET_BAND_1 ( 0 )
+#define IVAS_FB_12_1MS_32K_START_OFFSET_BAND_2 ( 0 )
+#define IVAS_FB_12_1MS_32K_START_OFFSET_BAND_3 ( 0 )
+#define IVAS_FB_12_1MS_32K_START_OFFSET_BAND_4 ( 0 )
+#define IVAS_FB_12_1MS_32K_START_OFFSET_BAND_5 ( 9 )
+#define IVAS_FB_12_1MS_32K_START_OFFSET_BAND_6 ( 7 )
+#define IVAS_FB_12_1MS_32K_START_OFFSET_BAND_7 ( 0 )
+#define IVAS_FB_12_1MS_32K_START_OFFSET_BAND_8 ( 0 )
+#define IVAS_FB_12_1MS_32K_START_OFFSET_BAND_9 ( 49 )
+#define IVAS_FB_12_1MS_32K_START_OFFSET_BAND_10 ( 172 )
+#define IVAS_FB_12_1MS_32K_START_OFFSET_BAND_11 ( 377 )
+
+#define IVAS_FB_12_1MS_32K_END_BINS_BAND_0 ( 179 )
+#define IVAS_FB_12_1MS_32K_END_BINS_BAND_1 ( 160 )
+#define IVAS_FB_12_1MS_32K_END_BINS_BAND_2 ( 215 )
+#define IVAS_FB_12_1MS_32K_END_BINS_BAND_3 ( 200 )
+#define IVAS_FB_12_1MS_32K_END_BINS_BAND_4 ( 186 )
+#define IVAS_FB_12_1MS_32K_END_BINS_BAND_5 ( 196 )
+#define IVAS_FB_12_1MS_32K_END_BINS_BAND_6 ( 230 )
+#define IVAS_FB_12_1MS_32K_END_BINS_BAND_7 ( 351 )
+#define IVAS_FB_12_1MS_32K_END_BINS_BAND_8 ( 456 )
+#define IVAS_FB_12_1MS_32K_END_BINS_BAND_9 ( 617 )
+#define IVAS_FB_12_1MS_32K_END_BINS_BAND_10 ( 640 )
+#define IVAS_FB_12_1MS_32K_END_BINS_BAND_11 ( 640 )
+
+#define IVAS_FB_12_1MS_16K_START_OFFSET_BAND_0 ( 0 )
+#define IVAS_FB_12_1MS_16K_START_OFFSET_BAND_1 ( 0 )
+#define IVAS_FB_12_1MS_16K_START_OFFSET_BAND_2 ( 0 )
+#define IVAS_FB_12_1MS_16K_START_OFFSET_BAND_3 ( 0 )
+#define IVAS_FB_12_1MS_16K_START_OFFSET_BAND_4 ( 0 )
+#define IVAS_FB_12_1MS_16K_START_OFFSET_BAND_5 ( 9 )
+#define IVAS_FB_12_1MS_16K_START_OFFSET_BAND_6 ( 7 )
+#define IVAS_FB_12_1MS_16K_START_OFFSET_BAND_7 ( 0 )
+#define IVAS_FB_12_1MS_16K_START_OFFSET_BAND_8 ( 0 )
+#define IVAS_FB_12_1MS_16K_START_OFFSET_BAND_9 ( 49 )
+#define IVAS_FB_12_1MS_16K_START_OFFSET_BAND_10 ( 172 )
+#define IVAS_FB_12_1MS_16K_START_OFFSET_BAND_11 ( 320 )
+
+#define IVAS_FB_12_1MS_16K_END_BINS_BAND_0 ( 179 )
+#define IVAS_FB_12_1MS_16K_END_BINS_BAND_1 ( 160 )
+#define IVAS_FB_12_1MS_16K_END_BINS_BAND_2 ( 215 )
+#define IVAS_FB_12_1MS_16K_END_BINS_BAND_3 ( 200 )
+#define IVAS_FB_12_1MS_16K_END_BINS_BAND_4 ( 186 )
+#define IVAS_FB_12_1MS_16K_END_BINS_BAND_5 ( 196 )
+#define IVAS_FB_12_1MS_16K_END_BINS_BAND_6 ( 230 )
+#define IVAS_FB_12_1MS_16K_END_BINS_BAND_7 ( 320 )
+#define IVAS_FB_12_1MS_16K_END_BINS_BAND_8 ( 320 )
+#define IVAS_FB_12_1MS_16K_END_BINS_BAND_9 ( 320 )
+#define IVAS_FB_12_1MS_16K_END_BINS_BAND_10 ( 320 )
+#define IVAS_FB_12_1MS_16K_END_BINS_BAND_11 ( 320 )
+
+#define IVAS_FB_BANDS_12 12
+#define IVAS_FB_BANDS_20 20
+#define IVAS_MAX_NUM_BANDS IVAS_FB_BANDS_12
+#define IVAS_MAX_NUM_FB_BANDS IVAS_FB_BANDS_20
+#define IVAS_FB_12_1MS_LEN ( IVAS_FB_12_1MS_48K_END_BINS_BAND_0 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_0 ) + ( IVAS_FB_12_1MS_48K_END_BINS_BAND_1 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_1 ) + ( IVAS_FB_12_1MS_48K_END_BINS_BAND_2 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_2 ) + ( IVAS_FB_12_1MS_48K_END_BINS_BAND_3 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_3 ) + ( IVAS_FB_12_1MS_48K_END_BINS_BAND_4 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_4 ) + ( IVAS_FB_12_1MS_48K_END_BINS_BAND_5 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_5 ) + ( IVAS_FB_12_1MS_48K_END_BINS_BAND_6 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_6 ) + ( IVAS_FB_12_1MS_48K_END_BINS_BAND_7 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_7 ) + ( IVAS_FB_12_1MS_48K_END_BINS_BAND_8 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_8 ) + ( IVAS_FB_12_1MS_48K_END_BINS_BAND_9 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_9 ) + ( IVAS_FB_12_1MS_48K_END_BINS_BAND_10 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_10 ) + ( IVAS_FB_12_1MS_48K_END_BINS_BAND_11 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_11 )
+#define IVAS_16K_12BANDS_ACTIVE_BANDS 10
+
+#define SPAR_DIRAC_SPLIT_START_BAND 8
+#define SPAR_DTX_BANDS 2
+#define DIRAC_DTX_BANDS 2
+#define SPAR_DIRAC_DTX_BANDS ( SPAR_DTX_BANDS + DIRAC_DTX_BANDS )
+#define CLDFB_PAR_WEIGHT_START_BAND 7
+
+#endif
+/* clang-format on */
+/* IVAS_CNST_H */
diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h
new file mode 100644
index 0000000000000000000000000000000000000000..58c45ee5ee0752f962207c834494e6d2070ba3aa
--- /dev/null
+++ b/lib_com/ivas_error.h
@@ -0,0 +1,167 @@
+/******************************************************************************************************
+
+ (C) 2022 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.
+
+*******************************************************************************************************/
+
+/*====================================================================================
+ EVS Codec 3GPP TS26.443 Nov 04, 2021. Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0
+ ====================================================================================*/
+
+/* options.h needed for debugging/development features
+ * It should be stripped for delivery along with debugging switches */
+#include "options.h"
+
+#ifndef IVAS_ERROR_H
+#define IVAS_ERROR_H
+
+typedef enum
+{
+ /*----------------------------------------*
+ * no error *
+ *----------------------------------------*/
+ IVAS_ERR_OK = 0x0000,
+
+ /*----------------------------------------*
+ * API errors *
+ *----------------------------------------*/
+ IVAS_ERR_INVALID_BANDWIDTH = 0x1000,
+ IVAS_ERR_INVALID_DTX_UPDATE_RATE,
+ IVAS_ERR_INVALID_SAMPLING_RATE,
+ IVAS_ERR_NOT_CONFIGURED,
+ IVAS_ERR_INVALID_STEREO_MODE,
+ IVAS_ERR_INVALID_CICP_INDEX,
+ IVAS_ERR_INVALID_BITRATE,
+ IVAS_ERR_INVALID_MASA_CONFIG,
+ IVAS_ERR_TOO_MANY_OBJECT_INPUTS,
+ IVAS_ERR_INDEX_OUT_OF_BOUNDS,
+ IVAS_ERR_RECONFIGURE_NOT_SUPPORTED,
+ IVAS_ERR_INVALID_FEC_CONFIG,
+ IVAS_ERR_INVALID_FEC_OFFSET,
+ IVAS_ERR_INVALID_INPUT_BUFFER_SIZE,
+ IVAS_ERR_DTX_NOT_SUPPORTED,
+ IVAS_ERR_UNEXPECTED_NULL_POINTER,
+ IVAS_ERR_METADATA_NOT_EXPECTED,
+ IVAS_ERR_INVALID_SPAR_CONFIG,
+ IVAS_ERR_WRONG_PARAMS,
+ IVAS_ERR_INIT_ERROR,
+ IVAS_ERR_DECODER_ERROR,
+ IVAS_ERR_WRONG_MODE,
+ IVAS_ERR_INVALID_OUTPUT_FORMAT,
+ IVAS_ERR_HEAD_ROTATION_NOT_SUPPORTED,
+ IVAS_ERR_INVALID_HRTF,
+ IVAS_ERR_INVALID_INPUT_FORMAT,
+ IVAS_ERR_INVALID_INDEX,
+ IVAS_ERR_NOT_SUPPORTED_OPTION,
+ IVAS_ERR_NOT_IMPLEMENTED,
+#ifdef DEBUGGING
+ IVAS_ERR_INVALID_FORCE_MODE,
+#endif
+ IVAS_ERR_FILE_READER_TIMESTAMP_MISMATCH,
+ IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT,
+ IVAS_ERR_INVALID_MASA_FORMAT_METADATA_FILE,
+
+ /*----------------------------------------*
+ * input data errors *
+ *----------------------------------------*/
+ IVAS_ERR_INVALID_BITSTREAM = 0x2000,
+
+ /*----------------------------------------*
+ * hardware errors *
+ *----------------------------------------*/
+ IVAS_ERR_FAILED_ALLOC = 0x3000,
+
+ /*----------------------------------------*
+ * internal errors *
+ *----------------------------------------*/
+ IVAS_ERR_INTERNAL = 0x4000,
+ IVAS_ERR_INTERNAL_FATAL,
+
+ /*----------------------------------------*
+ * file I/O errors (lib_util only) *
+ *----------------------------------------*/
+ IVAS_ERR_FAILED_FILE_OPEN = 0x5000,
+ IVAS_ERR_FAILED_FILE_WRITE,
+ IVAS_ERR_FAILED_FILE_READ,
+ IVAS_ERR_FAILED_FILE_PARSE,
+ IVAS_ERR_END_OF_FILE,
+ IVAS_ERR_BITSTREAM_WRITER_INVALID_FORMAT,
+ IVAS_ERR_BITSTREAM_READER_INVALID_DATA,
+ IVAS_ERR_BITSTREAM_READER_INVALID_FORMAT,
+
+ /*----------------------------------------*
+ * unknown error *
+ *----------------------------------------*/
+ IVAS_ERR_UNKNOWN = 0xF000, /* fallback error code */
+
+} ivas_error;
+
+
+static inline const char *ivas_error_to_string( ivas_error error_code )
+{
+ /* For error categories that are likely to still have many changes to
+ * specific error codes, return one string per category */
+ if ( ( error_code & 0xF000 ) == 0x1000 )
+ {
+ return "API error";
+ }
+ if ( ( error_code & 0xF000 ) == 0x2000 )
+ {
+ return "data error";
+ }
+
+ /* For categories that are unlikely to change, use more specific strings */
+ switch ( error_code )
+ {
+ case IVAS_ERR_OK:
+ return "No error";
+ case IVAS_ERR_FAILED_ALLOC:
+ return "Failed allocation error";
+ case IVAS_ERR_INTERNAL:
+ return "Internal error";
+ case IVAS_ERR_INTERNAL_FATAL:
+ return "Internal fatal error";
+ case IVAS_ERR_FAILED_FILE_OPEN:
+ return "File open error";
+ case IVAS_ERR_FAILED_FILE_WRITE:
+ return "File write error";
+ case IVAS_ERR_FAILED_FILE_READ:
+ return "File read error";
+ case IVAS_ERR_FAILED_FILE_PARSE:
+ return "Parse error";
+ case IVAS_ERR_END_OF_FILE:
+ return "End of file";
+ default:
+ break;
+ }
+
+ return "Unknown error";
+}
+
+#endif /* IVAS_ERROR_H */
diff --git a/lib_com/ivas_error_utils.h b/lib_com/ivas_error_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..412bd075b49c3e7fd575c905e636462345b3bc74
--- /dev/null
+++ b/lib_com/ivas_error_utils.h
@@ -0,0 +1,96 @@
+/******************************************************************************************************
+
+ (C) 2022 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 "options.h"
+
+#include
+#include
+#include
+
+#include "ivas_error.h"
+
+#ifdef DEBUGGING
+#include
+#endif
+
+#ifndef IVAS_ERROR_UTILS_H
+#define IVAS_ERROR_UTILS_H
+
+/*
+ * Usage:
+ *
+ * IVAS_ERROR( error_code, decription_fmt, ... );
+ *
+ * where:
+ * - error_code is of type enum ivas_error
+ * - decription_fmt is a description string with printf-like formatting
+ * - ... are (optional) printf-like arguments to place in the description format string
+ *
+ * Examples:
+ *
+ * IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for XXX" );
+ *
+ * IVAS_ERROR( IVAS_ERR_INTERNAL, "Unexpected value %f in frame %d", var, frame );
+ *
+ * Note: Contrary to printf, this macro is not able to verify at build time that the
+ * placeholders (e.g. "%f") in the format string match the types of provided arguments.
+ * If unexpected values are printed or the macro causes a crash, double check that the
+ * format specifiers are correct.
+ */
+#ifdef DEBUGGING
+#define IVAS_ERROR( error_code, ... ) ivas_error_wrapper( error_code, __func__, __FILE__, __LINE__, __VA_ARGS__ )
+#else
+#define IVAS_ERROR( error_code, ... ) ivas_error_wrapper( error_code )
+#endif
+
+#ifdef DEBUGGING
+static inline ivas_error ivas_error_wrapper( const ivas_error error_code, const char *function, const char *file, int32_t line, const char *description, ... )
+{
+ fprintf( stderr, "\n%s: ", ivas_error_to_string( error_code ) );
+
+ va_list args;
+ va_start( args, description );
+ vfprintf( stderr, description, args );
+ va_end( args );
+
+ fprintf( stderr, "\n\nIn function: %s(), %s:%d\n\n", function, file, line );
+ // assert( 0 );
+ return error_code;
+}
+#else
+static inline ivas_error ivas_error_wrapper( const ivas_error error_code )
+{
+ return error_code;
+}
+#endif
+
+#endif /* IVAS_ERROR_UTILS_H */
diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c
new file mode 100644
index 0000000000000000000000000000000000000000..f2c7da8ee7fd89422e08181ae9f11d8c48a6a28c
--- /dev/null
+++ b/lib_com/ivas_rom_com.c
@@ -0,0 +1,10568 @@
+/******************************************************************************************************
+
+ (C) 2022 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 "options.h"
+#ifdef DEBUGGING
+#include "debug.h"
+#endif
+#include
+#include "cnst_fx.h"
+#include "ivas_cnst.h"
+#include "ivas_rom_com.h"
+#include "wmops.h"
+
+/* clang-format off */
+
+/*----------------------------------------------------------------------------------*
+ * Table of IVAS bitrates
+ *----------------------------------------------------------------------------------*/
+
+const int32_t ivas_brate_tbl[SIZE_IVAS_BRATE_TBL] =
+{
+ FRAME_NO_DATA, IVAS_SID_4k4, IVAS_SID_5k,
+ IVAS_13k2, IVAS_16k4, IVAS_24k4, IVAS_32k, IVAS_48k,
+ IVAS_64k, IVAS_80k, IVAS_96k, IVAS_128k, IVAS_160k,
+ IVAS_192k, IVAS_256k, IVAS_384k, IVAS_512k
+};
+
+const int16_t fast_FCB_bits_2sfr[] = { 8, 14, 18, 20, 24, 128/*stop value*/ };
+
+const int16_t fast_FCB_rates_2sfr[] = {/*16*50,*/ (8 + 14) * 50, 28 * 50, 32 * 50, 34 * 50, 36 * 50, 38 * 50, 40 * 50, 42 * 50, 44 * 50, 48 * 50 };
+
+#if 0
+/*-------------------------------------------------------------------------
+ * DFT Stereo ROM tables
+ *------------------------------------------------------------------------*/
+
+/*4xERB scale: max of 14 bands*/
+const int16_t dft_band_limits_erb4[STEREO_DFT_ERB4_BANDS] =
+{
+ 1, 3, 5, 10, 18, 26, 41, 56, 84, 132, 214, 342, 470, 601
+};
+
+/*8xERB scale: max of 8 bands*/
+const int16_t dft_band_limits_erb8[STEREO_DFT_ERB8_BANDS] =
+{
+ 1, 5, 18, 41, 84, 214, 470, 601
+};
+
+const float dft_res_cod_alpha[STEREO_DFT_BAND_MAX] =
+{
+ .8f, .8f, .5f, .5f, .3f, .3f, .2f, .2f
+};
+
+const int16_t dft_band_ipd[3][4] =
+{
+ {0,8,10,13},
+ {0,5,6,8},
+ {0,2,3,4}
+};
+
+const int16_t dft_band_res_cod[3][4] =
+{
+ {0,8,10,11},
+ {0,5,6,7},
+ {0,5,6,7}
+};
+
+const float dft_res_gains_q[][2] =
+{
+ /* quantization points for joint quantization of prediction gain and residual energy */
+
+ /* column 1 (|ILD| = 0): */
+ { 0.000000f, 0.000000f },
+ { 0.000000f, 0.116982f },
+ { 0.000000f, 0.226991f },
+ { 0.000000f, 0.340693f },
+ { 0.000000f, 0.464549f },
+ { 0.000000f, 0.605079f },
+ { 0.000000f, 0.776250f },
+ { 0.000000f, 1.000000f },
+
+ /* column 2 (|ILD| = 2): */
+ { 0.114623f, 0.000000f },
+ { 0.116171f, 0.115424f },
+ { 0.120448f, 0.223857f },
+ { 0.127733f, 0.335704f },
+ { 0.138966f, 0.457149f },
+ { 0.155840f, 0.594270f },
+ { 0.182248f, 0.760034f },
+ { 0.226274f, 0.974064f },
+
+ /* column 3 (|ILD| = 4): */
+ { 0.226274f, 0.000000f },
+ { 0.229210f, 0.110915f },
+ { 0.237306f, 0.214802f },
+ { 0.251046f, 0.321340f },
+ { 0.272098f, 0.435947f },
+ { 0.303429f, 0.563535f },
+ { 0.351766f, 0.714464f },
+ { 0.430506f, 0.902588f },
+
+ /* column 4 (|ILD| = 6): */
+ { 0.332279f, 0.000000f },
+ { 0.336318f, 0.103909f },
+ { 0.347423f, 0.200786f },
+ { 0.366155f, 0.299242f },
+ { 0.394585f, 0.403641f },
+ { 0.436296f, 0.517359f },
+ { 0.499282f, 0.647470f },
+ { 0.598480f, 0.801138f },
+
+ /* column 5 (|ILD| = 8): */
+ { 0.430506f, 0.000000f },
+ { 0.435293f, 0.095060f },
+ { 0.448405f, 0.183172f },
+ { 0.470357f, 0.271705f },
+ { 0.503282f, 0.363897f },
+ { 0.550751f, 0.461614f },
+ { 0.620606f, 0.568856f },
+ { 0.726386f, 0.687287f },
+
+ /* column 6 (|ILD| = 10): */
+ { 0.519494f, 0.000000f },
+ { 0.524665f, 0.085097f },
+ { 0.538769f, 0.163459f },
+ { 0.562182f, 0.241193f },
+ { 0.596843f, 0.320512f },
+ { 0.645875f, 0.402058f },
+ { 0.716076f, 0.487487f },
+ { 0.818182f, 0.574960f },
+
+ /* column 7 (|ILD| = 13): */
+ { 0.634158f, 0.000000f },
+ { 0.639318f, 0.069554f },
+ { 0.653296f, 0.132950f },
+ { 0.676201f, 0.194597f },
+ { 0.709442f, 0.255549f },
+ { 0.755149f, 0.315316f },
+ { 0.818046f, 0.373555f },
+ { 0.904547f, 0.426375f },
+
+ /* column 8 (|ILD| = 16): */
+ { 0.726386f, 0.000000f },
+ { 0.731048f, 0.054862f },
+ { 0.743597f, 0.104384f },
+ { 0.763914f, 0.151643f },
+ { 0.792863f, 0.197003f },
+ { 0.831670f, 0.239542f },
+ { 0.883261f, 0.278217f },
+ { 0.950993f, 0.309212f },
+
+ /* column 9 (|ILD| = 19): */
+ { 0.798235f, 0.000000f },
+ { 0.802164f, 0.042077f },
+ { 0.812683f, 0.079739f },
+ { 0.829536f, 0.115098f },
+ { 0.853180f, 0.148173f },
+ { 0.884212f, 0.178009f },
+ { 0.924333f, 0.203506f },
+ { 0.975135f, 0.221614f },
+
+ /* column 10 (|ILD| = 22): */
+ { 0.852825f, 0.000000f },
+ { 0.855976f, 0.031585f },
+ { 0.864374f, 0.059662f },
+ { 0.877717f, 0.085671f },
+ { 0.896203f, 0.109492f },
+ { 0.920064f, 0.130302f },
+ { 0.950256f, 0.147176f },
+ { 0.987460f, 0.157870f },
+
+ /* column 11 (|ILD| = 25): */
+ { 0.893520f, 0.000000f },
+ { 0.895958f, 0.023331f },
+ { 0.902435f, 0.043958f },
+ { 0.912657f, 0.062866f },
+ { 0.926684f, 0.079898f },
+ { 0.944559f, 0.094403f },
+ { 0.966814f, 0.105673f },
+ { 0.993695f, 0.112114f },
+
+ /* column 12 (|ILD| = 30): */
+ { 0.938693f, 0.000000f },
+ { 0.940202f, 0.013738f },
+ { 0.944192f, 0.025807f },
+ { 0.950441f, 0.036736f },
+ { 0.958923f, 0.046392f },
+ { 0.969577f, 0.054375f },
+ { 0.982605f, 0.060264f },
+ { 0.998002f, 0.063182f },
+
+ /* column 13 (|ILD| = 35): */
+ { 0.965056f, 0.000000f },
+ { 0.965951f, 0.007932f },
+ { 0.968314f, 0.014873f },
+ { 0.971997f, 0.021112f },
+ { 0.976963f, 0.026561f },
+ { 0.983149f, 0.030984f },
+ { 0.990633f, 0.034143f },
+ { 0.999368f, 0.035554f },
+
+ /* column 14 (|ILD| = 40): */
+ { 0.980198f, 0.000000f },
+ { 0.980717f, 0.004528f },
+ { 0.982085f, 0.008481f },
+ { 0.984212f, 0.012019f },
+ { 0.987068f, 0.015088f },
+ { 0.990608f, 0.017552f },
+ { 0.994866f, 0.019278f },
+ { 0.999800f, 0.019998f },
+
+ /* column 15 (|ILD| = 45): */
+ { 0.988816f, 0.000000f },
+ { 0.989113f, 0.002568f },
+ { 0.989895f, 0.004807f },
+ { 0.991109f, 0.006806f },
+ { 0.992735f, 0.008532f },
+ { 0.994746f, 0.009911f },
+ { 0.997156f, 0.010865f },
+ { 0.999937f, 0.011246f },
+
+ /* column 16 (|ILD| = 50): */
+ { 0.993695f, 0.000000f },
+ { 0.993864f, 0.001451f },
+ { 0.994308f, 0.002715f },
+ { 0.994996f, 0.003842f },
+ { 0.995917f, 0.004813f },
+ { 0.997054f, 0.005586f },
+ { 0.998414f, 0.006117f },
+ { 0.999980f, 0.006324f }
+};
+
+const float dft_trigo_12k8[STEREO_DFT_N_12k8_ENC / 4 + 1] =
+{
+ 0.0000000f, 0.0122715f, 0.0245412f, 0.0368072f, 0.0490677f, 0.0613207f, 0.0735646f, 0.0857973f, 0.0980171f, 0.1102222f, 0.1224107f, 0.1345807f, 0.1467305f, 0.1588581f,
+ 0.1709619f, 0.1830399f, 0.1950903f, 0.2071114f, 0.2191012f, 0.2310581f, 0.2429802f, 0.2548657f, 0.2667128f, 0.2785197f, 0.2902847f, 0.3020059f, 0.3136817f, 0.3253103f,
+ 0.3368899f, 0.3484187f, 0.3598950f, 0.3713172f, 0.3826834f, 0.3939920f, 0.4052413f, 0.4164296f, 0.4275551f, 0.4386162f, 0.4496113f, 0.4605387f, 0.4713967f, 0.4821838f,
+ 0.4928982f, 0.5035384f, 0.5141027f, 0.5245897f, 0.5349976f, 0.5453250f, 0.5555702f, 0.5657318f, 0.5758082f, 0.5857979f, 0.5956993f, 0.6055110f, 0.6152316f, 0.6248595f,
+ 0.6343933f, 0.6438315f, 0.6531728f, 0.6624158f, 0.6715590f, 0.6806010f, 0.6895405f, 0.6983762f, 0.7071068f, 0.7157308f, 0.7242471f, 0.7326543f, 0.7409511f, 0.7491364f,
+ 0.7572088f, 0.7651673f, 0.7730105f, 0.7807372f, 0.7883464f, 0.7958369f, 0.8032075f, 0.8104572f, 0.8175848f, 0.8245893f, 0.8314696f, 0.8382247f, 0.8448536f, 0.8513552f,
+ 0.8577286f, 0.8639729f, 0.8700870f, 0.8760701f, 0.8819213f, 0.8876396f, 0.8932243f, 0.8986745f, 0.9039893f, 0.9091680f, 0.9142098f, 0.9191139f, 0.9238795f, 0.9285061f,
+ 0.9329928f, 0.9373390f, 0.9415441f, 0.9456073f, 0.9495282f, 0.9533060f, 0.9569403f, 0.9604305f, 0.9637761f, 0.9669765f, 0.9700313f, 0.9729400f, 0.9757021f, 0.9783174f,
+ 0.9807853f, 0.9831055f, 0.9852776f, 0.9873014f, 0.9891765f, 0.9909026f, 0.9924795f, 0.9939070f, 0.9951847f, 0.9963126f, 0.9972905f, 0.9981181f, 0.9987955f, 0.9993224f,
+ 0.9996988f, 0.9999247f, 1.0000000f
+};
+
+const float dft_trigo_32k[STEREO_DFT_N_32k_ENC / 4 + 1] =
+{
+ 0.0000000f, 0.0049087f, 0.0098173f, 0.0147257f, 0.0196337f, 0.0245412f, 0.0294482f, 0.0343544f, 0.0392598f, 0.0441643f, 0.0490677f, 0.0539699f, 0.0588708f, 0.0637703f,
+ 0.0686683f, 0.0735646f, 0.0784591f, 0.0833517f, 0.0882424f, 0.0931309f, 0.0980171f, 0.1029010f, 0.1077825f, 0.1126613f, 0.1175374f, 0.1224107f, 0.1272810f, 0.1321483f,
+ 0.1370123f, 0.1418731f, 0.1467305f, 0.1515843f, 0.1564345f, 0.1612809f, 0.1661234f, 0.1709619f, 0.1757963f, 0.1806264f, 0.1854522f, 0.1902736f, 0.1950903f, 0.1999024f,
+ 0.2047096f, 0.2095119f, 0.2143092f, 0.2191012f, 0.2238880f, 0.2286695f, 0.2334454f, 0.2382156f, 0.2429802f, 0.2477389f, 0.2524916f, 0.2572382f, 0.2619786f, 0.2667128f,
+ 0.2714404f, 0.2761616f, 0.2808761f, 0.2855838f, 0.2902847f, 0.2949785f, 0.2996653f, 0.3043448f, 0.3090170f, 0.3136817f, 0.3183389f, 0.3229884f, 0.3276302f, 0.3322640f,
+ 0.3368899f, 0.3415076f, 0.3461171f, 0.3507182f, 0.3553109f, 0.3598950f, 0.3644705f, 0.3690372f, 0.3735950f, 0.3781438f, 0.3826834f, 0.3872139f, 0.3917350f, 0.3962467f,
+ 0.4007488f, 0.4052413f, 0.4097240f, 0.4141969f, 0.4186597f, 0.4231125f, 0.4275551f, 0.4319874f, 0.4364092f, 0.4408206f, 0.4452213f, 0.4496113f, 0.4539905f, 0.4583587f,
+ 0.4627159f, 0.4670620f, 0.4713967f, 0.4757202f, 0.4800321f, 0.4843325f, 0.4886212f, 0.4928982f, 0.4971633f, 0.5014164f, 0.5056574f, 0.5098862f, 0.5141027f, 0.5183069f,
+ 0.5224986f, 0.5266776f, 0.5308440f, 0.5349976f, 0.5391383f, 0.5432660f, 0.5473807f, 0.5514821f, 0.5555702f, 0.5596450f, 0.5637063f, 0.5677540f, 0.5717880f, 0.5758082f,
+ 0.5798145f, 0.5838069f, 0.5877853f, 0.5917494f, 0.5956993f, 0.5996348f, 0.6035559f, 0.6074625f, 0.6113544f, 0.6152316f, 0.6190939f, 0.6229414f, 0.6267738f, 0.6305912f,
+ 0.6343933f, 0.6381801f, 0.6419516f, 0.6457076f, 0.6494480f, 0.6531728f, 0.6568819f, 0.6605751f, 0.6642524f, 0.6679137f, 0.6715590f, 0.6751880f, 0.6788007f, 0.6823972f,
+ 0.6859771f, 0.6895405f, 0.6930874f, 0.6966175f, 0.7001308f, 0.7036273f, 0.7071068f, 0.7105693f, 0.7140146f, 0.7174427f, 0.7208536f, 0.7242471f, 0.7276231f, 0.7309816f,
+ 0.7343225f, 0.7376457f, 0.7409511f, 0.7442387f, 0.7475083f, 0.7507599f, 0.7539935f, 0.7572088f, 0.7604060f, 0.7635848f, 0.7667452f, 0.7698871f, 0.7730105f, 0.7761152f,
+ 0.7792012f, 0.7822685f, 0.7853169f, 0.7883464f, 0.7913569f, 0.7943484f, 0.7973207f, 0.8002737f, 0.8032075f, 0.8061220f, 0.8090170f, 0.8118925f, 0.8147485f, 0.8175848f,
+ 0.8204014f, 0.8231983f, 0.8259753f, 0.8287325f, 0.8314696f, 0.8341867f, 0.8368838f, 0.8395606f, 0.8422172f, 0.8448536f, 0.8474695f, 0.8500651f, 0.8526402f, 0.8551947f,
+ 0.8577286f, 0.8602419f, 0.8627344f, 0.8652061f, 0.8676570f, 0.8700870f, 0.8724960f, 0.8748840f, 0.8772509f, 0.8795967f, 0.8819213f, 0.8842246f, 0.8865066f, 0.8887673f,
+ 0.8910065f, 0.8932243f, 0.8954206f, 0.8975952f, 0.8997483f, 0.9018797f, 0.9039893f, 0.9060771f, 0.9081432f, 0.9101873f, 0.9122095f, 0.9142098f, 0.9161880f, 0.9181441f,
+ 0.9200781f, 0.9219899f, 0.9238795f, 0.9257469f, 0.9275919f, 0.9294146f, 0.9312149f, 0.9329928f, 0.9347482f, 0.9364810f, 0.9381913f, 0.9398790f, 0.9415441f, 0.9431864f,
+ 0.9448060f, 0.9464029f, 0.9479770f, 0.9495282f, 0.9510565f, 0.9525619f, 0.9540444f, 0.9555039f, 0.9569403f, 0.9583537f, 0.9597440f, 0.9611112f, 0.9624552f, 0.9637761f,
+ 0.9650737f, 0.9663480f, 0.9675991f, 0.9688268f, 0.9700313f, 0.9712123f, 0.9723699f, 0.9735041f, 0.9746149f, 0.9757021f, 0.9767659f, 0.9778061f, 0.9788228f, 0.9798158f,
+ 0.9807853f, 0.9817311f, 0.9826533f, 0.9835518f, 0.9844266f, 0.9852776f, 0.9861050f, 0.9869085f, 0.9876883f, 0.9884443f, 0.9891765f, 0.9898849f, 0.9905693f, 0.9912300f,
+ 0.9918667f, 0.9924795f, 0.9930685f, 0.9936335f, 0.9941745f, 0.9946916f, 0.9951847f, 0.9956539f, 0.9960990f, 0.9965202f, 0.9969173f, 0.9972905f, 0.9976395f, 0.9979646f,
+ 0.9982656f, 0.9985426f, 0.9987955f, 0.9990243f, 0.9992290f, 0.9994097f, 0.9995663f, 0.9996988f, 0.9998072f, 0.9998916f, 0.9999518f, 0.9999880f, 1.0000000f
+};
+
+const float dft_trigo_48k[STEREO_DFT_N_MAX_ENC / 4 + 1] =
+{
+ 0.0000000f, 0.0032725f, 0.0065449f, 0.0098173f, 0.0130896f, 0.0163617f, 0.0196337f, 0.0229054f, 0.0261769f, 0.0294482f, 0.0327191f, 0.0359896f, 0.0392598f, 0.0425296f,
+ 0.0457989f, 0.0490677f, 0.0523360f, 0.0556037f, 0.0588708f, 0.0621373f, 0.0654031f, 0.0686683f, 0.0719327f, 0.0751963f, 0.0784591f, 0.0817211f, 0.0849822f, 0.0882424f,
+ 0.0915016f, 0.0947599f, 0.0980171f, 0.1012733f, 0.1045285f, 0.1077825f, 0.1110353f, 0.1142870f, 0.1175374f, 0.1207866f, 0.1240345f, 0.1272810f, 0.1305262f, 0.1337700f,
+ 0.1370123f, 0.1402532f, 0.1434926f, 0.1467305f, 0.1499668f, 0.1532014f, 0.1564345f, 0.1596658f, 0.1628955f, 0.1661234f, 0.1693495f, 0.1725738f, 0.1757963f, 0.1790169f,
+ 0.1822355f, 0.1854522f, 0.1886670f, 0.1918797f, 0.1950903f, 0.1982989f, 0.2015053f, 0.2047096f, 0.2079117f, 0.2111116f, 0.2143092f, 0.2175045f, 0.2206974f, 0.2238880f,
+ 0.2270763f, 0.2302620f, 0.2334454f, 0.2366262f, 0.2398045f, 0.2429802f, 0.2461533f, 0.2493238f, 0.2524916f, 0.2556567f, 0.2588190f, 0.2619786f, 0.2651354f, 0.2682894f,
+ 0.2714404f, 0.2745886f, 0.2777338f, 0.2808761f, 0.2840153f, 0.2871515f, 0.2902847f, 0.2934147f, 0.2965416f, 0.2996653f, 0.3027858f, 0.3059030f, 0.3090170f, 0.3121277f,
+ 0.3152350f, 0.3183389f, 0.3214395f, 0.3245366f, 0.3276302f, 0.3307203f, 0.3338069f, 0.3368899f, 0.3399692f, 0.3430450f, 0.3461171f, 0.3491854f, 0.3522500f, 0.3553109f,
+ 0.3583679f, 0.3614212f, 0.3644705f, 0.3675159f, 0.3705574f, 0.3735950f, 0.3766285f, 0.3796580f, 0.3826834f, 0.3857048f, 0.3887220f, 0.3917350f, 0.3947439f, 0.3977485f,
+ 0.4007488f, 0.4037449f, 0.4067366f, 0.4097240f, 0.4127070f, 0.4156856f, 0.4186597f, 0.4216294f, 0.4245945f, 0.4275551f, 0.4305111f, 0.4334625f, 0.4364092f, 0.4393513f,
+ 0.4422887f, 0.4452213f, 0.4481492f, 0.4510723f, 0.4539905f, 0.4569039f, 0.4598124f, 0.4627159f, 0.4656145f, 0.4685081f, 0.4713967f, 0.4742803f, 0.4771588f, 0.4800321f,
+ 0.4829003f, 0.4857634f, 0.4886212f, 0.4914739f, 0.4943212f, 0.4971633f, 0.5000000f, 0.5028314f, 0.5056574f, 0.5084780f, 0.5112931f, 0.5141027f, 0.5169069f, 0.5197055f,
+ 0.5224986f, 0.5252860f, 0.5280679f, 0.5308440f, 0.5336145f, 0.5363793f, 0.5391383f, 0.5418916f, 0.5446390f, 0.5473807f, 0.5501164f, 0.5528463f, 0.5555702f, 0.5582882f,
+ 0.5610003f, 0.5637063f, 0.5664062f, 0.5691001f, 0.5717880f, 0.5744697f, 0.5771452f, 0.5798145f, 0.5824777f, 0.5851346f, 0.5877853f, 0.5904296f, 0.5930676f, 0.5956993f,
+ 0.5983246f, 0.6009435f, 0.6035559f, 0.6061619f, 0.6087614f, 0.6113544f, 0.6139408f, 0.6165207f, 0.6190939f, 0.6216606f, 0.6242205f, 0.6267738f, 0.6293204f, 0.6318602f,
+ 0.6343933f, 0.6369196f, 0.6394390f, 0.6419516f, 0.6444573f, 0.6469562f, 0.6494480f, 0.6519330f, 0.6544109f, 0.6568819f, 0.6593458f, 0.6618027f, 0.6642524f, 0.6666951f,
+ 0.6691306f, 0.6715590f, 0.6739801f, 0.6763941f, 0.6788007f, 0.6812002f, 0.6835923f, 0.6859771f, 0.6883546f, 0.6907247f, 0.6930874f, 0.6954426f, 0.6977905f, 0.7001308f,
+ 0.7024637f, 0.7047890f, 0.7071068f, 0.7094170f, 0.7117196f, 0.7140146f, 0.7163019f, 0.7185816f, 0.7208536f, 0.7231179f, 0.7253744f, 0.7276231f, 0.7298641f, 0.7320972f,
+ 0.7343225f, 0.7365399f, 0.7387495f, 0.7409511f, 0.7431448f, 0.7453306f, 0.7475083f, 0.7496781f, 0.7518398f, 0.7539935f, 0.7561391f, 0.7582766f, 0.7604060f, 0.7625272f,
+ 0.7646403f, 0.7667452f, 0.7688418f, 0.7709303f, 0.7730105f, 0.7750824f, 0.7771460f, 0.7792012f, 0.7812482f, 0.7832867f, 0.7853169f, 0.7873387f, 0.7893520f, 0.7913569f,
+ 0.7933533f, 0.7953413f, 0.7973207f, 0.7992915f, 0.8012538f, 0.8032075f, 0.8051526f, 0.8070891f, 0.8090170f, 0.8109362f, 0.8128467f, 0.8147485f, 0.8166416f, 0.8185259f,
+ 0.8204014f, 0.8222682f, 0.8241262f, 0.8259753f, 0.8278156f, 0.8296471f, 0.8314696f, 0.8332833f, 0.8350880f, 0.8368838f, 0.8386706f, 0.8404484f, 0.8422172f, 0.8439770f,
+ 0.8457278f, 0.8474695f, 0.8492022f, 0.8509257f, 0.8526402f, 0.8543455f, 0.8560416f, 0.8577286f, 0.8594064f, 0.8610750f, 0.8627344f, 0.8643845f, 0.8660254f, 0.8676570f,
+ 0.8692793f, 0.8708923f, 0.8724960f, 0.8740903f, 0.8756753f, 0.8772509f, 0.8788171f, 0.8803739f, 0.8819213f, 0.8834592f, 0.8849876f, 0.8865066f, 0.8880161f, 0.8895161f,
+ 0.8910065f, 0.8924874f, 0.8939588f, 0.8954206f, 0.8968727f, 0.8983153f, 0.8997483f, 0.9011716f, 0.9025853f, 0.9039893f, 0.9053836f, 0.9067683f, 0.9081432f, 0.9095084f,
+ 0.9108638f, 0.9122095f, 0.9135455f, 0.9148716f, 0.9161880f, 0.9174945f, 0.9187912f, 0.9200781f, 0.9213551f, 0.9226223f, 0.9238795f, 0.9251269f, 0.9263644f, 0.9275919f,
+ 0.9288096f, 0.9300172f, 0.9312149f, 0.9324027f, 0.9335804f, 0.9347482f, 0.9359059f, 0.9370536f, 0.9381913f, 0.9393190f, 0.9404366f, 0.9415441f, 0.9426415f, 0.9437288f,
+ 0.9448060f, 0.9458732f, 0.9469301f, 0.9479770f, 0.9490136f, 0.9500402f, 0.9510565f, 0.9520627f, 0.9530586f, 0.9540444f, 0.9550199f, 0.9559853f, 0.9569403f, 0.9578852f,
+ 0.9588197f, 0.9597440f, 0.9606581f, 0.9615618f, 0.9624552f, 0.9633384f, 0.9642112f, 0.9650737f, 0.9659258f, 0.9667676f, 0.9675991f, 0.9684202f, 0.9692309f, 0.9700313f,
+ 0.9708212f, 0.9716008f, 0.9723699f, 0.9731287f, 0.9738770f, 0.9746149f, 0.9753423f, 0.9760593f, 0.9767659f, 0.9774620f, 0.9781476f, 0.9788228f, 0.9794874f, 0.9801416f,
+ 0.9807853f, 0.9814185f, 0.9820411f, 0.9826533f, 0.9832549f, 0.9838460f, 0.9844266f, 0.9849966f, 0.9855561f, 0.9861050f, 0.9866433f, 0.9871711f, 0.9876883f, 0.9881950f,
+ 0.9886910f, 0.9891765f, 0.9896514f, 0.9901157f, 0.9905693f, 0.9910124f, 0.9914449f, 0.9918667f, 0.9922779f, 0.9926785f, 0.9930685f, 0.9934478f, 0.9938165f, 0.9941745f,
+ 0.9945219f, 0.9948586f, 0.9951847f, 0.9955002f, 0.9958049f, 0.9960990f, 0.9963825f, 0.9966552f, 0.9969173f, 0.9971688f, 0.9974095f, 0.9976395f, 0.9978589f, 0.9980676f,
+ 0.9982656f, 0.9984529f, 0.9986295f, 0.9987955f, 0.9989507f, 0.9990952f, 0.9992290f, 0.9993522f, 0.9994646f, 0.9995663f, 0.9996573f, 0.9997376f, 0.9998072f, 0.9998661f,
+ 0.9999143f, 0.9999518f, 0.9999786f, 0.9999946f, 1.0000000f
+};
+
+/* tables for adaptive Golomb-Rice coding of DFT stereo parameters */
+const int16_t dft_code_itd[] =
+{
+ 0, 3, 4, 13, 8, 9, 12, 5, 10, 44, 23, 60, 45, 31, 235, 59, 28, 61, 234, 116
+};
+
+const int16_t dft_len_itd[] =
+{
+ 2, 3, 4, 4, 4, 4, 4, 4, 4, 6, 5, 6, 6, 5, 8, 6, 5, 6, 8, 7
+};
+
+const int16_t dft_maps_rpg[] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 2, 0, 1, 3, 4, 5, 6, 7,
+ 6, 2, 0, 1, 3, 4, 5, 7,
+ 7, 5, 2, 0, 1, 3, 4, 6,
+ 7, 6, 4, 3, 1, 0, 2, 5,
+ 7, 6, 5, 3, 2, 1, 0, 4,
+ 7, 6, 5, 4, 3, 2, 0, 1,
+ 7, 6, 5, 4, 3, 2, 0, 1,
+ 6, 5, 4, 3, 1, 0, 2, 7,
+};
+
+const int16_t dft_maps_sg[NO_SYMB_GR_SIDE_G * NO_SYMB_GR_SIDE_G] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 15, 4, 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 12, 9, 4, 1, 0, 2, 3, 5, 6, 7, 8, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 16, 14, 8, 4, 2, 0, 1, 3, 5, 6, 7, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 18, 16, 14, 10, 5, 0, 1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 21, 19, 17, 15, 8, 4, 2, 0, 1, 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 16, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 21, 19, 17, 15, 12, 8, 4, 0, 1, 2, 3, 5, 6, 7, 9, 10, 11, 13, 14, 16, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 21, 19, 17, 15, 13, 11, 9, 3, 0, 1, 2, 4, 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 24, 22, 20, 18, 16, 14, 12, 9, 6, 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 15, 17, 19, 21, 23, 25, 26, 27, 28, 29, 30,
+ 25, 23, 21, 19, 17, 15, 13, 11, 9, 6, 0, 1, 2, 3, 4, 5, 7, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 27, 28, 29, 30,
+ 27, 25, 23, 21, 19, 17, 15, 13, 11, 8, 5, 0, 1, 2, 3, 4, 6, 7, 9, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 29, 30,
+ 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 1, 0, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 28, 29, 30,
+ 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 30,
+ 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
+ 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
+ 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 1, 0, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29,
+ 30, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28,
+ 30, 29, 28, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 0, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26,
+ 30, 29, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 9, 7, 6, 4, 3, 2, 1, 0, 5, 8, 11, 13, 15, 17, 19, 21, 23, 25, 27,
+ 30, 29, 28, 27, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 7, 5, 4, 3, 2, 1, 0, 6, 9, 11, 13, 15, 17, 19, 21, 23, 25,
+ 30, 29, 28, 27, 26, 25, 23, 21, 19, 17, 15, 13, 11, 10, 8, 7, 5, 4, 3, 2, 1, 0, 6, 9, 12, 14, 16, 18, 20, 22, 24,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 20, 18, 16, 14, 12, 10, 8, 7, 6, 5, 4, 2, 1, 0, 3, 9, 11, 13, 15, 17, 19, 21,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 20, 18, 16, 14, 13, 11, 10, 9, 7, 6, 5, 3, 2, 1, 0, 4, 8, 12, 15, 17, 19, 21,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 20, 18, 16, 14, 13, 12, 11, 10, 9, 7, 6, 5, 3, 1, 0, 2, 4, 8, 15, 17, 19, 21,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 17, 15, 13, 12, 11, 9, 8, 7, 6, 4, 3, 2, 1, 0, 5, 10, 14, 16, 18,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 15, 13, 12, 11, 10, 9, 7, 6, 5, 3, 1, 0, 2, 4, 8, 14, 16,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 11, 10, 8, 7, 6, 5, 3, 2, 0, 1, 4, 9, 12,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 3, 2, 1, 0, 4, 15,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 0, 1,
+ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+};
+
+
+/*-------------------------------------------------------------------------
+ * Range Coder ROM tables
+ *------------------------------------------------------------------------*/
+
+/* Create separate tables for cumulative frequency and symbol frequency */
+const uint16_t cum_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][1 + RANGE_N_SYMBOLS] =
+{
+ { 0,16,47,153,241,269,325,468,591,674,798,912,1017,1082,1183,1277,1364,16384 },
+ { 0,7401,7844,7886,7899,12065,12718,12790,12805,14099,14476,14533,14549,15058,15264,15299,15310,16384 },
+ { 0,4362,6345,6864,7038,9037,11049,11736,12002,12569,13301,13656,13822,14021,14334,14515,14607,16384 },
+ { 0,2955,5183,5822,6013,8153,10671,11614,11943,12586,13540,14025,14232,14437,14770,14978,15080,16384 },
+ { 0,3155,4981,5615,5855,7969,9953,10739,11073,11936,12837,13208,13383,13767,14203,14400,14498,16384 },
+ { 0,1216,2630,3264,3558,4831,6679,7661,8157,8709,9622,10204,10542,10799,11243,11568,11777,16384 },
+ { 0,1759,3641,4350,4612,6325,8678,9732,10161,10790,11790,12361,12642,12883,13295,13566,13720,16384 },
+ { 0,1109,2705,3433,3732,5226,7532,8732,9263,9978,11142,11842,12188,12490,12986,13321,13520,16384 },
+ { 0,11524,13046,13170,13191,14956,15708,15813,15837,16028,16162,16195,16204,16245,16282,16295,16300,16384 },
+ { 0,8027,10586,10909,10974,13291,14861,15157,15232,15535,15824,15914,15943,16014,16090,16123,16136,16384 },
+ { 0,834,2034,2674,2997,4087,5843,6891,7455,8030,9013,9688,10085,10376,10893,11277,11528,16384 },
+ { 0,6038,9086,9451,9519,12332,14521,14913,15003,15329,15711,15848,15893,15955,16045,16091,16111,16384 },
+ { 0,4732,7685,8354,8545,10717,12924,13618,13852,14291,14842,15083,15181,15314,15491,15582,15625,16384 },
+ { 0,745,1783,2347,2655,3537,4963,5864,6406,6863,7664,8248,8634,8891,9351,9708,9958,16384 },
+ { 0,3957,6794,7669,7998,9743,11676,12498,12869,13313,13894,14186,14332,14498,14714,14835,14906,16384 },
+ { 0,2779,5388,6021,6201,8582,11352,12260,12544,13117,13981,14408,14580,14751,15039,15213,15298,16384 },
+ { 0,448,1160,1625,1920,2576,3706,4518,5053,5474,6234,6835,7262,7531,8032,8446,8758,16384 },
+ { 0,1,2,1555,2246,2247,2248,3489,4112,5449,6596,7302,7710,8311,8876,9266,9517,16384 },
+ { 0,2496,4910,5544,5722,8049,10799,11689,11973,12583,13467,13878,14047,14234,14537,14712,14803,16384 },
+ { 0,921,2222,2880,3188,4407,6321,7406,7955,8573,9616,10296,10679,10978,11502,11880,12118,16384 },
+ { 0,2620,4443,5017,5233,7072,9213,10083,10441,11049,11954,12442,12676,12918,13310,13565,13705,16384 },
+ { 0,11205,13084,13178,13187,15164,16010,16081,16091,16213,16303,16321,16325,16340,16355,16360,16362,16384 },
+ { 0,358,916,1288,1542,2055,2937,3594,4062,4399,5017,5524,5907,6136,6573,6941,7236,16384 },
+ { 0,3575,5093,5536,5735,7408,9185,9878,10188,10727,11497,11933,12165,12410,12794,13019,13166,16384 },
+ { 0,1,2,640,1036,1037,1038,1670,2096,2696,3287,3732,4056,4417,4800,5106,5339,16384 },
+ { 0,969,1397,1518,1578,2633,3338,3566,3675,4197,4664,4857,4957,5288,5625,5783,5874,16384 },
+ { 0,10458,12104,12294,12331,14246,15264,15437,15481,15752,15971,16031,16050,16120,16186,16210,16218,16384 },
+ { 0,7178,9744,10039,10093,12701,14612,14961,15042,15360,15732,15869,15917,15978,16070,16117,16139,16384 },
+ { 0,1298,2418,2879,3113,4146,5509,6227,6621,7053,7755,8229,8539,8776,9186,9492,9714,16384 },
+ { 0,4957,7785,8252,8357,10978,13372,13955,14114,14561,15140,15378,15464,15570,15730,15820,15860,16384 },
+ { 0,4823,8164,8570,8647,11604,14169,14653,14763,15105,15554,15727,15785,15852,15960,16018,16045,16384 },
+ { 0,4735,7010,7517,7660,9986,12230,12914,13131,13666,14374,14689,14814,14972,15212,15342,15404,16384 },
+ { 0,3363,5881,6658,6941,8864,11113,12015,12368,12889,13643,14019,14203,14394,14665,14823,14906,16384 },
+ { 0,2569,4996,5779,6068,7917,10251,11209,11602,12129,12918,13321,13520,13696,13976,14155,14259,16384 },
+ { 0,209,577,848,1046,1378,1982,2465,2835,3072,3513,3893,4202,4374,4703,4994,5241,16384 },
+ { 0,2074,4337,5048,5274,7319,10003,11066,11446,12105,13112,13652,13885,14100,14464,14691,14810,16384 },
+ { 0,1619,3560,4288,4550,6381,8955,10102,10543,11239,12362,12982,13261,13516,13958,14234,14381,16384 },
+ { 0,89,257,441,582,734,1024,1325,1568,1716,1983,2222,2430,2545,2750,2941,3109,16384 },
+ { 0,2202,3563,4044,4264,5686,7344,8100,8476,9006,9835,10331,10612,10864,11304,11599,11787,16384 },
+ { 0,1220,2801,3492,3784,5223,7387,8496,8998,9640,10711,11369,11711,11993,12486,12829,13035,16384 },
+ { 0,12626,13813,13903,13917,15396,15906,15972,15987,16139,16230,16251,16257,16289,16315,16323,16326,16384 },
+ { 0,1579,3191,3831,4099,5678,7788,8761,9206,9842,10821,11388,11681,11958,12417,12722,12902,16384 },
+ { 0,597,1514,2064,2379,3237,4679,5637,6213,6733,7649,8316,8755,9052,9599,10023,10323,16384 },
+ { 0,9273,11762,12080,12151,14038,15210,15446,15514,15725,15929,15995,16019,16068,16124,16148,16158,16384 },
+ { 0,9238,11681,11852,11872,14306,15644,15801,15828,16013,16183,16231,16243,16266,16297,16312,16318,16384 },
+ { 0,6791,9200,9531,9594,12240,14178,14552,14639,15064,15506,15643,15687,15785,15908,15960,15983,16384 },
+ { 0,7175,10415,10905,11033,13038,14621,15002,15123,15367,15651,15762,15806,15864,15938,15974,15992,16384 },
+ { 0,5060,7703,8132,8225,10934,13270,13778,13911,14397,14972,15173,15242,15367,15537,15619,15654,16384 },
+ { 0,3721,6311,6857,6992,9557,12180,12895,13098,13671,14418,14718,14830,14984,15212,15333,15390,16384 },
+ { 0,5971,9288,10044,10269,11991,13680,14228,14437,14750,15130,15293,15374,15459,15579,15642,15677,16384 },
+ { 0,3047,5311,5907,6078,8339,10850,11679,11946,12580,13442,13854,14024,14220,14534,14716,14810,16384 },
+ { 0,2061,4280,4993,5228,7201,9735,10735,11097,11708,12606,13082,13295,13498,13836,14043,14161,16384 },
+ { 0,4738,7949,8880,9234,10781,12502,13214,13531,13897,14355,14593,14718,14835,14998,15096,15153,16384 },
+ { 0,3237,5045,5632,5860,7609,9702,10608,10986,11571,12476,12978,13230,13451,13830,14074,14208,16384 },
+ { 0,1833,3889,4677,5028,6422,8379,9378,9884,10350,11086,11545,11809,12003,12327,12559,12711,16384 },
+ { 0,3989,6858,7352,7459,10254,12936,13571,13735,14240,14895,15153,15242,15364,15548,15646,15690,16384 },
+ { 0,1463,3197,3909,4220,5626,7609,8632,9127,9657,10520,11078,11380,11607,11991,12265,12442,16384 },
+ { 0,14233,15083,15108,15110,16069,16300,16314,16316,16352,16370,16373,16374,16377,16380,16381,16382,16384 },
+ { 0,1,2,2610,3293,3294,3295,5097,5671,8467,10332,11119,11437,12223,12850,13185,13345,16384 },
+ { 0,2010,4053,4696,4910,6879,9391,10386,10750,11393,12376,12886,13119,13348,13726,13967,14099,16384 },
+ { 0,7586,10517,10758,10791,13543,15346,15577,15619,15846,16082,16150,16169,16202,16245,16265,16273,16384 },
+ { 0,3059,5772,6369,6524,9041,11801,12582,12813,13361,14115,14439,14567,14714,14944,15075,15141,16384 },
+ { 0,8643,10594,10813,10856,13274,14686,14920,14975,15350,15680,15771,15799,15897,16003,16042,16057,16384 },
+ { 0,6720,8878,9325,9467,11564,13248,13744,13929,14384,14880,15087,15167,15311,15488,15569,15607,16384 },
+};
+
+const uint16_t sym_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][RANGE_N_SYMBOLS] =
+{
+ { 16,31,106,88,28,56,143,123,83,124,114,105,65,101,94,87,15020 },
+ { 7401,443,42,13,4166,653,72,15,1294,377,57,16,509,206,35,11,1074 },
+ { 4362,1983,519,174,1999,2012,687,266,567,732,355,166,199,313,181,92,1777 },
+ { 2955,2228,639,191,2140,2518,943,329,643,954,485,207,205,333,208,102,1304 },
+ { 3155,1826,634,240,2114,1984,786,334,863,901,371,175,384,436,197,98,1886 },
+ { 1216,1414,634,294,1273,1848,982,496,552,913,582,338,257,444,325,209,4607 },
+ { 1759,1882,709,262,1713,2353,1054,429,629,1000,571,281,241,412,271,154,2664 },
+ { 1109,1596,728,299,1494,2306,1200,531,715,1164,700,346,302,496,335,199,2864 },
+ { 11524,1522,124,21,1765,752,105,24,191,134,33,9,41,37,13,5,84 },
+ { 8027,2559,323,65,2317,1570,296,75,303,289,90,29,71,76,33,13,248 },
+ { 834,1200,640,323,1090,1756,1048,564,575,983,675,397,291,517,384,251,4856 },
+ { 6038,3048,365,68,2813,2189,392,90,326,382,137,45,62,90,46,20,273 },
+ { 4732,2953,669,191,2172,2207,694,234,439,551,241,98,133,177,91,43,759 },
+ { 745,1038,564,308,882,1426,901,542,457,801,584,386,257,460,357,250,6426 },
+ { 3957,2837,875,329,1745,1933,822,371,444,581,292,146,166,216,121,71,1478 },
+ { 2779,2609,633,180,2381,2770,908,284,573,864,427,172,171,288,174,85,1086 },
+ { 448,712,465,295,656,1130,812,535,421,760,601,427,269,501,414,312,7626 },
+ { 1,1,1553,691,1,1,1241,623,1337,1147,706,408,601,565,390,251,6867 },
+ { 2496,2414,634,178,2327,2750,890,284,610,884,411,169,187,303,175,91,1581 },
+ { 921,1301,658,308,1219,1914,1085,549,618,1043,680,383,299,524,378,238,4266 },
+ { 2620,1823,574,216,1839,2141,870,358,608,905,488,234,242,392,255,140,2679 },
+ { 11205,1879,94,9,1977,846,71,10,122,90,18,4,15,15,5,2,22 },
+ { 358,558,372,254,513,882,657,468,337,618,507,383,229,437,368,295,9148 },
+ { 3575,1518,443,199,1673,1777,693,310,539,770,436,232,245,384,225,147,3218 },
+ { 1,1,638,396,1,1,632,426,600,591,445,324,361,383,306,233,11045 },
+ { 969,428,121,60,1055,705,228,109,522,467,193,100,331,337,158,91,10510 },
+ { 10458,1646,190,37,1915,1018,173,44,271,219,60,19,70,66,24,8,166 },
+ { 7178,2566,295,54,2608,1911,349,81,318,372,137,48,61,92,47,22,245 },
+ { 1298,1120,461,234,1033,1363,718,394,432,702,474,310,237,410,306,222,6670 },
+ { 4957,2828,467,105,2621,2394,583,159,447,579,238,86,106,160,90,40,524 },
+ { 4823,3341,406,77,2957,2565,484,110,342,449,173,58,67,108,58,27,339 },
+ { 4735,2275,507,143,2326,2244,684,217,535,708,315,125,158,240,130,62,980 },
+ { 3363,2518,777,283,1923,2249,902,353,521,754,376,184,191,271,158,83,1478 },
+ { 2569,2427,783,289,1849,2334,958,393,527,789,403,199,176,280,179,104,2125 },
+ { 209,368,271,198,332,604,483,370,237,441,380,309,172,329,291,247,11143 },
+ { 2074,2263,711,226,2045,2684,1063,380,659,1007,540,233,215,364,227,119,1574 },
+ { 1619,1941,728,262,1831,2574,1147,441,696,1123,620,279,255,442,276,147,2003 },
+ { 89,168,184,141,152,290,301,243,148,267,239,208,115,205,191,168,13275 },
+ { 2202,1361,481,220,1422,1658,756,376,530,829,496,281,252,440,295,188,4597 },
+ { 1220,1581,691,292,1439,2164,1109,502,642,1071,658,342,282,493,343,206,3349 },
+ { 12626,1187,90,14,1479,510,66,15,152,91,21,6,32,26,8,3,58 },
+ { 1579,1612,640,268,1579,2110,973,445,636,979,567,293,277,459,305,180,3482 },
+ { 597,917,550,315,858,1442,958,576,520,916,667,439,297,547,424,300,6061 },
+ { 9273,2489,318,71,1887,1172,236,68,211,204,66,24,49,56,24,10,226 },
+ { 9238,2443,171,20,2434,1338,157,27,185,170,48,12,23,31,15,6,66 },
+ { 6791,2409,331,63,2646,1938,374,87,425,442,137,44,98,123,52,23,401 },
+ { 7175,3240,490,128,2005,1583,381,121,244,284,111,44,58,74,36,18,392 },
+ { 5060,2643,429,93,2709,2336,508,133,486,575,201,69,125,170,82,35,730 },
+ { 3721,2590,546,135,2565,2623,715,203,573,747,300,112,154,228,121,57,994 },
+ { 5971,3317,756,225,1722,1689,548,209,313,380,163,81,85,120,63,35,707 },
+ { 3047,2264,596,171,2261,2511,829,267,634,862,412,170,196,314,182,94,1574 },
+ { 2061,2219,713,235,1973,2534,1000,362,611,898,476,213,203,338,207,118,2223 },
+ { 4738,3211,931,354,1547,1721,712,317,366,458,238,125,117,163,98,57,1231 },
+ { 3237,1808,587,228,1749,2093,906,378,585,905,502,252,221,379,244,134,2176 },
+ { 1833,2056,788,351,1394,1957,999,506,466,736,459,264,194,324,232,152,3673 },
+ { 3989,2869,494,107,2795,2682,635,164,505,655,258,89,122,184,98,44,694 },
+ { 1463,1734,712,311,1406,1983,1023,495,530,863,558,302,227,384,274,177,3942 },
+ { 14233,850,25,2,959,231,14,2,36,18,3,1,3,3,1,1,2 },
+ { 1,1,2608,683,1,1,1802,574,2796,1865,787,318,786,627,335,160,3039 },
+ { 2010,2043,643,214,1969,2512,995,364,643,983,510,233,229,378,241,132,2285 },
+ { 7586,2931,241,33,2752,1803,231,42,227,236,68,19,33,43,20,8,111 },
+ { 3059,2713,597,155,2517,2760,781,231,548,754,324,128,147,230,131,66,1243 },
+ { 8643,1951,219,43,2418,1412,234,55,375,330,91,28,98,106,39,15,327 },
+ { 6720,2158,447,142,2097,1684,496,185,455,496,207,80,144,177,81,38,777 },
+};
+
+
+/*-------------------------------------------------------------------------
+ * ECLVQ Stereo ROM tables
+ *------------------------------------------------------------------------*/
+
+/* table with round(ECSQ_PROB_TOTAL / index) for entropy coding, with i in {1, .., ECSQ_SEGMENT_SIZE} */
+const uint16_t ECSQ_tab_inverse[1 + ECSQ_SEGMENT_SIZE] =
+{
+ 0, 16384, 8192, 5461, 4096, 3277, 2731, 2341, 2048
+};
+
+
+/*-------------------------------------------------------------------------
+ * Stereo ICA analysis ROM tables
+ *------------------------------------------------------------------------*/
+
+const float ica_sincInterp2[2*SINC_ORDER1+1] =
+{
+ 0.0f,-0.002323f,0.0f, 0.003486f, 0.0f,-0.005865f,0.0f, 0.009735f, 0.0f,-0.015447f,0.0f, 0.023503f,
+ 0.0f,-0.034727f,0.0f, 0.050649f, 0.0f,-0.074578f,0.0f, 0.115220f, 0.0f,-0.204776f,0.0f, 0.634114f,
+ 1.0f, 0.634114f,0.0f,-0.204776f, 0.0f, 0.115220f,0.0f,-0.074578f, 0.0f, 0.050649f,0.0f,-0.034727f,
+ 0.0f, 0.023503f,0.0f,-0.015447f, 0.0f, 0.009735f,0.0f,-0.005865f, 0.0f, 0.003486f,0.0f,-0.002323f, 0.0f
+};
+
+const float ica_sincInterp4[2*SINC_ORDER1+1] =
+{
+ 0.0f,-0.003285f,-0.005537f,-0.004930f, 0.0f, 0.008295f, 0.015189f, 0.013767f, 0.0f,-0.021845f,-0.038282f,-0.033239f,
+ 0.0f, 0.049111f, 0.083913f, 0.071628f, 0.0f,-0.105469f,-0.183615f,-0.162946f, 0.0f, 0.289597f, 0.626641f, 0.896773f,
+ 1.0f, 0.896773f, 0.626641f, 0.289597f, 0.0f,-0.162946f,-0.183615f,-0.105469f, 0.0f, 0.071628f, 0.083913f, 0.049111f,
+ 0.0f,-0.033239f,-0.038282f,-0.021845f, 0.0f, 0.013767f, 0.015189f, 0.008295f, 0.0f,-0.004930f,-0.005537f,-0.003285f, 0.0f
+};
+
+const float ica_sincInterp6[2*SINC_ORDER1+1] =
+{
+ 0.0f,-0.003484f,-0.007192f,-0.010460f,-0.011712f,-0.008798f, 0.0f, 0.014603f, 0.032045f, 0.046341f, 0.049731f, 0.035255f,
+ 0.0f,-0.052090f,-0.109007f,-0.151947f,-0.159196f,-0.111867f, 0.0f, 0.172831f, 0.388013f, 0.614328f, 0.814030f, 0.951171f,
+ 1.0f, 0.951171f, 0.814030f, 0.614328f, 0.388013f, 0.172831f, 0.0f,-0.111867f,-0.159196f,-0.151947f,-0.109007f,-0.052090f,
+ 0.0f, 0.035255f, 0.049731f, 0.046341f, 0.032045f, 0.014603f, 0.0f,-0.008798f,-0.011712f,-0.010460f,-0.007192f,-0.003484f, 0.0f
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Stereo IC-BWE ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const float icbwe_gsMapping_tbl[16] =
+{
+ -2.0000000f, -1.3494960f, -0.9607952f, -0.7098941f, -0.5589364f, -0.4453763f, -0.3429649f, -0.2527705f,
+ -0.1690688f, -0.0987095f, -0.0700000f, -0.0500000f, -0.0200000f, 0.0000000f, 0.0400000f, 0.0800000f
+};
+
+const float icbwe_gsMappingDFT_tbl[128] =
+{
+ -5.0000000f, -4.5000000f, -4.0000000f, -3.5000000f, -3.0000000f, -2.5000000f, -1.9000000f, -1.5474502f,
+ -1.5002078f, -1.4469336f, -1.3902478f, -1.3770106f, -1.3094972f, -1.2608015f, -1.0926061f, -1.0843442f,
+ -1.0345038f, -1.0286606f, -1.0161779f, -1.0036838f, -0.9812821f, -0.9698121f, -0.9573308f, -0.9405646f,
+ -0.9297086f, -0.9131601f, -0.9025761f, -0.8860643f, -0.8736950f, -0.8564931f, -0.8403996f, -0.8352164f,
+ -0.8241847f, -0.8038731f, -0.7923367f, -0.7789138f, -0.7679189f, -0.7595301f, -0.7566783f, -0.7507762f,
+ -0.7428076f, -0.7386452f, -0.7339793f, -0.7300271f, -0.7243238f, -0.7188097f, -0.7090309f, -0.7047743f,
+ -0.7000968f, -0.6903794f, -0.6844128f, -0.6792722f, -0.6724832f, -0.6680448f, -0.6638050f, -0.6587732f,
+ -0.6519668f, -0.6454810f, -0.6418348f, -0.6352437f, -0.6296001f, -0.6244346f, -0.6182194f, -0.6134241f,
+ -0.6093079f, -0.6042419f, -0.5995789f, -0.5946505f, -0.5897729f, -0.5851547f, -0.5806601f, -0.5759744f,
+ -0.5720182f, -0.5669503f, -0.5630283f, -0.5573819f, -0.5511614f, -0.5438205f, -0.5364699f, -0.5282783f,
+ -0.5198154f, -0.5095584f, -0.4986083f, -0.4861976f, -0.4725366f, -0.4591254f, -0.4449745f, -0.4310394f,
+ -0.4169318f, -0.4033374f, -0.3898838f, -0.3766562f, -0.3616849f, -0.3472800f, -0.3326788f, -0.3194550f,
+ -0.3060711f, -0.2916924f, -0.2783983f, -0.2642500f, -0.2506378f, -0.2368909f, -0.2203000f, -0.2036115f,
+ -0.1869981f, -0.1709912f, -0.1561569f, -0.1420659f, -0.1263750f, -0.1107119f, -0.0953914f, -0.0805369f,
+ -0.0660773f, -0.0529481f, -0.0401913f, -0.0287031f, -0.0184659f, -0.0094214f, 0.0000000f, 0.0073561f,
+ 0.0155180f, 0.0224511f, 0.0298570f, 0.0375954f, 0.0457853f, 0.0549424f, 0.0659733f, 0.0785186f
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * TD Stereo ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const float tdm_ratio_tabl[TDM_NQ+1] =
+{
+ 0.00f, 0.00f, 0.0109f, 0.0245f, 0.0432f, 0.0670f, 0.0955f, 0.1284f,
+ 0.1654f, 0.2061f, 0.2500f, 0.2966f, 0.3455f, 0.3960f, 0.4477f, 0.5000f,
+ 0.5523f, 0.6040f, 0.6545f, 0.7034f, 0.7500f, 0.7939f, 0.8346f, 0.8716f,
+ 0.9045f, 0.9330f, 0.9568f, 0.9755f, 0.9891f, 1.0000f, 1.0000f, 1.0000f
+};
+const float tdm_den_ratio_tabl[TDM_NQ+1] = /* 1.0f/(2*LR_ratio*LR_ratio-2*LR_ratio+1) */
+{
+ 1.0000f, 1.0000f, 1.0221f, 1.0501f, 1.0902f, 1.1429f, 1.2088f, 1.2884f,
+ 1.3815f, 1.4864f, 1.6000f, 1.7161f, 1.8257f, 1.9171f, 1.9784f, 2.0000f,
+ 1.9784f, 1.9171f, 1.8257f, 1.7161f, 1.6000f, 1.4864f, 1.3815f, 1.2884f,
+ 1.2088f, 1.1429f, 1.0902f, 1.0501f, 1.0221f, 1.0000f, 1.0000f, 1.0000f
+};
+
+#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+const int16_t tdm_bit_allc_tbl[5][6] =
+{
+ /* IC -- UC -- GC -- TM --AC */
+ { 1650, 3500, 0, 4400, 0, 5000 }, /* IVAS_13k2 */
+ { 1650, 3500, 0, 5000, 0, 5000 }, /* IVAS_16k4 */
+ { 1650, 3500, 0, 6000, 0, 5000 }, /* IVAS_24k4 */
+ { 1650, 6050, 0, 10000, 0, 10000 }, /* IVAS_32k */
+ { 1650, 6050, 0, 13000, 0, 14000 } /* IVAS_48k */
+};
+#else
+const int16_t tdm_bit_allc_tbl[5][6] =
+{
+ /* IC -- UC -- GC -- TM --AC */
+ { 1600, 3450, 0, 4400, 0, 5000 }, /* IVAS_13k2 */
+ { 1600, 3450, 0, 5000, 0, 5000 }, /* IVAS_16k4 */
+ { 1600, 3450, 0, 6000, 0, 5000 }, /* IVAS_24k4 */
+ { 1600, 6000, 0, 10000, 0, 10000 }, /* IVAS_32k */
+ { 1600, 6000, 0, 13000, 0, 14000 } /* IVAS_48k */
+};
+#endif
+
+#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+/* LSFs Intra-frame prediction tables */
+#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+const float tdm_LSF_MEAN_RE_USE_OUT[M] =
+{
+ 301.292f, 521.300f, 870.818f, 1340.278f, 1712.099f, 2091.456f, 2488.523f, 2841.096f, 3196.565f, 3593.040f, 3958.366f, 4293.334f, 4710.319f, 5118.806f, 5546.761f, 5918.579f,
+};
+
+const float tdm_LSF_MEAN_RE_USE_IN[M] =
+{
+ 286.414f, 522.366f, 887.297f, 1347.961f, 1725.604f, 2102.356f, 2511.703f, 2853.093f, 3211.319f, 3612.072f, 3970.889f, 4327.774f, 4732.423f, 5154.984f, 5572.849f, 5964.332f,
+};
+
+const float tdm_LSF_MEAN_RE_USE[M] =
+{
+ 265.534222F, 534.776631F, 919.574509F, 1346.991675F, 1756.991835F, 2123.061862F, 2556.845807F, 2927.484493F,
+ 3299.107307F, 3686.249102F, 4034.473656F, 4393.818819F, 4781.683038F, 5155.954294F, 5542.569582F, 5927.377309F
+};
+
+const float tdm_Beta_Q1bit_re_use_132[2] = { 0.97F, 0.75F };
+const float tdm_Beta_Q1bit_re_use_164[2] = { 0.95F, 0.71F };
+const float tdm_Beta_Q1bit_re_use_244_320[2] = { 0.93F, 0.73F };
+const float tdm_Beta_Q1bit_re_use_480[2] = { 0.97F, 0.77F };
+
+const float tdm_RE_USE_adaptive_beta_prd_diag_3[15 + 16 + 15] =
+{
+ 0.8859f, 0.2060f,
+ 0.0585f, 0.8245f, 0.2294f,
+ 0.0365f, 0.8175f, 0.1696f,
+ -0.0060f, 0.8483f, 0.2061f,
+ 0.0663f, 0.8983f, 0.1357f,
+ 0.0664f, 0.7951f, 0.1934f,
+ 0.0935f, 0.7948f, 0.1685f,
+ 0.1109f, 0.7960f, 0.1828f,
+ 0.1073f, 0.7835f, 0.1804f,
+ 0.1479f, 0.7362f, 0.1982f,
+ 0.1335f, 0.7621f, 0.1900f,
+ 0.1903f, 0.7369f, 0.1715f,
+ 0.1785f, 0.7214f, 0.1646f,
+ 0.1967f, 0.6891f, 0.1229f,
+ 0.2043f, 0.6317f, 0.0543f,
+ 0.1767f, 0.5396f,
+};
+#endif
+
+const float tdm_LSF_MEAN_PRED_QNT[M] =
+{
+ 391.31345F, 608.50453F, 968.00585F, 1354.23965F, 1709.71084F, 2080.49872F, 2450.64009F, 2796.96588F,
+ 3196.19608F, 3554.17092F, 3915.02370F, 4283.81121F, 4707.59835F, 5109.79026F, 5526.44936F, 5903.42625F
+};
+
+const float tdm_LSF_MEAN_PRED_QNT_IN[M] =
+{
+ 288.540f, 535.469f, 899.738f, 1342.313f, 1730.736f, 2107.070f, 2491.455f, 2859.828f, 3239.279f, 3625.673f, 3992.540f, 4356.748f, 4752.356f, 5153.685f, 5567.107f, 5972.623f,
+};
+const float tdm_LSF_MEAN_PRED_QNT_OUT[M] =
+{
+ 286.414f, 522.366f, 887.297f, 1347.961f, 1725.604f, 2102.356f, 2511.703f, 2853.093f, 3211.319f, 3612.072f, 3970.889f, 4327.774f, 4732.423f, 5154.984f, 5572.849f, 5964.332f,
+};
+
+const float tdm_PRED_QNT_fixed_beta_prd_diag_3[15 + 16 + 15] =
+{
+ 0.7040f, 0.1203f,
+ -0.1119f, 0.7340f, 0.1803f,
+ 0.0253f, 0.6702f, 0.1901f,
+ -0.1847f, 0.7892f, 0.3010f,
+ -0.0418f, 0.8716f, 0.1837f,
+ 0.0033f, 0.6915f, 0.2394f,
+ 0.0213f, 0.6728f, 0.2441f,
+ 0.0705f, 0.7549f, 0.1983f,
+ 0.0752f, 0.7152f, 0.2173f,
+ 0.0886f, 0.6163f, 0.3067f,
+ 0.0217f, 0.8121f, 0.2021f,
+ 0.1584f, 0.7311f, 0.1746f,
+ 0.1204f, 0.7296f, 0.1978f,
+ 0.1231f, 0.7502f, 0.1234f,
+ 0.1709f, 0.6372f, 0.1060f,
+ 0.1193f, 0.6574f,
+};
+#endif
+
+
+/*----------------------------------------------------------------------------------*
+ * MDCT Stereo ROM tables
+ *----------------------------------------------------------------------------------*/
+
+ /* PsychLPC */
+
+const SpectrumWarping sw32000Hz[] =
+{{
+ {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6,
+ 6, 8, 8, 8, 8, 8, 10, 10, 10, 10, 12, 12, 12, 12, 14, 14,
+ 14, 16, 18, 18, 18, 20, 22, 22, 22, 24, 26, 26, 26, 28, 30, 32
+ },
+ {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5,
+ 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10
+ },
+}};
+
+const SpectrumWarping sw25600Hz[] =
+{{
+ {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6,
+ 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 10, 12, 12, 12, 12,
+ 12, 12, 14, 14, 14, 14, 14, 16, 16, 18, 18, 18, 18, 18, 20, 20
+ },
+ {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7
+ },
+}};
+
+const SpectrumWarping sw16000Hz[] =
+{{
+ {
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
+ },
+ {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
+ },
+}};
+
+const MDCTStereoBands_config mdctStereoBands_32000_640[] =
+{{
+ /*TCX 20*/
+ { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 8, 8, 8, 8, 8, 8, 8, 12, 12, 12,
+ 12, 20, 20, 20, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 42,
+ 64, 64, 96, 160},
+ {44, 41,38, 29},/*number of bands for frame lengths 960, 640, 512, 320 respectively*/
+
+ /*TCX 10*/
+ {
+ 4, 4, 4, 4, 4, 8, 8, 8, 8, 12,
+ 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 20, 32, 32,
+ 32, 48, 80
+ },
+ {33, 29, 26, 18}/*number of bands for frame lengths 480, 320, 256, 160 respectively*/
+}};
+
+const float nf_tw_smoothing_coeffs[N_LTP_GAIN_MEMS] =
+{
+ 0.4f,0.2f,0.2f,0.2f
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Stereo DTX tables
+ *----------------------------------------------------------------------------------*/
+
+const float dft_cng_coh_pred[STEREO_DFT_N_COH_PRED][STEREO_DFT_COH_PRED_COEFFS] =
+{
+ { 0.601337f, -0.101048f, 1.269064f, 0.085044f, 0.279032f, 0.669925f, 0.081573f, 0.188857f, -0.172930f, 0.321477f, 0.009332f, -0.084341f, 0.362245f, -0.426671f, 0.758383f},
+ { 0.855349f, 0.420736f, 0.413285f, -0.009366f, -0.399699f, 1.385802f, 0.012428f, -0.015338f, 0.156471f, 0.517438f, 0.160248f, -0.303634f, 0.477768f, -0.560747f, 1.382583f},
+ { 0.202543f, 0.048819f, 0.263407f, 0.023538f, 0.092021f, 0.395655f, 0.013064f, -0.011127f, 0.035466f, 0.976055f, 0.009968f, 0.162957f, 0.383185f, -0.365493f, 2.534677f},
+ { 1.393664f, -0.131401f, 0.989429f, 0.738330f, 0.683865f, 0.001677f, -0.225448f, -0.012158f, 1.084608f, -0.115464f, 0.022371f, -0.045560f, -0.336230f, 0.422742f, 0.499163f}
+};
+
+const int16_t dft_cng_coh_u2i[9] = { 4, 5, 3, 6, 2, 7, 1, 8, 0 }; /* Coherence unary codeword -> residual codeword conversion table */
+
+const int16_t dft_cng_coh_i2u[9] = { 8, 6, 4, 2, 0, 1, 3, 5, 7 }; /* Coherence residual codeword -> unary codeword conversion table */
+
+const int16_t dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1] = { 15, 16, 17, 18 };
+
+const float dft_cng_alpha_bits[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS] =
+{
+ { 0.1f, 0.6f },
+ { 0.1f, 0.6f },
+ { 0.1f, 0.7f },
+ { 0.1f, 0.9f },
+ { 0.2f, 0.9f }
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * DirAC ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const float diffuseness_reconstructions[DIRAC_DIFFUSE_LEVELS] =
+{
+ 0.0f,
+ 0.03955078125f,
+ 0.089599609375f,
+ 0.158935546875f,
+ 0.308349609375f,
+ 0.473876953125f,
+ 0.63232421875f,
+ 0.85009765625f
+};
+
+const float diffuseness_thresholds[DIRAC_DIFFUSE_LEVELS + 1] =
+{
+ 0.0f,
+ 0.01904296875f,
+ 0.06298828125f,
+ 0.119384765625f,
+ 0.22119140625f,
+ 0.399169921875f,
+ 0.547607421875f,
+ 0.734619140625f,
+ 2.0f /* out-of-range large value to make searching easier */
+};
+
+const int16_t DirAC_band_grouping_12[12 + 1] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 11, 17, 25, 40, 60
+};
+
+
+const int16_t DirAC_band_grouping_6[6 + 1] =
+{
+ 0, 1, 4, 8, 20, 30, 60
+};
+
+const int16_t DirAC_band_grouping_5[5 + 1] =
+{
+ 0, 1, 3, 7, 15, 60
+};
+
+const int16_t DirAC_block_grouping[MAX_PARAM_SPATIAL_SUBFRAMES + 1] =
+{
+ 0, 4, 8, 12, 16
+};
+
+const int16_t DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES + 1] =
+{
+ 0, 1, 2, 3, 4
+};
+
+
+
+/*----------------------------------------------------------------------*
+* SPAR ROM tables
+*-----------------------------------------------------------------------*/
+
+const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] =
+{
+/* When AGC is ON additional (AGC_BITS_PER_CH+1) bits may be taken from each EVS channel
+ so minimum EVS bitrate per channel can be min EVS bitrates as per the table - AGC_BITS_PER_CH */
+ { 24400, 0, 1, FB, 24000, 1, WYXZ, 1, 0,{ { 16400, 15200, 24350 } },
+ { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 },
+
+ { 32000, 0, 1, FB, 24000, 1, WYXZ, 1, 0,{{ 24000, 20450, 31950 }},{ { 21, 1, 5, 1 },{ 15, 1, 5, 1 },{ 15, 1, 3, 1 } }, 0, 0, 0 },
+
+ { 48000, 0, 1, FB, 24000, 2, WYXZ, 0, 0,{ { 24000, 21000, 31950 },{ 16000, 15000, 20400 } },
+ { { 15, 7, 5, 1 },{ 15, 7, 3, 1 },{ 7, 7, 3, 1 } }, 1, 0, 0 },
+
+ { 64000, 0, 1, FB, 24000, 2, WYXZ, 0, 0,{ { 38000, 34050, 56000 },{ 16000, 15600, 20400 } },{ { 21, 7, 5, 1 },{ 15, 7, 5, 1 },{ 15, 7, 3, 1 } }, 1, 1, 0 },
+
+ { 80000, 0, 1, FB, 24000, 2, WYXZ, 0, 0,{ { 46000, 43000, 56000 },{ 24000, 23000, 31950 } },
+ { { 21, 7, 5, 1 },{ 15, 7, 5, 1 },{ 15, 7, 3, 1 } }, 1, 0, 0 },
+
+ { 96000, 0, 1, FB, 24000, 3, WYXZ, 0, 0,{ { 47000, 42600, 56000 },{ 23000, 22600, 31950 },{ 16000, 15600, 20400 } },
+ { { 21, 9, 9, 1 },{ 21, 7, 5, 1 },{ 21, 7, 5, 1 } }, 1, 0, 0 },
+
+ { 128000, 0, 1, FB, 24000, 3, WYXZ, 0, 0,{ { 55000, 50000, 56000 },{ 36000, 36000, 56000 },{ 27000, 27000, 31950 } },
+ { { 21, 11, 9, 1 },{ 21, 9, 7, 1 },{ 21, 7, 7, 1 } }, 1, 0, 0 },
+
+ { 160000, 0, 1, FB, 24000, 3, WYXZ, 0, 0,{ { 74000, 70900, 112000 },{ 41000, 40050, 56000 },{ 35000, 34050, 56000 } },
+ { { 21, 11, 11, 1 },{ 21, 9, 9, 1 },{ 21, 7, 7, 1 } }, 1, 0, 0 },
+
+ { 192000, 0, 1, FB, 24000, 3, WYXZ, 0, 0,{ { 90000, 87900, 112000 },{ 50000, 48050, 56000 },{ 42000, 41050, 56000 } },
+ { { 21, 11, 11, 1 },{ 21, 9, 9, 1 },{ 21, 7, 7, 1 } }, 1, 0, 0 },
+
+ { 256000, 0, 1, FB, 24000, 4, WYXZ, 0, 0,{ { 90000, 85000, 112000 },{ 70000, 69000, 112000 },{ 50000, 48950, 56000 },{ 36400, 35600, 56000 } },
+ { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 256000, 0, 2, FB, 24000, 4, WYXZ, 0, 0,{ { 84650, 83000, 112000 },{ 65850, 64550, 56000 },{ 47000, 46100, 48000 },{ 28200, 27650, 40000 } },
+ { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 256000, 0, 3, FB, 24000, 4, WYXZ, 0, 0,{ { 76300, 73550, 112000 },{ 59350, 57200, 56000 },{ 42400, 40850, 48000 },{ 25450, 24500, 40000 } },
+ { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 31, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 384000, 0, 1, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 100000, 100000, 128000 },{ 79850, 79850, 104000 },{ 66600, 66600, 104000 } }, // not yet optimized
+ { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 384000, 0, 2, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 105350, 103300, 112000 },{ 75200, 73750, 96000 },{ 45100, 44250, 48000 } }, // just added as a place holder, not necessarily operational
+ { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 384000, 0, 3, FB, 24000, 4, WYXZ, 0, 0,{ { 124300, 121550, 128000 },{ 96700, 94550, 112000 },{ 69050, 67500, 96000 },{ 41450, 40500, 48000 } }, // just added as a place holder, not necessarily operational
+ { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 512000, 0, 1, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 128000, 128000, 128000 }, {118450, 118450, 128000 } }, // not yet optimized
+ { { 31, 1, 1, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 512000, 0, 2, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 97700, 93300, 128000 } }, // not yet optimized
+ { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+ { 512000, 0, 3, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 128000, 128000, 128000 },{ 127200, 122550, 128000 },{ 76300, 73550, 128000 } }, // not yet optimized
+ { { 31, 11, 11, 1 },{ 1, 1, 1, 1 },{ 1, 1, 1, 1 } }, 1, 2, 0 },
+
+
+};
+
+#ifdef FIX_SBA_CLEAN_UP_OPT
+const ivas_freq_models_t ivas_arith_pred_r_consts[TOTAL_PRED_QUANT_STRATS_ARITH] =
+{
+ /* entry for 1 quantization points */
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 7 quantization points for br_table_idx >= 2 */
+ {
+ /* pred_R real */
+ {
+ { 0,546,1092,2184,8740,2184,1092,546, },
+ { 0,1779,2116,2516,3562,2516,2116,1779, },
+ { 0,1848,2614,5229,2614,1848,1307,924, },
+ { 0,924,1307,1848,2614,5229,2614,1848, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* pred_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 15 quantization points for br_table_idx >= 2 */
+ {
+ /* pred_R real */
+ {
+ { 0,32,64,128,257,514,1028,2056,8226,2056,1028,514,257,128,64,32, },
+ { 0,565,672,799,950,1130,1344,1598,2268,1598,1344,1130,950,799,672,565, },
+ { 0,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353,250,176, },
+ { 0,176,250,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, },
+ },
+ /* pred_R real : values for general and differential */
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 21 quantization points for br_table_idx >= 2 */
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 31 quantization points */
+ {
+ /* pred real */
+ {
+ { 0,1,1,1,1,2,4,8,16,32,64,128,256,512,1024,2048,8188,2048,1024,512,256,128,64,32,16,8,4,2,1,1,1,1, },
+ { 0,110,131,156,186,221,263,313,373,443,527,627,746,887,1055,1255,1798,1255,1055,887,746,627,527,443,373,313,263,221,186,156,131,110, },
+ { 0,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20,14,10, },
+ { 0,10,14,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20, }
+ },
+ /* pred real differential */
+ {
+ { 0,1,1,1,1,1,1,1,1,1,3,12,39,125,397,1260,12694,1260,397,125,39,12,3,1,1,1,1,1,1,1,1,1, },
+ { 0,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1, },
+ { 0,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1,1, },
+ { 0,1,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1, }
+ },
+ /* pred real : values for general and differential */
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ /* pred real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 7 quantization points for br_table_idx < 2 */
+ {
+ /* pred_R real */
+ {
+ { 0,327,778,1851,10472,1851,778,327, },
+ { 0,1057,1630,2514,5982,2514,1630,1057, },
+ { 0,1668,2572,6122,2572,1668,1081,701, },
+ { 0,701,1081,1668,2572,6122,2572,1668, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* pred_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 15 quantization points for br_table_idx < 2 */
+ {
+ /* pred real */
+ {
+ { 0,9,23,56,133,318,757,1800,10192,1800,757,318,133,56,23,9, },
+ { 0,156,240,371,573,883,1363,2102,5008,2102,1363,883,573,371,240,156, },
+ { 0,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241,156,101, },
+ { 0,101,156,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241, }
+ },
+ /* pred real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, }
+ },
+ /* pred real : values for general and differential */
+ {-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7},
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 21 quantization points for br_table_idx < 2 */
+ {
+ /* pred_R real */
+ {
+ { 0,1,1,4,9,23,56,133,318,756,1799,10184,1799,756,318,133,56,23,9,4,1,1, },
+ { 0,41,64,98,152,234,362,558,861,1329,2049,4888,2049,1329,861,558,362,234,152,98,64,41, },
+ { 0,64,98,152,235,362,559,862,1330,2051,4891,2051,1330,862,559,362,235,152,98,64,41,26, },
+ { 0,26,41,64,98,152,235,362,559,862,1330,2051,4891,2051,1330,862,559,362,235,152,98,64, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ }
+};
+
+ const ivas_freq_models_t ivas_arith_drct_r_consts[TOTAL_DRCT_QUANT_STRATS] =
+{
+ /* entry for 1 quantization points */
+ {
+ /* drct real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct real : values for general and differential */
+ {0},{ 0 },
+ /* drct real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 7 quantization points */
+ { /* drct real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 9 quantization points */
+ {
+ /* drct real */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,573,722,909,1146,1444,1819,2292,2888,4591, },
+ { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
+ },
+ /* drct real differential */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,716,1276,2274,7225,2274,1276,716,402,225, },
+ { 0,225,402,716,1276,2274,7225,2274,1276,716, }
+ },
+ /* drct real : values for general and differential */
+ { -4,-3,-2,-1,0,1,2,3,4 },{ -4,-3,-2,-1,0,1,2,3,4 },
+ /* drct real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 11 quantization points */
+ {
+ /* drct real */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,343,433,546,687,866,1092,1375,1733,2184,2751,4374, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* drct real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* drct real : values for general and differential */
+ { -5,-4,-3,-2,-1,0,1,2,3,4,5 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* drct real : num dyn models for general and differential */
+ 4, 4
+ }
+};
+
+ const ivas_freq_models_t ivas_arith_decd_r_consts[TOTAL_DECD_QUANT_STRATS] =
+{
+ /* entry for 1 quantization points */
+ {
+ /* decd real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 3 quantization points */
+ {
+ /* decd real */
+ {
+ { 0,11917,2978,1489, },
+ { 0,8840,4419,3125, },
+ { 0,4567,7250,4567, },
+ { 0,5203,5978,5203, },
+ },
+ /* decd real differential */
+ {
+ { 0,1356,13672,1356, },
+ { 0,3166,10052,3166, },
+ { 0,10984,3459,1941, },
+ { 0,1941,3459,10984, },
+ },
+ /* decd real : values for general and differential */
+ { 0,1,2 },{-1,0,1},
+ /* decd real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 5 quantization points */
+ {
+ /* decd real */
+ {
+ { 0,11157,2788,1394,697,348, },
+ { 0,7186,3592,2540,1796,1270, },
+ { 0,2512,3166,5028,3166,2512, },
+ { 0,3048,3267,3754,3267,3048, },
+ },
+ /* decd real differential */
+ {
+ { 0,406,1289,12994,1289,406, },
+ { 0,1460,2601,8262,2601,1460, },
+ { 0,2707,8599,2707,1519,852, },
+ { 0,852,1519,2707,8599,2707, },
+ },
+ /* decd real : values for general and differential */
+ { 0,1,2,3,4 },{ -2,-1,0,1,2 },
+ /* decd real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 7 quantization points */
+ {
+ /* decd real */
+ {
+ { 0,10983,2744,1372,686,343,171,85, },
+ { 0,6573,3285,2322,1642,1161,821,580, },
+ { 0,1603,2020,2546,4046,2546,2020,1603, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* decd real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, }
+ },
+ /* decd real : values for general and differential */
+ { 0,1,2,3,4,5,6 },{ -3,-2,-1,0,1,2,3 },
+ /* decd real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 9 quantization points */
+ { /* decd real */
+ {
+ { 0,10941,2734,1367,683,341,170,85,42,21, },
+ { 0,6305,3150,2227,1575,1113,787,556,393,278, },
+ { 0,1101,1388,1749,2203,3502,2203,1749,1388,1101, },
+ { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
+ },
+ /* decd real differential */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,716,1276,2274,7225,2274,1276,716,402,225, },
+ { 0,225,402,716,1276,2274,7225,2274,1276,716, }
+ },
+ /* decd real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8 },{ -4,-3,-2,-1,0,1,2,3,4 },
+ /* decd real : num dyn models for general and differential */
+ 4, 4
+ },
+ /* entry for 11 quantization points */
+ {
+ /* decd real */
+ {
+ { 0,10932,2731,1365,682,341,170,85,42,21,10,5, },
+ { 0,6181,3086,2182,1543,1091,771,545,385,272,192,136, },
+ { 0,790,995,1254,1580,1991,3164,1991,1580,1254,995,790, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* decd real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* decd real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8,9,10 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* decd real : num dyn models for general and differential */
+ 4, 4
+ }
+};
+#else
+const ivas_arith_consts_t ivas_arith_consts[IVAS_SPAR_BR_TABLE_LEN][MAX_QUANT_STRATS] =
+{
+ /* tbl_idx 0 -- 24.4kbps FOA */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,9,23,56,133,318,757,1800,10192,1800,757,318,133,56,23,9, },
+ { 0,156,240,371,573,883,1363,2102,5008,2102,1363,883,573,371,240,156, },
+ { 0,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241,156,101, },
+ { 0,101,156,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, },
+ },
+ /* pred_R real : values for general and differential */
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11157,2788,1394,697,348, },
+ { 0,7186,3592,2540,1796,1270, },
+ { 0,2512,3166,5028,3166,2512, },
+ { 0,3048,3267,3754,3267,3048, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,406,1289,12994,1289,406, },
+ { 0,1460,2601,8262,2601,1460, },
+ { 0,2707,8599,2707,1519,852, },
+ { 0,852,1519,2707,8599,2707, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4 },{ -2,-1,0,1,2 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,9,23,56,133,318,757,1800,10192,1800,757,318,133,56,23,9, },
+ { 0,156,240,371,573,883,1363,2102,5008,2102,1363,883,573,371,240,156, },
+ { 0,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241,156,101, },
+ { 0,101,156,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, },
+ },
+ /* pred_R real : values for general and differential */
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11917,2978,1489, },
+ { 0,8840,4419,3125, },
+ { 0,4567,7250,4567, },
+ { 0,5203,5978,5203, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,1356,13672,1356, },
+ { 0,3166,10052,3166, },
+ { 0,10984,3459,1941, },
+ { 0,1941,3459,10984, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2 },{ -1,0,1 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,327,778,1851,10472,1851,778,327, },
+ { 0,1057,1630,2514,5982,2514,1630,1057, },
+ { 0,1668,2572,6122,2572,1668,1081,701, },
+ { 0,701,1081,1668,2572,6122,2572,1668, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* pred_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11917,2978,1489, },
+ { 0,8840,4419,3125, },
+ { 0,4567,7250,4567, },
+ { 0,5203,5978,5203, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,1356,13672,1356, },
+ { 0,3166,10052,3166, },
+ { 0,10984,3459,1941, },
+ { 0,1941,3459,10984, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2 },{ -1,0,1 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 1 -- 32kbps FOA */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,1,1,4,9,23,56,133,318,756,1799,10184,1799,756,318,133,56,23,9,4,1,1, },
+ { 0,41,64,98,152,234,362,558,861,1329,2049,4888,2049,1329,861,558,362,234,152,98,64,41, },
+ { 0,64,98,152,235,362,559,862,1330,2051,4891,2051,1330,862,559,362,235,152,98,64,41,26, },
+ { 0,26,41,64,98,152,235,362,559,862,1330,2051,4891,2051,1330,862,559,362,235,152,98,64, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11157,2788,1394,697,348, },
+ { 0,7186,3592,2540,1796,1270, },
+ { 0,2512,3166,5028,3166,2512, },
+ { 0,3048,3267,3754,3267,3048, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,406,1289,12994,1289,406, },
+ { 0,1460,2601,8262,2601,1460, },
+ { 0,2707,8599,2707,1519,852, },
+ { 0,852,1519,2707,8599,2707, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4 },{ -2,-1,0,1,2 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,9,23,56,133,318,757,1800,10192,1800,757,318,133,56,23,9, },
+ { 0,156,240,371,573,883,1363,2102,5008,2102,1363,883,573,371,240,156, },
+ { 0,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241,156,101, },
+ { 0,101,156,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, },
+ },
+ /* pred_R real : values for general and differential */
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11157,2788,1394,697,348, },
+ { 0,7186,3592,2540,1796,1270, },
+ { 0,2512,3166,5028,3166,2512, },
+ { 0,3048,3267,3754,3267,3048, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,406,1289,12994,1289,406, },
+ { 0,1460,2601,8262,2601,1460, },
+ { 0,2707,8599,2707,1519,852, },
+ { 0,852,1519,2707,8599,2707, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4 },{ -2,-1,0,1,2 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,9,23,56,133,318,757,1800,10192,1800,757,318,133,56,23,9, },
+ { 0,156,240,371,573,883,1363,2102,5008,2102,1363,883,573,371,240,156, },
+ { 0,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241,156,101, },
+ { 0,101,156,241,372,575,886,1367,2109,5027,2109,1367,886,575,372,241, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, },
+ },
+ /* pred_R real : values for general and differential */
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11917,2978,1489, },
+ { 0,8840,4419,3125, },
+ { 0,4567,7250,4567, },
+ { 0,5203,5978,5203, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,1356,13672,1356, },
+ { 0,3166,10052,3166, },
+ { 0,10984,3459,1941, },
+ { 0,1941,3459,10984, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2 },{ -1,0,1 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 2 -- 48kbps FOA */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,32,64,128,257,514,1028,2056,8226,2056,1028,514,257,128,64,32, },
+ { 0,565,672,799,950,1130,1344,1598,2268,1598,1344,1130,950,799,672,565, },
+ { 0,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353,250,176, },
+ { 0,176,250,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, },
+ },
+ /* pred_R real : values for general and differential */
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11157,2788,1394,697,348, },
+ { 0,7186,3592,2540,1796,1270, },
+ { 0,2512,3166,5028,3166,2512, },
+ { 0,3048,3267,3754,3267,3048, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,406,1289,12994,1289,406, },
+ { 0,1460,2601,8262,2601,1460, },
+ { 0,2707,8599,2707,1519,852, },
+ { 0,852,1519,2707,8599,2707, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4 },{ -2,-1,0,1,2 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,32,64,128,257,514,1028,2056,8226,2056,1028,514,257,128,64,32, },
+ { 0,565,672,799,950,1130,1344,1598,2268,1598,1344,1130,950,799,672,565, },
+ { 0,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353,250,176, },
+ { 0,176,250,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, },
+ },
+ /* pred_R real : values for general and differential */
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11917,2978,1489, },
+ { 0,8840,4419,3125, },
+ { 0,4567,7250,4567, },
+ { 0,5203,5978,5203, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,1356,13672,1356, },
+ { 0,3166,10052,3166, },
+ { 0,10984,3459,1941, },
+ { 0,1941,3459,10984, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2 },{ -1,0,1 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,546,1092,2184,8740,2184,1092,546, },
+ { 0,1779,2116,2516,3562,2516,2116,1779, },
+ { 0,1848,2614,5229,2614,1848,1307,924, },
+ { 0,924,1307,1848,2614,5229,2614,1848, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* pred_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11917,2978,1489, },
+ { 0,8840,4419,3125, },
+ { 0,4567,7250,4567, },
+ { 0,5203,5978,5203, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,1356,13672,1356, },
+ { 0,3166,10052,3166, },
+ { 0,10984,3459,1941, },
+ { 0,1941,3459,10984, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2 },{ -1,0,1 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 3 -- 64kbps FOA */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11157,2788,1394,697,348, },
+ { 0,7186,3592,2540,1796,1270, },
+ { 0,2512,3166,5028,3166,2512, },
+ { 0,3048,3267,3754,3267,3048, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,406,1289,12994,1289,406, },
+ { 0,1460,2601,8262,2601,1460, },
+ { 0,2707,8599,2707,1519,852, },
+ { 0,852,1519,2707,8599,2707, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4 },{ -2,-1,0,1,2 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,32,64,128,257,514,1028,2056,8226,2056,1028,514,257,128,64,32, },
+ { 0,565,672,799,950,1130,1344,1598,2268,1598,1344,1130,950,799,672,565, },
+ { 0,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353,250,176, },
+ { 0,176,250,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, },
+ },
+ /* pred_R real : values for general and differential */
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11157,2788,1394,697,348, },
+ { 0,7186,3592,2540,1796,1270, },
+ { 0,2512,3166,5028,3166,2512, },
+ { 0,3048,3267,3754,3267,3048, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,406,1289,12994,1289,406, },
+ { 0,1460,2601,8262,2601,1460, },
+ { 0,2707,8599,2707,1519,852, },
+ { 0,852,1519,2707,8599,2707, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4 },{ -2,-1,0,1,2 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,32,64,128,257,514,1028,2056,8226,2056,1028,514,257,128,64,32, },
+ { 0,565,672,799,950,1130,1344,1598,2268,1598,1344,1130,950,799,672,565, },
+ { 0,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353,250,176, },
+ { 0,176,250,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, },
+ },
+ /* pred_R real : values for general and differential */
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11917,2978,1489, },
+ { 0,8840,4419,3125, },
+ { 0,4567,7250,4567, },
+ { 0,5203,5978,5203, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,1356,13672,1356, },
+ { 0,3166,10052,3166, },
+ { 0,10984,3459,1941, },
+ { 0,1941,3459,10984, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2 },{ -1,0,1 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 4 -- 80kbps FOA */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11157,2788,1394,697,348, },
+ { 0,7186,3592,2540,1796,1270, },
+ { 0,2512,3166,5028,3166,2512, },
+ { 0,3048,3267,3754,3267,3048, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,406,1289,12994,1289,406, },
+ { 0,1460,2601,8262,2601,1460, },
+ { 0,2707,8599,2707,1519,852, },
+ { 0,852,1519,2707,8599,2707, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4 },{ -2,-1,0,1,2 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,32,64,128,257,514,1028,2056,8226,2056,1028,514,257,128,64,32, },
+ { 0,565,672,799,950,1130,1344,1598,2268,1598,1344,1130,950,799,672,565, },
+ { 0,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353,250,176, },
+ { 0,176,250,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, },
+ },
+ /* pred_R real : values for general and differential */
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11157,2788,1394,697,348, },
+ { 0,7186,3592,2540,1796,1270, },
+ { 0,2512,3166,5028,3166,2512, },
+ { 0,3048,3267,3754,3267,3048, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,406,1289,12994,1289,406, },
+ { 0,1460,2601,8262,2601,1460, },
+ { 0,2707,8599,2707,1519,852, },
+ { 0,852,1519,2707,8599,2707, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4 },{ -2,-1,0,1,2 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,32,64,128,257,514,1028,2056,8226,2056,1028,514,257,128,64,32, },
+ { 0,565,672,799,950,1130,1344,1598,2268,1598,1344,1130,950,799,672,565, },
+ { 0,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353,250,176, },
+ { 0,176,250,353,500,707,1000,1414,2000,4010,2000,1414,1000,707,500,353, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,3,12,39,125,397,1260,12710,1260,397,125,39,12,3,1, },
+ { 0,66,119,212,378,674,1201,2140,6804,2140,1201,674,378,212,119,66, },
+ { 0,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119,67,37, },
+ { 0,37,67,119,212,379,675,1203,2144,6816,2144,1203,675,379,212,119, },
+ },
+ /* pred_R real : values for general and differential */
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ { -7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11917,2978,1489, },
+ { 0,8840,4419,3125, },
+ { 0,4567,7250,4567, },
+ { 0,5203,5978,5203, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,1356,13672,1356, },
+ { 0,3166,10052,3166, },
+ { 0,10984,3459,1941, },
+ { 0,1941,3459,10984, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2 },{ -1,0,1 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 5 -- 96kbps FOA */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,573,722,909,1146,1444,1819,2292,2888,4591, },
+ { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,716,1276,2274,7225,2274,1276,716,402,225, },
+ { 0,225,402,716,1276,2274,7225,2274,1276,716, },
+ },
+ /* drct_R real : values for general and differential */
+ { -4,-3,-2,-1,0,1,2,3,4 },{ -4,-3,-2,-1,0,1,2,3,4 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10941,2734,1367,683,341,170,85,42,21, },
+ { 0,6305,3150,2227,1575,1113,787,556,393,278, },
+ { 0,1101,1388,1749,2203,3502,2203,1749,1388,1101, },
+ { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,716,1276,2274,7225,2274,1276,716,402,225, },
+ { 0,225,402,716,1276,2274,7225,2274,1276,716, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8 },{ -4,-3,-2,-1,0,1,2,3,4 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11157,2788,1394,697,348, },
+ { 0,7186,3592,2540,1796,1270, },
+ { 0,2512,3166,5028,3166,2512, },
+ { 0,3048,3267,3754,3267,3048, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,406,1289,12994,1289,406, },
+ { 0,1460,2601,8262,2601,1460, },
+ { 0,2707,8599,2707,1519,852, },
+ { 0,852,1519,2707,8599,2707, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4 },{ -2,-1,0,1,2 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,11157,2788,1394,697,348, },
+ { 0,7186,3592,2540,1796,1270, },
+ { 0,2512,3166,5028,3166,2512, },
+ { 0,3048,3267,3754,3267,3048, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,406,1289,12994,1289,406, },
+ { 0,1460,2601,8262,2601,1460, },
+ { 0,2707,8599,2707,1519,852, },
+ { 0,852,1519,2707,8599,2707, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4 },{ -2,-1,0,1,2 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 6 -- 128kbps FOA */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,343,433,546,687,866,1092,1375,1733,2184,2751,4374, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* drct_R real : values for general and differential */
+ { -5,-4,-3,-2,-1,0,1,2,3,4,5 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10941,2734,1367,683,341,170,85,42,21, },
+ { 0,6305,3150,2227,1575,1113,787,556,393,278, },
+ { 0,1101,1388,1749,2203,3502,2203,1749,1388,1101, },
+ { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,716,1276,2274,7225,2274,1276,716,402,225, },
+ { 0,225,402,716,1276,2274,7225,2274,1276,716, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8 },{ -4,-3,-2,-1,0,1,2,3,4 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,573,722,909,1146,1444,1819,2292,2888,4591, },
+ { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,716,1276,2274,7225,2274,1276,716,402,225, },
+ { 0,225,402,716,1276,2274,7225,2274,1276,716, },
+ },
+ /* drct_R real : values for general and differential */
+ { -4,-3,-2,-1,0,1,2,3,4 },{ -4,-3,-2,-1,0,1,2,3,4 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10983,2744,1372,686,343,171,85, },
+ { 0,6573,3285,2322,1642,1161,821,580, },
+ { 0,1603,2020,2546,4046,2546,2020,1603, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6 },{ -3,-2,-1,0,1,2,3 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10983,2744,1372,686,343,171,85, },
+ { 0,6573,3285,2322,1642,1161,821,580, },
+ { 0,1603,2020,2546,4046,2546,2020,1603, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6 },{ -3,-2,-1,0,1,2,3 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 7 -- 160kbps FOA */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,343,433,546,687,866,1092,1375,1733,2184,2751,4374, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* drct_R real : values for general and differential */
+ { -5,-4,-3,-2,-1,0,1,2,3,4,5 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10932,2731,1365,682,341,170,85,42,21,10,5, },
+ { 0,6181,3086,2182,1543,1091,771,545,385,272,192,136, },
+ { 0,790,995,1254,1580,1991,3164,1991,1580,1254,995,790, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8,9,10 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,573,722,909,1146,1444,1819,2292,2888,4591, },
+ { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,716,1276,2274,7225,2274,1276,716,402,225, },
+ { 0,225,402,716,1276,2274,7225,2274,1276,716, },
+ },
+ /* drct_R real : values for general and differential */
+ { -4,-3,-2,-1,0,1,2,3,4 },{ -4,-3,-2,-1,0,1,2,3,4 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10941,2734,1367,683,341,170,85,42,21, },
+ { 0,6305,3150,2227,1575,1113,787,556,393,278, },
+ { 0,1101,1388,1749,2203,3502,2203,1749,1388,1101, },
+ { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,716,1276,2274,7225,2274,1276,716,402,225, },
+ { 0,225,402,716,1276,2274,7225,2274,1276,716, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8 },{ -4,-3,-2,-1,0,1,2,3,4 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10983,2744,1372,686,343,171,85, },
+ { 0,6573,3285,2322,1642,1161,821,580, },
+ { 0,1603,2020,2546,4046,2546,2020,1603, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6 },{ -3,-2,-1,0,1,2,3 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 8 -- 192kbps FOA */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,343,433,546,687,866,1092,1375,1733,2184,2751,4374, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* drct_R real : values for general and differential */
+ { -5,-4,-3,-2,-1,0,1,2,3,4,5 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10932,2731,1365,682,341,170,85,42,21,10,5, },
+ { 0,6181,3086,2182,1543,1091,771,545,385,272,192,136, },
+ { 0,790,995,1254,1580,1991,3164,1991,1580,1254,995,790, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8,9,10 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,573,722,909,1146,1444,1819,2292,2888,4591, },
+ { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,716,1276,2274,7225,2274,1276,716,402,225, },
+ { 0,225,402,716,1276,2274,7225,2274,1276,716, },
+ },
+ /* drct_R real : values for general and differential */
+ { -4,-3,-2,-1,0,1,2,3,4 },{ -4,-3,-2,-1,0,1,2,3,4 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10941,2734,1367,683,341,170,85,42,21, },
+ { 0,6305,3150,2227,1575,1113,787,556,393,278, },
+ { 0,1101,1388,1749,2203,3502,2203,1749,1388,1101, },
+ { 0,1587,1701,1824,1955,2250,1955,1824,1701,1587, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,39,125,397,1263,12736,1263,397,125,39, },
+ { 0,397,708,1262,2250,7150,2250,1262,708,397, },
+ { 0,716,1276,2274,7225,2274,1276,716,402,225, },
+ { 0,225,402,716,1276,2274,7225,2274,1276,716, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8 },{ -4,-3,-2,-1,0,1,2,3,4 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,4,8,16,32,64,128,256,512,1024,2049,8198,2049,1024,512,256,128,64,32,16,8,4, },
+ { 0,292,348,414,492,585,696,828,984,1171,1392,1980,1392,1171,984,828,696,585,492,414,348,292, },
+ { 0,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119,84,59, },
+ { 0,59,84,119,168,238,336,476,673,952,1346,1904,3817,1904,1346,952,673,476,336,238,168,119, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,3,12,39,125,397,1260,12704,1260,397,125,39,12,3,1,1,1,1, },
+ { 0,11,20,37,66,118,210,375,668,1191,2122,6748,2122,1191,668,375,210,118,66,37,20,11, },
+ { 0,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20,11,6, },
+ { 0,6,11,20,37,66,118,210,375,668,1191,2123,6751,2123,1191,668,375,210,118,66,37,20, },
+ },
+ /* pred_R real : values for general and differential */
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ { -10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,988,1244,1568,1976,2489,3136,4983, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* drct_R real : values for general and differential */
+ { -3,-2,-1,0,1,2,3 },{ -3,-2,-1,0,1,2,3 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10983,2744,1372,686,343,171,85, },
+ { 0,6573,3285,2322,1642,1161,821,580, },
+ { 0,1603,2020,2546,4046,2546,2020,1603, },
+ { 0,2111,2262,2425,2788,2425,2262,2111, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,125,399,1269,12798,1269,399,125, },
+ { 0,744,1327,2365,7512,2365,1327,744, },
+ { 0,1354,2413,7664,2413,1354,760,426, },
+ { 0,426,760,1354,2413,7664,2413,1354, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6 },{ -3,-2,-1,0,1,2,3 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 9 -- 256kbps FOA */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,1,1,1,1,2,4,8,16,32,64,128,256,512,1024,2048,8188,2048,1024,512,256,128,64,32,16,8,4,2,1,1,1,1, },
+ { 0,110,131,156,186,221,263,313,373,443,527,627,746,887,1055,1255,1798,1255,1055,887,746,627,527,443,373,313,263,221,186,156,131,110, },
+ { 0,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20,14,10, },
+ { 0,10,14,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,1,1,1,1,1,3,12,39,125,397,1260,12694,1260,397,125,39,12,3,1,1,1,1,1,1,1,1,1, },
+ { 0,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1, },
+ { 0,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1,1, },
+ { 0,1,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1, },
+ },
+ /* pred_R real : values for general and differential */
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 10 -- 256kbps HOA2 */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,1,1,1,1,2,4,8,16,32,64,128,256,512,1024,2048,8188,2048,1024,512,256,128,64,32,16,8,4,2,1,1,1,1, },
+ { 0,110,131,156,186,221,263,313,373,443,527,627,746,887,1055,1255,1798,1255,1055,887,746,627,527,443,373,313,263,221,186,156,131,110, },
+ { 0,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20,14,10, },
+ { 0,10,14,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,1,1,1,1,1,3,12,39,125,397,1260,12694,1260,397,125,39,12,3,1,1,1,1,1,1,1,1,1, },
+ { 0,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1, },
+ { 0,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1,1, },
+ { 0,1,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1, },
+ },
+ /* pred_R real : values for general and differential */
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,343,433,546,687,866,1092,1375,1733,2184,2751,4374, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* drct_R real : values for general and differential */
+ { -5,-4,-3,-2,-1,0,1,2,3,4,5 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10932,2731,1365,682,341,170,85,42,21,10,5, },
+ { 0,6181,3086,2182,1543,1091,771,545,385,272,192,136, },
+ { 0,790,995,1254,1580,1991,3164,1991,1580,1254,995,790, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8,9,10 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 11 -- 256kbps HOA3 */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,1,1,1,1,2,4,8,16,32,64,128,256,512,1024,2048,8188,2048,1024,512,256,128,64,32,16,8,4,2,1,1,1,1, },
+ { 0,110,131,156,186,221,263,313,373,443,527,627,746,887,1055,1255,1798,1255,1055,887,746,627,527,443,373,313,263,221,186,156,131,110, },
+ { 0,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20,14,10, },
+ { 0,10,14,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,1,1,1,1,1,3,12,39,125,397,1260,12694,1260,397,125,39,12,3,1,1,1,1,1,1,1,1,1, },
+ { 0,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1, },
+ { 0,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1,1, },
+ { 0,1,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1, },
+ },
+ /* pred_R real : values for general and differential */
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,343,433,546,687,866,1092,1375,1733,2184,2751,4374, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* drct_R real : values for general and differential */
+ { -5,-4,-3,-2,-1,0,1,2,3,4,5 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10932,2731,1365,682,341,170,85,42,21,10,5, },
+ { 0,6181,3086,2182,1543,1091,771,545,385,272,192,136, },
+ { 0,790,995,1254,1580,1991,3164,1991,1580,1254,995,790, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8,9,10 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 12 -- 384kbps FOA */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,1,1,1,1,2,4,8,16,32,64,128,256,512,1024,2048,8188,2048,1024,512,256,128,64,32,16,8,4,2,1,1,1,1, },
+ { 0,110,131,156,186,221,263,313,373,443,527,627,746,887,1055,1255,1798,1255,1055,887,746,627,527,443,373,313,263,221,186,156,131,110, },
+ { 0,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20,14,10, },
+ { 0,10,14,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,1,1,1,1,1,3,12,39,125,397,1260,12694,1260,397,125,39,12,3,1,1,1,1,1,1,1,1,1, },
+ { 0,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1, },
+ { 0,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1,1, },
+ { 0,1,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1, },
+ },
+ /* pred_R real : values for general and differential */
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 13 -- 384kbps HOA2 */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,1,1,1,1,2,4,8,16,32,64,128,256,512,1024,2048,8188,2048,1024,512,256,128,64,32,16,8,4,2,1,1,1,1, },
+ { 0,110,131,156,186,221,263,313,373,443,527,627,746,887,1055,1255,1798,1255,1055,887,746,627,527,443,373,313,263,221,186,156,131,110, },
+ { 0,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20,14,10, },
+ { 0,10,14,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,1,1,1,1,1,3,12,39,125,397,1260,12694,1260,397,125,39,12,3,1,1,1,1,1,1,1,1,1, },
+ { 0,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1, },
+ { 0,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1,1, },
+ { 0,1,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1, },
+ },
+ /* pred_R real : values for general and differential */
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,343,433,546,687,866,1092,1375,1733,2184,2751,4374, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* drct_R real : values for general and differential */
+ { -5,-4,-3,-2,-1,0,1,2,3,4,5 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10932,2731,1365,682,341,170,85,42,21,10,5, },
+ { 0,6181,3086,2182,1543,1091,771,545,385,272,192,136, },
+ { 0,790,995,1254,1580,1991,3164,1991,1580,1254,995,790, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8,9,10 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 14 -- 384kbps HOA3 */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,1,1,1,1,2,4,8,16,32,64,128,256,512,1024,2048,8188,2048,1024,512,256,128,64,32,16,8,4,2,1,1,1,1, },
+ { 0,110,131,156,186,221,263,313,373,443,527,627,746,887,1055,1255,1798,1255,1055,887,746,627,527,443,373,313,263,221,186,156,131,110, },
+ { 0,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20,14,10, },
+ { 0,10,14,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,1,1,1,1,1,3,12,39,125,397,1260,12694,1260,397,125,39,12,3,1,1,1,1,1,1,1,1,1, },
+ { 0,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1, },
+ { 0,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1,1, },
+ { 0,1,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1, },
+ },
+ /* pred_R real : values for general and differential */
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,343,433,546,687,866,1092,1375,1733,2184,2751,4374, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* drct_R real : values for general and differential */
+ { -5,-4,-3,-2,-1,0,1,2,3,4,5 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10932,2731,1365,682,341,170,85,42,21,10,5, },
+ { 0,6181,3086,2182,1543,1091,771,545,385,272,192,136, },
+ { 0,790,995,1254,1580,1991,3164,1991,1580,1254,995,790, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8,9,10 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 15 -- 512kbps FOA */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,1,1,1,1,2,4,8,16,32,64,128,256,512,1024,2048,8188,2048,1024,512,256,128,64,32,16,8,4,2,1,1,1,1, },
+ { 0,110,131,156,186,221,263,313,373,443,527,627,746,887,1055,1255,1798,1255,1055,887,746,627,527,443,373,313,263,221,186,156,131,110, },
+ { 0,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20,14,10, },
+ { 0,10,14,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,1,1,1,1,1,3,12,39,125,397,1260,12694,1260,397,125,39,12,3,1,1,1,1,1,1,1,1,1, },
+ { 0,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1, },
+ { 0,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1,1, },
+ { 0,1,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1, },
+ },
+ /* pred_R real : values for general and differential */
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 16 -- 512kbps HOA2 */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,1,1,1,1,2,4,8,16,32,64,128,256,512,1024,2048,8188,2048,1024,512,256,128,64,32,16,8,4,2,1,1,1,1, },
+ { 0,110,131,156,186,221,263,313,373,443,527,627,746,887,1055,1255,1798,1255,1055,887,746,627,527,443,373,313,263,221,186,156,131,110, },
+ { 0,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20,14,10, },
+ { 0,10,14,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,1,1,1,1,1,3,12,39,125,397,1260,12694,1260,397,125,39,12,3,1,1,1,1,1,1,1,1,1, },
+ { 0,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1, },
+ { 0,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1,1, },
+ { 0,1,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1, },
+ },
+ /* pred_R real : values for general and differential */
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,343,433,546,687,866,1092,1375,1733,2184,2751,4374, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* drct_R real : values for general and differential */
+ { -5,-4,-3,-2,-1,0,1,2,3,4,5 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10932,2731,1365,682,341,170,85,42,21,10,5, },
+ { 0,6181,3086,2182,1543,1091,771,545,385,272,192,136, },
+ { 0,790,995,1254,1580,1991,3164,1991,1580,1254,995,790, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8,9,10 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+ /* tbl_idx 17 -- 512kbps HOA3 */
+ {
+ /* Quant strat = 0 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,1,1,1,1,2,4,8,16,32,64,128,256,512,1024,2048,8188,2048,1024,512,256,128,64,32,16,8,4,2,1,1,1,1, },
+ { 0,110,131,156,186,221,263,313,373,443,527,627,746,887,1055,1255,1798,1255,1055,887,746,627,527,443,373,313,263,221,186,156,131,110, },
+ { 0,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20,14,10, },
+ { 0,10,14,20,29,41,58,82,116,164,233,329,466,659,932,1318,1864,3738,1864,1318,932,659,466,329,233,164,116,82,58,41,29,20, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,1,1,1,1,1,1,1,1,1,3,12,39,125,397,1260,12694,1260,397,125,39,12,3,1,1,1,1,1,1,1,1,1, },
+ { 0,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1, },
+ { 0,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1,1,1, },
+ { 0,1,1,1,2,3,6,11,20,37,66,117,210,374,667,1189,2118,6740,2118,1189,667,374,210,117,66,37,20,11,6,3,2,1, },
+ },
+ /* pred_R real : values for general and differential */
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ { -15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,343,433,546,687,866,1092,1375,1733,2184,2751,4374, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* drct_R real : values for general and differential */
+ { -5,-4,-3,-2,-1,0,1,2,3,4,5 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,10932,2731,1365,682,341,170,85,42,21,10,5, },
+ { 0,6181,3086,2182,1543,1091,771,545,385,272,192,136, },
+ { 0,790,995,1254,1580,1991,3164,1991,1580,1254,995,790, },
+ { 0,1254,1344,1441,1544,1655,1908,1655,1544,1441,1344,1254, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,12,39,125,397,1261,12716,1261,397,125,39,12, },
+ { 0,217,387,689,1229,2190,6960,2190,1229,689,387,217, },
+ { 0,389,694,1236,2203,7000,2203,1236,694,389,218,122, },
+ { 0,122,218,389,694,1236,2203,7000,2203,1236,694,389, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0,1,2,3,4,5,6,7,8,9,10 },{ -5,-4,-3,-2,-1,0,1,2,3,4,5 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 1 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ /* Quant strat = 2 */
+ {
+ {
+ /* pred_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* pred_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* pred_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* drct_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* drct_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* drct_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ {
+ /* decd_R real */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real differential */
+ {
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ { 0,16384, },
+ },
+ /* decd_R real : values for general and differential */
+ { 0 },{ 0 },
+ /* decd_R real : num dyn models for general and differential */
+ 4, 4
+ },
+ },
+ },
+
+};
+#endif
+
+#ifdef FIX_SBA_CLEAN_UP_OPT
+const ivas_huff_models_t ivas_huff_pred_r_consts[TOTAL_PRED_QUANT_STRATS_HUFF] =
+{
+ /* entry for 1 quantization points for br_table_idx */
+ {{{ 0 }}, {{ 0 }}},
+ /* entry for 7 quantization points for br_table_idx */
+ {
+ /* pred_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* pred_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ /* entry for 15 quantization points for br_table_idx */
+ {
+ /* pred_r codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5, 4, 4 },{ -4, 4, 5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },
+ { 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 } },
+ /* pred_r differential codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5, 4, 4 },{ -4, 4, 5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },
+ { 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 } },
+ },
+ /* entry for 21 quantization points for br_table_idx=0 */
+ {
+ /* pred_r codebook */
+ { {-10,5,22},{-9,5,23},{-8,5,24},{-7,5,25},{-6,5,26}, { -5, 4, 0 },{ -4, 4, 1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },
+ { 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{6,5,27},{7,5,28},{8,5,29},{9,5,30},{10,5,31} },
+ /* pred_r differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5, 4, 0 },{ -4, 4, 1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },
+ { 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 } },
+ },
+
+ /* entry for 31 quantization points for br_table_idx>0 */
+ {
+ /* pred_r codebook */
+ { {-15,5,2},{-14,5,3},{-13,5,4},{-12,5,5},{-11,5,6}, { -10,5,7 },{ -9,5,8 },{ -8,5,9 },
+ { -7,5,10 },{ -6,5,11 },{ -5, 5, 12 },{ -4, 5, 13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },
+ { 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },
+ { 8,5,24 },{ 9,5,25 },{ 10,5,26 },{11,5,27},{12,5,28},{13,5,29},{14,5,30},{15,5,31} },
+ /* pred_r differential codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },
+ { -7,5,10 },{ -6,5,11 },{ -5, 5, 12 },{ -4, 5, 13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },
+ { 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },
+ { 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 } },
+ },
+ };
+
+ const ivas_huff_models_t ivas_huff_drct_r_consts[TOTAL_DRCT_QUANT_STRATS] =
+{
+ /* entry for 1 quantization points */
+ {{{ 0 }}, {{ 0 }}},
+ /* entry for 7 quantization points */
+ {
+ /* drct_r codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 } },
+ /* drct_r differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 } },
+ },
+ /* entry for 9 quantization points */
+ {
+ /* drct_r codebook */
+ { { -4, 4, 14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 } },
+ /* drct_r differential codebook */
+ { { -4, 4, 14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 } },
+ },
+ /* entry for 11 quantization points */
+ {
+ /* drct_r codebook */
+ { { -5, 4, 10 },{ -4, 4, 11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 } },
+ /* drct_r differential codebook */
+ { { -5, 4, 10 },{ -4, 4, 11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 } },
+ },
+};
+
+const ivas_huff_models_t ivas_huff_decd_r_consts[TOTAL_DECD_QUANT_STRATS] =
+{
+ /* entry for 1 quantization points */
+ {{{ 0 }}, {{ 0 }}},
+ /* entry for 3 quantization points */
+ {
+ /* decd_r codebook */
+ { { 0, 2, 2 },{ 1, 1, 0 },{ 2,2,3 } },
+ /* decd_r differential codebook */
+ { { -1, 2, 2 },{ 0, 1, 0 },{ 1,2,3 } },
+ },
+ /* entry for 5 quantization points */
+ {
+ /* decd_r codebook */
+ { { 0,3,6 },{ 1,2,0 },{ 2,2,1 },{ 3,2,2 },{ 4,3,7 } },
+ /* decd_r differential codebook */
+ { { -2,3,6 },{ -1,2,0 },{ 0,2,1 },{ 1,2,2 },{ 2,3,7 } },
+ },
+ /* entry for 7 quantization points */
+ {
+ /* decd_r */
+ { { 0, 3, 2 },{ 1, 3, 3 },{ 2,3,4 },{ 3,3,0 },{ 4,3,5 },{ 5,3,6 },{ 6,3,7 } },
+ /* decd_r codebook differential codebook */
+ { { -3, 3, 2 },{ -2, 3, 3 },{ -1,3,4 },{ 0,3,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 } },
+ },
+ /* entry for 9 quantization points */
+ {
+ /* decd_r codebook */
+ { { 0, 4, 14 },{ 1,3,0 },{ 2,3,1 },{ 3,3,2 },{ 4,3,3 },{ 5,3,4 },{ 6,3,5 },{ 7,3,6 },{ 8,4,15 } },
+ /* decd_r differential codebook */
+ { { -4, 4, 14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 } },
+ },
+ /* entry for 11 quantization points */
+ {
+ /* decd_r codebook */
+ { { 0, 4, 10 },{ 1, 4, 11 },{ 2,4,12 },{ 3,3,0 },{ 4,3,1 },{ 5,3,2 },{ 6,3,3 },{ 7,3,4 },{ 8,4,13 },{ 9,4,14 },{ 10,4,15 } },
+ /* decd_r differential codebook */
+ { { -5, 4, 10 },{ -4, 4, 11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 } },
+ },
+};
+#else
+const ivas_huff_consts_t ivas_huff_const[IVAS_SPAR_BR_TABLE_LEN][MAX_QUANT_STRATS] =
+{
+ /* tbl_idx 0 -- 24.4kbps FOA */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ /* pred_R differential codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ },
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ {
+ /* decd_R codebook */
+ { { 0,3,6 },{ 1,2,0 },{ 2,2,1 },{ 3,2,2 },{ 4,3,7 }, },
+ /* decd_R differential codebook */
+ { { -2,3,6 },{ -1,2,0 },{ 0,2,1 },{ 1,2,2 },{ 2,3,7 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ {
+ /* pred_R codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ /* pred_R differential codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ },
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ {
+ /* decd_R codebook */
+ { { 0,2,2 },{ 1,1,0 },{ 2,2,3 }, },
+ /* decd_R differential codebook */
+ { { -1,2,2 },{ 0,1,0 },{ 1,2,3 }, },
+ },
+ },
+ /* Quant strat 2 */
+ {
+ {
+ /* pred_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* pred_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ {
+ /* decd_R codebook */
+ { { 0,2,2 },{ 1,1,0 },{ 2,2,3 }, },
+ /* decd_R differential codebook */
+ { { -1,2,2 },{ 0,1,0 },{ 1,2,3 }, },
+ },
+ },
+ },
+ /* tbl_idx 1 -- 32kbps FOA */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ {
+ /* decd_R codebook */
+ { { 0,3,6 },{ 1,2,0 },{ 2,2,1 },{ 3,2,2 },{ 4,3,7 }, },
+ /* decd_R differential codebook */
+ { { -2,3,6 },{ -1,2,0 },{ 0,2,1 },{ 1,2,2 },{ 2,3,7 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ {
+ /* pred_R codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ /* pred_R differential codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ },
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ {
+ /* decd_R codebook */
+ { { 0,3,6 },{ 1,2,0 },{ 2,2,1 },{ 3,2,2 },{ 4,3,7 }, },
+ /* decd_R differential codebook */
+ { { -2,3,6 },{ -1,2,0 },{ 0,2,1 },{ 1,2,2 },{ 2,3,7 }, },
+ },
+ },
+ /* Quant strat 2 */
+ {
+ {
+ /* pred_R codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ /* pred_R differential codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ },
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ {
+ /* decd_R codebook */
+ { { 0,2,2 },{ 1,1,0 },{ 2,2,3 }, },
+ /* decd_R differential codebook */
+ { { -1,2,2 },{ 0,1,0 },{ 1,2,3 }, },
+ },
+ },
+ },
+ /* tbl_idx 2 -- 48kbps FOA */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ /* pred_R differential codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,3,6 },{ 1,2,0 },{ 2,2,1 },{ 3,2,2 },{ 4,3,7 }, },
+ /* decd_R differential codebook */
+ { { -2,3,6 },{ -1,2,0 },{ 0,2,1 },{ 1,2,2 },{ 2,3,7 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ {
+ /* pred_R codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ /* pred_R differential codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,2,2 },{ 1,1,0 },{ 2,2,3 }, },
+ /* decd_R differential codebook */
+ { { -1,2,2 },{ 0,1,0 },{ 1,2,3 }, },
+ },
+ },
+ /* Quant strat 2 */
+ {
+ {
+ /* pred_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* pred_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,2,2 },{ 1,1,0 },{ 2,2,3 }, },
+ /* decd_R differential codebook */
+ { { -1,2,2 },{ 0,1,0 },{ 1,2,3 }, },
+ },
+ },
+ },
+ /* tbl_idx 3 -- 64kbps FOA */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,3,6 },{ 1,2,0 },{ 2,2,1 },{ 3,2,2 },{ 4,3,7 }, },
+ /* decd_R differential codebook */
+ { { -2,3,6 },{ -1,2,0 },{ 0,2,1 },{ 1,2,2 },{ 2,3,7 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ {
+ /* pred_R codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ /* pred_R differential codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,3,6 },{ 1,2,0 },{ 2,2,1 },{ 3,2,2 },{ 4,3,7 }, },
+ /* decd_R differential codebook */
+ { { -2,3,6 },{ -1,2,0 },{ 0,2,1 },{ 1,2,2 },{ 2,3,7 }, },
+ },
+ },
+ /* Quant strat 2 */
+ {
+ {
+ /* pred_R codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ /* pred_R differential codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,2,2 },{ 1,1,0 },{ 2,2,3 }, },
+ /* decd_R differential codebook */
+ { { -1,2,2 },{ 0,1,0 },{ 1,2,3 }, },
+ },
+ },
+ },
+ /* tbl_idx 4 -- 80kbps FOA */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,3,6 },{ 1,2,0 },{ 2,2,1 },{ 3,2,2 },{ 4,3,7 }, },
+ /* decd_R differential codebook */
+ { { -2,3,6 },{ -1,2,0 },{ 0,2,1 },{ 1,2,2 },{ 2,3,7 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ {
+ /* pred_R codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ /* pred_R differential codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,3,6 },{ 1,2,0 },{ 2,2,1 },{ 3,2,2 },{ 4,3,7 }, },
+ /* decd_R differential codebook */
+ { { -2,3,6 },{ -1,2,0 },{ 0,2,1 },{ 1,2,2 },{ 2,3,7 }, },
+ },
+ },
+ /* Quant strat 2 */
+ {
+ {
+ /* pred_R codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ /* pred_R differential codebook */
+ { { -7,4,2 },{ -6,4,3 },{ -5,4,4 },{ -4,4,5 },{ -3,4,6 },{ -2,4,7 },{ -1,4,8 },{ 0,3,0 },{ 1,4,9 },{ 2,4,10 },{ 3,4,11 },{ 4,4,12 },{ 5,4,13 },{ 6,4,14 },{ 7,4,15 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,2,2 },{ 1,1,0 },{ 2,2,3 }, },
+ /* decd_R differential codebook */
+ { { -1,2,2 },{ 0,1,0 },{ 1,2,3 }, },
+ },
+ },
+ },
+ /* tbl_idx 5 -- 96kbps FOA */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -4,4,14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 }, },
+ /* drct_R differential codebook */
+ { { -4,4,14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,4,14 },{ 1,3,0 },{ 2,3,1 },{ 3,3,2 },{ 4,3,3 },{ 5,3,4 },{ 6,3,5 },{ 7,3,6 },{ 8,4,15 }, },
+ /* decd_R differential codebook */
+ { { -4,4,14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,3,6 },{ 1,2,0 },{ 2,2,1 },{ 3,2,2 },{ 4,3,7 }, },
+ /* decd_R differential codebook */
+ { { -2,3,6 },{ -1,2,0 },{ 0,2,1 },{ 1,2,2 },{ 2,3,7 }, },
+ },
+ },
+ /* Quant strat 2 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,3,6 },{ 1,2,0 },{ 2,2,1 },{ 3,2,2 },{ 4,3,7 }, },
+ /* decd_R differential codebook */
+ { { -2,3,6 },{ -1,2,0 },{ 0,2,1 },{ 1,2,2 },{ 2,3,7 }, },
+ },
+ },
+ },
+ /* tbl_idx 6 -- 128kbps FOA */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ /* drct_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,4,14 },{ 1,3,0 },{ 2,3,1 },{ 3,3,2 },{ 4,3,3 },{ 5,3,4 },{ 6,3,5 },{ 7,3,6 },{ 8,4,15 }, },
+ /* decd_R differential codebook */
+ { { -4,4,14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -4,4,14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 }, },
+ /* drct_R differential codebook */
+ { { -4,4,14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,2,0 },{ 4,3,5 },{ 5,3,6 },{ 6,3,7 }, },
+ /* decd_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ },
+ /* Quant strat 2 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,2,0 },{ 4,3,5 },{ 5,3,6 },{ 6,3,7 }, },
+ /* decd_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ },
+ },
+ /* tbl_idx 7 -- 160kbps FOA */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ /* drct_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,4,10 },{ 1,4,11 },{ 2,4,12 },{ 3,3,0 },{ 4,3,1 },{ 5,3,2 },{ 6,3,3 },{ 7,3,4 },{ 8,4,13 },{ 9,4,14 },{ 10,4,15 }, },
+ /* decd_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -4,4,14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 }, },
+ /* drct_R differential codebook */
+ { { -4,4,14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,4,14 },{ 1,3,0 },{ 2,3,1 },{ 3,3,2 },{ 4,3,3 },{ 5,3,4 },{ 6,3,5 },{ 7,3,6 },{ 8,4,15 }, },
+ /* decd_R differential codebook */
+ { { -4,4,14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 }, },
+ },
+ },
+ /* Quant strat 2 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,2,0 },{ 4,3,5 },{ 5,3,6 },{ 6,3,7 }, },
+ /* decd_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ },
+ },
+ /* tbl_idx 8 -- 192kbps FOA */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ /* drct_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,4,10 },{ 1,4,11 },{ 2,4,12 },{ 3,3,0 },{ 4,3,1 },{ 5,3,2 },{ 6,3,3 },{ 7,3,4 },{ 8,4,13 },{ 9,4,14 },{ 10,4,15 }, },
+ /* decd_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -4,4,14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 }, },
+ /* drct_R differential codebook */
+ { { -4,4,14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,4,14 },{ 1,3,0 },{ 2,3,1 },{ 3,3,2 },{ 4,3,3 },{ 5,3,4 },{ 6,3,5 },{ 7,3,6 },{ 8,4,15 }, },
+ /* decd_R differential codebook */
+ { { -4,4,14 },{ -3,3,0 },{ -2,3,1 },{ -1,3,2 },{ 0,3,3 },{ 1,3,4 },{ 2,3,5 },{ 3,3,6 },{ 4,4,15 }, },
+ },
+ },
+ /* Quant strat 2 */
+ {
+ {
+ /* pred_R codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ /* pred_R differential codebook */
+ { { -10,5,22 },{ -9,5,23 },{ -8,5,24 },{ -7,5,25 },{ -6,5,26 },{ -5,4,0 },{ -4,4,1 },{ -3,4,2 },{ -2,4,3 },{ -1,4,4 },{ 0,4,5 },{ 1,4,6 },{ 2,4,7 },{ 3,4,8 },{ 4,4,9 },{ 5,4,10 },{ 6,5,27 },{ 7,5,28 },{ 8,5,29 },{ 9,5,30 },{ 10,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ /* drct_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,2,0 },{ 4,3,5 },{ 5,3,6 },{ 6,3,7 }, },
+ /* decd_R differential codebook */
+ { { -3,3,2 },{ -2,3,3 },{ -1,3,4 },{ 0,2,0 },{ 1,3,5 },{ 2,3,6 },{ 3,3,7 }, },
+ },
+ },
+ },
+ /* tbl_idx 9 -- 256kbps FOA */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ /* pred_R differential codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ },
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ /* Quant strat 1 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ /* Quant strat 2 */
+{
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ },
+ /* tbl_idx 10 -- 256kbps HOA2 */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ /* pred_R differential codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ /* drct_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,4,10 },{ 1,4,11 },{ 2,4,12 },{ 3,3,0 },{ 4,3,1 },{ 5,3,2 },{ 6,3,3 },{ 7,3,4 },{ 8,4,13 },{ 9,4,14 },{ 10,4,15 }, },
+ /* decd_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ /* Quant strat 2 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ },
+ /* tbl_idx 11 -- 256kbps HOA3 */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ /* pred_R differential codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ /* drct_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,4,10 },{ 1,4,11 },{ 2,4,12 },{ 3,3,0 },{ 4,3,1 },{ 5,3,2 },{ 6,3,3 },{ 7,3,4 },{ 8,4,13 },{ 9,4,14 },{ 10,4,15 }, },
+ /* decd_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ /* Quant strat 2 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ },
+ /* tbl_idx 12 -- 384kbps FOA */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ /* pred_R differential codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ },
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ /* Quant strat 1 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ /* Quant strat 2 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ },
+ /* tbl_idx 13 -- 384kbps HOA2 */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ /* pred_R differential codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ /* drct_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,4,10 },{ 1,4,11 },{ 2,4,12 },{ 3,3,0 },{ 4,3,1 },{ 5,3,2 },{ 6,3,3 },{ 7,3,4 },{ 8,4,13 },{ 9,4,14 },{ 10,4,15 }, },
+ /* decd_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ /* Quant strat 2 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ },
+ /* tbl_idx 14 -- 384kbps HOA3 */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ /* pred_R differential codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ /* drct_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,4,10 },{ 1,4,11 },{ 2,4,12 },{ 3,3,0 },{ 4,3,1 },{ 5,3,2 },{ 6,3,3 },{ 7,3,4 },{ 8,4,13 },{ 9,4,14 },{ 10,4,15 }, },
+ /* decd_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ /* Quant strat 2 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ },
+ /* tbl_idx 15 -- 512kbps FOA */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ /* pred_R differential codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ },
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ /* Quant strat 1 */
+ {
+ {
+ /* pred_R codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ /* pred_R differential codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ },
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ /* Quant strat 2 */
+ {
+ {
+ /* pred_R codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ /* pred_R differential codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ },
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ },
+ /* tbl_idx 16 -- 512kbps HOA2 */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ /* pred_R differential codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ /* drct_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,4,10 },{ 1,4,11 },{ 2,4,12 },{ 3,3,0 },{ 4,3,1 },{ 5,3,2 },{ 6,3,3 },{ 7,3,4 },{ 8,4,13 },{ 9,4,14 },{ 10,4,15 }, },
+ /* decd_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ /* Quant strat 2 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ },
+ /* tbl_idx 17 -- 512kbps HOA3 */
+ {
+ /* Quant strat 0 */
+ {
+ {
+ /* pred_R codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ /* pred_R differential codebook */
+ { { -15,5,2 },{ -14,5,3 },{ -13,5,4 },{ -12,5,5 },{ -11,5,6 },{ -10,5,7 },{ -9,5,8 },{ -8,5,9 },{ -7,5,10 },{ -6,5,11 },{ -5,5,12 },{ -4,5,13 },{ -3,5,14 },{ -2,5,15 },{ -1,5,16 },{ 0,4,0 },{ 1,5,17 },{ 2,5,18 },{ 3,5,19 },{ 4,5,20 },{ 5,5,21 },{ 6,5,22 },{ 7,5,23 },{ 8,5,24 },{ 9,5,25 },{ 10,5,26 },{ 11,5,27 },{ 12,5,28 },{ 13,5,29 },{ 14,5,30 },{ 15,5,31 }, },
+ },
+ {
+ /* drct_R codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ /* drct_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ {
+ /* decd_R codebook */
+ { { 0,4,10 },{ 1,4,11 },{ 2,4,12 },{ 3,3,0 },{ 4,3,1 },{ 5,3,2 },{ 6,3,3 },{ 7,3,4 },{ 8,4,13 },{ 9,4,14 },{ 10,4,15 }, },
+ /* decd_R differential codebook */
+ { { -5,4,10 },{ -4,4,11 },{ -3,4,12 },{ -2,3,0 },{ -1,3,1 },{ 0,3,2 },{ 1,3,3 },{ 2,3,4 },{ 3,4,13 },{ 4,4,14 },{ 5,4,15 }, },
+ },
+ },
+ /* Quant strat 1 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ /* Quant strat 2 */
+ {
+ /* pred_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* drct_R */
+ {{{ 0 }}, {{ 0 }}},
+ /* decd_R */
+ {{{ 0 }}, {{ 0 }}},
+ },
+ },
+};
+#endif
+
+/* DTX quantization and bitstream constants */
+
+const float dtx_pd_real_min_max[2] = { 0, 1.6f };
+const int16_t dtx_pd_real_q_levels[3][3] = { { 7,7,7 },{ 7,7,0 },{ 3,0,0 } };
+const int16_t dtx_pr_real_q_levels[3][3] = { { 9,9,9 },{ 9,7,9 },{ 9,5,7 } };
+const int16_t pr_pr_idx_pairs[3][3][2] = { { { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 0, 0 },{ 0, 0 } },{ { 0, 0 },{ 1, 3 },{ 0, 0 } } };
+const int16_t pr_pd_idx_pairs[3][3][2] = { { { 1, 1 },{ 2, 2 },{ 3, 3 } },{ { 1, 1 },{ 3, 2 },{ 2, 0 } },{ { 2, 1 },{ 0, 0 },{ 0, 0 } } };
+
+const int16_t remix_order_set[1][IVAS_SPAR_MAX_CH] = { /* WYZX --> WYXZ... */
+ { 0, 1, 3, 2, 4, 5, 6, 7}
+};
+const int16_t keep_planar[IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS] = { 1, 1, 1, 1 };
+const int16_t HOA_keep_ind[IVAS_SPAR_MAX_CH] = {0, 1, 2, 3, 4, 8, 9, 15};
+
+
+/*----------------------------------------------------------------------*
+* PCA ROM tables
+*-----------------------------------------------------------------------*/
+
+const int32_t ivas_pca_offset_index1[IVAS_PCA_N1 + 1] =
+{
+ 0, 1, 9, 61, 163, 359, 685, 1125, 1747,
+ 2519, 3521, 4713, 6183, 7883, 9809, 12093, 14633, 17575,
+ 20807, 24343, 28181, 32487, 37121, 42097, 47405, 53057, 59061,
+ 65421, 72137, 79205, 86625, 94415, 102345, 110629, 119263, 128017,
+ 137097, 146515, 156043, 165637, 175551, 185515, 195535, 205837, 216183,
+ 226545, 236911, 247273, 257619, 267921, 277941, 287905, 297819, 307413,
+ 316941, 326359, 335439, 344193, 352827, 361111, 369041, 376831, 384251,
+ 391319, 398035, 404395, 410399, 416051, 421359, 426335, 430969, 435275,
+ 439113, 442649, 445881, 448823, 451363, 453647, 455573, 457273, 458743,
+ 459935, 460937, 461709, 462331, 462771, 463097, 463293, 463395, 463447,
+ 463455, 463456
+};
+
+const int16_t ivas_pca_offset_index2[2692] =
+{
+ 0, 1, 0, 1, 7, 8, 0, 1, 7, 19,
+ 33, 45, 51, 52, 0, 1, 9, 23, 41, 61,
+ 79, 93, 101, 102, 0, 1, 7, 21, 39, 61,
+ 85, 111, 135, 157, 175, 189, 195, 196, 0, 1,
+ 7, 19, 37, 59, 85, 115, 147, 179, 211, 241,
+ 267, 289, 307, 319, 325, 326, 0, 1, 7, 21,
+ 41, 65, 95, 127, 163, 201, 239, 277, 313, 345,
+ 375, 399, 419, 433, 439, 440, 0, 1, 7, 19,
+ 37, 61, 91, 125, 163, 203, 245, 289, 333, 377,
+ 419, 459, 497, 531, 561, 585, 603, 615, 621, 622,
+ 0, 1, 7, 21, 41, 67, 97, 133, 173, 217,
+ 263, 311, 361, 411, 461, 509, 555, 599, 639, 675,
+ 705, 731, 751, 765, 771, 772, 0, 1, 7, 19,
+ 37, 61, 91, 127, 167, 211, 259, 309, 363, 417,
+ 473, 529, 585, 639, 693, 743, 791, 835, 875, 911,
+ 941, 965, 983, 995, 1001, 1002, 0, 1, 7, 21,
+ 41, 67, 99, 135, 177, 223, 273, 327, 383, 443,
+ 503, 565, 627, 689, 749, 809, 865, 919, 969, 1015,
+ 1057, 1093, 1125, 1151, 1171, 1185, 1191, 1192, 0, 1,
+ 7, 19, 37, 61, 91, 127, 169, 215, 265, 319,
+ 377, 437, 501, 567, 633, 701, 769, 837, 903, 969,
+ 1033, 1093, 1151, 1205, 1255, 1301, 1343, 1379, 1409, 1433,
+ 1451, 1463, 1469, 1470, 0, 1, 7, 21, 41, 67,
+ 99, 137, 179, 227, 279, 335, 395, 459, 525, 595,
+ 667, 739, 813, 887, 961, 1033, 1105, 1175, 1241, 1305,
+ 1365, 1421, 1473, 1521, 1563, 1601, 1633, 1659, 1679, 1693,
+ 1699, 1700, 0, 1, 9, 23, 43, 69, 101, 139,
+ 183, 231, 285, 343, 405, 471, 541, 613, 689, 765,
+ 843, 923, 1003, 1083, 1161, 1237, 1313, 1385, 1455, 1521,
+ 1583, 1641, 1695, 1743, 1787, 1825, 1857, 1883, 1903, 1917,
+ 1925, 1926, 0, 1, 7, 21, 41, 67, 99, 137,
+ 179, 227, 281, 339, 401, 467, 537, 611, 687, 767,
+ 849, 931, 1015, 1099, 1185, 1269, 1353, 1435, 1517, 1597,
+ 1673, 1747, 1817, 1883, 1945, 2003, 2057, 2105, 2147, 2185,
+ 2217, 2243, 2263, 2277, 2283, 2284, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 285, 345, 409, 477,
+ 549, 625, 705, 787, 871, 957, 1045, 1135, 1225, 1315,
+ 1405, 1495, 1583, 1669, 1753, 1835, 1915, 1991, 2063, 2131,
+ 2195, 2255, 2309, 2359, 2403, 2441, 2473, 2499, 2519, 2533,
+ 2539, 2540, 0, 1, 7, 19, 39, 65, 97, 135,
+ 177, 225, 279, 337, 401, 469, 541, 617, 697, 781,
+ 867, 955, 1045, 1137, 1231, 1327, 1423, 1519, 1615, 1711,
+ 1805, 1897, 1987, 2075, 2161, 2245, 2325, 2401, 2473, 2541,
+ 2605, 2663, 2717, 2765, 2807, 2845, 2877, 2903, 2923, 2935,
+ 2941, 2942, 0, 1, 7, 21, 41, 67, 99, 137,
+ 181, 229, 283, 343, 407, 477, 551, 629, 711, 797,
+ 885, 977, 1071, 1167, 1265, 1365, 1465, 1565, 1667, 1767,
+ 1867, 1967, 2065, 2161, 2255, 2347, 2435, 2521, 2603, 2681,
+ 2755, 2825, 2889, 2949, 3003, 3051, 3095, 3133, 3165, 3191,
+ 3211, 3225, 3231, 3232, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 347, 413, 483, 559, 639,
+ 723, 811, 903, 997, 1093, 1193, 1295, 1399, 1503, 1609,
+ 1715, 1821, 1927, 2033, 2137, 2241, 2343, 2443, 2539, 2633,
+ 2725, 2813, 2897, 2977, 3053, 3123, 3189, 3249, 3305, 3355,
+ 3399, 3437, 3469, 3495, 3515, 3529, 3535, 3536, 0, 1,
+ 7, 21, 41, 67, 99, 137, 181, 231, 287, 349,
+ 415, 487, 563, 645, 731, 821, 915, 1011, 1111, 1213,
+ 1317, 1423, 1531, 1641, 1751, 1863, 1975, 2087, 2197, 2307,
+ 2415, 2521, 2625, 2727, 2827, 2923, 3017, 3107, 3193, 3275,
+ 3351, 3423, 3489, 3551, 3607, 3657, 3701, 3739, 3771, 3797,
+ 3817, 3831, 3837, 3838, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 285, 345, 411, 481, 557, 637,
+ 721, 809, 901, 997, 1097, 1199, 1305, 1413, 1523, 1635,
+ 1749, 1863, 1979, 2095, 2211, 2327, 2443, 2557, 2671, 2783,
+ 2893, 3001, 3107, 3209, 3309, 3405, 3497, 3585, 3669, 3749,
+ 3825, 3895, 3961, 4021, 4075, 4125, 4169, 4207, 4239, 4265,
+ 4285, 4299, 4305, 4306, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 347, 413, 485, 561, 643,
+ 729, 819, 913, 1011, 1113, 1217, 1325, 1435, 1547, 1663,
+ 1779, 1897, 2017, 2137, 2257, 2377, 2497, 2617, 2737, 2855,
+ 2971, 3087, 3199, 3309, 3417, 3521, 3623, 3721, 3815, 3905,
+ 3991, 4073, 4149, 4221, 4287, 4347, 4403, 4453, 4497, 4535,
+ 4567, 4593, 4613, 4627, 4633, 4634, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 415, 487,
+ 565, 647, 733, 825, 921, 1021, 1125, 1231, 1341, 1453,
+ 1569, 1687, 1807, 1929, 2051, 2175, 2299, 2425, 2551, 2677,
+ 2801, 2925, 3047, 3169, 3289, 3407, 3523, 3635, 3745, 3851,
+ 3955, 4055, 4151, 4243, 4329, 4411, 4489, 4561, 4627, 4689,
+ 4745, 4795, 4839, 4877, 4909, 4935, 4955, 4969, 4975, 4976,
+ 0, 1, 7, 21, 41, 67, 99, 137, 181, 231,
+ 287, 349, 417, 489, 567, 649, 737, 829, 925, 1025,
+ 1129, 1237, 1349, 1463, 1581, 1701, 1823, 1947, 2073, 2201,
+ 2329, 2459, 2589, 2719, 2849, 2979, 3107, 3235, 3361, 3485,
+ 3607, 3727, 3845, 3959, 4071, 4179, 4283, 4383, 4479, 4571,
+ 4659, 4741, 4819, 4891, 4959, 5021, 5077, 5127, 5171, 5209,
+ 5241, 5267, 5287, 5301, 5307, 5308, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 417, 489,
+ 567, 651, 739, 831, 929, 1031, 1137, 1247, 1361, 1477,
+ 1597, 1719, 1843, 1969, 2097, 2227, 2359, 2491, 2625, 2759,
+ 2893, 3027, 3161, 3293, 3425, 3555, 3683, 3809, 3933, 4055,
+ 4175, 4291, 4405, 4515, 4621, 4723, 4821, 4913, 5001, 5085,
+ 5163, 5235, 5303, 5365, 5421, 5471, 5515, 5553, 5585, 5611,
+ 5631, 5645, 5651, 5652, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 569, 653,
+ 741, 835, 933, 1035, 1141, 1251, 1365, 1483, 1603, 1727,
+ 1853, 1983, 2115, 2249, 2383, 2519, 2657, 2795, 2933, 3071,
+ 3209, 3347, 3485, 3621, 3755, 3889, 4021, 4151, 4277, 4401,
+ 4521, 4639, 4753, 4863, 4969, 5071, 5169, 5263, 5351, 5435,
+ 5513, 5587, 5655, 5717, 5773, 5823, 5867, 5905, 5937, 5963,
+ 5983, 5997, 6003, 6004, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 569, 653,
+ 741, 835, 933, 1037, 1145, 1257, 1373, 1491, 1613, 1739,
+ 1867, 1997, 2131, 2267, 2405, 2543, 2683, 2825, 2967, 3109,
+ 3251, 3393, 3535, 3677, 3817, 3955, 4093, 4229, 4363, 4493,
+ 4621, 4747, 4869, 4987, 5103, 5215, 5323, 5427, 5525, 5619,
+ 5707, 5791, 5869, 5943, 6011, 6073, 6129, 6179, 6223, 6261,
+ 6293, 6319, 6339, 6353, 6359, 6360, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
+ 569, 653, 743, 837, 935, 1039, 1147, 1259, 1375, 1495,
+ 1619, 1745, 1875, 2007, 2143, 2281, 2421, 2563, 2705, 2849,
+ 2993, 3139, 3285, 3431, 3577, 3723, 3867, 4011, 4153, 4295,
+ 4435, 4573, 4709, 4841, 4971, 5097, 5221, 5341, 5457, 5569,
+ 5677, 5781, 5879, 5973, 6063, 6147, 6225, 6299, 6367, 6429,
+ 6485, 6535, 6579, 6617, 6649, 6675, 6695, 6709, 6715, 6716,
+ 0, 1, 7, 21, 41, 67, 99, 137, 181, 231,
+ 287, 349, 417, 491, 569, 653, 743, 837, 937, 1041,
+ 1149, 1261, 1377, 1497, 1621, 1749, 1879, 2013, 2149, 2287,
+ 2429, 2573, 2717, 2863, 3011, 3159, 3309, 3459, 3609, 3759,
+ 3909, 4057, 4205, 4351, 4495, 4639, 4781, 4919, 5055, 5189,
+ 5319, 5447, 5571, 5691, 5807, 5919, 6027, 6131, 6231, 6325,
+ 6415, 6499, 6577, 6651, 6719, 6781, 6837, 6887, 6931, 6969,
+ 7001, 7027, 7047, 7061, 7067, 7068, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
+ 569, 653, 743, 837, 937, 1041, 1149, 1261, 1377, 1497,
+ 1621, 1749, 1881, 2015, 2153, 2293, 2435, 2579, 2725, 2873,
+ 3023, 3175, 3327, 3479, 3633, 3787, 3941, 4093, 4245, 4397,
+ 4547, 4695, 4841, 4985, 5127, 5267, 5405, 5539, 5671, 5799,
+ 5923, 6043, 6159, 6271, 6379, 6483, 6583, 6677, 6767, 6851,
+ 6929, 7003, 7071, 7133, 7189, 7239, 7283, 7321, 7353, 7379,
+ 7399, 7413, 7419, 7420, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 489, 567, 651,
+ 741, 835, 935, 1039, 1147, 1259, 1377, 1499, 1625, 1753,
+ 1885, 2021, 2159, 2301, 2445, 2591, 2739, 2889, 3041, 3195,
+ 3349, 3505, 3661, 3817, 3973, 4129, 4285, 4441, 4595, 4749,
+ 4901, 5051, 5199, 5345, 5489, 5631, 5769, 5905, 6037, 6165,
+ 6291, 6413, 6531, 6643, 6751, 6855, 6955, 7049, 7139, 7223,
+ 7301, 7373, 7441, 7503, 7559, 7609, 7653, 7691, 7723, 7749,
+ 7769, 7783, 7789, 7790, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
+ 747, 843, 945, 1051, 1161, 1277, 1397, 1521, 1649, 1781,
+ 1915, 2053, 2195, 2339, 2485, 2635, 2787, 2941, 3095, 3251,
+ 3409, 3567, 3725, 3885, 4045, 4205, 4363, 4521, 4679, 4835,
+ 4989, 5143, 5295, 5445, 5591, 5735, 5877, 6015, 6149, 6281,
+ 6409, 6533, 6653, 6769, 6879, 6985, 7087, 7183, 7273, 7359,
+ 7439, 7513, 7581, 7643, 7699, 7749, 7793, 7831, 7863, 7889,
+ 7909, 7923, 7929, 7930, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
+ 747, 843, 943, 1049, 1159, 1273, 1393, 1517, 1645, 1777,
+ 1913, 2051, 2193, 2337, 2485, 2635, 2787, 2941, 3097, 3255,
+ 3415, 3575, 3737, 3899, 4061, 4223, 4385, 4547, 4709, 4869,
+ 5029, 5187, 5343, 5497, 5649, 5799, 5947, 6091, 6233, 6371,
+ 6507, 6639, 6767, 6891, 7011, 7125, 7235, 7341, 7441, 7537,
+ 7627, 7713, 7793, 7867, 7935, 7997, 8053, 8103, 8147, 8185,
+ 8217, 8243, 8263, 8277, 8283, 8284, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
+ 571, 655, 745, 841, 941, 1047, 1157, 1271, 1389, 1513,
+ 1641, 1773, 1907, 2045, 2187, 2331, 2479, 2629, 2783, 2939,
+ 3097, 3257, 3417, 3579, 3743, 3907, 4071, 4235, 4399, 4563,
+ 4727, 4891, 5055, 5217, 5377, 5537, 5695, 5851, 6005, 6155,
+ 6303, 6447, 6589, 6727, 6861, 6993, 7121, 7245, 7363, 7477,
+ 7587, 7693, 7793, 7889, 7979, 8063, 8143, 8217, 8285, 8347,
+ 8403, 8453, 8497, 8535, 8567, 8593, 8613, 8627, 8633, 8634,
+ 0, 1, 7, 21, 41, 67, 99, 137, 181, 231,
+ 287, 349, 417, 491, 571, 657, 749, 845, 947, 1053,
+ 1165, 1281, 1401, 1527, 1657, 1791, 1929, 2069, 2213, 2361,
+ 2511, 2663, 2819, 2977, 3137, 3299, 3463, 3627, 3793, 3959,
+ 4125, 4293, 4461, 4629, 4795, 4961, 5127, 5291, 5455, 5617,
+ 5777, 5935, 6091, 6243, 6393, 6541, 6685, 6825, 6963, 7097,
+ 7227, 7353, 7473, 7589, 7701, 7807, 7909, 8005, 8097, 8183,
+ 8263, 8337, 8405, 8467, 8523, 8573, 8617, 8655, 8687, 8713,
+ 8733, 8747, 8753, 8754, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
+ 747, 843, 943, 1049, 1159, 1275, 1395, 1519, 1647, 1779,
+ 1915, 2055, 2199, 2345, 2495, 2647, 2803, 2961, 3121, 3283,
+ 3447, 3613, 3779, 3947, 4115, 4285, 4455, 4625, 4795, 4965,
+ 5133, 5301, 5467, 5633, 5797, 5959, 6119, 6277, 6433, 6585,
+ 6735, 6881, 7025, 7165, 7301, 7433, 7561, 7685, 7805, 7921,
+ 8031, 8137, 8237, 8333, 8423, 8509, 8589, 8663, 8731, 8793,
+ 8849, 8899, 8943, 8981, 9013, 9039, 9059, 9073, 9079, 9080,
+ 0, 1, 7, 19, 39, 65, 97, 135, 179, 229,
+ 285, 347, 415, 489, 567, 651, 741, 835, 935, 1041,
+ 1151, 1265, 1385, 1509, 1637, 1769, 1905, 2045, 2189, 2335,
+ 2485, 2637, 2793, 2951, 3111, 3273, 3437, 3603, 3771, 3939,
+ 4109, 4279, 4451, 4623, 4795, 4967, 5139, 5309, 5479, 5647,
+ 5815, 5981, 6145, 6307, 6467, 6625, 6781, 6933, 7083, 7229,
+ 7373, 7513, 7649, 7781, 7909, 8033, 8153, 8267, 8377, 8483,
+ 8583, 8677, 8767, 8851, 8929, 9003, 9071, 9133, 9189, 9239,
+ 9283, 9321, 9353, 9379, 9399, 9411, 9417, 9418, 0, 1,
+ 7, 21, 41, 67, 99, 137, 181, 231, 287, 349,
+ 417, 491, 571, 657, 747, 843, 945, 1051, 1163, 1279,
+ 1399, 1525, 1655, 1789, 1927, 2069, 2213, 2361, 2513, 2667,
+ 2825, 2985, 3147, 3311, 3477, 3645, 3815, 3985, 4157, 4329,
+ 4503, 4677, 4851, 5025, 5199, 5371, 5543, 5713, 5883, 6051,
+ 6217, 6381, 6543, 6703, 6861, 7015, 7167, 7315, 7459, 7601,
+ 7739, 7873, 8003, 8129, 8249, 8365, 8477, 8583, 8685, 8781,
+ 8871, 8957, 9037, 9111, 9179, 9241, 9297, 9347, 9391, 9429,
+ 9461, 9487, 9507, 9521, 9527, 9528, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
+ 571, 657, 749, 845, 947, 1055, 1167, 1285, 1407, 1533,
+ 1663, 1797, 1935, 2077, 2223, 2373, 2525, 2681, 2839, 3001,
+ 3165, 3331, 3499, 3669, 3839, 4011, 4185, 4359, 4533, 4709,
+ 4885, 5061, 5235, 5409, 5583, 5755, 5925, 6095, 6263, 6429,
+ 6593, 6755, 6913, 7069, 7221, 7371, 7517, 7659, 7797, 7931,
+ 8061, 8187, 8309, 8427, 8539, 8647, 8749, 8845, 8937, 9023,
+ 9103, 9177, 9245, 9307, 9363, 9413, 9457, 9495, 9527, 9553,
+ 9573, 9587, 9593, 9594, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 571, 655,
+ 745, 841, 941, 1047, 1157, 1273, 1393, 1517, 1647, 1781,
+ 1919, 2061, 2207, 2355, 2507, 2663, 2821, 2981, 3145, 3311,
+ 3479, 3649, 3821, 3993, 4167, 4341, 4517, 4693, 4869, 5045,
+ 5221, 5397, 5573, 5747, 5921, 6093, 6265, 6435, 6603, 6769,
+ 6933, 7093, 7251, 7407, 7559, 7707, 7853, 7995, 8133, 8267,
+ 8397, 8521, 8641, 8757, 8867, 8973, 9073, 9169, 9259, 9343,
+ 9423, 9497, 9565, 9627, 9683, 9733, 9777, 9815, 9847, 9873,
+ 9893, 9907, 9913, 9914, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
+ 747, 843, 945, 1051, 1163, 1279, 1401, 1527, 1657, 1791,
+ 1929, 2071, 2217, 2367, 2519, 2675, 2835, 2997, 3161, 3327,
+ 3495, 3665, 3837, 4011, 4185, 4361, 4537, 4715, 4893, 5071,
+ 5249, 5427, 5603, 5779, 5953, 6127, 6299, 6469, 6637, 6803,
+ 6967, 7129, 7289, 7445, 7597, 7747, 7893, 8035, 8173, 8307,
+ 8437, 8563, 8685, 8801, 8913, 9019, 9121, 9217, 9307, 9393,
+ 9473, 9547, 9615, 9677, 9733, 9783, 9827, 9865, 9897, 9923,
+ 9943, 9957, 9963, 9964, 0, 1, 7, 21, 41, 67,
+ 99, 137, 181, 231, 287, 349, 417, 491, 571, 657,
+ 749, 845, 947, 1055, 1167, 1285, 1407, 1533, 1663, 1799,
+ 1939, 2083, 2229, 2379, 2533, 2689, 2849, 3011, 3177, 3345,
+ 3515, 3687, 3861, 4035, 4211, 4387, 4565, 4743, 4921, 5099,
+ 5277, 5455, 5633, 5809, 5985, 6159, 6333, 6505, 6675, 6843,
+ 7009, 7171, 7331, 7487, 7641, 7791, 7937, 8081, 8221, 8357,
+ 8487, 8613, 8735, 8853, 8965, 9073, 9175, 9271, 9363, 9449,
+ 9529, 9603, 9671, 9733, 9789, 9839, 9883, 9921, 9953, 9979,
+ 9999, 10013, 10019, 10020, 0, 1, 7, 19, 39, 65,
+ 97, 135, 179, 229, 285, 347, 415, 489, 567, 651,
+ 741, 837, 937, 1043, 1153, 1269, 1389, 1513, 1643, 1777,
+ 1915, 2057, 2203, 2351, 2503, 2659, 2817, 2979, 3143, 3309,
+ 3477, 3647, 3819, 3993, 4169, 4345, 4523, 4701, 4881, 5061,
+ 5241, 5421, 5601, 5779, 5957, 6133, 6309, 6483, 6655, 6825,
+ 6993, 7159, 7323, 7485, 7643, 7799, 7951, 8099, 8245, 8387,
+ 8525, 8659, 8789, 8913, 9033, 9149, 9259, 9365, 9465, 9561,
+ 9651, 9735, 9813, 9887, 9955, 10017, 10073, 10123, 10167, 10205,
+ 10237, 10263, 10283, 10295, 10301, 10302, 0, 1, 7, 21,
+ 41, 67, 99, 137, 181, 231, 287, 349, 417, 491,
+ 571, 655, 745, 841, 941, 1047, 1159, 1275, 1395, 1521,
+ 1651, 1785, 1923, 2065, 2211, 2361, 2513, 2669, 2829, 2991,
+ 3155, 3321, 3491, 3663, 3837, 4011, 4187, 4365, 4543, 4723,
+ 4903, 5083, 5263, 5443, 5623, 5803, 5981, 6159, 6335, 6509,
+ 6683, 6855, 7025, 7191, 7355, 7517, 7677, 7833, 7985, 8135,
+ 8281, 8423, 8561, 8695, 8825, 8951, 9071, 9187, 9299, 9405,
+ 9505, 9601, 9691, 9775, 9855, 9929, 9997, 10059, 10115, 10165,
+ 10209, 10247, 10279, 10305, 10325, 10339, 10345, 10346, 0, 1,
+ 7, 21, 41, 67, 99, 137, 181, 231, 287, 349,
+ 417, 491, 571, 655, 745, 841, 943, 1049, 1161, 1277,
+ 1397, 1523, 1653, 1787, 1925, 2067, 2213, 2363, 2517, 2673,
+ 2833, 2995, 3159, 3327, 3497, 3669, 3843, 4019, 4195, 4373,
+ 4551, 4731, 4911, 5091, 5271, 5451, 5631, 5811, 5989, 6167,
+ 6343, 6519, 6693, 6865, 7035, 7203, 7367, 7529, 7689, 7845,
+ 7999, 8149, 8295, 8437, 8575, 8709, 8839, 8965, 9085, 9201,
+ 9313, 9419, 9521, 9617, 9707, 9791, 9871, 9945, 10013, 10075,
+ 10131, 10181, 10225, 10263, 10295, 10321, 10341, 10355, 10361, 10362,
+ 0, 1, 7, 21, 41, 67, 99, 137, 181, 231,
+ 287, 349, 417, 491, 571, 657, 747, 843, 945, 1051,
+ 1163, 1279, 1399, 1525, 1655, 1789, 1927, 2069, 2215, 2365,
+ 2519, 2675, 2835, 2997, 3161, 3329, 3499, 3671, 3845, 4021,
+ 4197, 4375, 4553, 4733, 4913, 5093, 5273, 5453, 5633, 5813,
+ 5991, 6169, 6345, 6521, 6695, 6867, 7037, 7205, 7369, 7531,
+ 7691, 7847, 8001, 8151, 8297, 8439, 8577, 8711, 8841, 8967,
+ 9087, 9203, 9315, 9421, 9523, 9619, 9709, 9795, 9875, 9949,
+ 10017, 10079, 10135, 10185, 10229, 10267, 10299, 10325, 10345, 10359,
+ 10365, 10366
+};
+
+const int16_t ivas_pca_offset_n2[IVAS_PCA_N1] =
+{
+ 0, 2, 6, 14, 24, 38, 56, 76, 100, 126, 156, 188,
+ 224, 262, 302, 346, 392, 442, 494, 548, 604, 664, 726, 790,
+ 856, 924, 994, 1066, 1140, 1216, 1294, 1374, 1454, 1536, 1620, 1704,
+ 1790, 1878, 1966, 2054, 2144, 2234, 2324, 2416, 2508, 2600, 2692, 2784,
+ 2876, 2968, 3058, 3148, 3238, 3326, 3414, 3502, 3588, 3672, 3756, 3838,
+ 3918, 3998, 4076, 4152, 4226, 4298, 4368, 4436, 4502, 4566, 4628, 4688,
+ 4744, 4798, 4850, 4900, 4946, 4990, 5030, 5068, 5104, 5136, 5166, 5192,
+ 5216, 5236, 5254, 5268, 5278, 5286, 5290
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Parametric MC ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const int16_t param_mc_band_grouping_20[20 + 1] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 17, 20, 23, 27, 33, 40, 52, 60
+};
+
+const int16_t param_mc_coding_band_mapping_20[20] =
+{
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+const int16_t param_mc_bands_coded_20[4] =
+{
+ 10, 14, 18, 20
+};
+
+const int16_t param_mc_band_grouping_14[14 + 1] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 28, 40, 60
+};
+
+
+const int16_t param_mc_coding_band_mapping_14[14] =
+{
+ 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
+};
+
+const int16_t param_mc_bands_coded_14[4] =
+{
+ 8, 11, 13, 14
+};
+
+const int16_t param_mc_band_grouping_10[10 + 1] =
+{
+ 0, 1, 2, 3, 5, 7, 10, 14, 20, 40, 60
+};
+
+
+const int16_t param_mc_bands_coded_10[4] =
+{
+ 6, 8, 9, 10
+};
+
+const int16_t param_mc_coding_band_mapping_10[10] =
+{
+ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
+};
+
+const int16_t Param_MC_index[MAX_CICP_CHANNELS] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
+};
+
+const float ivas_param_mc_dmx_fac_CICP6_2tc[12] =
+{
+ 1.0f, 0.0f, INV_SQRT2, INV_SQRT2, 1.0f, 0.0f, /*Lt*/
+ 0.0f, 1.0f, INV_SQRT2, INV_SQRT2, 0.0f, 1.0f /*Rt*/
+};
+
+const float ivas_param_mc_dmx_fac_CICP12_2tc[16] =
+{
+ 1.0f, 0.0f, INV_SQRT2, INV_SQRT2, 1.0f, 0.0f, 1.0f, 0.0f, /*Lt*/
+ 0.0f, 1.0f, INV_SQRT2, INV_SQRT2, 0.0f, 1.0f, 0.0f, 1.0f /*Rt*/
+};
+
+const float ivas_param_mc_dmx_fac_CICP12_3tc[24] =
+{
+ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, /*Lt*/
+ 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, /*Rt*/
+ 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f /*Ct*/
+};
+
+const float ivas_param_mc_dmx_fac_CICP14_2tc[16] =
+{
+ 1.0f, 0.0f, INV_SQRT2, INV_SQRT2, 1.0f, 0.0f, 1.0f, 0.0f, /*Lt*/
+ 0.0f, 1.0f, INV_SQRT2, INV_SQRT2, 0.0f, 1.0f, 0.0f, 1.0f /*Rt*/
+};
+const float ivas_param_mc_dmx_fac_CICP14_3tc[24] =
+{
+ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, /*Lt*/
+ 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, /*Rt*/
+ 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, /*Ct*/
+};
+
+const float ivas_param_mc_dmx_fac_CICP16_3tc[30] =
+{
+ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, /*Lt*/
+ 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, /*Rt*/
+ 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f /*Ct*/
+};
+
+const float ivas_param_mc_dmx_fac_CICP19_3tc[36] =
+{
+ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, /*Lt*/
+ 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, /*Rt*/
+ 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f /*Ct*/
+};
+
+const float ivas_param_mc_dmx_fac_CICP19_4tc[48] =
+{
+ 1.0f, 0.0f, INV_SQRT2, INV_SQRT2, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, /*Lht*/
+ 0.0f, 1.0f, INV_SQRT2, INV_SQRT2, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, /*Rht*/
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, /*Lut*/
+ 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, /*Rut*/
+};
+
+/* Coefficient for Parametric MC ILD factorization */
+const float ivas_param_mc_ild_fac_CICP6_2tc[6] =
+{
+ 0.391608498887651f,
+ 0.391608498887651f,
+ 0.208150823035836f,
+ 0.323713613305539f,
+ 0.323713613305539f,
+ 0.208150823035836f,
+};
+
+const float ivas_param_mc_ild_fac_CICP12_2tc[8] =
+{
+ 0.365151211522008f,
+ 0.365151211522008f,
+ 0.208008958987949f,
+ 0.209863469733018f,
+ 0.209863469733018f,
+ 0.171473949468979f,
+ 0.171473949468979f,
+ 0.208008958987949f
+};
+
+const float ivas_param_mc_ild_fac_CICP12_3tc[8] =
+{
+ 0.5f,
+ 0.5f,
+ 0.29f,
+ 0.29f,
+ 0.2f,
+ 0.2f,
+ 1.0f,
+ 0.25f
+};
+
+const float ivas_param_mc_ild_fac_CICP14_2tc[8] =
+{
+ 0.36427054f,
+ 0.36427054f,
+ 0.18290930f,
+ 0.21193730f,
+ 0.21193730f,
+ 0.24564756f,
+ 0.24564756f,
+ 0.20800895f
+};
+
+const float ivas_param_mc_ild_fac_CICP14_3tc[8] =
+{
+ 0.49716263f,
+ 0.49716263f,
+ 0.25198298f,
+ 0.25198298f,
+ 0.29498283f,
+ 0.29498283f,
+ 1.0f,
+ 0.25f
+};
+
+const float ivas_param_mc_ild_fac_CICP16_3tc[10] =
+{
+ 0.34f,
+ 0.34f,
+ 0.22f,
+ 0.22f,
+ 0.20f,
+ 0.20f,
+ 0.18f,
+ 0.18f,
+ 1.0f,
+ 0.25f,
+};
+
+const float ivas_param_mc_ild_fac_CICP19_3tc[12] =
+{
+ 0.3f,
+ 0.3f,
+ 0.17f,
+ 0.17f,
+ 0.12f,
+ 0.12f,
+ 0.19f,
+ 0.19f,
+ 0.19f,
+ 0.19f,
+ 1.0f,
+ 0.5f
+};
+
+const float ivas_param_mc_ild_fac_CICP19_4tc[12] =
+{
+ 0.35f,
+ 0.35f,
+ 0.17f,
+ 0.22f,
+ 0.2f,
+ 0.2f,
+ 0.2f,
+ 0.5f,
+ 0.5f,
+ 0.5f,
+ 0.5f,
+ 0.2f,
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP6_2tc =
+{
+ 5,
+ 6,
+ {0,1,2,4,5,3},
+ {1,1,2,1,1,2},
+ {{0},{1},{0,1},{0},{1},{0,1}}
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP12_2tc =
+{
+ 7,
+ 8,
+ {0,1,2,4,5,6,7,3},
+ {1,1,2,1,1,1,1,2},
+ {{0},{1},{0,1},{0},{1},{0},{1},{0,1}}
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP12_3tc =
+{
+ 6,
+ 8,
+ {0,1,4,5,6,7,2,3},
+ {1,1,1,1,1,1,1,1},
+ {{0},{1},{0},{1},{0},{1},{2},{2}}
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP14_2tc =
+{
+ 7,
+ 8,
+ {0,1,2,4,5,6,7,3},
+ {1,1,2,1,1,1,1,2},
+ {{0},{1},{0,1},{0},{1},{0},{1},{0,1}}
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP14_3tc =
+{
+ 6,
+ 8,
+ {0,1,4,5,6,7,2,3},
+ {1,1,1,1,1,1,1,1},
+ {{0},{1},{0},{1},{0},{1},{2},{2}}
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP16_3tc =
+{
+ 8,
+ 10,
+ {0,1,4,5,6,7,8,9,2,3},
+ {1,1,1,1,1,1,1,1,1,1},
+ {{0},{1},{0},{1},{0},{1},{0},{1},{2},{2}}
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP19_3tc =
+{
+ 10,
+ 12,
+ {0,1,4,5,6,7,8,9,10,11,2,3},
+ {1,1,1,1,1,1,1,1,1,1,1,1},
+ {{0},{1},{0},{1},{0},{1},{0},{1},{0},{1},{2},{2}}
+};
+
+const PARAM_MC_ILD_MAPPING ivas_param_mc_ild_mapping_CICP19_4tc =
+{
+ 11,
+ 12,
+ {0,1,2,4,5,6,7,8,9,10,11,3},
+ {1,1,2,1,1,1,1,1,1,1,1,2},
+ {{0},{1},{0,1},{0},{1},{0},{1},{2},{3},{2},{3},{0,1}}
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP6_2tc =
+{
+ 4,
+ 5,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 2, 3 }} /* C/LFE */
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP12_2tc =
+{
+ 6,
+ 7,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 2, 6 }, /* C/BLS */
+ { 2, 7 }, /* C/BRS */
+ { 2, 3 } /* C/LFE */
+ }
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP12_3tc =
+{
+ 6,
+ 7,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 0, 6 }, /* L/BLS */
+ { 1, 7 }, /* R/BRS */
+ { 2, 3 } /* C/LFE */
+ }
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP14_2tc =
+{
+ 6,
+ 7,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 2, 6 }, /* C/UFL */
+ { 2, 7 }, /* C/UFR */
+ { 2, 3 } /* C/LFE */
+ }
+};
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP14_3tc =
+{
+ 6,
+ 7,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 0, 6 }, /* L/UFL */
+ { 1, 7 }, /* R/UFR */
+ { 2, 3 } /* C/LFE */
+ }
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP16_3tc =
+{
+ 8,
+ 9,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 0, 6 }, /* L/UFL */
+ { 1, 7 }, /* R/UFR */
+ { 4, 8 }, /* LS/UBL */
+ { 5, 9 }, /* RS/UBR */
+ { 2, 3 } /* C/LFE */
+ }
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_3tc =
+{
+ 10,
+ 11,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 0, 6 }, /* L/LBS */
+ { 1, 7 }, /* R/RBS */
+ { 0, 8 }, /* L/UFL */
+ { 1, 9 }, /* R/UFR */
+ { 6, 10 }, /* LBS/UBL */
+ { 7, 11 }, /* RBS/UBR */
+ { 2, 3 } /* C/LFE */
+ }
+};
+
+const PARAM_MC_ICC_MAPPING ivas_param_mc_icc_mapping_CICP19_4tc =
+{
+ 8,
+ 9,
+ { { 0, 4 }, /* L/LS */
+ { 1, 5 }, /* R/RS */
+ { 0, 2 }, /* L/C */
+ { 1, 2 }, /* R/C */
+ { 0, 6 }, /* L/LBS */
+ { 1, 7 }, /* R/RBS */
+ { 8, 10 }, /*UFL/UBL */
+ { 9, 11 }, /*UFR/UBR */
+ { 2, 3 } /* C/LFE */
+ }
+};
+
+const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS] =
+{
+ /* CICP6 48000 */
+ {
+ MC_LS_SETUP_5_1,
+ 6,
+ 2,
+ IVAS_48k,
+ &ivas_param_mc_ild_mapping_CICP6_2tc,
+ &ivas_param_mc_icc_mapping_CICP6_2tc,
+ &ivas_param_mc_dmx_fac_CICP6_2tc[0],
+ &ivas_param_mc_ild_fac_CICP6_2tc[0]
+ },
+ /* CICP6 64000 */
+ {
+ MC_LS_SETUP_5_1,
+ 6,
+ 2,
+ IVAS_64k,
+ &ivas_param_mc_ild_mapping_CICP6_2tc,
+ &ivas_param_mc_icc_mapping_CICP6_2tc,
+ &ivas_param_mc_dmx_fac_CICP6_2tc[0],
+ &ivas_param_mc_ild_fac_CICP6_2tc[0]
+ },
+ /* CICP6 80000 */
+ {
+ MC_LS_SETUP_5_1,
+ 6,
+ 2,
+ IVAS_80k,
+ &ivas_param_mc_ild_mapping_CICP6_2tc,
+ &ivas_param_mc_icc_mapping_CICP6_2tc,
+ &ivas_param_mc_dmx_fac_CICP6_2tc[0],
+ &ivas_param_mc_ild_fac_CICP6_2tc[0]
+ },
+ /* CICP12 48000 */
+ {
+ MC_LS_SETUP_7_1,
+ 8,
+ 2,
+ IVAS_48k,
+ &ivas_param_mc_ild_mapping_CICP12_2tc,
+ &ivas_param_mc_icc_mapping_CICP12_2tc,
+ &ivas_param_mc_dmx_fac_CICP12_2tc[0],
+ &ivas_param_mc_ild_fac_CICP12_2tc[0]
+ },
+ /* CICP12 64000 */
+ {
+ MC_LS_SETUP_7_1,
+ 8,
+ 2,
+ IVAS_64k,
+ &ivas_param_mc_ild_mapping_CICP12_2tc,
+ &ivas_param_mc_icc_mapping_CICP12_2tc,
+ &ivas_param_mc_dmx_fac_CICP12_2tc[0],
+ &ivas_param_mc_ild_fac_CICP12_2tc[0]
+ },
+ /* CICP12 80000 */
+ {
+ MC_LS_SETUP_7_1,
+ 8,
+ 2,
+ IVAS_80k,
+ &ivas_param_mc_ild_mapping_CICP12_2tc,
+ &ivas_param_mc_icc_mapping_CICP12_2tc,
+ &ivas_param_mc_dmx_fac_CICP12_2tc[0],
+ &ivas_param_mc_ild_fac_CICP12_2tc[0]
+ },
+ /* CICP12 96000 */
+ {
+ MC_LS_SETUP_7_1,
+ 8,
+ 3,
+ IVAS_96k,
+ &ivas_param_mc_ild_mapping_CICP12_3tc,
+ &ivas_param_mc_icc_mapping_CICP12_3tc,
+ &ivas_param_mc_dmx_fac_CICP12_3tc[0],
+ &ivas_param_mc_ild_fac_CICP12_3tc[0]
+ },
+ /* CICP14 48000 */
+ {
+ MC_LS_SETUP_5_1_2,
+ 8,
+ 2,
+ IVAS_48k,
+ &ivas_param_mc_ild_mapping_CICP14_2tc,
+ &ivas_param_mc_icc_mapping_CICP14_2tc,
+ &ivas_param_mc_dmx_fac_CICP14_2tc[0],
+ &ivas_param_mc_ild_fac_CICP14_2tc[0]
+ },
+ /* CICP14 64000 */
+ {
+ MC_LS_SETUP_5_1_2,
+ 8,
+ 2,
+ IVAS_64k,
+ &ivas_param_mc_ild_mapping_CICP14_2tc,
+ &ivas_param_mc_icc_mapping_CICP14_2tc,
+ &ivas_param_mc_dmx_fac_CICP14_2tc[0],
+ &ivas_param_mc_ild_fac_CICP14_2tc[0]
+ },
+ /* CICP14 80000 */
+ {
+ MC_LS_SETUP_5_1_2,
+ 8,
+ 2,
+ IVAS_80k,
+ &ivas_param_mc_ild_mapping_CICP14_2tc,
+ &ivas_param_mc_icc_mapping_CICP14_2tc,
+ &ivas_param_mc_dmx_fac_CICP14_2tc[0],
+ &ivas_param_mc_ild_fac_CICP14_2tc[0]
+ },
+ /* CICP14 96000 */
+ {
+ MC_LS_SETUP_5_1_2,
+ 8,
+ 3,
+ IVAS_96k,
+ &ivas_param_mc_ild_mapping_CICP14_3tc,
+ &ivas_param_mc_icc_mapping_CICP14_3tc,
+ &ivas_param_mc_dmx_fac_CICP14_3tc[0],
+ &ivas_param_mc_ild_fac_CICP14_3tc[0]
+ },
+ /* CICP16 96000 */
+ {
+ MC_LS_SETUP_5_1_4,
+ 10,
+ 3,
+ IVAS_96k,
+ &ivas_param_mc_ild_mapping_CICP16_3tc,
+ &ivas_param_mc_icc_mapping_CICP16_3tc,
+ &ivas_param_mc_dmx_fac_CICP16_3tc[0],
+ &ivas_param_mc_ild_fac_CICP16_3tc[0]
+ },
+ /* CICP16 128000 */
+ {
+ MC_LS_SETUP_5_1_4,
+ 10,
+ 3,
+ IVAS_128k,
+ &ivas_param_mc_ild_mapping_CICP16_3tc,
+ &ivas_param_mc_icc_mapping_CICP16_3tc,
+ &ivas_param_mc_dmx_fac_CICP16_3tc[0],
+ &ivas_param_mc_ild_fac_CICP16_3tc[0]
+ },
+ /* CICP19 128000 */
+ {
+ MC_LS_SETUP_7_1_4,
+ 12,
+ 3,
+ IVAS_128k,
+ &ivas_param_mc_ild_mapping_CICP19_3tc,
+ &ivas_param_mc_icc_mapping_CICP19_3tc,
+ &ivas_param_mc_dmx_fac_CICP19_3tc[0],
+ &ivas_param_mc_ild_fac_CICP19_3tc[0]
+ },
+ /* CICP19 160000 */
+ {
+ MC_LS_SETUP_7_1_4,
+ 12,
+ 4,
+ IVAS_160k,
+ &ivas_param_mc_ild_mapping_CICP19_4tc,
+ &ivas_param_mc_icc_mapping_CICP19_4tc,
+ &ivas_param_mc_dmx_fac_CICP19_4tc[0],
+ &ivas_param_mc_ild_fac_CICP19_4tc[0]
+ }
+};
+
+const float ivas_param_mc_quant_ild_5d1_48[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ -100.0f, -20.0f, -13.0f, -10.0f,
+ -8.0f, -5.5f, -3.5f, -1.5f, 0.0f, 1.5f, 3.5f, 5.5f, 8.0f, 10.0f, 13.0f, 20.0f
+};
+
+/* Quantizer for ICCs in Parametric MC Processing */
+const float ivas_param_mc_quant_icc[PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ -0.99f, -0.589f, 0.0f, 0.36764f, 0.60092f, 0.84118f, 0.937f, 1.0f
+};
+
+/* Alphabet for delta coding for the ICCs in Parametric MC processing */
+const uint16_t ivas_param_mc_cum_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] =
+{
+ 0, 24, 224, 20873, 42384, 51699, 57122, 60572, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 24, 200, 20649, 21511, 9315, 5423, 3450, 4963
+};
+
+const uint16_t ivas_param_mc_cum_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 0, 4, 9, 124, 447, 1311, 4453, 18116, 48636, 60573, 63692, 64746, 65327, 65531, 65534, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] =
+{
+ 4, 5, 115, 323, 864, 3142, 13663, 30520, 11937, 3119, 1054, 581, 204, 3, 1
+};
+
+const uint16_t ivas_param_mc_cum_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] =
+{
+ 0, 30, 848, 26611, 47846, 57358, 61679, 63237, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 30, 818, 25763, 21235, 9512, 4321, 1558, 2298
+};
+
+const uint16_t ivas_param_mc_cum_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 0, 2, 7, 53, 243, 979, 3994, 16732, 49642, 61343, 64331, 65158, 65438, 65532, 65534, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] =
+{
+ 2, 5, 46, 190, 736, 3015, 12738, 32910, 11701, 2988, 827, 280, 94, 2, 1
+};
+
+const uint16_t ivas_param_mc_cum_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] =
+{
+ 0, 46, 826, 27798, 49552, 58447, 62046, 63284, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER ]={
+ 46, 780, 26972, 21754, 8895, 3599, 1238, 2251
+};
+
+const uint16_t ivas_param_mc_cum_freq_icc_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 0, 3, 8, 36, 172, 763, 3436, 15845, 50168, 62005, 64676, 65298, 65481, 65533, 65534, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_icc_delta_cicp14_48_16bits[2* PARAM_MC_SZ_ICC_QUANTIZER - 1] =
+{
+ 3, 5, 28, 136, 591, 2673, 12409, 34323, 11837, 2671, 622, 183, 52, 1, 1
+};
+
+const uint16_t ivas_param_mc_cum_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1] =
+{
+ 0, 34, 552, 24717, 45819, 54772, 59054, 61166, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 34, 518, 24165, 21102, 8953, 4282, 2112, 4369
+};
+
+const uint16_t ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER] =
+{
+ 0, 3, 7, 74, 304, 1009, 3870, 16502, 49834, 61384, 64217, 65020, 65369, 65531, 65534, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1] =
+{
+ 3, 4, 67, 230, 705, 2861, 12632, 33332, 11550, 2833, 803, 349, 162, 3, 1
+};
+
+const uint16_t ivas_param_mc_cum_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] =
+{
+ 0, 1092, 5574, 8315, 10652, 13875, 19656, 27664, 36284, 47058, 56251, 62579, 65118, 65462, 65513, 65532, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 1092, 4482, 2741, 2337, 3223, 5781, 8008, 8620, 10774, 9193, 6328, 2539, 344, 51, 19, 3
+};
+
+const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 0, 1, 2, 3, 5, 38, 146, 352, 638, 997, 1559, 2323, 3570, 5859, 10556, 21075, 44682, 55617, 60408, 62739, 63833, 64443, 64809, 65074, 65279, 65400, 65484, 65531, 65532, 65533, 65534, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] =
+{
+ 1, 1, 1, 2, 33, 108, 206, 286, 359, 562, 764, 1247, 2289, 4697, 10519, 23607, 10935, 4791, 2331, 1094, 610, 366, 265, 205, 121, 84, 47, 1, 1, 1, 1
+};
+
+const uint16_t ivas_param_mc_cum_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] =
+{
+ 0, 967, 6335, 9941, 12837, 16652, 22416, 29814, 38807, 48497, 57184, 62661, 64916, 65466, 65514, 65530, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 967, 5368, 3606, 2896, 3815, 5764, 7398, 8993, 9690, 8687, 5477, 2255, 550, 48, 16, 5
+};
+
+const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 0, 1, 2, 3, 5, 18, 61, 149, 320, 592, 1083, 1793, 2974, 5257, 10133, 21274, 44342, 55891, 60895, 63174, 64244, 64793, 65100, 65287, 65406, 65477, 65517, 65531, 65532, 65533, 65534, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] =
+{
+ 1, 1, 1, 2, 13, 43, 88, 171, 272, 491, 710, 1181, 2283, 4876, 11141, 23068, 11549, 5004, 2279, 1070, 549, 307, 187, 119, 71, 40, 14, 1, 1, 1, 1
+};
+
+const uint16_t ivas_param_mc_cum_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1] =
+{
+ 0, 229, 7068, 10910, 13856, 17467, 22629, 29174, 36906, 46558, 55579, 61802, 65222, 65505, 65527, 65534, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 229, 6839, 3842, 2946, 3611, 5162, 6545, 7732, 9652, 9021, 6223, 3420, 283, 22, 7, 1
+};
+
+const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 0, 1, 2, 3, 4, 12, 56, 153, 278, 475, 856, 1430, 2489, 4723, 9580, 20685, 45423, 56274, 60948, 63097, 64128, 64679, 65002, 65208, 65348, 65445, 65517, 65531, 65532, 65533, 65534, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] =
+{
+ 1, 1, 1, 1, 8, 44, 97, 125, 197, 381, 574, 1059, 2234, 4857, 11105, 24738, 10851, 4674, 2149, 1031, 551, 323, 206, 140, 97, 72, 14, 1, 1, 1, 1
+};
+
+const uint16_t ivas_param_mc_cum_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS+1] =
+{
+ 0, 1453, 8326, 12221, 15164, 18764, 24177, 31297, 39520, 49154, 57135, 62460, 64821, 65468, 65514, 65530, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 1453, 6873, 3895, 2943, 3600, 5413, 7120, 8223, 9634, 7981, 5325, 2361, 647, 46, 16, 5
+};
+
+const uint16_t ivas_param_mc_cum_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS] =
+{
+ 0, 1, 2, 3, 5, 29, 98, 220, 414, 699, 1186, 1876, 3049, 5304, 10013, 20612, 45247, 56109, 60818, 63022, 64081, 64647, 64977, 65198, 65348, 65443, 65502, 65530, 65532, 65533, 65534, 65535
+};
+
+const uint16_t ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1] =
+{
+ 1, 1, 1, 2, 24, 69, 122, 194, 285, 487, 690, 1173, 2255, 4709, 10599, 24635, 10862, 4709, 2204, 1059, 566, 330, 221, 150, 95, 59, 28, 2, 1, 1, 1
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * MASA ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const int16_t bits_direction_masa[DIRAC_DIFFUSE_LEVELS] =
+{
+ 11,
+ 11,
+ 10,
+ 9,
+ 7,
+ 6,
+ 5,
+ 3
+};
+
+const float coherence_cb0_masa[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH] =
+{
+ /* this is the same */
+ 0.0478f, 0.2547f, 0.5515f, 0.9865f, 1.3573f, 1.6838f, 1.9674f, 0.0f,
+ 0.1211f, 0.4123f, 0.6997f, 1.0154f, 1.4197f, 1.7971f, 0.0f, 0.0f,
+ 0.1614f, 0.5674f, 0.9708f, 1.3699f, 1.7357f, 0.0f, 0.0f, 0.0f,
+ 0.2349f, 0.7306f, 1.2051f, 1.6547f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.2381f, 0.7185f, 1.1758f, 1.6335f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.2400f, 0.7027f, 1.1407f, 1.6243f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.3518f, 0.9398f, 1.6454f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+
+ 0.1445f, 0.3432f, 0.5351f, 0.7524f, 1.0095f, 1.3210f, 1.7399f, 0.0f,
+ 0.2002f, 0.4447f, 0.6869f, 0.9593f, 1.3090f, 1.7029f, 0.0f, 0.0f,
+ 0.2617f, 0.5556f, 0.8645f, 1.2185f, 1.6051f, 0.0f, 0.0f, 0.0f,
+ 0.3318f, 0.6810f, 1.0445f, 1.4710f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.3324f, 0.6588f, 0.9980f, 1.4164f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.3378f, 0.6658f, 1.0009f, 1.4269f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.3986f, 0.8244f, 1.3526f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f
+
+ /* 0.0478f, 0.2547f, 1.9674f, 0.9865f, 0.5515f, 1.6838f, 1.3573f, 0.0f,
+ 0.1211f, 0.4123f, 0.6997f, 1.0154f, 1.4197f, 1.7971f, 0.0f, 0.0f,
+ 0.5674f, 0.9708f, 0.1614f, 1.3699f, 1.7357f, 0.0f, 0.0f, 0.0f,
+ 0.7306f, 1.2051f, 0.2349f, 1.6547f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.7185f, 1.1758f, 0.2381f, 1.6335f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.7027f, 1.1407f, 0.2400f, 1.6243f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.9398f, 1.6454f, 0.3518f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+
+ 0.3432f, 0.1445f, 0.5351f, 0.7524f, 1.0095f, 1.3210f, 1.7399f, 0.0f,
+ 0.4447f, 0.2002f, 0.6869f, 0.9593f, 1.3090f, 1.7029f, 0.0f, 0.0f,
+ 0.5556f, 0.2617f, 0.8645f, 1.2185f, 1.6051f, 0.0f, 0.0f, 0.0f,
+ 0.6810f, 0.3318f, 1.0445f, 1.4710f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.6588f, 0.3324f, 0.9980f, 1.4164f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.6658f, 0.3378f, 1.0009f, 1.4269f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.3986f, 0.8244f, 1.3526f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 1.0f, 0.0f, 0.000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f */
+};
+
+const float coherence_cb1_masa[MASA_NO_CV_COH1*MASA_MAXIMUM_CODING_SUBBANDS] =
+{
+ -0.0019f, 0.2597f, -0.2696f, 0.6269f, -0.6295f,
+ -0.0055f, 0.2582f, -0.2784f, 0.6473f, -0.6538f,
+ -0.0029f, 0.2506f, -0.2630f, 0.6498f, -0.6540f,
+ -0.0004f, 0.2546f, -0.2579f, 0.6851f, -0.6743f,
+ 0.0017f, 0.2521f, -0.2479f, 0.7217f, -0.7157f
+};
+
+const int16_t len_cb_dct0_masa[DIRAC_DIFFUSE_LEVELS] = { 7, 6, 5, 4, 4, 4, 3, 2 };
+
+const uint8_t sur_coherence_cb_masa[MASA_MAX_NO_CV_SUR_COH*MASA_NO_CB_SUR_COH] =
+{
+ 16, 99, 0, 0, 0, 0, 0, 0,
+ 12, 64, 167, 0, 0, 0, 0, 0,
+ 10, 45, 100, 218, 0, 0, 0, 0,
+ 8, 34, 70, 124, 235, 0, 0, 0,
+ 7, 27, 55, 90, 141, 242, 0, 0,
+ 7, 23, 45, 71, 105, 153, 247, 0,
+ 6, 20, 38, 60, 86, 119, 165, 249
+};
+
+const int16_t idx_cb_sur_coh_masa[MASA_MAX_NO_CV_SUR_COH] = { 0, 1, 2, 3, 4, 5, 5, 6 };
+
+const int16_t len_huf_masa[MASA_NO_CV_COH1] = { 4, 2, 1, 3, 4 };
+
+const int16_t huff_code_av_masa[MASA_NO_CV_COH1] = { 15, 2, 0, 6, 14 };
+
+const int16_t no_theta_masa[NO_SPHERICAL_GRIDS-2] = /* from 1 to 11 bits */
+{ /*1, 1,*/ 2 ,2 , 4, 5, 6, 7, 10, 14, 19
+ /*0, 2, 8, 6, 7, 12, 14, 16*/
+};
+
+const int16_t no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA] = /* from 1 to 11 bits*/
+{
+ { 2 },
+ { 4 },
+ { 4, 2 },
+ { 8, 4 }, /* 8, 4*/
+ { 12, 7, 2, 1 }, /* 12, */
+ { 14, 13, 9, 2, 1 },
+ { 22, 21, 17, 11, 3, 1 },
+ { 33, 32, 29, 23, 17, 9, 1 },
+ { 48, 47, 45, 41, 35, 28, 20, 12, 2, 1 },
+ { 60, 60, 58, 56, 54, 50, 46, 41, 36, 30, 23, 17, 10, 1 },
+ { 89, 89, 88, 86, 84, 81, 77, 73, 68, 63, 57, 51, 44, 38, 30, 23, 15, 8, 1 }
+};
+
+const float delta_theta_masa[NO_SPHERICAL_GRIDS - 2] =
+{ /*180.0f, 90.0f,*/ 45.0f, 45.0f, 36.0f, 25.5f, 20.0f, /*14.9f*/ 15.0f, 10.78f, 6.7f, 5.0f };
+/* spheres
+11 (10.9951) : (4.05,5) 89 89 88 86 84 81 77 73 68 63 57 51 44 38 30 23 15 8 1
+10 (10.0000): (6, 6.7) 60 60 58 56 54 50 46 41 36 30 23 17 10 1
+9 (8.9944): (7.5, 10.78) 48 47 45 41 35 28 20 12 2 1
+8 (7.9944): (10.8, 14.9) 33 32 29 23 17 9 1
+7 (7.0000): (16.5,20) 22 21 17 11 3 1
+6 (6.0000): (25,25.5) 14 13 9 2 1
+5 (5.0000): (36,36) 10 8 2 1
+4 (4.0000): (45 45) 8 4 (no +-90)
+3 (3.0000) (90,45) 4 2 (no +-90)
+2 (2.0000) (90,90) 4 (no +-90)
+1 () 2
+*/
+
+const float azimuth_cb[8] =
+{
+ 0.0f, -180.0f, -90.0f, 90.0f, -45.0f, 45.0f, -135.0f, 135.0f
+};
+
+const int16_t MASA_band_grouping_24[24 + 1] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30, 40, 60
+};
+
+const int16_t MASA_band_mapping_24_to_18[18 + 1] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 17, 20, 21, 22, 23, 24
+};
+
+const int16_t MASA_band_mapping_24_to_12[12 + 1] =
+{
+ 0, 1, 2, 3, 4, 5, 7, 9, 12, 15, 20, 22, 24
+};
+
+const int16_t MASA_band_mapping_24_to_8[8 + 1] =
+{
+ 0, 1, 2, 3, 5, 8, 12, 20, 24
+};
+
+const int16_t MASA_band_mapping_24_to_5[5 + 1] =
+{
+ 0, 1, 3, 7, 15, 24
+};
+
+const int16_t MASA_grouping_8_to_5[8] =
+{
+ 0, 1, 1, 2, 3, 3, 4, 4
+};
+
+const int16_t MASA_grouping_12_to_5[12] =
+{
+ 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4
+};
+
+const int16_t MASA_grouping_18_to_5[18] =
+{
+ 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4
+};
+
+const int16_t MASA_grouping_24_to_5[24] =
+{
+ 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4
+};
+
+/* IVAS_13k2, IVAS_16k4, IVAS_24k4, IVAS_32k, IVAS_48k, IVAS_64k, IVAS_80k, IVAS_96k, IVAS_128k, IVAS_160k, IVAS_192k, IVAS_256k, IVAS_384k, IVAS_512k */
+const int16_t masa_bits[IVAS_NUM_ACTIVE_BRATES] =
+{
+ 50, 60, 70, 85, 140, 180, 220, 256, 350, 432, 528, 832, 1024, MASA_MAX_BITS
+};
+
+const int16_t masa_bits_LR_stereo[4] =
+{
+ 50, 50, 60, 70
+};
+
+const int16_t mcmasa_bits[IVAS_NUM_ACTIVE_BRATES] =
+{
+ 50, 70, 80, 120, 140, 160, 220, 256, 288, 432, 528, 832, 1024, MASA_MAX_BITS
+};
+
+const uint8_t masa_nbands[IVAS_NUM_ACTIVE_BRATES] =
+{
+ 5, 5, 5, 5, 5, 5, 5, 5, 8, 12, 18, 24, 24, 24
+};
+
+const uint8_t masa_joined_nbands[IVAS_NUM_ACTIVE_BRATES] =
+{
+ 5, 5, 5, 8, 12, 12, 12, 18, 18, 18, 18, 24, 24, 24
+};
+
+const uint8_t masa_twodir_bands[IVAS_NUM_ACTIVE_BRATES] =
+{
+ 0, 0, 0, 0, 0, 1, 1, 1, 3, 4, 6, 6, 9, 12
+};
+
+const uint8_t masa_twodir_bands_joined[IVAS_NUM_ACTIVE_BRATES] =
+{
+ 0, 0, 0, 0, 0, 2, 2, 3, 4, 6, 8, 9, 12, 18
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Multi-channel LS setups
+ *----------------------------------------------------------------------------------*/
+
+const float ls_azimuth_CICP2[2] = { 30.0f, -30.0f };
+const float ls_elevation_CICP2[2] = { 0.0f, 0.0f };
+
+const float ls_azimuth_CICP6[5] = { 30.0f, -30.0f, 0.0f, 110.0f, -110.0f };
+const float ls_elevation_CICP6[5] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+
+const float ls_azimuth_CICP12[7] = { 30.0f, -30.0f, 0.0f, 110.0f, -110.0f, 135.0f, -135.0f };
+const float ls_elevation_CICP12[7] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
+
+const float ls_azimuth_CICP14[7] = { 30.0f, -30.0f, 0.0f, 110.0f, -110.0f, 30.0f, -30.0f };
+const float ls_elevation_CICP14[7] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 35.0f, 35.0f };
+
+const float ls_azimuth_CICP16[9] = { 30.0f, -30.0f, 0.0f, 110.0f, -110.0f, 30.0f, -30.0f, 110.0f, -110.0f };
+const float ls_elevation_CICP16[9] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 35.0f, 35.0f, 35.0f, 35.0f };
+
+const float ls_azimuth_CICP19[11] = { 30.0f, -30.0f, 0.0f, 135.0f, -135.0f, 90.0f, -90.0f, 30.0f, -30.0f, 135.0f, -135.0f };
+const float ls_elevation_CICP19[11] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 35.0f, 35.0f, 35.0f, 35.0f };
+
+const float cb_azi_chan[] = { 0.0f, 30.0f, 110.0f, 135.0f };
+
+const float McMASA_LFEGain_vectors[64] =
+{
+ 0.38f, 0.33f, 0.19f, 0.20f, /* 1st bit */
+ -0.16f, -0.22f, -0.35f, -0.34f,
+ 0.50f, 0.50f, 0.50f, 0.50f, /* 2nd bit*/
+ -0.80f, -0.40f, 1.02f, 0.10f,
+ -0.50f, -0.50f, -0.50f, -0.50f, /* 3rd bit */
+ -0.56f, -0.12f, -0.78f, 1.36f,
+ -1.02f, 1.18f, -0.57f, 0.33f,
+ 0.72f, -1.13f, 0.97f, -0.62f,
+ -0.91f, 0.93f, 1.00f, -1.10f, /* 4th bit*/
+ 1.73f, -0.23f, -0.78f, -0.84f,
+ 0.95f, -1.60f, -0.34f, 0.93f,
+ 0.87f, 0.47f, -1.90f, 0.52f,
+ 0.67f, 1.42f, -0.97f, -1.24f,
+ 0.83f, 0.58f, 0.61f, -2.04f,
+ -0.80f, -1.58f, 0.82f, 1.42f,
+ -2.14f, 0.26f, 0.84f, 1.02f
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * ISM ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const float ism_azimuth_borders[4] =
+{
+ ISM_AZIMUTH_MIN, ISM_AZIMUTH_LOW_BORDER, ISM_AZIMUTH_HIGH_BORDER, ISM_AZIMUTH_MAX
+};
+
+const float ism_elevation_borders[4] =
+{
+ ISM_ELEVATION_MIN, ISM_ELEVATION_LOW_BORDER, ISM_ELEVATION_HIGH_BORDER, ISM_ELEVATION_MAX
+};
+
+
+/*----------------------------------------------------------------------------------*
+ * Param ISM ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const int16_t Param_ISM_band_grouping[MAX_PARAM_ISM_NBANDS + 1] =
+{
+ 0, 1, 2, 3, 4, 6, 8, 11, 15, 21, 31, 60
+};
+
+/*----------------------------------------------------------------------------------*
+ * LFE coding ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const float ivas_lfe_window_coeff_48k[IVAS_LFE_FADE_LEN_48K] =
+{
+ 0.000111037183489911f, 0.000184173600662723f, 0.000260431056232165f, 0.000343096680773904f,
+ 0.000433557036912299f, 0.000532702330090964f, 0.000641245198570983f, 0.000759825620233343f,
+ 0.000889053268887781f, 0.00102952705612861f, 0.00118184503626756f, 0.00134660978209878f,
+ 0.00152443144932643f, 0.00171592958031516f, 0.00192173418063960f, 0.00214248635511166f,
+ 0.00237883866481051f, 0.00263145529985620f, 0.00290101212545378f, 0.00318819663720802f,
+ 0.00349370784884686f, 0.00381825612758351f, 0.00416256298736225f, 0.00452736084701996f,
+ 0.00491339275828344f, 0.00532141210711066f, 0.00575218229092557f, 0.00620647637363723f,
+ 0.00668507671987614f, 0.00718877460956053f, 0.00771836983367896f, 0.00827467027201698f,
+ 0.00885849145344304f, 0.00947065609929077f, 0.0101119936503206f, 0.0107833397777077f,
+ 0.0114855358784815f, 0.0122194285558262f, 0.0129858690846493f, 0.0137857128628235f,
+ 0.0146198188485090f, 0.0154890489839742f, 0.0163942676063398f, 0.0173363408456805f,
+ 0.0183161360109349f, 0.0193345209640845f, 0.0203923634830761f, 0.0214905306139788f,
+ 0.0226298880128789f, 0.0238112992780310f, 0.0250356252727999f, 0.0263037234399395f,
+ 0.0276164471077718f, 0.0289746447888419f, 0.0303791594716384f, 0.0318308279059821f,
+ 0.0333304798826995f, 0.0348789375082095f, 0.0364770144746630f, 0.0381255153262869f,
+ 0.0398252347225964f, 0.0415769566991470f, 0.0433814539265092f, 0.0452394869681573f,
+ 0.0471518035379721f, 0.0491191377580651f, 0.0511422094176377f, 0.0532217232335982f,
+ 0.0553583681136604f, 0.0575528164226564f, 0.0598057232527990f, 0.0621177256986303f,
+ 0.0644894421373997f, 0.0669214715156123f, 0.0694143926424920f, 0.0719687634911028f,
+ 0.0745851205078720f, 0.0772639779312550f, 0.0800058271202837f, 0.0828111358937321f,
+ 0.0856803478806326f, 0.0886138818828696f, 0.0916121312505734f, 0.0946754632710273f,
+ 0.0978042185717987f, 0.100998710538792f, 0.104259224749915f, 0.107586018425039f,
+ 0.110979319892929f, 0.114439328075791f, 0.117966211992097f, 0.121560110278315f,
+ 0.125221130730162f, 0.128949349863999f, 0.132744812498936f, 0.136607531360247f,
+ 0.140537486704635f, 0.144534625967897f, 0.148598863435505f, 0.152730079936616f,
+ 0.156928122561981f, 0.161192804406232f, 0.165523904334983f, 0.169921166777162f,
+ 0.174384301542983f, 0.178912983667934f, 0.183506853283123f, 0.188165515512334f,
+ 0.192888540396077f, 0.197675462842929f, 0.202525782608415f, 0.207438964301664f,
+ 0.212414437420042f, 0.217451596411945f, 0.222549800767893f, 0.227708375140074f,
+ 0.232926609490399f, 0.238203759267182f, 0.243539045610445f, 0.248931655585895f,
+ 0.254380742447540f, 0.259885425928913f, 0.265444792562823f, 0.271057896029545f,
+ 0.276723757533309f, 0.282441366206947f, 0.288209679544493f, 0.294027623861544f,
+ 0.299894094783121f, 0.305807957758767f, 0.311768048604592f, 0.317773174071915f,
+ 0.323822112442170f, 0.329913614147682f, 0.336046402417904f, 0.342219173950673f,
+ 0.348430599608033f, 0.354679325136114f, 0.360963971908571f, 0.367283137693016f,
+ 0.373635397439901f, 0.380019304093226f, 0.386433389422488f, 0.392876164875198f,
+ 0.399346122449318f, 0.405841735584931f, 0.412361460074412f, 0.418903734990401f,
+ 0.425466983630787f, 0.432049614479962f, 0.438650022185529f, 0.445266588549660f,
+ 0.451897683534280f, 0.458541666279211f, 0.465196886132432f, 0.471861683691556f,
+ 0.478534391855649f, 0.485213336886453f, 0.491896839478123f, 0.498583215834516f,
+ 0.505270778753096f, 0.511957838714501f, 0.518642704976797f, 0.525323686673448f,
+ 0.531999093914013f, 0.538667238886587f, 0.545326436960981f, 0.551975007791651f,
+ 0.558611276419351f, 0.565233574370526f, 0.571840240753416f, 0.578429623349869f,
+ 0.585000079701846f, 0.591549978191620f, 0.598077699114643f, 0.604581635744092f,
+ 0.611060195386091f, 0.617511800424606f, 0.623934889355033f, 0.630327917805494f,
+ 0.636689359544871f, 0.643017707476609f, 0.649311474617338f, 0.655569195059378f,
+ 0.661789424916185f, 0.667970743249834f, 0.674111752979635f, 0.680211081770987f,
+ 0.686267382903617f, 0.692279336118339f, 0.698245648441503f, 0.704165054986320f,
+ 0.710036319730275f, 0.715858236267842f, 0.721629628537765f, 0.727349351524163f,
+ 0.733016291930776f, 0.738629368827644f, 0.744187534269598f, 0.749689773885909f,
+ 0.755135107440516f, 0.760522589362248f, 0.765851309244508f, 0.771120392313900f,
+ 0.776328999867319f, 0.781476329677057f, 0.786561616363500f, 0.791584131735037f,
+ 0.796543185094819f, 0.801438123514058f, 0.806268332071584f, 0.811033234059390f,
+ 0.815732291153985f, 0.820365003553343f, 0.824930910079335f, 0.829429588245527f,
+ 0.833860654290276f, 0.838223763175109f, 0.842518608548382f, 0.846744922674278f,
+ 0.850902476327233f, 0.854991078651907f, 0.859010576988885f, 0.862960856666304f,
+ 0.866841840757651f, 0.870653489806038f, 0.874395801515260f, 0.878068810408014f,
+ 0.881672587451697f, 0.885207239652212f, 0.888672909616291f, 0.892069775082842f,
+ 0.895398048423911f, 0.898657976115850f, 0.901849838181344f, 0.904973947602979f,
+ 0.908030649709079f, 0.911020321532565f, 0.913943371143645f, 0.916800236957154f,
+ 0.919591387015427f, 0.922317318247601f, 0.924978555706293f, 0.927575651782607f,
+ 0.930109185400495f, 0.932579761191496f, 0.934988008650908f, 0.937334581276497f,
+ 0.939620155690861f, 0.941845430748583f, 0.944011126629350f, 0.946117983918227f,
+ 0.948166762674299f, 0.950158241488903f, 0.952093216534711f, 0.953972500606916f,
+ 0.955796922157805f, 0.957567324326003f, 0.959284563961681f, 0.960949510649049f,
+ 0.962563045727414f, 0.964126061312150f, 0.965639459316855f, 0.967104150478033f,
+ 0.968521053383593f, 0.969891093506458f, 0.971215202244581f, 0.972494315968637f,
+ 0.973729375078655f, 0.974921323070827f, 0.976071105615721f, 0.977179669649101f,
+ 0.978247962476515f, 0.979276930892814f, 0.980267520317711f, 0.981220673948460f,
+ 0.982137331930712f, 0.983018430548546f, 0.983864901434662f, 0.984677670801652f,
+ 0.985457658695232f, 0.986205778270287f, 0.986922935090503f, 0.987610026452330f,
+ 0.988267940733967f, 0.988897556770000f, 0.989499743252276f, 0.990075358157522f,
+ 0.990625248202194f, 0.991150248324956f, 0.991651181197124f, 0.992128856761388f,
+ 0.992584071799021f, 0.993017609525750f, 0.993430239216404f, 0.993822715858368f,
+ 0.994195779833855f, 0.994550156630899f, 0.994886556582961f, 0.995205674636936f,
+ 0.995508190149341f, 0.995794766710354f, 0.996066051995373f, 0.996322677643671f,
+ 0.996565259163689f, 0.996794395864463f, 0.997010670812624f, 0.997214650814370f,
+ 0.997406886421766f, 0.997587911962687f, 0.997758245593683f, 0.997918389375006f,
+ 0.998068829367008f, 0.998210035747091f, 0.998342462946368f, 0.998466549805146f,
+ 0.998582719746365f, 0.998691380966053f, 0.998792926639904f, 0.998887735145004f,
+ 0.998976170295797f, 0.999058581593303f, 0.999135304486653f, 0.999206660645980f,
+ 0.999272958245696f, 0.999334492257230f, 0.999391544750254f, 0.999444385201492f,
+ 0.999493270810174f, 0.999538446819229f, 0.999580146841343f, 0.999618593188994f,
+ 0.999653997207632f, 0.999686559611161f, 0.999716470818948f, 0.999743911293550f,
+ 0.999769051878447f, 0.999792054135046f, 0.999813070678259f, 0.999832245510030f,
+ 0.999849714350153f, 0.999865604963813f, 0.999880037485284f, 0.999893124737258f,
+ 0.999904972545323f, 0.999915680047131f, 0.999925339995826f, 0.999934039057369f,
+ 0.999941858101379f, 0.999948872485197f, 0.999955152330868f, 0.999960762794806f,
+ 0.999965764329904f, 0.999970212939921f, 0.999974160425965f, 0.999977654624967f,
+ 0.999980739640031f, 0.999983456062595f, 0.999985841186357f, 0.999987929212949f,
+ 0.999989751449364f, 0.999991336497160f, 0.999992710433503f, 0.999993896984110f,
+ 0.999994917688186f, 0.999995792055471f, 0.999996537715509f, 0.999997170559301f,
+ 0.999997704873475f, 0.999998153467165f, 0.999998527791754f, 0.999998838053703f,
+ 0.999999093320636f, 0.999999301620911f, 0.999999470036880f, 0.999999604792064f,
+ 0.999999711332472f, 0.999999794402277f, 0.999999858114104f, 0.999999906014144f,
+ 0.999999941142332f, 0.999999966087832f, 0.999999983040042f, 0.999999993835372f
+};
+
+const float ivas_lfe_window_coeff_32k[IVAS_LFE_FADE_LEN_32K] =
+{
+ 0.000135992220705702f, 0.000243900754874608f, 0.000366502488193403f, 0.000507754555407233f,
+ 0.000670037413867230f, 0.000855400185342017f, 0.00106582120537505f, 0.00130328810233523f,
+ 0.00156982797844358f, 0.00186752014891622f, 0.00219850171292337f, 0.00256496978060437f,
+ 0.00296918195815542f, 0.00341345582581521f, 0.00390016777110998f, 0.00443175136707306f,
+ 0.00501069540002978f, 0.00563954160739932f, 0.00632088216212532f, 0.00705735692705637f,
+ 0.00785165049501826f, 0.00870648902594829f, 0.00962463688994814f, 0.0106088931237052f,
+ 0.0116620877070005f, 0.0127870776657112f, 0.0139867430076699f, 0.0152639824978695f,
+ 0.0166217092797368f, 0.0180628463495039f, 0.0195903218910554f, 0.0212070644790028f,
+ 0.0229159981581294f, 0.0247200374077382f, 0.0266220819998311f, 0.0286250117604275f,
+ 0.0307316812437090f, 0.0329449143290351f, 0.0352674987512187f, 0.0377021805747777f,
+ 0.0402516586231834f, 0.0429185788744125f, 0.0457055288343670f, 0.0486150318999676f,
+ 0.0516495417239329f, 0.0548114365934440f, 0.0581030138350493f, 0.0615264842582949f,
+ 0.0650839666506623f, 0.0687774823364692f, 0.0726089498124248f, 0.0765801794725421f,
+ 0.0806928684350862f, 0.0849485954841849f, 0.0893488161386407f, 0.0938948578603667f,
+ 0.0985879154147218f, 0.103429046394834f, 0.108419166921795f, 0.113559047532359f,
+ 0.118849309265507f, 0.124290419958929f, 0.129882690766145f, 0.135626272904605f,
+ 0.141521154644746f, 0.147567158549505f, 0.153763938973404f, 0.160110979829776f,
+ 0.166607592634260f, 0.173252914832108f, 0.180045908416344f, 0.186985358843200f,
+ 0.194069874250690f, 0.201297884985540f, 0.208667643443083f, 0.216177224224055f,
+ 0.223824524611575f, 0.231607265370904f, 0.239522991873889f, 0.247569075549288f,
+ 0.255742715659461f, 0.264040941403189f, 0.272460614343670f, 0.280998431159973f,
+ 0.289650926719540f, 0.298414477468569f, 0.307285305136374f, 0.316259480749104f,
+ 0.325332928947464f, 0.334501432602363f, 0.343760637721723f, 0.353106058640944f,
+ 0.362533083488876f, 0.372036979920440f, 0.381612901106401f, 0.391255891970138f,
+ 0.400960895660650f, 0.410722760250415f, 0.420536245646151f, 0.430396030699960f,
+ 0.440296720507817f, 0.450232853881834f, 0.460198910982274f, 0.470189321094825f,
+ 0.480198470538230f, 0.490220710686965f, 0.500250366093333f, 0.510281742692964f,
+ 0.520309136077485f, 0.530326839817815f, 0.540329153821353f, 0.550310392706136f,
+ 0.560264894174896f, 0.570187027371852f, 0.580071201204973f, 0.589911872616473f,
+ 0.599703554784248f, 0.609440825237056f, 0.619118333866323f, 0.628730810817558f,
+ 0.638273074244583f, 0.647740037909930f, 0.657126718615052f, 0.666428243444252f,
+ 0.675639856806586f, 0.684756927260328f, 0.693774954105018f, 0.702689573726534f,
+ 0.711496565681117f, 0.720191858504788f, 0.728771535235148f, 0.737231838633124f,
+ 0.745569176092876f, 0.753780124228688f, 0.761861433128389f, 0.769810030263551f,
+ 0.777623024047447f, 0.785297707032555f, 0.792831558740175f, 0.800222248115570f,
+ 0.807467635602894f, 0.814565774835047f, 0.821514913934526f, 0.828313496422214f,
+ 0.834960161732055f, 0.841453745330485f, 0.847793278440476f, 0.853977987371046f,
+ 0.860007292454100f, 0.865880806591466f, 0.871598333416011f, 0.877159865071782f,
+ 0.882565579619094f, 0.887815838071573f, 0.892911181073134f, 0.897852325223955f,
+ 0.902640159065461f, 0.907275738735386f, 0.911760283304927f, 0.916095169810981f,
+ 0.920281927997422f, 0.924322234780251f, 0.928217908452363f, 0.931970902644524f,
+ 0.935583300059946f, 0.939057306000627f, 0.942395241704333f, 0.945599537511766f,
+ 0.948672725884068f, 0.951617434291347f, 0.954436377993401f, 0.957132352734204f,
+ 0.959708227372067f, 0.962166936467612f, 0.964511472851888f, 0.966744880197007f,
+ 0.968870245611698f, 0.970890692284040f, 0.972809372193449f, 0.974629458913696f,
+ 0.976354140528315f, 0.977986612679290f, 0.979530071769289f, 0.980987708337022f,
+ 0.982362700624510f, 0.983658208354169f, 0.984877366732620f, 0.986023280697072f,
+ 0.987099019418999f, 0.988107611078563f, 0.989052037921982f, 0.989935231612664f,
+ 0.990760068885503f, 0.991529367512303f, 0.992245882584772f, 0.992912303120025f,
+ 0.993531248991970f, 0.994105268190439f, 0.994636834408346f, 0.995128344955654f,
+ 0.995582118997414f, 0.996000396111680f, 0.996385335161686f, 0.996739013475302f,
+ 0.997063426323498f, 0.997360486688307f, 0.997632025309661f, 0.997879790999405f,
+ 0.998105451209848f, 0.998310592843372f, 0.998496723288846f, 0.998665271669997f,
+ 0.998817590290322f, 0.998954956258775f, 0.999078573280101f, 0.999189573593561f,
+ 0.999289020043705f, 0.999377908266854f, 0.999457168977167f, 0.999527670336312f,
+ 0.999590220391194f, 0.999645569564531f, 0.999694413183629f, 0.999737394033262f,
+ 0.999775104919193f, 0.999808091229614f, 0.999836853482484f, 0.999861849847578f,
+ 0.999883498632868f, 0.999902180725714f, 0.999918241980199f, 0.999931995542854f,
+ 0.999943724109857f, 0.999953682109695f, 0.999962097806132f, 0.999969175317172f,
+ 0.999975096546511f, 0.999980023024807f, 0.999984097658787f, 0.999987446387008f,
+ 0.999990179741692f, 0.999992394316756f, 0.999994174142692f, 0.999995591969534f,
+ 0.999996710459602f, 0.999997583292189f, 0.999998256182726f, 0.999998767819300f,
+ 0.999999150719701f, 0.999999432012418f, 0.999999634145194f, 0.999999775524907f,
+ 0.999999871092647f, 0.999999932837961f, 0.999999970256211f, 0.999999990753058f
+};
+
+const float ivas_lfe_window_coeff_16k[IVAS_LFE_FADE_LEN_16K] =
+{
+ 0.000192322041967661f, 0.000432042541451336f, 0.000754275578824202f, 0.00117365342860051f,
+ 0.00170559736282027f, 0.00236656267363075f, 0.00317404503675108f, 0.00414654286875000f,
+ 0.00530350017263264f, 0.00666523498873026f, 0.00825285493787745f, 0.0100881605116261f,
+ 0.0121935365995684f, 0.0145918327721377f, 0.0173062329286553f, 0.0203601150332032f,
+ 0.0237769017796244f, 0.0275799031448139f, 0.0317921519028702f, 0.0364362332793203f,
+ 0.0415341100227591f, 0.0471069442593880f, 0.0531749175728265f, 0.0597570508160612f,
+ 0.0668710252134883f, 0.0745330063478375f, 0.0827574726486089f, 0.0915570500049407f,
+ 0.100942354116142f, 0.110921842167215f, 0.121501675374497f, 0.132685593888120f,
+ 0.144474805463665f, 0.156867889225514f, 0.169860715739713f, 0.183446384495299f,
+ 0.197615179761091f, 0.212354545640879f, 0.227649080995091f, 0.243480554732640f,
+ 0.259827941804377f, 0.276667480050824f, 0.293972747873422f, 0.311714762512102f,
+ 0.329862098524320f, 0.348381025873702f, 0.367235666851846f, 0.386388170876560f,
+ 0.405798906035553f, 0.425426666078274f, 0.445228891401677f, 0.465161902430052f,
+ 0.485181143655975f, 0.505241436490520f, 0.525297238967270f, 0.545302910257632f,
+ 0.565212977885414f, 0.584982405477527f, 0.604566858855629f, 0.623922968261127f,
+ 0.643008584513597f, 0.661783026930517f, 0.680207320884341f, 0.698244422941288f,
+ 0.715859431614468f, 0.733019781871777f, 0.749695421665815f, 0.765858968898205f,
+ 0.781485847393429f, 0.796554400636541f, 0.811045982224021f, 0.824945022186269f,
+ 0.838239068562518f, 0.850918803842860f, 0.862978036135913f, 0.874413665172658f,
+ 0.885225623515076f, 0.895416793600184f, 0.904992901513335f, 0.913962388646463f,
+ 0.922336262654064f, 0.930127929368794f, 0.937353007575688f, 0.944029128765173f,
+ 0.950175724185808f, 0.955813801693484f, 0.960965715039994f, 0.965654928355726f,
+ 0.969905778654342f, 0.973743239217655f, 0.977192686702912f, 0.980279674750013f,
+ 0.983029716751026f, 0.985468080278805f, 0.987619595456638f, 0.989508479289711f,
+ 0.991158177676277f, 0.992591226478046f, 0.993829132663272f, 0.994892276151289f,
+ 0.995799832594078f, 0.996569716939470f, 0.997218547242656f, 0.997761627838482f,
+ 0.998212950666223f, 0.998585213259802f, 0.998889851686633f, 0.999137086542491f,
+ 0.999335979990921f, 0.999494501774465f, 0.999619602119988f, 0.999717289508270f,
+ 0.999792711373630f, 0.999850235936272f, 0.999893533540622f, 0.999925656069088f,
+ 0.999949113214013f, 0.999965944612802f, 0.999977787074566f, 0.999985936344066f,
+ 0.999991403054165f, 0.999994962706365f, 0.999997199686635f, 0.999998545467760f,
+ 0.999999311268578f, 0.999999715534135f, 0.999999906669617f, 0.999999981506116f
+};
+
+const float ivas_lpf_4_butter_16k_sos[IVAS_BIQUAD_FILT_LEN << 2] =
+{
+ 3.97464794223146e-07f, 7.94929601777927e-07f, 3.97464788468481e-07f, 1.f,
+ -1.90746797905194f, 0.909956295365785f, 1.f, 1.99999996645833f,
+ 1.00000001447843f, 1.f, -1.95913666348268f, 0.961692382252710f
+};
+
+const float ivas_lpf_4_butter_32k_sos[IVAS_BIQUAD_FILT_LEN << 2] =
+{
+ 2.56674586654460e-08f, 5.13349181918215e-08f, 2.56674582938215e-08f, 1,
+ -1.95329015717623f, 0.953926661219383f, 1, 1.99999996645833f,
+ 1.00000001447843f, 1, -1.98000953138860f, 0.980654742275836f
+};
+
+const float ivas_lpf_4_butter_48k_sos[IVAS_BIQUAD_FILT_LEN << 2] =
+{
+ 5.12617881476274e-09f, 1.02523584294987e-08f, 5.12617879059970e-09f,
+ 1.0, -1.96875982668433f, 0.969044914826862f, 1.f , 1.99999984394358f,
+ 1.00000000471366f, 1.f , -1.98677297369091f, 0.987060670205863f
+};
+
+const float ivas_lpf_2_butter_16k[IVAS_BIQUAD_FILT_LEN << 1] =
+{
+ 0.000628720643081143f, 0.00125744128616229f, 0.000628720643081143f, 1.f, -1.92783286977036f, 0.930347752342683f
+};
+
+const float ivas_lpf_2_butter_32k[IVAS_BIQUAD_FILT_LEN << 1] =
+{
+ 0.000159990787823749f, 0.000319981575647499f, 0.000159990787823749f, 1.f, -1.96390539174033f, 0.964545354891623f
+};
+
+const float ivas_lpf_2_butter_48k[IVAS_BIQUAD_FILT_LEN << 1] =
+{
+ 7.15317998432330e-05f, 0.000143063599686466f, 7.15317998432330e-05f, 1.f, -1.97593552482925f, 0.976221652028620f
+};
+
+const ivas_lfe_freq_models ivas_str_lfe_freq_models =
+{
+ { 16384, 14924, 13463, 12003, 10542, 9082, 7622, 6161,
+ 4701, 4336, 3970, 3605, 3240, 2875, 2510, 2145,
+ 1780, 1689, 1597, 1506, 1415, 1323, 1232, 1141,
+ 1050, 1004, 958, 913, 867, 821, 776, 730,
+ 685, 639, 593, 548, 502, 456, 411, 365,
+ 319, 297, 274, 251, 228, 205, 183, 160,
+ 137, 126, 114, 103, 91, 80, 68, 57,
+ 46, 40, 34, 29, 23, 17, 11, 6, 0 },
+
+ { 16384, 13463, 10542, 7622, 4701, 3970, 3240, 2510,
+ 1780, 1597, 1415, 1232, 1050, 958, 867, 776,
+ 685, 593, 502, 411, 319, 274, 228, 183,
+ 137, 114, 91, 68, 46, 34, 23, 11, 0 },
+
+ { 16384, 4701, 1780, 1050, 685, 319, 137, 46,
+ 0, },
+
+ { 16384, 3277, 0 },
+
+ { 16384, 13463, 10542, 7622, 4701, 3970, 3240, 2510,
+ 1780, 1597, 1415, 1232, 1050, 958, 867, 776,
+ 685, 593, 502, 411, 319, 274, 228, 183,
+ 137, 114, 91, 68, 46, 34, 23, 11,
+ 0 },
+
+ { 16384, 10542, 4701, 3240, 1780, 1415, 1050, 867,
+ 685, 502, 319, 228, 137, 91, 46, 23,
+ 0 },
+
+ { 16384, 4468, 1489, 745, 0 }, 0,
+};
+
+const int16_t ivas_lfe_num_ele_in_coder_models[2][4] =
+{
+ { 63, 31, 7, 1 },{ 31, 15, 3, 0 }
+};
+
+const int16_t ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 8, 6 };
+
+const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 1, 0 };
+
+const float ivas_lfe_lpf_delay[2] = { 0.00175f, 0.0035f };
+
+const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2] =
+{
+ 0.08000000000000002, 0.08015895227847719, 0.08063569926248770, 0.08142991147368656, 0.08254104003450596, 0.08396831704748331, 0.08571075612595230, 0.08776715307573196,
+ 0.09013608672734141, 0.09281591991816535, 0.09580480062389246, 0.09910066323844335, 0.10270123000150438, 0.10660401257268071, 0.11080631375118072, 0.11530522933984272,
+ 0.12009765015221685, 0.12518026416131367, 0.13054955878853602, 0.13620182333121073, 0.14213315152704381, 0.14833944425372619, 0.15481641236182375, 0.16155957963899570,
+ 0.16856428590349043, 0.17582569022478273, 0.18333877426912554, 0.19109834576770490, 0.19909904210500018, 0.20733533402487142, 0.21580152945181053, 0.22449177742471671,
+ 0.23340007214047787, 0.24252025710456171, 0.25184602938575001, 0.26137094397207467, 0.27108841822494550, 0.28099173642839037, 0.29107405443026624, 0.30132840437223085,
+ 0.31174769950520753, 0.32232473908701620, 0.33305221335878232, 0.34392270859668939, 0.35492871223557998, 0.36606261806086549, 0.37731673146515798, 0.38868327476598852,
+ 0.40015439258093899, 0.41172215725647360, 0.42337857434671339, 0.43511558813837425, 0.44692508721804453, 0.45879891007795709, 0.47072885075638249, 0.48270666450874267,
+ 0.49472407350552849, 0.50677277255308162, 0.51884443483328757, 0.53093071765821398, 0.54302326823571601, 0.55511372944202464, 0.56719374559732838, 0.57925496824035816,
+ 0.59128906189798180, 0.60328770984582458, 0.61524261985593010, 0.62714552992749328, 0.63898821399670414, 0.65076248762175315, 0.66246021363907504, 0.67407330778691554,
+ 0.68559374429233988, 0.69701356141781945, 0.70832486696356345, 0.71951984372179334, 0.73059075487919101, 0.74152994936378558, 0.75232986713258543, 0.76298304439630038,
+ 0.77348211877754336, 0.78381983439894576, 0.79398904689767136, 0.80398272836286389, 0.81379397219261318, 0.82341599786708708, 0.83284215563452701, 0.84206593110687011,
+ 0.85108094976182280, 0.85988098134827329, 0.86845994419199846, 0.87681190939868969, 0.88493110495139349, 0.89281191969953333, 0.90044890723675941, 0.90783678966494241,
+ 0.91497046124171255, 0.92184499190902180, 0.92845563070029180, 0.93479780902379184, 0.94086714381997805, 0.94665944059061280, 0.95217069629756890, 0.95739710212931617,
+ 0.96233504613317988, 0.96698111571154954, 0.97133209998031445, 0.97538499198789563, 0.97913699079334116, 0.98258550340204664, 0.98572814655776630, 0.98856274838967395,
+ 0.99108734991333569, 0.99330020638455863, 0.99519978850517732, 0.99678478347994692, 0.99805409592381300, 0.99900684861892730, 0.99964238312089115, 0.99996026021380402
+};
+
+
+/*------------------------------------------------------------------------------------------*
+ * MDFT/iMDFT ROM tables
+ *------------------------------------------------------------------------------------------*/
+
+const float ivas_mdft_coeff_cos_twid_960[IVAS_960_PT_LEN + 1] =
+{
+ 1.00000000000000f, 0.999998661349528f, 0.999994645401697f, 0.999987952167257f,
+ 0.999978581664129f, 0.999966533917401f, 0.999951808959328f, 0.999934406829333f,
+ 0.999914327574007f, 0.999891571247108f, 0.999866137909562f, 0.999838027629461f,
+ 0.999807240482065f, 0.999773776549800f, 0.999737635922260f, 0.999698818696204f,
+ 0.999657324975557f, 0.999613154871411f, 0.999566308502021f, 0.999516785992811f,
+ 0.999464587476366f, 0.999409713092437f, 0.999352162987941f, 0.999291937316955f,
+ 0.999229036240723f, 0.999163459927649f, 0.999095208553300f, 0.999024282300407f,
+ 0.998950681358860f, 0.998874405925711f, 0.998795456205172f, 0.998713832408616f,
+ 0.998629534754574f, 0.998542563468736f, 0.998452918783950f, 0.998360600940223f,
+ 0.998265610184716f, 0.998167946771749f, 0.998067610962796f, 0.997964603026487f,
+ 0.997858923238604f, 0.997750571882084f, 0.997639549247016f, 0.997525855630641f,
+ 0.997409491337352f, 0.997290456678690f, 0.997168751973348f, 0.997044377547164f,
+ 0.996917333733128f, 0.996787620871373f, 0.996655239309180f, 0.996520189400975f,
+ 0.996382471508325f, 0.996242085999945f, 0.996099033251687f, 0.995953313646548f,
+ 0.995804927574662f, 0.995653875433303f, 0.995500157626885f, 0.995343774566954f,
+ 0.995184726672197f, 0.995023014368432f, 0.994858638088611f, 0.994691598272820f,
+ 0.994521895368273f, 0.994349529829318f, 0.994174502117428f, 0.993996812701206f,
+ 0.993816462056378f, 0.993633450665799f, 0.993447779019444f, 0.993259447614414f,
+ 0.993068456954926f, 0.992874807552322f, 0.992678499925058f, 0.992479534598710f,
+ 0.992277912105967f, 0.992073632986633f, 0.991866697787626f, 0.991657107062973f,
+ 0.991444861373810f, 0.991229961288385f, 0.991012407382049f, 0.990792200237260f,
+ 0.990569340443577f, 0.990343828597665f, 0.990115665303286f, 0.989884851171301f,
+ 0.989651386819670f, 0.989415272873448f, 0.989176509964781f, 0.988935098732911f,
+ 0.988691039824167f, 0.988444333891970f, 0.988194981596825f, 0.987942983606322f,
+ 0.987688340595138f, 0.987431053245027f, 0.987171122244825f, 0.986908548290446f,
+ 0.986643332084879f, 0.986375474338188f, 0.986104975767509f, 0.985831837097047f,
+ 0.985556059058078f, 0.985277642388941f, 0.984996587835043f, 0.984712896148850f,
+ 0.984426568089892f, 0.984137604424753f, 0.983846005927077f, 0.983551773377562f,
+ 0.983254907563955f, 0.982955409281056f, 0.982653279330712f, 0.982348518521816f,
+ 0.982041127670304f, 0.981731107599154f, 0.981418459138384f, 0.981103183125046f,
+ 0.980785280403230f, 0.980464751824058f, 0.980141598245680f, 0.979815820533276f,
+ 0.979487419559051f, 0.979156396202234f, 0.978822751349072f, 0.978486485892835f,
+ 0.978147600733806f, 0.977806096779282f, 0.977461974943572f, 0.977115236147994f,
+ 0.976765881320872f, 0.976413911397535f, 0.976059327320311f, 0.975702130038529f,
+ 0.975342320508513f, 0.974979899693582f, 0.974614868564045f, 0.974247228097201f,
+ 0.973876979277334f, 0.973504123095711f, 0.973128660550580f, 0.972750592647168f,
+ 0.972369920397677f, 0.971986644821279f, 0.971600766944121f, 0.971212287799312f,
+ 0.970821208426928f, 0.970427529874007f, 0.970031253194544f, 0.969632379449492f,
+ 0.969230909706754f, 0.968826845041188f, 0.968420186534595f, 0.968010935275723f,
+ 0.967599092360260f, 0.967184658890834f, 0.966767635977008f, 0.966348024735277f,
+ 0.965925826289068f, 0.965501041768733f, 0.965073672311547f, 0.964643719061708f,
+ 0.964211183170329f, 0.963776065795440f, 0.963338368101980f, 0.962898091261798f,
+ 0.962455236453647f, 0.962009804863184f, 0.961561797682962f, 0.961111216112432f,
+ 0.960658061357935f, 0.960202334632705f, 0.959744037156857f, 0.959283170157394f,
+ 0.958819734868193f, 0.958353732530011f, 0.957885164390477f, 0.957414031704088f,
+ 0.956940335732209f, 0.956464077743065f, 0.955985259011744f, 0.955503880820186f,
+ 0.955019944457187f, 0.954533451218389f, 0.954044402406280f, 0.953552799330194f,
+ 0.953058643306297f, 0.952561935657595f, 0.952062677713924f, 0.951560870811948f,
+ 0.951056516295154f, 0.950549615513851f, 0.950040169825165f, 0.949528180593037f,
+ 0.949013649188214f, 0.948496576988253f, 0.947976965377510f, 0.947454815747144f,
+ 0.946930129495106f, 0.946402908026138f, 0.945873152751771f, 0.945340865090320f,
+ 0.944806046466878f, 0.944268698313317f, 0.943728822068278f, 0.943186419177173f,
+ 0.942641491092178f, 0.942094039272230f, 0.941544065183021f, 0.940991570296997f,
+ 0.940436556093355f, 0.939879024058033f, 0.939318975683713f, 0.938756412469813f,
+ 0.938191335922484f, 0.937623747554606f, 0.937053648885784f, 0.936481041442343f,
+ 0.935905926757326f, 0.935328306370488f, 0.934748181828292f, 0.934165554683908f,
+ 0.933580426497202f, 0.932992798834739f, 0.932402673269775f, 0.931810051382254f,
+ 0.931214934758804f, 0.930617324992729f, 0.930017223684012f, 0.929414632439304f,
+ 0.928809552871924f, 0.928201986601852f, 0.927591935255724f, 0.926979400466833f,
+ 0.926364383875118f, 0.925746887127164f, 0.925126911876195f, 0.924504459782072f,
+ 0.923879532511287f, 0.923252131736957f, 0.922622259138823f, 0.921989916403245f,
+ 0.921355105223193f, 0.920717827298248f, 0.920078084334595f, 0.919435878045019f,
+ 0.918791210148898f, 0.918144082372204f, 0.917494496447491f, 0.916842454113897f,
+ 0.916187957117136f, 0.915531007209492f, 0.914871606149819f, 0.914209755703531f,
+ 0.913545457642601f, 0.912878713745555f, 0.912209525797468f, 0.911537895589956f,
+ 0.910863824921176f, 0.910187315595818f, 0.909508369425101f, 0.908826988226768f,
+ 0.908143173825081f, 0.907456928050819f, 0.906768252741266f, 0.906077149740215f,
+ 0.905383620897955f, 0.904687668071273f, 0.903989293123443f, 0.903288497924226f,
+ 0.902585284349861f, 0.901879654283062f, 0.901171609613013f, 0.900461152235364f,
+ 0.899748284052222f, 0.899033006972149f, 0.898315322910159f, 0.897595233787707f,
+ 0.896872741532688f, 0.896147848079432f, 0.895420555368697f, 0.894690865347664f,
+ 0.893958779969932f, 0.893224301195515f, 0.892487430990834f, 0.891748171328711f,
+ 0.891006524188368f, 0.890262491555416f, 0.889516075421856f, 0.888767277786068f,
+ 0.888016100652807f, 0.887262546033203f, 0.886506615944746f, 0.885748312411291f,
+ 0.884987637463042f, 0.884224593136556f, 0.883459181474733f, 0.882691404526809f,
+ 0.881921264348355f, 0.881148763001268f, 0.880373902553765f, 0.879596685080383f,
+ 0.878817112661965f, 0.878035187385663f, 0.877250911344924f, 0.876464286639493f,
+ 0.875675315375400f, 0.874883999664958f, 0.874090341626759f, 0.873294343385663f,
+ 0.872496007072797f, 0.871695334825548f, 0.870892328787557f, 0.870086991108712f,
+ 0.869279323945144f, 0.868469329459222f, 0.867657009819544f, 0.866842367200935f,
+ 0.866025403784439f, 0.865206121757311f, 0.864384523313017f, 0.863560610651224f,
+ 0.862734385977792f, 0.861905851504774f, 0.861075009450407f, 0.860241862039105f,
+ 0.859406411501453f, 0.858568660074204f, 0.857728610000272f, 0.856886263528723f,
+ 0.856041622914771f, 0.855194690419775f, 0.854345468311227f, 0.853493958862751f,
+ 0.852640164354092f, 0.851784087071117f, 0.850925729305802f, 0.850065093356229f,
+ 0.849202181526579f, 0.848336996127127f, 0.847469539474235f, 0.846599813890344f,
+ 0.845727821703973f, 0.844853565249707f, 0.843977046868193f, 0.843098268906136f,
+ 0.842217233716287f, 0.841333943657443f, 0.840448401094438f, 0.839560608398136f,
+ 0.838670567945424f, 0.837778282119209f, 0.836883753308409f, 0.835986983907947f,
+ 0.835087976318743f, 0.834186732947712f, 0.833283256207754f, 0.832377548517748f,
+ 0.831469612302545f, 0.830559449992965f, 0.829647064025785f, 0.828732456843738f,
+ 0.827815630895502f, 0.826896588635696f, 0.825975332524873f, 0.825051865029513f,
+ 0.824126188622016f, 0.823198305780696f, 0.822268218989775f, 0.821335930739376f,
+ 0.820401443525514f, 0.819464759850093f, 0.818525882220897f, 0.817584813151584f,
+ 0.816641555161679f, 0.815696110776568f, 0.814748482527489f, 0.813798672951530f,
+ 0.812846684591615f, 0.811892519996505f, 0.810936181720784f, 0.809977672324859f,
+ 0.809016994374948f, 0.808054150443073f, 0.807089143107059f, 0.806121974950521f,
+ 0.805152648562858f, 0.804181166539250f, 0.803207531480645f, 0.802231745993758f,
+ 0.801253812691061f, 0.800273734190774f, 0.799291513116864f, 0.798307152099032f,
+ 0.797320653772707f, 0.796332020779044f, 0.795341255764910f, 0.794348361382882f,
+ 0.793353340291235f, 0.792356195153942f, 0.791356928640660f, 0.790355543426726f,
+ 0.789352042193150f, 0.788346427626606f, 0.787338702419428f, 0.786328869269598f,
+ 0.785316930880745f, 0.784302889962131f, 0.783286749228650f, 0.782268511400816f,
+ 0.781248179204759f, 0.780225755372213f, 0.779201242640517f, 0.778174643752598f,
+ 0.777145961456971f, 0.776115198507728f, 0.775082357664531f, 0.774047441692607f,
+ 0.773010453362737f, 0.771971395451250f, 0.770930270740018f, 0.769887082016445f,
+ 0.768841832073460f, 0.767794523709512f, 0.766745159728562f, 0.765693742940071f,
+ 0.764640276159000f, 0.763584762205796f, 0.762527203906388f, 0.761467604092177f,
+ 0.760405965600031f, 0.759342291272276f, 0.758276583956687f, 0.757208846506485f,
+ 0.756139081780323f, 0.755067292642284f, 0.753993481961869f, 0.752917652613995f,
+ 0.751839807478977f, 0.750759949442534f, 0.749678081395770f, 0.748594206235171f,
+ 0.747508326862597f, 0.746420446185274f, 0.745330567115786f, 0.744238692572067f,
+ 0.743144825477394f, 0.742048968760379f, 0.740951125354959f, 0.739851298200392f,
+ 0.738749490241246f, 0.737645704427393f, 0.736539943713999f, 0.735432211061519f,
+ 0.734322509435686f, 0.733210841807505f, 0.732097211153246f, 0.730981620454432f,
+ 0.729864072697836f, 0.728744570875469f, 0.727623117984575f, 0.726499717027620f,
+ 0.725374371012288f, 0.724247082951467f, 0.723117855863248f, 0.721986692770910f,
+ 0.720853596702919f, 0.719718570692913f, 0.718581617779698f, 0.717442741007240f,
+ 0.716301943424654f, 0.715159228086199f, 0.714014598051268f, 0.712868056384380f,
+ 0.711719606155171f, 0.710569250438390f, 0.709416992313883f, 0.708262834866593f,
+ 0.707106781186548f, 0.705948834368849f, 0.704788997513670f, 0.703627273726243f,
+ 0.702463666116852f, 0.701298177800824f, 0.700130811898524f, 0.698961571535339f,
+ 0.697790459841680f, 0.696617479952964f, 0.695442635009612f, 0.694265928157036f,
+ 0.693087362545636f, 0.691906941330786f, 0.690724667672829f, 0.689540544737067f,
+ 0.688354575693754f, 0.687166763718086f, 0.685977111990193f, 0.684785623695130f,
+ 0.683592302022871f, 0.682397150168297f, 0.681200171331188f, 0.680001368716218f,
+ 0.678800745532942f, 0.677598304995789f, 0.676394050324054f, 0.675187984741891f,
+ 0.673980111478298f, 0.672770433767117f, 0.671558954847018f, 0.670345677961497f,
+ 0.669130606358858f, 0.667913743292216f, 0.666695092019479f, 0.665474655803342f,
+ 0.664252437911282f, 0.663028441615542f, 0.661802670193130f, 0.660575126925805f,
+ 0.659345815100069f, 0.658114738007160f, 0.656881898943041f, 0.655647301208395f,
+ 0.654410948108610f, 0.653172842953777f, 0.651932989058674f, 0.650691389742765f,
+ 0.649448048330184f, 0.648202968149730f, 0.646956152534857f, 0.645707604823667f,
+ 0.644457328358897f, 0.643205326487914f, 0.641951602562703f, 0.640696159939861f,
+ 0.639439001980585f, 0.638180132050665f, 0.636919553520476f, 0.635657269764965f,
+ 0.634393284163646f, 0.633127600100588f, 0.631860220964409f, 0.630591150148264f,
+ 0.629320391049838f, 0.628047947071334f, 0.626773821619470f, 0.625498018105461f,
+ 0.624220539945018f, 0.622941390558334f, 0.621660573370077f, 0.620378091809381f,
+ 0.619093949309834f, 0.617808149309472f, 0.616520695250769f, 0.615231590580627f,
+ 0.613940838750366f, 0.612648443215719f, 0.611354407436817f, 0.610058734878182f,
+ 0.608761429008721f, 0.607462493301711f, 0.606161931234795f, 0.604859746289968f,
+ 0.603555941953571f, 0.602250521716282f, 0.600943489073102f, 0.599634847523352f,
+ 0.598324600570659f, 0.597012751722948f, 0.595699304492433f, 0.594384262395609f,
+ 0.593067628953237f, 0.591749407690343f, 0.590429602136201f, 0.589108215824328f,
+ 0.587785252292473f, 0.586460715082607f, 0.585134607740916f, 0.583806933817786f,
+ 0.582477696867802f, 0.581146900449730f, 0.579814548126514f, 0.578480643465260f,
+ 0.577145190037234f, 0.575808191417845f, 0.574469651186643f, 0.573129572927301f,
+ 0.571787960227612f, 0.570444816679478f, 0.569100145878898f, 0.567753951425961f,
+ 0.566406236924833f, 0.565057005983753f, 0.563706262215017f, 0.562354009234973f,
+ 0.561000250664010f, 0.559644990126546f, 0.558288231251022f, 0.556929977669890f,
+ 0.555570233019602f, 0.554209000940606f, 0.552846285077328f, 0.551482089078169f,
+ 0.550116416595494f, 0.548749271285616f, 0.547380656808797f, 0.546010576829228f,
+ 0.544639035015027f, 0.543266035038224f, 0.541891580574752f, 0.540515675304440f,
+ 0.539138322911000f, 0.537759527082020f, 0.536379291508950f, 0.534997619887097f,
+ 0.533614515915612f, 0.532229983297479f, 0.530844025739510f, 0.529456646952329f,
+ 0.528067850650368f, 0.526677640551852f, 0.525286020378792f, 0.523892993856974f,
+ 0.522498564715949f, 0.521102736689023f, 0.519705513513249f, 0.518306898929413f,
+ 0.516906896682028f, 0.515505510519320f, 0.514102744193222f, 0.512698601459362f,
+ 0.511293086077052f, 0.509886201809281f, 0.508477952422700f, 0.507068341687617f,
+ 0.505657373377985f, 0.504245051271389f, 0.502831379149042f, 0.501416360795769f,
+ 0.500000000000000f, 0.498582300553759f, 0.497163266252654f, 0.495742900895868f,
+ 0.494321208286145f, 0.492898192229784f, 0.491473856536628f, 0.490048205020053f,
+ 0.488621241496955f, 0.487192969787746f, 0.485763393716340f, 0.484332517110141f,
+ 0.482900343800037f, 0.481466877620387f, 0.480032122409011f, 0.478596082007181f,
+ 0.477158760259609f, 0.475720161014437f, 0.474280288123229f, 0.472839145440959f,
+ 0.471396736825998f, 0.469953066140108f, 0.468508137248432f, 0.467061954019477f,
+ 0.465614520325111f, 0.464165840040552f, 0.462715917044350f, 0.461264755218387f,
+ 0.459812358447860f, 0.458358730621271f, 0.456903875630421f, 0.455447797370393f,
+ 0.453990499739547f, 0.452531986639508f, 0.451072261975153f, 0.449611329654607f,
+ 0.448149193589223f, 0.446685857693580f, 0.445221325885468f, 0.443755602085881f,
+ 0.442288690219001f, 0.440820594212194f, 0.439351317995994f, 0.437880865504095f,
+ 0.436409240673342f, 0.434936447443717f, 0.433462489758331f, 0.431987371563412f,
+ 0.430511096808295f, 0.429033669445413f, 0.427555093430282f, 0.426075372721496f,
+ 0.424594511280713f, 0.423112513072644f, 0.421629382065045f, 0.420145122228703f,
+ 0.418659737537428f, 0.417173231968043f, 0.415685609500371f, 0.414196874117224f,
+ 0.412707029804395f, 0.411216080550645f, 0.409724030347695f, 0.408230883190212f,
+ 0.406736643075800f, 0.405241314004990f, 0.403744899981227f, 0.402247405010863f,
+ 0.400748833103141f, 0.399249188270190f, 0.397748474527011f, 0.396246695891466f,
+ 0.394743856384267f, 0.393239960028970f, 0.391735010851956f, 0.390229012882428f,
+ 0.388721970152396f, 0.387213886696666f, 0.385704766552831f, 0.384194613761262f,
+ 0.382683432365090f, 0.381171226410203f, 0.379657999945233f, 0.378143757021541f,
+ 0.376628501693211f, 0.375112238017038f, 0.373594970052516f, 0.372076701861829f,
+ 0.370557437509836f, 0.369037181064067f, 0.367515936594704f, 0.365993708174577f,
+ 0.364470499879150f, 0.362946315786509f, 0.361421159977355f, 0.359895036534988f,
+ 0.358367949545300f, 0.356839903096763f, 0.355310901280416f, 0.353780948189858f,
+ 0.352250047921234f, 0.350718204573223f, 0.349185422247033f, 0.347651705046382f,
+ 0.346117057077493f, 0.344581482449081f, 0.343044985272340f, 0.341507569660936f,
+ 0.339969239730994f, 0.338429999601086f, 0.336889853392220f, 0.335348805227832f,
+ 0.333806859233771f, 0.332264019538291f, 0.330720290272038f, 0.329175675568039f,
+ 0.327630179561693f, 0.326083806390759f, 0.324536560195342f, 0.322988445117886f,
+ 0.321439465303162f, 0.319889624898253f, 0.318338928052550f, 0.316787378917734f,
+ 0.315234981647770f, 0.313681740398892f, 0.312127659329594f, 0.310572742600619f,
+ 0.309016994374947f, 0.307460418817785f, 0.305903020096554f, 0.304344802380877f,
+ 0.302785769842575f, 0.301225926655645f, 0.299665276996257f, 0.298103825042740f,
+ 0.296541574975571f, 0.294978530977364f, 0.293414697232857f, 0.291850077928904f,
+ 0.290284677254463f, 0.288718499400580f, 0.287151548560387f, 0.285583828929082f,
+ 0.284015344703923f, 0.282446100084212f, 0.280876099271292f, 0.279305346468526f,
+ 0.277733845881292f, 0.276161601716971f, 0.274588618184932f, 0.273014899496527f,
+ 0.271440449865074f, 0.269865273505849f, 0.268289374636071f, 0.266712757474899f,
+ 0.265135426243408f, 0.263557385164591f, 0.261978638463337f, 0.260399190366428f,
+ 0.258819045102521f, 0.257238206902140f, 0.255656679997665f, 0.254074468623318f,
+ 0.252491577015158f, 0.250908009411060f, 0.249323770050712f, 0.247738863175598f,
+ 0.246153293028993f, 0.244567063855944f, 0.242980179903264f, 0.241392645419519f,
+ 0.239804464655017f, 0.238215641861795f, 0.236626181293610f, 0.235036087205927f,
+ 0.233445363855905f, 0.231854015502391f, 0.230262046405902f, 0.228669460828619f,
+ 0.227076263034373f, 0.225482457288634f, 0.223888047858498f, 0.222293039012681f,
+ 0.220697435021501f, 0.219101240156870f, 0.217504458692281f, 0.215907094902801f,
+ 0.214309153065051f, 0.212710637457203f, 0.211111552358965f, 0.209511902051569f,
+ 0.207911690817759f, 0.206310922941784f, 0.204709602709380f, 0.203107734407763f,
+ 0.201505322325617f, 0.199902370753082f, 0.198298883981741f, 0.196694866304610f,
+ 0.195090322016128f, 0.193485255412143f, 0.191879670789901f, 0.190273572448036f,
+ 0.188666964686555f, 0.187059851806832f, 0.185452238111591f, 0.183844127904898f,
+ 0.182235525492147f, 0.180626435180053f, 0.179016861276633f, 0.177406808091201f,
+ 0.175796279934354f, 0.174185281117962f, 0.172573815955152f, 0.170961888760301f,
+ 0.169349503849025f, 0.167736665538162f, 0.166123378145765f, 0.164509645991092f,
+ 0.162895473394589f, 0.161280864677881f, 0.159665824163761f, 0.158050356176180f,
+ 0.156434465040231f, 0.154818155082141f, 0.153201430629259f, 0.151584296010041f,
+ 0.149966755554045f, 0.148348813591913f, 0.146730474455362f, 0.145111742477173f,
+ 0.143492621991180f, 0.141873117332253f, 0.140253232836296f, 0.138632972840227f,
+ 0.137012341681968f, 0.135391343700438f, 0.133769983235535f, 0.132148264628130f,
+ 0.130526192220052f, 0.128903770354076f, 0.127281003373913f, 0.125657895624201f,
+ 0.124034451450485f, 0.122410675199216f, 0.120786571217731f, 0.119162143854244f,
+ 0.117537397457838f, 0.115912336378446f, 0.114286964966846f, 0.112661287574648f,
+ 0.111035308554278f, 0.109409032258971f, 0.107782463042760f, 0.106155605260457f,
+ 0.104528463267653f, 0.102901041420696f, 0.101273344076683f, 0.0996453755934510f,
+ 0.0980171403295608f, 0.0963886426442880f, 0.0947598868976111f, 0.0931308774501999f,
+ 0.0915016186634025f, 0.0898721148992351f, 0.0882423705203694f, 0.0866123898901223f,
+ 0.0849821773724418f, 0.0833517373318973f, 0.0817210741336683f, 0.0800901921435302f,
+ 0.0784590957278450f, 0.0768277892535488f, 0.0751962770881400f, 0.0735645635996675f,
+ 0.0719326531567196f, 0.0703005501284112f, 0.0686682588843738f, 0.0670357837947423f,
+ 0.0654031292301431f, 0.0637702995616845f, 0.0621372991609429f, 0.0605041323999515f,
+ 0.0588708036511890f, 0.0572373172875686f, 0.0556036776824248f, 0.0539698892095020f,
+ 0.0523359562429437f, 0.0507018831572809f, 0.0490676743274181f, 0.0474333341286244f,
+ 0.0457988669365209f, 0.0441642771270675f, 0.0425295690765532f, 0.0408947471615835f,
+ 0.0392598157590687f, 0.0376247792462120f, 0.0359896420004986f, 0.0343544083996823f,
+ 0.0327190828217762f, 0.0310836696450389f, 0.0294481732479632f, 0.0278125980092656f,
+ 0.0261769483078731f, 0.0245412285229125f, 0.0229054430336971f, 0.0212695962197177f,
+ 0.0196336924606285f, 0.0179977361362357f, 0.0163617316264867f, 0.0147256833114587f,
+ 0.0130895955713446f, 0.0114534727864437f, 0.00981731933714973f, 0.00818113960393724f,
+ 0.00654493796735196f, 0.00490871880799808f, 0.00327248650652671f, 0.00163624544362412f,
+ 0.00000000000000000f
+};
+
+const float ivas_mdft_coeff_sin_twid_960[IVAS_960_PT_LEN] =
+{
+ 0.00000000000000f, 0.00163624544362405f, 0.00327248650652663f, 0.00490871880799799f,
+ 0.00654493796735186f, 0.00818113960393713f, 0.00981731933714962f, 0.0114534727864438f,
+ 0.0130895955713444f, 0.0147256833114585f, 0.0163617316264868f, 0.0179977361362355f,
+ 0.0196336924606283f, 0.0212695962197177f, 0.0229054430336971f, 0.0245412285229123f,
+ 0.0261769483078732f, 0.0278125980092656f, 0.0294481732479632f, 0.0310836696450387f,
+ 0.0327190828217761f, 0.0343544083996823f, 0.0359896420004984f, 0.0376247792462120f,
+ 0.0392598157590686f, 0.0408947471615835f, 0.0425295690765531f, 0.0441642771270674f,
+ 0.0457988669365208f, 0.0474333341286245f, 0.0490676743274180f, 0.0507018831572807f,
+ 0.0523359562429438f, 0.0539698892095019f, 0.0556036776824246f, 0.0572373172875686f,
+ 0.0588708036511890f, 0.0605041323999513f, 0.0621372991609427f, 0.0637702995616845f,
+ 0.0654031292301431f, 0.0670357837947420f, 0.0686682588843738f, 0.0703005501284112f,
+ 0.0719326531567194f, 0.0735645635996674f, 0.0751962770881399f, 0.0768277892535488f,
+ 0.0784590957278449f, 0.0800901921435301f, 0.0817210741336682f, 0.0833517373318975f,
+ 0.0849821773724417f, 0.0866123898901222f, 0.0882423705203695f, 0.0898721148992350f,
+ 0.0915016186634024f, 0.0931308774501998f, 0.0947598868976111f, 0.0963886426442878f,
+ 0.0980171403295606f, 0.0996453755934511f, 0.101273344076683f, 0.102901041420696f,
+ 0.104528463267653f, 0.106155605260457f, 0.107782463042759f, 0.109409032258971f,
+ 0.111035308554278f, 0.112661287574648f, 0.114286964966846f, 0.115912336378446f,
+ 0.117537397457838f, 0.119162143854244f, 0.120786571217731f, 0.122410675199216f,
+ 0.124034451450485f, 0.125657895624201f, 0.127281003373913f, 0.128903770354075f,
+ 0.130526192220052f, 0.132148264628130f, 0.133769983235535f, 0.135391343700438f,
+ 0.137012341681968f, 0.138632972840227f, 0.140253232836296f, 0.141873117332253f,
+ 0.143492621991179f, 0.145111742477173f, 0.146730474455362f, 0.148348813591913f,
+ 0.149966755554045f, 0.151584296010041f, 0.153201430629258f, 0.154818155082141f,
+ 0.156434465040231f, 0.158050356176180f, 0.159665824163761f, 0.161280864677880f,
+ 0.162895473394589f, 0.164509645991092f, 0.166123378145765f, 0.167736665538162f,
+ 0.169349503849025f, 0.170961888760301f, 0.172573815955152f, 0.174185281117962f,
+ 0.175796279934355f, 0.177406808091201f, 0.179016861276633f, 0.180626435180053f,
+ 0.182235525492147f, 0.183844127904898f, 0.185452238111591f, 0.187059851806832f,
+ 0.188666964686555f, 0.190273572448036f, 0.191879670789901f, 0.193485255412143f,
+ 0.195090322016128f, 0.196694866304610f, 0.198298883981740f, 0.199902370753082f,
+ 0.201505322325617f, 0.203107734407763f, 0.204709602709380f, 0.206310922941784f,
+ 0.207911690817759f, 0.209511902051569f, 0.211111552358965f, 0.212710637457203f,
+ 0.214309153065051f, 0.215907094902801f, 0.217504458692281f, 0.219101240156870f,
+ 0.220697435021501f, 0.222293039012681f, 0.223888047858498f, 0.225482457288634f,
+ 0.227076263034373f, 0.228669460828619f, 0.230262046405902f, 0.231854015502391f,
+ 0.233445363855905f, 0.235036087205927f, 0.236626181293610f, 0.238215641861795f,
+ 0.239804464655017f, 0.241392645419519f, 0.242980179903264f, 0.244567063855944f,
+ 0.246153293028993f, 0.247738863175598f, 0.249323770050712f, 0.250908009411060f,
+ 0.252491577015158f, 0.254074468623319f, 0.255656679997664f, 0.257238206902140f,
+ 0.258819045102521f, 0.260399190366428f, 0.261978638463337f, 0.263557385164591f,
+ 0.265135426243408f, 0.266712757474898f, 0.268289374636071f, 0.269865273505849f,
+ 0.271440449865074f, 0.273014899496527f, 0.274588618184932f, 0.276161601716971f,
+ 0.277733845881292f, 0.279305346468526f, 0.280876099271292f, 0.282446100084212f,
+ 0.284015344703923f, 0.285583828929082f, 0.287151548560387f, 0.288718499400580f,
+ 0.290284677254462f, 0.291850077928904f, 0.293414697232857f, 0.294978530977364f,
+ 0.296541574975571f, 0.298103825042740f, 0.299665276996257f, 0.301225926655644f,
+ 0.302785769842575f, 0.304344802380877f, 0.305903020096553f, 0.307460418817785f,
+ 0.309016994374947f, 0.310572742600619f, 0.312127659329594f, 0.313681740398891f,
+ 0.315234981647770f, 0.316787378917734f, 0.318338928052550f, 0.319889624898253f,
+ 0.321439465303162f, 0.322988445117886f, 0.324536560195342f, 0.326083806390759f,
+ 0.327630179561694f, 0.329175675568039f, 0.330720290272037f, 0.332264019538291f,
+ 0.333806859233771f, 0.335348805227832f, 0.336889853392220f, 0.338429999601086f,
+ 0.339969239730994f, 0.341507569660936f, 0.343044985272340f, 0.344581482449080f,
+ 0.346117057077493f, 0.347651705046382f, 0.349185422247033f, 0.350718204573223f,
+ 0.352250047921234f, 0.353780948189858f, 0.355310901280416f, 0.356839903096763f,
+ 0.358367949545300f, 0.359895036534988f, 0.361421159977355f, 0.362946315786509f,
+ 0.364470499879150f, 0.365993708174577f, 0.367515936594704f, 0.369037181064066f,
+ 0.370557437509836f, 0.372076701861829f, 0.373594970052516f, 0.375112238017038f,
+ 0.376628501693211f, 0.378143757021540f, 0.379657999945233f, 0.381171226410203f,
+ 0.382683432365090f, 0.384194613761262f, 0.385704766552831f, 0.387213886696666f,
+ 0.388721970152396f, 0.390229012882428f, 0.391735010851956f, 0.393239960028970f,
+ 0.394743856384267f, 0.396246695891466f, 0.397748474527011f, 0.399249188270190f,
+ 0.400748833103141f, 0.402247405010863f, 0.403744899981227f, 0.405241314004990f,
+ 0.406736643075800f, 0.408230883190212f, 0.409724030347695f, 0.411216080550645f,
+ 0.412707029804395f, 0.414196874117224f, 0.415685609500371f, 0.417173231968043f,
+ 0.418659737537428f, 0.420145122228702f, 0.421629382065045f, 0.423112513072644f,
+ 0.424594511280713f, 0.426075372721496f, 0.427555093430282f, 0.429033669445413f,
+ 0.430511096808295f, 0.431987371563412f, 0.433462489758331f, 0.434936447443717f,
+ 0.436409240673342f, 0.437880865504095f, 0.439351317995994f, 0.440820594212194f,
+ 0.442288690219001f, 0.443755602085881f, 0.445221325885468f, 0.446685857693580f,
+ 0.448149193589223f, 0.449611329654607f, 0.451072261975153f, 0.452531986639508f,
+ 0.453990499739547f, 0.455447797370393f, 0.456903875630421f, 0.458358730621271f,
+ 0.459812358447860f, 0.461264755218387f, 0.462715917044350f, 0.464165840040552f,
+ 0.465614520325111f, 0.467061954019477f, 0.468508137248431f, 0.469953066140108f,
+ 0.471396736825998f, 0.472839145440959f, 0.474280288123229f, 0.475720161014437f,
+ 0.477158760259608f, 0.478596082007181f, 0.480032122409011f, 0.481466877620387f,
+ 0.482900343800037f, 0.484332517110141f, 0.485763393716340f, 0.487192969787746f,
+ 0.488621241496955f, 0.490048205020053f, 0.491473856536628f, 0.492898192229784f,
+ 0.494321208286145f, 0.495742900895868f, 0.497163266252654f, 0.498582300553759f,
+ 0.500000000000000f, 0.501416360795769f, 0.502831379149042f, 0.504245051271389f,
+ 0.505657373377985f, 0.507068341687617f, 0.508477952422700f, 0.509886201809281f,
+ 0.511293086077052f, 0.512698601459362f, 0.514102744193222f, 0.515505510519320f,
+ 0.516906896682028f, 0.518306898929413f, 0.519705513513249f, 0.521102736689023f,
+ 0.522498564715949f, 0.523892993856974f, 0.525286020378792f, 0.526677640551852f,
+ 0.528067850650368f, 0.529456646952329f, 0.530844025739509f, 0.532229983297479f,
+ 0.533614515915612f, 0.534997619887097f, 0.536379291508950f, 0.537759527082020f,
+ 0.539138322911000f, 0.540515675304440f, 0.541891580574752f, 0.543266035038224f,
+ 0.544639035015027f, 0.546010576829228f, 0.547380656808797f, 0.548749271285616f,
+ 0.550116416595493f, 0.551482089078169f, 0.552846285077328f, 0.554209000940606f,
+ 0.555570233019602f, 0.556929977669889f, 0.558288231251022f, 0.559644990126546f,
+ 0.561000250664010f, 0.562354009234973f, 0.563706262215017f, 0.565057005983753f,
+ 0.566406236924833f, 0.567753951425961f, 0.569100145878898f, 0.570444816679478f,
+ 0.571787960227612f, 0.573129572927301f, 0.574469651186643f, 0.575808191417845f,
+ 0.577145190037234f, 0.578480643465260f, 0.579814548126514f, 0.581146900449730f,
+ 0.582477696867802f, 0.583806933817786f, 0.585134607740916f, 0.586460715082607f,
+ 0.587785252292473f, 0.589108215824328f, 0.590429602136201f, 0.591749407690343f,
+ 0.593067628953237f, 0.594384262395609f, 0.595699304492433f, 0.597012751722948f,
+ 0.598324600570659f, 0.599634847523352f, 0.600943489073102f, 0.602250521716282f,
+ 0.603555941953571f, 0.604859746289968f, 0.606161931234795f, 0.607462493301711f,
+ 0.608761429008721f, 0.610058734878182f, 0.611354407436817f, 0.612648443215719f,
+ 0.613940838750366f, 0.615231590580627f, 0.616520695250769f, 0.617808149309472f,
+ 0.619093949309834f, 0.620378091809381f, 0.621660573370077f, 0.622941390558334f,
+ 0.624220539945018f, 0.625498018105461f, 0.626773821619470f, 0.628047947071334f,
+ 0.629320391049838f, 0.630591150148264f, 0.631860220964409f, 0.633127600100588f,
+ 0.634393284163646f, 0.635657269764965f, 0.636919553520476f, 0.638180132050665f,
+ 0.639439001980585f, 0.640696159939861f, 0.641951602562703f, 0.643205326487914f,
+ 0.644457328358897f, 0.645707604823667f, 0.646956152534857f, 0.648202968149730f,
+ 0.649448048330184f, 0.650691389742765f, 0.651932989058674f, 0.653172842953777f,
+ 0.654410948108610f, 0.655647301208395f, 0.656881898943041f, 0.658114738007160f,
+ 0.659345815100069f, 0.660575126925805f, 0.661802670193130f, 0.663028441615542f,
+ 0.664252437911282f, 0.665474655803342f, 0.666695092019479f, 0.667913743292216f,
+ 0.669130606358858f, 0.670345677961497f, 0.671558954847018f, 0.672770433767117f,
+ 0.673980111478298f, 0.675187984741891f, 0.676394050324054f, 0.677598304995789f,
+ 0.678800745532942f, 0.680001368716218f, 0.681200171331188f, 0.682397150168297f,
+ 0.683592302022871f, 0.684785623695130f, 0.685977111990193f, 0.687166763718086f,
+ 0.688354575693754f, 0.689540544737067f, 0.690724667672829f, 0.691906941330786f,
+ 0.693087362545636f, 0.694265928157036f, 0.695442635009612f, 0.696617479952964f,
+ 0.697790459841680f, 0.698961571535339f, 0.700130811898524f, 0.701298177800824f,
+ 0.702463666116852f, 0.703627273726243f, 0.704788997513670f, 0.705948834368849f,
+ 0.707106781186548f, 0.708262834866593f, 0.709416992313883f, 0.710569250438390f,
+ 0.711719606155171f, 0.712868056384380f, 0.714014598051268f, 0.715159228086199f,
+ 0.716301943424654f, 0.717442741007240f, 0.718581617779698f, 0.719718570692913f,
+ 0.720853596702919f, 0.721986692770910f, 0.723117855863248f, 0.724247082951467f,
+ 0.725374371012288f, 0.726499717027620f, 0.727623117984575f, 0.728744570875469f,
+ 0.729864072697836f, 0.730981620454432f, 0.732097211153246f, 0.733210841807505f,
+ 0.734322509435686f, 0.735432211061519f, 0.736539943713999f, 0.737645704427393f,
+ 0.738749490241246f, 0.739851298200392f, 0.740951125354959f, 0.742048968760379f,
+ 0.743144825477394f, 0.744238692572067f, 0.745330567115786f, 0.746420446185274f,
+ 0.747508326862597f, 0.748594206235171f, 0.749678081395770f, 0.750759949442534f,
+ 0.751839807478977f, 0.752917652613995f, 0.753993481961869f, 0.755067292642284f,
+ 0.756139081780323f, 0.757208846506485f, 0.758276583956687f, 0.759342291272275f,
+ 0.760405965600031f, 0.761467604092177f, 0.762527203906388f, 0.763584762205796f,
+ 0.764640276159000f, 0.765693742940071f, 0.766745159728561f, 0.767794523709512f,
+ 0.768841832073460f, 0.769887082016445f, 0.770930270740018f, 0.771971395451250f,
+ 0.773010453362737f, 0.774047441692607f, 0.775082357664531f, 0.776115198507728f,
+ 0.777145961456971f, 0.778174643752598f, 0.779201242640517f, 0.780225755372213f,
+ 0.781248179204759f, 0.782268511400816f, 0.783286749228650f, 0.784302889962131f,
+ 0.785316930880745f, 0.786328869269598f, 0.787338702419428f, 0.788346427626606f,
+ 0.789352042193150f, 0.790355543426726f, 0.791356928640660f, 0.792356195153942f,
+ 0.793353340291235f, 0.794348361382881f, 0.795341255764910f, 0.796332020779044f,
+ 0.797320653772707f, 0.798307152099032f, 0.799291513116864f, 0.800273734190774f,
+ 0.801253812691061f, 0.802231745993758f, 0.803207531480645f, 0.804181166539250f,
+ 0.805152648562858f, 0.806121974950521f, 0.807089143107059f, 0.808054150443073f,
+ 0.809016994374948f, 0.809977672324859f, 0.810936181720784f, 0.811892519996505f,
+ 0.812846684591615f, 0.813798672951530f, 0.814748482527489f, 0.815696110776568f,
+ 0.816641555161679f, 0.817584813151584f, 0.818525882220897f, 0.819464759850093f,
+ 0.820401443525514f, 0.821335930739376f, 0.822268218989775f, 0.823198305780696f,
+ 0.824126188622016f, 0.825051865029513f, 0.825975332524873f, 0.826896588635696f,
+ 0.827815630895502f, 0.828732456843738f, 0.829647064025785f, 0.830559449992965f,
+ 0.831469612302545f, 0.832377548517748f, 0.833283256207754f, 0.834186732947712f,
+ 0.835087976318743f, 0.835986983907947f, 0.836883753308409f, 0.837778282119209f,
+ 0.838670567945424f, 0.839560608398136f, 0.840448401094438f, 0.841333943657443f,
+ 0.842217233716287f, 0.843098268906135f, 0.843977046868193f, 0.844853565249707f,
+ 0.845727821703973f, 0.846599813890344f, 0.847469539474234f, 0.848336996127127f,
+ 0.849202181526579f, 0.850065093356229f, 0.850925729305802f, 0.851784087071117f,
+ 0.852640164354092f, 0.853493958862750f, 0.854345468311227f, 0.855194690419775f,
+ 0.856041622914771f, 0.856886263528723f, 0.857728610000272f, 0.858568660074204f,
+ 0.859406411501453f, 0.860241862039105f, 0.861075009450407f, 0.861905851504774f,
+ 0.862734385977792f, 0.863560610651224f, 0.864384523313017f, 0.865206121757311f,
+ 0.866025403784439f, 0.866842367200935f, 0.867657009819544f, 0.868469329459222f,
+ 0.869279323945144f, 0.870086991108711f, 0.870892328787557f, 0.871695334825548f,
+ 0.872496007072797f, 0.873294343385663f, 0.874090341626759f, 0.874883999664958f,
+ 0.875675315375400f, 0.876464286639493f, 0.877250911344924f, 0.878035187385663f,
+ 0.878817112661965f, 0.879596685080383f, 0.880373902553765f, 0.881148763001268f,
+ 0.881921264348355f, 0.882691404526809f, 0.883459181474733f, 0.884224593136556f,
+ 0.884987637463042f, 0.885748312411291f, 0.886506615944746f, 0.887262546033203f,
+ 0.888016100652807f, 0.888767277786068f, 0.889516075421856f, 0.890262491555416f,
+ 0.891006524188368f, 0.891748171328711f, 0.892487430990834f, 0.893224301195515f,
+ 0.893958779969932f, 0.894690865347664f, 0.895420555368697f, 0.896147848079432f,
+ 0.896872741532688f, 0.897595233787707f, 0.898315322910159f, 0.899033006972149f,
+ 0.899748284052221f, 0.900461152235364f, 0.901171609613013f, 0.901879654283062f,
+ 0.902585284349861f, 0.903288497924226f, 0.903989293123443f, 0.904687668071273f,
+ 0.905383620897955f, 0.906077149740215f, 0.906768252741266f, 0.907456928050819f,
+ 0.908143173825081f, 0.908826988226768f, 0.909508369425101f, 0.910187315595818f,
+ 0.910863824921176f, 0.911537895589956f, 0.912209525797468f, 0.912878713745555f,
+ 0.913545457642601f, 0.914209755703531f, 0.914871606149819f, 0.915531007209492f,
+ 0.916187957117136f, 0.916842454113898f, 0.917494496447491f, 0.918144082372204f,
+ 0.918791210148898f, 0.919435878045019f, 0.920078084334595f, 0.920717827298248f,
+ 0.921355105223192f, 0.921989916403245f, 0.922622259138823f, 0.923252131736957f,
+ 0.923879532511287f, 0.924504459782072f, 0.925126911876195f, 0.925746887127164f,
+ 0.926364383875118f, 0.926979400466833f, 0.927591935255724f, 0.928201986601852f,
+ 0.928809552871924f, 0.929414632439304f, 0.930017223684012f, 0.930617324992729f,
+ 0.931214934758804f, 0.931810051382254f, 0.932402673269775f, 0.932992798834739f,
+ 0.933580426497202f, 0.934165554683908f, 0.934748181828292f, 0.935328306370488f,
+ 0.935905926757326f, 0.936481041442343f, 0.937053648885784f, 0.937623747554606f,
+ 0.938191335922484f, 0.938756412469813f, 0.939318975683713f, 0.939879024058033f,
+ 0.940436556093355f, 0.940991570296997f, 0.941544065183021f, 0.942094039272230f,
+ 0.942641491092178f, 0.943186419177173f, 0.943728822068278f, 0.944268698313317f,
+ 0.944806046466878f, 0.945340865090320f, 0.945873152751771f, 0.946402908026138f,
+ 0.946930129495106f, 0.947454815747144f, 0.947976965377510f, 0.948496576988253f,
+ 0.949013649188214f, 0.949528180593037f, 0.950040169825165f, 0.950549615513851f,
+ 0.951056516295154f, 0.951560870811948f, 0.952062677713924f, 0.952561935657595f,
+ 0.953058643306297f, 0.953552799330193f, 0.954044402406280f, 0.954533451218389f,
+ 0.955019944457187f, 0.955503880820186f, 0.955985259011744f, 0.956464077743065f,
+ 0.956940335732209f, 0.957414031704088f, 0.957885164390477f, 0.958353732530011f,
+ 0.958819734868193f, 0.959283170157394f, 0.959744037156857f, 0.960202334632705f,
+ 0.960658061357935f, 0.961111216112432f, 0.961561797682962f, 0.962009804863184f,
+ 0.962455236453647f, 0.962898091261798f, 0.963338368101980f, 0.963776065795440f,
+ 0.964211183170329f, 0.964643719061708f, 0.965073672311547f, 0.965501041768733f,
+ 0.965925826289068f, 0.966348024735277f, 0.966767635977008f, 0.967184658890834f,
+ 0.967599092360260f, 0.968010935275723f, 0.968420186534595f, 0.968826845041188f,
+ 0.969230909706754f, 0.969632379449491f, 0.970031253194544f, 0.970427529874007f,
+ 0.970821208426928f, 0.971212287799312f, 0.971600766944121f, 0.971986644821279f,
+ 0.972369920397677f, 0.972750592647168f, 0.973128660550580f, 0.973504123095711f,
+ 0.973876979277334f, 0.974247228097201f, 0.974614868564045f, 0.974979899693582f,
+ 0.975342320508513f, 0.975702130038529f, 0.976059327320311f, 0.976413911397535f,
+ 0.976765881320872f, 0.977115236147994f, 0.977461974943572f, 0.977806096779282f,
+ 0.978147600733806f, 0.978486485892835f, 0.978822751349072f, 0.979156396202234f,
+ 0.979487419559051f, 0.979815820533276f, 0.980141598245680f, 0.980464751824058f,
+ 0.980785280403230f, 0.981103183125046f, 0.981418459138384f, 0.981731107599154f,
+ 0.982041127670304f, 0.982348518521816f, 0.982653279330712f, 0.982955409281056f,
+ 0.983254907563955f, 0.983551773377562f, 0.983846005927077f, 0.984137604424753f,
+ 0.984426568089892f, 0.984712896148850f, 0.984996587835043f, 0.985277642388941f,
+ 0.985556059058078f, 0.985831837097047f, 0.986104975767509f, 0.986375474338188f,
+ 0.986643332084879f, 0.986908548290446f, 0.987171122244825f, 0.987431053245027f,
+ 0.987688340595138f, 0.987942983606322f, 0.988194981596825f, 0.988444333891970f,
+ 0.988691039824167f, 0.988935098732911f, 0.989176509964781f, 0.989415272873448f,
+ 0.989651386819670f, 0.989884851171301f, 0.990115665303286f, 0.990343828597665f,
+ 0.990569340443577f, 0.990792200237260f, 0.991012407382049f, 0.991229961288385f,
+ 0.991444861373810f, 0.991657107062973f, 0.991866697787626f, 0.992073632986633f,
+ 0.992277912105967f, 0.992479534598710f, 0.992678499925058f, 0.992874807552322f,
+ 0.993068456954926f, 0.993259447614414f, 0.993447779019444f, 0.993633450665799f,
+ 0.993816462056378f, 0.993996812701206f, 0.994174502117428f, 0.994349529829318f,
+ 0.994521895368273f, 0.994691598272820f, 0.994858638088611f, 0.995023014368432f,
+ 0.995184726672197f, 0.995343774566954f, 0.995500157626885f, 0.995653875433303f,
+ 0.995804927574662f, 0.995953313646548f, 0.996099033251687f, 0.996242085999945f,
+ 0.996382471508325f, 0.996520189400975f, 0.996655239309180f, 0.996787620871373f,
+ 0.996917333733128f, 0.997044377547164f, 0.997168751973348f, 0.997290456678690f,
+ 0.997409491337352f, 0.997525855630641f, 0.997639549247016f, 0.997750571882084f,
+ 0.997858923238604f, 0.997964603026487f, 0.998067610962796f, 0.998167946771749f,
+ 0.998265610184716f, 0.998360600940223f, 0.998452918783950f, 0.998542563468736f,
+ 0.998629534754574f, 0.998713832408616f, 0.998795456205172f, 0.998874405925711f,
+ 0.998950681358860f, 0.999024282300407f, 0.999095208553300f, 0.999163459927649f,
+ 0.999229036240723f, 0.999291937316955f, 0.999352162987941f, 0.999409713092437f,
+ 0.999464587476366f, 0.999516785992811f, 0.999566308502021f, 0.999613154871411f,
+ 0.999657324975557f, 0.999698818696204f, 0.999737635922260f, 0.999773776549800f,
+ 0.999807240482065f, 0.999838027629461f, 0.999866137909562f, 0.999891571247108f,
+ 0.999914327574007f, 0.999934406829333f, 0.999951808959328f, 0.999966533917401f,
+ 0.999978581664129f, 0.999987952167257f, 0.999994645401697f, 0.999998661349528f
+};
+
+
+const float ivas_mdft_coeff_cos_twid_640[IVAS_640_PT_LEN +1] =
+{
+ 1.00000000000000f, 0.999996988037278f, 0.999987952167257f, 0.999972892444367f,
+ 0.999951808959328f, 0.999924701839145f, 0.999891571247108f, 0.999852417382795f,
+ 0.999807240482065f, 0.999756040817060f, 0.999698818696204f, 0.999635574464198f,
+ 0.999566308502021f, 0.999491021226926f, 0.999409713092437f, 0.999322384588350f,
+ 0.999229036240723f, 0.999129668611881f, 0.999024282300407f, 0.998912877941140f,
+ 0.998795456205172f, 0.998672017799843f, 0.998542563468736f, 0.998407093991674f,
+ 0.998265610184716f, 0.998118112900149f, 0.997964603026487f, 0.997805081488460f,
+ 0.997639549247016f, 0.997468007299307f, 0.997290456678690f, 0.997106898454717f,
+ 0.996917333733128f, 0.996721763655847f, 0.996520189400975f, 0.996312612182778f,
+ 0.996099033251687f, 0.995879453894286f, 0.995653875433303f, 0.995422299227608f,
+ 0.995184726672197f, 0.994941159198190f, 0.994691598272820f, 0.994436045399422f,
+ 0.994174502117428f, 0.993906970002356f, 0.993633450665799f, 0.993353945755417f,
+ 0.993068456954926f, 0.992776985984091f, 0.992479534598710f, 0.992176104590609f,
+ 0.991866697787626f, 0.991551316053606f, 0.991229961288385f, 0.990902635427780f,
+ 0.990569340443577f, 0.990230078343521f, 0.989884851171301f, 0.989533661006540f,
+ 0.989176509964781f, 0.988813400197476f, 0.988444333891970f, 0.988069313271492f,
+ 0.987688340595138f, 0.987301418157858f, 0.986908548290446f, 0.986509733359519f,
+ 0.986104975767509f, 0.985694277952645f, 0.985277642388941f, 0.984855071586178f,
+ 0.984426568089892f, 0.983992134481354f, 0.983551773377562f, 0.983105487431216f,
+ 0.982653279330712f, 0.982195151800116f, 0.981731107599154f, 0.981261149523195f,
+ 0.980785280403230f, 0.980303503105861f, 0.979815820533276f, 0.979322235623241f,
+ 0.978822751349072f, 0.978317370719628f, 0.977806096779282f, 0.977288932607910f,
+ 0.976765881320872f, 0.976236946068990f, 0.975702130038529f, 0.975161436451181f,
+ 0.974614868564045f, 0.974062429669605f, 0.973504123095711f, 0.972939952205560f,
+ 0.972369920397677f, 0.971794031105889f, 0.971212287799312f, 0.970624693982323f,
+ 0.970031253194544f, 0.969431969010818f, 0.968826845041188f, 0.968215884930876f,
+ 0.967599092360260f, 0.966976471044852f, 0.966348024735277f, 0.965713757217249f,
+ 0.965073672311547f, 0.964427773873996f, 0.963776065795440f, 0.963118552001719f,
+ 0.962455236453647f, 0.961786123146989f, 0.961111216112432f, 0.960430519415566f,
+ 0.959744037156857f, 0.959051773471624f, 0.958353732530011f, 0.957649918536965f,
+ 0.956940335732209f, 0.956224988390216f, 0.955503880820186f, 0.954777017366017f,
+ 0.954044402406280f, 0.953306040354194f, 0.952561935657595f, 0.951812092798916f,
+ 0.951056516295154f, 0.950295210697844f, 0.949528180593037f, 0.948755430601263f,
+ 0.947976965377510f, 0.947192789611197f, 0.946402908026138f, 0.945607325380521f,
+ 0.944806046466878f, 0.943999076112052f, 0.943186419177173f, 0.942368080557626f,
+ 0.941544065183021f, 0.940714378017165f, 0.939879024058033f, 0.939038008337734f,
+ 0.938191335922484f, 0.937339011912575f, 0.936481041442343f, 0.935617429680138f,
+ 0.934748181828292f, 0.933873303123092f, 0.932992798834739f, 0.932106674267327f,
+ 0.931214934758804f, 0.930317585680942f, 0.929414632439304f, 0.928506080473216f,
+ 0.927591935255724f, 0.926672202293573f, 0.925746887127164f, 0.924815995330528f,
+ 0.923879532511287f, 0.922937504310623f, 0.921989916403245f, 0.921036774497350f,
+ 0.920078084334595f, 0.919113851690058f, 0.918144082372204f, 0.917168782222852f,
+ 0.916187957117136f, 0.915201612963474f, 0.914209755703531f, 0.913212391312179f,
+ 0.912209525797468f, 0.911201165200584f, 0.910187315595818f, 0.909167983090522f,
+ 0.908143173825081f, 0.907112893972869f, 0.906077149740215f, 0.905035947366364f,
+ 0.903989293123443f, 0.902937193316419f, 0.901879654283062f, 0.900816682393908f,
+ 0.899748284052222f, 0.898674465693954f, 0.897595233787707f, 0.896510594834693f,
+ 0.895420555368697f, 0.894325121956035f, 0.893224301195515f, 0.892118099718401f,
+ 0.891006524188368f, 0.889889581301463f, 0.888767277786068f, 0.887639620402854f,
+ 0.886506615944746f, 0.885368271236879f, 0.884224593136556f, 0.883075588533209f,
+ 0.881921264348355f, 0.880761627535558f, 0.879596685080383f, 0.878426444000357f,
+ 0.877250911344924f, 0.876070094195407f, 0.874883999664958f, 0.873692634898524f,
+ 0.872496007072797f, 0.871294123396174f, 0.870086991108712f, 0.868874617482085f,
+ 0.867657009819544f, 0.866434175455865f, 0.865206121757311f, 0.863972856121587f,
+ 0.862734385977792f, 0.861490718786378f, 0.860241862039105f, 0.858987823258990f,
+ 0.857728610000272f, 0.856464229848356f, 0.855194690419775f, 0.853919999362139f,
+ 0.852640164354092f, 0.851355193105265f, 0.850065093356229f, 0.848769872878448f,
+ 0.847469539474235f, 0.846164100976699f, 0.844853565249707f, 0.843537940187827f,
+ 0.842217233716287f, 0.840891453790923f, 0.839560608398136f, 0.838224705554838f,
+ 0.836883753308409f, 0.835537759736646f, 0.834186732947712f, 0.832830681080094f,
+ 0.831469612302545f, 0.830103534814044f, 0.828732456843738f, 0.827356386650900f,
+ 0.825975332524873f, 0.824589302785025f, 0.823198305780696f, 0.821802349891147f,
+ 0.820401443525514f, 0.818995595122750f, 0.817584813151584f, 0.816169106110459f,
+ 0.814748482527489f, 0.813322950960406f, 0.811892519996505f, 0.810457198252595f,
+ 0.809016994374948f, 0.807571917039244f, 0.806121974950521f, 0.804667176843123f,
+ 0.803207531480645f, 0.801743047655882f, 0.800273734190774f, 0.798799599936358f,
+ 0.797320653772707f, 0.795836904608884f, 0.794348361382882f, 0.792855033061574f,
+ 0.791356928640660f, 0.789854057144609f, 0.788346427626606f, 0.786834049168500f,
+ 0.785316930880745f, 0.783795081902349f, 0.782268511400816f, 0.780737228572095f,
+ 0.779201242640517f, 0.777660562858748f, 0.776115198507728f, 0.774565158896617f,
+ 0.773010453362737f, 0.771451091271519f, 0.769887082016445f, 0.768318435018988f,
+ 0.766745159728562f, 0.765167265622459f, 0.763584762205797f, 0.761997659011457f,
+ 0.760405965600031f, 0.758809691559762f, 0.757208846506485f, 0.755603440083571f,
+ 0.753993481961870f, 0.752378981839648f, 0.750759949442534f, 0.749136394523459f,
+ 0.747508326862597f, 0.745875756267305f, 0.744238692572067f, 0.742597145638433f,
+ 0.740951125354959f, 0.739300641637149f, 0.737645704427393f, 0.735986323694910f,
+ 0.734322509435686f, 0.732654271672413f, 0.730981620454432f, 0.729304565857669f,
+ 0.727623117984575f, 0.725937286964068f, 0.724247082951467f, 0.722552516128436f,
+ 0.720853596702919f, 0.719150334909079f, 0.717442741007240f, 0.715730825283819f,
+ 0.714014598051268f, 0.712294069648014f, 0.710569250438390f, 0.708840150812579f,
+ 0.707106781186548f, 0.705369152001986f, 0.703627273726243f, 0.701881156852263f,
+ 0.700130811898524f, 0.698376249408973f, 0.696617479952964f, 0.694854514125194f,
+ 0.693087362545636f, 0.691316035859480f, 0.689540544737067f, 0.687760899873822f,
+ 0.685977111990193f, 0.684189191831585f, 0.682397150168297f, 0.680600997795453f,
+ 0.678800745532942f, 0.676996404225349f, 0.675187984741891f, 0.673375497976352f,
+ 0.671558954847018f, 0.669738366296610f, 0.667913743292216f, 0.666085096825230f,
+ 0.664252437911282f, 0.662415777590172f, 0.660575126925805f, 0.658730497006124f,
+ 0.656881898943041f, 0.655029343872374f, 0.653172842953777f, 0.651312407370671f,
+ 0.649448048330184f, 0.647579777063073f, 0.645707604823667f, 0.643831542889792f,
+ 0.641951602562703f, 0.640067795167023f, 0.638180132050665f, 0.636288624584773f,
+ 0.634393284163646f, 0.632494122204673f, 0.630591150148264f, 0.628684379457781f,
+ 0.626773821619470f, 0.624859488142386f, 0.622941390558334f, 0.621019540421789f,
+ 0.619093949309834f, 0.617164628822086f, 0.615231590580627f, 0.613294846229936f,
+ 0.611354407436817f, 0.609410285890327f, 0.607462493301711f, 0.605511041404326f,
+ 0.603555941953571f, 0.601597206726822f, 0.599634847523352f, 0.597668876164268f,
+ 0.595699304492433f, 0.593726144372402f, 0.591749407690343f, 0.589769106353971f,
+ 0.587785252292473f, 0.585797857456439f, 0.583806933817786f, 0.581812493369691f,
+ 0.579814548126514f, 0.577813110123727f, 0.575808191417845f, 0.573799804086349f,
+ 0.571787960227612f, 0.569772671960834f, 0.567753951425961f, 0.565731810783613f,
+ 0.563706262215017f, 0.561677317921925f, 0.559644990126546f, 0.557609291071472f,
+ 0.555570233019602f, 0.553527828254070f, 0.551482089078169f, 0.549433027815281f,
+ 0.547380656808797f, 0.545324988422047f, 0.543266035038224f, 0.541203809060310f,
+ 0.539138322911000f, 0.537069589032630f, 0.534997619887097f, 0.532922427955790f,
+ 0.530844025739510f, 0.528762425758396f, 0.526677640551852f, 0.524589682678469f,
+ 0.522498564715949f, 0.520404299261031f, 0.518306898929413f, 0.516206376355680f,
+ 0.514102744193222f, 0.511996015114163f, 0.509886201809281f, 0.507773316987935f,
+ 0.505657373377985f, 0.503538383725718f, 0.501416360795769f, 0.499291317371047f,
+ 0.497163266252654f, 0.495032220259813f, 0.492898192229784f, 0.490761195017794f,
+ 0.488621241496955f, 0.486478344558187f, 0.484332517110141f, 0.482183772079123f,
+ 0.480032122409011f, 0.477877581061184f, 0.475720161014437f, 0.473559875264908f,
+ 0.471396736825998f, 0.469230758728290f, 0.467061954019477f, 0.464890335764274f,
+ 0.462715917044350f, 0.460538710958240f, 0.458358730621271f, 0.456175989165483f,
+ 0.453990499739547f, 0.451802275508688f, 0.449611329654607f, 0.447417675375397f,
+ 0.445221325885468f, 0.443022294415467f, 0.440820594212194f, 0.438616238538528f,
+ 0.436409240673342f, 0.434199613911428f, 0.431987371563412f, 0.429772526955677f,
+ 0.427555093430282f, 0.425335084344881f, 0.423112513072644f, 0.420887393002174f,
+ 0.418659737537428f, 0.416429560097637f, 0.414196874117224f, 0.411961693045722f,
+ 0.409724030347695f, 0.407483899502658f, 0.405241314004990f, 0.402996287363860f,
+ 0.400748833103141f, 0.398498964761330f, 0.396246695891466f, 0.393992040061048f,
+ 0.391735010851956f, 0.389475621860365f, 0.387213886696666f, 0.384949818985382f,
+ 0.382683432365090f, 0.380414740488332f, 0.378143757021541f, 0.375870495644950f,
+ 0.373594970052516f, 0.371317193951838f, 0.369037181064066f, 0.366754945123831f,
+ 0.364470499879150f, 0.362183859091351f, 0.359895036534988f, 0.357604045997758f,
+ 0.355310901280416f, 0.353015616196696f, 0.350718204573223f, 0.348418680249435f,
+ 0.346117057077493f, 0.343813348922205f, 0.341507569660936f, 0.339199733183530f,
+ 0.336889853392220f, 0.334577944201551f, 0.332264019538291f, 0.329948093341349f,
+ 0.327630179561693f, 0.325310292162263f, 0.322988445117886f, 0.320664652415197f,
+ 0.318338928052550f, 0.316011286039934f, 0.313681740398892f, 0.311350305162432f,
+ 0.309016994374947f, 0.306681822092128f, 0.304344802380877f, 0.302005949319228f,
+ 0.299665276996257f, 0.297322799511999f, 0.294978530977364f, 0.292632485514051f,
+ 0.290284677254463f, 0.287935120341621f, 0.285583828929082f, 0.283230817180850f,
+ 0.280876099271292f, 0.278519689385053f, 0.276161601716971f, 0.273801850471989f,
+ 0.271440449865074f, 0.269077414121127f, 0.266712757474898f, 0.264346494170904f,
+ 0.261978638463337f, 0.259609204615985f, 0.257238206902140f, 0.254865659604515f,
+ 0.252491577015158f, 0.250115973435366f, 0.247738863175599f, 0.245360260555389f,
+ 0.242980179903264f, 0.240598635556650f, 0.238215641861795f, 0.235831213173673f,
+ 0.233445363855905f, 0.231058108280671f, 0.228669460828619f, 0.226279435888785f,
+ 0.223888047858498f, 0.221495311143304f, 0.219101240156870f, 0.216705849320900f,
+ 0.214309153065051f, 0.211911165826842f, 0.209511902051569f, 0.207111376192219f,
+ 0.204709602709380f, 0.202306596071156f, 0.199902370753082f, 0.197496941238030f,
+ 0.195090322016128f, 0.192682527584672f, 0.190273572448036f, 0.187863471117585f,
+ 0.185452238111591f, 0.183039887955141f, 0.180626435180053f, 0.178211894324786f,
+ 0.175796279934354f, 0.173379606560240f, 0.170961888760301f, 0.168543141098691f,
+ 0.166123378145766f, 0.163702614477995f, 0.161280864677881f, 0.158858143333862f,
+ 0.156434465040231f, 0.154009844397046f, 0.151584296010041f, 0.149157834490539f,
+ 0.146730474455362f, 0.144302230526747f, 0.141873117332253f, 0.139443149504679f,
+ 0.137012341681968f, 0.134580708507126f, 0.132148264628130f, 0.129715024697841f,
+ 0.127281003373913f, 0.124846215318711f, 0.122410675199216f, 0.119974397686941f,
+ 0.117537397457838f, 0.115099689192216f, 0.112661287574648f, 0.110222207293883f,
+ 0.107782463042759f, 0.105342069518114f, 0.102901041420696f, 0.100459393455077f,
+ 0.0980171403295608f, 0.0955742967560992f, 0.0931308774501999f, 0.0906868971308382f,
+ 0.0882423705203696f, 0.0857973123444399f, 0.0833517373318975f, 0.0809056602147037f,
+ 0.0784590957278450f, 0.0760120586092433f, 0.0735645635996675f, 0.0711166254426455f,
+ 0.0686682588843738f, 0.0662194786736304f, 0.0637702995616845f, 0.0613207363022087f,
+ 0.0588708036511890f, 0.0564205163668375f, 0.0539698892095020f, 0.0515189369415775f,
+ 0.0490676743274181f, 0.0466161161332467f, 0.0441642771270675f, 0.0417121720785753f,
+ 0.0392598157590687f, 0.0368072229413588f, 0.0343544083996823f, 0.0319013869096110f,
+ 0.0294481732479634f, 0.0269947821927155f, 0.0245412285229123f, 0.0220875270185784f,
+ 0.0196336924606283f, 0.0171797396307788f, 0.0147256833114584f, 0.0122715382857199f,
+ 0.00981731933714973f, 0.00736304124977978f, 0.00490871880799808f, 0.00245436679646048f
+ ,0.00000000000000000f
+};
+
+const float ivas_mdft_coeff_sin_twid_640[IVAS_640_PT_LEN] =
+{
+ 0.00000000000000f, 0.00245436679646029f, 0.00490871880799799f, 0.00736304124977957f,
+ 0.00981731933714962f, 0.0122715382857199f, 0.0147256833114585f, 0.0171797396307787f,
+ 0.0196336924606283f, 0.0220875270185783f, 0.0245412285229123f, 0.0269947821927154f,
+ 0.0294481732479632f, 0.0319013869096109f, 0.0343544083996823f, 0.0368072229413588f,
+ 0.0392598157590686f, 0.0417121720785753f, 0.0441642771270674f, 0.0466161161332467f,
+ 0.0490676743274180f, 0.0515189369415775f, 0.0539698892095019f, 0.0564205163668375f,
+ 0.0588708036511890f, 0.0613207363022086f, 0.0637702995616845f, 0.0662194786736303f,
+ 0.0686682588843738f, 0.0711166254426453f, 0.0735645635996674f, 0.0760120586092431f,
+ 0.0784590957278449f, 0.0809056602147038f, 0.0833517373318975f, 0.0857973123444399f,
+ 0.0882423705203695f, 0.0906868971308382f, 0.0931308774501998f, 0.0955742967560992f,
+ 0.0980171403295606f, 0.100459393455076f, 0.102901041420696f, 0.105342069518114f,
+ 0.107782463042759f, 0.110222207293883f, 0.112661287574648f, 0.115099689192216f,
+ 0.117537397457838f, 0.119974397686940f, 0.122410675199216f, 0.124846215318711f,
+ 0.127281003373913f, 0.129715024697841f, 0.132148264628130f, 0.134580708507126f,
+ 0.137012341681968f, 0.139443149504679f, 0.141873117332253f, 0.144302230526747f,
+ 0.146730474455362f, 0.149157834490539f, 0.151584296010041f, 0.154009844397046f,
+ 0.156434465040231f, 0.158858143333861f, 0.161280864677880f, 0.163702614477995f,
+ 0.166123378145765f, 0.168543141098691f, 0.170961888760301f, 0.173379606560240f,
+ 0.175796279934355f, 0.178211894324786f, 0.180626435180053f, 0.183039887955141f,
+ 0.185452238111591f, 0.187863471117585f, 0.190273572448036f, 0.192682527584672f,
+ 0.195090322016128f, 0.197496941238030f, 0.199902370753082f, 0.202306596071156f,
+ 0.204709602709380f, 0.207111376192219f, 0.209511902051569f, 0.211911165826842f,
+ 0.214309153065051f, 0.216705849320900f, 0.219101240156870f, 0.221495311143304f,
+ 0.223888047858498f, 0.226279435888785f, 0.228669460828619f, 0.231058108280671f,
+ 0.233445363855905f, 0.235831213173673f, 0.238215641861795f, 0.240598635556650f,
+ 0.242980179903264f, 0.245360260555389f, 0.247738863175598f, 0.250115973435366f,
+ 0.252491577015158f, 0.254865659604515f, 0.257238206902140f, 0.259609204615985f,
+ 0.261978638463337f, 0.264346494170904f, 0.266712757474898f, 0.269077414121127f,
+ 0.271440449865074f, 0.273801850471989f, 0.276161601716971f, 0.278519689385053f,
+ 0.280876099271292f, 0.283230817180850f, 0.285583828929082f, 0.287935120341621f,
+ 0.290284677254462f, 0.292632485514050f, 0.294978530977364f, 0.297322799511998f,
+ 0.299665276996257f, 0.302005949319228f, 0.304344802380877f, 0.306681822092128f,
+ 0.309016994374947f, 0.311350305162432f, 0.313681740398891f, 0.316011286039934f,
+ 0.318338928052550f, 0.320664652415197f, 0.322988445117886f, 0.325310292162263f,
+ 0.327630179561694f, 0.329948093341349f, 0.332264019538291f, 0.334577944201551f,
+ 0.336889853392220f, 0.339199733183530f, 0.341507569660936f, 0.343813348922205f,
+ 0.346117057077493f, 0.348418680249435f, 0.350718204573223f, 0.353015616196696f,
+ 0.355310901280416f, 0.357604045997758f, 0.359895036534988f, 0.362183859091351f,
+ 0.364470499879150f, 0.366754945123831f, 0.369037181064066f, 0.371317193951838f,
+ 0.373594970052516f, 0.375870495644949f, 0.378143757021541f, 0.380414740488332f,
+ 0.382683432365090f, 0.384949818985382f, 0.387213886696666f, 0.389475621860365f,
+ 0.391735010851956f, 0.393992040061048f, 0.396246695891466f, 0.398498964761330f,
+ 0.400748833103141f, 0.402996287363860f, 0.405241314004990f, 0.407483899502658f,
+ 0.409724030347695f, 0.411961693045722f, 0.414196874117224f, 0.416429560097637f,
+ 0.418659737537428f, 0.420887393002174f, 0.423112513072644f, 0.425335084344881f,
+ 0.427555093430282f, 0.429772526955677f, 0.431987371563412f, 0.434199613911428f,
+ 0.436409240673342f, 0.438616238538528f, 0.440820594212194f, 0.443022294415467f,
+ 0.445221325885468f, 0.447417675375397f, 0.449611329654607f, 0.451802275508688f,
+ 0.453990499739547f, 0.456175989165483f, 0.458358730621271f, 0.460538710958240f,
+ 0.462715917044350f, 0.464890335764274f, 0.467061954019477f, 0.469230758728290f,
+ 0.471396736825998f, 0.473559875264908f, 0.475720161014437f, 0.477877581061184f,
+ 0.480032122409011f, 0.482183772079123f, 0.484332517110141f, 0.486478344558187f,
+ 0.488621241496955f, 0.490761195017794f, 0.492898192229784f, 0.495032220259813f,
+ 0.497163266252654f, 0.499291317371047f, 0.501416360795769f, 0.503538383725718f,
+ 0.505657373377985f, 0.507773316987935f, 0.509886201809281f, 0.511996015114162f,
+ 0.514102744193222f, 0.516206376355680f, 0.518306898929413f, 0.520404299261031f,
+ 0.522498564715949f, 0.524589682678469f, 0.526677640551852f, 0.528762425758396f,
+ 0.530844025739509f, 0.532922427955790f, 0.534997619887097f, 0.537069589032630f,
+ 0.539138322911000f, 0.541203809060310f, 0.543266035038224f, 0.545324988422047f,
+ 0.547380656808796f, 0.549433027815281f, 0.551482089078169f, 0.553527828254070f,
+ 0.555570233019602f, 0.557609291071472f, 0.559644990126546f, 0.561677317921925f,
+ 0.563706262215017f, 0.565731810783613f, 0.567753951425961f, 0.569772671960834f,
+ 0.571787960227612f, 0.573799804086349f, 0.575808191417845f, 0.577813110123727f,
+ 0.579814548126514f, 0.581812493369691f, 0.583806933817786f, 0.585797857456439f,
+ 0.587785252292473f, 0.589769106353971f, 0.591749407690343f, 0.593726144372402f,
+ 0.595699304492433f, 0.597668876164268f, 0.599634847523352f, 0.601597206726822f,
+ 0.603555941953571f, 0.605511041404326f, 0.607462493301711f, 0.609410285890327f,
+ 0.611354407436817f, 0.613294846229936f, 0.615231590580627f, 0.617164628822086f,
+ 0.619093949309834f, 0.621019540421789f, 0.622941390558334f, 0.624859488142386f,
+ 0.626773821619470f, 0.628684379457781f, 0.630591150148264f, 0.632494122204672f,
+ 0.634393284163646f, 0.636288624584773f, 0.638180132050665f, 0.640067795167023f,
+ 0.641951602562703f, 0.643831542889792f, 0.645707604823667f, 0.647579777063073f,
+ 0.649448048330184f, 0.651312407370671f, 0.653172842953777f, 0.655029343872374f,
+ 0.656881898943041f, 0.658730497006124f, 0.660575126925805f, 0.662415777590172f,
+ 0.664252437911282f, 0.666085096825230f, 0.667913743292216f, 0.669738366296610f,
+ 0.671558954847018f, 0.673375497976352f, 0.675187984741890f, 0.676996404225348f,
+ 0.678800745532942f, 0.680600997795453f, 0.682397150168297f, 0.684189191831585f,
+ 0.685977111990193f, 0.687760899873822f, 0.689540544737067f, 0.691316035859480f,
+ 0.693087362545636f, 0.694854514125194f, 0.696617479952964f, 0.698376249408973f,
+ 0.700130811898524f, 0.701881156852263f, 0.703627273726243f, 0.705369152001986f,
+ 0.707106781186548f, 0.708840150812579f, 0.710569250438390f, 0.712294069648014f,
+ 0.714014598051268f, 0.715730825283819f, 0.717442741007240f, 0.719150334909079f,
+ 0.720853596702919f, 0.722552516128436f, 0.724247082951467f, 0.725937286964068f,
+ 0.727623117984575f, 0.729304565857668f, 0.730981620454432f, 0.732654271672413f,
+ 0.734322509435686f, 0.735986323694910f, 0.737645704427393f, 0.739300641637149f,
+ 0.740951125354959f, 0.742597145638433f, 0.744238692572067f, 0.745875756267305f,
+ 0.747508326862597f, 0.749136394523459f, 0.750759949442534f, 0.752378981839648f,
+ 0.753993481961869f, 0.755603440083571f, 0.757208846506485f, 0.758809691559762f,
+ 0.760405965600031f, 0.761997659011457f, 0.763584762205797f, 0.765167265622459f,
+ 0.766745159728562f, 0.768318435018988f, 0.769887082016445f, 0.771451091271519f,
+ 0.773010453362737f, 0.774565158896617f, 0.776115198507728f, 0.777660562858748f,
+ 0.779201242640517f, 0.780737228572095f, 0.782268511400816f, 0.783795081902349f,
+ 0.785316930880745f, 0.786834049168500f, 0.788346427626606f, 0.789854057144609f,
+ 0.791356928640660f, 0.792855033061574f, 0.794348361382882f, 0.795836904608884f,
+ 0.797320653772707f, 0.798799599936358f, 0.800273734190774f, 0.801743047655881f,
+ 0.803207531480645f, 0.804667176843123f, 0.806121974950521f, 0.807571917039243f,
+ 0.809016994374948f, 0.810457198252595f, 0.811892519996505f, 0.813322950960406f,
+ 0.814748482527489f, 0.816169106110459f, 0.817584813151584f, 0.818995595122750f,
+ 0.820401443525514f, 0.821802349891147f, 0.823198305780696f, 0.824589302785025f,
+ 0.825975332524873f, 0.827356386650900f, 0.828732456843738f, 0.830103534814044f,
+ 0.831469612302545f, 0.832830681080094f, 0.834186732947712f, 0.835537759736646f,
+ 0.836883753308409f, 0.838224705554838f, 0.839560608398136f, 0.840891453790923f,
+ 0.842217233716286f, 0.843537940187827f, 0.844853565249707f, 0.846164100976699f,
+ 0.847469539474234f, 0.848769872878448f, 0.850065093356229f, 0.851355193105265f,
+ 0.852640164354092f, 0.853919999362139f, 0.855194690419775f, 0.856464229848356f,
+ 0.857728610000272f, 0.858987823258990f, 0.860241862039105f, 0.861490718786378f,
+ 0.862734385977792f, 0.863972856121587f, 0.865206121757311f, 0.866434175455865f,
+ 0.867657009819544f, 0.868874617482086f, 0.870086991108711f, 0.871294123396174f,
+ 0.872496007072797f, 0.873692634898524f, 0.874883999664958f, 0.876070094195407f,
+ 0.877250911344924f, 0.878426444000357f, 0.879596685080383f, 0.880761627535558f,
+ 0.881921264348355f, 0.883075588533209f, 0.884224593136556f, 0.885368271236879f,
+ 0.886506615944746f, 0.887639620402854f, 0.888767277786068f, 0.889889581301463f,
+ 0.891006524188368f, 0.892118099718401f, 0.893224301195515f, 0.894325121956035f,
+ 0.895420555368697f, 0.896510594834693f, 0.897595233787707f, 0.898674465693954f,
+ 0.899748284052221f, 0.900816682393908f, 0.901879654283062f, 0.902937193316419f,
+ 0.903989293123443f, 0.905035947366364f, 0.906077149740215f, 0.907112893972869f,
+ 0.908143173825081f, 0.909167983090522f, 0.910187315595818f, 0.911201165200584f,
+ 0.912209525797468f, 0.913212391312179f, 0.914209755703531f, 0.915201612963474f,
+ 0.916187957117136f, 0.917168782222852f, 0.918144082372204f, 0.919113851690058f,
+ 0.920078084334595f, 0.921036774497350f, 0.921989916403245f, 0.922937504310623f,
+ 0.923879532511287f, 0.924815995330528f, 0.925746887127164f, 0.926672202293573f,
+ 0.927591935255724f, 0.928506080473216f, 0.929414632439304f, 0.930317585680942f,
+ 0.931214934758804f, 0.932106674267327f, 0.932992798834739f, 0.933873303123092f,
+ 0.934748181828292f, 0.935617429680138f, 0.936481041442343f, 0.937339011912575f,
+ 0.938191335922484f, 0.939038008337734f, 0.939879024058033f, 0.940714378017165f,
+ 0.941544065183021f, 0.942368080557626f, 0.943186419177173f, 0.943999076112052f,
+ 0.944806046466878f, 0.945607325380521f, 0.946402908026138f, 0.947192789611197f,
+ 0.947976965377510f, 0.948755430601262f, 0.949528180593037f, 0.950295210697844f,
+ 0.951056516295154f, 0.951812092798916f, 0.952561935657595f, 0.953306040354194f,
+ 0.954044402406280f, 0.954777017366017f, 0.955503880820186f, 0.956224988390216f,
+ 0.956940335732209f, 0.957649918536965f, 0.958353732530011f, 0.959051773471624f,
+ 0.959744037156857f, 0.960430519415566f, 0.961111216112432f, 0.961786123146989f,
+ 0.962455236453647f, 0.963118552001719f, 0.963776065795440f, 0.964427773873996f,
+ 0.965073672311547f, 0.965713757217249f, 0.966348024735277f, 0.966976471044852f,
+ 0.967599092360260f, 0.968215884930876f, 0.968826845041188f, 0.969431969010818f,
+ 0.970031253194544f, 0.970624693982323f, 0.971212287799312f, 0.971794031105889f,
+ 0.972369920397677f, 0.972939952205560f, 0.973504123095711f, 0.974062429669605f,
+ 0.974614868564045f, 0.975161436451181f, 0.975702130038529f, 0.976236946068990f,
+ 0.976765881320873f, 0.977288932607910f, 0.977806096779282f, 0.978317370719628f,
+ 0.978822751349072f, 0.979322235623241f, 0.979815820533276f, 0.980303503105861f,
+ 0.980785280403230f, 0.981261149523195f, 0.981731107599154f, 0.982195151800116f,
+ 0.982653279330712f, 0.983105487431216f, 0.983551773377562f, 0.983992134481354f,
+ 0.984426568089892f, 0.984855071586178f, 0.985277642388941f, 0.985694277952645f,
+ 0.986104975767509f, 0.986509733359519f, 0.986908548290446f, 0.987301418157858f,
+ 0.987688340595138f, 0.988069313271492f, 0.988444333891970f, 0.988813400197476f,
+ 0.989176509964781f, 0.989533661006540f, 0.989884851171301f, 0.990230078343521f,
+ 0.990569340443577f, 0.990902635427780f, 0.991229961288385f, 0.991551316053606f,
+ 0.991866697787626f, 0.992176104590609f, 0.992479534598710f, 0.992776985984091f,
+ 0.993068456954926f, 0.993353945755417f, 0.993633450665799f, 0.993906970002356f,
+ 0.994174502117428f, 0.994436045399422f, 0.994691598272820f, 0.994941159198190f,
+ 0.995184726672197f, 0.995422299227608f, 0.995653875433303f, 0.995879453894286f,
+ 0.996099033251687f, 0.996312612182778f, 0.996520189400975f, 0.996721763655847f,
+ 0.996917333733128f, 0.997106898454717f, 0.997290456678690f, 0.997468007299307f,
+ 0.997639549247016f, 0.997805081488460f, 0.997964603026487f, 0.998118112900149f,
+ 0.998265610184716f, 0.998407093991674f, 0.998542563468736f, 0.998672017799843f,
+ 0.998795456205172f, 0.998912877941140f, 0.999024282300407f, 0.999129668611881f,
+ 0.999229036240723f, 0.999322384588350f, 0.999409713092437f, 0.999491021226926f,
+ 0.999566308502021f, 0.999635574464198f, 0.999698818696204f, 0.999756040817060f,
+ 0.999807240482065f, 0.999852417382795f, 0.999891571247108f, 0.999924701839145f,
+ 0.999951808959328f, 0.999972892444367f, 0.999987952167257f, 0.999996988037278f
+};
+
+const float ivas_mdft_coeff_cos_twid_320[IVAS_320_PT_LEN + 1] =
+{
+ 1.00000000000000f, 0.999987952167257f, 0.999951808959328f, 0.999891571247108f,
+ 0.999807240482065f, 0.999698818696204f, 0.999566308502021f, 0.999409713092437f,
+ 0.999229036240723f, 0.999024282300407f, 0.998795456205172f, 0.998542563468736f,
+ 0.998265610184716f, 0.997964603026487f, 0.997639549247016f, 0.997290456678690f,
+ 0.996917333733128f, 0.996520189400975f, 0.996099033251687f, 0.995653875433303f,
+ 0.995184726672197f, 0.994691598272820f, 0.994174502117428f, 0.993633450665799f,
+ 0.993068456954926f, 0.992479534598710f, 0.991866697787626f, 0.991229961288385f,
+ 0.990569340443577f, 0.989884851171301f, 0.989176509964781f, 0.988444333891970f,
+ 0.987688340595138f, 0.986908548290446f, 0.986104975767509f, 0.985277642388941f,
+ 0.984426568089892f, 0.983551773377562f, 0.982653279330712f, 0.981731107599154f,
+ 0.980785280403230f, 0.979815820533276f, 0.978822751349072f, 0.977806096779282f,
+ 0.976765881320872f, 0.975702130038529f, 0.974614868564045f, 0.973504123095711f,
+ 0.972369920397677f, 0.971212287799312f, 0.970031253194544f, 0.968826845041188f,
+ 0.967599092360260f, 0.966348024735277f, 0.965073672311547f, 0.963776065795440f,
+ 0.962455236453647f, 0.961111216112432f, 0.959744037156857f, 0.958353732530011f,
+ 0.956940335732209f, 0.955503880820186f, 0.954044402406280f, 0.952561935657595f,
+ 0.951056516295154f, 0.949528180593037f, 0.947976965377510f, 0.946402908026138f,
+ 0.944806046466878f, 0.943186419177173f, 0.941544065183021f, 0.939879024058033f,
+ 0.938191335922484f, 0.936481041442343f, 0.934748181828292f, 0.932992798834739f,
+ 0.931214934758804f, 0.929414632439304f, 0.927591935255724f, 0.925746887127164f,
+ 0.923879532511287f, 0.921989916403245f, 0.920078084334595f, 0.918144082372204f,
+ 0.916187957117136f, 0.914209755703531f, 0.912209525797468f, 0.910187315595818f,
+ 0.908143173825081f, 0.906077149740215f, 0.903989293123443f, 0.901879654283062f,
+ 0.899748284052222f, 0.897595233787707f, 0.895420555368697f, 0.893224301195515f,
+ 0.891006524188368f, 0.888767277786068f, 0.886506615944746f, 0.884224593136556f,
+ 0.881921264348355f, 0.879596685080383f, 0.877250911344924f, 0.874883999664958f,
+ 0.872496007072797f, 0.870086991108712f, 0.867657009819544f, 0.865206121757311f,
+ 0.862734385977792f, 0.860241862039105f, 0.857728610000272f, 0.855194690419775f,
+ 0.852640164354092f, 0.850065093356229f, 0.847469539474235f, 0.844853565249707f,
+ 0.842217233716287f, 0.839560608398136f, 0.836883753308409f, 0.834186732947712f,
+ 0.831469612302545f, 0.828732456843738f, 0.825975332524873f, 0.823198305780696f,
+ 0.820401443525514f, 0.817584813151584f, 0.814748482527489f, 0.811892519996505f,
+ 0.809016994374948f, 0.806121974950521f, 0.803207531480645f, 0.800273734190774f,
+ 0.797320653772707f, 0.794348361382882f, 0.791356928640660f, 0.788346427626606f,
+ 0.785316930880745f, 0.782268511400816f, 0.779201242640517f, 0.776115198507728f,
+ 0.773010453362737f, 0.769887082016445f, 0.766745159728562f, 0.763584762205797f,
+ 0.760405965600031f, 0.757208846506485f, 0.753993481961870f, 0.750759949442534f,
+ 0.747508326862597f, 0.744238692572067f, 0.740951125354959f, 0.737645704427393f,
+ 0.734322509435686f, 0.730981620454432f, 0.727623117984575f, 0.724247082951467f,
+ 0.720853596702919f, 0.717442741007240f, 0.714014598051268f, 0.710569250438390f,
+ 0.707106781186548f, 0.703627273726243f, 0.700130811898524f, 0.696617479952964f,
+ 0.693087362545636f, 0.689540544737067f, 0.685977111990193f, 0.682397150168297f,
+ 0.678800745532942f, 0.675187984741891f, 0.671558954847018f, 0.667913743292216f,
+ 0.664252437911282f, 0.660575126925805f, 0.656881898943041f, 0.653172842953777f,
+ 0.649448048330184f, 0.645707604823667f, 0.641951602562703f, 0.638180132050665f,
+ 0.634393284163646f, 0.630591150148264f, 0.626773821619470f, 0.622941390558334f,
+ 0.619093949309834f, 0.615231590580627f, 0.611354407436817f, 0.607462493301711f,
+ 0.603555941953571f, 0.599634847523352f, 0.595699304492433f, 0.591749407690343f,
+ 0.587785252292473f, 0.583806933817786f, 0.579814548126514f, 0.575808191417845f,
+ 0.571787960227612f, 0.567753951425961f, 0.563706262215017f, 0.559644990126546f,
+ 0.555570233019602f, 0.551482089078169f, 0.547380656808797f, 0.543266035038224f,
+ 0.539138322911000f, 0.534997619887097f, 0.530844025739510f, 0.526677640551852f,
+ 0.522498564715949f, 0.518306898929413f, 0.514102744193222f, 0.509886201809281f,
+ 0.505657373377985f, 0.501416360795769f, 0.497163266252654f, 0.492898192229784f,
+ 0.488621241496955f, 0.484332517110141f, 0.480032122409011f, 0.475720161014437f,
+ 0.471396736825998f, 0.467061954019477f, 0.462715917044350f, 0.458358730621271f,
+ 0.453990499739547f, 0.449611329654607f, 0.445221325885468f, 0.440820594212194f,
+ 0.436409240673342f, 0.431987371563412f, 0.427555093430282f, 0.423112513072644f,
+ 0.418659737537428f, 0.414196874117224f, 0.409724030347695f, 0.405241314004990f,
+ 0.400748833103141f, 0.396246695891466f, 0.391735010851956f, 0.387213886696666f,
+ 0.382683432365090f, 0.378143757021541f, 0.373594970052516f, 0.369037181064066f,
+ 0.364470499879150f, 0.359895036534988f, 0.355310901280416f, 0.350718204573223f,
+ 0.346117057077493f, 0.341507569660936f, 0.336889853392220f, 0.332264019538291f,
+ 0.327630179561693f, 0.322988445117886f, 0.318338928052550f, 0.313681740398892f,
+ 0.309016994374947f, 0.304344802380877f, 0.299665276996257f, 0.294978530977364f,
+ 0.290284677254463f, 0.285583828929082f, 0.280876099271292f, 0.276161601716971f,
+ 0.271440449865074f, 0.266712757474898f, 0.261978638463337f, 0.257238206902140f,
+ 0.252491577015158f, 0.247738863175599f, 0.242980179903264f, 0.238215641861795f,
+ 0.233445363855905f, 0.228669460828619f, 0.223888047858498f, 0.219101240156870f,
+ 0.214309153065051f, 0.209511902051569f, 0.204709602709380f, 0.199902370753082f,
+ 0.195090322016128f, 0.190273572448036f, 0.185452238111591f, 0.180626435180053f,
+ 0.175796279934354f, 0.170961888760301f, 0.166123378145766f, 0.161280864677881f,
+ 0.156434465040231f, 0.151584296010041f, 0.146730474455362f, 0.141873117332253f,
+ 0.137012341681968f, 0.132148264628130f, 0.127281003373913f, 0.122410675199216f,
+ 0.117537397457838f, 0.112661287574648f, 0.107782463042759f, 0.102901041420696f,
+ 0.0980171403295608f, 0.0931308774501999f, 0.0882423705203696f, 0.0833517373318975f,
+ 0.0784590957278450f, 0.0735645635996675f, 0.0686682588843738f, 0.0637702995616845f,
+ 0.0588708036511890f, 0.0539698892095020f, 0.0490676743274181f, 0.0441642771270675f,
+ 0.0392598157590687f, 0.0343544083996823f, 0.0294481732479634f, 0.0245412285229123f,
+ 0.0196336924606283f, 0.0147256833114584f, 0.00981731933714973f, 0.00490871880799808f
+ ,0.0000000000000000f
+};
+
+const float ivas_mdft_coeff_sin_twid_320[IVAS_320_PT_LEN] =
+{
+ 0.00000000000000f, 0.00490871880799799f, 0.00981731933714962f, 0.0147256833114585f,
+ 0.0196336924606283f, 0.0245412285229123f, 0.0294481732479632f, 0.0343544083996823f,
+ 0.0392598157590686f, 0.0441642771270674f, 0.0490676743274180f, 0.0539698892095019f,
+ 0.0588708036511890f, 0.0637702995616845f, 0.0686682588843738f, 0.0735645635996674f,
+ 0.0784590957278449f, 0.0833517373318975f, 0.0882423705203695f, 0.0931308774501998f,
+ 0.0980171403295606f, 0.102901041420696f, 0.107782463042759f, 0.112661287574648f,
+ 0.117537397457838f, 0.122410675199216f, 0.127281003373913f, 0.132148264628130f,
+ 0.137012341681968f, 0.141873117332253f, 0.146730474455362f, 0.151584296010041f,
+ 0.156434465040231f, 0.161280864677880f, 0.166123378145765f, 0.170961888760301f,
+ 0.175796279934355f, 0.180626435180053f, 0.185452238111591f, 0.190273572448036f,
+ 0.195090322016128f, 0.199902370753082f, 0.204709602709380f, 0.209511902051569f,
+ 0.214309153065051f, 0.219101240156870f, 0.223888047858498f, 0.228669460828619f,
+ 0.233445363855905f, 0.238215641861795f, 0.242980179903264f, 0.247738863175598f,
+ 0.252491577015158f, 0.257238206902140f, 0.261978638463337f, 0.266712757474898f,
+ 0.271440449865074f, 0.276161601716971f, 0.280876099271292f, 0.285583828929082f,
+ 0.290284677254462f, 0.294978530977364f, 0.299665276996257f, 0.304344802380877f,
+ 0.309016994374947f, 0.313681740398891f, 0.318338928052550f, 0.322988445117886f,
+ 0.327630179561694f, 0.332264019538291f, 0.336889853392220f, 0.341507569660936f,
+ 0.346117057077493f, 0.350718204573223f, 0.355310901280416f, 0.359895036534988f,
+ 0.364470499879150f, 0.369037181064066f, 0.373594970052516f, 0.378143757021541f,
+ 0.382683432365090f, 0.387213886696666f, 0.391735010851956f, 0.396246695891466f,
+ 0.400748833103141f, 0.405241314004990f, 0.409724030347695f, 0.414196874117224f,
+ 0.418659737537428f, 0.423112513072644f, 0.427555093430282f, 0.431987371563412f,
+ 0.436409240673342f, 0.440820594212194f, 0.445221325885468f, 0.449611329654607f,
+ 0.453990499739547f, 0.458358730621271f, 0.462715917044350f, 0.467061954019477f,
+ 0.471396736825998f, 0.475720161014437f, 0.480032122409011f, 0.484332517110141f,
+ 0.488621241496955f, 0.492898192229784f, 0.497163266252654f, 0.501416360795769f,
+ 0.505657373377985f, 0.509886201809281f, 0.514102744193222f, 0.518306898929413f,
+ 0.522498564715949f, 0.526677640551852f, 0.530844025739509f, 0.534997619887097f,
+ 0.539138322911000f, 0.543266035038224f, 0.547380656808796f, 0.551482089078169f,
+ 0.555570233019602f, 0.559644990126546f, 0.563706262215017f, 0.567753951425961f,
+ 0.571787960227612f, 0.575808191417845f, 0.579814548126514f, 0.583806933817786f,
+ 0.587785252292473f, 0.591749407690343f, 0.595699304492433f, 0.599634847523352f,
+ 0.603555941953571f, 0.607462493301711f, 0.611354407436817f, 0.615231590580627f,
+ 0.619093949309834f, 0.622941390558334f, 0.626773821619470f, 0.630591150148264f,
+ 0.634393284163646f, 0.638180132050665f, 0.641951602562703f, 0.645707604823667f,
+ 0.649448048330184f, 0.653172842953777f, 0.656881898943041f, 0.660575126925805f,
+ 0.664252437911282f, 0.667913743292216f, 0.671558954847018f, 0.675187984741890f,
+ 0.678800745532942f, 0.682397150168297f, 0.685977111990193f, 0.689540544737067f,
+ 0.693087362545636f, 0.696617479952964f, 0.700130811898524f, 0.703627273726243f,
+ 0.707106781186548f, 0.710569250438390f, 0.714014598051268f, 0.717442741007240f,
+ 0.720853596702919f, 0.724247082951467f, 0.727623117984575f, 0.730981620454432f,
+ 0.734322509435686f, 0.737645704427393f, 0.740951125354959f, 0.744238692572067f,
+ 0.747508326862597f, 0.750759949442534f, 0.753993481961869f, 0.757208846506485f,
+ 0.760405965600031f, 0.763584762205797f, 0.766745159728562f, 0.769887082016445f,
+ 0.773010453362737f, 0.776115198507728f, 0.779201242640517f, 0.782268511400816f,
+ 0.785316930880745f, 0.788346427626606f, 0.791356928640660f, 0.794348361382882f,
+ 0.797320653772707f, 0.800273734190774f, 0.803207531480645f, 0.806121974950521f,
+ 0.809016994374948f, 0.811892519996505f, 0.814748482527489f, 0.817584813151584f,
+ 0.820401443525514f, 0.823198305780696f, 0.825975332524873f, 0.828732456843738f,
+ 0.831469612302545f, 0.834186732947712f, 0.836883753308409f, 0.839560608398136f,
+ 0.842217233716286f, 0.844853565249707f, 0.847469539474234f, 0.850065093356229f,
+ 0.852640164354092f, 0.855194690419775f, 0.857728610000272f, 0.860241862039105f,
+ 0.862734385977792f, 0.865206121757311f, 0.867657009819544f, 0.870086991108711f,
+ 0.872496007072797f, 0.874883999664958f, 0.877250911344924f, 0.879596685080383f,
+ 0.881921264348355f, 0.884224593136556f, 0.886506615944746f, 0.888767277786068f,
+ 0.891006524188368f, 0.893224301195515f, 0.895420555368697f, 0.897595233787707f,
+ 0.899748284052221f, 0.901879654283062f, 0.903989293123443f, 0.906077149740215f,
+ 0.908143173825081f, 0.910187315595818f, 0.912209525797468f, 0.914209755703531f,
+ 0.916187957117136f, 0.918144082372204f, 0.920078084334595f, 0.921989916403245f,
+ 0.923879532511287f, 0.925746887127164f, 0.927591935255724f, 0.929414632439304f,
+ 0.931214934758804f, 0.932992798834739f, 0.934748181828292f, 0.936481041442343f,
+ 0.938191335922484f, 0.939879024058033f, 0.941544065183021f, 0.943186419177173f,
+ 0.944806046466878f, 0.946402908026138f, 0.947976965377510f, 0.949528180593037f,
+ 0.951056516295154f, 0.952561935657595f, 0.954044402406280f, 0.955503880820186f,
+ 0.956940335732209f, 0.958353732530011f, 0.959744037156857f, 0.961111216112432f,
+ 0.962455236453647f, 0.963776065795440f, 0.965073672311547f, 0.966348024735277f,
+ 0.967599092360260f, 0.968826845041188f, 0.970031253194544f, 0.971212287799312f,
+ 0.972369920397677f, 0.973504123095711f, 0.974614868564045f, 0.975702130038529f,
+ 0.976765881320873f, 0.977806096779282f, 0.978822751349072f, 0.979815820533276f,
+ 0.980785280403230f, 0.981731107599154f, 0.982653279330712f, 0.983551773377562f,
+ 0.984426568089892f, 0.985277642388941f, 0.986104975767509f, 0.986908548290446f,
+ 0.987688340595138f, 0.988444333891970f, 0.989176509964781f, 0.989884851171301f,
+ 0.990569340443577f, 0.991229961288385f, 0.991866697787626f, 0.992479534598710f,
+ 0.993068456954926f, 0.993633450665799f, 0.994174502117428f, 0.994691598272820f,
+ 0.995184726672197f, 0.995653875433303f, 0.996099033251687f, 0.996520189400975f,
+ 0.996917333733128f, 0.997290456678690f, 0.997639549247016f, 0.997964603026487f,
+ 0.998265610184716f, 0.998542563468736f, 0.998795456205172f, 0.999024282300407f,
+ 0.999229036240723f, 0.999409713092437f, 0.999566308502021f, 0.999698818696204f,
+ 0.999807240482065f, 0.999891571247108f, 0.999951808959328f, 0.999987952167257f
+};
+
+const float ivas_mdft_coeff_cos_twid_240[IVAS_240_PT_LEN + 1] =
+{
+ 1.0000000000f, 0.9999785817f, 0.9999143276f, 0.9998072405f, 0.9996573250f, 0.9994645875f,
+ 0.9992290362f, 0.9989506814f, 0.9986295348f, 0.9982656102f, 0.9978589232f, 0.9974094913f,
+ 0.9969173337f, 0.9963824715f, 0.9958049276f, 0.9951847267f, 0.9945218954f, 0.9938164621f,
+ 0.9930684570f, 0.9922779121f, 0.9914448614f, 0.9905693404f, 0.9896513868f, 0.9886910398f,
+ 0.9876883406f, 0.9866433321f, 0.9855560591f, 0.9844265681f, 0.9832549076f, 0.9820411277f,
+ 0.9807852804f, 0.9794874196f, 0.9781476007f, 0.9767658813f, 0.9753423205f, 0.9738769793f,
+ 0.9723699204f, 0.9708212084f, 0.9692309097f, 0.9675990924f, 0.9659258263f, 0.9642111832f,
+ 0.9624552365f, 0.9606580614f, 0.9588197349f, 0.9569403357f, 0.9550199445f, 0.9530586433f,
+ 0.9510565163f, 0.9490136492f, 0.9469301295f, 0.9448060465f, 0.9426414911f, 0.9404365561f,
+ 0.9381913359f, 0.9359059268f, 0.9335804265f, 0.9312149348f, 0.9288095529f, 0.9263643839f,
+ 0.9238795325f, 0.9213551052f, 0.9187912101f, 0.9161879571f, 0.9135454576f, 0.9108638249f,
+ 0.9081431738f, 0.9053836209f, 0.9025852843f, 0.8997482841f, 0.8968727415f, 0.8939587800f,
+ 0.8910065242f, 0.8880161007f, 0.8849876375f, 0.8819212643f, 0.8788171127f, 0.8756753154f,
+ 0.8724960071f, 0.8692793239f, 0.8660254038f, 0.8627343860f, 0.8594064115f, 0.8560416229f,
+ 0.8526401644f, 0.8492021815f, 0.8457278217f, 0.8422172337f, 0.8386705679f, 0.8350879763f,
+ 0.8314696123f, 0.8278156309f, 0.8241261886f, 0.8204014435f, 0.8166415552f, 0.8128466846f,
+ 0.8090169944f, 0.8051526486f, 0.8012538127f, 0.7973206538f, 0.7933533403f, 0.7893520422f,
+ 0.7853169309f, 0.7812481792f, 0.7771459615f, 0.7730104534f, 0.7688418321f, 0.7646402762f,
+ 0.7604059656f, 0.7561390818f, 0.7518398075f, 0.7475083269f, 0.7431448255f, 0.7387494902f,
+ 0.7343225094f, 0.7298640727f, 0.7253743710f, 0.7208535967f, 0.7163019434f, 0.7117196062f,
+ 0.7071067812f, 0.7024636661f, 0.6977904598f, 0.6930873625f, 0.6883545757f, 0.6835923020f,
+ 0.6788007455f, 0.6739801115f, 0.6691306064f, 0.6642524379f, 0.6593458151f, 0.6544109481f,
+ 0.6494480483f, 0.6444573284f, 0.6394390020f, 0.6343932842f, 0.6293203910f, 0.6242205399f,
+ 0.6190939493f, 0.6139408388f, 0.6087614290f, 0.6035559420f, 0.5983246006f, 0.5930676290f,
+ 0.5877852523f, 0.5824776969f, 0.5771451900f, 0.5717879602f, 0.5664062369f, 0.5610002507f,
+ 0.5555702330f, 0.5501164166f, 0.5446390350f, 0.5391383229f, 0.5336145159f, 0.5280678507f,
+ 0.5224985647f, 0.5169068967f, 0.5112930861f, 0.5056573734f, 0.5000000000f, 0.4943212083f,
+ 0.4886212415f, 0.4829003438f, 0.4771587603f, 0.4713967368f, 0.4656145203f, 0.4598123584f,
+ 0.4539904997f, 0.4481491936f, 0.4422886902f, 0.4364092407f, 0.4305110968f, 0.4245945113f,
+ 0.4186597375f, 0.4127070298f, 0.4067366431f, 0.4007488331f, 0.3947438564f, 0.3887219702f,
+ 0.3826834324f, 0.3766285017f, 0.3705574375f, 0.3644704999f, 0.3583679495f, 0.3522500479f,
+ 0.3461170571f, 0.3399692397f, 0.3338068592f, 0.3276301796f, 0.3214394653f, 0.3152349816f,
+ 0.3090169944f, 0.3027857698f, 0.2965415750f, 0.2902846773f, 0.2840153447f, 0.2777338459f,
+ 0.2714404499f, 0.2651354262f, 0.2588190451f, 0.2524915770f, 0.2461532930f, 0.2398044647f,
+ 0.2334453639f, 0.2270762630f, 0.2206974350f, 0.2143091531f, 0.2079116908f, 0.2015053223f,
+ 0.1950903220f, 0.1886669647f, 0.1822355255f, 0.1757962799f, 0.1693495038f, 0.1628954734f,
+ 0.1564344650f, 0.1499667556f, 0.1434926220f, 0.1370123417f, 0.1305261922f, 0.1240344515f,
+ 0.1175373975f, 0.1110353086f, 0.1045284633f, 0.0980171403f, 0.0915016187f, 0.0849821774f,
+ 0.0784590957f, 0.0719326532f, 0.0654031292f, 0.0588708037f, 0.0523359562f, 0.0457988669f,
+ 0.0392598158f, 0.0327190828f, 0.0261769483f, 0.0196336925f, 0.0130895956f, 0.0065449380f,
+ 0.000000000f
+};
+
+const float ivas_mdft_coeff_sin_twid_240[IVAS_240_PT_LEN] =
+{
+ 0.0000000000f, 0.0065449380f, 0.0130895956f, 0.0196336925f, 0.0261769483f, 0.0327190828f,
+ 0.0392598158f, 0.0457988669f, 0.0523359562f, 0.0588708037f, 0.0654031292f, 0.0719326532f,
+ 0.0784590957f, 0.0849821774f, 0.0915016187f, 0.0980171403f, 0.1045284633f, 0.1110353086f,
+ 0.1175373975f, 0.1240344515f, 0.1305261922f, 0.1370123417f, 0.1434926220f, 0.1499667556f,
+ 0.1564344650f, 0.1628954734f, 0.1693495038f, 0.1757962799f, 0.1822355255f, 0.1886669647f,
+ 0.1950903220f, 0.2015053223f, 0.2079116908f, 0.2143091531f, 0.2206974350f, 0.2270762630f,
+ 0.2334453639f, 0.2398044647f, 0.2461532930f, 0.2524915770f, 0.2588190451f, 0.2651354262f,
+ 0.2714404499f, 0.2777338459f, 0.2840153447f, 0.2902846773f, 0.2965415750f, 0.3027857698f,
+ 0.3090169944f, 0.3152349816f, 0.3214394653f, 0.3276301796f, 0.3338068592f, 0.3399692397f,
+ 0.3461170571f, 0.3522500479f, 0.3583679495f, 0.3644704999f, 0.3705574375f, 0.3766285017f,
+ 0.3826834324f, 0.3887219702f, 0.3947438564f, 0.4007488331f, 0.4067366431f, 0.4127070298f,
+ 0.4186597375f, 0.4245945113f, 0.4305110968f, 0.4364092407f, 0.4422886902f, 0.4481491936f,
+ 0.4539904997f, 0.4598123584f, 0.4656145203f, 0.4713967368f, 0.4771587603f, 0.4829003438f,
+ 0.4886212415f, 0.4943212083f, 0.5000000000f, 0.5056573734f, 0.5112930861f, 0.5169068967f,
+ 0.5224985647f, 0.5280678507f, 0.5336145159f, 0.5391383229f, 0.5446390350f, 0.5501164166f,
+ 0.5555702330f, 0.5610002507f, 0.5664062369f, 0.5717879602f, 0.5771451900f, 0.5824776969f,
+ 0.5877852523f, 0.5930676290f, 0.5983246006f, 0.6035559420f, 0.6087614290f, 0.6139408388f,
+ 0.6190939493f, 0.6242205399f, 0.6293203910f, 0.6343932842f, 0.6394390020f, 0.6444573284f,
+ 0.6494480483f, 0.6544109481f, 0.6593458151f, 0.6642524379f, 0.6691306064f, 0.6739801115f,
+ 0.6788007455f, 0.6835923020f, 0.6883545757f, 0.6930873625f, 0.6977904598f, 0.7024636661f,
+ 0.7071067812f, 0.7117196062f, 0.7163019434f, 0.7208535967f, 0.7253743710f, 0.7298640727f,
+ 0.7343225094f, 0.7387494902f, 0.7431448255f, 0.7475083269f, 0.7518398075f, 0.7561390818f,
+ 0.7604059656f, 0.7646402762f, 0.7688418321f, 0.7730104534f, 0.7771459615f, 0.7812481792f,
+ 0.7853169309f, 0.7893520422f, 0.7933533403f, 0.7973206538f, 0.8012538127f, 0.8051526486f,
+ 0.8090169944f, 0.8128466846f, 0.8166415552f, 0.8204014435f, 0.8241261886f, 0.8278156309f,
+ 0.8314696123f, 0.8350879763f, 0.8386705679f, 0.8422172337f, 0.8457278217f, 0.8492021815f,
+ 0.8526401644f, 0.8560416229f, 0.8594064115f, 0.8627343860f, 0.8660254038f, 0.8692793239f,
+ 0.8724960071f, 0.8756753154f, 0.8788171127f, 0.8819212643f, 0.8849876375f, 0.8880161007f,
+ 0.8910065242f, 0.8939587800f, 0.8968727415f, 0.8997482841f, 0.9025852843f, 0.9053836209f,
+ 0.9081431738f, 0.9108638249f, 0.9135454576f, 0.9161879571f, 0.9187912101f, 0.9213551052f,
+ 0.9238795325f, 0.9263643839f, 0.9288095529f, 0.9312149348f, 0.9335804265f, 0.9359059268f,
+ 0.9381913359f, 0.9404365561f, 0.9426414911f, 0.9448060465f, 0.9469301295f, 0.9490136492f,
+ 0.9510565163f, 0.9530586433f, 0.9550199445f, 0.9569403357f, 0.9588197349f, 0.9606580614f,
+ 0.9624552365f, 0.9642111832f, 0.9659258263f, 0.9675990924f, 0.9692309097f, 0.9708212084f,
+ 0.9723699204f, 0.9738769793f, 0.9753423205f, 0.9767658813f, 0.9781476007f, 0.9794874196f,
+ 0.9807852804f, 0.9820411277f, 0.9832549076f, 0.9844265681f, 0.9855560591f, 0.9866433321f,
+ 0.9876883406f, 0.9886910398f, 0.9896513868f, 0.9905693404f, 0.9914448614f, 0.9922779121f,
+ 0.9930684570f, 0.9938164621f, 0.9945218954f, 0.9951847267f, 0.9958049276f, 0.9963824715f,
+ 0.9969173337f, 0.9974094913f, 0.9978589232f, 0.9982656102f, 0.9986295348f, 0.9989506814f,
+ 0.9992290362f, 0.9994645875f, 0.9996573250f, 0.9998072405f, 0.9999143276f, 0.9999785817f
+};
+
+const float ivas_mdft_coeff_cos_twid_160[IVAS_160_PT_LEN + 1] =
+{
+ 1.0000000000f, 0.9999518090f, 0.9998072405f, 0.9995663085f, 0.9992290362f, 0.9987954562f,
+ 0.9982656102f, 0.9976395492f, 0.9969173337f, 0.9960990333f, 0.9951847267f, 0.9941745021f,
+ 0.9930684570f, 0.9918666978f, 0.9905693404f, 0.9891765100f, 0.9876883406f, 0.9861049758f,
+ 0.9844265681f, 0.9826532793f, 0.9807852804f, 0.9788227513f, 0.9767658813f, 0.9746148686f,
+ 0.9723699204f, 0.9700312532f, 0.9675990924f, 0.9650736723f, 0.9624552365f, 0.9597440372f,
+ 0.9569403357f, 0.9540444024f, 0.9510565163f, 0.9479769654f, 0.9448060465f, 0.9415440652f,
+ 0.9381913359f, 0.9347481818f, 0.9312149348f, 0.9275919353f, 0.9238795325f, 0.9200780843f,
+ 0.9161879571f, 0.9122095258f, 0.9081431738f, 0.9039892931f, 0.8997482841f, 0.8954205554f,
+ 0.8910065242f, 0.8865066159f, 0.8819212643f, 0.8772509113f, 0.8724960071f, 0.8676570098f,
+ 0.8627343860f, 0.8577286100f, 0.8526401644f, 0.8474695395f, 0.8422172337f, 0.8368837533f,
+ 0.8314696123f, 0.8259753325f, 0.8204014435f, 0.8147484825f, 0.8090169944f, 0.8032075315f,
+ 0.7973206538f, 0.7913569286f, 0.7853169309f, 0.7792012426f, 0.7730104534f, 0.7667451597f,
+ 0.7604059656f, 0.7539934820f, 0.7475083269f, 0.7409511254f, 0.7343225094f, 0.7276231180f,
+ 0.7208535967f, 0.7140145981f, 0.7071067812f, 0.7001308119f, 0.6930873625f, 0.6859771120f,
+ 0.6788007455f, 0.6715589548f, 0.6642524379f, 0.6568818989f, 0.6494480483f, 0.6419516026f,
+ 0.6343932842f, 0.6267738216f, 0.6190939493f, 0.6113544074f, 0.6035559420f, 0.5956993045f,
+ 0.5877852523f, 0.5798145481f, 0.5717879602f, 0.5637062622f, 0.5555702330f, 0.5473806568f,
+ 0.5391383229f, 0.5308440257f, 0.5224985647f, 0.5141027442f, 0.5056573734f, 0.4971632663f,
+ 0.4886212415f, 0.4800321224f, 0.4713967368f, 0.4627159170f, 0.4539904997f, 0.4452213259f,
+ 0.4364092407f, 0.4275550934f, 0.4186597375f, 0.4097240303f, 0.4007488331f, 0.3917350109f,
+ 0.3826834324f, 0.3735949701f, 0.3644704999f, 0.3553109013f, 0.3461170571f, 0.3368898534f,
+ 0.3276301796f, 0.3183389281f, 0.3090169944f, 0.2996652770f, 0.2902846773f, 0.2808760993f,
+ 0.2714404499f, 0.2619786385f, 0.2524915770f, 0.2429801799f, 0.2334453639f, 0.2238880479f,
+ 0.2143091531f, 0.2047096027f, 0.1950903220f, 0.1854522381f, 0.1757962799f, 0.1661233781f,
+ 0.1564344650f, 0.1467304745f, 0.1370123417f, 0.1272810034f, 0.1175373975f, 0.1077824630f,
+ 0.0980171403f, 0.0882423705f, 0.0784590957f, 0.0686682589f, 0.0588708037f, 0.0490676743f,
+ 0.0392598158f, 0.0294481732f, 0.0196336925f, 0.0098173193f, 0.000000000f
+};
+
+const float ivas_mdft_coeff_sin_twid_160[IVAS_160_PT_LEN] =
+{
+ 0.0000000000f, 0.0098173193f, 0.0196336925f, 0.0294481732f, 0.0392598158f, 0.0490676743f,
+ 0.0588708037f, 0.0686682589f, 0.0784590957f, 0.0882423705f, 0.0980171403f, 0.1077824630f,
+ 0.1175373975f, 0.1272810034f, 0.1370123417f, 0.1467304745f, 0.1564344650f, 0.1661233781f,
+ 0.1757962799f, 0.1854522381f, 0.1950903220f, 0.2047096027f, 0.2143091531f, 0.2238880479f,
+ 0.2334453639f, 0.2429801799f, 0.2524915770f, 0.2619786385f, 0.2714404499f, 0.2808760993f,
+ 0.2902846773f, 0.2996652770f, 0.3090169944f, 0.3183389281f, 0.3276301796f, 0.3368898534f,
+ 0.3461170571f, 0.3553109013f, 0.3644704999f, 0.3735949701f, 0.3826834324f, 0.3917350109f,
+ 0.4007488331f, 0.4097240303f, 0.4186597375f, 0.4275550934f, 0.4364092407f, 0.4452213259f,
+ 0.4539904997f, 0.4627159170f, 0.4713967368f, 0.4800321224f, 0.4886212415f, 0.4971632663f,
+ 0.5056573734f, 0.5141027442f, 0.5224985647f, 0.5308440257f, 0.5391383229f, 0.5473806568f,
+ 0.5555702330f, 0.5637062622f, 0.5717879602f, 0.5798145481f, 0.5877852523f, 0.5956993045f,
+ 0.6035559420f, 0.6113544074f, 0.6190939493f, 0.6267738216f, 0.6343932842f, 0.6419516026f,
+ 0.6494480483f, 0.6568818989f, 0.6642524379f, 0.6715589548f, 0.6788007455f, 0.6859771120f,
+ 0.6930873625f, 0.7001308119f, 0.7071067812f, 0.7140145981f, 0.7208535967f, 0.7276231180f,
+ 0.7343225094f, 0.7409511254f, 0.7475083269f, 0.7539934820f, 0.7604059656f, 0.7667451597f,
+ 0.7730104534f, 0.7792012426f, 0.7853169309f, 0.7913569286f, 0.7973206538f, 0.8032075315f,
+ 0.8090169944f, 0.8147484825f, 0.8204014435f, 0.8259753325f, 0.8314696123f, 0.8368837533f,
+ 0.8422172337f, 0.8474695395f, 0.8526401644f, 0.8577286100f, 0.8627343860f, 0.8676570098f,
+ 0.8724960071f, 0.8772509113f, 0.8819212643f, 0.8865066159f, 0.8910065242f, 0.8954205554f,
+ 0.8997482841f, 0.9039892931f, 0.9081431738f, 0.9122095258f, 0.9161879571f, 0.9200780843f,
+ 0.9238795325f, 0.9275919353f, 0.9312149348f, 0.9347481818f, 0.9381913359f, 0.9415440652f,
+ 0.9448060465f, 0.9479769654f, 0.9510565163f, 0.9540444024f, 0.9569403357f, 0.9597440372f,
+ 0.9624552365f, 0.9650736723f, 0.9675990924f, 0.9700312532f, 0.9723699204f, 0.9746148686f,
+ 0.9767658813f, 0.9788227513f, 0.9807852804f, 0.9826532793f, 0.9844265681f, 0.9861049758f,
+ 0.9876883406f, 0.9891765100f, 0.9905693404f, 0.9918666978f, 0.9930684570f, 0.9941745021f,
+ 0.9951847267f, 0.9960990333f, 0.9969173337f, 0.9976395492f, 0.9982656102f, 0.9987954562f,
+ 0.9992290362f, 0.9995663085f, 0.9998072405f, 0.9999518090f
+};
+
+const float ivas_mdft_coeff_cos_twid_80[IVAS_80_PT_LEN + 1] =
+{
+ 1.0000000000f, 0.9998072405f, 0.9992290362f, 0.9982656102f, 0.9969173337f, 0.9951847267f,
+ 0.9930684570f, 0.9905693404f, 0.9876883406f, 0.9844265681f, 0.9807852804f, 0.9767658813f,
+ 0.9723699204f, 0.9675990924f, 0.9624552365f, 0.9569403357f, 0.9510565163f, 0.9448060465f,
+ 0.9381913359f, 0.9312149348f, 0.9238795325f, 0.9161879571f, 0.9081431738f, 0.8997482841f,
+ 0.8910065242f, 0.8819212643f, 0.8724960071f, 0.8627343860f, 0.8526401644f, 0.8422172337f,
+ 0.8314696123f, 0.8204014435f, 0.8090169944f, 0.7973206538f, 0.7853169309f, 0.7730104534f,
+ 0.7604059656f, 0.7475083269f, 0.7343225094f, 0.7208535967f, 0.7071067812f, 0.6930873625f,
+ 0.6788007455f, 0.6642524379f, 0.6494480483f, 0.6343932842f, 0.6190939493f, 0.6035559420f,
+ 0.5877852523f, 0.5717879602f, 0.5555702330f, 0.5391383229f, 0.5224985647f, 0.5056573734f,
+ 0.4886212415f, 0.4713967368f, 0.4539904997f, 0.4364092407f, 0.4186597375f, 0.4007488331f,
+ 0.3826834324f, 0.3644704999f, 0.3461170571f, 0.3276301796f, 0.3090169944f, 0.2902846773f,
+ 0.2714404499f, 0.2524915770f, 0.2334453639f, 0.2143091531f, 0.1950903220f, 0.1757962799f,
+ 0.1564344650f, 0.1370123417f, 0.1175373975f, 0.0980171403f, 0.0784590957f, 0.0588708037f,
+ 0.0392598158f, 0.0196336925f, 0.000000000f
+};
+
+const float ivas_mdft_coeff_sin_twid_80[IVAS_80_PT_LEN] =
+{
+ 0.0000000000f, 0.0196336925f, 0.0392598158f, 0.0588708037f, 0.0784590957f, 0.0980171403f,
+ 0.1175373975f, 0.1370123417f, 0.1564344650f, 0.1757962799f, 0.1950903220f, 0.2143091531f,
+ 0.2334453639f, 0.2524915770f, 0.2714404499f, 0.2902846773f, 0.3090169944f, 0.3276301796f,
+ 0.3461170571f, 0.3644704999f, 0.3826834324f, 0.4007488331f, 0.4186597375f, 0.4364092407f,
+ 0.4539904997f, 0.4713967368f, 0.4886212415f, 0.5056573734f, 0.5224985647f, 0.5391383229f,
+ 0.5555702330f, 0.5717879602f, 0.5877852523f, 0.6035559420f, 0.6190939493f, 0.6343932842f,
+ 0.6494480483f, 0.6642524379f, 0.6788007455f, 0.6930873625f, 0.7071067812f, 0.7208535967f,
+ 0.7343225094f, 0.7475083269f, 0.7604059656f, 0.7730104534f, 0.7853169309f, 0.7973206538f,
+ 0.8090169944f, 0.8204014435f, 0.8314696123f, 0.8422172337f, 0.8526401644f, 0.8627343860f,
+ 0.8724960071f, 0.8819212643f, 0.8910065242f, 0.8997482841f, 0.9081431738f, 0.9161879571f,
+ 0.9238795325f, 0.9312149348f, 0.9381913359f, 0.9448060465f, 0.9510565163f, 0.9569403357f,
+ 0.9624552365f, 0.9675990924f, 0.9723699204f, 0.9767658813f, 0.9807852804f, 0.9844265681f,
+ 0.9876883406f, 0.9905693404f, 0.9930684570f, 0.9951847267f, 0.9969173337f, 0.9982656102f,
+ 0.9992290362f, 0.9998072405f
+};
+
+const float ivas_mdft_coeff_cos_twid_40[IVAS_40_PT_LEN + 1] =
+{
+ 1.0000000000f, 0.9992290362f, 0.9969173337f, 0.9930684570f, 0.9876883406f, 0.9807852804f,
+ 0.9723699204f, 0.9624552365f, 0.9510565163f, 0.9381913359f, 0.9238795325f, 0.9081431738f,
+ 0.8910065242f, 0.8724960071f, 0.8526401644f, 0.8314696123f, 0.8090169944f, 0.7853169309f,
+ 0.7604059656f, 0.7343225094f, 0.7071067812f, 0.6788007455f, 0.6494480483f, 0.6190939493f,
+ 0.5877852523f, 0.5555702330f, 0.5224985647f, 0.4886212415f, 0.4539904997f, 0.4186597375f,
+ 0.3826834324f, 0.3461170571f, 0.3090169944f, 0.2714404499f, 0.2334453639f, 0.1950903220f,
+ 0.1564344650f, 0.1175373975f, 0.0784590957f, 0.0392598158f, 0.000000000f
+};
+
+const float ivas_mdft_coeff_sin_twid_40[IVAS_40_PT_LEN] =
+{
+ 0.0000000000f, 0.0392598158f, 0.0784590957f, 0.1175373975f, 0.1564344650f, 0.1950903220f,
+ 0.2334453639f, 0.2714404499f, 0.3090169944f, 0.3461170571f, 0.3826834324f, 0.4186597375f,
+ 0.4539904997f, 0.4886212415f, 0.5224985647f, 0.5555702330f, 0.5877852523f, 0.6190939493f,
+ 0.6494480483f, 0.6788007455f, 0.7071067812f, 0.7343225094f, 0.7604059656f, 0.7853169309f,
+ 0.8090169944f, 0.8314696123f, 0.8526401644f, 0.8724960071f, 0.8910065242f, 0.9081431738f,
+ 0.9238795325f, 0.9381913359f, 0.9510565163f, 0.9624552365f, 0.9723699204f, 0.9807852804f,
+ 0.9876883406f, 0.9930684570f, 0.9969173337f, 0.9992290362f
+};
+
+const float ivas_sin_twiddle_480[IVAS_480_PT_LEN >> 1] =
+{
+ -0.000818122995607253f, -0.00736304124977957f, -0.0139076440957708f, -0.0204516511845773f,
+ -0.0269947821927154f, -0.0335367568342299f, -0.0400772948727007f, -0.0466161161332467f,
+ -0.0531529405145281f, -0.0596874880007445f, -0.0662194786736303f, -0.0727486327244454f,
+ -0.0792746704659607f, -0.0857973123444399f, -0.0923162789516138f, -0.0988312910366500f,
+ -0.105342069518114f, -0.111848335495926f, -0.118349810263305f, -0.124846215318711f,
+ -0.131337272377774f, -0.137822703385212f, -0.144302230526747f, -0.150775576241001f,
+ -0.157242463231389f, -0.163702614477995f, -0.170155753249442f, -0.176601603114742f,
+ -0.183039887955141f, -0.189470331975943f, -0.195892659718330f, -0.202306596071156f,
+ -0.208711866282735f, -0.215108195972610f, -0.221495311143304f, -0.227872938192063f,
+ -0.234240803922570f, -0.240598635556650f, -0.246946160745958f, -0.253283107583640f,
+ -0.259609204615985f, -0.265924180854051f, -0.272227765785273f, -0.278519689385053f,
+ -0.284799682128326f, -0.291067475001103f, -0.297322799511998f, -0.303565387703730f,
+ -0.309794972164597f, -0.316011286039934f, -0.322214063043544f, -0.328403037469105f,
+ -0.334577944201551f, -0.340738518728429f, -0.346884497151231f, -0.353015616196696f,
+ -0.359131613228090f, -0.365232226256457f, -0.371317193951838f, -0.377386255654469f,
+ -0.383439151385947f, -0.389475621860365f, -0.395495408495417f, -0.401498253423481f,
+ -0.407483899502658f, -0.413452090327791f, -0.419402570241451f, -0.425335084344881f,
+ -0.431249378508924f, -0.437145199384900f, -0.443022294415467f, -0.448880411845434f,
+ -0.454719300732547f, -0.460538710958240f, -0.466338393238348f, -0.472118099133784f,
+ -0.477877581061184f, -0.483616592303511f, -0.489334887020625f, -0.495032220259813f,
+ -0.500708347966279f, -0.506363026993606f, -0.511996015114162f, -0.517607071029487f,
+ -0.523195954380619f, -0.528762425758396f, -0.534306246713712f, -0.539827179767727f,
+ -0.545324988422047f, -0.550799437168844f, -0.556250291500956f, -0.561677317921925f,
+ -0.567080283956001f, -0.572458958158102f, -0.577813110123727f, -0.583142510498826f,
+ -0.588446930989624f, -0.593726144372402f, -0.598979924503229f, -0.604208046327650f,
+ -0.609410285890327f, -0.614586420344631f, -0.619736227962191f, -0.624859488142386f,
+ -0.629955981421804f, -0.635025489483634f, -0.640067795167023f, -0.645082682476378f,
+ -0.650069936590618f, -0.655029343872374f, -0.659960691877147f, -0.664863769362399f,
+ -0.669738366296610f, -0.674584273868271f, -0.679401284494831f, -0.684189191831585f,
+ -0.688947790780520f, -0.693676877499095f, -0.698376249408973f, -0.703045705204703f,
+ -0.707685044862340f, -0.712294069648014f, -0.716872582126442f, -0.721420386169390f,
+ -0.725937286964068f, -0.730423091021479f, -0.734877606184707f, -0.739300641637149f,
+ -0.743692007910687f, -0.748051516893805f, -0.752378981839648f, -0.756674217374021f,
+ -0.760937039503328f, -0.765167265622459f, -0.769364714522605f, -0.773529206399025f,
+ -0.777660562858748f, -0.781758606928213f, -0.785823163060853f, -0.789854057144609f,
+ -0.793851116509396f, -0.797814169934493f, -0.801743047655882f, -0.805637581373517f,
+ -0.809497604258536f, -0.813322950960406f, -0.817113457614006f, -0.820868961846646f,
+ -0.824589302785025f, -0.828274321062119f, -0.831923858824010f, -0.835537759736646f,
+ -0.839115868992540f, -0.842658033317402f, -0.846164100976699f, -0.849633921782164f,
+ -0.853067347098221f, -0.856464229848356f, -0.859824424521420f, -0.863147787177854f,
+ -0.866434175455865f, -0.869683448577516f, -0.872895467354761f, -0.876070094195407f,
+ -0.879207193109004f, -0.882306629712678f, -0.885368271236879f, -0.888391986531075f,
+ -0.891377646069366f, -0.894325121956035f, -0.897234287931024f, -0.900105019375345f,
+ -0.902937193316419f, -0.905730688433339f, -0.908485385062073f, -0.911201165200584f,
+ -0.913877912513892f, -0.916515512339049f, -0.919113851690058f, -0.921672819262709f,
+ -0.924192305439348f, -0.926672202293573f, -0.929112403594856f, -0.931512804813095f,
+ -0.933873303123092f, -0.936193797408954f, -0.938474188268430f, -0.940714378017165f,
+ -0.942914270692887f, -0.945073772059515f, -0.947192789611197f, -0.949271232576274f,
+ -0.951309011921168f, -0.953306040354194f, -0.955262232329299f, -0.957177504049732f,
+ -0.959051773471624f, -0.960884960307514f, -0.962676986029777f, -0.964427773873996f,
+ -0.966137248842248f, -0.967805337706313f, -0.969431969010818f, -0.971017073076290f,
+ -0.972560582002147f, -0.974062429669605f, -0.975522551744506f, -0.976940885680082f,
+ -0.978317370719628f, -0.979651947899104f, -0.980944560049668f, -0.982195151800116f,
+ -0.983403669579260f, -0.984570061618221f, -0.985694277952645f, -0.986776270424848f,
+ -0.987815992685872f, -0.988813400197476f, -0.989768450234042f, -0.990681101884405f,
+ -0.991551316053606f, -0.992379055464567f, -0.993164284659685f, -0.993906970002356f,
+ -0.994607079678411f, -0.995264583697482f, -0.995879453894286f, -0.996451663929828f,
+ -0.996981189292537f, -0.997468007299307f, -0.997912097096476f, -0.998313439660714f,
+ -0.998672017799843f, -0.998987816153568f, -0.999260821194138f, -0.999491021226926f,
+ -0.999678406390929f, -0.999822968659191f, -0.999924701839145f, -0.999983601572879f
+};
+
+const float ivas_cos_twiddle_480[IVAS_480_PT_LEN >> 1] =
+{
+ 0.999999665337326f, 0.999972892444367f, 0.999903284040864f, 0.999790843108610f,
+ 0.999635574464198f, 0.999437484758823f, 0.999196582477986f, 0.998912877941140f,
+ 0.998586383301244f, 0.998217112544241f, 0.997805081488460f, 0.997350307783942f,
+ 0.996852810911678f, 0.996312612182778f, 0.995729734737558f, 0.995104203544548f,
+ 0.994436045399422f, 0.993725288923851f, 0.992971964564277f, 0.992176104590609f,
+ 0.991337743094838f, 0.990456915989581f, 0.989533661006540f, 0.988568017694885f,
+ 0.987560027419562f, 0.986509733359519f, 0.985417180505858f, 0.984282415659908f,
+ 0.983105487431216f, 0.981886446235473f, 0.980625344292344f, 0.979322235623241f,
+ 0.977977176049001f, 0.976590223187499f, 0.975161436451181f, 0.973690877044515f,
+ 0.972178607961371f, 0.970624693982323f, 0.969029201671875f, 0.967392199375607f,
+ 0.965713757217249f, 0.963993947095677f, 0.962232842681832f, 0.960430519415566f,
+ 0.958587054502409f, 0.956702526910263f, 0.954777017366017f, 0.952810608352092f,
+ 0.950803384102905f, 0.948755430601263f, 0.946666835574676f, 0.944537688491606f,
+ 0.942368080557626f, 0.940158104711519f, 0.937907855621296f, 0.935617429680138f,
+ 0.933286925002268f, 0.930916441418752f, 0.928506080473216f, 0.926055945417500f,
+ 0.923566141207236f, 0.921036774497350f, 0.918467953637493f, 0.915859788667400f,
+ 0.913212391312179f, 0.910525874977521f, 0.907800354744844f, 0.905035947366364f,
+ 0.902232771260093f, 0.899390946504765f, 0.896510594834693f, 0.893591839634558f,
+ 0.890634805934118f, 0.887639620402854f, 0.884606411344546f, 0.881535308691775f,
+ 0.878426444000357f, 0.875279950443708f, 0.872095962807140f, 0.868874617482085f,
+ 0.865616052460258f, 0.862320407327736f, 0.858987823258990f, 0.855618443010829f,
+ 0.852212410916289f, 0.848769872878448f, 0.845290976364179f, 0.841775870397828f,
+ 0.838224705554838f, 0.834637633955290f, 0.831014809257393f, 0.827356386650900f,
+ 0.823662522850458f, 0.819933376088899f, 0.816169106110459f, 0.812369874163934f,
+ 0.808535842995778f, 0.804667176843123f, 0.800764041426753f, 0.796826603943998f,
+ 0.792855033061574f, 0.788849498908361f, 0.784810173068109f, 0.780737228572095f,
+ 0.776630839891703f, 0.772491182930959f, 0.768318435018988f, 0.764112774902423f,
+ 0.759874382737746f, 0.755603440083571f, 0.751300129892866f, 0.746964636505118f,
+ 0.742597145638433f, 0.738197844381584f, 0.733766921185995f, 0.729304565857669f,
+ 0.724810969549055f, 0.720286324750863f, 0.715730825283819f, 0.711144666290356f,
+ 0.706528044226263f, 0.701881156852263f, 0.697204203225545f, 0.692497383691237f,
+ 0.687760899873822f, 0.682994954668502f, 0.678199752232508f, 0.673375497976352f,
+ 0.668522398555031f, 0.663640661859171f, 0.658730497006124f, 0.653792114331011f,
+ 0.648825725377709f, 0.643831542889792f, 0.638809780801415f, 0.633760654228152f,
+ 0.628684379457781f, 0.623581173941019f, 0.618451256282204f, 0.613294846229936f,
+ 0.608112164667659f, 0.602903433604202f, 0.597668876164268f, 0.592408716578875f,
+ 0.587123180175754f, 0.581812493369691f, 0.576476883652835f, 0.571116579584947f,
+ 0.565731810783613f, 0.560322807914407f, 0.554889802681009f, 0.549433027815281f,
+ 0.543952717067296f, 0.538449105195327f, 0.532922427955790f, 0.527372922093143f,
+ 0.521800825329746f, 0.516206376355680f, 0.510589814818519f, 0.504951381313066f,
+ 0.499291317371047f, 0.493609865450762f, 0.487907268926702f, 0.482183772079123f,
+ 0.476439620083580f, 0.470675059000427f, 0.464890335764274f, 0.459085698173413f,
+ 0.453261394879198f, 0.447417675375397f, 0.441554789987504f, 0.435672989862017f,
+ 0.429772526955677f, 0.423853654024676f, 0.417916624613831f, 0.411961693045722f,
+ 0.405989114409798f, 0.399999144551449f, 0.393992040061048f, 0.387968058262959f,
+ 0.381927457204511f, 0.375870495644949f, 0.369797433044349f, 0.363708529552499f,
+ 0.357604045997758f, 0.351484243875885f, 0.345349385338836f, 0.339199733183530f,
+ 0.333035550840599f, 0.326857102363098f, 0.320664652415198f, 0.314458466260842f,
+ 0.308238809752391f, 0.302005949319228f, 0.295760151956351f, 0.289501685212929f,
+ 0.283230817180850f, 0.276947816483228f, 0.270652952262902f, 0.264346494170904f,
+ 0.258028712354909f, 0.251699877447663f, 0.245360260555389f, 0.239010133246176f,
+ 0.232649767538342f, 0.226279435888785f, 0.219899411181310f, 0.213509966714943f,
+ 0.207111376192219f, 0.200703913707458f, 0.194287853735029f, 0.187863471117585f,
+ 0.181431041054297f, 0.174990839089060f, 0.168543141098691f, 0.162088223281113f,
+ 0.155626362143520f, 0.149157834490539f, 0.142682917412363f, 0.136201888272891f,
+ 0.129715024697841f, 0.123222604562857f, 0.116724905981611f, 0.110222207293883f,
+ 0.103714787053643f, 0.0972029240171147f, 0.0906868971308382f, 0.0841669855197180f,
+ 0.0776434684750678f, 0.0711166254426455f, 0.0645867360106837f, 0.0580540798979125f,
+ 0.0515189369415777f, 0.0449815870854525f, 0.0384423103678466f, 0.0319013869096108f,
+ 0.0253590969021360f, 0.0188157205953513f, 0.0122715382857199f, 0.00572683030423125f
+};
+
+const float ivas_sin_twiddle_320[IVAS_320_PT_LEN >> 1] =
+{
+ -0.00122718432228885f, -0.0110444371277961f, -0.0208606254474658f, -0.0306748031766366f,
+ -0.0404860244044325f, -0.0502933435049309f, -0.0600958152283046f, -0.0698924947919266f,
+ -0.0796824379714301f, -0.0894647011917154f, -0.0992383416178931f, -0.109002417246156f,
+ -0.118755986994574f, -0.128498110793793f, -0.138227849677645f, -0.147944265873646f,
+ -0.157646422893378f, -0.167333385622756f, -0.177004220412149f, -0.186657995166372f,
+ -0.196293779434521f, -0.205910644499654f, -0.215507663468299f, -0.225083911359793f,
+ -0.234638465195433f, -0.244170404087435f, -0.253678809327687f, -0.263162764476304f,
+ -0.272621355449949f, -0.282053670609936f, -0.291458800850100f, -0.300835839684411f,
+ -0.310183883334351f, -0.319502030816016f, -0.328789384026957f, -0.338045047832741f,
+ -0.347268130153228f, -0.356457742048546f, -0.365612997804774f, -0.374733015019307f,
+ -0.383816914685905f, -0.392863821279410f, -0.401872862840135f, -0.410843171057904f,
+ -0.419773881355741f, -0.428664132973198f, -0.437513069049322f, -0.446319836705237f,
+ -0.455083587126344f, -0.463803475644138f, -0.472478661817616f, -0.481108309514277f,
+ -0.489691586990715f, -0.498227666972782f, -0.506715726735323f, -0.515154948181472f,
+ -0.523544517921500f, -0.531883627351215f, -0.540171472729893f, -0.548407255257747f,
+ -0.556590181152914f, -0.564719461727967f, -0.572794313465923f, -0.580813958095765f,
+ -0.588777622667452f, -0.596684539626417f, -0.604533946887548f, -0.612325087908634f,
+ -0.620057211763289f, -0.627729573213322f, -0.635341432780567f, -0.642892056818157f,
+ -0.650380717581231f, -0.657806693297079f, -0.665169268234704f, -0.672467732773812f,
+ -0.679701383473197f, -0.686869523138552f, -0.693971460889654f, -0.701006512226963f,
+ -0.707973999097587f, -0.714873249960641f, -0.721703599851967f, -0.728464390448225f,
+ -0.735154970130347f, -0.741774694046338f, -0.748322924173428f, -0.754799029379569f,
+ -0.761202385484262f, -0.767532375318718f, -0.773788388785342f, -0.779969822916534f,
+ -0.786076081932809f, -0.792106577300212f, -0.798060727787049f, -0.803937959519903f,
+ -0.809737706038947f, -0.815459408352540f, -0.821102514991105f, -0.826666482060278f,
+ -0.832150773293332f, -0.837554860102865f, -0.842878221631741f, -0.848120344803297f,
+ -0.853280724370791f, -0.858358862966099f, -0.863354271147654f, -0.868266467447619f,
+ -0.873094978418290f, -0.877839338677730f, -0.882499090954623f, -0.887073786132345f,
+ -0.891562983292255f, -0.895966249756185f, -0.900283161128150f, -0.904513301335247f,
+ -0.908656262667757f, -0.912711645818445f, -0.916679059921043f, -0.920558122587921f,
+ -0.924348459946945f, -0.928049706677513f, -0.931661506045761f, -0.935183509938948f,
+ -0.938615378899008f, -0.941956782155269f, -0.945207397656329f, -0.948366912101102f,
+ -0.951435020969008f, -0.954411428549330f, -0.957295847969710f, -0.960088001223801f,
+ -0.962787619198060f, -0.965394441697689f, -0.967908217471710f, -0.970328704237180f,
+ -0.972655668702548f, -0.974888886590136f, -0.977028142657754f, -0.979073230719452f,
+ -0.981023953665385f, -0.982880123480816f, -0.984641561264233f, -0.986308097244599f,
+ -0.987879570797705f, -0.989355830461661f, -0.990736733951487f, -0.992022148172831f,
+ -0.993211949234795f, -0.994306022461875f, -0.995304262405018f, -0.996206572851780f,
+ -0.997012866835602f, -0.997723066644192f, -0.998337103827013f, -0.998854919201885f,
+ -0.999276462860683f, -0.999601694174153f, -0.999830581795823f, -0.999963103665029f
+};
+
+const float ivas_cos_twiddle_320[IVAS_320_PT_LEN >> 1] =
+{
+ 0.999999247009036f, 0.999939008344274f, 0.999782393476671f, 0.999529417501093f,
+ 0.999180104799892f, 0.998734489040553f, 0.998192613172451f, 0.997554529422708f,
+ 0.996820299291166f, 0.995989993544452f, 0.995063692209162f, 0.994041484564148f,
+ 0.992923469131909f, 0.991709753669100f, 0.990400455156143f, 0.988995699785954f,
+ 0.987495622951779f, 0.985900369234146f, 0.984210092386929f, 0.982424955322528f,
+ 0.980545130096168f, 0.978570797889318f, 0.976502148992226f, 0.974339382785576f,
+ 0.972082707721278f, 0.969732341302371f, 0.967288510062064f, 0.964751449541896f,
+ 0.962121404269042f, 0.959398627732738f, 0.956583382359856f, 0.953675939489602f,
+ 0.950676579347373f, 0.947585591017741f, 0.944403272416596f, 0.941129930262426f,
+ 0.937765880046764f, 0.934311446003768f, 0.930766961078984f, 0.927132766897244f,
+ 0.923409213729749f, 0.919596660460302f, 0.915695474550723f, 0.911706032005430f,
+ 0.907628717335198f, 0.903463923520102f, 0.899212051971637f, 0.894873512494035f,
+ 0.890448723244758f, 0.885938110694205f, 0.881342109584601f, 0.876661162888100f,
+ 0.871895721764085f, 0.867046245515693f, 0.862113201545536f, 0.857097065310660f,
+ 0.851998320276715f, 0.846817457871361f, 0.841554977436898f, 0.836211386182145f,
+ 0.830787199133548f, 0.825282939085545f, 0.819699136550175f, 0.814036329705948f,
+ 0.808295064345975f, 0.802475893825360f, 0.796579379007870f, 0.790606088211875f,
+ 0.784556597155575f, 0.778431488901510f, 0.772231353800360f, 0.765956789434051f,
+ 0.759608400558158f, 0.753186799043613f, 0.746692603817734f, 0.740126440804576f,
+ 0.733488942864595f, 0.726780749733659f, 0.720002507961382f, 0.713154870848815f,
+ 0.706238498385475f, 0.699254057185735f, 0.692202220424575f, 0.685083667772700f,
+ 0.677899085331031f, 0.670649165564576f, 0.663334607235692f, 0.655956115336735f,
+ 0.648514401022112f, 0.641010181539737f, 0.633444180161903f, 0.625817126115569f,
+ 0.618129754512079f, 0.610382806276310f, 0.602577028075254f, 0.594713172246063f,
+ 0.586791996723527f, 0.578814264967032f, 0.570780745886967f, 0.562692213770623f,
+ 0.554549448207560f, 0.546353234014470f, 0.538104361159537f, 0.529803624686295f,
+ 0.521451824637002f, 0.513049765975530f, 0.504598258509780f, 0.496098116813633f,
+ 0.487550160148436f, 0.478955212384045f, 0.470314101919413f, 0.461627661602753f,
+ 0.452896728651262f, 0.444122144570429f, 0.435304755072932f, 0.426445409997122f,
+ 0.417544963225117f, 0.408604272600502f, 0.399624199845647f, 0.390605610478656f,
+ 0.381549373729942f, 0.372456362458452f, 0.363327453067539f, 0.354163525420491f,
+ 0.344965462755725f, 0.335734151601668f, 0.326470481691301f, 0.317175345876411f,
+ 0.307849640041535f, 0.298494263017610f, 0.289110116495347f, 0.279698104938318f,
+ 0.270259135495788f, 0.260794117915276f, 0.251303964454877f, 0.241789589795333f,
+ 0.232251910951879f, 0.222691847185850f, 0.213110319916091f, 0.203508252630144f,
+ 0.193886570795236f, 0.184246201769091f, 0.174588074710540f, 0.164913120489970f,
+ 0.155222271599607f, 0.145516462063635f, 0.135796627348180f, 0.126063704271142f,
+ 0.116318630911905f, 0.106562346520921f, 0.0967957914291864f, 0.0870199069576083f,
+ 0.0772356353262796f, 0.0674439195636641f, 0.0576457034157070f, 0.0478419312548745f,
+ 0.0380335479891316f, 0.0282214989708730f, 0.0184067299058048f, 0.00859018676179777f
+};
+
+const float ivas_sin_twiddle_160[IVAS_160_PT_LEN >> 1] =
+{
+ -0.00245436679646029f, -0.0220875270185783f, -0.0417121720785753f, -0.0613207363022086f,
+ -0.0809056602147038f, -0.100459393455076f, -0.119974397686940f, -0.139443149504679f,
+ -0.158858143333861f, -0.178211894324786f, -0.197496941238030f, -0.216705849320900f,
+ -0.235831213173673f, -0.254865659604515f, -0.273801850471989f, -0.292632485514050f,
+ -0.311350305162432f, -0.329948093341349f, -0.348418680249435f, -0.366754945123831f,
+ -0.384949818985382f, -0.402996287363860f, -0.420887393002174f, -0.438616238538528f,
+ -0.456175989165483f, -0.473559875264908f, -0.490761195017794f, -0.507773316987935f,
+ -0.524589682678469f, -0.541203809060310f, -0.557609291071472f, -0.573799804086349f,
+ -0.589769106353971f, -0.605511041404326f, -0.621019540421789f, -0.636288624584773f,
+ -0.651312407370671f, -0.666085096825230f, -0.680600997795453f, -0.694854514125194f,
+ -0.708840150812579f, -0.722552516128436f, -0.735986323694910f, -0.749136394523459f,
+ -0.761997659011457f, -0.774565158896617f, -0.786834049168500f, -0.798799599936358f,
+ -0.810457198252595f, -0.821802349891147f, -0.832830681080094f, -0.843537940187827f,
+ -0.853919999362139f, -0.863972856121587f, -0.873692634898524f, -0.883075588533209f,
+ -0.892118099718401f, -0.900816682393908f, -0.909167983090522f, -0.917168782222852f,
+ -0.924815995330528f, -0.932106674267327f, -0.939038008337734f, -0.945607325380521f,
+ -0.951812092798916f, -0.957649918536965f, -0.963118552001719f, -0.968215884930876f,
+ -0.972939952205560f, -0.977288932607910f, -0.981261149523195f, -0.984855071586178f,
+ -0.988069313271492f, -0.990902635427780f, -0.993353945755417f, -0.995422299227608f,
+ -0.997106898454717f, -0.998407093991674f, -0.999322384588350f, -0.999852417382795f
+};
+
+const float ivas_cos_twiddle_160[IVAS_160_PT_LEN >> 1] =
+{
+ 0.999996988037278f, 0.999756040817060f, 0.999129668611881f, 0.998118112900149f,
+ 0.996721763655847f, 0.994941159198190f, 0.992776985984091f, 0.990230078343521f,
+ 0.987301418157858f, 0.983992134481354f, 0.980303503105861f, 0.976236946068990f,
+ 0.971794031105889f, 0.966976471044852f, 0.961786123146989f, 0.956224988390216f,
+ 0.950295210697844f, 0.943999076112052f, 0.937339011912575f, 0.930317585680942f,
+ 0.922937504310623f, 0.915201612963474f, 0.907112893972869f, 0.898674465693954f,
+ 0.889889581301463f, 0.880761627535558f, 0.871294123396174f, 0.861490718786378f,
+ 0.851355193105265f, 0.840891453790923f, 0.830103534814044f, 0.818995595122750f,
+ 0.807571917039244f, 0.795836904608884f, 0.783795081902349f, 0.771451091271519f,
+ 0.758809691559762f, 0.745875756267305f, 0.732654271672413f, 0.719150334909079f,
+ 0.705369152001986f, 0.691316035859480f, 0.676996404225349f, 0.662415777590172f,
+ 0.647579777063073f, 0.632494122204673f, 0.617164628822086f, 0.601597206726822f,
+ 0.585797857456439f, 0.569772671960834f, 0.553527828254070f, 0.537069589032630f,
+ 0.520404299261031f, 0.503538383725718f, 0.486478344558187f, 0.469230758728290f,
+ 0.451802275508688f, 0.434199613911428f, 0.416429560097637f, 0.398498964761330f,
+ 0.380414740488332f, 0.362183859091351f, 0.343813348922205f, 0.325310292162263f,
+ 0.306681822092128f, 0.287935120341621f, 0.269077414121127f, 0.250115973435366f,
+ 0.231058108280671f, 0.211911165826842f, 0.192682527584672f, 0.173379606560240f,
+ 0.154009844397046f, 0.134580708507126f, 0.115099689192216f, 0.0955742967560992f,
+ 0.0760120586092433f, 0.0564205163668375f, 0.0368072229413588f, 0.0171797396307788f
+};
+
+const float ivas_sin_twiddle_80[IVAS_80_PT_LEN >> 1] =
+{
+ -0.00490871880799799f, -0.0441642771270674f, -0.0833517373318975f, -0.122410675199216f,
+ -0.161280864677880f, -0.199902370753082f, -0.238215641861795f, -0.276161601716971f,
+ -0.313681740398891f, -0.350718204573223f, -0.387213886696666f, -0.423112513072644f,
+ -0.458358730621271f, -0.492898192229784f, -0.526677640551852f, -0.559644990126546f,
+ -0.591749407690343f, -0.622941390558334f, -0.653172842953777f, -0.682397150168297f,
+ -0.710569250438390f, -0.737645704427393f, -0.763584762205797f, -0.788346427626606f,
+ -0.811892519996505f, -0.834186732947712f, -0.855194690419775f, -0.874883999664958f,
+ -0.893224301195515f, -0.910187315595818f, -0.925746887127164f, -0.939879024058033f,
+ -0.952561935657595f, -0.963776065795440f, -0.973504123095711f, -0.981731107599154f,
+ -0.988444333891970f, -0.993633450665799f, -0.997290456678690f, -0.999409713092437f
+};
+
+const float ivas_cos_twiddle_80[IVAS_80_PT_LEN >> 1] =
+{
+ 0.999987952167257f, 0.999024282300407f, 0.996520189400975f, 0.992479534598710f,
+ 0.986908548290446f, 0.979815820533276f, 0.971212287799312f, 0.961111216112432f,
+ 0.949528180593037f, 0.936481041442343f, 0.921989916403245f, 0.906077149740215f,
+ 0.888767277786068f, 0.870086991108712f, 0.850065093356229f, 0.828732456843738f,
+ 0.806121974950521f, 0.782268511400816f, 0.757208846506485f, 0.730981620454432f,
+ 0.703627273726243f, 0.675187984741891f, 0.645707604823667f, 0.615231590580627f,
+ 0.583806933817786f, 0.551482089078169f, 0.518306898929413f, 0.484332517110141f,
+ 0.449611329654607f, 0.414196874117224f, 0.378143757021541f, 0.341507569660936f,
+ 0.304344802380877f, 0.266712757474898f, 0.228669460828619f, 0.190273572448036f,
+ 0.151584296010041f, 0.112661287574648f, 0.0735645635996675f, 0.0343544083996823f
+};
+
+const int16_t dirac_gains_P_idx[16] =
+{
+ -1, 1, 0, 1, 4, 3, 2, 3, 4, 8, 7, 6, 5, 6, 7, 8
+};
+
+const float dirac_gains_norm_term[9] =
+{
+ 1.000000e+00f, 7.071068e-01f, 1.000000e+00f, 4.082483e-01f, 2.041242e-01f, 1.000000e+00f, 2.886751e-01f, 9.128709e-02f, 3.726780e-02f
+};
+
+const float dirac_gains_Pnm[91][9] =
+{
+ {-1.000000e+00f,-0.000000e+00f,1.000000e+00f,-0.000000e+00f,0.000000e+00f,-1.000000e+00f,-0.000000e+00f,0.000000e+00f,-0.000000e+00f},
+ {-9.998477e-01f,1.745221e-02f,9.995431e-01f,-5.234867e-02f,9.137391e-04f,-9.990864e-01f,1.046734e-01f,-4.568000e-03f,7.973384e-05f},
+ {-9.993909e-01f,3.489930e-02f,9.981732e-01f,-1.046341e-01f,3.653884e-03f,-9.963478e-01f,2.090770e-01f,-1.825829e-02f,6.375900e-04f},
+ {-9.986295e-01f,5.233614e-02f,9.958913e-01f,-1.567932e-01f,8.217215e-03f,-9.917910e-01f,3.129416e-01f,-4.102976e-02f,2.150287e-03f},
+ {-9.975641e-01f,6.975590e-02f,9.927012e-01f,-2.087579e-01f,1.459766e-02f,-9.854290e-01f,4.159897e-01f,-7.281048e-02f,5.091363e-03f},
+ {-9.961947e-01f,8.715547e-02f,9.886059e-01f,-2.604715e-01f,2.278823e-02f,-9.772766e-01f,5.179674e-01f,-1.135075e-01f,9.930593e-03f},
+ {-9.945220e-01f,1.045284e-01f,9.836106e-01f,-3.118673e-01f,3.277856e-02f,-9.673560e-01f,6.186047e-01f,-1.629950e-01f,1.713145e-02f},
+ {-9.925461e-01f,1.218695e-01f,9.777218e-01f,-3.628832e-01f,4.455650e-02f,-9.556924e-01f,7.176415e-01f,-2.211219e-01f,2.715038e-02f},
+ {-9.902681e-01f,1.391732e-01f,9.709461e-01f,-4.134564e-01f,5.810756e-02f,-9.423163e-01f,8.148217e-01f,-2.877103e-01f,4.043508e-02f},
+ {-9.876884e-01f,1.564343e-01f,9.632925e-01f,-4.635251e-01f,7.341509e-02f,-9.272624e-01f,9.098945e-01f,-3.625562e-01f,5.742321e-02f},
+ {-9.848077e-01f,1.736484e-01f,9.547693e-01f,-5.130307e-01f,9.046126e-02f,-9.105685e-01f,1.002619e+00f,-4.454347e-01f,7.854224e-02f},
+ {-9.816272e-01f,1.908091e-01f,9.453878e-01f,-5.619103e-01f,1.092244e-01f,-8.922793e-01f,1.092752e+00f,-5.360881e-01f,1.042050e-01f},
+ {-9.781475e-01f,2.079115e-01f,9.351591e-01f,-6.101044e-01f,1.296816e-01f,-8.724410e-01f,1.180063e+00f,-6.342387e-01f,1.348115e-01f},
+ {-9.743701e-01f,2.249510e-01f,9.240957e-01f,-6.575567e-01f,1.518089e-01f,-8.511051e-01f,1.264332e+00f,-7.395903e-01f,1.707479e-01f},
+ {-9.702957e-01f,2.419219e-01f,9.122107e-01f,-7.042075e-01f,1.755787e-01f,-8.283265e-01f,1.345341e+00f,-8.518162e-01f,2.123816e-01f},
+ {-9.659258e-01f,2.588191e-01f,8.995191e-01f,-7.500002e-01f,2.009620e-01f,-8.041639e-01f,1.422883e+00f,-9.705719e-01f,2.600640e-01f},
+ {-9.612616e-01f,2.756374e-01f,8.860360e-01f,-7.948789e-01f,2.279279e-01f,-7.786796e-01f,1.496760e+00f,-1.095492e+00f,3.141272e-01f},
+ {-9.563048e-01f,2.923716e-01f,8.717782e-01f,-8.387891e-01f,2.564435e-01f,-7.519395e-01f,1.566788e+00f,-1.226191e+00f,3.748840e-01f},
+ {-9.510565e-01f,3.090171e-01f,8.567626e-01f,-8.816782e-01f,2.864747e-01f,-7.240118e-01f,1.632789e+00f,-1.362268e+00f,4.426280e-01f},
+ {-9.455186e-01f,3.255681e-01f,8.410082e-01f,-9.234920e-01f,3.179837e-01f,-6.949692e-01f,1.694595e+00f,-1.503298e+00f,5.176268e-01f},
+ {-9.396926e-01f,3.420202e-01f,8.245332e-01f,-9.641815e-01f,3.509334e-01f,-6.648846e-01f,1.752055e+00f,-1.648848e+00f,6.001316e-01f},
+ {-9.335804e-01f,3.583678e-01f,8.073587e-01f,-1.003696e+00f,3.852825e-01f,-6.338369e-01f,1.805025e+00f,-1.798461e+00f,6.903643e-01f},
+ {-9.271840e-01f,3.746064e-01f,7.895051e-01f,-1.041987e+00f,4.209899e-01f,-6.019047e-01f,1.853375e+00f,-1.951675e+00f,7.885275e-01f},
+ {-9.205049e-01f,3.907311e-01f,7.709939e-01f,-1.079010e+00f,4.580124e-01f,-5.691693e-01f,1.896987e+00f,-2.108013e+00f,8.947984e-01f},
+ {-9.135456e-01f,4.067366e-01f,7.518480e-01f,-1.114717e+00f,4.963039e-01f,-5.357154e-01f,1.935757e+00f,-2.266981e+00f,1.009325e+00f},
+ {-9.063079e-01f,4.226184e-01f,7.320906e-01f,-1.149067e+00f,5.358188e-01f,-5.016273e-01f,1.969593e+00f,-2.428084e+00f,1.132234e+00f},
+ {-8.987941e-01f,4.383712e-01f,7.117461e-01f,-1.182016e+00f,5.765077e-01f,-4.669925e-01f,1.998415e+00f,-2.590808e+00f,1.263622e+00f},
+ {-8.910065e-01f,4.539906e-01f,6.908387e-01f,-1.213526e+00f,6.183225e-01f,-4.318987e-01f,2.022162e+00f,-2.754647e+00f,1.403563e+00f},
+ {-8.829476e-01f,4.694716e-01f,6.693946e-01f,-1.243556e+00f,6.612108e-01f,-3.964354e-01f,2.040781e+00f,-2.919073e+00f,1.552099e+00f},
+ {-8.746198e-01f,4.848095e-01f,6.474397e-01f,-1.272072e+00f,7.051207e-01f,-3.606927e-01f,2.054234e+00f,-3.083563e+00f,1.709246e+00f},
+ {-8.660253e-01f,5.000000e-01f,6.250001e-01f,-1.299038e+00f,7.500000e-01f,-3.247595e-01f,2.062500e+00f,-3.247595e+00f,1.875000e+00f},
+ {-8.571672e-01f,5.150381e-01f,6.021037e-01f,-1.324421e+00f,7.957926e-01f,-2.887278e-01f,2.065570e+00f,-3.410637e+00f,2.049318e+00f},
+ {-8.480480e-01f,5.299194e-01f,5.787782e-01f,-1.348191e+00f,8.424437e-01f,-2.526874e-01f,2.063448e+00f,-3.572164e+00f,2.232136e+00f},
+ {-8.386706e-01f,5.446391e-01f,5.550525e-01f,-1.370318e+00f,8.898951e-01f,-2.167299e-01f,2.056155e+00f,-3.731644e+00f,2.423358e+00f},
+ {-8.290377e-01f,5.591928e-01f,5.309552e-01f,-1.390776e+00f,9.380897e-01f,-1.809446e-01f,2.043725e+00f,-3.888559e+00f,2.622865e+00f},
+ {-8.191521e-01f,5.735765e-01f,5.065152e-01f,-1.409539e+00f,9.869699e-01f,-1.454202e-01f,2.026202e+00f,-4.042392e+00f,2.830513e+00f},
+ {-8.090171e-01f,5.877852e-01f,4.817629e-01f,-1.426585e+00f,1.036474e+00f,-1.102460e-01f,2.003651e+00f,-4.192627e+00f,3.046121e+00f},
+ {-7.986355e-01f,6.018150e-01f,4.567280e-01f,-1.441893e+00f,1.086544e+00f,-7.550830e-02f,1.976144e+00f,-4.338763e+00f,3.269493e+00f},
+ {-7.880108e-01f,6.156614e-01f,4.314414e-01f,-1.455444e+00f,1.137117e+00f,-4.129366e-02f,1.943771e+00f,-4.480302e+00f,3.500396e+00f},
+ {-7.771459e-01f,6.293205e-01f,4.059335e-01f,-1.467221e+00f,1.188133e+00f,-7.685401e-03f,1.906632e+00f,-4.616763e+00f,3.738582e+00f},
+ {-7.660444e-01f,6.427876e-01f,3.802360e-01f,-1.477211e+00f,1.239528e+00f,2.523343e-02f,1.864843e+00f,-4.747667e+00f,3.983766e+00f},
+ {-7.547096e-01f,6.560589e-01f,3.543800e-01f,-1.485402e+00f,1.291240e+00f,5.738307e-02f,1.818529e+00f,-4.872555e+00f,4.235647e+00f},
+ {-7.431449e-01f,6.691306e-01f,3.283964e-01f,-1.491783e+00f,1.343207e+00f,8.868646e-02f,1.767831e+00f,-4.990988e+00f,4.493906e+00f},
+ {-7.313538e-01f,6.819984e-01f,3.023174e-01f,-1.496346e+00f,1.395365e+00f,1.190676e-01f,1.712898e+00f,-5.102528e+00f,4.758184e+00f},
+ {-7.193397e-01f,6.946585e-01f,2.761744e-01f,-1.499086e+00f,1.447651e+00f,1.484544e-01f,1.653893e+00f,-5.206765e+00f,5.028115e+00f},
+ {-7.071068e-01f,7.071068e-01f,2.500000e-01f,-1.500000e+00f,1.500000e+00f,1.767767e-01f,1.590990e+00f,-5.303301e+00f,5.303301e+00f},
+ {-6.946585e-01f,7.193397e-01f,2.238256e-01f,-1.499086e+00f,1.552349e+00f,2.039685e-01f,1.524373e+00f,-5.391762e+00f,5.583331e+00f},
+ {-6.819984e-01f,7.313538e-01f,1.976825e-01f,-1.496346e+00f,1.604635e+00f,2.299670e-01f,1.454233e+00f,-5.471792e+00f,5.867779e+00f},
+ {-6.691307e-01f,7.431448e-01f,1.716038e-01f,-1.491783e+00f,1.656792e+00f,2.547115e-01f,1.380777e+00f,-5.543053e+00f,6.156183e+00f},
+ {-6.560589e-01f,7.547096e-01f,1.456200e-01f,-1.485402e+00f,1.708760e+00f,2.781472e-01f,1.304214e+00f,-5.605237e+00f,6.448089e+00f},
+ {-6.427876e-01f,7.660444e-01f,1.197639e-01f,-1.477212e+00f,1.760472e+00f,3.002205e-01f,1.224767e+00f,-5.658049e+00f,6.743000e+00f},
+ {-6.293203e-01f,7.771461e-01f,9.406608e-02f,-1.467221e+00f,1.811868e+00f,3.208840e-01f,1.142662e+00f,-5.701226e+00f,7.040430e+00f},
+ {-6.156614e-01f,7.880108e-01f,6.855855e-02f,-1.455444e+00f,1.862883e+00f,3.400929e-01f,1.058135e+00f,-5.734527e+00f,7.339859e+00f},
+ {-6.018151e-01f,7.986354e-01f,4.327216e-02f,-1.441893e+00f,1.913455e+00f,3.578070e-01f,9.714287e-01f,-5.757732e+00f,7.640767e+00f},
+ {-5.877852e-01f,8.090171e-01f,1.823708e-02f,-1.426585e+00f,1.963526e+00f,3.739910e-01f,8.827875e-01f,-5.770657e+00f,7.942629e+00f},
+ {-5.735764e-01f,8.191520e-01f,-6.515074e-03f,-1.409539e+00f,2.013030e+00f,3.886124e-01f,7.924678e-01f,-5.773133e+00f,8.244888e+00f},
+ {-5.591928e-01f,8.290376e-01f,-3.095508e-02f,-1.390776e+00f,2.061910e+00f,4.016449e-01f,7.007229e-01f,-5.765026e+00f,8.547005e+00f},
+ {-5.446391e-01f,8.386706e-01f,-5.505246e-02f,-1.370318e+00f,2.110105e+00f,4.130656e-01f,6.078163e-01f,-5.746228e+00f,8.848414e+00f},
+ {-5.299193e-01f,8.480480e-01f,-7.877823e-02f,-1.348191e+00f,2.157557e+00f,4.228564e-01f,5.140093e-01f,-5.716654e+00f,9.148557e+00f},
+ {-5.150380e-01f,8.571674e-01f,-1.021038e-01f,-1.324421e+00f,2.204208e+00f,4.310043e-01f,4.195672e-01f,-5.676254e+00f,9.446875e+00f},
+ {-5.000001e-01f,8.660253e-01f,-1.249999e-01f,-1.299038e+00f,2.250000e+00f,4.375000e-01f,3.247599e-01f,-5.625000e+00f,9.742785e+00f},
+ {-4.848095e-01f,8.746197e-01f,-1.474395e-01f,-1.272072e+00f,2.294879e+00f,4.423398e-01f,2.298521e-01f,-5.562896e+00f,1.003573e+01f},
+ {-4.694715e-01f,8.829476e-01f,-1.693947e-01f,-1.243556e+00f,2.338789e+00f,4.455244e-01f,1.351145e-01f,-5.489975e+00f,1.032514e+01f},
+ {-4.539906e-01f,8.910065e-01f,-1.908388e-01f,-1.213526e+00f,2.381678e+00f,4.470587e-01f,4.081347e-02f,-5.406296e+00f,1.061045e+01f},
+ {-4.383711e-01f,8.987940e-01f,-2.117461e-01f,-1.182016e+00f,2.423492e+00f,4.469530e-01f,-5.278682e-02f,-5.311945e+00f,1.089110e+01f},
+ {-4.226183e-01f,9.063078e-01f,-2.320906e-01f,-1.149067e+00f,2.464181e+00f,4.452218e-01f,-1.454199e-01f,-5.207041e+00f,1.116653e+01f},
+ {-4.067367e-01f,9.135454e-01f,-2.518479e-01f,-1.114717e+00f,2.503696e+00f,4.418841e-01f,-2.368270e-01f,-5.091725e+00f,1.143620e+01f},
+ {-3.907311e-01f,9.205048e-01f,-2.709937e-01f,-1.079010e+00f,2.541987e+00f,4.369636e-01f,-3.267503e-01f,-4.966168e+00f,1.169956e+01f},
+ {-3.746066e-01f,9.271839e-01f,-2.895049e-01f,-1.041988e+00f,2.579010e+00f,4.304885e-01f,-4.149371e-01f,-4.830570e+00f,1.195608e+01f},
+ {-3.583679e-01f,9.335804e-01f,-3.073587e-01f,-1.003696e+00f,2.614717e+00f,4.224911e-01f,-5.011396e-01f,-4.685155e+00f,1.220525e+01f},
+ {-3.420201e-01f,9.396927e-01f,-3.245333e-01f,-9.641814e-01f,2.649067e+00f,4.130083e-01f,-5.851153e-01f,-4.530170e+00f,1.244654e+01f},
+ {-3.255681e-01f,9.455186e-01f,-3.410081e-01f,-9.234920e-01f,2.682016e+00f,4.020810e-01f,-6.666291e-01f,-4.365895e+00f,1.267948e+01f},
+ {-3.090170e-01f,9.510564e-01f,-3.567626e-01f,-8.816779e-01f,2.713525e+00f,3.897543e-01f,-7.454509e-01f,-4.192628e+00f,1.290358e+01f},
+ {-2.923717e-01f,9.563047e-01f,-3.717781e-01f,-8.387894e-01f,2.743556e+00f,3.760769e-01f,-8.213612e-01f,-4.010692e+00f,1.311838e+01f},
+ {-2.756374e-01f,9.612617e-01f,-3.860361e-01f,-7.948790e-01f,2.772072e+00f,3.611015e-01f,-8.941467e-01f,-3.820433e+00f,1.332343e+01f},
+ {-2.588190e-01f,9.659258e-01f,-3.995190e-01f,-7.499999e-01f,2.799038e+00f,3.448846e-01f,-9.636030e-01f,-3.622222e+00f,1.351832e+01f},
+ {-2.419219e-01f,9.702957e-01f,-4.122107e-01f,-7.042072e-01f,2.824421e+00f,3.274858e-01f,-1.029536e+00f,-3.416446e+00f,1.370262e+01f},
+ {-2.249510e-01f,9.743701e-01f,-4.240956e-01f,-6.575566e-01f,2.848191e+00f,3.089685e-01f,-1.091760e+00f,-3.203517e+00f,1.387596e+01f},
+ {-2.079118e-01f,9.781476e-01f,-4.351591e-01f,-6.101051e-01f,2.870318e+00f,2.893990e-01f,-1.150101e+00f,-2.983865e+00f,1.403797e+01f},
+ {-1.908090e-01f,9.816272e-01f,-4.453879e-01f,-5.619099e-01f,2.890776e+00f,2.688461e-01f,-1.204397e+00f,-2.757931e+00f,1.418832e+01f},
+ {-1.736482e-01f,9.848077e-01f,-4.547695e-01f,-5.130303e-01f,2.909539e+00f,2.473820e-01f,-1.254495e+00f,-2.526181e+00f,1.432668e+01f},
+ {-1.564344e-01f,9.876883e-01f,-4.632923e-01f,-4.635254e-01f,2.926584e+00f,2.250811e-01f,-1.300254e+00f,-2.289093e+00f,1.445277e+01f},
+ {-1.391731e-01f,9.902681e-01f,-4.709463e-01f,-4.134560e-01f,2.941893e+00f,2.020205e-01f,-1.341547e+00f,-2.047161e+00f,1.456631e+01f},
+ {-1.218693e-01f,9.925461e-01f,-4.777218e-01f,-3.628827e-01f,2.955444e+00f,1.782789e-01f,-1.378258e+00f,-1.800889e+00f,1.466707e+01f},
+ {-1.045285e-01f,9.945219e-01f,-4.836107e-01f,-3.118677e-01f,2.967221e+00f,1.539375e-01f,-1.410285e+00f,-1.550796e+00f,1.475483e+01f},
+ {-8.715577e-02f,9.961947e-01f,-4.886058e-01f,-2.604724e-01f,2.977212e+00f,1.290786e-01f,-1.437538e+00f,-1.297406e+00f,1.482941e+01f},
+ {-6.975648e-02f,9.975641e-01f,-4.927011e-01f,-2.087597e-01f,2.985402e+00f,1.037861e-01f,-1.459940e+00f,-1.041256e+00f,1.489065e+01f},
+ {-5.233594e-02f,9.986295e-01f,-4.958915e-01f,-1.567926e-01f,2.991783e+00f,7.814553e-02f,-1.477429e+00f,-7.828888e-01f,1.493841e+01f},
+ {-3.489946e-02f,9.993909e-01f,-4.981730e-01f,-1.046346e-01f,2.996346e+00f,5.224292e-02f,-1.489957e+00f,-5.228543e-01f,1.497260e+01f},
+ {-1.745235e-02f,9.998478e-01f,-4.995431e-01f,-5.234908e-02f,2.999086e+00f,2.616524e-02f,-1.497488e+00f,-2.617055e-01f,1.499315e+01f},
+ {-4.371139e-08f,1.000000e+00f,-5.000000e-01f,-1.311342e-07f,3.000000e+00f,6.556709e-08f,-1.500000e+00f,-6.556709e-07f,1.500000e+01f}
+};
+
+const float dirac_gains_trg_term[181][2] =
+{
+ {-1.000000e+00f,8.742278e-08f},
+ {-9.998477e-01f,-1.745246e-02f},
+ {-9.993908e-01f,-3.489945e-02f},
+ {-9.986295e-01f,-5.233605e-02f},
+ {-9.975641e-01f,-6.975647e-02f},
+ {-9.961947e-01f,-8.715564e-02f},
+ {-9.945219e-01f,-1.045285e-01f},
+ {-9.925461e-01f,-1.218693e-01f},
+ {-9.902681e-01f,-1.391732e-01f},
+ {-9.876884e-01f,-1.564344e-01f},
+ {-9.848077e-01f,-1.736483e-01f},
+ {-9.816272e-01f,-1.908090e-01f},
+ {-9.781476e-01f,-2.079116e-01f},
+ {-9.743701e-01f,-2.249511e-01f},
+ {-9.702957e-01f,-2.419219e-01f},
+ {-9.659258e-01f,-2.588191e-01f},
+ {-9.612617e-01f,-2.756374e-01f},
+ {-9.563048e-01f,-2.923716e-01f},
+ {-9.510565e-01f,-3.090170e-01f},
+ {-9.455186e-01f,-3.255681e-01f},
+ {-9.396926e-01f,-3.420202e-01f},
+ {-9.335805e-01f,-3.583679e-01f},
+ {-9.271839e-01f,-3.746065e-01f},
+ {-9.205049e-01f,-3.907312e-01f},
+ {-9.135455e-01f,-4.067366e-01f},
+ {-9.063078e-01f,-4.226183e-01f},
+ {-8.987941e-01f,-4.383711e-01f},
+ {-8.910065e-01f,-4.539906e-01f},
+ {-8.829476e-01f,-4.694716e-01f},
+ {-8.746198e-01f,-4.848095e-01f},
+ {-8.660254e-01f,-5.000001e-01f},
+ {-8.571673e-01f,-5.150380e-01f},
+ {-8.480480e-01f,-5.299193e-01f},
+ {-8.386706e-01f,-5.446390e-01f},
+ {-8.290377e-01f,-5.591928e-01f},
+ {-8.191521e-01f,-5.735765e-01f},
+ {-8.090171e-01f,-5.877852e-01f},
+ {-7.986355e-01f,-6.018151e-01f},
+ {-7.880108e-01f,-6.156614e-01f},
+ {-7.771459e-01f,-6.293205e-01f},
+ {-7.660444e-01f,-6.427876e-01f},
+ {-7.547097e-01f,-6.560590e-01f},
+ {-7.431448e-01f,-6.691306e-01f},
+ {-7.313537e-01f,-6.819983e-01f},
+ {-7.193397e-01f,-6.946585e-01f},
+ {-7.071068e-01f,-7.071068e-01f},
+ {-6.946585e-01f,-7.193397e-01f},
+ {-6.819983e-01f,-7.313537e-01f},
+ {-6.691307e-01f,-7.431448e-01f},
+ {-6.560590e-01f,-7.547097e-01f},
+ {-6.427876e-01f,-7.660444e-01f},
+ {-6.293203e-01f,-7.771460e-01f},
+ {-6.156614e-01f,-7.880108e-01f},
+ {-6.018151e-01f,-7.986355e-01f},
+ {-5.877852e-01f,-8.090170e-01f},
+ {-5.735765e-01f,-8.191520e-01f},
+ {-5.591928e-01f,-8.290376e-01f},
+ {-5.446391e-01f,-8.386706e-01f},
+ {-5.299193e-01f,-8.480480e-01f},
+ {-5.150380e-01f,-8.571673e-01f},
+ {-5.000001e-01f,-8.660254e-01f},
+ {-4.848095e-01f,-8.746197e-01f},
+ {-4.694716e-01f,-8.829476e-01f},
+ {-4.539906e-01f,-8.910065e-01f},
+ {-4.383711e-01f,-8.987941e-01f},
+ {-4.226183e-01f,-9.063078e-01f},
+ {-4.067367e-01f,-9.135454e-01f},
+ {-3.907312e-01f,-9.205049e-01f},
+ {-3.746066e-01f,-9.271839e-01f},
+ {-3.583679e-01f,-9.335805e-01f},
+ {-3.420201e-01f,-9.396926e-01f},
+ {-3.255681e-01f,-9.455186e-01f},
+ {-3.090170e-01f,-9.510565e-01f},
+ {-2.923717e-01f,-9.563047e-01f},
+ {-2.756374e-01f,-9.612617e-01f},
+ {-2.588190e-01f,-9.659258e-01f},
+ {-2.419219e-01f,-9.702957e-01f},
+ {-2.249510e-01f,-9.743701e-01f},
+ {-2.079117e-01f,-9.781476e-01f},
+ {-1.908090e-01f,-9.816272e-01f},
+ {-1.736482e-01f,-9.848077e-01f},
+ {-1.564344e-01f,-9.876884e-01f},
+ {-1.391731e-01f,-9.902681e-01f},
+ {-1.218693e-01f,-9.925461e-01f},
+ {-1.045285e-01f,-9.945219e-01f},
+ {-8.715577e-02f,-9.961947e-01f},
+ {-6.975648e-02f,-9.975641e-01f},
+ {-5.233594e-02f,-9.986295e-01f},
+ {-3.489946e-02f,-9.993908e-01f},
+ {-1.745235e-02f,-9.998477e-01f},
+ {-4.371139e-08f,-1.000000e+00f},
+ {1.745238e-02f,-9.998477e-01f},
+ {3.489950e-02f,-9.993908e-01f},
+ {5.233597e-02f,-9.986295e-01f},
+ {6.975651e-02f,-9.975641e-01f},
+ {8.715580e-02f,-9.961947e-01f},
+ {1.045284e-01f,-9.945219e-01f},
+ {1.218693e-01f,-9.925461e-01f},
+ {1.391731e-01f,-9.902681e-01f},
+ {1.564345e-01f,-9.876884e-01f},
+ {1.736482e-01f,-9.848077e-01f},
+ {1.908089e-01f,-9.816272e-01f},
+ {2.079117e-01f,-9.781476e-01f},
+ {2.249510e-01f,-9.743701e-01f},
+ {2.419219e-01f,-9.702957e-01f},
+ {2.588191e-01f,-9.659258e-01f},
+ {2.756374e-01f,-9.612617e-01f},
+ {2.923717e-01f,-9.563048e-01f},
+ {3.090170e-01f,-9.510565e-01f},
+ {3.255681e-01f,-9.455186e-01f},
+ {3.420202e-01f,-9.396926e-01f},
+ {3.583680e-01f,-9.335804e-01f},
+ {3.746066e-01f,-9.271839e-01f},
+ {3.907311e-01f,-9.205049e-01f},
+ {4.067366e-01f,-9.135455e-01f},
+ {4.226182e-01f,-9.063078e-01f},
+ {4.383712e-01f,-8.987941e-01f},
+ {4.539905e-01f,-8.910065e-01f},
+ {4.694716e-01f,-8.829476e-01f},
+ {4.848096e-01f,-8.746197e-01f},
+ {5.000000e-01f,-8.660254e-01f},
+ {5.150381e-01f,-8.571673e-01f},
+ {5.299193e-01f,-8.480481e-01f},
+ {5.446390e-01f,-8.386706e-01f},
+ {5.591929e-01f,-8.290375e-01f},
+ {5.735765e-01f,-8.191521e-01f},
+ {5.877852e-01f,-8.090170e-01f},
+ {6.018150e-01f,-7.986355e-01f},
+ {6.156615e-01f,-7.880107e-01f},
+ {6.293204e-01f,-7.771460e-01f},
+ {6.427876e-01f,-7.660444e-01f},
+ {6.560590e-01f,-7.547095e-01f},
+ {6.691306e-01f,-7.431449e-01f},
+ {6.819984e-01f,-7.313537e-01f},
+ {6.946584e-01f,-7.193398e-01f},
+ {7.071068e-01f,-7.071068e-01f},
+ {7.193398e-01f,-6.946584e-01f},
+ {7.313537e-01f,-6.819983e-01f},
+ {7.431448e-01f,-6.691306e-01f},
+ {7.547096e-01f,-6.560590e-01f},
+ {7.660444e-01f,-6.427876e-01f},
+ {7.771460e-01f,-6.293204e-01f},
+ {7.880108e-01f,-6.156615e-01f},
+ {7.986355e-01f,-6.018150e-01f},
+ {8.090170e-01f,-5.877852e-01f},
+ {8.191521e-01f,-5.735765e-01f},
+ {8.290376e-01f,-5.591929e-01f},
+ {8.386706e-01f,-5.446391e-01f},
+ {8.480481e-01f,-5.299193e-01f},
+ {8.571673e-01f,-5.150381e-01f},
+ {8.660254e-01f,-5.000000e-01f},
+ {8.746197e-01f,-4.848096e-01f},
+ {8.829476e-01f,-4.694716e-01f},
+ {8.910065e-01f,-4.539905e-01f},
+ {8.987941e-01f,-4.383712e-01f},
+ {9.063078e-01f,-4.226183e-01f},
+ {9.135454e-01f,-4.067366e-01f},
+ {9.205049e-01f,-3.907311e-01f},
+ {9.271839e-01f,-3.746066e-01f},
+ {9.335804e-01f,-3.583679e-01f},
+ {9.396926e-01f,-3.420201e-01f},
+ {9.455186e-01f,-3.255681e-01f},
+ {9.510565e-01f,-3.090170e-01f},
+ {9.563048e-01f,-2.923717e-01f},
+ {9.612617e-01f,-2.756374e-01f},
+ {9.659258e-01f,-2.588190e-01f},
+ {9.702957e-01f,-2.419219e-01f},
+ {9.743701e-01f,-2.249510e-01f},
+ {9.781476e-01f,-2.079117e-01f},
+ {9.816272e-01f,-1.908090e-01f},
+ {9.848077e-01f,-1.736482e-01f},
+ {9.876884e-01f,-1.564345e-01f},
+ {9.902681e-01f,-1.391731e-01f},
+ {9.925461e-01f,-1.218693e-01f},
+ {9.945219e-01f,-1.045285e-01f},
+ {9.961947e-01f,-8.715574e-02f},
+ {9.975641e-01f,-6.975647e-02f},
+ {9.986295e-01f,-5.233596e-02f},
+ {9.993908e-01f,-3.489950e-02f},
+ {9.998477e-01f,-1.745241e-02f},
+ {1.000000e+00f,0.000000e+00f}
+};
+
+/*----------------------------------------------------------------------------------*
+ * FB ROM tables
+ *----------------------------------------------------------------------------------*/
+
+const float ivas_fb_cf_4ms_48k[IVAS_FB_4MS_48K_SAMP] =
+{
+ 0.0000167330f, 0.0001505907f, 0.0004182700f, 0.0008196995f, 0.0013547717f, 0.0020233432f, 0.0028252351f, 0.0037602327f,
+ 0.0048280857f, 0.0060285082f, 0.0073611788f, 0.0088257407f, 0.0104218019f, 0.0121489350f, 0.0140066776f, 0.0159945324f,
+ 0.0181119671f, 0.0203584149f, 0.0227332744f, 0.0252359097f, 0.0278656508f, 0.0306217938f, 0.0335036006f, 0.0365102998f,
+ 0.0396410864f, 0.0428951221f, 0.0462715360f, 0.0497694239f, 0.0533878494f, 0.0571258438f, 0.0609824063f, 0.0649565044f,
+ 0.0690470742f, 0.0732530206f, 0.0775732174f, 0.0820065080f, 0.0865517057f, 0.0912075934f, 0.0959729248f, 0.1008464240f,
+ 0.1058267862f, 0.1109126781f, 0.1161027381f, 0.1213955767f, 0.1267897769f, 0.1322838945f, 0.1378764585f, 0.1435659718f,
+ 0.1493509111f, 0.1552297276f, 0.1612008475f, 0.1672626721f, 0.1734135785f, 0.1796519200f, 0.1859760265f, 0.1923842047f,
+ 0.1988747391f, 0.2054458921f, 0.2120959043f, 0.2188229954f, 0.2256253644f, 0.2325011901f, 0.2394486317f, 0.2464658292f,
+ 0.2535509039f, 0.2607019590f, 0.2679170800f, 0.2751943352f, 0.2825317763f, 0.2899274389f, 0.2973793430f, 0.3048854936f,
+ 0.3124438810f, 0.3200524817f, 0.3277092588f, 0.3354121622f, 0.3431591298f, 0.3509480875f, 0.3587769500f, 0.3666436213f,
+ 0.3745459953f, 0.3824819564f, 0.3904493799f, 0.3984461328f, 0.4064700741f, 0.4145190556f, 0.4225909225f, 0.4306835136f,
+ 0.4387946624f, 0.4469221974f, 0.4550639426f, 0.4632177182f, 0.4713813414f, 0.4795526264f, 0.4877293857f, 0.4959094302f,
+ 0.5040905698f, 0.5122706143f, 0.5204473736f, 0.5286186586f, 0.5367822818f, 0.5449360574f, 0.5530778026f, 0.5612053376f,
+ 0.5693164864f, 0.5774090775f, 0.5854809444f, 0.5935299259f, 0.6015538672f, 0.6095506201f, 0.6175180436f, 0.6254540047f,
+ 0.6333563787f, 0.6412230500f, 0.6490519125f, 0.6568408702f, 0.6645878378f, 0.6722907412f, 0.6799475183f, 0.6875561190f,
+ 0.6951145064f, 0.7026206570f, 0.7100725611f, 0.7174682237f, 0.7248056648f, 0.7320829200f, 0.7392980410f, 0.7464490961f,
+ 0.7535341708f, 0.7605513683f, 0.7674988099f, 0.7743746356f, 0.7811770046f, 0.7879040957f, 0.7945541079f, 0.8011252609f,
+ 0.8076157953f, 0.8140239735f, 0.8203480800f, 0.8265864215f, 0.8327373279f, 0.8387991525f, 0.8447702724f, 0.8506490889f,
+ 0.8564340282f, 0.8621235415f, 0.8677161055f, 0.8732102231f, 0.8786044233f, 0.8838972619f, 0.8890873219f, 0.8941732138f,
+ 0.8991535760f, 0.9040270752f, 0.9087924066f, 0.9134482943f, 0.9179934920f, 0.9224267826f, 0.9267469794f, 0.9309529258f,
+ 0.9350434956f, 0.9390175937f, 0.9428741562f, 0.9466121506f, 0.9502305761f, 0.9537284640f, 0.9571048779f, 0.9603589136f,
+ 0.9634897002f, 0.9664963994f, 0.9693782062f, 0.9721343492f, 0.9747640903f, 0.9772667256f, 0.9796415851f, 0.9818880329f,
+ 0.9840054676f, 0.9859933224f, 0.9878510650f, 0.9895781981f, 0.9911742593f, 0.9926388212f, 0.9939714918f, 0.9951719143f,
+ 0.9962397673f, 0.9971747649f, 0.9979766568f, 0.9986452283f, 0.9991803005f, 0.9995817300f, 0.9998494093f, 0.9999832670f,
+};
+
+const float ivas_fb_cf_4ms_32k[IVAS_FB_4MS_32K_SAMP] =
+{
+ 0.0000376491f, 0.0003388077f, 0.0009409435f, 0.0018436939f, 0.0030465150f, 0.0045486823f, 0.0063492909f, 0.0084472563f,
+ 0.0108413146f, 0.0135300239f, 0.0165117645f, 0.0197847403f, 0.0233469798f, 0.0271963373f, 0.0313304940f, 0.0357469598f,
+ 0.0404430742f, 0.0454160085f, 0.0506627672f, 0.0561801898f, 0.0619649529f, 0.0680135719f, 0.0743224034f, 0.0808876472f,
+ 0.0877053486f, 0.0947714009f, 0.1020815477f, 0.1096313857f, 0.1174163672f, 0.1254318027f, 0.1336728642f, 0.1421345874f,
+ 0.1508118753f, 0.1596995011f, 0.1687921112f, 0.1780842286f, 0.1875702559f, 0.1972444793f, 0.2071010713f, 0.2171340946f,
+ 0.2273375058f, 0.2377051587f, 0.2482308081f, 0.2589081140f, 0.2697306445f, 0.2806918807f, 0.2917852200f, 0.3030039800f,
+ 0.3143414030f, 0.3257906599f, 0.3373448539f, 0.3489970253f, 0.3607401553f, 0.3725671702f, 0.3844709459f, 0.3964443119f,
+ 0.4084800560f, 0.4205709283f, 0.4327096457f, 0.4448888964f, 0.4571013438f, 0.4693396318f, 0.4815963885f, 0.4938642309f,
+ 0.5061357691f, 0.5184036115f, 0.5306603682f, 0.5428986562f, 0.5551111036f, 0.5672903543f, 0.5794290717f, 0.5915199440f,
+ 0.6035556881f, 0.6155290541f, 0.6274328298f, 0.6392598447f, 0.6510029747f, 0.6626551461f, 0.6742093401f, 0.6856585970f,
+ 0.6969960200f, 0.7082147800f, 0.7193081193f, 0.7302693555f, 0.7410918860f, 0.7517691919f, 0.7622948413f, 0.7726624942f,
+ 0.7828659054f, 0.7928989287f, 0.8027555207f, 0.8124297441f, 0.8219157714f, 0.8312078888f, 0.8403004989f, 0.8491881247f,
+ 0.8578654126f, 0.8663271358f, 0.8745681973f, 0.8825836328f, 0.8903686143f, 0.8979184523f, 0.9052285991f, 0.9122946514f,
+ 0.9191123528f, 0.9256775966f, 0.9319864281f, 0.9380350471f, 0.9438198102f, 0.9493372328f, 0.9545839915f, 0.9595569258f,
+ 0.9642530402f, 0.9686695060f, 0.9728036627f, 0.9766530202f, 0.9802152597f, 0.9834882355f, 0.9864699761f, 0.9891586854f,
+ 0.9915527437f, 0.9936507091f, 0.9954513177f, 0.9969534850f, 0.9981563061f, 0.9990590565f, 0.9996611923f, 0.9999623509f,
+};
+
+const float ivas_fb_cf_4ms_16k[IVAS_FB_4MS_16K_SAMP] =
+{
+ 0.0001505907f, 0.0013547717f, 0.0037602327f, 0.0073611788f, 0.0121489350f, 0.0181119671f, 0.0252359097f, 0.0335036006f,
+ 0.0428951221f, 0.0533878494f, 0.0649565044f, 0.0775732174f, 0.0912075934f, 0.1058267862f, 0.1213955767f, 0.1378764585f,
+ 0.1552297276f, 0.1734135785f, 0.1923842047f, 0.2120959043f, 0.2325011901f, 0.2535509039f, 0.2751943352f, 0.2973793430f,
+ 0.3200524817f, 0.3431591298f, 0.3666436213f, 0.3904493799f, 0.4145190556f, 0.4387946624f, 0.4632177182f, 0.4877293857f,
+ 0.5122706143f, 0.5367822818f, 0.5612053376f, 0.5854809444f, 0.6095506201f, 0.6333563787f, 0.6568408702f, 0.6799475183f,
+ 0.7026206570f, 0.7248056648f, 0.7464490961f, 0.7674988099f, 0.7879040957f, 0.8076157953f, 0.8265864215f, 0.8447702724f,
+ 0.8621235415f, 0.8786044233f, 0.8941732138f, 0.9087924066f, 0.9224267826f, 0.9350434956f, 0.9466121506f, 0.9571048779f,
+ 0.9664963994f, 0.9747640903f, 0.9818880329f, 0.9878510650f, 0.9926388212f, 0.9962397673f, 0.9986452283f, 0.9998494093f,
+};
+
+const float ivas_fb_fcs_12band_1ms[IVAS_FB_BANDS_12] =
+{
+ 0.0083333333f, 0.0250000000f, 0.0416666667f, 0.0583333333f,
+ 0.0750000000f, 0.0916666667f, 0.1083333333f, 0.1416666667f,
+ 0.2166666667f, 0.3333333333f, 0.5083333333f, 0.8083333333f
+};
+
+const int16_t ivas_fb_abs_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] =
+{
+ { 24, 30, 30, 30, 30, 30, 42, 76, 124, 182, 291, 367 },
+ { 24, 30, 30, 30, 30, 30, 42, 76, 124, 182, 260, 47 },
+ { 24, 30, 30, 30, 30, 30, 42, 75, 122, 73, 0, 0 }
+};
+
+const int16_t ivas_fb_abs_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] =
+{
+ {0, 9, 25, 41, 57, 73, 88, 110, 158, 246, 380, 593 },
+ {0, 9, 25, 41, 57, 73, 88, 110, 158, 246, 380, 593 },
+ {0, 9, 25, 41, 57, 73, 88, 110, 159, 247, 0, 0 }
+};
+
+const int16_t ivas_fb_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] =
+{
+ {
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_0 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_0,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_1 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_1,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_2 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_2,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_3 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_3,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_4 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_4,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_5 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_5,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_6 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_6,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_7 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_7,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_8 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_8,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_9 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_9,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_10 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_10,
+ IVAS_FB_12_1MS_48K_END_BINS_BAND_11 - IVAS_FB_12_1MS_48K_START_OFFSET_BAND_11
+ },
+ {
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_0 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_0,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_1 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_1,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_2 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_2,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_3 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_3,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_4 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_4,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_5 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_5,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_6 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_6,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_7 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_7,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_8 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_8,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_9 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_9,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_10 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_10,
+ IVAS_FB_12_1MS_32K_END_BINS_BAND_11 - IVAS_FB_12_1MS_32K_START_OFFSET_BAND_11
+ },
+ {
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_0 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_0,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_1 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_1,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_2 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_2,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_3 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_3,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_4 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_4,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_5 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_5,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_6 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_6,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_7 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_7,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_8 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_8,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_9 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_9,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_10 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_10,
+ IVAS_FB_12_1MS_16K_END_BINS_BAND_11 - IVAS_FB_12_1MS_16K_START_OFFSET_BAND_11
+ },
+};
+
+const int16_t ivas_fb_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12] =
+{
+ {
+ IVAS_FB_12_1MS_48K_START_OFFSET_BAND_0, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_1,
+ IVAS_FB_12_1MS_48K_START_OFFSET_BAND_2, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_3,
+ IVAS_FB_12_1MS_48K_START_OFFSET_BAND_4, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_5,
+ IVAS_FB_12_1MS_48K_START_OFFSET_BAND_6, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_7,
+ IVAS_FB_12_1MS_48K_START_OFFSET_BAND_8, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_9,
+ IVAS_FB_12_1MS_48K_START_OFFSET_BAND_10, IVAS_FB_12_1MS_48K_START_OFFSET_BAND_11
+ },
+ {
+ IVAS_FB_12_1MS_32K_START_OFFSET_BAND_0, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_1,
+ IVAS_FB_12_1MS_32K_START_OFFSET_BAND_2, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_3,
+ IVAS_FB_12_1MS_32K_START_OFFSET_BAND_4, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_5,
+ IVAS_FB_12_1MS_32K_START_OFFSET_BAND_6, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_7,
+ IVAS_FB_12_1MS_32K_START_OFFSET_BAND_8, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_9,
+ IVAS_FB_12_1MS_32K_START_OFFSET_BAND_10, IVAS_FB_12_1MS_32K_START_OFFSET_BAND_11
+ },
+ {
+ IVAS_FB_12_1MS_16K_START_OFFSET_BAND_0, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_1,
+ IVAS_FB_12_1MS_16K_START_OFFSET_BAND_2, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_3,
+ IVAS_FB_12_1MS_16K_START_OFFSET_BAND_4, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_5,
+ IVAS_FB_12_1MS_16K_START_OFFSET_BAND_6, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_7,
+ IVAS_FB_12_1MS_16K_START_OFFSET_BAND_8, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_9,
+ IVAS_FB_12_1MS_16K_START_OFFSET_BAND_10, IVAS_FB_12_1MS_16K_START_OFFSET_BAND_11
+ },
+};
+
+const float ivas_fb_cf_1ms_48k[IVAS_FB_1MS_48K_SAMP] =
+{
+ 0.0002677063f, 0.0024076367f, 0.0066783340f, 0.0130615104f, 0.0215298321f, 0.0320470366f, 0.0445680875f, 0.0590393678f,
+ 0.0753989092f, 0.0935766577f, 0.1134947733f, 0.1350679637f, 0.1582038490f, 0.1828033579f, 0.2087611516f, 0.2359660747f,
+ 0.2643016316f, 0.2936464851f, 0.3238749760f, 0.3548576614f, 0.3864618685f, 0.4185522633f, 0.4509914298f, 0.4836404586f,
+ 0.5163595414f, 0.5490085702f, 0.5814477367f, 0.6135381315f, 0.6451423386f, 0.6761250240f, 0.7063535149f, 0.7356983684f,
+ 0.7640339253f, 0.7912388484f, 0.8171966421f, 0.8417961510f, 0.8649320363f, 0.8865052267f, 0.9064233423f, 0.9246010908f,
+ 0.9409606322f, 0.9554319125f, 0.9679529634f, 0.9784701679f, 0.9869384896f, 0.9933216660f, 0.9975923633f, 0.9997322937f,
+};
+
+const float ivas_fb_cf_1ms_32k[IVAS_FB_1MS_32K_SAMP] =
+{
+ 0.0006022719f, 0.0054117450f, 0.0149843734f, 0.0292279674f, 0.0480053534f, 0.0711356950f, 0.0983962343f, 0.1295244373f,
+ 0.1642205226f, 0.2021503478f, 0.2429486279f, 0.2862224533f, 0.3315550733f, 0.3785099100f, 0.4266347628f, 0.4754661628f,
+ 0.5245338372f, 0.5733652372f, 0.6214900900f, 0.6684449267f, 0.7137775467f, 0.7570513721f, 0.7978496522f, 0.8357794774f,
+ 0.8704755627f, 0.9016037657f, 0.9288643050f, 0.9519946466f, 0.9707720326f, 0.9850156266f, 0.9945882550f, 0.9993977281f,
+};
+
+const float ivas_fb_cf_1ms_16k[IVAS_FB_1MS_16K_SAMP] =
+{
+ 0.0024076367f, 0.0215298321f, 0.0590393678f, 0.1134947733f, 0.1828033579f, 0.2643016316f, 0.3548576614f, 0.4509914298f,
+ 0.5490085702f, 0.6451423386f, 0.7356983684f, 0.8171966421f, 0.8865052267f, 0.9409606322f, 0.9784701679f, 0.9975923633f,
+ };
+
+
+const float ivas_fb_fr_12band_1ms_re[IVAS_FB_12_1MS_LEN] =
+{
+ 0.9748788957f, 0.9427895242f, 0.8792742509f, 0.7856320394f, 0.6637543553f, 0.5159842697f, 0.3449612971f, 0.1523029468f,
+ -0.0629462677f, -0.2915070279f, -0.5097704228f, -0.6945723663f, -0.8280677163f, -0.8984664279f, -0.9013544787f, -0.8399030468f,
+ -0.7243177987f, -0.5703726081f, -0.3972779762f, -0.2251611328f, -0.0723653847f, 0.0469440290f, 0.1248973653f, 0.1617697860f,
+ 0.1709641074f, 0.1694810686f, 0.1629475939f, 0.1522105989f, 0.1386564071f, 0.1233728939f, 0.1073854103f, 0.0914740522f,
+ 0.0762871837f, 0.0622709857f, 0.0497418146f, 0.0388592902f, 0.0296823509f, 0.0221628349f, 0.0161914497f, 0.0115997684f,
+ 0.0081967931f, 0.0057721783f, 0.0041230995f, 0.0030548577f, 0.0023984605f, 0.0020073250f, 0.0017670262f, 0.0015886054f,
+ 0.0014126895f, 0.0012008765f, 0.0009366259f, 0.0006164015f, 0.0002494051f, -0.0001501884f, -0.0005632461f, -0.0009716328f,
+ -0.0013573205f, -0.0017064484f, -0.0020074979f, -0.0022538257f, -0.0024412527f, -0.0025696364f, -0.0026403325f, -0.0026573398f,
+ -0.0026249989f, -0.0025490667f, -0.0024348276f, -0.0022882409f, -0.0021144573f, -0.0019190182f, -0.0017066606f, -0.0014824738f,
+ -0.0012508539f, -0.0010165332f, -0.0007835930f, -0.0005563371f, -0.0003383404f, -0.0001331992f, 0.0000563549f, 0.0002277657f,
+ 0.0003794289f, 0.0005100093f, 0.0006190856f, 0.0007064556f, 0.0007726658f, 0.0008183240f, 0.0008445608f, 0.0008523932f,
+ 0.0008431696f, 0.0008180214f, 0.0007783263f, 0.0007252567f, 0.0006602600f, 0.0005846794f, 0.0005002207f, 0.0004085983f,
+ 0.0003119450f, 0.0002124378f, 0.0001126202f, 0.0000149855f, -0.0000777886f, -0.0001632865f, -0.0002391747f, -0.0003036357f,
+ -0.0003551891f, -0.0003930613f, -0.0004169567f, -0.0004273258f, -0.0004250606f, -0.0004116574f, -0.0003888481f, -0.0003586881f,
+ -0.0003231696f, -0.0002842913f, -0.0002437103f, -0.0002028533f, -0.0001626543f, -0.0001237419f, -0.0000862804f, -0.0000502315f,
+ -0.0000152759f, 0.0000188864f, 0.0000525857f, 0.0000859011f, 0.0001187387f, 0.0001506215f, 0.0001808384f, 0.0002083291f,
+ 0.0002319112f, 0.0002502468f, 0.0002621167f, 0.0002664223f, 0.0002624512f, 0.0002498541f, 0.0002288448f, 0.0002001024f,
+ 0.0001648717f, 0.0001247734f, 0.0000818072f, 0.0000380927f, -0.0000041840f, -0.0000430463f, -0.0000767750f, -0.0001041381f,
+ -0.0001243744f, -0.0001373295f, -0.0001433435f, -0.0001432806f, -0.0001383279f, -0.0001299462f, -0.0001196234f, -0.0001088038f,
+ -0.0000986591f, -0.0000900582f, -0.0000834123f, -0.0000787307f, -0.0000755665f, -0.0000731664f, -0.0000705050f, -0.0000664967f,
+ -0.0000600718f, -0.0000503921f, -0.0000369061f, -0.0000195076f, 0.0000014839f, 0.0000252601f, 0.0000506406f, 0.0000761070f,
+ 0.0000999980f, 0.0001206038f, 0.0001363885f, 0.0001460830f, 0.0001488707f, 0.0001444187f, 0.0001329747f, 0.0001153008f,
+ 0.0000926636f, 0.0000666729f, 0.0000391891f,
+ 0.0080195493f, 0.0152804795f, 0.0297236427f, 0.0512076944f, 0.0795504278f, 0.1146345202f, 0.1565217749f, 0.2067150266f,
+ 0.2696514371f, 0.3398196482f, 0.3975948769f, 0.4239235527f, 0.4051207537f, 0.3335063336f, 0.2086503840f, 0.0374772593f,
+ -0.1663484542f, -0.3839925014f, -0.5936160820f, -0.7729897529f, -0.9021602868f, -0.9658914408f, -0.9555491003f, -0.8702102709f,
+ -0.7168585697f, -0.5096278055f, -0.2682088520f, -0.0155786468f, 0.2246238492f, 0.4308147261f, 0.5858672047f, 0.6790005846f,
+ 0.7068091556f, 0.6734550535f, 0.5898178925f, 0.4719496963f, 0.3387034057f, 0.2092646386f, 0.1002222301f, 0.0233145798f,
+ -0.0225492413f, -0.0508402802f, -0.0698819559f, -0.0814769049f, -0.0871540019f, -0.0880955245f, -0.0854373943f, -0.0801296337f,
+ -0.0730507304f, -0.0649236398f, -0.0563762037f, -0.0478921962f, -0.0398550173f, -0.0325224860f, -0.0260651486f, -0.0205564484f,
+ -0.0160078488f, -0.0123673601f, -0.0095503829f, -0.0074410094f, -0.0059169243f, -0.0048497092f, -0.0041229035f, -0.0036294834f,
+ -0.0032833863f, -0.0030140242f, -0.0027726134f, -0.0025247022f, -0.0022531837f, -0.0019502609f, -0.0016189799f, -0.0012659033f,
+ -0.0009025224f, -0.0005393948f, -0.0001881199f, 0.0001429077f, 0.0004458867f, 0.0007165584f, 0.0009512703f, 0.0011491538f,
+ 0.0013092799f, 0.0014325460f, 0.0015192234f, 0.0015708276f, 0.0015881374f, 0.0015730908f, 0.0015271608f, 0.0014531585f,
+ 0.0013537657f, 0.0012330943f, 0.0010952099f, 0.0009453732f, 0.0007885040f, 0.0006301505f, 0.0004749667f, 0.0003275524f,
+ 0.0001910823f, 0.0000681798f, -0.0000401798f, -0.0001336577f, -0.0002133415f, -0.0002805985f, -0.0003376335f, -0.0003863124f,
+ -0.0004286391f, -0.0004657017f, -0.0004982282f, -0.0005257791f, -0.0005474775f, -0.0005614835f, -0.0005658893f, -0.0005584023f,
+ -0.0005372971f, -0.0005011582f, -0.0004497305f, -0.0003835612f, -0.0003046159f, -0.0002157155f, -0.0001208702f, -0.0000245120f,
+ 0.0000683937f, 0.0001532153f, 0.0002256208f, 0.0002823819f, 0.0003212462f, 0.0003415271f, 0.0003437577f, 0.0003299911f,
+ 0.0003032103f, 0.0002673723f, 0.0002266573f, 0.0001853871f, 0.0001472716f, 0.0001153747f, 0.0000915248f, 0.0000764751f,
+ 0.0000695838f, 0.0000692286f, 0.0000727574f, 0.0000771057f, 0.0000789150f, 0.0000752114f, 0.0000635256f, 0.0000424610f,
+ 0.0000116537f, -0.0000279010f, -0.0000741391f, -0.0001238800f, -0.0001733508f, -0.0002183440f, -0.0002548569f, -0.0002793014f,
+ -0.0002890885f, -0.0002827170f, -0.0002601490f, -0.0002226568f, -0.0001729141f, -0.0001145795f, -0.0000521398f, 0.0000096825f,
+ 0.0114335951f, 0.0118220569f, 0.0126166715f, 0.0138498428f, 0.0155597951f, 0.0177826837f, 0.0205365788f, 0.0238116184f,
+ 0.0275499857f, 0.0316384404f, 0.0358879435f, 0.0400334899f, 0.0437164087f, 0.0464960697f, 0.0478357348f, 0.0471294159f,
+ 0.0436878423f, 0.0367814109f, 0.0256142984f, 0.0093791332f, -0.0128147904f, -0.0419091622f, -0.0791441084f, -0.1267865122f,
+ -0.1929101618f, -0.2825839913f, -0.3844663503f, -0.4796058889f, -0.5493419153f, -0.5770955026f, -0.5509547813f, -0.4652700670f,
+ -0.3217444363f, -0.1294222853f, 0.0961203110f, 0.3345074656f, 0.5628461809f, 0.7584007007f, 0.9012417605f, 0.9766103137f,
+ 0.9766601036f, 0.9013929608f, 0.7586588937f, 0.5632193167f, 0.3350048195f, 0.0967502546f, -0.1286537645f, -0.3208359645f,
+ -0.4642258941f, -0.5497861643f, -0.5758205512f, -0.5479856830f, -0.4781988983f, -0.3830435617f, -0.2811824725f, -0.1915676007f,
+ -0.1255389320f, -0.0780249233f, -0.0409475096f, -0.0120357725f, 0.0099548733f, 0.0259692697f, 0.0369008806f, 0.0435579897f,
+ 0.0467369910f, 0.0471666204f, 0.0455359048f, 0.0424502401f, 0.0384477095f, 0.0339708748f, 0.0293829220f, 0.0249536436f,
+ 0.0208784147f, 0.0172747220f, 0.0142030489f, 0.0116695065f, 0.0096461650f, 0.0080756116f, 0.0068882718f, 0.0060058072f,
+ 0.0053538953f, 0.0048628684f, 0.0044756795f, 0.0041456204f, 0.0038402965f, 0.0035372856f, 0.0032255714f, 0.0029004385f,
+ 0.0025638810f, 0.0022199121f, 0.0018750824f, 0.0015349035f, 0.0012050131f, 0.0008888342f, 0.0005893582f, 0.0003077151f,
+ 0.0000451990f, -0.0001977660f, -0.0004197988f, -0.0006196394f, -0.0007948001f, -0.0009428845f, -0.0010607326f, -0.0011459111f,
+ -0.0011961438f, -0.0012107318f, -0.0011899721f, -0.0011362537f, -0.0010532349f, -0.0009464869f, -0.0008223739f, -0.0006883049f,
+ -0.0005514485f, -0.0004188116f, -0.0002960338f, -0.0001875645f, -0.0000957748f, -0.0000214335f, 0.0000367443f, 0.0000812780f,
+ 0.0001159924f, 0.0001449821f, 0.0001725036f, 0.0002019612f, 0.0002358809f, 0.0002751586f, 0.0003193210f, 0.0003661738f,
+ 0.0004124154f, 0.0004536598f, 0.0004853030f, 0.0005027457f, 0.0005022926f, 0.0004813241f, 0.0004389844f, 0.0003760837f,
+ 0.0002954100f, 0.0002012644f, 0.0000993832f, -0.0000038301f, -0.0001016317f, -0.0001878100f, -0.0002570235f, -0.0003055296f,
+ -0.0003312954f, -0.0003343869f, -0.0003167133f, -0.0002820121f, -0.0002352424f, -0.0001822598f, -0.0001290196f, -0.0000811569f,
+ -0.0000432400f, -0.0000185020f, -0.0000083679f, -0.0000125164f, -0.0000287954f, -0.0000536548f, -0.0000824102f, -0.0001099335f,
+ -0.0001310885f, -0.0001414598f, -0.0001377171f, -0.0001181463f, -0.0000827338f, -0.0000333400f, 0.0000265889f, 0.0000922209f,
+ 0.0001579388f, 0.0002177817f, 0.0002661695f, 0.0002983587f, 0.0003110497f, 0.0003026261f, 0.0002734474f, 0.0002257288f,
+ 0.0001634460f, 0.0000918569f, 0.0000170963f, -0.0000545144f, -0.0001169830f, -0.0001653182f, -0.0001959140f, -0.0002069779f,
+ -0.0001985967f, -0.0001727902f, -0.0001331990f, -0.0000847800f, -0.0000332059f, 0.0000156408f, 0.0000563515f, 0.0000844666f,
+ 0.0000970039f, 0.0000926836f, 0.0000721249f, 0.0000377027f, -0.0000066339f, -0.0000558449f, -0.0001042571f, -0.0001462224f,
+ -0.0001766430f, -0.0001915709f, -0.0001885647f, -0.0001670193f, -0.0001281871f, -0.0000751314f, -0.0000123776f, 0.0000544678f,
+ 0.0001193245f, 0.0001761818f, 0.0002197499f, 0.0002459308f, 0.0002522801f, 0.0002382003f, 0.0002050537f,
+ 0.0023329977f, 0.0022744367f, 0.0021570870f, 0.0019806181f, 0.0017457340f, 0.0014542507f, 0.0011108455f, 0.0007223346f,
+ 0.0002992379f, -0.0001466015f, -0.0006012791f, -0.0010533907f, -0.0014941798f, -0.0019241070f, -0.0023530883f, -0.0028080809f,
+ -0.0033317792f, -0.0039896152f, -0.0048647785f, -0.0060629391f, -0.0077015456f, -0.0099112032f, -0.0128179487f, -0.0165415563f,
+ -0.0211707180f, -0.0267603854f, -0.0333010728f, -0.0407193019f, -0.0488429494f, -0.0574105466f, -0.0660338484f, -0.0742229694f,
+ -0.0813438415f, -0.0866673269f, -0.0893099408f, -0.0883179181f, -0.0825536818f, -0.0708351065f, -0.0516356322f, -0.0231563648f,
+ 0.0229208886f, 0.1000615986f, 0.2093510203f, 0.3390457527f, 0.4725528568f, 0.5906840617f, 0.6745849094f, 0.7082031015f,
+ 0.6806592553f, 0.5877917414f, 0.4330061655f, 0.2270823403f, -0.0128552066f, -0.2652258122f, -0.5063946175f, -0.7133884257f,
+ -0.8665187769f, -0.9516510020f, -0.9617959599f, -0.8978644321f, -0.7684707435f, -0.5888227503f, -0.3788375243f, -0.1607017417f,
+ 0.0437915599f, 0.2158527937f, 0.3418541386f, 0.4148932359f, 0.4353978994f, 0.4110138144f, 0.3553491439f, 0.2873311989f,
+ 0.2264012967f, 0.1778272597f, 0.1368656384f, 0.1016489237f, 0.0716971046f, 0.0466686361f, 0.0262587636f, 0.0101140856f,
+ -0.0021717142f, -0.0110521236f, -0.0170125125f, -0.0205483075f, -0.0221473891f, -0.0222696986f, -0.0213345382f, -0.0197075856f,
+ -0.0176958703f, -0.0155434695f, -0.0134339314f, -0.0114932096f, -0.0097973566f, -0.0083798220f, -0.0072413978f, -0.0063587120f,
+ -0.0056935805f, -0.0052001373f, -0.0048316507f, -0.0045448649f, -0.0043035469f, -0.0040798367f, -0.0038548953f, -0.0036180007f,
+ -0.0033653668f, -0.0030981742f, -0.0028208099f, -0.0025389671f, -0.0022582881f, -0.0019832510f, -0.0017166811f, -0.0014595950f,
+ -0.0012115153f, -0.0009709890f, -0.0007362895f, -0.0005061076f, -0.0002801409f, -0.0000595032f, 0.0001531427f, 0.0003536750f,
+ 0.0005368997f, 0.0006970650f, 0.0008285636f, 0.0009265836f, 0.0009877836f, 0.0010107351f, 0.0009962610f, 0.0009474346f,
+ 0.0008694403f, 0.0007691024f, 0.0006543506f, 0.0005334591f, 0.0004143726f, 0.0003039581f, 0.0002074999f, 0.0001282497f,
+ 0.0000673202f, 0.0000236838f, -0.0000054823f, -0.0000243922f, -0.0000379908f, -0.0000513567f, -0.0000689891f, -0.0000943029f,
+ -0.0001291385f, -0.0001735855f, -0.0002258909f, -0.0002827035f, -0.0003393834f, -0.0003905818f, -0.0004307882f, -0.0004550220f,
+ -0.0004593576f, -0.0004414605f, -0.0004008453f, -0.0003390565f, -0.0002595254f, -0.0001673445f, -0.0000687564f, 0.0000293658f,
+ 0.0001202144f, 0.0001976297f, 0.0002567251f, 0.0002942795f, 0.0003090663f, 0.0003018805f, 0.0002754671f, 0.0002341572f,
+ 0.0001834501f, 0.0001293884f, 0.0000779842f, 0.0000345648f, 0.0000032926f, -0.0000132797f, -0.0000143893f, -0.0000011447f,
+ 0.0000236778f, 0.0000559218f, 0.0000905679f, 0.0001222509f, 0.0001458957f, 0.0001572350f, 0.0001533249f, 0.0001328377f,
+ 0.0000962676f, 0.0000458655f, -0.0000145297f, -0.0000799026f, -0.0001445204f, -0.0002025425f, -0.0002485698f, -0.0002782267f,
+ -0.0002885684f, -0.0002784187f, -0.0002484615f, -0.0002012166f, -0.0001407652f, -0.0000723891f, -0.0000020250f, 0.0000642779f,
+ 0.0006545440f, 0.0006092123f, 0.0005211283f, 0.0003952715f, 0.0002383557f, 0.0000584198f, -0.0001362653f, -0.0003375075f,
+ -0.0005383555f, -0.0007329456f, -0.0009174331f, -0.0010891536f, -0.0012472468f, -0.0013911728f, -0.0015212364f, -0.0016367530f,
+ -0.0017368889f, -0.0018188830f, -0.0018796284f, -0.0019142370f, -0.0019185646f, -0.0018880671f, -0.0018210801f, -0.0017174793f,
+ -0.0015821304f, -0.0014225231f, -0.0012516143f, -0.0010835462f, -0.0009352781f, -0.0008198418f, -0.0007467438f, -0.0007129147f,
+ -0.0007027599f, -0.0006778296f, -0.0005783377f, -0.0003132968f, 0.0002340159f, 0.0012135056f, 0.0027962862f, 0.0051783222f,
+ 0.0085600080f, 0.0131460500f, 0.0191158420f, 0.0266218006f, 0.0357510579f, 0.0465271020f, 0.0588638446f, 0.0725784015f,
+ 0.0873370030f, 0.1026908595f, 0.1180068601f, 0.1325484280f, 0.1453642259f, 0.1554807068f, 0.1616648578f, 0.1632688310f,
+ 0.1549027767f, 0.1198428714f, 0.0449861804f, -0.0696229208f, -0.2158023005f, -0.3790883171f, -0.5408894679f, -0.6808851285f,
+ -0.7797705919f, -0.8217682544f, -0.7968116423f, -0.7019652931f, -0.5420418321f, -0.3292210214f, -0.0818128466f, 0.1777726196f,
+ 0.4255266516f, 0.6385776439f, 0.7977664747f, 0.8898038418f, 0.9086949642f, 0.8563086554f, 0.7419773576f, 0.5812252250f,
+ 0.3937408613f, 0.2008871303f, 0.0230173731f, -0.1230428784f, -0.2260664125f, -0.2818374636f, -0.2937072611f, -0.2733437698f,
+ -0.2408584071f, -0.2098412063f, -0.1806909043f, -0.1526536550f, -0.1261957677f, -0.1017094943f, -0.0795968657f, -0.0600974864f,
+ -0.0433545981f, -0.0293681726f, -0.0180470916f, -0.0092000126f, -0.0025796754f, 0.0021127195f, 0.0051910943f, 0.0069776293f,
+ 0.0077756050f, 0.0078657031f, 0.0074886765f, 0.0068470105f, 0.0060965069f, 0.0053530166f, 0.0046907222f, 0.0041521192f,
+ 0.0037501212f, 0.0034789031f, 0.0033170573f, 0.0032371863f, 0.0032080612f, 0.0032016671f, 0.0031933530f, 0.0031660244f,
+ 0.0031082781f, 0.0030162723f, 0.0028905427f, 0.0027365419f, 0.0025611068f, 0.0023726939f, 0.0021783369f, 0.0019843040f,
+ 0.0017939931f, 0.0016092783f, 0.0014293389f, 0.0012525382f, 0.0010758415f, 0.0008968234f, 0.0007132020f, 0.0005245511f,
+ 0.0003315658f, 0.0001372209f, -0.0000543880f, -0.0002374465f, -0.0004059085f, -0.0005532434f, -0.0006739838f, -0.0007634986f,
+ -0.0008192976f, -0.0008405529f, -0.0008289575f, -0.0007878678f, -0.0007226939f, -0.0006397231f, -0.0005461962f, -0.0004490215f,
+ -0.0003547907f, -0.0002686412f, -0.0001944601f, -0.0001340918f, -0.0000878707f, -0.0000542351f, -0.0000305758f, -0.0000131627f,
+ 0.0000018427f, 0.0000183480f, 0.0000393727f, 0.0000671196f, 0.0001022671f, 0.0001443061f, 0.0001911748f, 0.0002398911f,
+ 0.0002864880f, 0.0003268414f, 0.0003567538f, 0.0003727940f, 0.0003723297f, 0.0003541905f, 0.0003184856f, 0.0002669707f,
+ 0.0002025844f, 0.0001295158f, 0.0000525132f, -0.0000232393f, -0.0000928921f, -0.0001520697f, -0.0001975396f, -0.0002271978f,
+ -0.0002404958f, -0.0002381708f,
+ -0.0001556937f, -0.0002232588f, -0.0003000471f, -0.0003807341f, -0.0004589754f, -0.0005276096f, -0.0005796476f, -0.0006085059f,
+ -0.0006090117f, -0.0005773878f, -0.0005120302f, -0.0004130497f, -0.0002827174f, -0.0001245430f, 0.0000565230f, 0.0002553084f,
+ 0.0004662156f, 0.0006844691f, 0.0009056254f, 0.0011266188f, 0.0013448100f, 0.0015587720f, 0.0017669159f, 0.0019681955f,
+ 0.0021605643f, 0.0023419522f, 0.0025089038f, 0.0026581873f, 0.0027858518f, 0.0028896115f, 0.0029682393f, 0.0030244845f,
+ 0.0030642863f, 0.0030995791f, 0.0031464520f, 0.0032269718f, 0.0033653351f, 0.0035879808f, 0.0039171130f, 0.0043689626f,
+ 0.0049448001f, 0.0056281538f, 0.0063744051f, 0.0071088295f, 0.0077167468f, 0.0080450691f, 0.0078953687f, 0.0070318498f,
+ 0.0051792603f, 0.0020396552f, -0.0027043718f, -0.0093630158f, -0.0182327050f, -0.0295599145f, -0.0435368078f, -0.0602568291f,
+ -0.0797235538f, -0.1017981297f, -0.1262457047f, -0.1526688648f, -0.1806793505f, -0.2098138162f, -0.2408276962f, -0.2733223455f,
+ -0.2937063941f, -0.2818656143f, -0.2261282142f, -0.1231384900f, 0.0228924303f, 0.2007416620f, 0.3935871743f, 0.5810779624f,
+ 0.7418520015f, 0.8562199711f, 0.9086554096f, 0.8898222505f, 0.7978469922f, 0.6387191949f, 0.4257228188f, 0.1780121397f,
+ -0.0815452149f, -0.3289431293f, -0.5417726272f, -0.7017230773f, -0.7966125143f, -0.8216246380f, -0.7796902592f, -0.6808705368f,
+ -0.5409377623f, -0.3791916953f, -0.2159490132f, -0.0697984743f, 0.0447973984f, 0.1196560777f, 0.1547311650f, 0.1631223252f,
+ 0.1615491774f, 0.1553970134f, 0.1453090286f, 0.1325143072f, 0.1179833627f, 0.1026659817f, 0.0872986185f, 0.0725159741f,
+ 0.0587697393f, 0.0463978659f, 0.0355880008f, 0.0264313485f, 0.0189090552f, 0.0129379217f, 0.0083680105f, 0.0050209526f,
+ 0.0026911244f, 0.0011756268f, 0.0002742518f, -0.0001893835f, -0.0003713645f, -0.0003945662f, -0.0003559061f, -0.0003199311f,
+ -0.0003286406f, -0.0003992283f, -0.0005347052f, -0.0007234444f, -0.0009489211f, -0.0011892232f, -0.0014247925f, -0.0016368658f,
+ -0.0018128572f, -0.0019435092f, -0.0020262245f, -0.0020613098f, -0.0020539729f, -0.0020103196f, -0.0019388124f, -0.0018466470f,
+ -0.0017412840f, -0.0016275801f, -0.0015096821f, -0.0013889666f, -0.0012662678f, -0.0011404183f, -0.0010105747f, -0.0008750310f,
+ -0.0007333545f, -0.0005851730f, -0.0004319169f, -0.0002754165f, -0.0001192014f, 0.0000330890f, 0.0001767485f, 0.0003076493f,
+ 0.0004214404f, 0.0005150718f, 0.0005859601f, 0.0006332532f, 0.0006568484f, 0.0006583487f, 0.0006399242f, 0.0006050121f,
+ 0.0005571017f, 0.0005002994f, 0.0004381601f, 0.0003742519f, 0.0003111446f, 0.0002510679f, 0.0001951108f, 0.0001440004f,
+ 0.0000974938f, 0.0000552356f, 0.0000162701f, -0.0000201054f, -0.0000548020f, -0.0000881717f, -0.0001205191f, -0.0001514697f,
+ -0.0001805617f, -0.0002067517f, -0.0002290677f, -0.0002462077f, -0.0002572013f, -0.0002610364f, -0.0002572665f, -0.0002456071f,
+ -0.0002264461f, -0.0002003792f, -0.0001686145f,
+ -0.0002097915f, -0.0002547683f, -0.0002867440f, -0.0003037080f, -0.0003049864f, -0.0002912099f, -0.0002641320f, -0.0002263469f,
+ -0.0001809155f, -0.0001309730f, -0.0000793326f, -0.0000281672f, 0.0000212324f, 0.0000685537f, 0.0001144458f, 0.0001603457f,
+ 0.0002082167f, 0.0002601799f, 0.0003181336f, 0.0003833534f, 0.0004561750f, 0.0005357423f, 0.0006199091f, 0.0007052503f,
+ 0.0007872414f, 0.0008605303f, 0.0009193285f, 0.0009578246f, 0.0009706279f, 0.0009531437f, 0.0009018903f, 0.0008146822f,
+ 0.0006907085f, 0.0005304701f, 0.0003356294f, 0.0001087751f, -0.0001468322f, -0.0004275067f, -0.0007293282f, -0.0010482464f,
+ -0.0013801011f, -0.0017205409f, -0.0020649160f, -0.0024081360f, -0.0027446427f, -0.0030684675f, -0.0033735725f, -0.0036543691f,
+ -0.0039066272f, -0.0041285253f, -0.0043220448f, -0.0044942599f, -0.0046587239f, -0.0048362859f, -0.0050555995f, -0.0053524607f,
+ -0.0057684191f, -0.0063476637f, -0.0071329714f, -0.0081596433f, -0.0094487437f, -0.0109984997f, -0.0127758558f, -0.0147068954f,
+ -0.0166688890f, -0.0184823228f, -0.0199064468f, -0.0206359860f, -0.0203032667f, -0.0184822593f, -0.0146993237f, -0.0084456516f,
+ 0.0008037916f, 0.0135712038f, 0.0303539710f, 0.0516053773f, 0.0777267032f, 0.1090646438f, 0.1459928995f, 0.1890045882f,
+ 0.2399569411f, 0.3035491657f, 0.3744326411f, 0.4330381754f, 0.4602649242f, 0.4422767198f, 0.3711532515f, 0.2461380555f,
+ 0.0737670473f, -0.1327449736f, -0.3550430014f, -0.5718089399f, -0.7613406410f, -0.9042683903f, -0.9859824923f, -0.9986999813f,
+ -0.9431316453f, -0.8322426947f, -0.6838587489f, -0.5090121248f, -0.3164353275f, -0.1160643779f, 0.0821150478f, 0.2684309672f,
+ 0.4341770987f, 0.5719923883f, 0.6762928566f, 0.7434950500f, 0.7721889543f, 0.7631234448f, 0.7191049971f, 0.6447409999f,
+ 0.5461062812f, 0.4303073808f, 0.3050115994f, 0.1779422698f, 0.0563953149f, -0.0532072816f, -0.1456894384f, -0.2173979596f,
+ -0.2663715333f, -0.2923808160f, -0.2968590700f, -0.2826977783f, -0.2539702782f, -0.2155328992f, -0.1726410340f, -0.1304388234f,
+ -0.0937203765f, -0.0651894568f, -0.0434204585f, -0.0262320261f, -0.0128620020f, -0.0027758731f, 0.0045023778f, 0.0094378307f,
+ 0.0124649620f, 0.0139956053f, 0.0143989384f, 0.0140037462f, 0.0130866052f, 0.0118760507f, 0.0105485285f, 0.0092355458f,
+ 0.0080250843f, 0.0069705449f, 0.0060949377f, 0.0053998515f, 0.0048701054f, 0.0044812646f, 0.0042032151f, 0.0040054335f,
+ 0.0038588251f, 0.0037386836f, 0.0036248683f, 0.0035029301f, 0.0033631517f, 0.0032005638f, 0.0030135068f, 0.0028032324f,
+ 0.0025725319f, 0.0023254060f, 0.0020660644f, 0.0017988746f, 0.0015277862f, 0.0012565431f, 0.0009884144f, 0.0007265302f,
+ 0.0004737413f, 0.0002329236f, 0.0000068230f, -0.0002017617f, -0.0003902098f, -0.0005560211f, -0.0006970975f, -0.0008117494f,
+ -0.0008989567f, -0.0009583547f, -0.0009904048f, -0.0009962992f, -0.0009780085f, -0.0009380932f, -0.0008796449f, -0.0008060398f,
+ -0.0007208281f, -0.0006274895f, -0.0005293371f, -0.0004293314f, -0.0003300469f, -0.0002335751f, -0.0001415683f, -0.0000552272f,
+ 0.0000245975f, 0.0000973664f, 0.0001627306f, 0.0002204858f, 0.0002704729f, 0.0003125597f, 0.0003465872f, 0.0003723927f,
+ 0.0003898040f, 0.0003986947f, 0.0003990072f, 0.0003908172f, 0.0003743577f, 0.0003500669f, 0.0003185900f, 0.0002807935f,
+ 0.0002377348f, 0.0001906413f, 0.0001408526f, 0.0000897771f, 0.0000388229f, -0.0000106507f, -0.0000573934f, -0.0001003004f,
+ -0.0001384514f, -0.0001711250f, -0.0001978125f, -0.0002182105f, -0.0002322144f, -0.0002398964f, -0.0002414880f,
+ -0.0001596129f, -0.0001562496f, -0.0001498931f, -0.0001412337f, -0.0001312006f, -0.0001208315f, -0.0001111500f, -0.0001030067f,
+ -0.0000969764f, -0.0000932334f, -0.0000915268f, -0.0000911372f, -0.0000909596f, -0.0000895515f, -0.0000853138f, -0.0000765980f,
+ -0.0000619367f, -0.0000401498f, -0.0000105563f, 0.0000269865f, 0.0000719478f, 0.0001231977f, 0.0001789736f, 0.0002370733f,
+ 0.0002949065f, 0.0003497691f, 0.0003989259f, 0.0004399015f, 0.0004705253f, 0.0004891741f, 0.0004947225f, 0.0004866983f,
+ 0.0004651169f, 0.0004305530f, 0.0003838811f, 0.0003263054f, 0.0002590637f, 0.0001834786f, 0.0001006881f, 0.0000117772f,
+ -0.0000824234f, -0.0001810986f, -0.0002835801f, -0.0003890188f, -0.0004964869f, -0.0006046168f, -0.0007117406f, -0.0008155628f,
+ -0.0009134018f, -0.0010019440f, -0.0010776210f, -0.0011364499f, -0.0011745303f, -0.0011879291f, -0.0011732401f, -0.0011274376f,
+ -0.0010484260f, -0.0009347877f, -0.0007862674f, -0.0006033735f, -0.0003877877f, -0.0001418301f, 0.0001311620f, 0.0004274542f,
+ 0.0007424943f, 0.0010715568f, 0.0014092217f, 0.0017500212f, 0.0020878151f, 0.0024164922f, 0.0027293133f, 0.0030197921f,
+ 0.0032811287f, 0.0035074177f, 0.0036932727f, 0.0038354464f, 0.0039326233f, 0.0039873724f, 0.0040058742f, 0.0039999004f,
+ 0.0039859967f, 0.0039869775f, 0.0040299079f, 0.0041465214f, 0.0043693426f, 0.0047305856f, 0.0052560067f, 0.0059622775f,
+ 0.0068486582f, 0.0078935236f, 0.0090446101f, 0.0102161743f, 0.0112791696f, 0.0120612232f, 0.0123383309f, 0.0118401814f,
+ 0.0102443788f, 0.0071893168f, 0.0022697611f, -0.0049422577f, -0.0149080197f, -0.0281014987f, -0.0450597042f, -0.0665503452f,
+ -0.0947658820f, -0.1311459738f, -0.1730055990f, -0.2155698254f, -0.2537148355f, -0.2822005637f, -0.2961808714f, -0.2915797030f,
+ -0.2654897618f, -0.2164403253f, -0.1446028708f, -0.0518524544f, 0.0582677361f, 0.1807212874f, 0.3092454104f, 0.4367256082f,
+ 0.5556248313f, 0.6584663388f, 0.7383128514f, 0.7892352587f, 0.8067145259f, 0.7879751516f, 0.7322001587f, 0.6406413437f,
+ 0.5165833320f, 0.3651995965f, 0.1932631326f, 0.0087845907f, -0.1794730708f, -0.3624711894f, -0.5314826505f, -0.6784496714f,
+ -0.7975387008f, -0.8869066714f, -0.9460978228f, -0.9743683484f, -0.9716887763f, -0.9388912477f, -0.8776913880f, -0.7906217616f,
+ -0.6809617759f, -0.5526158639f, -0.4099903122f, -0.2578384472f, -0.1011091221f, 0.0552204273f, 0.2063009082f, 0.3475689337f,
+ 0.4748858634f, 0.5846665399f, 0.6739816770f, 0.7406414471f, 0.7832480152f, 0.8012243690f, 0.7948108464f, 0.7650372454f,
+ 0.7136651972f, 0.6431094919f, 0.5563357930f, 0.4567441179f, 0.3480375726f, 0.2340859886f, 0.1187851647f, 0.0059210218f,
+ -0.1009603020f, -0.1986681163f, -0.2844680876f, -0.3561617036f, -0.4121449494f, -0.4514415411f, -0.4737129527f, -0.4792427680f,
+ -0.4688992715f, -0.4440758562f, -0.4066146191f, -0.3587143469f, -0.3028292405f, -0.2415605597f, -0.1775478604f, -0.1133622284f,
+ -0.0514077865f, 0.0061666480f, 0.0575405302f, 0.1012784567f, 0.1363672493f, 0.1622340919f, 0.1787438032f, 0.1861777807f,
+ 0.1851944065f, 0.1767749919f, 0.1621564237f, 0.1427557163f, 0.1200884424f, 0.0956867818f, 0.0710192746f, 0.0474178663f,
+ 0.0260137499f, 0.0076867119f, -0.0069716085f, -0.0176776741f, -0.0244598245f, -0.0276479905f, -0.0278485265f, -0.0259604376f,
+ -0.0231942463f, -0.0203712397f, -0.0176250103f, -0.0150030188f, -0.0125853805f, -0.0104245492f, -0.0085536471f, -0.0069822366f,
+ -0.0057037888f, -0.0046971305f, -0.0039324091f, -0.0033733475f, -0.0029816582f, -0.0027187689f, -0.0025487112f, -0.0024389400f,
+ -0.0023618935f, -0.0022949607f, -0.0022210429f, -0.0021279181f, -0.0020081783f, -0.0018582858f, -0.0016782193f, -0.0014704729f,
+ -0.0012396507f, -0.0009915718f, -0.0007329515f, -0.0004706874f, -0.0002116789f, 0.0000376970f, 0.0002716276f, 0.0004852251f,
+ 0.0006744554f, 0.0008363689f, 0.0009689456f, 0.0010712272f, 0.0011431025f, 0.0011853673f, 0.0011994712f, 0.0011875293f,
+ 0.0011520531f, 0.0010959403f, 0.0010222139f, 0.0009340189f, 0.0008343934f, 0.0007262955f, 0.0006124255f, 0.0004952948f,
+ 0.0003771045f, 0.0002598545f, 0.0001452665f, 0.0000349171f, -0.0000698172f, -0.0001676287f, -0.0002573385f, -0.0003377893f,
+ -0.0004079306f, -0.0004667485f, -0.0005133801f, -0.0005470765f, -0.0005673356f, -0.0005738781f, -0.0005667759f, -0.0005464152f,
+ -0.0005135934f, -0.0004694478f, -0.0004155042f, -0.0003535607f, -0.0002856874f, -0.0002140732f, -0.0001409939f, -0.0000686445f,
+ 0.0000008966f, 0.0000658187f, 0.0001245893f, 0.0001760633f, 0.0002194479f, 0.0002543579f, 0.0002807311f, 0.0002988367f,
+ 0.0003091550f, 0.0003123597f, 0.0003091881f, 0.0003004253f, 0.0002867930f, 0.0002689588f, 0.0002474626f, 0.0002227630f,
+ 0.0001952039f, 0.0001650929f, 0.0001326952f, 0.0000983261f, 0.0000623480f, 0.0000252528f, -0.0000123602f, -0.0000497334f,
+ -0.0000860060f, -0.0001202016f, -0.0001513162f, -0.0001783353f, -0.0002003408f, -0.0002165359f, -0.0002263463f, -0.0002294298f,
+ -0.0002257477f, -0.0002155386f, -0.0001993478f, -0.0001779591f, -0.0001523829f, -0.0001237555f, -0.0000933024f, -0.0000622262f,
+ -0.0000316695f, -0.0000026169f, 0.0000241191f, 0.0000479620f, 0.0000685482f, 0.0000857501f, 0.0000996158f, 0.0001103594f,
+ 0.0001182780f, 0.0001237279f, 0.0001270411f, 0.0001285109f, 0.0001283284f, 0.0001265953f, 0.0001232928f, 0.0001183261f,
+ 0.0001115250f, 0.0001027124f, 0.0000917214f, 0.0000784695f, 0.0000629720f, 0.0000454005f, 0.0000260736f, 0.0000054844f,
+ -0.0000157413f, -0.0000368512f, -0.0000570374f, -0.0000754661f, -0.0000913623f, -0.0001040431f, -0.0001129942f,
+ -0.0001518039f, -0.0001490944f, -0.0001437563f, -0.0001359447f, -0.0001258775f, -0.0001138183f, -0.0001000584f, -0.0000848958f,
+ -0.0000686184f, -0.0000514869f, -0.0000337271f, -0.0000155230f, 0.0000029786f, 0.0000216627f, 0.0000404299f, 0.0000591833f,
+ 0.0000778062f, 0.0000961486f, 0.0001140075f, 0.0001311212f, 0.0001471607f, 0.0001617373f, 0.0001744077f, 0.0001846979f,
+ 0.0001921197f, 0.0001962050f, 0.0001965285f, 0.0001927436f, 0.0001846019f, 0.0001719815f, 0.0001548948f, 0.0001335028f,
+ 0.0001081065f, 0.0000791461f, 0.0000471762f, 0.0000128542f, -0.0000230952f, -0.0000598950f, -0.0000967535f, -0.0001328756f,
+ -0.0001674945f, -0.0001998742f, -0.0002293319f, -0.0002552303f, -0.0002769922f, -0.0002940867f, -0.0003060409f, -0.0003124253f,
+ -0.0003128705f, -0.0003070572f, -0.0002947414f, -0.0002757524f, -0.0002500272f, -0.0002176130f, -0.0001787066f, -0.0001336551f,
+ -0.0000829924f, -0.0000274293f, 0.0000321218f, 0.0000945733f, 0.0001586548f, 0.0002229603f, 0.0002859566f, 0.0003460483f,
+ 0.0004015979f, 0.0004510007f, 0.0004927070f, 0.0005252984f, 0.0005475019f, 0.0005582587f, 0.0005567241f, 0.0005423236f,
+ 0.0005147357f, 0.0004739352f, 0.0004201606f, 0.0003539484f, 0.0002760880f, 0.0001876525f, 0.0000899450f, -0.0000154720f,
+ -0.0001268367f, -0.0002421597f, -0.0003592929f, -0.0004759036f, -0.0005895563f, -0.0006976915f, -0.0007977237f, -0.0008870259f,
+ -0.0009630432f, -0.0010232813f, -0.0010654313f, -0.0010873564f, -0.0010872233f, -0.0010634782f, -0.0010149807f, -0.0009409632f,
+ -0.0008411655f, -0.0007157758f, -0.0005655665f, -0.0003918178f, -0.0001964570f, 0.0000180385f, 0.0002485007f, 0.0004912017f,
+ 0.0007417257f, 0.0009951609f, 0.0012460131f, 0.0014884994f, 0.0017165405f, 0.0019242012f, 0.0021057906f, 0.0022564772f,
+ 0.0023724911f, 0.0024518980f, 0.0024948363f, 0.0025043647f, 0.0024865838f, 0.0024513953f, 0.0024122725f, 0.0023867094f,
+ 0.0023953488f, 0.0024618909f, 0.0026112876f, 0.0028689594f, 0.0032578396f, 0.0037969386f, 0.0044971599f, 0.0053595648f,
+ 0.0063700240f, 0.0074979980f, 0.0086900568f, 0.0098707813f, 0.0109344936f, 0.0117523261f, 0.0121588428f, 0.0119927747f,
+ 0.0108338004f, 0.0076669462f, 0.0015951619f, -0.0077015608f, -0.0201874668f, -0.0355062002f, -0.0530094339f, -0.0717877750f,
+ -0.0907221346f, -0.1085412898f, -0.1238936126f, -0.1354215686f, -0.1418421064f, -0.1420235850f, -0.1350600376f, -0.1203351392f,
+ -0.0975759142f, -0.0668903695f, -0.0287893898f, 0.0158109005f, 0.0656049927f, 0.1189337419f, 0.1738373906f, 0.2281255290f,
+ 0.2794600956f, 0.3254494085f, 0.3637483740f, 0.3921617568f, 0.4087452458f, 0.4119008001f, 0.4004612717f, 0.3737611396f,
+ 0.3316892920f, 0.2747217255f, 0.2039316066f, 0.1209761088f, 0.0280593378f, -0.0721274395f, -0.1764869974f, -0.2816158102f,
+ -0.3839191559f, -0.4797372694f, -0.5654782669f, -0.6377526073f, -0.6935042311f, -0.7301330421f, -0.7456040786f, -0.7385387273f,
+ -0.7082842960f, -0.6549586998f, -0.5794681743f, -0.4834966938f, -0.3694669951f, -0.2404740552f, -0.1001929952f, 0.0472356415f,
+ 0.1973394347f, 0.3454617961f, 0.4869187455f, 0.6171590292f, 0.7319219537f, 0.8273869572f, 0.9003096301f, 0.9481388242f,
+ 0.9691107389f, 0.9623160652f, 0.9277378915f, 0.8662587282f, 0.7796363134f, 0.6704507997f, 0.5420235210f, 0.3983429587f,
+ 0.2439770306f, 0.0835515600f, -0.0785437339f, -0.2379253926f, -0.3902709949f, -0.5314762215f, -0.6577657562f, -0.7658017175f,
+ -0.8527727865f, -0.9164711922f, -0.9553496178f, -0.9685606622f, -0.9559747754f, -0.9181785555f, -0.8564517514f, -0.7727251920f,
+ -0.6695198086f, -0.5498696134f, -0.4172301964f, -0.2753762088f, -0.1282903603f, 0.0199522336f, 0.1653013209f, 0.3038465453f,
+ 0.4319271716f, 0.5462330255f, 0.6438939828f, 0.7225552652f, 0.7804366545f, 0.8163739029f, 0.8298414763f, 0.8209560951f,
+ 0.7904613476f, 0.7396940415f, 0.6705336701f, 0.5853367342f, 0.4868582109f, 0.3781627335f, 0.2625283931f, 0.1433461974f,
+ 0.0240183452f, -0.0921415681f, -0.2020034062f, -0.3027076056f, -0.3917420558f, -0.4670065944f, -0.5268634348f, -0.5701722713f,
+ -0.5963093708f, -0.6051704118f, -0.5971574290f, -0.5731506218f, -0.5344663552f, -0.4828029698f, -0.4201764962f, -0.3488485038f,
+ -0.2712486558f, -0.1898944962f, -0.1073111782f, -0.0259536082f, 0.0518664854f, 0.1240464667f, 0.1887496815f, 0.2444518757f,
+ 0.2899758594f, 0.3245137882f, 0.3476366187f, 0.3592909899f, 0.3597839221f, 0.3497564092f, 0.3301470195f, 0.3021472383f,
+ 0.2671501836f, 0.2266948496f, 0.1824077493f, 0.1359442498f, 0.0889314191f, 0.0429145298f, -0.0006912934f, -0.0406425334f,
+ -0.0759009165f, -0.1056580541f, -0.1293508553f, -0.1466672055f, -0.1575424230f, -0.1621466320f, -0.1608642639f, -0.1542663510f,
+ -0.1430773876f, -0.1281377523f, -0.1103638299f, -0.0907069045f, -0.0701130981f, -0.0494852310f, -0.0296487968f, -0.0113224665f,
+ 0.0049049322f, 0.0185912359f, 0.0294499482f, 0.0373525686f, 0.0423229093f, 0.0445255530f, 0.0442471860f, 0.0418741009f,
+ 0.0378642492f, 0.0327185225f, 0.0269484800f, 0.0210472303f, 0.0154578360f, 0.0105498876f, 0.0065912187f, 0.0037323571f,
+ 0.0018671281f, 0.0006505029f, -0.0001484215f, -0.0006222332f, -0.0008521845f, -0.0009057969f, -0.0008424506f, -0.0007103595f,
+ -0.0005491202f, -0.0003884807f, -0.0002503188f, -0.0001485007f, -0.0000907440f, -0.0000790482f, -0.0001114146f, -0.0001824655f,
+ -0.0002849020f, -0.0004100554f, -0.0005489962f, -0.0006928821f, -0.0008336988f, -0.0009643687f, -0.0010791665f, -0.0011736223f,
+ -0.0012446927f, -0.0012905298f, -0.0013105005f, -0.0013048967f, -0.0012748875f, -0.0012222325f, -0.0011492257f, -0.0010584505f,
+ -0.0009527473f, -0.0008350241f, -0.0007082563f, -0.0005753473f, -0.0004391546f, -0.0003023856f, -0.0001676358f, -0.0000373054f,
+ 0.0000863632f, 0.0002013598f, 0.0003058750f, 0.0003983709f, 0.0004775550f, 0.0005424460f, 0.0005923474f, 0.0006269020f,
+ 0.0006460595f, 0.0006501134f, 0.0006396557f, 0.0006155940f, 0.0005790906f, 0.0005315601f, 0.0004745961f, 0.0004099540f,
+ 0.0003394710f, 0.0002650418f, 0.0001885408f, 0.0001117995f, 0.0000365379f, -0.0000356487f, -0.0001033434f, -0.0001653071f,
+ -0.0002205157f, -0.0002681453f, -0.0003075938f, -0.0003384554f, -0.0003605306f, -0.0003737941f, -0.0003783989f, -0.0003746427f,
+ -0.0003629698f, -0.0003439392f, -0.0003182272f, -0.0002865979f, -0.0002499066f, -0.0002090714f, -0.0001650754f, -0.0001189372f,
+ -0.0000717098f, -0.0000244485f, 0.0000217960f, 0.0000660121f, 0.0001072384f, 0.0001445996f, 0.0001773182f, 0.0002047476f,
+ 0.0002263802f, 0.0002418727f, 0.0002510450f, 0.0002538948f, 0.0002505843f, 0.0002414409f, 0.0002269326f, 0.0002076567f,
+ 0.0001843057f, 0.0001576490f, 0.0001284948f, 0.0000976709f, 0.0000659883f, 0.0000342273f, 0.0000031084f, -0.0000267131f,
+ -0.0000546656f, -0.0000802581f, -0.0001030882f, -0.0001228320f, -0.0001392462f, -0.0001521538f, -0.0001614454f, -0.0001670654f,
+ -0.0001690150f, -0.0001673428f, -0.0001621512f, -0.0001535906f, -0.0001418693f, -0.0001272490f, -0.0001100543f, -0.0000906661f,
+ -0.0000695268f, -0.0000471286f, -0.0000240107f, -0.0000007413f, 0.0000220928f, 0.0000439109f, 0.0000641527f, 0.0000823053f,
+ 0.0000979177f, 0.0001106244f, 0.0001201540f, 0.0001263447f, 0.0001291432f, 0.0001286087f, 0.0001249010f, 0.0001182738f,
+ -0.0000677642f, -0.0000523826f, -0.0000355858f, -0.0000177135f, 0.0000008632f, 0.0000197497f, 0.0000385362f, 0.0000568069f,
+ 0.0000741490f, 0.0000901630f, 0.0001044714f, 0.0001167282f, 0.0001266271f, 0.0001339090f, 0.0001383682f, 0.0001398580f,
+ 0.0001382933f, 0.0001336542f, 0.0001259858f, 0.0001153988f, 0.0001020662f, 0.0000862221f, 0.0000681561f, 0.0000482094f,
+ 0.0000267679f, 0.0000042570f, -0.0000188674f, -0.0000421254f, -0.0000650225f, -0.0000870579f, -0.0001077348f, -0.0001265690f,
+ -0.0001431007f, -0.0001569032f, -0.0001675946f, -0.0001748464f, -0.0001783945f, -0.0001780466f, -0.0001736910f, -0.0001653012f,
+ -0.0001529419f, -0.0001367694f, -0.0001170335f, -0.0000940728f, -0.0000683121f, -0.0000402526f, -0.0000104645f, 0.0000204271f,
+ 0.0000517530f, 0.0000828177f, 0.0001129118f, 0.0001413312f, 0.0001673905f, 0.0001904409f, 0.0002098828f, 0.0002251816f,
+ 0.0002358781f, 0.0002416012f, 0.0002420750f, 0.0002371285f, 0.0002266990f, 0.0002108387f, 0.0001897144f, 0.0001636105f,
+ 0.0001329251f, 0.0000981694f, 0.0000599596f, 0.0000190121f, -0.0000238695f, -0.0000678035f, -0.0001118486f, -0.0001550177f,
+ -0.0001963012f, -0.0002346852f, -0.0002691787f, -0.0002988340f, -0.0003227757f, -0.0003402211f, -0.0003505078f, -0.0003531107f,
+ -0.0003476646f, -0.0003339751f, -0.0003120340f, -0.0002820207f, -0.0002443090f, -0.0001994588f, -0.0001482132f, -0.0000914813f,
+ -0.0000303277f, 0.0000340527f, 0.0001003514f, 0.0001671757f, 0.0002330697f, 0.0002965468f, 0.0003561116f, 0.0004102952f,
+ 0.0004576768f, 0.0004969199f, 0.0005267939f, 0.0005462097f, 0.0005542410f, 0.0005501582f, 0.0005334466f, 0.0005038372f,
+ 0.0004613187f, 0.0004061612f, 0.0003389189f, 0.0002604423f, 0.0001718676f, 0.0000746148f, -0.0000296392f, -0.0001389767f,
+ -0.0002512831f, -0.0003642749f, -0.0004755563f, -0.0005826556f, -0.0006830878f, -0.0007743933f, -0.0008542007f, -0.0009202618f,
+ -0.0009705111f, -0.0010030942f, -0.0010164239f, -0.0010092036f, -0.0009804838f, -0.0009296846f, -0.0008566574f, -0.0007617096f,
+ -0.0006456731f, -0.0005099278f, -0.0003564679f, -0.0001879096f, -0.0000075330f, 0.0001807554f, 0.0003724395f, 0.0005625175f,
+ 0.0007456177f, 0.0009162481f, 0.0010690442f, 0.0011991672f, 0.0013026871f, 0.0013771151f, 0.0014218793f, 0.0014389208f,
+ 0.0014331600f, 0.0014130261f, 0.0013907522f, 0.0013826603f, 0.0014090891f, 0.0014942408f, 0.0016655626f, 0.0019530043f,
+ 0.0023877813f, 0.0030010282f, 0.0038221874f, 0.0048773753f, 0.0061889900f, 0.0077755997f, 0.0096751224f, 0.0119741302f,
+ 0.0145439912f, 0.0169456183f, 0.0187073400f, 0.0194030360f, 0.0186550704f, 0.0161628228f, 0.0117223361f, 0.0052458122f,
+ -0.0032269514f, -0.0135216735f, -0.0253307510f, -0.0382203402f, -0.0516449105f, -0.0649674012f, -0.0774853341f, -0.0884609329f,
+ -0.0971548077f, -0.1028611423f, -0.1049434729f, -0.1028690049f, -0.0962403901f, -0.0848231076f, -0.0685674901f, -0.0476239362f,
+ -0.0223507100f, 0.0066865637f, 0.0387237751f, 0.0728157951f, 0.1078619795f, 0.1426392416f, 0.1758415350f, 0.2061246656f,
+ 0.2321547755f, 0.2526589705f, 0.2664761293f, 0.2726061478f, 0.2702555997f, 0.2588781212f, 0.2382077111f, 0.2082835801f,
+ 0.1694652065f, 0.1224367910f, 0.0682004341f, 0.0080579540f, -0.0564185505f, -0.1234266811f, -0.1909833663f, -0.2569826708f,
+ -0.3192601922f, -0.3756619825f, -0.4241159008f, -0.4627029725f, -0.4897264437f, -0.5037760457f, -0.5037852577f, -0.4890793474f,
+ -0.4594123986f, -0.4149916704f, -0.3564881936f, -0.2850327525f, -0.2021970477f, -0.1099601299f, -0.0106608717f, 0.0930624757f,
+ 0.1983439454f, 0.3021708437f, 0.4014716150f, 0.4932080681f, 0.5744690342f, 0.6425626416f, 0.6951041455f, 0.7300965662f,
+ 0.7460013189f, 0.7417965309f, 0.7170208283f, 0.6718010612f, 0.6068626327f, 0.5235219179f, 0.4236604995f, 0.3096818407f,
+ 0.1844512322f, 0.0512207469f, -0.0864589501f, -0.2248372460f, -0.3600700554f, -0.4883307618f, -0.6059225628f, -0.7093885522f,
+ -0.7956164474f, -0.8619344004f, -0.9061952044f, -0.9268458353f, -0.9229804407f, -0.8943745512f, -0.8414997451f, -0.7655175933f,
+ -0.6682534406f, -0.5521499681f, -0.4202024874f, -0.2758769248f, -0.1230137793f, 0.0342802674f, 0.1917486212f, 0.3451070280f,
+ 0.4901663081f, 0.6229542130f, 0.7398298367f, 0.8375910214f, 0.9135663759f, 0.9656969770f, 0.9925961604f, 0.9936618731f,
+ 0.9690844417f, 0.9196504635f, 0.8467117373f, 0.7522210603f, 0.6386799560f, 0.5090760386f, 0.3668025779f, 0.2155702981f,
+ 0.0593086479f, -0.0979369079f, -0.2521117236f, -0.3992577525f, -0.5356173001f, -0.6577304376f, -0.7625247715f, -0.8473940864f,
+ -0.9102647317f, -0.9496471895f, -0.9646722171f, -0.9551100144f, -0.9213725472f, -0.8644985297f, -0.7861220221f, -0.6884251575f,
+ -0.5740767467f, -0.4461581538f, -0.3080788471f, -0.1634836803f, -0.0161547423f, 0.1300897818f, 0.2714967454f, 0.4044766502f,
+ 0.5256968794f, 0.6321672656f, 0.7213155657f, 0.7910510602f, 0.8398145087f, 0.8666133944f, 0.8710415117f, 0.8532826677f,
+ 0.8140984457f, 0.7548006627f, 0.6772093367f, 0.5835975864f, 0.4766250203f, 0.3592616720f, 0.2347045793f, 0.1062894680f,
+ -0.0226000741f, -0.1486233373f, -0.2685707508f, -0.3794472128f, -0.4785483597f, -0.5635277262f, -0.6324531653f, -0.6838510882f,
+ -0.7167375675f, -0.7306356074f, -0.7255783918f, -0.7020986046f, -0.6612044089f, -0.6043429290f, -0.5333525140f, -0.4504052564f,
+ -0.3579415767f, -0.2585987895f, -0.1551357820f, -0.0503559257f, 0.0529695663f, 0.1521757603f, 0.2447735547f, 0.3285128639f,
+ 0.4014377748f, 0.4619323450f, 0.5087559395f, 0.5410673824f, 0.5584374718f, 0.5608498058f, 0.5486901404f, 0.5227248799f,
+ 0.4840695396f, 0.4341483415f, 0.3746462780f, 0.3074552135f, 0.2346156774f, 0.1582561348f, 0.0805315031f, 0.0035627058f,
+ -0.0706210625f, -0.1401357650f, -0.2032902555f, -0.2586270896f, -0.3049554547f, -0.3413754822f, -0.3672935096f, -0.3824281003f,
+ -0.3868069422f, -0.3807549745f, -0.3648743722f, -0.3400172139f, -0.3072518737f, -0.2678243125f, -0.2231155831f, -0.1745969158f,
+ -0.1237838039f, -0.0721904757f, -0.0212861041f, 0.0275460057f, 0.0730451234f, 0.1141047432f, 0.1497983924f, 0.1793990348f,
+ 0.2023917050f, 0.2184792403f, 0.2275811871f, 0.2298261737f, 0.2255382274f, 0.2152176942f, 0.1995175598f, 0.1792160900f,
+ 0.1551867943f, 0.1283667617f, 0.0997244393f, 0.0702278948f, 0.0408145632f, 0.0123633806f, -0.0143298873f, -0.0385734628f,
+ -0.0597959924f, -0.0775582602f, -0.0915599770f, -0.1016416466f, -0.1077816401f, -0.1100888003f, -0.1087910023f, -0.1042202530f,
+ -0.0967949724f, -0.0870002132f, -0.0753665756f, -0.0624486407f, -0.0488036800f, -0.0349714234f, -0.0214555345f, -0.0087074338f,
+ 0.0028870743f, 0.0130179511f, 0.0214576480f, 0.0280642424f, 0.0327810674f, 0.0356329290f, 0.0367192621f, 0.0362045427f,
+ 0.0343065259f, 0.0312827821f, 0.0274162441f, 0.0230002982f, 0.0183241826f, 0.0136591847f, 0.0092463500f, 0.0052860575f,
+ 0.0019300215f, -0.0007241258f, -0.0026354098f, -0.0038192546f, -0.0043449892f, -0.0043308242f, -0.0039467893f, -0.0034183427f,
+ -0.0028980777f, -0.0024111931f, -0.0019661658f, -0.0015766458f, -0.0012505436f, -0.0009916652f, -0.0007991070f, -0.0006687325f,
+ -0.0005935987f, -0.0005651424f, -0.0005737315f, -0.0006095407f, -0.0006629742f, -0.0007252278f, -0.0007885086f, -0.0008463178f,
+ -0.0008934778f, -0.0009262011f, -0.0009419761f, -0.0009394996f, -0.0009184875f, -0.0008795438f, -0.0008239543f, -0.0007535478f,
+ -0.0006705140f, -0.0005772899f, -0.0004764213f, -0.0003704871f, -0.0002620058f, -0.0001533948f, -0.0000469126f, 0.0000553574f,
+ 0.0001515421f, 0.0002399825f, 0.0003192564f, 0.0003881782f, 0.0004458153f, 0.0004914859f, 0.0005247706f, 0.0005455066f,
+ 0.0005537921f, 0.0005499733f, 0.0005346385f, 0.0005085956f, 0.0004728546f, 0.0004285952f, 0.0003771392f, 0.0003199107f,
+ 0.0002584034f, 0.0001941376f, 0.0001286276f, 0.0000633423f, -0.0000003230f, -0.0000610784f, -0.0001177585f, -0.0001693439f,
+ -0.0002149716f, -0.0002539451f, -0.0002857364f, -0.0003099879f, -0.0003265074f, -0.0003352642f, -0.0003363800f, -0.0003301214f,
+ -0.0003168882f, -0.0002972036f, -0.0002717009f, -0.0002411115f, -0.0002062492f, -0.0001679960f, -0.0001272837f, -0.0000850767f,
+ -0.0000423512f, -0.0000000757f, 0.0000408118f, 0.0000794235f, 0.0001149437f, 0.0001466472f, 0.0001739170f, 0.0001962578f,
+ 0.0002133072f, 0.0002248417f, 0.0002307793f, 0.0002311773f, 0.0002262259f, 0.0002162377f, 0.0002016344f, 0.0001829302f,
+ 0.0001607141f, 0.0001356302f, 0.0001083590f, 0.0000795981f, 0.0000500456f, 0.0000203831f, -0.0000087366f, -0.0000367025f,
+ -0.0000629538f, -0.0000869878f, -0.0001083652f, -0.0001267149f, -0.0001417362f, -0.0001532019f, -0.0001609587f, -0.0001649294f,
+ -0.0001651125f, -0.0001615824f, -0.0001544884f, -0.0001440526f, -0.0001305669f, -0.0001143883f, -0.0000959318f, -0.0000756626f,
+ -0.0000540855f, -0.0000317331f, -0.0000091523f, 0.0000131100f, 0.0000345222f, 0.0000545822f, 0.0000728319f, 0.0000888696f,
+ 0.0001023607f, 0.0001130460f, 0.0001207471f, 0.0001253683f, 0.0001268968f, 0.0001253988f, 0.0001210137f, 0.0001139460f,
+ -0.0000409890f, -0.0000231831f, -0.0000044979f, 0.0000146405f, 0.0000337894f, 0.0000524983f, 0.0000703210f, 0.0000868245f,
+ 0.0001016007f, 0.0001142746f, 0.0001245146f, 0.0001320387f, 0.0001366230f, 0.0001381059f, 0.0001363940f, 0.0001314632f,
+ 0.0001233624f, 0.0001122120f, 0.0000982042f, 0.0000815988f, 0.0000627207f, 0.0000419531f, 0.0000197321f, -0.0000034635f,
+ -0.0000271191f, -0.0000506974f, -0.0000736478f, -0.0000954205f, -0.0001154773f, -0.0001333068f, -0.0001484351f, -0.0001604403f,
+ -0.0001689621f, -0.0001737145f, -0.0001744920f, -0.0001711796f, -0.0001637549f, -0.0001522934f, -0.0001369666f, -0.0001180419f,
+ -0.0000958757f, -0.0000709093f, -0.0000436571f, -0.0000146989f, 0.0000153358f, 0.0000457778f, 0.0000759362f, 0.0001051099f,
+ 0.0001326066f, 0.0001577542f, 0.0001799192f, 0.0001985179f, 0.0002130330f, 0.0002230225f, 0.0002281351f, 0.0002281154f,
+ 0.0002228168f, 0.0002122035f, 0.0001963592f, 0.0001754845f, 0.0001499022f, 0.0001200490f, 0.0000864751f, 0.0000498314f,
+ 0.0000108634f, -0.0000296076f, -0.0000706952f, -0.0001114718f, -0.0001509832f, -0.0001882759f, -0.0002224138f, -0.0002525068f,
+ -0.0002777271f, -0.0002973368f, -0.0003107015f, -0.0003173138f, -0.0003168019f, -0.0003089482f, -0.0002936908f, -0.0002711354f,
+ -0.0002415497f, -0.0002053687f, -0.0001631812f, -0.0001157294f, -0.0000638885f, -0.0000086610f, 0.0000488496f, 0.0001074488f,
+ 0.0001658824f, 0.0002228496f, 0.0002770388f, 0.0003271423f, 0.0003718955f, 0.0004100930f, 0.0004406281f, 0.0004625082f,
+ 0.0004748944f, 0.0004771120f, 0.0004686867f, 0.0004493486f, 0.0004190617f, 0.0003780176f, 0.0003266564f, 0.0002656483f,
+ 0.0001959041f, 0.0001185450f, 0.0000349034f, -0.0000535185f, -0.0001450543f, -0.0002379235f, -0.0003302403f, -0.0004200698f,
+ -0.0005054364f, -0.0005843853f, -0.0006549896f, -0.0007154171f, -0.0007639381f, -0.0007990015f, -0.0008192451f, -0.0008235853f,
+ -0.0008112325f, -0.0007817958f, -0.0007353001f, -0.0006723017f, -0.0005938949f, -0.0005018237f, -0.0003984545f, -0.0002868589f,
+ -0.0001707179f, -0.0000543437f, 0.0000575249f, 0.0001597921f, 0.0002473552f, 0.0003152810f, 0.0003593211f, 0.0003761803f,
+ 0.0003641895f, 0.0003236064f, 0.0002574060f, 0.0001714998f, 0.0000755882f, -0.0000168765f, -0.0000877911f, -0.0001149323f,
+ -0.0000708145f, 0.0000759664f, 0.0003632082f, 0.0008340171f, 0.0015932147f, 0.0027965684f, 0.0044938862f, 0.0066209827f,
+ 0.0090614394f, 0.0116532691f, 0.0142012098f, 0.0164868538f, 0.0182824288f, 0.0193635282f, 0.0195233202f, 0.0185852780f,
+ 0.0164156862f, 0.0129338578f, 0.0081207820f, 0.0020247377f, -0.0052355839f, -0.0134714261f, -0.0224272216f, -0.0317873061f,
+ -0.0411854169f, -0.0502171478f, -0.0584545493f, -0.0654627361f, -0.0708175739f, -0.0741240923f, -0.0750346389f, -0.0732663141f,
+ -0.0686167330f, -0.0609776578f, -0.0503456776f, -0.0368295907f, -0.0206538852f, -0.0021581782f, 0.0182077069f, 0.0398928946f,
+ 0.0622588452f, 0.0845965541f, 0.1061472474f, 0.1261258801f, 0.1437468496f, 0.1582510183f, 0.1689332690f, 0.1751695690f,
+ 0.1764426874f, 0.1723655442f, 0.1627013795f, 0.1473798510f, 0.1265084200f, 0.1003783769f, 0.0694651504f, 0.0344225859f,
+ -0.0039288047f, -0.0446195451f, -0.0865544564f, -0.1285410062f, -0.1693219800f, -0.2076116501f, -0.2421343744f, -0.2716645414f,
+ -0.2950666012f, -0.3113339711f, -0.3196255083f, -0.3192983638f, -0.3099360208f, -0.2913705151f, -0.2636979059f, -0.2272863207f,
+ -0.1827760335f, -0.1310713384f, -0.0733241526f, -0.0109096078f, 0.0546059294f, 0.1215036544f, 0.1879570196f, 0.2520811416f,
+ 0.3119856181f, 0.3658292498f, 0.4118751262f, 0.4485444179f, 0.4744672713f, 0.4885291873f, 0.4899114116f, 0.4781239515f,
+ 0.4530300662f, 0.4148612531f, 0.3642220549f, 0.3020842490f, 0.2297703310f, 0.1489264657f, 0.0614854435f, -0.0303795649f,
+ -0.1243093268f, -0.2178195955f, -0.3083672722f, -0.3934199265f, -0.4705267388f, -0.5373888894f, -0.5919273479f, -0.6323460927f,
+ -0.6571888364f, -0.6653875249f, -0.6563010343f, -0.6297427848f, -0.5859962378f, -0.5258176130f, -0.4504254723f, -0.3614772269f,
+ -0.2610329551f, -0.1515073286f, -0.0356107555f, 0.0837187871f, 0.2033915080f, 0.3202471384f, 0.4311396943f, 0.5330233362f,
+ 0.6230369707f, 0.6985851980f, 0.7574133141f, 0.7976741718f, 0.8179849388f, 0.8174720079f, 0.7958026627f, 0.7532024103f,
+ 0.6904573239f, 0.6089011023f, 0.5103870229f, 0.3972453408f, 0.2722271452f, 0.1384360281f, -0.0007506793f, -0.1417690856f,
+ -0.2809620112f, -0.4146758861f, -0.5393586304f, -0.6516558729f, -0.7485028256f, -0.8272092868f, -0.8855353494f, -0.9217556888f,
+ -0.9347105366f, -0.9238418625f, -0.8892136169f, -0.8315153830f, -0.7520491685f, -0.6526996069f, -0.5358882111f, -0.4045128580f,
+ -0.2618739995f, -0.1115895724f, 0.0424992034f, 0.1964285728f, 0.3462168980f, 0.4879703230f, 0.6179866516f, 0.7328545277f,
+ 0.8295452782f, 0.9054947981f, 0.9586733060f, 0.9876409196f, 0.9915876025f, 0.9703562358f, 0.9244482541f, 0.8550115930f,
+ 0.7638112998f, 0.6531839260f, 0.5259766298f, 0.3854793593f, 0.2353470917f, 0.0794266997f, -0.0783736011f, -0.2341094912f,
+ -0.3838855272f, -0.5239604170f, -0.6508401618f, -0.7613664334f, -0.8527950879f, -0.9228648741f, -0.9698533854f, -0.9926197484f,
+ -0.9906323266f, -0.9639812550f, -0.9133750995f, -0.8401220648f, -0.7460959702f, -0.6336880996f, -0.5057459675f, -0.3655007408f,
+ -0.2164850263f, -0.0624432571f, 0.0927631497f, 0.2452533396f, 0.3912248813f, 0.5270493663f, 0.6493633998f, 0.7551526079f,
+ 0.8418266049f, 0.9072829806f, 0.9499587608f, 0.9688680208f, 0.9636247817f, 0.9344506105f, 0.8821668237f, 0.8081715061f,
+ 0.7144020216f, 0.6032839905f, 0.4776681160f, 0.3407564859f, 0.1960202987f, 0.0471111158f, -0.1022320452f, -0.2482774188f,
+ -0.3873945568f, -0.5161453835f, -0.6313699144f, -0.7302645031f, -0.8104506434f, -0.8700326423f, -0.9076427350f, -0.9224725808f,
+ -0.9142903937f, -0.8834433701f, -0.8308454204f, -0.7579506175f, -0.6667131091f, -0.5595346127f, -0.4392008921f, -0.3088089180f,
+ -0.1716866150f, -0.0313073005f, 0.1087989808f, 0.2451349347f, 0.3743240333f, 0.4931948249f, 0.5988594260f, 0.6887842282f,
+ 0.7608510829f, 0.8134074688f, 0.8453044545f, 0.8559215759f, 0.8451781058f, 0.8135305285f, 0.7619564059f, 0.6919251500f,
+ 0.6053565671f, 0.5045683259f, 0.3922137963f, 0.2712119195f, 0.1446709795f, 0.0158082697f, -0.1121322505f, -0.2359621952f,
+ -0.3526287795f, -0.4592906218f, -0.5533874164f, -0.6327017647f, -0.6954116543f, -0.7401323484f, -0.7659467130f, -0.7724233338f,
+ -0.7596220816f, -0.7280871206f, -0.6788276697f, -0.6132871451f, -0.5333015981f, -0.4410486347f, -0.3389882280f, -0.2297970351f,
+ -0.1162979714f, -0.0013869076f, 0.1120416061f, 0.2211676650f, 0.3233165238f, 0.4160245192f, 0.4970987736f, 0.5646692200f,
+ 0.6172317171f, 0.6536812560f, 0.6733345403f, 0.6759414941f, 0.6616855531f, 0.6311728784f, 0.5854109229f, 0.5257770441f,
+ 0.4539781120f, 0.3720022713f, 0.2820642158f, 0.1865454701f, 0.0879312930f, -0.0112541288f, -0.1085124968f, -0.2014345624f,
+ -0.2877600257f, -0.3654326821f, -0.4326494615f, -0.4879021964f, -0.5300111477f, -0.5581495604f, -0.5718587503f, -0.5710534933f,
+ -0.5560177281f, -0.5273908494f, -0.4861450978f, -0.4335547859f, -0.3711582904f, -0.3007139250f, -0.2241509378f, -0.1435169935f,
+ -0.0609235618f, 0.0215093313f, 0.1017075454f, 0.1776950580f, 0.2476426746f, 0.3099120105f, 0.3630936929f, 0.4060388941f,
+ 0.4378835058f, 0.4580644620f, 0.4663279432f, 0.4627294004f, 0.4476255675f, 0.4216588257f, 0.3857344863f, 0.3409917280f,
+ 0.2887690825f, 0.2305654810f, 0.1679979813f, 0.1027573461f, 0.0365626923f, -0.0288835867f, -0.0919394404f, -0.1510642130f,
+ -0.2048561002f, -0.2520851099f, -0.2917207545f, -0.3229538699f, -0.3452121154f, -0.3581688961f, -0.3617456210f, -0.3561073997f,
+ -0.3416524423f, -0.3189955996f, -0.2889466186f, -0.2524838235f, -0.2107240303f, -0.1648895947f, -0.1162735377f, -0.0662037318f,
+ -0.0160071241f, 0.0330250452f, 0.0796701284f, 0.1228042256f, 0.1614288774f, 0.1946936678f, 0.2219142443f, 0.2425853919f,
+ 0.2563889487f, 0.2631964891f, 0.2630668532f, 0.2562387302f, 0.2431186436f, 0.2242647892f, 0.2003672939f, 0.1722255274f,
+ 0.1407231814f, 0.1068018529f, 0.0714339071f, 0.0355953755f, 0.0002396385f, -0.0337274180f, -0.0654701262f, -0.0942430905f,
+ -0.1194080954f, -0.1404475082f, -0.1569739116f, -0.1687358288f, -0.1756195042f, -0.1776468257f, -0.1749695713f, -0.1678602690f,
+ -0.1567000359f, -0.1419638484f, -0.1242037381f, -0.1040304695f, -0.0820942616f, -0.0590651422f, -0.0356134981f, -0.0123913771f,
+ 0.0099849609f, 0.0309507800f, 0.0500065129f, 0.0667289886f, 0.0807800207f, 0.0919121972f, 0.0999718200f, 0.1048990098f,
+ 0.1067250926f, 0.1055674412f, 0.1016220359f, 0.0951540418f, 0.0864867765f, 0.0759894469f, 0.0640640860f, 0.0511321002f,
+ 0.0376208624f, 0.0239507391f, 0.0105229429f, -0.0022914718f, -0.0141611639f, -0.0248023986f, -0.0339850878f, -0.0415368905f,
+ -0.0473453103f, -0.0513578334f, -0.0535801684f, -0.0540727489f, -0.0529456678f, -0.0503522968f, -0.0464818329f, -0.0415510875f,
+ -0.0357957930f, -0.0294617627f, -0.0227961726f, -0.0160392815f, -0.0094168137f, -0.0031332654f, 0.0026337157f, 0.0077376956f,
+ 0.0120665112f, 0.0155439285f, 0.0181299546f, 0.0198198008f, 0.0206416522f, 0.0206533153f, 0.0199379832f, 0.0185992414f,
+ 0.0167556135f, 0.0145347842f, 0.0120678335f, 0.0094835966f, 0.0069034859f, 0.0044368299f, 0.0021770482f, 0.0001986183f,
+ -0.0014448717f, -0.0027217639f, -0.0036221831f, -0.0041570536f, -0.0043559653f, -0.0042644747f, -0.0039403827f, -0.0034499387f,
+ -0.0028631090f, -0.0022496331f, -0.0016738218f, -0.0011929502f, -0.0008370454f, -0.0005846760f, -0.0004048972f, -0.0002842065f,
+ -0.0002119725f, -0.0001785258f, -0.0001746762f, -0.0001920559f, -0.0002230524f, -0.0002610877f, -0.0003005688f, -0.0003370221f,
+ -0.0003669912f, -0.0003880546f, -0.0003986770f, -0.0003981548f, -0.0003864480f, -0.0003640945f, -0.0003320500f, -0.0002916028f,
+ -0.0002442394f, -0.0001915781f, -0.0001352688f, -0.0000769517f, -0.0000181891f, 0.0000395524f, 0.0000949441f, 0.0001467973f,
+ 0.0001940871f, 0.0002359457f, 0.0002716760f, 0.0003007405f, 0.0003227698f, 0.0003375491f, 0.0003450236f, 0.0003452833f,
+ 0.0003385643f, 0.0003252319f, 0.0003057766f, 0.0002807946f, 0.0002509791f, 0.0002170975f, 0.0001799788f, 0.0001404893f,
+ 0.0000995183f, 0.0000579532f, 0.0000166659f, -0.0000235093f, -0.0000617873f, -0.0000974508f, -0.0001298571f, -0.0001584526f,
+ -0.0001827754f, -0.0002024649f, -0.0002172605f, -0.0002270070f, -0.0002316506f, -0.0002312399f, -0.0002259201f, -0.0002159308f,
+ -0.0002015976f, -0.0001833276f, -0.0001615981f, -0.0001369497f, -0.0001099729f, -0.0000812980f, -0.0000515797f, -0.0000214856f,
+ 0.0000083213f, 0.0000371946f, 0.0000645215f, 0.0000897344f, 0.0001123264f, 0.0001318594f, 0.0001479763f, 0.0001604052f,
+ 0.0001689663f, 0.0001735714f, 0.0001742252f, 0.0001710200f, 0.0001641324f, 0.0001538135f, 0.0001403825f, 0.0001242143f,
+ 0.0001057308f, 0.0000853884f, 0.0000636683f, 0.0000410646f, 0.0000180754f, -0.0000048078f, -0.0000271075f, -0.0000483697f,
+ -0.0000681699f, -0.0000861206f, -0.0001018770f, -0.0001151429f, -0.0001256753f, -0.0001332891f, -0.0001378602f, -0.0001393293f,
+ -0.0001377022f, -0.0001330520f, -0.0001255166f, -0.0001152976f, -0.0001026555f, -0.0000879046f, -0.0000714049f, -0.0000535546f,
+ -0.0000347786f, -0.0000155193f, 0.0000037762f, 0.0000226667f, 0.0000407288f, 0.0000575664f, 0.0000728215f, 0.0000861808f,
+ 0.0000582411f, 0.0000747547f, 0.0000898871f, 0.0001032552f, 0.0001145066f, 0.0001233290f, 0.0001294588f, 0.0001326885f,
+ 0.0001328735f, 0.0001299377f, 0.0001238768f, 0.0001147609f, 0.0001027340f, 0.0000880132f, 0.0000708843f, 0.0000516966f,
+ 0.0000308558f, 0.0000088150f, -0.0000139353f, -0.0000368781f, -0.0000594822f, -0.0000812142f, -0.0001015508f, -0.0001199912f,
+ -0.0001360692f, -0.0001493631f, -0.0001595073f, -0.0001661997f, -0.0001692106f, -0.0001683879f, -0.0001636621f, -0.0001550493f,
+ -0.0001426526f, -0.0001266610f, -0.0001073481f, -0.0000850672f, -0.0000602464f, -0.0000333807f, -0.0000050232f, 0.0000242254f,
+ 0.0000537286f, 0.0000828270f, 0.0001108523f, 0.0001371418f, 0.0001610527f, 0.0001819781f, 0.0001993603f, 0.0002127056f,
+ 0.0002215967f, 0.0002257043f, 0.0002247967f, 0.0002187482f, 0.0002075440f, 0.0001912841f, 0.0001701836f, 0.0001445712f,
+ 0.0001148842f, 0.0000816622f, 0.0000455367f, 0.0000072204f, -0.0000325082f, -0.0000728185f, -0.0001128466f, -0.0001517120f,
+ -0.0001885378f, -0.0002224679f, -0.0002526873f, -0.0002784386f, -0.0002990404f, -0.0003139008f, -0.0003225330f, -0.0003245650f,
+ -0.0003197504f, -0.0003079739f, -0.0002892583f, -0.0002637651f, -0.0002317973f, -0.0001937968f, -0.0001503441f, -0.0001021521f,
+ -0.0000500632f, 0.0000049600f, 0.0000618411f, 0.0001194039f, 0.0001763844f, 0.0002314533f, 0.0002832366f, 0.0003303508f,
+ 0.0003714378f, 0.0004052165f, 0.0004305340f, 0.0004464367f, 0.0004522372f, 0.0004476003f, 0.0004326187f, 0.0004079029f,
+ 0.0003746497f, 0.0003347161f, 0.0002906568f, 0.0002457555f, 0.0002040014f, 0.0001700503f, 0.0001491128f, 0.0001468223f,
+ 0.0001690255f, 0.0002215535f, 0.0003099526f, 0.0004392070f, 0.0006136491f, 0.0008369098f, 0.0011153908f, 0.0014626641f,
+ 0.0018595375f, 0.0022395932f, 0.0025311249f, 0.0026688715f, 0.0025944027f, 0.0022604100f, 0.0016336976f, 0.0006981998f,
+ -0.0005431676f, -0.0020672947f, -0.0038308355f, -0.0057710271f, -0.0078076165f, -0.0098456303f, -0.0117790591f, -0.0134951832f,
+ -0.0148794917f, -0.0158209062f, -0.0162171833f, -0.0159802046f, -0.0150409946f, -0.0133541921f, -0.0109018245f, -0.0076961552f,
+ -0.0037814932f, 0.0007651902f, 0.0058348824f, 0.0112884531f, 0.0169598389f, 0.0226604555f, 0.0281847079f, 0.0333164681f,
+ 0.0378363117f, 0.0415293031f, 0.0441930617f, 0.0456458479f, 0.0457343703f, 0.0443410397f, 0.0413903773f, 0.0368543265f,
+ 0.0307562218f, 0.0231732263f, 0.0142370712f, 0.0041330029f, -0.0069031215f, -0.0185895710f, -0.0306052464f, -0.0425978140f,
+ -0.0541932843f, -0.0650067808f, -0.0746542114f, -0.0827644992f, -0.0889920115f, -0.0930287926f, -0.0946162074f, -0.0935555973f,
+ -0.0897175729f, -0.0830495883f, -0.0735814928f, -0.0614287943f, -0.0467934430f, -0.0299620019f, -0.0113011569f, 0.0087494102f,
+ 0.0296866709f, 0.0509562355f, 0.0719663997f, 0.0921039151f, 0.1107510726f, 0.1273036411f, 0.1411891551f, 0.1518850212f,
+ 0.1589358970f, 0.1619698015f, 0.1607124306f, 0.1549991925f, 0.1447845216f, 0.1301481022f, 0.1112977047f, 0.0885684336f,
+ 0.0624182781f, 0.0334199675f, 0.0022492343f, -0.0303302958f, -0.0634852726f, -0.0963334260f, -0.1279665024f, -0.1574747445f,
+ -0.1839722700f, -0.2066226519f, -0.2246639837f, -0.2374326975f, -0.2443854241f, -0.2451182136f, -0.2393824923f, -0.2270972049f,
+ -0.2083566840f, -0.1834338958f, -0.1527788314f, -0.1170119438f, -0.0769126672f, -0.0334031935f, 0.0124721800f, 0.0595716856f,
+ 0.1066841340f, 0.1525596967f, 0.1959426466f, 0.2356052084f, 0.2703816159f, 0.2992014435f, 0.3211212759f, 0.3353538037f,
+ 0.3412934754f, 0.3385379160f, 0.3269044144f, 0.3064409015f, 0.2774309795f, 0.2403927139f, 0.1960710651f, 0.1454240053f,
+ 0.0896025447f, 0.0299250576f, -0.0321535327f, -0.0950769985f, -0.1572266359f, -0.2169627100f, -0.2726674612f, -0.3227885475f,
+ -0.3658817647f, -0.4006518763f, -0.4259904152f, -0.4410093734f, -0.4450697851f, -0.4378043259f, -0.4191331941f, -0.3892727036f,
+ -0.3487362065f, -0.2983271575f, -0.2391243433f, -0.1724595094f, -0.0998878249f, -0.0231518277f, 0.0558603212f, 0.1351612774f,
+ 0.2127145048f, 0.2864865610f, 0.3545003342f, 0.4148878376f, 0.4659411557f, 0.5061601567f, 0.5342956523f, 0.5493867774f,
+ 0.5507914983f, 0.5382093212f, 0.5116954608f, 0.4716659463f, 0.4188933721f, 0.3544932422f, 0.2799011075f, 0.1968409421f,
+ 0.1072854415f, 0.0134091535f, -0.0824644450f, -0.1779206367f, -0.2705144779f, -0.3578335937f, -0.4375611342f, -0.5075372480f,
+ -0.5658174366f, -0.6107262192f, -0.6409046287f, -0.6553502097f, -0.6534483577f, -0.6349940579f, -0.6002033141f, -0.5497138242f,
+ -0.4845747300f, -0.4062255582f, -0.3164647475f, -0.2174084443f, -0.1114405017f, -0.0011548715f, 0.1107082189f, 0.2213307209f,
+ 0.3278881365f, 0.4276219846f, 0.5179114992f, 0.5963426829f, 0.6607728958f, 0.7093892437f, 0.7407591825f, 0.7538719283f,
+ 0.7481694943f, 0.7235664280f, 0.6804576085f, 0.6197137625f, 0.5426646818f, 0.4510704345f, 0.3470811862f, 0.2331865442f,
+ 0.1121556241f, -0.0130307134f, -0.1392537831f, -0.2633353122f, -0.3821180118f, -0.4925464326f, -0.5917460154f, -0.6770982854f,
+ -0.7463102071f, -0.7974758632f, -0.8291287887f, -0.8402835311f, -0.8304652631f, -0.7997265817f, -0.7486509433f, -0.6783425346f,
+ -0.5904027183f, -0.4868935511f, -0.3702891985f, -0.2434164031f, -0.1093854415f, 0.0284867240f, 0.1667591937f, 0.3019536886f,
+ 0.4306427342f, 0.5495372068f, 0.6555710008f, 0.7459806116f, 0.8183775659f, 0.8708117817f, 0.9018241781f, 0.9104871053f,
+ 0.8964314857f, 0.8598598737f, 0.8015450208f, 0.7228138795f, 0.6255173800f, 0.5119866531f, 0.3849767570f, 0.2475992600f,
+ 0.1032453598f, -0.0444985629f, -0.1919408168f, -0.3353774466f, -0.4711860685f, -0.5959181193f, -0.7063871285f, -0.7997507598f,
+ -0.8735844695f, -0.9259448860f, -0.9554212155f, -0.9611733371f, -0.9429555253f, -0.9011251664f, -0.8366361515f, -0.7510170890f,
+ -0.6463347988f, -0.5251440036f, -0.3904244118f, -0.2455067964f, -0.0939898753f, 0.0603498686f, 0.2136531983f, 0.3620754993f,
+ 0.5018841040f, 0.6295530127f, 0.7418526589f, 0.8359323337f, 0.9093932351f, 0.9603501538f, 0.9874803034f, 0.9900578955f,
+ 0.9679736807f, 0.9217387716f, 0.8524727897f, 0.7618764115f, 0.6521892146f, 0.5261336069f, 0.3868465674f, 0.2378005415f,
+ 0.0827159689f, -0.0745329240f, -0.2300158926f, -0.3798465481f, -0.5202802756f, -0.6478099233f, -0.7592521853f, -0.8518447888f,
+ -0.9233379834f, -0.9720085218f, -0.9966758999f, -0.9967463299f, -0.9722295329f, -0.9237392201f, -0.8524778646f, -0.7602073639f,
+ -0.6492055631f, -0.5222103755f, -0.3823523682f, -0.2330778865f, -0.0780642593f, 0.0788705421f, 0.2338618240f, 0.3830931459f,
+ 0.5228902075f, 0.6498111734f, 0.7607313594f, 0.8529200672f, 0.9241077914f, 0.9725420391f, 0.9970304792f, 0.9969702721f,
+ 0.9723629327f, 0.9238142869f, 0.8525195846f, 0.7602340753f, 0.6492298214f, 0.5222397619f, 0.3823904496f, 0.2331250710f,
+ 0.0781186890f, -0.0788122482f, -0.2338038630f, -0.3830399929f, -0.5228461462f, -0.6497799862f, -0.7607160866f, -0.8529228980f,
+ -0.9241300035f, -0.9725840329f, -0.9970918334f, -0.9970498578f, -0.9724590238f, -0.9239246994f, -0.8526417953f, -0.7603653504f,
+ -0.6493673160f, -0.5223806210f, -0.3825318778f, -0.2332644031f, -0.0782534324f, 0.0786843684f, 0.2336848810f, 0.3829316749f,
+ 0.5227499799f, 0.6496971643f, 0.7606475046f, 0.8528691455f, 0.9240913688f, 0.9725605024f, 0.9970831041f, 0.9970553461f,
+ 0.9724778870f, 0.9239558554f, 0.8526839539f, 0.7604170426f, 0.6494269334f, 0.5224464521f, 0.3826021525f, 0.2333373314f,
+ 0.0783272488f, -0.0786113681f, -0.2336143011f, -0.3828649893f, -0.5226885022f, -0.6496420279f, -0.7605996436f, -0.8528292862f,
+ -0.9240600225f, -0.9725379675f, -0.9970694696f, -0.9970505028f, -0.9724815391f, -0.9239675382f, -0.8527030511f, -0.7604428078f,
+ -0.6494585103f, -0.5224828981f, -0.3826424594f, -0.2333804494f, -0.0783721069f, 0.0785658395f, 0.2335691502f, 0.3828212223f,
+ 0.5226470656f, 0.6496037895f, 0.7605653778f, 0.8527996583f, 0.9240355773f, 0.9725191181f, 0.9970564910f, 0.9970435264f,
+ 0.9724805522f, 0.9239723853f, 0.8527134405f, 0.7604583197f, 0.6494786105f, 0.5225069525f, 0.3826697534f, 0.2334102074f,
+ 0.0784035151f, -0.0785336112f, -0.2335369252f, -0.3827897961f, -0.5226171847f, -0.6495761346f, -0.7605405475f, -0.8527781579f,
+ -0.9240178096f, -0.9725053787f, -0.9970469656f, -0.9970382927f, -0.9724795834f, -0.9239755567f, -0.8527205369f, -0.7604690457f,
+ -0.6494926000f, -0.5225237804f, -0.3826889457f, -0.2334312532f, -0.0784258768f, 0.0785104868f, 0.2335135965f, 0.3827668158f,
+ 0.5225950899f, 0.6495554361f, 0.7605217198f, 0.8527616288f, 0.9240039504f, 0.9724944950f, 0.9970392893f, 0.9970339749f,
+ 0.9724786893f, 0.9239780624f, 0.8527263292f, 0.7604779239f, 0.6495042812f, 0.5225379070f, 0.3827050967f, 0.2334489562f,
+ 0.0784446231f, -0.0784912259f, -0.2334943534f, -0.3827481104f, -0.5225774136f, -0.6495392378f, -0.7605073937f, -0.8527495050f,
+ -0.9239942880f, -0.9724874781f, -0.9970350256f, -0.9970324969f, -0.9724799577f, -0.9239819717f, -0.8527327136f, -0.7604865652f,
+ -0.6495149161f, -0.5225502352f, -0.3827187881f, -0.2334636585f, -0.0784599687f, 0.0784756139f, 0.2334788543f, 0.3827330998f,
+ 0.5225632570f, 0.6495262837f, 0.7604959669f, 0.8527398987f, 0.9239867563f, 0.9724822286f, 0.9970322117f,
+};
+
+const float ivas_fb_fr_12band_1ms_im[IVAS_FB_12_1MS_LEN] =
+{
+ -0.0898684611f, -0.2670421131f, -0.4365041728f, -0.5932908852f, -0.7325431118f, -0.8497696909f, -0.9406026758f, -1.0013422309f,
+ -1.0229026702f, -0.9881074062f, -0.8887876846f, -0.7310424395f, -0.5284210279f, -0.2997529481f, -0.0664760115f, 0.1499611207f,
+ 0.3307974571f, 0.4621685196f, 0.5367125342f, 0.5543493827f, 0.5220560680f, 0.4529408018f, 0.3642519877f, 0.2760859332f,
+ 0.2047354522f, 0.1503391462f, 0.1061445796f, 0.0699189586f, 0.0406773254f, 0.0176462883f, 0.0000989137f, -0.0126721698f,
+ -0.0213825135f, -0.0267263252f, -0.0293754264f, -0.0299501298f, -0.0290147562f, -0.0270589183f, -0.0244976437f, -0.0216640086f,
+ -0.0188153473f, -0.0161349368f, -0.0137427038f, -0.0117024055f, -0.0100340803f, -0.0087231409f, -0.0077319011f, -0.0070077840f,
+ -0.0064920884f, -0.0061256992f, -0.0058543602f, -0.0056314631f, -0.0054200843f, -0.0051933287f, -0.0049340271f, -0.0046335801f,
+ -0.0042904244f, -0.0039083723f, -0.0034948095f, -0.0030592765f, -0.0026120102f, -0.0021631376f, -0.0017217846f, -0.0012959083f,
+ -0.0008918976f, -0.0005148542f, -0.0001684643f, 0.0001445255f, 0.0004223858f, 0.0006639324f, 0.0008686856f, 0.0010364896f,
+ 0.0011677783f, 0.0012632724f, 0.0013243012f, 0.0013525145f, 0.0013501876f, 0.0013198910f, 0.0012647346f, 0.0011879780f,
+ 0.0010932175f, 0.0009839640f, 0.0008638145f, 0.0007360481f, 0.0006038306f, 0.0004698724f, 0.0003366939f, 0.0002063576f,
+ 0.0000807864f, -0.0000384546f, -0.0001498232f, -0.0002520137f, -0.0003436527f, -0.0004235485f, -0.0004904478f, -0.0005433364f,
+ -0.0005812551f, -0.0006036329f, -0.0006101286f, -0.0006009525f, -0.0005766848f, -0.0005385389f, -0.0004881156f, -0.0004275804f,
+ -0.0003593427f, -0.0002861534f, -0.0002107341f, -0.0001358351f, -0.0000638656f, 0.0000030299f, 0.0000632842f, 0.0001157628f,
+ 0.0001599820f, 0.0001958747f, 0.0002239118f, 0.0002447961f, 0.0002595218f, 0.0002690444f, 0.0002743352f, 0.0002760865f,
+ 0.0002748168f, 0.0002706555f, 0.0002635301f, 0.0002530421f, 0.0002387283f, 0.0002200029f, 0.0001964510f, 0.0001677833f,
+ 0.0001341045f, 0.0000958227f, 0.0000538421f, 0.0000093907f, -0.0000358838f, -0.0000801695f, -0.0001214720f, -0.0001579178f,
+ -0.0001877626f, -0.0002096837f, -0.0002227536f, -0.0002266623f, -0.0002216081f, -0.0002084174f, -0.0001883368f, -0.0001630566f,
+ -0.0001344297f, -0.0001044404f, -0.0000749065f, -0.0000474557f, -0.0000232739f, -0.0000031484f, 0.0000126922f, 0.0000244381f,
+ 0.0000327553f, 0.0000385592f, 0.0000429983f, 0.0000471857f, 0.0000521670f, 0.0000586725f, 0.0000671313f, 0.0000774992f,
+ 0.0000893598f, 0.0001018532f, 0.0001138697f, 0.0001240625f, 0.0001311002f, 0.0001337149f, 0.0001309532f, 0.0001221967f,
+ 0.0001073512f, 0.0000867866f, 0.0000614274f, 0.0000325927f, 0.0000019882f, -0.0000285322f, -0.0000570333f, -0.0000817625f,
+ -0.0001012133f, -0.0001143489f, -0.0001206018f,
+ 0.0115080962f, 0.0339059662f, 0.0543805639f, 0.0716908215f, 0.0844892131f, 0.0915170903f, 0.0912773099f, 0.0825231458f,
+ 0.0581340647f, 0.0023722407f, -0.0920729561f, -0.2188408880f, -0.3647527624f, -0.5119701616f, -0.6406838355f, -0.7316665697f,
+ -0.7689724827f, -0.7420606704f, -0.6473949518f, -0.4890788171f, -0.2786409816f, -0.0338325103f, 0.2232845090f, 0.4688402469f,
+ 0.6798489622f, 0.8368463063f, 0.9260768759f, 0.9410292369f, 0.8830777791f, 0.7612013021f, 0.5907780504f, 0.3916368742f,
+ 0.1855876370f, -0.0062576017f, -0.1660331877f, -0.2812632874f, -0.3462706324f, -0.3628576835f, -0.3399405921f, -0.2936025661f,
+ -0.2446360780f, -0.2029515435f, -0.1662608743f, -0.1331801236f, -0.1036965299f, -0.0778301527f, -0.0556266777f, -0.0370208473f,
+ -0.0218709516f, -0.0099359945f, -0.0009127909f, 0.0055587915f, 0.0098621029f, 0.0123923627f, 0.0135300104f, 0.0136320444f,
+ 0.0130144200f, 0.0119494969f, 0.0106574266f, 0.0093099072f, 0.0080287757f, 0.0068943240f, 0.0059483248f, 0.0052043487f,
+ 0.0046523406f, 0.0042685237f, 0.0040192551f, 0.0038688810f, 0.0037816102f, 0.0037267014f, 0.0036781232f, 0.0036173442f,
+ 0.0035313060f, 0.0034136237f, 0.0032617350f, 0.0030774362f, 0.0028640174f, 0.0026268424f, 0.0023709699f, 0.0021021154f,
+ 0.0018248805f, 0.0015440826f, 0.0012634327f, 0.0009870117f, 0.0007181238f, 0.0004606754f, 0.0002179850f, -0.0000060719f,
+ -0.0002083660f, -0.0003855837f, -0.0005355681f, -0.0006564697f, -0.0007479765f, -0.0008103905f, -0.0008456256f, -0.0008561209f,
+ -0.0008455816f, -0.0008177548f, -0.0007769991f, -0.0007270455f, -0.0006715492f, -0.0006129898f, -0.0005533521f, -0.0004932746f,
+ -0.0004329280f, -0.0003714208f, -0.0003078363f, -0.0002408007f, -0.0001695470f, -0.0000934908f, -0.0000131639f, 0.0000703507f,
+ 0.0001547277f, 0.0002371760f, 0.0003140053f, 0.0003815783f, 0.0004360445f, 0.0004743392f, 0.0004939265f, 0.0004936813f,
+ 0.0004734847f, 0.0004348607f, 0.0003803348f, 0.0003137905f, 0.0002396098f, 0.0001628232f, 0.0000881507f, 0.0000200989f,
+ -0.0000379279f, -0.0000834126f, -0.0001153958f, -0.0001340265f, -0.0001409462f, -0.0001385916f, -0.0001303365f, -0.0001196396f,
+ -0.0001100798f, -0.0001045123f, -0.0001051708f, -0.0001129953f, -0.0001279408f, -0.0001485750f, -0.0001726416f, -0.0001969197f,
+ -0.0002179800f, -0.0002321940f, -0.0002365365f, -0.0002285757f, -0.0002071506f, -0.0001721838f, -0.0001251084f, -0.0000684218f,
+ -0.0000058329f, 0.0000584158f, 0.0001195994f, 0.0001732950f, 0.0002154726f, 0.0002432129f, 0.0002546651f, 0.0002495466f,
+ 0.0002438301f, 0.0007109472f, 0.0011162460f, 0.0013967943f, 0.0014698785f, 0.0012150300f, 0.0004822469f, -0.0009199449f,
+ -0.0032069948f, -0.0066234807f, -0.0114150534f, -0.0178284637f, -0.0260733522f, -0.0363216183f, -0.0486605071f, -0.0630990061f,
+ -0.0795130312f, -0.0976712096f, -0.1171685259f, -0.1374957541f, -0.1579441550f, -0.1777994651f, -0.1961712153f, -0.2131191727f,
+ -0.2256033924f, -0.2176912218f, -0.1719241079f, -0.0821949125f, 0.0489542717f, 0.2117008349f, 0.3903676656f, 0.5654257562f,
+ 0.7160273175f, 0.8226483779f, 0.8696490849f, 0.8473276976f, 0.7533117569f, 0.5930248684f, 0.3792476318f, 0.1307497118f,
+ -0.1297731860f, -0.3782729365f, -0.5920556328f, -0.7523549294f, -0.8463947331f, -0.8687564040f, -0.8218173622f, -0.7152833962f,
+ -0.5647972104f, -0.3898836504f, -0.2113895751f, -0.0488408019f, 0.0820902688f, 0.1715873934f, 0.2171153181f, 0.2247885078f,
+ 0.2120719043f, 0.1949040588f, 0.1763288922f, 0.1562894837f, 0.1356771490f, 0.1152063262f, 0.0955845402f, 0.0773202283f,
+ 0.0608172272f, 0.0463072409f, 0.0339148674f, 0.0236334444f, 0.0153777062f, 0.0089786185f, 0.0042273050f, 0.0008767894f,
+ -0.0013231927f, -0.0026245282f, -0.0032557343f, -0.0034239005f, -0.0032991260f, -0.0030209159f, -0.0026903446f, -0.0023798808f,
+ -0.0021307088f, -0.0019640207f, -0.0018807705f, -0.0018724257f, -0.0019209336f, -0.0020075151f, -0.0021115303f, -0.0022167724f,
+ -0.0023088853f, -0.0023794235f, -0.0024222081f, -0.0024359169f, -0.0024201044f, -0.0023771902f, -0.0023088214f, -0.0022179019f,
+ -0.0021056723f, -0.0019740384f, -0.0018233675f, -0.0016550209f, -0.0014695894f, -0.0012693378f, -0.0010565212f, -0.0008354568f,
+ -0.0006106656f, -0.0003884494f, -0.0001748112f, 0.0000233719f, 0.0002004956f, 0.0003512145f, 0.0004724032f, 0.0005620267f,
+ 0.0006206994f, 0.0006502675f, 0.0006548938f, 0.0006393557f, 0.0006097638f, 0.0005717449f, 0.0005310334f, 0.0004917912f,
+ 0.0004573339f, 0.0004288066f, 0.0004062166f, 0.0003875516f, 0.0003701287f, 0.0003500723f, 0.0003238297f, 0.0002877917f,
+ 0.0002397329f, 0.0001783203f, 0.0001042514f, 0.0000194643f, -0.0000721397f, -0.0001658244f, -0.0002556635f, -0.0003358859f,
+ -0.0004006984f, -0.0004456200f, -0.0004672301f, -0.0004642525f, -0.0004370215f, -0.0003881655f, -0.0003217097f, -0.0002433639f,
+ -0.0001593403f, -0.0000763999f, -0.0000005923f, 0.0000626983f, 0.0001098436f, 0.0001386930f, 0.0001493084f, 0.0001433260f,
+ 0.0001242838f, 0.0000966497f, 0.0000658480f, 0.0000371218f, 0.0000154755f, 0.0000046144f, 0.0000070450f, 0.0000233058f,
+ 0.0000523967f, 0.0000914031f, 0.0001362820f, 0.0001818299f, 0.0002227029f, 0.0002535449f, 0.0002700191f, 0.0002688537f,
+ 0.0002486530f, 0.0002096567f, 0.0001541806f, 0.0000860074f, 0.0000104494f, -0.0000665586f, -0.0001386343f, -0.0001999605f,
+ -0.0002454664f, -0.0002717048f, -0.0002768116f, -0.0002610555f, -0.0002264389f, -0.0001768539f, -0.0001173333f, -0.0000538987f,
+ 0.0000073883f, 0.0000606831f, 0.0001012735f, 0.0001257023f, 0.0001324276f, 0.0001216280f, 0.0000954836f, 0.0000576109f,
+ 0.0000129868f, -0.0000328906f, -0.0000742744f, -0.0001060758f, -0.0001240987f, -0.0001257785f, -0.0001101631f, -0.0000783123f,
+ -0.0000329127f, 0.0000217021f, 0.0000802673f, 0.0001368394f, 0.0001856737f, 0.0002215380f, 0.0002405175f, 0.0002401550f,
+ 0.0002199754f, 0.0001812890f, 0.0001273345f, 0.0000627166f, -0.0000067866f, -0.0000750345f, -0.0001358771f,
+ -0.0002517773f, -0.0007530438f, -0.0012480393f, -0.0017311495f, -0.0021966783f, -0.0026372659f, -0.0030463219f, -0.0034173391f,
+ -0.0037471961f, -0.0040359970f, -0.0042905892f, -0.0045239611f, -0.0047578551f, -0.0050204690f, -0.0053469980f, -0.0057745962f,
+ -0.0063401820f, -0.0070723578f, -0.0079867916f, -0.0090758990f, -0.0103033224f, -0.0115933185f, -0.0128269170f, -0.0138337134f,
+ -0.0143928060f, -0.0142296836f, -0.0130247299f, -0.0104168701f, -0.0060212390f, 0.0005608679f, 0.0097154142f, 0.0218030935f,
+ 0.0371260945f, 0.0559219991f, 0.0783277405f, 0.1044019092f, 0.1340918009f, 0.1673695867f, 0.2042412889f, 0.2460845096f,
+ 0.2951830943f, 0.3416235468f, 0.3646126368f, 0.3480671745f, 0.2830729765f, 0.1678292828f, 0.0080159731f, -0.1838899497f,
+ -0.3900215384f, -0.5892675140f, -0.7598185700f, -0.8818480868f, -0.9399786297f, -0.9252325823f, -0.8362335185f, -0.6794898766f,
+ -0.4687496028f, -0.2234686369f, 0.0333794198f, 0.2779351658f, 0.4881469775f, 0.6462666955f, 0.7407620319f, 0.7675102118f,
+ 0.7300140555f, 0.6387574230f, 0.5096096451f, 0.3616936194f, 0.2146955649f, 0.0863068159f, -0.0104489874f, -0.0693762132f,
+ -0.0979362074f, -0.1120025953f, -0.1187847101f, -0.1195709435f, -0.1158142700f, -0.1086494413f, -0.0991759892f, -0.0882830476f,
+ -0.0767682730f, -0.0652504848f, -0.0542380863f, -0.0440837698f, -0.0350361951f, -0.0272194074f, -0.0206775342f, -0.0153683003f,
+ -0.0112022098f, -0.0080423433f, -0.0057368530f, -0.0041194819f, -0.0030341283f, -0.0023328322f, -0.0018922260f, -0.0016079045f,
+ -0.0014038691f, -0.0012238901f, -0.0010359885f, -0.0008223621f, -0.0005812568f, -0.0003172104f, -0.0000423446f, 0.0002317528f,
+ 0.0004920317f, 0.0007298898f, 0.0009380570f, 0.0011144792f, 0.0012583706f, 0.0013727541f, 0.0014603320f, 0.0015255024f,
+ 0.0015706934f, 0.0015984889f, 0.0016087944f, 0.0016013362f, 0.0015736524f, 0.0015238602f, 0.0014491647f, 0.0013485610f,
+ 0.0012214393f, 0.0010698662f, 0.0008969515f, 0.0007085113f, 0.0005110819f, 0.0003130098f, 0.0001222403f, -0.0000529128f,
+ -0.0002059168f, -0.0003312324f, -0.0004261003f, -0.0004894620f, -0.0005232055f, -0.0005306961f, -0.0005175051f, -0.0004896578f,
+ -0.0004540531f, -0.0004166844f, -0.0003830510f, -0.0003566394f, -0.0003395923f, -0.0003316443f, -0.0003311733f, -0.0003346124f,
+ -0.0003378214f, -0.0003358194f, -0.0003242611f, -0.0002992259f, -0.0002585275f, -0.0002012956f, -0.0001289055f, -0.0000441984f,
+ 0.0000480368f, 0.0001421911f, 0.0002316974f, 0.0003103339f, 0.0003721995f, 0.0004129378f, 0.0004295640f, 0.0004213762f,
+ 0.0003894462f, 0.0003371019f, 0.0002690431f, 0.0001914421f, 0.0001108048f, 0.0000338794f, -0.0000335063f, -0.0000864746f,
+ -0.0001220386f, -0.0001388528f, -0.0001377697f, -0.0001212160f, -0.0000933503f, -0.0000591266f, -0.0000241894f, 0.0000061837f,
+ 0.0000272190f, 0.0000355810f, 0.0000293086f, 0.0000084300f, -0.0000254463f, -0.0000689080f, -0.0001174917f, -0.0001657726f,
+ -0.0002083169f, -0.0002398873f, -0.0002563684f, -0.0002548515f, -0.0002343135f, -0.0001953996f, -0.0001407304f, -0.0000743265f,
+ -0.0000015627f, 0.0000716768f, 0.0001392424f, 0.0001956345f, 0.0002362192f, 0.0002579841f, 0.0002595163f, 0.0002414285f,
+ -0.0000940837f, -0.0002770282f, -0.0004449239f, -0.0005888728f, -0.0007019644f, -0.0007792340f, -0.0008182743f, -0.0008186617f,
+ -0.0007820794f, -0.0007112881f, -0.0006099783f, -0.0004815832f, -0.0003292359f, -0.0001547948f, 0.0000407443f, 0.0002577725f,
+ 0.0004970701f, 0.0007599305f, 0.0010467681f, 0.0013572172f, 0.0016888066f, 0.0020376007f, 0.0023974682f, 0.0027617602f,
+ 0.0031234670f, 0.0034780578f, 0.0038243130f, 0.0041678751f, 0.0045219223f, 0.0049104098f, 0.0053672600f, 0.0059379719f,
+ 0.0066758931f, 0.0076410668f, 0.0088925844f, 0.0104843046f, 0.0124532460f, 0.0148130444f, 0.0175396030f, 0.0205645423f,
+ 0.0237604835f, 0.0269378529f, 0.0298327415f, 0.0321108152f, 0.0333602127f, 0.0331056565f, 0.0308069668f, 0.0258845713f,
+ 0.0177205355f, 0.0056930577f, -0.0108298743f, -0.0324583065f, -0.0598208742f, -0.0935922245f, -0.1346769337f, -0.1852485101f,
+ -0.2520452044f, -0.3349618030f, -0.4178137014f, -0.4806851731f, -0.5066093847f, -0.4828480682f, -0.4029110854f, -0.2674540766f,
+ -0.0845343107f, 0.1312173509f, 0.3601564597f, 0.5799075204f, 0.7679640489f, 0.9043772480f, 0.9741394604f, 0.9690106520f,
+ 0.8885379519f, 0.7401510478f, 0.5383256422f, 0.3028982916f, 0.0567716151f, -0.1767567296f, -0.3766491619f, -0.5265275449f,
+ -0.6164139497f, -0.6437430944f, -0.6133407543f, -0.5366180838f, -0.4297512054f, -0.3115454630f, -0.2005356394f, -0.1128598350f,
+ -0.0539105809f, -0.0139443690f, 0.0156565191f, 0.0370291041f, 0.0516278850f, 0.0605689917f, 0.0649188950f, 0.0656033918f,
+ 0.0635061831f, 0.0593951272f, 0.0539682831f, 0.0478045414f, 0.0413946012f, 0.0351122976f, 0.0292427409f, 0.0239693774f,
+ 0.0194022319f, 0.0155752485f, 0.0124736580f, 0.0100363326f, 0.0081800382f, 0.0068024870f, 0.0058015196f, 0.0050760480f,
+ 0.0045392915f, 0.0041164842f, 0.0037525515f, 0.0034068962f, 0.0030568884f, 0.0026909558f, 0.0023097105f, 0.0019188491f,
+ 0.0015296237f, 0.0011527869f, 0.0007995822f, 0.0004773732f, 0.0001916221f, -0.0000568089f, -0.0002688493f, -0.0004487434f,
+ -0.0006009421f, -0.0007311394f, -0.0008434559f, -0.0009415801f, -0.0010266406f, -0.0010987560f, -0.0011556747f, -0.0011947058f,
+ -0.0012119146f, -0.0012041634f, -0.0011684945f, -0.0011039351f, -0.0010107180f, -0.0008915962f, -0.0007507109f, -0.0005943565f,
+ -0.0004295220f, -0.0002642519f, -0.0001060642f, 0.0000378186f, 0.0001618981f, 0.0002620189f, 0.0003364193f, 0.0003850258f,
+ 0.0004100438f, 0.0004149209f, 0.0004045652f, 0.0003841255f, 0.0003590482f, 0.0003339070f, 0.0003125425f, 0.0002971555f,
+ 0.0002887091f, 0.0002863958f, 0.0002883494f, 0.0002914552f, 0.0002922766f, 0.0002870530f, 0.0002726535f, 0.0002465517f,
+ 0.0002076047f, 0.0001558242f, 0.0000928493f, 0.0000214333f, -0.0000544032f, -0.0001301223f, -0.0002007286f, -0.0002616070f,
+ -0.0003086144f, -0.0003388183f, -0.0003504396f, -0.0003433413f, -0.0003187137f, -0.0002792588f, -0.0002286183f, -0.0001713141f,
+ -0.0001120267f, -0.0000554389f,
+ -0.0001958521f, -0.0002037772f, -0.0001928163f, -0.0001589424f, -0.0001002894f, -0.0000163380f, 0.0000907887f, 0.0002175831f,
+ 0.0003582211f, 0.0005062409f, 0.0006538405f, 0.0007937851f, 0.0009186699f, 0.0010227885f, 0.0011010838f, 0.0011507705f,
+ 0.0011698159f, 0.0011582816f, 0.0011163741f, 0.0010456753f, 0.0009469803f, 0.0008217234f, 0.0006698794f, 0.0004918730f,
+ 0.0002867091f, 0.0000544686f, -0.0002054280f, -0.0004913183f, -0.0008012958f, -0.0011303304f, -0.0014731078f, -0.0018216574f,
+ -0.0021695528f, -0.0025102922f, -0.0028430159f, -0.0031713537f, -0.0035102261f, -0.0038841898f, -0.0043342737f, -0.0049142608f,
+ -0.0056961483f, -0.0067625723f, -0.0082096287f, -0.0101339707f, -0.0126325271f, -0.0157836972f, -0.0196448900f, -0.0242284914f,
+ -0.0294998526f, -0.0353498489f, -0.0415975524f, -0.0479616035f, -0.0540728812f, -0.0594457699f, -0.0635064362f, -0.0655612395f,
+ -0.0648457799f, -0.0604784184f, -0.0515339488f, -0.0369448838f, -0.0155927126f, 0.0139806398f, 0.0539164770f, 0.1128370459f,
+ 0.2004901808f, 0.3114870438f, 0.4296920027f, 0.5365714345f, 0.6133195725f, 0.6437584042f, 0.6164735032f, 0.5266348467f,
+ 0.3768028330f, 0.1769504498f, -0.0565487403f, -0.3026608074f, -0.5380905144f, -0.7399360850f, -0.8883601949f, -0.9688847331f,
+ -0.9740762507f, -0.9043827765f, -0.7680389511f, -0.5800469251f, -0.3603504723f, -0.1314519403f, 0.0842759659f, 0.2671900601f,
+ 0.4026590428f, 0.4826236485f, 0.5064248335f, 0.4805483640f, 0.4177275519f, 0.3349242893f, 0.2520497692f, 0.1852850777f,
+ 0.1347332064f, 0.0936551449f, 0.0598782099f, 0.0325001596f, 0.0108498369f, -0.0056970597f, -0.0177459594f, -0.0259244265f,
+ -0.0308505634f, -0.0331397240f, -0.0333704132f, -0.0320833599f, -0.0297560793f, -0.0268041178f, -0.0235666816f, -0.0203132117f,
+ -0.0172390062f, -0.0144767230f, -0.0120991121f, -0.0101332076f, -0.0085666335f, -0.0073617255f, -0.0064621794f, -0.0058047936f,
+ -0.0053242015f, -0.0049609363f, -0.0046632383f, -0.0043912873f, -0.0041162231f, -0.0038213107f, -0.0034990867f, -0.0031507115f,
+ -0.0027824416f, -0.0024044438f, -0.0020276438f, -0.0016629392f, -0.0013190459f, -0.0010025416f, -0.0007168319f, -0.0004629763f,
+ -0.0002395008f, -0.0000436500f, 0.0001284164f, 0.0002803877f, 0.0004156585f, 0.0005364447f, 0.0006439523f, 0.0007379710f,
+ 0.0008173893f, 0.0008801810f, 0.0009241189f, 0.0009469386f, 0.0009470262f, 0.0009235256f, 0.0008768074f, 0.0008083660f,
+ 0.0007209842f, 0.0006183917f, 0.0005051683f, 0.0003862499f, 0.0002667034f, 0.0001512287f, 0.0000439630f, -0.0000518813f,
+ -0.0001340642f, -0.0002014693f, -0.0002539655f, -0.0002923568f, -0.0003181036f, -0.0003331509f, -0.0003396076f, -0.0003395633f,
+ -0.0003348303f, -0.0003268422f, -0.0003165265f, -0.0003043290f, -0.0002902270f, -0.0002738620f, -0.0002546506f, -0.0002319638f,
+ -0.0002052612f, -0.0001742433f, -0.0001389381f, -0.0000997698f, -0.0000575586f, -0.0000134887f, 0.0000309765f, 0.0000742026f,
+ 0.0001145147f, 0.0001503321f, 0.0001802885f,
+ -0.0001277341f, -0.0000801832f, -0.0000218515f, 0.0000429946f, 0.0001101725f, 0.0001753791f, 0.0002352234f, 0.0002868790f,
+ 0.0003289280f, 0.0003607437f, 0.0003830779f, 0.0003971613f, 0.0004050891f, 0.0004087434f, 0.0004101314f, 0.0004103021f,
+ 0.0004098229f, 0.0004078547f, 0.0004029032f, 0.0003921299f, 0.0003724071f, 0.0003398196f, 0.0002909307f, 0.0002223256f,
+ 0.0001319189f, 0.0000183492f, -0.0001178379f, -0.0002750908f, -0.0004498764f, -0.0006379165f, -0.0008333771f, -0.0010303574f,
+ -0.0012220954f, -0.0014025519f, -0.0015654459f, -0.0017057905f, -0.0018186276f, -0.0019004727f, -0.0019477420f, -0.0019582025f,
+ -0.0019292104f, -0.0018593672f, -0.0017467341f, -0.0015908909f, -0.0013912094f, -0.0011493707f, -0.0008675713f, -0.0005513213f,
+ -0.0002071950f, 0.0001544857f, 0.0005229288f, 0.0008847642f, 0.0012288921f, 0.0015452051f, 0.0018312322f, 0.0020914322f,
+ 0.0023452820f, 0.0026261558f, 0.0029898311f, 0.0035112352f, 0.0042918405f, 0.0054520943f, 0.0071361390f, 0.0094977907f,
+ 0.0127016847f, 0.0169013256f, 0.0222371991f, 0.0288065364f, 0.0366610177f, 0.0457690119f, 0.0560179682f, 0.0671701450f,
+ 0.0788774558f, 0.0906296100f, 0.1017925366f, 0.1115401869f, 0.1189349031f, 0.1228106313f, 0.1219422410f, 0.1147682442f,
+ 0.0998698743f, 0.0698963887f, 0.0088203751f, -0.0909692208f, -0.2234220627f, -0.3756331554f, -0.5300042260f, -0.6668887743f,
+ -0.7671574389f, -0.8148547416f, -0.7993524069f, -0.7169019655f, -0.5713321080f, -0.3737662567f, -0.1415729584f, 0.1036716588f,
+ 0.3378392047f, 0.5399814296f, 0.7022792290f, 0.8235847390f, 0.9011912110f, 0.9335195531f, 0.9210148943f, 0.8662582998f,
+ 0.7738442006f, 0.6501373474f, 0.5028823140f, 0.3407552797f, 0.1728427401f, 0.0081212390f, -0.1450610431f, -0.2794406314f,
+ -0.3892283922f, -0.4703883896f, -0.5208081709f, -0.5403348331f, -0.5306924278f, -0.4952731730f, -0.4388331926f, -0.3670992988f,
+ -0.2863302758f, -0.2028454693f, -0.1225716070f, -0.0506164333f, 0.0090788383f, 0.0540159375f, 0.0833026194f, 0.0977385677f,
+ 0.0999946466f, 0.0952552716f, 0.0880995668f, 0.0797728807f, 0.0706660863f, 0.0613242080f, 0.0521689821f, 0.0435466445f,
+ 0.0356893133f, 0.0287479136f, 0.0227869173f, 0.0178107854f, 0.0137689980f, 0.0105778434f, 0.0081277168f, 0.0062997686f,
+ 0.0049716376f, 0.0040285807f, 0.0033660981f, 0.0028959547f, 0.0025456890f, 0.0022606635f, 0.0020013537f, 0.0017429261f,
+ 0.0014715303f, 0.0011828460f, 0.0008784722f, 0.0005645174f, 0.0002487848f, -0.0000600208f, -0.0003540749f, -0.0006264965f,
+ -0.0008722305f, -0.0010875779f, -0.0012705059f, -0.0014199592f, -0.0015359444f, -0.0016188954f, -0.0016697727f, -0.0016896254f,
+ -0.0016797991f, -0.0016416978f, -0.0015770686f, -0.0014878777f, -0.0013765796f, -0.0012459990f, -0.0010995021f, -0.0009408124f,
+ -0.0007740525f, -0.0006034858f, -0.0004334565f, -0.0002681040f, -0.0001112695f, 0.0000337496f, 0.0001642534f, 0.0002782887f,
+ 0.0003746198f, 0.0004527614f, 0.0005128644f, 0.0005556551f, 0.0005822707f, 0.0005941545f, 0.0005928931f, 0.0005801213f,
+ 0.0005574074f, 0.0005262036f, 0.0004878004f, 0.0004433324f, 0.0003937929f, 0.0003400774f, 0.0002830311f, 0.0002234973f,
+ 0.0001623637f, 0.0001005861f, 0.0000392083f, -0.0000206541f, -0.0000778269f, -0.0001311308f, -0.0001794168f, -0.0002216378f,
+ -0.0002568858f, -0.0002844591f, -0.0003038790f, -0.0003149350f, -0.0003176698f, -0.0003123947f, -0.0002996434f, -0.0002801639f,
+ -0.0002548507f, -0.0002247269f, -0.0001908697f, -0.0001543953f, -0.0001163917f, -0.0000779152f, -0.0000399357f,
+ 0.0000094413f, 0.0000277999f, 0.0000446903f, 0.0000593280f, 0.0000712651f, 0.0000803871f, 0.0000870097f, 0.0000917822f,
+ 0.0000956902f, 0.0000998716f, 0.0001055506f, 0.0001138098f, 0.0001255136f, 0.0001411003f, 0.0001605589f, 0.0001832996f,
+ 0.0002082298f, 0.0002337307f, 0.0002578403f, 0.0002783202f, 0.0002929118f, 0.0002994416f, 0.0002960857f, 0.0002814451f,
+ 0.0002547522f, 0.0002158569f, 0.0001653321f, 0.0001043455f, 0.0000346623f, -0.0000415774f, -0.0001219205f, -0.0002038633f,
+ -0.0002849129f, -0.0003628240f, -0.0004355962f, -0.0005016356f, -0.0005596549f, -0.0006087461f, -0.0006481918f, -0.0006774810f,
+ -0.0006960781f, -0.0007034418f, -0.0006988166f, -0.0006813178f, -0.0006497978f, -0.0006030351f, -0.0005396896f, -0.0004585888f,
+ -0.0003587409f, -0.0002396693f, -0.0001014165f, 0.0000551454f, 0.0002283928f, 0.0004157251f, 0.0006137740f, 0.0008182856f,
+ 0.0010244618f, 0.0012269217f, 0.0014201288f, 0.0015983649f, 0.0017561723f, 0.0018882664f, 0.0019899370f, 0.0020568553f,
+ 0.0020854261f, 0.0020725003f, 0.0020157272f, 0.0019132331f, 0.0017640560f, 0.0015678593f, 0.0013255131f, 0.0010388553f,
+ 0.0007114008f, 0.0003480516f, -0.0000442075f, -0.0004568793f, -0.0008795218f, -0.0013009102f, -0.0017091380f, -0.0020936476f,
+ -0.0024460089f, -0.0027628964f, -0.0030473913f, -0.0033126371f, -0.0035830824f, -0.0038981281f, -0.0043122790f, -0.0048977534f,
+ -0.0057421929f, -0.0069491136f, -0.0086317888f, -0.0109107455f, -0.0139027684f, -0.0177154927f, -0.0224311200f, -0.0280995831f,
+ -0.0347172313f, -0.0422222045f, -0.0504683384f, -0.0592304787f, -0.0681714904f, -0.0768802892f, -0.0848233610f, -0.0916208280f,
+ -0.0960365098f, -0.0934965965f, -0.0788165513f, -0.0493177686f, -0.0041840764f, 0.0557190363f, 0.1279300009f, 0.2085541449f,
+ 0.2925373176f, 0.3740109184f, 0.4467123250f, 0.5044329150f, 0.5414803943f, 0.5531103895f, 0.5359083733f, 0.4880865671f,
+ 0.4096810759f, 0.3026295623f, 0.1707255672f, 0.0194488912f, -0.1443186247f, -0.3126736143f, -0.4771477585f, -0.6292070969f,
+ -0.7607694851f, -0.8646983027f, -0.9352529748f, -0.9684532025f, -0.9623535812f, -0.9171949326f, -0.8354559290f, -0.7219447724f,
+ -0.5842261616f, -0.4299994224f, -0.2647671304f, -0.0936718584f, 0.0778573928f, 0.2444955397f, 0.4011508179f, 0.5431562386f,
+ 0.6663917866f, 0.7674190691f, 0.8435687444f, 0.8930187210f, 0.9148305827f, 0.9089668951f, 0.8762704359f, 0.8184215785f,
+ 0.7378630625f, 0.6377054994f, 0.5216082533f, 0.3936475943f, 0.2581703422f, 0.1196438490f, -0.0174973196f, -0.1489983380f,
+ -0.2709234334f, -0.3797794589f, -0.4726225629f, -0.5471418581f, -0.6017198326f, -0.6354657299f, -0.6482230521f, -0.6405498448f,
+ -0.6136745009f, -0.5694280123f, -0.5101568311f, -0.4386191067f, -0.3578694342f, -0.2711360702f, -0.1816960690f, -0.0927527129f,
+ -0.0073202620f, 0.0718799659f, 0.1425082935f, 0.2026771758f, 0.2510012829f, 0.2866256582f, 0.3092317499f, 0.3190214225f,
+ 0.3166807736f, 0.3033253264f, 0.2804301957f, 0.2497478163f, 0.2132181238f, 0.1728741342f, 0.1307484916f, 0.0887835046f,
+ 0.0487503059f, 0.0121784205f, -0.0196990379f, -0.0459852335f, -0.0661399413f, -0.0799836583f, -0.0876812985f, -0.0897120098f,
+ -0.0868204670f, -0.0799602374f, -0.0702221831f, -0.0587644272f, -0.0467300423f, -0.0351807009f, -0.0250131586f, -0.0169220452f,
+ -0.0110491061f, -0.0067999510f, -0.0036452141f, -0.0013776515f, 0.0001725658f, 0.0011515063f, 0.0016931166f, 0.0019128947f,
+ 0.0019119195f, 0.0017731008f, 0.0015641080f, 0.0013360166f, 0.0011263428f, 0.0009592385f, 0.0008486058f, 0.0007990396f,
+ 0.0008087142f, 0.0008704662f, 0.0009741845f, 0.0011076612f, 0.0012583569f, 0.0014138649f, 0.0015630668f, 0.0016962130f,
+ 0.0018055792f, 0.0018852562f, 0.0019314544f, 0.0019421196f, 0.0019170260f, 0.0018573192f, 0.0017655022f, 0.0016449753f,
+ 0.0014999823f, 0.0013351861f, 0.0011556142f, 0.0009662892f, 0.0007721962f, 0.0005779798f, 0.0003879485f, 0.0002058452f,
+ 0.0000348998f, -0.0001223239f, -0.0002638249f, -0.0003882481f, -0.0004947379f, -0.0005829688f, -0.0006529761f, -0.0007051597f,
+ -0.0007401195f, -0.0007586609f, -0.0007616586f, -0.0007500873f, -0.0007249274f, -0.0006872277f, -0.0006380521f, -0.0005785652f,
+ -0.0005100019f, -0.0004337551f, -0.0003513433f, -0.0002644761f, -0.0001749961f, -0.0000849056f, 0.0000037265f, 0.0000887799f,
+ 0.0001682047f, 0.0002400620f, 0.0003026539f, 0.0003545629f, 0.0003947614f, 0.0004226221f, 0.0004379830f, 0.0004411096f,
+ 0.0004327050f, 0.0004138228f, 0.0003858290f, 0.0003502817f, 0.0003088683f, 0.0002632783f, 0.0002151470f, 0.0001659510f,
+ 0.0001169830f, 0.0000692900f, 0.0000236931f, -0.0000192281f, -0.0000590766f, -0.0000956193f, -0.0001287082f, -0.0001582520f,
+ -0.0001841434f, -0.0002062459f, -0.0002243482f, -0.0002381838f, -0.0002474218f, -0.0002517193f, -0.0002507430f, -0.0002442414f,
+ -0.0002320758f, -0.0002142901f, -0.0001911276f, -0.0001630744f, -0.0001308436f, -0.0000953784f, -0.0000577970f, -0.0000193582f,
+ 0.0000186239f, 0.0000548367f, 0.0000880630f, 0.0001172340f, 0.0001415074f, 0.0001602936f, 0.0001732965f, 0.0001804997f,
+ 0.0001821637f, 0.0001787723f, 0.0001709948f, 0.0001596078f, 0.0001454431f, 0.0001293085f, 0.0001119454f, 0.0000939706f,
+ 0.0000758637f, 0.0000579434f, 0.0000403900f, 0.0000232563f, 0.0000065182f, -0.0000098944f, -0.0000260374f, -0.0000419222f,
+ -0.0000574677f, -0.0000724909f, -0.0000866869f, -0.0000996508f, -0.0001108899f, -0.0001198747f, -0.0001260737f, -0.0001290184f,
+ -0.0001283426f, -0.0001238392f, -0.0001154831f, -0.0001034619f, -0.0000881663f, -0.0000701856f, -0.0000502629f,
+ 0.0000100257f, 0.0000298715f, 0.0000491016f, 0.0000673457f, 0.0000842719f, 0.0000996175f, 0.0001131774f, 0.0001248226f,
+ 0.0001344760f, 0.0001421200f, 0.0001477626f, 0.0001514384f, 0.0001531732f, 0.0001529862f, 0.0001508606f, 0.0001467558f,
+ 0.0001405885f, 0.0001322589f, 0.0001216448f, 0.0001086385f, 0.0000931503f, 0.0000751504f, 0.0000546725f, 0.0000318520f,
+ 0.0000069213f, -0.0000197639f, -0.0000477443f, -0.0000764464f, -0.0001052188f, -0.0001333354f, -0.0001600439f, -0.0001845767f,
+ -0.0002062035f, -0.0002242408f, -0.0002380992f, -0.0002472837f, -0.0002514295f, -0.0002502882f, -0.0002437508f, -0.0002318205f,
+ -0.0002146257f, -0.0001923855f, -0.0001654183f, -0.0001341069f, -0.0000989108f, -0.0000603353f, -0.0000189514f, 0.0000246284f,
+ 0.0000697235f, 0.0001156056f, 0.0001614708f, 0.0002064618f, 0.0002496452f, 0.0002900437f, 0.0003266238f, 0.0003583420f,
+ 0.0003841453f, 0.0004030314f, 0.0004140579f, 0.0004164107f, 0.0004094151f, 0.0003926023f, 0.0003657128f, 0.0003287519f,
+ 0.0002819762f, 0.0002259319f, 0.0001614203f, 0.0000895170f, 0.0000115172f, -0.0000710597f, -0.0001565398f, -0.0002430985f,
+ -0.0003288369f, -0.0004117862f, -0.0004899853f, -0.0005614798f, -0.0006243974f, -0.0006769402f, -0.0007174577f, -0.0007444335f,
+ -0.0007565586f, -0.0007527147f, -0.0007320491f, -0.0006939555f, -0.0006381507f, -0.0005646499f, -0.0004738416f, -0.0003664521f,
+ -0.0002436140f, -0.0001068131f, 0.0000420546f, 0.0002007573f, 0.0003666837f, 0.0005369393f, 0.0007083151f, 0.0008774032f,
+ 0.0010405725f, 0.0011941030f, 0.0013341657f, 0.0014569762f, 0.0015587822f, 0.0016360436f, 0.0016854353f, 0.0017040651f,
+ 0.0016895002f, 0.0016400311f, 0.0015547178f, 0.0014336912f, 0.0012781928f, 0.0010908735f, 0.0008757648f, 0.0006385002f,
+ 0.0003861185f, 0.0001271046f, -0.0001290952f, -0.0003723192f, -0.0005925672f, -0.0007805994f, -0.0009292471f, -0.0010343329f,
+ -0.0010963449f, -0.0011215032f, -0.0011235784f, -0.0011247650f, -0.0011572825f, -0.0012635736f, -0.0014972500f, -0.0019220776f,
+ -0.0026119000f, -0.0036479956f, -0.0051179657f, -0.0071115979f, -0.0097197636f, -0.0130315445f, -0.0171388264f, -0.0221826026f,
+ -0.0285136326f, -0.0361307186f, -0.0442081981f, -0.0516559897f, -0.0573925315f, -0.0603652434f, -0.0596331395f, -0.0544264019f,
+ -0.0442109616f, -0.0287331963f, -0.0080564058f, 0.0174234593f, 0.0469759993f, 0.0795551974f, 0.1138332879f, 0.1482526191f,
+ 0.1810898747f, 0.2105329869f, 0.2347647762f, 0.2520519356f, 0.2608332916f, 0.2598051239f, 0.2479978629f, 0.2248419603f,
+ 0.1902182120f, 0.1444910892f, 0.0885218306f, 0.0236611727f, -0.0482797215f, -0.1250786276f, -0.2041714722f, -0.2827382419f,
+ -0.3578034522f, -0.4263466673f, -0.4854197016f, -0.5322651608f, -0.5644323798f, -0.5798852692f, -0.5770983111f, -0.5551358084f,
+ -0.5137115562f, -0.4532252989f, -0.3747746885f, -0.2801408533f, -0.1717482321f, -0.0525987506f, 0.0738169580f, 0.2036293318f,
+ 0.3327161135f, 0.4568415935f, 0.5718029559f, 0.6735794476f, 0.7584777874f, 0.8232695197f, 0.8653138344f, 0.8826624233f,
+ 0.8741407389f, 0.8394039127f, 0.7789631089f, 0.6941829200f, 0.5872472518f, 0.4610970982f, 0.3193391719f, 0.1661318331f,
+ 0.0060481020f, -0.1560745385f, -0.3152984295f, -0.4667504424f, -0.6057916885f, -0.7281716821f, -0.8301830623f, -0.9087761258f,
+ -0.9618416393f, -0.9883769508f, -0.9880544909f, -0.9610885174f, -0.9083986381f, -0.8315930415f, -0.7329302137f, -0.6152510066f,
+ -0.4818998000f, -0.3366264325f, -0.1834804423f, -0.0266942820f, 0.1294357761f, 0.2806718111f, 0.4229523505f, 0.5525059678f,
+ 0.6659544948f, 0.7604051258f, 0.8335268161f, 0.8836105772f, 0.9096104660f, 0.9111656060f, 0.8886015017f, 0.8429119395f,
+ 0.7757211639f, 0.6892286142f, 0.5861371807f, 0.4695681223f, 0.3429645973f, 0.2099875350f, 0.0744064202f, -0.0600110582f,
+ -0.1896077300f, -0.3109402608f, -0.4208745383f, -0.5166699060f, -0.5960503378f, -0.6572602031f, -0.6991036150f, -0.7209660923f,
+ -0.7228185799f, -0.7052037113f, -0.6692054230f, -0.6164028870f, -0.5488108092f, -0.4688079424f, -0.3790565546f, -0.2824152817f,
+ -0.1818484683f, -0.0803346471f, 0.0192227465f, 0.1140799262f, 0.2017298411f, 0.2799697880f, 0.3469574836f, 0.4012543426f,
+ 0.4418547649f, 0.4682010863f, 0.4801839581f, 0.4781287434f, 0.4627686220f, 0.4352058330f, 0.3968625180f, 0.3494232322f,
+ 0.2947711136f, 0.2349201359f, 0.1719456583f, 0.1079157418f, 0.0448253472f, -0.0154643795f, -0.0712800080f, -0.1211812328f,
+ -0.1639966775f, -0.1988491244f, -0.2251698043f, -0.2427015611f, -0.2514912990f, -0.2518722833f, -0.2444373910f, -0.2300045092f,
+ -0.2095756919f, -0.1842916891f, -0.1553837364f, -0.1241243795f, -0.0917792284f, -0.0595613097f, -0.0285896618f, 0.0001465056f,
+ 0.0258169100f, 0.0477717562f, 0.0655551910f, 0.0789104778f, 0.0877769862f, 0.0922794468f, 0.0927101873f, 0.0895053265f,
+ 0.0832161440f, 0.0744769454f, 0.0639709607f, 0.0523956967f, 0.0404293889f, 0.0286998006f, 0.0177569270f, 0.0080503829f,
+ -0.0000871632f, -0.0064505432f, -0.0109653717f, -0.0136854786f, -0.0147827090f, -0.0145338644f, -0.0132999155f, -0.0115279496f,
+ -0.0097143162f, -0.0081066262f, -0.0066892166f, -0.0054526910f, -0.0044043619f, -0.0035430638f, -0.0028610848f, -0.0023435648f,
+ -0.0019710460f, -0.0017207440f, -0.0015686177f, -0.0014906099f, -0.0014640505f, -0.0014684367f, -0.0014861739f, -0.0015028429f,
+ -0.0015073922f, -0.0014919944f, -0.0014518622f, -0.0013848537f, -0.0012910935f, -0.0011724856f, -0.0010322928f, -0.0008746803f,
+ -0.0007043572f, -0.0005262236f, -0.0003451249f, -0.0001656257f, 0.0000081168f, 0.0001724644f, 0.0003243294f, 0.0004612043f,
+ 0.0005811330f, 0.0006826956f, 0.0007649539f, 0.0008274212f, 0.0008700054f, 0.0008929815f, 0.0008969444f, 0.0008827894f,
+ 0.0008516741f, 0.0008050045f, 0.0007444000f, 0.0006716783f, 0.0005888158f, 0.0004979255f, 0.0004012090f, 0.0003009243f,
+ 0.0001993306f, 0.0000986487f, 0.0000010025f, -0.0000916200f, -0.0001774214f, -0.0002548259f, -0.0003225212f, -0.0003794749f,
+ -0.0004249577f, -0.0004585414f, -0.0004801021f, -0.0004897991f, -0.0004880609f, -0.0004755490f, -0.0004531324f, -0.0004218435f,
+ -0.0003828474f, -0.0003373970f, -0.0002868049f, -0.0002324032f, -0.0001755218f, -0.0001174565f, -0.0000594555f, -0.0000026960f,
+ 0.0000517227f, 0.0001027959f, 0.0001496166f, 0.0001913889f, 0.0002274293f, 0.0002571799f, 0.0002802094f, 0.0002962259f,
+ 0.0003050777f, 0.0003067640f, 0.0003014323f, 0.0002893851f, 0.0002710700f, 0.0002470789f, 0.0002181291f, 0.0001850528f,
+ 0.0001487686f, 0.0001102623f, 0.0000705516f, 0.0000306614f, -0.0000084134f, -0.0000457325f, -0.0000804436f, -0.0001118002f,
+ -0.0001391858f, -0.0001621210f, -0.0001802753f, -0.0001934613f, -0.0002016344f, -0.0002048759f, -0.0002033834f, -0.0001974478f,
+ -0.0001874396f, -0.0001737844f, -0.0001569508f, -0.0001374298f, -0.0001157277f, -0.0000923513f, -0.0000678073f, -0.0000425930f,
+ -0.0000172000f, 0.0000078915f, 0.0000322093f, 0.0000552949f, 0.0000767028f, 0.0000960105f, 0.0001128219f, 0.0001267820f,
+ 0.0001375845f, 0.0001449888f, 0.0001488284f, 0.0001490265f, 0.0001456006f, 0.0001386719f, 0.0001284619f, 0.0001152928f,
+ 0.0000995735f, 0.0000817902f, 0.0000624834f, 0.0000422315f, 0.0000216225f, 0.0000012352f, -0.0000183878f, -0.0000367552f,
+ 0.0001023410f, 0.0001121154f, 0.0001195973f, 0.0001245785f, 0.0001269032f, 0.0001264687f, 0.0001232335f, 0.0001172154f,
+ 0.0001084967f, 0.0000972190f, 0.0000835860f, 0.0000678549f, 0.0000503359f, 0.0000313814f, 0.0000113831f, -0.0000092410f,
+ -0.0000300509f, -0.0000505985f, -0.0000704325f, -0.0000891123f, -0.0001062126f, -0.0001213366f, -0.0001341197f, -0.0001442414f,
+ -0.0001514272f, -0.0001554600f, -0.0001561797f, -0.0001534931f, -0.0001473717f, -0.0001378600f, -0.0001250712f, -0.0001091929f,
+ -0.0000904812f, -0.0000692631f, -0.0000459277f, -0.0000209260f, 0.0000052416f, 0.0000320286f, 0.0000588582f, 0.0000851296f,
+ 0.0001102367f, 0.0001335760f, 0.0001545675f, 0.0001726629f, 0.0001873663f, 0.0001982416f, 0.0002049310f, 0.0002071594f,
+ 0.0002047497f, 0.0001976225f, 0.0001858068f, 0.0001694347f, 0.0001487471f, 0.0001240832f, 0.0000958818f, 0.0000646662f,
+ 0.0000310422f, -0.0000043212f, -0.0000406957f, -0.0000773156f, -0.0001133832f, -0.0001480928f, -0.0001806368f, -0.0002102303f,
+ -0.0002361185f, -0.0002576013f, -0.0002740408f, -0.0002848864f, -0.0002896805f, -0.0002880829f, -0.0002798740f, -0.0002649766f,
+ -0.0002434546f, -0.0002155298f, -0.0001815742f, -0.0001421204f, -0.0000978454f, -0.0000495727f, 0.0000017521f, 0.0000550676f,
+ 0.0001092294f, 0.0001630223f, 0.0002152001f, 0.0002645008f, 0.0003096899f, 0.0003495759f, 0.0003830534f, 0.0004091148f,
+ 0.0004268910f, 0.0004356569f, 0.0004348671f, 0.0004241540f, 0.0004033574f, 0.0003725151f, 0.0003318867f, 0.0002819362f,
+ 0.0002233505f, 0.0001570144f, 0.0000840236f, 0.0000056513f, -0.0000766447f, -0.0001612647f, -0.0002464668f, -0.0003304197f,
+ -0.0004112104f, -0.0004869065f, -0.0005555699f, -0.0006153285f, -0.0006643921f, -0.0007011284f, -0.0007240766f, -0.0007320225f,
+ -0.0007240025f, -0.0006993717f, -0.0006577934f, -0.0005992952f, -0.0005242405f, -0.0004333727f, -0.0003277670f, -0.0002088657f,
+ -0.0000784141f, 0.0000615090f, 0.0002085679f, 0.0003601400f, 0.0005134039f, 0.0006653091f, 0.0008126807f, 0.0009521955f,
+ 0.0010805136f, 0.0011942726f, 0.0012902629f, 0.0013654507f, 0.0014172107f, 0.0014433822f, 0.0014425598f, 0.0014141671f,
+ 0.0013587836f, 0.0012781916f, 0.0011756894f, 0.0010560340f, 0.0009256640f, 0.0007924355f, 0.0006656655f, 0.0005555507f,
+ 0.0004729584f, 0.0004284373f, 0.0004317362f, 0.0004903651f, 0.0006089185f, 0.0007872127f, 0.0010196237f, 0.0012928786f,
+ 0.0015857907f, 0.0018667312f, 0.0020943919f, 0.0022145657f, 0.0021631986f, 0.0018604759f, 0.0012208798f, 0.0000292075f,
+ -0.0021197116f, -0.0054807990f, -0.0100496540f, -0.0156837116f, -0.0221176153f, -0.0289836659f, -0.0358300499f, -0.0421477124f,
+ -0.0473972472f, -0.0510405877f, -0.0525715807f, -0.0515476777f, -0.0476183263f, -0.0405511583f, -0.0302526219f, -0.0167837577f,
+ -0.0003687048f, 0.0186033188f, 0.0395840702f, 0.0618793275f, 0.0846695731f, 0.1070368665f, 0.1279977851f, 0.1465405975f,
+ 0.1616659442f, 0.1724289210f, 0.1779814634f, 0.1776128485f, 0.1707870983f, 0.1571752579f, 0.1366814829f, 0.1094613028f,
+ 0.0759313883f, 0.0367697773f, -0.0070935349f, -0.0544959696f, -0.1040711201f, -0.1542864664f, -0.2034887901f, -0.2499561795f,
+ -0.2919547949f, -0.3277987591f, -0.3559109665f, -0.3748828886f, -0.3835310580f, -0.3809483068f, -0.3665476249f, -0.3400970096f,
+ -0.3017436398f, -0.2520263114f, -0.1918751666f, -0.1225984212f, -0.0458559702f, 0.0363795557f, 0.1218735116f, 0.2081903173f,
+ 0.2927633059f, 0.3729712075f, 0.4462190576f, 0.5100209195f, 0.5620818683f, 0.6003764644f, 0.6232211630f, 0.6293380722f,
+ 0.6179078583f, 0.5886097344f, 0.5416469980f, 0.4777568614f, 0.3982039462f, 0.3047571785f, 0.1996504916f, 0.0855281262f,
+ -0.0346240344f, -0.1575593206f, -0.2798609975f, -0.3980402954f, -0.5086387923f, -0.6083321215f, -0.6940317623f, -0.7629817970f,
+ -0.8128474994f, -0.8417929488f, -0.8485450365f, -0.8324417371f, -0.7934628536f, -0.7322420813f, -0.6500596798f, -0.5488157513f,
+ -0.4309846022f, -0.2995513767f, -0.1579325879f, -0.0098828159f, 0.1406098406f, 0.2894364546f, 0.4324848701f, 0.5657586229f,
+ 0.6854937093f, 0.7882695488f, 0.8711108731f, 0.9315772485f, 0.9678376107f, 0.9787272513f, 0.9637856763f, 0.9232737576f,
+ 0.8581699744f, 0.7701451849f, 0.6615174635f, 0.5351870989f, 0.3945560458f, 0.2434310351f, 0.0859296286f, -0.0736424535f,
+ -0.2310634168f, -0.3823114335f, -0.5235213255f, -0.6510808750f, -0.7617398230f, -0.8526941807f, -0.9216599849f, -0.9669314227f,
+ -0.9874241586f, -0.9827015967f, -0.9529842399f, -0.8991414091f, -0.8226659724f, -0.7256325245f, -0.6106403919f, -0.4807428752f,
+ -0.3393647947f, -0.1902104941f, -0.0371648883f, 0.1158098198f, 0.2647789049f, 0.4059385830f, 0.5357153558f, 0.6508586114f,
+ 0.7485239966f, 0.8263453865f, 0.8824935656f, 0.9157201366f, 0.9253855645f, 0.9114707230f, 0.8745717535f, 0.8158785137f,
+ 0.7371373367f, 0.6405992467f, 0.5289551681f, 0.4052600056f, 0.2728477634f, 0.1352400975f, -0.0039491512f, -0.1411108055f,
+ -0.2727359386f, -0.3955076155f, -0.5063863406f, -0.6026869640f, -0.6821450593f, -0.7429710985f, -0.7838911084f, -0.8041728778f,
+ -0.8036371970f, -0.7826540315f, -0.7421239451f, -0.6834454939f, -0.6084696882f, -0.5194429622f, -0.4189403872f, -0.3097911110f,
+ -0.1949981889f, -0.0776550965f, 0.0391387290f, 0.1523609846f, 0.2591459713f, 0.3568583179f, 0.4431590282f, 0.5160621741f,
+ 0.5739808402f, 0.6157612575f, 0.6407044060f, 0.6485747369f, 0.6395960249f, 0.6144347317f, 0.5741715934f, 0.5202624757f,
+ 0.4544898084f, 0.3789061628f, 0.2957717132f, 0.2074874749f, 0.1165262725f, 0.0253634355f, -0.0635908373f, -0.1480555764f,
+ -0.2259378928f, -0.2953850427f, -0.3548284161f, -0.4030183987f, -0.4390493642f, -0.4623743329f, -0.4728091652f, -0.4705264349f,
+ -0.4560394511f, -0.4301771396f, -0.3940507708f, -0.3490137022f, -0.2966155068f, -0.2385519527f, -0.1766124162f, -0.1126263061f,
+ -0.0484101006f, 0.0142835032f, 0.0738128901f, 0.1286900297f, 0.1776170652f, 0.2195161266f, 0.2535516850f, 0.2791450556f,
+ 0.2959808562f, 0.3040055207f, 0.3034181575f, 0.2946543119f, 0.2783633373f, 0.2553803089f, 0.2266934879f, 0.1934085139f,
+ 0.1567104961f, 0.1178252714f, 0.0779810094f, 0.0383713679f, 0.0001212356f, -0.0357439328f, -0.0683244197f, -0.0968674883f,
+ -0.1207831483f, -0.1396541129f, -0.1532399189f, -0.1614752576f, -0.1644628650f, -0.1624613596f, -0.1558686952f, -0.1452018785f,
+ -0.1310738418f, -0.1141682734f, -0.0952134023f, -0.0749555678f, -0.0541335559f, -0.0334544361f, -0.0135717544f, 0.0049333847f,
+ 0.0215677075f, 0.0359373755f, 0.0477554333f, 0.0568451598f, 0.0631392301f, 0.0666750625f, 0.0675865095f, 0.0660925397f,
+ 0.0624832536f, 0.0571040881f, 0.0503386382f, 0.0425910695f, 0.0342685282f, 0.0257645482f, 0.0174437200f, 0.0096285741f,
+ 0.0025886897f, -0.0034671163f, -0.0083958582f, -0.0121219514f, -0.0146360592f, -0.0159904888f, -0.0162924414f, -0.0156942489f,
+ -0.0143825819f, -0.0125652661f, -0.0104587259f, -0.0082734050f, -0.0062022974f, -0.0044063851f, -0.0030085782f, -0.0020299468f,
+ -0.0013564795f, -0.0008863453f, -0.0005771741f, -0.0003938621f, -0.0003061649f, -0.0002866266f, -0.0003117925f, -0.0003614869f,
+ -0.0004195045f, -0.0004730462f, -0.0005129312f, -0.0005329799f, -0.0005299127f, -0.0005026982f, -0.0004523006f, -0.0003810636f,
+ -0.0002924326f, -0.0001904381f, -0.0000794736f, 0.0000360876f, 0.0001520218f, 0.0002645035f, 0.0003701407f, 0.0004661098f,
+ 0.0005501197f, 0.0006204662f, 0.0006759537f, 0.0007159048f, 0.0007400667f, 0.0007486024f, 0.0007420006f, 0.0007210650f,
+ 0.0006868352f, 0.0006405800f, 0.0005837296f, 0.0005178714f, 0.0004446899f, 0.0003659600f, 0.0002834907f, 0.0001991139f,
+ 0.0001146287f, 0.0000317867f, -0.0000477626f, -0.0001224860f, -0.0001910156f, -0.0002521590f, -0.0003049377f, -0.0003485879f,
+ -0.0003825850f, -0.0004066332f, -0.0004206749f, -0.0004248679f, -0.0004195832f, -0.0004053722f, -0.0003829556f, -0.0003531864f,
+ -0.0003170337f, -0.0002755456f, -0.0002298325f, -0.0001810330f, -0.0001302996f, -0.0000787683f, -0.0000275484f, 0.0000223042f,
+ 0.0000697938f, 0.0001140082f, 0.0001541235f, 0.0001894239f, 0.0002193054f, 0.0002432921f, 0.0002610376f, 0.0002723377f,
+ 0.0002771279f, 0.0002754901f, 0.0002676451f, 0.0002539525f, 0.0002348963f, 0.0002110770f, 0.0001831908f, 0.0001520155f,
+ 0.0001183840f, 0.0000831661f, 0.0000472400f, 0.0000114735f, -0.0000233037f, -0.0000563155f, -0.0000868623f, -0.0001143311f,
+ -0.0001382112f, -0.0001580971f, -0.0001736964f, -0.0001848263f, -0.0001914138f, -0.0001934872f, -0.0001911719f, -0.0001846781f,
+ -0.0001742945f, -0.0001603745f, -0.0001433301f, -0.0001236179f, -0.0001017335f, -0.0000781989f, -0.0000535563f, -0.0000283571f,
+ -0.0000031551f, 0.0000215050f, 0.0000450945f, 0.0000671132f, 0.0000870967f, 0.0001046293f, 0.0001193514f, 0.0001309712f,
+ 0.0001392702f, 0.0001441122f, 0.0001454457f, 0.0001433077f, 0.0001378215f, 0.0001291946f, 0.0001177105f, 0.0001037219f,
+ 0.0000876371f, 0.0000699088f, 0.0000510177f, 0.0000314597f, 0.0000117289f, -0.0000076947f, -0.0000263593f, -0.0000438511f,
+ 0.0001150132f, 0.0001210457f, 0.0001243256f, 0.0001247272f, 0.0001221905f, 0.0001167241f, 0.0001084050f, 0.0000973782f,
+ 0.0000838538f, 0.0000681026f, 0.0000504506f, 0.0000312726f, 0.0000109840f, -0.0000099676f, -0.0000311119f, -0.0000519657f,
+ -0.0000720435f, -0.0000908672f, -0.0001079775f, -0.0001229433f, -0.0001353725f, -0.0001449210f, -0.0001513017f, -0.0001542924f,
+ -0.0001537428f, -0.0001495795f, -0.0001418111f, -0.0001305291f, -0.0001159099f, -0.0000982119f, -0.0000777730f, -0.0000550042f,
+ -0.0000303824f, -0.0000044402f, 0.0000222446f, 0.0000490630f, 0.0000753874f, 0.0001005877f, 0.0001240454f, 0.0001451693f,
+ 0.0001634096f, 0.0001782724f, 0.0001893315f, 0.0001962400f, 0.0001987389f, 0.0001966654f, 0.0001899567f, 0.0001786543f,
+ 0.0001629038f, 0.0001429540f, 0.0001191532f, 0.0000919438f, 0.0000618549f, 0.0000294929f, -0.0000044692f, -0.0000393044f,
+ -0.0000742456f, -0.0001085004f, -0.0001412677f, -0.0001717545f, -0.0001991934f, -0.0002228606f, -0.0002420939f, -0.0002563091f,
+ -0.0002650175f, -0.0002678393f, -0.0002645180f, -0.0002549296f, -0.0002390911f, -0.0002171644f, -0.0001894582f, -0.0001564244f,
+ -0.0001186528f, -0.0000768603f, -0.0000318787f, 0.0000153623f, 0.0000638538f, 0.0001125289f, 0.0001602850f, 0.0002060085f,
+ 0.0002485978f, 0.0002869886f, 0.0003201766f, 0.0003472410f, 0.0003673652f, 0.0003798567f, 0.0003841643f, 0.0003798944f,
+ 0.0003668225f, 0.0003449050f, 0.0003142851f, 0.0002752981f, 0.0002284708f, 0.0001745194f, 0.0001143417f, 0.0000490064f,
+ -0.0000202635f, -0.0000921091f, -0.0001650610f, -0.0002375657f, -0.0003080181f, -0.0003747934f, -0.0004362837f, -0.0004909328f,
+ -0.0005372734f, -0.0005739597f, -0.0005998016f, -0.0006137920f, -0.0006151340f, -0.0006032611f, -0.0005778563f, -0.0005388644f,
+ -0.0004865040f, -0.0004212729f, -0.0003439544f, -0.0002556177f, -0.0001576201f, -0.0000516007f, 0.0000605233f, 0.0001765734f,
+ 0.0002941267f, 0.0004105520f, 0.0005230524f, 0.0006287329f, 0.0007246810f, 0.0008080802f, 0.0008763365f, 0.0009272432f,
+ 0.0009591516f, 0.0009711764f, 0.0009633904f, 0.0009370386f, 0.0008947118f, 0.0008405162f, 0.0007801566f, 0.0007209907f,
+ 0.0006719403f, 0.0006433567f, 0.0006466802f, 0.0006940691f, 0.0007977534f, 0.0009694468f, 0.0012193921f, 0.0015557448f,
+ 0.0019833924f, 0.0025041582f, 0.0031158854f, 0.0038235626f, 0.0046346272f, 0.0054390989f, 0.0060159327f, 0.0061653048f,
+ 0.0057248818f, 0.0045689017f, 0.0026174491f, -0.0001576249f, -0.0037279496f, -0.0080071970f, -0.0128521554f, -0.0180669900f,
+ -0.0234101334f, -0.0286038762f, -0.0333460639f, -0.0373236148f, -0.0402271782f, -0.0417664366f, -0.0416853226f, -0.0397765655f,
+ -0.0358948666f, -0.0299681460f, -0.0220062759f, -0.0121068734f, -0.0004577646f, 0.0126640959f, 0.0268973823f, 0.0418047890f,
+ 0.0568849057f, 0.0715872627f, 0.0853301253f, 0.0975204815f, 0.1075755810f, 0.1149452916f, 0.1191344911f, 0.1197246774f,
+ 0.1163939799f, 0.1089347803f, 0.0972682074f, 0.0814548499f, 0.0617011436f, 0.0383610136f, 0.0119325064f, -0.0169506961f,
+ -0.0475328132f, -0.0789543128f, -0.1102746589f, -0.1404988789f, -0.1686072305f, -0.1935871058f, -0.2144662161f, -0.2303460115f,
+ -0.2404342559f, -0.2440756538f, -0.2407794617f, -0.2302430666f, -0.2123706161f, -0.1872859065f, -0.1553388989f, -0.1171054066f,
+ -0.0733797097f, -0.0251600584f, 0.0263727389f, 0.0798832323f, 0.1339151136f, 0.1869300341f, 0.2373504277f, 0.2836051694f,
+ 0.3241767553f, 0.3576486211f, 0.3827511531f, 0.3984049546f, 0.4037599595f, 0.3982290834f, 0.3815152127f, 0.3536305207f,
+ 0.3149072795f, 0.2659995936f, 0.2078757153f, 0.1418008973f, 0.0693110001f, -0.0078226274f, -0.0876362185f, -0.1680235605f,
+ -0.2467916047f, -0.3217202299f, -0.3906245377f, -0.4514179183f, -0.5021740836f, -0.5411862254f, -0.5670215229f, -0.5785692885f,
+ -0.5750812186f, -0.5562023763f, -0.5219918070f, -0.4729319281f, -0.4099261771f, -0.3342846951f, -0.2476981973f, -0.1522004957f,
+ -0.0501205046f, 0.0559751503f, 0.1633474747f, 0.2691567323f, 0.3705384397f, 0.4646816888f, 0.5489076127f, 0.6207458062f,
+ 0.6780064885f, 0.7188463213f, 0.7418258915f, 0.7459571192f, 0.7307390569f, 0.6961809001f, 0.6428113176f, 0.5716736392f,
+ 0.4843067689f, 0.3827121551f, 0.2693074809f, 0.1468681897f, 0.0184582454f, -0.1126480739f, -0.2430513537f, -0.3693168934f,
+ -0.4880668522f, -0.5960721328f, -0.6903415076f, -0.7682054473f, -0.8273923237f, -0.8660947411f, -0.8830241082f, -0.8774517523f,
+ -0.8492353530f, -0.7988297417f, -0.7272816665f, -0.6362084256f, -0.5277608621f, -0.4045714971f, -0.2696891599f, -0.1265016829f,
+ 0.0213512370f, 0.1700728247f, 0.3158090264f, 0.4547507613f, 0.5832357292f, 0.6978471330f, 0.7955064526f, 0.8735578646f,
+ 0.9298417700f, 0.9627555531f, 0.9712996189f, 0.9551076043f, 0.9144595827f, 0.8502781043f, 0.7641067542f, 0.6580721014f,
+ 0.5348295632f, 0.3974950823f, 0.2495638365f, 0.0948188243f, -0.0627690415f, -0.2191456458f, -0.3702816044f, -0.5122788950f,
+ -0.6414754270f, -0.7545417373f, -0.8485716286f, -0.9211570287f, -0.9704889399f, -0.9954247591f, -0.9954218673f, -0.9705217574f,
+ -0.9213839861f, -0.8492714879f, -0.7560202971f, -0.6439925425f, -0.5160173451f, -0.3753189325f, -0.2254355616f, -0.0701299883f,
+ 0.0867051692f, 0.2411456382f, 0.3893340590f, 0.5275770178f, 0.6524375705f, 0.7608213615f, 0.8500537691f, 0.9179464760f,
+ 0.9628514821f, 0.9837014823f, 0.9800353577f, 0.9520083832f, 0.9003867192f, 0.8265265439f, 0.7323382228f, 0.6202366175f,
+ 0.4930786891f, 0.3540901510f, 0.2067829436f, 0.0548657749f, -0.0978500833f, -0.2475472308f, -0.3904984352f, -0.5231602531f,
+ -0.6422616826f, -0.7448855335f, -0.8285405425f, -0.8912223677f, -0.9314620191f, -0.9483604838f, -0.9416087836f, -0.9114929628f,
+ -0.8588840025f, -0.7852129374f, -0.6924319284f, -0.5829623058f, -0.4596310148f, -0.3255970991f, -0.1842701886f, -0.0392230686f,
+ 0.1058993714f, 0.2474725071f, 0.3819832739f, 0.5061180987f, 0.6168452203f, 0.7114893652f, 0.7877968946f, 0.8439898530f,
+ 0.8788075843f, 0.8915349645f, 0.8820165939f, 0.8506567100f, 0.7984048958f, 0.7267280723f, 0.6375695654f, 0.5332964054f,
+ 0.4166362696f, 0.2906057742f, 0.1584319899f, 0.0234692546f, -0.1108865770f, -0.2412842200f, -0.3645012037f, -0.4775241203f,
+ -0.5776228825f, -0.6624171300f, -0.7299331734f, -0.7786500916f, -0.8075339158f, -0.8160591222f, -0.8042170147f, -0.7725108907f,
+ -0.7219382530f, -0.6539606307f, -0.5704619141f, -0.4736963677f, -0.3662277643f, -0.2508612725f, -0.1305699260f, -0.0084175965f,
+ 0.1125195105f, 0.2292308248f, 0.3388468469f, 0.4387101575f, 0.5264402212f, 0.5999904058f, 0.6576958356f, 0.6983109662f,
+ 0.7210360284f, 0.7255318034f, 0.7119224786f, 0.6807866622f, 0.6331369228f, 0.5703885257f, 0.4943182949f, 0.4070147863f,
+ 0.3108211535f, 0.2082722739f, 0.1020278156f, -0.0051969757f, -0.1107009698f, -0.2118655199f, -0.3062197747f, -0.3915012914f,
+ -0.4657104605f, -0.5271574266f, -0.5745004072f, -0.6067745424f, -0.6234106746f, -0.6242437161f, -0.6095105484f, -0.5798376568f,
+ -0.5362189802f, -0.4799846893f, -0.4127618434f, -0.3364280618f, -0.2530595200f, -0.1648746973f, -0.0741754031f, 0.0167133565f,
+ 0.1055030935f, 0.1899996005f, 0.2681572959f, 0.3381288062f, 0.3983085785f, 0.4473694991f, 0.4842916874f, 0.5083828586f,
+ 0.5192898714f, 0.5170013229f, 0.5018412808f, 0.4744544796f, 0.4357835192f, 0.3870388112f, 0.3296621862f, 0.2652852328f,
+ 0.1956835517f, 0.1227281969f, 0.0483356232f, -0.0255825221f, -0.0971684532f, -0.1646648843f, -0.2264580855f, -0.2811163005f,
+ -0.3274226190f, -0.3644015563f, -0.3913387774f, -0.4077935926f, -0.4136040520f, -0.4088846629f, -0.3940169539f, -0.3696332868f,
+ -0.3365944947f, -0.2959620717f, -0.2489657697f, -0.1969675619f, -0.1414230072f, -0.0838410952f, -0.0257436705f, 0.0313744817f,
+ 0.0860838469f, 0.1370557180f, 0.1830941784f, 0.2231637715f, 0.2564122248f, 0.2821877493f, 0.3000505886f, 0.3097786572f,
+ 0.3113672668f, 0.3050231025f, 0.2911527592f, 0.2703462881f, 0.2433563271f, 0.2110734944f, 0.1744988056f, 0.1347139397f,
+ 0.0928502123f, 0.0500571304f, 0.0074713874f, -0.0338128732f, -0.0727717585f, -0.1084765990f, -0.1401155933f, -0.1670116352f,
+ -0.1886359510f, -0.2046172992f, -0.2147466154f, -0.2189771152f, -0.2174199887f, -0.2103359435f, -0.1981229573f, -0.1813006959f,
+ -0.1604921331f, -0.1364029689f, -0.1097994880f, -0.0814855216f, -0.0522791841f, -0.0229900383f, 0.0056026879f, 0.0327702587f,
+ 0.0578524543f, 0.0802730249f, 0.0995522334f, 0.1153162297f, 0.1273031071f, 0.1353655831f, 0.1394703527f, 0.1396942492f,
+ 0.1362174419f, 0.1293139704f, 0.1193399898f, 0.1067201472f, 0.0919325573f, 0.0754928613f, 0.0579378715f, 0.0398092914f,
+ 0.0216379870f, 0.0039292462f, -0.0128505743f, -0.0282856818f, -0.0420204769f, -0.0537669816f, -0.0633099271f, -0.0705094521f,
+ -0.0753014229f, -0.0776954715f, -0.0777709009f, -0.0756706792f, -0.0715937815f, -0.0657861933f, -0.0585309019f, -0.0501372415f,
+ -0.0409299405f, -0.0312382391f, -0.0213854050f, -0.0116789736f, -0.0024019780f, 0.0061945814f, 0.0138978546f, 0.0205376997f,
+ 0.0259896162f, 0.0301760169f, 0.0330658894f, 0.0346729129f, 0.0350521841f, 0.0342957066f, 0.0325268747f, 0.0298941639f,
+ 0.0265643082f, 0.0227151980f, 0.0185287912f, 0.0141842567f, 0.0098516209f, 0.0056860875f, 0.0018232500f, -0.0016247097f,
+ -0.0045716876f, -0.0069591888f, -0.0087566559f, -0.0099606909f, -0.0105931800f, -0.0106985104f, -0.0103399437f, -0.0095954160f,
+ -0.0085528538f, -0.0073053349f, -0.0059461694f, -0.0045642672f, -0.0032398065f, -0.0020405892f, -0.0010189826f, -0.0002098435f,
+ 0.0003708603f, 0.0007263907f, 0.0008791003f, 0.0008719916f, 0.0007765784f, 0.0006548666f, 0.0005262292f, 0.0003982537f,
+ 0.0002793177f, 0.0001753141f, 0.0000904043f, 0.0000267020f, -0.0000151645f, -0.0000359786f, -0.0000374823f, -0.0000222110f,
+ 0.0000068647f, 0.0000464960f, 0.0000934169f, 0.0001444514f, 0.0001966810f, 0.0002474932f, 0.0002946695f, 0.0003363826f,
+ 0.0003712266f, 0.0003981800f, 0.0004166001f, 0.0004261695f, 0.0004268735f, 0.0004189444f, 0.0004028356f, 0.0003791712f,
+ 0.0003487233f, 0.0003123700f, 0.0002710780f, 0.0002258678f, 0.0001778001f, 0.0001279460f, 0.0000773754f, 0.0000271305f,
+ -0.0000217852f, -0.0000684311f, -0.0001119393f, -0.0001515353f, -0.0001865458f, -0.0002164146f, -0.0002407060f, -0.0002591149f,
+ -0.0002714651f, -0.0002777121f, -0.0002779362f, -0.0002723393f, -0.0002612330f, -0.0002450307f, -0.0002242325f, -0.0001994145f,
+ -0.0001712119f, -0.0001403075f, -0.0001074144f, -0.0000732647f, -0.0000385932f, -0.0000041262f, 0.0000294329f, 0.0000614144f,
+ 0.0000911952f, 0.0001182080f, 0.0001419530f, 0.0001620054f, 0.0001780247f, 0.0001897598f, 0.0001970554f, 0.0001998531f,
+ 0.0001981941f, 0.0001922157f, 0.0001821496f, 0.0001683132f, 0.0001511033f, 0.0001309836f, 0.0001084739f, 0.0000841346f,
+ 0.0000585541f, 0.0000323319f, 0.0000060653f, -0.0000196656f, -0.0000443104f, -0.0000673606f, -0.0000883586f, -0.0001069066f,
+ -0.0001226716f, -0.0001353906f, -0.0001448717f, -0.0001509959f, -0.0001537153f, -0.0001530521f, -0.0001490949f, -0.0001419958f,
+ -0.0001319651f, -0.0001192675f, -0.0001042156f, -0.0000871648f, -0.0000685059f, -0.0000486591f, -0.0000280649f, -0.0000071771f,
+ 0.0000135476f, 0.0000336575f, 0.0000527172f, 0.0000703161f, 0.0000860792f, 0.0000996749f, 0.0001108247f, 0.0001193085f,
+ 0.0001249716f, 0.0001277272f, 0.0001275584f, 0.0001245179f, 0.0001187256f, 0.0001103637f, 0.0000996709f, 0.0000869347f,
+ 0.0001080714f, 0.0000990683f, 0.0000875489f, 0.0000737219f, 0.0000578554f, 0.0000402709f, 0.0000213391f, 0.0000014712f,
+ -0.0000188884f, -0.0000392732f, -0.0000592037f, -0.0000782001f, -0.0000957929f, -0.0001115356f, -0.0001250152f, -0.0001358638f,
+ -0.0001437678f, -0.0001484773f, -0.0001498120f, -0.0001476681f, -0.0001420207f, -0.0001329265f, -0.0001205227f, -0.0001050259f,
+ -0.0000867271f, -0.0000659874f, -0.0000432293f, -0.0000189302f, 0.0000063897f, 0.0000321758f, 0.0000578526f, 0.0000828338f,
+ 0.0001065369f, 0.0001283935f, 0.0001478642f, 0.0001644485f, 0.0001776986f, 0.0001872284f, 0.0001927257f, 0.0001939584f,
+ 0.0001907842f, 0.0001831541f, 0.0001711180f, 0.0001548245f, 0.0001345226f, 0.0001105567f, 0.0000833641f, 0.0000534651f,
+ 0.0000214568f, -0.0000120012f, -0.0000461970f, -0.0000803840f, -0.0001137931f, -0.0001456534f, -0.0001752051f, -0.0002017210f,
+ -0.0002245193f, -0.0002429841f, -0.0002565765f, -0.0002648525f, -0.0002674704f, -0.0002642056f, -0.0002549531f, -0.0002397370f,
+ -0.0002187078f, -0.0001921470f, -0.0001604577f, -0.0001241645f, -0.0000838982f, -0.0000403913f, 0.0000055419f, 0.0000530134f,
+ 0.0001010845f, 0.0001487757f, 0.0001950921f, 0.0002390326f, 0.0002796173f, 0.0003158959f, 0.0003469755f, 0.0003720281f,
+ 0.0003903206f, 0.0004012217f, 0.0004042346f, 0.0003990046f, 0.0003853554f, 0.0003632970f, 0.0003330658f, 0.0002951288f,
+ 0.0002502244f, 0.0001993576f, 0.0001438330f, 0.0000852306f, 0.0000254212f, -0.0000334924f, -0.0000891888f, -0.0001392362f,
+ -0.0001811447f, -0.0002125359f, -0.0002312354f, -0.0002355083f, -0.0002241797f, -0.0001969318f, -0.0001544184f, -0.0000986120f,
+ -0.0000328538f, 0.0000377552f, 0.0001064640f, 0.0001643821f, 0.0002009417f, 0.0002030084f, 0.0001564122f, 0.0000272101f,
+ -0.0002474236f, -0.0007077450f, -0.0013549123f, -0.0021692285f, -0.0031123474f, -0.0041302220f, -0.0051556983f, -0.0061124129f,
+ -0.0069187044f, -0.0074922749f, -0.0077547251f, -0.0076363116f, -0.0070802717f, -0.0060468886f, -0.0045167944f, -0.0024936150f,
+ -0.0000055857f, 0.0028937610f, 0.0061260810f, 0.0095897406f, 0.0131624981f, 0.0167051532f, 0.0200661755f, 0.0230870624f,
+ 0.0256083449f, 0.0274759454f, 0.0285477406f, 0.0287000110f, 0.0278335968f, 0.0258794506f, 0.0228034121f, 0.0186099337f,
+ 0.0133446258f, 0.0070954201f, -0.0000077076f, -0.0077945612f, -0.0160580606f, -0.0245590879f, -0.0330327072f, -0.0411956451f,
+ -0.0487548015f, -0.0554165787f, -0.0608967236f, -0.0649304010f, -0.0672821451f, -0.0677553773f, -0.0662011304f, -0.0625256765f,
+ -0.0566967379f, -0.0487480334f, -0.0387819173f, -0.0269699584f, -0.0135513300f, 0.0011710168f, 0.0168363911f, 0.0330344995f,
+ 0.0493155343f, 0.0652019647f, 0.0802017491f, 0.0938226053f, 0.1055869534f, 0.1150470840f, 0.1218001096f, 0.1255022179f,
+ 0.1258817753f, 0.1227508252f, 0.1160145780f, 0.1056785154f, 0.0918528133f, 0.0747538316f, 0.0547025267f, 0.0321197033f,
+ 0.0075181359f, -0.0185083336f, -0.0452985039f, -0.0721400382f, -0.0982878107f, -0.1229839236f, -0.1454788614f, -0.1650532162f,
+ -0.1810393625f, -0.1928424604f, -0.1999601464f, -0.2020003079f, -0.1986963539f, -0.1899194667f, -0.1756873734f, -0.1561692785f,
+ -0.1316866814f, -0.1027099283f, -0.0698504512f, -0.0338487823f, 0.0044414588f, 0.0440732723f, 0.0840292465f, 0.1232472348f,
+ 0.1606481100f, 0.1951648730f, 0.2257723487f, 0.2515166502f, 0.2715435877f, 0.2851251931f, 0.2916835749f, 0.2908113564f,
+ 0.2822880398f, 0.2660917210f, 0.2424057072f, 0.2116197075f, 0.1743254190f, 0.1313064718f, 0.0835228630f, 0.0320901527f,
+ -0.0217461395f, -0.0766403699f, -0.1311801252f, -0.1839222820f, -0.2334308512f, -0.2783156266f, -0.3172706001f, -0.3491110990f,
+ -0.3728086001f, -0.3875222240f, -0.3926259708f, -0.3877308633f, -0.3727012727f, -0.3476648529f, -0.3130156636f, -0.2694102425f,
+ -0.2177565698f, -0.1591960621f, -0.0950789218f, -0.0269333587f, 0.0435706287f, 0.1146620553f, 0.1845133465f, 0.2512872136f,
+ 0.3131848107f, 0.3684939113f, 0.4156358207f, 0.4532097440f, 0.4800333796f, 0.4951785767f, 0.4980010130f, 0.4881629819f,
+ 0.4656485511f, 0.4307705397f, 0.3841689741f, 0.3268008962f, 0.2599216377f, 0.1850578889f, 0.1039731292f, 0.0186261878f,
+ -0.0688760906f, -0.1563309363f, -0.2414952059f, -0.3221429964f, -0.3961238341f, -0.4614199206f, -0.5162009081f, -0.5588747253f,
+ -0.5881330481f, -0.6029901331f, -0.6028138835f, -0.5873482068f, -0.5567259364f, -0.5114718287f, -0.4524953996f, -0.3810736314f,
+ -0.2988238434f, -0.2076672897f, -0.1097842922f, -0.0075619595f, 0.0964642567f, 0.1996737260f, 0.2994269495f, 0.3931333240f,
+ 0.4783186205f, 0.5526904067f, 0.6141996858f, 0.6610970894f, 0.6919820919f, 0.7058438677f, 0.7020926210f, 0.6805804458f,
+ 0.6416110407f, 0.5859378797f, 0.5147507447f, 0.4296508188f, 0.3326148490f, 0.2259491718f, 0.1122346729f, -0.0057360023f,
+ -0.1250274487f, -0.2426350011f, -0.3555608763f, -0.4608910229f, -0.5558706911f, -0.6379767588f, -0.7049849023f, -0.7550298238f,
+ -0.7866568993f, -0.7988638266f, -0.7911310876f, -0.7634403277f, -0.7162800506f, -0.6506383584f, -0.5679827902f, -0.4702276607f,
+ -0.3596896122f, -0.2390324220f, -0.1112023801f, 0.0206441788f, 0.1532193990f, 0.2831865095f, 0.4072444271f, 0.5222121895f,
+ 0.6251110517f, 0.7132421052f, 0.7842573939f, 0.8362226383f, 0.8676698916f, 0.8776386903f, 0.8657045557f, 0.8319940114f,
+ 0.7771856339f, 0.7024969994f, 0.6096577639f, 0.5008694615f, 0.3787529642f, 0.2462848589f, 0.1067243047f, -0.0364678261f,
+ -0.1797154905f, -0.3194175307f, -0.4520389446f, -0.5742010518f, -0.6827682255f, -0.7749289589f, -0.8482691444f, -0.9008356561f,
+ -0.9311885385f, -0.9384404163f, -0.9222820323f, -0.8829932011f, -0.8214388065f, -0.7390498855f, -0.6377901922f, -0.5201090426f,
+ -0.3888815657f, -0.2473378465f, -0.0989827048f, 0.0524918607f, 0.2032993783f, 0.3496543888f, 0.4878683054f, 0.6144431772f,
+ 0.7261609761f, 0.8201660863f, 0.8940388909f, 0.9458585157f, 0.9742531243f, 0.9784364026f, 0.9582292951f, 0.9140663528f,
+ 0.8469865241f, 0.7586085363f, 0.6510914981f, 0.5270816374f, 0.3896465540f, 0.2421985725f, 0.0884091910f, -0.0678832812f,
+ -0.2227704771f, -0.3723727403f, -0.5129372944f, -0.6409334118f, -0.7531420237f, -0.8467376100f, -0.9193601068f, -0.9691751619f,
+ -0.9949209725f, -0.9959407463f, -0.9721996606f, -0.9242862434f, -0.8533978301f, -0.7613110254f, -0.6503400677f, -0.5232887671f,
+ -0.3833452070f, -0.2339716460f, -0.0788505878f, 0.0781931324f, 0.2332895986f, 0.3826182078f, 0.5225019620f, 0.6494973950f,
+ 0.7604792743f, 0.8527171215f, 0.9239423238f, 0.9724036977f, 0.9969105248f, 0.9968616872f, 0.9722604412f, 0.9237142440f,
+ 0.8524198184f, 0.7601336589f, 0.6491288368f, 0.5221390436f, 0.3822913495f, 0.2330292358f, 0.0780278756f, -0.0788963298f,
+ -0.2338796641f, -0.3831062116f, -0.5229017760f, -0.6498243415f, -0.7607488022f, -0.8529439154f, -0.9241395420f, -0.9725825570f,
+ -0.9970800142f, -0.9970285365f, -0.9724291748f, -0.9238873987f, -0.8525981906f, -0.7603166365f, -0.6493147113f, -0.5223253486f,
+ -0.3824751467f, -0.2332073920f, -0.0781972729f, 0.0787386074f, 0.2337362092f, 0.3829791953f, 0.5227929031f, 0.6497348216f,
+ 0.7606793588f, 0.8528947992f, 0.9241105706f, 0.9725731485f, 0.9970892373f, 0.9970551505f, 0.9724716796f, 0.9239440737f,
+ 0.8526671417f, 0.7603958321f, 0.6494020269f, 0.5224186015f, 0.3825721394f, 0.2333059467f, 0.0782952740f, -0.0786431789f,
+ -0.2336452368f, -0.3828943954f, -0.5227157923f, -0.6496666924f, -0.7606212560f, -0.8528475077f, -0.9240746034f, -0.9725487476f,
+ -0.9970763762f, -0.9970535479f, -0.9724808145f, -0.9239632108f, -0.8526953557f, -0.7604320409f, -0.6494450222f, -0.5224670848f,
+ -0.3826247539f, -0.2333613129f, -0.0783520192f, 0.0785863895f, 0.2335896751f, 0.3828412460f, 0.5226661333f, 0.6496214780f,
+ 0.7605813048f, 0.8528134912f, 0.9240470409f, 0.9725280010f, 0.9970626504f, 0.9970468907f, 0.9724811225f, 0.9239702338f,
+ 0.8527087070f, 0.7604512067f, 0.6494693756f, 0.5224958998f, 0.3826572234f, 0.2333965660f, 0.0783891427f, -0.0785483312f,
+ -0.2335516168f, -0.3828041004f, -0.5226307686f, -0.6495886980f, -0.7605518286f, -0.8527879374f, -0.9240259128f, -0.9725116771f,
+ -0.9970513761f, -0.9970407770f, -0.9724801457f, -0.9239742417f, -0.8527174266f, -0.7604642572f, -0.6494862818f, -0.5225161097f,
+ -0.3826801252f, -0.2334215076f, -0.0784154487f, 0.0785213402f, 0.2335246089f, 0.3827777168f, 0.5226056112f, 0.6495653171f,
+ 0.7605307154f, 0.8527695153f, 0.9240105331f, 0.9724996141f, 0.9970428253f, 0.9970358530f, 0.9724788823f, 0.9239765920f,
+ 0.8527232652f, 0.7604733819f, 0.6494984183f, 0.5225309161f, 0.3826971989f, 0.2334403933f, 0.0784356488f, -0.0785003550f,
+ -0.2335033857f, -0.3827568073f, -0.5225855558f, -0.6495466309f, -0.7605138718f, -0.8527549335f, -0.9239985644f, -0.9724905323f,
+ -0.9970368187f, -0.9970330198f, -0.9724792289f, -0.9239800349f, -0.8527296357f, -0.7604824344f, -0.6495098398f, -0.5225443385f,
+ -0.3827122124f, -0.2334565601f, -0.0784525165f, 0.0784832397f, 0.2334864657f, 0.3827405037f, 0.5225702598f, 0.6495326959f,
+ 0.7605016087f, 0.8527446058f, 0.9239903860f, 0.9724846653f, 0.9970333725f, 0.9970320501f, 0.9724807380f, 0.9239839714f,
+ 0.8527358952f, 0.7604908594f, 0.6495202224f, 0.5225564219f, 0.3827256949f, 0.2334710996f, 0.0784677378f,
+};
+
+
+const float ivas_fb_resp_cheby_ramp_32del[IVAS_FB_1MS_32K_SAMP + 1] =
+{
+ 0.010231040569020f, 0.007495943710050f, 0.010178929162785f, 0.013398453336031f,
+ 0.017224667421257f, 0.021716621502222f, 0.026933804139047f, 0.032948050269901f,
+ 0.039809603616101f, 0.047574690662976f, 0.056302264669850f, 0.066034303975194f,
+ 0.076798058466510f, 0.088625188565940f, 0.101547758277136f, 0.115583678333348f,
+ 0.130755763247409f, 0.147071750845082f, 0.164507415202116f, 0.183014970904299f,
+ 0.202613741800170f, 0.223272731589440f, 0.244918942156018f, 0.267509604208255f,
+ 0.290972907623430f, 0.315243955993690f, 0.340239023615672f, 0.365855210507665f,
+ 0.392018902968585f, 0.418630748275114f, 0.445572918038597f, 0.472730394874248f,
+ 0.500000000000000f
+};
+
+const float ivas_fb_resp_cheby_ramp_16del[IVAS_FB_1MS_16K_SAMP + 1] =
+{
+ 0.010924831305822f, 0.013910402297200f, 0.022265243822209f, 0.033383809618597f,
+ 0.047654785522720f, 0.065424889526712f, 0.087005871336219f, 0.112572807795153f,
+ 0.142228383484898f, 0.175983302431557f, 0.213688773924401f, 0.255075179343390f,
+ 0.299758845354607f, 0.347229042543433f, 0.396890172892483f, 0.448063390053926f,
+ 0.500000000000000f
+};
+
+const int16_t ivas_num_active_bands[FB - WB + 1] =
+{
+ IVAS_16K_12BANDS_ACTIVE_BANDS, IVAS_FB_BANDS_12, IVAS_FB_BANDS_12
+};
+
+#endif
+/* clang-format on */
diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h
new file mode 100644
index 0000000000000000000000000000000000000000..12604723baffaf7f1078542d6918aa6d99bd9847
--- /dev/null
+++ b/lib_com/ivas_rom_com.h
@@ -0,0 +1,420 @@
+/******************************************************************************************************
+
+ (C) 2022 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.
+
+*******************************************************************************************************/
+
+#ifndef IVAS_ROM_COM_H
+#define IVAS_ROM_COM_H
+
+#include
+#include "options.h"
+#include "cnst_fx.h"
+#include "ivas_cnst.h"
+#include "typedef.h"
+//#include "stat_com.h"
+//#include "ivas_stat_com.h"
+#ifdef DEBUGGING
+#include "debug.h"
+#endif
+
+
+/*----------------------------------------------------------------------------------*
+ * General IVAS ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const int32_t ivas_brate_tbl[];
+extern const int16_t fast_FCB_bits_2sfr[];
+extern const int16_t fast_FCB_rates_2sfr[];
+
+#if 0
+/*-------------------------------------------------------------------------
+ * DFT Stereo ROM tables
+ *------------------------------------------------------------------------*/
+
+extern const int16_t dft_band_limits_erb4[];
+extern const int16_t dft_band_limits_erb8[];
+extern const int16_t dft_band_ipd[3][4];
+extern const int16_t dft_band_res_cod[3][4];
+
+extern const float dft_res_gains_q[][2];
+extern const float dft_res_cod_alpha[STEREO_DFT_BAND_MAX];
+
+extern const float dft_trigo_12k8[STEREO_DFT_N_12k8_ENC / 4 + 1];
+extern const float dft_trigo_32k[STEREO_DFT_N_32k_ENC / 4 + 1];
+extern const float dft_trigo_48k[STEREO_DFT_N_MAX_ENC / 4 + 1];
+
+/* Golomb-Rice encoding tables */
+extern const int16_t dft_maps_rpg[];
+extern const int16_t dft_code_itd[];
+extern const int16_t dft_len_itd[];
+extern const int16_t dft_maps_sg[NO_SYMB_GR_SIDE_G * NO_SYMB_GR_SIDE_G];
+
+/*----------------------------------------------------------------------------------*
+ * Range Coder ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const uint16_t cum_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][1 + RANGE_N_SYMBOLS];
+extern const uint16_t sym_freq_ari_pk_s17_LC_ext[RANGE_N_CONTEXT][RANGE_N_SYMBOLS];
+
+/*----------------------------------------------------------------------------------*
+ * ECLVQ Stereo ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const uint16_t ECSQ_tab_inverse[1 + ECSQ_SEGMENT_SIZE];
+
+/*----------------------------------------------------------------------------------*
+ * Stereo ICA ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const float ica_sincInterp2[];
+extern const float ica_sincInterp4[];
+extern const float ica_sincInterp6[];
+
+/*----------------------------------------------------------------------------------*
+ * Stereo IC-BWE ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const float icbwe_gsMapping_tbl[];
+extern const float icbwe_gsMappingDFT_tbl[];
+
+/*----------------------------------------------------------------------------------*
+ * TD Stereo ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const float tdm_ratio_tabl[];
+extern const float tdm_den_ratio_tabl[];
+extern const int16_t tdm_bit_allc_tbl[5][6];
+
+#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+/* LSFs Intra-frame prediction tables */
+#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+extern const float tdm_LSF_MEAN_RE_USE_OUT[M];
+extern const float tdm_LSF_MEAN_RE_USE_IN[M];
+extern const float tdm_LSF_MEAN_RE_USE[M];
+
+extern const float tdm_Beta_Q1bit_re_use_132[2];
+extern const float tdm_Beta_Q1bit_re_use_164[2];
+extern const float tdm_Beta_Q1bit_re_use_244_320[2];
+extern const float tdm_Beta_Q1bit_re_use_480[2];
+
+extern const float tdm_RE_USE_adaptive_beta_prd_diag_3[15 + 16 + 15];
+#endif
+
+extern const float tdm_LSF_MEAN_PRED_QNT_OUT[M];
+extern const float tdm_LSF_MEAN_PRED_QNT_IN[M];
+extern const float tdm_LSF_MEAN_PRED_QNT[M];
+extern const float tdm_PRED_QNT_fixed_beta_prd_diag_3[15 + 16 + 15];
+#endif
+
+
+/*----------------------------------------------------------------------------------*
+ * MDCT Stereo ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const SpectrumWarping sw16000Hz[]; /* PsychLPC */
+extern const SpectrumWarping sw25600Hz[]; /* PsychLPC */
+extern const SpectrumWarping sw32000Hz[]; /* PsychLPC */
+
+extern const MDCTStereoBands_config mdctStereoBands_32000_640[];
+extern const float nf_tw_smoothing_coeffs[N_LTP_GAIN_MEMS];
+
+/*----------------------------------------------------------------------------------*
+ * Stereo DTX ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const float dft_cng_coh_pred[][STEREO_DFT_COH_PRED_COEFFS];
+extern const int16_t dft_cng_coh_u2i[9];
+extern const int16_t dft_cng_coh_i2u[9];
+extern const float dft_cng_alpha_bits[STEREO_DFT_N_COH_ALPHA_STEPS][STEREO_DFT_N_COH_ALPHA_LEVELS];
+extern const int16_t dft_cng_coh_alpha_start[STEREO_DFT_N_COH_ALPHA_STEPS - 1];
+
+/*----------------------------------------------------------------------------------*
+ * DirAC ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const float diffuseness_reconstructions[DIRAC_DIFFUSE_LEVELS];
+extern const float diffuseness_thresholds[DIRAC_DIFFUSE_LEVELS + 1];
+extern const int16_t DirAC_band_grouping_12[12 + 1];
+extern const int16_t DirAC_band_grouping_6[6 + 1];
+extern const int16_t DirAC_band_grouping_5[5 + 1];
+extern const int16_t DirAC_block_grouping[MAX_PARAM_SPATIAL_SUBFRAMES + 1];
+extern const int16_t DirAC_block_grouping_5ms_MDFT[MAX_PARAM_SPATIAL_SUBFRAMES + 1];
+
+/*------------------------------------------------------------------------------------------*
+ * SPAR ROM tables
+ *------------------------------------------------------------------------------------------*/
+
+#ifdef FIX_SBA_CLEAN_UP_OPT
+extern const ivas_freq_models_t ivas_arith_pred_r_consts[TOTAL_PRED_QUANT_STRATS_ARITH];
+extern const ivas_freq_models_t ivas_arith_drct_r_consts[TOTAL_DRCT_QUANT_STRATS];
+extern const ivas_freq_models_t ivas_arith_decd_r_consts[TOTAL_DECD_QUANT_STRATS];
+extern const ivas_huff_models_t ivas_huff_pred_r_consts[TOTAL_PRED_QUANT_STRATS_HUFF];
+extern const ivas_huff_models_t ivas_huff_drct_r_consts[TOTAL_DRCT_QUANT_STRATS];
+extern const ivas_huff_models_t ivas_huff_decd_r_consts[TOTAL_DECD_QUANT_STRATS];
+#endif
+extern const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN];
+#ifndef FIX_SBA_CLEAN_UP_OPT
+extern const ivas_arith_consts_t ivas_arith_consts[IVAS_SPAR_BR_TABLE_LEN][MAX_QUANT_STRATS];
+extern const ivas_huff_consts_t ivas_huff_const[IVAS_SPAR_BR_TABLE_LEN][MAX_QUANT_STRATS];
+#endif
+extern const int16_t remix_order_set[1][IVAS_SPAR_MAX_CH];
+extern const int16_t keep_planar[IVAS_SPAR_MAX_CH - FOA_CHANNELS];
+extern const int16_t HOA_keep_ind[IVAS_SPAR_MAX_CH];
+
+extern const float dtx_pd_real_min_max[2];
+extern const int16_t dtx_pd_real_q_levels[3][3];
+extern const int16_t dtx_pr_real_q_levels[3][3];
+extern const int16_t pr_pr_idx_pairs[3][3][2];
+extern const int16_t pr_pd_idx_pairs[3][3][2];
+
+
+/*----------------------------------------------------------------------*
+ * PCA ROM tables
+ *-----------------------------------------------------------------------*/
+
+extern const int32_t ivas_pca_offset_index1[IVAS_PCA_N1 + 1];
+extern const int16_t ivas_pca_offset_index2[2692];
+extern const int16_t ivas_pca_offset_n2[IVAS_PCA_N1];
+
+
+/*----------------------------------------------------------------------------------*
+ * Parametric MC ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const int16_t param_mc_band_grouping_20[20 + 1];
+extern const int16_t param_mc_coding_band_mapping_20[20];
+extern const int16_t param_mc_bands_coded_20[4];
+extern const int16_t param_mc_band_grouping_14[14 + 1];
+extern const int16_t param_mc_coding_band_mapping_14[14];
+extern const int16_t param_mc_bands_coded_14[4];
+extern const int16_t param_mc_band_grouping_10[10 + 1];
+extern const int16_t param_mc_coding_band_mapping_10[10];
+extern const int16_t param_mc_bands_coded_10[4];
+extern const int16_t param_mc_start_bin_per_band_20[20];
+extern const int16_t param_mc_active_bins_per_band_20[20];
+extern const int16_t param_mc_start_bin_per_band_14[14];
+extern const int16_t param_mc_active_bins_per_band_14[14];
+extern const int16_t param_mc_start_bin_per_band_10[10];
+extern const int16_t param_mc_active_bins_per_band_10[10];
+extern const int16_t Param_MC_index[MAX_CICP_CHANNELS];
+extern const PARAM_MC_CONF ivas_param_mc_conf[PARAM_MC_NUM_CONFIGS];
+extern const float ivas_param_mc_quant_ild_5d1_48[PARAM_MC_SZ_ILD_QUANTIZER_4BITS];
+extern const float ivas_param_mc_quant_icc[PARAM_MC_SZ_ICC_QUANTIZER];
+extern const uint16_t ivas_param_mc_cum_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1];
+extern const uint16_t ivas_param_mc_sym_freq_ild_cicp6_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS];
+extern const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS];
+extern const uint16_t ivas_param_mc_sym_freq_ild_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1];
+extern const uint16_t ivas_param_mc_cum_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1];
+extern const uint16_t ivas_param_mc_sym_freq_icc_cicp6_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER];
+extern const uint16_t ivas_param_mc_cum_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER];
+extern const uint16_t ivas_param_mc_sym_freq_icc_delta_cicp6_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1];
+
+extern const uint16_t ivas_param_mc_cum_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1];
+extern const uint16_t ivas_param_mc_sym_freq_ild_cicp12_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS];
+extern const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS];
+extern const uint16_t ivas_param_mc_sym_freq_ild_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1];
+extern const uint16_t ivas_param_mc_cum_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1];
+extern const uint16_t ivas_param_mc_sym_freq_icc_cicp12_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER];
+extern const uint16_t ivas_param_mc_cum_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER];
+extern const uint16_t ivas_param_mc_sym_freq_icc_delta_cicp12_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1];
+
+extern const uint16_t ivas_param_mc_cum_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1];
+extern const uint16_t ivas_param_mc_sym_freq_ild_cicp14_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS];
+extern const uint16_t ivas_param_mc_cum_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS];
+extern const uint16_t ivas_param_mc_sym_freq_ild_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1];
+extern const uint16_t ivas_param_mc_cum_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1];
+extern const uint16_t ivas_param_mc_sym_freq_icc_cicp14_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER];
+extern const uint16_t ivas_param_mc_cum_freq_icc_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER];
+extern const uint16_t ivas_param_mc_sym_freq_icc_delta_cicp14_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1];
+
+extern const uint16_t ivas_param_mc_cum_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS + 1];
+extern const uint16_t ivas_param_mc_sym_freq_ild_combined_48_16bits[PARAM_MC_SZ_ILD_QUANTIZER_4BITS];
+extern const uint16_t ivas_param_mc_cum_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS];
+extern const uint16_t ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_SZ_ILD_QUANTIZER_4BITS - 1];
+extern const uint16_t ivas_param_mc_cum_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER + 1];
+extern const uint16_t ivas_param_mc_sym_freq_icc_combined_48_16bits[PARAM_MC_SZ_ICC_QUANTIZER];
+extern const uint16_t ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER];
+extern const uint16_t ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1];
+
+
+/*----------------------------------------------------------------------------------*
+ * MASA ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const int16_t bits_direction_masa[DIRAC_DIFFUSE_LEVELS];
+extern const int16_t no_theta_masa[NO_SPHERICAL_GRIDS - 2];
+extern const int16_t no_phi_masa[NO_SPHERICAL_GRIDS][MAX_NO_THETA];
+
+extern const float delta_theta_masa[NO_SPHERICAL_GRIDS - 2];
+
+extern const float azimuth_cb[8];
+extern const float coherence_cb0_masa[DIRAC_DIFFUSE_LEVELS * 2 * MASA_NO_CV_COH];
+extern const float coherence_cb1_masa[MASA_NO_CV_COH1 * MASA_MAXIMUM_CODING_SUBBANDS]; /* 25 */
+extern const int16_t len_cb_dct0_masa[DIRAC_DIFFUSE_LEVELS];
+extern const uint8_t sur_coherence_cb_masa[MASA_NO_CB_SUR_COH * MASA_MAX_NO_CV_SUR_COH];
+extern const int16_t idx_cb_sur_coh_masa[MASA_NO_CV_COH];
+extern const int16_t len_huf_masa[MASA_NO_CV_COH1];
+extern const int16_t huff_code_av_masa[MASA_NO_CV_COH1];
+
+extern const int16_t MASA_band_grouping_24[24 + 1];
+extern const int16_t MASA_band_mapping_24_to_18[18 + 1];
+extern const int16_t MASA_band_mapping_24_to_12[12 + 1];
+extern const int16_t MASA_band_mapping_24_to_8[8 + 1];
+extern const int16_t MASA_band_mapping_24_to_5[5 + 1];
+
+extern const int16_t MASA_grouping_8_to_5[8];
+extern const int16_t MASA_grouping_12_to_5[12];
+extern const int16_t MASA_grouping_18_to_5[18];
+extern const int16_t MASA_grouping_24_to_5[24];
+extern const int16_t masa_bits[14];
+extern const int16_t masa_bits_LR_stereo[4];
+extern const int16_t mcmasa_bits[];
+extern const uint8_t masa_nbands[];
+extern const uint8_t masa_joined_nbands[];
+extern const uint8_t masa_twodir_bands[];
+extern const uint8_t masa_twodir_bands_joined[];
+
+/* Multi-channel input and output setups */
+extern const float ls_azimuth_CICP2[2];
+extern const float ls_elevation_CICP2[2];
+extern const float ls_azimuth_CICP6[5];
+extern const float ls_elevation_CICP6[5];
+extern const float ls_azimuth_CICP12[7];
+extern const float ls_elevation_CICP12[7];
+extern const float ls_azimuth_CICP14[7];
+extern const float ls_elevation_CICP14[7];
+extern const float ls_azimuth_CICP16[9];
+extern const float ls_elevation_CICP16[9];
+extern const float ls_azimuth_CICP19[11];
+extern const float ls_elevation_CICP19[11];
+
+extern const float cb_azi_chan[];
+
+extern const float McMASA_LFEGain_vectors[64];
+
+/*----------------------------------------------------------------------------------*
+ * ISM ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const float ism_azimuth_borders[4];
+extern const float ism_elevation_borders[4];
+
+/*----------------------------------------------------------------------------------*
+ * Param ISM ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const int16_t Param_ISM_band_grouping[MAX_PARAM_ISM_NBANDS + 1];
+
+
+/*----------------------------------------------------------------------------------*
+ * LFE coding ROM tables
+ *----------------------------------------------------------------------------------*/
+
+extern const float ivas_lpf_4_butter_16k_sos[IVAS_BIQUAD_FILT_LEN << 2];
+extern const float ivas_lpf_4_butter_32k_sos[IVAS_BIQUAD_FILT_LEN << 2];
+extern const float ivas_lpf_4_butter_48k_sos[IVAS_BIQUAD_FILT_LEN << 2];
+extern const float ivas_lpf_2_butter_16k[IVAS_BIQUAD_FILT_LEN << 1];
+extern const float ivas_lpf_2_butter_32k[IVAS_BIQUAD_FILT_LEN << 1];
+extern const float ivas_lpf_2_butter_48k[IVAS_BIQUAD_FILT_LEN << 1];
+
+extern const float ivas_lfe_window_coeff_48k[IVAS_LFE_FADE_LEN_48K];
+extern const float ivas_lfe_window_coeff_32k[IVAS_LFE_FADE_LEN_32K];
+extern const float ivas_lfe_window_coeff_16k[IVAS_LFE_FADE_LEN_16K];
+
+extern const int16_t ivas_lfe_num_ele_in_coder_models[2][4];
+extern const int16_t ivas_lfe_num_dct_pass_bins_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP];
+extern const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP];
+extern const ivas_lfe_freq_models ivas_str_lfe_freq_models;
+extern const float ivas_lfe_lpf_delay[2];
+
+extern const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2];
+
+extern const float ivas_sin_twiddle_480[IVAS_480_PT_LEN >> 1];
+extern const float ivas_cos_twiddle_480[IVAS_480_PT_LEN >> 1];
+extern const float ivas_sin_twiddle_320[IVAS_320_PT_LEN >> 1];
+extern const float ivas_cos_twiddle_320[IVAS_320_PT_LEN >> 1];
+extern const float ivas_sin_twiddle_160[IVAS_160_PT_LEN >> 1];
+extern const float ivas_cos_twiddle_160[IVAS_160_PT_LEN >> 1];
+extern const float ivas_sin_twiddle_80[IVAS_80_PT_LEN >> 1];
+extern const float ivas_cos_twiddle_80[IVAS_80_PT_LEN >> 1];
+
+/*------------------------------------------------------------------------------------------*
+ * MDFT/iMDFT ROM tables
+ *------------------------------------------------------------------------------------------*/
+
+extern const float ivas_mdft_coeff_cos_twid_240[IVAS_240_PT_LEN + 1];
+extern const float ivas_mdft_coeff_sin_twid_240[IVAS_240_PT_LEN];
+extern const float ivas_mdft_coeff_cos_twid_160[IVAS_160_PT_LEN + 1];
+extern const float ivas_mdft_coeff_sin_twid_160[IVAS_160_PT_LEN];
+extern const float ivas_mdft_coeff_cos_twid_80[IVAS_80_PT_LEN + 1];
+extern const float ivas_mdft_coeff_sin_twid_80[IVAS_80_PT_LEN];
+extern const float ivas_mdft_coeff_cos_twid_40[IVAS_40_PT_LEN + 1];
+extern const float ivas_mdft_coeff_sin_twid_40[IVAS_40_PT_LEN];
+
+extern const float ivas_mdft_coeff_cos_twid_960[IVAS_960_PT_LEN + 1];
+extern const float ivas_mdft_coeff_sin_twid_960[IVAS_960_PT_LEN];
+extern const float ivas_mdft_coeff_cos_twid_640[IVAS_640_PT_LEN + 1];
+extern const float ivas_mdft_coeff_sin_twid_640[IVAS_640_PT_LEN];
+extern const float ivas_mdft_coeff_cos_twid_320[IVAS_320_PT_LEN + 1];
+extern const float ivas_mdft_coeff_sin_twid_320[IVAS_320_PT_LEN];
+
+extern const int16_t dirac_gains_P_idx[16];
+extern const float dirac_gains_norm_term[9];
+extern const float dirac_gains_Pnm[91][9];
+extern const float dirac_gains_trg_term[181][2];
+
+/*------------------------------------------------------------------------------------------*
+ * FB ROM tables
+ *------------------------------------------------------------------------------------------*/
+
+extern const float ivas_fb_fcs_12band_1ms[IVAS_FB_BANDS_12];
+
+extern const float ivas_fb_fr_12band_1ms_re[IVAS_FB_12_1MS_LEN];
+extern const float ivas_fb_fr_12band_1ms_im[IVAS_FB_12_1MS_LEN];
+
+extern const int16_t ivas_fb_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12];
+extern const int16_t ivas_fb_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12];
+extern const int16_t ivas_fb_abs_bins_per_band_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12];
+extern const int16_t ivas_fb_abs_bins_start_offset_12band_1ms[IVAS_NUM_SUPPORTED_FS][IVAS_FB_BANDS_12];
+
+extern const float ivas_fb_cf_4ms_48k[IVAS_FB_4MS_48K_SAMP];
+extern const float ivas_fb_cf_1ms_48k[IVAS_FB_1MS_48K_SAMP];
+extern const float ivas_fb_cf_4ms_32k[IVAS_FB_4MS_32K_SAMP];
+extern const float ivas_fb_cf_1ms_32k[IVAS_FB_1MS_32K_SAMP];
+extern const float ivas_fb_cf_4ms_16k[IVAS_FB_4MS_16K_SAMP];
+extern const float ivas_fb_cf_1ms_16k[IVAS_FB_1MS_16K_SAMP];
+
+extern const float ivas_fb_resp_cheby_ramp_32del[IVAS_FB_1MS_32K_SAMP + 1];
+extern const float ivas_fb_resp_cheby_ramp_16del[IVAS_FB_1MS_16K_SAMP + 1];
+
+extern const int16_t ivas_num_active_bands[FB - WB + 1];
+#endif
+/* IVAS_ROM_COM_H */
+#endif
diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h
new file mode 100644
index 0000000000000000000000000000000000000000..e4adbcd8cb834213bd0071241a5fa28608bccbcb
--- /dev/null
+++ b/lib_com/ivas_stat_com.h
@@ -0,0 +1,793 @@
+/******************************************************************************************************
+
+ (C) 2022 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.
+
+*******************************************************************************************************/
+
+#ifndef IVAS_STAT_COM
+#define IVAS_STAT_COM
+
+#include
+#include "options.h"
+#include "typedef.h"
+#include "cnst_fx.h"
+#include "ivas_cnst.h"
+
+
+/*----------------------------------------------------------------------------------*
+ * Declaration of ISm common (encoder & decoder) structure
+ *----------------------------------------------------------------------------------*/
+
+/* ISM metadata handle (storage for one frame of read ISM metadata) */
+typedef struct
+{
+ int16_t ism_metadata_flag; /* flag whether metadata are coded in particular frame of particular object */
+ int16_t last_ism_metadata_flag; /* last frame ism_metadata_flag */
+
+ float azimuth; /* azimuth value read from the input metadata file */
+ float elevation; /* azimuth value read from the input metadata file */
+
+ int16_t last_azimuth_idx; /* last frame index of coded azimuth */
+ int16_t azimuth_diff_cnt; /* FEC counter of consecutive differentially azimuth coded frames */
+ int16_t last_elevation_idx; /* last frame index of coded elevation */
+ int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */
+
+} ISM_METADATA_FRAME, *ISM_METADATA_HANDLE;
+
+
+/*----------------------------------------------------------------------------------*
+ * Declaration of DFT Stereo common (encoder & decoder) structure
+ *----------------------------------------------------------------------------------*/
+
+typedef struct stereo_dft_config_data_struct
+{
+ int16_t dmx_active;
+ int16_t band_res;
+ int16_t prm_res; /* Send prm every # DFT frames */
+#ifdef DEBUG_MODE_DFT
+ int16_t gipd_mode; /* mode : from 0 (off) to 1 (on) */
+ int16_t itd_mode; /* mode : from 0 (off) to 1 (on) */
+#endif
+ int16_t res_pred_mode; /* mode : from 0 (off) to 1 (on) */
+ int16_t res_cod_mode; /* mode : from 0 (off) to 3 */
+ int16_t hybrid_itd_flag;
+ int16_t ada_wb_res_cod_mode; /* res_cod_mode for adaptive wide band residual coding */
+
+ int16_t force_mono_transmission;
+
+} STEREO_DFT_CONFIG_DATA, *STEREO_DFT_CONFIG_DATA_HANDLE;
+
+
+/*----------------------------------------------------------------------------------*
+ * Declaration of MDCT stereo common (encoder & decoder) structure
+ *----------------------------------------------------------------------------------*/
+
+typedef struct
+{
+ uint8_t const bandLengthsTCX20[SMDCT_MAX_STEREO_BANDS_TCX20]; /* Length of a band in number of bins. Range is 4..160 */
+ const int16_t bdnCnt_TCX20[4]; /* uppermost band for FB,SWB,WB,NB */
+ uint8_t const bandLengthsTCX10[SMDCT_MAX_STEREO_BANDS_TCX10]; /* Length of a band in number of bins. Range is 2..80, always divisible by 2 */
+ const int16_t bndCnt_TCX10[4]; /* uppermost band for FB,SWB,WB,NB */
+
+} MDCTStereoBands_config;
+
+/* MDCT stereo frequency band structure */
+typedef struct stereo_mdct_dec_band_parameters_struct
+{
+ int16_t sfbOffset[MAX_SFB + 1]; /* stereo frequency band start offsets */
+ int16_t sfbCnt; /* number of stereo frequency bands */
+ int16_t nBandsStereoCore; /* number of stereo frequency bands in the core */
+ int16_t sfbIgfStart; /*index for first IGF band*/
+
+} STEREO_MDCT_BAND_PARAMETERS;
+
+
+/*----------------------------------------------------------------------------------*
+ * Declaration of ECLVQ common (encoder & decoder) structure
+ *----------------------------------------------------------------------------------*/
+
+typedef struct
+{
+ int16_t config_index;
+ int16_t encoding_active; /* internal state specifying if actual encoding is active or only length evaluation is active */
+ int32_t bit_count_estimate; /* uses 22Q10 fixed-point representation */
+ void *ac_handle;
+
+} ECSQ_instance;
+
+/*----------------------------------------------------------------------------------*
+ * PARAMETRIC ISM encoder/decoder (common) structure
+ *----------------------------------------------------------------------------------*/
+typedef struct ivas_param_ism_data_structure
+{
+ int16_t nbands;
+ int16_t nblocks[MAX_PARAM_ISM_NBANDS];
+ int16_t band_grouping[MAX_PARAM_ISM_NBANDS + 1];
+ int16_t num_obj;
+
+ int16_t azi_index[MAX_NUM_OBJECTS];
+ int16_t ele_index[MAX_NUM_OBJECTS];
+
+ int16_t obj_indices[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE];
+ int16_t power_ratios_idx[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS];
+
+ int16_t last_az_sgn[MAX_NUM_OBJECTS];
+ int16_t last_az_diff[MAX_NUM_OBJECTS];
+ int16_t last_el_sgn[MAX_NUM_OBJECTS];
+ int16_t last_el_diff[MAX_NUM_OBJECTS];
+
+ int16_t flag_noisy_speech;
+ int16_t noisy_speech_buffer[PARAM_ISM_HYS_BUF_SIZE];
+
+} PARAM_ISM_CONFIG_DATA, *PARAM_ISM_CONFIG_HANDLE;
+
+
+/*----------------------------------------------------------------------------------*
+ * Declaration of DirAC common (encoder & decoder) structure
+ *----------------------------------------------------------------------------------*/
+
+typedef struct ivas_dirac_config_data_struct
+{
+ int16_t enc_param_start_band;
+ int16_t dec_param_estim;
+ int16_t nbands;
+
+} DIRAC_CONFIG_DATA, *DIRAC_CONFIG_DATA_HANDLE;
+
+
+/*----------------------------------------------------------------------------------*
+ * Declaration of SPAR common structures
+ *----------------------------------------------------------------------------------*/
+
+/* SPAR MD structures */
+typedef struct ivas_band_coeffs_t
+{
+ float pred_re[IVAS_SPAR_MAX_CH - 1];
+ float C_re[IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS][IVAS_SPAR_MAX_DMX_CHS - 1];
+ float P_re[IVAS_SPAR_MAX_CH - 1];
+ float pred_quant_re[IVAS_SPAR_MAX_CH - 1];
+ float C_quant_re[IVAS_SPAR_MAX_CH - IVAS_SPAR_MAX_DMX_CHS][IVAS_SPAR_MAX_DMX_CHS - 1];
+ float P_quant_re[IVAS_SPAR_MAX_CH - 1];
+
+} ivas_band_coeffs_t;
+
+typedef struct ivas_band_coeffs_ind_t
+{
+ int16_t pred_index_re[IVAS_SPAR_MAX_CH - 1];
+ int16_t drct_index_re[IVAS_SPAR_MAX_C_COEFF];
+ int16_t decd_index_re[IVAS_SPAR_MAX_CH - 1];
+
+} ivas_band_coeffs_ind_t;
+
+typedef struct ivas_spar_md_t
+{
+#ifndef FIX_SBA_CLEAN_UP_OPT
+ ivas_band_coeffs_t band_coeffs[IVAS_MAX_NUM_BANDS * MAX_PARAM_SPATIAL_SUBFRAMES];
+#else
+ ivas_band_coeffs_t *band_coeffs;
+#endif
+ ivas_band_coeffs_ind_t band_coeffs_idx[IVAS_MAX_NUM_BANDS];
+ int16_t num_bands;
+ float min_max[2];
+ int16_t dtx_vad;
+ float en_ratio_slow[IVAS_MAX_NUM_BANDS];
+ float ref_pow_slow[IVAS_MAX_NUM_BANDS];
+} ivas_spar_md_t;
+
+typedef struct ivas_spar_md_prev_t
+{
+ ivas_band_coeffs_ind_t band_coeffs_idx[IVAS_MAX_NUM_BANDS];
+ ivas_band_coeffs_ind_t band_coeffs_idx_mapped[IVAS_MAX_NUM_BANDS];
+
+} ivas_spar_md_prev_t;
+
+typedef struct ivas_quant_coeffs_t
+{
+ float min;
+ float max;
+ int16_t q_levels[2];
+
+} ivas_quant_coeffs_t;
+
+typedef struct ivas_quant_strat_t
+{
+ ivas_quant_coeffs_t PR;
+ ivas_quant_coeffs_t C;
+ ivas_quant_coeffs_t P_r;
+ ivas_quant_coeffs_t P_c;
+
+} ivas_quant_strat_t;
+
+#ifndef FIX_SBA_CLEAN_UP_OPT
+typedef struct ivas_spar_foa_md_com_cfg
+{
+ int16_t max_freq_per_chan[IVAS_SPAR_MAX_CH];
+ int16_t num_dmx_chans_per_band[IVAS_MAX_NUM_BANDS];
+ int16_t num_decorr_per_band[IVAS_MAX_NUM_BANDS];
+ int16_t active_w;
+ int16_t remix_unmix_order;
+ ivas_quant_strat_t quant_strat[MAX_QUANT_STRATS];
+ int16_t gen_bs;
+ int16_t quant_strat_bits;
+ int16_t nchan_transport;
+ int16_t num_quant_strats;
+ int16_t prior_strat;
+ int16_t tgt_bits_per_blk;
+ int16_t max_bits_per_blk;
+ int16_t prev_quant_idx;
+ int16_t agc_bits_ch_idx;
+ int16_t planarCP;
+ int16_t num_umx_chs;
+
+} ivas_spar_foa_md_com_cfg;
+#else
+typedef struct ivas_spar_md_com_cfg
+{
+ int16_t max_freq_per_chan[IVAS_SPAR_MAX_CH];
+ int16_t num_dmx_chans_per_band[IVAS_MAX_NUM_BANDS];
+ int16_t num_decorr_per_band[IVAS_MAX_NUM_BANDS];
+ int16_t active_w;
+ int16_t remix_unmix_order;
+ ivas_quant_strat_t quant_strat[MAX_QUANT_STRATS];
+ int16_t gen_bs;
+ int16_t quant_strat_bits;
+ int16_t nchan_transport;
+ int16_t num_quant_strats;
+ int16_t prior_strat;
+ int16_t tgt_bits_per_blk;
+ int16_t max_bits_per_blk;
+ int16_t prev_quant_idx;
+ int16_t agc_bits_ch_idx;
+ int16_t planarCP;
+ int16_t num_umx_chs;
+
+} ivas_spar_md_com_cfg;
+#endif
+
+
+/* arithmetic coder structures */
+typedef struct ivas_cell_dim_t
+{
+ int16_t dim1;
+ int16_t dim2;
+
+} ivas_cell_dim_t;
+
+typedef struct ivas_freq_models_t
+{
+ int16_t freq_model[IVAS_NUM_PROB_MODELS][IVAS_MAX_QUANT_LEVELS];
+ int16_t diff_freq_model[IVAS_NUM_PROB_MODELS][IVAS_MAX_QUANT_LEVELS];
+ int16_t vals[IVAS_MAX_QUANT_LEVELS];
+ int16_t diff_vals[IVAS_MAX_QUANT_LEVELS];
+ int16_t num_models;
+ int16_t diff_num_models;
+
+} ivas_freq_models_t;
+
+typedef struct ivas_huff_models_t
+{
+ int16_t code_book[IVAS_MAX_QUANT_LEVELS][3];
+ int16_t diff_code_book[IVAS_MAX_QUANT_LEVELS][3];
+
+} ivas_huff_models_t;
+
+#ifndef FIX_SBA_CLEAN_UP_OPT
+typedef struct ivas_arith_consts_t
+{
+ ivas_freq_models_t pred_r;
+ ivas_freq_models_t drct_r;
+ ivas_freq_models_t decd_r;
+} ivas_arith_consts_t;
+
+typedef struct ivas_huff_const_t
+{
+ ivas_huff_models_t pred_r;
+ ivas_huff_models_t drct_r;
+ ivas_huff_models_t decd_r;
+} ivas_huff_consts_t;
+#endif
+
+/* Entropy coder structures */
+typedef struct ivas_huffman_cfg_t
+{
+ const int16_t *codebook;
+ int16_t min_len;
+ int16_t max_len;
+ int16_t sym_len;
+
+} ivas_huffman_cfg_t;
+
+typedef struct ivas_arith_t
+{
+ int16_t dyn_model_bits;
+ const int16_t *pFreq_model;
+ const int16_t *pAlt_freq_models[IVAS_NUM_PROB_MODELS];
+ const int16_t *vals;
+ int16_t cum_freq[IVAS_NUM_PROB_MODELS][IVAS_MAX_QUANT_LEVELS];
+ int16_t range;
+ int16_t num_models;
+ float saved_dist_arr[IVAS_NUM_PROB_MODELS][IVAS_MAX_QUANT_LEVELS];
+
+} ivas_arith_t;
+
+typedef struct ivas_arith_coeffs_t
+{
+ ivas_arith_t pred_arith_re[MAX_QUANT_STRATS];
+ ivas_arith_t drct_arith_re[MAX_QUANT_STRATS];
+ ivas_arith_t decd_arith_re[MAX_QUANT_STRATS];
+ ivas_arith_t pred_arith_re_diff[MAX_QUANT_STRATS];
+ ivas_arith_t drct_arith_re_diff[MAX_QUANT_STRATS];
+ ivas_arith_t decd_arith_re_diff[MAX_QUANT_STRATS];
+
+} ivas_arith_coeffs_t;
+
+typedef struct ivas_huff_coeffs_t
+{
+ ivas_huffman_cfg_t pred_huff_re[MAX_QUANT_STRATS];
+ ivas_huffman_cfg_t drct_huff_re[MAX_QUANT_STRATS];
+ ivas_huffman_cfg_t decd_huff_re[MAX_QUANT_STRATS];
+
+} ivas_huff_coeffs_t;
+
+/* AGC structures */
+typedef struct ivas_agc_chan_data_t
+{
+ int16_t gainException;
+ int16_t absGainExp;
+ int16_t absGainExpCurr;
+
+} ivas_agc_chan_data_t;
+
+typedef struct ivas_agc_com_state_t
+{
+ float *winFunc;
+ int16_t in_delay;
+ uint16_t absEmin;
+ uint16_t betaE;
+ uint16_t maxAttExp;
+ uint16_t num_coeff;
+
+} ivas_agc_com_state_t;
+
+/* Covariance structures */
+typedef struct ivas_cov_smooth_state_t
+{
+ float *pPrior_cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
+ int16_t prior_bank_idx;
+ float *pSmoothing_factor;
+ int16_t num_bins;
+
+} ivas_cov_smooth_state_t;
+
+typedef struct ivas_cov_smooth_cfg_t
+{
+ float max_update_rate;
+ int16_t min_pool_size;
+ int16_t max_bands;
+ int16_t num_bins;
+
+} ivas_cov_smooth_cfg_t;
+
+typedef struct ivas_cov_smooth_in_buf_t
+{
+ float *cov_real[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH];
+ int16_t num_ch;
+ int16_t reset_cov;
+
+} ivas_cov_smooth_in_buf_t;
+
+/* SPAR bitrate constant table structure */
+typedef struct ivas_spar_br_table_t
+{
+ int32_t ivas_total_brate;
+ int16_t isPlanar;
+ int16_t sba_order;
+ int16_t bwidth;
+ int16_t fpcs;
+ int16_t nchan_transport;
+#ifndef FIX_SBA_CLEAN_UP_OPT
+ ivas_spar_foa_pmx_strings_t dmx_str;
+#else
+ ivas_spar_pmx_strings_t dmx_str;
+#endif
+ int16_t active_w;
+ int16_t tmode;
+ int32_t evs_brs[FOA_CHANNELS][3];
+ int16_t q_lvls[MAX_QUANT_STRATS][NUM_MD_Q_COEFS_SET];
+ int16_t td_ducking;
+ int16_t agc_bits_ch_idx; /* 0-3, Indicates core-coder channel index from which AGC bits have been taken from*/
+ int16_t usePlanarCoeff;
+} ivas_spar_br_table_t;
+
+
+/*----------------------------------------------------------------------------------*
+ * Declaration of MASA common structures
+ *----------------------------------------------------------------------------------*/
+
+typedef struct ivas_MASA_spherical_grid_deindexing
+{
+ float theta_cb[NO_THETA16_MAX];
+ int16_t no_theta;
+ int16_t no_phi[NO_THETA16_MAX];
+
+} SPHERICAL_GRID_DATA;
+
+typedef struct ivas_masa_descriptive_meta_struct
+{
+ uint8_t formatDescriptor[8]; /* 8x 8 bits */
+ uint8_t numberOfDirections; /* 1 bit */
+ uint8_t numberOfChannels; /* 1 bit */
+ uint8_t sourceFormat; /* 2 bits */
+ uint8_t transportDefinition; /* 3 bits */
+ uint8_t channelAngle; /* 3 bits */
+ uint8_t channelDistance; /* 6 bits */
+ uint8_t channelLayout; /* 3 bits, used only when sourceFormat == bit value 10 */
+
+} MASA_DECRIPTIVE_META;
+
+typedef struct ivas_masa_directional_spatial_meta_struct
+{
+ float azimuth[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
+ float elevation[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
+ float energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
+ float spread_coherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
+
+} MASA_DIRECTIONAL_SPATIAL_META;
+
+typedef struct ivas_masa_common_spatial_meta_struct
+{
+ float diffuse_to_total_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
+ float surround_coherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
+ float remainder_to_total_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
+
+} MASA_COMMON_SPATIAL_META;
+
+typedef struct ivas_masa_metadata_frame_struct
+{
+ MASA_DECRIPTIVE_META descriptive_meta;
+ MASA_DIRECTIONAL_SPATIAL_META directional_meta[MASA_MAXIMUM_DIRECTIONS];
+ MASA_COMMON_SPATIAL_META common_meta;
+
+} MASA_METADATA_FRAME, *MASA_METADATA_HANDLE;
+
+typedef struct ivas_masa_config_struct
+{
+ uint16_t max_metadata_bits;
+ int16_t block_grouping[5];
+ int16_t band_grouping[MASA_FREQUENCY_BANDS + 1];
+ uint8_t numCodingBands;
+ uint8_t numTwoDirBands;
+ uint8_t numberOfDirections;
+ uint8_t joinedSubframes;
+ uint8_t useCoherence;
+ uint8_t coherencePresent;
+ uint8_t mergeRatiosOverSubframes;
+
+} MASA_CODEC_CONFIG;
+
+
+/*----------------------------------------------------------------------------------*
+ * Declaration of Qmetadata common structures
+ *----------------------------------------------------------------------------------*/
+
+typedef struct
+{
+ int16_t nbands;
+ int16_t nblocks;
+ int16_t start_band;
+ int16_t search_effort;
+ MC_LS_SETUP mc_ls_setup;
+
+} IVAS_METADATA_CONFIG;
+
+typedef struct ivas_qdirection_band_data_struct
+{
+ uint16_t spherical_index[MAX_PARAM_SPATIAL_SUBFRAMES];
+ float azimuth[MAX_PARAM_SPATIAL_SUBFRAMES];
+ float elevation[MAX_PARAM_SPATIAL_SUBFRAMES];
+ int16_t elevation_m_alphabet[MAX_PARAM_SPATIAL_SUBFRAMES];
+ int16_t azimuth_m_alphabet[MAX_PARAM_SPATIAL_SUBFRAMES];
+
+ float energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES];
+ uint8_t distance[MAX_PARAM_SPATIAL_SUBFRAMES];
+
+ uint16_t bits_sph_idx[MAX_PARAM_SPATIAL_SUBFRAMES];
+ uint16_t energy_ratio_index[MAX_PARAM_SPATIAL_SUBFRAMES];
+ uint16_t energy_ratio_index_mod[MAX_PARAM_SPATIAL_SUBFRAMES];
+ uint16_t azimuth_index[MAX_PARAM_SPATIAL_SUBFRAMES];
+ uint16_t elevation_index[MAX_PARAM_SPATIAL_SUBFRAMES];
+ float q_azimuth[MAX_PARAM_SPATIAL_SUBFRAMES];
+ float q_elevation[MAX_PARAM_SPATIAL_SUBFRAMES];
+} IVAS_QDIRECTION_BAND_DATA;
+
+typedef struct ivas_qdirection_band_coherence_data_struct
+{
+ uint8_t spread_coherence[MAX_PARAM_SPATIAL_SUBFRAMES];
+ uint16_t spread_coherence_dct0_index;
+ uint16_t spread_coherence_dct1_index;
+
+} IVAS_QDIRECTION_BAND_COHERENCE_DATA;
+
+typedef struct ivas_surround_coherence_band_data_struct
+{
+ uint8_t surround_coherence[MAX_PARAM_SPATIAL_SUBFRAMES];
+ uint16_t sur_coherence_index;
+
+} IVAS_SURROUND_COHERENCE_BAND_DATA;
+
+
+typedef struct
+{
+ IVAS_METADATA_CONFIG cfg;
+
+ IVAS_QDIRECTION_BAND_DATA *band_data;
+ IVAS_QDIRECTION_BAND_COHERENCE_DATA *coherence_band_data;
+ int16_t not_in_2D;
+
+} IVAS_QDIRECTION; /* IVAS_QMETADATA; */
+
+typedef struct ivas_masa_qmetadata_frame_struct
+{
+ IVAS_QDIRECTION *q_direction;
+ uint16_t no_directions;
+ int16_t bits_frame_nominal;
+ uint16_t coherence_flag;
+ uint8_t all_coherence_zero;
+ uint8_t twoDirBands[MASA_MAXIMUM_CODING_SUBBANDS];
+ uint8_t numTwoDirBands;
+ int16_t qmetadata_max_bit_req;
+ int16_t metadata_max_bits; /* maximum allowed number of bits for metadata per frame */
+ uint8_t useLowerRes;
+ uint8_t useLowerBandRes;
+ IVAS_SURROUND_COHERENCE_BAND_DATA *surcoh_band_data;
+
+ /* Additional helper values to include all data required for writing to output file */
+ uint8_t numCodingBands;
+ int16_t *bandMap;
+ int16_t nchan_transport;
+ int16_t sba_inactive_mode;
+ /* Status values on metadata quality */
+ int16_t ec_flag;
+ float dir_comp_ratio;
+ uint8_t is_masa_ivas_format;
+} IVAS_QMETADATA, *IVAS_QMETADATA_HANDLE;
+
+
+/*----------------------------------------------------------------------------------*
+ * Declaration of Parametric MC common (encoder & decoder) structures
+ *----------------------------------------------------------------------------------*/
+
+typedef struct ivas_param_mc_ild_mapping_struct
+{
+ int16_t ild_map_size_wo_lfe;
+ int16_t ild_map_size_lfe;
+ int16_t ild_index[MAX_CICP_CHANNELS];
+ int16_t num_ref_channels[MAX_CICP_CHANNELS];
+ int16_t ref_channel_idx[MAX_CICP_CHANNELS][PARAM_MC_MAX_ILD_REF_CHANNELS];
+
+} PARAM_MC_ILD_MAPPING, *HANDLE_PARAM_MC_ILD_MAPPING;
+
+typedef struct ivas_param_mc_icc_mapping_struct
+{
+ int16_t icc_map_size_wo_lfe;
+ int16_t icc_map_size_lfe;
+ int16_t icc_mapping[PARAM_MC_SZ_ICC_MAP][2];
+
+} PARAM_MC_ICC_MAPPING, *HANDLE_PARAM_MC_ICC_MAPPING;
+
+typedef struct ivas_param_mc_conf_struct /* structure for ROM Table */
+{
+ MC_LS_SETUP mc_ls_setup;
+ int16_t num_input_chan;
+ int16_t num_transport_chan;
+ int32_t ivas_total_brate;
+ const PARAM_MC_ILD_MAPPING *ild_mapping_conf;
+ const PARAM_MC_ICC_MAPPING *icc_mapping_conf;
+ const float *dmx_fac;
+ const float *ild_factors;
+
+} PARAM_MC_CONF;
+
+typedef struct ivas_parametric_mc_metadata_value_coding_info_struct
+{
+ const uint16_t *cum_freq;
+ const uint16_t *sym_freq;
+ const uint16_t *cum_freq_delta;
+ const uint16_t *sym_freq_delta;
+ const float *quantizer;
+ int16_t quantizer_size;
+ int16_t uni_bits;
+
+} PARAM_MC_PARAMETER_CODING_INFO, *HANDLE_PARAM_MC_PARAMETER_CODING_INFO;
+
+typedef struct ivas_parametric_mc_metadata_struct
+{
+ const PARAM_MC_ILD_MAPPING *ild_mapping_conf;
+ const PARAM_MC_ICC_MAPPING *icc_mapping_conf;
+ int16_t icc_mapping[PARAM_MC_PARAMETER_FRAMES][PARAM_MC_SZ_ICC_MAP][2];
+ int16_t *icc_map_full[2];
+ int16_t icc_map_size_full;
+ int16_t param_frame_idx;
+ int16_t flag_use_adaptive_icc_map;
+ const float *ild_factors;
+ int16_t coding_band_mapping[PARAM_MC_MAX_PARAMETER_BANDS];
+ int16_t nbands_in_param_frame[PARAM_MC_PARAMETER_FRAMES];
+ int16_t bAttackPresent;
+ int16_t attackIndex;
+ int16_t nbands_coded;
+ int16_t num_parameter_bands;
+ int16_t coded_bwidth;
+ int16_t last_coded_bwidth;
+ int16_t lfe_on;
+ PARAM_MC_PARAMETER_CODING_INFO icc_coding;
+ PARAM_MC_PARAMETER_CODING_INFO ild_coding;
+
+} IVAS_PARAM_MC_METADATA, *HANDLE_IVAS_PARAM_MC_METADATA;
+
+
+/*----------------------------------------------------------------------------------*
+ * Declaration of LFE common (encoder & decoder) structures
+ *----------------------------------------------------------------------------------*/
+
+typedef struct ivas_lfe_window
+{
+ int16_t dct_len;
+ int16_t fade_len;
+ int16_t zero_pad_len;
+ int16_t full_len;
+ const float *pWindow_coeffs;
+
+} LFE_WINDOW_DATA, *LFE_WINDOW_HANDLE;
+
+typedef struct ivas_lfe_freq_models
+{
+ uint16_t entropy_coder_model_fine_sg1[65];
+ uint16_t entropy_coder_model_fine_sg2[33];
+ uint16_t entropy_coder_model_fine_sg3[9];
+ uint16_t entropy_coder_model_fine_sg4[3];
+ uint16_t entropy_coder_model_coarse_sg1[33];
+ uint16_t entropy_coder_model_coarse_sg2[17];
+ uint16_t entropy_coder_model_coarse_sg3[5];
+ uint16_t entropy_coder_model_coarse_sg4;
+
+} ivas_lfe_freq_models;
+
+typedef struct ivas_filters_process_state_t
+{
+ int16_t order;
+ int16_t filt_len;
+ float num[IVAS_FILTER_MAX_STAGES][IVAS_BIQUAD_FILT_LEN];
+ float den[IVAS_FILTER_MAX_STAGES][IVAS_BIQUAD_FILT_LEN];
+ float state[IVAS_FILTER_MAX_STAGES][IVAS_BIQUAD_FILT_LEN];
+
+} ivas_filters_process_state_t;
+
+
+/*----------------------------------------------------------------------------------*
+ * Transient Detector (TD) structure
+ *----------------------------------------------------------------------------------*/
+
+typedef struct ivas_trans_det_state_t
+{
+ ivas_filters_process_state_t env_hpf;
+ ivas_filters_process_state_t env_fast;
+ ivas_filters_process_state_t env_slow;
+ float in_duck_coeff;
+ float out_duck_coeff;
+ float in_duck_gain;
+ float out_duck_gain;
+ float duck_mult_fac;
+
+} ivas_trans_det_state_t;
+
+
+/*----------------------------------------------------------------------------------*
+ * Filter Bank (FB) structures
+ *----------------------------------------------------------------------------------*/
+
+typedef struct ivas_fb_mixer_cfg_t
+{
+ int16_t fb_latency;
+ int16_t num_in_chans;
+ int16_t num_out_chans;
+ int16_t pcm_offset;
+ int16_t fade_len; /* this sets the stride length; no delay is introduced */
+ int16_t prior_input_length;
+ int16_t windowed_fr_offset;
+ int16_t active_w_mixing;
+ const int16_t *remix_order;
+
+} IVAS_FB_CFG;
+
+typedef struct ivas_fb_consts_t
+{
+ const float *ppFilterbank_FRs[2][IVAS_MAX_NUM_BANDS];
+ float *ppFilterbank_FRs_non48k[2][IVAS_MAX_NUM_BANDS];
+ const int16_t *pFilterbank_bins_per_band;
+ const int16_t *pFilterbank_bins_start_offset;
+
+} ivas_fb_consts_t;
+
+typedef struct ivas_fb_bin_to_band_data_t
+{
+ float *pFb_bin_to_band[IVAS_MAX_NUM_FB_BANDS];
+ const int16_t *pFb_start_bin_per_band;
+ const int16_t *pFb_active_bins_per_band;
+ float pp_cldfb_weights_per_spar_band[CLDFB_NO_CHANNELS_MAX][IVAS_MAX_NUM_FB_BANDS]; /* weights for linear combination of parameters from different spar bands*/
+ int16_t p_spar_start_bands[CLDFB_NO_CHANNELS_MAX]; /* the first spar band per CLFB band when the weight is > 0 */
+ int16_t p_cldfb_map_to_spar_band[CLDFB_NO_CHANNELS_MAX]; /* a direct mapping from CLDFB band to SPAR band */
+ int16_t p_short_stride_start_bin_per_band[IVAS_MAX_NUM_FB_BANDS];
+ int16_t p_short_stride_num_bins_per_band[IVAS_MAX_NUM_FB_BANDS];
+ float p_short_stride_bin_to_band[2 * MDFT_FB_BANDS_240];
+ float *pp_short_stride_bin_to_band[IVAS_MAX_NUM_FB_BANDS];
+ int16_t short_stride;
+ int16_t num_cldfb_bands;
+
+} ivas_fb_bin_to_band_data_t;
+
+typedef struct ivas_filterbank_t
+{
+ int16_t filterbank_num_bands;
+ ivas_fb_consts_t fb_consts;
+ ivas_fb_bin_to_band_data_t fb_bin_to_band;
+
+} ivas_filterbank_t;
+
+typedef struct ivas_fb_mixer_state_structure
+{
+ IVAS_FB_CFG *fb_cfg;
+
+ int16_t num_diff_bands;
+ ivas_filterbank_t *pFb;
+
+ float *ppFilterbank_inFR_re[IVAS_MAX_FB_MIXER_IN_CH];
+ float *ppFilterbank_inFR_im[IVAS_MAX_FB_MIXER_IN_CH];
+ float *ppFilterbank_prior_input[IVAS_MAX_FB_MIXER_IN_CH];
+ float *prior_mixer[IVAS_MAX_FB_MIXER_OUT_CH][IVAS_MAX_SPAR_FB_MIXER_IN_CH];
+
+ /* store sin part in const table (no need to store 1s and 0s, no need to do windowing for 1's and 0's as well) */
+ int16_t cross_fade_start_offset;
+ int16_t cross_fade_end_offset;
+ const float *pFilterbank_cross_fade;
+ int16_t ana_window_offset;
+ const float *pAna_window;
+
+ int16_t prior_input_length;
+ int16_t windowed_fr_offset;
+ float cldfb_cross_fade[CLDFB_NO_COL_MAX];
+ int16_t cldfb_cross_fade_start;
+ int16_t cldfb_cross_fade_end;
+ int16_t cldfb_latency;
+
+ int16_t first_frame[IVAS_SPAR_MAX_CH];
+
+} IVAS_FB_MIXER_DATA, *IVAS_FB_MIXER_HANDLE;
+
+
+#endif /* IVAS_STAT_COM */
diff --git a/lib_com/lag_wind.c b/lib_com/lag_wind.c
index 56e3bf33ec1d7272881cb58cce907024e36662bb..a4abea6d5c4ff91a1fbd74f3bfac4af91755790c 100644
--- a/lib_com/lag_wind.c
+++ b/lib_com/lag_wind.c
@@ -2,11 +2,12 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include
+#include "options.h"
#include "prot_fx.h"
#include "rom_com_fx.h"
#include "basop_util.h"
-#include "stl.h"
/*-------------------------------------------------------------------*
* Local constants
@@ -25,7 +26,7 @@ void lag_wind(
Word16 r_h[], /* in/out: autocorrelations */
Word16 r_l[], /* in/out: autocorrelations */
Word16 m, /* input : order of LP filter */
- Word32 sr, /* input : sampling rate */
+ Word32 sr_core, /* input : sampling rate */
Word16 strength /* input : LAGW_WEAK, LAGW_MEDIUM, or LAGW_STRONG */
)
{
@@ -35,7 +36,7 @@ void lag_wind(
assert(0 <= strength && strength <= NUM_LAGW_STRENGTHS);
- SWITCH (sr)
+ SWITCH (sr_core)
{
case 8000:
assert(m <= 16);
@@ -89,7 +90,7 @@ void adapt_lag_wind(
Word16 m, /* input : order of LP filter */
const Word16 Top, /* input : open loop pitch lag */
const Word16 Tnc, /* input : open loop pitch gain */
- Word32 sr /* input : sampling rate */
+ Word32 sr_core /* input : sampling rate */
)
{
Word16 strength, pitch_lag;
@@ -126,5 +127,5 @@ void adapt_lag_wind(
move16();
}
- lag_wind(r_h, r_l, m, sr, strength);
+ lag_wind(r_h, r_l, m, sr_core, strength);
}
diff --git a/lib_com/lerp.c b/lib_com/lerp.c
index e866e231cb7d93492567ffa6bbc420d66ddc6c4f..d27ef9cc0c3fef0db20b77074d3c8cef6c92ea56 100644
--- a/lib_com/lerp.c
+++ b/lib_com/lerp.c
@@ -1,20 +1,30 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h"
#include "basop_util.h"
#include "prot_fx.h"
#include
-#include "stl.h"
+/*-------------------------------------------------------------*
+ * Local constants
+ *-------------------------------------------------------------*/
#define shift_e (16-1)
#define pos_e (16-1)
+/*-------------------------------------------------------------*
+ * Local function prototypes
+ *-------------------------------------------------------------*/
static void lerp_proc(Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize);
+/*-------------------------------------------------------------*
+ * procedure lerp() *
+ * *
+ * *
+ *-------------------------------------------------------------*/
void lerp(Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize)
{
@@ -75,8 +85,12 @@ void lerp(Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize)
lerp_proc(f, f_out, bufferNewSize, bufferOldSize);
}
}
-
-void lerp_proc(Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize)
+/*-------------------------------------------------------------*
+ * procedure lerp_proc() *
+ * *
+ * *
+ *-------------------------------------------------------------*/
+static void lerp_proc(Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize)
{
Word16 i, idx, n;
diff --git a/lib_com/limit_t0_fx.c b/lib_com/limit_t0_fx.c
index d5b31b19bb2c7097d93e2a804aa01dfcb8a41c54..810b7d988512a11980eb0ebfabfb447f321a403a 100644
--- a/lib_com/limit_t0_fx.c
+++ b/lib_com/limit_t0_fx.c
@@ -2,11 +2,10 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h"
#include "rom_basop_util.h"
@@ -166,10 +165,10 @@ void limit_T0_voiced(
const Word16 T0, /* i : rough pitch estimate around which the search is done */
const Word16 T0_frac, /* i : pitch estimate fractional part */
const Word16 T0_res, /* i : pitch resolution */
- Word16 *T0_min, /* o : lower pitch limit */
- Word16 *T0_min_frac, /* o : lower pitch limit */
- Word16 *T0_max, /* o : higher pitch limit */
- Word16 *T0_max_frac, /* o : higher pitch limit */
+ Word16 *T0_min, /* o : lower pitch limit */
+ Word16 *T0_min_frac, /* o : lower pitch limit */
+ Word16 *T0_max, /* o : higher pitch limit */
+ Word16 *T0_max_frac, /* o : higher pitch limit */
const Word16 pit_min, /* i : Minimum pitch lag */
const Word16 pit_max /* i : Maximum pitch lag */
)
diff --git a/lib_com/logqnorm_fx.c b/lib_com/logqnorm_fx.c
index 957fcdfc6d3c965339f474960fa7dc874fd595b9..562f56db1a359c0d8cfe516a5f96ae6e117dd507 100644
--- a/lib_com/logqnorm_fx.c
+++ b/lib_com/logqnorm_fx.c
@@ -2,13 +2,16 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h" /* Compilation switches */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h" /* required for wmc_tool */
#include "rom_com_fx.h" /* Static table prototypes */
#include "cnst_fx.h" /* Common constants */
-/* Local constants */
+/*--------------------------------------------------------------------------*
+ * Local constants
+ *--------------------------------------------------------------------------*/
+
#define THREN2POW 1518500250L
/*--------------------------------------------------------------------------*
@@ -20,7 +23,7 @@
void logqnorm_fx(
const Word32 *L_x, /* i : coefficient vector Qx */
const Word16 qx, /* i : Q value of input */
- Word16 *k, /* o : index Q0 */
+ Word16 *k, /* o : index Q0 */
const Word16 L, /* i : codebook length Q0 */
const Word16 N, /* i : sub-vector size Q0 */
const Word16 hvq_flag /* i : HVQ flag Q0 */
@@ -99,8 +102,8 @@ void logqnorm_2_fx(
const Word16 L, /* i : codebook length */
const Word16 n_env_band, /* i : sub-vector size */
const Word16 nb_sfm, /* i : sub-vector size */
- Word16 *ynrm,
- Word16 *normqlg2,
+ Word16 *ynrm, /* o : norm indices */
+ Word16* normqlg2, /* o : quantized norm values */
const Word32 *thren /* i, Q10 : quantization thresholds */
)
{
@@ -159,14 +162,14 @@ void logqnorm_2_fx(
*--------------------------------------------------------------------------*/
void calc_norm_fx(
- const Word32 *L_x, /* i : Input vector. Qx */
- const Word16 qx, /* i : Q value of input */
- Word16 *norm, /* o : Quantization indices for norms Q0 */
- Word16 *normlg, /* o : Quantized norms in log2 Q0 */
- const Word16 start_band, /* i : Indice of band to start coding Q0 */
- const Word16 num_bands, /* i : Number of bands Q0 */
- const Word16 *band_len, /* i : Length of bands Q0 */
- const Word16 *band_start /* i : Start of bands Q0 */
+ const Word32 *L_x, /* i : Input vector. Qx */
+ const Word16 qx, /* i : Q value of input */
+ Word16 *norm, /* o : Quantization indices for norms Q0 */
+ Word16 *normlg, /* o : Quantized norms in log2 Q0 */
+ const Word16 start_band, /* i : Indice of band to start coding Q0 */
+ const Word16 num_bands, /* i : Number of bands Q0 */
+ const Word16 *band_len, /* i : Length of bands Q0 */
+ const Word16 *band_start /* i : Start of bands Q0 */
)
{
Word16 nrm;
diff --git a/lib_com/longarith.c b/lib_com/longarith.c
index c169347a385edc13e0a861227fc2c2f9f58906fd..716cb1c63bf2b18f49d50c352b22eebedd4c8526 100644
--- a/lib_com/longarith.c
+++ b/lib_com/longarith.c
@@ -2,12 +2,19 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
+#include
#include
+#include "options.h"
#include "prot_fx.h"
-#include "stl.h"
-
+ /*-------------------------------------------------------------------*
+* longshiftright()
+*
+* long shift right: d[] = a[] >> b
+* Logical shift right of unsigned vectors a[] by b bit-positions.
+* Vector d[] is filled with leading zeroes, where lend exceeds lena.
+* It is allowed to overlay d[] with a[].
+*--------------------------------------------------------------------*/
/**
* \brief inplace long shift right: a[] = a[] >> bits
* Logical shift right of UWord32 vector a[] by 'bits' positions.
@@ -27,7 +34,11 @@
* \return void
*/
-void longshr(UWord32 a[], Word16 bits, Word16 len)
+void longshr(
+ UWord32 a[],
+ Word16 bits,
+ Word16 len
+)
{
Word16 fracb_u, k;
diff --git a/lib_com/low_rate_band_att_fx.c b/lib_com/low_rate_band_att_fx.c
index 680b95ed6324c7d6c0b9273213a3931791fecd21..b93c778f41123074f8e28d0bc6eeb71f8e3e7788 100644
--- a/lib_com/low_rate_band_att_fx.c
+++ b/lib_com/low_rate_band_att_fx.c
@@ -2,11 +2,10 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
+#include
#include "options.h" /* Compilation switches */
#include "rom_com_fx.h" /* Static table prototypes */
#include "prot_fx.h"
-#include "stl.h" /* required for wmc_tool */
/*--------------------------------------------------------------------------*
@@ -16,18 +15,18 @@
*--------------------------------------------------------------------------*/
void fine_gain_pred_fx(
- const Word16 *sfm_start, /* i : Sub band start indices */
- const Word16 *sfm_end, /* i : Sub band end indices */
- const Word16 *sfm_size, /* i : Sub band bandwidths */
- const Word16 *i_sort, /* i : Energy sorting indices */
- const Word16 *K, /* i : Number of pulses per band */
- const Word16 *maxpulse, /* i : Maximum pulse per band */
- const Word16 *R, /* i : Bits per sub band Q3 */
- const Word16 num_sfm, /* i : Number of sub bands */
- Word16 *xq, /* i/o: Quantized vector /quantized vector with finegain adj Q15*/
- Word16 *y, /* i/o: Quantized vector (int) */
- Word16 *fg_pred, /* o : Predicted fine gains Q12 */
- const Word16 core /* i : Core */
+ const Word16 *sfm_start, /* i : Sub band start indices */
+ const Word16 *sfm_end, /* i : Sub band end indices */
+ const Word16 *sfm_size, /* i : Sub band bandwidths */
+ const Word16 *i_sort, /* i : Energy sorting indices */
+ const Word16 *K, /* i : Number of pulses per band */
+ const Word16 *maxpulse, /* i : Maximum pulse per band */
+ const Word16 *R, /* i : Bits per sub band Q3 */
+ const Word16 num_sfm, /* i : Number of sub bands */
+ Word16 *xq, /* i/o: Quantized vector /quantized vector with finegain adj Q15*/
+ Word16 *y, /* i/o: Quantized vector (int) */
+ Word16 *fg_pred, /* o : Predicted fine gains Q12 */
+ const Word16 core /* i : Core */
)
{
Word16 i, band;
@@ -127,13 +126,13 @@ void fine_gain_pred_fx(
*--------------------------------------------------------------------------*/
void get_max_pulses_fx(
- const Word16 *band_start, /* i : Sub band start indices */
- const Word16 *band_end, /* i : Sub band end indices */
- const Word16 *k_sort, /* i : Indices for sorting by energy */
- const Word16 *npulses, /* i : Pulses per sub band */
- const Word16 BANDS, /* i : Number of bands */
- Word16 *inp_vector, /* i/o: Encoded shape vectors (int)*/
- Word16 *maxpulse /* o : Maximum pulse height per band */
+ const Word16 *band_start, /* i : Sub band start indices */
+ const Word16 *band_end, /* i : Sub band end indices */
+ const Word16 *k_sort, /* i : Indices for sorting by energy */
+ const Word16 *npulses, /* i : Pulses per sub band */
+ const Word16 BANDS, /* i : Number of bands */
+ Word16 *inp_vector, /* i/o: Encoded shape vectors (int)*/
+ Word16 *maxpulse /* o : Maximum pulse height per band */
)
{
Word16 i, k;
@@ -179,7 +178,7 @@ void fine_gain_dec_fx
const Word16 *ord, /* i : Indices for energy order */
const Word16 num_sfm, /* i : Number of bands */
const Word16 *gain_bits, /* i : Gain adjustment bits per sub band */
- Word16 *fg_pred /* i/o: Predicted gains / Corrected gains */
+ Word16 *fg_pred /* i/o: Predicted gains / Corrected gains */
)
{
Word16 band;
diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c
index d690482f5693b31a3e1318e296d5952a95a33415..3f4222435bc081252c592b58913d86f7d29f68f3 100644
--- a/lib_com/lpc_tools_fx.c
+++ b/lib_com/lpc_tools_fx.c
@@ -2,12 +2,12 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "rom_com_fx.h"
-#include "stl.h"
#include "basop_mpy.h"
#include "basop_util.h"
@@ -26,9 +26,9 @@
void autocorr_fx(
const Word16 x[], /* i : Input signal */
const Word16 m, /* i : LPC order Q0 */
- Word16 r_h[], /* o : Autocorrelations (msb) Q15 */
- Word16 r_l[], /* o : Autocorrelations (lsb) */
- Word16 *Q_r, /* o : normalisation shift of r Q0 */
+ Word16 r_h[], /* o : Autocorrelations (msb) Q15 */
+ Word16 r_l[], /* o : Autocorrelations (lsb) */
+ Word16 *Q_r, /* o : normalisation shift of r Q0 */
const Word16 len, /* i : Frame lenght */
const Word16* wind, /* i : Window used */
Word16 rev_flag,
diff --git a/lib_com/lsf_dec_bfi_fx.c b/lib_com/lsf_dec_bfi_fx.c
index 5c4796700a848a7cd603b6f368ab7393877bf2e1..2b10f85fb78f7b903fdc61f6d00a6335ea8e4d2f 100644
--- a/lib_com/lsf_dec_bfi_fx.c
+++ b/lib_com/lsf_dec_bfi_fx.c
@@ -3,10 +3,8 @@
====================================================================================*/
-#include
-#include
-#include
-#include "stl.h"
+#include
+#include "options.h"
#include "basop_util.h"
#include "rom_com_fx.h"
#include "cnst_fx.h"
@@ -20,26 +18,26 @@
* Bad frame, all active speech coders
*---------------------------------------------------------------------*/
void lsf_dec_bfi(
- const Word16 codec_mode, /* i: : codec mode: MODE1 | MODE2 */
- Word16*lsf, /*!< o : 14Q1*1.28 quantized ISFs */
- const Word16*lsfold, /*!< i : 14Q1*1.28 past quantized ISF */
+ const Word16 codec_mode, /* i: : codec mode: MODE1 | MODE2 */
+ Word16*lsf, /*!< o : 14Q1*1.28 quantized ISFs */
+ const Word16*lsfold, /*!< i : 14Q1*1.28 past quantized ISF */
Word16*lsf_adaptive_mean, /*!< i : 14Q1*1.28 ISF adaptive mean, updated when BFI==0 */
- const Word16 lsfBase[], /* i : base for differential lsf coding */
+ const Word16 lsfBase[], /* i : base for differential lsf coding */
Word16*mem_MA, /*!< i/o: 14Q1*1.28 quantizer memory for MA model */
Word16*mem_AR, /*!< i/o: 14Q1*1.28 quantizer memory for MA model */
Word16 stab_fac, /*!< i : ISF stability factor (shifted right by 1) */
- const Word16 last_coder_type, /*!< i : coding type in last good received fr. */
+ const Word16 last_coder_type,/*!< i : coding type in last good received fr. */
Word16 L_frame,
- const Word16 last_good, /*!< i : last good received frame */
- const Word16 nbLostCmpt, /*!< i : counter of consecutive bad frames */
- Word8 plcBackgroundNoiseUpdated,
- Word16 *lsf_q_cng, /* o : quantized ISFs for background noise (14Q1*1.28) */
+ const Word16 last_good, /*!< i : last good received frame */
+ const Word16 nbLostCmpt, /*!< i : counter of consecutive bad frames */
+ const Word8 plcBackgroundNoiseUpdated, /* i : background noise already updated?*/
+ Word16 *lsf_q_cng, /* o : quantized ISFs for background noise (14Q1*1.28) */
Word16 *lsf_cng,
- Word16 *old_lsf_q_cng, /* o : old quantized ISFs for background noise */
+ Word16 *old_lsf_q_cng, /* o : old quantized ISFs for background noise */
const Word16 Last_GSC_pit_band_idx,
- const Word16 Opt_AMR_WB /* i : IO flag */
- , const Word8 tcxonly
- ,const short MODE1_bwidth /* i: coded bandwidth */
+ const Word16 Opt_AMR_WB, /* i : IO flag */
+ const Word8 tcxonly,
+ const short bwidth /* i: coded bandwidth */
)
{
Word16 i;
@@ -66,7 +64,7 @@ void lsf_dec_bfi(
{
pt_meansForFading = GEWB_Ave_fx;
- if (EQ_16(MODE1_bwidth,NB))
+ if (EQ_16(bwidth,NB))
{
pt_meansForFading = GENB_Ave_fx;
}
@@ -255,9 +253,11 @@ void lsf_dec_bfi(
return;
}
-Word16 const * PlcGetLsfBase (Word16 const lpcQuantization,
- Word16 const narrowBand,
- Word32 const sr_core)
+Word16 const * PlcGetLsfBase (
+ Word16 const lpcQuantization,
+ Word16 const narrowBand,
+ Word32 const sr_core
+)
{
/* Not correct BW */
IF (lpcQuantization==0)
@@ -283,7 +283,7 @@ Word16 const * PlcGetLsfBase (Word16 const lpcQuantization,
/* lpcQuntization == 1 is left */
- IF (EQ_32(sr_core,16000))
+ IF (EQ_32(sr_core, INT_FS_16k))
{
return GEWB2_Ave_fx;
}
diff --git a/lib_com/lsf_msvq_ma.c b/lib_com/lsf_msvq_ma.c
index 38892638a30650a6b5357a0380148522e2544424..be34f9b0dae0cb37d187dfa04df59cc1b5d7fda7 100644
--- a/lib_com/lsf_msvq_ma.c
+++ b/lib_com/lsf_msvq_ma.c
@@ -2,33 +2,31 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
-#include
+#include
#include "cnst_fx.h"
+#include "options.h"
#include "rom_com_fx.h"
#include "prot_fx.h"
-#include "stl.h"
#include "basop_util.h"
#include "prot_fx.h"
-#include "options.h"
-
+#ifndef swap
#define swap(x,y,type) {type u__p; u__p=x; x=y; y=u__p;}
-
-extern const Word16 tbl_mid_gen_wb_5b_fx[];
-extern const Word16 tbl_mid_unv_wb_5b_fx[];
-
-
-
-
+#endif
+/*---------------------------------------------------------------------*
+ * midlsf_dec()
+ *
+ *
+ *---------------------------------------------------------------------*/
void midlsf_dec(
const Word16 qlsf0[], /* i: quantized lsf coefficients (3Q12) */
const Word16 qlsf1[], /* i: quantized lsf coefficients (3Q12) */
- Word16 idx, /* i: codebook index */
+ const Word16 idx, /* i: codebook index */
Word16 qlsf[], /* o: decoded lsf coefficients (3Q12) */
- Word16 coder_type,
+ const Word16 coder_type,
Word16 *mid_lsf_int,
- Word16 prev_bfi,
- Word16 safety_net)
+ const Word16 prev_bfi,
+ const Word16 safety_net
+)
{
const Word16 *ratio=NULL;
Word16 j;
@@ -136,8 +134,8 @@ void midlsf_dec(
Word16 lsf_ind_is_active(
const Word16 lsf_q_ind[],
const Word16 means[],
- Word16 narrowband,
- Word16 cdk
+ const Word16 narrowband,
+ const Word16 cdk
)
{
Word16 lsf[2], min_distance;
diff --git a/lib_com/lsf_tools_fx.c b/lib_com/lsf_tools_fx.c
index f5d593f4479442b2edd35557c1e09e8c07e21437..08329fd262a9609848653438719aa84460773717 100644
--- a/lib_com/lsf_tools_fx.c
+++ b/lib_com/lsf_tools_fx.c
@@ -2,19 +2,18 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
-#include
+#include
#include
#include "options.h" /* Compilation switches */
-#include "stl.h"
#include "basop_util.h"
#include "rom_com_fx.h"
#include "cnst_fx.h"
#include "prot_fx.h"
-#include "rom_com_fx.h" /* Static table prototypes */
-
+/*-------------------------------------------------------------------*
+ * Local constants
+ *-------------------------------------------------------------------*/
#define NC_MAX 8
#define GUESS_TBL_SZ 256
@@ -24,10 +23,6 @@
val2 = shr((cbp)[2], 4); \
val3 = add(add(shr(lshl((cbp)[2],12),4),lshr(lshl((cbp)[1],12),8)),s_and((cbp)[0],0xF));
-/*-------------------------------------------------------------------*
- * Local constants
- *-------------------------------------------------------------------*/
-
#define NC ( M/2)
#define NC16k ( M16k/2)
@@ -36,8 +31,8 @@
#define ALPHA_SQ ( ( 0.5f / PI2) * ( 0.5f / PI2))
/*-------------------------------------------------------------------*
- * Local functions
- *-------------------------------------------------------------------*/
+ * Local functions
+ *-------------------------------------------------------------------*/
Word16 root_search_fx( Word16 low, Word16 high, Word32 *v_low, Word32 *coef,Word16 order);
Word32 calc_weight( Word16 delta1,Word16 delta2,Word16 *n1 );
Word32 polynomial_eval_fx( Word16 f, Word32 *coef,Word16 order);
@@ -45,7 +40,7 @@ void E_LPC_isf_isp_conversion(const Word16 isf[], Word16 isp[], const Word16 m);
void E_LPC_lsp_lsf_conversion(const Word16 lsp[],Word16 lsf[],const Word16 m);
Word16 E_LPC_f_lsp_pol_get(const Word16 lsp[], Word32 f[], const Word16 n, const Word16 past_Ovf, const Word16 isMODE1);
-static Word16 chebyshev(Word16 x, Word32 *f, Word16 n, Word16 shift)
+static Word16 chebyshev(Word16 x, Word32 *f, const Word16 n, const Word16 shift)
{
Word16 cheb;
@@ -1626,27 +1621,25 @@ Word16 vq_dec_lvq_fx (
return ber_flag;
}
-void lsf_allocate_fx(
- const Word16 nBits, /* i : Number of bits to use for quantization */
- const Word16 framemode, /* i : ISF quantizer mode */
- const Word16 framemode_p, /* i : ISF quantizer mode predmode (mode_lvq_p) */
- Word16 *stages0, /* o : Number of stages for safety-net quantizer */
- Word16 *stages1, /* o : Number of stages for predictive quantizer */
- Word16 levels0[], /* o : Number of vectors for each stage for SFNET */
- Word16 levels1[], /* o : Number of vectors for each stage for pred */
- Word16 bits0[], /* o : Number of bits for each stage safety net */
- Word16 bits1[] /* o : Number of bits for each stage pred */
+ivas_error lsf_allocate_fx(
+ const Word16 nBits, /* i : Number of bits to use for quantization */
+ const Word16 framemode, /* i : ISF quantizer mode */
+ const Word16 framemode_p, /* i : ISF quantizer mode predmode (mode_lvq_p) */
+ Word16 *stages0, /* o : Number of stages for safety-net quantizer */
+ Word16 *stages1, /* o : Number of stages for predictive quantizer */
+ Word16 levels0[], /* o : Number of vectors for each stage for SFNET */
+ Word16 levels1[], /* o : Number of vectors for each stage for pred */
+ Word16 bits0[], /* o : Number of bits for each stage safety net */
+ Word16 bits1[] /* o : Number of bits for each stage pred */
)
{
Word16 i;
Word16 cumleft;
Word16 bits_lvq, n_stages, nbits0;
+ ivas_error error;
+
+ error = IVAS_ERR_OK;
- /* VOICED@16kHz */
- IF(EQ_16(framemode, 14))
- {
- return;
- }
cumleft = nBits;
move16();
@@ -1774,23 +1767,31 @@ void lsf_allocate_fx(
move16();
}
}
+#ifdef DEBUGGING
ELSE
{
+ return IVAS_ERROR(IVAS_ERR_INTERNAL_FATAL, "lsf_allocate(): invalid number of bits in used predictive mode\n");
}
+#endif
}
- return;
+ return error;
}
-Word16 find_pred_mode(
- const Word16 coder_type, /* i: coding type */
- const Word16 bwidth, /* i: bandwidth index */
- const Word32 int_fs, /* i: sampling frequency */
- Word16 * p_mode_lvq, /* o: index of LSF codebooks in safety net mode */
- Word16 * p_mode_lvq_p, /* o: index of LSF codebooks in predictive mode (AR or MA) */
- Word32 core_brate) /* i: core bit rate */
+ivas_error find_pred_mode(
+ Word16* predmode, /* o: prediction mode */
+ const Word16 coder_type, /* i: coding type */
+ const Word16 bwidth, /* i: bandwidth index */
+ const Word32 int_fs, /* i: sampling frequency */
+ Word16 * p_mode_lvq, /* o: index of LSF codebooks in safety net mode */
+ Word16 * p_mode_lvq_p, /* o: index of LSF codebooks in predictive mode (AR or MA) */
+ Word32 core_brate /* i: core bit rate */
+)
{
- Word16 idx, predmode;
+ Word16 idx;
+ ivas_error error;
+
+ error = IVAS_ERR_OK;
/* bwidth = 0(NB), 1 (WB), 2(WB2); line index in predmode_tab[][] */
idx = bwidth;
@@ -1809,18 +1810,18 @@ Word16 find_pred_mode(
{
test();
test();
- if ((GE_32(core_brate, GENERIC_MA_LIMIT))&&(EQ_16(coder_type,GENERIC))&&(EQ_16(idx,1)))
+ if ((GE_32(core_brate, GENERIC_MA_LIMIT) )&& (EQ_16(coder_type,GENERIC)) && (EQ_16(idx,1)))
{
idx = 3;
move16();
}
}
- predmode = predmode_tab[idx][coder_type];
+ *predmode = predmode_tab[idx][coder_type];
move16();
IF (LE_16(idx, 2))
{
*p_mode_lvq = add(i_mult2(NO_CODING_MODES, idx), coder_type);
- IF (predmode>0)
+ IF (*predmode>0)
{
*p_mode_lvq_p = *p_mode_lvq;
move16();
@@ -1841,7 +1842,7 @@ Word16 find_pred_mode(
}
ELSE
{
- IF (predmode>0)
+ IF (*predmode>0)
{
*p_mode_lvq_p = *p_mode_lvq;
}
@@ -1851,10 +1852,15 @@ Word16 find_pred_mode(
}
}
}
+#ifdef DEBUGGING
+ if (*predmode == -1)
+ {
+ return IVAS_ERROR(IVAS_ERR_INTERNAL_FATAL, "\nfind_pred_mode(): incorrect coder_type specification: %d\n", coder_type);
+ }
+#endif
-
- return predmode;
+ return error;
}
/*---------------------------------------------------------------------------*
@@ -1931,11 +1937,11 @@ void reorder_isf_fx(
/* RETURN ARGUMENTS : */
/* _ (Word16) stab_fac_fx : LP filter stability Q15 */
/*========================================================================*/
-Word16 lsf_stab_fx( /* o : LP filter stability Q15*/
- const Word16 *lsf, /* i : LSF vector Q(x2.56)*/
- const Word16 *lsfold, /* i : old LSF vector Q(x2.56)*/
+Word16 lsf_stab_fx( /* o : LP filter stability Q15*/
+ const Word16 *lsf, /* i : LSF vector Q(x2.56)*/
+ const Word16 *lsfold, /* i : old LSF vector Q(x2.56)*/
const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 L_frame /* i : frame length */
+ const Word16 L_frame /* i : frame length */
)
{
Word16 i, m;
@@ -2001,10 +2007,10 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/
*-------------------------------------------------------------------*/
void lsp2isp_fx(
- const Word16 *lsp, /* i : LSP vector */
+ const Word16 *lsp, /* i : LSP vector */
Word16 *isp, /* o : ISP filter coefficients */
Word16 *stable_isp, /* i/o: ISP filter coefficients */
- const Word16 m /* i : order of LP analysis */
+ const Word16 m /* i : order of LP analysis */
)
{
Word16 a[M+1];
@@ -2027,10 +2033,10 @@ void lsp2isp_fx(
*-------------------------------------------------------------------*/
void isp2lsp_fx(
- const Word16 *isp, /* i : LSP vector */
+ const Word16 *isp, /* i : LSP vector */
Word16 *lsp, /* o : ISP filter coefficients */
Word16 *stable_lsp, /* i/o: stable LSP filter coefficients */
- const Word16 m /* i : order of LP analysis */
+ const Word16 m /* i : order of LP analysis */
)
{
Word16 a[M+1];
@@ -2052,10 +2058,10 @@ void isp2lsp_fx(
*-------------------------------------------------------------------*/
void lsf2isf_fx(
- const Word16 *lsf, /* i : LSF vector */
+ const Word16 *lsf, /* i : LSF vector */
Word16 *isf, /* o : ISF vector */
Word16 *stable_isp, /* i/o: stable ISP filter coefficients */
- const Word16 m /* i : order of LP analysis */
+ const Word16 m /* i : order of LP analysis */
)
{
Word16 tmp_lsp[M];
@@ -2081,7 +2087,7 @@ void lsf2isf_fx(
*-------------------------------------------------------------------*/
void isf2lsf_fx(
- const Word16 *isf, /* i : ISF vector */
+ const Word16 *isf, /* i : ISF vector */
Word16 *lsf, /* o : LSF vector */
Word16 *stable_lsp /* i/o: stable LSP filter coefficients */
)
@@ -2124,9 +2130,9 @@ void isf2lsf_fx(
/*==========================================================================*/
void lsp2lsf_fx(
const Word16 lsp[], /* i : lsp[m] (range: -1<=val<1) Q15*/
- Word16 lsf[], /* o : lsf[m] normalized (range: 0.0<=val<=0.5) Q(x2.56)*/
- const Word16 m /* i : LPC order Q0*/
- ,Word32 int_fs
+ Word16 lsf[], /* o : lsf[m] normalized (range: 0.0<=val<=0.5) Q(x2.56)*/
+ const Word16 m, /* i : LPC order Q0*/
+ const Word32 int_fs /* i : internal sampling frequency */
)
{
Word16 i;
@@ -2168,10 +2174,10 @@ void lsp2lsf_fx(
/* _ None */
/*===========================================================================*/
void lsf2lsp_fx(
- const Word16 lsf[], /* i : lsf[m] normalized (range: 0.0<=val<=0.5) x2.56 */
- Word16 lsp[], /* o : lsp[m] (range: -1<=val<1) Q15 */
- const Word16 m /* i : LPC order Q0 */
- , Word32 int_fs
+ const Word16 lsf[], /* i : lsf[m] normalized (range: 0.0<=val<=0.5) x2.56 */
+ Word16 lsp[], /* o : lsp[m] (range: -1<=val<1) Q15 */
+ const Word16 m, /* i : LPC order Q0 */
+ const Word32 int_fs /* i : internal sampling frequency */
)
{
Word16 i, ind, offset;
@@ -2215,7 +2221,11 @@ void lsf2lsp_fx(
}
-void tcvq_Dec_fx(Word16 *ind, /*float *d_out, */Word16 *d_out_fx, Word16 safety_net)
+void tcvq_Dec_fx(
+ Word16 *ind,
+ Word16 *d_out_fx,
+ const Word16 safety_net
+)
{
Word16 i;
Word16 index[9];
@@ -2376,9 +2386,9 @@ void tcvq_Dec_fx(Word16 *ind, /*float *d_out, */Word16 *d_out_fx, Word16 safety_
}
Word16 qlsf_ARSN_tcvq_Dec_16k_fx (
- Word16 *y_fx, /* o : Quantized LSF vector */
- Word16 *indice, /* i : Indices */
- const Word16 nBits /* i : number of bits */
+ Word16 *y_fx, /* o : Quantized LSF vector */
+ Word16 *indice, /* i : Indices */
+ const Word16 nBits /* i : number of bits */
)
{
Word16 i;
@@ -2475,7 +2485,6 @@ Word16 qlsf_ARSN_tcvq_Dec_16k_fx (
void lsf_syn_mem_backup_fx(
Encoder_State_fx *st_fx, /* i: state structure */
- LPD_state* LPDmem, /* i: LPD state memory structure */
Word16 *btilt_code_fx, /* i: tilt code */
Word32 *gc_threshold_fx, /* i: */
Word16 *clip_var_bck_fx, /* o: */
@@ -2500,6 +2509,7 @@ void lsf_syn_mem_backup_fx(
)
{
Word16 i;
+ LPD_state_HANDLE hLPDmem = st_fx->hLPDmem;
*clip_var = st_fx->clip_var_fx[0];
move16();
@@ -2540,16 +2550,16 @@ void lsf_syn_mem_backup_fx(
/* back-up memories */
FOR(i=0; iLPDmem.mem_syn[i];
+ mem_syn_bck[i] = hLPDmem->mem_syn[i];
move16();
}
- *mem_w0_bck = st_fx->LPDmem.mem_w0;
+ *mem_w0_bck = hLPDmem->mem_w0;
move16();
- *btilt_code_fx = LPDmem->tilt_code;
- *gc_threshold_fx = LPDmem->gc_threshold;
+ *btilt_code_fx = hLPDmem->tilt_code;
+ *gc_threshold_fx = hLPDmem->gc_threshold;
Copy( st_fx->clip_var_fx, clip_var_bck_fx, 6 );
*next_force_sf_bck_fx = st_fx->next_force_safety_net_fx;
@@ -2612,11 +2622,10 @@ void lsf_update_memory(
/*=======================================================================*/
void lsf_syn_mem_restore_fx(
Encoder_State_fx *st_fx, /* o: state structure */
- LPD_state* LPDmem, /* o: LPD_state vewctor */
- Word16 btilt_code_fx, /* i: */
- Word32 gc_threshold_fx, /* i: */
- Word16 *clip_var_bck_fx, /* i: */
- Word16 next_force_sf_bck_fx, /* i: */
+ Word16 btilt_code_fx, /* i: */
+ Word32 gc_threshold_fx, /* i: */
+ Word16 *clip_var_bck_fx, /* i: */
+ Word16 next_force_sf_bck_fx, /* i: */
Word16 *lsp_new, /* o: LSP vector to quantize */
Word16 *lsf_new, /* o: quantized LSF vector */
@@ -2637,6 +2646,7 @@ void lsf_syn_mem_restore_fx(
)
{
Word16 i;
+ LPD_state_HANDLE hLPDmem = st_fx->hLPDmem;
/* restore lsf memories */
st_fx->clip_var_fx[0] = clip_var;
@@ -2676,20 +2686,20 @@ void lsf_syn_mem_restore_fx(
}
/* restoring memories */
- st_fx->LPDmem.mem_w0 = mem_w0_bck;
+ hLPDmem->mem_w0 = mem_w0_bck;
move16();
FOR(i=0; iLPDmem.mem_syn[i] = mem_syn_bck[i];
+ hLPDmem->mem_syn[i] = mem_syn_bck[i];
move16();
}
move16();
move32();
move16();
- LPDmem->tilt_code = btilt_code_fx;
- LPDmem->gc_threshold = gc_threshold_fx;
+ hLPDmem->tilt_code = btilt_code_fx;
+ hLPDmem->gc_threshold = gc_threshold_fx;
Copy( clip_var_bck_fx, st_fx->clip_var_fx, 6 );
st_fx->next_force_safety_net_fx = next_force_sf_bck_fx;
@@ -2714,16 +2724,85 @@ Word16 tcxlpc_get_cdk(
return cdk;
}
+#ifdef IVAS_MSVQ
+/*--------------------------------------------------------------------------*
+ * dec_FDCNG_MSVQ_stage1()
+ *
+ *
+ *--------------------------------------------------------------------------*/
+
+void dec_FDCNG_MSVQ_stage1(
+ int16_t j_full, /* i : index full range */
+ int16_t n, /* i : dimension to generate */
+ const float* invTrfMatrix, /* i : IDCT matrix for synthesis */
+ const DCTTYPE idcttype, /* i : specify which IDCT */
+ float* uq, /* o : synthesized stage1 vector */
+ Word16* uq_ind /* o : synthesized stage1 vector in BASOP */
+)
+{
+ int16_t col, segm_ind, j;
+ float dct_vec[FDCNG_VQ_MAX_LEN];
+ float idct_vec[FDCNG_VQ_MAX_LEN];
+ const Word8* cbpW8;
+ const Word16* dct_col_shift_tab;
+
+ assert(n <= FDCNG_VQ_MAX_LEN);
+ assert(n >= FDCNG_VQ_DCT_MINTRUNC);
+
+ segm_ind = 0;
+ for (col = 1; col <= FDCNG_VQ_DCT_NSEGM; col++)
+ {
+ if (j_full >= cdk1_ivas_cum_entries_per_segment[col])
+ {
+ segm_ind++;
+ }
+ }
+
+ j = j_full - cdk1_ivas_cum_entries_per_segment[segm_ind]; /* j is the local segment index */
+
+ assert(j < cdk1_ivas_entries_per_segment[segm_ind]);
+
+ /* Word8 column variable Qx storage*/
+ cbpW8 = cdk_37bits_ivas_stage1_W8Qx_dct_sections[segm_ind]; /* Word8 storage fixed ptr_init */
+ cbpW8 += j * cdk1_ivas_cols_per_segment[segm_ind]; /* adaptive ptr init */
+ dct_col_shift_tab = stage1_dct_col_syn_shift[segm_ind];
+
+ for (col = 0; col < cdk1_ivas_cols_per_segment[segm_ind]; col++)
+ {
+ dct_vec[col] = (float)shl((Word16)cbpW8[col], dct_col_shift_tab[col]);
+ /* LOGIC( 1 ) , SHIFT( 1 );
+ in BASOP: s_and(for W8->W16), shl()
+ */
+ }
+ dctT2_N_apply_matrix((const float*)dct_vec, idct_vec, cdk1_ivas_cols_per_segment[segm_ind], n, invTrfMatrix, FDCNG_VQ_DCT_MAXTRUNC, idcttype);
+
+ /*scale down to original fdcngvq domain and move to Q0 */
+ v_multc(idct_vec, fdcng_dct_scaleF[1], idct_vec, n);
+ /* fdcng_dct_scaleF[1] --> 0.0625-->scale down from search Q4 domain to Q0 ,
+ not really relevant for BASOP loop */
+
+ /*add common mid fdcng vector, in fdcng bands domain */
+ v_add(idct_vec, cdk1r_tr_midQ_truncQ, uq, n);
+ assert(uq_ind == NULL);
+
+ return;
+}
+
+#endif
void msvq_dec
(
const Word16 *const*cb, /* i : Codebook (indexed cb[*stages][levels][p]) (14Q1*1.28)*/
const Word16 dims[], /* i : Dimension of each codebook stage (NULL: full dim.) */
const Word16 offs[], /* i : Starting dimension of each codebook stage (NULL: 0) */
- const Word16 stages,/* i : Number of stages */
- const Word16 N, /* i : Vector dimension */
- const Word16 maxN, /* i : Codebook dimension */
- const Word16 Idx[], /* i : Indices */
- Word16 *uq /* o : quantized vector (14Q1*1.28)*/
+ const Word16 stages, /* i : Number of stages */
+ const Word16 N, /* i : Vector dimension */
+ const Word16 maxN, /* i : Codebook dimension */
+ const Word16 Idx[], /* i : Indices */
+#ifdef IVAS_MSVQ
+ const int16_t applyIDCT_flag, /* i : applyIDCT flag */
+ const float* invTrfMatrix, /* i : matrix for IDCT synthesis */
+#endif
+ Word16 *uq /* o : quantized vector (14Q1*1.28)*/
)
{
Word16 i,j,offset;
@@ -2761,24 +2840,34 @@ void msvq_dec
start = offs[i];
move16();
}
-
- /*vr_add( uq+start, cb[i]+Idx[i]*maxn, uq+start, n );, where uq = a zero vector*/
- offset = i_mult2(Idx[i],N34);
-
- FOR (j=0; j XX in worst case */
+ dim_in = fdcngvq_dim;
+ dim_out = dct_dim;
+ mat_step_col = matrix_row_dim; /* matrix maximum storage size dependent, width of first row in matrix */
+ mat_step_row = 0;
+ mat_step_col_flag = 1;
+ assert(dcttype == DCT_T2_21_XX || dcttype == DCT_T2_24_XX);
+ }
+ else
+ {
+ assert((dcttype & 1) != 0); /* idct */
+ dim_in = dct_dim;
+ dim_out = fdcngvq_dim;
+ mat_step_col = 1;
+ mat_step_row = matrix_row_dim;
+ mat_step_col_flag = 0;
+ assert(dcttype == IDCT_T2_XX_24);
+ }
+
+ pt_y = tmp_y;
+ for (i = 0; i < dim_out; i++)
+ {
+ pt_x = input;
+ *pt_y = 0;
+
+ /* +i(DCT) or +i*maxTrunc(IDCT) */
+#define WMC_TOOL_SKIP
+ pt_A = &(matrix[i * (mat_step_row + mat_step_col_flag)]); /* ptr indexing */
+ PTR_INIT(1);
+#undef WMC_TOOL_SKIP
+ for (j = 0; j < dim_in; j++)
+ {
+#define WMC_TOOL_SKIP
+ * pt_y += (*pt_x++) * (*pt_A);
+ pt_A += mat_step_col; /* step +maxtrunc or +1 */ /* ptr indexing*/
+ MAC(1);
+#undef WMC_TOOL_SKIP
+ }
+ pt_y++;
+ }
+
+ mvr2r(tmp_y, output, dim_out);
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * extend_dctN_input()
+ *
+ * (inputN, dctN) -> idct(N_ext) idct_N matrix application loop for
+ * extending, extrapolating a DCT basis vector length of N to N_ext
+ *-------------------------------------------------------------------*/
+
+void extend_dctN_input(
+ const float* input, /* i : input in fdcng domain */
+ const float* dct_input, /* i : input in dctN(fdcng) domain */
+ const int16_t in_dim, /* i : in_dim == N */
+ float* ext_sig, /* o : extended output in fdcng domain */
+ const int16_t out_dim, /* i : output total dim */
+ float* matrix, /* i : idct synthesis matrix N rows, n_cols columns */
+ const int16_t n_cols, /* i : number of columns == DCT truncation length */
+ const DCTTYPE dcttype /* i : matrix operation type */
+)
+{
+ int16_t i, j, i_rev;
+ const float(*ptr)[FDCNG_VQ_DCT_MAXTRUNC] = (void*)matrix;
+
+ /* stored format is an IDCT_Nx(FDCNG_VQ_DCT_MAXTRUNC) matrix */
+ assert(in_dim < FDCNG_VQ_MAX_LEN);
+ assert(out_dim <= FDCNG_VQ_MAX_LEN);
+ assert(out_dim > in_dim);
+ assert(n_cols == FDCNG_VQ_DCT_MAXTRUNC); /* for *ptr[MAX_TRUNC] adressing*/
+ assert((dcttype & 1) != 0); /* idct tables always in use for this basis vector extension */
+
+ mvr2r(input, ext_sig, in_dim); /* copy initial part, i.e. only last/tail parts are extended */
+ set_f(&(ext_sig[in_dim]), 0.0, out_dim - in_dim);
+
+ i_rev = in_dim; /*ptr init*/
+ for (i = in_dim; i < out_dim; i++)
+ { /* for each extension sample */
+ /* i = 21 22 23;
+ i_rev = 20 19 18; for odd dctII reflect basis vector
+ */
+ i_rev--;
+
+ for (j = 0; j < n_cols; j++) /* for each available DCT coeff */
+ {
+ /* DCTcoeff * reflected basis vector */
+#define WMC_TOOL_SKIP
+ /* pure ptr MAC operations */
+ ext_sig[i] += dct_input[j] * ptr[i_rev][j]; /* sum up scaled and extended basis vector */
+ MAC(1);
+#undef WMC_TOOL_SKIP
+ }
+ }
+
+ return;
+}
+
+
+/*-------------------------------------------------------------------*
+ * create_IDCT_N_Matrix()
+ *
+ * inititate idct24 FDCNG_VQ_DCT_MAXTRUNCx N matrix in
+ * RAM from a quantized compressed ROM format
+ *-------------------------------------------------------------------*/
+
+void create_IDCT_N_Matrix(
+ float* inv_matrixFloatQ, /* i/o: RAM buffer */
+ const int16_t N, /* i : DCT length, number of time samples */
+ const int16_t n_cols, /* i : number of dct coeffs (as DCT may be truncated) */
+ const int16_t alloc_size /* i : RAM buffer size in elements */
+)
+{
+ int16_t c, c1, r, r_flip, W16_val;
+ int16_t len;
+ int16_t mat_cpy_size;
+ const Word16* absval_ptr;
+ const Word8* idx_ptr;
+ Word16 idx;
+ float(*ptr)[FDCNG_VQ_DCT_MAXTRUNC] = (void*)inv_matrixFloatQ; /* fixed number of columns pointers, to simplifies adressing in ANSIC */
+
+ absval_ptr = unique_idctT2_24coeffsQ16;
+ idx_ptr = idctT2_24_compressed_idx;
+ len = FDCNG_VQ_MAX_LEN;
+
+ if (N == FDCNG_VQ_MAX_LEN_WB)
+ {
+ absval_ptr = unique_idctT2_21coeffsQ16;
+ idx_ptr = idctT2_21_compressed_idx;
+ len = N;
+ }
+
+ assert(alloc_size >= (n_cols * len)); /* enough space for the full expanded IDCT matrix */
+ assert(N <= len);
+
+ mat_cpy_size = (n_cols) * (len >> 1); /* NB integer division of "len" */
+
+ if ((len & 1) != 0)
+ { /* odd sized DCT with a non-reflected center row */
+ mat_cpy_size += n_cols;
+ }
+
+ for (c = 0; c < mat_cpy_size; c++)
+ {
+ idx = (Word16)(idx_ptr[c]);
+ W16_val = absval_ptr[abs(idx)];
+
+ if (idx < 0)
+ {
+ W16_val = -(W16_val);
+ }
+ inv_matrixFloatQ[c] = (+1.52587890625e-05f) * ((float)W16_val); /* 1.0/2.^16 scaling to a float-"Q0" , a scaling that is not done in BASOP */
+ }
+
+ /* for even number of coeffs DCT24,
+ flip symmetry for odd, even is used to save 50% IDCT Table ROM */
+ /* for an odd DCT center is not flipped e.g for DCT21 */
+
+ assert(n_cols == FDCNG_VQ_DCT_MAXTRUNC);
+ assert((n_cols & 1) == 0);
+
+ for (c = 0; c < (n_cols); c += 2)
+ {
+ c1 = c + 1;
+ r_flip = len - 1;
+ for (r = 0; r < (len / 2); r++, r_flip--)
+ {
+#define WMC_TOOL_SKIP
+ ptr[r_flip][c] = ptr[r][c]; /* flipped */
+ ptr[r_flip][c1] = -(ptr[r][c1]); /* flipped and sign swapped */
+ MOVE(2);
+ MULT(1); /* for negate */
+#undef WMC_TOOL_SKIP
+ }
+ }
+
+ return;
+}
+#endif
diff --git a/lib_com/lsp_conv_poly_fx.c b/lib_com/lsp_conv_poly_fx.c
index cf37feb7b38fdfdc686e9b7a3613b751548f13ed..0269ed4f4e7e762de5a9a50c84e4949be33bb894 100644
--- a/lib_com/lsp_conv_poly_fx.c
+++ b/lib_com/lsp_conv_poly_fx.c
@@ -2,12 +2,11 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h"
-
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "rom_com_fx.h" /* Static table prototypes */
-#include "stl.h"
/*-------------------------------------------------------------------*
* Local constants
@@ -19,48 +18,15 @@
#define NC (M/2)
/*-------------------------------------------------------------------*
- * Local functions
+ * Local function prototypes
*-------------------------------------------------------------------*/
-static void powerspect_fx(
- const Word16 x[], /* i: Q15 Grid points x[0:m-1] */
- Word16 N, /* i: Number of grid points */
- Word32 R[], /* i: Q20 Coefficients of R(x) in R[0:NC] */
- Word32 S[], /* i: Q20 Coefficients of S(x) in S[0:NC] */
- Word32 G[], /* o: Q15 Power spectrum G[0:N] */
- Word16 mode /* i: Flag for up or down conversion */
-);
-
-static void spectautocorr_fx(
- const Word16 x[], /* i: Grid points x[0:m-1] */
- const Word16 N, /* i: Number of grid points */
- const Word32 G[], /* i: Power spectrum G[0:N-1] */
- Word16 rh[], /* o: Autocorrelation r[0:M] */
- Word16 rl[] /* o: Autocorrelation r[0:M] */
-);
-
-static Word32 b_inv_sq(
- const Word32 in32, /* i : Input not normalized to inverse */
- const Word16 exp_in /* I : input current exponent */
-);
-
-static Word32 inv_pow(
- const Word32 re,
- const Word32 se,
- const Word16 x
-
-);
-
+static void powerspect_fx(const Word16 x[], Word16 N, Word32 R[], Word32 S[], Word32 G[], Word16 mode );
+static void spectautocorr_fx(const Word16 x[], const Word16 N, const Word32 G[], Word16 rh[], Word16 rl[] );
+static Word32 b_inv_sq(const Word32 in32, const Word16 exp_in );
+static Word32 inv_pow(const Word32 re, const Word32 se, const Word16 x);
static void zeros2poly_fx( Word16 x[], Word32 R[], Word32 S[] );
-
-static void polydecomp_fx(
- Word16 A[], /* i: Q12 linear prediction coefficients */
- Word32 P[], /* o: Q22 coefficients of R(x) */
- Word32 Q[] /* o: Q22 coefficients of S(x) */
-);
-
-static void cheb2poly_fx(
- Word32 L_P[] /* i/o Q22: The coefficients of C(x) and P(x) */
-);
+static void polydecomp_fx(Word16 A[], Word32 P[], Word32 Q[] );
+static void cheb2poly_fx( Word32 L_P[] );
/*---------------------------------------------------------------------*
* lsp_convert_poly()
@@ -79,9 +45,9 @@ static void cheb2poly_fx(
*---------------------------------------------------------------------*/
Word16 lsp_convert_poly_fx(
- Word16 w[], /* i/o: LSP or ISP parameters */
- const Word16 L_frame, /* i : flag for up or down conversion */
- const Word16 Opt_AMRWB /* i : flag for the AMR-WB IO mode */
+ Word16 w[], /* i/o: LSP or ISP parameters */
+ const Word16 L_frame, /* i : flag for up or down conversion */
+ const Word16 Opt_AMRWB /* i : flag for the AMR-WB IO mode */
)
{
const Word16 N50 = GRID50_POINTS;
diff --git a/lib_com/modif_fs_fx.c b/lib_com/modif_fs_fx.c
index e0929578f786590ca7871143f06fc337d4da2aaf..532e1ff030436359da68f92949579c11e270fd9e 100644
--- a/lib_com/modif_fs_fx.c
+++ b/lib_com/modif_fs_fx.c
@@ -2,15 +2,13 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
#include "rom_com_fx.h" /* Static table prototypes */
#include
#include "rom_enc_fx.h" /* prototypes */
-#include "stl.h"
-
#include "basop_util.h"
/*-----------------------------------------------------------------*
@@ -43,12 +41,12 @@
/*==============================================================================*/
Word16 modify_Fs_fx( /* o : length of output Q0 */
const Word16 sigIn_fx[], /* i : signal to decimate Q0 */
- Word16 lg, /* i : length of input Q0 */
+ Word16 lg, /* i : length of input Q0 */
const Word32 fin, /* i : frequency of input Q0 */
- Word16 sigOut_fx[], /* o : decimated signal Q0 */
+ Word16 sigOut_fx[], /* o : decimated signal Q0 */
const Word32 fout, /* i : frequency of output Q0 */
- Word16 mem_fx[] /* i/o: filter memory Q0 */
- ,const Word16 nblp /* i : flag indicating if NB low-pass is applied */
+ Word16 mem_fx[], /* i/o: filter memory Q0 */
+ const Word16 nblp /* i : flag indicating if NB low-pass is applied */
)
{
Word16 i;
@@ -308,14 +306,19 @@ Word16 modify_Fs_fx( /* o : length of output Q0 */
return lg_out;
}
+/*-------------------------------------------------------------------*
+ * modify_Fs_intcub3m_sup()
+ *
+ *
+ *-------------------------------------------------------------------*/
-Word16 modify_Fs_intcub3m_sup_fx( /* o : length of output */
- const Word16 sigIn[], /* i : signal to decimate with memory of 2 samples (indexes -2 & -1) */
- const Word16 lg, /* i : length of input (suppose that lg is such that lg_out is integer, ex multiple of 5 in case of 16kHz to 12.8 kHz) */
- const Word32 fin, /* i : frequency of input */
- Word16 sigOut[], /* o : decimated signal */
- const Word32 fout, /* i : frequency of output */
- Word16 *delayout /* o : delay of output */
+Word16 modify_Fs_intcub3m_sup_fx( /* o : length of output */
+ const Word16 sigIn[], /* i : signal to decimate with memory of 2 samples (indexes -2 & -1) */
+ const Word16 lg, /* i : length of input (suppose that lg is such that lg_out is integer, ex multiple of 5 in case of 16kHz to 12.8 kHz) */
+ const Word32 fin, /* i : frequency of input */
+ Word16 sigOut[], /* o : decimated signal */
+ const Word32 fout, /* i : frequency of output */
+ Word16 *delayout /* o : delay of output */
)
{
Word16 i, k, i1, i2, k1, k2, k3, kk, cind;
@@ -598,18 +601,18 @@ Word16 modify_Fs_intcub3m_sup_fx( /* o : length of output */
/*====================================================================*/
/* FUNCTION : Decimate_allpass_steep_fx1 () */
/*-------------------------------------------------------------------*/
-/* PURPOSE : decimation by a factor 2 */
+/* PURPOSE : decimation by a factor 2 */
/*-------------------------------------------------------------------*/
/* INPUT ARGUMENTS : */
/* _ (const Word16 *) in_fx : input speech, Q0 */
-/* _ (Word16 []) state_fx: Stateinfo, Q0 */
+/* _ (Word16 []) mem: Stateinfo, Q0 */
/* Size: 2*ALLPASSSECTIONS_STEEP+1 */
/* _ (Word16) N: Number of Input samples */
-/* _ (Word16 []) out_fx :Output arry of size N/2 Q0 */
+/* _ (Word16 []) out_fx :Output arry of size N/2 Q0 */
/*-------------------------------------------------------------------*/
/* OUTPUT ARGUMENTS : */
/* _ (Word16 []) out_fx : output-signal, Q0 */
-/* _ (Word16 []) state_fx:gets updated, Q0 */
+/* _ (Word16 []) mem:gets updated, Q0 */
/*-------------------------------------------------------------------*/
/* INPUT/OUTPUT ARGUMENTS : */
/*-------------------------------------------------------------------*/
@@ -617,10 +620,11 @@ Word16 modify_Fs_intcub3m_sup_fx( /* o : length of output */
/*===================================================================*/
-void Decimate_allpass_steep_fx( const Word16 *in_fx,
- Word16 state_fx[], /* array of size: 2*ALLPASSSECTIONS_STEEP+1 */
- Word16 N, /* number of input samples */
- Word16 out_fx[]) /* array of size N/2 */
+void Decimate_allpass_steep_fx(
+ const Word16 *in_fx,
+ Word16 mem[], /* array of size: 2*ALLPASSSECTIONS_STEEP+1 */
+ Word16 N, /* number of input samples */
+ Word16 out_fx[]) /* array of size N/2 */
{
Word16 k;
@@ -636,58 +640,58 @@ void Decimate_allpass_steep_fx( const Word16 *in_fx,
FOR ( k = 0; k < N/2; k++ )
{
- Lacc = L_deposit_h( state_fx[0] ); /* Q(16+x) */
+ Lacc = L_deposit_h( mem[0] ); /* Q(16+x) */
Lacc = L_mac( Lacc, AP1_STEEP_FX[0], in_fx[2*k] ); /* Q(16+x) */
Lacc1 = L_deposit_h( in_fx[2*k] ); /* Q16+Qx */
temp1 = extract_h( Lacc ); /* Qx */
Lacc1 = L_msu( Lacc1, AP1_STEEP_FX[0], temp1 ); /* Q16+Qx */
- state_fx[0] = extract_h( Lacc1 ); /* Qx */
+ mem[0] = extract_h( Lacc1 ); /* Qx */
temp[0] = temp1;
move16();
- Lacc1 = L_deposit_h( state_fx[1] ); /* Q16+Qx */
+ Lacc1 = L_deposit_h( mem[1] ); /* Q16+Qx */
Lacc1 = ( L_mac( Lacc1, AP1_STEEP_FX[1], temp1 )); /* Q16+Qx */
temp2 = extract_h( Lacc1 ); /* Qx */
Lacc = L_msu( Lacc, AP1_STEEP_FX[1], temp2 ); /* Q16+Qx */
- state_fx[1] = extract_h(Lacc); /* Qx */
+ mem[1] = extract_h(Lacc); /* Qx */
temp[1] = temp2;
move16();
- Lacc = L_deposit_h( state_fx[ ALLPASSSECTIONS_STEEP-1 ] ); /* Q(16+x) */
+ Lacc = L_deposit_h( mem[ ALLPASSSECTIONS_STEEP-1 ] ); /* Q(16+x) */
out_fx[ k ] = extract_h( L_mac( Lacc, AP1_STEEP_FX[ ALLPASSSECTIONS_STEEP-1 ], temp2 )); /* Qx format */
- state_fx[ ALLPASSSECTIONS_STEEP-1 ] = extract_h( L_msu ( Lacc1, AP1_STEEP_FX[ ALLPASSSECTIONS_STEEP-1 ], out_fx[k] )); /* Qx */
+ mem[ ALLPASSSECTIONS_STEEP-1 ] = extract_h( L_msu ( Lacc1, AP1_STEEP_FX[ ALLPASSSECTIONS_STEEP-1 ], out_fx[k] )); /* Qx */
}
/* lower allpass filter chain */
- Lacc = L_deposit_h( state_fx[ ALLPASSSECTIONS_STEEP ] ); /* Q(16+x) */
- Lacc = L_mac( Lacc, AP2_STEEP_FX[0], state_fx[2*ALLPASSSECTIONS_STEEP] ); /*Q(16+x) */
- Lacc1 = L_deposit_h( state_fx[2*ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */
+ Lacc = L_deposit_h( mem[ ALLPASSSECTIONS_STEEP ] ); /* Q(16+x) */
+ Lacc = L_mac( Lacc, AP2_STEEP_FX[0], mem[2*ALLPASSSECTIONS_STEEP] ); /*Q(16+x) */
+ Lacc1 = L_deposit_h( mem[2*ALLPASSSECTIONS_STEEP] ); /* Q(16+x) */
temp1 = extract_h( Lacc ); /* Qx */
Lacc1 = L_msu( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */
- state_fx[ ALLPASSSECTIONS_STEEP ] = extract_h( Lacc1 );
+ mem[ ALLPASSSECTIONS_STEEP ] = extract_h( Lacc1 );
temp[0] = temp1;
move16();
- Lacc1 = L_deposit_h( state_fx[ ALLPASSSECTIONS_STEEP+1 ] ); /* Q(16+x) */
+ Lacc1 = L_deposit_h( mem[ ALLPASSSECTIONS_STEEP+1 ] ); /* Q(16+x) */
Lacc1 = L_mac( Lacc1, AP2_STEEP_FX[1], temp1 ); /* Q(16+x) */
temp2 = extract_h( Lacc1 ); /* Qx */
temp[1] = temp2;
move16();
Lacc = L_msu( Lacc, AP2_STEEP_FX[1], temp2 ); /* Q(16+x) */
- state_fx[ALLPASSSECTIONS_STEEP+1] = extract_h( Lacc ); /* Qx */
+ mem[ALLPASSSECTIONS_STEEP+1] = extract_h( Lacc ); /* Qx */
- Lacc = L_deposit_h( state_fx[2*ALLPASSSECTIONS_STEEP-1] ); /* Q(16+x) */
+ Lacc = L_deposit_h( mem[2*ALLPASSSECTIONS_STEEP-1] ); /* Q(16+x) */
Lacc = L_mac( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP-1], temp2 ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */
temp[2] = extract_h( Lacc ); /* temp[2] in Qx */
Lacc1 = L_msu( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP-1], temp[2] ); /* Q(16+x) */
- state_fx[ 2*ALLPASSSECTIONS_STEEP-1 ] = extract_h( Lacc1 ); /* Qx */
+ mem[ 2*ALLPASSSECTIONS_STEEP-1 ] = extract_h( Lacc1 ); /* Qx */
sum = mult_r( out_fx[0], 16384 ); /* Qx */
out_fx[0] = add( sum, mult_r(temp[ALLPASSSECTIONS_STEEP-1], 16384 )); /* Qx */ move16();
@@ -697,31 +701,31 @@ void Decimate_allpass_steep_fx( const Word16 *in_fx,
{
- Lacc = L_deposit_h( state_fx[ ALLPASSSECTIONS_STEEP ] ); /* Q(16+x) */
+ Lacc = L_deposit_h( mem[ ALLPASSSECTIONS_STEEP ] ); /* Q(16+x) */
Lacc = L_mac(Lacc, AP2_STEEP_FX[0], in_fx[2*k-1] ); /* Q(16+x):temp[0] */
Lacc1 = L_deposit_h( in_fx[ 2*k-1 ] ); /* Q(16+x) */
temp1 = extract_h( Lacc ); /* Qx */
Lacc1 = L_msu( Lacc1, AP2_STEEP_FX[0], temp1 ); /* Q(16+x) */
- state_fx[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */
+ mem[ALLPASSSECTIONS_STEEP] = extract_h( Lacc1 ); /* Qx */
temp[0] = temp1;
move16();
- Lacc1 = L_deposit_h( state_fx[ ALLPASSSECTIONS_STEEP+1 ] ); /* Q(16+x) */
+ Lacc1 = L_deposit_h( mem[ ALLPASSSECTIONS_STEEP+1 ] ); /* Q(16+x) */
Lacc1 = L_mac(Lacc1,AP2_STEEP_FX[1],temp1); /* Q(16+x) */
temp2 = extract_h( Lacc1 ); /* Qx */
temp[1] = temp2;
move16();
Lacc = L_msu(Lacc,AP2_STEEP_FX[1],temp2); /* Q(16+x) */
- state_fx[ALLPASSSECTIONS_STEEP+1]= extract_h(Lacc); /* Qx */
+ mem[ALLPASSSECTIONS_STEEP+1]= extract_h(Lacc); /* Qx */
- Lacc = L_deposit_h( state_fx[2*ALLPASSSECTIONS_STEEP-1] ); /* Q(16+x) */
+ Lacc = L_deposit_h( mem[2*ALLPASSSECTIONS_STEEP-1] ); /* Q(16+x) */
Lacc = L_mac( Lacc, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP-1], temp[1] ); /* Q(16+x) temp[ALLPASSSECTIONS_STEEP-1] */
temp[2] = extract_h( Lacc ); /*temp[2] in Qx */
Lacc1 = L_msu( Lacc1, AP2_STEEP_FX[ALLPASSSECTIONS_STEEP-1], temp[2] ); /* Q(16+x) */
- state_fx[2*ALLPASSSECTIONS_STEEP-1] = extract_h( Lacc1 ); /* Qx */
+ mem[2*ALLPASSSECTIONS_STEEP-1] = extract_h( Lacc1 ); /* Qx */
@@ -733,19 +737,23 @@ void Decimate_allpass_steep_fx( const Word16 *in_fx,
/* z^(-1) */
- state_fx[ 2*ALLPASSSECTIONS_STEEP ] = in_fx[ N-1 ];
+ mem[ 2*ALLPASSSECTIONS_STEEP ] = in_fx[ N-1 ];
move16(); /* Qx */
}
+/*-------------------------------------------------------------------*
+ * Interpolate_allpass_steep()
+ *
+ * Interpolation by a factor 2
+ *-------------------------------------------------------------------*/
-void Interpolate_allpass_steep_fx(const Word16 *in_fx,
- Word16 state_fx[], /* array of size: 2*ALLPASSSECTIONS_STEEP+1 */
- Word16 N, /* number of input samples */
- Word16 out_fx[]) /* array of size 2*N */
-
-
+void Interpolate_allpass_steep_fx(
+ const Word16 *in_fx,
+ Word16 mem[], /* array of size: 2*ALLPASSSECTIONS_STEEP+1 */
+ Word16 N, /* number of input samples */
+ Word16 out_fx[]) /* array of size 2*N */
{
Word16 k;
@@ -758,28 +766,28 @@ void Interpolate_allpass_steep_fx(const Word16 *in_fx,
FOR (k=0; k
+#include "options.h"
#include "rom_com_fx.h"
#include "prot_fx.h"
-#include "stl.h"
/*===================================================================*/
@@ -29,11 +30,11 @@
/* _ None. */
/*===================================================================*/
Word16 dequantize_uvg_fx(
- Word16 iG1,
- Word16 *iG2,
- Word16 *G,
- Word16 bwidth_fx
- ,Word16 do_scale
+ const Word16 iG1, /* i: gain 1 index */
+ const Word16* iG2, /* i: gain 2 index */
+ Word16* G, /* o: quantized gain */
+ const Word16 bwidth_fx, /* i: bandwidth */
+ const Word16 do_scale
)
{
Word16 i, k;
@@ -135,9 +136,9 @@ Word16 dequantize_uvg_fx(
/*===================================================================*/
void generate_nelp_excitation_fx(
Word16 *seed, /* i/o: random number seed */
- Word16 *Gains, /* i : excitation gains Q_exc*/
+ const Word16 *Gains, /* i : excitation gains Q_exc*/
Word16 *output, /* o : excitation output */
- Word16 gain_fac /* i : gain factor */
+ const Word16 gain_fac /* i : gain factor */
)
{
Word16 i, len, j;
diff --git a/lib_com/options.h b/lib_com/options.h
index 6ff5ded14d32b042ce69a057db87be97f1d47b9a..6846cd7a376cfc6b1a8164aa9ae46977a7917e40 100644
--- a/lib_com/options.h
+++ b/lib_com/options.h
@@ -6,11 +6,15 @@
#ifndef OPTIONS_H
#define OPTIONS_H
-#define DEBUGGING
+
+
+#define DEBUGGING /*allows message printed out during run time */
+
#ifdef DEBUGGING
#include "debug.h"
#endif
+
#include "stl.h"
/* ################### Start compiler switches ######################## */
@@ -20,6 +24,93 @@
#endif
#define SUPPORT_JBM_TRACEFILE /* support for JBM tracefile, which is needed for 3GPP objective/subjective testing, but not relevant for real-world implementations */
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * Keywors concerning IVAS to be search for in the code
+ *
+ *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+ /* #define _DIFF_FLOAT_FIX_*/ /* ->>>>>>> difference observed between fix and floating point*/
+
+/* IVAS_CNST_AND_ROM Some constant and ROM added for IVAS */
+
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#define IVAS_CNST
+#define REMOVE_IVAS_UNUSED_PARAMETERS_WARNING /*temporary operation on unused parameters to remove warnings */
+#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING /*temporary operation on unused parameters to remove warnings (works in msvc, but not for gcc */
+#define MY_UNUSED_Word32(a) { Word32 b; b = a+1; b++; }
+#define MY_UNUSED_Word(a) { Word16 b; b = a+1; b++; }
+#define MY_UNUSED_Array(a) { Word16 b; if (a!= NULL) {b = a[0]+1; b++;}else {b= 0;} }
+#endif
+
+ //#define MSVQ_ROM ->>>>At least tables under MSVQ_ROM plus scales, scales_p, sigma_p, inv_sigma_p, need update
+//#define MY_DEBUG
+
+#define MOD_BIT_ALLOC_ROM_TABLE // Just to highlight modification in bit allocation table and to ensure these modifications doesn't affect EVS modes*/
+#define SIMPLIFY_CODE_BE // Simplify synthesis loop
+
+//#define AFFECT_TEST_VECTOR_BE_1 /* This concerns the reset of infoTotalBitsPerFrameWritten */
+//#define AFFECT_TEST_VECTOR_BE_dec /* This is related to the CR concerning lead_deindexing, it is just that my test vectors are not updated accordingly */
+
+
+#if 0 /*These are a list of switches that highlight probable places where IVAS code would need to be added */
+ #define IVAS_CODE /* General code added into EVS for IVAS purpose only*/
+ #define NEW_IVAS_OPEN_DEC /* Structural changes un core_init_dec.c */
+
+ #define IVAS_CODE_AVQ
+ #define IVAS_CODE_AVQ_LPC
+ #define IVAS_CODE_TCX
+ #ifdef IVAS_CODE_TCX
+ #define IVAS_CODE_TCX_LTP
+ #define IVAS_CODE_TCX_UTIL
+ #endif
+ #define IVAS_CODE_FCB
+ #define IVAS_CODE_SWITCHING
+ #define IVAS_CODE_CNG
+ #ifdef IVAS_CODE_CNG
+ #define IVAS_CODE_CNG_COM
+ #define IVAS_CODE_CNG_FIX185_PLC_FADEOUT
+ #endif
+ #define IVAS_FEC_ECU_TO_COMPLETE
+ #define IVAS_CODE_MDCT_GSHAPE /*code to be completed/verified in TonalComponentDetection.c*/
+ #define ADD_IVAS_TBE_CODE
+
+ #define IVAS_CODE_TCX_COM
+ #define ADD_IVAS_HQ_CODE
+ #define ADD_IVAS_HQ_CODE_FEC
+ #define IVAS_CODE_COM_CONFIG_P1 /* core_com_conf */
+ #define ADD_IVAS_BWE
+ #define AVQ_DEMUX
+ #define ADD_LRTD
+ #define GSC_IVAS
+ #define LSF_RE_USE_SECONDARY_CHANNEL
+ #define IVAS_GAIN_MOD
+ #define ADD_IVAS_GS_DEC_IMPR /* -> doesnt seem used at all in IVAS to be confirm */
+ #define ADD_IVAS_CLDFB /* Code to be added to CLDFB for ivas */
+ #define IVAS_CONTEXT_MAPPING /* Fixed point range decoder is missing */
+ #define ADD_BPF_ADAPT /* bass post filter adaptation function missing */
+ #define IVAS_CODE_CON_TCX /*missing code in er_dec_tcx*/
+ #define ADD_IVAS_HTONALMDCTCONC /* handle for tonal mdct concealment is missing */
+ #define ADD_IVAS_TNS /* Code to be completed in tns , cod_tcx*/
+ #define IVAS_CODE_RANGE_CODER /* Range coder code that is missing, mainly in ACcontext_mapping */
+ #define IVAS_CODE_BITSTREAM
+
+ /* Encoder*/
+#define IVAS_CODE_CPE /*floating point code related to CPE */
+#define IVAS_CODE_DFT /*floating point code related to DFT (sp analysis and more) */
+#define IVAS_CODE_BWD /*floating point code in the BWD to be converted */
+#define IVAS_MSVQ /*floating point code in the lsf_tool to be converted */
+#endif
+
+/* #define FIX_I4_OL_PITCH */
+
+
+/*#define ADD_IVAS_HQ_CODE_L_SPEC*/ /*-->> might go hand in hand with SOLVED_COMP_ENC_DEC*/
+#ifdef ADD_IVAS_HQ_CODE_L_SPEC
+ #define SOLVED_COMP_ENC_DEC// /*HQ classifier must be aligned between encoder and decoder -> Does break to IO with legacy EVS 48 kHz high bitrate?, seems ok from preliminry tests */
+#endif
+
+
/* */
/* ##################### End compiler switches ######################## */
diff --git a/lib_com/parameter_bitmaping.c b/lib_com/parameter_bitmaping.c
index 2124258053e4743556f196977e4b719fd36d215d..b6fdbe9c4cf2d4e90c35e90559d94ab76885e771 100644
--- a/lib_com/parameter_bitmaping.c
+++ b/lib_com/parameter_bitmaping.c
@@ -2,8 +2,8 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
-#include "stl.h"
+#include
+#include "options.h"
#include
#include "prot_fx.h"
@@ -12,7 +12,13 @@
/********************************/
/** Put nBits long encoded value from *pStream into bitstream. Using the function EncodeValue for encoding. */
-static Word16 PutIntoBitstream(Word16 const ** pStream, TEncodeValue EncodeValue, Word16 index, Encoder_State_fx *st_fx, Word16 nBits)
+static Word16 PutIntoBitstream(
+ const Word16 ** pStream,
+ TEncodeValue EncodeValue,
+ Word16 index,
+ BSTR_ENC_HANDLE hBstr,
+ const Word16 nBits
+)
{
Word16 value;
Word16 codedValue;
@@ -21,14 +27,20 @@ static Word16 PutIntoBitstream(Word16 const ** pStream, TEncodeValue EncodeValue
value = *(*pStream)++;
codedValue = EncodeValue(value, index);
- push_next_indice_fx(st_fx, codedValue, nBits);
+ push_next_indice_fx(hBstr, codedValue, nBits);
return value;
}
/** Get nBits long value from bitstream into *pStream. */
-static Word16 GetFromBitstream(Decoder_State_fx *st, TDecodeValue DecodeValue, Word16 index, Word16 nFixedBits, Word16 ** pStream)
+static Word16 GetFromBitstream(
+ Decoder_State_fx *st,
+ TDecodeValue DecodeValue,
+ Word16 index,
+ Word16 nFixedBits,
+ Word16 ** pStream
+)
{
Word16 value;
@@ -50,7 +62,10 @@ static Word16 GetFromBitstream(Decoder_State_fx *st, TDecodeValue DecodeValue, W
return value;
}
-static Word16 FixedWidthEncoding(Word16 value, Word16 index)
+static Word16 FixedWidthEncoding(
+ Word16 value,
+ Word16 index
+)
{
(void)index;
return value;
@@ -60,7 +75,14 @@ static Word16 FixedWidthEncoding(Word16 value, Word16 index)
/* Interface functions */
/********************************/
-void GetParameters(ParamsBitMap const * paramsBitMap, Word16 nArrayLength, void const * pParameter, Word16 ** pStream, Word16 * pnSize, Word16 * pnBits)
+void GetParameters(
+ ParamsBitMap const * paramsBitMap,
+ const Word16 nArrayLength,
+ void const * pParameter,
+ Word16 ** pStream,
+ Word16 * pnSize,
+ Word16 * pnBits
+)
{
Word16 index;
Word16 iParam, nParams;
@@ -128,7 +150,13 @@ void GetParameters(ParamsBitMap const * paramsBitMap, Word16 nArrayLength, void
}
-void SetParameters(ParamsBitMap const * paramsBitMap, Word16 nArrayLength, void * pParameter, Word16 const ** pStream, Word16 * pnSize)
+void SetParameters(
+ ParamsBitMap const * paramsBitMap,
+ const Word16 nArrayLength,
+ void * pParameter,
+ const Word16 ** pStream,
+ Word16 * pnSize
+)
{
Word16 index;
Word16 iParam, nParams;
@@ -172,11 +200,20 @@ void SetParameters(ParamsBitMap const * paramsBitMap, Word16 nArrayLength, void
}
-void WriteToBitstream(ParamsBitMap const * paramsBitMap, Word16 nArrayLength, Word16 const ** pStream, Word16 * pnSize, Encoder_State_fx *st, Word16 * pnBits)
+void WriteToBitstream(
+ ParamsBitMap const * paramsBitMap,
+ const Word16 nArrayLength,
+ const Word16 ** pStream,
+ Word16 * pnSize,
+ BSTR_ENC_HANDLE hBstr,
+ Word16 * pnBits
+)
{
Word16 index;
Word16 iParam, nParams;
- assert((paramsBitMap != NULL) && (nArrayLength > 0) && (pStream != NULL) && (pnSize != NULL) && (st != NULL) && (pnBits != NULL));
+
+
+ assert((paramsBitMap != NULL) && (nArrayLength > 0) && (pStream != NULL) && (pnSize != NULL) && (hBstr != NULL) && (pnBits != NULL));
nParams = paramsBitMap->nParams;
FOR (index = 0; index < nArrayLength; index++)
@@ -211,7 +248,7 @@ void WriteToBitstream(ParamsBitMap const * paramsBitMap, Word16 nArrayLength, Wo
move16();
EncodeValue = &FixedWidthEncoding;
}
- value = PutIntoBitstream(pStream, EncodeValue, index, st, nBits);
+ value = PutIntoBitstream(pStream, EncodeValue, index, hBstr, nBits);
if (fShiftValue)
{
value = add(value, 1);
@@ -224,14 +261,20 @@ void WriteToBitstream(ParamsBitMap const * paramsBitMap, Word16 nArrayLength, Wo
IF ((param->pSubParamBitMap != NULL) && (value > 0))
{
- WriteToBitstream(param->pSubParamBitMap, value, pStream, pnSize, st, pnBits);
+ WriteToBitstream(param->pSubParamBitMap, value, pStream, pnSize, hBstr, pnBits);
}
}
}
}
-void ReadFromBitstream(ParamsBitMap const * paramsBitMap, Word16 nArrayLength, Decoder_State_fx *st, Word16 ** pStream, Word16 * pnSize)
+void ReadFromBitstream(
+ ParamsBitMap const * paramsBitMap,
+ const Word16 nArrayLength,
+ Decoder_State_fx *st,
+ Word16 ** pStream,
+ Word16 * pnSize
+)
{
Word16 index;
Word16 iParam, nParams;
diff --git a/lib_com/phase_dispersion.c b/lib_com/phase_dispersion.c
index f2a5f67e91703f85fcbe39b2b32684d266d71b27..10e5fd593f04b07a5c7b765a79d4c48de03189ed 100644
--- a/lib_com/phase_dispersion.c
+++ b/lib_com/phase_dispersion.c
@@ -2,12 +2,10 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
-#include
+#include
#include "options.h" /* EV-VBR compilation switches */
#include "prot_fx.h"
#include "basop_util.h"
-#include "stl.h" /* Weighted mops computation related code */
/*-----------------------------------------------------------------------*
* phase_dispersion:
diff --git a/lib_com/ppp_fx.c b/lib_com/ppp_fx.c
index 21d6b01d9ae6822bfd2c7c0fa171d4e0619dba4d..0e0303925785b0f6a7336c1f2b58485a55466c3a 100644
--- a/lib_com/ppp_fx.c
+++ b/lib_com/ppp_fx.c
@@ -2,10 +2,10 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h"
#include "cnst_fx.h"
#include "prot_fx.h"
-#include "stl.h"
/*===================================================================*/
/* FUNCTION : Interpol_delay_fx () */
@@ -55,12 +55,11 @@ void Interpol_delay_fx(Word16 *out_fx, Word16 last_fx, Word16 current_fx,
*--------------------------------------------------------------------*/
void deemph_lpc_fx(
- Word16 *p_Aq_curr_fx, /* i : LP coefficients current frame */
- Word16 *p_Aq_old_fx, /* i : LP coefficients previous frame */
- Word16 *LPC_de_curr_fx, /* o : De-emphasized LP coefficients current frame in Q12 */
- Word16 *LPC_de_old_fx, /* o : De-emphasized LP coefficients previous frame in Q12 */
- Word16 deemph_old
-
+ const Word16 *p_Aq_curr_fx, /* i : LP coefficients current frame */
+ const Word16 *p_Aq_old_fx, /* i : LP coefficients previous frame */
+ Word16 *LPC_de_curr_fx, /* o : De-emphasized LP coefficients current frame in Q12 */
+ Word16 *LPC_de_old_fx, /* o : De-emphasized LP coefficients previous frame in Q12 */
+ const Word16 deemph_old
)
{
Word16 k,temp;
diff --git a/lib_com/pred_lt4_fx.c b/lib_com/pred_lt4_fx.c
index 88f32da625018369f7cab02004d2b38edaf528cc..80c89f13b76fa583a2f504cafc41a3228f47960a 100644
--- a/lib_com/pred_lt4_fx.c
+++ b/lib_com/pred_lt4_fx.c
@@ -2,12 +2,11 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "rom_com_fx.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h"
/*-------------------------------------------------------------------*
@@ -23,14 +22,13 @@
void pred_lt4(
const Word16 excI[], /* in : excitation buffer */
- Word16 excO[], /* out: excitation buffer */
- Word16 T0, /* input : integer pitch lag */
- Word16 frac, /* input : fraction of lag */
- Word16 L_subfr, /* input : subframe size */
+ Word16 excO[], /* out: excitation buffer */
+ const Word16 T0, /* input : integer pitch lag */
+ Word16 frac, /* input : fraction of lag */
+ const Word16 L_subfr, /* input : subframe size */
const Word16 *win, /* i : interpolation window */
const Word16 nb_coef, /* i : nb of filter coef */
const Word16 up_sample /* i : up_sample */
-
)
{
Word16 i, j;
@@ -104,9 +102,9 @@ void pred_lt4(
/* NONE */
/*=======================================================================*/
void pred_lt4_tc_fx(
- Word16 exc[], /* i/o: excitation buffer */
+ Word16 exc[], /* i/o: excitation buffer */
const Word16 T0, /* i : integer pitch lag */
- Word16 frac, /* i: fraction of lag */
+ Word16 frac, /* i: fraction of lag */
const Word16 *win, /* i : interpolation window */
const Word16 imp_pos, /* i : glottal impulse position */
const Word16 i_subfr /* i : subframe index */
diff --git a/lib_com/preemph_fx.c b/lib_com/preemph_fx.c
index b667eeca159b8cbdae843feef33730deec414d95..efb7fbbdc850293c6da9828f1430265e658ebd11 100644
--- a/lib_com/preemph_fx.c
+++ b/lib_com/preemph_fx.c
@@ -1,10 +1,9 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h"
/*-------------------------------------------------------------*
* preemph_copy_fx()
@@ -13,10 +12,10 @@
*-------------------------------------------------------------*/
void preemph_copy_fx(
const Word16 x[], /* i : input signal Qx */
- Word16 y[], /* o : output signal Qx */
+ Word16 y[], /* o : output signal Qx */
const Word16 mu, /* i : preemphasis coefficient Q15 */
const Word16 lg, /* i : vector size Q0 */
- Word16 *mem /* i/o: memory (x[-1]) Qx */
+ Word16 *mem /* i/o: memory (x[-1]) Qx */
)
{
Word16 i, temp;
diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h
index ef9867907d52fa96a83ffb9f28e3d5dd9a365105..5f00004fb4485adad5c6f4e9f6c0d223ae8d0e8e 100644
--- a/lib_com/prot_fx.h
+++ b/lib_com/prot_fx.h
@@ -10,17 +10,59 @@
#include "typedefs.h"
#include "stat_dec_fx.h"
#include "stat_enc_fx.h"
+#include "ivas_stat_enc.h"
#include "stat_com.h"
#include "cnst_fx.h"
#include "basop_util.h"
#include "complex_basop.h"
+#include "ivas_error_utils.h"
+#ifdef RAM_COUNTING_TOOL
+#include "mem_count.h"
+#endif
/*----------------------------------------------------------------------------------*
* Prototypes of global macros
*----------------------------------------------------------------------------------*/
+ /*----------------------------------------------------------------------------------*
+ * Prototypes of RAM counting tool macros
+ *----------------------------------------------------------------------------------*/
+
+#ifdef RAM_COUNTING_TOOL
+#define count_malloc( n1 ) MALLOC_FCT_CALL( n1 )
+#define count_calloc( n1, n2 ) CALLOC_FCT_CALL( n1, n2 )
+#define count_free( ptr ) FREE_FCT_CALL( ptr )
+#else
+#define count_malloc( n1 ) malloc( n1 )
+#define count_calloc( n1, n2 ) calloc( n1, n2 )
+#define count_free( ptr ) free( ptr )
+#endif
-void reset_preecho_dec_fx (
- Decoder_State_fx *st_fx /* i/o: decoder state structure */
-);
+#define dynamic_malloc( n1 ) malloc( n1 )
+#define dynamic_calloc( n1, n2 ) calloc( n1, n2 )
+#define dynamic_free( n1 ) free( n1 )
+
+void reset_preecho_dec_fx(
+ HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */
+);
+/*IVAS_CNST_AND_ROM*/
+#ifndef SWAP
+#define SWAP( a, b ) \
+ { \
+ tempr = ( a ); \
+ ( a ) = ( b ); \
+ ( b ) = tempr; \
+ }
+#endif
+
+#ifndef swap
+#define swap( x, y, type ) \
+ { \
+ type u__p; \
+ u__p = x; \
+ x = y; \
+ y = u__p; \
+ }
+#endif
+/*End of IVAS_CNST_AND_ROM*/
void preecho_sb_fx(
const Word32 brate, /* i Q0 : core bit-rate */
@@ -42,8 +84,8 @@ void preecho_sb_fx(
void calc_normal_length_fx_32(
const Word16 core, /* i : core : Q0 */
- const Word32 *sp, /* i : input signal : Q12 */
- const Word16 mode, /* i : input mode : Q0 */
+ const Word32 *sp, /* i : i signal : Q12 */
+ const Word16 mode, /* i : i mode : Q0 */
const Word16 extl, /* i : extension layer : Q0 */
Word16 *L_swb_norm, /* o : normalize length : Q0 */
Word16 *prev_L_swb_norm /*i/o : last normalize length : Q0 */
@@ -53,42 +95,43 @@ void calc_norm_envelop_fx_32(
const Word32 SWB_signal_fx[], /* i : SWB spectrum : Q12 */
Word32 *envelope_fx, /* o : normalized envelope : Q16 */
const Word16 L_swb_norm, /* i : length of envelope : Q0 */
- const Word16 SWB_flength, /* i : Length of input/output : Q0 */
+ const Word16 SWB_flength, /* i : Length of i /output : Q0 */
const Word16 st_offset /* i : offset : Q0 */
);
void push_indice_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- Word16 id, /* i : ID of the indice */
- UWord16 value, /* i : value of the quantized indice */
- Word16 nb_bits /* i : number of bits used to quantize the indice */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 id, /* i : ID of the indice */
+ UWord16 value, /* i : value of the quantized indice */
+ Word16 nb_bits /* i : number of bits used to quantize the indice */
);
void push_next_indice_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- UWord16 value, /* i : value of the quantized indice */
- Word16 nb_bits /* i : number of bits used to quantize the indice */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ UWord16 value, /* i : value of the quantized indice */
+ Word16 nb_bits /* i : number of bits used to quantize the indice */
);
void push_next_bits_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- Word16 bits[], /* i : bit buffer to pack, sequence of single bits */
- Word16 nb_bits /* i : number of bits to pack */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 bits[], /* i : bit buffer to pack, sequence of single bits */
+ Word16 nb_bits /* i : number of bits to pack */
);
void get_NextCoderType_fx(
UWord8 *bitsteam, /* i : bitstream */
Word16 *next_coder_type /* o : next coder type */
);
-void evs_enc_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word16 input_sp[], /* i : input signal */
- const Word16 n_samples /* i : number of input samples */
+ivas_error evs_enc_fx(
+ Encoder_State_fx* st, /* i/o: encoder state structure */
+ const Word16* data, /* i : i signal */
+ Word32* mem_hp20_in_fx, /* i/o: hp20 filter memory */
+ const Word16 n_samples /* i : number of i samples */
);
void io_ini_enc_fx(
const int argc, /* i : command line arguments number */
char *argv[], /* i : command line arguments */
- FILE **f_input, /* o : input signal file */
+ FILE **f_input, /* o : i signal file */
FILE **f_stream, /* o : output bitstream file */
FILE **f_rate, /* o : bitrate switching profile (0 if N/A) */
FILE **f_bwidth, /* o : bandwidth switching profile (0 if N/A) */
@@ -108,7 +151,7 @@ void read_next_brate_fx(
Word32 *total_brate, /* i/o: total bitrate */
const Word32 last_total_brate, /* i : last total bitrate */
FILE *f_rate, /* i : bitrate switching profile (0 if N/A) */
- Word32 input_Fs, /* i : input sampling frequency */
+ Word32 input_Fs, /* i : i sampling frequency */
Word16 *Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
Word16 *Opt_SC_VBR, /* i/o: SC-VBR flag */
Word16 *codec_mode /* i/o: MODE1 or MODE2 */
@@ -119,7 +162,7 @@ void read_next_bwidth_fx(
Word16 *max_bwidth, /* i/o: maximum encoded bandwidth */
FILE *f_bwidth, /* i : bandwidth switching profile (0 if N/A) */
Word32 *bwidth_profile_cnt, /* i/o: counter of frames for bandwidth switching profile file */
- Word32 input_Fs /* i : input sampling frequency */
+ Word32 input_Fs /* i : i sampling frequency */
);
UWord16 get_next_indice_fx( /* o : value of the indice */
@@ -149,7 +192,7 @@ UWord16 get_indice_1_fx( /* o : value of the indice */
);
void reset_indices_enc_fx(
- Encoder_State_fx *st_fx /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr /* i/o: encoder state structure */
);
@@ -158,12 +201,16 @@ void reset_indices_dec_fx(
);
void write_indices_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- FILE *file /* i : output bitstream file */
- , UWord8 *pFrame, /* i: byte array with bit packet and byte aligned coded speech data */
+ Encoder_State_fx* st_fx, /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */
+ FILE* file /* i : output bitstream file */
+ , UWord8* pFrame, /* i: byte array with bit packet and byte aligned coded speech data */
Word16 pFrame_size /* i: size of the binary encoded access unit [bits] */
);
-
+Word16 rate2EVSmode(
+ const Word32 brate, /* i : bitrate */
+ Word16* is_amr_wb /* o : (flag) does the bitrate belong to AMR-WB? Can be NULL */
+);
Word16 read_indices_fx( /* o : 1 = OK, 0 = something wrong */
Decoder_State_fx *st_fx, /* i/o: decoder state structure */
FILE *file, /* i : bitstream file */
@@ -177,9 +224,10 @@ Word16 read_indices_mime( /* o : 1 = reading OK, 0 = problem
);
void indices_to_serial(
- const Encoder_State_fx *st_fx, /* i: encoder state structure */
- UWord8 *pFrame, /* o: byte array with bit packet and byte aligned coded speech data */
- Word16 *pFrame_size /* i: size of the binary encoded access unit [bits] */
+ const Encoder_State_fx* st_fx, /* i: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */
+ UWord8* pFrame, /* o: byte array with bit packet and byte aligned coded speech data */
+ Word16* pFrame_size /* o: size of the binary encoded access unit [bits] */
);
void indices_to_serial_generic(
@@ -239,7 +287,9 @@ void get_rfTargetBits(
Word16 *rf_target_bits /* o : Number of RF target bits */
);
-
+Word16 get_codec_mode(
+ const Word32 total_brate /* i : total bitrate */
+);
Word16 BRATE2IDX_fx(Word32 brate);
Word16 BRATE2IDX16k_fx(Word32 brate);
@@ -255,7 +305,7 @@ void save_old_syn_fx(
Word16 *mem_deemph /* i/o: deemphasis filter memory */
);
-void evs_dec_fx(
+ivas_error evs_dec_fx(
Decoder_State_fx *st_fx, /* i/o : Decoder state structure */
Word16 output_sp[], /* o : output synthesis signal */
frameMode_fx frameMode /* i : Decoder frame mode */
@@ -276,7 +326,7 @@ Word16 decodeVoip(
void io_ini_dec_fx(
const int argc, /* i : command line arguments number */
char *argv[], /* i : command line arguments */
- FILE **f_stream, /* o : input bitstream file */
+ FILE **f_stream, /* o : i bitstream file */
FILE **f_synth, /* o : output synthesis file */
Word16 *quietMode, /* o : limited printouts */
Word16 *noDelayCmp, /* o : turn off delay compensation */
@@ -297,17 +347,18 @@ Word16 deindex_lvq_cng_fx(
);
void CNG_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: State structure */
- const Word16 L_frame, /* i : length of the frame Q0 */
- Word16 Aq[], /* o : LP coefficients Q12 */
- const Word32 core_brate, /* i : core bitrate Q0 */
- Word16 *lsp_new, /* i/o: current frame LSPs Q15 */
- Word16 *lsf_new, /* i/o: current frame LSFs Qlog2(2.56) */
- Word16 *allow_cn_step /* o : allow CN step Q0 */
- ,Word16 *sid_bw /* o : 0-NB/WB, 1-SWB SID */
- ,Word32 *q_env
+ Decoder_State_fx* st_fx, /* i/o: State structure */
+ const Word16 last_element_mode, /* i : last element mode Q0 */
+ Word16 Aq[], /* o : LP coefficients Q12 */
+ Word16* lsp_new, /* i/o: current frame LSPs Q15 */
+ Word16* lsf_new, /* i/o: current frame LSFs Qlog2(2.56) */
+ Word16* allow_cn_step, /* o : allow CN step Q0 */
+ Word16* sid_bw /* i : 0-NB/WB, 1-SWB SID */
+ , Word32* q_env
+);
+void td_cng_dec_init(
+ DEC_CORE_HANDLE st /* i/o: decoder state structure */
);
-
void swb_CNG_dec_fx(
Decoder_State_fx *st_fx, /* i/o: State structure */
const Word16 *synth_fx, /* i : ACELP core synthesis at 32kHz */
@@ -316,14 +367,26 @@ void swb_CNG_dec_fx(
const Word16 Qsyn /* i : Q value of ACELP core synthesis */
);
+void GSC_enc_init(
+ GSC_ENC_HANDLE hGSCEnc /* i/o: GSC data handle */
+);
+
+void HQ_core_enc_init(
+ HQ_ENC_HANDLE hHQ_core /* i/o: HQ core data handle */
+);
+
void CNG_reset_enc_fx(
Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- LPD_state *mem, /* i/o: acelp memories */
+ LPD_state_HANDLE hLPDmemm, /* i/o: acelp memories */
Word16 *pitch_buf, /* o : floating pitch for each subframe */
Word16 *voice_factors /* o : voicing factors */
,Word16 VBR_cng_reset_flag
);
+void speech_music_clas_init(
+ SP_MUS_CLAS_HANDLE hSpMusClas /* i/o: speech/music classifier handle */
+);
+
void CNG_reset_dec_fx(
Decoder_State_fx *st_fx, /* i/o: decoder state structure */
Word16 *pitch_buf, /* o : floating pitch for each subframe */
@@ -331,49 +394,50 @@ void CNG_reset_dec_fx(
);
void CNG_exc_fx(
- const Word32 core_brate, /* i : core bitrate */
- const Word16 L_frame, /* i : length of the frame */
- Word32 *Enew, /* i/o: decoded SID energy Q6 */
- Word16 *seed, /* i/o: random generator seed */
- Word16 exc[], /* o : current non-enhanced excitation Q_new */
- Word16 exc2[], /* o : current enhanced excitation Q_new */
- Word32 *lp_ener, /* i/o: LP filtered E */
- const Word32 last_core_brate, /* i : previous frame core bitrate */
- Word16 *first_CNG, /* i/o: first CNG frame flag for energy init. */
- Word16 *cng_ener_seed, /* i/o: random generator seed for CNG energy */
- Word16 bwe_exc[], /* o : excitation for SWB TBE */
- const Word16 allow_cn_step, /* i : allow CN step */
- Word16 *last_allow_cn_step, /* i/o: last allow step */
- const Word16 OldQ_exc, /* i : Old excitation scaling */
- const Word16 Q_exc, /* i : excitation scaling */
- const Word16 num_ho /* i : number of selected hangover frames */
- ,Word32 q_env[]
- ,Word32 *lp_env
- ,Word32 *old_env
- ,Word16 *exc_mem
- ,Word16 *exc_mem1
- ,Word16 *sid_bw
- ,Word16 *cng_ener_seed1
- ,Word16 exc3[]
- ,Word16 Opt_AMR_WB
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16 L_frame, /* i : length of the frame */
+ Word32* Enew, /* i/o: decoded SID energy Q6 */
+ Word16* seed, /* i/o: random generator seed */
+ Word16 exc[], /* o : current non-enhanced excitation Q_new */
+ Word16 exc2[], /* o : current enhanced excitation Q_new */
+ Word32* lp_ener, /* i/o: LP filtered E */
+ const Word32 last_core_brate,/* i : previous frame core bitrate */
+ Word16* first_CNG, /* i/o: first CNG frame flag for energy init. */
+ Word16* cng_ener_seed, /* i/o: random generator seed for CNG energy */
+ Word16 bwe_exc[], /* o : excitation for SWB TBE */
+ const Word16 allow_cn_step, /* i : allow CN step */
+ Word16* last_allow_cn_step, /* i/o: last allow step */
+ const Word16 OldQ_exc, /* i : Old excitation scaling */
+ const Word16 Q_exc, /* i : excitation scaling */
+ const Word16 num_ho, /* i : number of selected hangover frames */
+ Word32 q_env[],
+ Word32* lp_env,
+ Word32* old_env,
+ Word16* exc_mem,
+ Word16* exc_mem1,
+ Word16* sid_bw,
+ Word16* cng_ener_seed1,
+ Word16 exc3[],
+ Word16 Opt_AMR_WB,
+ const Word16 element_mode /* i : IVAS Element mode */
+);
+Word16 get_cng_mode(
+ const Word32 last_active_brate /* i : last active bitrate */
);
void CNG_enc_fx(
- Encoder_State_fx *st_fx, /* i/o: State structure */
- const Word16 L_frame, /* i : length of the frame Q0 */
- Word16 Aq[], /* o : LP coefficients Q12 */
- const Word16 *speech, /* i : pointer to current frame input speech buffer Q_new */
- Word32 L_enr, /* i : residual energy from Levinson-Durbin Q6 */
- Word16 *lsp_new, /* i/o: current frame ISPs Q15 */
- Word16 *lsf_new, /* i/o: current frame ISFs Qlog2(2.56) */
- Word16 *allow_cn_step, /* o : allow CN step Q0 */
- Word16 burst_ho_cnt, /* i : hangover frames at end of speech burst Q0 */
- Word16 Q_new /* i : Q value of speech */
- ,Word32 *q_env
- ,Word16 *sid_bw
- ,Word16 *exc_mem2
+ Encoder_State_fx* st_fx,/* i/o: State structure */
+ Word16 Aq[], /* o : LP coefficients Q12 */
+ const Word16* speech, /* i : pointer to current frame i speech buffer Q_new */
+ Word32 L_enr, /* i : residual energy from Levinson-Durbin Q6 */
+ const Word16* lsp_mid, /* i : mid frame LSPs Q15 */
+ Word16* lsp_new, /* i/o: current frame ISPs Q15 */
+ Word16* lsf_new, /* i/o: current frame ISFs Qlog2(2.56) */
+ Word16* allow_cn_step, /* o : allow CN step Q0 */
+ Word16 Q_new, /* i : Q value of speech */
+ Word32* q_env,
+ Word16* sid_bw
);
-
void swb_CNG_enc_fx(
Encoder_State_fx *st_fx, /* i/o: State structure */
const Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz */
@@ -406,16 +470,20 @@ void cng_params_postupd_fx(
const Word32 *const cng_brate_buf, /* i : bit rate buffer Q0 */
Word32 ho_env_circ[] /* i/o: Envelope buffer */
);
-Word32 get_delay_fx( /* o : delay value in ms */
- const Word16 what_delay, /* i : what delay? (ENC or DEC) */
- const Word32 io_fs /* i : input/output sampling frequency */
+Word32 get_delay_fx( /* o : delay value in ms */
+ const Word16 what_delay, /* i : what delay? (ENC or DEC) */
+ const Word32 io_fs, /* i : input/output sampling frequency */
+ const IVAS_FORMAT ivas_format, /* i : IVAS format */
+ HANDLE_CLDFB_FILTER_BANK hCldfb /* i : Handle of Cldfb analysis */
+#ifdef SPLIT_REND_WITH_HEAD_ROT
+ ,
+ const AUDIO_CONFIG output_config /* i : decoder output config */
+#endif
);
void signalling_enc_fx(
- Encoder_State_fx *st_fx, /* i : encoder state structure */
- const Word16 coder_type, /* i : coder type */
- const Word16 sharpFlag /* i : formant sharpening flag */
+ Encoder_State_fx *st_fx /* i : encoder state structure */
);
Word16 signalling_mode1_tcx20_enc(
@@ -433,16 +501,11 @@ void decision_matrix_core_dec(
void decision_matrix_enc_fx(
Encoder_State_fx *st_fx, /* i : encoder state structure */
- const Word16 sp_aud_decision1, /* i : 1st stage speech/music classification */
- const Word16 sp_aud_decision2, /* i : 2nd stage speech/music classification */
- const Word16 coder_type, /* i : coder type */
- const Word16 vad_flag,
Word16 *hq_core_type /* o : HQ core_fx type */
);
void decision_matrix_dec_fx(
Decoder_State_fx *st, /* i/o: decoder state structure */
- Word16 *coder_type, /* o : coder type */
Word16 *sharpFlag, /* o : formant sharpening flag */
Word16 *hq_core_type, /* o : HQ core type */
Word16 *core_switching_flag /* o : ACELP->HQ switching frame flag */
@@ -453,10 +516,11 @@ void init_gp_clip_fx(
);
void gp_clip_test_isf_fx(
- const Word32 core_brate, /* i : core bitrate */
- const Word16 isf[], /* i : isf values (in frequency domain) */
- Word16 mem[], /* i/o: memory of gain of pitch clipping algorithm */
- const Word16 Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */
+ const Word16 element_mode, /* i : element mode */
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16 isf[], /* i : isf values (in frequency domain) */
+ Word16 mem[], /* i/o: memory of gain of pitch clipping algorithm */
+ const Word16 Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */
);
void pitch_ol_init_fx(
@@ -467,7 +531,7 @@ void pitch_ol_init_fx(
);
void noise_est_down_fx(
- const Word32 fr_bands[], /* i : per band input energy (contains 2 vectors) */
+ const Word32 fr_bands[], /* i : per band i energy (contains 2 vectors) */
Word32 bckr[], /* i/o: per band background noise energy estimate */
Word32 tmpN[], /* o : temporary noise update */
Word32 enr[], /* o : averaged energy over both subframes */
@@ -482,37 +546,23 @@ void noise_est_down_fx(
);
void wb_vad_init_fx(
- Word16 *nb_active_frames, /* o : nb of consecutive active speech frames */
- Word16 *hangover_cnt,
- Word16 *lp_speech, /* o : long-term active speech level */
- Word16 *nb_active_frames_he, /* o : nb of consecutive active speech frames */
- Word16 *hangover_cnt_he,
- Word16 *bcg_flux, /* o : background noise fluctuation */
- Word16 *soft_hangover, /* o : soft hangover counter */
- Word16 *voiced_burst, /* o : consecutive voiced speech counter */
- Word16 *bcg_flux_init, /* o : initialization period for noise fluctuation estimation */
- Word16 *nb_active_frames_he1, /* o : nb of consecutive active speech frames 1 */
- Word16 *hangover_cnt_he1,
- Word32 *L_vad_flag_reg_H,
- Word32 *L_vad_flag_reg_L,
- Word32 *L_vad_prim_reg,
- Word16 *vad_flag_cnt_50,
- Word16 *vad_prim_cnt_16,
- Word16 *hangover_cnt_dtx,
- Word16 *hangover_cnt_music
+ VAD_HANDLE hVAD /* i/o: VAD data handle */
);
Word16 wb_vad_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word32 fr_bands[], /* i : per band input energy (contains 2 vectors) Q_new+QSCALE*/
- Word16 *localVAD,
- Word16 *noisy_speech_HO, /* o : SC-VBR noisy speech HO flag */
- Word16 *clean_speech_HO, /* o : SC-VBR clean speech HO flag */
- Word16 *NB_speech_HO, /* o : SC-VBR NB speech HO flag */
- Word16 *snr_sum_he, /* o : Output snr_sum as weighted spectral measure */
- Word16 *localVAD_HE_SAD, /* o : HE_SAD decision without hangovers */
- Word8 *flag_noisy_speech_snr, /* o : */
- const Word16 Q_new /* i : scaling factor Q0 */
+ Encoder_State_fx* st_fx, /* i/o: encoder state structure */
+ const Word32 fr_bands[], /* i : per band i energy (contains 2 vectors) Q_new+QSCALE*/
+ Word16* noisy_speech_HO, /* o : SC-VBR noisy speech HO flag */
+ Word16* clean_speech_HO, /* o : SC-VBR clean speech HO flag */
+ Word16* NB_speech_HO, /* o : SC-VBR NB speech HO flag */
+ Word16* snr_sum_he, /* o : Output snr_sum as weighted spectral measure*/
+ Word16* localVAD_HE_SAD,
+ Word8* flag_noisy_speech_snr, /* o : */
+ const Word16 Q_new, /* i : scaling factor Q0 */
+ VAD_HANDLE hVAD, /* i/o: VAD data handle */
+ NOISE_EST_HANDLE hNoiseEst, /* i : Noise estimation handle */
+ Word16 lp_speech, /* i : long term active speech energy average */
+ Word16 lp_noise /* i : long term noise energy */
);
@@ -530,46 +580,36 @@ void dtx_hangover_control_fx(
);
Word16 dtx_hangover_addition_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word16 localVAD, /* i Q0 */
- const Word16 vad_flag, /* i Q0 */
- const Word16 lp_snr, /* i Q8 */
- const Word16 cldfb_subtraction, /* i Q0 */
- Word16 *vad_hover_flag_ptr
+ Encoder_State_fx* st_fx, /* i/o: encoder state structure */
+ const Word16 vad_flag, /* i Q0 */
+ const Word16 lp_snr, /* i Q8 */
+ const Word16 cldfb_subtraction, /* i Q0 number of DTX-HO frames CLDFB wants to reduce */
+ Word16* vad_hover_flag_ptr,
+ VAD_HANDLE hVAD, /* i/o: VAD data handle */
+ NOISE_EST_HANDLE hNoiseEst /* i : Noise estimation handle */
+);
+void td_cng_enc_init(
+ TD_CNG_ENC_HANDLE hTdCngEnc, /* i/o: DTX/TD CNG data handle */
+ const Word16 Opt_DTX_ON, /* i : flag indicating DTX operation */
+ const Word16 max_bwidth /* i : maximum encoded bandwidth */
);
+void dtx_enc_init(
+ Encoder_State_fx* st, /* i : Encoder state handle */
+ const Word16 var_SID_rate_flag, /* i : flag for variable SID update rate */
+ const Word16 interval_SID /* i : interval for SID update */
+);
void noise_est_init_fx(
- Word16 *totalNoise, /* o : noise estimate over all critical bands */
- Word16 *first_noise_updt, /* o : noise update initialization flag */
- Word32 bckr[], /* o : per band background noise energy estimate */
- Word32 enrO[], /* o : per band old input energy */
- Word32 ave_enr[], /* o : per band long-term average energies */
- Word16 *pitO, /* o : open-loop pitch values from preceed. frame */
- Word16 *aEn, /* o : noise adaptation hangover counter */
- Word16 *st_harm_cor_cnt, /* i/o: 1st harm correlation timer */
- Word16 *bg_cnt, /* i/o: pause burst length counter */
- Word16 *lt_tn_track, /* Q15 */
- Word16 *lt_tn_dist, /* Q8 */
- Word16 *lt_Ellp_dist, /* Etot low lp same domain as *Etot_l_lp, Q8 */
- Word16 *lt_haco_ev, /* Q15 */
- Word16 *low_tn_track_cnt /* Q0 */
- ,Word16 *Etot_st_est, /* Q8: Short term Etot Estimate for variance calc */
- Word16 *Etot_sq_st_est /* Q2 : Short term Etot^2 Estimate for variance calc */
-
+ NOISE_EST_HANDLE hNoiseEst /* i/o: Noise estimation handle */
);
-
-
void noise_est_pre_fx(
const Word16 Etot, /* i : Energy of current frame */
const Word16 ini_frame_fx, /* i : Frame number (init) */
- Word16 *Etot_l, /* i/o: Track energy from below */ /*Q8 */
- Word16 *Etot_h, /* i/o: Track energy from above */ /*Q8 */
- Word16 *Etot_l_lp, /* i/o: Smoothed low energy */ /*Q8 */
- Word16 *Etot_last, /* i/o: Energy of last frame */ /*Q8 */
- Word16 *Etot_v_h2, /* i/o: Energy variations */ /*Q8*/
- Word16 *sign_dyn_lp, /* i/o: Smoother signal dynamics */ /*Q8*/
- Word16 harm_cor_cnt, /* i : correlation counter */
- Word16 *Etot_lp /* i/o: Smoothed energy */
+ NOISE_EST_HANDLE hNoiseEst, /* i/o: Noise estimation handle */
+ const Word16 idchan, /* i : channel ID */
+ const Word16 element_mode, /* i : element mode */
+ const Word16 last_element_mode /* i : last element mode */
+
);
void Preemph_scaled(
@@ -613,13 +653,14 @@ void Scale_mem_enc(
);
void SetModeIndex(
- Encoder_State_fx *st,
- Word32 total_brate,
- Word16 bwidth,
+ Encoder_State_fx* st,
+ Word32 last_total_brate,
+ const Word16 last_element_mode,
+ const Word16 is_mct,
const Word16 shift
);
-void init_encoder_fx(
+ivas_error init_encoder_fx(
Encoder_State_fx *st_fx /* i/o: Encoder static variables structure */
);
@@ -637,25 +678,27 @@ void analysisCldfbEncoder_fx(
CLDFB_SCALE_FACTOR * scale
);
-void cldfb_save_memory (HANDLE_CLDFB_FILTER_BANK hs); /* i/o: cldfb handle */
+ivas_error cldfb_save_memory (HANDLE_CLDFB_FILTER_BANK hs); /* i/o: cldfb handle */
void cldfb_restore_memory (HANDLE_CLDFB_FILTER_BANK hs); /* i/o: cldfb handle */
void cldfb_reset_memory (HANDLE_CLDFB_FILTER_BANK hs); /* i/o: cldfb handle */
Word16 gp_clip_fx(
- const Word32 core_brate, /* i : core bitrate */
- const Word16 *voicing, /* i : normalized correlations (from OL pitch) */
- const Word16 i_subfr, /* i : subframe index */
- const Word16 coder_type, /* i : type of coder */
- const Word16 xn[], /* i : target vector */
+ const Word16 element_mode, /* i : element mode */
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16* voicing, /* i : normalized correlations (from OL pitch) */
+ const Word16 i_subfr, /* i : subframe index */
+ const Word16 coder_type, /* i : type of coder */
+ const Word16 xn[], /* i : target vector */
Word16 mem[], /* i/o: memory of gain of pitch clipping algorithm */
- const Word16 Q_new /* i : scaling factor */
+ const Word16 Q_new /* i : scaling factor */
);
-void init_decoder_fx(
- Decoder_State_fx *st_fx /* o: Decoder static variables structure */
+ivas_error init_decoder_fx(
+ Decoder_State_fx *st_fx, /* o: Decoder static variables structure */
+ const Word16 idchan /* i : channel ID */
);
-void destroy_decoder(
+void destroy_cldfb_decoder(
Decoder_State_fx *st_fx /* o: Decoder static variables structure */
);
Word16 Enr_1_Az_fx( /* o : impulse response energy Q3 */
@@ -663,54 +706,57 @@ Word16 Enr_1_Az_fx( /* o : impulse response energy Q3 */
const Word16 len /* i : impulse response length Q0 */
);
void FEC_scale_syn_fx(
- const Word16 L_frame, /* i : length of the frame */
- Word16 *update_flg, /* o: flag indicating re-synthesis after scaling*/
- Word16 clas, /* i/o: frame classification */
- const Word16 last_good, /* i: last good frame classification */
- Word16 *synth, /* i/o: synthesized speech at Fs = 12k8 Hz */
- const Word16 *pitch, /* i: pitch values for each subframe */
- Word32 L_enr_old, /* i: energy at the end of previous frame */
- Word32 L_enr_q, /* i: transmitted energy for current frame */
- const Word16 coder_type, /* i: coder type */
- const Word16 LSF_Q_prediction, /* i : LSF prediction mode */
- Word16 *scaling_flag, /* i/o: flag to indicate energy control of syn */
- Word32 *lp_ener_FEC_av, /* i/o: averaged voiced signal energy */
- Word32 *lp_ener_FEC_max, /* i/o: averaged voiced signal energy */
- const Word16 bfi, /* i: current frame BFI */
- const Word32 total_brate, /* i: total bitrate */
- const Word16 prev_bfi, /* i: previous frame BFI */
- const Word32 last_core_brate, /* i: previous frame core bitrate */
- Word16 *exc, /* i/o: excitation signal without enhancement */
- Word16 *exc2, /* i/o: excitation signal with enhancement */
- Word16 Aq[], /* i/o: LP filter coefs (can be modified if BR) */
- Word16 *old_enr_LP, /* i/o: LP filter E of last good voiced frame */
- const Word16 *mem_tmp, /* i: temp. initial synthesis filter states */
- Word16 *mem_syn, /* o: initial synthesis filter states */
+ const Word16 L_frame, /* i : length of the frame */
+ Word16* update_flg, /* o: flag indicating re-synthesis after scaling*/
+ Word16 clas, /* i/o: frame classification */
+ const Word16 last_good, /* i: last good frame classification */
+ Word16* synth, /* i/o: synthesized speech at Fs = 12k8 Hz */
+ const Word16* pitch, /* i: pitch values for each subframe */
+ Word32 L_enr_old, /* i: energy at the end of previous frame */
+ Word32 L_enr_q, /* i: transmitted energy for current frame */
+ const Word16 coder_type, /* i: coder type */
+ const Word16 LSF_Q_prediction, /* i : LSF prediction mode */
+ Word16* scaling_flag, /* i/o: flag to indicate energy control of syn */
+ Word32* lp_ener_FEC_av, /* i/o: averaged voiced signal energy */
+ Word32* lp_ener_FEC_max, /* i/o: averaged voiced signal energy */
+ const Word16 bfi, /* i: current frame BFI */
+ const Word32 total_brate, /* i: total bitrate */
+ const Word16 prev_bfi, /* i: previous frame BFI */
+ const Word32 last_core_brate, /* i: previous frame core bitrate */
+ Word16* exc, /* i/o: excitation signal without enhancement */
+ Word16* exc2, /* i/o: excitation signal with enhancement */
+ Word16 Aq[], /* i/o: LP filter coefs (can be modified if BR) */
+ Word16* old_enr_LP, /* i/o: LP filter E of last good voiced frame */
+ const Word16* mem_tmp, /* i: temp. initial synthesis filter states */
+ Word16* mem_syn, /* o: initial synthesis filter states */
Word16 Q_exc,
- Word16 Q_syn
- , Word16 avoid_lpc_burst_on_recovery /* i : if true the excitation energy is limited if LP has big gain */
- , Word16 force_scaling /* i: force scaling */
+ Word16 Q_syn,
+ const Word16 avoid_lpc_burst_on_recovery, /* i : if true the excitation energy is limited if LP has big gain */
+ const Word16 force_scaling /* i: force scaling */
);
void improv_amr_wb_gs_fx(
- const Word16 clas, /* i : signal frame class */
- const Word16 coder_type, /* i : coder type */
- const Word32 core_brate, /* i : bitrate allocated to the core */
- Word16 *seed_tcx, /* i/o: Seed used for noise generation */
- Word16 *old_Aq_fx, /* i/o: old LPC filter coefficient */
- Word16 *mem_syn2_fx, /* i/o: synthesis memory */
- const Word16 lt_voice_fac_fx, /* i/o: long term voice factor Q15 */
- const Word16 locattack, /* i : Flag for a detected attack */
- Word16 *Aq_fx, /* i/o: Decoded LP filter coefficient */
- Word16 *exc2_fx, /* i/o: Decoded complete excitation */
- const Word16 Q_exc2, /* i : Exponent of Exc2 */
- Word16 *mem_tmp_fx, /* i/o: synthesis temporary memory */
- Word16 *syn_fx, /* o: Decoded synthesis to be updated */
- const Word16 Q_syn, /* i : Synthesis scaling Q0 */
- const Word16 *pitch_buf_fx, /* i : Decoded pitch buffer */
- const Word16 Last_ener_fx, /* i : Last energy (Q8) */
- const Word16 rate_switching_reset, /* i : rate switching reset flag */
- const Word16 last_coder_type_fx /* i : Last coder_type */
+ const Word16 clas, /* i : signal frame class */
+ const Word16 coder_type, /* i : coder type */
+ const Word32 core_brate, /* i : bitrate allocated to the core */
+ Word16 *seed_tcx, /* i/o: Seed used for noise generation */
+ Word16 *old_Aq_fx, /* i/o: old LPC filter coefficient */
+ Word16 *mem_syn2_fx, /* i/o: synthesis memory */
+ const Word16 lt_voice_fac_fx, /* i/o: long term voice factor Q15 */
+ const Word16 locattack, /* i : Flag for a detected attack */
+ Word16 *Aq_fx, /* i/o: Decoded LP filter coefficient */
+ Word16 *exc2_fx, /* i/o: Decoded complete excitation */
+ const Word16 Q_exc2, /* i : Exponent of Exc2 */
+ Word16 *mem_tmp_fx, /* i/o: synthesis temporary memory */
+ Word16 *syn_fx, /* o: Decoded synthesis to be updated */
+ const Word16 Q_syn, /* i : Synthesis scaling Q0 */
+ const Word16 *pitch_buf_fx, /* i : Decoded pitch buffer */
+ const Word16 Last_ener_fx, /* i : Last energy (Q8) */
+ const Word16 rate_switching_reset, /* i : rate switching reset flag */
+ const Word16 last_coder_type_fx /* i : Last coder_type */
+#ifdef ADD_IVAS_GS_DEC_IMPR
+ ,const Word16 VeryLowRateSTflag /* i : Enable the noise enhancement for very low rate stereo generic mode */
+#endif
);
void FEC_pitch_estim_fx(
@@ -734,21 +780,19 @@ Word16 div_s_ss( /* o: result of division (Word16 Q0)
Word16 detect_transient_fx(
const Word16 *in_fx, /*Q_new */
- /*Encoder_State *st, */
const Word16 L,
- const Word16 coder_type, /* i : coder type */
Word16 Q_new,
Encoder_State_fx *st_fx
);
Word16 detect_transient_fx32( /* o : transient flag */
- const Word32* in_fx, /* i : input signal */
+ const Word32* in_fx, /* i : i signal */
Encoder_State_fx *st_fx, /* i/o: Encoder state structure */
const Word16 L, /* i : length (32 or 48kHz) */
const Word16 coder_type /* i : coder type */
);
-void ar_encoder_start_fx( PARCODEC_FX arInst, PBITSTREAM_FX bsInst, Word32 max_bits );
+void ar_encoder_start_fx( PARCODEC_FX arInst, PBITSTREAM_FX bsInst, const Word32 max_bits );
void ar_encoder_done_fx( PARCODEC_FX arInst );
void ar_decoder_start_fx( PARCODEC_FX arInst, PBITSTREAM_FX bsInst );
void ar_decoder_done_fx( PARCODEC_FX arInst );
@@ -769,22 +813,22 @@ void decode_magnitude_usq_fx(ARCODEC_FX* pardec, Word16 size, Word16 npulses, Wo
void decode_mangitude_tcq_fx(ARCODEC_FX* pardec, Word16 size, Word16 npulses, Word16 nzpos, Word16* positions, Word16* out, Word32* surplus_fx);
void decode_signs_fx(ARCODEC_FX* pardec, Word16 size, Word16* out);
-void tcq_core_LR_enc_fx(
- Encoder_State_fx* st_fx,
- Word16 inp_vector_fx[],
- const Word32 coefs_norm_fx[],
- Word32 coefs_quant_fx[],
- const Word16 bit_budget, /* number of bits */
- const Word16 nb_sfm,
- const Word16 *sfm_start,
- const Word16 *sfm_end,
- const Word16 *sfmsize,
- Word32 *R_fx,
- Word16 *npulses,
- Word16 *k_sort,
- const Word16 *p2a_flags,
+ivas_error tcq_core_LR_enc_fx(
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 inp_vector_fx[], /* x5 */
+ const Word32 coefs_norm_fx[], /* Q12 */
+ Word32 coefs_quant_fx[], /* Q12 */
+ const Word16 bit_budget, /* number of bits */
+ const Word16 BANDS,
+ const Word16* sfm_start,
+ const Word16* sfm_end,
+ const Word16* sfmsize,
+ Word32* R_fx, /* Q16 */
+ Word16* npulses,
+ Word16* k_sort,
+ const Word16* p2a_flags,
const Word16 p2a_bands,
- const Word16 *last_bitalloc,
+ const Word16* last_bitalloc,
const Word16 input_frame,
const Word16 adjustFlag,
const Word16 is_transient
@@ -880,13 +924,13 @@ void window_ola_fx(
);
void tcx_get_windows_mode1(
- Word16 left_mode, /* i: overlap mode of left window half */
- Word16 right_mode, /* i: overlap mode of right window half */
- Word16 *left_win, /* o: left overlap window */
- Word16 *right_win, /* o: right overlap window */
- Word16 *left_win_int, /* o: left overlap window */
- Word16 *right_win_int, /* o: right overlap window */
- Word16 const L
+ const Word16 left_mode, /* i: overlap mode of left window half */
+ const Word16 right_mode,/* i: overlap mode of right window half */
+ Word16* left_win, /* o: left overlap window */
+ Word16* right_win, /* o: right overlap window */
+ Word16* left_win_int, /* o: left overlap window */
+ Word16* right_win_int, /* o: right overlap window */
+ const Word16 L /* i : length */
);
void sinq_fx(
@@ -896,120 +940,19 @@ void sinq_fx(
Word16 x[] /* o : output vector Q15*/
);
-Word16 FEC_phase_matching_fx(
- Decoder_State_fx *st_fx, /* i : Decoder State */
- Word32 *ImdctOut_fx, /* i : input */
- Word16 *auOut_fx, /* o : output audio */
- Word16 *OldauOut_fx,
- Word16 OldauOut_pha_fx[2][N_LEAD_NB]
-);
-
-void FEC_phase_matching_nextgood_fx(
- const Word32 *ImdctOut_fx, /* i : input */
- Word16 *auOut_fx, /* o : output audio */
- Word16 *OldauOut_fx, /* i/o: audio from previous frame */
- Word16 OldauOut_pha_fx[2][N_LEAD_NB],
- Word16 mean_en_high_fx /* Q5 */
-);
-
-void FEC_phase_matching_burst_fx(
- const Word32 *ImdctOut_fx, /* i : input */
- Word16 *auOut_fx, /* o : output audio */
- Word16 *OldauOut_fx, /* i/o: audio from previous frame */
- Word16 OldauOut_pha_fx[2][N_LEAD_NB],
- Word16 *prev_oldauOut_fx /* i : OldauOut from previous frame */
-);
-
-void Repetition_smoothing_nextgood_fx(
- const Word32 *ImdctOut_fx, /* i : input */
- Word16 *auOut_fx, /* o : output audio */
- Word32 *OldImdctOut_fx, /* i : input */
- Word16 *OldauOut_fx, /* i/o: audio from previous frame */
- Word16 cur_data_use_flag, /* i : current imdct data use flag */
- Word16 overlap_time
-);
-
-Word16 Repetition_smoothing_fx(
- const Word32 *ImdctOut_fx, /* i : input */
- Word16 *auOut_fx, /* o : output audio */
- Word32 *OldImdctOut_fx, /* i/o: audio from previous frame */
- Word16 *OldauOut_fx, /* i/o: audio from previous frame */
- const Word16 L, /* i : length */
- Word16 *prev_oldauOut_fx, /* i/o: IMDCT output from previous old frame */
- Word16 overlap_time /* i : overlapping time */
-);
-
void time_domain_FEC_HQ_fx(
Decoder_State_fx *st_fx, /* i : Decoder State */
- Word32 *wtda_audio_fx, /* i : input */
+ Word32 *wtda_audio_fx, /* i : i */
Word16 *out_fx, /* o : output audio */
Word16 mean_en_high_fx, /* i : transient flag */
const Word16 output_frame,
Word16 *Q_synth
);
-void common_overlapping_fx(
- Word16 *auOut_fx, /* i : Input */
- Word16 *ImdctOutWin_fx, /* o : Output */
- Word16 *OldauOut_fx, /* i : Window */
- Word16 end1, /* i : Decay */
- Word16 offset1,
- Word16 start2,
- Word16 end2,
- Word16 offset_i2,
- Word16 offset2
-);
-
-void Smoothing_vector_scaledown_NB_fx(
- const Word16 OldauOutnoWin_fx[], /* i : Input vector 1 */
- const Word16 ImdctOutWin_fx[], /* i : Input vector 2 */
- const Word16 SmoothingWin_fx[], /* i : Smoothing window */
- Word16 auOut_fx[], /* o : Output vector that contains vector 1 .* vector 2*/
- const Word16 ol_size /* i : Overlap size */
-);
-
-void Scaledown_fx(
- Word16 x[], /* i : Input vector */
- Word16 y[], /* o : Output vector that contains vector 1 .* vector 2*/
- Word16 scale_v,
- const Word16 N /* i : Overlap size */
-);
-
-void Smoothing_vector_NB_fx(
- const Word16 OldauOutnoWin_fx[], /* i : Input vector 1 */
- const Word16 ImdctOutWin_fx[], /* i : Input vector 2 */
- const Word16 SmoothingWin_fx[], /* i : Smoothing window */
- Word16 auOut_fx[], /* o : Output vector that contains vector 1 .* vector 2 */
- const Word16 ol_size /* i : Overlap size */
-);
-void Windowing_1st_NB_fx(
- Word16 *ImdctOutWin_fx, /* o : Output */
- const Word32 *ImdctOut_fx, /* i : Input */
- const Word16 *win_fx, /* i : Window */
- const Word16 *smoothingWin_fx, /* i : Smoothing Window */
- Word16 smoothing_flag /* i : 1=Smoothing window, 0=Original window */
-);
-void Windowing_2nd_NB_fx(
- Word16 *ImdctOutWin_fx, /* o : Output */
- const Word32 *ImdctOut_fx, /* i : Input */
- const Word16 *win_fx /* i : Window */
-);
-void Next_good_after_burst_erasures_fx(
- const Word32 *ImdctOut_fx,
- Word16 *auOut_fx,
- Word16 *OldauOut_fx,
- const Word16 ol_size
-);
-void subband_gain_bits_fx(
- const Word16 *Rk, /* i : bit allocation per band Q3 */
- const Word16 N, /* i : number of bands */
- Word16 *bits, /* o : gain bits per band */
- const Word16 *sfmsize /* i : Size of bands */
-);
Word16 assign_gain_bits_fx( /* o : Number of assigned gain bits */
const Word16 core, /* i : HQ core */
@@ -1045,7 +988,7 @@ void fine_gain_pred_fx(
);
void fine_gain_quant_fx(
- Encoder_State_fx *st_fx,
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
const Word16 *ord, /* i : Indices for energy order */
const Word16 num_sfm, /* i : Number of bands */
const Word16 *gain_bits, /* i : Gain adjustment bits per sub band */
@@ -1073,56 +1016,40 @@ void get_max_pulses_fx(
);
Word16 pvq_core_enc_fx(
- Encoder_State_fx *st_fx,
- Word16 coefs_norm[],
- Word16 coefs_quant[],
- Word16 *Q_coefs,
- Word16 bits_tot, /* total number of bits */
- Word16 nb_sfm,
- const Word16 *sfm_start,
- const Word16 *sfm_end,
- const Word16 *sfmsize,
- Word16 *R, /* Q3 */
- Word16 *Rs,
- Word16 *npulses,
- Word16 *maxpulse,
- const Word16 core
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16 coefs_norm[], /* i/o: normalized coefficients to encode */
+ Word16 coefs_quant[], /* o : quantized coefficients */
+ Word16* Q_coefs,
+ const Word16 bits_tot, /* i : total number of bits */
+ const Word16 nb_sfm, /* i : number of bands */
+ const Word16* sfm_start, /* i : Subband start coefficient */
+ const Word16* sfm_end, /* i : Subband end coefficient */
+ const Word16* sfmsize, /* i : subband width */
+ Word16* R, /* i/o: Bit allocation/Adjusted bit alloc. Q3 */
+ Word16* Rs, /* i/o: Integer bit allocation */
+ Word16* npulses, /* o : number of pulses */
+ Word16* maxpulse, /* i : maximum pulse per band */
+ const Word16 core /* i : number of bands */
);
void pvq_encode_frame_fx(
- Encoder_State_fx *st_fx,
- const Word16 *coefs_norm, /* i : normalized coefficients to encode */
- Word16 Q_coefs,
- Word16 *coefs_quant, /* o : quantized coefficients */
- Word16 *gopt, /* o : optimal shape gains */
- Word16 *npulses, /* o : number of pulses per band */
- Word16 *pulse_vector, /* o : non-normalized pulse shapes */
- const Word16 *sfm_start, /* i : indices of first coefficients in the bands */
- const Word16 *sfm_end, /* i : indices of last coefficients in the bands */
- const Word16 *sfmsize, /* i : band sizes */
- const Word16 nb_sfm, /* i : total number of bands */
- const Word16 *R, /* i : bitallocation per band */
- const Word16 pvq_bits, /* i : number of bits avaiable */
- const Word16 core /* i : core */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16* coefs_norm, /* i : normalized coefficients to encode */
+ Word16 Q_coefs, /* i : Q-point of coefs_norm[] */
+ Word16* coefs_quant, /* o : quantized coefficients */
+ Word16* gopt, /* o : optimal shape gains */
+ Word16* npulses, /* o : number of pulses per band */
+ Word16* pulse_vector, /* o : non-normalized pulse shapes */
+ const Word16* sfm_start, /* i : indices of first coefficients in the bands */
+ const Word16* sfm_end, /* i : indices of last coefficients in the bands */
+ const Word16* sfmsize, /* i : band sizes */
+ const Word16 nb_sfm, /* i : total number of bands */
+ const Word16* R, /* i : bitallocation per band Q3 */
+ const Word16 pvq_bits, /* i : number of bits avaiable */
+ const Word16 core /* i : core */
);
-void encode_energies_fx(
- Encoder_State_fx *st_fx,
- const Word16 *coefs,
- const Word16 Q_coefs,
- Word16 Np,
- Word16 *dim_part,
- Word32 *E_part, /* 32-bit Q15 */
- Word16 *bits_part,
- Word16 *g_part, /* Q15 */
- Word16 qband,
- Word16 *bits_left,
- Word32 enr, /* 32-bit Q15 */
- Word16 dim,
- const Word16 strict_bits
-);
-
Word16 pvq_core_dec_fx(
Decoder_State_fx *st_fx,
const Word16 *sfm_start,
@@ -1155,6 +1082,7 @@ void pvq_decode_frame_fx(
void decode_energies_fx(
Decoder_State_fx *st_fx,
+ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
Word16 Np,
Word16 *dim_part,
Word16 *bits_part,
@@ -1171,7 +1099,7 @@ Word16 atan2_fx(
);
void srt_vec_ind16_fx (
- const Word16 *linear, /* linear input */
+ const Word16 *linear, /* linear i */
Word16 *srt, /* sorted output*/
Word16 *I, /* index for sorted output */
Word16 length
@@ -1197,31 +1125,35 @@ void mpvq_decode_vec_fx( /* o : void */
);
void rc_enc_init_fx(
- Encoder_State_fx *st_fx, /* i/o: Encoder state */
- Word16 tot_bits /* i : Total bit budget */
+ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */
+ Word16 tot_bits /* i : Total bit budget */
);
void rc_encode_fx(
- Encoder_State_fx *st_fx, /* i/o: Encoder state */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */
UWord32 cum_freq, /* i : Cumulative frequency up to symbol */
UWord32 sym_freq, /* i : Symbol probability */
UWord32 tot /* i : Total cumulative frequency */
);
void rc_enc_uniform_fx(
- Encoder_State_fx *st_fx, /* i/o: Encoder state */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */
UWord32 value, /* i : Value to encode */
UWord32 tot /* i : Maximum value */
);
void rc_enc_bits_fx(
- Encoder_State_fx *st_fx, /* i/o: Encoder state */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */
UWord32 value, /* i : Value to encode */
Word16 bits /* i : Number of bits used */
);
void rc_enc_finish_fx(
- Encoder_State_fx *st_fx /* i/o: Encoder state */
+ BSTR_ENC_HANDLE hBstr, /* i/o: Encoder state */
+ PVQ_ENC_HANDLE hPVQ /* i/o: PVQ encoder handle */
);
Word16 rc_get_bits2_fx( /* o: Number of bits needed */
@@ -1237,61 +1169,69 @@ void rangeCoderFinalizationFBits_fx(
);
void conservativeL1Norm_fx(
- Word16 L,
- Word16 Qvec,
- Word16 Fcons,
- Word16 Qavail,
- Word16 Qreserv,
- Word16 Dspec,
- Word16 *Dvec,
- Word16 *Qspare,
- Word16 *Qreservplus,
- Word16 *Dspecplus
+ const Word16 L, /* i : Length of vector segment */
+ const Word16 Qvec, /* i : Assigned number of quanta */
+ const Word16 Fcons, /* i : Conservative rounding flag */
+ const Word16 Qavail, /* i : Input quanta remaining */
+ const Word16 Qreserv, /* i : Input quanta in reservoir */
+ const Word16 Dspec, /* i : assigned diracs from bitalloc */
+ Word16* Dvec, /* o : actual number of diracs */
+ Word16* Qspare, /* o : Output quanta remaining */
+ Word16* Qreservplus, /* o : Output quanta in reservoir */
+ Word16* Dspecplus /* o : Output number of diracs */
);
void bandBitsAdjustment_fx(
- Word16 Brc,
- UWord32 INTrc,
- Word16 Bavail,
- Word16 Nbands,
- Word16 D,
- Word16 L,
- Word16 Bband,
- Word16 Breserv,
- Word16 *Bband_adj,
- Word16 *Brem,
- Word16 *Breservplus
+ const Word16 Brc, /* i : Current number of read quanta in range coder */
+ const UWord32 INTrc, /* i : Range coder state */
+ const Word16 Bavail, /* i : Available number of quanta */
+ const Word16 Nbands, /* i : Number of bands */
+ const Word16 D, /* i : Remaining number of bands to encode */
+ const Word16 L, /* i : Size of current band */
+ const Word16 Bband, /* i : Quanta allocation for current band */
+ const Word16 Breserv, /* i : Quanta reservoir */
+ Word16* Bband_adj, /* o : Actual used number of quanta */
+ Word16* Brem, /* o : Quanta remaining */
+ Word16* Breservplus /* o : Quanta pool size */
);
UWord32 rc_decode_fx( /* o : Decoded cumulative frequency */
- Decoder_State_fx *st_fx, /* i/o: Decoder State */
+ Word16* BER_detect, /* o : Bit error detection flag */
+ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
UWord32 tot /* i : Total cumulative frequency */
);
void rc_dec_update_fx(
Decoder_State_fx *st_fx, /* i/o: Decoder State */
+ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
+
UWord32 cum_freq, /* i : Cumulative frequency */
UWord32 sym_freq /* i : Symbol frequency */
);
UWord32 rc_dec_uniform_fx( /* i : Decoded value */
Decoder_State_fx *st_fx, /* i/o: Decoder State */
+ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
+
UWord32 tot /* i : Maximum value */
);
void rc_dec_init_fx(
Decoder_State_fx *st_fx, /* i/o: Decoder State */
+ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
Word16 tot_bits /* i : Total bit budget */
);
Word32 rc_dec_bits_fx( /* i : Decoded value */
Decoder_State_fx *st_fx, /* i/o: Decoder State */
+ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
Word16 bits /* i : Number of bits */
);
void rc_dec_finish_fx(
- Decoder_State_fx *st_fx
+ Decoder_State_fx *st_fx,
+ PVQ_DEC_HANDLE hPVQ /* i/o: PVQ decoder handle */
);
UWord32 UL_inverse(
@@ -1305,11 +1245,12 @@ UWord32 UL_div(
);
void hq_core_enc_fx(
- Encoder_State_fx *st_fx,
- const Word16 *audio, /* i : input audio signal Q0 */
- const Word16 input_frame_orig,/* i : frame length */
- const Word16 hq_core_type, /* i : HQ core type */
- const Word16 Voicing_flag
+ Encoder_State_fx* st_fx,
+ const Word16* audio, /* i : i audio signal Q0 */
+ const Word16 input_frame_orig, /* i : frame length */
+ const Word16 hq_core_type, /* i : HQ core type */
+ const Word16 Voicing_flag, /* i : Voicing flag for FER method selection */
+ const Word16 vad_hover_flag /* i : VAD hangover flag */
);
void normalizecoefs_fx(
@@ -1323,7 +1264,7 @@ void normalizecoefs_fx(
void calc_norm_fx(
const Word32 *L_x, /* i : Input vector. Qx */
- const Word16 qx, /* i : Q value of input */
+ const Word16 qx, /* i : Q value of i */
Word16 *norm, /* o : Quantization indices for norms Q0 */
Word16 *normlg, /* o : Quantized norms in log2 Q0 */
const Word16 start_band, /* i : Indice of band to start coding Q0 */
@@ -1350,11 +1291,12 @@ void reordernorm_fx(
);
void hq_hr_enc_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure fx */
- Word32 *t_audio, /* i/o: transform-domain coefficients Q12? */
- const Word16 length, /* i : length of spectrum Q0 */
- Word16 *num_bits, /* i : number of available bits Q0 */
- const Word16 is_transient /* i : transient flag Q0 */
+ Encoder_State_fx* st_fx, /* i/o: encoder state structure fx */
+ Word32* t_audio, /* i/o: transform-domain coefficients Q12 */
+ const Word16 length, /* i : length of spectrum Q0 */
+ Word16* num_bits, /* i : number of available bits Q0 */
+ const Word16 is_transient, /* i : transient flag Q0 */
+ const Word16 vad_hover_flag /* i : VAD hangover flag */
);
Word16 hq_classifier_enc_fx( /* o : Consumed bits Q0 */
@@ -1370,7 +1312,7 @@ Word16 hq_classifier_enc_fx( /* o : Consumed bits Q0
);
void hvq_classifier_fx(
- const Word32 *input, /* i : input signal Q12 */
+ const Word32 *i , /* i : i signal Q12 */
Word16 *prev_Npeaks, /* i/o: Peak number memory Q0 */
Word16 *prev_peaks, /* i/o: Peak indices memory Q0 */
Word16 *hqswb_clas, /* i/o: HQ class Q0 */
@@ -1412,7 +1354,7 @@ void hq_wb_nf_bwe_fx(
const Word16 prev_is_transient, /* i : previous transient flag */
Word32 *prev_normq_fx, /* i/o: previous norms */
Word32 *prev_env_fx, /* i/o: previous noise envelopes */
- Word16 *bwe_seed, /* i/o: random seed for generating BWE input */
+ Word16 *bwe_seed, /* i/o: random seed for generating BWE i */
Word32 *prev_coeff_out_fx, /* i/o: decoded spectrum in previous frame */
Word16 *prev_R, /* i/o: bit allocation info. in previous frame */
Word32 *L_coeff_out, /* o : coded/noisefilled spectrum */
@@ -1434,19 +1376,20 @@ void harm_bwe_fine_fx(
);
void harm_bwe_fx(
- const Word16 *coeff_fine, /* i : fine structure for BWE */
- const Word16 *coeff, /* i : coded/noisefilled normalized spectrum */
- const Word16 num_sfm, /* i : Number of subbands */
- const Word16 *sfm_start, /* i : Subband start coefficient */
- const Word16 *sfm_end, /* i : Subband end coefficient */
- const Word16 last_sfm, /* i : last coded subband */
- const Word16 *R, /* i : bit allocation */
- const Word16 prev_hq_mode, /* i : previous hq mode */
- Word16 *norm, /* i/o: quantization indices for norms */
- Word16 *noise_level, /* i/o: noise levels for harmonic modes */
- Word16 *prev_noise_level, /* i/o: noise factor in previous frame */
- Word16 *bwe_seed, /* i/o: random seed for generating BWE input */
- Word32 *coeff_out /* o : coded/noisefilled spectrum */
+ const Word16* coeff_fine, /* i : fine structure for BWE */
+ const Word16* coeff, /* i : coded/noisefilled normalized spectrum */
+ const Word16 num_sfm, /* i : Number of subbands */
+ const Word16* sfm_start, /* i : Subband start coefficient */
+ const Word16* sfm_end, /* i : Subband end coefficient */
+ const Word16 last_sfm, /* i : last coded subband */
+ const Word16* R, /* i : bit allocation */
+ const Word16 prev_hq_mode, /* i : previous hq mode */
+ Word16* norm, /* i/o: quantization indices for norms */
+ Word16* noise_level, /* i/o: noise levels for harmonic modes */
+ Word16* prev_noise_level, /* i/o: noise factor in previous frame */
+ Word16* bwe_seed, /* i/o: random seed for generating BWE i */
+ Word32* coeff_out, /* o : coded/noisefilled spectrum */
+ const Word16 element_mode /* i : IVAS element mode */
);
void hq_generic_encoding_fx(
@@ -1462,13 +1405,13 @@ void hq_generic_fine_fx(
const Word16 last_sfm, /* i : Last coded band */
const Word16 *sfm_start, /* i : Subband start coefficient */
const Word16 *sfm_end, /* i : Subband end coefficient */
- Word16 *bwe_seed, /* i/o: random seed for generating BWE input */
- Word16 *coeff_out1 /* o : HQ Generic input */
+ Word16 *bwe_seed, /* i/o: random seed for generating BWE i */
+ Word16 *coeff_out1 /* o : HQ Generic i */
);
void hq_bwe_fx(
const Word16 HQ_mode, /* i : HQ mode */
- Word32 *coeff_out1, /* i/o: BWE input & temporary buffer */
+ Word32 *coeff_out1, /* i/o: BWE i & temporary buffer */
const Word16 *hq_generic_fenv, /* i : SWB frequency envelopes */
Word32 *coeff_out, /* o : SWB signal in MDCT domain */
const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic bwe*/
@@ -1482,7 +1425,7 @@ void hq_bwe_fx(
void hq_generic_decoding_fx(
const Word16 HQ_mode, /* i : HQ mode */
- Word32 *coeff_out1_fx, /* i/o: BWE input & temporary buffer */
+ Word32 *coeff_out1_fx, /* i/o: BWE i & temporary buffer */
const Word16 *hq_generic_fenv_fx, /* i : SWB frequency envelopes */
Word32 *coeff_out_fx, /* o : SWB signal in MDCT domain */
const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic*/
@@ -1512,15 +1455,15 @@ Word16 get_nor_delta_hf_fx(
);
Word16 calc_nor_delta_hf_fx(
- Encoder_State_fx *st,
- const Word32 *t_audio,
- Word16 *ynrm,
- Word16 *Rsubband,
- const Word16 num_env_bands,
- const Word16 nb_sfm,
- const Word16 *sfmsize,
- const Word16 *sfm_start,
- const Word16 core_sfm
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word32* t_audio, /* i : transform-domain coefficients */
+ Word16* ynrm, /* i/o: norm indices */
+ Word16* Rsubband, /* i/o: sub-band bit allocation */
+ const Word16 num_env_bands, /* i : Number coded envelope bands */
+ const Word16 nb_sfm, /* i : Number of envelope bands */
+ const Word16* sfmsize, /* i : band length */
+ const Word16* sfm_start, /* i : Start index of bands */
+ const Word16 core_sfm /* i : index of the end band for core */
);
void HQ_FEC_processing_fx(
@@ -1593,43 +1536,37 @@ void hvq_dec_fx(
const Word16 core
);
-void peak_vq_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- Word32 *coefs_out, /* o : Output coefficient vector Q12 */
- const Word16 brate, /* i : Core bitrate */
- const Word16 num_bits, /* i : Number of bits for HVQ */
- const Word16 *ynrm, /* i : Envelope coefficients */
- Word16 *R, /* i/o: Bit allocation/updated bit allocation */
- Word16 *vq_peak_idx, /* o : Peak position vector */
- Word16 *Npeaks, /* o : Number of peaks */
- const Word16 core
-);
-
void hq_pred_hb_bws_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- const Word16 *ynrm, /* i : norm quantization index vector */
- const Word16 length, /* i : frame length */
- const Word16 hqswb_clas, /* i : HQ SWB class */
- const Word16 *SWB_fenv /* i : SWB frequency envelopes Q1 */
+ Decoder_State_fx *st_fx, /* i/o: decoder state structure */
+ const Word16 *ynrm, /* i : norm quantization index vector */
+ const Word16 length, /* i : frame length */
+ const Word16 hqswb_clas, /* i : HQ SWB class */
+ const Word16 *SWB_fenv /* i : SWB frequency envelopes Q1 */
);
void hq_core_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure fx */
- Word16 synth[], /* o : output synthesis */
- Word16 *Q_synth, /* o : Q value of synth */
- const Word16 output_frame, /* i : output frame length */
- const Word16 hq_core_type, /* i : HQ core type */
- const Word16 core_switching_flag /* i : ACELP->HQ switching frame flag */
+ Decoder_State_fx *st_fx, /* i/o: decoder state structure fx */
+ Word16 synth[], /* o : output synthesis */
+ Word16 *Q_synth, /* o : Q value of synth */
+ const Word16 output_frame, /* i : output frame length */
+ const Word16 hq_core_type, /* i : HQ core type */
+ const Word16 core_switching_flag /* i : ACELP->HQ switching frame flag */
+);
+void HQ_core_dec_init(
+ HQ_DEC_HANDLE hHQ_core /* i/o: HQ core data handle */
+);
+void HQ_nbfec_init(
+ HQ_NBFEC_HANDLE hHQ_nbfec /* i/o: HQ NB FEC data handle */
);
-
void hq_hr_dec_fx(
Decoder_State_fx *st_fx, /* i/o: decoder state structure fx */
- Word32 *L_coefsq, /* o : transform-domain coefficients Q12 */
- const Word16 length, /* i : frame length Q0 */
- Word16 num_bits, /* i : number of available bits Q0 */
- Word16 *ynrm, /* o : norm quantization index vector Q0 */
- Word16 *is_transient, /* o : transient flag Q0 */
- Word16 *hqswb_clas, /* o : HQ SWB class Q0 */
- Word16 *SWB_fenv /* o : SWB frequency envelopes Q1 */
+ Word32 *L_coefsq, /* o : transform-domain coefficients Q12 */
+ const Word16 length, /* i : frame length Q0 */
+ Word16 num_bits, /* i : number of available bits Q0 */
+ Word16 *ynrm, /* o : norm quantization index vector Q0 */
+ Word16 *is_transient, /* o : transient flag Q0 */
+ Word16 *hqswb_clas, /* o : HQ SWB class Q0 */
+ Word16 *SWB_fenv, /* o : SWB frequency envelopes Q1 */
+ const Word16 core_switching_flag /* i : Core switching flag */
);
void dequantize_norms_fx(
@@ -1661,19 +1598,19 @@ Word16 hq_classifier_dec_fx( /* o : Consumed bits Q0
);
void hq_configure_bfi_fx(
- Word16 *nb_sfm, /* o : Number of sub bands Q0 */
- Word16 *num_Sb, /* o : Number of FEC sub bands ? Q0 */
- Word16 *num_bands_p, /* o : FEC sub bands Q0 */
- Word16 const **sfmsize, /* o : Subband bandwidths */
- Word16 const **sfm_start, /* o : Subband start coefficients */
- Word16 const **sfm_end /* o : Subband end coefficients */
+ Word16* nb_sfm, /* o : Number of sub bands Q0 */
+ Word16* num_Sb, /* o : Number of FEC sub bands ? Q0 */
+ Word16* num_bands_p, /* o : FEC sub bands Q0 */
+ const Word16** sfmsize, /* o : Subband bandwidths */
+ const Word16** sfm_start, /* o : Subband start coefficients */
+ const Word16** sfm_end /* o : Subband end coefficients */
);
void hq_swb_harmonic_calc_norm_envelop_fx(
- Word32 *L_SWB_signal, /* i : input signal Q=12*/
- Word32 *L_envelope, /* o : output envelope Q=12*/
- Word16 L_swb_norm, /* i : length of normaliztion */
- Word16 SWB_flength /* i : length of input signal */
+ const Word32* L_SWB_signal, /* i : i signal Q=12*/
+ Word32* L_envelope, /* o : output envelope Q=12*/
+ const Word16 L_swb_norm, /* i : length of normaliztion */
+ const Word16 SWB_flength /* i : length of i signal */
);
Word16 build_nf_codebook_fx( /* o : Number of coefficients in nf codebook */
@@ -1695,7 +1632,7 @@ Word16 find_last_band_fx( /* o : index of last band */
void apply_noisefill_HQ_fx(
const Word16 *R, /* i : bit allocation */
- const Word16 length, /* i : input frame length */
+ const Word16 length, /* i : i frame length */
const Word16 flag_32K_env_ho,/* i : envelope stability hangover flag*/
const Word32 L_core_brate, /* i : core bit rate */
const Word16 last_sfm, /* i : last coded subband */
@@ -1739,7 +1676,7 @@ void apply_nf_gain_fx(
void logqnorm_fx(
const Word32 *x, /* i : coefficient vector Qx */
- const Word16 qx, /* i : Q value of input */
+ const Word16 qx, /* i : Q value of i */
Word16 *k, /* o : index Q0 */
const Word16 L, /* i : codebook length Q0 */
const Word16 N, /* i : sub-vector size Q0 */
@@ -1772,7 +1709,7 @@ void hvq_bwe_fx(
Word16 *norm, /* i/o: quantization indices for norms Q0 */
Word16 *noise_level, /* i/o: noise levels for harmonic modes Q15 */
Word16 *prev_noise_level, /* i/o: noise factor in previous frame Q15 */
- Word16 *bwe_seed, /* i/o: random seed for generating BWE input Q0 */
+ Word16 *bwe_seed, /* i/o: random seed for generating BWE i Q0 */
Word32 *L_coeff_out, /* o : coded/noisefilled spectrum Qout*/
const Word16 qin,
const Word16 qout
@@ -1811,16 +1748,17 @@ Word16 noise_adjust_fx( /* o : index of noise attenuation Q0 *
);
Word16 peak_vq_enc_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word32 *coefs, /* i : Input coefficient vector Q14 */
- Word32 *coefs_out, /* o : Quantized output vector Q14 */
- const Word32 brate, /* i : Core bitrate */
- const Word16 num_bits, /* i : Number of bits for HVQ */
- const Word16 vq_peaks, /* i : Number of identified peaks */
- const Word16 *ynrm, /* i : Envelope coefficients */
- Word16 *R, /* i/o: Bit allocation/updated bit allocation */
- Word16 *vq_peak_idx, /* i : Peak index vector */
- Word32 *nf_gains /* i : Estimated noise floor gains Q14 */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word32* coefs, /* i : Input coefficient vector Q12 */
+ Word32* coefs_out, /* o : Quantized output vector Q12 */
+ const Word32 brate, /* i : Core bitrate */
+ const Word16 num_bits, /* i : Number of bits for HVQ */
+ const Word16 vq_peaks, /* i : Number of identified peaks */
+ const Word16* ynrm, /* i : Envelope coefficients */
+ Word16* R, /* i/o: Bit allocation/updated bit allocation */
+ Word16* vq_peak_idx, /* i : Peak index vector */
+ Word32* nf_gains /* i : Estimated noise floor gains Q12 */
);
Word16 hvq_enc_fx( /* o : Consumed bits */
@@ -1897,8 +1835,9 @@ void env_adj_fx
Word16 env_stability_fx( /* in Q15 */
const Word16 *ynrm, /*i: Norm vector for current frame */
const Word16 nb_sfm, /*i: Number of sub-bands */
- Word16 *mem_norm, /*i/o: Norm vector memory from past frame */
- Word16 *mem_env_delta /*i/o: Envelope stability memory for smoothing in Q11 */
+ Word16 *mem_norm, /*i/o: Norm vector memory from past frame */
+ Word16 *mem_env_delta, /*i/o: Envelope stability memory for smoothing in Q11 */
+ const Word16 core_switching_flag/* i : Core switching flag */
);
Word16 env_stab_smo_fx( /* Q0 */
@@ -1929,9 +1868,9 @@ void hq_configure_fx(
Word16 *num_env_bands, /* o : Number coded envelope bands Q0 */
Word16 *numnrmibits, /* o : Number of bits in fall-back norm encoding Q0 */
Word16 *hq_generic_offset, /* o : Freq offset for HQ GENERIC Q0 */
- Word16 const **sfmsize, /* o : Subband bandwidths Q0 */
- Word16 const **sfm_start, /* o : Subband start coefficients Q0 */
- Word16 const **sfm_end /* o : Subband end coefficients Q0 */
+ Word16 *sfmsize, /* o : Subband bandwidths Q0 */
+ Word16 *sfm_start, /* o : Subband start coefficients Q0 */
+ Word16 *sfm_end /* o : Subband end coefficients Q0 */
);
Word16 hvq_pvq_bitalloc_fx(
@@ -1953,15 +1892,15 @@ void disf_ns_28b_fx(
);
void isf_enc_amr_wb_fx(
- Encoder_State_fx *st, /* i/o: state structure */
- Word16 *isf_new, /* o : quantized ISF vector */
- Word16 *isp_new, /* i/o: ISP vector to quantize/quantized */
- Word16 *Aq, /* o : quantized A(z) for 4 subframes */
- Word16 *stab_fac /* o : ISF stability factor */
+ Encoder_State_fx* st, /* i/o: state structure */
+ Word16* isf_new, /* i/o: quantized ISF vector */
+ Word16* isp_new, /* i/o: ISP vector to quantize/quantized */
+ Word16* Aq /* o : quantized A(z) for 4 subframes */
);
void pvq_encode_fx(
- Encoder_State_fx *st_fx,
+ BSTR_ENC_HANDLE hBstr,
+ PVQ_ENC_HANDLE hPVQ, /* i/o: PVQ encoder handle */
const Word16 *x, /* i: vector to quantize Q15-3=>Q12 */
Word16 *y, /* o: raw pulses (non-scaled short) Q0 */
Word16 *xq, /* o: quantized vector Q15 */
@@ -1973,8 +1912,9 @@ void pvq_encode_fx(
void pvq_decode_fx(
Decoder_State_fx *st_fx,
- Word16 *xq, /* o: decoded vector (Q15) */
- Word16 *y, /* o: decoded vector (non-scaled int) */
+ PVQ_DEC_HANDLE hPVQ, /* i/o: PVQ decoder handle */
+ Word16 *xq, /* o: decoded vector (Q15) */
+ Word16 *y, /* o: decoded vector (non-scaled int) */
const Word16 k_val, /* i: number of allocated pulses */
const Word16 dim, /* i: Length of vector */
const Word16 neg_gain /* i: Gain (negated to fit 1.0 in Q15 as -1.0) */
@@ -1985,30 +1925,26 @@ UWord32 intLimCDivPos_fx(
Word16 DEN
);
-Word32 intLimCDivSigned_fx(
- Word32 NUM,
- Word16 DEN
-);
Word16 shrtCDivSignedApprox(
const Word16 num,
const Word16 den
);
void de_interleave_spectrum_fx(
- Word32 *coefs, /* i/o: input and output coefficients Q? */
+ Word32 *coefs, /* i/o: i and output coefficients Q? */
const Word16 length /* i : length of spectrum Q0 */
);
void interleave_spectrum_fx(
- Word32 *coefs, /* i/o: input and output coefficients Q? */
+ Word32 *coefs, /* i/o: i and output coefficients Q? */
const Word16 length /* i : length of spectrum Q0 */
);
void recovernorm_fx(
- Word16 *idxbuf, /* i : reordered quantization indices */
- Word16 *ynrm, /* o : recovered quantization indices */
- Word16 *normqlg2, /* o : recovered quantized norms */
- Word16 nb_sfm /* i : number of SFMs */
+ const Word16* idxbuf, /* i : reordered quantization indices */
+ Word16* ynrm, /* o : recovered quantization indices */
+ Word16* normqlg2, /* o : recovered quantized norms */
+ const Word16 nb_sfm /* i : number of SFMs */
);
void map_quant_weight_fx(
@@ -2030,7 +1966,7 @@ void fill_spectrum_fx(
const Word16 env_stab, /* i : Envelope stability measure [0..1] Q15 */
Word16 *no_att_hangover, /* i/o: Frame counter for attenuation hangover Q0 */
Word32 *L_energy_lt, /* i/o: Long-term energy measure for transient detection Q13 */
- Word16 *bwe_seed, /* i/o: random seed for generating BWE input Q0 */
+ Word16 *bwe_seed, /* i/o: random seed for generating BWE i Q0 */
const Word16 hq_generic_exc_clas, /* i : BWE excitation class Q0 */
const Word16 core_sfm, /* i : index of the end band for core Q0 */
const Word16 HQ_mode, /* i : HQ mode Q0 */
@@ -2053,17 +1989,15 @@ void fill_spectrum_fx(
const Word16 prev_hq_mode, /* i : Previous HQ mode Q0 */
const Word16 num_sfm, /* i : Total number of bands Q0 */
Word16 *prev_env_Q,
- const Word16 num_env_bands
+ const Word16 num_env_bands,
+ const Word16 element_mode
);
Word16 FEC_pos_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- const Word16 coder_type, /* i : coder type */
- const Word16 last_good, /* i : last good classfication */
- Word16 *last_pulse_pos, /* o : last glotal pulse position in the lost ACB */
- Word16 *clas, /* o : decoded classification */
- Word32 *enr_q, /* o : decoded energy in Q0 */
- const Word32 core_brate /* i : decoded bitrate */
+ Decoder_State_fx* st_fx, /* i/o: decoder state structure */
+ Word16* last_pulse_pos, /* o : last glotal pulse position in the lost ACB */
+ Word32* enr_q, /* o : decoded energy in Q0 */
+ const Word16 nBits_es_Pred /* i : number of bits for Es_pred Q */
);
void pit16k_Q_dec_fx(
@@ -2162,17 +2096,16 @@ void FEC_lsf2lsp_interp(
);
void FEC_lsf_estim_enc_fx(
Encoder_State_fx *st_fx, /* i : Encoder static memory */
- const Word16 L_frame, /* i : length of the frame */
Word16 *lsf /* o : estimated LSF vector */
);
void FEC_clas_estim_fx(
Decoder_State_fx *st_fx, /* i/o: decoder state handle */
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ /*A*/
- const Word16 L_frame, /* i : length of the frame */
+ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */ /*A*/
+ const Word16 L_frame, /* i : length of the frame */
Word16 *clas, /* i/o: frame classification */
- const Word16 coder_type, /* i : coder type */
- const Word16 *pitch, /* i : pitch values for each subframe (Q6) */
+ const Word16 coder_type, /* i : coder type */
+ const Word16 *pitch, /* i : pitch values for each subframe (Q6) */
Word16 *syn, /* i : synthesis buffer */
Word16 *lp_speech, /* i/o: long term active speech energy average Q8 */
Word16 *decision_hyst, /* i/o: hysteresis of the music/speech decision */ /*A*/
@@ -2182,7 +2115,7 @@ void FEC_clas_estim_fx(
Word16 *locattack, /* i/o: detection of attack (mainly to localized speech burst) */ /*A*/
Word16 *lt_diff_etot, /* i/o: long-term total energy variation */ /*A*/
Word16 *amr_io_class, /* i/o: classification for AMR-WB IO mode */ /*A*/
- const Word32 bitrate, /* i : Decoded bitrate */ /*A*/
+ const Word32 bitrate, /* i : Decoded bitrate */ /*A*/
Word16 Q_syn, /* i : Synthesis scaling */
Word16 *class_para, /* o : classification para. fmerit1 */ /*A*/
Word16 *mem_syn_clas_estim, /* i/o: memory of the synthesis signal for frame class estimation */
@@ -2190,13 +2123,14 @@ void FEC_clas_estim_fx(
Word16 LTP_Gain, /* i : LTP gain is 0..0.6 or negative Q15*/ /*B*/
Word16 mode, /* i : signal classifier mode *//*B*/
Word16 bfi, /* i : bad frame indicator *//*B*/
- Word32 last_core_brate /* i : bitrate of previous frame */
+ Word32 last_core_brate, /* i : bitrate of previous frame */
+ const Word16 FEC_mode /* i : ACELP FEC mode */
);
void non_linearity_fx(
- const Word16 input[], /* i : input signal Q_inp */
+ const Word16 i [], /* i : i signal Q_inp */
Word32 output[], /* o : output signal 2*Q_inp */
- const Word16 length, /* i : input length */
+ const Word16 length, /* i : i length */
Word32 *prev_scale, /* i/o: memory Q30 */
Word16 Q_inp,
Word16 coder_type, /* i : Coder Type */
@@ -2205,12 +2139,12 @@ void non_linearity_fx(
);
void stat_noise_uv_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: Decoder static memory */
- const Word16 coder_type, /* i : coding type */
- Word16 *lsp_new, /* i : end-frame LSP vector */
- Word16 *lsp_mid, /* i : mid-frame LSP vector */
- Word16 *Aq, /* o : A(z) quantized for the 4 subframes */
- Word16 *exc2 /* i/o: excitation buffer */
+ Decoder_State_fx *st_fx, /* i/o: Decoder static memory */
+ Word16 *lsp_new, /* i : end-frame LSP vector */
+ Word16 *lsp_mid, /* i : mid-frame LSP vector */
+ Word16 *Aq, /* o : A(z) quantized for the 4 subframes */
+ Word16 *exc2 /* i/o: excitation buffer */
+ , const Word16 uc_two_stage_flag /* i : flag indicating two-stage UC */
);
void stat_noise_uv_mod_fx(
@@ -2231,7 +2165,7 @@ void stat_noise_uv_mod_fx(
Word16 *st_min_alpha, /* i/o: minimum alpha */
Word16 *exc_pe, /* i/o: scale Q_stat_noise */
const Word32 bitrate, /* i : core bitrate */
- const Word16 bwidth_fx, /* i : input bandwidth */
+ const Word16 bwidth_fx, /* i : i bandwidth */
Word16 *Q_stat_noise, /* i/o: noise scaling */
Word16 *Q_stat_noise_ge /* i/o: noise scaling */
);
@@ -2240,7 +2174,7 @@ void stat_noise_uv_mod_fx(
#define preemph_fx(signal,mu,L,mem) preemph_copy_fx((signal),(signal),(mu),(L),(mem))
void preemph_copy_fx(
- const Word16 x[], /* i : input signal Qx */
+ const Word16 x[], /* i : i signal Qx */
Word16 y[], /* o : output signal Qx */
const Word16 mu, /* i : preemphasis coefficient Q15 */
const Word16 lg, /* i : vector size Q0 */
@@ -2274,18 +2208,18 @@ void Vr_subt(
);
Word16 gsc_gainQ_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */
const Word16 y_gain4[], /* i : Energy per band Q13 */
Word16 y_gainQ[], /* o : quantized energy per band Q13 */
const Word32 core_brate, /* i : Core rate */
const Word16 coder_type, /* i : coding type */
- const Word16 bwidth /* i : input signal bandwidth */
+ const Word16 bwidth /* i : i signal bandwidth */
);
Word16 emaximum_fx( /* o : return index with max energy value in vector Q0 */
- const Word16 Qvec, /* i : Q of input vector Q0 */
- const Word16 *vec, /* i : input vector Qx */
- const Word16 lvec, /* i : length of input vector Q0 */
+ const Word16 Qvec, /* i : Q of i vector Q0 */
+ const Word16 *vec, /* i : i vector Qx */
+ const Word16 lvec, /* i : length of i vector Q0 */
Word32 *ener_max /* o : maximum energy value Q0 */
);
@@ -2302,13 +2236,13 @@ void set32_fx(
);
void Copy(
- const Word16 x[], /* i : input vector */
+ const Word16 x[], /* i : i vector */
Word16 y[], /* o : output vector */
const Word16 L /* i : vector length */
);
void Copy32(
- const Word32 x[], /* i : input vector */
+ const Word32 x[], /* i : i vector */
Word32 y[], /* o : output vector */
const Word16 L /* i : vector length */
);
@@ -2320,21 +2254,21 @@ void Scale_sig32(
);
void Copy_Scale_sig(
- const Word16 x[], /* i : signal to scale input Qx */
+ const Word16 x[], /* i : signal to scale i Qx */
Word16 y[], /* o : scaled signal output Qx */
const Word16 lg, /* i : size of x[] Q0 */
const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */
);
void Copy_Scale_sig_16_32(
- const Word16 x[], /* i : signal to scale input Qx */
+ const Word16 x[], /* i : signal to scale i Qx */
Word32 y[], /* o : scaled signal output Qx */
const Word16 lg, /* i : size of x[] Q0 */
const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */
);
void Copy_Scale_sig_32_16(
- const Word32 x[], /* i : signal to scale input Qx */
+ const Word32 x[], /* i : signal to scale i Qx */
Word16 y[], /* o : scaled signal output Qx */
const Word16 lg, /* i : size of x[] Q0 */
const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */
@@ -2349,18 +2283,14 @@ void init_lvq_fx(
Word16 no_scales_p[][2]
);
-void hf_synth_reset_fx(
- Word16 *seed2, /* i/o: random seed for HF noise gen */
- Word16 mem_hf[], /* o : HF band-pass filter memory */
- Word16 mem_syn_hf[], /* o : HF synthesis memory */
- Word16 mem_hp400[], /* o : memory of hp 400 Hz filter */
- Word16 mem_hp_interp[], /* o : interpol. memory */
- Word16 delay_syn_hf[] /* o : HF synthesis memory */
+void sc_vbr_dec_init(
+ SC_VBR_DEC_HANDLE hSC_VBR /* i/o: SC-VBR decoder handle */
);
-
void hf_synth_init_fx(
- Word16 mem_hp400[], /* o : 400 Hz high pass filter memory initialization */
- Word16 mem_hf[] /* o : band pass 6kHz to 7kHz FIR filter initialization */
+ ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */
+);
+void hf_synth_reset_fx(
+ ZERO_BWE_DEC_HANDLE hBWE_zero /* o : zero BWE decoder handle */
);
Word16 Random( /* o : output random value */
@@ -2387,24 +2317,20 @@ void iDiv_and_mod_32(
);
void lsf2lsp_fx(
- const Word16 lsf[], /* i : lsf[m] normalized (range: 0.0<=val<=0.5) x2.56 */
- Word16 lsp[], /* o : lsp[m] (range: -1<=val<1) Q15 */
- const Word16 m, /* i : LPC order Q0 */
- Word32 int_fs
+ const Word16 lsf[], /* i : lsf[m] normalized (range: 0.0<=val<=0.5) x2.56 */
+ Word16 lsp[], /* o : lsp[m] (range: -1<=val<1) Q15 */
+ const Word16 m, /* i : LPC order Q0 */
+ const Word32 int_fs /* i : internal sampling frequency */
);
void bass_psfilter_init_fx(
- Word16 old_syn[], /* o : Old synthesis buffer 1 */
- Word16 *mem_deemph_err, /* o : Error deemphasis memory */
- Word16 *lp_ener /* o : long_term error signal energy */
+ BPF_DEC_HANDLE hBPF /* o : BPF data handle */
);
-
-void decod_gen_voic_fx(
+ivas_error decod_gen_voic_fx(
Decoder_State_fx *st_fx, /* i/o: decoder static memory */
const Word16 L_frame_fx, /* i : length of the frame */
const Word16 sharpFlag_fx, /* i : formant sharpening flag */
const Word16 *Aq_fx, /* i : LP filter coefficient */
- const Word16 coder_type_fx, /* i : coding type */
const Word16 Es_pred_fx, /* i : predicted scaled innov. energy */
const Word16 do_WI_fx, /* i : do interpolation after a FER */
Word16 *pitch_buf_fx, /* o : floating pitch values for each subframe */
@@ -2422,23 +2348,21 @@ Word16 tc_classif_fx(
);
void transition_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 i_subfr, /* i : subframe index */
- const Word16 coder_type, /* i : coder type */
- const Word16 tc_subfr, /* i : TC subframe index */
- Word16 *Jopt_flag, /* i : joint optimization flag */
- Word16 *exc, /* o : excitation signal */
- Word16 *T0, /* o : close loop integer pitch */
- Word16 *T0_frac, /* o : close loop fractional part of the pitch */
- Word16 *T0_min, /* i/o: delta search min for sf 2 & 4 */
- Word16 *T0_max, /* i/o: delta search max for sf 2 & 4 */
- Word16 **pt_pitch, /* o : floating pitch values */
- Word16 *position, /* i/o: first glottal impulse position in frame */
- Word16 *bwe_exc, /* o : excitation for SWB TBE */
- Word16 *Q_exc /*i/o : scaling of excitation */
+ Decoder_State_fx* st_fx, /* i/o: decoder state structure */
+ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
+ const Word16 L_frame, /* i : length of the frame */
+ const Word16 i_subfr, /* i : subframe index */
+ const Word16 tc_subfr, /* i : TC subframe index */
+ Word16* Jopt_flag, /* i : joint optimization flag */
+ Word16* exc, /* o : excitation signal */
+ Word16* T0, /* o : close loop integer pitch */
+ Word16* T0_frac, /* o : close loop fractional part of the pitch */
+ Word16* T0_min, /* i/o: delta search min for sf 2 & 4 */
+ Word16* T0_max, /* i/o: delta search max for sf 2 & 4 */
+ Word16** pt_pitch, /* o : floating pitch values */
+ Word16* position, /* i/o: first glottal impulse position in frame */
+ Word16* bwe_exc, /* o : excitation for SWB TBE */
+ Word16* Q_exc /*i/o : scaling of excitation */
);
void decod_tran_fx(
@@ -2446,7 +2370,6 @@ void decod_tran_fx(
const Word16 L_frame_fx, /* i : length of the frame */
const Word16 tc_subfr_fx, /* i : TC subframe index */
const Word16 *Aq_fx, /* i : LP filter coefficient */
- const Word16 coder_type_fx, /* i : coding type */
const Word16 Es_pred_fx, /* i : predicted scaled innov. energy */
Word16 *pitch_buf_fx, /* o : floating pitch values for each subframe */
Word16 *voice_factors_fx, /* o : voicing factors */
@@ -2459,9 +2382,9 @@ void decod_tran_fx(
);
void interp_code_4over2_fx(
- const Word16 inp_code_fx[], /* i : input vector Qx */
+ const Word16 inp_code_fx[], /* i : i vector Qx */
Word16 interp_code_fx[], /* o : output vector Qx */
- const Word16 inp_length /* i : length of input vector */
+ const Word16 inp_length /* i : length of i vector */
);
void pred_lt4_tc_fx(
@@ -2474,24 +2397,23 @@ void pred_lt4_tc_fx(
);
void gaus_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder static memory */
- const Word32 core_brate, /* i */ /*1 : core bitrate */
- const Word16 i_subfr, /* i */ /*2 : subframe index */
- Word16 *code, /* o */ /*3 : unvoiced excitation Q12 */
- Word32 *L_norm_gain_code, /* o */ /*4 : gain of normalized gaussian excitation Q16 */
- Word16 *lp_gainp, /* i/o */ /*5 : lp filtered pitch gain(FER) Q14 */
- Word16 *lp_gainc, /* i/o */ /*6 : lp filtered code gain (FER) Q3 */
- Word16 *inv_gain_inov, /* o */ /*7 : unscaled innovation gain Q12 */
- Word16 *tilt_code, /* o */ /*8 : synthesis excitation spectrum tilt Q15 */
- Word16 *voice_fac, /* o */ /*9 : estimated voicing factor Q15 */
- Word16 *gain_pit, /* o */ /*10 : pitch gain Q14 */
- Word16 *pt_pitch_1, /* o */ /*11 : floating pitch buffer Q6 */
- Word16 *exc, /* o */ /*12 : excitation signal frame */
- Word32 *L_gain_code, /* o */ /*13 : gain of the gaussian excitation Q16 */
- Word16 *exc2, /* o */ /*14 : Scaled excitation signal frame */
- Word16 *bwe_exc_fx,
- Word16 *sQ_exc, /* i/o */ /*15 : Excitation scaling factor (Decoder state) */
- Word16 *sQsubfr /* i/o */ /*16 : Past excitation scaling factors (Decoder State) */
+ Decoder_State_fx* st_fx, /* i/o: decoder static memory */
+ const Word16 i_subfr, /* i : subframe index */
+ Word16* code, /* o : unvoiced excitation Q12 */
+ Word32* L_norm_gain_code, /* o : gain of normalized gaussian excitation Q16 */
+ Word16* lp_gainp, /* i/o : lp filtered pitch gain(FER) Q14 */
+ Word16* lp_gainc, /* i/o : lp filtered code gain (FER) Q3 */
+ Word16* inv_gain_inov, /* o : unscaled innovation gain Q12 */
+ Word16* tilt_code, /* o : synthesis excitation spectrum tilt Q15 */
+ Word16* voice_fac, /* o : estimated voicing factor Q15 */
+ Word16* gain_pit, /* o : pitch gain Q14 */
+ Word16* pt_pitch_1, /* o : floating pitch buffer Q6 */
+ Word16* exc, /* o : excitation signal frame */
+ Word32* L_gain_code, /* o : gain of the gaussian excitation Q16 */
+ Word16* exc2, /* o : Scaled excitation signal frame */
+ Word16* bwe_exc_fx,
+ Word16* sQ_exc, /* i/o : Excitation scaling factor (Decoder state) */
+ Word16* sQsubfr /* i/o : Past excitation scaling factors (Decoder State) */
);
void decod_unvoiced_fx(
@@ -2524,7 +2446,7 @@ void AVQ_demuxdec_fx(
Word16 nq_out[] /* i/o: AVQ nq index */
);
-void re8_decode_base_index_fx(Word16 n, UWord16 I, Word16 *x);
+void re8_decode_base_index_fx(const Word16 n, UWord16 I, Word16 *x);
void re8_k2y_fx(
const Word16 *k, /* i : Voronoi index k[0..7] */
@@ -2560,17 +2482,14 @@ void re8_dec_fx(
);
void gain_dec_SQ_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 coder_type, /* i : coding type */
- const Word16 i_subfr, /* i : subframe number */
- const Word16 tc_subfr, /* i : TC subframe index */
- const Word16 *code, /* i : algebraic code excitation Q12*/
- const Word16 Es_pred, /* i : predicted scaled innov. energy Q8 */
- Word16 *gain_pit, /* o : Quantized pitch gain Q14*/
- Word32 *gain_code, /* o : Quantized codeebook gain Q16*/
- Word16 *gain_inov, /* o : unscaled innovation gain Q12*/
- Word32 *norm_gain_code /* o : norm. gain of the codebook excitation Q16*/
+ Decoder_State_fx* st_fx, /* i/o: decoder state structure */
+ const Word16 i_subfr, /* i : subframe number */
+ const Word16* code, /* i : algebraic code excitation Q9*/
+ const Word16 Es_pred, /* i : predicted scaled innov. energy Q8 */
+ Word16* gain_pit, /* o : Quantized pitch gain Q14*/
+ Word32* gain_code, /* o : Quantized codeebook gain Q16*/
+ Word16* gain_inov, /* o : unscaled innovation gain Q12*/
+ Word32* norm_gain_code /* o : norm. gain of the codebook excitation Q16*/
);
void gain_dec_amr_wb_fx(
@@ -2599,7 +2518,7 @@ void syn_output_fx(
const Word16 Q_syn2 /* i : Synthesis scaling factor */
);
-void amr_wb_dec_fx(
+ivas_error amr_wb_dec_fx(
Word16 output_sp[], /* o : synthesis output */
Decoder_State_fx *st_fx /* o : Decoder static variables structure */
);
@@ -2632,59 +2551,70 @@ void disf_2s_36b_fx(
);
void transf_cdbk_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 coder_type, /* i : coding type */
+ Decoder_State_fx* st_fx, /* i/o: decoder state structure */
const Word16 harm_flag_acelp,/* i : harmonic flag for higher rates ACELP */
const Word16 i_subfr, /* i : subframe index */
- const Word16 tc_subfr, /* i : TC subframe index */
const Word16 Es_pred, /* i : predicited scaled innovation energy (Q8) */
const Word32 gain_code, /* i : innovative excitation gain (Q16) */
- Word16 *mem_preemp, /* i/o: dequantizer preemhasis memory */
- Word16 *gain_preQ, /* o : prequantizer excitation gain (Q2) */
- Word32 *norm_gain_preQ,/* o : normalized prequantizer excitation gain (Q16) */
+ Word16* gain_preQ, /* o : prequantizer excitation gain (Q2) */
+ Word32* norm_gain_preQ,/* o : normalized prequantizer excitation gain (Q16) */
Word16 code_preQ[], /* o : prequantizer excitation (Q8) */
- Word16 *unbits /* o : number of AVQ unused bits */
+ Word16* unbits /* o : number of AVQ unused bits */
);
void gain_enc_SQ_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 coder_type, /* i : coding type */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 gains_mode[], /* i : gain bits */
const Word16 i_subfr, /* i : subframe index */
- const Word16 tc_subfr, /* i : TC subframe index */
- const Word16 *xn, /* i : target vector Q_xn */
- const Word16 *yy1, /* i : zero-memory filtered adaptive excitation Q_xn */
- const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9 */
- const Word16 *code, /* i : algebraic excitation Q9 */
+ const Word16* xn, /* i : target vector Q_xn */
+ const Word16* yy1, /* i : zero-memory filtered adaptive excitation Q_xn */
+ const Word16* y2, /* i : zero-memory filtered algebraic codebook excitation Q9 */
+ const Word16* code, /* i : algebraic excitation Q9 */
const Word16 Es_pred, /* i : predicted scaled innovation energy Q8 */
- Word16 *gain_pit, /* o : quantized pitch gain Q14 */
- Word32 *gain_code, /* o : quantized codebook gain Q16 */
- Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12 */
- Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16 */
- Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 */
+ Word16* gain_pit, /* o : quantized pitch gain Q14 */
+ Word32* gain_code, /* o : quantized codebook gain Q16 */
+ Word16* gain_inov, /* o : gain of the innovation (used for normalization) Q12 */
+ Word32* norm_gain_code, /* o : norm. gain of the codebook excitation Q16 */
+ Word16* g_corr, /* i/o: correlations , ,, -2 and 2 */
const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) */
const Word16 Q_xn /* i : xn and y1 scaling */
);
-void AVQ_cod_fx( /* o: comfort noise gain factor */
- const Word16 xri[], /* i: vector to quantize */
- Word16 xriq[], /* o: quantized normalized vector (assuming the bit budget is enough) */
- const Word16 NB_BITS, /* i: number of allocated bits */
- const Word16 Nsv, /* i: number of subvectors (lg=Nsv*8) */
- const Word16 Q_in /* i: Scaling input */
+void AVQ_cod_fx( /* o: comfort noise gain factor */
+ const Word16 xri[], /* i: vector to quantize */
+ Word16 xriq[], /* o: quantized normalized vector (assuming the bit budget is enough) */
+ const Word16 NB_BITS, /* i: number of allocated bits */
+ const Word16 Nsv, /* i: number of subvectors (lg=Nsv*8) */
+ const Word16 Q_in_ref /* i: Scaling i */
+);
+void ordr_esti(
+ const Word16 svLength, /* i : sub-vector index */
+ Word16* Mpos, /* i/o: dominant sub-vector position from ACV */
+ Word16 svOrder[], /* i/o: AVQ sub-vecotr order */
+ const Word16 Nsv /* i : total sub-vectors in a sub-frames */
);
-
void AVQ_encmux_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word16 extl, /* i : extension layer */
- Word16 xriq[], /* i/o: rounded subvectors [0..8*Nsv-1] followed
- by rounded bit allocations [8*Nsv..8*Nsv+Nsv-1] */
- Word16 *nb_bits, /* i/o: number of allocated bits */
- const Word16 Nsv, /* i: number of subvectors */
- Word16 nq_out[] /* o : AVQ nq index */
+ BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */
+ const Word16 extl, /* i : extension layer */
+ Word16 xriq[], /* i/o: rounded subvectors [0..8*Nsv-1] followed
+ by rounded bit allocations [8*Nsv..8*Nsv+Nsv-1] */
+ Word16* nb_bits, /* i/o: number of allocated bits */
+ const Word16 Nsv, /* i: number of subvectors */
+ Word16 nq_out[], /* o : AVQ nq index */
+ Word16 avq_bit_sFlag, /* i : flag for AVQ bit saving solution */
+ Word16 trgtSvPos /* i : target SV for AVQ bit savings */
+);
+void E_ACELP_4t(
+ Word16 dn[], Word16 cn[] /* Q_xn */, Word16 H[],
+ Word16 R[], Word8 acelpautoc,
+ Word16 code[],
+ Word16 cdk_index, Word16 _index[]
+ , const Word16 L_frame,
+ const Word16 last_L_frame,
+ const Word32 total_brate,
+ const Word16 i_subfr,
+ const Word16 cmpl_flag
);
-
Word32 Dot_product( /* o : Sum */
const Word16 x[], /* i : 12bits: x vector */
const Word16 y[], /* i : 12bits: y vector */
@@ -2709,24 +2639,24 @@ Word16 gain_quant_fx( /* o: quantization index */
);
void gain_enc_mless_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 coder_type, /* i : coding type */
- const Word16 i_subfr, /* i : subframe index */
- const Word16 tc_subfr, /* i : TC subframe index */
- const Word16 *xn, /* i : target vector */
- const Word16 *y1, /* i : zero-memory filtered adaptive excitation */
- const Word16 Q_xn, /* i : xn and y1 scaling */
- const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation */
- const Word16 *code, /* i : algebraic excitation */
- const Word16 Es_pred, /* i : predicted scaled innovation energy */
- Word16 *gain_pit, /* o : quantized pitch gain */
- Word32 *gain_code, /* o : quantized codebook gain */
- Word16 *gain_inov, /* o : gain of the innovation (used for normalization) */
- Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation */
- Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 */
- const Word16 clip_gain /* i : gain pitch clipping flag (1 = clipping) */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 gains_mode[], /* i : gain bits */
+ const Word16 element_mode, /* i : element mode */
+ const Word16 L_frame, /* i : length of the frame */
+ const Word16 i_subfr, /* i : subframe index */
+ const Word16 tc_subfr, /* i : TC subframe index */
+ const Word16* xn, /* i : target vector */
+ const Word16* y1, /* i : zero-memory filtered adaptive excitation */
+ const Word16 Q_xn, /* i : xn and y1 scaling */
+ const Word16* y2, /* i : zero-memory filtered algebraic codebook excitation */
+ const Word16* code, /* i : algebraic excitation */
+ const Word16 Es_pred, /* i : predicted scaled innovation energy */
+ Word16* gain_pit, /* o : quantized pitch gain */
+ Word32* gain_code, /* o : quantized codebook gain */
+ Word16* gain_inov, /* o : gain of the innovation (used for normalization) */
+ Word32* norm_gain_code, /* o : norm. gain of the codebook excitation */
+ Word16* g_corr, /* i/o: correlations , -2,, -2 and 2 */
+ const Word16 clip_gain /* i : gain pitch clipping flag (1 = clipping) */
);
Word16 gain_enc_gaus_fx( /* o : Return index of quantization */
@@ -2736,105 +2666,90 @@ Word16 gain_enc_gaus_fx( /* o : Return index of quantization
const Word16 stepSize, /* i : Step size choice Q14 */
const Word16 inv_stepSize /* i : Step size choice Q15 */
);
-
void gain_enc_tc_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 i_subfr, /* i : subframe index */
- const Word16 tc_subfr, /* i : TC subframe index */
- const Word16 xn_fx[], /* i : target vector */
- const Word16 y2_fx[], /* i : zero-memory filtered algebraic codebook excitation */
- const Word16 code_fx[], /* i : algebraic excitation */
- const Word16 Es_pred_fx, /* i : predicted scaled innovation energy */
- Word16 *gain_pit_fx, /* o : Pitch gain / Quantized pitch gain */
- Word32 *gain_code_fx, /* o : quantized codebook gain */
- Word16 *gain_inov_fx, /* o : innovation gain */
- Word32 *norm_gain_code_fx, /* o : norm. gain of the codebook excitation */
- const Word16 Q_xn /* i : xn and y1 scaling Q0 */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 gains_mode[], /* i : gain bits */
+ const Word16 i_subfr, /* i : subframe index */
+ const Word16 xn_fx[], /* i : target vector */
+ const Word16 y2_fx[], /* i : zero-memory filtered algebraic codebook excitation */
+ const Word16 code_fx[], /* i : algebraic excitation */
+ const Word16 Es_pred_fx, /* i : predicted scaled innovation energy */
+ Word16* gain_pit_fx, /* o : Pitch gain / Quantized pitch gain */
+ Word32* gain_code_fx, /* o : quantized codebook gain */
+ Word16* gain_inov_fx, /* o : innovation gain */
+ Word32* norm_gain_code_fx, /* o : norm. gain of the codebook excitation */
+ const Word16 Q_xn /* i : xn and y1 scaling Q0 */
);
Word16 gaus_encode_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word16 i_subfr, /* i : subframe index */
- const Word16 *h1, /* i : weighted filter input response */
- const Word16 *xn, /* i : target vector */
- Word16 *exc, /* o : pointer to excitation signal frame */
- Word16 *mem_w0, /* o : weighting filter denominator memory */
- Word16 *clip_gain, /* o : memory of gain of pitch clipping algorithm */
- Word16 *tilt_code, /* o : synthesis excitation spectrum tilt */
- Word16 *code, /* o : algebraic excitation Q9 */
- Word32 *gain_code, /* o : Code gain. Q16 */
- Word16 *y2, /* o : zero-memory filtered adaptive excitation Q9 */
- Word16 *gain_inov, /* o : innovation gain Q12 */
- Word16 *voice_fac, /* o : voicing factor Q15 */
- Word16 *gain_pit, /* o : adaptive excitation gain Q14 */
- const Word16 Q_new, /* i : scaling factor */
- const Word16 shift, /* i : scaling factor */
- Word32 *norm_gain_code, /* o : normalized innovative cb. gain Q16 */
- const Word32 core_brate /* i : core bitrate */
+ Encoder_State_fx* st_fx, /* i/o: encoder state structure */
+ const Word16 i_subfr, /* i : subframe index */
+ const Word16* h1, /* i : weighted filter i response */
+ const Word16* xn, /* i : target vector */
+ Word16* exc, /* o : pointer to excitation signal frame */
+ Word16* mem_w0, /* o : weighting filter denominator memory */
+ Word16* clip_gain, /* o : memory of gain of pitch clipping algorithm */
+ Word16* tilt_code, /* o : synthesis excitation spectrum tilt */
+ Word16* code, /* o : algebraic excitation Q9 */
+ Word32* gain_code, /* o : Code gain. Q16 */
+ Word16* y2, /* o : zero-memory filtered adaptive excitation Q9 */
+ Word16* gain_inov, /* o : innovation gain Q12 */
+ Word16* voice_fac, /* o : voicing factor Q15 */
+ Word16* gain_pit, /* o : adaptive excitation gain Q14 */
+ const Word16 Q_new, /* i : scaling factor */
+ const Word16 shift, /* i : scaling factor */
+ Word32* norm_gain_code /* o : normalized innovative cb. gain Q16 */
);
void encod_unvoiced_fx(
- Encoder_State_fx *st_fx, /* i/o: state structure */
- LPD_state *mem, /* i/o: acelp memories */
- const Word16 *speech_fx, /* i : Input speech */
- const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */
- const Word16 *Aq_fx, /* i : 12k8 Lp coefficient */
- const Word16 vad_flag_fx,
- const Word16 *res_fx, /* i : residual signal */
- Word16 *syn_fx, /* o : core synthesis */
- Word16 *tmp_noise_fx, /* o : long-term noise energy */
- Word16 *exc_fx, /* i/o: current non-enhanced excitation */
- Word16 *pitch_buf_fx, /* o : floating pitch values for each subframe */
- Word16 *voice_factors_fx, /* o : voicing factors */
- Word16 *bwe_exc_fx, /* i/o: excitation for SWB TBE */
+ Encoder_State_fx* st_fx, /* i/o: state structure */
+ const Word16* speech_fx, /* i : Input speech */
+ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */
+ const Word16* Aq_fx, /* i : 12k8 Lp coefficient */
+ const Word16 Es_pred, /* i : predicted scaled innov. energy */
+ const Word16 uc_two_stage_flag, /* i : flag indicating two-stage UC */
+ const Word16* res_fx, /* i : residual signal */
+ Word16* syn_fx, /* o : core synthesis */
+ Word16* tmp_noise_fx, /* o : long-term noise energy */
+ Word16* exc_fx, /* i/o: current non-enhanced excitation */
+ Word16* pitch_buf_fx, /* o : floating pitch values for each subframe */
+ Word16* voice_factors_fx, /* o : voicing factors */
+ Word16* bwe_exc_fx, /* i/o: excitation for SWB TBE */
const Word16 Q_new,
const Word16 shift
);
void transf_cdbk_enc_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 extl, /* i : extension layer */
- const Word16 coder_type, /* i : coding type */
- const Word16 harm_flag_acelp, /* i : harmonic flag for higher rates ACELP */
- const Word16 i_subfr, /* i : subframe index */
- const Word16 tc_subfr, /* i : TC subframe index */
- Word16 cn[], /* i/o: target vector in residual domain */
- Word16 exc[], /* i/o: pointer to excitation signal frame */
- const Word16 *p_Aq, /* i : 12k8 Lp coefficient */
- const Word16 Ap[], /* i : weighted LP filter coefficients */
- const Word16 h1[], /* i : weighted filter input response */
- Word16 xn[], /* i/o: target vector */
- Word16 xn2[], /* i/o: target vector for innovation search */
- Word16 y1[], /* i/o: zero-memory filtered adaptive excitation */
- const Word16 y2[], /* i : zero-memory filtered innovative excitation */
- const Word16 Es_pred, /* i : predicited scaled innovation energy */
- Word16 *gain_pit, /* i/o: adaptive excitation gain */
- const Word32 gain_code, /* i : innovative excitation gain */
- Word16 g_corr[], /* o : ACELP correlation values */
- const Word16 clip_gain, /* i : adaptive gain clipping flag */
- Word16 *mem_deemp, /* i/o: prequantizer deemhasis memory */
- Word16 *mem_preemp, /* i/o: prequantizer preemhasis memory */
- Word16 *gain_preQ, /* o : prequantizer excitation gain */
- Word16 code_preQ[], /* o : prequantizer excitation */
- Word16 *unbits, /* o : number of AVQ unused bits */
- const Word16 Q_new, /* i : Current frame scaling */
- const Word16 shift /* i : shifting applied to y1, xn,... */
+ Encoder_State_fx* st_fx, /* i/o: encoder state structure */
+ const Word16 harm_flag_acelp,/* i : harmonic flag for higher rates ACELP */
+ const Word16 i_subfr, /* i : subframe index */
+ Word16 cn[], /* i/o: target vector in residual domain */
+ Word16 exc[], /* i/o: pointer to excitation signal frame */
+ const Word16* p_Aq, /* i : 12k8 Lp coefficient */
+ const Word16 Ap[], /* i : weighted LP filter coefficients */
+ const Word16 h1[], /* i : weighted filter i response */
+ Word16 xn[], /* i/o: target vector */
+ Word16 xn2[], /* i/o: target vector for innovation search */
+ Word16 y1[], /* i/o: zero-memory filtered adaptive excitation */
+ const Word16 y2[], /* i : zero-memory filtered innovative excitation */
+ const Word16 Es_pred, /* i : predicited scaled innovation energy */
+ Word16* gain_pit, /* i/o: adaptive excitation gain */
+ const Word32 gain_code, /* i : innovative excitation gain */
+ Word16 g_corr[], /* o : ACELP correlation values */
+ const Word16 clip_gain, /* i : adaptive gain clipping flag */
+ Word16* gain_preQ, /* o : prequantizer excitation gain */
+ Word16 code_preQ[], /* o : prequantizer excitation */
+ Word16* unbits, /* o : number of AVQ unused bits */
+ const Word16 Q_new, /* i : Current frame scaling */
+ const Word16 shift /* i : shifting applied to y1, xn,... */
);
Word16 encod_tran_fx(
Encoder_State_fx *st_fx, /* i/o: state structure */
- LPD_state *mem, /* i/o: acelp memories */
- const Word16 L_frame_fx, /* i : length of the frame */
- const Word16 speech_fx[], /* i : input speech */
+ const Word16 speech_fx[], /* i : i speech */
const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */
const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */
- const Word16 coder_type, /* i : coding type */
const Word16 Es_pred_fx, /* i : predicted scaled innov. energy */
- const Word16 T_op_fx[], /* i : open loop pitch */
- const Word16 voicing_fx[], /* i : voicing */
const Word16 *res_fx, /* i : residual signal */
Word16 *syn_fx, /* i/o: core synthesis */
Word16 *exc_fx, /* i/o: current non-enhanced excitation */
@@ -2842,9 +2757,9 @@ Word16 encod_tran_fx(
Word16 *pitch_buf_fx, /* i/o: floating pitch values for each subframe */
Word16 *voice_factors, /* o : voicing factors */
Word16 *bwe_exc_fx, /* i/o: excitation for SWB TBE */
- const Word16 gsc_attack_flag, /* i : Flag to indicate when an audio attack is deal with TM */
+ Word16 tc_subfr, /* i/o: TC subframe classification */
+ Word16 position, /* i : maximum of residual signal index */
Word16 *unbits, /* i/o: number of unused bits */
- Word16 sharpFlag, /* o : formant sharpening flag */
const Word16 shift, /* i : Scaling to get 12 bits */
const Word16 Q_new /* i : Input scaling */
);
@@ -2854,8 +2769,12 @@ Word16 est_tilt_fx( /* o : tilt of the code
const Word16 gain_pit, /* i : adaptive gain Q14 */
const Word16 *code, /* i : algebraic exctitation vector Q9 */
const Word32 gain_code, /* i : algebraic code gain Q16 */
- Word16 *voice_fac, /* o : voicing factor Q15 */
+ Word16 *voice_fac, /* o : voicing factor Q15 */
const Word16 Q_exc /* i : Scaling factor of excitation Q0 */
+#ifdef ADD_LRTD
+ , const Word16 L_subfr /* i : Sub frame lenght */
+#endif
+
);
Word16 Est_tilt2( /* o : tilt of the code */
@@ -2869,23 +2788,17 @@ Word16 Est_tilt2( /* o : tilt of the code
void transition_enc_fx(
Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 coder_type, /* i : coding type */
const Word16 i_subfr, /* i : subframe index */
Word16 *tc_subfr, /* i/o: TC subframe index */
Word16 *Jopt_flag, /* i : joint optimization flag */
Word16 *position, /* i/o: maximum of residual signal index */
- const Word16 voicing_fx[], /* i : normalized correlations (from OL pitch) Q15*/
- const Word16 T_op_fx[], /* i : open loop pitch estimates in current frame Q0*/
Word16 *T0, /* i/o: close loop integer pitch Q0*/
Word16 *T0_frac, /* i/o: close loop fractional part of the pitch Q0*/
Word16 *T0_min, /* i/o: lower limit for close-loop search Q0*/
Word16 *T0_max, /* i/o: higher limit for close-loop search Q0*/
Word16 *exc_fx, /* i/o: pointer to excitation signal frame Q_new*/
Word16 *y1_fx, /* o : zero-memory filtered adaptive excitation Q_new-1+shift*/
- const Word16 *res_fx, /* i : pointer to the LP residual signal frame Q_new*/
- const Word16 *h1_fx, /* i : weighted filter input response Q(14+shift)*/
+ const Word16 *h1_fx, /* i : weighted filter i response Q(14+shift)*/
const Word16 *xn_fx, /* i : target vector Q_new-1+shift*/
Word16 *xn2_fx, /* o : target vector for innovation search Q_new-1+shift*/
Word16 *gp_cl_fx, /* i/o: memory of gain of pitch clipping algorithm */
@@ -2894,8 +2807,10 @@ void transition_enc_fx(
Word16 *clip_gain, /* i/o: adaptive gain clipping flag */
Word16 **pt_pitch_fx, /* o : floating pitch values */
Word16 *bwe_exc_fx, /* o : excitation for SWB TBE Q_new*/
+ Word16* unbits_ACELP, /* i/o: unused bits */
Word16 Q_new, /* i : Current scaling */
Word16 shift /* i : downscaling needs for 12 bits convolutions */
+
);
Word16 abs_pit_enc_fx( /* o : pitch index */
@@ -2924,7 +2839,7 @@ void set_impulse_fx(
);
void pit16k_Q_enc_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
const Word16 nBits, /* i : # of Q bits */
const Word16 limit_flag, /* i : restrained(0) or extended(1) Q limits */
const Word16 T0, /* i : integer pitch lag */
@@ -2934,7 +2849,7 @@ void pit16k_Q_enc_fx(
);
void gain_enc_amr_wb_fx(
- Encoder_State_fx *st, /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
const Word16 *xn, /* i : target vector */
const Word16 Q_xn, /* i : xn and yy1 format Q0 */
const Word16 *yy1, /* i : zero-memory filtered adaptive excitation */
@@ -2951,70 +2866,74 @@ void gain_enc_amr_wb_fx(
);
void gain_enc_lbr_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 coder_type, /* i : coding type */
- const Word16 i_subfr, /* i : subframe index */
- const Word16 *xn, /* i : target vector Q_xn*/
- const Word16 *y1, /* i : zero-memory filtered adaptive excitation Q_xn*/
- const Word16 Q_xn, /* i : xn and y1 format */
- const Word16 *y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/
- const Word16 *code, /* i : algebraic excitation Q9*/
- Word16 *gain_pit, /* o : quantized pitch gain Q14*/
- Word32 *gain_code, /* o : quantized codebook gain Q16*/
- Word16 *gain_inov, /* o : gain of the innovation (used for normalization) Q12*/
- Word32 *norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/
- Word16 *g_corr, /* i/o: correlations , -2,, -2 and 2 mant/exp*/
- Word32 gc_mem[], /* i/o: gain_code from previous subframes */
- Word16 gp_mem[], /* i/o: gain_pitch from previous subframes */
- const Word16 clip_gain /* i : gain pitch clipping flag (1 = clipping) */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 gains_mode[], /* i : gain bits */
+ const Word16 coder_type, /* i : coding type */
+ const Word16 i_subfr, /* i : subframe index */
+ const Word16* xn, /* i : target vector Q_xn*/
+ const Word16* y1, /* i : zero-memory filtered adaptive excitation Q_xn*/
+ const Word16 Q_xn, /* i : xn and y1 format */
+ const Word16* y2, /* i : zero-memory filtered algebraic codebook excitation Q9*/
+ const Word16* code, /* i : algebraic excitation Q9*/
+ Word16* gain_pit, /* o : quantized pitch gain Q14*/
+ Word32* gain_code, /* o : quantized codebook gain Q16*/
+ Word16* gain_inov, /* o : gain of the innovation (used for normalization) Q12*/
+ Word32* norm_gain_code, /* o : norm. gain of the codebook excitation Q16*/
+ Word16* g_corr, /* i/o: correlations , -2,, -2 and 2 mant/exp*/
+ Word32 gc_mem[], /* i/o: gain_code from previous subframes */
+ Word16 gp_mem[], /* i/o: gain_pitch from previous subframes */
+ const Word16 clip_gain, /* i : gain pitch clipping flag (1 = clipping) */
+ const Word16 L_subfr /* i : subframe length */
);
void gp_clip_test_gain_pit_fx(
- const Word32 core_brate, /* i : core bitrate */
- const Word16 gain_pit, /* i : gain of quantized pitch Q14 */
- Word16 mem[] /* i/o: memory of gain of pitch clipping algorithm */
+ const Word16 element_mode, /* i : element mode */
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16 gain_pit, /* i : gain of quantized pitch Q14 */
+ Word16 mem[] /* i/o: memory of gain of pitch clipping algorithm 1Q14 */
);
void gp_clip_test_lsf_fx(
- const Word16 lsf[], /* i : lsf values (in frequency domain) */
- Word16 mem[], /* i/o: memory of gain of pitch clipping algorithm */
- const Word16 Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */
+ const Word16 element_mode, /* i : element mode */
+ const Word16 lsf[], /* i : lsf values (in frequency domain) 14Q1*1.28 */
+ Word16 mem[], /* i/o: memory of gain of pitch clipping algorithm */
+ const Word16 m /* i : dimension of lsf */
);
Word16 inov_encode_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 last_L_frame, /* i : length of the last frame */
- const Word16 coder_type, /* i : coding type */
- const Word16 bwidth, /* i : input signal bandwidth */
- const Word16 sharpFlag, /* i : formant sharpening flag */
- const Word16 i_subfr, /* i : subframe index */
- const Word16 tc_subfr, /* i : TC subframe index */
- const Word16 *p_Aq, /* i : LP filter coefficients Q12*/
- const Word16 gain_pit, /* i : adaptive excitation gain Q14*/
- Word16 *cn, /* i/o: target vector in residual domain Q_new*/
- const Word16 *exc, /* i : pointer to excitation signal frame Q_new*/
- Word16 *h2, /* i/o: weighted filter input response Q12*/
- const Word16 tilt_code, /* i : tilt of the excitation of previous subframe Q15*/
- const Word16 pt_pitch, /* i : pointer to current subframe fractional pitch Q6*/
- const Word16 *xn2, /* i : target vector for innovation search Q_new-1+shift*/
- Word16 *code, /* o : algebraic excitation Q9*/
- Word16 *y2, /* o : zero-memory filtered algebraic excitation Q9*/
- Word16 *unbits, /* o : number of unused bits for PI */
+ Encoder_State_fx* st_fx, /* i/o: encoder state structure */
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
+ const Word16 L_frame, /* i : length of the frame */
+ const Word16 last_L_frame, /* i : length of the last frame */
+ const Word16 coder_type, /* i : coding type */
+ const Word16 bwidth, /* i : i signal bandwidth */
+ const Word16 sharpFlag, /* i : formant sharpening flag */
+ const Word16 i_subfr, /* i : subframe index */
+ const Word16 tc_subfr, /* i : TC subframe index */
+ const Word16* p_Aq, /* i : LP filter coefficients Q12*/
+ const Word16 gain_pit, /* i : adaptive excitation gain Q14*/
+ Word16* cn, /* i/o: target vector in residual domain Q_new*/
+ const Word16* exc, /* i : pointer to excitation signal frame Q_new*/
+ Word16* h2, /* i/o: weighted filter i response Q12*/
+ const Word16 tilt_code, /* i : tilt of the excitation of previous subframe Q15*/
+ const Word16 pt_pitch, /* i : pointer to current subframe fractional pitch Q6*/
+ const Word16* xn2, /* i : target vector for innovation search Q_new-1+shift*/
+ Word16* code, /* o : algebraic excitation Q9*/
+ Word16* y2, /* o : zero-memory filtered algebraic excitation Q9*/
+ Word16* unbits, /* o : number of unused bits for PI */
+ const Word16 L_subfr, /* i : subframe length */
Word16 shift
);
Word32 sum2_fx( /* o : sum of all squared vector elements Q(2x+1)*/
- const Word16 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+ const Word16 *vec, /* i : i vector Qx*/
+ const Word16 lvec /* i : length of i vector */
);
Word32 sum2_fx_mod( /* o : sum of all squared vector elements Q(2x+1)*/
- const Word16 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+ const Word16 *vec, /* i : i vector Qx*/
+ const Word16 lvec /* i : length of i vector */
);
Word16 usdequant_fx( /* Qx*/
@@ -3032,29 +2951,25 @@ Word16 gain_dequant_fx( /* o: decoded gain */
);
void Es_pred_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- Word16 *Es_pred, /* o : predicited scaled innovation energy Q8*/
- const Word16 coder_type, /* i : coder type */
- const Word32 core_brate /* i : core bitrate */
+ Word16* Es_pred, /* o : predicited scaled innovation energy Q8*/
+ const Word16 enr_idx, /* i : indice */
+ const Word16 nb_bits, /* i : number of bits */
+ const Word16 no_ltp /* i : no LTP flag */
);
void gain_dec_tc_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- const Word32 core_brate_fx, /* i : core bitrate */
- const Word16 *code_fx, /* i : algebraic code excitation */
- const Word16 L_frame_fx, /* i : length of the frame */
+ Decoder_State_fx* st_fx, /* i/o: decoder state structure */
+ const Word16* code_fx, /* i : algebraic code excitation */
const Word16 i_subfr_fx, /* i : subframe number */
- const Word16 tc_subfr_fx, /* i : TC subframe index */
const Word16 Es_pred_fx, /* i : predicted scaled innov. energy */
- Word16 *gain_pit_fx, /* o : pitch gain */
- Word32 *gain_code_fx, /* o : Quantized codeebook gain */
- Word16 *gain_inov_fx, /* o : unscaled innovation gain */
- Word32 *norm_gain_code_fx /* o : norm. gain of the codebook excit. */
+ Word16* gain_pit_fx, /* o : pitch gain */
+ Word32* gain_code_fx, /* o : Quantized codeebook gain */
+ Word16* gain_inov_fx, /* o : unscaled innovation gain */
+ Word32* norm_gain_code_fx /* o : norm. gain of the codebook excit. */
);
void gain_dec_mless_fx(
Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- const Word32 core_brate_fx, /* i : core bitrate */
const Word16 L_frame_fx, /* i : length of the frame */
const Word16 coder_type_fx, /* i : coding type */
const Word16 i_subfr_fx, /* i : subframe number */
@@ -3068,25 +2983,26 @@ void gain_dec_mless_fx(
);
void pre_echo_att_fx(
- Word32 *Last_frame_ener_fx, /* i/o: Energy of the last frame 2*Q_new+1*/
- Word16 *exc_fx, /* i/o: Excitation of the current frame Q_new*/
- const Word16 gsc_attack_flag_fx, /* i : flag signalling attack encoded by AC mode (GSC) */
- const Word16 Q_new
- ,const Word16 last_coder_type_fx /* i : Last coding mode */
+ Word32* Last_frame_ener_fx, /* i/o: Energy of the last frame 2*Q_new+1*/
+ Word16* exc_fx, /* i/o: Excitation of the current frame Q_new*/
+ const Word16 gsc_attack_flag_fx, /* i : flag signalling attack encoded by AC mode (GSC) */
+ const Word16 Q_new,
+ const Word16 last_coder_type_fx, /* i : Last coding mode */
+ const Word16 L_frame /* i : Frame length*/
);
void gain_dec_lbr_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 coder_type, /* i : coding type */
- const Word16 i_subfr, /* i : subframe index */
- const Word16 *code_fx, /* i : algebraic excitation Q12*/
- Word16 *gain_pit_fx, /* o : quantized pitch gain Q14*/
- Word32 *gain_code_fx, /* o : quantized codebook gain Q16*/
- Word16 *gain_inov_fx, /* o : gain of the innovation (used for normalization) Q12*/
- Word32 *norm_gain_code_fx, /* o : norm. gain of the codebook excitation Q16*/
- Word32 gc_mem[], /* i/o: gain_code from previous subframes */
- Word16 gp_mem[] /* i/o: gain_pitch from previous subframes */
+ Decoder_State_fx* st_fx, /* i/o: decoder state structure */
+ const Word16 coder_type, /* i : coding type */
+ const Word16 i_subfr, /* i : subframe index */
+ const Word16* code_fx, /* i : algebraic excitation Q9 */
+ Word16* gain_pit_fx, /* o : quantized pitch gain Q14*/
+ Word32* gain_code_fx, /* o : quantized codebook gain Q16*/
+ Word16* gain_inov_fx, /* o : gain of the innovation (used for normalization) Q12*/
+ Word32* norm_gain_code_fx, /* o : norm. gain of the codebook excitation Q16*/
+ Word32 gc_mem[], /* i/o: gain_code from previous subframes */
+ Word16 gp_mem[] /* i/o: gain_pitch from previous subframes */
+ , const Word16 L_subfr /* i : subfr lenght */
);
void lp_gain_updt_fx(
@@ -3139,38 +3055,39 @@ void delta_pit_dec_fx(
const Word16 T0_min /* i : delta search min */
);
-Word16 pit_decode_fx( /* o : floating pitch value */
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 L_frame, /* i : length of the frame */
- Word16 i_subfr, /* i : subframe index */
- const Word16 coder_type, /* i : coding type */
- Word16 *limit_flag, /* i/o: restrained(0) or extended(1) Q limits */
- Word16 *T0, /* o : close loop integer pitch */
- Word16 *T0_frac, /* o : close loop fractional part of the pitch */
- Word16 *T0_min, /* i/o: delta search min for sf 2 & 4 */
- Word16 *T0_max, /* i/o: delta search max for sf 2 & 4 */
- const Word16 L_subfr /* i : subframe length */
+Word16 pit_decode_fx( /* o : floating pitch value */
+ Decoder_State_fx *st_fx, /* i/o: decoder state structure */
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
+ const Word16 L_frame, /* i : length of the frame */
+ Word16 i_subfr, /* i : subframe index */
+ const Word16 coder_type, /* i : coding type */
+ Word16 *limit_flag, /* i/o: restrained(0) or extended(1) Q limits */
+ Word16 *T0, /* o : close loop integer pitch */
+ Word16 *T0_frac, /* o : close loop fractional part of the pitch */
+ Word16 *T0_min, /* i/o: delta search min for sf 2 & 4 */
+ Word16 *T0_max, /* i/o: delta search max for sf 2 & 4 */
+ const Word16 L_subfr /* i : subframe length */
+#ifdef ADD_LRTD
+ , const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
+ const Word16 tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */
+#endif
);
void pred_lt4(
- const Word16 excI[], /* in: excitation buffer */
- Word16 excO[], /* out: excitation buffer */
- Word16 T0, /* input : integer pitch lag */
- Word16 frac, /* input : fraction of lag */
- Word16 L_subfr, /* input : subframe size */
- const Word16 *win, /* i : interpolation window */
- const Word16 nb_coef, /* i : nb of filter coef */
- const Word16 up_sample /* i : up_sample */
+ const Word16 excI[], /* in : excitation buffer */
+ Word16 excO[], /* out: excitation buffer */
+ const Word16 T0, /* i : integer pitch lag */
+ Word16 frac, /* i : fraction of lag */
+ const Word16 L_subfr, /* i : subframe size */
+ const Word16* win, /* i : interpolation window */
+ const Word16 nb_coef, /* i : nb of filter coef */
+ const Word16 up_sample /* i : up_sample */
);
void lp_filt_exc_dec_fx(
Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- const Word16 codec_type, /* i : coder type */
- const Word32 core_brate, /* i : core bitrate */
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 coder_type, /* i : coding type */
+ const Word16 codec_mode, /* i : coder mode */
const Word16 i_subfr, /* i : subframe index */
const Word16 L_subfr, /* i : subframe size */
const Word16 L_frame, /* i : frame size */
@@ -3183,19 +3100,19 @@ void inov_decode_fx(
const Word32 core_brate, /* i : core bitrate */
const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
const Word16 L_frame, /* i : length of the frame */
- const Word16 coder_type, /* i : coding type */
const Word16 sharpFlag, /* i : formant sharpening flag */
const Word16 i_subfr, /* i : subframe index */
- const Word16 tc_subfr, /* i : TC subframe index */
const Word16 *p_Aq, /* i : LP filter coefficients Q12 */
const Word16 tilt_code, /* i : tilt of the excitation of previous subframe Q15 */
const Word16 pt_pitch, /* i : pointer to current subframe fractional pitch Q6*/
Word16 *code /* o : algebraic excitation */
+ , const Word16 L_subfr /* i : subframe length */
);
void dec_acelp_1t64_fx(
Decoder_State_fx *st_fx, /* i/o: decoder state structure */
Word16 code[] /* o: algebraic (fixed) codebook excitation Q12*/
+ ,const Word16 L_subfr /* i : sub frame lenght*/
);
void dec_acelp_2t32_fx(
@@ -3227,7 +3144,7 @@ void weight_a_fx(
void Residu3_lc_fx(
const Word16 a[], /* i : prediction coefficients Q12 */
const Word16 m, /* i : order of LP filter Q0 */
- const Word16 x[], /* i : input signal (usually speech) Qx */
+ const Word16 x[], /* i : i signal (usually speech) Qx */
Word16 y[], /* o : output signal (usually residual) Qx */
const Word16 lg, /* i : vector size Q0 */
const Word16 shift /* i : 0=residu2, 1=residu */
@@ -3235,7 +3152,7 @@ void Residu3_lc_fx(
void Residu3_10_fx(
const Word16 a[], /* i : prediction coefficients Q12 */
- const Word16 x[], /* i : input signal (usually speech) Qx */
+ const Word16 x[], /* i : i signal (usually speech) Qx */
/* (note that values x[-10..-1] are needed) */
Word16 y[], /* o : output signal (usually residual) Qx */
const Word16 lg, /* i : vector size Q0 */
@@ -3244,7 +3161,7 @@ void Residu3_10_fx(
void Residu3_fx(
const Word16 a[], /* i : prediction coefficients Q12 */
- const Word16 x[], /* i : input signal (usually speech) Qx */
+ const Word16 x[], /* i : i signal (usually speech) Qx */
/* (note that values x[-M..-1] are needed) */
Word16 y[], /* o : output signal (usually residual) Qx */
const Word16 lg, /* i : vector size Q0 */
@@ -3253,7 +3170,7 @@ void Residu3_fx(
void pre_exc_fx(
const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
- const Word16 *speech, /* i : input speech Q_new-1*/
+ const Word16 *speech, /* i : i speech Q_new-1*/
const Word16 *p_Aq, /* i : 12k8 Lp coefficient Q12*/
const Word16 *p_A, /* i : unquantized A(q) filter with bandwidth expansion Q12*/
const Word16 coder_type, /* i : coding type */
@@ -3272,29 +3189,39 @@ void pre_exc_fx(
);
void encod_audio_fx(
- Encoder_State_fx *st_fx, /* i/o: State structure */
- LPD_state *mem, /* i/o: acelp memories */
- const Word16 speech[], /* i : input speech Q_new */
- const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */
- const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */
- const Word16 T_op[], /* i : open loop pitch */
- const Word16 voicing[], /* i : voicing Q15 */
- const Word16 *res, /* i : residual signal Q_new */
- Word16 *synth, /* i/o: core synthesis Q-1 */
- Word16 *exc, /* i/o: current non-enhanced excitation Q_new */
- Word16 *pitch_buf, /* i/o: floating pitch values for each subframe Q6 */
- Word16 *voice_factors, /* o : voicing factors Q15 */
- Word16 *bwe_exc, /* o : excitation for SWB TBE Q0 */
- const Word16 gsc_attack_flag, /* i : Flag that point to an attack coded with AC mode (GSC) */
- const Word16 coder_type, /* i : coding type */
- Word16 *lsf_new, /* i : current frame ISF vector */
- Word16 *tmp_noise, /* o : noise energy */
+ Encoder_State_fx* st_fx, /* i/o: State structure */
+ const Word16 speech[], /* i : i speech Q_new */
+ const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */
+ const Word16 Aq[], /* i : 12k8 Lp coefficient */
+ const Word16* res, /* i : residual signal Q_new */
+ Word16* synth, /* i/o: core synthesis Q-1 */
+ Word16* exc, /* i/o: current non-enhanced excitation Q_new */
+ Word16* pitch_buf, /* i/o: floating pitch values for each subframe Q6 */
+ Word16* voice_factors, /* o : voicing factors Q15 */
+ Word16* bwe_exc, /* o : excitation for SWB TBE Q0 */
+ const Word16 attack_flag, /* i : Flag that point to an attack coded with AC mode (GSC) */
+ Word16* lsf_new, /* i : current frame ISF vector */
+ Word16* tmp_noise, /* o : noise energy */
+ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
+ const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer */
Word16 Q_new,
Word16 shift
);
-
+void gsc_enc_fx(
+ Encoder_State_fx* st_fx, /* i/o: State structure */
+ Word16 res_dct_in[], /* i : dct of residual signal */
+ Word16 exc_dct_in[], /* i/o: dct of pitch-only excitation / total excitation */
+ const Word16 Diff_len,
+ const Word16 bits_used,
+ const Word16 nb_subfr,
+ Word16* lsf_new, /* i : ISFs at the end of the frame */
+ Word16* exc_wo_nf, /* o : excitation (in f domain) without noisefill */
+ Word16* tmp_noise, /* o : noise energy */
+ Word16 Q_exc
+);
Word16 pit_encode_fx( /* o : Fractional pitch for each subframe */
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 pitch_bits[], /* i : pitch bits */
const Word32 core_brate, /* i : core bitrate */
const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
const Word16 L_frame, /* i : length of the frame */
@@ -3308,8 +3235,10 @@ Word16 pit_encode_fx( /* o : Fractional pitch for each subframe
Word16 *T0_max, /* i/o: higher limit for close-loop search */
Word16 *T0, /* i/o: close loop integer pitch */
Word16 *T0_frac, /* i/o: close loop fractional part of the pitch */
- const Word16 *h1, /* i : weighted filter input response */
- const Word16 *xn /* i : target vector */
+ const Word16 *h1, /* i : weighted filter i response */
+ const Word16 *xn, /* i : target vector */
+ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
+ const Word16 tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */
);
Word32 dotp_fx( /* o : dot product of x[] and y[] */
@@ -3328,21 +3257,21 @@ Word32 syn_kern_16(
void syn_filt_s_lc_fx(
const Word16 shift, /* i : scaling to apply Q0 */
const Word16 a[], /* i : LP filter coefficients Q12 */
- const Word16 x[], /* i : input signal Qx */
+ const Word16 x[], /* i : i signal Qx */
Word16 y[], /* o : output signal Qx-s */
const Word16 lg /* i : size of filtering Q0 */
);
void acelp_2t32_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word16 dn[], /* i : corr. between target and h[]. */
- const Word16 h[], /* i : impulse response of weighted synthesis filter */
- Word16 code[], /* o : algebraic (fixed) codebook excitation */
- Word16 y[] /* o : filtered fixed codebook excitation */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 dn[], /* i : corr. between target and h[]. */
+ const Word16 h[], /* i : impulse response of weighted synthesis filter */
+ Word16 code[], /* o : algebraic (fixed) codebook excitation */
+ Word16 y[] /* o : filtered fixed codebook excitation */
);
Word16 acelp_4t64_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
Word16 dn[], /* i : corr. between target and h[]. */
const Word16 cn[], /* i : residual after long term prediction Q_new*/
const Word16 H[], /* i : impulse response of weighted synthesis filter Q12*/
@@ -3356,11 +3285,12 @@ Word16 acelp_4t64_fx(
);
void acelp_1t64_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word16 dn[], /* i : corr. between target and h[]. */
- const Word16 h[], /* i : impulse response of weighted synthesis filter */
- Word16 code[], /* o : algebraic (fixed) codebook excitation */
- Word16 y[] /* o : filtered fixed codebook excitation */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 dn[], /* i : corr. between target and h[]. */
+ const Word16 h[], /* i : impulse response of weighted synthesis filter */
+ Word16 code[], /* o : algebraic (fixed) codebook excitation */
+ Word16 y[], /* o : filtered fixed codebook excitation */
+ const Word16 L_subfr /* i : subframe length */
);
void cb_shape_fx(
@@ -3376,6 +3306,7 @@ void cb_shape_fx(
const Word16 tilt_code, /* i : tilt of code */
const Word16 pt_pitch, /* i : pointer to current subframe fractional pitch */
const Word16 shift
+ , const Word16 L_subfr /* i : subframe lenght */
);
void corr_xh_fx(
@@ -3466,28 +3397,20 @@ void unscale_AGC(
const Word16 n
);
-void LD_music_post_filter_fx(
- const Word16 dtc_in[], /* i : input synthesis Qdct */
+void LD_music_post_filter_fx
+(
+ MUSIC_POSTFILT_HANDLE hMusicPF, /* i/o: LD music postfilter handle */
+ const Word16 dtc_in[], /* i : i synthesis Qdct */
Word16 dtc_out[], /* o : output synthesis Qdct */
const Word32 core_brate, /* i : core bitrate Q0 */
- Word16 *last_music_flag, /* i/o : Previous music detection ouptut Q0 */
- Word16 *thresh, /* i/o : Detection thresold Q0 */
- Word16 *nb_thr_1, /* i/o : Number of consecutives frames of level 1 Q0 */
- Word16 *nb_thr_3, /* i/o : Number of consecutives frames of level 3 Q0 */
- Word16 *lt_diff_etot, /* i/o : Long term total energy variation Q8 */
- Word16 *mem_etot, /* i/o : Total energy memory Q8 */
- const Word16 min_ns_gain, /* i : minimum gain for inter-harm noise red. Q15 */
- Word32 bckr[], /* i/o : per band bckgnd. noise energy estimate */
- Word32 lf_EO[], /* i/o : old per bin E for previous half frame 2*Qdct+10 */
- Word16 lp_gbin[], /* i/o : smoothed suppression gain, per FFT bin Q15 */
- Word16 *filt_lfE, /* i : post filter weighting coefficient Q15 */
- Word16 *last_nonfull_music, /* i : Number of frames sinces la "speech like" frame Q0*/
- Word16 *Old_ener_Q, /* i/o : Old energy scaling factor */
+ Word16* Old_ener_Q, /* i/o : Old energy scaling factor */
const Word16 coder_type, /* i : Coder type : -1 in case of IO Q0 */
- const Word16 Last_coder_type, /* i : input scaling Q0 */
- const Word16 Qdct /* i : input scaling Q0 */
+ const Word16 Last_coder_type, /* i : i scaling Q0 */
+ const Word16 Qdct /* i : i scaling Q0 */
+);
+void music_postfilt_init(
+ MUSIC_POSTFILT_HANDLE hMusicPF /* i/o: LD music postfilter handle */
);
-
void Rescale_mem(
const Word16 Q_exc, /* i : current excitation scaling (>=0) */
Word16 *prev_Q_syn, /* i/o : scaling factor of previous frame */
@@ -3499,7 +3422,7 @@ void Rescale_mem(
Word16 *pst_old_syn, /* i/o: psfiler */
Word16 *pst_mem_deemp_err, /* i/o: psfiler */
Word16 *mem_agc,
- PFSTAT *pf_stat, /* i/o: All memories related to NB post filter */
+ PFSTAT_HANDLE hPFstat, /* i/o: All memories related to NB post filter */
const Word16 Vad_flag,
const Word16 Cna_flag,
const Word16 *tmp_buffer /* tmp_buffer in Q-1 */
@@ -3544,62 +3467,65 @@ void updt_IO_switch_dec_fx(
);
void prep_tbe_exc_fx(
- const Word16 L_frame_fx, /* i : length of the frame */
- const Word16 i_subfr_fx, /* i : subframe index */
- const Word16 gain_pit_fx, /* i : Pitch gain Q14*/
- const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/
- const Word16 code_fx[], /* i : algebraic excitation Q9*/
- const Word16 voice_fac_fx, /* i : voicing factor Q15*/
- Word16 *voice_factors_fx, /* o : TBE voicing factor Q15*/
- Word16 bwe_exc_fx[], /* i/o: excitation for TBE Q_exc*/
- const Word16 gain_preQ_fx, /* i : prequantizer excitation gain */
- const Word16 code_preQ_fx[], /* i : prequantizer excitation */
- const Word16 Q_exc, /* i : Excitation, bwe_exc Q-factor */
- Word16 T0, /* i : integer pitch variables Q0 */
- Word16 T0_frac, /* i : Fractional pitch variables Q0*/
- const Word16 coder_type, /* i : coding type */
- Word32 core_brate /* i :core bitrate */
+ const Word16 L_frame_fx, /* i : length of the frame */
+#ifdef ADD_IVAS_TBE_CODE
+ const Word16 L_subfr,
+#endif
+ const Word16 i_subfr_fx, /* i : subframe index */
+ const Word16 gain_pit_fx, /* i : Pitch gain Q14*/
+ const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/
+ const Word16 code_fx[], /* i : algebraic excitation Q9*/
+ const Word16 voice_fac_fx, /* i : voicing factor Q15*/
+ Word16 *voice_factors_fx, /* o : TBE voicing factor Q15*/
+ Word16 bwe_exc_fx[], /* i/o: excitation for TBE Q_exc*/
+ const Word16 gain_preQ_fx, /* i : prequantizer excitation gain */
+ const Word16 code_preQ_fx[],/* i : prequantizer excitation */
+ const Word16 Q_exc, /* i : Excitation, bwe_exc Q-factor */
+ Word16 T0, /* i : integer pitch variables Q0 */
+ Word16 T0_frac, /* i : Fractional pitch variables Q0*/
+ const Word16 coder_type, /* i : coding type */
+ Word32 core_brate /* i :core bitrate */
+#ifdef ADD_IVAS_TBE_CODE
+ ,const Word16 element_mode, /* i : element mode */
+ const Word16 idchan, /* i : channel ID */
+ const Word16 flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */
+ const Word16 tdm_LRTD_flag /* i : LRTD stereo mode flag */
+#endif
);
void interp_code_5over2_fx(
- const Word16 inp_code[], /* i : input vector */
+ const Word16 inp_code[], /* i : i vector */
Word16 interp_code[], /* o : output vector */
- const Word16 inp_length /* i : length of input vector */
+ const Word16 inp_length /* i : length of i vector */
);
void lsp2lsf_fx(
- const Word16 lsp[], /* i : lsp[m] (range: -1<=val<1) Q15*/
- Word16 lsf[], /* o : lsf[m] normalized (range: 0.0<=val<=0.5) Q(x2.56)*/
- const Word16 m, /* i : LPC order Q0*/
- Word32 int_fs
+ const Word16 lsp[], /* i : lsp[m] (range: -1<=val<1) Q15*/
+ Word16 lsf[], /* o : lsf[m] normalized (range: 0.0<=val<=0.5) Q(x2.56)*/
+ const Word16 m, /* i : LPC order Q0*/
+ const Word32 int_fs /* i : internal sampling frequency */
);
void lsf_enc_fx(
- Encoder_State_fx *st_fx, /* i/o: state structure */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 coder_type, /* i : coding type */
- Word16 *lsf_new, /* o : quantized LSF vector */
- Word16 *lsp_new, /* i/o: LSP vector to quantize/quantized */
- Word16 *lsp_mid, /* i/o : mid-frame LSP vector */
- Word16 *Aq, /* o : quantized A(z) for 4 subframes */
- Word16 *stab_fac, /* o : LSF stability factor */
+ Encoder_State_fx* st_fx, /* i/o: state structure */
+ Word16* lsf_new, /* o : quantized LSF vector */
+ Word16* lsp_new, /* i/o: LSP vector to quantize/quantized */
+ Word16* lsp_mid, /* i/o : mid-frame LSP vector */
+ Word16* Aq, /* o : quantized A(z) for 4 subframes */
const Word16 Nb_ACELP_frames,
- const Word16 Q_new
+ const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */
+ const Word16 GSC_IVAS_mode, /* i : GSC IVAS mode */
+#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+ const float tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel */
+#endif
+ const Word16 Q_new
);
void lsf_mid_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- const Word16 int_fs, /* i : internal (ACELP) sampling frequency */
- Word16 qlsp0[], /* i : quantized LSPs from frame beginning Q15*/
- Word16 qlsp1[], /* i : quantized LSPs from frame endSQ15*/
- Word16 coder_type, /* i : Coder type */
- Word16 qlsp[], /* o : quantized LSPs Q15*/
- const Word32 core_brate, /* i : core bitrate */
- Word16 ppp_mode,
- Word16 nelp_mode,
- Word16 prev_bfi,
- Word16 *mid_lsf_int,
- Word16 safety_net
+ Decoder_State_fx* st_fx, /* i/o: decoder state structure */
+ Word16 lsp_new[], /* i : quantized LSPs from frame endSQ15*/
+ Word16 coder_type, /* i : Coder type */
+ Word16 lsp_mid[] /* o : quantized LSPs Q15*/
);
Word16 lsf_stab_fx( /* o : LP filter stability Q15*/
@@ -3609,16 +3535,16 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/
const Word16 L_frame /* i : frame length */
);
-void lsf_allocate_fx(
- const Word16 nBits, /* i : Number of bits to use for quantization */
- const Word16 framemode, /* i : ISF quantizer mode */
- const Word16 framemode_p, /* i : ISF quantizer mode predmode (mode_lvq_p) */
- Word16 *stages0, /* o : Number of stages for safety-net quantizer */
- Word16 *stages1, /* o : Number of stages for predictive quantizer */
- Word16 levels0[], /* o : Number of vectors for each stage for SFNET */
- Word16 levels1[], /* o : Number of vectors for each stage for pred */
- Word16 bits0[], /* o : Number of bits for each stage safety net */
- Word16 bits1[] /* o : Number of bits for each stage pred */
+ivas_error lsf_allocate_fx(
+ const Word16 nBits, /* i : Number of bits to use for quantization */
+ const Word16 framemode, /* i : ISF quantizer mode */
+ const Word16 framemode_p, /* i : ISF quantizer mode predmode (mode_lvq_p) */
+ Word16* stages0, /* o : Number of stages for safety-net quantizer */
+ Word16* stages1, /* o : Number of stages for predictive quantizer */
+ Word16 levels0[], /* o : Number of vectors for each stage for SFNET */
+ Word16 levels1[], /* o : Number of vectors for each stage for pred */
+ Word16 bits0[], /* o : Number of bits for each stage safety net */
+ Word16 bits1[] /* o : Number of bits for each stage pred */
);
Word16 vq_dec_lvq_fx (
Word16 sf_flag, /* i : safety net flag */
@@ -3642,11 +3568,11 @@ Word16 qlsf_ARSN_tcvq_Dec_16k_fx (
const Word16 nBits /* i : number of bits */
);
-void tcvq_Dec_fx(Word16 *ind,
- /*float *d_out, */
- Word16 *d_out_fx,
- Word16 safety_net
- );
+void tcvq_Dec_fx(
+ Word16* ind,
+ Word16* d_out_fx,
+ const Word16 safety_net
+);
Word32 qlsf_ARSN_tcvq_Enc_16k_fx(
const Word16 *x_fx, /* i : Vector to be encoded x2.65 */
@@ -3681,7 +3607,12 @@ void index_lvq_fx (
Word32 * p_offset_scale2,
Word16 * p_no_scales
);
-
+void create_offset(
+ Word32* offset_scale1,
+ Word32* offset_scale2,
+ const Word16 mode,
+ const Word16 prediction_flag
+);
void multiply32_32_64_fx(
Word32 x,
Word32 y,
@@ -3694,7 +3625,7 @@ void permute_fx(
);
Word32 mslvq_fx (
- Word16 *pTmp, /* i : M-dimensional input vector */
+ Word16 *pTmp, /* i : M-dimensional i vector */
Word16 *quant, /* o : quantized vector */
Word16 *cv_out, /* o : corresponding 8-dim lattice codevectors (without the scaling) */
Word16 *idx_lead, /* o : leader index for each 8-dim subvector */
@@ -3708,7 +3639,7 @@ Word32 mslvq_fx (
Word32 mslvq_cng_fx (
Word16 idx_cv, /* i : index of cv from previous stage */
- Word16 *pTmp, /* i : 16 dimensional input vector x2.56*/
+ Word16 *pTmp, /* i : 16 dimensional i vector x2.56*/
Word16 *quant, /* o : quantized vector x2.56*/
Word16 *cv_out, /* o : corresponding 8-dim lattice codevectors (without the scaling) Q13*/
Word16 *idx_lead, /* o : leader index for each 8-dim subvector */
@@ -3724,74 +3655,60 @@ void sort_fx(
);
void lsf_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: State structure */
+ Decoder_State_fx* st_fx, /* i/o: State structure */
const Word16 tc_subfr, /* i : TC subframe index */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 coder_type, /* i : coding type */
- const Word16 bwidth, /* i : input signal bandwidth */
- Word16 *Aq, /* o : quantized A(z) for 4 subframes */
- Word16 *LSF_Q_prediction, /* o : LSF prediction mode */
- Word16 *lsf_new, /* o : de-quantized LSF vector */
- Word16 *lsp_new, /* o : de-quantized LSP vector */
- Word16 *lsp_mid /* o : de-quantized mid-frame LSP vector */
+ Word16* Aq, /* o : quantized A(z) for 4 subframes */
+ Word16* LSF_Q_prediction, /* o : LSF prediction mode */
+ Word16* lsf_new, /* o : de-quantized LSF vector */
+ Word16* lsp_new, /* o : de-quantized LSP vector */
+ Word16* lsp_mid, /* o : de-quantized mid-frame LSP vector */
+ const Word16 tdm_low_rate_mode /* i : secondary channel low rate mode flag */
+#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+ , const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */
+#endif
);
void lsf_end_enc_fx(
- Encoder_State_fx *st,
- const Word16 *lsf,
- Word16 *qlsf,
- Word16 *mem_AR,
- Word16 * mem_MA,
- const Word16 nBits,
- const Word16 coder_type_org,
- const Word16 bwidth,
- Word32 *Bin_Ener,
- Word16 Q_ener,
- const Word32 int_fs,
- Word32 core_brate,
- Word16 *streaklimit,
- Word16 *pstreaklen,
- Word16 force_sf,
- Word16 RF_flag,
- Word16 mode2_flag,
- Word16 * lpc_param,
- Word16 * no_stages,
- Word16 * bits_param_lpc,
- Word16 coder_type_raw
+ Encoder_State_fx* st, /* i/o: encoder state structure */
+ const Word16* lsf, /* i : LSF in the frequency domain (0..6400) */
+ Word16* qlsf, /* o : quantized LSF */
+ const Word16 nBits_in, /* i : number of bits to spend on ISF quantization */
+ const Word16 coder_type_org, /* i : coding type */
+ Word16 Q_ener, /* i : Q valuen for Bin_Ener */
+ Word16 force_sf, /* i : Force safety-net usage if coding type supports */
+ Word16* lpc_param,
+ Word16* no_indices,
+ Word16* bits_param_lpc,
+ Word16 coder_type_raw /* i : Coder type (LSF coder_type have some special cases)*/
+#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+ , const Word16 tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */
+#endif
);
void lsf_end_dec_fx(
- Decoder_State_fx *st,
+ Decoder_State_fx* st, /* i/o: decoder state structure */
Word16 mode2_flag,
- const Word16 coder_type_org,
- const Word16 bwidth,
- const Word16 nBits,
- Word16 *qlsf,
- Word16 *mem_AR,
- Word16 *mem_MA,
- const Word32 int_fs,
- Word32 core_brate,
- Word32 *p_offset_scale1,
- Word32 *p_offset_scale2,
- Word32 *p_offset_scale1_p,
- Word32 *p_offset_scale2_p,
- Word16 *p_no_scales,
- Word16 *p_no_scales_p,
- Word16 *safety_net,
- Word16 *lpc_param,
- Word16 *LSF_Q_prediction, /* o : LSF prediction mode */
- Word16 * nb_indices
+ const Word16 coder_type_org, /* i : coding type */
+ const Word16 bwidth, /* i : i signal bandwidth */
+ const Word16 nBits_in, /* i : number of bits used for ISF quantization*/
+ Word16* qlsf, /* o : quantized LSFs in the cosine domain */
+ Word16* lpc_param,
+ Word16* LSF_Q_prediction, /* o : LSF prediction mode */
+ Word16* nb_indices
+#ifdef LSF_RE_USE_SECONDARY_CHANNEL
+ , const float tdm_lsfQ_PCh[M]
+#endif
);
-Word16 find_pred_mode(
- const Word16 coder_type,
- const Word16 bwidth,
- const Word32 int_fs,
- Word16 * p_mode_lvq,
- Word16 * p_mode_lvq_p,
- Word32 core_brate
+ivas_error find_pred_mode(
+ Word16* predmode, /* o: prediction mode */
+ const Word16 coder_type, /* i: coding type */
+ const Word16 bwidth, /* i: bandwidth index */
+ const Word32 int_fs, /* i: sampling frequency */
+ Word16* p_mode_lvq, /* o: index of LSF codebooks in safety net mode */
+ Word16* p_mode_lvq_p, /* o: index of LSF codebooks in predictive mode (AR or MA) */
+ Word32 core_brate /* i: core bit rate */
);
-
Word16 xsf_to_xsp(
Word16 lsf
);
@@ -3812,8 +3729,8 @@ void int_lsp4_fx(
Word16 modify_Fs_fx( /* o : length of output Q0 */
const Word16 sigIn_fx[], /* i : signal to decimate Q0 */
- Word16 lg, /* i : length of input Q0 */
- const Word32 fin, /* i : frequency of input Q0 */
+ Word16 lg, /* i : length of i Q0 */
+ const Word32 fin, /* i : frequency of i Q0 */
Word16 sigOut_fx[], /* o : decimated signal Q0 */
const Word32 fout, /* i : frequency of output Q0 */
Word16 mem_fx[], /* i/o: filter memory Q0 */
@@ -3834,52 +3751,38 @@ void addBassPostFilterFx(
);
void bass_psfilter_fx(
- const Word16 Opt_AMR_WB, /* i : AMR-WB IO flag */
- Word16 synth_in_fx[], /* i : input synthesis (at 16kHz) */
- const Word16 L_frame, /* i : length of the last frame */
+ BPF_DEC_HANDLE hBPF, /* i/o: BPF data handle */
+ const Word16 Opt_AMR_WB, /* i : AMR-WB IO flag */
+ Word16 synth_in_fx[], /* i : i synthesis (at 16kHz) */
+ const Word16 L_frame, /* i : length of the last frame */
Word16 pitch_buf_fx[], /* i : pitch for every subfr [0,1,2,3] */
- Word16 old_syn_fx[], /* i/o: NBPSF_PIT_MAX */
- Word16 *mem_deemph_err, /* o : Error deemphasis memory */
- Word16 *lp_ener, /* o : long_term error signal energy */
- const Word16 bpf_off, /* i : do not use BPF when set to 1 */
- Word16 v_stab_fx, /* i : stability factor */
- Word16 *v_stab_smooth_fx, /* i/o: smoothed stability factor */
- Word16 *mem_mean_pit, /* i/o: average pitch memory */
- Word16 *Track_on_hist, /* i/o: History of half frame usage */
- Word16 *vibrato_hist, /* i/o: History of frames declared as vibrato*/
- Word16 *psf_att, /* i/o: Post filter attenuation factor */
- const Word16 coder_type, /* i : coder_type */
+ const Word16 bpf_off, /* i : do not use BPF when set to 1 */
+ Word16 v_stab_fx, /* i : stability factor */
+ Word16* v_stab_smooth_fx, /* i/o: smoothed stability factor */
+ const Word16 coder_type, /* i : coder_type */
Word16 Q_syn,
- Word16 bpf_noise_buf[] /* o : BPF error signal (at int_fs) */
+ Word16 bpf_noise_buf[] /* o : BPF error signal (at int_fs) */
);
void speech_music_classif_fx(
- Encoder_State_fx *st, /* i/o: state structure */
- Word16 *sp_aud_decision0,
- Word16 *sp_aud_decision1, /* o : 1st stage speech/music */
- Word16 *sp_aud_decision2, /* o : 2nd stage speech/music */
- const Word16 *new_inp, /* i : new input signal */
- const Word16 *inp, /* i : input signal to locate attach position */
- const Word16 vad_flag,
- const Word16 localVAD,
+ Encoder_State_fx* st, /* i/o: state structure */
+ const Word16* new_inp, /* i : new input signal */
+ const Word16* inp, /* i : input signal to locate attach position */
const Word16 localVAD_HE_SAD, /* i : HE-SAD flag without hangover */
- const Word16 pitch[3], /* i : open-loop pitch estimate in three subframes */
- const Word16 voicing[3], /* i : voicing estimate in three subframes Q15 */
const Word16 lsp_new[M], /* i : LSPs in current frame Q15 */
const Word16 cor_map_sum, /* i : correlation map sum (from multi-harmonic anal.)Q8*/
- const Word32 epsP[M+1], /* i : LP prediciton error Q_esp*/
+ const Word32 epsP[M + 1], /* i : LP prediciton error Q_esp*/
const Word32 PS[], /* i : energy spectrum Q_new+QSCALE*/
const Word16 Etot, /* i : total frame energy Q8 */
const Word16 old_cor, /* i : max correlation from previous frame Q15 */
- Word16 *coder_type, /* i/o: coding type */
- Word16 *attack_flag, /* o : flag to indicate if attack is to be treated by TC or GSC */
+ Word16* attack_flag, /* o : flag to indicate if attack is to be treated by TC or GSC */
Word16 non_sta, /* i : unbound non-stationarity for sp/mus classifier */
Word16 relE, /* i : relative frame energy */
Word16 Q_esp, /* i : scaling of esP */
- Word16 Q_inp /* i : scaling of input */
- ,Word16 *high_lpn_flag_ptr /* o : noise log prob flag for NOISE_EST */
- ,Word16 flag_spitch /* i: flag to indicate very short stable pitch */
-);
+ Word16 Q_inp, /* i : scaling of input */
+ Word16* high_lpn_flag_ptr, /* o : noise log prob flag for NOISE_EST */
+ Word16 flag_spitch /* i : flag to indicate very short stable pitch */
+ );
Word32 sub_lsp2lsf_fx(
const Word16 lsp_i /* i : lsp[m] (range: -1<=val<1) Q15*/
@@ -3916,18 +3819,32 @@ void Es_pred_enc_fx(
const Word16 no_ltp, /* i : no_ltp flag */
Word16 Q_new /* i : Scaling in speech Q0 */
);
-
+void calculate_hangover_attenuation_gain(
+ Encoder_State_fx* st, /* i : encoder state structure */
+ Word16* att, /* o : attenuation factor */
+ const Word16 vad_hover_flag /* i : VAD hangover flag */
+);
+void v_multc_att(
+ const Word16 x[], /* i : Input vector Qx */
+ const Word16 att, /* i : Constant Q15, <= MAX_16 */
+ Word16 y[], /* o : Output vector that contains att*x */
+ const Word16 N /* i : Vector length */
+);
+void v_multc_att32(
+ const Word32 x[], /* i : Input vector Qx */
+ const Word16 att, /* i : Constant Q15, <= MAX_16 */
+ Word32 y[], /* o : Output vector that contains att*x */
+ const Word16 N /* i : Vector length */
+);
void calc_residu_fx(
- Encoder_State_fx *st, /* i/o: state structure */
- const Word16 *speech, /* i : weighted speech signal */
- Word16 *res, /* o : residual signal */
- const Word16 *p_Aq, /* i : quantized LP filter coefficients */
- const Word16 vad_hover_flag,
- const Word16 vad_flag_dtx
+ Encoder_State_fx* st, /* i/o: state structure */
+ const Word16* speech, /* i : weighted speech signal */
+ Word16* res, /* o : residual signal */
+ const Word16* p_Aq /* i : quantized LP filter coefficients */
);
void updt_IO_switch_enc_fx(
Encoder_State_fx *st, /* i/o: state structure */
- const Word16 input_frame /* i : input frame length */
+ const Word16 input_frame /* i : i frame length */
);
/*-------------------------------------------------------------------*
* pre_proc()
@@ -3938,19 +3855,15 @@ void updt_IO_switch_enc_fx(
void pre_proc_fx(
Encoder_State_fx *st, /* i/o: encoder state structure */
const Word16 input_frame, /* i : frame length */
- const Word16 signal_in[], /* i : new samples */
- Word16 old_inp_12k8[], /* i/o: buffer of old input signal */
- Word16 old_inp_16k[], /* i/o: buffer of old input signal @ 16kHz */
+ Word16 old_inp_12k8[], /* i/o: buffer of old i signal */
+ Word16 old_inp_16k[], /* i/o: buffer of old i signal @ 16kHz */
Word16 **inp, /* o : ptr. to inp. signal in the current frame */
- Word16 *sp_aud_decision1, /* o : 1st stage speech/music classification */
- Word16 *sp_aud_decision2, /* o : 2nd stage speech/music classification */
Word32 fr_bands[2*NB_BANDS], /* o : energy in frequency bands */
- Word16 *vad_flag,
- Word16 *localVAD,
Word16 *Etot, /* o : total energy */
Word32 *ener, /* o : residual energy from Levinson-Durbin */
- Word16 pitch[3], /* o : open-loop pitch values for quantiz. */
- Word16 voicing[3], /* o : OL maximum normalized correlation */
+#ifndef FIX_I4_OL_PITCH
+ Word16 pitch_orig[3], /* o : open-loop pitch values for quantization */
+#endif
Word16 A[NB_SUBFR16k*(M+1)], /* o : A(z) unquantized for the 4 subframes */
Word16 Aw[NB_SUBFR16k*(M+1)], /* o : weighted A(z) unquantized for subframes */
Word16 epsP_h[M+1], /* o : LP prediction errors */
@@ -3958,11 +3871,9 @@ void pre_proc_fx(
Word32 epsP[M+1], /* o : LP prediction errors */
Word16 lsp_new[M], /* o : LSPs at the end of the frame */
Word16 lsp_mid[M], /* o : LSPs in the middle of the frame */
- Word16 *coder_type, /* o : coder type */
- Word16 *sharpFlag, /* o : formant sharpening flag */
Word16 *vad_hover_flag,
Word16 *attack_flag, /* o : flag signalling attack encoded by AC mode (GSC) */
- Word16 *new_inp_resamp16k, /* o : new input signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */
+ Word16 *new_inp_resamp16k, /* o : new i signal @16kHz, non pre-emphasised, used by the WB TBE/BWE */
Word16 *Voicing_flag, /* o : voicing flag for HQ FEC */
Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o : cldfb real buffer */
@@ -3978,9 +3889,9 @@ void pre_proc_fx(
Word16 mdct_classifier_fx( /* o: MDCT A/B decision */
const Word16 *Y, /* i: re[0], re[1], ..., re[n/2], im[n/2 - 1], im[n/2 - 2], ..., im[1] */
Encoder_State_fx *st_fx, /* i/o: Encoder state variable */
- Word16 vadflag
- ,Word32 *cldfbBuf_Ener
- ,Word16 enerBuffer_exp
+ Word32 *cldfbBuf_Ener,
+ Word16 enerBuffer_exp,
+ const Word32 brate /* i : current brate, IVAS: nominal bitrate, EVS: st->total_brate */
);
void floating_point_add(
@@ -3989,40 +3900,51 @@ void floating_point_add(
const Word32 my, /* i: mantissa of the adder Q31 */
const Word16 ey /* i: exponent of the adder Q0 */
);
+void delay_signal(
+ Word16 x[], /* i/o: signal to be delayed */
+ const Word16 len, /* i : length of the i signal */
+ Word16 mem[], /* i/o: synchronization memory */
+ const Word16 delay /* i : delay in samples */
+);
void MDCT_selector(
- Encoder_State_fx *st /* i/o: Encoder State */
- , Word16 sp_floor /* i : Noise floor estimate Q7 */
- , Word16 Etot /* i : Total energy Q8 */
- , Word16 cor_map_sum /* i : harmonicity factor Q8 */
- , const Word16 voicing[] /* i : voicing factors Q15*/
- , const Word32 enerBuffer[] /* i : CLDFB buffers */
- , Word16 enerBuffer_exp /* i : exponent of enerBuffer */
- , Word16 vadflag
+ Encoder_State_fx* st, /* i/o: Encoder State */
+ Word16 sp_floor, /* i : Noise floor estimate Q7 */
+ const Word16 Etot, /* i : Total energy Q8 */
+ const Word16 cor_map_sum, /* i : harmonicity factor Q8 */
+ const Word32 enerBuffer[], /* i : CLDFB buffers */
+ const Word16 enerBuffer_exp /* i : exponent of enerBuffer */
);
void MDCT_selector_reset(
- Encoder_State_fx *st); /* i/o: Encoder State */
+ TCX_ENC_HANDLE hTcxEnc
+);
+void MDCT_classifier_reset(
+ TCX_ENC_HANDLE hTcxEnc /* i/o: TCX Encoder Handle */
+);
+void fd_bwe_enc_init(
+ FD_BWE_ENC_HANDLE hBWE_FD /* i/o: FD BWE data handle */
+);
-Word16 minimum_fx( /* o : index of the minimum value in the input vector */
- const Word16 *vec_fx, /* i : input vector */
- const Word16 lvec_fx, /* i : length of input vector */
- Word16 *min_fx /* o : minimum value in the input vector */
+Word16 minimum_fx( /* o : index of the minimum value in the i vector */
+ const Word16 *vec_fx, /* i : i vector */
+ const Word16 lvec_fx, /* i : length of i vector */
+ Word16 *min_fx /* o : minimum value in the i vector */
);
-Word16 minimum_32_fx( /* o : index of the minimum value in the input vector */
- const Word32 *vec_fx, /* i : input vector */
- const Word16 lvec_fx, /* i : length of input vector */
- Word32 *min_fx /* o : minimum value in the input vector */
+Word16 minimum_32_fx( /* o : index of the minimum value in the i vector */
+ const Word32 *vec_fx, /* i : i vector */
+ const Word16 lvec_fx, /* i : length of i vector */
+ Word32 *min_fx /* o : minimum value in the i vector */
);
-Word16 maximum_32_fx( /* o : index of the maximum value in the input vector */
- const Word32 *vec, /* i : input vector */
- const Word16 lvec, /* i : length of input vector */
- Word32 *max /* o : maximum value in the input vector */
+Word16 maximum_32_fx( /* o : index of the maximum value in the i vector */
+ const Word32 *vec, /* i : i vector */
+ const Word16 lvec, /* i : length of i vector */
+ Word32 *max /* o : maximum value in the i vector */
);
-Word16 maximum_fx( /* o : index of the maximum value in the input vector */
- const Word16 *vec_fx, /* i : input vector */
- const Word16 lvec_fx, /* i : length of input vector */
- Word16 *max_fx /* o : maximum value in the input vector */
+Word16 maximum_fx( /* o : index of the maximum value in the i vector */
+ const Word16 *vec_fx, /* i : i vector */
+ const Word16 lvec_fx, /* i : length of i vector */
+ Word16 *max_fx /* o : maximum value in the i vector */
);
Word16 Exp32Array(
const Word16 n, /* (i): Array size */
@@ -4034,8 +3956,8 @@ Word16 Exp16Array(
);
Word32 sum16_32_fx( /* o : sum of all vector elements Qx*/
- const Word16 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+ const Word16 *vec, /* i : i vector Qx*/
+ const Word16 lvec /* i : length of i vector */
);
Word32 dot_product_mat_fx( /* o : the dot product x'*A*x */
const Word16 *x, /* i : vector x Q15 */
@@ -4045,28 +3967,28 @@ Word32 dot_product_mat_fx( /* o : the dot product x'*A*x */
);
Word16 std_fx( /* o: standard deviation */
- const Word16 *x, /* i: input vector */
- const Word16 len /* i: length of the input vector */
+ const Word16 *x, /* i: i vector */
+ const Word16 len /* i: length of the i vector */
);
Word16 stab_est_fx(
Word16 etot, /* i : Total energy of the current frame */
- Word16 *lt_diff_etot, /* i/o : Long term total energy variation */
- Word16 *mem_etot, /* i/o : Total energy memory */
- Word16 *nb_thr_3, /* i/o : Number of consecutives frames of level 3 */
- Word16 *nb_thr_1, /* i/o : Number of consecutives frames of level 1 */
- Word16 *thresh, /* i/o : Detection thresold */
- Word16 *last_music_flag,/* i/o : Previous music detection ouptut */
- Word16 vad_flag
+ Word16* lt_diff_etot, /* i/o : Long term total energy variation */
+ Word16* mem_etot, /* i/o : Total energy memory */
+ Word16* nb_thr_3, /* i/o : Number of consecutives frames of level 3 */
+ Word16* nb_thr_1, /* i/o : Number of consecutives frames of level 1 */
+ Word16* thresh, /* i/o : Detection thresold */
+ Word16* last_music_flag,/* i/o : Previous music detection ouptut */
+ const Word16 vad_flag /* i : VAD flag */
);
Word16 var_fx( /* o: variance of vector Qx*/
- const Word16 *x, /* i: input vector Qx*/
+ const Word16 *x, /* i: i vector Qx*/
const Word16 Qx,
const Word16 len /* i: length of inputvector */
);
void conv_fx(
- const Word16 x[], /* i : input vector Q_new*/
- const Word16 h[], /* i : impulse response (or second input vector) Q(15)*/
+ const Word16 x[], /* i : i vector Q_new*/
+ const Word16 h[], /* i : impulse response (or second i vector) Q(15)*/
Word16 y[], /* o : output vetor (result of convolution) 12 bits*/
const Word16 L /* i : vector size */
);
@@ -4080,7 +4002,7 @@ void norm_corr_fx(
const Word16 L_subfr /* i : subframe size */
);
void pit_Q_enc_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode */
const Word16 nBits, /* i : # of Q bits */
const Word16 delta, /* i : Half the CL searched interval */
@@ -4118,28 +4040,28 @@ Word16 pitch_fr4_fx( /* o : chosen integer pitch lag
);
Word32 var_fx_32( /* o: variance of vector Qx+16*/
- const Word16 *x, /* i: input vector Qx*/
+ const Word16 *x, /* i: i vector Qx*/
const Word16 Qx,
const Word16 len /* i: length of inputvector */
);
Word16 sum16_fx( /* o : sum of all vector elements Qx*/
- const Word16 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+ const Word16 *vec, /* i : i vector Qx*/
+ const Word16 lvec /* i : length of i vector */
);
Word32 sum32_fx( /* o : sum of all vector elements Qx*/
- const Word32 *vec, /* i : input vector Qx*/
- const Word16 lvec /* i : length of input vector */
+ const Word32 *vec, /* i : i vector Qx*/
+ const Word16 lvec /* i : length of i vector */
);
Word32 Mean32( /* o : mean of the elements of the vector */
- const Word32 in[], /* i : input vector */
- const Word16 L /* i : length of input vector */
+ const Word32 in[], /* i : i vector */
+ const Word16 L /* i : length of i vector */
);
void Deemph2(
- Word16 x[], /* i/o: input signal overwritten by the output Qx/Qx-1 */
+ Word16 x[], /* i/o: i signal overwritten by the output Qx/Qx-1 */
const Word16 mu, /* i : deemphasis factor Q15 */
const Word16 L, /* i : vector size Q0 */
Word16 *mem /* i/o: memory (y[-1]) Qx-1 */
@@ -4165,14 +4087,14 @@ void Syn_filt_s(
const Word16 shift, /* i : scaling to apply Q0 */
const Word16 a[], /* i : LP filter coefficients Q12 */
const Word16 m, /* i : order of LP filter Q0 */
- const Word16 x[], /* i : input signal Qx */
+ const Word16 x[], /* i : i signal Qx */
Word16 y[], /* o : output signal Qx-s */
const Word16 lg, /* i : size of filtering Q0 */
Word16 mem[], /* i/o: memory associated with this filtering. Qx-s */
const Word16 update /* i : 0=no update, 1=update of memory. Q0 */
);
void hp400_12k8_fx(
- Word16 signal[], /* i/o: input signal / output is divided by 16 */
+ Word16 signal[], /* i/o: i signal / output is divided by 16 */
const Word16 lg, /* i : lenght of signal */
Word16 mem[] /* i/o: filter memory [6] */
);
@@ -4180,7 +4102,7 @@ Word16 dot_prod_satcontr(const Word16 *x, const Word16 *y, Word16 qx, Word16 qy,
void syn_12k8_fx(
Word16 L_frame,
const Word16 *Aq, /* i : LP filter coefficients Q12 */
- const Word16 *exc, /* i : input signal Q_exc */
+ const Word16 *exc, /* i : i signal Q_exc */
Word16 *synth, /* o : output signal Q_syn */
Word16 *mem, /* i/o: initial filter states Q_syn */
const Word16 update_m, /* i : update memory flag: 0 --> no memory update Q0 */
@@ -4190,8 +4112,6 @@ void syn_12k8_fx(
);
void updt_dec_fx(
Decoder_State_fx *st_fx, /* i/o: state structure */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 coder_type, /* i : coding type */
const Word16 *old_exc_fx, /* i : buffer of excitation */
const Word16 *pitch_buf_fx, /* i : floating pitch values for each subframe */
const Word16 Es_pred, /* i : predicited scaled innovation energy */
@@ -4203,7 +4123,7 @@ void updt_dec_fx(
, const Word16 *gain_buf /*Q14*/
);
Word32 Interpol_lc_fx( /* o : interpolated value Qx+16 */
- const Word16 *x, /* i : input vector Q0 */
+ const Word16 *x, /* i : i vector Q0 */
const Word16 *win, /* i : interpolation window Q14 */
const Word16 frac, /* i : fraction (0..up_samp) Q0 */
const Word16 up_samp, /* i : upsampling factor Q0 */
@@ -4230,18 +4150,16 @@ void updt_tar_HR_fx(
Word16 *x2, /* o : new target (for codebook search) */
const Word16 *y, /* i : filtered adaptive codebook vector */
const Word16 gain, /* i : adaptive codebook gain */
- const Word16 Qx, /* i : Scaling factor to adapt output to input */
+ const Word16 Qx, /* i : Scaling factor to adapt output to i */
const Word16 L /* i : subframe size */
);
Word16 lp_filt_exc_enc_fx(
const Word16 codec_mode, /* i : MODE1 or MODE2 Q0 */
- const Word32 core_brate, /* i : core bitrate Q0 */
- const Word16 Opt_AMR_WB, /* i : flag indicating AMR-WB IO mode Q0 */
const Word16 coder_type, /* i : coding type Q0 */
const Word16 i_subfr, /* i : subframe index Q0 */
Word16 *exc, /* i/o: pointer to excitation signal frame Q_new */
- const Word16 *h1, /* i : weighted filter input response Q(14+shift) */
+ const Word16 *h1, /* i : weighted filter i response Q(14+shift) */
const Word16 *xn, /* i : target vector Q_new-1+shift */
Word16 *y1, /* o : zero-memory filtered adaptive excitation Q_new-1+shift */
Word16 *xn2, /* o : target vector for innovation search Q_new-1+shift */
@@ -4254,7 +4172,7 @@ Word16 lp_filt_exc_enc_fx(
);
Word16 Interpol_4( /* o : interpolated value */
- Word16 * x, /* i : input vector */
+ Word16 * x, /* i : i vector */
Word16 frac /* i : fraction (-4..+3) */
);
@@ -4269,35 +4187,43 @@ void r_fft_fx_lc(
);
void hf_synth_fx(
- const Word32 core_brate, /* i : core bitrate */
- const Word16 output_frame, /* i : output frame length */
- const Word16 *Aq, /* i : quantized Az */
- const Word16 *exc, /* i : excitation at 12.8 kHz */
- Word16 *synth, /* i : 12.8kHz synthesis signal */
- Word16 *synth16k, /* o : 16kHz synthesis signal */
- Word16 *seed2, /* i/o: random seed for HF noise gen */
- Word16 *mem_hp400, /* i/o: memory of hp 400 Hz filter */
- Word16 *mem_syn_hf, /* i/o: HF synthesis memory */
- Word16 *mem_hf, /* i/o: HF band-pass filter memory */
- const Word16 Q_exc, /* i : excitation scaling */
- const Word16 Q_syn2, /* i : synthesis scaling */
- Word16 *delay_syn_hf, /*i/o: HF synthesis memory */
- Word16 *memExp1, /* o : HF excitation exponent */
- Word16 *mem_hp_interp, /* i/o: interpol. memory */
- const Word16 extl, /* i : flag indicating BWE */
- const Word16 CNG_mode /* i : CNG_mode */
-);
-void acelp_core_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- Word16 synth_out[], /* o : synthesis */
- Word32 bwe_exc_extended[], /* i/o: bandwidth extended excitation */
- Word16 *voice_factors, /* o : voicing factors */
- Word16 old_syn_12k8_16k[], /* o : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE */
- Word16 coder_type_fx, /* i : coder type */
+ ZERO_BWE_DEC_HANDLE hBWE_zero, /* i/o: handle to 0 bit BWE parameters */
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16 output_frame, /* i : output frame length */
+ const Word16* Aq, /* i : quantized Az */
+ const Word16* exc, /* i : excitation at 12.8 kHz */
+ Word16* synth, /* i : 12.8kHz synthesis signal */
+ Word16* synth16k, /* o : 16kHz synthesis signal */
+ const Word16 Q_exc, /* i : excitation scaling */
+ const Word16 Q_syn2, /* i : synthesis scaling */
+ Word16* delay_syn_hf, /*i/o: HF synthesis memory */
+ Word16* memExp1, /* o : HF excitation exponent */
+ Word16* mem_hp_interp, /* i/o: interpol. memory */
+ const Word16 extl, /* i : flag indicating BWE */
+ const Word16 CNG_mode /* i : CNG_mode */
+);
+ivas_error acelp_core_dec_fx(
+ Decoder_State_fx* st_fx, /* i/o: decoder state structure */
+ Word16 output[], /* o : synthesis @internal Fs */
+ Word16 synth_out[], /* o : synthesis */
+ Word16 save_hb_synth[], /* o : HB synthesis */
+ Word32 bwe_exc_extended[], /* i/o: bandwidth extended excitation */
+ Word16* voice_factors, /* o : voicing factors */
+ Word16 old_syn_12k8_16k[], /* o : intermediate ACELP synthesis for SWB BWE */
Word16 sharpFlag,
- Word16 pitch_buf_fx[NB_SUBFR16k], /* o : floating pitch for each subframe */
- Word16 *unbits /* o : number of unused bits */
- ,Word16 *sid_bw /* o : 0-NB/WB, 1-SWB SID */
+ Word16 pitch_buf_fx[NB_SUBFR16k], /* o : floating pitch for each subframe */
+ Word16* unbits, /* o : number of unused bits */
+ Word16* sid_bw /* o : 0-NB/WB, 1-SWB SID */
+ ,STEREO_TD_DEC_DATA_HANDLE hStereoTD, /* i/o: TD stereo decoder handle */
+ const Word16 tdm_lspQ_PCh[M], /* i : Q LSPs for primary channel */
+ const Word16 tdm_lsfQ_PCh[M], /* i : Q LSFs for primary channel */
+ const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */
+ const Word16 last_element_mode, /* i : last element mode */
+ const Word32 last_element_brate, /* i : last element bitrate */
+ const Word16 flag_sec_CNA, /* i : CNA flag for secondary channel */
+ const Word16 nchan_out, /* i : number of output channels */
+ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : stereo CNG handle */
+ const Word16 read_sid_info /* i : read SID info flag */
);
void Inac_swtch_ematch_fx(
Word16 exc2[], /* i/o: CELP/GSC excitation buffer Q_exc*/
@@ -4306,46 +4232,44 @@ void Inac_swtch_ematch_fx(
const Word16 coder_type, /* i : Coding mode */
const Word16 L_frame, /* i : Frame lenght */
const Word32 core_brate, /* i : Core bit rate */
- const Word16 Q_exc /* i : input and output format of exc2 */
+ const Word16 Q_exc /* i : i and output format of exc2 */
,const Word16 bfi /* i : frame lost indicator */
,const short last_core, /* i : Last core used */
const short last_codec_mode /* i : Last codec mode */
);
void stat_noise_uv_enc_fx(
- Encoder_State_fx *st_fx, /* i/o: state structure */
- const Word16 coder_type, /* i : coding type */
- const Word32 *LepsP, /* i : LP prediction errors */
- Word16 *isp_new, /* i : immittance spectral pairs at 4th sfr */
- Word16 *isp_mid, /* i : immittance spectral pairs at 2nd sfr */
- Word16 *Aq, /* i : A(z) quantized for the 4 subframes */
- Word16 *exc2, /* i/o: excitation buffer */
+ Encoder_State_fx* st_fx, /* i/o: state structure */
+ const Word32* LepsP, /* i : LP prediction errors */
+ const Word16* isp_new, /* i : immittance spectral pairs at 4th sfr */
+ const Word16* isp_mid, /* i : immittance spectral pairs at 2nd sfr */
+ Word16* Aq, /* i : A(z) quantized for the 4 subframes */
+ Word16* exc2, /* i/o: excitation buffer */
+ const Word16 uc_two_stage_flag, /* o : flag undicating two-stage UC */
Word16 Q_new
);
void updt_enc_fx(
- Encoder_State_fx *st, /* i/o: state structure */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 coder_type, /* i : speech coder type */
- const Word16 *old_exc, /* i : buffer of excitation */
- const Word16 *pitch_buf, /* i : floating pitch for each subframe */
+ Encoder_State_fx* st, /* i/o: state structure */
+ const Word16* old_exc, /* i : buffer of excitation */
+ const Word16* pitch_buf, /* i : floating pitch for each subframe */
const Word16 Es_pred, /* i : predicited scaled innovation energy */
- const Word16 *Aq, /* i : A(z) quantized for all subframes */
- const Word16 *lsf_new, /* i : current frame LSF vector */
- const Word16 *lsp_new, /* i : current frame LSP vector */
- const Word16 *old_bwe_exc /* i : buffer of excitation */
+ const Word16* Aq, /* i : A(z) quantized for all subframes */
+ const Word16* lsf_new, /* i : current frame LSF vector */
+ const Word16* lsp_new, /* i : current frame LSP vector */
+ const Word16* old_bwe_exc /* i : buffer of excitation */
);
void FEC_encode_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word16 *synth, /* i : pointer to synthesized speech for E computation */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const ACELP_config acelp_cfg, /* i/o: configuration of the ACELP */
+ const Word16* synth, /* i : pointer to synthesized speech for E computation */
const Word16 coder_type, /* i : type of coder */
- Word16 clas, /* i : signal clas for current frame */
- const Word16 *fpit, /* i : close loop fractional pitch buffer */
- const Word16 *res, /* i : LP residual signal frame */
- Word16 *last_pulse_pos, /* i/o: Position of the last pulse */
+ Word16 clas, /* i : signal clas for current frame */
+ const Word16* fpit, /* i : close loop fractional pitch buffer */
+ const Word16* res, /* i : LP residual signal frame */
+ Word16* last_pulse_pos, /* i/o: Position of the last pulse */
const Word16 L_frame, /* i : Frame length */
const Word32 total_brate, /* i : total codec bitrate */
- const Word32 core_brate, /* i : total codec bitrate */
- const Word16 Q_new, /* i : input scaling */
+ const Word16 Q_new, /* i : i scaling */
const Word16 shift /* i : scaling to get 12bits */
);
void Ener_per_band_comp_fx(
@@ -4355,24 +4279,18 @@ void Ener_per_band_comp_fx(
const Word16 Mband, /* i : Max band */
const Word16 Eflag
);
-void acelp_core_enc_fx(
+ivas_error acelp_core_enc_fx(
Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- LPD_state *mem, /* i/o: acelp memories */
- const Word16 inp_fx[], /* i : input signal of the current frame */
- const Word16 vad_flag_fx,
+ const Word16 inp_fx[], /* i : i signal of the current frame */
const Word32 ener_fx, /* i : residual energy from Levinson-Durbin*/
- const Word16 pitch[3], /* i : open-loop pitch values for quantiz. */
- const Word16 voicing_fx[3], /* i : Open-loop pitch gains */
Word16 A_fx[NB_SUBFR16k*(M+1)], /* i : A(z) unquantized for the 4 subframes*/
Word16 Aw_fx[NB_SUBFR16k*(M+1)], /* i : weighted A(z) unquant. for subframes*/
const Word16 epsP_h_fx[M+1], /* i : LP prediction errors */
const Word16 epsP_l_fx[M+1], /* i : LP prediction errors */
Word16 lsp_new_fx[M], /* i : LSPs at the end of the frame */
Word16 lsp_mid_fx[M], /* i : LSPs in the middle of the frame */
- Word16 coder_type_fx, /* i : coding type */
- const Word16 sharpFlag_fx, /* i : formant sharpening flag */
- Word16 vad_hover_flag_fx,
- const Word16 gsc_attack_flag_fx, /* i : flag signalling attack encoded by AC mode (GSC) */
+ Word16 vad_hover_flag_fx, /* i : VAD hangover flag */
+ const Word16 attack_flag, /* i : attack flag (GSC or TC) */
Word32 bwe_exc_extended_fx[], /* i/o: bandwidth extended excitation */
Word16 *voice_factors_fx, /* o : voicing factors */
Word16 old_syn_12k8_16k_fx[], /* o : intermediate ACELP synthesis at 12.8kHz or 16kHz to be used by SWB BWE */
@@ -4380,26 +4298,40 @@ void acelp_core_enc_fx(
Word16 *unbits_fx, /* o : number of unused bits */
const Word16 Q_new,
const Word16 shift
+#ifdef ADD_LRTD
+ ,
+ STEREO_TD_ENC_DATA_HANDLE hStereoTD, /* i/o: TD stereo encoder handle */
+ const float tdm_lsfQ_PCh[M] /* i : Q LSFs for primary channel */
+#endif
+);
+void tc_classif_enc(
+ const Word16 Q_new, /* i : scaling factor */
+ const Word16 L_frame, /* i : length of the frame */
+ Word16* tc_subfr, /* o : TC subframe index */
+ Word16* position, /* o : maximum of residual signal index */
+ const Word16 attack_flag, /* i : attack flag */
+ const Word16 pitch, /* i : open loop pitch estimates for first halfframe */
+ const Word16* res /* i : pointer to the LP residual signal frame */
);
#define EDCT_FACTOR_SCALE 2
void edct_fx(
- const Word32 *x, /* i : input signal Qq */
+ const Word32 *x, /* i : i signal Qq */
Word32 *y, /* o : output transform Qq */
Word16 length, /* i : length */
- Word16 *q /* i : Q value of input signal */
+ Word16 *q /* i : Q value of i signal */
);
void edst_fx(
- const Word32 *x, /* i : input signal Qq */
+ const Word32 *x, /* i : i signal Qq */
Word32 *y, /* o : output transform Qq */
Word16 length, /* i : length */
- Word16 *q /* i : Q value of input signal */
+ Word16 *q /* i : Q value of i signal */
);
void DoRTFTn_fx(
- Word32 *x, /* i/o : real part of input and output data */
- Word32 *y, /* i/o : imaginary part of input and output data */
+ Word32 *x, /* i/o : real part of i and output data */
+ Word32 *y, /* i/o : imaginary part of i and output data */
const Word16 n /* i : size of the FFT up to 1024 */
);
@@ -4413,50 +4345,54 @@ void edct2_fx(
const Word16 *w
);
void DoRTFT160_16fx(
- Word16 x[], /* i/o : real part of input and output data */
- Word16 y[] /* i/o : imaginary part of input and output data */
+ Word16 x[], /* i/o : real part of i and output data */
+ Word16 y[] /* i/o : imaginary part of i and output data */
);
void DoRTFT320_16fx(
- Word16 *x, /* i/o : real part of input and output data */
- Word16 *y /* i/o : imaginary part of input and output data */
+ Word16 *x, /* i/o : real part of i and output data */
+ Word16 *y /* i/o : imaginary part of i and output data */
);
void DoRTFT128_16fx(
- Word16 *x, /* i/o : real part of input and output data Q(Qx+Q_edct)*/
- Word16 *y /* i/o : imaginary part of input and output data Q(Qx+Q_edct)*/
+ Word16 *x, /* i/o : real part of i and output data Q(Qx+Q_edct)*/
+ Word16 *y /* i/o : imaginary part of i and output data Q(Qx+Q_edct)*/
);
void edct_16fx(
- const Word16 *x, /* i : input signal Qx */
+ const Word16 *x, /* i : i signal Qx */
Word16 *y, /* o : output transform Qx */
Word16 length, /* i : length */
- Word16 bh /* bit-headroom */
+ Word16 bh, /* bit-headroom */
+ const Word16 element_mode
);
void highband_exc_dct_in_fx(
- const Word32 core_brate, /* i : core bitrate */
- const Word16 *mfreq_bindiv_loc, /* i : bin per bands tables */
+ const Word32 core_brate, /* i : core bitrate */
+ const Word16* mfreq_bindiv, /* i : bin per bands tables */
Word16 last_bin, /* i : last bin of bit allocation */
Word16 Diff_len, /* i : number of bin before cut-off frequency */
Word16 noise_lev, /* i : pulses dynamic */
Word16 pit_band_idx, /* i : bin position of the cut-off frequency */
- Word16 *exc_diffQ, /* i : frequency coefficients of per band */
- Word16 *seed_tcx, /* i : Seed for noise */
- Word16 *Ener_per_bd_iQ, /* i : Quantized energy of targeted vector */
+ Word16* exc_diffQ, /* i : frequency coefficients of per band */
+ Word16* seed_tcx, /* i : Seed for noise */
+ Word16* Ener_per_bd_iQ, /* i : Quantized energy of targeted vector */
Word16 nb_subfr, /* i : Number of subframe considered */
- Word16 *exc_dct_in, /* o : dct of residual signal */
+ Word16* exc_dct_in, /* o : dct of residual signal */
Word16 last_coder_type, /* i : coding type of last frame */
- Word16 *bitallocation_band, /* i : bit allocation flag of each band */
- Word16 *lsf_new, /* i : LSFs at the end of the frame */
- Word16 *last_exc_dct_in, /* i : dct of residual signal of last frame */
- Word16 *last_ener, /* i : frequency energy of last frame */
- Word16 *last_bitallocation_band, /* i : bit allocation flag of each band of last frame */
- Word16 *bitallocation_exc, /* i : flag of decoded coefficients */
+ Word16* bitallocation_band, /* i : bit allocation flag of each band */
+ const Word16* lsf_new, /* i : LSFs at the end of the frame */
+ Word16* last_exc_dct_in, /* i : dct of residual signal of last frame */
+ Word16* last_ener, /* i : frequency energy of last frame */
+ Word16* last_bitallocation_band, /* i : bit allocation flag of each band of last frame */
+ Word16* bitallocation_exc, /* i : flag of decoded coefficients */
Word16 bfi, /* i : bad frame indicator */
const Word16 coder_type, /* i : coder type */
Word16 bwidth,
- Word16 *exc_wo_nf , /* o : temporal excitation (in f domain) without noisefill */
+ Word16* exc_wo_nf, /* o : temporal excitation (in f domain) without noisefill */
Word16 Qexc_diffQ,
Word16 Q_exc,
const Word16 GSC_noisy_speech
- ,Word16 *lt_ener_per_band_fx /* i/o: Average per band energy */
+ , Word16* lt_ener_per_band_fx, /* i/o: Average per band energy */
+ const Word16 L_frame, /* i : frame length */
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */
);
@@ -4468,25 +4404,26 @@ void long_enr_fx(
);
Word16 correlation_shift_fx( /* o : noise dependent voicing correction Q15 */
- Word16 totalNoise_fx /* i/o: noise estimate over all critical bands Q8 */
+ const Word16 totalNoise_fx /* i/o: noise estimate over all critical bands Q8 */
);
void analy_lp_fx(
- const Word16 speech[], /* i : pointer to the speech frame */
- const Word16 L_frame, /* i : length of the frame */
- const Word16 L_look, /* i : look-ahead */
- Word32 *ener, /* o : residual energy from Levinson-Durbin */
- Word16 A[], /* o : A(z) filter coefficients */
- Word16 epsP_h[], /* o : LP analysis residual energies for each iteration */
- Word16 epsP_l[], /* o : LP analysis residual energies for each iteration */
- Word16 lsp_new[], /* o : current frame LSPs */
- Word16 lsp_mid[], /* o : current mid-frame LSPs */
- Word16 lsp_old[], /* i/o: previous frame unquantized LSPs */
- const Word16 Top[2], /* i : open loop pitch lag */
- const Word16 Tnc[2], /* i : open loop pitch gain */
- const Word32 Core_sr, /* i : Internal core sampling rate */
+ const Word16 speech[], /* i : pointer to the speech frame */
+ const Word16 L_frame, /* i : length of the frame */
+ const Word16 L_look, /* i : look-ahead */
+ Word32* ener, /* o : residual energy from Levinson-Durbin */
+ Word16 A[], /* o : A(z) filter coefficients */
+ Word16 epsP_h[], /* o : LP analysis residual energies for each iteration */
+ Word16 epsP_l[], /* o : LP analysis residual energies for each iteration */
+ Word16 lsp_new[], /* o : current frame LSPs */
+ Word16 lsp_mid[], /* o : current mid-frame LSPs */
+ Word16 lsp_old[], /* i/o: previous frame unquantized LSPs */
+ const Word16 Top[2], /* i : open loop pitch lag */
+ const Word16 Tnc[2], /* i : open loop pitch gain */
+ const Word32 Core_sr, /* i : Internal core sampling rate */
+ const Word16 sec_chan_low_rate, /* i : flag to signal second channel */
Word16 Q_new,
- Word16 *Q_r
+ Word16* Q_r
);
void analy_lp_AMR_WB_fx(
@@ -4509,13 +4446,13 @@ void a2rc_fx(const Word16 *a, Word16 *refl,Word16 lpcorder);
Word32 invert_dp(Word40 Linput, Word16 n, Word16 *Qout, Word16 wb_mode_bit);
void vad_param_updt_fx(
- Encoder_State_fx *st_fx, /* i/o: state structure */
- Word16 pitch[3], /* i : open loop pitch lag for each half-frame Q0*/
- Word16 voicing[3], /* i : maximum normalized correlation for each half-frame Q15*/
- const Word16 old_pitch1,/* i : OL pitch value from last frame */
- Word16 corr_shift, /* i : correlation shift Q15*/
- Word16 vad_flag, /* i : vad flag Q0*/
- const Word16 Az[] /* i: a coeffs */
+ Encoder_State_fx* st_fx, /* i/o: state structure */
+ const Word16 old_pitch1, /* i : OL pitch value from last frame */
+ const Word16 corr_shift, /* i : correlation shift Q15*/
+ const Word16 corr_shiftR, /* i : correlation shift */
+ const Word16 Az[], /* i: a coeffs Q12 */
+ FRONT_VAD_ENC_HANDLE hFrontVad[], /* i/o: front-VAD handles */
+ const Word16 n_channels /* i : number of channels */
);
void pitch_ol2_fx(
@@ -4557,52 +4494,61 @@ void Scale_wsp(
const Word16 Len_p_look /* i : L_frame + look ahead */
);
-Word16 multi_harm_fx( /* o : frame multi-harmonicity (1-harmonic, 0-not) */
- const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */
- Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */
- Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */
- Word16 *multi_harm_limit, /* i/o: multi harminic threshold Q9 */
- const Word32 total_brate, /* i : total bitrate Q0 */
- const Word16 bwidth, /* i : input signal bandwidth Q0 */
- Word16 *cor_strong_limit, /* i/o: HF correlation indicator Q0 */
- Word16 *st_mean_avr_dyn, /* i/o: long term average dynamic Q7 */
- Word16 *st_last_sw_dyn, /* i/o: last dynamic Q7 */
- Word16 *cor_map_sum /* Q8 */
- , Word16 *sp_floor /* o : noise floor estimate Q7 */
-);
-
-Word16 find_uv_fx( /* o : coding type */
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word16 *T_op_fr, /* i : pointer to adjusted fractional pitch (4 val.) Q6 */
- const Word16 *voicing_fr, /* i : refined correlation for each subframes Q15 */
- const Word16 *voicing, /* i : correlation for 3 half-frames Q15 */
- const Word16 *speech, /* i : pointer to speech signal for E computation Q_new*/
- const Word16 localVAD, /* i : vad without hangover */
- const Word32 *ee, /* i : lf/hf Energy ratio for present frame Q6 */
- const Word16 corr_shift, /* i : normalized correlation correction in noise Q15 */
- const Word16 relE, /* i : relative frame energy Q8 */
- const Word16 Etot, /* i : total energy Q8 */
- const Word32 hp_E[], /* i : energy in HF Q_new + Q_SCALE */
+Word16 multi_harm_fx( /* o : frame multi-harmonicity (1-harmonic, 0-not) */
+ const Word16 Bin_E[], /* i : log-energy spectrum of the current frame Q7 */
+ Word16 old_S[], /* i/o: prev. log-energy spectrum w. subtracted floor Q7 */
+ Word16 cor_map_LT[], /* i/o: LT correlation map Q15 */
+ Word16* multi_harm_limit, /* i/o: multi harminic threshold Q9 */
+ const Word32 total_brate, /* i : total bitrate Q0 */
+ const Word16 bwidth, /* i : i signal bandwidth Q0 */
+ Word16* cor_strong_limit, /* i/o: HF correlation indicator Q0 */
+ Word16* st_mean_avr_dyn, /* i/o: long term average dynamic Q7 */
+ Word16* st_last_sw_dyn, /* i/o: last dynamic Q7 */
+ Word16* cor_map_sum, /* i : sum of correlation map Q8 */
+ Word16* sp_floor, /* o: noise floor estimate Q7 */
+ Word16 S_map[] /* o : short-term correlation map Q7 */
+);
+
+Word16 find_uv_fx( /* o : coding type */
+ Encoder_State_fx* st_fx, /* i/o: encoder state structure */
+ const Word16* T_op_fr, /* i : pointer to adjusted fractional pitch (4 val.) Q6*/
+ const Word16* voicing_fr, /* i : refined correlation for each subframes Q15*/
+ const Word16* speech, /* i : pointer to speech signal for E computation Q_new*/
+ const Word32* ee, /* i : lf/hf Energy ratio for present frame Q6*/
+#ifdef IVAS_CODE
+ Word32* dE1X, /* o : sudden energy increase for S/M classifier */
+#endif
+ const Word16 corr_shift, /* i : normalized correlation correction in noise Q15*/
+ const Word16 relE, /* i : relative frame energy Q8*/
+ const Word16 Etot, /* i : total energy Q8*/
+ const Word32 hp_E[], /* i : energy in HF Q_new + Q_SCALE*/
const Word16 Q_new,
- Word16 *flag_spitch, /* i/o: flag to indicate very short stable pitch and high correlation */
- const Word16 voicing_sm /* i : smoothed open-loop pitch gains */
- , const Word16 shift
- , const Word16 last_core_orig /* i : original last core */
-);
-
-Word16 signal_clas_fx( /* o : classification for current frames */
- Encoder_State_fx *st, /* i/o: encoder state structure */
- Word16 *coder_type, /* i/o: coder type */
- const Word16 voicing[3], /* i : normalized correlation for 3 half-frames */
- const Word16 *speech, /* i : pointer to speech signal for E computation */
- const Word16 localVAD, /* i : vad without hangover */
- const Word16 pit[3], /* i : open loop pitch values for 3 half-frames */
- const Word32 *ee, /* i : lf/hf E ration for 2 half-frames */
- const Word16 relE, /* i : frame relative E to the long term average */
- const Word16 L_look , /* i : look-ahead */
- Word16 *uc_clas /* o : temporary classification used in music/speech class*/
+ Word16* flag_spitch, /* i/o: flag to indicate very short stable pitch and high correlation */
+ const Word16 shift,
+ const Word16 last_core_orig /* i : original last core */
+#ifdef IVAS_CODE
+ , STEREO_CLASSIF_HANDLE hStereoClassif /* i/o: stereo classifier structure */
+#endif
);
+Word16 signal_clas_fx( /* o : classification for current frames */
+ Encoder_State_fx* st, /* i/o: encoder state structure */
+ const Word16* speech, /* i : pointer to speech signal for E computation */
+ const Word32* ee, /* i : lf/hf E ration for 2 half-frames */
+ const Word16 relE, /* i : frame relative E to the long term average */
+ const Word16 L_look, /* i : look-ahead */
+ Word16* uc_clas /* o : temporary classification used in music/speech class*/
+);
+void select_TC(
+ const Word16 codec_mode, /* i : codec mode */
+ const Word16 tc_cnt, /* i : TC frame counter */
+ Word16* coder_type, /* i/o: coder type */
+ const Word16 localVAD /* i : VAD without hangover */
+);
+void coder_type_modif(
+ Encoder_State_fx* st, /* i/o: encoder state structure */
+ const Word16 relE /* i : frame relative E to the long term average */
+);
void find_tilt_fx(
const Word32 fr_bands[], /* i : energy in frequency bands Q_new + Q_SCALE*/
const Word32 bckr[], /* i : per band background noise energy estimate Q_new + Q_SCALE*/
@@ -4611,7 +4557,7 @@ void find_tilt_fx(
const Word16 voicing[3], /* i : normalized correlation for 3 half-frames Q15*/
const Word32 *lf_E, /* i : per bin energy for low frequencies Q_new + Q_SCALE - 2*/
const Word16 corr_shift, /* i : normalized correlation correction Q15*/
- const Word16 bwidth, /* i : input signal bandwidth */
+ const Word16 bwidth, /* i : i signal bandwidth */
const Word16 max_band, /* i : maximum critical band */
Word32 hp_E[], /* o : energy in HF Q_new + Q_SCALE*/
const Word16 codec_mode, /* i : MODE1 or MODE2 */
@@ -4650,31 +4596,32 @@ Word16 swb_bwe_dec_hr_fx(
const Word16 pitch_buf[] /* i : pitch buffer */
);
Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 */
- const Word16 *sp0, /* i : input signal */
+ const Word16 *sp0, /* i : i signal */
const Word16 exp, /* i : Exp of inp signal */
const Word16 N /* i : signal length */
);
void Inverse_Transform(
- const Word32 *in_mdct, /* i : input MDCT vector */
- Word16 *Q, /* i/o: Q value of input */
+ const Word32 *in_mdct, /* i : i MDCT vector */
+ Word16 *Q, /* i/o: Q value of i */
Word32 *out, /* o : output vector */
const Word16 is_transient, /* i : transient flag */
const Word16 L, /* i : output frame length */
- const Word16 L_inner /* i : length of the transform */
+ const Word16 L_inner, /* i : length of the transform */
+ const Word16 element_mode /* i : IVAS element mode */
);
void iedct_short_fx(
- const Word32 *in, /* i : input vector */
- Word16 *Q, /* i/o: Q value of input */
+ const Word32 *in, /* i : i vector */
+ Word16 *Q, /* i/o: Q value of i */
Word32 *out, /* o : output vector */
const Word16 segment_length /* i : length */
);
void swb_bwe_enc_fx(
Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- Word16 *old_input_12k8_fx, /* i : input signal @12.8kHz for SWB BWE */
- Word16 *old_input_16k_fx, /* i : input signal @16kHz for SWB BWE */
+ Word16 *old_input_12k8_fx, /* i : i signal @12.8kHz for SWB BWE */
+ Word16 *old_input_16k_fx, /* i : i signal @16kHz for SWB BWE */
const Word16 *old_syn_12k8_16k_fx, /* i : ACELP core synthesis at 12.8kHz or 16kHz */
- const Word16 *new_swb_speech_fx, /* i : original input signal at 32kHz */
+ const Word16 *new_swb_speech_fx, /* i : original i signal at 32kHz */
Word16 *shb_speech_fx, /* i : SHB target signal (6-14kHz) at 16kHz */
const Word16 coder_type, /* i : coding type */
Word16 Q_shb_speech,
@@ -4682,7 +4629,7 @@ void swb_bwe_enc_fx(
);
void wb_bwe_enc_fx(
Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word16 *new_wb_speech_fx, /* i : original input signal at 16kHz */
+ const Word16 *new_wb_speech_fx, /* i : original i signal at 16kHz */
Word16 coder_type /* i : coding type */
);
@@ -4697,13 +4644,18 @@ Word16 WB_BWE_encoding_fx( /* o : classification of wb signal *
Word16 wb_bwe_dec_fx(
- Word16 *synth_fx, /* i/o: ACELP core synthesis/final synthesis */
- Word16 *hb_synth_fx, /* o : SHB synthesis/final synthesis */
- const Word16 output_frame, /* i : frame length */
- Word16 coder_type, /* i : coding type */
- Word16 *voice_factors_fx, /* i : voicing factors */
- const Word16 pitch_buf_fx[], /* i : pitch buffer */
- Decoder_State_fx *st_fx /* i/o: decoder state structure */
+#ifdef ADD_IVAS_BWE
+ const Word16 output[], /* i : suntehsis @ internal Fs */
+#endif
+ Word16 *synth_fx, /* i/o: ACELP core synthesis/final synthesis */
+ Word16 *hb_synth_fx, /* o : SHB synthesis/final synthesis */
+#ifdef ADD_IVAS_BWE
+ const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */
+#endif
+ const Word16 output_frame, /* i : frame length */
+ Word16 *voice_factors_fx, /* i : voicing factors */
+ const Word16 pitch_buf_fx[],/* i : pitch buffer */
+ Decoder_State_fx *st_fx /* i/o: decoder state structure */
,Word16 * Qpost
);
@@ -4721,12 +4673,17 @@ Word16 swb_bwe_gain_deq_fx( /* o : BWE class */
);
Word16 swb_bwe_dec_fx(
+#ifdef ADD_IVAS_BWE
+ const Word16 output[], /* i : suntehsis @ internal Fs */
+#endif
Decoder_State_fx *st_fx, /* i/o: decoder state structure */
Word16 *synth_fx, /* i : ACELP core synthesis/final synthesis */
Word16 *hb_synth, /* o : SHB synthesis/final synthesis */
+#ifdef ADD_IVAS_BWE
+ const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */
+#endif
const Word16 output_frame /* i : frame length */
,Word16 * Qpost
- ,Word16 coder_type /* i : coding type */
);
Word16 WB_BWE_gain_pred_fx(
@@ -4745,8 +4702,8 @@ Word16 WB_BWE_gain_pred_fx(
);
void calc_normal_length_fx(
const Word16 core, /* i : core */
- const Word16 *sp, /* i : input signal */
- const Word16 mode, /* i : input mode */
+ const Word16 *sp, /* i : i signal */
+ const Word16 mode, /* i : i mode */
const Word16 extl, /* i : extension layer */
Word16 *L_swb_norm, /* o : normalize length */
Word16 *prev_L_swb_norm, /*i/o : last normalize length */
@@ -4757,7 +4714,7 @@ void calc_norm_envelop_fx(
const Word16 SWB_signal[], /* i : SWB spectrum Q_syn*/
Word32 *envelope, /* o : normalized envelope Q_syn*/
const Word16 L_swb_norm, /* i : length of envelope Q0 */
- const Word16 SWB_flength, /* i : Length of input/output */
+ const Word16 SWB_flength, /* i : Length of i /output */
const Word16 st_offset /* i : offset */
);
@@ -4765,7 +4722,7 @@ void WB_BWE_decoding_fx(
const Word16 *core_dec_freq, /* i : Frequency domain core decoded signal */
Word16 *WB_fenv, /* i : WB frequency envelopes */
Word32 *WB_signal32, /* o : WB signal in MDCT domain */
- const Word16 WB_flength, /* i : Length of input/output */
+ const Word16 WB_flength, /* i : Length of i /output */
const Word16 mode, /* i : classification for WB signal */
const Word16 last_extl, /* i : extl. layer for last frame */
Word32 *prev_Energy, /* i/o: energy for last frame */
@@ -4785,7 +4742,7 @@ void SWB_BWE_decoding_fx(
const Word16 *core_dec_freq, /* i : Frequency domain core decoded signal */
Word16 *SWB_fenv, /* i/o: SWB frequency envelopes */
Word32 *SWB_signal, /* o : SWB signal in MDCT domain */
- const Word16 SWB_flength, /* i : Length of input/output */
+ const Word16 SWB_flength, /* i : Length of i /output */
const Word16 mode, /* i : classification for SWB signal */
Word16 *frica_flag, /* o : fricative signal flag */
Word16 *prev_Energy, /* i/o: energy for last frame */
@@ -4908,7 +4865,7 @@ void GetPredictedSignal_fx(
);
void Get20Log10Spec_fx(
- const Word32 *L_inBuf, /* i : input Q_inBuf */
+ const Word32 *L_inBuf, /* i : i Q_inBuf */
Word16 *outBuf_fx, /* o : output Q7 */
const Word16 fLen, /* i : loop length */
const Word16 Q_inBuf /* i : Qvalue of L_inBuf */
@@ -4944,7 +4901,7 @@ void SpectrumSmoothing_fx(
void GetSynthesizedSpecThinOut_fx(
const Word16 *predBuf_fx, /* i : Qss: prediction buffer (i.e., lowband) */
- const Word16 Qss, /* i : Q value of input vector */
+ const Word16 Qss, /* i : Q value of i vector */
Word32 *L_outBuf, /* o : QsL: synthesized spectrum */
Word16 QsL, /* o : Q value of synthesized spectrum */
const Word16 nBands_fx, /* i : Q0: number of subbands calculated */
@@ -4965,7 +4922,7 @@ Word32 hq2_bit_alloc_fx (
const Word16 band_width[], /* i : Sub band bandwidth */
const Word16 num_bits, /* i : available bits */
const Word16 hqswb_clas, /* i : HQ2 class information */
- const Word16 bwidth, /* i : input bandwidth */
+ const Word16 bwidth, /* i : i bandwidth */
const Word16 is_transient /* i : indicator HQ_TRANSIENT or not */
);
@@ -5083,23 +5040,23 @@ typedef struct GainItemStr_fx
} GainItem_fx;
void genhf_noise_fx(
- Word16 noise_flr_fx[], /* i : Qss smoothed non tonal */ /* sspectra_diff_fx:Qss */
- Word16 Qss, /* i : Q0 Q value */
+ const Word16 noise_flr_fx[], /* i : Qss smoothed non tonal */ /* sspectra_diff_fx:Qss */
+ const Word16 Qss, /* i : Q0 Q value */
Word32 L_xSynth_har[], /* o : QsL hf non tonal components */ /* xSynth_har:QsL */
- Word16 QsL, /* i : Q0 Q value */
- Word16 *predBuf_fx, /* i : Qss smoothed tonal compone */ /* sspectra:Qss */
- Word16 bands, /* i : Q0 total number of subbands in a frame */
- Word16 harmonic_band, /* i : Q0 Number of LF harmonic frames */
- Word16 har_freq_est2, /* i : Q0 harmonic signal parameter */
- Word16 pos_max_hfe2, /* i : Q0 last pulse in core coder */
- Word16 *pul_res, /* o : Q0 pulse resolution */
+ const Word16 QsL, /* i : Q0 Q value */
+ const Word16* predBuf_fx, /* i : Qss smoothed tonal compone */ /* sspectra:Qss */
+ const Word16 bands, /* i : Q0 total number of subbands in a frame */
+ const Word16 harmonic_band, /* i : Q0 Number of LF harmonic frames */
+ const Word16 har_freq_est2, /* i : Q0 harmonic signal parameter */
+ const Word16 pos_max_hfe2, /* i : Q0 last pulse in core coder */
+ Word16* pul_res, /* o : Q0 pulse resolution */
GainItem_fx pk_sf_fx[], /* o : representative region */
- const Word16 fLenLow, /* i : Q0 low frequency length */
- const Word16 fLenHigh, /* i : Q0 high frequency length */
- const Word16 sbWidth[], /* i : Q0 bandwidth for high bands */
- const Word16 lagIndices[], /* i : Q0 correlation indices for most representative */
- const Word16 subband_offsets[], /* i : Q0 band offsets for HF reconstruction */
- const Word16 subband_search_offset[] /* i : Q0 most representative regions offsets in LF */
+ const Word16 fLenLow, /* i : Q0 low frequency length */
+ const Word16 fLenHigh, /* i : Q0 high frequency length */
+ const Word16 sbWidth[], /* i : Q0 bandwidth for high bands */
+ const Word16 lagIndices[], /* i : Q0 correlation indices for most representative */
+ const Word16 subband_offsets[], /* i : Q0 band offsets for HF reconstruction */
+ const Word16 subband_search_offset[]/* i : Q0 most representative regions offsets in LF */
);
void spt_shorten_domain_pre_fx(
@@ -5151,7 +5108,7 @@ void updat_prev_frm_fx(
Word32 L_t_audio[], /* o: core coder buffer */
Word32 L_bwe_br, /* i: core bitrate */
Word16 length_fx, /* i: frame length coded bw */
- const Word16 inner_frame_fx, /* i: input frame length */
+ const Word16 inner_frame_fx, /* i: i frame length */
Word16 bands_fx, /* i: sub band resolution */
Word16 bwidth_fx, /* i: NB/WB/SWB indicator */
const Word16 is_transient_fx, /* i: signal class information */
@@ -5204,23 +5161,23 @@ void noise_extr_corcod_fx(
);
void ton_ene_est_fx(
- Word32 L_xSynth_har[], /* i : QsL buffer with non tonal compoents */
- Word16 QsL, /* i : Q0 Q value for xSynth_har */
+ Word32 L_xSynth_har[], /* i/o: QsL buffer with non tonal compoents */
+ const Word16 QsL, /* i : Q0 Q value for xSynth_har */
Word32 L_be_tonal[], /* o : QbeL tonal energy of the missing bands */
- Word16 *QbeL, /* o : Q0 Q value for be_tonal */
- Word32 L_band_energy[], /* i : Qbe subband energies */
- Word16 Qbe, /* i : Q0 Q value for band_energy */
- const Word16 band_start[], /* i : Q0 subband start indices */
- const Word16 band_end[], /* i : Q0 subband end indices */
- const Word16 band_width[], /* i : Q0 subband widths */
- const Word16 fLenLow, /* i : Q0 low frequency width */
- const Word16 fLenHigh, /* i : Q0 High frequency width */
- Word16 bands, /* i : Q0 total subbands */
- Word16 har_bands, /* i : Q0 total number of harmonics bands */
- Word16 ni_lvl_fx, /* i : Q11 noise enve for the hf bands */
- GainItem_fx pk_sf_fx[], /* i : */
- Word16 Qss, /* i : Q0 Q value for GainItem_fx->nmrValue */
- Word16 *pul_res /* i : Q0 tonal resolution */
+ Word16* QbeL, /* o : Q0 Q value for be_tonal */
+ const Word32 L_band_energy[], /* i : Qbe subband energies */
+ const Word16 Qbe, /* i : Q0 Q value for band_energy */
+ const Word16 band_start[], /* i : Q0 subband start indices */
+ const Word16 band_end[], /* i : Q0 subband end indices */
+ const Word16 band_width[], /* i : Q0 subband widths */
+ const Word16 fLenLow, /* i : Q0 low frequency width */
+ const Word16 fLenHigh, /* i : Q0 High frequency width */
+ const Word16 bands, /* i : Q0 total subbands */
+ const Word16 har_bands, /* i : Q0 total number of harmonics bands */
+ const Word16 ni_lvl_fx, /* i : Q11 noise enve for the hf bands */
+ GainItem_fx pk_sf_fx[], /* i : */
+ const Word16 Qss, /* i : Q0 Q value for GainItem_fx->nmrValue */
+ const Word16* pul_res /* i : Q0 tonal resolution */
);
void Gettonl_scalfact_fx
@@ -5246,7 +5203,7 @@ void Gettonl_scalfact_fx
void get_sigma_fx_har(
- const Word32 L_x_abs[], /* i: Qi absolute input */
+ const Word32 L_x_abs[], /* i: Qi absolute i */
const Word16 Qi, /* i: Q0 Q value of x_abs */
const Word16 avg_fx, /* i: Qavg average of x_abs */
const Word16 Qavg, /* i: Q0 Q value of avg */
@@ -5256,8 +5213,8 @@ void get_sigma_fx_har(
);
void FindNBiggest2_simple_fx_har(
- const Word32 *L_inBuf, /* i : input buffer (searched) */
- const Word16 Qabs_in, /* i : Q value of input buffer */
+ const Word32 *L_inBuf, /* i : i buffer (searched) */
+ const Word16 Qabs_in, /* i : Q value of i buffer */
GainItem_fx *pk_sf_fx, /* o : N biggest components found */
const Word16 nIdx_fx, /* i : search length */
Word16 *n_fx, /* i : number of components searched (N biggest) */
@@ -5292,15 +5249,15 @@ void noiseinj_hf_fx(
);
void sqrt_32n_16_fx(
- Word32 L_in, /* i : input vector (Word32) */
+ Word32 L_in, /* i : i vector (Word32) */
Word16 Qin, /* i : Q value for L_in */
- Word16 *out_fx, /* o : sqrt input vector (Word16) */
+ Word16 *out_fx, /* o : sqrt i vector (Word16) */
Word16 *Qout /* o : Q value for out_fx */
);
void norm_vec_32_16_scale_fx(
- Word32 *L_vec_in, /* i : input vector */
- Word16 Qin, /* i : Q value for input vector */
+ Word32 *L_vec_in, /* i : i vector */
+ Word16 Qin, /* i : Q value for i vector */
Word16 length_fx, /* i :vector size */
Word16 *vec_out_fx, /* o : output vectror */
Word16 *Qout, /* o : Q value for output vectro */
@@ -5316,7 +5273,7 @@ void return_bits_normal2_fx(
Word16 peak_avrg_ratio_fx(
const Word32 total_brate,
- const Word32 *input_hi_fx, /* i : input signal */
+ const Word32 *input_hi_fx, /* i : i signal */
const Word16 length, /* i : number of coefficients */
Word16 *mode_count, /* i/o: HQ_HARMONIC mode count */
Word16 *mode_count1, /* i/o: HQ_NORMAL mode count */
@@ -5338,7 +5295,7 @@ void diffcod_lrmdct_fx(
);
Word16 encode_envelope_indices_fx( /* o : Number of bits if flag_pack=0,0 if flag_pack=1 Q0 */
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
+ BSTR_ENC_HANDLE hBstr, /* i : handle to the bitstream */
const Word16 num_sfm, /* i : Number of subbands Q0 */
const Word16 numnrmibits, /* i : Bitrate of fall-back coding mode Q0 */
Word16 *difidx, /* i/o: Diff indices/encoded diff indices Q0 */
@@ -5409,34 +5366,41 @@ Word16 noise_est_AR1_Qx( /* o: Qx y(n) */
Word16 alpha /*i : Q15 scaling of driving x(n) */
);
void noise_est_fx(
- Encoder_State_fx *st_fx, /* i/o: state structure */
- const Word32 tmpN[], /* i : temporary noise update Q_new + QSCALE */
- const Word16 *pit, /* i : open-loop pitch values for each half-frame Q0 */
- const Word16 cor[], /* i : normalized correlation for all half-frames Q15 */
- const Word16 epsP_h[], /* i : msb prediction error energies Q_r-1 */
- const Word16 epsP_l[], /* i : msb prediction error energies Q_r-1 */
- const Word16 Etot, /* i : total channel E (see find_enr_fx.c) Q8 */
- const Word16 relE, /* i : (VA_CHECK addition) relative frame energy Q8? */
- const Word16 corr_shift, /* i : normalized correlation correction Q15 */
- const Word32 enr[], /* i : averaged energy over both subframes Q_new + Q_SCALE */
- Word32 fr_bands[], /* i : spectrum per critical bands of the current frame Q_new + Q_SCALE */
- Word16 *cor_map_sum, /* o : Q8 */
- Word16 *sp_div, /* o : Q_sp_div */
- Word16 *Q_sp_div, /* o : Q factor for sp_div */
- Word16 *non_staX, /* o : non-stationarity for sp/mus classifier */
- Word16 *loc_harm , /* o : multi-harmonicity flag for UV classifier */
- const Word32 *lf_E, /* i : per bin energy for low frequencies Q_new + Q_SCALE -2 */
- Word16 *st_harm_cor_cnt, /* i/o : 1st harm correlation timer Q0 */
- const Word16 Etot_l_lp, /* i : Smoothed low energy Q8 */
- const Word16 Etot_v_h2, /* i : Energy variations Q8 */
- Word16 *bg_cnt, /* i : Background burst length timer Q0 */
- Word16 EspecdB[], /* i/o: log E spectrum (with f=0) of the current frame Q7 */
- Word16 Q_new , /* i : Scaling of current frame */
-
- const Word32 Le_min_scaled /*i : Minimum energy value */
- , Word16 *sp_floor /* o : noise floor estimate Q7 */
+ Encoder_State_fx* st_fx, /* i/o: state structure */
+ const Word16 old_pitch1, /* i : previous frame OL pitch[1] */
+ const Word32 tmpN[], /* i : temporary noise update Q_new + QSCALE */
+ const Word16 epsP_h[], /* i : msb prediction error energies Q_r-1 */
+ const Word16 epsP_l[], /* i : msb prediction error energies Q_r-1 */
+ const Word16 Etot, /* i : total channel E (see find_enr_fx.c) Q8 */
+ const Word16 relE, /* i : (VA_CHECK addition) relative frame energy Q8? */
+ const Word16 corr_shift, /* i : normalized correlation correction Q15 */
+ const Word32 enr[], /* i : averaged energy over both subframes Q_new + Q_SCALE */
+ Word32 fr_bands[], /* i : spectrum per critical bands of the current frame Q_new + Q_SCALE */
+ Word16* cor_map_sum, /* o : Q8 */
+ Word16* ncharX, /* o : IVAS_CODE -> size of ncharX needs validation noise character for sp/mus classifier Qx? */
+ Word16* sp_div, /* o : Q_sp_div */
+ Word16* Q_sp_div, /* o : Q factor for sp_div */
+ Word16* non_staX, /* o : non-stationarity for sp/mus classifier */
+ Word16* loc_harm, /* o : multi-harmonicity flag for UV classifier */
+ const Word32* lf_E, /* i : per bin energy for low frequencies Q_new + Q_SCALE -2 */
+ Word16* st_harm_cor_cnt, /* i/o : 1st harm correlation timer Q0 */
+ const Word16 Etot_l_lp, /* i : Smoothed low energy Q8 */
+ const Word16 Etot_v_h2, /* i : Energy variations Q8 */
+ Word16* bg_cnt, /* i : Background burst length timer Q0 */
+ Word16 EspecdB[], /* i/o: log E spectrum (with f=0) of the current frame Q7 for multi harm */
+ Word16 Q_new, /* i : SCaling of current frame */
+ const Word32 Le_min_scaled, /*i : Minimum energy value in Q_new + Q_SCALE */
+ Word16* sp_floor, /* o : noise floor estimate Q7 */
+ Word16 S_map[], /* o : short-term correlation map Q7 */
+#ifdef IVAS_CODE
+ STEREO_CLASSIF_HANDLE hStereoClassif, /* i/o: stereo classifier structure */
+ FRONT_VAD_ENC_HANDLE hFrontVad, /* i/o: front-VAD handle */
+#endif
+ const Word16 ini_frame /* i : Frame number (init) */
+);
+void amr_wb_enc_init(
+ AMRWB_IO_ENC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO encoder handle */
);
-
void autocorr_fx(
const Word16 x[], /* i : Input signal */
@@ -5455,7 +5419,8 @@ void freq_dnw_scaling_fx(
const Word16 noise_lev, /* i : Noise level */
const Word32 core_brate, /* i : Core bitrate */
Word16 fy_norm[], /* i/o: Frequency quantized parameter */
- Word16 Qx /* Q format of fy_norm*/
+ Word16 Qx, /* Q format of fy_norm*/
+ const Word16 L_frame /* i : frame length */
);
void Comp_and_apply_gain_fx(
Word16 exc_diffQ[], /* i/o: Quantized excitation */
@@ -5467,41 +5432,48 @@ void Comp_and_apply_gain_fx(
Word16 Q_exc
);
void dec_pit_exc_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder static memory */
- const Word16 *Aq_fx, /* i : LP filter coefficient */
- const Word16 coder_type_fx, /* i : coding type */
- const Word16 Es_pred_fx, /* i : predicted scaled innov. energy */
- Word16 *pitch_buf_fx, /* o : floating pitch values for each subframe */
- Word16 *code_fx, /* o : innovation */
- Word16 *exc_fx, /* i/o: adapt. excitation exc */
- Word16 *bwe_exc_fx, /* o : excitation for SWB TBE */
- const Word16 nb_subfr_fx /* i : Number of subframe considered */
- , Word16 *gain_buf /*Q14*/
+ Decoder_State_fx* st_fx, /* i/o: decoder static memory */
+ const Word16* Aq_fx, /* i : LP filter coefficient */
+ const Word16 coder_type_fx, /* i : coding type */
+ const Word16 Es_pred_fx, /* i : predicted scaled innov. energy */
+ Word16* pitch_buf_fx, /* o : floating pitch values for each subframe */
+ Word16* code_fx, /* o : innovation */
+ Word16* exc_fx, /* i/o: adapt. excitation exc */
+ Word16* bwe_exc_fx, /* o : excitation for SWB TBE */
+ const Word16 nb_subfr_fx /* i : Number of subframe considered */
+ , Word16* gain_buf /*Q14*/
+#ifdef ADD_LRTD
+ , const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
+ const Word16 tdm_Pri_pitch_buf[] /* i : primary channel pitch buffer */
+#endif
);
Word16 mean_fx( /* o : mean of vector */
- const Word16 *vec_fx, /* i : input vector */
- const Word16 lvec_fx /* i : length of input vector */
+ const Word16 *vec_fx, /* i : i vector */
+ const Word16 lvec_fx /* i : length of i vector */
+);
+void GSC_dec_init(
+ GSC_DEC_HANDLE hGSCDec /* i/o: GSC data handle */
);
void gsc_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: State structure */
- Word16 exc_dct_in[], /* i/o: dct of pitch-only excitation / total excitation */
+ Decoder_State_fx *st_fx, /* i/o: State structure */
+ Word16 exc_dct_in[], /* i/o: dct of pitch-only excitation / total excitation */
const Word16 pit_band_idx, /* i : bin position of the cut-off frequency */
- const Word16 Diff_len, /* i : Lenght of the difference signal (before pure spectral)*/
- const Word16 bits_used, /* i : Number of bit used before frequency Q */
- const Word16 nb_subfr, /* i : Number of subframe considered */
- const Word16 coder_type, /* i : coding type */
- Word16 *last_bin, /* i : last bin of bit allocation */
- Word16 *lsf_new, /* i : ISFs at the end of the frame */
- Word16 *exc_wo_nf, /* o : excitation (in f domain) without noisefill */
+ const Word16 Diff_len, /* i : Lenght of the difference signal (before pure spectral)*/
+ const Word16 bits_used, /* i : Number of bit used before frequency Q */
+ const Word16 nb_subfr, /* i : Number of subframe considered */
+ const Word16 coder_type, /* i : coding type */
+ Word16 *last_bin, /* i : last bin of bit allocation */
+ const Word16 *lsf_new, /* i : ISFs at the end of the frame */
+ Word16 *exc_wo_nf, /* o : excitation (in f domain) without noisefill */
Word16 Q_exc
);
void fft_rel_fx(
- Word16 x[], /* i/o: input/output vector */
+ Word16 x[], /* i/o: i /output vector */
const Word16 n, /* i : vector length */
const Word16 m /* i : log2 of vector length */
);
void ifft_rel_fx(
- Word16 io[], /* i/o: input/output vector */
+ Word16 io[], /* i/o: i /output vector */
const Word16 n, /* i : vector length */
const Word16 m /* i : log2 of vector length */
);
@@ -5512,10 +5484,10 @@ Word16 gsc_gaindec_fx( /* o : average frequency gain */
const Word32 core_brate_fx, /* i : core used */
Word16 old_y_gain_fx[], /* i/o: AR gain quantizer for low rate */
const Word16 coder_type_fx, /* i : coding type */
- const Word16 bwidth_fx /* i : input signal bandwidth */
+ const Word16 bwidth_fx /* i : i signal bandwidth */
);
void Copy_Scale_sig(
- const Word16 x[], /* i : signal to scale input Qx */
+ const Word16 x[], /* i : signal to scale i Qx */
Word16 y[], /* o : scaled signal output Qx */
const Word16 lg, /* i : size of x[] Q0 */
const Word16 exp0 /* i : exponent: x = round(x << exp) Qx ?exp */
@@ -5527,17 +5499,20 @@ void bands_and_bit_alloc_fx(
const Word32 core_brate, /* i : core bit rate */
const Word16 Diff_len, /* i : Lenght of the difference signal (before pure spectral)*/
const Word16 bits_used, /* i : Number of bit used before frequency Q */
- Word16 *bit, /* i/o: Number of bit allowed for frequency quantization */
- const Word16 *Ener_per_bd_iQ, /* i/o: Quantized energy vector */
- Word16 *max_ener_band, /* o : Sorted order */
- Word16 *bits_per_bands, /* i/o: Number of bit allowed per allowed subband Q3 */
- Word16 *nb_subbands, /* o : Number of subband allowed */
- const Word16 *exc_diff, /* i : Difference signal to quantize (encoder side only) */
- Word16 *concat_in, /* o : Concatened PVQ's input vector (encoder side only) */
- Word16 *pvq_len, /* o : Number of bin covered with the PVQ */
+ Word16* bit, /* i/o: Number of bit allowed for frequency quantization */
+ const Word16* Ener_per_bd_iQ, /* i/o: Quantized energy vector */
+ Word16* max_ener_band, /* o : Sorted order */
+ Word16* out_bits_per_bands, /* i/o: Number of bit allowed per allowed subband Q3 */
+ Word16* nb_subbands, /* o : Number of subband allowed */
+ const Word16* exc_diff, /* i : Difference signal to quantize (encoder side only) */
+ Word16* concat_in, /* o : Concatened PVQ's i vector (encoder side only) */
+ Word16* pvq_len, /* o : Number of bin covered with the PVQ */
const Word16 coder_type, /* i : coding type */
- const Word16 bwidth, /* i : input signal bandwidth */
- const Word16 GSC_noisy_speech
+ const Word16 bwidth, /* i : i signal bandwidth */
+ const Word16 GSC_noisy_speech, /* i : GSC noisy speech flag */
+ const Word16 L_frame, /* i : frame length */
+ const Word16 element_mode, /* i : element mode */
+ const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */
);
@@ -5545,7 +5520,6 @@ void decod_audio_fx(
Decoder_State_fx *st_fx, /* i/o: decoder static memory */
Word16 dct_epit[], /* o : GSC excitation in DCT domain */
const Word16 *Aq, /* i : LP filter coefficient */
- const Word16 coder_type, /* i : coding type */
Word16 *pitch_buf, /* o : floating pitch values for each subframe */
Word16 *voice_factors, /* o : voicing factors */
Word16 *exc, /* i/o: adapt. excitation exc */
@@ -5555,155 +5529,117 @@ void decod_audio_fx(
, Word16 *gain_buf /*Q14*/
);
Word16 Pit_exc_contribution_len_fx( /* o : bin where pitch contribution is significant */
- Encoder_State_fx *st_fx, /* i/o: state structure */
- const Word16 *dct_res, /* i : DCT of residual */
- Word16 *dct_pitex, /* i/o: DCT of pitch contribution */
- Word16 *pitch_buf, /* i/o: Pitch per subframe */
- const Word16 nb_subfr, /* i : Number of subframe considered */
- Word16 *hangover, /* i : hangover for the time contribution switching */
- const Word16 coder_type, /* i : coding type */
+ Encoder_State_fx *st_fx, /* i/o: state structure */
+ const Word16 *dct_res, /* i : DCT of residual */
+ Word16 *dct_pitex, /* i/o: DCT of pitch contribution */
+ Word16 *pitch_buf, /* i/o: Pitch per subframe */
+ const Word16 nb_subfr, /* i : Number of subframe considered */
+ Word16 *hangover, /* i : hangover for the time contribution switching */
Word16 Qnew
);
void enc_pit_exc_fx(
- Encoder_State_fx *st_fx, /* i/o: State structure */
- LPD_state *mem, /* i/o: acelp memories */
- const Word16 *speech, /* i : Input speech */
- const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */
- const Word16 Aq[], /* i : 12k8 Lp coefficient */
+ Encoder_State_fx* st_fx, /* i/o: State structure */
+ const Word16* speech, /* i : Input speech */
+ const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */
+ const Word16 Aq[], /* i : 12k8 Lp coefficient */
const Word16 Es_pred, /* i : predicted scaled innov. energy */
- const Word16 *T_op, /* i : open loop pitch */
- const Word16 *voicing, /* i : voicing */
- const Word16 *res, /* i : residual signal */
- Word16 *synth, /* i/o: core synthesis */
- Word16 *exc, /* i/o: current non-enhanced excitation */
- Word16 *T0, /* i/o: close loop integer pitch */
- Word16 *T0_frac, /* i/o: close-loop pitch period - fractional part */
- Word16 *pitch_buf, /* i/o: Fractionnal per subframe pitch */
+ const Word16* res, /* i : residual signal */
+ Word16* synth, /* i/o: core synthesis */
+ Word16* exc, /* i/o: current non-enhanced excitation */
+ Word16* T0, /* i/o: close loop integer pitch */
+ Word16* T0_frac, /* i/o: close-loop pitch period - fractional part */
+ Word16* pitch_buf, /* i/o: Fractionnal per subframe pitch */
const Word16 nb_subfr, /* i : Number of subframe considered */
- Word16 *gpit, /* o : pitch mean gpit */
- Word16 *saved_bit_pos, /* o : saved position in the bitstream before pitch contribution */
+ Word16* gpit, /* o : pitch mean gpit */
+ Word16* saved_bit_pos, /* o : saved position in the bitstream before pitch contribution */
+ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
+ const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer */
Word16 Q_new,
Word16 shift
);
void encod_amr_wb_fx(
- Encoder_State_fx *st, /* i/o: state structure */
- LPD_state *mem, /* i/o: acelp memories */
- const Word16 speech[], /* i : input speech */
- const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */
- const Word16 Aq[], /* i : 12k8 Lp coefficient */
- const Word16 pitch[3], /* i : open-loop pitch values for quantiz. */
- const Word16 voicing[], /* i : voicing */
- const Word16 *res, /* i : residual signal */
- Word16 *syn, /* i/o: core synthesis */
- Word16 *exc, /* i/o: current non-enhanced excitation */
- Word16 *exc2, /* i/o: current enhanced excitation */
- Word16 *pitch_buf, /* i/o: floating pitch values for each subframe */
- Word16 hf_gain_fx[NB_SUBFR], /* o : decoded HF gain */
- const Word16 *speech16k_fx,
+ Encoder_State_fx* st, /* i/o: state structure */
+ const Word16 speech[], /* i : i speech */
+ const Word16 Aw[], /* i : weighted A(z) unquantized for subframes */
+ const Word16 Aq[], /* i : 12k8 Lp coefficient */
+ const Word16* res, /* i : residual signal */
+ Word16* syn, /* i/o: core synthesis */
+ Word16* exc, /* i/o: current non-enhanced excitation */
+ Word16* exc2, /* i/o: current enhanced excitation */
+ Word16* pitch_buf, /* i/o: floating pitch values for each subframe */
+ Word16 hf_gain_fx[NB_SUBFR],/* o : decoded HF gain */
+ const Word16* speech16k_fx, /* i : i speech @16kHz */
Word16 shift,
Word16 Q_new
);
void amr_wb_enc_fx(
Encoder_State_fx *st, /* i/o: encoder state structure */
- const Word16 input_sp[], /* i : input signal */
- const Word16 n_samples /* i : number of input samples */
+ const Word16 input_sp[], /* i : i signal */
+ const Word16 n_samples /* i : number of i samples */
);
void encod_gen_voic_fx(
- Encoder_State_fx *st_fx, /* i/o: state structure */
- LPD_state *mem, /* i/o: acelp memories */
- const Word16 L_frame_fx, /* i : length of the frame */
- const Word16 sharpFlag_fx, /* o : formant sharpening flag */
- const Word16 speech_fx[], /* i : input speech */
- const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */
- const Word16 A_fx[], /* i : unquantized A(z) filter with bandwidth expansion */
- const Word16 coder_type_fx, /* i : coding type */
- const Word16 Es_pred_fx, /* i : predicted scaled innov. energy */
- const Word16 T_op_fx[], /* i : open loop pitch */
- const Word16 voicing_fx[], /* i : voicing */
- const Word16 *res_fx, /* i : residual signal */
- Word16 *syn_fx, /* i/o: core synthesis */
- Word16 *exc_fx, /* i/o: current non-enhanced excitation */
- Word16 *exc2_fx, /* i/o: current enhanced excitation */
- Word16 *pitch_buf_fx, /* i/o: floating pitch values for each subframe */
- Word16 *voice_factors_fx, /* o : voicing factors */
- Word16 *bwe_exc_fx, /* o : excitation for SWB TBE */
- Word16 *unbits_fx, /* i/o: number of unused bits */
+ Encoder_State_fx* st_fx, /* i/o: state structure */
+ const Word16 speech_fx[], /* i : i speech */
+ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */
+ const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */
+ const Word16 Es_pred_fx, /* i : predicted scaled innov. energy */
+ const Word16* res_fx, /* i : residual signal */
+ Word16* syn_fx, /* i/o: core synthesis */
+ Word16* exc_fx, /* i/o: current non-enhanced excitation */
+ Word16* exc2_fx, /* i/o: current enhanced excitation */
+ Word16* pitch_buf_fx, /* i/o: floating pitch values for each subframe */
+ Word16* voice_factors_fx, /* o : voicing factors */
+ Word16* bwe_exc_fx, /* o : excitation for SWB TBE */
+ Word16* unbits_fx, /* i/o: number of unused bits */
+ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag */
+ const Word16 tdm_Pri_pitch_buf[], /* i : primary channel pitch buffer */
Word16 shift,
Word16 Q_new
);
void bw_detect_fx(
- Encoder_State_fx *st, /* i/o: Encoder State */
- const Word16 signal_in[], /* i : input signal */
- const Word16 localVAD,
- Word32 *enerBuffer, /* i : CLDFB Energy */
- Word16 *cldfbBuf_Ener_Exp /* i : CLDFB Energy Exponent */
+ Encoder_State_fx* st, /* i/o: Encoder State */
+ const Word16 signal_in[], /* i : i signal */
+ Word16* spectrum, /* i : MDCT spectrum */
+ const Word32* enerBuffer, /* i : CLDFB Energy Q31 */
+ const Word16* cldfbBuf_Ener_Exp,/* i : CLDFB Energy Exponent */
+ const IVAS_FORMAT ivas_format, /* i : IVAS format */
+ const int16_t mct_on /* i : flag MCT mode */
+);
+void set_bw(
+ const Word16 element_mode, /* i : element mode */
+ const Word32 element_brate, /* i : element bitrate */
+ Encoder_State_fx* st, /* i/o: Encoder State */
+ const Word16 codec_mode /* i : codec mode */
);
void hf_synth_amr_wb_init_fx(
- Word16 *prev_r, /* o : previous sub-frame gain */
- Word16 *fmerit_w_sm, /* o : 1 sample memory fmerit_w param */
- Word16 mem_syn_hf_fx[], /* o : HF LPC synthesis filter initialization */
- Word16 *frame_count, /* o : frame counter initialization */
- Word16 *ne_min, /* o : minimum Noise gate - short-term energy initialization*/
- Word16 *fmerit_m_sm, /* o : 1 sample memory fmerit_m param */
- Word16 *voice_fac, /* o : voice factor initialization */
- Word16 *unvoicing, /* o : unvoiced parameter */
- Word16 *unvoicing_sm, /* o : smoothed unvoiced parameter */
- Word16 *unvoicing_flag, /* o : unvoiced flag */
- Word16 *voicing_flag, /* o : voiced flag */
- Word16 *start_band_old, /* o : previous start point for copying frequency band */
- Word32 *OptCrit_old /* o : previous criterion value for deciding the start point */
+ AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */
+);
+void amr_wb_dec_init(
+ AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */
);
-
void hf_synth_amr_wb_reset_fx(
- Word16 *seed2, /* i/o: random seed for HF noise gen */
- Word16 mem_syn_hf[], /* o : HF synthesis memory */
- Word16 mem_hp_interp[], /* o : interpol. memory */
- Word16 *prev_r, /* o : previous sub-frame gain */
- Word16 *fmerit_w_sm, /* o : 1 sample memory fmerit_w param */
- Word16 delay_syn_hf[], /* o : HF synthesis memory */
- Word16 *frame_count, /* o : frame counter memory */
- Word16 *ne_min, /* o : minimum Noise gate - short-term energy memory */
- Word16 *fmerit_m_sm, /* o : 1 sample memory fmerit_m param */
- Word16 *voice_fac, /* o : voice factor memory */
- Word16 *unvoicing, /* o : unvoiced parameter */
- Word16 *unvoicing_sm, /* o : smoothed unvoiced parameter */
- Word16 *unvoicing_flag, /* o : unvoiced flag */
- Word16 *voicing_flag, /* o : voiced flag */
- Word16 *start_band_old, /* o : previous start point for copying frequency band */
- Word32 *OptCrit_old /* o : previous criterion value for deciding the start point */
+ ZERO_BWE_DEC_HANDLE hBWE_zero, /* o : zero BWE decoder handle */
+ AMRWB_IO_DEC_HANDLE hAmrwb_IO /* i/o: AMR-WB IO data handle */
);
void hf_synth_amr_wb_fx(
- const Word32 core_brate, /* i : core bitrate */
+ AMRWB_IO_DEC_HANDLE hAmrwb_IO, /* i/o: AMR-WB IO data handle */
+ ZERO_BWE_DEC_HANDLE hBWE_zero, /* o : zero BWE decoder handle */
+ const Word32 core_brate, /* i : core bitrate */
const Word16 output_frame, /* i : output frame length */
- const Word16 *Aq, /* i : quantized Az : Q12 */
- const Word16 *exc, /* i : excitation at 12.8 kHz : Qexc */
- Word16 *synth, /* i/o: synthesis signal at 12.8k : Qsyn */
- Word16 *mem_syn_hf, /* i/o: HF synthesis memory : Qout */
- Word16 *delay_syn_hf, /* i/o: HF synthesis memory : Qout */
- Word16 *prev_r, /* i/o : previous sub-frame gain : Q10 */
- Word16 *fmerit_w_sm, /* i/o: smoothed fmerit_w : Q14 */
- Word16 *amr_io_class, /* i : signal class (determined by FEC algorithm) */
- Word16 *mem_hp_interp, /* i/o: interpol. memory : Qout */
- Word16 *synth_out, /* i/o: output signal at output Fs : Qout */
+ const Word16* Aq, /* i : quantized Az : Q12 */
+ const Word16* exc, /* i : excitation at 12.8 kHz : Q_exc */
+ Word16* synth, /* i/o: synthesis signal at 12.8k : Q_syn */
+ Word16* amr_io_class, /* i : signal class (determined by FEC algorithm) */
+ Word16* synth_out, /* i/o: output signal at output Fs : Q_out */
Word16 fmerit, /* i : classify parameter from FEC : Q14 */
- const Word16 *hf_gain, /* i : decoded HF gain */
- const Word16 *voice_factors, /* i : voicing factors : Q15 */
+ const Word16* hf_gain, /* i : decoded HF gain */
+ const Word16* voice_factors, /* i : voicing factors : Q15 */
const Word16 pitch_buf[], /* i : pitch buffer : Q5 */
const Word16 ng_ener_ST, /* i : Noise gate - short-term energy : Q8 */
- const Word16 *lsf_new, /* i : ISF vector : Q2 */
- Word16 *frame_count, /* i/o: frame counter */
- Word16 *ne_min, /* i/o: minimum Noise gate : Q8 */
- Word16 *fmerit_m_sm, /* i/o: smoothed fmerit_m : Q14 */
- Word16 *voice_facor_sm, /* o : voice factor memory : Q15 */
- Word16 *unvoicing, /* o : unvoiced parameter : Q15 */
- Word16 *unvoicing_sm, /* o : smoothed unvoiced parameter : Q15 */
- Word16 *unvoicing_flag, /* o : unvoiced flag */
- Word16 *voicing_flag, /* o : voiced flag */
- Word16 *start_band_old, /* o : previous start point for copying frequency band */
- Word32 *OptCrit_old, /* o : previous criterion value for deciding the start point */
+ const Word16* lsf_new, /* i : ISF vector : Q2 */
const Word16 Q_exc, /* i : exc scaling */
- const Word16 Q_out /* i : synth_out scaling */
+ const Word16 Q_out /* i : Q_syn2-1 */
);
void hf_cod_init_fx(
@@ -5765,7 +5701,7 @@ void pz_filter_sp_fx (
void Decimate_allpass_steep_fx(
const Word16 *in_fx,
Word16 state_fx[], /* array of size: 2*ALLPASSSECTIONS_STEEP+1 */
- Word16 N, /* number of input samples */
+ Word16 N, /* number of i samples */
Word16 out_fx[] /* array of size N/2 */
);
@@ -5785,11 +5721,11 @@ Word32 root_a_over_b_fx(
void fir_fx(
- const Word16 x[], /* i : input vector */
+ const Word16 x[], /* i : i vector */
const Word16 h[], /* i : impulse response of the FIR filter */
Word16 y[], /* o : output vector (result of filtering) */
- Word16 mem[], /* i/o: memory of the input signal (M samples) */
- const Word16 L, /* i : input vector size */
+ Word16 mem[], /* i/o: memory of the i signal (M samples) */
+ const Word16 L, /* i : i vector size */
const Word16 K, /* i : order of the FIR filter (M+1 coefs.) */
const Word16 upd, /* i : 1 = update the memory, 0 = not */
Word16 shift /* i : difference between Q15 and scaling of h[] */
@@ -5797,9 +5733,9 @@ void fir_fx(
void Interpolate_allpass_steep_fx(
- const Word16 *in_fx, /* i : input signal */
+ const Word16 *in_fx, /* i : i signal */
Word16 state_fx[], /* array of size: 2*ALLPASSSECTIONS_STEEP+1 */
- Word16 N, /* number of input samples */
+ Word16 N, /* number of i samples */
Word16 out_fx[] /* o : output signal, size 2*N */
);
@@ -5814,8 +5750,7 @@ void interpolate_3_over_1_allpass_fx(
const Word16 *input_fx,
const Word16 len,
Word16 *out_fx,
- Word16 *mem_fx,
- const Word16 *filt_coeff_fx
+ Word16 *mem_fx
);
void decimate_2_over_3_allpass_fx(
const Word16 *input_fx,
@@ -5844,14 +5779,14 @@ void lsp2lpc_fx(
);
void PostShortTerm_fx(
- Word16 *sig_in, /* i : input signal (pointer to current subframe */
+ Word16 *sig_in, /* i : i signal (pointer to current subframe */
Word16 *lpccoeff, /* i : LPC coefficients for current subframe */
Word16 *sig_out, /* o : postfiltered output */
Word16 *mem_stp, /* i/o: postfilter memory*/
Word16 *ptr_mem_stp, /* i/o: pointer to postfilter memory*/
Word16 *ptr_gain_prec, /* i/o: for gain adjustment*/
Word16 *mem_zero, /* i/o: null memory to compute h_st*/
- Word16 formant_fac_fx /* i : Strength of post-filter*/
+ const Word16 formant_fac_fx /* i : Strength of post-filter*/
);
void GenShapedWBExcitation_fx(
@@ -5873,14 +5808,14 @@ void GenShapedWBExcitation_fx(
);
void GenWBSynth_fx(
- const Word16 *input_synspeech, /* i : input synthesized speech */
+ const Word16 *input_synspeech, /* i : i synthesized speech */
Word16 *shb_syn_speech_16k, /* o : output highband compnent */
Word16 *state_lsyn_filt_shb1, /* i/o: memory */
Word16 *state_lsyn_filt_shb2 /* i/o: memory */
);
void GenSHBSynth_fx(
- const Word16 *shb_target_speech, /* i : input synthesized speech */
+ const Word16 *shb_target_speech, /* i : i synthesized speech */
Word16 *shb_syn_speech_32k, /* o : output highband component */
Word32 Hilbert_Mem[], /* i/o: memory */
Word16 genSHBsynth_allpass_mem[], /* i/o: memory */
@@ -5926,35 +5861,49 @@ void ScaleShapedWB_fx(
);
void GenShapedSHBExcitation_fx(
- Word16 *excSHB, /* o : synthesized shaped shb excitation Q_bwe_exc*/
- const Word16 *lpc_shb, /* i : lpc coefficients Q12*/
- Word16 *White_exc16k_FB, /* o : white excitation for the Fullband extension Q_bwe_exc */
- Word32 *mem_csfilt, /* i/o: memory */
- Word16 *mem_genSHBexc_filt_down_shb, /* i/o: memory */
- Word16 *state_lpc_syn, /* i/o: memory */
- const Word16 coder_type, /* i : coding type */
- const Word16 *bwe_exc_extended, /* i : bandwidth extended excitation */
- Word16 bwe_seed[], /* i/o: random number generator seed */
- Word16 voice_factors[], /* i : voicing factor*/
- const Word16 extl, /* i : extension layer */
- Word16 *tbe_demph, /* i/o: de-emphasis memory */
- Word16 *tbe_premph, /* i/o: pre-emphasis memory */
- Word16 *lpc_shb_sf, /* i: LP coefficients */
- const Word32 shb_ener_sf_32,
- Word16 *shb_res_gshape,
- Word16 *shb_res,
- Word16 *vf_ind,
- const Word16 formant_fac, /* i : Formant sharpening factor [0..1] */
- Word16 fb_state_lpc_syn[], /* i/o: memory */
- Word16 *fb_tbe_demph, /* i/o: fb de-emphasis memory */
- Word16 *Q_bwe_exc,
- Word16 *Q_bwe_exc_fb,
+ Word16* excSHB, /* o : synthesized shaped shb excitation Q_bwe_exc*/
+ const Word16* lpc_shb, /* i : lpc coefficients Q12*/
+ Word16* White_exc16k_FB, /* o : white excitation for the Fullband extension Q_bwe_exc */
+ Word32* mem_csfilt, /* i/o: memory */
+ Word16* mem_genSHBexc_filt_down_shb, /* i/o: memory */
+ Word16* state_lpc_syn, /* i/o: memory */
+ const Word16 coder_type, /* i : coding type */
+ const Word16* bwe_exc_extended, /* i : bandwidth extended excitation */
+ Word16 bwe_seed[], /* i/o: random number generator seed */
+ Word16 voice_factors[], /* i : voicing factor*/
+ const Word16 extl, /* i : extension layer */
+ Word16* tbe_demph, /* i/o: de-emphasis memory */
+ Word16* tbe_premph, /* i/o: pre-emphasis memory */
+ Word16* lpc_shb_sf, /* i: LP coefficients */
+ const Word32 shb_ener_sf_32, /* i: i shb ener, Q31 */
+ Word16* shb_res_gshape, /* i: i res gain shape, Q14 */
+ Word16* shb_res,
+ Word16* vf_ind,
+ const Word16 formant_fac, /* i : Formant sharpening factor [0..1] */
+ Word16 fb_state_lpc_syn[], /* i/o: memory */
+ Word16* fb_tbe_demph, /* i/o: fb de-emphasis memory */
+ Word16* Q_bwe_exc,
+ Word16* Q_bwe_exc_fb,
const Word16 Q_shb,
- Word16 n_mem2, /* i : n_mem2 scale factor to adjust 24.4/32kbps memories */
- Word16 prev_Q_bwe_syn, /* i : st_fx->prev_Q_bwe_syn */
+ Word16 n_mem2, /* i : n_mem2 scale factor to adjust 24.4/32kbps memories */
+ Word16 prev_Q_bwe_syn, /* i : st_fx->prev_Q_bwe_syn */
const Word32 bitrate,
const Word16 prev_bfi
-);
+#ifdef ADD_IVAS_TBE_CODE
+ , /* i : previous frame was concealed */
+ const Word16 element_mode, /* i : element mode */
+ const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */
+ Word16* nlExc16k, /* i/o: NL exc for IC-BWE */
+ Word16* mixExc16k, /* i/o: exc spreading for IC-BWE */
+ const Word32 extl_brate, /* i : extension layer bitarte */
+ const Word16 MSFlag, /* i : Multi Source flag */
+ Word16 EnvSHBres_4k[], /* i/o: TD envelope of the SHB residual signal */
+ Word16* prev_pow_exc16kWhtnd, /* i/o: power of the LB excitation signal in the previous frame */
+ Word16* prev_mix_factor, /* i/o: mixing factor in the previous frame */
+ Word16* Env_error, /* o : error in SHB residual envelope modelling*/
+ Word16 Env_error_part[] /* o : per-segment error in SHB residual envelope modelling */
+#endif
+ );
void space_lsfs_fx (
@@ -5975,7 +5924,7 @@ void lsp_convolve_fx(Word32 x, Word32 *p1, Word32 *p2, Word16 len);
Word32 poscos_fx(Word16 w);
void flip_spectrum_and_decimby4_fx(
- const Word16 input[], /* i : input spectrum */
+ const Word16 i [], /* i : i spectrum */
Word16 output[], /* o : output spectrum */
const Word16 length, /* i : vector length */
Word16 mem1[], /* i/o : memory */
@@ -6004,7 +5953,7 @@ void wb_tbe_enc_fx(
const Word16 coder_type, /* i : coding type */
const Word16 *hb_speech, /* i : HB target signal (6-8kHz) at 16kHz */
const Word32 *bwe_exc_extended, /* i : bandwidth extended exciatation */
- const Word16 Q_new, /* i : input HB speech Q factor */
+ const Word16 Q_new, /* i : i HB speech Q factor */
const Word16 voice_factors[], /* i : voicing factors */
const Word16 pitch_buf[], /* i : pitch for each subframe */
const Word16 voicing[] /* i : OL maximum normalized correlation */
@@ -6012,7 +5961,7 @@ void wb_tbe_enc_fx(
void wb_pre_proc_fx(
Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word16 *new_inp_resamp16k, /* i : original input signal */
+ const Word16 *new_inp_resamp16k, /* i : original i signal */
Word16 *hb_speech /* o : HB target signal (6-8kHz) at 16kHz */
);
@@ -6030,7 +5979,7 @@ void pz_filter_dp_fx (
);
void flip_and_downmix_generic_fx(
- Word16 input[], /* i : input spectrum */
+ Word16 i [], /* i : i spectrum */
Word16 output[], /* o : output spectrum */
const Word16 length, /* i : length of spectra */
Word32 mem1_ext[HILBERT_ORDER1], /* i/o: Hilbert filter memory */
@@ -6049,11 +5998,36 @@ void wb_tbe_dec_fx(
Word16 *synth, /* i/o: ACELP core synthesis/final synthesis */
Word16 *Q_synth
);
-
+ivas_error config_acelp1(
+ const Word16 enc_dec, /* i : encoder/decoder flag */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word32 core_brate_inp, /* i : core bitrate */
+ const Word16 core, /* i : core */
+ const Word16 extl, /* i : extension layer */
+ const Word32 extl_brate, /* i : extension layer bitrate */
+ const Word16 L_frame, /* i : frame length at internal Fs */
+ const Word16 GSC_noisy_speech, /* i : GSC on SWB noisy speech flag */
+ ACELP_config* acelp_cfg, /* i : ACELP bit-allocation */
+ const Word16 signalling_bits, /* i : number of signalling bits */
+ const Word16 coder_type, /* i : coder type */
+ const Word16 tc_subfr, /* i : TC subfr ID */
+ const Word16 tc_call, /* i : TC call number (0,1,2,3,5(DEC)) */
+ Word16* nBits_es_Pred, /* o : number of bits for Es_pred Q */
+ Word16* unbits, /* o : number of unused bits */
+ const Word16 element_mode, /* i : element mode */
+ Word16* uc_two_stage_flag, /* o : flag undicating two-stage UC */
+ const Word16 tdm_lp_reuse_flag, /* i : LPC reuse flag (can be 1 only with secondary channel */
+ const Word16 tdm_low_rate_mode, /* i : secondary channel low rate mode flag */
+ const Word16 idchan, /* i : stereo channel ID */
+ const Word16 active_cnt, /* i : Active frame counter */
+ const Word16 tdm_Pitch_reuse_flag, /* i : primary channel pitch reuse flag*/
+ const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */
+ const Word16 GSC_IVAS_mode /* i : GSC IVAS mode */
+);
void swb_tbe_enc_fx(
Encoder_State_fx *st_fx, /* i/o: encoder state structure */
const Word16 coder_type_fx, /* i : coding type */
- Word16 *new_speech_fx, /* i : original input signal */
+ Word16 *new_speech_fx, /* i : original i signal */
Word32 *bwe_exc_extended_fx, /* i : bandwidth extended excitation */
const Word16 voice_factors_fx[], /* i : voicing factors */
Word16 *White_exc16k_fx, /* o : shaped white excitation for the FB TBE */
@@ -6063,11 +6037,27 @@ void swb_tbe_enc_fx(
Word16 *voicing_fx, /* i : OL maximum normalized correlation */
const Word16 pitch_buf[] /* i : pitch for each subframe */
);
+void td_bwe_dec_init_fx(
+ Decoder_State_fx* st_fx, /* i/o: SHB decoder structure */
+ TD_BWE_DEC_HANDLE hBWE_TD, /* i/o: TD BWE data handle */
+#ifdef ADD_IVAS_BWE
+ const Word16 extl, /* i : BWE extension layer */
+#endif
+ const Word32 output_Fs /* i : output sampling rate */
+);
+
+void fd_bwe_dec_init(
+ Decoder_State_fx* st_fx, /* i/o: decoder state structure */
+ FD_BWE_DEC_HANDLE hBWE_FD /* i/o: FD BWE data handle */
+);
+void hr_bwe_dec_init(
+ HR_BWE_DEC_HANDLE hBWE_FD_HR /* i/o: HR BWE data handle */
+);
void swb_pre_proc_fx(
Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word16 *input_fx, /* i : original input signal */
- Word16 *new_swb_speech_fx, /* o : original input signal at 32kHz */
+ const Word16 *input_fx, /* i : original i signal */
+ Word16 *new_swb_speech_fx, /* o : original i signal at 32kHz */
Word16 *shb_speech_fx, /* o : SHB target signal (6-14kHz) at 16kHz */
Word16 *Q_shb_spch /* o : shb target signal Q factor */
, Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] /* i : real buffer */
@@ -6135,14 +6125,14 @@ void tbe_read_bitstream_fx(
Decoder_State_fx *st_fx /* i/o: encoder state structure */
);
-Word16 get_tbe_bits_fx( /* o : TBE bit consumption per frame */
- Word32 bitrate, /* i : overall bitrate */
- Word16 bandwidth /* i : bandwidht mode */
- ,Word16 rf_mode
+Word16 get_tbe_bits_fx(
+ const Word32 total_brate, /* o : TBE bit consumption per frame */
+ const Word16 bwidth, /* i : overall bitrate */
+ const Word16 rf_mode /* i : bandwidht mode */
);
void GenTransition_fx(
- const Word16 *input, /* i : gain shape overlap buffer */
+ const Word16 *i , /* i : gain shape overlap buffer */
const Word16 *old_hb_synth, /* i : synthesized HB from previous frame */
Word16 length, /* i : targeted length of transition signal */
Word16 *output, /* o : synthesized transitions signal */
@@ -6157,7 +6147,7 @@ void GenTransition_fx(
);
void GenTransition_WB_fx(
- const Word16 *input, /* i : gain shape overlap buffer */
+ const Word16 *i , /* i : gain shape overlap buffer */
const Word16 *old_hb_synth, /* i : synthesized HB from previous frame */
const Word16 prev_Qx, /* i : scaling of old_hb_synth */
Word16 length, /* i : targeted length of transition signal */
@@ -6180,7 +6170,7 @@ void TBEreset_dec_fx(
void fb_tbe_enc_fx(
Encoder_State_fx *st, /* i/o: encoder state structure */
- const Word16 new_input[], /* i : input speech at 48 kHz sample rate */
+ const Word16 new_input[], /* i : i speech at 48 kHz sample rate */
const Word16 fb_exc[], /* i : FB excitation from the SWB part */
Word16 Q_fb_exc
);
@@ -6194,7 +6184,7 @@ void fb_tbe_dec_fx(
);
void elliptic_bpf_48k_generic_fx(
- const Word16 input_fx[], /* i : input signal */
+ const Word16 input_fx[], /* i : i signal */
Word16 *Q_input_fx,
Word16 output_fx[], /* o : output signal */
Word32 memory_fx[][4], /* i/o: 4 arrays of 4 for memory */
@@ -6217,7 +6207,6 @@ void synthesise_fb_high_band_fx(
void lsf_syn_mem_restore_fx(
Encoder_State_fx *st_fx, /* o: state structure */
- LPD_state* LPDmem, /* o: LPD_state vewctor */
Word16 btilt_code_fx, /* i: */
Word32 gc_threshold_fx, /* i: */
Word16 *clip_var_bck_fx, /* i: */
@@ -6241,21 +6230,21 @@ void lsf_syn_mem_restore_fx(
);
void encod_nelp_fx(
- Encoder_State_fx *st_fx, /* i/o: state structure */
- LPD_state *mem, /* i/o: acelp memories */
- const Word16 *speech_fx, /* i : input speech */
+ Encoder_State_fx* st_fx, /* i/o: state structure */
+ const Word16* speech_fx, /* i : i speech */
const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */
const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */
- Word16 *res_fx, /* o : residual signal */
- Word16 *synth_fx, /* o : core synthesis */
- Word16 *tmp_noise_fx, /* o : long-term noise energy */
- Word16 *exc_fx, /* i/o: current non-enhanced excitation */
- Word16 *exc2_fx, /* i/o: current enhanced excitation */
- Word16 *pitch_buf_fx, /* o : floating pitch values for each subframe */
- Word16* voice_factors_fx, /* o : voicing factors */
- Word16* bwe_exc_fx, /* o : excitation for SWB TBE */
+ Word16* res_fx, /* o : residual signal */
+ Word16* synth_fx, /* o : core synthesis */
+ Word16* tmp_noise_fx, /* o : long-term noise energy */
+ Word16* exc_fx, /* i/o: current non-enhanced excitation */
+ Word16* exc2_fx, /* i/o: current enhanced excitation */
+ Word16* pitch_buf_fx, /* o : floating pitch values for each subframe */
+ Word16* voice_factors_fx, /* o : voicing factors */
+ Word16* bwe_exc_fx, /* o : excitation for SWB TBE */
Word16 Q_new,
Word16 shift
+
);
void nelp_encoder_fx(
@@ -6267,11 +6256,11 @@ void nelp_encoder_fx(
);
Word16 dequantize_uvg_fx(
- Word16 iG1, /* i: gain 1 index */
- Word16 *iG2, /* i: gain 2 index */
- Word16 *G, /* o: quantized gain */
- Word16 bandwidth /* i: bandwidth */
- ,Word16 do_scale
+ const Word16 iG1, /* i: gain 1 index */
+ const Word16* iG2, /* i: gain 2 index */
+ Word16* G, /* o: quantized gain */
+ const Word16 bandwidth, /* i: bandwidth */
+ const Word16 do_scale
);
void quantize_uvg_fx(
@@ -6284,10 +6273,10 @@ void quantize_uvg_fx(
void generate_nelp_excitation_fx(
- Word16 *seed,
- Word16 *Gains,
- Word16 *output,
- Word16 gain_fac
+ Word16* seed, /* i/o: random number seed */
+ const Word16* Gains, /* i : excitation gains Q_exc*/
+ Word16* output, /* o : excitation output */
+ const Word16 gain_fac /* i : gain factor */
);
@@ -6304,54 +6293,54 @@ Word32 find_remd(
);
void set_ppp_mode_fx(
- Encoder_State_fx *st_fx, /* i/o: state structure */
- Word16 *coder_type /* i : coding type */
- ,const Word16 noisy_speech_HO, /* i : SC-VBR noisy speech HO flag */
+ Encoder_State_fx* st_fx, /* i/o: state structure */
+ const Word16 noisy_speech_HO, /* i : SC-VBR noisy speech HO flag */
const Word16 clean_speech_HO, /* i : SC-VBR clean speech HO flag */
const Word16 NB_speech_HO, /* i : SC-VBR NB speech HO flag */
- const Word16 localVAD,
- const Word16 localVAD_he, /* i : HE-SAD flag without hangover */
- Word16 *vad_flag
- ,Word16 T_op_fx[] /* i : open loop pitch lag */
- ,Word16 sp_aud_decision1 /* i : Speech Audio Decision */
+ const Word16 localVAD_he /* i : HE-SAD flag without hangover */
);
void update_average_rate_fx(
- Encoder_State_fx *st_fx /* i/o: encoder state structure */
-);
-
-
-void encod_ppp_fx(
- Encoder_State_fx * st_fx, /* i/o: state structure */
- LPD_state *mem, /* i/o: acelp memories */
- const Word16 speech_fx[], /* i : input speech Q_new*/
- const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */
- const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */
- Word16 *coder_type, /* i/o : coding type */
- Word16 sharpFlag_fx, /* i : formant sharpening flag */
- const Word16 T_op_fx[], /* i : open loop pitch */
- const Word16 voicing_fx[], /* i : voicing Q14*/
- Word16 *res_fx, /* i/o: residual signal Q_new*/
- Word16 *synth_fx, /* i/o: core synthesis Q-1*/
- Word16 *exc_fx, /* i/o: current non-enhanced excitation Q_new*/
- Word16 *exc2_fx, /* o: current enhanced excitation Q0*/
- Word16 *pitch_buf_fx, /* o: floating pitch values for each subframe Q6*/
- Word16 *voice_factors, /* o : voicing factors */
- Word16 *bwe_exc, /* o : excitation for SWB TBE */
+ SC_VBR_ENC_HANDLE hSC_VBR, /* i/o: SC-VBR state structure */
+ const Word32 core_brate_fx /* i : core bitrate */
+);
+
+void sc_vbr_enc_init(
+ SC_VBR_ENC_HANDLE hSC_VBR /* i/o: SC-VBR encoder handle */
+);
+ivas_error encod_ppp_fx(
+ Encoder_State_fx* st_fx, /* i/o: state structure */
+ const Word16 speech_fx[], /* i : i speech Q_new*/
+ const Word16 Aw_fx[], /* i : weighted A(z) unquantized for subframes */
+ const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */
+ Word16* res_fx, /* i : residual signal Q_new*/
+ Word16* synth_fx, /* o : core synthesis Q-1*/
+ Word16* exc_fx, /* i/o: current non-enhanced excitation Q_new*/
+ Word16* exc2_fx, /* o : current enhanced excitation Q0*/
+ Word16* pitch_buf_fx, /* o : floating pitch values for each subframe Q6*/
+ Word16* voice_factors, /* o : voicing factors */
+ Word16* bwe_exc, /* o : excitation for SWB TBE */
Word16 Q_new,
Word16 shift
);
-void ppp_voiced_encoder_fx(
- Encoder_State_fx *st_fx, /* i/o: state structure */
- Word16 *in_fx, /* i : residual signal */
- Word16 *out_fx, /* o : Quantized residual signal */
- Word16 delay_fx, /* i : open loop pitch */
- Word16 *lpc1_fx, /* i : prev frame de-emphasized LPC */
- Word16* lpc2_fx, /* i : current frame de-emphasized LPC */
- Word16 *exc_fx, /* i: previous frame quantized excitation */
- Word16 *pitch_fx, /* o: floating pitch values for each subframe */
- Word16 vadsnr_fx, /* i: current frame SNR Q7*/
+void LPDmem_enc_init(
+ LPD_state_HANDLE hLPDmem /* i/o: LP memories */
+);
+
+ivas_error ppp_voiced_encoder_fx(
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ SC_VBR_ENC_HANDLE hSC_VBR,
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 last_coder_type_raw, /* i : raw last_coder_type */
+ const Word16 old_pitch_buf[], /* i : buffer of old subframe pitch values */
+ Word16* in_fx, /* i : residual signal */
+ Word16* out_fx, /* o : Quantized residual signal */
+ Word16 delay_fx, /* i : open loop pitch */
+ Word16* lpc1_fx, /* i : prev frame de-emphasized LPC */
+ Word16* lpc2_fx, /* i : current frame de-emphasized LPC */
+ Word16* exc_fx, /* i: previous frame quantized excitation */
+ Word16* pitch_fx, /* o: floating pitch values for each subframe */
Word16 Qres
);
@@ -6361,7 +6350,6 @@ Word16 rint_new_fx(
void decod_nelp_fx(
Decoder_State_fx *st_fx, /* i/o: decoder static memory */
- const Word16 coder_type, /* i : coding type */
Word16 *tmp_noise_fx, /* o : long term temporary noise energy */
Word16 *pitch_buf_fx, /* o : floating pitch values for each subframe*/
Word16 *exc_fx, /* o : adapt. excitation exc */
@@ -6383,7 +6371,7 @@ void nelp_decoder_fx(
, Word16 *gain_buf /*Q14*/
);
-void core_switching_pre_dec_fx(
+ivas_error core_switching_pre_dec_fx(
Decoder_State_fx *st_fx, /* i/o: decoder state structure */
const Word16 output_frame /* i : frame length */
);
@@ -6394,24 +6382,34 @@ void fb_tbe_reset_synth_fx(
Word16 *prev_fbbwe_ratio_fx
);
-void core_switching_post_dec_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- Word16 *synth, /* i/o: output synthesis Qsynth */
- const Word16 output_frame, /* i : frame length */
- const Word16 core_switching_flag, /* i : ACELP->HQ switching flag */
- const Word16 coder_type, /* i : ACELP coder type */
- Word16 *Qsynth
+ivas_error core_switching_post_dec_fx(
+ Decoder_State_fx* st_fx, /* i/o: decoder state structure */
+ Word16* synth, /* i/o: output synthesis Qsynth */
+#ifdef IVAS_CODE_SWITCHING
+ float* output, /* i/o: LB synth/upsampled LB synth */
+ float output_mem[], /* i : OLA memory from last TCX/HQ frame */
+ const IVAS_FORMAT ivas_format, /* i : IVAS format */
+ const Word16 use_cldfb_for_dft, /* i : flag to use of CLDFB for DFT Stereo */
+#endif
+ const Word16 output_frame, /* i : frame length */
+ const Word16 core_switching_flag, /* i : ACELP->HQ switching flag */
+#ifdef IVAS_CODE_SWITCHING
+ const Word16 sba_dirac_stereo_flag, /* i : signal stereo output for SBA DirAC */
+ const Word16 nchan_out, /* i : number of output channels */
+#endif
+ const Word16 last_element_mode, /* i : element mode of previous frame */
+ Word16* Qsynth /* i/o: Scaling of ACELP exit (Q_syn2-1) or HQ exit (Qsynth); changes after this function */
);
-void acelp_core_switch_dec_bfi_fx(
+ivas_error acelp_core_switch_dec_bfi_fx(
Decoder_State_fx *st_fx, /* i/o: decoder state structure */
Word16 synth_out[], /* o : synthesis Q_syn */
const Word16 coder_type /* i : coder type */
);
-void acelp_core_switch_dec_fx(
+ivas_error acelp_core_switch_dec_fx(
Decoder_State_fx *st_fx, /* decoder state structure */
Word16 *synth_subfr_out, /* o synthesized ACELP subframe Q_syn*/
Word16 *tmp_synth_bwe, /* o synthesized ACELP subframe BWE Q_syn*/
- const Word16 output_frame, /* i : input frame legth */
+ const Word16 output_frame, /* i : i frame legth */
const Word16 core_switching_flag, /* i : core switching flag */
Word16 *mem_synth, /* o : synthesis to overlap */
Word16 *Q_syn
@@ -6443,13 +6441,10 @@ void core_switching_OLA_fx(
);
void acelp_core_switch_enc_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- LPD_state *mem,
- const Word16 inp12k8[], /* i : input signal @12.8 kHz Q0 */
- const Word16 inp16k[], /* i : input signal @16 kHz Q0 */
- const Word16 T_op_orig[2], /* i : open-loop pitch values for quantiz. Q0*/
- const Word16 voicing[3], /* i : Open-loop pitch gains Q15 */
- const Word16 A[NB_SUBFR16k*(M+1)], /* i : A(z) unquantized for the 4 subframes Q12*/
+ Encoder_State_fx* st_fx, /* i/o: encoder state structure */
+ const Word16 inp12k8[], /* i : i signal @12.8 kHz Q0 */
+ const Word16 inp16k[], /* i : i signal @16 kHz Q0 */
+ const Word16 A[NB_SUBFR16k * (M + 1)], /* i : A(z) unquantized for the 4 subframes Q12*/
Word16 shift,
Word16 Q_new
);
@@ -6463,18 +6458,17 @@ void core_switching_hq_prepare_enc_fx(
);
void core_switching_pre_enc_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- LPD_state *mem, /* i/o: encoder state structure */
- const Word16 *old_inp_12k8, /* i : old input signal @12.8kHz */
- const Word16 *old_inp_16k /* i : old input signal @16kHz */
+ Encoder_State_fx* st_fx, /* i/o: encoder state structure */
+ const Word16* old_inp_12k8, /* i : old i signal @12.8kHz */
+ const Word16* old_inp_16k, /* i : old i signal @16kHz */
+ const Word16 active_cnt, /* i : active frame counter */
+ const Word16 last_element_mode /* i : last_element_mode */
);
void core_switching_post_enc_fx( /*done */
Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- const Word16 inp12k8[], /* i : input signal @12.8 kHz */
- const Word16 inp16k[], /* i : input signal @16 kHz */
- const Word16 T_op[2], /* i : open-loop pitch values for quantiz. */
- const Word16 voicing[3], /* i : Open-loop pitch gains */
+ const Word16 inp12k8[], /* i : i signal @12.8 kHz */
+ const Word16 inp16k[], /* i : i signal @16 kHz */
const Word16 A[], /* i : unquant. LP filter coefs. (Q12) */
Word16 Qshift,
Word16 Q_new,
@@ -6484,8 +6478,8 @@ void core_switching_post_enc_fx( /*done */
Word16 modify_Fs_intcub3m_sup_fx( /* o : length of output */
const Word16 sigIn[], /* i : signal to decimate with memory of 2 samples (indexes -2 & -1) */
- const Word16 lg, /* i : length of input (suppose that lg is such that lg_out is integer, ex multiple of 5 in case of 16kHz to 12.8 kHz) */
- const Word32 fin, /* i : frequency of input */
+ const Word16 lg, /* i : length of i (suppose that lg is such that lg_out is integer, ex multiple of 5 in case of 16kHz to 12.8 kHz) */
+ const Word32 fin, /* i : frequency of i */
Word16 sigOut[], /* o : decimated signal */
const Word32 fout, /* i : frequency of output */
Word16 *delayout /* o : delay of output */
@@ -6558,23 +6552,22 @@ Word16 Invert16( /* result in Q'15 + 'exp' */
Word16 *exp);
void swb_bwe_enc_hr_fx(
- Encoder_State_fx *st_fx, /* i/o: encoder state structure */
- Word16 *new_input_fx, /* i : input signal */
- Word16 new_input_fx_exp, /* i : Exponent of input signal */
- const Word16 input_frame, /* i : frame length */
- const Word16 coder_type, /* i : coding type */
- const Word16 unbits /* i : number of core unused bits */
+ Encoder_State_fx* st_fx, /* i/o: encoder state structure */
+ Word16* new_input_fx, /* i : i signal */
+ Word16 new_input_fx_exp, /* i : Exponent of i signal */
+ const Word16 input_frame, /* i : frame length */
+ const Word16 unbits /* i : number of core unused bits */
);
void wtda_fx(
- Word16 *new_audio, /* i : input audio Q0 */
- Word16 *Q, /* i/o : Q of Output Audio (use 15 for 'qout' for backward compatibility - NON SWB ENC HR FX MODULES) */
- Word32 *wtda_audio, /* o : windowed audio Qout */
- Word16 *old_wtda, /* i/o: windowed audio from previous frame Qout */
- Word16 *Qold_wtda,
- Word16 left_mode,
- Word16 right_mode, /* window overlap of current frame (0: full, 2: none, or 3: half) */
- const Word16 L
+ Word16* new_audio, /* i : i audio Q0 */
+ Word16* Q, /* i/o : Q of i /Output Audio */
+ Word32* wtda_audio, /* o : windowed audio Qout */
+ Word16* old_wtda, /* i/o: windowed audio from previous frame Qout */
+ Word16* Qold_wtda,
+ const Word16 left_mode, /* i : window overlap of previous frame (0: full, 2: none, or 3: half) */
+ const Word16 right_mode, /* i : window overlap of current frame (0: full, 2: none, or 3: half) */
+ const Word16 L /* i : length */
);
void direct_transform_fx(
@@ -6582,38 +6575,37 @@ void direct_transform_fx(
Word32 out32_fx[],
const Word16 is_transient,
const Word16 L,
- Word16 *Q
+ Word16 *Q,
+ const Word16 element_mode
);
void r_fft_4_fx(Word16 * farray_ptr_fx, Word16 size, Word16 stage, Word16 isign);
-DTFS_STRUCTURE_FX* DTFS_new_fx(
- void
-);
+ivas_error DTFS_new_fx(DTFS_STRUCTURE_FX** dtfs_out);
void DTFS_copy_fx(
DTFS_STRUCTURE_FX *Xout_fx, /* o: DTFS structure */
DTFS_STRUCTURE_FX Xinp_fx /* i: DTFS structure */
);
-DTFS_STRUCTURE_FX DTFS_sub_fx(
- DTFS_STRUCTURE_FX X1, /* i: DTFS input 1 */
- DTFS_STRUCTURE_FX X2 /* i: DTFS input 2 */
-); /* o: X1 - X2 */
+void DTFS_sub_fx(
+ DTFS_STRUCTURE_FX* tmp,/* o: X1 - X2 */
+ DTFS_STRUCTURE_FX X1, /* i: DTFS i 1 */
+ DTFS_STRUCTURE_FX X2 /* i: DTFS i 2 */
+);
void DTFS_to_fs_fx(
- const Word16 *x, /* i : time domain signal */
- Word16 N, /* i : Length of input vector */
- DTFS_STRUCTURE_FX *X_fx, /* o : DTFS structure with a, b, lag */
- Word16 Fs, /* i : sampling rate */
- Word16 FR_flag, /* i: FR flag */
- Word16 *S_fx,
- Word16 *C_fx
+ const Word16* x, /* i : time domain signal */
+ Word16 N, /* i : Length of i vector */
+ DTFS_STRUCTURE_FX* X_fx, /* o : DTFS structure with a, b, lag */
+ const Word16 Fs, /* i : sampling rate */
+ const Word16 FR_flag, /* i : FR flag */
+ Word16* S_fx,
+ Word16* C_fx
);
-void DTFS_fast_fs_inv_fx( DTFS_STRUCTURE_FX *This,Word16 *out_fx, Word16 N_fx, Word16 LOG2N);
void DTFS_car2pol_fx(
DTFS_STRUCTURE_FX *X_fx /* i/o : DTFS structure a, b, lag */
@@ -6624,8 +6616,8 @@ Word32 getSpEngyFromResAmp_fx( DTFS_STRUCTURE_FX *X_fx,Word16 lband, Word16 hban
Word16 *cos_tab);
Word32 DTFS_setEngyHarm_fx(
- Word16 f1_fx, /* i : lower band freq of input to control energy */
- Word16 f2_fx, /* i : upper band freq of input to control energy */
+ Word16 f1_fx, /* i : lower band freq of i to control energy */
+ Word16 f2_fx, /* i : upper band freq of i to control energy */
Word16 g1_fx, /* i : lower band freq of output to control energy */
Word16 g2_fx, /* i : upper band freq of output to control energy */
Word32 en2_fx, /* i : Target Energy to set the DTFS to */
@@ -6641,7 +6633,7 @@ void quant_target_fx( DTFS_STRUCTURE_FX *X_fx,const Word16 *curr_lpc, Word16 *w,
void GetSinCosTab_fx(Word16 L, Word16 *sinTab, Word16 *cosTab);
void DTFS_to_erb_fx(
- const DTFS_STRUCTURE_FX X_fx, /* i : DTFS input */
+ const DTFS_STRUCTURE_FX X_fx, /* i : DTFS i */
Word16 *out_fx /* o : ERB output */
);
@@ -6652,11 +6644,6 @@ Word32 DTFS_getEngy_fx( DTFS_STRUCTURE_FX *X_fx);
Word32 DTFS_getEngy_P2A_fx( DTFS_STRUCTURE_FX *X_fx);
-Word32 DTFS_getEngy_band_fx(
- DTFS_STRUCTURE_FX X_fx,
- Word16 lband,
- Word16 hband
-);
Word32 DTFS_getEngy_band_wb_fx(
DTFS_STRUCTURE_FX X_fx,
@@ -6664,15 +6651,6 @@ Word32 DTFS_getEngy_band_wb_fx(
Word16 hband
);
-Word32 DTFS_freq_corr_fx(
- DTFS_STRUCTURE_FX X1_DTFS_fx, /* i : X1 DTFS */
- DTFS_STRUCTURE_FX X2_DTFS_fx, /* i : X2 DTFS */
- Word16 lband, /* i : low cutoff */
- Word16 hband, /* i : high cutoff */
- Word16 *Qout /* o : Correlation Q format */
-); /* o : Correlation */
-
-Word32 DTFS_setEngy_fx( DTFS_STRUCTURE_FX *X_DTFS_FX,Word32 en2_fx);
void DTFS_adjustLag_fx(
DTFS_STRUCTURE_FX *X_DTFS_FX, /* i/o : DTFS to adjust lag for */
@@ -6700,25 +6678,6 @@ Word16 DTFS_alignment_full_fx(
, Word16 FR_flag
);
-Word16 DTFS_alignment_extract_td_fx(Word16 *x1, Word16 *x2, Word16 lag);
-
-Word16 DTFS_alignment_weight_fx(
- DTFS_STRUCTURE_FX *X_fx,
- DTFS_STRUCTURE_FX X2,
- Word16 Eshift,
- const Word16 *LPC1,
- const Word16 *LPC2,
- Word16 *S_fx,
- Word16 *C_fx,
- Word16 *pf_temp1,
- Word16 *pf_temp2,
- Word16 *pf_temp,
- Word16 *pf_n2
-);
-
-
-Word16 DTFS_alignment_fine_new_fx( DTFS_STRUCTURE_FX X1_fx, DTFS_STRUCTURE_FX X2_fx, Word16 *S_fx, Word16 *C_fx);
-
void DTFS_phaseShift_fx( DTFS_STRUCTURE_FX *X_fx,Word16 ph, Word16 Lag, Word16 *S_fx, Word16 *C_fx);
void Q2phaseShift_fx( DTFS_STRUCTURE_FX *X_fx,Word16 ph, Word16 Lag, Word16 *S_fx, Word16 *C_fx);
@@ -6741,50 +6700,13 @@ void erb_add_fx(
Word16 num_erb_fx /* i : number of ERBs */
);
-void LPCPowSpect_fx(Word16 *freq, Word16 Nf, Word16 *LPC, Word16 Np,
- Word16 *out);
-
void erb_slot_fx(
- Word16 lag_fx, /* i : input lag */
+ Word16 lag_fx, /* i : i lag */
Word16 *out_fx, /* o : ERB slots */
Word16 *mfreq_fx, /* i : ERB frequencies */
Word16 num_erb_fx /* i : number of ERBs */
);
-Word16 DTFS_quant_cw_fx(
- DTFS_STRUCTURE_FX *X_fx, /* i/o: DTFS unquant inp, quant out */
- Word16 pl, /* i : Previous lag */
- const Word16 *curr_lpc_fx, /* i : LPC */
- Word16 *POWER_IDX, /* o : Power index */
- Word16 *AMP_IDX, /* o : Amplitude index */
- Word16 *lastLgainE_fx, /* i/o: last frame lowband gain */
- Word16 *lastHgainE_fx, /* i/o: last frame highband gain */
- Word16 *lasterbE_fx, /* i/o: last frame ERB vector */
- Word16 *sin_tab,
- Word16 *cos_tab
-);
-
-
-void DTFS_dequant_cw_fx(
- Word16 pl_fx, /* i : Previous lag */
- Word16 POWER_IDX_fx, /* i : POWER index */
- const Word16 *AMP_IDX_fx, /* i : Amp Shape index */
- Word16 *lastLgainD_fx, /* i/o: low band last gain */
- Word16 *lastHgainD_fx, /* i/o: high band last gain */
- Word16 *lasterbD_fx, /* i/o: last frame ERB vector */
- DTFS_STRUCTURE_FX *X_fx, /* o : DTFS structure dequantized */
- Word16 num_erb_fx
-);
-
-void DTFS_transform_fx(
- DTFS_STRUCTURE_FX X_fx, /* i : Starting DTFS to use in WI */
- DTFS_STRUCTURE_FX X2_fx, /* i : Ending DTFS to use in WI */
- const Word32 *phase_fx, /* i : Phase contour */
- Word16 *out_fx, /* o : Output time domain waveform */
- Word16 N, /* i : Number of samples to generate */
- Word16 FR_flag /* i : Flag to indicate called in FR context */
-);
-
void DTFS_peaktoaverage_fx(
DTFS_STRUCTURE_FX X_fx, /* i : DTFS */
Word32 *pos_fx, /* o : positive peak to ave */
@@ -6796,7 +6718,7 @@ void DTFS_peaktoaverage_fx(
Word16 ppp_extract_pitch_period_fx(
- const Word16 *in, /* i : input residual */
+ const Word16 *in, /* i : i residual */
Word16 *out, /* o : output residual */
Word16 l, /* i : lag */
Word16 *out_of_bound, /* o : out of bound flag */
@@ -6813,45 +6735,45 @@ void Interpol_delay_fx(
);
-Word16 ppp_quarter_encoder_fx(
- DTFS_STRUCTURE_FX *CURRCW_Q_FX, /* o : Quantized (amp/phase) DTFS */
- DTFS_STRUCTURE_FX *TARGETCW_FX, /* o : DTFS with quant phase but unquant Amp */
- Word16 prevCW_lag, /* i : previous lag */
- DTFS_STRUCTURE_FX CURRCW_NQ_FX, /* i : Unquantized DTFS */
- const Word16 *curr_lpc_fx, /* i : LPCS */
- Word16 *lastLgainE_fx, /* i/o: last low band gain */
- Word16 *lastHgainE_fx, /* i/o: last high band gain */
- Word16 *lasterbE_fx, /* i/o: last ERB vector */
- DTFS_STRUCTURE_FX PREV_CW_E_FX, /* i : past DTFS */
- Word16 *S_fx, /* i : sin table, Q15 */
- Word16 *C_fx, /* i : cos table, Q15 */
- Encoder_State_fx *st_fx
-);
-
-
-void WIsyn_fx(
- DTFS_STRUCTURE_FX PREVCW_FX,
- DTFS_STRUCTURE_FX *CURR_CW_DTFS_FX,
- const Word16 *curr_lpc_fx,
- Word16 *ph_offset_fx,
- Word16 *out_fx,
- Word16 N,
- Word16 FR_flag, /* i : called for post-smoothing in FR */
- Word16 *S_fx,
+ivas_error ppp_quarter_encoder_fx(
+ Word16* returnFlag, /* o : return value */
+ DTFS_STRUCTURE_FX* CURRCW_Q_FX, /* o : Quantized (amp/phase) DTFS */
+ DTFS_STRUCTURE_FX* TARGETCW_FX, /* o : DTFS with quant phase but unquant Amp */
+ Word16 prevCW_lag, /* i : previous lag */
+ DTFS_STRUCTURE_FX vCURRCW_NQ_FX, /* i : Unquantized DTFS */
+ const Word16* curr_lpc_fx, /* i : LPCS */
+ Word16* lastLgainE_fx, /* i/o: last low band gain */
+ Word16* lastHgainE_fx, /* i/o: last high band gain */
+ Word16* lasterbE_fx, /* i/o: last ERB vector */
+ DTFS_STRUCTURE_FX PREV_CW_E_FX, /* i : past DTFS */
+ Word16* S_fx, /* i : sin table, Q15 */
+ Word16* C_fx, /* i : cos table, Q15 */
+ BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */
+);
+
+
+ivas_error WIsyn_fx(
+ DTFS_STRUCTURE_FX PREVCW_FX, /* i : Prev frame DTFS */
+ DTFS_STRUCTURE_FX* CURR_CW_DTFS_FX, /* i/o: Curr frame DTFS */
+ const Word16* curr_lpc_fx, /* i : LPC */
+ Word16* ph_offset_fx, /* i/o: Phase offset to line up at end of frame */
+ Word16* out_fx, /* o : Waveform Interpolated time domain signal */
+ const Word16 N, /* i : Number of output samples to generate */
+ const Word16 FR_flag, /* i : called for post-smoothing in FR */
+ Word16* S_fx,
Word16* C_fx,
- Word16 *pf_temp1,
- Word16 *pf_temp2,
- Word16 *pf_temp,
- Word16 *pf_n2
+ Word16* pf_temp1,
+ Word16* pf_temp2,
+ Word16* pf_temp,
+ Word16* pf_n2
);
void deemph_lpc_fx(
- Word16 *p_Aq_curr_fx, /* i : LP coefficients current frame */
- Word16 *p_Aq_old_fx, /* i : LP coefficients previous frame */
- Word16 *LPC_de_curr_fx, /* o : De-emphasized LP coefficients current frame */
- Word16 *LPC_de_old_fx, /* o : De-emphasized LP coefficients previous frame */
- Word16 deemph_old
-
+ const Word16* p_Aq_curr_fx, /* i : LP coefficients current frame */
+ const Word16* p_Aq_old_fx, /* i : LP coefficients previous frame */
+ Word16* LPC_de_curr_fx, /* o : De-emphasized LP coefficients current frame in Q12 */
+ Word16* LPC_de_old_fx, /* o : De-emphasized LP coefficients previous frame in Q12 */
+ const Word16 deemph_old
);
Word16 erb_diff_search_fx(Word16 *prev_erb, const Word16 *curr_erb, Word16 *dif_erb,
@@ -6866,7 +6788,8 @@ void Acelp_dec_total_exc(
const Word16 gain_code16, /* i : Gain code Q0 */
const Word16 gain_pit_fx, /* i ; Pitch gain in Q14 */
const Word16 i_subfr, /* i ; subfr */
- const Word16 *code_fx /* i : code in Q12 */
+ const Word16 *code_fx, /* i : code in Q12 */
+ const Word16 L_subfr /* i : Subframne lenght */
);
void tbe_celp_exc(
const Word16 L_frame_fx, /* i : Frame lenght */
@@ -6883,7 +6806,6 @@ Word16 tbe_celp_exc_offset(
);
void lsf_syn_mem_backup_fx(
Encoder_State_fx *st_fx, /* i: state structure */
- LPD_state* LPDmem, /* i: LPD state memory structure */
Word16 *btilt_code, /* i: tilt code */
Word32 *bgc_threshold, /* i: */
Word16 *clip_var_bck, /* o: */
@@ -6906,7 +6828,7 @@ void lsf_syn_mem_backup_fx(
Word16 *pstreaklen
);
-void decod_ppp_fx(
+ivas_error decod_ppp_fx(
Decoder_State_fx *st_fx, /* i/o: state structure */
const Word16 Aq_fx[], /* i : 12k8 Lp coefficient */
Word16 *pitch_buf_fx, /* i/o: fixed pitch values for each subframe */
@@ -6918,7 +6840,7 @@ void decod_ppp_fx(
Word16 *bwe_exc_fx /* o : excitation for SWB TBE */
);
-void ppp_quarter_decoder_fx(
+ivas_error ppp_quarter_decoder_fx(
DTFS_STRUCTURE_FX *CURRCW_Q_DTFS_FX, /* i/o: Current CW DTFS */
Word16 prevCW_lag_fx, /* i : Previous lag */
Word16 *lastLgainD_fx, /* i/o: Last gain lowband Q11 */
@@ -6931,8 +6853,7 @@ void ppp_quarter_decoder_fx(
,Decoder_State_fx *st
);
-
-void ppp_voiced_decoder_fx(
+ivas_error ppp_voiced_decoder_fx(
Decoder_State_fx *st_fx, /* i/o: state structure */
Word16 *out_fx, /* o : residual signal */
const Word16 *lpc2_fx, /* i : current frame LPC */
@@ -6957,9 +6878,11 @@ void updt_bw_switching_fx(
const Word16 Qpost
);
void updt_dec_common_fx(
- Decoder_State_fx *st_fx, /* i/o: decoder state structure */
- Word16 hq_core_type_fx, /* i : HQ core type */
- const Word16 *synth /* i : decoded synthesis */
+ Decoder_State_fx* st_fx, /* i/o: decoder state structure */
+ Word16 hq_core_type_fx, /* i : HQ core type */
+ const Word16 concealWholeFrameTmp, /* i : concealWholeFrameTmp flag */
+ const Word16* synth, /* i : decoded synthesis */
+ const Word16 Qpostd /* i : Synthesis Q value */
);
void sort_32_fx(
@@ -7022,33 +6945,23 @@ void hq_timedomain_conc_fx(
Word16 ratio(const Word32, const Word32, Word16 *);
-void nearProjQ15_fx(
- Word16 x,
- Word16 *result
-);
-
-void Ratio_rQ3_fx(
- Word16 opp,
- Word16 near,
- Word16 *result
-);
void densityAngle2RmsProjDec_fx(
- Word16 D, /* i: density */
- Word16 indexphi, /* i: decoded index from AR dec */
- Word16 *oppQ15, /* o: proj*/
- Word16 *nearQ15, /* o: */
- Word16 *oppRatioQ3 /* o: */
-) ;
+ const Word16 D, /* i : density */
+ const Word16 indexphi, /* i : decoded index from AR dec */
+ Word16* oppQ15, /* o : opposite */
+ Word16* nearQ15, /* o : near */
+ Word16* oppRatioQ3 /* o : ratio */
+);
-void densityAngle2RmsProjEnc_fx (
- Word16 D,
- Word16 phiQ14uq,
- Word16 *indexphi, /* o: index to send to AR */
- Word16 *oppQ15, /* o: proj*/
- Word16 *nearQ15,
- Word16 *oppRatioQ3
-) ;
+void densityAngle2RmsProjEnc_fx(
+ const Word16 D, /* i : density */
+ const Word16 phiQ14uq, /* i : angle */
+ Word16* indexphi, /* o : index */
+ Word16* oppQ15, /* o : opposite */
+ Word16* nearQ15, /* o : near */
+ Word16* oppRatioQ3 /* o : ratio */
+);
void dsDiracPerQuanta_fx(
const Word16 td,
const Word16 t_quanta,
@@ -7058,10 +6971,10 @@ void dsDiracPerQuanta_fx(
);
void QuantaPerDsDirac_fx(
- Word16 td,
- Word16 dsDiracIndex,
- const unsigned char* const* dimFrQuanta,
- Word16 *Quanta
+ const Word16 td, /* i : Length of vector segment */
+ const Word16 dsDiracIndex, /* i : Quanta table index */
+ const unsigned char* const* dimFrQuanta, /* i : Quanta lookup table */
+ Word16* Quanta /* i : Quanta */
);
void obtainEnergyQuantizerDensity_fx(
@@ -7105,7 +7018,7 @@ void IGFEncApplyMono(const IGF_ENC_INSTANCE_HANDLE hInstance,
Word16 MDCTSpectrum_e, /**< in: | exponent of MDCT spectrum */
Word32 *pPowerSpectrum, /**< in: Q31 | MDCT^2 + MDST^2 spectrum, or estimate */
Word16 PowerSpectrum_e, /**< in: | exponent of pPowerSpectrum */
- Word16 isTCX20, /**< in: Q0 | flag indicating if the input is TCX20 or TCX10/2xTCX5 */
+ Word16 isTCX20, /**< in: Q0 | flag indicating if the i is TCX20 or TCX10/2xTCX5 */
Word16 isTNSActive, /**< in: Q0 | flag indicating if the TNS is active */
Word16 last_core_acelp /**< in: Q0 | indictaor if last frame was acelp coded */
);
@@ -7120,16 +7033,17 @@ void IGFEncConcatenateBitstream(const IGF_ENC_INSTANCE_HANDLE hInstance,
void IGFEncResetTCX10BitCounter(const IGF_ENC_INSTANCE_HANDLE hInstance /**< in: | instance handle of IGF Encoder */
);
-void IGFEncSetMode(const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */
- const Word32 bitRate, /**< in: Q0 | encoder bitrate */
- const Word16 mode /**< in: Q0 | encoder bandwidth mode */
- , const Word16 rf_mode /**< in: | flag to signal the RF mode */
-
- );
+void IGFEncSetMode(
+ const IGF_ENC_INSTANCE_HANDLE hIGFEnc, /* i/o: instance handle of IGF Encoder */
+ const Word32 total_brate, /* i : encoder total bitrate */
+ const Word16 bwidth, /* i : encoder audio bandwidth */
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word16 rf_mode /* i : flag to signal the RF mode */
+);
Word16 IGFEncWriteBitstream( /**< out: | number of bits written per frame */
const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */
- Encoder_State_fx *st, /**< in: | encoder state */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
Word16 *pBitOffset, /**< in: | ptr to bitOffset counter */
const Word16 igfGridIdx, /**< in: Q0 | igf grid index see declaration of IGF_GRID_IDX for details */
const Word16 isIndepFlag /**< in: Q0 | if 1 frame is independent, 0 = frame is coded with data from previous frame */
@@ -7137,8 +7051,8 @@ Word16 IGFEncWriteBitstream(
Word16 IGFEncWriteConcatenatedBitstream( /**< out: Q0 | total number of bits written */
const IGF_ENC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Encoder */
- void *st /**< in: | encoder state */
-);
+ BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */
+ );
/* IGFDec.c */
void IGFDecApplyMono(const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */
@@ -7170,14 +7084,18 @@ void IGFDecRestoreTCX10SubFrameData(const IGF_DEC_INSTANCE_HANDLE hInstance,
const Word16 subFrameIdx /**< in: Q0 | index of subframe */
);
-void IGFDecSetMode(const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */
- const Word32 bitRate, /**< in: Q0 | bitrate */
- const Word16 mode, /**< in: Q0 | bandwidth mode */
- const Word16 defaultStartLine, /**< in: Q0 | default start subband index */
- const Word16 defaultStopLine /**< in: Q0 | default stop subband index */
- , const Word16 rf_mode /**< in: | flag to signal the RF mode */
- );
-
+void IGFDecSetMode(
+ const IGF_DEC_INSTANCE_HANDLE hIGFDec, /* o : instance handle of IGF Decoder */
+ const Word32 total_brate, /* i : bitrate */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word16 defaultStartLine, /* i : default start subband index */
+ const Word16 defaultStopLine, /* i : default stop subband index */
+ const Word16 rf_mode /* i : flag to signal the RF mode */
+);
+void init_igf_dec(
+ IGF_DEC_INSTANCE_HANDLE hIGFDec /* i/o: IGF decoder handle */
+);
void IGFDecStoreTCX10SubFrameData(const IGF_DEC_INSTANCE_HANDLE hInstance, /**< in: | instance handle of IGF Decoder */
const Word16 subFrameIdx /**< in: Q0 | index of subframe */
);
@@ -7196,26 +7114,28 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec(const Word16 startSfb,
Word16 *sfbEnergy_exp /**< out: | Exponent of PowerSpectrum */
);
-Word16 IGFCommonFuncsIGFConfiguration( /**< out: | error value: 0 -> error, 1 -> ok */
- Word32 bitRate, /**< in: Q0 | bitrate in bs e.g. 9600 for 9.6kbs */
- Word16 mode, /**< in: Q0 | bandwidth mode */
- H_IGF_INFO hIGFInfo /**< out: | IGF info handle */
- ,Word16 rf_mode /**< in: flag to signal the RF mode */
-);
-
-Word16 IGFCommonFuncsIGFGetCFTables( /**< out: | error value: 0 -> error, 1 -> ok */
- Word32 bitRate, /**< in: Q0 | bitrate in bs e.g. 9600 for 9.6kbs */
- Word16 mode, /**< in: Q0 | bandwidth mode */
- Word16 rf_mode, /**< in: | flag to signal the RF mode */
- const Word16 **cf_se00, /**< out: | CF table for t == 0 and f == 0 */
- const Word16 **cf_se01, /**< out: | CF table for t == 0 and f == 1 */
- Word16 *cf_off_se01, /**< out: | offset for CF table above */
- const Word16 **cf_se02, /**< out: | CF tables for t == 0 and f >= 2 */
- const Word16 **cf_off_se02, /**< out: | offsets for CF tables above */
- const Word16 **cf_se10, /**< out: | CF table for t == 1 and f == 0 */
- Word16 *cf_off_se10, /**< out: | offset for CF table above */
- const Word16 **cf_se11, /**< out: | CF tables for t == 1 and f >= 1 */
- const Word16 **cf_off_se11 /**< out: | offsets for CF tables above */
+Word16 IGFCommonFuncsIGFConfiguration(
+ const Word32 total_brate, /* i : bitrate in bs e.g. 9600 for 9.6kbs */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 element_mode, /* i : element mode */
+ H_IGF_INFO hIGFInfo, /* o : IGF info handle */
+ const Word16 rf_mode /* i : flag to signal the RF mode */
+);
+
+Word16 IGFCommonFuncsIGFGetCFTables(
+ const Word32 total_brate, /* i : bitrate in bs e.g. 9600 for 9.6kbs */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 element_mode, /* i : element mode */
+ const Word16 rf_mode, /* i : flag to signal the RF mode */
+ const Word16** cf_se00, /* o : CF table for t == 0 and f == 0 */
+ const Word16** cf_se01, /* o : CF table for t == 0 and f == 1 */
+ Word16* cf_off_se01, /* o : offset for CF table above */
+ const Word16** cf_se02, /* o : CF tables for t == 0 and f >= 2 */
+ const Word16** cf_off_se02, /* o : offsets for CF tables above */
+ const Word16** cf_se10, /* o : CF table for t == 1 and f == 0 */
+ Word16* cf_off_se10, /* o : offset for CF table above */
+ const Word16** cf_se11, /* o : CF tables for t == 1 and f >= 1 */
+ const Word16** cf_off_se11 /* o : offsets for CF tables above */
);
void IGFCommonFuncsMDCTSquareSpec(const Word16 sqrtBgn, /**< in: Q0 | start MDCT subband index */
@@ -7227,18 +7147,20 @@ void IGFCommonFuncsMDCTSquareSpec(const Word16 sqrtBgn,
Word16 indexOffset /**< in: Q0 | index offset */
);
-void IGFCommonFuncsWriteSerialBit(void *st, /**< in: | encoder/decoder state structure */
- Word16 *pBitOffset, /**< out: Q0 | bit offset */
- Word16 bit /**< in: Q0 | value of bit */
- );
+void IGFCommonFuncsWriteSerialBit(
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ Word16* pBitOffset, /**< out: Q0 | bit offset */
+ Word16 bit /**< in: Q0 | value of bit */
+ );
/* IGFSCFEncoder.c */
void IGFSCFEncoderOpen(
- IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i/o: handle to public data */
- Word16 scfCountLongBlock, /* i: number of SCFs for a long block */
- Word32 bitRate, /* i: bitrate in bps */
- Word16 mode /* i: operating mode */
- , Word16 rf_mode /**< in: flag to signal the RF mode */
+ IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i/o: handle to public data */
+ H_IGF_INFO hIgfInfo, /* i : IGF info handle */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word16 rf_mode /* i : flag to signal the RF mode */
);
void IGFSCFEncoderReset(
@@ -7246,29 +7168,32 @@ void IGFSCFEncoderReset(
);
Word16 IGFSCFEncoderEncode(
- IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i/o: handle to public data */
- Encoder_State_fx *st, /* i/o: pointer to encoder state */
- Word16 bitCount, /* i: offset to the first bit in bitbuffer which should be written by the raw AC functions */
- Word16 *sfe, /* i: pointer to an array which contains the quantized SCF energies to be encoded */
- Word16 indepFlag, /* i: 1 if the block is an independent block, 0 otherwise */
- Word16 doRealEncoding /* i: whether the real encoding is needed, otherwise only the number of bits is used */
+ IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i : handle to public data or NULL in case there was no instance created */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 bitCount, /* i : offset to the first bit in bitbuffer which should be readed by iisArithDecoderDecode function */
+ Word16* sfe, /* i : ptr to an array which contain quantized scalefactor energies */
+ const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */
+ const Word16 indepFlag /* i : if 1 frame is independent, 0 = frame is coded with data from previous frame */
);
void IGFSCFEncoderSaveContextState(
- IGFSCFENC_INSTANCE_HANDLE hPublicData /* i/o: handle to public data */
+ IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i/o: handle to public data */
+ const Word16 igfGridIdx /* i : igf grid index see declaration of IGF_GRID_IDX for details */
);
void IGFSCFEncoderRestoreContextState(
- IGFSCFENC_INSTANCE_HANDLE hPublicData /* i/o: handle to public data */
+ IGFSCFENC_INSTANCE_HANDLE hPublicData, /* i/o: handle to public data */
+ const Word16 igfGridIdx /* i : igf grid index see declaration of IGF_GRID_IDX for details */
);
/* IGFSCFDecoder.c */
void IGFSCFDecoderOpen(
- IGFSCFDEC_INSTANCE_HANDLE hPublicData, /* i/o: handle to public data */
- Word16 scfCountLongBlock, /* i: number of SCFs for a long block */
- Word32 bitRate, /* i: bitrate in bps */
- Word16 mode /* i: operating mode */
- ,Word16 rf_mode
+ IGFSCFDEC_INSTANCE_HANDLE hPublicData, /* i : handle to public data */
+ H_IGF_INFO hIgfInfo, /* i : IGF info handle */
+ const Word32 total_brate,
+ const Word16 bwidth,
+ const Word16 element_mode,
+ const Word16 rf_mode
);
void IGFSCFDecoderReset(
@@ -7276,17 +7201,19 @@ void IGFSCFDecoderReset(
);
void IGFSCFDecoderDecode(
- IGFSCFDEC_INSTANCE_HANDLE hPublicData, /* i/o: handle to public data */
- Decoder_State_fx *st, /* i/o: pointer to decoder state */
- Word16 *sfe, /* o: pointer to an array which will contain the decoded quantized SCFs */
- Word16 indepFlag /* i: 1 if the block is an independent block, 0 otherwise */
+ IGFSCFDEC_INSTANCE_HANDLE hPublicData, /* i/o: handle to public data or NULL in case there was no instance created */
+ Decoder_State_fx* st, /* i/o: pointer to decoder state */
+ int16_t* sfe, /* o : ptr to an array which will contain the decoded quantized coefficients */
+ const Word16 igfGridIdx, /* i : igf grid index see declaration of IGF_GRID_IDX for details */
+ const Word16 indepFlag /* i : if 1 on input the decoder will be forced to reset,
+ if 0 on input the decoder will be forced to encode without a reset */
);
Word32 SFM_Cal(Word32 magn[], Word16 n);
void Unified_weighting_fx(
- Word32 Bin_Ener_128_fx[], /* i : FFT Bin energy 128 bins in two sets Q_ener */
+ const Word32 Bin_Ener_128_fx[], /* i : FFT Bin energy 128 bins in two sets Q_ener */
Word16 Q_ener,
const Word16 lsf_fx[], /* i : LSF vector x2.56 */
Word16 w_fx[], /* o : LP weighting filter (numerator) Q8 */
@@ -7297,34 +7224,31 @@ void Unified_weighting_fx(
);
void lsf_dec_bfi(
- const Word16 codec_mode, /* i: : codec mode: MODE1 | MODE2 */
- Word16*lsf, /*!< o : 14Q1*1.28 quantized ISFs */
- const Word16*lsfold, /*!< i : 14Q1*1.28 past quantized ISF */
- Word16*lsf_adaptive_mean, /*!< i : 14Q1*1.28 ISF adaptive mean, updated when BFI==0 */
- const Word16 lsfBase[], /* i : base for differential lsf coding */
- Word16*mem_MA, /*!< i/o: 14Q1*1.28 quantizer memory for MA model */
- Word16*mem_AR, /*!< i/o: 14Q1*1.28 quantizer memory for MA model */
+ const Word16 codec_mode, /* i: : codec mode: MODE1 | MODE2 */
+ Word16* lsf, /*!< o : 14Q1*1.28 quantized ISFs */
+ const Word16* lsfold, /*!< i : 14Q1*1.28 past quantized ISF */
+ Word16* lsf_adaptive_mean, /*!< i : 14Q1*1.28 ISF adaptive mean, updated when BFI==0 */
+ const Word16 lsfBase[], /* i : base for differential lsf coding */
+ Word16* mem_MA, /*!< i/o: 14Q1*1.28 quantizer memory for MA model */
+ Word16* mem_AR, /*!< i/o: 14Q1*1.28 quantizer memory for MA model */
Word16 stab_fac, /*!< i : ISF stability factor (shifted right by 1) */
- const Word16 last_coder_type, /*!< i : coding type in last good received fr. */
+ const Word16 last_coder_type,/*!< i : coding type in last good received fr. */
Word16 L_frame,
- const Word16 last_good, /*!< i : last good received frame */
- const Word16 nbLostCmpt, /*!< i : counter of consecutive bad frames */
- Word8 plcBackgroundNoiseUpdated,
- Word16 *lsf_q_cng, /* o : quantized ISFs for background noise (14Q1*1.28) */
- Word16 *lsf_cng,
- Word16 *old_lsf_q_cng, /* o : old quantized ISFs for background noise */
+ const Word16 last_good, /*!< i : last good received frame */
+ const Word16 nbLostCmpt, /*!< i : counter of consecutive bad frames */
+ const Word8 plcBackgroundNoiseUpdated, /* i : background noise already updated?*/
+ Word16* lsf_q_cng, /* o : quantized ISFs for background noise (14Q1*1.28) */
+ Word16* lsf_cng,
+ Word16* old_lsf_q_cng, /* o : old quantized ISFs for background noise */
const Word16 Last_GSC_pit_band_idx,
- const Word16 Opt_AMR_WB, /* i : IO flag */
- const Word8 tcxonly
- ,const short MODE1_bwidth /* i: coded bandwidth */
+ const Word16 Opt_AMR_WB, /* i : IO flag */
+ const Word8 tcxonly,
+ const short bwidth /* i: coded bandwidth */
);
void lpc_quantization(
- Encoder_State_fx * st,
- const Word16 core,
- const Word16 lpcQuantization,
- const Word16 lsfold_q[],
+ Encoder_State_fx* st,
const Word16 lsp[],
const Word16 lspmid[],
Word16 lsp_q[],
@@ -7332,18 +7256,12 @@ void lpc_quantization(
Word16 lspmid_q[],
Word16 lspq_ind[],
Word16 clip_var[],
- Word16 mem_MA[],
- Word16 mem_AR[],
- const Word8 narrowBand,
const Word16 coder_type,
const Word8 acelp_midLpc,
Word16 param_lpc[],
Word16 nbits_lpc[],
- Word16 * bits_param_lpc,
- Word16 *no_param_lpc,
- Word16 *seed_acelp,
- Word32 * Bin_Ener_fx,
- Word32 * Bin_Ener_old_fx,
+ Word16* bits_param_lpc,
+ Word16* no_param_lpc,
const Word16 Q_ener
);
@@ -7468,35 +7386,35 @@ void E_LPC_a_weight_inv(const Word16 *a, Word16 *ap, const Word16 gamma, const W
void E_LPC_a_add_tilt(const Word16 *a, Word16 *ap, Word16 gamma, Word16 m);
void E_LPC_a_lsf_isf_conversion(Word16 *lpcCoeffs, Word16 *lsf, const Word16 *old_lsf, Word16 lpcOrder, Word8 lpcRep);
void E_LPC_a_lsp_conversion(
- const Word16 *a, /* input : LP filter coefficients */
- Word16 *lsp, /* output: Line spectral pairs (in the cosine domain) */
- const Word16 *old_lsp, /* input : LSP vector from past frame */
- const Word16 m /* input : LPC order */
+ const Word16 *a, /* i : LP filter coefficients */
+ Word16 *lsp, /* o : Line spectral pairs (in the cosine domain) */
+ const Word16 *old_lsp, /* i : LSP vector from past frame */
+ const Word16 m /* i : LPC order */
);
void E_LPC_lsp_lsf_conversion(
- const Word16 lsp[], /* input: lsp[m] (range: -1<=val<1) */
+ const Word16 lsp[], /* i : lsp[m] (range: -1<=val<1) */
Word16 lsf[], /* output : lsf[m] normalized (range: 0<=val<=6400) */
- const Word16 m /* input : LPC order */
+ const Word16 m /* i : LPC order */
);
void E_LPC_lsf_lsp_conversion(
- const Word16 lsf[], /* input : lsf[m] normalized (range: 0<=val<=6400) */
- Word16 lsp[], /* output: lsp[m] (range: -1<=val<1) */
- const Word16 m /* input : LPC order */
+ const Word16 lsf[], /* i : lsf[m] normalized (range: 0<=val<=6400) */
+ Word16 lsp[], /* o : lsp[m] (range: -1<=val<1) */
+ const Word16 m /* i : LPC order */
);
void E_LPC_f_lsp_a_conversion(const Word16 *lsp, Word16 *a, const Word16 m);
void E_LPC_a_isp_conversion(
- const Word16 *a, /* input : LP filter coefficients */
- Word16 *isp, /* output: Line spectral pairs (in the cosine domain) */
- const Word16 *old_isp,/* input : LSP vector from past frame */
- const Word16 m /* input : LPC order */
+ const Word16 *a, /* i : LP filter coefficients */
+ Word16 *isp, /* o : Line spectral pairs (in the cosine domain) */
+ const Word16 *old_isp,/* i : LSP vector from past frame */
+ const Word16 m /* i : LPC order */
);
void E_LPC_isp_isf_conversion(const Word16 isp[], Word16 isf[], const Word16 m);
void E_LPC_isf_isp_conversion(const Word16 isf[], Word16 isp[], const Word16 m);
void E_LPC_f_isp_a_conversion(const Word16 *isp, Word16 *a, const Word16 m);
-void E_LPC_int_lpc_tcx(const Word16 lsp_old[], /* input : LSPs from past frame (1Q14) */
- const Word16 lsp_new[], /* input : LSPs from present frame (1Q14) */
- Word16 a[] /* output: interpolated LP coefficients (4Q11) */
+void E_LPC_int_lpc_tcx(const Word16 lsp_old[], /* i : LSPs from past frame (1Q14) */
+ const Word16 lsp_new[], /* i : LSPs from present frame (1Q14) */
+ Word16 a[] /* o : interpolated LP coefficients (4Q11) */
);
/* enc_gain.c */
@@ -7563,34 +7481,27 @@ void E_ACELP_adaptive_codebook(
);
void E_ACELP_innovative_codebook(
- Word16 *exc, /* i : pointer to the excitation frame */
- Word16 T0, /* i : integer pitch lag */
- Word16 T0_frac, /* i : fraction of lag */
- Word16 T0_res, /* i : pitch resolution */
- Word16 gain_pit, /* i : adaptive codebook gain */
- Word16 tilt_code, /* i : tilt factor */
- Word16 mode, /* i : innovative codebook mode */
- Word16 formant_enh, /* i : use formant enhancement Q15 */
- Word16 formant_tilt, /* i : use tilt of formant enhancement */
- const Word16 formant_enh_num, /* i : formant sharpening numerator weighting */
- const Word16 foramnt_enh_den, /* i : formant sharpening denominator weighting */
- Word16 pitch_sharpening,/* i : use pitch sharpening */
- Word16 pre_emphasis,
- Word16 phase_scrambling,
- Word16 i_subfr, /* i : subframe index */
- const Word16 *Aq, /* i : quantized LPC coefficients */
- Word16 *h1, /* i : impulse response of weighted synthesis filter */
- Word16 *xn, /* i : Close-loop Pitch search target vector */
- Word16 *cn, /* i : Innovative codebook search target vector */
- Word16 *y1, /* i : zero-memory filtered adaptive excitation */
- Word16 *y2, /* o : zero-memory filtered algebraic excitation */
- Word8 acelpautoc, /* i : autocorrelation mode enabled */
- Word16 **pt_indice, /* i/o: quantization indices pointer */
- Word16 *code, /* o : innovative codebook Q9 */
- Word16 shift /* i : Scaling to get 12 bits */
- ,const Word16 L_frame, /* i : length of the frame */
- const Word16 last_L_frame, /* i : length of the last frame */
- const Word32 total_brate /* i : total bit-rate */
+ Word16* exc, /* i : pointer to the excitation frame Q_new */
+ Word16 T0, /* i : integer pitch lag Q0 */
+ Word16 T0_frac, /* i : fraction of lag Q0 */
+ Word16 T0_res, /* i : pitch resolution Q0 */
+ Word16 pitch_gain, /* i : adaptive codebook gain 1Q14 */
+ Word16 tilt_code, /* i : tilt factor Q15 */
+ ACELP_config* acelp_cfg,/* i/o: configuration of the ACELP */
+ Word16 i_subfr, /* i : subframe index */
+ const Word16* Aq, /* i : quantized LPC coefficients 3Q12 */
+ Word16* h1, /* i : impulse response of weighted synthesis filter 1Q14+shift */
+ Word16* xn, /* i : Close-loop Pitch search target vector Q_xn */
+ Word16* cn, /* i : Innovative codebook search target vector Q_new */
+ Word16* y1, /* i : zero-memory filtered adaptive excitation Q_xn */
+ Word16* y2, /* o : zero-memory filtered algebraic excitation Q9 */
+ Word8 acelpautoc, /* i : autocorrelation mode enabled */
+ Word16** pt_indice, /* i/o: quantization indices pointer */
+ Word16* code, /* o : innovative codebook Q9 Q9 */
+ Word16 shift, /* i : Scaling to get 12 bits */
+ const Word16 L_frame, /* i : length of the frame */
+ const Word16 last_L_frame,/* i : length of the last frame */
+ const Word32 total_brate /* i : ttoal bit-rate */
);
Word16 E_ACELP_code43bit(const Word16 code[], UWord32 *ps, Word16 *p, UWord16 idxs[]);
@@ -7632,18 +7543,18 @@ void fcb_pulse_track_joint_decode(UWord16 *idxs, Word16 wordcnt, UWord32 *index_
void lag_wind(
Word16 r_h[], /* in/out: autocorrelations */
Word16 r_l[], /* in/out: autocorrelations */
- Word16 m, /* input : order of LP filter */
- Word32 sr, /* input : sampling rate */
- Word16 strength /* input : LAGW_WEAK, LAGW_MEDIUM, or LAGW_STRONG */
+ Word16 m, /* i : order of LP filter */
+ Word32 sr_core, /* i : sampling rate */
+ Word16 strength /* i : LAGW_WEAK, LAGW_MEDIUM, or LAGW_STRONG */
);
void adapt_lag_wind(
Word16 r_h[], /* in/out: autocorrelations */
Word16 r_l[], /* in/out: autocorrelations */
- Word16 m, /* input : order of LP filter */
- const Word16 Top, /* input : open loop pitch lag */
- const Word16 Tnc, /* input : open loop pitch gain */
- Word32 sr /* input : sampling rate */
+ Word16 m, /* i : order of LP filter */
+ const Word16 Top, /* i : open loop pitch lag */
+ const Word16 Tnc, /* i : open loop pitch gain */
+ Word32 sr_core /* i : sampling rate */
);
void hp20(Word16 signal[], /* i/o: signal to filter any */
@@ -7656,15 +7567,15 @@ void hp20(Word16 signal[], /* i/o: signal to filter any */
/* mem[3]: x[-1] << 16 */
/* Note: mem[0..3] need to be scaled per frame */
/* mem[4]: states scale */
- const Word32 sFreq); /* i : input sampling rate Q0 */
+ const Word32 sFreq); /* i : i sampling rate Q0 */
/* pit_fr4.c */
void Mode2_pred_lt4(Word16 exc[], /* in/out: excitation buffer */
- Word16 T0, /* input : integer pitch lag */
- Word16 frac, /* input : fraction of lag */
- Word16 T0_res, /* input : pitch lag resolution */
- Word16 T0_res_max, /* input : maximum resolution */
- Word16 L_subfr); /* input : subframe size */
+ Word16 T0, /* i : integer pitch lag */
+ Word16 frac, /* i : fraction of lag */
+ Word16 T0_res, /* i : pitch lag resolution */
+ Word16 T0_res_max, /* i : maximum resolution */
+ Word16 L_subfr); /* i : subframe size */
#define mvr2r_Word32(x,y,n) Copy32(x,y,n)
@@ -7672,39 +7583,56 @@ void Mode2_pred_lt4(Word16 exc[], /* in/out: excitation buffer */
#define vr_intset(val, vector, count) { Word16 i; FOR(i=0; i<(count); i++) { vector[i]=val; } }
float mean( /* o : the mean of the elements of the vector */
- const float *vec, /* i : input vector */
- const short lvec /* i : length of input vector */
+ const float *vec, /* i : i vector */
+ const short lvec /* i : length of i vector */
);
/* window.c */
void ham_cos_window(Word16 *fh, const Word16 n1, const Word16 n2);
+Word16 cng_energy(
+ const Word16 element_mode, /* i : element mode */
+ const Word16 bwidth, /* i : audio bandwidh */
+ const Word16 CNG_mode, /* i : mode for DTX configuration */
+ const Word16 CNG_att, /* i : attenuation factor for CNG */
+ const Word16* exc, /* i : i signal */
+ const Word16 len, /* i : vector length */
+ const Word16 Q_new /* i : Input scaling */
+);
/*---------------------------------------------------------------------*
* main routines *
*---------------------------------------------------------------------*/
-void init_coder_ace_plus( Encoder_State_fx* st,const Word16 shift);
-void core_coder_reconfig( Encoder_State_fx *st);
-void core_coder_mode_switch( Encoder_State_fx *st, const Word16 bandwidth_in, const Word32 bitrate, const Word16 shift);
+void init_coder_ace_plus(
+ Encoder_State_fx* st,
+ const Word32 last_total_brate, /* i : last total bitrate */
+ const Word16 shift,
+ const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) */
+);
+void core_coder_reconfig(
+ Encoder_State_fx* st,
+ const Word32 last_total_brate
+);
+void core_coder_mode_switch(
+ Encoder_State_fx* st,
+ const Word32 last_total_bitrate,
+ const Word16 is_mct,
+ const Word16 shift
+);
void enc_acelp_tcx_main(
- const Word16 new_samples[], /* i : new samples */
- Encoder_State_fx *st, /* i/o: encoder state structure */
- const Word16 coder_type, /* i : coding type */
- const Word16 pitch[3], /* i : open-loop pitch values for quantiz. */
- const Word16 voicing[3], /* i : open-loop pitch gains */
- Word16 Aw[NB_SUBFR16k*(M+1)], /* i : weighted A(z) unquant. for subframes*/
- const Word16 lsp_new[M], /* i : LSPs at the end of the frame */
- const Word16 lsp_mid[M], /* i : LSPs at the middle of the frame */
- HANDLE_FD_CNG_ENC hFdCngEnc, /* i/o: FD CNG handle */
- Word32 bwe_exc_extended[], /* i/o: bandwidth extended excitation */
- Word16 *voice_factors, /* o : voicing factors */
- Word16 pitch_buf[], /* o : floating pitch for each subframe */
- Word16 vad_hover_flag,
- const Word16 vad_flag_dtx,
- Word16 *Q_new,
- Word16 *shift
+ const Word16 new_samples[], /* i : new samples */
+ Encoder_State_fx* st, /* i/o: encoder state structure */
+ Word16 Aw[NB_SUBFR16k * (M + 1)], /* i : weighted A(z) unquant. for subframes*/
+ const Word16 lsp_new[M], /* i : LSPs at the end of the frame */
+ const Word16 lsp_mid[M], /* i : LSPs at the middle of the frame */
+ Word32 bwe_exc_extended[], /* i/o: bandwidth extended excitation */
+ Word16* voice_factors, /* o : voicing factors */
+ Word16 pitch_buf[], /* o : floating pitch for each subframe */
+ Word16 vad_hover_flag, /* i : VAD hangover flag */
+ Word16* Q_new,
+ Word16* shift
);
/*-----------------------------------------------------------------*
@@ -7735,8 +7663,6 @@ void get_subframe_pitch(
void core_encode_openloop(
Encoder_State_fx *st, /* i/o: encoder state structure */
const Word16 coder_type, /* i : coding type */
- const Word16 pitch[3], /* i : open-loop pitch values for quantiz. */
- const Word16 voicing[3], /* i : open-loop pitch gains */
const Word16 Aw[NB_SUBFR16k*(M+1)], /* i : weighted A(z) unquant. for subframes*/
const Word16 *lsp_new, /* i : LSPs at the end of the frame */
const Word16 *lsp_mid, /* i : LSPs at the middle of the frame */
@@ -7751,10 +7677,7 @@ void core_encode_openloop(
void core_acelp_tcx20_switching(
Encoder_State_fx *st, /* i/o: encoder state structure */
- const Word16 vad_flag,
- Word16 sp_aud_decision0,
Word16 non_staX,
- Word16 *pitch, /* i : open-loop pitch values for quantiz. */
Word16 *pitch_fr, /* i/o: fraction pitch values */
Word16 *voicing_fr, /* i/o: fractional voicing values */
const Word16 currFlatness, /* i : flatness */
@@ -7765,18 +7688,21 @@ void core_acelp_tcx20_switching(
);
void core_encode_twodiv(
- const Word16 new_samples[],
- Encoder_State_fx *st,
- const Word16 coder_type, /* i : coding type */
- const Word16 pitch[3], /* i : open-loop pitch values for quantiz. */
- const Word16 voicing[3], /* i : open-loop pitch gains */
- Word16 Aw[NB_SUBFR16k*(M+1)], /* i : weighted A(z) unquant. for subframes*/
- Word16 *Q_new,
- Word16 *shift
+ const Word16 new_samples[], /* i : new samples */
+ Encoder_State_fx* st, /* i/o: coder memory state */
+ const Word16 coder_type, /* i : coding type */
+ Word16 Aw[NB_SUBFR16k * (M + 1)], /* i : weighted A(z) unquant. for subframes*/
+ const Word16 vad_hover_flag, /* i : VAD hangover flag */
+ Word16* Q_new,
+ Word16* shift
);
void core_encode_update( Encoder_State_fx *st);
-
+void updt_enc_common(
+ Encoder_State_fx* st, /* i/o: encoder state structure */
+ const Word16 Etot, /* i : total energy */
+ const Word16 Q_new /* i : CUrrent frame scaling */
+);
void core_encode_update_cng( Encoder_State_fx *st,
Word16 *timeDomainBuffer,
Word16 *A,
@@ -7795,25 +7721,24 @@ void core_signal_analysis_enc(const Word16 *new_samples, /*syn */
Word8 fb /* i: fullband flag */
);
@@ -8549,14 +8494,20 @@ Word16 tcx_res_invQ_spec(
);
void InitTnsConfigs(
- Word32 nSampleRate,
- Word16 L_frame,
- STnsConfig tnsConfig[2][2]
- ,Word16 igfStopFreq
- ,Word32 bitrate
+ const Word16 bwidth,
+ const Word16 L_frame,
+ STnsConfig tnsConfig[2][2],
+ const Word16 igfStopFreq,
+ const Word32 total_brate,
+ const Word16 element_mode,
+ const Word16 is_mct
);
-void SetTnsConfig(TCX_config * tcx_cfg, Word8 isTCX20, Word8 isAfterACELP);
+void SetTnsConfig(
+ TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */
+ Word8 isTCX20,
+ Word8 isAfterACELP
+);
/* ari.c */
@@ -8620,31 +8571,32 @@ Word16 ari_start_decoding_14bits_prm(const Word16 *ptr, Word16 bp, TastatDec *s)
/*arith_code.c*/
Word32 expfp( /* o: Q31 */
- Word16 x, /* i: mantissa Q-e */
- Word16 x_e); /* i: exponent Q0 */
+ const Word16 x, /* i: mantissa Q-e */
+ const Word16 x_e); /* i: exponent Q0 */
-void powfp_odd2(Word16 base, /* Q15 */
- Word16 exp, /* Q0 */
- Word16 *pout1, /* Q15 */
- Word16 *pout2); /* Q15 */
+void powfp_odd2(
+ const Word16 base, /* Q15 */
+ const Word16 exp, /* Q0 */
+ Word16 *pout1, /* Q15 */
+ Word16 *pout2); /* Q15 */
void tcx_arith_scale_envelope(
- Word16 L_spec_core, /* i: number of lines to scale Q0 */
+ const Word16 L_spec_core, /* i: number of lines to scale Q0 */
Word16 L_frame, /* i: number of lines Q0 */
- Word32 env[], /* i: unscaled envelope Q16 */
+ const Word32 env[], /* i: unscaled envelope Q16 */
Word16 target_bits, /* i: number of available bits Q0 */
- Word16 low_complexity, /* i: low-complexity flag Q0 */
+ const Word16 low_complexity,/* i: low-complexity flag Q0 */
Word16 s_env[], /* o: scaled envelope Q15-e */
Word16 *s_env_e /* o: scaled envelope exponent Q0 */
);
void tcx_arith_render_envelope(
- const Word16 A_ind[], /* i: LPC coefficients of signal envelope */
- Word16 L_frame, /* i: number of spectral lines */
- Word16 L_spec,
- Word16 preemph_fac, /* i: pre-emphasis factor */
- Word16 gamma_w, /* i: A_ind -> weighted envelope factor */
- Word16 gamma_uw, /* i: A_ind -> non-weighted envelope factor */
+ const Word16 A_ind[], /* i: LPC coefficients of signal envelope */
+ const Word16 L_frame, /* i: number of spectral lines */
+ const Word16 L_spec,
+ const Word16 preemph_fac, /* i: pre-emphasis factor */
+ const Word16 gamma_w, /* i: A_ind -> weighted envelope factor */
+ const Word16 gamma_uw, /* i: A_ind -> non-weighted envelope factor */
Word32 env[] /* o: shaped signal envelope */
);
@@ -8658,31 +8610,38 @@ void tcx_get_gain(Word32 *x, /* i: spectrum 1 */
Word32 *en_y, /* o: energy of y (optional) */
Word16 *en_y_e /* o: energy of y exponent (optional) */
);
-
-void init_TCX_config(TCX_config *tcx_cfg,
- Word16 L_frame,
- Word16 fscale
- ,Word16 L_frameTCX
- ,Word16 fscaleFB
- );
+void init_TCX_config_dec( /* TEMPORARY */
+ TCX_CONFIG_HANDLE hTcxCfg,
+ Word16 L_frame,
+ Word16 fscale
+ , Word16 L_frameTCX
+ , Word16 fscaleFB
+);
+void init_TCX_config(
+ TCX_CONFIG_HANDLE hTcxCfg,
+ Word16 L_frame,
+ Word16 fscale
+ ,Word16 L_frameTCX
+ ,Word16 fscaleFB
+);
void tcx_arith_encode_envelope(
- Word32 spectrum[], /* i/o: MDCT coefficients Q31-e */
- Word16 *spectrum_e, /* i/o: MDCT exponent Q0 */
- Word16 signs[], /* o: signs (spectrum[.]<0) Q0 */
- Word16 L_frame, /* i: frame or MDCT length Q0 */
- Word16 L_frame_orig, /* i: length w/o BW limitation Q0 */
- Encoder_State_fx *st, /* i/o: coder state */
- const Word16 A_ind[], /* i: quantised LPC coefficients Q12 */
- Word16 target_bits, /* i: number of available bits Q0 */
- Word16 prm[], /* o: bitstream parameters Q0 */
- Word8 use_hm, /* i: use HM in current frame? */
- Word16 prm_hm[], /* o: HM parameter area Q0 */
- Word16 tcxltp_pitch, /* i: TCX LTP pitch in FD, -1 if n/a Q0*/
- Word16 *arith_bits, /* o: bits used for ari. coding Q0 */
- Word16 *signaling_bits, /* o: bits used for signaling Q0 */
- Word16 *nf_seed /* o: noise filling seed Q0 */
- ,Word16 low_complexity /* i: low-complexity flag Q0 */
+ Word32 spectrum[], /* i/o: MDCT coefficients Q31-e */
+ Word16* spectrum_e, /* i/o: MDCT exponent Q0 */
+ Word16 signs[], /* o: signs (spectrum[.]<0) Q0 */
+ const Word16 L_frame, /* i: frame or MDCT length Q0 */
+ const Word16 L_spec, /* i: frame or MDCT length Q0 */
+ Encoder_State_fx* st, /* i/o: coder state */
+ const Word16 A_ind[], /* i: quantised LPC coefficients Q12 */
+ Word16 target_bits, /* i: number of available bits Q0 */
+ Word16 prm[], /* o: bitstream parameters Q0 */
+ const Word8 use_hm, /* i: use HM in current frame? */
+ Word16 prm_hm[], /* o: HM parameter area Q0 */
+ const Word16 tcxltp_pitch, /* i: TCX LTP pitch in FD, -1 if n/a Q0*/
+ Word16* arith_bits, /* o: bits used for ari. coding Q0 */
+ Word16* signaling_bits, /* o: bits used for signaling Q0 */
+ Word16* nf_seed, /* o: noise filling seed Q0 */
+ const Word16 low_complexity /* i: low-complexity flag Q0 */
);
void tcx_arith_decode_envelope(
Word32 q_spectrum[], /* o: quantised MDCT coefficients Q31-e */
@@ -8750,7 +8709,8 @@ void ConfigureContextHm(
Word16 EncodeIndex(
Word16 Bandwidth, /* 0: NB, 1: (S)WB */
Word16 PeriodicityIndex,
- Encoder_State_fx *st);
+ BSTR_ENC_HANDLE hBst /* i/o: bitstream handle */
+ );
Word16 CountIndexBits(
Word16 Bandwidth, /* 0: NB, 1: (S)WB */
@@ -8764,16 +8724,16 @@ DecodeIndex(
void tcx_hm_analyse(
- const Word32 abs_spectrum[], /* i: absolute spectrum Q31-e */
- Word16 *spectrum_e, /* i: absolute spectrum exponent Q0 */
- Word16 L_frame, /* i: number of spectral lines Q0 */
- Word32 env[], /* i/o: envelope shape Q16 */
- Word16 targetBits, /* i: target bit budget Q0 */
- Word16 coder_type, /* i: coder type Q0 */
- Word16 prm_hm[], /* o: HM parameters Q0 */
- Word16 LtpPitchLag, /* i: LTP pitch lag or -1 if none Q0 */
- Word16 LtpGain, /* i: LTP gain Q15 */
- Word16 *hm_bits /* o: bit consumption Q0 */
+ const Word32 abs_spectrum[],/* i: absolute spectrum Q31-e */
+ const Word16* spectrum_e, /* i: absolute spectrum exponent Q0 */
+ const Word16 L_frame, /* i: number of spectral lines Q0 */
+ Word32 env[], /* i/o: envelope shape Q16 */
+ const Word16 targetBits, /* i: target bit budget Q0 */
+ const Word16 coder_type, /* i: coder type Q0 */
+ Word16 prm_hm[], /* o: HM parameters Q0 */
+ const Word16 LtpPitchLag, /* i: LTP pitch lag or -1 if none Q0 */
+ const Word16 LtpGain, /* i: LTP gain Q15 */
+ Word16* hm_bits_out /* o: bit consumption Q0 */
);
void tcx_hm_decode(
@@ -8788,49 +8748,49 @@ void tcx_hm_decode(
void coder_tcx(
Word16 n,
- TCX_config *tcx_cfg, /*input: configuration of TCX*/
- Word16 A[], /* input: quantized coefficients NxAz_q[M+1] */
- Word16 Aqind[], /* input: frame-independent quantized coefficients (M+1) */
+ TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */
+ Word16 A[], /* i : quantized coefficients NxAz_q[M+1] */
+ Word16 Aqind[], /* i : frame-independent quantized coefficients (M+1) */
Word16 synth[],
- Word16 L_frame_glob, /* input: frame length */
+ Word16 L_frame_glob, /* i : frame length */
Word16 L_frameTCX_glob,
Word16 L_spec,
- Word16 nb_bits, /*input: bit budget*/
- Word8 tcxonly, /*input: only TCX flag*/
+ Word16 nb_bits, /*i : bit budget*/
+ Word8 tcxonly, /*i : only TCX flag*/
Word32 spectrum[], /* i/o: MDCT spectrum */
Word16 *spectrum_e, /* i/o: MDCT spectrum exponent */
- LPD_state *LPDmem, /*i/o: memories*/
- Word16 prm[], /* output: tcx parameters */
+ Word16 prm[], /* o : tcx parameters */
Encoder_State_fx *st,
CONTEXT_HM_CONFIG *hm_cfg
);
-void coder_tcx_post(Encoder_State_fx *st,
- LPD_state *LPDmem,
- TCX_config *tcx_cfg,
- Word16 *synth,
- const Word16 *A,
- const Word16 *Ai,
- Word16 *wsig,
- Word16 Q_new,
- Word16 shift
- );
+void coder_tcx_post(
+ Encoder_State_fx *st,
+ LPD_state *LPDmem,
+ TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */
+ Word16 *synth,
+ const Word16 *A,
+ const Word16 *Ai,
+ Word16 *wsig,
+ Word16 Q_new,
+ Word16 shift
+ );
void decoder_tcx(
- TCX_config *tcx_cfg, /* input: configuration of TCX */
- Word16 prm[], /* input: parameters */
- Word16 A[], /* input: coefficients NxAz[M+1] */
- Word16 Aind[], /* input: frame-independent coefficients Az[M+1] */
- Word16 L_frame_glob, /* input: frame length */
+ TCX_CONFIG_HANDLE hTcxCfg,
+ Word16 prm[], /* i : parameters */
+ Word16 A[], /* i : coefficients NxAz[M+1] */
+ Word16 Aind[], /* i : frame-independent coefficients Az[M+1] */
+ Word16 L_frame_glob, /* i : frame length */
Word16 L_frameTCX,
Word16 L_spec,
Word16 synth[], /* in/out: synth[-M-LFAC..lg] */
Word16 synthFB[],
Decoder_State_fx*st,
- Word16 coder_type, /* input : coder type */
- Word16 bfi, /* input: Bad frame indicator */
- Word16 frame_cnt, /* input: frame counter in the super_frame */
- Word16 stab_fac /* input: stability of isf */
+ Word16 coder_type, /* i : coder type */
+ Word16 bfi, /* i : Bad frame indicator */
+ Word16 frame_cnt, /* i : frame counter in the super_frame */
+ Word16 stab_fac /* i : stability of isf */
);
void decoder_tcx_post(Decoder_State_fx *st_fx,
@@ -8841,39 +8801,32 @@ void decoder_tcx_post(Decoder_State_fx *st_fx,
);
/* cod_ace.c */
-Word16 coder_acelp( /* output SEGSNR for CL decision */
- ACELP_config *acelp_cfg, /*input/output: configuration of the ACELP coding*/
- const Word16 coder_type, /* input: coding type */
- const Word16 A[], /* input: coefficients 4xAz[M+1] */
- const Word16 Aq[], /* input: coefficients 4xAz_q[M+1] */
- Word16 speech[], /* input: speech[-M..lg] */
- Word16 synth[],
- LPD_state *LPDmem,
- const Word16 voicing[], /* input: open-loop LTP gain */
- const Word16 T_op[], /* input: open-loop LTP lag */
- Word16 *prm, /* output: acelp parameters */
+Word16 coder_acelp( /* o : SEGSNR for CL decision */
+ const Word16 A[], /* i : coefficients 4xAz[M+1] */
+ const Word16 Aq[], /* i : coefficients 4xAz_q[M+1] */
+ const Word16 speech[], /* i : speech[-M..lg] */
+ Word16* prm, /* o : acelp parameters */
Word16 stab_fac,
- Encoder_State_fx *st,
- HANDLE_PLC_ENC_EVS hPlc_Ext,
- Word16 target_bits, /* i/o : coder memory state */
- Word16 Q_new,
- Word16 shift,
- Word16 *pitch_buf, /* output : pitch values for each subfr.*/
- Word16 *voice_factors, /* output : voicing factors */
- Word16 *bwe_exc /* output : excitation for SWB TBE */
+ Encoder_State_fx* st,
+ PLC_ENC_EVS_HANDLE hPlc_Ext,
+ const Word16 target_bits, /* i/o: coder memory state */
+ const Word16 Q_new,
+ const Word16 shift,
+ Word16* pitch_buf, /* o : pitch values for each subfr.*/
+ Word16* voice_factors, /* o : voicing factors */
+ Word16* bwe_exc /* o : excitation for SWB TBE */
);
void decoder_acelp(
Decoder_State_fx *st,
- Word16 coder_type, /* input: coder type */
- Word16 prm[], /* input: parameters */
- Word16 A[], /* input: coefficients NxAz[M+1] */
- ACELP_config acelp_cfg, /* input: ACELP config */
+ Word16 prm[], /* i : parameters */
+ Word16 A[], /* i : coefficients NxAz[M+1] */
+ ACELP_config acelp_cfg, /* i : ACELP config */
Word16 synth[], /* i/o: synth[-2*LFAC..L_DIV] Q0 */
Word16 *pT, /* out: pitch for all subframe Q0 */
Word16 *pgainT, /* out: pitch gain for all subfr 1Q14 */
- Word16 stab_fac, /* input: stability of isf */
+ Word16 stab_fac, /* i : stability of isf */
Word16 *pitch_buffer, /* out: pitch values for each subfr.*/
Word16 *voice_factors, /* out: voicing factors */
const Word16 LSF_Q_prediction,/* i : LSF prediction mode */
@@ -8911,26 +8864,31 @@ void dec_prm_core(
Decoder_State_fx *st
);
-void analy_sp( /* o: fft0 bin energy Q0 */
- Word16 *speech, /* i: speech buffer Q_new - preemph_bits */
- const Word16 Q_new, /* i: current scaling exp Q0 */
- Word32 *fr_bands, /* o: energy in critical frequency bands Q_new + QSCALE */
- Word32 *lf_E, /* o: per bin E for first... Q_new + QSCALE - 2*/
- Word16 *Etot, /* o: total input energy Q8 */
- const Word16 min_band, /* i: minimum critical band Q0 */
- const Word16 max_band, /* i: maximum critical band Q0 */
- const Word32 e_min_scaled, /* i: minimum energy scaled Q_new + QSCALE */
- Word16 Scale_fac[2], /* o: FFT scales factors (2 values by frame) Q0 */
- Word32 *Bin_E, /* o : per bin log energy spectrum */
- Word32 *Bin_E_old, /* o : per bin log energy spectrum for mid-frame */
- Word32 *PS, /* o : Per bin energy spectrum */
- Word16 *EspecdB, /* o : log E spectrum (with f=0) of the current frame Q7 */
- Word32 *band_energies, /* o : energy in critical frequency bands without minimum noise floor MODE2_E_MIN */
- Word16 *fft_buff /* o : FFT coefficients */
+void analy_sp(
+ const Word16 element_mode, /* i : element mode */
+#ifdef IVAS_CODE_CPE
+ CPE_ENC_HANDLE hCPE, /* i/o: CPE encoder structure */
+#endif
+ const Word32 input_Fs, /* i : i sampling rate */
+ Word16* speech, /* i : speech buffer Q_new - preemph_bits */
+ const Word16 Q_new, /* i : current scaling exp Q0 */
+ Word32* fr_bands, /* o : energy in critical frequency bands Q_new + QSCALE */
+ Word32* lf_E, /* o : per bin E for first... Q_new + QSCALE - 2*/
+ Word16* Etot, /* o : total i energy Q8 */
+ const Word16 min_band, /* i : minimum critical band Q0 */
+ const Word16 max_band, /* i : maximum critical band Q0 */
+ const Word32 e_min_scaled, /* i : minimum energy scaled Q_new + QSCALE */
+ Word16 Scale_fac[2], /* o : FFT scales factors (2 values by frame) Q0 */
+ Word32* Bin_E, /* o : per-bin energy spectrum */
+ Word32* Bin_E_old, /* o : per-bin energy spectrum of the previous frame */
+ Word32* PS, /* o : per-bin energy spectrum */
+ Word16* EspecdB, /* o : per-bin log energy spectrum (with f=0) Q7 */
+ Word32* band_energies, /* o : energy in critical frequency bands without minimum noise floor MODE2_E_MIN */
+ Word16* fft_buff /* o : FFT coefficients */
);
void E_UTIL_copy_scale_sig(
- const Word16 x[], /* i : signal to scale input Qx */
+ const Word16 x[], /* i : signal to scale i Qx */
Word16 y[], /* o : scaled signal output Qx */
const Word16 lg, /* i : size of x[] Q0 */
const Word16 exp0 /* i : exponent: x = round(x << exp) Qx xx exp */
@@ -9003,14 +8961,14 @@ void gaus_L2_dec(
);
void tcx_ltp_get_lpc(
- Word16 *x,
- Word16 L,
- Word16 *A,
- Word16 order
+ Word16* x,
+ const Word16 L,
+ Word16* A,
+ const Word16 order
);
void predict_signal(
- const Word16 excI[], /* i : input excitation buffer */
+ const Word16 excI[], /* i : i excitation buffer */
Word16 excO[], /* o : output excitation buffer */
const Word16 T0, /* i : integer pitch lag */
Word16 frac, /* i : fraction of lag */
@@ -9063,30 +9021,15 @@ void tcx_ltp_encode( Word8 tcxltp_on,
Word16 lpcorder
);
-void tcx_ltp_post( Word8 tcxltp_on,
- Word16 core,
- Word16 L_frame,
- Word16 L_frame_core,
- Word16 delay,
- Word16 *sig,
- Word16 *tcx_buf,
- Word16 tcx_buf_len,
- Word16 bfi,
- Word16 pitch_int,
- Word16 pitch_fr,
- Word16 gain,
- Word16 *pitch_int_past,
- Word16 *pitch_fr_past,
- Word16 *gain_past,
- Word16 *filtIdx_past,
- Word16 pitres,
- Word16 *pitres_past,
- Word16 damping,
- Word16 SideInfoOnly,
- Word16 *mem_in,
- Word16 *mem_out,
- Word32 bitrate
- );
+void tcx_ltp_post(
+ Decoder_State_fx* st,
+ TCX_LTP_DEC_HANDLE hTcxLtpDec,
+ Word16 core,
+ Word16 output_frame,
+ Word16 delay,
+ Word16* sig,
+ Word16* tcx_buf
+);
Word16 tcx_ltp_decode_params( Word16 *ltp_param,
Word16 *pitch_int,
@@ -9124,6 +9067,10 @@ void msvq_dec
const Word16 N, /* i : Vector dimension */
const Word16 maxN, /* i : Codebook dimension */
const Word16 Idx[], /* i : Indices */
+#ifdef IVAS_MSVQ
+ const int16_t applyIDCT_flag, /* i : applyIDCT flag */
+ const float* invTrfMatrix, /* i : matrix for IDCT synthesis */
+#endif
Word16 *uq /* o : quantized vector (3Q12) */
);
@@ -9228,16 +9175,16 @@ void lsf_update_memory(
/* Returns: number of indices */
Word16 Q_lsf_tcxlpc(
- /* const */ Word16 xsf[], /* (I) original xSF */
- Word16 xsf_q[], /* (O) quantized xSF */
- Word16 xsf_q_ind[], /* (O) quantized xSF (w/o MA prediction) */
- Word16 indices[], /* (O) VQ indices */
- Word16 lpcorder, /* (I) LPC order */
- Word16 narrowband, /* (I) narrowband flag */
- Word16 cdk, /* (I) codebook selector */
- Word16 mem_MA[], /* (I) MA memory */
- Word16 coder_type,
- Word32 * Bin_Ener,
+ /* const */ Word16 lsf[], /* i : original lsf */
+ Word16 lsf_q[], /* o : quantized lsf */
+ Word16 lsp_q_ind[], /* o : quantized lsp (w/o MA prediction) */
+ Word16 indices[], /* o : VQ indices */
+ const Word16 lpcorder, /* i : LPC order */
+ const Word16 narrowband, /* i : narrowband flag */
+ const Word16 cdk, /* i : codebook selector */
+ const Word16 mem_MA[], /* i : MA memory */
+ const Word16 coder_type,
+ const Word32* Bin_Ener,
const Word16 Q_ener
);
@@ -9253,8 +9200,8 @@ Word16 D_lsf_tcxlpc(
/* Returns: number of bits written */
Word16 enc_lsf_tcxlpc(
- Word16 **indices, /* (I) Ptr to VQ indices */
- Encoder_State_fx *st /* (I/O) Encoder state */
+ Word16** indices, /* i : Ptr to VQ indices */
+ BSTR_ENC_HANDLE hBstr /* i/o: encoder bitstream handle */
);
/* Returns: number of bits read */
@@ -9293,67 +9240,60 @@ void lsf_msvq_ma_dec( Word16 *lsfq,
Word16 acelp_mode
);
-Word16 lsf_msvq_ma_encprm( Encoder_State_fx * st,
- Word16 *param_lpc,
- Word16 core,
- Word16 acelp_mode,
- Word16 acelp_midLpc,
- Word16 * bits_param_lpc,
- Word16 no_indices
- );
-Word16 lsf_msvq_ma_decprm( Decoder_State_fx *st, Word16 *param_lpc, Word16 core, Word16 acelp_mode, Word16 acelp_midLpc
- ,Word16 narrowBand
- ,Word32 sr_core
- );
-
-Word16 lsf_bctcvq_encprm(
- Encoder_State_fx *st,
+Word16 lsf_msvq_ma_encprm(
+ BSTR_ENC_HANDLE hBstr,
Word16 *param_lpc,
+ Word16 core,
+ Word16 acelp_mode,
+ Word16 acelp_midLpc,
Word16 * bits_param_lpc,
Word16 no_indices
);
+Word16 lsf_msvq_ma_decprm( Decoder_State_fx *st, Word16 *param_lpc);
+
+Word16 lsf_bctcvq_encprm(
+ BSTR_ENC_HANDLE hBstr,
+ Word16* param_lpc,
+ Word16* bits_param_lpc,
+ Word16 no_indices
+);
Word16 lsf_bctcvq_decprm(
Decoder_State_fx * st,
Word16 *param_lpc
);
void lpc_unquantize(
- Decoder_State_fx * st,
- Word16 *lsfold,
- Word16 *lspold,
- Word16 *lsf,
- Word16 *lsp,
+ Decoder_State_fx* st,
+ Word16* lsf,
+ Word16* lsp,
const Word16 m,
- const Word16 lpcQuantization,
- Word16 *param_lpc,
- const Word16 numlpc,
- const Word16 core,
- Word16 *mem_MA,
- Word16 *mem_AR,
- Word16 *lspmid,
- Word16 *lsfmid,
+ Word16* param_lpc,
+ Word16* lspmid,
+ Word16* lsfmid,
Word16 coder_type,
- Word16 acelp_midLpc,
- Word8 narrow_band,
- Word16 *seed_acelp,
- Word32 sr_core,
- Word16 *mid_lsf_int,
- Word16 prev_bfi,
- Word16 *LSF_Q_prediction, /* o : LSF prediction mode */
- Word16 *safety_net
-);
-
-void midlsf_enc(const Word16 qlsf0[], /* i: quantized lsf coefficients (3Q12) */
- const Word16 qlsf1[], /* i: quantized lsf coefficients (3Q12) */
- const Word16 lsf[], /* i: lsf coefficients (3Q12) */
- Word16 *idx, /* o: codebook index */
- const Word16 lpcorder /* i: order of the lpc */
- , Word32 * Bin_Ener_128_fx
- ,const Word16 Q_ener
- ,Word8 narrowBand
- ,Word32 sr_core
- ,Word16 coder_type
- );
+ Word16* LSF_Q_prediction /* o : LSF prediction mode */
+);
+Word16 set_ACELP_flag(
+ const Word16 element_mode, /* i : element mode */
+ const Word32 element_brate, /* i : element bitrate */
+ const Word32 total_brate, /* i : total bitrate per channel */
+ const Word16 idchan, /* i : Channel id */
+ const Word16 tdm_LRTD_flag, /* i : LRTD stereo mode flag */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 cng_type /* i : CNG type */
+);
+void midlsf_enc(
+ const Word16 qlsf0[], /* i: quantized lsf coefficients (3Q12) */
+ const Word16 qlsf1[], /* i: quantized lsf coefficients (3Q12) */
+ const Word16 lsf[], /* i: lsf coefficients (3Q12) */
+ Word16* idx, /* o: codebook index */
+ const Word16 lpcorder, /* i: order of the lpc */
+ const Word32* Bin_Ener_128_fx,
+ const Word16 Q_ener,
+ const Word8 narrowBand,
+ const Word32 sr_core,
+ const Word16 coder_type
+);
void midlsf_dec(
@@ -9377,17 +9317,40 @@ Word16 const * PlcGetLsfBase (Word16 const lpcQuantization,
#define TCX_IMDCT_SCALE 15
#define TCX_IMDCT_HEADROOM 1
-void TCX_MDCT(const Word16 *x, Word32 *y, Word16 *y_e, Word16 l, Word16 m, Word16 r);
-
-void TCX_MDST(const Word16 *x, Word32 *y, Word16 *y_e, Word16 l, Word16 m, Word16 r);
+void TCX_MDCT(
+ const Word16* x,
+ Word32* y,
+ Word16* y_e,
+ const Word16 l,
+ const Word16 m,
+ const Word16 r,
+ const Word16 element_mode
+);
+
+void TCX_MDST(
+ const Word16* x,
+ Word32* y,
+ Word16* y_e,
+ const Word16 l,
+ const Word16 m,
+ const Word16 r,
+ const Word16 element_mode
+);
-void TCX_MDCT_Inverse(Word32 *x, Word16 x_e, Word16 *y, Word16 l, Word16 m, Word16 r);
+void TCX_MDCT_Inverse(
+ Word32* x,
+ Word16 x_e,
+ Word16* y,
+ const Word16 l,
+ const Word16 m,
+ const Word16 r,
+ const Word16 element_mode
+);
/* post_dec.h */
void post_decoder(
Decoder_State_fx *st,
- Word16 coder_type,
Word16 synth_buf[],
Word16 pit_gain[],
Word16 pitch[],
@@ -9396,15 +9359,15 @@ void post_decoder(
);
Word16 bass_pf_enc(
- Word16 *orig, /* (i) : 12.8kHz original signal Q0 */
- Word16 *syn, /* (i) : 12.8kHz synthesis to postfilter Q0 */
- Word16 *T_sf, /* (i) : Pitch period for all subframes (T_sf[16]) Q0 */
- Word16 *gainT_sf, /* (i) : Pitch gain for all subframes (gainT_sf[16]) Q14 */
- Word16 l_frame, /* (i) : frame length (should be multiple of l_subfr) Q0 */
- Word16 l_subfr, /* (i) : sub-frame length (60/64) Q0 */
- Word16 *gain_factor_param, /* (o) : quantized gain factor Q0 */
- Word16 mode, /* (i) : coding mode of adapt bpf */
- struct MEM_BPF *mem_bpf /* i/o : memory state */
+ const Word16* orig, /* i : 12.8kHz original signal Q0 */
+ const Word16* syn, /* i : 12.8kHz synthesis to postfilter Q0 */
+ const Word16* T_sf, /* i : Pitch period for all subframes (T_sf[16]) Q0 */
+ const Word16* gainT_sf, /* i : Pitch gain for all subframes (gainT_sf[16]) Q14 */
+ const Word16 l_frame, /* i : frame length (should be multiple of l_subfr) Q0 */
+ const Word16 l_subfr, /* i : sub-frame length (60/64) Q0 */
+ Word16* gain_factor_param, /* o : quantized gain factor Q0 */
+ const Word16 mode, /* i : coding mode of adapt bpf */
+ struct MEM_BPF* mem_bpf /* i/o: memory state */
);
void cldfb_synth_set_bandsToZero(
Decoder_State_fx *st,
@@ -9415,7 +9378,7 @@ void cldfb_synth_set_bandsToZero(
);
/* fd_cng_common.h */
/* Create an instance of type FD_CNG */
-void createFdCngCom(HANDLE_FD_CNG_COM* hFdCngCom);
+ivas_error createFdCngCom(HANDLE_FD_CNG_COM* hFdCngCom);
void initFdCngCom(HANDLE_FD_CNG_COM hFdCngCom, Word16 scale);
@@ -9425,31 +9388,35 @@ void deleteFdCngCom(HANDLE_FD_CNG_COM * hFdCngCom);
void resetFdCngEnc( Encoder_State_fx * st);
/* Initialize the spectral partitioning */
-void initPartitions( const Word16* part_in,
- Word16 npart_in,
- Word16 startBand,
- Word16 stopBand,
- Word16* part_out,
- Word16* npart_out,
- Word16* midband,
- Word16* psize,
- Word16* psize_norm,
- Word16* psize_norm_exp,
- Word16* psize_inv,
- Word16 stopBandFR);
+void initPartitions(
+ const Word16* part_in,
+ const Word16 npart_in,
+ const Word16 startBand,
+ const Word16 stopBand,
+ Word16* part_out,
+ Word16* npart_out,
+ Word16* midband,
+ Word16* psize,
+ Word16* psize_norm,
+ Word16* psize_norm_exp,
+ Word16* psize_inv,
+ const Word16 stopBandFR
+);
/* Noise estimation using Minimum Statistics (MS) */
-void compress_range(Word32 *in,
- Word16 in_exp,
- Word16 *out,
- Word16 len
- );
+void compress_range(
+ Word32* in,
+ Word16 in_exp,
+ Word16* out,
+ const Word16 len
+);
-void expand_range(Word16 *in,
- Word32 *out,
- Word16 *out_exp,
- Word16 len
- );
+void expand_range(
+ Word16* in,
+ Word32* out,
+ Word16* out_exp,
+ const Word16 len
+);
void minimum_statistics(Word16 len, /* i : Total number of partitions (CLDFB or FFT) */
Word16 lenFFT, /* i : Number of FFT partitions */
@@ -9479,17 +9446,19 @@ void generate_comfort_noise_enc (Encoder_State_fx *stcod,
Word16 Q_new,
Word16 gen_exc
);
-void generate_comfort_noise_dec (Word32 **bufferReal, /* o : matrix to real part of input bands */
- Word32 **bufferImag, /* o : matrix to imaginary part of input bands */
- Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of input bands */
- Decoder_State_fx *stdec,
- Word16 *Q_new,
- Word16 gen_exc
- );
+void generate_comfort_noise_dec (
+ Word32 **bufferReal, /* o : matrix to real part of i bands */
+ Word32 **bufferImag, /* o : matrix to imaginary part of i bands */
+ Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of i bands */
+ Decoder_State_fx *stdec,
+ Word16 *Q_new,
+ Word16 gen_exc
+ , const Word16 nchan_out /* i : number of output channels */
+);
void
-generate_comfort_noise_dec_hf (Word32 **bufferReal, /* o : matrix to real part of input bands */
- Word32 **bufferImag, /* o : matrix to imaginary part of input bands */
- Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of input bands */
+generate_comfort_noise_dec_hf (Word32 **bufferReal, /* o : matrix to real part of i bands */
+ Word32 **bufferImag, /* o : matrix to imaginary part of i bands */
+ Word16 *bufferScale, /* o : pointer to scalefactor for real and imaginary part of i bands */
Decoder_State_fx *stdec
);
@@ -9512,122 +9481,140 @@ void generate_masking_noise_mdct (Word32 *mdctBuffer, /* i/o: time-domain
);
/* Apply bitrate-dependant scale */
-void apply_scale(Word32 *scale,
- Word16 bwmode,
- Word32 bitrate
- );
+void apply_scale(
+ Word32* scale, /* o : scalefactor */
+ const Word16 bwmode, /* i : audio bandwidth */
+ const Word32 bitrate, /* i : Bit rate */
+ const SCALE_SETUP* scaleTable, /* i : Scale table */
+ const Word16 scaleTableSize /* i : Size of scale table */
+);
/* Compute the power for each partition */
-void bandcombinepow(Word32* bandpow, /* i : Power for each band */
- Word16 exp_bandpow, /* i : exponent of bandpow */
- Word16 nband, /* i : Number of bands */
- Word16* part, /* i : Partition upper boundaries (band indices starting from 0) */
- Word16 npart, /* i : Number of partitions */
- Word16* psize_inv, /* i : Inverse partition sizes */
- Word32* partpow, /* o : Power for each partition */
- Word16* exp_partpow
- );
+void bandcombinepow(
+ const Word32* bandpow, /* i : Power for each band */
+ const Word16 exp_bandpow, /* i : exponent of bandpow */
+ const Word16 nband, /* i : Number of bands */
+ Word16* part, /* i : Partition upper boundaries (band indices starting from 0) */
+ const Word16 npart, /* i : Number of partitions */
+ const Word16* psize_inv, /* i : Inverse partition sizes */
+ Word32* partpow, /* o : Power for each partition */
+ Word16* exp_partpow
+);
/* Scale partitions (with smoothing) */
-void scalebands (Word32 *partpow, /* i : Power for each partition */
- Word16 *part, /* i : Partition upper boundaries (band indices starting from 0) */
- Word16 npart, /* i : Number of partitions */
- Word16 *midband, /* i : Central band of each partition */
- Word16 nFFTpart, /* i : Number of FFT partitions */
- Word16 nband, /* i : Number of bands */
- Word32 *bandpow, /* o : Power for each band */
- Word16 flag_fft_en
- );
+void scalebands(
+ const Word32* partpow, /* i : Power for each partition */
+ Word16* part, /* i : Partition upper boundaries (band indices starting from 0) */
+ const Word16 npart, /* i : Number of partitions */
+ Word16* midband, /* i : Central band of each partition */
+ const Word16 nFFTpart, /* i : Number of FFT partitions */
+ const Word16 nband, /* i : Number of bands */
+ Word32* bandpow, /* o : Power for each band */
+ const Word16 flag_fft_en
+);
-/* Get central band for each partition */
-void getmidbands(Word16* part, /* i : Partition upper boundaries (band indices starting from 0) */
- Word16 npart, /* i : Number of partitions */
- Word16* midband, /* o : Central band of each partition */
- Word16* psize, /* o : Partition sizes */
- Word16* psize_norm, /* o : Partition sizes, fractional values */
- Word16* psize_norm_exp, /* o : Exponent for fractional partition sizes */
- Word16* psize_inv /* o : Inverse of partition sizes */
- );
/* STFT analysis filterbank */
-void AnalysisSTFT (const Word16 *timeDomainInput, /* i : pointer to time signal */
- Word16 Q,
- Word32 *fftBuffer, /* o : FFT bins */
- Word16 *fftBuffer_exp, /* i : exponent of FFT bins */
- HANDLE_FD_CNG_COM st /* i/o: FD_CNG structure containing all buffers and variables */
- );
+void AnalysisSTFT(
+ const Word16* timeDomainInput, /* i : pointer to time signal */
+ Word16 Q,
+ Word32* fftBuffer, /* o : FFT bins */
+ Word16* fftBuffer_exp, /* i : exponent of FFT bins */
+ HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */
+);
/* STFT synthesis filterbank */
-void SynthesisSTFT (Word32 *fftBuffer, /* i : pointer to FFT bins */
- Word16 fftBufferExp, /* i : exponent of FFT bins */
- Word16 *timeDomainOutput, /* o : pointer to time domain signal */
- Word16 *olapBuffer, /* i/o : pointer to overlap buffer */
- const PWord16 *olapWin, /* i : pointer to overlap window */
- Word16 tcx_transition,
- HANDLE_FD_CNG_COM st, /* i/o : pointer to FD_CNG structure containing all buffers and variables */
- Word16 gen_exc,
- Word16 *Q_new
- );
+void SynthesisSTFT(
+ Word32* fftBuffer, /* i : pointer to FFT bins */
+ Word16 fftBufferExp, /* i : exponent of FFT bins */
+ Word16* timeDomainOutput, /* o : pointer to time domain signal */
+ Word16* olapBuffer, /* i/o : pointer to overlap buffer */
+ const PWord16* olapWin, /* i : pointer to overlap window */
+ Word16 tcx_transition,
+ HANDLE_FD_CNG_COM hFdCngCom, /* i/o : pointer to FD_CNG structure containing all buffers and variables */
+ Word16 gen_exc,
+ Word16* Q_new,
+ const Word16 element_mode, /* i : element mode */
+ const Word16 nchan_out /* i : number of output channels */
+);
/* Compute some calues used in the bias correction of the minimum statistics algorithm */
-void mhvals(Word16 d, Word16 * m/*, float * h*/);
+void mhvals(
+ const Word16 d,
+ Word16* m /*, float * h*/
+);
/* Random generator with Gaussian distribution with mean 0 and std 1 */
Word32 rand_gauss (Word16 *seed);
-void lpc_from_spectrum (Word32 *powspec,
- Word16 powspec_exp,
- Word16 start,
- Word16 stop,
- Word16 fftlen,
- Word16 *A,
- Word16 lpcorder,
- Word16 preemph_fac);
-
-void msvq_decoder(const Word16 *const cb[], /* i : Codebook (indexed cb[*stages][levels][p]) */
- Word16 stages, /* i : Number of stages */
- Word16 N, /* i : Vector dimension */
- Word16 maxN, /* i : Codebook vector dimension */
- Word16 Idx[], /* i : Indices */
- Word16 *uq /* o : quantized vector */
- );
+void lpc_from_spectrum(
+ HANDLE_FD_CNG_COM hFdCngCom,
+ const Word16 start, /*i : start band*/
+ const Word16 stop, /*i : stop band*/
+ const Word16 preemph_fac /*i : preemphase factor format Q1.15*/
+);
+
+void msvq_decoder(
+ const Word16* const cb[], /* i : Codebook (indexed cb[*stages][levels][p]) */
+ const Word16 stages, /* i : Number of stages */
+ const Word16 N, /* i : Vector dimension */
+ const Word16 maxN, /* i : Codebook vector dimension */
+ const Word16 Idx[], /* i : Indices */
+ Word16* uq /* o : quantized vector */
+);
/*fd_cng_dec.h*/
/* Create an instance of type FD_CNG */
-void createFdCngDec(HANDLE_FD_CNG_DEC* hFdCngDec);
-
-Word16 initFdCngDec(HANDLE_FD_CNG_DEC hFdCngDec, Word16 scale);
+ivas_error createFdCngDec(HANDLE_FD_CNG_DEC* hFdCngDec);
+void initFdCngDec(
+ DEC_CORE_HANDLE st, /* i/o: decoder state structure */
+ Word16 scale
+);
extern void E_LPC_isf_isp_conversion(const Word16 isf[], Word16 isp[], const Word16 m);
extern void E_LPC_f_isp_a_conversion(const Word16 *isp, Word16 *a, const Word16 m);
/* Delete the instance of type FD_CNG */
-void deleteFdCngDec(HANDLE_FD_CNG_DEC * hFdCngDec);
-
+void deleteFdCngDec(HANDLE_FD_CNG_DEC* hFdCngDec);
/* Configure CLDFB-CNG */
-void configureFdCngDec(HANDLE_FD_CNG_DEC hs, /* i/o: Contains the variables related to the CLDFB-based CNG process */
- Word16 bandwidth,
- Word32 bitrate,
- Word16 cng_type);
-
-
+void configureFdCngDec(
+ HANDLE_FD_CNG_DEC hFdCngDec, /* i/o: Contains the variables related to the CLDFB-based CNG process */
+ Word16 bandwidth,
+ Word32 bitrate,
+ Word16 L_frame,
+ const Word16 Last_L_frame,
+ const Word16 element_mode
+);
/* Apply the CLDFB-based CNG */
-Word16 ApplyFdCng (Word16 * timeDomainInput, /* i : pointer to time domain input */
- Word16 Q,
- Word32 ** cldfbBufferReal, /* i/o: real part of the CLDFB buffer */
- Word32 ** cldfbBufferImag, /* i/o: imaginary part of the CLDFB buffer */
- Word16 * cldfbBufferScale, /* o : pointer to the scalefactor for real and imaginary part of the CLDFB buffer */
- HANDLE_FD_CNG_DEC st, /* i/o: pointer to FD_CNG structure containing all buffers and variables */
- Word16 m_frame_type, /* i : type of frame at the decoder side */
- Decoder_State_fx *stdec,
- const Word16 concealWholeFrame, /* i : binary flag indicating frame loss */
- Word16 is_music
- );
-
+Word16 ApplyFdCng(
+ Word16* timeDomainInput, /* i : pointer to time domain i */
+ Word16 Q,
+#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
+ Word16* powerSpectrum,
+#endif
+ Word32** cldfbBufferReal, /* i/o: real part of the CLDFB buffer */
+ Word32** cldfbBufferImag, /* i/o: imaginary part of the CLDFB buffer */
+ Word16* cldfbBufferScale, /* o : pointer to the scalefactor for real and imaginary part of the CLDFB buffer */
+ Decoder_State_fx* st,
+ const Word16 concealWholeFrame, /* i : binary flag indicating frame loss */
+ Word16 is_music
+);
/* Perform noise estimation */
-void perform_noise_estimation_dec(const Word16 *timeDomainInput, /* i: pointer to time domain input */
- Word16 Q,
- HANDLE_FD_CNG_DEC st /* i/o: FD_CNG structure containing all buffers and variables */
- );
+void perform_noise_estimation_dec(
+ const Word16* timeDomainInput, /* i: pointer to time domain i */
+ const Word16 Q,
+#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
+ float* power_spectrum,
+#endif
+ HANDLE_FD_CNG_DEC hFdCngDec /* i/o: FD_CNG structure containing all buffers and variables */
+#ifdef IVAS_CODE_CNG
+ , const Word16 element_mode, /* i : element mode */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 L_frame, /* i : frame length at internal Fs */
+ const Word16 last_L_frame, /* i : frame length of the last frame at internal Fs */
+ const Word32 last_core_brate, /* i : previous frame core bitrate */
+ const Word16 VAD /* i : VAD flag in the decoder */
+#endif
+);
/* Decode the CLDFB-CNG bitstream */
void FdCng_decodeSID(HANDLE_FD_CNG_COM st, /* i/o: FD_CNG structure containing all buffers and variables */
@@ -9647,22 +9634,12 @@ void FdCng_exc(
Word16 *exc2, /* o: LP excitation */
Word16 *bwe_exc /* o: LP excitation for BWE */
);
-
void noisy_speech_detection(
- const Word16 vad,
- const Word16 *ftimeInPtr, /* i : input time-domain frame */
- const Word16 frameSize, /* i : frame size */
- const Word16 Q,
- const Word32 *msNoiseEst, /* i : noise estimate over all critical bands */
- const Word16 msNoiseEst_exp, /* i : exponent for noise estimate over all critical bands */
- const Word16 *psize_norm,
- const Word16 psize_norm_exp,
- const Word16 nFFTpart, /* i : Number of partitions taken into account */
- Word32 *lp_noise, /* i/o: pointer to long term total Noise energy average */
- Word32 *lp_speech, /* i/o: pointer to long term active speech energy average */
- Word16 *flag_noisy_speech
+ HANDLE_FD_CNG_DEC hFdCngDec,/* i/o: FD_CNG structure */
+ const Word16 vad, /* i : VAD flag */
+ const Word16* syn, /* i : i time-domain frame */
+ const Word16 Q
);
-
/* Create an instance of type FD_CNG */
void createFdCngEnc(HANDLE_FD_CNG_ENC* hFdCngEnc);
@@ -9714,7 +9691,14 @@ void FdCng_encodeSID (HANDLE_FD_CNG_ENC st, /* i/o: FD_CNG structure contain
* @param pnSize Set to the number of elements written to the stream.
* @param pnBits Set to the number of required bits.
*/
-void GetParameters(ParamsBitMap const * paramsBitMap, Word16 nParams, void const * pParameter, Word16 ** pStream, Word16 * pnSize, Word16 * pnBits);
+void GetParameters(
+ ParamsBitMap const* paramsBitMap,
+ const Word16 nArrayLength,
+ void const* pParameter,
+ Word16** pStream,
+ Word16* pnSize,
+ Word16* pnBits
+);
/** Reads parameters from a stream into paramsBitMap.
* @param paramsBitMap Definition of parameters and mappings to a bitstream.
@@ -9723,7 +9707,13 @@ void GetParameters(ParamsBitMap const * paramsBitMap, Word16 nParams, void const
* @param pStream Pointer to a stream from which parameters are read.
* @param pnSize Set to the number of elements read from the stream.
*/
-void SetParameters(ParamsBitMap const * paramsBitMap, Word16 nParams, void * pParameter, Word16 const ** pStream, Word16 * pnSize);
+void SetParameters(
+ ParamsBitMap const* paramsBitMap,
+ const Word16 nArrayLength,
+ void* pParameter,
+ const Word16** pStream,
+ Word16* pnSize
+);
/** Writes parameters from a stream into a bitstream.
* @param paramsBitMap Definition of parameters and mappings to a bitstream.
@@ -9733,7 +9723,14 @@ void SetParameters(ParamsBitMap const * paramsBitMap, Word16 nParams, void * pPa
* @param st Encoder state.
* @param pnBits Set to the number of bits written.
*/
-void WriteToBitstream(ParamsBitMap const * paramsBitMap, Word16 nParams, Word16 const ** pStream, Word16 * pnSize, Encoder_State_fx *st, Word16 * pnBits);
+void WriteToBitstream(
+ ParamsBitMap const* paramsBitMap,
+ const Word16 nArrayLength,
+ const Word16** pStream,
+ Word16* pnSize,
+ BSTR_ENC_HANDLE hBstr,
+ Word16* pnBits
+);
/** Reads parameters from a bitstream into a stream.
* @param paramsBitMap Definition of parameters and mappings to a bitstream.
@@ -9742,7 +9739,13 @@ void WriteToBitstream(ParamsBitMap const * paramsBitMap, Word16 nParams, Word16
* @param pStream Pointer to a stream where parameters should be stored.
* @param pnSize Set to the number of elements written to the stream.
*/
-void ReadFromBitstream(ParamsBitMap const * paramsBitMap, Word16 nArrayLength, Decoder_State_fx *st, Word16 ** pStream, Word16 * pnSize);
+void ReadFromBitstream(
+ ParamsBitMap const* paramsBitMap,
+ const Word16 nArrayLength,
+ Decoder_State_fx* st,
+ Word16** pStream,
+ Word16* pnSize
+);
void const * GetTnsFilterOrder(void const * p, Word16 index, Word16 * pValue);
void * SetTnsFilterOrder(void * p, Word16 index, Word16 value);
@@ -9793,17 +9796,20 @@ void ClearTnsFilterCoefficients(STnsFilter * pTnsFilter);
/** Init TNS configuration.
* Fills STnsConfig structure with sensible content.
- * @param nSampleRate Sampling rate of the input.
+ * @param nSampleRate Sampling rate of the i .
* @param nFrameLength Frame length.
* @param pTnsConfig TNS configuration to be initialized.
* @return 0 on success, otherwise 1.
*/
-Word16 InitTnsConfiguration(Word32 nSampleRate,
- Word16 frameLength,
- STnsConfig * pTnsConfig
- ,Word16 igfStopFreq
- ,Word32 bitrate
- );
+void InitTnsConfiguration(
+ const Word16 bwidth,
+ const Word16 frameLength,
+ STnsConfig* pTnsConfig,
+ const Word16 igfStopFreq,
+ const Word32 total_brate,
+ const Word16 element_mode,
+ const Word16 is_mct
+);
/** Detect TNS parameters.
* Detects if TNS should be used and fills TNS data in pTnsData.
@@ -9822,7 +9828,7 @@ Word16 DetectTnsFilt(STnsConfig const * pTnsConfig,
/** Modify spectrum using TNS filter.
* Modifies spectrum unsing TNS filter defined by pTnsData.
* If fIsAnalyses is true considers spectrum to be
- * an input of encoder and returns residum.
+ * an i of encoder and returns residum.
* If fIsAnalyses is false considers spectrum to be
* a residum from decoder and returns output spectrum.
* @param pTnsConfig TNS configuration.
@@ -9832,10 +9838,12 @@ Word16 DetectTnsFilt(STnsConfig const * pTnsConfig,
* in encoder (TRUE) or in decoder (FALSE).
* @return 0 on success, otherwise 1.
*/
-Word16 ApplyTnsFilter(STnsConfig const * pTnsConfig,
- STnsData const * pTnsData,
- Word32 spectrum[],
- Word8 fIsAnalysis);
+void ApplyTnsFilter(
+ STnsConfig const * pTnsConfig,
+ STnsData const * pTnsData,
+ Word32 spectrum[],
+ const Word8 fIsAnalysis
+);
Word16 ITF_Detect_fx(Word32 const pSpectrum[],
Word16 startLine,
@@ -9847,7 +9855,7 @@ Word16 ITF_Detect_fx(Word32 const pSpectrum[],
Word16* curr_order,
Word16 Q);
-TNS_ERROR ITF_Apply_fx(Word32 spectrum[],
+void ITF_Apply_fx(Word32 spectrum[],
Word16 startLine, Word16 stopLine, const Word16* A,
Word16 Q_A,
Word16 curr_order);
@@ -9904,7 +9912,12 @@ Word16 WriteTnsData(STnsConfig const * pTnsConfig,
* @param pnSize Set to the number of used elements from stream.
* @return 0 on success, otherwise 1.
*/
-Word16 ReadTnsData(STnsConfig const * pTnsConfig,
+#ifdef IVAS_CODE
+void
+#else
+Word16
+#endif
+ReadTnsData(STnsConfig const * pTnsConfig,
Decoder_State_fx *st,
Word16 * pnBits,
Word16 * stream,
@@ -9978,7 +9991,7 @@ void configureCldfb ( HANDLE_CLDFB_FILTER_BANK h_cldfb, /*!< CLDFB Handle
const Word16 frameSize /*!< FrameSize */
);
-void openCldfb ( HANDLE_CLDFB_FILTER_BANK *h_cldfb, /*!< CLDFB Handle */
+ivas_error openCldfb ( HANDLE_CLDFB_FILTER_BANK *h_cldfb, /*!< CLDFB Handle */
const Word16 type, /*!< analysis or synthesis */
const Word16 maxCldfbBands, /*!< number of cldfb bands */
const Word16 frameSize /*!< FrameSize */
@@ -10061,8 +10074,8 @@ GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q31 | pointer to the resul
Word32 *energyHF, /*!< o: Q31 | pointer to HF energy */
Word16 *energyHF_Exp, /*!< o: pointer to exponent of HF energy */
Word32 *energyValuesSum, /*!< o: Q31 | pointer to sum array of energy values, not initialized*/
- Word16 *energyValuesSum_Exp /*!< o: pointer to exponents of energyValuesSum, not initialized */
- , HANDLE_TEC_ENC_FX hTecEnc
+ Word16 *energyValuesSum_Exp, /*!< o: pointer to exponents of energyValuesSum, not initialized */
+ TEC_ENC_HANDLE_FX hTECEnc
);
/*bits_alloc.h*/
@@ -10085,29 +10098,6 @@ Word16 BITS_ALLOC_config_acelp(
const Word16 nb_subfr
);
-void BITS_ALLOC_ACELP_config_rf(const Word16 coder_type,
- Word16 *tilt_code,
- Word16 *rf_frame_type,
- Word16 *rf_target_bits,
- Word16 nb_subfr
- , Word16 rf_fec_indicator
- , Word16 *pitch_buf
- );
-void BITS_ALLOC_TCX_config_rf(
- Word16 *rf_frame_type,
- Word16 *rf_target_bits,
- Word16 PLC_Mode,
- Word16 coder_type,
- Word16 last_core,
- Word16 TD_mode
-);
-
-Word16 BITS_ALLOC_adjust_acelp_fixed_cdk(
- const Word16 bits_frame, /*i: bit budget */
- Word16 *fixed_cdk_index, /*o: codebook index */
- const Word16 nb_subfr /*i: number of subframes*/
-);
-
Word16 BITS_ALLOC_adjust_acelp_fixed_16KHZ_cdk(
@@ -10131,11 +10121,11 @@ void InitTransientDetection(Word16 nFrameLength,
/** Runs transient detection.
* Runs all transient detectors defined in pTransientDetection
* and calculates mean zero crossing.
- * @param input New input samples.
- * @param nSamplesAvailable Number of new input samples available.
+ * @param i New i samples.
+ * @param nSamplesAvailable Number of new i samples available.
* @param pTransientDetection Structure that contains transient detectors to be run.
*/
-void RunTransientDetection(Word16 const * input, Word16 nSamplesAvailable, struct TransientDetection * pTransientDetection);
+void RunTransientDetection(Word16 const * i , Word16 nSamplesAvailable, struct TransientDetection * pTransientDetection);
/** Get the average temporal flatness measure using subblock energies aligned with the TCX.
@@ -10169,24 +10159,29 @@ void SetTCXModeInfo(Encoder_State_fx *st,
/* Tonal Concealment */
-TONALMDCTCONCEAL_ERROR TonalMDCTConceal_Init( TonalMDCTConcealPtr self,
- Word16 nSamples,
- Word16 nSamplesCore,
- Word16 nScaleFactors,
- TCX_config * tcx_cfg
- );
+ivas_error TonalMDCTConceal_Init(
+ TonalMDCTConcealPtr self,
+ const Word16 nSamples,
+ const Word16 nSamplesCore,
+ const Word16 nScaleFactors,
+ TCX_CONFIG_HANDLE hTcxCfg /* TCX config */
+);
/* Must be called only when a good frame is recieved - concealment is inactive */
-TONALMDCTCONCEAL_ERROR TonalMDCTConceal_SaveFreqSignal( TonalMDCTConcealPtr self,
- Word32 const *mdctSpectrum,
- Word16 const mdctSpectrum_exp,
- Word16 nNewSamples,
- Word16 nNewSamplesCore,
- Word16 const *scaleFactors,
- Word16 const *scaleFactors_exp,
- Word16 const gain_tcx_exp
- );
+void TonalMDCTConceal_SaveFreqSignal(
+ TonalMDCTConcealPtr self,
+ const Word32* mdctSpectrum,
+ const Word16 mdctSpectrum_exp,
+ Word16 nNewSamples,
+ Word16 nNewSamplesCore,
+ const Word16* scaleFactors,
+ const Word16* scaleFactors_exp,
+ const Word16 gain_tcx_exp
+#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
+ ,const Word16 infoIGFStartLine
+#endif
+);
/* The call to TonalMDCTConceal_UpdateState() should be called after TonalMDCTConceal_Apply. */
TONALMDCTCONCEAL_ERROR TonalMDCTConceal_UpdateState(TonalMDCTConcealPtr self,
@@ -10198,10 +10193,11 @@ TONALMDCTCONCEAL_ERROR TonalMDCTConceal_UpdateState(TonalMDCTConcealPtr self,
/* The call to TonalMDCTConceal_SaveTimeSignal() should be at the
* place where the TD signal corresponds to the FD signal stored with TonalMDCTConceal_SaveFreqSignal. */
-TONALMDCTCONCEAL_ERROR TonalMDCTConceal_SaveTimeSignal( TonalMDCTConcealPtr self,
- Word16 *timeSignal,
- Word16 numSamples
- );
+void TonalMDCTConceal_SaveTimeSignal(
+ TonalMDCTConcealPtr hTonalMDCTConc,
+ Word16 * timeSignal,
+ Word16 nNewSamples
+);
/* Calculates MDST, power spectrum and performs peak detection.
* Uses the TD signal in pastTimeSignal; if pastTimeSignal is NULL, uses the
@@ -10209,50 +10205,68 @@ TONALMDCTCONCEAL_ERROR TonalMDCTConceal_SaveTimeSignal( TonalMDCTConcealPtr self
* second last frame was also lost, it is expected that pastTimeSignal
* could hold a signal somewhat different from the one stored in
* TonalMDCTConceal_SaveTimeSignal (e.g. including fade-out).*/
-TONALMDCTCONCEAL_ERROR TonalMDCTConceal_Detect( TonalMDCTConcealPtr const self, /*IN */
- Word32 const pitchLag, /*IN */
- Word16 * const umIndices /*OUT*/
- );
+void TonalMDCTConceal_Detect(
+ const TonalMDCTConcealPtr self, /*IN */
+ const Word32 pitchLag, /*IN */
+ Word16 * umIndices /*OUT*/
+#ifdef IVAS_CODE_MDCT_GSHAPE
+ , const PsychoacousticParameters* psychParamsCurrent
+#endif
+);
/* Conceals the lost frame using the FD signal previously stored using
* TonalMDCTConceal_SaveFreqSignal. Stores the concealed harmonic part of
* the signal in mdctSpectrum, the rest of the spectrum is unchanged. */
-TONALMDCTCONCEAL_ERROR TonalMDCTConceal_Apply( TonalMDCTConcealPtr self, /*IN */
- Word32 * mdctSpectrum, /*OUT*/
- Word16 * mdctSpectrum_exp /*OUT*/
- );
+void TonalMDCTConceal_Apply(
+ const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */
+ Word32* mdctSpectrum, /*IN/OUT*/
+ Word16* mdctSpectrum_exp /*IN */
+#ifdef IVAS_CODE_MDCT_GSHAPE
+ , const PsychoacousticParameters* psychParamsCurrent)
+#endif
+ );
/* Conceals the lost frame using the FD signal previously stored using
* TonalMDCTConceal_SaveFreqSignal. Stores the concealed noise part of
* the signal in mdctSpectrum, the rest of the spectrum is unchanged. */
-TONALMDCTCONCEAL_ERROR TonalMDCTConceal_InsertNoise( TonalMDCTConcealPtr self, /*IN */
- Word32* mdctSpectrum, /*OUT*/
- Word16* mdctSpectrum_exp, /*OUT*/
- Word8 tonalConcealmentActive,
- Word16* pSeed, /*IN/OUT*/
- Word16 tiltCompFactor,
- Word16 crossfadeGain,
- Word16 crossOverFreq);
+void TonalMDCTConceal_InsertNoise(
+ const TonalMDCTConcealPtr hTonalMDCTConc, /*IN */
+ Word32* mdctSpectrum, /*OUT*/
+ Word16* mdctSpectrum_exp, /*OUT*/
+ const Word8 tonalConcealmentActive,
+ Word16* pSeed, /*IN/OUT*/
+ const Word16 tiltCompFactor,
+ Word16 crossfadeGain,
+#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
+ const Word16concealment_noise[L_FRAME48k],
+#endif
+ const Word16 crossOverFreq
+);
/* Detect tonal components in the lastMDCTSpectrum, use
* secondLastPowerSpectrum for the precise location of the peaks and
* store them in indexOfTonalPeak. Updates lowerIndex, upperIndex,
* pNumIndexes accordingly. */
-void DetectTonalComponents(Word16 indexOfTonalPeak[], /* OUT */
- Word16 lowerIndex[], /* OUT */
- Word16 upperIndex[], /* OUT */
- Word16 * pNumIndexes, /* OUT */
- Word32 lastPitchLag, Word32 currentPitchLag, /* IN */
- Word16 const lastMDCTSpectrum[], /* IN */
- Word16 lastMDCTSpectrum_exp, /* IN */
- Word16 const scaleFactors[], /* IN */
- Word16 const scaleFactors_exp[], /* IN */
- Word16 const scaleFactors_max_e, /* IN */
- Word32 const secondLastPowerSpectrum[], /* IN */
- Word16 nSamples /* IN */
- ,Word16 nSamplesCore
- ,Word16 floorPowerSpectrum /* IN */
- );
+void DetectTonalComponents(
+ Word16 indexOfTonalPeak[],
+ Word16 lowerIndex[],
+ Word16 upperIndex[],
+ Word16* pNumIndexes,
+ const Word32 lastPitchLag,
+ const Word32 currentPitchLag,
+ const Word16 lastMDCTSpectrum[],
+ const Word16 lastMDCTSpectrum_exp,
+ const Word16 scaleFactors[],
+ const Word16 scaleFactors_exp[],
+ const Word16 scaleFactors_max_e,
+ const Word32 secondLastPowerSpectrum[],
+ const Word16 nSamples,
+ const Word16 nSamplesCore,
+ Word16 floorPowerSpectrum /* i: lower limit for power spectrum bins */
+#ifdef IVAS_CODE_MDCT_GSHAPE
+ , const PsychoacousticParameters* psychParamsCurrent
+#endif
+);
/* When called, the tonal components are already stored in
* indexOfTonalPeak. Detect tonal components in the lastMDCTSpectrum,
@@ -10260,24 +10274,28 @@ void DetectTonalComponents(Word16 indexOfTonalPeak[], /* OU
* then keep in indexOfTonalPeak only the tonal components that are
* again detected Updates indexOfTonalPeak, lowerIndex, upperIndex,
* phaseDiff, phases, pNumIndexes accordingly. */
-void RefineTonalComponents(Word16 indexOfTonalPeak[], /* OUT */
- Word16 lowerIndex[], /* OUT */
- Word16 upperIndex[], /* OUT */
- Word16 phaseDiff[], /* OUT */
- Word16 phases[], /* OUT */
- Word16 * pNumIndexes, /* OUT */
- Word32 lastPitchLag, /* IN */
- Word32 currentPitchLag, /* IN */
- Word16 const lastMDCTSpectrum[], /* IN */
- Word16 const lastMDCTSpectrum_exp, /* IN */
- Word16 const scaleFactors[], /* IN */
- Word16 const scaleFactors_exp[], /* IN */
- Word16 const scaleFactors_max_e, /* IN */
- Word32 const secondLastPowerSpectrum[], /* IN */
- Word16 nSamples /* IN */
- ,Word16 nSamplesCore
- ,Word16 floorPowerSpectrum /* IN */
- );
+void RefineTonalComponents(
+ Word16 indexOfTonalPeak[],
+ Word16 lowerIndex[],
+ Word16 upperIndex[],
+ Word16 phaseDiff[],
+ Word16 phases[],
+ Word16* pNumIndexes,
+ const Word32 lastPitchLag,
+ const Word32 currentPitchLag,
+ const Word16 lastMDCTSpectrum[],
+ const Word16 lastMDCTSpectrum_exp,
+ const Word16 scaleFactors[],
+ const Word16 scaleFactors_exp[],
+ const Word16 scaleFactors_max_e,
+ const Word32 secondLastPowerSpectrum[],
+ const Word16 nSamples,
+ const Word16 nSamplesCore,
+ const Word16 floorPowerSpectrum /* i: lower limit for power spectrum bins */
+#ifdef IVAS_CODE_MDCT_GSHAPE
+ , const PsychoacousticParameters* psychParamsCurrent
+#endif
+);
void set_state(Word16 *state, Word16 num, Word16 N);
void concealment_init_x(Word16 N, void *_plcInfo);
@@ -10298,8 +10316,8 @@ void waveform_adj2_fix( Word16 *overlapbuf,
Word16 bfi
);
-Word16 ffr_getSfWord16(Word16 *vector, /*!< Pointer to input vector */
- Word16 len); /*!< Length of input vector */
+Word16 ffr_getSfWord16(Word16 *vector, /*!< Pointer to i vector */
+ Word16 len); /*!< Length of i vector */
void concealment_decode_fix(Word16 curr_mode, Word32 *invkoef, Word16 *invkoef_scale,void *_plcInfo);
@@ -10314,10 +10332,10 @@ void concealment_signal_tuning_fx(Word16 bfi,
Word16 *outdata2_fx,
Decoder_State_fx *st);
-Word16 Spl_GetScalingSquare_x(Word16 *in_vector, Word16 in_vector_length, Word16 times);
-Word32 Spl_Energy_x(Word16* vector, Word16 vector_length, Word16* scale_factor);
-void Log10OfEnergy_x(Word16 *s, Word32 *enerlogval, Word16 len);
-void concealment_update2_x(Word16 *outx_new, void *_plcInfo, Word16 FrameSize);
+Word16 Spl_GetScalingSquare_x(const Word16 *in_vector, const Word16 in_vector_length, Word16 times);
+Word32 Spl_Energy_x(const Word16* vector, const Word16 vector_length, Word16* scale_factor);
+void Log10OfEnergy_x(const Word16 *s, Word32 *enerlogval, const Word16 len);
+void concealment_update2_x(const Word16 *outx_new, void *_plcInfo, const Word16 FrameSize);
Word16 Sqrt_x_fast(Word32 value);
Word32 dot_w32_accuracy_x(Word16 *s1, Word16 *s2, Word16 nbits, Word16 N);
@@ -10361,26 +10379,32 @@ void longshr (UWord32 a[], Word16 bits, Word16 len);
/*qlpc_avq.h*/
-void lsf_weight_2st(const Word16 *lsfq, /* input: quantized lsf coefficients (3Q12) */
- Word16 *w, /* output: weighting function (0Q15) */
- const Word16 mode /* input: operational mode */
+void lsf_weight_2st(const Word16 *lsfq, /* i : quantized lsf coefficients (3Q12) */
+ Word16 *w, /* o : weighting function (0Q15) */
+ const Word16 mode /* i : operational mode */
);
void qlpc_avq(
- const Word16 *lsf, /* (i) Input LSF vectors */
- const Word16 *lsfmid, /* (i) Input LSF vectors */
- Word16 *lsf_q, /* (o) Quantized LFS vectors */
- Word16 *lsfmid_q, /* (o) Quantized LFS vectors */
- Word16 *index, /* (o) Quantization indices */
- Word16 *nb_indices, /* (o) Number of quantization indices */
- Word16 *nbbits, /* (o) Number of quantization bits */
- const Word16 core, /* (i) TCX10 or TCX20 */
- Word32 sr_core
+ const Word16* lsf, /* i : Input LSF vectors (14Q1*1.28) */
+ const Word16* lsfmid, /* i : Input LSF vectors (14Q1*1.28) */
+ Word16* lsf_q, /* o : Quantized LFS vectors (14Q1*1.28) */
+ Word16* lsfmid_q, /* o : Quantized LFS vectors (14Q1*1.28) */
+ Word16* index, /* o : Quantization indices */
+ Word16* nb_indices, /* o : Number of quantization indices */
+ Word16* nbbits, /* o : Number of quantization bits */
+ const Word16 core, /* i : TCX10 or TCX20 */
+ const Word32 sr_core /* i : internal sampling rate */
);
-Word16 encode_lpc_avq( Encoder_State_fx *st, Word16 numlpc, Word16 *param_lpc, Word16 mode );
+Word16 encode_lpc_avq(
+ BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */
+ const Word16 numlpc, /* i : Number of sets of lpc */
+ const Word16* param_lpc, /* i : lpc parameters */
+ const Word16 core, /* i : core */
+ const Word16 element_mode /* i : element mode - decides between SNS and LPC coding */
+);
Word16 dlpc_avq(
Word16 *index, /* (i) Quantization indices */
@@ -10388,33 +10412,51 @@ Word16 dlpc_avq(
Word16 numlpc, /* (i) Number of sets of lpc */
Word32 sr_core
);
+Word16 decode_lpc_avq(
+ Decoder_State_fx* st, /* i/o: decoder state structure */
+ const Word16 numlpc, /* i : Number of sets of lpc */
+ Word16* param_lpc /* o : lpc parameters */
+#ifdef IVAS_CODE_AVQ_LPC
+ , const Word16 ch, /* i : channel */
+ const Word16 element_mode, /* i : element mode */
+ const Word16 sns_low_br_mode /* i : SNS low-bitrate mode */
+#endif
+);
-Word16 decode_lpc_avq( Decoder_State_fx *st, Word16 numlpc, Word16 *param_lpc );
-
-Word16 vlpc_1st_cod(const Word16 *lsf, /* input: vector to quantize */
+Word16 vlpc_1st_cod(const Word16 *lsf, /* i : vector to quantize */
Word16 *lsfq /* i/o: i:prediction o:quantized lsf */
,Word16 *wout /* o: lsf weights */
,Word16 rf_mode
);
-Word16 vlpc_2st_cod( /* output: number of allocated bits */
- const Word16 *lsf, /* input: normalized vector to quantize (3Q12) */
- Word16 *lsfq, /* i/o: i:1st stage o:1st+2nd stage (3Q12) */
- Word16 *indx, /* output: index[] (4 bits per words) */
- Word16 mode, /* input: 0=abs, >0=rel */
- Word32 sr_core
+Word16 vlpc_2st_cod( /* o : number of allocated bits */
+ const Word16* lsf, /* i : normalized vector to quantize */
+ Word16* lsfq, /* i/o: i:1st stage o:1st+2nd stage */
+ Word16* indx, /* o : index[] (4 bits per words) */
+ const Word16 mode, /* i : 0=abs, >0=rel */
+ const Word32 sr_core/* i : internal sampling rate */
);
void vlpc_2st_dec(
Word16 *lsfq, /* i/o: i:1st stage o:1st+2nd stage */
- Word16 *indx, /* input: index[] (4 bits per words) */
- Word16 mode, /* input: 0=abs, >0=rel */
+ Word16 *indx, /* i : index[] (4 bits per words) */
+ Word16 mode, /* i : 0=abs, >0=rel */
Word32 sr_core);
void open_decoder_LPD(
- Decoder_State_fx *st,
- Word32 bitrate,
- Word16 bandwidth
+ Decoder_State_fx* st,
+ const Word32 total_brate,
+#ifdef NEW_IVAS_OPEN_DEC
+ const Word32 last_total_brate,
+#endif
+ const Word16 bwidth
+#ifdef NEW_IVAS_OPEN_DEC
+ , const Word16 is_mct, /* i : MCT mode flag */
+#ifdef IVAS_CODE_CNG_FIX185_PLC_FADEOUT
+ const Word16 last_element_mode,
+#endif
+ const Word16 is_init /* i : indicate call from init_decoder() to avoid double TC initialization */
+#endif
);
@@ -10432,59 +10474,65 @@ void mode_switch_decoder_LPD( Decoder_State_fx *st, Word16 bandwidth_in, Word32
);
void decoder_LPD(
- Word16 signal_out[], /* output: signal with LPD delay (7 subfrs) */
- Word16 signal_outFB[],
- Word16 *total_nbbits, /* i/o: number of bits / decoded bits */
- Decoder_State_fx *st , /* i/o: decoder memory state pointer */
- Word16 *bpf_noise_buf,
- Word16 bfi,
- Word16 *bitsRead,
- Word16 *coder_type,
- Word16 param[],
- Word16 *pitch_buf,
- Word16 *voice_factors,
- Word16 *ptr_bwe_exc
+ Word16 signal_out[], /* o : signal with LPD delay (7 subfrs) */
+ Word16 signal_outFB[], /* o : synthesis @output_FS */
+ Word16* total_nbbits, /* i/o: number of bits / decoded bits */
+ Decoder_State_fx* st, /* i/o: decoder memory state pointer */
+ Word16* bpf_noise_buf, /* i/o: BPF noise buffer */
+ Word16 bfi, /* i : BFI flag */
+ Word16* bitsRead, /* o : number of read bits */
+ Word16 param[], /* o : buffer of parameters */
+ Word16* pitch_buf, /* i/o: floating pitch values for each subfr*/
+ Word16* voice_factors, /* o : voicing factors */
+ Word16* ptr_bwe_exc /* o : excitation for SWB TBE */
);
Word16 dec_acelp_tcx_frame(
- Decoder_State_fx *st,
- Word16 *coder_type,
- Word16 *concealWholeFrame,
- Word16 *pcmBuf,
- Word16 * bpf_noise_buf,
- Word16 * pcmbufFB,
- Word32 bwe_exc_extended[],
- Word16 *voice_factors,
- Word16 pitch_buf[]
-);
+ Decoder_State_fx* st, /* i/o: decoder state structure */
+ Word16* concealWholeFrame, /* i/o: concealment flag */
+ Word16* pcmBuf, /* o : synthesis */
+ Word16* bpf_noise_buf, /* i/o: BPF noise buffer */
+ Word16* pcmbufFB, /* o : synthesis @output_FS */
+ Word32 bwe_exc_extended[], /* i/o: bandwidth extended excitation */
+ Word16* voice_factors, /* o : voicing factors */
+ Word16 pitch_buf[] /* o : floating pitch for each subframe */
+#ifdef IVAS_CODE_CNG
+ , STEREO_CNG_DEC_HANDLE hStereoCng /* i : stereo CNG handle */
+#endif
+ );
-Word16 tcxGetNoiseFillingTilt(Word16 A[],
- Word16 lpcorder,
- Word16 L_frame,
- Word16 mode,
- Word16 *noiseTiltFactor
- );
+Word16 tcxGetNoiseFillingTilt(
+ const Word16 A[],
+ const Word16 lpcorder,
+ const Word16 L_frame,
+ const Word16 mode,
+ Word16* noiseTiltFactor
+);
void tcxFormantEnhancement(
Word16 xn_buf[],
- Word16 gainlpc[], Word16 gainlpc_e[],
- Word32 spectrum[], Word16 *spectrum_e,
- Word16 L_frame
- ,Word16 L_frameTCX
+ const Word16 gainlpc[],
+ const Word16 gainlpc_e[],
+ Word32 spectrum[],
+ Word16* spectrum_e,
+ const Word16 L_frame,
+ const Word16 L_frameTCX
);
-void tcxInvertWindowGrouping(TCX_config *tcx_cfg,
- Word32 xn_buf[],
- Word32 spectrum[],
- Word16 L_frame,
- Word8 fUseTns,
- Word16 last_core,
- Word16 index,
- Word16 frame_cnt,
- Word16 bfi);
+void tcxInvertWindowGrouping(
+ TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */
+ Word32 xn_buf[],
+ Word32 spectrum[],
+ const Word16 L_frame,
+ const Word8 fUseTns,
+ const Word16 last_core,
+ const Word16 index,
+ const Word16 frame_cnt,
+ const Word16 bfi
+);
/*lerp.h*/
@@ -10492,30 +10540,59 @@ void lerp(Word16 *f, Word16 *f_out, Word16 bufferNewSize, Word16 bufferOldSize);
void attenuateNbSpectrum(Word16 L_frame, Word32 *spectrum);
-Word8 getTcxonly(const Word32 bitrate);
-Word8 getCtxHm(const Word32 bitrate, const Word16 rf_flag);
+Word16 getTcxonly(
+#ifdef IVAS_CODE_SWITCHING
+ const Word16 element_mode, /* i : IVAS element mode */
+#endif
+ const Word32 total_brate /* i : total bitrate */
+#ifdef IVAS_CODE_SWITCHING
+ , const Word16 MCT_flag, /* i : hMCT handle allocated (1) or not (0)*/
+ const int16_t is_ism_format /* i : flag indicating ISM format */
+#endif
+);
+Word8 getCtxHm(
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 rf_flag /* i : flag to signal the RF mode */
+);
Word8 getResq(const Word32 bitrate);
-Word8 getTnsAllowed(const Word32 bitrate
- ,const Word16 igf
- );
+Word16 getTnsAllowed(
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 igf, /* i : flag indicating IGF activity*/
+ const Word16 element_mode /* i : IVAS element mode */
+);
-Word8 getRestrictedMode(const Word32 bitrate, const Word16 Opt_AMR_WB);
+Word8 getRestrictedMode(
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 Opt_AMR_WB /* i : flag indicating AMR-WB IO mode */
+);
Word16 sr2fscale(const Word32 sr);
-Word32 getCoreSamplerateMode2(const Word32 bitrate, const Word16 bandwidth, const Word16 rf_flag);
+Word32 getCoreSamplerateMode2(
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */
+ const Word16 rf_mode, /* i : flag to signal the RF mode */
+ const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */
+);
Word16 getTcxBandwidth(const Word16 bandwidth);
-Word8 getIgfPresent(
- const Word32 bitrate,
- const Word16 bandwidth
- , const Word16 rf_mode
+Word16 getIgfPresent(
+ const Word16 element_mode, /* i : IVAS element mode */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 bwidth, /* i : audio bandwidth */
+ const Word16 rf_mode /* i : flag to signal the RF mode */
);
-Word8 getCnaPresent(
- const Word32 bitrate,
- const Word16 bandwidth
+Word16 getCnaPresent(
+ const Word16 element_mode, /* i : element mode */
+ const Word32 element_brate, /* i : element bitrate */
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 bwidth /* i : audio bandwidth */
);
Word8 getTcxLtp(
@@ -10534,9 +10611,9 @@ Word16 initPitchLagParameters(
Word16 getNumTcxCodedLines(const Word16 bwidth);
Word16 getTcxLpcShapedAri(
- const Word32 total_brate,
- const Word16 bwidth
- ,const Word16 rf_mode
+ const Word32 total_brate, /* i : total bitrate */
+ const Word16 rf_mode, /* i : flag to signal the RF mode */
+ const Word16 element_mode /* i : IVAS element mode */
);
@@ -10550,16 +10627,17 @@ void subband_FFT(
Word16 *fftoQ /*(o) the Scaling */
);
-void UpdateState( T_CldfbVadState *vad_state,
- Word16 vad_flag,
- Word32 frame_energy, /*(i) current frame energy*/
- Word16 sacle_sbpower, /*(i) the Scaling of current frame energy*/
- Word32 update_flag, /*(i) current frame update flag*/
- Word16 music_backgound_f, /*(i) backgound music flag*/
- Word32 HB_Power, /*(i) current frame high frequency energy*/
- Word16 HB_Power_Q /*(i) the Scaling of current frame high frequency energy*/
- ,Word32 snr
- );
+void UpdateState(
+ VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */
+ Word16 vad_flag, /* i : VAD flag */
+ Word32 frame_energy, /* i : current frame energy */
+ Word16 sacle_sbpower, /* i : the Scaling of current frame energy */
+ Word32 update_flag, /* i : current frame update flag */
+ Word16 music_backgound_f, /* i : background music flag */
+ Word32 HB_Power, /* i : current frame high frequency energy */
+ Word16 HB_Power_Q, /* i : the Scaling of current frame high frequency energy*/
+ Word32 snr
+);
void calc_snr_flux( Word32 tsnr_fix, /*(i) time-domain SNR*/
Word32 *pre_snr, /*(io)time-domain SNR storage*/
@@ -10567,112 +10645,122 @@ void calc_snr_flux( Word32 tsnr_fix, /*(i) time-domain SNR*/
);
Word16 update_decision(
- T_CldfbVadState *st,
- Word32 frame_energy, /*(i) current frame energy*/
- Word32 HB_Power, /*(i) current frame high frequency energy*/
- Word16 frameloop, /*(i) amount of frames*/
- Word16 bw, /*(i) band width index*/
- Word16 frame_energy_Q, /*(i) the Scaling of current frame energy*/
- Word16 HB_Power_Q, /*(i) the Scaling of current frame high frequency energy*/
- Word32 snr, /*(i) frequency domain SNR */
- Word32 tsnr, /*(i) time domain SNR */
- Word16 vad_flag,
- Word16 music_backgound_f /*(i) background music flag*/
-);
-
-void frame_spec_dif_cor_rate( T_CldfbVadState *st, /*(io) vad state*/
- Word32 *spec_amp, /*(i) spectral amplitude*/
- Word16 sacle, /*(i) the scaling of spec_amp*/
- Word16 f_tonality_rate[3] /*(o) tonality rate*/
- );
-
-void ltd_stable( T_CldfbVadState *st, /*(io) vad state*/
- Word16 *ltd_stable_rate, /*(o) time-domain stable rate*/
- Word32 frame_energy, /*(i) current frame energy*/
- Word16 frameloop, /*(i) amount of frames*/
- Word16 Q_frames_power /*(i) the Scaling of frames_power*/
- );
-
-void snr_calc( T_CldfbVadState *st, /*(io) vad state*/
- Word16 sacle_sbpower, /*(i) the Scaling of sbpower*/
- Word32 *snr, /*(o) frequency domain SNR */
- Word32 *tsnr, /*(o) time domain SNR */
- Word32 frame_energy, /*(i) current frame energy */
- Word32 bandwith /*(i) band width*/
- );
-
-void bg_music_decision( T_CldfbVadState *st,
- Word16 *music_backgound_f, /*(i) background music flag*/
- Word32 frame_energy, /*(i) current frame energy 1*/
- Word16 frame_energy_Q /*(i) the Scaling of current frame energy*/
- );
-
-void background_update( T_CldfbVadState *st,
- Word16 scale, /*(i) the Scaling of frame energy*/
- Word32 frame_energy, /*(i) current frame energy*/
- Word32 update_flag, /*(i) update flag*/
- Word16 music_backgound_f /*(i) background music flag*/
- ,Word32 snr
- );
-
-void spec_center( Word32* sb_power, /*(i) energy of sub-band divided uniformly*/
- Word16* sp_center, /*(o) spectral center*/
- Word32 bandwith, /*(i) band width*/
- Word16 Q_sb_p /*(i) the Scaling of sb_power*/
- );
+ VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */
+ const Word32 frame_energy, /* i : current frame energy*/
+ Word32 HB_Power, /* i : current frame high frequency energy*/
+ const Word16 frameloop, /* i : amount of frames*/
+ const Word16 bw, /* i : band width index*/
+ const Word16 frame_energy_Q, /* i : the Scaling of current frame energy*/
+ const Word16 HB_Power_Q, /* i : the Scaling of current frame high frequency energy*/
+ const Word32 snr, /* i : frequency domain SNR */
+ const Word32 tsnr, /* i : time domain SNR */
+ const Word16 vad_flag, /* i : VAD flag */
+ const Word16 music_backgound_f /* i : background music flag*/
+);
+
+void frame_spec_dif_cor_rate(
+ VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */
+ Word32* spec_amp, /* i : spectral amplitude*/
+ Word16 sacle, /* i : the scaling of spec_amp*/
+ Word16 f_tonality_rate[3] /* o : tonality rate*/
+);
+
+void ltd_stable(
+ VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */
+ Word16* ltd_stable_rate, /* o : time-domain stable rate*/
+ const Word32 frame_energy, /* i : current frame energy*/
+ const Word16 frameloop, /* i : amount of frames*/
+ const Word16 Q_frames_power /* i : the Scaling of frames_power*/
+);
+
+void snr_calc(
+ VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */
+ const Word16 sacle_sbpower, /* i : the Scaling of sbpower*/
+ Word32* snr, /* o : frequency domain SNR */
+ Word32* tsnr, /* o : time domain SNR */
+ const Word32 frame_energy, /* i : current frame energy */
+ const Word32 bwidth /* i : audio band width*/
+);
+
+void bg_music_decision(
+ VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */
+ Word16 *music_backgound_f, /*(i) background music flag*/
+ Word32 frame_energy, /*(i) current frame energy 1*/
+ Word16 frame_energy_Q /*(i) the Scaling of current frame energy*/
+);
+
+void background_update(
+ VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */
+ Word16 scale, /* i : the scaling of frame energy*/
+ Word32 frame_energy, /* i : current frame energy*/
+ Word32 update_flag, /* i : update flag*/
+ Word16 music_backgound_f, /* i : background music flag*/
+ Word32 snr
+);
+
+void spec_center(
+ Word32* sb_power, /* i : energy of sub-band divided uniformly*/
+ Word16* sp_center, /* o : spectral center*/
+ const Word32 bandwith, /* i : band width*/
+ const Word16 Q_sb_p /* i : the Scaling of sb_power*/
+);
void spec_flatness( Word32 *spec_amp, /*(i) spectral amplitude*/
Word32 smooth_spec_amp[], /*(i) smoothed spectral amplitude*/
Word16 sSFM[5] /*(o) spectral flatness rate*/
);
-void calc_lt_snr( T_CldfbVadState *st, /*(io) vad state*/
- Word32 *lt_snr_org, /*(o) original long time SNR*/
- Word32 *lt_snr, /*(o) long time SNR calculated by fg_energy and bg_energy*/
- Word32 fg_energy, /*(i) foreground energy sum */
- Word16 fg_energy_count, /*(i) amount of the foreground energy frame */
- Word32 bg_energy, /*(i) background energy sum */
- Word16 bg_energy_count, /*(i) amount of the background energy frame */
- Word16 bw_index, /*(i) band width index*/
- Word16 lt_noise_sp_center0 /*(i) long time noise spectral center by 0*/
- );
-
-Word16 vad_decision( T_CldfbVadState *st,
- Word32 l_snr, /*(i) long time frequency domain*/
- Word32 lt_snr_org, /*(i) original long time SNR*/
- Word32 lt_snr, /*(i) long time SNR calculated by fg_energy and bg_energy*/
- Word32 snr_flux, /*(i) average tsnr of several frames*/
- Word32 snr, /*(i) frequency domain SNR */
- Word32 tsnr, /*(i) time domain SNR */
- Word32 frame_energy, /*(i) current frame energy */
- Word16 music_backgound_f, /*(i) background music flag*/
- Word16 frame_energy_Q /*(i) the scaling of current frame energy*/
- );
-
-Word16 comvad_decision( T_CldfbVadState *st,
- Word32 l_snr, /*(i) long time frequency domain*/
- Word32 lt_snr_org, /*(i) original long time SNR*/
- Word32 lt_snr, /*(i) long time SNR calculated by fg_energy and bg_energy*/
- Word32 snr_flux, /*(i) average tsnr of several frames*/
- Word32 snr, /*(i) frequency domain SNR */
- Word32 tsnr, /*(i) time domain SNR */
- Word32 frame_energy, /*(i) current frame energy */
- Word16 music_backgound_f, /*(i) background music flag*/
- Word16 frame_energy_Q, /*(i) the Scaling of current frame energy*/
- Word16 *cldfb_addition, /*(o) adjust the harmonized hangover */
- Word16 vada_flag
- );
+void calc_lt_snr(
+ VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */
+ Word32* lt_snr_org_fp, /* o : original long time SNR*/
+ Word32* lt_snr_fp, /* o : long time SNR calculated by fg_energy and bg_energy*/
+ Word32 fg_energy, /* i : foreground energy sum */
+ Word16 fg_energy_count, /* i : amount of the foreground energy frame */
+ Word32 bg_energy, /* i : background energy sum */
+ Word16 bg_energy_count, /* i : amount of the background energy frame */
+ Word16 bw_index, /* i : band width index*/
+ Word16 lt_noise_sp_center0 /* i : long time noise spectral center by 0*/
+);
+
+Word16 vad_decision(
+ VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */
+ Word32 l_snr, /*(i) long time frequency domain*/
+ Word32 lt_snr_org, /*(i) original long time SNR*/
+ Word32 lt_snr, /*(i) long time SNR calculated by fg_energy and bg_energy*/
+ Word32 snr_flux, /*(i) average tsnr of several frames*/
+ Word32 snr, /*(i) frequency domain SNR */
+ Word32 tsnr, /*(i) time domain SNR */
+ Word32 frame_energy, /*(i) current frame energy */
+ Word16 music_backgound_f, /*(i) background music flag*/
+ Word16 frame_energy_Q /*(i) the scaling of current frame energy*/
+);
+
+Word16 comvad_decision(
+ VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */
+ Word32 l_snr, /*(i) long time frequency domain*/
+ Word32 lt_snr_org, /*(i) original long time SNR*/
+ Word32 lt_snr, /*(i) long time SNR calculated by fg_energy and bg_energy*/
+ Word32 snr_flux, /*(i) average tsnr of several frames*/
+ Word32 snr, /*(i) frequency domain SNR */
+ Word32 tsnr, /*(i) time domain SNR */
+ Word32 frame_energy, /*(i) current frame energy */
+ Word16 music_backgound_f, /*(i) background music flag*/
+ Word16 frame_energy_Q, /*(i) the Scaling of current frame energy*/
+ Word16 *cldfb_addition, /*(o) adjust the harmonized hangover */
+ Word16 vada_flag
+ );
void calc_lf_snr(
- Word32 *lf_snr_smooth, /*(o) smoothed lf_snr*/
- Word32 *lf_snr, /*(o) long time frequency domain SNR calculated by l_speech_snr and l_silence_snr*/
- Word32 l_speech_snr, /*(i) sum of active frames snr */
- Word32 l_speech_snr_count, /*(i) amount of the active frame */
- Word32 l_silence_snr, /*(i) sum of the nonactive frames snr*/
- Word32 l_silence_snr_count, /*(i) amount of the nonactive frame */
- Word16 fg_energy_count, /*(i) amount of the foreground energy frame */
- Word16 bg_energy_count, /*(i) amount of the background energy frame */
- Word16 bw_index /*(i) band width index*/
+ Word32* lf_snr_smooth, /* o : smoothed lf_snr*/
+ Word32* lf_snr, /* o : long time frequency domain
+ SNR calculated by l_speech_snr and l_silence_snr*/
+ const Word32 l_speech_snr, /* i : sum of active frames snr */
+ const Word32 l_speech_snr_count, /* i : amount of the active frame */
+ const Word32 l_silence_snr, /* i : sum of the nonactive frames snr*/
+ const Word32 l_silence_snr_count,/* i : amount of the nonactive frame */
+ const Word16 fg_energy_count, /* i : amount of the foreground energy frame */
+ const Word16 bg_energy_count, /* i : amount of the background energy frame */
+ const Word16 bw_index /* i : band width index*/
);
Word32 construct_snr_thresh( Word16 sp_center[], /*(i) spectral center*/
@@ -10685,31 +10773,32 @@ Word32 construct_snr_thresh( Word16 sp_center[], /*(i) spectral cen
Word16 bw_index /*(i) band width index*/
);
-Word16 vad_proc(T_CldfbVadState *vad_st,
- Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i: real values */
- Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i: imag values */
- Word16 riBuffer_exp, /* i: exponent of real & imag Buffer */
-
- Word16 *cldfb_addition, /*o: adjust the harmonized hangover */
- Word32 enerBuffer[CLDFB_NO_CHANNELS_MAX], /* i: energy vector per band */
- Word16 enerBuffer_exp, /* i: exponent of energy vector */
- Word16 bandwidth, /* 1: NB; 2:WB;3:SWB;4:FB*/
- Word16 vada_flag
- );
-
-void est_energy(Word32 enerBuffer[CLDFB_NO_CHANNELS_MAX], /* i: energy vector per band */
- Word16 enerBuffer_exp, /* i: exponent of energy vector */
- Word32 *frame_sb_energy, /*(o) energy of sub-band divided non-uniformly*/
- Word32 *frame_energy2_p, /*(o) frame energy 2*/
- Word32 *HB_Power_p, /*(o) high frequency energy*/
- Word32 *frame_energy_p, /*(o) frame energy 1*/
- Word16 *sb_power_Q, /*(o) the scaling of sb_power*/
- Word16 *frame_energy2_Q, /*(o) the scaling of frame_energy*/
- Word16 *HB_Power_Q, /*(o) the scaling of HB_Power*/
- Word16 *frame_energy_Q, /*(o) the Scaling of frame_energy*/
- Word16 *frame_sb_energy_scale, /*(o) the Scaling of frame_sb_energy[]*/
- Word32 bandwidth /*(i) band width*/
- );
+Word16 vad_proc(
+ VAD_CLDFB_HANDLE hVAD_CLDFB, /* i/o: CLDFB VAD state */
+ Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : real values */
+ Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : imag values */
+ Word16 riBuffer_exp, /* i : exponent of real & imag Buffer */
+ Word16* cldfb_addition, /* o : adjust the harmonized hangover */
+ Word32 enerBuffer[CLDFB_NO_CHANNELS_MAX], /* i : energy vector per band */
+ Word16 enerBuffer_exp, /* i : exponent of energy vector */
+ Word16 numBands, /* i : band width 1: NB; 2:WB;3:SWB;4:FB*/
+ Word16 vada_flag /* i : VAD flag */
+);
+
+void est_energy(
+ Word32 enerBuffer[CLDFB_NO_CHANNELS_MAX], /* i : energy vector per band */
+ Word16 enerBuffer_exp, /* i : exponent of energy vector */
+ Word32* frame_sb_energy, /* o : energy of sub-band divided non-uniformly*/
+ Word32* frame_energy2_p, /* o : frame energy 2*/
+ Word32* HB_Power_p, /* o : high frequency energy*/
+ Word32* frame_energy_p, /* o : frame energy 1*/
+ Word16* sb_power_Q, /* o : the scaling of sb_power*/
+ Word16* frame_energy2_Q, /* o : the scaling of frame_energy*/
+ Word16* HB_Power_Q, /* o : the scaling of HB_Power*/
+ Word16* frame_energy_Q, /* o : the Scaling of frame_energy*/
+ Word16* frame_sb_energy_scale, /* o : the Scaling of frame_sb_energy[]*/
+ const Word32 bandwidth /* i : band width*/
+);
/**
* \brief Function performs a complex 16-point FFT
@@ -10720,9 +10809,9 @@ void est_energy(Word32 enerBuffer[CLDFB_NO_CHANNELS_MAX], /* i: energy
* WOPS with 32x16 bit multiplications (scale on ): 288 cycles
* WOPS with 32x16 bit multiplications (scale off): 256 cycles
*
- * \param [i/o] re real input / output
- * \param [i/o] im imag input / output
- * \param [i ] s stride real and imag input / output
+ * \param [i/o] re real i / output
+ * \param [i/o] im imag i / output
+ * \param [i ] s stride real and imag i / output
*
* \return void
*/
@@ -10767,15 +10856,23 @@ void isf_dec_bfi(
const Word16 xsfBase[] /* i : base for differential XSF coding */
);
-void tfaCalcEnv_fx(const Word16* shb_speech, Word32* enr);
-Word16 tfaEnc_TBE_fx(Word32* enr,
- Word16 last_core,
- Word16* voicing, /* Q15 */
- Word16* pitch_buf, /* Q6 */
- Word16 Q_enr
- );
+void tfaCalcEnv_fx(
+ const Word16* shb_speech,
+ Word32* enr
+);
+Word16 tfaEnc_TBE_fx(
+ const Word32* enr,
+ const Word16 last_core,
+ const Word16* voicing, /* Q15 */
+ const Word16* pitch_buf, /* Q6 */
+ const Word16 Q_enr
+);
-void tecEnc_TBE_fx(Word16* corrFlag, const Word16* voicing, Word16 coder_type);
+void tecEnc_TBE_fx(
+ Word16* corrFlag,
+ const Word16* voicing,
+ const Word16 coder_type
+);
void set_TEC_TFA_code_fx(const Word16 corrFlag, Word16* tec_flag, Word16* tfa_flag);
@@ -10790,22 +10887,21 @@ Word16 procTecTfa_TBE_Fx(Word16 *hb_synth_Fx,
);
-void
-calcGainTemp_TBE_Fx(
+void calcGainTemp_TBE_Fx(
Word32** pCldfbRealSrc_Fx,
Word32** pCldfbImagSrc_Fx,
Word16 cldfb_exp,
Word16* loBuffer_Fx,
- Word16 startPos, /*!< Start position of the current envelope. */
- Word16 stopPos, /*!< Stop position of the current envelope. */
- Word16 lowSubband, /* lowSubband */
+ const Word16 startPos, /*!< Start position of the current envelope. */
+ const Word16 stopPos, /*!< Stop position of the current envelope. */
+ const Word16 lowSubband, /* lowSubband */
Word16* pGainTemp_m,
- Word16* pGainTemp_e
- , Word16 code
+ Word16* pGainTemp_e,
+ const Word16 code
);
void resetTecEnc_Fx(
- HANDLE_TEC_ENC_FX hTecEnc,
+ TEC_ENC_HANDLE_FX hTECEnc,
Word16 flag
);
@@ -10815,24 +10911,25 @@ resetTecDec_Fx(
HANDLE_TEC_DEC_FX hTecDec
);
+
void calcHiEnvLoBuff_Fix(
- Word16 noCols,
- Word16* pFreqBandTable, /*!< freqbandTable. */
- Word16 nSfb, /*!< Number of scalefactors. */
- Word32** pCldfbPow_Fix /*float** pCldfbPow*/,
- Word16* loBuffer_Fix /*float* loBuffer Q8*/,
- Word16* hiTempEnvOrig_Fix /*float* hiTempEnvOrig*/,
+ const Word16 noCols,
+ const Word16* pFreqBandTable, /*!< freqbandTable. */
+ const Word16 nSfb, /*!< Number of scalefactors. */
+ Word32** pCldfbPow_Fix /*float** pCldfbPow*/,
+ Word16* loBuffer_Fix /*float* loBuffer Q8*/,
+ Word16* hiTempEnvOrig_Fix /*float* hiTempEnvOrig*/,
Word16 pCldfbPow_FixScale
);
void calcLoEnvCheckCorrHiLo_Fix(
- Word16 noCols,
- Word16* pFreqBandTable, /*!< freqbandTable. */
- Word16* loBuffer_Fix /*float* loBuffer*/,
- Word16* loTempEnv_Fix /*float* loTempEnv*/,
- Word16* loTempEnv_ns_Fix /* float* loTempEnv_ns*/,
- Word16* hiTempEnvOrig_Fix /*float* hiTempEnvOrig*/,
- Word16* corrFlag /*int* corrFlag*/
+ const Word16 noCols,
+ const Word16* pFreqBandTable, /*!< freqbandTable. */
+ Word16* loBuffer_Fix /*float* loBuffer Q8*/,
+ Word16* loTempEnv_Fix /*float* loTempEnv Q7*/,
+ Word16* loTempEnv_ns_Fix /* float* loTempEnv_ns*/,
+ Word16* hiTempEnvOrig_Fix /*float* hiTempEnvOrig*/,
+ Word16* corrFlag /*int* corrFlag*/
);
@@ -10842,11 +10939,11 @@ void calcLoEnvCheckCorrHiLo_Fix(
/*----------------------------------------------------------------------*
* PLC: [ACELP: Fade-out]
* PLC: getLevelSynDeemph: derive on subframe basis the level of LPC
- * synthesis and deeemphasis based on the given input
+ * synthesis and deeemphasis based on the given i
*----------------------------------------------------------------------*/
Word16 getLevelSynDeemph( /*10Q5*/
- Word16 h1Init[], /* i: input value or vector to be processed */ /* Q15 */
+ Word16 h1Init[], /* i: i value or vector to be processed */ /* Q15 */
Word16 const A[], /* i: LPC coefficients */ /* Qx */
Word16 const lpcorder, /* i: LPC order */ /* Q0 */
Word16 const lenLpcExc, /* i: length of the LPC excitation buffer */ /* Q0 */
@@ -10958,9 +11055,10 @@ Word32 VAD_Log2( Word32 i_s32Val,
Word16 i_s16Q
);
-Word16 ffr_getSfWord32( Word32 *vector,
- Word16 len
- );
+Word16 ffr_getSfWord32(
+ const Word32* vector, /*!< Pointer to i vector */
+ const Word16 len /*!< Length of i vector */
+);
Word32 VAD_Pow( Word32 i_s32Base,
Word32 i_s32Exp,
@@ -10985,44 +11083,69 @@ void cfftf( Word16* scale,
);
-void getLookAheadResSig( Word16 *speechLookAhead, Word16 *A_3Q12, Word16 *res, Word16 L_frame, Word16 numSubFrame );
-void updateLSFForConcealment( HANDLE_PLC_ENC_EVS decState, Word16 *isf_14Q1, Word16 m );
-void getConcealedLP( HANDLE_PLC_ENC_EVS memDecState, Word16 *AqCon, const Word16 xsfBase[], Word16 last_good, Word16 L_frame );
-void getConcealedLSF( HANDLE_PLC_ENC_EVS memDecState, const Word16 xsfBase[], Word16 last_good, Word16 L_frame );
+void getLookAheadResSig(
+ Word16* speechLookAhead,
+ Word16* A_3Q12,
+ Word16* res,
+ const Word16 L_frame,
+ const Word16 numSubFrame
+);
+void updateLSFForConcealment(
+ PLC_ENC_EVS_HANDLE decState,
+ Word16* lsf_14Q1
+);
+void getConcealedLP(
+ PLC_ENC_EVS_HANDLE memDecState,
+ Word16* AqCon,
+ const Word16 lsfBase[],
+ const Word16 last_good,
+ const Word16 L_frame
+);
+void getConcealedLSF(
+ PLC_ENC_EVS_HANDLE memDecState,
+ const Word16 lsfBase[],
+ const Word16 last_good,
+ const Word16 L_frame
+);
+
+void RecLpcSpecPowDiffuseLc(
+ Word16* lspq,
+ Word16* lsp_old,
+ Word16* lsfq,
+ Decoder_State_fx* st,
+ const Word16 reset_q
+);
-void RecLpcSpecPowDiffuseLc( Word16 *ispq, Word16 *isp_old, Word16 *isfq, Decoder_State_fx *st
- , Word16 reset_q
- );
void modify_lsf(
Word16 *lsf,
const Word16 n,
- const Word32 sr_core
- , Word16 reset_q
+ const Word32 sr_core,
+ const Word16 reset_q
);
void coderLookAheadInnovation(
- Word16 A_3Q12[], /* input: coefficients NxAz[M+1] */
+ Word16 A_3Q12[], /* i : coefficients NxAz[M+1] */
Word16 *pT, /* out: pitch for all subframe */
- HANDLE_PLC_ENC_EVS st, /* i/o: coder memory state */
- Word16 *speechLookAhead_Qx, /* i: input speech in Q(st->Qold) */
- Word16 *old_exc, /* i: input excitation in Q(st->Qold) */
- Word16 L_frame /* i: input frame length */
+ PLC_ENC_EVS_HANDLE st, /* i/o: coder memory state */
+ Word16 *speechLookAhead_Qx, /* i: i speech in Q(st->Qold) */
+ Word16 *old_exc, /* i: i excitation in Q(st->Qold) */
+ Word16 L_frame /* i: i frame length */
);
void encoderSideLossSimulation(
- Encoder_State_fx *st,
- HANDLE_PLC_ENC_EVS hPlc_Ext,
- Word16 *isf_q, /* Q1*1.28 */
- Word16 stab_fac, /* Q15 */
- Word8 calcOnlyISF,
+ Encoder_State_fx* st,
+ PLC_ENC_EVS_HANDLE hPlc_Ext,
+ Word16* lsf_q, /* Q1*1.28 */
+ const Word16 stab_fac, /* Q15 */
+ const Word8 calcOnlyISF,
const Word16 L_frame
);
-void enc_prm_side_Info( HANDLE_PLC_ENC_EVS hPlc_Ext, Encoder_State_fx *st );
+void enc_prm_side_Info( PLC_ENC_EVS_HANDLE hPlc_Ext, Encoder_State_fx *st );
void GplcTcxEncSetup(Encoder_State_fx *st,
- HANDLE_PLC_ENC_EVS hPlc_Ext,
+ PLC_ENC_EVS_HANDLE hPlc_Ext,
Word16 Q_new);
Word16 encSideSpecPowDiffuseDetector(
Word16 *isf_ref,
@@ -11036,8 +11159,8 @@ Word16 encSideSpecPowDiffuseDetector(
void updateSpecPowDiffuseIdx( Encoder_State_fx *st);
void blend_subfr2(
- Word16 *sigIn1, /* i : input signal for fade-out */
- Word16 *sigIn2, /* i : input signal for fade-in */
+ Word16 *sigIn1, /* i : i signal for fade-out */
+ Word16 *sigIn2, /* i : i signal for fade-in */
Word16 *sigOut /* o : output signal */
);
@@ -11047,13 +11170,13 @@ void BASOP_cfft16(Word16 *re, Word16 *im, Word16 sizeOfFft, Word16 s, Word16 *sc
void BASOP_rfft(Word32 *x, Word16 sizeOfFft, Word16 *scale, Word16 isign);
void BASOP_rfft16(Word16 *x, Word16 sizeOfFft, Word16 *scale, Word16 isign);
-void open_PLC_ENC_EVS(
- HANDLE_PLC_ENC_EVS hPlcExt,
+void init_PLC_enc(
+ PLC_ENC_EVS_HANDLE hPlcExt,
Word32 sampleRate
);
void gPLC_encInfo (
- HANDLE_PLC_ENC_EVS self,
+ PLC_ENC_EVS_HANDLE self,
Word32 modeBitrate,
Word16 modeBandwidth,
Word16 old_clas,
@@ -11063,13 +11186,13 @@ void gPLC_encInfo (
void v_sort(Word16 *r, const Word16 lo, const Word16 up);
void coder_acelp_rf(
- ACELP_config *acelp_cfg_rf, /*input/output: configuration of the ACELP coding*/
- const Word16 coder_type, /* input: coding type */
- const Word16 A[], /* input: coefficients 4xAz[M+1] */
- const Word16 Aq[], /* input: coefficients 4xAz_q[M+1] */
- Word16 speech[], /* input: speech[-M..lg] */
- const Word16 voicing[], /* input: open-loop LTP gain */
- const Word16 T_op[], /* input: open-loop LTP lag */
+ ACELP_config *acelp_cfg_rf, /*i /o : configuration of the ACELP coding*/
+ const Word16 coder_type, /* i : coding type */
+ const Word16 A[], /* i : coefficients 4xAz[M+1] */
+ const Word16 Aq[], /* i : coefficients 4xAz_q[M+1] */
+ Word16 speech[], /* i : speech[-M..lg] */
+ const Word16 voicing[], /* i : open-loop LTP gain */
+ const Word16 T_op[], /* i : open-loop LTP lag */
Word16 stab_fac,
Encoder_State_fx *st,
Word16 target_bits, /* i/o : coder memory state */
diff --git a/lib_com/pvq_com_fx.c b/lib_com/pvq_com_fx.c
index 69b5518c44bdf254826f3c853dd523557cf6b4dd..563471093f729f47c3e9cabd1925ddce1eeb0e7e 100644
--- a/lib_com/pvq_com_fx.c
+++ b/lib_com/pvq_com_fx.c
@@ -1,18 +1,13 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
-
#include "prot_fx.h" /* Function prototypes */
#include "cnst_fx.h" /* Common constants */
#include "rom_com_fx.h" /* Static table prototypes */
-#include "stl.h" /* required for wmc_tool */
-
-
-#include "options.h"
-
+ /*! r: Approximate integer division for positive input using lookup table */
UWord32 intLimCDivPos_fx(
UWord32 NUM,
Word16 DEN
@@ -23,10 +18,11 @@ UWord32 intLimCDivPos_fx(
return UL_ru;
}
-
-Word32 intLimCDivSigned_fx(
+/*! r: Approximate integer division for signed input using lookup table */
+static Word32 intLimCDivSigned_fx(
Word32 NUM,
- Word16 DEN)
+ Word16 DEN
+)
{
Word32 L_tmp;
@@ -38,10 +34,11 @@ Word32 intLimCDivSigned_fx(
return L_tmp;
}
-
-Word16 shrtCDivSignedApprox( const Word16 num,
- const Word16 den
- )
+/*! r: Approximate integer division for negative input */
+Word16 shrtCDivSignedApprox(
+ const Word16 num,
+ const Word16 den
+)
{
Word16 pool_part;
@@ -54,9 +51,9 @@ Word16 shrtCDivSignedApprox( const Word16 num,
return pool_part;
}
-void nearProjQ15_fx(
- Word16 x,
- Word16 *result
+static void nearProjQ15_fx(
+ const Word16 x, /* i : input coefficient */
+ Word16* result /* o : projection */
)
{
const Word16 a[4] = {14967, -25518, 3415, 32351};
@@ -79,9 +76,10 @@ void nearProjQ15_fx(
*
*-------------------------------------------------------------------*/
void obtainEnergyQuantizerDensity_fx(
- const Word16 L,
- const Word16 R,
- Word16 *Density )
+ const Word16 L, /* i : left vector energy */
+ const Word16 R, /* i : right vector energy */
+ Word16* Density /* o : quantizer density */
+)
{
Word16 Rnrg, den, n;
@@ -112,8 +110,8 @@ void obtainEnergyQuantizerDensity_fx(
*
*-------------------------------------------------------------------*/
void dsDirac2Dirac_fx(
- const Word16 dsDiracIndex,
- Word16 *diracs
+ const Word16 dsDiracIndex, /* i : input index */
+ Word16* diracs /* o : number of diracs */
)
{
*diracs = dsDiracsTab[dsDiracIndex];
@@ -121,11 +119,11 @@ void dsDirac2Dirac_fx(
}
void dsDiracPerQuanta_fx(
- const Word16 td,
- const Word16 t_quanta,
- const Word16 dsm,
- const unsigned char* const *frQuanta,
- Word16 *DsIdx
+ const Word16 td, /* i : Length of vector segment */
+ const Word16 t_quanta, /* i : Assigned number of quanta */
+ const Word16 dsm, /* i : Conservative rounding flag */
+ const unsigned char* const* frQuanta, /* i : Quanta lookup table */
+ Word16* DsIdx /* o : Lookup table index */
)
{
const unsigned char *sv;
@@ -167,7 +165,7 @@ void dsDiracPerQuanta_fx(
dsIndex = add(dsIndex, lshr(sub(sv[dsIndex], t_quanta_o), 15));
dsIndex = sub(dsIndex, lshr(sub(1, dsIndex), 15));
- IF (dsm > 0)
+ IF (EQ_16(dsm, PVQ_CONS))
{
*DsIdx=dsIndex;
move16();
@@ -178,10 +176,10 @@ void dsDiracPerQuanta_fx(
}
void QuantaPerDsDirac_fx(
- Word16 td,
- Word16 dsDiracIndex,
- const unsigned char* const* dimFrQuanta,
- Word16 *Quanta
+ const Word16 td, /* i : Length of vector segment */
+ const Word16 dsDiracIndex, /* i : Quanta table index */
+ const unsigned char* const* dimFrQuanta, /* i : Quanta lookup table */
+ Word16* Quanta /* i : Quanta */
)
{
*Quanta = dimFrQuanta[td][dsDiracIndex];
@@ -195,16 +193,16 @@ void QuantaPerDsDirac_fx(
}
void conservativeL1Norm_fx(
- Word16 L,
- Word16 Qvec,
- Word16 Fcons,
- Word16 Qavail,
- Word16 Qreserv,
- Word16 Dspec,
- Word16 *Dvec,
- Word16 *Qspare,
- Word16 *Qreservplus,
- Word16 *Dspecplus
+ const Word16 L, /* i : Length of vector segment */
+ const Word16 Qvec, /* i : Assigned number of quanta */
+ const Word16 Fcons, /* i : Conservative rounding flag */
+ const Word16 Qavail, /* i : Input quanta remaining */
+ const Word16 Qreserv, /* i : Input quanta in reservoir */
+ const Word16 Dspec, /* i : assigned diracs from bitalloc */
+ Word16* Dvec, /* o : actual number of diracs */
+ Word16* Qspare, /* o : Output quanta remaining */
+ Word16* Qreservplus, /* o : Output quanta in reservoir */
+ Word16* Dspecplus /* o : Output number of diracs */
)
{
@@ -247,17 +245,18 @@ void conservativeL1Norm_fx(
void bandBitsAdjustment_fx(
- Word16 Brc,
- UWord32 INTrc,
- Word16 Bavail,
- Word16 Nbands,
- Word16 D,
- Word16 L,
- Word16 Bband,
- Word16 Breserv,
- Word16 *Bband_adj,
- Word16 *Brem,
- Word16 *Breservplus)
+ const Word16 Brc, /* i : Current number of read quanta in range coder */
+ const UWord32 INTrc, /* i : Range coder state */
+ const Word16 Bavail, /* i : Available number of quanta */
+ const Word16 Nbands, /* i : Number of bands */
+ const Word16 D, /* i : Remaining number of bands to encode */
+ const Word16 L, /* i : Size of current band */
+ const Word16 Bband, /* i : Quanta allocation for current band */
+ const Word16 Breserv, /* i : Quanta reservoir */
+ Word16* Bband_adj, /* o : Actual used number of quanta */
+ Word16* Brem, /* o : Quanta remaining */
+ Word16* Breservplus /* o : Quanta pool size */
+)
{
Word16 Btemp;
Word16 Bff;
@@ -281,13 +280,14 @@ void bandBitsAdjustment_fx(
*Brem = sub(Bavail, Bff);
*Bband_adj = s_min(*Brem, add(*Bband_adj, Btemp));
*Bband_adj = s_max(0, *Bband_adj);
+ return;
}
-static Word16 Ratio_base2Q11_fx( /* o : Q11 */
- const Word16 opp, /* i : Q15 */
- const Word16 near /* i : Q15 */
+static Word16 Ratio_base2Q11_fx( /* o : Q11 */
+ const Word16 opp, /* i : opposite Q15 */
+ const Word16 near /* i : near Q15 */
)
{
Word16 mc, nc, ms, ns, d, z;
@@ -310,10 +310,10 @@ static Word16 Ratio_base2Q11_fx( /* o : Q11 */
return result;
}
-void Ratio_rQ3_fx(
- Word16 opp,
- Word16 near,
- Word16 *result
+static void Ratio_rQ3_fx(
+ Word16 opp, /* i : opposite */
+ Word16 near, /* i : near */
+ Word16* result /* o : ratio */
)
{
Word16 tmp;
@@ -325,11 +325,11 @@ void Ratio_rQ3_fx(
void densityAngle2RmsProjDec_fx(
- Word16 D,
- Word16 indexphi,
- Word16 *oppQ15,
- Word16 *nearQ15,
- Word16 *oppRatioQ3
+ const Word16 D, /* i : density */
+ const Word16 indexphi, /* i : decoded index from AR dec */
+ Word16* oppQ15, /* o : opposite */
+ Word16* nearQ15, /* o : near */
+ Word16* oppRatioQ3 /* o : ratio */
)
{
Word16 phiQ14q;
@@ -361,12 +361,12 @@ void densityAngle2RmsProjDec_fx(
}
void densityAngle2RmsProjEnc_fx(
- Word16 D,
- Word16 phiQ14uq,
- Word16 *indexphi,
- Word16 *oppQ15,
- Word16 *nearQ15,
- Word16 *oppRatioQ3
+ const Word16 D, /* i : density */
+ const Word16 phiQ14uq, /* i : angle */
+ Word16* indexphi, /* o : index */
+ Word16* oppQ15, /* o : opposite */
+ Word16* nearQ15, /* o : near */
+ Word16* oppRatioQ3 /* o : ratio */
)
{
*indexphi = mult_r(shl(D, 1), phiQ14uq);
@@ -380,21 +380,21 @@ void densityAngle2RmsProjEnc_fx(
}
void NearOppSplitAdjustment_fx(
- const Word16 qband,
- const Word16 qzero,
- const Word16 Qac,
- const UWord32 INTac,
- const Word16 qglobal,
- const Word16 FlagCons,
- const Word16 Np,
- const Word16 Nhead,
- const Word16 Ntail,
- const Word16 Nnear,
- const Word16 Nopp,
- Word16 oppRQ3,
- Word16 *qnear,
- Word16 *qopp,
- Word16 *qglobalupd
+ const Word16 qband, /* i : quanta for current band */
+ const Word16 qzero, /* i : range coder finalization quanta */
+ const Word16 Qac, /* i : range coder current quanta */
+ const UWord32 INTac, /* i : range coder state */
+ const Word16 qglobal, /* i : quanta input */
+ const Word16 FlagCons, /* i : conservative rounding flag */
+ const Word16 Np, /* i : number of parts */
+ const Word16 Nhead, /* i : first part */
+ const Word16 Ntail, /* i : remaining parts */
+ const Word16 Nnear, /* i : length of near component */
+ const Word16 Nopp, /* i : length of opposite component */
+ Word16 oppRQ3, /* i : ratio */
+ Word16* qnear, /* o : quantized near */
+ Word16* qopp, /* o : quantized opposite */
+ Word16* qglobalupd /* o : quanta remaining */
)
{
@@ -449,7 +449,7 @@ void apply_gain_fx(
const Word16 *band_end, /* i : Sub band end indices */
const Word16 num_sfm, /* i : Number of bands */
const Word16 *gains, /* i : Band gain vector Q12 */
- Word16 *xq /* i/o: Float synthesis / Gain adjusted synth Q15/Q12 */
+ Word16 *xq /* i/o: Float synthesis / Gain adjusted synth Q15/Q12 */
)
{
Word16 band,i;
@@ -477,12 +477,12 @@ void apply_gain_fx(
*--------------------------------------------------------------------------*/
void fine_gain_quant_fx(
- Encoder_State_fx *st_fx,
- const Word16 *ord, /* i : Indices for energy order */
- const Word16 num_sfm, /* i : Number of bands */
- const Word16 *gain_bits, /* i : Gain adjustment bits per sub band */
+ BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */
+ const Word16 *ord, /* i : Indices for energy order */
+ const Word16 num_sfm, /* i : Number of bands */
+ const Word16 *gain_bits, /* i : Gain adjustment bits per sub band */
Word16 *fg_pred, /* i/o: Predicted gains / Corrected gains Q12 */
- const Word16 *gopt /* i : Optimal gains Q12 */
+ const Word16 *gopt /* i : Optimal gains Q12 */
)
{
Word16 band;
@@ -517,7 +517,7 @@ void fine_gain_quant_fx(
gain_db = round_fx(L_shl(L_tmp, 17));
idx = squant_fx(gain_db, &gain_dbq, finegain_fx[gbits-1], gain_cb_size[gbits-1]);
- push_indice_fx( st_fx, IND_PVQ_FINE_GAIN, idx, gbits );
+ push_indice_fx( hBstr, IND_PVQ_FINE_GAIN, idx, gbits );
L_tmp = L_mult0(gain_dbq, 21771); /* 21771=0.05*log2(10) */ /* 14+17=31 */
L_tmp = L_shr(L_tmp, 15);
@@ -541,7 +541,7 @@ void fine_gain_quant_fx(
*-------------------------------------------------------------------*/
void srt_vec_ind16_fx (
- const Word16 *linear, /* linear input */
+ const Word16 *linear,/* linear input */
Word16 *srt, /* sorted output*/
Word16 *I, /* index for sorted output */
Word16 length
@@ -599,8 +599,8 @@ void srt_vec_ind16_fx (
* - 8.0 to infinity
*---------------------------------------------------------------------------*/
Word16 atan2_fx( /* o: Angle between 0 and PI/2 radian (Q14) */
- const Word32 y, /* i: Argument must be positive (Q15) */
- const Word32 x /* i: Q15 */
+ const Word32 y, /* i : near side (Argument must be positive) (Q15) */
+ const Word32 x /* i : opposite side (Q15) */
)
{
Word32 acc, arg;
diff --git a/lib_com/range_com_fx.c b/lib_com/range_com_fx.c
index 1e7aa09b07e312f64eb1b6eb928e3df574bc1044..036767d4b7bafbaaa3dc116e3f85187fa281d8d8 100644
--- a/lib_com/range_com_fx.c
+++ b/lib_com/range_com_fx.c
@@ -2,11 +2,10 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h" /* required for wmc_tool */
/*-------------------------------------------------------------------*
@@ -23,10 +22,16 @@ Word16 rc_get_bits2_fx( /* o: Number of bits needed */
return add(add(N, 2), norm_ul(range));
}
+/*-------------------------------------------------------------------*
+ * rangeCoderFinalizationFBits()
+ *
+ * Fractional (Q3) bits for range coder finalization
+ *-------------------------------------------------------------------*/
+
void rangeCoderFinalizationFBits_fx(
- Word16 Brc,
- UWord32 INTrc,
- Word16 *FBits
+ Word16 Brc, /* i : Current number of decoded bits */
+ UWord32 INTrc, /* i : Range coder state */
+ Word16* FBits /* i : Fractional finalization bits */
)
{
Word32 L_Bq15;
diff --git a/lib_com/re8_ppv_fx.c b/lib_com/re8_ppv_fx.c
index 873ff54dac05bbc30a5d62585081fb39844980c0..b43766b023561b33b7f112c1306a7330f3ecc498 100644
--- a/lib_com/re8_ppv_fx.c
+++ b/lib_com/re8_ppv_fx.c
@@ -8,8 +8,8 @@
#include "stl.h"
/*-------------------------------------------------------------------*
- * Prototypes
- *-------------------------------------------------------------------*/
+ * Local function prototypes
+ *-------------------------------------------------------------------*/
static void nearest_neighbor_2D8_fx( const Word32 x[], Word16 y[] );
static Word32 compute_error_2D8_fx( const Word32 x[], const Word16 y[] );
@@ -24,8 +24,8 @@ static Word32 compute_error_2D8_fx( const Word32 x[], const Word16 y[] );
* --------------------------------------------------------------*/
void re8_PPV_fx(
- const Word32 x[], /* i : point in R^8Q15 */
- Word16 y[] /* o : point in RE8 (8-dimensional integer vector) */
+ const Word32 x[], /* i : point in R^8Q15 */
+ Word16 y[] /* o : point in RE8 (8-dimensional integer vector) */
)
{
Word16 i, y0[8];
diff --git a/lib_com/re8_util_fx.c b/lib_com/re8_util_fx.c
index b67c73f59edcdbb076bb9902b338d07d8ba886a9..94a410f141b6784def4c9ef416b20893c4248a74 100644
--- a/lib_com/re8_util_fx.c
+++ b/lib_com/re8_util_fx.c
@@ -2,15 +2,15 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "rom_com_fx.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h"
/*-------------------------------------------------------------------*
- * Prototypes
+ * Local function prototypes
*-------------------------------------------------------------------*/
static Word16 re8_identify_absolute_leader_fx( const Word16 y[] );
diff --git a/lib_com/recovernorm_fx.c b/lib_com/recovernorm_fx.c
index f061c71eff8a959140fb851019764ce5ad92743a..8594d3854ef3f3b535fe94e2c5956cd9b4b7877c 100644
--- a/lib_com/recovernorm_fx.c
+++ b/lib_com/recovernorm_fx.c
@@ -1,9 +1,8 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
-#include "stl.h" /* required for wmc_tool */
#include "prot_fx.h" /* Function prototypes */
#include "cnst_fx.h" /* Common constants */
#include "rom_com_fx.h" /* Static table prototypes */
@@ -15,10 +14,10 @@
*--------------------------------------------------------------------------*/
void recovernorm_fx(
- Word16 *idxbuf, /* i : reordered quantization indices */
+ const Word16 *idxbuf, /* i : reordered quantization indices */
Word16 *ynrm, /* o : recovered quantization indices */
Word16 *normqlg2, /* o : recovered quantized norms */
- Word16 nb_sfm /* i : number of SFMs */
+ const Word16 nb_sfm /* i : number of SFMs */
)
{
Word16 i,j,k;
diff --git a/lib_com/reordvct_fx.c b/lib_com/reordvct_fx.c
index 952c483d000c9838059d047c59c8c328d8161415..2c2ffe9549ad1665cdd0a553384f5793fa97c9e4 100644
--- a/lib_com/reordvct_fx.c
+++ b/lib_com/reordvct_fx.c
@@ -2,8 +2,8 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h" /* Compilation switches */
-#include "stl.h"
#include "prot_fx.h" /* Function prototypes */
@@ -15,7 +15,7 @@
void reordvct_fx(
Word16 *y, /* i/o: vector to rearrange */
- const Word16 N, /* i : dimensions */
+ const Word16 N, /* i : dimensions */
Word16 *idx /* o : reordered vector index */
)
{
diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c
index 67528b91803e49a2559570576d74326c0f84566b..48d3de59bddfabc63121b5aa2a19a69febaa5218 100644
--- a/lib_com/residu_fx.c
+++ b/lib_com/residu_fx.c
@@ -2,11 +2,11 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "rom_com_fx.h" /* Function prototypes */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h"
/*--------------------------------------------------------------------*
* Residu3_lc_fx:
@@ -20,7 +20,7 @@ void Residu3_lc_fx(
const Word16 a[], /* i : prediction coefficients Q12 */
const Word16 m, /* i : order of LP filter Q0 */
const Word16 x[], /* i : input signal (usually speech) Qx */
- Word16 y[], /* o : output signal (usually residual) Qx */
+ Word16 y[], /* o : output signal (usually residual) Qx */
const Word16 lg, /* i : vector size Q0 */
const Word16 shift
)
@@ -70,9 +70,10 @@ void Residu3_lc_fx(
void Residu3_10_fx(
const Word16 a[], /* i : prediction coefficients Q12 */
const Word16 x[], /* i : input signal (usually speech) Qx */
- /* (note that values x[-10..-1] are needed) */
- Word16 y[], /* o : output signal (usually residual) Qx */
- const Word16 lg, /* i : vector size Q0 */ const Word16 shift
+ /* (note that values x[-10..-1] are needed) */
+ Word16 y[], /* o : output signal (usually residual) Qx */
+ const Word16 lg, /* i : vector size Q0 */
+ const Word16 shift
)
{
Word16 i,j;
@@ -102,8 +103,8 @@ void Residu3_10_fx(
void Residu3_fx(
const Word16 a[], /* i : prediction coefficients Q12 */
const Word16 x[], /* i : input signal (usually speech) Qx */
- /* (note that values x[-M..-1] are needed) */
- Word16 y[], /* o : output signal (usually residual) Qx */
+ /* (note that values x[-M..-1] are needed) */
+ Word16 y[], /* o : output signal (usually residual) Qx */
const Word16 lg, /* i : vector size Q0 */
const Word16 shift
)
@@ -150,18 +151,13 @@ void Residu3_fx(
/*==========================================================================*/
void calc_residu_fx(
- Encoder_State_fx *st, /* i/o: state structure */
- const Word16 *speech, /* i : weighted speech signal */
- Word16 *res, /* o : residual signal */
- const Word16 *p_Aq, /* i : quantized LP filter coefficients */
- const Word16 vad_hover_flag,
- const Word16 vad_flag_dtx
+ Encoder_State_fx *st, /* i/o: state structure */
+ const Word16 *speech, /* i : weighted speech signal */
+ Word16 *res, /* o : residual signal */
+ const Word16 *p_Aq /* i : quantized LP filter coefficients */
)
{
Word16 i_subfr;
- Word16 i;
- Word16 att;
- Word16 offset;
FOR( i_subfr = 0; i_subfr < st->L_frame_fx; i_subfr += L_SUBFR )
{
@@ -171,40 +167,6 @@ void calc_residu_fx(
/* next subframe */
p_Aq += (M+1);
}
- /* smoothing in case of CNG */
- test();
- IF( (st->Opt_DTX_ON_fx != 0 ) && (vad_hover_flag != 0) ) /* corresponds to line 504 in FLT acelp_core_enc.c */
- {
- st->burst_ho_cnt_fx = add(st->burst_ho_cnt_fx,1);
- st->burst_ho_cnt_fx = s_min(st->burst_ho_cnt_fx, HO_HIST_SIZE);
- IF( NE_16(st->bwidth_fx, NB))
- {
- offset = 5;
- test();
- if( EQ_16(st->bwidth_fx, WB)&&st->CNG_mode_fx>=0)
- {
- offset = st->CNG_mode_fx;
- move16();
- }
-
- att = CNG_burst_att_fx[offset][sub(st->burst_ho_cnt_fx,1)]; /*Q15*/
-
- FOR( i = 0; i < st->L_frame_fx; i++ )
- {
- res[i] = mult_r(res[i], att);
- move16();
- }
- }
- }
- ELSE
- {
- test();
- IF( (st->Opt_DTX_ON_fx != 0) && (vad_flag_dtx != 0) )
- {
- st->burst_ho_cnt_fx = 0;
- move16();
- }
- }
return;
}
diff --git a/lib_com/rom_com_fx.c b/lib_com/rom_com_fx.c
index dba0f3a0d6494f64e2956fe831e7be04925c561b..05ee311e89fa6b735edd2fb81bd03fc965f52cdd 100644
--- a/lib_com/rom_com_fx.c
+++ b/lib_com/rom_com_fx.c
@@ -22,7 +22,17 @@ const Word32 brate_tbl[SIZE_BRATE_TBL] =
ACELP_7k20, ACELP_8k00, ACELP_9k60, ACELP_13k20, ACELP_16k40, ACELP_24k40,
ACELP_32k, ACELP_48k, ACELP_64k, HQ_96k, HQ_128k
};
-
+/*----------------------------------------------------------------------------------*
+ * Table of bitrates
+ *----------------------------------------------------------------------------------*/
+ /*IVAS_CNST_AND_ROM*/
+const Word32 brate_intermed_tbl[SIZE_BRATE_INTERMED_TBL] =
+{
+ ACELP_5k00, ACELP_6k15, ACELP_7k20, ACELP_8k00, ACELP_9k60, ACELP_11k60, ACELP_12k15, ACELP_12k85, ACELP_13k20,
+ ACELP_14k80, ACELP_16k40, ACELP_22k60, ACELP_24k40, ACELP_29k00, ACELP_29k20, ACELP_30k20,
+ ACELP_30k40, ACELP_32k, ACELP_48k, ACELP_64k, HQ_96k, HQ_128k
+};
+/*End of IVAS_CNST_AND_ROM*/
/*----------------------------------------------------------------------------------*
* Conversion of ACELP signalling parameters (ACELP internal Fs, coder type, bandwidth, sharpening flag) to index
* (to be consulted with the decision matrix)
@@ -32,8 +42,6 @@ const Word32 brate_tbl[SIZE_BRATE_TBL] =
* - the other values represent indices created by combining different parameters into a single value through the macro SIG2IND()
*----------------------------------------------------------------------------------*/
-/* Combine coder_type, bandwidth, formant sharpening flag, and channel-aware flag into one indice */
-#define SIG2IND(ctype, bw, sf, ca_rf) ( ctype | (bw << 3) | (sf << 6) | (ca_rf << 7) )
const Word32 acelp_sig_tbl[MAX_ACELP_SIG] =
{
@@ -88,16 +96,27 @@ const Word32 acelp_sig_tbl[MAX_ACELP_SIG] =
/* bit allocation table for end-frame LSF quantizer */
const Word16 LSF_bits_tbl[] =
{
+#ifdef MOD_BIT_ALLOC_ROM_TABLE
+ 22, 31, 24, 29, 24, 22, /* ACELP_5k00 */
+ 22, 31, 24, 29, 24, 22, /* ACELP_6k15 */
+#endif
/* IC UC VC GC TC AC */
22, 37, 31, 29, 31, 22, /* ACELP_7k20 */
22, 40, 36, 33, 34, 22, /* ACELP_8k00 */
+#ifdef MOD_BIT_ALLOC_ROM_TABLE
+ 27, 40, 34, 35, 37, 27, /* ACELP_9k60 */
+#endif
31, 0, 37, 37, 40, 31, /* ACELP_11k60 */
31, 0, 39, 39, 41, 31, /* ACELP_12k15 */
31, 0, 38, 38, 40, 31, /* ACELP_12k85 */
31, 0, 38, 38, 40, 31, /* ACELP_13k20 */
31, 0, 37, 42, 42, 31, /* ACELP_14k80 */
31, 0, 43, 40, 40, 31, /* ACELP_16k40 */
+#ifdef MOD_BIT_ALLOC_ROM_TABLE
+ 31, 0, 42, 40, 40, 31, /* ACELP_22k60 */
+#else
31, 0, 42, 40, 40, 0, /* ACELP_22k60 */
+#endif
31, 0, 46, 41, 41, 31, /* ACELP_24k40 */
41, 0, 0, 41, 41, 0, /* ACELP_29k00 */
41, 0, 0, 41, 41, 0, /* ACELP_29k20 */
@@ -109,6 +128,32 @@ const Word16 LSF_bits_tbl[] =
};
/* bit allocation table for mid-frame LSF quantizer */
+#ifdef MOD_BIT_ALLOC_ROM_TABLE
+const int16_t mid_LSF_bits_tbl[] =
+{
+ /* IC UC VC GC TC AC */
+ 2, 5, 1, 2, 2, 2, /* ACELP_5k00 */
+ 2, 5, 1, 2, 2, 2, /* ACELP_6k15 */
+ 2, 5, 4, 5, 5, 2, /* ACELP_7k20 */
+ 2, 5, 4, 5, 5, 2, /* ACELP_8k00 */
+ 2, 5, 4, 5, 5, 2, /* ACELP_9k60 */
+ 2, 5, 4, 5, 5, 2, /* ACELP_11k60 */
+ 2, 5, 5, 5, 5, 2, /* ACELP_12k15 */
+ 2, 5, 5, 5, 5, 2, /* ACELP_12k85 */
+ 2, 5, 5, 5, 5, 2, /* ACELP_13k20 */
+ 4, 0, 5, 5, 5, 4, /* ACELP_14k80 */
+ 4, 0, 5, 5, 5, 4, /* ACELP_16k40 */
+ 5, 0, 5, 5, 5, 5, /* ACELP_22k60 */
+ 5, 0, 5, 5, 5, 5, /* ACELP_24k40 */
+ 5, 0, 0, 5, 5, 5, /* ACELP_29k00 */
+ 5, 0, 0, 5, 5, 5, /* ACELP_29k20 */
+ 5, 0, 0, 5, 5, 5, /* ACELP_30k20 */
+ 5, 0, 0, 5, 5, 5, /* ACELP_30k40 */
+ 5, 0, 0, 5, 5, 5, /* ACELP_32k */
+ 5, 0, 0, 5, 5, 5, /* ACELP_48k */
+ 5, 0, 0, 5, 5, 5, /* ACELP_64k */
+};
+#else
const Word16 mid_LSF_bits_tbl[] =
{
/* IC UC VC GC TC AC */
@@ -130,14 +175,21 @@ const Word16 mid_LSF_bits_tbl[] =
5, 0, 0, 5, 5, 5, /* ACELP_48k */
5, 0, 0, 5, 5, 5, /* ACELP_64k */
};
-
+#endif
/* bit allocation table for scaled innovation energy prediction */
const Word16 Es_pred_bits_tbl[] =
{
/* UC VC GC TC */
+#ifdef MOD_BIT_ALLOC_ROM_TABLE
+ 0, 0, 0, 4, /* ACELP_5k00 */
+ 0, 0, 0, 4, /* ACELP_6k15 */
+#endif
0, 0, 0, 4, /* ACELP_7k20 */
0, 0, 0, 4, /* ACELP_8k00 */
+#ifdef MOD_BIT_ALLOC_ROM_TABLE
+ 0, 5, 5, 5, /* ACELP_9k60 */
+#endif
0, 5, 4, 4, /* ACELP_11k60 */
0, 5, 5, 5, /* ACELP_12k15 */
0, 5, 4, 5, /* ACELP_12k85 */
@@ -157,6 +209,156 @@ const Word16 Es_pred_bits_tbl[] =
/* bit allocation table for gain quantizer (ACELP@12.8kHz) */
/* the 4 values allocated correspond to 4 subframes */
+#ifdef MOD_BIT_ALLOC_ROM_TABLE
+const int16_t gain_bits_tbl[] =
+{
+ /* UC VC GC TC0_0 TC0_64 TC0_128 TC0_192 TC64 TC128 TC192 */
+ 6,6,6,6, 7,6,6,6, 7,6,6,6, 5,5,5,5, 5,5,6,5, 5,3,6,6, 5,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,10, /* ACELP_5k00 */
+ 6,6,6,6, 7,6,6,6, 7,6,6,6, 5,5,5,5, 5,5,6,5, 5,3,6,6, 5,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,10, /* ACELP_6k15 */
+ 7,7,7,7, 7,6,6,6, 6,6,6,6, 5,5,5,5, 5,5,6,5, 5,3,6,6, 5,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,10, /* ACELP_7k20 */
+ 7,7,7,7, 8,7,6,6, 8,7,6,6, 5,5,5,5, 5,6,5,5, 5,3,6,6, 5,3,3,6, 3,5,5,5, 3,3,6,6, 3,3,3,14, /* ACELP_8k00 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,10, /* ACELP_9k60 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,13, /* ACELP_11k60 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,14, /* ACELP_12k15 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,5, 3,3,3,14, /* ACELP_12k85 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,15, /* ACELP_13k20 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,15, /* ACELP_14k80 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,15, /* ACELP_16k40 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,14, /* ACELP_22k60 */
+ 7,7,7,7, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,6,6,6, 6,3,6,6, 6,3,3,6, 3,6,6,6, 3,3,6,6, 3,3,3,15, /* ACELP_24k40 */
+};
+
+
+/* bit allocation table for gain gain quantizer (ACELP@16kHz) */
+/* the 5 values allocated correspond to 5 subframes */
+const int16_t gain_bits_16kHz_tbl[] =
+{
+ /* IC GC TC0 TC64 TC128 TC192 TC256 */
+ 0,0,0,0,0, 6,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0, 0, /* ACELP_8k00 */
+ 0,0,0,0,0, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,15, /* ACELP_14k80 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,15, /* ACELP_22k60 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,16, /* ACELP_24k40 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_29k00 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_29k20 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_30k20 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_30k40 */
+ 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 3,6,6,6,6, 3,3,6,6,6, 3,3,3,6,6, 3,3,3,3,14, /* ACELP_32k */
+ 12,12,12,12,12, 12,12,12,12,12, 12,12,12,12,12, 6,12,12,12,12, 6,6,12,12,12, 6,6,6,12,12, 6,6,6,6,12, /* ACELP_48k */
+ 12,12,12,12,12, 12,12,12,12,12, 12,12,12,12,12, 6,12,12,12,12, 6,6,12,12,12, 6,6,6,12,12, 6,6,6,6,12 /* ACELP_64k */
+};
+
+/* bit allocation table for adaptive codebook (pitch) (ACELP@12.8kHz) */
+/* the 4 values correspond to 4 subframes */
+const int16_t ACB_bits_tbl[] =
+{
+ /* UC VC GC TC0_0 TC0_64 TC0_128 TC0_192 TC64 TC128 TC192 */
+ 0,0,0,0, 9,5,5,5, 8,5, 8,5, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,8, /* ACELP_5k00 */
+ 0,0,0,0, 9,5,5,5, 8,5, 8,5, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,8, /* ACELP_6k15 */
+ 0,0,0,0, 9,5,5,5, 8,5, 8,5, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,8, /* ACELP_7k20 */
+ 0,0,0,0, 10,5,5,5, 9,5, 8,5, 6,5,6,6, 0,7,6,6, 0,0,7,5, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_8k00 */
+ 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_9k60 */
+ 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_11k60 */
+ 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_12k15 */
+ 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_12k85 */
+ 0,0,0,0, 10,5,5,5, 10,6, 9,6, 6,5,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_13k20 */
+ 0,0,0,0, 10,5,5,5, 10,6,10,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_14k80 */
+ 0,0,0,0, 10,5,5,5, 10,6,10,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_16k40 */
+ 0,0,0,0, 10,5,5,5, 10,6,10,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_22k60 */
+ 0,0,0,0, 10,5,5,5, 10,6,10,6, 6,6,6,6, 0,7,6,6, 0,0,7,6, 0,0,0,7, 0,0,9,6, 0,0,5,9, 0,0,0,9, /* ACELP_24k40 */
+};
+
+/* bit allocation table for adaptive codebook (pitch) (ACELP@16kHz) */
+/* the 5 values correspond to 5 subframes */
+const int16_t ACB_bits_16kHz_tbl[] =
+{
+ /* IC GC TC0 TC64 TC128 TC192 TC256 */
+ 0,0, 0,0,0, 9,0, 0,0,0, 0,0, 0,0,0, 0,0, 0,0,0, 0,0, 0,0,0, 0,0,0, 0,0, 0,0,0,0, 0, /* ACELP_8k00 */
+ 0,0, 0,0,0, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_14k80 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_22k60 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_24k40 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_29k00 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_29k20 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_30k20 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_30k40 */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_32k */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10, /* ACELP_48k */
+ 10,6,10,6,6, 10,6,10,6,6, 6,8,10,6,6, 0,6,10,6,6, 0,0,10,6,6, 0,0,0,10,6, 0,0,0,0,10 /* ACELP_64k */
+};
+
+/* bit allocation table for algebraic (fixed) codebook (innovation) (ACELP@12.8kHz) */
+/* the 4 values correspond to 4 subframes */
+const int16_t FCB_bits_tbl[] =
+{
+ /* UC VC GC TC0_0 TC0_64 TC0_128 TC0_192 TC64 TC128 TC192 */
+ 8,8,8,8, 12,12,12,20, 7, 7, 0, 7, 12, 7,12,12, 12,12, 7,12, 12,12,12,12, 12,12,20,12, 12,12,12,12, 12,12,12,12, 12,12,12,20, /* ACELP_5k00 */
+ 10,10,10,10, 12,12,12,20, 12, 7,12, 7, 12, 7,12,12, 12,12, 7,12, 12,12,12,12, 12,12,20,12, 12,12,12,12, 12,12,12,12, 12,12,12,20, /* ACELP_6k15 */
+ 13,13,13,13, 12,12,12,20, 12,12,12,20, 12, 7,12,12, 12,12, 7,12, 12,12,12,12, 12,12,20,12, 12,12,12,12, 12,12,12,12, 12,12,12,20, /* ACELP_7k20 */
+ 13,13,13,13, 12,20,12,20, 12,20,12,20, 20,12,12,12, 20,12,12,12, 20,12,20,12, 20,12,20,20, 20,12,12,20, 20,12,20,12, 12,20,12,20, /* ACELP_8k00 */
+ 13,13,13,13, 20,28,20,28, 20,20,20,28, 20,20,20,20, 20,20,20,20, 20,20,28,20, 20,28,20,28, 20,28,20,20, 20,20,20,28, 20,28,20,28, /* ACELP_9k60 */
+ 0, 0, 0, 0, 28,36,28,36, 28,28,28,36, 28,28,28,28, 28,28,28,28, 28,28,36,28, 28,36,28,36, 28,36,28,28, 28,28,28,36, 28,36,28,36, /* ACELP_11k60 */
+ 0, 0, 0, 0, 28,36,36,36, 28,36,28,36, 36,28,28,28, 36,28,28,28, 36,28,36,28, 36,36,28,43, 28,36,28,36, 28,36,28,36, 28,36,36,36, /* ACELP_12k15 */
+ 0, 0, 0, 0, 36,36,36,43, 36,36,36,36, 36,36,28,36, 36,28,36,36, 36,36,36,36, 36,36,43,43, 36,36,36,36, 36,36,36,43, 36,36,36,43, /* ACELP_12k85 */
+ 0, 0, 0, 0, 36,43,36,43, 36,36,36,43, 36,36,36,36, 36,36,36,36, 36,36,43,36, 36,43,43,43, 36,43,36,36, 43,36,43,36, 36,43,36,43, /* ACELP_13k20 */
+ 0, 0, 0, 0, 43,50,43,50, 43,43,43,43, 43,43,43,43, 43,43,43,43, 43,43,50,43, 43,50,50,50, 43,43,43,50, 50,43,50,43, 43,50,43,50, /* ACELP_14k80 */
+ 0, 0, 0, 0, 50,56,50,56, 50,50,50,56, 56,50,50,50, 56,50,50,50, 56,50,56,56, 56,56,56,56, 50,56,50,56, 50,56,56,56, 50,56,56,56, /* ACELP_16k40 */
+ 0, 0, 0, 0, 83,83,83,87, 78,83,83,83, 83,78,83,83, 83,78,83,87, 83,87,83,87, 83,87,87,92, 87,83,87,83, 87,83,87,87, 83,87,87,87, /* ACELP_22k60 */
+ 0, 0, 0, 0, 92,92,92,92, 87,92,92,92, 92,87,92,92, 92,87,92,92, 92,92,92,92, 92,92,92,92, 92,92,92,92, 92,92,92,92, 92,92,92,92, /* ACELP_24k40 */
+};
+
+/* bit allocation table for algebraic (fixed) codebook (innovation) (ACELP@16kHz) */
+/* the 5 values correspond to 5 subframes */
+const int16_t FCB_bits_16kHz_tbl[] =
+{
+ /* IC GC TC0 TC64 TC128 TC192 TC256 */
+ 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_8k00 */
+ 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_14k80 */
+ 0, 0, 0, 0, 0, 62,56,56,56,62, 62,56,56,56,56, 56,56,56,56,73, 62,56,62,62,62, 56,62,62,62,73, 62,62,62,62,68, /* ACELP_22k60 */
+ 0, 0, 0, 0, 0, 68,68,68,73,73, 68,68,68,68,73, 68,73,68,73,73, 73,73,73,73,73, 73,78,73,73,78, 73,78,73,73,78, /* ACELP_24k40 */
+ 12,12,12,12,12, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, /* ACELP_29k00 */
+ 12,12,12,12,12, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, 36,28,28,36,36, /* ACELP_29k20 */
+ 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, /* ACELP_30k20 */
+ 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, /* ACELP_30k40 */
+ 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, /* ACELP_32k */
+ 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, /* ACELP_48k */
+ 12,12,12,12,12, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36, 36,36,36,36,36 /* ACELP_64k */
+};
+
+/* bit allocation table for AVQ bits in active segments (ACELP@16kHz) */
+const int16_t AVQ_bits_16kHz_tbl[] =
+{
+ /* IC GC TC0 TC64 TC128 TC192 TC256 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_8k00 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_14k80 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_22k60 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_24k40 */
+ 78, 78, 78, 78, 78, 48, 48, 48, 48, 49, 48, 49, 49, 48, 49, 50, 50, 51, 52, 52, 50, 54, 53, 54, 54, 55, 55, 55, 55, 54, 52, 56, 56, 56, 56, /* ACELP_29k00 */
+ 79, 79, 79, 79, 78, 49, 49, 49, 49, 49, 50, 49, 49, 50, 49, 52, 52, 51, 52, 52, 54, 54, 53, 54, 54, 56, 55, 55, 56, 56, 56, 56, 56, 56, 56, /* ACELP_29k20 */
+ 78, 78, 78, 78, 78, 50, 50, 50, 50, 49, 51, 50, 50, 50, 50, 53, 53, 53, 52, 52, 55, 55, 55, 54, 54, 57, 57, 56, 56, 56, 57, 57, 57, 57, 56, /* ACELP_30k20 */
+ 79, 79, 79, 79, 78, 51, 51, 51, 50, 50, 51, 51, 51, 51, 51, 54, 54, 53, 53, 53, 56, 56, 56, 55, 54, 58, 57, 57, 57, 57, 58, 58, 58, 57, 57, /* ACELP_30k40 */
+ 86, 85, 85, 85, 85, 57, 57, 57, 57, 57, 58, 58, 57, 57, 57, 60, 60, 60, 60, 59, 62, 62, 62, 62, 61, 64, 64, 64, 63, 63, 64, 64, 64, 64, 64, /* ACELP_32k */
+ 143,142,142,142,142, 116,115,115,115,115, 116,116,115,115,115, 119,119,118,118,118, 121,121,121,121,121, 124,124,123,123,123, 126,126,126,126,126, /* ACELP_48k */
+ 207,206,206,206,206, 180,179,179,179,179, 180,180,179,179,179, 183,183,182,182,182, 185,185,185,185,185, 188,188,187,187,187, 190,190,190,190,190 /* ACELP_64k */
+};
+
+/* bit allocation table for reserved bits (ACELP@12.8kHz) */
+const int16_t reserved_bits_tbl[] =
+{
+ /* UC VC GC TC0_0 TC0_64 TC0_128 TC0_192 TC64 TC128 TC192 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_5k00 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ACELP_6k15 */
+ 1, 0, 0, 0, 0, 2, 4, 0, 3, 0, /* ACELP_7k20 */
+ 14, 0, 0, 0, 0, 0, 1, 0, 0, 0, /* ACELP_8k00 */
+ 46, 0, 0, 0, 1, 2, 4, 1, 4, 0, /* ACELP_9k60 */
+ 0, 0, 0, 0, 1, 3, 6, 2, 6, 0, /* ACELP_11k60 */
+ 0, 0, 0, 0, 2, 4, 0, 3, 7, 0, /* ACELP_12k15 */
+ 0, 0, 0, 0, 1, 3, 0, 2, 0, 0, /* ACELP_12k85 */
+ 0, 0, 0, 0, 1, 4, 1, 3, 0, 0, /* ACELP_13k20 */
+ 0, 0, 0, 0, 2, 5, 2, 4, 1, 1, /* ACELP_14k80 */
+ 0, 0, 0, 0, 2, 0, 5, 5, 3, 3, /* ACELP_16k40 */
+ 0, 0, 2, 2, 0, 1, 3, 0, 0, 1, /* ACELP_22k60 */
+ 0, 0, 1, 1, 3, 8, 19, 7, 11, 11, /* ACELP_24k40 */
+};
+#else
const Word16 gain_bits_tbl[] =
{
/* UC VC GC TC0_0 TC0_64 TC0_128 TC0_192 TC64 TC128 TC192 */
@@ -292,7 +494,7 @@ const Word16 reserved_bits_tbl[] =
0, 0, 2, 2, 0, 1, 3, 0, 0, 1, /* ACELP_22k60 */
0, 0, 1, 1, 3, 8, 19, 7, 11, 11, /* ACELP_24k40 */
};
-
+#endif
/*----------------------------------------------------------------------------------*
@@ -470,9 +672,9 @@ const Word16 band_end_harm[SFM_N_HARM_FB] =
8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128,
144, 160, 176, 192, 208, 224, 256, 288, 320, 368, 416, 464, 512, 576, 640, 704, 800
};
+const Word16 min_lat_bits_SN_fx[] = { -1, -1, 17, 12, 17, 17, -1, -1, 17, 12, 17, 17, -1, -1, 22, -1, 32, 26 };
-const Word16 min_lat_bits_SN_fx[] = {-1, -1, 17, 12, 17, 17, -1, -1, 17, 12, 17, 17, -1, -1, 22, -1, 32, 26
- };
+#if 1 /*_DIFF_FLOAT_FIX_*/
const Word16 min_lat_bits_pred_fx[] = {17, 18, 9, 15, -1, 21, 17, 14, 9, 15, -1, 21, 17, -1, -1, 26, -1, 26, 16};
@@ -519,19 +721,72 @@ const Word16 offset_in_lvq_mode_pred_fx[][32] =
{0,0,0,0,0,0,1,2,3,4,5,6}, /* A 16k */
{0,0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G WB MA*/
};
+const Word16 offset_lvq_modes_SN_fx[] = { -1,-1,26,51,77,96,-1,-1,12,36,66,90,-1,-1,105,-1,88,102,112}; /* CNG */
+const Word16 offset_lvq_modes_pred_fx[] = { 74, 95, 15, 45, -1, 66, 81, 102, 0, 30, -1, 60, 88, -1, 109, 117, -1, 139, 124 };
+#else
+
+const int16_t min_lat_bits_pred_fx[] = { 17, 18, 9, 15, -1, 21, 17, 14, 9, 15, -1, 21, 17, -1, 24, 26, -1, 26, 16 };
+
+const int16_t offset_lvq_modes_SN_fx[] = { -1,-1,33,64,96, 129,-1,-1,12,43,79,109,-1,-1,137,-1,107,135,112}; /* CNG */
+
+const int16_t offset_lvq_modes_pred_fx[] = { 119, 153, 31, 67, -1, 102, 126, 160, 0, 46, -1, 82, 146, -1, 175, 191, -1, 225, 203 };
+const int16_t offset_in_lvq_mode_SN_fx[][21] =
+{
+ {0}, /* I NB */
+ {0,1,1,1,1,1,2,3,3,3,3,4,4,4,5}, /* UV NB*/
+ {0,1,1,1,1,2,3,4,5,5,6,6,7,7,7,7,7,8,8,8,9}, /* V NB */
+ {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G NB */
+ {0,1,1,1,1,2,3,4,5,5,5,6,6,6,7,8}, /* T NB */
+ {0,0,0,0,1,2,2,2,2,3,4,5}, /* A NB */
+ {0}, /* I WB */
+ {0}, /* UV WB*/
+ {1}, /* V WB */ /* granularity 1 */
+ {1}, /* G WB */ /* granularity 1 */
+ {1}, /* T WB */ /* granularity 1 */
+ {1}, /* A WB */ /* granularity 1 */
+ {0}, /* I 16k */
+ {0}, /* UV 16k */
+ {1}, /* V 16k */ /* granularity 1 */
+ {0}, /* G 16k */
+ {0,1}, /* T 16k */
+ {0}, /* A 16k */
+};
+const int16_t offset_in_lvq_mode_pred_fx[][32] =
+{
+ {0,0,0,0,1,2,2,2,3,4,5,5,5,5,5,5,5,5,5,6}, /* I NB */
+ {0,1,1,1,2,3,4,4,4,4,4,5,5,5,6}, /* UV NB */
+ {0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,3,4,4,5,6,7,8,9,10,10,11,12,13,13,13,14}, /* V NB */
+ {0,0,0,0,1,1,1,2,3,4,5,6,6,7,8,9,10,11,12,13,14}, /* G NB */
+ {0}, /* T NB */
+ {0,0,0,0,1,2,2,2,2,3,4,5}, /* A NB */
+ {1}, /* I WB */
+ {1}, /* UV WB */ /* granularity 1 */
+ {1}, /* V WB */ /* granularity 1 */
+ {1}, /* G WB */
+ {0}, /* T WB */
+ {1}, /* A WB */
+ {0,0,0,0,1,2,2,2,3,4,5,5,5,5,5,5,5,5,5,6}, /* I 16k */
+ {0}, /* UV 16k */
+ {1}, /* V 16k */
+ {1}, /* G 16k */
+ {0}, /* T 16k */
+ {1}, /* A 16k */
+ {1}, /* G WB MA*/
+};
+
+#endif
-const Word16 offset_lvq_modes_SN_fx[] = {-1,-1,26,51,77,96,-1,-1,12,36,66,90,-1,-1,105,-1,88,102,
- 112
- }; /* CNG */
-const Word16 offset_lvq_modes_pred_fx[] = {74, 95, 15, 45, -1, 66, 81, 102, 0, 30, -1, 60, 88, -1, 109, 117, -1, 139, 124};
const Word16 sfm_width[20] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 8};
const Word16 a_table_fx[20] = {8, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 7, 11};
const Word16 inner_frame_tbl[4] = {L_FRAME8k, L_FRAME16k, L_FRAME32k, L_FRAME48k}; /* corresponds to NB, WB, SWB, FB */
+//IVAS_CODE
+const Word16 l_spec_tbl[4] = { L_SPEC8k, L_SPEC16k, L_SPEC32k, L_SPEC48k }; /* corresponds to NB, WB, SWB, FB */
+const Word16 l_spec_ext_tbl[4] = { 0, L_SPEC16k_EXT, L_SPEC32k_EXT, L_SPEC48k_EXT }; /* corresponds to NB, WB, SWB, FB */
@@ -3025,7 +3280,11 @@ const Word16 CB_lsf_fx[] =
9, /* Mode 11 : AUDIO WB, Safety net */
-1, /* Mode 12 : INACTIVE WB16k, Safety net */
-1, /* Mode 13 : UNVOICED WB16k, Safety net */
+#ifdef MOD_BIT_ALLOC_ROM_TABLE
+ 14, /* Mode 14 : VOICED WB16k, Safety net */
+#else
-1, /* Mode 14 : VOICED WB16k, Safety net */
+#endif
-1, /* Mode 15 : GENERIC WB 16k, Safety net */
10, /* Mode 16 : TRANSITION WB16k, Safety net */
-1, /* Mode 17 : AUDIO WB16k, Safety net */
@@ -3048,7 +3307,11 @@ const Word16 CB_p_lsf_fx[] =
-1, /* Mode 11 : AUDIO WB, Predictive */
0, /* Mode 12 : INACTIVE WB16k, Predictive */
-1, /* Mode 13 : UNVOICED WB16k, Predictive */
+#ifdef MOD_BIT_ALLOC_ROM_TABLE
+ 11,
+#else
-1, /* Mode 14 : VOICED WB16k, Predictive */
+#endif
8, /* Mode 15 : GENERIC WB16k, Predictive */
-1, /* Mode 16 : TRANSITION WB16k, Predictive */
10, /* Mode 17 : AUDIO WB16k, Predictive */
@@ -3857,6 +4120,9 @@ const Word16 sigma_MSLVQ_fx[][16] =
};
/* An 16-by-19 matrix in Scale = 2.56f */
+#ifdef MSVQ_ROM
+PMT("sigma_p_fx and sigma_p_fx needs update")
+#endif
const Word16 sigma_p_fx[][16] =
{
{152, 164, 179, 170, 172, 176, 171, 169, 169, 174, 175, 216, 247, 304, 113, 110},
@@ -4010,7 +4276,698 @@ const Word16 CNG_details_codebook_fx[64][NUM_ENV_CNG]= /* Q6 */
{765,778,764,484,607,791,757,760,700,687,789,777,779,783,768,791,778,757,784,770},
{800,825,775,782,821,679,805,824,752,824,796,785,829,817,824,803,814,807,762,779}
};
-
+#ifdef MSVQ_ROM
+PMT ("scales, scales_p, sigma and sigma_p needs update")
+
+const Word16 leaders_short[][MAX_NO_SCALES] =
+{ { 0, 0, 0},
+{ 1, 0, 0},
+{ 15, 3, 3},
+{ 2, 2, 0},
+{ 2, 0, 0},
+{ 2, 1, 0},
+{ 4, 0, 0},
+{ 9, 7, 6},
+{ 4, 1, 0},
+{ 5, 2, 0},
+{ 6, 3, 2},
+{ 5, 3, 1},
+{ 8, 3, 0},
+{ 9, 3, 0},
+{ 2, 2, 1},
+{ 9, 8, 5},
+{ 5, 5, 0},
+{ 17, 3, 0},
+{ 5, 2, 1},
+{ 7, 3, 0},
+{ 5, 4, 0},
+{ 5, 5, 1},
+{ 2, 2, 2},
+{ 4, 2, 2},
+{ 5, 2, 2},
+{ 6, 6, 5},
+{ 5, 3, 2},
+{ 6, 3, 0},
+{ 12, 3, 2},
+{ 15, 3, 2},
+{ 19, 3, 2},
+{ 7, 6, 3},
+{ 5, 4, 2},
+{ 9, 8, 2},
+{ 6, 5, 2},
+{ 5, 4, 1},
+{ 9, 9, 3},
+{ 6, 6, 2},
+{ 8, 6, 2},
+{ 8, 7, 2},
+{ 8, 8, 2},
+{ 4, 2, 0},
+{ 11, 8, 2},
+{ 13, 11, 2},
+{ 5, 5, 2},
+{ 16, 13, 2},
+{ 13, 12, 2},
+{ 18, 17, 2},
+{ 21, 17, 2},
+{ 18, 16, 2},
+{ 32, 28, 2},
+{ 8, 8, 4},
+{ 7, 5, 2},
+{ 13, 11, 9},
+{ 38, 31, 2},
+{ 4, 4, 2},
+{ 8, 8, 3},
+{ 9, 8, 3},
+{ 8, 5, 2},
+{ 10, 9, 3},
+{ 11, 10, 3},
+{ 13, 10, 3},
+{ 22, 10, 3},
+{ 23, 10, 3},
+{ 13, 11, 3},
+{ 15, 13, 3},
+{ 35, 15, 3},
+{ 32, 16, 3},
+{ 5, 5, 4},
+{ 8, 7, 4},
+{ 33, 31, 2},
+{ 9, 9, 4},
+{ 16, 12, 4},
+{ 17, 13, 4},
+{ 5, 5, 5},
+{ 7, 5, 5},
+{ 4, 3, 2},
+{ 8, 6, 5},
+{ 9, 6, 5},
+{ 9, 7, 5},
+{ 8, 8, 5},
+{ 3, 2, 0},
+{ 10, 8, 5},
+{ 11, 8, 5},
+{ 12, 8, 5},
+{ 13, 8, 5},
+{ 16, 8, 5},
+{ 18, 8, 5},
+{ 10, 9, 5},
+{ 18, 9, 5},
+{ 23, 21, 2},
+{ 13, 8, 8},
+{ 14, 10, 5},
+{ 11, 11, 5},
+{ 13, 11, 5},
+{ 13, 13, 5},
+{ 14, 13, 5},
+{ 15, 13, 5},
+{ 16, 13, 5},
+{ 17, 13, 5},
+{ 18, 13, 5},
+{ 18, 16, 5},
+{ 18, 17, 5},
+{ 19, 18, 5},
+{ 13, 10, 5},
+{ 21, 21, 5},
+{ 23, 21, 5},
+{ 24, 21, 5},
+{ 25, 23, 5},
+{ 32, 23, 5},
+{ 11, 10, 5},
+{ 8, 8, 6},
+{ 5, 5, 7},
+{ 8, 7, 7},
+{ 8, 8, 7},
+{ 10, 8, 7},
+{ 13, 8, 7},
+{ 10, 9, 7},
+{ 13, 11, 7},
+{ 9, 8, 8},
+{ 12, 8, 8},
+{ 23, 18, 5},
+{ 9, 9, 8},
+{ 11, 9, 8},
+{ 13, 9, 8},
+{ 18, 10, 8},
+{ 26, 10, 8},
+{ 27, 10, 8},
+{ 31, 10, 8},
+{ 40, 21, 11},
+{ 13, 11, 8},
+{ 13, 12, 8},
+{ 14, 12, 8},
+{ 18, 12, 8},
+{ 13, 13, 8},
+{ 14, 13, 8},
+{ 16, 13, 8},
+{ 18, 13, 8},
+{ 18, 16, 8},
+{ 18, 17, 8},
+{ 23, 18, 8},
+{ 23, 21, 8},
+{ 24, 21, 8},
+{ 28, 23, 8},
+{ 31, 31, 8},
+{ 36, 31, 8},
+{ 38, 31, 8},
+{ 11, 9, 9},
+{ 12, 9, 9},
+{ 13, 9, 9},
+{ 12, 11, 9},
+{ 42, 31, 2},
+{ 14, 12, 9},
+{ 13, 13, 9},
+{ 14, 13, 9},
+{ 16, 13, 9},
+{ 17, 13, 9},
+{ 18, 13, 9},
+{ 18, 14, 9},
+{ 18, 18, 9},
+{ 26, 25, 9},
+{ 13, 11, 10},
+{ 18, 12, 10},
+{ 18, 13, 10},
+{ 21, 14, 10},
+{ 22, 16, 10},
+{ 18, 18, 10},
+{ 23, 18, 10},
+{ 24, 18, 10},
+{ 24, 21, 10},
+{ 23, 22, 10},
+{ 24, 23, 10},
+{ 32, 25, 10},
+{ 34, 28, 10},
+{ 42, 31, 10},
+{ 17, 11, 11},
+{ 18, 13, 11},
+{ 21, 13, 11},
+{ 18, 17, 11},
+{ 18, 18, 11},
+{ 48, 35, 24},
+{ 18, 17, 12},
+{ 18, 18, 12},
+{ 20, 18, 12},
+{ 39, 30, 12},
+{ 31, 31, 12},
+{ 43, 34, 12},
+{ 16, 13, 13},
+{ 17, 13, 13},
+{ 16, 16, 13},
+{ 18, 17, 13},
+{ 20, 18, 13},
+{ 22, 18, 13},
+{ 23, 18, 13},
+{ 22, 21, 13},
+{ 23, 23, 13},
+{ 24, 23, 13},
+{ 43, 36, 13},
+{ 43, 40, 13},
+{ 43, 41, 13},
+{ 31, 30, 18},
+{ 24, 21, 14},
+{ 31, 31, 14},
+{ 23, 18, 16},
+{ 23, 23, 16},
+{ 31, 25, 16},
+{ 31, 29, 16},
+{ 45, 35, 16},
+{ 23, 21, 17},
+{ 23, 22, 17},
+{ 23, 23, 17},
+{ 31, 31, 17},
+{ 21, 18, 18},
+{ 23, 21, 18},
+{ 23, 22, 18},
+{ 27, 23, 18},
+{ 29, 23, 18},
+{ 32, 23, 18},
+{ 31, 27, 18},
+{ 30, 28, 18},
+{ 31, 28, 18},
+{ 43, 42, 13},
+{ 31, 31, 18},
+{ 32, 31, 18},
+{ 36, 31, 18},
+{ 46, 48, 18},
+{ 46, 32, 19},
+{ 43, 38, 19},
+{ 43, 42, 19},
+{ 32, 32, 20},
+{ 27, 23, 21},
+{ 31, 23, 21},
+{ 31, 24, 21},
+{ 32, 30, 21},
+{ 32, 31, 21},
+{ 43, 33, 21},
+{ 43, 34, 21},
+{ 24, 23, 23},
+{ 32, 32, 23},
+{ 48, 40, 23},
+{ 48, 46, 23},
+{ 28, 24, 24},
+{ 32, 31, 24},
+{ 34, 32, 24},
+{ 36, 32, 24},
+{ 48, 32, 24},
+{ 35, 10, 8},
+{ 40, 28, 25},
+{ 45, 31, 25},
+{ 44, 32, 25},
+{ 31, 31, 27},
+{ 39, 32, 27},
+{ 44, 32, 27},
+{ 32, 32, 28},
+{ 43, 32, 28},
+{ 48, 32, 28},
+{ 36, 36, 28},
+{ 48, 45, 28},
+{ 40, 32, 29},
+{ 44, 34, 30},
+{ 40, 32, 31},
+{ 41, 32, 31},
+{ 42, 32, 31},
+{ 44, 43, 31},
+{ 48, 37, 32},
+{ 48, 39, 32},
+{ 46, 43, 32},
+{ 48, 48, 34},
+{ 48, 36, 35},
+{ 48, 41, 35},
+{ 47, 43, 36},
+{ 48, 48, 37},
+{ 48, 48, 40},
+{ 48, 48, 45},
+{ 48, 48, 47},
+{ 48, 48, 48} };
+
+const Word16 no_lead_idx[][2] = {
+{ 1, 1},
+{ 4, 1},
+{ 41, 1},
+{ 41, 4},
+{ 52, 32},
+{ 56, 38},
+{ 41, 1},
+{ 6, 5},
+{119, 14},
+{ 58, 18},
+{138, 21},
+{169, 40},
+{ 4, 4},
+{ 41, 1},
+{ 35, 1},
+{ 35, 4},
+{ 52, 4},
+{ 18, 8},
+{ 44, 41},
+{ 58, 6},
+{ 58, 9},
+{ 69, 26},
+{ 51, 34},
+{ 85, 34},
+{ 85, 38},
+{ 85, 42},
+{139, 40},
+{142, 33},
+{140, 64},
+{141, 73},
+{236, 124},
+{235, 133},
+{211, 160},
+{ 4, 3},
+{ 41, 1},
+{ 52, 3},
+{ 39, 3},
+{ 42, 3},
+{153, 3},
+{118, 9},
+{158, 44},
+{202, 93},
+{250, 201},
+{ 20, 0},
+{ 52, 0},
+{ 1, 1},
+{ 4, 1},
+{ 4, 4},
+{ 4, 4},
+{ 41, 1},
+{ 41, 4},
+{ 20, 4},
+{ 52, 4},
+{ 39, 4},
+{ 44, 41},
+{ 58, 6},
+{ 80, 41},
+{114, 9},
+{124, 9},
+{130, 21},
+{124, 58},
+{165, 34},
+{164, 39},
+{169, 40},
+{ 35, 0},
+{ 4, 4},
+{ 35, 1},
+{ 35, 4},
+{ 52, 4},
+{ 58, 5},
+{ 15, 5},
+{135, 3},
+{116, 41},
+{124, 24},
+{137, 24},
+{177, 26},
+{194, 44},
+{208, 52},
+{230, 58},
+{ 4, 4},
+{ 41, 1},
+{ 41, 4},
+{ 20, 4},
+{ 8, 6},
+{ 9, 8},
+{ 44, 41},
+{ 58, 6},
+{ 58, 9},
+{114, 9},
+{124, 9},
+{ 92, 21},
+{124, 58},
+{ 92, 51},
+{104, 91},
+{141, 51},
+{121, 91},
+{ 4, 3},
+{ 41, 1},
+{ 52, 3},
+{ 69, 3},
+{ 83, 3},
+{ 87, 3},
+{ 86, 44},
+{143, 74},
+{144, 112},
+{179, 78},
+{196, 78},
+{196, 78},
+{224, 78},
+{ 4, 3},
+{ 41, 1},
+{ 20, 1},
+{ 20, 4},
+{ 52, 4},
+{ 52, 3},
+{111, 5},
+{132, 4},
+{ 57, 41},
+{123, 41},
+{214, 3},
+{183, 81},
+{215, 41},
+{213, 32},
+{219, 44},
+{233, 52},
+{ 7, 52},
+{ 3, 57},
+{ 14, 59},
+{ 11, 53},
+{ 62, 0},
+{ 37, 4},
+{ 37, 3},
+{ 63, 3},
+{ 67, 3},
+{184, 3},
+{123, 41},
+{ 19, 124},
+{ 39, 4},
+{ 44, 41},
+{ 58, 6},
+{ 58, 9},
+{ 58, 44},
+{115, 32},
+{ 95, 16},
+{102, 21},
+{ 99, 38},
+{126, 58},
+{141, 57},
+{206, 56},
+{205, 120},
+{226, 124},
+{226, 133},
+{225, 182},
+{152, 3},
+{ 65, 3},
+{ 17, 14},
+{ 61, 22},
+{135, 3},
+{ 19, 11},
+{ 76, 25},
+{ 41, 36},
+{ 41, 33},
+{ 41, 7},
+{ 27, 10},
+{ 81, 15},
+{ 3, 2},
+{ 41, 36},
+{ 55, 31},
+{ 81, 7},
+};
+const Word16 no_lead_p_idx[][2] = {
+ { 5, 0},
+{ 3, 0},
+{ 41, 0},
+{ 35, 0},
+{ 52, 0},
+{ 1, 1},
+{ 4, 1},
+{ 4, 4},
+{ 3, 4},
+{ 41, 1},
+{ 41, 4},
+{ 35, 4},
+{ 52, 4},
+{ 39, 4},
+{ 44, 41},
+{ 58, 6},
+{ 80, 41},
+{ 15, 9},
+{ 94, 9},
+{110, 34},
+{ 96, 52},
+{ 98, 39},
+{105, 58},
+{107, 51},
+{105, 104},
+{109, 94},
+{145, 98},
+{207, 100},
+{239, 103},
+{240, 108},
+{207, 146},
+{ 4, 0},
+{ 41, 4},
+{ 39, 3},
+{ 94, 5},
+{ 80, 41},
+{ 94, 18},
+{ 94, 44},
+{ 96, 52},
+{106, 44},
+{121, 58},
+{107, 51},
+{199, 15},
+{197, 104},
+{198, 156},
+{221, 200},
+{ 4, 1},
+{ 3, 1},
+{ 3, 4},
+{ 41, 1},
+{ 35, 1},
+{ 35, 4},
+{ 52, 4},
+{ 39, 4},
+{ 88, 4},
+{135, 4},
+{135, 3},
+{190, 3},
+{155, 41},
+{135, 20},
+{190, 32},
+{194, 44},
+{231, 44},
+{230, 58},
+{231, 15},
+{242, 83},
+{253, 130},
+{ 4, 1},
+{ 32, 1},
+{ 58, 5},
+{ 39, 3},
+{ 43, 5},
+{ 45, 3},
+{ 48, 3},
+{ 46, 44},
+{ 49, 44},
+{ 90, 44},
+{ 50, 44},
+{ 54, 52},
+{ 70, 51},
+{151, 122},
+{151, 53},
+{ 52, 4},
+{ 39, 4},
+{ 83, 4},
+{ 89, 4},
+{ 80, 41},
+{ 85, 41},
+{100, 8},
+{101, 9},
+{ 85, 38},
+{ 85, 15},
+{195, 52},
+{234, 52},
+{217, 15},
+{254, 15},
+{251, 104},
+{ 10, 153},
+{ 18, 157},
+{ 19, 192},
+{ 19, 237},
+{ 19, 0},
+{ 52, 4},
+{153, 3},
+{159, 3},
+{171, 32},
+{185, 44},
+{186, 68},
+{ 85, 15},
+{220, 44},
+{218, 75},
+{227, 75},
+{ 1, 77},
+{228, 147},
+{ 15, 150},
+{ 18, 187},
+{ 16, 212},
+{ 16, 241},
+{ 17, 248},
+{ 4, 3},
+{ 52, 4},
+{ 52, 3},
+{161, 3},
+{166, 3},
+{149, 9},
+{247, 47},
+{178, 0},
+{ 41, 1},
+{ 20, 1},
+{ 20, 4},
+{ 52, 4},
+{ 58, 5},
+{117, 4},
+{117, 3},
+{153, 3},
+{182, 3},
+{204, 3},
+{162, 9},
+{163, 44},
+{167, 44},
+{173, 44},
+{254, 44},
+{ 12, 52},
+{254, 15},
+{ 13, 82},
+{244, 188},
+{ 3, 4},
+{ 52, 4},
+{ 58, 5},
+{153, 3},
+{190, 3},
+{209, 3},
+{243, 189},
+{ 41, 1},
+{ 20, 1},
+{ 39, 4},
+{ 88, 4},
+{ 97, 4},
+{138, 21},
+{ 6, 44},
+{ 1, 1},
+{ 4, 1},
+{ 4, 4},
+{ 5, 4},
+{ 41, 1},
+{ 41, 4},
+{ 20, 4},
+{ 52, 4},
+{ 39, 4},
+{ 83, 4},
+{135, 4},
+{ 80, 41},
+{116, 41},
+{136, 41},
+{110, 34},
+{ 13, 6},
+{113, 41},
+{114, 18},
+{ 91, 24},
+{125, 24},
+{127, 24},
+{163, 12},
+{168, 13},
+{172, 13},
+{128, 84},
+{174, 28},
+{252, 29},
+{249, 30},
+{246, 129},
+{246, 180},
+{ 9, 66},
+{110, 41},
+{155, 41},
+{154, 20},
+{158, 44},
+{203, 21},
+{232, 44},
+{210, 39},
+{223, 79},
+{222, 123},
+{229, 131},
+{238, 139},
+{238, 170},
+{ 4, 4},
+{ 4, 4},
+{ 41, 1},
+{ 20, 1},
+{ 20, 4},
+{ 52, 4},
+{ 39, 4},
+{ 88, 4},
+{135, 4},
+{ 80, 41},
+{110, 41},
+{136, 41},
+{134, 32},
+{176, 44},
+{193, 44},
+{195, 52},
+{210, 39},
+{242, 39},
+{ 6, 71},
+{ 2, 148},
+{ 4, 175},
+{ 5, 191},
+{110, 41},
+{204, 3},
+{216, 22},
+{210, 23},
+{195, 32},
+{220, 44},
+{210, 39},
+{222, 33},
+{245, 57},
+{255, 60},
+{ 8, 72},
+{ 8, 181},
+};
+#endif
const Word16 interpol_frac_mid_fx[NB_SUBFR*3] = { 16384, 16384, 0,
0, 32767, 0,
0, 16384, 16384,
@@ -4158,6 +5115,7 @@ const Word16 vals_fx[NO_LEADERS][MAX_NO_VALS]= /*Q1 */
};
/* An 6-by-128 matrix in Scale = 2048.00f */
+
const Word16 scales_fx[][6] =
{
{3129, 0, 0, 3138, 0, 0, }, /* 14 */
@@ -6640,6 +7598,24 @@ const Word16 gsc_sfm_size[MBANDS_GN] = {16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
/*GSC related */
+#ifdef MOD_BIT_ALLOC_ROM_TABLE
+const Word16 GSC_freq_bits[] =
+{
+ 21, 66, -6, 25, 15, 11, 10, 5, 0, 0, 5, 4, 0, 0, 4, 0, 0, /* ACELP_5k00*/
+ 21, 66, -6, 25, 15, 11, 10, 5, 0, 0, 5, 4, 0, 0, 4, 0, 0, /* ACELP_6k15*/
+ 21, 66, -6, 25, 15, 11, 10, 5, 0, 0, 5, 4, 0, 0, 4, 0, 0, /* ACELP_7k20*/
+ 21, 74, -4, 26, 16, 12, 11, 9, 0, 0, 4, 4, 1, 1, 3, 0, 0, /* ACELP_8k00*/
+ 26, 80, -3, 28, 18, 13, 12, 9, 0, 0, 4, 4, 1, 1, 3, 0, 0, /* ACELP_9k60*/
+ 26, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_11k60*/
+ 26, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_12k15*/
+ 26, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_12k85*/
+ 26, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_13k20*/
+ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_14k80*/
+ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_16k40*/
+ 26, 96, 0, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_22k60*/
+ 26, 96, 0, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4 /* ACELP_24k40*/
+};
+#else
const Word16 GSC_freq_bits[] =
{
21, 66, -6, 25, 15, 11, 10, 5, 0, 0, 5, 4, 0, 0, 4, 0, 0, /* ACELP_7k20*/
@@ -6649,7 +7625,7 @@ const Word16 GSC_freq_bits[] =
26, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_12k85*/
31, 96, -4, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_13k20*/
};
-
+#endif
/***IN Q2 ****/
const Word16 mfreq_loc_Q2fx[] = { 700, 1500, 3100, 4700, 6300, 7900, 9500, 11100, 12700, 14300, 15900, 17500, 19100, 20700, 22300, 25500, 28700, 31900 };
const Word16 mfreq_loc_div_25[] = {7, 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 255, 287, 319};
@@ -7320,7 +8296,23 @@ const Word16 sm_table_fx[] =
2494, 2254, 2025, 1809, 1602, 1412, 1229, 1062, 904, 760,
629, 511, 403, 308, 226, 157, 102, 56, 26, 7,
};
-
+#ifdef MOD_BIT_ALLOC_ROM_TABLE
+const Word32 GSC_freq_bits_fx[] =
+{
+ 5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_5k00*/
+ 5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_6k15*/
+ 5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_7k20*/
+ 5505024, 19660800, -1048576, 6815744, 4194304, 3145728, 2883584, 2359296, 0, 0, 1048576, 1048576, 262144, 262144, 786432, 0, 0, /* ACELP_8k00*/
+ 6815744, 20971520, -786432, 7340032, 4718592, 3407872, 3145728, 2359296, 0, 0, 1048576, 1048576, 262144, 262144, 786432, 0, 0, /* ACELP_8k00*/
+ 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_11k60*/
+ 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_12k15*/
+ 6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_12k85*/
+ 8126464, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_13k20*/ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_14k80*/
+ 8126464, 25165824, -262144, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_13k20*/ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_16k40*/
+ 8126464, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_22k60*/ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_16k40*/
+ 8126464, 25165824, 0, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_22k60*/ 26, 96, -1, 28, 18, 13, 12,10,10, 5, 4, 4, 1, 0, 1, 3, 4, /* ACELP_16k40*/
+};
+#else
const Word32 GSC_freq_bits_fx[] =
{
5505024, 17563648, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, /* ACELP_7k20*/
@@ -7330,7 +8322,7 @@ const Word32 GSC_freq_bits_fx[] =
6815744, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_12k85*/
8126464, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_13k20*/
};
-
+#endif
const Word32 pow2_fx[] =
{
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576
@@ -15108,7 +16100,7 @@ const Word16 msQeqInvAv_thresh[3] = { 328/*0.01f Q15*/, 983/*0.03f Q15*/,
const Word16 msNoiseSlopeMax[4] = { 32767/*2.f Q14*/, 26214/*1.6f Q14*/, 21299/*1.3f Q14*/, 18022/*1.1f Q14*/ };
const Word16 preemphCompensation[NB_BANDS] = { 19960/*9.7461f Q11*/, 19493/*9.5182f Q11*/, 18486/*9.0262f Q11*/, 17099/*8.3493f Q11*/, 15516/*7.5764f Q11*/, 13893/*6.7838f Q11*/, 11956/*5.8377f Q11*/, 9933/*4.8502f Q11*/, 8263/*4.0346f Q11*/, 6715/*3.2788f Q11*/, 5383/*2.6283f Q11*/, 4284/*2.0920f Q11*/, 3339/*1.6304f Q11*/, 2632/*1.2850f Q11*/, 2070/*1.0108f Q11*/, 1621/*0.7916f Q11*/, 1284/*0.6268f Q11*/, 1026/*0.5011f Q11*/, 844/*0.4119f Q11*/, 745/*0.3637f Q11*/ };
-const SCALE_SETUP scaleTable[20] =
+const SCALE_SETUP scaleTableMono[SIZE_SCALE_TABLE_MONO] =
{
{ 0, 8000, -704/*-5.5f Q7*/, 0 },
{ 8000, 9600, -640/*-5.0f Q7*/, 0 },
@@ -19552,7 +20544,7 @@ const Word16 cldfb_scale_2_5ms[7] =
/**********************************************************************/ /**
igf settings structure for each bitrate mode
**************************************************************************/
-const Word16 swb_offset_LB_new[15][IGF_MAX_SFB] =
+const Word16 swb_offset_LB_new[][IGF_MAX_SFB] =
{
/* 0: for 9600 kbs WB */
{
@@ -19590,27 +20582,35 @@ const Word16 swb_offset_LB_new[15][IGF_MAX_SFB] =
{
4, 512, 534, 576, 640
},
- /* 9: for 16400 kbs FB */
+ /* 9: for 64000 kbs SWB */
+ {
+ 4, 512, 534, 576, 640
+ },
+ /* 10: for 16400 kbs FB */
{
10, 256, 288, 328, 376, 432, 496, 576, 640, 720, 800
},
- /* 10: for 24400 kbs FB */
+ /* 11: for 24400 kbs FB */
{
11, 256, 284, 318, 358, 402, 450, 508, 576, 640, 720, 800
},
- /* 11: for 32000 kbs FB */
+ /* 12: for 32000 kbs FB */
{
11, 256, 284, 318, 358, 402, 450, 508, 576, 640, 720, 800
},
- /* 12: for 48000 kbs FB */
+ /* 13: for 48000 kbs FB */
+ {
+ 5, 512, 584, 656, 728, 800
+ },
+ /* 14: for 64000 kbs FB */
{
5, 512, 584, 656, 728, 800
},
- /* 13: for 96000 kbs FB */
+ /* 15: for 96000 kbs FB */
{
3, 640, 720, 800 /* old: 640, 760, 880 */
},
- /* 14: for 128000 kbs FB */
+ /* 16: for 128000 kbs FB */
{
3, 640, 720, 800 /* old: 640, 760, 880 */
}
@@ -19618,7 +20618,7 @@ const Word16 swb_offset_LB_new[15][IGF_MAX_SFB] =
-const Word16 igf_whitening_TH[15][2][IGF_MAX_TILES] =
+const Word16 igf_whitening_TH[][2][IGF_MAX_TILES] =
{
/* 0: for 9600 kbs WB */
{
@@ -19665,32 +20665,42 @@ const Word16 igf_whitening_TH[15][2][IGF_MAX_TILES] =
/* medium */ { 9421/*1.15f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
/* strong */ { 9748/*1.19f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
},
- /* 9: for 16400 kbs FB */
+ /* 9: for 64000 kbs SWB */
+ {
+ /* medium */ { 9421/*1.15f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 9748/*1.19f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 10: for 16400 kbs FB */
{
/* medium */ { 5161/*0.63f Q13*/, 2212/*0.27f Q13*/, 2949/*0.36f Q13*/, 0/*0.f Q13*/},
/* strong */ { 12534/*1.53f Q13*/, 10813/*1.32f Q13*/, 5489/*0.67f Q13*/, 0/*0.f Q13*/}
},
- /* 10: for 24400 kbs FB */
+ /* 11: for 24400 kbs FB */
{
/* medium */ { 6390/*0.78f Q13*/, 2540/*0.31f Q13*/, 2785/*0.34f Q13*/, 2785/*0.34f Q13*/},
/* strong */ { 12206/*1.49f Q13*/, 11305/*1.38f Q13*/, 5325/*0.65f Q13*/, 5325/*0.65f Q13*/}
},
- /* 11: for 32000 kbs FB */
+ /* 12: for 32000 kbs FB */
{
/* medium */ { 6390/*0.78f Q13*/, 2540/*0.31f Q13*/, 2785/*0.34f Q13*/, 2785/*0.34f Q13*/},
/* strong */ { 12206/*1.49f Q13*/, 11305/*1.38f Q13*/, 5325/*0.65f Q13*/, 5325/*0.65f Q13*/}
},
- /* 12: for 48000 kbs FB */
+ /* 13: for 48000 kbs FB */
+ {
+ /* medium */ { 6554/*0.80f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
+ /* strong */ { 8192/*1.00f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
+ },
+ /* 14: for 64000 kbs FB */
{
/* medium */ { 6554/*0.80f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
/* strong */ { 8192/*1.00f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
},
- /* 13: for 96000 kbs FB */
+ /* 15: for 96000 kbs FB */
{
/* medium */ { 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
/* strong */ { 23101/*2.82f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
},
- /* 14: for 128000 kbs FB */
+ /* 16: for 128000 kbs FB */
{
/* medium */ { 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/},
/* strong */ { 23101/*2.82f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/, 0/*0.f Q13*/}
@@ -19738,68 +20748,121 @@ const Word16 cf_off_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT] =
{ +0, +1, +0, +0, +3, +0, +3}
};
+
const Word16 cf_se00_tab[IGF_SYMBOLS_IN_TABLE + 1] =
{
16384, 16356, 16299, 16185, 15904, 15282, 14669, 13598, 11886, 9541, 6613, 3845, 1799, 606, 153, 32, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
};
-const Word16 cf_se01_tab[9][IGF_SYMBOLS_IN_TABLE + 1] =
-{
- {16384, 16320, 16285, 16237, 16163, 16049, 15864, 15604, 15187, 14557, 13612, 12308, 10590, 8535, 6346, 4396, 2900, 1917, 1289, 870, 593, 408, 279, 181, 122, 78, 52, 0}, /* 9.6 kbs B*/
- {16384, 16320, 16285, 16237, 16163, 16049, 15864, 15604, 15187, 14557, 13612, 12308, 10590, 8535, 6346, 4396, 2900, 1917, 1289, 870, 593, 408, 279, 181, 122, 78, 52, 0}, /* 13.2 kbs WB RF B*/
- {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 9.6 kbs SWB B*/
- {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 13.2 kbs A*/
- {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 13.2 kbs SWB RF B*/
- {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 16.4 kbs B*/
- {16384, 16369, 16356, 16337, 16311, 16268, 16197, 16073, 15876, 15544, 14977, 13987, 12327, 9908, 7017, 4393, 2545, 1446, 840, 493, 292, 183, 111, 70, 45, 31, 20, 0}, /* 24.4 kbs B*/
- {16384, 16369, 16356, 16337, 16311, 16268, 16197, 16073, 15876, 15544, 14977, 13987, 12327, 9908, 7017, 4393, 2545, 1446, 840, 493, 292, 183, 111, 70, 45, 31, 20, 0}, /* 32.0 kbs A*/
- {16384, 16368, 16355, 16334, 16291, 16212, 16071, 15816, 15359, 14523, 13014, 10534, 7345, 4272, 2228, 1149, 626, 357, 215, 139, 93, 67, 53, 43, 36, 28, 22, 0} /* 48.0 kbs B*/
-};
-
-const Word16 cf_se02_tab[4][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1] =
-{
- { /* 9.6 kbs B */
- { 16384, 16369, 16348, 16316, 16256, 16172, 16017, 15735, 15246, 14363, 13036, 11139, 8916, 6724, 4757, 3282, 2221, 1549, 1105, 771, 548, 364, 238, 151, 89, 50, 30, 0 },
-{ 16384, 16371, 16358, 16339, 16290, 16241, 16153, 16040, 15813, 15397, 14601, 13301, 11360, 8916, 6254, 3911, 2220, 1280, 755, 461, 278, 177, 111, 70, 35, 20, 12, 0 },
-{ 16384, 16375, 16359, 16333, 16286, 16243, 16154, 16024, 15771, 15380, 14712, 13537, 11742, 9425, 6872, 4378, 2327, 1197, 671, 412, 259, 145, 93, 52, 26, 13, 5, 0 },
-{ 16384, 16372, 16358, 16326, 16289, 16241, 16147, 16014, 15765, 15321, 14670, 13546, 11912, 9787, 7323, 4824, 2536, 1330, 731, 438, 258, 148, 86, 37, 22, 11, 2, 0 },
-{ 16384, 16376, 16364, 16344, 16315, 16272, 16219, 16119, 15910, 15620, 15100, 14254, 13063, 11489, 9413, 7100, 4738, 2751, 1584, 973, 597, 349, 201, 96, 47, 22, 9, 0 },
-{ 16384, 16364, 16340, 16312, 16288, 16237, 16166, 16026, 15756, 15390, 14833, 13870, 12627, 10998, 8985, 6893, 4720, 3048, 1860, 1131, 725, 449, 215, 111, 56, 34, 14, 0 },
-{ 16384, 16326, 16297, 16246, 16183, 16064, 15884, 15632, 15240, 14763, 14107, 13230, 12185, 10886, 9390, 7781, 6194, 4696, 3350, 2259, 1506, 975, 604, 356, 201, 106, 48, 0 }
- },
-
- { /* 9.6 kbs SWB B*/
- { 16384, 16359, 16349, 16331, 16300, 16236, 16112, 15894, 15480, 14691, 13257, 10996, 8168, 5357, 3193, 1864, 1098, 676, 426, 265, 173, 117, 81, 59, 45, 35, 26, 0 },
-{ 16384, 16374, 16370, 16367, 16362, 16348, 16325, 16283, 16204, 16058, 15715, 14980, 13521, 11144, 7972, 4702, 2366, 1063, 480, 241, 128, 71, 42, 22, 14, 9, 5, 0 },
-{ 16384, 16380, 16377, 16375, 16372, 16365, 16354, 16334, 16295, 16216, 16056, 15716, 15034, 13690, 11467, 8404, 5150, 2385, 908, 417, 199, 106, 62, 35, 21, 13, 7, 0 },
-{ 16384, 16378, 16376, 16373, 16368, 16360, 16346, 16318, 16267, 16173, 15991, 15644, 14932, 13623, 11575, 8688, 5224, 2309, 891, 393, 202, 103, 57, 34, 20, 11, 8, 0 },
-{ 16384, 16375, 16372, 16365, 16348, 16322, 16279, 16201, 16046, 15728, 15214, 14297, 12811, 10673, 7918, 4530, 2109, 978, 466, 234, 121, 72, 46, 31, 25, 17, 13, 0 },
-{ 16384, 16366, 16357, 16341, 16325, 16289, 16220, 16084, 15768, 15300, 14466, 13206, 11402, 9176, 6633, 4092, 2192, 1171, 592, 315, 179, 111, 74, 46, 31, 26, 18, 0 },
-{ 16384, 16301, 16266, 16211, 16140, 16045, 15889, 15652, 15358, 14883, 14192, 13119, 11753, 10181, 8445, 6708, 5023, 3449, 2226, 1375, 849, 516, 353, 231, 153, 107, 78, 0 }
- },
-
-{ /* 24.4 kbs B */
- { 16384, 16351, 16333, 16303, 16254, 16163, 15993, 15681, 15080, 13987, 12109, 9465, 6588, 4160, 2488, 1480, 912, 589, 389, 266, 190, 131, 93, 68, 47, 34, 24, 0 },
-{ 16384, 16379, 16375, 16369, 16360, 16345, 16328, 16286, 16211, 16078, 15810, 15233, 14058, 11933, 8881, 5609, 2940, 1290, 558, 274, 150, 80, 47, 29, 17, 11, 6, 0 },
-{ 16384, 16382, 16380, 16377, 16370, 16358, 16337, 16300, 16224, 16088, 15811, 15233, 14112, 12019, 9061, 5723, 2780, 1121, 480, 239, 123, 69, 41, 22, 13, 8, 5, 0 },
-{ 16384, 16377, 16375, 16369, 16363, 16351, 16325, 16268, 16172, 16009, 15686, 15039, 13830, 11799, 8924, 5422, 2444, 960, 441, 220, 111, 63, 37, 22, 11, 6, 3, 0 },
-{ 16384, 16374, 16369, 16363, 16356, 16335, 16290, 16214, 16068, 15826, 15382, 14550, 13126, 10956, 8000, 4622, 2090, 973, 478, 249, 128, 75, 42, 19, 13, 7, 4, 0 },
-{ 16384, 16375, 16370, 16367, 16362, 16340, 16298, 16232, 16097, 15860, 15440, 14718, 13570, 11874, 9557, 6790, 4053, 2166, 1150, 622, 323, 179, 96, 53, 33, 17, 12, 0 },
-{ 16384, 16335, 16304, 16276, 16228, 16166, 16094, 15983, 15775, 15501, 15040, 14417, 13552, 12326, 10847, 9117, 7308, 5373, 3666, 2297, 1336, 807, 495, 313, 216, 152, 114, 0 }
-},
-
-{ /* 48.0 kbs B */
- { 16384, 16334, 16310, 16285, 16254, 16204, 16128, 16031, 15903, 15697, 15380, 14820, 13857, 12267, 9878, 7099, 4509, 2576, 1478, 871, 531, 349, 230, 163, 111, 80, 62, 0},
- { 16384, 16337, 16327, 16307, 16278, 16239, 16178, 16092, 15947, 15719, 15286, 14428, 12833, 10246, 7123, 4088, 1896, 849, 481, 287, 190, 139, 94, 66, 52, 34, 24, 0 },
- { 16384, 16352, 16341, 16329, 16312, 16295, 16265, 16223, 16151, 16026, 15825, 15437, 14645, 13089, 10612, 7364, 4077, 1783, 779, 444, 281, 192, 138, 93, 65, 43, 30, 0 },
- { 16384, 16354, 16347, 16337, 16314, 16284, 16233, 16165, 16051, 15847, 15450, 14621, 13069, 10623, 7298, 3789, 1569, 727, 445, 302, 207, 143, 96, 59, 36, 18, 9, 0 },
- { 16384, 16352, 16342, 16330, 16314, 16295, 16266, 16215, 16127, 15984, 15709, 15190, 14242, 12540, 9979, 6448, 3160, 1392, 752, 481, 344, 251, 169, 115, 73, 28, 8, 0 },
- { 16384, 16340, 16320, 16302, 16272, 16257, 16220, 16135, 16011, 15784, 15370, 14688, 13423, 11457, 8721, 5529, 2736, 1375, 784, 525, 353, 263, 172, 113, 78, 26, 11, 0 },
- { 16384, 16238, 16170, 16113, 16077, 16030, 16000, 15948, 15873, 15752, 15535, 15157, 14595, 13788, 12569, 10767, 8611, 6186, 4101, 2459, 1478, 881, 607, 385, 243, 168, 116, 0 }
-}
-};
-
-/* only needed for >= 48 kbs */
+const Word16 cf_se01_tab[10][IGF_SYMBOLS_IN_TABLE + 1] =
+{
+ {16384, 16320, 16285, 16237, 16163, 16049, 15864, 15604, 15187, 14557, 13612, 12308, 10590, 8535, 6346, 4396, 2900, 1917, 1289, 870, 593, 408, 279, 181, 122, 78, 52, 0}, /* 9.6 kbs B*/
+ {16384, 16320, 16285, 16237, 16163, 16049, 15864, 15604, 15187, 14557, 13612, 12308, 10590, 8535, 6346, 4396, 2900, 1917, 1289, 870, 593, 408, 279, 181, 122, 78, 52, 0}, /* 13.2 kbs WB RF B*/
+ {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 9.6 kbs SWB B*/
+ {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 13.2 kbs A*/
+ {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 13.2 kbs SWB RF B*/
+ {16384, 16375, 16362, 16339, 16307, 16258, 16180, 16061, 15845, 15463, 14795, 13680, 11828, 9252, 6358, 3769, 2079, 1186, 687, 415, 242, 150, 100, 67, 44, 30, 19, 0}, /* 16.4 kbs B*/
+ {16384, 16369, 16356, 16337, 16311, 16268, 16197, 16073, 15876, 15544, 14977, 13987, 12327, 9908, 7017, 4393, 2545, 1446, 840, 493, 292, 183, 111, 70, 45, 31, 20, 0 }, /* 24.4 kbs B*/
+ {16384, 16369, 16356, 16337, 16311, 16268, 16197, 16073, 15876, 15544, 14977, 13987, 12327, 9908, 7017, 4393, 2545, 1446, 840, 493, 292, 183, 111, 70, 45, 31, 20, 0}, /* 32.0 kbs A*/
+ {16384, 16368, 16355, 16334, 16291, 16212, 16071, 15816, 15359, 14523, 13014, 10534, 7345, 4272, 2228, 1149, 626, 357, 215, 139, 93, 67, 53, 43, 36, 28, 22, 0}, /* 48.0 kbs B*/
+ {16384, 16368, 16355, 16334, 16291, 16212, 16071, 15816, 15359, 14523, 13014, 10534, 7345, 4272, 2228, 1149, 626, 357, 215, 139, 93, 67, 53, 43, 36, 28, 22, 0} /* 64.0 kbs B*/
+};
+
+const Word16 cf_se02_tab[10][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1] =
+{
+ { /* 9.6 kbs B */
+ { 16384, 16369, 16348, 16316, 16256, 16172, 16017, 15735, 15246, 14363, 13036, 11139, 8916, 6724, 4757, 3282, 2221, 1549, 1105, 771, 548, 364, 238, 151, 89, 50, 30, 0},
+ { 16384, 16371, 16358, 16339, 16290, 16241, 16153, 16040, 15813, 15397, 14601, 13301, 11360, 8916, 6254, 3911, 2220, 1280, 755, 461, 278, 177, 111, 70, 35, 20, 12, 0},
+ { 16384, 16375, 16359, 16333, 16286, 16243, 16154, 16024, 15771, 15380, 14712, 13537, 11742, 9425, 6872, 4378, 2327, 1197, 671, 412, 259, 145, 93, 52, 26, 13, 5, 0},
+ { 16384, 16372, 16358, 16326, 16289, 16241, 16147, 16014, 15765, 15321, 14670, 13546, 11912, 9787, 7323, 4824, 2536, 1330, 731, 438, 258, 148, 86, 37, 22, 11, 2, 0},
+ { 16384, 16376, 16364, 16344, 16315, 16272, 16219, 16119, 15910, 15620, 15100, 14254, 13063, 11489, 9413, 7100, 4738, 2751, 1584, 973, 597, 349, 201, 96, 47, 22, 9, 0},
+ { 16384, 16364, 16340, 16312, 16288, 16237, 16166, 16026, 15756, 15390, 14833, 13870, 12627, 10998, 8985, 6893, 4720, 3048, 1860, 1131, 725, 449, 215, 111, 56, 34, 14, 0},
+ { 16384, 16326, 16297, 16246, 16183, 16064, 15884, 15632, 15240, 14763, 14107, 13230, 12185, 10886, 9390, 7781, 6194, 4696, 3350, 2259, 1506, 975, 604, 356, 201, 106, 48, 0}
+ },
+ { /* 13.2 kbs WB RF B*/
+ { 16384, 16369, 16348, 16316, 16256, 16172, 16017, 15735, 15246, 14363, 13036, 11139, 8916, 6724, 4757, 3282, 2221, 1549, 1105, 771, 548, 364, 238, 151, 89, 50, 30, 0},
+ { 16384, 16371, 16358, 16339, 16290, 16241, 16153, 16040, 15813, 15397, 14601, 13301, 11360, 8916, 6254, 3911, 2220, 1280, 755, 461, 278, 177, 111, 70, 35, 20, 12, 0},
+ { 16384, 16375, 16359, 16333, 16286, 16243, 16154, 16024, 15771, 15380, 14712, 13537, 11742, 9425, 6872, 4378, 2327, 1197, 671, 412, 259, 145, 93, 52, 26, 13, 5, 0},
+ { 16384, 16372, 16358, 16326, 16289, 16241, 16147, 16014, 15765, 15321, 14670, 13546, 11912, 9787, 7323, 4824, 2536, 1330, 731, 438, 258, 148, 86, 37, 22, 11, 2, 0},
+ { 16384, 16376, 16364, 16344, 16315, 16272, 16219, 16119, 15910, 15620, 15100, 14254, 13063, 11489, 9413, 7100, 4738, 2751, 1584, 973, 597, 349, 201, 96, 47, 22, 9, 0},
+ { 16384, 16364, 16340, 16312, 16288, 16237, 16166, 16026, 15756, 15390, 14833, 13870, 12627, 10998, 8985, 6893, 4720, 3048, 1860, 1131, 725, 449, 215, 111, 56, 34, 14, 0},
+ { 16384, 16326, 16297, 16246, 16183, 16064, 15884, 15632, 15240, 14763, 14107, 13230, 12185, 10886, 9390, 7781, 6194, 4696, 3350, 2259, 1506, 975, 604, 356, 201, 106, 48, 0}
+ },
+ { /* 9.6 kbs SWB B*/
+ { 16384, 16359, 16349, 16331, 16300, 16236, 16112, 15894, 15480, 14691, 13257, 10996, 8168, 5357, 3193, 1864, 1098, 676, 426, 265, 173, 117, 81, 59, 45, 35, 26, 0},
+ { 16384, 16374, 16370, 16367, 16362, 16348, 16325, 16283, 16204, 16058, 15715, 14980, 13521, 11144, 7972, 4702, 2366, 1063, 480, 241, 128, 71, 42, 22, 14, 9, 5, 0},
+ { 16384, 16380, 16377, 16375, 16372, 16365, 16354, 16334, 16295, 16216, 16056, 15716, 15034, 13690, 11467, 8404, 5150, 2385, 908, 417, 199, 106, 62, 35, 21, 13, 7, 0},
+ { 16384, 16378, 16376, 16373, 16368, 16360, 16346, 16318, 16267, 16173, 15991, 15644, 14932, 13623, 11575, 8688, 5224, 2309, 891, 393, 202, 103, 57, 34, 20, 11, 8, 0},
+ { 16384, 16375, 16372, 16365, 16348, 16322, 16279, 16201, 16046, 15728, 15214, 14297, 12811, 10673, 7918, 4530, 2109, 978, 466, 234, 121, 72, 46, 31, 25, 17, 13, 0},
+ { 16384, 16366, 16357, 16341, 16325, 16289, 16220, 16084, 15768, 15300, 14466, 13206, 11402, 9176, 6633, 4092, 2192, 1171, 592, 315, 179, 111, 74, 46, 31, 26, 18, 0},
+ { 16384, 16301, 16266, 16211, 16140, 16045, 15889, 15652, 15358, 14883, 14192, 13119, 11753, 10181, 8445, 6708, 5023, 3449, 2226, 1375, 849, 516, 353, 231, 153, 107, 78, 0}
+ },
+ { /* 13.2 kbs A */
+ { 16384, 16359, 16349, 16331, 16300, 16236, 16112, 15894, 15480, 14691, 13257, 10996, 8168, 5357, 3193, 1864, 1098, 676, 426, 265, 173, 117, 81, 59, 45, 35, 26, 0},
+ { 16384, 16374, 16370, 16367, 16362, 16348, 16325, 16283, 16204, 16058, 15715, 14980, 13521, 11144, 7972, 4702, 2366, 1063, 480, 241, 128, 71, 42, 22, 14, 9, 5, 0},
+ { 16384, 16380, 16377, 16375, 16372, 16365, 16354, 16334, 16295, 16216, 16056, 15716, 15034, 13690, 11467, 8404, 5150, 2385, 908, 417, 199, 106, 62, 35, 21, 13, 7, 0},
+ { 16384, 16378, 16376, 16373, 16368, 16360, 16346, 16318, 16267, 16173, 15991, 15644, 14932, 13623, 11575, 8688, 5224, 2309, 891, 393, 202, 103, 57, 34, 20, 11, 8, 0},
+ { 16384, 16375, 16372, 16365, 16348, 16322, 16279, 16201, 16046, 15728, 15214, 14297, 12811, 10673, 7918, 4530, 2109, 978, 466, 234, 121, 72, 46, 31, 25, 17, 13, 0},
+ { 16384, 16366, 16357, 16341, 16325, 16289, 16220, 16084, 15768, 15300, 14466, 13206, 11402, 9176, 6633, 4092, 2192, 1171, 592, 315, 179, 111, 74, 46, 31, 26, 18, 0},
+ { 16384, 16301, 16266, 16211, 16140, 16045, 15889, 15652, 15358, 14883, 14192, 13119, 11753, 10181, 8445, 6708, 5023, 3449, 2226, 1375, 849, 516, 353, 231, 153, 107, 78, 0}
+ },
+ { /* 13.2 kbs SWB RF B*/
+ { 16384, 16359, 16349, 16331, 16300, 16236, 16112, 15894, 15480, 14691, 13257, 10996, 8168, 5357, 3193, 1864, 1098, 676, 426, 265, 173, 117, 81, 59, 45, 35, 26, 0},
+ { 16384, 16374, 16370, 16367, 16362, 16348, 16325, 16283, 16204, 16058, 15715, 14980, 13521, 11144, 7972, 4702, 2366, 1063, 480, 241, 128, 71, 42, 22, 14, 9, 5, 0},
+ { 16384, 16380, 16377, 16375, 16372, 16365, 16354, 16334, 16295, 16216, 16056, 15716, 15034, 13690, 11467, 8404, 5150, 2385, 908, 417, 199, 106, 62, 35, 21, 13, 7, 0},
+ { 16384, 16378, 16376, 16373, 16368, 16360, 16346, 16318, 16267, 16173, 15991, 15644, 14932, 13623, 11575, 8688, 5224, 2309, 891, 393, 202, 103, 57, 34, 20, 11, 8, 0},
+ { 16384, 16375, 16372, 16365, 16348, 16322, 16279, 16201, 16046, 15728, 15214, 14297, 12811, 10673, 7918, 4530, 2109, 978, 466, 234, 121, 72, 46, 31, 25, 17, 13, 0},
+ { 16384, 16366, 16357, 16341, 16325, 16289, 16220, 16084, 15768, 15300, 14466, 13206, 11402, 9176, 6633, 4092, 2192, 1171, 592, 315, 179, 111, 74, 46, 31, 26, 18, 0},
+ { 16384, 16301, 16266, 16211, 16140, 16045, 15889, 15652, 15358, 14883, 14192, 13119, 11753, 10181, 8445, 6708, 5023, 3449, 2226, 1375, 849, 516, 353, 231, 153, 107, 78, 0}
+ },
+ { /* 16.4 kbs B */
+ { 16384, 16359, 16349, 16331, 16300, 16236, 16112, 15894, 15480, 14691, 13257, 10996, 8168, 5357, 3193, 1864, 1098, 676, 426, 265, 173, 117, 81, 59, 45, 35, 26, 0},
+ { 16384, 16374, 16370, 16367, 16362, 16348, 16325, 16283, 16204, 16058, 15715, 14980, 13521, 11144, 7972, 4702, 2366, 1063, 480, 241, 128, 71, 42, 22, 14, 9, 5, 0},
+ { 16384, 16380, 16377, 16375, 16372, 16365, 16354, 16334, 16295, 16216, 16056, 15716, 15034, 13690, 11467, 8404, 5150, 2385, 908, 417, 199, 106, 62, 35, 21, 13, 7, 0},
+ { 16384, 16378, 16376, 16373, 16368, 16360, 16346, 16318, 16267, 16173, 15991, 15644, 14932, 13623, 11575, 8688, 5224, 2309, 891, 393, 202, 103, 57, 34, 20, 11, 8, 0},
+ { 16384, 16375, 16372, 16365, 16348, 16322, 16279, 16201, 16046, 15728, 15214, 14297, 12811, 10673, 7918, 4530, 2109, 978, 466, 234, 121, 72, 46, 31, 25, 17, 13, 0},
+ { 16384, 16366, 16357, 16341, 16325, 16289, 16220, 16084, 15768, 15300, 14466, 13206, 11402, 9176, 6633, 4092, 2192, 1171, 592, 315, 179, 111, 74, 46, 31, 26, 18, 0},
+ { 16384, 16301, 16266, 16211, 16140, 16045, 15889, 15652, 15358, 14883, 14192, 13119, 11753, 10181, 8445, 6708, 5023, 3449, 2226, 1375, 849, 516, 353, 231, 153, 107, 78, 0}
+ },
+ { /* 24.4 kbs B */
+ { 16384, 16351, 16333, 16303, 16254, 16163, 15993, 15681, 15080, 13987, 12109, 9465, 6588, 4160, 2488, 1480, 912, 589, 389, 266, 190, 131, 93, 68, 47, 34, 24, 0},
+ { 16384, 16379, 16375, 16369, 16360, 16345, 16328, 16286, 16211, 16078, 15810, 15233, 14058, 11933, 8881, 5609, 2940, 1290, 558, 274, 150, 80, 47, 29, 17, 11, 6, 0},
+ { 16384, 16382, 16380, 16377, 16370, 16358, 16337, 16300, 16224, 16088, 15811, 15233, 14112, 12019, 9061, 5723, 2780, 1121, 480, 239, 123, 69, 41, 22, 13, 8, 5, 0},
+ { 16384, 16377, 16375, 16369, 16363, 16351, 16325, 16268, 16172, 16009, 15686, 15039, 13830, 11799, 8924, 5422, 2444, 960, 441, 220, 111, 63, 37, 22, 11, 6, 3, 0},
+ { 16384, 16374, 16369, 16363, 16356, 16335, 16290, 16214, 16068, 15826, 15382, 14550, 13126, 10956, 8000, 4622, 2090, 973, 478, 249, 128, 75, 42, 19, 13, 7, 4, 0},
+ { 16384, 16375, 16370, 16367, 16362, 16340, 16298, 16232, 16097, 15860, 15440, 14718, 13570, 11874, 9557, 6790, 4053, 2166, 1150, 622, 323, 179, 96, 53, 33, 17, 12, 0},
+ { 16384, 16335, 16304, 16276, 16228, 16166, 16094, 15983, 15775, 15501, 15040, 14417, 13552, 12326, 10847, 9117, 7308, 5373, 3666, 2297, 1336, 807, 495, 313, 216, 152, 114, 0}
+ },
+ { /* 32.0 kbs A */
+ { 16384, 16351, 16333, 16303, 16254, 16163, 15993, 15681, 15080, 13987, 12109, 9465, 6588, 4160, 2488, 1480, 912, 589, 389, 266, 190, 131, 93, 68, 47, 34, 24, 0},
+ { 16384, 16379, 16375, 16369, 16360, 16345, 16328, 16286, 16211, 16078, 15810, 15233, 14058, 11933, 8881, 5609, 2940, 1290, 558, 274, 150, 80, 47, 29, 17, 11, 6, 0},
+ { 16384, 16382, 16380, 16377, 16370, 16358, 16337, 16300, 16224, 16088, 15811, 15233, 14112, 12019, 9061, 5723, 2780, 1121, 480, 239, 123, 69, 41, 22, 13, 8, 5, 0},
+ { 16384, 16377, 16375, 16369, 16363, 16351, 16325, 16268, 16172, 16009, 15686, 15039, 13830, 11799, 8924, 5422, 2444, 960, 441, 220, 111, 63, 37, 22, 11, 6, 3, 0},
+ { 16384, 16374, 16369, 16363, 16356, 16335, 16290, 16214, 16068, 15826, 15382, 14550, 13126, 10956, 8000, 4622, 2090, 973, 478, 249, 128, 75, 42, 19, 13, 7, 4, 0},
+ { 16384, 16375, 16370, 16367, 16362, 16340, 16298, 16232, 16097, 15860, 15440, 14718, 13570, 11874, 9557, 6790, 4053, 2166, 1150, 622, 323, 179, 96, 53, 33, 17, 12, 0},
+ { 16384, 16335, 16304, 16276, 16228, 16166, 16094, 15983, 15775, 15501, 15040, 14417, 13552, 12326, 10847, 9117, 7308, 5373, 3666, 2297, 1336, 807, 495, 313, 216, 152, 114, 0}
+ },
+ { /* 48.0 kbs B */
+ { 16384, 16334, 16310, 16285, 16254, 16204, 16128, 16031, 15903, 15697, 15380, 14820, 13857, 12267, 9878, 7099, 4509, 2576, 1478, 871, 531, 349, 230, 163, 111, 80, 62, 0},
+ { 16384, 16337, 16327, 16307, 16278, 16239, 16178, 16092, 15947, 15719, 15286, 14428, 12833, 10246, 7123, 4088, 1896, 849, 481, 287, 190, 139, 94, 66, 52, 34, 24, 0},
+ { 16384, 16352, 16341, 16329, 16312, 16295, 16265, 16223, 16151, 16026, 15825, 15437, 14645, 13089, 10612, 7364, 4077, 1783, 779, 444, 281, 192, 138, 93, 65, 43, 30, 0},
+ { 16384, 16354, 16347, 16337, 16314, 16284, 16233, 16165, 16051, 15847, 15450, 14621, 13069, 10623, 7298, 3789, 1569, 727, 445, 302, 207, 143, 96, 59, 36, 18, 9, 0},
+ { 16384, 16352, 16342, 16330, 16314, 16295, 16266, 16215, 16127, 15984, 15709, 15190, 14242, 12540, 9979, 6448, 3160, 1392, 752, 481, 344, 251, 169, 115, 73, 28, 8, 0},
+ { 16384, 16340, 16320, 16302, 16272, 16257, 16220, 16135, 16011, 15784, 15370, 14688, 13423, 11457, 8721, 5529, 2736, 1375, 784, 525, 353, 263, 172, 113, 78, 26, 11, 0},
+ { 16384, 16238, 16170, 16113, 16077, 16030, 16000, 15948, 15873, 15752, 15535, 15157, 14595, 13788, 12569, 10767, 8611, 6186, 4101, 2459, 1478, 881, 607, 385, 243, 168, 116, 0}
+ },
+ { /* 64.0 kbs B */
+ { 16384, 16334, 16310, 16285, 16254, 16204, 16128, 16031, 15903, 15697, 15380, 14820, 13857, 12267, 9878, 7099, 4509, 2576, 1478, 871, 531, 349, 230, 163, 111, 80, 62, 0},
+ { 16384, 16337, 16327, 16307, 16278, 16239, 16178, 16092, 15947, 15719, 15286, 14428, 12833, 10246, 7123, 4088, 1896, 849, 481, 287, 190, 139, 94, 66, 52, 34, 24, 0},
+ { 16384, 16352, 16341, 16329, 16312, 16295, 16265, 16223, 16151, 16026, 15825, 15437, 14645, 13089, 10612, 7364, 4077, 1783, 779, 444, 281, 192, 138, 93, 65, 43, 30, 0},
+ { 16384, 16354, 16347, 16337, 16314, 16284, 16233, 16165, 16051, 15847, 15450, 14621, 13069, 10623, 7298, 3789, 1569, 727, 445, 302, 207, 143, 96, 59, 36, 18, 9, 0},
+ { 16384, 16352, 16342, 16330, 16314, 16295, 16266, 16215, 16127, 15984, 15709, 15190, 14242, 12540, 9979, 6448, 3160, 1392, 752, 481, 344, 251, 169, 115, 73, 28, 8, 0},
+ { 16384, 16340, 16320, 16302, 16272, 16257, 16220, 16135, 16011, 15784, 15370, 14688, 13423, 11457, 8721, 5529, 2736, 1375, 784, 525, 353, 263, 172, 113, 78, 26, 11, 0},
+ { 16384, 16238, 16170, 16113, 16077, 16030, 16000, 15948, 15873, 15752, 15535, 15157, 14595, 13788, 12569, 10767, 8611, 6186, 4101, 2459, 1478, 881, 607, 385, 243, 168, 116, 0}
+ }
+};
+
+/* only needed for >= 48 kbps */
const Word16 cf_se10_tab[IGF_SYMBOLS_IN_TABLE + 1] =
{
@@ -19873,11 +20936,10 @@ const Word16 cf_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1]
}
};
-
/**********************************************************************/ /**
igf settings table for each bitrate mode
**************************************************************************/
-const IGF_MODE igfMode[15] =
+const IGF_MODE igfMode[] =
{
/* sampleRate, frameLength, bitRate, igfMinFq, transFac, maxHopsize */
{ 16000, 320, 9600, 774, 20480/*1.25f Q14*/, 4 }, /* 9.6kbs WB 0 */
@@ -19889,10 +20951,12 @@ const IGF_MODE igfMode[15] =
{ 32000, 640, 24400, 800, 20480/*1.25f Q14*/, 4 }, /* 24.4kbs SWB 6 */
{ 32000, 640, 32000, 800, 20480/*1.25f Q14*/, 4 }, /* 32.0kbs SWB 7 */
{ 32000, 640, 48000, 1600, 20480/*1.25f Q14*/, 4 }, /* 48.0kbs SWB 8 */
+ { 32000, 640, 64000, 1600, 20480/*1.25f Q14*/, 4 }, /* 48.0kbs SWB 8 */
{ 48000, 960, 16400, 800, 20480/*1.25f Q14*/, 4 }, /* 16.4kbs FB 9 */
{ 48000, 960, 24400, 800, 20480/*1.25f Q14*/, 2 }, /* 24.4kbs FB 10 */
{ 48000, 960, 32000, 800, 20480/*1.25f Q14*/, 2 }, /* 32.0kbs FB 11 */
{ 48000, 960, 48000, 1600, 20480/*1.25f Q14*/, 2 }, /* 48.0kbs FB 12 */
+ { 48000, 960, 64000, 1600, 20480/*1.25f Q14*/, 2 }, /* 48.0kbs FB 12 */
{ 48000, 960, 96000, 1600, 8192/*0.50f Q14*/, 1 }, /* 96.0kbs FB 13 */
{ 48000, 960, 128000, 1600, 8192/*0.50f Q14*/, 1 } /*128.0kbs FB 14 */
};
@@ -20579,7 +21643,15 @@ const Word16 grid40_fx[(GRID40_POINTS-1)/2 - 1] =
17121, 14876, 12540, 10126, 7650, 5126,
2571
};
-
+#ifdef MOD_BIT_ALLOC_ROM_TABLE
+const Word16 bit_rates_div50[] = /* bit rate values / 50 to Fit in a Word16 */
+{
+ ACELP_5k00/50, ACELP_6k15/50, ACELP_7k20/50, ACELP_8k00/50, ACELP_9k60/50, ACELP_11k60/50, ACELP_12k15/50,
+ ACELP_12k85/50, ACELP_13k20/50, ACELP_14k80/50, ACELP_16k40/50, ACELP_22k60/50,
+ ACELP_24k40/50, ACELP_29k00/50, ACELP_29k20/50, ACELP_30k20/50, ACELP_30k40/50,
+ ACELP_32k /50, ACELP_48k /50, ACELP_64k /50, HQ_96k /50, HQ_128k /50
+};
+#else
const Word16 bit_rates_div50[] = /* bit rate values / 50 to Fit in a Word16 */
{
ACELP_7k20/50, ACELP_8k00/50, ACELP_11k60/50, ACELP_12k15/50,
@@ -20587,7 +21659,7 @@ const Word16 bit_rates_div50[] = /* bit rate values / 50 to Fit in a Word16 */
ACELP_24k40/50, ACELP_29k00/50, ACELP_29k20/50, ACELP_30k20/50, ACELP_30k40/50,
ACELP_32k /50, ACELP_48k /50, ACELP_64k /50, HQ_96k /50, HQ_128k /50
};
-
+#endif
const Word16 bit_rates_16k_div50[] = /* bit rate values / 50 to Fit in a Word16 */
{
ACELP_8k00 /50, ACELP_14k80/50, ACELP_22k60/50, ACELP_24k40/50, ACELP_29k00/50,
diff --git a/lib_com/rom_com_fx.h b/lib_com/rom_com_fx.h
index 530d2dff74b3e0d299231b4694b0f27e08a18318..04d1f420539225cfb152be82d3e015095be5d80c 100644
--- a/lib_com/rom_com_fx.h
+++ b/lib_com/rom_com_fx.h
@@ -10,7 +10,8 @@
#include "stat_enc_fx.h" /* Encoder static structure */
#include "stat_dec_fx.h" /* Decoder static structure */
-
+ /* Combine coder_type, bandwidth, formant sharpening flag, and channel-aware flag into one indice */
+#define SIG2IND(ctype, bw, sf, ca_rf) ( ctype | (bw << 3) | (sf << 6) | (ca_rf << 7) )
typedef struct
{
Word32 fin_fx; /* input frequency Q0 */
@@ -23,6 +24,14 @@ typedef struct
UNS_Word16 flags_fx; /* flags from config. table Q0 */
} Resampling_cfg_fx;
+enum FUNC_GAIN_ENC
+{
+ FUNC_GAIN_ENC_MLESS = 0, /* Memory-less gain coding */
+ FUNC_GAIN_ENC_2 = 1, /* AMR-WB gains quantizer (6bits/subfr (mode 4) or 7bits/subfr (mode 5)) */ /* !!! to be removed !!! */
+ FUNC_GAIN_ENC_UV, /* UV gains quantizer (5bits/subfr) */
+ FUNC_GAIN_ENC_GACELP_UV /* UV GACELP gain quantizer ((7=5-2bits/subfr) */
+};
+
/*-----------------------------------------------------------------*
* Tables with bit-allocations
*-----------------------------------------------------------------*/
@@ -52,7 +61,9 @@ extern const Word16 crit_bins_corr_fx[];
extern const Word32 brate_tbl[SIZE_BRATE_TBL];
extern const Word32 acelp_sig_tbl[MAX_ACELP_SIG];
-
+/*IVAS_CNST_AND_ROM*/
+extern const Word32 brate_intermed_tbl[];
+/*End of IVAS_CNST_AND_ROM*/
extern const Word16 Nb[NB_SFM];
extern const Word16 LNb[ NB_SFM];
@@ -194,7 +205,11 @@ extern const Word16 inv_sigma_p_fx[][16];
extern const Word16 inv_sigma_MSLVQ_fx[][16];
extern const Word16 perm_MSLVQ_fx[][4];
extern const Word16 pl_HQ_fx[];
-
+#ifdef MSVQ_ROM
+extern const Word16 no_lead_idx[][2];
+extern const Word16 no_lead_p_idx[][2];
+extern const Word16 leaders_short[][MAX_NO_SCALES];
+#endif
/*----------------------------------------------------------------------------------*
* ISF quantization (AMR-WB IO mode)
*----------------------------------------------------------------------------------*/
@@ -428,6 +443,9 @@ extern const Word16 hp12800_48000_fx[];
extern const Word16 hp16000_48000_fx[];
extern const Word16 hp12800_16000_fx[];
extern const Word16 inner_frame_tbl_fx[];
+/* HQ spectrum length lookup tables */
+extern const Word16 l_spec_tbl[];
+extern const Word16 l_spec_ext_tbl[];
extern const Word16 EnvCdbk11_fx [];
@@ -882,7 +900,7 @@ extern const Word16 msNoiseSlopeMax[4];
extern const Word16 preemphCompensation[NB_BANDS];
#define msNoiseSlopeMax_EXP 3
-extern const SCALE_SETUP scaleTable[20];
+extern const SCALE_SETUP scaleTableMono[SIZE_SCALE_TABLE_MONO];
extern const SCALE_SETUP scaleTable_cn_only[18];
extern const Word16 scaleTable_cn_only_amrwbio[3][2];
@@ -1058,6 +1076,8 @@ extern const Word16 lsf_numbits[TCXLPC_NUMSTAGES];
extern const Word16 lsf_dims[TCXLPC_NUMSTAGES];
extern const Word16 lsf_offs[TCXLPC_NUMSTAGES];
extern const Word16 lsf_q_diff_cb_8b_rf[];
+extern const Word16 dico_lsf_abs_8b[];
+
extern const Word16 lsf_cdk_nb_gc_stg1[];
extern const Word16 lsf_cdk_nb_gc_stg2[];
extern const Word16 lsf_cdk_nb_gc_stg3[];
@@ -1166,9 +1186,9 @@ typedef struct igf_mode_type
} IGF_MODE,*H_IGF_MODE;
-extern const IGF_MODE igfMode[15];
-extern const Word16 swb_offset_LB_new[15][IGF_MAX_SFB];
-extern const Word16 igf_whitening_TH[15][2][IGF_MAX_TILES];
+extern const IGF_MODE igfMode[];
+extern const Word16 swb_offset_LB_new[][IGF_MAX_SFB];
+extern const Word16 igf_whitening_TH[][2][IGF_MAX_TILES];
extern const Word16 cf_off_se01_tab[9];
@@ -1179,8 +1199,8 @@ extern const Word16 cf_off_se02_tab[9][IGF_CTX_COUNT];
extern const Word16 cf_off_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT];
extern const Word16 cf_se00_tab[IGF_SYMBOLS_IN_TABLE + 1];
-extern const Word16 cf_se01_tab[9][IGF_SYMBOLS_IN_TABLE + 1];
-extern const Word16 cf_se02_tab[4][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1];
+extern const Word16 cf_se01_tab[][IGF_SYMBOLS_IN_TABLE + 1];
+extern const Word16 cf_se02_tab[][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1];
extern const Word16 cf_se10_tab[IGF_SYMBOLS_IN_TABLE + 1];
extern const Word16 cf_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1];
diff --git a/lib_com/scale_mem_fx.c b/lib_com/scale_mem_fx.c
index 3f24bef3bf9e46efe6bcf2448a2961d9550914f5..dce719c69472303ce7926973ca45b5f3104e0b70 100644
--- a/lib_com/scale_mem_fx.c
+++ b/lib_com/scale_mem_fx.c
@@ -164,7 +164,7 @@ void Rescale_mem(
Word16 *pst_old_syn, /* i/o: psfiler */
Word16 *pst_mem_deemp_err, /* i/o: psfiler */
Word16 *mem_agc,
- PFSTAT *pf_stat, /* i/o: All memories related to NB post filter */
+ PFSTAT_HANDLE hPFstat, /* i/o: All memories related to NB post filter */
const Word16 Vad_flag,
const Word16 Cna_flag,
const Word16 *tmp_buffer /* tmp_buffer in Q-1 */
@@ -247,9 +247,9 @@ void Rescale_mem(
Scale_sig(mem_deemph, 1, exp_scale);
Scale_sig(pst_old_syn, NBPSF_PIT_MAX, exp_scale);
Scale_sig(pst_mem_deemp_err, 1, exp_scale);
- Scale_sig(pf_stat->mem_pf_in, L_SUBFR, exp_scale); /* NB post_filter mem */
- Scale_sig(pf_stat->mem_res2, DECMEM_RES2, exp_scale); /* NB post_filter mem */
- Scale_sig(pf_stat->mem_stp, L_SUBFR, exp_scale); /* NB post_filter mem */
+ Scale_sig(hPFstat->mem_pf_in, L_SUBFR, exp_scale); /* NB post_filter mem */
+ Scale_sig(hPFstat->mem_res2, DECMEM_RES2, exp_scale); /* NB post_filter mem */
+ Scale_sig(hPFstat->mem_stp, L_SUBFR, exp_scale); /* NB post_filter mem */
Scale_sig(mem_agc, 1, exp_scale); /* NB post_filter mem */
return;
}
diff --git a/lib_com/stab_est_fx.c b/lib_com/stab_est_fx.c
index d85fe5bdb5759d26d1d400a356acd12b56ab8d4b..d853eac7935d562a92eb31386e0402a35e5c7b11 100644
--- a/lib_com/stab_est_fx.c
+++ b/lib_com/stab_est_fx.c
@@ -1,11 +1,10 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h" /* required for wmc_tool */
#include "basop_mpy.h"
/*-------------------------------------------------------------------*
@@ -40,7 +39,7 @@ Word16 stab_est_fx(
Word16 *nb_thr_1, /* i/o : Number of consecutives frames of level 1 */
Word16 *thresh, /* i/o : Detection thresold */
Word16 *last_music_flag,/* i/o : Previous music detection ouptut */
- Word16 vad_flag
+ const Word16 vad_flag /* i : VAD flag */
)
{
Word16 i, music_flag2, tmp16, exp1, exp2;
diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h
index 640bde1b1c80760008ca59e697c311cfd14a5a19..f7672db427de93605efb58b68697a6854886d2d9 100644
--- a/lib_com/stat_com.h
+++ b/lib_com/stat_com.h
@@ -5,6 +5,7 @@
#ifndef STAT_COM_H
#define STAT_COM_H
+#include
#include "options.h"
#include "basop_util.h"
#include "cnst_fx.h"
@@ -28,7 +29,7 @@ typedef struct
Word16 mem_res2[DECMEM_RES2]; /* A(gamma2) residual */
Word16 mem_zero[M]; /* null memory to compute i.r. of A(gamma2)/A(gamma1) */
Word16 gain_prec; /* for gain adjustment */
-} PFSTAT;
+} PFSTAT, * PFSTAT_HANDLE;
typedef struct
{
@@ -113,6 +114,15 @@ typedef struct
Word16 fixed_cdk_index[NB_SUBFR16k];
+ /* IVAS related parameters */
+ Word16 pitch_bits[NB_SUBFR16k];
+ Word16 lsf_bits;
+ Word16 mid_lsf_bits;
+ Word16 AVQ_cdk_bits[NB_SUBFR16k];
+ Word16 FEC_mode; /* 0 == no FEC bits; 1 == class; 2 == clas+energy; 3== class+energy+pulse */
+ Word16 ubits;
+ Word16 fcb_mode; /* 0 == mode1; 1 == mode2 */
+
} ACELP_config;
/*tns_base.h*/
@@ -134,6 +144,9 @@ typedef struct
* Upper borders for other filters is the lower border of previous filter.
*/
Word16 iFilterBorders[TNS_MAX_NUM_OF_FILTERS+1];
+#ifdef ADD_IVAS_TNS
+ Flag allowTnsOnWhite;
+#endif
} STnsConfig;
@@ -224,7 +237,7 @@ typedef struct
Word16 lfacNextFB;
/* TNS */
- Word8 fIsTNSAllowed;
+ Word16 fIsTNSAllowed;
STnsConfig tnsConfig[2][2];
STnsConfig const * pCurrentTnsConfig;
@@ -244,7 +257,8 @@ typedef struct
Word16 na_scale;
Word32 SFM2;
-} TCX_config;
+}
+TCX_config, *TCX_CONFIG_HANDLE;
/* prot.h */
typedef struct
@@ -585,16 +599,7 @@ typedef struct
} TEMPORAL_ENVELOPE_CODING_DECODER_FX;
typedef TEMPORAL_ENVELOPE_CODING_DECODER_FX* HANDLE_TEC_DEC_FX;
-typedef struct
-{
- Word16 loBuffer[CLDFB_NO_COL_MAX + MAX_TEC_SMOOTHING_DEG + DELAY_TEMP_ENV_BUFF_TEC];
- Word16 loTempEnv[CLDFB_NO_COL_MAX];
- Word16 loTempEnv_ns[CLDFB_NO_COL_MAX];
- Word16 hiTempEnv[CLDFB_NO_COL_MAX + DELAY_TEMP_ENV_BUFF_TEC + EXT_DELAY_HI_TEMP_ENV];
- Word16 tranFlag;
- Word16 corrFlag;
-} TEMPORAL_ENVELOPE_CODING_ENCODER_FX;
-typedef TEMPORAL_ENVELOPE_CODING_ENCODER_FX* HANDLE_TEC_ENC_FX;
+
typedef enum
{
@@ -669,7 +674,11 @@ typedef Word16 (*get_next_coeff_function)(
Word16 *idx, /* o : index in unmapped domain */
CONTEXT_HM_CONFIG *hm_cfg /* i : HM configuration */
);
-
+typedef enum
+{
+ LPC_ABS_QUANT_BITS = 8,
+ SNS_ABS_QUANT_BITS = 10
+} ABS_QUANT_BITS;
/*CLDFB-VAD*/
diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c
index da16a0ca3a56271ca700bb5a6eb280cf8d72e9eb..19e282ada784b09221f707156601d86ebd8d3b29 100644
--- a/lib_com/stat_noise_uv_mod_fx.c
+++ b/lib_com/stat_noise_uv_mod_fx.c
@@ -2,14 +2,14 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h" /* Compilation switches */
#include "prot_fx.h" /* Function prototypes */
#include "cnst_fx.h" /* Function prototypes */
-#include "stl.h"
/*---------------------------------------------------------------------*
- * Local constants
- *---------------------------------------------------------------------*/
+ * Local function prototypes
+ *---------------------------------------------------------------------*/
#define TILT_COMP_LIM_FX 24576 /* 0.75 in Q15 */
#define GE_SHIFT 6
@@ -29,15 +29,15 @@ Word32 L_Sqrt_Q0(const Word32 x);
*--------------------------------------------------------------------*/
void stat_noise_uv_mod_fx(
- const Word16 coder_type, /* i : Coder type */
+ const Word16 coder_type, /* i : Coder type */
Word16 noisiness, /* i : noisiness parameter */
- const Word16 *lsp_old, /* i : old LSP vector at 4th sfr */
- const Word16 *lsp_new, /* i : LSP vector at 4th sfr */
- const Word16 *lsp_mid, /* i : LSP vector at 2nd sfr */
+ const Word16 *lsp_old, /* i : old LSP vector at 4th sfr */
+ const Word16 *lsp_new, /* i : LSP vector at 4th sfr */
+ const Word16 *lsp_mid, /* i : LSP vector at 2nd sfr */
Word16 *Aq, /* o : A(z) quantized for the 4 subframes */
Word16 *exc2, /* i/o: excitation buffer */
Word16 Q_exc, /* i : Q of exc2 excitation buffer [11..-1] expected */
- const Word16 bfi , /* i : Bad frame indicator */
+ const Word16 bfi , /* i : Bad frame indicator */
Word32 *ge_sm, /* i/o: smoothed excitation gain */
Word16 *uv_count, /* i/o: unvoiced counter */
Word16 *act_count, /* i/o: activation counter */
@@ -45,8 +45,8 @@ void stat_noise_uv_mod_fx(
Word16 *noimix_seed, /* i/o: mixture seed */
Word16 *st_min_alpha, /* i/o: minimum alpha */
Word16 *exc_pe, /* i/o: scale Q_stat_noise */
- const Word32 bitrate, /* i : core bitrate */
- const Word16 bwidth_fx, /* i : input bandwidth */
+ const Word32 bitrate, /* i : core bitrate */
+ const Word16 bwidth_fx, /* i : input bandwidth */
Word16 *Q_stat_noise, /* i/o: noise scaling */
Word16 *Q_stat_noise_ge /* i/o: noise scaling */
)
@@ -334,7 +334,7 @@ void stat_noise_uv_mod_fx(
static Word16 calc_tilt_fx( /* o : Excitation tilt Q15*/
const Word16 *x, /* i : Signal input */
const Word16 Q_shift, /* i : input scaling */
- const Word16 len /* i : lenght */
+ const Word16 len /* i : length */
)
{
Word16 i;
diff --git a/lib_com/swb_bwe_com_fx.c b/lib_com/swb_bwe_com_fx.c
index d95324518efab8911dc80aa650daa697cd5806bf..0b5b286a16e2e7a45456a7a8a0fe97060f24a589 100644
--- a/lib_com/swb_bwe_com_fx.c
+++ b/lib_com/swb_bwe_com_fx.c
@@ -2,13 +2,11 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
-#include
+#include
#include "options.h"
#include "prot_fx.h"
#include "basop_util.h"
#include "rom_com_fx.h"
-#include "stl.h"
/*==========================================================================*/
@@ -39,16 +37,16 @@
Word16 WB_BWE_gain_pred_fx(
Word16 *WB_fenv, /* o : WB frequency envelopes */
- const Word16 *core_dec_freq, /* i : Frequency domain core decoded signal */
- const Word16 coder_type, /* i : coding type */
+ const Word16 *core_dec_freq, /* i : Frequency domain core decoded signal */
+ const Word16 coder_type, /* i : coding type */
Word16 prev_coder_type, /* i : coding type of last frame */
Word16 prev_WB_fenv, /* i : envelope for last frame */
Word16 *voice_factors, /* i : voicing factors //Q15 */
- const Word16 pitch_buf[], /* i : pitch buffer //Q6 */
+ const Word16 pitch_buf[], /* i : pitch buffer //Q6 */
Word32 last_core_brate, /* i : previous frame core bitrate */
- Word16 last_wb_bwe_ener , /* i : previous frame wb bwe signal energy */
- Word16 Q_syn
- ,Word16 last_extl_fx,
+ Word16 last_wb_bwe_ener, /* i : previous frame wb bwe signal energy */
+ Word16 Q_syn, /* i : synthesis scaling */
+ Word16 last_extl_fx, /* i : extl. layer for last frame */
Word16 tilt_wb_fx
)
{
@@ -305,13 +303,13 @@ Word16 WB_BWE_gain_pred_fx(
*-------------------------------------------------------------------*/
static
void calc_norm_envelop_lf_fx(
- const Word32 SWB_signal[], /* i : SWB spectrum */ /* Q12 */
- Word32 *envelope, /* o : normalized envelope */ /* Q12 */
- Word16 *L_swb_norm, /* i/o : length of envelope */
- const Word16 HQ_mode, /* i : HQ mode */ /* Q0 */
- const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic */ /* Q0 */
- Word16 *sfreq, /* i : starting frequency index */
- Word16 *efreq /* i : ending frequency index */
+ const Word32 SWB_signal[], /* i : SWB spectrum */ /* Q12 */
+ Word32 *envelope, /* o : normalized envelope */ /* Q12 */
+ Word16 *L_swb_norm, /* i/o : length of envelope */
+ const Word16 HQ_mode, /* i : HQ mode */ /* Q0 */
+ const Word16 hq_generic_offset, /* i : frequency offset for representing hq generic */ /* Q0 */
+ Word16 *sfreq, /* i : starting frequency index */
+ Word16 *efreq /* i : ending frequency index */
)
{
Word16 lookback, env_index, n_freq, n_lag_now, n_lag;
@@ -384,14 +382,18 @@ void calc_norm_envelop_lf_fx(
return;
}
+/*-------------------------------------------------------------------*
+ * calc_normal_length()
+ *
+ *-------------------------------------------------------------------*/
void calc_normal_length_fx(
- const Word16 core, /* i : core */
- const Word16 *sp, /* i : input signal */
- const Word16 mode, /* i : input mode */
- const Word16 extl, /* i : extension layer */
- Word16 *L_swb_norm, /* o : normalize length */
- Word16 *prev_L_swb_norm, /*i/o : last normalize length */
+ const Word16 core, /* i : core */
+ const Word16 *sp, /* i : input signal */
+ const Word16 mode, /* i : input mode */
+ const Word16 extl, /* i : extension layer */
+ Word16 *L_swb_norm, /* o : normalize length */
+ Word16 *prev_L_swb_norm, /*i/o : last normalize length */
Word16 Q_syn
)
{
@@ -508,7 +510,13 @@ void calc_normal_length_fx(
return;
}
-Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 */
+/*-------------------------------------------------------------------*
+ * calc_tilt_bwe()
+ *
+ * calculate tilt parameter
+ *-------------------------------------------------------------------*/
+
+Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 */
const Word16 *sp, /* i : input signal */
const Word16 exp_sp, /* i : Exp of inp signal */
const Word16 N /* i : signal length */
@@ -595,12 +603,18 @@ Word32 calc_tilt_bwe_fx( /* o : Tilt in Q24 */
return L_temp;
}
+/*-------------------------------------------------------------------*
+ * calc_norm_envelop()
+ *
+ * calculate normalized parameter
+ *-------------------------------------------------------------------*/
+
void calc_norm_envelop_fx(
- const Word16 SWB_signal[], /* i : SWB spectrum Q_syn*/
- Word32 *envelope, /* o : normalized envelope Q_syn*/
- const Word16 L_swb_norm, /* i : length of envelope Q0 */
- const Word16 SWB_flength, /* i : Length of input/output */
- const Word16 st_offset /* i : offset */
+ const Word16 SWB_signal[], /* i : SWB spectrum Q_syn*/
+ Word32 *envelope, /* o : normalized envelope Q_syn*/
+ const Word16 L_swb_norm, /* i : length of envelope Q0 */
+ const Word16 SWB_flength, /* i : Length of input/output */
+ const Word16 st_offset /* i : offset */
)
{
Word16 i, lookback, env_index, n_freq, n_lag_now, n_lag, tmp;
@@ -681,23 +695,23 @@ void calc_norm_envelop_fx(
/* CALLED FROM : */
/*==========================================================================*/
void WB_BWE_decoding_fx(
- const Word16 *core_dec_freq, /* i : Frequency domain core decoded signal */
- Word16 *WB_fenv, /* i : WB frequency envelopes */
- Word32 *WB_signal_32, /* o : WB signal in MDCT domain */
- const Word16 WB_flength, /* i : Length of input/output */
- const Word16 mode, /* i : classification for WB signal */
- const Word16 last_extl, /* i : extl. layer for last frame */
- Word32 *prev_Energy, /* i/o: energy for last frame */
- Word16 *prev_WB_fenv, /* i/o: envelope for last frame */
- Word16 *prev_L_wb_norm, /* i/o: length for last frame wb norm */
- const Word16 extl, /* i : extension layer */
- const Word16 coder_type, /* i : coding type */
- const Word32 total_brate, /* i : core layer bitrate */
- Word16 *Seed, /* i/o: random generator seed */
- Word16 *prev_flag, /* i/o: attenu flag of last frame */
- Word16 prev_coder_type , /* i : coding type of last frame */
+ const Word16 *core_dec_freq,/* i : Frequency domain core decoded signal */
+ Word16 *WB_fenv, /* i : WB frequency envelopes */
+ Word32 *WB_signal_32, /* o : WB signal in MDCT domain */
+ const Word16 WB_flength, /* i : Length of input/output */
+ const Word16 mode, /* i : classification for WB signal */
+ const Word16 last_extl, /* i : extl. layer for last frame */
+ Word32 *prev_Energy, /* i/o: energy for last frame */
+ Word16 *prev_WB_fenv, /* i/o: envelope for last frame */
+ Word16 *prev_L_wb_norm, /* i/o: length for last frame wb norm */
+ const Word16 extl, /* i : extension layer */
+ const Word16 coder_type, /* i : coding type */
+ const Word32 total_brate, /* i : core layer bitrate */
+ Word16 *Seed, /* i/o: random generator seed */
+ Word16 *prev_flag, /* i/o: attenu flag of last frame */
+ Word16 prev_coder_type , /* i : coding type of last frame */
Word16 Q_syn,
- Word16 *Q_syn_hb /*o : Q value of WB_signal_32 */
+ Word16 *Q_syn_hb /*o : Q value of WB_signal_32 */
)
{
Word16 n_freq, n_band;
@@ -919,7 +933,7 @@ void WB_BWE_decoding_fx(
test();
test();
test();
- IF( EQ_16(coder_type,GENERIC)||((GT_32(EnergyL,L_shr(*prev_Energy,1))&>_32(*prev_Energy,L_shr(EnergyL,1))&&EQ_16(*prev_flag,1))))
+ IF( EQ_16(coder_type,GENERIC) || ( GT_32(EnergyL,L_shr(*prev_Energy,1)) && GT_32(*prev_Energy,L_shr(EnergyL,1)) && EQ_16(*prev_flag,1) ))
{
WB_fenv[0] = shr( WB_fenv[0], 1);
move16();
@@ -1113,22 +1127,22 @@ void WB_BWE_decoding_fx(
/*--------------------------------------------------------------------------*/
void SWB_BWE_decoding_fx(
- const Word16 *core_dec_freq, /* i : Frequency domain core decoded signal */
- Word16 *SWB_fenv, /* i/o: SWB frequency envelopes */
- Word32 *SWB_signal_32, /* o : SWB signal in MDCT domain */
- const Word16 SWB_flength, /* i : Length of input/output */
- const Word16 mode, /* i : classification for SWB signal */
- Word16 *frica_flag, /* o : fricative signal flag */
- Word16 *prev_Energy, /* i/o: energy for last frame */
- Word16 *prev_SWB_fenv, /* i/o: envelope for last frame */
- Word16 *prev_L_swb_norm, /* i/o: length for last frame wb norm */
- const Word16 tilt_nb, /* i : tilt of synthesis wb signal */
- Word16 *Seed, /* i/o: random generator seed */
- const Word16 st_offset, /* i : offset value due to different core */
- Word16 *prev_weight, /* i/o: excitation weight value of last frame */
- const Word16 extl , /* i : extension layer */
+ const Word16 *core_dec_freq,/* i : Frequency domain core decoded signal */
+ Word16 *SWB_fenv, /* i/o: SWB frequency envelopes */
+ Word32 *SWB_signal_32, /* o : SWB signal in MDCT domain */
+ const Word16 SWB_flength, /* i : Length of input/output */
+ const Word16 mode, /* i : classification for SWB signal */
+ Word16 *frica_flag, /* o : fricative signal flag */
+ Word16 *prev_Energy, /* i/o: energy for last frame */
+ Word16 *prev_SWB_fenv, /* i/o: envelope for last frame */
+ Word16 *prev_L_swb_norm, /* i/o: length for last frame wb norm */
+ const Word16 tilt_nb, /* i : tilt of synthesis wb signal */
+ Word16 *Seed, /* i/o: random generator seed */
+ const Word16 st_offset, /* i : offset value due to different core */
+ Word16 *prev_weight, /* i/o: excitation weight value of last frame */
+ const Word16 extl , /* i : extension layer */
Word16 Q_syn
- ,const Word16 last_extl /* i : extension layer of last frame */
+ ,const Word16 last_extl /* i : extension layer of last frame */
)
{
Word16 n_freq, n_band, L, L_swb_norm;
@@ -1775,7 +1789,7 @@ void SWB_BWE_decoding_fx(
void time_envelop_shaping_fx(
Word16 werr[], /* i/o: SHB synthesis Q_synth*/
Word32 SWB_tenv[], /* i/o: frequency envelope Q15*/
- const Word16 L , /* i : frame length */
+ const Word16 L , /* i : frame length */
Word16 *Q_synth
)
{
@@ -1873,10 +1887,10 @@ void time_envelop_shaping_fx(
/* _ None */
/*--------------------------------------------------------------------------*/
void time_reduce_pre_echo_fx(
- const Word16 *synth, /* i : ACELP core synthesis Q_syn*/
+ const Word16 *synth, /* i : ACELP core synthesis Q_syn*/
Word16 *error, /* i/o: SHB BWE synthesis Q0*/
Word16 prev_td_energy, /* o : last td energy Q0*/
- const Word16 L, /* i : subframe length */
+ const Word16 L, /* i : subframe length */
Word16 Q_syn,
Word16 Q_synth
)
@@ -2041,12 +2055,12 @@ void time_reduce_pre_echo_fx(
*
*-------------------------------------------------------------------*/
void calc_normal_length_fx_32(
- const Word16 core, /* i : core : Q0 */
- const Word32 *sp, /* i : input signal : Q12 */
- const Word16 mode, /* i : input mode : Q0 */
- const Word16 extl, /* i : extension layer : Q0 */
- Word16 *L_swb_norm, /* o : normalize length : Q0 */
- Word16 *prev_L_swb_norm /*i/o : last normalize length : Q0 */
+ const Word16 core, /* i : core : Q0 */
+ const Word32 *sp, /* i : input signal : Q12 */
+ const Word16 mode, /* i : input mode : Q0 */
+ const Word16 extl, /* i : extension layer : Q0 */
+ Word16 *L_swb_norm, /* o : normalize length : Q0 */
+ Word16 *prev_L_swb_norm /*i/o : last normalize length : Q0 */
)
{
Word16 i, n_freq, n_band, THRES;
@@ -2219,13 +2233,13 @@ void calc_norm_envelop_fx_32(
*
*-------------------------------------------------------------------*/
void hq_generic_decoding_fx(
- const Word16 HQ_mode, /* i : HQ mode : Q0 */
+ const Word16 HQ_mode, /* i : HQ mode : Q0 */
Word32 *coeff_out1_fx, /* i/o: BWE input & temporary buffer : Q12 */
- const Word16 *hq_generic_fenv_fx, /* i : SWB frequency envelopes : Q1 */
- Word32 *coeff_out_fx, /* o : SWB signal in MDCT domain : Q12 */
- const Word16 hq_generic_offset, /* i : frequency offset for representing hq generci : Q0 */
- Word16 *prev_L_swb_norm, /* i/o: last normalize length : Q0 */
- const Word16 hq_generic_exc_clas, /* i : bwe excitation class " Q0 */
+ const Word16 *hq_generic_fenv_fx, /* i : SWB frequency envelopes : Q1 */
+ Word32 *coeff_out_fx, /* o : SWB signal in MDCT domain : Q12 */
+ const Word16 hq_generic_offset, /* i : frequency offset for representing hq generci : Q0 */
+ Word16 *prev_L_swb_norm, /* i/o: last normalize length : Q0 */
+ const Word16 hq_generic_exc_clas, /* i : bwe excitation class " Q0 */
const Word16 *R
)
{
diff --git a/lib_com/swb_bwe_com_hr_fx.c b/lib_com/swb_bwe_com_hr_fx.c
index d583717ef8d5f7d57314116443dad08f25c4d86e..681377aff713e708cc93c37b1437c7023ecd6978 100644
--- a/lib_com/swb_bwe_com_hr_fx.c
+++ b/lib_com/swb_bwe_com_hr_fx.c
@@ -2,9 +2,9 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h"
#include "prot_fx.h"
-#include "stl.h"
/*-------------------------------------------------------------------*
* swb_hr_nonzero_subband_noise_fill()
@@ -12,11 +12,11 @@
* SWB BWE HR noise filling of zero subbands
*-------------------------------------------------------------------*/
static void swb_hr_nonzero_subband_noise_fill_fx(
- const Word16 tilt_wb_fx, /* i : tilt of wideband signal */
+ const Word16 tilt_wb_fx, /* i : tilt of wideband signal */
Word16 *t_audio_fx, /* i/o: mdct spectrum */
Word16 *bwe_highrate_seed, /* i/o: seed of random noise */
- const Word16 N, /* i : length of subband */
- const Word16 Nsv, /* i : number of subband */
+ const Word16 N, /* i : length of subband */
+ const Word16 Nsv, /* i : number of subband */
Word16 Q_audio
)
{
@@ -78,15 +78,15 @@ static void swb_hr_nonzero_subband_noise_fill_fx(
* SWB BWE HR noise filling
*-------------------------------------------------------------------*/
void swb_hr_noise_fill_fx(
- const Word16 is_transient, /* i : transient flag */
- const Word16 spect_start, /* i : spectrum start point */
- const Word16 spect_end, /* i : spectrum end point */
- const Word16 tilt_wb_fx, /* i : tilt of wideband signal */
- const Word16 pitch_fx, /* i : pitch value */
- const Word16 nq[], /* i : AVQ nq index */
- Word16 Nsv, /* i : number of subband */
- Word16 *bwe_highrate_seed, /* i/o: seed of random noise */
- Word16 *t_audio_fx, /* i/o: mdct spectrum */
+ const Word16 is_transient, /* i : transient flag */
+ const Word16 spect_start, /* i : spectrum start point */
+ const Word16 spect_end, /* i : spectrum end point */
+ const Word16 tilt_wb_fx, /* i : tilt of wideband signal */
+ const Word16 pitch_fx, /* i : pitch value */
+ const Word16 nq[], /* i : AVQ nq index */
+ Word16 Nsv, /* i : number of subband */
+ Word16 *bwe_highrate_seed, /* i/o: seed of random noise */
+ Word16 *t_audio_fx, /* i/o: mdct spectrum */
Word16 Q_audio
)
{
diff --git a/lib_com/swb_bwe_com_lr_fx.c b/lib_com/swb_bwe_com_lr_fx.c
index 7a15dea326a5cfa7266852635e8921fe4ecded28..a7cc052b4c419d98a6ee9ec52b96c8aa0f2709e8 100644
--- a/lib_com/swb_bwe_com_lr_fx.c
+++ b/lib_com/swb_bwe_com_lr_fx.c
@@ -1,14 +1,11 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
-#include
+#include
#include "options.h"
#include "cnst_fx.h"
-
#include "prot_fx.h"
#include "rom_com_fx.h"
-#include "stl.h" /* required for wmc_tool */
#include "basop_mpy.h"
#include
@@ -20,7 +17,7 @@
*-------------------------------------------------------------------*/
void GetPredictedSignal_fx(
const Word16 *predBuf_fx, /* i: Q8 */
- Word32 *L_outBuf, /* o: Q9 */
+ Word32 *L_outBuf, /* o: Q9 */
const Word16 lag_fx, /* i: Q0 */
const Word16 fLen_fx, /* i: Q0 */
const Word16 lagGains_fx, /* i: Qgain */
@@ -165,7 +162,7 @@ Word16 har_est_fx(
Word16 i, j, q, k , k1, k2;
Word16 blk_end,blk_st;
- Word16 peak_pos,blk_peak_pos[30], diff_peak_pos[30], sharp, sharp1, sharp2;
+ Word16 peak_pos,blk_peak_pos[30], diff_peak_pos[30], sharp, sharp1;
Word16 min_har_pos;
Word16 blk_peak_pos_te[30];
Word16 temp;
@@ -438,8 +435,6 @@ Word16 har_est_fx(
move16();
sharp1 = 0;
move16();
- sharp2 = 0;
- move16();
k2 = 0;
move16();
@@ -463,7 +458,6 @@ Word16 har_est_fx(
}
ELSE IF ( diff_peak_pos[i] > 0 )
{
- sharp2 = add(sharp2, diff_peak_pos[i]);
k2 = add(k2, 1);
}
q = add(q, 1);
@@ -570,29 +564,27 @@ Word16 har_est_fx(
}
}
}
-
-
return blk_peak_pos_max;
}
void genhf_noise_fx(
- Word16 noise_flr_fx[], /* i : Qss smoothed non tonal */ /* sspectra_diff_fx:Qss */
- Word16 Qss, /* i : Q0 Q value */
+ const Word16 noise_flr_fx[], /* i : Qss smoothed non tonal */ /* sspectra_diff_fx:Qss */
+ const Word16 Qss, /* i : Q0 Q value */
Word32 L_xSynth_har[], /* o : QsL hf non tonal components */ /* xSynth_har:QsL */
- Word16 QsL, /* i : Q0 Q value */
- Word16 *predBuf_fx, /* i : Qss smoothed tonal compone */ /* sspectra:Qss */
- Word16 bands, /* i : Q0 total number of subbands in a frame */
- Word16 harmonic_band, /* i : Q0 Number of LF harmonic frames */
- Word16 har_freq_est2, /* i : Q0 harmonic signal parameter */
- Word16 pos_max_hfe2, /* i : Q0 last pulse in core coder */
+ const Word16 QsL, /* i : Q0 Q value */
+ const Word16 *predBuf_fx, /* i : Qss smoothed tonal compone */ /* sspectra:Qss */
+ const Word16 bands, /* i : Q0 total number of subbands in a frame */
+ const Word16 harmonic_band, /* i : Q0 Number of LF harmonic frames */
+ const Word16 har_freq_est2, /* i : Q0 harmonic signal parameter */
+ const Word16 pos_max_hfe2, /* i : Q0 last pulse in core coder */
Word16 *pul_res, /* o : Q0 pulse resolution */
GainItem_fx pk_sf_fx[], /* o : representative region */
- const Word16 fLenLow, /* i : Q0 low frequency length */
- const Word16 fLenHigh, /* i : Q0 high frequency length */
- const Word16 sbWidth[], /* i : Q0 bandwidth for high bands */
- const Word16 lagIndices[], /* i : Q0 correlation indices for most representative */
- const Word16 subband_offsets[], /* i : Q0 band offsets for HF reconstruction */
- const Word16 subband_search_offset[] /* i : Q0 most representative regions offsets in LF */
+ const Word16 fLenLow, /* i : Q0 low frequency length */
+ const Word16 fLenHigh, /* i : Q0 high frequency length */
+ const Word16 sbWidth[], /* i : Q0 bandwidth for high bands */
+ const Word16 lagIndices[], /* i : Q0 correlation indices for most representative */
+ const Word16 subband_offsets[], /* i : Q0 band offsets for HF reconstruction */
+ const Word16 subband_search_offset[]/* i : Q0 most representative regions offsets in LF */
)
{
Word16 k,j,ii,st_pos,dst_pos;
@@ -756,9 +748,9 @@ void genhf_noise_fx(
*-------------------------------------------------------------------*/
static
void SmoothSpec_fx(
- Word16 *inBuf, /* (i) : Input spectrum Q8 */
- Word16 *outBuf, /* (o) : Smoothed spectrum Q8 */
- Word16 num_subband /* (i) : subband number */
+ Word16 *inBuf, /* i : Input spectrum Q8 */
+ Word16 *outBuf, /* o : Smoothed spectrum Q8 */
+ Word16 num_subband /* i : subband number */
)
{
Word16 i, tmp;
@@ -867,11 +859,11 @@ void SmoothSpec_fx(
*-------------------------------------------------------------------*/
void SpectrumSmoothing_fx(
- const Word32 *L_inBuf, /* i : Qs Low band MDCT */
- Word16 *outBuf_fx, /* o : Qss output */
- Word16 *Qss, /* o : Q0 Q value of output vector */
- const Word16 fLen, /* i : Q0 length */
- const Word16 th_cut_fx /* i : Qss threshold of cut */
+ const Word32 *L_inBuf, /* i : Qs Low band MDCT */
+ Word16 *outBuf_fx, /* o : Qss output */
+ Word16 *Qss, /* o : Q0 Q value of output vector */
+ const Word16 fLen, /* i : Q0 length */
+ const Word16 th_cut_fx /* i : Qss threshold of cut */
)
{
/* internal variable */
@@ -1081,10 +1073,10 @@ void SpectrumSmoothing_fx(
*-------------------------------------------------------------------*/
void Get20Log10Spec_fx(
- const Word32 *L_inBuf, /* i : input Q_inBuf */ /* L_inBuf >=0, so L_abs is omitted. */
- Word16 *outBuf_fx, /* o : output Q7 */
- const Word16 fLen, /* i : loop length */
- const Word16 Q_inBuf /* i : Qvalue of L_inBuf */
+ const Word32 *L_inBuf, /* i : input Q_inBuf */ /* L_inBuf >=0, so L_abs is omitted. */
+ Word16 *outBuf_fx, /* o : output Q7 */
+ const Word16 fLen, /* i : loop length */
+ const Word16 Q_inBuf /* i : Qvalue of L_inBuf */
)
{
Word16 i;
@@ -1120,7 +1112,11 @@ void Get20Log10Spec_fx(
return;
}
-
+/*-------------------------------------------------------------------*
+ * convert_lagIndices_pls2smp()
+ *
+ *
+ *-------------------------------------------------------------------*/
void convert_lagIndices_pls2smp_fx(
Word16 lagIndices_in_fx[],
Word16 nBands_search_fx,
@@ -1162,6 +1158,11 @@ void convert_lagIndices_pls2smp_fx(
return;
}
+/*-------------------------------------------------------------------*
+ * get_usebit_npswb()
+ *
+ *
+ *-------------------------------------------------------------------*/
Word16 get_usebit_npswb_fx(
Word16 hqswb_clas_fx
)
@@ -1203,12 +1204,16 @@ Word16 get_usebit_npswb_fx(
return bits;
}
-
+/*-------------------------------------------------------------------*
+ * SpectrumSmoothing_nss()
+ *
+ *
+ *-------------------------------------------------------------------*/
void SpectrumSmoothing_nss_fx(
- const Word32 *L_inBuf, /* i : lowband MDCT */
- Word16 *outBuf_fx, /* o : output */
- Word16 *Qss, /* o : Q value of output vector */
- const Word16 fLen /* i : length */
+ const Word32 *L_inBuf, /* i : lowband MDCT */
+ Word16 *outBuf_fx, /* o : output */
+ Word16 *Qss, /* o : Q value of output vector */
+ const Word16 fLen /* i : length */
)
{
/* internal variable */
@@ -1502,7 +1507,7 @@ void SpectrumSmoothing_nss_fx(
*-------------------------------------------------------------------*/
void return_bits_normal2_fx(
- Word16 *bit_budget_fx, /* i/o : bit budget */
+ Word16 *bit_budget_fx, /* i/o : bit budget */
const Word16 p2a_flags_fx[], /* i : HF tonal indicator */
const Word16 bands_fx, /* i : Total number of Subbands in a frame */
const Word16 bits_lagIndices_fx[] /* i : bits for lagIndices */
@@ -1534,13 +1539,13 @@ void preset_hq2_swb_fx
(
const Word16 hqswb_clas_fx, /* i : HQ2 class information */
const Word16 band_end_fx[], /* i : band end of each SB */
- Word16 *har_bands_fx, /* i/o : Number of LF harmonic bands */
- Word16 p2a_bands_fx, /* i : flag for peakness */
+ Word16 *har_bands_fx, /* i/o : Number of LF harmonic bands */
+ Word16 p2a_bands_fx, /* i : flag for peakness */
const Word16 length_fx, /* i : processed band length */
const Word16 bands_fx, /* i : Total number of Subbands in a frame */
- Word16 *lowlength_fx, /* o : lowband length */
- Word16 *highlength_fx, /* o : highband length */
- Word32 L_m[] /* o : MDCT */
+ Word16 *lowlength_fx, /* o : lowband length */
+ Word16 *highlength_fx, /* o : highband length */
+ Word32 L_m[] /* o : MDCT */
)
{
IF( EQ_16(hqswb_clas_fx, HQ_HARMONIC))
@@ -1581,8 +1586,8 @@ void post_hq2_swb_fx
const Word16 p2a_flags_fx[], /* i : HF tonal indicator */
const Word16 band_start_fx[], /* i : band start of each SB */
const Word16 band_end_fx[], /* i : band end of each SB */
- Word32 L_y2[], /* o : output signal */
- Word16 npulses_fx[] /* i/o : Number of coded spectrum */
+ Word32 L_y2[], /* o : output signal */
+ Word16 npulses_fx[] /* i/o : Number of coded spectrum */
)
{
Word16 i, k;
@@ -1629,8 +1634,8 @@ void post_hq2_swb_fx
void GetSynthesizedSpecThinOut_fx(
const Word16 *predBuf_fx, /* i : Qss: prediction buffer (i.e., lowband) */
const Word16 Qss, /* i : Q value of input vector */
- Word32 *L_outBuf, /* o : QsL: synthesized spectrum */
- Word16 QsL, /* o : Q value of synthesized spectrum */
+ Word32 *L_outBuf, /* o : QsL: synthesized spectrum */
+ Word16 QsL, /* o : Q value of synthesized spectrum */
const Word16 nBands_fx, /* i : Q0: number of subbands calculated */
const Word16 *sbWidth_fx, /* i : Q0: subband lengths */
const Word16 *lagIndices_fx, /* i : Q0: lowband index for each subband */
@@ -1718,7 +1723,11 @@ Word16 div_s_ss( /* o: result of division (Word16 Q0) */
return res;
}
-
+/*-------------------------------------------------------------------*
+ * hf_parinitiz()
+ *
+ *
+ *-------------------------------------------------------------------*/
void hf_parinitiz_fx(
const Word32 L_total_brate,
const Word16 hqswb_clas_fx,
@@ -1825,8 +1834,8 @@ void GetlagGains_fx(
const Word16 *sbWidth, /* i: Q0 width of SWB subbands */
const Word16 *lagIndices, /* i: Q0 lagIndices */
const Word16 predBufLen, /* i: Q0 length of predBuf */
- Word16 *lagGains_fx, /* o: QlagGains lagGains */
- Word16 *QlagGains /* o: Q0 Q value of lagGains */
+ Word16 *lagGains_fx, /* o: QlagGains lagGains */
+ Word16 *QlagGains /* o: Q0 Q value of lagGains */
)
{
Word16 i;
@@ -1943,11 +1952,11 @@ void GetlagGains_fx(
void noise_extr_corcod_fx(
Word32 L_spectra[], /* i : QsL core coder */
- const Word32 L_spectra_ni[], /* i : QsL core coder with sparse filling */
+ const Word32 L_spectra_ni[], /* i : QsL core coder with sparse filling */
Word16 sspectra_fx[], /* o : Qss Smoothed tonal information from core coder */
Word16 sspectra_diff_fx[], /* o : Qss non tonal infomration for gap filling */
Word16 sspectra_ni_fx[], /* o : Qss smoothed core coder */
- const Word16 fLenLow_fx, /* i : Q0 low frequency bands width */
+ const Word16 fLenLow_fx, /* i : Q0 low frequency bands width */
Word16 prev_hqswb_clas_fx, /* i : Q0 classification information */
Word16 *prev_ni_ratio_fx, /* i : Q15 noise parameter */
Word16 *Qss /* o : Q0 Q value for sspectra_*_fx */
@@ -2091,23 +2100,23 @@ void noise_extr_corcod_fx(
*--------------------------------------------------------------------------*/
void ton_ene_est_fx(
- Word32 L_xSynth_har[], /* i : QsL buffer with non tonal compoents */
- Word16 QsL, /* i : Q0 Q value for xSynth_har */
+ Word32 L_xSynth_har[], /* i/o: QsL buffer with non tonal compoents */
+ const Word16 QsL, /* i : Q0 Q value for xSynth_har */
Word32 L_be_tonal[], /* o : QbeL tonal energy of the missing bands */
Word16 *QbeL, /* o : Q0 Q value for be_tonal */
- Word32 L_band_energy[], /* i : Qbe subband energies */
- Word16 Qbe, /* i : Q0 Q value for band_energy */
- const Word16 band_start[], /* i : Q0 subband start indices */
- const Word16 band_end[], /* i : Q0 subband end indices */
- const Word16 band_width[], /* i : Q0 subband widths */
- const Word16 fLenLow, /* i : Q0 low frequency width */
- const Word16 fLenHigh, /* i : Q0 High frequency width */
- Word16 bands, /* i : Q0 total subbands */
- Word16 har_bands, /* i : Q0 total number of harmonics bands */
- Word16 ni_lvl_fx, /* i : Q11 noise enve for the hf bands */
- GainItem_fx pk_sf_fx[], /* i : */
- Word16 Qss, /* i : Q0 Q value for GainItem_fx->nmrValue */
- Word16 *pul_res /* i : Q0 tonal resolution */
+ const Word32 L_band_energy[], /* i : Qbe subband energies */
+ const Word16 Qbe, /* i : Q0 Q value for band_energy */
+ const Word16 band_start[], /* i : Q0 subband start indices */
+ const Word16 band_end[], /* i : Q0 subband end indices */
+ const Word16 band_width[], /* i : Q0 subband widths */
+ const Word16 fLenLow, /* i : Q0 low frequency width */
+ const Word16 fLenHigh, /* i : Q0 High frequency width */
+ const Word16 bands, /* i : Q0 total subbands */
+ const Word16 har_bands, /* i : Q0 total number of harmonics bands */
+ const Word16 ni_lvl_fx, /* i : Q11 noise enve for the hf bands */
+ GainItem_fx pk_sf_fx[], /* i : */
+ const Word16 Qss, /* i : Q0 Q value for GainItem_fx->nmrValue */
+ const Word16 *pul_res /* i : Q0 tonal resolution */
)
{
Word16 i, j, k;
@@ -2360,19 +2369,19 @@ void Gettonl_scalfact_fx
(
Word32 *L_outBuf, /* i/o: QsL synthesized spectrum */
Word16 QsL, /* i : Q0 Q value for outBuf */
- const Word32 *L_codbuf, /* i : QsL core coder */
- const Word16 fLenLow, /* i : Q0 lowband length */
- const Word16 fLenHigh, /* i : Q0 highband length */
- const Word16 harmonic_band, /* i : Q0 total number of Low frequency bands */
- const Word16 bands, /* i : Q0 total number of subbands in a frame */
+ const Word32 *L_codbuf, /* i : QsL core coder */
+ const Word16 fLenLow, /* i : Q0 lowband length */
+ const Word16 fLenHigh, /* i : Q0 highband length */
+ const Word16 harmonic_band, /* i : Q0 total number of Low frequency bands */
+ const Word16 bands, /* i : Q0 total number of subbands in a frame */
Word32 *L_band_energy, /* i : Qbe band energy of each subband */
Word16 Qbe, /* i : Q0 Q value for band_energy */
- const Word16 *band_start, /* i : Q0 subband start indices */
- const Word16 *band_end, /* i : Q0 subband end indices */
- const Word16 p2aflags[], /* i : Q0 missing bands in the core coder */
+ const Word16 *band_start, /* i : Q0 subband start indices */
+ const Word16 *band_end, /* i : Q0 subband end indices */
+ const Word16 p2aflags[], /* i : Q0 missing bands in the core coder */
Word32 L_be_tonal[], /* i : QbeL tonal energy */
Word16 QbeL, /* i : Q0 Q value for be_tonal */
- GainItem_fx *pk_sf_fx, /* i : toanl information for Sparse filling */
+ GainItem_fx *pk_sf_fx, /* i : toanl information for Sparse filling */
Word16 Qss, /* i : Q0 Q value for pk_sf.nmrValue */
Word16 *pul_res_pk /* i : Q0 pulse resolution information */
)
@@ -2647,8 +2656,8 @@ void get_sigma_fx_har(
const Word16 avg_fx, /* i: Qavg average of x_abs */
const Word16 Qavg, /* i: Q0 Q value of avg */
const Word16 length_fx, /* i: Q0 length */
- Word16 *sigma_fx, /* o: Qsigma sigma */
- Word16 *Qsigma /* o: Q0 Q value of sigma */
+ Word16 *sigma_fx, /* o: Qsigma sigma */
+ Word16 *Qsigma /* o: Q0 Q value of sigma */
)
{
Word16 i;
@@ -2749,12 +2758,12 @@ void get_sigma_fx_har(
}
void FindNBiggest2_simple_fx_har(
- const Word32 *L_inBuf, /* i : input buffer (searched) */
- const Word16 Qabs_in, /* i : Q value of input buffer */
- GainItem_fx *pk_sf_fx, /* o : N biggest components found */
- const Word16 nIdx_fx, /* i : search length */
- Word16 *n_fx, /* i : number of components searched (N biggest) */
- Word16 n_nbiggestsearch /* i : */
+ const Word32 *L_inBuf, /* i : input buffer (searched) */
+ const Word16 Qabs_in, /* i : Q value of input buffer */
+ GainItem_fx *pk_sf_fx, /* o : N biggest components found */
+ const Word16 nIdx_fx, /* i : search length */
+ Word16 *n_fx, /* i : number of components searched (N biggest) */
+ Word16 n_nbiggestsearch /* i : */
)
{
Word16 j;
@@ -2915,16 +2924,16 @@ void FindNBiggest2_simple_fx_har(
* spectrumsmooth_noiseton()
* Spectrum normalization for the the core coder
*--------------------------------------------------------------------------*/
-Word16 spectrumsmooth_noiseton_fx( /* o : Qss ss_min */
- Word32 L_spectra[], /* i : Qs core coder */
- /*Word16 Qs,*/ /* i : Q0 Q value for spectra, spectra_ni */
- const Word32 L_spectra_ni[], /* i : Qs core coder with sparse filling */
- Word16 sspectra_fx[], /* o : Qss Smoothed tonal information from core coder */
- Word16 sspectra_diff_fx[], /* o : Qss non tonal infomration for gap filling */
- Word16 sspectra_ni_fx[], /* o : Qss smoothed core coder */
- Word16 *Qss, /* o : Q0 Q value for sspectra* */
- const Word16 fLenLow_fx, /* i : Q0 low frequency boundaries */
- Word16 *ni_seed_fx /* io : Q0 random seed */
+Word16 spectrumsmooth_noiseton_fx( /* o : Qss ss_min */
+ Word32 L_spectra[], /* i : Qs core coder */
+ /*Word16 Qs,*/ /* i : Q0 Q value for spectra, spectra_ni */
+ const Word32 L_spectra_ni[], /* i : Qs core coder with sparse filling */
+ Word16 sspectra_fx[], /* o : Qss Smoothed tonal information from core coder */
+ Word16 sspectra_diff_fx[], /* o : Qss non tonal infomration for gap filling */
+ Word16 sspectra_ni_fx[], /* o : Qss smoothed core coder */
+ Word16 *Qss, /* o : Q0 Q value for sspectra* */
+ const Word16 fLenLow_fx, /* i : Q0 low frequency boundaries */
+ Word16 *ni_seed_fx /* io : Q0 random seed */
)
{
Word16 i;
@@ -3067,12 +3076,12 @@ void noiseinj_hf_fx(
Word32 L_band_energy[], /* i : Qbe subband energies */
Word16 Qbe, /* i : Q0 Q value for band_energy */
Word16 *prev_En_sb_fx, /* i/o : QsEn smoothed sqrt band Energies */
- const Word16 p2a_flags_fx[], /* i : Q0 Missing bands in the core coder */
- const Word16 BANDS_fx, /* i : Q0 total bands */
- const Word16 band_start_fx[], /* i : Q0 band start indices */
- const Word16 band_end_fx[], /* i : Q0 band end indices */
- const Word16 fLenLow_fx, /* i : Q0 low frequency bandwidth */
- const Word16 fLenHigh_fx /* i : Q0 SWB frequency bandwidth */
+ const Word16 p2a_flags_fx[], /* i : Q0 Missing bands in the core coder */
+ const Word16 BANDS_fx, /* i : Q0 total bands */
+ const Word16 band_start_fx[], /* i : Q0 band start indices */
+ const Word16 band_end_fx[], /* i : Q0 band end indices */
+ const Word16 fLenLow_fx, /* i : Q0 low frequency bandwidth */
+ const Word16 fLenHigh_fx /* i : Q0 SWB frequency bandwidth */
)
{
Word16 k,i;
@@ -3245,10 +3254,10 @@ void updat_prev_frm_fx(
Word32 L_t_audio[], /* o: core coder buffer */
Word32 L_bwe_br, /* i: core bitrate */
Word16 length_fx, /* i: frame length coded bw */
- const Word16 inner_frame_fx, /* i: input frame length */
+ const Word16 inner_frame_fx, /* i: input frame length */
Word16 bands_fx, /* i: sub band resolution */
Word16 bwidth_fx, /* i: NB/WB/SWB indicator */
- const Word16 is_transient_fx, /* i: signal class information */
+ const Word16 is_transient_fx, /* i: signal class information */
Word16 hqswb_clas_fx, /* i: signal class information */
Word16 *prev_hqswb_clas_fx, /* o: update signal class information */
Word16 prev_SWB_peak_pos_fx[], /* o: update core coder last coded peaks*/
diff --git a/lib_com/swb_tbe_com_fx.c b/lib_com/swb_tbe_com_fx.c
index 1e6fa69b6a218f625d8bcd52171cb6a4e0b81728..fc74e1abe30dc74e00ed6046800ce41e9dc74dcd 100644
--- a/lib_com/swb_tbe_com_fx.c
+++ b/lib_com/swb_tbe_com_fx.c
@@ -3,28 +3,22 @@
====================================================================================*/
-#include
+#include
#include "options.h"
#include "cnst_fx.h"
#include "prot_fx.h"
#include "rom_com_fx.h"
-#include "stl.h"
#include "basop_util.h"
/*-----------------------------------------------------------------*
-* Local functions
+* Local function prototypes
*-----------------------------------------------------------------*/
static void create_random_vector_fx( Word16 output[], const Word16 length, Word16 seed[] );
-
static void flip_spectrum_fx( const Word16 input[], Word16 output[], const Word16 length );
-
static void Calc_st_filt_tbe(Word16 * apond2,Word16 * apond1,Word16 * parcor0,Word16 * sig_ltp_ptr,Word16 * mem_zero );
-
static void Hilbert_transform_fx( Word32 tmp_R[], Word32 tmp_I[], Word32 *tmpi_R, Word32 *tmpi_I, const Word16 length, const Word16 HB_stage_id );
-
static void Hilbert_transform_sp_fx( Word16 tmp_R[], Word16 tmp_I[], Word32 *tmpi_R, Word32 *tmpi_I, const Word16 length, const Word16 HB_stage_id );
-
void Estimate_mix_factors_fx( const Word16 *shb_res, const Word16 Q_shb, const Word16 *exc16kWhtnd, const Word16 Q_bwe_exc, const Word16 *White_exc16k_frac,
const Word16 Q_frac, const Word32 pow1, const Word16 Q_pow1, const Word32 pow22, const Word16 Q_pow22, Word16 *vf_modified, Word16 *vf_ind );
@@ -34,7 +28,6 @@ void Estimate_mix_factors_fx( const Word16 *shb_res, const Word16 Q_shb, const W
* Reset the SWB TBE encoder
*-------------------------------------------------------------------*/
-
void swb_tbe_reset_fx(
Word32 mem_csfilt[],
Word16 mem_genSHBexc_filt_down_shb[],
@@ -249,13 +242,15 @@ void tbe_celp_exc(
/* RETURN ARGUMENTS : */
/* _ None */
/*---------------------------------------------------------------------------*/
-void flip_and_downmix_generic_fx( Word16 input[], /* i : input spectrum Qx*/
- Word16 output[], /* o : output spectrum Qx*/
- const Word16 length, /* i : length of spectra */
- Word32 mem1_ext[HILBERT_ORDER1], /* i/o: memory Qx+16*/
- Word32 mem2_ext[2*HILBERT_ORDER2], /* i/o: memory Qx+16*/
- Word32 mem3_ext[2*HILBERT_ORDER2], /* i/o: memory Qx+16*/
- Word16* phase_state /* i/o: Phase state in case frequency isn't multiple of 50 Hz */ )
+void flip_and_downmix_generic_fx(
+ Word16 input[], /* i : input spectrum Qx*/
+ Word16 output[], /* o : output spectrum Qx*/
+ const Word16 length, /* i : length of spectra */
+ Word32 mem1_ext[HILBERT_ORDER1], /* i/o: memory Qx+16*/
+ Word32 mem2_ext[2*HILBERT_ORDER2], /* i/o: memory Qx+16*/
+ Word32 mem3_ext[2*HILBERT_ORDER2], /* i/o: memory Qx+16*/
+ Word16* phase_state /* i/o: Phase state in case frequency isn't multiple of 50 Hz */
+)
{
Word16 i, j;
Word16 tmp_16[L_FRAME32k + HILBERT_ORDER1];
@@ -388,13 +383,14 @@ void flip_and_downmix_generic_fx( Word16 input[], /* i : input spectrum Qx*/
/*----------------------------------------------
* Hilbert transform - Double precision
*------------------------------------------------*/
-static void Hilbert_transform_fx( Word32 tmp_R[], /* i: Real component of HB */
- Word32 tmp_I[], /* i: Real component of HB */
- Word32 tmpi_R[], /* o: Real component of HB */
- Word32 tmpi_I[], /* o: Imag. component of HB */
- const Word16 length, /* i: input length */
- const Word16 HB_stage_id /* i: HB transform stage */
- )
+static void Hilbert_transform_fx(
+ Word32 tmp_R[], /* i: Real component of HB */
+ Word32 tmp_I[], /* i: Real component of HB */
+ Word32 tmpi_R[], /* o: Real component of HB */
+ Word32 tmpi_I[], /* o: Imag. component of HB */
+ const Word16 length, /* i: input length */
+ const Word16 HB_stage_id /* i: HB transform stage */
+)
{
Word16 i, hb_filter_stage, offset;
Word32 L_tmp;
@@ -449,13 +445,14 @@ static void Hilbert_transform_fx( Word32 tmp_R[], /* i: Real compon
/*----------------------------------------------
* Hilbert transform - Single precision Stage 0
*------------------------------------------------*/
-static void Hilbert_transform_sp_fx( Word16 tmp_R[], /* i: Real component of HB */
- Word16 tmp_I[], /* i: Real component of HB */
- Word32 tmpi_R[], /* o: Real component of HB */
- Word32 tmpi_I[], /* o: Imag. component of HB */
- const Word16 length, /* i: input length */
- const Word16 HB_stage_id /* i: HB transform stage */
- )
+static void Hilbert_transform_sp_fx(
+ Word16 tmp_R[], /* i: Real component of HB */
+ Word16 tmp_I[], /* i: Real component of HB */
+ Word32 tmpi_R[], /* o: Real component of HB */
+ Word32 tmpi_I[], /* o: Imag. component of HB */
+ const Word16 length, /* i: input length */
+ const Word16 HB_stage_id /* i: HB transform stage */
+)
{
Word16 i, hb_filter_stage, offset;
Word32 L_tmp;
@@ -493,9 +490,9 @@ static void Hilbert_transform_sp_fx( Word16 tmp_R[], /* i: Real com
* flip_spectrum_fx
*----------------------------------------------*/
void flip_spectrum_fx(
- const Word16 input[], /* i : input spectrum */
- Word16 output[], /* o : output spectrum */
- const Word16 length /* i : vector length */
+ const Word16 input[], /* i : input spectrum */
+ Word16 output[], /* o : output spectrum */
+ const Word16 length /* i : vector length */
)
{
Word16 i;
@@ -674,9 +671,9 @@ static void filt_mu_fx(
}
static void scale_st_swb(
- const Word16 * sig_in_fx, /* i : postfilter i signal */
- Word16 * sig_out_fx, /* i/o: postfilter o signal */
- Word16 * gain_prec_fx, /* i/o: last value of gain for subframe */
+ const Word16 * sig_in_fx, /* i : postfilter i signal */
+ Word16 * sig_out_fx, /* i/o: postfilter o signal */
+ Word16 * gain_prec_fx, /* i/o: last value of gain for subframe */
Word16 SubFrameLength
)
{
@@ -783,7 +780,7 @@ void PostShortTerm_fx(
Word16 *ptr_mem_stp, /* i/o: pointer to postfilter memory*/
Word16 *ptr_gain_prec, /* i/o: for gain adjustment*/
Word16 *mem_zero, /* i/o: null memory to compute h_st*/
- Word16 formant_fac_fx /* i : Strength of post-filter*/
+ const Word16 formant_fac_fx /* i : Strength of post-filter*/
)
{
Word16 apond1_fx[LPC_SHB_ORDER+1]; /* denominator coeff.*/
@@ -836,13 +833,13 @@ void PostShortTerm_fx(
}
void flip_spectrum_and_decimby4_fx(
- const Word16 input[], /* i : input spectrum Q_inp */
- Word16 output[], /* o : output spectrum Q_inp */
- const Word16 length, /* i : vector length */
- Word16 mem1[], /* i/o : memory Q_inp */
- Word16 mem2[], /* i/o : memory Q_inp */
- const Word16
- ramp_flag /*i: flag to trigger slow ramp-up of output following change of core (HQ to ACELP or 12k8 to 16k ACELP) */ )
+ const Word16 input[], /* i : input spectrum Q_inp */
+ Word16 output[], /* o : output spectrum Q_inp */
+ const Word16 length, /* i : vector length */
+ Word16 mem1[], /* i/o : memory Q_inp */
+ Word16 mem2[], /* i/o : memory Q_inp */
+ const Word16 ramp_flag /*i: flag to trigger slow ramp-up of output following change of core (HQ to ACELP or 12k8 to 16k ACELP) */
+)
{
Word16 i;
Word16 factor, tmp[L_FRAME16k/2];
@@ -876,8 +873,8 @@ void flip_spectrum_and_decimby4_fx(
move16();
}
- Decimate_allpass_steep_fx( input_change, mem1, L_FRAME16k, tmp );
- Decimate_allpass_steep_fx( tmp, mem2, L_FRAME16k / 2, output );
+ Decimate_allpass_steep_fx( input_change, mem1, length, tmp );
+ Decimate_allpass_steep_fx( tmp, mem2, length / 2, output );
return;
}
@@ -891,7 +888,7 @@ void flip_spectrum_and_decimby4_fx(
/* INPUT ARGUMENTS : */
/* _Word16 *lpc_shb i : lpc coefficients Q12 */
/* _Word16 coder_type i : coding type */
-/* _Word16 *bwe_exc_extended i : bandwidth extended exciatation Q_bwe_exc*/
+/* _Word16 *bwe_exc_extended i : bwidth extended exciatation Q_bwe_exc*/
/* _Word16 Q_bwe_exc i : Q format */
/* _Word16 voice_factors[] i : voicing factor Q15 */
/*--------------------------------------------------------------------------*/
@@ -912,21 +909,22 @@ void flip_spectrum_and_decimby4_fx(
/*--------------------------------------------------------------------------*/
/* CALLED FROM : */
/*==========================================================================*/
-void GenShapedWBExcitation_fx( Word16* excSHB, /* o : synthesized shaped shb exctiation Q_bwe_exc*/
- const Word16* lpc_shb, /* i : lpc coefficients Q12*/
- Word16* exc4kWhtnd, /* o : whitened synthesized shb excitation Q_bwe_exc*/
- Word32* mem_csfilt, /* i/o : memory Q_bwe_exc+16*/
- Word16* mem_genSHBexc_filt_down1, /* i/o : memory Q_bwe_exc*/
- Word16* mem_genSHBexc_filt_down2, /* i/o : memory Q_bwe_exc*/
- Word16* mem_genSHBexc_filt_down3, /* i/o : memory Q_bwe_exc*/
- Word16* state_lpc_syn, /* i/o : memory Q_bwe_exc*/
- const Word16 coder_type, /* i : coding type */
- const Word16* bwe_exc_extended, /* i : bandwidth extended exciatation Q_bwe_exc*/
- const Word16 Q_bwe_exc, Word16 bwe_seed[], /* i/o : random number generator seed */
- const Word16 voice_factors[], /* i : voicing factor Q15*/
- const Word16 uv_flag /* i : unvoiced flag */
- , const Word16 igf_flag
- )
+void GenShapedWBExcitation_fx(
+ Word16* excSHB, /* o : synthesized shaped shb exctiation Q_bwe_exc*/
+ const Word16* lpc_shb, /* i : lpc coefficients Q12*/
+ Word16* exc4kWhtnd, /* o : whitened synthesized shb excitation Q_bwe_exc*/
+ Word32* mem_csfilt, /* i/o : memory Q_bwe_exc+16*/
+ Word16* mem_genSHBexc_filt_down1, /* i/o : memory Q_bwe_exc*/
+ Word16* mem_genSHBexc_filt_down2, /* i/o : memory Q_bwe_exc*/
+ Word16* mem_genSHBexc_filt_down3, /* i/o : memory Q_bwe_exc*/
+ Word16* state_lpc_syn, /* i/o : memory Q_bwe_exc*/
+ const Word16 coder_type, /* i : coding type */
+ const Word16* bwe_exc_extended, /* i : bwidth extended exciatation Q_bwe_exc*/
+ const Word16 Q_bwe_exc, Word16 bwe_seed[], /* i/o : random number generator seed */
+ const Word16 voice_factors[], /* i : voicing factor Q15*/
+ const Word16 uv_flag, /* i : unvoiced flag */
+ const Word16 igf_flag
+)
{
Word16 i, j, k;
Word16 wht_fil_mem [ LPC_WHTN_ORDER_WB ];
@@ -947,7 +945,7 @@ void GenShapedWBExcitation_fx( Word16* excSHB, /* o : synthesized shaped shb ex
Word32 L_tmp, Ltemp1, Ltemp2;
Word16 temp1, temp2, exp;
Word32 Lmax;
- Word16 max, n1, n2, sc;
+ Word16 max_val, n1, n2, sc;
Word32 LepsP[LPC_WHTN_ORDER_WB+1];
Word16 tmp_vfac;
Word16 avg_voice_fac;
@@ -1016,16 +1014,16 @@ void GenShapedWBExcitation_fx( Word16* excSHB, /* o : synthesized shaped shb ex
LPC_WHTN_ORDER_WB, 0, 3 );
/* Ensure pow1 is greater than zero when computing normalization */
- max = 0;
+ max_val = 0;
FOR ( i = 0; i < L_FRAME16k / 4; i++ )
{
excTmp2[i] = abs_s( exc4kWhtnd[i] );
move16(); /* Q_bwe_exc */
- max = s_max( max, excTmp2[i] );
+ max_val = s_max( max_val, excTmp2[i] );
move16();
}
- IF ( max == 0 )
+ IF ( max_val == 0 )
{
pow1 = 1;
move16();
@@ -1034,7 +1032,7 @@ void GenShapedWBExcitation_fx( Word16* excSHB, /* o : synthesized shaped shb ex
}
ELSE
{
- n1 = norm_s( max );
+ n1 = norm_s( max_val );
FOR ( i = 0; i < L_FRAME16k / 4; i++ )
{
excTmp2_frac[i] = shl( excTmp2[i], n1 );
@@ -1161,9 +1159,10 @@ void GenShapedWBExcitation_fx( Word16* excSHB, /* o : synthesized shaped shb ex
void GenWBSynth_fx(
const Word16* input_synspeech, /* i : input synthesized speech Qx*/
- Word16* shb_syn_speech_16k, /* o : output highband compnent Qx*/
- Word16* state_lsyn_filt_shb1, /* i/o: memory Qx*/
- Word16* state_lsyn_filt_shb2 /* i/o: memory Qx*/ )
+ Word16* shb_syn_speech_16k, /* o : output highband compnent Qx*/
+ Word16* state_lsyn_filt_shb1, /* i/o: memory Qx*/
+ Word16* state_lsyn_filt_shb2 /* i/o: memory Qx*/
+)
{
Word16 speech_buf_16k1[L_FRAME16k], speech_buf_16k2[L_FRAME16k];
Word16 i, maxm, nor;
@@ -1201,7 +1200,73 @@ void GenWBSynth_fx(
return;
}
+#ifdef ADD_IVAS_TBE_CODE
+void find_td_envelope(
+ const float inp[], /* i : input signal */
+ const int16_t len, /* i : length of the input signal */
+ const int16_t len_h, /* i : length of the MA filter */
+ float mem_h[], /* i/o: memory of the MA filter, length len_h/2 */
+ float out[] /* o : td envelope of the input signal */
+)
+{
+ int16_t k, K;
+ float buf_in[L_FRAME16k + MAX_LEN_MA_FILTER], * p_in, * p_out, * p_prev, w;
+
+ assert(len > 0 && len <= L_FRAME16k);
+
+ K = (int16_t)(len_h / 2); /* length of FIR filter memory = half of the total filter length */
+ w = 1.0f / len_h; /* MA filtering coefficient */
+
+ /* copy filter memory to the input buffer */
+ if (mem_h != NULL)
+ {
+ mvr2r(mem_h, buf_in, K);
+ }
+ else
+ {
+ /* no memory available, use the first len_h/2 samples as memory */
+ p_in = buf_in;
+ for (k = 0; k < K; k++)
+ {
+ *p_in++ = (float)fabs(inp[k]) * w;
+ }
+ }
+
+ /* take the absolute value of the input signal and copy it to the input buffer */
+ /* multiply each value by 1 / filter length */
+ p_in = &buf_in[K];
+ for (k = 0; k < len; k++)
+ {
+ *p_in++ = (float)fabs(inp[k]) * w;
+ }
+
+ /* update filter memory from the end of the input buffer */
+ if (mem_h != NULL)
+ {
+ mvr2r(&buf_in[len], mem_h, K);
+ }
+
+ /* do MA filtering */
+ out[0] = sum_f(buf_in, len_h);
+ p_out = &buf_in[0]; /* pointer to leaving sample */
+ p_in = &buf_in[len_h]; /* pointer to entering sample*/
+ for (k = 1; k < len - K; k++)
+ {
+ out[k] = out[k - 1] - *p_out++ + *p_in++;
+ }
+ /* use IIR filtering to extrapolate the last K samples */
+ p_in = &buf_in[len - K];
+ p_out = &out[len - K];
+ p_prev = p_out - 1;
+ for (k = 0; k < K; k++)
+ {
+ *p_out++ = 0.05f * (*p_in++) + 0.95f * (*p_prev++);
+ }
+
+ return;
+}
+#endif
/*======================================================================================*/
/* FUNCTION : void GenShapedSHBExcitation_fx () */
/*--------------------------------------------------------------------------------------*/
@@ -1209,8 +1274,8 @@ void GenWBSynth_fx(
/*--------------------------------------------------------------------------------------*/
/* INPUT ARGUMENTS : */
/* _(Word16) coder_type : coding type Q_bwe_exc */
-/* _(Word16) bwidth : input signal bandwidth Q0 */
-/* _(Word16*) bwe_exc_extended :bandwidth extended exciatation Q_bwe_exc */
+/* _(Word16) bwidth : input signal bwidth Q0 */
+/* _(Word16*) bwe_exc_extended :bwidth extended exciatation Q_bwe_exc */
/* _(Word16[]) voice_factors :voicing factors Q15 */
/* _(Word16*) lpc_shb :lpc coefficients Q12 */
/* _(Word16*) Q_bwe_exc :Q Format of bwe_exc_extended */
@@ -1236,34 +1301,48 @@ void GenWBSynth_fx(
/* CALLED FROM : RX */
/*======================================================================================*/
void GenShapedSHBExcitation_fx(
- Word16 *excSHB, /* o : synthesized shaped shb excitation Q_bwe_exc*/
- const Word16 *lpc_shb, /* i : lpc coefficients Q12*/
- Word16 *White_exc16k_FB, /* o : white excitation for the Fullband extension Q_bwe_exc */
- Word32 *mem_csfilt, /* i/o: memory */
+ Word16 *excSHB, /* o : synthesized shaped shb excitation Q_bwe_exc*/
+ const Word16 *lpc_shb, /* i : lpc coefficients Q12*/
+ Word16 *White_exc16k_FB, /* o : white excitation for the Fullband extension Q_bwe_exc */
+ Word32 *mem_csfilt, /* i/o: memory */
Word16 *mem_genSHBexc_filt_down_shb, /* i/o: memory */
- Word16 *state_lpc_syn, /* i/o: memory */
- const Word16 coder_type, /* i : coding type */
- const Word16 *bwe_exc_extended, /* i : bandwidth extended excitation */
- Word16 bwe_seed[], /* i/o: random number generator seed */
- Word16 voice_factors[], /* i : voicing factor*/
- const Word16 extl, /* i : extension layer */
- Word16 *tbe_demph, /* i/o: de-emphasis memory */
- Word16 *tbe_premph, /* i/o: pre-emphasis memory */
- Word16 *lpc_shb_sf, /* i: LP coefficients */
- const Word32 shb_ener_sf_32, /* i: input shb ener, Q31 */
- Word16 *shb_res_gshape, /* i: input res gain shape, Q14 */
+ Word16 *state_lpc_syn, /* i/o: memory */
+ const Word16 coder_type, /* i : coding type */
+ const Word16 *bwe_exc_extended, /* i : bwidth extended excitation */
+ Word16 bwe_seed[], /* i/o: random number generator seed */
+ Word16 voice_factors[], /* i : voicing factor*/
+ const Word16 extl, /* i : extension layer */
+ Word16 *tbe_demph, /* i/o: de-emphasis memory */
+ Word16 *tbe_premph, /* i/o: pre-emphasis memory */
+ Word16 *lpc_shb_sf, /* i: LP coefficients */
+ const Word32 shb_ener_sf_32, /* i: input shb ener, Q31 */
+ Word16 *shb_res_gshape, /* i: input res gain shape, Q14 */
Word16 *shb_res,
Word16 *vf_ind,
- const Word16 formant_fac, /* i : Formant sharpening factor [0..1] */
- Word16 fb_state_lpc_syn[], /* i/o: memory */
- Word16 *fb_tbe_demph, /* i/o: fb de-emphasis memory */
+ const Word16 formant_fac, /* i : Formant sharpening factor [0..1] */
+ Word16 fb_state_lpc_syn[], /* i/o: memory */
+ Word16 *fb_tbe_demph, /* i/o: fb de-emphasis memory */
Word16 *Q_bwe_exc,
Word16 *Q_bwe_exc_fb,
const Word16 Q_shb,
- Word16 n_mem2, /* i : n_mem2 scale factor to adjust 24.4/32kbps memories */
- Word16 prev_Q_bwe_syn, /* i : st_fx->prev_Q_bwe_syn */
+ Word16 n_mem2, /* i : n_mem2 scale factor to adjust 24.4/32kbps memories */
+ Word16 prev_Q_bwe_syn, /* i : st_fx->prev_Q_bwe_syn */
const Word32 bitrate,
const Word16 prev_bfi
+#ifdef ADD_IVAS_TBE_CODE
+ , /* i : previous frame was concealed */
+ const Word16 element_mode, /* i : element mode */
+ const Word16 flag_ACELP16k, /* i : ACELP@16kHz flag */
+ Word16* nlExc16k, /* i/o: NL exc for IC-BWE */
+ Word16* mixExc16k, /* i/o: exc spreading for IC-BWE */
+ const Word32 extl_brate, /* i : extension layer bitarte */
+ const Word16 MSFlag, /* i : Multi Source flag */
+ Word16 EnvSHBres_4k[], /* i/o: TD envelope of the SHB residual signal */
+ Word16* prev_pow_exc16kWhtnd, /* i/o: power of the LB excitation signal in the previous frame */
+ Word16* prev_mix_factor, /* i/o: mixing factor in the previous frame */
+ Word16* Env_error, /* o : error in SHB residual envelope modelling*/
+ Word16 Env_error_part[] /* o : per-segment error in SHB residual envelope modelling */
+#endif
)
{
Word16 i, j, k;
@@ -1302,7 +1381,20 @@ void GenShapedSHBExcitation_fx(
Word32 White_exc16k_32[L_FRAME16k];
Word16 Q_temp;
Word16 prev_Q_bwe_exc_fb;
-
+#ifdef ADD_IVAS_TBE_CODE
+ Word32 tempD;
+ Word16 alpha, step, mem_csfilt_left, mem_csfilt_right, excNoisyEnvLeft[L_FRAME16k], excNoisyEnvRight[L_FRAME16k];
+ Word16 cbsize;
+ Word16 mix_factor, old_fact, new_fact, fact, old_scale, new_scale, step_scale;
+ Word16 c0, c1, c2, c3, c4, c5, g1, g2, g, den;
+ Word16 EnvWhiteExc16k[L_FRAME16k], EnvExc16kWhtnd[L_FRAME16k];
+ Word16 EnvWhiteExc16k_4k[L_FRAME4k] = { 0 }, EnvExc16kWhtnd_4k[L_FRAME4k] = { 0 };
+ Word16 flag_plosive;
+ Word16 delta;
+ Word16 c0_part[NUM_SHB_SUBGAINS], c1_part[NUM_SHB_SUBGAINS], c2_part[NUM_SHB_SUBGAINS], c3_part[NUM_SHB_SUBGAINS], c4_part[NUM_SHB_SUBGAINS], c5_part[NUM_SHB_SUBGAINS];
+
+ mix_factor = 0.0f;
+#endif
set16_fx( zero_mem, 0, LPC_SHB_ORDER );
set16_fx( wht_fil_mem, 0, LPC_WHTN_ORDER );
@@ -1335,7 +1427,11 @@ void GenShapedSHBExcitation_fx(
/* i: exc16k in Q_bwe_exc */
/* o: exc16kWhtnd in Q_bwe_exc */
- IF( GE_32(bitrate, ACELP_24k40))
+#ifdef ADD_IVAS_TBE_CODE
+ IF(GE_32(extl_brate, SWB_TBE_2k8))
+#else
+ IF(GE_32(bitrate, ACELP_24k40))
+#endif
{
temp2 = 0;
move16();
@@ -1368,7 +1464,11 @@ void GenShapedSHBExcitation_fx(
Q_pow1 = shl(*Q_bwe_exc,1);
test();
+#ifdef ADD_IVAS_TBE_CODE
+ IF(EQ_16(flag_ACELP16k,0))
+#else
IF( (LE_32( bitrate, ACELP_13k20 ))&&(GE_32(bitrate,ACELP_7k20)))
+#endif
{
/* varEnvShape = mean_fx(voice_factors, 4); */
/* unroll the loop */
@@ -1394,7 +1494,7 @@ void GenShapedSHBExcitation_fx(
tmp = mult_r(varEnvShape, varEnvShape);
tmp = mult_r(tmp, varEnvShape);
- /* max((0.68f - (float)pow(varEnvShape, 3)), 0.48f); */
+ /* max_val((0.68f - (float)pow(varEnvShape, 3)), 0.48f); */
fb_deemph_fac = sub(22282/*0.68f Q15*/, tmp);
fb_deemph_fac = s_max(fb_deemph_fac, 15729/*0.48f Q15*/);
}
@@ -1402,7 +1502,7 @@ void GenShapedSHBExcitation_fx(
/*varEnvShape = 1.09875f - 0.49875f * varEnvShape; */
varEnvShape = msu_r(1179773824l/*0.549375f Q31*/, 8172/*0.249375f Q15*/, varEnvShape);
- /*varEnvShape = min( max(varEnvShape, 0.6f), 0.999f); */
+ /*varEnvShape = min( max_val(varEnvShape, 0.6f), 0.999f); */
varEnvShape = s_max(varEnvShape, 9830/*0.3f Q15*/);
varEnvShape = s_min(varEnvShape, 16368/*0.4995f Q15*/);
varEnvShape = shl(varEnvShape, 1);
@@ -1414,7 +1514,11 @@ void GenShapedSHBExcitation_fx(
test();
test();
test();
+#ifdef ADD_IVAS_TBE_CODE
+ IF (EQ_16(element_mode, EVS_MONO) && *mem_csfilt == 0 && ( (EQ_32( bitrate, ACELP_9k60 ))||(EQ_32(bitrate,ACELP_16k40))||(EQ_32(bitrate,ACELP_24k40))))
+#else
IF ( *mem_csfilt == 0 && ( (EQ_32( bitrate, ACELP_9k60 ))||(EQ_32(bitrate,ACELP_16k40))||(EQ_32(bitrate,ACELP_24k40))))
+#endif
{
/* pre-init smoothing filter to avoid energy drop outs */
L_tmp = L_mult(excTmp2[0], 1638);
@@ -1441,101 +1545,273 @@ void GenShapedSHBExcitation_fx(
*mem_csfilt = Mult_32_16( L_tmp, varEnvShape );
move32();
}
-
- /* Track the low band envelope */
- L_tmp = *mem_csfilt;
- move32();
- FOR ( i = 0; i < L_FRAME16k; i++ )
+#ifdef ADD_IVAS_TBE_CODE
+ if (MSFlag > 0)
{
- excNoisyEnv[i] = mac_r( L_tmp, csfilt_num2[0], excTmp2[i] );
- move16();
- /* excNoisyEnv : Q_bwe_exc,
- *mem_csfilt: Q_bwe_exc+16, excTmp2: Q_bwe_exc, csfilt_num2[0] Q15 */
- L_tmp = L_mult( excNoisyEnv[i], neg_csfilt_den2[1] ); /* Q_bwe_exc+16 */
+ varEnvShape = 0.995f;
+ csfilt_num2[0] = 1.0f - varEnvShape;
+ csfilt_den2[1] = -varEnvShape;
}
- *mem_csfilt = L_tmp;
- move32();
- /* create a random excitation - Reuse exc16k memory */
White_exc16k = exc16k;
- create_random_vector_fx( White_exc16k, 256, bwe_seed );
- create_random_vector_fx( White_exc16k + 256, L_FRAME16k - 256, bwe_seed );
- L_tmp = L_deposit_l(0);
- tmp = add(*Q_bwe_exc, 1);
- FOR ( k = 0; k < L_FRAME16k; k++ )
+ /* Track the low band envelope */
+ if (element_mode == IVAS_CPE_TD || element_mode == IVAS_CPE_DFT)
+ {
+ if (extl_brate != SWB_TBE_1k10 && extl_brate != SWB_TBE_1k75)
+ {
+ mem_csfilt_left = 0.0f;
+ mem_csfilt_right = 0.0f;
+ for (k = 0; k < L_FRAME16k; k++)
+ {
+ excNoisyEnvLeft[k] = mem_csfilt_left + csfilt_num2[0] * excTmp2[k];
+ mem_csfilt_left = -csfilt_den2[1] * excNoisyEnvLeft[k];
+ excNoisyEnvRight[L_FRAME16k - k - 1] = mem_csfilt_right + csfilt_num2[0] * excTmp2[L_FRAME16k - k - 1];
+ mem_csfilt_right = -csfilt_den2[1] * excNoisyEnvRight[L_FRAME16k - k - 1];
+ }
+
+ alpha = 0.0f;
+ step = 1.0f / L_FRAME16k;
+ for (k = 0; k < L_FRAME16k; k++)
+ {
+ excNoisyEnv[k] = alpha * excNoisyEnvLeft[k] + (1 - alpha) * excNoisyEnvRight[k];
+ alpha += step;
+ }
+ }
+ }
+ else
+#endif
{
- L_tmp4 = L_shl(L_deposit_l(White_exc16k[k]), tmp);
- if(excNoisyEnv[k] != 0)
+ /* Track the low band envelope */
+ L_tmp = *mem_csfilt;
+ move32();
+ FOR(i = 0; i < L_FRAME16k; i++)
{
- L_tmp4 = L_mult(excNoisyEnv[k], White_exc16k[k]);/* (Q_bwe_exc) +5 +1*/
+ excNoisyEnv[i] = mac_r(L_tmp, csfilt_num2[0], excTmp2[i]);
+ move16();
+ /* excNoisyEnv : Q_bwe_exc,
+ *mem_csfilt: Q_bwe_exc+16, excTmp2: Q_bwe_exc, csfilt_num2[0] Q15 */
+ L_tmp = L_mult(excNoisyEnv[i], neg_csfilt_den2[1]); /* Q_bwe_exc+16 */
}
- White_exc16k_32[k] = L_tmp4;
+ *mem_csfilt = L_tmp;
move32();
- L_tmp = L_max(L_tmp, L_abs(White_exc16k_32[k]));
}
- Q_temp = norm_l( L_tmp );
- if(L_tmp == 0)
+#ifdef ADD_IVAS_TBE_CODE
+ if (extl_brate == SWB_TBE_1k10 || extl_brate == SWB_TBE_1k75)
{
- Q_temp = 31;
- }
- /*Copy_Scale_sig( White_exc16k, White_exc16k, L_FRAME16k, sub(NOISE_QFAC, 5) );)*/
- /* White_exc16k in Q6 */
+ /* generate gaussian (white) excitation */
+ for (k = 0; k < L_FRAME16k; k++)
+ {
+ White_exc16k[k] = (float)own_random(&bwe_seed[0]);
+ }
- /* calculate pow22 */
- /* pow22=0.00001f */
- tmp = sub(shl(sub(*Q_bwe_exc, NOISE_QADJ), 1), 31);
- pow22 = L_shl(21475l/*0.00001f Q31*/, tmp); /* 0.00001f in 2*(Q_bwe_exc-NOISE_QADJ) */
- tmp = sub(NOISE_QFAC, 5);
- FOR ( k = 0; k < L_FRAME16k; k++ )
- {
- /* White_exc16k[k] *= excNoisyEnv[k]; */
- White_exc16k[k] = mult_r( excNoisyEnv[k], shl(White_exc16k[k], tmp) );
- move16();
- /* i: excNoisyEnv in (Q_bwe_exc) */
- /* i: White_exc16k in Q6 */
- /* o: White_exc16k in (Q_bwe_exc-NOISE_QADJ) */
- /* pow22 += White_exc16k[k] * White_exc16k[k]; */
- pow22 = L_mac0( pow22, White_exc16k[k], White_exc16k[k] ); /* 2*(Q_bwe_exc-NOISE_QADJ)*/
+ /* normalize the amplitude of the gaussian excitation to that of the LB exc. */
+ pow22 = POW_EXC16k_WHTND;
+ v_multc(White_exc16k, (float)sqrt(pow1 / pow22), White_exc16k, L_FRAME16k);
}
- /*Q_pow22 = sub( shl(*Q_bwe_exc,1), 18 );*/
- Q_pow22 = shl( sub( *Q_bwe_exc, NOISE_QADJ ), 1);
+ else
+#endif
+ {
+ /* create a random excitation - Reuse exc16k memory */
+ White_exc16k = exc16k;
+ create_random_vector_fx(White_exc16k, L_FRAME, bwe_seed);
+ create_random_vector_fx(White_exc16k + L_FRAME, L_FRAME16k - L_FRAME, bwe_seed);
+
+ L_tmp = L_deposit_l(0);
+ tmp = add(*Q_bwe_exc, 1);
+ FOR(k = 0; k < L_FRAME16k; k++)
+ {
+ L_tmp4 = L_shl(L_deposit_l(White_exc16k[k]), tmp);
+ if (excNoisyEnv[k] != 0)
+ {
+ L_tmp4 = L_mult(excNoisyEnv[k], White_exc16k[k]);/* (Q_bwe_exc) +5 +1*/
+ }
+ White_exc16k_32[k] = L_tmp4;
+ move32();
+ L_tmp = L_max(L_tmp, L_abs(White_exc16k_32[k]));
+ }
+ Q_temp = norm_l(L_tmp);
+ if (L_tmp == 0)
+ {
+ Q_temp = 31;
+ }
+ /*Copy_Scale_sig( White_exc16k, White_exc16k, L_FRAME16k, sub(NOISE_QFAC, 5) );)*/
+ /* White_exc16k in Q6 */
+ /* calculate pow22 */
+ /* pow22=0.00001f */
+ tmp = sub(shl(sub(*Q_bwe_exc, NOISE_QADJ), 1), 31);
+ pow22 = L_shl(21475l/*0.00001f Q31*/, tmp); /* 0.00001f in 2*(Q_bwe_exc-NOISE_QADJ) */
+ tmp = sub(NOISE_QFAC, 5);
+ FOR(k = 0; k < L_FRAME16k; k++)
+ {
+ /* White_exc16k[k] *= excNoisyEnv[k]; */
+ White_exc16k[k] = mult_r(excNoisyEnv[k], shl(White_exc16k[k], tmp));
+ move16();
+ /* i: excNoisyEnv in (Q_bwe_exc) */
+ /* i: White_exc16k in Q6 */
+ /* o: White_exc16k in (Q_bwe_exc-NOISE_QADJ) */
+ /* pow22 += White_exc16k[k] * White_exc16k[k]; */
+ pow22 = L_mac0(pow22, White_exc16k[k], White_exc16k[k]); /* 2*(Q_bwe_exc-NOISE_QADJ)*/
+ }
+ /*Q_pow22 = sub( shl(*Q_bwe_exc,1), 18 );*/
+ Q_pow22 = shl(sub(*Q_bwe_exc, NOISE_QADJ), 1);
+ }
+#ifdef ADD_IVAS_TBE_CODE
+ flag_plosive = 0;
+ move16();
+ test(); test(); test();
+ IF(GE_32(extl_brate, SWB_TBE_2k8) || EQ_32(extl_brate, SWB_TBE_1k10) || EQ_32(extl_brate, SWB_TBE_1k75)))
+#else
IF( GE_32(bitrate, ACELP_24k40))
+#endif
{
IF( EQ_16(*vf_ind,20)) /* encoder side */
{
- Estimate_mix_factors_fx(shb_res, Q_shb, exc16kWhtnd, *Q_bwe_exc,
- White_exc16k, (*Q_bwe_exc-NOISE_QADJ), pow1, Q_pow1,
- pow22, Q_pow22, voiceFacEst, vf_ind);
- tmp = voiceFacEst[0];
+#ifdef ADD_IVAS_TBE_CODE
+ if (extl_brate == SWB_TBE_1k10 || extl_brate == SWB_TBE_1k75)
+ {
+ /* calculate TD envelopes of exc16kWhtnd and White_exc16k */
+ find_td_envelope(White_exc16k, L_FRAME16k, 20, NULL, EnvWhiteExc16k);
+ find_td_envelope(exc16kWhtnd, L_FRAME16k, 20, NULL, EnvExc16kWhtnd);
+
+ for (k = 0; k < L_FRAME4k; k++)
+ {
+ EnvWhiteExc16k_4k[k] = EnvWhiteExc16k[4 * k];
+ EnvExc16kWhtnd_4k[k] = EnvExc16kWhtnd[4 * k];
+ }
+
+ /* calculate the optimal mix factor */
+ c0 = c1 = c2 = c3 = c4 = c5 = 0.0f;
+ for (i = 0; i < NUM_SHB_SUBGAINS; i++)
+ {
+ c0_part[i] = sum2_f(&EnvExc16kWhtnd_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS);
+ c1_part[i] = -2.0f * dotp(&EnvSHBres_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], &EnvExc16kWhtnd_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS);
+ c2_part[i] = sum2_f(&EnvWhiteExc16k_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS);
+ c3_part[i] = -2.0f * dotp(&EnvSHBres_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], &EnvWhiteExc16k_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS);
+ c4_part[i] = 2.0f * dotp(&EnvExc16kWhtnd_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], &EnvWhiteExc16k_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS);
+ c5_part[i] = sum2_f(&EnvSHBres_4k[i * L_FRAME4k / NUM_SHB_SUBGAINS], L_FRAME4k / NUM_SHB_SUBGAINS);
+
+ c0 += c0_part[i];
+ c1 += c1_part[i];
+ c2 += c2_part[i];
+ c3 += c3_part[i];
+ c4 += c4_part[i];
+ c5 += c5_part[i];
+ }
+
+ den = 4.0f * c0 * c2 - c4 * c4;
+ g1 = (c3 * c4 - 2 * c1 * c2) / den;
+ g2 = (c1 * c4 - 2 * c0 * c3) / den;
+
+ *Env_error = 0.0f;
+ flag_plosive = 0;
+ for (i = 0; i < NUM_SHB_SUBGAINS; i++)
+ {
+ Env_error_part[i] = c5_part[i] + g1 * g1 * c0_part[i] + g1 * c1_part[i] + g2 * g2 * c2_part[i] + g2 * c3_part[i] + g1 * g2 * c4_part[i];
+ *Env_error += Env_error_part[i];
+
+ if (Env_error_part[i] > THR_ENV_ERROR_PLOSIVE)
+ {
+ /* envelope error is too high -> likely a plosive */
+ flag_plosive = 1;
+ }
+ }
+
+ if (flag_plosive)
+ {
+ /* plosive detected -> set the mixing factor to 0 */
+ *vf_ind = 0;
+ mix_factor = 0.0f;
+ }
+ else
+ {
+ /* normalize gain */
+ g = g2 / (g1 + g2);
+
+ /* quantization of the mixing factor */
+ cbsize = 1 << NUM_BITS_SHB_VF;
+ delta = 1.0f / (cbsize - 1);
+ if (g > 1.0f)
+ {
+ g = 1.0f;
+ }
+ else if (g < delta)
+ {
+ /* prevent low gains to be quantized to 0 as this is reserved for plosives */
+ g = delta;
+ }
+
+ *vf_ind = usquant(g, &mix_factor, 0.0f, 1.0f / (cbsize - 1), cbsize);
+ }
+ }
+ else
+#endif
+ {
+ Estimate_mix_factors_fx(shb_res, Q_shb, exc16kWhtnd, *Q_bwe_exc, White_exc16k,
+ (*Q_bwe_exc - NOISE_QADJ), pow1, Q_pow1, pow22, Q_pow22, voiceFacEst, vf_ind);
+ tmp = voiceFacEst[0];
+ tmp2 = MAX_16;
+ if (LE_16(tmp, 22938/*0.7f Q15*/))
+ {
+ tmp2 = 26214/*0.8f Q15*/;
+ }
+ }
}
ELSE /* decoder side */
{
- /* *vf_ind is an integer scale by 0.125f*/
- tmp = shl( *vf_ind, (15-3) );
+#ifdef ADD_IVAS_TBE_CODE
+ if (extl_brate == SWB_TBE_1k10 || extl_brate == SWB_TBE_1k75)
+ {
+ if (*vf_ind == 0)
+ {
+ mix_factor = 0.0f;
+ flag_plosive = 1;
+ }
+ else
+ {
+ mix_factor = usdequant(*vf_ind, 0.0f, 1.0f / ((1 << NUM_BITS_SHB_VF) - 1));
+ }
+ }
+ else
+#endif
+ {
+ /* *vf_ind is an integer scale by 0.125f*/
+ tmp = shl(*vf_ind, (15 - 3));
+ tmp2 = MAX_16;
+ if( LE_16(tmp, 22938/*0.7f Q15*/))
+ {
+ tmp2 = 26214/*0.8f Q15*/;
+ }
+ }
}
- tmp2 = MAX_16;
- if( LE_16(tmp, 22938/*0.7f Q15*/))
+#ifdef ADD_IVAS_TBE_CODE
+ IF (NE_32(extl_brate, SWB_TBE_1k10) && NE_32(extl_brate, SWB_TBE_1k75) )
+#endif
{
- tmp2 = 26214/*0.8f Q15*/;
+ voice_factors[0] = mult_r(voice_factors[0], tmp2);
+ move16();
+ voice_factors[1] = mult_r(voice_factors[1], tmp2);
+ move16();
+ voice_factors[2] = mult_r(voice_factors[2], tmp2);
+ move16();
+ voice_factors[3] = mult_r(voice_factors[3], tmp2);
+ move16();
+ voice_factors[4] = mult_r(voice_factors[4], tmp2);
+ move16();
}
- voice_factors[0] = mult_r(voice_factors[0], tmp2);
- move16();
- voice_factors[1] = mult_r(voice_factors[1], tmp2);
- move16();
- voice_factors[2] = mult_r(voice_factors[2], tmp2);
- move16();
- voice_factors[3] = mult_r(voice_factors[3], tmp2);
- move16();
- voice_factors[4] = mult_r(voice_factors[4], tmp2);
- move16();
}
-
+#ifdef ADD_IVAS_TBE_CODE
+ if (element_mode >= IVAS_CPE_DFT && nlExc16k != NULL)
{
- tmp = sub(Q_temp, 3);
+ /* save buffers for IC-BWE */
+ mvr2r(exc16kWhtnd, nlExc16k, L_FRAME16k);
+ v_multc(White_exc16k, (float)sqrt(pow1 / pow22), mixExc16k, L_FRAME16k);
}
+#endif
+
+ tmp = sub(Q_temp, 3);
FOR ( k = 0; k < L_FRAME16k; k++ )
{
White_exc16k_FB[k] = round_fx(L_shl(White_exc16k_32[k], tmp)); /* Q_bwe_exc +5 +1 +Q_temp -16 -3 */
@@ -1546,106 +1822,149 @@ void GenShapedSHBExcitation_fx(
deemph_fx( White_exc16k, PREEMPH_FAC, L_FRAME16k, tbe_demph );
/* i/o: White_exc16k (Q_bwe_exc-NOISE_QADJ) */
/* i: tbe_demph (Q_bwe_exc-NOISE_QADJ) */
-
- IF ( EQ_16(coder_type, UNVOICED))
+#ifdef ADD_IVAS_TBE_CODE
+ if (extl_brate == SWB_TBE_1k10 || extl_brate == SWB_TBE_1k75)
{
- L_tmp = root_a_over_b_fx( pow1, Q_pow1, pow22, Q_pow22, &exp );
- scale = round_fx( L_shl( L_tmp, exp ) ); /*Q15 */
-
- FOR ( k = 0; k < L_FRAME16k; k++ )
+ if (!flag_plosive) /* use only LB excitation in case of plosives */
{
- /* White_exc16k: (Q_bwe_exc-NOISE_QADJ), scale: Q15 */
- L_tmp = L_mult( White_exc16k[k], scale );
- /* L_tmp: (Q_bwe_exc-NOISE_QADJ) + 15 + 1 */
- exc16kWhtnd[k] = round_fx( L_shl(L_tmp, NOISE_QADJ) );
- /* exc16kWhtnd: Q_bwe_exc */
+ /* re-scale gaussian excitation at the beginning to gradually move from old energy to new energy */
+ old_scale = (float)sqrt(*prev_pow_exc16kWhtnd / pow1);
+ new_scale = 1.0f;
+ step_scale = (new_scale - old_scale) / (L_FRAME16k / 2);
+ scale = old_scale;
+
+ /* interpolate between the old and the new value of the mixing factor */
+ old_fact = *prev_mix_factor;
+ new_fact = mix_factor;
+ step = (new_fact - old_fact) / (L_FRAME16k / 2);
+ fact = old_fact;
+
+ /* mixing of LB and gaussian excitation in the first half of the frame */
+ for (k = 0; k < L_FRAME16k / 2; k++)
+ {
+ exc16kWhtnd[k] = (float)fact * (White_exc16k[k] * scale) + (float)(1 - fact) * exc16kWhtnd[k];
+ fact += step;
+ scale += step_scale;
+ }
+
+ /* mixing of LB and gaussian excitation in the second half of the frame */
+ for (; k < L_FRAME16k; k++)
+ {
+ exc16kWhtnd[k] = (float)new_fact * White_exc16k[k] + (float)(1 - new_fact) * exc16kWhtnd[k];
+ }
}
- preemph_fx( exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph );
- /* i/o: exc16kWhtnd (Q_bwe_exc) */
- /* i/o: tbe_premph (Q_bwe_exc) */
+ preemph(exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph);
}
- ELSE
+ else
+#endif
{
- Word16 nbSubFr, lSubFr;
- Word16 tempQ15;
- Word32 tempQ31;
- /*nbSubFr = ( bitrate < ACELP_24k40 )? NB_SUBFR : NB_SUBFR16k;*/
- nbSubFr = NB_SUBFR16k;
- lSubFr = (L_FRAME16k/NB_SUBFR16k);
- IF(LT_32(bitrate, ACELP_24k40))
+#ifdef ADD_IVAS_TBE_CODE
+ if (coder_type == UNVOICED || MSFlag == 1)
+#else
+ IF(EQ_16(coder_type, UNVOICED))
+#endif
{
- nbSubFr = NB_SUBFR;
- move16();
- lSubFr = (L_FRAME16k/NB_SUBFR);
- move16();
+ L_tmp = root_a_over_b_fx(pow1, Q_pow1, pow22, Q_pow22, &exp);
+ scale = round_fx(L_shl(L_tmp, exp)); /*Q15 */
+
+ FOR(k = 0; k < L_FRAME16k; k++)
+ {
+ /* White_exc16k: (Q_bwe_exc-NOISE_QADJ), scale: Q15 */
+ L_tmp = L_mult(White_exc16k[k], scale);
+ /* L_tmp: (Q_bwe_exc-NOISE_QADJ) + 15 + 1 */
+ exc16kWhtnd[k] = round_fx(L_shl(L_tmp, NOISE_QADJ));
+ /* exc16kWhtnd: Q_bwe_exc */
+ }
+ preemph_fx(exc16kWhtnd, PREEMPH_FAC, L_FRAME16k, tbe_premph);
+ /* i/o: exc16kWhtnd (Q_bwe_exc) */
+ /* i/o: tbe_premph (Q_bwe_exc) */
}
- k = 0;
- FOR( i = 0; i < nbSubFr; i++ )
+ ELSE
{
- test();
- IF( EQ_16(coder_type, VOICED)&&(LT_32(bitrate,ACELP_24k40)))
+ Word16 nbSubFr, lSubFr;
+ Word16 tempQ15;
+ Word32 tempQ31;
+ /*nbSubFr = ( bitrate < ACELP_24k40 )? NB_SUBFR : NB_SUBFR16k;*/
+ nbSubFr = NB_SUBFR16k;
+ lSubFr = (L_FRAME16k / NB_SUBFR16k);
+ IF(LT_32(bitrate, ACELP_24k40))
{
- exp = 0;
- tempQ15 = Sqrt16(voice_factors[i], &exp); /* Q15 */
- temp = shl(tempQ15, exp); /* Q15 exc16kWhtnd scale factor */
- exp = 0;
- tempQ15 = Sqrt16(temp, &exp); /* Q15 */
- temp1 = shl(tempQ15, exp); /* Q15 exc16kWhtnd scale factor */
-
- /*temp2 = root_a_over_b_fx( pow1 * (1.0f - temp), pow22 ); */
- temp = sub(MAX_16, temp);
- tempQ31 = Mult_32_16(pow1, temp);
- L_tmp = root_a_over_b_fx( tempQ31, Q_pow1, pow22, Q_pow22, &exp );
- temp2 = round_fx(L_shl(L_tmp, exp)); /* Q15 whiteEnvShapedExc scale factor */
+ nbSubFr = NB_SUBFR;
+ move16();
+ lSubFr = (L_FRAME16k / NB_SUBFR);
+ move16();
}
- ELSE
+ k = 0;
+ FOR(i = 0; i < nbSubFr; i++)
{
- /* Adjust noise mixing for formant sharpening filter */
- tempQ15 = mult_r(SWB_NOISE_MIX_FAC_FX, formant_fac);
- /* vf_tmp = voice_factors[i] * (1.0f - vf_tmp); */
- vf_tmp = sub(MAX_16, tempQ15);
- vf_tmp = mult_r(voice_factors[i], vf_tmp);
-
- exp = 0;
- tempQ15 = Sqrt16(vf_tmp, &exp); /* Q15 */
- temp1 = shl(tempQ15, exp); /* Q15 exc16kWhtnd scale factor */
-
- /*temp2 = root_a_over_b(pow1 * (1.0f - vf_tmp), pow22); */
- temp = sub(MAX_16, vf_tmp);
- tempQ31 = Mult_32_16(pow1, temp);
- L_tmp = root_a_over_b_fx( tempQ31, Q_pow1, pow22, Q_pow22, &exp );
- temp2 = round_fx(L_shl(L_tmp, exp)); /* Q15 whiteEnvShapedExc scale factor */
- }
+ test();
+ IF(EQ_16(coder_type, VOICED) && (LT_32(bitrate,ACELP_24k40)))
+ {
+ exp = 0;
+ tempQ15 = Sqrt16(voice_factors[i], &exp); /* Q15 */
+ temp = shl(tempQ15, exp); /* Q15 exc16kWhtnd scale factor */
+ exp = 0;
+ tempQ15 = Sqrt16(temp, &exp); /* Q15 */
+ temp1 = shl(tempQ15, exp); /* Q15 exc16kWhtnd scale factor */
+
+ /*temp2 = root_a_over_b_fx( pow1 * (1.0f - temp), pow22 ); */
+ temp = sub(MAX_16, temp);
+ tempQ31 = Mult_32_16(pow1, temp);
+ L_tmp = root_a_over_b_fx(tempQ31, Q_pow1, pow22, Q_pow22, &exp);
+ temp2 = round_fx(L_shl(L_tmp, exp)); /* Q15 whiteEnvShapedExc scale factor */
+ }
+ ELSE
+ {
+ /* Adjust noise mixing for formant sharpening filter */
+ tempQ15 = mult_r(SWB_NOISE_MIX_FAC_FX, formant_fac);
+ /* vf_tmp = voice_factors[i] * (1.0f - vf_tmp); */
+ vf_tmp = sub(MAX_16, tempQ15);
+ vf_tmp = mult_r(voice_factors[i], vf_tmp);
+
+ exp = 0;
+ tempQ15 = Sqrt16(vf_tmp, &exp); /* Q15 */
+ temp1 = shl(tempQ15, exp); /* Q15 exc16kWhtnd scale factor */
+
+ /*temp2 = root_a_over_b(pow1 * (1.0f - vf_tmp), pow22); */
+ temp = sub(MAX_16, vf_tmp);
+ tempQ31 = Mult_32_16(pow1, temp);
+ L_tmp = root_a_over_b_fx(tempQ31, Q_pow1, pow22, Q_pow22, &exp);
+ temp2 = round_fx(L_shl(L_tmp, exp)); /* Q15 whiteEnvShapedExc scale factor */
+ }
- FOR( j = 0; j < lSubFr; j++)
- {
- /*exc16kWhtnd[k+j] = temp1 * exc16kWhtnd[k+j] + temp2 * White_exc16k[k+j]; */
- L_tmp = L_mult(temp2, White_exc16k[k+j]); /* 16+(Q_bwe_exc-NOISE_QADJ)*/
- L_tmp = L_shl(L_tmp, NOISE_QADJ); /* 16+(Q_bwe_exc) */
- exc16kWhtnd[k+j] = mac_r(L_tmp, temp1, exc16kWhtnd[k+j]);
- move16();
- /* Q_bwe_exc */
- }
- k = add(k, lSubFr);
+ FOR(j = 0; j < lSubFr; j++)
+ {
+ /*exc16kWhtnd[k+j] = temp1 * exc16kWhtnd[k+j] + temp2 * White_exc16k[k+j]; */
+ L_tmp = L_mult(temp2, White_exc16k[k + j]); /* 16+(Q_bwe_exc-NOISE_QADJ)*/
+ L_tmp = L_shl(L_tmp, NOISE_QADJ); /* 16+(Q_bwe_exc) */
+ exc16kWhtnd[k + j] = mac_r(L_tmp, temp1, exc16kWhtnd[k + j]);
+ move16();
+ /* Q_bwe_exc */
+ }
+ k = add(k, lSubFr);
- /* estimate the pre-emph factor */
- tempQ15 = sub(MAX_16, voice_factors[i]);
- exp = 0;
- temp = Sqrt16(tempQ15, &exp);
- temp = shl(temp, exp-1);
+ /* estimate the pre-emph factor */
+ tempQ15 = sub(MAX_16, voice_factors[i]);
+ exp = 0;
+ temp = Sqrt16(tempQ15, &exp);
+ temp = shl(temp, exp - 1);
- temp2 = add( temp, shl(temp1, -1) ); /* shift right by 1 to avoid overflow */
- temp = div_s( temp, temp2 ); /* Q15 */
- temp = mult_r( PREEMPH_FAC, temp );
+ temp2 = add(temp, shl(temp1, -1)); /* shift right by 1 to avoid overflow */
+ temp = div_s(temp, temp2); /* Q15 */
+ temp = mult_r(PREEMPH_FAC, temp);
- preemph_fx( &exc16kWhtnd[i*lSubFr], temp, lSubFr, tbe_premph );
- /* exc16kWhtnd: Q_bwe_exc;
- tbe_premph: Q_bwe_exc*/
+ preemph_fx(&exc16kWhtnd[i * lSubFr], temp, lSubFr, tbe_premph);
+ /* exc16kWhtnd: Q_bwe_exc;
+ tbe_premph: Q_bwe_exc*/
+ }
}
}
-
+#ifdef ADD_IVAS_TBE_CODE
+ IF ( LT_32(extl_brate, SWB_TBE_2k8))
+#else
IF ( LT_32(bitrate, ACELP_24k40))
+#endif
{
Syn_filt_s(0, lpc_shb, LPC_SHB_ORDER, exc16kWhtnd, excSHB, L_FRAME16k, state_lpc_syn, 1 );
/* i: exc16kWhtnd in Q_bwe_exc */
@@ -1754,6 +2073,10 @@ void GenShapedSHBExcitation_fx(
set16_fx( White_exc16k_FB, 0, L_FRAME16k);
}
+#ifdef ADD_IVAS_TBE_CODE
+ *prev_pow_exc16kWhtnd = pow1;
+ *prev_mix_factor = mix_factor;
+#endif
return;
}
@@ -1779,11 +2102,11 @@ void GenShapedSHBExcitation_fx(
/*------------------------------------------------------------------------------------*/
void GenSHBSynth_fx(
- const Word16* input_synspeech, /* i : input synthesized speech */
+ const Word16* input_synspeech, /* i : input synthesized speech */
Word16* shb_syn_speech_32k, /* o : output highband component */
Word32 Hilbert_Mem[], /* i/o: memory */
Word16 allpass_mem[], /* i/o: memory */
- const Word16 L_frame, /* i : ACELP frame length */
+ const Word16 L_frame, /* i : ACELP frame length */
Word16* syn_dm_phase
)
{
@@ -1882,14 +2205,14 @@ void GenSHBSynth_fx(
void ScaleShapedSHB_fx(
const Word16 length, /* i : SHB overlap length */
- Word16* synSHB, /* i/o : synthesized shb signal Q_bwe_exc/Qx */
- Word16* overlap, /* i/o : buffer for overlap-add Q_bwe_exc/Qx */
+ Word16* synSHB, /* i/o : synthesized shb signal Q_bwe_exc/Qx */
+ Word16* overlap, /* i/o : buffer for overlap-add Q_bwe_exc/Qx */
const Word16* subgain, /* i : subframe gain Q15*/
const Word32 frame_gain, /* i : frame gain Q18 */
const Word16* win, /* i : window Q15*/
const Word16* subwin, /* i : subframes window Q15*/
Word16 *Q_bwe_exc
- ,Word16* Qx /* o : newly computed Q factor for synSHB */
+ ,Word16* Qx /* o : newly computed Q factor for synSHB */
,Word16 n_mem3
,Word16 prev_Q_bwe_syn2
)
@@ -2060,22 +2383,26 @@ void ScaleShapedSHB_fx(
return;
}
-
+/*-------------------------------------------------------------------*
+ * ScaleShapedWB()
+ *
+ *
+ *-------------------------------------------------------------------*/
void ScaleShapedWB_fx(
const Word16 length, /* i : SHB overlap length */
- Word16* synSHB, /* i/o : synthesized shb signal Q_bwe_exc/Qx */
- Word16* overlap, /* i/o : buffer for overlap-add Q_bwe_exc/Qx */
+ Word16* synSHB, /* i/o : synthesized shb signal Q_bwe_exc/Qx */
+ Word16* overlap, /* i/o : buffer for overlap-add Q_bwe_exc/Qx */
const Word16* subgain, /* i : subframe gain Q15*/
const Word32 frame_gain, /* i : frame gain Q18 */
const Word16* win, /* i : window Q15*/
const Word16* subwin, /* i : subframes window Q15*/
const Word16 Q_bwe_exc
- ,Word16 L_frame /* i : Frame length - determines whether 12.8 or 16kHz core in-use */
- ,Word16 dynQ /* i : indicate whether output is dynamic Q, or Q0 */
- ,Word16* Qx /* o : newly computed Q factor for synSHB */
- ,Word16 prev_Qx /* i : prev_Qx for memory scaling */
- ,Word32* Hilbert_Mem /* i : Hilbert memory used for computing Qx */
+ ,Word16 L_frame /* i : Frame length - determines whether 12.8 or 16kHz core in-use */
+ ,Word16 dynQ /* i : indicate whether output is dynamic Q, or Q0 */
+ ,Word16* Qx /* o : newly computed Q factor for synSHB */
+ ,Word16 prev_Qx /* i : prev_Qx for memory scaling */
+ ,Word32* Hilbert_Mem /* i : Hilbert memory used for computing Qx */
)
{
const Word16* skip;
@@ -2084,7 +2411,7 @@ void ScaleShapedWB_fx(
Word32 mod_syn[L_FRAME16k+L_SHB_LAHEAD];
Word16 sum_gain;
Word32 L_tmp;
- Word16 max, abs_sig, sc1, sc2, shift, max_headroom, min_shift, max_shift, max_shift2;
+ Word16 max_val, abs_sig, sc1, sc2, shift, max_headroom, min_shift, max_shift, max_shift2;
/* Init */
set32_fx( mod_syn, 0, L_FRAME16k+L_SHB_LAHEAD );
@@ -2183,14 +2510,14 @@ void ScaleShapedWB_fx(
- max = 0;
+ max_val = 0;
move16();
FOR( i = 0; i < l_frame + l_shb_lahead; i++ )
{
abs_sig = abs_s( round_fx(mod_syn[i]) );
- if(GT_16(abs_sig,max))
+ if(GT_16(abs_sig,max_val))
{
- max = abs_sig;
+ max_val = abs_sig;
move16();
}
}
@@ -2198,14 +2525,14 @@ void ScaleShapedWB_fx(
FOR( i = 0; i < HILBERT_MEM_SIZE; i++ )
{
abs_sig = abs_s( round_fx(Hilbert_Mem[i]) );
- if(GT_16(abs_sig,max))
+ if(GT_16(abs_sig,max_val))
{
- max = abs_sig;
+ max_val = abs_sig;
move16();
}
}
- sc1 = norm_s( max ); /* max headroom in mod_syn[] */
+ sc1 = norm_s( max_val ); /* max_val headroom in mod_syn[] */
sc2 = norm_s( round_fx(frame_gain));/* headroom in GainFrame */
IF(dynQ == 0 )
@@ -2223,7 +2550,7 @@ void ScaleShapedWB_fx(
/* make sure 14 > Qx > 2 */
min_shift = 2-(Q_bwe_exc+3-16);
max_shift = 13-(Q_bwe_exc+3-16);
- max_shift2 = s_min(max_shift,max_headroom); /* avoid shifting more than the available max headroom to avoid overflow */
+ max_shift2 = s_min(max_shift,max_headroom); /* avoid shifting more than the available max_val headroom to avoid overflow */
shift = s_min(min_shift,max_shift2);
*Qx = (Q_bwe_exc+3) + shift - 16;
@@ -2236,7 +2563,7 @@ void ScaleShapedWB_fx(
/* make sure 14 > Qx > 3 */
min_shift = 3-(Q_bwe_exc+3-16);
max_shift = 13-(Q_bwe_exc+3-16);
- max_shift2 = s_min(max_shift,max_headroom); /* avoid shifting more than the available max headroom to avoid overflow */
+ max_shift2 = s_min(max_shift,max_headroom); /* avoid shifting more than the available max_val headroom to avoid overflow */
shift = s_min(min_shift,max_shift2);
*Qx = (Q_bwe_exc+3) + shift - 16;
@@ -2274,14 +2601,20 @@ void ScaleShapedWB_fx(
return;
}
+/*-------------------------------------------------------------------*
+ * non_linearity()
+ *
+ * Apply a non linearity to the SHB excitation
+ * -------------------------------------------------------------------*/
+
static Word32 non_linearity_scaled_copy(
const Word16 input[],
Word16 j,
- Word16 length,
+ const Word16 length,
Word32 output[],
Word32 prev_scale,
- Word16 scale_step,
- Word16 en_abs
+ const Word16 scale_step,
+ const Word16 en_abs
)
{
Word16 i;
@@ -2363,19 +2696,19 @@ static Word32 non_linearity_scaled_copy(
/*==========================================================================*/
void non_linearity_fx(
- const Word16 input[], /* i : input signal Q_inp */
- Word32 output[], /* o : output signal 2*Q_inp */
- const Word16 length, /* i : input length */
- Word32* pPrevScale, /* i/o: memory Q30 */
- Word16 Q_inp
- ,Word16 coder_type, /* i : Coder Type */
- Word16 *voice_factors, /* i : Voice Factors */
- const Word16 L_frame /* i : ACELP frame length */
+ const Word16 input[], /* i : input signal Q_inp */
+ Word32 output[], /* o : output signal 2*Q_inp */
+ const Word16 length, /* i : input length */
+ Word32* pPrevScale, /* i/o: memory Q30 */
+ Word16 Q_inp,
+ Word16 coder_type, /* i : Coder Type */
+ Word16 *voice_factors, /* i : Voice Factors */
+ const Word16 L_frame /* i : ACELP frame length */
)
{
Word16 i, j;
- Word16 max=0;
+ Word16 max_val=0;
Word32 scale;
Word16 scale_step;
Word16 exp, tmp;
@@ -2431,20 +2764,20 @@ void non_linearity_fx(
FOR ( i = j = 0; i < length_half; i++ )
{
tmp = abs_s(input[i]);
- if(GT_16(tmp,max))
+ if(GT_16(tmp,max_val))
{
j = i;
move16();
}
- max = s_max(max, tmp);
+ max_val = s_max(max_val, tmp);
}
- IF ( GT_16(max, shl(1,Q_inp)))
+ IF ( GT_16(max_val, shl(1,Q_inp)))
{
- exp = norm_s( max );
- tmp = div_s( shl(1, sub( 14, exp)), max ); /* Q(29-exp-Q_inp) */
+ exp = norm_s( max_val );
+ tmp = div_s( shl(1, sub( 14, exp)), max_val ); /* Q(29-exp-Q_inp) */
scale = L_shl( L_mult( 21955, tmp ), add(exp, sub(Q_inp,14)) ); /* Q31 */
}
ELSE
@@ -2501,24 +2834,24 @@ void non_linearity_fx(
prev_scale = non_linearity_scaled_copy( input, j, length_half, output, prev_scale, scale_step, en_abs );
- max = 0;
+ max_val = 0;
move16();
j = shr(length, 1);
FOR ( i = length_half; i < length; i++ )
{
tmp = abs_s(input[i]);
- if(GT_16(tmp,max))
+ if(GT_16(tmp,max_val))
{
j = i;
move16();
}
- max = s_max(max, tmp);
+ max_val = s_max(max_val, tmp);
}
- IF ( GT_16( max, shl( 1, Q_inp ) ))
+ IF ( GT_16( max_val, shl( 1, Q_inp ) ))
{
- exp = norm_s( max );
- tmp = div_s( shl(1, sub( 14, exp)), max ); /* Q(29-exp-Q_inp) */
+ exp = norm_s( max_val );
+ tmp = div_s( shl(1, sub( 14, exp)), max_val ); /* Q(29-exp-Q_inp) */
scale = L_shl( L_mult( 21955, tmp ), add(exp, sub(Q_inp, 14)) ); /* Q31 */
}
ELSE
@@ -2594,7 +2927,7 @@ void non_linearity_fx(
* create_random_vector()
*
* creates random number vector
-* Note: the abs(max) value coming out of create_random_vector should
+* Note: the abs(max_val) value coming out of create_random_vector should
* fit into the precision of Q6.
* -------------------------------------------------------------------*/
@@ -2677,9 +3010,9 @@ void create_random_vector_fx(
/*======================================================================================*/
void interp_code_5over2_fx(
- const Word16 inp_code_fx[], /* i : input vector Qx*/
- Word16 interp_code_fx[], /* o : output vector Qx*/
- const Word16 inp_length /* i : length of input vector */
+ const Word16 inp_code_fx[], /* i : input vector Qx*/
+ Word16 interp_code_fx[], /* o : output vector Qx*/
+ const Word16 inp_length /* i : length of input vector */
)
{
Word16 i, kk, kkp1, i_len2;
@@ -2772,9 +3105,9 @@ void interp_code_5over2_fx(
/*======================================================================================*/
void interp_code_4over2_fx(
- const Word16 inp_code_fx[], /* i : input vector Qx*/
- Word16 interp_code_fx[], /* o : output vector Qx*/
- const Word16 inp_length /* i : length of input vector */
+ const Word16 inp_code_fx[], /* i : input vector Qx*/
+ Word16 interp_code_fx[], /* o : output vector Qx*/
+ const Word16 inp_length /* i : length of input vector */
)
{
Word16 i, j;
@@ -2805,10 +3138,12 @@ void interp_code_4over2_fx(
* Reset the extra parameters only required for WB TBE synthesis
*-------------------------------------------------------------------*/
-void wb_tbe_extras_reset_synth_fx( Word16 state_lsyn_filt_shb[], Word16 state_lsyn_filt_dwn_shb[],
- Word16 state_32and48k_WB_upsample[]
- ,Word16 state_resamp_HB[]
- )
+void wb_tbe_extras_reset_synth_fx(
+ Word16 state_lsyn_filt_shb[],
+ Word16 state_lsyn_filt_dwn_shb[],
+ Word16 state_32and48k_WB_upsample[],
+ Word16 state_resamp_HB[]
+)
{
set16_fx( state_lsyn_filt_shb, 0, 2 * ALLPASSSECTIONS_STEEP );
set16_fx( state_lsyn_filt_dwn_shb, 0, 2 * ALLPASSSECTIONS_STEEP );
@@ -3081,15 +3416,15 @@ void elliptic_bpf_48k_generic_fx(
*-------------------------------------------------------------------*/
void synthesise_fb_high_band_fx(
- const Word16 excitation_in[], /* i : full band excitation */
+ const Word16 excitation_in[], /* i : full band excitation */
Word16 Q_fb_exc,
- Word16 output[], /* o : high band speech - 14.0 to 20 kHz */
- const Word32 fb_exc_energy, /* i : full band excitation energy */
- const Word16 ratio, /* i : energy ratio */
- const Word16 L_frame, /* i : ACELP frame length */
- const Word16 bfi, /* i : fec flag */
- Word16 *prev_fbbwe_ratio, /* o : previous frame energy for FEC */
- Word32 bpf_memory[][4], /* i/o: memory for elliptic bpf 48k */
+ Word16 output[], /* o : high band speech - 14.0 to 20 kHz */
+ const Word32 fb_exc_energy, /* i : full band excitation energy */
+ const Word16 ratio, /* i : energy ratio */
+ const Word16 L_frame, /* i : ACELP frame length */
+ const Word16 bfi, /* i : fec flag */
+ Word16 *prev_fbbwe_ratio, /* o : previous frame energy for FEC */
+ Word32 bpf_memory[][4], /* i/o: memory for elliptic bpf 48k */
Word16 bpf_memory_Q[],
Word16 Qout
)
@@ -3189,18 +3524,18 @@ void synthesise_fb_high_band_fx(
* Estimate mix factors for SHB excitation generation *
*-------------------------------------------------------------------*/
void Estimate_mix_factors_fx(
- const Word16 *shb_res, /* i : SHB LP residual in Q = Q_shb */
+ const Word16 *shb_res, /* i : SHB LP residual in Q = Q_shb */
const Word16 Q_shb,
- const Word16 *exc16kWhtnd, /* i : SHB transformed low band excitation Q_bwe_exc */
+ const Word16 *exc16kWhtnd, /* i : SHB transformed low band excitation Q_bwe_exc */
const Word16 Q_bwe_exc,
- const Word16 *White_exc16k_frac, /* i : Modulated envelope shaped white noise Q_frac */
+ const Word16 *White_exc16k_frac,/* i : Modulated envelope shaped white noise Q_frac */
const Word16 Q_frac,
- const Word32 pow1, /* i : SHB exc. power for normalization in Q_pow1 */
+ const Word32 pow1, /* i : SHB exc. power for normalization in Q_pow1 */
const Word16 Q_pow1,
- const Word32 pow22, /* i : White noise excitation for normalization in Q_pow22 */
+ const Word32 pow22, /* i : White noise excitation for normalization in Q_pow22 */
const Word16 Q_pow22,
- Word16 *vf_modified, /* o : Estimated voice factors */
- Word16 *vf_ind /* o : voice factors VQ index */
+ Word16 *vf_modified, /* o : Estimated voice factors */
+ Word16 *vf_ind /* o : voice factors VQ index */
)
{
Word16 shb_res_local[L_FRAME16k], WN_exc_local[L_FRAME16k];
@@ -3257,7 +3592,7 @@ void Estimate_mix_factors_fx(
temp_p1_p2 = Dot_product(temp_numer1, temp_numer2, length); /* 2*(Q_bwe_exc)+1 */
temp_p1_p3 = Dot_product(temp_numer2, temp_numer2, length); /* 2*(Q_bwe_exc)+1 */
- /* vf_modified[i] = min( max( (temp_p1_p2 / temp_p1_p3), 0.1f), 0.99f); */
+ /* vf_modified[i] = min( max_val( (temp_p1_p2 / temp_p1_p3), 0.1f), 0.99f); */
/* tmp = (temp_p1_p2 / temp_p1_p3); */
IF(temp_p1_p3>0)
{
@@ -3326,7 +3661,56 @@ void Estimate_mix_factors_fx(
return;
}
+#ifdef ADD_IVAS_TBE_CODE
+/*-------------------------------------------------------------------*
+ * tbe_celp_exc() *
+ * *
+ * Prepare adaptive part of TBE excitation *
+ *-------------------------------------------------------------------*/
+
+void tbe_celp_exc(
+ const int16_t element_mode, /* i : element mode */
+ const int16_t idchan, /* i : channel ID */
+ float* bwe_exc, /* i/o: BWE excitation */
+ const int16_t L_frame, /* i : frame length */
+ const int16_t L_subfr, /* i : subframe length */
+ const int16_t i_subfr, /* i : subframe index */
+ const int16_t T0, /* i : integer pitch lag */
+ const int16_t T0_frac, /* i : fraction of lag */
+ float* error, /* i/o: error */
+ const int16_t tdm_LRTD_flag /* i : LRTD stereo mode flag */
+)
+{
+ int16_t i, offset;
+ if (element_mode == IVAS_CPE_TD && idchan == 1 && !tdm_LRTD_flag)
+ {
+ return;
+ }
+
+ if (L_frame == L_FRAME)
+ {
+ offset = tbe_celp_exc_offset(T0, T0_frac);
+
+ for (i = 0; i < L_subfr * HIBND_ACB_L_FAC; i++)
+ {
+ bwe_exc[i + i_subfr * HIBND_ACB_L_FAC] = bwe_exc[i + i_subfr * HIBND_ACB_L_FAC - offset + (int16_t)*error];
+ }
+ *error += (float)offset - (float)T0 * HIBND_ACB_L_FAC - 0.25f * HIBND_ACB_L_FAC * (float)T0_frac;
+ }
+ else
+ {
+ offset = T0 * 2 + (int16_t)((float)T0_frac * 0.5f + 4 + 0.5f) - 4;
+ for (i = 0; i < L_subfr * 2; i++)
+ {
+ bwe_exc[i + i_subfr * 2] = bwe_exc[i + i_subfr * 2 - offset + (int16_t)*error];
+ }
+ *error += (float)offset - (float)T0 * 2 - 0.5f * (float)T0_frac;
+ }
+
+ return;
+}
+#endif
/*======================================================================================*/
/* FUNCTION : prep_tbe_exc_fx() */
/*--------------------------------------------------------------------------------------*/
@@ -3356,25 +3740,35 @@ void Estimate_mix_factors_fx(
/*======================================================================================*/
void prep_tbe_exc_fx(
- const Word16 L_frame_fx, /* i : length of the frame */
- const Word16 i_subfr_fx, /* i : subframe index */
- const Word16 gain_pit_fx, /* i : Pitch gain Q14*/
- const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/
- const Word16 code_fx[], /* i : algebraic excitation Q9*/
- const Word16 voice_fac_fx, /* i : voicing factor Q15*/
- Word16 *voice_factors_fx, /* o : TBE voicing factor Q15*/
- Word16 bwe_exc_fx[], /* i/o: excitation for TBE Q_exc*/
- const Word16 gain_preQ_fx, /* i : prequantizer excitation gain */
- const Word16 code_preQ_fx[], /* i : prequantizer excitation */
- const Word16 Q_exc, /* i : Excitation, bwe_exc Q-factor */
- Word16 T0, /* i : integer pitch variables Q0 */
- Word16 T0_frac, /* i : Fractional pitch variables Q0*/
- const Word16 coder_type, /* i : coding type */
- Word32 core_brate /* i :core bitrate */
+ const Word16 L_frame_fx, /* i : length of the frame */
+#ifdef ADD_IVAS_TBE_CODE
+ const Word16 L_subfr,
+#endif
+ const Word16 i_subfr_fx, /* i : subframe index */
+ const Word16 gain_pit_fx, /* i : Pitch gain Q14*/
+ const Word32 gain_code_fx, /* i : algebraic codebook gain 16+Q_exc*/
+ const Word16 code_fx[], /* i : algebraic excitation Q9*/
+ const Word16 voice_fac_fx, /* i : voicing factor Q15*/
+ Word16 *voice_factors_fx, /* o : TBE voicing factor Q15*/
+ Word16 bwe_exc_fx[], /* i/o: excitation for TBE Q_exc*/
+ const Word16 gain_preQ_fx, /* i : prequantizer excitation gain */
+ const Word16 code_preQ_fx[], /* i : prequantizer excitation */
+ const Word16 Q_exc, /* i : Excitation, bwe_exc Q-factor */
+ Word16 T0, /* i : integer pitch variables Q0 */
+ Word16 T0_frac, /* i : Fractional pitch variables Q0*/
+ const Word16 coder_type, /* i : coding type */
+ Word32 core_brate
+#ifdef ADD_IVAS_TBE_CODE
+ , /* i : core bitrate */
+ const int16_t element_mode, /* i : element mode */
+ const int16_t idchan, /* i : channel ID */
+ const int16_t flag_TD_BWE, /* i : flag indicating whether hTD_BWE exists */
+ const int16_t tdm_LRTD_flag /* i : LRTD stereo mode flag */
+#endif
)
{
Word16 i;
- Word16 tmp_code_fx[L_SUBFR * HIBND_ACB_L_FAC];
+ Word16 tmp_code_fx[2*L_SUBFR * HIBND_ACB_L_FAC];
Word16 tmp_code_preInt_fx[L_SUBFR];
Word16 gain_code16 = 0;
Word16 tmp /*, tmp1, tmp2*/;
@@ -3384,10 +3778,13 @@ void prep_tbe_exc_fx(
Word32 L_tmp, Ltemp1, Ltemp2;
Word32 tempQ31;
Word16 tempQ15;
+#ifndef ADD_IVAS_TBE_CODE
+ Word16 L_subfr = L_SUBFR;
+#endif
/**voice_factors = VF_0th_PARAM + VF_1st_PARAM * voice_fac + VF_2nd_PARAM * voice_fac * voice_fac;
= VF_0th_PARAM + voice_fac * (VF_1st_PARAM + VF_2nd_PARAM * voice_fac )
- *voice_factors = min( max(0.0f, *voice_factors), 1.0f); */
+ *voice_factors = min( max_val(0.0f, *voice_factors), 1.0f); */
tempQ31 = L_deposit_h( VF_1st_PARAM_FX );
tempQ15 = mac_r(tempQ31, VF_2nd_PARAM_FX, voice_fac_fx);
tempQ31 = L_deposit_h( VF_0th_PARAM_FX );
@@ -3409,12 +3806,22 @@ void prep_tbe_exc_fx(
*voice_factors_fx = s_min(s_max(*voice_factors_fx, 0), MAX_16);
move16();
-
+#ifdef ADD_IVAS_TBE_CODE
+ IF (EQ_16(element_mode, IVAS_CPE_TD) && EQ_16(idchan, 1) && !tdm_LRTD_flag)
+ {
+ IF (flag_TD_BWE && i_subfr == 0)
+ {
+ set16_fx(bwe_exc, 0, L_FRAME32k);
+ }
+ return;
+ }
+
+#endif
IF ( EQ_16(L_frame_fx,L_FRAME))
{
- interp_code_5over2_fx( code_fx, tmp_code_fx, L_SUBFR ); /* code: Q9, tmp_code: Q9 */
+ interp_code_5over2_fx( code_fx, tmp_code_fx, L_subfr); /* code: Q9, tmp_code: Q9 */
gain_code16 = round_fx( L_shl( gain_code_fx, Q_exc ) ); /*Q_exc */
- FOR ( i = 0; i < L_SUBFR * HIBND_ACB_L_FAC; i++ )
+ FOR ( i = 0; i < L_subfr* HIBND_ACB_L_FAC; i++ )
{
L_tmp = L_mult( gain_code16, tmp_code_fx[i] ); /* Q9 + Q_exc + 1*/
L_tmp = L_shl( L_tmp, 5 ); /* Q9 + Q_exc + Q6*/
@@ -3427,7 +3834,7 @@ void prep_tbe_exc_fx(
{
IF( gain_preQ_fx != 0 )
{
- FOR( i = 0; i < L_SUBFR; i++ )
+ FOR( i = 0; i < L_subfr; i++ )
{
/*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */
Ltemp1 = Mult_32_16(gain_code_fx, code_fx[i]); /* Q16 + Q9 + 1 - 16 = Q10 */
@@ -3441,7 +3848,7 @@ void prep_tbe_exc_fx(
}
ELSE
{
- FOR( i = 0; i < L_SUBFR; i++ )
+ FOR( i = 0; i < L_subfr; i++ )
{
/*code in the encoder is Q9 and there is no <<1 with Mult_32_16 Q16 * Q9 -> Q9 */
Ltemp1 = Mult_32_16(gain_code_fx, code_fx[i]); /* Q16 + Q9 + 1 - 16 = Q10 */
@@ -3450,8 +3857,8 @@ void prep_tbe_exc_fx(
}
}
- interp_code_4over2_fx( tmp_code_preInt_fx, tmp_code_fx, L_SUBFR ); /* o: tmp_code in Q_exc */
- FOR ( i = 0; i < L_SUBFR * 2; i++ )
+ interp_code_4over2_fx( tmp_code_preInt_fx, tmp_code_fx, L_subfr); /* o: tmp_code in Q_exc */
+ FOR ( i = 0; i < L_subfr * 2; i++ )
{
L_tmp = L_mult(gain_pit_fx, bwe_exc_fx[i + i_subfr_fx*2]); /*Q14+Q_exc+1 */
tmp = round_fx(L_shl(L_tmp, 1 /* (Q_exc+16)-(14+Q_exc+1)*/ )); /* tmp in Q_exc */
@@ -3532,12 +3939,17 @@ void wb_tbe_extras_reset_fx(
return;
}
+/*-------------------------------------------------------------------*
+* get_tbe_bits() *
+* *
+* Determine TBE bit consumption per frame from bitrate *
+*-------------------------------------------------------------------*/
Word16 get_tbe_bits_fx(
- Word32 bitrate,
- Word16 bandwidth
- ,Word16 rf_mode
+ const Word32 total_brate, /* o : TBE bit consumption per frame */
+ const Word16 bwidth, /* i : overall bitrate */
+ const Word16 rf_mode /* i : bandwidht mode */
)
{
Word16 i, bits = 0;
@@ -3547,13 +3959,13 @@ Word16 get_tbe_bits_fx(
/* TBE bits for core, primary frame */
test();
test();
- IF( (EQ_16(bandwidth, WB ))&&(EQ_32(bitrate,ACELP_13k20)))
+ IF( (EQ_16(bwidth, WB ))&&(EQ_32(total_brate,ACELP_13k20)))
{
/* Gain frame: 4, Gain shapes: 0, and LSFs: 2 */
bits = NUM_BITS_SHB_FrameGain_LBR_WB + NUM_BITS_LBR_WB_LSF;
move16();
}
- ELSE IF( (EQ_16(bandwidth, SWB ))&&(EQ_32(bitrate,ACELP_13k20)))
+ ELSE IF( (EQ_16(bwidth, SWB ))&&(EQ_32(total_brate,ACELP_13k20)))
{
/* Gain frame: 5, Gain shapes: 5, and lowrate LSFs: 8 */
bits = NUM_BITS_SHB_FRAMEGAIN + NUM_BITS_SHB_SUBGAINS + 8;
@@ -3564,20 +3976,20 @@ Word16 get_tbe_bits_fx(
{
test();
test();
- IF( (EQ_16(bandwidth, WB ))&&(EQ_32(bitrate,ACELP_9k60)))
+ IF( (EQ_16(bwidth, WB ))&&(EQ_32(total_brate,ACELP_9k60)))
{
bits = NUM_BITS_LBR_WB_LSF + NUM_BITS_SHB_FrameGain_LBR_WB;
move16();
}
- ELSE IF( (EQ_16( bandwidth, SWB ))||(EQ_16(bandwidth,FB)))
+ ELSE IF( (EQ_16( bwidth, SWB ))||(EQ_16(bwidth,FB)))
{
test();
- IF( EQ_32(bitrate, ACELP_9k60))
+ IF( EQ_32(total_brate, ACELP_9k60))
{
bits = NUM_BITS_SHB_FRAMEGAIN + NUM_BITS_SHB_SUBGAINS + 8;
move16();
}
- ELSE IF( (GE_32( bitrate, ACELP_13k20 ))&&(LE_32(bitrate,ACELP_32k)))
+ ELSE IF( (GE_32( total_brate, ACELP_13k20 ))&&(LE_32(total_brate,ACELP_32k)))
{
bits = NUM_BITS_SHB_SUBGAINS + NUM_BITS_SHB_FRAMEGAIN + NUM_LSF_GRID_BITS + MIRROR_POINT_BITS;
move16();
@@ -3588,19 +4000,19 @@ Word16 get_tbe_bits_fx(
}
}
- if ( GE_32( bitrate, ACELP_24k40 ))
+ if ( GE_32( total_brate, ACELP_24k40 ))
{
bits = add( bits, NUM_BITS_SHB_ENER_SF + NUM_BITS_SHB_VF + NUM_BITS_SHB_RES_GS*NB_SUBFR16k );
}
test();
test();
- if( EQ_16(bandwidth, SWB)&&(EQ_32(bitrate,ACELP_16k40)||EQ_32(bitrate,ACELP_24k40)))
+ if( EQ_16(bwidth, SWB)&&(EQ_32(total_brate,ACELP_16k40)||EQ_32(total_brate,ACELP_24k40)))
{
bits = add( bits, BITS_TEC+BITS_TFA );
}
- if ( EQ_16(bandwidth, FB))
+ if ( EQ_16(bwidth, FB))
{
/* full band slope */
bits = add( bits, 4 );
diff --git a/lib_com/syn_12k8_fx.c b/lib_com/syn_12k8_fx.c
index c774c7c684fdcfa0b66768c6506c6bcff6227efc..0b3657a55ad9f6384b66329ff901c52335e13f6f 100644
--- a/lib_com/syn_12k8_fx.c
+++ b/lib_com/syn_12k8_fx.c
@@ -1,11 +1,10 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
-#include "options.h" /* Compilation switches */
+#include
+#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h"
/*===========================================================================*/
@@ -36,9 +35,9 @@
void syn_12k8_fx(
Word16 L_frame,
const Word16 *Aq, /* i : LP filter coefficients Q12 */
- const Word16 *exc, /* i : input signal Q_exc */
- Word16 *synth, /* o : output signal Q_syn */
- Word16 *mem, /* i/o: initial filter states Q_syn */
+ const Word16 *exc, /* i : input signal Q_exc */
+ Word16 *synth, /* o : output signal Q_syn */
+ Word16 *mem, /* i/o: initial filter states Q_syn */
const Word16 update_m, /* i : update memory flag: 0 --> no memory update Q0 */
/* 1 --> update of memory */
const Word16 Q_exc, /* i : Excitation scaling Q0 */
diff --git a/lib_com/syn_filt_fx.c b/lib_com/syn_filt_fx.c
index 05e1577ff5616df971278ddf3858dfd4ab168c5b..688202250540656c1ff05286f7129f56e6ee9124 100644
--- a/lib_com/syn_filt_fx.c
+++ b/lib_com/syn_filt_fx.c
@@ -2,13 +2,12 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "basop_util.h"
#include "prot_fx.h" /* Function prototypes */
#include "rom_com_fx.h" /* Static table prototypes */
-#include "stl.h"
static Word32 syn_kern_2(Word32 L_tmp, const Word16 a[], const Word16 y[])
{
@@ -62,7 +61,7 @@ void syn_filt_s_lc_fx(
const Word16 shift, /* i : scaling to apply Q0 */
const Word16 a[], /* i : LP filter coefficients Q12 */
const Word16 x[], /* i : input signal Qx */
- Word16 y[], /* o : output signal Qx-s */
+ Word16 y[], /* o : output signal Qx-s */
const Word16 lg /* i : size of filtering Q0 */
)
{
@@ -109,9 +108,9 @@ void Syn_filt_s(
const Word16 a[], /* i : LP filter coefficients Q12 */
const Word16 m, /* i : order of LP filter Q0 */
const Word16 x[], /* i : input signal Qx */
- Word16 y[], /* o : output signal Qx-s */
+ Word16 y[], /* o : output signal Qx-s */
const Word16 lg, /* i : size of filtering Q0 */
- Word16 mem[], /* i/o: memory associated with this filtering. Qx-s */
+ Word16 mem[], /* i/o: memory associated with this filtering. Qx-s */
const Word16 update /* i : 0=no update, 1=update of memory. Q0 */
)
{
@@ -236,17 +235,17 @@ void E_UTIL_synthesis(const Word16 shift, const Word16 a[], const Word16 x[], Wo
void synth_mem_updt2(
const Word16 L_frame, /* i : frame length */
const Word16 last_L_frame, /* i : frame length */
- Word16 old_exc[], /* i/o: excitation buffer */
- Word16 mem_syn_r[], /* i/o: synthesis filter memory */
- Word16 mem_syn2[], /* o : synthesis filter memory for find_target */
- Word16 mem_syn[], /* o : synthesis filter memory for find_target */
+ Word16 old_exc[], /* i/o: excitation buffer */
+ Word16 mem_syn_r[], /* i/o: synthesis filter memory */
+ Word16 mem_syn2[], /* o : synthesis filter memory for find_target */
+ Word16 mem_syn[], /* o : synthesis filter memory for find_target */
const Word16 dec /* i : flag for decoder indication */
)
{
Word16 mem_syn_r_size_old, mem_syn_r_size_new;
/* Residual and update old_exc */
- IF( EQ_16(dec, DEC))
+ IF( GE_16(dec, DEC))
{
lerp( old_exc+L_EXC_MEM_DEC-(last_L_frame+last_L_frame/2), old_exc+L_EXC_MEM_DEC-(L_frame+L_frame/2), L_frame+L_frame/2, last_L_frame+last_L_frame/2 );
}
@@ -254,7 +253,25 @@ void synth_mem_updt2(
{
lerp( old_exc+L_EXC_MEM-last_L_frame, old_exc+L_EXC_MEM-L_frame, L_frame, last_L_frame );
}
-
+#ifdef ADD_LRTD
+ IF (EQ_16(dec, DEC_IVAS) )
+ {
+ IF (EQ_16(L_frame, L_FRAME16k))
+ {
+ /* find scaling factor */
+ PME()
+ en1 = 1.25f * sum2_f(mem_syn2, M);
+ en2 = sum2_f(mem_syn_r + L_SYN_MEM - M, M);
+
+ loc_rat = sqrtf(en2) / (sqrtf(en1) + 0.01f);
+ /* scale synthesis filter memory */
+ FOR (i = 0; i < M; i++)
+ {
+ mem_syn_r[L_SYN_MEM - M + i] *= loc_rat;
+ }
+ }
+ }
+#endif
/*Resamp memory*/
/*Size of LPC syn memory*/
/* 1.25/20.0 = 1.0/16.0 -> shift 4 to the right. */
diff --git a/lib_com/tcq_position_arith_fx.c b/lib_com/tcq_position_arith_fx.c
index 48dc303aaa9efefe71cc86cd2baaa0bf0d345fed..86deb5a2870ea9eb21ddef32dad6a2b2ad2d9724 100644
--- a/lib_com/tcq_position_arith_fx.c
+++ b/lib_com/tcq_position_arith_fx.c
@@ -2,17 +2,17 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
-#include
-#include
-#include
+#include
#include "options.h" /* Compilation switches */
#include "stl.h"
#include "rom_com_fx.h"
#include "prot_fx.h"
-Word32 ar_div(Word32 num, Word32 denum)
+Word32 ar_div(
+ Word32 num,
+ Word32 denum
+)
{
Word16 exp1, exp2, exp, i;
Word32 varout;
@@ -65,7 +65,10 @@ Word32 ar_div(Word32 num, Word32 denum)
return varout;
}
-static void bitstream_save_bit(PBITSTREAM_FX pBS, Word32 bit)
+static void bitstream_save_bit(
+ PBITSTREAM_FX pBS,
+ Word32 bit
+)
{
UWord8 cur;
@@ -90,7 +93,9 @@ static void bitstream_save_bit(PBITSTREAM_FX pBS, Word32 bit)
return;
}
-static UWord32 bitstream_load_bit(PBITSTREAM_FX pBS)
+static UWord32 bitstream_load_bit(
+ PBITSTREAM_FX pBS
+)
{
UWord32 bit;
Word16 *curPos;
@@ -118,7 +123,10 @@ static UWord32 bitstream_load_bit(PBITSTREAM_FX pBS)
return bit;
}
-static void bitstream_rollback(PBITSTREAM_FX pBS, Word32 numBits)
+static void bitstream_rollback(
+ PBITSTREAM_FX pBS,
+ Word32 numBits
+)
{
FOR ( ; numBits > 0; numBits--)
@@ -136,7 +144,10 @@ static void bitstream_rollback(PBITSTREAM_FX pBS, Word32 numBits)
return;
}
-static void transmission_bits( PARCODEC_FX arInst, Word32 bit )
+static void transmission_bits(
+ PARCODEC_FX arInst,
+ Word32 bit
+)
{
bitstream_save_bit( arInst->bsInst, bit );
arInst->num_bits = L_add(arInst->num_bits, 1);
@@ -152,7 +163,10 @@ static void transmission_bits( PARCODEC_FX arInst, Word32 bit )
return;
}
-static Word32 ar_make_model_fx( const Word16 *freq, Word16 *model, Word16 len )
+static Word32 ar_make_model_fx(
+ const Word16 *freq,
+ Word16 *model,
+ const Word16 len )
{
Word16 dist;
Word32 sum = 0;
@@ -203,7 +217,11 @@ static Word32 ar_make_model_fx( const Word16 *freq, Word16 *model, Word16 len )
return (model[0] > model[1]);
}
-void ar_encoder_start_fx( PARCODEC_FX arInst, PBITSTREAM_FX bsInst, Word32 max_bits )
+void ar_encoder_start_fx(
+ PARCODEC_FX arInst,
+ PBITSTREAM_FX bsInst,
+ const Word32 max_bits
+)
{
arInst->bsInst = bsInst;
move32();
@@ -219,7 +237,11 @@ void ar_encoder_start_fx( PARCODEC_FX arInst, PBITSTREAM_FX bsInst, Word32 max_b
move32();
}
-static void ar_encode_fx( PARCODEC_FX arInst, Word16 const *model, Word32 symbol )
+static void ar_encode_fx(
+ PARCODEC_FX arInst,
+ const Word16 *model,
+ Word32 symbol
+)
{
Word32 range, high, low;
@@ -277,7 +299,11 @@ static void ar_encode_fx( PARCODEC_FX arInst, Word16 const *model, Word32 symbol
return;
}
-static void ar_encode_uniform_fx( PARCODEC_FX arInst, UWord32 data, Word32 bits )
+static void ar_encode_uniform_fx(
+ PARCODEC_FX arInst,
+ UWord32 data,
+ const Word32 bits
+)
{
Word32 i;
@@ -290,7 +316,9 @@ static void ar_encode_uniform_fx( PARCODEC_FX arInst, UWord32 data, Word32 bits
return;
}
-void ar_encoder_done_fx( PARCODEC_FX arInst )
+void ar_encoder_done_fx(
+ PARCODEC_FX arInst
+)
{
arInst->bits_to_follow ++;
move16();
@@ -299,7 +327,10 @@ void ar_encoder_done_fx( PARCODEC_FX arInst )
return;
}
-void ar_decoder_start_fx( PARCODEC_FX arInst, PBITSTREAM_FX bsInst )
+void ar_decoder_start_fx(
+ PARCODEC_FX arInst,
+ PBITSTREAM_FX bsInst
+)
{
Word16 i;
@@ -319,7 +350,10 @@ void ar_decoder_start_fx( PARCODEC_FX arInst, PBITSTREAM_FX bsInst )
return;
}
-static Word16 ar_decode_fx( PARCODEC_FX arInst, Word16 const *model )
+static Word16 ar_decode_fx(
+ PARCODEC_FX arInst,
+ const Word16 *model
+)
{
Word32 range, high, low, value, i;
Word16 cum;
@@ -374,14 +408,19 @@ static Word16 ar_decode_fx( PARCODEC_FX arInst, Word16 const *model )
return (symbol - 1);
}
-void ar_decoder_done_fx( PARCODEC_FX arInst )
+void ar_decoder_done_fx(
+ PARCODEC_FX arInst
+)
{
bitstream_rollback( arInst->bsInst, AR_BITS - 2 );
return;
}
-static Word16 quantize_fx( Word16 val, Word16 D)
+static Word16 quantize_fx(
+ Word16 val,
+ const Word16 D
+)
{
Word16 qval4_fx;
Word16 retval_fx;
@@ -402,7 +441,10 @@ static Word16 quantize_fx( Word16 val, Word16 D)
return retval_fx;
}
-static Word32 GetBitsFromPulses_fx(Word16 m, Word16 n)
+static Word32 GetBitsFromPulses_fx(
+ Word16 m,
+ Word16 n
+)
{
Word16 i, tmp, integer_fx, temp_fx1, temp_fx2, exp1, exp2;
Word32 temp32;
@@ -484,8 +526,19 @@ static Word32 GetBitsFromPulses_fx(Word16 m, Word16 n)
}
static
-void TCQnew_fx( Word32 *v_fx, Word32 scale_fx, Word16 Qscale,
- Word16 length, Word16 *vout_fx, Word16 pulses, Word16 *pulsesout, Word16* nzposout, Word32 *savedstates, Word32 * lasttrellislevel, Word32 terminate)
+void TCQnew_fx(
+ Word32 *v_fx,
+ Word32 scale_fx,
+ Word16 Qscale,
+ Word16 length,
+ Word16 *vout_fx,
+ Word16 pulses,
+ Word16 *pulsesout,
+ Word16* nzposout,
+ Word32 *savedstates,
+ Word32 * lasttrellislevel,
+ Word32 terminate
+)
{
Word16 i, st, dminpos, position;
Word16 pulsesnum, nzpos = 0;
@@ -656,8 +709,22 @@ void TCQnew_fx( Word32 *v_fx, Word32 scale_fx, Word16 Qscale,
return;
}
-Word32 GetISCScale_fx( Word32 *quants_fx, Word16 size, Word32 bits_fx, Word16 *magn_fx, Word32 *qscale_fx, Word32 *surplus_fx, Word16 *pulses, Word32* savedstates, Word32 noTCQ,
- Word16 *nzpout, Word16 *bcount, Word32 *abuffer, Word16 *mbuffer, Word32 *sbuffer)
+Word32 GetISCScale_fx(
+ Word32 *quants_fx,
+ Word16 size,
+ Word32 bits_fx,
+ Word16 *magn_fx,
+ Word32 *qscale_fx,
+ Word32 *surplus_fx,
+ Word16 *pulses,
+ Word32* savedstates,
+ Word32 noTCQ,
+ Word16 *nzpout,
+ Word16 *bcount,
+ Word32 *abuffer,
+ Word16 *mbuffer,
+ Word32 *sbuffer
+)
{
Word32 pos, terminate, trellislevel, st;
Word32 lasttrellislevel;
@@ -693,7 +760,7 @@ Word32 GetISCScale_fx( Word32 *quants_fx, Word16 size, Word32 bits_fx, Word16 *m
pulsesnum = 0;
move16();
- IF( surplus_fx != 0 )
+ IF( surplus_fx != NULL )
{
/* *surplus_fx += bits_fx; */
*surplus_fx = L_add(*surplus_fx, bits_fx);
@@ -707,7 +774,7 @@ Word32 GetISCScale_fx( Word32 *quants_fx, Word16 size, Word32 bits_fx, Word16 *m
*nzpout = 0;
move16();
- if ( pulses != 0 )
+ if ( pulses != NULL)
{
*pulses = pulsesnum;
move16();
@@ -1182,7 +1249,7 @@ Word32 GetISCScale_fx( Word32 *quants_fx, Word16 size, Word32 bits_fx, Word16 *m
move16();
}
test();
- IF ( *nzpout > 1 && bcount != 0 )
+ IF ( GT_16(*nzpout, 1) && bcount != NULL)
{
flag_g1 = 0;
move16();
@@ -1230,7 +1297,13 @@ Word32 GetISCScale_fx( Word32 *quants_fx, Word16 size, Word32 bits_fx, Word16 *m
return L_shl(magnbits_fx, 1);
}
-void TCQLSB_fx(Word16 bcount, Word32 *abuffer_fx, Word16 *mbuffer_fx, Word32 *sbuffer_fx, Word16 *dpath)
+void TCQLSB_fx(
+ Word16 bcount,
+ Word32 *abuffer_fx,
+ Word16 *mbuffer_fx,
+ Word32 *sbuffer_fx,
+ Word16 *dpath
+)
{
Word16 i, st, dminpos, position;
Word16 q_fx = 6554;/*Q15*/
@@ -1436,7 +1509,11 @@ void TCQLSB_fx(Word16 bcount, Word32 *abuffer_fx, Word16 *mbuffer_fx, Word32 *sb
return;
}
-void TCQLSBdec_fx( Word16 *dpath, Word16 *mbuffer, Word16 bcount )
+void TCQLSBdec_fx(
+ Word16 *dpath,
+ Word16 *mbuffer,
+ Word16 bcount
+)
{
/*float q = QTCQ;*/
Word16 q = 1;/*x5*/
@@ -1471,7 +1548,12 @@ void TCQLSBdec_fx( Word16 *dpath, Word16 *mbuffer, Word16 bcount )
return;
}
-void RestoreTCQ_fx( Word16 * magn, Word16 size, Word16 *bcount, Word16 *mbuffer)
+void RestoreTCQ_fx(
+ Word16 * magn,
+ Word16 size,
+ Word16 *bcount,
+ Word16 *mbuffer
+)
{
Word16 i, nzpos = 0, flag_g1 = 0;
@@ -1512,7 +1594,12 @@ void RestoreTCQ_fx( Word16 * magn, Word16 size, Word16 *bcount, Word16 *mbuffer)
return;
}
-void RestoreTCQdec_fx( Word16 * magn, Word16 size, Word16 *bcount, Word16 *mbuffer)
+void RestoreTCQdec_fx(
+ Word16 * magn,
+ Word16 size,
+ Word16 *bcount,
+ Word16 *mbuffer
+)
{
Word16 i, nzpos = 0, flag_g1 = 0;
@@ -1557,14 +1644,20 @@ void RestoreTCQdec_fx( Word16 * magn, Word16 size, Word16 *bcount, Word16 *mbuff
return;
}
-void InitLSBTCQ_fx(Word16 *bcount)
+void InitLSBTCQ_fx(
+ Word16 *bcount
+)
{
*bcount = 0;
move16();
return;
}
-void SaveTCQdata_fx( PARCODEC_FX arInst, Word16 *dpath, Word16 bcount)
+void SaveTCQdata_fx(
+ PARCODEC_FX arInst,
+ Word16 *dpath,
+ Word16 bcount
+)
{
Word16 i;
FOR ( i = 0; i < bcount; i++)
@@ -1574,7 +1667,11 @@ void SaveTCQdata_fx( PARCODEC_FX arInst, Word16 *dpath, Word16 bcount)
return;
}
-void LoadTCQdata_fx( PARCODEC_FX arInst, Word16 *dpath, Word16 bcount)
+void LoadTCQdata_fx(
+ PARCODEC_FX arInst,
+ Word16 *dpath,
+ Word16 bcount
+)
{
Word32 i;
FOR ( i = 0; i < bcount; i++)
@@ -1586,7 +1683,12 @@ void LoadTCQdata_fx( PARCODEC_FX arInst, Word16 *dpath, Word16 bcount)
}
-Word32 encode_position_ari_fx(PARCODEC_FX parenc, Word16* quants, Word16 size, Word32* est_bits_frame_fx)
+Word32 encode_position_ari_fx(
+ PARCODEC_FX parenc,
+ Word16* quants,
+ Word16 size,
+ Word32* est_bits_frame_fx
+)
{
Word16 i, tmp;
Word16 nz = 0, pulses = 0;
@@ -1734,7 +1836,14 @@ Word32 encode_position_ari_fx(PARCODEC_FX parenc, Word16* quants, Word16 size, W
}
return bits_fx;
}
-Word32 encode_magnitude_usq_fx(ARCODEC_FX* parenc, Word16* magn_fx, Word16 size, Word16 npulses, Word16 nzpos, Word32* est_frame_bits_fx)
+Word32 encode_magnitude_usq_fx(
+ ARCODEC_FX* parenc,
+ Word16* magn_fx,
+ Word16 size,
+ Word16 npulses,
+ Word16 nzpos,
+ Word32* est_frame_bits_fx
+)
{
Word16 i, j, k, tmp, magnp, magnzp;
Word16 magn_position[MAX_PULSES];
@@ -1839,7 +1948,15 @@ Word32 encode_magnitude_usq_fx(ARCODEC_FX* parenc, Word16* magn_fx, Word16 size,
}
return bits_fx;
}
-Word32 encode_magnitude_tcq_fx(ARCODEC_FX* parenc, Word16* magn_fx, Word16 size, Word16 npulses, Word16 nzpos, Word32* savedstates, Word32* est_frame_bits_fx)
+Word32 encode_magnitude_tcq_fx(
+ ARCODEC_FX* parenc,
+ Word16* magn_fx,
+ Word16 size,
+ Word16 npulses,
+ Word16 nzpos,
+ Word32* savedstates,
+ Word32* est_frame_bits_fx
+)
{
Word32 tcq_bits_fx, bits_fx/*, est_frame_bits_fx*/;
Word16 prob0_fx, prob1_fx, num, denum, quantum1_fx, quantum2_fx;
@@ -1939,7 +2056,13 @@ Word32 encode_magnitude_tcq_fx(ARCODEC_FX* parenc, Word16* magn_fx, Word16 size,
return bits_fx;
}
-Word32 encode_signs_fx(ARCODEC_FX* parenc, Word16* magn, Word16 size, Word16 npos, Word32* est_frame_bits_fx)
+Word32 encode_signs_fx(
+ ARCODEC_FX* parenc,
+ Word16* magn,
+ Word16 size,
+ Word16 npos,
+ Word32* est_frame_bits_fx
+)
{
Word32 i, sign;
@@ -1959,7 +2082,13 @@ Word32 encode_signs_fx(ARCODEC_FX* parenc, Word16* magn, Word16 size, Word16 npo
return L_deposit_h(npos);
}
-void decode_position_ari_fx(PARCODEC_FX pardec, Word16 size, Word16 npulses, Word16* nz, Word16* position)
+void decode_position_ari_fx(
+ PARCODEC_FX pardec,
+ Word16 size,
+ Word16 npulses,
+ Word16* nz,
+ Word16* position
+)
{
Word16 i, tmp, nzp;
Word16 mode_num_nz[TCQ_MAX_BAND_SIZE];
@@ -2130,7 +2259,14 @@ void decode_position_ari_fx(PARCODEC_FX pardec, Word16 size, Word16 npulses, Wor
return;
}
-void decode_magnitude_usq_fx(ARCODEC_FX* pardec, Word16 size, Word16 npulses, Word16 nzpos, Word16* positions, Word16* out)
+void decode_magnitude_usq_fx(
+ ARCODEC_FX* pardec,
+ Word16 size,
+ Word16 npulses,
+ Word16 nzpos,
+ Word16* positions,
+ Word16* out
+)
{
Word16 i, magnp, magnzp;
Word16 magns[TCQ_MAX_BAND_SIZE], magncout = 0;
@@ -2295,7 +2431,15 @@ void decode_magnitude_usq_fx(ARCODEC_FX* pardec, Word16 size, Word16 npulses, Wo
return;
}
-void decode_mangitude_tcq_fx(ARCODEC_FX* pardec, Word16 size, Word16 npulses, Word16 nzpos, Word16* positions, Word16* out, Word32* surplus_fx)
+void decode_mangitude_tcq_fx(
+ ARCODEC_FX* pardec,
+ Word16 size,
+ Word16 npulses,
+ Word16 nzpos,
+ Word16* positions,
+ Word16* out,
+ Word32* surplus_fx
+)
{
Word32 tcq_bits_fx, bits_fx/*, surplus_fx*/;
Word16 prob0_fx, prob1_fx, num, denum, quantum1_fx, quantum2_fx;
@@ -2458,7 +2602,11 @@ void decode_mangitude_tcq_fx(ARCODEC_FX* pardec, Word16 size, Word16 npulses, Wo
return;
}
-void decode_signs_fx(ARCODEC_FX* pardec, Word16 size, Word16* out)
+void decode_signs_fx(
+ ARCODEC_FX* pardec,
+ Word16 size,
+ Word16* out
+)
{
Word16 i;
@@ -2479,7 +2627,11 @@ void decode_signs_fx(ARCODEC_FX* pardec, Word16 size, Word16* out)
return;
}
-Word16 GetScale_fx( Word16 blen, Word32 bits_fx/*Q16*/, Word32 *surplus_fx/*Q16*/)
+Word16 GetScale_fx(
+ Word16 blen,
+ Word32 bits_fx/*Q16*/,
+ Word32 *surplus_fx/*Q16*/
+)
{
Word16 pulses = MAX_PULSES, p_est, exp, exp1, exp2, magicnum;
Word32 t, a, b, ab, estbits_fx = 0;
diff --git a/lib_com/tcx_ltp.c b/lib_com/tcx_ltp.c
index b23037e29f1103c87dd768158bf32942ec6bdabf..5bf671677ca946d7548179b3eb274b68fadcdeae 100644
--- a/lib_com/tcx_ltp.c
+++ b/lib_com/tcx_ltp.c
@@ -1,19 +1,25 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
-#include
+#include
#include "options.h"
#include "prot_fx.h"
-#include "stl.h"
#include "cnst_fx.h"
#include "basop_util.h"
#include "rom_com_fx.h"
-#define ALPHA 27853/*0.85f Q15*/
+/*-------------------------------------------------------------------
+ * Local constants
+ *-------------------------------------------------------------------*/
+#define ALPHA 27853/*0.85f Q15*/
-void tcx_ltp_get_lpc(Word16 *x, Word16 L, Word16 *A, Word16 order)
+void tcx_ltp_get_lpc(
+ Word16 *x,
+ const Word16 L,
+ Word16 *A,
+ const Word16 order
+)
{
Word16 i, j, s, s2, tmp;
Word32 r, L_tmp;
@@ -100,7 +106,19 @@ void tcx_ltp_get_lpc(Word16 *x, Word16 L, Word16 *A, Word16 order)
}
-static void tcx_ltp_get_zir( Word16 *zir, Word16 length, Word16 *synth_ltp, Word16 *synth, Word16 *A, Word16 lpcorder, Word16 gain, Word16 pitch_int, Word16 pitch_fr, Word16 pitres, Word16 filtIdx )
+static void tcx_ltp_get_zir(
+ Word16 *zir,
+ const Word16 length,
+ Word16 *synth_ltp,
+ Word16 *synth,
+ Word16 *A,
+ const Word16 lpcorder,
+ const Word16 gain,
+ const Word16 pitch_int,
+ const Word16 pitch_fr,
+ const Word16 pitres,
+ const Word16 filtIdx
+)
{
Word16 buf[TCXLTP_LTP_ORDER], alpha, step;
Word16 *x0, *x1;
@@ -175,12 +193,12 @@ static void tcx_ltp_get_zir( Word16 *zir, Word16 length, Word16 *synth_ltp, Word
}
void predict_signal(
- const Word16 excI[], /* i : input excitation buffer */
- Word16 excO[], /* o : output excitation buffer */
- const Word16 T0, /* i : integer pitch lag */
- Word16 frac, /* i : fraction of lag */
- const Word16 frac_max,/* i : max fraction */
- const Word16 L_subfr /* i : subframe size */
+ const Word16 excI[], /* i : input excitation buffer */
+ Word16 excO[], /* o : output excitation buffer */
+ const Word16 T0, /* i : integer pitch lag */
+ Word16 frac, /* i : fraction of lag */
+ const Word16 frac_max, /* i : max fraction */
+ const Word16 L_subfr /* i : subframe size */
)
{
Word16 j;
@@ -215,17 +233,18 @@ void predict_signal(
}
-static void tcx_ltp_synth_filter( Word16 *synth_ltp,
- Word16 *synth,
- Word16 length,
- Word16 pitch_int,
- Word16 pitch_fr,
- Word16 gain,
- Word16 pitch_res
- ,Word16 *zir /* can be NULL */
- ,Word16 fade /* 0=normal, +1=fade-in, -1=fade-out */
- ,Word16 filtIdx
- )
+static void tcx_ltp_synth_filter(
+ Word16 *synth_ltp,
+ Word16 *synth,
+ Word16 length,
+ Word16 pitch_int,
+ Word16 pitch_fr,
+ Word16 gain,
+ Word16 pitch_res,
+ Word16 *zir, /* can be NULL */
+ Word16 fade, /* 0=normal, +1=fade-in, -1=fade-out */
+ Word16 filtIdx
+ )
{
Word16 *x0, *x1;
Word16 *y0, *y1;
@@ -319,16 +338,17 @@ static void tcx_ltp_synth_filter( Word16 *synth_ltp,
}
}
-Word16 tcx_ltp_decode_params( Word16 *ltp_param,
- Word16 *pitch_int,
- Word16 *pitch_fr,
- Word16 *gain,
- Word16 pitmin,
- Word16 pitfr1,
- Word16 pitfr2,
- Word16 pitmax,
- Word16 pitres
- )
+Word16 tcx_ltp_decode_params(
+ Word16 *ltp_param,
+ Word16 *pitch_int,
+ Word16 *pitch_fr,
+ Word16 *gain,
+ Word16 pitmin,
+ Word16 pitfr1,
+ Word16 pitfr2,
+ Word16 pitmax,
+ Word16 pitres
+)
{
Word16 tmp, tmp2;
@@ -404,66 +424,96 @@ Word16 tcx_ltp_decode_params( Word16 *ltp_param,
return 0;
}
-void tcx_ltp_post( Word8 tcxltp_on,
- Word16 core,
- Word16 L_frame,
- Word16 L_frame_core,
- Word16 delay,
- Word16 *sig,
- Word16 *tcx_buf,
- Word16 tcx_buf_len,
- Word16 bfi,
- Word16 pitch_int,
- Word16 pitch_fr,
- Word16 gain,
- Word16 *pitch_int_past,
- Word16 *pitch_fr_past,
- Word16 *gain_past,
- Word16 *filtIdx_past,
- Word16 pitres,
- Word16 *pitres_past,
- Word16 damping,
- Word16 SideInfoOnly,
- Word16 *mem_in,
- Word16 *mem_out,
- Word32 bitrate
- )
+void tcx_ltp_post(
+ Decoder_State_fx* st,
+ TCX_LTP_DEC_HANDLE hTcxLtpDec,
+ Word16 core,
+ Word16 output_frame,
+ Word16 delay,
+ Word16 *sig,
+ Word16 *tcx_buf
+)
{
Word16 tmp, L_transition, lpcorder, filtIdx;
- Word16 gain2;
+ Word16 gain, gain2;
Word32 tmp32;
Word16 zir[L_FRAME_PLUS/4], A[TCXLTP_LTP_ORDER+1];
Word16 buf_in[TCXLTP_MAX_DELAY+L_FRAME48k+TCXLTP_MAX_DELAY], buf_out[2*L_FRAME48k];
Word16 *sig_in, *sig_out;
+ Word16 pitch_int, pitch_fr;
+ Word16 tcx_buf_len, bfi, L_frame_core, SideInfoOnly;
+ Word32 total_brate;
+
+ total_brate = st->total_brate_fx;
+ move32();
+ IF (EQ_16(st->element_mode, IVAS_CPE_MDCT))
+ {
+ total_brate = st->bits_frame_nominal* FRAMES_PER_SEC;
+ move32();
+ }
filtIdx = 0; /* just to avoid comilation warnings */
+ tcx_buf_len = NS2SA(st->output_Fs_fx, TCXLTP_DELAY_NS);
+ SideInfoOnly = 0;
+ if (GE_32(total_brate, HQ_96k))
+ {
+ SideInfoOnly = 1;
+ move16();
+ }
+
+ L_frame_core = st->L_frame_fx;
+ move16();
+
+ if (EQ_16(st->element_mode, IVAS_CPE_MDCT))
+ {
+ L_frame_core = L_FRAME;
+ move16();
+ }
+
+ IF (EQ_16(core, ACELP_CORE))
+ {
+ bfi = 0;
+ pitch_int = 0;
+ pitch_fr = 0;
+ gain = 0;
+ L_frame_core = st->L_frame_past;
+ move16(); move16(); move16(); move16();
+ }
+ ELSE
+ {
+ bfi = st->bfi_fx;
+ pitch_int = hTcxLtpDec->tcxltp_pitch_int;
+ pitch_fr = hTcxLtpDec->tcxltp_pitch_fr;
+ gain = hTcxLtpDec->tcxltp_gain;
+ move16(); move16(); move16(); move16();
+ }
/******** Init ********/
/* Parameters */
- L_transition = shr(L_frame, 2);
+ L_transition = shr(output_frame, 2);
lpcorder = TCXLTP_LTP_ORDER;
move16();
/* Input buffer */
sig_in = buf_in + tcx_buf_len;
- Copy( mem_in, buf_in, tcx_buf_len );
- Copy( sig, buf_in+tcx_buf_len, L_frame );
+ Copy(hTcxLtpDec->tcxltp_mem_in, buf_in, tcx_buf_len );
+ Copy( sig, buf_in+tcx_buf_len, output_frame );
IF ( core > ACELP_CORE )
{
- Copy( tcx_buf, sig_in+L_frame, tcx_buf_len );
+ Copy( tcx_buf, sig_in+output_frame, tcx_buf_len );
}
- Copy( sig+L_frame-tcx_buf_len, mem_in, tcx_buf_len );
+ Copy( sig+output_frame-tcx_buf_len, hTcxLtpDec->tcxltp_mem_in, tcx_buf_len );
/* Output buffer */
- sig_out = buf_out + L_frame;
- Copy( mem_out, buf_out, L_frame );
+ sig_out = buf_out + output_frame;
+ Copy(hTcxLtpDec->tcxltp_mem_out, buf_out, output_frame );
/* TCX-LTP parameters: integer pitch, fractional pitch, gain */
test();
test();
- IF ( !(SideInfoOnly != 0 || tcxltp_on != 0) || EQ_16(core, ACELP_CORE))
+ IF ( !(SideInfoOnly != 0 || hTcxLtpDec->tcxltp != 0) || EQ_16(core, ACELP_CORE))
{
/* No LTP */
pitch_int = 0;
@@ -476,21 +526,32 @@ void tcx_ltp_post( Word8 tcxltp_on,
ELSE IF (bfi == 0)
{
/* LTP and good frame */
- IF (NE_16(L_frame, L_frame_core))
- {
- tmp = div_s(L_frame, shl(L_frame_core, 2)); /* Q13 */
- tmp32 = L_mult0(add(imult1616(pitch_int, pitres), pitch_fr), tmp); /* Q13 */
- tmp = round_fx(L_shl(tmp32, 3)); /* Q0 */
- pitch_int = idiv1616U(tmp, pitres);
- pitch_fr = sub(tmp, imult1616(pitch_int, pitres));
- }
- test();
- test();
- IF ( EQ_32(bitrate, 48000)&&EQ_16(L_frame_core,L_FRAME16k))
+ IF(EQ_16(st->element_mode, EVS_MONO)) /* hard tunings for EVS_MONO, HQ_48k is TCX only */
{
- gain = mult_r(gain, 10486/*0.32f Q15*/);
+ IF(NE_16(output_frame, L_frame_core))
+ {
+ tmp = div_s(output_frame, shl(L_frame_core, 2)); /* Q13 */
+ tmp32 = L_mult0(add(imult1616(pitch_int, st->pit_res_max), pitch_fr), tmp); /* Q13 */
+ tmp = round_fx(L_shl(tmp32, 3)); /* Q0 */
+ pitch_int = idiv1616U(tmp, st->pit_res_max);
+ pitch_fr = sub(tmp, imult1616(pitch_int, st->pit_res_max));
+ }
+ test();
+ test();
+ IF(EQ_32(total_brate, 48000) && EQ_16(L_frame_core, L_FRAME16k))
+ {
+ gain = mult_r(gain, 10486/*0.32f Q15*/);
+ }
+ ELSE IF(EQ_32(total_brate, 48000) && EQ_16(L_frame_core, 512))
+ {
+ gain = mult_r(gain, 13107/*0.40f Q15*/);
+ }
+ ELSE
+ {
+ gain = mult_r(gain, 20972/*0.64f Q15*/);
+ }
}
- ELSE IF ( EQ_32(bitrate, 48000)&&EQ_16(L_frame_core,512))
+ ELSE IF (GT_16(st->element_mode, IVAS_SCE) && GE_32(total_brate, IVAS_96k))
{
gain = mult_r(gain, 13107/*0.40f Q15*/);
}
@@ -503,13 +564,13 @@ void tcx_ltp_post( Word8 tcxltp_on,
{
/* PLC: [TCX: Fade-out]
* PLC: LTP and bad frame (concealment) */
- IF (pitres == *pitres_past) /* ensure consistent core SR to previous frame; otherwise, set gain to 0 */
+ IF (st->pit_res_max == st->pit_res_max_past) /* ensure consistent core SR to previous frame; otherwise, set gain to 0 */
{
- pitch_int = *pitch_int_past;
+ pitch_int = hTcxLtpDec->tcxltp_pitch_int_post_prev;
move16();
- pitch_fr = *pitch_fr_past;
+ pitch_fr = hTcxLtpDec->tcxltp_pitch_fr_post_prev;
move16();
- gain = shl(mult_r(*gain_past, damping), 1);
+ gain = shl(mult_r(hTcxLtpDec->tcxltp_gain_post_prev, st->hTcxDec->damping), 1);
}
ELSE
{
@@ -525,7 +586,7 @@ void tcx_ltp_post( Word8 tcxltp_on,
move16();
if ( bfi != 0 )
{
- *gain_past = 0;
+ hTcxLtpDec->tcxltp_gain_post_prev = 0;
move16();
}
}
@@ -534,7 +595,7 @@ void tcx_ltp_post( Word8 tcxltp_on,
IF (EQ_16(L_frame_core, L_FRAME))
{
- SWITCH ( L_frame )
+ SWITCH ( output_frame )
{
case L_FRAME8k:
filtIdx = 0;
@@ -558,7 +619,7 @@ void tcx_ltp_post( Word8 tcxltp_on,
}
ELSE IF (EQ_16(L_frame_core, L_FRAME16k))
{
- SWITCH ( L_frame )
+ SWITCH ( output_frame )
{
case L_FRAME8k:
filtIdx = 4;
@@ -582,7 +643,7 @@ void tcx_ltp_post( Word8 tcxltp_on,
}
ELSE IF (EQ_16(L_frame_core, 512))
{
- SWITCH ( L_frame )
+ SWITCH ( output_frame )
{
case L_FRAME8k:
filtIdx = 8;
@@ -613,101 +674,77 @@ void tcx_ltp_post( Word8 tcxltp_on,
/******** Previous-frame part ********/
- tcx_ltp_synth_filter( sig_out,
- sig_in,
- delay,
- *pitch_int_past,
- *pitch_fr_past,
- *gain_past,
- *pitres_past,
- NULL,
- 0,
- *filtIdx_past
- );
+ tcx_ltp_synth_filter( sig_out, sig_in, delay, hTcxLtpDec->tcxltp_pitch_int_post_prev, hTcxLtpDec->tcxltp_pitch_fr_post_prev, hTcxLtpDec->tcxltp_gain_post_prev,
+ st->pit_res_max_past, NULL, 0, hTcxLtpDec->tcxltp_filt_idx_prev);
/******** Transition part ********/
test();
test();
test();
- IF ( gain==0 && *gain_past==0 )
+#ifdef IVAS_CODE_TCX_LTP
+ if (st->element_mode != EVS_MONO)
{
- Copy( sig_in+delay, sig_out+delay, L_transition );
- }
- ELSE IF ( *gain_past==0 )
- {
- tcx_ltp_synth_filter( sig_out+delay,
- sig_in+delay,
- L_transition,
- pitch_int,
- pitch_fr,
- gain,
- pitres,
- NULL,
- 1,
- filtIdx
- );
- }
- ELSE IF ( gain==0 )
- {
- tcx_ltp_synth_filter( sig_out+delay,
- sig_in+delay,
- L_transition,
- *pitch_int_past,
- *pitch_fr_past,
- *gain_past,
- *pitres_past,
- NULL,
- -1,
- *filtIdx_past
- );
- }
- ELSE IF ( EQ_16(gain, *gain_past)&&EQ_16(pitch_int,*pitch_int_past)&&EQ_16(pitch_fr,*pitch_fr_past))
- {
- tcx_ltp_synth_filter( sig_out+delay,
- sig_in+delay,
- L_transition,
- pitch_int,
- pitch_fr,
- gain,
- pitres,
- NULL,
- 0,
- filtIdx
- );
+ if (gain == 0.f && hTcxLtpDec->tcxltp_gain_post_prev == 0.f)
+ {
+ /* The filtering is deactivated, just copy input to the output */
+ mvr2r(sig_in + delay, sig_out + delay, L_transition);
+ }
+ else if (gain == 0.f && hTcxLtpDec->tcxltp_gain_post_prev != 0.f)
+ {
+ /* Filtering with the first filter unit */
+ tcx_ltp_synth_filter_10(sig_out + delay, sig_in + delay, L_transition, hTcxLtpDec->tcxltp_pitch_int_post_prev, hTcxLtpDec->tcxltp_pitch_fr_post_prev, hTcxLtpDec->tcxltp_gain_post_prev, st->pit_res_max_past, hTcxLtpDec->tcxltp_filt_idx_prev);
+ }
+ else if (gain != 0.f && hTcxLtpDec->tcxltp_gain_post_prev == 0.f)
+ {
+ /* Filtering with the second filter unit */
+ tcx_ltp_synth_filter_01(sig_out + delay, sig_in + delay, L_transition, pitch_int, pitch_fr, gain, st->pit_res_max, filtIdx);
+ }
+ else if (gain == hTcxLtpDec->tcxltp_gain_post_prev && pitch_int == hTcxLtpDec->tcxltp_pitch_int_post_prev && pitch_fr == hTcxLtpDec->tcxltp_pitch_fr_post_prev && st->pit_res_max == st->pit_res_max_past && filtIdx == hTcxLtpDec->tcxltp_filt_idx_prev)
+ {
+ tcx_ltp_synth_filter(sig_out + delay, sig_in + delay, L_transition, pitch_int, pitch_fr, gain, st->pit_res_max, filtIdx);
+ }
+ else
+ {
+ /* Filtering with the first filter unit, followed by the filtering with the second filter unit */
+ tcx_ltp_synth_filter_11_unequal_pitch(sig_out + delay, sig_in + delay, L_transition, pitch_int, pitch_fr, gain, st->pit_res_max, filtIdx,
+ hTcxLtpDec->tcxltp_pitch_int_post_prev, hTcxLtpDec->tcxltp_pitch_fr_post_prev, hTcxLtpDec->tcxltp_gain_post_prev, st->pit_res_max_past, hTcxLtpDec->tcxltp_filt_idx_prev);
+ }
}
ELSE
+#endif
{
- tcx_ltp_get_lpc( sig_out+delay-L_frame, L_frame, A, lpcorder );
-
- tcx_ltp_get_zir( zir, L_transition, sig_out+delay-lpcorder, sig_in+delay-lpcorder, A, lpcorder, gain, pitch_int, pitch_fr, pitres, filtIdx );
-
- tcx_ltp_synth_filter( sig_out+delay,
- sig_in+delay,
- L_transition,
- pitch_int,
- pitch_fr,
- gain,
- pitres,
- zir,
- 0,
- filtIdx
- );
+ IF(gain == 0 && hTcxLtpDec->tcxltp_gain_post_prev == 0)
+ {
+ Copy(sig_in + delay, sig_out + delay, L_transition);
+ }
+ ELSE IF(hTcxLtpDec->tcxltp_gain_post_prev == 0)
+ {
+ tcx_ltp_synth_filter(sig_out + delay, sig_in + delay, L_transition, pitch_int,
+ pitch_fr, gain, st->pit_res_max, NULL, 1, filtIdx );
+ }
+ ELSE IF(gain == 0)
+ {
+ tcx_ltp_synth_filter(sig_out + delay,sig_in + delay,L_transition, hTcxLtpDec->tcxltp_pitch_int_post_prev, hTcxLtpDec->tcxltp_pitch_fr_post_prev,
+ hTcxLtpDec->tcxltp_gain_post_prev, st->pit_res_max_past, NULL, -1, hTcxLtpDec->tcxltp_filt_idx_prev);
+ }
+ ELSE IF(EQ_16(gain, hTcxLtpDec->tcxltp_gain_post_prev) && EQ_16(pitch_int,hTcxLtpDec->tcxltp_pitch_int_post_prev) && EQ_16(pitch_fr,hTcxLtpDec->tcxltp_pitch_fr_post_prev))
+ {
+ tcx_ltp_synth_filter(sig_out + delay, sig_in + delay, L_transition, pitch_int, pitch_fr, gain, st->pit_res_max, NULL, 0, filtIdx );
+ }
+ ELSE
+ {
+ tcx_ltp_get_lpc(sig_out + delay - output_frame, output_frame, A, lpcorder);
+
+ tcx_ltp_get_zir(zir, L_transition, sig_out + delay - lpcorder, sig_in + delay - lpcorder, A, lpcorder, gain, pitch_int, pitch_fr, st->pit_res_max, filtIdx);
+
+ tcx_ltp_synth_filter(sig_out + delay, sig_in + delay, L_transition, pitch_int, pitch_fr, gain, st->pit_res_max, zir, 0, filtIdx);
+ }
}
- /******** Current-frame part ********/
+ /******** Current-frame part - subsequent subinterval, filtered with the third filter unit ********/
- tcx_ltp_synth_filter( sig_out+(delay+L_transition),
- sig_in+(delay+L_transition),
- L_frame-(delay+L_transition),
- pitch_int,
- pitch_fr,
- gain,
- pitres,
- NULL,
- 0,
- filtIdx
- );
+ tcx_ltp_synth_filter( sig_out+(delay+L_transition),sig_in+(delay+L_transition), output_frame-(delay+L_transition), pitch_int, pitch_fr, gain, st->pit_res_max, NULL, 0, filtIdx);
/******** Output ********/
@@ -715,18 +752,18 @@ void tcx_ltp_post( Word8 tcxltp_on,
/* copy to output */
- Copy( sig_out, sig, L_frame );
+ Copy( sig_out, sig, output_frame );
/* Update */
- *pitch_int_past = pitch_int;
+ hTcxLtpDec->tcxltp_pitch_int_post_prev = pitch_int;
move16();
- *pitch_fr_past = pitch_fr;
+ hTcxLtpDec->tcxltp_pitch_fr_post_prev = pitch_fr;
move16();
- *gain_past = gain2;
+ hTcxLtpDec->tcxltp_gain_post_prev = gain2;
move16();
- *filtIdx_past = filtIdx;
+ hTcxLtpDec->tcxltp_filt_idx_prev = filtIdx;
move16();
- *pitres_past = pitres;
- Copy( sig_out, mem_out, L_frame );
+ st->pit_res_max_past = st->pit_res_max;
+ Copy( sig_out, hTcxLtpDec->tcxltp_mem_out, output_frame );
}
diff --git a/lib_com/tcx_mdct.c b/lib_com/tcx_mdct.c
index 698b2b3841a9ed2040775be483be42006d31b02c..a17a1073310e97f15b89d57da77d6904d6043a8f 100644
--- a/lib_com/tcx_mdct.c
+++ b/lib_com/tcx_mdct.c
@@ -2,15 +2,16 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
-#include
-#include
+#include
+#include "options.h"
#include "cnst_fx.h"
#include "prot_fx.h"
#include "basop_util.h"
-#include "stl.h"
-static Word16 TCX_MDCT_GetScaleFactor(Word16 L, Word16 *factor_e)
+static Word16 TCX_MDCT_GetScaleFactor(
+ const Word16 L,
+ Word16 *factor_e
+)
{
Word16 factor;
@@ -49,7 +50,10 @@ static Word16 TCX_MDCT_GetScaleFactor(Word16 L, Word16 *factor_e)
return factor;
}
-static Word16 TCX_MDCT_Inverse_GetScaleFactor(Word16 L, Word16 *factor_e)
+static Word16 TCX_MDCT_Inverse_GetScaleFactor(
+ const Word16 L,
+ Word16 *factor_e
+)
{
Word16 factor;
@@ -88,13 +92,23 @@ static Word16 TCX_MDCT_Inverse_GetScaleFactor(Word16 L, Word16 *factor_e)
}
-void TCX_MDCT(const Word16 *x, Word32 *y, Word16* y_e, Word16 l, Word16 m, Word16 r)
+void TCX_MDCT(
+ const Word16 *x,
+ Word32 *y,
+ Word16* y_e,
+ const Word16 l,
+ const Word16 m,
+ const Word16 r,
+ const Word16 element_mode
+)
{
Word16 i;
Word16 factor, neg_factor;
Word16 factor_e;
-
+#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING
+ MY_UNUSED_Word(element_mode)
+#endif
factor = TCX_MDCT_GetScaleFactor(add(add(shr(l, 1), m), shr(r, 1)), &factor_e);
*y_e = add(*y_e, factor_e);
@@ -126,17 +140,28 @@ void TCX_MDCT(const Word16 *x, Word32 *y, Word16* y_e, Word16 l, Word16 m, Word1
*y_e = sub(15, *y_e);
edct_fx(y, y, l/2 + m + r/2, y_e);
*y_e = sub(15-1, *y_e);
+ return;
}
-void TCX_MDST(const Word16 *x, Word32 *y, Word16* y_e, Word16 l, Word16 m, Word16 r)
+void TCX_MDST(
+ const Word16 *x,
+ Word32 *y,
+ Word16* y_e,
+ const Word16 l,
+ const Word16 m,
+ const Word16 r,
+ const Word16 element_mode
+)
{
Word16 i;
Word16 factor, neg_factor;
Word16 factor_e;
-
+#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING
+MY_UNUSED_Word(element_mode)
+#endif
factor = TCX_MDCT_GetScaleFactor(add(add(shr(l, 1), m), shr(r, 1)), &factor_e);
*y_e = add(*y_e, factor_e);
neg_factor = negate(factor);
@@ -167,17 +192,27 @@ void TCX_MDST(const Word16 *x, Word32 *y, Word16* y_e, Word16 l, Word16 m, Word1
*y_e = sub(15, *y_e);
edst_fx(y, y, l/2 + m + r/2, y_e);
*y_e = sub(15-1, *y_e);
-
+ return;
}
-void TCX_MDCT_Inverse(Word32 *x, Word16 x_e, Word16 *y, Word16 l, Word16 m, Word16 r)
+void TCX_MDCT_Inverse(
+ Word32 *x,
+ Word16 x_e,
+ Word16 *y,
+ const Word16 l,
+ const Word16 m,
+ const Word16 r,
+ const Word16 element_mode
+)
{
Word16 i, fac, negfac, s;
Word16 L2 = l, R2 = r;
Word32 tmp_buf[N_MAX+L_MDCT_OVLP_MAX/2];
Word16 fac_e;
-
+#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING
+ MY_UNUSED_Word (element_mode)
+#endif
L2 = shr(l, 1);
R2 = shr(r, 1);
diff --git a/lib_com/tcx_mdct_window.c b/lib_com/tcx_mdct_window.c
index cf69732902e49c0e45f871de0bb5b412b6ef7257..72d61336fa3e1d8a39d7284d721f133530dd34d6 100644
--- a/lib_com/tcx_mdct_window.c
+++ b/lib_com/tcx_mdct_window.c
@@ -2,24 +2,73 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include
#include "options.h"
#include "cnst_fx.h"
#include "basop_util.h"
#include "rom_basop_util.h"
#include "prot_fx.h"
-#include "stl.h"
+#include "rom_com_fx.h"
+
+/*-------------------------------------------------------------------
+ * mdct_window_sine()
+ *
+ *
+ *-------------------------------------------------------------------*/
void mdct_window_sine(const PWord16 **window, const Word16 n)
{
- *window = getSineWindowTable(n);
-}
+#ifdef IVAS_CODE
+ if (element_mode == EVS_MONO)
+#endif
+ {
+ *window = getSineWindowTable(n);
+ PMT("getSineWindowTable needs to be updated for IVAS")
+ }
+#ifdef IVAS_CODE
+ else
+ {
+ const float* window_table = 0;
+ int16_t buf_in_size = 0;
+ switch (window_type)
+ {
+ case FULL_OVERLAP:
+ window_table = tcx_mdct_window_48;
+ buf_in_size = 420;
+ break;
+ case HALF_OVERLAP:
+ window_table = tcx_mdct_window_half_48;
+ buf_in_size = 180;
+ break;
+ case TRANSITION_OVERLAP:
+ case MIN_OVERLAP:
+ window_table = tcx_mdct_window_trans_48;
+ buf_in_size = 60;
+ break;
+ default:
+ assert(0 && "Unsupported window type");
+ break;
+ }
+
+ if (Fs == 48000)
+ {
+ mvr2r(window_table, window, n);
+ }
+ else
+ {
+ lerp(window_table, window, n, buf_in_size);
+ }
+ }
+#endif
+}
-extern const Word16 window_48kHz_fx[];
-extern const Word16 window_256kHz[];
-extern const Word16 window_8_16_32kHz_fx[];
+/*-------------------------------------------------------------------
+ * mdct_window_aldo()
+ *
+ *
+ *-------------------------------------------------------------------*/
void mdct_window_aldo(
Word16 *window1,
diff --git a/lib_com/tcx_utils.c b/lib_com/tcx_utils.c
index e11be3b387b731dac7ab7d899e431b54e4eb5d5c..3d1f21ceba5ffd819a4b5a6e6e190ea5f3374d05 100644
--- a/lib_com/tcx_utils.c
+++ b/lib_com/tcx_utils.c
@@ -2,10 +2,8 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
-#include
+#include
#include
-#include "stl.h"
#include "options.h"
#include "prot_fx.h"
#include "rom_com_fx.h"
@@ -14,8 +12,14 @@
#define inv_int InvIntTable
-
-Word16 getInvFrameLen(Word16 L_frame) /* returns 1/L_frame in Q21 format */
+ /*-------------------------------------------------------------------*
+ * getInvFrameLen()
+ *
+ *
+ *-------------------------------------------------------------------*/
+Word16 getInvFrameLen( /* returns 1/L_frame in Q21 format */
+ const Word16 L_frame
+)
{
Word16 idx, s;
@@ -30,64 +34,70 @@ Word16 getInvFrameLen(Word16 L_frame) /* returns 1/L_frame in Q21 format */
return shl(L_frame_inv[idx], sub(s, 7));
}
-
+/*-------------------------------------------------------------------*
+ *tcx_get_windows()
+ *
+ *
+ * ------------------------------------------------------------------ - */
static void tcx_get_windows(
- TCX_config const * tcx_cfg, /* i: TCX configuration */
- Word16 left_mode, /* i: overlap mode of left window half */
- Word16 right_mode, /* i: overlap mode of right window half */
- Word16 *left_overlap, /* o: left overlap length */
- PWord16 const **left_win, /* o: left overlap window */
- Word16 *right_overlap, /* o: right overlap length */
- PWord16 const **right_win, /* o: right overlap window */
- Word8 fullband /* i: fullband flag */
+ TCX_CONFIG_HANDLE hTcxCfg, /* i : TCX configuration */
+ const Word16 left_mode, /* i: overlap mode of left window half */
+ const Word16 right_mode, /* i: overlap mode of right window half */
+ Word16 *left_overlap, /* o: left overlap length */
+ const PWord16 **left_win, /* o: left overlap window */
+ Word16 *right_overlap, /* o: right overlap length */
+ const PWord16 **right_win, /* o: right overlap window */
+ const Word8 fullband /* i: fullband flag */
)
-{
+{ /* LFE is only FULL_OVERLAP*/
IF (fullband == 0)
{
/* Left part */
SWITCH (left_mode)
{
case TRANSITION_OVERLAP: /* ACELP->TCX transition */
- *left_overlap = tcx_cfg->tcx_mdct_window_trans_length;
+ *left_overlap = hTcxCfg->tcx_mdct_window_trans_length;
move16();
- *left_win = tcx_cfg->tcx_mdct_window_trans;
+ *left_win = hTcxCfg->tcx_mdct_window_trans;
BREAK;
case MIN_OVERLAP:
- *left_overlap = tcx_cfg->tcx_mdct_window_min_length;
+ *left_overlap = hTcxCfg->tcx_mdct_window_min_length;
move16();
- *left_win = tcx_cfg->tcx_mdct_window_minimum;
+ *left_win = hTcxCfg->tcx_mdct_window_minimum;
BREAK;
case HALF_OVERLAP:
- *left_overlap = tcx_cfg->tcx_mdct_window_half_length;
+ *left_overlap = hTcxCfg->tcx_mdct_window_half_length;
move16();
- *left_win = tcx_cfg->tcx_mdct_window_half;
+ *left_win = hTcxCfg->tcx_mdct_window_half;
BREAK;
case FULL_OVERLAP:
- *left_overlap = tcx_cfg->tcx_mdct_window_length;
+ *left_overlap = hTcxCfg->tcx_mdct_window_length;
+ move16();
+ *left_win = hTcxCfg->tcx_aldo_window_1_trunc;
move16();
- *left_win = tcx_cfg->tcx_aldo_window_1_trunc;
BREAK;
default:
assert(!"Not supported overlap");
}
/* Right part */
- SWITCH (right_mode)
+ SWITCH(right_mode)
{
case MIN_OVERLAP:
- *right_overlap = tcx_cfg->tcx_mdct_window_min_length;
+ *right_overlap = hTcxCfg->tcx_mdct_window_min_length;
move16();
- *right_win = tcx_cfg->tcx_mdct_window_minimum;
+ *right_win = hTcxCfg->tcx_mdct_window_minimum;
BREAK;
case HALF_OVERLAP:
- *right_overlap = tcx_cfg->tcx_mdct_window_half_length;
+ *right_overlap = hTcxCfg->tcx_mdct_window_half_length;
move16();
- *right_win = tcx_cfg->tcx_mdct_window_half;
+ *right_win = hTcxCfg->tcx_mdct_window_half;
BREAK;
case FULL_OVERLAP:
- *right_overlap = tcx_cfg->tcx_mdct_window_delay;
+ *right_overlap = hTcxCfg->tcx_mdct_window_delay;
+ move16();
+ *right_win = hTcxCfg->tcx_aldo_window_2;
move16();
- *right_win = tcx_cfg->tcx_aldo_window_2;
BREAK;
default:
assert(!"Not supported overlap");
@@ -99,19 +109,19 @@ static void tcx_get_windows(
SWITCH (left_mode)
{
case TRANSITION_OVERLAP: /* ACELP->TCX transition */
- *left_overlap = tcx_cfg->tcx_mdct_window_trans_lengthFB;
+ *left_overlap = hTcxCfg->tcx_mdct_window_trans_lengthFB;
move16();
- *left_win = tcx_cfg->tcx_mdct_window_transFB;
+ *left_win = hTcxCfg->tcx_mdct_window_transFB;
BREAK;
case MIN_OVERLAP:
- *left_overlap = tcx_cfg->tcx_mdct_window_min_lengthFB;
+ *left_overlap = hTcxCfg->tcx_mdct_window_min_lengthFB;
move16();
- *left_win = tcx_cfg->tcx_mdct_window_minimumFB;
+ *left_win = hTcxCfg->tcx_mdct_window_minimumFB;
BREAK;
case HALF_OVERLAP:
- *left_overlap = tcx_cfg->tcx_mdct_window_half_lengthFB;
+ *left_overlap = hTcxCfg->tcx_mdct_window_half_lengthFB;
move16();
- *left_win = tcx_cfg->tcx_mdct_window_halfFB;
+ *left_win = hTcxCfg->tcx_mdct_window_halfFB;
BREAK;
case RECTANGULAR_OVERLAP:
*left_overlap = 0;
@@ -119,9 +129,10 @@ static void tcx_get_windows(
*left_win = NULL;
BREAK;
case FULL_OVERLAP:
- *left_overlap = tcx_cfg->tcx_mdct_window_lengthFB;
- move16();
- *left_win = tcx_cfg->tcx_aldo_window_1_FB_trunc;
+ *left_overlap = hTcxCfg->tcx_mdct_window_lengthFB;
+ *left_win = hTcxCfg->tcx_aldo_window_1_FB_trunc;
+ move16();move16();
+
BREAK;
default:
assert(!"Not supported overlap");
@@ -131,14 +142,14 @@ static void tcx_get_windows(
SWITCH (right_mode)
{
case MIN_OVERLAP:
- *right_overlap = tcx_cfg->tcx_mdct_window_min_lengthFB;
+ *right_overlap = hTcxCfg->tcx_mdct_window_min_lengthFB;
move16();
- *right_win = tcx_cfg->tcx_mdct_window_minimumFB;
+ *right_win = hTcxCfg->tcx_mdct_window_minimumFB;
BREAK;
case HALF_OVERLAP:
- *right_overlap = tcx_cfg->tcx_mdct_window_half_lengthFB;
+ *right_overlap = hTcxCfg->tcx_mdct_window_half_lengthFB;
move16();
- *right_win = tcx_cfg->tcx_mdct_window_halfFB;
+ *right_win = hTcxCfg->tcx_mdct_window_halfFB;
BREAK;
case RECTANGULAR_OVERLAP:
*right_overlap = 0;
@@ -146,9 +157,9 @@ static void tcx_get_windows(
*right_win = NULL;
BREAK;
case FULL_OVERLAP:
- *right_overlap = tcx_cfg->tcx_mdct_window_delayFB;
- move16();
- *right_win = tcx_cfg->tcx_aldo_window_2_FB;
+ *right_overlap = hTcxCfg->tcx_mdct_window_delayFB;
+ move16();move16();
+ *right_win = hTcxCfg->tcx_aldo_window_2_FB;
BREAK;
default:
assert(!"Not supported overlap");
@@ -202,18 +213,23 @@ static void tcx_windowing_analysis(
move16();
}
}
-
+/*-------------------------------------------------------------------*
+ * WindowSignal()
+ *
+ *
+ *-------------------------------------------------------------------*/
void WindowSignal(
- TCX_config const *tcx_cfg, /* input: configuration of TCX */
- Word16 offset, /* input: left folding point offset relative to the input signal pointer */
- Word16 left_overlap_mode, /* input: overlap mode of left window half */
- Word16 right_overlap_mode, /* input: overlap mode of right window half */
- Word16 * left_overlap_length, /* output: TCX window left overlap length */
- Word16 * right_overlap_length, /* output: TCX window right overlap length */
- Word16 const in[], /* input: input signal */
- Word16 * L_frame, /* input/output: frame length */
- Word16 out[] /* output: output windowed signal */
- ,Word8 fullband /* input: fullband flag */
+ TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */
+ Word16 offset, /* i : left folding point offset relative to the input signal pointer */
+ const Word16 left_overlap_mode, /* i : overlap mode of left window half */
+ Word16 right_overlap_mode, /* i : overlap mode of right window half */
+ Word16 * left_overlap_length, /* o : TCX window left overlap length */
+ Word16 * right_overlap_length, /* o : TCX window right overlap length */
+ const Word16 in[], /* i : input signal */
+ Word16 * L_frame, /* i/o: frame length */
+ Word16 out[], /* o : output windowed signal */
+ const Word16 truncate_aldo, /* i : nonzero to truncate long ALDO slope */
+ const Word8 fullband /* i : fullband flag */
)
{
Word16 l, r;
@@ -225,7 +241,7 @@ void WindowSignal(
* Init *
*-----------------------------------------------------------*/
- tcx_get_windows(tcx_cfg, left_overlap_mode, right_overlap_mode, &l, &left_win, &r, &right_win, fullband);
+ tcx_get_windows(hTcxCfg, left_overlap_mode, right_overlap_mode, &l, &left_win, &r, &right_win, fullband);
/* Init lengths */
@@ -235,15 +251,15 @@ void WindowSignal(
/* Increase frame size for 5ms */
IF (fullband == 0)
{
- *L_frame = add(*L_frame, tcx_cfg->tcx5Size);
+ *L_frame = add(*L_frame, hTcxCfg->tcx5Size);
move16();
- offset = negate(shr(tcx_cfg->tcx_mdct_window_trans_length, 1));
+ offset = negate(shr(hTcxCfg->tcx_mdct_window_trans_length, 1));
}
ELSE
{
- *L_frame = add(*L_frame, tcx_cfg->tcx5SizeFB);
+ *L_frame = add(*L_frame, hTcxCfg->tcx5SizeFB);
move16();
- offset = negate(shr(tcx_cfg->tcx_mdct_window_trans_lengthFB, 1));
+ offset = negate(shr(hTcxCfg->tcx_mdct_window_trans_lengthFB, 1));
}
}
@@ -252,19 +268,19 @@ void WindowSignal(
*-----------------------------------------------------------*/
tcx_windowing_analysis(in-shr(l,1)+offset, *L_frame, l, left_win, r, right_win, out);
-
- IF (EQ_16(left_overlap_mode, FULL_OVERLAP))
+ test(); test();
+ IF (EQ_16(left_overlap_mode, FULL_OVERLAP) && truncate_aldo )
{
/* fade truncated ALDO window to avoid discontinuities */
Word16 i, tmp;
const PWord16 *p;
- p = tcx_cfg->tcx_mdct_window_minimum;
- tmp = shr(tcx_cfg->tcx_mdct_window_min_length, 1);
+ p = hTcxCfg->tcx_mdct_window_minimum;
+ tmp = shr(hTcxCfg->tcx_mdct_window_min_length, 1);
IF (fullband != 0)
{
- p = tcx_cfg->tcx_mdct_window_minimumFB;
- tmp = shr(tcx_cfg->tcx_mdct_window_min_lengthFB, 1);
+ p = hTcxCfg->tcx_mdct_window_minimumFB;
+ tmp = shr(hTcxCfg->tcx_mdct_window_min_lengthFB, 1);
}
FOR (i = 0; i < tmp; i++)
@@ -285,27 +301,32 @@ void WindowSignal(
move16();
}
+/*-------------------------------------------------------------------*
+ * tcx_windowing_synthesis_current_frame()
+ *
+ *
+ *-------------------------------------------------------------------*/
void tcx_windowing_synthesis_current_frame(
Word16 *signal, /* i/o: signal vector */
const PWord16 *window, /* i: TCX window vector */
const PWord16 *window_half, /* i: TCX window vector for half-overlap window */
const PWord16 *window_min, /* i: TCX minimum overlap window */
- Word16 window_length, /* i: TCX window length */
- Word16 window_half_length, /* i: TCX half window length */
- Word16 window_min_length, /* i: TCX minimum overlap length */
- Word16 left_rect, /* i: left part is rectangular */
- Word16 left_mode, /* i: overlap mode of left window half */
+ const Word16 window_length, /* i: TCX window length */
+ const Word16 window_half_length, /* i: TCX half window length */
+ const Word16 window_min_length, /* i: TCX minimum overlap length */
+ const Word16 left_rect, /* i: left part is rectangular */
+ const Word16 left_mode, /* i: overlap mode of left window half */
Word16 *acelp_zir, /* i: acelp ZIR */
- Word16 *old_syn,
- Word16 *syn_overl,
- Word16 *A_zir,
- const PWord16 *window_trans,
+ const Word16* old_syn,
+ const Word16* syn_overl,
+ const Word16* A_zir,
+ const PWord16 *window_trans,
Word16 acelp_zir_len,
- Word16 acelp_mem_len,
- Word16 last_core_bfi, /* i : last core */
- Word8 last_is_cng
- ,Word16 fullbandScale
+ const Word16 acelp_mem_len,
+ const Word16 last_core_bfi, /* i : last core */
+ const Word8 last_is_cng,
+ const Word16 fullbandScale
)
{
@@ -565,16 +586,20 @@ void tcx_windowing_synthesis_current_frame(
/* Right part asymmetric window : with ALDO do nothing->can be skipped*/
}
-
+/*-------------------------------------------------------------------*
+ * tcx_windowing_synthesis_past_frame()
+ *
+ *
+ *-------------------------------------------------------------------*/
void tcx_windowing_synthesis_past_frame(
- Word16 *signal, /* i/o: signal vector */
- const PWord16 *window, /* i: TCX window vector */
- const PWord16 *window_half, /* i: TCX window vector for half-overlap window */
- const PWord16 *window_min, /* i: TCX minimum overlap window */
- Word16 window_length, /* i: TCX window length */
- Word16 window_half_length, /* i: TCX half window length */
- Word16 window_min_length, /* i: TCX minimum overlap length */
- Word16 right_mode /* i: overlap mode (left_mode of current frame) */
+ Word16 *signal, /* i/o: signal vector */
+ const PWord16 *window, /* i: TCX window vector */
+ const PWord16 *window_half, /* i: TCX window vector for half-overlap window */
+ const PWord16 *window_min, /* i: TCX minimum overlap window */
+ const Word16 window_length, /* i: TCX window length */
+ const Word16 window_half_length, /* i: TCX half window length */
+ const Word16 window_min_length, /* i: TCX minimum overlap length */
+ const Word16 right_mode /* i: overlap mode (left_mode of current frame) */
)
{
@@ -645,10 +670,22 @@ void tcx_windowing_synthesis_past_frame(
}
}
-
-void lpc2mdct(Word16 *lpcCoeffs, Word16 lpcOrder,
- Word16 *mdct_gains, Word16 *mdct_gains_exp,
- Word16 *mdct_inv_gains, Word16 *mdct_inv_gains_exp)
+/*-------------------------------------------------------------------*
+ * lpc2mdct()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void lpc2mdct(
+ Word16 *lpcCoeffs,
+ const Word16 lpcOrder,
+ Word16 *mdct_gains,
+ Word16 *mdct_gains_exp,
+ Word16 *mdct_inv_gains,
+ Word16 *mdct_inv_gains_exp,
+ const int16_t length,
+ const int16_t noInverse
+)
{
Word32 ComplexData[2*FDNS_NPTS];
Word16 i, j, k, sizeN, step, scale, s, tmp16;
@@ -656,7 +693,14 @@ void lpc2mdct(Word16 *lpcCoeffs, Word16 lpcOrder,
Word32 tmp32;
const PWord16 *ptwiddle;
Word32 workBuffer[2*BASOP_CFFT_MAX_LENGTH];
- sizeN = shl(FDNS_NPTS, 1);
+
+#ifndef IVAS_CODE_TCX_UTIL
+ MY_UNUSED_Word(noInverse)
+#endif
+
+ assert(length <= FDNS_NPTS);
+ sizeN = shl(length, 1);
+
BASOP_getTables(NULL, &ptwiddle, &step, sizeN);
/*ODFT*/
assert(lpcOrder < FDNS_NPTS);
@@ -675,92 +719,111 @@ void lpc2mdct(Word16 *lpcCoeffs, Word16 lpcOrder,
ComplexData[2*i] = L_deposit_l(0);
ComplexData[2*i+1] = L_deposit_l(0);
}
- /* half length FFT */
- scale = add(norm_s(lpcCoeffs[0]),1);
- BASOP_cfft((cmplx *)ComplexData, FDNS_NPTS, &scale, workBuffer);
- /*Get amplitude*/
- j = sub(FDNS_NPTS, 1);
- k = 0;
+
move16();
- FOR (i=0; i In float the fft type changes as well
+ /*Get amplitude*/
+ j = sub(length, 1);
+ k = 0;
+ for (i = 0; i < length; i++)
{
- mdct_gains[k] = g;
- move16();
- }
- if (mdct_gains_exp != 0)
- {
- mdct_gains_exp[k] = g_e;
- move16();
+ mdct_gains[i] = (float)(sqrt(RealData[i] * RealData[i] + ImagData[i] * ImagData[i]));
}
- if (mdct_inv_gains != 0)
- {
- mdct_inv_gains[k] = ig;
- move16();
- }
- if (mdct_inv_gains_exp != 0)
- {
- mdct_inv_gains_exp[k] = ig_e;
- move16();
+ }
+ else
+#endif
+ {
+ /* half length FFT */
+ scale = add(norm_s(lpcCoeffs[0]), 1);
+ BASOP_cfft((cmplx*)ComplexData, FDNS_NPTS, &scale, workBuffer);
+ /*Get amplitude*/
+ j = sub(length, 1);
+ k = 0;
+ FOR(i = 0; i < length / 2; i++)
+ {
+ s = sub(norm_l(L_max(L_abs(ComplexData[2 * i]), L_abs(ComplexData[2 * i + 1]))), 1);
+ tmp16 = extract_h(L_shl(ComplexData[2 * i], s));
+ tmp32 = L_mult(tmp16, tmp16);
+ tmp16 = extract_h(L_shl(ComplexData[2 * i + 1], s));
+ tmp16 = mac_r(tmp32, tmp16, tmp16);
+ s = shl(sub(scale, s), 1);
+ if (tmp16 == 0)
+ {
+ s = -16;
+ move16();
+ }
+ if (tmp16 == 0)
+ {
+ tmp16 = 1;
+ move16();
+ }
+ BASOP_Util_Sqrt_InvSqrt_MantExp(tmp16, s, &g, &g_e, &ig, &ig_e);
+ if (mdct_gains != 0)
+ {
+ mdct_gains[k] = g;
+ move16();
+ }
+ if (mdct_gains_exp != 0)
+ {
+ mdct_gains_exp[k] = g_e;
+ move16();
+ }
+ if (mdct_inv_gains != 0)
+ {
+ mdct_inv_gains[k] = ig;
+ move16();
+ }
+ if (mdct_inv_gains_exp != 0)
+ {
+ mdct_inv_gains_exp[k] = ig_e;
+ move16();
+ }
+ k = add(k, 1);
+ s = sub(norm_l(L_max(L_abs(ComplexData[2 * j]), L_abs(ComplexData[2 * j + 1]))), 1);
+ tmp16 = extract_h(L_shl(ComplexData[2 * j], s));
+ tmp32 = L_mult(tmp16, tmp16);
+ tmp16 = extract_h(L_shl(ComplexData[2 * j + 1], s));
+ tmp16 = mac_r(tmp32, tmp16, tmp16);
+ s = shl(sub(scale, s), 1);
+ if (tmp16 == 0)
+ {
+ s = -16;
+ move16();
+ }
+ if (tmp16 == 0)
+ {
+ tmp16 = 1;
+ move16();
+ }
+ BASOP_Util_Sqrt_InvSqrt_MantExp(tmp16, s, &g, &g_e, &ig, &ig_e);
+ if (mdct_gains != 0)
+ {
+ mdct_gains[k] = g;
+ move16();
+ }
+ if (mdct_gains_exp != 0)
+ {
+ mdct_gains_exp[k] = g_e;
+ move16();
+ }
+ if (mdct_inv_gains != 0)
+ {
+ mdct_inv_gains[k] = ig;
+ move16();
+ }
+ if (mdct_inv_gains_exp != 0)
+ {
+ mdct_inv_gains_exp[k] = ig_e;
+ move16();
+ }
+ j = sub(j, 1);
+ k = add(k, 1);
}
- j = sub(j, 1);
- k = add(k, 1);
}
}
/**
@@ -771,7 +834,13 @@ void lpc2mdct(Word16 *lpcCoeffs, Word16 lpcOrder,
* \param gains shaping gains mantissas
* \param gains_exp shaping gains exponents
*/
-void mdct_shaping(Word32 x[], Word16 lg, Word16 const gains[], Word16 const gains_exp[])
+void mdct_shaping(
+ Word32 x[],
+ const Word16 lg,
+ const Word16 gains[],
+ const Word16 gains_exp[]
+ /*const Word16 nBands*/ /*Parameter added in IVAS, but always equal to FDNS_NPTS */
+)
{
Word16 i, k, l;
@@ -779,6 +848,7 @@ void mdct_shaping(Word32 x[], Word16 lg, Word16 const gains[], Word16 const gain
Word32 * px = x;
Word16 const * pgains = gains;
Word16 const * pgainsexp = gains_exp;
+
/* FDNS_NPTS = 64 */
k = shr(lg, 6);
@@ -859,7 +929,14 @@ void mdct_shaping(Word32 x[], Word16 lg, Word16 const gains[], Word16 const gain
}
-void mdct_shaping_16(Word16 const x[], Word16 lg, Word16 lg_total, Word16 const gains[], Word16 const gains_exp[], Word16 gains_max_exp, Word32 y[])
+void mdct_shaping_16(
+ const Word16 x[],
+ const Word16 lg,
+ const Word16 lg_total,
+ const Word16 gains[],
+ const Word16 gains_exp[],
+ Word16 gains_max_exp, Word32 y[]
+)
{
Word16 i, k, l;
Word16 m, gain_exp;
@@ -906,7 +983,12 @@ void mdct_shaping_16(Word16 const x[], Word16 lg, Word16 lg_total, Word16 const
}
}
-void mdct_noiseShaping_interp(Word32 x[], Word16 lg, Word16 gains[], Word16 gains_exp[])
+void mdct_noiseShaping_interp(
+ Word32 x[],
+ const Word16 lg,
+ Word16 gains[],
+ Word16 gains_exp[]
+)
{
Word16 i, j, jp, jn, k, l;
Word16 g, pg, ng, e, tmp;
@@ -1051,20 +1133,22 @@ void mdct_noiseShaping_interp(Word32 x[], Word16 lg, Word16 gains[], Word16 gain
}
-void PsychAdaptLowFreqDeemph(Word32 x[],
- const Word16 lpcGains[], const Word16 lpcGains_e[],
- Word16 lf_deemph_factors[]
- )
+void PsychAdaptLowFreqDeemph(
+ Word32 x[],
+ const Word16 lpcGains[],
+ const Word16 lpcGains_e[],
+ Word16 lf_deemph_factors[]
+)
{
Word16 i;
- Word16 max, max_e, fac, min, min_e, tmp, tmp_e;
+ Word16 max_val, max_e, fac, min, min_e, tmp, tmp_e;
Word32 L_tmp;
assert(lpcGains[0] >= 0x4000);
- max = lpcGains[0];
+ max_val = lpcGains[0];
move16();
max_e = lpcGains_e[0];
move16();
@@ -1073,7 +1157,7 @@ void PsychAdaptLowFreqDeemph(Word32 x[],
min_e = lpcGains_e[0];
move16();
- /* find minimum (min) and maximum (max) of LPC gains in low frequencies */
+ /* find minimum (min) and maximum (max_val) of LPC gains in low frequencies */
FOR (i = 1; i < 9; i++)
{
IF (compMantExp16Unorm(lpcGains[i], lpcGains_e[i], min, min_e) < 0)
@@ -1084,9 +1168,9 @@ void PsychAdaptLowFreqDeemph(Word32 x[],
move16();
}
- IF (compMantExp16Unorm(lpcGains[i], lpcGains_e[i], max, max_e) > 0)
+ IF (compMantExp16Unorm(lpcGains[i], lpcGains_e[i], max_val, max_e) > 0)
{
- max = lpcGains[i];
+ max_val = lpcGains[i];
move16();
max_e = lpcGains_e[i];
move16();
@@ -1096,20 +1180,20 @@ void PsychAdaptLowFreqDeemph(Word32 x[],
min_e = add(min_e, 5); /* min *= 32.0f; */
test();
- IF ((compMantExp16Unorm(max, max_e, min, min_e) < 0) && (min > 0))
+ IF ((compMantExp16Unorm(max_val, max_e, min, min_e) < 0) && (min > 0))
{
- /* fac = tmp = (float)pow(max / min, 0.0078125f); */
+ /* fac = tmp = (float)pow(max_val / min, 0.0078125f); */
tmp_e = min_e;
move16();
tmp = Inv16(min, &tmp_e);
- L_tmp = L_shl(L_mult(tmp, max), add(tmp_e, max_e)); /* Q31 */
+ L_tmp = L_shl(L_mult(tmp, max_val), add(tmp_e, max_e)); /* Q31 */
L_tmp = BASOP_Util_Log2(L_tmp); /* Q25 */
L_tmp = L_shr(L_tmp, 7); /* 0.0078125f = 1.f/(1<<7) */
L_tmp = BASOP_Util_InvLog2(L_tmp); /* Q31 */
tmp = round_fx(L_tmp); /* Q15 */
fac = tmp; /* Q15 */ move16();
- /* gradual lowering of lowest 32 bins; DC is lowered by (max/tmp)^1/4 */
+ /* gradual lowering of lowest 32 bins; DC is lowered by (max_val/tmp)^1/4 */
FOR (i = 31; i >= 0; i--)
{
x[i] = Mpy_32_16_1(x[i], fac);
@@ -1125,12 +1209,15 @@ void PsychAdaptLowFreqDeemph(Word32 x[],
}
-void AdaptLowFreqDeemph(Word32 x[], Word16 x_e,
- Word16 tcx_lpc_shaped_ari,
- Word16 lpcGains[], Word16 lpcGains_e[],
- const Word16 lg,
- Word16 lf_deemph_factors[]
- )
+void AdaptLowFreqDeemph(
+ Word32 x[],
+ Word16 x_e,
+ Word16 tcx_lpc_shaped_ari,
+ Word16 lpcGains[],
+ Word16 lpcGains_e[],
+ const Word16 lg,
+ Word16 lf_deemph_factors[]
+)
{
Word16 i, i_max, i_max_old, lg_4;
@@ -1308,16 +1395,17 @@ void AdaptLowFreqDeemph(Word32 x[], Word16 x_e,
}
void tcx_noise_filling(
- Word32 *Q,
+ Word32* Q,
Word16 Q_e,
Word16 seed,
- Word16 iFirstLine,
- Word16 lowpassLine,
- Word16 nTransWidth,
- Word16 L_frame,
- Word16 tiltCompFactor,
+ const Word16 iFirstLine,
+ const Word16 lowpassLine,
+ const Word16 nTransWidth,
+ const Word16 L_frame,
+ const Word16 tiltCompFactor,
Word16 fac_ns,
- Word16 *infoTCXNoise
+ Word16* infoTCXNoise,
+ const Word16 element_mode /* i : IVAS element mode */
)
{
Word16 i, m, segmentOffset;
@@ -1331,7 +1419,7 @@ void tcx_noise_filling(
/* get inverse frame length */
tmp1 = getInvFrameLen(L_frame);
- /* tilt_factor = (float)pow(max(0.375f, tiltCompFactor), 1.0f/(float)L_frame); */
+ /* tilt_factor = (float)pow(max_val(0.375f, tiltCompFactor), 1.0f/(float)L_frame); */
tmp32 = BASOP_Util_Log2(L_deposit_h(s_max(0x3000, tiltCompFactor))); /* 6Q25 */
tmp32 = L_shr(Mpy_32_16_1(tmp32, tmp1), 6);
BASOP_SATURATE_WARNING_OFF;
@@ -1339,25 +1427,34 @@ void tcx_noise_filling(
BASOP_SATURATE_WARNING_ON;
/* find last nonzero line below iFirstLine, use it as start offset */
+ i = iFirstLine;
+ move16();
tmp1 = shr(iFirstLine, 1);
- FOR (i = iFirstLine; i > tmp1; i--)
+ IF (EQ_16(element_mode, IVAS_CPE_MDCT)) /* ... but only in mono or parametric stereo since it may cause binaural unmasking in discrete stereo */
{
- IF (Q[i] != 0)
- {
- BREAK;
- }
+ segmentOffset = i;
+ move16();
}
- /* fac_ns *= (float)pow(tilt_factor, (float)i); */
- FOR (m = 0; m < i; m++)
+ ELSE
{
- fac_ns = mult_r(fac_ns, tilt_factor);
+ FOR(; i > tmp1; i--)
+ {
+ IF(Q[i] != 0)
+ {
+ BREAK;
+ }
+ }
+ /* fac_ns *= (float)pow(tilt_factor, (float)i); */
+ FOR(m = 0; m < i; m++)
+ {
+ fac_ns = mult_r(fac_ns, tilt_factor);
+ }
+ i = add(i, 1);
+ segmentOffset = i;
}
-
nrg = L_deposit_l(1);
win = 0;
move16();
- i = add(i, 1);
- segmentOffset = i;
move16();
FOR (; i < lowpassLine; i++)
@@ -1442,43 +1539,71 @@ void tcx_noise_filling(
/*---------------------------------------------------------------
- * Residual Quantization
+ * InitTnsConfigs()
*--------------------------------------------------------------*/
-void InitTnsConfigs(Word32 nSampleRate, Word16 L_frame,
- STnsConfig tnsConfig[2][2]
- ,Word16 igfStopFreq
- ,Word32 bitrate
- )
+void InitTnsConfigs(
+ const Word16 bwidth,
+ const Word16 L_frame,
+ STnsConfig tnsConfig[2][2],
+ const Word16 igfStopFreq,
+ const Word32 total_brate,
+ const int16_t element_mode,
+ const int16_t MCT_flag
+)
{
- IF (GT_32(bitrate,ACELP_32k))
+ IF (GT_32(total_brate,ACELP_32k))
{
- InitTnsConfiguration(nSampleRate, shr(L_frame,1), &tnsConfig[0][0], igfStopFreq, bitrate);
+ InitTnsConfiguration(bwidth, shr(L_frame,1), &tnsConfig[0][0], igfStopFreq, total_brate, element_mode, MCT_flag);
}
- InitTnsConfiguration(nSampleRate, L_frame, &tnsConfig[1][0], igfStopFreq, bitrate);
- InitTnsConfiguration(nSampleRate, add(L_frame, shr(L_frame,2)), &tnsConfig[1][1], igfStopFreq, bitrate);
+ InitTnsConfiguration(bwidth, L_frame, &tnsConfig[1][0], igfStopFreq, total_brate, element_mode, MCT_flag);
+ InitTnsConfiguration(bwidth, add(L_frame, shr(L_frame,2)), &tnsConfig[1][1], igfStopFreq, total_brate, element_mode, MCT_flag);
}
-void SetTnsConfig(TCX_config * tcx_cfg, Word8 isTCX20, Word8 isAfterACELP)
+void SetTnsConfig(
+ TCX_CONFIG_HANDLE hTcxCfg, /* i : configuration of TCX */
+ Word8 isTCX20,
+ Word8 isAfterACELP
+)
{
move16();
- tcx_cfg->pCurrentTnsConfig = &tcx_cfg->tnsConfig[isTCX20][isAfterACELP];
- assert(tcx_cfg->pCurrentTnsConfig != NULL);
+ hTcxCfg->pCurrentTnsConfig = &hTcxCfg->tnsConfig[isTCX20][isAfterACELP];
+ assert(hTcxCfg->pCurrentTnsConfig != NULL);
}
+#ifdef IVAS_CODE_TCX_UTIL
+/*-------------------------------------------------------------------*
+ * SetAllowTnsOnWhite
+ *
+ * set TNS config flag for possible application of TNS in the whitened domain
+ *-------------------------------------------------------------------*/
+
+void SetAllowTnsOnWhite(
+ STnsConfig tnsConfig[2][2], /* o : updated TNS configurations */
+ const int8_t allowTnsOnWhite /* i : flag for TNS in whiteded domain mode */
+)
+{
+ tnsConfig[0][0].allowTnsOnWhite = allowTnsOnWhite;
+ tnsConfig[0][1].allowTnsOnWhite = allowTnsOnWhite;
+ tnsConfig[1][0].allowTnsOnWhite = allowTnsOnWhite;
+ tnsConfig[1][1].allowTnsOnWhite = allowTnsOnWhite;
-
-void tcx_get_gain(Word32 *x, /* i: spectrum 1 */
- Word16 x_e, /* i: spectrum 1 exponent */
- Word32 *y, /* i: spectrum 2 */
- Word16 y_e, /* i: spectrum 2 exponent */
- Word16 n, /* i: length */
- Word16 *gain, /* o: gain */
- Word16 *gain_e, /* o: gain exponent */
- Word32 *en_y, /* o: energy of y (optional) */
- Word16 *en_y_e /* o: energy of y exponent (optional) */
- )
+ return;
+}
+#endif
+
+void tcx_get_gain(
+ Word32 *x, /* i: spectrum 1 */
+ Word16 x_e, /* i: spectrum 1 exponent */
+ Word32 *y, /* i: spectrum 2 */
+ Word16 y_e, /* i: spectrum 2 exponent */
+ Word16 n, /* i: length */
+ Word16 *gain, /* o: gain */
+ Word16 *gain_e, /* o: gain exponent */
+ Word32 *en_y, /* o: energy of y (optional) */
+ Word16 *en_y_e /* o: energy of y exponent (optional) */
+)
{
Word32 maxX, minX, maxY, minY;
Word32 corr, ener;
@@ -1545,49 +1670,95 @@ void tcx_get_gain(Word32 *x, /* i: spectrum 1 */
}
}
+void init_TCX_config_dec( /* TEMPORARY */
+ TCX_CONFIG_HANDLE hTcxCfg,
+ Word16 L_frame,
+ Word16 fscale
+ , Word16 L_frameTCX
+ , Word16 fscaleFB
+)
+{
+ /* Initialize the TCX MDCT windows */
+ hTcxCfg->tcx_mdct_window_length = extract_l(L_shr(L_mult0(L_LOOK_12k8, fscale), LD_FSCALE_DENOM));
+ hTcxCfg->tcx_mdct_window_delay = hTcxCfg->tcx_mdct_window_length;
+ move16();
+
+ hTcxCfg->tcx_mdct_window_half_length = extract_l(L_shr(L_mult0(L_LOOK_12k8 - NS2SA(12800, 5000000L), fscale), LD_FSCALE_DENOM));
+
+ hTcxCfg->tcx_mdct_window_min_length = shr(L_frame, 4); /* 1.25ms */
+ hTcxCfg->tcx_mdct_window_trans_length = shr(L_frame, 4); /* 1.25ms */
+
+ hTcxCfg->tcx5Size = shr(L_frame, 2); /* 5ms */
+
+ hTcxCfg->tcx_mdct_window_lengthFB = extract_l(L_shr(L_mult0(L_LOOK_12k8, fscaleFB), LD_FSCALE_DENOM));
+ hTcxCfg->tcx_mdct_window_delayFB = hTcxCfg->tcx_mdct_window_lengthFB;
+ move16();
+
+ hTcxCfg->tcx_mdct_window_half_lengthFB = extract_l(L_shr(L_mult0(L_LOOK_12k8 - NS2SA(12800, 5000000L), fscaleFB), LD_FSCALE_DENOM));
+
+ hTcxCfg->tcx_mdct_window_min_lengthFB = shr(L_frameTCX, 4); /* 1.25ms */
+ hTcxCfg->tcx_mdct_window_trans_lengthFB = shr(L_frameTCX, 4); /* 1.25ms */
-void init_TCX_config(TCX_config *tcx_cfg,
- Word16 L_frame,
- Word16 fscale
- ,Word16 L_frameTCX
- ,Word16 fscaleFB
- )
+ hTcxCfg->tcx5SizeFB = shr(L_frameTCX, 2); /* 5ms */
+
+ mdct_window_sine(&hTcxCfg->tcx_mdct_window, hTcxCfg->tcx_mdct_window_length);
+ mdct_window_sine(&hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_half_length);
+ mdct_window_sine(&hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_min_length);
+ mdct_window_sine(&hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_trans_length);
+
+ mdct_window_sine(&hTcxCfg->tcx_mdct_windowFB, hTcxCfg->tcx_mdct_window_lengthFB);
+ mdct_window_sine(&hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_half_lengthFB);
+ mdct_window_sine(&hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_min_lengthFB);
+ mdct_window_sine(&hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_trans_lengthFB);
+
+ /*ALDO windows for MODE2*/
+ mdct_window_aldo(hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, L_frame);
+ mdct_window_aldo(hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, L_frameTCX);
+}
+
+void init_TCX_config(
+ TCX_CONFIG_HANDLE hTcxCfg,
+ Word16 L_frame,
+ Word16 fscale
+ ,Word16 L_frameTCX
+ ,Word16 fscaleFB
+)
{
/* Initialize the TCX MDCT windows */
- tcx_cfg->tcx_mdct_window_length = extract_l(L_shr(L_mult0(L_LOOK_12k8, fscale), LD_FSCALE_DENOM));
- tcx_cfg->tcx_mdct_window_delay = tcx_cfg->tcx_mdct_window_length;
+ hTcxCfg->tcx_mdct_window_length = extract_l(L_shr(L_mult0(L_LOOK_12k8, fscale), LD_FSCALE_DENOM));
+ hTcxCfg->tcx_mdct_window_delay = hTcxCfg->tcx_mdct_window_length;
move16();
- tcx_cfg->tcx_mdct_window_half_length = extract_l(L_shr(L_mult0(L_LOOK_12k8 - NS2SA(12800, 5000000L), fscale), LD_FSCALE_DENOM));
+ hTcxCfg->tcx_mdct_window_half_length = extract_l(L_shr(L_mult0(L_LOOK_12k8 - NS2SA(12800, 5000000L), fscale), LD_FSCALE_DENOM));
- tcx_cfg->tcx_mdct_window_min_length = shr(L_frame, 4); /* 1.25ms */
- tcx_cfg->tcx_mdct_window_trans_length = shr(L_frame, 4); /* 1.25ms */
+ hTcxCfg->tcx_mdct_window_min_length = shr(L_frame, 4); /* 1.25ms */
+ hTcxCfg->tcx_mdct_window_trans_length = shr(L_frame, 4); /* 1.25ms */
- tcx_cfg->tcx5Size = shr(L_frame, 2); /* 5ms */
+ hTcxCfg->tcx5Size = shr(L_frame, 2); /* 5ms */
- tcx_cfg->tcx_mdct_window_lengthFB = extract_l(L_shr(L_mult0(L_LOOK_12k8, fscaleFB), LD_FSCALE_DENOM));
- tcx_cfg->tcx_mdct_window_delayFB = tcx_cfg->tcx_mdct_window_lengthFB;
+ hTcxCfg->tcx_mdct_window_lengthFB = extract_l(L_shr(L_mult0(L_LOOK_12k8, fscaleFB), LD_FSCALE_DENOM));
+ hTcxCfg->tcx_mdct_window_delayFB = hTcxCfg->tcx_mdct_window_lengthFB;
move16();
- tcx_cfg->tcx_mdct_window_half_lengthFB = extract_l(L_shr(L_mult0(L_LOOK_12k8 - NS2SA(12800, 5000000L), fscaleFB), LD_FSCALE_DENOM));
+ hTcxCfg->tcx_mdct_window_half_lengthFB = extract_l(L_shr(L_mult0(L_LOOK_12k8 - NS2SA(12800, 5000000L), fscaleFB), LD_FSCALE_DENOM));
- tcx_cfg->tcx_mdct_window_min_lengthFB = shr(L_frameTCX, 4); /* 1.25ms */
- tcx_cfg->tcx_mdct_window_trans_lengthFB = shr(L_frameTCX, 4); /* 1.25ms */
+ hTcxCfg->tcx_mdct_window_min_lengthFB = shr(L_frameTCX, 4); /* 1.25ms */
+ hTcxCfg->tcx_mdct_window_trans_lengthFB = shr(L_frameTCX, 4); /* 1.25ms */
- tcx_cfg->tcx5SizeFB = shr(L_frameTCX, 2); /* 5ms */
+ hTcxCfg->tcx5SizeFB = shr(L_frameTCX, 2); /* 5ms */
- mdct_window_sine( &tcx_cfg->tcx_mdct_window, tcx_cfg->tcx_mdct_window_length );
- mdct_window_sine( &tcx_cfg->tcx_mdct_window_half, tcx_cfg->tcx_mdct_window_half_length );
- mdct_window_sine( &tcx_cfg->tcx_mdct_window_minimum, tcx_cfg->tcx_mdct_window_min_length );
- mdct_window_sine( &tcx_cfg->tcx_mdct_window_trans, tcx_cfg->tcx_mdct_window_trans_length );
+ mdct_window_sine( &hTcxCfg->tcx_mdct_window, hTcxCfg->tcx_mdct_window_length );
+ mdct_window_sine( &hTcxCfg->tcx_mdct_window_half, hTcxCfg->tcx_mdct_window_half_length );
+ mdct_window_sine( &hTcxCfg->tcx_mdct_window_minimum, hTcxCfg->tcx_mdct_window_min_length );
+ mdct_window_sine( &hTcxCfg->tcx_mdct_window_trans, hTcxCfg->tcx_mdct_window_trans_length );
- mdct_window_sine( &tcx_cfg->tcx_mdct_windowFB, tcx_cfg->tcx_mdct_window_lengthFB );
- mdct_window_sine( &tcx_cfg->tcx_mdct_window_halfFB, tcx_cfg->tcx_mdct_window_half_lengthFB );
- mdct_window_sine( &tcx_cfg->tcx_mdct_window_minimumFB, tcx_cfg->tcx_mdct_window_min_lengthFB );
- mdct_window_sine( &tcx_cfg->tcx_mdct_window_transFB, tcx_cfg->tcx_mdct_window_trans_lengthFB );
+ mdct_window_sine( &hTcxCfg->tcx_mdct_windowFB, hTcxCfg->tcx_mdct_window_lengthFB );
+ mdct_window_sine( &hTcxCfg->tcx_mdct_window_halfFB, hTcxCfg->tcx_mdct_window_half_lengthFB );
+ mdct_window_sine( &hTcxCfg->tcx_mdct_window_minimumFB, hTcxCfg->tcx_mdct_window_min_lengthFB );
+ mdct_window_sine( &hTcxCfg->tcx_mdct_window_transFB, hTcxCfg->tcx_mdct_window_trans_lengthFB );
/*ALDO windows for MODE2*/
- mdct_window_aldo(tcx_cfg->tcx_aldo_window_1, tcx_cfg->tcx_aldo_window_1_trunc, tcx_cfg->tcx_aldo_window_2, L_frame);
- mdct_window_aldo(tcx_cfg->tcx_aldo_window_1_FB, tcx_cfg->tcx_aldo_window_1_FB_trunc, tcx_cfg->tcx_aldo_window_2_FB, L_frameTCX);
+ mdct_window_aldo(hTcxCfg->tcx_aldo_window_1, hTcxCfg->tcx_aldo_window_1_trunc, hTcxCfg->tcx_aldo_window_2, L_frame);
+ mdct_window_aldo(hTcxCfg->tcx_aldo_window_1_FB, hTcxCfg->tcx_aldo_window_1_FB_trunc, hTcxCfg->tcx_aldo_window_2_FB, L_frameTCX);
}
diff --git a/lib_com/tec_com.c b/lib_com/tec_com.c
index 66114892d074e1bf51020a156141939cb259b7e6..d61dbad07fc54d093d556be2a64d35eaa5599ede 100644
--- a/lib_com/tec_com.c
+++ b/lib_com/tec_com.c
@@ -2,30 +2,30 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
-#include
-#include
-#include "stl.h"
+#include
+#include "options.h"
#include "basop_util.h"
#include "prot_fx.h"
#include "cnst_fx.h"
+/*-------------------------------------------------------------------
+ * Local constants
+ *-------------------------------------------------------------------*/
-#ifndef EPS
-#define EPS ( 1e-12f)
-#endif
-
+/*#define EPS ( 1e-12f)*/
#define ENV_SCALE_OFFSET_1_FX 1515133568l/*90.309f/128.0 Q31*/ /* 10*log10(2^30) */ /* scaled by 1/128.0 */
-#define MAX_TEC_BW_LO (12)
-#define MAX_NB_TEC_LOW_BAND ( 3)
-
-static const Word16 TecSmoothingDeg = 5;
-static const Word16 NbTecLowBand = 3;
-
-#define LOBUF_NO_SMOOTHING_MODE 1
-
-void
-resetTecDec_Fx(
+#define MAX_TEC_BW_LO (12)
+#define MAX_NB_TEC_LOW_BAND ( 3)
+#define NBTECLOWBAND 3
+#define TECSMOOTHINGDEG 5
+#define LOBUF_NO_SMOOTHING_MODE 1
+
+/*-------------------------------------------------------------------
+ * resetTecDec_Fx()
+ *
+ *
+ *-------------------------------------------------------------------*/
+void resetTecDec_Fx(
HANDLE_TEC_DEC_FX hTecDec
)
{
@@ -38,9 +38,12 @@ resetTecDec_Fx(
return;
}
-
-void
-resetTecEnc_Fx(HANDLE_TEC_ENC_FX hTecEnc, Word16 flag)
+/*-------------------------------------------------------------------
+ * resetTecEnc_Fx()
+ *
+ *
+ *-------------------------------------------------------------------*/
+void resetTecEnc_Fx(TEC_ENC_HANDLE_FX hTecEnc, Word16 flag)
{
IF (flag == 0)
{
@@ -56,8 +59,17 @@ resetTecEnc_Fx(HANDLE_TEC_ENC_FX hTecEnc, Word16 flag)
return;
}
+/*-------------------------------------------------------------------
+ * calcVar()
+ *
+ *
+ *-------------------------------------------------------------------*/
-static Word32 calcVar_Fix(const Word32 in[], Word32 len, Word32* x)
+static Word32 calcVar_Fix(
+ const Word32 in[],
+ const Word32 len,
+ Word32* x
+)
{
Word32 xx;
Word32 i;
@@ -101,11 +113,21 @@ static Word32 calcVar_Fix(const Word32 in[], Word32 len, Word32* x)
}
return ans;
}
-
-static Word32
-calcCorrelationCoefficient2_Fix(
- const Word32 in_vec1[], const Word32 in_vec2[], Word32 len,
- Word32 var_x, Word32 var_y, Word32 x, Word32 y)
+/*-------------------------------------------------------------------
+ * calcCorrelationCoefficient2()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static Word32 calcCorrelationCoefficient2_Fix(
+ const Word32 in_vec1[],
+ const Word32 in_vec2[],
+ const Word32 len,
+ Word32 var_x,
+ Word32 var_y,
+ Word32 x,
+ Word32 y
+)
{
Word16 i;
@@ -207,15 +229,19 @@ calcCorrelationCoefficient2_Fix(
return ans;
}
-
-static void
-calcLoBufferEnc_Fx (Word32 **pCldfbPow_Fx, /* Q31 */
- Word16 scale,
- Word16 startPos,
- Word16 stopPos,
- Word16 bandOffsetBottom,
- Word16 *loBuffer /* Q8 = Q(15 - (LD_DATA_SCALE + 1)) */
- )
+/*-------------------------------------------------------------------
+ * calcLoBufferEnc()
+ *
+ *
+ *-------------------------------------------------------------------*/
+static void calcLoBufferEnc_Fx (
+ Word32 **pCldfbPow_Fx, /* Q31 */
+ const Word16 scale,
+ const Word16 startPos,
+ const Word16 stopPos,
+ const Word16 bandOffsetBottom,
+ Word16 *loBuffer /* Q8 = Q(15 - (LD_DATA_SCALE + 1)) */
+)
{
Word16 lb;
Word16 li;
@@ -231,7 +257,7 @@ calcLoBufferEnc_Fx (Word32 **pCldfbPow_Fx, /* Q31 */
/* scaling nrg : scale - 1 (sum up nrg) + 1 (inv_bw = 0.5) */
- FOR (lb=0; lb < NbTecLowBand; lb++)
+ FOR (lb=0; lb < NBTECLOWBAND; lb++)
{
li = TecLowBandTable[lb];
move16();
@@ -266,16 +292,21 @@ calcLoBufferEnc_Fx (Word32 **pCldfbPow_Fx, /* Q31 */
}
}
-
-static void
-calcHiTempEnv_Fx(Word32 **pCldfbPow, /* Q31 */
- Word16 scale,
- Word16 startPos,
- Word16 stopPos,
- Word16 lowSubband,
- Word16 highSubband,
- Word16 *hiTempEnv /* Q7 = Q(15 - (LD_DATA_SCALE + 2)) */
- )
+/*-------------------------------------------------------------------
+ * calcHiTempEnv()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static void calcHiTempEnv_Fx(
+ Word32 **pCldfbPow, /* Q31 */
+ Word16 scale,
+ const Word16 startPos,
+ const Word16 stopPos,
+ const Word16 lowSubband,
+ const Word16 highSubband,
+ Word16 *hiTempEnv /* Q7 = Q(15 - (LD_DATA_SCALE + 2)) */
+)
{
Word16 k;
Word16 s1;
@@ -325,16 +356,21 @@ calcHiTempEnv_Fx(Word32 **pCldfbPow, /* Q31 */
}
}
-
-static void
-calcLoBufferDec_Fx(Word32 **pCldfbReal,
- Word32 **pCldfbImag,
- Word16 *loBuffer,
- Word16 startPos,
- Word16 stopPos,
- Word16 offset,
- Word16 scale
- )
+/*-------------------------------------------------------------------
+ * calcLoBufferDec()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static void calcLoBufferDec_Fx(
+ Word32 **pCldfbReal,
+ Word32 **pCldfbImag,
+ Word16 *loBuffer,
+ const Word16 startPos,
+ const Word16 stopPos,
+ const Word16 offset,
+ const Word16 scale
+)
{
Word16 k;
Word16 lb;
@@ -350,7 +386,7 @@ calcLoBufferDec_Fx(Word32 **pCldfbReal,
{
tmp = L_deposit_l(0);
- FOR (lb=0; lb < NbTecLowBand; lb++)
+ FOR (lb=0; lb < NBTECLOWBAND; lb++)
{
Word16 li;
Word16 ui;
@@ -412,13 +448,17 @@ calcLoBufferDec_Fx(Word32 **pCldfbReal,
}
}
}
-
-static void
-calcLoTempEnv_Fx(Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA_SCALE+1)) */
- Word16 noCols,
- Word16* loTempEnv_Fx, /* Q7 = Q(15 - (LD_DATA_SCALE+2)) */
- Word16 adjFac_Fx
- )
+/*-------------------------------------------------------------------
+ * calcLoTempEnv_Fx()
+ *
+ *
+ *-------------------------------------------------------------------*/
+static void calcLoTempEnv_Fx(
+ Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA_SCALE+1)) */
+ const Word16 noCols,
+ Word16* loTempEnv_Fx, /* Q7 = Q(15 - (LD_DATA_SCALE+2)) */
+ const Word16 adjFac_Fx
+)
{
Word16 i;
Word16 slot;
@@ -428,7 +468,7 @@ calcLoTempEnv_Fx(Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA_SCALE+1)) */
FOR (slot = 0; slot < noCols; slot++)
{
accu = L_mult0(TecSC_Fx[0], loBuffer_Fx[slot]);
- FOR (i=1; i < TecSmoothingDeg + 1; i++)
+ FOR (i=1; i < TECSMOOTHINGDEG + 1; i++)
{
accu = L_mac0(accu,TecSC_Fx[i], loBuffer_Fx[sub(slot, i)]);
}
@@ -436,11 +476,16 @@ calcLoTempEnv_Fx(Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA_SCALE+1)) */
loTempEnv_Fx[slot] = extract_h(Mpy_32_16_1(accu,adjFac_Fx));
}
}
-
-static void calcLoTempEnv_ns_Fx(Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA_SCALE+1)) */
- Word16 noCols,
- Word16* loTempEnv_Fx /* Q7 = Q(15 - (LD_DATA_SCALE+2)) */
- )
+ /*-------------------------------------------------------------------
+ * calcLoTempEnv_ns()
+ *
+ *
+ *-------------------------------------------------------------------*/
+static void calcLoTempEnv_ns_Fx(
+ Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA_SCALE+1)) */
+ const Word16 noCols,
+ Word16* loTempEnv_Fx /* Q7 = Q(15 - (LD_DATA_SCALE+2)) */
+)
{
Word16 slot;
@@ -452,13 +497,17 @@ static void calcLoTempEnv_ns_Fx(Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA_SCA
return;
}
-
-static void
-calcLoTempEnv_TBE_Fx(Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA_SCALE+1)) */
- Word16 noCols,
- Word16* loTempEnv_Fx, /* Q7 = Q(15 - (LD_DATA_SCALE+2)) */
- Word16 adjFac_Fx
- )
+/*-------------------------------------------------------------------
+ * calcLoTempEnv_ns_TBE()
+ *
+ *
+ *-------------------------------------------------------------------*/
+static void calcLoTempEnv_TBE_Fx(
+ Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA_SCALE+1)) */
+ const Word16 noCols,
+ Word16* loTempEnv_Fx, /* Q7 = Q(15 - (LD_DATA_SCALE+2)) */
+ const Word16 adjFac_Fx
+)
{
Word16 i;
Word16 slot;
@@ -469,7 +518,7 @@ calcLoTempEnv_TBE_Fx(Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA_SCALE+1)) */
FOR (slot = 0; slot < noCols; slot++)
{
accu = L_mult0(TecSC_Fx[0], loBuffer_Fx[slot - delay]);
- FOR (i=1; i < TecSmoothingDeg + 1; i++)
+ FOR (i=1; i < TECSMOOTHINGDEG + 1; i++)
{
accu = L_mac0(accu,TecSC_Fx[i], loBuffer_Fx[slot-i-delay]);
}
@@ -477,11 +526,17 @@ calcLoTempEnv_TBE_Fx(Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA_SCALE+1)) */
loTempEnv_Fx[slot] = extract_h(Mpy_32_16_1(accu,adjFac_Fx));
}
}
-
-static void calcLoTempEnv_ns_TBE_Fx(Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA_SCALE+1)) */
- Word16 noCols,
- Word16* loTempEnv_Fx /* Q7 = Q(15 - (LD_DATA_SCALE+2)) */
- )
+/*-------------------------------------------------------------------
+ * calcLoTempEnv_ns_TBE()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static void calcLoTempEnv_ns_TBE_Fx(
+ Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA_SCALE+1)) */
+ const Word16 noCols,
+ Word16* loTempEnv_Fx /* Q7 = Q(15 - (LD_DATA_SCALE+2)) */
+)
{
Word16 slot;
Word16 delay = 1;
@@ -496,12 +551,18 @@ static void calcLoTempEnv_ns_TBE_Fx(Word16* loBuffer_Fx, /* Q8 = Q(15 - (LD_DATA
return;
}
-
-static void calcGainLinear_TBE_Fx(const Word16* loTempEnv_m, /* Q7 = Q(15 - (LD_DATA_SCALE+2)) */
- const Word16 startPos,
- const Word16 stopPos,
- Word16* pGainTemp_m, /* Q0 */
- Word16* pGainTemp_e /* Q0 */)
+/*-------------------------------------------------------------------
+ * calcGainLinear_TBE()
+ *
+ *
+ *-------------------------------------------------------------------*/
+static void calcGainLinear_TBE_Fx(
+ const Word16* loTempEnv_m, /* Q7 = Q(15 - (LD_DATA_SCALE+2)) */
+ const Word16 startPos,
+ const Word16 stopPos,
+ Word16* pGainTemp_m, /* Q0 */
+ Word16* pGainTemp_e /* Q0 */
+)
{
Word16 slot;
@@ -554,25 +615,28 @@ static void calcGainLinear_TBE_Fx(const Word16* loTempEnv_m, /* Q7 = Q(15 - (LD_
pGainTemp_e[slot] = sub(s,s2);
}
}
-
-void
-calcGainTemp_TBE_Fx(
+/*-------------------------------------------------------------------
+ * calcGainTemp_TBE()
+ *
+ *
+ *-------------------------------------------------------------------*/
+void calcGainTemp_TBE_Fx(
Word32** pCldfbRealSrc_Fx,
Word32** pCldfbImagSrc_Fx,
Word16 cldfb_exp,
Word16* loBuffer_Fx,
- Word16 startPos, /*!< Start position of the current envelope. */
- Word16 stopPos, /*!< Stop position of the current envelope. */
- Word16 lowSubband, /* lowSubband */
+ const Word16 startPos, /*!< Start position of the current envelope. */
+ const Word16 stopPos, /*!< Stop position of the current envelope. */
+ const Word16 lowSubband, /* lowSubband */
Word16* pGainTemp_m,
- Word16* pGainTemp_e
- , Word16 code
+ Word16* pGainTemp_e,
+ const Word16 code
)
{
Word16 loTempEnv_Fx[16];
- const Word16 BW_LO = TecLowBandTable[NbTecLowBand];
+ const Word16 BW_LO = TecLowBandTable[NBTECLOWBAND];
Word16 slot;
Word16 noCols = stopPos - startPos;
@@ -612,19 +676,34 @@ calcGainTemp_TBE_Fx(
move16();
}
}
-
-static void setSubfrConfig_Fix(Word16 i_offset, Word16* k_offset, Word16* n_subfr
- , Word16 l_subfr
- )
+/*-------------------------------------------------------------------
+ * setSubfrConfig()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static void setSubfrConfig_Fix(
+ const Word16 i_offset,
+ Word16* k_offset,
+ Word16* n_subfr,
+ const Word16 l_subfr
+)
{
*n_subfr = sub((Word16)N_TEC_TFA_SUBFR,i_offset);
*k_offset = i_mult(i_offset,l_subfr);
}
-
-static Word16 calcSum_Fx(Word16* vec_m, /*Q0*/
- Word16* vec_e, /*Q0*/
- const Word16 len,
- Word16* sum16_m /*Q0*/)
+/*-------------------------------------------------------------------
+ * calcSum_Fx()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static Word16 calcSum_Fx(
+ Word16* vec_m, /*Q0*/
+ Word16* vec_e, /*Q0*/
+ const Word16 len,
+ Word16* sum16_m /*Q0*/
+)
{
Word16 slot;
Word16 sum16_e; /* Q0 */
@@ -644,17 +723,21 @@ static Word16 calcSum_Fx(Word16* vec_m, /*Q0*/
return sum16_e;
}
-
-
-static Word16 calcSubfrNrg_Fx(Word16* hb_synth_Fx,
- Word16 exp_syn,
- const Word16 i_offset,
- Word16* enr_m,
- Word16* enr_e,
- Word16 k_offset,
- Word16* sum16_m
- ,Word16 l_subfr
- )
+/*-------------------------------------------------------------------
+ * calcSubfrNrg()
+ *
+ *
+ *-------------------------------------------------------------------*/
+static Word16 calcSubfrNrg_Fx(
+ Word16* hb_synth_Fx,
+ Word16 exp_syn,
+ const Word16 i_offset,
+ Word16* enr_m,
+ Word16* enr_e,
+ const Word16 k_offset,
+ Word16* sum16_m,
+ const Word16 l_subfr
+)
{
Word16 i, j, k;
Word16 s;
@@ -723,16 +806,21 @@ static Word16 calcSubfrNrg_Fx(Word16* hb_synth_Fx,
return sum16_e;
}
-
-static Word16 procTec_Fx(Word16* hb_synth_Fx,
- Word16 exp_syn,
- Word16* gain_m,
- Word16* gain_e,
-
- Word16 i_offset,
- Word16 l_subfr
- , Word16 code
- )
+/*-------------------------------------------------------------------
+ * procTec()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+static Word16 procTec_Fx(
+ Word16* hb_synth_Fx,
+ Word16 exp_syn,
+ Word16* gain_m,
+ Word16* gain_e,
+ const Word16 i_offset,
+ const Word16 l_subfr,
+ const Word16 code
+)
{
Word16 i,j,k;
Word16 k_offset, n_subfr;
@@ -981,12 +1069,17 @@ static Word16 procTec_Fx(Word16* hb_synth_Fx,
return exp_syn;
}
-
-static Word16 procTfa_Fx(Word16* hb_synth_Fx,
- Word16 exp_syn,
- Word16 i_offset,
- Word16 l_subfr
- )
+/*-------------------------------------------------------------------
+ * procTfa_TBE()
+ *
+ *
+ *-------------------------------------------------------------------*/
+static Word16 procTfa_Fx(
+ Word16* hb_synth_Fx,
+ Word16 exp_syn,
+ const Word16 i_offset,
+ const Word16 l_subfr
+)
{
Word16 i,j,k;
Word16 k_offset, n_subfr;
@@ -1108,17 +1201,21 @@ static Word16 procTfa_Fx(Word16* hb_synth_Fx,
return exp_syn;
}
-
-
-Word16 procTecTfa_TBE_Fx(Word16 *hb_synth_Fx,
- Word16 hb_synth_fx_exp,
- Word16 *gain_m,
- Word16 *gain_e,
- Word16 flat_flag,
- Word16 last_core
- , Word16 l_subfr
- , Word16 code
- )
+/*-------------------------------------------------------------------
+ * procTecTfa_TBE()
+ *
+ *
+ *-------------------------------------------------------------------*/
+Word16 procTecTfa_TBE_Fx(
+ Word16 *hb_synth_Fx,
+ Word16 hb_synth_fx_exp,
+ Word16 *gain_m,
+ Word16 *gain_e,
+ const Word16 flat_flag,
+ const Word16 last_core,
+ const Word16 l_subfr,
+ const Word16 code
+)
{
Word16 i_offset = 0;
Word16 exp_syn_frame = sub(15, hb_synth_fx_exp);
@@ -1158,18 +1255,23 @@ Word16 procTecTfa_TBE_Fx(Word16 *hb_synth_Fx,
}
-void
-calcHiEnvLoBuff_Fix(
- Word16 noCols,
- Word16* pFreqBandTable, /*!< freqbandTable. */
- Word16 nSfb, /*!< Number of scalefactors. */
- Word32** pCldfbPow_Fix /*float** pCldfbPow*/,
- Word16* loBuffer_Fix /*float* loBuffer Q8*/,
- Word16* hiTempEnvOrig_Fix /*float* hiTempEnvOrig*/,
+/*-------------------------------------------------------------------
+ * calcHiEnvLoBuff()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void calcHiEnvLoBuff_Fix(
+ const Word16 noCols,
+ const Word16* pFreqBandTable, /*!< freqbandTable. */
+ const Word16 nSfb, /*!< Number of scalefactors. */
+ Word32** pCldfbPow_Fix /*float** pCldfbPow*/,
+ Word16* loBuffer_Fix /*float* loBuffer Q8*/,
+ Word16* hiTempEnvOrig_Fix /*float* hiTempEnvOrig*/,
Word16 pCldfbPow_FixScale
)
{
- const Word16 BW_LO = TecLowBandTable[NbTecLowBand];
+ const Word16 BW_LO = TecLowBandTable[NBTECLOWBAND];
const Word16 lowSubband = pFreqBandTable[0];
const Word16 highSubband = pFreqBandTable[nSfb];
@@ -1202,18 +1304,22 @@ calcHiEnvLoBuff_Fix(
/* ============================================================ */
}
-void
-calcLoEnvCheckCorrHiLo_Fix(
- Word16 noCols,
- Word16* pFreqBandTable, /*!< freqbandTable. */
- Word16* loBuffer_Fix /*float* loBuffer Q8*/,
- Word16* loTempEnv_Fix /*float* loTempEnv Q7*/,
- Word16* loTempEnv_ns_Fix /* float* loTempEnv_ns*/,
- Word16* hiTempEnvOrig_Fix /*float* hiTempEnvOrig*/,
- Word16* corrFlag /*int* corrFlag*/
+/*-------------------------------------------------------------------
+ * calcLoEnvCheckCorrHiLo()
+ *
+ *
+ *-------------------------------------------------------------------*/
+void calcLoEnvCheckCorrHiLo_Fix(
+ const Word16 noCols,
+ const Word16* pFreqBandTable, /*!< freqbandTable. */
+ Word16* loBuffer_Fix /*float* loBuffer Q8*/,
+ Word16* loTempEnv_Fix /*float* loTempEnv Q7*/,
+ Word16* loTempEnv_ns_Fix /* float* loTempEnv_ns*/,
+ Word16* hiTempEnvOrig_Fix /*float* hiTempEnvOrig*/,
+ Word16* corrFlag /*int* corrFlag*/
)
{
- const Word16 BW_LO = TecLowBandTable[NbTecLowBand];
+ const Word16 BW_LO = TecLowBandTable[NBTECLOWBAND];
const Word16 lowSubband = pFreqBandTable[0];
Word16 i;
@@ -1452,7 +1558,17 @@ calcLoEnvCheckCorrHiLo_Fix(
}
-void tecEnc_TBE_fx(Word16* corrFlag, const Word16* voicing, Word16 coder_type)
+/*-------------------------------------------------------------------
+ * tecEnc_TBE()
+ *
+ *
+ *-------------------------------------------------------------------*/
+
+void tecEnc_TBE_fx(
+ Word16* corrFlag,
+ const Word16* voicing,
+ const Word16 coder_type
+)
{
Word16 voice_sum;
Word16 voice_diff;
@@ -1475,7 +1591,7 @@ void tecEnc_TBE_fx(Word16* corrFlag, const Word16* voicing, Word16 coder_type)
test();
test();
/*if( ((voice_sum > 0.35 * 2 && voice_sum < 0.55 * 2) && (voice_diff < 0.2)) )*/
- if( EQ_16(coder_type,INACTIVE)||((GT_16(voice_sum,11469/*0.35 Q15*/)&<_16(voice_sum,18022/*0.55 Q15*/))&&(sub(voice_diff,6554/*0.2 Q15*/)<0)))
+ if( EQ_16(coder_type,INACTIVE) || (GT_16(voice_sum,11469/*0.35 Q15*/) && LT_16(voice_sum,18022/*0.55 Q15*/) && (sub(voice_diff,6554/*0.2 Q15*/)<0)))
{
*corrFlag = 0;
move16();
@@ -1487,8 +1603,16 @@ void tecEnc_TBE_fx(Word16* corrFlag, const Word16* voicing, Word16 coder_type)
move16();
}
}
-
-void set_TEC_TFA_code_fx(const Word16 corrFlag, Word16* tec_flag, Word16* tfa_flag)
+/*-------------------------------------------------------------------
+ * set_TEC_TFA_code()
+ *
+ *
+ *-------------------------------------------------------------------*/
+void set_TEC_TFA_code_fx(
+ const Word16 corrFlag,
+ Word16* tec_flag,
+ Word16* tfa_flag
+)
{
*tec_flag = 0;
move16();
diff --git a/lib_com/tns_base.c b/lib_com/tns_base.c
index a39813b31b976c6c0b1a61c784b85dbbeca895b1..a60d207c47c983eb99fe0a7b4e62b9ce75b6d6cf 100644
--- a/lib_com/tns_base.c
+++ b/lib_com/tns_base.c
@@ -3,16 +3,26 @@
====================================================================================*/
-#include "stl.h"
-#include "stat_com.h"
-#include "stl.h"
-#include
#include
+#include
+#include
+#include "options.h"
+#include "stat_com.h"
#include "rom_com_fx.h"
#include "prot_fx.h"
#include "basop_util.h"
+/*----------------------------------------------------------------------------
+ * Local constants
+ *---------------------------------------------------------------------------*/
+
#define HLM_MIN_NRG 32768.0f
+#define MAX_SUBDIVISIONS 3
+
+
+/*----------------------------------------------------------------------------
+ * Local prototypes
+ *---------------------------------------------------------------------------*/
/** Linear prediction analysis/synthesis filter definition.
* @param order filter order.
@@ -34,7 +44,7 @@ static void Index2Parcor(Word16 const index[], Word16 parCoeff[], Word16 order);
/** Linear prediction analysis filter.
* See TLinearPredictionFilter for details.
*/
-static Word32 FIRLattice(Word16 order, const Word16 *parCoeff, Word32 *state, Word32 x);
+static Word32 FIRLattice(const Word16 order, const Word16 *parCoeff, Word32 *state, Word32 x);
/** Linear prediction synthesis filter.
* See TLinearPredictionFilter for details.
@@ -51,53 +61,52 @@ static Word32 IIRLattice(Word16 order, const Word16 *parCoeff, Word32 *state, Wo
* @param output filtered output spectrum values.
Inplace operation is supported, so it can be equal to spectrum.
*/
-static void TnsFilter(Word32 const spectrum[], Word16 numOfLines,
- Word16 const parCoeff[], Word16 order,
- TLinearPredictionFilter filter, Word32 * state,
- Word32 output[]);
-
-static void ITF_TnsFilter_fx( Word32 const spectrum[],
- const Word16 numOfLines,
- const Word16 A[], /* Q14 */
- const Word16 Q_A,
- const Word16 order,
- Word32 output[]);
-
-static void ITF_GetFilterParameters_fx(Word32 rxx[],
- Word16 maxOrder,
- Word16* A, /* Q14 */
- Word16* Q_A,
- Word16* predictionGain);
+static void TnsFilter(const Word32 spectrum[], const Word16 numOfLines, const Word16 parCoeff[], const Word16 order, TLinearPredictionFilter filter, Word32 * state, Word32 output[]);
+
+static void ITF_TnsFilter_fx( const Word32 spectrum[], const Word16 numOfLines, const Word16 A[], /* Q14 */ const Word16 Q_A, const Word16 order, Word32 output[]);
+
+static void ITF_GetFilterParameters_fx(Word32 rxx[], const Word16 maxOrder, Word16* A, /* Q14 */Word16* Q_A, Word16* predictionGain);
/********************************/
/* Interface functions */
/********************************/
-#define MAX_SUBDIVISIONS 3
-
-Word16 InitTnsConfiguration(
- Word32 nSampleRate,
- Word16 frameLength,
+/** Init TNS configuration.
+ * Fills STnsConfig structure with sensible content.
+ * @param nSampleRate Sampling rate of the input.
+ * @param nFrameLength Frame length.
+ * @param pTnsConfig TNS configuration to be initialized.
+ * @return 0 on success, otherwise 1.
+ */
+void InitTnsConfiguration(
+ const Word16 bwidth,
+ const Word16 frameLength,
STnsConfig * pTnsConfig,
- Word16 igfStopFreq,
- Word32 bitrate
+ const Word16 igfStopFreq,
+ const Word32 total_brate,
+ const int16_t element_mode,
+ const int16_t is_mct
)
{
Word16 iFilter = 0;
Word16 * startLineFilter;
Word32 L_tmp;
+ Word32 nSampleRate;
Word16 s1;
Word16 s2;
-
-
- move16();
+#ifndef ADD_IVAS_TNS
+ MY_UNUSED_Word(element_mode);
+ MY_UNUSED_Word(is_mct);
+#endif
+ nSampleRate = bwMode2fs[bwidth];
+ move32();
startLineFilter = &pTnsConfig->iFilterBorders[1];
/* Sanity checks */
assert((nSampleRate > 0) && (frameLength > 0) && (pTnsConfig != NULL));
if ((nSampleRate <= 0) || (frameLength <= 0) || (pTnsConfig == NULL))
{
- return TNS_FATAL_ERROR;
+ return /*TNS_FATAL_ERROR*/;
}
@@ -105,7 +114,7 @@ Word16 InitTnsConfiguration(
move16();
pTnsConfig->maxOrder = TNS_MAX_FILTER_ORDER;
- IF (LE_32(bitrate, ACELP_32k))
+ IF (LE_32(total_brate, ACELP_32k))
{
move16();
move16();
@@ -123,18 +132,36 @@ Word16 InitTnsConfiguration(
pTnsConfig->pTnsParameters = tnsParameters48kHz_grouped;
}
ELSE
- IF ( GT_32(nSampleRate,16000))
+ IF ( GT_32(nSampleRate,INT_FS_16k))
{
- move16();
- pTnsConfig->nMaxFilters = sizeof(tnsParameters32kHz)/sizeof(tnsParameters32kHz[0]);
+#ifdef ADD_IVAS_TNS
+ if ((element_mode > IVAS_SCE) && (total_brate >= (is_mct ? IVAS_32k : IVAS_48k)))
+ {
+ pTnsConfig->nMaxFilters = sizeof(tnsParameters32kHz_Stereo) / sizeof(tnsParameters32kHz_Stereo[0]);
+ if (nSampleRate == 100 * frameLength) /* sub-frame length is <= 10 ms */
+ {
+ pTnsConfig->pTnsParameters = tnsParameters32kHz_grouped;
+ }
+ else
+ {
+ pTnsConfig->pTnsParameters = tnsParameters32kHz_Stereo;
+ }
+ }
+ else
+#endif
+ {
- move16();
- pTnsConfig->pTnsParameters = tnsParameters32kHz;
+ move16();
+ pTnsConfig->nMaxFilters = sizeof(tnsParameters32kHz) / sizeof(tnsParameters32kHz[0]);
- if ( EQ_32(nSampleRate, L_mult0(100, frameLength))) /* sub-frame length is <= 10 ms */
- {
move16();
- pTnsConfig->pTnsParameters = tnsParameters32kHz_grouped;
+ pTnsConfig->pTnsParameters = tnsParameters32kHz;
+
+ if (EQ_32(nSampleRate, L_mult0(100, frameLength))) /* sub-frame length is <= 10 ms */
+ {
+ move16();
+ pTnsConfig->pTnsParameters = tnsParameters32kHz_grouped;
+ }
}
}
ELSE
@@ -183,18 +210,24 @@ Word16 InitTnsConfiguration(
move16();
pTnsConfig->iFilterBorders[0] = frameLength;
}
-
- return TNS_NO_ERROR;
+#ifdef ADD_IVAS_TNS
+ pTnsConfig->allowTnsOnWhite = 0;
+#endif
+ return; /*TNS_NO_ERROR;*/
}
+/*-------------------------------------------------------------------*
+ * ApplyTnsFilter()
+ *
+ *-------------------------------------------------------------------*/
-Word16 ApplyTnsFilter(
+void ApplyTnsFilter(
STnsConfig const * pTnsConfig,
STnsData const * pTnsData,
Word32 spectrum[],
- Word8 fIsAnalysis)
+ const Word8 fIsAnalysis
+)
{
- Word16 result;
TLinearPredictionFilter filter;
Word32 state[TNS_MAX_FILTER_ORDER];
Word16 iFilter;
@@ -216,7 +249,7 @@ Word16 ApplyTnsFilter(
FOR (iFilter = pTnsConfig->nMaxFilters-1; iFilter >= 0; iFilter--)
{
Word16 parCoeff[TNS_MAX_FILTER_ORDER];
- STnsFilter const * pFilter;
+ const STnsFilter * pFilter;
move16();
@@ -236,47 +269,48 @@ Word16 ApplyTnsFilter(
}
move16();
- result = TNS_NO_ERROR;
- if (pTnsData->nFilters < 0)
- {
- move16();
- result = TNS_FATAL_ERROR;
- }
- return result;
+ return /*result*/;
}
-TNS_ERROR ITF_Apply_fx(Word32 spectrum[],
- Word16 startLine,
- Word16 stopLine,
- const Word16* A,
- Word16 Q_A,
- Word16 order
- )
+/*-------------------------------------------------------------------*
+ * ITF_Apply()
+ *
+ *-------------------------------------------------------------------*/
+
+void ITF_Apply_fx(
+ Word32 spectrum[],
+ Word16 startLine,
+ Word16 stopLine,
+ const Word16* A,
+ Word16 Q_A,
+ Word16 order
+)
{
- ITF_TnsFilter_fx(&spectrum[startLine],
- (Word16)(stopLine-startLine),
- A,
- Q_A,
- (Word16)order,
- &spectrum[startLine]);
+ ITF_TnsFilter_fx(&spectrum[startLine],(Word16)(stopLine-startLine), A, Q_A, (Word16)order, &spectrum[startLine]);
- return TNS_NO_ERROR;
+ return /*TNS_NO_ERROR*/;
}
-
-Word16 ITF_Detect_fx(Word32 const pSpectrum[],
- Word16 startLine,
- Word16 stopLine,
- Word16 maxOrder,
- Word16* A,
- Word16* Q_A,
- Word16* predictionGain,
- Word16* curr_order,
- Word16 Q )
+/*-------------------------------------------------------------------*
+* ITF_Detect()
+*
+*
+*-------------------------------------------------------------------*/
+
+Word16 ITF_Detect_fx(
+ const Word32 pSpectrum[],
+ const Word16 startLine,
+ const Word16 stopLine,
+ const Word16 maxOrder,
+ Word16* A,
+ Word16* Q_A,
+ Word16* predictionGain,
+ Word16* curr_order,
+ Word16 Q
+)
{
- Word16 const idx0 = startLine;
- Word16 const idx1 = stopLine;
+
Word16 spectrumLength;
Word16 const nSubdivisions = MAX_SUBDIVISIONS;
Word16 iSubdivisions;
@@ -306,15 +340,15 @@ Word16 ITF_Detect_fx(Word32 const pSpectrum[],
{
assert((nSubdivisions == 1) || (nSubdivisions == 3));
- tmp = sub(idx1, idx0);
+ tmp = sub(stopLine, startLine);
iStartLine = imult1616(tmp, iSubdivisions);
iEndLine = add(iStartLine, tmp);
if (EQ_16(nSubdivisions, 3))iStartLine=mult(iStartLine,0x2AAB);
- iStartLine = add(iStartLine, idx0);
+ iStartLine = add(iStartLine, startLine);
if (EQ_16(nSubdivisions, 3))iEndLine=mult(iEndLine,0x2AAB);
- iEndLine = add(iEndLine, idx0);
+ iEndLine = add(iEndLine, startLine);
headroom = getScaleFactor32(pSpectrum+iStartLine-IGF_START_MN, sub(iEndLine, iStartLine));
/* Calculate norm of spectrum band */
L_tmp = Norm32Norm(pSpectrum+iStartLine-IGF_START_MN, headroom, sub(iEndLine, iStartLine), &shift);
@@ -358,72 +392,68 @@ Word16 ITF_Detect_fx(Word32 const pSpectrum[],
}
/* Calculate normalized autocorrelation for spectrum subdivision and get filter parameters based on it */
-#define RXX_E (3)
- {
- set32_fx(rxx, 0, ITF_MAX_FILTER_ORDER+1);
+ set32_fx(rxx, 0, ITF_MAX_FILTER_ORDER+1);
- spectrumLength = sub(idx1, idx0);
+ spectrumLength = sub(stopLine, startLine);
- FOR (iSubdivisions = 0; iSubdivisions < nSubdivisions; iSubdivisions++)
+ FOR (iSubdivisions = 0; iSubdivisions < nSubdivisions; iSubdivisions++)
+ {
+ IF ( facs[iSubdivisions] == 0 )
{
- IF ( facs[iSubdivisions] == 0 )
- {
- BREAK;
- }
+ BREAK;
+ }
- assert((nSubdivisions == 1) || (nSubdivisions == 3));
+ assert((nSubdivisions == 1) || (nSubdivisions == 3));
- iStartLine = imult1616(spectrumLength, iSubdivisions);
- iEndLine = add(iStartLine, spectrumLength);
+ iStartLine = imult1616(spectrumLength, iSubdivisions);
+ iEndLine = add(iStartLine, spectrumLength);
- if (EQ_16(nSubdivisions, 3))iStartLine=mult(iStartLine,0x2AAB);
- iStartLine = add(iStartLine, idx0);
+ if (EQ_16(nSubdivisions, 3))iStartLine=mult(iStartLine,0x2AAB);
+ iStartLine = add(iStartLine, startLine);
- if (EQ_16(nSubdivisions, 3))iEndLine=mult(iEndLine,0x2AAB);
- iEndLine = add(iEndLine, idx0);
+ if (EQ_16(nSubdivisions, 3))iEndLine=mult(iEndLine,0x2AAB);
+ iEndLine = add(iEndLine, startLine);
- move16();
- shift = shifts[iSubdivisions];
+ move16();
+ shift = shifts[iSubdivisions];
- n = sub(iEndLine, iStartLine);
- assert(n < (Word16)(sizeof(tmpbuf)/sizeof(Word16)));
- FOR (i = 0; i < n; i++)
- {
- tmpbuf[i] = round_fx(L_shl(pSpectrum[iStartLine+i-IGF_START_MN], shift));
- }
+ n = sub(iEndLine, iStartLine);
+ assert(n < (Word16)(sizeof(tmpbuf)/sizeof(Word16)));
+ FOR (i = 0; i < n; i++)
+ {
+ tmpbuf[i] = round_fx(L_shl(pSpectrum[iStartLine+i-IGF_START_MN], shift));
+ }
- FOR (lag = 0; lag <= maxOrder; lag++)
- {
- n = sub(sub(iEndLine,lag), iStartLine);
+ FOR (lag = 0; lag <= maxOrder; lag++)
+ {
+ n = sub(sub(iEndLine,lag), iStartLine);
+ {
+ Word64 tmp64 = 0;
+ FOR (i = 0; i < n; i++)
{
- Word64 tmp64 = 0;
- FOR (i = 0; i < n; i++)
- {
- tmp64 = W_mac0_16_16(tmp64, tmpbuf[i], tmpbuf[i+lag]);
- }
- L_tmp = W_sat_l(tmp64);
+ tmp64 = W_mac0_16_16(tmp64, tmpbuf[i], tmpbuf[i+lag]);
}
-
- L_tmp = Mpy_32_16_1(L_tmp, facs[iSubdivisions]);
- L_tmp = L_shl(L_tmp, facs_e[iSubdivisions]);
-
- rxx[lag] = L_add(rxx[lag], L_tmp);
- move32();
+ L_tmp = W_sat_l(tmp64);
}
+ L_tmp = Mpy_32_16_1(L_tmp, facs[iSubdivisions]);
+ L_tmp = L_shl(L_tmp, facs_e[iSubdivisions]);
+
+ rxx[lag] = L_add(rxx[lag], L_tmp);
+ move32();
}
- IF ( EQ_16(iSubdivisions,nSubdivisions)) /* meaning there is no subdivision with low energy */
- {
- /* Limit the maximum order to spectrum length/4 */
- ITF_GetFilterParameters_fx(rxx, s_min (maxOrder, shr(spectrumLength,2)), A, Q_A, predictionGain);
+ }
- *curr_order = maxOrder;
- }
+ IF ( EQ_16(iSubdivisions,nSubdivisions)) /* meaning there is no subdivision with low energy */
+ {
+ /* Limit the maximum order to spectrum length/4 */
+ ITF_GetFilterParameters_fx(rxx, s_min (maxOrder, shr(spectrumLength,2)), A, Q_A, predictionGain);
+ *curr_order = maxOrder;
}
return 1;
@@ -513,76 +543,76 @@ static Word16 DecodeUsingTable(Decoder_State_fx *st, Word16 * pValue, const Codi
/* TNS filter coefficients */
-void const * GetTnsFilterCoeff(void const * p, Word16 index, Word16 * pValue)
+void const * GetTnsFilterCoeff(void const * p, const Word16 index, Word16 * pValue)
{
*pValue = ((Word16 const *)p)[index] + INDEX_SHIFT;
return NULL;
}
-void * SetTnsFilterCoeff(void * p, Word16 index, Word16 value)
+void * SetTnsFilterCoeff(void * p, const Word16 index, const Word16 value)
{
((Word16 *)p)[index] = sub(value, INDEX_SHIFT);
return NULL;
}
-Word16 GetSWBTCX20TnsFilterCoeffBits(Word16 value, Word16 index)
+Word16 GetSWBTCX20TnsFilterCoeffBits(const Word16 value, const Word16 index)
{
assert((index >= 0) && (index < nTnsCoeffTables));
return GetBitsFromTable(value, codesTnsCoeffSWBTCX20[index], nTnsCoeffCodes);
}
-Word16 EncodeSWBTCX20TnsFilterCoeff(Word16 value, Word16 index)
+Word16 EncodeSWBTCX20TnsFilterCoeff(const Word16 value, const Word16 index)
{
assert((index >= 0) && (index < nTnsCoeffTables));
return EncodeUsingTable(value, codesTnsCoeffSWBTCX20[index], nTnsCoeffCodes);
}
-Word16 DecodeSWBTCX20TnsFilterCoeff(Decoder_State_fx *st, Word16 index, Word16 * pValue)
+Word16 DecodeSWBTCX20TnsFilterCoeff(Decoder_State_fx *st, const Word16 index, Word16 * pValue)
{
assert((index >= 0) && (index < nTnsCoeffTables));
return DecodeUsingTable(st, pValue, codesTnsCoeffSWBTCX20[index], nTnsCoeffCodes);
}
-Word16 GetSWBTCX10TnsFilterCoeffBits(Word16 value, Word16 index)
+Word16 GetSWBTCX10TnsFilterCoeffBits(const Word16 value, const Word16 index)
{
assert((index >= 0) && (index < nTnsCoeffTables));
return GetBitsFromTable(value, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes);
}
-Word16 EncodeSWBTCX10TnsFilterCoeff(Word16 value, Word16 index)
+Word16 EncodeSWBTCX10TnsFilterCoeff(const Word16 value, const Word16 index)
{
assert((index >= 0) && (index < nTnsCoeffTables));
return EncodeUsingTable(value, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes);
}
-Word16 DecodeSWBTCX10TnsFilterCoeff(Decoder_State_fx *st, Word16 index, Word16 * pValue)
+Word16 DecodeSWBTCX10TnsFilterCoeff(Decoder_State_fx *st, const Word16 index, Word16 * pValue)
{
assert((index >= 0) && (index < nTnsCoeffTables));
return DecodeUsingTable(st, pValue, codesTnsCoeffSWBTCX10[index], nTnsCoeffCodes);
}
-Word16 GetWBTCX20TnsFilterCoeffBits(Word16 value, Word16 index)
+Word16 GetWBTCX20TnsFilterCoeffBits(const Word16 value, const Word16 index)
{
assert((index >= 0) && (index < nTnsCoeffTables));
return GetBitsFromTable(value, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes);
}
-Word16 EncodeWBTCX20TnsFilterCoeff(Word16 value, Word16 index)
+Word16 EncodeWBTCX20TnsFilterCoeff(const Word16 value, const Word16 index)
{
assert((index >= 0) && (index < nTnsCoeffTables));
return EncodeUsingTable(value, codesTnsCoeffWBTCX20[index], nTnsCoeffCodes);
}
-Word16 DecodeWBTCX20TnsFilterCoeff(Decoder_State_fx *st, Word16 index, Word16 * pValue)
+Word16 DecodeWBTCX20TnsFilterCoeff(Decoder_State_fx *st, const Word16 index, Word16 * pValue)
{
assert((index >= 0) && (index < nTnsCoeffTables));
@@ -593,7 +623,7 @@ Word16 DecodeWBTCX20TnsFilterCoeff(Decoder_State_fx *st, Word16 index, Word16 *
/* TNS filter order */
-void const * GetTnsFilterOrder(void const * p, Word16 index, Word16 * pValue)
+void const * GetTnsFilterOrder(void const * p, const Word16 index, Word16 * pValue)
{
move16();
*pValue = ((STnsFilter const *)p)[index].order;
@@ -602,7 +632,7 @@ void const * GetTnsFilterOrder(void const * p, Word16 index, Word16 * pValue)
return ((STnsFilter const *)p)[index].coefIndex;
}
-void * SetTnsFilterOrder(void * p, Word16 index, Word16 value)
+void * SetTnsFilterOrder(void * p, const Word16 index, const Word16 value)
{
move16();
((STnsFilter *)p)[index].order = value;
@@ -611,63 +641,63 @@ void * SetTnsFilterOrder(void * p, Word16 index, Word16 value)
return ((STnsFilter *)p)[index].coefIndex;
}
-Word16 GetTnsFilterOrderBitsSWBTCX20(Word16 value, Word16 index)
+Word16 GetTnsFilterOrderBitsSWBTCX20(const Word16 value, const Word16 index)
{
(void)index;
return GetBitsFromTable(value-1, codesTnsOrderTCX20, nTnsOrderCodes);
}
-Word16 EncodeTnsFilterOrderSWBTCX20(Word16 value, Word16 index)
+Word16 EncodeTnsFilterOrderSWBTCX20(const Word16 value, const Word16 index)
{
(void)index;
return EncodeUsingTable(value-1, codesTnsOrderTCX20, nTnsOrderCodes);
}
-Word16 DecodeTnsFilterOrderSWBTCX20(Decoder_State_fx *st, Word16 index, Word16 * pValue)
+Word16 DecodeTnsFilterOrderSWBTCX20(Decoder_State_fx *st, const Word16 index, Word16 * pValue)
{
(void)index;
return DecodeUsingTable(st, pValue, codesTnsOrderTCX20, nTnsOrderCodes);
}
-Word16 GetTnsFilterOrderBitsSWBTCX10(Word16 value, Word16 index)
+Word16 GetTnsFilterOrderBitsSWBTCX10(const Word16 value, const Word16 index)
{
(void)index;
return GetBitsFromTable(value-1, codesTnsOrderTCX10, nTnsOrderCodes);
}
-Word16 EncodeTnsFilterOrderSWBTCX10(Word16 value, Word16 index)
+Word16 EncodeTnsFilterOrderSWBTCX10(const Word16 value, const Word16 index)
{
(void)index;
return EncodeUsingTable(value-1, codesTnsOrderTCX10, nTnsOrderCodes);
}
-Word16 DecodeTnsFilterOrderSWBTCX10(Decoder_State_fx *st, Word16 index, Word16 * pValue)
+Word16 DecodeTnsFilterOrderSWBTCX10(Decoder_State_fx *st, const Word16 index, Word16 * pValue)
{
(void)index;
return DecodeUsingTable(st, pValue, codesTnsOrderTCX10, nTnsOrderCodes);
}
-Word16 GetTnsFilterOrderBits(Word16 value, Word16 index)
+Word16 GetTnsFilterOrderBits(const Word16 value, const Word16 index)
{
(void)index;
return GetBitsFromTable(value-1, codesTnsOrder, nTnsOrderCodes);
}
-Word16 EncodeTnsFilterOrder(Word16 value, Word16 index)
+Word16 EncodeTnsFilterOrder(const Word16 value, const Word16 index)
{
(void)index;
return EncodeUsingTable(value-1, codesTnsOrder, nTnsOrderCodes);
}
-Word16 DecodeTnsFilterOrder(Decoder_State_fx *st, Word16 index, Word16 * pValue)
+Word16 DecodeTnsFilterOrder(Decoder_State_fx *st, const Word16 index, Word16 * pValue)
{
(void)index;
@@ -676,14 +706,14 @@ Word16 DecodeTnsFilterOrder(Decoder_State_fx *st, Word16 index, Word16 * pValue)
/* Number of TNS filters */
-void const * GetNumOfTnsFilters(void const * p, Word16 index, Word16 * pValue)
+void const * GetNumOfTnsFilters(void const * p, const Word16 index, Word16 * pValue)
{
*pValue = ((STnsData const *)p)[index].nFilters;
return ((STnsData const *)p)[index].filter;
}
-void * SetNumOfTnsFilters(void * p, Word16 index, Word16 value)
+void * SetNumOfTnsFilters(void * p, const Word16 index, Word16 value)
{
((STnsData *)p)[index].nFilters = value;
@@ -692,11 +722,11 @@ void * SetNumOfTnsFilters(void * p, Word16 index, Word16 value)
/* TNS enabled/disabled flag */
-void const * GetTnsEnabled(void const * p, Word16 index, Word16 * pValue)
+void const * GetTnsEnabled(void const * p, const Word16 index, Word16 * pValue)
{
move16();
*pValue = 0;
- if (((STnsData const *)p)[index].nFilters > 0)
+ if (((STnsData const *)p)[index].nFilters != 0)
{
move16();
*pValue = 1;
@@ -704,13 +734,34 @@ void const * GetTnsEnabled(void const * p, Word16 index, Word16 * pValue)
return NULL;
}
-void * SetTnsEnabled(void * p, Word16 index, Word16 value)
+void * SetTnsEnabled(void * p, const Word16 index, const Word16 value)
{
(void)p,(void)index,(void)value;
return NULL;
}
+#ifdef ADD_IVAS_TNS
+/* TNS on whitened spectra flag */
-void const * GetTnsEnabledSingleFilter(void const * p, Word16 index, Word16 * pValue)
+void const* GetTnsOnWhite(void const* p, const int16_t index, int16_t* pValue)
+{
+ *pValue = ((STnsData const*)p)[index].tnsOnWhitenedSpectra > 0 ? 1 : 0;
+ return NULL;
+}
+
+void* SetTnsOnWhite(void* p, const int16_t index, const int16_t value)
+{
+ ((STnsData*)p)[index].tnsOnWhitenedSpectra = value;
+ return NULL;
+}
+
+void const* GetTnsEnabledSingleFilter(void const* p, const int16_t index, int16_t* pValue)
+{
+ *pValue = ((STnsData const*)p)[index].nFilters != 0 ? 1 : 0;
+ return ((STnsData const*)p)[index].filter;
+}
+#endif
+
+void const * GetTnsEnabledSingleFilter(void const * p, const Word16 index, Word16 * pValue)
{
move16();
*pValue = 0;
@@ -722,15 +773,16 @@ void const * GetTnsEnabledSingleFilter(void const * p, Word16 index, Word16 * pV
return ((STnsData const *)p)[index].filter;
}
-void * SetTnsEnabledSingleFilter(void * p, Word16 index, Word16 value)
+void * SetTnsEnabledSingleFilter(void * p, const Word16 index, const Word16 value)
{
((STnsData *)p)[index].nFilters = value;
return ((STnsData *)p)[index].filter;
}
-/********************************/
-/* Private functions */
-/********************************/
+/*-------------------------------------------------------------------*
+ * ResetTnsData()
+ *
+ *-------------------------------------------------------------------*/
void ResetTnsData(STnsData * pTnsData)
{
@@ -738,31 +790,36 @@ void ResetTnsData(STnsData * pTnsData)
pTnsData->nFilters = 0;
-
+#ifdef ADD_IVAS_TNS
+ pTnsData->tnsOnWhitenedSpectra = 0;
+#endif
FOR (iFilter = 0; iFilter < (Word16) (sizeof(pTnsData->filter)/sizeof(pTnsData->filter[0])); iFilter++)
{
STnsFilter * const pTnsFilter = &pTnsData->filter[iFilter];
pTnsFilter->spectrumLength = 0;
pTnsFilter->predictionGain = 128/*1.0f Q7*/;
pTnsFilter->avgSqrCoef = 0;
+#ifdef ADD_IVAS_TNS
+ pTnsFilter->filterType = TNS_FILTER_OFF;
+#endif
ClearTnsFilterCoefficients(pTnsFilter);
}
}
+/*-------------------------------------------------------------------*
+ * ClearTnsFilterCoefficients()
+ *
+ *-------------------------------------------------------------------*/
-void ClearTnsFilterCoefficients(STnsFilter * pTnsFilter)
+void ClearTnsFilterCoefficients(
+ STnsFilter * pTnsFilter
+)
{
move16();
pTnsFilter->order = 0;
assert(TNS_MAX_FILTER_ORDER == 8);
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
- move16();
+ move16();move16();move16();move16();
+ move16();move16();move16();move16();
pTnsFilter->coefIndex[0] = 0;
pTnsFilter->coefIndex[1] = 0;
pTnsFilter->coefIndex[2] = 0;
@@ -773,9 +830,15 @@ void ClearTnsFilterCoefficients(STnsFilter * pTnsFilter)
pTnsFilter->coefIndex[7] = 0;
}
+/** Inverse quantization for reflection coefficients.
+ *
+ * @param index input quantized values.
+ * @param parCoeff output reflection coefficients.
+ * @param order number of coefficients/values.
+ */
static void Index2Parcor(const Word16 index[], Word16 parCoeff[], Word16 order)
{
- Word16 const * values;
+ const Word16 * values;
Word16 i;
move16();
@@ -786,12 +849,17 @@ static void Index2Parcor(const Word16 index[], Word16 parCoeff[], Word16 order)
move16();
parCoeff[i] = values[add(index[i], INDEX_SHIFT)];
}
-
+ return;
}
-
-static Word32 FIRLattice(Word16 order, const Word16 *parCoeff /*Q15*/, Word32 *state, Word32 x /* Q0 */)
+/* Linear prediction analysis filter. */
+static Word32 FIRLattice(
+ const Word16 order,
+ const Word16 *parCoeff /*Q15*/,
+ Word32 *state,
+ Word32 x /* Q0 */
+)
{
Word16 i;
Word32 tmpSave, tmp;
@@ -836,11 +904,25 @@ static Word32 IIRLattice(Word16 order, const Word16 *parCoeff, Word32 *state, Wo
state[0] = x;
return x;
}
-
-static void TnsFilter(Word32 const spectrum[], Word16 numOfLines,
- Word16 const parCoeff[], Word16 order,
- TLinearPredictionFilter filter, Word32 * state,
- Word32 output[])
+/** TNS analysis/synthesis filter.
+ * @param spectrum input spectrum values.
+ * @param numOfLines number of lines in the spectrum.
+ * @param parCoeff filter (PARCOR) coefficients.
+ * @param order filter order.
+ * @param filter function that implements filtering.
+ By this function it is defined whether analysis or synthesis is performed.
+ * @param output filtered output spectrum values.
+ Inplace operation is supported, so it can be equal to spectrum.
+ */
+static void TnsFilter(
+ const Word32 spectrum[],
+ const Word16 numOfLines,
+ const Word16 parCoeff[],
+ const Word16 order,
+ TLinearPredictionFilter filter,
+ Word32 * state,
+ Word32 output[]
+)
{
Word16 j;
@@ -868,14 +950,17 @@ static void TnsFilter(Word32 const spectrum[], Word16 numOfLines,
}
}
}
+ return;
}
-static void ITF_TnsFilter_fx( Word32 const spectrum[],
- const Word16 numOfLines,
- const Word16 A[], /* ifdef FIX_ITF_OVERFLOW Q_A else Q14 */
- const Word16 Q_A,
- const Word16 order,
- Word32 output[])
+static void ITF_TnsFilter_fx(
+ const Word32 spectrum[],
+ const Word16 numOfLines,
+ const Word16 A[], /* ifdef FIX_ITF_OVERFLOW Q_A else Q14 */
+ const Word16 Q_A,
+ const Word16 order,
+ Word32 output[]
+)
{
Word16 i, j;
Word32 buf[ITF_MAX_FILTER_ORDER + N_MAX];
@@ -914,14 +999,16 @@ static void ITF_TnsFilter_fx( Word32 const spectrum[],
++p;
}
}
-
+ return;
}
-static void ITF_GetFilterParameters_fx(Word32 rxx[],
- Word16 maxOrder,
- Word16* A, /* ifdef FIX_ITF_OVERFLOW Q_A else Q14 */
- Word16* Q_A,
- Word16* predictionGain)
+static void ITF_GetFilterParameters_fx(
+ Word32 rxx[],
+ const Word16 maxOrder,
+ Word16* A, /* ifdef FIX_ITF_OVERFLOW Q_A else Q14 */
+ Word16* Q_A,
+ Word16* predictionGain
+)
{
Word16 i, j, i_2, tmp;
Word16 parCoeff[ITF_MAX_FILTER_ORDER];
@@ -976,5 +1063,6 @@ static void ITF_GetFilterParameters_fx(Word32 rxx[],
}
*Q_A = add(11, tmp);
}
+ return;
}
diff --git a/lib_com/tools_fx.c b/lib_com/tools_fx.c
index ff2ab2e8e71264f75f5d2280cde63b02db3b661d..7765331d58f92cf74eaa97f0d2a74062e4794123 100644
--- a/lib_com/tools_fx.c
+++ b/lib_com/tools_fx.c
@@ -659,7 +659,7 @@ Word16 minimum_32_fx( /* o : index of the minimum value in the input vecto
Word16 maximum_32_fx( /* o : index of the maximum value in the input vector */
const Word32 *vec, /* i : input vector */
const Word16 lvec, /* i : length of input vector */
- Word32 *max /* o : maximum value in the input vector */
+ Word32 *max_val /* o : maximum value in the input vector */
)
{
Word16 j, ind;
@@ -678,7 +678,7 @@ Word16 maximum_32_fx( /* o : index of the maximum value in the input ve
}
tmp = L_max(tmp,vec[j]);
}
- *max = tmp;
+ *max_val = tmp;
move32();
return ind;
@@ -1783,6 +1783,51 @@ void Copy_Scale_sig32_16(
}
}
+/*-------------------------------------------------------------------*
+ * v_multc_att()
+ *
+ * Attenuation of a vector,, attenuation factor in Q15
+ *-------------------------------------------------------------------*/
+
+void v_multc_att(
+ const Word16 x[], /* i : Input vector Qx */
+ const Word16 att, /* i : Constant Q15, <= MAX_16 */
+ Word16 y[], /* o : Output vector that contains att*x */
+ const Word16 N /* i : Vector length */
+)
+{
+ Word16 i;
+ IF(LT_16(att, 32767))
+ {
+ FOR(i = 0; i < N; i++)
+ {
+ y[i] = mult_r(x[i], att);
+ move16();
+ }
+ }
+}/*-------------------------------------------------------------------*
+ * v_multc_att32()
+ *
+ * Attenuation of a vector,, attenuation factor in Q15
+ *-------------------------------------------------------------------*/
+
+void v_multc_att32(
+ const Word32 x[], /* i : Input vector Qx */
+ const Word16 att, /* i : Constant Q15, <= MAX_16 */
+ Word32 y[], /* o : Output vector that contains att*x */
+ const Word16 N /* i : Vector length */
+)
+{
+ Word16 i;
+ IF(LT_16(att, 32767))
+ {
+ FOR(i = 0; i < N; i++)
+ {
+ y[i] = Mpy_32_16_r(x[i], att);
+ move32();
+ }
+ }
+}
/*-------------------------------------------------------------------*
* add_vec()
*
@@ -2325,17 +2370,19 @@ Word16 erb_diff_search_fx(Word16 *prev_erb, const Word16 *curr_erb, Word16 *dif_
}
void Acelp_dec_total_exc(
- Word16 *exc_fx, /* i/o: adapt. excitation exc */
- Word16 *exc2_fx, /* i/o: adapt. excitation/total exc */
- const Word16 gain_code16, /* i : Gain code Q0 */
- const Word16 gain_pit_fx, /* i ; Pitch gain in Q14 */
- const Word16 i_subfr, /* i ; subfr */
- const Word16 *code_fx /* i : code in Q9 */
+ Word16 *exc_fx, /* i/o: adapt. excitation exc */
+ Word16 *exc2_fx, /* i/o: adapt. excitation/total exc */
+ const Word16 gain_code16, /* i : Gain code Q0 */
+ const Word16 gain_pit_fx, /* i ; Pitch gain in Q14 */
+ const Word16 i_subfr, /* i ; subfr */
+ const Word16 *code_fx, /* i : code in Q9 */
+ const Word16 L_subfr /* i : Subframne lenght */
)
{
Word16 i;
Word32 L_tmp;
- FOR (i = 0; i < L_SUBFR; i++)
+
+ FOR (i = 0; i < L_subfr; i++)
{
L_tmp = L_shl(L_mult(gain_pit_fx, exc_fx[i+i_subfr]), 1); /*Q16+Q_exc*/
exc2_fx[i+i_subfr] = round_fx(L_tmp); /*Q_exc*/
@@ -2627,4 +2674,25 @@ void floating_point_add(
*ex = sub(add(*ex, expo), 1); /* Subtract 1 due to 1-bit down-shift above ensuring 1 bit headroom before addition. */
return;
}
+/*-------------------------------------------------------------------*
+ * delay_signal()
+ *
+ * Delay buffer by defined number of samples
+ *-------------------------------------------------------------------*/
+
+void delay_signal(
+ Word16 x[], /* i/o: signal to be delayed */
+ const Word16 len, /* i : length of the input signal */
+ Word16 mem[], /* i/o: synchronization memory */
+ const Word16 delay /* i : delay in samples */
+)
+{
+ Word16 tmp_buffer[L_FRAME48k];
+
+ Copy(mem, tmp_buffer, delay);
+ Copy(x + len - delay, mem, delay);
+ Copy(x, x + delay, len - delay);
+ Copy(tmp_buffer, x, delay);
+ return;
+}
diff --git a/lib_com/trans_direct_fx.c b/lib_com/trans_direct_fx.c
index 88d94953da1f4da5375d7c997d0d565dad19f752..aeb63e574241f31e07b98d0e0f3c6cc3b5145b76 100644
--- a/lib_com/trans_direct_fx.c
+++ b/lib_com/trans_direct_fx.c
@@ -1,21 +1,24 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
-#include "stl.h"
#include "cnst_fx.h" /* Common FX constants */
#include "prot_fx.h" /* Function prototypes */
#include "rom_com_fx.h" /* Function prototypes */
-
-
-void direct_transform_fx(
- const Word32 in32_fx[],
- Word32 out32_fx[],
- const Word16 is_transient,
- const Word16 L,
- Word16 *Q
+/*-------------------------------------------------------------------
+ * direct_transform()
+ *
+ * Transformation of the signal to DCT domain
+ *-------------------------------------------------------------------*/
+ void direct_transform_fx(
+ const Word32 in32_fx[], /* i : input signal */
+ Word32 out32_fx[], /* o : transformation */
+ const Word16 is_transient, /* i : is transient */
+ const Word16 L, /* i : length */
+ Word16 *Q,
+ const Word16 element_mode /* i : IVAS element mode */
)
{
@@ -37,7 +40,9 @@ void direct_transform_fx(
Word16 shift, Qmin = 31;
Word32 L_tmp;
Word16 Qs[NUM_TIME_SWITCHING_BLOCKS];
-
+#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING
+ MY_UNUSED_Word(element_mode);
+#endif
segment_length = shr(L, 1);
segment_length2 = shr(segment_length, 1);
diff --git a/lib_com/trans_inv_fx.c b/lib_com/trans_inv_fx.c
index 05aecbe32386c3dfce44ea29cc7c4f282827f8f7..c3adcf33296c76a5ddea29cddb21ec3994452a09 100644
--- a/lib_com/trans_inv_fx.c
+++ b/lib_com/trans_inv_fx.c
@@ -1,9 +1,8 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
-#include "stl.h"
#include "prot_fx.h" /* Function prototypes */
#include "rom_com_fx.h" /* Function prototypes */
#include "rom_dec_fx.h"
@@ -28,12 +27,12 @@
*--------------------------------------------------------------------------*/
void preecho_sb_fx(
- const Word32 brate, /* i Q0 : core bit-rate */
+ const Word32 core_brate, /* i Q0 : core bit-rate */
Word32 *wtda_audio_fx, /* i q_sig32 : imdct signal, used to compute imdct_mem_fx when not 24400 bps */
Word16 q_sig32, /* i Q value for wtda_audio_fx */
Word16 *rec_sig_fx, /* i q_sig16 : reconstructed signal, output of the imdct transform */
Word16 q_sig16, /* i Q value for rec_sig_fx and imdct_mem_fx */
- const Word16 framelength, /* i Q0 : frame length */
+ const Word16 framelength, /* i Q0 : frame length */
Word16 *memfilt_lb_fx, /* i/o Q0 : memory */
Word32 *mean_prev_hb_fx, /* i/o Q0 : memory */
Word16 *smoothmem_fx, /* i/o Q15 : memory */
@@ -42,7 +41,7 @@ void preecho_sb_fx(
Word16 *wmold_hb_fx, /* i/o Q15 : memory */
Word16 *prevflag, /* i/o Q0 : flag */
Word16 *pastpre, /* i/o Q0 : flag */
- const Word16 bwidth /* i Q0 : bandwidth */
+ const Word16 bwidth /* i Q0 : bandwidth */
)
{
Word16 i, j, len3xLp20;
@@ -72,12 +71,12 @@ void preecho_sb_fx(
Word32 savehalfe_hb_fx, last2_hb_fx;
Word32 plus_es_mdct_fx[64], max_es_fx, max_es_hb_fx, max_plus_es_mdct_fx;
Word16 imdct_mem_fx[L_FRAME48k]; /* memory of the imdct transform, used in the next frame */
- Word16 rec_sig_lb_fx[960], rec_sig_hb_fx[960]; /* 960 max frame length at 48 kHz */
+ Word16 rec_sig_lb_fx[L_FRAME48k], rec_sig_hb_fx[L_FRAME48k]; /* 960 max frame length at 48 kHz */
Word16 min_g_fx[13], g_fx, gt_fx[13];
Word16 min_g_hb_fx[13], gt_hb_fx[13];
- Word16 preechogain_fx[960+PREECHO_SMOOTH_LEN];
- Word16 preechogain_hb_fx[960];
+ Word16 preechogain_fx[L_FRAME48k +PREECHO_SMOOTH_LEN];
+ Word16 preechogain_hb_fx[L_FRAME48k];
Word16 pre_g_ch_tab[9];
Word32 eshbmean2_fx, eshbmean3_fx, sxyhb2_fx, sxylb3_fx;
Word16 wmold_fx;
@@ -91,7 +90,7 @@ void preecho_sb_fx(
q16p1 = add(q_sig16, 1);
qmemp1 = q16p1;
- IF(LE_32(brate, HQ_32k))
+ IF(LE_32(core_brate, HQ_32k))
{
mean_prev_fx_loc = L_add(*mean_prev_fx, 0);
@@ -950,12 +949,13 @@ void preecho_sb_fx(
*--------------------------------------------------------------------------*/
void Inverse_Transform(
- const Word32 *in_mdct, /* i : input MDCT vector */
- Word16 *Q, /* i/o: Q value of input */
- Word32 *out, /* o : output vector */
- const Word16 is_transient, /* i : transient flag */
- const Word16 L, /* i : output frame length */
- const Word16 L_inner /* i : length of the transform */
+ const Word32 *in_mdct, /* i : input MDCT vector */
+ Word16 *Q, /* i/o: Q value of input */
+ Word32 *out, /* o : output vector */
+ const Word16 is_transient, /* i : transient flag */
+ const Word16 L, /* i : output frame length */
+ const Word16 L_inner, /* i : length of the transform */
+ const Word16 element_mode /* i : IVAS element mode */
)
{
Word16 ta, seg, tmp16;
@@ -970,6 +970,9 @@ void Inverse_Transform(
Word16 segment_length_div2, segment_length_div4;
Word16 tmp, q_out;
Word32 L_temp;
+#ifdef REMOVE_IVAS_UNUSED_PARAMETERS_WARNING
+ MY_UNUSED_Word(element_mode);
+#endif
/* This value is used to right shift all vectors returned by 'iedct_short_fx()' */
/* to bring them to a scaling that is equal to the 1st 'Q' returned by the 1st */
/* call to 'iedct_short_fx()' minus these guard bits. */
diff --git a/lib_com/vlpc_2st_com.c b/lib_com/vlpc_2st_com.c
index ac54149d628ad91a14984069284c1bfaa741134f..90fbe70479468679b0da4fd4f10faa886cc38050 100644
--- a/lib_com/vlpc_2st_com.c
+++ b/lib_com/vlpc_2st_com.c
@@ -2,19 +2,17 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
-#include
-#include
+#include
+#include "options.h"
#include "cnst_fx.h"
#include "prot_fx.h"
-#include "stl.h"
#include "control.h"
#include "basop_util.h"
void lsf_weight_2st(
const Word16 *lsfq, /* input: quantized lsf coefficients (14Q1*1.28) */
- Word16 *w, /* output: weighting function (0Q15*1.28) */
+ Word16 *w, /* output: weighting function (0Q15*1.28) */
const Word16 mode /* input: operational mode */
)
{
diff --git a/lib_com/weight_a_fx.c b/lib_com/weight_a_fx.c
index 49622fce33d333d3e276993d579a89b278b1c5b9..b13e0f44f039386bac68b37a81b76ac2b03fa36a 100644
--- a/lib_com/weight_a_fx.c
+++ b/lib_com/weight_a_fx.c
@@ -1,12 +1,10 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
-#include "stl.h"
#include "prot_fx.h" /* Function prototypes */
#include "rom_com_fx.h" /* Function prototypes */
-#include "prot_fx.h" /* Function prototypes */
#include
/*------------------------------------------------------------------
@@ -55,7 +53,7 @@ void weight_a_subfr_fx(
/*==============================================================================*/
void weight_a_lc_fx(
const Word16 a[], /* i: LP filter coefficients Q12 */
- Word16 ap[], /* o: weighted LP filter coefficients Q12 */
+ Word16 ap[], /* o: weighted LP filter coefficients Q12 */
const Word16 *gammatbl, /* i: weighting factor Q15 */
const Word16 m /* i: order of LP filter Q0 */
)
@@ -91,10 +89,10 @@ void weight_a_lc_fx(
* Weighting of LP filter coefficients, ap[i] = a[i] * (gamma^i)
*------------------------------------------------------------------*/
void weight_a_fx(
- const Word16 a[], /* i: LP filter coefficients Q12 */
- Word16 ap[], /* o: weighted LP filter coefficients Q12 */
- const Word16 gamma, /* i: weighting factor Q15 */
- const Word16 m /* i: order of LP filter Q0 */
+ const Word16 a[], /* i: LP filter coefficients Q12 */
+ Word16 ap[], /* o: weighted LP filter coefficients Q12 */
+ const Word16 gamma, /* i: weighting factor Q15 */
+ const Word16 m /* i: order of LP filter Q0 */
)
{
Word16 i, fac;
@@ -140,7 +138,12 @@ void weight_a_fx(
* Returns:
* void
*/
-void E_LPC_a_weight_inv(const Word16 *a, Word16 *ap, const Word16 inv_gamma, const Word16 m)
+void E_LPC_a_weight_inv(
+ const Word16 *a,
+ Word16 *ap,
+ const Word16 inv_gamma,
+ const Word16 m
+)
{
Word16 i;
static const Word16 inv_gamma_tab_12k8[16] = { 17809, 19357, 21041, 22870, 24859, 27020, 29370, 31924, /* Q14 */
diff --git a/lib_com/weight_fx.c b/lib_com/weight_fx.c
index 270ef3b42bec962466fb4c70371098176830c1ec..4c6daf5b21f54a4ea172635d0922bab191c02cfc 100644
--- a/lib_com/weight_fx.c
+++ b/lib_com/weight_fx.c
@@ -2,11 +2,11 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "rom_com_fx.h" /* Static table prototypes */
#include "prot_fx.h" /* Function prototypes */
-#include "stl.h" /* required for wmc_tool */
/*--------------------------------------------------------------------------*
* sfm2mqb_fx()
@@ -17,7 +17,7 @@
static void sfm2mqb_fx(
Word16 spe[], /* i : sub-vectors */
Word16 spe2q[], /* o : pbands */
- const Word16 nb_sfm /* i : number of norms */
+ const Word16 nb_sfm /* i : number of norms */
)
{
Word16 tmp, i;
@@ -117,9 +117,9 @@ static void sfm2mqb_fx(
*--------------------------------------------------------------------------*/
static void mqb2sfm_fx(
- Word16 spe2q[], /* i : pbands */
- Word16 spe[], /* o : sub-vectors */
- const Word16 lnb_sfm /* i : number of norms */
+ Word16 spe2q[], /* i : pbands */
+ Word16 spe[], /* o : sub-vectors */
+ const Word16 lnb_sfm /* i : number of norms */
)
{
Word16 i;
@@ -216,9 +216,9 @@ static void mqb2sfm_fx(
*--------------------------------------------------------------------------*/
void map_quant_weight_fx(
- const Word16 normqlg2[], /* i : quantized norms */
- Word16 wnorm[], /* o : weighted norm */
- const Word16 is_transient /* i : transient flag */
+ const Word16 normqlg2[], /* i : quantized norms */
+ Word16 wnorm[], /* o : weighted norm */
+ const Word16 is_transient /* i : transient flag */
)
{
Word16 sfm;
diff --git a/lib_com/wi_fx.c b/lib_com/wi_fx.c
index ddd4fa7435fc631bd3a68464bfc1562598a1d7d4..aca7b73ccf9f5ba7998b550453edc9966dbe529c 100644
--- a/lib_com/wi_fx.c
+++ b/lib_com/wi_fx.c
@@ -2,15 +2,15 @@
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-#include
-#include
-
+#include
#include "options.h"
#include "prot_fx.h"
#include "rom_com_fx.h"
#include "log2.h"
-#include "stl.h"
+/*-------------------------------------------------------------------*
+ * Local constants
+ *-------------------------------------------------------------------*/
#define WARP_OS_RATE 8
#define LL 256
#define LL_OS (WARP_OS_RATE*LL)
@@ -21,26 +21,37 @@
#define CUTFREE_REL_RANGE_Q2 1
#define WI_THRESHLD 0.8
#define WI_SAMPLE_THLD 20
-#define ERB_CBSIZE1 64
-#define ERB_CBSIZE2 64
-#define P_CBSIZE 64
/*#define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) */
/*#define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) */
/*#define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) */
+/*-------------------------------------------------------------------*
+ * Local functions
+ *--------------------------------------------------------------------*/
+
+static Word32 DTFS_setEngy_fx(DTFS_STRUCTURE_FX* X_DTFS_FX, Word32 en2_fx);
+
/*-------------------------------------------------------------------*
* DTFS_new_fx()
*
* DTFS structure initialization.
*-------------------------------------------------------------------*/
-DTFS_STRUCTURE_FX* DTFS_new_fx(void)
+ivas_error DTFS_new_fx(
+ DTFS_STRUCTURE_FX** dtfs_out
+)
{
Word16 i ;
DTFS_STRUCTURE_FX* dtfs_fx = NULL;
dtfs_fx = (DTFS_STRUCTURE_FX *) calloc(1,sizeof(DTFS_STRUCTURE_FX));
+ PMT("verif mem alloc")
+ IF (dtfs_fx == NULL)
+ {
+ return (IVAS_ERROR(IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DTFS (SC-VBR) structure\n"));
+ }
+
dtfs_fx->lag_fx = 0 ;
move16();
dtfs_fx->nH_fx=0;
@@ -61,9 +72,8 @@ DTFS_STRUCTURE_FX* DTFS_new_fx(void)
dtfs_fx->b_fx[i] = 0;
move16();
}
-
- return dtfs_fx; /* o: DTFS structure_fx */
-
+ *dtfs_out = dtfs_fx;
+ return IVAS_ERR_OK;
}
/*-------------------------------------------------------------------*
* DTFS_copy_fx()
@@ -103,6 +113,8 @@ void DTFS_copy_fx(
move16();
Xout_fx->Q = Xinp_fx.Q;
move16();
+ return;
+
}
@@ -111,13 +123,12 @@ void DTFS_copy_fx(
*
* Subtract one DTFS STRUCTURE from another.
*-------------------------------------------------------------------*/
-DTFS_STRUCTURE_FX DTFS_sub_fx(
-
+void DTFS_sub_fx(
+ DTFS_STRUCTURE_FX *tmp,/* o: X1 - X2 */
DTFS_STRUCTURE_FX X1, /* i: DTFS input 1 */
DTFS_STRUCTURE_FX X2 /* i: DTFS input 2 */
)
{
- DTFS_STRUCTURE_FX tmp ;
Word16 i ,sft, tmp_loop;
sft = sub(X1.Q,X2.Q);
@@ -127,12 +138,12 @@ DTFS_STRUCTURE_FX DTFS_sub_fx(
FOR(i=0; i<=tmp_loop; i++)
{
- tmp.a_fx[i] = sub(shr(X1.a_fx[i],sft),X2.a_fx[i]);
+ tmp->a_fx[i] = sub(shr(X1.a_fx[i],sft),X2.a_fx[i]);
move16();
- tmp.b_fx[i] = sub(shr(X1.b_fx[i],sft),X2.b_fx[i]);
+ tmp->b_fx[i] = sub(shr(X1.b_fx[i],sft),X2.b_fx[i]);
move16();
}
- tmp.Q = X2.Q;
+ tmp->Q = X2.Q;
move16();
}
ELSE
@@ -141,25 +152,30 @@ DTFS_STRUCTURE_FX DTFS_sub_fx(
FOR(i=0; i<=tmp_loop; i++)
{
- tmp.a_fx[i] = sub(X1.a_fx[i],shl(X2.a_fx[i],sft));
+ tmp->a_fx[i] = sub(X1.a_fx[i],shl(X2.a_fx[i],sft));
move16();
- tmp.b_fx[i] = sub(X1.b_fx[i],shl(X2.b_fx[i],sft));
+ tmp->b_fx[i] = sub(X1.b_fx[i],shl(X2.b_fx[i],sft));
move16();
}
- tmp.Q = X1.Q;
+ tmp->Q = X1.Q;
move16();
}
- tmp.lag_fx = s_max(X1.lag_fx, X2.lag_fx) ;
- tmp.nH_fx=s_max(X1.nH_fx,X2.nH_fx);
- tmp.nH_4kHz_fx=s_max(X1.nH_4kHz_fx,X2.nH_4kHz_fx);
- tmp.upper_cut_off_freq_of_interest_fx=X1.upper_cut_off_freq_of_interest_fx;
+ tmp->lag_fx = s_max(X1.lag_fx, X2.lag_fx) ;
+ tmp->nH_fx=s_max(X1.nH_fx,X2.nH_fx);
+ tmp->nH_4kHz_fx=s_max(X1.nH_4kHz_fx,X2.nH_4kHz_fx);
+ tmp->upper_cut_off_freq_of_interest_fx=X1.upper_cut_off_freq_of_interest_fx;
move16();
- tmp.upper_cut_off_freq_fx=X1.upper_cut_off_freq_fx;
+ tmp->upper_cut_off_freq_fx=X1.upper_cut_off_freq_fx;
move16();
- return tmp ;
+ return ;
}
+/*-------------------------------------------------------------------*
+ * DTFS_fast_fs_inv()
+ *
+ * DTFS inverse.
+ *-------------------------------------------------------------------*/
-void DTFS_fast_fs_inv_fx( DTFS_STRUCTURE_FX *X_fx,Word16 *out_fx, Word16 N_fx, Word16 LOG2N)
+static void DTFS_fast_fs_inv_fx( DTFS_STRUCTURE_FX *X_fx,Word16 *out_fx, Word16 N_fx, Word16 LOG2N)
{
Word16 i, M_2, N_2, s;
Word16 dbuf_fx[256+1];
@@ -198,157 +214,7 @@ void DTFS_fast_fs_inv_fx( DTFS_STRUCTURE_FX *X_fx,Word16 *out_fx, Word16 N_fx, W
out_fx[i]=dbuf_fx[i];/* Q0 */ move16();
}
}
-/*==============================================================================*/
-/* FUNCTION : DTFS_freq_corr_fx () */
-/*------------------------------------------------------------------------------*/
-/* PURPOSE : */
-/*------------------------------------------------------------------------------*/
-/* INPUT ARGUMENTS : */
-/* _ (struct DTFS_STRUCTURE_FX) X1_DTFS_fx : a_fx/b_fx in X1_DTFS_fx.Q */
-/* _ (struct DTFS_STRUCTURE_FX) X2_DTFS_fx : a_fx/b_fx in X2_DTFS_fx.Q */
-/* _ (Word16) lband: Q0 */
-/* _ (Word16) hband: Q0 */
-/*------------------------------------------------------------------------------*/
-/* OUTPUT ARGUMENTS : */
-/* _ (Word16) *Qout : Q of output result */
-/*------------------------------------------------------------------------------*/
-/* INPUT/OUTPUT ARGUMENTS : */
-/* _ None */
-/*------------------------------------------------------------------------------*/
-/* RETURN ARGUMENTS : */
-/* _ (Word32) Result : Qout */
-/*------------------------------------------------------------------------------*/
-/* CALLED FROM : TX */
-/*==============================================================================*/
-
-Word32 DTFS_freq_corr_fx( DTFS_STRUCTURE_FX X1_DTFS_fx, DTFS_STRUCTURE_FX X2_DTFS_fx, Word16 lband, Word16 hband, Word16 *Qout)
-{
- Word16 k, HalfLag, lk, hk ;
- Word32 corr_fx;
- Word32 freq_fx, L_lband, L_hband;
- Word32 E_fx;
- Word32 Num, Den, Result;
- Word16 E1_fx, E2_fx, Q1, Q2, Qr;
- Word16 expa,expb,fraca,fracb,scale;
- Word16 exp,tmp;
- Word32 L_tmp;
- Word16 Q_num,Q_den;
-
- IF (LT_16(X1_DTFS_fx.lag_fx ,X2_DTFS_fx.lag_fx))
- {
- DTFS_zeroPadd_fx(X2_DTFS_fx.lag_fx,&X1_DTFS_fx) ;
- }
-
- corr_fx = L_deposit_l(0);
-
- L_lband = L_mult(lband, X2_DTFS_fx.lag_fx);
- L_hband = L_mult(hband, X2_DTFS_fx.lag_fx);
- HalfLag = s_min(shr(X2_DTFS_fx.lag_fx, 1),X2_DTFS_fx.nH_4kHz_fx);
-
- /* get lband and hband */
- FOR (k=0; k<=HalfLag; k++)
- {
- freq_fx = L_mult(k, 12800);
- IF (GE_32(freq_fx, L_lband))
- {
- BREAK;
- }
- }
- lk = k;
- FOR (k=0; k<=HalfLag; k++)
- {
- freq_fx = L_mult(k, 12800);
- IF (GE_32(freq_fx, L_hband))
- {
- BREAK;
- }
- }
- hk = k;
- move16();
-
- FOR (k=lk; k0)
- {
- Result = L_add(L_tmp, 0);
- }
- ELSE
- {
- Result = L_negate(L_tmp);
- }
- *Qout = sub(30,exp);
-
- }
- return Result;
-}
/*===================================================================*/
/* FUNCTION : DTFS_alignment_weight_fx () */
@@ -375,7 +241,19 @@ Word32 DTFS_freq_corr_fx( DTFS_STRUCTURE_FX X1_DTFS_fx, DTFS_STRUCTURE_FX X2_DTF
/* CALLED FROM : TX/RX */
/*===================================================================*/
-Word16 DTFS_alignment_weight_fx( DTFS_STRUCTURE_FX *X_fx, DTFS_STRUCTURE_FX X2, Word16 Eshift, const Word16 *LPC1, const Word16 *LPC2, Word16 *S_fx, Word16 *C_fx, Word16 *pf_temp1,Word16 *pf_temp2, Word16 *pf_temp, Word16 *pf_n2)
+static Word16 DTFS_alignment_weight_fx(
+ DTFS_STRUCTURE_FX *X_fx, /* i : X1 the reference DTFS to keep fixed */
+ DTFS_STRUCTURE_FX X2, /* i : X2 the test DTFS to shift to find best match */
+ Word16 Eshift, /* i : Expected shift - coarse value */
+ const Word16* LPC1, /* i : LPC to filter to find correlation in spch */
+ const Word16* LPC2, /* i : LPC to filter to find correlation in spch */
+ Word16 *S_fx,
+ Word16 *C_fx,
+ Word16 *pf_temp1,
+ Word16 *pf_temp2,
+ Word16 *pf_temp,
+ Word16 *pf_n2
+)
{
/* Eshift is w.r.t X2 */
Word16 k, HalfLag, start, end, ab1[MAXLAG_WI], ab2[MAXLAG_WI] ;
@@ -495,152 +373,8 @@ Word16 DTFS_alignment_weight_fx( DTFS_STRUCTURE_FX *X_fx, DTFS_STRUCTURE_FX X2,
return fshift_fx ;
}
-/*===================================================================*/
-/* FUNCTION : DTFS_alignment_extract_td_fx () */
-/*-------------------------------------------------------------------*/
-/* PURPOSE : search for alignment in time domain */
-/*-------------------------------------------------------------------*/
-/* INPUT ARGUMENTS : */
-/* _ (Word16 *) x1: Q? */
-/* _ (Word16 *) x2: Q? */
-/*-------------------------------------------------------------------*/
-/* OUTPUT ARGUMENTS : */
-/* _ (Word16) lag : Q0 */
-/*-------------------------------------------------------------------*/
-/* INPUT/OUTPUT ARGUMENTS : */
-/* _ None */
-/*-------------------------------------------------------------------*/
-/* RETURN ARGUMENTS : _ (Word16 *) idx: Q0 */
-/*-------------------------------------------------------------------*/
-/* CALLED FROM : TX */
-/*===================================================================*/
-
-Word16 DTFS_alignment_extract_td_fx(Word16 *x1, Word16 *x2, Word16 lag)
-{
- Word16 j, k, idx, Adiff_fx ;
- Word32 maxcorr, corr;
-
- maxcorr = L_add(MIN_32, 0);
- Adiff_fx = (Word16)(s_max(4, shr(lag, 3)));
-
- idx=0;
- move16();
- FOR ( j=negate(Adiff_fx); j<=Adiff_fx; j++)
- {
- corr=L_deposit_l(0);
- FOR (k=0; k 0 )
- {
- fshift_fx = n ;
- move16();
- maxcorr_fx = (Word32)L_shl(corr_fx, Qcorr) ; /* Qcorr */
- Qmaxcorr = Qcorr;
- move16();
- }
- }
- return fshift_fx ;
-}
/*===========================================================================*/
/* FUNCTION : DTFS_alignment_full_fx () */
/*---------------------------------------------------------------------------*/
@@ -663,9 +397,14 @@ Word16 DTFS_alignment_fine_new_fx( DTFS_STRUCTURE_FX X1_fx, DTFS_STRUCTURE_FX X2
/* CALLED FROM : TX */
/*===========================================================================*/
-Word16 DTFS_alignment_full_fx( DTFS_STRUCTURE_FX X1_DTFS_fx, DTFS_STRUCTURE_FX X2_DTFS_fx, Word16 ph_offset_fx,Word16 *S_fx, Word16 *C_fx
- , Word16 FR_flag
- )
+Word16 DTFS_alignment_full_fx(
+ DTFS_STRUCTURE_FX X1_DTFS_fx,
+ DTFS_STRUCTURE_FX X2_DTFS_fx,
+ Word16 ph_offset_fx,
+ Word16 *S_fx,
+ Word16 *C_fx,
+ Word16 FR_flag
+)
{
Word16 temp, temp1, k, start, end, HalfLag, ab1[MAXLAG_WI], ab2[MAXLAG_WI] ;
Word16 n, fshift_fx;
@@ -804,6 +543,7 @@ void DTFS_phaseShift_fx( DTFS_STRUCTURE_FX *X_fx,Word16 ph, Word16 Lag, Word16 *
L_temp2 = L_add(L_temp2, ph);
}
}
+ return;
}
/*===================================================================*/
@@ -828,7 +568,13 @@ void DTFS_phaseShift_fx( DTFS_STRUCTURE_FX *X_fx,Word16 ph, Word16 Lag, Word16 *
/* CALLED FROM : TX/RX */
/*===================================================================*/
-void Q2phaseShift_fx( DTFS_STRUCTURE_FX *X_fx,Word16 ph, Word16 Lag, Word16 *S_fx, Word16 *C_fx)
+void Q2phaseShift_fx(
+ DTFS_STRUCTURE_FX *X_fx,
+ Word16 ph,
+ Word16 Lag,
+ Word16 *S_fx,
+ Word16 *C_fx
+)
{
Word16 k ;
Word16 temp, HalfLag;
@@ -869,7 +615,7 @@ void Q2phaseShift_fx( DTFS_STRUCTURE_FX *X_fx,Word16 ph, Word16 Lag, Word16 *S_f
/* PURPOSE : zeroPadding */
/*-------------------------------------------------------------------*/
/* INPUT ARGUMENTS : */
-/* _ (Word16) N_fx: length , Q0 */
+/* _ (Word16) N_fx: length , Q0 */
/*-------------------------------------------------------------------*/
/* OUTPUT ARGUMENTS : */
/* _ None. */
@@ -883,7 +629,10 @@ void Q2phaseShift_fx( DTFS_STRUCTURE_FX *X_fx,Word16 ph, Word16 Lag, Word16 *S_f
/* CALLED FROM : TX/RX */
/*===================================================================*/
-void DTFS_zeroPadd_fx(Word16 N_fx,DTFS_STRUCTURE_FX *X_fx)
+void DTFS_zeroPadd_fx(
+ Word16 N_fx,
+ DTFS_STRUCTURE_FX *X_fx
+)
{
Word16 i, start, end ,diff_fx,rem_fx;
@@ -944,8 +693,8 @@ void DTFS_to_fs_fx(
const Word16 *x, /* i : time domain signal */
Word16 N, /* i : Length of input vector */
DTFS_STRUCTURE_FX *X_fx, /* o : DTFS structure with a, b, lag */
- Word16 Fs, /* i : sampling rate */
- Word16 FR_flag, /* i : FR flag */
+ const Word16 Fs, /* i : sampling rate */
+ const Word16 FR_flag, /* i : FR flag */
Word16 *S_fx,
Word16 *C_fx
)
@@ -1142,7 +891,7 @@ void DTFS_to_fs_fx(
move16();
X_fx->nH_4kHz_fx=nH_4kHz;
move16();
-
+ return;
}
@@ -1167,13 +916,13 @@ void DTFS_to_fs_fx(
/*-------------------------------------------------------------------*/
/* CALLED FROM : TX/RX */
/*===================================================================*/
-void DTFS_transform_fx(
+static void DTFS_transform_fx(
DTFS_STRUCTURE_FX X_fx, /* i : Starting DTFS to use in WI */
DTFS_STRUCTURE_FX X2_fx, /* i : Ending DTFS to use in WI */
const Word32 *phase_fx, /* i : Phase contour */
Word16 *out_fx, /* o : Output time domain waveform */
Word16 N, /* i : Number of samples to generate */
- Word16 FR_flag /* i : Flag to indicate called in FR context */
+ const Word16 FR_flag /* i : Flag to indicate called in FR context */
)
{
@@ -1193,9 +942,27 @@ void DTFS_transform_fx(
Word16 tmp, tmp1, tmp2, frac, exp1, exp2;
Word16 expa, expb, fraca, fracb, scale;
- DTFS_STRUCTURE_FX *tmp2_dtfs_fx = DTFS_new_fx();
- DTFS_STRUCTURE_FX *tmp1_dtfs_fx = DTFS_new_fx();
- DTFS_STRUCTURE_FX *tmp3_dtfs_fx = DTFS_new_fx();
+ ivas_error error;
+
+ DTFS_STRUCTURE_FX* tmp1_dtfs_fx;
+ DTFS_STRUCTURE_FX* tmp2_dtfs_fx;
+ DTFS_STRUCTURE_FX* tmp3_dtfs_fx;
+
+ error = IVAS_ERR_OK;
+
+ IF ((error = DTFS_new_fx(&tmp1_dtfs_fx)) != IVAS_ERR_OK)
+ {
+ IVAS_ERROR(error, "Error creating DTFS structure 1");
+ }
+ IF ((error = DTFS_new_fx(&tmp2_dtfs_fx)) != IVAS_ERR_OK)
+ {
+ IVAS_ERROR(error, "Error creating DTFS structure 2");
+ }
+ IF ((error = DTFS_new_fx(&tmp3_dtfs_fx)) != IVAS_ERR_OK)
+ {
+ IVAS_ERROR(error, "Error creating DTFS structure 3");
+ }
+
DTFS_copy_fx(tmp1_dtfs_fx,X_fx);
DTFS_copy_fx(tmp2_dtfs_fx,X2_fx);
@@ -1359,9 +1126,10 @@ void DTFS_transform_fx(
}
- free(tmp1_dtfs_fx);
- free(tmp2_dtfs_fx);
- free(tmp3_dtfs_fx);
+ count_free(tmp1_dtfs_fx);
+ count_free(tmp2_dtfs_fx);
+ count_free(tmp3_dtfs_fx);
+ return;
}
/*===================================================================*/
/* FUNCTION : zeroFilter_fx() */
@@ -1388,7 +1156,13 @@ void DTFS_transform_fx(
/* CALLED FROM : TX/RX */
/*===================================================================*/
-void DTFS_zeroFilter_fx( DTFS_STRUCTURE_FX *X_fx,Word16 *LPC, Word16 N, Word16 *S_fx, Word16 *C_fx)
+void DTFS_zeroFilter_fx(
+ DTFS_STRUCTURE_FX *X_fx,
+ Word16 *LPC,
+ Word16 N,
+ Word16 *S_fx,
+ Word16 *C_fx
+)
{
Word32 sum1_fx, sum2_fx ;
Word16 k, n, HalfLag ;
@@ -1467,6 +1241,7 @@ void DTFS_zeroFilter_fx( DTFS_STRUCTURE_FX *X_fx,Word16 *LPC, Word16 N, Word16 *
X_fx->Q = add(X_fx->Q, Qmin);
move16();
+ return;
}
/*===================================================================*/
/* FUNCTION : DTFS_poleFilter_fx() */
@@ -1496,7 +1271,13 @@ void DTFS_zeroFilter_fx( DTFS_STRUCTURE_FX *X_fx,Word16 *LPC, Word16 N, Word16 *
/* PORTING: Handling the functions with variable no. of arguments */
-void DTFS_poleFilter_fx_9( DTFS_STRUCTURE_FX *X_fx, Word16 *pf_temp1, Word16 *pf_temp2, Word16 *pf_temp, Word16 *pf_n2_temp1)
+void DTFS_poleFilter_fx_9(
+ DTFS_STRUCTURE_FX *X_fx,
+ Word16 *pf_temp1,
+ Word16 *pf_temp2,
+ Word16 *pf_temp,
+ Word16 *pf_n2_temp1
+)
{
Word16 temp, temp1, temp2, HalfLag ;
Word32 sum1_fx, sum2_fx;
@@ -1574,6 +1355,7 @@ void DTFS_poleFilter_fx_9( DTFS_STRUCTURE_FX *X_fx, Word16 *pf_temp1, Word16 *pf
}
X_fx->Q = add(X_fx->Q, Qmin);
+ return;
}
/*===================================================================*/
/* FUNCTION : DTFS_adjustLag_fx () */
@@ -1666,6 +1448,7 @@ void DTFS_adjustLag_fx(
move16();
}
}
+ return;
}
/*===================================================================*/
/* FUNCTION : DTFS_getEngy_fx () */
@@ -1686,7 +1469,9 @@ void DTFS_adjustLag_fx(
/*===================================================================*/
-Word32 DTFS_getEngy_fx( DTFS_STRUCTURE_FX *X_fx)
+Word32 DTFS_getEngy_fx(
+ DTFS_STRUCTURE_FX *X_fx
+)
{
Word16 k, HalfLag_fx;
Word32 en_fx=0;
@@ -1744,7 +1529,9 @@ Word32 DTFS_getEngy_fx( DTFS_STRUCTURE_FX *X_fx)
/* CALLED FROM : TX/RX */
/*===================================================================*/
-Word32 DTFS_getEngy_P2A_fx( DTFS_STRUCTURE_FX *X_fx)
+Word32 DTFS_getEngy_P2A_fx(
+ DTFS_STRUCTURE_FX *X_fx
+)
{
Word16 k, HalfLag_fx;
Word32 en_fx=0;
@@ -1769,81 +1556,7 @@ Word32 DTFS_getEngy_P2A_fx( DTFS_STRUCTURE_FX *X_fx)
}
-/*=================================================================================*/
-/* FUNCTION : DTFS_getEngy_band_fx (Word16 lband, Word16 hband) */
-/*---------------------------------------------------------------------------------*/
-/* PURPOSE : compute the energy of X1.a[k] and X2.b[k] */
-/*---------------------------------------------------------------------------------*/
-/* INPUT ARGUMENTS : */
-/* _ (struct DTFS_STRUCTURE_FX) X_fx : a_fx/b_fx in X_fx.Q, lag in Q0 */
-/* _ (Word16) lband: Q0 */
-/* _ (Word16) hband: Q0 */
-/*---------------------------------------------------------------------------------*/
-/* OUTPUT ARGUMENTS : */
-/* _ (Word40) en_fx : 2*X1.Q */
-/*---------------------------------------------------------------------------------*/
-/* INPUT/OUTPUT ARGUMENTS : */
-/* _ None */
-/*---------------------------------------------------------------------------------*/
-/* RETURN ARGUMENTS : _ None. */
-/*---------------------------------------------------------------------------------*/
-/* CALLED FROM : TX */
-/*=================================================================================*/
-
-/* PORTING: Handling the functions with variable no. of arguments */
-
-Word32 DTFS_getEngy_band_fx(DTFS_STRUCTURE_FX X_fx,Word16 lband, Word16 hband)
-{
- Word16 k, lk, hk, HalfLag ;
- Word32 freq_fx, L_lband, L_hband;
- Word32 en_fx=0;
- L_lband = L_mult(lband, X_fx.lag_fx);
- L_hband = L_mult(hband, X_fx.lag_fx);
- HalfLag = s_min(shr(sub(X_fx.lag_fx, 1), 1),X_fx.nH_4kHz_fx);
- /* get lband and hband */
- FOR (k=1; k<=HalfLag; k++)
- {
- freq_fx = L_mult(k, 12800);
- IF (GE_32(freq_fx, L_lband))
- {
- BREAK;
- }
- }
- lk = k;
- move16();
- FOR (k=1; k<=HalfLag; k++)
- {
- freq_fx = L_mult(k, 12800);
- IF (GE_32(freq_fx, L_hband))
- {
- BREAK;
- }
- }
- hk = k;
- move16();
-
- FOR (k=lk; kb_fx[k]= 0;
move16(); /* clear b[k]; */
}
+ return;
}
@@ -2206,10 +1923,13 @@ Word32 DTFS_setEngyHarm_fx(
/*===================================================================*/
/* NOTE: This function outputs phase in (-1,1) */
/*===================================================================*/
-static
-void cubicPhase_fx(
- Word16 ph1_fx, Word16 ph2_fx, Word16 L1, Word16 L2,
- Word16 N, Word32 *phOut_fx
+static void cubicPhase_fx(
+ Word16 ph1_fx, /* i : phase offset */
+ Word16 ph2_fx, /* i : phase 2 */
+ const Word16 L1, /* i : previous lag */
+ const Word16 L2, /* i : current lag */
+ Word16 N, /* i : input length */
+ Word32* phOut_fx /* o : cubic phase output */
)
{
Word16 n;
@@ -2497,7 +2217,7 @@ void cubicPhase_fx(
move32(); /* Q27 */
}
-
+ return;
}
/*===================================================================*/
@@ -2631,6 +2351,7 @@ void DTFS_to_erb_fx(
out_fx[i] = round_fx(L_tmp);
}
}
+ return;
}
/*===================================================================*/
/* FUNCTION : erb_slot_fx () */
@@ -2778,7 +2499,7 @@ void erb_slot_fx(
}
}
-
+ return;
}
/*===================================================================*/
/* FUNCTION : DTFS_erb_inv_fx () */
@@ -2924,291 +2645,9 @@ void DTFS_erb_inv_fx(
}
X_fx->Q=min_q;
+ return;
}
-/*===================================================================*/
-/* FUNCTION : LPCPowSpect_fx () */
-/*-------------------------------------------------------------------*/
-/* PURPOSE : Compute LPC power spectrum */
-/*-------------------------------------------------------------------*/
-/* INPUT ARGUMENTS : */
-/* _ (Word16 []) freq : ERB frequency bounds, Q15 */
-/* _ (Word16 []) LPC : LPC coefficients, Q12 */
-/* _ (Word16) Nf: number of ERB bins, Q0 */
-/* _ (Word16) Np : order of LPC, Q0 */
-/*-------------------------------------------------------------------*/
-/* OUTPUT ARGUMENTS : */
-/* _ (Word16 []) out : LPC power spectrum, Q7 */
-/*-------------------------------------------------------------------*/
-/* INPUT/OUTPUT ARGUMENTS : */
-/* _ None */
-/*-------------------------------------------------------------------*/
-/* RETURN ARGUMENTS : _ None. */
-/*-------------------------------------------------------------------*/
-/* CALLED FROM : TX */
-/*===================================================================*/
-/* NOTE: Frequency is normalized by 12800, i.e. 1=12800Hz */
-/*===================================================================*/
-void LPCPowSpect_fx(Word16 *freq, Word16 Nf, Word16 *LPC, Word16 Np,
- Word16 *out)
-{
- Word16 i, k;
- Word16 w; /* Q9 */
- Word16 t1, dt;
- /*Word16 t2; */
- Word16 dh, dl;
- Word32 Re, Im; /* Q27 */
- Word32 Ltemp, Lw;
- Word32 Lacc;
- Word16 tmp,exp;
-
- FOR (k=0; k 0)
- {
- tmp = div_s(16384, tmp); /* 15+exp1 */
- }
- ELSE
- {
- tmp = 0;
- move16();
- }
- Ltemp = L_deposit_h(tmp);
- out[k] = round_fx(L_shl(Ltemp,negate(add(exp,8))));
-
- /* out[k] = shl(tmp,-exp-8); in Q7 */
-
- }
-}
-/*===================================================================*/
-/* FUNCTION : erb_diff_fx () */
-/*-------------------------------------------------------------------*/
-/* PURPOSE : Quantize erb amplitude for QPPP */
-/*-------------------------------------------------------------------*/
-/* INPUT ARGUMENTS : */
-/* _ (Word16) pl : previous pitch lag, Q0 */
-/* _ (Word16) l : current pitch lag, Q0 */
-/* _ (Word16 []) prev_erb : Previous erb amplitude, Q13 */
-/* _ (Word16 []) curr_erb : Current erb amplitude, Q13 */
-/* _ (Word16 []) curr_lsp : LSP coefficients, Q12 */
-/* _ (Word16 []) num_erb : Number of ERBs , Q0 */
-/*-------------------------------------------------------------------*/
-/* OUTPUT ARGUMENTS : */
-/* _ (Word16 []) index: quantized differential erb index */
-/*-------------------------------------------------------------------*/
-/* INPUT/OUTPUT ARGUMENTS : */
-/* _ None */
-/*-------------------------------------------------------------------*/
-/* RETURN ARGUMENTS : _ None. */
-/*-------------------------------------------------------------------*/
-/* CALLED FROM : TX */
-/*===================================================================*/
-static
-void erb_diff_fx(
- const Word16 *prev_erb, /* i : previous ERB */
- Word16 pl, /* i : previous lag */
- const Word16 *curr_erb, /* i : current ERB */
- Word16 l, /* i : current lag */
- const Word16 *curr_lsp, /* i : current LSP coefficients */
- Word16 *index, /* 0 : ERB index */
- Word16 num_erb /* i : Number of ERBs */
-)
-{
- Word16 i;
- Word16 pslot[NUM_ERB_WB], cslot[NUM_ERB_WB];
- Word16 tmp, t_prev_erb[NUM_ERB_WB], LPC[M+1], mfreq[NUM_ERB_WB], PowSpect[NUM_ERB_WB], dif_erb[NUM_ERB_WB] ;
- const Word16 *AmpCB1_fx = NULL;
-
- IF (EQ_16(num_erb,NUM_ERB_NB))
- {
- AmpCB1_fx=AmpCB1_NB_fx;
- move16();
- }
- ELSE IF (EQ_16(num_erb,NUM_ERB_WB))
- {
- AmpCB1_fx=AmpCB1_WB_fx;
- move16();
-
- }
- erb_slot_fx (l,cslot,mfreq,num_erb);/* cslot in Qo and mfreq in Q15 */
- erb_slot_fx (pl,pslot,t_prev_erb,num_erb);
-
- FOR (i=0; i=0; i--)
- {
- IF (pslot[i]!=0)
- {
- tmp = t_prev_erb[i];
- move16();
- }
- ELSE
- {
- t_prev_erb[i] = tmp ;
- move16();
- }
- }
- }
- FOR(i=0; iupper_cut_off_freq_fx,0x2800))/* 4000 hz normalized to 12800 in Q15 */
- {
- num_erb=NUM_ERB_NB;
- move16();
- PowerCB_fx=PowerCB_NB_fx;
- move16();
- }
- ELSE IF (EQ_16(X_fx->upper_cut_off_freq_fx,0x4000))/* 6400 hz normalized to 12800 in Q15 */
- {
- num_erb=NUM_ERB_WB;
- move16();
- PowerCB_fx=PowerCB_WB_fx;
- move16();
- }
-
- /* Get weighting and target */
- quant_target_fx(X_fx,curr_lpc_fx, w, target, sin_tab, cos_tab);
-
- /* Power Quantization in log domain */
- target[0]=sub(target[0],*lastLgainE_fx);
- move16();
- target[1]=sub(target[1],*lastHgainE_fx);
- move16();
-
- minerror = L_add(EVS_LW_MAX, 0);
- *POWER_IDX = 0;
- move16();
-
- j=0;
- move16();
- FOR (n=0; n=0 && d2>=0)
- {
- Ltemp= Mult_32_16(Ltemp,0x6666); /* *=0.8 */
- }
- IF (LT_32(Ltemp, minerror))
- {
- minerror = L_add(Ltemp, 0);
- *POWER_IDX = j ;
- move16();
- }
- j = add(j,1);
- }
- DTFS_to_erb_fx (*X_fx,curr_erb_fx) ;
-
- FOR(j=0; jlag_fx, slot, mfreq,num_erb) ;
- /* Amplitude Quantization */
-
-
- erb_diff_fx(lasterbE_fx,pl,curr_erb_fx,X_fx->lag_fx,curr_lpc_fx,AMP_IDX,num_erb);
-
-
- /* Dequantization of prototype */
- /* PORTING: Removing the references */
- /* DTFS_dequant_cw_fx(pl, *POWER_IDX, AMP_IDX,lastLgainE_fx,lastHgainE_fx, lasterbE_fx,X_fx,num_erb,curr_erb_fx); */
-
- /* Determine IF the amplitude quantization is good enough */
- erb_add_fx(curr_erb_fx,X_fx->lag_fx,lasterbE_fx,pl,AMP_IDX,num_erb);
-
- curr_erb_fx[0] = mult_r(curr_erb_fx[1],9830);
- move16(); /* 0.3 inQ15 leaves curr_erb in Q13 */
- curr_erb_fx[sub(num_erb,2)] = mult_r(curr_erb_fx[sub(num_erb,3)],9830);/* Q13 */
-
- curr_erb_fx[sub(num_erb,1)] = 0;
- move16();
- flag=1;
- move16();
-
- Ltemp = L_deposit_l(0);
- n=0;
- move16();
- FOR (j=1; j<10; j++)
- {
- IF (slot[j]!=0)
- {
- Ltemp=L_add(Ltemp,abs_s(sub(erb_uq[j],curr_erb_fx[j]))); /* Q13 */
- n=add(n,1); /* n++ */
- }
- }
-
- exp = norm_s(n);
- tmp = div_s(shl(1,sub(14,exp)),n);/* 29 - exp */
- Lacc = L_shl( Mult_32_16(Ltemp , tmp), exp +4);
-
- tmp=round_fx(Lacc); /* tmp in Q15 */
-
- test();
- if (GT_16(tmp,0x3C29)&>_16(target[0],-819))
- {
- flag = 0 ; /* Bumping up */ move16();
- }
-
- /* mfreq normalized (2.56) in Q15 */
- DTFS_erb_inv_fx(curr_erb_fx, slot, mfreq, X_fx,num_erb) ;
-
-
- /* Back up the lasterbD memory after power normalization */
- DTFS_setEngyHarm_fx(236,2828,0,2828,1,0,&Ql,X_fx);
- DTFS_setEngyHarm_fx(2828,X_fx->upper_cut_off_freq_of_interest_fx,2828,X_fx->upper_cut_off_freq_fx,1,0,&Qh,X_fx);
-
- /* Need to unify the Q factors of both bands */
- X_fx->Q=s_min(Ql,Qh); /* set Q factor to be the smaller one */
- n=sub(Ql,Qh); /* compare band Q factors */
-
-
- /* This logic adjusts difference between Q formats of both bands */
-
- IF (n<0)
- rshiftHarmBand_fx(X_fx,2828, X_fx->upper_cut_off_freq_fx,n);
- ELSE IF (n>0)
- rshiftHarmBand_fx(X_fx,0, 2828, sub(Qh,Ql));
-
- tmp=shl(*POWER_IDX,1); /* tmp=2*POWER_IDX */
- *lastLgainE_fx =add(*lastLgainE_fx, PowerCB_fx[tmp]) ; /* Q11 */
- *lastHgainE_fx =add(*lastHgainE_fx, PowerCB_fx[tmp+1]); /* Q11 */
-
- Ltemp=log10_fx(X_fx->lag_fx); /* Ltemp=10*log10(lag), Q23 */
- logLag_fx= Mult_32_16(Ltemp,0x6666); /* logLag=log10(lag), Q26 */
-
- Ltemp=L_sub(L_shr(L_deposit_h(*lastLgainE_fx),1),logLag_fx); /* Ltemp=Lgain-log10(lag), Q26 */
-
- L_tmp=pow_10(Ltemp,&Q); /* Lacc=10^Lgain/lag, Q15 */
- n=norm_l(L_tmp);
- Ltemp=(Word32)L_shl(L_tmp,n); /* Ltemp in Q(15+n) */
-
-
- DTFS_setEngyHarm_fx(236,2828,0,2828,Ltemp, add(Q,n),&Ql,X_fx);
-
- Ltemp=L_sub(L_shr(L_deposit_h(*lastHgainE_fx),1),logLag_fx); /* Ltemp=Hgain-log10(lag), Q26 */
-
- /* Ltemp = L_shr(Ltemp,1); */
- L_tmp = pow_10(Ltemp,&Q); /* Lacc=10^Lgain/lag, Q15 */
- n=norm_l(L_tmp);
- Ltemp=(Word32)L_shl(L_tmp,n); /* Ltemp in Q(15+n) */
-
- DTFS_setEngyHarm_fx(2828,X_fx->upper_cut_off_freq_of_interest_fx,2828,X_fx->upper_cut_off_freq_fx,Ltemp,add(Q,n),&Qh,X_fx);
- /* Need to unify the Q factors of both bands */
- X_fx->Q=s_min(Ql,Qh); /* set Q factor to be the smaller one */
- n=sub(Ql,Qh); /* compare band Q factors */
- IF (n<0)
- rshiftHarmBand_fx(X_fx,2828, X_fx->upper_cut_off_freq_fx,n);
- ELSE IF (n>0)
- rshiftHarmBand_fx(X_fx,0, 2828, sub(Qh,Ql));
-
- return flag;
-}
/*===================================================================*/
/* FUNCTION : struct quant_target_fx() */
/*-------------------------------------------------------------------*/
@@ -3661,192 +2880,7 @@ void quant_target_fx( DTFS_STRUCTURE_FX *X_fx,const Word16 *curr_lpc, Word16 *w,
IF (n<0) rshiftHarmBand_fx(X_fx,2828, X_fx->upper_cut_off_freq_fx,n);
ELSE IF (n>0) rshiftHarmBand_fx(X_fx,0, 2828, sub(Qh,Ql));
}
-/*===================================================================*/
-/* FUNCTION : struct DTFS_fx::dequant_cw_fx () */
-/*-------------------------------------------------------------------*/
-/* PURPOSE : Dequantize QPPP prototype */
-/*-------------------------------------------------------------------*/
-/* INPUT ARGUMENTS : */
-/* _ (Word16) pl: previous lag */
-/* _ (Word16) p_idx: Power index */
-/* _ (Word16[]) a_idx: Amplitude indices, 2 words */
-/* _ (struct DTFS_fx) X : prototype in polar domain */
-/* (Word16) lag: length of prototype */
-/*-------------------------------------------------------------------*/
-/* OUTPUT ARGUMENTS : */
-/* _ (struct DTFS_fx) X : prototype in polar domain */
-/* (Word16) lag: length of prototype in time domain */
-/* (Word16 []) a: amplitude of harmonics, normalized */
-/* (Word16) Q: norm factor of a */
-/* _ (Word16[]) curr_erb: Quantized current ERB, Q13 */
-/*-------------------------------------------------------------------*/
-/* INPUT/OUTPUT ARGUMENTS : */
-/* _ (Word16[]) lasterb: ERB history for differential */
-/* quantization, Q13 */
-/* _ (Word16) Lgain: low band power history, log domain, Q11 */
-/* _ (Word16) Hgain: high band power history, log domain, Q11 */
-/*-------------------------------------------------------------------*/
-/* RETURN ARGUMENTS : _ None. */
-/*-------------------------------------------------------------------*/
-/* CALLED FROM : TX/RX */
-/*===================================================================*/
-
-void DTFS_dequant_cw_fx(
- Word16 pl_fx, /* i : Previous lag */
- Word16 POWER_IDX_fx, /* i : POWER index */
- const Word16 *AMP_IDX_fx, /* i : Amp Shape index */
- Word16 *lastLgainD_fx, /* i/o: low band last gain */
- Word16 *lastHgainD_fx, /* i/o: high band last gain */
- Word16 *lasterbD_fx, /* i/o: last frame ERB vector */
- DTFS_STRUCTURE_FX *X_fx, /* o : DTFS structure dequantized */
- Word16 num_erb_fx
-)
-
-{
- Word16 tmp_fx, mfreq_fx[NUM_ERB_WB], curr_erb_fx[NUM_ERB_WB];
- const Word16 *PowerCB_fx=NULL;
- Word16 slot_fx[NUM_ERB_WB];
- Word16 Ql, Qh, n;
- Word32 Ltemp_fx,logLag_fx;
- Word16 exp,frac,exp1;
- Word32 L_tmp,L_temp;
- Word32 L_tmp2;
-
- IF (num_erb_fx==NUM_ERB_NB)
- {
- PowerCB_fx=PowerCB_NB_fx;
- move16();
- }
- ELSE IF (num_erb_fx==NUM_ERB_WB)
- {
- PowerCB_fx=PowerCB_WB_fx;
- move16();
- }
-
- /* Amplitude Dequantization */
-
- erb_add_fx(curr_erb_fx,X_fx->lag_fx,lasterbD_fx,pl_fx,AMP_IDX_fx,num_erb_fx);
-
- curr_erb_fx[0] = mult_r(curr_erb_fx[1],9830);/* 0.3 inQ15 leaves curr_erb in Q13 */
- curr_erb_fx[sub(num_erb_fx,2)] = mult_r(curr_erb_fx[sub(num_erb_fx,3)],9830);/* Q13 */
-
- move16();
-
- curr_erb_fx[sub(num_erb_fx,1)] = 0;
-
- erb_slot_fx(X_fx->lag_fx,slot_fx,mfreq_fx,num_erb_fx);
-
- /* mfreq normalized (2.56) in Q15 */
- DTFS_erb_inv_fx(curr_erb_fx, slot_fx, mfreq_fx, X_fx,num_erb_fx) ;
-
-
- /* Back up the lasterbD memory after power normalization */
-
- DTFS_setEngyHarm_fx(236,2828,0,2828,1,0,&Ql,X_fx);
- DTFS_setEngyHarm_fx(2828,X_fx->upper_cut_off_freq_of_interest_fx,2828,X_fx->upper_cut_off_freq_fx,1,0,&Qh,X_fx);
-
- /* Need to unify the Q factors of both bands */
- X_fx->Q=s_min(Ql,Qh); /* set Q factor to be the smaller one */
- n=sub(Ql,Qh); /* compare band Q factors */
-
-
-
- /* This logic adjusts difference between Q formats of both bands */
- IF (n<0)
- rshiftHarmBand_fx(X_fx,2828, X_fx->upper_cut_off_freq_fx,n);
- ELSE IF (n>0)
- rshiftHarmBand_fx(X_fx,0, 2828, sub(Qh,Ql));
-
- DTFS_to_erb_fx(*X_fx,lasterbD_fx);
-
-
- /* Power Dequantization */
-
- tmp_fx=shl(POWER_IDX_fx,1); /* tmp=2*POWER_IDX */
- *lastLgainD_fx =add(*lastLgainD_fx, PowerCB_fx[tmp_fx]) ; /* Q11 */
- *lastHgainD_fx =add(*lastHgainD_fx, PowerCB_fx[tmp_fx+1]); /* Q11 */
-
- L_tmp = L_deposit_h(X_fx->lag_fx); /* Q16 */
- exp = norm_l(L_tmp);
- L_tmp = L_shl(L_tmp,exp);
- frac = Log2_norm_lc(L_tmp);
- exp = sub(30,add(exp,16));
- L_tmp = Mpy_32_16(exp,frac,12330);/* Q13 */ /* 10*log10(2) in Q12*/
- Ltemp_fx = L_shl(L_tmp, 10);/* Q23 */
-
-
- logLag_fx= Mult_32_16(Ltemp_fx,0x6666); /* logLag=log10(lag), Q26 */
-
- Ltemp_fx=L_sub(L_shr(L_deposit_h(*lastLgainD_fx),1),logLag_fx); /* Ltemp=Lgain-log10(lag), Q26 */
-
- /* Lacc_fx=dsp_pow10(Ltemp_fx); : Lacc=10^Lgain/lag, Q15 */
-
- L_tmp = Mult_32_16(Ltemp_fx, 27213); /* 3.321928 in Q13 */
- L_tmp = L_shr(L_tmp,8); /* Q16 */
- frac = L_Extract_lc(L_tmp, &exp1); /* Extract exponent */
- L_tmp =Pow2(14, frac);
- exp1 = sub(exp1,14);
- L_temp = L_shl(L_tmp, add(exp1,15) ); /* Q15 */
-
- L_tmp2 = L_temp;
- if( GE_32( L_temp, 2147483647 ))
- {
- L_temp = L_shl(L_tmp, 15 ); /*Q(15-exp1) */
- }
-
- n=norm_l(L_temp);
- Ltemp_fx=L_shl(L_temp,n); /* Ltemp in Q(15+n) or Q(15 - exp1 +n) */
-
- IF( GE_32( L_tmp2, 2147483647 ))
- {
- DTFS_setEngyHarm_fx( 236, 2828, 0, 2828, Ltemp_fx, add(15,sub(n,exp1)), &Ql, X_fx );
- }
- ELSE
- {
- DTFS_setEngyHarm_fx( 236, 2828, 0, 2828, Ltemp_fx, add(15,n), &Ql, X_fx );
- }
-
- Ltemp_fx=L_sub(L_shr(L_deposit_h(*lastHgainD_fx),1),logLag_fx); /* Ltemp=Hgain-log10(lag), Q26 */
- /* Lacc_fx=dsp_pow10(Ltemp_fx); : Lacc=10^Hgain/lag, Q15 */
- L_tmp = Mult_32_16(Ltemp_fx, 27213); /* 3.321928 in Q13 */ /* Q24 */
- L_tmp = L_shr(L_tmp,8); /* Q16 */
- frac = L_Extract_lc(L_tmp, &exp1); /* Extract exponent */
- L_tmp =Pow2(14, frac);
- exp1 = sub(exp1,14);
- L_temp = L_shl(L_tmp,exp1 +15 ); /* Q15 */
-
- L_tmp2 = L_temp;
- if( GE_32( L_temp, 2147483647 ))
- {
- L_temp = L_shl(L_tmp, 15 ); /*Q(15-exp1) */
- }
-
-
- n=norm_l(L_temp);
- Ltemp_fx=L_shl(L_temp,n); /* Ltemp in Q(15+n) or Q(15 - exp1 +n) */
-
- IF( GE_32( L_tmp2, 2147483647 ))
- {
- DTFS_setEngyHarm_fx( 2828, X_fx->upper_cut_off_freq_of_interest_fx,2828, X_fx->upper_cut_off_freq_fx, Ltemp_fx,add( 15, sub( n, exp1 )),&Qh, X_fx );
- }
- ELSE
- {
- DTFS_setEngyHarm_fx( 2828, X_fx->upper_cut_off_freq_of_interest_fx,2828, X_fx->upper_cut_off_freq_fx, Ltemp_fx, add( 15, n ), &Qh, X_fx );
- }
-
-
- /* Need to unify the Q factors of both bands */
- X_fx->Q=s_min(Ql,Qh); /* set Q factor to be the smaller one */
- n=sub(Ql,Qh); /* compare band Q factors */
-
-
-
- IF (n<0)
- rshiftHarmBand_fx(X_fx,2828, X_fx->upper_cut_off_freq_fx,n);
- ELSE IF (n>0)
- rshiftHarmBand_fx(X_fx,0, 2828, sub(Qh,Ql));
-}
/*==========================================================================*/
/* FUNCTION : WIsyn_fx () */
/*--------------------------------------------------------------------------*/
@@ -3854,7 +2888,7 @@ void DTFS_dequant_cw_fx(
/*--------------------------------------------------------------------------*/
/* INPUT ARGUMENTS : */
/* _ (struct DTFS_STRUCTURE_FX) PREVCW_FX: a/b in PREVCW_FX.Q */
-/* _ (struct DTFS_fx *) CURR_CW_DTFS_FX: a/b in CURR_CW_DTFS_FX->Q */
+/* _ (struct DTFS_fx *) CURRCW_DTFS_out: a/b in CURRCW_DTFS_out->Q */
/* _ (Word16 *) curr_lpc_fx: lpc coefficients in Q12 */
/* _ (Word16 *) ph_offset_fx: in Q15, normalized by 2pi */
/* _ (Word16 *) S_fx: sin(2pi*n/(4*lag)) table, Q15 */
@@ -3865,20 +2899,19 @@ void DTFS_dequant_cw_fx(
/* _ (Word16 *) out_fx: Q0 */
/*--------------------------------------------------------------------------*/
/* INPUT/OUTPUT ARGUMENTS : */
-/* _ (struct DTFS_STRUCTURE_FX *) CURR_CW_DTFS_FX: a/b in CURR_CW_DTFS_FX->Q*/
+/* _ (struct DTFS_STRUCTURE_FX *) CURRCW_DTFS_out: a/b in CURRCW_DTFS_out->Q*/
/* _ (Word16 *) ph_offset_fx: in Q15, normalized by 2pi */
/*--------------------------------------------------------------------------*/
/* RETURN ARGUMENTS : _ None. */
/*==========================================================================*/
-
-void WIsyn_fx(
- DTFS_STRUCTURE_FX PREVCW_FX,
- DTFS_STRUCTURE_FX *CURR_CW_DTFS_FX,
- const Word16 *curr_lpc_fx,
- Word16 *ph_offset_fx,
- Word16 *out_fx,
- Word16 N,
- Word16 FR_flag, /* i : called for post-smoothing in FR */
+ivas_error WIsyn_fx(
+ DTFS_STRUCTURE_FX PREVCW_FX, /* i : Prev frame DTFS */
+ DTFS_STRUCTURE_FX* CURRCW_DTFS_out, /* i/o: Curr frame DTFS */
+ const Word16* curr_lpc_fx, /* i : LPC */
+ Word16* ph_offset_fx, /* i/o: Phase offset to line up at end of frame */
+ Word16* out_fx, /* o : Waveform Interpolated time domain signal */
+ const Word16 N, /* i : Number of output samples to generate */
+ const Word16 FR_flag, /* i : called for post-smoothing in FR */
Word16 * S_fx,
Word16* C_fx,
Word16 *pf_temp1,
@@ -3899,41 +2932,48 @@ void WIsyn_fx(
/* prev_lsp_fx; */
- DTFS_STRUCTURE_FX *CURRCW_DTFS_FX=DTFS_new_fx();
+ DTFS_STRUCTURE_FX *CURRCW_DTFS_FX;
+ ivas_error error;
+ error = IVAS_ERR_OK;
- IF (LT_16(PREVCW_FX.Q,CURR_CW_DTFS_FX->Q))
+ IF ((error = DTFS_new_fx(&CURRCW_DTFS_FX)) != IVAS_ERR_OK)
+ {
+ return IVAS_ERROR(error, "Error creating new DTFS structure\n");
+ }
+ IF(LT_16(PREVCW_FX.Q, CURRCW_DTFS_out->Q))
{
- temp = sub(CURR_CW_DTFS_FX->Q, PREVCW_FX.Q);
- tmp = s_min(shr(CURR_CW_DTFS_FX->lag_fx,1),CURR_CW_DTFS_FX->nH_fx);
- FOR (i=0; i<=tmp; i++)
+ temp = sub(CURRCW_DTFS_out->Q, PREVCW_FX.Q);
+ tmp = s_min(shr(CURRCW_DTFS_out->lag_fx, 1), CURRCW_DTFS_out->nH_fx);
+ FOR(i = 0; i <= tmp; i++)
{
- CURR_CW_DTFS_FX->a_fx[i] = shr(CURR_CW_DTFS_FX->a_fx[i], temp);
+ CURRCW_DTFS_out->a_fx[i] = shr(CURRCW_DTFS_out->a_fx[i], temp);
move16();
- CURR_CW_DTFS_FX->b_fx[i] = shr(CURR_CW_DTFS_FX->b_fx[i], temp);
+ CURRCW_DTFS_out->b_fx[i] = shr(CURRCW_DTFS_out->b_fx[i], temp);
move16();
}
- CURR_CW_DTFS_FX->Q=PREVCW_FX.Q;
+ CURRCW_DTFS_out->Q = PREVCW_FX.Q;
move16();
}
- IF (LT_16(CURR_CW_DTFS_FX->Q,PREVCW_FX.Q))
+ IF(LT_16(CURRCW_DTFS_out->Q, PREVCW_FX.Q))
{
- temp = sub(PREVCW_FX.Q, CURR_CW_DTFS_FX->Q);
- tmp = s_min(shr(PREVCW_FX.lag_fx, 1),PREVCW_FX.nH_fx);
- FOR (i=0; i<=tmp; i++)
+ temp = sub(PREVCW_FX.Q, CURRCW_DTFS_out->Q);
+ tmp = s_min(shr(PREVCW_FX.lag_fx, 1), PREVCW_FX.nH_fx);
+ FOR(i = 0; i <= tmp; i++)
{
PREVCW_FX.a_fx[i] = shr(PREVCW_FX.a_fx[i], temp);
move16();
PREVCW_FX.b_fx[i] = shr(PREVCW_FX.b_fx[i], temp);
move16();
}
- PREVCW_FX.Q=CURR_CW_DTFS_FX->Q;
+ PREVCW_FX.Q = CURRCW_DTFS_out->Q;
move16();
}
- DTFS_copy_fx( CURRCW_DTFS_FX, *CURR_CW_DTFS_FX);
+ DTFS_copy_fx(CURRCW_DTFS_FX, *CURRCW_DTFS_out);
+
/* Calculating the expected alignment shift */
alignment_fx = mult_r(*ph_offset_fx, shl(PREVCW_FX.lag_fx, 7)); /* confirmed I<2 by smv12.org, Q7 */
@@ -3997,7 +3037,7 @@ void WIsyn_fx(
}
DTFS_phaseShift_fx(CURRCW_DTFS_FX, alignment_fx, CURRCW_DTFS_FX->lag_fx, S_fx, C_fx) ; /* Qmin */
- DTFS_phaseShift_fx(CURR_CW_DTFS_FX, alignment_fx, CURR_CW_DTFS_FX->lag_fx, S_fx, C_fx);/* Qmin */
+ DTFS_phaseShift_fx(CURRCW_DTFS_out, alignment_fx, CURRCW_DTFS_out->lag_fx, S_fx, C_fx);/* Qmin */
/* Compute the cubic phase track and transform to 1-D signal */
cubicPhase_fx(*ph_offset_fx, tmp_fx, PREVCW_FX.lag_fx , CURRCW_DTFS_FX->lag_fx, N, phase_fx) ;
@@ -4016,7 +3056,7 @@ void WIsyn_fx(
/* Adjust the phase offset and wrap it between 0 and 2pi */
-
+PMT("NEED a complete verification of mem flow and assignment")
IF (EQ_16(flag,2))
@@ -4039,6 +3079,7 @@ void WIsyn_fx(
/* free(phase_fx) ; */
free(CURRCW_DTFS_FX);
+ return error;
}
diff --git a/lib_com/window.c b/lib_com/window.c
index ecdc4466260501cef2c12b71d525d3d4744f6300..4bf8b52ab80150690de6682703040bee36a1d721 100644
--- a/lib_com/window.c
+++ b/lib_com/window.c
@@ -3,10 +3,11 @@
====================================================================================*/
+#include
+#include "options.h"
#include
#include "basop_util.h"
#include "prot_fx.h"
-#include "stl.h"
#define PI_HALF_0Q15 51472 /* ~=round(pi/2*2^15) */
#define PI2_15Q16 0x0006487F /* ~=round(2*PI*2^16) */
@@ -20,10 +21,11 @@
#include "rom_basop_util.h"
-void ham_cos_window(Word16 *fh, /* o: 0Q15 */
- const Word16 n1, /* i: */
- const Word16 n2 /* i: */
- )
+void ham_cos_window(
+ Word16 *fh, /* o: 0Q15 */
+ const Word16 n1, /* i: */
+ const Word16 n2 /* i: */
+)
{
Word16 i;
Word32 cte, cc;
diff --git a/lib_com/window_ola_fx.c b/lib_com/window_ola_fx.c
index 163ce54ad9b732a7f04906962d310f1a9b8e8f1c..373503c8c17685a2fec43186c99d82f7359580e4 100644
--- a/lib_com/window_ola_fx.c
+++ b/lib_com/window_ola_fx.c
@@ -475,16 +475,145 @@ void window_ola_fx(
*p2++=*p1++;
}
- /* for (i = 0; i < n; i++)
- {
- OldauOut[ i] = -ImdctOut[L/2 - 1 - i];
- }
- for (i =0; i = MDCT_II ? -1.f : 1.f);
+ int16_t i, decimate, decay;
+ int16_t n, n16, windecay48, windecay16;
+ float win_right[R2_48];
+ float win_int_left[R1_16];
+ float win_left[R1_48];
+ float win_int_right[R2_16];
+ float* paout;
+
+ n = (int16_t)((float)L * N_ZERO_MDCT_NS / FRAME_SIZE_NS);
+ n16 = (int16_t)((float)L_FRAME16k * N_ZERO_MDCT_NS / FRAME_SIZE_NS);
+ windecay48 = (int16_t)(2 * ((float)L_FRAME48k * N_ZERO_MDCT_NS / FRAME_SIZE_NS)) + R1_48;
+ windecay16 = (int16_t)(2 * ((float)L_FRAME16k * N_ZERO_MDCT_NS / FRAME_SIZE_NS)) + R1_16;
+ decimate = 1;
+ decay = 0;
+
+ tcx_get_windows_mode1(left_mode, right_mode, win_left, win_right, win_int_left, win_int_right, L);
+
+ if (L == L_FRAME32k || L == L_FRAME16k)
+ {
+ decimate = 3;
+ decay = 1;
+ }
+ else if (L == L_FRAME8k)
+ {
+ decimate = 6;
+ decay = 2;
+ }
+
+ else if (L == 512)
+ {
+ windecay48 = (int16_t)(2 * ((float)512 * N_ZERO_MDCT_NS / FRAME_SIZE_NS)) + R1_25;
+ decimate = 1;
+ decay = 0;
+ }
+ else if (L == 256)
+ {
+ windecay48 = (int16_t)(2 * ((float)512 * N_ZERO_MDCT_NS / FRAME_SIZE_NS)) + R1_25;
+ decimate = 2;
+ decay = 0;
+ }
+ paout = auOut - n;
+
+ if (L == L_FRAME32k)
+ {
+ for (i = n; i < L / 2; i += 2)
+ {
+ paout[i] = sign_right * ImdstOut[L / 2 + i] * win_right[(2 * L_FRAME16k - (n16 + (i - n) / 2)) * decimate - 1 - decay - windecay48] + OldauOut[i];
+ paout[i + 1] = sign_right * ImdstOut[L / 2 + i + 1] * win_int_right[2 * L_FRAME16k - (n16 + (i - n) / 2) - 1 - windecay16] + OldauOut[i + 1];
+ }
+
+ for (i = 0; i < L / 2 - n; i += 2)
+ {
+ paout[L / 2 + i + 1] = -ImdstOut[L - 1 - (i + 1)] * win_right[(3 * L_FRAME16k / 2 - 1 - i / 2) * decimate + decay - windecay48] + OldauOut[i + L / 2 + 1];
+ paout[L / 2 + i] = -ImdstOut[L - 1 - i] * win_int_right[(3 * L_FRAME16k / 2 - 1 - i / 2) - windecay16] + OldauOut[i + L / 2];
+ }
+
+ for (i = L / 2 - n; i < L / 2; i += 2)
+ {
+ paout[L / 2 + i + 1] = -ImdstOut[L - 1 - (i + 1)] + OldauOut[i + L / 2 + 1];
+ paout[L / 2 + i] = -ImdstOut[L - 1 - i] + OldauOut[i + L / 2];
+ }
+
+ for (i = 0; i < L / 2; i += 2)
+ {
+ OldauOut[L / 2 + i + 1] = sign_left * ImdstOut[i + 1] * win_left[(L_FRAME16k / 2 - i / 2 - 1) * decimate + decay];
+ OldauOut[L / 2 + i] = sign_left * ImdstOut[i] * win_int_left[(L_FRAME16k / 2 - i / 2 - 1)];
+ }
+
+
+ for (i = n; i < L / 2; i += 2)
+ {
+ OldauOut[i] = -ImdstOut[L / 2 - 1 - i] * win_left[(L_FRAME16k - i / 2) * decimate - decay - 1];
+ OldauOut[i + 1] = -ImdstOut[L / 2 - 1 - (i + 1)] * win_int_left[L_FRAME16k - (i / 2) - 1];
+ }
+ }
+ else
+ {
+ for (i = n; i < L / 2; i++)
+ {
+ paout[i] = sign_right * ImdstOut[L / 2 + i] * win_right[(2 * L - i) * decimate - 1 - decay - windecay48] + OldauOut[i];
+ }
+
+ for (i = 0; i < L / 2 - n; i++)
+ {
+ paout[L / 2 + i] = -ImdstOut[L - 1 - i] * win_right[(3 * L / 2 - 1 - i) * decimate + decay - windecay48] + OldauOut[i + L / 2];
+ }
+
+ for (i = L / 2 - n; i < L / 2; i++)
+ {
+ paout[L / 2 + i] = -ImdstOut[L - 1 - i] + OldauOut[i + L / 2];
+ }
+
+ for (i = 0; i < L / 2; i++)
+ {
+ OldauOut[L / 2 + i] = sign_left * ImdstOut[i] * win_left[(L / 2 - i - 1) * decimate + decay];
+ }
+
+
+ for (i = n; i < L / 2; i++)
+ {
+ OldauOut[i] = -ImdstOut[L / 2 - 1 - i] * win_left[(L - i) * decimate - decay - 1];
+ }
+ }
+
+ for (i = 0; i < n; i++)
+ {
+ OldauOut[i] = -ImdstOut[L / 2 - 1 - i];
+ }
+ for (i = 0; i < n; i++)
+ {
+ paout[L + i] = OldauOut[i];
+ }
+
+ return;
+}
+#endif
@@ -495,14 +624,14 @@ void window_ola_fx(
* overlapp ACELP and HQ
*---------------------------------------------------------------------*/
void core_switching_OLA_fx(
- Word16 *mem_over_hp, /* i : upsampling filter memory Qsubrf (except at 8kHz) */
- const Word16 last_L_frame, /* i : last L_frame lengthture */
- const Word32 output_Fs, /* i : output sampling rate */
- Word16 *synth, /* i/o: synthesized signal from HQ core Qsynth*/
- Word16 *synth_subfr_out, /* i : synthesized signal from ACELP core Qsubfr*/
- Word16 *synth_subfr_bwe, /* i : synthesized BWE from ACELP core Qbwe (todo) */
- const Word16 output_frame, /* i : output frame length */
- const Word16 bwidth, /* i : output bandwidth */
+ Word16 *mem_over_hp, /* i : upsampling filter memory Qsubrf (except at 8kHz) */
+ const Word16 last_L_frame, /* i : last L_frame lengthture */
+ const Word32 output_Fs, /* i : output sampling rate */
+ Word16 *synth, /* i/o: synthesized signal from HQ core Qsynth*/
+ Word16 *synth_subfr_out, /* i : synthesized signal from ACELP core Qsubfr*/
+ Word16 *synth_subfr_bwe, /* i : synthesized BWE from ACELP core Qbwe (todo) */
+ const Word16 output_frame, /* i : output frame length */
+ const Word16 bwidth, /* i : output bandwidth */
Word16* Qsynth,
Word16* Qsubfr
)
diff --git a/lib_com/wtda_fx.c b/lib_com/wtda_fx.c
index 8d4b5cc25db4079e481ae9c3e5c597052f7066d0..2936b7bb23d72f19c63c32ee8f106301017de2f8 100644
--- a/lib_com/wtda_fx.c
+++ b/lib_com/wtda_fx.c
@@ -1,24 +1,22 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
#include "rom_com_fx.h" /* Static table prototypes */
-#include "stl.h" /* required by wmc_tool */
-
#include "prot_fx.h" /* required by wmc_tool */
#include "stat_com.h"
-/*--------------------------------------------------------------------------*
- * wtda()
- *
- * Windowing and time-domain aliasing
- *--------------------------------------------------------------------------*/
+ /*--------------------------------------------------------------------------*
+ * mvr2r_inv()
+ *
+ *
+ *--------------------------------------------------------------------------*/
static void mvs2s_inv(
- const Word16 *in,
- Word16 *out,
- Word16 L,
- Word16 decimate
+ const Word16 *in, /* i : input vector */
+ Word16* out, /* o : output vector */
+ const Word16 L, /* i : length */
+ const Word16 decimate /* i : decimation flag [-1,1] */
)
{
Word16 i;
@@ -33,13 +31,16 @@ static void mvs2s_inv(
}
}
-
-
+/*--------------------------------------------------------------------------*
+ * mvr2r_dec()
+ *
+ *
+ *--------------------------------------------------------------------------*/
static void mvs2s_dec(
- const Word16 *in,
- Word16 *out,
- Word16 L,
- Word16 decimate
+ const Word16 *in, /* i : input vector */
+ Word16* out, /* o : output vector */
+ const Word16 L, /* i : length */
+ const Word16 decimate /* i : decimation flag [-1,1] */
)
{
Word16 i;
@@ -54,14 +55,20 @@ static void mvs2s_dec(
}
}
+/*--------------------------------------------------------------------------*
+ * copy_win()
+ *
+ *
+ *--------------------------------------------------------------------------*/
static void copy_win(
- Word16 *out_win,
- Word16 nb_zero,
- const Word16 *in_win,
- Word16 win_lenght,
- Word16 nb_one,
- Word16 decimate)
+ Word16 *out_win, /* o : output window buffer */
+ const Word16 nb_zero, /* i : length of zero padding */
+ const Word16* in_win, /* i : input window */
+ const Word16 win_lenght, /* i : length */
+ const Word16 nb_one, /* i : length of flat section (ones) */
+ const Word16 decimate /* i : input window */
+)
{
IF (decimate<0)
{
@@ -76,15 +83,20 @@ static void copy_win(
set16_fx(out_win+add(nb_zero,win_lenght),32767,nb_one);
}
}
+/*--------------------------------------------------------------------------*
+ * tcx_get_windows_mode1()
+ *
+ *
+ *--------------------------------------------------------------------------*/
void tcx_get_windows_mode1(
- Word16 left_mode, /* i: overlap mode of left window half */
- Word16 right_mode, /* i: overlap mode of right window half */
- Word16 *left_win, /* o: left overlap window */
- Word16 *right_win, /* o: right overlap window */
- Word16 *left_win_int, /* o: left overlap window */
- Word16 *right_win_int, /* o: right overlap window */
- Word16 const L
+ const Word16 left_mode, /* i: overlap mode of left window half */
+ const Word16 right_mode,/* i: overlap mode of right window half */
+ Word16 *left_win, /* o: left overlap window */
+ Word16 *right_win, /* o: right overlap window */
+ Word16 *left_win_int, /* o: left overlap window */
+ Word16 *right_win_int, /* o: right overlap window */
+ const Word16 L /* i : length */
)
{
/* Left part */
@@ -180,16 +192,21 @@ void tcx_get_windows_mode1(
}
}
+/*--------------------------------------------------------------------------*
+ * wtda()
+ *
+ * Windowing and time-domain aliasing
+ *--------------------------------------------------------------------------*/
void wtda_fx(
- Word16 *new_audio, /* i : input audio Q0 */
- Word16 *Q, /* i/o : Q of input/Output Audio */
- Word32 *wtda_audio, /* o : windowed audio Qout */
- Word16 *old_wtda, /* i/o: windowed audio from previous frame Qout */
+ Word16 *new_audio, /* i : input audio Q0 */
+ Word16 *Q, /* i/o : Q of input/Output Audio */
+ Word32 *wtda_audio, /* o : windowed audio Qout */
+ Word16 *old_wtda, /* i/o: windowed audio from previous frame Qout */
Word16 *Qold_wtda,
- Word16 left_mode,
- Word16 right_mode, /* window overlap of current frame (0: full, 2: none, or 3: half) */
- const Word16 L
+ const Word16 left_mode, /* i : window overlap of previous frame (0: full, 2: none, or 3: half) */
+ const Word16 right_mode, /* i : window overlap of current frame (0: full, 2: none, or 3: half) */
+ const Word16 L /* i : length */
)
{
Word16 i, decimate, decay, tmp;
@@ -392,50 +409,114 @@ void wtda_fx(
p4-=decimate;
/* wtda_audio[i+L/2]=allsig_l[i]*win_left[i*decimate+decay]-allsig_l[L-i-1]*win_left[L*decimate-i*decimate-1-decay];*/
}
+ }
+
+ *Q=add(*Q,15); /* output Q */
+ if (old_wtda != NULL)
+ {
+ Copy(new_audio,old_wtda,L);
- /* Windowing and foldin for the MDST */
- /* if (wtda_audio_dst != NULL)
- {
+ }
+ return;
+
+}
+#ifdef IVAS_CODE
+
+void wtda_ext(
+ const float* new_audio, /* i : input audio */
+ float* wtda_audio, /* o : windowed audio */
+ const int16_t left_mode, /* i : window overlap of previous frame (0: full, 2: none, or 3: half) */
+ const int16_t right_mode, /* i : window overlap of current frame (0: full, 2: none, or 3: half) */
+ const int16_t L, /* i : length */
+ const uint16_t kernel_type /* i : transform kernel type (0 - 3) */
+)
+{
+ const float sign_left = (kernel_type >= 2 ? -1.f : 1.f);
+ const float sign_right = (kernel_type & 1 ? 1.f : -1.f);
+ int16_t i, decimate, decay;
+ int16_t n, windecay48, windecay16;
+ const float* allsig_l, * allsig_r;
+ float win_right[R2_48];
+ float win_int_left[R1_16];
+ float win_left[R1_48];
+ float win_int_right[R2_16];
+
+ tcx_get_windows_mode1(left_mode, right_mode, win_left, win_right, win_int_left, win_int_right, L);
+
+ decimate = 1; /* L_FRAME 48k */
+ decay = 0;
+ windecay48 = (int16_t)(2 * ((float)L_FRAME48k * N_ZERO_MDCT_NS / FRAME_SIZE_NS)) + R1_48;
+
+ if (L == L_FRAME32k || L == L_FRAME16k)
+ {
+ decimate = 3;
+ decay = 1;
+ }
+ else if (L == L_FRAME8k)
+ {
+ decimate = 6;
+ decay = 2;
+ }
+ n = (int16_t)((float)L * N_ZERO_MDCT_NS / FRAME_SIZE_NS);
+ windecay16 = (int16_t)(2 * ((float)L_FRAME16k * N_ZERO_MDCT_NS / FRAME_SIZE_NS)) + R1_16;
+ allsig_r = new_audio + n;
+ allsig_l = new_audio + n - L;
- for (i=n;i
-#include
-#include
+#include
#include
#include "options.h"
-#include "stl.h"
#include "rom_com_fx.h"
#include "rom_dec_fx.h"
#include "basop_util.h"
-#include "stl.h"
#include "cnst_fx.h"
#include "prot_fx.h"
-/**
- * \brief Arithmetic decoder
- * \param[i/o] st
- * \param[o] x
- * \param[i] nt
- * \param[i] nbbits
- * \param[i] resQMaxBits
- * \return resQBits
- */
+/*-------------------------------------------------------------------*
+ * ACcontextMapping_decode2_no_mem_s17_LC()
+ *
+ * Arithmetic decoder
+ *-------------------------------------------------------------------*/
+
Word16 ACcontextMapping_decode2_no_mem_s17_LC(
Decoder_State_fx *st,/* i/o: decoder state */
Word16 *x, /* o: decoded spectrum */
@@ -226,7 +219,7 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC(
/*Dectect overflow*/
IF (add(sub(st->next_bit_pos_fx, start_bit_pos), rest_bits) > 0)
{
- /* Roll back bit-stream position to overflow_bit_pos */
+ /* Roll back bitstream position to overflow_bit_pos */
get_next_indice_tmp_fx(st, sub(overflow_bit_pos, st->next_bit_pos_fx));
rest_bits = rest_bits_overflow;
move16();
@@ -282,7 +275,7 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC(
IF (NE_16(k, lastnz))
{
rest_bits = add(rest_bits, nbbits_m2);
- /* Set bit-stream position to (start_bit_pos+nbbits-rest_bits) */
+ /* Set bitstream position to (start_bit_pos+nbbits-rest_bits) */
get_next_indice_tmp_fx(st, sub((sub(add(start_bit_pos, nbbits), rest_bits)), st->next_bit_pos_fx));
}
@@ -317,10 +310,372 @@ Word16 ACcontextMapping_decode2_no_mem_s17_LC(
move16();
}
- /* Set bit-stream pointer to end of buffer */
+ /* Set bitstream pointer to end of buffer */
get_next_indice_tmp_fx(st, sub(add(start_bit_pos, nbbits), st->next_bit_pos_fx));
+ return resQBits;
+}
+#ifdef IVAS_CONTEXT_MAPPING
+
+/*-------------------------------------------------------------------*
+ * RCcontextMapping_decode2_no_mem_s17_LCS()
+ *
+ * Range decoder
+ *-------------------------------------------------------------------*/
+
+ /*! r: resQBits */
+int16_t RCcontextMapping_decode2_no_mem_s17_LCS(
+ Decoder_State* st, /* i/o: decoder state */
+ int16_t* x, /* o : decoded spectrum */
+ const int16_t nt, /* i : size of spectrum */
+ const int16_t nbbits, /* i : bit budget */
+ const int16_t resQMaxBits, /* i : residual coding maximum bits */
+ CONTEXT_HM_CONFIG* hm_cfg /* i : context-based harmonic model configuration*/
+)
+{
+ RangeUniDecState rc_st_dec; /* State of the range decoder */
+ int16_t start_bit_pos, lsbs_bit_pos;
+ int16_t a, b, a1, b1, k;
+ uint16_t t;
+ int16_t lev, pki, esc_nb;
+ int16_t rateFlag;
+ int16_t lastnz, n;
+ uint16_t r;
+ int16_t resQBits;
+ int16_t rest_bits;
+ int16_t nt_half;
+ int16_t nbbits_m2;
+ int16_t bits_tups; /* No. of bits for coding the no. of tuples */
+
+ set_s(x, 0, nt);
+
+ /*Decode number of ntuples*/
+ start_bit_pos = st->next_bit_pos;
+ lsbs_bit_pos = start_bit_pos + nbbits - 1;
+ n = 0;
+ k = 1;
+ nt_half = nt >> 1;
+
+ while (k < nt_half)
+ {
+ ++n;
+ k = k << 1;
+ }
+
+ bits_tups = n;
+
+ n = get_next_indice(st, n) + 1;
+
+ t = 0;
+
+ lastnz = n << 1;
+
+ if (lastnz > nt)
+ {
+ st->BER_detect = 1;
+ return 0;
+ }
+
+ if (hm_cfg)
+ {
+ int16_t a1_i, b1_i;
+ int32_t c[2], * ctx;
+ int32_t p1, p2;
+ int16_t ii[2];
+ int16_t idx1, idx2, idx;
+ int16_t numPeakIndicesOrig, numHoleIndices;
+
+ /* Rate flag */
+ if (nbbits > 400)
+ {
+ rateFlag = 2 << NBITS_CONTEXT;
+ }
+ else
+ {
+ rateFlag = 0;
+ }
+
+ /* Init */
+ c[0] = c[1] = 0;
+
+ /* mapped domain */
+ numPeakIndicesOrig = hm_cfg->numPeakIndices;
+ hm_cfg->numPeakIndices = min(hm_cfg->numPeakIndices, lastnz);
+ numHoleIndices = lastnz - hm_cfg->numPeakIndices;
+
+ /* Mark hole indices beyond lastnz as pruned */
+ for (k = numHoleIndices; k < hm_cfg->numHoleIndices; ++k)
+ {
+ hm_cfg->holeIndices[k] = hm_cfg->holeIndices[k] + nt;
+ }
+
+ ii[0] = numPeakIndicesOrig;
+ ii[1] = 0;
+
+ p1 = p2 = 0; /* to avoid compilation warnings */
+
+ /* Start Decoding */
+ /* Initialize range decoder */
+ rc_uni_dec_init(&rc_st_dec, &st->bit_stream[st->next_bit_pos], nbbits); /* (nbbits + 30) entries are read by the decoder */
+
+ nbbits_m2 = nbbits;
+ rest_bits = -nbbits_m2;
+
+ /* Main Loop through the 2-tuples */
+ for (k = 0; k < lastnz; k += 2)
+ {
+ a1_i = get_next_coeff_mapped(ii, &p1, &idx1, hm_cfg);
+ b1_i = get_next_coeff_mapped(ii, &p2, &idx2, hm_cfg);
+ idx = min(idx1, idx2);
+
+ /* Get context */
+ ctx = &c[p1 | p2];
+
+ t = (uint16_t)(*ctx + rateFlag);
+ t += (nt_half >= idx) ? 0 : (1 << NBITS_CONTEXT);
+
+ esc_nb = 0;
+ r = 0;
+
+ /* BER detection: Check max value of context t leading to out-of-bound access to ari_lookup_s17_LC[]*/
+ if ((t >= (1 << (NBITS_CONTEXT + NBITS_RATEQ))) || lsbs_bit_pos <= 0)
+ {
+ st->BER_detect = 1;
+ return 0;
+ }
+
+ a = b = 0;
+
+ /* MSBs decoding */
+ for (lev = 0; lev < 15 && lsbs_bit_pos > 0; ++lev)
+ {
+ esc_nb = min(lev, 3);
+ pki = ari_lookup_s17_LC[t + (esc_nb << (NBITS_CONTEXT + NBITS_RATEQ))];
+ r = rc_uni_dec_read_symbol_fastS(&rc_st_dec, cum_freq_ari_pk_s17_LC_ext[pki], sym_freq_ari_pk_s17_LC_ext[pki], 17, 14); /*Alphabet size = 17 (2^4 = 16 MSB symbols + 1 ESC symbol) */
+ /* r is the symbol read, the possible values are {0,1,....alphabet_size - 1} */
+
+ if (r < VAL_ESC) /* If symbol read corresponds to MSB */
+ {
+ break;
+ }
+
+ /* LSBs decoding */
+ a += get_indice_1(st, lsbs_bit_pos--) << lev;
+ b += get_indice_1(st, lsbs_bit_pos--) << lev;
+ }
+
+ if ((lsbs_bit_pos < -1 && r >= VAL_ESC) || (lev > 14))
+ {
+ x[a1_i] = 0;
+ x[b1_i] = 0;
+ st->BER_detect = 1;
+ return 0;
+ }
+
+ /* MSBs contributions */
+ b1 = r >> 2;
+ a1 = r & 0x3;
+ a += a1 << lev;
+ b += b1 << lev;
+
+ /* Add 2 LSB bits per bit-plane */
+ rest_bits += 2 * lev;
+ /* Sign bits */
+ rest_bits += min(a, 1);
+ rest_bits += min(b, 1);
+
+ /* Update bitstream pointer */
+ st->next_bit_pos = start_bit_pos + bits_tups + rc_uni_dec_virtual_finish(&rc_st_dec);
+
+ /* Confirm that there is no overflow */
+#ifdef DEBUGGING
+ assert(st->next_bit_pos - start_bit_pos + rest_bits <= 0);
+#endif
+
+ /* Store decoded data */
+ x[a1_i] = a;
+ x[b1_i] = b;
+
+ /* Update context for next 2-tuple */
+ if (p1 == p2)
+ {
+ /* peak-peak or hole-hole context */
+ lev = esc_nb - 1;
+
+ if (lev <= 0)
+ {
+ t = 1 + (a1 + b1) * (lev + 2);
+ }
+ else
+ {
+ t = 13 + lev;
+ }
+
+ *ctx = (*ctx & 0xf) * 16 + t;
+ }
+ else
+ {
+ /* mixed context */
+
+ if (idx1 & 1)
+ {
+ /* update first context */
+ c[p1] = update_mixed_context(c[p1], a);
+ }
+
+ if (idx2 & 1)
+ {
+ /* update second context */
+ c[p2] = update_mixed_context(c[p2], b);
+ }
+ }
+ }
+
+ /* We don't need to finish because virtual_finish() already does the same */
+ /*st->next_bit_pos = rc_uni_dec_finish(&rc_st_dec);*/
+
+ /* Check for bitstream errors */
+ assert(rc_st_dec.bit_error_detected == 0);
+
+ /* Cross-check: No overflow */
+#ifdef DEBUGGING
+ assert(k == lastnz);
+#endif
+
+ /* Decode signs */
+ n = nt;
+ }
+ else /* if(!hm_cfg) */
+ {
+ int16_t c, rateQ;
+ uint16_t s;
+
+ /* Rate flag */
+ if (nbbits > 400)
+ {
+ rateFlag = 2;
+ }
+ else
+ {
+ rateFlag = 0;
+ }
+
+ /* Start Decoding */
+ /* Initialize range decoder */
+ rc_uni_dec_init(&rc_st_dec, &st->bit_stream[st->next_bit_pos], nbbits); /* (nbbits + 30) entries are read by the decoder */
+
+ nbbits_m2 = nbbits;
+ rest_bits = -nbbits_m2;
+
+ t = 0;
+ s = 0;
+
+ /* Main Loop through the 2-tuples */
+ for (k = 0; k < lastnz; k += 2)
+ {
+ rateQ = rateFlag + (k > (nt_half));
+
+ /* BER detection: Check max value of context t leading to out-of-bound access to ari_lookup_s17_LC[]*/
+ if ((t >= (1 << (NBITS_CONTEXT))) || lsbs_bit_pos <= 0)
+ {
+ st->BER_detect = 1;
+ return 0;
+ }
+
+ a = b = 0;
+ esc_nb = 0;
+ r = 0;
+
+ /* MSBs decoding */
+ for (lev = 0; lev < 15 && lsbs_bit_pos > 0; ++lev)
+ {
+ esc_nb = min(lev, 3);
+ pki = ari_lookup_s17_LC[t + ((rateQ) << NBITS_CONTEXT) + (esc_nb << (NBITS_CONTEXT + NBITS_RATEQ))];
+ r = rc_uni_dec_read_symbol_fastS(&rc_st_dec, cum_freq_ari_pk_s17_LC_ext[pki], sym_freq_ari_pk_s17_LC_ext[pki], 17, 14); /*Alphabet size = 17 (2^4 = 16 MSB symbols + 1 ESC symbol) */
+ /* r is the symbol read, the possible values are {0,1,....alphabet_size - 1} */
+
+ if (r < VAL_ESC) /* If symbol read corresponds to MSB */
+ {
+ break;
+ }
+
+ /* LSBs decoding */
+ a += get_indice_1(st, lsbs_bit_pos--) << lev;
+ b += get_indice_1(st, lsbs_bit_pos--) << lev;
+ }
+
+ if ((lsbs_bit_pos < -1 && r >= VAL_ESC) || (lev > 14))
+ {
+ x[k + 0] = 0;
+ x[k + 1] = 0;
+ st->BER_detect = 1;
+ return 0;
+ }
+
+ /* MSBs contributions */
+ b1 = r >> 2;
+ a1 = r & 0x3;
+ a += a1 << lev;
+ b += b1 << lev;
+
+ /* Add 2 LSB bits per bit-plane */
+ rest_bits += 2 * lev;
+ /* Sign bits */
+ rest_bits += min(a, 1);
+ rest_bits += min(b, 1);
+
+ /* Update bitstream pointer */
+ st->next_bit_pos = start_bit_pos + bits_tups + rc_uni_dec_virtual_finish(&rc_st_dec);
+
+ /* Confirm that there is no overflow */
+#ifdef DEBUGGING
+ assert(st->next_bit_pos - start_bit_pos + rest_bits <= 0);
+#endif
+
+ /* Store decoded data */
+ x[k + 0] = a;
+ x[k + 1] = b;
+
+ /* Update context for next 2-tuple */
+ if (esc_nb < 2)
+ {
+ c = 1 + ((a1 + b1) * (esc_nb + 1));
+ }
+ else
+ {
+ c = 12 + esc_nb;
+ }
+
+ s = s << 4; /*Shift old 4 bits*/
+ s = s + c; /*replace last 4 bits*/
+ t = s & 0xFF;
+ }
+
+ /* Decode signs */
+ n = lastnz;
+ } /* end of if(hm_cfg) */
+
+ for (k = 0; k < n; k++)
+ {
+ if (x[k] > 0)
+ {
+ x[k] *= 1 - 2 * get_next_indice_1(st);
+ }
+ }
+
+ /* Decode Residual Q */
+ resQBits = min(resQMaxBits, lsbs_bit_pos + 1 - st->next_bit_pos);
+
+ for (k = 0; k < resQBits; ++k)
+ {
+ x[nt + k] = get_indice_1(st, lsbs_bit_pos - k);
+ }
+
+ /* Set bitstream pointer to end of buffer */
+ get_next_indice_tmp(st, (start_bit_pos + nbbits) - st->next_bit_pos);
+
return resQBits;
}
+#endif
diff --git a/lib_dec/EvsRXlib.c b/lib_dec/EvsRXlib.c
index 4de16ccf8defae417436c0faf5ff15fde6a0e85d..e715ff9998147689ac67b7fba47eb9db79ad4841 100644
--- a/lib_dec/EvsRXlib.c
+++ b/lib_dec/EvsRXlib.c
@@ -335,7 +335,7 @@ EVS_RX_GetSamples(EVS_RX_HANDLE hEvsRX,
/* initialize, since this is needed within read_indices_from_djb_fx, to correctly set st->last_codec_mode */
st->ini_frame_fx = 0;
st->prev_use_partial_copy = 0;
- init_decoder_fx( st );
+ init_decoder_fx( st, EVS_MONO);
/* parse frame again because init_decoder() overwrites st->total_brate_fx */
read_indices_from_djb_fx( st, dataUnit->data, dataUnit->dataSize,
@@ -518,7 +518,7 @@ EVS_RX_Close(EVS_RX_HANDLE* phRX )
return EVS_RX_NO_ERROR;
}
- destroy_decoder( (*phRX)->st );
+ destroy_cldfb_decoder( (*phRX)->st );
IF( (*phRX)->hJBM )
{
diff --git a/lib_dec/FEC_HQ_core_fx.c b/lib_dec/FEC_HQ_core_fx.c
index 0645cc76da785d9480c4bbdcd99b9e11062973db..c632e9762db8d65f61cd3fc204561169f557a977 100644
--- a/lib_dec/FEC_HQ_core_fx.c
+++ b/lib_dec/FEC_HQ_core_fx.c
@@ -1,17 +1,29 @@
/*====================================================================================
EVS Codec 3GPP TS26.452 Aug 12, 2021. Version 16.3.0
====================================================================================*/
-
-#include
+#include
#include "options.h" /* Compilation switches */
#include "cnst_fx.h" /* Common constants */
-#include "prot_fx.h" /* Function prototypes */
-#include "stl.h"
-
-#include "prot_fx.h"
+#include "prot_fx.h" /* Function prototypes */
#include "rom_com_fx.h"
+/*---------------------------------------------------------------------*
+ * Local function prototypes
+ *---------------------------------------------------------------------*/
+
+static Word16 FEC_phase_matching_fx(HQ_NBFEC_HANDLE st_fx, Word32* ImdctOut_fx, Word16* auOut_fx, Word16* OldauOut_fx, Word16 OldauOut_pha_fx[2][N_LEAD_NB]);
+static void FEC_phase_matching_nextgood_fx(const Word32* ImdctOut_fx, Word16* auOut_fx, Word16* OldauOut_fx, Word16 OldauOut_pha_fx[2][N_LEAD_NB],Word16 mean_en_high_fx);
+static void FEC_phase_matching_burst_fx(const Word32* ImdctOut_fx, Word16* auOut_fx, Word16* OldauOut_fx, Word16 OldauOut_pha_fx[2][N_LEAD_NB], Word16* prev_oldauOut_fx );
+static void Repetition_smoothing_nextgood_fx(const Word32* ImdctOut_fx, Word16* auOut_fx, Word32* OldImdctOut_fx, Word16* OldauOut_fx, Word16 cur_data_use_flag, Word16 overlap_time);
+static Word16 Repetition_smoothing_fx(const Word32* ImdctOut_fx, Word16* auOut_fx, Word32* OldImdctOut_fx, Word16* OldauOut_fx, const Word16 L, Word16* prev_oldauOut_fx, Word16 overlap_time );
+static void Smoothing_vector_scaledown_NB_fx(const Word16 OldauOutnoWin_fx[], const Word16 ImdctOutWin_fx[], const Word16 SmoothingWin_fx[], Word16 auOut_fx[], const Word16 ol_size);
+static void Smoothing_vector_NB_fx(const Word16 OldauOutnoWin_fx[], const Word16 ImdctOutWin_fx[], const Word16 SmoothingWin_fx[], Word16 auOut_fx[], const Word16 ol_size);
+static void Windowing_1st_NB_fx(Word16* ImdctOutWin_fx, const Word32* ImdctOut_fx, const Word16* win_fx, const Word16* smoothingWin_fx, Word16 smoothing_flag );
+static void Windowing_2nd_NB_fx(Word16* ImdctOutWin_fx, const Word32* ImdctOut_fx, const Word16* win_fx );
+static void Scaledown_fx(Word16 x[], Word16 y[], Word16 scale_v,const Word16 N );
+static void Next_good_after_burst_erasures_fx(const Word32* ImdctOut_fx, Word16* auOut_fx,Word16* OldauOut_fx, const Word16 ol_size);
+static void common_overlapping_fx(Word16* auOut_fx, Word16* ImdctOutWin_fx, Word16* OldauOut_fx, Word16 end1, Word16 offset1, Word16 start2, Word16 end2, Word16 offset_i2, Word16 offset2);
/*--------------------------------------------------------------------------*
@@ -132,16 +144,20 @@ void HQ_FEC_processing_fx(
Word32 norm_p_fx[MAX_SB_NB];
Word32 *norm_values_fx, *r_p_fx;
Word16 energy_diff_fx;
+ HQ_NBFEC_HANDLE hHQ_nbfec;
+ HQ_DEC_HANDLE hHQ_core;
+ hHQ_nbfec = st_fx->hHQ_nbfec;
+ hHQ_core = st_fx->hHQ_core;
/* Decide the start frame number for adaptive muting */
/* Normalized energy difference between the current frame and the moving average */
- tmp_fx = abs_s(sub(st_fx->energy_MA_Curr_fx[1], st_fx->energy_MA_Curr_fx[0]));
+ tmp_fx = abs_s(sub(hHQ_nbfec->energy_MA_Curr_fx[1], hHQ_nbfec->energy_MA_Curr_fx[0]));
exp1 = sub(norm_s(tmp_fx), 1);
- st_fx->energy_MA_Curr_fx[0] = s_max(st_fx->energy_MA_Curr_fx[0],1);
+ hHQ_nbfec->energy_MA_Curr_fx[0] = s_max(hHQ_nbfec->energy_MA_Curr_fx[0],1);
move16();
- exp2 = norm_s(st_fx->energy_MA_Curr_fx[0]);
- tmp_fx = div_s(shl(tmp_fx, exp1), shl(st_fx->energy_MA_Curr_fx[0], exp2));/*15 + exp1 - exp2*/
+ exp2 = norm_s(hHQ_nbfec->energy_MA_Curr_fx[0]);
+ tmp_fx = div_s(shl(tmp_fx, exp1), shl(hHQ_nbfec->energy_MA_Curr_fx[0], exp2));/*15 + exp1 - exp2*/
energy_diff_fx = shl(tmp_fx, sub(sub(exp2, exp1), 5));/*10*/
test();
IF ((LT_16(energy_diff_fx, 1024))&&(is_transient==0)) /* First erasure frame */
@@ -170,7 +186,7 @@ void HQ_FEC_processing_fx(
{
FOR (i=0; i < output_frame; i++)
{
- t_audio_q_fx[i] = st_fx->old_coeffs_fx[i];
+ t_audio_q_fx[i] = hHQ_nbfec->old_coeffs_fx[i];
move32();
}
}
@@ -178,20 +194,20 @@ void HQ_FEC_processing_fx(
{
FOR (i=0; i < output_frame; i++)
{
- st_fx->old_coeffs_fx[i] = Mult_32_16(st_fx->old_coeffs_fx[i], 23170);/*23170, 3dB, Q15*/
- t_audio_q_fx[i] = st_fx->old_coeffs_fx[i];
+ hHQ_nbfec->old_coeffs_fx[i] = Mult_32_16(hHQ_nbfec->old_coeffs_fx[i], 23170);/*23170, 3dB, Q15*/
+ t_audio_q_fx[i] = hHQ_nbfec->old_coeffs_fx[i];
move32();
}
}
/* Sign prediction in 4-dim bands up to 1.6 kHz*/
- IF (st_fx->old_is_transient_fx[1] == 0)
+ IF (hHQ_core->old_is_transient_fx[1] == 0)
{
- IF (st_fx->old_is_transient_fx[2] == 0)
+ IF (hHQ_core->old_is_transient_fx[2] == 0)
{
FOR (sfm = 0; sfm < HQ_FEC_SIGN_SFM; sfm++)
{
- IF (GE_16(st_fx->prev_sign_switch_fx[sfm], HQ_FEC_SIGN_THRES))
+ IF (GE_16(hHQ_nbfec->prev_sign_switch_fx[sfm], HQ_FEC_SIGN_THRES))
{
FOR (i = 0; i < HQ_FEC_BAND_SIZE; i++)
{
@@ -205,7 +221,7 @@ void HQ_FEC_processing_fx(
{
FOR (sfm = 0; sfm < HQ_FEC_SIGN_SFM; sfm++)
{
- IF (GE_16(st_fx->prev_sign_switch_fx[sfm], HQ_FEC_SIGN_THRES_TRANS))
+ IF (GE_16(hHQ_nbfec->prev_sign_switch_fx[sfm], HQ_FEC_SIGN_THRES_TRANS))
{
FOR (i = 0; i < HQ_FEC_BAND_SIZE; i++)
{
@@ -220,7 +236,7 @@ void HQ_FEC_processing_fx(
{
FOR (i = RANDOM_START*8; i < output_frame; i++)
{
- IF(Random(&st_fx->HQ_FEC_seed_fx) < 0)
+ IF(Random(&hHQ_nbfec->HQ_FEC_seed_fx) < 0)
{
t_audio_q_fx[i] = L_negate(t_audio_q_fx[i]);
move32();
@@ -230,12 +246,12 @@ void HQ_FEC_processing_fx(
}
ELSE
{
- IF( st_fx->old_is_transient_fx[1] ) /* hangover */
+ IF(hHQ_core->old_is_transient_fx[1] ) /* hangover */
{
FOR (i=0; i < output_frame; i++)
{
- st_fx->old_coeffs_fx[i] = Mult_32_16(st_fx->old_coeffs_fx[i], 23170);
- t_audio_q_fx[i] = st_fx->old_coeffs_fx[i];
+ hHQ_nbfec->old_coeffs_fx[i] = Mult_32_16(hHQ_nbfec->old_coeffs_fx[i], 23170);
+ t_audio_q_fx[i] = hHQ_nbfec->old_coeffs_fx[i];
move32();
}
}
@@ -243,22 +259,22 @@ void HQ_FEC_processing_fx(
{
FOR (i = 0; i < RANDOM_START*8; i++)
{
- st_fx->old_coeffs_fx[i] = Mult_32_16(st_fx->old_coeffs_fx[i], 23170);
- t_audio_q_fx[i] = st_fx->old_coeffs_fx[i];
+ hHQ_nbfec->old_coeffs_fx[i] = Mult_32_16(hHQ_nbfec->old_coeffs_fx[i], 23170);
+ t_audio_q_fx[i] = hHQ_nbfec->old_coeffs_fx[i];
move32();
}
FOR (i = RANDOM_START*8; i < output_frame; i++)
{
- st_fx->old_coeffs_fx[i] = Mult_32_16(st_fx->old_coeffs_fx[i], 23170);
- IF (Random(&st_fx->HQ_FEC_seed_fx) < 0)
+ hHQ_nbfec->old_coeffs_fx[i] = Mult_32_16(hHQ_nbfec->old_coeffs_fx[i], 23170);
+ IF (Random(&hHQ_nbfec->HQ_FEC_seed_fx) < 0)
{
- t_audio_q_fx[i] = L_negate(st_fx->old_coeffs_fx[i]);
+ t_audio_q_fx[i] = L_negate(hHQ_nbfec->old_coeffs_fx[i]);
move32();
}
ELSE
{
- t_audio_q_fx[i] = st_fx->old_coeffs_fx[i];
+ t_audio_q_fx[i] = hHQ_nbfec->old_coeffs_fx[i];
move32();
}
}
@@ -298,7 +314,7 @@ void HQ_FEC_processing_fx(
/* Scaling */
FOR ( i=0; i < output_frame; i++ )
{
- st_fx->old_coeffs_fx[i] = Mult_32_16(st_fx->old_coeffs_fx[i], 23170);
+ hHQ_nbfec->old_coeffs_fx[i] = Mult_32_16(hHQ_nbfec->old_coeffs_fx[i], 23170);
move32();
}
}
@@ -339,7 +355,7 @@ void HQ_FEC_processing_fx(
FOR ( j=0; jNorm_gain_fx[k++] = shl(tmp_fx, 1);
+ hHQ_nbfec->Norm_gain_fx[k++] = shl(tmp_fx, 1);
move16();
}
}
@@ -348,7 +364,7 @@ void HQ_FEC_processing_fx(
/* Scale down the last gain with the fixed gain(-3dB) */
FOR (j=0; jNorm_gain_fx[k] = mult_r(st_fx->Norm_gain_fx[k], 23170);
+ hHQ_nbfec->Norm_gain_fx[k] = mult_r(hHQ_nbfec->Norm_gain_fx[k], 23170);
move16();
k++;
}
@@ -356,7 +372,7 @@ void HQ_FEC_processing_fx(
}
/* Scaling for core band */
- FEC_scaling_fx( st_fx->old_coeffs_fx, t_audio_q_fx, st_fx->Norm_gain_fx, &st_fx->HQ_FEC_seed_fx, nb_sfm, sfm_start, sfm_end );
+ FEC_scaling_fx(hHQ_nbfec->old_coeffs_fx, t_audio_q_fx, hHQ_nbfec->Norm_gain_fx, &hHQ_nbfec->HQ_FEC_seed_fx, nb_sfm, sfm_start, sfm_end );
}
@@ -391,41 +407,49 @@ void HQ_FEC_Mem_update_fx(
Word32* norm_values_fx;
Word32 L_tmp, tmp_energy_fx = 0, Max_coeff_fx;
Word32 en_high_fx[MAX_SB_NB];
-
-
- IF (is_transient)
- {
- set16_fx(st_fx->prev_sign_switch_2_fx, 0, HQ_FEC_SIGN_SFM);
- set16_fx(st_fx->prev_sign_switch_fx, 0, HQ_FEC_SIGN_SFM);
- }
- ELSE
+ HQ_NBFEC_HANDLE hHQ_nbfec;
+ HQ_DEC_HANDLE hHQ_core;
+ hHQ_nbfec = st_fx->hHQ_nbfec;
+ hHQ_core = st_fx->hHQ_core;
+#ifdef ADD_IVAS_HQ_CODE_FEC
+ IF(EQ_16(output_frame, L_FRAME8k))
{
- FOR (j = 0; j < HQ_FEC_SIGN_SFM; j++)
- {
- st_fx->prev_sign_switch_fx[j] = st_fx->prev_sign_switch_2_fx[j];
- move16();
- st_fx->prev_sign_switch_2_fx[j] = 0;
- move16();
+#endif
- FOR (i = 0; i < HQ_FEC_BAND_SIZE; i++)
+ IF (is_transient)
+ {
+ set16_fx(hHQ_nbfec->prev_sign_switch_2_fx, 0, HQ_FEC_SIGN_SFM);
+ set16_fx(hHQ_nbfec->prev_sign_switch_fx, 0, HQ_FEC_SIGN_SFM);
+ }
+ ELSE
+ {
+ FOR (j = 0; j < HQ_FEC_SIGN_SFM; j++)
{
- test();
- test();
- test();
- IF ((st_fx->old_coeffs_fx[i+j*HQ_FEC_BAND_SIZE]>0 && t_audio_q_fx[i+j*HQ_FEC_BAND_SIZE]<0)
- || (st_fx->old_coeffs_fx[i+j*HQ_FEC_BAND_SIZE]<0 && t_audio_q_fx[i+j*HQ_FEC_BAND_SIZE]>0))
+ hHQ_nbfec->prev_sign_switch_fx[j] = hHQ_nbfec->prev_sign_switch_2_fx[j];
+ move16();
+ hHQ_nbfec->prev_sign_switch_2_fx[j] = 0;
+ move16();
+
+ FOR (i = 0; i < HQ_FEC_BAND_SIZE; i++)
{
- st_fx->prev_sign_switch_fx[j] = add(st_fx->prev_sign_switch_fx[j], 1);
- move16();
- st_fx->prev_sign_switch_2_fx[j] = add(st_fx->prev_sign_switch_2_fx[j], 1);
- move16();
+ test();
+ test();
+ test();
+ IF ((hHQ_nbfec->old_coeffs_fx[i+j*HQ_FEC_BAND_SIZE]>0 && t_audio_q_fx[i+j*HQ_FEC_BAND_SIZE]<0)
+ || (hHQ_nbfec->old_coeffs_fx[i+j*HQ_FEC_BAND_SIZE]<0 && t_audio_q_fx[i+j*HQ_FEC_BAND_SIZE]>0))
+ {
+ hHQ_nbfec->prev_sign_switch_fx[j] = add(hHQ_nbfec->prev_sign_switch_fx[j], 1);
+ move16();
+ hHQ_nbfec->prev_sign_switch_2_fx[j] = add(hHQ_nbfec->prev_sign_switch_2_fx[j], 1);
+ move16();
+ }
}
}
}
- }
-
+#ifndef ADD_IVAS_HQ_CODE_FEC
IF(EQ_16(output_frame, L_FRAME8k))
{
+#endif
/* if LR MDCT core is used, recalculate norms from decoded MDCT spectrum (using code from hq_hr_enc_fx()) */
test();
IF ( ( EQ_16(hqswb_clas, HQ_HVQ))||(EQ_16(hq_core_type,LOW_RATE_HQ_CORE)))
@@ -463,7 +487,7 @@ void HQ_FEC_Mem_update_fx(
move16();
FOR (i=0; iynrm_values_fx[i][0];
+ norm_values_fx = &hHQ_nbfec->ynrm_values_fx[i][0];
Copy32(norm_values_fx, &norm_values_fx[1], MAX_PGF-1);
L_tmp = L_deposit_l(0);
@@ -483,31 +507,31 @@ void HQ_FEC_Mem_update_fx(
{
FOR (j=1; j