FFmpeg
Data Structures | Macros | Functions | Variables
vf_unsharp.c File Reference
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "unsharp.h"

Go to the source code of this file.

Data Structures

struct  TheadData
 

Macros

#define OFFSET(x)   offsetof(UnsharpContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define MIN_SIZE   3
 
#define MAX_SIZE   23
 

Functions

static int unsharp_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int apply_unsharp_c (AVFilterContext *ctx, AVFrame *in, AVFrame *out)
 
static void set_filter_param (UnsharpFilterParam *fp, int msize_x, int msize_y, float amount)
 
static av_cold int init (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int init_filter_param (AVFilterContext *ctx, UnsharpFilterParam *fp, const char *effect_type, int width)
 
static int config_input (AVFilterLink *inlink)
 
static void free_filter_param (UnsharpFilterParam *fp, int nb_threads)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int filter_frame (AVFilterLink *link, AVFrame *in)
 
 AVFILTER_DEFINE_CLASS (unsharp)
 

Variables

static const AVOption unsharp_options []
 
static const AVFilterPad avfilter_vf_unsharp_inputs []
 
static const AVFilterPad avfilter_vf_unsharp_outputs []
 
AVFilter ff_vf_unsharp
 

Detailed Description

blur / sharpen filter, ported to FFmpeg from MPlayer libmpcodecs/unsharp.c.

This code is based on:

An Efficient algorithm for Gaussian blur using finite-state machines Frederick M. Waltz and John W. V. Miller

SPIE Conf. on Machine Vision Systems for Inspection and Metrology VII Originally published Boston, Nov 98

http://www.engin.umd.umich.edu/~jwvm/ece581/21_GBlur.pdf

Definition in file vf_unsharp.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 302 of file vf_unsharp.c.

◆ FLAGS

Definition at line 303 of file vf_unsharp.c.

◆ MIN_SIZE

#define MIN_SIZE   3

Definition at line 304 of file vf_unsharp.c.

◆ MAX_SIZE

#define MAX_SIZE   23

Definition at line 305 of file vf_unsharp.c.

Function Documentation

◆ unsharp_slice()

static int unsharp_slice ( AVFilterContext ctx,
void *  arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 60 of file vf_unsharp.c.

Referenced by apply_unsharp_c().

◆ apply_unsharp_c()

static int apply_unsharp_c ( AVFilterContext ctx,
AVFrame in,
AVFrame out 
)
static

Definition at line 136 of file vf_unsharp.c.

Referenced by init().

◆ set_filter_param()

static void set_filter_param ( UnsharpFilterParam fp,
int  msize_x,
int  msize_y,
float  amount 
)
static

Definition at line 163 of file vf_unsharp.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 175 of file vf_unsharp.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 190 of file vf_unsharp.c.

◆ init_filter_param()

static int init_filter_param ( AVFilterContext ctx,
UnsharpFilterParam fp,
const char *  effect_type,
int  width 
)
static

Definition at line 204 of file vf_unsharp.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 233 of file vf_unsharp.c.

◆ free_filter_param()

static void free_filter_param ( UnsharpFilterParam fp,
int  nb_threads 
)
static

Definition at line 257 of file vf_unsharp.c.

Referenced by uninit().

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 269 of file vf_unsharp.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 277 of file vf_unsharp.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( unsharp  )

Variable Documentation

◆ unsharp_options

const AVOption unsharp_options[]
static
Initial value:
= {
{ "luma_msize_x", "set luma matrix horizontal size", OFFSET(lmsize_x), AV_OPT_TYPE_INT, { .i64 = 5 }, MIN_SIZE, MAX_SIZE, FLAGS },
{ "lx", "set luma matrix horizontal size", OFFSET(lmsize_x), AV_OPT_TYPE_INT, { .i64 = 5 }, MIN_SIZE, MAX_SIZE, FLAGS },
{ "luma_msize_y", "set luma matrix vertical size", OFFSET(lmsize_y), AV_OPT_TYPE_INT, { .i64 = 5 }, MIN_SIZE, MAX_SIZE, FLAGS },
{ "ly", "set luma matrix vertical size", OFFSET(lmsize_y), AV_OPT_TYPE_INT, { .i64 = 5 }, MIN_SIZE, MAX_SIZE, FLAGS },
{ "luma_amount", "set luma effect strength", OFFSET(lamount), AV_OPT_TYPE_FLOAT, { .dbl = 1 }, -2, 5, FLAGS },
{ "la", "set luma effect strength", OFFSET(lamount), AV_OPT_TYPE_FLOAT, { .dbl = 1 }, -2, 5, FLAGS },
{ "chroma_msize_x", "set chroma matrix horizontal size", OFFSET(cmsize_x), AV_OPT_TYPE_INT, { .i64 = 5 }, MIN_SIZE, MAX_SIZE, FLAGS },
{ "cx", "set chroma matrix horizontal size", OFFSET(cmsize_x), AV_OPT_TYPE_INT, { .i64 = 5 }, MIN_SIZE, MAX_SIZE, FLAGS },
{ "chroma_msize_y", "set chroma matrix vertical size", OFFSET(cmsize_y), AV_OPT_TYPE_INT, { .i64 = 5 }, MIN_SIZE, MAX_SIZE, FLAGS },
{ "cy", "set chroma matrix vertical size", OFFSET(cmsize_y), AV_OPT_TYPE_INT, { .i64 = 5 }, MIN_SIZE, MAX_SIZE, FLAGS },
{ "chroma_amount", "set chroma effect strength", OFFSET(camount), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -2, 5, FLAGS },
{ "ca", "set chroma effect strength", OFFSET(camount), AV_OPT_TYPE_FLOAT, { .dbl = 0 }, -2, 5, FLAGS },
{ "opencl", "ignored", OFFSET(opencl), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
{ NULL }
}

Definition at line 306 of file vf_unsharp.c.

◆ avfilter_vf_unsharp_inputs

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

Definition at line 325 of file vf_unsharp.c.

◆ avfilter_vf_unsharp_outputs

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

Definition at line 335 of file vf_unsharp.c.

◆ ff_vf_unsharp

AVFilter ff_vf_unsharp
Initial value:
= {
.name = "unsharp",
.description = NULL_IF_CONFIG_SMALL("Sharpen or blur the input video."),
.priv_size = sizeof(UnsharpContext),
.priv_class = &unsharp_class,
.init = init,
}

Definition at line 343 of file vf_unsharp.c.

uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_unsharp.c:269
MIN_SIZE
#define MIN_SIZE
Definition: vf_unsharp.c:304
filter_frame
static int filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_unsharp.c:277
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_unsharp.c:233
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_unsharp.c:175
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
MAX_SIZE
#define MAX_SIZE
Definition: vf_unsharp.c:305
UnsharpContext
Definition: unsharp.h:44
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: vf_unsharp.c:302
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
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_unsharp.c:190
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
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
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:226
avfilter_vf_unsharp_outputs
static const AVFilterPad avfilter_vf_unsharp_outputs[]
Definition: vf_unsharp.c:335
FLAGS
#define FLAGS
Definition: vf_unsharp.c:303
avfilter_vf_unsharp_inputs
static const AVFilterPad avfilter_vf_unsharp_inputs[]
Definition: vf_unsharp.c:325
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:240
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565