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.00746082949812
f),
Q31(0.02270420949825
f),
Q31(0.04546865930473
f),
Q31(0.07266113929591
f),
65 Q31(0.09885108575264
f),
Q31(0.11793710567217
f),
Q31(0.125
f)
69 Q31(0.04081179924692
f),
Q31(0.03812810994926
f),
Q31(0.05144908135699
f),
Q31(0.06399831151592
f),
70 Q31(0.07428313801106
f),
Q31(0.08100347892914
f),
Q31(0.08333333333333
f)
74 Q31(0.01565675600122
f),
Q31(0.03752716391991
f),
Q31(0.05417891378782
f),
Q31(0.08417044116767
f),
75 Q31(0.10307344158036
f),
Q31(0.12222452249753
f),
Q31(0.125
f)
79 Q31(-0.05908211155639
f),
Q31(-0.04871498374946
f),
Q31(0.0
f),
Q31(0.07778723915851
f),
80 Q31( 0.16486303567403
f),
Q31( 0.23279856662996
f),
Q31(0.25
f)
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.41198278375959
f),
Q30(1.40313815268360
f),
Q30(1.38687670404960
f),
Q30(1.34839972492648
f),
250 Q30(1.29124937110028
f),
Q30(1.19603741667993
f),
Q30(1.10737240362323
f),
Q30(1),
251 Q30(0.87961716655242
f),
Q30(0.75464859232732
f),
Q30(0.57677990744575
f),
Q30(0.42640143271122
f),
252 Q30(0.27671828230984
f),
Q30(0.17664462766713
f),
Q30(0.07940162697653
f),
254 Q30(1.41420649135832
f),
Q30(1.41419120222364
f),
Q30(1.41414285699784
f),
Q30(1.41399000859438
f),
255 Q30(1.41350698548044
f),
Q30(1.41198278375959
f),
Q30(1.40977302262355
f),
Q30(1.40539479488545
f),
256 Q30(1.39677960498402
f),
Q30(1.38005309967827
f),
Q30(1.34839972492648
f),
Q30(1.31392017367631
f),
257 Q30(1.26431008149654
f),
Q30(1.19603741667993
f),
Q30(1.10737240362323
f),
Q30(1),
258 Q30(0.87961716655242
f),
Q30(0.75464859232732
f),
Q30(0.63365607219232
f),
Q30(0.52308104267543
f),
259 Q30(0.42640143271122
f),
Q30(0.30895540465965
f),
Q30(0.22137464873077
f),
Q30(0.15768788954414
f),
260 Q30(0.11198225164225
f),
Q30(0.07940162697653
f),
Q30(0.04469901562677
f),
Q30(0.02514469318284
f),
261 Q30(0.01414142856998
f),
Q30(0.00795258154731
f),
Q30(0.00447211359449
f),
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.43
f),
Q31(0.75
f),
Q31(0.347
f) };
280 const int fractional_delay_gain =
Q31(0.39
f);
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);