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);
109 opcode = bytestream2_peek_byte(gb);
113 if (!bytestream2_peek_byte(gb)) {
119 opcode += bytestream2_get_byte(gb) + 15;
121 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
122 for (
i = opcode - 1;
i > 0; --
i)
123 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
124 opcode = bytestream2_peek_byte(gb);
127 pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049;
132 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
133 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
134 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
140 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
143 opcode = bytestream2_peek_byte(gb);
150 if (opcode >= 0x40) {
152 pos = - ((opcode >> 2) & 7) - 1 - 8 * bytestream2_get_byte(gb);
153 len = (opcode >> 5) - 1;
158 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
159 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
161 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
171 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
174 opcode = bytestream2_peek_byte(gb);
177 }
else if (opcode < 0x20) {
183 if (!bytestream2_peek_byte(gb)) {
189 len += bytestream2_get_byte(gb) + 31;
191 i = bytestream2_get_le16(gb);
192 pos = - (
i >> 2) - 1;
198 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
199 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
201 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
205 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
207 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
214 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
217 opcode = bytestream2_peek_byte(gb);
222 pos = -(opcode >> 2) - 1 - 4 * bytestream2_get_byte(gb);
227 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
228 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
234 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
237 opcode = bytestream2_peek_byte(gb);
243 if (!bytestream2_peek_byte(gb)) {
249 len += bytestream2_get_byte(gb) + 7;
251 i = bytestream2_get_le16(gb);
262 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
263 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
265 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
269 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
271 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
279 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
282 opcode = bytestream2_peek_byte(gb);
291 unsigned opcode = 0,
len;
300 opcode = bytestream2_get_byte(gb);
301 high = opcode >= 0x20;
306 opcode = bytestream2_get_byte(gb);
322 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
323 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
330 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
337 opcode = bytestream2_get_byte(gb);
342 pos = -(opcode | 32 * bytestream2_get_byte(gb)) - 1;
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(&gbc));
347 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
354 pos = (-((opcode & 0x1F) | 32 * bytestream2_get_byte(gb)) - 1);
356 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
357 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
358 len = (opcode >> 5) - 1;
360 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
366 if (!bytestream2_peek_byte(gb)) {
372 len += bytestream2_get_byte(gb) + 31;
374 pos = -bytestream2_get_byte(gb);
380 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
381 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
382 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
384 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
388 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
414 frame->key_frame = !!bytestream2_get_le16(gb);
417 if (
frame->key_frame) {
422 type = bytestream2_get_le16(gb);
423 size = bytestream2_get_le16(gb);
430 }
else if (
type == 2){
441 dst -=
frame->linesize[0];
442 src +=
s->stride * 4;
447 unsigned block, nb_blocks;
449 uint8_t *ssrc, *ddst;
456 nb_blocks = bytestream2_get_le16(gb);
457 if (nb_blocks >
s->nb_blocks)
462 type = bytestream2_get_le16(gb);
467 offset = bytestream2_get_le16(gb);
471 size = bytestream2_get_le16(gb);
478 }
else if (
type == 2){
491 src = (
const uint32_t *)
s->pbuffer;
492 dst = (uint32_t *)
s->buffer;
494 for (
block = 0, y = 0; y <
s->yb; y++) {
495 int block_h =
s->blocks[
block].h;
496 uint32_t *
rect = dst;
498 for (x = 0; x <
s->xb; x++) {
499 int block_w =
s->blocks[
block].w;
502 block_h =
s->blocks[
block].h;
503 if (
s->blocks[
block].xor) {
504 for (k = 0; k < block_h; k++) {
505 uint32_t *column = dst;
506 for (l = 0; l < block_w; l++)
508 dst = &column[
s->stride];
514 dst = &
rect[block_h *
s->stride];
520 memcpy(ddst, ssrc, avctx->
width *
s->bpp);
521 ddst -=
frame->linesize[0];
522 ssrc +=
s->stride * 4;
575 s->nb_blocks =
s->xb *
s->yb;
578 s->blocks =
av_calloc(
s->nb_blocks,
sizeof(*
s->blocks));
582 for (
i = 0;
i <
s->yb;
i++) {
583 for (j = 0; j <
s->xb; j++) {
584 if (
i != (
s->yb - 1) || j != (
s->xb - 1)) {
585 if (
i ==
s->yb - 1) {
589 }
else if (j ==
s->xb - 1) {
612 if (!
s->buffer || !
s->pbuffer)