2 * Header file for hardcoded shared mpegaudiodec tables
4 * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
5 * Copyright (c) 2020 Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
7 * This file is part of FFmpeg.
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #ifndef AVCODEC_MPEGAUDIODEC_COMMON_TABLEGEN_H
25 #define AVCODEC_MPEGAUDIODEC_COMMON_TABLEGEN_H
29 #define TABLE_4_3_SIZE ((8191 + 16)*4)
31 #if CONFIG_HARDCODED_TABLES
32 #define mpegaudiodec_common_tableinit()
33 #include "libavcodec/mpegaudiodec_common_tables.h"
36 #include "libavutil/attributes.h"
38 int8_t ff_table_4_3_exp [TABLE_4_3_SIZE];
39 uint32_t ff_table_4_3_value[TABLE_4_3_SIZE];
42 #define IMDCT_SCALAR 1.759
44 static av_cold void mpegaudiodec_common_tableinit(void)
46 static const double exp2_lut[4] = {
47 1.00000000000000000000, /* 2 ^ (0 * 0.25) */
48 1.18920711500272106672, /* 2 ^ (1 * 0.25) */
49 M_SQRT2 , /* 2 ^ (2 * 0.25) */
50 1.68179283050742908606, /* 2 ^ (3 * 0.25) */
54 for (int i = 1; i < TABLE_4_3_SIZE; i++) {
59 pow43_val = value / IMDCT_SCALAR * cbrt(value);
60 f = pow43_val * exp2_lut[i & 3];
62 m = llrint(fm * (1LL << 31));
63 e += FRAC_BITS - 31 + 5 - 100;
65 /* normalized to FRAC_BITS */
66 ff_table_4_3_value[i] = m;
67 ff_table_4_3_exp [i] = -e;
71 #endif /* CONFIG_HARDCODED_TABLES */
72 #endif /* AVCODEC_MPEGAUDIODEC_COMMON_TABLEGEN_H */