77 0, 1818, 3622, 4144, 4698, 5234, 5804, 5868, 5900, 5932,
78 5996, 6252, 6316, 6348, 6380, 7674, 8944, 10274, 11668, 12250,
79 14060, 15846, 16372, 16962, 17512, 18148, 18180, 18212, 18244, 18308,
80 18564, 18628, 18660, 18692, 20036, 21314, 22648, 23968, 24614, 26384,
81 28190, 28736, 29366, 29938, 30608, 30640, 30672, 30704, 30768, 31024,
82 31088, 31120, 31184, 32570, 33898, 35236, 36644, 37286, 39020, 40802,
83 41368, 42052, 42692, 43348, 43380, 43412, 43444, 43476, 43604, 43668,
84 43700, 43732, 45100, 46430, 47778, 49160, 49802, 51550, 53340, 53972,
85 54648, 55348, 55994, 56122, 56154, 56186, 56218, 56346, 56410, 56442,
86 56474, 57878, 59290, 60636, 62036, 62682, 64460, 64524, 64588, 64716,
87 64844, 66076, 67466, 67978, 68542, 69064, 69648, 70296, 72010, 72074,
88 72138, 72202, 72330, 73572, 74936, 75454, 76030, 76566, 77176, 77822,
89 79582, 79646, 79678, 79742, 79870, 81180, 82536, 83064, 83672, 84242,
90 84934, 85576, 87384, 87448, 87480, 87544, 87672, 88982, 90340, 90902,
91 91598, 92182, 92846, 93488, 95246, 95278, 95310, 95374, 95502, 96878,
92 98266, 98848, 99542, 100234, 100884, 101524, 103320, 103352, 103384, 103416,
93 103480, 104874, 106222, 106910, 107584, 108258, 108902, 109544, 111366, 111398,
94 111430, 111462, 111494, 112878, 114320, 114988, 115660, 116310, 116950, 117592
111 int counts[17] = {0}, codes[17];
114 int maxbits = 0, realsize = 0;
116 for(i = 0; i <
size; i++){
118 bits2[realsize] = bits[i];
119 syms[realsize] = insyms ? insyms[i] : i;
121 maxbits =
FFMAX(maxbits, bits[i]);
127 for(i = 0; i < 16; i++)
128 codes[i+1] = (codes[i] + counts[i]) << 1;
129 for(i = 0; i < realsize; i++)
130 cw[i] = codes[bits2[i]]++;
148 for(j = 0; j < 2; j++){
152 for(k = 0; k < 4; k++){
156 for(j = 0; j < 4; j++){
164 for(j = 0; j < 4; j++){
167 for(j = 0; j < 2; j++){
188 int pattern, code, cbp=0;
190 static const int cbp_masks[3] = {0x100000, 0x010000, 0x110000};
191 static const int shifts[4] = { 0, 2, 8, 10 };
192 const int *curshift = shifts;
196 pattern = code & 0xF;
201 for(mask = 8;
mask; mask >>= 1, curshift++){
206 for(i = 0; i < 4; i++){
211 cbp |= cbp_masks[2] << i;
226 coef = 22 + ((1 << coef) |
get_bits(gb, coef));
232 *dst = (coef*q + 8) >> 4;
245 decode_coeff(dst+1*4+0, (flags >> 4) & 3, 2, gb, vlc, q);
246 decode_coeff(dst+0*4+1, (flags >> 2) & 3, 2, gb, vlc, q);
248 decode_coeff(dst+0*4+1, (flags >> 4) & 3, 2, gb, vlc, q);
249 decode_coeff(dst+1*4+0, (flags >> 2) & 3, 2, gb, vlc, q);
251 decode_coeff( dst+1*4+1, (flags >> 0) & 3, 2, gb, vlc, q);
264 int q_dc,
int q_ac1,
int q_ac2)
268 decode_coeff(dst+0*4+0, (flags >> 6) , 3, gb, vlc, q_dc);
269 decode_coeff(dst+0*4+1, (flags >> 4) & 3, 2, gb, vlc, q_ac1);
270 decode_coeff(dst+1*4+0, (flags >> 2) & 3, 2, gb, vlc, q_ac1);
271 decode_coeff(dst+1*4+1, (flags >> 0) & 3, 2, gb, vlc, q_ac2);
287 int code, pattern, has_ac = 1;
291 pattern = code & 0x7;
316 return has_ac | pattern;
331 for(i = 0; i < 5; i++)
342 if(mod == 2 && quant < 19) quant += 10;
343 else if(mod && quant < 26) quant += 5;
426 for(i = 0; i < 16; i++)
448 static const uint8_t part_sizes_w[
RV34_MB_TYPES] = { 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2 };
451 static const uint8_t part_sizes_h[
RV34_MB_TYPES] = { 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2 };
467 int A[2] = {0},
B[2],
C[2];
473 mv_pos += (subblock_no & 1) + (subblock_no >> 1)*s->
b8_stride;
489 if(avail[-4] && (avail[-1] || r->
rv30)){
502 mx += r->
dmv[dmv_no][0];
503 my += r->
dmv[dmv_no][1];
512 #define GET_PTS_DIFF(a, b) ((a - b + 8192) & 0x1FFF)
521 return (val * mul + 0x2000) >> 14;
528 int A_avail,
int B_avail,
int C_avail,
531 if(A_avail + B_avail + C_avail != 3){
532 *mx = A[0] + B[0] + C[0];
533 *my = A[1] + B[1] + C[1];
534 if(A_avail + B_avail + C_avail == 2){
552 int A[2] = { 0 },
B[2] = { 0 },
C[2] = { 0 };
553 int has_A = 0, has_B = 0, has_C = 0;
558 int type = cur_pic->
f.
mb_type[mb_pos];
582 mx += r->
dmv[dir][0];
583 my += r->
dmv[dir][1];
585 for(j = 0; j < 2; j++){
586 for(i = 0; i < 2; i++){
603 int A[2] = {0},
B[2],
C[2];
620 if(avail[-4] && (avail[-1])){
635 for(j = 0; j < 2; j++){
636 for(i = 0; i < 2; i++){
637 for(k = 0; k < 2; k++){
663 const int xoff,
const int yoff,
int mv_off,
665 const int thirdpel,
int weighted,
671 int dxy, mx, my, umx, umy, lx, ly, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y;
676 int chroma_mx, chroma_my;
683 umx = (chroma_mx + (3 << 24)) / 3 - (1 << 24);
684 umy = (chroma_my + (3 << 24)) / 3 - (1 << 24);
697 uvmx = (cx & 3) << 1;
698 uvmy = (cy & 3) << 1;
700 if(uvmx == 6 && uvmy == 6)
706 int mb_row = s->
mb_y + ((yoff + my + 5 + 8 *
height) >> 4);
715 src_x = s->
mb_x * 16 + xoff + mx;
716 src_y = s->
mb_y * 16 + yoff + my;
717 uvsrc_x = s->
mb_x * 8 + (xoff >> 1) + umx;
718 uvsrc_y = s->
mb_y * 8 + (yoff >> 1) + umy;
719 srcY += src_y * s->
linesize + src_x;
723 (
unsigned)(src_x - !!lx*2) > s->
h_edge_pos - !!lx*2 - (width <<3) - 4 ||
724 (unsigned)(src_y - !!ly*2) > s->
v_edge_pos - !!ly*2 - (height<<3) - 4) {
758 qpel_mc[!is16x16][dxy](
Y, srcY, s->
linesize);
764 const int xoff,
const int yoff,
int mv_off,
765 const int width,
const int height,
int dir)
767 rv34_mc(r, block_type, xoff, yoff, mv_off, width, height, dir, r->
rv30, 0,
798 rv34_mc(r, block_type, 0, 0, 0, 2, 2, 0, r->
rv30, weighted,
802 rv34_mc(r, block_type, 0, 0, 0, 2, 2, 1, r->
rv30, 0,
806 rv34_mc(r, block_type, 0, 0, 0, 2, 2, 1, r->
rv30, 1,
818 for(j = 0; j < 2; j++)
819 for(i = 0; i < 2; i++){
834 static const int num_mvs[
RV34_MB_TYPES] = { 0, 0, 1, 4, 1, 1, 0, 0, 2, 2, 2, 1 };
848 memset(r->
dmv, 0,
sizeof(r->
dmv));
849 for(i = 0; i < num_mvs[block_type]; i++){
875 for(j = 0; j < 2; j++)
876 for(i = 0; i < 2; i++)
877 for(k = 0; k < 2; k++)
878 for(l = 0; l < 2; l++)
893 r->
dmv[1][0] = r->
dmv[0][0];
894 r->
dmv[1][1] = r->
dmv[0][1];
951 uint8_t *prev = dst - stride + 4;
970 topleft = dst[-stride + 3] * 0x01010101
u;
994 int fc,
int sc,
int q_dc,
int q_ac)
997 int16_t *ptr = s->
block[0];
999 fc, sc, q_dc, q_ac, q_ac);
1016 int16_t *ptr = s->
block[0];
1017 int i, j, itype, has_ac;
1019 memset(block16, 0, 16 *
sizeof(*block16));
1027 itype = ittrans16[intra_types[0]];
1031 for(j = 0; j < 4; j++){
1032 for(i = 0; i < 4; i++, cbp >>= 1){
1033 int dc = block16[i + j*4];
1050 itype = ittrans16[intra_types[0]];
1057 for(j = 1; j < 3; j++){
1060 for(i = 0; i < 4; i++, cbp >>= 1){
1062 if(!(cbp & 1))
continue;
1063 pdst = dst + (i&1)*4 + (i&2)*2*s->
uvlinesize;
1075 int avail[6*8] = {0};
1077 int idx, q_ac, q_dc;
1083 avail[1] = avail[2] = 1;
1085 avail[3] = avail[4] = 1;
1089 avail[8] = avail[16] = 1;
1091 avail[24] = avail[32] = 1;
1094 for(j = 0; j < 4; j++){
1096 for(i = 0; i < 4; i++, cbp >>= 1, dst += 4, idx++){
1099 if(!(cbp & 1))
continue;
1113 for(k = 0; k < 2; k++){
1117 for(j = 0; j < 2; j++){
1119 for(i = 0; i < 2; i++, cbp >>= 1, acache++){
1124 if(!(cbp&1))
continue;
1138 d = motion_val[0][0] - motion_val[-step][0];
1141 d = motion_val[0][1] - motion_val[-step][1];
1150 int hmvmask = 0, vmvmask = 0, i, j;
1153 for(j = 0; j < 16; j += 8){
1154 for(i = 0; i < 2; i++){
1156 vmvmask |= 0x11 << (j + i*2);
1158 hmvmask |= 0x03 << (j + i*2);
1167 vmvmask |= (vmvmask & 0x4444) >> 1;
1168 hmvmask |= (hmvmask & 0x0F00) >> 4;
1174 return hmvmask | vmvmask;
1182 int16_t *ptr = s->
block[0];
1185 int q_dc, q_ac, has_ac;
1223 memset(block16, 0, 16 *
sizeof(*block16));
1233 for(j = 0; j < 4; j++){
1234 for(i = 0; i < 4; i++, cbp >>= 1){
1235 int dc = block16[i + j*4];
1256 for(j = 0; j < 4; j++){
1257 for(i = 0; i < 4; i++, cbp >>= 1){
1258 if(!(cbp & 1))
continue;
1270 for(j = 1; j < 3; j++){
1272 for(i = 0; i < 4; i++, cbp >>= 1){
1274 if(!(cbp & 1))
continue;
1275 pdst = dst + (i&1)*4 + (i&2)*2*s->
uvlinesize;
1335 if(bits <= 0 || (bits < 8 && !
show_bits(&s->
gb, bits)))
1391 int mb_pos, slice_type;
1495 #if CONFIG_RV30_DECODER
1499 #if CONFIG_RV40_DECODER
1507 if(!intra_vlcs[0].cbppattern[0].
bits)
1536 if (dst == src || !
s1->context_initialized)
1555 memset(&r->
si, 0,
sizeof(r->
si));
1570 int got_picture = 0;
1603 void *
data,
int *got_picture_ptr,
1607 int buf_size = avpkt->
size;
1618 if (buf_size == 0) {
1624 *got_picture_ptr = 1;
1630 slice_count = (*buf++) + 1;
1631 slices_hdr = buf + 4;
1632 buf += 8 * slice_count;
1633 buf_size -= 1 + 8 * slice_count;
1651 "reference data.\n");
1660 if (si.
start == 0) {
1696 for (i = 0; i < 2; i++)
1699 for (i = 0; i < 4; i++)
1732 }
else if (HAVE_THREADS &&
1735 "multithreading mode (start MB is %d).\n", si.
start);
1739 for(i = 0; i < slice_count; i++){
1742 if(i+1 == slice_count)
1743 size = buf_size -
offset;
1747 if(offset < 0 || offset > buf_size){
1755 if(i+1 < slice_count){
1763 if(i+2 < slice_count)
1766 size = buf_size -
offset;
1770 if (size < 0 || size > buf_size - offset) {
1785 }
else if (HAVE_THREADS &&