FFmpeg
Data Structures | Macros | Functions | Variables
vsrc_gradients.c File Reference
#include "avfilter.h"
#include "filters.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 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 activate (AVFilterContext *ctx)
 

Variables

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

Macro Definition Documentation

◆ OFFSET

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

Definition at line 55 of file vsrc_gradients.c.

◆ FLAGS

Definition at line 56 of file vsrc_gradients.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( gradients  )

◆ lerp_color()

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

Definition at line 86 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 96 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 106 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 124 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 142 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 162 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 185 of file vsrc_gradients.c.

◆ config_output()

static int config_output ( AVFilterLink inlink)
static

Definition at line 206 of file vsrc_gradients.c.

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 237 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 },
{"duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1}, -1, INT64_MAX, FLAGS },
{"d", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1}, -1, INT64_MAX, FLAGS },
{"speed", "set gradients rotation speed", OFFSET(speed), AV_OPT_TYPE_FLOAT,{.dbl=0.01}, 0.00001, 1, FLAGS },
{NULL},
}

Definition at line 58 of file vsrc_gradients.c.

◆ gradients_outputs

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

Definition at line 278 of file vsrc_gradients.c.

◆ ff_vsrc_gradients

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

Definition at line 286 of file vsrc_gradients.c.

AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:237
w
uint8_t w
Definition: llviddspenc.c:38
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Definition: opt.h:238
config_output
static int config_output(AVFilterLink *inlink)
Definition: vsrc_gradients.c:206
duration
int64_t duration
Definition: movenc.c:64
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Definition: opt.h:225
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:93
AV_PIX_FMT_RGBA64
#define AV_PIX_FMT_RGBA64
Definition: pixfmt.h:394
OFFSET
#define OFFSET(x)
Definition: vsrc_gradients.c:55
NULL
#define NULL
Definition: coverity.c:32
gradients_outputs
static const AVFilterPad gradients_outputs[]
Definition: vsrc_gradients.c:278
AV_OPT_TYPE_COLOR
@ AV_OPT_TYPE_COLOR
Definition: opt.h:239
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:234
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:117
FLAGS
#define FLAGS
Definition: vsrc_gradients.c:56
FILTER_PIXFMTS
#define FILTER_PIXFMTS(...)
Definition: internal.h:177
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:227
GradientsContext
Definition: vsrc_gradients.c:35
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
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:121
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
activate
static int activate(AVFilterContext *ctx)
Definition: vsrc_gradients.c:237
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192