FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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, NB_CS
}
 

Functions

 AVFILTER_DEFINE_CLASS (ciescope)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_output (AVFilterLink *outlink)
 
static void uv_to_xy (double const u, double const v, double *const xc, double *const yc)
 
static void upvp_to_xy (double const up, double const vp, double *const xc, double *const yc)
 
static void xy_to_upvp (double xc, double yc, double *const up, double *const vp)
 
static void xy_to_uv (double xc, double yc, double *const u, double *const v)
 
static void xyz_to_rgb (const double m[3][3], double xc, double yc, double zc, double *const r, double *const g, double *const b)
 
static void invert_matrix3x3 (double in[3][3], double out[3][3])
 
static void get_rgb2xyz_matrix (struct ColorSystem system, double m[3][3])
 
static void rgb_to_xy (double rc, double gc, double bc, double *const x, double *const y, double *const z, const double m[3][3])
 
static int constrain_rgb (double *const r, double *const g, double *const b)
 
static void gamma_correct (const struct ColorSystem *const cs, double *const c)
 
static void gamma_correct_rgb (const struct ColorSystem *const cs, double *const r, double *const g, double *const b)
 
static void monochrome_color_location (double 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, double 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, AVFrame *in, double *cx, double *cy, int x, int y)
 
static void filter_rgba64 (AVFilterContext *ctx, AVFrame *in, double *cx, double *cy, int x, int y)
 
static void filter_rgb24 (AVFilterContext *ctx, AVFrame *in, double *cx, double *cy, int x, int y)
 
static void filter_rgba (AVFilterContext *ctx, AVFrame *in, double *cx, double *cy, int x, int y)
 
static void filter_xyz (AVFilterContext *ctx, AVFrame *in, double *cx, double *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 float const spectral_chromaticity [][3]
 
static const struct ColorSystem color_systems []
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
AVFilter ff_vf_ciescope
 

Macro Definition Documentation

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

Definition at line 72 of file vf_ciescope.c.

Definition at line 73 of file vf_ciescope.c.

#define C   0.310063, 0.316158

Definition at line 647 of file vf_ciescope.c.

#define E   1.0/3.0, 1.0/3.0

Definition at line 648 of file vf_ciescope.c.

#define D50   0.34570, 0.3585

Definition at line 649 of file vf_ciescope.c.

#define D65   0.312713, 0.329016

Definition at line 650 of file vf_ciescope.c.

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

Definition at line 658 of file vf_ciescope.c.

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

Definition at line 930 of file vf_ciescope.c.

Referenced by plot_white_point().

Enumeration Type Documentation

enum CieSystem
Enumerator
XYY 
UCS 
LUV 
NB_CIE 

Definition at line 32 of file vf_ciescope.c.

Enumerator
NTSCsystem 
EBUsystem 
SMPTEsystem 
SMPTE240Msystem 
APPLEsystem 
wRGBsystem 
CIE1931system 
Rec709system 
Rec2020system 
NB_CS 

Definition at line 39 of file vf_ciescope.c.

Function Documentation

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

Definition at line 135 of file vf_ciescope.c.

static int config_output ( AVFilterLink outlink)
static

Definition at line 148 of file vf_ciescope.c.

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

Definition at line 708 of file vf_ciescope.c.

Referenced by fill_in_tongue().

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

Definition at line 721 of file vf_ciescope.c.

Referenced by fill_in_tongue().

static void xy_to_upvp ( double  xc,
double  yc,
double *const  up,
double *const  vp 
)
static
static void xy_to_uv ( double  xc,
double  yc,
double *const  u,
double *const  v 
)
static
static void xyz_to_rgb ( const double  m[3][3],
double  xc,
double  yc,
double  zc,
double *const  r,
double *const  g,
double *const  b 
)
static

Definition at line 760 of file vf_ciescope.c.

Referenced by fill_in_tongue().

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

Definition at line 769 of file vf_ciescope.c.

Referenced by config_input(), and get_rgb2xyz_matrix().

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

Definition at line 796 of file vf_ciescope.c.

Referenced by config_input().

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

Definition at line 830 of file vf_ciescope.c.

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

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

Definition at line 851 of file vf_ciescope.c.

Referenced by fill_in_tongue().

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

Definition at line 880 of file vf_ciescope.c.

Referenced by gamma_correct_rgb().

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

Definition at line 916 of file vf_ciescope.c.

Referenced by fill_in_tongue().

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

Definition at line 933 of file vf_ciescope.c.

Referenced by tongue_outline().

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 964 of file vf_ciescope.c.

Referenced by fill_in_tongue().

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 993 of file vf_ciescope.c.

Referenced by tongue_outline().

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 1025 of file vf_ciescope.c.

Referenced by plot_gamuts(), and plot_white_point().

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 1057 of file vf_ciescope.c.

Referenced by draw_background().

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,
double const  m[3][3],
int const  cie,
int const  correct_gamma,
float const  contrast 
)
static

Definition at line 1088 of file vf_ciescope.c.

Referenced by draw_background().

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 1172 of file vf_ciescope.c.

Referenced by filter_frame().

static int draw_background ( AVFilterContext ctx)
static

Definition at line 1218 of file vf_ciescope.c.

Referenced by filter_frame().

static void filter_rgb48 ( AVFilterContext ctx,
AVFrame in,
double *  cx,
double *  cy,
int  x,
int  y 
)
static

Definition at line 1239 of file vf_ciescope.c.

Referenced by config_input().

static void filter_rgba64 ( AVFilterContext ctx,
AVFrame in,
double *  cx,
double *  cy,
int  x,
int  y 
)
static

Definition at line 1251 of file vf_ciescope.c.

Referenced by config_input().

static void filter_rgb24 ( AVFilterContext ctx,
AVFrame in,
double *  cx,
double *  cy,
int  x,
int  y 
)
static

Definition at line 1263 of file vf_ciescope.c.

Referenced by config_input().

static void filter_rgba ( AVFilterContext ctx,
AVFrame in,
double *  cx,
double *  cy,
int  x,
int  y 
)
static

Definition at line 1275 of file vf_ciescope.c.

Referenced by config_input().

static void filter_xyz ( AVFilterContext ctx,
AVFrame in,
double *  cx,
double *  cy,
int  x,
int  y 
)
static

Definition at line 1287 of file vf_ciescope.c.

Referenced by config_input().

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

Definition at line 1302 of file vf_ciescope.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 1352 of file vf_ciescope.c.

static void av_cold uninit ( AVFilterContext ctx)
static

Definition at line 1442 of file vf_ciescope.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 1449 of file vf_ciescope.c.

Variable Documentation

const AVOption ciescope_options[]
static

Definition at line 75 of file vf_ciescope.c.

enum AVPixelFormat in_pix_fmts[]
static
Initial value:
= {
}
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:64
#define AV_PIX_FMT_RGBA64
Definition: pixfmt.h:331
#define AV_PIX_FMT_RGB48
Definition: pixfmt.h:327
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:94
#define AV_PIX_FMT_XYZ12
Definition: pixfmt.h:381

Definition at line 121 of file vf_ciescope.c.

Referenced by query_formats().

enum AVPixelFormat out_pix_fmts[]
static
Initial value:
= {
}
#define AV_PIX_FMT_RGBA64
Definition: pixfmt.h:331

Definition at line 130 of file vf_ciescope.c.

Referenced by query_formats().

float const spectral_chromaticity[][3]
static

Definition at line 170 of file vf_ciescope.c.

Referenced by monochrome_color_location().

const struct ColorSystem color_systems[]
static

Definition at line 660 of file vf_ciescope.c.

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 filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_ciescope.c:1352
static int config_input(AVFilterLink *inlink)
Definition: vf_ciescope.c:1449

Definition at line 1482 of file vf_ciescope.c.

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

Definition at line 1492 of file vf_ciescope.c.

AVFilter ff_vf_ciescope
Initial value:
= {
.name = "ciescope",
.description = NULL_IF_CONFIG_SMALL("Video CIE scope."),
.priv_size = sizeof(CiescopeContext),
.priv_class = &ciescope_class,
}
static int query_formats(AVFilterContext *ctx)
Definition: vf_ciescope.c:135
static const AVFilterPad inputs[]
Definition: vf_ciescope.c:1482
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static void av_cold uninit(AVFilterContext *ctx)
Definition: vf_ciescope.c:1442
static const AVFilterPad outputs[]
Definition: vf_ciescope.c:1492

Definition at line 1501 of file vf_ciescope.c.