FFmpeg
Data Structures | Macros | Functions | Variables
vf_colorcontrast.c File Reference
#include <float.h>
#include "libavutil/opt.h"
#include "libavutil/imgutils.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  ColorContrastContext
 

Macros

#define R   0
 
#define G   1
 
#define B   2
 
#define PROCESS(max)
 
#define OFFSET(x)   offsetof(ColorContrastContext, x)
 
#define VF   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 

Functions

static float lerpf (float v0, float v1, float f)
 
static int colorcontrast_slice8 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int colorcontrast_slice16 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int colorcontrast_slice8p (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int colorcontrast_slice16p (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *link, AVFrame *frame)
 
static av_cold int query_formats (AVFilterContext *ctx)
 
static av_cold int config_input (AVFilterLink *inlink)
 
 AVFILTER_DEFINE_CLASS (colorcontrast)
 

Variables

static const AVFilterPad colorcontrast_inputs []
 
static const AVFilterPad colorcontrast_outputs []
 
static const AVOption colorcontrast_options []
 
AVFilter ff_vf_colorcontrast
 

Macro Definition Documentation

◆ R

#define R   0

Definition at line 31 of file vf_colorcontrast.c.

◆ G

#define G   1

Definition at line 32 of file vf_colorcontrast.c.

◆ B

#define B   2

Definition at line 33 of file vf_colorcontrast.c.

◆ PROCESS

#define PROCESS (   max)

Definition at line 55 of file vf_colorcontrast.c.

◆ OFFSET

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

Definition at line 382 of file vf_colorcontrast.c.

◆ VF

Definition at line 383 of file vf_colorcontrast.c.

Function Documentation

◆ lerpf()

static float lerpf ( float  v0,
float  v1,
float  f 
)
inlinestatic

Definition at line 50 of file vf_colorcontrast.c.

◆ colorcontrast_slice8()

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

Definition at line 92 of file vf_colorcontrast.c.

Referenced by config_input().

◆ colorcontrast_slice16()

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

Definition at line 144 of file vf_colorcontrast.c.

Referenced by config_input().

◆ colorcontrast_slice8p()

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

Definition at line 198 of file vf_colorcontrast.c.

Referenced by config_input().

◆ colorcontrast_slice16p()

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

Definition at line 248 of file vf_colorcontrast.c.

Referenced by config_input().

◆ filter_frame()

static int filter_frame ( AVFilterLink link,
AVFrame frame 
)
static

Definition at line 300 of file vf_colorcontrast.c.

◆ query_formats()

static av_cold int query_formats ( AVFilterContext ctx)
static

Definition at line 313 of file vf_colorcontrast.c.

◆ config_input()

static av_cold int config_input ( AVFilterLink inlink)
static

Definition at line 339 of file vf_colorcontrast.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( colorcontrast  )

Variable Documentation

◆ colorcontrast_inputs

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

Definition at line 363 of file vf_colorcontrast.c.

◆ colorcontrast_outputs

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

Definition at line 374 of file vf_colorcontrast.c.

◆ colorcontrast_options

const AVOption colorcontrast_options[]
static
Initial value:
= {
{ "rc", "set the red-cyan contrast", OFFSET(rc), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, VF },
{ "gm", "set the green-magenta contrast", OFFSET(gm), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, VF },
{ "by", "set the blue-yellow contrast", OFFSET(by), AV_OPT_TYPE_FLOAT, {.dbl=0}, -1, 1, VF },
{ "rcw", "set the red-cyan weight", OFFSET(rcw), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 1, VF },
{ "gmw", "set the green-magenta weight", OFFSET(gmw), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 1, VF },
{ "byw", "set the blue-yellow weight", OFFSET(byw), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 1, VF },
{ "pl", "set the amount of preserving lightness", OFFSET(preserve), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 1, VF },
{ NULL }
}

Definition at line 385 of file vf_colorcontrast.c.

◆ ff_vf_colorcontrast

AVFilter ff_vf_colorcontrast
Initial value:
= {
.name = "colorcontrast",
.description = NULL_IF_CONFIG_SMALL("Adjust color contrast between RGB components."),
.priv_size = sizeof(ColorContrastContext),
.priv_class = &colorcontrast_class,
}

Definition at line 398 of file vf_colorcontrast.c.

VF
#define VF
Definition: vf_colorcontrast.c:383
OFFSET
#define OFFSET(x)
Definition: vf_colorcontrast.c:382
ColorContrastContext
Definition: vf_colorcontrast.c:35
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
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:117
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
query_formats
static av_cold int query_formats(AVFilterContext *ctx)
Definition: vf_colorcontrast.c:313
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:882
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
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
filter_frame
static int filter_frame(AVFilterLink *link, AVFrame *frame)
Definition: vf_colorcontrast.c:300
colorcontrast_outputs
static const AVFilterPad colorcontrast_outputs[]
Definition: vf_colorcontrast.c:374
colorcontrast_inputs
static const AVFilterPad colorcontrast_inputs[]
Definition: vf_colorcontrast.c:363
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
config_input
static av_cold int config_input(AVFilterLink *inlink)
Definition: vf_colorcontrast.c:339