48 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
49 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
54 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
55 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
56 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
57 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
58 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
59 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
60 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
61 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
66 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
67 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
68 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
69 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
70 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
71 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
72 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
73 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
78 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
79 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
80 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
81 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
82 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
83 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
84 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
85 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
90 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
91 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
92 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
93 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
94 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
95 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
96 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
97 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
113 int16_t *
block,
int n,
int qscale)
115 int i,
level, nCoeffs;
116 const uint16_t *quant_matrix;
123 for(i=1;i<=nCoeffs;i++) {
129 level = (int)(level * qscale * quant_matrix[j]) >> 3;
130 level = (level - 1) | 1;
133 level = (int)(level * qscale * quant_matrix[j]) >> 3;
134 level = (level - 1) | 1;
142 int16_t *
block,
int n,
int qscale)
144 int i,
level, nCoeffs;
145 const uint16_t *quant_matrix;
150 for(i=0; i<=nCoeffs; i++) {
156 level = (((level << 1) + 1) * qscale *
157 ((int) (quant_matrix[j]))) >> 4;
158 level = (level - 1) | 1;
161 level = (((level << 1) + 1) * qscale *
162 ((int) (quant_matrix[j]))) >> 4;
163 level = (level - 1) | 1;
171 int16_t *
block,
int n,
int qscale)
173 int i,
level, nCoeffs;
174 const uint16_t *quant_matrix;
181 for(i=1;i<=nCoeffs;i++) {
187 level = (int)(level * qscale * quant_matrix[j]) >> 3;
190 level = (int)(level * qscale * quant_matrix[j]) >> 3;
198 int16_t *
block,
int n,
int qscale)
200 int i,
level, nCoeffs;
201 const uint16_t *quant_matrix;
210 for(i=1;i<=nCoeffs;i++) {
216 level = (int)(level * qscale * quant_matrix[j]) >> 3;
219 level = (int)(level * qscale * quant_matrix[j]) >> 3;
229 int16_t *
block,
int n,
int qscale)
231 int i,
level, nCoeffs;
232 const uint16_t *quant_matrix;
239 for(i=0; i<=nCoeffs; i++) {
245 level = (((level << 1) + 1) * qscale *
246 ((int) (quant_matrix[j]))) >> 4;
249 level = (((level << 1) + 1) * qscale *
250 ((int) (quant_matrix[j]))) >> 4;
260 int16_t *
block,
int n,
int qscale)
262 int i,
level, qmul, qadd;
271 qadd = (qscale - 1) | 1;
280 for(i=1; i<=nCoeffs; i++) {
284 level = level * qmul - qadd;
286 level = level * qmul + qadd;
294 int16_t *
block,
int n,
int qscale)
296 int i,
level, qmul, qadd;
301 qadd = (qscale - 1) | 1;
306 for(i=0; i<=nCoeffs; i++) {
310 level = level * qmul - qadd;
312 level = level * qmul + qadd;
321 int mb_x,
int mb_y,
int mb_intra,
int mb_skipped)
331 memcpy(s->
mv,
mv,
sizeof(*
mv));
440 if (r < 0 || !pic->f.buf[0]) {
448 for (i = 0; pic->
f.
data[i]; i++) {
473 "get_buffer() failed (stride changed)\n");
480 "get_buffer() failed (uv stride mismatch)\n");
488 "get_buffer() failed to allocate context scratch buffers.\n");
510 for (i = 0; i < 2; i++) {
540 int mv_size = 2 * (b8_array_size + 4) *
sizeof(int16_t);
541 int ref_index_size = 4 * mb_array_size;
543 for (i = 0; mv_size && i < 2; i++) {
560 #define MAKE_WRITABLE(table) \
563 (ret = av_buffer_make_writable(&pic->table)) < 0)\
574 for (i = 0; i < 2; i++) {
626 for (i = 0; i < 2; i++) {
662 memset((
uint8_t*)pic + off, 0,
sizeof(*pic) - off);
669 #define UPDATE_TABLE(table)\
672 (!dst->table || dst->table->buffer != src->table->buffer)) {\
673 av_buffer_unref(&dst->table);\
674 dst->table = av_buffer_ref(src->table);\
676 ff_free_picture_tables(dst);\
677 return AVERROR(ENOMEM);\
688 for (i = 0; i < 2; i++) {
699 for (i = 0; i < 2; i++) {
761 int yc_size = y_size + 2 * c_size;
781 2 * 64 *
sizeof(
int), fail)
787 for (i = 0; i < 12; i++) {
796 yc_size *
sizeof(int16_t) * 16, fail);
829 #define COPY(a) bak->a = src->a
830 COPY(edge_emu_buffer);
835 COPY(obmc_scratchpad);
863 for (i = 0; i < 12; i++) {
871 "scratch buffers.\n");
899 if (
s1->context_initialized){
930 if (
s1->picture[i].f.buf[0] &&
935 #define UPDATE_PICTURE(pic)\
937 ff_mpeg_unref_picture(s, &s->pic);\
938 if (s1->pic.f.buf[0])\
939 ret = ff_mpeg_ref_picture(s, &s->pic, &s1->pic);\
941 ret = update_picture_tables(&s->pic, &s1->pic);\
961 (
char *) &
s1->pb_field_time +
sizeof(
s1->pb_field_time) -
962 (
char *) &
s1->last_time_base);
972 if (
s1->bitstream_buffer) {
973 if (
s1->bitstream_buffer_size +
977 s1->allocated_bitstream_buffer_size);
980 s1->bitstream_buffer_size);
990 "scratch buffers.\n");
995 "be allocated due to unknown size.\n");
1000 (
char *) &
s1->rtp_mode - (
char *) &
s1->progressive_sequence);
1002 if (!
s1->first_field) {
1004 if (
s1->current_picture_ptr)
1087 int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x,
y;
1112 yc_size = y_size + 2 * c_size;
1145 mb_array_size *
sizeof(
float), fail);
1147 mb_array_size *
sizeof(
float), fail);
1154 for (i = 0; i < 2; i++) {
1156 for (j = 0; j < 2; j++) {
1157 for (k = 0; k < 2; k++) {
1160 mv_table_size * 2 *
sizeof(int16_t),
1189 for (i = 0; i < yc_size; i++)
1213 int nb_slices = (HAVE_THREADS &&
1227 "decoding to AV_PIX_FMT_NONE is not supported.\n");
1238 " reducing to %d\n", nb_slices, max_slices);
1239 nb_slices = max_slices;
1282 if (nb_slices > 1) {
1283 for (i = 1; i < nb_slices; i++) {
1288 for (i = 0; i < nb_slices; i++) {
1292 (s->
mb_height * (i) + nb_slices / 2) / nb_slices;
1294 (s->
mb_height * (i + 1) + nb_slices / 2) / nb_slices;
1333 for (i = 0; i < 2; i++) {
1334 for (j = 0; j < 2; j++) {
1335 for (k = 0; k < 2; k++) {
1410 if (nb_slices > 1) {
1411 for (i = 1; i < nb_slices; i++) {
1416 for (i = 0; i < nb_slices; i++) {
1420 (s->
mb_height * (i) + nb_slices / 2) / nb_slices;
1422 (s->
mb_height * (i + 1) + nb_slices / 2) / nb_slices;
1496 for (last = 0; last < 2; last++) {
1505 memset(max_level, 0,
MAX_RUN + 1);
1507 memset(index_run, rl->
n,
MAX_RUN + 1);
1508 for (i = start; i <
end; i++) {
1511 if (index_run[run] == rl->
n)
1513 if (level > max_level[run])
1515 if (run > max_run[level])
1519 rl->
max_level[last] = static_store[last];
1532 memcpy(rl->
index_run[last], index_run, MAX_RUN + 1);
1540 for (q = 0; q < 32; q++) {
1542 int qadd = (q - 1) | 1;
1556 }
else if (len < 0) {
1560 if (code == rl->
n) {
1566 if (code >= rl->
last) run += 192;
1591 if (pic->
f.
buf[0] == NULL)
1615 "Internal error, picture buffer overflow\n");
1675 "releasing zombie picture\n");
1736 av_dlog(s->
avctx,
"L%p N%p C%p L%p N%p C%p type:%d drop:%d\n",
1747 int h_chroma_shift, v_chroma_shift;
1749 &h_chroma_shift, &v_chroma_shift);
1752 "allocating dummy last picture for B frame\n");
1755 "warning: first frame is no keyframe\n");
1758 "allocate dummy last picture for field based first keyframe\n");
1778 for(i=0; i<avctx->
height; i++)
1780 0x80, avctx->
width);
1783 0x80, FF_CEIL_RSHIFT(avctx->
width, h_chroma_shift));
1785 0x80, FF_CEIL_RSHIFT(avctx->
width, h_chroma_shift));
1789 for(i=0; i<avctx->
height; i++)
1820 #if 0 // BUFREF-FIXME
1844 for (i = 0; i < 4; i++) {
1895 sx = av_clip(sx, 0, w - 1);
1896 sy = av_clip(sy, 0, h - 1);
1897 ex = av_clip(ex, 0, w - 1);
1898 ey = av_clip(ey, 0, h - 1);
1900 buf[sy * stride + sx] +=
color;
1907 buf += sx + sy * stride;
1909 f = ((ey - sy) << 16) / ex;
1910 for (x = 0; x <= ex; x++) {
1912 fr = (x * f) & 0xFFFF;
1913 buf[y * stride + x] += (color * (0x10000 - fr)) >> 16;
1914 if(fr) buf[(y + 1) * stride + x] += (color * fr ) >> 16;
1921 buf += sx + sy * stride;
1924 f = ((ex - sx) << 16) / ey;
1927 for(y= 0; y <= ey; y++){
1929 fr = (y*f) & 0xFFFF;
1930 buf[y * stride + x] += (color * (0x10000 - fr)) >> 16;
1931 if(fr) buf[y * stride + x + 1] += (color * fr ) >> 16;
1948 sx = av_clip(sx, -100, w + 100);
1949 sy = av_clip(sy, -100, h + 100);
1950 ex = av_clip(ex, -100, w + 100);
1951 ey = av_clip(ey, -100, h + 100);
1956 if (dx * dx + dy * dy > 3 * 3) {
1965 draw_line(buf, sx, sy, sx + rx, sy + ry, w, h, stride, color);
1966 draw_line(buf, sx, sy, sx - ry, sy + rx, w, h, stride, color);
1968 draw_line(buf, sx, sy, ex, ey, w, h, stride, color);
1976 int mb_width,
int mb_height,
int mb_stride,
int quarter_sample)
1988 for (y = 0; y < mb_height; y++) {
1989 for (x = 0; x < mb_width; x++) {
1991 int count = mbskip_table[x + y * mb_stride];
2001 int mb_type = p->
mb_type[x + y * mb_stride];
2017 else if (
IS_GMC(mb_type))
2055 const int shift = 1 + quarter_sample;
2059 int h_chroma_shift, v_chroma_shift, block_height;
2063 const int mv_stride = (mb_width << mv_sample_log2) +
2073 ptr = pict->
data[0];
2074 block_height = 16 >> v_chroma_shift;
2076 for (mb_y = 0; mb_y < mb_height; mb_y++) {
2078 for (mb_x = 0; mb_x < mb_width; mb_x++) {
2079 const int mb_index = mb_x + mb_y * mb_stride;
2082 for (type = 0; type < 3; type++) {
2109 for (i = 0; i < 4; i++) {
2110 int sx = mb_x * 16 + 4 + 8 * (i & 1);
2111 int sy = mb_y * 16 + 4 + 8 * (i >> 1);
2112 int xy = (mb_x * 2 + (i & 1) +
2113 (mb_y * 2 + (i >> 1)) * mv_stride) << (mv_sample_log2 - 1);
2121 for (i = 0; i < 2; i++) {
2122 int sx = mb_x * 16 + 8;
2123 int sy = mb_y * 16 + 4 + 8 * i;
2124 int xy = (mb_x * 2 + (mb_y * 2 + i) * mv_stride) << (mv_sample_log2 - 1);
2131 draw_arrow(ptr, sx, sy, mx + sx, my + sy, width,
2136 for (i = 0; i < 2; i++) {
2137 int sx = mb_x * 16 + 4 + 8 * i;
2138 int sy = mb_y * 16 + 8;
2139 int xy = (mb_x * 2 + i + mb_y * 2 * mv_stride) << (mv_sample_log2 - 1);
2146 draw_arrow(ptr, sx, sy, mx + sx, my + sy, width,
2150 int sx= mb_x * 16 + 8;
2151 int sy= mb_y * 16 + 8;
2152 int xy= (mb_x + mb_y * mv_stride) << mv_sample_log2;
2161 0x0101010101010101ULL;
2163 for (y = 0; y < block_height; y++) {
2164 *(uint64_t *)(pict->
data[1] + 8 * mb_x +
2165 (block_height * mb_y + y) *
2167 *(uint64_t *)(pict->
data[2] + 8 * mb_x +
2168 (block_height * mb_y + y) *
2174 int mb_type = p->
mb_type[mb_index];
2177 #define COLOR(theta, r) \
2178 u = (int)(128 + r * cos(theta * 3.141592 / 180)); \
2179 v = (int)(128 + r * sin(theta * 3.141592 / 180));
2196 }
else if (
IS_GMC(mb_type)) {
2198 }
else if (
IS_SKIP(mb_type)) {
2209 u *= 0x0101010101010101ULL;
2210 v *= 0x0101010101010101ULL;
2211 for (y = 0; y < block_height; y++) {
2212 *(uint64_t *)(pict->
data[1] + 8 * mb_x +
2213 (block_height * mb_y + y) * pict->
linesize[1]) = u;
2214 *(uint64_t *)(pict->
data[2] + 8 * mb_x +
2215 (block_height * mb_y + y) * pict->
linesize[2]) = v;
2220 *(uint64_t *)(pict->
data[0] + 16 * mb_x + 0 +
2221 (16 * mb_y + 8) * pict->
linesize[0]) ^= 0x8080808080808080ULL;
2222 *(uint64_t *)(pict->
data[0] + 16 * mb_x + 8 +
2223 (16 * mb_y + 8) * pict->
linesize[0]) ^= 0x8080808080808080ULL;
2226 for (y = 0; y < 16; y++)
2227 pict->
data[0][16 * mb_x + 8 + (16 * mb_y + y) *
2230 if (
IS_8X8(mb_type) && mv_sample_log2 >= 2) {
2231 int dm = 1 << (mv_sample_log2 - 2);
2232 for (i = 0; i < 4; i++) {
2233 int sx = mb_x * 16 + 8 * (i & 1);
2234 int sy = mb_y * 16 + 8 * (i >> 1);
2235 int xy = (mb_x * 2 + (i & 1) +
2236 (mb_y * 2 + (i >> 1)) * mv_stride) << (mv_sample_log2 - 1);
2239 if (mv[0] != mv[dm] ||
2240 mv[dm * mv_stride] != mv[dm * (mv_stride + 1)])
2241 for (y = 0; y < 8; y++)
2242 pict->
data[0][sx + 4 + (sy + y) * pict->
linesize[0]] ^= 0x80;
2243 if (mv[0] != mv[dm * mv_stride] || mv[dm] != mv[dm * (mv_stride + 1)])
2244 *(uint64_t *)(pict->
data[0] + sx + (sy + 4) *
2245 pict->
linesize[0]) ^= 0x8080808080808080ULL;
2254 mbskip_table[mb_index] = 0;
2280 int field_based,
int field_select,
2281 int src_x,
int src_y,
2283 int h_edge_pos,
int v_edge_pos,
2285 int motion_x,
int motion_y)
2288 const int op_index =
FFMIN(lowres, 3);
2289 const int s_mask = (2 <<
lowres) - 1;
2298 sx = motion_x & s_mask;
2299 sy = motion_y & s_mask;
2300 src_x += motion_x >> lowres + 1;
2301 src_y += motion_y >> lowres + 1;
2303 src += src_y * stride + src_x;
2305 if ((
unsigned)src_x >
FFMAX( h_edge_pos - (!!sx) - w, 0) ||
2306 (unsigned)src_y >
FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
2309 w + 1, (h + 1) << field_based,
2310 src_x, src_y << field_based,
2311 h_edge_pos, v_edge_pos);
2316 sx = (sx << 2) >>
lowres;
2317 sy = (sy << 2) >>
lowres;
2320 pix_op[op_index](dest,
src, stride, h, sx, sy);
2334 int motion_x,
int motion_y,
2337 uint8_t *ptr_y, *ptr_cb, *ptr_cr;
2338 int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, sx, sy, uvsx, uvsy;
2339 ptrdiff_t uvlinesize, linesize;
2342 const int block_s = 8>>
lowres;
2343 const int s_mask = (2 <<
lowres) - 1;
2356 motion_y += (bottom_field - field_select)*((1 << lowres)-1);
2359 sx = motion_x & s_mask;
2360 sy = motion_y & s_mask;
2361 src_x = s->
mb_x * 2 * block_s + (motion_x >> lowres + 1);
2362 src_y = (mb_y * 2 * block_s >> field_based) + (motion_y >> lowres + 1);
2365 uvsx = ((motion_x >> 1) & s_mask) | (sx & 1);
2366 uvsy = ((motion_y >> 1) & s_mask) | (sy & 1);
2367 uvsrc_x = src_x >> 1;
2368 uvsrc_y = src_y >> 1;
2373 uvsx = (2 * mx) & s_mask;
2374 uvsy = (2 * my) & s_mask;
2375 uvsrc_x = s->
mb_x * block_s + (mx >>
lowres);
2376 uvsrc_y = mb_y * block_s + (my >>
lowres);
2383 uvsrc_x = s->
mb_x * block_s + (mx >> lowres + 1);
2384 uvsrc_y = (mb_y * block_s >> field_based) + (my >> lowres + 1);
2390 uvsy = motion_y & s_mask;
2392 uvsrc_x = s->
mb_x*block_s + (mx >> (lowres+1));
2395 uvsx = motion_x & s_mask;
2396 uvsy = motion_y & s_mask;
2403 ptr_y = ref_picture[0] + src_y * linesize + src_x;
2404 ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
2405 ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
2407 if ((
unsigned) src_x >
FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || uvsrc_y<0 ||
2408 (
unsigned) src_y >
FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
2410 linesize >> field_based, linesize >> field_based,
2411 17, 17 + field_based,
2412 src_x, src_y << field_based, h_edge_pos,
2418 uvlinesize >> field_based, uvlinesize >> field_based,
2420 uvsrc_x, uvsrc_y << field_based,
2421 h_edge_pos >> 1, v_edge_pos >> 1);
2423 uvlinesize >> field_based,uvlinesize >> field_based,
2425 uvsrc_x, uvsrc_y << field_based,
2426 h_edge_pos >> 1, v_edge_pos >> 1);
2428 ptr_cr = uvbuf + 16;
2445 sx = (sx << 2) >>
lowres;
2446 sy = (sy << 2) >>
lowres;
2447 pix_op[lowres - 1](dest_y, ptr_y, linesize, h, sx, sy);
2451 uvsx = (uvsx << 2) >>
lowres;
2452 uvsy = (uvsy << 2) >>
lowres;
2454 pix_op[op_index](dest_cb, ptr_cb, uvlinesize, hc, uvsx, uvsy);
2455 pix_op[op_index](dest_cr, ptr_cr, uvlinesize, hc, uvsx, uvsy);
2468 const int op_index =
FFMIN(lowres, 3);
2469 const int block_s = 8 >>
lowres;
2470 const int s_mask = (2 <<
lowres) - 1;
2471 const int h_edge_pos = s->
h_edge_pos >> lowres + 1;
2472 const int v_edge_pos = s->
v_edge_pos >> lowres + 1;
2473 int emu = 0, src_x, src_y, sx, sy;
2489 src_x = s->
mb_x * block_s + (mx >> lowres + 1);
2490 src_y = s->
mb_y * block_s + (my >> lowres + 1);
2493 ptr = ref_picture[1] +
offset;
2494 if ((
unsigned) src_x >
FFMAX(h_edge_pos - (!!sx) - block_s, 0) ||
2495 (unsigned) src_y >
FFMAX(v_edge_pos - (!!sy) - block_s, 0)) {
2499 src_x, src_y, h_edge_pos, v_edge_pos);
2503 sx = (sx << 2) >>
lowres;
2504 sy = (sy << 2) >>
lowres;
2505 pix_op[op_index](dest_cb, ptr, s->
uvlinesize, block_s, sx, sy);
2507 ptr = ref_picture[2] +
offset;
2512 src_x, src_y, h_edge_pos, v_edge_pos);
2515 pix_op[op_index](dest_cr, ptr, s->
uvlinesize, block_s, sx, sy);
2538 const int block_s = 8 >>
lowres;
2547 ref_picture, pix_op,
2548 s->
mv[dir][0][0], s->
mv[dir][0][1],
2554 for (i = 0; i < 4; i++) {
2557 ref_picture[0], 0, 0,
2558 (2 * mb_x + (i & 1)) * block_s,
2559 (2 * mb_y + (i >> 1)) * block_s,
2562 block_s, block_s, pix_op,
2563 s->
mv[dir][i][0], s->
mv[dir][i][1]);
2565 mx += s->
mv[dir][i][0];
2566 my += s->
mv[dir][i][1];
2578 ref_picture, pix_op,
2579 s->
mv[dir][0][0], s->
mv[dir][0][1],
2584 ref_picture, pix_op,
2585 s->
mv[dir][1][0], s->
mv[dir][1][1],
2595 ref_picture, pix_op,
2597 s->
mv[dir][0][1], 2 * block_s, mb_y >> 1);
2601 for (i = 0; i < 2; i++) {
2613 ref2picture, pix_op,
2614 s->
mv[dir][i][0], s->
mv[dir][i][1] +
2615 2 * block_s * i, block_s, mb_y >> 1);
2617 dest_y += 2 * block_s * s->
linesize;
2624 for (i = 0; i < 2; i++) {
2626 for (j = 0; j < 2; j++) {
2629 ref_picture, pix_op,
2630 s->
mv[dir][2 * i + j][0],
2631 s->
mv[dir][2 * i + j][1],
2637 for (i = 0; i < 2; i++) {
2640 ref_picture, pix_op,
2641 s->
mv[dir][2 * i][0],s->
mv[dir][2 * i][1],
2642 2 * block_s, mb_y >> 1);
2665 int my_max = INT_MIN, my_min = INT_MAX, qpel_shift = !s->
quarter_sample;
2666 int my,
off, i, mvs;
2685 for (i = 0; i < mvs; i++) {
2686 my = s->
mv[dir][i][1]<<qpel_shift;
2687 my_max =
FFMAX(my_max, my);
2688 my_min =
FFMIN(my_min, my);
2691 off = (
FFMAX(-my_min, my_max) + 63) >> 6;
2700 int16_t *
block,
int i,
uint8_t *dest,
int line_size,
int qscale)
2716 int16_t *
block,
int i,
uint8_t *dest,
int line_size,
int qscale)
2738 memset(s->
ac_val[0][xy ], 0, 32 *
sizeof(int16_t));
2739 memset(s->
ac_val[0][xy + wrap], 0, 32 *
sizeof(int16_t));
2752 memset(s->
ac_val[1][xy], 0, 16 *
sizeof(int16_t));
2753 memset(s->
ac_val[2][xy], 0, 16 *
sizeof(int16_t));
2770 int lowres_flag,
int is_mpeg12)
2785 for(j=0; j<64; j++){
2811 uint8_t *dest_y, *dest_cb, *dest_cr;
2812 int dct_linesize, dct_offset;
2818 const int block_size= lowres_flag ? 8>>s->
avctx->
lowres : 8;
2837 dct_offset = s->
interlaced_dct ? linesize : linesize * block_size;
2841 dest_cb= s->
dest[1];
2842 dest_cr= s->
dest[2];
2925 add_dct(s, block[0], 0, dest_y , dct_linesize);
2926 add_dct(s, block[1], 1, dest_y + block_size, dct_linesize);
2927 add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize);
2928 add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
2932 add_dct(s, block[4], 4, dest_cb, uvlinesize);
2933 add_dct(s, block[5], 5, dest_cr, uvlinesize);
2937 dct_offset = s->
interlaced_dct ? uvlinesize : uvlinesize*block_size;
2939 add_dct(s, block[4], 4, dest_cb, dct_linesize);
2940 add_dct(s, block[5], 5, dest_cr, dct_linesize);
2941 add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize);
2942 add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize);
2944 add_dct(s, block[8], 8, dest_cb+block_size, dct_linesize);
2945 add_dct(s, block[9], 9, dest_cr+block_size, dct_linesize);
2946 add_dct(s, block[10], 10, dest_cb+block_size+dct_offset, dct_linesize);
2947 add_dct(s, block[11], 11, dest_cr+block_size+dct_offset, dct_linesize);
2952 else if (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) {
2959 put_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->
qscale);
2960 put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->
qscale);
2961 put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->
qscale);
2978 s->
dsp.
idct_put(dest_y + block_size, dct_linesize, block[1]);
2979 s->
dsp.
idct_put(dest_y + dct_offset , dct_linesize, block[2]);
2980 s->
dsp.
idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]);
2989 dct_offset = s->
interlaced_dct ? uvlinesize : uvlinesize*block_size;
2993 s->
dsp.
idct_put(dest_cb + dct_offset, dct_linesize, block[6]);
2994 s->
dsp.
idct_put(dest_cr + dct_offset, dct_linesize, block[7]);
2996 s->
dsp.
idct_put(dest_cb + block_size, dct_linesize, block[8]);
2997 s->
dsp.
idct_put(dest_cr + block_size, dct_linesize, block[9]);
2998 s->
dsp.
idct_put(dest_cb + block_size + dct_offset, dct_linesize, block[10]);
2999 s->
dsp.
idct_put(dest_cr + block_size + dct_offset, dct_linesize, block[11]);
3029 Picture *last,
int y,
int h,
int picture_structure,
3034 const int field_pic = picture_structure !=
PICT_FRAME;
3065 offset[2]= (y >> vshift) * src->
linesize[1];
3073 y, picture_structure, h);
3104 s->
dest[0] += s->
mb_y * linesize << mb_size;
3108 s->
dest[0] += (s->
mb_y>>1) * linesize << mb_size;
3132 for(i=0; i<=last; i++){
3133 const int j= scantable[i];
3138 for(i=0; i<=last; i++){
3139 const int j= scantable[i];
3140 const int perm_j= permutation[j];
3141 block[perm_j]= temp[j];
3149 if(s==NULL || s->
picture==NULL)
3180 else if (qscale > 31)
3196 #if CONFIG_ERROR_RESILIENCE