46 int jobnr,
int nb_jobs);
49static inline float lerpf(
float v0,
float v1,
float f)
51 return v0 + (v1 - v0) *
f;
55 br = (b + r) * 0.5f; \
56 gb = (g + b) * 0.5f; \
57 rg = (r + g) * 0.5f; \
75 ng = av_clipf((g0 * gmw + g1 * byw + g2 * rcw) * scale, 0.f, max); \
76 nb = av_clipf((b0 * gmw + b1 * byw + b2 * rcw) * scale, 0.f, max); \
77 nr = av_clipf((r0 * gmw + r1 * byw + r2 * rcw) * scale, 0.f, max); \
79 li = FFMAX3(r, g, b) + FFMIN3(r, g, b); \
80 lo = FFMAX3(nr, ng, nb) + FFMIN3(nr, ng, nb) + FLT_EPSILON; \
87 nr = lerpf(nr, r, preserve); \
88 ng = lerpf(ng, g, preserve); \
89 nb = lerpf(nb, b, preserve);
99 const ptrdiff_t glinesize =
frame->linesize[0];
100 const ptrdiff_t blinesize =
frame->linesize[1];
101 const ptrdiff_t rlinesize =
frame->linesize[2];
105 const float preserve =
s->preserve;
106 const float gm =
s->gm * 0.5f;
107 const float by =
s->by * 0.5f;
108 const float rc =
s->rc * 0.5f;
109 const float gmw =
s->gmw;
110 const float byw =
s->byw;
111 const float rcw =
s->rcw;
112 const float sum = gmw + byw + rcw;
113 const float scale = 1.f / sum;
115 for (
int y =
slice_start; y < slice_end && sum > FLT_EPSILON; y++) {
116 for (
int x = 0; x <
width; x++) {
147 const int depth =
s->depth;
148 const float max = (1 << depth) - 1;
153 const ptrdiff_t glinesize =
frame->linesize[0] / 2;
154 const ptrdiff_t blinesize =
frame->linesize[1] / 2;
155 const ptrdiff_t rlinesize =
frame->linesize[2] / 2;
159 const float preserve =
s->preserve;
160 const float gm =
s->gm * 0.5f;
161 const float by =
s->by * 0.5f;
162 const float rc =
s->rc * 0.5f;
163 const float gmw =
s->gmw;
164 const float byw =
s->byw;
165 const float rcw =
s->rcw;
166 const float sum = gmw + byw + rcw;
167 const float scale = 1.f / sum;
169 for (
int y =
slice_start; y < slice_end && sum > FLT_EPSILON; y++) {
170 for (
int x = 0; x <
width; x++) {
201 const int step =
s->step;
206 const ptrdiff_t linesize =
frame->linesize[0];
207 const uint8_t roffset =
s->rgba_map[
R];
208 const uint8_t goffset =
s->rgba_map[
G];
209 const uint8_t boffset =
s->rgba_map[
B];
211 const float preserve =
s->preserve;
212 const float gm =
s->gm * 0.5f;
213 const float by =
s->by * 0.5f;
214 const float rc =
s->rc * 0.5f;
215 const float gmw =
s->gmw;
216 const float byw =
s->byw;
217 const float rcw =
s->rcw;
218 const float sum = gmw + byw + rcw;
219 const float scale = 1.f / sum;
221 for (
int y =
slice_start; y < slice_end && sum > FLT_EPSILON; y++) {
222 for (
int x = 0; x <
width; x++) {
223 float g = ptr[x * step + goffset];
224 float b = ptr[x * step + boffset];
225 float r = ptr[x * step + roffset];
251 const int step =
s->step;
252 const int depth =
s->depth;
253 const float max = (1 << depth) - 1;
258 const ptrdiff_t linesize =
frame->linesize[0] / 2;
259 const uint8_t roffset =
s->rgba_map[
R];
260 const uint8_t goffset =
s->rgba_map[
G];
261 const uint8_t boffset =
s->rgba_map[
B];
263 const float preserve =
s->preserve;
264 const float gm =
s->gm * 0.5f;
265 const float by =
s->by * 0.5f;
266 const float rc =
s->rc * 0.5f;
267 const float gmw =
s->gmw;
268 const float byw =
s->byw;
269 const float rcw =
s->rcw;
270 const float sum = gmw + byw + rcw;
271 const float scale = 1.f / sum;
273 for (
int y =
slice_start; y < slice_end && sum > FLT_EPSILON; y++) {
274 for (
int x = 0; x <
width; x++) {
275 float g = ptr[x * step + goffset];
276 float b = ptr[x * step + boffset];
277 float r = ptr[x * step + roffset];
334 s->step =
desc->nb_components;
341 s->depth =
desc->comp[0].depth;
361#define OFFSET(x) offsetof(ColorContrastContext, x)
362#define VF AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
378 .p.name =
"colorcontrast",
380 .p.priv_class = &colorcontrast_class,
static int config_input(AVFilterLink *inlink)
const FFFilter ff_vf_colorcontrast
static AVFormatContext * ctx
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
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.
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Main libavfilter public API header.
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
Clip a signed integer to an unsigned power of two range.
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
static void scale(int *out, const int *in, const int w, const int h, const int shift)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.
#define FILTER_PIXFMTS_ARRAY(array)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output)
Handle slice ends.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
#define AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_RGBA64
#define AV_PIX_FMT_GBRP12
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
#define AV_PIX_FMT_BGRA64
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP14
Describe the class of an AVClass context structure.
A link between two filters.
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
int(* do_slice)(AVFilterContext *s, void *arg, int jobnr, int nb_jobs)
static enum AVPixelFormat pixel_fmts[]
static int colorcontrast_slice16p(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static const AVFilterPad colorcontrast_inputs[]
static const AVOption colorcontrast_options[]
static int colorcontrast_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static av_cold int config_input(AVFilterLink *inlink)
static int filter_frame(AVFilterLink *link, AVFrame *frame)
static float lerpf(float v0, float v1, float f)
static int colorcontrast_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int colorcontrast_slice8p(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static double b1(void *priv, double x, double y)
static double b2(void *priv, double x, double y)
static double b0(void *priv, double x, double y)
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)