FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
vf_histogram.c File Reference
#include "libavutil/avassert.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  HistogramContext
 

Macros

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

Enumerations

enum  HistogramMode {
  MODE_LEVELS, MODE_WAVEFORM, MODE_COLOR, MODE_COLOR2,
  MODE_NB
}
 

Functions

 AVFILTER_DEFINE_CLASS (histogram)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
static void gen_waveform (HistogramContext *h, AVFrame *inpicref, AVFrame *outpicref, int component, int intensity, int offset, int col_mode)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 

Variables

static const AVOption histogram_options []
 
static enum AVPixelFormat color_pix_fmts []
 
static enum AVPixelFormat levels_pix_fmts []
 
static enum AVPixelFormat waveform_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 AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
AVFilter ff_vf_histogram
 

Macro Definition Documentation

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

Definition at line 55 of file vf_histogram.c.

Definition at line 56 of file vf_histogram.c.

Enumeration Type Documentation

Enumerator
MODE_LEVELS 
MODE_WAVEFORM 
MODE_COLOR 
MODE_COLOR2 
MODE_NB 

Definition at line 30 of file vf_histogram.c.

Function Documentation

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

Definition at line 104 of file vf_histogram.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 136 of file vf_histogram.c.

static int config_output ( AVFilterLink outlink)
static

Definition at line 157 of file vf_histogram.c.

static void gen_waveform ( HistogramContext h,
AVFrame inpicref,
AVFrame outpicref,
int  component,
int  intensity,
int  offset,
int  col_mode 
)
static

Definition at line 186 of file vf_histogram.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 233 of file vf_histogram.c.

Variable Documentation

const AVOption histogram_options[]
static
Initial value:
= {
{ "mode", "set histogram mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=MODE_LEVELS}, 0, MODE_NB-1, FLAGS, "mode"},
{ "levels", "standard histogram", 0, AV_OPT_TYPE_CONST, {.i64=MODE_LEVELS}, 0, 0, FLAGS, "mode" },
{ "waveform", "per row/column luminance graph", 0, AV_OPT_TYPE_CONST, {.i64=MODE_WAVEFORM}, 0, 0, FLAGS, "mode" },
{ "color", "chroma values in vectorscope", 0, AV_OPT_TYPE_CONST, {.i64=MODE_COLOR}, 0, 0, FLAGS, "mode" },
{ "color2", "chroma values in vectorscope", 0, AV_OPT_TYPE_CONST, {.i64=MODE_COLOR2}, 0, 0, FLAGS, "mode" },
{ "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},
{ "step", "set waveform step value", OFFSET(step), AV_OPT_TYPE_INT, {.i64=10}, 1, 255, FLAGS},
{ "waveform_mode", "set waveform mode", OFFSET(waveform_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "waveform_mode"},
{ "row", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "waveform_mode" },
{ "column", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "waveform_mode" },
{ "waveform_mirror", "set waveform mirroring", OFFSET(waveform_mirror), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "waveform_mirror"},
{ "display_mode", "set display mode", OFFSET(display_mode), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS, "display_mode"},
{ "parade", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "display_mode" },
{ "overlay", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "display_mode" },
{ "levels_mode", "set levels mode", OFFSET(levels_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "levels_mode"},
{ "linear", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "levels_mode" },
{ "logarithmic", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "levels_mode" },
{ NULL }
}
#define NULL
Definition: coverity.c:32
mode
Definition: f_perms.c:27
#define OFFSET(x)
Definition: vf_histogram.c:55
#define FLAGS
Definition: vf_histogram.c:56

Definition at line 58 of file vf_histogram.c.

enum AVPixelFormat color_pix_fmts[]
static
Initial value:
= {
}
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:68
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:268
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:77

Definition at line 82 of file vf_histogram.c.

Referenced by query_formats().

enum AVPixelFormat levels_pix_fmts[]
static
Initial value:
= {
}
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:68
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:176
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:268
Y , 8bpp.
Definition: pixfmt.h:71
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:287
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:77

Definition at line 87 of file vf_histogram.c.

Referenced by query_formats().

enum AVPixelFormat waveform_pix_fmts[]
static
Initial value:
= {
}
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:68
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:176
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:103
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
Definition: pixfmt.h:102
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:76
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:269
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:67
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:75
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:268
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:69
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:63
Y , 8bpp.
Definition: pixfmt.h:71
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:287
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:77
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:70
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:290
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:101

Definition at line 92 of file vf_histogram.c.

Referenced by query_formats().

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

Definition at line 131 of file vf_histogram.c.

Referenced by config_input().

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

Definition at line 132 of file vf_histogram.c.

Referenced by config_input().

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

Definition at line 133 of file vf_histogram.c.

Referenced by config_input().

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

Definition at line 134 of file vf_histogram.c.

Referenced by config_input().

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)
Definition: vf_histogram.c:136
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_histogram.c:233

Definition at line 351 of file vf_histogram.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_histogram.c:157

Definition at line 361 of file vf_histogram.c.

AVFilter ff_vf_histogram
Initial value:
= {
.name = "histogram",
.description = NULL_IF_CONFIG_SMALL("Compute and draw a histogram."),
.priv_size = sizeof(HistogramContext),
.priv_class = &histogram_class,
}
static const AVFilterPad inputs[]
Definition: vf_histogram.c:351
static const AVFilterPad outputs[]
Definition: vf_histogram.c:361
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
static int query_formats(AVFilterContext *ctx)
Definition: vf_histogram.c:104

Definition at line 370 of file vf_histogram.c.