83#define OFFSET(x) offsetof(MCDeintContext, x)
84#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
85#define CONST(name, help, val, u) { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, INT_MIN, INT_MAX, FLAGS, .unit = u }
128 enc_ctx->
width = inlink->
w;
142 switch (mcdeint->
mode) {
208 for (
i = 0;
i < 3;
i++) {
219 int srcs =
inpic ->linesize[
i];
222 for (y = 0; y <
h; y++) {
223 if ((y ^ mcdeint->
parity) & 1) {
224 for (x = 0; x <
w; x++) {
225 uint8_t *
filp = &frame_dec->
data[
i][x + y*fils];
226 uint8_t *srcp = &
inpic ->data[
i][x + y*srcs];
227 uint8_t *dstp = &outpic ->
data[
i][x + y*dsts];
229 if (y > 0 && y <
h-1){
230 int is_edge = x < 3 || x >
w-4;
231 int diff0 =
filp[-fils] - srcp[-srcs];
232 int diff1 =
filp[+fils] - srcp[+srcs];
235#define DELTA(j) av_clip(j, -x, w-1-x)
237#define GET_SCORE_EDGE(j)\
238 FFABS(srcp[-srcs+DELTA(-1+(j))] - srcp[+srcs+DELTA(-1-(j))])+\
239 FFABS(srcp[-srcs+DELTA(j) ] - srcp[+srcs+DELTA( -(j))])+\
240 FFABS(srcp[-srcs+DELTA(1+(j)) ] - srcp[+srcs+DELTA( 1-(j))])
243 FFABS(srcp[-srcs-1+(j)] - srcp[+srcs-1-(j)])+\
244 FFABS(srcp[-srcs +(j)] - srcp[+srcs -(j)])+\
245 FFABS(srcp[-srcs+1+(j)] - srcp[+srcs+1-(j)])
247#define CHECK_EDGE(j)\
248 { int score = GET_SCORE_EDGE(j);\
249 if (score < spatial_score){\
250 spatial_score = score;\
251 diff0 = filp[-fils+DELTA(j)] - srcp[-srcs+DELTA(j)];\
252 diff1 = filp[+fils+DELTA(-(j))] - srcp[+srcs+DELTA(-(j))];\
255 { int score = GET_SCORE(j);\
256 if (score < spatial_score){\
257 spatial_score= score;\
258 diff0 = filp[-fils+(j)] - srcp[-srcs+(j)];\
259 diff1 = filp[+fils-(j)] - srcp[+srcs-(j)];\
272 if (diff0 + diff1 > 0)
284 for (y = 0; y <
h; y++) {
285 if (!((y ^ mcdeint->parity) & 1)) {
286 for (x = 0; x <
w; x++) {
287 frame_dec->data[
i][x + y*fils] =
288 outpic ->data[
i][x + y*dsts] =
inpic->data[
i][x + y*srcs];
293 mcdeint->parity ^= 1;
317 .p.priv_class = &mcdeint_class,
const FFFilter ff_vf_mcdeint
Libavcodec external API header.
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
#define AV_CEIL_RSHIFT(a, b)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AV_CODEC_FLAG_QPEL
Use qpel MC.
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale.
const AVCodec * avcodec_find_encoder(enum AVCodecID id)
Find a registered encoder with a matching codec ID.
#define AV_CODEC_FLAG_LOW_DELAY
Force low delay.
#define AV_CODEC_FLAG_4MV
4 MV per MB allowed / advanced prediction for H.263.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
#define AV_CODEC_FLAG_RECON_FRAME
Request the encoder to output reconstructed frames, i.e. frames that would be produced by decoding th...
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Alias for avcodec_receive_frame_flags(avctx, frame, 0).
int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
Read encoded data from the encoder.
int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame)
Supply a raw video or audio frame to the encoder.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define FF_QP2LAMBDA
factor to convert from H.263 QP to lambda
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FILTER_PIXFMTS(...)
#define AVFILTER_DEFINE_CLASS(fname)
Macro definitions for various function/variable attributes.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static int config_props(AVBitStreamFilterLink *link)
Describe the class of an AVClass context structure.
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
int me_cmp
motion estimation comparison function
int global_quality
Global quality for codecs which cannot change it per frame.
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
int max_b_frames
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 re...
int dia_size
ME diamond size & shape.
int me_sub_cmp
subpixel motion estimation comparison function
int mb_cmp
macroblock comparison function (not supported yet)
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
int refs
number of reference frames
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
int flags
AV_CODEC_FLAG_*.
void * priv
private data for use by the filter
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
This structure stores compressed data.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Rational number (pair of numerator and denominator).
static AVFormatContext * ctx
static AVDictionary * opts
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
return ff_filter_frame(outlink, outpic)
@ PARITY_BFF
bottom field first
@ PARITY_TFF
top field first
static const AVOption mcdeint_options[]
static const AVFilterPad mcdeint_inputs[]
#define CONST(name, help, val, u)
#define GET_SCORE_EDGE(j)
static int config_props(AVFilterLink *inlink)
static av_cold void uninit(AVFilterContext *ctx)
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.