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

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

Definition at line 52 of file vsrc_gradients.c.

Definition at line 53 of file vsrc_gradients.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( gradients  )
static int query_formats ( AVFilterContext ctx)
static

Definition at line 80 of file vsrc_gradients.c.

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().

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().

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().

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().

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().

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

Definition at line 170 of file vsrc_gradients.c.

Referenced by config_output().

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

Definition at line 193 of file vsrc_gradients.c.

Referenced by config_output().

static int config_output ( AVFilterLink inlink)
static

Definition at line 214 of file vsrc_gradients.c.

static int gradients_request_frame ( AVFilterLink outlink)
static

Definition at line 245 of file vsrc_gradients.c.

Variable Documentation

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},
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
#define FLAGS
uint8_t w
Definition: llviddspenc.c:38
static unsigned int seed
Definition: videogen.c:78
offset must point to AVRational
Definition: opt.h:238
offset must point to two consecutive integers
Definition: opt.h:235

Definition at line 55 of file vsrc_gradients.c.

const AVFilterPad gradients_outputs[]
static
Initial value:
= {
{
.name = "default",
.request_frame = gradients_request_frame,
.config_props = config_output,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int gradients_request_frame(AVFilterLink *outlink)
static int config_output(AVFilterLink *inlink)

Definition at line 271 of file vsrc_gradients.c.

AVFilter ff_vsrc_gradients
Initial value:
= {
.name = "gradients",
.description = NULL_IF_CONFIG_SMALL("Draw a gradients."),
.priv_size = sizeof(GradientsContext),
.priv_class = &gradients_class,
}
#define NULL
Definition: coverity.c:32
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:153
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
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
#define flags(name, subs,...)
Definition: cbs_av1.c:560
static const AVFilterPad gradients_outputs[]
static int query_formats(AVFilterContext *ctx)

Definition at line 281 of file vsrc_gradients.c.