32 #define BLOCK_HEIGHT 112u
33 #define BLOCK_WIDTH 84u
57 unsigned repeat = 0,
first = 1, opcode = 0;
66 if (bytestream2_peek_byte(gb) > 17) {
67 len = bytestream2_get_byte(gb) - 17;
70 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
73 opcode = bytestream2_peek_byte(gb);
77 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
80 opcode = bytestream2_peek_byte(gb);
83 pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049;
88 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
89 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
90 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
96 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
99 opcode = bytestream2_peek_byte(gb);
110 opcode = bytestream2_peek_byte(gb);
114 if (!bytestream2_peek_byte(gb)) {
120 opcode += bytestream2_get_byte(gb) + 15;
122 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
123 for (
i = opcode - 1;
i > 0; --
i)
124 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
125 opcode = bytestream2_peek_byte(gb);
128 pos = - (opcode >> 2) - 4 * bytestream2_get_byte(gb) - 2049;
133 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
134 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
135 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
141 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
144 opcode = bytestream2_peek_byte(gb);
151 if (opcode >= 0x40) {
153 pos = - ((opcode >> 2) & 7) - 1 - 8 * bytestream2_get_byte(gb);
154 len = (opcode >> 5) - 1;
159 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
160 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
162 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
172 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
175 opcode = bytestream2_peek_byte(gb);
178 }
else if (opcode < 0x20) {
184 if (!bytestream2_peek_byte(gb)) {
190 len += bytestream2_get_byte(gb) + 31;
192 i = bytestream2_get_le16(gb);
193 pos = - (
i >> 2) - 1;
199 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
200 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
202 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
206 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
208 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
215 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
218 opcode = bytestream2_peek_byte(gb);
223 pos = -(opcode >> 2) - 1 - 4 * bytestream2_get_byte(gb);
228 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
229 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
235 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
238 opcode = bytestream2_peek_byte(gb);
244 if (!bytestream2_peek_byte(gb)) {
250 len += bytestream2_get_byte(gb) + 7;
252 i = bytestream2_get_le16(gb);
263 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
264 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
266 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
270 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
272 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
280 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
283 opcode = bytestream2_peek_byte(gb);
292 unsigned opcode = 0,
len;
301 opcode = bytestream2_get_byte(gb);
302 high = opcode >= 0x20;
307 opcode = bytestream2_get_byte(gb);
323 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
324 bytestream2_put_le32(pb, bytestream2_get_le32(gb));
331 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
338 opcode = bytestream2_get_byte(gb);
343 pos = -(opcode | 32 * bytestream2_get_byte(gb)) - 1;
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(&gbc));
348 bytestream2_put_byte(pb, bytestream2_get_byte(gb));
355 pos = (-((opcode & 0x1F) | 32 * bytestream2_get_byte(gb)) - 1);
357 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
358 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
359 len = (opcode >> 5) - 1;
361 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
367 if (!bytestream2_peek_byte(gb)) {
373 len += bytestream2_get_byte(gb) + 31;
375 pos = -bytestream2_get_byte(gb);
381 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
382 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
383 bytestream2_put_byte(pb, bytestream2_get_byte(&gbc));
385 bytestream2_put_le32(pb, bytestream2_get_le32(&gbc));
389 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)