mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/aactab: Deduplicate ltp_coef and tns_tmp2_map tables
This will allow to make aac_defines.h decoder-only. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
b9dea251d5
commit
4ed0fea0fa
|
@ -89,6 +89,49 @@ DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_short_128))[128];
|
|||
DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_long_960))[960];
|
||||
DECLARE_ALIGNED(32, static int, AAC_RENAME2(aac_kbd_short_120))[120];
|
||||
|
||||
/* @name ltp_coef
|
||||
* Table of the LTP coefficients
|
||||
*/
|
||||
static const int ltp_coef_fixed[8] = {
|
||||
Q30(0.570829), Q30(0.696616), Q30(0.813004), Q30(0.911304),
|
||||
Q30(0.984900), Q30(1.067894), Q30(1.194601), Q30(1.369533),
|
||||
};
|
||||
|
||||
/* @name tns_tmp2_map
|
||||
* Tables of the tmp2[] arrays of LPC coefficients used for TNS.
|
||||
* The suffix _M_N[] indicate the values of coef_compress and coef_res
|
||||
* respectively.
|
||||
* @{
|
||||
*/
|
||||
static const int tns_tmp2_map_1_3[4] = {
|
||||
Q31(0.00000000), Q31(-0.43388373), Q31(0.64278758), Q31(0.34202015),
|
||||
};
|
||||
|
||||
static const int tns_tmp2_map_0_3[8] = {
|
||||
Q31(0.00000000), Q31(-0.43388373), Q31(-0.78183150), Q31(-0.97492790),
|
||||
Q31(0.98480773), Q31( 0.86602539), Q31( 0.64278758), Q31( 0.34202015),
|
||||
};
|
||||
|
||||
static const int tns_tmp2_map_1_4[8] = {
|
||||
Q31(0.00000000), Q31(-0.20791170), Q31(-0.40673664), Q31(-0.58778524),
|
||||
Q31(0.67369562), Q31( 0.52643216), Q31( 0.36124167), Q31( 0.18374951),
|
||||
};
|
||||
|
||||
static const int tns_tmp2_map_0_4[16] = {
|
||||
Q31( 0.00000000), Q31(-0.20791170), Q31(-0.40673664), Q31(-0.58778524),
|
||||
Q31(-0.74314481), Q31(-0.86602539), Q31(-0.95105654), Q31(-0.99452192),
|
||||
Q31( 0.99573416), Q31( 0.96182561), Q31( 0.89516330), Q31( 0.79801720),
|
||||
Q31( 0.67369562), Q31( 0.52643216), Q31( 0.36124167), Q31( 0.18374951),
|
||||
};
|
||||
|
||||
static const int * const tns_tmp2_map_fixed[4] = {
|
||||
tns_tmp2_map_0_3,
|
||||
tns_tmp2_map_0_4,
|
||||
tns_tmp2_map_1_3,
|
||||
tns_tmp2_map_1_4
|
||||
};
|
||||
// @}
|
||||
|
||||
static av_always_inline void reset_predict_state(PredictorState *ps)
|
||||
{
|
||||
ps->r0.mant = 0;
|
||||
|
|
|
@ -1298,7 +1298,7 @@ static void decode_ltp(LongTermPrediction *ltp,
|
|||
int sfb;
|
||||
|
||||
ltp->lag = get_bits(gb, 11);
|
||||
ltp->coef = ltp_coef[get_bits(gb, 3)];
|
||||
ltp->coef = AAC_RENAME2(ltp_coef)[get_bits(gb, 3)];
|
||||
for (sfb = 0; sfb < FFMIN(max_sfb, MAX_LTP_LONG_SFB); sfb++)
|
||||
ltp->used[sfb] = get_bits1(gb);
|
||||
}
|
||||
|
@ -1611,7 +1611,7 @@ static int decode_tns(AACDecContext *ac, TemporalNoiseShaping *tns,
|
|||
tmp2_idx = 2 * coef_compress + coef_res;
|
||||
|
||||
for (i = 0; i < tns->order[w][filt]; i++)
|
||||
tns->coef[w][filt][i] = tns_tmp2_map[tmp2_idx][get_bits(gb, coef_len)];
|
||||
tns->coef[w][filt][i] = AAC_RENAME2(tns_tmp2_map)[tmp2_idx][get_bits(gb, coef_len)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,8 +92,8 @@ static void get_lag(float *buf, const float *new, LongTermPrediction *ltp)
|
|||
}
|
||||
}
|
||||
ltp->lag = FFMAX(av_clip_uintp2(lag, 11), 0);
|
||||
ltp->coef_idx = quant_array_idx(max_ratio, ltp_coef, 8);
|
||||
ltp->coef = ltp_coef[ltp->coef_idx];
|
||||
ltp->coef_idx = quant_array_idx(max_ratio, ff_ltp_coef, 8);
|
||||
ltp->coef = ff_ltp_coef[ltp->coef_idx];
|
||||
}
|
||||
|
||||
static void generate_samples(float *buf, LongTermPrediction *ltp)
|
||||
|
|
|
@ -148,7 +148,7 @@ static inline void quantize_coefs(double *coef, int *idx, float *lpc, int order,
|
|||
int c_bits)
|
||||
{
|
||||
int i;
|
||||
const float *quant_arr = tns_tmp2_map[c_bits];
|
||||
const float *quant_arr = ff_tns_tmp2_map[c_bits];
|
||||
for (i = 0; i < order; i++) {
|
||||
idx[i] = quant_array_idx(coef[i], quant_arr, c_bits ? 16 : 8);
|
||||
lpc[i] = quant_arr[idx[i]];
|
||||
|
|
|
@ -105,6 +105,45 @@ av_cold void ff_aac_float_common_init(void)
|
|||
static AVOnce init_static_once = AV_ONCE_INIT;
|
||||
ff_thread_once(&init_static_once, aac_float_common_init);
|
||||
}
|
||||
|
||||
const float ff_ltp_coef[8] = {
|
||||
0.570829, 0.696616, 0.813004, 0.911304,
|
||||
0.984900, 1.067894, 1.194601, 1.369533,
|
||||
};
|
||||
|
||||
/* @name tns_tmp2_map
|
||||
* Tables of the tmp2[] arrays of LPC coefficients used for TNS.
|
||||
* The suffix _M_N[] indicate the values of coef_compress and coef_res
|
||||
* respectively.
|
||||
* @{
|
||||
*/
|
||||
static const float tns_tmp2_map_1_3[4] = {
|
||||
0.00000000, -0.43388373, 0.64278758, 0.34202015,
|
||||
};
|
||||
|
||||
static const float tns_tmp2_map_0_3[8] = {
|
||||
0.00000000, -0.43388373, -0.78183150, -0.97492790,
|
||||
0.98480773, 0.86602539, 0.64278758, 0.34202015,
|
||||
};
|
||||
|
||||
static const float tns_tmp2_map_1_4[8] = {
|
||||
0.00000000, -0.20791170, -0.40673664, -0.58778524,
|
||||
0.67369562, 0.52643216, 0.36124167, 0.18374951,
|
||||
};
|
||||
|
||||
static const float tns_tmp2_map_0_4[16] = {
|
||||
0.00000000, -0.20791170, -0.40673664, -0.58778524,
|
||||
-0.74314481, -0.86602539, -0.95105654, -0.99452192,
|
||||
0.99573416, 0.96182561, 0.89516330, 0.79801720,
|
||||
0.67369562, 0.52643216, 0.36124167, 0.18374951,
|
||||
};
|
||||
|
||||
const float * const ff_tns_tmp2_map[4] = {
|
||||
tns_tmp2_map_0_3,
|
||||
tns_tmp2_map_0_4,
|
||||
tns_tmp2_map_1_3,
|
||||
tns_tmp2_map_1_4
|
||||
};
|
||||
#endif
|
||||
|
||||
const uint8_t ff_aac_num_swb_1024[] = {
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#define AVCODEC_AACTAB_H
|
||||
|
||||
#include "libavutil/mem_internal.h"
|
||||
#include "aac_defines.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
@ -45,44 +44,13 @@ extern float ff_aac_pow34sf_tab[428];
|
|||
/* @name ltp_coef
|
||||
* Table of the LTP coefficients
|
||||
*/
|
||||
static const INTFLOAT ltp_coef[8] = {
|
||||
Q30(0.570829), Q30(0.696616), Q30(0.813004), Q30(0.911304),
|
||||
Q30(0.984900), Q30(1.067894), Q30(1.194601), Q30(1.369533),
|
||||
};
|
||||
extern const float ff_ltp_coef[8];
|
||||
|
||||
/* @name tns_tmp2_map
|
||||
* Tables of the tmp2[] arrays of LPC coefficients used for TNS.
|
||||
* The suffix _M_N[] indicate the values of coef_compress and coef_res
|
||||
* respectively.
|
||||
* @{
|
||||
*/
|
||||
static const INTFLOAT tns_tmp2_map_1_3[4] = {
|
||||
Q31(0.00000000), Q31(-0.43388373), Q31(0.64278758), Q31(0.34202015),
|
||||
};
|
||||
|
||||
static const INTFLOAT tns_tmp2_map_0_3[8] = {
|
||||
Q31(0.00000000), Q31(-0.43388373), Q31(-0.78183150), Q31(-0.97492790),
|
||||
Q31(0.98480773), Q31( 0.86602539), Q31( 0.64278758), Q31( 0.34202015),
|
||||
};
|
||||
|
||||
static const INTFLOAT tns_tmp2_map_1_4[8] = {
|
||||
Q31(0.00000000), Q31(-0.20791170), Q31(-0.40673664), Q31(-0.58778524),
|
||||
Q31(0.67369562), Q31( 0.52643216), Q31( 0.36124167), Q31( 0.18374951),
|
||||
};
|
||||
|
||||
static const INTFLOAT tns_tmp2_map_0_4[16] = {
|
||||
Q31( 0.00000000), Q31(-0.20791170), Q31(-0.40673664), Q31(-0.58778524),
|
||||
Q31(-0.74314481), Q31(-0.86602539), Q31(-0.95105654), Q31(-0.99452192),
|
||||
Q31( 0.99573416), Q31( 0.96182561), Q31( 0.89516330), Q31( 0.79801720),
|
||||
Q31( 0.67369562), Q31( 0.52643216), Q31( 0.36124167), Q31( 0.18374951),
|
||||
};
|
||||
|
||||
static const INTFLOAT * const tns_tmp2_map[4] = {
|
||||
tns_tmp2_map_0_3,
|
||||
tns_tmp2_map_0_4,
|
||||
tns_tmp2_map_1_3,
|
||||
tns_tmp2_map_1_4
|
||||
};
|
||||
extern const float *const ff_tns_tmp2_map[4];
|
||||
// @}
|
||||
|
||||
/* @name window coefficients
|
||||
|
|
Loading…
Reference in New Issue