FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
vf_histeq.c File Reference

Histogram equalization filter, based on the VirtualDub filter by Donald A. More...

#include "libavutil/common.h"
#include "libavutil/internal.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  HisteqContext
 

Macros

#define LCG_A   4096
 
#define LCG_C   150889
 
#define LCG_M   714025
 
#define LCG(x)   (((x) * LCG_A + LCG_C) % LCG_M)
 
#define LCG_SEED   739187
 
#define OFFSET(x)   offsetof(HisteqContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define CONST(name, help, val, unit)   { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, INT_MIN, INT_MAX, FLAGS, unit }
 
#define R   0
 
#define G   1
 
#define B   2
 
#define A   3
 
#define GET_RGB_VALUES(r, g, b, src, map)
 

Enumerations

enum  HisteqAntibanding { HISTEQ_ANTIBANDING_NONE = 0, HISTEQ_ANTIBANDING_WEAK = 1, HISTEQ_ANTIBANDING_STRONG = 2, HISTEQ_ANTIBANDING_NB }
 

Functions

 AVFILTER_DEFINE_CLASS (histeq)
 
static av_cold int init (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *inpic)
 

Variables

static const AVOption histeq_options []
 
static const AVFilterPad histeq_inputs []
 
static const AVFilterPad histeq_outputs []
 
AVFilter ff_vf_histeq
 

Detailed Description

Histogram equalization filter, based on the VirtualDub filter by Donald A.

Graft <neuron2 at="" home="" dot="" com>="">. Implements global automatic contrast adjustment by means of histogram equalization.

Definition in file vf_histeq.c.

Macro Definition Documentation

#define LCG_A   4096

Definition at line 44 of file vf_histeq.c.

#define LCG_C   150889

Definition at line 45 of file vf_histeq.c.

#define LCG_M   714025

Definition at line 46 of file vf_histeq.c.

Referenced by filter_frame().

#define LCG (   x)    (((x) * LCG_A + LCG_C) % LCG_M)

Definition at line 47 of file vf_histeq.c.

Referenced by filter_frame().

#define LCG_SEED   739187

Definition at line 48 of file vf_histeq.c.

Referenced by filter_frame().

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

Definition at line 69 of file vf_histeq.c.

Definition at line 70 of file vf_histeq.c.

#define CONST (   name,
  help,
  val,
  unit 
)    { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, INT_MIN, INT_MAX, FLAGS, unit }

Definition at line 71 of file vf_histeq.c.

#define R   0

Definition at line 121 of file vf_histeq.c.

Referenced by filter_frame().

#define G   1

Definition at line 122 of file vf_histeq.c.

Referenced by filter_frame().

#define B   2

Definition at line 123 of file vf_histeq.c.

Referenced by filter_frame().

#define A   3

Definition at line 124 of file vf_histeq.c.

Referenced by filter_frame().

#define GET_RGB_VALUES (   r,
  g,
  b,
  src,
  map 
)
Value:
do { \
r = src[x + map[R]]; \
g = src[x + map[G]]; \
b = src[x + map[B]]; \
} while (0)
const char * g
Definition: vf_curves.c:112
const char * b
Definition: vf_curves.c:113
#define src
Definition: vp8dsp.c:254
const char * r
Definition: vf_curves.c:111
#define R
Definition: vf_histeq.c:121
const VDPAUPixFmtMap * map
#define B
Definition: vf_histeq.c:123
#define G
Definition: vf_histeq.c:122

Definition at line 126 of file vf_histeq.c.

Referenced by filter_frame().

Enumeration Type Documentation

Enumerator
HISTEQ_ANTIBANDING_NONE 
HISTEQ_ANTIBANDING_WEAK 
HISTEQ_ANTIBANDING_STRONG 
HISTEQ_ANTIBANDING_NB 

Definition at line 50 of file vf_histeq.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( histeq  )
static av_cold int init ( AVFilterContext ctx)
static

Definition at line 85 of file vf_histeq.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 96 of file vf_histeq.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 109 of file vf_histeq.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame inpic 
)
static

Definition at line 132 of file vf_histeq.c.

Variable Documentation

const AVOption histeq_options[]
static
Initial value:
= {
{ "strength", "set the strength", OFFSET(strength), AV_OPT_TYPE_FLOAT, {.dbl=0.2}, 0, 1, FLAGS },
{ "intensity", "set the intensity", OFFSET(intensity), AV_OPT_TYPE_FLOAT, {.dbl=0.21}, 0, 1, FLAGS },
{ "antibanding", "set the antibanding level", OFFSET(antibanding), AV_OPT_TYPE_INT, {.i64=HISTEQ_ANTIBANDING_NONE}, 0, HISTEQ_ANTIBANDING_NB-1, FLAGS, "antibanding" },
CONST("none", "apply no antibanding", HISTEQ_ANTIBANDING_NONE, "antibanding"),
CONST("weak", "apply weak antibanding", HISTEQ_ANTIBANDING_WEAK, "antibanding"),
CONST("strong", "apply strong antibanding", HISTEQ_ANTIBANDING_STRONG, "antibanding"),
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define FLAGS
Definition: vf_histeq.c:70
#define CONST(name, help, val, unit)
Definition: vf_histeq.c:71
#define OFFSET(x)
Definition: vf_histeq.c:69

Definition at line 73 of file vf_histeq.c.

const AVFilterPad histeq_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.filter_frame = filter_frame,
},
{ NULL }
}
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
Definition: vf_histeq.c:132
#define NULL
Definition: coverity.c:32
static int config_input(AVFilterLink *inlink)
Definition: vf_histeq.c:109

Definition at line 255 of file vf_histeq.c.

const AVFilterPad histeq_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 265 of file vf_histeq.c.

AVFilter ff_vf_histeq
Initial value:
= {
.name = "histeq",
.description = NULL_IF_CONFIG_SMALL("Apply global color histogram equalization."),
.priv_size = sizeof(HisteqContext),
.init = init,
.priv_class = &histeq_class,
}
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:125
static int flags
Definition: log.c:57
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static const AVFilterPad histeq_outputs[]
Definition: vf_histeq.c:265
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:386
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:376
static av_cold int init(AVFilterContext *ctx)
Definition: vf_histeq.c:85
static int query_formats(AVFilterContext *ctx)
Definition: vf_histeq.c:96
static const AVFilterPad histeq_inputs[]
Definition: vf_histeq.c:255

Definition at line 273 of file vf_histeq.c.