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);
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));
411 key_frame = !!bytestream2_get_le16(gb);
418 type = bytestream2_get_le16(gb);
419 size = bytestream2_get_le16(gb);
426 }
else if (
type == 2){
444 src +=
s->stride * 4;
449 unsigned block, nb_blocks;
451 uint8_t *ssrc, *ddst;
458 nb_blocks = bytestream2_get_le16(gb);
459 if (nb_blocks >
s->nb_blocks)
464 type = bytestream2_get_le16(gb);
469 offset = bytestream2_get_le16(gb);
473 size = bytestream2_get_le16(gb);
480 }
else if (
type == 2){
493 src = (
const uint32_t *)
s->pbuffer;
494 dst = (uint32_t *)
s->buffer;
496 for (
block = 0, y = 0; y <
s->yb; y++) {
497 int block_h =
s->blocks[
block].h;
500 for (x = 0; x <
s->xb; x++) {
501 int block_w =
s->blocks[
block].w;
504 block_h =
s->blocks[
block].h;
505 if (
s->blocks[
block].xor) {
506 for (k = 0; k < block_h; k++) {
507 uint32_t *column =
dst;
508 for (l = 0; l < block_w; l++)
510 dst = &column[
s->stride];
528 memcpy(ddst, ssrc, avctx->
width *
s->bpp);
529 ddst -=
frame->linesize[0];
530 ssrc +=
s->stride * 4;
583 s->nb_blocks =
s->xb *
s->yb;
586 s->blocks =
av_calloc(
s->nb_blocks,
sizeof(*
s->blocks));
590 for (
i = 0;
i <
s->yb;
i++) {
591 for (j = 0; j <
s->xb; j++) {
592 if (
i != (
s->yb - 1) || j != (
s->xb - 1)) {
593 if (
i ==
s->yb - 1) {
597 }
else if (j ==
s->xb - 1) {
620 if (!
s->buffer || !
s->pbuffer)