comparison ra144.c @ 1781:bbb6e7667671 libavcodec

cleanup ugly code (also appearently works around a bug gcc 3.4 which fails compiling it) by (mru at kth dot se (Mns Rullgrd))
author michael
date Wed, 04 Feb 2004 16:03:10 +0000
parents 9a218b289ee0
children 7b13ac4995a9
comparison
equal deleted inserted replaced
1780:cc4c1eb18eec 1781:bbb6e7667671
422 glob->decsp+=n*10; 422 glob->decsp+=n*10;
423 } 423 }
424 424
425 /* Uncompress one block (20 bytes -> 160*2 bytes) */ 425 /* Uncompress one block (20 bytes -> 160*2 bytes) */
426 static int ra144_decode_frame(AVCodecContext * avctx, 426 static int ra144_decode_frame(AVCodecContext * avctx,
427 void *data, int *data_size, 427 void *vdata, int *data_size,
428 uint8_t * buf, int buf_size) 428 uint8_t * buf, int buf_size)
429 { 429 {
430 unsigned int a,b,c; 430 unsigned int a,b,c;
431 long s; 431 long s;
432 signed short *shptr; 432 signed short *shptr;
433 unsigned int *lptr,*temp; 433 unsigned int *lptr,*temp;
434 const short **dptr; 434 const short **dptr;
435 void *datao; 435 int16_t *datao;
436 int16_t *data = vdata;
436 Real144_internal *glob=avctx->priv_data; 437 Real144_internal *glob=avctx->priv_data;
437 438
438 datao = data; 439 datao = data;
439 unpack_input(buf,glob->unpacked); 440 unpack_input(buf,glob->unpacked);
440 441
478 glob->resetflag=0; 479 glob->resetflag=0;
479 480
480 shptr=glob->output_buffer; 481 shptr=glob->output_buffer;
481 while (shptr<glob->output_buffer+BLOCKSIZE) { 482 while (shptr<glob->output_buffer+BLOCKSIZE) {
482 s=*(shptr++)<<2; 483 s=*(shptr++)<<2;
483 *((int16_t *)data)=s; 484 *data=s;
484 if (s>32767) *((int16_t *)data)=32767; 485 if (s>32767) *data=32767;
485 if (s<-32767) *((int16_t *)data)=-32768; 486 if (s<-32767) *data=-32768;
486 ((int16_t *)data)++; 487 data++;
487 } 488 }
488 b+=30; 489 b+=30;
489 } 490 }
490 491
491 glob->oldval=glob->val; 492 glob->oldval=glob->val;
493 glob->swapbuf1alt=glob->swapbuf1; 494 glob->swapbuf1alt=glob->swapbuf1;
494 glob->swapbuf1=temp; 495 glob->swapbuf1=temp;
495 temp=glob->swapbuf2alt; 496 temp=glob->swapbuf2alt;
496 glob->swapbuf2alt=glob->swapbuf2; 497 glob->swapbuf2alt=glob->swapbuf2;
497 glob->swapbuf2=temp; 498 glob->swapbuf2=temp;
498 *data_size=data-datao; 499 *data_size=(data-datao)*sizeof(*data);
499 return 20; 500 return 20;
500 } 501 }
501 502
502 503
503 AVCodec ra_144_decoder = 504 AVCodec ra_144_decoder =