FastLED 3.10.6
Loading...
Searching...
No Matches
minimp3_fixed_tables.h
Go to the documentation of this file.
1// SPDX-License-Identifier: CC0-1.0
2/*
3 Fixed-point constant tables for minimp3's integer DSP path.
4
5 GENERATED FILE -- do not edit by hand. Regenerate with:
6 uv run python ci/codec_tables/generate_minimp3_fixed_tables.py --write
7 and verify with `--check`, which CI runs.
8
9 Every constant is derived from its ISO 11172-3 / 13818-3 formula in the
10 generator and rounded once into the Q format named on the array. Values are
11 dedicated to the public domain along with the rest of minimp3.
12
13 NOTE: this file has no include guard and opens no namespace on purpose. It
14 is included from inside minimp3.h's already-open fl::MINIMP3_NAMESPACE, so
15 that a translation unit holding more than one decoder variant gets its own
16 copy of the tables per variant rather than the first one silently winning.
17*/
18
19
20/* x**(4/3) mantissas, value = mant * 2**(exp - 30); upstream g_pow43 layout */
21static const int32_t g_pow43_mant[145] = {
22 0,-1073741824,-1352829926,-1161452763,-1704458901,-1147545432,-1463338785,-1797244940,
23 -1073741824,-1256328562,-1445816646,-1641736552,-1843691338,-2051340197,-1132193366,-1241285180,
24 0,1073741824,1352829926,1161452763,1704458901,1147545432,1463338785,1797244940,
25 1073741824,1256328562,1445816646,1641736552,1843691338,2051340197,1132193366,1241285180,
26 1352829926,1466724186,1582874800,1701197332,1821614827,1944056807,2068458440,1097379924,
27 1161452763,1226421930,1292263347,1358954496,1426474254,1494802767,1563921327,1633812274,
28 1704458901,1775845377,1847956676,1920778511,1994297280,2068500013,2143374328,1109454194,
29 1147545432,1185955452,1224679047,1263711219,1303047165,1342682263,1382612066,1422832284,
30 1463338785,1504127577,1545194805,1586536745,1628149793,1670030463,1712175375,1754581259,
31 1797244940,1840163341,1883333472,1926752432,1970417401,2014325637,2058474476,2102861321,
32 1073741824,1096169499,1118712486,1141369619,1164139758,1187021793,1210014639,1233117240,
33 1256328562,1279647595,1303073354,1326604876,1350241217,1373981457,1397824693,1421770044,
34 1445816646,1469963653,1494210238,1518555589,1542998910,1567539424,1592176366,1616908986,
35 1641736552,1666658341,1691673647,1716781775,1741982045,1767273788,1792656346,1818129074,
36 1843691338,1869342516,1895081995,1920909174,1946823461,1972824274,1998911042,2025083200,
37 2051340197,2077681487,2104106534,2130614810,1078602898,1091939491,1105316931,1118734971,
38 1132193366,1145691876,1159230264,1172808296,1186425743,1200082376,1213777973,1227512314,
39 1241285180,1255096358,1268945636,1282832806,1296757661,1310720000,1324719622,1338756329,
40 1352829926,
41};
42
43/* matching exponents for g_pow43_mant */
44static const int8_t g_pow43_exp[145] = {
45 0,0,1,2,2,3,3,3,4,4,4,4,4,4,5,5,0,0,1,2,2,3,3,3,
46 4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,
47 6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
48 7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
49 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
50 8,8,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
51 9,
52};
53
54/* 2**(r/4) for r in [0,3], Q30 -- fractional part of a gain exponent */
55static const int32_t g_expfrac_q30[4] = {
56 1073741824,1276901417,1518500250,1805811301,
57};
58
59/* alias reduction cs = 1/sqrt(1+c^2), Q31 */
60static const int32_t g_aa_cs_q31[8] = {
61 1841452036,1893526521,2039311996,2111652008,2137858231,2145680960,2147267171,2147468949,
62};
63
64/* alias reduction -ca = -c/sqrt(1+c^2), Q31 */
65static const int32_t g_aa_ca_q31[8] = {
66 1104871222,1013036689,672972959,390655622,203096532,87972919,30491194,7945635,
67};
68
69/* IMDCT-36 twiddles: cos then sin of (2k+1)*pi/72, Q30 */
70static const int32_t g_twid9_q30[18] = {
71 791645512,851856663,905584669,952420630,992008094,1024045778,1048289855,1064555814,1072719860,
72 725409462,653652607,576921062,495798798,410903207,322880394,232400266,140151432,46835961,
73};
74
75/* IMDCT-12 twiddles: cos then sin of (2k+1)*pi/24, Q30 */
76static const int32_t g_twid3_q30[6] = {
77 851856663,992008094,1064555814,653652607,410903207,140151432,
78};
79
80/* long-block window, cos then sin of (2i+1)*pi/72, Q30 */
82 1072719860,1064555814,1048289855,1024045778,992008094,952420630,905584669,851856663,791645512,
83 46835961,140151432,232400266,322880394,410903207,495798798,576921062,653652607,725409462,
84};
85
86/* start/stop-block window, Q30 */
87static const int32_t g_mdct_window_stop_q30[18] = {
88 1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1064555814,992008094,851856663,
89 0,0,0,0,0,0,140151432,410903207,653652607,
90};
91
92/* DCT-32 secants 1/(2 cos theta), Q27 (values reach 10.19) */
93static constexpr int32_t g_sec_q27[24] = {
94 1367679739,67189797,67433575,457361460,67843164,70128577,
95 276190692,69182167,76093940,199201203,71275330,86814950,
96 156959571,74236348,105784323,130535899,78240207,142361749,
97 112655602,83551089,231182936,99929967,90571242,684664578,
98};
99
100/* MPEG-1 intensity stereo pan pairs (kl, kr), Q30 */
101static const int32_t g_pan_q30[14] = {
102 0,1073741824,226908346,846833478,393016785,680725039,
103 536870912,536870912,680725039,393016785,846833478,226908346,
104 1073741824,0,
105};
106
107/* Layer I/II dequantiser steps, value = mant * 2**(exp - 30) */
108static const int32_t g_deq_L12_mant[54] = {
109 1431655765,1136305934,1803773235,1227133513,1947953030,1546091344,
110 1145324612,1818089494,1443018588,1108378657,1759441446,1396469601,
111 1090785345,1731513804,1374303417,1082196484,1717879837,1363482130,
112 1077952576,1711143054,1358135142,1075843080,1707794437,1355477343,
113 1074791425,1706125039,1354152341,1074266368,1705291563,1353490810,
114 1074004032,1704875130,1353160288,1073872912,1704666990,1352995087,
115 1073807364,1704562939,1352912501,1073774593,1704510919,1352871213,
116 1073758208,1704484909,1352850569,1431655765,1136305934,1803773235,
117 1717986918,1363567121,1082263941,1908874354,1515074579,1202515490,
118};
119
120/* matching exponents for g_deq_L12_mant */
121static const int8_t g_deq_L12_exp[54] = {
122 -22,-22,-23,-23,-24,-24,-24,-25,-25,-25,-26,-26,-26,-27,-27,-27,-28,-28,
123 -28,-29,-29,-29,-30,-30,-30,-31,-31,-31,-32,-32,-32,-33,-33,-33,-34,-34,
124 -34,-35,-35,-35,-36,-36,-36,-37,-37,-22,-22,-23,-23,-23,-23,-24,-24,-24,
125};
126
127/* Inline kernel scalars. */
128#define MP3D_Q30_SQRT2 1518500250 /* Q30: sqrt(2), the mid/side stereo rescale */
129#define MP3D_Q31_COS_PI_4 1518500250 /* Q31: cos(pi/4), the DCT-32 half-butterfly scale */
130#define MP3D_Q31_TAN_PI_16 427161056 /* Q31: tan(pi/16), first and third steps of the pi/8 rotation */
131#define MP3D_Q31_SIN_PI_8 821806413 /* Q31: sin(pi/8), middle step of the pi/8 rotation */
132#define MP3D_Q29_SEC_PI_16 273694417 /* Q29: 1/(2 cos(pi/16)) */
133#define MP3D_Q29_SEC_PI_8 290552444 /* Q29: 1/(2 cos(pi/8)) */
134#define MP3D_Q29_SEC_3PI_16 322844578 /* Q29: 1/(2 cos(3pi/16)) */
135#define MP3D_Q29_SEC_5PI_16 483171056 /* Q29: 1/(2 cos(5pi/16)) */
136#define MP3D_Q29_SEC_3PI_8 701455651 /* Q29: 1/(2 cos(3pi/8)) */
137#define MP3D_Q29_SEC_7PI_16 1375954754 /* Q29: 1/(2 cos(7pi/16)) */
138#define MP3D_Q31_COS_PI_9 2017974537 /* Q31: cos(20 deg) */
139#define MP3D_Q31_COS_2PI_9 1645067915 /* Q31: cos(40 deg) */
140#define MP3D_Q31_COS_4PI_9 372906622 /* Q31: cos(80 deg) */
141#define MP3D_Q31_COS_PI_6 1859775393 /* Q31: cos(30 deg) */
142#define MP3D_Q31_COS_PI_18 2114858546 /* Q31: cos(10 deg) */
143#define MP3D_Q31_COS_7PI_18 734482665 /* Q31: cos(70 deg) */
144#define MP3D_Q31_COS_5PI_18 1380375881 /* Q31: cos(50 deg) */
145#define MP3D_Q30_POW43_C1 1431655765 /* Q30: first-order term of the x**(4/3) interpolation */
146#define MP3D_Q30_POW43_C2 238609294 /* Q30: second-order term of the x**(4/3) interpolation */
static const int32_t g_mdct_window_normal_q30[18]
static const int32_t g_expfrac_q30[4]
static const int32_t g_twid3_q30[6]
static const int8_t g_deq_L12_exp[54]
static const int32_t g_pow43_mant[145]
static const int32_t g_twid9_q30[18]
static const int32_t g_mdct_window_stop_q30[18]
static const int32_t g_aa_ca_q31[8]
static const int32_t g_aa_cs_q31[8]
static const int32_t g_deq_L12_mant[54]
static constexpr int32_t g_sec_q27[24]
static const int32_t g_pan_q30[14]
static const int8_t g_pow43_exp[145]
signed char int8_t
Definition stdint.h:209
fl::i32 int32_t
Definition stdint.h:219