FFmpeg
libavcodec
mpegaudiodec_common_tablegen.h
Go to the documentation of this file.
1
/*
2
* Header file for hardcoded shared mpegaudiodec tables
3
*
4
* Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
5
* Copyright (c) 2020 Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
6
*
7
* This file is part of FFmpeg.
8
*
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.
13
*
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.
18
*
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
22
*/
23
24
#ifndef AVCODEC_MPEGAUDIODEC_COMMON_TABLEGEN_H
25
#define AVCODEC_MPEGAUDIODEC_COMMON_TABLEGEN_H
26
27
#include <stdint.h>
28
29
#define TABLE_4_3_SIZE ((8191 + 16)*4)
30
31
#if CONFIG_HARDCODED_TABLES
32
#define mpegaudiodec_common_tableinit()
33
#include "libavcodec/mpegaudiodec_common_tables.h"
34
#else
35
#include <math.h>
36
#include "
libavutil/attributes.h
"
37
38
int8_t
ff_table_4_3_exp
[
TABLE_4_3_SIZE
];
39
uint32_t
ff_table_4_3_value
[
TABLE_4_3_SIZE
];
40
41
#define FRAC_BITS 23
42
#define IMDCT_SCALAR 1.759
43
44
static
av_cold
void
mpegaudiodec_common_tableinit
(
void
)
45
{
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) */
51
};
52
double
pow43_val = 0;
53
54
for
(
int
i
= 1;
i
<
TABLE_4_3_SIZE
;
i
++) {
55
double
f
, fm;
56
int
e, m;
57
double
value
=
i
/ 4;
58
if
((
i
& 3) == 0)
59
pow43_val =
value
/
IMDCT_SCALAR
*
cbrt
(
value
);
60
f
= pow43_val * exp2_lut[
i
& 3];
61
fm = frexp(
f
, &e);
62
m =
llrint
(fm * (1LL << 31));
63
e +=
FRAC_BITS
- 31 + 5 - 100;
64
65
/* normalized to FRAC_BITS */
66
ff_table_4_3_value
[
i
] = m;
67
ff_table_4_3_exp
[
i
] = -e;
68
}
69
}
70
71
#endif
/* CONFIG_HARDCODED_TABLES */
72
#endif
/* AVCODEC_MPEGAUDIODEC_COMMON_TABLEGEN_H */
cbrt
#define cbrt
Definition:
tablegen.h:35
av_cold
#define av_cold
Definition:
attributes.h:90
f
#define f(width, name)
Definition:
cbs_vp9.c:255
ff_table_4_3_value
uint32_t ff_table_4_3_value[TABLE_4_3_SIZE]
Definition:
mpegaudiodec_common_tablegen.h:39
IMDCT_SCALAR
#define IMDCT_SCALAR
Definition:
mpegaudiodec_common_tablegen.h:42
attributes.h
mpegaudiodec_common_tableinit
static av_cold void mpegaudiodec_common_tableinit(void)
Definition:
mpegaudiodec_common_tablegen.h:44
i
int i
Definition:
input.c:407
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition:
writing_filters.txt:86
TABLE_4_3_SIZE
#define TABLE_4_3_SIZE
Definition:
mpegaudiodec_common_tablegen.h:29
ff_table_4_3_exp
int8_t ff_table_4_3_exp[TABLE_4_3_SIZE]
Definition:
mpegaudiodec_common_tablegen.h:38
llrint
#define llrint(x)
Definition:
libm.h:394
M_SQRT2
#define M_SQRT2
Definition:
mathematics.h:61
FRAC_BITS
#define FRAC_BITS
Definition:
mpegaudiodec_common_tablegen.h:41
Generated on Wed Aug 24 2022 21:34:08 for FFmpeg by
1.8.17