FFmpeg
Data Structures | Macros | Functions | Variables
vf_colorlevels.c File Reference
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.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  Range
 
struct  ColorLevelsContext
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

#define R   0
 
#define G   1
 
#define B   2
 
#define A   3
 
#define OFFSET(x)   offsetof(ColorLevelsContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
#define LOAD_COMMON
 

Functions

 AVFILTER_DEFINE_CLASS (colorlevels)
 
static int query_formats (AVFilterContext *ctx)
 
static int colorlevels_slice_8 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int colorlevels_slice_16 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 

Variables

static const AVOption colorlevels_options []
 
static const AVFilterPad colorlevels_inputs []
 
static const AVFilterPad colorlevels_outputs []
 
const AVFilter ff_vf_colorlevels
 

Macro Definition Documentation

◆ R

#define R   0

Definition at line 30 of file vf_colorlevels.c.

◆ G

#define G   1

Definition at line 31 of file vf_colorlevels.c.

◆ B

#define B   2

Definition at line 32 of file vf_colorlevels.c.

◆ A

#define A   3

Definition at line 33 of file vf_colorlevels.c.

◆ OFFSET

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

Definition at line 53 of file vf_colorlevels.c.

◆ FLAGS

Definition at line 54 of file vf_colorlevels.c.

◆ LOAD_COMMON

#define LOAD_COMMON
Value:
ColorLevelsContext *s = ctx->priv; \
const ThreadData *td = arg; \
const int process_h = td->h; \
const int slice_start = (process_h * jobnr ) / nb_jobs; \
const int slice_end = (process_h * (jobnr+1)) / nb_jobs; \
const uint8_t *srcrow = td->srcrow; \
uint8_t *dstrow = td->dstrow; \
const int step = s->step;

Definition at line 110 of file vf_colorlevels.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( colorlevels  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 77 of file vf_colorlevels.c.

◆ colorlevels_slice_8()

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

Definition at line 120 of file vf_colorlevels.c.

Referenced by config_input().

◆ colorlevels_slice_16()

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

Definition at line 142 of file vf_colorlevels.c.

Referenced by config_input().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 164 of file vf_colorlevels.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 183 of file vf_colorlevels.c.

Variable Documentation

◆ colorlevels_options

const AVOption colorlevels_options[]
static
Initial value:
= {
{ "rimin", "set input red black point", OFFSET(range[R].in_min), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS },
{ "gimin", "set input green black point", OFFSET(range[G].in_min), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS },
{ "bimin", "set input blue black point", OFFSET(range[B].in_min), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS },
{ "aimin", "set input alpha black point", OFFSET(range[A].in_min), AV_OPT_TYPE_DOUBLE, {.dbl=0}, -1, 1, FLAGS },
{ "rimax", "set input red white point", OFFSET(range[R].in_max), AV_OPT_TYPE_DOUBLE, {.dbl=1}, -1, 1, FLAGS },
{ "gimax", "set input green white point", OFFSET(range[G].in_max), AV_OPT_TYPE_DOUBLE, {.dbl=1}, -1, 1, FLAGS },
{ "bimax", "set input blue white point", OFFSET(range[B].in_max), AV_OPT_TYPE_DOUBLE, {.dbl=1}, -1, 1, FLAGS },
{ "aimax", "set input alpha white point", OFFSET(range[A].in_max), AV_OPT_TYPE_DOUBLE, {.dbl=1}, -1, 1, FLAGS },
{ "romin", "set output red black point", OFFSET(range[R].out_min), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 1, FLAGS },
{ "gomin", "set output green black point", OFFSET(range[G].out_min), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 1, FLAGS },
{ "bomin", "set output blue black point", OFFSET(range[B].out_min), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 1, FLAGS },
{ "aomin", "set output alpha black point", OFFSET(range[A].out_min), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, 1, FLAGS },
{ "romax", "set output red white point", OFFSET(range[R].out_max), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS },
{ "gomax", "set output green white point", OFFSET(range[G].out_max), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS },
{ "bomax", "set output blue white point", OFFSET(range[B].out_max), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS },
{ "aomax", "set output alpha white point", OFFSET(range[A].out_max), AV_OPT_TYPE_DOUBLE, {.dbl=1}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 55 of file vf_colorlevels.c.

◆ colorlevels_inputs

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

Definition at line 300 of file vf_colorlevels.c.

◆ colorlevels_outputs

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

Definition at line 310 of file vf_colorlevels.c.

◆ ff_vf_colorlevels

const AVFilter ff_vf_colorlevels
Initial value:
= {
.name = "colorlevels",
.description = NULL_IF_CONFIG_SMALL("Adjust the color levels."),
.priv_size = sizeof(ColorLevelsContext),
.priv_class = &colorlevels_class,
}

Definition at line 318 of file vf_colorlevels.c.

td
#define td
Definition: regdef.h:70
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_colorlevels.c:183
colorlevels_inputs
static const AVFilterPad colorlevels_inputs[]
Definition: vf_colorlevels.c:300
step
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
Definition: rate_distortion.txt:58
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_colorlevels.c:164
A
#define A
Definition: vf_colorlevels.c:33
ColorLevelsContext
Definition: vf_colorlevels.c:40
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
s
#define s(width, name)
Definition: cbs_vp9.c:257
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Definition: opt.h:226
slice_end
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:2031
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
ctx
AVFormatContext * ctx
Definition: movenc.c:48
arg
const char * arg
Definition: jacosubdec.c:67
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_colorlevels.c:77
NULL
#define NULL
Definition: coverity.c:32
G
#define G
Definition: vf_colorlevels.c:31
OFFSET
#define OFFSET(x)
Definition: vf_colorlevels.c:53
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:116
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: af_acrusher.c:336
ff_filter_process_command
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition: avfilter.c:842
B
#define B
Definition: vf_colorlevels.c:32
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:126
ThreadData
Used for passing data between threads.
Definition: dsddec.c:67
colorlevels_outputs
static const AVFilterPad colorlevels_outputs[]
Definition: vf_colorlevels.c:310
FLAGS
#define FLAGS
Definition: vf_colorlevels.c:54
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:117
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
R
#define R
Definition: vf_colorlevels.c:30