FFmpeg
Loading...
Searching...
No Matches
vf_colorcontrast.c File Reference
#include <float.h>
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "drawutils.h"
#include "filters.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)
 
#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 config_input (AVFilterLink *inlink)
 
 AVFILTER_DEFINE_CLASS (colorcontrast)
 

Variables

static enum AVPixelFormat pixel_fmts []
 
static const AVFilterPad colorcontrast_inputs []
 
static const AVOption colorcontrast_options []
 
const FFFilter ff_vf_colorcontrast
 

Macro Definition Documentation

◆ R

#define R   0

Definition at line 30 of file vf_colorcontrast.c.

◆ G

#define G   1

Definition at line 31 of file vf_colorcontrast.c.

◆ B

#define B   2

Definition at line 32 of file vf_colorcontrast.c.

◆ PROCESS

#define PROCESS ( max)

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 361 of file vf_colorcontrast.c.

◆ VF

Function Documentation

◆ lerpf()

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

Definition at line 49 of file vf_colorcontrast.c.

◆ colorcontrast_slice8()

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

Definition at line 91 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 143 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 197 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 247 of file vf_colorcontrast.c.

Referenced by config_input().

◆ filter_frame()

static int filter_frame ( AVFilterLink * link,
AVFrame * frame )
static

Definition at line 299 of file vf_colorcontrast.c.

◆ config_input()

static av_cold int config_input ( AVFilterLink * inlink)
static

Definition at line 327 of file vf_colorcontrast.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( colorcontrast )

Variable Documentation

◆ pixel_fmts

enum AVPixelFormat pixel_fmts[]
static
Initial value:
= {
}
#define AV_PIX_FMT_GBRAP12
Definition pixfmt.h:569
#define AV_PIX_FMT_GBRAP16
Definition pixfmt.h:571
#define AV_PIX_FMT_GBRP9
Definition pixfmt.h:563
#define AV_PIX_FMT_BGR48
Definition pixfmt.h:536
#define AV_PIX_FMT_GBRP10
Definition pixfmt.h:564
#define AV_PIX_FMT_RGBA64
Definition pixfmt.h:535
#define AV_PIX_FMT_GBRP12
Definition pixfmt.h:565
#define AV_PIX_FMT_RGB48
Definition pixfmt.h:531
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition pixfmt.h:75
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition pixfmt.h:265
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition pixfmt.h:99
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition pixfmt.h:102
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition pixfmt.h:101
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
Definition pixfmt.h:264
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition pixfmt.h:100
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition pixfmt.h:212
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
Definition pixfmt.h:263
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition pixfmt.h:76
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition pixfmt.h:165
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
Definition pixfmt.h:262
#define AV_PIX_FMT_BGRA64
Definition pixfmt.h:540
#define AV_PIX_FMT_GBRAP10
Definition pixfmt.h:568
#define AV_PIX_FMT_GBRP16
Definition pixfmt.h:567
#define AV_PIX_FMT_GBRP14
Definition pixfmt.h:566

Definition at line 312 of file vf_colorcontrast.c.

◆ colorcontrast_inputs

const AVFilterPad colorcontrast_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
}
static int config_input(AVFilterLink *inlink)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.
Definition filters.h:59

Definition at line 351 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 }
}
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition opt.h:270
#define VF
Definition af_afir.c:731

Definition at line 364 of file vf_colorcontrast.c.

◆ ff_vf_colorcontrast

const FFFilter ff_vf_colorcontrast
Initial value:
= {
.p.name = "colorcontrast",
.p.description = NULL_IF_CONFIG_SMALL("Adjust color contrast between RGB components."),
.p.priv_class = &colorcontrast_class,
.priv_size = sizeof(ColorContrastContext),
.process_command = 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:906
#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:196
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition avfilter.h:166
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_PIXFMTS_ARRAY(array)
Definition filters.h:244
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static enum AVPixelFormat pixel_fmts[]
Definition vf_amplify.c:52
static const AVFilterPad colorcontrast_inputs[]
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

Definition at line 377 of file vf_colorcontrast.c.