From 16864af47a5dee73d2c92ecdda3ec8655e61933b Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 8 Nov 2024 18:41:21 +0530 Subject: [PATCH] Encoder float struct emnts cleanup, Q-info addition and LTV crash fix --- lib_com/basop_util.c | 4 +- lib_com/lpc_tools_fx.c | 2 +- lib_com/prot.h | 6 +- lib_com/prot_fx.h | 93 +- lib_com/reordvct_fx.c | 2 +- lib_com/residu.c | 8 +- lib_com/residu_fx.c | 8 +- lib_com/rom_basic_math.c | 16 +- lib_com/rom_basic_math.h | 16 +- lib_com/rom_basop_util.c | 77 +- lib_com/rom_basop_util.h | 6 +- lib_com/rom_com.c | 1709 +++++++++++++------------- lib_com/rom_com.h | 2091 ++++++++++++++++---------------- lib_com/rom_com_fx.c | 20 +- lib_com/rom_com_fx.h | 114 +- lib_com/scale_mem_fx.c | 26 +- lib_com/stab_est_fx.c | 10 +- lib_com/stat_com.h | 474 ++++---- lib_com/stat_noise_uv_mod_fx.c | 30 +- lib_enc/core_enc_switch.c | 1 - lib_enc/core_switching_enc.c | 17 +- lib_enc/ivas_core_enc.c | 48 +- lib_enc/ivas_masa_enc.c | 2 +- lib_enc/ivas_omasa_enc.c | 4 +- lib_enc/stat_enc.h | 57 +- lib_enc/swb_pre_proc.c | 28 +- lib_enc/swb_tbe_enc.c | 24 +- lib_enc/swb_tbe_enc_fx.c | 6 +- 28 files changed, 2469 insertions(+), 2430 deletions(-) diff --git a/lib_com/basop_util.c b/lib_com/basop_util.c index 1a2ef14f8..c465428fc 100644 --- a/lib_com/basop_util.c +++ b/lib_com/basop_util.c @@ -49,8 +49,8 @@ #define WMC_TOOL_SKIP -extern const Word32 SqrtTable[32]; -extern const Word16 SqrtDiffTable[32]; +extern const Word32 SqrtTable[32]; // Q31 +extern const Word16 SqrtDiffTable[32]; /* Q15 */ extern const Word32 ISqrtTable[32]; extern const Word16 ISqrtDiffTable[32]; diff --git a/lib_com/lpc_tools_fx.c b/lib_com/lpc_tools_fx.c index bec794e31..b1bbbae7b 100644 --- a/lib_com/lpc_tools_fx.c +++ b/lib_com/lpc_tools_fx.c @@ -1281,7 +1281,7 @@ Word32 E_LPC_schur( Word32 r[] /*Qr*/, Word16 reflCoeff[] /*Q15*/, Word32 epsP[] } -extern const PWord16 *w_a[7]; +extern const PWord16 *w_a[7]; // Q15 extern const PWord16 w19N[127]; extern const PWord16 w18N[127]; extern void BASOP_getTables( const PWord16 **ptwiddle, const PWord16 **sin_twiddle, Word16 *psin_step, Word16 length ); diff --git a/lib_com/prot.h b/lib_com/prot.h index 444817758..dc328e5d4 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -1153,11 +1153,11 @@ void residu( #ifdef IVAS_FLOAT_FIXED void residu_ivas_fx( - const Word16 *a, /* i : LP filter coefficients */ + const Word16 *a, /* i : LP filter coefficients Q31-a_exp*/ const Word16 a_exp, const Word16 m, /* i : order of LP filter */ - const Word32 *x, /* i : input signal (usually speech) */ - Word32 *y, /* o : output signal (usually residual) */ + const Word32 *x, /* i : input signal (usually speech) Qx*/ + Word32 *y, /* o : output signal (usually residual) Qx*/ const Word16 l /* i : size of filtering */ ); #endif diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 66e80a6b3..1ac9d84c0 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -1336,16 +1336,16 @@ scale_mem_fx.c /========================================================================================================*/ Word16 Rescale_exc( - Word16 dct_post_old_exc_fx[], /* i/o: Music post processing memory */ + Word16 dct_post_old_exc_fx[], /* i/o: Music post processing memory Q_exc*/ Word16 exc[], /* i/o: excitation to rescale Q_exc */ - Word16 bwe_exc[], - Word16 *last_exc_dct_in, - Word16 lg, /* i : frame size */ + Word16 bwe_exc[], /* Q_exc */ + Word16 *last_exc_dct_in, /* Q_exc */ + Word16 lg, /* i : frame size */ Word16 lg32, Word32 L_gain_code, /* i : decoded codebook gain Q16 */ Word16 *sQ_exc, /* i/o: Excitation scaling factor */ Word16 *sQsubfr, /* i/o: Past excitation scaling factors */ - Word16 exc2[], /* o : local excitation vector */ + Word16 exc2[], /* o : local excitation vector Q_exc */ Word16 i_subfr, /* i : subframe number */ const Word16 coder_type ); @@ -1353,14 +1353,14 @@ void Rescale_mem( const Word16 Q_exc, /* i : current excitation scaling (>=0) */ Word16 *prev_Q_syn, /* i/o : scaling factor of previous frame */ Word16 *Q_syn, /* i/o : scaling factor of frame */ - Word16 *mem_syn2, /* i/o : modified synthesis memory */ - Word16 *mem_syn_clas_estim_fx, /* i/o : old 12k8 core memory for classification */ + Word16 *mem_syn2, /* i/o : modified synthesis memory Qexp_scale */ + Word16 *mem_syn_clas_estim_fx, /* i/o : old 12k8 core memory for classification Qexp_scale*/ const Word16 MaxScaling, /* i: Minimal difference between excitation scaling and synthesis scaling */ - Word16 *mem_deemph, /* i/o: speech deemph filter memory */ - Word16 *pst_old_syn, /* i/o: psfiler */ - Word16 *pst_mem_deemp_err, /* i/o: psfiler */ - Word16 *mem_agc, - PFSTAT_HANDLE hPFstat, /* i/o: All memories related to NB post filter */ + Word16 *mem_deemph, /* i/o: speech deemph filter memory Qexp_scale */ + Word16 *pst_old_syn, /* i/o: psfiler Qexp_scale*/ + Word16 *pst_mem_deemp_err, /* i/o: psfiler Qexp_scale */ + Word16 *mem_agc, /*Qexp_scale*/ + 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 */ @@ -2192,7 +2192,7 @@ Word32 hq2_bit_alloc_fx( ); void reordvct_fx( - Word16 *y, /* i/o: vector to rearrange */ + Word16 *y, /* i/o: vector to rearrange Q0*/ const Word16 N, /* i : dimensions */ Word16 *idx /* o : reordered vector index */ ); @@ -2477,9 +2477,9 @@ void Residu3_fx( void calc_residu_fx( Encoder_State *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 *speech, /* i : weighted speech signal Qx*/ + Word16 *res, /* o : residual signal Qx+1*/ + const Word16 *p_Aq /* i : quantized LP filter coefficients Q12*/ ); // inerpol_lc.c Word32 Interpol_lc_fx( /* o : interpolated value Q15 */ @@ -5482,12 +5482,12 @@ void bitallocsum_fx( // stab_est_fx.c 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 etot, /* i : Total energy of the current frame Q8*/ + Word16 *lt_diff_etot, /* i/o : Long term total energy variation Q8*/ + Word16 *mem_etot, /* i/o : Total energy memory Q8*/ 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 *thresh, /* i/o : Detection thresold Q11*/ Word16 *last_music_flag, /* i/o : Previous music detection ouptut */ const Word16 vad_flag /* i : VAD flag */ ); @@ -8361,26 +8361,26 @@ void stat_noise_uv_dec_fx( // stat_noise_uv_mod_fx.c void stat_noise_uv_mod_fx( - 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 */ - Word16 *Aq, /* o : A(z) quantized for the 4 subframes */ - Word16 *exc2, /* i/o: excitation buffer */ + const Word16 coder_type, /* i : Coder type */ + Word16 noisiness, /* i : noisiness parameter Q0 */ + const Word16 *lsp_old, /* i : old LSP vector at 4th sfr Q15 */ + const Word16 *lsp_new, /* i : LSP vector at 4th sfr Q15 */ + const Word16 *lsp_mid, /* i : LSP vector at 2nd sfr Q15 */ + Word16 *Aq, /* o : A(z) quantized for the 4 subframes Q12 */ + Word16 *exc2, /* i/o: excitation buffer Q_exc */ Word16 Q_exc, /* i : Q of exc2 excitation buffer [11..-1] expected */ - 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 */ - Word16 lspold_s[], /* i/o: old LSP */ - 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 : i bandwidth */ - Word16 *Q_stat_noise, /* i/o: noise scaling */ - Word16 *Q_stat_noise_ge /* i/o: noise scaling */ + const Word16 bfi, /* i : Bad frame indicator */ + Word32 *ge_sm, /* i/o: smoothed excitation gain Q_ge */ + Word16 *uv_count, /* i/o: unvoiced counter */ + Word16 *act_count, /* i/o: activation counter */ + Word16 lspold_s[], /* i/o: old LSP Q15 */ + Word16 *noimix_seed, /* i/o: mixture seed Q0 */ + Word16 *st_min_alpha, /* i/o: minimum alpha Q15 */ + Word16 *exc_pe, /* i/o: scale Q_stat_noise Q_stat_noise */ + 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 */ ); void stat_noise_uv_mod_ivas_fx( @@ -8393,11 +8393,11 @@ void stat_noise_uv_mod_ivas_fx( Word16 *exc2, /* i/o: excitation buffer Q=Q_exc*/ Word16 Q_exc, /* i : Q of exc2 excitation buffer [11..-1] expected */ const Word16 bfi, /* i : Bad frame indicator */ - Word32 *ge_sm, /* i/o: smoothed excitation gain Q=Q_stat_noise_ge (6) */ + Word32 *ge_sm, /* i/o: smoothed excitation gain Q=Q_stat_noise_ge (6)*/ Word16 *uv_count, /* i/o: unvoiced counter */ Word16 *act_count, /* i/o: activation counter */ Word16 lspold_s[], /* i/o: old LSP Q=15*/ - Word16 *noimix_seed, /* i/o: mixture seed */ + Word16 *noimix_seed, /* i/o: mixture seed Q0 */ Word16 *st_min_alpha, /* i/o: minimum alpha Q=15*/ Word16 *exc_pe, /* i/o: scale Q_stat_noise Q=Q_stat_noise*/ const Word32 bitrate, /* i : core bitrate */ @@ -10716,12 +10716,11 @@ void Copy_Scale_sig32( ); void swb_pre_proc_ivas_fx( - Encoder_State *st, /* i/o: encoder state structure */ - Word16 *new_swb_speech, /* o : original input signal at 32kHz - Q0 */ - Word32 *new_swb_speech_fx, /* o : original input signal at 32kHz - Q - q_reImBuffer */ - Word16 *shb_speech, /* o : SHB target signal (6-14kHz) at 16kHz- Q0 */ - Word32 *shb_speech_32, /* o : SHB target signal (6-14kHz) at 16kHz- Q - q_reImBuffer */ - Word16 *use_shb32, /* o : flags valid data in 32-bit shb buffer for better precision. */ + Encoder_State *st, /* i/o: encoder state structure */ + Word16 *new_swb_speech, /* o : original input signal at 32kHz - Q0 */ + Word32 *new_swb_speech_fx, /* o : original input signal at 32kHz - Q - q_reImBuffer */ + Word16 *shb_speech, /* o : SHB target signal (6-14kHz) at 16kHz- Q(Q_shb_spch) */ + Word16 *Q_shb_spch, Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : real buffer Q - q_reImbuffer */ Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : imag buffer Q - q_reImbuffer */ Word16 q_reImBuffer, /* i : scale data of real and imag CLDFB buffers */ diff --git a/lib_com/reordvct_fx.c b/lib_com/reordvct_fx.c index 07bc21bc8..3b741203a 100644 --- a/lib_com/reordvct_fx.c +++ b/lib_com/reordvct_fx.c @@ -42,7 +42,7 @@ *--------------------------------------------------------------------------*/ void reordvct_fx( - Word16 *y, /* i/o: vector to rearrange */ + Word16 *y, /* i/o: vector to rearrange Q0*/ const Word16 N, /* i : dimensions */ Word16 *idx /* o : reordered vector index */ ) diff --git a/lib_com/residu.c b/lib_com/residu.c index e05210598..28574a072 100644 --- a/lib_com/residu.c +++ b/lib_com/residu.c @@ -79,11 +79,11 @@ void residu( #ifdef IVAS_FLOAT_FIXED void residu_ivas_fx( - const Word16 *a, /* i : LP filter coefficients */ + const Word16 *a, /* i : LP filter coefficients Q31-a_exp*/ const Word16 a_exp, const Word16 m, /* i : order of LP filter */ - const Word32 *x, /* i : input signal (usually speech) */ - Word32 *y, /* o : output signal (usually residual) */ + const Word32 *x, /* i : input signal (usually speech) Qx*/ + Word32 *y, /* o : output signal (usually residual) Qx*/ const Word16 l /* i : size of filtering */ ) { @@ -96,7 +96,7 @@ void residu_ivas_fx( move32(); FOR( j = 1; j <= m; j++ ) { - s = L_add( s, L_shl( Mpy_32_16_1( x[sub( i, j )], a[j] ), sub( Q15, a_exp ) ) ); + s = L_add( s, L_shl( Mpy_32_16_1( x[i - j], a[j] ), sub( Q15, a_exp ) ) ); // Qx } y[i] = s; move32(); diff --git a/lib_com/residu_fx.c b/lib_com/residu_fx.c index e06ef40ea..c2e6d43a6 100644 --- a/lib_com/residu_fx.c +++ b/lib_com/residu_fx.c @@ -29,6 +29,7 @@ void Residu3_lc_fx( Word16 q; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move16(); #endif q = add( norm_s( a[0] ), 1 ); @@ -151,6 +152,7 @@ void Residu3_fx( Word16 q; #ifdef BASOP_NOGLOB_DECLARE_LOCAL Flag Overflow = 0; + move16(); #endif q = add( norm_s( a[0] ), 1 ); if ( shift != 0 ) @@ -195,9 +197,9 @@ void Residu3_fx( void calc_residu_fx( Encoder_State *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 *speech, /* i : weighted speech signal Qx*/ + Word16 *res, /* o : residual signal Qx+1*/ + const Word16 *p_Aq /* i : quantized LP filter coefficients Q12*/ ) { Word16 i_subfr; diff --git a/lib_com/rom_basic_math.c b/lib_com/rom_basic_math.c index 07535d524..589935254 100644 --- a/lib_com/rom_basic_math.c +++ b/lib_com/rom_basic_math.c @@ -2,7 +2,7 @@ #include "cnst.h" /* Decoder static structure */ #include "stl.h" /* math_op.c */ -const Word32 L_table_isqrt[48] = { +const Word32 L_table_isqrt[48] = { // Q31 2147418112L, 2083389440L, 2024669184L, 1970667520L, 1920794624L, 1874460672L, 1831403520L, 1791098880L, 1753415680L, 1717960704L, 1684602880L, 1653145600L, @@ -18,7 +18,7 @@ const Word32 L_table_isqrt[48] = { }; /* table of table_isqrt[i] - table_isqrt[i+1] */ -const Word16 table_isqrt_diff[48] = { +const Word16 table_isqrt_diff[48] = { // Q15 977, 896, 824, 761, 707, 657, 615, 575, 541, 509, 480, 455, 431, 409, 389, 371, 353, 338, 324, 310, 297, 285, 275, 264, @@ -29,7 +29,7 @@ const Word16 table_isqrt_diff[48] = { const Word16 shift_Isqrt_lc[] = { 9, 10 }; -const Word16 table_pow2[32] = { +const Word16 table_pow2[32] = { // Q15 16384, 16743, 17109, 17484, 17867, 18258, 18658, 19066, 19484, 19911, 20347, 20792, 21247, 21713, 22188, 22674, 23170, 23678, 24196, 24726, 25268, 25821, 26386, 26964, 27554, 28158, 28774, 29405, 30048, 30706, @@ -37,14 +37,14 @@ const Word16 table_pow2[32] = { }; /* table of table_pow2[i+1] - table_pow2[i] */ -const Word16 table_pow2_diff_x32[32] = { +const Word16 table_pow2_diff_x32[32] = { // Q15 11488, 11712, 12000, 12256, 12512, 12800, 13056, 13376, 13664, 13952, 14240, 14560, 14912, 15200, 15552, 15872, 16256, 16576, 16960, 17344, 17696, 18080, 18496, 18880, 19328, 19712, 20192, 20576, 21056, 21536, 21984, 22432 }; -const Word16 sqrt_table[49] = { +const Word16 sqrt_table[49] = { // Q15 16384, 16888, 17378, 17854, 18318, 18770, 19212, 19644, 20066, 20480, 20886, 21283, 21674, 22058, 22435, 22806, 23170, 23530, 23884, 24232, 24576, @@ -55,7 +55,7 @@ const Word16 sqrt_table[49] = { }; /* log2.c */ -const Word32 L_table_Log2_norm_lc[32] = { +const Word32 L_table_Log2_norm_lc[32] = { // Q31 -32768L, 95322112L, 187793408L, 277577728L, 364871680L, 449740800L, 532381696L, 612859904L, 691306496L, 767787008L, 842432512L, 915308544L, @@ -66,14 +66,14 @@ const Word32 L_table_Log2_norm_lc[32] = { 1947435008L, 1998618624L, 2049015808L, 2098626560L }; -const Word16 table_diff_Log2_norm_lc[32] = { +const Word16 table_diff_Log2_norm_lc[32] = { // Q15 1455, 1411, 1370, 1332, 1295, 1261, 1228, 1197, 1167, 1139, 1112, 1087, 1063, 1039, 1016, 995, 975, 955, 936, 918, 901, 883, 868, 852, 836, 822, 809, 794, 781, 769, 757, 744 }; -const Word16 log2_tab[33] = { +const Word16 log2_tab[33] = { // Q15 0x7800, 0x782D, 0x785A, 0x7884, 0x78AE, 0x78D6, 0x78FE, 0x7924, 0x794A, 0x796E, 0x7992, 0x79B4, 0x79D6, 0x79F8, 0x7A18, 0x7A38, 0x7A57, 0x7A75, 0x7A93, 0x7AB1, 0x7ACD, 0x7AE9, 0x7B05, 0x7B20, diff --git a/lib_com/rom_basic_math.h b/lib_com/rom_basic_math.h index 93f9a825c..0f4826d0c 100644 --- a/lib_com/rom_basic_math.h +++ b/lib_com/rom_basic_math.h @@ -3,23 +3,23 @@ #include "stl.h" /* math_op.c */ -extern const Word32 L_table_isqrt[48]; +extern const Word32 L_table_isqrt[48]; // Q31 /* table of table_isqrt[i] - table_isqrt[i+1] */ -extern const Word16 table_isqrt_diff[48]; +extern const Word16 table_isqrt_diff[48]; // Q15 extern const Word16 shift_Isqrt_lc[]; -extern const Word16 table_pow2[32]; +extern const Word16 table_pow2[32]; // Q15 /* table of table_pow2[i+1] - table_pow2[i] */ -extern const Word16 table_pow2_diff_x32[32]; +extern const Word16 table_pow2_diff_x32[32]; // Q15 -extern const Word16 sqrt_table[49]; +extern const Word16 sqrt_table[49]; // Q15 /* log2.c */ -extern const Word32 L_table_Log2_norm_lc[32]; +extern const Word32 L_table_Log2_norm_lc[32]; // Q31 -extern const Word16 table_diff_Log2_norm_lc[32]; +extern const Word16 table_diff_Log2_norm_lc[32]; // Q15 -extern const Word16 log2_tab[33]; +extern const Word16 log2_tab[33]; // Q15 diff --git a/lib_com/rom_basop_util.c b/lib_com/rom_basop_util.c index 9bb6f0a93..38c61d6bc 100644 --- a/lib_com/rom_basop_util.c +++ b/lib_com/rom_basop_util.c @@ -46,6 +46,7 @@ } const PWord16 SineTable512[] = { + // Q15 STCP( 0x7fffffff, 0x00000000 ), STCP( 0x7fffd886, 0x006487e3 ), STCP( 0x7fff6216, 0x00c90f88 ), @@ -305,7 +306,7 @@ const PWord16 SineTable512[] = { STCP( 0x5a82799a, 0x5a82799a ), }; -const PWord16 SineTable320[] = { +const PWord16 SineTable320[] = { // Q15 STCP( 0x7fffffff, 0x00000000 ), STCP( 0x7fff9aef, 0x00a0d951 ), STCP( 0x7ffe6bbf, 0x0141b1a5 ), STCP( 0x7ffc726f, 0x01e287fc ), STCP( 0x7ff9af04, 0x02835b5a ), STCP( 0x7ff62182, 0x03242abf ), @@ -399,6 +400,7 @@ const PWord16 SineTable320[] = { } const PWord16 SineWindow10[5] = { + // Q15 WTCP( 0x7f9afcb9, 0x0a0af299 ), WTCP( 0x7c769e18, 0x1de189a6 ), WTCP( 0x7641af3d, 0x30fbc54d ), @@ -407,6 +409,7 @@ const PWord16 SineWindow10[5] = { }; const PWord16 SineWindow16[8] = { + // Q15 WTCP( 0x7fd8878e, 0x0647d97c ), WTCP( 0x7e9d55fc, 0x12c8106f ), WTCP( 0x7c29fbee, 0x1f19f97b ), @@ -418,6 +421,7 @@ const PWord16 SineWindow16[8] = { }; const PWord16 SineWindow20[10] = { + // Q15 WTCP( 0x7fe6bcb0, 0x05067734 ), WTCP( 0x7f1cde01, 0x0f0b7727 ), WTCP( 0x7d8a5f40, 0x18f8b83c ), @@ -431,6 +435,7 @@ const PWord16 SineWindow20[10] = { }; const PWord16 SineWindow30[15] = { + // Q15 WTCP( 0x7ff4c56f, 0x0359c428 ), WTCP( 0x7f9afcb9, 0x0a0af299 ), WTCP( 0x7ee7aa4c, 0x10b5150f ), @@ -448,7 +453,7 @@ const PWord16 SineWindow30[15] = { WTCP( 0x5cd91140, 0x581c00b3 ), }; -const PWord16 SineWindow32[16] = { +const PWord16 SineWindow32[16] = { // Q15 WTCP( 0x7ff62182, 0x03242abf ), WTCP( 0x7fa736b4, 0x096a9049 ), WTCP( 0x7f0991c4, 0x0fab272b ), WTCP( 0x7e1d93ea, 0x15e21445 ), WTCP( 0x7ce3ceb2, 0x1c0b826a ), WTCP( 0x7b5d039e, 0x2223a4c5 ), WTCP( 0x798a23b1, 0x2826b928 ), WTCP( 0x776c4edb, 0x2e110a62 ), WTCP( 0x7504d345, 0x33def287 ), WTCP( 0x72552c85, 0x398cdd32 ), WTCP( 0x6f5f02b2, 0x3f1749b8 ), WTCP( 0x6c242960, 0x447acd50 ), @@ -456,6 +461,7 @@ const PWord16 SineWindow32[16] = { }; const PWord16 SineWindow40[20] = { + // Q15 WTCP( 0x7ff9af04, 0x02835b5a ), WTCP( 0x7fc72ae2, 0x07891418 ), WTCP( 0x7f62368f, 0x0c8bd35e ), @@ -478,7 +484,7 @@ const PWord16 SineWindow40[20] = { WTCP( 0x5c44ee40, 0x58b71632 ), }; -const PWord16 SineWindow48[24] = { +const PWord16 SineWindow48[24] = { // Q15 WTCP( 0x7ffb9d15, 0x02182427 ), WTCP( 0x7fd8878e, 0x0647d97c ), WTCP( 0x7f92661d, 0x0a75d60e ), WTCP( 0x7f294bfd, 0x0ea0f48c ), WTCP( 0x7e9d55fc, 0x12c8106f ), WTCP( 0x7deeaa7a, 0x16ea0646 ), WTCP( 0x7d1d7958, 0x1b05b40f ), WTCP( 0x7c29fbee, 0x1f19f97b ), WTCP( 0x7b1474fd, 0x2325b847 ), WTCP( 0x79dd3098, 0x2727d486 ), WTCP( 0x78848414, 0x2b1f34eb ), WTCP( 0x770acdec, 0x2f0ac320 ), @@ -488,6 +494,7 @@ const PWord16 SineWindow48[24] = { }; const PWord16 SineWindow60[60] = { + // Q15 WTCP( 0x7ffd3154, 0x01aceb7c ), WTCP( 0x7fe6bcb0, 0x05067734 ), WTCP( 0x7fb9d759, 0x085f2137 ), @@ -521,6 +528,7 @@ const PWord16 SineWindow60[60] = { }; const PWord16 SineWindow64[32] = { + // Q15 WTCP( 0x7ffd885a, 0x01921d20 ), WTCP( 0x7fe9cbc0, 0x04b6195d ), WTCP( 0x7fc25596, 0x07d95b9e ), @@ -556,6 +564,7 @@ const PWord16 SineWindow64[32] = { }; const PWord16 SineWindow80[40] = { + // Q15 WTCP( 0x7ffe6bbf, 0x0141b1a5 ), WTCP( 0x7ff1c9ef, 0x03c4f52f ), WTCP( 0x7fd8878e, 0x0647d97c ), @@ -598,7 +607,7 @@ const PWord16 SineWindow80[40] = { WTCP( 0x5b64d492, 0x599de2ee ), }; -const PWord16 SineWindow70[35] = { +const PWord16 SineWindow70[35] = { // Q15 WTCP( 0x7ffdeffe, 0x016fa5fd ), WTCP( 0x7fed7058, 0x044ec292 ), WTCP( 0x7fcc732b, 0x072d5101 ), WTCP( 0x7f9afcb9, 0x0a0af299 ), WTCP( 0x7f591361, 0x0ce748ca ), WTCP( 0x7f06bfa3, 0x0fc1f52d ), WTCP( 0x7ea40c1b, 0x129a9991 ), WTCP( 0x7e310583, 0x1570d80b ), WTCP( 0x7dadbaaf, 0x184452fd ), WTCP( 0x7d1a3c8a, 0x1b14ad24 ), WTCP( 0x7c769e18, 0x1de189a6 ), WTCP( 0x7bc2f470, 0x20aa8c19 ), @@ -610,7 +619,7 @@ const PWord16 SineWindow70[35] = { WTCP( 0x5f7133d4, 0x554ad83c ), WTCP( 0x5d811e90, 0x576994c8 ), WTCP( 0x5b84fbb6, 0x597d0cc7 ) }; -const PWord16 SineWindow96[48] = { +const PWord16 SineWindow96[48] = { // Q15 WTCP( 0x7ffee744, 0x010c1460 ), WTCP( 0x7ff62182, 0x03242abf ), WTCP( 0x7fe49698, 0x053c0a01 ), WTCP( 0x7fca47b9, 0x07538d6b ), WTCP( 0x7fa736b4, 0x096a9049 ), WTCP( 0x7f7b65ef, 0x0b80edf1 ), WTCP( 0x7f46d86c, 0x0d9681c2 ), WTCP( 0x7f0991c4, 0x0fab272b ), WTCP( 0x7ec3962a, 0x11beb9aa ), WTCP( 0x7e74ea6a, 0x13d114d0 ), WTCP( 0x7e1d93ea, 0x15e21445 ), WTCP( 0x7dbd98a4, 0x17f193c5 ), @@ -625,7 +634,7 @@ const PWord16 SineWindow96[48] = { WTCP( 0x5f8ab487, 0x552e4605 ), WTCP( 0x5e22a487, 0x56bb8a90 ), WTCP( 0x5cb420e0, 0x5842dd54 ), WTCP( 0x5b3f42ae, 0x59c42381 ) }; -const PWord16 SineWindow112[56] = { +const PWord16 SineWindow112[56] = { // Q15 WTCP( 0x7fff31bf, 0x00e5c87e ), WTCP( 0x7ff8bfc7, 0x02b14de9 ), WTCP( 0x7febdc2a, 0x047cb09e ), WTCP( 0x7fd8878e, 0x0647d97c ), WTCP( 0x7fbec2ec, 0x0812b164 ), WTCP( 0x7f9e8f91, 0x09dd213a ), WTCP( 0x7f77ef1c, 0x0ba711ea ), WTCP( 0x7f4ae37e, 0x0d706c64 ), WTCP( 0x7f176efc, 0x0f3919a0 ), WTCP( 0x7edd942d, 0x110102a0 ), WTCP( 0x7e9d55fc, 0x12c8106f ), WTCP( 0x7e56b7a4, 0x148e2c22 ), @@ -643,6 +652,7 @@ const PWord16 SineWindow112[56] = { }; const PWord16 SineWindow120[60] = { + // Q15 WTCP( 0x7fff4c54, 0x00d676eb ), WTCP( 0x7ff9af04, 0x02835b5a ), WTCP( 0x7fee74a2, 0x0430238f ), @@ -706,6 +716,7 @@ const PWord16 SineWindow120[60] = { }; const PWord16 SineWindow128[64] = { + // Q15 WTCP( 0x7fff6216, 0x00c90f88 ), WTCP( 0x7ffa72d1, 0x025b26d7 ), WTCP( 0x7ff09478, 0x03ed26e6 ), @@ -772,7 +783,7 @@ const PWord16 SineWindow128[64] = { WTCP( 0x5b1035cf, 0x59f3de12 ), }; -const PWord16 SineWindow140[70] = { +const PWord16 SineWindow140[70] = { // Q15 WTCP( 0x7fff7bff, 0x00b7d3bc ), WTCP( 0x7ffb5c00, 0x02277547 ), WTCP( 0x7ff31c25, 0x0397050d ), WTCP( 0x7fe6bcb0, 0x05067734 ), WTCP( 0x7fd63e09, 0x0675bfe7 ), WTCP( 0x7fc1a0b6, 0x07e4d34d ), WTCP( 0x7fa8e564, 0x0953a594 ), WTCP( 0x7f8c0cdc, 0x0ac22ae8 ), WTCP( 0x7f6b180f, 0x0c30577a ), WTCP( 0x7f46080a, 0x0d9e1f7d ), WTCP( 0x7f1cde01, 0x0f0b7727 ), WTCP( 0x7eef9b46, 0x107852b2 ), @@ -794,6 +805,7 @@ const PWord16 SineWindow140[70] = { }; const PWord16 SineWindow160[80] = { + // Q15 WTCP( 0x7fff9aef, 0x00a0d951 ), WTCP( 0x7ffc726f, 0x01e287fc ), WTCP( 0x7ff62182, 0x03242abf ), @@ -877,6 +889,7 @@ const PWord16 SineWindow160[80] = { }; const PWord16 SineWindow180[90] = { + // Q15 WTCP( 0x7fffb026, 0x008efa17 ), WTCP( 0x7ffd3154, 0x01aceb7c ), WTCP( 0x7ff833bd, 0x02cad485 ), @@ -970,7 +983,7 @@ const PWord16 SineWindow180[90] = { }; -const PWord16 SineWindow224[112] = { +const PWord16 SineWindow224[112] = { // Q15 WTCP( 0x7fffcc70, 0x0072e46e ), WTCP( 0x7ffe2fee, 0x0158abd6 ), WTCP( 0x7ffaf6f1, 0x023e6ee8 ), WTCP( 0x7ff62182, 0x03242abf ), WTCP( 0x7fefafb1, 0x0409dc76 ), WTCP( 0x7fe7a192, 0x04ef8129 ), WTCP( 0x7fddf741, 0x05d515f5 ), WTCP( 0x7fd2b0da, 0x06ba97f4 ), WTCP( 0x7fc5ce84, 0x07a00445 ), WTCP( 0x7fb75068, 0x08855802 ), WTCP( 0x7fa736b4, 0x096a9049 ), WTCP( 0x7f95819c, 0x0a4faa38 ), @@ -1003,6 +1016,7 @@ const PWord16 SineWindow224[112] = { const PWord16 SineWindow256[128] = { + // Q15 WTCP( 0x7fffd886, 0x006487e3 ), WTCP( 0x7ffe9cb2, 0x012d96b1 ), WTCP( 0x7ffc250f, 0x01f6a297 ), @@ -1133,7 +1147,7 @@ const PWord16 SineWindow256[128] = { WTCP( 0x5ac973b5, 0x5a3b47ab ), }; -const PWord16 SineWindow280[140] = { +const PWord16 SineWindow280[140] = { // Q15 WTCP( 0x7fffdf00, 0x005be9f6 ), WTCP( 0x7ffed6ff, 0x0113bd23 ), WTCP( 0x7ffcc6ff, 0x01cb8e18 ), WTCP( 0x7ff9af04, 0x02835b5a ), WTCP( 0x7ff58f15, 0x033b236c ), WTCP( 0x7ff0673a, 0x03f2e4d4 ), WTCP( 0x7fea377e, 0x04aa9e17 ), WTCP( 0x7fe2ffee, 0x05624dba ), WTCP( 0x7fdac098, 0x0619f243 ), WTCP( 0x7fd1798e, 0x06d18a36 ), WTCP( 0x7fc72ae2, 0x07891418 ), WTCP( 0x7fbbd4aa, 0x08408e70 ), @@ -1172,6 +1186,7 @@ const PWord16 SineWindow280[140] = { }; const PWord16 SineWindow320[160] = { + // Q15 WTCP( 0x7fffe6bc, 0x00506cb9 ), WTCP( 0x7fff1c9b, 0x00f145ab ), WTCP( 0x7ffd885a, 0x01921d20 ), @@ -1335,7 +1350,7 @@ const PWord16 SineWindow320[160] = { }; -const PWord16 SineWindow420[210] = { +const PWord16 SineWindow420[210] = { // Q15 WTCP( 0x7ffff155, 0x003d46a7 ), WTCP( 0x7fff7bff, 0x00b7d3bc ), WTCP( 0x7ffe9154, 0x01326029 ), WTCP( 0x7ffd3154, 0x01aceb7c ), WTCP( 0x7ffb5c00, 0x02277547 ), WTCP( 0x7ff9115b, 0x02a1fd18 ), WTCP( 0x7ff65166, 0x031c8280 ), WTCP( 0x7ff31c25, 0x0397050d ), WTCP( 0x7fef7199, 0x0411844f ), WTCP( 0x7feb51c6, 0x048bffd7 ), WTCP( 0x7fe6bcb0, 0x05067734 ), WTCP( 0x7fe1b25b, 0x0580e9f6 ), @@ -1392,7 +1407,7 @@ const PWord16 SineWindow420[210] = { }; -const PWord16 *const windowSlopes[1][2][8] = { +const PWord16 *const windowSlopes[1][2][8] = { // Q15 { /* Sine */ { /* Radix 2 */ @@ -1422,7 +1437,7 @@ const PWord16 *const windowSlopes[1][2][8] = { #define DCTIV_SINETABLE320 SineTable320 #define DCTIV_SINETABLE320_SIZE_LD 8 -void BASOP_getTables( const PWord16 **ptwiddle, const PWord16 **sin_twiddle, Word16 *psin_step, Word16 length ) +void BASOP_getTables( const PWord16 **ptwiddle /*Q15*/, const PWord16 **sin_twiddle /*Q15*/, Word16 *psin_step, Word16 length ) { const PWord16 *twiddle; const PWord16 *sine; @@ -1441,7 +1456,7 @@ void BASOP_getTables( const PWord16 **ptwiddle, const PWord16 **sin_twiddle, Wor move16(); sine = DCTIV_SINETABLE320; sin_step = shl( 1, sub( DCTIV_SINETABLE320_SIZE_LD + 1, ld2_length ) ); - twiddle = windowSlopes[0][1][sub( ld2_length, 1 )]; + twiddle = windowSlopes[0][1][ld2_length - 1]; // Q15 BREAK; case 0x8000: /* radix 2 */ @@ -1449,7 +1464,7 @@ void BASOP_getTables( const PWord16 **ptwiddle, const PWord16 **sin_twiddle, Wor move16(); sine = DCTIV_SINETABLE; sin_step = shl( 1, sub( DCTIV_SINETABLE_SIZE_LD + 1, ld2_length ) ); - twiddle = windowSlopes[0][0][sub( ld2_length, 2 )]; + twiddle = windowSlopes[0][0][ld2_length - 2]; // Q15 BREAK; default: /* not instrumented, probably obsolete */ @@ -1486,55 +1501,55 @@ const PWord16 *getSineWindowTable( Word16 length ) switch ( length ) { case 10: - p = SineWindow10; + p = SineWindow10; // Q15 BREAK; case 16: - p = SineWindow16; + p = SineWindow16; // Q15 BREAK; case 20: - p = SineWindow20; + p = SineWindow20; // Q15 BREAK; case 30: - p = SineWindow30; + p = SineWindow30; // Q15 BREAK; case 32: - p = SineWindow32; + p = SineWindow32; // Q15 BREAK; case 40: - p = SineWindow40; + p = SineWindow40; // Q15 BREAK; case 48: - p = SineWindow48; + p = SineWindow48; // Q15 BREAK; case 60: - p = SineWindow60; + p = SineWindow60; // Q15 BREAK; case 70: - p = SineWindow70; + p = SineWindow70; // Q15 BREAK; case 96: - p = SineWindow96; + p = SineWindow96; // Q15 BREAK; case 112: - p = SineWindow112; + p = SineWindow112; // Q15 BREAK; case 120: - p = SineWindow120; + p = SineWindow120; // Q15 BREAK; case 140: - p = SineWindow140; + p = SineWindow140; // Q15 BREAK; case 180: - p = SineWindow180; + p = SineWindow180; // Q15 BREAK; case 224: - p = SineWindow224; + p = SineWindow224; // Q15 BREAK; case 280: - p = SineWindow280; + p = SineWindow280; // Q15 BREAK; case 420: - p = SineWindow420; + p = SineWindow420; // Q15 BREAK; } diff --git a/lib_com/rom_basop_util.h b/lib_com/rom_basop_util.h index 2626f6f43..f2e81f0a1 100644 --- a/lib_com/rom_basop_util.h +++ b/lib_com/rom_basop_util.h @@ -40,14 +40,14 @@ #include "typedef.h" #include "basop_util.h" -extern const PWord16 SineTable512[257]; -extern const PWord16 SineTable320[161]; +extern const PWord16 SineTable512[257]; // Q15 +extern const PWord16 SineTable320[161]; // Q15 /** * \ brief Lookup for sine tables and windows. */ -void BASOP_getTables( const PWord16 **ptwiddle, const PWord16 **sin_twiddle, Word16 *sin_step, Word16 length ); +void BASOP_getTables( const PWord16 **ptwiddle /*Q15*/, const PWord16 **sin_twiddle /*Q15*/, Word16 *psin_step, Word16 length ); const PWord16 *getSineWindowTable( Word16 length ); #endif diff --git a/lib_com/rom_com.c b/lib_com/rom_com.c index a1fc49304..acf416c0a 100644 --- a/lib_com/rom_com.c +++ b/lib_com/rom_com.c @@ -50,13 +50,13 @@ *----------------------------------------------------------------------------------*/ #define W16(x) ((Word16)x) -const int32_t brate_tbl[SIZE_BRATE_TBL] = +const Word32 brate_tbl[SIZE_BRATE_TBL] = // Q0 { ACELP_7k20, ACELP_8k00, ACELP_9k60, ACELP_13k20, ACELP_16k40, ACELP_24k40, ACELP_32k, ACELP_48k, ACELP_64k, HQ_96k, HQ_128k }; -const int32_t brate_intermed_tbl[SIZE_BRATE_INTERMED_TBL] = +const Word32 brate_intermed_tbl[SIZE_BRATE_INTERMED_TBL] = // Q0 { 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, @@ -109,7 +109,7 @@ const FrameSizeParams FrameSizeConfig[FRAME_SIZE_NB] = * - the other values represent indices created by combining different parameters into a single value through the macro SIG2IND() *----------------------------------------------------------------------------------*/ -const int32_t acelp_sig_tbl[MAX_ACELP_SIG] = +const Word32 acelp_sig_tbl[MAX_ACELP_SIG] = // Q0 { /* GENERIC UNVOICED VOICED TRANSITION AUDIO INACTIVE */ ACELP_7k20, 4, @@ -160,7 +160,7 @@ const int32_t acelp_sig_tbl[MAX_ACELP_SIG] = *----------------------------------------------------------------------------------*/ /* bit allocation table for end-frame LSF quantizer */ -const int16_t LSF_bits_tbl[] = +const Word16 LSF_bits_tbl[] = // Q0 { /* IC UC VC GC TC AC */ 22, 31, 24, 29, 24, 22, /* ACELP_5k00 */ @@ -186,7 +186,7 @@ const int16_t LSF_bits_tbl[] = }; /* bit allocation table for mid-frame LSF quantizer */ -const int16_t mid_LSF_bits_tbl[] = +const Word16 mid_LSF_bits_tbl[] = // Q0 { /* IC UC VC GC TC AC */ 2, 5, 1, 2, 2, 2, /* ACELP_5k00 */ @@ -213,7 +213,7 @@ const int16_t mid_LSF_bits_tbl[] = /* bit allocation table for scaled innovation energy prediction */ -const int16_t Es_pred_bits_tbl[] = +const Word16 Es_pred_bits_tbl[] = // Q0 { /* UC VC GC TC */ 0, 0, 0, 4, /* ACELP_5k00 */ @@ -240,7 +240,7 @@ const int16_t Es_pred_bits_tbl[] = /* bit allocation table for gain quantizer (ACELP@12.8kHz) */ /* the 4 values allocated correspond to 4 subframes */ -const int16_t gain_bits_tbl[] = +const Word16 gain_bits_tbl[] = // Q0 { /* 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 */ @@ -261,7 +261,7 @@ const int16_t gain_bits_tbl[] = /* bit allocation table for gain gain quantizer (ACELP@16kHz) */ /* the 5 values allocated correspond to 5 subframes */ -const int16_t gain_bits_16kHz_tbl[] = +const Word16 gain_bits_16kHz_tbl[] = // Q0 { /* 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 */ @@ -279,7 +279,7 @@ const int16_t gain_bits_16kHz_tbl[] = /* bit allocation table for adaptive codebook (pitch) (ACELP@12.8kHz) */ /* the 4 values correspond to 4 subframes */ -const int16_t ACB_bits_tbl[] = +const Word16 ACB_bits_tbl[] = // Q0 { /* 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 */ @@ -299,7 +299,7 @@ const int16_t ACB_bits_tbl[] = /* bit allocation table for adaptive codebook (pitch) (ACELP@16kHz) */ /* the 5 values correspond to 5 subframes */ -const int16_t ACB_bits_16kHz_tbl[] = +const Word16 ACB_bits_16kHz_tbl[] = // Q0 { /* 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 */ @@ -317,7 +317,7 @@ const int16_t ACB_bits_16kHz_tbl[] = /* bit allocation table for algebraic (fixed) codebook (innovation) (ACELP@12.8kHz) */ /* the 4 values correspond to 4 subframes */ -const int16_t FCB_bits_tbl[] = +const Word16 FCB_bits_tbl[] = // Q0 { /* 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 */ @@ -337,7 +337,7 @@ const int16_t FCB_bits_tbl[] = /* bit allocation table for algebraic (fixed) codebook (innovation) (ACELP@16kHz) */ /* the 5 values correspond to 5 subframes */ -const int16_t FCB_bits_16kHz_tbl[] = +const Word16 FCB_bits_16kHz_tbl[] = // Q0 { /* 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 */ @@ -354,7 +354,7 @@ const int16_t FCB_bits_16kHz_tbl[] = }; /* bit allocation table for AVQ bits in active segments (ACELP@16kHz) */ -const int16_t AVQ_bits_16kHz_tbl[] = +const Word16 AVQ_bits_16kHz_tbl[] = // Q0 { /* 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 */ @@ -371,7 +371,7 @@ const int16_t AVQ_bits_16kHz_tbl[] = }; /* bit allocation table for reserved bits (ACELP@12.8kHz) */ -const int16_t reserved_bits_tbl[] = +const Word16 reserved_bits_tbl[] = // Q0 { /* 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 */ @@ -390,24 +390,24 @@ const int16_t reserved_bits_tbl[] = }; /* NRG mode */ -const uint8_t ACELP_NRG_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = +const UWord8 ACELP_NRG_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0 { {{0,0,1,1,0,0,0,0},{2,2,1,1,0,0,0,0}}, {{1,1,1,1,0,0,0,0},{1,1,1,1,1,1,1,0}}, }; /* NRG bits : (0/2/3 bits) */ -const uint8_t ACELP_NRG_BITS[3] = { 0, 3, 4 }; +const uint8_t ACELP_NRG_BITS[3] = { 0, 3, 4 }; // Q0 /* LTP MODE*/ -const uint8_t ACELP_LTP_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = +const UWord8 ACELP_LTP_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0 { {{0,0,1,2,0,0,0,0},{0,0,1,2,0,0,0,0}}, {{4,4,3,4,0,0,0,0},{4,4,3,4,8,0,9,0}}, }; /* LTP bits */ -const uint8_t ACELP_LTP_BITS_SFR[8+RF_MODE_MAX][5] = +const UWord8 ACELP_LTP_BITS_SFR[8+RF_MODE_MAX][5] = // Q0 { {0,0,0,0,0}, {8,4,4,4,4}, @@ -423,25 +423,25 @@ const uint8_t ACELP_LTP_BITS_SFR[8+RF_MODE_MAX][5] = /* LTF modes (0 - LOW_PASS (LP filtering), 1 - FULL_BAND (no filtering), 2 - NORMAL_OPERATION (adaptive)) */ /* Mode 2 ACELP: INACTIVE,UNVOICED,VOICED,GENERIC */ -const uint8_t ACELP_LTF_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = +const UWord8 ACELP_LTF_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0 { {{1,1,1,0,0,0,0,0},{1,1,1,0,0,0,0,0}}, {{0,0,2,0,0,0,0,0},{0,0,2,0,1,1,1,0}}, }; /* LTF bits */ -const uint8_t ACELP_LTF_BITS[4] = { 0, 0, 4, 0 }; +const UWord8 ACELP_LTF_BITS[4] = { 0, 0, 4, 0 }; // Q0 /* GAINS ELEMENT */ /* 5 modes: (EVS: 5b/subframe), (AMRWB: 7b/subframe),(AMRWB: 6b/subframe),(UC: 5b/subframe) */ -const uint8_t ACELP_GAINS_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = +const UWord8 ACELP_GAINS_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0 { {{6,6,1,1,0,0,0,0},{7,7,1,1,0,0,0,0}}, {{2,2,3,3,0,0,0,0},{2,2,3,3,3,2,1,0}}, }; /* gains bits */ -const uint8_t ACELP_GAINS_BITS[10] = +const UWord8 ACELP_GAINS_BITS[10] = // Q0 { 0, /* skip sub-frame wise gain coding*/ 5, @@ -456,14 +456,14 @@ const uint8_t ACELP_GAINS_BITS[10] = }; /* BPF modes (0 - no filtering, 1 - filtering, 2 - adaptive) */ -const uint8_t ACELP_BPF_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = +const UWord8 ACELP_BPF_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX+RF_MODE_MAX] = // Q0 { {{1,1,1,1,0,0,0,0},{1,1,1,1,0,0,0,0}}, {{1,1,2,2,0,0,0,0},{1,1,2,2,1,1,1,1}}, }; /* BPF bits */ -const uint8_t ACELP_BPF_BITS[3] = { 0, 0, 2 }; +const UWord8 ACELP_BPF_BITS[3] = { 0, 0, 2 }; // Q0 const Word16 ACELP_CDK_BITS[ACELP_FIXED_CDK_NB] = { 7, 10, 12, 15, 17, 20, 24, 26, 28, 30, 32, 34, 36, 40, 43, 46, @@ -495,12 +495,12 @@ const float crit_bins_corr[CRIT_NOIS_BAND] = 0.60f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f }; const Word16 crit_bins_corr_fx[CRIT_NOIS_BAND] = -{ +{//Q15 /*.9f, .9f, .85f, .8f, .775f, .75f, .725f , .7f , .675f, .65f, .625f , .60f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f, .6f*/ 29491, 29491, 27853, 26214, 25395, 24576, 23577 , 22938, 22118, 21299, 20480, 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661, 19661 }; -const int16_t crit_bins[CRIT_NOIS_BAND] = +const Word16 crit_bins[CRIT_NOIS_BAND] = // Q0 { 4, 4, 4, 4, 4, 5, 6, 6, 6, 8, 8, 10, 11, 13, 15, 18, 22, 16, 16, 20, 20, 20, 16 }; @@ -511,7 +511,7 @@ const float crit_bands_loc[CRIT_NOIS_BAND] = 1720.0f, 2000.0f, 2320.0f, 2700.0f, 3150.0f, 3700.0f, 4100.0f, 4500.0f, 5000.0f, 5500.0f, 6000.0f, 6375.0f }; const Word16 crit_bands_loc_fx[CRIT_NOIS_BAND] = -{ +{//Q0 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480, 1720, 2000, 2320, 2700, 3150, 3700, 4100, 4500, 5000, 5500, 6000, 6375 }; @@ -553,7 +553,7 @@ const float inv_tbl[130] = 0.0077519380f /* last val = 1/129 */ }; -const Word16 inv_tbl_fx[146] = +const Word16 inv_tbl_fx[146] =//Q15 { 0, 32767, 16384, 10923, 8192, 6554, 5462, 4681, 4096, 3641, 3277, 2979, 2731, 2521, 2341, 2185, @@ -639,7 +639,7 @@ const Word32 thren_fx[39] = /* Q8 */ 108, 76, 54 }; -const Word16 dicnlg2[40] = +const Word16 dicnlg2[40] = // Q0 { 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, @@ -655,13 +655,13 @@ const float mfreq_loc_LD[] = { 100.0f, 200.0f, 300.0f, 400.0f, 510.0f, 630.0f, 7 1720.0f, 2000.0f, 2320.0f, 2700.0f, 3150.0f, 3700.0f, 4400.0f, 5300.0f, (6400.0f-BIN_16kdct) }; -const Word16 mfreq_loc_LD_fx[] = { 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480, +const Word16 mfreq_loc_LD_fx[] = { 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480,//Q0 1720, 2000, 2320, 2700, 3150, 3700, 4400, 5300, (6400 - BIN_16kdct_fx) }; -const int16_t mfreq_bindiv_LD[] = {10, 10, 10, 10, 11, 12, 14, 15, 16, 19, 21, 24, 28, 32, 38, 45, 55, 70, 90, 110}; +const Word16 mfreq_bindiv_LD[] = {10, 10, 10, 10, 11, 12, 14, 15, 16, 19, 21, 24, 28, 32, 38, 45, 55, 70, 90, 110}; // Q0 const float sc_qnoise[] = {0.1f,0.1f,0.1f,0.1f,0.1f,0.1f,0.09091f,0.09091f,0.09091f,0.09091f,0.09091f,0.09091f,0.09091f,0.09091f,0.09091f,0.06667f,0.06667f,0.06667f,0.06667f,0.06667f}; -const Word16 sc_qnoise_fx[] = { 3277, 3277, 3277, 3277, 3277, 3277, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2185, 2185, 2185, 2185, 2185 }; +const Word16 sc_qnoise_fx[] = { 3277, 3277, 3277, 3277, 3277, 3277, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2979, 2185, 2185, 2185, 2185, 2185 };//Q15 const Word16 inv_mfreq_bindiv_LD_fx[] = { 3277, 3277, 3277, 3277, 2979, 2731, 2341, 2185, 2048, 1725, 1560, 1365, 1170, 1024, 862, 728, 596, 468, 364, 298 }; /*Q15 */ const Word16 inv_mfreq_bindiv_LD_M1_fx[] = { 3641, 3641, 3641, 3641, 3277, 2979, 2521, 2341, 2185, 1820, 1638, 1425, 1214, 1057, 886, 745, 607, 475, 368, 301 }; /*Q15 */ @@ -723,9 +723,9 @@ const Word16 post_dct_wind_fx[OFFSET2] = /*Q15 */ const float MAX_SNR_SNR1_tab[MBANDS_GN_LD] = { 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.026316f, 1.02631627f, 1.043478f, 1.043478f, 1.043478f, 1.043478f}; const float INV_MAX_SNR_tab[MBANDS_GN_LD] = { .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .026316f, .043478f, .043478f, .043478f, .043478f}; -const Word16 MAX_SNR_SNR1_tab_FX[MBANDS_GN_LD] = { 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 17096, 17096, 17096, 17096 }; +const Word16 MAX_SNR_SNR1_tab_FX[MBANDS_GN_LD] = { 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 16815, 17096, 17096, 17096, 17096 };//Q14 -const Word16 INV_MAX_SNR_tab_FX[MBANDS_GN_LD] = { 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 1425, 1425, 1425, 1425 }; +const Word16 INV_MAX_SNR_tab_FX[MBANDS_GN_LD] = { 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 862, 1425, 1425, 1425, 1425 };//Q15 const float wind_sss[LEN_WIN_SSS] = /* window for subsampling */ { @@ -746,7 +746,7 @@ const float wind_sss[LEN_WIN_SSS] = /* window for subsampling */ 1.000000f, 0.979530f, 0.918958f, 0.820763f, 0.688967f, 0.528964f, 0.347305f, 0.151428f }; const Word16 wind_sss_fx[LEN_WIN_SSS] = /*window for subsampling*/ -{ +{//Q15 2621, 2627, 2645, 2675, 2717, 2771, 2836, 2914, 3003, 3103, 3216, 3340, 3475, 3621, 3779, 3948, 4127, 4318, 4519, 4730, 4952, 5184, 5426, 5677, @@ -1198,13 +1198,13 @@ const float lag_window_48k_flt[17] = 0.994801176082f, 0.993973102356f, 0.993084457589f, 0.992135405511f }; -const Word16 lag_window_8k[2][16] = /* LAGW_STRONG */ +const Word16 lag_window_8k[2][16] = /* LAGW_STRONG Q15*/ { /* h */ { 32728, 32619, 32438, 32187, 31867, 31480, 31029, 30517, 29946, 29321, 28645, 27923, 27158, 26356, 25521, 24658 }, /* l */ { 11904, 17280, 30720, 25856, 24192, 28992, 24384, 7360, 19456, 14720, 22080, 12928, 31040, 27328, 22080, 5184 } }; const Word16 lag_window_12k8[NUM_LAGW_STRENGTHS][2][16] = -{ +{//Q15 /* LAGW_WEAK */ { /* h */ { 32763, 32758, 32750, 32739, 32725, 32707, 32687, 32663, 32637, 32607, 32574, 32538, 32498, 32456, 32411, 32362 }, @@ -1222,7 +1222,7 @@ const Word16 lag_window_12k8[NUM_LAGW_STRENGTHS][2][16] = } }; const Word16 lag_window_16k[NUM_LAGW_STRENGTHS][2][16] = -{ +{//Q15 /* LAGW_WEAK */ { /* h */ { 32763, 32760, 32755, 32748, 32739, 32728, 32715, 32700, 32682, 32663, 32642, 32619, 32594, 32567, 32538, 32507 }, @@ -1240,7 +1240,7 @@ const Word16 lag_window_16k[NUM_LAGW_STRENGTHS][2][16] = } }; const Word16 lag_window_25k6[NUM_LAGW_STRENGTHS][2][16] = -{ +{//Q15 /* LAGW_WEAK */ { /* h */ { 32764, 32763, 32761, 32758, 32754, 32750, 32745, 32739, 32732, 32725, 32716, 32707, 32698, 32687, 32676, 32663 }, @@ -1258,7 +1258,7 @@ const Word16 lag_window_25k6[NUM_LAGW_STRENGTHS][2][16] = } }; const Word16 lag_window_32k[NUM_LAGW_STRENGTHS][2][16] = -{ +{//Q15 /* LAGW_WEAK */ { /* h */ { 32764, 32763, 32762, 32760, 32758, 32755, 32752, 32748, 32744, 32739, 32734, 32728, 32722, 32715, 32707, 32700 }, @@ -1276,19 +1276,19 @@ const Word16 lag_window_32k[NUM_LAGW_STRENGTHS][2][16] = } }; const Word16 lag_window_48k[2][16] = /* LAGW_STRONG */ -{ +{//Q15 /* h */ { 32763, 32760, 32755, 32748, 32739, 32728, 32715, 32700, 32682, 32663, 32642, 32619, 32594, 32567, 32538, 32507 }, /* l */ { 23360, 22272, 20672, 18304, 15360, 11904, 8000, 3648, 31808, 27008, 22080, 17280, 12608, 8256, 4480, 1344 } }; /* 32 bit declarations */ const Word32 lag_window_8k_32[16] = /* LAGW_STRONG */ -{ +{//Q31 2144886016, 2137753344, 2125918208, 2109458944, 2088484096, 2063131264, 2033565312, 1999976832, 1962579968, 1921610496, 1877322880, 1829987584, 1779888768, 1727321472, 1672588416, 1615997056 }; const Word32 lag_window_12k8_32[NUM_LAGW_STRENGTHS][16] = -{ +{//Q31 /* LAGW_WEAK */ { 2147165440, 2146854912, 2146337792, 2145613824, 2144683392, 2143546880, 2142204288, 2140656384, 2138903424, 2136945792, 2134784256, 2132419328, 2129851776, 2127082368, 2124111616, 2120940800 @@ -1304,7 +1304,7 @@ const Word32 lag_window_12k8_32[NUM_LAGW_STRENGTHS][16] = }; const Word32 lag_window_16k_32[NUM_LAGW_STRENGTHS][16] = -{ +{//Q31 /* LAGW_WEAK */ { 2147202688, 2147003904, 2146673024, 2146209536, 2145613824, 2144886016, 2144026240, 2143034496, 2141911168, 2140656384, 2139270272, 2137753344, 2136105600, 2134327424, 2132419328, 2130381440 @@ -1319,7 +1319,7 @@ const Word32 lag_window_16k_32[NUM_LAGW_STRENGTHS][16] = } }; const Word32 lag_window_25k6_32[NUM_LAGW_STRENGTHS][16] = -{ +{//Q31 /* LAGW_WEAK */ { 2147243008, 2147165440, 2147036032, 2146854912, 2146622336, 2146337792, 2146001664, 2145613824, 2145174400, 2144683392, 2144140928, 2143546880, 2142901376, 2142204288, 2141456000, 2140656384 @@ -1334,7 +1334,7 @@ const Word32 lag_window_25k6_32[NUM_LAGW_STRENGTHS][16] = } }; const Word32 lag_window_32k_32[NUM_LAGW_STRENGTHS][16] = -{ +{//Q31 /* LAGW_WEAK */ { 2147252352, 2147202688, 2147119872, 2147003904, 2146854912, 2146673024, 2146457728, 2146209536, 2145928192, 2145613824, 2145266432, 2144886016, 2144472576, 2144026240, 2143546880, 2143034496 @@ -1349,7 +1349,7 @@ const Word32 lag_window_32k_32[NUM_LAGW_STRENGTHS][16] = } }; const Word32 lag_window_48k_32[16] = /* LAGW_STRONG */ -{ +{//Q31 2147202688, 2147003904, 2146673024, 2146209536, 2145613824, 2144886016, 2144026240, 2143034496, 2141911168, 2140656384, 2139270272, 2137753344, 2136105600, 2134327424, 2132419328, 2130381440 }; /*----------------------------------------------------------------------------------* @@ -1374,7 +1374,7 @@ const float grid40[(GRID40_POINTS-1)/2 - 1] = #ifdef IVAS_FLOAT_FIXED const Word16 grid50_fx[(GRID50_POINTS - 1) / 2 - 1] = -{ +{//Q15 32703, 32510, 32188, 31739, 31164, 30467, 29649, 28715, 27667, 26510, 25248, 23887, 22431, 20887, 19261, 17558, 15786, 13952, @@ -1382,7 +1382,7 @@ const Word16 grid50_fx[(GRID50_POINTS - 1) / 2 - 1] = }; const Word16 grid40_fx[(GRID40_POINTS - 1) / 2 - 1] = -{ +{//Q15 32667, 32365, 31863, 31164, 30274, 29197, 27939, 26510, 24917, 23170, 21281, 19261, 17121, 14876, 12540, 10126, 7650, 5126, @@ -1588,7 +1588,7 @@ const float sincos_t_ext[641] = -0.676092703575316f, -0.680600997795453f, -0.685083667772700f, -0.689540544737067f, -0.693971460889654f, -0.698376249408973f, -0.702754744457225f, -0.707106781186547f }; const Word16 sincos_t_ext_fx[641] = -{ +{//Q15 0, 201, 402, 603, 804, 1005, 1206, 1407, 1608, 1809, 2009, 2210, 2411, 2611, 2811, 3012, 3212, 3412, 3612, 3812, 4011, 4211, 4410, 4609, @@ -1733,7 +1733,8 @@ const Word16 Asr_LP48_fx[61] = 0, -407, -592, -571, -408, -192, 0, 123, 167, 146, 93, 38, 0 }; -const Word16 fft256_read_indexes[]= + +const Word16 fft256_read_indexes[]= // Q0 { 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, @@ -1792,7 +1793,7 @@ const float sin_table256[] = }; const Word16 sin_table256_fx[] = -{ +{//Q15 101, 302, 503, 704, 905, 1106, 1307, 1507, 1708, 1909, 2110, 2310, 2511, 2711, 2912, 3112, 3312, 3512, 3712, 3911, 4111, 4310, 4510, 4709, 4907, 5106, 5305, @@ -1850,7 +1851,7 @@ const float inter4_2[65] = const Word16 inter4_2_fx_Q15[65] = -{ +{//Q15 30801, 28062, 20718, 11061, 1935, -4294, -6533, -5195, -1846, @@ -1871,7 +1872,7 @@ const Word16 inter4_2_fx_Q15[65] = }; const Word16 inter4_2_fx[] = -{ +{//evs table , some mismatch in values compared to float is observed 0, 1, 2, 1, -2, -7, -10, -7, 4, 19, 28, 22, @@ -2116,7 +2117,7 @@ static const float filter_LP12_180H[] = /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax }; const Word16 filter_LP12_180H_fx[] = /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/12, hann( N )' */ -{ +{//Q14 16384, 16196, 15641, 14741, 13533, 12067, 10402, 8604, 6742, 4887, 3105, 1459, 0, -1230, -2202, -2900, -3322, -3478, @@ -2150,7 +2151,7 @@ const Word16 filter_LP12_180H_fx[] = /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/ 0 }; const Word16 filter_LP12_180H_13b_fx[] = /*Q13 Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/12, hann( N )*/ -{ +{//Q13 8192, 8098, 7820, 7370, 6766, 6033, 5201, 4302, 3371, 2443, 1553, 729, 0, -615, -1101, -1450, -1661, -1739, @@ -2226,7 +2227,7 @@ static const float filter_LP15_180H[] = /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax }; const Word16 filter_LP15_180H_fx[] = /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/15, hann( N )' */ -{ +{//Q14 16384, 16263, 15904, 15317, 14516, 13524, 12366, 11073, 9678, 8216, 6723, 5236, 3790, 2416, 1144, 0, -997, -1831, @@ -2261,7 +2262,7 @@ const Word16 filter_LP15_180H_fx[] = /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/ }; const Word16 filter_LP15_180H_13b_fx[6 * 31] = /*Q13 Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/12, hann( N )'*/ -{ +{//Q13 8192, 8132, 7952, 7658, 7258, 6762, 6183, 5536, 4839, 4108, 3362, 2618, 1895, 1208, 572, 0, -498, -915, @@ -2321,7 +2322,7 @@ static const float filter_LP24_90H[] = { }; const Word16 filter_LP24_90H_fx[] = -{ +{//Q14 10240, 10208, 10111, 9951, 9731, 9452, 9119, 8734, 8304, 7834, @@ -2348,7 +2349,7 @@ const Word16 filter_LP24_90H_fx[] = }; const Word16 filter_LP24_90H_13b_fx[] = -{ +{//Q13 5120, 5104, 5056, 4976, 4865, 4726, 4559, 4367, 4152, 3917, @@ -2395,7 +2396,7 @@ static const float filter_LP3_90H[] = /* Sincfilt.m: N=90*2+1, Fmin=0, Fmax=1/ }; const Word16 filter_LP3_90H_fx[] = /* Sincfilt.m: N=90*2+1, Fmin=0, Fmax=1/3, hann( N )' */ -{ +{//Q14 16384, 13545, 6766, 0, -3371, -2689, 0, 1907, 1661, 0, -1314, -1187, 0, 990, 911, 0, -783, -729, @@ -2465,7 +2466,7 @@ static const float filter_LP15_360H[] = /* Sincfilt.m: N=360*2+1, Fmin=0, Fmax }; const Word16 filter_LP15_360H_13b_fx[] = /* Sincfilt.m: N=360*2+1, Fmin=0, Fmax=1/15, hann( N )' */ -{ +{//Q13 8192, 8132, 7954, 7662, 7265, 6772, 6196, 5552, 4857, 4127, 3381, 2636, 1911, 1220, 579, 0, @@ -2560,7 +2561,7 @@ static const float filter_LP30_300K[LFE_PLC_FDEL + 1] = /* 800/24000 LP filter }; static const Word16 filter_LP30_300K_fx[LFE_PLC_FDEL + 1] = -{ +{//Q14 16395,16364,16273,16123,15913,15646,15323,14947,14520,14045,13524,12963,12363,11730,11067,10379,9669, 8943,8205,7460,6712,5965,5225,4495,3779,3082,2408,1759,1140,552,0,-515,-991,-1426,-1819,-2169,-2475, -2736,-2953,-3126,-3257,-3345,-3392,-3400,-3371,-3307,-3210,-3083,-2928,-2749,-2547,-2327,-2091,-1842, @@ -2623,7 +2624,7 @@ const float interpol_frac2[NB_SUBFR] = { 0.5f, 0.5f, 1.0f, 1.0f }; -const Word16 interpol_frac2_fx[NB_SUBFR] = { +const Word16 interpol_frac2_fx[NB_SUBFR] = {//Q15 16384, 16384, 32767, 32767 }; @@ -2634,7 +2635,7 @@ const float interpol_frac2_mid[NB_SUBFR*3] = { 0.0f, 0.25f, 0.75f }; -const Word16 interpol_frac2_mid_fx[NB_SUBFR * 3] = { +const Word16 interpol_frac2_mid_fx[NB_SUBFR * 3] = {//Q15 8191, 24575, 0, 8191, 24575, 0, 0, 8191, 24575, @@ -2645,12 +2646,13 @@ const float interpol_frac_12k8[NB_SUBFR] = { 0.25f, 0.5f, 0.75f, 1.0f }; -const Word16 interpol_frac_12k8_fx[NB_SUBFR] = { +const Word16 interpol_frac_12k8_fx[NB_SUBFR] = {//Q15 8191, 16383, 24575, 32767 }; const Word16 interpol_frac_fx[NB_SUBFR] = { 8192, 16384, 24576,32767 };/*Q15*/ + const float interpol_isp_amr_wb[NB_SUBFR] = { 0.45f, 0.8f, 0.96f, 1.0f }; @@ -2661,7 +2663,9 @@ const float interpol_frac_16k[NB_SUBFR16k] = { 0.2f, 0.4f, 0.6f, 0.8f, 1.0f }; -const Word16 interpol_frac_16k_fx[NB_SUBFR16k] = { 6554, 13107, 19661, 26214, 32767 };/*Q15*/ + +const Word16 interpol_frac_16k_fx[NB_SUBFR16k] = { 6554, 13107, 19661, 26214, 32767 };//Q15 + const float interpol_frac_mid[NB_SUBFR*3] = { 0.5f, 0.5f, 0.0f, @@ -2669,7 +2673,7 @@ const float interpol_frac_mid[NB_SUBFR*3] = { 0.0f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f }; -const Word16 interpol_frac_mid_fx[NB_SUBFR * 3] = { 16384, 16384, 0, +const Word16 interpol_frac_mid_fx[NB_SUBFR * 3] = { 16384, 16384, 0,//Q15 0, 32767, 0, 0, 16384, 16384, 0, 0, 32767 @@ -2682,7 +2686,7 @@ const float interpol_frac_mid_16k[NB_SUBFR16k*3] = { 0.0f, 0.35f, 0.65f, 0.0f, 0.0f, 1.0f }; -const Word16 interpol_frac_mid_16k_fx[NB_SUBFR16k * 3] = { 18022, 14746, 0, +const Word16 interpol_frac_mid_16k_fx[NB_SUBFR16k * 3] = { 18022, 14746, 0,//Q15 4915, 27853, 0, 0, 24576, 8192, 0, 11469, 21299, @@ -2695,7 +2699,7 @@ const float interpol_frac_mid_relaxprev_12k8[NB_SUBFR*3] = { 0.0f, 0.0f, 1.0f }; -const Word16 interpol_frac_mid_relaxprev_12k8_fx[NB_SUBFR * 3] = { 0, 22938, 9830, +const Word16 interpol_frac_mid_relaxprev_12k8_fx[NB_SUBFR * 3] = { 0, 22938, 9830,//Q15 0, 0, 32767, 0, 0, 32767, 0, 0, 32767 @@ -2706,7 +2710,7 @@ const float interpol_frac_mid_FEC[NB_SUBFR*3] = { 0.00f, 0.45f, 0.55f, 0.00f, 0.00f, 1.00f }; -const Word16 interpol_frac_mid_FEC_fx[NB_SUBFR * 3] = { 8192, 18022, 6554, +const Word16 interpol_frac_mid_FEC_fx[NB_SUBFR * 3] = { 8192, 18022, 6554,//Q15 0, 22938, 9830, 0, 14746, 18022, 0, 0, 32767 @@ -2719,7 +2723,7 @@ const float interpol_frac_mid_relaxprev_pred_12k8[NB_SUBFR*3] = { 0.00f, 0.50f, 0.50f, 0.00f, 0.0f, 1.00f }; -const Word16 interpol_frac_mid_relaxprev_pred_12k8_fx[NB_SUBFR * 3] = { 4915, 22938, 4915, +const Word16 interpol_frac_mid_relaxprev_pred_12k8_fx[NB_SUBFR * 3] = { 4915, 22938, 4915,//Q15 1638, 21299, 9830, 0, 16384, 16384, 0, 0, 32767 @@ -2732,7 +2736,7 @@ const float interpol_frac_mid_relaxprev_16k[NB_SUBFR16k*3] = { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f }; -const Word16 interpol_frac_mid_relaxprev_16k_fx[NB_SUBFR16k * 3] = { 0, 22938, 9830, +const Word16 interpol_frac_mid_relaxprev_16k_fx[NB_SUBFR16k * 3] = { 0, 22938, 9830,//Q15 0, 0, 32767, 0, 0, 32767, 0, 0, 32767, @@ -2747,7 +2751,7 @@ const float interpol_frac_mid_16k_FEC[NB_SUBFR16k*3] = { 0.0f, 0.15f, 0.85f, 0.0f, 0.00f, 1.00f }; -const Word16 interpol_frac_mid_16k_FEC_fx[NB_SUBFR16k * 3] = { 13107, 13107, 6554, +const Word16 interpol_frac_mid_16k_FEC_fx[NB_SUBFR16k * 3] = { 13107, 13107, 6554,//Q15 0, 26214, 6554, 0, 21299, 11469, 0, 4915, 27853, @@ -2761,7 +2765,7 @@ const float interpol_frac_mid_relaxprev_pred_16k[NB_SUBFR16k*3] = { 0.00f, 0.15f, 0.85f, 0.00f, 0.0f, 1.00f }; -const Word16 interpol_frac_mid_relaxprev_pred_16k_fx[NB_SUBFR16k * 3] = { 4915, 22938, 4915, +const Word16 interpol_frac_mid_relaxprev_pred_16k_fx[NB_SUBFR16k * 3] = { 4915, 22938, 4915,//Q15 1638, 21299, 9830, 0, 16384, 16384, 0, 4915, 27853, @@ -2981,7 +2985,7 @@ const float gain_qua_mless_7b[128*2] = 1.2298f, 1.0376f }; const Word16 gain_qua_mless_7b_fx[128*2] = -{ +{//Q14 419, 28, 1499, 607, 1586, 322, @@ -3180,7 +3184,7 @@ const float gain_qua_mless_6b_stereo[64*2]= }; const Word16 gain_qua_mless_6b_stereo_fx[64 * 2] = -{ +{//Q14 570, 695, 932, 535, 972, 913, @@ -3315,7 +3319,7 @@ const float gain_qua_mless_6b[64*2] = 1.1911f, 0.6722f }; const Word16 gain_qua_mless_6b_fx[64 * 2] = -{ +{//Q14 1676, 71, 2128, 198, 2318, 491, @@ -3417,7 +3421,7 @@ const float gain_qua_mless_5b[32*2] = 1.1529f, 0.9632f }; const Word16 gain_qua_mless_5b_fx[32 * 2] = -{ +{//Q14 2695, 109, 3444, 271, 3529, 433, @@ -3452,8 +3456,8 @@ const Word16 gain_qua_mless_5b_fx[32 * 2] = 18889, 493, }; -const int16_t E_ROM_qua_gain5b_const[NB_QUA_GAIN5B * 2]= -{ +const Word16 E_ROM_qua_gain5b_const[NB_QUA_GAIN5B * 2]= +{//Q0 1774,577, 2090,1805, 2103,3371, @@ -3489,7 +3493,7 @@ const int16_t E_ROM_qua_gain5b_const[NB_QUA_GAIN5B * 2]= }; const Word16 E_ROM_qua_gain6b_const[NB_QUA_GAIN6B * 2] = -{ +{//Q0 0,2758, 143,3562, 397,2146, @@ -3556,8 +3560,8 @@ const Word16 E_ROM_qua_gain6b_const[NB_QUA_GAIN6B * 2] = 18576,3563, }; -const int16_t E_ROM_qua_gain7b_const[NB_QUA_GAIN7B * 2] = -{ +const Word16 E_ROM_qua_gain7b_const[NB_QUA_GAIN7B * 2] = +{//Q0 123,2777, 369,2102, 404,4368, @@ -3693,7 +3697,7 @@ const int16_t E_ROM_qua_gain7b_const[NB_QUA_GAIN7B * 2] = *----------------------------------------------------------------------------------*/ const float pred_gain[GAIN_PRED_ORDER] = { 0.5f, 0.4f, 0.3f, 0.2f }; -const Word16 pred_gain_fx[GAIN_PRED_ORDER] = { 8192, 6554, 4915, 3277 }; +const Word16 pred_gain_fx[GAIN_PRED_ORDER] = { 8192, 6554, 4915, 3277 };//Q14 /*----------------------------------------------------------------------------------* * 6-bit gain quantization table (only for AMR-WB IO mode) @@ -3767,7 +3771,7 @@ const float t_qua_gain6b[64*2] = 1.243327f, 7.268204f }; const Word16 t_qua_gain6b_fx[64 * 2] = -{ +{//Q14 1566, 1332, 1577, 3557, 3071, 6490, @@ -3971,7 +3975,7 @@ const float t_qua_gain7b[128*2] = 1.296012f, 9.684225f }; const Word16 t_qua_gain7b_fx[128 * 2] = -{ +{//Q14 204, 441, 464, 1977, 869, 1077, @@ -4142,7 +4146,7 @@ const float Es_pred_qua_5b[32] = 65.0000f }; const Word16 Es_pred_qua_5b_fx[32] = -{ +{//Q8 -2048, -525, 642, @@ -4198,7 +4202,7 @@ const float Es_pred_qua_4b[16] = 65.0000f }; const Word16 Es_pred_qua_4b_fx[16] = -{ +{//Q8 -2048, -36, 1828, @@ -4306,7 +4310,7 @@ const float b_3sfr[6] = { -0.11658f, 0.02674f, 0.13513f, 0.79682f, 0.02241f, 0.17815f }; -const Word16 b_3sfr_fx[6] = +const Word16 b_3sfr_fx[6] =//Q12 { -478, 110, 553, 3264, 92, 730 }; @@ -4315,7 +4319,7 @@ const float b_4sfr[8] = { -0.09296f, 0.01578f, -0.06606f, 0.20416f, 0.79254f, 0.00829f, 0.03499f, 0.15859f }; -const Word16 b_4sfr_fx[8] = +const Word16 b_4sfr_fx[8] =//Q12 { -381, 65, -271, 836, 3246, 34, 143, 650 }; @@ -6597,7 +6601,7 @@ const float deem_tab[56] = 0.595767611250409f, 0.595627053220407f, 0.595508161367956f, 0.595410914747406f, 0.595335296233253f, 0.595281292513031f, 0.595248894081778f }; const Word16 deem_tab_fx[56] = -{ +{//Q15 20668, 20625, 20583, 20541, 20501, 20462, 20423, 20385, 20348, 20313, 20277, 20243, 20210, 20177, 20146, 20115, 20085, 20055, 20027, 19999, 19972, 19946, 19921, 19896, @@ -6622,7 +6626,7 @@ const float filt_hp[56] = 0.983792375705577f, 0.992691651376520f }; const Word16 filt_hp_fx[56] = -{ +{//Q15 53, 153, 274, 415, 578, 765, 978, 1217, 1483, 1778, 2102, 2457, 2843, 3261, 3710, 4192, 4706, 5252, 5829, 6438, 7077, 7746, 8443, 9168, 9918, 10693, 11489, 12306, 13141, 13992, @@ -6692,7 +6696,7 @@ const float HP_gain[16] = 0.511779785156250f, 0.599822998046875f, 0.741241455078125f, 0.998779296875000f }; const Word16 HP_gain_fx[16] = -{ +{//Q15 3624, 4673, 5597, 6479, 7425, 8378, 9324, 10264, 11210, 12206, 13391, 14844, 16770, 19655, 24289, 32728 }; @@ -6750,7 +6754,7 @@ const float fir_6k_7k[31] = -0.001005f }; const Word16 fir_6k_7k_fx[31] = -{ +{//Q15 -32, 47, 32, -27, -369, 1122, -1421, 0, 3798, -8880, 12349, -10984, 3548, 7766, -18001, @@ -6760,7 +6764,7 @@ const Word16 fir_6k_7k_fx[31] = -32 }; const Word16 no_lead_fx[][MAX_NO_SCALES * 2] = -{ +{//Q0 { 1, 0, 0, 1, 0, 0, }, /* 14 */ { 2, 0, 0, 1, 0, 0, }, /* 15 */ { 4, 2, 0, 1, 0, 0, }, /* 18 */ @@ -6899,7 +6903,7 @@ const Word16 no_lead_fx[][MAX_NO_SCALES * 2] = }; -const Word16 no_lead_p_fx[][MAX_NO_SCALES * 2] = +const Word16 no_lead_p_fx[][MAX_NO_SCALES * 2] = // Q0 { { 2, 1, 0, 0, 0, 0, }, /* 9 (8.464) */ @@ -7192,7 +7196,7 @@ const Word16 filt_lp_16kHz_fx[1 + L_FILT16k] = * Pulse indexing tables for ACELP innovation coding *-------------------------------------------------------------------*/ -const int32_t PI_select_table[23][8] = +const Word32 PI_select_table[23][8] = // Q0 { {1, 0, 0, 0, 0, 0, 0, 0}, {1, 1, 0, 0, 0, 0, 0, 0}, @@ -7219,7 +7223,7 @@ const int32_t PI_select_table[23][8] = {1, 22, 231, 1540, 7315, 26334, 74613, 1705444} }; -const int32_t PI_offset[8][8] = +const Word32 PI_offset[8][8] = // Q0 { /* for 0p(0). */ {0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000,0x00000}, @@ -7239,15 +7243,15 @@ const int32_t PI_offset[8][8] = {0x00000,0x00000,0x165800,0x454400,0x654200,0x6E2500,0x6F2B80,0x6F36C0} }; -const int16_t PI_factor[7] = {0,0,120,560,1820,4368,8008}; +const Word16 PI_factor[7] = {0,0,120,560,1820,4368,8008}; // Q0 /* ACELP pulse coding */ -const Word16 hi_to_low_tmpl[10] = { 0, 0, 0, 3, 9, 5, 3, 1, 8, 8 }; -const uint16_t low_len[10] = { 0, 0, 8, 5, 7,11,13,15,16,16 }; -const uint16_t low_mask[10] = { 0, 0, 255,31,127,2047,8191,32767,65535,65535 }; -const uint16_t indx_fact[10] = { 0, 0,2,172,345,140,190,223,463,1732 }; -const int16_t index_len[3] = { 0, 5, 9 }; -const int16_t index_mask_ACELP[3] = { 0, 31, 511 }; +const Word16 hi_to_low_tmpl[10] = { 0, 0, 0, 3, 9, 5, 3, 1, 8, 8 }; // Q0 +const UWord16 low_len[10] = { 0, 0, 8, 5, 7,11,13,15,16,16 }; // Q0 +const UWord16 low_mask[10] = { 0, 0, 255,31,127,2047,8191,32767,65535,65535 }; // Q0 +const UWord16 indx_fact[10] = { 0, 0,2,172,345,140,190,223,463,1732 }; // Q0 +const Word16 index_len[3] = { 0, 5, 9 }; // Q0 +const Word16 index_mask_ACELP[3] = { 0, 31, 511 }; // Q0 /*------------------------------------------------------------------------------* @@ -7734,7 +7738,7 @@ const Word16 edct_table_80_fx[80] = /*Q16 */ }; const Word16 edct_table_100_fx[] = -{ +{/*Q16 */ 20723, 20718, 20708, 20692, 20672, 20646, 20616, 20580, 20539, 20493, 20442, 20386, 20325, 20259, 20188, 20112, 20031, 19946, 19855, 19759, 19658, 19553, 19443, 19328, @@ -7877,7 +7881,7 @@ const Word16 edct_table_480_fx[480] = /*Q16 */ 344, 298, 252, 206, 160, 115, 69, 23 }; -const Word16 edct_table_600_fx[] = +const Word16 edct_table_600_fx[] =/*Q16 */ { 26483, 26483, 26483, 26482, 26481, 26481, 26479, 26478, 26477, 26475, 26473, 26471, 26469, 26467, 26464, 26461, @@ -8017,7 +8021,7 @@ const Word16 edct_table_20_fx[20] = /*Q16 */ }; -const Word16 edct_table_64_fx[] = +const Word16 edct_table_64_fx[] =/*Q16 */ { 23167, 23153, 23125, 23083, 23027, 22958, 22874, 22777, 22666, 22542, 22403, 22252, 22087, 21908, 21717, 21512, @@ -8030,7 +8034,7 @@ const Word16 edct_table_64_fx[] = }; -const Word16 edct_table_200_fx[] = +const Word16 edct_table_200_fx[] =/*Q16 */ { 17427, 17426, 17423, 17420, 17416, 17411, 17404, 17397, 17388, 17378, 17368, 17356, 17343, 17329, 17314, 17298, @@ -8059,7 +8063,7 @@ const Word16 edct_table_200_fx[] = 1026, 889, 753, 616, 479, 342, 205, 68 }; -const Word16 edct_table_240_fx[] = +const Word16 edct_table_240_fx[] =/*Q16 */ { 16650, 16650, 16648, 16646, 16643, 16640, 16635, 16630, 16625, 16618, 16611, 16603, 16595, 16585, 16575, 16565, @@ -8093,7 +8097,7 @@ const Word16 edct_table_240_fx[] = 817, 708, 599, 490, 381, 272, 163, 54 }; -const Word16 edct_table_256_fx[] = +const Word16 edct_table_256_fx[] =/*Q16 */ { 16384, 16383, 16382, 16380, 16378, 16375, 16371, 16367, 16362, 16356, 16350, 16343, 16336, 16328, 16319, 16310, @@ -8129,7 +8133,7 @@ const Word16 edct_table_256_fx[] = 754, 653, 553, 452, 352, 251, 151, 50 }; -const Word16 edct_table_400_fx[] = +const Word16 edct_table_400_fx[] =/*Q16 */ { 29308, 29308, 29307, 29306, 29304, 29302, 29299, 29296, 29292, 29288, 29284, 29279, 29273, 29267, 29261, 29254, @@ -8183,7 +8187,7 @@ const Word16 edct_table_400_fx[] = 863, 748, 633, 518, 403, 288, 173, 58 }; -const Word16 edct_table_320_16fx[320] = +const Word16 edct_table_320_16fx[320] =/*Q16 */ { 7747, 7747, 7747, 7746, 7746, 7745, 7744, 7742, 7741, 7739, 7737, 7735, 7733, 7730, 7728, 7725, @@ -8245,7 +8249,7 @@ const Word16 edct_table_128_16fx[128] = /*Q15 */ 1842, 1724, 1607, 1489, 1370, 1252, 1133, 1014, 895, 776, 657, 538, 418, 299, 179, 60 }; -const Word16 edct_table_160_16fx[160] = +const Word16 edct_table_160_16fx[160] =//Q15 { 9213, 9212, 9211, 9208, 9204, 9200, 9195, 9188, 9181, 9173, 9164, 9155, 9144, 9132, 9120, 9107, @@ -8294,7 +8298,7 @@ const float mean_isf_amr_wb[M] = 1576.906494f }; -const Word16 mean_isf_amr_wb_fx[M] = +const Word16 mean_isf_amr_wb_fx[M] =/*Qlog2(2.56)*/ { 738, 1326, 2336, 3578, 4596, 5662, 6711, 7730, 8750, 9753,10705, 11728, 12833, 13971,15043, 4037 @@ -8324,7 +8328,7 @@ const float mean_isf_noise_amr_wb[M] = 1485.457031f }; -const Word16 mean_isf_noise_amr_wb_fx[M] = +const Word16 mean_isf_noise_amr_wb_fx[M] =/*Qlog2(2.56)*/ { 478, 1100, 2213, 3267, 4219, 5222, 6198, 7240, 8229, 9153,10098, 11108, 12144, 13184,14165, 3803 @@ -8335,7 +8339,7 @@ const Word16 mean_isf_noise_amr_wb_fx[M] = * Indirection for 1st stage 1st split of 46 bit cb. : The transmitted_index = indirect_dico1[found_index]; *------------------------------------------------------*/ -const Word16 Indirect_dico1[SIZE_BK1] = +const Word16 Indirect_dico1[SIZE_BK1] = // Q0 { 2, 6, 18, 22, 34, 35, 38, 50, 66, 67, 70, 82, 98, 99, 102, 130, @@ -8531,7 +8535,7 @@ const Word16 gaus_dico_swb_fx[256] = * CLDFB tables *----------------------------------------------------------------------------------*/ -const int16_t freqTable[2] = {20, 40}; +const Word16 freqTable[2] = {20, 40}; // Q0 /* SNR: 109.44, PHASE: 3.500000000000000 */ const float CLDFB80_10_flt[100] = @@ -9824,7 +9828,7 @@ const float rot_vec_ana_im_L60[30] = * abs. max Val: 1.04 * scale: 0.50 */ -const Word16 CLDFB80_10[] = +const Word16 CLDFB80_10[] =//Q.5 { W16(0x0000), W16(0xfffc), W16(0xffdf), W16(0x0132), W16(0x23b5), W16(0x0000), W16(0xffff), W16(0xfff3), W16(0x018d), W16(0x2a98), @@ -9856,7 +9860,7 @@ const Word16 CLDFB80_10[] = * abs. max Val: 1.04 * scale: 0.50 */ -const Word16 CLDFB80_16[] = +const Word16 CLDFB80_16[] =//Q.5 { W16(0x0000), W16(0xfffb), W16(0xffdd), W16(0x0123), W16(0x2266), W16(0x0000), W16(0xfffe), W16(0xffe7), W16(0x0157), W16(0x26c0), @@ -9900,7 +9904,7 @@ const Word16 CLDFB80_16[] = * abs. max Val: 1.04 * scale: 0.50 */ -const Word16 CLDFB80_20[] = +const Word16 CLDFB80_20[] =//Q.5 { W16(0x0000), W16(0xfffb), W16(0xffdf), W16(0x011e), W16(0x21f7), W16(0x0000), W16(0xfffd), W16(0xffe1), W16(0x0146), W16(0x2573), @@ -9952,7 +9956,7 @@ const Word16 CLDFB80_20[] = * abs. max Val: 1.04 * scale: 0.50 */ -const Word16 CLDFB80_32[] = +const Word16 CLDFB80_32[] =//Q.5 { W16(0x0000), W16(0xfffb), W16(0xffe2), W16(0x0115), W16(0x214f), W16(0x0000), W16(0xfffc), W16(0xffde), W16(0x012f), W16(0x237e), @@ -10028,7 +10032,7 @@ const Word16 CLDFB80_32[] = * abs. max Val: 1.04 * scale: 0.50 */ -const Word16 CLDFB80_40[] = +const Word16 CLDFB80_40[] =//Q.5 { W16(0x0000), W16(0xfffa), W16(0xffe2), W16(0x0112), W16(0x2117), W16(0x0000), W16(0xfffb), W16(0xffdc), W16(0x0128), W16(0x22d6), @@ -10120,7 +10124,7 @@ const Word16 CLDFB80_40[] = * abs. max Val: 1.04 * scale: 0.50 */ -const Word16 CLDFB80_60[] = +const Word16 CLDFB80_60[] =//Q.5 { W16(0x0000), W16(0xfffa), W16(0xffe2), W16(0x010f), W16(0x20cd), W16(0x0000), W16(0xfffb), W16(0xffdf), W16(0x011e), W16(0x21f7), @@ -10244,7 +10248,7 @@ const Word16 CLDFB80_60[] = W16(0x0002), W16(0x0020), W16(0xff00), W16(0xe05e), W16(0x00a9) }; -const Word16 CLDFB80_30[] = +const Word16 CLDFB80_30[] =//Q.5 { 0, -5, -30, 278, 8546, 0, -4, -33, 306, 9141, @@ -10307,7 +10311,7 @@ const Word16 CLDFB80_30[] = 0, 18, -223, -7348, 682, 0, 32, -249, -7947, 282 }; - +#if 0// Not used anywhere const Word16 LDQMF_10_enc_fx[] = { 2, -21, 79, -1890, 8640, @@ -10750,7 +10754,7 @@ const Word16 LDQMF_60_enc_fx[] = 9, -121, 1012, -9642, -21, 12, -113, 1199, -9421, -13 }; - +#endif /*! * \brief CLDFB rRotVectr * @@ -10758,7 +10762,7 @@ const Word16 LDQMF_60_enc_fx[] = * global gain: 8.00 * scale: sqrt(1.0/16.00) */ -const Word16 rRotVectr_10[] = +const Word16 rRotVectr_10[] =//Q(sqrt(1.0/16.00)) { W16(0x5a71), W16(0x54ea), W16(0x4714), W16(0x3249), W16(0x1891) }; @@ -10770,7 +10774,7 @@ const Word16 rRotVectr_10[] = * global gain: 8.00 * scale: sqrt(1.0/16.00) */ -const Word16 iRotVectr_10[] = +const Word16 iRotVectr_10[] =//Q(sqrt(1.0/16.00)) { W16(0xfc72), W16(0xe0ac), W16(0xc7f7), W16(0xb4be), W16(0xa8e3) }; @@ -10782,7 +10786,7 @@ const Word16 iRotVectr_10[] = * global gain: 5.00 * scale: sqrt(1.0/8.00) */ -const Word16 rRotVectr_16[] = +const Word16 rRotVectr_16[] =//Q(sqrt(1.0/8.00)) { W16(0x652a), W16(0x62bc), W16(0x5c83), W16(0x52bc), W16(0x45c7), W16(0x3623), W16(0x246b), W16(0x114d) @@ -10795,7 +10799,7 @@ const Word16 rRotVectr_16[] = * global gain: 5.00 * scale: sqrt(1.0/8.00) */ -const Word16 iRotVectr_16[] = +const Word16 iRotVectr_16[] =//Q(sqrt(1.0/8.00)) { W16(0xfd84), W16(0xe9d4), W16(0xd6fe), W16(0xc5bb), W16(0xb6b6), W16(0xaa82), W16(0xa196), W16(0x9c4c) @@ -10808,7 +10812,7 @@ const Word16 iRotVectr_16[] = * global gain: 4.00 * scale: sqrt(1.0/8.00) */ -const Word16 rRotVectr_20[] = +const Word16 rRotVectr_20[] =//Q(sqrt(1.0/8.00)) { W16(0x5a7e), W16(0x591a), W16(0x5584), W16(0x4fd3), W16(0x482a), W16(0x3ebb), W16(0x33c1), W16(0x2780), W16(0x1a46), W16(0x0c67) @@ -10821,7 +10825,7 @@ const Word16 rRotVectr_20[] = * global gain: 4.00 * scale: sqrt(1.0/8.00) */ -const Word16 iRotVectr_20[] = +const Word16 iRotVectr_20[] =//Q(sqrt(1.0/8.00) { W16(0xfe39), W16(0xf017), W16(0xe259), W16(0xd556), W16(0xc95f), W16(0xbec1), W16(0xb5bf), W16(0xae90), W16(0xa963), W16(0xa658) @@ -10834,7 +10838,7 @@ const Word16 iRotVectr_20[] = * global gain: 2.50 * scale: sqrt(1.0/4.00) */ -const Word16 rRotVectr_30[] = +const Word16 rRotVectr_30[] =//Q(sqrt(1.0/4.00)) { 25902, 25725, 25265, 24529, 23525, 22262, 20756, 19022, 17080, 14950, 12657, 10226, 7682, 5054, 2370 }; @@ -10846,7 +10850,7 @@ const Word16 rRotVectr_30[] = * global gain: 2.50 * scale: sqrt(1.0/4.00) */ -const Word16 iRotVectr_30[] = +const Word16 iRotVectr_30[] =//Q(sqrt(1.0/4.00)) { -339, -3045, -5717, -8327, -10845, -13245, -15499, -17584, -19476, -21154, -22601, -23801, -24739, -25406, -25796 }; @@ -10857,7 +10861,7 @@ const Word16 iRotVectr_30[] = * global gain: 2.50 * scale: sqrt(1.0/4.00) */ -const Word16 rRotVectr_32[] = +const Word16 rRotVectr_32[] =//Q(sqrt(1.0/4.00)) { W16(0x652f), W16(0x6494), W16(0x6300), W16(0x6078), W16(0x5d02), W16(0x58a7), W16(0x5371), W16(0x4d6e), W16(0x46ac), W16(0x3f3b), @@ -10872,7 +10876,7 @@ const Word16 rRotVectr_32[] = * global gain: 2.50 * scale: sqrt(1.0/4.00) */ -const Word16 iRotVectr_32[] = +const Word16 iRotVectr_32[] =//Q(sqrt(1.0/4.00)) { W16(0xfec2), W16(0xf4d9), W16(0xeb0b), W16(0xe170), W16(0xd821), W16(0xcf35), W16(0xc6c1), W16(0xbed9), W16(0xb793), W16(0xb0ff), @@ -10887,7 +10891,7 @@ const Word16 iRotVectr_32[] = * global gain: 2.00 * scale: sqrt(1.0/4.00) */ -const Word16 rRotVectr_40[] = +const Word16 rRotVectr_40[] =//Q(sqrt(1.0/4.00)) { W16(0x5a81), W16(0x5a28), W16(0x5941), W16(0x57cc), W16(0x55cd), W16(0x5347), W16(0x503d), W16(0x4cb4), W16(0x48b3), W16(0x443e), @@ -10902,7 +10906,7 @@ const Word16 rRotVectr_40[] = * global gain: 2.00 * scale: sqrt(1.0/4.00) */ -const Word16 iRotVectr_40[] = +const Word16 iRotVectr_40[] =//Q(sqrt(1.0/4.00)) { W16(0xff1d), W16(0xf803), W16(0xf0f7), W16(0xea02), W16(0xe330), W16(0xdc8b), W16(0xd61f), W16(0xcff4), W16(0xca15), W16(0xc48c), @@ -10917,7 +10921,7 @@ const Word16 iRotVectr_40[] = * global gain: 1.33 * scale: sqrt(1.0/2.00) */ -const Word16 rRotVectr_60[] = +const Word16 rRotVectr_60[] =//Q(sqrt(1.0/2.00)) { W16(0x6882), W16(0x6855), W16(0x67de), W16(0x671e), W16(0x6615), W16(0x64c5), W16(0x632f), W16(0x6153), W16(0x5f32), W16(0x5ccf), @@ -10934,7 +10938,7 @@ const Word16 rRotVectr_60[] = * global gain: 1.33 * scale: sqrt(1.0/2.00) */ -const Word16 iRotVectr_60[] = +const Word16 iRotVectr_60[] =//Q(sqrt(1.0/2.00)) { W16(0xff51), W16(0xf9d9), W16(0xf465), W16(0xeefa), W16(0xe99a), W16(0xe44a), W16(0xdf0e), W16(0xd9e9), W16(0xd4de), W16(0xcff2), @@ -10944,15 +10948,15 @@ const Word16 iRotVectr_60[] = W16(0x9ae0), W16(0x99a2), W16(0x98ac), W16(0x97fe), W16(0x9799) }; -const Word16 cldfb_anaScale[] = +const Word16 cldfb_anaScale[] = // Q0 { SCALE_CLDFB_ANA_10, SCALE_CLDFB_ANA_16, SCALE_CLDFB_ANA_20, SCALE_CLDFB_ANA_32, SCALE_CLDFB_ANA_40, SCALE_CLDFB_ANA_60, SCALE_CLDFB_ANA_30 }; -const Word16 cldfb_synScale[] = +const Word16 cldfb_synScale[] = // Q0 { SCALE_CLDFB_SYN_10, SCALE_CLDFB_SYN_16, SCALE_CLDFB_SYN_20, SCALE_CLDFB_SYN_32, SCALE_CLDFB_SYN_40, SCALE_CLDFB_SYN_60, SCALE_CLDFB_SYN_30 }; -const Word16 cldfb_synGain[] = +const Word16 cldfb_synGain[] =//Q0 { 0x6666, /* 10 bands */ 0x51EC, /* 16 bands */ @@ -10966,7 +10970,7 @@ const Word16 *cldfb_protoFilter_2_5ms[] = { CLDFB80_10, CLDFB80_16, CLDFB80_20, CLDFB80_32, CLDFB80_40, CLDFB80_60, CLDFB80_30 }; -#ifdef IVAS_FLOAT_FIXED +#if 0 //def IVAS_FLOAT_FIXED not used anywhere const Word16 *cldfb_protoFilter_5_0ms[] = { LDQMF_10_enc_fx, LDQMF_16_enc_fx, LDQMF_20_enc_fx, LDQMF_32_enc_fx, LDQMF_40_enc_fx, LDQMF_60_enc_fx, LDQMF_30_enc_fx @@ -11737,39 +11741,39 @@ const Word16 scaleTable_cn_only_amrwbio[3][2] = { ACELP_8k85, 16306/*0.9952622652 Q14*/ }, { ACELP_12k65, 9583/*0.5848932266 Q14*/ }, }; -const Word32 scaleTable_cn_only_amrwbio_fx_by_10f[SIZE_SCALE_TABLE_CN_AMRWB][2] = +const Word32 scaleTable_cn_only_amrwbio_fx_by_10f[SIZE_SCALE_TABLE_CN_AMRWB][2] =//Q29 { { ACELP_6k60, 858993459 }, { ACELP_8k85, 644245094 }, { ACELP_12k65, 429496729 } }; -const int16_t sidparts_encoder_noise_est[SIZE_SIDPARTS_ENC_NOISE_EST] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 259, 264, 269, 279 }; +const Word16 sidparts_encoder_noise_est[SIZE_SIDPARTS_ENC_NOISE_EST] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 259, 264, 269, 279 }; // Q0 -const int16_t sidPartitions_nb[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 159 }; -const int16_t sidPartitions_wb1[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255 }; -const int16_t sidPartitions_wb2[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 259 }; -const int16_t sidPartitions_wb3[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 319 }; -const int16_t sidPartitions_swb1[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 259, 264, 269, 274 }; -const int16_t sidPartitions_swb2[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 319, 324, 329, 339 }; +const Word16 sidPartitions_nb[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 159 }; // Q0 +const Word16 sidPartitions_wb1[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255 }; // Q0 +const Word16 sidPartitions_wb2[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 259 }; // Q0 +const Word16 sidPartitions_wb3[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 319 }; // Q0 +const Word16 sidPartitions_swb1[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 259, 264, 269, 274 }; // Q0 +const Word16 sidPartitions_swb2[] = { 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 58, 68, 80, 92, 108, 126, 148, 176, 212, 255, 319, 324, 329, 339 }; // Q0 -const int16_t shapingPartitions_nb[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 136, 159 }; -const int16_t shapingPartitions_wb1[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 135, 148, 162, 176, 192, 212, 232, 255 }; -const int16_t shapingPartitions_wb2[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 135, 148, 162, 176, 192, 212, 232, 255 }; -const int16_t shapingPartitions_wb3[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 136, 148, 176, 212, 256, 308, 319 }; -const int16_t shapingPartitions_swb1[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 135, 148, 162, 176, 192, 212, 232, 255 }; -const int16_t shapingPartitions_swb2[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 136, 148, 176, 212, 256, 308, 319 }; +const Word16 shapingPartitions_nb[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 136, 159 }; // Q0 +const Word16 shapingPartitions_wb1[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 135, 148, 162, 176, 192, 212, 232, 255 }; // Q0 +const Word16 shapingPartitions_wb2[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 135, 148, 162, 176, 192, 212, 232, 255 }; // Q0 +const Word16 shapingPartitions_wb3[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 136, 148, 176, 212, 256, 308, 319 }; // Q0 +const Word16 shapingPartitions_swb1[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 135, 148, 162, 176, 192, 212, 232, 255 }; // Q0 +const Word16 shapingPartitions_swb2[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 28, 31, 34, 37, 40, 43, 47, 51, 55, 59, 64, 69, 74, 80, 86, 93, 100, 108, 117, 126, 136, 148, 176, 212, 256, 308, 319 }; // Q0 -const FD_CNG_SETUP FdCngSetup_nb = { 512, 160, sizeof(sidPartitions_nb)/sizeof(int16_t), sidPartitions_nb, sizeof(shapingPartitions_nb)/sizeof(int16_t), shapingPartitions_nb }; -const FD_CNG_SETUP FdCngSetup_wb1 = { 512, 256, sizeof(sidPartitions_wb1)/sizeof(int16_t), sidPartitions_wb1, sizeof(shapingPartitions_wb1)/sizeof(int16_t), shapingPartitions_wb1 }; -const FD_CNG_SETUP FdCngSetup_wb2 = { 512, 256, sizeof(sidPartitions_wb2)/sizeof(int16_t), sidPartitions_wb2, sizeof(shapingPartitions_wb2)/sizeof(int16_t), shapingPartitions_wb2 }; -const FD_CNG_SETUP FdCngSetup_wb3 = { 640, 320, sizeof(sidPartitions_wb3)/sizeof(int16_t), sidPartitions_wb3, sizeof(shapingPartitions_wb3)/sizeof(int16_t), shapingPartitions_wb3 }; -const FD_CNG_SETUP FdCngSetup_swb1 = { 512, 256, sizeof(sidPartitions_swb1)/sizeof(int16_t), sidPartitions_swb1, sizeof(shapingPartitions_swb1)/sizeof(int16_t), shapingPartitions_swb1 }; -const FD_CNG_SETUP FdCngSetup_swb2 = { 640, 320, sizeof(sidPartitions_swb2)/sizeof(int16_t), sidPartitions_swb2, sizeof(shapingPartitions_swb2)/sizeof(int16_t), shapingPartitions_swb2 }; +const FD_CNG_SETUP FdCngSetup_nb = { 512, 160, sizeof(sidPartitions_nb)/sizeof(Word16), sidPartitions_nb, sizeof(shapingPartitions_nb)/sizeof(Word16), shapingPartitions_nb }; +const FD_CNG_SETUP FdCngSetup_wb1 = { 512, 256, sizeof(sidPartitions_wb1)/sizeof(Word16), sidPartitions_wb1, sizeof(shapingPartitions_wb1)/sizeof(Word16), shapingPartitions_wb1 }; +const FD_CNG_SETUP FdCngSetup_wb2 = { 512, 256, sizeof(sidPartitions_wb2)/sizeof(Word16), sidPartitions_wb2, sizeof(shapingPartitions_wb2)/sizeof(Word16), shapingPartitions_wb2 }; +const FD_CNG_SETUP FdCngSetup_wb3 = { 640, 320, sizeof(sidPartitions_wb3)/sizeof(Word16), sidPartitions_wb3, sizeof(shapingPartitions_wb3)/sizeof(Word16), shapingPartitions_wb3 }; +const FD_CNG_SETUP FdCngSetup_swb1 = { 512, 256, sizeof(sidPartitions_swb1)/sizeof(Word16), sidPartitions_swb1, sizeof(shapingPartitions_swb1)/sizeof(Word16), shapingPartitions_swb1 }; +const FD_CNG_SETUP FdCngSetup_swb2 = { 640, 320, sizeof(sidPartitions_swb2)/sizeof(Word16), sidPartitions_swb2, sizeof(shapingPartitions_swb2)/sizeof(Word16), shapingPartitions_swb2 }; -const int16_t levels_37bits[FD_CNG_stages_37bits] = { 128, 64, 64, 64, 64, 64 }; -const int16_t bits_37bits[FD_CNG_stages_37bits] = { 7, 6, 6, 6, 6, 6 }; +const Word16 levels_37bits[FD_CNG_stages_37bits] = { 128, 64, 64, 64, 64, 64 }; // Q0 +const Word16 bits_37bits[FD_CNG_stages_37bits] = { 7, 6, 6, 6, 6, 6 }; // Q0 /* IDCT_MATRIX_ROM: 18*24 Word16 = 432 Word16 */ /* or compressed IDCT_MATRIX_ROM: 18*24 Word8 + 25 = 230 Word16 + WMOPS (INDIRECT(432) and STORE(432) ) */ @@ -11782,8 +11786,8 @@ const int16_t bits_37bits[FD_CNG_stages_37bits] = { 7, 6, 6, 6, 6, 6 }; /* additional minor Table ROM ( dct_mid points 18 Word16, dct_col_upshifts 52, scaleFactors 2*2 = ~= 74 Word16s */ -const Word16 cdk1_ivas_entries_per_segment[FDCNG_VQ_DCT_NSEGM] = { 16, 17, 17, 78 }; -const Word16 cdk1_ivas_cum_entries_per_segment[FDCNG_VQ_DCT_NSEGM + 1] = { 0, 16 ,33, 50, 128 }; +const Word16 cdk1_ivas_entries_per_segment[FDCNG_VQ_DCT_NSEGM] = { 16, 17, 17, 78 }; // Q0 +const Word16 cdk1_ivas_cum_entries_per_segment[FDCNG_VQ_DCT_NSEGM + 1] = { 0, 16 ,33, 50, 128 }; // Q0 const Word16 /* DCT trunc_len */ cdk1_ivas_cols_per_segment[FDCNG_VQ_DCT_NSEGM] = { FDCNG_VQ_DCT_MINTRUNC, 10, 16, FDCNG_VQ_DCT_MAXTRUNC }; /* 8, 10, 16, 18 */ const Word16 /* segment inner DCT trunc_len */ cdk1_ivas_trunc_dct_cols_per_segment[FDCNG_VQ_DCT_NSEGM] = { FDCNG_VQ_DCT_MAXTRUNC - FDCNG_VQ_DCT_MINTRUNC, FDCNG_VQ_DCT_MAXTRUNC - 10 , FDCNG_VQ_DCT_MAXTRUNC - 16 , 0 }; @@ -11810,30 +11814,30 @@ const Word8* const cdk_37bits_ivas_stage1_W8Qx_dct_sections[] = { cdk1_ivas_dct_ /* scaling constants */ const float fdcng_dct_scaleF[3] = { 0.420288085937500f , (0.420288085937500f / 16.0f) , (0.420288085937500f * 0.420288085937500f) / (16.0f*16.0f) }; const float fdcng_dct_invScaleF[2] = { 2.379272460937500f ,2.379272460937500f*16.0f }; -const Word32 fdcng_dct_scaleF_fx[3] = { 902561792, 56410112,1481781 }; +const Word32 fdcng_dct_scaleF_fx[3] = { 902561792, 56410112,1481781 };//Q31 -const Word16 stage1_col_syn_shift_segm0[8] = { +const Word16 stage1_col_syn_shift_segm0[8] = { // Q0 4, 4, 4, 3, 2, 2, 2, 1 }; -const Word16 stage1_col_syn_shift_segm1[10] = { +const Word16 stage1_col_syn_shift_segm1[10] = { // Q0 4, 4, 4, 3, 2, 2, 2, 1, 1, 1 }; -const Word16 stage1_col_syn_shift_segm2[16] = { +const Word16 stage1_col_syn_shift_segm2[16] = { // Q0 4, 4, 4, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 0, 1 }; -const Word16 stage1_col_syn_shift_segm3[18] = { +const Word16 stage1_col_syn_shift_segm3[18] = { // Q0 4, 4, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1 }; /* segment individual shiftfactor to Q4 for each stored DCT Word8 coeff column */ -const Word16 * stage1_dct_col_syn_shift[FDCNG_VQ_DCT_NSEGM] = { stage1_col_syn_shift_segm0, stage1_col_syn_shift_segm1,stage1_col_syn_shift_segm2,stage1_col_syn_shift_segm3 }; +const Word16 * stage1_dct_col_syn_shift[FDCNG_VQ_DCT_NSEGM] = { stage1_col_syn_shift_segm0, stage1_col_syn_shift_segm1,stage1_col_syn_shift_segm2,stage1_col_syn_shift_segm3 }; // Q0 -/* 25 unique abs values of idct24_18matrixQ16 */ +/* 25 unique abs values of idct24_18matrix Q16 */ const Word16 unique_idctT2_24coeffsQ16[25] = { 0, 1237, 2469, 3691, 4896, 6081, 7240, 8367, 9459, 10511, 11517, 12474, 13377, 14224, 15009, 15730, @@ -11857,10 +11861,10 @@ const Word8 idctT2_24_compressed_idx[(FDCNG_VQ_DCT_MAXTRUNC * FDCNG_VQ_MAX_LEN) 12, 5, -14, -15, 4, 23, 6, -13, -16, 3, 22, 7, -12, -17, 2, 21, 8, -11, 12, 3, -18, -9, 12, 15, -6, -21, 0, 21, 6, -15, -12, 9, 18, -3, -24, -3, 12, 1, -22, -3, 20, 5, -18, -7, 16, 9, -14, -11, 12, 13, -10, -15, 8, 17 -}; +}; // Q0 -const Word16 unique_idctT2_21coeffsQ16[23] = { +const Word16 unique_idctT2_21coeffsQ16[23] = {//Q16 0, 1511, 3014, 4500, 5961, 7389, 8775, 10112, 11393, 12610, 13756, 14301, 14826, 15812, 16711, 17515, 18222, 18827, 19326, 19718, 19999, 20168, 20225 @@ -11889,7 +11893,7 @@ const Word8 idctT2_21_compressed_idx[(FDCNG_VQ_DCT_MAXTRUNC *( (21/2) + 1)) /* /*tables in truncated DCTII_24 domain */ -const Word8 /*seg 0, 16 x 8 */ cdk1_ivas_dct_s0_W8[128] = { +const Word8 /*seg 0, 16 x 8 */ cdk1_ivas_dct_s0_W8[128] = { // Q0 29, -126, 8, -34, -45, -42, -13, 2, 22, -120, 0, -27, -41, -50, -25, 42, 20, -116, -2, -39, -61, -33, -22, -25, @@ -11908,7 +11912,7 @@ const Word8 /*seg 0, 16 x 8 */ cdk1_ivas_dct_s0_W8[128] = { -17, 125, 6, 74, 21, 85, 5, 98 }; -const Word8 /*seg 1, 17 x 10 */ cdk1_ivas_dct_s1_W8[170] = { +const Word8 /*seg 1, 17 x 10 */ cdk1_ivas_dct_s1_W8[170] = { // Q0 20, -127, -12, -9, 1, -30, -2, -1, -43, -54, 24, -113, 3, -39, -49, -25, -15, -27, 6, 2, 55, 17, 74, 22, 78, 77, 87, 97, 89, 61, @@ -11928,7 +11932,7 @@ const Word8 /*seg 1, 17 x 10 */ cdk1_ivas_dct_s1_W8[170] = { -8, 127, 23, 24, 58, 89, 46, 20, 14, 54 }; -const Word8 /*seg 2, 17 x 16 */ cdk1_ivas_dct_s2_W8[272] = { +const Word8 /*seg 2, 17 x 16 */ cdk1_ivas_dct_s2_W8[272] = { // Q0 32, -69, 21, 3, -9, 17, 3, 14, 15, 35, -17, -10, -20, 28, -52, -19, 24, -49, 17, 9, -6, 14, 22, 33, 51, 38, 21, 14, 5, 38, 13, -5, 27, -8, 30, 9, 93, 65, 65, 66, 67, 30, 39, 21, 9, 22, 5, -17, @@ -11948,7 +11952,7 @@ const Word8 /*seg 2, 17 x 16 */ cdk1_ivas_dct_s2_W8[272] = { 4, 117, 37, 43, 44, 32, 13, 75, 32, 33, 15, -70, 51, 39, 68, 15 }; -const Word8 /*seg 3, 78 x 18 */ cdk1_ivas_dct_s3_W8[1404] = { +const Word8 /*seg 3, 78 x 18 */ cdk1_ivas_dct_s3_W8[1404] = { // Q0 21, -127, -23, -10, 7, -26, 1, 6, -39, -53, -19, -84, -34, 16, -10, -24, -75, 9, 76, -117, 124, -63, 75, 72, -9, 115, 42, 100, -36, 120, -37, 66, 46, 72, -34, 18, 24, -115, 3, -65, -47, -24, -7, -13, 1, -18, -10, -58, -30, 2, -37, -27, -78, 9, @@ -12032,7 +12036,7 @@ const Word8 /*seg 3, 78 x 18 */ cdk1_ivas_dct_s3_W8[1404] = { /* stage1 low complex search tables */ /* segm_neighbour_fwd/segm_neighbour_rev nex/previous indeces in an circularly ordered list of close MSE neighbours */ -const Word8 cdk1_ivas_segm_neighbour_fwd[128] = { +const Word8 cdk1_ivas_segm_neighbour_fwd[128] = { // Q0 3, 0, 4, 62, 5, 58, 64, 59, 33, 19, 9, 127, 26, 12, 28, 31, 1, 2, 51, 38, 18, 25, 43, 21, @@ -12050,7 +12054,7 @@ const Word8 cdk1_ivas_segm_neighbour_fwd[128] = { 82, 103, 121, 110, 109, 115, 40, 123, 116, 122, 120, 46, 93, 20, 125, 45 }; -const Word8 cdk1_ivas_segm_neighbour_rev[128] = { +const Word8 cdk1_ivas_segm_neighbour_rev[128] = { // Q0 1, 16, 17, 0, 2, 4, 63, 51, 65, 10, 44, 27, 13, 29, 30, 49, 50, 57, 20, 9, 125, 23, 36, 26, @@ -12547,7 +12551,7 @@ const float * const cdk_37bits_flt[] = { cdk_37bits_1, cdk_37bits_2, cdk_37bits_ const float * const cdk_37bits_ivas[] = { NULL, cdk_37bits_2, cdk_37bits_3, cdk_37bits_4, cdk_37bits_5, cdk_37bits_6 }; -const Word16 cdk_37bits_1_fx[3072] = +const Word16 cdk_37bits_1_fx[3072] =//Q7 { W16(0x017B), W16(0x0548), W16(0x068C), W16(0x058B), W16(0x0572), W16(0x0577), W16(0x04BC), W16(0x03C0), W16(0x0399), W16(0x0237), W16(0x00A1), W16(0xFEB3), W16(0xFCFA), W16(0xFC2F), W16(0xFACB), W16(0xFA70), @@ -12935,7 +12939,7 @@ const Word16 cdk_37bits_1_fx[3072] = W16(0xF82A), W16(0xF775), W16(0xF601), W16(0xF4EB), W16(0xF453), W16(0xF321), W16(0xF2CA), W16(0xF274) }; -const Word16 cdk_37bits_2_fx[1536] = +const Word16 cdk_37bits_2_fx[1536] =//Q7 { W16(0xFFB3), W16(0xFFD1), W16(0xFFDB), W16(0xFFB1), W16(0xFFE5), W16(0x0002), W16(0xFFE4), W16(0xFFED), W16(0x0018), W16(0x0058), W16(0x005D), W16(0x006D), W16(0x0055), W16(0x0018), W16(0xFFB1), W16(0xFF83), @@ -13131,7 +13135,7 @@ const Word16 cdk_37bits_2_fx[1536] = W16(0xFFF7), W16(0xFFF5), W16(0xFFFF), W16(0x0001), W16(0x0022), W16(0x003E), W16(0x0047), W16(0x0037) }; -const Word16 cdk_37bits_3_fx[1536] = +const Word16 cdk_37bits_3_fx[1536] =//Q7 { W16(0xFFCD), W16(0xFFFB), W16(0xFFC7), W16(0x0024), W16(0x0000), W16(0xFFAB), W16(0x014C), W16(0xFF9A), W16(0xFFF0), W16(0xFFF1), W16(0x0002), W16(0x0015), W16(0xFFF3), W16(0xFFDC), W16(0xFFD2), W16(0x000F), @@ -13327,7 +13331,7 @@ const Word16 cdk_37bits_3_fx[1536] = W16(0xFFA4), W16(0xFFEA), W16(0x001A), W16(0x002C), W16(0x0003), W16(0x002A), W16(0x005F), W16(0x0077) }; -const Word16 cdk_37bits_4_fx[1536] = +const Word16 cdk_37bits_4_fx[1536] =//Q7 { W16(0xFFF5), W16(0xFFA9), W16(0x000E), W16(0xFFC8), W16(0xFFCB), W16(0xFFB9), W16(0xFFD4), W16(0xFFCC), W16(0xFFCB), W16(0xFFC8), W16(0xFFD3), W16(0x001A), W16(0x0049), W16(0x003A), W16(0x001F), W16(0x0044), @@ -13523,7 +13527,7 @@ const Word16 cdk_37bits_4_fx[1536] = W16(0x0029), W16(0x0046), W16(0x0084), W16(0x0071), W16(0x004F), W16(0x0045), W16(0x0040), W16(0x0038) }; -const Word16 cdk_37bits_5_fx[1536] = +const Word16 cdk_37bits_5_fx[1536] =//Q7 { W16(0xFFF5), W16(0x0024), W16(0xFFA1), W16(0xFFDD), W16(0x0022), W16(0x004B), W16(0x003F), W16(0x0001), W16(0x0040), W16(0xFFF4), W16(0xFFEE), W16(0xFFE4), W16(0xFFA4), W16(0xFFD7), W16(0xFFEA), W16(0xFFFD), @@ -13719,7 +13723,7 @@ const Word16 cdk_37bits_5_fx[1536] = W16(0x001F), W16(0x0028), W16(0x0033), W16(0x003A), W16(0x0021), W16(0xFFE2), W16(0xFFB8), W16(0xFFAF) }; -const Word16 cdk_37bits_6_fx[1536] = +const Word16 cdk_37bits_6_fx[1536] =//Q7 { W16(0x0003), W16(0xFFDA), W16(0x0007), W16(0x0012), W16(0x0022), W16(0xFFFC), W16(0x001A), W16(0x0047), W16(0x001D), W16(0x0029), W16(0x0015), W16(0xFFF4), W16(0xFFE2), W16(0xFFC7), W16(0xFFD7), W16(0xFFDC), @@ -13917,11 +13921,11 @@ const Word16 cdk_37bits_6_fx[1536] = const Word16 * const cdk_37bits[] = { cdk_37bits_1_fx, cdk_37bits_2_fx, cdk_37bits_3_fx, cdk_37bits_4_fx, cdk_37bits_5_fx, cdk_37bits_6_fx -}; +}; // Q7 const Word16 * const ivas_cdk_37bits_fx[] = { NULL, cdk_37bits_2_fx, cdk_37bits_3_fx, cdk_37bits_4_fx, cdk_37bits_5_fx, cdk_37bits_6_fx -}; +}; // Q7 /* Sine tables for FFT */ /* for (j=0; jfftlen/2+1; j++) hs->fftSineTab[j] = (float)sin(2.0*EVS_PI*j/hs->fftlen); */ @@ -14514,7 +14518,7 @@ const float olapWinSyn256[256] = 0.0061358846f }; const Word16 olapWinSyn256_fx[256] = -{ +{//Q15 201, 603, 1005, 1407, 1808, 2210, 2611, 3011, 3411, 3811, 4210, 4609, 5006, 5403, 5800, 6195, 6589, 6983, 7375, 7766, 8156, 8545, 8933, 9319, 9704, 10087, 10469, 10849, 11228, 11605, 11980, 12353, 12725, 13094, 13462, 13828, 14191, 14552, 14912, 15269, 15623, 15976, 16325, 16673, 17018, 17360, 17700, 18037, @@ -14570,7 +14574,7 @@ const float olapWinSyn320[320] = }; const Word16 olapWinSyn320_fx[320] = -{ +{//Q15 160, 482, 804, 1125, 1447, 1768, 2089, 2410, 2731, 3051, 3371, 3691, 4011, 4330, 4648, 4967, 5284, 5602, 5918, 6234, 6550, 6865, 7179, 7493, 7805, 8117, 8429, 8739, 9049, 9358, @@ -14880,7 +14884,7 @@ const float dico1_isf[] = }; const Word16 dico1_isf_fx[] = -{ +{/*Qlog2(2.56)*/ 740, 1263, 1292, 1006, 997, 1019, 1017, 976, 923, 557, 946, 1049, 867, 846, 990, 1112, 1262, 1241, 633, 898, 996, 756, 662, 683, 783, 909, 996, @@ -15433,7 +15437,7 @@ const float dico2_isf[] = /* ISF codebook - common 1st stage, 2nd split (only in AMR-WB IO mode) */ const Word16 dico2_isf_fx[] = -{ +{/*Qlog2(2.56)*/ 1357, 1313, 1136, 784, 438, 181, 145, 636, 648, 667, 568, 442, 217, 362, 427, 440, 674, 524, 332, 117, -417, @@ -15779,7 +15783,7 @@ const float dico21_isf_46b[] = /* ISF codebook - 46b, 2nd stage, 1st split (only in AMR-WB IO mode) */ const Word16 dico21_isf_46b_fx[] = -{ +{/*Qlog2(2.56)*/ 329, 409, 249, -33, 505, 160, -29, -14, 582, @@ -15984,7 +15988,7 @@ const float dico22_isf_46b[] = /* ISF codebook - 46b, 2nd stage, 2st split (only in AMR-WB IO mode) */ const Word16 dico22_isf_46b_fx[] = -{ +{/*Qlog2(2.56)*/ -127, 310, 42, -242, 197, 5, -151, 84, -17, @@ -16253,7 +16257,7 @@ const float dico23_isf_46b[] = /* ISF codebook - 46b, 2nd stage, 3rd split (only in AMR-WB IO mode) */ const Word16 dico23_isf_46b_fx[] = -{ +{/*Qlog2(2.56)*/ -10, 151, 359, 136, 298, 223, 255, -104, 290, @@ -16426,7 +16430,7 @@ const float dico24_isf_46b[] = /* ISF codebook - 46b, 2nd stage, 4th split (only in AMR-WB IO mode) */ const Word16 dico24_isf_46b_fx[] = -{ +{/*Qlog2(2.56)*/ -79, -89, -4, -171, 77, -211, 160, -193, 98, @@ -16503,7 +16507,7 @@ const float dico25_isf_46b[] = /* ISF codebook - 46b, 2nd stage, 5th split (only in AMR-WB IO mode) */ const Word16 dico25_isf_46b_fx[] = -{ +{/*Qlog2(2.56)*/ 169, 142, -119, 115, 206, -20, 94, 226, -106, 313, -21, 16, @@ -16688,7 +16692,7 @@ const float dico21_isf_36b[] = /* ISF codebook - 36b, 2nd stage, 1st split (only in AMR-WB IO mode) */ const Word16 dico21_isf_36b_fx[] = -{ +{/*Qlog2(2.56)*/ -52, -96, 212, 315, -73, 82, -204, 363, 136, -197, -126, -331, 183, 218, 143, @@ -16957,7 +16961,7 @@ const float dico22_isf_36b[] = /* ISF codebook - 36b, 2nd stage, 2nd split (only in AMR-WB IO mode) */ const Word16 dico22_isf_36b_fx[] = -{ +{/*Qlog2(2.56)*/ -298, -6, 95, 31, -213, -87, -122, 261, 4, -49, 208, 14, @@ -17162,7 +17166,7 @@ const float dico23_isf_36b[] = /* ISF codebook - 36b, 2nd stage, 3rd split (only in AMR-WB IO mode) */ const Word16 dico23_isf_36b_fx[] = -{ +{/*Qlog2(2.56)*/ 81, -18, 68, -27, -122, -280, -4, 45, -177, 209, -30, -136, -74, 131, -44, 101, -75, -88, -48, -137, -54, @@ -17315,7 +17319,7 @@ const float dico1_ns_28b[64*2] = /* ISF codebook for SID frames - 28b, 1st split */ const Word16 dico1_ns_28b_fx[] = -{ +{/*Qlog2(2.56)*/ -269, -673, -222, -537, -233, -430, @@ -17456,7 +17460,7 @@ const float dico2_ns_28b[64*3] = /* ISF codebook for SID frames - 28b, 2nd spilt */ const Word16 dico2_ns_28b_fx[] = -{ +{/*Qlog2(2.56)*/ -824, -884, -949, -805, -456, -418, -442, -438, -541, @@ -17597,7 +17601,7 @@ const float dico3_ns_28b[64*3] = /* ISF codebook for SID frames - 28b, 3rd spilt */ const Word16 dico3_ns_28b_fx[] = -{ +{/*Qlog2(2.56)*/ -805, -838, -774, -522, -627, -828, -477, -486, -603, @@ -17706,7 +17710,7 @@ const float dico4_ns_28b[32*4] = /* ISF codebook for SID frames - 28b, 4th spilt */ const Word16 dico4_ns_28b_fx[] = -{ +{/*Qlog2(2.56)*/ -776, -854, -891, -920, -552, -610, -663, -741, -321, -370, -476, -565, @@ -17783,7 +17787,7 @@ const float dico5_ns_28b[32*4] = /* ISF codebook for SID frames - 28b, 5th spilt */ const Word16 dico5_ns_28b_fx[] = -{ +{/*Qlog2(2.56)*/ -810, -879, -945, -254, 248, 184, 671, 128, 288, 703, 918, 99, @@ -19033,7 +19037,7 @@ const Word16 lsf_cdk_wb_vc_stg3[] = /* 14Q1*1.28 */ 13, 12, 1888, 3621, 3935, 4000, 3607, 2932, 2128 }; -const Word16 *const lsf_codebook[2][2][TCXLPC_NUMSTAGES] = +const Word16 *const lsf_codebook[2][2][TCXLPC_NUMSTAGES] = /* 14Q1*1.28 */ { { { lsf_cdk_wb_gc_stg1, lsf_cdk_wb_gc_stg2, lsf_cdk_wb_gc_stg3 }, @@ -19045,12 +19049,12 @@ const Word16 *const lsf_codebook[2][2][TCXLPC_NUMSTAGES] = } }; -const int16_t lsf_numbits[TCXLPC_NUMSTAGES] = { 5, 4, 4 }; +const Word16 lsf_numbits[TCXLPC_NUMSTAGES] = { 5, 4, 4 }; // Q0 -const int16_t lsf_dims_ivas[TCXLPC_NUMSTAGES] = { 16, 6, 10 }; -const int16_t lsf_offs_ivas[TCXLPC_NUMSTAGES] = { 0, 0, 6 }; -const Word16 lsf_dims[TCXLPC_NUMSTAGES] = { 16, 8, 12 }; -const Word16 lsf_offs[TCXLPC_NUMSTAGES] = { 0, 0, 4 }; +const Word16 lsf_dims_ivas[TCXLPC_NUMSTAGES] = { 16, 6, 10 }; // Q0 +const Word16 lsf_offs_ivas[TCXLPC_NUMSTAGES] = { 0, 0, 6 }; // Q0 +const Word16 lsf_dims[TCXLPC_NUMSTAGES] = { 16, 8, 12 }; // Q0 +const Word16 lsf_offs[TCXLPC_NUMSTAGES] = { 0, 0, 4 }; // Q0 const float lsf_ind_cdk_nb_gc_stg4_flt[] = { @@ -19119,17 +19123,17 @@ const Word16 lsf_ind_cdk_wb_vc_stg4[] = /* 14Q1*1.28 */ 2256, 2704, 0 }; -const Word16 *const lsf_ind_codebook[2][2][TCXLPC_IND_NUMSTAGES] = +const Word16 *const lsf_ind_codebook[2][2][TCXLPC_IND_NUMSTAGES] = /* 14Q1*1.28 */ { { { lsf_ind_cdk_wb_gc_stg4 }, { lsf_ind_cdk_wb_vc_stg4 } }, { { lsf_ind_cdk_nb_gc_stg4 }, { lsf_ind_cdk_nb_vc_stg4 } } }; -const int16_t lsf_ind_numbits[TCXLPC_IND_NUMSTAGES] = { 2 }; +const Word16 lsf_ind_numbits[TCXLPC_IND_NUMSTAGES] = { 2 }; // Q0 -const int16_t lsf_ind_dims_ivas[TCXLPC_IND_NUMSTAGES] = { 2 }; -const Word16 lsf_ind_dims[TCXLPC_IND_NUMSTAGES] = { 4 }; -const int16_t lsf_ind_offs[TCXLPC_IND_NUMSTAGES] = { 0 }; +const Word16 lsf_ind_dims_ivas[TCXLPC_IND_NUMSTAGES] = { 2 }; // Q0 +const Word16 lsf_ind_dims[TCXLPC_IND_NUMSTAGES] = { 4 }; // Q0 +const Word16 lsf_ind_offs[TCXLPC_IND_NUMSTAGES] = { 0 }; // Q0 const Word16 min_distance_thr[2][2] = /* 14Q1*1.28 */ { @@ -19682,11 +19686,11 @@ const float stable_LSP[M] = /* Stable ISP vector in Q15 */ const Word16 stable_ISP_fx[16] = { 32139, 30274, 27247, 23170, 18206, 12540, 6393, 0, -6390, -12537, -18203, -23170, -27243, -30271, -32139, 1475 }; /* Stable LSP vector in Q15 */ -/* This LSP corresponds to GEWB_Ave_fx */ +/* This LSP corresponds to GEWB_Ave_fx Q15*/ const Word16 stable_LSP_fx[16] = { 32437, 31676, 29486, 25681, 21564, 16413, 10838, 5385, -735, -6405, -11986, -17040, -22052, -26346, -29678, -31784 }; /* stable ISF vector */ -const Word16 stable_ISF_fx[M] = +const Word16 stable_ISF_fx[M] =/*15Q16*/ { 1023, 2048, 3072, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 13311, 14335, 15361, 3978 }; /*----------------------------------------------------------------------------------* @@ -19795,22 +19799,22 @@ const float AUWB2_Ave[16] = 364.4531f, 681.6406f, 1187.5000f, 1623.8281f, 2101.1719f, 2535.1563f, 2986.7188f, 3408.2031f, 3848.4375f, 4269.5313f, 4771.0938f, 5330.8594f, 5883.5938f, 6366.0156f, 6889.0625f, 7331.2500f }; -const Word16 SVWB2_Ave_fx[16] = { 998, 1488, 2682, 3823, 5084, 6305, 7485, 8686, 9861, 11004, 12339, 13664, 15088, 16330, 17663, 18754 }; +const Word16 SVWB2_Ave_fx[16] = { 998, 1488, 2682, 3823, 5084, 6305, 7485, 8686, 9861, 11004, 12339, 13664, 15088, 16330, 17663, 18754 }; // Q2.56 /* An 16-by-1 matrix */ const Word16 IANB_Ave_fx[16] = { 726, 1433, 2493, 3408, 4340, 5215, 6103, 6947, 7772, 8536, 9252, 10012, 10909, 12427, 13997, 15193 -}; +}; // Q2.56 /* An 16-by-1 matrix */ const Word16 IAWB_Ave_fx[16] = { 577, 1350, 2526, 3535, 4539, 5504, 6497, 7460, 8445, 9396, 10371, 11319, 12307, 13268, 14249, 15207 -}; +}; // Q2.56 /* An 16-by-1 matrix */ const Word16 IAWB2_Ave_fx[16] = { 731, 1777, 3194, 4386, 5629, 6806, 8012, 9164, 10329, 11469, 12731, 14037, 15326, 16538, 17801, 18927 -}; +}; // Q2.56 /* Length 16 vector in Scale = 2.56f */ const Word16 UVNB_Ave_fx[16] = { 1018, 1764, 2856, 3751, 4611, 5410, 6233, 6961, 7685, 8304, 8859, 9325, 9977, 11741, 13699, 15074 }; /* Length 16 vector in Scale = 2.56f */ @@ -20354,7 +20358,7 @@ const float CNG_SN1[256] = /* An 16-by-16 matrix */ const Word16 CNG_SN1_fx[256] = -{ +{//Qlog2(2.56) 600, 1640, 3039, 4257, 5512, 6740, 7989, 9169, 10393, 11612, 12880, 14100, 15378, 16554, 17816, 18918, 1188, 2487, 3746, 4903, 6103, 7261, 8437, 9587, 10776, 11954, 13172, 14355, 15564, 16712, 17913, 19012, 346, 799, 2259, 3555, 4876, 6175, 7516, 8803, 10073, 11323, 12631, 13938, 15282, 16553, 17817, 19039, @@ -20514,7 +20518,7 @@ const float SVWB2_SN1[256] = { -91.02f, -115.23f, -227.34f, -448.05f, -339.84f, 30.08f, 56.25f, 130.86f, 105.08f, 196.09f, 249.22f, 280.86f, 240.23f, 146.88f, 85.55f, 67.19f }; -const Word16 SVWB2_SN1_fx[256] = { +const Word16 SVWB2_SN1_fx[256] = {//Qlog2(2.56) -257, -385, -673, 926, 1408, 874, 735, 512, 624, 587, 493, 688, 845, 521, 428, 95, -32, -90, 1046, 666, 329, -59, -324, -282, -712, -783, -229, 28, -354, -434, -497, -351, 182, 111, 512, 746, 365, 91, -214, -477, -401, -496, -931, -1180, -1422, -1085, -456, -9, @@ -20554,7 +20558,7 @@ const float SVWB2_SN2[256] = { }; /* An 16-by-16 matrix */ -const Word16 SVWB2_SN2_fx[256] = { +const Word16 SVWB2_SN2_fx[256] = {//Qlog2(2.56) -100, -130, -545, -834, 489, 501, 523, 297, 137, 198, 270, 172, 17, -50, -147, -63, 333, 351, 143, 142, 47, -137, -131, -323, -216, -32, 105, 264, 541, 425, 342, 153, -93, -168, 184, 605, 372, 237, 186, 175, 307, 321, 448, 205, -128, -481, -477, -512, @@ -20597,7 +20601,7 @@ const float SVWB2_AR2[128] = { }; /* SVWB2_AR1 * 2.56f */ -const Word16 SVWB2_AR1_fx[128] = { +const Word16 SVWB2_AR1_fx[128] = {//Qlog2(2.56) -28, -38, -122, 74, 296, 148, 146, 120, 148, 36, -11, -163, -223, -299, -290, -320, -22, -30, -138, -319, -385, 159, 124, 51, 32, -44, -15, -78, -96, -53, 40, 64, -96, -144, -205, -96, 80, 96, 152, 246, 206, 193, 265, 333, 320, 232, 131, 32, @@ -20609,7 +20613,7 @@ const Word16 SVWB2_AR1_fx[128] = { }; /* SVWB2_AR2 * 2.56f */ -const Word16 SVWB2_AR2_fx[128] = { +const Word16 SVWB2_AR2_fx[128] = {//Qlog2(2.56) 12, 16, -46, -156, -329, -293, 43, 141, 61, 15, -9, 29, -74, -41, -37, 16, -47, -81, -136, 82, -33, -111, -268, -293, 109, 136, 53, -58, -51, 62, 64, 14, -15, -19, -171, -347, 258, 161, 88, 13, -57, -26, -59, 24, 10, 14, -41, -8, @@ -20623,7 +20627,7 @@ const Word16 SVWB2_AR2_fx[128] = { /*----------------------------------------------------------------------------------* * LSF quantization - LSF mode/codebook selection tables *----------------------------------------------------------------------------------*/ -const int16_t CB_lsf[] = +const Word16 CB_lsf[] = { -1, /* Mode 0 : INACTIVE NB, Safety net */ -1, /* Mode 1 : UNVOICED NB, Safety net */ @@ -20644,9 +20648,9 @@ const int16_t CB_lsf[] = 10, /* Mode 16 : TRANSITION WB16k, Safety net */ -1, /* Mode 17 : AUDIO WB16k, Safety net */ 13 /* Mode 18 : CNG, Safety net */ -}; +}; // Q0 -const int16_t CB_p_lsf[] = +const Word16 CB_p_lsf[] = { 0, /* Mode 0 : INACTIVE NB, Predictive */ 1, /* Mode 1 : UNVOICED NB, Predictive */ @@ -20667,7 +20671,7 @@ const int16_t CB_p_lsf[] = -1, /* Mode 16 : TRANSITION WB16k, Predictive */ 10, /* Mode 17 : AUDIO WB16k, Predictive */ 9, /* Mode 18 : GENERIC WB, MA Predictive */ -}; +}; // Q0 const float * const ModeMeans[] = {IANB_Ave, UVNB_Ave, SVNB_Ave, GENB_Ave, TRNB_Ave, AUNB_Ave, IAWB_Ave, UVWB_Ave, @@ -20678,21 +20682,21 @@ const float * const Predictors[] = {Predictor6, NULL, Predictor1, Predictor3, NU }; const Word16 *const ModeMeans_fx[] = { IANB_Ave_fx, UVNB_Ave_fx, SVNB_Ave_fx, GENB_Ave_fx, TRNB_Ave_fx, AUNB_Ave_fx, IAWB_Ave_fx, UVWB_Ave_fx, SVWB_Ave_fx, GEWB_Ave_fx, TRWB_Ave_fx, AUWB_Ave_fx, IAWB2_Ave_fx, NULL, SVWB2_Ave_fx, GEWB2_Ave_fx, TRWB2_Ave_fx, AUWB2_Ave_fx -}; +}; //Qlog2(2.56) const Word16 * const Predictors_fx[] = { Predictor6_fx, NULL, Predictor1_fx, Predictor3_fx, NULL, Predictor6_fx,Predictor5_fx, NULL, Predictor0_fx, Predictor2_fx, NULL, Predictor5_fx, Predictor7_fx, NULL, Predictor8_fx, Predictor4_fx, NULL, Predictor7_fx -}; +}; // Q15 const float means_nb_31bits_ma_lsf_float[16] = {336.3281f , 531.2500f , 886.7188f , 1266.7969f , 1629.2969f , 1973.4375f , 2348.4375f , 2646.8750f , 2998.4375f , 3292.1875f , 3591.4062f , 3806.2500f , 4132.8125f , 4652.7344f , 5250.0000f , 5883.2031f}; const float means_wb_31bits_ma_lsf_float[16] = {319.5312f , 548.0469f , 934.3750f , 1353.5156f , 1730.0781f , 2120.3125f , 2505.4688f , 2860.5469f , 3243.7500f , 3601.9531f , 3969.5312f , 4332.4219f , 4736.3281f , 5137.8906f , 5562.8906f , 5963.2812f}; -const int16_t CBsizes[] = +const Word16 CBsizes[] = { 1,2,4,8,16,32,64 -}; +}; // Q0 -const int16_t CBbits[] = +const Word16 CBbits[] = { -1, /* Mode 0 : INACTIVE NB, Safety net */ -1, /* Mode 1 : UNVOICED NB, Safety net */ @@ -20713,10 +20717,10 @@ const int16_t CBbits[] = 4, /* Mode 16 : TRANSITION WB16k, Safety net */ -1, /* Mode 17 : AUDIO WB16k, Safety net */ 4, /* Mode 18: CNG, Safety net */ -}; +}; // Q0 -const int16_t CBbits_p[] = +const Word16 CBbits_p[] = { 5, /* Mode 0 : INACTIVE NB, Predictive */ 4, /* Mode 1 : UNVOICED NB, Predictive */ @@ -20737,11 +20741,11 @@ const int16_t CBbits_p[] = -1, /* Mode 16 : TRANSITION WB16k, Predictive */ 5, /* Mode 17 : AUDIO WB16k, Predictive */ 5, /* Mode 9 : GENERIC WB, Predictive */ -}; +}; // Q0 -const int16_t BitsVQ[]= +const Word16 BitsVQ[]= { -1, /* Mode 0 : INACTIVE NB, Safety net */ -1, /* Mode 1 : UNVOICED NB, Safety net */ @@ -20762,10 +20766,10 @@ const int16_t BitsVQ[]= 8, /* Mode 16 : TRANSITION WB16k, Safety net */ -1, /* Mode 17 : AUDIO WB16k, Safety net */ 4, /* Mode 18: CNG, Safety net */ -}; +}; // Q0 -const int16_t BitsVQ_p[]= +const Word16 BitsVQ_p[]= { 5, /* Mode 0 : INACTIVE NB, Predictive */ 8, /* Mode 1 : UNVOICED NB, Predictive */ @@ -20786,7 +20790,7 @@ const int16_t BitsVQ_p[]= -1, /* Mode 16 : TRANSITION WB16k, Predictive */ 5, /* Mode 17 : AUDIO WB16k, Predictive */ 5, /* Mode 18 : GENERIC WB, MA Predictive */ -}; +}; // Q0 const int16_t predmode_tab_float[][6] = @@ -20803,7 +20807,7 @@ const Word16 predmode_tab[][6] = {1,1,2,2,0,2}, {1,-1,2,1,0,1}, {1,1,2,1,0,2} /* should check how is the cb for audio mode at 13.2*/ -}; +}; // Q0 const float * const Quantizers[] = {SVNB_SN1, SVNB_SN2, GETRNB_SN1, GETRNB_SN2, AUNB_SN1,SVWB_SN1, SVWB_SN2, GETRWB_SN1, GETRWB_SN2, AUWB_SN1,TRWB2_SN1, TRWB2_SN2, AUWB2_SN1, CNG_SN1, SVWB2_SN1, SVWB2_SN2 }; @@ -20813,7 +20817,7 @@ const float * const Quantizers_p[] = {IAA_MA1, UVD_MA1, UVD_MA2, UVWB_MA3, GESVN const Word16 SVNB_SN1_fx[256] = -{ +{//Qlog2(2.56) 135, 109, 135, -153, -549, 214, 416, 195, 291, 247, 100, -127, -579, -160, -66, -32, -107, -150, -274, -149, 642, 594, 338, 183, 81, -31, -14, -150, -387, -40, -44, -18, 73, 42, 171, 339, 213, 42, -137, -277, -379, -441, -440, -478, 270, 126, -4, 6, @@ -20834,7 +20838,7 @@ const Word16 SVNB_SN1_fx[256] = /* An 16-by-16 matrix in Scale = 2.56f */ const Word16 SVNB_SN2_fx[256] = -{ +{//Qlog2(2.56) -16, 111, 111, -89, -115, -404, -514, 162, 277, 41, -94, -89, 15, 31, 2, 2, -82, -99, -25, -287, -464, 204, 18, -123, -38, 56, 109, 198, 160, 96, 41, 19, -95, -62, -242, -415, 318, 118, -121, 44, 74, 40, 85, 114, 52, 36, 21, 8, @@ -20854,7 +20858,7 @@ const Word16 SVNB_SN2_fx[256] = }; const Word16 GETRNB_SN1_fx[512] = -{ +{//Qlog2(2.56) -119, -271, -427, 447, 321, 58, 37, -105, -65, 99, 106, 21, -277, 53, 9, -6, -93, -241, -433, -826, -1028, 17, 180, 138, 320, 234, 152, 235, 973, 594, 199, 96, -300, -474, -553, -497, -374, -231, -224, -170, -145, 51, 154, 714, 1338, 690, 271, 118, @@ -20891,7 +20895,7 @@ const Word16 GETRNB_SN1_fx[512] = /* An 16-by-16 matrix in Scale = 2.56f */ const Word16 GETRNB_SN2_fx[256] = -{ +{//Qlog2(2.56) -27, 71, 45, -4, 28, 69, 25, 94, 45, 90, 45, 87, -177, -567, -116, -59, -208, -147, 531, 399, 199, 113, -21, -28, -34, -38, -48, -46, -47, 18, -1, -1, 69, -20, -115, -355, -380, 388, 379, 193, 134, 37, -42, -60, -35, 29, 6, 5, @@ -20912,7 +20916,7 @@ const Word16 GETRNB_SN2_fx[256] = /* An 16-by-16 matrix in Scale = 2.56f */ const Word16 AUNB_SN1_fx[256] = -{ +{//Qlog2(2.56) -180, -79, -51, 39, 66, 99, 48, 108, 56, 127, 34, 46, -470, -845, -141, -90, -212, 82, 284, 422, 416, 416, 313, 289, 233, 210, 108, 55, -439, -1323, -336, -123, -9, 405, 532, 659, 710, 798, 844, 971, 1072, 1181, 1464, 1913, 2028, 1232, 549, 265, @@ -20932,7 +20936,7 @@ const Word16 AUNB_SN1_fx[256] = }; const Word16 SVWB_SN1_fx[256] = -{ +{//Qlog2(2.56) -71, -61, -170, -563, -962, -845, 186, 421, 282, 344, 260, 155, 186, 52, -18, -11, -107, -139, -289, -270, 788, 615, 249, 174, -1, -24, 159, 106, -46, -183, -187, -107, -144, -221, -215, 359, 192, -34, -186, -326, -256, -124, -49, 84, 214, 237, 186, 91, @@ -20952,7 +20956,7 @@ const Word16 SVWB_SN1_fx[256] = }; const Word16 SVWB_SN2_fx[256] = -{ +{//Qlog2(2.56) -126, -152, -342, -423, 311, 95, 3, 29, -93, 4, 227, 193, 142, 120, 93, 62, 190, 258, 382, 310, 166, -11, -77, -67, -217, -327, -330, -378, -461, -309, -142, -47, -16, -58, -77, -339, -534, 469, 399, 237, 290, 135, 34, 86, -14, -77, -30, 10, @@ -20972,7 +20976,7 @@ const Word16 SVWB_SN2_fx[256] = }; const Word16 GETRWB_SN1_fx[512] = -{ +{//Qlog2(2.56) -232, -191, 282, 248, 344, 390, 428, 490, 538, 592, 620, 607, 533, 372, 261, 136, -59, -227, -418, -288, -247, -448, -501, -644, -760, -922, -1112, -1204, -523, -130, 12, 131, 139, 838, 1402, 1327, 1465, 1391, 1371, 1342, 1220, 1147, 1041, 910, 733, 518, 335, 181, @@ -21008,7 +21012,7 @@ const Word16 GETRWB_SN1_fx[512] = }; const Word16 GETRWB_SN2_fx[256] = -{ +{//Qlog2(2.56) -202, -246, -356, -356, -232, -164, -79, 4, 78, 130, 152, 165, 170, 141, 90, 70, 38, 78, -72, -185, -446, -552, 269, 295, 104, 77, -54, -184, -168, -72, -32, -2, 69, 93, 39, 116, 100, 46, 50, -1, -2, 62, 8, -105, -404, -656, -494, -224, @@ -21028,7 +21032,7 @@ const Word16 GETRWB_SN2_fx[256] = }; const Word16 AUWB_SN1_fx[256] = -{ +{//Qlog2(2.56) 328, 137, 358, 330, 184, 145, -60, -294, -555, -784, -945, -872, -601, -337, -155, -33, 32, -212, -488, -651, -752, -877, -892, -886, -853, -795, -705, -549, -330, -224, -127, -9, 372, 327, 197, 33, 13, -55, -87, -124, -125, -148, -144, -168, -175, -184, -127, -125, @@ -21049,7 +21053,7 @@ const Word16 AUWB_SN1_fx[256] = /* An 16-by-16 matrix in Scale = 2.56f */ const Word16 TRWB2_SN1_fx[256] = -{ +{//Qlog2(2.56) -74, -384, -764, -964, -1122, -912, -819, -740, -728, -572, -379, -317, -250, -51, -67, 85, -311, -618, -439, -108, 156, 257, 404, 543, 643, 729, 732, 572, 446, 329, 236, 164, 523, 1549, 1557, 1476, 1374, 1192, 1068, 923, 901, 788, 717, 401, 262, 6, -100, -368, @@ -21070,7 +21074,7 @@ const Word16 TRWB2_SN1_fx[256] = /* An 16-by-16 matrix in Scale = 2.56f */ const Word16 TRWB2_SN2_fx[256] = -{ +{//Qlog2(2.56) 50, -66, -486, -850, 504, 345, 261, 10, -207, -218, -174, -18, 72, 69, 3, 24, -171, -439, -632, 390, 143, -89, -292, -314, -227, -157, 33, 181, 185, 204, 128, 167, 458, 459, 78, -250, -365, -381, -353, -382, -327, -284, -191, -18, 3, 37, 29, 95, @@ -21091,7 +21095,7 @@ const Word16 TRWB2_SN2_fx[256] = /* An 16-by-16 matrix in Scale = 2.56f */ const Word16 AUWB2_SN1_fx[256] = -{ +{//Qlog2(2.56) -107, -446, -835, -1041, -1152, -1161, -1146, -969, -828, -533, -251, -242, -139, 172, 95, 466, 1052, 1008, 1052, 875, 864, 748, 783, 690, 754, 715, 688, 342, 195, -32, -251, -509, -311, -170, 366, 632, 748, 863, 983, 1042, 1118, 1188, 1133, 895, 728, 621, 460, 418, @@ -21112,7 +21116,7 @@ const Word16 AUWB2_SN1_fx[256] = /* An 16-by-32 matrix */ const Word16 IAA_MA1_fx[512] = -{ +{//Qlog2(2.56) -175, -490, -520, -631, -645, -614, -610, -548, -503, -432, -353, -301, -238, -141, -67, 26, 301, 407, 227, 96, -12, -18, -13, 2, 39, 107, 124, 92, 83, 100, 62, 72, -280, -737, -569, -164, -9, 100, 141, 211, 252, 281, 274, 217, 206, 219, 117, 106, @@ -21149,7 +21153,7 @@ const Word16 IAA_MA1_fx[512] = /* An 16-by-16 matrix in Scale = 2.56f */ const Word16 UVD_MA1_fx[256] = -{ +{//Qlog2(2.56) -301, -503, -426, -187, -131, -64, -45, -20, 11, 56, 63, 90, 110, 175, 97, 33, 161, 353, 474, 502, 709, 782, 794, 765, 632, 532, 406, 285, 230, 145, 97, 52, -37, -5, 205, 323, 412, 349, 221, 91, -6, -59, -86, -112, -32, 209, 73, 23, @@ -21170,7 +21174,7 @@ const Word16 UVD_MA1_fx[256] = /* An 16-by-16 matrix in Scale = 2.56f */ const Word16 UVD_MA2_fx[256] = -{ +{//Qlog2(2.56) -75, -64, -150, -231, -272, -278, -248, -194, -156, -107, -74, -43, -92, -21, 9, 5, 393, 275, -12, -156, -208, -215, -162, -132, -115, -109, -94, -85, -104, -10, 5, -1, -297, -389, -99, -78, -66, -19, -12, 8, 0, -3, -15, -22, -113, -82, -16, 2, @@ -21191,7 +21195,7 @@ const Word16 UVD_MA2_fx[256] = /* An 16-by-16 matrix in Scale = 2.56f */ const Word16 UVWB_MA3_fx[256] = -{ +{//Qlog2(2.56) -26, 23, 7, -6, -1, 3, 40, 35, -43, -24, 56, 157, 265, 423, 382, 260, 61, -300, -130, -101, -8, 106, 108, 114, 88, 43, -2, -33, -56, 67, 29, 13, -31, 47, 45, -121, 46, 22, 111, 233, -256, -252, -123, -71, -31, 54, 56, 33, @@ -21212,7 +21216,7 @@ const Word16 UVWB_MA3_fx[256] = /* An 16-by-8 matrix in Scale = 2.56f */ const Word16 GESVNB_AR1_fx[128] = -{ +{//Qlog2(2.56) -25, -64, -140, -118, 270, 240, 127, 70, 20, -40, -56, -111, -82, 64, 2, 5, 81, 104, 71, 70, 0, -49, -54, -73, -59, -92, -102, -201, -404, -52, -40, -15, -112, -217, -251, -202, -34, 57, 58, 62, 79, 127, 177, 306, 524, 315, 112, 53, @@ -21225,7 +21229,7 @@ const Word16 GESVNB_AR1_fx[128] = /* An 16-by-8 matrix in Scale = 2.56f */ const Word16 GESVNB_AR2_fx[128] = -{ +{//Qlog2(2.56) -22, -35, -31, -166, -164, 217, 212, 155, 166, 123, 67, 33, -21, -41, -3, -1, -14, -20, -16, -70, -77, -53, 23, -7, -98, -123, -99, -49, 357, 114, 36, 19, -57, -119, -303, -215, -33, -103, -97, -117, -105, -102, -67, -134, -176, 113, 16, 8, @@ -21238,7 +21242,7 @@ const Word16 GESVNB_AR2_fx[128] = /* An 16-by-8 matrix in Scale = 2.56f */ const Word16 GESVWB_AR1_fx[128] = -{ +{//Qlog2(2.56) -3, -16, -31, 2, -81, -123, -226, -260, -196, -122, -20, 78, 178, 145, 84, 46, 55, 42, 15, 32, -48, -81, -109, -137, -187, -264, -330, -387, -363, -176, -38, 37, -32, -70, -144, -269, -337, -183, 59, 58, 44, 49, 42, 51, 72, 50, 26, 38, @@ -21251,7 +21255,7 @@ const Word16 GESVWB_AR1_fx[128] = /* An 16-by-8 matrix in Scale = 2.56f */ const Word16 GESVWB_AR2_fx[128] = -{ +{//Qlog2(2.56) -147, -326, -421, -91, -22, -25, -14, -21, 32, 76, 104, 102, 65, 47, 50, 41, -39, -16, 61, -13, -38, -56, 47, 153, 195, 213, 212, 220, 245, 245, 209, 86, -34, -73, 82, 387, 199, 71, 56, -18, -33, -56, -88, -79, -5, 59, 55, 29, @@ -21264,7 +21268,7 @@ const Word16 GESVWB_AR2_fx[128] = /* An 16-by-32 matrix in Scale = 2.56f */ const Word16 GEWB2_MA1_fx[512] = -{ +{//Qlog2(2.56) 659, 1694, 1634, 1513, 1305, 1098, 933, 805, 733, 624, 525, 339, 239, 50, -35, -215, 6, 65, 125, 55, -85, -126, -272, -316, -507, -586, -1010, -1278, -1941, -1910, -426, 78, 281, 315, 236, -4, -102, -171, -232, -335, -362, -425, -488, -603, -669, -736, -648, -593, @@ -21301,7 +21305,7 @@ const Word16 GEWB2_MA1_fx[512] = /* An 16-by-32 matrix in Scale = 2.56f */ const Word16 GEWB_MA1_fx[512] = -{ +{//Qlog2(2.56) 269, 268, 416, 287, 157, 7, -132, -276, -482, -701, -1025, -1350, -1642, -982, -321, -49, 237, 949, 1374, 1228, 1337, 1219, 1123, 1016, 852, 752, 664, 559, 448, 306, 194, 83, -6, -176, -373, -111, -221, -387, -483, -639, -753, -786, -774, -655, -328, -114, -25, 27, @@ -21338,7 +21342,7 @@ const Word16 GEWB_MA1_fx[512] = /* An 16-by-32 matrix in Scale = 2.56f */ const Word16 AUWB2_MA1_fx[512] = -{ +{//Qlog2(2.56) 391, 298, 179, -37, -225, -387, -627, -864, -1216, -1644, -2108, -804, -277, -5, 121, 468, 351, 213, 141, -75, -130, -164, -332, -410, -524, -573, -575, -474, -331, -103, -22, 201, 81, 874, 1137, 1223, 1242, 1262, 1238, 1185, 1141, 1085, 993, 733, 570, 424, 256, 145, @@ -21376,11 +21380,11 @@ const Word16 AUWB2_MA1_fx[512] = const Word16 *const Quantizers_fx[] = { SVNB_SN1_fx, SVNB_SN2_fx, GETRNB_SN1_fx, GETRNB_SN2_fx, AUNB_SN1_fx,SVWB_SN1_fx, SVWB_SN2_fx, GETRWB_SN1_fx, GETRWB_SN2_fx, AUWB_SN1_fx,/* U13, */ TRWB2_SN1_fx, TRWB2_SN2_fx, AUWB2_SN1_fx, CNG_SN1_fx, SVWB2_SN1_fx, SVWB2_SN2_fx -}; +};//Qlog2(2.56) const Word16 *const Quantizers_p_fx[] = { IAA_MA1_fx, UVD_MA1_fx, UVD_MA2_fx, UVWB_MA3_fx, GESVNB_AR1_fx, GESVNB_AR2_fx, GESVWB_AR1_fx, GESVWB_AR2_fx, GEWB2_MA1_fx,GEWB_MA1_fx, AUWB2_MA1_fx, SVWB2_AR1_fx, SVWB2_AR2_fx -}; +};//Qlog2(2.56) const float vals[NO_LEADERS][MAX_NO_VALS]= { @@ -21487,9 +21491,9 @@ const Word16 vals_fx[NO_LEADERS][MAX_NO_VALS] = /*Q1 */ {7, 3, 1, 0}, }; -const int16_t no_vals[NO_LEADERS]= {2,1,2,2,2,2,3,2,1,3,2,2,2,3,3,3,2,3,3,2,3,2,3,2,3,3,4,2,3,2,2,3,2,2,4,2,2,3,3,3,3,4,4,2,3,1,3,3,3}; +const Word16 no_vals[NO_LEADERS]= {2,1,2,2,2,2,3,2,1,3,2,2,2,3,3,3,2,3,3,2,3,2,3,2,3,3,4,2,3,2,2,3,2,2,4,2,2,3,3,3,3,4,4,2,3,1,3,3,3}; // Q0 -const int16_t no_vals_ind[NO_LEADERS][MAX_NO_VALS]= +const Word16 no_vals_ind[NO_LEADERS][MAX_NO_VALS]= { {2,6,0,0}, {8,0,0,0}, @@ -21540,7 +21544,7 @@ const int16_t no_vals_ind[NO_LEADERS][MAX_NO_VALS]= {1,5,2,0}, {2,2,4,0}, {1,2,5,0} -}; +}; // Q0 const int16_t C_VQ[LATTICE_DIM+1][LATTICE_DIM+1] = @@ -21567,27 +21571,27 @@ const Word16 C_VQ_fx[LATTICE_DIM + 1][LATTICE_DIM + 1] = {1,6,15,20,15,6,1,0,0}, {1,7,21,35,35,21,7,1,0}, {1,8,28,56,70,56,28,8,1} -}; +}; // Q0 -const UWord32 table_no_cv[] = +const UWord32 table_no_cv[] = //Q0 { 0, 112, 240, 1360, 1376, 2400, 4192, 5536, 9120, 9376, 18336, 18448, 25616, 26640, 33808, 40528, 40752, 49712, 56880, 83760, 84208, 88688, 95856, 117360, 124528, 142448, 153200, 155888, 159472, 195312, 198896, 199920, 235760, 236880, 238928, 274768, 274784, 275808, 311648, 333152, 340320, 367200, 410208, 423648, 423760, 425104, 425232, 446736, 500496, 522000, 0 }; - +//Q0 const Word32 table_no_cv_fx[] = { 0, 112, 240, 1360, 1376, 2400, 4192, 5536, 9120, 9376, 18336, 18448, 25616, 26640, 33808, 40528, 40752, 49712, 56880, 83760, 84208, 88688, 95856, 117360, 124528, 142448, 153200, 155888, 159472, 195312, 198896, 199920, 235760, 236880, 238928, 274768, 274784, 275808, 311648, 333152, 340320, 367200, 410208, 423648,423760, 425104, 425232, 446736, 500496, 522000 ,0 -}; +}; // Q0 -const int16_t pi0[] = +const Word16 pi0[] = { 28,1,70,8,8,28,168,28,1,280,28,56,8,56,420,56, 70, 56,420, 56, 280, 56, 168, 28, 560, 168,336,28,280,28,8, 280,70, 8, 1120, 8, 8, 280, 168, 56, 420, 336, 840, 28, 168, 1, 168, 420, 168 -}; +}; // Q0 @@ -21700,10 +21704,10 @@ const Word16 pl_HQ_fx[] = /* Q1 vectors in first layers */ * LSF quantization for CNG *----------------------------------------------------------------------------------*/ -const int16_t cng_sort[] = {/*5f */1,1,0,1,0,0, /* 4f */0,1,0,1,0,0,1,1,1,1}; +const Word16 cng_sort[] = {/*5f */1,1,0,1,0,0, /* 4f */0,1,0,1,0,0,1,1,1,1}; // Q0 -const int16_t perm_MSLVQ[][4] = +const Word16 perm_MSLVQ[][4] = { /* 5f*/ {6,11,7,15}, @@ -21723,15 +21727,15 @@ const int16_t perm_MSLVQ[][4] = {6,11,7,12}, {6,11,7,12}, {6,11,7,12} -}; +}; // Q0 -const int16_t pl_par[] = /* 1 if even number of signs */ +const Word16 pl_par[] = /* 1 if even number of signs */ { 0, 1, 0, 0, -1, 0, 0, 1, 0, 0, 0, -1, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 1, 0, 0, 0, 0, 1, -1, 1, -1, 0, 0, 0, 0, 0, -1, 1, -1, 1, 0, 0, 0, 0, 0, 1, -1, 1, -1 -}; +}; // Q0 const float scales[][MAX_NO_SCALES*2]= /* 2 subvectors */ @@ -22177,7 +22181,7 @@ const float scales_p[][MAX_NO_SCALES*2]= /* 2 subvectors 20 modes */ {0.787f, 1.257f, 0.596f, 1.106f, 0.735f, 1.659f, }, /* 37 (36.961) */ /* AUDIO 16k */ }; -const Word16 scales_fx[][6] = +const Word16 scales_fx[][6] =//Q11 { {3129, 0, 0, 3138, 0, 0, }, /* 14 */ {3287, 0, 0, 3138, 0, 0, }, /* 15 */ @@ -22328,7 +22332,7 @@ const Word16 scales_fx[][6] = };/* An 6-by-146 matrix in Scale = 2048.00f */ const Word16 scales_p_fx[][6] = -{ +{//Q11 {2998, 4862, 0, 0, 0, 0, }, {2591, 5251, 0, 3355, 0, 0, }, {2177, 3488, 5745, 2650, 4819, 0, }, @@ -22525,7 +22529,7 @@ const float sigma_MSLVQ[][16] = {74.8535156f, 97.3632813f, 100.1464844f, 91.6992188f, 90.3808594f, 89.6484375f, 83.2031250f, 84.0820313f, 81.9335938f, 96.4355469f, 110.9863281f, 92.6757813f, 83.4960938f, 82.1289063f, 77.8808594f, 70.8984375f} }; const Word16 sigma_MSLVQ_fx[][16] = -{ +{//Qlog2(2.56) {3}, {3}, {107, 113, 160, 185, 202, 211, 219, 222, 222, 217, 218, 270, 327, 176, 66, 43}, @@ -22602,7 +22606,7 @@ const float inv_sigma_MSLVQ[][16] = }; /* An 16-by-33 matrix in Scale = 32768.00f */ -const Word16 inv_sigma_MSLVQ_fx[][16] = +const Word16 inv_sigma_MSLVQ_fx[][16] =//Q15 { {32767}, {32767}, @@ -22687,7 +22691,7 @@ const float inv_sigma_p[][16] = {0.0143820f, 0.0124726f, 0.0098699f, 0.0099081f, 0.0093902f, 0.0089943f, 0.0092922f, 0.0088505f, 0.0085690f, 0.0085333f, 0.0082681f, 0.0079938f, 0.0076475f, 0.0077693f, 0.0081045f, 0.0095300f} /* G WB for MA*/ }; /* An 16-by-19 matrix in Scale = 32768.00f */ -const Word16 inv_sigma_p_fx[][16] = +const Word16 inv_sigma_p_fx[][16] =//Q15 { {552, 513, 469, 494, 486, 478, 492, 496, 496, 482, 480, 388, 339, 276, 743, 760}, {640, 492, 472, 478, 482, 471, 470, 471, 623, 504, 501, 477, 459, 425, 421, 408}, @@ -22711,7 +22715,7 @@ const Word16 inv_sigma_p_fx[][16] = }; const Word16 sigma_p_fx[][16] = -{ +{//Qlog2(2.56) {152, 164, 179, 170, 172, 176, 171, 169, 169, 174, 175, 216, 247, 304, 113, 110}, {131, 171, 178, 176, 174, 178, 178, 178, 135, 166, 167, 176, 183, 197, 199, 206}, {84, 89, 120, 142, 154, 175, 184, 186, 189, 181, 178, 198, 245, 190, 54, 28}, @@ -22734,7 +22738,7 @@ const Word16 sigma_p_fx[][16] = }; const Word16 sigma_p_ivas_fx[][16] = -{ +{//Qlog2(2.56) {152, 164, 179, 170, 172, 176, 171, 169, 169, 174, 175, 216, 247, 304, 113, 110}, {131, 171, 178, 176, 174, 178, 178, 178, 135, 166, 167, 176, 183, 197, 199, 206}, {84, 89, 120, 142, 154, 175, 184, 186, 189, 181, 178, 198, 245, 190, 54, 28}, @@ -22757,7 +22761,7 @@ const Word16 sigma_p_ivas_fx[][16] = }; const Word16 inv_sigma_p_ivas_fx[][16] = -{ +{//Qlog2(2.56) {552, 513, 470, 494, 487, 478, 492, 496, 496, 482, 480, 389, 339, 276, 743, 760}, {640, 492, 472, 478, 482, 471, 470, 471, 623, 504, 501, 477, 459, 425, 420, 408}, {1002, 939, 696, 589, 545, 480, 456, 450, 444, 462, 472, 424, 342, 441, 1568, 2996}, @@ -22779,7 +22783,7 @@ const Word16 inv_sigma_p_ivas_fx[][16] = {471, 409, 323, 325, 308, 295, 304, 290, 281, 280, 271, 262, 251, 255, 266, 312} }; -const Word8 leaders_short[][MAX_NO_SCALES] = +const Word8 leaders_short[][MAX_NO_SCALES] = // Q0 {{ 0, 0, 0}, { 1, 0, 0}, { 15, 3, 3}, @@ -23057,7 +23061,7 @@ const Word8 leaders_short[][MAX_NO_SCALES] = { 48, 48, 47}, { 48, 48, 48}}; -const UWord8 no_lead_idx[][2] = { +const UWord8 no_lead_idx[][2] = { // Q0 { 1, 1}, { 4, 1}, { 41, 1}, @@ -23228,7 +23232,7 @@ const UWord8 no_lead_idx[][2] = { { 55, 31}, { 81, 7}, }; -const UWord8 no_lead_p_idx[][2] = { +const UWord8 no_lead_p_idx[][2] = { // Q0 { 5, 0}, { 3, 0}, { 41, 0}, @@ -23469,20 +23473,21 @@ const UWord8 no_lead_p_idx[][2] = { }; const int16_t min_lat_bits_SN[] = {-1, -1, 17, 12, 17, 17, -1, -1, 17, 12, 17, 17, -1, -1, 22, -1, 32, 26 }; - +//Q0 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 int16_t min_lat_bits_pred[] = {17, 18, 9, 15, -1, 21, 17, 14, 9, 15, -1, 21, 17, -1, 24, 26, -1, 26, 16}; - +//Q0 const Word16 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[] = {-1,-1,33,64,96, 129,-1,-1,12,43,79,109,-1,-1,137,-1,107,135, 112 }; /* CNG */ - +//Q0 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 int16_t offset_lvq_modes_pred[] = {119, 153, 31, 67, -1, 102, 126, 160, 0, 46, -1, 82, 146, -1, 175, 191, -1, 225, 203}; +//Qlog2(1.6) 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 int16_t offset_in_lvq_mode_SN[][21] = @@ -23508,7 +23513,7 @@ const int16_t offset_in_lvq_mode_SN[][21] = }; const Word16 offset_in_lvq_mode_SN_fx[][21] = -{ +{//Q0 {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 */ @@ -23553,7 +23558,7 @@ const int16_t offset_in_lvq_mode_pred[][32] = }; const Word16 offset_in_lvq_mode_pred_fx[][32] = -{ +{//Q0 {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 */ @@ -23578,28 +23583,28 @@ const Word16 offset_in_lvq_mode_pred_fx[][32] = /*-----------------------------------------------------------------* * BC-TCVQ frame-end quantization tables (BC-TCVQ is used in Voiced mode for 16kHz isf) *-----------------------------------------------------------------*/ -const int16_t NTRANS[4][NUM_STATE] = {{0,2,4,6,8,10,12,14,0,2,4,6,8,10,12,14}, /* indices of previous state of first branche */ +const Word16 NTRANS[4][NUM_STATE] = {{0,2,4,6,8,10,12,14,0,2,4,6,8,10,12,14}, /* indices of previous state of first branche */ {1,3,5,7,9,11,13,15,1,3,5,7,9,11,13,15}, /* indices of previous state of second branches */ {4,2,1,3,0,2,1,3,2,0,3,1,7,0,3,1}, /* indices of previous subset of first branch */ {2,0,3,6,2,0,3,1,0,2,1,3,0,2,1,5} /* indices of previous subset of second branch */ -}; +}; // Q0 -const int16_t NTRANS2[4][NUM_STATE] = {{0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7}, +const Word16 NTRANS2[4][NUM_STATE] = {{0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7}, {8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15}, {4,2,2,0,1,3,3,6,0,2,2,0,1,3,3,1}, {2,0,0,2,3,1,1,3,7,0,0,2,3,1,1,5} -}; +}; // Q0 /* BC-TCQ Bit Allocations */ -const int16_t BC_TCVQ_BIT_ALLOC_40B[M/2+4] = {1, 4, 5,5,4,4, 2,2,2,2, 5,4 }; /*1+39bit*/ +const Word16 BC_TCVQ_BIT_ALLOC_40B[M/2+4] = {1, 4, 5,5,4,4, 2,2,2,2, 5,4 }; /*1+39bit Q0*/ -const int16_t FixBranch_tbl[4][4][N_STAGE_VQ - 4] = +const Word16 FixBranch_tbl[4][4][N_STAGE_VQ - 4] = { {{0, 0, 0, 0}, {1, 0, 0, 0}, {0, 1, 0, 0}, {1, 1, 0, 0}}, /* incase of initial state 0 */ {{0, 0, 1, 0}, {1, 0, 1, 0}, {0, 1, 1, 0}, {1, 1, 1, 0}}, /* incase of initial state 4 */ {{0, 0, 0, 1}, {1, 0, 0, 1}, {0, 1, 0, 1}, {1, 1, 0, 1}}, /* incase of initial state 8 */ {{0, 0, 1, 1}, {1, 0, 1, 1}, {0, 1, 1, 1}, {1, 1, 1, 1}} /* incase of initial state 12 */ -}; +}; // Q0 /* Intra-Prediction */ const float AR_IntraCoeff[N_STAGE_VQ-1][2][2] = @@ -23759,7 +23764,7 @@ const float AR_TCVQ_CB_SUB3[4][32][2] = }; const Word16 AR_TCVQ_CB_SUB1_fx[2][128][2] = /* x2.65 */ -{ +{//Qlog2(2.56) { {-435 , -434}, {-233 , 124}, {-381 , 44}, {-274 , -88}, {-332 , -224}, {-563 , -600}, {-332 , 134}, { 53 , -739}, {-567 , 0}, { 149 , 316}, {-191 , 541}, {-123 , 317}, {-493 , -634}, {-528 , 268}, {-321 , -386}, {-432 , -220}, @@ -23798,7 +23803,7 @@ const Word16 AR_TCVQ_CB_SUB1_fx[2][128][2] = /* x2.65 */ } }; const Word16 AR_TCVQ_CB_SUB2_fx[2][64][2] = -{ +{//Qlog2(2.56) { {-357 , -53}, {-525 , 167}, {-232 , 255}, {-132 , -359}, {-940 , -221}, { -260 , -1296}, {-1197 , -455}, { -833 , 49}, {-132 , -1}, {-401 , -280}, {-212 , -217}, {-194 , 92}, {-580 , -710}, { -862 , -750}, { -669 , 430}, { -521 , 719}, @@ -23821,7 +23826,7 @@ const Word16 AR_TCVQ_CB_SUB2_fx[2][64][2] = } }; const Word16 AR_TCVQ_CB_SUB3_fx[4][32][2] = -{ +{//Qlog2(2.56) { {-487 , 9}, {-456 , -400}, { 96 , 451}, {-239 , 422}, {-685 , -1309}, { 68 , -709}, {-302 , -1185}, { 481 , -287}, {-287 , -697}, {-194 , 73}, {-159 , -132}, {-161 , -312}, {-809 , 417}, {-860 , -926}, { -26 , -71}, {-1052 , -432}, @@ -23947,7 +23952,7 @@ const float SN_TCVQ_CB_SUB3[4][32][2] = }; const Word16 SN_TCVQ_CB_SUB1_fx[2][128][2] = -{ +{//Qlog2(2.56) { {-639 , 105}, {-488 , -449}, {-530 , -811}, {-419 , -634}, {-781 , -1061}, {-585 , 386}, {-501 , -737}, {-489 , -728}, {-702 , -685}, {-510 , -762}, {-390 , -287}, {-379 , -379}, {-573 , -848}, {-583 , -778}, {-500 , -810}, {-671 , -420}, @@ -23987,7 +23992,7 @@ const Word16 SN_TCVQ_CB_SUB1_fx[2][128][2] = }; const Word16 SN_TCVQ_CB_SUB2_fx[2][64][2] = -{ +{//Qlog2(2.56) { {-709 , -609}, {-615 , -1025}, {-430 , -321}, { -44 , 1032}, {-1050 , -32}, {-1028 , -1856}, {-970 , -109}, { -572 , -1426}, {-568 , 154}, {-142 , -189}, { -80 , 533}, { -38 , -632}, { -391 , 1275}, { -986 , -732}, {-479 , -510}, { -966 , 96}, @@ -24010,7 +24015,7 @@ const Word16 SN_TCVQ_CB_SUB2_fx[2][64][2] = } }; const Word16 SN_TCVQ_CB_SUB3_fx[4][32][2] = -{ +{//Qlog2(2.56) { {-377 , -872}, {-407 , 801}, {-611 , -449}, {-397 , -87}, {-476 , -1063}, {-797 , -249}, {-263 , -662}, {-473 , 1508}, {-716 , 310}, {-616 , -982}, {-742 , -1326}, { 197 , 327}, {-894 , -1556}, {-871 , -1259}, {-708 , -1380}, {-789 , -848}, @@ -24095,7 +24100,7 @@ const float AR_SVQ_CB2[16][8] = }; const Word16 AR_SVQ_CB1_fx[32][8] = /* x2.56 */ -{ +{//Qlog2(2.56) { -1, 4, 16, 4, 45, -110, 10, 167, }, { -3, 2, 8, -12, -7, 23, 279, -46, }, { 0, 2, 1, 8, -73, -40, 71, -97, }, @@ -24131,7 +24136,7 @@ const Word16 AR_SVQ_CB1_fx[32][8] = /* x2.56 */ }; const Word16 AR_SVQ_CB2_fx[16][8] = /* x2.56 */ -{ +{//Qlog2(2.56) { -37, -59, 208, -88, 54, 58, -16, -24, }, { 0, -98, 9, -65, -182, -21, 19, 9, }, { -1, 110, -8, 59, 201, 9, -38, -22, }, @@ -24178,7 +24183,7 @@ const Word16 HO_ATT_FX[5] = /* Q15 */ 17597, 20205, 22410, 23198, 23198 }; -const int16_t uniform_model[] = { MAX_AR_FREQ, MAX_AR_FREQ / 2, 0 }; +const Word16 uniform_model[] = { MAX_AR_FREQ, MAX_AR_FREQ / 2, 0 }; // Q0 /*-----------------------------------------------------------------* @@ -24192,7 +24197,7 @@ const float tbl_mid_gen_wb_2b[] = 0.4828f, 0.4701f, 0.1855f, 0.2034f, 0.1897f, 0.1691f, 0.1876f, 0.1558f, 0.1762f, 0.1863f, 0.1950f, 0.1997f, 0.2279f, 0.2492f, 0.3031f, 0.2513f, 0.8591f, 0.9902f, 0.8941f, 0.8507f, 0.8395f, 0.8579f, 0.8529f, 0.8665f, 0.8549f, 0.8490f, 0.8456f, 0.8310f, 0.8161f, 0.7884f, 0.7167f, 0.7381f }; -const Word16 tbl_mid_gen_wb_2b_fx[] = +const Word16 tbl_mid_gen_wb_2b_fx[] =//Q13 { 3814, 5145, 5856, 5290, 5277, 4880, 4877, 4273, 3868, 3776, 3392, 3163, 3120, 3019, 3395, 5814, 1482, 861, 1968, 3198, 3105, 3737, 3749, 4525, 4982, 4828, 5023, 5335, 5327, 5296, 5092, 3444, @@ -24220,7 +24225,7 @@ const float tbl_mid_gen_wb_4b[] = }; const Word16 tbl_mid_gen_wb_4b_fx[] = -{ +{//Q13 5532, 5133, 2125, 3516, 4905, 5624, 6338, 6918, 6854, 6354, 5345, 3996, 3603, 5588, 6962, 7511, 4218, 4157, 4892, 6332, 5786, 2931, 2749, 2306, 3420, 4629, 5591, 6249, 6638, 7273, 7904, 8379, 993, 369, 2927, 5138, 4840, 5892, 5331, 5158, 3956, 3130, 3324, 5022, 5292, 3974, 2488, 1119, @@ -24275,7 +24280,7 @@ const float tbl_mid_gen_wb_5b[] = 0.3360f, 0.8495f, 0.8652f, 0.5642f, 0.3230f, 0.2924f, 0.2144f, 0.0397f, 0.0596f, 0.0316f, -0.0152f, -0.0704f, -0.0675f, 0.0751f, 0.0680f, 0.5636f }; const Word16 tbl_mid_gen_wb_5b_fx[] = -{ +{//Q13 6510, 8058, 7103, 6095, 6483, 5866, 6026, 6443, 6882, 6907, 7015, 6581, 5649, 4044, 2816, 2519, 3778, 2123, 3580, 4221, 2598, 4631, 2844, 4905, 5446, 4529, 5186, 6228, 6210, 5693, 6213, -4670, 9050, 9934, 8441, 7921, 7546, 7840, 7977, 8335, 8679, 8706, 8703, 8607, 8560, 8375, 7759, 6405, @@ -24377,7 +24382,7 @@ const Word16 tbl_mid_voi_wb_1b_fx[] = /* Q13*/ 4551, 4599, 4754, 5035, 4982, 5228, 5318, 5603, 5699, 5652, 5642, 5766, 5825, 5874, 5819, 6056, 3816, 3355, 2321, 2712, 2900, 2715, 2790, 2508, 2506, 2610, 2617, 2419, 2538, 2622, 3004, 2725, }; -const Word16 tbl_mid_voi_wb_4b_fx[] = +const Word16 tbl_mid_voi_wb_4b_fx[] =//Q13 { 4337, 4235, 3526, 4083, 3514, 5457, 3168, 2509, 4418, 5021, 1313, 2952, 5347, 3893, 8325, 11758, 4180, 4037, 3965, 3481, 4028, 3284, 2644, 4585, 4749, 3076, 3211, 1101, 4175, 7440, 5745, -4105, @@ -24396,7 +24401,7 @@ const Word16 tbl_mid_voi_wb_4b_fx[] = 3394, 2776, 1970, 2707, 2983, 3931, 3247, 1729, 449, -109, -46, -469, 397, 1980, 2305, 1573, 3259, 1870, 242, 392, 748, 615, 1185, 1285, 2259, 2687, 2212, 1762, 2174, 1887, 1847, 2073, }; -const Word16 tbl_mid_voi_wb_5b_fx[] = +const Word16 tbl_mid_voi_wb_5b_fx[] =//Q13 { 4182, 3820, 4103, 5620, 4100, 4478, 3949, 5053, 2918, 3083, 4229, 3732, 1823, 6350, 17230, 4601, 4361, 4077, 2236, 4128, 3216, 4673, 6022, 6522, 5746, 4282, 3121, 4448, 6457, 12573, 4401, 7796, @@ -24488,7 +24493,7 @@ const float tbl_mid_unv_wb_5b[] = 0.5444f, 0.5385f, 0.4809f, 0.5395f, 1.1487f, -0.3404f, -0.3082f, -0.3512f, -0.2280f, 0.3479f, 0.5481f, 0.4996f, 0.3860f, 0.4747f, 0.4639f, 0.4263f, 0.7822f, 1.0122f, 1.0295f, 1.0430f, 1.0629f, 1.1165f, 1.1447f, 1.1354f, 1.1063f, 1.0919f, 1.0188f, 0.9977f, 0.8758f, 0.8855f, 0.7471f, 0.9058f }; -const Word16 tbl_mid_unv_wb_4b_fx[] = +const Word16 tbl_mid_unv_wb_4b_fx[] =//Q13 { 5190, 3143, 50, 2521, 5180, 6320, 3890, 3365, 3582, 3517, 3406, 3049, 2864, 1621, 1932, -950, 6813, 6650, 2135, 972, 452, 1453, 3221, 1697, 3165, 4443, 5924, 6297, 3907, 2862, 3586, 4625, @@ -24508,7 +24513,7 @@ const Word16 tbl_mid_unv_wb_4b_fx[] = 5380, 7307, 7727, 8135, 8270, 8471, 8792, 8573, 8335, 8420, 8057, 7562, 7119, 7458, 6806, 7385, }; const Word16 tbl_mid_unv_wb_5b_fx[] = -{ +{//Q13 6237, 6323, 1151, 763, 4218, 6546, 8437, 8701, 7456, 6604, 4631, 2901, 3050, 1793, 1955, 2260, 5542, 4318, 5343, 5521, 5999, 5477, 5265, 5234, 4616, 3329, 3444, 1816, -442, 45, -2, 8922, 6370, 8208, 6583, 5630, 5401, 5458, 5188, 5595, 6637, 6891, 6962, 6967, 7014, 6330, 5445, 3101, @@ -24548,110 +24553,110 @@ const Word16 tbl_mid_unv_wb_5b_fx[] = * AVQ - RE8 tables *------------------------------------------------------------------------------*/ -const int16_t select_table22[5][9] = +const Word16 select_table22[5][9] = { {1, 1, 1, 1, 1, 1, 1, 1, 1}, {0, 1, 2, 3, 4, 5, 6, 7, 8}, {0, 0, 1, 3, 6, 10, 15, 21, 28}, {0, 0, 0, 1, 4, 10, 20, 35, 56}, {0, 0, 0, 0, 1, 5, 15, 35, 70} -}; +}; // Q0 /* value of leader element */ -const int16_t vals_a[36][4] = +const Word16 vals_a[36][4] = { {1}, {0,2}, {0,2}, {1,3}, {0,4}, {2,0}, {1,3}, {0,2,4}, {2}, {1,3}, {2,0,4}, {0,4}, {1,5}, {1,3}, {2,0,4}, {0,2,4}, {1,3,5}, {0,2,6}, {0,4}, {0,2,6}, {0,2,4,6}, {1,7}, {0,8}, {0,6}, {0,2,8}, {0,4,8}, {1,9}, {0,2,10}, {0,8}, {0,6,10}, {0,12}, {0,4,12}, {0,10}, {0,2,14}, {0,8,12}, {0,16} -}; +}; // Q0 /* code parameter for every leader */ -const int16_t vals_q[36][4] = +const Word16 vals_q[36][4] = { {7,1}, {2,2,2}, {4,2,4}, {7,2,1}, {1,2,1}, {6,2,2}, {7,2,2}, {3,3,3,1}, {8,1}, {7,2,3}, {5,3,4,1}, {2,2,2}, {7,2,1}, {7,2,4}, {7,3,2,1}, {4,3,4,2}, {7,3,2,1}, {2,3,2,1}, {3,2,3}, {4,3,4,1}, {3,4,3,2}, {7,2,1}, {1,2,1}, {2,2,2}, {3,3,3,1}, {2,3,2,1}, {7,2,1}, {2,3,2,1}, {2,2,2}, {2,3,2,1}, {1,2,1}, {2,3,2,1}, {2,2,2}, {2,3,2,1}, {2,3,2,1}, {1,2,1} -}; +}; // Q0 /* codebook start address for every leader */ -const uint16_t Is[36] = +const UWord16 Is[36] = { 0, 128, 256, 1376, 240, 0, 1792, 2400, 5376, 5632, 12800, 3744, 21760, 22784, 31744, 38912, 45632, 3856, 52800, 53248, 57728, 60416, 4080, 61440, 61552, 62896, 63120, 64144, 64368, 64480, 64704, 64720, 64944, 65056, 65280, 65504 -}; +}; // Q0 /* A3 - Number of the absolute leaders in codebook Q3 */ -const int16_t AA3[NB_LDQ3] = +const Word16 AA3[NB_LDQ3] = { 0, 1, 4, 2, 3, 7, 11, 17, 22 -}; +}; // Q0 /* A4 - Number of the absolute leaders in codebook Q4 */ -const int16_t AA4[NB_LDQ4] = +const Word16 AA4[NB_LDQ4] = { 5, 6, 8, 9, 10, 12, 13, 14, 15, 16, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 -}; +}; // Q0 /* I3 - Cardinality offsets for absolute leaders in Q3 */ -const uint16_t II3[NB_LDQ3] = +const UWord16 II3[NB_LDQ3] = { 0, 128, 240, 256, 1376, 2400, 3744, 3856, 4080 -}; +}; // Q0 /* I4 - Cardinality offset for absolute leaders in Q4 */ -const uint16_t II4[NB_LDQ4] = +const UWord16 II4[NB_LDQ4] = { 0, 1792, 5376, 5632, 12800, 21760, 22784, 31744, 38912, 45632, 52800, 53248, 57728, 60416, 61440, 61552, 62896, 63120, 64144, 64368, 64480, 64704, 64720, 64944, 65056, 65280, 65504 -}; +}; // Q0 /* Position of the first absolute leader on a spherical shell (or sphere) */ -const int16_t Da_pos[NB_SPHERE] = +const Word16 Da_pos[NB_SPHERE] = { 0, 2, 5, 8, 13, 18, 20, 22, 23, 25, 26, 27, 27, 28, 28, 28, 29, 30, 31, 31, 32, 32, 32, 32, 32, 34, 35, 35, 35, 35, 35, 35 -}; +}; // Q0 /* Number of absolute leaders on a spherical shell */ -const int16_t Da_nb[NB_SPHERE] = +const Word16 Da_nb[NB_SPHERE] = { 2, 3, 3, 5, 5, 2, 2, 1, 2, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 0, 1 -}; +}; // Q0 /* Identification code of an absolute leader */ -const int16_t Da_id[NB_LEADER] = +const Word16 Da_id[NB_LEADER] = { 0x0001, 0x0004, 0x0008, 0x000B, 0x0020, 0x000C, 0x0015, 0x0024, 0x0010, 0x001F, 0x0028, 0x0040, 0x004F, 0x0029, 0x002C, 0x0044, 0x0059, 0x00A4, 0x0060, 0x00A8, 0x00C4, 0x012D, 0x0200, 0x0144, 0x0204, 0x0220, 0x0335, 0x04E4, 0x0400, 0x0584, 0x0A20, 0x0A40, 0x09C4, 0x12C4, 0x0C20, 0x2000 -}; +}; // Q0 /* Codebook number for each absolute leader */ -const int16_t Da_nq[NB_LEADER+2] = +const Word16 Da_nq[NB_LEADER+2] = { 2, 2, 3, 3, 2, 4, 4, 3, 4, 4, 4, 3, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 100 -}; +}; // Q0 /*------------------------------------------------------------------------------* * SWB TBE tables *------------------------------------------------------------------------------*/ -const int16_t skip_bands_SWB_TBE[NUM_SHB_SUBFR+1] = {0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320}; /* bands for SWB TBE quantisation */ -const int16_t skip_bands_WB_TBE[NUM_SHB_SUBFR/2+1] = {0, 10, 20, 30, 40, 50, 60, 70, 80}; /* bands for WB TBE quantisation */ +const Word16 skip_bands_SWB_TBE[NUM_SHB_SUBFR+1] = {0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320}; /* bands for SWB TBE quantisation Q0*/ +const Word16 skip_bands_WB_TBE[NUM_SHB_SUBFR/2+1] = {0, 10, 20, 30, 40, 50, 60, 70, 80}; /* bands for WB TBE quantisation Q0*/ const float interpol_frac_shb_flt[NB_SUBFR*2] = { 0.7f, 0.3f, 0.4f, 0.6f, 0.1f, 0.9f, 0.0f, 1.0f }; const Word16 interpol_frac_shb[NB_SUBFR * 2] = @@ -24778,7 +24783,7 @@ const Word16 window_wb_fx[L_SHB_LAHEAD / 4] =/*sin, 1 */ const float subwin_wb[SHB_OVERLAP_LEN/2+1]= {0.00000000f, 0.15643448f, 0.30901700f, 0.45399052f, 0.58778524f, 0.70710677f, 0.80901700f, 0.89100653f, 0.95105654f, 0.98768836f, 1.0000000f}; const Word16 subwin_wb_fx[SHB_OVERLAP_LEN / 2 + 1] = -{ 0, 5126, 10126, 14876, 19261, 23170, 26510, 29197, 31164, 32365, 32767 }; +{ 0, 5126, 10126, 14876, 19261, 23170, 26510, 29197, 31164, 32365, 32767 }; // Q15 /* Window for calculating SHB LPC coeffs */ const float win_lpc_shb[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5/8]= @@ -24853,7 +24858,7 @@ const float win_lpc_hb_wb[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5/32]= 0.991627454f, 0.995722431f, 0.998458667f, 0.999828662f }; const Word16 win_lpc_hb_wb_fx[(L_LOOK_12k8 + L_SUBFR + L_FRAME) * 5 / 32] = -{ +{//Q15 17, 70, 157, 279, 435, 625, 849, 1106, 1396, 1718, 2071, 2454, 2867, 3309, 3779, 4276, 4799, 5346, 5917, 6510, 7125, 7759, 8411, 9081, @@ -24880,7 +24885,7 @@ const float ola_win_shb_switch_fold[L_SUBFR16k] = 0.989176510f, 0.991866698f, 0.994174502f, 0.996099033f, 0.997639549f, 0.998795456f, 0.999566309f, 0.999951809f }; const Word16 ola_win_shb_switch_fold_fx[L_SUBFR16k] = -{ +{//Q15 322, 965, 1608, 2250, 2892, 3532, 4171, 4808, 5444, 6077, 6708, 7336, 7962, 8585, 9204, 9819, 10431, 11039, 11643, 12242, 12836, 13426, 14010, 14589, @@ -25212,7 +25217,7 @@ const float wb_bwe_lsfvq_cbook_8bit[256*6] = 0.240476170f, 0.27948010f, 0.32327234f, 0.37258368f, 0.41532038f, 0.45744253f }; const Word16 wb_bwe_lsfvq_cbook_8bit_fx[256 * 6] = -{ +{//Q15 2107, 3430, 5123, 6677, 9403, 13197, 4031, 5069, 7343, 8910, 10647, 12245, 2037, 3542, 6708, 8763, 10505, 12655, @@ -25999,7 +26004,7 @@ const float wac_swb[LPC_SHB_ORDER + 1] = 0.98239158f, 0.97776669f, 0.97262346f }; const Word16 wac_swb_h[LPC_SHB_ORDER] = -{ +{//Q15 32758, 32731, 32686, @@ -26013,7 +26018,7 @@ const Word16 wac_swb_h[LPC_SHB_ORDER] = }; const Word16 wac_swb_l[LPC_SHB_ORDER] = -{ +{//Q15 29673, 20874, 7850, @@ -26160,7 +26165,7 @@ const float HBCB_SubGain5bit[128] = -2.728315f, -6.770474f, -8.485444f, -4.669493f }; const Word16 HBCB_SubGain5bit_fx[128] = -{ +{//Q8 -15224, -17789, -9897, -5048, -456, -1232, -2238, -2782, -3391, -3864, -4026, -4045, -2017, -1311, -878, -1973, -12837, -15376, -8273, -4141, -2791, -3037, -2403, -342, @@ -26314,12 +26319,12 @@ const float lsf_q_cb_3b[8] = const float * const lsf_q_cb[NUM_Q_LSF] = { lsf_q_cb_4b, lsf_q_cb_4b, lsf_q_cb_3b, lsf_q_cb_3b, lsf_q_cb_3b }; -const int16_t lsf_q_cb_size[NUM_Q_LSF] = {16, 16, 8, 8, 8}; -const int16_t lsf_q_num_bits[NUM_Q_LSF] = { 4, 4, 3, 3, 3 }; +const Word16 lsf_q_cb_size[NUM_Q_LSF] = {16, 16, 8, 8, 8}; // Q0 +const Word16 lsf_q_num_bits[NUM_Q_LSF] = { 4, 4, 3, 3, 3 }; // Q0 /* Tables for approximation of upper half of SWB LSFs */ const float mirror_point_q_cb[MIRROR_POINT_Q_CB_SIZE] = { 0.01436178f, 0.02111641f, 0.02735687f, 0.03712105f }; -const Word16 mirror_point_q_cb_fx[MIRROR_POINT_Q_CB_SIZE] = { 471, 692, 896, 1216 }; +const Word16 mirror_point_q_cb_fx[MIRROR_POINT_Q_CB_SIZE] = { 471, 692, 896, 1216 }; // Q15 const float lsf_grid[4][5] = { @@ -26439,8 +26444,8 @@ const Word16 F_2_5_fx[64] = /*Q10 */ * SWB BWE tables *------------------------------------------------------------------------------*/ -const int16_t swb_bwe_trans_subband[SWB_FENV_TRANS+1] = {240, 316, 392, 476, 560}; -const int16_t swb_bwe_trans_subband_width[SWB_FENV_TRANS] = {76, 76, 84, 84}; +const Word16 swb_bwe_trans_subband[SWB_FENV_TRANS+1] = {240, 316, 392, 476, 560}; // Q0 +const Word16 swb_bwe_trans_subband_width[SWB_FENV_TRANS] = {76, 76, 84, 84}; // Q0 const Word16 sqrt_swb_bwe_trans_subband_width_fx[SWB_FENV_TRANS] = { 17854, 17854, 18770, 18770 };/*Q11 */ @@ -26448,21 +26453,21 @@ const Word16 sqrt_swb_bwe_subband_fx_L1[SWB_FENV] = { 16384, 20066, 16384, 20066 const Word16 sqrt_swb_bwe_subband_fx_L2[SWB_FENV / 2] = { 25905, 25905, 25905, 25905, 28378, 28378, 32767 }; /*Q12 */ -const int16_t swb_bwe_subband[SWB_FENV+1] = {240, 256, 280, 296, 320, 336, 360, 376, 400, 424, 448, 472, 496, 528, 560}; -const Word16 fb_bwe_subband[DIM_FB + 1] = { 640, 680, 720, 800 }; -const Word16 fb_bwe_sm_subband[DIM_FB] = { 656, 696, 760 }; +const Word16 swb_bwe_subband[SWB_FENV+1] = {240, 256, 280, 296, 320, 336, 360, 376, 400, 424, 448, 472, 496, 528, 560}; // Q0 +const Word16 fb_bwe_subband[DIM_FB + 1] = { 640, 680, 720, 800 }; // Q0 +const Word16 fb_bwe_sm_subband[DIM_FB] = { 656, 696, 760 }; // Q0 const float swb_inv_bwe_subband_width[SWB_FENV] = {0.0625f, 0.04167f, 0.0625f, 0.04167f, 0.0625f, 0.04167f, 0.0625f, 0.04167f, 0.04167f, 0.04167f, 0.04167f, 0.04167f, 0.03125f, 0.03125f}; -const Word16 swb_inv_bwe_subband_width_fx[SWB_FENV] = { 2048,1365,2048,1365,2048,1365,2048,1365,1365,1365,1365,1365,1024,1024 }; -const int16_t swb_bwe_sm_subband[SWB_FENV] = {248, 268, 288, 308, 328, 348, 368, 388, 412, 436, 460, 484, 512, 544}; +const Word16 swb_inv_bwe_subband_width_fx[SWB_FENV] = { 2048,1365,2048,1365,2048,1365,2048,1365,1365,1365,1365,1365,1024,1024 };//Q15 +const Word16 swb_bwe_sm_subband[SWB_FENV] = {248, 268, 288, 308, 328, 348, 368, 388, 412, 436, 460, 484, 512, 544}; // Q0 const float smooth_factor[SWB_FENV-1] = {0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.0417f, 0.0417f, 0.0417f, 0.0417f, 0.03125f, 0.03125f}; -const Word16 smooth_factor_fx[SWB_FENV - 1] = { 1638, 1638, 1638, 1638, 1638, 1638, 1638, 1366, 1366, 1366, 1366, 1024, 1024 }; +const Word16 smooth_factor_fx[SWB_FENV - 1] = { 1638, 1638, 1638, 1638, 1638, 1638, 1638, 1366, 1366, 1366, 1366, 1024, 1024 };//Q15 -const int16_t fb_bwe_subband_float[DIM_FB+1] = {640, 680, 720, 800}; +const Word16 fb_bwe_subband_float[DIM_FB+1] = {640, 680, 720, 800}; // Q0 const float fb_inv_bwe_subband_width[DIM_FB] = {0.0250f, 0.0250f, 0.0125f}; -const Word16 fb_inv_bwe_subband_width_fx[DIM_FB] = { 819, 819, 409 }; -const int16_t fb_bwe_sm_subband_float[DIM_FB] = {656, 696, 760}; +const Word16 fb_inv_bwe_subband_width_fx[DIM_FB] = { 819, 819, 409 };//Q15 +const Word16 fb_bwe_sm_subband_float[DIM_FB] = {656, 696, 760}; // Q0 const float fb_smooth_factor[DIM_FB] = {0.03125f, 0.0250f, 0.015625f}; -const Word16 fb_smooth_factor_fx[DIM_FB] = { 1024, 819, 512 }; +const Word16 fb_smooth_factor_fx[DIM_FB] = { 1024, 819, 512 };//Q15 const float EnvCdbk11 [N_CB11 * DIM11] = { -8.6703f, 0.1116f, 4.5639f, 8.2950f, 8.5148f, 4.7195f, 2.8963f, @@ -27641,15 +27646,15 @@ const float gain_table_SWB_BWE[NB_SWB_SUBBANDS] = {-0.4f, 0.1f, 0.6f, 1.1f}; const Word16 gain_table_SWB_BWE_fx[NB_SWB_SUBBANDS] = { -6554/*-0.4f*/, 1638/*0.1f*/, 9830/*0.6f*/, 18022/*1.1f*/ }; /* Q14 */ -const int16_t bits_lagIndices_modeNormal[NB_SWB_SUBBANDS] = {2, 2, 1, 1}; -const int16_t subband_offsets_12KBPS[NB_SWB_SUBBANDS] = {SWB_SB_OFF0_12KBPS, SWB_SB_OFF1_12KBPS, SWB_SB_OFF2_12KBPS, SWB_SB_OFF3_12KBPS}; -const int16_t subband_offsets_16KBPS[NB_SWB_SUBBANDS] = {SWB_SB_OFF0_16KBPS, SWB_SB_OFF1_16KBPS, SWB_SB_OFF2_16KBPS, SWB_SB_OFF3_16KBPS}; +const Word16 bits_lagIndices_modeNormal[NB_SWB_SUBBANDS] = {2, 2, 1, 1}; // Q0 +const Word16 subband_offsets_12KBPS[NB_SWB_SUBBANDS] = {SWB_SB_OFF0_12KBPS, SWB_SB_OFF1_12KBPS, SWB_SB_OFF2_12KBPS, SWB_SB_OFF3_12KBPS}; // Q0 +const Word16 subband_offsets_16KBPS[NB_SWB_SUBBANDS] = {SWB_SB_OFF0_16KBPS, SWB_SB_OFF1_16KBPS, SWB_SB_OFF2_16KBPS, SWB_SB_OFF3_16KBPS}; // Q0 /* Search offset for the subbands that use a partial search */ -const int16_t subband_search_offsets[NB_SWB_SUBBANDS] = +const Word16 subband_search_offsets[NB_SWB_SUBBANDS] = { 0, 0, 64, 64 -}; +}; // Q0 @@ -27662,32 +27667,32 @@ const Word16 bw_SPT_tbl[2][SPT_SHORTEN_SBNUM]= /* Harmonic Mode */ -const int16_t bits_lagIndices_mode0_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB] = {1,1}; +const Word16 bits_lagIndices_mode0_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB] = {1,1}; // Q0 /* 13.2 kbps */ -const int16_t subband_offsets_sub5_13p2kbps_Har[NB_SWB_SUBBANDS_HAR] = +const Word16 subband_offsets_sub5_13p2kbps_Har[NB_SWB_SUBBANDS_HAR] = { SWB_SB_OFF0_SUB5_12KBPS_HAR, SWB_SB_OFF1_SUB5_12KBPS_HAR, SWB_SB_OFF2_SUB5_12KBPS_HAR, SWB_SB_OFF3_SUB5_12KBPS_HAR -}; +}; // Q0 /* Search offset for the subbands that use a partial search */ -const int16_t subband_search_offsets_13p2kbps_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB] = +const Word16 subband_search_offsets_13p2kbps_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB] = { 120, 210 -}; +}; // Q0 /* 16.4 kbps */ -const int16_t subband_offsets_sub5_16p4kbps_Har[NB_SWB_SUBBANDS_HAR] = +const Word16 subband_offsets_sub5_16p4kbps_Har[NB_SWB_SUBBANDS_HAR] = { SWB_SB_OFF0_SUB5_16KBPS_HAR, SWB_SB_OFF1_SUB5_16KBPS_HAR, SWB_SB_OFF2_SUB5_16KBPS_HAR, SWB_SB_OFF3_SUB5_16KBPS_HAR -}; +}; // Q0 /* Search offset for the subbands that use a partial search */ -const int16_t subband_search_offsets_16p4kbps_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB] = +const Word16 subband_search_offsets_16p4kbps_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB] = { 120, 210 -}; +}; // Q0 /*------------------------------------------------------------------------------* @@ -27797,7 +27802,7 @@ const float wscw16q15_8[40] = 0.137023925781250f, 0.098022460937500f, 0.058868408203125f, 0.019622802734375f, }; -const Word16 wscw16q15_fx[240] = +const Word16 wscw16q15_fx[240] =/*Q15 */ { -32768, -32766, -32764, -32759, -32754, -32747, -32738, -32729, -32717, -32705, -32691, -32675, -32658, -32640, -32621, -32600, -32577, -32553, -32528, -32501, -32473, -32444, @@ -27822,7 +27827,7 @@ const Word16 wscw16q15_fx[240] = 4171, 3958, 3745, 3532, 3319, 3105, 2892, 2678, 2464, 2250, 2036, 1822, 1608, 1394, 1179, 965, 751, 536, 322, 107 }; -const Word16 wscw16q15_8_fx[40] = +const Word16 wscw16q15_8_fx[40] =/*Q15 */ { -32762, -32711, -32610, -32459, -32258, -32007, -31706, -31357, -30959, -30514, -30022, -29483, -28899, -28270, -27598, -26883, @@ -27830,7 +27835,7 @@ const Word16 wscw16q15_8_fx[40] = 18736, 17666, 16569, 15447, 14300, 13132, 11943, 10736, 9512, 8274, 7022, 5760, 4490, 3212, 1929, 643 }; -const Word16 wscw16q15_16_fx[80] = +const Word16 wscw16q15_16_fx[80] =/*Q15 */ { -32766, -32754, -32729, -32691, -32640, -32577, -32501, -32413, -32313, -32200, -32074, -31936, -31786, -31624, -31449, -31262, @@ -27843,7 +27848,7 @@ const Word16 wscw16q15_16_fx[80] = 9819, 9204, 8585, 7962, 7336, 6708, 6077, 5444, 4808, 4171, 3532, 2892, 2250, 1608, 965, 322 }; -const Word16 wscw16q15_32_fx[160] = +const Word16 wscw16q15_32_fx[160] =/*Q15 */ { -32768, -32764, -32758, -32749, -32736, -32720, -32701, -32679, -32654, -32626, -32594, -32559, -32522, -32481, -32437, -32389, -32339, -32286, -32229, -32169, -32107, -32041, @@ -27972,16 +27977,16 @@ const Word32 dicn_pg_fx[45] = /* Q12 */ 16384, 11585, 8192, 5793, 4096, 2896, 2048, 1448, 1024, 724 }; -const int16_t expPkEnrg_tbl[45] = +const Word16 expPkEnrg_tbl[45] = { 0, 0, 0, 0, 0, 2, 2, 2, 2, 4, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26, 26, 28, 28, 30, 30, 32, 32, 34, 34, 36, 36, 38 -}; +}; // Q0 -const int32_t manPkEnrg_tbl[45] = +const Word32 manPkEnrg_tbl[45] = { 2147483646, 1518500308, 1073741787, 759250076, 536870912, 1518500294, 1073741787, 759250076, 536870912, 1518500294, @@ -27992,8 +27997,8 @@ const int32_t manPkEnrg_tbl[45] = 1073744140, 536870912, 1073744140, 536870912, 1073697800, 536870912, 1073697800, 536870912, 1073883168, 536870912, 1073512448, 536870912, 1073512448, 536870912, 1073512448 -}; -const int32_t E_max5_tbl[40] = +}; // Q0 +const Word32 E_max5_tbl[40] = { 2047999999, 1448154663, 1024000000, 1448154663, 1024000000, 1448154663, 1024000000, 1448154663, 1024000000, 1448154663, @@ -28003,73 +28008,73 @@ const int32_t E_max5_tbl[40] = 1448156250, 1024000000, 1448156250, 1024000000, 1448156250, 1024000000, 1448156250, 1024000000, 1448125000, 1024000000, 1448125000, 1024000000, 1448250000, 1024000000, 1448000000 -}; +}; // Q0 -const int16_t resize_huffsizn[32] = +const Word16 resize_huffsizn[32] = { 0, 0, 0, 0, 0, 11, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, 0 -}; +}; // Q0 -const int16_t huffsizn[32] = +const Word16 huffsizn[32] = { 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 4, 4, 3, 3, 3, 3, 4, 4, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7 -}; +}; // Q0 -const int16_t huffnorm_tran[32] = +const Word16 huffnorm_tran[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,122, 10, 6, 1, 0, 3, 2, 26, 58, 186, 442, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; +}; // Q0 -const int16_t huffsizn_tran[32] = +const Word16 huffsizn_tran[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 5, 3, 2, 2, 2, 4, 6, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; +}; // Q0 -const int16_t pgain_huffsizn[32] = +const Word16 pgain_huffsizn[32] = { 10, 11, 10, 10, 9, 8, 6, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 6, 7, 7, 8, 10, 10, 12, 12 -}; +}; // Q0 -const int16_t dicnlg2_float[40] = +const Word16 dicnlg2_float[40] = { 34, 33, 32, 31, 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, -1, -2, -3, -4, -5 -}; +}; // Q0 /*** Table for quantization of MLT coefficients ***/ -const int16_t norm_order_48[NB_SFM] = +const Word16 norm_order_48[NB_SFM] = { 0, 1, 8, 9, 16, 20, 24, 28, 32, 36, 40, 41, 37, 33, 29, 25, 21, 17, 11, 10, 3, 2, 4, 5, 12, 13, 18, 22, 26, 30, 34, 38, 42, 43, 39, 35, 31, 27, 23, 19, 15, 14, 7, 6 -}; +}; // Q0 -const int16_t norm_order_32[SFM_N_SWB] = +const Word16 norm_order_32[SFM_N_SWB] = { 0, 1, 8, 9, 16, 20, 24, 28, 32, 36, 37, 33, 29, 25, 21, 17, 11, 10, 3, 2, 4, 5, 12, 13, 18, 22, 26, 30, 34, 38, 35, 31, 27, 23, 19, 15, 14, 7, 6 -}; +}; // Q0 -const int16_t norm_order_16[SFM_N_WB] = +const Word16 norm_order_16[SFM_N_WB] = { 0, 1, 8, 9, 16, 20, 24, 21, 17, 11, 10, 3, 2, 4, 5, 12, 13, 18, 22, 25, 23, 19, 15, 14, 7, 6 -}; +}; // Q0 -const int16_t intl_bw_16[N_INTL_GRP_16] = {16, 16}; -const int16_t intl_bw_32[N_INTL_GRP_32] = {16, 24}; -const int16_t intl_bw_48[N_INTL_GRP_48] = {16, 24, 32}; +const Word16 intl_bw_16[N_INTL_GRP_16] = {16, 16}; // Q0 +const Word16 intl_bw_32[N_INTL_GRP_32] = {16, 24}; // Q0 +const Word16 intl_bw_48[N_INTL_GRP_48] = {16, 24, 32}; // Q0 -const int16_t intl_cnt_16[N_INTL_GRP_16] = {4, 1}; -const int16_t intl_cnt_32[N_INTL_GRP_32] = {4, 4}; -const int16_t intl_cnt_48[N_INTL_GRP_48] = {4, 3, 2}; +const Word16 intl_cnt_16[N_INTL_GRP_16] = {4, 1}; // Q0 +const Word16 intl_cnt_32[N_INTL_GRP_32] = {4, 4}; // Q0 +const Word16 intl_cnt_48[N_INTL_GRP_48] = {4, 3, 2}; // Q0 const Word16 band_start_HQ[44] = { @@ -28077,7 +28082,7 @@ const Word16 band_start_HQ[44] = 96, 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240, 256, 280, 304, 328, 352, 376, 400, 424, 448, 472, 496, 520, 544, 576, 608, 640, 672, 704, 736, 768 -}; +}; // Q0 const Word16 band_end_HQ[44] = { @@ -28085,7 +28090,7 @@ const Word16 band_end_HQ[44] = 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240, 256, 280, 304, 328, 352, 376, 400, 424, 448, 472, 496, 520, 544, 576, 608, 640, 672, 704, 736, 768, 800 -}; +}; // Q0 const Word16 band_len_HQ[44] = { @@ -28093,41 +28098,41 @@ const Word16 band_len_HQ[44] = 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 32, 32, 32, 32, 32, 32, 32, 32 -}; +}; // Q0 -const int16_t band_start_wb[26] = +const Word16 band_start_wb[26] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240, 256, 288 -}; +}; // Q0 -const int16_t band_end_wb[26] = +const Word16 band_end_wb[26] = { 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 144, 160, 176, 192, 208, 224, 240, 256, 288, 320 -}; +}; // Q0 -const int16_t band_len_wb[26] = +const Word16 band_len_wb[26] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 32, 32 -}; -const Word16 band_len_harm_float[SFM_N_HARM_FB] = +}; // Q0 +const Word16 band_len_harm_float[SFM_N_HARM_FB] = // Q0 { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 32, 32, 32, 48, 48, 48, 48, 64, 64, 64, 96 }; -const Word16 band_start_harm[SFM_N_HARM_FB] = +const Word16 band_start_harm[SFM_N_HARM_FB] =//Q0 { 0, 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 }; -const Word16 band_end_harm[SFM_N_HARM_FB] = +const Word16 band_end_harm[SFM_N_HARM_FB] =//Q0 { 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 @@ -28139,10 +28144,10 @@ const float rat_flt[SFM_N_WB] = {1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, }; const Word16 rat_fx[SFM_N_WB] = { 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 24576, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 13107, 13107 -}; +};//Q14 -const int16_t sfm_width[20] = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 8}; -const int16_t a_map[20] = {8, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 7, 11}; +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}; // Q0 +const Word16 a_map[20] = {8, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 5, 7, 11}; // Q0 const Word32 SQRT_DIM_fx[65] = /* sqrt(x) for x = 0, 1, ..., 64. in Q15 */ @@ -28722,7 +28727,7 @@ const float short_window_48kHz[480] = 0.0359802f, 0.0294495f, 0.0229187f, 0.0163574f, 0.00982666f, 0.00326538f }; -const Word16 short_window_48kHz_fx[L_FRAME48k / 2 / 2] = /* second half is symetric and omitted */ +const Word16 short_window_48kHz_fx[L_FRAME48k / 2 / 2] = /* second half is symetric and omitted Q15*/ { 107, 322, 536, 751, 965, 1179, 1394, 1608, 1822, 2036, 2250, 2464, 2678, 2892, 3105, 3319, 3532, 3745, 3958, 4171, 4383, 4596, 4808, 5020, 5232, 5444, 5655, 5866, 6077, 6288, 6498, 6708, @@ -28740,7 +28745,7 @@ const Word16 short_window_48kHz_fx[L_FRAME48k / 2 / 2] = /* second half is sym 32074, 32117, 32159, 32200, 32239, 32276, 32313, 32348, 32381, 32413, 32444, 32473, 32501, 32528, 32553, 32577, 32600, 32621, 32640, 32658, 32675, 32691, 32705, 32717, 32729, 32738, 32747, 32754, 32759, 32764, 32766, 32767, }; -const Word16 short_window_32kHz_fx[L_FRAME32k / 2 / 2] = /* second half is symetric and omitted */ +const Word16 short_window_32kHz_fx[L_FRAME32k / 2 / 2] = /* second half is symetric and omitted Q15*/ { 161, 483, 804, 1126, 1447, 1768, 2090, 2411, 2731, 3052, 3372, 3692, 4011, 4330, 4649, 4967, 5285, 5602, 5919, 6235, 6550, 6865, 7180, 7493, 7806, 8118, 8429, 8740, 9049, 9358, 9666, 9973, @@ -28754,7 +28759,7 @@ const Word16 short_window_32kHz_fx[L_FRAME32k / 2 / 2] = /* second half is sym 32389, 32437, 32481, 32522, 32559, 32594, 32626, 32654, 32679, 32701, 32720, 32736, 32749, 32758, 32764, 32767, }; -const Word16 short_window_16kHz_fx[L_FRAME16k / 2 / 2] = /* second half is symetric and omitted */ +const Word16 short_window_16kHz_fx[L_FRAME16k / 2 / 2] = /* second half is symetric and omitted Q15*/ { 322, 965, 1608, 2250, 2892, 3532, 4171, 4808, 5444, 6077, 6708, 7336, 7962, 8585, 9204, 9819, 10431, 11039, 11643, 12242, 12836, 13426, 14010, 14589, 15162, 15730, 16291, 16846, 17395, 17937, 18472, 18999, @@ -28763,7 +28768,7 @@ const Word16 short_window_16kHz_fx[L_FRAME16k / 2 / 2] = /* second half is sym 31262, 31449, 31624, 31786, 31936, 32074, 32200, 32313, 32413, 32501, 32577, 32640, 32691, 32729, 32754, 32766, }; -const Word16 short_window_8kHz_fx[L_FRAME8k / 2 / 2] = /* second half is symetric and omitted */ +const Word16 short_window_8kHz_fx[L_FRAME8k / 2 / 2] = /* second half is symetric and omitted Q15*/ { 643, 1929, 3212, 4490, 5760, 7022, 8274, 9512, 10736, 11943, 13132, 14300, 15447, 16569, 17666, 18736, @@ -28772,20 +28777,20 @@ const Word16 short_window_8kHz_fx[L_FRAME8k / 2 / 2] = /* second half is symet 31357, 31706, 32007, 32258, 32459, 32610, 32711, 32762, }; -const Word16 inv_jp2[64] = +const Word16 inv_jp2[64] =//Q15 { 16384, 10923, 8192, 6554, 5461, 4681, 4096, 3641, 3277, 2979, 2731, 2521, 2341, 2185, 2048, 1928, 1820, 1725, 1638, 1560, 1489, 1425, 1365, 1311, 1260, 1214, 1170, 1130, 1092, 1057, 1024, 993, 964, 936, 910, 886, 862, 840, 819, 799, 780, 762, 745, 728, 712, 697, 683, 669, 655, 643, 630, 618, 607, 596, 585, 575, 565, 555, 546, 537, 529, 520, 512, 504 }; -const int16_t subf_norm_groups[4][11] = +const Word16 subf_norm_groups[4][11] = { {0,1,8,9,16,20,24,28,32,36,40}, {2,3,10,11,17,21,25,29,33,37,41}, {4,5,12,13,18,22,26,30,34,38,42}, {6,7,14,15,19,23,27,31,35,39,43} -}; +}; // Q0 const float gain_att[MAX_P_ATT] = { @@ -28835,7 +28840,7 @@ const Word16 att_step_fx[4] = /* Q=13 */ 32767, 16384, 10923, 8192 }; -const Word32 table_logcum_fx[563] = +const Word32 table_logcum_fx[563] =//Q16 { 0, 0, 0, 65536, 169408, 300480, 452650, 622058, 806041, 1002649, 1210393, 1428099, 1654816, 1889761, 2132272, 2381791, 2637833, @@ -28914,31 +28919,31 @@ const Word32 pow_getbitsfrompulses_fx[16] = /*Q21 */ 2097152, 2190001, 2286961, 2388214, 2493948, 2604365, 2719671, 2840081, 2965822, 3097129, 3234251, 3377442, 3526976, 3683128, 3846194, 4016480 }; -const Word16 DDP_fx[4] = { 3, 0, 1, 2 }; +const Word16 DDP_fx[4] = { 3, 0, 1, 2 };//Q0 const float DDP[4] = { 3.0f, 0.0f, 1.0f, 2.0f }; -const int16_t step_tcq[8][STATES] = { {0,4}, {0,4}, {1,5}, {1,5}, {2,6}, {2,6}, {3,7}, {3,7} }; -const int16_t denc[8][STATES] = { {0,2}, {2,0}, {1,3}, {3,1}, {2,0}, {0,2}, {3,1}, {1,3} }; /* enc trellis */ -const int16_t ddec[8][STATES] = { {0,2}, {1,3}, {2,0}, {3,1}, {2,0}, {3,1}, {0,2}, {1,3} }; /* dec trellis */ +const Word16 step_tcq[8][STATES] = { {0,4}, {0,4}, {1,5}, {1,5}, {2,6}, {2,6}, {3,7}, {3,7} }; // Q0 +const Word16 denc[8][STATES] = { {0,2}, {2,0}, {1,3}, {3,1}, {2,0}, {0,2}, {3,1}, {1,3} }; /* enc trellis Q0*/ +const Word16 ddec[8][STATES] = { {0,2}, {1,3}, {2,0}, {3,1}, {2,0}, {3,1}, {0,2}, {1,3} }; /* dec trellis Q0*/ -const int16_t step_LSB[STATES_LSB][2] = { {0,1}, {2,3}, {0,1}, {2,3} }; -const int16_t denc_LSB[STATES_LSB][2] = { {0,3}, {2,1}, {3,0}, {1,2} }; -const int16_t dqnt_LSB[STATES_LSB][4] = { {0,8,1,8}, {0,8,1,8}, {8,0,8,1}, {8,0,8,1} }; +const Word16 step_LSB[STATES_LSB][2] = { {0,1}, {2,3}, {0,1}, {2,3} }; // Q0 +const Word16 denc_LSB[STATES_LSB][2] = { {0,3}, {2,1}, {3,0}, {1,2} }; // Q0 +const Word16 dqnt_LSB[STATES_LSB][4] = { {0,8,1,8}, {0,8,1,8}, {8,0,8,1}, {8,0,8,1} }; // Q0 -const int16_t dstep_LSB[4][2] = { {0,2}, {0,2}, {1,3}, {1,3} }; -const int16_t ddec_LSB[4][2] = { {0,3}, {3,0}, {2,1}, {1,2} }; +const Word16 dstep_LSB[4][2] = { {0,2}, {0,2}, {1,3}, {1,3} }; // Q0 +const Word16 ddec_LSB[4][2] = { {0,3}, {3,0}, {2,1}, {1,2} }; // Q0 -const int16_t nextstate[STATES][2] = {{0, 1}, {2, 3}, {4, 5}, {6, 7}, {0, 1}, {2, 3}, {4, 5}, {6, 7}};/*current state points to next two states */ +const Word16 nextstate[STATES][2] = {{0, 1}, {2, 3}, {4, 5}, {6, 7}, {0, 1}, {2, 3}, {4, 5}, {6, 7}};/*current state points to next two states Q0*/ /*------------------------------------------------------------------------------* * PVQ tables *------------------------------------------------------------------------------*/ -const int16_t fine_gain_bits[8] = {0, 0, 0, 1, 2, 2, 4, 5}; +const Word16 fine_gain_bits[8] = {0, 0, 0, 1, 2, 2, 4, 5}; // Q0 const float finegain_1[2] = {-0.7448924f, 0.7718827f}; const float finegain_2[4] = {-1.0847910f, -0.3616628f, 0.3668007f, 1.1455675f}; const float finegain_3[8] = {-1.0000000f, -0.7142857f, -0.4285714f, -0.1428571f, 0.1428571f, 0.4285714f, 0.7142857f, 1.0000000f}; @@ -28960,323 +28965,323 @@ const Word16 finegain_5_fx[32] = /* Q14 */ 449, 1390, 2364, 3433, 4579, 5516, 6769, 7767, 9085, 10152, 11009, 12535, 14765, 17093, 20094, 24716 }; -const Word16* finegain_fx[5] = { finegain_1_fx, finegain_2_fx, finegain_3_fx, finegain_4_fx, finegain_5_fx }; +const Word16* finegain_fx[5] = { finegain_1_fx, finegain_2_fx, finegain_3_fx, finegain_4_fx, finegain_5_fx };/* Q14 */ -const uint8_t hBitsMinus1_N01[2] = {1, 7}; +const UWord8 hBitsMinus1_N01[2] = {1, 7}; // Q0 -const uint8_t hBitsMinus1_N02[65]= +const UWord8 hBitsMinus1_N02[65]= { 64, 15, 23, 28, 31, 34, 36, 38, 39, 41, 42, 43, 44, 45, 46, 47, 47, 48, 49, 49, 50, 51, 52, 53, 54, 54, 55, 56, 57, 57, 58, 59, 60, 61, 62, 63, 63, 64, 65, 65, 67, 68, 69, 69, 70, 71, 72, 72, 73, 74, 75, 76, 77, 78, 79, 80, 80, 81, 82, 83, 84, 85, 86, 87, 87 -}; +}; // Q0 -const uint8_t hBitsMinus1_N03[65]= +const UWord8 hBitsMinus1_N03[65]= { 64, 20, 33, 41, 48, 53, 57, 61, 64, 66, 69, 71, 73, 75, 76, 78, 80, 81, 82, 83, 85, 86, 88, 90, 92, 93, 95, 96, 98, 99, 100, 102, 104, 106, 108, 110, 111, 113, 114, 115, 118, 120, 122, 123, 125, 127, 128, 129, 131, 133, 135, 137, 139, 141, 142, 144, 145, 146, 149, 151, 153, 155, 157, 158, 160 -}; +}; // Q0 -const uint8_t hBitsMinus1_N04[65]= +const UWord8 hBitsMinus1_N04[65]= { 64, 23, 39, 51, 60, 67, 73, 79, 83, 87, 91, 94, 97, 100, 102, 105, 107, 109, 111, 113, 115, 116, 119, 122, 125, 127, 130, 132, 134, 136, 138, 141, 144, 147, 150, 152, 154, 156, 158, 160, 164, 167, 170, 173, 175, 177, 180, 182, 184, 187, 190, 193, 196, 199, 201, 203, 205, 207, 211, 214, 217, 220, 222, 225, 227 -}; +}; // Q0 -const uint8_t hBitsMinus1_N05[54]= +const UWord8 hBitsMinus1_N05[54]= { 53, 26, 45, 59, 70, 79, 87, 94, 100, 105, 110, 114, 118, 122, 125, 128, 131, 134, 136, 139, 141, 144, 148, 152, 155, 158, 161, 164, 167, 170, 172, 176, 181, 184, 188, 191, 194, 197, 200, 202, 207, 211, 215, 219, 222, 225, 228, 231, 233, 238, 242, 246, 250, 253 -}; +}; // Q0 -const uint8_t hBitsMinus1_N06[42]= +const UWord8 hBitsMinus1_N06[42]= { 41, 28, 49, 65, 78, 89, 99, 107, 114, 120, 126, 132, 136, 141, 145, 149, 153, 156, 159, 162, 165, 168, 173, 178, 183, 187, 191, 194, 198, 201, 204, 209, 214, 219, 224, 228, 231, 235, 238, 241, 247, 253 -}; +}; // Q0 -const uint8_t hBitsMinus1_N07[34]= +const UWord8 hBitsMinus1_N07[34]= { 33, 30, 52, 70, 85, 98, 109, 118, 126, 134, 141, 147, 153, 158, 163, 168, 172, 176, 180, 184, 188, 191, 197, 203, 208, 213, 218, 222, 226, 230, 233, 240, 246, 252 -}; +}; // Q0 -const uint8_t hBitsMinus1_N08[29]= +const UWord8 hBitsMinus1_N08[29]= { 28, 31, 55, 75, 91, 105, 117, 128, 138, 146, 154, 161, 168, 174, 180, 185, 190, 195, 200, 204, 208, 212, 219, 226, 232, 238, 243, 248, 253 -}; +}; // Q0 -const uint8_t hBitsMinus1_N09[25]= +const UWord8 hBitsMinus1_N09[25]= { 24, 33, 58, 79, 97, 112, 125, 137, 148, 157, 166, 174, 182, 189, 195, 201, 207, 212, 217, 222, 227, 231, 240, 247, 254 -}; +}; // Q0 -const uint8_t hBitsMinus1_N10[22]= +const UWord8 hBitsMinus1_N10[22]= { 21, 34, 61, 83, 101, 118, 132, 145, 157, 167, 177, 186, 194, 202, 209, 216, 222, 228, 234, 239, 245, 250 -}; +}; // Q0 -const uint8_t hBitsMinus1_N11[19]= +const UWord8 hBitsMinus1_N11[19]= { 18, 35, 63, 86, 106, 123, 139, 152, 165, 176, 187, 197, 206, 214, 222, 230, 237, 243, 250 -}; +}; // Q0 -const uint8_t hBitsMinus1_N12[17]= +const UWord8 hBitsMinus1_N12[17]= { 16, 36, 65, 89, 110, 128, 144, 159, 173, 185, 196, 207, 217, 226, 234, 242, 250 -}; +}; // Q0 -const uint8_t hBitsMinus1_N13[16]= +const UWord8 hBitsMinus1_N13[16]= { 15, 37, 67, 92, 113, 133, 150, 165, 180, 193, 205, 216, 227, 237, 246, 254, -}; +}; // Q0 -const uint8_t hBitsMinus1_N14[14]= +const UWord8 hBitsMinus1_N14[14]= { 13, 38, 68, 94, 117, 137, 155, 171, 186, 200, 213, 225, 236, 247 -}; +}; // Q0 -const uint8_t hBitsMinus1_N15[13]= +const UWord8 hBitsMinus1_N15[13]= { 12, 39, 70, 97, 120, 141, 160, 177, 193, 207, 221, 233, 245 -}; +}; // Q0 -const uint8_t hBitsMinus1_N16[13]= +const UWord8 hBitsMinus1_N16[13]= { 12, 39, 71, 99, 123, 144, 164, 182, 198, 214, 228, 241, 253 -}; +}; // Q0 -const uint8_t hBitsMinus1_N17[12]= +const UWord8 hBitsMinus1_N17[12]= { 11, 40, 73, 101, 126, 148, 168, 187, 204, 220, 234, 248 -}; +}; // Q0 -const uint8_t hBitsMinus1_N18[12]= +const UWord8 hBitsMinus1_N18[12]= { 11, 41, 74, 103, 128, 151, 172, 191, 209, 225, 241, 255 -}; +}; // Q0 -const uint8_t hBitsMinus1_N19[11]= +const UWord8 hBitsMinus1_N19[11]= { 10, 41, 75, 105, 131, 154, 176, 196, 214, 231, 247 -}; +}; // Q0 -const uint8_t hBitsMinus1_N20[11]= +const UWord8 hBitsMinus1_N20[11]= { 10, 42, 77, 107, 133, 157, 179, 200, 219, 236, 253 -}; +}; // Q0 -const uint8_t hBitsMinus1_N21[10]= +const UWord8 hBitsMinus1_N21[10]= { 9, 43, 78, 108, 135, 160, 183, 204, 223, 241 -}; +}; // Q0 -const uint8_t hBitsMinus1_N22[10]= +const UWord8 hBitsMinus1_N22[10]= { 9, 43, 79, 110, 138, 163, 186, 207, 227, 246 -}; +}; // Q0 -const uint8_t hBitsMinus1_N23[10]= +const UWord8 hBitsMinus1_N23[10]= { 9, 44, 80, 111, 140, 165, 189, 211, 231, 250 -}; +}; // Q0 -const uint8_t hBitsMinus1_N24[10]= +const UWord8 hBitsMinus1_N24[10]= { 9, 44, 81, 113, 142, 168, 192, 214, 235, 255 -}; +}; // Q0 -const uint8_t hBitsMinus1_N25[9]= +const UWord8 hBitsMinus1_N25[9]= { 8, 45, 82, 114, 143, 170, 195, 217, 239 -}; +}; // Q0 -const uint8_t hBitsMinus1_N26[9]= +const UWord8 hBitsMinus1_N26[9]= { 8, 45, 83, 116, 145, 172, 197, 221, 242 -}; +}; // Q0 -const uint8_t hBitsMinus1_N27[9]= +const UWord8 hBitsMinus1_N27[9]= { 8, 46, 84, 117, 147, 175, 200, 224, 246 -}; +}; // Q0 -const uint8_t hBitsMinus1_N28[9]= +const UWord8 hBitsMinus1_N28[9]= { 8, 46, 84, 118, 149, 177, 202, 227, 249 -}; -const uint8_t hBitsMinus1_N29[9]= +}; // Q0 +const UWord8 hBitsMinus1_N29[9]= { 8, 46, 85, 119, 150, 179, 205, 229, 252 -}; -const uint8_t hBitsMinus1_N30[8]= +}; // Q0 +const UWord8 hBitsMinus1_N30[8]= { 7, 47, 86, 121, 152, 181, 207, 232 -}; -const uint8_t hBitsMinus1_N31[8]= +}; // Q0 +const UWord8 hBitsMinus1_N31[8]= { 7, 47, 87, 122, 153, 182, 209, 235 -}; -const uint8_t hBitsMinus1_N32[8]= +}; // Q0 +const UWord8 hBitsMinus1_N32[8]= { 7, 47, 87, 123, 155, 184, 212, 237 -}; -const uint8_t hBitsMinus1_N33[8]= +}; // Q0 +const UWord8 hBitsMinus1_N33[8]= { 7, 48, 88, 124, 156, 186, 214, 240 -}; -const uint8_t hBitsMinus1_N34[8]= +}; // Q0 +const UWord8 hBitsMinus1_N34[8]= { 7, 48, 89, 125, 158, 188, 216, 242 -}; -const uint8_t hBitsMinus1_N35[8]= +}; // Q0 +const UWord8 hBitsMinus1_N35[8]= { 7, 49, 90, 126, 159, 189, 218, 245 -}; -const uint8_t hBitsMinus1_N36[8]= +}; // Q0 +const UWord8 hBitsMinus1_N36[8]= { 7, 49, 90, 127, 160, 191, 220, 247 -}; +}; // Q0 const uint8_t hBitsMinus1_N37[8]= { 7, 49, 91, 128, 162, 193, 222, 249 -}; -const uint8_t hBitsMinus1_N38[8]= +}; // Q0 +const UWord8 hBitsMinus1_N38[8]= { 7, 49, 91, 129, 163, 194, 224, 251 -}; -const uint8_t hBitsMinus1_N39[8]= +}; // Q0 +const UWord8 hBitsMinus1_N39[8]= { 7, 50, 92, 130, 164, 196, 225, 253 -}; -const uint8_t hBitsMinus1_N40[8]= +}; // Q0 +const UWord8 hBitsMinus1_N40[8]= { 7, 50, 93, 131, 165, 197, 227, 255 -}; -const uint8_t hBitsMinus1_N41[7]= +}; // Q0 +const UWord8 hBitsMinus1_N41[7]= { 6, 50, 93, 131, 166, 199, 229 -}; -const uint8_t hBitsMinus1_N42[7]= +}; // Q0 +const UWord8 hBitsMinus1_N42[7]= { 6, 51, 94, 132, 167, 200, 230 -}; -const uint8_t hBitsMinus1_N43[7]= +}; // Q0 +const UWord8 hBitsMinus1_N43[7]= { 6, 51, 94, 133, 168, 201, 232 -}; -const uint8_t hBitsMinus1_N44[7]= +}; // Q0 +const UWord8 hBitsMinus1_N44[7]= { 6, 51, 95, 134, 170, 203, 234 -}; -const uint8_t hBitsMinus1_N45[7]= +}; // Q0 +const UWord8 hBitsMinus1_N45[7]= { 6, 51, 95, 135, 171, 204, 235 -}; -const uint8_t hBitsMinus1_N46[7]= +}; // Q0 +const UWord8 hBitsMinus1_N46[7]= { 6, 52, 96, 135, 172, 205, 237 -}; -const uint8_t hBitsMinus1_N47[7]= +}; // Q0 +const UWord8 hBitsMinus1_N47[7]= { 6, 52, 96, 136, 173, 206, 238 -}; -const uint8_t hBitsMinus1_N48[7]= +}; // Q0 +const UWord8 hBitsMinus1_N48[7]= { 6, 52, 97, 137, 174, 208, 240 -}; -const uint8_t hBitsMinus1_N49[7]= +}; // Q0 +const UWord8 hBitsMinus1_N49[7]= { 6, 52, 97, 138, 175, 209, 241 -}; -const uint8_t hBitsMinus1_N50[7]= +}; // Q0 +const UWord8 hBitsMinus1_N50[7]= { 6, 53, 98, 138, 175, 210, 243 -}; -const uint8_t hBitsMinus1_N51[7]= +}; // Q0 +const UWord8 hBitsMinus1_N51[7]= { 6, 53, 98, 139, 176, 211, 244 -}; -const uint8_t hBitsMinus1_N52[7]= +}; // Q0 +const UWord8 hBitsMinus1_N52[7]= { 6, 53, 99, 140, 177, 212, 245 -}; -const uint8_t hBitsMinus1_N53[7]= +}; // Q0 +const UWord8 hBitsMinus1_N53[7]= { 6, 53, 99, 140, 178, 213, 247 -}; -const uint8_t hBitsMinus1_N54[7]= +}; // Q0 +const UWord8 hBitsMinus1_N54[7]= { 6, 54, 100, 141, 179, 214, 248 -}; -const uint8_t hBitsMinus1_N55[7]= +}; // Q0 +const UWord8 hBitsMinus1_N55[7]= { 6, 54, 100, 142, 180, 216, 249 -}; -const uint8_t hBitsMinus1_N56[7]= +}; // Q0 +const UWord8 hBitsMinus1_N56[7]= { 6, 54, 100, 142, 181, 217, 250 -}; +}; // Q0 const uint8_t hBitsMinus1_N57[7]= { 6, 54, 101, 143, 181, 218, 252 }; -const uint8_t hBitsMinus1_N58[7]= +const UWord8 hBitsMinus1_N58[7]= { 6, 54, 101, 143, 182, 219, 253 -}; -const uint8_t hBitsMinus1_N59[7]= +}; // Q0 +const UWord8 hBitsMinus1_N59[7]= { 6, 55, 102, 144, 183, 220, 254 -}; -const uint8_t hBitsMinus1_N60[7]= +}; // Q0 +const UWord8 hBitsMinus1_N60[7]= { 6, 55, 102, 145, 184, 221, 255 -}; -const uint8_t hBitsMinus1_N61[6]= +}; // Q0 +const UWord8 hBitsMinus1_N61[6]= { 5, 55, 102, 145, 185, 221 -}; -const uint8_t hBitsMinus1_N62[6]= +}; // Q0 +const UWord8 hBitsMinus1_N62[6]= { 5, 55, 103, 146, 185, 222 -}; -const uint8_t hBitsMinus1_N63[6]= +}; // Q0 +const UWord8 hBitsMinus1_N63[6]= { 5, 55, 103, 146, 186, 223 -}; -const uint8_t hBitsMinus1_N64[6]= +}; // Q0 +const UWord8 hBitsMinus1_N64[6]= { 5, 55, 103, 147, 187, 224 -}; -const int16_t dsHighDiracsTab[PVQ_MAX_BAND_SIZE - DS_INDEX_LINEAR_END ] = +}; // Q0 +const Word16 dsHighDiracsTab[PVQ_MAX_BAND_SIZE - DS_INDEX_LINEAR_END ] = { 23, 25, 27, 29, 31, 33, 35, 37, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 83, 91, 99, 107, 115, 123, 131, 139, 147, 163, 179, 195, 211, 227, 243, 259, 275, 291, 323, 355, 387, 419, 451, 483, 512 -}; +}; // Q0 -const uint32_t intLimCDivInvDQ31[67+1] = +const UWord32 intLimCDivInvDQ31[67+1] = { 0x00000000, 0x80000000, 0x40000000, 0x2aaaaaab, 0x20000000, 0x1999999a, 0x15555556, 0x12492493, 0x10000000, 0x0e38e38f, 0x0ccccccd, 0x0ba2e8bb, 0x0aaaaaab, 0x09d89d8a, 0x0924924a, 0x08888889, @@ -29287,9 +29292,9 @@ const uint32_t intLimCDivInvDQ31[67+1] = 0x02aaaaab, 0x029cbc15, 0x028f5c29, 0x02828283, 0x02762763, 0x026a43a0, 0x025ed098, 0x0253c826, 0x02492493, 0x023ee090, 0x0234f72d, 0x022b63cc, 0x02222223, 0x02192e2a, 0x02108422, 0x02082083, 0x02000000, 0x01f81f82, 0x01f07c20, 0x01e9131b -}; +}; // Q0 -const uint8_t obtainEnergyQuantizerDensity_f[57] = +const UWord8 obtainEnergyQuantizerDensity_f[57] = { 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, @@ -29298,11 +29303,11 @@ const uint8_t obtainEnergyQuantizerDensity_f[57] = 16,18,20,20,22,24,26,30, 32,34,38,42,46,50,54,58, 64,70,76,82,90,98,108,118, 128 -}; +}; // Q0 /* (char)ceil(log2(hBitsN[N][0])) - 2) */ -const uint8_t f_log2_n[ PVQ_MAX_BAND_SIZE + 1] = +const UWord8 f_log2_n[ PVQ_MAX_BAND_SIZE + 1] = { 0xff, 0xff, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, @@ -29312,9 +29317,9 @@ const uint8_t f_log2_n[ PVQ_MAX_BAND_SIZE + 1] = 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01}; + 0x01}; // Q0 -const uint8_t * const hBitsN[ PVQ_MAX_BAND_SIZE + 1 ]= +const UWord8 * const hBitsN[ PVQ_MAX_BAND_SIZE + 1 ]= { f_log2_n/*N=0*/, hBitsMinus1_N01, hBitsMinus1_N02, hBitsMinus1_N03, hBitsMinus1_N04, hBitsMinus1_N05, hBitsMinus1_N06, hBitsMinus1_N07, hBitsMinus1_N08, hBitsMinus1_N09, @@ -29329,9 +29334,9 @@ hBitsMinus1_N45, hBitsMinus1_N46, hBitsMinus1_N47, hBitsMinus1_N48, hBit hBitsMinus1_N50, hBitsMinus1_N51, hBitsMinus1_N52, hBitsMinus1_N53, hBitsMinus1_N54, hBitsMinus1_N55, hBitsMinus1_N56, hBitsMinus1_N57, hBitsMinus1_N58, hBitsMinus1_N59, hBitsMinus1_N60, hBitsMinus1_N61, hBitsMinus1_N62, hBitsMinus1_N63, hBitsMinus1_N64, -}; +}; // Q0 -const int16_t lim_neg_inv_tbl_fx[MAX_SPLITS + 1 ] = +const Word16 lim_neg_inv_tbl_fx[MAX_SPLITS + 1 ] = { /* 1 = optimized inv_tbl_fx constant for div by 1, Q15 */ /* 2-10 = negated inv_tbl_fx Q15*/ 0, @@ -29341,7 +29346,7 @@ const int16_t lim_neg_inv_tbl_fx[MAX_SPLITS + 1 ] = const Word16 Idx2Freq_Tbl[] = { 6554/*12.8*512*/, 48 * 512, 13108/*25.6*512*/, 32 * 512, 16 * 512, 8 * 512 }; /* in Q9 */ -const int16_t fg_inv_tbl_fx [HQ_MAX_BAND_LEN/8 + 1 ] = +const Word16 fg_inv_tbl_fx [HQ_MAX_BAND_LEN/8 + 1 ] = { /* i/8 , slice of inv_tbl_fx , Q15 */ 0, 4096, 2048, 1366, 1024, 820, 683, @@ -29349,7 +29354,7 @@ const int16_t fg_inv_tbl_fx [HQ_MAX_BAND_LEN/8 + 1 ] = }; -const uint32_t exactdivodd[ODD_DIV_SIZE] = +const UWord32 exactdivodd[ODD_DIV_SIZE] = { /* exactdivodd[0]=1/1, exactdivodd[1]=1/3, exactdivodd[n]=1/(2*n+1), exactdivodd[47]=1/95 ) */ 1U, 2863311531U, 3435973837U, 3067833783U, 954437177U, 3123612579U, 3303820997U, 4008636143U, @@ -29358,17 +29363,17 @@ const uint32_t exactdivodd[ODD_DIV_SIZE] = 438261969U, 4210752251U, 2350076445U, 1483715975U, 3089362441U, 2693454067U, 3238827797U, 3204181951U, 3237744577U, 128207979U, 2738819725U, 3811027319U, 3353604601U, 2519714147U, 1059797125U, 1631000239U, 2014922929U, 724452315U, 4244438269U, 1875962727U, 4198451177U, 3539808211U, 1062196213U, 3571604383U -}; +}; // Q0 -const int16_t gain_cb_size[MAX_GAIN_BITS] = {2, 4, 8, 16, 32}; +const Word16 gain_cb_size[MAX_GAIN_BITS] = {2, 4, 8, 16, 32}; // Q0 -const int16_t inner_frame_tbl[4] = {L_FRAME8k, L_FRAME16k, L_FRAME32k, L_FRAME48k}; /* corresponds to NB, WB, SWB, FB */ +const Word16 inner_frame_tbl[4] = {L_FRAME8k, L_FRAME16k, L_FRAME32k, L_FRAME48k}; /* corresponds to NB, WB, SWB, FB Q0*/ const Word16 hq_nominal_scaling_inv[7] = { 0, 8192, 11585, 0, 16384, 0, 20066 }; /*Q13 */ const Word16 hq_nominal_scaling[7] = { 0, 32767, 23170, 0, 16384, 0, 13377 }; /*Q15 */ -const int16_t l_spec_tbl[4] = {L_SPEC8k, L_SPEC16k, L_SPEC32k, L_SPEC48k}; /* corresponds to NB, WB, SWB, FB */ -const int16_t l_spec_ext_tbl[4] = {0, L_SPEC16k_EXT, L_SPEC32k_EXT, L_SPEC48k_EXT}; /* corresponds to NB, WB, SWB, FB */ -const Word16 sinq_16k[3 * L_FRAME16k / 20] = +const Word16 l_spec_tbl[4] = {L_SPEC8k, L_SPEC16k, L_SPEC32k, L_SPEC48k}; /* corresponds to NB, WB, SWB, FB Q0*/ +const Word16 l_spec_ext_tbl[4] = {0, L_SPEC16k_EXT, L_SPEC32k_EXT, L_SPEC48k_EXT}; /* corresponds to NB, WB, SWB, FB Q0*/ +const Word16 sinq_16k[3 * L_FRAME16k / 20] =/*Q15 */ { 536, 1608, 2678, 3745, 4808, 5866, 6918, 7962, 8998, 10024, 11039, 12043, 13033, 14010, 14972, 15917, @@ -29377,7 +29382,7 @@ const Word16 sinq_16k[3 * L_FRAME16k / 20] = 28642, 29147, 29622, 30064, 30475, 30852, 31197, 31508, 31786, 32029, 32238, 32413, 32553, 32658, 32728, 32763 }; -const Word16 sinq_32k[3 * L_FRAME32k / 20] = +const Word16 sinq_32k[3 * L_FRAME32k / 20] =/*Q15 */ { 268, 804, 1340, 1876, 2411, 2945, 3479, 4011, 4543, 5073, 5602, 6130, 6655, 7180, 7702, 8222, 8740, 9255, 9768, 10279, 10786, 11291, 11793, 12292, @@ -29388,7 +29393,7 @@ const Word16 sinq_32k[3 * L_FRAME32k / 20] = 30375, 30572, 30761, 30941, 31114, 31278, 31433, 31580, 31719, 31849, 31971, 32084, 32189, 32285, 32372, 32451, 32521, 32582, 32634, 32678, 32713, 32740, 32757, 32766 }; -const Word16 sinq_48k[3 * L_FRAME48k / 20] = +const Word16 sinq_48k[3 * L_FRAME48k / 20] =/*Q15 */ { 179, 536, 893, 1251, 1608, 1965, 2321, 2678, 3034, 3390, 3745, 4100, 4454, 4808, 5161, 5514, 5866, 6217, 6568, 6918, 7267, 7615, 7962, 8308, @@ -29410,29 +29415,29 @@ const Word16 sinq_48k[3 * L_FRAME48k / 20] = /* subband width tables */ /* NB short win: 7200/8000/9600, 13200/16400/24400 */ -const int16_t band_width_40_4_6_0_0_0[4] = { 6, 8, 11, 15 }; -const int16_t band_width_40_5_6_0_0_0[5] = { 6, 7, 7, 9, 11 }; +const Word16 band_width_40_4_6_0_0_0[4] = { 6, 8, 11, 15 }; // Q0 +const Word16 band_width_40_5_6_0_0_0[5] = { 6, 7, 7, 9, 11 }; // Q0 /* NB long win: 7200, 8000, 9600, 13200, 16400 */ -const int16_t band_width_160_13_6_2_0_0[13] = { 6, 6, 6, 6, 7, 8, 9, 10, 13, 15, 19, 24, 31 }; -const int16_t band_width_160_14_6_3_0_0[14] = { 6, 6, 6, 6, 6, 7, 8, 9, 10, 12, 15, 18, 22, 29 }; -const int16_t band_width_160_17_6_3_0_0[17] = { 6, 6, 6, 6, 6, 6, 7, 7, 8, 8, 9, 10, 11, 13, 15, 17, 19 }; -const int16_t band_width_160_18_6_4_0_0[18] = { 6, 6, 6, 6, 6, 6, 6, 7, 7, 8, 8, 9, 10, 11, 12, 14, 15, 17 }; +const Word16 band_width_160_13_6_2_0_0[13] = { 6, 6, 6, 6, 7, 8, 9, 10, 13, 15, 19, 24, 31 }; // Q0 +const Word16 band_width_160_14_6_3_0_0[14] = { 6, 6, 6, 6, 6, 7, 8, 9, 10, 12, 15, 18, 22, 29 }; // Q0 +const Word16 band_width_160_17_6_3_0_0[17] = { 6, 6, 6, 6, 6, 6, 7, 7, 8, 8, 9, 10, 11, 13, 15, 17, 19 }; // Q0 +const Word16 band_width_160_18_6_4_0_0[18] = { 6, 6, 6, 6, 6, 6, 6, 7, 7, 8, 8, 9, 10, 11, 12, 14, 15, 17 }; // Q0 /* WB short win: 13200/16400/24400 */ -const int16_t band_width_80_7_6_0_0_0[7] = { 6, 7, 8, 10, 12, 16, 21 }; +const Word16 band_width_80_7_6_0_0_0[7] = { 6, 7, 8, 10, 12, 16, 21 }; // Q0 /* WB long win: 13200, 16400 */ -const int16_t band_width_320_18_6_3_0_0[18] = { 6, 6, 6, 6, 6, 7, 7, 8, 10, 11, 13, 16, 19, 24, 30, 37, 47, 61 }; -const int16_t band_width_320_20_6_3_0_0[20] = { 6, 6, 6, 6, 6, 6, 7, 8, 8, 9, 11, 12, 14, 17, 20, 23, 28, 34, 42, 51 }; +const Word16 band_width_320_18_6_3_0_0[18] = { 6, 6, 6, 6, 6, 7, 7, 8, 10, 11, 13, 16, 19, 24, 30, 37, 47, 61 }; // Q0 +const Word16 band_width_320_20_6_3_0_0[20] = { 6, 6, 6, 6, 6, 6, 7, 8, 8, 9, 11, 12, 14, 17, 20, 23, 28, 34, 42, 51 }; // Q0 /* SWB short win: 13200, 16400 */ -const int16_t band_width_142_8_8_0_0_0[8] = {7,8,10,11,15,21,29,41}; -const int16_t band_width_160_8_8_0_0_0[8] = { 8, 9, 11,13,17,23,32,47}; +const Word16 band_width_142_8_8_0_0_0[8] = {7,8,10,11,15,21,29,41}; // Q0 +const Word16 band_width_160_8_8_0_0_0[8] = { 8, 9, 11,13,17,23,32,47}; // Q0 /* SWB long win: 13200, 16400 */ -const int16_t band_width_568_22_6_2_0_0[22] = { 6, 6, 6, 6, 6, 6, 7, 8, 9, 10, 11, 13, 16, 19, 23, 28, 34, 42, 55, 68, 84, 105}; -const int16_t band_width_640_24_6_4_0_0[24] = { 6, 6, 6, 6, 6, 6, 7,7,8,9,10,11,13,15,18,21,26,32,39,48,59, 74,92,115}; +const Word16 band_width_568_22_6_2_0_0[22] = { 6, 6, 6, 6, 6, 6, 7, 8, 9, 10, 11, 13, 16, 19, 23, 28, 34, 42, 55, 68, 84, 105}; // Q0 +const Word16 band_width_640_24_6_4_0_0[24] = { 6, 6, 6, 6, 6, 6, 7,7,8,9,10,11,13,15,18,21,26,32,39,48,59, 74,92,115}; // Q0 /* LR-MDCT: NB configuration tables */ const Xcore_Config xcore_config_8kHz_007200bps_long = { 13, L_FRAME8k, band_width_160_13_6_2_0_0, 536870912L, 24576, 24576/*eref*/, 13107, 13107/*bit_alloc_weight*/, 2, 2, 0, 0.0f, 0 /*p2a_th*/, 0.40f, 13107/*pd_thresh*/, 0.13f, 4260/*ld_slope*/, 1.2f, 19661/*ni_coef*/, 0.32f }; @@ -29459,31 +29464,31 @@ const Xcore_Config xcore_config_32kHz_013200bps_short = { 8, 568 / NUM_TIME_SWIT const Xcore_Config xcore_config_32kHz_016400bps_short = { 8, 640 / NUM_TIME_SWITCHING_BLOCKS, band_width_160_8_8_0_0_0, 644245094L, 24576, 24576/*eref*/, 8192, 8192/*bit_alloc_weight*/, 2, 4, 0, 0.0f, 0 /*p2a_th*/, 0.30f, 9830 /*pd_thresh*/, 0.13f, 4260/*ld_slope*/, 1.2f, 19661/*ni_coef*/, 0.32f }; /* bandwidths */ -const int16_t Nb[ NB_SFM] = +const Word16 Nb[ NB_SFM] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 32, 32, 32, 32, 32, 32, 32, 32 -}; +}; // Q0 /* log2(Nb) to calculate minimum bits for one pulse in PVQ */ -const int16_t LNb[ NB_SFM] = +const Word16 LNb[ NB_SFM] = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 -}; +}; // Q0 /*------------------------------------------------------------------------------* * GSC tables *------------------------------------------------------------------------------*/ -const int16_t gsc_sfm_start[MBANDS_GN] = {0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240}; +const Word16 gsc_sfm_start[MBANDS_GN] = {0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240}; // Q0 -const int16_t gsc_sfm_end[MBANDS_GN] = {16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256}; +const Word16 gsc_sfm_end[MBANDS_GN] = {16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256}; // Q0 -const int16_t gsc_sfm_size[MBANDS_GN] = {16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; +const Word16 gsc_sfm_size[MBANDS_GN] = {16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; // Q0 const float sm_table[] = { @@ -29507,9 +29512,9 @@ const Word16 sm_table_fx[] = 5521, 5171, 4830, 4499, 4178, 3870, 3572, 3287, 3011, 2746, 2494, 2254, 2025, 1809, 1602, 1412, 1229, 1062, 904, 760, 629, 511, 403, 308, 226, 157, 102, 56, 26, 7, -}; +}; // Q15 -const int16_t GSC_freq_bits[] = +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*/ @@ -29524,9 +29529,9 @@ const int16_t GSC_freq_bits[] = 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*/ -}; +}; // Q0 #ifdef MOD_BIT_ALLOC_ROM_TABLE -const Word32 GSC_freq_bits_fx[] = +const Word32 GSC_freq_bits_fx[] =/*Q18*/ { 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*/ @@ -29542,7 +29547,7 @@ const Word32 GSC_freq_bits_fx[] = 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*/ }; -const Word32 GSC_freq_bits_fx_Q18[] = +const Word32 GSC_freq_bits_fx_Q18[] =/*Q18*/ { 5505024, 17301504, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, 5505024, 17301504, -1572864, 6553600, 3932160, 2883584, 2621440, 1310720, 0, 0, 1310720, 1048576, 0, 0, 1048576, 0, 0, @@ -29569,10 +29574,10 @@ const Word32 GSC_freq_bits_fx[] = 8126464, 25165824, -1048576, 7340032, 4718592, 3407872, 3145728, 2621440, 2621440, 1310720, 1048576, 1048576, 262144, 0, 262144, 786432, 1048576, /* ACELP_13k20*/ }; #endif -const int16_t Compl_GSC_freq_bits[] = +const Word16 Compl_GSC_freq_bits[] = { 5, 10, 10, 10 /* bitrate > ACELP_16k40 && FS = 16kHz */ -}; +}; // Q0 const float mfreq_loc[] = { @@ -29580,7 +29585,7 @@ const float mfreq_loc[] = 4375.0f, 4775.0f, 5175.0f, 5575.0f, 6375.0f, 7175.0f, 7975.0f }; -const int16_t mfreq_bindiv_loc[] = { 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 32, 32, 32 }; +const Word16 mfreq_bindiv_loc[] = { 8, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 32, 32, 32 }; // Q0 const float mean_gp[] = { 0.5853f }; const Word16 mean_gp_fx[] = { 9590 }; /*Q14*/ @@ -30671,7 +30676,7 @@ const float YGain_mean_LR[] = -0.0113f, -0.0029f, 0.0156f, 0.0123f, 0.0288f, 0.0167f, 0.0324f, 0.0369f, }; -const Word16 YGain_mean_LR_fx[1 * 12] = +const Word16 YGain_mean_LR_fx[1 * 12] =/* Q12 */ { -385, -178, -143, -116, -46, -12, 64, 50, 118, 68, 133, 151 @@ -31618,7 +31623,7 @@ const float YG_dicL2G_16kHz[] = 0.2962f, 0.3062f, }; -const Word16 YG_dicL2G_16kHz_fx[] = +const Word16 YG_dicL2G_16kHz_fx[] =//Q12 { -255, 122, 296, 314, @@ -31630,11 +31635,11 @@ const Word16 YG_dicL2G_16kHz_fx[] = 1213, 1254, }; -const int16_t Odx_fft64[64] = +const Word16 Odx_fft64[64] = { 0,59,54,49,44,39,34,29,24,19,14,9,4,63,58,53,48,43,38,33,28,23,18,13,8,3,62,57,52,47,42,37, 32,27,22,17,12,7,2,61,56,51,46,41,36,31,26,21,16,11,6,1,60,55,50,45,40,35,30,25,20,15,10,5 -}; +}; // Q0 const float w_fft64[32] = { @@ -31644,51 +31649,51 @@ const float w_fft64[32] = 0.95694035f,0.29028469f,0.47139674f,0.88192123f,0.77301043f,0.63439327f,0.098017141f,0.99518472f }; -const int16_t Ip_fft64[6] = { 32,1,0,64,32,96 }; +const Word16 Ip_fft64[6] = { 32,1,0,64,32,96 }; // Q0 -const int16_t Odx_fft32_15[32] = { 0,17,2,19,4,21,6,23,8,25,10,27,12,29,14,31,16,1,18,3,20,5,22,7,24,9,26,11,28,13,30,15 }; +const Word16 Odx_fft32_15[32] = { 0,17,2,19,4,21,6,23,8,25,10,27,12,29,14,31,16,1,18,3,20,5,22,7,24,9,26,11,28,13,30,15 }; // Q0 const float w_fft32[16] = { 1.0000000f,0.00000000f,0.70710677f,0.70710677f,0.92387950f,0.38268346f,0.38268346f,0.92387950f, 0.98078525f,0.19509032f,0.55557024f,0.83146960f,0.83146960f,0.55557024f,0.19509032f,0.98078525f }; -const Word32 w_fft32_16fx[16] = +const Word32 w_fft32_16fx[16] =//Q30 { 1073741824, 0, 759250113, 759250113, 992008059, 410903236, 410903236, 992008059, 1053110143, 209476636, 596539003, 892783685, 892783685, 596539003, 209476636, 1053110143 }; -const int16_t Ip_fft32[6] = { 16,1,0,32,16,48 }; +const Word16 Ip_fft32[6] = { 16,1,0,32,16,48 }; // Q0 -const int16_t Odx_fft32_5[32] = { 0,27,22,17,12,7,2,29,24,19,14,9,4,31,26,21,16,11,6,1,28,23,18,13,8,3,30,25,20,15,10,5 }; +const Word16 Odx_fft32_5[32] = { 0,27,22,17,12,7,2,29,24,19,14,9,4,31,26,21,16,11,6,1,28,23,18,13,8,3,30,25,20,15,10,5 }; // Q0 -const int16_t Odx_fft16[16] = {0,11,6,1,12,7,2,13,8,3,14,9,4,15,10,5}; +const Word16 Odx_fft16[16] = {0,11,6,1,12,7,2,13,8,3,14,9,4,15,10,5}; // Q0 const float w_fft16[8] = { 1.0000000f,0.00000000f,0.70710677f,0.70710677f,0.92387950f,0.38268346f,0.38268346f,0.92387950f }; -const int16_t Ip_fft16[6] = {8,1,0,16,8,24}; +const Word16 Ip_fft16[6] = {8,1,0,16,8,24}; // Q0 const float w_fft8[8] = {1.0000000f,0.00000000f,0.70710677f,0.70710677f }; -const int16_t Ip_fft8[6] = {4,1,0,8,4,12}; +const Word16 Ip_fft8[6] = {4,1,0,8,4,12}; // Q0 -const int16_t Idx_dortft80[80] = +const Word16 Idx_dortft80[80] = { 0,65,50,35,20,5,70,55,40,25,10,75,60,45,30,15,16,1,66,51,36,21,6,71,56,41,26,11,76,61, 46,31,32,17,2,67,52,37,22,7,72,57,42,27,12,77,62,47,48,33,18,3,68,53,38,23,8,73,58,43, 28,13,78,63,64,49,34,19,4,69,54,39,24,9,74,59,44,29,14,79 -}; +}; // Q0 -const int16_t Idx_dortft120[120] = +const Word16 Idx_dortft120[120] = { 0,105,90,75,60,45,30,15,16,1,106,91,76,61,46,31,32,17,2,107,92,77,62,47, 48,33,18,3,108,93,78,63,64,49,34,19,4,109,94,79,80,65,50,35,20,5,110,95, 96,81,66,51,36,21,6,111,112,97,82,67,52,37,22,7,8,113,98,83,68,53,38,23, 24,9,114,99,84,69,54,39,40,25,10,115,100,85,70,55,56,41,26,11,116,101,86, 71,72,57,42,27,12,117,102,87,88,73,58,43,28,13,118,103,104,89,74,59,44,29,14,119 -}; +}; // Q0 -const int16_t Idx_dortft160[160] = +const Word16 Idx_dortft160[160] = { 0,65,130,35,100,5,70,135,40,105,10,75,140,45,110,15,80,145, 50,115,20,85,150,55,120,25,90,155,60,125,30,95,96,1,66,131, @@ -31699,9 +31704,9 @@ const int16_t Idx_dortft160[160] = 108,13,78,143,48,113,18,83,148,53,118,23,88,153,58,123,28,93, 158,63,64,129,34,99,4,69,134,39,104,9,74,139,44,109,14,79, 144,49,114,19,84,149,54,119,24,89,154,59,124,29,94,159 -}; +}; // Q0 -const int16_t Idx_dortft320[320] = +const Word16 Idx_dortft320[320] = { 0,65,130,195,260,5,70,135,200,265,10,75,140,205,270,15,80,145,210,275,20,85,150,215,280,25,90,155,220,285,30,95, 160,225,290,35,100,165,230,295,40,105,170,235,300,45,110,175,240,305,50,115,180,245,310,55,120,185,250,315,60,125, @@ -31714,9 +31719,9 @@ const int16_t Idx_dortft320[320] = 58,123,188,253,318,63,64,129,194,259,4,69,134,199,264,9,74,139,204,269,14,79,144,209,274,19,84,149,214,279,24,89,154, 219,284,29,94,159,224,289,34,99,164,229,294,39,104,169,234,299,44,109,174,239,304,49,114,179,244,309,54,119,184,249, 314,59,124,189,254,319 -}; +}; // Q0 -const int16_t Idx_dortft480[480] = +const Word16 Idx_dortft480[480] = { 0,225,450,195,420,165,390,135,360,105,330,75,300,45,270,15,240,465,210,435,180,405,150,375,120,345, 90,315,60,285,30,255,256,1,226,451,196,421,166,391,136,361,106,331,76,301,46,271,16,241,466,211,436, @@ -31736,9 +31741,9 @@ const int16_t Idx_dortft480[480] = 117,342,87,312,57,282,27,252,477,222,447,448,193,418,163,388,133,358,103,328,73,298,43,268,13,238,463, 208,433,178,403,148,373,118,343,88,313,58,283,28,253,478,223,224,449,194,419,164,389,134,359,104,329,74, 299,44,269,14,239,464,209,434,179,404,149,374,119,344,89,314,59,284,29,254,479 -}; +}; // Q0 -const int16_t Ip_fft128[10] = { 64, 1, 0, 128, 64, 192, 32, 160, 96, 224 }; +const Word16 Ip_fft128[10] = { 64, 1, 0, 128, 64, 192, 32, 160, 96, 224 }; // Q0 const float w_fft128[64] = { @@ -31761,9 +31766,9 @@ const Word32 w_fft128_16fx[64] = 1041563136, 260897968, 552013632, 920979072, 862437504, 639627264, 157550640, 1062120192, 1062120192, 157550640, 639627264, 862437504, 920979072, 552013632, 260897968, 1041563136, 1010975232, 361732736, 459083776, 970651136, 795590208, 721080960, 52686008, 1072448448, -}; +}; // Q30 -const int16_t Ip_fft256[10] = {128, 1, 0, 256, 128, 384, 64, 320,192, 448}; +const Word16 Ip_fft256[10] = {128, 1, 0, 256, 128, 384, 64, 320,192, 448}; // Q0 const float w_fft256[128] = { @@ -31785,7 +31790,7 @@ const float w_fft256[128] = 0.93299280f, 0.35989504f, 0.40524131f, 0.91420976f, 0.72424708f, 0.68954054f, 0.02454123f, 0.99969882f }; -const int16_t Ip_fft512[18] = {256, 1, 0, 512, 256, 768, 128, 640,384, 896, 64, 576, 320, 832, 192, 704,448, 960}; +const Word16 Ip_fft512[18] = {256, 1, 0, 512, 256, 768, 128, 640,384, 896, 64, 576, 320, 832, 192, 704,448, 960}; // Q0 const float w_fft512[256] = { @@ -31822,7 +31827,7 @@ const float w_fft512[256] = 0.98310549f, 0.18303989f, 0.56573181f, 0.82458930f, 0.83822471f, 0.54532499f, 0.20711138f, 0.97831737f, 0.92850608f, 0.37131719f, 0.39399204f, 0.91911385f, 0.71573083f, 0.69837625f, 0.01227154f, 0.99992470f }; -const Word16 w_fft512_fx_evs[256] = +const Word16 w_fft512_fx_evs[256] =//Q14 { 16384, 0, 11585, 11585, 15137, 6270, 6270, 15137, 16069, 3196, 9102, 13623, 13623, 9102, 3196, 16069, @@ -31857,18 +31862,18 @@ const Word16 w_fft512_fx_evs[256] = 16107, 2999, 9269, 13510, 13733, 8935, 3393, 16029, 15213, 6084, 6455, 15059, 11727, 11442, 201, 16383 }; -const int16_t Idx_dortft40[40] = +const Word16 Idx_dortft40[40] = { 0, 25, 10, 35, 20, 5, 30, 15, 16, 1, 26, 11, 36, 21, 6, 31, 32, 17, 2, 27, 12, 37, 22, 7, 8, 33, 18, 3, 28, 13, 38, 23, 24, 9, 34, 19, 4, 29, 14, 39 -}; +}; // Q0 -const int16_t Odx_fft8_5[8] = {0, 3, 6, 1, 4, 7, 2, 5}; -const int16_t Idx_dortft20[20] = {0, 5, 10, 15, 16, 1, 6, 11, 12, 17, 2, 7, 8, 13, 18, 3, 4, 9, 14, 19}; -const int16_t Odx_fft4_5[4] = {0, 3, 2, 1}; +const Word16 Odx_fft8_5[8] = {0, 3, 6, 1, 4, 7, 2, 5}; // Q0 +const Word16 Idx_dortft20[20] = {0, 5, 10, 15, 16, 1, 6, 11, 12, 17, 2, 7, 8, 13, 18, 3, 4, 9, 14, 19}; // Q0 +const Word16 Odx_fft4_5[4] = {0, 3, 2, 1}; // Q0 const float w_fft4[2] = {1.0000000f, 0.00000000f}; -const int16_t Ip_fft4[6] = {2,1,0,4,2,6}; -const int16_t ip_edct2_64[6] = {16, 64, 0, 32, 16, 48}; +const Word16 Ip_fft4[6] = {2,1,0,4,2,6}; // Q0 +const Word16 ip_edct2_64[6] = {16, 64, 0, 32, 16, 48}; // Q0 const float w_edct2_64[80] = { @@ -32624,16 +32629,16 @@ const Word16 hvq_class_c_fx[16] = /* Q15 */ 6914, 2136, -14387, -7617 }; -const int16_t hvq_cb_search_overlap24k[17] = +const Word16 hvq_cb_search_overlap24k[17] = { 0, 8, 17, 27, 39, 53, 69, 89, 113, 128, 128, 128, 128, 128, 128, 128, 128 -}; +}; // Q0 -const int16_t hvq_cb_search_overlap32k[21] = +const Word16 hvq_cb_search_overlap32k[21] = { 0, 6, 13, 21, 30, 40, 51, 64, @@ -32641,7 +32646,7 @@ const int16_t hvq_cb_search_overlap32k[21] = 128, 128, 128, 128, 128, 128, 128, 128, 128 -}; +}; // Q0 const float hvq_peak_cb[1024] = { @@ -33009,43 +33014,43 @@ const Word16 hvq_peak_cb_fx[1024] = /* Q15 */ 6066, 4720, 25084,-28951 }; -const int16_t hvq_pg_huff_offset[NUM_PG_HUFFLEN] = {0,2,3,8,9,11,13,15,19}; -const int16_t hvq_pg_huff_thres[NUM_PG_HUFFLEN] = {0,0x2,0x4,0x18,0x20,0x40,0x80,0x100,0x300}; +const Word16 hvq_pg_huff_offset[NUM_PG_HUFFLEN] = {0,2,3,8,9,11,13,15,19}; // Q0 +const Word16 hvq_pg_huff_thres[NUM_PG_HUFFLEN] = {0,0x2,0x4,0x18,0x20,0x40,0x80,0x100,0x300}; // Q0 -const int16_t hvq_pg_huff_tab[32] = +const Word16 hvq_pg_huff_tab[32] = { 30, 31, 1, 0, 2, 3, 28, 29, 4, 5, 27, 25, 26, 6, 24, 7, 8, 22, 23, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 -}; +}; // Q0 -const int16_t hvq_cp_huff_len[52] = +const Word16 hvq_cp_huff_len[52] = { 3, 4, 5, 6, 6, 6, 6, 6, 4, 4, 5, 5, 5, 5, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 8, 9, 10, 10, 11, 11, 11, 10, 10, 10, 10, 11, 12, 12, 13, 13, 12, 12, 11, 12 -}; +}; // Q0 -const int16_t hvq_cp_huff_val[52] = +const Word16 hvq_cp_huff_val[52] = { 7, 8, 6, 3, 4, 5, 6, 7, 9, 10, 7, 8, 9, 10, 11, 12, 13, 11, 12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 3, 4, 5, 6, 7, 5, 4, 5, 3, 4, 5, 6, 7, 8, 9, 6, 1, 2, 0, 1, 3, 4, 7, 5 -}; +}; // Q0 -const int16_t hvq_cp_layer1_map5[HVQ_CP_MAP_LEN] = { 16, 8, 4, 2, 1, 18, 17, 9 }; +const Word16 hvq_cp_layer1_map5[HVQ_CP_MAP_LEN] = { 16, 8, 4, 2, 1, 18, 17, 9 }; // Q0 -const int16_t hvq_cp_huff_thres[HVQ_CP_HUFF_NUM_LEN] = { 0x0, 0x2, 0xC, 0x20, 0x50, 0x60, 0x100, 0x180, 0x600, 0x1000, 0x1C00 }; -const int16_t hvq_cp_huff_offset[HVQ_CP_HUFF_NUM_LEN] = { 0, 2, 7, 12, 18, 19, 24, 26, 35, 45, 51 }; +const Word16 hvq_cp_huff_thres[HVQ_CP_HUFF_NUM_LEN] = { 0x0, 0x2, 0xC, 0x20, 0x50, 0x60, 0x100, 0x180, 0x600, 0x1000, 0x1C00 }; // Q0 +const Word16 hvq_cp_huff_offset[HVQ_CP_HUFF_NUM_LEN] = { 0, 2, 7, 12, 18, 19, 24, 26, 35, 45, 51 }; // Q0 -const int16_t hvq_cp_huff_tab[52] = +const Word16 hvq_cp_huff_tab[52] = { 46, 47, 44, 45, 48, 49, 51, 36, 37, 38, 43, 50, 34, 35, 39, 40, 41, 42, 33, 28, 29, 30, 31, 32, 26, 27, 3, 4, 5, 6, 7, 22, 23, 24, 25, 2, 10, 11, 12, 13, 17, 18, 19, 20, 21, 1, 8, 9, 14, 15, 16, 0 -}; +}; // Q0 /*----------------------------------------------------------------------------------* * FEC for HQ core *----------------------------------------------------------------------------------*/ -const int16_t Num_bands_NB[MAX_SB_NB] = {8,8,2}; +const Word16 Num_bands_NB[MAX_SB_NB] = {8,8,2}; // Q0 const float SmoothingWin_NB875[70] = { @@ -33074,7 +33079,7 @@ const float SmoothingWin_NB2[16] = 0.69134172f,0.77778512f,0.85355339f,0.91573481f,0.96193977f,0.99039264f }; const Word16 SmoothingWin_NB2_fx[16] = -{ +{/* Q15 */ 0, 315, 1247, 2761, 4799, 7282, 10114, 13188, 16384, 19580, 22654, 25486, 27969, 30007, 31521, 32453 }; /*----------------------------------------------------------------------------------* @@ -33979,11 +33984,11 @@ const float erb_NB[NUM_ERB_NB+1] = {0.0f, 92.8061f, 185.6121f, 278.4182f, 371.22 }; /* ERB table for PPP-ampl-quant */ -const Word16 erb_WB_fx[NUM_ERB_WB + 1] = { 0, 238, 475, 713, 950, 1188, 1426, 1663, 1911, 2185, 2490, 2826, 3205, 3624, 4094, 4620, 5210, 5875, 6626, 7478, 8448, 9558, 11264, 13568, 16387 }; +const Word16 erb_WB_fx[NUM_ERB_WB + 1] = { 0, 238, 475, 713, 950, 1188, 1426, 1663, 1911, 2185, 2490, 2826, 3205, 3624, 4094, 4620, 5210, 5875, 6626, 7478, 8448, 9558, 11264, 13568, 16387 };//Q(log2(2.56) /* ERB table for PPP-ampl-quant */ -const Word16 erb_NB_fx[NUM_ERB_NB + 1] = { 0, 238, 475, 713, 950, 1188, 1426, 1663, 1911, 2185, 2490, 2826, 3205, 3624, 4094, 4620, 5210, 5875, 6626, 7478, 8448, 9558, 10243 }; +const Word16 erb_NB_fx[NUM_ERB_NB + 1] = { 0, 238, 475, 713, 950, 1188, 1426, 1663, 1911, 2185, 2490, 2826, 3205, 3624, 4094, 4620, 5210, 5875, 6626, 7478, 8448, 9558, 10243 };//Q(log2(2.56) @@ -34059,7 +34064,7 @@ const float AmpCB1_WB[64][10] = }; const Word16 AmpCB1_WB_fx[640] = -{ +{//Q13 5655, 1589, -653, 3568, -3173, -1852, -3204, -4623, -2100, -5103, -923, -67, -7152, -4958, -2019, -1810, -8532, -648, 6581, 8043, 160, 778, -1535, 863, 5482, 1674, -3576, 123, -3163, -3595, @@ -34195,7 +34200,7 @@ const float AmpCB2_WB[64][NUM_ERB_WB-11] = }; const Word16 AmpCB2_WB_fx[64 * (NUM_ERB_WB - 13)] = -{ +{//Q13 -5276, -7711, -3518, -2416, -382, 319, -1900, -900, 1725, 884, 4071, -4052, -2430, -336, 2136, 3006, 591, -3893, -2731, 2625, 2390, -1047, -883, -3368, -4235, -3726, 189, -1803, 784, 2336, @@ -34338,7 +34343,7 @@ const float AmpCB1_NB[64][10] = }; const Word16 AmpCB1_NB_fx[640] = -{ +{//Q13 -1355, 185, -222, -221, 1976, 3119, 540, 1333, -3646, -2511, -979, 1664, 2087, 951, 787, -1687, -855, 1594, 1264, -4990, -1957, -215, -850, 1369, -113, 2541, -2904, 743, 634, -657, @@ -34474,7 +34479,7 @@ const float AmpCB2_NB[64][NUM_ERB_NB-11] = }; const Word16 AmpCB2_NB_fx[64 * (NUM_ERB_NB - 13)] = -{ +{//Q13 -2681, -4389, -4270, -4727, -239, 1938, 1748, 2311, 4300, -3957, -1299, 3487, 1595, -377, 295, -1193, -1588, 2112, -1573, -6362, -504, 1796, -2521, -68, 1322, 1223, 2263, -503, -3906, 3686, @@ -35097,7 +35102,7 @@ const float hp12800_16000[21] = -0.01235466f, 0.01161181f, -0.00632535f, 0.00212227f, -0.00000000f }; const Word16 hp12800_16000_fx[21] = -{ +{//Q15 -0, 70, -207, 380, -405, 0, 1041, -2668, 4505, -5968, 6526, -5968, 4505, -2668, 1041, 0, -405, 380, -207, 70, -0 @@ -35113,7 +35118,7 @@ const float hp12800_32000[41] = -0.00000000f }; const Word16 hp12800_32000_fx[41] = -{ +{//Q15 -0, 45, 35, -47, -104, 0, 191, 156, -203, -422, -0, 675, 523, -656, -1341, 0, 2264, 1943, -2999, -9872, 19678, -9872, -2999, 1943, @@ -35133,7 +35138,7 @@ const float hp12800_48000[61] = -0.00413694f, 0.00122967f, 0.00427438f, 0.00388820f, 0.00136699f, -0.00111583f, -0.00211804f, -0.00156225f, -0.00030497f, 0.00071064f, 0.00101850f, 0.00067336f, -0.00000000f }; -const Word16 hp12800_48000_fx[61] = +const Word16 hp12800_48000_fx[61] =//Q15 { -0, 22, 33, 23, -10, -51, -69, -37, 45, 127, 140, 40, -136, -271, -238, 0, 326, 507, 349, -143, @@ -35151,7 +35156,7 @@ const float hp16000_32000[33] = -0.00000000f, -0.01594711f, -0.00000000f, 0.00824247f, -0.00000000f, -0.00386248f, -0.00000000f, 0.00188788f, -0.00000000f }; -const Word16 hp16000_32000_fx[33] = +const Word16 hp16000_32000_fx[33] =//Q15 { -0, 62, -0, -127, -0, 270, -0, -523, -0, 940, -0, -1662, -0, 3212, -0, -10353, 16407, -10353, -0, 3212, @@ -35169,7 +35174,7 @@ const float hp16000_48000[49] = 0.00534416f, 0.00421805f, -0.00000000f, -0.00254135f, -0.00195325f, -0.00000000f, 0.00119953f, 0.00100660f, -0.00000000f }; -const Word16 hp16000_48000_fx[49] = +const Word16 hp16000_48000_fx[49] =//Q15 { -0, 33, 39, -0, -64, -83, -0, 138, 175, 0, -272, -334, -0, 493, 596, 0, -870, -1059, -0, 1636, @@ -35223,7 +35228,7 @@ const double cu4[6][3] = /* 5:*/ { 0.5833333333, 1.0208333333, 1.7864583333 } /*1.75*/ }; -const int16_t ct2[7][13] = +const Word16 ct2[7][13] = { /* accepted configurations */ /*input 12.8, output :*/ @@ -35236,7 +35241,7 @@ const int16_t ct2[7][13] = /*12*/ { 9, 3, 4, 5, 9, 0, 0, 0, 5, 0, 5, 5, 4}, /*32*/ { 4, 4, 4, 4, 4, 0, 0, 0, 2, 1, 1, 4, 4}, /*48*/ {18, 18, 18, 18, 18, 0, 0, 0, 5, 2, 1, 4, 15}, -}; +}; // Q0 const Word16 ct2_fx[7][14] = { /* accepted configurations */ @@ -35303,7 +35308,7 @@ const Word16 cu4_fx[6][3] = /*Q13*/ *----------------------------------------------------------------------------------*/ const float h_high[5] = { -0.0125f, -0.1090f, 0.7813f, -0.1090f, -0.0125f }; -const Word16 h_high_fx[5] = { -410, -3572, 25602, -3572, -410 }; +const Word16 h_high_fx[5] = { -410, -3572, 25602, -3572, -410 };//Q15 const float sincos_t_rad3[T_SIN_PI_2+1] = { @@ -35358,7 +35363,7 @@ const float sincos_t_rad3[T_SIN_PI_2+1] = 1.000000000000000f }; const Word16 sincos_t_rad3_fx[T_SIN_PI_2 + 1] = -{ +{//Q15 0, 134, 268, 402, 536, 670, 804, 938, 1072, 1206, 1340, 1474, 1608, 1742, 1876, 2009, 2143, 2277, 2411, 2544, 2678, 2811, 2945, 3078, @@ -35545,7 +35550,7 @@ const float inter_core_25_6kHz_output_48kHz_flt[] = 0.0000000f }; -const TCX_LTP_FILTER_FLT tcxLtpFilters_flt[12] = +const TCX_LTP_FILTER_FLT tcxLtpFilters_flt[12] =//Q15 { { inter_core_12_8kHz_output_8kHz_flt, 2 }, { inter_core_12_8kHz_output_16kHz_flt, 3 }, @@ -35693,7 +35698,7 @@ const SCALE_TCX_SETUP scaleTcxTable[SIZE_SCALE_TABLE_TCX] = * Arithmetic coder *----------------------------------------------------------------------------------*/ -const uint8_t ari_lookup_s17_LC[4096] = +const UWord8 ari_lookup_s17_LC[4096] = // Q0 { 0x01,0x04,0x29,0x13,0x0A,0x0D,0x05,0x10, 0x10,0x0D,0x00,0x0D,0x2A,0x2A,0x22,0x25, @@ -36209,7 +36214,7 @@ const uint8_t ari_lookup_s17_LC[4096] = 0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A,0x3A }; -const uint16_t ari_pk_s17_LC_ext[64][18] = +const UWord16 ari_pk_s17_LC_ext[64][18] = // Q0 { { 16384, 16368,16337,16231,16143,16115,16059,15916,15793,15710,15586,15472,15367,15302,15201,15107,15020, @@ -36469,7 +36474,7 @@ const uint16_t ari_pk_s17_LC_ext[64][18] = } }; -const int16_t NumRatioBits[2][17] = +const Word16 NumRatioBits[2][17] = { /* NB */ { @@ -36480,7 +36485,7 @@ const int16_t NumRatioBits[2][17] = { 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2 } -}; +}; // Q0 const float Ratios_WB_2[32] = /* 2 */ { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 60, 64, 72 }; @@ -36632,37 +36637,37 @@ const float * const Ratios[2][17] = /* 7Q8 */ const Word16 Ratios_WB_2_fx[32] = /* 2 */{ 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4352, 4608, 4864, 5120, 5376, 5632, 6144, 6656, 7168, 7680, 8192, 8704, 9216, 9728, 10240, 15360, 16384, 18432 }; -const Word16 Ratios_WB_3_fx[32] = +const Word16 Ratios_WB_3_fx[32] =/* 7Q8 */ /* 3 */{ 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 7680, 8192, 8704, 9216, 9728, 10240, 11264, 12288, 13824, 15360, 17408, 19968, 20480 }; -const Word16 Ratios_WB_4_fx[32] = +const Word16 Ratios_WB_4_fx[32] =/* 7Q8 */ /* 4 */{ 384, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 7680, 8192, 8704, 9216, 9728, 10240, 10752, 11264, 12288, 13312, 13824, 17408 }; -const Word16 Ratios_WB_5_fx[32] = +const Word16 Ratios_WB_5_fx[32] =/* 7Q8 */ /* 5 */{ 256, 384, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 7680, 8192, 8704, 9216, 10240, 11264, 12288, 13824 }; -const Word16 Ratios_WB_6_fx[32] = +const Word16 Ratios_WB_6_fx[32] =/* 7Q8 */ /* 6 */{ 256, 384, 512, 640, 768, 896, 1024, 1152, 1280, 1408, 1536, 1664, 1792, 1920, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4608, 5120, 5632, 6144, 6656, 7168, 8704, 10240, 10496 }; -const Word16 Ratios_WB_7_fx[32] = +const Word16 Ratios_WB_7_fx[32] =/* 7Q8 */ /* 7 */{ 256, 384, 512, 640, 768, 896, 1024, 1152, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4352, 4608, 4864, 5120, 5376, 5760, 6144, 6400, 6912, 7168, 7680, 8960 }; -const Word16 Ratios_WB_8_fx[16] = +const Word16 Ratios_WB_8_fx[16] =/* 7Q8 */ /* 8 */{ 128, 256, 384, 512, 640, 768, 896, 1024, 1152, 1280, 1408, 1536, 1792, 2048, 2304, 2560 }; -const Word16 Ratios_WB_9_fx[16] = +const Word16 Ratios_WB_9_fx[16] =/* 7Q8 */ /* 9 */{ 256, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3840, 4096, 4608, 6912 }; -const Word16 Ratios_WB_10_fx[16] = +const Word16 Ratios_WB_10_fx[16] =/* 7Q8 */ /* 10 */{ 256, 384, 512, 640, 768, 896, 1024, 1280, 1536, 2048, 2560, 3840, 4608, 5632, 6144, 6656 }; -const Word16 Ratios_WB_11_fx[16] = +const Word16 Ratios_WB_11_fx[16] =/* 7Q8 */ /* 11 */{ 256, 384, 512, 640, 768, 896, 1024, 1280, 1536, 2048, 2560, 3072, 3328, 3584, 4608, 5376 }; -const Word16 Ratios_WB_12_fx[16] = +const Word16 Ratios_WB_12_fx[16] =/* 7Q8 */ /* 12 */{ 128, 256, 384, 512, 640, 768, 1024, 1280, 1536, 2048, 2304, 2816, 3072, 3456, 4096, 5120 }; -const Word16 Ratios_WB_13_fx[16] = +const Word16 Ratios_WB_13_fx[16] =/* 7Q8 */ /* 13 */{ 128, 256, 384, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2560, 2816, 3072, 3584, 5120 }; -const Word16 Ratios_WB_14_fx[16] = +const Word16 Ratios_WB_14_fx[16] =/* 7Q8 */ /* 14 */{ 128, 256, 384, 512, 640, 768, 1024, 1152, 1536, 1920, 2304, 2560, 3072, 3584, 3840, 4608 }; -const Word16 Ratios_WB_15_fx[16] = +const Word16 Ratios_WB_15_fx[16] =/* 7Q8 */ /* 15 */{ 128, 256, 320, 384, 448, 512, 640, 768, 896, 1024, 1152, 1280, 1536, 2048, 2304, 3584 }; -const Word16 Ratios_WB_16_fx[4] = +const Word16 Ratios_WB_16_fx[4] =/* 7Q8 */ /* 16 */{ 128, 256, 512, 1024 }; -const Word16 Ratios_WB_17_fx[4] = +const Word16 Ratios_WB_17_fx[4] =/* 7Q8 */ /* 17 */{ 256, 384, 512, 1024 }; -const Word16 Ratios_WB_18_fx[4] = +const Word16 Ratios_WB_18_fx[4] =/* 7Q8 */ /* 18 */{ 256, 512, 768, 1024 }; /******************************************************************************/ @@ -36670,42 +36675,42 @@ const Word16 Ratios_WB_18_fx[4] = /* 7Q8 */ const Word16 Ratios_NB_2_fx[32] = /* 2 */{ 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 2816, 3072, 3328, 3584, 3840, 4096, 4352, 4608, 4864, 5120, 5376, 5632, 5888, 6144, 6400, 6656, 6912, 7168, 7680, 8192, 8704, 9216, 9728, 10240 }; -const Word16 Ratios_NB_3_fx[16] = +const Word16 Ratios_NB_3_fx[16] =/* 7Q8 */ /* 3 */{ 128, 256, 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 4096, 5120, 6144, 7680 }; -const Word16 Ratios_NB_4_fx[16] = +const Word16 Ratios_NB_4_fx[16] =/* 7Q8 */ /* 4 */{ 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120, 6144, 7680 }; -const Word16 Ratios_NB_5_fx[16] = +const Word16 Ratios_NB_5_fx[16] =/* 7Q8 */ /* 5 */{ 512, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120, 6144, 7680 }; -const Word16 Ratios_NB_6_fx[16] = +const Word16 Ratios_NB_6_fx[16] =/* 7Q8 */ /* 6 */{ 512, 640, 768, 896, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120 }; -const Word16 Ratios_NB_7_fx[16] = +const Word16 Ratios_NB_7_fx[16] =/* 7Q8 */ /* 7 */{ 256, 512, 640, 768, 1024, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 3584, 4096, 4608, 5120 }; -const Word16 Ratios_NB_8_fx[16] = +const Word16 Ratios_NB_8_fx[16] =/* 7Q8 */ /* 8 */{ 256, 384, 512, 640, 768, 896, 1024, 1152, 1280, 1536, 1792, 2048, 2304, 2560, 3072, 4096 }; -const Word16 Ratios_NB_9_fx[8] = +const Word16 Ratios_NB_9_fx[8] =/* 7Q8 */ /* 9 */{ 256, 512, 768, 1024, 1280, 1536, 2048, 2560 }; -const Word16 Ratios_NB_10_fx[8] = +const Word16 Ratios_NB_10_fx[8] =/* 7Q8 */ /* 10 */{ 256, 512, 768, 1024, 1280, 1536, 2048, 2560 }; -const Word16 Ratios_NB_11_fx[8] = +const Word16 Ratios_NB_11_fx[8] =/* 7Q8 */ /* 11 */{ 256, 384, 512, 768, 1024, 1280, 1536, 2048 }; -const Word16 Ratios_NB_12_fx[8] = +const Word16 Ratios_NB_12_fx[8] =/* 7Q8 */ /* 12 */{ 256, 512, 640, 768, 1024, 1280, 1536, 2048 }; -const Word16 Ratios_NB_13_fx[4] = +const Word16 Ratios_NB_13_fx[4] =/* 7Q8 */ /* 13 */{ 256, 512, 768, 1024 }; -const Word16 Ratios_NB_14_fx[4] = +const Word16 Ratios_NB_14_fx[4] =/* 7Q8 */ /* 14 */{ 256, 512, 1024, 1536 }; -const Word16 Ratios_NB_15_fx[4] = +const Word16 Ratios_NB_15_fx[4] =/* 7Q8 */ /* 15 */{ 256, 512, 768, 1024 }; -const Word16 Ratios_NB_16_fx[4] = +const Word16 Ratios_NB_16_fx[4] =/* 7Q8 */ /* 16 */{ 256, 384, 512, 1024 }; -const Word16 Ratios_NB_17_fx[4] = +const Word16 Ratios_NB_17_fx[4] =/* 7Q8 */ /* 17 */{ 256, 384, 512, 768 }; -const Word16 Ratios_NB_18_fx[4] = +const Word16 Ratios_NB_18_fx[4] =/* 7Q8 */ /* 18 */{ 128, 256, 512, 768 }; /******************************************************************************/ -const Word16 *const Ratios_fx[2][17] = +const Word16 *const Ratios_fx[2][17] =/* 7Q8 */ { /* NB */ { @@ -37184,7 +37189,7 @@ const Coding * const codesTnsCoeffSWBTCX20[] = { codesTnsCoeff0TCX20, codesTnsCo const Coding * const codesTnsCoeffSWBTCX10[] = { codesTnsCoeff0TCX10, codesTnsCoeff1TCX10, codesTnsCoeff2TCX10, codesTnsCoeff3TCX10, codesTnsCoeff4TCX10, codesTnsCoeff5, codesTnsCoeff6, codesTnsCoeff7 }; const Coding * const codesTnsCoeffWBTCX20[] = { codesTnsCoeff0WBTCX20, codesTnsCoeff1WBTCX20, codesTnsCoeff2WB, codesTnsCoeff3WB, codesTnsCoeff456, codesTnsCoeff456, codesTnsCoeff456, codesTnsCoeff7 }; -const int16_t nTnsCoeffTables = sizeof(codesTnsCoeffSWBTCX20)/sizeof(codesTnsCoeffSWBTCX20[0]); +const Word16 nTnsCoeffTables = sizeof(codesTnsCoeffSWBTCX20)/sizeof(codesTnsCoeffSWBTCX20[0]); // Q0 const Coding codesTnsOrderTCX20[] = { @@ -37220,7 +37225,7 @@ const Coding codesTnsOrder[] = { 8, 0, 1 } /* 0 */ }; -const int16_t nTnsOrderCodes = sizeof(codesTnsOrder)/sizeof(codesTnsOrder[0]); +const Word16 nTnsOrderCodes = sizeof(codesTnsOrder)/sizeof(codesTnsOrder[0]); // Q0 const ParamsBitMap tnsSWBTCX20FilterCoeffBitMap = { @@ -37400,7 +37405,7 @@ const Word16 tnsCoeff4[16] = * IGF settings for each bitrate *----------------------------------------------------------------------------------*/ -const Word16 swb_offset_LB_new[IGF_BITRATE_UNKNOWN][IGF_MAX_SFB] = +const Word16 swb_offset_LB_new[IGF_BITRATE_UNKNOWN][IGF_MAX_SFB] = // Q0 { /* 0: for 9600 kbs WB */ { @@ -37548,7 +37553,7 @@ const Word16 swb_offset_LB_new[IGF_BITRATE_UNKNOWN][IGF_MAX_SFB] = } };/*Q0*/ -const int16_t igf_tile_offset_table[IGF_BITRATE_UNKNOWN][2*IGF_MAX_TILES+1] = { +const Word16 igf_tile_offset_table[IGF_BITRATE_UNKNOWN][2*IGF_MAX_TILES+1] = { // Q0 { 2, 2, 0, 3, 0}, /* 9600 WB*/ { 2, 2, 0, 3, 0}, /* 13200 WB RF */ { 3, 1, 0, 2, 32, 3, 46}, /* 9600 SWB */ @@ -38045,7 +38050,7 @@ const Word16 igf_whitening_TH[][2][IGF_MAX_TILES] = /* IGF SCF arithmetic coder cumulative frequency tables and offsets */ -const int16_t cf_off_se01_tab[10] = { +const Word16 cf_off_se01_tab[10] = { // Q0 +1, /* 9.6 kbs B*/ +1, /* 13.2 kbs WB RF B*/ +1, /* 9.6 kbs SWB B*/ @@ -38058,7 +38063,7 @@ const int16_t cf_off_se01_tab[10] = { -1 /* 64.0 kbs B*/ }; -const int16_t cf_off_se02_tab[10][IGF_CTX_COUNT] = { +const Word16 cf_off_se02_tab[10][IGF_CTX_COUNT] = { // Q0 { +1, +2, +2, +2, +3, +3, +4}, /* 9.6 kbs B*/ { +1, +2, +2, +2, +3, +3, +4}, /* 13.2 kbs WB RF B*/ { +0, +2, +3, +3, +2, +2, +4}, /* 9.6 kbs SWB B*/ @@ -38071,9 +38076,9 @@ const int16_t cf_off_se02_tab[10][IGF_CTX_COUNT] = { { +3, +2, +3, +2, +3, +3, +6} /* 64.0 kbs B*/ }; -const int16_t cf_off_se10_tab = -7; +const Word16 cf_off_se10_tab = -7; // Q0 -const int16_t cf_off_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT] = +const Word16 cf_off_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT] = // Q0 { { -5, +0, +0, +0, +0, +0, +0}, { +0, +0, +0, +0, +0, +0, +0}, @@ -38084,12 +38089,12 @@ const int16_t cf_off_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT] = { +0, +1, +0, +0, +3, +0, +3} }; -const uint16_t cf_se00_tab[IGF_SYMBOLS_IN_TABLE + 1] = +const UWord16 cf_se00_tab[IGF_SYMBOLS_IN_TABLE + 1] = // Q0 { 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 uint16_t cf_se01_tab[10][IGF_SYMBOLS_IN_TABLE + 1] = +const UWord16 cf_se01_tab[10][IGF_SYMBOLS_IN_TABLE + 1] = // Q0 { {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*/ @@ -38103,7 +38108,7 @@ const uint16_t cf_se01_tab[10][IGF_SYMBOLS_IN_TABLE + 1] = {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 uint16_t cf_se02_tab[10][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1] = +const UWord16 cf_se02_tab[10][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1] = // Q0 { { /* 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}, @@ -38199,12 +38204,12 @@ const uint16_t cf_se02_tab[10][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1] = /* only needed for >= 48 kbps */ -const uint16_t cf_se10_tab[IGF_SYMBOLS_IN_TABLE + 1] = +const UWord16 cf_se10_tab[IGF_SYMBOLS_IN_TABLE + 1] = // Q0 { 16384, 15493, 15154, 14810, 14331, 13701, 13086, 12403, 11585, 10923, 10293, 9631, 8943, 8385, 7760, 7182, 6593, 6009, 5540, 5082, 4571, 4133, 3711, 3299, 2887, 2460, 2043, 0 }; -const uint16_t cf_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1] = +const UWord16 cf_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1] = // Q0 { { { 16384, 16313, 16312, 16241, 16206, 16099, 15957, 15386, 14601, 12852, 10282, 7534, 4964, 2966, 1824, 896, 504, 255, 113, 112, 41, 40, 39, 38, 37, 36, 1, 0}, @@ -38329,7 +38334,7 @@ const float * const w_a_float[7] = {w1N8_float, w2N8_float, w3N8_float, w4N8_flo #define STCP( a, b ) {{ WORD322WORD16( a ), WORD322WORD16( b ) }} -const PWord16 SineTable512_fx[] = +const PWord16 SineTable512_fx[] =//Q15 { STCP(0x7fffffff, 0x00000000), STCP(0x7fffd886, 0x006487e3), STCP(0x7fff6216, 0x00c90f88), STCP(0x7ffe9cb2, 0x012d96b1), STCP(0x7ffd885a, 0x01921d20), STCP(0x7ffc250f, 0x01f6a297), STCP(0x7ffa72d1, 0x025b26d7), STCP(0x7ff871a2, 0x02bfa9a4), @@ -38399,7 +38404,7 @@ const PWord16 SineTable512_fx[] = }; /* Lookup-Table for binary logarithm */ -const Word16 ldCoeff[7] = +const Word16 ldCoeff[7] =//Q15 { -32768, -16384, -10923, -8192, -6554, -5461, -4681 /* -4096, -3641, -3277 */ @@ -38407,7 +38412,7 @@ const Word16 ldCoeff[7] = /* Lookup-Table for binary power algorithm */ /* This table is used for lookup 2^x with x in range [0...1.0[ in steps of 1/32 */ -const UWord32 exp2_tab_long[32] = +const UWord32 exp2_tab_long[32] =//Q31 { 0x40000000,0x4166C34C,0x42D561B4,0x444C0740, 0x45CAE0F2,0x47521CC6,0x48E1E9BA,0x4A7A77D4, @@ -38421,7 +38426,7 @@ const UWord32 exp2_tab_long[32] = /* Lookup-Table for binary power algorithm */ /* This table is used for lookup 2^x with x in range [0...1/32[ in steps of 1/1024 */ -const UWord32 exp2w_tab_long[32] = +const UWord32 exp2w_tab_long[32] =//Q31 { 0x40000000,0x400B1818,0x4016321B,0x40214E0C, 0x402C6BE9,0x40378BB4,0x4042AD6D,0x404DD113, @@ -38435,7 +38440,7 @@ const UWord32 exp2w_tab_long[32] = /* Lookup-Table for binary power algorithm */ /* This table is used for lookup 2^x with x in range [0...1/1024[ in steps of 1/32768 */ -const UWord32 exp2x_tab_long[32] = +const UWord32 exp2x_tab_long[32] =//Q31 { 0x40000000,0x400058B9,0x4000B173,0x40010A2D, 0x400162E8,0x4001BBA3,0x4002145F,0x40026D1B, @@ -38456,7 +38461,7 @@ const Word32 SqrtTable[32] = /* Q31 */ 0x77BBCF60, 0x78CC4545, 0x79DA5A00, 0x7AE61D3E, 0x7BEF9E07, 0x7CF6EAC2, 0x7DFC113F, 0x7EFF1EC0 }; -const Word16 SqrtDiffTable[32] = /* Q21 */ +const Word16 SqrtDiffTable[32] = /* Q15 */ { 0x59CF, 0x5875, 0x572B, 0x55EE, 0x54BF, 0x539C, 0x5284, 0x5177, 0x5074, 0x4F7A, 0x4E89, 0x4DA1, 0x4CC0, 0x4BE7, 0x4B15, 0x4A4A, @@ -38472,7 +38477,7 @@ const Word32 ISqrtTable[32] = /* Q31 */ 0x60C1E8C8, 0x5FE7AE45, 0x5F131EBE, 0x5E43FC76, 0x5D7A0D4F, 0x5CB51A81, 0x5BF4F061, 0x5B395E26 }; -const Word16 ISqrtDiffTable[32] = /* Q21 */ +const Word16 ISqrtDiffTable[32] = /* Q15 */ { 0x7D0C, 0x777E, 0x7256, 0x6D8A, 0x6911, 0x64E5, 0x60FD, 0x5D54, 0x59E5, 0x56AA, 0x53A0, 0x50C2, 0x4E0D, 0x4B7E, 0x4912, 0x46C6, @@ -38489,7 +38494,7 @@ const Word32 InvTable[32] = /* Q31 */ 0x4923D31D, 0x47DB5CAE, 0x469E3974, 0x456BD608, 0x4443A8D9, 0x43253159, 0x420FF746, 0x41038A01 }; -const Word16 InvDiffTable[32] = /* Q20 */ +const Word16 InvDiffTable[32] = /* Q15 */ { 0x7C14, 0x74C8, 0x6E1C, 0x67FF, 0x6260, 0x5D33, 0x586C, 0x5400, 0x4FE7, 0x4C19, 0x4890, 0x4543, 0x422F, 0x3F4F, 0x3C9D, 0x3A17, @@ -38544,7 +38549,7 @@ const float tcx_mdct_window_48[420] = 0.99936891f , 0.99949473f , 0.99960661f , 0.99970454f , 0.99978846f , 0.99985838f , 0.99991435f , 0.99995631f , 0.99998426f , 0.99999827f , }; -const Word16 tcx_mdct_window_48_fx[420] = +const Word16 tcx_mdct_window_48_fx[420] =//Q15 { 61, 183, 306, 428, 551, 673, 796, 919, 1041, 1163, 1286, 1408, 1531, 1653, 1776, 1898, 2020, 2143, 2265, 2387, 2509, 2632, 2754, 2876, 2998, 3120, 3242, 3364, 3486, 3607, 3729, @@ -38609,7 +38614,7 @@ const float tcx_mdct_window_half_48[180] = 0.99656552f , 0.99725020f , 0.99785894f , 0.99839169f , 0.99884838f , 0.99922901f , 0.99953359f , 0.99976200f , 0.99991435f , 0.99999046f , }; -const Word16 tcx_mdct_window_half_48_fx[180] = +const Word16 tcx_mdct_window_half_48_fx[180] =//Q15 { 142, 428, 714, 1000, 1286, 1572, 1857, 2143, 2428, 2713, 2998, 3282, 3567, 3851, 4135, 4418, 4701, 4984, 5267, 5549, 5830, @@ -38639,7 +38644,7 @@ const float tcx_mdct_window_trans_48[60] = 0.96923089f , 0.97534233f , 0.98078531f , 0.98555607f , 0.98965138f , 0.99306846f , 0.99580491f , 0.99785894f , 0.99922901f , 0.99991435f , }; -const Word16 tcx_mdct_window_trans_48_fx[60] = +const Word16 tcx_mdct_window_trans_48_fx[60] =//Q15 { 428, 1286, 2143, 2998, 3851, 4701, 5549, 6392, 7231, 8065, 8894, 9717, 10532, 11341, 12142, 12934, 13718, 14492, 15257, 16011, 16754, 17485, 18204, 18911, 19605, 20286, 20953, 21605, 22242, 22865, 23471, @@ -38658,7 +38663,7 @@ const float sigma_BWE[] = { 0.008809121277345f, 0.008799007638233f, 0.009070002122415f, 0.009080199707624f, 0.009739951681282f, 0.010572954192948f, 0.018255917586799f, 0.018995351636606f }; /* for 3 bits first stage */ -const Word32 sigma_BWE_fx[] = { +const Word32 sigma_BWE_fx[] = {//Q31 17011214, 16701976, 17561200, 17474996, 19251270, 20645372, 39204284, 40792208, 18917444, 18895726, 19477682, @@ -38674,7 +38679,7 @@ const float inv_sigma_BWE[] = { }; -const Word16 inv_modified_sigma_BWE_fx[] = { +const Word16 inv_modified_sigma_BWE_fx[] = {//Q1 259, 254, 267, @@ -38693,7 +38698,7 @@ const Word16 inv_modified_sigma_BWE_fx[] = { 622 }; -const Word16 modified_sigma_BWE_fx[] = +const Word16 modified_sigma_BWE_fx[] =//Q(log2(2.56) { 323, 329, 313, @@ -38715,7 +38720,7 @@ const float SHB_LSF_mean[10] = { 0.04131f, 0.08078f, 0.12348f, 0.16567f, 0.21045f, 0.25449f, 0.30101f, 0.34693f, 0.39605f, 0.44428f }; -const Word16 SHB_LSF_mean_fx[10] = { +const Word16 SHB_LSF_mean_fx[10] = {//Q15 1353, 2646, 4046, 5428, 6896, 8339, 9863, 11368, 12977, 14558 @@ -38756,7 +38761,7 @@ const float SHB_LSF_VQ3[48] = { const float *const cb_LSF_BWE[] = { SHB_LSF_VQ4, SHB_LSF_VQ3 }; -const Word16 SHB_LSF_VQ4_fx[96] = +const Word16 SHB_LSF_VQ4_fx[96] =//Q15 { 150, 51, -507, -986, -1115, -944, -184, -77, 95, 232, 440, 497, -115, -107, -109, -242, -446, -592, 387, 799, @@ -38772,7 +38777,7 @@ const Word16 SHB_LSF_VQ4_fx[96] = 234, -377, -629, -296, -95, 21, 63, -206, -456, 518, 472, 179, 22 }; /* 3 bit VQ first stage */ -const Word16 SHB_LSF_VQ3_fx[48] = +const Word16 SHB_LSF_VQ3_fx[48] =//Q15 { 278, 403, 285, 65, -206, -337, 386, 770, 838, 753, 599, 445, -196, -455, -609, -524, -206, -78, 39, 199, @@ -38780,21 +38785,21 @@ const Word16 SHB_LSF_VQ3_fx[48] = -1241, -1225, -976, -52, -98, -216, -422, -599, -688, 127, 137, 0, 52, 301, 412, -278, -422, 9, 199, 137, 72 }; -const Word16 *const cb_LSF_BWE_fx[] = { SHB_LSF_VQ4_fx, SHB_LSF_VQ3_fx }; +const Word16 *const cb_LSF_BWE_fx[] = { SHB_LSF_VQ4_fx, SHB_LSF_VQ3_fx }; // Q15 -const int16_t mslvq_SHB_min_bits[] = {14, 12}; /* for 4 bits and 3 bits respectively */ +const Word16 mslvq_SHB_min_bits[] = {14, 12}; /* for 4 bits and 3 bits respectively Q0*/ const float scales_BWE[] = { 0.932f, 1.677f, 2.811f, /* 14 bits*/ 0.891f, 1.770f, 3.002f, /* 15 bits */ 0.849f, 1.769f, 3.226f}; /* 16 bits */ -const Word16 scales_BWE_fx[] = { +const Word16 scales_BWE_fx[] = {//Q13 7634, 13737, 23027, 7299, 14499, 24592, 6955, 14491, 26427 }; -const Word16 scales_BWE_fx_new[] = { +const Word16 scales_BWE_fx_new[] = {//Q11 1908, 3434, @@ -38806,7 +38811,7 @@ const Word16 scales_BWE_fx_new[] = { 3622, 6606 }; -const Word8 no_lead_BWE[] = { +const Word8 no_lead_BWE[] = { // Q0 8, 6, 5, /* 14 bits */ 10,9,5, /* 15 bits*/ 16, 11, 5}; /* 16 bits */ @@ -38818,13 +38823,13 @@ const float scales_BWE_3b[] = { 0.885f, 1.549f, 2.815f /* 14 bits*/ }; -const Word16 scales_BWE_3b_fx[] = { +const Word16 scales_BWE_3b_fx[] = {//Q13 7847, 14262, 28934, 7610, 12771, 21544, 7249, 12689, 23060 }; -const Word16 scales_BWE_3b_fx_new[] = { +const Word16 scales_BWE_3b_fx_new[] = {//Q11 1961, 3565, 7233, @@ -38836,7 +38841,7 @@ const Word16 scales_BWE_3b_fx_new[] = { 5765 }; -const Word8 no_lead_BWE_3b[] = { +const Word8 no_lead_BWE_3b[] = { // Q0 4, 5, 2, /* 12 bits */ 5, 5, 5, /* 13 bits */ 8, 6, 5 /* 14 bits */ @@ -38847,7 +38852,7 @@ const float LastCoefPred_0bit[18] = { 0.00817f, -0.00645f, -0.00937f, -0.00726f, 0.00363f, 0.02148f, 0.08237f, 0.20400f, 0.00000f }; -const Word32 LastCoefPred_0bit_fx[18] = +const Word32 LastCoefPred_0bit_fx[18] =//Q31 { 10930692, -29356102, -14495515, -11918534, 3435973, 89292368, 269423296, @@ -38862,14 +38867,14 @@ const float LastCoefPred_1bit[36] = { -0.01554f, -0.02277f, -0.00474f, 0.00468f, 0.01070f, 0.04327f, 0.09857f, 0.26611f, -0.01164f }; -const Word32 LastCoefPred_1bit_fx[36] = { +const Word32 LastCoefPred_1bit_fx[36] = {//Q31 37795712, -47094316, 24910810, 18060338, 38268160, 87424056, 217346816, 810181184, 9685151, 53107272, -26843546, 11703786, -7301444, 20444044, 22655952, 138448272, 307648512, 9234180 }; -const int16_t config_LSF_BWE[] = { +const Word16 config_LSF_BWE[] = { // Q0 4, 16, 1, /* 21 bits */ 4, 16, 1, /* 20 */ 4, 16, 1, /* 19 */ @@ -38939,7 +38944,7 @@ const Word16 f_atan_expand_range[MAXSFTAB - (MINSFTAB - 1)] = }; -const Word16 Grid[GRID100_POINTS + 1] = +const Word16 Grid[GRID100_POINTS + 1] =//Q15 { 32767, 32751, 32703, 32622, 32509, 32364, 32187, 31978, 31738, 31466, 31164, 30830, @@ -38960,7 +38965,7 @@ const Word16 Grid[GRID100_POINTS + 1] = -32509, -32622, -32703, -32751, -32760 }; -const Word16 pwAlpha[10] = { 0x6666, 0x51ec, 0x4189, 0x346e, 0x29f1, +const Word16 pwAlpha[10] = { 0x6666, 0x51ec, 0x4189, 0x346e, 0x29f1,//Q15 0x218e, 0x1ad8, 0x157a, 0x112e, 0x0dbe }; @@ -39001,7 +39006,7 @@ const Word8 Ind_Guess[256] = 14, 13, 12, 11, 10, 8, 7, 5 }; -const Word16 cos_table_129[129] = +const Word16 cos_table_129[129] =//Q15 { 32767, 32758, 32729, 32679, 32610, 32522, 32413, 32286, 32138, @@ -39022,7 +39027,7 @@ const Word16 cos_table_129[129] = -32286, -32413, -32522, -32610, -32679, -32729, -32758, -32768 }; -const Word16 acos_slope[128] = +const Word16 acos_slope[128] =//Q15 { -26214, -9039, -5243, -3799, -2979, -2405, -2064, -1771, -1579, -1409, -1279, -1170, -1079, -1004, -933, -880, @@ -39043,9 +39048,9 @@ const Word16 acos_slope[128] = }; #define SHC(x) ((Word16)x) -const Word16 cos_coef_new[4] = { SHC(0x02BA), SHC(0xE60A), SHC(0xEEEF), SHC(0xAAAB) }; +const Word16 cos_coef_new[4] = { SHC(0x02BA), SHC(0xE60A), SHC(0xEEEF), SHC(0xAAAB) };//Q15 -const Word16 cos_table[512] = +const Word16 cos_table[512] =//Q15 { SHC(0x7fff), SHC(0x7ffe), @@ -39694,7 +39699,7 @@ const PWord16 w7N8[15] = {{ 14010/*0.427555 Q15*/, 29622/*0.903989 Q15*/}} }; -const PWord16 *w_a[7] = { w1N8, w2N8, w3N8, w4N8, w5N8, w6N8, w7N8 }; +const PWord16 *w_a[7] = { w1N8, w2N8, w3N8, w4N8, w5N8, w6N8, w7N8 };//Q15 const PWord16 w19N[127] = { @@ -39963,7 +39968,7 @@ const PWord16 w18N[127] = * for fractional pitch search * Used in lib_enc\pit_enc.c Q14 *-------------------------------------------------------------------*/ -const Word16 inter4_1_fx[32] = +const Word16 inter4_1_fx[32] =//Q14 { -12, -26, 32, 206, 420, 455, 73, -766, @@ -39977,13 +39982,13 @@ const Word16 inter4_1_fx[32] = const Word16 sin_switch_8[15] = { 3212, 6393, 9512, 12540, 15447, 18205, 20788, 23170, 25330, 27246, 28899, 30274, 31357, 32138, 32610 -}; +};//Q15 const Word16 sin_switch_16[30] = { 1660, 3315, 4962, 6596, 8213, 9810, 11380, 12922, 14431, 15902, 17333, 18719, 20057, 21344, 22576, 23750, 24863, 25912, 26895, 27808, 28651, 29419, 30112, 30728, 31265, 31722, 32097, 32390, 32600, 32726 -}; +};//Q15 const Word16 sin_switch_32[60] = { 844, 1687, 2529, 3369, 4207, 5043, 5875, 6703, @@ -39994,7 +39999,7 @@ const Word16 sin_switch_32[60] = { 844, 1687, 2529, 3369, 4207, 5043, 5875, 6703 28518, 28924, 29311, 29678, 30026, 30354, 30662, 30949, 31216, 31462, 31688, 31892, 32075, 32237, 32378, 32497, 32594, 32670, 32725, 32757 -}; +};//Q15 const Word16 sin_switch_48[90] = { 566, 1131, 1696, 2261, 2825, 3388, 3950, 4511, @@ -40009,7 +40014,7 @@ const Word16 sin_switch_48[90] = { 566, 1131, 1696, 2261, 2825, 3388, 3950, 4511 31199, 31367, 31526, 31676, 31816, 31946, 32068, 32179, 32281, 32373, 32456, 32529, 32592, 32646, 32690, 32724, 32748, 32763 -}; +};//Q15 const Word16 one_on_win_48k_fx[210] = { @@ -40040,7 +40045,7 @@ const Word16 one_on_win_48k_fx[210] = 22924, 22996, 23069, 23142, 23216, 23291, 23367, 23443, 23521, 23599, 23677, 23757, 23837, 23918, 24000, 24083, 24167, 24251 -}; +};//Q14 const Word16 one_on_win_8k_16k_48k_fx[70] = { @@ -40053,7 +40058,7 @@ const Word16 one_on_win_8k_16k_48k_fx[70] = 20268, 20411, 20558, 20709, 20865, 21024, 21188, 21357, 21530, 21708, 21891, 22079, 22273, 22472, 22677, 22888, 23105, 23329, 23560, 23797, 24041, 24251 -}; +};//Q14 const Word16 window_8_16_32kHz_fx[370] = { @@ -40104,7 +40109,7 @@ const Word16 window_8_16_32kHz_fx[370] = 7026, 6675, 6322, 5965, 5606, 5243, 4878, 4508, 4136, 3759, 3378, 2993, 2603, 2208, 1807, 1397, 978, 545 -}; +};//Q15 const Word16 window_48kHz_fx[1110] = { @@ -40247,9 +40252,9 @@ const Word16 window_48kHz_fx[1110] = 3058, 2929, 2800, 2669, 2539, 2407, 2275, 2142, 2009, 1875, 1740, 1604, 1467, 1330, 1191, 1051, 909, 766, 621, 474, 324, 169 -}; +};//Q15 -const Word16 window_256kHz[592] = /*ALDO at 25.6 maybe not needed ?*/ +const Word16 window_256kHz[592] = /*ALDO at 25.6 maybe not needed ?Q15*/ { 1, 3, 7, 12, 19, 27, 36, 47, 58, 72, 86, 102, 119, 138, 157, 178, @@ -40327,7 +40332,7 @@ const Word16 window_256kHz[592] = /*ALDO at 25.6 maybe not needed ?*/ 2139, 1888, 1635, 1379, 1119, 854, 583, 304 }; -const Word16 small_overlap_48[R2_48 / 7] = +const Word16 small_overlap_48[R2_48 / 7] =//Q15 { 429, 1286, 2143, 2998, 3851, 4702, 5549, 6393, 7232, 8066, 8895, 9717, 10533, 11342, 12142, 12935, @@ -40339,7 +40344,7 @@ const Word16 small_overlap_48[R2_48 / 7] = 32631, 32698, 32743, 32765 }; -const Word16 small_overlap_25[R2_25 / 7] = +const Word16 small_overlap_25[R2_25 / 7] =//Q15 { 804, 2411, 4011, 5602, 7180, 8740, 10279, 11793, 13279, 14733, 16151, 17531, 18868, 20160, 21403, 22595, @@ -40347,7 +40352,7 @@ const Word16 small_overlap_25[R2_25 / 7] = 30572, 31114, 31581, 31972, 32286, 32522, 32679, 32758 }; -const Word16 small_overlap_int[R2_16 / 7] = +const Word16 small_overlap_int[R2_16 / 7] =//Q15 { 2571, 5126, 7650, 10126, 12540, 14876, 17121, 19261, 21281, 22865, @@ -40356,7 +40361,7 @@ const Word16 small_overlap_int[R2_16 / 7] = }; -const Word16 half_overlap_48[3 * R2_48 / 7] = +const Word16 half_overlap_48[3 * R2_48 / 7] =//Q15 { 143, 429, 715, 1001, 1286, 1572, 1858, 2143, 2428, 2713, @@ -40384,7 +40389,7 @@ const Word16 half_overlap_48[3 * R2_48 / 7] = 32765, 32767 }; -const Word16 half_overlap_25[3 * R2_25 / 7] = +const Word16 half_overlap_25[3 * R2_25 / 7] =//Q15 { 268, 804, 1340, 1876, 2411, 2945, 3479, 4011, 4543, 5073, 5602, 6130, 6655, 7180, 7702, 8222, @@ -40400,7 +40405,7 @@ const Word16 half_overlap_25[3 * R2_25 / 7] = 32522, 32583, 32635, 32679, 32714, 32741, 32758, 32767 }; -const Word16 half_overlap_int[3 * R2_16 / 7] = +const Word16 half_overlap_int[3 * R2_16 / 7] =//Q15 { 858, 1715, 2571, 3425, 4277, 5126, 5971, 6813, 7650, 8481, 9307, 10126, 10938, 11743, @@ -40411,7 +40416,7 @@ const Word16 half_overlap_int[3 * R2_16 / 7] = 30592, 30888, 31164, 31419, 31651, 31863, 32052, 32219, 32365, 32488, 32588, 32667, 32723, 32757 }; -const Word16 wac_h[LPC_SHB_ORDER] = +const Word16 wac_h[LPC_SHB_ORDER] =//Q15 { 32763, 32751, @@ -40425,7 +40430,7 @@ const Word16 wac_h[LPC_SHB_ORDER] = 32366 }; -const Word16 wac_l[LPC_SHB_ORDER] = +const Word16 wac_l[LPC_SHB_ORDER] =//Q15 { 31381, 27317, @@ -40452,20 +40457,20 @@ const Word16 dsDiracsTab[65] = 512 }; -const Word16 pwf_fx[17] = +const Word16 pwf_fx[17] =//Q12 { 22938, 16056, 11239, 7868, 5507, 3855, 2699, 1889, 1322, 926, 648, 454, 317, 222, 156, 109, 76 }; -const Word32 inverse_table[] = +const Word32 inverse_table[] =//Q29 { 0, 134217728, 67108864, 44739242, 33554432, 26843545, 22369621, 19173961, 16777216, 14913080, 13421772, 12201611, 11184810, 10324440, 9586980, 8947848, 8388608, 7895160, 7456540, 7064090, 6710886, 6391320, 6100805, 5835553, 5592405, 5368709, 5162220, 4971026, 4793490, 4628197, 4473924, 4329604, 4194304, 4067203, 3947580, 3834792, 3728270, 3627506, 3532045, 3441480, 3355443, 3273603, 3195660, 3121342, 3050402, 2982616, 2917776, 2855696, 2796202, 2739137, 2684354, 2631720, 2581110, 2532409, 2485513, 2440322, 2396745, 2354696, 2314098, 2274876, 2236962, 2200290, 2164802, 2130440, 2097152, 2064888, 2033601, 2003249, 1973790, 1945184, 1917396, 1890390, 1864135, 1838599, 1813753, 1789569, 1766022, 1743087, 1720740, 1698958, 1677721, 1657008, 1636801, 1617081, 1597830, 1579032, 1560671, 1542732, 1525201, 1508064, 1491308, 1474920, 1458888, 1443201, 1427848, 1412818, 1398101, 1383687, 1369568, 1355734, 1342177, 1328888, 1315860, 1303084, 1290555, 1278264, 1266204, 1254371, 1242756, 1231355, 1220161, 1209168, 1198372, 1187767, 1177348, 1167110, 1157049, 1147160, 1137438, 1127880, 1118481, 1109237, 1100145, 1091201, 1082401, 1073741, 1065220, 1056832, 1048576, 1040447, 1032444, 1024562, 1016800, 1009155, 1001624, 994205, 986895, 979691, 972592, 965595, 958698, 951898, 945195, 938585, 932067, 925639, 919299, 913045, 906876, 900790, 894784, 888859, 883011, 877240, 871543, 865920, 860370, 854889, 849479, 844136, 838860, 833650, 828504, 823421, 818400, 813440, 808540, 803698, 798915, 794187, 789516, 784898, 780335, 775825, 771366, 766958, 762600, 758292, 754032, 749819, 745654, 741534, 737460, 733430, 729444, 725501, 721600, 717741, 713924, 710146, 706409, 702710, 699050, 695428, 691843, 688296, 684784, 681308, 677867, 674460, 671088, 667749, 664444, 661171, 657930, 654720, 651542, 648394, 645277, 642190, 639132, 636102, 633102, 630130, 627185, 624268, 621378, 618514, 615677, 612866, 610080, 607320, 604584, 601873, 599186, 596523, 593883, 591267, 588674, 586103, 583555, 581029, 578524, 576041, 573580, 571139, 568719, 566319, 563940, 561580, 559240, 556920, 554618, 552336, 550072, 547827, 545600, 543391, 541200, 539027, 536870, 534731, 532610, 530504, 528416, 526344, }; -const Word16 cos_diff_table[512] = +const Word16 cos_diff_table[512] =//Q15 { SHC(0xFFFF), SHC(0xFFF8), SHC(0xFFF4), SHC(0xFFEF), SHC(0xFFE9), SHC(0xFFE5), SHC(0xFFE0), SHC(0xFFDB), SHC(0xFFD6), SHC(0xFFD2), SHC(0xFFCC), SHC(0xFFC7), SHC(0xFFC3), SHC(0xFFBE), SHC(0xFFB8), SHC(0xFFB4), @@ -40620,7 +40625,8 @@ const Word16 sincos_t_ext_fx[ 641 ] = { }; #endif -const Word16 fftSineTab640_fx[ 321 ] = { +const Word16 fftSineTab640_fx[ 321 ] = +{//Q15 SHC( 0x0000 ), SHC( 0x0141 ), SHC( 0x0283 ), SHC( 0x03c4 ), SHC( 0x0506 ), SHC( 0x0647 ), SHC( 0x0789 ), SHC( 0x08ca ), SHC( 0x0a0a ), SHC( 0x0b4b ), SHC( 0x0c8b ), SHC( 0x0dcb ), SHC( 0x0f0b ), SHC( 0x104a ), SHC( 0x1189 ), SHC( 0x12c8 ), SHC( 0x1406 ), SHC( 0x1543 ), SHC( 0x1680 ), SHC( 0x17bc ), SHC( 0x18f8 ), SHC( 0x1a33 ), SHC( 0x1b6e ), SHC( 0x1ca8 ), @@ -40665,7 +40671,7 @@ const Word16 fftSineTab640_fx[ 321 ] = { }; -const Word32 bwMode2fs[4] = { 8000, 16000, 32000, 48000 }; +const Word32 bwMode2fs[4] = { 8000, 16000, 32000, 48000 };//Q0 const Word16 cos_pi_by_127[128] = /* Q15 */ { @@ -40833,7 +40839,7 @@ const Word16 cos_pi_by_383[384] = /* Q15 */ -32762 ,-32765 ,-32767 }; -const Word16 swb_lsp_prev_interp_init[10] = { 32767, 31164, 26510, 19261, 10126, 0, -10126, -19261, -26510, -31164 }; +const Word16 swb_lsp_prev_interp_init[10] = { 32767, 31164, 26510, 19261, 10126, 0, -10126, -19261, -26510, -31164 };//Q15 /* st->swb_lsp_prev_interp[i] = (float)cos( (float)i * PI / (float)10.0f )*/ //ivas_sns_com_fx.c @@ -40880,9 +40886,9 @@ const Word32 pow_tilt_32k[64] = { 1029387260, 1121709444, 1222311686, 1331936594, 1451393382, 1581563835, 1723408827, 1877975405 }; -const Word16 L_frame_inv[8] = { 0x4000, 0x369D, 0x3333, 0x2D83, 0x2AAB, 0x28F6, 0, 0x2222 }; +const Word16 L_frame_inv[8] = { 0x4000, 0x369D, 0x3333, 0x2D83, 0x2AAB, 0x28F6, 0, 0x2222 }; // Q14 -const Word16 InvIntTable[65] = +const Word16 InvIntTable[65] = // Q15 { 0x7FFF, 0x7FFF, 0x4000, 0x2AAB, 0x2000, 0x199A, 0x1555, 0x1249, 0x1000, @@ -40895,7 +40901,7 @@ const Word16 InvIntTable[65] = 0x023F, 0x0235, 0x022B, 0x0222, 0x0219, 0x0211, 0x0208, 0x0200 }; -const Word16 TecLowBandTable[] = { 0, 2, 4, 6 }; +const Word16 TecLowBandTable[] = { 0, 2, 4, 6 }; //Q0 const Word16 TecSC_Fx[] = { 23999/*0.3662f*2.0f Q15*/, 7065/*0.1078f*2.0f Q15*/, 7825/*0.1194f*2.0f Q15*/, @@ -40942,7 +40948,7 @@ const Word16 sqrt_table_pitch_search[256 + 1] = /* Q11 */ }; // fft_evs.c -const Word16 RotVector_32[2 * 20] = { +const Word16 RotVector_32[2 * 20] = { // Q15 /** * \brief Twiddle factors are unscaled */ @@ -40956,7 +40962,7 @@ const Word16 RotVector_32[2 * 20] = { /** * \brief Twiddle factors are unscaled */ -const Word16 RotVector_480[2 * ( 480 - 30 )] = { +const Word16 RotVector_480[2 * ( 480 - 30 )] = { // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff5 ), SHC( 0xfca6 ), SHC( 0x7fd3 ), SHC( 0xf94d ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7ee8 ), SHC( 0xef4b ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7ddb ), SHC( 0xe8ad ), SHC( 0x7d34 ), SHC( 0xe563 ), SHC( 0x7c77 ), SHC( 0xe21e ), @@ -41072,7 +41078,7 @@ const Word16 RotVector_480[2 * ( 480 - 30 )] = { SHC( 0x30fc ), SHC( 0x7642 ), SHC( 0x471d ), SHC( 0x6a6e ), SHC( 0x5a82 ), SHC( 0x5a82 ), SHC( 0x6a6e ), SHC( 0x471d ) }; -const Word16 RotVector_600[2 * ( 600 - 30 )] = { +const Word16 RotVector_600[2 * ( 600 - 30 )] = { // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff9 ), SHC( 0xfd52 ), SHC( 0x7fe3 ), SHC( 0xfaa4 ), SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7f8d ), SHC( 0xf54a ), SHC( 0x7f4c ), SHC( 0xf29f ), SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7ea0 ), SHC( 0xed4d ), SHC( 0x7e35 ), SHC( 0xeaa7 ), SHC( 0x7dbc ), SHC( 0xe804 ), @@ -41222,7 +41228,7 @@ const Word16 RotVector_600[2 * ( 600 - 30 )] = { /** * \brief Twiddle factors are unscaled */ -const Word16 RotVector_256[2 * ( 256 - 32 )] = { +const Word16 RotVector_256[2 * ( 256 - 32 )] = { // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff6 ), SHC( 0xfcdc ), SHC( 0x7fd9 ), SHC( 0xf9b8 ), SHC( 0x7fa7 ), SHC( 0xf695 ), SHC( 0x7f62 ), SHC( 0xf374 ), SHC( 0x7f0a ), SHC( 0xf055 ), SHC( 0x7e9d ), SHC( 0xed38 ), SHC( 0x7e1e ), SHC( 0xea1e ), SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7ce4 ), SHC( 0xe3f4 ), SHC( 0x7c2a ), SHC( 0xe0e6 ), SHC( 0x7b5d ), SHC( 0xdddc ), @@ -41284,7 +41290,7 @@ const Word16 RotVector_256[2 * ( 256 - 32 )] = { /** * \brief Twiddle factors are unscaled */ -const Word16 RotVector_320[2 * ( 320 - 20 )] = { +const Word16 RotVector_320[2 * ( 320 - 20 )] = { // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fe7 ), SHC( 0xfafa ), SHC( 0x7f9b ), SHC( 0xf5f5 ), SHC( 0x7f1d ), SHC( 0xf0f5 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7d8a ), SHC( 0xe707 ), SHC( 0x7c77 ), SHC( 0xe21e ), SHC( 0x7b32 ), SHC( 0xdd41 ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x7817 ), SHC( 0xd3b2 ), SHC( 0x7642 ), SHC( 0xcf04 ), SHC( 0x743e ), SHC( 0xca69 ), @@ -41368,7 +41374,7 @@ const Word16 RotVector_320[2 * ( 320 - 20 )] = { * Rotation factor table, real and imaginary part interleaved, for dim1=20,dim2=20 */ -const Word16 RotVector_400[2 * ( 400 - 20 )] = { +const Word16 RotVector_400[2 * ( 400 - 20 )] = { // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff0 ), SHC( 0xfbfb ), SHC( 0x7fbf ), SHC( 0xf7f6 ), SHC( 0x7f6f ), SHC( 0xf3f4 ), SHC( 0x7efe ), SHC( 0xeff5 ), SHC( 0x7e6d ), SHC( 0xebfa ), SHC( 0x7dbc ), SHC( 0xe804 ), SHC( 0x7ceb ), SHC( 0xe414 ), SHC( 0x7bfb ), SHC( 0xe02b ), SHC( 0x7aeb ), SHC( 0xdc4a ), SHC( 0x79bc ), SHC( 0xd872 ), SHC( 0x786f ), SHC( 0xd4a4 ), @@ -41466,7 +41472,7 @@ const Word16 RotVector_400[2 * ( 400 - 20 )] = { SHC( 0x080a ), SHC( 0x7fbf ), SHC( 0x2d3f ), SHC( 0x77bd ), SHC( 0x4e74 ), SHC( 0x6524 ), SHC( 0x68b9 ), SHC( 0x499a ) }; -const Word16 FFT_W64[( 64 * 2 ) * 2] = { +const Word16 FFT_W64[( 64 * 2 ) * 2] = { // Q15 16384, 0, 16364, -804, 16305, -1606, 16207, -2404, 16069, -3196, 15893, -3981, 15679, -4756, 15426, -5520, 15137, -6270, 14811, -7005, 14449, -7723, 14053, -8423, @@ -41503,7 +41509,7 @@ const Word16 FFT_W64[( 64 * 2 ) * 2] = { -32138, -6393, -32413, -4808, -32610, -3212, -32729, -1608 }; -const Word16 FFT_W128[] = { +const Word16 FFT_W128[] = { // Q15 /* part of table that is not scaled by 2 */ 16384, 0, 16379, -402, 16364, -804, 16339, -1205, 16305, -1606, 16260, -2006, 16206, -2404, 16142, -2801, @@ -41572,7 +41578,7 @@ const Word16 FFT_W128[] = { -32610, -3212, -32678, -2410, -32728, -1608, -32758, -804 }; -const Word16 FFT_W256[( 256 * 2 ) * 2] = { +const Word16 FFT_W256[( 256 * 2 ) * 2] = { // Q15 /* Each adjacent pair represents the real and imaginary part of a complex number: */ /* W = exp{-j*(PI*n/256)} = cos(PI*n/256)*16384 -j*sin(PI*n/256)*16384 for n=0, 1, ..., 255. */ 16384, 0, 16383, -201, 16379, -402, 16373, -603, @@ -41708,7 +41714,7 @@ const Word16 FFT_W256[( 256 * 2 ) * 2] = { -32729, -1608, -32746, -1206, -32758, -804, -32766, -402 }; -const Word16 FFT_W512[( 512 * 2 ) * 2] = { +const Word16 FFT_W512[( 512 * 2 ) * 2] = { // Q15 16384, 0, 16384, -101, 16383, -201, 16381, -302, 16379, -402, 16376, -503, 16373, -603, 16369, -704, 16364, -804, 16359, -904, 16353, -1005, 16347, -1105, @@ -42043,19 +42049,19 @@ const Word16 Gamma_19661_Tbl_fx[] = { const Word16 Gamma_29491_Tbl[] = { 29491, 26542, 23888, 21499, 19349, 17414, 15672, 14105, 12694, 11425, 10282, 9254, 8329, 7496, 6746, 6071 -}; +}; // Q15 /*---------------------------------------------------------------------* * NB post-filter tables *---------------------------------------------------------------------*/ -const Word16 tab_hup_s_fx[SIZ_TAB_HUP_S] = { +const Word16 tab_hup_s_fx[SIZ_TAB_HUP_S] = { // Q15 -188, 2873, 31650, -1597, -484, 7041, 28469, -2147, -933, 12266, 23705, -1992, -1492, 18050, 18050, -1492, -1992, 23705, 12266, -933, -2147, 28469, 7041, -484, -1597, 31650, 2873, -188 }; -const Word16 tab_hup_l_fx[SIZ_TAB_HUP_L] = { +const Word16 tab_hup_l_fx[SIZ_TAB_HUP_L] = { // Q15 -40, 72, -156, 315, -579, 1023, -1874, 4439, 31915, -3390, 1595, -887, 501, -266, 130, -59, -77, 147, -317, 631, -1150, 2030, -3773, 9639, @@ -42072,8 +42078,8 @@ const Word16 tab_hup_l_fx[SIZ_TAB_HUP_L] = { 4439, -1874, 1023, -579, 315, -156, 72, -40 }; -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 }; +const Word16 mfreq_loc_Q2fx[] = { 700, 1500, 3100, 4700, 6300, 7900, 9500, 11100, 12700, 14300, 15900, 17500, 19100, 20700, 22300, 25500, 28700, 31900 }; // Q0 +const Word16 mfreq_loc_div_25[] = { 7, 15, 31, 47, 63, 79, 95, 111, 127, 143, 159, 175, 191, 207, 223, 255, 287, 319 }; // Q0 // low_rate_band_att_fx.c /* %* lowered Table ROM, call with band_len_idx[sfm_size>>3] */ @@ -42082,25 +42088,26 @@ const Word16 mfreq_loc_div_25[] = { 7, 15, 31, 47, 63, 79, 95, 111, 127, 143, 15 /* % idx= 0 1 2 3 4 5 6 7; */ /* call with band_len_idx[sfm_size>>3] */ const Word16 band_len_idx[1 + ( MAX_SFM_LEN_FX / 8 )] = { + // Q0 /*sfm/8*/ /*1*/ /*2 */ /*3 */ /*4 */ /*6 */ /*8 */ /*10*/ /*12*/ -1, 0 /*8*/, 1 /*16*/, 2 /*24*/, 3 /*32*/, -1, 4 /*48 */, -1, 5 /*64 */, -1, 6 /*80*/, -1, 7 /*96*/ }; -const Word16 band_len_ener_shift[8] = { 1, 2, 2, 2, 3, 3, 4 /*sfm==80*/, 4 /*sfm==96*/ }; /* 96 requires 1 bit more than 48 */ +const Word16 band_len_ener_shift[8] = { 1, 2, 2, 2, 3, 3, 4 /*sfm==80*/, 4 /*sfm==96*/ }; /* 96 requires 1 bit more than 48 */ // Q0 /*% sfms=[8,16,24,32,48,64,80,96], round(sqrt(sfms)*2^11) */ const Word16 fine_gain_pred_sqrt_bw[8] = { 5793, 8192, 10033, 11585, 14189, 16384, 18318, 20066 }; /* (Q11) */ #ifdef IVAS_FLOAT_FIXED const Word16 ivas_band_len_idx[1 + ( MAX_SFM_LEN_FX / 8 )] = { - /*sfm/8*/ /*1*/ /*2 */ /*3 */ /*4 */ /*6 */ /*8 */ /*10*/ /*12*/ - -1, 0 /*8*/, 1 /*16*/, 2 /*24*/, 3 /*32*/, 4 /*40*/, 5 /*48 */, -1, 6 /*64 */, -1, 7 /*80*/, -1, 8 /*96*/ -}; -const Word16 ivas_band_len_ener_shift[9] = { 1, 2, 2, 2, 3, 3, 3, 4 /*sfm==80*/, 4 /*sfm==96*/ }; /* 96 requires 1 bit more than 48 */ + /*sfm/8*/ /*1*/ /*2 */ /*3 */ /*4 */ /*6 */ /*8 */ /*10*/ /*12*/ + -1, 0 /*8*/, 1 /*16*/, 2 /*24*/, 3 /*32*/, 4 /*40*/, 5 /*48 */, -1, 6 /*64 */, -1, 7 /*80*/, -1, 8 /*96*/ +}; // Q0 +const Word16 ivas_band_len_ener_shift[9] = { 1, 2, 2, 2, 3, 3, 3, 4 /*sfm==80*/, 4 /*sfm==96*/ }; // Q0 /* 96 requires 1 bit more than 48 */ const Word16 ivas_fine_gain_pred_sqrt_bw[9] = { 5793, 8192, 10033, 11585, 12953, 14189, 16384, 18318, 20066 }; /* (Q11) */ /*% sfms=[8,16,24,32,40,48,64,80,96], round(sqrt(sfms)*2^11) */ #endif /*----------------------------------------------------------------------------------* * means of ISFs for WB active speech *----------------------------------------------------------------------------------*/ -const Word16 Mean_isf_wb[M] = /* G722.2 active speech ISF's means */ +const Word16 Mean_isf_wb[M] = /* G722.2 active speech ISF's means Q2.56*/ { 738, 1326, 2336, 3578, 4596, 5662, 6711, 7730, 8750, 9753, 10705, 11728, 12833, 13971, 15043, 4037 @@ -42144,7 +42151,7 @@ const Word16 tab_ari_qnew[4][4] = { { 0x0000, 0x0CCC, 0x0CCC, 0x0CCC }, { 0x0BBB, 0x2000, 0x4000, 0x0CCC }, { 0x0BBB, 0x0BBB, 0x4000, 0x4000 } }; -const Word16 phs_tbl_dec[64 * 2] = { +const Word16 phs_tbl_dec[64 * 2] = { // Q15 /* part of table that is not scaled by 2 */ 16384, 0, 16305, -1606, 16069, -3196, 15678, -4756, 15136, -6270, 14449, -7723, 13622, -9102, 12665, -10394, 11585, -11585, 10394, -12665, @@ -42164,7 +42171,7 @@ const Word16 phs_tbl_dec[64 * 2] = { }; /* 2.0 - 6.4 kHz phase dispersion */ -const Word16 Low_H_phasedisp[L_SUBFR] = { +const Word16 Low_H_phasedisp[L_SUBFR] = { // Q15 16389, 16381, 16386, 16382, 16382, 16383, 16381, 16384, 16385, 10265, 10154, 9894, 14052, 16343, -531, 13216, 16373, 15510, 9407, 15949, 4726, 14593, 10404, 9796, -16336, -1815, -10623, 12647, 14556, -12683, @@ -42175,7 +42182,7 @@ const Word16 Low_H_phasedisp[L_SUBFR] = { }; /* 3.2 - 6.4 kHz phase dispersion */ -const Word16 Mid_H_phasedisp[L_SUBFR] = { +const Word16 Mid_H_phasedisp[L_SUBFR] = { // Q15 16382, 16382, 16384, 16385, 16386, 16388, 16387, 16383, 16387, 16383, 16386, 16386, 16386, 16384, 16382, 16388, 14847, 9629, 13249, 14487, 10995, 643, 13818, 13779, 6468, 8665, 11634, 9781, -14636, -982, @@ -42189,10 +42196,10 @@ const Word16 Mid_H_phasedisp[L_SUBFR] = { const Word16 Tab_esc_nb[4] = { 0 << ( NBITS_CONTEXT + NBITS_RATEQ ), 1 << ( NBITS_CONTEXT + NBITS_RATEQ ), 2 << ( NBITS_CONTEXT + NBITS_RATEQ ), - 3 << ( NBITS_CONTEXT + NBITS_RATEQ ) }; + 3 << ( NBITS_CONTEXT + NBITS_RATEQ ) }; // Q0 -const Word16 pow2tab[15] = { 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; -const Word32 pow2[] = { +const Word16 pow2tab[15] = { 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; // Q0 +const Word32 pow2[] = { // Q0 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576 }; // d_gain2p.c @@ -42256,7 +42263,7 @@ const Word16 num_nelp_lp_fx[NELP_LP_ORDER + 1] = /*Q13*/ 726 }; -const Word16 den_nelp_lp_fx[NELP_LP_ORDER + 1] = { +const Word16 den_nelp_lp_fx[NELP_LP_ORDER + 1] = { // Q13 8192, 8819, 21618, @@ -42271,7 +42278,7 @@ const Word16 den_nelp_lp_fx[NELP_LP_ORDER + 1] = { /*----------------------------------------------------------------------------------* * AMR-WB IO WB BWE - band-pass 6-8kHz FIR filter, values in Q15: *----------------------------------------------------------------------------------*/ -const Word16 fir_6k_8k_fx[31] = { +const Word16 fir_6k_8k_fx[31] = { // Q15 44, -155, 323, -482, 563, -590, 726, -1180, 1986, -2818, 3028, -1991, -423, 3583, -6281, 7342, -6281, 3583, -423, -1991, 3028, -2818, 1986, -1180, 726, -590, 563, -482, 323, -155, 44 @@ -42285,7 +42292,7 @@ const Word16 pwf78_fx[17] = { 25559, 19936, 15550, 12129, 9460, 7379, 5755, 4489 * lag window for windowing the autocorrelations in LP analysis * Used in lib_enc\analy_lp_fx.c *------------------------------------------------------------------------------*/ -const Word16 hamcos_window_fx[L_LP_AMR_WB] = { +const Word16 hamcos_window_fx[L_LP_AMR_WB] = { // Q15 2621, 2622, 2626, 2632, 2640, 2650, 2662, 2677, 2694, 2714, 2735, 2759, 2785, 2814, 2844, 2877, 2912, 2949, 2989, 3031, 3075, 3121, 3169, 3220, @@ -42337,7 +42344,7 @@ const Word16 hamcos_window_fx[L_LP_AMR_WB] = { }; -const Word16 CNG_burst_att_fx[6][8] = { +const Word16 CNG_burst_att_fx[6][8] = { // Q15 { 30076, 27793, 25832, 24129, 22637, 21319, 20146, 19095 }, { 29714, 27181, 25046, 23222, 21646, 20270, 20205, 20205 }, { 29415, 26685, 24418, 22506, 22410, 22410, 22410, 22410 }, @@ -42346,7 +42353,7 @@ const Word16 CNG_burst_att_fx[6][8] = { { 29789, 27307, 25206, 23406, 21845, 20480, 19661, 19661 } }; -const Word16 lpc_weights_fx[LPC_SHB_ORDER + 1] = { +const Word16 lpc_weights_fx[LPC_SHB_ORDER + 1] = { // Q15 32767, 31948, 31150, 30371, 29612, 28871, 28149, 27446, 26760, 26091, 25438 }; @@ -42521,7 +42528,7 @@ const Word16 E_ROM_inter6_1_fx[PIT_UP_SAMP6 * L_INTERPOL1 + 1] = { -108 /*-0.00656128F Q14*/, 0 /*0.000000F Q14*/ }; -const Word16 kLog2TableFrac_x[256] = { +const Word16 kLog2TableFrac_x[256] = { // Q8 0, 1, 3, 4, 6, 7, 9, 10, 11, 13, 14, 16, 17, 18, 20, 21, 22, 24, 25, 26, 28, 29, 30, 32, @@ -42608,7 +42615,7 @@ const Word16 One_div_fx[] = /* in Q15 */ 4096 /* 1/8 */ }; -const Word32 tbl_two_pow_shift_by_4[35] = { +const Word32 tbl_two_pow_shift_by_4[35] = { // Q30 1073741824, 902905664, 759250112, 638450688, 536870912, 451452832, 379625056, 319225344, 268435456, 225726416, 189812528, 159612672, 134217728, 112863208, 94906264, 79806336, 67108864, 56431604, 47453132, 39903168, 33554432, 28215802, 23726566, 19951584, @@ -42617,7 +42624,7 @@ const Word32 tbl_two_pow_shift_by_4[35] = { }; -const Word16 ivas_tan_panning_gain_tbl_fx[601] = { +const Word16 ivas_tan_panning_gain_tbl_fx[601] = { // Q15 SHC( 0x0000 ), SHC( 0x0042 ), SHC( 0x0084 ), SHC( 0x00c6 ), SHC( 0x0109 ), SHC( 0x014b ), SHC( 0x018e ), SHC( 0x01d1 ), SHC( 0x0214 ), SHC( 0x0257 ), SHC( 0x029b ), SHC( 0x02de ), SHC( 0x0322 ), SHC( 0x0365 ), SHC( 0x03a9 ), SHC( 0x03ed ), SHC( 0x0431 ), SHC( 0x0475 ), SHC( 0x04ba ), SHC( 0x04fe ), SHC( 0x0543 ), SHC( 0x0588 ), SHC( 0x05cd ), SHC( 0x0612 ), @@ -42696,7 +42703,7 @@ const Word16 ivas_tan_panning_gain_tbl_fx[601] = { SHC( 0x7fff ) }; -const Word16 ivas_sine_panning_tbl_fx[601] = { +const Word16 ivas_sine_panning_tbl_fx[601] = { // Q15 SHC( 0xc001 ), SHC( 0xc032 ), SHC( 0xc064 ), SHC( 0xc095 ), SHC( 0xc0c7 ), SHC( 0xc0f9 ), SHC( 0xc12b ), SHC( 0xc15c ), SHC( 0xc18e ), SHC( 0xc1c0 ), SHC( 0xc1f2 ), SHC( 0xc224 ), SHC( 0xc256 ), SHC( 0xc289 ), SHC( 0xc2bb ), SHC( 0xc2ed ), SHC( 0xc31f ), SHC( 0xc352 ), SHC( 0xc384 ), SHC( 0xc3b6 ), SHC( 0xc3e9 ), SHC( 0xc41b ), SHC( 0xc44e ), SHC( 0xc481 ), @@ -42775,7 +42782,7 @@ const Word16 ivas_sine_panning_tbl_fx[601] = { SHC( 0x3fff ) }; -const Word16 ivas_sin_az_fx[361] = { +const Word16 ivas_sin_az_fx[361] = { // Q15 SHC( 0x0000 ), SHC( 0xfdc5 ), SHC( 0xfb89 ), SHC( 0xf94e ), SHC( 0xf713 ), SHC( 0xf4d9 ), SHC( 0xf29f ), SHC( 0xf067 ), SHC( 0xee30 ), SHC( 0xebfa ), SHC( 0xe9c6 ), SHC( 0xe794 ), SHC( 0xe564 ), SHC( 0xe335 ), SHC( 0xe109 ), SHC( 0xdee0 ), SHC( 0xdcb8 ), SHC( 0xda94 ), SHC( 0xd873 ), SHC( 0xd654 ), SHC( 0xd439 ), SHC( 0xd221 ), SHC( 0xd00d ), SHC( 0xcdfd ), @@ -44210,7 +44217,7 @@ const Word16 cos_scale_tbl_800[800] = { /* Q15 */ }; #endif // IVAS_FLOAT_FIXED -const Word16 scales_ivas_fx[][MAX_NO_SCALES * 2] = /* 2 subvectors */ +const Word16 scales_ivas_fx[][MAX_NO_SCALES * 2] = /* 2 subvectors Q11*/ { { 3129, diff --git a/lib_com/rom_com.h b/lib_com/rom_com.h index 9035c3144..833ae46b6 100644 --- a/lib_com/rom_com.h +++ b/lib_com/rom_com.h @@ -75,9 +75,9 @@ typedef struct typedef struct { - int16_t bands; - int16_t bw; - const int16_t *band_width; + Word16 bands; // Q0 + Word16 bw; // Q0 + const Word16 *band_width; // Q0 Word32 L_qint; Word16 eref_fx; @@ -86,9 +86,9 @@ typedef struct Word16 bit_alloc_weight_fx; Word16 bit_alloc_weight; - int16_t gqlevs; - int16_t Ngq; - int16_t p2a_bands; + Word16 gqlevs; // Q0 + Word16 Ngq; // Q0 + Word16 p2a_bands; // Q0 float p2a_th_float; Word16 p2a_th; @@ -107,119 +107,119 @@ typedef struct } Xcore_Config; -extern const Word16 filter_LP15_180H_fx[]; /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/15, hann( N )' */ -extern const Word16 filter_LP3_90H_fx[]; /* Sincfilt.m: N=90*2+1, Fmin=0, Fmax=1/3, hann( N )' */ -extern const Word16 filter_LP12_180H_13b_fx[]; /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/12, hann( N )' */ -extern const Word16 filter_LP15_180H_13b_fx[]; /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/15, hann( N )' */ -extern const Word16 filter_LP15_360H_13b_fx[]; /* Sincfilt.m: N=360*2+1, Fmin=0, Fmax=1/15, hann( N )' */ -extern const Word16 filter_LP24_90H_13b_fx[]; -extern const Word16 filter_LP24_90H_fx[]; +extern const Word16 filter_LP15_180H_fx[]; // Q14 /* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/15, hann( N )' */ +extern const Word16 filter_LP3_90H_fx[]; // Q14 /* Sincfilt.m: N=90*2+1, Fmin=0, Fmax=1/3, hann( N )' */ +extern const Word16 filter_LP12_180H_13b_fx[]; // Q13/* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/12, hann( N )' */ +extern const Word16 filter_LP15_180H_13b_fx[]; // Q13/* Sincfilt.m: N=180*2+1, Fmin=0, Fmax=1/15, hann( N )' */ +extern const Word16 filter_LP15_360H_13b_fx[]; // Q13/* Sincfilt.m: N=360*2+1, Fmin=0, Fmax=1/15, hann( N )' */ +extern const Word16 filter_LP24_90H_13b_fx[]; // Q13 +extern const Word16 filter_LP24_90H_fx[]; // Q14 /*-----------------------------------------------------------------* * Table of bitrates *-----------------------------------------------------------------*/ -extern const int32_t brate_tbl[SIZE_BRATE_TBL]; -extern const int32_t brate_intermed_tbl[]; -extern const int32_t acelp_sig_tbl[MAX_ACELP_SIG]; +extern const Word32 brate_tbl[SIZE_BRATE_TBL]; // Q0 +extern const Word32 brate_intermed_tbl[]; // Q0 +extern const Word32 acelp_sig_tbl[MAX_ACELP_SIG]; // Q0 /*-----------------------------------------------------------------* * Bit-allocation tables *-----------------------------------------------------------------*/ -extern const int16_t LSF_bits_tbl[]; /* Bit allocation table for end-frame ISF quantizer */ -extern const int16_t mid_LSF_bits_tbl[]; /* Bit allocation table for mid-frame ISF quantizer */ -extern const int16_t Es_pred_bits_tbl[]; /* Bit allocation table for scaled innovation energy prediction */ -extern const int16_t gain_bits_tbl[]; /* Bit allocation table for gain quantizer */ +extern const Word16 LSF_bits_tbl[]; /* Bit allocation table for end-frame ISF quantizer Q0*/ +extern const Word16 mid_LSF_bits_tbl[]; /* Bit allocation table for mid-frame ISF quantizer Q0*/ +extern const Word16 Es_pred_bits_tbl[]; /* Bit allocation table for scaled innovation energy prediction Q0*/ +extern const Word16 gain_bits_tbl[]; /* Bit allocation table for gain quantizer Q0*/ -extern const int16_t ACB_bits_tbl[]; /* Bit allocation table for adaptive codebook (pitch) */ -extern const int16_t FCB_bits_tbl[]; /* Bit allocation table for algebraic (fixed) codebook (innovation) */ -extern const int16_t reserved_bits_tbl[]; /* Bit allocation table for reseved bits */ +extern const Word16 ACB_bits_tbl[]; /* Bit allocation table for adaptive codebook (pitch) Q0*/ +extern const Word16 FCB_bits_tbl[]; /* Bit allocation table for algebraic (fixed) codebook (innovation) Q0*/ +extern const Word16 reserved_bits_tbl[]; /* Bit allocation table for reseved bits Q0*/ -extern const int16_t ACB_bits_16kHz_tbl[]; /* Bit allocation table for adaptive codebook (pitch) @16kHz */ -extern const int16_t FCB_bits_16kHz_tbl[]; /* Bit allocation table for algebraic (fixed) codebook (innovation) @16kHz */ -extern const int16_t gain_bits_16kHz_tbl[]; /* Bit allocation table for gain quantizer @16kHz */ -extern const int16_t AVQ_bits_16kHz_tbl[]; /* Bit allocation table for AVQ bits @16kHz ACELP, active segments */ +extern const Word16 ACB_bits_16kHz_tbl[]; /* Bit allocation table for adaptive codebook (pitch) @16kHz Q0*/ +extern const Word16 FCB_bits_16kHz_tbl[]; /* Bit allocation table for algebraic (fixed) codebook (innovation) @16kHz Q0*/ +extern const Word16 gain_bits_16kHz_tbl[]; /* Bit allocation table for gain quantizer @16kHz Q0*/ +extern const Word16 AVQ_bits_16kHz_tbl[]; /* Bit allocation table for AVQ bits @16kHz ACELP, active segments Q0*/ -extern const uint32_t pulsestostates[17][9]; /* Number of states for any combination of pulses in any combination of vector length */ +extern const UWord32 pulsestostates[17][9]; /* Number of states for any combination of pulses in any combination of vector length Q0*/ -extern const uint8_t ACELP_NRG_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX + RF_MODE_MAX]; -extern const uint8_t ACELP_NRG_BITS[3]; +extern const UWord8 ACELP_NRG_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX + RF_MODE_MAX]; // Q0 +extern const UWord8 ACELP_NRG_BITS[3]; // Q0 -extern const uint8_t ACELP_LTP_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX + RF_MODE_MAX]; -extern const uint8_t ACELP_LTP_BITS[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX + RF_MODE_MAX]; -extern const uint8_t ACELP_LTP_BITS_SFR[8 + RF_MODE_MAX][5]; +extern const UWord8 ACELP_LTP_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX + RF_MODE_MAX]; // Q0 +extern const UWord8 ACELP_LTP_BITS[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX + RF_MODE_MAX]; // Q0 +extern const UWord8 ACELP_LTP_BITS_SFR[8 + RF_MODE_MAX][5]; // Q0 -extern const uint8_t ACELP_LTF_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX + RF_MODE_MAX]; -extern const uint8_t ACELP_LTF_BITS[4]; +extern const UWord8 ACELP_LTF_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX + RF_MODE_MAX]; // Q0 +extern const UWord8 ACELP_LTF_BITS[4]; // Q0 -extern const uint8_t ACELP_GAINS_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX + RF_MODE_MAX]; -extern const uint8_t ACELP_GAINS_BITS[10]; +extern const UWord8 ACELP_GAINS_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX + RF_MODE_MAX]; // Q0 +extern const UWord8 ACELP_GAINS_BITS[10]; // Q0 -extern const uint8_t ACELP_BPF_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX + RF_MODE_MAX]; -extern const uint8_t ACELP_BPF_BITS[3]; -extern const Word16 ACELP_CDK_BITS[]; +extern const UWord8 ACELP_BPF_MODE[RATE_MODE_MAX][BANDWIDTH_MODE_MAX][ACELP_MODE_MAX + RF_MODE_MAX]; // Q0 +extern const UWord8 ACELP_BPF_BITS[3]; // Q0 +extern const Word16 ACELP_CDK_BITS[]; // Q0 /*----------------------------------------------------------------------------------* * Pre-processing *----------------------------------------------------------------------------------*/ -extern const float inv_tbl[]; /* Table of 1/x values */ -extern const Word16 inv_tbl_fx[]; +extern const float inv_tbl[]; /* Table of 1/x values */ +extern const Word16 inv_tbl_fx[]; // Q15 -extern const Word16 hvq_bwe_fac_fx[16]; -extern const Word16 sqac_headroom_fx[146]; -extern const Word16 inv_N_fx[32]; -extern const Word16 band_len_harm[]; +extern const Word16 hvq_bwe_fac_fx[16]; // Q15 +extern const Word16 sqac_headroom_fx[146]; // Q0 +extern const Word16 inv_N_fx[32]; // Q15 +extern const Word16 band_len_harm[]; // Q0 /* PVQ tables */ -extern const Word32 thren_fx[39]; +extern const Word32 thren_fx[39]; // Q8 /* Band structure */ -extern const Word16 dicnlg2[40]; +extern const Word16 dicnlg2[40]; // Q0 extern const Resampling_cfg resampling_cfg_tbl[]; /* table of resampling configurations */ extern const FrameSizeParams FrameSizeConfig[FRAME_SIZE_NB]; -extern const float h_high[]; /* HP filter for filtering random part of excitation in FEC */ -extern const Word16 h_high_fx[5]; +extern const float h_high[]; /* HP filter for filtering random part of excitation in FEC */ +extern const Word16 h_high_fx[5]; // Q15 #ifdef IVAS_FLOAT_FIXED extern const Word32 crit_bands_fx[]; -#endif // IVAS_FLOAT_FIXED -extern const float crit_bands[]; /* Table of critical bands */ -extern const float sincos_t[]; /* FFT - sinus and cosinus tables */ -extern const Word16 sincos_t_fx[161]; +#endif // IVAS_FLOAT_FIXED +extern const float crit_bands[]; /* Table of critical bands */ +extern const float sincos_t[]; /* FFT - sinus and cosinus tables */ +extern const Word16 sincos_t_fx[161]; // Q15 extern const float sincos_t_ext[]; -extern const Word16 sincos_t_ext_fx[]; +extern const Word16 sincos_t_ext_fx[]; // Q15 extern const float sincos_t_rad3[]; -extern const Word16 sincos_t_rad3_fx[]; -extern const Word16 fft256_read_indexes[]; /* FFT */ +extern const Word16 sincos_t_rad3_fx[]; // Q15 +extern const Word16 fft256_read_indexes[]; /* FFT Q0*/ extern const float inter4_2[]; /* 1/4 resolution interpolation filter */ -extern const Word16 inter4_2_fx_Q15[]; /* 1/4 resolution interpolation filter */ +extern const Word16 inter4_2_fx_Q15[]; // Q15 /* 1/4 resolution interpolation filter */ extern const Word16 inter4_2_fx[]; extern const Word16 pitch_inter4_1[UP_SAMP * L_INTERPOL1 + 1]; /*1Q14*/ extern const Word16 pitch_inter4_2[PIT_FIR_SIZE2]; /*1Q14*/ extern const float LP_assym_window[]; /* Assymetric window for LP analysis @12.8kHz */ extern const float LP_assym_window_16k[]; /* Assymetric window for LP analysis @16kHz */ -extern const Word16 Assym_window_W16fx[]; -extern const Word16 assym_window_16k_fx[]; -extern const float hamcos_window[]; /* Hamming-Cosinus window */ -extern const float grid50[]; /* Table of grid points for evaluating Chebyshev polynomials */ -extern const float grid40[]; /* Table of grid points for evaluating Chebyshev polynomials */ +extern const Word16 Assym_window_W16fx[]; // Q15 +extern const Word16 assym_window_16k_fx[]; // Q15 +extern const float hamcos_window[]; /* Hamming-Cosinus window */ +extern const float grid50[]; /* Table of grid points for evaluating Chebyshev polynomials */ +extern const float grid40[]; /* Table of grid points for evaluating Chebyshev polynomials */ #ifdef IVAS_FLOAT_FIXED -extern const Word16 grid50_fx[( GRID50_POINTS - 1 ) / 2 - 1]; -extern const Word16 grid40_fx[( GRID40_POINTS - 1 ) / 2 - 1]; -extern const Word32 crit_bands_fx[]; /* Table of critical bands */ +extern const Word16 grid50_fx[( GRID50_POINTS - 1 ) / 2 - 1]; // Q15 +extern const Word16 grid40_fx[( GRID40_POINTS - 1 ) / 2 - 1]; // Q15 +extern const Word32 crit_bands_fx[]; /* Table of critical bands Q0*/ #endif extern const float grid100[]; /* Table of 100 grid points for evaluating Chebyshev polynomials */ extern const float wind_sss[LEN_WIN_SSS]; /* window for modify_sf ana */ -extern const Word16 wind_sss_fx[LEN_WIN_SSS]; /*window for modify_sf ana*/ +extern const Word16 wind_sss_fx[LEN_WIN_SSS]; // Q15 /*window for modify_sf ana*/ extern const float filter5_39s320_120[]; /* LP FIR filter for 8kHz signal resampling */ -extern const Word16 filter5_39s320_120_fx[]; +extern const Word16 filter5_39s320_120_fx[]; // Q15 extern const float lag_window_8k_flt[17]; extern const float lag_window_12k8_flt[][17]; @@ -227,62 +227,62 @@ extern const float lag_window_16k_flt[][17]; extern const float lag_window_25k6_flt[][17]; extern const float lag_window_32k_flt[][17]; extern const float lag_window_48k_flt[17]; -extern const Word16 lag_window_8k[2][16]; -extern const Word16 lag_window_12k8[NUM_LAGW_STRENGTHS][2][16]; -extern const Word16 lag_window_16k[NUM_LAGW_STRENGTHS][2][16]; -extern const Word16 lag_window_25k6[NUM_LAGW_STRENGTHS][2][16]; -extern const Word16 lag_window_32k[NUM_LAGW_STRENGTHS][2][16]; -extern const Word16 lag_window_48k[2][16]; - -extern const Word32 lag_window_8k_32[16]; -extern const Word32 lag_window_12k8_32[NUM_LAGW_STRENGTHS][16]; -extern const Word32 lag_window_16k_32[NUM_LAGW_STRENGTHS][16]; -extern const Word32 lag_window_25k6_32[NUM_LAGW_STRENGTHS][16]; -extern const Word32 lag_window_32k_32[NUM_LAGW_STRENGTHS][16]; -extern const Word32 lag_window_48k_32[16]; -extern const float interpol_frac2[]; /* LPC interpolation coefficients for two-subframe mode */ -extern const float interpol_frac2_mid[]; /* LPC interpolation coefficients with mid-ISFs for two-subframe mode */ -extern const float interpol_frac_12k8[]; /* LPC interpolation coefficients */ -extern const Word16 interpol_frac2_fx[]; /* LPC interpolation coefficients for two-subframe mode */ -extern const Word16 interpol_frac2_mid_fx[]; /* LPC interpolation coefficients with mid-ISFs for two-subframe mode */ -extern const Word16 interpol_frac_12k8_fx[]; /* LPC interpolation coefficients */ -extern const Word16 interpol_frac_fx[NB_SUBFR]; -extern const float interpol_isp_amr_wb[]; /* LPC interpolation coefficients for AMR-WB interoperable mode */ - -extern const Word16 interpol_isp_amr_wb_fx[]; - -extern const float interpol_frac_16k[]; /* LPC interpolation coefficients @ 16kHz */ -extern const Word16 interpol_frac_16k_fx[NB_SUBFR16k]; -extern const float interpol_frac_mid[]; /* LPC interpolation coefficients with mid-ISFs */ -extern const Word16 interpol_frac_mid_fx[NB_SUBFR * 3]; -extern const float interpol_frac_mid_16k[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz */ -extern const Word16 interpol_frac_mid_16k_fx[NB_SUBFR16k * 3]; -extern const float interpol_frac_mid_relaxprev_12k8[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz - relaxed prev frame interp */ -extern const Word16 interpol_frac_mid_relaxprev_12k8_fx[NB_SUBFR * 3]; -extern const float interpol_frac_mid_FEC[]; /* LPC interpolation coefficients with mid-ISFs - FEC */ -extern const Word16 interpol_frac_mid_FEC_fx[NB_SUBFR * 3]; -extern const float interpol_frac_mid_relaxprev_16k[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz - relaxed prev frame interp */ -extern const Word16 interpol_frac_mid_relaxprev_16k_fx[NB_SUBFR16k * 3]; -extern const float interpol_frac_mid_16k_FEC[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz - FEC */ -extern const Word16 interpol_frac_mid_16k_FEC_fx[NB_SUBFR16k * 3]; +extern const Word16 lag_window_8k[2][16]; // Q15 +extern const Word16 lag_window_12k8[NUM_LAGW_STRENGTHS][2][16]; // Q15 +extern const Word16 lag_window_16k[NUM_LAGW_STRENGTHS][2][16]; // Q15 +extern const Word16 lag_window_25k6[NUM_LAGW_STRENGTHS][2][16]; // Q15 +extern const Word16 lag_window_32k[NUM_LAGW_STRENGTHS][2][16]; // Q15 +extern const Word16 lag_window_48k[2][16]; // Q15 + +extern const Word32 lag_window_8k_32[16]; // Q31 +extern const Word32 lag_window_12k8_32[NUM_LAGW_STRENGTHS][16]; // Q31 +extern const Word32 lag_window_16k_32[NUM_LAGW_STRENGTHS][16]; // Q31 +extern const Word32 lag_window_25k6_32[NUM_LAGW_STRENGTHS][16]; // Q31 +extern const Word32 lag_window_32k_32[NUM_LAGW_STRENGTHS][16]; // Q31 +extern const Word32 lag_window_48k_32[16]; // Q31 +extern const float interpol_frac2[]; /* LPC interpolation coefficients for two-subframe mode */ +extern const float interpol_frac2_mid[]; /* LPC interpolation coefficients with mid-ISFs for two-subframe mode */ +extern const float interpol_frac_12k8[]; /* LPC interpolation coefficients */ +extern const Word16 interpol_frac2_fx[]; // Q15 /* LPC interpolation coefficients for two-subframe mode */ +extern const Word16 interpol_frac2_mid_fx[]; // Q15 /* LPC interpolation coefficients with mid-ISFs for two-subframe mode */ +extern const Word16 interpol_frac_12k8_fx[]; // Q15 /* LPC interpolation coefficients */ +extern const Word16 interpol_frac_fx[NB_SUBFR]; // Q15 +extern const float interpol_isp_amr_wb[]; /* LPC interpolation coefficients for AMR-WB interoperable mode */ + +extern const Word16 interpol_isp_amr_wb_fx[]; // Q15 + +extern const float interpol_frac_16k[]; /* LPC interpolation coefficients @ 16kHz */ +extern const Word16 interpol_frac_16k_fx[NB_SUBFR16k]; // Q15 +extern const float interpol_frac_mid[]; /* LPC interpolation coefficients with mid-ISFs */ +extern const Word16 interpol_frac_mid_fx[NB_SUBFR * 3]; // Q15 +extern const float interpol_frac_mid_16k[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz */ +extern const Word16 interpol_frac_mid_16k_fx[NB_SUBFR16k * 3]; // Q15 +extern const float interpol_frac_mid_relaxprev_12k8[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz - relaxed prev frame interp */ +extern const Word16 interpol_frac_mid_relaxprev_12k8_fx[NB_SUBFR * 3]; // Q15 +extern const float interpol_frac_mid_FEC[]; /* LPC interpolation coefficients with mid-ISFs - FEC */ +extern const Word16 interpol_frac_mid_FEC_fx[NB_SUBFR * 3]; // Q15 +extern const float interpol_frac_mid_relaxprev_16k[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz - relaxed prev frame interp */ +extern const Word16 interpol_frac_mid_relaxprev_16k_fx[NB_SUBFR16k * 3]; // Q15 +extern const float interpol_frac_mid_16k_FEC[]; /* LPC interpolation coefficients with mid-ISFs @ 16kHz - FEC */ +extern const Word16 interpol_frac_mid_16k_FEC_fx[NB_SUBFR16k * 3]; // Q15 extern const float interpol_frac_mid_relaxprev_pred_12k8[]; -extern const Word16 interpol_frac_mid_relaxprev_pred_12k8_fx[NB_SUBFR * 3]; +extern const Word16 interpol_frac_mid_relaxprev_pred_12k8_fx[NB_SUBFR * 3]; // Q15 extern const float interpol_frac_mid_relaxprev_pred_16k[]; -extern const Word16 interpol_frac_mid_relaxprev_pred_16k_fx[NB_SUBFR16k * 3]; +extern const Word16 interpol_frac_mid_relaxprev_pred_16k_fx[NB_SUBFR16k * 3]; // Q15 extern const float inter6_2[PIT_FIR_SIZE6_2]; extern const Word16 pitch_inter6_2[PIT_FIR_SIZE6_2]; /*1Q14*/ extern const float inter4_2tcx2_flt[4][4]; extern const float inter6_2tcx2_flt[6][4]; -extern const Word16 inter4_2tcx2[4][4]; -extern const Word16 inter6_2tcx2[6][4]; +extern const Word16 inter4_2tcx2[4][4]; // Q15 +extern const Word16 inter6_2tcx2[6][4]; // Q15 typedef struct TCX_LTP_FILTER_FLT { const float *filt; int16_t length; } TCX_LTP_FILTER_FLT; -extern const TCX_LTP_FILTER_FLT tcxLtpFilters_flt[12]; +extern const TCX_LTP_FILTER_FLT tcxLtpFilters_flt[12]; // Q15 typedef struct TCX_LTP_FILTER { const Word16 *filt; @@ -292,37 +292,37 @@ extern const TCX_LTP_FILTER tcxLtpFilters[12]; extern const float gain_qua_mless_7b[]; /* Gain quantization - gain quantization table */ extern const float gain_qua_mless_6b_stereo[]; /* Gain quantization - gain quantization table in IVAS */ -extern const Word16 gain_qua_mless_6b_stereo_fx[]; /* Gain quantization - gain quantization table in IVAS */ +extern const Word16 gain_qua_mless_6b_stereo_fx[]; // Q14 /* Gain quantization - gain quantization table in IVAS */ extern const float gain_qua_mless_6b[]; /* Gain quantization - gain quantization table */ extern const float gain_qua_mless_5b[]; /* Gain quantization - gain quantization table */ -extern const Word16 gain_qua_mless_7b_fx[]; -extern const Word16 gain_qua_mless_6b_fx[]; -extern const Word16 gain_qua_mless_5b_fx[]; - -extern const float pred_gain[]; /* Gain quantization - MA predicition coefficients for gain quantizer */ -extern const float t_qua_gain6b[]; /* Gain quantization - gain quantization table for AMR-WB interoperable mode */ -extern const float t_qua_gain7b[]; /* Gain quantization - gain quantization table for AMR-WB interoperable mode */ -extern const Word16 pred_gain_fx[GAIN_PRED_ORDER]; -extern const Word16 t_qua_gain6b_fx[64 * 2]; -extern const Word16 t_qua_gain7b_fx[128 * 2]; - -extern const float Es_pred_qua_5b[]; /* Gain quantization - quantization table for scaled innovation energy prediciton */ -extern const float Es_pred_qua_4b[]; /* Gain quantization - quantization table for scaled innovation energy prediciton */ -extern const float Es_pred_qua_3b[]; /* Gain quantization - quantization table for scaled innovation energy prediciton */ -extern const float Es_pred_qua_4b_no_ltp[]; /* Gain quantization - quantization table for scaled innovation energy prediciton */ -extern const Word16 Es_pred_qua_5b_fx[32]; -extern const Word16 Es_pred_qua_4b_fx[16]; -extern const Word16 Es_pred_qua_3b_fx[8]; -extern const Word16 Es_pred_qua_4b_no_ltp_fx[16]; - -extern const float b_1sfr[]; /* Gain quantization - gain estimation constants for gain quantizer at 7.2 and 8.0 kbps */ -extern const float b_2sfr[]; /* Gain quantization - gain estimation constants for gain quantizer at 7.2 and 8.0 kbps */ -extern const float b_3sfr[]; /* Gain quantization - gain estimation constants for gain quantizer at 7.2 and 8.0 kbps */ -extern const float b_4sfr[]; /* Gain quantization - gain estimation constants for gain quantizer at 7.2 and 8.0 kbps */ -extern const Word16 b_1sfr_fx[]; -extern const Word16 b_2sfr_fx[]; -extern const Word16 b_3sfr_fx[]; -extern const Word16 b_4sfr_fx[]; +extern const Word16 gain_qua_mless_7b_fx[]; // Q14 +extern const Word16 gain_qua_mless_6b_fx[]; // Q14 +extern const Word16 gain_qua_mless_5b_fx[]; // Q14 + +extern const float pred_gain[]; /* Gain quantization - MA predicition coefficients for gain quantizer */ +extern const float t_qua_gain6b[]; /* Gain quantization - gain quantization table for AMR-WB interoperable mode */ +extern const float t_qua_gain7b[]; /* Gain quantization - gain quantization table for AMR-WB interoperable mode */ +extern const Word16 pred_gain_fx[GAIN_PRED_ORDER]; // Q14 +extern const Word16 t_qua_gain6b_fx[64 * 2]; // Q14 +extern const Word16 t_qua_gain7b_fx[128 * 2]; // Q14 + +extern const float Es_pred_qua_5b[]; /* Gain quantization - quantization table for scaled innovation energy prediciton */ +extern const float Es_pred_qua_4b[]; /* Gain quantization - quantization table for scaled innovation energy prediciton */ +extern const float Es_pred_qua_3b[]; /* Gain quantization - quantization table for scaled innovation energy prediciton */ +extern const float Es_pred_qua_4b_no_ltp[]; /* Gain quantization - quantization table for scaled innovation energy prediciton */ +extern const Word16 Es_pred_qua_5b_fx[32]; // Q8 +extern const Word16 Es_pred_qua_4b_fx[16]; // Q8 +extern const Word16 Es_pred_qua_3b_fx[8]; // Q8 +extern const Word16 Es_pred_qua_4b_no_ltp_fx[16]; // Q8 + +extern const float b_1sfr[]; /* Gain quantization - gain estimation constants for gain quantizer at 7.2 and 8.0 kbps */ +extern const float b_2sfr[]; /* Gain quantization - gain estimation constants for gain quantizer at 7.2 and 8.0 kbps */ +extern const float b_3sfr[]; /* Gain quantization - gain estimation constants for gain quantizer at 7.2 and 8.0 kbps */ +extern const float b_4sfr[]; /* Gain quantization - gain estimation constants for gain quantizer at 7.2 and 8.0 kbps */ +extern const Word16 b_1sfr_fx[]; // Q12 +extern const Word16 b_2sfr_fx[]; // Q12 +extern const Word16 b_3sfr_fx[]; // Q12 +extern const Word16 b_4sfr_fx[]; // Q12 extern const float gp_gamma_1sfr_8b[]; /* Gain quantization - gain quantization table for gain quantizer at 7.2 and 8.0 kbps */ @@ -337,15 +337,15 @@ extern const float gp_gamma_2sfr_6b[]; /* Gain quantization - gain quantization extern const float gp_gamma_3sfr_6b[]; /* Gain quantization - gain quantization table for gain quantizer at 7.2 and 8.0 kbps */ extern const float gp_gamma_4sfr_6b[]; /* Gain quantization - gain quantization table for gain quantizer at 7.2 and 8.0 kbps */ -extern const Word16 gp_gamma_1sfr_8b_fx[]; -extern const Word16 gp_gamma_1sfr_7b_fx[]; -extern const Word16 gp_gamma_1sfr_6b_fx[]; -extern const Word16 gp_gamma_2sfr_7b_fx[]; -extern const Word16 gp_gamma_4sfr_7b_fx[]; -extern const Word16 gp_gamma_2sfr_6b_fx[]; -extern const Word16 gp_gamma_3sfr_7b_fx[]; -extern const Word16 gp_gamma_3sfr_6b_fx[]; -extern const Word16 gp_gamma_4sfr_6b_fx[]; +extern const Word16 gp_gamma_1sfr_8b_fx[]; // Q14/Q9 +extern const Word16 gp_gamma_1sfr_7b_fx[]; // Q14/Q9 +extern const Word16 gp_gamma_1sfr_6b_fx[]; // Q14/Q9 +extern const Word16 gp_gamma_2sfr_7b_fx[]; // Q14/Q9 +extern const Word16 gp_gamma_4sfr_7b_fx[]; // Q14/Q9 +extern const Word16 gp_gamma_2sfr_6b_fx[]; // Q14/Q9 +extern const Word16 gp_gamma_3sfr_7b_fx[]; // Q14/Q9 +extern const Word16 gp_gamma_3sfr_6b_fx[]; // Q14/Q9 +extern const Word16 gp_gamma_4sfr_6b_fx[]; // Q14/Q9 extern const int16_t E_ROM_qua_gain5b_const[]; @@ -354,59 +354,59 @@ extern const int16_t E_ROM_qua_gain7b_const[]; extern const float gain_qua_mless[]; -extern const float tbl_gain_code_tc[]; /* TC - code gain quantization table */ -extern const Word16 tbl_gain_code_tc_fx[N_GAIN_CODE_TC]; -extern const Word16 tbl_gain_code_tc_quant_mean[N_GAIN_CODE_TC - 1]; +extern const float tbl_gain_code_tc[]; /* TC - code gain quantization table */ +extern const Word16 tbl_gain_code_tc_fx[N_GAIN_CODE_TC]; // Q13 +extern const Word16 tbl_gain_code_tc_quant_mean[N_GAIN_CODE_TC - 1]; // Q13 -extern const float tbl_gain_trans_tc[]; /* TC - gain quantization table for g_trans */ -extern const float glottal_cdbk[]; /* TC - table of prototype glottal impulses */ -extern const Word16 tbl_gain_trans_tc_fx[]; -extern const Word16 Glottal_cdbk_fx[]; +extern const float tbl_gain_trans_tc[]; /* TC - gain quantization table for g_trans */ +extern const float glottal_cdbk[]; /* TC - table of prototype glottal impulses */ +extern const Word16 tbl_gain_trans_tc_fx[]; // Q7/Q4 +extern const Word16 Glottal_cdbk_fx[]; // Q13 -extern const int32_t PI_select_table[23][8]; /* selection table for Pulse indexing */ -extern const int32_t PI_offset[8][8]; /* offset table for Pulse indexing */ -extern const int16_t PI_factor[]; /* EVS_PI factor table for Pulse indexing */ +extern const Word32 PI_select_table[23][8]; /* selection table for Pulse indexing Q0*/ +extern const int32_t PI_offset[8][8]; /* offset table for Pulse indexing Q0*/ +extern const Word16 PI_factor[]; /* EVS_PI factor table for Pulse indexing Q0*/ /* ACELP pulse coding */ -extern const Word16 hi_to_low_tmpl[10]; -extern const uint16_t low_len[10]; -extern const uint16_t low_mask[10]; -extern const uint16_t indx_fact[10]; -extern const int16_t index_len[3]; -extern const int16_t index_mask_ACELP[3]; +extern const Word16 hi_to_low_tmpl[10]; // Q0 +extern const uint16_t low_len[10]; // Q0 +extern const uint16_t low_mask[10]; // Q0 +extern const uint16_t indx_fact[10]; // Q0 +extern const int16_t index_len[3]; // Q0 +extern const int16_t index_mask_ACELP[3]; // Q0 -extern const float deem_tab[]; /* HF BWE - de-emphasis coefficients */ -extern const Word16 deem_tab_fx[]; +extern const float deem_tab[]; /* HF BWE - de-emphasis coefficients */ +extern const Word16 deem_tab_fx[]; // Q15 extern const float filt_hp[]; -extern const Word16 filt_hp_fx[]; -extern const float exp_tab_p[]; /* HF BWE - Table of values exp(-j*w*i) */ -extern const Word16 exp_tab_p_fx[]; -extern const float exp_tab_q[]; /* HF BWE - Table of values exp(-j*w*i) */ -extern const Word16 exp_tab_q_fx[]; -extern const float HP_gain[]; /* HF BWE - quantization table for 23.85 */ -extern const Word16 HP_gain_fx[]; -extern const float fir_6k_8k[]; /* HF BWE - band-pass filter coefficients */ - -extern const float b_hp400[]; /* HF (6-7kHz) BWE - 400Hz HP filter coefficients */ -extern const float a_hp400[]; /* HF (6-7kHz) BWE - 400Hz HP filter coefficients */ -extern const float fir_6k_7k[]; /* HF (6-7kHz) BWE - 6.0 - 7.0 kHz BP filter coefficients */ -extern const Word16 fir_6k_7k_fx[]; - -extern const Word16 no_lead_fx[][MAX_NO_SCALES * 2]; -extern const Word16 no_lead_p_fx[][MAX_NO_SCALES * 2]; - -extern const float low_H_flt[]; /* Enhacer - 2.0 - 6.4 kHz impulse response with phase dispersion */ -extern const float mid_H_flt[]; /* Enhancer - 3.2 - 6.4 kHz impulse response with phase dispersion */ -extern const Word16 low_H[64]; -extern const Word16 low_H16k[80]; -extern const Word16 mid_H[64]; -extern const Word16 mid_H16k[80]; +extern const Word16 filt_hp_fx[]; // Q15 +extern const float exp_tab_p[]; /* HF BWE - Table of values exp(-j*w*i) */ +extern const Word16 exp_tab_p_fx[]; // Q14 +extern const float exp_tab_q[]; /* HF BWE - Table of values exp(-j*w*i) */ +extern const Word16 exp_tab_q_fx[]; // Q14 +extern const float HP_gain[]; /* HF BWE - quantization table for 23.85 */ +extern const Word16 HP_gain_fx[]; // Q15 +extern const float fir_6k_8k[]; /* HF BWE - band-pass filter coefficients */ + +extern const float b_hp400[]; /* HF (6-7kHz) BWE - 400Hz HP filter coefficients */ +extern const float a_hp400[]; /* HF (6-7kHz) BWE - 400Hz HP filter coefficients */ +extern const float fir_6k_7k[]; /* HF (6-7kHz) BWE - 6.0 - 7.0 kHz BP filter coefficients */ +extern const Word16 fir_6k_7k_fx[]; // Q15 + +extern const Word16 no_lead_fx[][MAX_NO_SCALES * 2]; // Q0 +extern const Word16 no_lead_p_fx[][MAX_NO_SCALES * 2]; // Q0 + +extern const float low_H_flt[]; /* Enhacer - 2.0 - 6.4 kHz impulse response with phase dispersion */ +extern const float mid_H_flt[]; /* Enhancer - 3.2 - 6.4 kHz impulse response with phase dispersion */ +extern const Word16 low_H[64]; // Q14 +extern const Word16 low_H16k[80]; // Q14 +extern const Word16 mid_H[64]; // Q14 +extern const Word16 mid_H16k[80]; // Q14 extern const float filt_lp[1 + L_FILT]; -extern const Word16 filt_lp_fx[1 + L_FILT]; +extern const Word16 filt_lp_fx[1 + L_FILT]; // Q15 extern const float filt_lp_16kHz[1 + L_FILT16k]; -extern const Word16 filt_lp_16kHz_fx[1 + L_FILT16k]; +extern const Word16 filt_lp_16kHz_fx[1 + L_FILT16k]; // Q15 extern const float tab_hup_l[SIZ_TAB_HUP_L]; /* NB post-filter */ extern const float tab_hup_s[SIZ_TAB_HUP_S]; /* NB post-filter */ @@ -425,80 +425,80 @@ extern const float edct_table_200[]; extern const float edct_table_240[]; extern const float edct_table_256[]; extern const float edct_table_400[]; -extern const float edct_table_600[]; /* EDCT */ -extern const Word16 edct_table_80_fx[]; /* EDCT */ -extern const Word16 edct_table_120_fx[]; /* EDCT */ -extern const Word16 edct_table_100_fx[]; /* EDCT */ -extern const Word16 edct_table_320_fx[]; /* EDCT */ -extern const Word16 edct_table_480_fx[]; /* EDCT */ -extern const Word16 edct_table_600_fx[]; /* EDCT */ -extern const Word16 edct_table_128_fx[]; /* EDCT */ -extern const Word16 edct_table_160_fx[]; /* EDCT */ -extern const Word16 edct_table_40_fx[]; /* EDCT */ -extern const Word16 edct_table_20_fx[]; /* EDCT */ -extern const Word16 edct_table_64_fx[]; -extern const Word16 edct_table_200_fx[]; -extern const Word16 edct_table_240_fx[]; -extern const Word16 edct_table_256_fx[]; -extern const Word16 edct_table_400_fx[]; -extern const Word16 edct_table_160_16fx[160]; -extern const Word16 edct_table_128_16fx[128]; -extern const Word16 edct_table_320_16fx[320]; +extern const float edct_table_600[]; /* EDCT */ +extern const Word16 edct_table_80_fx[]; // Q16 /* EDCT */ +extern const Word16 edct_table_120_fx[]; // Q16 /* EDCT */ +extern const Word16 edct_table_100_fx[]; // Q16 /* EDCT */ +extern const Word16 edct_table_320_fx[]; // Q16 /* EDCT */ +extern const Word16 edct_table_480_fx[]; // Q16 /* EDCT */ +extern const Word16 edct_table_600_fx[]; // Q16 /* EDCT */ +extern const Word16 edct_table_128_fx[]; // Q16 /* EDCT */ +extern const Word16 edct_table_160_fx[]; // Q16 /* EDCT */ +extern const Word16 edct_table_40_fx[]; // Q16 /* EDCT */ +extern const Word16 edct_table_20_fx[]; // Q16 /* EDCT */ +extern const Word16 edct_table_64_fx[]; // Q16 +extern const Word16 edct_table_200_fx[]; // Q16 +extern const Word16 edct_table_240_fx[]; // Q16 +extern const Word16 edct_table_256_fx[]; // Q16 +extern const Word16 edct_table_400_fx[]; // Q16 +extern const Word16 edct_table_160_16fx[160]; // Q15 +extern const Word16 edct_table_128_16fx[128]; // Q15 +extern const Word16 edct_table_320_16fx[320]; // Q16 extern const int16_t crit_bins[]; /* (used only in AMR-WB IO mode) */ extern const float crit_bins_corr[CRIT_NOIS_BAND]; -extern const Word16 crit_bins_corr_fx[]; -extern const float crit_bands_loc[]; /* (used only in AMR-WB IO mode) */ -extern const Word16 crit_bands_loc_fx[]; -extern const float mfreq_loc_LD[]; /* LD music post-filter */ -extern const Word16 mfreq_loc_LD_fx[]; -extern const int16_t mfreq_bindiv_LD[]; +extern const Word16 crit_bins_corr_fx[]; // Q15 +extern const float crit_bands_loc[]; /* (used only in AMR-WB IO mode) */ +extern const Word16 crit_bands_loc_fx[]; // Q0 +extern const float mfreq_loc_LD[]; /* LD music post-filter */ +extern const Word16 mfreq_loc_LD_fx[]; // Q0 +extern const Word16 mfreq_bindiv_LD[]; // Q0 extern const float post_dct_wind[OFFSET2]; -extern const Word16 post_dct_wind_fx[]; +extern const Word16 post_dct_wind_fx[]; // Q15 extern const float MAX_SNR_SNR1_tab[]; extern const float INV_MAX_SNR_tab[]; -extern const Word16 MAX_SNR_SNR1_tab_FX[MBANDS_GN_LD]; -extern const Word16 INV_MAX_SNR_tab_FX[MBANDS_GN_LD]; +extern const Word16 MAX_SNR_SNR1_tab_FX[MBANDS_GN_LD]; // Q14 +extern const Word16 INV_MAX_SNR_tab_FX[MBANDS_GN_LD]; // Q15 extern const float sc_qnoise[]; -extern const Word16 sc_qnoise_fx[]; -extern const Word16 inv_mfreq_bindiv_LD_fx[]; -extern const Word16 inv_mfreq_bindiv_LD_M1_fx[]; +extern const Word16 sc_qnoise_fx[]; // Q15 +extern const Word16 inv_mfreq_bindiv_LD_fx[]; // Q15 +extern const Word16 inv_mfreq_bindiv_LD_M1_fx[]; // Q15 extern const float W_DTX_HO[HO_HIST_SIZE]; -extern const Word16 W_DTX_HO_FX[HO_HIST_SIZE]; +extern const Word16 W_DTX_HO_FX[HO_HIST_SIZE]; // Q15 extern const float ENR_ATT[5]; -extern const Word16 ENR_ATT_fx[5]; +extern const Word16 ENR_ATT_fx[5]; // Q8 extern const float HO_ATT[5]; -extern const Word16 HO_ATT_FX[5]; +extern const Word16 HO_ATT_FX[5]; // Q15 -extern const int16_t hq_swb_bwe_nb_bits[]; +extern const Word16 hq_swb_bwe_nb_bits[]; // Q0 /*----------------------------------------------------------------------------------* * ISF quantization (AMR-WB IO mode) *----------------------------------------------------------------------------------*/ -extern const Word16 Indirect_dico1[SIZE_BK1]; +extern const Word16 Indirect_dico1[SIZE_BK1]; // Q0 extern const float mean_isf_amr_wb[M]; /* Mean ISF vector (only in AMR-WB IO mode) */ -extern const Word16 mean_isf_amr_wb_fx[M]; /* Mean ISF vector (only in AMR-WB IO mode) */ +extern const Word16 mean_isf_amr_wb_fx[M]; /*Qlog2(2.56)*/ /* Mean ISF vector (only in AMR-WB IO mode) */ extern const float mean_isf_noise_amr_wb[]; /* Mean ISF vector for SID frame (only in AMR-WB IO mode) */ -extern const Word16 mean_isf_noise_amr_wb_fx[]; /* Mean ISF vector for SID frame (only in AMR-WB IO mode) */ +extern const Word16 mean_isf_noise_amr_wb_fx[]; /*Qlog2(2.56)*/ /* Mean ISF vector for SID frame (only in AMR-WB IO mode) */ -extern const float gaus_dico[]; /* Gaussian codebook */ -extern const Word16 gaus_dico_fx[]; -extern const float gaus_dico_swb[]; /* Gaussian codebook for SWB TBE */ -extern const Word16 gaus_dico_swb_fx[]; +extern const float gaus_dico[]; /* Gaussian codebook */ +extern const Word16 gaus_dico_fx[]; // Q12 +extern const float gaus_dico_swb[]; /* Gaussian codebook for SWB TBE */ +extern const Word16 gaus_dico_swb_fx[]; // Q15 extern const float dico1_isf[]; /* ISF codebook - common 1st stage, 1st split (only in AMR-WB IO mode) */ -extern const Word16 dico1_isf_fx[]; /* ISF codebook - common 1st stage, 1st split (only in AMR-WB IO mode) */ +extern const Word16 dico1_isf_fx[]; /* ISF codebook - common 1st stage, 1st split (only in AMR-WB IO mode) Qlog2(2.56)*/ extern const float dico2_isf[]; /* ISF codebook - common 1st stage, 2nd split (only in AMR-WB IO mode) */ -extern const Word16 dico2_isf_fx[]; /* ISF codebook - common 1st stage, 2nd split (only in AMR-WB IO mode) */ +extern const Word16 dico2_isf_fx[]; /* ISF codebook - common 1st stage, 2nd split (only in AMR-WB IO mode) Qlog2(2.56)*/ extern const float dico21_isf_46b[]; /* ISF codebook - 46b, 2nd stage, 1st split (only in AMR-WB IO mode) */ extern const float dico22_isf_46b[]; /* ISF codebook - 46b, 2nd stage, 2st split (only in AMR-WB IO mode) */ @@ -506,23 +506,23 @@ extern const float dico23_isf_46b[]; /* ISF codebook - 46b, 2nd stage, 3rd split extern const float dico24_isf_46b[]; /* ISF codebook - 46b, 2nd stage, 4th split (only in AMR-WB IO mode) */ extern const float dico25_isf_46b[]; /* ISF codebook - 46b, 2nd stage, 5th split (only in AMR-WB IO mode) */ -extern const Word16 dico21_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 1st split (only in AMR-WB IO mode) */ -extern const Word16 dico22_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 2st split (only in AMR-WB IO mode) */ -extern const Word16 dico23_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 3rd split (only in AMR-WB IO mode) */ -extern const Word16 dico24_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 4th split (only in AMR-WB IO mode) */ -extern const Word16 dico25_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 5th split (only in AMR-WB IO mode) */ +extern const Word16 dico21_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 1st split (only in AMR-WB IO mode) Qlog2(2.56)*/ +extern const Word16 dico22_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 2st split (only in AMR-WB IO mode) Qlog2(2.56)*/ +extern const Word16 dico23_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 3rd split (only in AMR-WB IO mode) Qlog2(2.56)*/ +extern const Word16 dico24_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 4th split (only in AMR-WB IO mode) Qlog2(2.56)*/ +extern const Word16 dico25_isf_46b_fx[]; /* ISF codebook - 46b, 2nd stage, 5th split (only in AMR-WB IO mode) Qlog2(2.56)*/ extern const float dico21_isf_36b[]; /* ISF codebook - 36b, 2nd stage, 1st split (only in AMR-WB IO mode) */ -extern const Word16 dico21_isf_36b_fx[]; /* ISF codebook - 36b, 2nd stage, 1st split (only in AMR-WB IO mode) */ +extern const Word16 dico21_isf_36b_fx[]; /* ISF codebook - 36b, 2nd stage, 1st split (only in AMR-WB IO mode) Qlog2(2.56)*/ extern const float dico22_isf_36b[]; /* ISF codebook - 36b, 2nd stage, 2nd split (only in AMR-WB IO mode) */ -extern const Word16 dico22_isf_36b_fx[]; /* ISF codebook - 36b, 2nd stage, 2nd split (only in AMR-WB IO mode) */ +extern const Word16 dico22_isf_36b_fx[]; /* ISF codebook - 36b, 2nd stage, 2nd split (only in AMR-WB IO mode) Qlog2(2.56)*/ extern const float dico23_isf_36b[]; /* ISF codebook - 36b, 2nd stage, 3rd split (only in AMR-WB IO mode) */ -extern const Word16 dico23_isf_36b_fx[]; /* ISF codebook - 36b, 2nd stage, 3rd split (only in AMR-WB IO mode) */ +extern const Word16 dico23_isf_36b_fx[]; /* ISF codebook - 36b, 2nd stage, 3rd split (only in AMR-WB IO mode) Qlog2(2.56)*/ extern const float dico1_ns_28b[]; /* ISF codebook for SID frames - 28b, 1st split */ extern const float dico2_ns_28b[]; /* ISF codebook for SID frames - 28b, 2nd spilt */ @@ -530,11 +530,11 @@ extern const float dico3_ns_28b[]; /* ISF codebook for SID frames - 28b, 3rd spi extern const float dico4_ns_28b[]; /* ISF codebook for SID frames - 28b, 4th spilt */ extern const float dico5_ns_28b[]; /* ISF codebook for SID frames - 28b, 5th spilt */ -extern const Word16 dico1_ns_28b_fx[]; /* ISF codebook for SID frames - 28b, 1st split */ -extern const Word16 dico2_ns_28b_fx[]; /* ISF codebook for SID frames - 28b, 2nd spilt */ -extern const Word16 dico3_ns_28b_fx[]; /* ISF codebook for SID frames - 28b, 3rd spilt */ -extern const Word16 dico4_ns_28b_fx[]; /* ISF codebook for SID frames - 28b, 4th spilt */ -extern const Word16 dico5_ns_28b_fx[]; /* ISF codebook for SID frames - 28b, 5th spilt */ +extern const Word16 dico1_ns_28b_fx[]; /*Qlog2(2.56)*/ /* ISF codebook for SID frames - 28b, 1st split Qlog2(2.56)*/ +extern const Word16 dico2_ns_28b_fx[]; /*Qlog2(2.56)*/ /* ISF codebook for SID frames - 28b, 2nd spilt Qlog2(2.56)*/ +extern const Word16 dico3_ns_28b_fx[]; /*Qlog2(2.56)*/ /* ISF codebook for SID frames - 28b, 3rd spilt Qlog2(2.56)*/ +extern const Word16 dico4_ns_28b_fx[]; /*Qlog2(2.56)*/ /* ISF codebook for SID frames - 28b, 4th spilt Qlog2(2.56)*/ +extern const Word16 dico5_ns_28b_fx[]; /*Qlog2(2.56)*/ /* ISF codebook for SID frames - 28b, 5th spilt Qlog2(2.56)*/ extern const float dico1_cng_ev[]; extern const float dico2_cng_ev[]; @@ -549,9 +549,9 @@ extern const float dico5_cng_ev[]; extern const float stable_ISP[]; extern const float stable_LSP[]; extern const float stable_ISF[]; -extern const Word16 stable_ISP_fx[]; -extern const Word16 stable_ISF_fx[]; -extern const Word16 stable_LSP_fx[]; +extern const Word16 stable_ISP_fx[]; /*Q15*/ +extern const Word16 stable_ISF_fx[]; /*15Q16*/ +extern const Word16 stable_LSP_fx[]; /*Q15*/ extern const float UVWB_Ave[]; extern const float UVNB_Ave[]; @@ -564,25 +564,25 @@ extern const float GEWB_Ave[]; extern const float GEWB2_Ave[]; extern const float TRWB_Ave[]; extern const float TRWB2_Ave[]; -extern const Word16 UVWB_Ave_fx[]; -extern const Word16 UVNB_Ave_fx[]; -extern const Word16 SVWB_Ave_fx[]; -extern const Word16 SVNB_Ave_fx[]; -extern const Word16 IANB_Ave_fx[]; -extern const Word16 IAWB_Ave_fx[]; -extern const Word16 IAWB2_Ave_fx[]; -extern const Word16 GENB_Ave_fx[]; -extern const Word16 GEWB_Ave_fx[]; -extern const Word16 GEWB2_Ave_fx[]; -extern const Word16 TRWB_Ave_fx[]; -extern const Word16 TRWB2_Ave_fx[]; +extern const Word16 UVWB_Ave_fx[]; // Qlog2(2.56) +extern const Word16 UVNB_Ave_fx[]; // Qlog2(2.56) +extern const Word16 SVWB_Ave_fx[]; // Qlog2(2.56) +extern const Word16 SVNB_Ave_fx[]; // Qlog2(2.56) +extern const Word16 IANB_Ave_fx[]; // Qlog2(2.56) +extern const Word16 IAWB_Ave_fx[]; // Qlog2(2.56) +extern const Word16 IAWB2_Ave_fx[]; // Qlog2(2.56) +extern const Word16 GENB_Ave_fx[]; // Qlog2(2.56) +extern const Word16 GEWB_Ave_fx[]; // Qlog2(2.56) +extern const Word16 GEWB2_Ave_fx[]; // Qlog2(2.56) +extern const Word16 TRWB_Ave_fx[]; // Qlog2(2.56) +extern const Word16 TRWB2_Ave_fx[]; // Qlog2(2.56) extern const float means_wb_cleanspeech_lsf16k0_flt[]; extern const float means_swb_cleanspeech_lsf25k6_flt[]; extern const float means_swb_cleanspeech_lsf32k0_flt[]; -extern const Word16 means_wb_cleanspeech_lsf16k0[]; -extern const Word16 means_swb_cleanspeech_lsf25k6[]; -extern const Word16 means_swb_cleanspeech_lsf32k0[]; +extern const Word16 means_wb_cleanspeech_lsf16k0[]; // Qlog2(2.56) +extern const Word16 means_swb_cleanspeech_lsf25k6[]; // Qlog2(2.56) +extern const Word16 means_swb_cleanspeech_lsf32k0[]; // Qlog2(2.56) extern const float ModeMean12[]; extern const float Predictor0[]; @@ -594,143 +594,143 @@ extern const float Predictor5[]; extern const float Predictor6[]; extern const float Predictor7[]; extern const float Predictor8[]; -extern const Word16 Predictor0_fx[]; -extern const Word16 Predictor1_fx[]; -extern const Word16 Predictor2_fx[]; -extern const Word16 Predictor3_fx[]; -extern const Word16 Predictor4_fx[]; -extern const Word16 Predictor5_fx[]; -extern const Word16 Predictor6_fx[]; -extern const Word16 Predictor7_fx[]; -extern const Word16 Predictor8_fx[]; +extern const Word16 Predictor0_fx[]; // Q15 +extern const Word16 Predictor1_fx[]; // Q15 +extern const Word16 Predictor2_fx[]; // Q15 +extern const Word16 Predictor3_fx[]; // Q15 +extern const Word16 Predictor4_fx[]; // Q15 +extern const Word16 Predictor5_fx[]; // Q15 +extern const Word16 Predictor6_fx[]; // Q15 +extern const Word16 Predictor7_fx[]; // Q15 +extern const Word16 Predictor8_fx[]; // Q15 extern const float CNG_SN1[]; -extern const Word16 CNG_SN1_fx[]; -extern const int16_t CB_lsf[]; -extern const int16_t CB_p_lsf[]; +extern const Word16 CNG_SN1_fx[]; // Qlog2(2.56) +extern const Word16 CB_lsf[]; // Q0 +extern const Word16 CB_p_lsf[]; // Q0 extern const float *const ModeMeans[]; extern const float *const Predictors[]; -extern const Word16 *const ModeMeans_fx[]; -extern const Word16 *const Predictors_fx[]; -extern const int16_t CBsizes[]; -extern const int16_t CBbits[]; +extern const Word16 *const ModeMeans_fx[]; // Qlog2(2.56) +extern const Word16 *const Predictors_fx[]; // Q15 +extern const Word16 CBsizes[]; // Q0 +extern const Word16 CBbits[]; // Q0 -extern const int16_t CBbits_p[]; +extern const Word16 CBbits_p[]; // Q0 extern const float vals[NO_LEADERS][MAX_NO_VALS]; -extern const Word16 vals_fx[NO_LEADERS][MAX_NO_VALS]; +extern const Word16 vals_fx[NO_LEADERS][MAX_NO_VALS]; // Q1 -extern const int16_t no_vals[NO_LEADERS]; +extern const Word16 no_vals[NO_LEADERS]; // Q0 // extern const Word16 no_vals_fx[NO_LEADERS]; -extern const int16_t no_vals_ind[NO_LEADERS][MAX_NO_VALS]; +extern const Word16 no_vals_ind[NO_LEADERS][MAX_NO_VALS]; // Q0 // extern const Word16 no_vals_ind_fx[NO_LEADERS][MAX_NO_VALS]; -extern const int16_t C_VQ[LATTICE_DIM + 1][LATTICE_DIM + 1]; +extern const Word16 C_VQ[LATTICE_DIM + 1][LATTICE_DIM + 1]; // Q0 // extern const Word16 C_VQ_fx[LATTICE_DIM + 1][LATTICE_DIM + 1]; -extern const int16_t BitsVQ[]; -extern const int16_t BitsVQ_p[]; -extern const UWord8 no_lead_idx[][2]; -extern const UWord8 no_lead_p_idx[][2]; -extern const Word8 leaders_short[][MAX_NO_SCALES]; +extern const Word16 BitsVQ[]; // Q0 +extern const Word16 BitsVQ_p[]; // Q0 +extern const UWord8 no_lead_idx[][2]; // Q0 +extern const UWord8 no_lead_p_idx[][2]; // Q0 +extern const Word8 leaders_short[][MAX_NO_SCALES]; // Q0 extern const float sigma_MSLVQ[][16]; -extern const Word16 sigma_MSLVQ_fx[][16]; +extern const Word16 sigma_MSLVQ_fx[][16]; // Qlog2(2.56) extern const float sigma_p[][16]; -extern const Word16 sigma_p_fx[][16]; -extern const Word16 sigma_p_ivas_fx[][16]; +extern const Word16 sigma_p_fx[][16]; // Qlog2(2.56) +extern const Word16 sigma_p_ivas_fx[][16]; // Qlog2(2.56) extern const float inv_sigma_MSLVQ[][16]; -extern const Word16 inv_sigma_MSLVQ_fx[][16]; +extern const Word16 inv_sigma_MSLVQ_fx[][16]; // Q15 extern const float inv_sigma_p[][16]; -extern const Word16 inv_sigma_p_fx[][16]; -extern const Word16 inv_sigma_p_ivas_fx[][16]; +extern const Word16 inv_sigma_p_fx[][16]; // Q15 +extern const Word16 inv_sigma_p_ivas_fx[][16]; // Qlog2(2.56) extern const float scales[][MAX_NO_SCALES * 2]; extern const float scales_p[][MAX_NO_SCALES * 2]; -extern const Word16 scales_fx[][MAX_NO_SCALES * 2]; -extern const Word16 scales_ivas_fx[][MAX_NO_SCALES * 2]; -extern const Word16 scales_p_ivas_fx[][MAX_NO_SCALES * 2]; -extern const Word16 scales_p_fx[][MAX_NO_SCALES * 2]; +extern const Word16 scales_fx[][MAX_NO_SCALES * 2]; // Q11 +extern const Word16 scales_ivas_fx[][MAX_NO_SCALES * 2]; // Q11 +extern const Word16 scales_p_ivas_fx[][MAX_NO_SCALES * 2]; // Q11 +extern const Word16 scales_p_fx[][MAX_NO_SCALES * 2]; // Q11 extern const int16_t predmode_tab_float[][6]; -extern const Word16 predmode_tab[][6]; +extern const Word16 predmode_tab[][6]; // Q0 extern const float pl_HQ[]; -extern const Word16 pl_HQ_fx[]; +extern const Word16 pl_HQ_fx[]; // Q1 -extern const int16_t pi0[]; +extern const Word16 pi0[]; // Q0 // extern const Word16 pi0_fx[]; -extern const UWord32 table_no_cv[]; -extern const Word32 table_no_cv_fx[]; +extern const UWord32 table_no_cv[]; // Q0 +extern const Word32 table_no_cv_fx[]; // Q0 -extern const int16_t pl_par[]; +extern const Word16 pl_par[]; // Q0 // extern const Word16 pl_par_fx[]; /* 1 if even number of signs */ extern const float *const Quantizers[]; extern const float *const Quantizers_p[]; -extern const Word16 *const Quantizers_p_fx[]; -extern const Word16 *const Quantizers_fx[]; +extern const Word16 *const Quantizers_p_fx[]; // Qlog2(2.56) +extern const Word16 *const Quantizers_fx[]; // Qlog2(2.56) -extern const int16_t cng_sort[]; +extern const Word16 cng_sort[]; // Q0 // extern const Word16 cng_sort_fx[]; -extern const int16_t perm_MSLVQ[][4]; +extern const Word16 perm_MSLVQ[][4]; // Q0 // extern const Word16 perm_MSLVQ_fx[][4]; extern const int16_t min_lat_bits_SN[]; -extern const Word16 min_lat_bits_SN_fx[]; +extern const Word16 min_lat_bits_SN_fx[]; // Q0 extern const int16_t min_lat_bits_pred[]; -extern const Word16 min_lat_bits_pred_fx[]; +extern const Word16 min_lat_bits_pred_fx[]; // Q0 extern const int16_t offset_in_lvq_mode_SN[][21]; -extern const Word16 offset_in_lvq_mode_SN_fx[][21]; +extern const Word16 offset_in_lvq_mode_SN_fx[][21]; // Q0 extern const int16_t offset_in_lvq_mode_pred[][32]; -extern const Word16 offset_in_lvq_mode_pred_fx[][32]; +extern const Word16 offset_in_lvq_mode_pred_fx[][32]; // Q0 extern const int16_t offset_lvq_modes_SN[]; -extern const Word16 offset_lvq_modes_SN_fx[]; +extern const Word16 offset_lvq_modes_SN_fx[]; // Q0 extern const int16_t offset_lvq_modes_pred[]; -extern const Word16 offset_lvq_modes_pred_fx[]; +extern const Word16 offset_lvq_modes_pred_fx[]; // Qlog2(1.6) /*-----------------------------------------------------------------* * LSF quantization - BC-TCVQ tables *-----------------------------------------------------------------*/ -extern const int16_t FixBranch_tbl[4][4][N_STAGE_VQ - 4]; +extern const Word16 FixBranch_tbl[4][4][N_STAGE_VQ - 4]; // Q0 -extern const int16_t BC_TCVQ_BIT_ALLOC_40B[]; +extern const Word16 BC_TCVQ_BIT_ALLOC_40B[]; // Q0 -extern const int16_t NTRANS[4][16]; -extern const int16_t NTRANS2[4][16]; +extern const Word16 NTRANS[4][16]; // Q0 +extern const Word16 NTRANS2[4][16]; // Q0 extern const float AR_IntraCoeff[N_STAGE_VQ - 1][2][2]; extern const float SN_IntraCoeff[N_STAGE_VQ - 1][2][2]; -extern const Word16 AR_IntraCoeff_fx[N_STAGE_VQ - 1][2][2]; -extern const Word16 SN_IntraCoeff_fx[N_STAGE_VQ - 1][2][2]; +extern const Word16 AR_IntraCoeff_fx[N_STAGE_VQ - 1][2][2]; /* Q15 */ +extern const Word16 SN_IntraCoeff_fx[N_STAGE_VQ - 1][2][2]; // Q15 extern const float scale_ARSN[]; -extern const Word16 scale_ARSN_fx[]; +extern const Word16 scale_ARSN_fx[]; /* Q14 */ extern const float scale_inv_ARSN[]; -extern const Word16 scale_inv_ARSN_fx[]; +extern const Word16 scale_inv_ARSN_fx[]; // Q15 extern const float AR_TCVQ_CB_SUB1[2][128][2]; extern const float AR_TCVQ_CB_SUB2[2][64][2]; extern const float AR_TCVQ_CB_SUB3[4][32][2]; -extern const Word16 AR_TCVQ_CB_SUB1_fx[2][128][2]; -extern const Word16 AR_TCVQ_CB_SUB2_fx[2][64][2]; -extern const Word16 AR_TCVQ_CB_SUB3_fx[4][32][2]; +extern const Word16 AR_TCVQ_CB_SUB1_fx[2][128][2]; // Qlog2(2.56) +extern const Word16 AR_TCVQ_CB_SUB2_fx[2][64][2]; // Qlog2(2.56) +extern const Word16 AR_TCVQ_CB_SUB3_fx[4][32][2]; // Qlog2(2.56) extern const float SN_TCVQ_CB_SUB1[2][128][2]; extern const float SN_TCVQ_CB_SUB2[2][64][2]; extern const float SN_TCVQ_CB_SUB3[4][32][2]; -extern const Word16 SN_TCVQ_CB_SUB1_fx[2][128][2]; -extern const Word16 SN_TCVQ_CB_SUB2_fx[2][64][2]; -extern const Word16 SN_TCVQ_CB_SUB3_fx[4][32][2]; +extern const Word16 SN_TCVQ_CB_SUB1_fx[2][128][2]; // Qlog2(2.56) +extern const Word16 SN_TCVQ_CB_SUB2_fx[2][64][2]; // Qlog2(2.56) +extern const Word16 SN_TCVQ_CB_SUB3_fx[4][32][2]; // Qlog2(2.56) extern const float AR_SVQ_CB1[32][8]; extern const float AR_SVQ_CB2[16][8]; -extern const Word16 AR_SVQ_CB1_fx[32][8]; -extern const Word16 AR_SVQ_CB2_fx[16][8]; +extern const Word16 AR_SVQ_CB1_fx[32][8]; // Qlog2(2.56) +extern const Word16 AR_SVQ_CB2_fx[16][8]; // Qlog2(2.56) extern const int16_t uniform_model[]; @@ -742,47 +742,47 @@ extern const int16_t uniform_model[]; extern const float tbl_mid_gen_wb_2b[]; extern const float tbl_mid_gen_wb_4b[]; extern const float tbl_mid_gen_wb_5b[]; -extern const Word16 tbl_mid_gen_wb_2b_fx[]; -extern const Word16 tbl_mid_gen_wb_4b_fx[]; -extern const Word16 tbl_mid_gen_wb_5b_fx[]; +extern const Word16 tbl_mid_gen_wb_2b_fx[]; // Q13 +extern const Word16 tbl_mid_gen_wb_4b_fx[]; // Q13 +extern const Word16 tbl_mid_gen_wb_5b_fx[]; // Q13 extern const float tbl_mid_unv_wb_4b[]; extern const float tbl_mid_unv_wb_5b[]; -extern const Word16 tbl_mid_unv_wb_4b_fx[]; -extern const Word16 tbl_mid_unv_wb_5b_fx[]; +extern const Word16 tbl_mid_unv_wb_4b_fx[]; // Q13 +extern const Word16 tbl_mid_unv_wb_5b_fx[]; // Q13 extern const float tbl_mid_voi_wb_1b[]; extern const float tbl_mid_voi_wb_4b[]; extern const float tbl_mid_voi_wb_5b[]; -extern const Word16 tbl_mid_voi_wb_1b_fx[]; -extern const Word16 tbl_mid_voi_wb_4b_fx[]; -extern const Word16 tbl_mid_voi_wb_5b_fx[]; +extern const Word16 tbl_mid_voi_wb_1b_fx[]; // Q13 +extern const Word16 tbl_mid_voi_wb_4b_fx[]; // Q13 +extern const Word16 tbl_mid_voi_wb_5b_fx[]; // Q13 /*-----------------------------------------------------------------* * LSF quantization - Mode 2 quantization tables *-----------------------------------------------------------------*/ extern const float lsf_init[16]; -extern const Word16 lsf_init_fx[16]; +extern const Word16 lsf_init_fx[16]; /*14Q1*1.28*/ extern const float means_wb_31bits_ma_lsf_float[16]; extern const float means_nb_31bits_ma_lsf_float[16]; extern const float *const lsf_means_float[2]; -extern const Word16 means_nb_31bits_ma_lsf[16]; -extern const Word16 means_wb_31bits_ma_lsf[16]; -extern const Word16 *lsf_means[2]; +extern const Word16 means_nb_31bits_ma_lsf[16]; // Q1 +extern const Word16 means_wb_31bits_ma_lsf[16]; // Q1 +extern const Word16 *lsf_means[2]; // Q1 extern const float *const lsf_codebook_flt[2][2][TCXLPC_NUMSTAGES]; -extern const Word16 *const lsf_codebook[2][2][TCXLPC_NUMSTAGES]; -extern const int16_t lsf_numbits[TCXLPC_NUMSTAGES]; -extern const int16_t lsf_dims_ivas[TCXLPC_NUMSTAGES]; -extern const int16_t lsf_offs_ivas[TCXLPC_NUMSTAGES]; -extern const Word16 lsf_dims[TCXLPC_NUMSTAGES]; -extern const Word16 lsf_offs[TCXLPC_NUMSTAGES]; +extern const Word16 *const lsf_codebook[2][2][TCXLPC_NUMSTAGES]; /* 14Q1*1.28 */ +extern const Word16 lsf_numbits[TCXLPC_NUMSTAGES]; // Q0 +extern const Word16 lsf_dims_ivas[TCXLPC_NUMSTAGES]; // Q0 +extern const Word16 lsf_offs_ivas[TCXLPC_NUMSTAGES]; // Q0 +extern const Word16 lsf_dims[TCXLPC_NUMSTAGES]; // Q0 +extern const Word16 lsf_offs[TCXLPC_NUMSTAGES]; // Q0 extern const float dico_lsf_abs_8b_flt[]; -extern const Word16 dico_lsf_abs_8b[]; +extern const Word16 dico_lsf_abs_8b[]; /* 14Q1*1.28 */ extern const float lsf_q_diff_cb_8b_rf_flt[]; -extern const Word16 lsf_q_diff_cb_8b_rf[]; +extern const Word16 lsf_q_diff_cb_8b_rf[]; // Q6 extern const float lsf_cdk_nb_gc_stg1_flt[]; extern const float lsf_cdk_nb_gc_stg2_flt[]; @@ -801,139 +801,138 @@ extern const float lsf_cdk_wb_vc_stg2_flt[]; extern const float lsf_cdk_wb_vc_stg3_flt[]; extern const float lsf_ind_cdk_wb_vc_stg4_flt[]; -extern const Word16 lsf_cdk_nb_gc_stg1[]; -extern const Word16 lsf_cdk_nb_gc_stg2[]; -extern const Word16 lsf_cdk_nb_gc_stg3[]; -extern const Word16 lsf_ind_cdk_nb_gc_stg4[]; -extern const Word16 lsf_cdk_nb_vc_stg1[]; -extern const Word16 lsf_cdk_nb_vc_stg2[]; -extern const Word16 lsf_cdk_nb_vc_stg3[]; -extern const Word16 lsf_ind_cdk_nb_vc_stg4[]; -extern const Word16 lsf_cdk_wb_gc_stg1[]; -extern const Word16 lsf_cdk_wb_gc_stg2[]; -extern const Word16 lsf_cdk_wb_gc_stg3[]; -extern const Word16 lsf_ind_cdk_wb_gc_stg4[]; -extern const Word16 lsf_cdk_wb_vc_stg1[]; -extern const Word16 lsf_cdk_wb_vc_stg2[]; -extern const Word16 lsf_cdk_wb_vc_stg3[]; -extern const Word16 lsf_ind_cdk_wb_vc_stg4[]; +extern const Word16 lsf_cdk_nb_gc_stg1[]; /* 14Q1*1.28 */ +extern const Word16 lsf_cdk_nb_gc_stg2[]; /* 14Q1*1.28 */ +extern const Word16 lsf_cdk_nb_gc_stg3[]; /* 14Q1*1.28 */ +extern const Word16 lsf_ind_cdk_nb_gc_stg4[]; /* 14Q1*1.28 */ +extern const Word16 lsf_cdk_nb_vc_stg1[]; /* 14Q1*1.28 */ +extern const Word16 lsf_cdk_nb_vc_stg2[]; /* 14Q1*1.28 */ +extern const Word16 lsf_cdk_nb_vc_stg3[]; /* 14Q1*1.28 */ +extern const Word16 lsf_ind_cdk_nb_vc_stg4[]; /* 14Q1*1.28 */ +extern const Word16 lsf_cdk_wb_gc_stg1[]; /* 14Q1*1.28 */ +extern const Word16 lsf_cdk_wb_gc_stg2[]; /* 14Q1*1.28 */ +extern const Word16 lsf_cdk_wb_gc_stg3[]; /* 14Q1*1.28 */ +extern const Word16 lsf_ind_cdk_wb_gc_stg4[]; /* 14Q1*1.28 */ +extern const Word16 lsf_cdk_wb_vc_stg1[]; /* 14Q1*1.28 */ +extern const Word16 lsf_cdk_wb_vc_stg2[]; /* 14Q1*1.28 */ +extern const Word16 lsf_cdk_wb_vc_stg3[]; /* 14Q1*1.28 */ +extern const Word16 lsf_ind_cdk_wb_vc_stg4[]; /* 14Q1*1.28 */ extern const float *const lsf_ind_codebook_flt[2][2][TCXLPC_IND_NUMSTAGES]; -extern const Word16 *const lsf_ind_codebook[2][2][TCXLPC_IND_NUMSTAGES]; -extern const int16_t lsf_ind_numbits[TCXLPC_IND_NUMSTAGES]; -extern const int16_t lsf_ind_dims_ivas[TCXLPC_IND_NUMSTAGES]; -extern const Word16 lsf_ind_dims[TCXLPC_IND_NUMSTAGES]; -extern const int16_t lsf_ind_offs[TCXLPC_IND_NUMSTAGES]; -extern const Word16 min_distance_thr[2][2]; +extern const Word16 *const lsf_ind_codebook[2][2][TCXLPC_IND_NUMSTAGES]; /* 14Q1*1.28 */ +extern const Word16 lsf_ind_numbits[TCXLPC_IND_NUMSTAGES]; // Q0 +extern const Word16 lsf_ind_dims_ivas[TCXLPC_IND_NUMSTAGES]; // Q0 +extern const Word16 lsf_ind_dims[TCXLPC_IND_NUMSTAGES]; // Q0 +extern const Word16 lsf_ind_offs[TCXLPC_IND_NUMSTAGES]; // Q0 +extern const Word16 min_distance_thr[2][2]; /* 14Q1*1.28 */ typedef float lsp_unw_triplet_flt[3]; extern const lsp_unw_triplet_flt p16_gamma0_92to1_float[16]; extern const lsp_unw_triplet_flt p16_gamma0_94to1_float[16]; -typedef Word16 lsp_unw_triplet[3]; +typedef Word16 lsp_unw_triplet[3]; // Q14 extern const lsp_unw_triplet p16_gamma0_92to1[16]; extern const lsp_unw_triplet p16_gamma0_94to1[16]; /*------------------------------------------------------------------------------* * AVQ - RE8 tables *------------------------------------------------------------------------------*/ -extern const int16_t select_table22[][9]; -extern const int16_t vals_a[][4]; /* value of leader element */ -extern const int16_t vals_q[][4]; /* code parameter for every leader */ -extern const uint16_t Is[]; /* codebook start address for every leader */ -extern const int16_t AA3[]; /* A3 - Number of the absolute leaders in codebook Q3 */ -extern const int16_t AA4[]; /* A4 - Number of the absolute leaders in codebook Q4 */ -extern const uint16_t II3[]; /* I3 - Cardinality offsets for absolute leaders in Q3 */ -extern const uint16_t II4[]; /* I4 - Cardinality offset for absolute leaders in Q4 */ -extern const int16_t Da_pos[]; /* Position of the first absolute leader on a spherical shell (or sphere) */ -extern const int16_t Da_nb[]; /* Number of absolute leaders on a spherical shell */ -extern const int16_t Da_id[]; /* identification code of an absolute leader */ -extern const int16_t Da_nq[]; /* Codebook number for each absolute leader */ +extern const Word16 select_table22[][9]; // Q0 +extern const Word16 vals_a[][4]; /* value of leader element */ // Q0 +extern const Word16 vals_q[][4]; /* code parameter for every leader */ // Q0 +extern const UWord16 Is[]; /* codebook start address for every leader */ // Q0 +extern const Word16 AA3[]; /* A3 - Number of the absolute leaders in codebook Q3 */ // Q0 +extern const Word16 AA4[]; /* A4 - Number of the absolute leaders in codebook Q4 */ // Q0 +extern const UWord16 II3[]; /* I3 - Cardinality offsets for absolute leaders in Q3 */ // Q0 +extern const UWord16 II4[]; /* I4 - Cardinality offset for absolute leaders in Q4 */ // Q0 +extern const Word16 Da_pos[]; /* Position of the first absolute leader on a spherical shell (or sphere) */ // Q0 +extern const Word16 Da_nb[]; /* Number of absolute leaders on a spherical shell */ // Q0 +extern const Word16 Da_id[]; /* identification code of an absolute leader */ // Q0 +extern const Word16 Da_nq[]; /* Codebook number for each absolute leader */ // Q0 /*------------------------------------------------------------------------------* * SWB TBE tables *------------------------------------------------------------------------------*/ -extern const int16_t skip_bands_SWB_TBE[]; /* bands for SWB TBE quantisation */ -extern const int16_t skip_bands_WB_TBE[]; /* bands for WB TBE quantisation */ +extern const Word16 skip_bands_SWB_TBE[]; /* bands for SWB TBE quantisation Q0*/ +extern const Word16 skip_bands_WB_TBE[]; /* bands for WB TBE quantisation Q0*/ extern const float interpol_frac_shb_flt[]; -extern const Word16 interpol_frac_shb[NB_SUBFR * 2]; +extern const Word16 interpol_frac_shb[NB_SUBFR * 2]; // Q15 extern const float AP1_STEEP[]; /* All pass filter coeffs for interpolation and decimation by a factor of 2 */ extern const float AP2_STEEP[]; /* All pass filter coeffs for interpolation and decimation by a factor of 2 */ -extern const Word16 AP1_STEEP_FX[]; /* All pass filter coeffs for interpolation and decimation by a factor of 2 */ -extern const Word16 AP2_STEEP_FX[]; /* All pass filter coeffs for interpolation and decimation by a factor of 2 */ +extern const Word16 AP1_STEEP_FX[]; // Q15 /* All pass filter coeffs for interpolation and decimation by a factor of 2 */ +extern const Word16 AP2_STEEP_FX[]; // Q15 /* All pass filter coeffs for interpolation and decimation by a factor of 2 */ extern const float STEPS[]; /* Granuality in conversion from lpc to lsp */ extern const float cos_fb_exc[]; -extern const Word16 cos_fb_exc_fx[32]; +extern const Word16 cos_fb_exc_fx[32]; // Q15 extern const float recip_order[]; extern const float win_lpc_shb[]; /* Window for calculating SHB LPC coeffs */ -extern const Word16 win_lpc_shb_fx[]; /* Window for calculating SHB LPC coeffs */ +extern const Word16 win_lpc_shb_fx[]; // Q15 /* Window for calculating SHB LPC coeffs */ extern const float win_lpc_hb_wb[]; -extern const Word16 win_lpc_hb_wb_fx[]; +extern const Word16 win_lpc_hb_wb_fx[]; // Q15 extern const float ola_win_shb_switch_fold[]; -extern const Word16 ola_win_shb_switch_fold_fx[]; -extern const float win_flatten[]; /* Window for calculating whitening filter for SHB excitation */ -extern const Word16 win_flatten_fx[]; -extern const float win_flatten_4k[]; /* Window for calculating whitening filter for WB excitation */ -extern const Word16 win_flatten_4k_fx[]; -extern const float window_shb[]; /* Overlap add window for SHB excitation used in anal and synth */ -extern const Word16 window_shb_fx[]; -extern const float window_shb_32k[]; /* Upsampled overlap add window for SHB excitation used transition generation */ -extern const Word16 window_shb_32k_fx[]; -extern const float subwin_shb[]; /* Short overlap add window for SHB excitation used in anal and synth */ -extern const Word16 subwin_shb_fx[]; /* Short overlap add window for SHB excitation used in anal and synth */ +extern const Word16 ola_win_shb_switch_fold_fx[]; // Q15 +extern const float win_flatten[]; /* Window for calculating whitening filter for SHB excitation */ +extern const Word16 win_flatten_fx[]; // Q15 +extern const float win_flatten_4k[]; /* Window for calculating whitening filter for WB excitation */ +extern const Word16 win_flatten_4k_fx[]; // Q15 +extern const float window_shb[]; /* Overlap add window for SHB excitation used in anal and synth */ +extern const Word16 window_shb_fx[]; // Q15 +extern const float window_shb_32k[]; /* Upsampled overlap add window for SHB excitation used transition generation */ +extern const Word16 window_shb_32k_fx[]; // Q15 +extern const float subwin_shb[]; /* Short overlap add window for SHB excitation used in anal and synth */ +extern const Word16 subwin_shb_fx[]; // Q15 /* Short overlap add window for SHB excitation used in anal and synth */ extern const float window_wb[]; -extern const float subwin_wb[]; /* Short overlap add window for SHB excitation used in anal and synth */ -extern const Word16 window_wb_fx[]; -extern const Word16 subwin_wb_fx[]; +extern const float subwin_wb[]; /* Short overlap add window for SHB excitation used in anal and synth */ +extern const Word16 window_wb_fx[]; // Q15 +extern const Word16 subwin_wb_fx[]; // Q15 extern const float Hilbert_coeffs[4 * NUM_HILBERTS][HILBERT_ORDER1 + 1]; -extern const Word16 Hilbert_coeffs_fx[4 * NUM_HILBERTS][HILBERT_ORDER1 + 1]; +extern const Word16 Hilbert_coeffs_fx[4 * NUM_HILBERTS][HILBERT_ORDER1 + 1]; // Q14 extern const float wac[]; extern const float wac_swb[]; -extern const Word16 wac_swb_h[]; -extern const Word16 wac_swb_l[]; +extern const Word16 wac_swb_h[]; // Q15 +extern const Word16 wac_swb_l[]; // Q15 extern const float wb_bwe_lsfvq_cbook_8bit[]; -extern const Word16 wb_bwe_lsfvq_cbook_8bit_fx[]; +extern const Word16 wb_bwe_lsfvq_cbook_8bit_fx[]; // Q15 extern const float lbr_wb_bwe_lsfvq_cbook_2bit[]; -extern const Word16 lbr_wb_bwe_lsfvq_cbook_2bit_fx[]; +extern const Word16 lbr_wb_bwe_lsfvq_cbook_2bit_fx[]; // Q15 extern const float swb_tbe_lsfvq_cbook_8b_flt[]; -extern const Word16 swb_tbe_lsfvq_cbook_8b[]; -extern const float SHBCB_SubGain5bit[]; /* 5 bit Quantizer table for SHB gain shapes */ -extern const Word16 SHBCB_SubGain5bit_fx[]; -extern const float HBCB_SubGain5bit[]; /* 5-bit TD WB BWE temporal shaping codebook */ -extern const Word16 HBCB_SubGain5bit_fx[]; -extern const float SHBCB_FrameGain64[]; /* 6 bit Quantizer table for SHB overall gain */ -extern const Word32 SHBCB_FrameGain64_fx[]; +extern const Word16 swb_tbe_lsfvq_cbook_8b[]; // Q15 +extern const float SHBCB_SubGain5bit[]; /* 5 bit Quantizer table for SHB gain shapes */ +extern const Word16 SHBCB_SubGain5bit_fx[]; // Q14 +extern const float HBCB_SubGain5bit[]; /* 5-bit TD WB BWE temporal shaping codebook */ +extern const Word16 HBCB_SubGain5bit_fx[]; // Q8 +extern const float SHBCB_FrameGain64[]; /* 6 bit Quantizer table for SHB overall gain */ +extern const Word32 SHBCB_FrameGain64_fx[]; // Q18 extern const float SHBCB_FrameGain16[]; -extern const Word32 SHBCB_FrameGain16_fx[]; +extern const Word32 SHBCB_FrameGain16_fx[]; /*Q18*/ extern const float full_band_bpf_1[][5]; extern const float full_band_bpf_2[][5]; extern const float full_band_bpf_3[][5]; -extern const Word16 full_band_bpf_1_fx[][5]; -extern const Word16 full_band_bpf_2_fx[][5]; -extern const Word16 full_band_bpf_3_fx[][5]; - -extern const float lsf_q_cb_4b[]; /* 4 bit differential scalar quantizer table for TD SWB BWE LSFs 1 and 2*/ -extern const float lsf_q_cb_3b[]; /* 3 bit differential scalar quantizer table for TD SWB BWE LSFs 3, 4 and 5*/ -extern const float *const lsf_q_cb[]; /* Codebook array for each LSF */ -extern const Word16 *const lsf_q_cb_fx[]; -extern const int16_t lsf_q_cb_size[]; /* Size of each element of the above */ -extern const int16_t lsf_q_num_bits[]; /* Size of each element of the above, in bits */ -extern const float mirror_point_q_cb[]; /* LSF mirroring point codebook */ -extern const Word16 mirror_point_q_cb_fx[]; -extern const float lsf_grid[4][5]; /* LSF mirroring adjustment grid */ -extern const Word16 lsf_grid_fx[4][5]; -extern const float grid_smoothing[]; /* LSF mirroring smoothing table */ -extern const Word16 grid_smoothing_fx[]; /* LSF mirroring smoothing table */ +extern const Word16 full_band_bpf_1_fx[][5]; /*Q13*/ +extern const Word16 full_band_bpf_2_fx[][5]; /*Q13*/ +extern const Word16 full_band_bpf_3_fx[][5]; /*Q13*/ +extern const float lsf_q_cb_4b[]; /* 4 bit differential scalar quantizer table for TD SWB BWE LSFs 1 and 2*/ +extern const float lsf_q_cb_3b[]; /* 3 bit differential scalar quantizer table for TD SWB BWE LSFs 3, 4 and 5*/ +extern const float *const lsf_q_cb[]; /* Codebook array for each LSF */ +extern const Word16 *const lsf_q_cb_fx[]; // Q15 +extern const Word16 lsf_q_cb_size[]; /* Size of each element of the above Q0*/ +extern const Word16 lsf_q_num_bits[]; /* Size of each element of the above, in bits Q0*/ +extern const float mirror_point_q_cb[]; /* LSF mirroring point codebook */ +extern const Word16 mirror_point_q_cb_fx[]; // Q15 +extern const float lsf_grid[4][5]; /* LSF mirroring adjustment grid */ +extern const Word16 lsf_grid_fx[4][5]; // Q15 +extern const float grid_smoothing[]; /* LSF mirroring smoothing table */ +extern const Word16 grid_smoothing_fx[]; /* LSF mirroring smoothing table Q15*/ extern const float overlap_coefs[]; /* HR SWB BWE - overlap coefficients */ extern const float overlap_coefs_48kHz[]; /* HR SWB BWE - overlap coefficients @48kHz */ @@ -943,16 +942,16 @@ extern const Word16 overlap_coefs_48kHz_fx[NSV_OVERLAP * WIDTH_BAND]; /* in Q15 extern const float swb_hr_env_code1[]; /* HR SWB BWE - envelope Q table - first two subabnds in non-transient frames */ extern const float swb_hr_env_code2[]; /* HR SWB BWE - envelope Q table - second two subabnds in non-transient frames*/ extern const float swb_hr_env_code3[]; /* HR SWB BWE - envelope Q table - two subabnds in transient frames */ -extern const Word16 swb_hr_env_code1_fx[]; /* HR SWB BWE - envelope Q table - first two subabnds in non-transient frames */ -extern const Word16 swb_hr_env_code2_fx[]; /* HR SWB BWE - envelope Q table - second two subabnds in non-transient frames*/ -extern const Word16 swb_hr_env_code3_fx[]; /* HR SWB BWE - envelope Q table - two subands in transient frames */ +extern const Word16 swb_hr_env_code1_fx[]; /* HR SWB BWE - envelope Q table - first two subabnds in non-transient frames Q9*/ +extern const Word16 swb_hr_env_code2_fx[]; /* HR SWB BWE - envelope Q table - second two subabnds in non-transient frames Q9*/ +extern const Word16 swb_hr_env_code3_fx[]; /* HR SWB BWE - envelope Q table - two subands in transient frames Q9*/ extern const float allpass_poles_3_ov_2_flt[]; -extern const Word16 allpass_poles_3_ov_2[]; +extern const Word16 allpass_poles_3_ov_2[]; /*Q15*/ extern const float decimate_3_ov_2_lowpass_num[]; -extern const Word16 decimate_3_ov_2_lowpass_num_fx[]; +extern const Word16 decimate_3_ov_2_lowpass_num_fx[]; /*Q15*/ extern const float decimate_3_ov_2_lowpass_den[]; -extern const Word16 decimate_3_ov_2_lowpass_den_fx[]; +extern const Word16 decimate_3_ov_2_lowpass_den_fx[]; /*Q15*/ /*------------------------------------------------------------------------------* @@ -960,57 +959,57 @@ extern const Word16 decimate_3_ov_2_lowpass_den_fx[]; *------------------------------------------------------------------------------*/ extern const float F_2_5[64]; -extern const Word16 F_2_5_fx[64]; +extern const Word16 F_2_5_fx[64]; /*Q10*/ /*------------------------------------------------------------------------------* * SWB BWE tables *------------------------------------------------------------------------------*/ -extern const int16_t swb_bwe_trans_subband[]; -extern const int16_t swb_bwe_trans_subband_width[]; +extern const Word16 swb_bwe_trans_subband[]; // Q0 +extern const Word16 swb_bwe_trans_subband_width[]; // Q0 -extern const Word16 sqrt_swb_bwe_trans_subband_width_fx[]; -extern const Word16 sqrt_swb_bwe_subband_fx_L1[]; -extern const Word16 sqrt_swb_bwe_subband_fx_L2[]; +extern const Word16 sqrt_swb_bwe_trans_subband_width_fx[]; // Q11 +extern const Word16 sqrt_swb_bwe_subband_fx_L1[]; // Q12 +extern const Word16 sqrt_swb_bwe_subband_fx_L2[]; // Q12 -extern const int16_t swb_bwe_subband[]; -extern const Word16 fb_bwe_subband[]; -extern const Word16 fb_bwe_sm_subband[]; +extern const Word16 swb_bwe_subband[]; // Q0 +extern const Word16 fb_bwe_subband[]; // Q0 +extern const Word16 fb_bwe_sm_subband[]; // Q0 extern const float swb_inv_bwe_subband_width[]; -extern const Word16 swb_inv_bwe_subband_width_fx[]; -extern const int16_t swb_bwe_sm_subband[]; +extern const Word16 swb_inv_bwe_subband_width_fx[]; // Q15 +extern const Word16 swb_bwe_sm_subband[]; // Q0 extern const float smooth_factor[]; -extern const Word16 smooth_factor_fx[]; -extern const int16_t fb_bwe_subband_float[]; +extern const Word16 smooth_factor_fx[]; // Q15 +extern const Word16 fb_bwe_subband_float[]; // Q0 extern const float fb_inv_bwe_subband_width[]; -extern const Word16 fb_inv_bwe_subband_width_fx[]; -extern const int16_t fb_bwe_sm_subband_float[]; +extern const Word16 fb_inv_bwe_subband_width_fx[]; // Q15 +extern const Word16 fb_bwe_sm_subband_float[]; // Q0 extern const float fb_smooth_factor[]; -extern const Word16 fb_smooth_factor_fx[]; +extern const Word16 fb_smooth_factor_fx[]; // Q15 extern const float EnvCdbk11[]; extern const float EnvCdbk1st[]; extern const float EnvCdbk2nd[]; extern const float EnvCdbk3rd[]; extern const float EnvCdbk4th[]; -extern const Word16 EnvCdbk11_fx[]; -extern const Word16 EnvCdbk1st_fx[]; -extern const Word16 EnvCdbk2nd_fx[]; -extern const Word16 EnvCdbk3rd_fx[]; -extern const Word16 EnvCdbk4th_fx[]; +extern const Word16 EnvCdbk11_fx[]; /*Q8 */ +extern const Word16 EnvCdbk1st_fx[]; /*Q8 */ +extern const Word16 EnvCdbk2nd_fx[]; /*Q8 */ +extern const Word16 EnvCdbk3rd_fx[]; /*Q8 */ +extern const Word16 EnvCdbk4th_fx[]; /*Q8 */ extern const float EnvCdbkFB[]; -extern const Word16 EnvCdbkFB_fx[]; +extern const Word16 EnvCdbkFB_fx[]; /*Q7 */ extern const float Env_TR_Cdbk1[]; extern const float Env_TR_Cdbk2[]; -extern const Word16 Env_TR_Cdbk1_fx[]; -extern const Word16 Env_TR_Cdbk2_fx[]; +extern const Word16 Env_TR_Cdbk1_fx[]; /*Q8 */ +extern const Word16 Env_TR_Cdbk2_fx[]; /*Q8 */ extern const float w_NOR[]; -extern const Word16 w_NOR_fx[]; +extern const Word16 w_NOR_fx[]; // Q15 extern const float Mean_env[]; -extern const Word16 Mean_env_fx[]; +extern const Word16 Mean_env_fx[]; // Q8 extern const float Mean_env_fb[]; -extern const Word16 Mean_env_fb_fx[]; +extern const Word16 Mean_env_fb_fx[]; /*Q8 */ extern const float Mean_env_tr[]; -extern const Word16 Mean_env_tr_fx[]; +extern const Word16 Mean_env_tr_fx[]; /*Q8 */ /*------------------------------------------------------------------------------* * ACEPL/HQ core switching tables *------------------------------------------------------------------------------*/ @@ -1020,18 +1019,18 @@ extern const float hp16000_32000[]; extern const float hp12800_48000[]; extern const float hp16000_48000[]; extern const float hp12800_16000[]; -extern const Word16 hp12800_32000_fx[]; -extern const Word16 hp16000_32000_fx[]; -extern const Word16 hp12800_48000_fx[]; -extern const Word16 hp16000_48000_fx[]; -extern const Word16 hp12800_16000_fx[]; +extern const Word16 hp12800_32000_fx[]; // Q15 +extern const Word16 hp16000_32000_fx[]; // Q15 +extern const Word16 hp12800_48000_fx[]; // Q15 +extern const Word16 hp16000_48000_fx[]; // Q15 +extern const Word16 hp12800_16000_fx[]; // Q15 extern const double cu15[28][3]; extern const double cu4[6][3]; -extern const Word16 cu15_fx[28][3]; -extern const Word16 cu4_fx[6][3]; -extern const int16_t ct2[7][13]; -extern const Word16 ct2_fx[7][14]; +extern const Word16 cu15_fx[28][3]; // Q13 +extern const Word16 cu4_fx[6][3]; // Q13 +extern const Word16 ct2[7][13]; // Q0 +extern const Word16 ct2_fx[7][14]; // Q13 /*------------------------------------------------------------------------------* * HQ core tables *------------------------------------------------------------------------------*/ @@ -1050,113 +1049,113 @@ extern const float short_window_48kHz[]; extern const float short_window_32kHz[]; extern const float short_window_16kHz[]; extern const float short_window_8kHz[]; -extern const Word16 short_window_48kHz_fx[L_FRAME48k / 2 / 2]; -extern const Word16 short_window_32kHz_fx[L_FRAME32k / 2 / 2]; -extern const Word16 short_window_16kHz_fx[L_FRAME16k / 2 / 2]; -extern const Word16 short_window_8kHz_fx[L_FRAME8k / 2 / 2]; -extern const Word16 inv_jp2[]; +extern const Word16 short_window_48kHz_fx[L_FRAME48k / 2 / 2]; // Q15 +extern const Word16 short_window_32kHz_fx[L_FRAME32k / 2 / 2]; // Q15 +extern const Word16 short_window_16kHz_fx[L_FRAME16k / 2 / 2]; // Q15 +extern const Word16 short_window_8kHz_fx[L_FRAME8k / 2 / 2]; // Q15 +extern const Word16 inv_jp2[]; // Q15 extern const float wscw16q15[]; extern const float wscw16q15_8[]; extern const float wscw16q15_16[]; extern const float wscw16q15_32[]; -extern const Word16 wscw16q15_fx[]; -extern const Word16 wscw16q15_8_fx[]; -extern const Word16 wscw16q15_16_fx[]; -extern const Word16 wscw16q15_32_fx[]; +extern const Word16 wscw16q15_fx[]; /*Q15 */ +extern const Word16 wscw16q15_8_fx[]; /*Q15 */ +extern const Word16 wscw16q15_16_fx[]; /*Q15 */ +extern const Word16 wscw16q15_32_fx[]; /*Q15 */ /* Band structure */ -extern const Word16 band_len_HQ[]; -extern const Word16 band_start_HQ[]; -extern const Word16 band_end_HQ[]; -extern const int16_t band_len_wb[]; -extern const int16_t band_start_wb[]; -extern const int16_t band_end_wb[]; -extern const int16_t band_len_harm_float[]; -extern const Word16 band_start_harm[]; -extern const Word16 band_end_harm[]; +extern const Word16 band_len_HQ[]; // Q0 +extern const Word16 band_start_HQ[]; // Q0 +extern const Word16 band_end_HQ[]; // Q0 +extern const Word16 band_len_wb[]; // Q0 +extern const Word16 band_start_wb[]; // Q0 +extern const Word16 band_end_wb[]; // Q0 +extern const Word16 band_len_harm_float[]; +extern const Word16 band_start_harm[]; // Q0 +extern const Word16 band_end_harm[]; // Q0 extern const float rat_flt[SFM_N_WB]; -extern const Word16 rat_fx[SFM_N_WB]; -extern const int16_t intl_bw_16[N_INTL_GRP_16]; -extern const int16_t intl_bw_32[N_INTL_GRP_32]; -extern const int16_t intl_bw_48[N_INTL_GRP_48]; -extern const int16_t intl_cnt_16[N_INTL_GRP_16]; -extern const int16_t intl_cnt_32[N_INTL_GRP_32]; -extern const int16_t intl_cnt_48[N_INTL_GRP_48]; -extern const int16_t norm_order_48[NB_SFM]; -extern const int16_t norm_order_32[SFM_N_SWB]; -extern const int16_t norm_order_16[SFM_N_WB]; +extern const Word16 rat_fx[SFM_N_WB]; // Q14 +extern const Word16 intl_bw_16[N_INTL_GRP_16]; // Q0 +extern const Word16 intl_bw_32[N_INTL_GRP_32]; // Q0 +extern const Word16 intl_bw_48[N_INTL_GRP_48]; // Q0 +extern const Word16 intl_cnt_16[N_INTL_GRP_16]; // Q0 +extern const Word16 intl_cnt_32[N_INTL_GRP_32]; // Q0 +extern const Word16 intl_cnt_48[N_INTL_GRP_48]; // Q0 +extern const Word16 norm_order_48[NB_SFM]; // Q0 +extern const Word16 norm_order_32[SFM_N_SWB]; // Q0 +extern const Word16 norm_order_16[SFM_N_WB]; // Q0 extern const float dicn_pg[45]; -extern const Word32 dicn_pg_fx[]; -extern const int16_t expPkEnrg_tbl[45]; -extern const int32_t manPkEnrg_tbl[45]; -extern const int32_t E_max5_tbl[40]; +extern const Word32 dicn_pg_fx[]; /*Q12 */ +extern const Word16 expPkEnrg_tbl[45]; // Q0 +extern const Word32 manPkEnrg_tbl[45]; // Q0 +extern const Word32 E_max5_tbl[40]; // Q0 extern const float thren_pg[44]; #ifdef IVAS_FLOAT_FIXED extern const Word32 thren_pg_fx[44]; #endif extern const float dicn[40]; -extern const Word32 dicn_fx[40]; +extern const Word32 dicn_fx[40]; /*Q14 */ extern const float dicn_inv[40]; extern const float thren_HQ[39]; #ifdef IVAS_FLOAT_FIXED -extern const Word32 thren_HQ_fx[39]; +extern const Word32 thren_HQ_fx[39]; /*Q14 */ #endif -extern const int16_t dicnlg2_float[40]; -extern const int16_t huffnorm[32]; -extern const int16_t huffsizn[32]; -extern const int16_t huffcoef[60]; -extern const int16_t pgain_huffnorm[32]; -extern const int16_t pgain_huffsizn[32]; +extern const Word16 dicnlg2_float[40]; // Q0 +extern const Word16 huffnorm[32]; // Q0 +extern const Word16 huffsizn[32]; // Q0 +extern const Word16 huffcoef[60]; // Q0 +extern const Word16 pgain_huffnorm[32]; // Q0 +extern const Word16 pgain_huffsizn[32]; // Q0 -extern const int16_t resize_huffnorm[32]; -extern const int16_t resize_huffsizn[32]; +extern const Word16 resize_huffnorm[32]; // Q0 +extern const Word16 resize_huffsizn[32]; // Q) -extern const int16_t huffnorm_tran[32]; -extern const int16_t huffsizn_tran[32]; +extern const Word16 huffnorm_tran[32]; // Q0 +extern const Word16 huffsizn_tran[32]; // Q0 -extern const int16_t sfm_width[20]; -extern const int16_t a_map[20]; -extern const int16_t subf_norm_groups[4][11]; +extern const Word16 sfm_width[20]; // Q0 +extern const Word16 a_map[20]; // Q0 +extern const Word16 subf_norm_groups[4][11]; // Q0 -extern const Word32 SQRT_DIM_fx[]; +extern const Word32 SQRT_DIM_fx[]; // Q15 /* HQ inner_frame signallisation table */ -extern const int16_t inner_frame_tbl[]; -extern const Word16 hq_nominal_scaling_inv[]; -extern const Word16 hq_nominal_scaling[]; +extern const Word16 inner_frame_tbl[]; // Q0 +extern const Word16 hq_nominal_scaling_inv[]; // Q13 +extern const Word16 hq_nominal_scaling[]; /*Q15 */ /* HQ spectrum length lookup tables */ -extern const int16_t l_spec_tbl[]; -extern const int16_t l_spec_ext_tbl[]; -extern const Word16 sinq_16k[]; -extern const Word16 sinq_32k[]; -extern const Word16 sinq_48k[]; +extern const Word16 l_spec_tbl[]; // Q0 +extern const Word16 l_spec_ext_tbl[]; // Q0 +extern const Word16 sinq_16k[]; /*Q15 */ +extern const Word16 sinq_32k[]; /*Q15 */ +extern const Word16 sinq_48k[]; /*Q15 */ /* NB short win: 7200/8000/9600, 13200/16400 */ -extern const int16_t band_width_40_4_6_0_0_0[4]; -extern const int16_t band_width_40_5_6_0_0_0[5]; +extern const Word16 band_width_40_4_6_0_0_0[4]; // Q0 +extern const Word16 band_width_40_5_6_0_0_0[5]; // Q0 /* NB long win: 7200, 8000, 9600, 13200, 16400 */ -extern const int16_t band_width_160_18_6_4_0_0[18]; -extern const int16_t band_width_160_17_6_3_0_0[17]; -extern const int16_t band_width_160_14_6_3_0_0[14]; -extern const int16_t band_width_160_13_6_2_0_0[13]; +extern const Word16 band_width_160_18_6_4_0_0[18]; // Q0 +extern const Word16 band_width_160_17_6_3_0_0[17]; // Q0 +extern const Word16 band_width_160_14_6_3_0_0[14]; // Q0 +extern const Word16 band_width_160_13_6_2_0_0[13]; // Q0 /* WB short win: 13200/16400 */ -extern const int16_t band_width_80_7_6_0_0_0[7]; +extern const Word16 band_width_80_7_6_0_0_0[7]; // Q0 /* WB long win: 13200, 16400 */ -extern const int16_t band_width_320_18_6_3_0_0[18]; -extern const int16_t band_width_320_20_6_3_0_0[20]; +extern const Word16 band_width_320_18_6_3_0_0[18]; // Q0 +extern const Word16 band_width_320_20_6_3_0_0[20]; // Q0 /* SWB short win: 13200, 16400 */ -extern const int16_t band_width_142_8_8_0_0_0[8]; -extern const int16_t band_width_160_8_8_0_0_0[8]; +extern const Word16 band_width_142_8_8_0_0_0[8]; // Q0 +extern const Word16 band_width_160_8_8_0_0_0[8]; // Q0 /* SWB long win: 13200, 16400 */ -extern const int16_t band_width_568_22_6_2_0_0[22]; -extern const int16_t band_width_640_24_6_4_0_0[24]; +extern const Word16 band_width_568_22_6_2_0_0[22]; // Q0 +extern const Word16 band_width_640_24_6_4_0_0[24]; // Q0 /* LR-MDCT configuration tables */ extern const Xcore_Config xcore_config_8kHz_007200bps_long; @@ -1182,136 +1181,136 @@ extern const Xcore_Config xcore_config_32kHz_013200bps_short; extern const Xcore_Config xcore_config_32kHz_016400bps_short; -extern const int16_t Nb[NB_SFM]; -extern const int16_t LNb[NB_SFM]; +extern const Word16 Nb[NB_SFM]; // Q0 +extern const Word16 LNb[NB_SFM]; // Q0 -extern const Word32 pow_getbitsfrompulses_fx[16]; -extern const Word32 table_logcum_fx[563]; -extern const Word16 DDP_fx[4]; +extern const Word32 pow_getbitsfrompulses_fx[16]; // Q21 +extern const Word32 table_logcum_fx[563]; // Q16 +extern const Word16 DDP_fx[4]; // Q0 extern const float DDP[4]; -extern const int16_t step_tcq[8][STATES]; -extern const int16_t denc[8][STATES]; -extern const int16_t ddec[8][STATES]; +extern const Word16 step_tcq[8][STATES]; // Q0 +extern const Word16 denc[8][STATES]; // Q0 +extern const Word16 ddec[8][STATES]; // Q0 -extern const int16_t step_LSB[STATES_LSB][2]; -extern const int16_t denc_LSB[STATES_LSB][2]; -extern const int16_t dqnt_LSB[STATES_LSB][4]; -extern const int16_t dstep_LSB[4][2]; -extern const int16_t ddec_LSB[4][2]; +extern const Word16 step_LSB[STATES_LSB][2]; // Q0 +extern const Word16 denc_LSB[STATES_LSB][2]; // Q0 +extern const Word16 dqnt_LSB[STATES_LSB][4]; // Q0 +extern const Word16 dstep_LSB[4][2]; // Q0 +extern const Word16 ddec_LSB[4][2]; // Q0 -extern const int16_t nextstate[STATES][2]; +extern const Word16 nextstate[STATES][2]; // Q0 -extern const int16_t fine_gain_bits[]; +extern const Word16 fine_gain_bits[]; // Q0 extern const float *const finegain[]; -extern const Word16 *finegain_fx[5]; -extern const uint8_t hBitsMinus1_N01[2]; -extern const uint8_t hBitsMinus1_N02[65]; -extern const uint8_t hBitsMinus1_N03[65]; -extern const uint8_t hBitsMinus1_N04[65]; -extern const uint8_t hBitsMinus1_N05[54]; -extern const uint8_t hBitsMinus1_N06[42]; -extern const uint8_t hBitsMinus1_N07[34]; -extern const uint8_t hBitsMinus1_N08[29]; -extern const uint8_t hBitsMinus1_N09[25]; -extern const uint8_t hBitsMinus1_N10[22]; -extern const uint8_t hBitsMinus1_N11[19]; -extern const uint8_t hBitsMinus1_N12[17]; -extern const uint8_t hBitsMinus1_N13[16]; -extern const uint8_t hBitsMinus1_N14[14]; -extern const uint8_t hBitsMinus1_N15[13]; -extern const uint8_t hBitsMinus1_N16[13]; -extern const uint8_t hBitsMinus1_N17[12]; -extern const uint8_t hBitsMinus1_N18[12]; -extern const uint8_t hBitsMinus1_N19[11]; -extern const uint8_t hBitsMinus1_N20[11]; -extern const uint8_t hBitsMinus1_N21[10]; -extern const uint8_t hBitsMinus1_N22[10]; -extern const uint8_t hBitsMinus1_N23[10]; -extern const uint8_t hBitsMinus1_N24[10]; -extern const uint8_t hBitsMinus1_N25[9]; -extern const uint8_t hBitsMinus1_N26[9]; -extern const uint8_t hBitsMinus1_N27[9]; -extern const uint8_t hBitsMinus1_N28[9]; -extern const uint8_t hBitsMinus1_N29[9]; -extern const uint8_t hBitsMinus1_N30[8]; -extern const uint8_t hBitsMinus1_N31[8]; -extern const uint8_t hBitsMinus1_N32[8]; -extern const uint8_t hBitsMinus1_N33[8]; -extern const uint8_t hBitsMinus1_N34[8]; -extern const uint8_t hBitsMinus1_N35[8]; -extern const uint8_t hBitsMinus1_N36[8]; -extern const uint8_t hBitsMinus1_N37[8]; -extern const uint8_t hBitsMinus1_N38[8]; -extern const uint8_t hBitsMinus1_N39[8]; -extern const uint8_t hBitsMinus1_N40[8]; -extern const uint8_t hBitsMinus1_N41[7]; -extern const uint8_t hBitsMinus1_N42[7]; -extern const uint8_t hBitsMinus1_N43[7]; -extern const uint8_t hBitsMinus1_N44[7]; -extern const uint8_t hBitsMinus1_N45[7]; -extern const uint8_t hBitsMinus1_N46[7]; -extern const uint8_t hBitsMinus1_N47[7]; -extern const uint8_t hBitsMinus1_N48[7]; -extern const uint8_t hBitsMinus1_N49[7]; -extern const uint8_t hBitsMinus1_N50[7]; -extern const uint8_t hBitsMinus1_N51[7]; -extern const uint8_t hBitsMinus1_N52[7]; -extern const uint8_t hBitsMinus1_N53[7]; -extern const uint8_t hBitsMinus1_N54[7]; -extern const uint8_t hBitsMinus1_N55[7]; -extern const uint8_t hBitsMinus1_N56[7]; -extern const uint8_t hBitsMinus1_N57[7]; -extern const uint8_t hBitsMinus1_N58[7]; -extern const uint8_t hBitsMinus1_N59[7]; -extern const uint8_t hBitsMinus1_N60[7]; -extern const uint8_t hBitsMinus1_N61[6]; -extern const uint8_t hBitsMinus1_N62[6]; -extern const uint8_t hBitsMinus1_N63[6]; -extern const uint8_t hBitsMinus1_N64[6]; -extern const uint8_t *const hBitsN[65]; -extern const int16_t dsHighDiracsTab[43]; -extern const uint32_t intLimCDivInvDQ31[68]; -extern const uint8_t obtainEnergyQuantizerDensity_f[57]; -extern const int16_t lim_neg_inv_tbl_fx[11]; -extern const int16_t fg_inv_tbl_fx[13]; +extern const Word16 *finegain_fx[5]; /* Q14 */ +extern const UWord8 hBitsMinus1_N01[2]; // Q0 +extern const UWord8 hBitsMinus1_N02[65]; // Q0 +extern const UWord8 hBitsMinus1_N03[65]; // Q0 +extern const UWord8 hBitsMinus1_N04[65]; // Q0 +extern const UWord8 hBitsMinus1_N05[54]; // Q0 +extern const UWord8 hBitsMinus1_N06[42]; // Q0 +extern const UWord8 hBitsMinus1_N07[34]; // Q0 +extern const UWord8 hBitsMinus1_N08[29]; // Q0 +extern const UWord8 hBitsMinus1_N09[25]; // Q0 +extern const UWord8 hBitsMinus1_N10[22]; // Q0 +extern const UWord8 hBitsMinus1_N11[19]; // Q0 +extern const UWord8 hBitsMinus1_N12[17]; // Q0 +extern const UWord8 hBitsMinus1_N13[16]; // Q0 +extern const UWord8 hBitsMinus1_N14[14]; // Q0 +extern const UWord8 hBitsMinus1_N15[13]; // Q0 +extern const UWord8 hBitsMinus1_N16[13]; // Q0 +extern const UWord8 hBitsMinus1_N17[12]; // Q0 +extern const UWord8 hBitsMinus1_N18[12]; // Q0 +extern const UWord8 hBitsMinus1_N19[11]; // Q0 +extern const UWord8 hBitsMinus1_N20[11]; // Q0 +extern const UWord8 hBitsMinus1_N21[10]; // Q0 +extern const UWord8 hBitsMinus1_N22[10]; // Q0 +extern const UWord8 hBitsMinus1_N23[10]; // Q0 +extern const UWord8 hBitsMinus1_N24[10]; // Q0 +extern const UWord8 hBitsMinus1_N25[9]; // Q0 +extern const UWord8 hBitsMinus1_N26[9]; // Q0 +extern const UWord8 hBitsMinus1_N27[9]; // Q0 +extern const UWord8 hBitsMinus1_N28[9]; // Q0 +extern const UWord8 hBitsMinus1_N29[9]; // Q0 +extern const UWord8 hBitsMinus1_N30[8]; // Q0 +extern const UWord8 hBitsMinus1_N31[8]; // Q0 +extern const UWord8 hBitsMinus1_N32[8]; // Q0 +extern const UWord8 hBitsMinus1_N33[8]; // Q0 +extern const UWord8 hBitsMinus1_N34[8]; // Q0 +extern const UWord8 hBitsMinus1_N35[8]; // Q0 +extern const UWord8 hBitsMinus1_N36[8]; // Q0 +extern const UWord8 hBitsMinus1_N37[8]; // Q0 +extern const UWord8 hBitsMinus1_N38[8]; // Q0 +extern const UWord8 hBitsMinus1_N39[8]; // Q0 +extern const UWord8 hBitsMinus1_N40[8]; // Q0 +extern const UWord8 hBitsMinus1_N41[7]; // Q0 +extern const UWord8 hBitsMinus1_N42[7]; // Q0 +extern const UWord8 hBitsMinus1_N43[7]; // Q0 +extern const UWord8 hBitsMinus1_N44[7]; // Q0 +extern const UWord8 hBitsMinus1_N45[7]; // Q0 +extern const UWord8 hBitsMinus1_N46[7]; // Q0 +extern const UWord8 hBitsMinus1_N47[7]; // Q0 +extern const UWord8 hBitsMinus1_N48[7]; // Q0 +extern const UWord8 hBitsMinus1_N49[7]; // Q0 +extern const UWord8 hBitsMinus1_N50[7]; // Q0 +extern const UWord8 hBitsMinus1_N51[7]; // Q0 +extern const UWord8 hBitsMinus1_N52[7]; // Q0 +extern const UWord8 hBitsMinus1_N53[7]; // Q0 +extern const UWord8 hBitsMinus1_N54[7]; // Q0 +extern const UWord8 hBitsMinus1_N55[7]; // Q0 +extern const UWord8 hBitsMinus1_N56[7]; // Q0 +extern const UWord8 hBitsMinus1_N57[7]; // Q0 +extern const UWord8 hBitsMinus1_N58[7]; // Q0 +extern const UWord8 hBitsMinus1_N59[7]; // Q0 +extern const UWord8 hBitsMinus1_N60[7]; // Q0 +extern const UWord8 hBitsMinus1_N61[6]; // Q0 +extern const UWord8 hBitsMinus1_N62[6]; // Q0 +extern const UWord8 hBitsMinus1_N63[6]; // Q0 +extern const UWord8 hBitsMinus1_N64[6]; // Q0 +extern const UWord8 *const hBitsN[65]; // Q0 +extern const Word16 dsHighDiracsTab[43]; // Q0 +extern const UWord32 intLimCDivInvDQ31[68]; // Q0 +extern const UWord8 obtainEnergyQuantizerDensity_f[57]; // Q0 +extern const Word16 lim_neg_inv_tbl_fx[11]; // Q0 +extern const Word16 fg_inv_tbl_fx[13]; // Q0 /* functions and tables for pvq_indexing */ -extern const uint32_t exactdivodd[ODD_DIV_SIZE]; +extern const UWord32 exactdivodd[ODD_DIV_SIZE]; // Q0 extern const float gain_att[]; -extern const Word16 gain_att_fx[40]; +extern const Word16 gain_att_fx[40]; // Q15 extern const float att_step[]; -extern const Word16 att_step_fx[4]; +extern const Word16 att_step_fx[4]; // Q13 extern const float gain_qlow[]; extern const int16_t gain_cb_size[]; extern const float stab_trans[]; -extern const Word16 stab_trans_fx[]; +extern const Word16 stab_trans_fx[]; // Q15 extern const float env_stab_tp[2][2]; -extern const Word16 env_stab_tp_fx[2][2]; +extern const Word16 env_stab_tp_fx[2][2]; // Q15 /*----------------------------------------------------------------------------------* * SWB BWE for LR MDCT core *----------------------------------------------------------------------------------*/ extern const float gain_table_SWB_BWE[NB_SWB_SUBBANDS]; -extern const Word16 gain_table_SWB_BWE_fx[NB_SWB_SUBBANDS]; +extern const Word16 gain_table_SWB_BWE_fx[NB_SWB_SUBBANDS]; /*Q14 */ /* HQ_NORMAL mode */ -extern const int16_t bits_lagIndices_modeNormal[NB_SWB_SUBBANDS]; -extern const int16_t subband_offsets_12KBPS[NB_SWB_SUBBANDS]; -extern const int16_t subband_offsets_16KBPS[NB_SWB_SUBBANDS]; -extern const int16_t subband_search_offsets[NB_SWB_SUBBANDS]; +extern const Word16 bits_lagIndices_modeNormal[NB_SWB_SUBBANDS]; // Q0 +extern const Word16 subband_offsets_12KBPS[NB_SWB_SUBBANDS]; // Q0 +extern const Word16 subband_offsets_16KBPS[NB_SWB_SUBBANDS]; // Q0 +extern const Word16 subband_search_offsets[NB_SWB_SUBBANDS]; // Q0 -extern const int16_t bw_SPT_tbl[2][SPT_SHORTEN_SBNUM]; +extern const Word16 bw_SPT_tbl[2][SPT_SHORTEN_SBNUM]; // Q0 /* HQ_HARMONIC mode */ -extern const int16_t bits_lagIndices_mode0_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB]; +extern const Word16 bits_lagIndices_mode0_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB]; // Q0 -extern const int16_t subband_offsets_sub5_13p2kbps_Har[NB_SWB_SUBBANDS_HAR]; -extern const int16_t subband_search_offsets_13p2kbps_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB]; -extern const int16_t subband_offsets_sub5_16p4kbps_Har[NB_SWB_SUBBANDS_HAR]; -extern const int16_t subband_search_offsets_16p4kbps_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB]; +extern const Word16 subband_offsets_sub5_13p2kbps_Har[NB_SWB_SUBBANDS_HAR]; // Q0 +extern const Word16 subband_search_offsets_13p2kbps_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB]; // Q0 +extern const Word16 subband_offsets_sub5_16p4kbps_Har[NB_SWB_SUBBANDS_HAR]; // Q0 +extern const Word16 subband_search_offsets_16p4kbps_Har[NB_SWB_SUBBANDS_HAR_SEARCH_SB]; // Q0 /*----------------------------------------------------------------------------------* * SC-VBR @@ -1319,46 +1318,46 @@ extern const int16_t subband_search_offsets_16p4kbps_Har[NB_SWB_SUBBANDS_HAR_SEA /* NELP filter coefficients */ extern const float bp1_num_coef_wb[5]; -extern const Word16 bp1_num_coef_wb_fx[5]; +extern const Word16 bp1_num_coef_wb_fx[5]; /* Q14 */ extern const float bp1_den_coef_wb[5]; -extern const Word16 bp1_den_coef_wb_fx[5]; +extern const Word16 bp1_den_coef_wb_fx[5]; /* Q14 */ extern const float shape1_num_coef[11]; -extern const Word16 shape1_num_coef_fx[11]; +extern const Word16 shape1_num_coef_fx[11]; /* Q15 */ extern const float shape1_den_coef[11]; -extern const Word16 shape1_den_coef_fx[11]; +extern const Word16 shape1_den_coef_fx[11]; /* Q15 */ extern const float shape2_num_coef[11]; -extern const Word16 shape2_num_coef_fx[11]; +extern const Word16 shape2_num_coef_fx[11]; /* Q15 */ extern const float shape2_den_coef[11]; -extern const Word16 shape2_den_coef_fx[11]; +extern const Word16 shape2_den_coef_fx[11]; /* Q15 */ extern const float shape3_num_coef[11]; -extern const Word16 shape3_num_coef_fx[11]; +extern const Word16 shape3_num_coef_fx[11]; /* Q15 */ extern const float shape3_den_coef[11]; -extern const Word16 shape3_den_coef_fx[11]; +extern const Word16 shape3_den_coef_fx[11]; /* Q15 */ extern const float txlpf1_num_coef[11]; -extern const Word16 txlpf1_num_coef_fx[11]; +extern const Word16 txlpf1_num_coef_fx[11]; /* Q13 */ extern const float txlpf1_den_coef[11]; -extern const Word16 txlpf1_den_coef_fx[11]; +extern const Word16 txlpf1_den_coef_fx[11]; /* Q13 */ extern const float txhpf1_num_coef[11]; -extern const Word16 txhpf1_num_coef_fx[11]; +extern const Word16 txhpf1_num_coef_fx[11]; /* Q13 */ extern const float txhpf1_den_coef[11]; -extern const Word16 txhpf1_den_coef_fx[11]; +extern const Word16 txhpf1_den_coef_fx[11]; /* Q13 */ extern const float bp1_num_coef_nb_fx_order7_flt[8]; -extern const Word16 bp1_num_coef_nb_fx_order7[8]; +extern const Word16 bp1_num_coef_nb_fx_order7[8]; /* Q13 */ extern const float bp1_den_coef_nb_fx_order7_flt[8]; -extern const Word16 bp1_den_coef_nb_fx_order7[8]; +extern const Word16 bp1_den_coef_nb_fx_order7[8]; /* Q13 */ extern const float num_nelp_lp[NELP_LP_ORDER + 1]; extern const float den_nelp_lp[NELP_LP_ORDER + 1]; @@ -1367,37 +1366,37 @@ extern const float UVG1CB_WB[UVG1_CBSIZE][2]; extern const float UVG2CB1_WB[UVG2_CBSIZE][5]; extern const float UVG2CB2_WB[UVG2_CBSIZE][5]; -extern const Word16 UVG1CB_WB_FX[UVG1_CBSIZE][2]; -extern const Word16 UVG2CB1_WB_FX[UVG2_CBSIZE][5]; -extern const Word16 UVG2CB2_WB_FX[UVG2_CBSIZE][5]; +extern const Word16 UVG1CB_WB_FX[UVG1_CBSIZE][2]; /* Q13 */ +extern const Word16 UVG2CB1_WB_FX[UVG2_CBSIZE][5]; /* Q12 */ +extern const Word16 UVG2CB2_WB_FX[UVG2_CBSIZE][5]; /* Q12 */ extern const float UVG1CB_NB[UVG1_CBSIZE][2]; extern const float UVG2CB1_NB[UVG2_CBSIZE][5]; extern const float UVG2CB2_NB[UVG2_CBSIZE][5]; -extern const Word16 UVG1CB_NB_FX[UVG1_CBSIZE][2]; -extern const Word16 UVG2CB1_NB_FX[UVG2_CBSIZE][5]; -extern const Word16 UVG2CB2_NB_FX[UVG2_CBSIZE][5]; +extern const Word16 UVG1CB_NB_FX[UVG1_CBSIZE][2]; /* Q13 */ +extern const Word16 UVG2CB1_NB_FX[UVG2_CBSIZE][5]; /* Q12 */ +extern const Word16 UVG2CB2_NB_FX[UVG2_CBSIZE][5]; /* Q12 */ extern const float frac_4sf[NB_SUBFR + 2]; -extern const Word16 frac_4sf_fx[NB_SUBFR + 2]; +extern const Word16 frac_4sf_fx[NB_SUBFR + 2]; /* Q4 */ extern const float erb_WB[NUM_ERB_WB + 1]; extern const float erb_NB[NUM_ERB_NB + 1]; -extern const Word16 erb_WB_fx[NUM_ERB_WB + 1]; -extern const Word16 erb_NB_fx[NUM_ERB_NB + 1]; +extern const Word16 erb_WB_fx[NUM_ERB_WB + 1]; // Q(log2(2.56) +extern const Word16 erb_NB_fx[NUM_ERB_NB + 1]; // Q(log2(2.56) extern const float AmpCB1_WB[64][10]; -extern const Word16 AmpCB1_WB_fx[640]; +extern const Word16 AmpCB1_WB_fx[640]; // Q13 extern const float AmpCB2_WB[64][NUM_ERB_WB - 11]; -extern const Word16 AmpCB2_WB_fx[64 * ( NUM_ERB_WB - 13 )]; +extern const Word16 AmpCB2_WB_fx[64 * ( NUM_ERB_WB - 13 )]; // Q13 extern const float AmpCB1_NB[64][10]; -extern const Word16 AmpCB1_NB_fx[640]; +extern const Word16 AmpCB1_NB_fx[640]; // Q13 extern const float AmpCB2_NB[64][NUM_ERB_NB - 11]; -extern const Word16 AmpCB2_NB_fx[64 * ( NUM_ERB_NB - 13 )]; +extern const Word16 AmpCB2_NB_fx[64 * ( NUM_ERB_NB - 13 )]; // Q13 extern const float PowerCB_WB[64][2]; extern const float PowerCB_NB[64][2]; @@ -1407,153 +1406,153 @@ extern const float sinc[8][12]; extern const Word16 sinc_fx[8][12]; extern const float hvq_thr_adj[5]; -extern const Word16 hvq_thr_adj_fx[5]; +extern const Word16 hvq_thr_adj_fx[5]; /* Q15 */ extern const Word16 hvq_index_mapping_fx[4]; extern const float hvq_peak_cb[1024]; -extern const Word16 hvq_peak_cb_fx[]; +extern const Word16 hvq_peak_cb_fx[]; /* Q15 */ extern const float hvq_class_c[16]; -extern const Word16 hvq_class_c_fx[16]; -extern const int16_t hvq_cb_search_overlap24k[17]; -extern const int16_t hvq_cb_search_overlap32k[21]; +extern const Word16 hvq_class_c_fx[16]; /* Q15 */ +extern const Word16 hvq_cb_search_overlap24k[17]; // Q0 +extern const Word16 hvq_cb_search_overlap32k[21]; // Q0 -extern const int16_t hvq_pg_huff_offset[NUM_PG_HUFFLEN]; -extern const int16_t hvq_pg_huff_thres[NUM_PG_HUFFLEN]; -extern const int16_t hvq_pg_huff_tab[32]; +extern const Word16 hvq_pg_huff_offset[NUM_PG_HUFFLEN]; // Q0 +extern const Word16 hvq_pg_huff_thres[NUM_PG_HUFFLEN]; // Q0 +extern const Word16 hvq_pg_huff_tab[32]; // Q0 -extern const int16_t hvq_cp_huff_len[52]; -extern const int16_t hvq_cp_huff_val[52]; -extern const int16_t hvq_cp_layer1_map5[HVQ_CP_MAP_LEN]; +extern const Word16 hvq_cp_huff_len[52]; // Q0 +extern const Word16 hvq_cp_huff_val[52]; // Q0 +extern const Word16 hvq_cp_layer1_map5[HVQ_CP_MAP_LEN]; // Q0 -extern const int16_t hvq_cp_huff_thres[HVQ_CP_HUFF_NUM_LEN]; -extern const int16_t hvq_cp_huff_offset[HVQ_CP_HUFF_NUM_LEN]; -extern const int16_t hvq_cp_huff_tab[52]; +extern const Word16 hvq_cp_huff_thres[HVQ_CP_HUFF_NUM_LEN]; // Q0 +extern const Word16 hvq_cp_huff_offset[HVQ_CP_HUFF_NUM_LEN]; // Q0 +extern const Word16 hvq_cp_huff_tab[52]; // Q0 /*------------------------------------------------------------------------------* * GSC mode *------------------------------------------------------------------------------*/ extern const float sin_table256[]; -extern const Word16 sin_table256_fx[]; -extern const int16_t gsc_sfm_start[]; -extern const int16_t gsc_sfm_end[]; -extern const int16_t gsc_sfm_size[]; +extern const Word16 sin_table256_fx[]; // Q15 +extern const Word16 gsc_sfm_start[]; // Q0 +extern const Word16 gsc_sfm_end[]; // Q0 +extern const Word16 gsc_sfm_size[]; // Q0 extern const float sm_table[]; -extern const Word16 sm_table_fx[]; +extern const Word16 sm_table_fx[]; // Q15 extern const float mfreq_loc[]; -extern const int16_t mfreq_bindiv_loc[]; +extern const Word16 mfreq_bindiv_loc[]; // Q0 extern const float mean_gp[]; -extern const Word16 mean_gp_fx[]; +extern const Word16 mean_gp_fx[]; /*Q14*/ extern const float dic_gp[]; -extern const Word16 dic_gp_fx[]; +extern const Word16 dic_gp_fx[]; /*Q14*/ extern const float Gain_mean[]; extern const float Gain_meanHR[]; extern const float Gain_mean_dic[]; extern const float Gain_mean_dicHR[]; extern const float YG_mean16[]; -extern const Word16 YG_mean16_fx[]; +extern const Word16 YG_mean16_fx[]; /*Q12 */ extern const float YG_dicMR_1[]; extern const float YG_dicMR_2[]; extern const float YG_dicMR_3[]; extern const float YG_dicMR_4[]; -extern const Word16 YG_dicMR_1_fx[]; -extern const Word16 YG_dicMR_2_fx[]; -extern const Word16 YG_dicMR_3_fx[]; -extern const Word16 YG_dicMR_4_fx[]; +extern const Word16 YG_dicMR_1_fx[]; /*Q12 */ +extern const Word16 YG_dicMR_2_fx[]; /*Q12 */ +extern const Word16 YG_dicMR_3_fx[]; /*Q12 */ +extern const Word16 YG_dicMR_4_fx[]; /*Q12 */ extern const float mean_m[]; -extern const Word16 mean_m_fx[]; +extern const Word16 mean_m_fx[]; /*Q12 */ extern const float mean_gain_dic[]; -extern const Word16 mean_gain_dic_fx[]; +extern const Word16 mean_gain_dic_fx[]; /*Q12 */ extern const float YGain_mean_LR[]; -extern const Word16 YGain_mean_LR_fx[]; +extern const Word16 YGain_mean_LR_fx[]; /* Q12 */ extern const float YGain_dic1_LR[]; extern const float YGain_dic2_LR[]; extern const float YGain_dic3_LR[]; -extern const Word16 YGain_dic1_LR_fx[]; -extern const Word16 YGain_dic2_LR_fx[]; /*Q13 */ -extern const Word16 YGain_dic3_LR_fx[]; /*Q13 */ +extern const Word16 YGain_dic1_LR_fx[]; /* Q12 */ +extern const Word16 YGain_dic2_LR_fx[]; /*Q12 */ +extern const Word16 YGain_dic3_LR_fx[]; /*Q12 */ extern const float Gain_dic2_NBHR[]; extern const float Gain_dic3_NBHR[]; -extern const Word16 Gain_dic3_NBHR_fx[]; -extern const Word16 Gain_dic2_NBHR_fx[]; +extern const Word16 Gain_dic3_NBHR_fx[]; /*Q12 */ +extern const Word16 Gain_dic2_NBHR_fx[]; /*Q12 */ extern const float YG_mean16HR[]; -extern const Word16 YG_mean16HR_fx[]; +extern const Word16 YG_mean16HR_fx[]; /* Q12 */ extern const float YG_dicHR_1[]; -extern const Word16 YG_dicHR_1_fx[]; +extern const Word16 YG_dicHR_1_fx[]; /* Q12 */ extern const float YG_dicHR_2[]; -extern const Word16 YG_dicHR_2_fx[]; +extern const Word16 YG_dicHR_2_fx[]; /* Q12 */ extern const float YG_dicHR_3[]; -extern const Word16 YG_dicHR_3_fx[]; +extern const Word16 YG_dicHR_3_fx[]; /* Q12 */ extern const float YG_mean16HR_16kHz[]; -extern const Word16 YG_mean16HR_16kHz_fx[]; +extern const Word16 YG_mean16HR_16kHz_fx[]; /* Q12 */ extern const float YG_dicHR_4_16kHz[]; -extern const Word16 YG_dicHR_4_16kHz_fx[]; +extern const Word16 YG_dicHR_4_16kHz_fx[]; /* Q12 */ extern const float YG_meanL2G_16kHz[]; -extern const Word16 YG_meanL2G_16kHz_fx[]; +extern const Word16 YG_meanL2G_16kHz_fx[]; /* Q12 */ extern const float YG_dicL2G_16kHz[]; -extern const Word16 YG_dicL2G_16kHz_fx[]; -extern const int16_t GSC_freq_bits[]; -extern const Word32 GSC_freq_bits_fx[]; -extern const Word32 GSC_freq_bits_fx_Q18[]; -extern const int16_t GSC_freq_DL0_bits[]; -extern const int16_t Compl_GSC_freq_bits[]; +extern const Word16 YG_dicL2G_16kHz_fx[]; /* Q12 */ +extern const Word16 GSC_freq_bits[]; // Q0 +extern const Word32 GSC_freq_bits_fx[]; /*Q18*/ +extern const Word32 GSC_freq_bits_fx_Q18[]; /*Q18*/ +extern const Word16 GSC_freq_DL0_bits[]; /* Q0 */ +extern const Word16 Compl_GSC_freq_bits[]; /* Q0 */ extern const float Gain_meanNB[]; -extern const Word16 Gain_meanNB_fx[]; +extern const Word16 Gain_meanNB_fx[]; /*Q12*/ extern const float Gain_mean_dicNB[]; -extern const Word16 Gain_mean_dicNB_fx[]; +extern const Word16 Gain_mean_dicNB_fx[]; /*Q12 */ extern const float Mean_dic_NB[]; -extern const Word16 Mean_dic_NB_fx[]; +extern const Word16 Mean_dic_NB_fx[]; /*Q12 */ extern const float Gain_dic1_NB[]; extern const float Gain_dic2_NB[]; extern const float Gain_dic3_NB[]; -extern const Word16 Gain_dic1_NB_fx[]; -extern const Word16 Gain_dic2_NB_fx[]; -extern const Word16 Gain_dic3_NB_fx[]; +extern const Word16 Gain_dic1_NB_fx[]; /*Q12 */ +extern const Word16 Gain_dic2_NB_fx[]; /*Q12 */ +extern const Word16 Gain_dic3_NB_fx[]; /*Q12 */ /*------------------------------------------------------------------------------* * FFT transform *------------------------------------------------------------------------------*/ -extern const int16_t Odx_fft64[64]; +extern const Word16 Odx_fft64[64]; // Q0 extern const float w_fft64[32]; -extern const int16_t Ip_fft64[6]; -extern const int16_t Odx_fft32_15[32]; +extern const Word16 Ip_fft64[6]; // Q0 +extern const Word16 Odx_fft32_15[32]; // Q0 extern const float w_fft32[16]; -extern const Word32 w_fft32_16fx[16]; -extern const int16_t Ip_fft32[6]; -extern const int16_t Odx_fft32_5[32]; -extern const int16_t Odx_fft16[16]; +extern const Word32 w_fft32_16fx[16]; // Q30 +extern const Word16 Ip_fft32[6]; // Q0 +extern const Word16 Odx_fft32_5[32]; // Q0 +extern const Word16 Odx_fft16[16]; // Q0 extern const float w_fft16[8]; -extern const int16_t Ip_fft16[6]; +extern const Word16 Ip_fft16[6]; // Q0 extern const float w_fft8[8]; -extern const int16_t Ip_fft8[6]; -extern const int16_t Idx_dortft80[80]; -extern const int16_t Idx_dortft120[120]; -extern const int16_t Idx_dortft160[160]; -extern const int16_t Idx_dortft320[320]; -extern const int16_t Idx_dortft480[480]; -extern const int16_t Ip_fft128[10]; +extern const Word16 Ip_fft8[6]; // Q0 +extern const Word16 Idx_dortft80[80]; // Q0 +extern const Word16 Idx_dortft120[120]; // Q0 +extern const Word16 Idx_dortft160[160]; // Q0 +extern const Word16 Idx_dortft320[320]; // Q0 +extern const Word16 Idx_dortft480[480]; // Q0 +extern const Word16 Ip_fft128[10]; // Q0 extern const float w_fft128[64]; -extern const Word32 w_fft128_16fx[64]; -extern const int16_t Ip_fft256[10]; +extern const Word32 w_fft128_16fx[64]; // Q30 +extern const Word16 Ip_fft256[10]; // Q0 extern const float w_fft256[128]; -extern const int16_t Ip_fft512[18]; +extern const Word16 Ip_fft512[18]; // Q0 extern const float w_fft512[256]; -extern const Word16 w_fft512_fx_evs[256]; +extern const Word16 w_fft512_fx_evs[256]; // Q14 // extern const Word16 w_fft512_fx[256]; -extern const int16_t Idx_dortft40[40]; -extern const int16_t Odx_fft8_5[8]; -extern const int16_t ip_edct2_64[6]; +extern const Word16 Idx_dortft40[40]; // Q0 +extern const Word16 Odx_fft8_5[8]; // Q0 +extern const Word16 ip_edct2_64[6]; // Q0 extern const float w_edct2_64[80]; -extern const Word16 w_edct2_64_fx[80]; -extern const int16_t Idx_dortft20[20]; -extern const int16_t Odx_fft4_5[4]; +extern const Word16 w_edct2_64_fx[80]; /*Q14 */ +extern const Word16 Idx_dortft20[20]; // Q0 +extern const Word16 Odx_fft4_5[4]; // Q0 extern const float w_fft4[2]; -extern const int16_t Ip_fft4[6]; +extern const Word16 Ip_fft4[6]; // Q0 extern const float FFT_RotVector_32[40]; extern const float FFT_RotVector_256[448]; @@ -1570,21 +1569,21 @@ extern const float FFT_RotVector_960[1860]; extern const float Asr_LP32[41]; extern const float Asr_LP16[21]; extern const float Asr_LP48[61]; -extern const Word16 Asr_LP32_fx[41]; -extern const Word16 Asr_LP16_fx[21]; -extern const Word16 Asr_LP48_fx[61]; +extern const Word16 Asr_LP32_fx[41]; // Q15 +extern const Word16 Asr_LP16_fx[21]; // Q15 +extern const Word16 Asr_LP48_fx[61]; // Q15 -extern const int16_t Num_bands_NB[]; +extern const Word16 Num_bands_NB[]; // Q0 extern const float SmoothingWin_NB875[]; extern const float SmoothingWin_NB2[]; -extern const Word16 SmoothingWin_NB875_fx[]; -extern const Word16 SmoothingWin_NB2_fx[]; +extern const Word16 SmoothingWin_NB875_fx[]; /* Q15 */ +extern const Word16 SmoothingWin_NB2_fx[]; /* Q15 */ /*----------------------------------------------------------------------------------* * CLDFB *----------------------------------------------------------------------------------*/ -extern const int16_t freqTable[2]; +extern const Word16 freqTable[2]; // Q0 extern const float CLDFB80_10_flt[100]; extern const float CLDFB80_16_flt[160]; @@ -1620,13 +1619,13 @@ extern const float rot_vec_ana_im_L40[20]; extern const float rot_vec_ana_re_L60[30]; extern const float rot_vec_ana_im_L60[30]; -extern const Word16 CLDFB80_10[100]; -extern const Word16 CLDFB80_16[160]; -extern const Word16 CLDFB80_20[200]; -extern const Word16 CLDFB80_32[320]; -extern const Word16 CLDFB80_40[400]; -extern const Word16 CLDFB80_60[600]; -extern const Word16 CLDFB80_30[300]; +extern const Word16 CLDFB80_10[100]; // Q.5 +extern const Word16 CLDFB80_16[160]; // Q.5 +extern const Word16 CLDFB80_20[200]; // Q.5 +extern const Word16 CLDFB80_32[320]; // Q.5 +extern const Word16 CLDFB80_40[400]; // Q.5 +extern const Word16 CLDFB80_60[600]; // Q.5 +extern const Word16 CLDFB80_30[300]; // Q.5 #ifdef IVAS_FLOAT_FIXED extern const Word16 LDQMF_10_enc_fx[100]; extern const Word16 LDQMF_16_enc_fx[160]; @@ -1637,28 +1636,28 @@ extern const Word16 LDQMF_40_enc_fx[400]; extern const Word16 LDQMF_60_enc_fx[600]; #endif -extern const Word16 rRotVectr_10[]; -extern const Word16 iRotVectr_10[]; -extern const Word16 rRotVectr_16[]; -extern const Word16 iRotVectr_16[]; -extern const Word16 rRotVectr_20[]; -extern const Word16 iRotVectr_20[]; -extern const Word16 rRotVectr_32[]; -extern const Word16 iRotVectr_32[]; -extern const Word16 rRotVectr_40[]; -extern const Word16 iRotVectr_40[]; -extern const Word16 rRotVectr_60[]; -extern const Word16 iRotVectr_60[]; -extern const Word16 rRotVectr_30[]; -extern const Word16 iRotVectr_30[]; - -extern const Word16 cldfb_anaScale[]; -extern const Word16 cldfb_synScale[]; -extern const Word16 cldfb_synGain[]; +extern const Word16 rRotVectr_10[]; // Q(sqrt(1.0/16.00)) +extern const Word16 iRotVectr_10[]; // Q(sqrt(1.0/16.00)) +extern const Word16 rRotVectr_16[]; // Q(sqrt(1.0/8.00)) +extern const Word16 iRotVectr_16[]; // Q(sqrt(1.0/8.00)) +extern const Word16 rRotVectr_20[]; // Q(sqrt(1.0/8.00)) +extern const Word16 iRotVectr_20[]; // Q(sqrt(1.0/8.00) +extern const Word16 rRotVectr_32[]; // Q(sqrt(1.0/4.00)) +extern const Word16 iRotVectr_32[]; // Q(sqrt(1.0/4.00)) +extern const Word16 rRotVectr_40[]; // Q(sqrt(1.0/4.00)) +extern const Word16 iRotVectr_40[]; // Q(sqrt(1.0/4.00)) +extern const Word16 rRotVectr_60[]; // Q(sqrt(1.0/2.00)) +extern const Word16 iRotVectr_60[]; // Q(sqrt(1.0/2.00)) +extern const Word16 rRotVectr_30[]; // Q(sqrt(1.0/4.00)) +extern const Word16 iRotVectr_30[]; // Q(sqrt(1.0/4.00)) + +extern const Word16 cldfb_anaScale[]; // Q0 +extern const Word16 cldfb_synScale[]; // Q0 +extern const Word16 cldfb_synGain[]; // Q0 extern const Word16 *cldfb_protoFilter_2_5ms[]; -extern const Word16 *cldfb_protoFilter_5_0ms[]; -extern const Word16 cldfb_scale_2_5ms[7]; -extern const Word16 cldfb_scale_5_0ms[7]; +// extern const Word16 *cldfb_protoFilter_5_0ms[]; +extern const Word16 cldfb_scale_2_5ms[7]; // Q8 +extern const Word16 cldfb_scale_5_0ms[7]; // Q8 extern const float rot_vec_syn_re_L10[5]; @@ -1676,51 +1675,51 @@ extern const float rot_vec_syn_im_L40[20]; extern const float rot_vec_syn_re_L60[30]; extern const float rot_vec_syn_im_L60[30]; -extern const Word32 rot_vec_syn_re_L10_fx[5]; -extern const Word32 rot_vec_syn_im_L10_fx[5]; -extern const Word32 rot_vec_syn_re_L16_fx[8]; -extern const Word32 rot_vec_syn_im_L16_fx[8]; -extern const Word32 rot_vec_syn_re_L20_fx[10]; -extern const Word32 rot_vec_syn_im_L20_fx[10]; -extern const Word32 rot_vec_syn_re_L30_fx[15]; -extern const Word32 rot_vec_syn_im_L30_fx[15]; -extern const Word32 rot_vec_syn_re_L32_fx[16]; -extern const Word32 rot_vec_syn_im_L32_fx[16]; -extern const Word32 rot_vec_syn_re_L40_fx[20]; -extern const Word32 rot_vec_syn_im_L40_fx[20]; -extern const Word32 rot_vec_syn_re_L60_fx[30]; -extern const Word32 rot_vec_syn_im_L60_fx[30]; +extern const Word32 rot_vec_syn_re_L10_fx[5]; // Q31 +extern const Word32 rot_vec_syn_im_L10_fx[5]; // Q31 +extern const Word32 rot_vec_syn_re_L16_fx[8]; // Q31 +extern const Word32 rot_vec_syn_im_L16_fx[8]; // Q31 +extern const Word32 rot_vec_syn_re_L20_fx[10]; // Q31 +extern const Word32 rot_vec_syn_im_L20_fx[10]; // Q31 +extern const Word32 rot_vec_syn_re_L30_fx[15]; // Q31 +extern const Word32 rot_vec_syn_im_L30_fx[15]; // Q31 +extern const Word32 rot_vec_syn_re_L32_fx[16]; // Q31 +extern const Word32 rot_vec_syn_im_L32_fx[16]; // Q31 +extern const Word32 rot_vec_syn_re_L40_fx[20]; // Q31 +extern const Word32 rot_vec_syn_im_L40_fx[20]; // Q31 +extern const Word32 rot_vec_syn_re_L60_fx[30]; // Q31 +extern const Word32 rot_vec_syn_im_L60_fx[30]; // Q31 extern const float bpf_weights_16[CLDFB_NO_COL_MAX]; -extern const Word16 bpf_weights_16_Fx[16]; -extern const Word16 bpf_weights_16_ivas_fx[16]; -extern const Word32 bpf_weights_16_ivas_fx_32[16]; +extern const Word16 bpf_weights_16_Fx[16]; // Q15 +extern const Word16 bpf_weights_16_ivas_fx[16]; // Q15 +extern const Word32 bpf_weights_16_ivas_fx_32[16]; // Q30 extern const float CNG_details_codebook[64][NUM_ENV_CNG]; -extern const Word16 CNG_details_codebook_fx[64][NUM_ENV_CNG]; +extern const Word16 CNG_details_codebook_fx[64][NUM_ENV_CNG]; // Q6 /*----------------------------------------------------------------------------------* * FD CNG *----------------------------------------------------------------------------------*/ -extern const int16_t d_array[SIZE_SCALE_TABLE_CN]; +extern const Word16 d_array[SIZE_SCALE_TABLE_CN]; // Q0 extern const float m_array_flt[SIZE_SCALE_TABLE_CN]; -extern const Word16 m_array[SIZE_SCALE_TABLE_CN]; +extern const Word16 m_array[SIZE_SCALE_TABLE_CN]; // Q15 extern const float msQeqInvAv_thresh_flt[3]; -extern const Word16 msQeqInvAv_thresh[3]; +extern const Word16 msQeqInvAv_thresh[3]; // Q15 extern const float msNoiseSlopeMax_flt[4]; -extern const Word16 msNoiseSlopeMax[4]; +extern const Word16 msNoiseSlopeMax[4]; // Q15 -extern const SCALE_SETUP scaleTableStereo[SIZE_SCALE_TABLE_STEREO]; -extern const SCALE_SETUP scaleTableMono[SIZE_SCALE_TABLE_MONO]; -extern const SCALE_SETUP scaleTable_cn_only[SIZE_SCALE_TABLE_CN]; -extern const SCALE_SETUP scaleTable_cn_dirac[15]; +extern const SCALE_SETUP scaleTableStereo[SIZE_SCALE_TABLE_STEREO]; // Q7 +extern const SCALE_SETUP scaleTableMono[SIZE_SCALE_TABLE_MONO]; // Q7 +extern const SCALE_SETUP scaleTable_cn_only[SIZE_SCALE_TABLE_CN]; // Q14 +extern const SCALE_SETUP scaleTable_cn_dirac[15]; // Q14 extern const float scaleTable_cn_only_amrwbio_flt[SIZE_SCALE_TABLE_CN_AMRWB][2]; -extern const Word16 scaleTable_cn_only_amrwbio[SIZE_SCALE_TABLE_CN_AMRWB][2]; -extern const Word32 scaleTable_cn_only_amrwbio_fx_by_10f[SIZE_SCALE_TABLE_CN_AMRWB][2]; +extern const Word16 scaleTable_cn_only_amrwbio[SIZE_SCALE_TABLE_CN_AMRWB][2]; // Q14 +extern const Word32 scaleTable_cn_only_amrwbio_fx_by_10f[SIZE_SCALE_TABLE_CN_AMRWB][2]; // Q29 -extern const int16_t sidparts_encoder_noise_est[SIZE_SIDPARTS_ENC_NOISE_EST]; +extern const Word16 sidparts_encoder_noise_est[SIZE_SIDPARTS_ENC_NOISE_EST]; // Q0 extern const FD_CNG_SETUP FdCngSetup_nb; @@ -1731,14 +1730,14 @@ extern const FD_CNG_SETUP FdCngSetup_swb1; extern const FD_CNG_SETUP FdCngSetup_swb1_stereo; extern const FD_CNG_SETUP FdCngSetup_swb2; -extern const int16_t levels_37bits[FD_CNG_stages_37bits]; -extern const int16_t bits_37bits[FD_CNG_stages_37bits]; +extern const Word16 levels_37bits[FD_CNG_stages_37bits]; // Q0 +extern const Word16 bits_37bits[FD_CNG_stages_37bits]; // Q0 extern const float *const cdk_37bits_flt[]; extern const float *const cdk_37bits_ivas[]; -extern Word16 const *const cdk_37bits[]; -extern Word16 const *const ivas_cdk_37bits_fx[]; +extern Word16 const *const cdk_37bits[]; // Q7 +extern Word16 const *const ivas_cdk_37bits_fx[]; // Q7 extern const float fftSineTab640[321]; -extern const Word16 fftSineTab640_fx[321]; +extern const Word16 fftSineTab640_fx[321]; // Q15 extern const float olapWinAna512[512]; extern const float olapWinAna640[640]; @@ -1748,50 +1747,50 @@ extern const Word32 olapWinAna640_fx[640]; // Q30 #endif // IVAS_FLOAT_FIXED extern const float olapWinSyn256[256]; -extern const Word16 olapWinSyn256_fx[256]; +extern const Word16 olapWinSyn256_fx[256]; // Q15 extern const float olapWinSyn320[320]; -extern const Word16 olapWinSyn320_fx[320]; +extern const Word16 olapWinSyn320_fx[320]; // Q15 #ifdef ERI_FDCNGVQ_LOW_ROM_TESTING extern const float *const cdk_37bits_ivas_orig[]; #endif -extern const Word8 cdk1_ivas_dct_s0_W8[]; -extern const Word8 cdk1_ivas_dct_s1_W8[]; -extern const Word8 cdk1_ivas_dct_s2_W8[]; -extern const Word8 cdk1_ivas_dct_s3_W8[]; -extern const Word8 *const cdk_37bits_ivas_stage1_W8Qx_dct_sections[]; +extern const Word8 cdk1_ivas_dct_s0_W8[]; // Q0 +extern const Word8 cdk1_ivas_dct_s1_W8[]; // Q0 +extern const Word8 cdk1_ivas_dct_s2_W8[]; // Q0 +extern const Word8 cdk1_ivas_dct_s3_W8[]; // Q0 +extern const Word8 *const cdk_37bits_ivas_stage1_W8Qx_dct_sections[]; // Q0 -extern const Word16 cdk1_ivas_entries_per_segment[]; -extern const Word16 cdk1_ivas_cum_entries_per_segment[]; -extern const Word16 cdk1_ivas_cols_per_segment[]; -extern const Word16 cdk1_ivas_trunc_dct_cols_per_segment[]; +extern const Word16 cdk1_ivas_entries_per_segment[]; // Q0 +extern const Word16 cdk1_ivas_cum_entries_per_segment[]; // Q0 +extern const Word16 cdk1_ivas_cols_per_segment[]; // Q0 +extern const Word16 cdk1_ivas_trunc_dct_cols_per_segment[]; // Q0 -extern const Word16 *stage1_dct_col_syn_shift[]; +extern const Word16 *stage1_dct_col_syn_shift[]; // Q0 extern const float cdk1r_tr_midQ_truncQ[]; #ifdef IVAS_FLOAT_FIXED -extern const Word16 cdk1r_tr_midQ_truncQ_fx[]; +extern const Word16 cdk1r_tr_midQ_truncQ_fx[]; // Q10 #endif extern const float fdcng_dct_invScaleF[]; extern const float fdcng_dct_scaleF[]; -extern const Word32 fdcng_dct_scaleF_fx[]; +extern const Word32 fdcng_dct_scaleF_fx[]; // Q31 -extern const Word16 unique_idctT2_24coeffsQ16[]; +extern const Word16 unique_idctT2_24coeffsQ16[]; // Q16 extern const Word8 idctT2_24_compressed_idx[]; -extern const Word16 unique_idctT2_21coeffsQ16[]; -extern const Word8 idctT2_21_compressed_idx[]; +extern const Word16 unique_idctT2_21coeffsQ16[]; // Q16 +extern const Word8 idctT2_21_compressed_idx[]; // Q0 extern const float idctT2_24_X_matrixFloatQ[]; -extern const Word16 cdk1_ivas_entries_per_segment[]; -extern const Word16 cdk1_ivas_cum_entries_per_segment[]; +extern const Word16 cdk1_ivas_entries_per_segment[]; // Q0 +extern const Word16 cdk1_ivas_cum_entries_per_segment[]; // Q0 /* circular mse ordered list fwd/rev directions for candidate evaluations */ -extern const Word8 cdk1_ivas_segm_neighbour_fwd[]; -extern const Word8 cdk1_ivas_segm_neighbour_rev[]; +extern const Word8 cdk1_ivas_segm_neighbour_fwd[]; // Q0 +extern const Word8 cdk1_ivas_segm_neighbour_rev[]; // Q0 extern const float cdk_37bits_1[]; @@ -1808,20 +1807,20 @@ extern const float cdk_37bits_6[]; extern const float gain_corr_fac_flt[]; extern const float gain_corr_inv_fac_flt[]; -extern const Word16 gain_corr_fac[]; /*pow(10,2^(-n-2)/28)*/ -extern const Word16 gain_corr_inv_fac[]; /*pow(10,-2^(-n-2)/28)*/ +extern const Word16 gain_corr_fac[]; /*pow(10,2^(-n-2)/28)(1Q14)*/ +extern const Word16 gain_corr_inv_fac[]; /*pow(10,-2^(-n-2)/28)(0Q15)*/ -extern const SCALE_TCX_SETUP scaleTcxTable[SIZE_SCALE_TABLE_TCX]; +extern const SCALE_TCX_SETUP scaleTcxTable[SIZE_SCALE_TABLE_TCX]; // Q15 /*----------------------------------------------------------------------------------* * Arithmetic coder *----------------------------------------------------------------------------------*/ -extern const uint8_t ari_lookup_s17_LC[4096]; -extern const uint16_t ari_pk_s17_LC_ext[64][18]; +extern const UWord8 ari_lookup_s17_LC[4096]; // Q0 +extern const UWord16 ari_pk_s17_LC_ext[64][18]; // Q0 -extern const int16_t NumRatioBits[2][17]; +extern const Word16 NumRatioBits[2][17]; // Q0 extern const float Ratios_WB_2[32]; extern const float Ratios_WB_3[32]; extern const float Ratios_WB_4[32]; @@ -1858,41 +1857,41 @@ extern const float Ratios_NB_17[4]; extern const float Ratios_NB_18[4]; extern const float *const Ratios[2][17]; -extern const Word16 Ratios_WB_2_fx[32]; -extern const Word16 Ratios_WB_3_fx[32]; -extern const Word16 Ratios_WB_4_fx[32]; -extern const Word16 Ratios_WB_5_fx[32]; -extern const Word16 Ratios_WB_6_fx[32]; -extern const Word16 Ratios_WB_7_fx[32]; -extern const Word16 Ratios_WB_8_fx[16]; -extern const Word16 Ratios_WB_9_fx[16]; -extern const Word16 Ratios_WB_10_fx[16]; -extern const Word16 Ratios_WB_11_fx[16]; -extern const Word16 Ratios_WB_12_fx[16]; -extern const Word16 Ratios_WB_13_fx[16]; -extern const Word16 Ratios_WB_14_fx[16]; -extern const Word16 Ratios_WB_15_fx[16]; -extern const Word16 Ratios_WB_16_fx[4]; -extern const Word16 Ratios_WB_17_fx[4]; -extern const Word16 Ratios_WB_18_fx[4]; -extern const Word16 Ratios_NB_2_fx[32]; -extern const Word16 Ratios_NB_3_fx[16]; -extern const Word16 Ratios_NB_4_fx[16]; -extern const Word16 Ratios_NB_5_fx[16]; -extern const Word16 Ratios_NB_6_fx[16]; -extern const Word16 Ratios_NB_7_fx[16]; -extern const Word16 Ratios_NB_8_fx[16]; -extern const Word16 Ratios_NB_9_fx[8]; -extern const Word16 Ratios_NB_10_fx[8]; -extern const Word16 Ratios_NB_11_fx[8]; -extern const Word16 Ratios_NB_12_fx[8]; -extern const Word16 Ratios_NB_13_fx[4]; -extern const Word16 Ratios_NB_14_fx[4]; -extern const Word16 Ratios_NB_15_fx[4]; -extern const Word16 Ratios_NB_16_fx[4]; -extern const Word16 Ratios_NB_17_fx[4]; -extern const Word16 Ratios_NB_18_fx[4]; -extern const Word16 *const Ratios_fx[2][17]; +extern const Word16 Ratios_WB_2_fx[32]; /* 7Q8 */ +extern const Word16 Ratios_WB_3_fx[32]; /* 7Q8 */ +extern const Word16 Ratios_WB_4_fx[32]; /* 7Q8 */ +extern const Word16 Ratios_WB_5_fx[32]; /* 7Q8 */ +extern const Word16 Ratios_WB_6_fx[32]; /* 7Q8 */ +extern const Word16 Ratios_WB_7_fx[32]; /* 7Q8 */ +extern const Word16 Ratios_WB_8_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_WB_9_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_WB_10_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_WB_11_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_WB_12_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_WB_13_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_WB_14_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_WB_15_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_WB_16_fx[4]; /* 7Q8 */ +extern const Word16 Ratios_WB_17_fx[4]; /* 7Q8 */ +extern const Word16 Ratios_WB_18_fx[4]; /* 7Q8 */ +extern const Word16 Ratios_NB_2_fx[32]; /* 7Q8 */ +extern const Word16 Ratios_NB_3_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_NB_4_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_NB_5_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_NB_6_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_NB_7_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_NB_8_fx[16]; /* 7Q8 */ +extern const Word16 Ratios_NB_9_fx[8]; /* 7Q8 */ +extern const Word16 Ratios_NB_10_fx[8]; /* 7Q8 */ +extern const Word16 Ratios_NB_11_fx[8]; /* 7Q8 */ +extern const Word16 Ratios_NB_12_fx[8]; /* 7Q8 */ +extern const Word16 Ratios_NB_13_fx[4]; /* 7Q8 */ +extern const Word16 Ratios_NB_14_fx[4]; /* 7Q8 */ +extern const Word16 Ratios_NB_15_fx[4]; /* 7Q8 */ +extern const Word16 Ratios_NB_16_fx[4]; /* 7Q8 */ +extern const Word16 Ratios_NB_17_fx[4]; /* 7Q8 */ +extern const Word16 Ratios_NB_18_fx[4]; /* 7Q8 */ +extern const Word16 *const Ratios_fx[2][17]; /* 7Q8 */ extern const Word16 qGains[2][1 << kTcxHmNumGainBits]; @@ -1916,7 +1915,7 @@ extern const struct TnsParameters tnsParameters48kHz_grouped[2]; extern const struct TnsParameters tnsParameters32kHz_Stereo[2]; extern const float tnsAcfWindow[TNS_MAX_FILTER_ORDER]; -extern const Word16 tnsAcfWindow_fx[TNS_MAX_FILTER_ORDER]; +extern const Word16 tnsAcfWindow_fx[TNS_MAX_FILTER_ORDER]; // Q15 extern const ParamsBitMap tnsEnabledSWBTCX20BitMap; extern const ParamsBitMap tnsEnabledSWBTCX10BitMap; @@ -1948,7 +1947,7 @@ extern const Coding codesTnsCoeff3WB[]; extern const Coding codesTnsCoeff456[]; extern const Coding codesTnsCoeff7[]; -extern const int16_t nTnsCoeffCodes; +extern const Word16 nTnsCoeffCodes; // Q0 extern const Coding *const codesTnsCoeffSWBTCX20[]; extern const Coding *const codesTnsCoeffSWBTCX10[]; @@ -1958,7 +1957,7 @@ extern const int16_t nTnsCoeffTables; extern const Coding codesTnsOrderTCX20[]; extern const Coding codesTnsOrderTCX10[]; extern const Coding codesTnsOrder[]; -extern const int16_t nTnsOrderCodes; +extern const Word16 nTnsOrderCodes; // Q0 extern const float tnsCoeff4_flt[16]; extern const Word16 tnsCoeff4[16]; @@ -1969,48 +1968,48 @@ extern const Word16 tnsCoeff4[16]; typedef struct igf_mode_type { - int32_t sampleRate; - int16_t frameLength; - int16_t igfMinFq; - int16_t maxHopsize; + Word32 sampleRate; // Q0 + Word16 frameLength; // Q0 + Word16 igfMinFq; // Q0 + Word16 maxHopsize; // Q0 } IGF_MODE; extern const IGF_MODE igfMode[IGF_BITRATE_UNKNOWN]; -extern const Word16 swb_offset_LB_new[IGF_BITRATE_UNKNOWN][IGF_MAX_SFB]; -extern const int16_t igf_tile_offset_table[IGF_BITRATE_UNKNOWN][2 * IGF_MAX_TILES + 1]; +extern const Word16 swb_offset_LB_new[IGF_BITRATE_UNKNOWN][IGF_MAX_SFB]; // Q0 +extern const Word16 igf_tile_offset_table[IGF_BITRATE_UNKNOWN][2 * IGF_MAX_TILES + 1]; // Q0 extern const float igf_whitening_TH_flt[IGF_BITRATE_UNKNOWN][2][IGF_MAX_TILES]; -extern const Word16 igf_whitening_TH[][2][IGF_MAX_TILES]; +extern const Word16 igf_whitening_TH[][2][IGF_MAX_TILES]; // Q13 #ifdef IVAS_FLOAT_FIXED -extern const Word16 igf_whitening_TH_ivas_fx[IGF_BITRATE_UNKNOWN][2][IGF_MAX_TILES]; -#endif // IVAS_FLOAT_FIXED -extern const int16_t cf_off_se01_tab[10]; -extern const int16_t cf_off_se10_tab; -extern const int16_t cf_off_se02_tab[10][IGF_CTX_COUNT]; -extern const int16_t cf_off_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT]; -extern const uint16_t cf_se00_tab[IGF_SYMBOLS_IN_TABLE + 1]; -extern const uint16_t cf_se01_tab[10][IGF_SYMBOLS_IN_TABLE + 1]; -extern const uint16_t cf_se02_tab[10][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1]; -extern const uint16_t cf_se10_tab[IGF_SYMBOLS_IN_TABLE + 1]; -extern const uint16_t cf_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1]; +extern const Word16 igf_whitening_TH_ivas_fx[IGF_BITRATE_UNKNOWN][2][IGF_MAX_TILES]; // Q13 +#endif // IVAS_FLOAT_FIXED +extern const Word16 cf_off_se01_tab[10]; // Q0 +extern const Word16 cf_off_se10_tab; // Q0 +extern const Word16 cf_off_se02_tab[10][IGF_CTX_COUNT]; // Q0 +extern const Word16 cf_off_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT]; // Q0 +extern const UWord16 cf_se00_tab[IGF_SYMBOLS_IN_TABLE + 1]; // Q0 +extern const UWord16 cf_se01_tab[10][IGF_SYMBOLS_IN_TABLE + 1]; // Q0 +extern const UWord16 cf_se02_tab[10][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1]; // Q0 +extern const UWord16 cf_se10_tab[IGF_SYMBOLS_IN_TABLE + 1]; // Q0 +extern const UWord16 cf_se11_tab[IGF_CTX_COUNT][IGF_CTX_COUNT][IGF_SYMBOLS_IN_TABLE + 1]; // Q0 extern const float normReciprocal[CHEAP_NORM_SIZE]; extern const float *const w_a_float[7]; -extern const PWord16 SineTable512_fx[]; -extern const Word16 ldCoeff[7]; -extern const UWord32 exp2_tab_long[32]; -extern const UWord32 exp2w_tab_long[32]; -extern const UWord32 exp2x_tab_long[32]; -extern const Word16 invTable[INV_TABLE_SIZE + 1]; -extern const Word16 sqrtTable[SQRT_TABLE_SIZE + 1]; -extern const Word16 invSqrtTable[SQRT_TABLE_SIZE + 1]; +extern const PWord16 SineTable512_fx[]; // Q15 +extern const Word16 ldCoeff[7]; // Q15 +extern const UWord32 exp2_tab_long[32]; // Q31 +extern const UWord32 exp2w_tab_long[32]; // Q31 +extern const UWord32 exp2x_tab_long[32]; // Q31 +extern const Word16 invTable[INV_TABLE_SIZE + 1]; // Q15 +extern const Word16 sqrtTable[SQRT_TABLE_SIZE + 1]; // Q15 +extern const Word16 invSqrtTable[SQRT_TABLE_SIZE + 1]; // Q15 extern const float tcx_mdct_window_48[420]; -extern const Word16 tcx_mdct_window_48_fx[420]; +extern const Word16 tcx_mdct_window_48_fx[420]; // Q15 extern const float tcx_mdct_window_half_48[180]; -extern const Word16 tcx_mdct_window_half_48_fx[180]; +extern const Word16 tcx_mdct_window_half_48_fx[180]; // Q15 extern const float tcx_mdct_window_trans_48[60]; -extern const Word16 tcx_mdct_window_trans_48_fx[60]; +extern const Word16 tcx_mdct_window_trans_48_fx[60]; // Q15 /*----------------------------------------------------------------------------------* @@ -2018,140 +2017,140 @@ extern const Word16 tcx_mdct_window_trans_48_fx[60]; *----------------------------------------------------------------------------------*/ extern const float sigma_BWE[]; -extern const Word32 sigma_BWE_fx[]; +extern const Word32 sigma_BWE_fx[]; // Q31 extern const float inv_sigma_BWE[]; -extern const Word16 inv_modified_sigma_BWE_fx[]; -extern const Word16 modified_sigma_BWE_fx[]; +extern const Word16 inv_modified_sigma_BWE_fx[]; // Q1 +extern const Word16 modified_sigma_BWE_fx[]; // Q(log2(2.56) extern const float scales_BWE[]; -extern const Word8 no_lead_BWE[]; +extern const Word8 no_lead_BWE[]; // Q0 extern const float scales_BWE_3b[]; -extern const Word16 scales_BWE_fx[]; -extern const Word16 scales_BWE_fx_new[]; -extern const Word16 scales_BWE_3b_fx[]; -extern const Word16 scales_BWE_3b_fx_new[]; -extern const Word8 no_lead_BWE_3b[]; -extern const int16_t mslvq_SHB_min_bits[]; +extern const Word16 scales_BWE_fx[]; // Q13 +extern const Word16 scales_BWE_fx_new[]; // Q11 +extern const Word16 scales_BWE_3b_fx[]; // Q13 +extern const Word16 scales_BWE_3b_fx_new[]; // Q11 +extern const Word8 no_lead_BWE_3b[]; // Q0 +extern const Word16 mslvq_SHB_min_bits[]; // Q0 extern const float SHB_LSF_mean[]; -extern const Word16 SHB_LSF_mean_fx[]; +extern const Word16 SHB_LSF_mean_fx[]; // Q15 extern const float SHB_LSF_VQ3[48]; extern const float SHB_LSF_VQ4[96]; extern const float *const cb_LSF_BWE[]; -extern const Word16 SHB_LSF_VQ3_fx[48]; -extern const Word16 SHB_LSF_VQ4_fx[96]; -extern const Word16 *const cb_LSF_BWE_fx[]; +extern const Word16 SHB_LSF_VQ3_fx[48]; // Q15 +extern const Word16 SHB_LSF_VQ4_fx[96]; // Q15 +extern const Word16 *const cb_LSF_BWE_fx[]; // Q15 extern const float LastCoefPred_0bit[18]; extern const float LastCoefPred_1bit[36]; -extern const Word32 LastCoefPred_0bit_fx[18]; -extern const Word32 LastCoefPred_1bit_fx[36]; -extern const int16_t config_LSF_BWE[]; +extern const Word32 LastCoefPred_0bit_fx[18]; // Q31 +extern const Word32 LastCoefPred_1bit_fx[36]; // Q31 +extern const Word16 config_LSF_BWE[]; // Q0 // basops -extern const Word32 BASOP_util_normReciprocal[CHEAP_NORM_SIZE]; -extern const Word16 f_atan_expand_range[MAXSFTAB - ( MINSFTAB - 1 )]; +extern const Word32 BASOP_util_normReciprocal[CHEAP_NORM_SIZE]; // Q31 +extern const Word16 f_atan_expand_range[MAXSFTAB - ( MINSFTAB - 1 )]; // Q15 -extern const Word16 Grid[]; -extern const Word16 pwAlpha[10]; +extern const Word16 Grid[]; // Q15 +extern const Word16 pwAlpha[10]; // Q15 extern const Word8 Ind_Guess[256]; -extern const Word16 cos_table_129[129]; -extern const Word16 acos_slope[128]; -extern const Word16 cos_coef_new[4]; -extern const Word16 cos_table[512]; -extern const Word16 inter4_1_fx[]; +extern const Word16 cos_table_129[129]; // Q15 +extern const Word16 acos_slope[128]; // Q15 +extern const Word16 cos_coef_new[4]; // Q15 +extern const Word16 cos_table[512]; // Q15 +extern const Word16 inter4_1_fx[]; // Q14 -extern const Word16 sin_switch_8[15]; -extern const Word16 sin_switch_16[30]; -extern const Word16 sin_switch_32[60]; -extern const Word16 sin_switch_48[90]; +extern const Word16 sin_switch_8[15]; // Q15 +extern const Word16 sin_switch_16[30]; // Q15 +extern const Word16 sin_switch_32[60]; // Q15 +extern const Word16 sin_switch_48[90]; // Q15 extern const Word16 one_on_win_48k_fx[210]; /*Q14 */ extern const Word16 one_on_win_8k_16k_48k_fx[70]; /*Q14 */ -extern const Word16 window_8_16_32kHz_fx[]; -extern const Word16 window_48kHz_fx[]; -extern const Word16 window_256kHz[]; -extern const Word16 half_overlap_25[]; -extern const Word16 half_overlap_48[]; -extern const Word16 half_overlap_int[]; -extern const Word16 small_overlap_25[]; -extern const Word16 small_overlap_48[]; -extern const Word16 small_overlap_int[]; - -extern const Word16 wac_h[]; -extern const Word16 wac_l[]; -extern const short dsDiracsTab[65]; -extern const Word16 pwf_fx[17]; -extern const Word32 inverse_table[]; -extern const Word16 cos_diff_table[512]; -extern const Word32 bwMode2fs[4]; - -extern const Word16 cos_pi_by_127[128]; -extern const Word16 cos_pi_by_255[256]; -extern const Word16 cos_pi_by_383[384]; - -extern const Word16 swb_lsp_prev_interp_init[]; -extern const Word16 L_frame_inv[8]; -extern const Word16 InvIntTable[65]; -extern const Word16 TecLowBandTable[]; -extern const Word16 TecSC_Fx[]; +extern const Word16 window_8_16_32kHz_fx[]; // Q15 +extern const Word16 window_48kHz_fx[]; // Q15 +extern const Word16 window_256kHz[]; // Q15 +extern const Word16 half_overlap_25[]; // Q15 +extern const Word16 half_overlap_48[]; // Q15 +extern const Word16 half_overlap_int[]; // Q15 +extern const Word16 small_overlap_25[]; // Q15 +extern const Word16 small_overlap_48[]; // Q15 +extern const Word16 small_overlap_int[]; // Q15 + +extern const Word16 wac_h[]; // Q15 +extern const Word16 wac_l[]; // Q15 +extern const Word16 dsDiracsTab[65]; // Q0 +extern const Word16 pwf_fx[17]; // Q15 +extern const Word32 inverse_table[]; // Q29 +extern const Word16 cos_diff_table[512]; // Q15 +extern const Word32 bwMode2fs[4]; // Q0 + +extern const Word16 cos_pi_by_127[128]; /* Q15 */ +extern const Word16 cos_pi_by_255[256]; /* Q15 */ +extern const Word16 cos_pi_by_383[384]; /* Q15 */ + +extern const Word16 swb_lsp_prev_interp_init[]; /* Q15 */ +extern const Word16 L_frame_inv[8]; // Q14 +extern const Word16 InvIntTable[65]; // Q15 +extern const Word16 TecLowBandTable[]; // Q0 +extern const Word16 TecSC_Fx[]; // Q15 extern const float TecSC[]; -extern const Word16 sqrt_table_pitch_search[256 + 1]; +extern const Word16 sqrt_table_pitch_search[256 + 1]; // Q11 /* fft_evs.c */ -extern const Word16 RotVector_32[2 * 20]; -extern const Word16 RotVector_256[2 * ( 256 - 32 )]; -extern const Word16 RotVector_320[2 * ( 320 - 20 )]; -extern const Word16 RotVector_400[2 * ( 400 - 20 )]; -extern const Word16 RotVector_480[2 * ( 480 - 30 )]; -extern const Word16 RotVector_600[2 * ( 600 - 30 )]; +extern const Word16 RotVector_32[2 * 20]; // Q15 +extern const Word16 RotVector_256[2 * ( 256 - 32 )]; // Q15 +extern const Word16 RotVector_320[2 * ( 320 - 20 )]; // Q15 +extern const Word16 RotVector_400[2 * ( 400 - 20 )]; // Q15 +extern const Word16 RotVector_480[2 * ( 480 - 30 )]; // Q15 +extern const Word16 RotVector_600[2 * ( 600 - 30 )]; // Q15 extern const Word16 FFT_REORDER_1024[]; -extern const Word16 FFT_W64[]; -extern const Word16 FFT_W128[]; -extern const Word16 FFT_W256[]; -extern const Word16 FFT_W512[]; -extern const Word16 Gamma_19661_Tbl_fx[]; -extern const Word16 Gamma_29491_Tbl[]; +extern const Word16 FFT_W64[]; // Q15 +extern const Word16 FFT_W128[]; // Q15 +extern const Word16 FFT_W256[]; // Q15 +extern const Word16 FFT_W512[]; // Q15 +extern const Word16 Gamma_19661_Tbl_fx[]; // Q15 +extern const Word16 Gamma_29491_Tbl[]; // Q15 /*---------------------------------------------------------------------* * NB post-filter tables *---------------------------------------------------------------------*/ -extern const Word16 tab_hup_s_fx[]; -extern const Word16 tab_hup_l_fx[]; +extern const Word16 tab_hup_s_fx[]; // Q15 +extern const Word16 tab_hup_l_fx[]; // Q15 -extern const Word16 mfreq_loc_Q2fx[]; -extern const Word16 mfreq_loc_div_25[]; +extern const Word16 mfreq_loc_Q2fx[]; // Q0 +extern const Word16 mfreq_loc_div_25[]; // Q0 -extern const Word16 band_len_idx[]; -extern const Word16 band_len_ener_shift[]; -extern const Word16 fine_gain_pred_sqrt_bw[]; +extern const Word16 band_len_idx[]; // Q0 +extern const Word16 band_len_ener_shift[]; // Q0 +extern const Word16 fine_gain_pred_sqrt_bw[]; // Q11 #ifdef IVAS_FLOAT_FIXED -extern const Word16 ivas_band_len_idx[]; -extern const Word16 ivas_band_len_ener_shift[]; -extern const Word16 ivas_fine_gain_pred_sqrt_bw[]; +extern const Word16 ivas_band_len_idx[]; // Q0 +extern const Word16 ivas_band_len_ener_shift[]; // Q0 +extern const Word16 ivas_fine_gain_pred_sqrt_bw[]; // Q11 #endif -extern const Word16 Mean_isf_wb[]; -extern const Word16 lsp_shb_prev_tbl_fx[]; +extern const Word16 Mean_isf_wb[]; // Q2.56 +extern const Word16 lsp_shb_prev_tbl_fx[]; // Q15 #ifdef IVAS_FLOAT_FIXED -extern const Word16 ivas_lsp_shb_prev_tbl_fx[]; +extern const Word16 ivas_lsp_shb_prev_tbl_fx[]; // Q15 #endif extern const Word16 tab_ari_qnew[4][4]; // enhancer.c -extern const Word16 phs_tbl_dec[]; -extern const Word16 Low_H_phasedisp[L_SUBFR]; -extern const Word16 Mid_H_phasedisp[L_SUBFR]; +extern const Word16 phs_tbl_dec[]; // Q15 +extern const Word16 Low_H_phasedisp[L_SUBFR]; // Q15 +extern const Word16 Mid_H_phasedisp[L_SUBFR]; // Q15 // ACcontextMapping_dec_fx.c -extern const Word16 Tab_esc_nb[4]; -extern const Word16 pow2tab[15]; -extern const Word32 pow2[]; -extern const Word16 Es_pred_qua[8]; -extern const Word16 Es_pred_qua_2[16]; -extern const Word16 T_DIV_L_Frame[]; /*0Q15 * 2^-7 */ +extern const Word16 Tab_esc_nb[4]; // Q0 +extern const Word16 pow2tab[15]; // Q0 +extern const Word32 pow2[]; // Q0 +extern const Word16 Es_pred_qua[8]; // Q8 +extern const Word16 Es_pred_qua_2[16]; // Q8 +extern const Word16 T_DIV_L_Frame[]; /*0Q15 * 2^-7 */ // ivas_sns_com_fx.c extern const Word32 pow_tilt_16k[64]; /* Q23 */ @@ -2160,11 +2159,11 @@ extern const Word32 pow_tilt_32k[64]; /* Q23 */ /*EVS basop*/ -extern const Word16 num_nelp_lp_fx[NELP_LP_ORDER + 1]; -extern const Word16 den_nelp_lp_fx[NELP_LP_ORDER + 1]; +extern const Word16 num_nelp_lp_fx[NELP_LP_ORDER + 1]; // Q13 +extern const Word16 den_nelp_lp_fx[NELP_LP_ORDER + 1]; // Q13 -extern const Word16 fir_6k_8k_fx[]; /* HF BWE - band-pass filter coefficients */ -extern const Word16 pwf78_fx[17]; +extern const Word16 fir_6k_8k_fx[]; /* HF BWE - band-pass filter coefficients Q15*/ +extern const Word16 pwf78_fx[17]; // Q15 enum FUNC_GAIN_ENC { @@ -2175,36 +2174,36 @@ enum FUNC_GAIN_ENC FUNC_GAIN_ENC_GACELP_UV /* UV GACELP gain quantizer ((7=5-2bits/subfr) */ }; -extern const Word16 hamcos_window_fx[]; -extern const Word16 CNG_burst_att_fx[6][8]; -extern const Word16 lpc_weights_fx[]; -extern const Word16 SHBCB_SubGain5bit_12_fx[]; /* 5 bit Quantizer table for SHB gain shapes */ -extern const Word16 E_ROM_inter4_1_fx[PIT_UP_SAMP * L_INTERPOL1 + 1]; -extern const Word16 E_ROM_inter6_1_fx[PIT_UP_SAMP6 * L_INTERPOL1 + 1]; -extern const Word16 kLog2TableFrac_x[256]; -extern const Word16 kExp2TableFrac_x[256]; -extern const Word16 One_div_fx[]; +extern const Word16 hamcos_window_fx[]; // Q15 +extern const Word16 CNG_burst_att_fx[6][8]; // Q15 +extern const Word16 lpc_weights_fx[]; // Q15 +extern const Word16 SHBCB_SubGain5bit_12_fx[]; /* 5 bit Quantizer table for SHB gain shapes Q12*/ +extern const Word16 E_ROM_inter4_1_fx[PIT_UP_SAMP * L_INTERPOL1 + 1]; // Q14 +extern const Word16 E_ROM_inter6_1_fx[PIT_UP_SAMP6 * L_INTERPOL1 + 1]; // Q14 +extern const Word16 kLog2TableFrac_x[256]; // Q8 +extern const Word16 kExp2TableFrac_x[256]; // Q15 +extern const Word16 One_div_fx[]; // Q15 // ivas_lfe_dec_fx.c extern const Word32 tbl_two_pow_shift_by_4[35]; /* Q30 */ -extern const Word16 ivas_tan_panning_gain_tbl_fx[601]; -extern const Word16 ivas_sine_panning_tbl_fx[601]; -extern const Word16 ivas_sin_az_fx[361]; +extern const Word16 ivas_tan_panning_gain_tbl_fx[601]; // Q15 +extern const Word16 ivas_sine_panning_tbl_fx[601]; // Q15 +extern const Word16 ivas_sin_az_fx[361]; // Q15 // edct_fx.c -extern const Word16 sin_scale_tbl_960[960]; -extern const Word16 cos_scale_tbl_960[960]; -extern const Word16 cos_scale_tbl_640[640]; -extern const Word16 sin_scale_tbl_640[640]; -extern const Word16 sin_scale_tbl_512[512]; -extern const Word16 cos_scale_tbl_512[512]; -extern const Word16 cos_scale_tbl_1200[1200]; -extern const Word16 sin_scale_tbl_1200[1200]; -extern const Word16 cos_scale_tbl_800[800]; -extern const Word16 sin_scale_tbl_800[800]; - -extern const Word16 scales_ivas_fx[][MAX_NO_SCALES * 2]; -extern const Word16 scales_p_ivas_fx[][MAX_NO_SCALES * 2]; +extern const Word16 sin_scale_tbl_960[960]; // Q15 +extern const Word16 cos_scale_tbl_960[960]; // Q15 +extern const Word16 cos_scale_tbl_640[640]; // Q15 +extern const Word16 sin_scale_tbl_640[640]; // Q15 +extern const Word16 sin_scale_tbl_512[512]; // Q15 +extern const Word16 cos_scale_tbl_512[512]; // Q15 +extern const Word16 cos_scale_tbl_1200[1200]; // Q15 +extern const Word16 sin_scale_tbl_1200[1200]; // Q15 +extern const Word16 cos_scale_tbl_800[800]; // Q15 +extern const Word16 sin_scale_tbl_800[800]; // Q15 + +extern const Word16 scales_ivas_fx[][MAX_NO_SCALES * 2]; // Q11 +extern const Word16 scales_p_ivas_fx[][MAX_NO_SCALES * 2]; // Q11 #endif diff --git a/lib_com/rom_com_fx.c b/lib_com/rom_com_fx.c index 39b94b308..e669a8995 100644 --- a/lib_com/rom_com_fx.c +++ b/lib_com/rom_com_fx.c @@ -46,10 +46,12 @@ #define SHC( x ) ( (Word16) x ) const Word16 w_fft4_fx[2] = { + // Q15 SHC( 0x7fff ), SHC( 0x0000 ), }; const Word16 w_fft8_fx[8] = { + // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x5a82 ), @@ -61,6 +63,7 @@ const Word16 w_fft8_fx[8] = { }; const Word16 w_fft16_fx[8] = { + // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x5a82 ), @@ -72,6 +75,7 @@ const Word16 w_fft16_fx[8] = { }; const Word16 w_fft32_fx[16] = { + // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x5a82 ), @@ -91,6 +95,7 @@ const Word16 w_fft32_fx[16] = { }; const Word16 w_fft64_fx[32] = { + // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x5a82 ), @@ -126,6 +131,7 @@ const Word16 w_fft64_fx[32] = { }; const Word16 w_fft128_fx[64] = { + // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x5a82 ), @@ -193,6 +199,7 @@ const Word16 w_fft128_fx[64] = { }; const Word16 w_fft256_fx[128] = { + // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x5a82 ), @@ -324,6 +331,7 @@ const Word16 w_fft256_fx[128] = { }; const Word16 w_fft512_fx[256] = { + // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x5a82 ), @@ -583,6 +591,7 @@ const Word16 w_fft512_fx[256] = { }; const Word16 FFT_RotVector_960_fx[1860] = { + // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ffd ), @@ -2446,6 +2455,7 @@ const Word16 FFT_RotVector_960_fx[1860] = { }; const Word16 FFT_RotVector_640_fx[1240] = { + // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff9 ), @@ -3689,6 +3699,7 @@ const Word16 FFT_RotVector_640_fx[1240] = { }; const Word16 FFT_RotVector_600_fx[1140] = { + // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff8 ), @@ -4832,6 +4843,7 @@ const Word16 FFT_RotVector_600_fx[1140] = { }; const Word16 FFT_RotVector_400_fx[760] = { + // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7fef ), @@ -5595,6 +5607,7 @@ const Word16 FFT_RotVector_400_fx[760] = { }; const Word16 FFT_RotVector_256_fx[448] = { + // Q15 SHC( 0x7fff ), SHC( 0x0000 ), SHC( 0x7ff6 ), @@ -6046,6 +6059,7 @@ const Word16 FFT_RotVector_256_fx[448] = { }; const Word16 FFT_RotVector_32_fx[40] = { + // Q15 SHC( 0x7d8a ), SHC( 0xe708 ), SHC( 0x7641 ), @@ -6089,6 +6103,7 @@ const Word16 FFT_RotVector_32_fx[40] = { }; const Word16 cos_twiddle_table_25_5_5[25] = { + // Q15 SHC( 0x7fff ), SHC( 0x7fff ), SHC( 0x7fff ), @@ -6116,6 +6131,7 @@ const Word16 cos_twiddle_table_25_5_5[25] = { SHC( 0xae69 ), }; const Word16 sin_twiddle_table_25_5_5[25] = { + // Q15 SHC( 0x0000 ), SHC( 0x0000 ), SHC( 0x0000 ), @@ -6143,6 +6159,7 @@ const Word16 sin_twiddle_table_25_5_5[25] = { SHC( 0x62a0 ), }; const Word16 cos_twiddle_table_16_8_2[16] = { + // Q15 SHC( 0x7fff ), SHC( 0x7fff ), SHC( 0x7fff ), @@ -6161,6 +6178,7 @@ const Word16 cos_twiddle_table_16_8_2[16] = { SHC( 0x89bf ), }; const Word16 sin_twiddle_table_16_8_2[16] = { + // Q15 SHC( 0x0000 ), SHC( 0x0000 ), SHC( 0x0000 ), @@ -6648,7 +6666,7 @@ const Word16 lsf_q_cb_3b_fx[8] = { 1739, 2011, 2365, 2953 }; -const Word16 *const lsf_q_cb_fx[NUM_Q_LSF] = { lsf_q_cb_4b_fx, lsf_q_cb_4b_fx, lsf_q_cb_3b_fx, lsf_q_cb_3b_fx, lsf_q_cb_3b_fx }; +const Word16 *const lsf_q_cb_fx[NUM_Q_LSF] = { lsf_q_cb_4b_fx, lsf_q_cb_4b_fx, lsf_q_cb_3b_fx, lsf_q_cb_3b_fx, lsf_q_cb_3b_fx }; // Q15 /*Q15*/ const Word16 lsf_grid_fx[4][5] = { diff --git a/lib_com/rom_com_fx.h b/lib_com/rom_com_fx.h index 01ef473c4..4ab4bf819 100644 --- a/lib_com/rom_com_fx.h +++ b/lib_com/rom_com_fx.h @@ -44,47 +44,47 @@ * FFT transform *------------------------------------------------------------------------------*/ -extern const Word16 w_fft64_fx[32]; -extern const Word16 w_fft32_fx[16]; -extern const Word16 w_fft16_fx[8]; -extern const Word16 w_fft8_fx[8]; -extern const Word16 w_fft128_fx[64]; -extern const Word16 w_fft256_fx[128]; -extern const Word16 w_fft512_fx[256]; -extern const Word16 w_fft4_fx[2]; - -extern const Word16 FFT_RotVector_960_fx[1860]; -extern const Word16 FFT_RotVector_640_fx[1240]; -extern const Word16 FFT_RotVector_600_fx[1140]; -extern const Word16 FFT_RotVector_400_fx[760]; -extern const Word16 FFT_RotVector_256_fx[448]; -extern const Word16 FFT_RotVector_32_fx[40]; - -extern const Word16 sincos_t_rad3_fx[T_SIN_PI_2 + 1]; - -extern const Word16 cos_twiddle_table_25_5_5[25]; -extern const Word16 sin_twiddle_table_25_5_5[25]; -extern const Word16 cos_twiddle_table_16_8_2[16]; -extern const Word16 sin_twiddle_table_16_8_2[16]; - - -extern const Word16 CLDFB80_10_fx[100]; -extern const Word16 CLDFB80_16_fx[160]; -extern const Word16 CLDFB80_20_fx[200]; -extern const Word16 CLDFB80_30_fx[300]; -extern const Word16 CLDFB80_32_fx[320]; -extern const Word16 CLDFB80_40_fx[400]; -extern const Word16 CLDFB80_60_fx[600]; +extern const Word16 w_fft64_fx[32]; // Q15 +extern const Word16 w_fft32_fx[16]; // Q15 +extern const Word16 w_fft16_fx[8]; // Q15 +extern const Word16 w_fft8_fx[8]; // Q15 +extern const Word16 w_fft128_fx[64]; // Q15 +extern const Word16 w_fft256_fx[128]; // Q15 +extern const Word16 w_fft512_fx[256]; // Q15 +extern const Word16 w_fft4_fx[2]; // Q15 + +extern const Word16 FFT_RotVector_960_fx[1860]; // Q15 +extern const Word16 FFT_RotVector_640_fx[1240]; // Q15 +extern const Word16 FFT_RotVector_600_fx[1140]; // Q15 +extern const Word16 FFT_RotVector_400_fx[760]; // Q15 +extern const Word16 FFT_RotVector_256_fx[448]; // Q15 +extern const Word16 FFT_RotVector_32_fx[40]; // Q15 + +extern const Word16 sincos_t_rad3_fx[T_SIN_PI_2 + 1]; // Q15 + +extern const Word16 cos_twiddle_table_25_5_5[25]; // Q15 +extern const Word16 sin_twiddle_table_25_5_5[25]; // Q15 +extern const Word16 cos_twiddle_table_16_8_2[16]; // Q15 +extern const Word16 sin_twiddle_table_16_8_2[16]; // Q15 + + +extern const Word16 CLDFB80_10_fx[100]; // Q15 +extern const Word16 CLDFB80_16_fx[160]; // Q15 +extern const Word16 CLDFB80_20_fx[200]; // Q15 +extern const Word16 CLDFB80_30_fx[300]; // Q15 +extern const Word16 CLDFB80_32_fx[320]; // Q15 +extern const Word16 CLDFB80_40_fx[400]; // Q15 +extern const Word16 CLDFB80_60_fx[600]; // Q15 /*5ms delay*/ -extern const Word16 LDQMF_10_fx[100]; -extern const Word16 LDQMF_16_fx[160]; -extern const Word16 LDQMF_20_fx[200]; -extern const Word16 LDQMF_30_fx[300]; -extern const Word16 LDQMF_32_fx[320]; -extern const Word16 LDQMF_40_fx[400]; -extern const Word16 LDQMF_60_fx[600]; - +extern const Word16 LDQMF_10_fx[100]; // Q15 +extern const Word16 LDQMF_16_fx[160]; // Q15 +extern const Word16 LDQMF_20_fx[200]; // Q15 +extern const Word16 LDQMF_30_fx[300]; // Q15 +extern const Word16 LDQMF_32_fx[320]; // Q15 +extern const Word16 LDQMF_40_fx[400]; // Q15 +extern const Word16 LDQMF_60_fx[600]; // Q15 +/* Not used anywhere extern const Word16 LDQMF_10_enc_fx[100]; extern const Word16 LDQMF_16_enc_fx[160]; extern const Word16 LDQMF_20_enc_fx[200]; @@ -92,24 +92,24 @@ extern const Word16 LDQMF_30_enc_fx[300]; extern const Word16 LDQMF_32_enc_fx[320]; extern const Word16 LDQMF_40_enc_fx[400]; extern const Word16 LDQMF_60_enc_fx[600]; - -extern const Word32 rot_vec_delay_re_LDQMF_fx[60]; -extern const Word32 rot_vec_delay_im_LDQMF_fx[60]; - -extern const Word32 rot_vec_ana_re_L10_fx[5]; -extern const Word32 rot_vec_ana_im_L10_fx[5]; -extern const Word32 rot_vec_ana_re_L16_fx[8]; -extern const Word32 rot_vec_ana_im_L16_fx[8]; -extern const Word32 rot_vec_ana_re_L20_fx[10]; -extern const Word32 rot_vec_ana_im_L20_fx[10]; -extern const Word32 rot_vec_ana_re_L30_fx[15]; -extern const Word32 rot_vec_ana_im_L30_fx[15]; -extern const Word32 rot_vec_ana_re_L32_fx[16]; -extern const Word32 rot_vec_ana_im_L32_fx[16]; -extern const Word32 rot_vec_ana_re_L40_fx[20]; -extern const Word32 rot_vec_ana_im_L40_fx[20]; -extern const Word32 rot_vec_ana_re_L60_fx[30]; -extern const Word32 rot_vec_ana_im_L60_fx[30]; +*/ +extern const Word32 rot_vec_delay_re_LDQMF_fx[60]; // Q31 +extern const Word32 rot_vec_delay_im_LDQMF_fx[60]; // Q31 + +extern const Word32 rot_vec_ana_re_L10_fx[5]; // Q29 +extern const Word32 rot_vec_ana_im_L10_fx[5]; // Q29 +extern const Word32 rot_vec_ana_re_L16_fx[8]; // Q29 +extern const Word32 rot_vec_ana_im_L16_fx[8]; // Q29 +extern const Word32 rot_vec_ana_re_L20_fx[10]; // Q29 +extern const Word32 rot_vec_ana_im_L20_fx[10]; // Q29 +extern const Word32 rot_vec_ana_re_L30_fx[15]; // Q29 +extern const Word32 rot_vec_ana_im_L30_fx[15]; // Q29 +extern const Word32 rot_vec_ana_re_L32_fx[16]; // Q29 +extern const Word32 rot_vec_ana_im_L32_fx[16]; // Q29 +extern const Word32 rot_vec_ana_re_L40_fx[20]; // Q29 +extern const Word32 rot_vec_ana_im_L40_fx[20]; // Q29 +extern const Word32 rot_vec_ana_re_L60_fx[30]; // Q29 +extern const Word32 rot_vec_ana_im_L60_fx[30]; // Q29 extern const Word16 LP_assym_window_fx[]; /* Assymetric window for LP analysis @12.8kHz (Q15) */ extern const Word16 LP_assym_window_16k_fx[]; /* Assymetric window for LP analysis @16kHz (Q15) */ diff --git a/lib_com/scale_mem_fx.c b/lib_com/scale_mem_fx.c index c02eff2a5..49e6aef99 100644 --- a/lib_com/scale_mem_fx.c +++ b/lib_com/scale_mem_fx.c @@ -47,16 +47,16 @@ * Scale excitation and total excitation (exc2) *-------------------------------------------------------------------*/ Word16 Rescale_exc( - Word16 dct_post_old_exc_fx[], /* i/o: Music post processing memory */ + Word16 dct_post_old_exc_fx[], /* i/o: Music post processing memory Q_exc*/ Word16 exc[], /* i/o: excitation to rescale Q_exc */ - Word16 bwe_exc[], - Word16 *last_exc_dct_in, - Word16 lg, /* i : frame size */ + Word16 bwe_exc[], /* output Q = Q_exc */ + Word16 *last_exc_dct_in, /* output Q = Q_exc */ + Word16 lg, /* i : frame size */ Word16 lg32, Word32 L_gain_code, /* i : decoded codebook gain Q16 */ Word16 *sQ_exc, /* i/o: Excitation scaling factor */ Word16 *sQsubfr, /* i/o: Past excitation scaling factors */ - Word16 exc2[], /* o : local excitation vector */ + Word16 exc2[], /* o : local excitation vector output Q = Q_exc */ Word16 i_subfr, /* i : subframe number */ const Word16 coder_type ) { @@ -188,14 +188,14 @@ void Rescale_mem( const Word16 Q_exc, /* i : current excitation scaling (>=0) */ Word16 *prev_Q_syn, /* i/o : scaling factor of previous frame */ Word16 *Q_syn, /* i/o : scaling factor of frame */ - Word16 *mem_syn2, /* i/o : modified synthesis memory */ - Word16 *mem_syn_clas_estim_fx, /* i/o : old 12k8 core memory for classification */ + Word16 *mem_syn2, /* i/o : modified synthesis memory Qexp_scale */ + Word16 *mem_syn_clas_estim_fx, /* i/o : old 12k8 core memory for classification Qexp_scale*/ const Word16 MaxScaling, /* i: Minimal difference between excitation scaling and synthesis scaling */ - Word16 *mem_deemph, /* i/o: speech deemph filter memory */ - Word16 *pst_old_syn, /* i/o: psfiler */ - Word16 *pst_mem_deemp_err, /* i/o: psfiler */ - Word16 *mem_agc, - PFSTAT_HANDLE hPFstat, /* i/o: All memories related to NB post filter */ + Word16 *mem_deemph, /* i/o: speech deemph filter memory Qexp_scale */ + Word16 *pst_old_syn, /* i/o: psfiler Qexp_scale*/ + Word16 *pst_mem_deemp_err, /* i/o: psfiler Qexp_scale */ + Word16 *mem_agc, /*Qexp_scale*/ + 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 */ @@ -337,7 +337,7 @@ Word16 rescale_mem( const Word16 *Q_exc, /* i : current excitation scaling (>=0) */ Word16 *prev_Q_syn, /* i/o : scaling factor of previous frame */ Word16 *Q_syn, /* i/o : scaling factor of frame */ - Word16 *mem_syn2, /* i/o : modified synthesis memory */ + Word16 *mem_syn2, /* i/o : modified synthesis memory Q_syn */ Word16 *syn, /* i/o : synthesis to rescale Q_syn */ Word16 mem_len, /* i : lenght of modified synthesis memory */ Word16 i_subfr /* i : subframe number */ diff --git a/lib_com/stab_est_fx.c b/lib_com/stab_est_fx.c index e0c75e563..73d58af44 100644 --- a/lib_com/stab_est_fx.c +++ b/lib_com/stab_est_fx.c @@ -31,12 +31,12 @@ *------------------------------------------------------------------------*/ 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 etot, /* i : Total energy of the current frame Q8*/ + Word16 *lt_diff_etot, /* i/o : Long term total energy variation Q8*/ + Word16 *mem_etot, /* i/o : Total energy memory Q8*/ 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 *thresh, /* i/o : Detection thresold Q11*/ Word16 *last_music_flag, /* i/o : Previous music detection ouptut */ const Word16 vad_flag /* i : VAD flag */ ) @@ -121,7 +121,6 @@ Word16 stab_est_fx( music_flag2 = 0; move16(); /* deactivate spectral modification (if music_flag2 != 0 is activated) */ - test(); /*--------------------------------------------------------------------* * statistical deviation < thresh3 and last signal category type >= 3 * (last category was "tonal" and the new one is "very tonal") @@ -182,6 +181,7 @@ Word16 stab_est_fx( *nb_thr_1 = add( *nb_thr_1, 1 ); *nb_thr_3 = 0; move16(); + move16(); } /*------------------------------------------------------------------------* diff --git a/lib_com/stat_com.h b/lib_com/stat_com.h index 487d94dbf..6c19f481a 100644 --- a/lib_com/stat_com.h +++ b/lib_com/stat_com.h @@ -61,13 +61,13 @@ typedef struct Word16 a_fx[MAXLAG_WI]; /* Q(DTFS_STRUCTURE.Q) */ Word16 b_fx[MAXLAG_WI]; /* Q(DTFS_STRUCTURE.Q) */ #endif - int16_t lag; - int16_t nH; - int16_t nH_4kHz; + Word16 lag; + Word16 nH; + Word16 nH_4kHz; // lag and lag_fx to be same - Word16 lag_fx; - Word16 nH_fx; - Word16 nH_4kHz_fx; + Word16 lag_fx; // Q0 + Word16 nH_fx; // Q0 + Word16 nH_4kHz_fx; // Q0 #ifndef IVAS_FLOAT_FIXED float upper_cut_off_freq_of_interest; @@ -76,16 +76,16 @@ typedef struct Word16 upper_cut_off_freq_of_interest_fx; /* Q0 */ Word16 upper_cut_off_freq_fx; /* Q0 */ #endif - int32_t sampling_rate; - Word16 Fs_fx; + Word32 sampling_rate; + Word16 Fs_fx; /* Q0 */ Word16 Q; } DTFS_STRUCTURE; typedef struct { - int16_t lead_sign_ind; + Word16 lead_sign_ind; uint32_t index, size; - int16_t dim, k_val; + Word16 dim, k_val; } PvqEntry; typedef struct @@ -119,20 +119,20 @@ typedef struct typedef struct { /*Coding mode info*/ - int16_t mode_index; + Word16 mode_index; /*LPC info*/ - int16_t midLpc; /*Flag for using or not mid LPC for the current frame*/ - int16_t midLpc_enable; /*Flag enabling or not the mid LPC for the current mode*/ + Word16 midLpc; /*Flag for using or not mid LPC for the current frame*/ + Word16 midLpc_enable; /*Flag enabling or not the mid LPC for the current mode*/ /*ICB flags*/ - int16_t pre_emphasis; /*Flag for triggering pre-emphasis*/ - int16_t pitch_sharpening; /*Flag for triggering pitch sharpening*/ - int16_t phase_scrambling; /*Flag for triggering phase scrambling*/ - int16_t formant_enh; /*Flag for triggering formant enhancement*/ - int16_t formant_tilt; /*Flag for triggering formant tile*/ + Word16 pre_emphasis; /*Flag for triggering pre-emphasis*/ + Word16 pitch_sharpening; /*Flag for triggering pitch sharpening*/ + Word16 phase_scrambling; /*Flag for triggering phase scrambling*/ + Word16 formant_enh; /*Flag for triggering formant enhancement*/ + Word16 formant_tilt; /*Flag for triggering formant tile*/ - int16_t voice_tilt; /*Flag for triggering new voice factor tilt*/ + Word16 voice_tilt; /*Flag for triggering new voice factor tilt*/ #ifndef IVAS_FLOAT_FIXED float formant_enh_num_flt; @@ -142,41 +142,41 @@ typedef struct Word16 formant_enh_den; /* Q15 */ #endif - int16_t bpf_mode; + Word16 bpf_mode; - int16_t nrg_mode; - int16_t nrg_bits; + Word16 nrg_mode; + Word16 nrg_bits; - int16_t ltp_mode; - int16_t ltp_bits; + Word16 ltp_mode; + Word16 ltp_bits; - int16_t ltf_mode; - int16_t ltf_bits; + Word16 ltf_mode; + Word16 ltf_bits; - int16_t gains_mode[NB_SUBFR16k]; + Word16 gains_mode[NB_SUBFR16k]; - int16_t fixed_cdk_index[NB_SUBFR16k]; + Word16 fixed_cdk_index[NB_SUBFR16k]; /* IVAS related parameters */ - int16_t pitch_bits[NB_SUBFR16k]; - int16_t lsf_bits; - int16_t mid_lsf_bits; - int16_t AVQ_cdk_bits[NB_SUBFR16k]; - int16_t FEC_mode; /* 0 == no FEC bits; 1 == class; 2 == clas+energy; 3== class+energy+pulse */ - int16_t ubits; - int16_t fcb_mode; /* 0 == mode1; 1 == mode2 */ + 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; typedef struct { - int16_t bits; /* bits per subframe */ - int16_t nbiter; /* number of iterations */ + Word16 bits; /* bits per subframe */ + Word16 nbiter; /* number of iterations */ float alp_flt; /* initial energy of all fixed pulses */ - Word16 alp; /* initial energy of all fixed pulses, exponent = ALP_E */ - int16_t nb_pulse; /* number of pulses */ - int16_t fixedpulses; /* number of pulses whose position is determined from correlation and not by iteration */ - int16_t nbpos[13]; /* number of positions tried in the pair-wise search */ + Word16 alp; /* initial energy of all fixed pulses, exponent = ALP_E Q13*/ + Word16 nb_pulse; /* number of pulses */ + Word16 fixedpulses; /* number of pulses whose position is determined from correlation and not by iteration */ + Word16 nbpos[13]; /* number of positions tried in the pair-wise search */ enum TRACKPOS codetrackpos; /* ordering of tracks -mode */ } PulseConfig; @@ -191,20 +191,20 @@ typedef enum } TNS_ERROR; typedef struct { - uint8_t maxOrder; - uint8_t nMaxFilters; /* Maximum number of filters. */ - uint8_t allowTnsOnWhite; - struct TnsParameters const *pTnsParameters; /* Parameters for each TNS filter */ - int16_t iFilterBorders[TNS_MAX_NUM_OF_FILTERS + 1]; /* Lower borders for each filter. Upper border for the first filter is nsbBorders-1. Upper borders for other filters is the lower border of previous filter. */ + UWord8 maxOrder; + UWord8 nMaxFilters; /* Maximum number of filters. */ + UWord8 allowTnsOnWhite; + struct TnsParameters const *pTnsParameters; /* Parameters for each TNS filter */ + Word16 iFilterBorders[TNS_MAX_NUM_OF_FILTERS + 1]; /* Lower borders for each filter. Upper border for the first filter is nsbBorders-1. Upper borders for other filters is the lower border of previous filter. */ } STnsConfig; typedef struct TNS_filter_structure { - int16_t filterType; - int16_t spectrumLength; /* Number of subbands covered by the filter. */ - int16_t order; /* Filter order. */ - int16_t coefIndex[TNS_MAX_FILTER_ORDER]; /* Quantized filter coefficients. */ + Word16 filterType; + Word16 spectrumLength; /* Number of subbands covered by the filter. */ + Word16 order; /* Filter order. */ + Word16 coefIndex[TNS_MAX_FILTER_ORDER]; /* Quantized filter coefficients. */ #ifndef IVAS_FLOAT_FIXED float predictionGain_flt; /* Prediction gain. The ratio of a signal and TNS residual energy. */ float avgSqrCoef_flt; /* Average squared filter coefficient. */ @@ -216,8 +216,8 @@ typedef struct TNS_filter_structure typedef struct /* TNS data describing all active filters. */ { - int16_t nFilters; /* Number of active filters. */ - int16_t tnsOnWhitenedSpectra; + Word16 nFilters; /* Number of active filters. */ + Word16 tnsOnWhitenedSpectra; STnsFilter filter[TNS_MAX_NUM_OF_FILTERS]; /* Active filters. */ } STnsData; @@ -226,16 +226,16 @@ typedef struct /* TNS data describing all active filters. */ Borders and weighting are available for TCX10 and TCX20 for a specific sampling rate. */ typedef struct { - const uint8_t bandLengthsTCX20[FDNS_NPTS]; /* Length of a band in number of bins. Range is 2..31 */ - const uint8_t bandLengthsTCX10[FDNS_NPTS]; /* Length of a band in number of bins. Range is 2..20, always divisible by 2 */ + const UWord8 bandLengthsTCX20[FDNS_NPTS]; /* Length of a band in number of bins. Range is 2..31 */ + const UWord8 bandLengthsTCX10[FDNS_NPTS]; /* Length of a band in number of bins. Range is 2..20, always divisible by 2 */ } SpectrumWarping; typedef struct { - int16_t nBins; /* Range 0..1200 */ - uint8_t nBands; /* Range 0..64 */ - const uint8_t *bandLengths; /* Length of a band in number of bins. Range is 2..31 */ + Word16 nBins; /* Range 0..1200 */ + UWord8 nBands; /* Range 0..64 */ + const UWord8 *bandLengths; /* Length of a band in number of bins. Range is 2..31 */ } PsychoacousticParameters; @@ -251,29 +251,29 @@ typedef struct TCX_config_structure PWord16 tcx_mdct_window_half[L_MDCT_HALF_OVLP_MAX_CORE_FS]; PWord16 tcx_mdct_window_minimum[L_MDCT_MIN_OVLP_MAX_CORE_FS]; PWord16 tcx_mdct_window_trans[L_MDCT_MIN_OVLP_MAX_CORE_FS]; - Word16 tcx_aldo_window_1[L_FRAME32k * 9 / 32]; + Word16 tcx_aldo_window_1[L_FRAME32k * 9 / 32]; /*Q15*/ PWord16 tcx_aldo_window_1_trunc[L_FRAME32k * 7 / 32]; PWord16 tcx_aldo_window_2[L_FRAME32k * 7 / 32]; - int16_t last_aldo; + Word16 last_aldo; float tcx_mdct_window_half_flt[L_MDCT_HALF_OVLP_MAX_CORE_FS]; float tcx_mdct_window_minimum_flt[L_MDCT_MIN_OVLP_MAX_CORE_FS]; float tcx_mdct_window_trans_flt[L_MDCT_MIN_OVLP_MAX_CORE_FS]; /* transition window for ACELP->TCX */ - int16_t tcx5Size; /* Size of the TCX5 spectrum in number of samples. Always 5ms. */ + Word16 tcx5Size; /* Size of the TCX5 spectrum in number of samples. Always 5ms. */ - int16_t tcx_curr_overlap_mode; /* window overlap of current frame (0: full, 2: none, or 3: half) */ - int16_t tcx_last_overlap_mode; /* previous window overlap, i.e. left-side overlap of current frame */ + Word16 tcx_curr_overlap_mode; /* window overlap of current frame (0: full, 2: none, or 3: half) */ + Word16 tcx_last_overlap_mode; /* previous window overlap, i.e. left-side overlap of current frame */ - int16_t tcx_mdct_window_length; /* length of overlap-add region*/ - int16_t tcx_mdct_window_half_length; /* length of the "half" overlap */ - int16_t tcx_mdct_window_min_length; /* length of the "minimum" overlap */ - int16_t tcx_mdct_window_trans_length; /* length of the ACELP->TCX overlap */ + Word16 tcx_mdct_window_length; /* length of overlap-add region*/ + Word16 tcx_mdct_window_half_length; /* length of the "half" overlap */ + Word16 tcx_mdct_window_min_length; /* length of the "minimum" overlap */ + Word16 tcx_mdct_window_trans_length; /* length of the ACELP->TCX overlap */ - int16_t tcx_mdct_window_delay; /* length of window delay */ - int16_t tcx_offset; /* Offset of the folding point relative to the end of the previous synthetised frame */ - int16_t tcx_mdct_window_length_old; /* for keeping old value for sample rate switching */ + Word16 tcx_mdct_window_delay; /* length of window delay */ + Word16 tcx_offset; /* Offset of the folding point relative to the end of the previous synthetised frame */ + Word16 tcx_mdct_window_length_old; /* for keeping old value for sample rate switching */ float tcx_mdct_windowFB_flt[L_MDCT_OVLP_MAX]; float tcx_aldo_window_1_FB_flt[L_ALDO_WIN1_FB_MAX]; /* ALDO window long slope */ float tcx_aldo_window_2_FB_flt[L_MDCT_OVLP_MAX]; /* ALDO window short slope */ @@ -288,28 +288,28 @@ typedef struct TCX_config_structure PWord16 tcx_mdct_window_halfFB[L_MDCT_HALF_OVLP_MAX]; PWord16 tcx_mdct_window_minimumFB[L_MDCT_MIN_OVLP_MAX]; PWord16 tcx_mdct_window_transFB[L_MDCT_TRANS_OVLP_MAX]; - Word16 tcx_aldo_window_1_FB[L_FRAME_MAX * 9 / 32]; + Word16 tcx_aldo_window_1_FB[L_FRAME_MAX * 9 / 32]; /*Q15*/ PWord16 tcx_aldo_window_1_FB_trunc[L_FRAME_MAX * 7 / 32]; PWord16 tcx_aldo_window_2_FB[L_FRAME_MAX * 7 / 32]; - int16_t tcx5SizeFB; /* Size of the TCX5 spectrum in number of samples. Always 5ms. */ + Word16 tcx5SizeFB; /* Size of the TCX5 spectrum in number of samples. Always 5ms. */ - int16_t tcx_mdct_window_lengthFB; /* length of window, length of overlap-add region */ - int16_t tcx_mdct_window_half_lengthFB; /* length of the "half" overlap window */ - int16_t tcx_mdct_window_min_lengthFB; /* length of the "minimum" overlap window */ - int16_t tcx_mdct_window_trans_lengthFB; /* length of the ACELP->TCX overlap */ + Word16 tcx_mdct_window_lengthFB; /* length of window, length of overlap-add region */ + Word16 tcx_mdct_window_half_lengthFB; /* length of the "half" overlap window */ + Word16 tcx_mdct_window_min_lengthFB; /* length of the "minimum" overlap window */ + Word16 tcx_mdct_window_trans_lengthFB; /* length of the ACELP->TCX overlap */ - int16_t tcx_mdct_window_delayFB; /* length of window delay */ - int16_t tcx_offsetFB; + Word16 tcx_mdct_window_delayFB; /* length of window delay */ + Word16 tcx_offsetFB; - int16_t tcx_coded_lines; /* max number of coded lines, depending on audio bandwidth */ + Word16 tcx_coded_lines; /* max number of coded lines, depending on audio bandwidth */ /* FAC window */ - int16_t lfacNext; - int16_t lfacNextFB; + Word16 lfacNext; + Word16 lfacNextFB; /* TNS */ - int16_t fIsTNSAllowed; + Word16 fIsTNSAllowed; STnsConfig tnsConfig[2][2]; STnsConfig const *pCurrentTnsConfig; @@ -319,18 +319,18 @@ typedef struct TCX_config_structure #else Word16 sq_rounding; /* set the sq deadzone (no deadzone=0.5f) Q15 */ #endif - int16_t tcxRateLoopOpt; + Word16 tcxRateLoopOpt; /*Bandwidth*/ float preemph_fac_flt; /* preemphasis factor */ float bandwidth_flt; - Word16 preemph_fac; /*preemphasis factor*/ + Word16 preemph_fac; /*preemphasis factorQ15*/ Word16 bandwidth; /* Context HM - Residual Quantization*/ - int16_t ctx_hm; /* Flag for enabling Context HM */ - int16_t resq; /* Flag for enabling Residual Quantization */ - int16_t coder_type; /* GC,VC,UC */ + Word16 ctx_hm; /* Flag for enabling Context HM */ + Word16 resq; /* Flag for enabling Residual Quantization */ + Word16 coder_type; /* GC,VC,UC */ #ifndef IVAS_FLOAT_FIXED float na_scale_flt; @@ -354,10 +354,10 @@ typedef struct TCX_config_structure typedef struct { - int32_t low; - int32_t high; + Word32 low; + Word32 high; uint32_t value; - int32_t bits_to_follow; + Word32 bits_to_follow; } Tastat; #ifdef IVAS_FLOAT_FIXED typedef struct @@ -372,22 +372,22 @@ typedef struct typedef struct { - int16_t fftlen; /* FFT length */ - int16_t stopFFTbin; /* Number of FFT bins to be actually processed */ - int16_t numPartitions; /* Number of partitions */ - const int16_t *sidPartitions; /* Upper boundaries for grouping the (sub)bands into partitions when transmitting SID frames (define as NULL pointer to avoid grouping) */ + Word16 fftlen; /* FFT length */ + Word16 stopFFTbin; /* Number of FFT bins to be actually processed */ + Word16 numPartitions; /* Number of partitions */ + const Word16 *sidPartitions; /* Upper boundaries for grouping the (sub)bands into partitions when transmitting SID frames (define as NULL pointer to avoid grouping) */ - int16_t numShapingPartitions; /* Number of partitions */ - const int16_t *shapingPartitions; /* Upper boundaries for grouping the (sub)bands into partitions for shaping at the decoder (define as NULL pointer to avoid grouping) */ + Word16 numShapingPartitions; /* Number of partitions */ + const Word16 *shapingPartitions; /* Upper boundaries for grouping the (sub)bands into partitions for shaping at the decoder (define as NULL pointer to avoid grouping) */ } FD_CNG_SETUP; typedef struct { - int16_t bwmode; + Word16 bwmode; - int32_t bitrateFrom; - int32_t bitrateTo; + Word32 bitrateFrom; + Word32 bitrateTo; #ifndef IVAS_FLOAT_FIXED float scale_flt; @@ -402,30 +402,30 @@ typedef struct { FD_CNG_SETUP FdCngSetup; - int16_t numSlots; /* Number of time slots in CLDFB matrix */ - int16_t regularStopBand; /* Number of CLDFB bands to be considered */ + Word16 numSlots; /* Number of time slots in CLDFB matrix */ + Word16 regularStopBand; /* Number of CLDFB bands to be considered */ - int16_t numCoreBands; /* Number of core bands to be decomposed into FFT subbands */ - int16_t stopBand; /* Total number of (sub)bands to be considered */ - int16_t startBand; /* First (sub)band to be considered */ - int16_t stopFFTbin; /* Total number of FFT subbands */ - int16_t frameSize; /* Frame size in samples */ - int16_t fftlen; /* FFT length used for the decomposition */ - Word16 fftlenShift; - Word16 fftlenFac; + Word16 numCoreBands; /* Number of core bands to be decomposed into FFT subbands */ + Word16 stopBand; /* Total number of (sub)bands to be considered */ + Word16 startBand; /* First (sub)band to be considered */ + Word16 stopFFTbin; /* Total number of FFT subbands */ + Word16 frameSize; /* Frame size in samples */ + Word16 fftlen; /* FFT length used for the decomposition */ + Word16 fftlenShift; // Q0 + Word16 fftlenFac; // Q0 float timeDomainBuffer_flt[L_FRAME16k]; - Word16 timeDomainBuffer[L_FRAME16k]; + Word16 timeDomainBuffer[L_FRAME16k]; /*Q15*/ float fftBuffer_flt[FFTLEN]; float olapBufferAna_flt[FFTLEN]; float olapBufferSynth_flt[FFTLEN]; #ifdef IVAS_FLOAT_FIXED - Word32 olapBufferSynth_fx[FFTLEN]; + Word32 olapBufferSynth_fx[FFTLEN]; /*Q_olapBufferSynth*/ #endif float olapBufferSynth2_flt[FFTLEN]; #ifdef IVAS_FLOAT_FIXED - Word32 olapBufferSynth2_fx[FFTLEN]; + Word32 olapBufferSynth2_fx[FFTLEN]; /*Q_olapBufferSynth2*/ #endif #ifndef IVAS_FLOAT_FIXED const float *olapWinAna_flt; @@ -436,27 +436,27 @@ typedef struct const Word16 *olapWinSyn_fx; /* Q15 */ const Word16 *fftSineTab_fx; /* Q15 */ #endif - Word32 fftBuffer[FFTLEN]; + Word32 fftBuffer[FFTLEN]; // Q31-fftBuffer_exp Word16 fftBuffer_exp; - Word16 *olapBufferAna; /* points to FD_CNG_DEC->olapBufferAna[FFTLEN] in case of decoder */ - Word16 olapBufferAna_fx[FFTLEN]; /* points to FD_CNG_DEC->olapBufferAna[FFTLEN] in case of decoder */ - Word16 olapBufferSynth[FFTLEN]; - Word16 *olapBufferSynth2; /* points to FD_CNG_DEC->olapBufferSynth2[FFTLEN] in case of decoder */ + Word16 *olapBufferAna; /* q_olapBufferAna */ /* points to FD_CNG_DEC->olapBufferAna[FFTLEN] in case of decoder */ + Word16 olapBufferAna_fx[FFTLEN]; /* q_olapBufferAna_fx */ /* points to FD_CNG_DEC->olapBufferAna[FFTLEN] in case of decoder */ + Word16 olapBufferSynth[FFTLEN]; /* q_olapBuffer */ + Word16 *olapBufferSynth2; /*Q_syn*/ /* points to FD_CNG_DEC->olapBufferSynth2[FFTLEN] in case of decoder */ const PWord16 *olapWinAna; const PWord16 *olapWinSyn; float msM_win_flt; float msM_subwin_flt; - Word16 msM_win; - Word16 msM_subwin; + Word16 msM_win; // Q8 + Word16 msM_subwin; // Q11 - int16_t msFrCnt_init_counter; /* Frame counter at initialization */ - int16_t msFrCnt_init_thresh; + Word16 msFrCnt_init_counter; /* Frame counter at initialization */ + Word16 msFrCnt_init_thresh; float init_old_flt; - Word16 init_old; + Word16 init_old; // Q15 - int16_t msFrCnt; /* Frame counter */ + Word16 msFrCnt; /* Frame counter */ #ifndef IVAS_FLOAT_FIXED float msAlphaCor_flt[2]; /* Correction factor (smoothed) */ float msSlope_flt[2]; @@ -464,72 +464,72 @@ typedef struct #else Word32 msAlphaCor[2]; /* Correction factor (smoothed) Q31 */ Word16 msSlope[2]; /* Q14 */ - Word32 msQeqInvAv[2]; + Word32 msQeqInvAv[2]; /* Q31- msQeqInvAv_exp*/ Word16 msQeqInvAv_exp[2]; #endif - int16_t msMinBufferPtr; + Word16 msMinBufferPtr; float msPsdSum_flt[2]; float msPeriodogSum_flt[2]; - Word32 msPsdSum[2]; - Word32 msPeriodogSum[2]; - Word16 msPeriodogSum_exp[2]; + Word32 msPsdSum[2]; /* 16Q15 */ + Word32 msPeriodogSum[2]; /* Q31- msPeriodogSum_exp*/ + Word16 msPeriodogSum_exp[2]; // Q0 - int16_t offsetflag; + Word16 offsetflag; float periodog_flt[PERIODOGLEN]; /* Periodogram */ float cngNoiseLevel_flt[FFTCLDFBLEN]; /* Noise level applied for the CNG in each (sub)band */ - Word32 periodog[PERIODOGLEN]; /* Periodogram */ - Word16 periodog_exp; - Word16 exp_cldfb_periodog; + Word32 periodog[PERIODOGLEN]; /* Periodogram Q31 - periodog_exp*/ + Word16 periodog_exp; // Q0 + Word16 exp_cldfb_periodog; // Q0 - Word32 cngNoiseLevel[FFTCLDFBLEN]; /* Noise level applied for the CNG in each (sub)band */ + Word32 cngNoiseLevel[FFTCLDFBLEN]; /* Noise level applied for the CNG in each (sub)band Q31 - cngNoiseLevelExp*/ // Word16 q_cngNoiseLevel; Word16 cngNoiseLevelExp; - int16_t seed; /* Seed memory (for random function) */ - int16_t seed2; /* Seed for second noise source in MDCT-Stereo DTX */ - int16_t seed3; /* Seed for third noise source in MDCT-Stereo DTX */ + Word16 seed; /* Seed memory (for random function) */ + Word16 seed2; /* Seed for second noise source in MDCT-Stereo DTX */ + Word16 seed3; /* Seed for third noise source in MDCT-Stereo DTX */ - int16_t npart; /* Number of partitions */ - int16_t midband[NPART]; /* Central band of each partition */ - int16_t nFFTpart; /* Number of hybrid spectral partitions */ - int16_t part[NPART]; /* Partition upper boundaries (band indices starting from 0) */ + Word16 npart; /* Number of partitions */ + Word16 midband[NPART]; /* Central band of each partition */ + Word16 nFFTpart; /* Number of hybrid spectral partitions */ + Word16 part[NPART]; /* Partition upper boundaries (band indices starting from 0) */ float psize_flt[NPART]; /* Partition sizes */ float psize_inv_flt[NPART]; /* Inverse of partition sizes */ float FFTscalingFactor_flt; /* Squared ratio between core signal analysis FFT and noise estimator FFT */ float scalingFactor_flt; - Word16 psize[NPART]; /* Partition sizes */ - Word16 psize_norm[NPART]; /* Partition sizes, fractional variable */ - Word16 psize_norm_exp; /* Partition sizes exponent for fractional variable */ - Word16 psize_inv[NPART]; /* Inverse of partition sizes */ - Word16 FFTscalingFactor; /* Squared ratio between core signal analysis FFT and noise estimator FFT */ - Word16 scalingFactor; - Word16 invScalingFactor; - int16_t nCLDFBpart; /* Number of CLDFB spectral partitions */ - int16_t CLDFBpart[NPARTCLDFB]; /* CLDFB Partition upper boundaries (band indices starting from 0 above the core coder bands) */ + Word16 psize[NPART]; /* Partition sizes 6Q9 */ + Word16 psize_norm_exp; /* Partition sizes exponent for fractional variable */ + Word16 psize_norm[NPART]; /* Partition sizes, fractional variable Q15-psize_norm_exp*/ + Word16 psize_inv[NPART]; /* Inverse of partition sizes Q15*/ + // Word16 FFTscalingFactor; /* Squared ratio between core signal analysis FFT and noise estimator FFT */ + Word16 scalingFactor; // Q15 + Word16 invScalingFactor; // Q15 + Word16 nCLDFBpart; /* Number of CLDFB spectral partitions */ + Word16 CLDFBpart[NPARTCLDFB]; /* CLDFB Partition upper boundaries (band indices starting from 0 above the core coder bands) */ float CLDFBpsize_inv_flt[NPARTCLDFB]; /* Inverse of CLDFB partition sizes */ - Word16 CLDFBpsize_inv[NPARTCLDFB]; /* Inverse of CLDFB partition sizes */ + Word16 CLDFBpsize_inv[NPARTCLDFB]; /* Inverse of CLDFB partition sizes Q15*/ - int16_t inactive_frame_counter; - int16_t sid_frame_counter; - int16_t active_frame_counter; /* Active frame counter limited to MSBUFLEN in stereo decoder */ + Word16 inactive_frame_counter; + Word16 sid_frame_counter; + Word16 active_frame_counter; /* Active frame counter limited to MSBUFLEN in stereo decoder */ float sidNoiseEst_flt[NPART]; /* Transmitted noise level */ - Word32 sidNoiseEst[NPART]; /* Transmitted noise level */ + Word32 sidNoiseEst[NPART]; /* Transmitted noise level Q31-sidNoiseEstExp*/ Word16 sidNoiseEstExp; float sidNoiseEstLp_flt[NPART]; - Word32 sidNoiseEstLp[NPART]; + Word32 sidNoiseEstLp[NPART]; // Q(31-sidNoiseEstExp) - int16_t frame_type_previous; + Word16 frame_type_previous; float A_cng_flt[M + 1]; float exc_cng_flt[L_FRAME16k]; - Word16 A_cng[M + 1]; - Word16 exc_cng[L_FRAME16k]; + Word16 A_cng[M + 1]; // Qx + Word16 exc_cng[L_FRAME16k]; // Q_new #ifdef IVAS_FLOAT_FIXED - Word32 exc_cng_32fx[L_FRAME16k]; + Word32 exc_cng_32fx[L_FRAME16k]; // Q_qexc_cng_32fx #endif Word32 CngBitrate; @@ -539,15 +539,15 @@ typedef struct #ifndef IVAS_FLOAT_FIXED float likelihood_noisy_speech_flt; #else - Word16 likelihood_noisy_speech; /* Q15 */ + Word16 likelihood_noisy_speech; /* Q15 */ #endif #ifndef IVAS_FLOAT_FIXED float coherence_flt; /* inter-channel coherence of noise */ #else - Word16 coherence_fx; /* inter-channel coherence of noise Q15 */ + Word16 coherence_fx; /* inter-channel coherence of noise Q15 */ #endif - int16_t no_side_flag; /* indicates whether the side noise shape should be zeroed-out or not */ + Word16 no_side_flag; /* indicates whether the side noise shape should be zeroed-out or not */ } FD_CNG_COM, *HANDLE_FD_CNG_COM; @@ -562,7 +562,7 @@ typedef struct * @param pValue Pointer to the value. * @return Substructure associated with this value or NULL if there is none. */ -typedef void const *( *TGetParamValue )( void const *p, int16_t index, int16_t *pValue ); +typedef void const *( *TGetParamValue )( void const *p, Word16 index, Word16 *pValue ); /** Function that puts specific value to p. * @param p Pointer to a variable that can also be structure or array. @@ -570,21 +570,21 @@ typedef void const *( *TGetParamValue )( void const *p, int16_t index, int16_t * * @param value The value. * @return Substructure associated with this value or NULL if there is none. */ -typedef void *( *TSetParamValue )( void *p, int16_t index, int16_t value ); +typedef void *( *TSetParamValue )( void *p, Word16 index, Word16 value ); /** Function that return required number of bits for a value when it is coded. * @param value The value. * @param index Index of a variable when it is an element of an array, otherwise 0. * @return Number of bits required to code the value. */ -typedef int16_t ( *TGetNumberOfBits )( int16_t value, int16_t index ); +typedef Word16 ( *TGetNumberOfBits )( Word16 value, Word16 index ); /** Function that encodes a value. * @param value The value. * @param index Index of a variable when it is an element of an array, otherwise 0. * @return Coded value. */ -typedef int16_t ( *TEncodeValue )( int16_t value, int16_t index ); +typedef Word16 ( *TEncodeValue )( Word16 value, Word16 index ); /** Function that decodes a value. * @param bitstream Bitstream containing a coded value. @@ -609,7 +609,7 @@ typedef struct ParamBitMap /** Number of bits in a bitstream required for the parameter. * If nBits is equal to 0 then GetNumberOfBits is used. */ - int16_t nBits; + Word16 nBits; /** Function to get the number of bits required for a value of this parameter. * If nBits != 0 it is not used and can be set to NULL. * If fZeroAllowed == 0 then GetNumberOfBits must take care of this. @@ -621,7 +621,7 @@ typedef struct ParamBitMap * must take care of this flag - there is no additional processing in parameter bitmapping. * If EncodeValue is equal to NULL, then the encode/decode function takes care of this. */ - int16_t fZeroAllowed; + Word16 fZeroAllowed; /** Function to get the value of this parameter. * The function returns a pointer to be used in functions in pSubParamBitMap. * If the function returns NULL then the same pointer as for the current @@ -662,7 +662,7 @@ typedef struct ParamBitMap typedef struct ParamsBitMap { /** Number of parameters in params. */ - int16_t nParams; + Word16 nParams; /** Definition of the mapping for each parameter. */ ParamBitMap params[NPARAMS_MAX]; } ParamsBitMap; @@ -688,24 +688,24 @@ struct TnsParameters typedef struct { - uint8_t value; - uint16_t code; - uint8_t nBits; + UWord8 value; + UWord16 code; + UWord8 nBits; } Coding; /* Scale TCX setup */ typedef struct { - int16_t bwmode; + Word16 bwmode; - int32_t bitrateFrom; - int32_t bitrateTo; + Word32 bitrateFrom; + Word32 bitrateTo; #ifndef IVAS_FLOAT_FIXED float scale_flt; #else - Word16 scale; /* Q15 */ + Word16 scale; /* Q15 */ #endif } SCALE_TCX_SETUP; @@ -713,14 +713,14 @@ typedef struct typedef struct { - uint16_t frame_bits; /*Bits per frame*/ - uint16_t frame_net_bits; /*Net Bits per frame*/ - uint8_t transmission_bits; /*max=1*/ - uint8_t transmission_mode[2]; /*SID,VBR/CBR*/ - uint8_t bandwidth_bits; /*max=2*/ - uint8_t bandwidth_min; /*first valid bandwidth (NB,WB,SWB,FB)*/ - uint8_t bandwidth_max; /*last valid bandwidth (NB,WB,SWB,FB)*/ - uint8_t reserved_bits; /*max=1*/ + UWord16 frame_bits; /*Bits per frame*/ + UWord16 frame_net_bits; /*Net Bits per frame*/ + UWord8 transmission_bits; /*max=1*/ + UWord8 transmission_mode[2]; /*SID,VBR/CBR*/ + UWord8 bandwidth_bits; /*max=2*/ + UWord8 bandwidth_min; /*first valid bandwidth (NB,WB,SWB,FB)*/ + UWord8 bandwidth_max; /*last valid bandwidth (NB,WB,SWB,FB)*/ + UWord8 reserved_bits; /*max=1*/ } FrameSizeParams; @@ -741,8 +741,8 @@ typedef struct cldfb_filter_bank_struct #ifndef IVAS_FLOAT_FIXED const float *p_filter_flt; #endif - const Word16 *p_filter; /*!< Pointer to filter coefficients */ - Word16 p_filter_sf; + const Word16 *p_filter; /*!< Pointer to filter coefficients */ // Q15 + Word16 p_filter_sf; // Q0 /* rotation vectors */ @@ -752,11 +752,11 @@ typedef struct cldfb_filter_bank_struct const float *rot_vec_syn_re; const float *rot_vec_syn_im; #else - const Word32 *rot_vec_syn_re_fx; - const Word32 *rot_vec_syn_im_fx; + const Word32 *rot_vec_syn_re_fx; // Q29 + const Word32 *rot_vec_syn_im_fx; // Q29 - const Word32 *rot_vec_syn_delay_re_fx; - const Word32 *rot_vec_syn_delay_im_fx; + const Word32 *rot_vec_syn_delay_re_fx; // Q31 + const Word32 *rot_vec_syn_delay_im_fx; // Q31 #endif /* rotation vectors for delay */ #ifndef IVAS_FLOAT_FIXED @@ -765,35 +765,35 @@ typedef struct cldfb_filter_bank_struct const float *rot_vec_syn_delay_re; const float *rot_vec_syn_delay_im; #else - const Word32 *rot_vec_ana_re_fx; - const Word32 *rot_vec_ana_im_fx; + const Word32 *rot_vec_ana_re_fx; // Q29 + const Word32 *rot_vec_ana_im_fx; // Q29 - const Word32 *rot_vec_ana_delay_re_fx; - const Word32 *rot_vec_ana_delay_im_fx; + const Word32 *rot_vec_ana_delay_re_fx; // Q31 + const Word32 *rot_vec_ana_delay_im_fx; // Q31 #endif // Fix variables - Word16 *FilterStates; /*!< Pointer to buffer of filter states */ + Word16 *FilterStates; /*!< Pointer to buffer of filter states Q15-FilterStates_eg*/ Word16 FilterStates_e[CLDFB_NO_COL_MAX + 9]; /*!< Filter states time slot exponents */ Word16 FilterStates_eg; /*!< Filter states current exponent */ - const Word16 *rRotVctr; /*!< Modulation tables. */ - const Word16 *iRotVctr; - Word16 filterScale; /*!< filter scale */ + const Word16 *rRotVctr; /*!< Modulation tables.Q(sqrt(1.0/16.00)) */ + const Word16 *iRotVctr; /*Q(sqrt(1.0/16.00))*/ + Word16 filterScale; /*!< filter scale Q0*/ - Word16 synGain; /*!< gain for synthesis filterbank */ - Word16 anaScalefactor; /*!< Scale factor of analysis cldfb */ - Word16 synScalefactor; /*!< Scale factor of synthesis cldfb */ - Word16 outScalefactor; /*!< Scale factor of output data (syn only) */ - Word16 synFilterHeadroom; /*!< Headroom for states in synthesis cldfb filterbank */ + Word16 synGain; /*!< gain for synthesis filterbank Q0*/ + Word16 anaScalefactor; /*!< Scale factor of analysis cldfb Q0*/ + Word16 synScalefactor; /*!< Scale factor of synthesis cldfb Q0*/ + Word16 outScalefactor; /*!< Scale factor of output data (syn only) Q0*/ + Word16 synFilterHeadroom; /*!< Headroom for states in synthesis cldfb filterbank Q0*/ /* memory helper states */ #ifndef IVAS_FLOAT_FIXED float *memory_flt; #endif - Word16 *memory; + Word16 *memory; // Qx #ifdef IVAS_FLOAT_FIXED - Word32 *memory32; /*because cldfb_state_fx is word32 which is used to assign values*/ + Word32 *memory32; // Q_cldfb_state /*because cldfb_state_fx is word32 which is used to assign values*/ #endif // IVAS_FLOAT_FIXED UWord16 memory_length; @@ -802,7 +802,7 @@ typedef struct cldfb_filter_bank_struct #ifndef IVAS_FLOAT_FIXED float *cldfb_state; #else - Word32 *cldfb_state_fx; + Word32 *cldfb_state_fx; // Q_cldfb_state Word16 cldfb_state_length; Word16 cldfb_size; Word16 Q_cldfb_state; @@ -848,8 +848,8 @@ typedef enum *----------------------------------------------------------------------------------*/ typedef struct pfstat_structure { - int16_t on; /* On/off flag */ - int16_t reset; /* reset flag */ + Word16 on; /* On/off flag */ + Word16 reset; /* reset flag */ #ifndef IVAS_FLOAT_FIXED float mem_pf_in_flt[L_SUBFR]; /* Input memory */ float mem_stp_flt[L_SUBFR]; /* 1/A(gamma1) memory */ @@ -857,11 +857,11 @@ typedef struct pfstat_structure float mem_zero_flt[M]; /* null memory to compute i.r. of A(gamma2)/A(gamma1) */ float gain_prec_flt; /* for gain adjustment */ #endif - Word16 mem_pf_in[L_SUBFR]; /* Input memory */ - Word16 mem_stp[L_SUBFR]; /* 1/A(gamma1) memory */ - 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 */ + Word16 mem_pf_in[L_SUBFR]; /* Input memory Qqmem_pf_in */ + Word16 mem_stp[L_SUBFR]; /* 1/A(gamma1) memory Qqmem_stp*/ + Word16 mem_res2[DECMEM_RES2]; /* A(gamma2) residual Q_syn*/ + Word16 mem_zero[M]; /* null memory to compute i.r. of A(gamma2)/A(gamma1) Q_qmem_zero*/ + Word16 gain_prec; /*Q14*/ /* for gain adjustment */ } PFSTAT, *PFSTAT_HANDLE; @@ -878,22 +878,22 @@ typedef struct typedef struct igf_grid_struct { - int16_t swb_offset[IGF_MAX_SFB]; - int16_t swb_offset_len; - int16_t startFrequency; - int16_t stopFrequency; - int16_t startLine; - int16_t stopLine; - int16_t startSfb; - int16_t stopSfb; - int16_t sfbWrap[IGF_MAX_TILES + 1]; - int16_t sbWrap[IGF_MAX_TILES]; - int16_t nTiles; - int16_t minSrcSubband; - int16_t minSrcFrequency; - int16_t tile[IGF_MAX_TILES + 1]; - int16_t infoIsRefined; - int16_t infoGranuleLen; + Word16 swb_offset[IGF_MAX_SFB]; + Word16 swb_offset_len; + Word16 startFrequency; + Word16 stopFrequency; + Word16 startLine; + Word16 stopLine; + Word16 startSfb; + Word16 stopSfb; + Word16 sfbWrap[IGF_MAX_TILES + 1]; + Word16 sbWrap[IGF_MAX_TILES]; + Word16 nTiles; + Word16 minSrcSubband; + Word16 minSrcFrequency; + Word16 tile[IGF_MAX_TILES + 1]; + Word16 infoIsRefined; + Word16 infoGranuleLen; Word16 infoTransFac; #ifndef IVAS_FLOAT_FIXED float whiteningThreshold_flt[2][IGF_MAX_TILES]; @@ -911,21 +911,21 @@ typedef struct igf_grid_struct typedef struct IGF_INFO_struct { - int16_t *nfSeed; - int16_t nfSeedBuf[2]; - int32_t sampleRate; - int16_t frameLength; - int16_t maxHopsize; + Word16 *nfSeed; + Word16 nfSeedBuf[2]; + Word32 sampleRate; + Word16 frameLength; + Word16 maxHopsize; IGF_GRID grid[IGF_NOF_GRIDS]; - int16_t bitRateIndex; + Word16 bitRateIndex; } IGF_INFO, *H_IGF_INFO; typedef struct { - int16_t *indexBuffer; - int16_t *peakIndices, *holeIndices; - int16_t numPeakIndices, numHoleIndices; + Word16 *indexBuffer; + Word16 *peakIndices, *holeIndices; + Word16 numPeakIndices, numHoleIndices; } CONTEXT_HM_CONFIG; typedef enum diff --git a/lib_com/stat_noise_uv_mod_fx.c b/lib_com/stat_noise_uv_mod_fx.c index c022ab04f..e4771a183 100644 --- a/lib_com/stat_noise_uv_mod_fx.c +++ b/lib_com/stat_noise_uv_mod_fx.c @@ -30,21 +30,21 @@ Word32 L_Sqrt_Q0( const Word32 x ); void stat_noise_uv_mod_fx( 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 */ - Word16 *Aq, /* o : A(z) quantized for the 4 subframes */ - Word16 *exc2, /* i/o: excitation buffer */ + Word16 noisiness, /* i : noisiness parameter Q0 */ + const Word16 *lsp_old, /* i : old LSP vector at 4th sfr Q15 */ + const Word16 *lsp_new, /* i : LSP vector at 4th sfr Q15 */ + const Word16 *lsp_mid, /* i : LSP vector at 2nd sfr Q15 */ + Word16 *Aq, /* o : A(z) quantized for the 4 subframes Q12 */ + Word16 *exc2, /* i/o: excitation buffer Q_exc */ Word16 Q_exc, /* i : Q of exc2 excitation buffer [11..-1] expected */ const Word16 bfi, /* i : Bad frame indicator */ - Word32 *ge_sm, /* i/o: smoothed excitation gain */ + Word32 *ge_sm, /* i/o: smoothed excitation gain Q_ge */ Word16 *uv_count, /* i/o: unvoiced counter */ Word16 *act_count, /* i/o: activation counter */ - Word16 lspold_s[], /* i/o: old LSP */ - Word16 *noimix_seed, /* i/o: mixture seed */ - Word16 *st_min_alpha, /* i/o: minimum alpha */ - Word16 *exc_pe, /* i/o: scale Q_stat_noise */ + Word16 lspold_s[], /* i/o: old LSP Q15 */ + Word16 *noimix_seed, /* i/o: mixture seed Q0 */ + Word16 *st_min_alpha, /* i/o: minimum alpha Q15 */ + Word16 *exc_pe, /* i/o: scale Q_stat_noise Q_stat_noise */ const Word32 bitrate, /* i : core bitrate */ const Word16 bwidth_fx, /* i : input bandwidth */ Word16 *Q_stat_noise, /* i/o: noise scaling */ @@ -379,7 +379,7 @@ void stat_noise_uv_mod_ivas_fx( Word16 *uv_count, /* i/o: unvoiced counter */ Word16 *act_count, /* i/o: activation counter */ Word16 lspold_s[], /* i/o: old LSP Q=15*/ - Word16 *noimix_seed, /* i/o: mixture seed */ + Word16 *noimix_seed, /* i/o: mixture seed Q0 */ Word16 *st_min_alpha, /* i/o: minimum alpha Q=15*/ Word16 *exc_pe, /* i/o: scale Q_stat_noise Q=Q_stat_noise*/ const Word32 bitrate, /* i : core bitrate */ @@ -698,7 +698,7 @@ void stat_noise_uv_mod_ivas_fx( *---------------------------------------------------------------------------*/ static Word16 calc_tilt_fx( /* o : Excitation tilt Q15*/ - const Word16 *x, /* i : Signal input */ + const Word16 *x, /* i : Signal input Q_shift*/ const Word16 Q_shift, /* i : input scaling */ const Word16 len /* i : length */ ) @@ -768,8 +768,8 @@ static Word16 calc_tilt_fx( /* o : Excitation tilt Q15*/ * Calculate square root from fractional values (Q0 -> Q0) * Uses 32 bit internal representation for precision *---------------------------------------------------------------------------*/ -Word32 L_Sqrt_Q0( /* o : Square root of input */ - const Word32 x /* i : Input */ +Word32 L_Sqrt_Q0( /* o : Square root of input Q0*/ + const Word32 x /* i : Input Qx */ ) { Word32 log2_work; diff --git a/lib_enc/core_enc_switch.c b/lib_enc/core_enc_switch.c index 3dee5f2bc..3f79d365d 100644 --- a/lib_enc/core_enc_switch.c +++ b/lib_enc/core_enc_switch.c @@ -278,7 +278,6 @@ void core_coder_mode_switch_ivas_fx( set_f( st->hBWE_TD->state_lpc_syn, 0.0f, LPC_SHB_ORDER ); set_f( st->hBWE_TD->state_syn_shbexc, 0.0f, L_SHB_LAHEAD ); set_f( st->hBWE_TD->mem_stp_swb, 0.0f, LPC_SHB_ORDER ); - set_f( st->hBWE_TD->mem_zero_swb, 0, LPC_SHB_ORDER ); st->hBWE_TD->gain_prec_swb = 1.0f; #endif set16_fx( st->hBWE_TD->state_lpc_syn_fx, 0, LPC_SHB_ORDER ); diff --git a/lib_enc/core_switching_enc.c b/lib_enc/core_switching_enc.c index 147a0d015..7bcd3a99c 100644 --- a/lib_enc/core_switching_enc.c +++ b/lib_enc/core_switching_enc.c @@ -376,7 +376,17 @@ void core_switching_pre_enc( mvr2r( old_inp_16k + L_INP_MEM + L_FRAME - Sample_Delay_LP, st->hBWE_FD->old_input_lp, Sample_Delay_LP ); } +#ifndef IVAS_FLOAT_FIXED mvr2r( st->hBWE_TD->old_speech_shb + L_LOOK_16k + L_SUBFR16k - Sample_Delay_HP, st->hBWE_FD->new_input_hp, Sample_Delay_HP ); +#else +#ifdef IVAS_FLOAT_FIXED_CONVERSIONS + floatToFixed_arr( st->hBWE_FD->new_input_hp, st->hBWE_FD->new_input_hp_fx, 0, NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS - DELAY_CLDFB_NS ) ); +#endif + Copy( st->hBWE_TD->old_speech_shb_fx + L_LOOK_16k + L_SUBFR16k - Sample_Delay_HP, st->hBWE_FD->new_input_hp_fx, Sample_Delay_HP ); +#ifdef IVAS_FLOAT_FIXED_CONVERSIONS + fixedToFloat_arr( st->hBWE_FD->new_input_hp_fx, st->hBWE_FD->new_input_hp, 0, NS2SA( 16000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS - DELAY_CLDFB_NS ) ); +#endif +#endif if ( st->last_extl != WB_BWE ) { @@ -954,9 +964,10 @@ void core_switching_post_enc( InitSWBencBufferStates( st->hBWE_TD, NULL ); swb_tbe_reset( st->hBWE_TD->mem_csfilt, st->hBWE_TD->mem_genSHBexc_filt_down_shb, st->hBWE_TD->state_lpc_syn, st->hBWE_TD->syn_overlap, st->hBWE_TD->state_syn_shbexc, &( st->hBWE_TD->tbe_demph ), &( st->hBWE_TD->tbe_premph ), st->hBWE_TD->mem_stp_swb, &( st->hBWE_TD->gain_prec_swb ) ); #endif +#ifndef IVAS_FLOAT_FIXED set_f( st->hBWE_TD->dec_2_over_3_mem, 0.0f, L_FILT_2OVER3 ); set_f( st->hBWE_TD->dec_2_over_3_mem_lp, 0.0f, L_FILT_2OVER3_LP ); -#ifdef IVAS_FLOAT_FIXED +#else set16_fx( st->hBWE_TD->dec_2_over_3_mem_fx, 0, L_FILT_2OVER3 ); set16_fx( st->hBWE_TD->dec_2_over_3_mem_lp_fx, 0, L_FILT_2OVER3_LP ); #endif @@ -966,7 +977,11 @@ void core_switching_post_enc( set_f( st->hBWE_TD->state_lpc_syn, 0.0f, LPC_SHB_ORDER ); set_f( st->hBWE_TD->state_syn_shbexc, 0.0f, L_SHB_LAHEAD ); set_f( st->hBWE_TD->mem_stp_swb, 0.0f, LPC_SHB_ORDER ); +#ifndef IVAS_FLOAT_FIXED set_f( st->hBWE_TD->mem_zero_swb, 0, LPC_SHB_ORDER ); +#else + set16_fx( st->hBWE_TD->mem_zero_swb_fx, 0, LPC_SHB_ORDER ); +#endif st->hBWE_TD->gain_prec_swb = 1.0f; } else if ( st->last_core == TCX_20_CORE || st->last_core == TCX_10_CORE ) diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index a550f76de..de065abb6 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -105,8 +105,7 @@ ivas_error ivas_core_enc( #endif #ifdef IVAS_FLOAT_FIXED Word32 *new_swb_speech_fx; - Word16 shb_speech_fx[L_FRAME16k]; // Q_shb_spch - Word32 shb_speech_fx_32[L_FRAME16k]; // Q_shb_spch + Word16 shb_speech_fx[L_FRAME16k]; // Q_shb_spch Word16 Q_shb_spch; Word32 new_swb_speech_buffer_fx[L_FRAME48k + STEREO_DFT_OVL_MAX]; Word16 new_inp_resamp16k_fx[CPE_CHANNELS][L_FRAME16k]; @@ -154,6 +153,9 @@ ivas_error ivas_core_enc( error = IVAS_ERR_OK; + Q_shb_spch = 0; + move16(); + /*------------------------------------------------------------------* * General initialization *-----------------------------------------------------------------*/ @@ -881,7 +883,6 @@ ivas_error ivas_core_enc( #ifdef IVAS_FLOAT_FIXED_CONVERSIONS Word32 realBuffer_fx[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; Word32 imagBuffer_fx[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; - Word16 use_shb32 = 0; Word16 q_realImagBuffer = Q_factor_arrL( (float *) &realBuffer[n][0][0], CLDFB_NO_COL_MAX * CLDFB_NO_CHANNELS_MAX ); q_realImagBuffer = s_min( q_realImagBuffer, Q_factor_arrL( (float *) &imagBuffer[n][0][0], CLDFB_NO_COL_MAX * CLDFB_NO_CHANNELS_MAX ) ); q_realImagBuffer = s_min( q_realImagBuffer, st->cldfbSynTd->Q_cldfb_state ); @@ -921,23 +922,18 @@ ivas_error ivas_core_enc( st->hBWE_FD->L_old_wtda_swb_fx[idx] = (Word16) st->hBWE_FD->old_wtda_swb[idx]; st->hBWE_FD->old_fdbwe_speech_fx[idx] = (Word16) st->hBWE_FD->old_fdbwe_speech[idx]; } - for ( Word32 idx = 0; idx < ( L_LOOK_16k + L_SUBFR16k ); idx++ ) - { - st->hBWE_TD->old_speech_shb_fx[idx] = (Word16) st->hBWE_TD->old_speech_shb[idx]; - } #endif #endif /* Scaling cldfb_state_fx */ scale_sig32( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length, sub( q_realImagBuffer, st->cldfbSynTd->Q_cldfb_state ) ); - swb_pre_proc_ivas_fx( st, new_swb_speech_fx_16, new_swb_speech_fx, shb_speech_fx, shb_speech_fx_32, &use_shb32, realBuffer_fx, imagBuffer_fx, q_realImagBuffer, hCPE ); + swb_pre_proc_ivas_fx( st, new_swb_speech_fx_16, new_swb_speech_fx, shb_speech_fx, &Q_shb_spch, realBuffer_fx, imagBuffer_fx, q_realImagBuffer, hCPE ); /* Re-scaling cldfb_state_fx */ scale_sig32( st->cldfbSynTd->cldfb_state_fx, st->cldfbSynTd->p_filter_length, negate( sub( q_realImagBuffer, st->cldfbSynTd->Q_cldfb_state ) ) ); #ifdef IVAS_FLOAT_FIXED_CONVERSIONS - fixedToFloat_arr( (Word16 *) &st->hBWE_TD->old_speech_shb_fx[0], (float *) &st->hBWE_TD->old_speech_shb[0], 0, L_LOOK_16k + L_SUBFR16k ); fixedToFloat_arr( (Word16 *) &st->hBWE_FD->old_fdbwe_speech_fx[0], (float *) &st->hBWE_FD->old_fdbwe_speech[0], 0, L_FRAME48k ); fixedToFloat_arr( (Word16 *) &st->hBWE_FD->L_old_wtda_swb_fx[0], (float *) &st->hBWE_FD->old_wtda_swb[0], 0, L_FRAME48k ); for ( int ii = 0; ii < NS2SA( 48000, DELAY_FD_BWE_ENC_NS + DELAY_FIR_RESAMPL_NS ); ii++ ) @@ -945,14 +941,9 @@ ivas_error ivas_core_enc( st->hBWE_FD->old_input[ii] = (Word16) st->hBWE_FD->old_input_fx[ii]; } fixedToFloat_arr( new_swb_speech_fx_16, new_swb_speech, 0, L_FRAME48k ); - if ( use_shb32 == 0 ) - { - fixedToFloat_arr( shb_speech_fx, shb_speech, 0, L_FRAME16k ); - } - else - { - fixedToFloat_arrL( shb_speech_fx_32, shb_speech, q_realImagBuffer - 1, L_FRAME16k ); - } + + fixedToFloat_arr( shb_speech_fx, shb_speech, 0, L_FRAME16k ); + fixedToFloat_arrL32( (Word32 *) &realBuffer_fx[0][0], (float *) &realBuffer[n][0][0], q_realImagBuffer, CLDFB_NO_COL_MAX * CLDFB_NO_CHANNELS_MAX ); fixedToFloat_arrL32( (Word32 *) &imagBuffer_fx[0][0], (float *) &imagBuffer[n][0][0], q_realImagBuffer, CLDFB_NO_COL_MAX * CLDFB_NO_CHANNELS_MAX ); @@ -1003,9 +994,7 @@ ivas_error ivas_core_enc( Q_new[n] = Q_factor_arrL( bwe_exc_extended[n], L_FRAME32k + NL_BUFF_OFFSET ); Q_new[n] = Q_new[n] / 2; - Q_shb_spch = Q_factor_arr( shb_speech, L_FRAME16k ); - Q_shb_spch = min( Q_shb_spch, Q_factor_arr( st->hBWE_TD->old_speech_shb, L_LOOK_16k + L_SUBFR16k ) ); - Q_shb_spch = min( Q_shb_spch, Q_factor_arr( st->hBWE_TD->shb_inv_filt_mem, LPC_SHB_ORDER ) ); + // Q_shb_spch = Q_factor_arr( shb_speech, L_FRAME16k ); if ( st->hBWE_TD != NULL ) { @@ -1030,10 +1019,7 @@ ivas_error ivas_core_enc( if ( st->hBWE_TD != NULL ) { - floatToFixed_arr16( st->hBWE_TD->old_speech_shb, st->hBWE_TD->old_speech_shb_fx, Q_shb_spch, L_LOOK_16k + L_SUBFR16k ); - floatToFixed_arr16( st->hBWE_TD->shb_inv_filt_mem, st->hBWE_TD->shb_inv_filt_mem_fx, Q_shb_spch, LPC_SHB_ORDER ); // Check floatToFixed_arr16( st->hBWE_TD->cur_sub_Aq, st->hBWE_TD->cur_sub_Aq_fx, Q12, M + 1 ); - st->hBWE_TD->prev_pow_exc16kWhtnd_fx32 = floatToFixed( st->hBWE_TD->prev_pow_exc16kWhtnd, 0 ); floatToFixed_arr16( st->hBWE_TD->state_lpc_syn, st->hBWE_TD->state_lpc_syn_fx, ( st->prev_Q_bwe_exc - 16 ), LPC_SHB_ORDER ); floatToFixed_arr32( st->hBWE_TD->mem_csfilt, st->hBWE_TD->mem_csfilt_fx, st->prev_Q_bwe_exc, 2 ); st->hBWE_TD->gain_prec_swb_fx = float_to_fix16( st->hBWE_TD->gain_prec_swb, Q14 ); @@ -1046,10 +1032,7 @@ ivas_error ivas_core_enc( #ifdef IVAS_FLOAT_FIXED_CONVERSIONS if ( st->hBWE_TD != NULL ) { - fixedToFloat_arr( st->hBWE_TD->old_speech_shb_fx, st->hBWE_TD->old_speech_shb, Q_shb_spch, L_LOOK_16k + L_SUBFR16k ); - fixedToFloat_arr( st->hBWE_TD->shb_inv_filt_mem_fx, st->hBWE_TD->shb_inv_filt_mem, Q_shb_spch, LPC_SHB_ORDER ); // Check fixedToFloat_arr( st->hBWE_TD->cur_sub_Aq_fx, st->hBWE_TD->cur_sub_Aq, Q12, M + 1 ); - st->hBWE_TD->prev_pow_exc16kWhtnd = fixedToFloat( st->hBWE_TD->prev_pow_exc16kWhtnd_fx32, 0 ); fixedToFloat_arr( st->hBWE_TD->state_lpc_syn_fx, st->hBWE_TD->state_lpc_syn, ( st->prev_Q_bwe_exc - 16 ), LPC_SHB_ORDER ); fixedToFloat_arrL( st->hBWE_TD->mem_csfilt_fx, st->hBWE_TD->mem_csfilt, st->prev_Q_bwe_exc, 2 ); st->hBWE_TD->gain_prec_swb = fixedToFloat( st->hBWE_TD->gain_prec_swb_fx, Q14 ); @@ -1168,19 +1151,6 @@ ivas_error ivas_core_enc( } floatToFixed_arr( shb_speech, shb_speech_fx, 0, L_FRAME16k ); - - test(); - IF( EQ_32( st->core_brate, SID_2k40 ) || st->core_brate == FRAME_NO_DATA ) - { - IF( st->cng_type == LP_CNG ) - { - IF( GE_32( st->input_Fs, L_FRAME32k * FRAMES_PER_SEC ) ) - { - /* decide if SHB SID encoding or not */ - floatToFixed_arr( st->hBWE_TD->old_speech_shb, st->hBWE_TD->old_speech_shb_fx, 0, L_LOOK_16k + L_SUBFR16k ); - } - } - } #endif swb_CNG_enc_ivas_fx( st, shb_speech_fx, old_syn_12k8_16k_fx[n] ); #else diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index a2fd102b1..9fc3a0de5 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -8649,7 +8649,7 @@ static void ivas_encode_masaism_metadata_fx( } ELSE { - hOmasaData->masa_to_total_energy_ratio_fx[0][band] = MAX_32; + hOmasaData->masa_to_total_energy_ratio_fx[0][band] = ONE_IN_Q30; // Q30 move32(); } } diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c index 48592f1b3..e99d89efd 100644 --- a/lib_enc/ivas_omasa_enc.c +++ b/lib_enc/ivas_omasa_enc.c @@ -1995,9 +1995,9 @@ static void ivas_omasa_param_est_enc_fx( /* Determine energy ratios */ FOR( band_m_idx = 0; band_m_idx < hOMasa->nbands; band_m_idx++ ) { - IF( GT_32( BASOP_Util_Log10( renormalization_factor_diff_fx[band_m_idx], ref_exp ), -( 15 << 25 ) ) ) + IF( EQ_16( BASOP_Util_Cmp_Mant32Exp( renormalization_factor_diff_fx[band_m_idx], renormalization_factor_diff_e[band_m_idx], 1 /*EPSILON Q50*/, -19 ), 1 ) ) { - diffuseness_m_fx[band_m_idx] = BASOP_Util_Divide3232_Scale( diffuseness_m_fx[band_m_idx], L_add( renormalization_factor_diff_fx[band_m_idx], EPSILON_FX ), &temp_e ); + diffuseness_m_fx[band_m_idx] = BASOP_Util_Divide3232_Scale( diffuseness_m_fx[band_m_idx], L_add( renormalization_factor_diff_fx[band_m_idx], EPSILON_FX ), &temp_e ); // Q=15-temp_e temp_e = add( temp_e, sub( diffuseness_e[band_m_idx], renormalization_factor_diff_e[band_m_idx] ) ); } ELSE diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index d5fbcc018..0f9646cac 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -1441,10 +1441,13 @@ typedef struct amrwb_io_enc_structure typedef struct td_bwe_enc_structure { - float old_speech_shb[L_LOOK_16k + L_SUBFR16k]; /* Buffer memories */ +#ifndef IVAS_FLOAT_FIXED + float old_speech_shb[L_LOOK_16k + L_SUBFR16k]; /* Buffer memories */ +#else + Word16 old_speech_shb_fx[L_LOOK_16k + L_SUBFR16k]; /* Buffer memories Q(Q_shb_spch) */ +#endif float old_speech_wb[( L_LOOK_12k8 + L_SUBFR ) * 5 / 16]; /* Buffer memories */ float old_input_fhb[NS2SA( 48000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) - L_FRAME48k / 2]; - Word16 old_speech_shb_fx[L_LOOK_16k + L_SUBFR16k]; /* Buffer memories */ Word16 old_speech_wb_fx[( L_LOOK_12k8 + L_SUBFR ) * 5 / 16]; /* Buffer memories */ Word16 old_input_fhb_fx[NS2SA( 48000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) - L_FRAME48k / 2]; Word16 old_input_fhb_fx_Q; @@ -1467,26 +1470,28 @@ typedef struct td_bwe_enc_structure float old_EnvSHBres[L_FRAME4k]; /* old TD envelope of the SHB residual signal */ Word16 old_EnvSHBres_fx[L_FRAME4k]; /* old TD envelope of the SHB residual signal */ #ifndef IVAS_FLOAT_FIXED - float old_mean_EnvSHBres; /* energy of the last subframe of the SHB residual signal from previous frame */ - float prev_enr_EnvSHBres; /* energy of the residual SHB envelope from the previous frame */ - float prev_shb_env_tilt; /* tilt of the residual SHB envelope from the previous frame */ + float old_mean_EnvSHBres; /* energy of the last subframe of the SHB residual signal from previous frame */ + float prev_enr_EnvSHBres; /* energy of the residual SHB envelope from the previous frame */ + float prev_shb_env_tilt; /* tilt of the residual SHB envelope from the previous frame */ + float prev_pow_exc16kWhtnd; /* power of the LB excitation signal in the previous frame */ #else Word16 old_mean_EnvSHBres_fx; /* energy of the last subframe of the SHB residual signal from previous frame Q15 */ Word32 prev_enr_EnvSHBres_fx; /* energy of the residual SHB envelope from the previous frame Q(31 - prev_enr_EnvSHBres_e) */ Word16 prev_enr_EnvSHBres_e; Word16 prev_shb_env_tilt_fx; /* tilt of the residual SHB envelope from the previous frame Q(prev_shb_env_tilt_q) */ Word16 prev_shb_env_tilt_q; -#endif - float prev_pow_exc16kWhtnd; /* power of the LB excitation signal in the previous frame */ +#if 0 Word16 prev_pow_exc16kWhtnd_fx; /* power of the LB excitation signal in the previous frame */ - Word32 prev_pow_exc16kWhtnd_fx32; /* Use this power of the LB excitation signal in the previous frame Q0 */ +#endif + Word32 prev_pow_exc16kWhtnd_fx32; /* Use this power of the LB excitation signal in the previous frame Q0 */ +#endif #ifndef IVAS_FLOAT_FIXED float prev_mix_factor; /* mixing factor in the previous frame */ + float prev_Env_error; /* error in SHB envelope modelling */ #else Word16 prev_mix_factor_fx; /* mixing factor in the previous frame Q15 */ + Word16 prev_Env_error_fx; /* error in SHB envelope modelling Q0 */ #endif - float prev_Env_error; /* error in SHB envelope modelling */ - Word16 prev_Env_error_fx; /* error in SHB envelope modelling */ /* states for the filters used in generating SHB signal from SHB excitation*/ float state_syn_shbexc[L_SHB_LAHEAD]; @@ -1525,23 +1530,23 @@ typedef struct td_bwe_enc_structure float prev_gainFr_SHB; float lsp_shb_slow_interpl[LPC_SHB_ORDER]; float lsp_shb_fast_interpl[LPC_SHB_ORDER]; + float shb_inv_filt_mem[LPC_SHB_ORDER]; #else Word32 elliptic_bpf_2_48k_mem_fx[4][4]; /* Q(elliptic_bpf_2_48k_mem_fx_Q[4]) */ Word16 elliptic_bpf_2_48k_mem_fx_Q[4]; Word32 prev_fb_energy_fx; /* Q(prev_fb_energy_fx_Q) */ Word16 prev_fb_energy_fx_Q; - Word32 prev_gainFr_SHB_fx; /* Q18 */ - Word16 lsp_shb_slow_interpl_fx[LPC_SHB_ORDER]; /* Q15 */ - Word16 lsp_shb_fast_interpl_fx[LPC_SHB_ORDER]; /* Q15 */ + Word32 prev_gainFr_SHB_fx; /* Q18 */ + Word16 lsp_shb_slow_interpl_fx[LPC_SHB_ORDER]; /* Q15 */ + Word16 lsp_shb_fast_interpl_fx[LPC_SHB_ORDER]; /* Q15 */ + Word16 shb_inv_filt_mem_fx[LPC_SHB_ORDER]; /* Q(Q_shb_spch) */ #endif - float shb_inv_filt_mem[LPC_SHB_ORDER]; - Word16 shb_inv_filt_mem_fx[LPC_SHB_ORDER]; #ifndef IVAS_FLOAT_FIXED float lsp_shb_spacing[3]; float prev_swb_GainShape; #else - Word16 lsp_shb_spacing_fx[3]; /* Q15 */ - Word16 prev_swb_GainShape_fx; /* Q15 */ + Word16 lsp_shb_spacing_fx[3]; /* Q15 */ + Word16 prev_swb_GainShape_fx; /* Q15 */ #endif int16_t prev_frGainAtten; @@ -1550,8 +1555,8 @@ typedef struct td_bwe_enc_structure float prev_wb_GainShape_flt; float swb_lsp_prev_interp[LPC_SHB_ORDER]; #else - Word16 prev_wb_GainShape; /* Q15 */ - Word16 swb_lsp_prev_interp_fx[LPC_SHB_ORDER]; /* Q15 */ + Word16 prev_wb_GainShape; /* Q15 */ + Word16 swb_lsp_prev_interp_fx[LPC_SHB_ORDER]; /* Q15 */ #endif float fb_state_lpc_syn[LPC_SHB_ORDER]; float fb_tbe_demph; @@ -1561,7 +1566,7 @@ typedef struct td_bwe_enc_structure #ifndef IVAS_FLOAT_FIXED float tilt_mem; #else - Word16 tilt_mem_fx; /* Q12 */ + Word16 tilt_mem_fx; /* Q12 */ #endif int16_t prev_coder_type; @@ -1569,8 +1574,8 @@ typedef struct td_bwe_enc_structure float prev_lsf_diff[LPC_SHB_ORDER - 2]; float prev_tilt_para; #else - Word16 prev_lsf_diff_fx[LPC_SHB_ORDER - 2]; /* Q15 */ - Word16 prev_tilt_para_fx; /* Q10 */ + Word16 prev_lsf_diff_fx[LPC_SHB_ORDER - 2]; /* Q15 */ + Word16 prev_tilt_para_fx; /* Q10 */ #endif float cur_sub_Aq[M + 1]; Word16 cur_sub_Aq_fx[M + 1]; /* Q12 */ @@ -1589,23 +1594,29 @@ typedef struct td_bwe_enc_structure int16_t gFrame_WB; int16_t idxGain; +#ifndef IVAS_FLOAT_FIXED float dec_2_over_3_mem[L_FILT_2OVER3]; float dec_2_over_3_mem_lp[L_FILT_2OVER3_LP]; +#else Word16 dec_2_over_3_mem_fx[L_FILT_2OVER3]; Word16 dec_2_over_3_mem_lp_fx[6]; +#endif float tbe_demph; float tbe_premph; float mem_stp_swb[LPC_SHB_ORDER]; float *ptr_mem_stp_swb; float gain_prec_swb; - float mem_zero_swb[LPC_SHB_ORDER]; Word16 tbe_demph_fx; /* Q(prev_Q_bwe_exc - 16 - NOISE_QADJ) */ Word16 tbe_premph_fx; /* Q(prev_Q_bwe_exc - 16) */ Word16 mem_stp_swb_fx[LPC_SHB_ORDER]; /* Q(st->prev_Q_bwe_syn) */ Word16 *ptr_mem_stp_swb_fx; Word16 gain_prec_swb_fx; /* Q14 */ +#ifndef IVAS_FLOAT_FIXED + float mem_zero_swb[LPC_SHB_ORDER]; +#else Word16 mem_zero_swb_fx[LPC_SHB_ORDER]; +#endif } TD_BWE_ENC_DATA, *TD_BWE_ENC_HANDLE; diff --git a/lib_enc/swb_pre_proc.c b/lib_enc/swb_pre_proc.c index b8c891d3c..878c1aa9b 100644 --- a/lib_enc/swb_pre_proc.c +++ b/lib_enc/swb_pre_proc.c @@ -280,12 +280,11 @@ void wb_pre_proc( #ifdef IVAS_FLOAT_FIXED /*full implementation pending*/ void swb_pre_proc_ivas_fx( - Encoder_State *st, /* i/o: encoder state structure */ - Word16 *new_swb_speech, /* o : original input signal at 32kHz - Q0 */ - Word32 *new_swb_speech_fx, /* o : original input signal at 32kHz - Q - q_reImBuffer */ - Word16 *shb_speech, /* o : SHB target signal (6-14kHz) at 16kHz- Q0 */ - Word32 *shb_speech_32, /* o : SHB target signal (6-14kHz) at 16kHz- Q - q_reImBuffer */ - Word16 *use_shb32, /* o : flags valid data in 32-bit shb buffer for better precision. */ + Encoder_State *st, /* i/o: encoder state structure */ + Word16 *new_swb_speech, /* o : original input signal at 32kHz - Q0 */ + Word32 *new_swb_speech_fx, /* o : original input signal at 32kHz - Q - q_reImBuffer */ + Word16 *shb_speech, /* o : SHB target signal (6-14kHz) at 16kHz- Q(Q_shb_spch) */ + Word16 *Q_shb_spch, Word32 realBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : real buffer Q - q_reImbuffer */ Word32 imagBuffer[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i : imag buffer Q - q_reImbuffer */ Word16 q_reImBuffer, /* i : scale data of real and imag CLDFB buffers */ @@ -305,6 +304,7 @@ void swb_pre_proc_ivas_fx( Word32 *imagBufferFlipped[CLDFB_NO_COL_MAX]; Word32 realBufferTmp[CLDFB_NO_COL_MAX][20]; Word32 imagBufferTmp[CLDFB_NO_COL_MAX][20]; + Word32 shb_speech_fx_32[L_FRAME16k]; Word16 ts, nB, uB; Word32 v, t, regression; Word16 t_16; @@ -314,9 +314,6 @@ void swb_pre_proc_ivas_fx( Word16 Sample_Delay_SWB_BWE32k, lMemRecalc32k, dft_ovl32k; Word32 one_by_50_Q31 = 42949673; - *use_shb32 = 0; - move16(); - lMemRecalc32k = NS2SA_FX2( 32000, L_MEM_RECALC_NS ); move16(); // exp_lbEner move16(); // lMemRecalc32k @@ -787,11 +784,10 @@ void swb_pre_proc_ivas_fx( thr = icbwe_thr_TDM_fx; regV = icbwe_regressionValuesTDM_fx; - // Copy_Scale_sig_16_32((const Word16 *)&shb_speech[0], (Word32 *)&shb_speech_32[0], L_FRAME16k,Q16); - cldfbSynthesis_ivas_fx( realBufferFlipped, imagBufferFlipped, shb_speech_32, -1, st->cldfbSynTd ); - *use_shb32 = 1; + cldfbSynthesis_ivas_fx( realBufferFlipped, imagBufferFlipped, shb_speech_fx_32, -1, st->cldfbSynTd ); + Copy_Scale_sig_32_16( shb_speech_fx_32, shb_speech, L_FRAME16k, negate( sub( q_reImBuffer, 1 ) ) ); + *Q_shb_spch = 0; move16(); - Copy_Scale_sig_32_16( (const Word32 *) &shb_speech_32[0], (Word16 *) &shb_speech[0], L_FRAME16k, negate( sub( q_reImBuffer, 1 ) ) ); } IF( GE_16( st->element_mode, IVAS_CPE_DFT ) && hCPE->hStereoICBWE != NULL ) @@ -896,8 +892,6 @@ void swb_pre_proc_ivas_fx( IF( ( EQ_16( st->bwidth, FB ) || st->core == ACELP_CORE ) && ( st->element_mode == EVS_MONO ) ) { InitSWBencBufferStates_fx( st->hBWE_TD, shb_speech ); - *use_shb32 = 0; - move16(); } ELSE { @@ -942,8 +936,6 @@ void swb_pre_proc_ivas_fx( } Decimate_allpass_steep_fx( spchTmp, hBWE_TD->state_ana_filt_shb_fx, L_FRAME32k, shb_speech ); - *use_shb32 = 0; - move16(); Copy( shb_speech + L_FRAME16k - ( L_LOOK_16k + L_SUBFR16k ), hBWE_TD->old_speech_shb_fx, L_LOOK_16k + L_SUBFR16k ); @@ -983,8 +975,6 @@ void swb_pre_proc_ivas_fx( shb_speech[i] = mult_r( mult_r( i, 983 /*0.03f Q15*/ ), shb_speech[2 * delay - 1 - i] ); move16(); } - *use_shb32 = 0; - move16(); } return; diff --git a/lib_enc/swb_tbe_enc.c b/lib_enc/swb_tbe_enc.c index dad834fcf..0d3f74364 100644 --- a/lib_enc/swb_tbe_enc.c +++ b/lib_enc/swb_tbe_enc.c @@ -123,7 +123,11 @@ void InitSWBencBuffer( move16(); #endif +#ifndef IVAS_FLOAT_FIXED set_f( hBWE_TD->old_speech_shb, 0.0f, L_LOOK_16k + L_SUBFR16k ); +#else + set16_fx( hBWE_TD->old_speech_shb_fx, 0, L_LOOK_16k + L_SUBFR16k ); +#endif set_f( hBWE_TD->old_speech_wb, 0.0f, ( L_LOOK_12k8 + L_SUBFR ) * 5 / 16 ); set_f( hBWE_TD->old_input_fhb, 0.0f, NS2SA( 48000, ACELP_LOOK_NS + DELAY_FD_BWE_ENC_12k8_NS + DELAY_FIR_RESAMPL_NS ) - L_FRAME48k / 2 ); @@ -158,11 +162,12 @@ void InitSWBencBuffer( set16_fx( hBWE_TD->lsp_shb_slow_interpl_fx, 0, LPC_SHB_ORDER ); set16_fx( hBWE_TD->lsp_shb_fast_interpl_fx, 0, LPC_SHB_ORDER ); #endif - set_f( hBWE_TD->shb_inv_filt_mem, 0, LPC_SHB_ORDER ); #ifndef IVAS_FLOAT_FIXED + set_f( hBWE_TD->shb_inv_filt_mem, 0, LPC_SHB_ORDER ); set_f( hBWE_TD->lsp_shb_spacing, 0.1f, 3 ); hBWE_TD->prev_swb_GainShape = 0; #else + set16_fx( hBWE_TD->shb_inv_filt_mem_fx, 0, LPC_SHB_ORDER ); set16_fx( hBWE_TD->lsp_shb_spacing_fx, 3277, 3 ); hBWE_TD->prev_swb_GainShape_fx = 0; #endif @@ -194,23 +199,26 @@ void InitSWBencBuffer( /* TD BWE post-processing */ hBWE_TD->ptr_mem_stp_swb = hBWE_TD->mem_stp_swb + LPC_SHB_ORDER - 1; +#ifndef IVAS_FLOAT_FIXED set_f( hBWE_TD->mem_zero_swb, 0, LPC_SHB_ORDER ); -#ifndef IVAS_FLOAT_FIXED for ( i = 0; i < LPC_SHB_ORDER; i++ ) { hBWE_TD->swb_lsp_prev_interp[i] = (float) cos( (float) i * EVS_PI / (float) 10.0f ); } #else + set16_fx( hBWE_TD->mem_zero_swb_fx, 0, LPC_SHB_ORDER ); + FOR( i = 0; i < LPC_SHB_ORDER; i++ ) { hBWE_TD->swb_lsp_prev_interp_fx[i] = swb_lsp_prev_interp_init[i]; } #endif +#ifndef IVAS_FLOAT_FIXED set_f( hBWE_TD->dec_2_over_3_mem, 0.0f, L_FILT_2OVER3 ); set_f( hBWE_TD->dec_2_over_3_mem_lp, 0.0f, L_FILT_2OVER3_LP ); -#ifdef IVAS_FLOAT_FIXED +#else set16_fx( hBWE_TD->dec_2_over_3_mem_fx, 0, L_FILT_2OVER3 ); set16_fx( hBWE_TD->dec_2_over_3_mem_lp_fx, 0, L_FILT_2OVER3_LP ); #endif @@ -235,7 +243,11 @@ void InitSWBencBufferStates( set_f( shb_speech, 0.0f, L_FRAME16k ); } +#ifndef IVAS_FLOAT_FIXED set_f( hBWE_TD->old_speech_shb, 0.0f, L_LOOK_16k + L_SUBFR16k ); +#else + set16_fx( hBWE_TD->old_speech_shb_fx, 0, L_LOOK_16k + L_SUBFR16k ); +#endif set_f( hBWE_TD->mem_shb_res, 0.0f, MAX_LEN_MA_FILTER ); set16_fx( hBWE_TD->mem_shb_res_fx, 0, MAX_LEN_MA_FILTER ); set32_fx( hBWE_TD->mem_shb_res_32_fx, 0, MAX_LEN_MA_FILTER ); @@ -251,13 +263,15 @@ void InitSWBencBufferStates( hBWE_TD->prev_shb_env_tilt_fx = 0; hBWE_TD->prev_shb_env_tilt_q = 15; #endif - hBWE_TD->prev_pow_exc16kWhtnd = 1.0f; #ifndef IVAS_FLOAT_FIXED + hBWE_TD->prev_pow_exc16kWhtnd = 1.0f; hBWE_TD->prev_mix_factor = 1.0f; + hBWE_TD->prev_Env_error = 0.0f; #else + hBWE_TD->prev_pow_exc16kWhtnd_fx32 = 1; hBWE_TD->prev_mix_factor_fx = 32767; + hBWE_TD->prev_Env_error_fx = 0; #endif - hBWE_TD->prev_Env_error = 0.0f; return; } diff --git a/lib_enc/swb_tbe_enc_fx.c b/lib_enc/swb_tbe_enc_fx.c index e81ec96ba..1304bdedb 100644 --- a/lib_enc/swb_tbe_enc_fx.c +++ b/lib_enc/swb_tbe_enc_fx.c @@ -4258,7 +4258,7 @@ void swb_tbe_enc_ivas_fx( move16(); } - hBWE_TD->prev_Env_error = Env_error_fx; + hBWE_TD->prev_Env_error_fx = Env_error_fx; move16(); /* *Q_white_exc = Q_bwe_exc_mod; move16(); output Qwhiteexc_FB from the GenShapedSHB function*/ @@ -7347,8 +7347,8 @@ void InitSWBencBufferStates_fx( hBWE_TD->prev_enr_EnvSHBres_e = 31; hBWE_TD->prev_shb_env_tilt_fx = 0; hBWE_TD->prev_shb_env_tilt_q = 15; - hBWE_TD->prev_pow_exc16kWhtnd_fx = 32767; /*1.0f in Q15*/ - hBWE_TD->prev_mix_factor_fx = 32767; /*1.0f in Q15*/ + hBWE_TD->prev_pow_exc16kWhtnd_fx32 = 1; /*1.0f in Q0*/ + hBWE_TD->prev_mix_factor_fx = 32767; /*1.0f in Q15*/ hBWE_TD->prev_Env_error_fx = 0; move16(); move16(); -- GitLab