FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
vf_delogo.c File Reference

A very simple tv station logo remover Originally imported from MPlayer libmpcodecs/vf_delogo.c, the algorithm was later improved. More...

#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  DelogoContext
 

Macros

#define OFFSET(x)   offsetof(DelogoContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define CHECK_UNSET_OPT(opt)
 

Functions

static void apply_delogo (uint8_t *dst, int dst_linesize, uint8_t *src, int src_linesize, int w, int h, AVRational sar, int logo_x, int logo_y, int logo_w, int logo_h, unsigned int band, int show, int direct)
 Apply a simple delogo algorithm to the image in src and put the result in dst. More...
 
 AVFILTER_DEFINE_CLASS (delogo)
 
static int query_formats (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 

Variables

static const AVOption delogo_options []
 
static const AVFilterPad avfilter_vf_delogo_inputs []
 
static const AVFilterPad avfilter_vf_delogo_outputs []
 
AVFilter ff_vf_delogo
 

Detailed Description

A very simple tv station logo remover Originally imported from MPlayer libmpcodecs/vf_delogo.c, the algorithm was later improved.

Definition in file vf_delogo.c.

Macro Definition Documentation

#define OFFSET (   x)    offsetof(DelogoContext, x)

Definition at line 161 of file vf_delogo.c.

Definition at line 162 of file vf_delogo.c.

#define CHECK_UNSET_OPT (   opt)
Value:
if (s->opt == -1) { \
av_log(s, AV_LOG_ERROR, "Option %s was not set.\n", #opt); \
return AVERROR(EINVAL); \
}
const char * s
Definition: avisynth_c.h:768
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
#define AVERROR(e)
Definition: error.h:43
return

Referenced by init().

Function Documentation

static void apply_delogo ( uint8_t dst,
int  dst_linesize,
uint8_t src,
int  src_linesize,
int  w,
int  h,
AVRational  sar,
int  logo_x,
int  logo_y,
int  logo_w,
int  logo_h,
unsigned int  band,
int  show,
int  direct 
)
static

Apply a simple delogo algorithm to the image in src and put the result in dst.

The algorithm is only applied to the region specified by the logo parameters.

Parameters
wwidth of the input image
hheight of the input image
logo_xx coordinate of the top left corner of the logo region
logo_yy coordinate of the top left corner of the logo region
logo_wwidth of the logo
logo_hheight of the logo
bandthe size of the band around the processed area
showshow a rectangle around the processed area, useful for parameters tweaking
directif non-zero perform in-place processing

Definition at line 57 of file vf_delogo.c.

Referenced by filter_frame().

AVFILTER_DEFINE_CLASS ( delogo  )
static int query_formats ( AVFilterContext ctx)
static

Definition at line 180 of file vf_delogo.c.

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 194 of file vf_delogo.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 229 of file vf_delogo.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 243 of file vf_delogo.c.

Variable Documentation

const AVOption delogo_options[]
static
Initial value:
= {
{ "x", "set logo x position", OFFSET(x), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS },
{ "y", "set logo y position", OFFSET(y), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS },
{ "w", "set logo width", OFFSET(w), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS },
{ "h", "set logo height", OFFSET(h), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS },
{ "band", "set delogo area band size", OFFSET(band), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "t", "set delogo area band size", OFFSET(band), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "show", "show delogo area", OFFSET(show), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, FLAGS },
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define FLAGS
Definition: vf_delogo.c:162
#define OFFSET(x)
Definition: vf_delogo.c:161

Definition at line 164 of file vf_delogo.c.

const AVFilterPad avfilter_vf_delogo_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_input(AVFilterLink *inlink)
Definition: vf_delogo.c:229
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_delogo.c:243

Definition at line 296 of file vf_delogo.c.

const AVFilterPad avfilter_vf_delogo_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 306 of file vf_delogo.c.

AVFilter ff_vf_delogo
Initial value:
= {
.name = "delogo",
.description = NULL_IF_CONFIG_SMALL("Remove logo from input video."),
.priv_size = sizeof(DelogoContext),
.priv_class = &delogo_class,
.init = init,
}
static int query_formats(AVFilterContext *ctx)
Definition: vf_delogo.c:180
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:125
static int flags
Definition: log.c:57
static const AVFilterPad avfilter_vf_delogo_outputs[]
Definition: vf_delogo.c:306
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static av_cold int init(AVFilterContext *ctx)
Definition: vf_delogo.c:194
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:386
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:376
static const AVFilterPad avfilter_vf_delogo_inputs[]
Definition: vf_delogo.c:296

Definition at line 314 of file vf_delogo.c.