Go to the documentation of this file.
39 #define SAT_MIN_VAL -10
40 #define SAT_MAX_VAL 10
88 #define OFFSET(x) offsetof(HueContext, x)
89 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
94 { .str =
"1" }, .flags =
FLAGS },
98 { .str =
"0" }, .flags =
FLAGS },
117 const float b =
h->brightness;
120 for (
i = 0;
i < 256;
i++) {
123 for (
i = 0;
i < 65536;
i++) {
137 for (
i = 0;
i < 256;
i++) {
138 for (j = 0; j < 256; j++) {
149 new_u = ((
c *
u) - (
s * v) + (1 << 15) + (128 << 16)) >> 16;
150 new_v = ((
s *
u) + (
c * v) + (1 << 15) + (128 << 16)) >> 16;
157 for (
i = 0;
i < 1024;
i++) {
158 for (j = 0; j < 1024; j++) {
168 new_u = ((
c *
u) - (
s * v) + (1 << 15) + (512 << 16)) >> 16;
169 new_v = ((
s *
u) + (
c * v) + (1 << 15) + (512 << 16)) >> 16;
179 const char *expr,
const char *
option,
void *log_ctx)
192 "Error when evaluating the expression '%s' for %s\n",
200 *pexpr_ptr = new_pexpr;
202 *expr_ptr = new_expr;
214 "H and h options are incompatible and cannot be specified "
215 "at the same time\n");
219 #define SET_EXPR(expr, option) \
220 if (hue->expr##_expr) do { \
221 ret = set_expr(&hue->expr##_pexpr, &hue->expr##_expr, \
222 hue->expr##_expr, option, ctx); \
233 "H_expr:%s h_deg_expr:%s s_expr:%s b_expr:%s\n",
289 uint8_t *ldst,
const int dst_linesize,
290 uint8_t *lsrc,
const int src_linesize,
296 for (
i = 0;
i <
w;
i++)
297 ldst[
i] =
s->lut_l[lsrc[
i]];
299 lsrc += src_linesize;
300 ldst += dst_linesize;
305 uint16_t *ldst,
const int dst_linesize,
306 uint16_t *lsrc,
const int src_linesize,
312 for (
i = 0;
i <
w;
i++)
313 ldst[
i] =
s->lut_l16[lsrc[
i]];
315 lsrc += src_linesize;
316 ldst += dst_linesize;
328 for (
i = 0;
i <
w;
i++) {
329 const int u = usrc[
i];
330 const int v = vsrc[
i];
332 udst[
i] =
s->lut_u[
u][v];
333 vdst[
i] =
s->lut_v[
u][v];
336 usrc += src_linesize;
337 vsrc += src_linesize;
338 udst += dst_linesize;
339 vdst += dst_linesize;
344 uint16_t *udst, uint16_t *vdst,
const int dst_linesize,
345 uint16_t *usrc, uint16_t *vsrc,
const int src_linesize,
351 for (
i = 0;
i <
w;
i++) {
355 udst[
i] =
s->lut_u10[
u][v];
356 vdst[
i] =
s->lut_v10[
u][v];
359 usrc += src_linesize;
360 vsrc += src_linesize;
361 udst += dst_linesize;
362 vdst += dst_linesize;
375 const int bps =
desc->comp[0].depth > 8 ? 2 : 1;
399 "Saturation value not in range [%d,%d]: clipping value to %0.1f\n",
410 "Brightness value not in range [%d,%d]: clipping value to %0.1f\n",
424 "H:%0.1f*PI h:%0.1f s:%0.1f b:%0.f t:%0.1f n:%d\n",
448 (uint16_t*)
inpic->data[1], (uint16_t*)
inpic->data[2],
inpic->linesize[1]/2,
472 char *res,
int res_len,
int flags)
477 #define SET_EXPR(expr, option) \
479 ret = set_expr(&hue->expr##_pexpr, &hue->expr##_expr, \
480 args, option, ctx); \
485 if (!strcmp(cmd,
"h")) {
488 }
else if (!strcmp(cmd,
"H")) {
491 }
else if (!strcmp(cmd,
"s")) {
493 }
else if (!strcmp(cmd,
"b")) {
529 .priv_class = &hue_class,
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
#define AV_LOG_WARNING
Something somehow does not look correct.
static void direct(const float *in, const FFTComplex *ir, int len, float *out)
AVPixelFormat
Pixel format.
double var_values[VAR_NB]
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
#define u(width, name, range_min, range_max)
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)
static void compute_sin_and_cos(HueContext *hue)
static int query_formats(AVFilterContext *ctx)
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.
This structure describes decoded (raw) audio or video data.
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUV420P10
#define AV_LOG_VERBOSE
Detailed information.
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
const char * name
Filter name.
static void apply_luma_lut10(HueContext *s, uint16_t *ldst, const int dst_linesize, uint16_t *lsrc, const int src_linesize, int w, int h)
A link between two filters.
#define AV_PIX_FMT_YUVA422P10
static const AVFilterPad hue_inputs[]
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
AVExpr * saturation_pexpr
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
static void create_chrominance_lut(HueContext *h, const int32_t c, const int32_t s)
#define SET_EXPR(expr, option)
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
A filter pad used for either input or output.
#define AV_PIX_FMT_YUV444P10
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold int init(AVFilterContext *ctx)
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
#define AV_CEIL_RSHIFT(a, b)
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static const AVFilterPad outputs[]
static enum AVPixelFormat pix_fmts[]
static void create_luma_lut(HueContext *h)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
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 void apply_lut(HueContext *s, uint8_t *udst, uint8_t *vdst, const int dst_linesize, uint8_t *usrc, uint8_t *vsrc, const int src_linesize, int w, int h)
static void apply_lut10(HueContext *s, uint16_t *udst, uint16_t *vdst, const int dst_linesize, uint16_t *usrc, uint16_t *vsrc, const int src_linesize, int w, int h)
uint16_t lut_v10[1024][1024]
#define AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV422P10
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
static av_cold void uninit(AVFilterContext *ctx)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
#define AV_PIX_FMT_YUVA444P10
AVFILTER_DEFINE_CLASS(hue)
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
int w
agreed upon image width
uint16_t lut_u10[1024][1024]
const char * name
Pad name.
static const AVOption hue_options[]
static int set_expr(AVExpr **pexpr_ptr, char **expr_ptr, const char *expr, const char *option, void *log_ctx)
static const char *const var_names[]
int h
agreed upon image height
AVExpr * brightness_pexpr
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
char * av_strdup(const char *s)
Duplicate a string.
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static int config_props(AVFilterLink *inlink)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
static const AVFilterPad hue_outputs[]
#define flags(name, subs,...)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static void apply_luma_lut(HueContext *s, uint8_t *ldst, const int dst_linesize, uint8_t *lsrc, const int src_linesize, int w, int h)
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)