FFmpeg
Data Structures | Macros | Functions | Variables
vf_colorize.c File Reference
#include "libavutil/opt.h"
#include "libavutil/imgutils.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  ColorizeContext
 

Macros

#define OFFSET(x)   offsetof(ColorizeContext, 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 colorizey_slice8 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int colorizey_slice16 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int colorize_slice8 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int colorize_slice16 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int do_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static float hue2rgb (float p, float q, float t)
 
static void hsl2rgb (float h, float s, float l, float *r, float *g, float *b)
 
static void rgb2yuv (float r, float g, float b, int *y, int *u, int *v, int depth)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
static av_cold int query_formats (AVFilterContext *ctx)
 
static av_cold int config_input (AVFilterLink *inlink)
 
 AVFILTER_DEFINE_CLASS (colorize)
 

Variables

static const AVFilterPad colorize_inputs []
 
static const AVFilterPad colorize_outputs []
 
static const AVOption colorize_options []
 
const AVFilter ff_vf_colorize
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 283 of file vf_colorize.c.

◆ VF

Definition at line 284 of file vf_colorize.c.

Function Documentation

◆ lerpf()

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

Definition at line 43 of file vf_colorize.c.

Referenced by colorizey_slice16(), and colorizey_slice8().

◆ colorizey_slice8()

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

Definition at line 48 of file vf_colorize.c.

Referenced by config_input().

◆ colorizey_slice16()

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

Definition at line 71 of file vf_colorize.c.

Referenced by config_input().

◆ colorize_slice8()

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

Definition at line 94 of file vf_colorize.c.

Referenced by config_input().

◆ colorize_slice16()

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

Definition at line 122 of file vf_colorize.c.

Referenced by config_input().

◆ do_slice()

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

Definition at line 150 of file vf_colorize.c.

Referenced by filter_frame().

◆ hue2rgb()

static float hue2rgb ( float  p,
float  q,
float  t 
)
static

Definition at line 160 of file vf_colorize.c.

Referenced by hsl2rgb().

◆ hsl2rgb()

static void hsl2rgb ( float  h,
float  s,
float  l,
float *  r,
float *  g,
float *  b 
)
static

Definition at line 171 of file vf_colorize.c.

Referenced by filter_frame().

◆ rgb2yuv()

static void rgb2yuv ( float  r,
float  g,
float  b,
int y,
int u,
int v,
int  depth 
)
static

Definition at line 187 of file vf_colorize.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 197 of file vf_colorize.c.

◆ query_formats()

static av_cold int query_formats ( AVFilterContext ctx)
static

Definition at line 212 of file vf_colorize.c.

◆ config_input()

static av_cold int config_input ( AVFilterLink inlink)
static

Definition at line 244 of file vf_colorize.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( colorize  )

Variable Documentation

◆ colorize_inputs

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

Definition at line 264 of file vf_colorize.c.

◆ colorize_outputs

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

Definition at line 275 of file vf_colorize.c.

◆ colorize_options

const AVOption colorize_options[]
static
Initial value:
= {
{ "hue", "set the hue", OFFSET(hue), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 360, VF },
{ "saturation", "set the saturation", OFFSET(saturation), AV_OPT_TYPE_FLOAT, {.dbl=0.5},0, 1, VF },
{ "lightness", "set the lightness", OFFSET(lightness), AV_OPT_TYPE_FLOAT, {.dbl=0.5},0, 1, VF },
{ "mix", "set the mix of source lightness", OFFSET(mix), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, VF },
{ NULL }
}

Definition at line 286 of file vf_colorize.c.

◆ ff_vf_colorize

const AVFilter ff_vf_colorize
Initial value:
= {
.name = "colorize",
.description = NULL_IF_CONFIG_SMALL("Overlay a solid color on the video stream."),
.priv_size = sizeof(ColorizeContext),
.priv_class = &colorize_class,
}

Definition at line 296 of file vf_colorize.c.

mix
static int mix(int c0, int c1)
Definition: 4xm.c:716
VF
#define VF
Definition: vf_colorize.c:284
colorize_outputs
static const AVFilterPad colorize_outputs[]
Definition: vf_colorize.c:275
config_input
static av_cold int config_input(AVFilterLink *inlink)
Definition: vf_colorize.c:244
ColorizeContext
Definition: vf_colorize.c:26
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
query_formats
static av_cold int query_formats(AVFilterContext *ctx)
Definition: vf_colorize.c:212
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: vf_colorize.c:283
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
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
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition: vf_colorize.c:197
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
colorize_inputs
static const AVFilterPad colorize_inputs[]
Definition: vf_colorize.c:264
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