FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vf_pseudocolor.c File Reference
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "libavutil/eval.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  Curve
 
struct  Fill
 
struct  Range
 
struct  Preset
 
struct  PseudoColorContext
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

#define OFFSET(x)   offsetof(PseudoColorContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
#define PCLIP(v, max, dst, src, x)
 
#define RGB_TO_Y_BT709(r, g, b)
 
#define RGB_TO_U_BT709(r1, g1, b1, max)
 
#define RGB_TO_V_BT709(r1, g1, b1, max)
 

Enumerations

enum  var_name {
  VAR_N, VAR_TS, VAR_POS, VAR_PREV_INPTS,
  VAR_PREV_INDTS, VAR_PREV_OUTPTS, VAR_PREV_OUTDTS, VAR_PTS,
  VAR_DTS, VAR_STARTPTS, VAR_STARTDTS, VAR_TB,
  VAR_SR, VAR_VARS_NB, VAR_CH, VAR_N,
  VAR_NB_IN_CHANNELS, VAR_NB_OUT_CHANNELS, VAR_T, VAR_S,
  VAR_VARS_NB, VAR_W, VAR_H, VAR_CW,
  VAR_CH, VAR_HSUB, VAR_VSUB, VARS_NB,
  VAR_VALUE1, VAR_VALUE2, VAR_VARS_NB, VAR_TB,
  VAR_PTS, VAR_START_PTS, VAR_PREV_PTS, VAR_PREV_SELECTED_PTS,
  VAR_T, VAR_START_T, VAR_PREV_T, VAR_PREV_SELECTED_T,
  VAR_PICT_TYPE, VAR_I, VAR_P, VAR_B,
  VAR_S, VAR_SI, VAR_SP, VAR_BI,
  VAR_PICT_TYPE_I, VAR_PICT_TYPE_P, VAR_PICT_TYPE_B, VAR_PICT_TYPE_S,
  VAR_PICT_TYPE_SI, VAR_PICT_TYPE_SP, VAR_PICT_TYPE_BI, VAR_INTERLACE_TYPE,
  VAR_INTERLACE_TYPE_P, VAR_INTERLACE_TYPE_T, VAR_INTERLACE_TYPE_B, VAR_CONSUMED_SAMPLES_N,
  VAR_SAMPLES_N, VAR_SAMPLE_RATE, VAR_N, VAR_SELECTED_N,
  VAR_PREV_SELECTED_N, VAR_KEY, VAR_POS, VAR_SCENE,
  VAR_CONCATDEC_SELECT, VAR_VARS_NB, VAR_N, VAR_T,
  VAR_POS, VAR_PTS, VAR_TS, VAR_TE,
  VAR_TI, VAR_VARS_NB, VAR_IN_W, VAR_IW,
  VAR_IN_H, VAR_IH, VAR_OUT_W, VAR_OW,
  VAR_OUT_H, VAR_OH, VAR_A, VAR_SAR,
  VAR_DAR, VAR_HSUB, VAR_VSUB, VAR_OHSUB,
  VAR_OVSUB, VARS_NB, VAR_FRAME_RATE, VAR_INTERLACED,
  VAR_N, VAR_NB_CONSUMED_SAMPLES, VAR_NB_SAMPLES, VAR_POS,
  VAR_PREV_INPTS, VAR_PREV_INT, VAR_PREV_OUTPTS, VAR_PREV_OUTT,
  VAR_PTS, VAR_SAMPLE_RATE, VAR_STARTPTS, VAR_STARTT,
  VAR_T, VAR_TB, VAR_RTCTIME, VAR_RTCSTART,
  VAR_S, VAR_SR, VAR_FR, VAR_VARS_NB,
  VAR_AVTB, VAR_INTB, VAR_SR, VAR_VARS_NB,
  VAR_W, VAR_H, VAR_A, VAR_DAR,
  VAR_SAR, VAR_HSUB, VAR_VSUB, VARS_NB,
  VAR_IN_W, VAR_IW, VAR_IN_H, VAR_IH,
  VAR_OUT_W, VAR_OW, VAR_OUT_H, VAR_OH,
  VAR_A, VAR_SAR, VAR_DAR, VAR_HSUB,
  VAR_VSUB, VAR_X, VAR_Y, VAR_N,
  VAR_POS, VAR_T, VAR_VARS_NB, VAR_X,
  VAR_Y, VAR_W, VAR_H, VAR_N,
  VAR_T, VAR_VARS_NB, VAR_DAR, VAR_HSUB,
  VAR_VSUB, VAR_IN_H, VAR_IH, VAR_IN_W,
  VAR_IW, VAR_SAR, VAR_X, VAR_Y,
  VAR_H, VAR_W, VAR_T, VAR_MAX,
  VARS_NB, VAR_DAR, VAR_HSUB, VAR_VSUB,
  VAR_LINE_H, VAR_LH, VAR_MAIN_H, VAR_h,
  VAR_H, VAR_MAIN_W, VAR_w, VAR_W,
  VAR_MAX_GLYPH_A, VAR_ASCENT, VAR_MAX_GLYPH_D, VAR_DESCENT,
  VAR_MAX_GLYPH_H, VAR_MAX_GLYPH_W, VAR_N, VAR_SAR,
  VAR_T, VAR_TEXT_H, VAR_TH, VAR_TEXT_W,
  VAR_TW, VAR_X, VAR_Y, VAR_PICT_TYPE,
  VAR_PKT_POS, VAR_PKT_DURATION, VAR_PKT_SIZE, VAR_VARS_NB,
  VAR_N, VAR_POS, VAR_R, VAR_T,
  VAR_NB, VAR_N, VAR_PTS, VAR_R,
  VAR_T, VAR_TB, VAR_NB, VAR_W,
  VAR_H, VAR_VAL, VAR_MAXVAL, VAR_MINVAL,
  VAR_NEGVAL, VAR_CLIPVAL, VAR_VARS_NB, VAR_W,
  VAR_H, VAR_X, VAR_Y, VAR_BITDEPTHX,
  VAR_BITDEPTHY, VAR_VARS_NB, VAR_MAIN_W, VAR_MW,
  VAR_MAIN_H, VAR_MH, VAR_OVERLAY_W, VAR_OW,
  VAR_OVERLAY_H, VAR_OH, VAR_HSUB, VAR_VSUB,
  VAR_X, VAR_Y, VAR_N, VAR_POS,
  VAR_T, VAR_VARS_NB, VAR_MAIN_iW, VAR_MW,
  VAR_MAIN_iH, VAR_MH, VAR_OVERLAY_iW, VAR_OVERLAY_iH,
  VAR_OVERLAY_X, VAR_OX, VAR_OVERLAY_Y, VAR_OY,
  VAR_OVERLAY_W, VAR_OW, VAR_OVERLAY_H, VAR_OH,
  VAR_VARS_NB, VAR_IN_W, VAR_IW, VAR_IN_H,
  VAR_IH, VAR_OUT_W, VAR_OW, VAR_OUT_H,
  VAR_OH, VAR_X, VAR_Y, VAR_A,
  VAR_SAR, VAR_DAR, VAR_HSUB, VAR_VSUB,
  VARS_NB, VAR_IN_W, VAR_IW, VAR_IN_H,
  VAR_IH, VAR_OUT_W, VAR_OW, VAR_OUT_H,
  VAR_OH, VAR_X, VAR_Y, VAR_A,
  VAR_SAR, VAR_DAR, VARS_NB, VAR_W,
  VAR_H, VAR_VAL, VAR_YMIN, VAR_UMIN,
  VAR_VMIN, VAR_AMIN, VAR_YMAX, VAR_UMAX,
  VAR_VMAX, VAR_AMAX, VAR_VARS_NB, VAR_IN_W,
  VAR_IW, VAR_IN_H, VAR_IH, VAR_OUT_W,
  VAR_OW, VAR_OUT_H, VAR_OH, VAR_HSUB,
  VAR_VSUB, VAR_N, VAR_T, VAR_VARS_NB,
  VAR_IN_W, VAR_IW, VAR_IN_H, VAR_IH,
  VAR_OUT_W, VAR_OW, VAR_OUT_H, VAR_OH,
  VAR_A, VAR_SAR, VAR_DAR, VAR_HSUB,
  VAR_VSUB, VAR_OHSUB, VAR_OVSUB, VAR_N,
  VAR_T, VAR_POS, VAR_S2R_MAIN_W, VAR_S2R_MAIN_H,
  VAR_S2R_MAIN_A, VAR_S2R_MAIN_SAR, VAR_S2R_MAIN_DAR, VAR_S2R_MDAR,
  VAR_S2R_MAIN_HSUB, VAR_S2R_MAIN_VSUB, VAR_S2R_MAIN_N, VAR_S2R_MAIN_T,
  VAR_S2R_MAIN_POS, VARS_NB, VAR_PI, VAR_PHI,
  VAR_E, VAR_IN_W, VAR_IW, VAR_IN_H,
  VAR_IH, VAR_OUT_W, VAR_OW, VAR_OUT_H,
  VAR_OH, VAR_A, VAR_DAR, VAR_SAR,
  VARS_NB, VAR_W, VAR_H, VAR_N,
  VAR_PTS, VAR_R, VAR_T, VAR_TB,
  VAR_NB, VAR_iW, VAR_IN_W, VAR_iH,
  VAR_IN_H, VAR_oW, VAR_OUT_W, VAR_W,
  VAR_oH, VAR_OUT_H, VAR_H, CW,
  CH, CX, CY, VAR_VARS_NB,
  VAR_IN_W, VAR_IW, VAR_IN_H, VAR_IH,
  VAR_OUT_W, VAR_OW, VAR_OUT_H, VAR_OH,
  VAR_IN, VAR_ON, VAR_DURATION, VAR_PDURATION,
  VAR_IN_TIME, VAR_IT, VAR_TIME, VAR_OUT_TIME,
  VAR_OT, VAR_FRAME, VAR_ZOOM, VAR_PZOOM,
  VAR_X, VAR_PX, VAR_Y, VAR_PY,
  VAR_A, VAR_SAR, VAR_DAR, VAR_HSUB,
  VAR_VSUB, VARS_NB, VAR_IN_W, VAR_IW,
  VAR_IN_H, VAR_IH, VAR_OUT_W, VAR_OW,
  VAR_OUT_H, VAR_OH, VAR_A, VAR_SAR,
  VAR_DAR, VAR_HSUB, VAR_VSUB, VAR_OHSUB,
  VAR_OVSUB, VARS_NB, VAR_X, VAR_Y,
  VAR_W, VAR_H, VAR_TIME, VAR_SPEED,
  VAR_TEMPO, VAR_ORDER, VAR_PATTERN, VAR_ROW,
  VAR_VARS_NB
}
 
enum  Curves {
  MAGMA, INFERNO, PLASMA, VIRIDIS,
  TURBO, CIVIDIS, NB_CURVES
}
 
enum  Presets {
  PRESET_MAGMA, PRESET_INFERNO, PRESET_PLASMA, PRESET_VIRIDIS,
  PRESET_TURBO, PRESET_CIVIDIS, PRESET_RANGE1, PRESET_RANGE2,
  PRESET_SHADOWS, PRESET_HIGHLIGHTS, NB_PRESETS
}
 

Functions

static int query_formats (AVFilterContext *ctx)
 
static float lerpf (float v0, float v1, float f)
 
static void pseudocolor_filter (int max, int width, int height, const uint8_t *index, const uint8_t *src, uint8_t *dst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
 
static void pseudocolor_filter_11 (int max, int width, int height, const uint8_t *index, const uint8_t *src, uint8_t *dst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
 
static void pseudocolor_filter_11d (int max, int width, int height, const uint8_t *index, const uint8_t *src, uint8_t *dst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
 
static void pseudocolor_filter_10 (int max, int width, int height, const uint8_t *index, const uint8_t *src, uint8_t *dst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
 
static void pseudocolor_filter_10d (int max, int width, int height, const uint8_t *index, const uint8_t *src, uint8_t *dst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
 
static void pseudocolor_filter_16 (int max, int width, int height, const uint8_t *iindex, const uint8_t *ssrc, uint8_t *ddst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
 
static void pseudocolor_filter_16_10 (int max, int width, int height, const uint8_t *iindex, const uint8_t *ssrc, uint8_t *ddst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
 
static void pseudocolor_filter_16_10d (int max, int width, int height, const uint8_t *iindex, const uint8_t *ssrc, uint8_t *ddst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
 
static void pseudocolor_filter_16_11 (int max, int width, int height, const uint8_t *iindex, const uint8_t *ssrc, uint8_t *ddst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
 
static void pseudocolor_filter_16_11d (int max, int width, int height, const uint8_t *iindex, const uint8_t *ssrc, uint8_t *ddst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
 
static double poly_eval (const double *const poly, double x)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int process_command (AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
 
static av_cold void uninit (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS (pseudocolor)
 

Variables

static const char *const var_names []
 
static const Range full_range = {0, 256}
 
static const Range spec1_range [] = {{0, 16}, {16, 236}, {236, 256}}
 
static const Range spec2_range [] = {{0, 16}, {16, 22}, {22, 226}, {226, 236}, {236, 256}}
 
static const Range shadows_range [] = {{0, 32}, {32, 256}}
 
static const Range highlights_range [] = {{0, 214}, {214, 224}, {224, 256}}
 
static const Fill spec1_fills [] = {{{0.5f, 0.f, .5f, 1.f}}, {{-1.f, -1.f, -1.f, 1.f}}, {{1.f, 0.f, 0.f, 1.f}}}
 
static const Fill spec2_fills [] = {{{0.5f, 0.f, .5f, 1.f}}, {{0.f, 1.f, 1.f, 1.f}}, {{-1.f, -1.f, -1.f, 1.f}}, {{1.f, 1.f, 0.f, 1.f}}, {{1.f, 0.f, 0.f, 1.f}}}
 
static const Fill shadows_fills [] = {{{0.8f, 0.4f, .8f, 1.f}}, {{-1.f, -1.f, -1.f, 1.f}}}
 
static const Fill highlights_fills [] = {{{-1.f, -1.f, -1.f, 1.f}}, {{1.f, 0.3f, 0.6f, 1.f}}, {{1.f, 0.2f, .5f, 1.f}}}
 
static const Curve curves []
 
static const Preset presets []
 
static const AVOption pseudocolor_options []
 
static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
AVFilter ff_vf_pseudocolor
 

Macro Definition Documentation

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

Definition at line 189 of file vf_pseudocolor.c.

Definition at line 190 of file vf_pseudocolor.c.

#define PCLIP (   v,
  max,
  dst,
  src,
 
)
Value:
if (v >= 0 && v <= max) { \
dst[x] = lerpf(src[x], v, opacity);\
} else { \
dst[x] = src[x]; \
}
#define max(a, b)
Definition: cuda_runtime.h:33
#define src
Definition: vp8dsp.c:255
static float lerpf(float v0, float v1, float f)

Definition at line 258 of file vf_pseudocolor.c.

Referenced by pseudocolor_filter(), pseudocolor_filter_10(), pseudocolor_filter_10d(), pseudocolor_filter_11(), pseudocolor_filter_11d(), pseudocolor_filter_16(), pseudocolor_filter_16_10(), pseudocolor_filter_16_10d(), pseudocolor_filter_16_11(), and pseudocolor_filter_16_11d().

#define RGB_TO_Y_BT709 (   r,
  g,
  b 
)
Value:
((0.21260*219.0/255.0) * (r) + (0.71520*219.0/255.0) * (g) + \
(0.07220*219.0/255.0) * (b))
const char * g
Definition: vf_curves.c:117
const char * r
Definition: vf_curves.c:116
#define b
Definition: input.c:41

Definition at line 524 of file vf_pseudocolor.c.

Referenced by config_input(), config_output(), and pad_opencl_init().

#define RGB_TO_U_BT709 (   r1,
  g1,
  b1,
  max 
)
Value:
(-(0.11457*224.0/255.0) * r1 - (0.38543*224.0/255.0) * g1 + \
(0.50000*224.0/255.0) * b1 + max * 0.5)
#define max(a, b)
Definition: cuda_runtime.h:33
static double b1(void *priv, double x, double y)
Definition: vf_xfade.c:1665

Definition at line 528 of file vf_pseudocolor.c.

Referenced by config_input(), config_output(), and pad_opencl_init().

#define RGB_TO_V_BT709 (   r1,
  g1,
  b1,
  max 
)
Value:
((0.50000*224.0/255.0) * r1 - (0.45415*224.0/255.0) * g1 - \
(0.04585*224.0/255.0) * b1 + max * 0.5)
#define max(a, b)
Definition: cuda_runtime.h:33
static double b1(void *priv, double x, double y)
Definition: vf_xfade.c:1665

Definition at line 532 of file vf_pseudocolor.c.

Referenced by config_input(), config_output(), and pad_opencl_init().

Enumeration Type Documentation

enum var_name
Enumerator
VAR_N 
VAR_TS 
VAR_POS 
VAR_PREV_INPTS 
VAR_PREV_INDTS 
VAR_PREV_OUTPTS 
VAR_PREV_OUTDTS 
VAR_PTS 
VAR_DTS 
VAR_STARTPTS 
VAR_STARTDTS 
VAR_TB 
VAR_SR 
VAR_VARS_NB 
VAR_CH 
VAR_N 
VAR_NB_IN_CHANNELS 
VAR_NB_OUT_CHANNELS 
VAR_T 
VAR_S 
VAR_VARS_NB 
VAR_W 
VAR_H 
VAR_CW 
VAR_CH 
VAR_HSUB 
VAR_V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
MAGMA 
INFERNO 
PLASMA 
VIRIDIS 
TURBO 
CIVIDIS 
NB_CURVES 

Definition at line 62 of file vf_pseudocolor.c.

enum Presets
Enumerator
PRESET_MAGMA 
PRESET_INFERNO 
PRESET_PLASMA 
PRESET_VIRIDIS 
PRESET_TURBO 
PRESET_CIVIDIS 
PRESET_RANGE1 
PRESET_RANGE2 
PRESET_SHADOWS 
PRESET_HIGHLIGHTS 
NB_PRESETS 

Definition at line 72 of file vf_pseudocolor.c.

Function Documentation

static int query_formats ( AVFilterContext ctx)
static

Definition at line 245 of file vf_pseudocolor.c.

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

Definition at line 253 of file vf_pseudocolor.c.

static void pseudocolor_filter ( int  max,
int  width,
int  height,
const uint8_t index,
const uint8_t src,
uint8_t dst,
ptrdiff_t  ilinesize,
ptrdiff_t  slinesize,
ptrdiff_t  dlinesize,
float *  lut,
float  opacity 
)
static

Definition at line 265 of file vf_pseudocolor.c.

Referenced by config_input().

static void pseudocolor_filter_11 ( int  max,
int  width,
int  height,
const uint8_t index,
const uint8_t src,
uint8_t dst,
ptrdiff_t  ilinesize,
ptrdiff_t  slinesize,
ptrdiff_t  dlinesize,
float *  lut,
float  opacity 
)
static

Definition at line 289 of file vf_pseudocolor.c.

Referenced by config_input().

static void pseudocolor_filter_11d ( int  max,
int  width,
int  height,
const uint8_t index,
const uint8_t src,
uint8_t dst,
ptrdiff_t  ilinesize,
ptrdiff_t  slinesize,
ptrdiff_t  dlinesize,
float *  lut,
float  opacity 
)
static

Definition at line 312 of file vf_pseudocolor.c.

Referenced by config_input().

static void pseudocolor_filter_10 ( int  max,
int  width,
int  height,
const uint8_t index,
const uint8_t src,
uint8_t dst,
ptrdiff_t  ilinesize,
ptrdiff_t  slinesize,
ptrdiff_t  dlinesize,
float *  lut,
float  opacity 
)
static

Definition at line 335 of file vf_pseudocolor.c.

Referenced by config_input().

static void pseudocolor_filter_10d ( int  max,
int  width,
int  height,
const uint8_t index,
const uint8_t src,
uint8_t dst,
ptrdiff_t  ilinesize,
ptrdiff_t  slinesize,
ptrdiff_t  dlinesize,
float *  lut,
float  opacity 
)
static

Definition at line 359 of file vf_pseudocolor.c.

Referenced by config_input().

static void pseudocolor_filter_16 ( int  max,
int  width,
int  height,
const uint8_t iindex,
const uint8_t ssrc,
uint8_t ddst,
ptrdiff_t  ilinesize,
ptrdiff_t  slinesize,
ptrdiff_t  dlinesize,
float *  lut,
float  opacity 
)
static

Definition at line 383 of file vf_pseudocolor.c.

Referenced by config_input().

static void pseudocolor_filter_16_10 ( int  max,
int  width,
int  height,
const uint8_t iindex,
const uint8_t ssrc,
uint8_t ddst,
ptrdiff_t  ilinesize,
ptrdiff_t  slinesize,
ptrdiff_t  dlinesize,
float *  lut,
float  opacity 
)
static

Definition at line 410 of file vf_pseudocolor.c.

Referenced by config_input().

static void pseudocolor_filter_16_10d ( int  max,
int  width,
int  height,
const uint8_t iindex,
const uint8_t ssrc,
uint8_t ddst,
ptrdiff_t  ilinesize,
ptrdiff_t  slinesize,
ptrdiff_t  dlinesize,
float *  lut,
float  opacity 
)
static

Definition at line 437 of file vf_pseudocolor.c.

Referenced by config_input().

static void pseudocolor_filter_16_11 ( int  max,
int  width,
int  height,
const uint8_t iindex,
const uint8_t ssrc,
uint8_t ddst,
ptrdiff_t  ilinesize,
ptrdiff_t  slinesize,
ptrdiff_t  dlinesize,
float *  lut,
float  opacity 
)
static

Definition at line 464 of file vf_pseudocolor.c.

Referenced by config_input().

static void pseudocolor_filter_16_11d ( int  max,
int  width,
int  height,
const uint8_t iindex,
const uint8_t ssrc,
uint8_t ddst,
ptrdiff_t  ilinesize,
ptrdiff_t  slinesize,
ptrdiff_t  dlinesize,
float *  lut,
float  opacity 
)
static

Definition at line 494 of file vf_pseudocolor.c.

Referenced by config_input().

static double poly_eval ( const double *const  poly,
double  x 
)
static

Definition at line 536 of file vf_pseudocolor.c.

Referenced by config_input().

static int config_input ( AVFilterLink inlink)
static

Definition at line 547 of file vf_pseudocolor.c.

Referenced by process_command().

static int filter_slice ( AVFilterContext ctx,
void arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 801 of file vf_pseudocolor.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 827 of file vf_pseudocolor.c.

static int process_command ( AVFilterContext ctx,
const char *  cmd,
const char *  args,
char *  res,
int  res_len,
int  flags 
)
static

Definition at line 849 of file vf_pseudocolor.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 878 of file vf_pseudocolor.c.

AVFILTER_DEFINE_CLASS ( pseudocolor  )

Referenced by uninit().

Variable Documentation

const char* const var_names[]
static
Initial value:
= {
"w",
"h",
"val",
"ymin",
"umin",
"vmin",
"amin",
"ymax",
"umax",
"vmax",
"amax",
}
#define NULL
Definition: coverity.c:32

Definition at line 32 of file vf_pseudocolor.c.

Referenced by config_input().

const Range full_range = {0, 256}
static

Definition at line 105 of file vf_pseudocolor.c.

const Range spec1_range[] = {{0, 16}, {16, 236}, {236, 256}}
static

Definition at line 106 of file vf_pseudocolor.c.

const Range spec2_range[] = {{0, 16}, {16, 22}, {22, 226}, {226, 236}, {236, 256}}
static

Definition at line 107 of file vf_pseudocolor.c.

const Range shadows_range[] = {{0, 32}, {32, 256}}
static

Definition at line 108 of file vf_pseudocolor.c.

const Range highlights_range[] = {{0, 214}, {214, 224}, {224, 256}}
static

Definition at line 109 of file vf_pseudocolor.c.

const Fill spec1_fills[] = {{{0.5f, 0.f, .5f, 1.f}}, {{-1.f, -1.f, -1.f, 1.f}}, {{1.f, 0.f, 0.f, 1.f}}}
static

Definition at line 111 of file vf_pseudocolor.c.

const Fill spec2_fills[] = {{{0.5f, 0.f, .5f, 1.f}}, {{0.f, 1.f, 1.f, 1.f}}, {{-1.f, -1.f, -1.f, 1.f}}, {{1.f, 1.f, 0.f, 1.f}}, {{1.f, 0.f, 0.f, 1.f}}}
static

Definition at line 112 of file vf_pseudocolor.c.

const Fill shadows_fills[] = {{{0.8f, 0.4f, .8f, 1.f}}, {{-1.f, -1.f, -1.f, 1.f}}}
static

Definition at line 113 of file vf_pseudocolor.c.

const Fill highlights_fills[] = {{{-1.f, -1.f, -1.f, 1.f}}, {{1.f, 0.3f, 0.6f, 1.f}}, {{1.f, 0.2f, .5f, 1.f}}}
static

Definition at line 114 of file vf_pseudocolor.c.

const Curve curves[]
static
const Preset presets[]
static
Initial value:
=
{
[PRESET_INFERNO] = { 1, &full_range, &curves[INFERNO], NULL },
[PRESET_PLASMA] = { 1, &full_range, &curves[PLASMA], NULL },
[PRESET_VIRIDIS] = { 1, &full_range, &curves[VIRIDIS], NULL },
[PRESET_TURBO] = { 1, &full_range, &curves[TURBO], NULL },
[PRESET_CIVIDIS] = { 1, &full_range, &curves[CIVIDIS], NULL },
}
static const Range highlights_range[]
#define NULL
Definition: coverity.c:32
static const Range full_range
static const Fill highlights_fills[]
static const Curve curves[]
static const Range spec1_range[]
static const Fill spec1_fills[]
static const Fill spec2_fills[]
static const Fill shadows_fills[]
static const Range shadows_range[]
static const Range spec2_range[]

Definition at line 150 of file vf_pseudocolor.c.

Referenced by new_output_stream(), and nvenc_map_preset().

const AVOption pseudocolor_options[]
static
Initial value:
= {
{ "c0", "set component #0 expression", OFFSET(comp_expr_str[0]), AV_OPT_TYPE_STRING, {.str="val"}, .flags = FLAGS },
{ "c1", "set component #1 expression", OFFSET(comp_expr_str[1]), AV_OPT_TYPE_STRING, {.str="val"}, .flags = FLAGS },
{ "c2", "set component #2 expression", OFFSET(comp_expr_str[2]), AV_OPT_TYPE_STRING, {.str="val"}, .flags = FLAGS },
{ "c3", "set component #3 expression", OFFSET(comp_expr_str[3]), AV_OPT_TYPE_STRING, {.str="val"}, .flags = FLAGS },
{ "index", "set component as base", OFFSET(index), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, .flags = FLAGS },
{ "i", "set component as base", OFFSET(index), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, .flags = FLAGS },
{ "preset", "set preset", OFFSET(preset), AV_OPT_TYPE_INT, {.i64=-1},-1, NB_PRESETS-1, .flags = FLAGS, "preset" },
{ "p", "set preset", OFFSET(preset), AV_OPT_TYPE_INT, {.i64=-1},-1, NB_PRESETS-1, .flags = FLAGS, "preset" },
{ "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64=-1}, .flags = FLAGS, "preset" },
{ "magma", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_MAGMA}, .flags = FLAGS, "preset" },
{ "inferno", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_INFERNO}, .flags = FLAGS, "preset" },
{ "plasma", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_PLASMA}, .flags = FLAGS, "preset" },
{ "viridis", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_VIRIDIS}, .flags = FLAGS, "preset" },
{ "turbo", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_TURBO}, .flags = FLAGS, "preset" },
{ "cividis", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_CIVIDIS}, .flags = FLAGS, "preset" },
{ "range1", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_RANGE1}, .flags = FLAGS, "preset" },
{ "range2", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_RANGE2}, .flags = FLAGS, "preset" },
{ "shadows", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_SHADOWS}, .flags = FLAGS, "preset" },
{ "highlights", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_HIGHLIGHTS},.flags=FLAGS, "preset" },
{ "opacity", "set pseudocolor opacity",OFFSET(opacity), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, .flags = FLAGS },
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
#define FLAGS
int index
Definition: gxfenc.c:89
preset
Definition: vf_curves.c:46

Definition at line 192 of file vf_pseudocolor.c.

enum AVPixelFormat pix_fmts[]
static
Initial value:
= {
}
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:442
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:434
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:436
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:409
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:419
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:437
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:415
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:379
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:403
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:380
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:381
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:101
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:433
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:414
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:412
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:404
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:441
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:176
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:443
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:420
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:402
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:421
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:397
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:418
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:383
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:438
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:398
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:417
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:410
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:407
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:382
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:399
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:396
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:408
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:416
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:400
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:406
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
Y , 8bpp.
Definition: pixfmt.h:74
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:435
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:411

Definition at line 216 of file vf_pseudocolor.c.

Referenced by query_formats().

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_input(AVFilterLink *inlink)
static int filter_frame(AVFilterLink *inlink, AVFrame *in)

Definition at line 860 of file vf_pseudocolor.c.

const AVFilterPad outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 870 of file vf_pseudocolor.c.

AVFilter ff_vf_pseudocolor
Initial value:
= {
.name = "pseudocolor",
.description = NULL_IF_CONFIG_SMALL("Make pseudocolored video frames."),
.priv_size = sizeof(PseudoColorContext),
.priv_class = &pseudocolor_class,
}
static const AVFilterPad outputs[]
#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
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:115
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:117
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
static av_cold void uninit(AVFilterContext *ctx)
#define flags(name, subs,...)
Definition: cbs_av1.c:561
static int query_formats(AVFilterContext *ctx)
static const AVFilterPad inputs[]

Definition at line 891 of file vf_pseudocolor.c.