Mercurial > libavcodec.hg
comparison 4xm.c @ 6264:8f6749f5cd53 libavcodec
Replace get32() by AV_RL32().
author | michael |
---|---|
date | Fri, 01 Feb 2008 14:57:49 +0000 |
parents | ddfd8aed3a3f |
children | c32be43b52b2 |
comparison
equal
deleted
inserted
replaced
6263:ddfd8aed3a3f | 6264:8f6749f5cd53 |
---|---|
341 dst[stride] = le2me_16(*f->wordstream++); | 341 dst[stride] = le2me_16(*f->wordstream++); |
342 } | 342 } |
343 } | 343 } |
344 } | 344 } |
345 | 345 |
346 static int get32(void *p){ | |
347 return le2me_32(*(uint32_t*)p); | |
348 } | |
349 | |
350 static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length){ | 346 static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length){ |
351 int x, y; | 347 int x, y; |
352 const int width= f->avctx->width; | 348 const int width= f->avctx->width; |
353 const int height= f->avctx->height; | 349 const int height= f->avctx->height; |
354 uint16_t *src= (uint16_t*)f->last_picture.data[0]; | 350 uint16_t *src= (uint16_t*)f->last_picture.data[0]; |
356 const int stride= f->current_picture.linesize[0]>>1; | 352 const int stride= f->current_picture.linesize[0]>>1; |
357 unsigned int bitstream_size, bytestream_size, wordstream_size, extra; | 353 unsigned int bitstream_size, bytestream_size, wordstream_size, extra; |
358 | 354 |
359 if(f->version>1){ | 355 if(f->version>1){ |
360 extra=20; | 356 extra=20; |
361 bitstream_size= get32(buf+8); | 357 bitstream_size= AV_RL32(buf+8); |
362 wordstream_size= get32(buf+12); | 358 wordstream_size= AV_RL32(buf+12); |
363 bytestream_size= get32(buf+16); | 359 bytestream_size= AV_RL32(buf+16); |
364 }else{ | 360 }else{ |
365 extra=0; | 361 extra=0; |
366 bitstream_size = AV_RL16(buf-4); | 362 bitstream_size = AV_RL16(buf-4); |
367 wordstream_size= AV_RL16(buf-2); | 363 wordstream_size= AV_RL16(buf-2); |
368 bytestream_size= FFMAX(length - bitstream_size - wordstream_size, 0); | 364 bytestream_size= FFMAX(length - bitstream_size - wordstream_size, 0); |
636 int x, y; | 632 int x, y; |
637 const int width= f->avctx->width; | 633 const int width= f->avctx->width; |
638 const int height= f->avctx->height; | 634 const int height= f->avctx->height; |
639 uint16_t *dst= (uint16_t*)f->current_picture.data[0]; | 635 uint16_t *dst= (uint16_t*)f->current_picture.data[0]; |
640 const int stride= f->current_picture.linesize[0]>>1; | 636 const int stride= f->current_picture.linesize[0]>>1; |
641 const unsigned int bitstream_size= get32(buf); | 637 const unsigned int bitstream_size= AV_RL32(buf); |
642 const int token_count av_unused = get32(buf + bitstream_size + 8); | 638 const int token_count av_unused = AV_RL32(buf + bitstream_size + 8); |
643 unsigned int prestream_size= 4*get32(buf + bitstream_size + 4); | 639 unsigned int prestream_size= 4*AV_RL32(buf + bitstream_size + 4); |
644 const uint8_t *prestream= buf + bitstream_size + 12; | 640 const uint8_t *prestream= buf + bitstream_size + 12; |
645 | 641 |
646 if(prestream_size + bitstream_size + 12 != length | 642 if(prestream_size + bitstream_size + 12 != length |
647 || bitstream_size > (1<<26) | 643 || bitstream_size > (1<<26) |
648 || prestream_size > (1<<26)){ | 644 || prestream_size > (1<<26)){ |
685 FourXContext * const f = avctx->priv_data; | 681 FourXContext * const f = avctx->priv_data; |
686 AVFrame *picture = data; | 682 AVFrame *picture = data; |
687 AVFrame *p, temp; | 683 AVFrame *p, temp; |
688 int i, frame_4cc, frame_size; | 684 int i, frame_4cc, frame_size; |
689 | 685 |
690 frame_4cc= get32(buf); | 686 frame_4cc= AV_RL32(buf); |
691 if(buf_size != get32(buf+4)+8 || buf_size < 20){ | 687 if(buf_size != AV_RL32(buf+4)+8 || buf_size < 20){ |
692 av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d\n", buf_size, get32(buf+4)); | 688 av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d\n", buf_size, AV_RL32(buf+4)); |
693 } | 689 } |
694 | 690 |
695 if(frame_4cc == ff_get_fourcc("cfrm")){ | 691 if(frame_4cc == ff_get_fourcc("cfrm")){ |
696 int free_index=-1; | 692 int free_index=-1; |
697 const int data_size= buf_size - 20; | 693 const int data_size= buf_size - 20; |
698 const int id= get32(buf+12); | 694 const int id= AV_RL32(buf+12); |
699 const int whole_size= get32(buf+16); | 695 const int whole_size= AV_RL32(buf+16); |
700 CFrameBuffer *cfrm; | 696 CFrameBuffer *cfrm; |
701 | 697 |
702 for(i=0; i<CFRAME_BUFFER_COUNT; i++){ | 698 for(i=0; i<CFRAME_BUFFER_COUNT; i++){ |
703 if(f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number) | 699 if(f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number) |
704 av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n", f->cfrm[i].id); | 700 av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n", f->cfrm[i].id); |