32 #define BITSTREAM_READER_LE
37 #define EA_PREAMBLE_SIZE 8
38 #define kVGT_TAG MKTAG('k', 'V', 'G', 'T')
80 if (src_end - src < 3)
85 while (size > 0 && src < src_end) {
93 size1 = (((src[0] & 31) + 1) << 2);
97 offset = ((src[0] & 0x10) << 12) +
AV_RB16(&src[1]) + 1;
98 size2 = ((src[0] & 0xC) << 6) + src[3] + 5;
102 size1 = ((src[1] & 0xC0) >> 6);
103 offset = (
AV_RB16(&src[1]) & 0x3FFF) + 1;
104 size2 = (src[0] & 0x3F) + 4;
108 offset = ((src[0] & 0x60) << 3) + src[1] + 1;
109 size2 = ((src[0] & 0x1C) >> 2) + 3;
115 if (size1 > src_end - src)
120 run =
FFMIN(size1, dst_end - dst);
121 memcpy(dst, src, run);
127 if (dst - dst_start < offset)
130 run =
FFMIN(size2, dst_end - dst);
148 int num_blocks_packed;
155 if(buf_end - buf < 12)
159 num_blocks_raw =
AV_RL16(&buf[2]);
160 num_blocks_packed =
AV_RL16(&buf[4]);
161 vector_bits =
AV_RL16(&buf[6]);
166 "Invalid value for motion vector bits: %d\n", vector_bits);
182 mvbits = (num_mvs * 2 * 10 + 31) & ~31;
184 if (buf_end - buf < (mvbits>>3) + 16*num_blocks_raw + 8*num_blocks_packed)
188 for (i = 0; i <
num_mvs; i++) {
196 buf += num_blocks_raw * 16;
200 for (i = 0; i < num_blocks_packed; i++) {
202 for (j = 0; j < 4; j++)
204 for (j = 0; j < 16; j++)
215 unsigned int vector =
get_bits(&gb, vector_bits);
219 if (vector < num_mvs) {
233 if (offset < num_blocks_raw)
234 src = blocks_raw + 16*
offset;
235 else if (offset - num_blocks_raw < num_blocks_packed)
242 for (j = 0; j < 4; j++)
243 for (i = 0; i < 4; i++)
245 src[j * src_stride + i];
261 void *
data,
int *got_frame,
265 int buf_size = avpkt->
size;
267 const uint8_t *buf_end = buf + buf_size;
278 if(buf_end - buf < 12) {
293 for(i = 0; i < pal_count && i <
AVPALETTE_COUNT && buf_end - buf >= 3; i++) {