comparison 4xm.c @ 5540:9b20d2534c97 libavcodec

use bytestream_get_le*() this also fixes a big endian bug
author michael
date Mon, 13 Aug 2007 13:20:16 +0000
parents 44e140e3cd6a
children c94931b2f2e5
comparison
equal deleted inserted replaced
5539:1c67999f81c8 5540:9b20d2534c97
25 */ 25 */
26 26
27 #include "avcodec.h" 27 #include "avcodec.h"
28 #include "dsputil.h" 28 #include "dsputil.h"
29 #include "mpegvideo.h" 29 #include "mpegvideo.h"
30 #include "bytestream.h"
30 31
31 //#undef NDEBUG 32 //#undef NDEBUG
32 //#include <assert.h> 33 //#include <assert.h>
33 34
34 #define BLOCK_TYPE_VLC_BITS 5 35 #define BLOCK_TYPE_VLC_BITS 5
595 for(y=0; y<height; y+=16){ 596 for(y=0; y<height; y+=16){
596 for(x=0; x<width; x+=16){ 597 for(x=0; x<width; x+=16){
597 unsigned int color[4], bits; 598 unsigned int color[4], bits;
598 memset(color, 0, sizeof(color)); 599 memset(color, 0, sizeof(color));
599 //warning following is purely guessed ... 600 //warning following is purely guessed ...
600 color[0]= AV_RN16(buf); buf+=2; //FIXME use bytestream 601 color[0]= bytestream_get_le16(&buf);
601 color[1]= AV_RN16(buf); buf+=2; 602 color[1]= bytestream_get_le16(&buf);
602 603
603 if(color[0]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 1\n"); 604 if(color[0]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 1\n");
604 if(color[1]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 2\n"); 605 if(color[1]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 2\n");
605 606
606 color[2]= mix(color[0], color[1]); 607 color[2]= mix(color[0], color[1]);
607 color[3]= mix(color[1], color[0]); 608 color[3]= mix(color[1], color[0]);
608 609
609 bits= AV_RL32(buf); buf+= 4; 610 bits= bytestream_get_le32(&buf);
610 for(y2=0; y2<16; y2++){ 611 for(y2=0; y2<16; y2++){
611 for(x2=0; x2<16; x2++){ 612 for(x2=0; x2<16; x2++){
612 int index= 2*(x2>>2) + 8*(y2>>2); 613 int index= 2*(x2>>2) + 8*(y2>>2);
613 dst[y2*stride+x2]= color[(bits>>index)&3]; 614 dst[y2*stride+x2]= color[(bits>>index)&3];
614 } 615 }