FFmpeg  2.1.1
vf_hue.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2003 Michael Niedermayer
3  * Copyright (c) 2012 Jeremy Tran
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * Apply a hue/saturation filter to the input video
25  * Ported from MPlayer libmpcodecs/vf_hue.c.
26  */
27 
28 #include <float.h>
29 #include "libavutil/eval.h"
30 #include "libavutil/imgutils.h"
31 #include "libavutil/opt.h"
32 #include "libavutil/pixdesc.h"
33 
34 #include "avfilter.h"
35 #include "formats.h"
36 #include "internal.h"
37 #include "video.h"
38 
39 #define SAT_MIN_VAL -10
40 #define SAT_MAX_VAL 10
41 
42 static const char *const var_names[] = {
43  "n", // frame count
44  "pts", // presentation timestamp expressed in AV_TIME_BASE units
45  "r", // frame rate
46  "t", // timestamp expressed in seconds
47  "tb", // timebase
48  NULL
49 };
50 
51 enum var_name {
58 };
59 
60 typedef struct {
61  const AVClass *class;
62  float hue_deg; /* hue expressed in degrees */
63  float hue; /* hue expressed in radians */
64  char *hue_deg_expr;
65  char *hue_expr;
68  float saturation;
71  float brightness;
74  int hsub;
75  int vsub;
78  double var_values[VAR_NB];
79  uint8_t lut_l[256];
80  uint8_t lut_u[256][256];
81  uint8_t lut_v[256][256];
82 } HueContext;
83 
84 #define OFFSET(x) offsetof(HueContext, x)
85 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
86 static const AVOption hue_options[] = {
87  { "h", "set the hue angle degrees expression", OFFSET(hue_deg_expr), AV_OPT_TYPE_STRING,
88  { .str = NULL }, .flags = FLAGS },
89  { "s", "set the saturation expression", OFFSET(saturation_expr), AV_OPT_TYPE_STRING,
90  { .str = "1" }, .flags = FLAGS },
91  { "H", "set the hue angle radians expression", OFFSET(hue_expr), AV_OPT_TYPE_STRING,
92  { .str = NULL }, .flags = FLAGS },
93  { "b", "set the brightness expression", OFFSET(brightness_expr), AV_OPT_TYPE_STRING,
94  { .str = "0" }, .flags = FLAGS },
95  { NULL }
96 };
97 
99 
100 static inline void compute_sin_and_cos(HueContext *hue)
101 {
102  /*
103  * Scale the value to the norm of the resulting (U,V) vector, that is
104  * the saturation.
105  * This will be useful in the apply_lut function.
106  */
107  hue->hue_sin = rint(sin(hue->hue) * (1 << 16) * hue->saturation);
108  hue->hue_cos = rint(cos(hue->hue) * (1 << 16) * hue->saturation);
109 }
110 
111 static inline void create_luma_lut(HueContext *h)
112 {
113  const float b = h->brightness;
114  int i;
115 
116  for (i = 0; i < 256; i++) {
117  h->lut_l[i] = av_clip_uint8(i + b * 25.5);
118  }
119 }
120 
121 static inline void create_chrominance_lut(HueContext *h, const int32_t c,
122  const int32_t s)
123 {
124  int32_t i, j, u, v, new_u, new_v;
125 
126  /*
127  * If we consider U and V as the components of a 2D vector then its angle
128  * is the hue and the norm is the saturation
129  */
130  for (i = 0; i < 256; i++) {
131  for (j = 0; j < 256; j++) {
132  /* Normalize the components from range [16;140] to [-112;112] */
133  u = i - 128;
134  v = j - 128;
135  /*
136  * Apply the rotation of the vector : (c * u) - (s * v)
137  * (s * u) + (c * v)
138  * De-normalize the components (without forgetting to scale 128
139  * by << 16)
140  * Finally scale back the result by >> 16
141  */
142  new_u = ((c * u) - (s * v) + (1 << 15) + (128 << 16)) >> 16;
143  new_v = ((s * u) + (c * v) + (1 << 15) + (128 << 16)) >> 16;
144 
145  /* Prevent a potential overflow */
146  h->lut_u[i][j] = av_clip_uint8_c(new_u);
147  h->lut_v[i][j] = av_clip_uint8_c(new_v);
148  }
149  }
150 }
151 
152 static int set_expr(AVExpr **pexpr_ptr, char **expr_ptr,
153  const char *expr, const char *option, void *log_ctx)
154 {
155  int ret;
156  AVExpr *new_pexpr;
157  char *new_expr;
158 
159  new_expr = av_strdup(expr);
160  if (!new_expr)
161  return AVERROR(ENOMEM);
162  ret = av_expr_parse(&new_pexpr, expr, var_names,
163  NULL, NULL, NULL, NULL, 0, log_ctx);
164  if (ret < 0) {
165  av_log(log_ctx, AV_LOG_ERROR,
166  "Error when evaluating the expression '%s' for %s\n",
167  expr, option);
168  av_free(new_expr);
169  return ret;
170  }
171 
172  if (*pexpr_ptr)
173  av_expr_free(*pexpr_ptr);
174  *pexpr_ptr = new_pexpr;
175  av_freep(expr_ptr);
176  *expr_ptr = new_expr;
177 
178  return 0;
179 }
180 
181 static av_cold int init(AVFilterContext *ctx)
182 {
183  HueContext *hue = ctx->priv;
184  int ret;
185 
186  if (hue->hue_expr && hue->hue_deg_expr) {
187  av_log(ctx, AV_LOG_ERROR,
188  "H and h options are incompatible and cannot be specified "
189  "at the same time\n");
190  return AVERROR(EINVAL);
191  }
192 
193 #define SET_EXPR(expr, option) \
194  if (hue->expr##_expr) do { \
195  ret = set_expr(&hue->expr##_pexpr, &hue->expr##_expr, \
196  hue->expr##_expr, option, ctx); \
197  if (ret < 0) \
198  return ret; \
199  } while (0)
200  SET_EXPR(brightness, "b");
201  SET_EXPR(saturation, "s");
202  SET_EXPR(hue_deg, "h");
203  SET_EXPR(hue, "H");
204 #undef SET_EXPR
205 
206  av_log(ctx, AV_LOG_VERBOSE,
207  "H_expr:%s h_deg_expr:%s s_expr:%s b_expr:%s\n",
208  hue->hue_expr, hue->hue_deg_expr, hue->saturation_expr, hue->brightness_expr);
209  compute_sin_and_cos(hue);
210 
211  return 0;
212 }
213 
214 static av_cold void uninit(AVFilterContext *ctx)
215 {
216  HueContext *hue = ctx->priv;
217 
220  av_expr_free(hue->hue_pexpr);
222 }
223 
225 {
226  static const enum AVPixelFormat pix_fmts[] = {
233  };
234 
236 
237  return 0;
238 }
239 
240 static int config_props(AVFilterLink *inlink)
241 {
242  HueContext *hue = inlink->dst->priv;
243  const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
244 
245  hue->hsub = desc->log2_chroma_w;
246  hue->vsub = desc->log2_chroma_h;
247 
248  hue->var_values[VAR_N] = 0;
249  hue->var_values[VAR_TB] = av_q2d(inlink->time_base);
250  hue->var_values[VAR_R] = inlink->frame_rate.num == 0 || inlink->frame_rate.den == 0 ?
251  NAN : av_q2d(inlink->frame_rate);
252 
253  return 0;
254 }
255 
257  uint8_t *ldst, const int dst_linesize,
258  uint8_t *lsrc, const int src_linesize,
259  int w, int h)
260 {
261  int i;
262 
263  while (h--) {
264  for (i = 0; i < w; i++)
265  ldst[i] = s->lut_l[lsrc[i]];
266 
267  lsrc += src_linesize;
268  ldst += dst_linesize;
269  }
270 }
271 
272 static void apply_lut(HueContext *s,
273  uint8_t *udst, uint8_t *vdst, const int dst_linesize,
274  uint8_t *usrc, uint8_t *vsrc, const int src_linesize,
275  int w, int h)
276 {
277  int i;
278 
279  while (h--) {
280  for (i = 0; i < w; i++) {
281  const int u = usrc[i];
282  const int v = vsrc[i];
283 
284  udst[i] = s->lut_u[u][v];
285  vdst[i] = s->lut_v[u][v];
286  }
287 
288  usrc += src_linesize;
289  vsrc += src_linesize;
290  udst += dst_linesize;
291  vdst += dst_linesize;
292  }
293 }
294 
295 #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
296 #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
297 
298 static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
299 {
300  HueContext *hue = inlink->dst->priv;
301  AVFilterLink *outlink = inlink->dst->outputs[0];
302  AVFrame *outpic;
303  const int32_t old_hue_sin = hue->hue_sin, old_hue_cos = hue->hue_cos;
304  const float old_brightness = hue->brightness;
305  int direct = 0;
306 
307  if (av_frame_is_writable(inpic)) {
308  direct = 1;
309  outpic = inpic;
310  } else {
311  outpic = ff_get_video_buffer(outlink, outlink->w, outlink->h);
312  if (!outpic) {
313  av_frame_free(&inpic);
314  return AVERROR(ENOMEM);
315  }
316  av_frame_copy_props(outpic, inpic);
317  }
318 
319  hue->var_values[VAR_N] = inlink->frame_count;
320  hue->var_values[VAR_T] = TS2T(inpic->pts, inlink->time_base);
321  hue->var_values[VAR_PTS] = TS2D(inpic->pts);
322 
323  if (hue->saturation_expr) {
324  hue->saturation = av_expr_eval(hue->saturation_pexpr, hue->var_values, NULL);
325 
326  if (hue->saturation < SAT_MIN_VAL || hue->saturation > SAT_MAX_VAL) {
327  hue->saturation = av_clip(hue->saturation, SAT_MIN_VAL, SAT_MAX_VAL);
328  av_log(inlink->dst, AV_LOG_WARNING,
329  "Saturation value not in range [%d,%d]: clipping value to %0.1f\n",
331  }
332  }
333 
334  if (hue->brightness_expr) {
335  hue->brightness = av_expr_eval(hue->brightness_pexpr, hue->var_values, NULL);
336 
337  if (hue->brightness < -10 || hue->brightness > 10) {
338  hue->brightness = av_clipf(hue->brightness, -10, 10);
339  av_log(inlink->dst, AV_LOG_WARNING,
340  "Brightness value not in range [%d,%d]: clipping value to %0.1f\n",
341  -10, 10, hue->brightness);
342  }
343  }
344 
345  if (hue->hue_deg_expr) {
346  hue->hue_deg = av_expr_eval(hue->hue_deg_pexpr, hue->var_values, NULL);
347  hue->hue = hue->hue_deg * M_PI / 180;
348  } else if (hue->hue_expr) {
349  hue->hue = av_expr_eval(hue->hue_pexpr, hue->var_values, NULL);
350  hue->hue_deg = hue->hue * 180 / M_PI;
351  }
352 
353  av_log(inlink->dst, AV_LOG_DEBUG,
354  "H:%0.1f*PI h:%0.1f s:%0.f b:%0.f t:%0.1f n:%d\n",
355  hue->hue/M_PI, hue->hue_deg, hue->saturation, hue->brightness,
356  hue->var_values[VAR_T], (int)hue->var_values[VAR_N]);
357 
358  compute_sin_and_cos(hue);
359  if (old_hue_sin != hue->hue_sin || old_hue_cos != hue->hue_cos)
360  create_chrominance_lut(hue, hue->hue_cos, hue->hue_sin);
361 
362  if (old_brightness != hue->brightness && hue->brightness)
363  create_luma_lut(hue);
364 
365  if (!direct) {
366  if (!hue->brightness)
367  av_image_copy_plane(outpic->data[0], outpic->linesize[0],
368  inpic->data[0], inpic->linesize[0],
369  inlink->w, inlink->h);
370  if (inpic->data[3])
371  av_image_copy_plane(outpic->data[3], outpic->linesize[3],
372  inpic->data[3], inpic->linesize[3],
373  inlink->w, inlink->h);
374  }
375 
376  apply_lut(hue, outpic->data[1], outpic->data[2], outpic->linesize[1],
377  inpic->data[1], inpic->data[2], inpic->linesize[1],
378  FF_CEIL_RSHIFT(inlink->w, hue->hsub),
379  FF_CEIL_RSHIFT(inlink->h, hue->vsub));
380  if (hue->brightness)
381  apply_luma_lut(hue, outpic->data[0], outpic->linesize[0],
382  inpic->data[0], inpic->linesize[0], inlink->w, inlink->h);
383 
384  if (!direct)
385  av_frame_free(&inpic);
386  return ff_filter_frame(outlink, outpic);
387 }
388 
389 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
390  char *res, int res_len, int flags)
391 {
392  HueContext *hue = ctx->priv;
393  int ret;
394 
395 #define SET_EXPR(expr, option) \
396  do { \
397  ret = set_expr(&hue->expr##_pexpr, &hue->expr##_expr, \
398  args, option, ctx); \
399  if (ret < 0) \
400  return ret; \
401  } while (0)
402 
403  if (!strcmp(cmd, "h")) {
404  SET_EXPR(hue_deg, "h");
405  av_freep(&hue->hue_expr);
406  } else if (!strcmp(cmd, "H")) {
407  SET_EXPR(hue, "H");
408  av_freep(&hue->hue_deg_expr);
409  } else if (!strcmp(cmd, "s")) {
410  SET_EXPR(saturation, "s");
411  } else if (!strcmp(cmd, "b")) {
412  SET_EXPR(brightness, "b");
413  } else
414  return AVERROR(ENOSYS);
415 
416  return 0;
417 }
418 
419 static const AVFilterPad hue_inputs[] = {
420  {
421  .name = "default",
422  .type = AVMEDIA_TYPE_VIDEO,
423  .filter_frame = filter_frame,
424  .config_props = config_props,
425  },
426  { NULL }
427 };
428 
429 static const AVFilterPad hue_outputs[] = {
430  {
431  .name = "default",
432  .type = AVMEDIA_TYPE_VIDEO,
433  },
434  { NULL }
435 };
436 
438  .name = "hue",
439  .description = NULL_IF_CONFIG_SMALL("Adjust the hue and saturation of the input video."),
440  .priv_size = sizeof(HueContext),
441  .init = init,
442  .uninit = uninit,
445  .inputs = hue_inputs,
446  .outputs = hue_outputs,
447  .priv_class = &hue_class,
449 };
float v
const char * s
Definition: avisynth_c.h:668
option
Definition: openal-dec.c:238
This structure describes decoded (raw) audio or video data.
Definition: frame.h:96
static double rint(double x)
Definition: libm.h:141
double var_values[VAR_NB]
Definition: vf_hue.c:78
AVOption.
Definition: opt.h:253
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition: eval.c:692
const char * name
Filter name.
Definition: avfilter.h:468
void * priv
private data for use by the filter
Definition: avfilter.h:648
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: avcodec.h:4153
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:111
char * av_strdup(const char *s) av_malloc_attrib
Duplicate the string s.
Definition: mem.c:256
uint8_t lut_u[256][256]
Definition: vf_hue.c:80
#define SAT_MAX_VAL
Definition: vf_hue.c:40
planar YUV 4:2:2, 16bpp, (1 Cr &amp; Cb sample per 2x1 Y samples)
Definition: avcodec.h:4538
int num
numerator
Definition: rational.h:44
const char * b
Definition: vf_curves.c:105
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
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.
Definition: eval.c:641
static int query_formats(AVFilterContext *ctx)
Definition: vf_hue.c:224
int32_t hue_sin
Definition: vf_hue.c:76
static void create_chrominance_lut(HueContext *h, const int32_t c, const int32_t s)
Definition: vf_hue.c:121
static const AVFilterPad hue_inputs[]
Definition: vf_hue.c:419
#define FLAGS
Definition: vf_hue.c:85
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:109
planar YUV 4:4:4 32bpp, (1 Cr &amp; Cb sample per 1x1 Y &amp; A samples)
Definition: avcodec.h:4693
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Definition: eval.c:303
Pixel format.
Definition: avcodec.h:4533
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:382
#define av_cold
Definition: avcodec.h:653
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:68
char * saturation_expr
Definition: vf_hue.c:69
uint8_t lut_v[256][256]
Definition: vf_hue.c:81
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Definition: mem.c:234
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:294
#define SET_EXPR(expr, option)
int hsub
Definition: vf_hue.c:74
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic &quot;enable&quot; expression option that can be used to enable or disable a fil...
Definition: avfilter.h:445
const char * name
Pad name.
Definition: internal.h:66
static uint8_t * res
Definition: ffhash.c:43
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1118
#define M_PI
Definition: mathematics.h:46
static void compute_sin_and_cos(HueContext *hue)
Definition: vf_hue.c:100
uint8_t
static av_always_inline av_const uint8_t av_clip_uint8_c(int a)
Clip a signed integer value into the 0-255 range.
Definition: common.h:132
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only &quot;metadata&quot; fields from src to dst.
Definition: frame.c:446
av_frame_free & inpic
Definition: vf_mcdeint.c:280
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:182
Definition: eval.c:141
#define FF_CEIL_RSHIFT(a, b)
Definition: avcodec.h:916
static double av_q2d(AVRational a)
Convert rational to double.
Definition: rational.h:69
float brightness
Definition: vf_hue.c:71
char * hue_deg_expr
Definition: vf_hue.c:64
planar YUV 4:2:2 24bpp, (1 Cr &amp; Cb sample per 2x1 Y &amp; A samples)
Definition: avcodec.h:4694
#define AV_LOG_VERBOSE
Detailed information.
Definition: avcodec.h:4163
planar YUV 4:2:0, 20bpp, (1 Cr &amp; Cb sample per 2x2 Y &amp; A samples)
Definition: avcodec.h:4571
void ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:531
float hue_deg
Definition: vf_hue.c:62
static void create_luma_lut(HueContext *h)
Definition: vf_hue.c:111
A filter pad used for either input or output.
Definition: internal.h:60
uint8_t lut_l[256]
Definition: vf_hue.c:79
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: vf_hue.c:389
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: avcodec.h:4147
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
Definition: mem.c:219
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:77
static av_cold int init(AVFilterContext *ctx)
Definition: vf_hue.c:181
#define SAT_MIN_VAL
Definition: vf_hue.c:39
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:151
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: avcodec.h:4168
AVExpr * saturation_pexpr
Definition: vf_hue.c:70
planar YUV 4:1:1, 12bpp, (1 Cr &amp; Cb sample per 4x1 Y samples)
Definition: avcodec.h:4541
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:123
float saturation
Definition: vf_hue.c:68
float hue
Definition: vf_hue.c:63
AVPixelFormat
Pixel format.
Definition: pixfmt.h:66
AVExpr * brightness_pexpr
Definition: vf_hue.c:73
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
Definition: vf_hue.c:298
AVFilter avfilter_vf_hue
Definition: vf_hue.c:437
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)
Definition: vf_hue.c:272
var_name
Definition: vf_hue.c:54
ret
Definition: avfilter.c:961
int32_t
float u
Main libavfilter public API header.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:1938
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:642
AVExpr * hue_pexpr
Definition: vf_hue.c:67
planar YUV 4:2:0, 12bpp, (1 Cr &amp; Cb sample per 2x2 Y samples)
Definition: avcodec.h:4534
#define TS2T(ts, tb)
Definition: vf_hue.c:296
planar YUV 4:4:0 (1 Cr &amp; Cb sample per 1x2 Y samples)
Definition: avcodec.h:4569
int32_t hue_cos
Definition: vf_hue.c:77
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_hue.c:214
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:57
AVExpr * hue_deg_pexpr
Definition: vf_hue.c:66
Describe the class of an AVClass context structure.
Definition: log.h:50
Filter definition.
Definition: avfilter.h:464
static const AVFilterPad inputs[]
Definition: af_ashowinfo.c:102
static int set_expr(AVExpr **pexpr_ptr, char **expr_ptr, const char *expr, const char *option, void *log_ctx)
Definition: vf_hue.c:152
planar YUV 4:4:4, 24bpp, (1 Cr &amp; Cb sample per 1x1 Y samples)
Definition: avcodec.h:4539
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:124
static const AVOption hue_options[]
Definition: vf_hue.c:86
static const AVFilterPad hue_outputs[]
Definition: vf_hue.c:429
static int flags
Definition: cpu.c:45
char * hue_expr
Definition: vf_hue.c:65
char * brightness_expr
Definition: vf_hue.c:72
static double c[64]
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)
Definition: vf_hue.c:256
int vsub
Definition: vf_hue.c:75
int den
denominator
Definition: rational.h:45
#define OFFSET(x)
Definition: vf_hue.c:84
#define NAN
Definition: math.h:28
#define AVFILTER_DEFINE_CLASS(fname)
Definition: internal.h:301
#define TS2D(ts)
Definition: vf_hue.c:295
#define AVERROR(e)
An instance of a filter.
Definition: avfilter.h:627
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.
Definition: imgutils.c:242
internal API functions
static int config_props(AVFilterLink *inlink)
Definition: vf_hue.c:240
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:107
static const char *const var_names[]
Definition: vf_hue.c:42
planar YUV 4:1:0, 9bpp, (1 Cr &amp; Cb sample per 4x4 Y samples)
Definition: avcodec.h:4540