32 #define BITSTREAM_READER_LE
37 #define EA_PREAMBLE_SIZE 8
38 #define kVGT_TAG MKTAG('k', 'V', 'G', 'T')
68 unsigned char *dst_end = dst + width*
height;
70 unsigned char *dst_start =
dst;
77 if (src_end - src < 3)
82 while(size>0 && src<src_end) {
86 if ( src[0] & 0x80 ) {
88 if ( src[0] & 0x20 ) {
90 size1 = (((src[0] & 31) + 1) << 2);
94 offset = ((src[0] & 0x10) << 12) +
AV_RB16(&src[1]) + 1;
95 size2 = ((src[0] & 0xC) << 6) + src[3] + 5;
99 size1 = ( ( src[1] & 0xC0) >> 6 );
100 offset = (
AV_RB16(&src[1]) & 0x3FFF) + 1;
101 size2 = (src[0] & 0x3F) + 4;
105 offset = ((src[0] & 0x60) << 3) + src[1] + 1;
106 size2 = ((src[0] & 0x1C) >> 2) + 3;
112 if (size1>src_end-src)
117 run =
FFMIN(size1, dst_end-dst);
118 memcpy(dst, src, run);
124 if (dst-dst_start<offset)
127 run =
FFMIN(size2, dst_end-dst);
143 int num_blocks_packed;
148 const unsigned char *blocks_raw;
150 if(buf_end - buf < 12)
154 num_blocks_raw =
AV_RL16(&buf[2]);
155 num_blocks_packed =
AV_RL16(&buf[4]);
156 vector_bits =
AV_RL16(&buf[6]);
161 "Invalid value for motion vector bits: %d\n", vector_bits);
177 mvbits = (num_mvs*2*10+31) & ~31;
179 if (buf_end - buf < (mvbits>>3)+16*num_blocks_raw+8*num_blocks_packed)
191 buf += num_blocks_raw*16;
195 for (i=0; i<num_blocks_packed; i++) {
210 unsigned int vector =
get_bits(&gb, vector_bits);
211 const unsigned char *src;
214 if (vector < num_mvs) {
228 if (offset<num_blocks_raw)
229 src = blocks_raw + 16*
offset;
230 else if (offset-num_blocks_raw<num_blocks_packed)
240 src[j*src_stride + i];
256 void *
data,
int *got_frame,
260 int buf_size = avpkt->
size;
262 const uint8_t *buf_end = buf + buf_size;
273 if(buf_end - buf < 12) {
288 for(i=0; i<pal_count && i<
AVPALETTE_COUNT && buf_end - buf >= 3; i++) {