annotate als_data.h @ 10522:9b56cd1e37b7 libavcodec

Add MPEG-4 Audio Lossless Coding (ALS) decoder. Patch by Thilo Borgmann, thilo D borgmann A googlemail
author cehoyos
date Wed, 11 Nov 2009 22:36:17 +0000
parents
children d428e57f14c6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10522
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
1 /*
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
2 * ALS header file for common data
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
3 * Copyright (c) 2009 Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
4 *
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
5 * This file is part of FFmpeg.
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
6 *
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
11 *
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
15 * Lesser General Public License for more details.
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
16 *
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
20 */
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
21
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
22 #ifndef AVCODEC_ALS_DATA_H
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
23 #define AVCODEC_ALS_DATA_H
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
24
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
25 /**
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
26 * @file libavcodec/als_data.h
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
27 * MPEG-4 ALS common data tables
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
28 * @author Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
29 */
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
30
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
31
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
32 #include <stdint.h>
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
33
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
34 /** Rice parameters and corresponding index offsets for decoding the
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
35 * indices of scaled PARCOR values. The table choosen is set globally
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
36 * by the encoder and stored in ALSSpecificConfig.
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
37 */
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
38 static const int8_t parcor_rice_table[3][20][2] = {
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
39 { {-52, 4}, {-29, 5}, {-31, 4}, { 19, 4}, {-16, 4},
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
40 { 12, 3}, { -7, 3}, { 9, 3}, { -5, 3}, { 6, 3},
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
41 { -4, 3}, { 3, 3}, { -3, 2}, { 3, 2}, { -2, 2},
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
42 { 3, 2}, { -1, 2}, { 2, 2}, { -1, 2}, { 2, 2} },
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
43 { {-58, 3}, {-42, 4}, {-46, 4}, { 37, 5}, {-36, 4},
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
44 { 29, 4}, {-29, 4}, { 25, 4}, {-23, 4}, { 20, 4},
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
45 {-17, 4}, { 16, 4}, {-12, 4}, { 12, 3}, {-10, 4},
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
46 { 7, 3}, { -4, 4}, { 3, 3}, { -1, 3}, { 1, 3} },
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
47 { {-59, 3}, {-45, 5}, {-50, 4}, { 38, 4}, {-39, 4},
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
48 { 32, 4}, {-30, 4}, { 25, 3}, {-23, 3}, { 20, 3},
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
49 {-20, 3}, { 16, 3}, {-13, 3}, { 10, 3}, { -7, 3},
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
50 { 3, 3}, { 0, 3}, { -1, 3}, { 2, 3}, { -1, 2} }
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
51 };
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
52
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
53
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
54 /** Scaled PARCOR values used for the first two PARCOR coefficients.
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
55 * To be indexed by the Rice coded indices.
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
56 * Generated by: parcor_scaled_values[i] = 32 + ((i * (i+1)) << 7) - (1 << 20)
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
57 * Actual values are divided by 32 in order to be stored in 16 bits.
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
58 */
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
59 static const int16_t parcor_scaled_values[] = {
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
60 -1048544 / 32, -1048288 / 32, -1047776 / 32, -1047008 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
61 -1045984 / 32, -1044704 / 32, -1043168 / 32, -1041376 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
62 -1039328 / 32, -1037024 / 32, -1034464 / 32, -1031648 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
63 -1028576 / 32, -1025248 / 32, -1021664 / 32, -1017824 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
64 -1013728 / 32, -1009376 / 32, -1004768 / 32, -999904 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
65 -994784 / 32, -989408 / 32, -983776 / 32, -977888 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
66 -971744 / 32, -965344 / 32, -958688 / 32, -951776 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
67 -944608 / 32, -937184 / 32, -929504 / 32, -921568 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
68 -913376 / 32, -904928 / 32, -896224 / 32, -887264 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
69 -878048 / 32, -868576 / 32, -858848 / 32, -848864 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
70 -838624 / 32, -828128 / 32, -817376 / 32, -806368 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
71 -795104 / 32, -783584 / 32, -771808 / 32, -759776 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
72 -747488 / 32, -734944 / 32, -722144 / 32, -709088 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
73 -695776 / 32, -682208 / 32, -668384 / 32, -654304 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
74 -639968 / 32, -625376 / 32, -610528 / 32, -595424 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
75 -580064 / 32, -564448 / 32, -548576 / 32, -532448 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
76 -516064 / 32, -499424 / 32, -482528 / 32, -465376 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
77 -447968 / 32, -430304 / 32, -412384 / 32, -394208 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
78 -375776 / 32, -357088 / 32, -338144 / 32, -318944 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
79 -299488 / 32, -279776 / 32, -259808 / 32, -239584 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
80 -219104 / 32, -198368 / 32, -177376 / 32, -156128 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
81 -134624 / 32, -112864 / 32, -90848 / 32, -68576 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
82 -46048 / 32, -23264 / 32, -224 / 32, 23072 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
83 46624 / 32, 70432 / 32, 94496 / 32, 118816 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
84 143392 / 32, 168224 / 32, 193312 / 32, 218656 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
85 244256 / 32, 270112 / 32, 296224 / 32, 322592 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
86 349216 / 32, 376096 / 32, 403232 / 32, 430624 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
87 458272 / 32, 486176 / 32, 514336 / 32, 542752 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
88 571424 / 32, 600352 / 32, 629536 / 32, 658976 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
89 688672 / 32, 718624 / 32, 748832 / 32, 779296 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
90 810016 / 32, 840992 / 32, 872224 / 32, 903712 / 32,
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
91 935456 / 32, 967456 / 32, 999712 / 32, 1032224 / 32
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
92 };
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
93
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
94
9b56cd1e37b7 Add MPEG-4 Audio Lossless Coding (ALS) decoder.
cehoyos
parents:
diff changeset
95 #endif /* AVCODEC_ALS_DATA_H */