71 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
72 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
77 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
78 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
79 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
80 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
81 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
82 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
83 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
84 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
89 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
90 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
91 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
92 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
93 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
94 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
95 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
96 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
101 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
102 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
103 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
104 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
105 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
106 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
107 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
108 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
113 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
114 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
115 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
116 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
117 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
118 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
119 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
120 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
153 for (i = 0; i < 3; i++) {
154 uint32_t tmp = *state << 8;
155 *state = tmp + *(p++);
156 if (tmp == 0x100 || p == end)
161 if (p[-1] > 1 ) p += 3;
162 else if (p[-2] ) p += 2;
163 else if (p[-3]|(p[-1]-1)) p++;
170 p =
FFMIN(p, end) - 4;
266 if (r < 0 || !pic->
f.type || !pic->
f.
data[0]) {
276 "get_buffer() failed (stride changed)\n");
283 "get_buffer() failed (uv stride mismatch)\n");
308 assert(pic->
f.
data[0]);
312 assert(!pic->
f.
data[0]);
324 mb_array_size *
sizeof(int16_t), fail)
326 mb_array_size *
sizeof(int16_t), fail)
328 mb_array_size *
sizeof(int8_t ), fail)
332 mb_array_size *
sizeof(uint8_t) + 2, fail)
334 (big_mb_num + s->
mb_stride) *
sizeof(uint8_t),
337 (big_mb_num + s->
mb_stride) *
sizeof(uint32_t),
342 for (i = 0; i < 2; i++) {
344 2 * (b4_array_size + 4) *
sizeof(int16_t),
348 4 * mb_array_size *
sizeof(uint8_t), fail)
353 for (i = 0; i < 2; i++) {
355 2 * (b8_array_size + 4) *
sizeof(int16_t),
359 4 * mb_array_size *
sizeof(uint8_t), fail)
365 64 * mb_array_size *
sizeof(
DCTELEM) * 6, fail)
401 for (i = 0; i < 2; i++) {
407 for (i = 0; i < 4; i++) {
419 int yc_size = y_size + 2 * c_size;
425 (s->
width + 64) * 2 * 21 * 2, fail);
430 (s->
width + 64) * 4 * 16 * 2 *
sizeof(uint8_t), fail)
442 2 * 64 *
sizeof(
int), fail)
448 for (i = 0; i < 12; i++) {
455 yc_size *
sizeof(int16_t) * 16, fail);
488 #define COPY(a) bak->a = src->a
489 COPY(edge_emu_buffer);
494 COPY(obmc_scratchpad);
501 COPY(me.map_generation);
522 for (i = 0; i < 12; i++) {
534 if (dst == src || !
s1->context_initialized)
562 (
char *) &
s1->last_picture_ptr - (
char *) &
s1->last_picture);
574 (
char *) &
s1->shape - (
char *) &
s1->time_increment_bits);
584 if (
s1->bitstream_buffer) {
585 if (
s1->bitstream_buffer_size +
589 s1->allocated_bitstream_buffer_size);
592 s1->bitstream_buffer_size);
599 (
char *) &
s1->rtp_mode - (
char *) &
s1->progressive_sequence);
601 if (!
s1->first_field) {
603 if (
s1->current_picture_ptr)
660 int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
675 "decoding to PIX_FMT_NONE is not supported.\n");
686 " reducing to %d\n", nb_slices, max_slices);
687 nb_slices = max_slices;
732 yc_size = y_size + 2 * c_size;
748 mv_table_size * 2 *
sizeof(int16_t), fail);
750 mv_table_size * 2 *
sizeof(int16_t), fail);
752 mv_table_size * 2 *
sizeof(int16_t), fail);
754 mv_table_size * 2 *
sizeof(int16_t), fail);
756 mv_table_size * 2 *
sizeof(int16_t), fail);
758 mv_table_size * 2 *
sizeof(int16_t), fail);
775 (
MAX_RUN + 1) * 2 *
sizeof(
int), fail);
781 sizeof(uint16_t), fail);
787 64 * 32 *
sizeof(
int), fail);
789 64 * 32 *
sizeof(
int), fail);
791 64 * 32 * 2 *
sizeof(uint16_t), fail);
793 64 * 32 * 2 *
sizeof(uint16_t), fail);
801 2 * 64 *
sizeof(uint16_t), fail);
815 mb_array_size *
sizeof(uint8_t), fail);
820 for (i = 0; i < 2; i++) {
822 for (j = 0; j < 2; j++) {
823 for (k = 0; k < 2; k++) {
826 mv_table_size * 2 *
sizeof(int16_t),
832 mb_array_size * 2 *
sizeof(uint8_t),
835 mv_table_size * 2 *
sizeof(int16_t),
841 mb_array_size * 2 *
sizeof(uint8_t),
852 mb_array_size *
sizeof(uint8_t), fail);
854 mb_array_size *
sizeof(uint8_t), fail);
861 yc_size *
sizeof(int16_t), fail);
865 for (i = 0; i < yc_size; i++)
894 for (i = 1; i < nb_slices; i++) {
899 for (i = 0; i < nb_slices; i++) {
903 (s->
mb_height * (i) + nb_slices / 2) / nb_slices;
905 (s->
mb_height * (i + 1) + nb_slices / 2) / nb_slices;
953 for (i = 0; i < 2; i++) {
954 for (j = 0; j < 2; j++) {
955 for (k = 0; k < 2; k++) {
1001 for (i = 0; i < 3; i++)
1012 uint8_t index_run[
MAX_RUN + 1];
1013 int last,
run,
level, start, end, i;
1020 for (last = 0; last < 2; last++) {
1029 memset(max_level, 0,
MAX_RUN + 1);
1031 memset(index_run, rl->
n,
MAX_RUN + 1);
1032 for (i = start; i < end; i++) {
1035 if (index_run[run] == rl->
n)
1037 if (level > max_level[run])
1039 if (run > max_run[level])
1043 rl->
max_level[last] = static_store[last];
1056 memcpy(rl->
index_run[last], index_run, MAX_RUN + 1);
1064 for (q = 0; q < 32; q++) {
1066 int qadd = (q - 1) | 1;
1080 }
else if (len < 0) {
1084 if (code == rl->
n) {
1090 if (code >= rl->
last) run += 192;
1142 for (intra = 0; intra < 2; intra++) {
1144 for (i = 0; i < 64; i++) {
1150 for (i = 0; i < 64; i++) {
1188 "releasing zombie picture\n");
1261 "warning: first frame is no keyframe\n");
1264 "allocate dummy last picture for field based first keyframe\n");
1317 for (i = 0; i < 4; i++) {
1402 assert(i < MAX_PICTURE_COUNT);
1434 static void draw_line(uint8_t *buf,
int sx,
int sy,
int ex,
int ey,
1439 sx = av_clip(sx, 0, w - 1);
1440 sy = av_clip(sy, 0, h - 1);
1441 ex = av_clip(ex, 0, w - 1);
1442 ey = av_clip(ey, 0, h - 1);
1444 buf[sy * stride + sx] +=
color;
1453 f = ((ey - sy) << 16) / ex;
1454 for (x = 0; x = ex; x++) {
1456 fr = (x *
f) & 0xFFFF;
1457 buf[y * stride + x] += (color * (0x10000 - fr)) >> 16;
1458 buf[(y + 1) * stride + x] += (color * fr ) >> 16;
1468 f = ((ex - sx) << 16) / ey;
1471 for (y = 0; y = ey; y++) {
1473 fr = (y *
f) & 0xFFFF;
1474 buf[y * stride + x] += (color * (0x10000 - fr)) >> 16;
1475 buf[y * stride + x + 1] += (color * fr ) >> 16;
1492 sx = av_clip(sx, -100, w + 100);
1493 sy = av_clip(sy, -100, h + 100);
1494 ex = av_clip(ex, -100, w + 100);
1495 ey = av_clip(ey, -100, h + 100);
1500 if (dx * dx + dy * dy > 3 * 3) {
1503 int length =
ff_sqrt((rx * rx + ry * ry) << 8);
1509 draw_line(buf, sx, sy, sx + rx, sy + ry, w, h, stride, color);
1510 draw_line(buf, sx, sy, sx - ry, sy + rx, w, h, stride, color);
1512 draw_line(buf, sx, sy, ex, ey, w, h, stride, color);
1548 for (x = 0; x < s->
mb_width; x++) {
1576 else if (
IS_GMC(mb_type))
1619 int h_chroma_shift, v_chroma_shift, block_height;
1623 const int mv_stride = (s->
mb_width << mv_sample_log2) +
1628 &h_chroma_shift, &v_chroma_shift);
1629 for (i = 0; i < 3; i++) {
1631 (i == 0) ? pict->
linesize[i] * height:
1632 pict->
linesize[i] * height >> v_chroma_shift);
1636 ptr = pict->
data[0];
1637 block_height = 16 >> v_chroma_shift;
1639 for (mb_y = 0; mb_y < s->
mb_height; mb_y++) {
1641 for (mb_x = 0; mb_x < s->
mb_width; mb_x++) {
1642 const int mb_index = mb_x + mb_y * s->
mb_stride;
1645 for (type = 0; type < 3; type++) {
1672 for (i = 0; i < 4; i++) {
1673 int sx = mb_x * 16 + 4 + 8 * (i & 1);
1674 int sy = mb_y * 16 + 4 + 8 * (i >> 1);
1675 int xy = (mb_x * 2 + (i & 1) +
1676 (mb_y * 2 + (i >> 1)) * mv_stride) << (mv_sample_log2 - 1);
1677 int mx = (pict->
motion_val[direction][xy][0] >> shift) + sx;
1678 int my = (pict->
motion_val[direction][xy][1] >> shift) + sy;
1684 for (i = 0; i < 2; i++) {
1685 int sx = mb_x * 16 + 8;
1686 int sy = mb_y * 16 + 4 + 8 * i;
1687 int xy = (mb_x * 2 + (mb_y * 2 + i) * mv_stride) << (mv_sample_log2 - 1);
1688 int mx = (pict->
motion_val[direction][xy][0] >> shift);
1689 int my = (pict->
motion_val[direction][xy][1] >> shift);
1694 draw_arrow(ptr, sx, sy, mx + sx, my + sy, width,
1699 for (i = 0; i < 2; i++) {
1700 int sx = mb_x * 16 + 4 + 8 * i;
1701 int sy = mb_y * 16 + 8;
1702 int xy = (mb_x * 2 + i + mb_y * 2 * mv_stride) << (mv_sample_log2 - 1);
1703 int mx = pict->
motion_val[direction][xy][0] >> shift;
1704 int my = pict->
motion_val[direction][xy][1] >> shift;
1709 draw_arrow(ptr, sx, sy, mx + sx, my + sy, width,
1713 int sx = mb_x * 16 + 8;
1714 int sy = mb_y * 16 + 8;
1715 int xy = (mb_x + mb_y * mv_stride) << mv_sample_log2;
1716 int mx = pict->
motion_val[direction][xy][0] >> shift + sx;
1717 int my = pict->
motion_val[direction][xy][1] >> shift + sy;
1723 uint64_t c = (pict->
qscale_table[mb_index] * 128 / 31) *
1724 0x0101010101010101ULL;
1726 for (y = 0; y < block_height; y++) {
1727 *(uint64_t *)(pict->
data[1] + 8 * mb_x +
1728 (block_height * mb_y + y) *
1730 *(uint64_t *)(pict->
data[2] + 8 * mb_x +
1731 (block_height * mb_y + y) *
1737 int mb_type = pict->
mb_type[mb_index];
1740 #define COLOR(theta, r) \
1741 u = (int)(128 + r * cos(theta * 3.141592 / 180)); \
1742 v = (int)(128 + r * sin(theta * 3.141592 / 180));
1759 }
else if (
IS_GMC(mb_type)) {
1761 }
else if (
IS_SKIP(mb_type)) {
1772 u *= 0x0101010101010101ULL;
1773 v *= 0x0101010101010101ULL;
1774 for (y = 0; y < block_height; y++) {
1775 *(uint64_t *)(pict->
data[1] + 8 * mb_x +
1776 (block_height * mb_y + y) * pict->
linesize[1]) = u;
1777 *(uint64_t *)(pict->
data[2] + 8 * mb_x +
1778 (block_height * mb_y + y) * pict->
linesize[2]) = v;
1783 *(uint64_t *)(pict->
data[0] + 16 * mb_x + 0 +
1784 (16 * mb_y + 8) * pict->
linesize[0]) ^= 0x8080808080808080ULL;
1785 *(uint64_t *)(pict->
data[0] + 16 * mb_x + 8 +
1786 (16 * mb_y + 8) * pict->
linesize[0]) ^= 0x8080808080808080ULL;
1789 for (y = 0; y < 16; y++)
1790 pict->
data[0][16 * mb_x + 8 + (16 * mb_y + y) *
1793 if (
IS_8X8(mb_type) && mv_sample_log2 >= 2) {
1794 int dm = 1 << (mv_sample_log2 - 2);
1795 for (i = 0; i < 4; i++) {
1796 int sx = mb_x * 16 + 8 * (i & 1);
1797 int sy = mb_y * 16 + 8 * (i >> 1);
1798 int xy = (mb_x * 2 + (i & 1) +
1799 (mb_y * 2 + (i >> 1)) * mv_stride) << (mv_sample_log2 - 1);
1802 if (mv[0] != mv[dm] ||
1803 mv[dm * mv_stride] != mv[dm * (mv_stride + 1)])
1804 for (y = 0; y < 8; y++)
1805 pict->
data[0][sx + 4 + (sy + y) * pict->
linesize[0]] ^= 0x80;
1806 if (mv[0] != mv[dm * mv_stride] || mv[dm] != mv[dm * (mv_stride + 1)])
1807 *(uint64_t *)(pict->
data[0] + sx + (sy + 4) *
1808 pict->
linesize[0]) ^= 0x8080808080808080ULL;
1824 uint8_t *dest, uint8_t *src,
1825 int field_based,
int field_select,
1826 int src_x,
int src_y,
1828 int h_edge_pos,
int v_edge_pos,
1830 int motion_x,
int motion_y)
1833 const int op_index =
FFMIN(lowres, 2);
1834 const int s_mask = (2 <<
lowres) - 1;
1843 sx = motion_x & s_mask;
1844 sy = motion_y & s_mask;
1845 src_x += motion_x >> lowres + 1;
1846 src_y += motion_y >> lowres + 1;
1848 src += src_y * stride + src_x;
1850 if ((
unsigned)src_x >
FFMAX( h_edge_pos - (!!sx) - w, 0) ||
1851 (unsigned)src_y >
FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
1853 (h + 1) << field_based, src_x,
1854 src_y << field_based,
1861 sx = (sx << 2) >>
lowres;
1862 sy = (sy << 2) >>
lowres;
1865 pix_op[op_index](dest, src,
stride, h, sx, sy);
1877 uint8_t **ref_picture,
1879 int motion_x,
int motion_y,
1882 uint8_t *ptr_y, *ptr_cb, *ptr_cr;
1883 int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, uvlinesize, linesize, sx, sy,
1886 const int op_index =
FFMIN(lowres, 2);
1887 const int block_s = 8>>
lowres;
1888 const int s_mask = (2 <<
lowres) - 1;
1901 motion_y += (bottom_field - field_select) * (1 << lowres - 1);
1904 sx = motion_x & s_mask;
1905 sy = motion_y & s_mask;
1906 src_x = s->
mb_x * 2 * block_s + (motion_x >> lowres + 1);
1907 src_y = (mb_y * 2 * block_s >> field_based) + (motion_y >> lowres + 1);
1910 uvsx = ((motion_x >> 1) & s_mask) | (sx & 1);
1911 uvsy = ((motion_y >> 1) & s_mask) | (sy & 1);
1912 uvsrc_x = src_x >> 1;
1913 uvsrc_y = src_y >> 1;
1918 uvsx = (2 * mx) & s_mask;
1919 uvsy = (2 * my) & s_mask;
1920 uvsrc_x = s->
mb_x * block_s + (mx >>
lowres);
1921 uvsrc_y = mb_y * block_s + (my >>
lowres);
1927 uvsrc_x = s->
mb_x * block_s + (mx >> lowres + 1);
1928 uvsrc_y = (mb_y * block_s >> field_based) + (my >> lowres + 1);
1931 ptr_y = ref_picture[0] + src_y * linesize + src_x;
1932 ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
1933 ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
1935 if ((
unsigned) src_x >
FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) ||
1936 (unsigned) src_y >
FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
1939 src_x, src_y << field_based, h_edge_pos,
1946 uvsrc_x, uvsrc_y << field_based,
1947 h_edge_pos >> 1, v_edge_pos >> 1);
1950 uvsrc_x, uvsrc_y << field_based,
1951 h_edge_pos >> 1, v_edge_pos >> 1);
1953 ptr_cr = uvbuf + 16;
1970 sx = (sx << 2) >>
lowres;
1971 sy = (sy << 2) >>
lowres;
1972 pix_op[lowres - 1](dest_y, ptr_y, linesize, h, sx, sy);
1975 uvsx = (uvsx << 2) >>
lowres;
1976 uvsy = (uvsy << 2) >>
lowres;
1977 pix_op[op_index](dest_cb, ptr_cb, uvlinesize, h >> s->
chroma_y_shift,
1979 pix_op[op_index](dest_cr, ptr_cr, uvlinesize, h >> s->
chroma_y_shift,
1986 uint8_t *dest_cb, uint8_t *dest_cr,
1987 uint8_t **ref_picture,
1992 const int op_index =
FFMIN(lowres, 2);
1993 const int block_s = 8 >>
lowres;
1994 const int s_mask = (2 <<
lowres) - 1;
1995 const int h_edge_pos = s->
h_edge_pos >> lowres + 1;
1996 const int v_edge_pos = s->
v_edge_pos >> lowres + 1;
1997 int emu = 0, src_x, src_y, offset, sx, sy;
2012 src_x = s->
mb_x * block_s + (mx >> lowres + 1);
2013 src_y = s->
mb_y * block_s + (my >> lowres + 1);
2016 ptr = ref_picture[1] + offset;
2018 if ((
unsigned) src_x >
FFMAX(h_edge_pos - (!!sx) - block_s, 0) ||
2019 (unsigned) src_y >
FFMAX(v_edge_pos - (!!sy) - block_s, 0)) {
2021 9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
2026 sx = (sx << 2) >>
lowres;
2027 sy = (sy << 2) >>
lowres;
2028 pix_op[op_index](dest_cb, ptr, s->
uvlinesize, block_s, sx, sy);
2030 ptr = ref_picture[2] + offset;
2033 src_x, src_y, h_edge_pos, v_edge_pos);
2036 pix_op[op_index](dest_cr, ptr, s->
uvlinesize, block_s, sx, sy);
2051 uint8_t *dest_y, uint8_t *dest_cb,
2053 int dir, uint8_t **ref_picture,
2059 const int block_s = 8 >>
lowres;
2068 ref_picture, pix_op,
2069 s->
mv[dir][0][0], s->
mv[dir][0][1],
2075 for (i = 0; i < 4; i++) {
2078 ref_picture[0], 0, 0,
2079 (2 * mb_x + (i & 1)) * block_s,
2080 (2 * mb_y + (i >> 1)) * block_s,
2083 block_s, block_s, pix_op,
2084 s->
mv[dir][i][0], s->
mv[dir][i][1]);
2086 mx += s->
mv[dir][i][0];
2087 my += s->
mv[dir][i][1];
2099 ref_picture, pix_op,
2100 s->
mv[dir][0][0], s->
mv[dir][0][1],
2105 ref_picture, pix_op,
2106 s->
mv[dir][1][0], s->
mv[dir][1][1],
2116 ref_picture, pix_op,
2118 s->
mv[dir][0][1], 2 * block_s, mb_y >> 1);
2122 for (i = 0; i < 2; i++) {
2123 uint8_t **ref2picture;
2127 ref2picture = ref_picture;
2134 ref2picture, pix_op,
2135 s->
mv[dir][i][0], s->
mv[dir][i][1] +
2136 2 * block_s * i, block_s, mb_y >> 1);
2138 dest_y += 2 * block_s * s->
linesize;
2145 for (i = 0; i < 2; i++) {
2147 for (j = 0; j < 2; j++) {
2150 ref_picture, pix_op,
2151 s->
mv[dir][2 * i + j][0],
2152 s->
mv[dir][2 * i + j][1],
2158 for (i = 0; i < 2; i++) {
2161 ref_picture, pix_op,
2162 s->
mv[dir][2 * i][0],s->
mv[dir][2 * i][1],
2163 2 * block_s, mb_y >> 1);
2186 int my_max = INT_MIN, my_min = INT_MAX, qpel_shift = !s->
quarter_sample;
2187 int my,
off, i, mvs;
2205 for (i = 0; i < mvs; i++) {
2206 my = s->
mv[dir][i][1]<<qpel_shift;
2207 my_max =
FFMAX(my_max, my);
2208 my_min =
FFMIN(my_min, my);
2211 off = (
FFMAX(-my_min, my_max) + 63) >> 6;
2220 DCTELEM *
block,
int i, uint8_t *dest,
int line_size,
int qscale)
2236 DCTELEM *
block,
int i, uint8_t *dest,
int line_size,
int qscale)
2258 memset(s->
ac_val[0][xy ], 0, 32 *
sizeof(int16_t));
2259 memset(s->
ac_val[0][xy + wrap], 0, 32 *
sizeof(int16_t));
2272 memset(s->
ac_val[1][xy], 0, 16 *
sizeof(int16_t));
2273 memset(s->
ac_val[2][xy], 0, 16 *
sizeof(int16_t));
2290 int lowres_flag,
int is_mpeg12)
2304 for(j=0; j<64; j++){
2329 uint8_t *dest_y, *dest_cb, *dest_cr;
2330 int dct_linesize, dct_offset;
2336 const int block_size= lowres_flag ? 8>>s->
avctx->
lowres : 8;
2355 dct_offset = s->
interlaced_dct ? linesize : linesize * block_size;
2359 dest_cb= s->
dest[1];
2360 dest_cr= s->
dest[2];
2439 add_dct(s, block[0], 0, dest_y , dct_linesize);
2440 add_dct(s, block[1], 1, dest_y + block_size, dct_linesize);
2441 add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize);
2442 add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
2446 add_dct(s, block[4], 4, dest_cb, uvlinesize);
2447 add_dct(s, block[5], 5, dest_cr, uvlinesize);
2453 add_dct(s, block[4], 4, dest_cb, dct_linesize);
2454 add_dct(s, block[5], 5, dest_cr, dct_linesize);
2455 add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize);
2456 add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize);
2458 add_dct(s, block[8], 8, dest_cb+8, dct_linesize);
2459 add_dct(s, block[9], 9, dest_cr+8, dct_linesize);
2460 add_dct(s, block[10], 10, dest_cb+8+dct_offset, dct_linesize);
2461 add_dct(s, block[11], 11, dest_cr+8+dct_offset, dct_linesize);
2473 put_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->
qscale);
2474 put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->
qscale);
2475 put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->
qscale);
2492 s->
dsp.
idct_put(dest_y + block_size, dct_linesize, block[1]);
2493 s->
dsp.
idct_put(dest_y + dct_offset , dct_linesize, block[2]);
2494 s->
dsp.
idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]);
2507 s->
dsp.
idct_put(dest_cb + dct_offset, dct_linesize, block[6]);
2508 s->
dsp.
idct_put(dest_cr + dct_offset, dct_linesize, block[7]);
2510 s->
dsp.
idct_put(dest_cb + 8, dct_linesize, block[8]);
2511 s->
dsp.
idct_put(dest_cr + 8, dct_linesize, block[9]);
2512 s->
dsp.
idct_put(dest_cb + 8 + dct_offset, dct_linesize, block[10]);
2513 s->
dsp.
idct_put(dest_cr + 8 + dct_offset, dct_linesize, block[11]);
2555 int sides = 0, edge_h;
2628 s->
dest[0] += s->
mb_y * linesize << mb_size;
2632 s->
dest[0] += (s->
mb_y>>1) * linesize << mb_size;
2670 int i,
level, nCoeffs;
2671 const uint16_t *quant_matrix;
2681 for(i=1;i<=nCoeffs;i++) {
2687 level = (int)(level * qscale * quant_matrix[j]) >> 3;
2688 level = (level - 1) | 1;
2691 level = (int)(level * qscale * quant_matrix[j]) >> 3;
2692 level = (level - 1) | 1;
2702 int i,
level, nCoeffs;
2703 const uint16_t *quant_matrix;
2708 for(i=0; i<=nCoeffs; i++) {
2714 level = (((level << 1) + 1) * qscale *
2715 ((int) (quant_matrix[j]))) >> 4;
2716 level = (level - 1) | 1;
2719 level = (((level << 1) + 1) * qscale *
2720 ((int) (quant_matrix[j]))) >> 4;
2721 level = (level - 1) | 1;
2731 int i,
level, nCoeffs;
2732 const uint16_t *quant_matrix;
2742 for(i=1;i<=nCoeffs;i++) {
2748 level = (int)(level * qscale * quant_matrix[j]) >> 3;
2751 level = (int)(level * qscale * quant_matrix[j]) >> 3;
2761 int i,
level, nCoeffs;
2762 const uint16_t *quant_matrix;
2773 for(i=1;i<=nCoeffs;i++) {
2779 level = (int)(level * qscale * quant_matrix[j]) >> 3;
2782 level = (int)(level * qscale * quant_matrix[j]) >> 3;
2794 int i,
level, nCoeffs;
2795 const uint16_t *quant_matrix;
2802 for(i=0; i<=nCoeffs; i++) {
2808 level = (((level << 1) + 1) * qscale *
2809 ((int) (quant_matrix[j]))) >> 4;
2812 level = (((level << 1) + 1) * qscale *
2813 ((int) (quant_matrix[j]))) >> 4;
2825 int i,
level, qmul, qadd;
2837 qadd = (qscale - 1) | 1;
2846 for(i=1; i<=nCoeffs; i++) {
2850 level = level * qmul - qadd;
2852 level = level * qmul + qadd;
2862 int i,
level, qmul, qadd;
2867 qadd = (qscale - 1) | 1;
2872 for(i=0; i<=nCoeffs; i++) {
2876 level = level * qmul - qadd;
2878 level = level * qmul + qadd;
2892 else if (qscale > 31)
int bitstream_buffer_size
uint8_t * scratchpad
data area for the ME algo, so that the ME does not need to malloc/free
#define PICT_BOTTOM_FIELD
#define FF_DEBUG_VIS_MB_TYPE
int last
number of values for last = 0
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
void(* emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize, int block_w, int block_h, int src_x, int src_y, int w, int h)
Motion estimation with emulated edge values.
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
int16_t(* b_bidir_back_mv_table_base)[2]
void ff_init_block_index(MpegEncContext *s)
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
unsigned int stream_codec_tag
fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A')...
#define MAX_PICTURE_COUNT
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
ScanTable intra_v_scantable
#define SLICE_FLAG_ALLOW_FIELD
allow draw_horiz_band() with field slices (MPEG2 field pics)
const uint8_t ff_zigzag_direct[64]
void ff_release_unused_pictures(MpegEncContext *s, int remove_current)
int time_increment_bits
number of bits to represent the fractional part of time
int qstride
QP store stride.
AVPanScan * pan_scan
Pan scan.
int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared)
Allocate a Picture.
int16_t(* p_mv_table)[2]
MV table (1MV per MB) p-frame encoding.
uint8_t * rd_scratchpad
scratchpad for rate distortion mb decision
AV_WL32 AV_WL24 AV_WL16 AV_RB32
static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s, DCTELEM *block, int n, int qscale)
int start_mb_y
start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) ...
#define MV_TYPE_FIELD
2 vectors, one per field
void MPV_common_init_mmx(MpegEncContext *s)
const uint8_t * y_dc_scale_table
qscale -> y_dc_scale table
uint8_t * mb_mean
Table for MB luminance.
int coded_width
Bitstream width / height, may be different from width/height if lowres enabled.
av_cold int ff_dct_common_init(MpegEncContext *s)
void(* dct_unquantize_mpeg2_inter)(struct MpegEncContext *s, DCTELEM *block, int n, int qscale)
static void chroma_4mv_motion_lowres(MpegEncContext *s, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture, h264_chroma_mc_func *pix_op, int mx, int my)
uint8_t * coded_block_base
AVFrame * coded_frame
the picture in the bitstream
int end_mb_y
end mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) ...
uint16_t * mb_var
Table for MB variances.
static void free_frame_buffer(MpegEncContext *s, Picture *pic)
Release a frame buffer.
int16_t(*[3] ac_val)[16]
used for for mpeg4 AC prediction, all 3 arrays must be continuous
#define AV_LOG_WARNING
Something somehow does not look correct.
void(* idct_add)(uint8_t *dest, int line_size, DCTELEM *block)
block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
void * hwaccel_picture_private
hardware accelerator private data (Libav-allocated)
int v_edge_pos
horizontal / vertical position of the right/bottom edge (pixel replication)
hardware decoding through VDA
int msmpeg4_version
0=not msmpeg4, 1=mp41, 2=mp42, 3=mp43/divx3 4=wmv1/7 5=wmv2/8
void(* draw_edges)(uint8_t *buf, int wrap, int width, int height, int w, int h, int sides)
static const uint8_t mpeg2_dc_scale_table3[128]
void ff_xvmc_field_end(MpegEncContext *s)
Complete frame/field rendering by passing any remaining blocks.
uint8_t * bitstream_buffer
void(* dct_unquantize_h263_inter)(struct MpegEncContext *s, DCTELEM *block, int n, int qscale)
void ff_init_rl(RLTable *rl, uint8_t static_store[2][2 *MAX_RUN+MAX_LEVEL+3])
int16_t(*[2] motion_val_base)[2]
void MPV_common_init_arm(MpegEncContext *s)
int field_picture
whether or not the picture was encoded in separate fields
void(* dct_unquantize_mpeg2_intra)(struct MpegEncContext *s, DCTELEM *block, int n, int qscale)
int16_t(*[2][2] p_field_mv_table)[2]
MV table (2MV per MB) interlaced p-frame encoding.
int picture_range_end
the part of picture that this context can allocate in
static void dct_unquantize_h263_inter_c(MpegEncContext *s, DCTELEM *block, int n, int qscale)
int16_t(* p_mv_table_base)[2]
uint32_t * score_map
map to store the scores
const int8_t * table_level
static void free_duplicate_context(MpegEncContext *s)
#define FF_DEBUG_VIS_MV_B_FOR
int mb_num
number of MBs of a picture
int ff_xvmc_field_start(MpegEncContext *s, AVCodecContext *avctx)
Find and store the surfaces that are used as reference frames.
static void free_picture(MpegEncContext *s, Picture *pic)
Deallocate a picture.
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
int h263_aic
Advanded INTRA Coding (AIC)
int16_t(* b_back_mv_table)[2]
MV table (1MV per MB) backward mode b-frame encoding.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
int encoding
true if we are encoding (vs decoding)
static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s, DCTELEM *block, int n, int qscale)
int16_t(* b_back_mv_table_base)[2]
static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src)
#define USES_LIST(a, list)
does this mb use listX, note does not work if subMBs
void ff_clean_intra_table_entries(MpegEncContext *s)
Clean dc, ac, coded_block for the current non-intra MB.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
void MPV_common_init_mlib(MpegEncContext *s)
uint8_t * visualization_buffer[3]
temporary buffer vor MV visualization
struct AVHWAccel * hwaccel
Hardware accelerator in use.
int picture_in_gop_number
0-> first pic in gop, ...
static av_const unsigned int ff_sqrt(unsigned int a)
int8_t * max_run[2]
encoding & decoding
const uint8_t ff_alternate_vertical_scan[64]
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
DCTELEM(*[12] pblocks)[64]
Picture ** input_picture
next pictures on display order for encoding
enum OutputFormat out_format
output format
void(* qpel_mc_func)(uint8_t *dst, uint8_t *src, int stride)
h264_chroma_mc_func avg_h264_chroma_pixels_tab[3]
enum PixelFormat ff_hwaccel_pixfmt_list_420[]
uint16_t(* dct_offset)[64]
#define FF_DEBUG_VIS_MV_B_BACK
uint8_t * pred_dir_table
used to store pred_dir for partitioned decoding
void MPV_common_init_bfin(MpegEncContext *s)
qpel_mc_func(* qpel_put)[16]
static void dct_unquantize_h263_intra_c(MpegEncContext *s, DCTELEM *block, int n, int qscale)
uint8_t motion_subsample_log2
log2 of the size of the block which a single vector in motion_val represents: (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
int no_rounding
apply no rounding to motion compensation (MPEG4, msmpeg4, ...) for b-frames rounding mode is always 0...
Picture current_picture
copy of the current picture structure.
op_pixels_func avg_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
int16_t(* b_bidir_forw_mv_table)[2]
MV table (1MV per MB) bidir mode b-frame encoding.
void(* dct_unquantize_intra)(struct MpegEncContext *s, DCTELEM *block, int n, int qscale)
void(* dct_unquantize_inter)(struct MpegEncContext *s, DCTELEM *block, int n, int qscale)
int8_t * max_level[2]
encoding & decoding
uint16_t pp_time
time distance between the last 2 p,s,i frames
uint8_t idct_permutation[64]
idct input permutation.
uint8_t * b_scratchpad
scratchpad used for writing into write only buffers
int flags2
AVCodecContext.flags2.
static int hpel_motion_lowres(MpegEncContext *s, uint8_t *dest, uint8_t *src, int field_based, int field_select, int src_x, int src_y, int width, int height, int stride, int h_edge_pos, int v_edge_pos, int w, int h, h264_chroma_mc_func *pix_op, int motion_x, int motion_y)
int interlaced_frame
The content of the picture is interlaced.
int mb_height
number of MBs horizontally & vertically
int lowres
low resolution decoding, 1-> 1/2 size, 2->1/4 size
int codec_tag
internal codec_tag upper case converted from avctx codec_tag
enum PixelFormat ff_pixfmt_list_420[]
void MPV_common_end(MpegEncContext *s)
char * stats_out
pass1 encoding statistics output buffer
void(* dct_unquantize_mpeg1_intra)(struct MpegEncContext *s, DCTELEM *block, int n, int qscale)
int16_t(*[2][2] p_field_mv_table_base)[2]
#define FF_BUFFER_TYPE_INTERNAL
static void update_noise_reduction(MpegEncContext *s)
av_cold void dsputil_init(DSPContext *c, AVCodecContext *avctx)
void ff_set_qscale(MpegEncContext *s, int qscale)
set qscale and update qscale dependent variables.
#define CODEC_FLAG_GRAY
Only decode/encode grayscale.
#define ROUNDED_DIV(a, b)
int(* q_inter_matrix)[64]
void ff_xvmc_decode_mb(MpegEncContext *s)
Synthesize the data needed by XvMC to render one macroblock of data.
preferred ID for MPEG-1/2 video decoding
uint8_t * error_status_table
table of the error status of each MB
int(* q_intra_matrix)[64]
precomputed matrix (combine qscale and DCT renorm)
int intra_only
if true, only intra pictures are generated
int16_t * dc_val[3]
used for mpeg4 DC prediction, all 3 arrays must be continuous
int h263_plus
h263 plus headers
int slice_context_count
number of used thread_contexts
int last_non_b_pict_type
used for mpeg4 gmc b-frames & ratecontrol
HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer. ...
int stream_codec_tag
internal stream_codec_tag upper case converted from avctx stream_codec_tag
int last_dc[3]
last DC values for MPEG1
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static int ff_h263_round_chroma(int x)
Multithreading support functions.
int mb_skipped
MUST BE SET only during DECODING.
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
int partitioned_frame
is current frame partitioned
int is_copy
Whether the parent AVCodecContext is a copy of the context which had init() called on it...
short * dct_coeff
DCT coefficients.
const uint8_t ff_alternate_horizontal_scan[64]
void(* idct_put)(uint8_t *dest, int line_size, DCTELEM *block)
block -> idct -> clip to unsigned 8 bit -> dest.
int unrestricted_mv
mv can point outside of the coded picture
int active_thread_type
Which multithreading methods are in use by the codec.
int last_lambda_for[5]
last lambda for a specific pict type
int capabilities
Codec capabilities.
uint8_t * edge_emu_buffer
temporary buffer for if MVs point to out-of-frame data
uint8_t * base[AV_NUM_DATA_POINTERS]
pointer to the first allocated byte of the picture.
#define FF_BUFFER_TYPE_USER
direct rendering buffers (image is (de)allocated by user)
#define REBASE_PICTURE(pic, new_ctx, old_ctx)
static enum AVDiscard skip_idct
int overread_index
the index into ParseContext.buffer of the overread bytes
void av_log(void *avcl, int level, const char *fmt,...)
void(* h264_chroma_mc_func)(uint8_t *dst, uint8_t *src, int srcStride, int h, int x, int y)
int quarter_sample
1->qpel, 0->half pel ME/MC
uint16_t * mb_type
Table for candidate MB types for encoding.
static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color)
Draw a line from (ex, ey) -> (sx, sy).
int low_delay
no reordering needed / has no b-frames
op_pixels_func put_no_rnd_pixels_tab[4][4]
Halfpel motion compensation with no rounding (a+b)>>1.
static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s, DCTELEM *block, int n, int qscale)
VLC vlc
decoding only deprecated FIXME remove
uint8_t *[2][2] b_field_select_table
const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB]
The array of all the pixel format descriptors.
#define AV_NUM_DATA_POINTERS
void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64])
h264_chroma_mc_func put_h264_chroma_pixels_tab[3]
h264 Chroma MC
int priv_data_size
Size of HW accelerator private data.
#define CODEC_FLAG_EMU_EDGE
Don't draw edges.
void MPV_frame_end(MpegEncContext *s)
int picture_count
number of allocated pictures (MAX_PICTURE_COUNT * avctx->thread_count)
static const uint8_t ff_default_chroma_qscale_table[32]
void ff_mpeg_flush(AVCodecContext *avctx)
static av_always_inline void emms_c(void)
Empty mmx state.
int coded_picture_number
used to set pic->coded_picture_number, should not be used for/by anything else
void avcodec_default_free_buffers(AVCodecContext *s)
The simplest mpeg encoder (well, it was the simplest!).
int n
number of entries of table_vlc minus 1
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
void(* dct_unquantize_mpeg1_inter)(struct MpegEncContext *s, DCTELEM *block, int n, int qscale)
void(* draw_horiz_band)(struct AVCodecContext *s, const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], int y, int type, int height)
If non NULL, 'draw_horiz_band' is called by the libavcodec decoder to draw a horizontal band...
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
#define FF_THREAD_FRAME
Decode more than one frame at once.
int overread
the number of bytes which where irreversibly read from the next frame
uint16_t(* q_inter_matrix16)[2][64]
int next_p_frame_damaged
set if the next p frame is damaged, to avoid showing trashed b frames
void MPV_decode_defaults(MpegEncContext *s)
Set the given MpegEncContext to defaults for decoding.
int width
picture width / height.
uint8_t * mbskip_table
used to avoid copy if macroblock skipped (for black regions for example) and used for b-frame encodin...
int type
type of the buffer (to keep track of who has to deallocate data[*])
Picture * current_picture_ptr
pointer to the current picture
void ff_copy_picture(Picture *dst, Picture *src)
static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], int lowres_flag, int is_mpeg12)
unsigned int allocated_bitstream_buffer_size
int16_t(* ac_val_base)[16]
uint16_t(* q_intra_matrix16)[2][64]
identical to the above but for MMX & these are not permutated, second 64 entries are bias ...
#define FF_THREAD_SLICE
Decode more than one part of a single frame at once.
int16_t(*[2][2][2] b_field_mv_table_base)[2]
int quality
quality (between 1 (good) and FF_LAMBDA_MAX (bad))
int(* ac_stats)[2][MAX_LEVEL+1][MAX_RUN+1][2]
[mb_intra][isChroma][level][run][last]
int16_t(* b_forw_mv_table_base)[2]
int block_last_index[12]
last non zero coefficient in block
int mb_decision
macroblock decision mode
uint8_t * mbintra_table
used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding
int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
RL_VLC_ELEM * rl_vlc[32]
decoding only
av_cold int MPV_common_init(MpegEncContext *s)
init common structure for both encoder and decoder.
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
int block_index[6]
index to current MB in block based arrays with edges
int xvmc_acceleration
XVideo Motion Acceleration.
int * mb_index2xy
mb_index -> mb_x + mb_y*mb_stride
int first_field
is 1 for the first field of a field picture 0 otherwise
void(* op_pixels_func)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
static const int8_t mv[256][2]
uint32_t * mb_type
macroblock type table mb_type_base + mb_width + 2
#define MV_TYPE_16X16
1 vector for the whole mb
uint16_t * mc_mb_var
Table for motion compensated MB variances.
int16_t(* b_bidir_forw_mv_table_base)[2]
const uint8_t *const ff_mpeg2_dc_scale_table[4]
void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift)
int coded_picture_number
picture number in bitstream order
const uint8_t * avpriv_mpv_find_start_code(const uint8_t *restrict p, const uint8_t *end, uint32_t *restrict state)
uint16_t inter_matrix[64]
void MPV_common_init_mmi(MpegEncContext *s)
struct MpegEncContext * thread_context[MAX_THREADS]
void ff_thread_await_progress(AVFrame *f, int n, int field)
Wait for earlier decoding threads to finish reference pictures.
int8_t * qscale_table_base
static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s, DCTELEM *block, int n, int qscale)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
#define FF_BUFFER_TYPE_COPY
Just a (modified) copy of some other buffer, don't deallocate anything.
discard all non reference
main external API structure.
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)
ScanTable intra_scantable
uint8_t * coded_block
used for coded block pattern prediction (msmpeg4v3, wmv1)
int height
picture size. must be a multiple of 16
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
const uint8_t ff_mpeg1_dc_scale_table[128]
int16_t(*[2] motion_val)[2]
motion vector table
#define MV_TYPE_16X8
2 vectors, one per 16x8 block
uint32_t state
contains the last few bytes in MSB order
Picture * picture
main picture buffer
int slice_flags
slice flags
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
ScanTable intra_h_scantable
int16_t(*[2][2][2] b_field_mv_table)[2]
MV table (4MV per MB) interlaced b-frame encoding.
uint8_t * cbp_table
used to store cbp, ac_pred for partitioned decoding
void ff_draw_horiz_band(MpegEncContext *s, int y, int h)
unsigned int avpriv_toupper4(unsigned int x)
#define FF_DEBUG_DCT_COEFF
#define FF_MB_DECISION_RD
rate distortion
uint8_t * index_run[2]
encoding only
int input_picture_number
used to set pic->display_picture_number, should not be used for/by anything else
int8_t * ref_index[2]
motion reference frame index the order in which these are stored can depend on the codec...
DSPContext dsp
pointers for accelerated dsp functions
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
void MPV_common_defaults(MpegEncContext *s)
Set the given MpegEncContext to common defaults (same for encoding and decoding). ...
int f_code
forward MV resolution
#define CODEC_CAP_HWACCEL_VDPAU
Codec can export data for HW decoding (VDPAU).
int max_b_frames
max number of b-frames for encoding
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
DCTELEM(* block)[64]
points to one of the following blocks
int h263_pred
use mpeg4/h263 ac/dc predictions
int16_t(* b_bidir_back_mv_table)[2]
MV table (1MV per MB) bidir mode b-frame encoding.
uint8_t *[2] p_field_select_table
int16_t(* b_direct_mv_table)[2]
MV table (1MV per MB) direct mode b-frame encoding.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
const uint8_t * c_dc_scale_table
qscale -> c_dc_scale table
static void add_dequant_dct(MpegEncContext *s, DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale)
int8_t * qscale_table
QP table.
qpel_mc_func(* qpel_avg)[16]
#define CODEC_FLAG_INTERLACED_ME
interlaced motion estimation
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
int16_t(* b_forw_mv_table)[2]
MV table (1MV per MB) forward mode b-frame encoding.
int b8_stride
2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
int noise_reduction
noise reduction strength
struct MpegEncContext * owner2
pointer to the MpegEncContext that allocated this picture
Picture * next_picture_ptr
pointer to the next picture (for bidir pred)
struct AVCodecContext * avctx
void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src)
static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color)
Draw an arrow from (ex, ey) -> (sx, sy).
void ff_init_vlc_rl(RLTable *rl)
common internal api header.
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int b4_stride
4*mb_width+1 used for some 4x4 block arrays to allow simple addressing
Picture last_picture
copy of the previous picture structure.
uint8_t * obmc_scratchpad
static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
Allocate a frame buffer.
Picture * last_picture_ptr
pointer to the previous picture.
#define FF_DEBUG_VIS_MV_P_FOR
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic)
void MPV_report_decode_progress(MpegEncContext *s)
const uint8_t * chroma_qscale_table
qscale -> chroma_qscale (h263)
static const uint8_t color[]
uint32_t * map
map to avoid duplicate evaluations
int slices
Number of slices.
void MPV_common_init_altivec(MpegEncContext *s)
void ff_wmv2_add_mb(MpegEncContext *s, DCTELEM block[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
int top_field_first
If the content is interlaced, is top field displayed first.
void ff_print_debug_info(MpegEncContext *s, AVFrame *pict)
Print debugging info for the given picture.
#define MV_TYPE_DMV
2 vectors, special mpeg2 Dual Prime Vectors
void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable)
struct AVCodecInternal * internal
Private context used for internal data.
ParseContext parse_context
VLC_TYPE(* table)[2]
code, bits
Picture next_picture
copy of the next picture structure.
static void MPV_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t **ref_picture, op_pixels_func(*pix_op)[4], qpel_mc_func(*qpix_op)[16])
int key_frame
1 -> keyframe, 0-> not
static const uint8_t mpeg2_dc_scale_table1[128]
int linesize
line size, in bytes, may be different from width
uint8_t * mbskip_table
mbskip_table[mb]>=1 if MB didn't change stride= mb_width = (width+15)>>4
static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int field_based, int bottom_field, int field_select, uint8_t **ref_picture, h264_chroma_mc_func *pix_op, int motion_x, int motion_y, int h, int mb_y)
Picture ** reordered_input_picture
pointer to the next pictures in codedorder for encoding
static const uint8_t mpeg2_dc_scale_table2[128]
int chroma_qscale
chroma QP
static void add_dct(MpegEncContext *s, DCTELEM *block, int i, uint8_t *dest, int line_size)
static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base)
#define SLICE_FLAG_CODED_ORDER
draw_horiz_band() is called in coded order instead of display
int flags
AVCodecContext.flags (HQ, MV4, ...)
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
int workaround_bugs
workaround bugs in encoders which cannot be detected automatically
ScanTable inter_scantable
if inter == intra then intra should be used to reduce tha cache usage
#define CODEC_FLAG_PSNR
error[?] variables will be set during encoding.
void avcodec_get_frame_defaults(AVFrame *pic)
Set the fields of the given AVFrame to default values.
static void put_dct(MpegEncContext *s, DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale)
static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s, DCTELEM *block, int n, int qscale)
void ff_thread_report_progress(AVFrame *f, int n, int field)
Notify later decoding threads when part of their reference picture is ready.
int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around get_buffer() for frame-multithreaded codecs.
HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the b...
#define FFSWAP(type, a, b)
discard all frames except keyframes
#define FF_BUFFER_TYPE_SHARED
Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared...
int ff_find_unused_picture(MpegEncContext *s, int shared)
int MPV_lowest_referenced_row(MpegEncContext *s, int dir)
find the lowest MB row referenced in the MVs
#define CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT).
#define MV_TYPE_8X8
4 vectors (h263, mpeg4 4MV)
int16_t(* b_direct_mv_table_base)[2]
int b_code
backward MV resolution for B Frames (mpeg4)
int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
generic function for encode/decode called after coding/decoding the header and before a frame is code...
void(* dct_unquantize_h263_intra)(struct MpegEncContext *s, DCTELEM *block, int n, int qscale)
int uvlinesize
line size, for chroma in bytes, may be different from width
void ff_thread_release_buffer(AVCodecContext *avctx, AVFrame *f)
Wrapper around release_buffer() frame-for multithreaded codecs.
static void MPV_motion_lowres(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t **ref_picture, h264_chroma_mc_func *pix_op)
motion compensation of a single macroblock
#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)
void MPV_common_init_axp(MpegEncContext *s)