39 #define CBP_VLC_BITS 9
66 12, 12, 15, 19, 25, 34, 40, 48,
67 12, 12, 18, 22, 27, 44, 47, 46,
68 17, 18, 21, 26, 35, 46, 52, 47,
69 18, 20, 24, 28, 40, 61, 59, 51,
70 20, 24, 32, 43, 50, 72, 72, 63,
71 25, 31, 42, 48, 58, 72, 81, 75,
72 38, 46, 54, 61, 71, 84, 88, 85,
73 50, 61, 65, 68, 79, 78, 86, 91,
77 12, 16, 24, 47, 99, 99, 99, 99,
78 16, 21, 26, 66, 99, 99, 99, 99,
79 24, 26, 56, 99, 99, 99, 99, 99,
80 47, 66, 99, 99, 99, 99, 99, 99,
81 99, 99, 99, 99, 99, 99, 99, 99,
82 99, 99, 99, 99, 99, 99, 99, 99,
83 99, 99, 99, 99, 99, 99, 99, 99,
84 99, 99, 99, 99, 99, 99, 99, 99,
88 0, 1, 8, 9, 16, 2, 3, 10,
89 17, 24, 32, 25, 18, 11, 4, 5,
90 12, 19, 26, 33, 40, 48, 41, 34,
91 27, 20, 13, 6, 7, 14, 21, 28,
92 35, 42, 49, 56, 57, 50, 43, 36,
93 29, 22, 15, 23, 30, 37, 44, 51,
94 58, 59, 52, 45, 38, 31, 39, 46,
95 53, 60, 61, 54, 47, 55, 62, 63,
102 for (
int i = 0;
i < 64;
i++) {
114 const unsigned t4 =
t0 +
t2;
115 const unsigned t5 =
t0 -
t2;
116 const unsigned t6 =
t1 +
t3;
117 const unsigned t7 =
t1 -
t3;
122 const unsigned tC =
t8 + tA;
123 const unsigned tD = (
int)((tB +
t9) * 473
U) >> 8;
124 const unsigned tE = (((
int)(
t9 * -669
U) >> 8) - tC) + tD;
125 const unsigned tF = ((
int)((tA -
t8) * 362
U) >> 8) - tE;
126 const unsigned t10 = (((
int)(tB * 277
U) >> 8) - tD) + tF;
140 for (
int i = 0;
i < 8;
i++) {
160 for (
int i = 0;
i < 8;
i++) {
162 for (
int j = 0; j < 8; j++)
170 const uint8_t *
src,
int in_linesize,
int *
block)
172 for (
int i = 0;
i < 8;
i++) {
192 for (
int i = 0;
i < 8;
i++) {
194 for (
int j = 0; j < 8; j++)
206 const unsigned int t2 = (
int)(
t1 * 473
U) >> 8;
207 const unsigned int t3 =
t2 -
t1;
208 const unsigned int t4 = ((
int)(
t1 * 362
U) >> 8) -
t3;
209 const unsigned int t5 = (((
int)(
t1 * 277
U) >> 8) -
t2) +
t4;
223 for (
int i = 0;
i < 2;
i++) {
224 if ((
block[0x08 +
i]) == 0) {
237 for (
int i = 0;
i < 8;
i++) {
239 for (
int j = 0; j < 8; j++)
243 for (
int j = 0; j < 8; j++)
252 const uint8_t *
src,
int in_linesize,
255 for (
int i = 0;
i < 2;
i++) {
256 if ((
block[0x08 +
i]) == 0) {
269 for (
int i = 0;
i < 8;
i++) {
271 for (
int j = 0; j < 8; j++)
275 for (
int j = 0; j < 8; j++)
285 const uint8_t *
src,
int in_linesize,
288 for (
int i = 0;
i < 8;
i++) {
289 for (
int j = 0; j < 8; j++)
298 int *
block,
int *pfill,
299 uint8_t *dst,
int linesize)
306 s->bdsp.fill_block_tab[1](dst, 128, linesize, 8);
311 block[0] = ((
int)((
unsigned)pfill[0] * qtab[0]) >> 5) + 128;
312 s->bdsp.fill_block_tab[1](dst,
block[0], linesize, 8);
318 block[0] = (unsigned)pfill[0] * qtab[0];
327 block[0] = (unsigned)pfill[0] * qtab[0];
328 for (
int i = 1;
i < 64;
i++)
339 int *
block,
int *pfill,
340 uint8_t *dst,
int linesize,
341 const uint8_t *
src,
int in_linesize)
352 block[0] = (
int)((
unsigned)pfill[0] * qtab[0]) >> 5;
359 block[0] = (unsigned)pfill[0] * qtab[0];
368 block[0] = (unsigned)pfill[0] * qtab[0];
369 for (
int i = 1;
i < 64;
i++)
380 memset(coeffs, 0, nb_codes *
sizeof(*coeffs));
382 for (
int i = 0;
i < nb_codes;) {
388 if (x < (1 <<
value) / 2) {
389 x = (1 << (
value - 1)) + (x & ((1 <<
value) - 1 >> 1));
391 x = -(1 << (
value - 1)) - (x & ((1 <<
value) - 1 >> 1));
418 linesize[0] =
frame->linesize[0];
419 linesize[1] =
frame->linesize[0];
420 linesize[2] =
frame->linesize[0];
421 linesize[3] =
frame->linesize[0];
422 linesize[4] =
frame->linesize[1];
423 linesize[5] =
frame->linesize[2];
425 for (
int y = 0; y < avctx->
height; y += 16) {
427 int pfill[3][1] = { {0} };
439 for (
int x = 0; x < avctx->
width; x += 16) {
440 dst[0] =
frame->data[0] + linesize[0] * y + x;
441 dst[1] =
frame->data[0] + linesize[0] * y + x + 8;
442 dst[2] =
frame->data[0] + linesize[0] * (y + 8) + x;
443 dst[3] =
frame->data[0] + linesize[0] * (y + 8) + x + 8;
444 dst[4] =
frame->data[1] + linesize[4] * (y >> 1) + (x >> 1);
445 dst[5] =
frame->data[2] + linesize[5] * (y >> 1) + (x >> 1);
447 for (
int b = 0;
b < 6;
b++) {
452 pfill[(
b >= 4) + (
b >= 5)],
453 dst[
b], linesize[
b]);
470 const int mask_size = ((avctx->
height >> 4) * (avctx->
width >> 4) * 2 + 7) / 8;
471 uint8_t *dst[6], *
src[6];
484 linesize[0] =
frame->linesize[0];
485 linesize[1] =
frame->linesize[0];
486 linesize[2] =
frame->linesize[0];
487 linesize[3] =
frame->linesize[0];
488 linesize[4] =
frame->linesize[1];
489 linesize[5] =
frame->linesize[2];
508 for (
int y = 0; y < avctx->
height; y += 16) {
510 int pfill[3][1] = { {0} };
531 for (
int x = 0; x < avctx->
width; x += 16) {
542 dst[0] =
frame->data[0] + linesize[0] * y + x;
543 dst[1] =
frame->data[0] + linesize[0] * y + x + 8;
544 dst[2] =
frame->data[0] + linesize[0] * (y + 8) + x;
545 dst[3] =
frame->data[0] + linesize[0] * (y + 8) + x + 8;
546 dst[4] =
frame->data[1] + linesize[4] * (y >> 1) + (x >> 1);
547 dst[5] =
frame->data[2] + linesize[5] * (y >> 1) + (x >> 1);
549 if ((
flags >> (cnt)) & 1) {
560 src[0] = prev->
data[0] + in_linesize[0] * py + px;
561 src[1] = prev->
data[0] + in_linesize[0] * py + px + 8;
562 src[2] = prev->
data[0] + in_linesize[0] * (py + 8) + px;
563 src[3] = prev->
data[0] + in_linesize[0] * (py + 8) + px + 8;
564 src[4] = prev->
data[1] + in_linesize[4] * (py >> 1) + (px >> 1);
565 src[5] = prev->
data[2] + in_linesize[5] * (py >> 1) + (px >> 1);
567 if ((
flags >> (cnt + 4)) & 1) {
568 for (
int b = 0;
b < 6;
b++)
571 for (
int b = 0;
b < 6;
b++) {
576 pfill[(
b >= 4) + (
b >= 5)],
578 src[
b], in_linesize[
b]);
584 for (
int b = 0;
b < 6;
b++) {
589 pfill[(
b >= 4) + (
b >= 5)],
590 dst[
b], linesize[
b]);
618 s->inter_quant =
s->intra_quant +
get_sbits(gb, 8);
627 frame->key_frame =
s->is_inter == 0;
629 if (
frame->key_frame) {
637 if (!
s->prev_frame->data[0]) {
657 2, 2, 3, 3, 3, 4, 5, 6, 7, 8, 9, 9,
700 s->mvectors_size = 0;