38 #define CBPLO_VLC_BITS 6
39 #define CBPHI_VLC_BITS 6
40 #define BLKTYPE_VLC_BITS 9
41 #define BLOCK_VLC_BITS 12
67 static const uint8_t
cbplo[][2] = {
68 { 0,-6 }, { 0x01, 6 }, { 0x02, 6 }, { 0x03, 6 }, { 0x00, 4 },
69 { 0x01, 3 }, { 0x02, 3 }, { 0x03, 3 }, { 0x00, 1 },
73 4, 5, 5, 4, 5, 4, 6, 4, 5, 6, 4, 4, 4, 4, 4, 2
77 3, 5, 4, 9, 3, 7, 2, 11, 2, 3, 5, 10, 4, 8, 6, 3
81 { 0,-8 }, { 0x34, 9 }, { 0,-9 }, { 0x14, 9 }, { 0,-9 },
82 { 0x23, 8 }, { 0x13, 8 }, { 0x32, 8 }, { 0x33, 7 }, { 0x22, 7 },
83 { 0x12, 7 }, { 0x21, 7 }, { 0x11, 7 }, { 0x04, 6 }, { 0x30, 6 },
84 { 0x03, 5 }, { 0x20, 4 }, { 0x10, 4 }, { 0x02, 3 }, { 0x01, 3 },
89 0, 0x4082, 0x4003, 0x000B, 0x000A, 0x4E01, 0x4D81, 0x4D01, 0x4C81,
90 0x0482, 0x0402, 0x0382, 0x0302, 0x0282, 0x0183, 0x0103, 0x0084, 0x000C,
91 0x0085, 0x0B81, 0x0C01, 0x4E81, 0x4F01, 0x4F81, 0x5001, 0x0086, 0x0104,
92 0x0203, 0x0283, 0x0303, 0x0502, 0x0C81, 0x0D01, 0x5081, 0x5101, 0x5181,
93 0x5201, 0x5281, 0x5301, 0x5381, 0x5401, 0x0000, 0x0009, 0x0008, 0x4C01,
94 0x4B81, 0x4B01, 0x4A81, 0x4A01, 0x4981, 0x4901, 0x4881, 0x4002, 0x0B01,
95 0x0A81, 0x0A01, 0x0981, 0x0901, 0x0881, 0x0801, 0x0781, 0x0202, 0x0182,
96 0x0007, 0x0006, 0x4801, 0x4781, 0x4701, 0x4681, 0x4601, 0x4581, 0x4501,
97 0x4481, 0x0701, 0x0681, 0x0102, 0x0083, 0x0005, 0x4401, 0x4381, 0x4301,
98 0x4281, 0x0601, 0x0581, 0x0501, 0x0004, 0x4201, 0x4181, 0x4101, 0x4081,
99 0x0481, 0x0401, 0x0381, 0x0301, 0x0082, 0x0003, 0x0281, 0x0201, 0x0181,
100 0x4001, 0x0001, 0x0081, 0x0101, 0x0002,
104 -9, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11,
105 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
106 12, 12, 12, 7, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
107 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
108 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6,
109 6, 5, 5, 5, 4, 2, 3, 4, 4,
132 const uint8_t *idct_permutation =
s->idsp.idct_permutation;
133 int i, last,
len, factor2;
146 factor2 =
value & 0x7F;
147 last = (
value >> 14) & 1;
160 if (
s->hi == 2 && flag2 &&
block < 4) {
162 s->block[
block][idct_permutation[0]] *= 2;
163 s->block[
block][idct_permutation[1]] *= 2;
164 s->block[
block][idct_permutation[8]] *= 2;
165 s->block[
block][idct_permutation[16]] *= 2;
172 unsigned cbp,
int flag,
int offset,
unsigned flag2)
175 const uint8_t *idct_permutation =
s->idsp.idct_permutation;
178 memset(
s->block, 0,
sizeof(
s->block));
180 for (
i = 0;
i < 6;
i++) {
188 s->block[
i][idct_permutation[0]] = x;
191 if (cbp & (1 << (5 -
i))) {
211 s->factor =
s->lo * 2;
221 for (y = 0; y < avctx->
height; y += 16) {
222 for (x = 0; x < avctx->
width; x += 16) {
237 s->idsp.idct_put(
frame->data[0] + y *
frame->linesize[0] + x,
238 frame->linesize[0],
s->block[0]);
239 s->idsp.idct_put(
frame->data[0] + y *
frame->linesize[0] + x + 8,
240 frame->linesize[0],
s->block[1]);
241 s->idsp.idct_put(
frame->data[0] + (y + 8) *
frame->linesize[0] + x,
242 frame->linesize[0],
s->block[2]);
243 s->idsp.idct_put(
frame->data[0] + (y + 8) *
frame->linesize[0] + x + 8,
244 frame->linesize[0],
s->block[3]);
245 s->idsp.idct_put(
frame->data[1] + (y >> 1) *
frame->linesize[1] + (x >> 1),
246 frame->linesize[1],
s->block[4]);
247 s->idsp.idct_put(
frame->data[2] + (y >> 1) *
frame->linesize[2] + (x >> 1),
248 frame->linesize[2],
s->block[5]);
266 s->factor =
s->lo * 2;
276 for (y = 0; y < avctx->
height; y += 16) {
277 for (x = 0; x < avctx->
width; x += 16) {
278 int reverse, intra_block,
value;
279 unsigned cbplo, flag2 = 0;
287 prev->
data[1] + (y >> 1) * prev->
linesize[1] + (x >> 1),
290 prev->
data[2] + (y >> 1) * prev->
linesize[2] + (x >> 1),
299 intra_block =
value & 0x07;
300 reverse = intra_block == 3;
314 s->idsp.idct_put(
frame->data[0] + y *
frame->linesize[0] + x,
315 frame->linesize[0],
s->block[0]);
316 s->idsp.idct_put(
frame->data[0] + y *
frame->linesize[0] + x + 8,
317 frame->linesize[0],
s->block[1]);
318 s->idsp.idct_put(
frame->data[0] + (y + 8) *
frame->linesize[0] + x,
319 frame->linesize[0],
s->block[2]);
320 s->idsp.idct_put(
frame->data[0] + (y + 8) *
frame->linesize[0] + x + 8,
321 frame->linesize[0],
s->block[3]);
322 s->idsp.idct_put(
frame->data[1] + (y >> 1) *
frame->linesize[1] + (x >> 1),
323 frame->linesize[1],
s->block[4]);
324 s->idsp.idct_put(
frame->data[2] + (y >> 1) *
frame->linesize[2] + (x >> 1),
325 frame->linesize[2],
s->block[5]);
337 prev->
data[1] + (y >> 1) * prev->
linesize[1] + (x >> 1),
340 prev->
data[2] + (y >> 1) * prev->
linesize[2] + (x >> 1),
343 s->idsp.idct_add(
frame->data[0] + y *
frame->linesize[0] + x,
344 frame->linesize[0],
s->block[0]);
345 s->idsp.idct_add(
frame->data[0] + y *
frame->linesize[0] + x + 8,
346 frame->linesize[0],
s->block[1]);
347 s->idsp.idct_add(
frame->data[0] + (y + 8) *
frame->linesize[0] + x,
348 frame->linesize[0],
s->block[2]);
349 s->idsp.idct_add(
frame->data[0] + (y + 8) *
frame->linesize[0] + x + 8,
350 frame->linesize[0],
s->block[3]);
351 s->idsp.idct_add(
frame->data[1] + (y >> 1) *
frame->linesize[1] + (x >> 1),
352 frame->linesize[1],
s->block[4]);
353 s->idsp.idct_add(
frame->data[2] + (y >> 1) *
frame->linesize[2] + (x >> 1),
354 frame->linesize[2],
s->block[5]);
371 if (avpkt->
size <= 32)
379 s->bdsp.bswap_buf((uint32_t *)
s->bitstream,
380 (uint32_t *)avpkt->
data,
381 (avpkt->
size + 3) >> 2);
392 scaled = avpkt->
data[8];
471 if (!
s->prev_frame->data[0]) {
534 s->bitstream_size = 0;