76 0, 1818, 3622, 4144, 4698, 5234, 5804, 5868, 5900, 5932,
77 5996, 6252, 6316, 6348, 6380, 7674, 8944, 10274, 11668, 12250,
78 14060, 15846, 16372, 16962, 17512, 18148, 18180, 18212, 18244, 18308,
79 18564, 18628, 18660, 18692, 20036, 21314, 22648, 23968, 24614, 26384,
80 28190, 28736, 29366, 29938, 30608, 30640, 30672, 30704, 30768, 31024,
81 31088, 31120, 31184, 32570, 33898, 35236, 36644, 37286, 39020, 40802,
82 41368, 42052, 42692, 43348, 43380, 43412, 43444, 43476, 43604, 43668,
83 43700, 43732, 45100, 46430, 47778, 49160, 49802, 51550, 53340, 53972,
84 54648, 55348, 55994, 56122, 56154, 56186, 56218, 56346, 56410, 56442,
85 56474, 57878, 59290, 60636, 62036, 62682, 64460, 64524, 64588, 64716,
86 64844, 66076, 67466, 67978, 68542, 69064, 69648, 70296, 72010, 72074,
87 72138, 72202, 72330, 73572, 74936, 75454, 76030, 76566, 77176, 77822,
88 79582, 79646, 79678, 79742, 79870, 81180, 82536, 83064, 83672, 84242,
89 84934, 85576, 87384, 87448, 87480, 87544, 87672, 88982, 90340, 90902,
90 91598, 92182, 92846, 93488, 95246, 95278, 95310, 95374, 95502, 96878,
91 98266, 98848, 99542, 100234, 100884, 101524, 103320, 103352, 103384, 103416,
92 103480, 104874, 106222, 106910, 107584, 108258, 108902, 109544, 111366, 111398,
93 111430, 111462, 111494, 112878, 114320, 114988, 115660, 116310, 116950, 117592
110 int counts[17] = {0}, codes[17];
113 int maxbits = 0, realsize = 0;
115 for(i = 0; i <
size; i++){
117 bits2[realsize] = bits[i];
118 syms[realsize] = insyms ? insyms[i] : i;
120 maxbits =
FFMAX(maxbits, bits[i]);
126 for(i = 0; i < 16; i++)
127 codes[i+1] = (codes[i] + counts[i]) << 1;
128 for(i = 0; i < realsize; i++)
129 cw[i] = codes[bits2[i]]++;
147 for(j = 0; j < 2; j++){
151 for(k = 0; k < 4; k++){
155 for(j = 0; j < 4; j++){
163 for(j = 0; j < 4; j++){
166 for(j = 0; j < 2; j++){
187 int pattern, code, cbp=0;
189 static const int cbp_masks[3] = {0x100000, 0x010000, 0x110000};
190 static const int shifts[4] = { 0, 2, 8, 10 };
191 const int *curshift = shifts;
195 pattern = code & 0xF;
200 for(mask = 8;
mask; mask >>= 1, curshift++){
205 for(i = 0; i < 4; i++){
210 cbp |= cbp_masks[2] << i;
225 coef = 22 + ((1 << coef) |
get_bits(gb, coef));
231 *dst = (coef*q + 8) >> 4;
244 decode_coeff(dst+1*4+0, (flags >> 4) & 3, 2, gb, vlc, q);
245 decode_coeff(dst+0*4+1, (flags >> 2) & 3, 2, gb, vlc, q);
247 decode_coeff(dst+0*4+1, (flags >> 4) & 3, 2, gb, vlc, q);
248 decode_coeff(dst+1*4+0, (flags >> 2) & 3, 2, gb, vlc, q);
250 decode_coeff( dst+1*4+1, (flags >> 0) & 3, 2, gb, vlc, q);
263 int q_dc,
int q_ac1,
int q_ac2)
267 decode_coeff(dst+0*4+0, (flags >> 6) , 3, gb, vlc, q_dc);
268 decode_coeff(dst+0*4+1, (flags >> 4) & 3, 2, gb, vlc, q_ac1);
269 decode_coeff(dst+1*4+0, (flags >> 2) & 3, 2, gb, vlc, q_ac1);
270 decode_coeff(dst+1*4+1, (flags >> 0) & 3, 2, gb, vlc, q_ac2);
286 int code, pattern, has_ac = 1;
290 pattern = code & 0x7;
315 return has_ac | pattern;
330 for(i = 0; i < 5; i++)
341 if(mod == 2 && quant < 19) quant += 10;
342 else if(mod && quant < 26) quant += 5;
425 for(i = 0; i < 16; i++)
447 static const uint8_t part_sizes_w[
RV34_MB_TYPES] = { 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2 };
450 static const uint8_t part_sizes_h[
RV34_MB_TYPES] = { 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2 };
466 int A[2] = {0},
B[2],
C[2];
472 mv_pos += (subblock_no & 1) + (subblock_no >> 1)*s->
b8_stride;
488 if(avail[-4] && (avail[-1] || r->
rv30)){
501 mx += r->
dmv[dmv_no][0];
502 my += r->
dmv[dmv_no][1];
511 #define GET_PTS_DIFF(a, b) ((a - b + 8192) & 0x1FFF)
520 return (val * mul + 0x2000) >> 14;
527 int A_avail,
int B_avail,
int C_avail,
530 if(A_avail + B_avail + C_avail != 3){
531 *mx = A[0] + B[0] + C[0];
532 *my = A[1] + B[1] + C[1];
533 if(A_avail + B_avail + C_avail == 2){
551 int A[2] = { 0 },
B[2] = { 0 },
C[2] = { 0 };
552 int has_A = 0, has_B = 0, has_C = 0;
560 A[0] = cur_pic->
motion_val[dir][mv_pos - 1][0];
561 A[1] = cur_pic->
motion_val[dir][mv_pos - 1][1];
581 mx += r->
dmv[dir][0];
582 my += r->
dmv[dir][1];
584 for(j = 0; j < 2; j++){
585 for(i = 0; i < 2; i++){
602 int A[2] = {0},
B[2],
C[2];
619 if(avail[-4] && (avail[-1])){
634 for(j = 0; j < 2; j++){
635 for(i = 0; i < 2; i++){
636 for(k = 0; k < 2; k++){
662 const int xoff,
const int yoff,
int mv_off,
664 const int thirdpel,
int weighted,
670 int dxy, mx, my, umx, umy, lx, ly, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y;
675 int chroma_mx, chroma_my;
682 umx = (chroma_mx + (3 << 24)) / 3 - (1 << 24);
683 umy = (chroma_my + (3 << 24)) / 3 - (1 << 24);
696 uvmx = (cx & 3) << 1;
697 uvmy = (cy & 3) << 1;
699 if(uvmx == 6 && uvmy == 6)
705 int mb_row = s->
mb_y + ((yoff + my + 5 + 8 *
height) >> 4);
714 src_x = s->
mb_x * 16 + xoff + mx;
715 src_y = s->
mb_y * 16 + yoff + my;
716 uvsrc_x = s->
mb_x * 8 + (xoff >> 1) + umx;
717 uvsrc_y = s->
mb_y * 8 + (yoff >> 1) + umy;
718 srcY += src_y * s->
linesize + src_x;
722 (
unsigned)(src_x - !!lx*2) > s->
h_edge_pos - !!lx*2 - (width <<3) - 4 ||
723 (unsigned)(src_y - !!ly*2) > s->
v_edge_pos - !!ly*2 - (height<<3) - 4) {
729 (width << 3) + 6, (height << 3) + 6,
730 src_x - 2, src_y - 2,
735 (width << 2) + 1, (height << 2) + 1,
740 (width << 2) + 1, (height << 2) + 1,
766 qpel_mc[!is16x16][dxy](
Y, srcY, s->
linesize);
772 const int xoff,
const int yoff,
int mv_off,
773 const int width,
const int height,
int dir)
775 rv34_mc(r, block_type, xoff, yoff, mv_off, width, height, dir, r->
rv30, 0,
806 rv34_mc(r, block_type, 0, 0, 0, 2, 2, 0, r->
rv30, weighted,
810 rv34_mc(r, block_type, 0, 0, 0, 2, 2, 1, r->
rv30, 0,
814 rv34_mc(r, block_type, 0, 0, 0, 2, 2, 1, r->
rv30, 1,
826 for(j = 0; j < 2; j++)
827 for(i = 0; i < 2; i++){
842 static const int num_mvs[
RV34_MB_TYPES] = { 0, 0, 1, 4, 1, 1, 0, 0, 2, 2, 2, 1 };
856 memset(r->
dmv, 0,
sizeof(r->
dmv));
857 for(i = 0; i < num_mvs[block_type]; i++){
883 for(j = 0; j < 2; j++)
884 for(i = 0; i < 2; i++)
885 for(k = 0; k < 2; k++)
886 for(l = 0; l < 2; l++)
901 r->
dmv[1][0] = r->
dmv[0][0];
902 r->
dmv[1][1] = r->
dmv[0][1];
959 uint8_t *prev = dst - stride + 4;
978 topleft = dst[-stride + 3] * 0x01010101
u;
981 r->
h.
pred4x4[itype](dst, prev, stride);
1002 int fc,
int sc,
int q_dc,
int q_ac)
1005 int16_t *ptr = s->
block[0];
1007 fc, sc, q_dc, q_ac, q_ac);
1024 int16_t *ptr = s->
block[0];
1025 int i, j, itype, has_ac;
1027 memset(block16, 0, 16 *
sizeof(*block16));
1035 itype = ittrans16[intra_types[0]];
1039 for(j = 0; j < 4; j++){
1040 for(i = 0; i < 4; i++, cbp >>= 1){
1041 int dc = block16[i + j*4];
1058 itype = ittrans16[intra_types[0]];
1065 for(j = 1; j < 3; j++){
1068 for(i = 0; i < 4; i++, cbp >>= 1){
1070 if(!(cbp & 1))
continue;
1071 pdst = dst + (i&1)*4 + (i&2)*2*s->
uvlinesize;
1083 int avail[6*8] = {0};
1085 int idx, q_ac, q_dc;
1091 avail[1] = avail[2] = 1;
1093 avail[3] = avail[4] = 1;
1097 avail[8] = avail[16] = 1;
1099 avail[24] = avail[32] = 1;
1102 for(j = 0; j < 4; j++){
1104 for(i = 0; i < 4; i++, cbp >>= 1, dst += 4, idx++){
1107 if(!(cbp & 1))
continue;
1121 for(k = 0; k < 2; k++){
1125 for(j = 0; j < 2; j++){
1127 for(i = 0; i < 2; i++, cbp >>= 1, acache++){
1132 if(!(cbp&1))
continue;
1146 d = motion_val[0][0] - motion_val[-step][0];
1149 d = motion_val[0][1] - motion_val[-step][1];
1158 int hmvmask = 0, vmvmask = 0, i, j;
1161 for(j = 0; j < 16; j += 8){
1162 for(i = 0; i < 2; i++){
1164 vmvmask |= 0x11 << (j + i*2);
1166 hmvmask |= 0x03 << (j + i*2);
1175 vmvmask |= (vmvmask & 0x4444) >> 1;
1176 hmvmask |= (hmvmask & 0x0F00) >> 4;
1182 return hmvmask | vmvmask;
1190 int16_t *ptr = s->
block[0];
1193 int q_dc, q_ac, has_ac;
1231 memset(block16, 0, 16 *
sizeof(*block16));
1241 for(j = 0; j < 4; j++){
1242 for(i = 0; i < 4; i++, cbp >>= 1){
1243 int dc = block16[i + j*4];
1264 for(j = 0; j < 4; j++){
1265 for(i = 0; i < 4; i++, cbp >>= 1){
1266 if(!(cbp & 1))
continue;
1278 for(j = 1; j < 3; j++){
1280 for(i = 0; i < 4; i++, cbp >>= 1){
1282 if(!(cbp & 1))
continue;
1283 pdst = dst + (i&1)*4 + (i&2)*2*s->
uvlinesize;
1343 if(bits <= 0 || (bits < 8 && !
show_bits(&s->
gb, bits)))
1399 int mb_pos, slice_type;
1501 #if CONFIG_RV30_DECODER
1505 #if CONFIG_RV40_DECODER
1515 if(!intra_vlcs[0].cbppattern[0].
bits)
1549 if (dst == src || !
s1->context_initialized)
1568 memset(&r->
si, 0,
sizeof(r->
si));
1583 int got_picture = 0,
ret;
1620 void *
data,
int *got_picture_ptr,
1624 int buf_size = avpkt->
size;
1631 const uint8_t *slices_hdr = NULL;
1635 if (buf_size == 0) {
1642 *got_picture_ptr = 1;
1648 slice_count = (*buf++) + 1;
1649 slices_hdr = buf + 4;
1650 buf += 8 * slice_count;
1651 buf_size -= 1 + 8 * slice_count;
1669 "reference data.\n");
1678 if (si.
start == 0) {
1718 for (i = 0; i < 2; i++)
1721 for (i = 0; i < 4; i++)
1754 }
else if (HAVE_THREADS &&
1757 "multithreading mode (start MB is %d).\n", si.
start);
1761 for(i = 0; i < slice_count; i++){
1764 if(i+1 == slice_count)
1765 size = buf_size -
offset;
1769 if(offset < 0 || offset > buf_size){
1777 if(i+1 < slice_count){
1785 if(i+2 < slice_count)
1788 size = buf_size -
offset;
1809 *got_picture_ptr =
ret;
1810 }
else if (HAVE_THREADS &&