comparison ra144.c @ 6842:61ff2f1d36bb libavcodec

Make gbuf2 a table instead of an array
author vitor
date Wed, 21 May 2008 19:24:17 +0000
parents 10975a82f615
children 20a7e808dd82
comparison
equal deleted inserted replaced
6841:10975a82f615 6842:61ff2f1d36bb
31 31
32 /* internal globals */ 32 /* internal globals */
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[4][30];
37 unsigned int *decptr; /* decoder ptr */ 37 unsigned int *decptr; /* decoder ptr */
38 38
39 /* the swapped buffers */ 39 /* the swapped buffers */
40 unsigned int swapbuffers[4][10]; 40 unsigned int swapbuffers[4][10];
41 unsigned int *swapbuf1; 41 unsigned int *swapbuf1;
250 250
251 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,
252 int n, int f, int block_idx) 252 int n, int f, int block_idx)
253 { 253 {
254 short *ptr,*end; 254 short *ptr,*end;
255 signed short *decsp = glob->gbuf2 + 30*block_idx; 255 signed short *decsp = glob->gbuf2[block_idx];
256 256
257 *(glob->decptr++) = rms(data, f); 257 *(glob->decptr++) = rms(data, f);
258 end = (ptr = decsp) + (n * 10); 258 end = (ptr = decsp) + (n * 10);
259 259
260 while (ptr < end) 260 while (ptr < end)
327 unsigned const int *ptr1,*ptr2; 327 unsigned const int *ptr1,*ptr2;
328 int work[10]; 328 int work[10];
329 int a,b; 329 int a,b;
330 int x; 330 int x;
331 int result; 331 int result;
332 signed short *decsp = glob->gbuf2 + 30*l; 332 signed short *decsp = glob->gbuf2[l];
333 unsigned short *sptr = decsp; 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
361 static int ra144_decode_frame(AVCodecContext * avctx, 361 static int ra144_decode_frame(AVCodecContext * avctx,
362 void *vdata, int *data_size, 362 void *vdata, int *data_size,
363 const uint8_t * buf, int buf_size) 363 const uint8_t * buf, int buf_size)
364 { 364 {
365 static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; 365 static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};
366 unsigned int a, b, c; 366 unsigned int a, c;
367 int i; 367 int i;
368 signed short *shptr; 368 signed short *shptr;
369 int16_t *data = vdata; 369 int16_t *data = vdata;
370 unsigned int val; 370 unsigned int val;
371 371
394 } 394 }
395 dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, val, glob->swapbuf2alt, 2); 395 dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, val, glob->swapbuf2alt, 2);
396 dec1(glob, glob->swapbuf1, glob->swapbuf2, 3, val, 3); 396 dec1(glob, glob->swapbuf1, glob->swapbuf2, 3, val, 3);
397 397
398 /* do output */ 398 /* do output */
399 for (b=0, c=0; c<4; c++) { 399 for (c=0; c<4; c++) {
400 unsigned int gval = glob->gbuf1[c]; 400 unsigned int gval = glob->gbuf1[c];
401 unsigned short *gsp = glob->gbuf2 + b; 401 unsigned short *gsp = glob->gbuf2[c];
402 signed short output_buffer[40]; 402 signed short output_buffer[40];
403 403
404 do_output_subblock(glob, gsp, gval, output_buffer, &gb); 404 do_output_subblock(glob, gsp, gval, output_buffer, &gb);
405 405
406 shptr = output_buffer; 406 shptr = output_buffer;
407 while (shptr < output_buffer + BLOCKSIZE) 407 while (shptr < output_buffer + BLOCKSIZE)
408 *data++ = av_clip_int16(*(shptr++) << 2); 408 *data++ = av_clip_int16(*(shptr++) << 2);
409 b += 30;
410 } 409 }
411 410
412 glob->oldval = val; 411 glob->oldval = val;
413 412
414 FFSWAP(unsigned int *, glob->swapbuf1alt, glob->swapbuf1); 413 FFSWAP(unsigned int *, glob->swapbuf1alt, glob->swapbuf1);