Go to the documentation of this file.
49 #define OFFSET(x) offsetof(MEContext, x)
50 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
51 #define CONST(name, help, val, unit) { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, 0, 0, FLAGS, unit }
97 s->mb_size = 1 <<
s->log2_mb_size;
99 s->b_width =
inlink->w >>
s->log2_mb_size;
100 s->b_height =
inlink->h >>
s->log2_mb_size;
101 s->b_count =
s->b_width *
s->b_height;
103 for (
i = 0;
i < 3;
i++) {
115 int x,
int y,
int x_mv,
int y_mv,
int dir)
119 mv->dst_x =
x + (mb_size >> 1);
120 mv->dst_y = y + (mb_size >> 1);
121 mv->src_x = x_mv + (mb_size >> 1);
122 mv->src_y = y_mv + (mb_size >> 1);
123 mv->source = dir ? 1 : -1;
127 #define SEARCH_MV(method)\
129 for (mb_y = 0; mb_y < s->b_height; mb_y++)\
130 for (mb_x = 0; mb_x < s->b_width; mb_x++) {\
131 const int x_mb = mb_x << s->log2_mb_size;\
132 const int y_mb = mb_y << s->log2_mb_size;\
133 int mv[2] = {x_mb, y_mb};\
134 ff_me_search_##method(me_ctx, x_mb, y_mb, mv);\
135 add_mv_data(((AVMotionVector *) sd->data) + mv_count++, me_ctx->mb_size, x_mb, y_mb, mv[0], mv[1], dir);\
139 #define ADD_PRED(preds, px, py)\
141 preds.mvs[preds.nb][0] = px;\
142 preds.mvs[preds.nb][1] = py;\
167 s->mv_table[2] = memcpy(
s->mv_table[2],
s->mv_table[1],
sizeof(*
s->mv_table[1]) *
s->b_count);
168 s->mv_table[1] = memcpy(
s->mv_table[1],
s->mv_table[0],
sizeof(*
s->mv_table[0]) *
s->b_count);
192 for (dir = 0; dir < 2; dir++) {
210 for (mb_y = 0; mb_y <
s->b_height; mb_y++)
211 for (mb_x = 0; mb_x <
s->b_width; mb_x++) {
212 const int mb_i = mb_x + mb_y *
s->b_width;
213 const int x_mb = mb_x <<
s->log2_mb_size;
214 const int y_mb = mb_y <<
s->log2_mb_size;
215 int mv[2] = {x_mb, y_mb};
224 ADD_PRED(preds[0],
s->mv_table[0][mb_i - 1][dir][0],
s->mv_table[0][mb_i - 1][dir][1]);
228 ADD_PRED(preds[0],
s->mv_table[0][mb_i -
s->b_width][dir][0],
s->mv_table[0][mb_i -
s->b_width][dir][1]);
231 if (mb_x + 1 <
s->b_width)
232 ADD_PRED(preds[0],
s->mv_table[0][mb_i -
s->b_width + 1][dir][0],
s->mv_table[0][mb_i -
s->b_width + 1][dir][1]);
235 ADD_PRED(preds[0],
s->mv_table[0][mb_i -
s->b_width - 1][dir][0],
s->mv_table[0][mb_i -
s->b_width - 1][dir][1]);
239 if (preds[0].nb == 4) {
240 me_ctx->
pred_x =
mid_pred(preds[0].mvs[1][0], preds[0].mvs[2][0], preds[0].mvs[3][0]);
241 me_ctx->
pred_y =
mid_pred(preds[0].mvs[1][1], preds[0].mvs[2][1], preds[0].mvs[3][1]);
242 }
else if (preds[0].nb == 3) {
243 me_ctx->
pred_x =
mid_pred(0, preds[0].mvs[1][0], preds[0].mvs[2][0]);
244 me_ctx->
pred_y =
mid_pred(0, preds[0].mvs[1][1], preds[0].mvs[2][1]);
245 }
else if (preds[0].nb == 2) {
255 s->mv_table[0][mb_i][dir][0] =
mv[0] - x_mb;
256 s->mv_table[0][mb_i][dir][1] =
mv[1] - y_mb;
262 for (mb_y = 0; mb_y <
s->b_height; mb_y++)
263 for (mb_x = 0; mb_x <
s->b_width; mb_x++) {
264 const int mb_i = mb_x + mb_y *
s->b_width;
265 const int x_mb = mb_x <<
s->log2_mb_size;
266 const int y_mb = mb_y <<
s->log2_mb_size;
267 int mv[2] = {x_mb, y_mb};
277 ADD_PRED(preds[0],
s->mv_table[0][mb_i - 1][dir][0],
s->mv_table[0][mb_i - 1][dir][1]);
281 ADD_PRED(preds[0],
s->mv_table[0][mb_i -
s->b_width][dir][0],
s->mv_table[0][mb_i -
s->b_width][dir][1]);
284 if (mb_y > 0 && mb_x + 1 <
s->b_width)
285 ADD_PRED(preds[0],
s->mv_table[0][mb_i -
s->b_width + 1][dir][0],
s->mv_table[0][mb_i -
s->b_width + 1][dir][1]);
288 if (preds[0].nb == 4) {
289 me_ctx->
pred_x =
mid_pred(preds[0].mvs[1][0], preds[0].mvs[2][0], preds[0].mvs[3][0]);
290 me_ctx->
pred_y =
mid_pred(preds[0].mvs[1][1], preds[0].mvs[2][1], preds[0].mvs[3][1]);
291 }
else if (preds[0].nb == 3) {
292 me_ctx->
pred_x =
mid_pred(0, preds[0].mvs[1][0], preds[0].mvs[2][0]);
293 me_ctx->
pred_y =
mid_pred(0, preds[0].mvs[1][1], preds[0].mvs[2][1]);
294 }
else if (preds[0].nb == 2) {
303 ADD_PRED(preds[0],
s->mv_table[1][mb_i][dir][0],
s->mv_table[1][mb_i][dir][1]);
306 ADD_PRED(preds[1],
s->mv_table[1][mb_i][dir][0] + (
s->mv_table[1][mb_i][dir][0] -
s->mv_table[2][mb_i][dir][0]),
307 s->mv_table[1][mb_i][dir][1] + (
s->mv_table[1][mb_i][dir][1] -
s->mv_table[2][mb_i][dir][1]));
311 ADD_PRED(preds[1],
s->mv_table[1][mb_i - 1][dir][0],
s->mv_table[1][mb_i - 1][dir][1]);
315 ADD_PRED(preds[1],
s->mv_table[1][mb_i -
s->b_width][dir][0],
s->mv_table[1][mb_i -
s->b_width][dir][1]);
318 if (mb_x + 1 <
s->b_width)
319 ADD_PRED(preds[1],
s->mv_table[1][mb_i + 1][dir][0],
s->mv_table[1][mb_i + 1][dir][1]);
322 if (mb_y + 1 <
s->b_height)
323 ADD_PRED(preds[1],
s->mv_table[1][mb_i +
s->b_width][dir][0],
s->mv_table[1][mb_i +
s->b_width][dir][1]);
327 s->mv_table[0][mb_i][dir][0] =
mv[0] - x_mb;
328 s->mv_table[0][mb_i][dir][1] =
mv[1] - y_mb;
346 for (
i = 0;
i < 3;
i++)
372 .priv_class = &mestimate_class,
static int query_formats(AVFilterContext *ctx)
AVPixelFormat
Pixel format.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int(*[3] mv_table)[2][2]
motion vectors of current & prev 2 frames
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, int size)
Add a new side data to a frame.
static const int8_t mv[256][2]
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
static const AVFilterPad mestimate_outputs[]
This structure describes decoded (raw) audio or video data.
void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
const char * name
Filter name.
static void add_mv_data(AVMotionVector *mv, int mb_size, int x, int y, int x_mv, int y_mv, int dir)
AVMotionEstContext me_ctx
int method
motion estimation method
A link between two filters.
Copyright (c) 2016 Davinder Singh (DSM_) <ds.mudhar<@gmail.com>
int pred_x
median predictor x
#define SEARCH_MV(method)
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
static int config_input(AVFilterLink *inlink)
#define AV_ME_METHOD_ESA
Copyright (c) 2016 Davinder Singh (DSM_) <ds.mudhar<@gmail.com>
A filter pad used for either input or output.
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
AVFILTER_DEFINE_CLASS(mestimate)
static const AVFilterPad outputs[]
static enum AVPixelFormat pix_fmts[]
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
#define CONST(name, help, val, unit)
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
static const AVFilterPad mestimate_inputs[]
Describe the class of an AVClass context structure.
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define ADD_PRED(preds, px, py)
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
uint64_t ff_me_search_epzs(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv)
static const AVOption mestimate_options[]
#define AV_NOPTS_VALUE
Undefined timestamp value.
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
#define AV_ME_METHOD_EPZS
#define i(width, name, range_min, range_max)
#define AV_ME_METHOD_HEXBS
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
const char * name
Pad name.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
void ff_me_init_context(AVMotionEstContext *me_ctx, int mb_size, int search_param, int width, int height, int x_min, int x_max, int y_min, int y_max)
static av_cold void uninit(AVFilterContext *ctx)
int search_param
search parameter
int mb_size
macroblock size
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
int pred_y
median predictor y
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
#define AV_ME_METHOD_NTSS
Structure to hold side data for an AVFrame.
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
@ AV_FRAME_DATA_MOTION_VECTORS
Motion vectors exported by some codecs (on demand through the export_mvs flag set in the libavcodec A...
uint64_t ff_me_search_umh(AVMotionEstContext *me_ctx, int x_mb, int y_mb, int *mv)
#define AV_ME_METHOD_TDLS
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
AVMotionEstPredictor preds[2]
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
static av_always_inline av_const int av_ceil_log2_c(int x)
Compute ceil(log2(x)).