FFmpeg
Data Structures | Macros | Functions | Variables
vf_elbg.c File Reference
#include "libavcodec/elbg.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/random_seed.h"
#include "avfilter.h"
#include "drawutils.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  ELBGFilterContext
 

Macros

#define OFFSET(x)   offsetof(ELBGFilterContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define NB_COMPONENTS   4
 
#define R   0
 
#define G   1
 
#define B   2
 
#define A   3
 

Functions

 AVFILTER_DEFINE_CLASS (elbg)
 
static av_cold int init (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption elbg_options []
 
static const AVFilterPad elbg_inputs []
 
const AVFilter ff_vf_elbg
 

Detailed Description

video quantizer filter based on ELBG

Definition in file vf_elbg.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 54 of file vf_elbg.c.

◆ FLAGS

Definition at line 55 of file vf_elbg.c.

◆ NB_COMPONENTS

#define NB_COMPONENTS   4

Definition at line 111 of file vf_elbg.c.

◆ R

#define R   0

Definition at line 141 of file vf_elbg.c.

◆ G

#define G   1

Definition at line 142 of file vf_elbg.c.

◆ B

#define B   2

Definition at line 143 of file vf_elbg.c.

◆ A

#define A   3

Definition at line 144 of file vf_elbg.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( elbg  )

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 71 of file vf_elbg.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 87 of file vf_elbg.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 113 of file vf_elbg.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 146 of file vf_elbg.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 236 of file vf_elbg.c.

Variable Documentation

◆ elbg_options

const AVOption elbg_options[]
static
Initial value:
= {
{ "codebook_length", "set codebook length", OFFSET(codebook_length), AV_OPT_TYPE_INT, { .i64 = 256 }, 1, INT_MAX, FLAGS },
{ "l", "set codebook length", OFFSET(codebook_length), AV_OPT_TYPE_INT, { .i64 = 256 }, 1, INT_MAX, FLAGS },
{ "nb_steps", "set max number of steps used to compute the mapping", OFFSET(max_steps_nb), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, INT_MAX, FLAGS },
{ "n", "set max number of steps used to compute the mapping", OFFSET(max_steps_nb), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, INT_MAX, FLAGS },
{ "seed", "set the random seed", OFFSET(lfg_seed), AV_OPT_TYPE_INT64, {.i64 = -1}, -1, UINT32_MAX, FLAGS },
{ "s", "set the random seed", OFFSET(lfg_seed), AV_OPT_TYPE_INT64, { .i64 = -1 }, -1, UINT32_MAX, FLAGS },
{ "pal8", "set the pal8 output", OFFSET(pal8), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS },
{ "use_alpha", "use alpha channel for mapping", OFFSET(use_alpha), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 57 of file vf_elbg.c.

◆ elbg_inputs

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

Definition at line 247 of file vf_elbg.c.

◆ ff_vf_elbg

const AVFilter ff_vf_elbg
Initial value:
= {
.name = "elbg",
.description = NULL_IF_CONFIG_SMALL("Apply posterize effect, using the ELBG algorithm."),
.priv_size = sizeof(ELBGFilterContext),
.priv_class = &elbg_class,
.init = init,
}

Definition at line 257 of file vf_elbg.c.

OFFSET
#define OFFSET(x)
Definition: vf_elbg.c:54
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_elbg.c:87
elbg_inputs
static const AVFilterPad elbg_inputs[]
Definition: vf_elbg.c:247
ff_video_default_filterpad
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition: video.c:37
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Definition: opt.h:236
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_elbg.c:71
NULL
#define NULL
Definition: coverity.c:32
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:106
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition: vf_elbg.c:146
ELBGFilterContext
Definition: vf_elbg.c:37
FLAGS
#define FLAGS
Definition: vf_elbg.c:55
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_elbg.c:236
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_elbg.c:113
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
AVFILTERPAD_FLAG_NEEDS_WRITABLE
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.
Definition: internal.h:52