26 #ifndef AVCODEC_AACPS_FIXED_TABLEGEN_H
27 #define AVCODEC_AACPS_FIXED_TABLEGEN_H
32 #if CONFIG_HARDCODED_TABLES
33 #define ps_tableinit()
34 #define TABLE_CONST const
35 #include "libavcodec/aacps_fixed_tables.h"
40 #undef DECLARE_ALIGNED
41 #define DECLARE_ALIGNED(align, type, variable) type variable
48 #define NR_ALLPASS_BANDS20 30
49 #define NR_ALLPASS_BANDS34 50
54 static int HA[46][8][4];
55 static int HB[46][8][4];
64 Q31(0.00746082949812f),
Q31(0.02270420949825f),
Q31(0.04546865930473f),
Q31(0.07266113929591f),
65 Q31(0.09885108575264f),
Q31(0.11793710567217f),
Q31(0.125f)
69 Q31(0.04081179924692f),
Q31(0.03812810994926f),
Q31(0.05144908135699f),
Q31(0.06399831151592f),
70 Q31(0.07428313801106f),
Q31(0.08100347892914f),
Q31(0.08333333333333f)
74 Q31(0.01565675600122f),
Q31(0.03752716391991f),
Q31(0.05417891378782f),
Q31(0.08417044116767f),
75 Q31(0.10307344158036f),
Q31(0.12222452249753f),
Q31(0.125f)
79 Q31(-0.05908211155639f),
Q31(-0.04871498374946f),
Q31(0.0f),
Q31(0.07778723915851f),
80 Q31( 0.16486303567403f),
Q31( 0.23279856662996f),
Q31(0.25f)
83 static const int sintbl_4[4] = { 0, 1073741824, 0, -1073741824 };
84 static const int costbl_4[4] = { 1073741824, 0, -1073741824, 0 };
85 static const int sintbl_8[8] = { 0, 759250125, 1073741824, 759250125,
86 0, -759250125, -1073741824, -759250125 };
87 static const int costbl_8[8] = { 1073741824, 759250125, 0, -759250125,
88 -1073741824, -759250125, 0, 759250125 };
89 static const int sintbl_12[12] = { 0, 536870912, 929887697, 1073741824,
90 929887697, 536870912, 0, -536870912,
91 -929887697, -1073741824, -929887697, -536870912 };
92 static const int costbl_12[12] = { 1073741824, 929887697, 536870912, 0,
93 -536870912, -929887697, -1073741824, -929887697,
94 -536870912, 0, 536870912, 929887697 };
99 const int *sinptr, *cosptr;
100 int s,
c, sinhalf, coshalf;
108 }
else if (
bands == 8) {
117 coshalf = 1037154959;
120 for (q = 0; q <
bands; q++) {
121 for (n = 0; n < 7; n++) {
122 int theta = (q*(n-6) + (n>>1) - 3) %
bands;
197 static const int gamma_tab[] =
247 static const int iid_par_dequant_c1[] = {
249 Q30(1.41198278375959f),
Q30(1.40313815268360f),
Q30(1.38687670404960f),
Q30(1.34839972492648f),
250 Q30(1.29124937110028f),
Q30(1.19603741667993f),
Q30(1.10737240362323f),
Q30(1),
251 Q30(0.87961716655242f),
Q30(0.75464859232732f),
Q30(0.57677990744575f),
Q30(0.42640143271122f),
252 Q30(0.27671828230984f),
Q30(0.17664462766713f),
Q30(0.07940162697653f),
254 Q30(1.41420649135832f),
Q30(1.41419120222364f),
Q30(1.41414285699784f),
Q30(1.41399000859438f),
255 Q30(1.41350698548044f),
Q30(1.41198278375959f),
Q30(1.40977302262355f),
Q30(1.40539479488545f),
256 Q30(1.39677960498402f),
Q30(1.38005309967827f),
Q30(1.34839972492648f),
Q30(1.31392017367631f),
257 Q30(1.26431008149654f),
Q30(1.19603741667993f),
Q30(1.10737240362323f),
Q30(1),
258 Q30(0.87961716655242f),
Q30(0.75464859232732f),
Q30(0.63365607219232f),
Q30(0.52308104267543f),
259 Q30(0.42640143271122f),
Q30(0.30895540465965f),
Q30(0.22137464873077f),
Q30(0.15768788954414f),
260 Q30(0.11198225164225f),
Q30(0.07940162697653f),
Q30(0.04469901562677f),
Q30(0.02514469318284f),
261 Q30(0.01414142856998f),
Q30(0.00795258154731f),
Q30(0.00447211359449f),
264 static const int acos_icc_invq[] = {
270 static const int8_t f_center_20[] = {
271 -3, -1, 1, 3, 5, 7, 10, 14, 18, 22,
273 static const int32_t f_center_34[] = {
275 Q31( 34/768.0),
Q31(-10/768.0),
Q31(-6/768.0),
Q31(-2/768.0),
Q31( 51/768.0),
Q31( 57/768.0),
Q31( 15/768.0),
Q31(21/768.0),
276 Q31( 27/768.0),
Q31( 33/768.0),
Q31(39/768.0),
Q31(45/768.0),
Q31( 54/768.0),
Q31( 66/768.0),
Q31( 78/768.0),
Q31(42/768.0),
277 Q31(102/768.0),
Q31( 66/768.0),
Q31(78/768.0),
Q31(90/768.0),
Q31(102/768.0),
Q31(114/768.0),
Q31(126/768.0),
Q31(90/768.0)
279 static const int fractional_delay_links[] = {
Q31(0.43f),
Q31(0.75f),
Q31(0.347f) };
280 const int fractional_delay_gain =
Q31(0.39f);
282 for (pd0 = 0; pd0 < 8; pd0++) {
283 int pd0_re = (ipdopd_cos[pd0]+2)>>2;
284 int pd0_im = (ipdopd_sin[pd0]+2)>>2;
285 for (pd1 = 0; pd1 < 8; pd1++) {
286 int pd1_re = ipdopd_cos[pd1] >> 1;
287 int pd1_im = ipdopd_sin[pd1] >> 1;
288 for (pd2 = 0; pd2 < 8; pd2++) {
290 int pd2_re = ipdopd_cos[pd2];
291 int pd2_im = ipdopd_sin[pd2];
292 int re_smooth = pd0_re + pd1_re + pd2_re;
293 int im_smooth = pd0_im + pd1_im + pd2_im;
295 SoftFloat pd_mag =
av_int2sf(((ipdopd_cos[(pd0-pd1)&7]+8)>>4) + ((ipdopd_cos[(pd0-pd2)&7]+4)>>3) +
296 ((ipdopd_cos[(pd1-pd2)&7]+2)>>2) + 0x15000000, 28);
307 for (iid = 0; iid < 46; iid++) {
310 c1 = iid_par_dequant_c1[iid];
312 c2 = iid_par_dequant_c1[14-iid];
314 c2 = iid_par_dequant_c1[60-iid];
316 for (icc = 0; icc < 8; icc++) {
321 alpha = acos_icc_invq[icc];
333 int alpha_int, gamma_int;
334 int alpha_c_int, alpha_s_int, gamma_c_int, gamma_s_int;
337 gamma_int = gamma_tab[idx];
342 alpha_c_int = (
int)(((
int64_t)alpha_c_int * 1518500250 + 0x20000000) >> 30);
343 alpha_s_int = (
int)(((
int64_t)alpha_s_int * 1518500250 + 0x20000000) >> 30);
345 HB[iid][icc][0] = (
int)(((
int64_t)alpha_c_int * gamma_c_int + 0x20000000) >> 30);
346 HB[iid][icc][1] = (
int)(((
int64_t)alpha_s_int * gamma_c_int + 0x20000000) >> 30);
347 HB[iid][icc][2] = -(
int)(((
int64_t)alpha_s_int * gamma_s_int + 0x20000000) >> 30);
348 HB[iid][icc][3] = (
int)(((
int64_t)alpha_c_int * gamma_s_int + 0x20000000) >> 30);
351 if (icc < 5 || icc > 6)
362 f_center = f_center_20[k];
364 f_center = (k << 3) - 52;
367 theta = (
int)(((
int64_t)fractional_delay_links[m] * f_center + 8) >> 4);
373 theta = (
int)(((
int64_t)fractional_delay_gain * f_center + 8) >> 4);
384 f_center = f_center_34[k];
386 f_center = ((
int64_t)k << 26) - (53 << 25);
389 theta = (
int)(((
int64_t)fractional_delay_links[m] * f_center + 0x10000000) >> 27);
395 theta = (
int)(((
int64_t)fractional_delay_gain * f_center + 0x10000000) >> 27);
static int phi_fract[2][50][2]
static int f20_0_8[8][8][2]
static int pd_re_smooth[8 *8 *8]
static const int sintbl_12[12]
static const int costbl_8[8]
static void make_filters_from_proto(int(*filter)[8][2], const int *proto, int bands)
static const int g0_Q12[]
static const int costbl_12[12]
static int pd_im_smooth[8 *8 *8]
static int f34_0_12[12][8][2]
#define NR_ALLPASS_BANDS34
#define NR_ALLPASS_BANDS20
static int f34_2_4[4][8][2]
static const int sintbl_4[4]
static int f34_1_8[8][8][2]
static const int costbl_4[4]
static void ps_tableinit(void)
static TABLE_CONST int Q_fract_allpass[2][50][3][2]
static const int sintbl_8[8]
static const float bands[]
static const uint8_t alpha_tab[64]
static av_always_inline void filter(int16_t *output, ptrdiff_t out_stride, const int16_t *low, ptrdiff_t low_stride, const int16_t *high, ptrdiff_t high_stride, int len, int clip)
common internal and external API header
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
static const int16_t alpha[]
static av_always_inline av_const double round(double x)
#define FF_ARRAY_ELEMS(a)
static const SoftFloat FLOAT_1
1.0
static av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b)
b has to be normalized and not zero.
static av_unused void av_sincos_sf(int a, int *s, int *c)
Rounding-to-nearest used.
static av_const SoftFloat av_int2sf(int v, int frac_bits)
Converts a mantisse and exponent to a SoftFloat.
static av_always_inline SoftFloat av_sqrt_sf(SoftFloat val)
Rounding-to-nearest used.
static int shift(int a, int b)
static double cb(void *priv, double x, double y)