40 int src_x, src_y, motion_x, motion_y;
51 if (src_x == s->
width)
60 ptr = ref_picture[0] + src_y * linesize + src_x;
72 if ((motion_x | motion_y) & 7) {
73 s->
mdsp.
gmc1(dest_y, ptr, linesize, 16,
74 motion_x & 15, motion_y & 15, 128 - s->
no_rounding);
75 s->
mdsp.
gmc1(dest_y + 8, ptr + 8, linesize, 16,
76 motion_x & 15, motion_y & 15, 128 - s->
no_rounding);
80 dxy = ((motion_x >> 3) & 1) | ((motion_y >> 2) & 2);
98 if (src_x == s->
width >> 1)
101 if (src_y == s->
height >> 1)
105 ptr = ref_picture[1] +
offset;
109 uvlinesize, uvlinesize,
116 s->
mdsp.
gmc1(dest_cb, ptr, uvlinesize, 8,
117 motion_x & 15, motion_y & 15, 128 - s->
no_rounding);
119 ptr = ref_picture[2] +
offset;
122 uvlinesize, uvlinesize,
128 s->
mdsp.
gmc1(dest_cr, ptr, uvlinesize, 8,
129 motion_x & 15, motion_y & 15, 128 - s->
no_rounding);
144 ptr = ref_picture[0];
151 s->
mdsp.
gmc(dest_y, ptr, linesize, 16,
157 s->
mdsp.
gmc(dest_y + 8, ptr, linesize, 16,
173 ptr = ref_picture[1];
174 s->
mdsp.
gmc(dest_cb, ptr, uvlinesize, 8,
181 ptr = ref_picture[2];
182 s->
mdsp.
gmc(dest_cr, ptr, uvlinesize, 8,
192 int src_x,
int src_y,
194 int motion_x,
int motion_y)
199 src_x += motion_x >> 1;
200 src_y += motion_y >> 1;
204 if (src_x != s->
width)
208 dxy |= (motion_y & 1) << 1;
242 uint8_t *ptr_y, *ptr_cb, *ptr_cr;
243 int dxy, uvdxy, mx, my, src_x, src_y,
250 block_y_half = (field_based | is_16x8);
252 dxy = ((motion_y & 1) << 1) | (motion_x & 1);
253 src_x = s->
mb_x * 16 + (motion_x >> 1);
254 src_y = (mb_y << (4 - block_y_half)) + (motion_y >> 1);
258 mx = (motion_x >> 1) | (motion_x & 1);
260 uvdxy = ((my & 1) << 1) | (mx & 1);
261 uvsrc_x = s->
mb_x * 8 + (mx >> 1);
262 uvsrc_y = (mb_y << (3 - block_y_half)) + (my >> 1);
264 uvdxy = dxy | (motion_y & 2) | ((motion_x & 2) >> 1);
265 uvsrc_x = src_x >> 1;
266 uvsrc_y = src_y >> 1;
273 uvsrc_x = s->
mb_x * 8 + mx;
274 uvsrc_y = mb_y * 8 + my;
279 uvdxy = ((my & 1) << 1) | (mx & 1);
280 uvsrc_x = s->
mb_x * 8 + (mx >> 1);
281 uvsrc_y = (mb_y << (3 - block_y_half)) + (my >> 1);
286 uvdxy = ((motion_y & 1) << 1) | (mx & 1);
287 uvsrc_x = s->
mb_x * 8 + (mx >> 1);
298 ptr_y = ref_picture[0] + src_y * linesize + src_x;
299 ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
300 ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
302 if ((
unsigned)src_x >=
FFMAX(s->
h_edge_pos - (motion_x & 1) - 15 , 0) ||
303 (unsigned)src_y >=
FFMAX( v_edge_pos - (motion_y & 1) - h + 1, 0)) {
304 if (is_mpeg12 || (CONFIG_SMALL &&
308 "MPEG motion vector out of boundary (%d %d)\n", src_x,
312 src_y = (unsigned)src_y << field_based;
315 17, 17 + field_based,
324 uvsrc_y = (unsigned)uvsrc_y << field_based;
354 pix_op[0][dxy](dest_y, ptr_y,
linesize,
h);
362 if (!is_mpeg12 && (CONFIG_H261_ENCODER || CONFIG_H261_DECODER) &&
370 int field_select,
uint8_t **ref_picture,
372 int motion_x,
int motion_y,
int h,
int is_16x8,
int mb_y)
377 field_select, ref_picture, pix_op,
378 motion_x, motion_y, h, 1, is_16x8, mb_y);
382 field_select, ref_picture, pix_op,
383 motion_x, motion_y, h, 0, is_16x8, mb_y);
388 int bottom_field,
int field_select,
391 int motion_x,
int motion_y,
int h,
int mb_y)
396 bottom_field, field_select, ref_picture, pix_op,
397 motion_x, motion_y, h, 1, 0, mb_y);
401 bottom_field, field_select, ref_picture, pix_op,
402 motion_x, motion_y, h, 0, 0, mb_y);
413 uint8_t *
const bottom = src[4];
414 #define OBMC_FILTER(x, t, l, m, r, b)\ 415 dst[x]= (t*top[x] + l*left[x] + m*mid[x] + r*right[x] + b*bottom[x] + 4)>>3 416 #define OBMC_FILTER4(x, t, l, m, r, b)\ 417 OBMC_FILTER(x , t, l, m, r, b);\ 418 OBMC_FILTER(x+1 , t, l, m, r, b);\ 419 OBMC_FILTER(x +stride, t, l, m, r, b);\ 420 OBMC_FILTER(x+1+stride, t, l, m, r, b); 461 int src_x,
int src_y,
471 for (i = 0; i < 5; i++) {
472 if (i && mv[i][0] == mv[
MID][0] && mv[i][1] == mv[
MID][1]) {
489 int field_based,
int bottom_field,
490 int field_select,
uint8_t **ref_picture,
493 int motion_x,
int motion_y,
int h)
495 uint8_t *ptr_y, *ptr_cb, *ptr_cr;
496 int dxy, uvdxy, mx, my, src_x, src_y, uvsrc_x, uvsrc_y,
v_edge_pos;
499 dxy = ((motion_y & 3) << 2) | (motion_x & 3);
501 src_x = s->
mb_x * 16 + (motion_x >> 2);
502 src_y = s->
mb_y * (16 >> field_based) + (motion_y >> 2);
505 linesize = s->
linesize << field_based;
512 static const int rtab[8] = { 0, 0, 1, 1, 0, 0, 0, 1 };
513 mx = (motion_x >> 1) + rtab[motion_x & 7];
514 my = (motion_y >> 1) + rtab[motion_y & 7];
516 mx = (motion_x >> 1) | (motion_x & 1);
517 my = (motion_y >> 1) | (motion_y & 1);
522 mx = (mx >> 1) | (mx & 1);
523 my = (my >> 1) | (my & 1);
525 uvdxy = (mx & 1) | ((my & 1) << 1);
529 uvsrc_x = s->
mb_x * 8 + mx;
530 uvsrc_y = s->
mb_y * (8 >> field_based) + my;
532 ptr_y = ref_picture[0] + src_y * linesize + src_x;
533 ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
534 ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
536 if ((
unsigned)src_x >=
FFMAX(s->
h_edge_pos - (motion_x & 3) - 15 , 0) ||
537 (unsigned)src_y >=
FFMAX( v_edge_pos - (motion_y & 3) - h + 1, 0)) {
540 17, 17 + field_based,
541 src_x, src_y * (1 << field_based),
552 uvsrc_x, uvsrc_y * (1 << field_based),
557 uvsrc_x, uvsrc_y * (1 << field_based),
565 qpix_op[0][dxy](dest_y, ptr_y,
linesize);
580 qpix_op[1][dxy](dest_y, ptr_y,
linesize);
581 qpix_op[1][dxy](dest_y + 8, ptr_y + 8,
linesize);
584 pix_op[1][uvdxy](dest_cr, ptr_cr,
uvlinesize, h >> 1);
585 pix_op[1][uvdxy](dest_cb, ptr_cb,
uvlinesize, h >> 1);
599 int src_x, src_y, dxy, emu = 0;
607 dxy = ((my & 1) << 1) | (mx & 1);
611 src_x = s->
mb_x * 8 + mx;
612 src_y = s->
mb_y * 8 + my;
614 if (src_x == (s->
width >> 1))
617 if (src_y == (s->
height >> 1))
621 ptr = ref_picture[1] +
offset;
622 if ((
unsigned)src_x >=
FFMAX((s->
h_edge_pos >> 1) - (dxy & 1) - 7, 0) ||
633 ptr = ref_picture[2] +
offset;
649 const int mx = (s->
mv[dir][0][0] >>
shift) + 16 * s->
mb_x + 8;
650 const int my = (s->
mv[dir][0][1] >> shift) + 16 * s->
mb_y;
651 int off = mx + (my + (s->
mb_x & 3) * 4) * s->
linesize + 64;
654 off = (mx >> 1) + ((my >> 1) + (s->
mb_x & 7)) * s->
uvlinesize + 64;
669 const int xy = mb_x + mb_y * s->
mb_stride;
671 const int mot_xy = mb_x * 2 + mb_y * 2 * mot_stride;
680 cur_frame->
motion_val[0][mot_xy + mot_stride]);
682 cur_frame->
motion_val[0][mot_xy + mot_stride + 1]);
685 cur_frame->
motion_val[0][mot_xy + mot_stride]);
687 cur_frame->
motion_val[0][mot_xy + mot_stride + 1]);
690 AV_COPY32(mv_cache[0][1], mv_cache[1][1]);
691 AV_COPY32(mv_cache[0][2], mv_cache[1][2]);
694 cur_frame->
motion_val[0][mot_xy - mot_stride]);
696 cur_frame->
motion_val[0][mot_xy - mot_stride + 1]);
700 AV_COPY32(mv_cache[1][0], mv_cache[1][1]);
701 AV_COPY32(mv_cache[2][0], mv_cache[2][1]);
705 cur_frame->
motion_val[0][mot_xy - 1 + mot_stride]);
709 AV_COPY32(mv_cache[1][3], mv_cache[1][2]);
710 AV_COPY32(mv_cache[2][3], mv_cache[2][2]);
714 cur_frame->
motion_val[0][mot_xy + 2 + mot_stride]);
719 for (i = 0; i < 4; i++) {
720 const int x = (i & 1) + 1;
721 const int y = (i >> 1) + 1;
723 { mv_cache[y][x][0], mv_cache[y][x][1] },
724 { mv_cache[y - 1][x][0], mv_cache[y - 1][x][1] },
725 { mv_cache[y][x - 1][0], mv_cache[y][x - 1][1] },
726 { mv_cache[y][x + 1][0], mv_cache[y][x + 1][1] },
727 { mv_cache[y + 1][x][0], mv_cache[y + 1][x][1] }
732 mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >> 1) * 8,
741 ref_picture, pix_op[1],
754 int dxy, mx, my, src_x, src_y;
763 for (i = 0; i < 4; i++) {
764 int motion_x = s->
mv[dir][
i][0];
765 int motion_y = s->
mv[dir][
i][1];
767 dxy = ((motion_y & 3) << 2) | (motion_x & 3);
768 src_x = mb_x * 16 + (motion_x >> 2) + (i & 1) * 8;
769 src_y = mb_y * 16 + (motion_y >> 2) + (i >> 1) * 8;
773 if (src_x == s->
width)
779 ptr = ref_picture[0] + (src_y * s->
linesize) + (src_x);
790 dest = dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->
linesize;
791 qpix_op[1][dxy](dest, ptr, s->
linesize);
793 mx += s->
mv[dir][
i][0] / 2;
794 my += s->
mv[dir][
i][1] / 2;
797 for (i = 0; i < 4; i++) {
799 dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->
linesize,
801 mb_x * 16 + (i & 1) * 8,
802 mb_y * 16 + (i >> 1) * 8,
807 mx += s->
mv[dir][
i][0];
808 my += s->
mv[dir][
i][1];
814 ref_picture, pix_op[1], mx, my);
845 apply_obmc(s, dest_y, dest_cb, dest_cr, ref_picture, pix_op);
851 if (!is_mpeg12 && s->
mcsel) {
862 ref_picture, pix_op, qpix_op,
863 s->
mv[dir][0][0], s->
mv[dir][0][1], 16);
864 }
else if (!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) &&
868 s->
mv[dir][0][0], s->
mv[dir][0][1], 16);
872 s->
mv[dir][0][0], s->
mv[dir][0][1], 16, 0, mb_y);
878 dir, ref_picture, qpix_op, pix_op);
883 for (i = 0; i < 2; i++)
886 ref_picture, pix_op, qpix_op,
887 s->
mv[dir][i][0], s->
mv[dir][i][1], 8);
893 s->
mv[dir][0][0], s->
mv[dir][0][1], 8, mb_y);
898 s->
mv[dir][1][0], s->
mv[dir][1][1], 8, mb_y);
902 || !ref_picture[0]) {
909 s->
mv[dir][0][0], s->
mv[dir][0][1], 16, 0, mb_y >> 1);
913 if (CONFIG_SMALL || is_mpeg12) {
914 for (i = 0; i < 2; i++) {
920 ref2picture = ref_picture;
928 s->
mv[dir][i][0], s->
mv[dir][i][1],
929 8, 1, (mb_y & ~1) + i);
938 if (CONFIG_SMALL || is_mpeg12) {
940 for (i = 0; i < 2; i++) {
941 for (
int j = 0; j < 2; j++)
943 j, j ^ i, ref_picture, pix_op,
944 s->
mv[dir][2 * i + j][0],
945 s->
mv[dir][2 * i + j][1], 8, mb_y);
949 if (!ref_picture[0]) {
952 for (i = 0; i < 2; i++) {
956 s->
mv[dir][2 * i][0], s->
mv[dir][2 * i][1],
984 ref_picture, pix_op, qpix_op, 1);
988 ref_picture, pix_op, qpix_op, 0);
void ff_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])
static int shift(int a, int b)
void(* gmc1)(uint8_t *dst, uint8_t *src, int srcStride, int h, int x16, int y16, int rounder)
translational global motion compensation.
static void gmc_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture)
#define MV_TYPE_FIELD
2 vectors, one per field
int sprite_warping_accuracy
uint8_t * edge_emu_buffer
temporary buffer for if MVs point to out-of-frame data
op_pixels_func avg_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
int v_edge_pos
horizontal / vertical position of the right/bottom edge (pixel replication)
#define FF_BUG_HPEL_CHROMA
int obmc
overlapped block motion compensation
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
int real_sprite_warping_points
void(* prefetch)(uint8_t *buf, ptrdiff_t stride, int h)
Prefetch memory into cache (if supported by hardware).
void(* emulated_edge_mc)(uint8_t *dst, const uint8_t *src, ptrdiff_t dst_linesize, ptrdiff_t src_linesize, int block_w, int block_h, int src_x, int src_y, int w, int h)
Copy a rectangular area of samples to a temporary buffer and replicate the border samples...
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
static void chroma_4mv_motion(MpegEncContext *s, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture, op_pixels_func *pix_op, int mx, int my)
H.263 chroma 4mv motion compensation.
enum OutputFormat out_format
output format
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
void(* gmc)(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
global motion compensation.
int no_rounding
apply no rounding to motion compensation (MPEG-4, msmpeg4, ...) for B-frames rounding mode is always ...
Picture current_picture
copy of the current picture structure.
#define FF_BUG_QPEL_CHROMA2
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
int sprite_offset[2][2]
sprite offset[isChroma][isMVY]
static void prefetch_motion(MpegEncContext *s, uint8_t **pix, int dir)
int mb_skipped
MUST BE SET only during DECODING.
void(* qpel_mc_func)(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int flags
AV_CODEC_FLAG_*.
simple assert() macros that are a bit more flexible than ISO C assert().
int quarter_sample
1->qpel, 0->half pel ME/MC
common internal API header
int sprite_delta[2][2]
sprite_delta [isY][isMVY]
int16_t(*[2] motion_val)[2]
Picture * current_picture_ptr
pointer to the current picture
static void gmc1_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture)
#define FF_BUG_QPEL_CHROMA
preferred ID for MPEG-1/2 video decoding
#define OBMC_FILTER4(x, t, l, m, r, b)
int first_field
is 1 for the first field of a field picture 0 otherwise
static const int8_t mv[256][2]
static av_always_inline void mpv_motion_internal(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 is_mpeg12)
motion compensation of a single macroblock
#define MV_TYPE_16X16
1 vector for the whole mb
Libavcodec external API header.
ptrdiff_t linesize
line size, in bytes, may be different from width
static void mpeg_motion_field(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int bottom_field, int field_select, uint8_t **ref_picture, op_pixels_func(*pix_op)[4], int motion_x, int motion_y, int h, int mb_y)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
#define LOCAL_ALIGNED_8(t, v,...)
int height
picture size. must be a multiple of 16
void(* op_pixels_func)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2]...the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so...,+,-,+,-,+,+,-,+,-,+,...hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32-hcoeff[1]-hcoeff[2]-...a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2}an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||.........intra?||||:Block01:yes no||||:Block02:.................||||:Block03::y DC::ref index:||||:Block04::cb DC::motion x:||||.........:cr DC::motion y:||||.................|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------------------------------|||Y subbands||Cb subbands||Cr subbands||||------||------||------|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||------||------||------||||------||------||------|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||------||------||------||||------||------||------|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||------||------||------||||------||------||------|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------------------------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction------------|\Dequantization-------------------\||Reference frames|\IDWT|--------------|Motion\|||Frame 0||Frame 1||Compensation.OBMC v-------|--------------|--------------.\------> Frame n output Frame Frame<----------------------------------/|...|-------------------Range Coder:============Binary Range Coder:-------------------The implemented range coder is an adapted version based upon"Range encoding: an algorithm for removing redundancy from a digitised message."by G.N.N.Martin.The symbols encoded by the Snow range coder are bits(0|1).The associated probabilities are not fix but change depending on the symbol mix seen so far.bit seen|new state---------+-----------------------------------------------0|256-state_transition_table[256-old_state];1|state_transition_table[old_state];state_transition_table={0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:-------------------------FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1.the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled left
op_pixels_func put_pixels_tab[4][4]
Halfpel motion compensation with rounding (a+b+1)>>1.
#define MV_TYPE_16X8
2 vectors, one per 16x8 block
static av_always_inline void mpeg_motion_internal(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, op_pixels_func(*pix_op)[4], int motion_x, int motion_y, int h, int is_mpeg12, int is_16x8, int mb_y)
op_pixels_func put_no_rnd_pixels_tab[4][4]
Halfpel motion compensation with no rounding (a+b)>>1.
ptrdiff_t uvlinesize
line size, for chroma in bytes, may be different from width
static int ff_h263_round_chroma(int x)
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
int b8_stride
2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
struct AVCodecContext * avctx
static void qpel_motion(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, op_pixels_func(*pix_op)[4], qpel_mc_func(*qpix_op)[16], int motion_x, int motion_y, int h)
GLint GLenum GLboolean GLsizei stride
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
void ff_mspel_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture, op_pixels_func(*pix_op)[4], int motion_x, int motion_y, int h)
static void mpeg_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int field_select, uint8_t **ref_picture, op_pixels_func(*pix_op)[4], int motion_x, int motion_y, int h, int is_16x8, int mb_y)
#define MV_TYPE_DMV
2 vectors, special mpeg2 Dual Prime Vectors
static void apply_obmc(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture, op_pixels_func(*pix_op)[4])
uint8_t * obmc_scratchpad
uint32_t * mb_type
types and macros are defined in mpegutils.h
int workaround_bugs
workaround bugs in encoders which cannot be detected automatically
void ff_h261_loop_filter(MpegEncContext *s)
static int hpel_motion(MpegEncContext *s, uint8_t *dest, uint8_t *src, int src_x, int src_y, op_pixels_func *pix_op, int motion_x, int motion_y)
static void obmc_motion(MpegEncContext *s, uint8_t *dest, uint8_t *src, int src_x, int src_y, op_pixels_func *pix_op, int16_t mv[5][2])
#define MV_TYPE_8X8
4 vectors (H.263, MPEG-4 4MV)
static void apply_8x8(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t **ref_picture, qpel_mc_func(*qpix_op)[16], op_pixels_func(*pix_op)[4])
static void put_obmc(uint8_t *dst, uint8_t *src[5], int stride)
#define OBMC_FILTER(x, t, l, m, r, b)