45 int src_x, src_y, motion_x, motion_y;
55 src_x = av_clip(src_x, -16, s->
width);
56 if (src_x == s->
width)
58 src_y = av_clip(src_y, -16, s->
height);
65 ptr = ref_picture[0] + src_y * linesize + src_x;
77 if ((motion_x | motion_y) & 7) {
78 s->
mdsp.
gmc1(dest_y, ptr, linesize, 16,
79 motion_x & 15, motion_y & 15, 128 - s->
no_rounding);
80 s->
mdsp.
gmc1(dest_y + 8, ptr + 8, linesize, 16,
81 motion_x & 15, motion_y & 15, 128 - s->
no_rounding);
85 dxy = ((motion_x >> 3) & 1) | ((motion_y >> 2) & 2);
102 src_x = av_clip(src_x, -8, s->
width >> 1);
103 if (src_x == s->
width >> 1)
105 src_y = av_clip(src_y, -8, s->
height >> 1);
106 if (src_y == s->
height >> 1)
110 ptr = ref_picture[1] +
offset;
114 uvlinesize, uvlinesize,
121 s->
mdsp.
gmc1(dest_cb, ptr, uvlinesize, 8,
122 motion_x & 15, motion_y & 15, 128 - s->
no_rounding);
124 ptr = ref_picture[2] +
offset;
127 uvlinesize, uvlinesize,
133 s->
mdsp.
gmc1(dest_cr, ptr, uvlinesize, 8,
134 motion_x & 15, motion_y & 15, 128 - s->
no_rounding);
149 ptr = ref_picture[0];
156 s->
mdsp.
gmc(dest_y, ptr, linesize, 16,
162 s->
mdsp.
gmc(dest_y + 8, ptr, linesize, 16,
178 ptr = ref_picture[1];
179 s->
mdsp.
gmc(dest_cb, ptr, uvlinesize, 8,
186 ptr = ref_picture[2];
187 s->
mdsp.
gmc(dest_cr, ptr, uvlinesize, 8,
197 int src_x,
int src_y,
199 int motion_x,
int motion_y)
204 src_x += motion_x >> 1;
205 src_y += motion_y >> 1;
208 src_x = av_clip(src_x, -16, s->
width);
209 if (src_x != s->
width)
211 src_y = av_clip(src_y, -16, s->
height);
213 dxy |= (motion_y & 1) << 1;
247 uint8_t *ptr_y, *ptr_cb, *ptr_cr;
248 int dxy, uvdxy, mx, my, src_x, src_y,
255 block_y_half = (field_based | is_16x8);
257 dxy = ((motion_y & 1) << 1) | (motion_x & 1);
258 src_x = s->
mb_x * 16 + (motion_x >> 1);
259 src_y = (mb_y << (4 - block_y_half)) + (motion_y >> 1);
263 mx = (motion_x >> 1) | (motion_x & 1);
265 uvdxy = ((my & 1) << 1) | (mx & 1);
266 uvsrc_x = s->
mb_x * 8 + (mx >> 1);
267 uvsrc_y = (mb_y << (3 - block_y_half)) + (my >> 1);
269 uvdxy = dxy | (motion_y & 2) | ((motion_x & 2) >> 1);
270 uvsrc_x = src_x >> 1;
271 uvsrc_y = src_y >> 1;
278 uvsrc_x = s->
mb_x * 8 + mx;
279 uvsrc_y = mb_y * 8 + my;
284 uvdxy = ((my & 1) << 1) | (mx & 1);
285 uvsrc_x = s->
mb_x * 8 + (mx >> 1);
286 uvsrc_y = (mb_y << (3 - block_y_half)) + (my >> 1);
291 uvdxy = ((motion_y & 1) << 1) | (mx & 1);
292 uvsrc_x = s->
mb_x * 8 + (mx >> 1);
303 ptr_y = ref_picture[0] + src_y * linesize + src_x;
304 ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
305 ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
307 if ((
unsigned)src_x >=
FFMAX(s->
h_edge_pos - (motion_x & 1) - 15 , 0) ||
308 (unsigned)src_y >=
FFMAX( v_edge_pos - (motion_y & 1) - h + 1, 0)) {
313 "MPEG motion vector out of boundary (%d %d)\n", src_x,
317 src_y = (unsigned)src_y << field_based;
320 17, 17 + field_based,
329 uvsrc_y = (unsigned)uvsrc_y << field_based;
359 pix_op[0][dxy](dest_y, ptr_y,
linesize,
h);
367 if (!is_mpeg12 && (CONFIG_H261_ENCODER || CONFIG_H261_DECODER) &&
375 int field_select,
uint8_t **ref_picture,
377 int motion_x,
int motion_y,
int h,
int is_16x8,
int mb_y)
382 field_select, ref_picture, pix_op,
383 motion_x, motion_y, h, 1, is_16x8, mb_y);
387 field_select, ref_picture, pix_op,
388 motion_x, motion_y, h, 0, is_16x8, mb_y);
393 int bottom_field,
int field_select,
396 int motion_x,
int motion_y,
int h,
int mb_y)
401 bottom_field, field_select, ref_picture, pix_op,
402 motion_x, motion_y, h, 1, 0, mb_y);
406 bottom_field, field_select, ref_picture, pix_op,
407 motion_x, motion_y, h, 0, 0, mb_y);
418 uint8_t *
const bottom = src[4];
419 #define OBMC_FILTER(x, t, l, m, r, b)\ 420 dst[x]= (t*top[x] + l*left[x] + m*mid[x] + r*right[x] + b*bottom[x] + 4)>>3 421 #define OBMC_FILTER4(x, t, l, m, r, b)\ 422 OBMC_FILTER(x , t, l, m, r, b);\ 423 OBMC_FILTER(x+1 , t, l, m, r, b);\ 424 OBMC_FILTER(x +stride, t, l, m, r, b);\ 425 OBMC_FILTER(x+1+stride, t, l, m, r, b); 466 int src_x,
int src_y,
476 for (i = 0; i < 5; i++) {
477 if (i && mv[i][0] == mv[
MID][0] && mv[i][1] == mv[
MID][1]) {
494 int field_based,
int bottom_field,
495 int field_select,
uint8_t **ref_picture,
498 int motion_x,
int motion_y,
int h)
500 uint8_t *ptr_y, *ptr_cb, *ptr_cr;
501 int dxy, uvdxy, mx, my, src_x, src_y, uvsrc_x, uvsrc_y,
v_edge_pos;
504 dxy = ((motion_y & 3) << 2) | (motion_x & 3);
506 src_x = s->
mb_x * 16 + (motion_x >> 2);
507 src_y = s->
mb_y * (16 >> field_based) + (motion_y >> 2);
510 linesize = s->
linesize << field_based;
517 static const int rtab[8] = { 0, 0, 1, 1, 0, 0, 0, 1 };
518 mx = (motion_x >> 1) + rtab[motion_x & 7];
519 my = (motion_y >> 1) + rtab[motion_y & 7];
521 mx = (motion_x >> 1) | (motion_x & 1);
522 my = (motion_y >> 1) | (motion_y & 1);
527 mx = (mx >> 1) | (mx & 1);
528 my = (my >> 1) | (my & 1);
530 uvdxy = (mx & 1) | ((my & 1) << 1);
534 uvsrc_x = s->
mb_x * 8 + mx;
535 uvsrc_y = s->
mb_y * (8 >> field_based) + my;
537 ptr_y = ref_picture[0] + src_y * linesize + src_x;
538 ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
539 ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
541 if ((
unsigned)src_x >=
FFMAX(s->
h_edge_pos - (motion_x & 3) - 15 , 0) ||
542 (unsigned)src_y >=
FFMAX( v_edge_pos - (motion_y & 3) - h + 1, 0)) {
545 17, 17 + field_based,
546 src_x, src_y * (1 << field_based),
557 uvsrc_x, uvsrc_y * (1 << field_based),
562 uvsrc_x, uvsrc_y * (1 << field_based),
570 qpix_op[0][dxy](dest_y, ptr_y,
linesize);
585 qpix_op[1][dxy](dest_y, ptr_y,
linesize);
586 qpix_op[1][dxy](dest_y + 8, ptr_y + 8,
linesize);
589 pix_op[1][uvdxy](dest_cr, ptr_cr,
uvlinesize, h >> 1);
590 pix_op[1][uvdxy](dest_cb, ptr_cb,
uvlinesize, h >> 1);
604 int src_x, src_y, dxy, emu = 0;
612 dxy = ((my & 1) << 1) | (mx & 1);
616 src_x = s->
mb_x * 8 + mx;
617 src_y = s->
mb_y * 8 + my;
618 src_x = av_clip(src_x, -8, (s->
width >> 1));
619 if (src_x == (s->
width >> 1))
621 src_y = av_clip(src_y, -8, (s->
height >> 1));
622 if (src_y == (s->
height >> 1))
626 ptr = ref_picture[1] +
offset;
627 if ((
unsigned)src_x >=
FFMAX((s->
h_edge_pos >> 1) - (dxy & 1) - 7, 0) ||
638 ptr = ref_picture[2] +
offset;
654 const int mx = (s->
mv[dir][0][0] >>
shift) + 16 * s->
mb_x + 8;
655 const int my = (s->
mv[dir][0][1] >> shift) + 16 * s->
mb_y;
656 int off = mx + (my + (s->
mb_x & 3) * 4) * s->
linesize + 64;
659 off = (mx >> 1) + ((my >> 1) + (s->
mb_x & 7)) * s->
uvlinesize + 64;
674 const int xy = mb_x + mb_y * s->
mb_stride;
676 const int mot_xy = mb_x * 2 + mb_y * 2 * mot_stride;
685 cur_frame->
motion_val[0][mot_xy + mot_stride]);
687 cur_frame->
motion_val[0][mot_xy + mot_stride + 1]);
690 cur_frame->
motion_val[0][mot_xy + mot_stride]);
692 cur_frame->
motion_val[0][mot_xy + mot_stride + 1]);
695 AV_COPY32(mv_cache[0][1], mv_cache[1][1]);
696 AV_COPY32(mv_cache[0][2], mv_cache[1][2]);
699 cur_frame->
motion_val[0][mot_xy - mot_stride]);
701 cur_frame->
motion_val[0][mot_xy - mot_stride + 1]);
705 AV_COPY32(mv_cache[1][0], mv_cache[1][1]);
706 AV_COPY32(mv_cache[2][0], mv_cache[2][1]);
710 cur_frame->
motion_val[0][mot_xy - 1 + mot_stride]);
714 AV_COPY32(mv_cache[1][3], mv_cache[1][2]);
715 AV_COPY32(mv_cache[2][3], mv_cache[2][2]);
719 cur_frame->
motion_val[0][mot_xy + 2 + mot_stride]);
724 for (i = 0; i < 4; i++) {
725 const int x = (i & 1) + 1;
726 const int y = (i >> 1) + 1;
728 { mv_cache[y][x][0], mv_cache[y][x][1] },
729 { mv_cache[y - 1][x][0], mv_cache[y - 1][x][1] },
730 { mv_cache[y][x - 1][0], mv_cache[y][x - 1][1] },
731 { mv_cache[y][x + 1][0], mv_cache[y][x + 1][1] },
732 { mv_cache[y + 1][x][0], mv_cache[y + 1][x][1] }
737 mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >> 1) * 8,
746 ref_picture, pix_op[1],
759 int dxy, mx, my, src_x, src_y;
768 for (i = 0; i < 4; i++) {
769 int motion_x = s->
mv[dir][
i][0];
770 int motion_y = s->
mv[dir][
i][1];
772 dxy = ((motion_y & 3) << 2) | (motion_x & 3);
773 src_x = mb_x * 16 + (motion_x >> 2) + (i & 1) * 8;
774 src_y = mb_y * 16 + (motion_y >> 2) + (i >> 1) * 8;
777 src_x = av_clip(src_x, -16, s->
width);
778 if (src_x == s->
width)
780 src_y = av_clip(src_y, -16, s->
height);
784 ptr = ref_picture[0] + (src_y * s->
linesize) + (src_x);
795 dest = dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->
linesize;
796 qpix_op[1][dxy](dest, ptr, s->
linesize);
798 mx += s->
mv[dir][
i][0] / 2;
799 my += s->
mv[dir][
i][1] / 2;
802 for (i = 0; i < 4; i++) {
804 dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->
linesize,
806 mb_x * 16 + (i & 1) * 8,
807 mb_y * 16 + (i >> 1) * 8,
812 mx += s->
mv[dir][
i][0];
813 my += s->
mv[dir][
i][1];
819 ref_picture, pix_op[1], mx, my);
850 apply_obmc(s, dest_y, dest_cb, dest_cr, ref_picture, pix_op);
867 ref_picture, pix_op, qpix_op,
868 s->
mv[dir][0][0], s->
mv[dir][0][1], 16);
869 }
else if (!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) &&
873 s->
mv[dir][0][0], s->
mv[dir][0][1], 16);
877 s->
mv[dir][0][0], s->
mv[dir][0][1], 16, 0, mb_y);
883 dir, ref_picture, qpix_op, pix_op);
888 for (i = 0; i < 2; i++)
891 ref_picture, pix_op, qpix_op,
892 s->
mv[dir][i][0], s->
mv[dir][i][1], 8);
898 s->
mv[dir][0][0], s->
mv[dir][0][1], 8, mb_y);
903 s->
mv[dir][1][0], s->
mv[dir][1][1], 8, mb_y);
907 || !ref_picture[0]) {
914 s->
mv[dir][0][0], s->
mv[dir][0][1], 16, 0, mb_y >> 1);
918 for (i = 0; i < 2; i++) {
923 ref2picture = ref_picture;
931 s->
mv[dir][i][0], s->
mv[dir][i][1],
932 8, 1, (mb_y & ~1) + i);
941 for (i = 0; i < 2; i++) {
943 for (j = 0; j < 2; j++)
945 j, j ^ i, ref_picture, pix_op,
946 s->
mv[dir][2 * i + j][0],
947 s->
mv[dir][2 * i + j][1], 8, mb_y);
951 if (!ref_picture[0]) {
954 for (i = 0; i < 2; i++) {
958 s->
mv[dir][2 * i][0], s->
mv[dir][2 * i][1],
986 ref_picture, pix_op, qpix_op, 1);
990 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)