31 #define BLOCK_HEIGHT 112u
32 #define BLOCK_WIDTH 84u
56 unsigned repeat = 0,
first = 1, opcode = 0;
65 if (bytestream2_peek_byte(gb) > 17) {
66 len = bytestream2_get_byte(gb) - 17;
69 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
72 opcode = bytestream2_peek_byte(gb);
76 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
79 opcode = bytestream2_peek_byte(gb);
82 pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049;
87 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
88 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
89 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
95 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
98 opcode = bytestream2_peek_byte(gb);
108 opcode = bytestream2_peek_byte(gb);
112 if (!bytestream2_peek_byte(gb)) {
118 opcode += bytestream2_get_byte(gb) + 15;
120 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
121 for (
i = opcode - 1;
i > 0; --
i)
122 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
123 opcode = bytestream2_peek_byte(gb);
126 pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049;
131 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
132 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
133 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
139 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
142 opcode = bytestream2_peek_byte(gb);
149 if (opcode >= 0x40) {
151 pos = - ((opcode >> 2) & 7) - 1 - 8 * bytestream2_get_byte(gb);
152 len = (opcode >> 5) - 1;
157 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
158 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
160 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
170 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
173 opcode = bytestream2_peek_byte(gb);
176 }
else if (opcode < 0x20) {
182 if (!bytestream2_peek_byte(gb)) {
188 len += bytestream2_get_byte(gb) + 31;
190 i = bytestream2_get_le16(gb);
191 pos = - (
i >> 2) - 1;
197 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
198 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
200 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
204 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
206 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
213 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
216 opcode = bytestream2_peek_byte(gb);
221 pos = -(opcode >> 2) - 1 - 4 * bytestream2_get_byte(gb);
226 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
227 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
233 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
236 opcode = bytestream2_peek_byte(gb);
242 if (!bytestream2_peek_byte(gb)) {
248 len += bytestream2_get_byte(gb) + 7;
250 i = bytestream2_get_le16(gb);
261 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
262 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
264 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
268 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
270 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
278 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
281 opcode = bytestream2_peek_byte(gb);
290 unsigned opcode = 0,
len;
299 opcode = bytestream2_get_byte(gb);
300 high = opcode >= 0x20;
305 opcode = bytestream2_get_byte(gb);
321 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
322 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
329 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
336 opcode = bytestream2_get_byte(gb);
341 pos = -(opcode | 32 * bytestream2_get_byte(gb)) - 1;
343 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
344 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
345 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
346 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
353 pos = (-((opcode & 0x1F) | 32 * bytestream2_get_byte(gb)) - 1);
355 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
356 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
357 len = (opcode >> 5) - 1;
359 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
365 if (!bytestream2_peek_byte(gb)) {
371 len += bytestream2_get_byte(gb) + 31;
373 pos = -bytestream2_get_byte(gb);
379 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
380 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
381 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
383 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
387 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
410 key_frame = !!bytestream2_get_le16(gb);
417 type = bytestream2_get_le16(gb);
418 size = bytestream2_get_le16(gb);
425 }
else if (
type == 2){
443 src +=
s->stride * 4;
448 unsigned block, nb_blocks;
450 uint8_t *ssrc, *ddst;
457 nb_blocks = bytestream2_get_le16(gb);
458 if (nb_blocks >
s->nb_blocks)
463 type = bytestream2_get_le16(gb);
468 offset = bytestream2_get_le16(gb);
472 size = bytestream2_get_le16(gb);
479 }
else if (
type == 2){
492 src = (
const uint32_t *)
s->pbuffer;
493 dst = (uint32_t *)
s->buffer;
495 for (
block = 0, y = 0; y <
s->yb; y++) {
496 int block_h =
s->blocks[
block].h;
497 uint32_t *
rect = dst;
499 for (x = 0; x <
s->xb; x++) {
500 int block_w =
s->blocks[
block].w;
503 block_h =
s->blocks[
block].h;
504 if (
s->blocks[
block].xor) {
505 for (k = 0; k < block_h; k++) {
506 uint32_t *column = dst;
507 for (l = 0; l < block_w; l++)
509 dst = &column[
s->stride];
515 dst = &
rect[block_h *
s->stride];
527 memcpy(ddst, ssrc, avctx->
width *
s->bpp);
529 ssrc +=
s->stride * 4;
582 s->nb_blocks =
s->xb *
s->yb;
585 s->blocks =
av_calloc(
s->nb_blocks,
sizeof(*
s->blocks));
589 for (
i = 0;
i <
s->yb;
i++) {
590 for (j = 0; j <
s->xb; j++) {
591 if (
i != (
s->yb - 1) || j != (
s->xb - 1)) {
592 if (
i ==
s->yb - 1) {
596 }
else if (j ==
s->xb - 1) {
619 if (!
s->buffer || !
s->pbuffer)