FFmpeg
Data Structures | Macros | Functions | Variables
vsrc_gradients.c File Reference
#include "avfilter.h"
#include "formats.h"
#include "video.h"
#include "internal.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/lfg.h"
#include "libavutil/random_seed.h"
#include <float.h>
#include <math.h>

Go to the source code of this file.

Data Structures

struct  GradientsContext
 

Macros

#define OFFSET(x)   offsetof(GradientsContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (gradients)
 
static int query_formats (AVFilterContext *ctx)
 
static uint32_t lerp_color (uint8_t c0[4], uint8_t c1[4], float x)
 
static uint64_t lerp_color16 (uint8_t c0[4], uint8_t c1[4], float x)
 
static uint32_t lerp_colors (uint8_t arr[3][4], int nb_colors, float step)
 
static uint64_t lerp_colors16 (uint8_t arr[3][4], int nb_colors, float step)
 
static float project (float origin_x, float origin_y, float dest_x, float dest_y, int point_x, int point_y)
 
static int draw_gradients_slice (AVFilterContext *ctx, void *arg, int job, int nb_jobs)
 
static int draw_gradients_slice16 (AVFilterContext *ctx, void *arg, int job, int nb_jobs)
 
static int config_output (AVFilterLink *inlink)
 
static int gradients_request_frame (AVFilterLink *outlink)
 

Variables

static const AVOption gradients_options []
 
static const AVFilterPad gradients_outputs []
 
AVFilter ff_vsrc_gradients
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 52 of file vsrc_gradients.c.

◆ FLAGS

Definition at line 53 of file vsrc_gradients.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( gradients  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 80 of file vsrc_gradients.c.

◆ lerp_color()

static uint32_t lerp_color ( uint8_t  c0[4],
uint8_t  c1[4],
float  x 
)
static

Definition at line 94 of file vsrc_gradients.c.

Referenced by lerp_colors().

◆ lerp_color16()

static uint64_t lerp_color16 ( uint8_t  c0[4],
uint8_t  c1[4],
float  x 
)
static

Definition at line 104 of file vsrc_gradients.c.

Referenced by lerp_colors16().

◆ lerp_colors()

static uint32_t lerp_colors ( uint8_t  arr[3][4],
int  nb_colors,
float  step 
)
static

Definition at line 114 of file vsrc_gradients.c.

Referenced by draw_gradients_slice().

◆ lerp_colors16()

static uint64_t lerp_colors16 ( uint8_t  arr[3][4],
int  nb_colors,
float  step 
)
static

Definition at line 132 of file vsrc_gradients.c.

Referenced by draw_gradients_slice16().

◆ project()

static float project ( float  origin_x,
float  origin_y,
float  dest_x,
float  dest_y,
int  point_x,
int  point_y 
)
static

Definition at line 150 of file vsrc_gradients.c.

Referenced by draw_gradients_slice(), and draw_gradients_slice16().

◆ draw_gradients_slice()

static int draw_gradients_slice ( AVFilterContext ctx,
void *  arg,
int  job,
int  nb_jobs 
)
static

Definition at line 170 of file vsrc_gradients.c.

◆ draw_gradients_slice16()

static int draw_gradients_slice16 ( AVFilterContext ctx,
void *  arg,
int  job,
int  nb_jobs 
)
static

Definition at line 193 of file vsrc_gradients.c.

◆ config_output()

static int config_output ( AVFilterLink inlink)
static

Definition at line 214 of file vsrc_gradients.c.

◆ gradients_request_frame()

static int gradients_request_frame ( AVFilterLink outlink)
static

Definition at line 245 of file vsrc_gradients.c.

Variable Documentation

◆ gradients_options

const AVOption gradients_options[]
static
Initial value:
= {
{"size", "set frame size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="640x480"}, 0, 0, FLAGS },
{"s", "set frame size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="640x480"}, 0, 0, FLAGS },
{"rate", "set frame rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
{"r", "set frame rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
{"c0", "set 1st color", OFFSET(color_rgba[0]), AV_OPT_TYPE_COLOR, {.str = "random"}, 0, 0, FLAGS },
{"c1", "set 2nd color", OFFSET(color_rgba[1]), AV_OPT_TYPE_COLOR, {.str = "random"}, 0, 0, FLAGS },
{"c2", "set 3rd color", OFFSET(color_rgba[2]), AV_OPT_TYPE_COLOR, {.str = "random"}, 0, 0, FLAGS },
{"c3", "set 4th color", OFFSET(color_rgba[3]), AV_OPT_TYPE_COLOR, {.str = "random"}, 0, 0, FLAGS },
{"c4", "set 5th color", OFFSET(color_rgba[4]), AV_OPT_TYPE_COLOR, {.str = "random"}, 0, 0, FLAGS },
{"c5", "set 6th color", OFFSET(color_rgba[5]), AV_OPT_TYPE_COLOR, {.str = "random"}, 0, 0, FLAGS },
{"c6", "set 7th color", OFFSET(color_rgba[6]), AV_OPT_TYPE_COLOR, {.str = "random"}, 0, 0, FLAGS },
{"c7", "set 8th color", OFFSET(color_rgba[7]), AV_OPT_TYPE_COLOR, {.str = "random"}, 0, 0, FLAGS },
{"x0", "set gradient line source x0", OFFSET(x0), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, FLAGS },
{"y0", "set gradient line source y0", OFFSET(y0), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, FLAGS },
{"x1", "set gradient line destination x1", OFFSET(x1), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, FLAGS },
{"y1", "set gradient line destination y1", OFFSET(y1), AV_OPT_TYPE_INT, {.i64=-1}, -1, INT_MAX, FLAGS },
{"nb_colors", "set the number of colors", OFFSET(nb_colors), AV_OPT_TYPE_INT, {.i64=2}, 2, 8, FLAGS },
{"n", "set the number of colors", OFFSET(nb_colors), AV_OPT_TYPE_INT, {.i64=2}, 2, 8, FLAGS },
{"seed", "set the seed", OFFSET(seed), AV_OPT_TYPE_INT64, {.i64=-1}, -1, UINT32_MAX, FLAGS },
{NULL},
}

Definition at line 55 of file vsrc_gradients.c.

◆ gradients_outputs

const AVFilterPad gradients_outputs[]
static
Initial value:
= {
{
.name = "default",
.request_frame = gradients_request_frame,
.config_props = config_output,
},
{ NULL }
}

Definition at line 271 of file vsrc_gradients.c.

◆ ff_vsrc_gradients

AVFilter ff_vsrc_gradients
Initial value:
= {
.name = "gradients",
.description = NULL_IF_CONFIG_SMALL("Draw a gradients."),
.priv_size = sizeof(GradientsContext),
.priv_class = &gradients_class,
}

Definition at line 281 of file vsrc_gradients.c.

query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vsrc_gradients.c:80
AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:236
w
uint8_t w
Definition: llviddspenc.c:38
config_output
static int config_output(AVFilterLink *inlink)
Definition: vsrc_gradients.c:214
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Definition: opt.h:224
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
OFFSET
#define OFFSET(x)
Definition: vsrc_gradients.c:52
NULL
#define NULL
Definition: coverity.c:32
gradients_outputs
static const AVFilterPad gradients_outputs[]
Definition: vsrc_gradients.c:271
AV_OPT_TYPE_COLOR
@ AV_OPT_TYPE_COLOR
Definition: opt.h:238
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:233
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
seed
static unsigned int seed
Definition: videogen.c:78
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:188
FLAGS
#define FLAGS
Definition: vsrc_gradients.c:53
GradientsContext
Definition: vsrc_gradients.c:34
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
gradients_request_frame
static int gradients_request_frame(AVFilterLink *outlink)
Definition: vsrc_gradients.c:245
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:116
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565