FFmpeg
Loading...
Searching...
No Matches
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 "filters.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)
 
#define LCG_SEED   739187
 
#define OFFSET(x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define CONST(name, help, val, u)
 
#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 config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *inpic)
 

Variables

static const AVOption histeq_options []
 
static enum AVPixelFormat pix_fmts []
 
static const AVFilterPad histeq_inputs []
 
const FFFilter 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

◆ LCG_A

#define LCG_A   4096

Definition at line 43 of file vf_histeq.c.

◆ LCG_C

#define LCG_C   150889

Definition at line 44 of file vf_histeq.c.

◆ LCG_M

#define LCG_M   714025

Definition at line 45 of file vf_histeq.c.

Referenced by filter_frame().

◆ LCG

#define LCG ( x)
Value:
(((x) * LCG_A + LCG_C) % LCG_M)
#define LCG_A
#define LCG_C
#define LCG_M
Definition vf_histeq.c:45

Definition at line 46 of file vf_histeq.c.

Referenced by filter_frame().

◆ LCG_SEED

#define LCG_SEED   739187

Definition at line 47 of file vf_histeq.c.

Referenced by filter_frame().

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 68 of file vf_histeq.c.

◆ FLAGS

Definition at line 69 of file vf_histeq.c.

◆ CONST

#define CONST ( name,
help,
val,
u )
Value:
{ name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, INT_MIN, INT_MAX, FLAGS, .unit = u }
static double val(void *priv, double ch)
Definition aeval.c:77
#define FLAGS
Definition cmdutils.c:598
static void help(void)
Definition dct.c:457
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
#define u(width, name, range_min, range_max)
Definition cbs_apv.c:68
const char * name
Definition qsvenc.c:142

Definition at line 70 of file vf_histeq.c.

◆ R

#define R   0

Definition at line 113 of file vf_histeq.c.

◆ G

#define G   1

Definition at line 114 of file vf_histeq.c.

◆ B

#define B   2

Definition at line 115 of file vf_histeq.c.

◆ A

#define A   3

Definition at line 116 of file vf_histeq.c.

◆ GET_RGB_VALUES

#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)
#define B
Definition huffyuv.h:42
#define R
Definition huffyuv.h:44
#define G
Definition huffyuv.h:43
const VDPAUPixFmtMap * map
#define r
Definition input.c:42
#define b
Definition input.c:43
#define src
Definition vp8dsp.c:248
const char * g
Definition vf_curves.c:128

Definition at line 118 of file vf_histeq.c.

Referenced by filter_frame().

Enumeration Type Documentation

◆ HisteqAntibanding

Enumerator
HISTEQ_ANTIBANDING_NONE 
HISTEQ_ANTIBANDING_WEAK 
HISTEQ_ANTIBANDING_STRONG 
HISTEQ_ANTIBANDING_NB 

Definition at line 49 of file vf_histeq.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( histeq )

◆ init()

static av_cold int init ( AVFilterContext * ctx)
static

Definition at line 84 of file vf_histeq.c.

◆ config_input()

static int config_input ( AVFilterLink * inlink)
static

Definition at line 101 of file vf_histeq.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink * inlink,
AVFrame * inpic )
static

Definition at line 124 of file vf_histeq.c.

Variable Documentation

◆ histeq_options

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, .unit = "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 OFFSET(x)
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition opt.h:270
#define CONST(name, help, val, u)
Definition vf_bwdif.c:189
@ HISTEQ_ANTIBANDING_NONE
Definition vf_histeq.c:50
@ HISTEQ_ANTIBANDING_NB
Definition vf_histeq.c:53
@ HISTEQ_ANTIBANDING_STRONG
Definition vf_histeq.c:52
@ HISTEQ_ANTIBANDING_WEAK
Definition vf_histeq.c:51

Definition at line 72 of file vf_histeq.c.

◆ pix_fmts

enum AVPixelFormat pix_fmts[]
static
Initial value:
= {
}
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition pixfmt.h:75
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition pixfmt.h:99
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition pixfmt.h:102
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition pixfmt.h:101
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition pixfmt.h:100
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition pixfmt.h:76

Definition at line 95 of file vf_histeq.c.

◆ histeq_inputs

const AVFilterPad histeq_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.filter_frame = filter_frame,
},
}
static int config_input(AVFilterLink *inlink)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
Definition dolby_e.c:1067
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200

Definition at line 247 of file vf_histeq.c.

◆ ff_vf_histeq

const FFFilter ff_vf_histeq
Initial value:
= {
.p.name = "histeq",
.p.description = NULL_IF_CONFIG_SMALL("Apply global color histogram equalization."),
.p.priv_class = &histeq_class,
.priv_size = sizeof(HisteqContext),
.init = init,
}
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#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:196
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FILTER_PIXFMTS_ARRAY(array)
Definition filters.h:244
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
static enum AVPixelFormat pix_fmts[]
Definition libkvazaar.c:296
static const AVFilterPad histeq_inputs[]
Definition vf_histeq.c:247
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition video.c:37

Definition at line 256 of file vf_histeq.c.