38 #define CBP_VLC_BITS 9
65 12, 12, 15, 19, 25, 34, 40, 48,
66 12, 12, 18, 22, 27, 44, 47, 46,
67 17, 18, 21, 26, 35, 46, 52, 47,
68 18, 20, 24, 28, 40, 61, 59, 51,
69 20, 24, 32, 43, 50, 72, 72, 63,
70 25, 31, 42, 48, 58, 72, 81, 75,
71 38, 46, 54, 61, 71, 84, 88, 85,
72 50, 61, 65, 68, 79, 78, 86, 91,
76 12, 16, 24, 47, 99, 99, 99, 99,
77 16, 21, 26, 66, 99, 99, 99, 99,
78 24, 26, 56, 99, 99, 99, 99, 99,
79 47, 66, 99, 99, 99, 99, 99, 99,
80 99, 99, 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,
87 0, 1, 8, 9, 16, 2, 3, 10,
88 17, 24, 32, 25, 18, 11, 4, 5,
89 12, 19, 26, 33, 40, 48, 41, 34,
90 27, 20, 13, 6, 7, 14, 21, 28,
91 35, 42, 49, 56, 57, 50, 43, 36,
92 29, 22, 15, 23, 30, 37, 44, 51,
93 58, 59, 52, 45, 38, 31, 39, 46,
94 53, 60, 61, 54, 47, 55, 62, 63,
101 for (
int i = 0;
i < 64;
i++) {
113 const unsigned t4 =
t0 +
t2;
114 const unsigned t5 =
t0 -
t2;
115 const unsigned t6 =
t1 +
t3;
116 const unsigned t7 =
t1 -
t3;
121 const unsigned tC =
t8 + tA;
122 const unsigned tD = (
int)((tB +
t9) * 473
U) >> 8;
123 const unsigned tE = (((
int)(
t9 * -669
U) >> 8) - tC) + tD;
124 const unsigned tF = ((
int)((tA -
t8) * 362
U) >> 8) - tE;
125 const unsigned t10 = (((
int)(tB * 277
U) >> 8) - tD) + tF;
139 for (
int i = 0;
i < 8;
i++) {
159 for (
int i = 0;
i < 8;
i++) {
161 for (
int j = 0; j < 8; j++)
169 const uint8_t *
src,
int in_linesize,
int *
block)
171 for (
int i = 0;
i < 8;
i++) {
191 for (
int i = 0;
i < 8;
i++) {
193 for (
int j = 0; j < 8; j++)
205 const unsigned int t2 = (
int)(
t1 * 473
U) >> 8;
206 const unsigned int t3 =
t2 -
t1;
207 const unsigned int t4 = ((
int)(
t1 * 362
U) >> 8) -
t3;
208 const unsigned int t5 = (((
int)(
t1 * 277
U) >> 8) -
t2) +
t4;
222 for (
int i = 0;
i < 2;
i++) {
223 if ((
block[0x08 +
i]) == 0) {
236 for (
int i = 0;
i < 8;
i++) {
238 for (
int j = 0; j < 8; j++)
242 for (
int j = 0; j < 8; j++)
251 const uint8_t *
src,
int in_linesize,
254 for (
int i = 0;
i < 2;
i++) {
255 if ((
block[0x08 +
i]) == 0) {
268 for (
int i = 0;
i < 8;
i++) {
270 for (
int j = 0; j < 8; j++)
274 for (
int j = 0; j < 8; j++)
284 const uint8_t *
src,
int in_linesize,
287 for (
int i = 0;
i < 8;
i++) {
288 for (
int j = 0; j < 8; j++)
297 int *
block,
int *pfill,
298 uint8_t *dst,
int linesize)
305 s->bdsp.fill_block_tab[1](dst, 128, linesize, 8);
310 block[0] = ((
int)((
unsigned)pfill[0] * qtab[0]) >> 5) + 128;
311 s->bdsp.fill_block_tab[1](dst,
block[0], linesize, 8);
317 block[0] = (unsigned)pfill[0] * qtab[0];
326 block[0] = (unsigned)pfill[0] * qtab[0];
327 for (
int i = 1;
i < 64;
i++)
338 int *
block,
int *pfill,
339 uint8_t *dst,
int linesize,
340 const uint8_t *
src,
int in_linesize)
351 block[0] = (
int)((
unsigned)pfill[0] * qtab[0]) >> 5;
358 block[0] = (unsigned)pfill[0] * qtab[0];
367 block[0] = (unsigned)pfill[0] * qtab[0];
368 for (
int i = 1;
i < 64;
i++)
379 memset(coeffs, 0, nb_codes *
sizeof(*coeffs));
381 for (
int i = 0;
i < nb_codes;) {
387 if (x < (1 <<
value) / 2) {
388 x = (1 << (
value - 1)) + (x & ((1 <<
value) - 1 >> 1));
390 x = -(1 << (
value - 1)) - (x & ((1 <<
value) - 1 >> 1));
424 for (
int y = 0; y < avctx->
height; y += 16) {
426 int pfill[3][1] = { {0} };
438 for (
int x = 0; x < avctx->
width; x += 16) {
439 dst[0] =
frame->
data[0] + linesize[0] * y + x;
440 dst[1] =
frame->
data[0] + linesize[0] * y + x + 8;
441 dst[2] =
frame->
data[0] + linesize[0] * (y + 8) + x;
442 dst[3] =
frame->
data[0] + linesize[0] * (y + 8) + x + 8;
443 dst[4] =
frame->
data[1] + linesize[4] * (y >> 1) + (x >> 1);
444 dst[5] =
frame->
data[2] + linesize[5] * (y >> 1) + (x >> 1);
446 for (
int b = 0;
b < 6;
b++) {
451 pfill[(
b >= 4) + (
b >= 5)],
452 dst[
b], linesize[
b]);
469 const int mask_size = ((avctx->
height >> 4) * (avctx->
width >> 4) * 2 + 7) / 8;
470 uint8_t *dst[6], *
src[6];
507 for (
int y = 0; y < avctx->
height; y += 16) {
509 int pfill[3][1] = { {0} };
530 for (
int x = 0; x < avctx->
width; x += 16) {
541 dst[0] =
frame->
data[0] + linesize[0] * y + x;
542 dst[1] =
frame->
data[0] + linesize[0] * y + x + 8;
543 dst[2] =
frame->
data[0] + linesize[0] * (y + 8) + x;
544 dst[3] =
frame->
data[0] + linesize[0] * (y + 8) + x + 8;
545 dst[4] =
frame->
data[1] + linesize[4] * (y >> 1) + (x >> 1);
546 dst[5] =
frame->
data[2] + linesize[5] * (y >> 1) + (x >> 1);
548 if ((
flags >> (cnt)) & 1) {
559 src[0] = prev->
data[0] + in_linesize[0] * py + px;
560 src[1] = prev->
data[0] + in_linesize[0] * py + px + 8;
561 src[2] = prev->
data[0] + in_linesize[0] * (py + 8) + px;
562 src[3] = prev->
data[0] + in_linesize[0] * (py + 8) + px + 8;
563 src[4] = prev->
data[1] + in_linesize[4] * (py >> 1) + (px >> 1);
564 src[5] = prev->
data[2] + in_linesize[5] * (py >> 1) + (px >> 1);
566 if ((
flags >> (cnt + 4)) & 1) {
567 for (
int b = 0;
b < 6;
b++)
570 for (
int b = 0;
b < 6;
b++) {
575 pfill[(
b >= 4) + (
b >= 5)],
577 src[
b], in_linesize[
b]);
583 for (
int b = 0;
b < 6;
b++) {
588 pfill[(
b >= 4) + (
b >= 5)],
589 dst[
b], linesize[
b]);
617 s->inter_quant =
s->intra_quant +
get_sbits(gb, 8);
626 if (
s->is_inter == 0) {
635 if (!
s->prev_frame->data[0]) {
655 2, 2, 3, 3, 3, 4, 5, 6, 7, 8, 9, 9,
698 s->mvectors_size = 0;