comparison alsdec.c @ 10531:142645a57180 libavcodec

Merge data tables from als_data.h with the decoder source to reduce code complexity.
author thilo.borgmann
date Sat, 14 Nov 2009 11:49:48 +0000
parents d428e57f14c6
children 95f3daa991a2
comparison
equal deleted inserted replaced
10530:d428e57f14c6 10531:142645a57180
33 #include "get_bits.h" 33 #include "get_bits.h"
34 #include "unary.h" 34 #include "unary.h"
35 #include "mpeg4audio.h" 35 #include "mpeg4audio.h"
36 #include "bytestream.h" 36 #include "bytestream.h"
37 37
38 #include "als_data.h" 38 #include <stdint.h>
39
40 /** Rice parameters and corresponding index offsets for decoding the
41 * indices of scaled PARCOR values. The table choosen is set globally
42 * by the encoder and stored in ALSSpecificConfig.
43 */
44 static const int8_t parcor_rice_table[3][20][2] = {
45 { {-52, 4}, {-29, 5}, {-31, 4}, { 19, 4}, {-16, 4},
46 { 12, 3}, { -7, 3}, { 9, 3}, { -5, 3}, { 6, 3},
47 { -4, 3}, { 3, 3}, { -3, 2}, { 3, 2}, { -2, 2},
48 { 3, 2}, { -1, 2}, { 2, 2}, { -1, 2}, { 2, 2} },
49 { {-58, 3}, {-42, 4}, {-46, 4}, { 37, 5}, {-36, 4},
50 { 29, 4}, {-29, 4}, { 25, 4}, {-23, 4}, { 20, 4},
51 {-17, 4}, { 16, 4}, {-12, 4}, { 12, 3}, {-10, 4},
52 { 7, 3}, { -4, 4}, { 3, 3}, { -1, 3}, { 1, 3} },
53 { {-59, 3}, {-45, 5}, {-50, 4}, { 38, 4}, {-39, 4},
54 { 32, 4}, {-30, 4}, { 25, 3}, {-23, 3}, { 20, 3},
55 {-20, 3}, { 16, 3}, {-13, 3}, { 10, 3}, { -7, 3},
56 { 3, 3}, { 0, 3}, { -1, 3}, { 2, 3}, { -1, 2} }
57 };
58
59
60 /** Scaled PARCOR values used for the first two PARCOR coefficients.
61 * To be indexed by the Rice coded indices.
62 * Generated by: parcor_scaled_values[i] = 32 + ((i * (i+1)) << 7) - (1 << 20)
63 * Actual values are divided by 32 in order to be stored in 16 bits.
64 */
65 static const int16_t parcor_scaled_values[] = {
66 -1048544 / 32, -1048288 / 32, -1047776 / 32, -1047008 / 32,
67 -1045984 / 32, -1044704 / 32, -1043168 / 32, -1041376 / 32,
68 -1039328 / 32, -1037024 / 32, -1034464 / 32, -1031648 / 32,
69 -1028576 / 32, -1025248 / 32, -1021664 / 32, -1017824 / 32,
70 -1013728 / 32, -1009376 / 32, -1004768 / 32, -999904 / 32,
71 -994784 / 32, -989408 / 32, -983776 / 32, -977888 / 32,
72 -971744 / 32, -965344 / 32, -958688 / 32, -951776 / 32,
73 -944608 / 32, -937184 / 32, -929504 / 32, -921568 / 32,
74 -913376 / 32, -904928 / 32, -896224 / 32, -887264 / 32,
75 -878048 / 32, -868576 / 32, -858848 / 32, -848864 / 32,
76 -838624 / 32, -828128 / 32, -817376 / 32, -806368 / 32,
77 -795104 / 32, -783584 / 32, -771808 / 32, -759776 / 32,
78 -747488 / 32, -734944 / 32, -722144 / 32, -709088 / 32,
79 -695776 / 32, -682208 / 32, -668384 / 32, -654304 / 32,
80 -639968 / 32, -625376 / 32, -610528 / 32, -595424 / 32,
81 -580064 / 32, -564448 / 32, -548576 / 32, -532448 / 32,
82 -516064 / 32, -499424 / 32, -482528 / 32, -465376 / 32,
83 -447968 / 32, -430304 / 32, -412384 / 32, -394208 / 32,
84 -375776 / 32, -357088 / 32, -338144 / 32, -318944 / 32,
85 -299488 / 32, -279776 / 32, -259808 / 32, -239584 / 32,
86 -219104 / 32, -198368 / 32, -177376 / 32, -156128 / 32,
87 -134624 / 32, -112864 / 32, -90848 / 32, -68576 / 32,
88 -46048 / 32, -23264 / 32, -224 / 32, 23072 / 32,
89 46624 / 32, 70432 / 32, 94496 / 32, 118816 / 32,
90 143392 / 32, 168224 / 32, 193312 / 32, 218656 / 32,
91 244256 / 32, 270112 / 32, 296224 / 32, 322592 / 32,
92 349216 / 32, 376096 / 32, 403232 / 32, 430624 / 32,
93 458272 / 32, 486176 / 32, 514336 / 32, 542752 / 32,
94 571424 / 32, 600352 / 32, 629536 / 32, 658976 / 32,
95 688672 / 32, 718624 / 32, 748832 / 32, 779296 / 32,
96 810016 / 32, 840992 / 32, 872224 / 32, 903712 / 32,
97 935456 / 32, 967456 / 32, 999712 / 32, 1032224 / 32
98 };
99
100
101 /** Gain values of p(0) for long-term prediction.
102 * To be indexed by the Rice coded indices.
103 */
104 static const uint8_t ltp_gain_values [4][4] = {
105 { 0, 8, 16, 24},
106 {32, 40, 48, 56},
107 {64, 70, 76, 82},
108 {88, 92, 96, 100}
109 };
110
39 111
40 enum RA_Flag { 112 enum RA_Flag {
41 RA_FLAG_NONE, 113 RA_FLAG_NONE,
42 RA_FLAG_FRAMES, 114 RA_FLAG_FRAMES,
43 RA_FLAG_HEADER 115 RA_FLAG_HEADER