52 int buf_size = avpkt->
size;
58 int i, j, x,
y,
stride,
ret, vect_w = 3, vect_h = 3;
71 if (buf_end - buf < 4)
79 uint32_t *pal = (uint32_t *) p->
data[1];
82 last = first +
AV_RL16(buf + 2);
83 if (first >= 256 || last > 256 || buf_end - buf < 4 + 4 + 3 * (last - first))
86 for (i=first; i<last; i++, buf+=3) {
87 pal[i] = (buf[0] << 18) | (buf[1] << 10) | (buf[2] << 2);
88 pal[i] |= 0xFFU << 24 | (pal[i] >> 6) & 0x30303;
122 if (buf_end - buf < 256 * vect_w * vect_h)
124 table = buf + (256 * vect_w * vect_h);
126 int map_size = ((318 / vect_w + 7) / 8) * (198 / vect_h);
127 if (buf_end - table < map_size)
133 for (y=0; y<198; y+=vect_h) {
134 for (x=0; x<318; x+=vect_w) {
136 if (buf_end - table < 1)
138 vect = &buf[*table++ * (vect_w * vect_h)];
139 for (j=0; j<vect_w; j++) {
140 out[(y + 0) * stride + x + j] = vect[(0 * vect_w) + j];
141 out[(y + 1) * stride + x + j] = vect[(1 * vect_w) + j];
143 out[(y + 2) * stride + x + j] =
144 vect[(2 * vect_w) + j];