79 0, 1818, 3622, 4144, 4698, 5234, 5804, 5868, 5900, 5932,
80 5996, 6252, 6316, 6348, 6380, 7674, 8944, 10274, 11668, 12250,
81 14060, 15846, 16372, 16962, 17512, 18148, 18180, 18212, 18244, 18308,
82 18564, 18628, 18660, 18692, 20036, 21314, 22648, 23968, 24614, 26384,
83 28190, 28736, 29366, 29938, 30608, 30640, 30672, 30704, 30768, 31024,
84 31088, 31120, 31184, 32570, 33898, 35236, 36644, 37286, 39020, 40802,
85 41368, 42052, 42692, 43348, 43380, 43412, 43444, 43476, 43604, 43668,
86 43700, 43732, 45100, 46430, 47778, 49160, 49802, 51550, 53340, 53972,
87 54648, 55348, 55994, 56122, 56154, 56186, 56218, 56346, 56410, 56442,
88 56474, 57878, 59290, 60636, 62036, 62682, 64460, 64524, 64588, 64716,
89 64844, 66076, 67466, 67978, 68542, 69064, 69648, 70296, 72010, 72074,
90 72138, 72202, 72330, 73572, 74936, 75454, 76030, 76566, 77176, 77822,
91 79582, 79646, 79678, 79742, 79870, 81180, 82536, 83064, 83672, 84242,
92 84934, 85576, 87384, 87448, 87480, 87544, 87672, 88982, 90340, 90902,
93 91598, 92182, 92846, 93488, 95246, 95278, 95310, 95374, 95502, 96878,
94 98266, 98848, 99542, 100234, 100884, 101524, 103320, 103352, 103384, 103416,
95 103480, 104874, 106222, 106910, 107584, 108258, 108902, 109544, 111366, 111398,
96 111430, 111462, 111494, 112878, 114320, 114988, 115660, 116310, 116950, 117592
113 int counts[17] = {0}, codes[17];
116 int maxbits = 0, realsize = 0;
118 for(i = 0; i <
size; i++){
120 bits2[realsize] = bits[i];
121 syms[realsize] = insyms ? insyms[i] : i;
123 maxbits =
FFMAX(maxbits, bits[i]);
129 for(i = 0; i < 16; i++)
130 codes[i+1] = (codes[i] + counts[i]) << 1;
131 for(i = 0; i < realsize; i++)
132 cw[i] = codes[bits2[i]]++;
150 for(j = 0; j < 2; j++){
154 for(k = 0; k < 4; k++){
158 for(j = 0; j < 4; j++){
166 for(j = 0; j < 4; j++){
169 for(j = 0; j < 2; j++){
190 int pattern, code, cbp=0;
192 static const int cbp_masks[3] = {0x100000, 0x010000, 0x110000};
193 static const int shifts[4] = { 0, 2, 8, 10 };
194 const int *curshift =
shifts;
198 pattern = code & 0xF;
203 for(mask = 8;
mask; mask >>= 1, curshift++){
208 for(i = 0; i < 4; i++){
213 cbp |= cbp_masks[2] << i;
228 coef = 22 + ((1 << coef) |
get_bits(gb, coef));
234 *dst = (coef*q + 8) >> 4;
247 decode_coeff(dst+1*4+0, (flags >> 4) & 3, 2, gb, vlc, q);
248 decode_coeff(dst+0*4+1, (flags >> 2) & 3, 2, gb, vlc, q);
250 decode_coeff(dst+0*4+1, (flags >> 4) & 3, 2, gb, vlc, q);
251 decode_coeff(dst+1*4+0, (flags >> 2) & 3, 2, gb, vlc, q);
253 decode_coeff( dst+1*4+1, (flags >> 0) & 3, 2, gb, vlc, q);
266 int q_dc,
int q_ac1,
int q_ac2)
270 decode_coeff(dst+0*4+0, (flags >> 6) , 3, gb, vlc, q_dc);
271 decode_coeff(dst+0*4+1, (flags >> 4) & 3, 2, gb, vlc, q_ac1);
272 decode_coeff(dst+1*4+0, (flags >> 2) & 3, 2, gb, vlc, q_ac1);
273 decode_coeff(dst+1*4+1, (flags >> 0) & 3, 2, gb, vlc, q_ac2);
289 int code, pattern, has_ac = 1;
293 pattern = code & 0x7;
318 return has_ac | pattern;
333 for(i = 0; i < 5; i++)
344 if(mod == 2 && quant < 19) quant += 10;
345 else if(mod && quant < 26) quant += 5;
428 for(i = 0; i < 16; i++)
450 static const uint8_t part_sizes_w[
RV34_MB_TYPES] = { 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2 };
453 static const uint8_t part_sizes_h[
RV34_MB_TYPES] = { 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2 };
469 int A[2] = {0},
B[2],
C[2];
475 mv_pos += (subblock_no & 1) + (subblock_no >> 1)*s->
b8_stride;
491 if(avail[-4] && (avail[-1] || r->
rv30)){
504 mx += r->
dmv[dmv_no][0];
505 my += r->
dmv[dmv_no][1];
514 #define GET_PTS_DIFF(a, b) (((a) - (b) + 8192) & 0x1FFF)
523 return (val * mul + 0x2000) >> 14;
530 int A_avail,
int B_avail,
int C_avail,
533 if(A_avail + B_avail + C_avail != 3){
534 *mx = A[0] + B[0] + C[0];
535 *my = A[1] + B[1] + C[1];
536 if(A_avail + B_avail + C_avail == 2){
554 int A[2] = { 0 },
B[2] = { 0 },
C[2] = { 0 };
555 int has_A = 0, has_B = 0, has_C = 0;
563 A[0] = cur_pic->
motion_val[dir][mv_pos - 1][0];
564 A[1] = cur_pic->
motion_val[dir][mv_pos - 1][1];
584 mx += r->
dmv[dir][0];
585 my += r->
dmv[dir][1];
587 for(j = 0; j < 2; j++){
588 for(i = 0; i < 2; i++){
605 int A[2] = {0},
B[2],
C[2];
622 if(avail[-4] && (avail[-1])){
637 for(j = 0; j < 2; j++){
638 for(i = 0; i < 2; i++){
639 for(k = 0; k < 2; k++){
665 const int xoff,
const int yoff,
int mv_off,
667 const int thirdpel,
int weighted,
673 int dxy, mx, my, umx, umy, lx, ly, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y;
679 int chroma_mx, chroma_my;
686 umx = (chroma_mx + (3 << 24)) / 3 - (1 << 24);
687 umy = (chroma_my + (3 << 24)) / 3 - (1 << 24);
700 uvmx = (cx & 3) << 1;
701 uvmy = (cy & 3) << 1;
703 if(uvmx == 6 && uvmy == 6)
709 int mb_row = s->
mb_y + ((yoff + my + 5 + 8 *
height) >> 4);
718 src_x = s->
mb_x * 16 + xoff + mx;
719 src_y = s->
mb_y * 16 + yoff + my;
720 uvsrc_x = s->
mb_x * 8 + (xoff >> 1) + umx;
721 uvsrc_y = s->
mb_y * 8 + (yoff >> 1) + umy;
722 srcY += src_y * s->
linesize + src_x;
726 (
unsigned)(src_x - !!lx*2) > s->
h_edge_pos - !!lx*2 - (width <<3) - 4 ||
727 (unsigned)(src_y - !!ly*2) > s->
v_edge_pos - !!ly*2 - (height<<3) - 4) {
731 (width << 3) + 6, (height << 3) + 6,
732 src_x - 2, src_y - 2,
757 qpel_mc[!is16x16][dxy](
Y, srcY, s->
linesize);
763 (width << 2) + 1, (height << 2) + 1,
771 (width << 2) + 1, (height << 2) + 1,
781 const int xoff,
const int yoff,
int mv_off,
782 const int width,
const int height,
int dir)
784 rv34_mc(r, block_type, xoff, yoff, mv_off, width, height, dir, r->
rv30, 0,
815 rv34_mc(r, block_type, 0, 0, 0, 2, 2, 0, r->
rv30, weighted,
819 rv34_mc(r, block_type, 0, 0, 0, 2, 2, 1, r->
rv30, 0,
823 rv34_mc(r, block_type, 0, 0, 0, 2, 2, 1, r->
rv30, 1,
835 for(j = 0; j < 2; j++)
836 for(i = 0; i < 2; i++){
851 static const int num_mvs[
RV34_MB_TYPES] = { 0, 0, 1, 4, 1, 1, 0, 0, 2, 2, 2, 1 };
865 memset(r->
dmv, 0,
sizeof(r->
dmv));
866 for(i = 0; i < num_mvs[block_type]; i++){
892 for(j = 0; j < 2; j++)
893 for(i = 0; i < 2; i++)
894 for(k = 0; k < 2; k++)
895 for(l = 0; l < 2; l++)
910 r->
dmv[1][0] = r->
dmv[0][0];
911 r->
dmv[1][1] = r->
dmv[0][1];
968 uint8_t *prev = dst - stride + 4;
987 topleft = dst[-stride + 3] * 0x01010101
u;
990 r->
h.
pred4x4[itype](dst, prev, stride);
1011 int fc,
int sc,
int q_dc,
int q_ac)
1014 int16_t *ptr = s->
block[0];
1016 fc, sc, q_dc, q_ac, q_ac);
1033 int16_t *ptr = s->
block[0];
1034 int i, j, itype, has_ac;
1036 memset(block16, 0, 16 *
sizeof(*block16));
1044 itype = ittrans16[intra_types[0]];
1048 for(j = 0; j < 4; j++){
1049 for(i = 0; i < 4; i++, cbp >>= 1){
1050 int dc = block16[i + j*4];
1067 itype = ittrans16[intra_types[0]];
1074 for(j = 1; j < 3; j++){
1077 for(i = 0; i < 4; i++, cbp >>= 1){
1079 if(!(cbp & 1))
continue;
1080 pdst = dst + (i&1)*4 + (i&2)*2*s->
uvlinesize;
1092 int avail[6*8] = {0};
1094 int idx, q_ac, q_dc;
1100 avail[1] = avail[2] = 1;
1102 avail[3] = avail[4] = 1;
1106 avail[8] = avail[16] = 1;
1108 avail[24] = avail[32] = 1;
1111 for(j = 0; j < 4; j++){
1113 for(i = 0; i < 4; i++, cbp >>= 1, dst += 4, idx++){
1116 if(!(cbp & 1))
continue;
1130 for(k = 0; k < 2; k++){
1134 for(j = 0; j < 2; j++){
1136 for(i = 0; i < 2; i++, cbp >>= 1, acache++){
1141 if(!(cbp&1))
continue;
1155 d = motion_val[0][0] - motion_val[-step][0];
1158 d = motion_val[0][1] - motion_val[-step][1];
1167 int hmvmask = 0, vmvmask = 0, i, j;
1170 for(j = 0; j < 16; j += 8){
1171 for(i = 0; i < 2; i++){
1173 vmvmask |= 0x11 << (j + i*2);
1175 hmvmask |= 0x03 << (j + i*2);
1184 vmvmask |= (vmvmask & 0x4444) >> 1;
1185 hmvmask |= (hmvmask & 0x0F00) >> 4;
1191 return hmvmask | vmvmask;
1199 int16_t *ptr = s->
block[0];
1202 int q_dc, q_ac, has_ac;
1240 memset(block16, 0, 16 *
sizeof(*block16));
1250 for(j = 0; j < 4; j++){
1251 for(i = 0; i < 4; i++, cbp >>= 1){
1252 int dc = block16[i + j*4];
1273 for(j = 0; j < 4; j++){
1274 for(i = 0; i < 4; i++, cbp >>= 1){
1275 if(!(cbp & 1))
continue;
1287 for(j = 1; j < 3; j++){
1289 for(i = 0; i < 4; i++, cbp >>= 1){
1291 if(!(cbp & 1))
continue;
1292 pdst = dst + (i&1)*4 + (i&2)*2*s->
uvlinesize;
1352 if(bits <= 0 || (bits < 8 && !
show_bits(&s->
gb, bits)))
1408 int mb_pos, slice_type;
1506 #if CONFIG_RV30_DECODER
1510 #if CONFIG_RV40_DECODER
1520 if(!intra_vlcs[0].cbppattern[0].
bits)
1555 if (dst == src || !
s1->context_initialized)
1571 memset(&r->
si, 0,
sizeof(r->
si));
1591 int got_picture = 0,
ret;
1628 void *
data,
int *got_picture_ptr,
1632 int buf_size = avpkt->
size;
1643 if (buf_size == 0) {
1650 *got_picture_ptr = 1;
1656 slice_count = (*buf++) + 1;
1657 slices_hdr = buf + 4;
1658 buf += 8 * slice_count;
1659 buf_size -= 1 + 8 * slice_count;
1677 "reference data.\n");
1686 if (si.
start == 0) {
1726 for (i = 0; i < 2; i++)
1729 for (i = 0; i < 4; i++)
1762 }
else if (HAVE_THREADS &&
1765 "multithreading mode (start MB is %d).\n", si.
start);
1769 for(i = 0; i < slice_count; i++){
1772 if(i+1 == slice_count)
1773 size = buf_size -
offset;
1777 if(offset < 0 || offset > buf_size){
1785 if(i+1 < slice_count){
1793 if(i+2 < slice_count)
1796 size = buf_size -
offset;
1817 *got_picture_ptr =
ret;
1818 }
else if (HAVE_THREADS &&