Go to the documentation of this file.
34 int motion_x,
int motion_y,
int motion_scale,
39 mb->motion_x = motion_x;
40 mb->motion_y = motion_y;
41 mb->motion_scale = motion_scale;
44 mb->src_x = dst_x + motion_x / motion_scale;
45 mb->src_y = dst_y + motion_y / motion_scale;
46 mb->source = direction ? 1 : -1;
53 int y,
int h,
int picture_structure,
57 int vshift =
desc->log2_chroma_h;
58 const int field_pic = picture_structure !=
PICT_FRAME;
91 offset[2]= (y >> vshift) *
src->linesize[1];
99 y, picture_structure,
h);
104 uint32_t *mbtype_table, int8_t *qscale_table, int16_t (*motion_val[2])[2],
105 int mb_width,
int mb_height,
int mb_stride,
int quarter_sample)
108 const int shift = 1 + quarter_sample;
111 const int mv_stride = (mb_width << mv_sample_log2) +
113 int mb_x, mb_y, mbcount = 0;
121 for (mb_y = 0; mb_y < mb_height; mb_y++) {
122 for (mb_x = 0; mb_x < mb_width; mb_x++) {
123 int i, direction, mb_type = mbtype_table[mb_x + mb_y * mb_stride];
124 for (direction = 0; direction < 2; direction++) {
128 for (
i = 0;
i < 4;
i++) {
129 int sx = mb_x * 16 + 4 + 8 * (
i & 1);
130 int sy = mb_y * 16 + 4 + 8 * (
i >> 1);
131 int xy = (mb_x * 2 + (
i & 1) +
132 (mb_y * 2 + (
i >> 1)) * mv_stride) << (mv_sample_log2 - 1);
133 int mx = motion_val[direction][xy][0];
134 int my = motion_val[direction][xy][1];
135 mbcount +=
add_mb(mvs + mbcount, mb_type, sx, sy, mx, my,
scale, direction);
138 for (
i = 0;
i < 2;
i++) {
139 int sx = mb_x * 16 + 8;
140 int sy = mb_y * 16 + 4 + 8 *
i;
141 int xy = (mb_x * 2 + (mb_y * 2 +
i) * mv_stride) << (mv_sample_log2 - 1);
142 int mx = motion_val[direction][xy][0];
143 int my = motion_val[direction][xy][1];
148 mbcount +=
add_mb(mvs + mbcount, mb_type, sx, sy, mx, my,
scale, direction);
151 for (
i = 0;
i < 2;
i++) {
152 int sx = mb_x * 16 + 4 + 8 *
i;
153 int sy = mb_y * 16 + 8;
154 int xy = (mb_x * 2 +
i + mb_y * 2 * mv_stride) << (mv_sample_log2 - 1);
155 int mx = motion_val[direction][xy][0];
156 int my = motion_val[direction][xy][1];
161 mbcount +=
add_mb(mvs + mbcount, mb_type, sx, sy, mx, my,
scale, direction);
164 int sx = mb_x * 16 + 8;
165 int sy = mb_y * 16 + 8;
166 int xy = (mb_x + mb_y * mv_stride) << mv_sample_log2;
167 int mx = motion_val[direction][xy][0];
168 int my = motion_val[direction][xy][1];
169 mbcount +=
add_mb(mvs + mbcount, mb_type, sx, sy, mx, my,
scale, direction);
191 if (avctx->
hwaccel || !mbtype_table)
200 for (y = 0; y < mb_height; y++) {
201 for (x = 0; x < mb_width; x++) {
203 int count = mbskip_table ? mbskip_table[x + y * mb_stride] : 0;
210 qscale_table[x + y * mb_stride]);
213 int mb_type = mbtype_table[x + y * mb_stride];
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, size_t size)
Add a new side data to a frame.
#define SLICE_FLAG_CODED_ORDER
draw_horiz_band() is called in coded order instead of display
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define SLICE_FLAG_ALLOW_FIELD
allow draw_horiz_band() with field slices (MPEG-2 field pics)
This structure describes decoded (raw) audio or video data.
const struct AVCodec * codec
#define USES_LIST(a, list)
static av_always_inline float scale(float x, float s)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_table, uint32_t *mbtype_table, int8_t *qscale_table, int16_t(*motion_val[2])[2], int mb_width, int mb_height, int mb_stride, int quarter_sample)
Print debugging info for the given picture.
int slice_flags
slice flags
enum AVPictureType pict_type
Picture type of the frame.
void ff_draw_horiz_band(AVCodecContext *avctx, AVFrame *cur, AVFrame *last, int y, int h, int picture_structure, int first_field, int low_delay)
Draw a horizontal band if supported.
#define AV_NUM_DATA_POINTERS
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
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define i(width, name, range_min, range_max)
#define av_malloc_array(a, b)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
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.
main external API structure.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
int export_side_data
Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of metadata exported in frame,...
static int shift(int a, int b)
#define AV_CODEC_EXPORT_DATA_MVS
Export motion vectors through frame side data.
int frame_number
Frame counter, set by libavcodec.
Structure to hold side data for an AVFrame.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static int add_mb(AVMotionVector *mb, uint32_t mb_type, int dst_x, int dst_y, int motion_x, int motion_y, int motion_scale, int direction)
@ AV_FRAME_DATA_MOTION_VECTORS
Motion vectors exported by some codecs (on demand through the export_mvs flag set in the libavcodec A...
static int first_field(const struct video_data *s)