comparison mace.c @ 7818:09291b115695 libavcodec

Cosmetics: rename vars s/ctx/chd/
author vitor
date Sun, 07 Sep 2008 20:18:18 +0000
parents 0f3b77f8789d
children a16406b793a5
comparison
equal deleted inserted replaced
7817:0f3b77f8789d 7818:09291b115695
160 return -32767; 160 return -32767;
161 else 161 else
162 return n; 162 return n;
163 } 163 }
164 164
165 static void chomp3(ChannelData *ctx, int16_t *output, uint8_t val, 165 static void chomp3(ChannelData *chd, int16_t *output, uint8_t val,
166 const uint16_t tab1[], 166 const uint16_t tab1[],
167 const int16_t *tab2, int tab2_stride, 167 const int16_t *tab2, int tab2_stride,
168 uint32_t numChannels) 168 uint32_t numChannels)
169 { 169 {
170 int16_t current; 170 int16_t current;
171 171
172 if (val < tab2_stride) 172 if (val < tab2_stride)
173 current = tab2[((ctx->index & 0x7f0) >> 4)*tab2_stride + val]; 173 current = tab2[((chd->index & 0x7f0) >> 4)*tab2_stride + val];
174 else 174 else
175 current = - 1 - tab2[((ctx->index & 0x7f0) >> 4)*tab2_stride + 2*tab2_stride-val-1]; 175 current = - 1 - tab2[((chd->index & 0x7f0) >> 4)*tab2_stride + 2*tab2_stride-val-1];
176 176
177 current = mace_broken_clip_int16(current + ctx->lev); 177 current = mace_broken_clip_int16(current + chd->lev);
178 178
179 ctx->lev = current - (current >> 3); 179 chd->lev = current - (current >> 3);
180 *output = QT_8S_2_16S(current); 180 *output = QT_8S_2_16S(current);
181 if (( ctx->index += tab1[val]-(ctx->index >> 5) ) < 0) 181 if (( chd->index += tab1[val]-(chd->index >> 5) ) < 0)
182 ctx->index = 0; 182 chd->index = 0;
183 } 183 }
184 184
185 static void chomp6(ChannelData *ctx, int16_t *output, uint8_t val, 185 static void chomp6(ChannelData *chd, int16_t *output, uint8_t val,
186 const uint16_t tab1[], 186 const uint16_t tab1[],
187 const int16_t *tab2, int tab2_stride, 187 const int16_t *tab2, int tab2_stride,
188 uint32_t numChannels) 188 uint32_t numChannels)
189 { 189 {
190 int16_t current; 190 int16_t current;
191 191
192 if (val < tab2_stride) 192 if (val < tab2_stride)
193 current = tab2[((ctx->index & 0x7f0) >> 4)*tab2_stride + val]; 193 current = tab2[((chd->index & 0x7f0) >> 4)*tab2_stride + val];
194 else 194 else
195 current = - 1 - tab2[((ctx->index & 0x7f0) >> 4)*tab2_stride + 2*tab2_stride-val-1]; 195 current = - 1 - tab2[((chd->index & 0x7f0) >> 4)*tab2_stride + 2*tab2_stride-val-1];
196 196
197 if ((ctx->previous ^ current) >= 0) { 197 if ((chd->previous ^ current) >= 0) {
198 ctx->factor = FFMIN(ctx->factor + 506, 32767); 198 chd->factor = FFMIN(chd->factor + 506, 32767);
199 } else { 199 } else {
200 if (ctx->factor - 314 < -32768) 200 if (chd->factor - 314 < -32768)
201 ctx->factor = -32767; 201 chd->factor = -32767;
202 else 202 else
203 ctx->factor -= 314; 203 chd->factor -= 314;
204 } 204 }
205 205
206 current = mace_broken_clip_int16(current + ctx->level); 206 current = mace_broken_clip_int16(current + chd->level);
207 207
208 ctx->level = ((current*ctx->factor) >> 15); 208 chd->level = ((current*chd->factor) >> 15);
209 current >>= 1; 209 current >>= 1;
210 210
211 output[0] = QT_8S_2_16S(ctx->previous + ctx->prev2 - 211 output[0] = QT_8S_2_16S(chd->previous + chd->prev2 -
212 ((ctx->prev2-current) >> 2)); 212 ((chd->prev2-current) >> 2));
213 output[numChannels] = QT_8S_2_16S(ctx->previous + current + 213 output[numChannels] = QT_8S_2_16S(chd->previous + current +
214 ((ctx->prev2-current) >> 2)); 214 ((chd->prev2-current) >> 2));
215 ctx->prev2 = ctx->previous; 215 chd->prev2 = chd->previous;
216 ctx->previous = current; 216 chd->previous = current;
217 217
218 if ((ctx->index += tab1[val] - (ctx->index >> 5)) < 0) 218 if ((chd->index += tab1[val] - (chd->index >> 5)) < 0)
219 ctx->index = 0; 219 chd->index = 0;
220 } 220 }
221 221
222 static av_cold int mace_decode_init(AVCodecContext * avctx) 222 static av_cold int mace_decode_init(AVCodecContext * avctx)
223 { 223 {
224 if (avctx->channels > 2) 224 if (avctx->channels > 2)