FFmpeg
Data Structures | Macros | Functions | Variables
vf_delogo.c File Reference
#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

◆ OFFSET

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

Definition at line 161 of file vf_delogo.c.

◆ FLAGS

Definition at line 162 of file vf_delogo.c.

◆ CHECK_UNSET_OPT

#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); \
}

Function Documentation

◆ apply_delogo()

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()

AVFILTER_DEFINE_CLASS ( delogo  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 180 of file vf_delogo.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 194 of file vf_delogo.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 229 of file vf_delogo.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 243 of file vf_delogo.c.

Variable Documentation

◆ delogo_options

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 },
{ "show", "show delogo area", OFFSET(show), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, FLAGS },
{ NULL }
}

Definition at line 164 of file vf_delogo.c.

◆ avfilter_vf_delogo_inputs

const AVFilterPad avfilter_vf_delogo_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
{ NULL }
}

Definition at line 296 of file vf_delogo.c.

◆ avfilter_vf_delogo_outputs

const AVFilterPad avfilter_vf_delogo_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}

Definition at line 306 of file vf_delogo.c.

◆ ff_vf_delogo

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,
}

Definition at line 314 of file vf_delogo.c.

AVERROR
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
w
uint8_t w
Definition: llviddspenc.c:38
avfilter_vf_delogo_inputs
static const AVFilterPad avfilter_vf_delogo_inputs[]
Definition: vf_delogo.c:296
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_delogo.c:194
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_delogo.c:229
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_delogo.c:243
s
#define s(width, name)
Definition: cbs_vp9.c:257
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
NULL
#define NULL
Definition: coverity.c:32
inputs
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
Definition: filter_design.txt:243
FLAGS
#define FLAGS
Definition: vf_delogo.c:162
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
DelogoContext
Definition: vf_delogo.c:156
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#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
OFFSET
#define OFFSET(x)
Definition: vf_delogo.c:161
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
avfilter_vf_delogo_outputs
static const AVFilterPad avfilter_vf_delogo_outputs[]
Definition: vf_delogo.c:306
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_delogo.c:180
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:240
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
h
h
Definition: vp9dsp_template.c:2038