Mercurial > libavcodec.hg
comparison ra144.c @ 6841:10975a82f615 libavcodec
Remove unneeded var from context
author | vitor |
---|---|
date | Wed, 21 May 2008 19:23:15 +0000 |
parents | d17cae06e958 |
children | 61ff2f1d36bb |
comparison
equal
deleted
inserted
replaced
6840:7cb16b1c580f | 6841:10975a82f615 |
---|---|
33 typedef struct { | 33 typedef struct { |
34 unsigned int oldval; | 34 unsigned int oldval; |
35 unsigned int gbuf1[4]; | 35 unsigned int gbuf1[4]; |
36 unsigned short gbuf2[120]; | 36 unsigned short gbuf2[120]; |
37 unsigned int *decptr; /* decoder ptr */ | 37 unsigned int *decptr; /* decoder ptr */ |
38 signed short *decsp; | |
39 | 38 |
40 /* the swapped buffers */ | 39 /* the swapped buffers */ |
41 unsigned int swapbuffers[4][10]; | 40 unsigned int swapbuffers[4][10]; |
42 unsigned int *swapbuf1; | 41 unsigned int *swapbuf1; |
43 unsigned int *swapbuf2; | 42 unsigned int *swapbuf2; |
44 unsigned int *swapbuf1alt; | 43 unsigned int *swapbuf1alt; |
45 unsigned int *swapbuf2alt; | 44 unsigned int *swapbuf2alt; |
46 | 45 |
47 unsigned int buffer[5]; | 46 unsigned int buffer[5]; |
48 unsigned short int buffer_2[148]; | 47 unsigned short int buffer_2[148]; |
49 | |
50 unsigned short *sptr; | |
51 } Real144_internal; | 48 } Real144_internal; |
52 | 49 |
53 static int ra144_decode_init(AVCodecContext * avctx) | 50 static int ra144_decode_init(AVCodecContext * avctx) |
54 { | 51 { |
55 Real144_internal *glob = avctx->priv_data; | 52 Real144_internal *glob = avctx->priv_data; |
250 | 247 |
251 final(gsp, block, output_buffer, glob->buffer, BLOCKSIZE); | 248 final(gsp, block, output_buffer, glob->buffer, BLOCKSIZE); |
252 } | 249 } |
253 | 250 |
254 static void dec1(Real144_internal *glob, const int *data, const int *inp, | 251 static void dec1(Real144_internal *glob, const int *data, const int *inp, |
255 int n, int f) | 252 int n, int f, int block_idx) |
256 { | 253 { |
257 short *ptr,*end; | 254 short *ptr,*end; |
258 | 255 signed short *decsp = glob->gbuf2 + 30*block_idx; |
259 *(glob->decptr++) = rms(data, f); | 256 |
260 end = (ptr = glob->decsp) + (n * 10); | 257 *(glob->decptr++) = rms(data, f); |
258 end = (ptr = decsp) + (n * 10); | |
261 | 259 |
262 while (ptr < end) | 260 while (ptr < end) |
263 *(ptr++) = *(inp++); | 261 *(ptr++) = *(inp++); |
264 } | 262 } |
265 | 263 |
329 unsigned const int *ptr1,*ptr2; | 327 unsigned const int *ptr1,*ptr2; |
330 int work[10]; | 328 int work[10]; |
331 int a,b; | 329 int a,b; |
332 int x; | 330 int x; |
333 int result; | 331 int result; |
332 signed short *decsp = glob->gbuf2 + 30*l; | |
333 unsigned short *sptr = decsp; | |
334 | 334 |
335 if(l + 1 < NBLOCKS / 2) | 335 if(l + 1 < NBLOCKS / 2) |
336 a = NBLOCKS - (l + 1); | 336 a = NBLOCKS - (l + 1); |
337 else | 337 else |
338 a = l + 1; | 338 a = l + 1; |
339 | 339 |
340 b = NBLOCKS - a; | 340 b = NBLOCKS - a; |
341 | 341 |
342 if (l == 0) { | 342 if (l == 0) { |
343 glob->decsp = glob->sptr = glob->gbuf2; | |
344 glob->decptr = glob->gbuf1; | 343 glob->decptr = glob->gbuf1; |
345 } | 344 } |
346 ptr1 = inp; | 345 ptr1 = inp; |
347 ptr2 = inp2; | 346 ptr2 = inp2; |
348 | 347 |
349 for (x=0; x<10*n; x++) | 348 for (x=0; x<10*n; x++) |
350 *(glob->sptr++) = (a * (*ptr1++) + b * (*ptr2++)) >> 2; | 349 *(sptr++) = (a * (*ptr1++) + b * (*ptr2++)) >> 2; |
351 | 350 |
352 result = eq(glob->decsp, work); | 351 result = eq(decsp, work); |
353 | 352 |
354 if (result == 1) { | 353 if (result == 1) { |
355 dec1(glob, data, inp, n, f); | 354 dec1(glob, data, inp, n, f, l); |
356 } else { | 355 } else { |
357 *(glob->decptr++) = rms(work, f); | 356 *(glob->decptr++) = rms(work, f); |
358 } | 357 } |
359 glob->decsp += n * 10; | |
360 } | 358 } |
361 | 359 |
362 /* Uncompress one block (20 bytes -> 160*2 bytes) */ | 360 /* Uncompress one block (20 bytes -> 160*2 bytes) */ |
363 static int ra144_decode_frame(AVCodecContext * avctx, | 361 static int ra144_decode_frame(AVCodecContext * avctx, |
364 void *vdata, int *data_size, | 362 void *vdata, int *data_size, |
393 dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, a, glob->swapbuf2alt, 1); | 391 dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, a, glob->swapbuf2alt, 1); |
394 } else { | 392 } else { |
395 dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, a, glob->swapbuf2, 1); | 393 dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, a, glob->swapbuf2, 1); |
396 } | 394 } |
397 dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, val, glob->swapbuf2alt, 2); | 395 dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, val, glob->swapbuf2alt, 2); |
398 dec1(glob, glob->swapbuf1, glob->swapbuf2, 3, val); | 396 dec1(glob, glob->swapbuf1, glob->swapbuf2, 3, val, 3); |
399 | 397 |
400 /* do output */ | 398 /* do output */ |
401 for (b=0, c=0; c<4; c++) { | 399 for (b=0, c=0; c<4; c++) { |
402 unsigned int gval = glob->gbuf1[c]; | 400 unsigned int gval = glob->gbuf1[c]; |
403 unsigned short *gsp = glob->gbuf2 + b; | 401 unsigned short *gsp = glob->gbuf2 + b; |