FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vf_ciescope.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.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  CiescopeContext
 
struct  ColorSystem
 

Macros

#define OFFSET(x)   offsetof(CiescopeContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define C   0.310063, 0.316158
 
#define E   1.0/3.0, 1.0/3.0
 
#define D50   0.34570, 0.3585
 
#define D65   0.312713, 0.329016
 
#define GAMMA_REC709   0. /* Rec. 709 */
 
#define Sz(x)   (((x) * (int)FFMIN(w, h)) / 512)
 

Enumerations

enum  CieSystem { XYY, UCS, LUV, NB_CIE }
 
enum  ColorsSystems {
  NTSCsystem, EBUsystem, SMPTEsystem, SMPTE240Msystem,
  APPLEsystem, wRGBsystem, CIE1931system, Rec709system,
  Rec2020system, DCIP3, NB_CS
}
 

Functions

 AVFILTER_DEFINE_CLASS (ciescope)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_output (AVFilterLink *outlink)
 
static void uv_to_xy (float const u, float const v, float *const xc, float *const yc)
 
static void upvp_to_xy (float const up, float const vp, float *const xc, float *const yc)
 
static void xy_to_upvp (float xc, float yc, float *const up, float *const vp)
 
static void xy_to_uv (float xc, float yc, float *const u, float *const v)
 
static void xyz_to_rgb (const float m[3][3], float xc, float yc, float zc, float *const r, float *const g, float *const b)
 
static void invert_matrix3x3 (float in[3][3], float out[3][3])
 
static void get_rgb2xyz_matrix (struct ColorSystem system, float m[3][3])
 
static void rgb_to_xy (float rc, float gc, float bc, float *const x, float *const y, float *const z, const float m[3][3])
 
static int constrain_rgb (float *const r, float *const g, float *const b)
 
static void gamma_correct (const struct ColorSystem *const cs, float *const c)
 
static void gamma_correct_rgb (const struct ColorSystem *const cs, float *const r, float *const g, float *const b)
 
static void monochrome_color_location (float waveLength, int w, int h, int cie, int *xP, int *yP)
 
static void find_tongue (uint16_t *const pixels, int const w, int const linesize, int const row, int *const presentP, int *const leftEdgeP, int *const rightEdgeP)
 
static void draw_line (uint16_t *const pixels, int linesize, int x0, int y0, int x1, int y1, int w, int h, const uint16_t *const rgbcolor)
 
static void draw_rline (uint16_t *const pixels, int linesize, int x0, int y0, int x1, int y1, int w, int h)
 
static void tongue_outline (uint16_t *const pixels, int const linesize, int const w, int const h, uint16_t const maxval, int const cie)
 
static void fill_in_tongue (uint16_t *const pixels, int const linesize, int const w, int const h, uint16_t const maxval, const struct ColorSystem *const cs, float const m[3][3], int const cie, int const correct_gamma, float const contrast)
 
static void plot_white_point (uint16_t *pixels, int const linesize, int const w, int const h, int const maxval, int const color_system, int const cie)
 
static int draw_background (AVFilterContext *ctx)
 
static void filter_rgb48 (AVFilterContext *ctx, const uint8_t *ptr, ptrdiff_t linesize, float *cx, float *cy, int x, int y)
 
static void filter_rgba64 (AVFilterContext *ctx, const uint8_t *ptr, ptrdiff_t linesize, float *cx, float *cy, int x, int y)
 
static void filter_rgb24 (AVFilterContext *ctx, const uint8_t *ptr, ptrdiff_t linesize, float *cx, float *cy, int x, int y)
 
static void filter_rgba (AVFilterContext *ctx, const uint8_t *ptr, ptrdiff_t linesize, float *cx, float *cy, int x, int y)
 
static void filter_xyz (AVFilterContext *ctx, const uint8_t *ptr, ptrdiff_t linesize, float *cx, float *cy, int x, int y)
 
static void plot_gamuts (uint16_t *pixels, int linesize, int w, int h, int cie, int gamuts)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static void av_cold uninit (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 

Variables

static const AVOption ciescope_options []
 
static enum AVPixelFormat in_pix_fmts []
 
static enum AVPixelFormat out_pix_fmts []
 
static const float spectral_chromaticity [][3]
 
static const struct ColorSystem color_systems []
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
const AVFilter ff_vf_ciescope
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 76 of file vf_ciescope.c.

◆ FLAGS

Definition at line 77 of file vf_ciescope.c.

◆ C

#define C   0.310063, 0.316158

Definition at line 654 of file vf_ciescope.c.

◆ E

#define E   1.0/3.0, 1.0/3.0

Definition at line 655 of file vf_ciescope.c.

◆ D50

#define D50   0.34570, 0.3585

Definition at line 656 of file vf_ciescope.c.

◆ D65

#define D65   0.312713, 0.329016

Definition at line 657 of file vf_ciescope.c.

◆ GAMMA_REC709

#define GAMMA_REC709   0. /* Rec. 709 */

Definition at line 665 of file vf_ciescope.c.

◆ Sz

#define Sz (   x)    (((x) * (int)FFMIN(w, h)) / 512)

Definition at line 943 of file vf_ciescope.c.

Enumeration Type Documentation

◆ CieSystem

enum CieSystem
Enumerator
XYY 
UCS 
LUV 
NB_CIE 

Definition at line 32 of file vf_ciescope.c.

◆ ColorsSystems

Enumerator
NTSCsystem 
EBUsystem 
SMPTEsystem 
SMPTE240Msystem 
APPLEsystem 
wRGBsystem 
CIE1931system 
Rec709system 
Rec2020system 
DCIP3 
NB_CS 

Definition at line 39 of file vf_ciescope.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( ciescope  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 142 of file vf_ciescope.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 155 of file vf_ciescope.c.

◆ uv_to_xy()

static void uv_to_xy ( float const  u,
float const  v,
float *const  xc,
float *const  yc 
)
static

Definition at line 719 of file vf_ciescope.c.

Referenced by fill_in_tongue().

◆ upvp_to_xy()

static void upvp_to_xy ( float const  up,
float const  vp,
float *const  xc,
float *const  yc 
)
static

Definition at line 732 of file vf_ciescope.c.

Referenced by fill_in_tongue().

◆ xy_to_upvp()

static void xy_to_upvp ( float  xc,
float  yc,
float *const  up,
float *const  vp 
)
static

◆ xy_to_uv()

static void xy_to_uv ( float  xc,
float  yc,
float *const  u,
float *const  v 
)
static

◆ xyz_to_rgb()

static void xyz_to_rgb ( const float  m[3][3],
float  xc,
float  yc,
float  zc,
float *const  r,
float *const  g,
float *const  b 
)
static

Definition at line 773 of file vf_ciescope.c.

Referenced by fill_in_tongue().

◆ invert_matrix3x3()

static void invert_matrix3x3 ( float  in[3][3],
float  out[3][3] 
)
static

Definition at line 782 of file vf_ciescope.c.

Referenced by config_input(), and get_rgb2xyz_matrix().

◆ get_rgb2xyz_matrix()

static void get_rgb2xyz_matrix ( struct ColorSystem  system,
float  m[3][3] 
)
static

Definition at line 809 of file vf_ciescope.c.

Referenced by config_input().

◆ rgb_to_xy()

static void rgb_to_xy ( float  rc,
float  gc,
float  bc,
float *const  x,
float *const  y,
float *const  z,
const float  m[3][3] 
)
static

Definition at line 843 of file vf_ciescope.c.

Referenced by filter_rgb24(), filter_rgb48(), filter_rgba(), and filter_rgba64().

◆ constrain_rgb()

static int constrain_rgb ( float *const  r,
float *const  g,
float *const  b 
)
static

Definition at line 864 of file vf_ciescope.c.

Referenced by fill_in_tongue().

◆ gamma_correct()

static void gamma_correct ( const struct ColorSystem *const  cs,
float *const  c 
)
static

Definition at line 893 of file vf_ciescope.c.

Referenced by gamma_correct_rgb().

◆ gamma_correct_rgb()

static void gamma_correct_rgb ( const struct ColorSystem *const  cs,
float *const  r,
float *const  g,
float *const  b 
)
static

Definition at line 929 of file vf_ciescope.c.

Referenced by fill_in_tongue().

◆ monochrome_color_location()

static void monochrome_color_location ( float  waveLength,
int  w,
int  h,
int  cie,
int xP,
int yP 
)
static

Definition at line 946 of file vf_ciescope.c.

Referenced by tongue_outline().

◆ find_tongue()

static void find_tongue ( uint16_t *const  pixels,
int const  w,
int const  linesize,
int const  row,
int *const  presentP,
int *const  leftEdgeP,
int *const  rightEdgeP 
)
static

Definition at line 977 of file vf_ciescope.c.

Referenced by fill_in_tongue().

◆ draw_line()

static void draw_line ( uint16_t *const  pixels,
int  linesize,
int  x0,
int  y0,
int  x1,
int  y1,
int  w,
int  h,
const uint16_t *const  rgbcolor 
)
static

Definition at line 1006 of file vf_ciescope.c.

Referenced by tongue_outline().

◆ draw_rline()

static void draw_rline ( uint16_t *const  pixels,
int  linesize,
int  x0,
int  y0,
int  x1,
int  y1,
int  w,
int  h 
)
static

Definition at line 1055 of file vf_ciescope.c.

Referenced by plot_gamuts(), and plot_white_point().

◆ tongue_outline()

static void tongue_outline ( uint16_t *const  pixels,
int const  linesize,
int const  w,
int const  h,
uint16_t const  maxval,
int const  cie 
)
static

Definition at line 1087 of file vf_ciescope.c.

Referenced by draw_background().

◆ fill_in_tongue()

static void fill_in_tongue ( uint16_t *const  pixels,
int const  linesize,
int const  w,
int const  h,
uint16_t const  maxval,
const struct ColorSystem *const  cs,
float const  m[3][3],
int const  cie,
int const  correct_gamma,
float const  contrast 
)
static

Definition at line 1118 of file vf_ciescope.c.

Referenced by draw_background().

◆ plot_white_point()

static void plot_white_point ( uint16_t *  pixels,
int const  linesize,
int const  w,
int const  h,
int const  maxval,
int const  color_system,
int const  cie 
)
static

Definition at line 1202 of file vf_ciescope.c.

Referenced by filter_frame().

◆ draw_background()

static int draw_background ( AVFilterContext ctx)
static

Definition at line 1244 of file vf_ciescope.c.

Referenced by filter_frame().

◆ filter_rgb48()

static void filter_rgb48 ( AVFilterContext ctx,
const uint8_t *  ptr,
ptrdiff_t  linesize,
float cx,
float cy,
int  x,
int  y 
)
static

Definition at line 1266 of file vf_ciescope.c.

Referenced by config_input().

◆ filter_rgba64()

static void filter_rgba64 ( AVFilterContext ctx,
const uint8_t *  ptr,
ptrdiff_t  linesize,
float cx,
float cy,
int  x,
int  y 
)
static

Definition at line 1281 of file vf_ciescope.c.

Referenced by config_input().

◆ filter_rgb24()

static void filter_rgb24 ( AVFilterContext ctx,
const uint8_t *  ptr,
ptrdiff_t  linesize,
float cx,
float cy,
int  x,
int  y 
)
static

Definition at line 1296 of file vf_ciescope.c.

Referenced by config_input().

◆ filter_rgba()

static void filter_rgba ( AVFilterContext ctx,
const uint8_t *  ptr,
ptrdiff_t  linesize,
float cx,
float cy,
int  x,
int  y 
)
static

Definition at line 1311 of file vf_ciescope.c.

Referenced by config_input().

◆ filter_xyz()

static void filter_xyz ( AVFilterContext ctx,
const uint8_t *  ptr,
ptrdiff_t  linesize,
float cx,
float cy,
int  x,
int  y 
)
static

Definition at line 1326 of file vf_ciescope.c.

Referenced by config_input().

◆ plot_gamuts()

static void plot_gamuts ( uint16_t *  pixels,
int  linesize,
int  w,
int  h,
int  cie,
int  gamuts 
)
static

Definition at line 1343 of file vf_ciescope.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 1393 of file vf_ciescope.c.

◆ uninit()

static void av_cold uninit ( AVFilterContext ctx)
static

Definition at line 1497 of file vf_ciescope.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 1504 of file vf_ciescope.c.

Variable Documentation

◆ ciescope_options

const AVOption ciescope_options[]
static

Definition at line 79 of file vf_ciescope.c.

◆ in_pix_fmts

enum AVPixelFormat in_pix_fmts[]
static

◆ out_pix_fmts

enum AVPixelFormat out_pix_fmts[]
static
Initial value:

Definition at line 137 of file vf_ciescope.c.

Referenced by overlay_qsv_query_formats(), and query_formats().

◆ spectral_chromaticity

const float spectral_chromaticity[][3]
static

Definition at line 177 of file vf_ciescope.c.

Referenced by monochrome_color_location().

◆ color_systems

const struct ColorSystem color_systems[]
static

Definition at line 667 of file vf_ciescope.c.

Referenced by config_input(), draw_background(), plot_gamuts(), and plot_white_point().

◆ inputs

const AVFilterPad inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
}

Definition at line 1537 of file vf_ciescope.c.

◆ outputs

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

Definition at line 1546 of file vf_ciescope.c.

◆ ff_vf_ciescope

const AVFilter ff_vf_ciescope
Initial value:
= {
.name = "ciescope",
.description = NULL_IF_CONFIG_SMALL("Video CIE scope."),
.priv_size = sizeof(CiescopeContext),
.priv_class = &ciescope_class,
}

Definition at line 1554 of file vf_ciescope.c.

query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_ciescope.c:142
inputs
static const AVFilterPad inputs[]
Definition: vf_ciescope.c:1537
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_ciescope.c:1504
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_ciescope.c:1393
CiescopeContext
Definition: vf_ciescope.c:53
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:100
AV_PIX_FMT_RGBA64
#define AV_PIX_FMT_RGBA64
Definition: pixfmt.h:468
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:75
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:106
AV_PIX_FMT_RGB48
#define AV_PIX_FMT_RGB48
Definition: pixfmt.h:464
AV_PIX_FMT_XYZ12
#define AV_PIX_FMT_XYZ12
Definition: pixfmt.h:525
uninit
static void av_cold uninit(AVFilterContext *ctx)
Definition: vf_ciescope.c:1497
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_ciescope.c:155
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
outputs
static const AVFilterPad outputs[]
Definition: vf_ciescope.c:1546