Mercurial > libavcodec.hg
comparison g726.c @ 6128:9dd54c009d47 libavcodec
Mark the tables in g726.c as constant.
Patch by Diego 'Flameeyes' Petten flameeyes gmail ! com
author | benoit |
---|---|
date | Mon, 07 Jan 2008 12:43:04 +0000 |
parents | f99e40a7155b |
children | 0014e6433d96 |
comparison
equal
deleted
inserted
replaced
6127:e830a3633548 | 6128:9dd54c009d47 |
---|---|
62 return (value < 0) ? -1 : 1; | 62 return (value < 0) ? -1 : 1; |
63 } | 63 } |
64 | 64 |
65 typedef struct G726Tables { | 65 typedef struct G726Tables { |
66 int bits; /**< bits per sample */ | 66 int bits; /**< bits per sample */ |
67 int* quant; /**< quantization table */ | 67 const int* quant; /**< quantization table */ |
68 int* iquant; /**< inverse quantization table */ | 68 const int* iquant; /**< inverse quantization table */ |
69 int* W; /**< special table #1 ;-) */ | 69 const int* W; /**< special table #1 ;-) */ |
70 int* F; /**< special table #2 */ | 70 const int* F; /**< special table #2 */ |
71 } G726Tables; | 71 } G726Tables; |
72 | 72 |
73 typedef struct G726Context { | 73 typedef struct G726Context { |
74 G726Tables* tbls; /**< static tables needed for computation */ | 74 const G726Tables* tbls; /**< static tables needed for computation */ |
75 | 75 |
76 Float11 sr[2]; /**< prev. reconstructed samples */ | 76 Float11 sr[2]; /**< prev. reconstructed samples */ |
77 Float11 dq[6]; /**< prev. difference */ | 77 Float11 dq[6]; /**< prev. difference */ |
78 int a[2]; /**< second order predictor coeffs */ | 78 int a[2]; /**< second order predictor coeffs */ |
79 int b[6]; /**< sixth order predictor coeffs */ | 79 int b[6]; /**< sixth order predictor coeffs */ |
89 int se; /**< estimated signal for the next iteration */ | 89 int se; /**< estimated signal for the next iteration */ |
90 int sez; /**< estimated second order prediction */ | 90 int sez; /**< estimated second order prediction */ |
91 int y; /**< quantizer scaling factor for the next iteration */ | 91 int y; /**< quantizer scaling factor for the next iteration */ |
92 } G726Context; | 92 } G726Context; |
93 | 93 |
94 static int quant_tbl16[] = /**< 16kbit/s 2bits per sample */ | 94 static const int quant_tbl16[] = /**< 16kbit/s 2bits per sample */ |
95 { 260, INT_MAX }; | 95 { 260, INT_MAX }; |
96 static int iquant_tbl16[] = | 96 static const int iquant_tbl16[] = |
97 { 116, 365, 365, 116 }; | 97 { 116, 365, 365, 116 }; |
98 static int W_tbl16[] = | 98 static const int W_tbl16[] = |
99 { -22, 439, 439, -22 }; | 99 { -22, 439, 439, -22 }; |
100 static int F_tbl16[] = | 100 static const int F_tbl16[] = |
101 { 0, 7, 7, 0 }; | 101 { 0, 7, 7, 0 }; |
102 | 102 |
103 static int quant_tbl24[] = /**< 24kbit/s 3bits per sample */ | 103 static const int quant_tbl24[] = /**< 24kbit/s 3bits per sample */ |
104 { 7, 217, 330, INT_MAX }; | 104 { 7, 217, 330, INT_MAX }; |
105 static int iquant_tbl24[] = | 105 static const int iquant_tbl24[] = |
106 { INT_MIN, 135, 273, 373, 373, 273, 135, INT_MIN }; | 106 { INT_MIN, 135, 273, 373, 373, 273, 135, INT_MIN }; |
107 static int W_tbl24[] = | 107 static const int W_tbl24[] = |
108 { -4, 30, 137, 582, 582, 137, 30, -4 }; | 108 { -4, 30, 137, 582, 582, 137, 30, -4 }; |
109 static int F_tbl24[] = | 109 static const int F_tbl24[] = |
110 { 0, 1, 2, 7, 7, 2, 1, 0 }; | 110 { 0, 1, 2, 7, 7, 2, 1, 0 }; |
111 | 111 |
112 static int quant_tbl32[] = /**< 32kbit/s 4bits per sample */ | 112 static const int quant_tbl32[] = /**< 32kbit/s 4bits per sample */ |
113 { -125, 79, 177, 245, 299, 348, 399, INT_MAX }; | 113 { -125, 79, 177, 245, 299, 348, 399, INT_MAX }; |
114 static int iquant_tbl32[] = | 114 static const int iquant_tbl32[] = |
115 { INT_MIN, 4, 135, 213, 273, 323, 373, 425, | 115 { INT_MIN, 4, 135, 213, 273, 323, 373, 425, |
116 425, 373, 323, 273, 213, 135, 4, INT_MIN }; | 116 425, 373, 323, 273, 213, 135, 4, INT_MIN }; |
117 static int W_tbl32[] = | 117 static const int W_tbl32[] = |
118 { -12, 18, 41, 64, 112, 198, 355, 1122, | 118 { -12, 18, 41, 64, 112, 198, 355, 1122, |
119 1122, 355, 198, 112, 64, 41, 18, -12}; | 119 1122, 355, 198, 112, 64, 41, 18, -12}; |
120 static int F_tbl32[] = | 120 static const int F_tbl32[] = |
121 { 0, 0, 0, 1, 1, 1, 3, 7, 7, 3, 1, 1, 1, 0, 0, 0 }; | 121 { 0, 0, 0, 1, 1, 1, 3, 7, 7, 3, 1, 1, 1, 0, 0, 0 }; |
122 | 122 |
123 static int quant_tbl40[] = /**< 40kbit/s 5bits per sample */ | 123 static const int quant_tbl40[] = /**< 40kbit/s 5bits per sample */ |
124 { -122, -16, 67, 138, 197, 249, 297, 338, | 124 { -122, -16, 67, 138, 197, 249, 297, 338, |
125 377, 412, 444, 474, 501, 527, 552, INT_MAX }; | 125 377, 412, 444, 474, 501, 527, 552, INT_MAX }; |
126 static int iquant_tbl40[] = | 126 static const int iquant_tbl40[] = |
127 { INT_MIN, -66, 28, 104, 169, 224, 274, 318, | 127 { INT_MIN, -66, 28, 104, 169, 224, 274, 318, |
128 358, 395, 429, 459, 488, 514, 539, 566, | 128 358, 395, 429, 459, 488, 514, 539, 566, |
129 566, 539, 514, 488, 459, 429, 395, 358, | 129 566, 539, 514, 488, 459, 429, 395, 358, |
130 318, 274, 224, 169, 104, 28, -66, INT_MIN }; | 130 318, 274, 224, 169, 104, 28, -66, INT_MIN }; |
131 static int W_tbl40[] = | 131 static const int W_tbl40[] = |
132 { 14, 14, 24, 39, 40, 41, 58, 100, | 132 { 14, 14, 24, 39, 40, 41, 58, 100, |
133 141, 179, 219, 280, 358, 440, 529, 696, | 133 141, 179, 219, 280, 358, 440, 529, 696, |
134 696, 529, 440, 358, 280, 219, 179, 141, | 134 696, 529, 440, 358, 280, 219, 179, 141, |
135 100, 58, 41, 40, 39, 24, 14, 14 }; | 135 100, 58, 41, 40, 39, 24, 14, 14 }; |
136 static int F_tbl40[] = | 136 static const int F_tbl40[] = |
137 { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 6, | 137 { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 6, |
138 6, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; | 138 6, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; |
139 | 139 |
140 static G726Tables G726Tables_pool[] = | 140 static const G726Tables G726Tables_pool[] = |
141 {{ 2, quant_tbl16, iquant_tbl16, W_tbl16, F_tbl16 }, | 141 {{ 2, quant_tbl16, iquant_tbl16, W_tbl16, F_tbl16 }, |
142 { 3, quant_tbl24, iquant_tbl24, W_tbl24, F_tbl24 }, | 142 { 3, quant_tbl24, iquant_tbl24, W_tbl24, F_tbl24 }, |
143 { 4, quant_tbl32, iquant_tbl32, W_tbl32, F_tbl32 }, | 143 { 4, quant_tbl32, iquant_tbl32, W_tbl32, F_tbl32 }, |
144 { 5, quant_tbl40, iquant_tbl40, W_tbl40, F_tbl40 }}; | 144 { 5, quant_tbl40, iquant_tbl40, W_tbl40, F_tbl40 }}; |
145 | 145 |