FFmpeg
Data Structures | Macros | Functions | Variables
vf_normalize.c File Reference
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "drawutils.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  NormalizeHistory
 
struct  NormalizeLocal
 
struct  NormalizeContext
 

Macros

#define OFFSET(x)   offsetof(NormalizeContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define FLAGSR   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (normalize)
 
static void find_min_max (NormalizeContext *s, AVFrame *in, NormalizeLocal min[3], NormalizeLocal max[3])
 
static void process (NormalizeContext *s, AVFrame *in, AVFrame *out)
 
static void find_min_max_planar (NormalizeContext *s, AVFrame *in, NormalizeLocal min[3], NormalizeLocal max[3])
 
static void process_planar (NormalizeContext *s, AVFrame *in, AVFrame *out)
 
static void find_min_max_16 (NormalizeContext *s, AVFrame *in, NormalizeLocal min[3], NormalizeLocal max[3])
 
static void process_16 (NormalizeContext *s, AVFrame *in, AVFrame *out)
 
static void find_min_max_planar_16 (NormalizeContext *s, AVFrame *in, NormalizeLocal min[3], NormalizeLocal max[3])
 
static void process_planar_16 (NormalizeContext *s, AVFrame *in, AVFrame *out)
 
static void normalize (NormalizeContext *s, AVFrame *in, AVFrame *out)
 
static int config_input (AVFilterLink *inlink)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 

Variables

static const AVOption normalize_options []
 
static enum AVPixelFormat pixel_fmts []
 
static const AVFilterPad inputs []
 
static const AVFilterPad outputs []
 
const AVFilter ff_vf_normalize
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 125 of file vf_normalize.c.

◆ FLAGS

Definition at line 126 of file vf_normalize.c.

◆ FLAGSR

Definition at line 127 of file vf_normalize.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( normalize  )

◆ find_min_max()

static void find_min_max ( NormalizeContext s,
AVFrame in,
NormalizeLocal  min[3],
NormalizeLocal  max[3] 
)
static

Definition at line 140 of file vf_normalize.c.

Referenced by config_input().

◆ process()

static void process ( NormalizeContext s,
AVFrame in,
AVFrame out 
)
static

Definition at line 156 of file vf_normalize.c.

Referenced by config_input(), and swscale().

◆ find_min_max_planar()

static void find_min_max_planar ( NormalizeContext s,
AVFrame in,
NormalizeLocal  min[3],
NormalizeLocal  max[3] 
)
static

Definition at line 173 of file vf_normalize.c.

Referenced by config_input().

◆ process_planar()

static void process_planar ( NormalizeContext s,
AVFrame in,
AVFrame out 
)
static

Definition at line 193 of file vf_normalize.c.

Referenced by config_input().

◆ find_min_max_16()

static void find_min_max_16 ( NormalizeContext s,
AVFrame in,
NormalizeLocal  min[3],
NormalizeLocal  max[3] 
)
static

Definition at line 214 of file vf_normalize.c.

Referenced by config_input().

◆ process_16()

static void process_16 ( NormalizeContext s,
AVFrame in,
AVFrame out 
)
static

Definition at line 230 of file vf_normalize.c.

Referenced by config_input().

◆ find_min_max_planar_16()

static void find_min_max_planar_16 ( NormalizeContext s,
AVFrame in,
NormalizeLocal  min[3],
NormalizeLocal  max[3] 
)
static

Definition at line 247 of file vf_normalize.c.

Referenced by config_input().

◆ process_planar_16()

static void process_planar_16 ( NormalizeContext s,
AVFrame in,
AVFrame out 
)
static

Definition at line 267 of file vf_normalize.c.

Referenced by config_input().

◆ normalize()

static void normalize ( NormalizeContext s,
AVFrame in,
AVFrame out 
)
static

Definition at line 291 of file vf_normalize.c.

Referenced by filter_frame().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 413 of file vf_normalize.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 459 of file vf_normalize.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 469 of file vf_normalize.c.

Variable Documentation

◆ normalize_options

const AVOption normalize_options[]
static
Initial value:
= {
{ "blackpt", "output color to which darkest input color is mapped", OFFSET(blackpt), AV_OPT_TYPE_COLOR, { .str = "black" }, 0, 0, FLAGSR },
{ "whitept", "output color to which brightest input color is mapped", OFFSET(whitept), AV_OPT_TYPE_COLOR, { .str = "white" }, 0, 0, FLAGSR },
{ "smoothing", "amount of temporal smoothing of the input range, to reduce flicker", OFFSET(smoothing), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX/8, FLAGS },
{ "independence", "proportion of independent to linked channel normalization", OFFSET(independence), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, 1.0, FLAGSR },
{ "strength", "strength of filter, from no effect to full normalization", OFFSET(strength), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, 1.0, FLAGSR },
{ NULL }
}

Definition at line 129 of file vf_normalize.c.

◆ pixel_fmts

enum AVPixelFormat pixel_fmts[]
static

◆ inputs

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

Definition at line 505 of file vf_normalize.c.

◆ outputs

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

Definition at line 514 of file vf_normalize.c.

◆ ff_vf_normalize

const AVFilter ff_vf_normalize
Initial value:
= {
.name = "normalize",
.description = NULL_IF_CONFIG_SMALL("Normalize RGB video."),
.priv_size = sizeof(NormalizeContext),
.priv_class = &normalize_class,
.process_command = ff_filter_process_command,
}

Definition at line 521 of file vf_normalize.c.

NormalizeContext
Definition: vf_normalize.c:96
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:426
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:171
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:95
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:422
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:205
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:420
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:424
outputs
static const AVFilterPad outputs[]
Definition: vf_normalize.c:514
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:425
pixel_fmts
static enum AVPixelFormat pixel_fmts[]
Definition: vf_normalize.c:391
FLAGSR
#define FLAGSR
Definition: vf_normalize.c:127
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:93
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:423
AV_PIX_FMT_RGBA64
#define AV_PIX_FMT_RGBA64
Definition: pixfmt.h:394
AV_PIX_FMT_BGR48
#define AV_PIX_FMT_BGR48
Definition: pixfmt.h:395
NULL
#define NULL
Definition: coverity.c:32
AV_OPT_TYPE_COLOR
@ AV_OPT_TYPE_COLOR
Definition: opt.h:239
inputs
static const AVFilterPad inputs[]
Definition: vf_normalize.c:505
AV_PIX_FMT_BGR0
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:230
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:419
AV_PIX_FMT_ABGR
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:94
OFFSET
#define OFFSET(x)
Definition: vf_normalize.c:125
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
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:117
FLAGS
#define FLAGS
Definition: vf_normalize.c:126
AV_PIX_FMT_RGB48
#define AV_PIX_FMT_RGB48
Definition: pixfmt.h:390
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_normalize.c:459
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_normalize.c:469
ff_filter_process_command
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition: avfilter.c:882
AV_PIX_FMT_RGB0
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
Definition: pixfmt.h:228
AV_PIX_FMT_ARGB
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:92
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:227
AV_PIX_FMT_BGRA64
#define AV_PIX_FMT_BGRA64
Definition: pixfmt.h:399
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_normalize.c:413
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:421
AV_PIX_FMT_0BGR
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
Definition: pixfmt.h:229
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:158
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition: avfilter.h:154
AV_PIX_FMT_0RGB
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
Definition: pixfmt.h:227