]> git.sesse.net Git - ffmpeg/blob - libavcodec/atrac3data.h
avformat: Constify the API wrt AV(In|Out)putFormat
[ffmpeg] / libavcodec / atrac3data.h
1 /*
2  * ATRAC3 compatible decoder data
3  * Copyright (c) 2006-2007 Maxim Poliakovski
4  * Copyright (c) 2006-2007 Benjamin Larsson
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22
23 /**
24  * @file
25  * ATRAC3 AKA RealAudio 8 compatible decoder data
26  */
27
28 #ifndef AVCODEC_ATRAC3DATA_H
29 #define AVCODEC_ATRAC3DATA_H
30
31 #include <stdint.h>
32
33 /* VLC tables */
34
35 static const uint8_t atrac3_hufftabs[][2] = {
36     /* Spectral coefficient 1 - 9 entries */
37     { 31, 1 }, { 32, 3 }, { 33, 3 }, { 34, 4 }, { 35, 4 },
38     { 36, 5 }, { 37, 5 }, { 38, 5 }, { 39, 5 },
39     /* Spectral coefficient 2 - 5 entries */
40     { 31, 1 }, { 32, 3 }, { 30, 3 }, { 33, 3 }, { 29, 3 },
41     /* Spectral coefficient 3 - 7 entries */
42     { 31, 1 }, { 32, 3 }, { 30, 3 }, { 33, 4 },
43     { 29, 4 }, { 34, 4 }, { 28, 4 },
44     /* Spectral coefficient 4 - 9 entries */
45     { 31, 1 }, { 32, 3 }, { 30, 3 }, { 33, 4 }, { 29, 4 },
46     { 34, 5 }, { 28, 5 }, { 35, 5 }, { 27, 5 },
47     /* Spectral coefficient 5 - 15 entries */
48     { 31, 2 }, { 32, 3 }, { 30, 3 }, { 33, 4 }, { 29, 4 },
49     { 34, 4 }, { 28, 4 }, { 38, 4 }, { 24, 4 }, { 35, 5 },
50     { 27, 5 }, { 36, 6 }, { 26, 6 }, { 37, 6 }, { 25, 6 },
51     /* Spectral coefficient 6 - 31 entries */
52     { 31, 3 }, { 32, 4 }, { 30, 4 }, { 33, 4 }, { 29, 4 }, { 34, 4 },
53     { 28, 4 }, { 46, 4 }, { 16, 4 }, { 35, 5 }, { 27, 5 }, { 36, 5 },
54     { 26, 5 }, { 37, 5 }, { 25, 5 }, { 38, 6 }, { 24, 6 }, { 39, 6 },
55     { 23, 6 }, { 40, 6 }, { 22, 6 }, { 41, 6 }, { 21, 6 }, { 42, 7 },
56     { 20, 7 }, { 43, 7 }, { 19, 7 }, { 44, 7 }, { 18, 7 }, { 45, 7 },
57     { 17, 7 },
58     /* Spectral coefficient 7 - 63 entries */
59     { 31, 3 }, { 62, 4 }, {  0, 4 }, { 32, 5 }, { 30, 5 }, { 33, 5 },
60     { 29, 5 }, { 34, 5 }, { 28, 5 }, { 35, 5 }, { 27, 5 }, { 36, 5 },
61     { 26, 5 }, { 37, 6 }, { 25, 6 }, { 38, 6 }, { 24, 6 }, { 39, 6 },
62     { 23, 6 }, { 40, 6 }, { 22, 6 }, { 41, 6 }, { 21, 6 }, { 42, 6 },
63     { 20, 6 }, { 43, 6 }, { 19, 6 }, { 44, 6 }, { 18, 6 }, { 45, 7 },
64     { 17, 7 }, { 46, 7 }, { 16, 7 }, { 47, 7 }, { 15, 7 }, { 48, 7 },
65     { 14, 7 }, { 49, 7 }, { 13, 7 }, { 50, 7 }, { 12, 7 }, { 51, 7 },
66     { 11, 7 }, { 52, 8 }, { 10, 8 }, { 53, 8 }, {  9, 8 }, { 54, 8 },
67     {  8, 8 }, { 55, 8 }, {  7, 8 }, { 56, 8 }, {  6, 8 }, { 57, 8 },
68     {  5, 8 }, { 58, 8 }, {  4, 8 }, { 59, 8 }, {  3, 8 }, { 60, 8 },
69     {  2, 8 }, { 61, 8 }, {  1, 8 },
70 };
71
72 static const uint8_t huff_tab_sizes[7] = {
73     9, 5, 7, 9, 15, 31, 63,
74 };
75
76 /* selector tables */
77
78 static const uint8_t clc_length_tab[8] = { 0, 4, 3, 3, 4, 4, 5, 6 };
79
80 static const int8_t mantissa_clc_tab[4] = { 0, 1, -2, -1 };
81
82 static const int8_t mantissa_vlc_tab[18] = {
83     0, 0,  0, 1,  0, -1,  1, 0,  -1, 0,  1, 1,  1, -1,  -1, 1,  -1, -1
84 };
85
86
87 /* tables for the scalefactor decoding */
88
89 static const float inv_max_quant[8] = {
90       0.0,       1.0 / 1.5, 1.0 /  2.5, 1.0 /  3.5,
91       1.0 / 4.5, 1.0 / 7.5, 1.0 / 15.5, 1.0 / 31.5
92 };
93
94 static const uint16_t subband_tab[33] = {
95       0,   8,  16,  24,  32,  40,  48,  56,
96      64,  80,  96, 112, 128, 144, 160, 176,
97     192, 224, 256, 288, 320, 352, 384, 416,
98     448, 480, 512, 576, 640, 704, 768, 896,
99     1024
100 };
101
102 /* joint stereo related tables */
103 static const float matrix_coeffs[8] = {
104     0.0, 2.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0
105 };
106
107 #endif /* AVCODEC_ATRAC3DATA_H */