44 if (*x + run >= s->
width) {
45 int n = s->
width - *x;
46 memset(d + *x, value, n);
53 memset(d + *x, value, run);
61 int *x,
int *
y,
int *plane,
int bits_per_plane)
64 int shift = *plane * bits_per_plane;
65 int mask = ((1 << bits_per_plane) - 1) <<
shift;
70 for (j = 8-bits_per_plane; j >= 0; j -= bits_per_plane) {
72 d[*x] |= (value >> j) & mask;
80 value <<= bits_per_plane;
81 mask <<= bits_per_plane;
95 [3] = { 0, 11, 13, 15 },
96 [4] = { 0, 10, 12, 14 },
97 [5] = { 0, 11, 12, 15 },
109 void *
data,
int *got_frame,
114 int bits_per_plane, bpp, etype, esize, npal, pos_after_pal;
115 int i, x,
y, plane, tmp, val;
122 if (bytestream2_get_le16u(&s->
g) != 0x1234)
125 s->
width = bytestream2_get_le16u(&s->
g);
126 s->
height = bytestream2_get_le16u(&s->
g);
128 tmp = bytestream2_get_byteu(&s->
g);
129 bits_per_plane = tmp & 0xF;
132 if (bits_per_plane > 8 || bpp < 1 || bpp > 32) {
137 if (bytestream2_peek_byte(&s->
g) == 0xFF || bpp == 1 || bpp == 4 || bpp == 8) {
139 etype = bytestream2_get_le16(&s->
g);
140 esize = bytestream2_get_le16(&s->
g);
168 if (etype == 1 && esize > 1 && bytestream2_peek_byte(&s->
g) < 6) {
169 int idx = bytestream2_get_byte(&s->
g);
171 for (i = 0; i < npal; i++)
173 }
else if (etype == 2) {
174 npal =
FFMIN(esize, 16);
175 for (i = 0; i < npal; i++) {
176 int pal_idx = bytestream2_get_byte(&s->
g);
179 }
else if (etype == 3) {
180 npal =
FFMIN(esize, 16);
181 for (i = 0; i < npal; i++) {
182 int pal_idx = bytestream2_get_byte(&s->
g);
185 }
else if (etype == 4 || etype == 5) {
186 npal =
FFMIN(esize / 3, 256);
187 for (i = 0; i < npal; i++) {
188 palette[i] = bytestream2_get_be24(&s->
g) << 2;
189 palette[i] |= 0xFFU << 24 | palette[i] >> 6 & 0x30303;
194 palette[0] = 0xFF000000;
195 palette[1] = 0xFFFFFFFF;
196 }
else if (bpp == 2) {
198 for (i = 0; i < npal; i++)
212 if (bytestream2_get_le16(&s->
g)) {
216 int stop_size, marker,
t1,
t2;
219 t2 = bytestream2_get_le16(&s->
g);
220 stop_size = t1 -
FFMIN(t1, t2);
223 marker = bytestream2_get_byte(&s->
g);
225 while (plane < s->nb_planes && y >= 0 &&
228 val = bytestream2_get_byte(&s->
g);
230 run = bytestream2_get_byte(&s->
g);
232 run = bytestream2_get_le16(&s->
g);
233 val = bytestream2_get_byte(&s->
g);
238 if (bits_per_plane == 8) {
241 picmemset(s, val, run, &x, &y, &plane, bits_per_plane);
246 if (x < avctx->
width && y >= 0) {
247 int run = (y + 1) * avctx->
width - x;
248 if (bits_per_plane == 8)
251 picmemset(s, val, run / (8 / bits_per_plane), &x, &y, &plane, bits_per_plane);