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);
193 mvbits = (num_mvs * 2 * 10 + 31) & ~31;
195 if (buf_end - buf < (mvbits>>3) + 16*num_blocks_raw + 8*num_blocks_packed)
199 for (i = 0; i <
num_mvs; i++) {
207 buf += num_blocks_raw * 16;
211 for (i = 0; i < num_blocks_packed; i++) {
213 for (j = 0; j < 4; j++)
215 for (j = 0; j < 16; j++)
226 unsigned int vector =
get_bits(&gb, vector_bits);
230 if (vector < num_mvs) {
244 if (offset < num_blocks_raw)
245 src = blocks_raw + 16*
offset;
246 else if (offset - num_blocks_raw < num_blocks_packed)
253 for (j = 0; j < 4; j++)
254 for (i = 0; i < 4; i++)
255 frame->
data[0][(y * 4 + j) * frame->
linesize[0] + (x * 4 + i)] =
256 src[j * src_stride + i];
263 void *
data,
int *got_frame,
267 int buf_size = avpkt->
size;
269 const uint8_t *buf_end = buf + buf_size;
281 if(buf_end - buf < 12) {
297 for(i = 0; i < pal_count && i <
AVPALETTE_COUNT && buf_end - buf >= 3; i++) {
321 for (y = 0; y < s->
height; y++)