32 #define BITSTREAM_READER_LE
38 #define EA_PREAMBLE_SIZE 8
39 #define kVGT_TAG MKTAG('k', 'V', 'G', 'T')
84 if (src_end - src < 3)
89 while (size > 0 && src < src_end) {
97 size1 = (((src[0] & 31) + 1) << 2);
101 offset = ((src[0] & 0x10) << 12) +
AV_RB16(&src[1]) + 1;
102 size2 = ((src[0] & 0xC) << 6) + src[3] + 5;
106 size1 = ((src[1] & 0xC0) >> 6);
107 offset = (
AV_RB16(&src[1]) & 0x3FFF) + 1;
108 size2 = (src[0] & 0x3F) + 4;
112 offset = ((src[0] & 0x60) << 3) + src[1] + 1;
113 size2 = ((src[0] & 0x1C) >> 2) + 3;
119 if (size1 > src_end - src)
124 run =
FFMIN(size1, dst_end - dst);
125 memcpy(dst, src, run);
131 if (dst - dst_start < offset)
134 run =
FFMIN(size2, dst_end - dst);
152 int num_blocks_packed;
159 if(buf_end - buf < 12)
163 num_blocks_raw =
AV_RL16(&buf[2]);
164 num_blocks_packed =
AV_RL16(&buf[4]);
165 vector_bits =
AV_RL16(&buf[6]);
170 "Invalid value for motion vector bits: %d\n", vector_bits);
192 mvbits = (num_mvs * 2 * 10 + 31) & ~31;
194 if (buf_end - buf < (mvbits>>3) + 16*num_blocks_raw + 8*num_blocks_packed)
198 for (i = 0; i <
num_mvs; i++) {
206 buf += num_blocks_raw * 16;
210 for (i = 0; i < num_blocks_packed; i++) {
212 for (j = 0; j < 4; j++)
214 for (j = 0; j < 16; j++)
225 unsigned int vector =
get_bits(&gb, vector_bits);
229 if (vector < num_mvs) {
243 if (offset < num_blocks_raw)
244 src = blocks_raw + 16*
offset;
245 else if (offset - num_blocks_raw < num_blocks_packed)
252 for (j = 0; j < 4; j++)
253 for (i = 0; i < 4; i++)
254 frame->
data[0][(y * 4 + j) * frame->
linesize[0] + (x * 4 + i)] =
255 src[j * src_stride + i];
262 void *
data,
int *got_frame,
266 int buf_size = avpkt->
size;
268 const uint8_t *buf_end = buf + buf_size;
280 if(buf_end - buf < 12) {
295 for(i = 0; i < pal_count && i <
AVPALETTE_COUNT && buf_end - buf >= 3; i++) {
322 for (y = 0; y < s->
height; y++)