80 switch (bpp * 2 + be) {
83 return bytestream2_get_byte(gb);
85 return bytestream2_get_le16(gb);
87 return bytestream2_get_be16(gb);
89 return bytestream2_get_le32(gb);
91 return bytestream2_get_be32(gb);
99 const int bpp = c->
bpp2;
101 uint16_t *dst16 = (uint16_t *)c->
curbits;
102 uint32_t *dst32 = (uint32_t *)c->
curbits;
104 for (j = 0; j < c->
cur_h; j++) {
105 for (i = 0; i < c->
cur_w; i++) {
118 for (j = 0; j < c->
cur_h; j++) {
119 for (i = 0; i < c->
cur_w; i++) {
152 if ((w < 1) || (h < 1))
158 for (j = 0; j < h; j++) {
159 for (i = 0; i < w; i++)
160 dst[i] = (dst[i] & cd[i]) ^ msk[i];
165 }
else if (c->
bpp2 == 2) {
166 uint16_t *cd = (uint16_t*)c->
curbits, *msk = (uint16_t*)c->
curmask;
168 for (j = 0; j < h; j++) {
169 dst2 = (uint16_t*)dst;
170 for (i = 0; i < w; i++)
171 dst2[i] = (dst2[i] & cd[i]) ^ msk[i];
176 }
else if (c->
bpp2 == 4) {
177 uint32_t *cd = (uint32_t*)c->
curbits, *msk = (uint32_t*)c->
curmask;
179 for (j = 0; j < h; j++) {
180 dst2 = (uint32_t*)dst;
181 for (i = 0; i < w; i++)
182 dst2[i] = (dst2[i] & cd[i]) ^ msk[i];
192 int w,
int h,
int color,
196 dst += dx * bpp + dy *
stride;
198 for (j = 0; j < h; j++) {
199 memset(dst, color, w);
202 }
else if (bpp == 2) {
204 for (j = 0; j < h; j++) {
205 dst2 = (uint16_t*)dst;
206 for (i = 0; i < w; i++)
210 }
else if (bpp == 4) {
212 for (j = 0; j < h; j++) {
213 dst2 = (uint32_t*)dst;
214 for (i = 0; i < w; i++)
226 for (j = 0; j < h; j++) {
227 for (i = 0; i < w; i++) {
234 ((uint16_t*)dst)[i] = p;
237 ((uint32_t*)dst)[i] = p;
249 int bg = 0, fg = 0, rects,
color,
flags, xy, wh;
250 const int bpp = c->
bpp2;
252 int bw = 16, bh = 16;
254 for (j = 0; j < h; j += 16) {
259 for (i = 0; i < w; i += 16, dst2 += 16 * bpp) {
266 flags = bytestream2_get_byte(gb);
280 rects = bytestream2_get_byte(gb);
281 color = !!(flags &
HT_CLR);
283 paint_rect(dst2, 0, 0, bw, bh, bg, bpp, stride);
289 for (k = 0; k < rects; k++) {
292 xy = bytestream2_get_byte(gb);
293 wh = bytestream2_get_byte(gb);
294 if ( (xy >> 4) + (wh >> 4) + 1 > w - i
295 || (xy & 0xF) + (wh & 0xF)+1 > h - j) {
300 (wh>>4)+1, (wh & 0xF)+1, fg, bpp, stride);
323 int buf_size = avpkt->
size;
327 int dx, dy, w, h,
depth, enc, chunks,
res, size_left,
ret;
356 if ((w > 0) && (h > 0)) {
358 for (i = 0; i < h; i++) {
366 chunks = bytestream2_get_be16(gb);
372 dx = bytestream2_get_be16(gb);
373 dy = bytestream2_get_be16(gb);
374 w = bytestream2_get_be16(gb);
375 h = bytestream2_get_be16(gb);
376 enc = bytestream2_get_be32(gb);
381 if (w*(int64_t)h*c->
bpp2 > INT_MAX/2 - 2) {
385 if (size_left < 2 + w * h * c->bpp2 * 2) {
387 "Premature end of data! (need %i got %i)\n",
388 2 + w * h * c->
bpp2 * 2, size_left);
398 "Cursor hot spot is not in image: "
399 "%ix%i of %ix%i cursor size\n",
433 depth = bytestream2_get_byte(gb);
434 if (depth != c->
bpp) {
436 "Depth mismatch. Container %i bpp, "
437 "Frame data: %i bpp\n",
444 "Invalid header: bigendian flag = %i\n", c->
bigendian);
456 "Incorrect frame size: %ix%i+%ix%i of %ix%i\n",
460 if (size_left < w * h * c->bpp2) {
462 "Premature end of data! (need %i got %i)\n",
463 w * h * c->
bpp2, size_left);
472 "Incorrect frame size: %ix%i+%ix%i of %ix%i\n",
504 if ((w > 0) && (h > 0)) {
506 for (i = 0; i < h; i++) {