FFmpeg
Data Structures | Macros | Functions | Variables
vf_histogram.c File Reference
#include "config_components.h"
#include "libavutil/colorspace.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  HistogramContext
 

Macros

#define OFFSET(x)   offsetof(HistogramContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define COMMON_OPTIONS
 

Functions

 AVFILTER_DEFINE_CLASS (histogram)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 

Variables

static const AVOption histogram_options []
 
static enum AVPixelFormat levels_in_pix_fmts []
 
static enum AVPixelFormat levels_out_yuv8_pix_fmts []
 
static enum AVPixelFormat levels_out_yuv9_pix_fmts []
 
static enum AVPixelFormat levels_out_yuv10_pix_fmts []
 
static enum AVPixelFormat levels_out_yuv12_pix_fmts []
 
static enum AVPixelFormat levels_out_rgb8_pix_fmts []
 
static enum AVPixelFormat levels_out_rgb9_pix_fmts []
 
static enum AVPixelFormat levels_out_rgb10_pix_fmts []
 
static enum AVPixelFormat levels_out_rgb12_pix_fmts []
 
static const uint8_t black_yuva_color [4] = { 0, 127, 127, 255 }
 
static const uint8_t black_gbrp_color [4] = { 0, 0, 0, 255 }
 
static const uint8_t white_yuva_color [4] = { 255, 127, 127, 255 }
 
static const uint8_t white_gbrp_color [4] = { 255, 255, 255, 255 }
 
static const uint8_t gray_color [4] = { 127, 127, 127, 255 }
 
static const uint8_t red_yuva_color [4] = { 127, 127, 255, 255 }
 
static const uint8_t red_gbrp_color [4] = { 255, 0, 0, 255 }
 
static const uint8_t green_yuva_color [4] = { 255, 127, 127, 255 }
 
static const uint8_t igreen_yuva_color [4] = { 0, 127, 127, 255 }
 
static const uint8_t green_gbrp_color [4] = { 0, 255, 0, 255 }
 
static const uint8_t blue_yuva_color [4] = { 127, 255, 127, 255 }
 
static const uint8_t blue_gbrp_color [4] = { 0, 0, 255, 255 }
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 66 of file vf_histogram.c.

◆ FLAGS

Definition at line 67 of file vf_histogram.c.

◆ COMMON_OPTIONS

#define COMMON_OPTIONS
Value:
{ "display_mode", "set display mode", OFFSET(display_mode), AV_OPT_TYPE_INT, {.i64=2}, 0, 2, FLAGS, .unit = "display_mode"}, \
{ "d", "set display mode", OFFSET(display_mode), AV_OPT_TYPE_INT, {.i64=2}, 0, 2, FLAGS, .unit = "display_mode"}, \
{ "overlay", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "display_mode" }, \
{ "parade", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "display_mode" }, \
{ "stack", NULL, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, .unit = "display_mode" }, \
{ "levels_mode", "set levels mode", OFFSET(levels_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, .unit = "levels_mode"}, \
{ "m", "set levels mode", OFFSET(levels_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, .unit = "levels_mode"}, \
{ "linear", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "levels_mode" }, \
{ "logarithmic", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "levels_mode" }, \
{ "components", "set color components to display", OFFSET(components), AV_OPT_TYPE_INT, {.i64=7}, 1, 15, FLAGS}, \
{ "c", "set color components to display", OFFSET(components), AV_OPT_TYPE_INT, {.i64=7}, 1, 15, FLAGS},

Definition at line 69 of file vf_histogram.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( histogram  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 166 of file vf_histogram.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 230 of file vf_histogram.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 371 of file vf_histogram.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 402 of file vf_histogram.c.

Variable Documentation

◆ histogram_options

const AVOption histogram_options[]
static
Initial value:
= {
{ "level_height", "set level height", OFFSET(level_height), AV_OPT_TYPE_INT, {.i64=200}, 50, 2048, FLAGS},
{ "scale_height", "set scale height", OFFSET(scale_height), AV_OPT_TYPE_INT, {.i64=12}, 0, 40, FLAGS},
{ "fgopacity", "set foreground opacity", OFFSET(fgopacity), AV_OPT_TYPE_FLOAT, {.dbl=0.7}, 0, 1, FLAGS},
{ "f", "set foreground opacity", OFFSET(fgopacity), AV_OPT_TYPE_FLOAT, {.dbl=0.7}, 0, 1, FLAGS},
{ "bgopacity", "set background opacity", OFFSET(bgopacity), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS},
{ "b", "set background opacity", OFFSET(bgopacity), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS},
{ "colors_mode", "set colors mode", OFFSET(colors_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 9, FLAGS, .unit = "colors_mode"},
{ "l", "set colors mode", OFFSET(colors_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 9, FLAGS, .unit = "colors_mode"},
{ "whiteonblack", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "colors_mode" },
{ "blackonwhite", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "colors_mode" },
{ "whiteongray", NULL, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, .unit = "colors_mode" },
{ "blackongray", NULL, 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, FLAGS, .unit = "colors_mode" },
{ "coloronblack", NULL, 0, AV_OPT_TYPE_CONST, {.i64=4}, 0, 0, FLAGS, .unit = "colors_mode" },
{ "coloronwhite", NULL, 0, AV_OPT_TYPE_CONST, {.i64=5}, 0, 0, FLAGS, .unit = "colors_mode" },
{ "colorongray" , NULL, 0, AV_OPT_TYPE_CONST, {.i64=6}, 0, 0, FLAGS, .unit = "colors_mode" },
{ "blackoncolor", NULL, 0, AV_OPT_TYPE_CONST, {.i64=7}, 0, 0, FLAGS, .unit = "colors_mode" },
{ "whiteoncolor", NULL, 0, AV_OPT_TYPE_CONST, {.i64=8}, 0, 0, FLAGS, .unit = "colors_mode" },
{ "grayoncolor" , NULL, 0, AV_OPT_TYPE_CONST, {.i64=9}, 0, 0, FLAGS, .unit = "colors_mode" },
{ NULL }
}

Definition at line 82 of file vf_histogram.c.

◆ levels_in_pix_fmts

enum AVPixelFormat levels_in_pix_fmts[]
static

◆ levels_out_yuv8_pix_fmts

enum AVPixelFormat levels_out_yuv8_pix_fmts[]
static
Initial value:

Definition at line 126 of file vf_histogram.c.

Referenced by query_formats().

◆ levels_out_yuv9_pix_fmts

enum AVPixelFormat levels_out_yuv9_pix_fmts[]
static
Initial value:

Definition at line 131 of file vf_histogram.c.

Referenced by query_formats().

◆ levels_out_yuv10_pix_fmts

enum AVPixelFormat levels_out_yuv10_pix_fmts[]
static
Initial value:

Definition at line 136 of file vf_histogram.c.

Referenced by query_formats().

◆ levels_out_yuv12_pix_fmts

enum AVPixelFormat levels_out_yuv12_pix_fmts[]
static
Initial value:

Definition at line 141 of file vf_histogram.c.

Referenced by query_formats().

◆ levels_out_rgb8_pix_fmts

enum AVPixelFormat levels_out_rgb8_pix_fmts[]
static
Initial value:

Definition at line 146 of file vf_histogram.c.

Referenced by query_formats().

◆ levels_out_rgb9_pix_fmts

enum AVPixelFormat levels_out_rgb9_pix_fmts[]
static
Initial value:

Definition at line 151 of file vf_histogram.c.

Referenced by query_formats().

◆ levels_out_rgb10_pix_fmts

enum AVPixelFormat levels_out_rgb10_pix_fmts[]
static
Initial value:

Definition at line 156 of file vf_histogram.c.

Referenced by query_formats().

◆ levels_out_rgb12_pix_fmts

enum AVPixelFormat levels_out_rgb12_pix_fmts[]
static
Initial value:

Definition at line 161 of file vf_histogram.c.

Referenced by query_formats().

◆ black_yuva_color

const uint8_t black_yuva_color[4] = { 0, 127, 127, 255 }
static

Definition at line 217 of file vf_histogram.c.

Referenced by config_input().

◆ black_gbrp_color

const uint8_t black_gbrp_color[4] = { 0, 0, 0, 255 }
static

Definition at line 218 of file vf_histogram.c.

Referenced by config_input().

◆ white_yuva_color

const uint8_t white_yuva_color[4] = { 255, 127, 127, 255 }
static

Definition at line 219 of file vf_histogram.c.

Referenced by config_input().

◆ white_gbrp_color

const uint8_t white_gbrp_color[4] = { 255, 255, 255, 255 }
static

Definition at line 220 of file vf_histogram.c.

Referenced by config_input().

◆ gray_color

const uint8_t gray_color[4] = { 127, 127, 127, 255 }
static

Definition at line 221 of file vf_histogram.c.

Referenced by config_input().

◆ red_yuva_color

const uint8_t red_yuva_color[4] = { 127, 127, 255, 255 }
static

Definition at line 222 of file vf_histogram.c.

Referenced by config_input().

◆ red_gbrp_color

const uint8_t red_gbrp_color[4] = { 255, 0, 0, 255 }
static

Definition at line 223 of file vf_histogram.c.

Referenced by config_input().

◆ green_yuva_color

const uint8_t green_yuva_color[4] = { 255, 127, 127, 255 }
static

Definition at line 224 of file vf_histogram.c.

Referenced by config_input().

◆ igreen_yuva_color

const uint8_t igreen_yuva_color[4] = { 0, 127, 127, 255 }
static

Definition at line 225 of file vf_histogram.c.

Referenced by config_input().

◆ green_gbrp_color

const uint8_t green_gbrp_color[4] = { 0, 255, 0, 255 }
static

Definition at line 226 of file vf_histogram.c.

Referenced by config_input().

◆ blue_yuva_color

const uint8_t blue_yuva_color[4] = { 127, 255, 127, 255 }
static

Definition at line 227 of file vf_histogram.c.

Referenced by config_input().

◆ blue_gbrp_color

const uint8_t blue_gbrp_color[4] = { 0, 0, 255, 255 }
static

Definition at line 228 of file vf_histogram.c.

Referenced by config_input().

◆ inputs

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

Definition at line 620 of file vf_histogram.c.

◆ outputs

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

Definition at line 629 of file vf_histogram.c.

FLAGS
#define FLAGS
Definition: vf_histogram.c:67
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:538
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:540
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:502
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_histogram.c:230
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_histogram.c:402
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:541
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:537
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:518
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:500
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:505
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:283
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:86
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:522
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:523
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:108
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:544
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:499
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:87
NULL
#define NULL
Definition: coverity.c:32
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:85
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:503
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:517
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_histogram.c:371
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:507
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:509
OFFSET
#define OFFSET(x)
Definition: vf_histogram.c:66
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:174
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:542
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition: opt.h:271
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:519
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:501
COMMON_OPTIONS
#define COMMON_OPTIONS
Definition: vf_histogram.c:69
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:539
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:506
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:543
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:80
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:508
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:173