vf_delogo.c File Reference

A very simple tv station logo remover Ported from MPlayer libmpcodecs/vf_delogo.c. More...

#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"

Go to the source code of this file.

Data Structures

struct  DelogoContext
 

Macros

#define OFFSET(x)   offsetof(DelogoContext, x)
 
#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, int logo_x, int logo_y, int logo_w, int logo_h, int band, int show, int direct)
 Apply a simple delogo algorithm to the image in dst and put the result in src. More...
 
static const char * delogo_get_name (void *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx, const char *args, void *opaque)
 
static void start_frame (AVFilterLink *inlink, AVFilterBufferRef *inpicref)
 
static void null_draw_slice (AVFilterLink *link, int y, int h, int slice_dir)
 
static void end_frame (AVFilterLink *inlink)
 

Variables

static const AVOption delogo_options []
 
static const AVClass delogo_class
 
AVFilter avfilter_vf_delogo
 

Detailed Description

A very simple tv station logo remover Ported from MPlayer libmpcodecs/vf_delogo.c.

Definition in file vf_delogo.c.

Macro Definition Documentation

#define CHECK_UNSET_OPT (   opt)
Value:
if (delogo->opt == -1) { \
av_log(delogo, AV_LOG_ERROR, "Option %s was not set.\n", #opt); \
return AVERROR(EINVAL); \
}
#define AVERROR(e)
Definition: error.h:43
void av_log(void *avcl, int level, const char *fmt,...)
Definition: log.c:140
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:111

Referenced by init().

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

Definition at line 134 of file vf_delogo.c.

Function Documentation

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

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

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 51 of file vf_delogo.c.

Referenced by end_frame().

static const char* delogo_get_name ( void ctx)
static

Definition at line 147 of file vf_delogo.c.

static void end_frame ( AVFilterLink inlink)
static

Definition at line 234 of file vf_delogo.c.

static av_cold int init ( AVFilterContext ctx,
const char *  args,
void opaque 
)
static

Definition at line 171 of file vf_delogo.c.

static void null_draw_slice ( AVFilterLink link,
int  y,
int  h,
int  slice_dir 
)
static

Definition at line 232 of file vf_delogo.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 158 of file vf_delogo.c.

static void start_frame ( AVFilterLink inlink,
AVFilterBufferRef inpicref 
)
static

Definition at line 214 of file vf_delogo.c.

Variable Documentation

AVFilter avfilter_vf_delogo
Initial value:
= {
.name = "delogo",
.description = NULL_IF_CONFIG_SMALL("Remove logo from input video."),
.priv_size = sizeof(DelogoContext),
.init = init,
.inputs = (AVFilterPad[]) {{ .name = "default",
.get_video_buffer = avfilter_null_get_video_buffer,
.start_frame = start_frame,
.draw_slice = null_draw_slice,
.end_frame = end_frame,
.min_perms = AV_PERM_WRITE | AV_PERM_READ,
.rej_perms = AV_PERM_PRESERVE },
{ .name = NULL}},
.outputs = (AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO, },
{ .name = NULL}},
}
static int query_formats(AVFilterContext *ctx)
Definition: vf_delogo.c:158
#define AV_PERM_READ
can read from the buffer
Definition: avfilter.h:81
static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
Definition: vf_delogo.c:171
A filter pad used for either input or output.
Definition: avfilter.h:312
static void null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
Definition: vf_delogo.c:232
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:191
static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
Definition: vf_delogo.c:214
NULL
Definition: eval.c:50
static void end_frame(AVFilterLink *inlink)
Definition: vf_delogo.c:234
AVFilterBufferRef * avfilter_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
get_video_buffer() handler for filters which simply pass video along
Definition: defaults.c:288
#define AV_PERM_PRESERVE
nobody else can overwrite the buffer
Definition: avfilter.h:83
#define AV_PERM_WRITE
can write to the buffer
Definition: avfilter.h:82

Definition at line 265 of file vf_delogo.c.

const AVClass delogo_class
static
Initial value:
= {
.class_name = "DelogoContext",
.item_name = delogo_get_name,
.option = delogo_options,
}
static const char * delogo_get_name(void *ctx)
Definition: vf_delogo.c:147
static const AVOption delogo_options[]
Definition: vf_delogo.c:136

Definition at line 152 of file vf_delogo.c.

Referenced by init().

const AVOption delogo_options[]
static
Initial value:
= {
{"x", "set logo x position", OFFSET(x), FF_OPT_TYPE_INT, {-1}, -1, INT_MAX },
{"y", "set logo y position", OFFSET(y), FF_OPT_TYPE_INT, {-1}, -1, INT_MAX },
{"w", "set logo width", OFFSET(w), FF_OPT_TYPE_INT, {-1}, -1, INT_MAX },
{"h", "set logo height", OFFSET(h), FF_OPT_TYPE_INT, {-1}, -1, INT_MAX },
{"band", "set delogo area band size", OFFSET(band), FF_OPT_TYPE_INT, { 4}, -1, INT_MAX },
{"t", "set delogo area band size", OFFSET(band), FF_OPT_TYPE_INT, { 4}, -1, INT_MAX },
{"show", "show delogo area", OFFSET(show), FF_OPT_TYPE_INT, { 0}, 0, 1 },
{NULL},
}
#define OFFSET(x)
Definition: vf_delogo.c:134
NULL
Definition: eval.c:50

Definition at line 136 of file vf_delogo.c.