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

gradfun debanding filter, ported from MPlayer libmpcodecs/vf_gradfun.c More...

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

Go to the source code of this file.


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


void ff_gradfun_filter_line_c (uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers)
void ff_gradfun_blur_line_c (uint16_t *dc, uint16_t *buf, const uint16_t *buf1, const uint8_t *src, int src_linesize, int width)
static void filter (GradFunContext *ctx, uint8_t *dst, const uint8_t *src, int width, int height, int dst_linesize, int src_linesize, int r)
static av_cold int init (AVFilterContext *ctx)
static av_cold void uninit (AVFilterContext *ctx)
static int query_formats (AVFilterContext *ctx)
static int config_input (AVFilterLink *inlink)
static int filter_frame (AVFilterLink *inlink, AVFrame *in)


static const uint16_t dither [8][8]
static const AVOption gradfun_options []
static const AVFilterPad avfilter_vf_gradfun_inputs []
static const AVFilterPad avfilter_vf_gradfun_outputs []
AVFilter ff_vf_gradfun

Detailed Description

gradfun debanding filter, ported from MPlayer libmpcodecs/vf_gradfun.c

Apply a boxblur debanding algorithm (based on the gradfun2db AviSynth filter by prunedtree). For each pixel, if it is within the threshold of the blurred value, make it closer. So now we have a smoothed and higher bitdepth version of all the shallow gradients, while leaving detailed areas untouched. Dither it back to 8bit.

Definition in file vf_gradfun.c.

Macro Definition Documentation

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

Definition at line 225 of file vf_gradfun.c.

Definition at line 226 of file vf_gradfun.c.

Function Documentation

void ff_gradfun_filter_line_c ( uint8_t dst,
const uint8_t src,
const uint16_t *  dc,
int  width,
int  thresh,
const uint16_t *  dithers 

Definition at line 57 of file vf_gradfun.c.

Referenced by init().

void ff_gradfun_blur_line_c ( uint16_t *  dc,
uint16_t *  buf,
const uint16_t *  buf1,
const uint8_t src,
int  src_linesize,
int  width 

Definition at line 71 of file vf_gradfun.c.

Referenced by init().

static void filter ( GradFunContext ctx,
uint8_t dst,
const uint8_t src,
int  width,
int  height,
int  dst_linesize,
int  src_linesize,
int  r 

Definition at line 82 of file vf_gradfun.c.

Referenced by filter_frame().

static av_cold int init ( AVFilterContext ctx)

Definition at line 124 of file vf_gradfun.c.

static av_cold void uninit ( AVFilterContext ctx)

Definition at line 142 of file vf_gradfun.c.

static int query_formats ( AVFilterContext ctx)

Definition at line 148 of file vf_gradfun.c.

static int config_input ( AVFilterLink inlink)

Definition at line 164 of file vf_gradfun.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame in 

Definition at line 183 of file vf_gradfun.c.


Variable Documentation

const uint16_t dither[8][8]
Initial value:
= {

Definition at line 46 of file vf_gradfun.c.

Referenced by filter().

const AVOption gradfun_options[]
Initial value:
= {
{ "strength", "The maximum amount by which the filter will change any one pixel.", OFFSET(strength), AV_OPT_TYPE_FLOAT, { .dbl = 1.2 }, 0.51, 64, FLAGS },
{ "radius", "The neighborhood to fit the gradient to.", OFFSET(radius), AV_OPT_TYPE_INT, { .i64 = 16 }, 4, 32, FLAGS },
{ NULL }
#define NULL
Definition: coverity.c:32
#define FLAGS
Definition: vf_gradfun.c:226
#define OFFSET(x)
Definition: vf_gradfun.c:225

Definition at line 228 of file vf_gradfun.c.

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

Definition at line 236 of file vf_gradfun.c.

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

Definition at line 246 of file vf_gradfun.c.

AVFilter ff_vf_gradfun
Initial value:
= {
.name = "gradfun",
.description = NULL_IF_CONFIG_SMALL("Debands video quickly using gradients."),
.priv_size = sizeof(GradFunContext),
.priv_class = &gradfun_class,
.init = init,
Holds instance-specific information for gradfun.
Definition: gradfun.h:28
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_gradfun_outputs[]
Definition: vf_gradfun.c:246
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_gradfun.c:142
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:389
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:379
static av_cold int init(AVFilterContext *ctx)
Definition: vf_gradfun.c:124
static const AVFilterPad avfilter_vf_gradfun_inputs[]
Definition: vf_gradfun.c:236
static int query_formats(AVFilterContext *ctx)
Definition: vf_gradfun.c:148

Definition at line 254 of file vf_gradfun.c.