Go to the documentation of this file.
46 #define LCG(x) (((x) * LCG_A + LCG_C) % LCG_M)
47 #define LCG_SEED 739187
68 #define OFFSET(x) offsetof(HisteqContext, x)
69 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
70 #define CONST(name, help, val, u) { name, help, 0, AV_OPT_TYPE_CONST, {.i64=val}, INT_MIN, INT_MAX, FLAGS, .unit = u }
89 "strength:%0.3f intensity:%0.3f antibanding:%d\n",
118 #define GET_RGB_VALUES(r, g, b, src, map) do { \
119 r = src[x + map[R]]; \
120 g = src[x + map[G]]; \
121 b = src[x + map[B]]; \
129 int strength = histeq->
strength * 1000;
130 int intensity = histeq->
intensity * 1000;
131 int x, y,
i, luthi, lutlo, lut, luma, oluma, m;
133 unsigned int r,
g,
b, jran;
150 dst = outpic->
data[0];
151 for (y = 0; y <
inlink->h; y++) {
152 for (x = 0; x <
inlink->w * histeq->
bpp; x += histeq->
bpp) {
154 luma = (55 *
r + 182 *
g + 19 *
b) >> 8;
163 for (x = 0; x < 256; x++)
170 for (x = 1; x < 256; x++)
174 for (x = 0; x < 256; x++)
179 for (x = 0; x < 256; x++)
180 histeq->
LUT[x] = (strength * histeq->
LUT[x]) / 255 +
181 ((255 - strength) * x) / 255;
187 dst = outpic->
data[0];
188 for (y = 0; y <
inlink->h; y++) {
189 for (x = 0; x <
inlink->w * histeq->
bpp; x += histeq->
bpp) {
192 for (
i = 0;
i < histeq->
bpp; ++
i)
196 lut = histeq->
LUT[luma];
200 (histeq->
LUT[luma] + histeq->
LUT[luma - 1]) / 2 :
201 histeq->
LUT[luma - 1];
207 (histeq->
LUT[luma] + histeq->
LUT[luma + 1]) / 2 :
208 histeq->
LUT[luma + 1];
212 if (lutlo != luthi) {
214 lut = lutlo + ((luthi - lutlo + 1) * jran) /
LCG_M;
219 if (((m =
FFMAX3(
r,
g,
b)) * lut) / luma > 255) {
224 r = (
r * lut) / luma;
225 g = (
g * lut) / luma;
226 b = (
b * lut) / luma;
239 for (x = 0; x < 256; x++)
264 .priv_class = &histeq_class,
@ HISTEQ_ANTIBANDING_WEAK
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
AVPixelFormat
Pixel format.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static const AVOption histeq_options[]
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define FILTER_PIXFMTS_ARRAY(array)
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
const AVFilter ff_vf_histeq
This structure describes decoded (raw) audio or video data.
#define AV_LOG_VERBOSE
Detailed information.
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
const char * name
Filter name.
A link between two filters.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
A filter pad used for either input or output.
#define GET_RGB_VALUES(r, g, b, src, map)
static enum AVPixelFormat pix_fmts[]
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
#define FILTER_INPUTS(array)
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Describe the class of an AVClass context structure.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
static av_cold int init(AVFilterContext *ctx)
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
@ HISTEQ_ANTIBANDING_NONE
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int in_histogram[256]
input histogram
uint8_t rgba_map[4]
components position
static const AVFilterPad histeq_inputs[]
int antibanding
HisteqAntibanding.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
#define i(width, name, range_min, range_max)
int w
agreed upon image width
static int config_input(AVFilterLink *inlink)
int out_histogram[256]
output histogram
const char * name
Pad name.
int LUT[256]
lookup table derived from histogram[]
int h
agreed upon image height
AVFILTER_DEFINE_CLASS(histeq)
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define FILTER_OUTPUTS(array)
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
@ HISTEQ_ANTIBANDING_STRONG
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
#define CONST(name, help, val, u)