FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavfilter/vf_hue.c
Date: 2024-02-16 17:37:06
Exec Total Coverage
Lines: 147 199 73.9%
Functions: 11 13 84.6%
Branches: 71 126 56.3%

Line Branch Exec Source
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 "internal.h"
36 #include "video.h"
37
38 #define SAT_MIN_VAL -10
39 #define SAT_MAX_VAL 10
40
41 static const char *const var_names[] = {
42 "n", // frame count
43 "pts", // presentation timestamp expressed in AV_TIME_BASE units
44 "r", // frame rate
45 "t", // timestamp expressed in seconds
46 "tb", // timebase
47 NULL
48 };
49
50 enum var_name {
51 VAR_N,
52 VAR_PTS,
53 VAR_R,
54 VAR_T,
55 VAR_TB,
56 VAR_NB
57 };
58
59 typedef struct HueContext {
60 const AVClass *class;
61 float hue_deg; /* hue expressed in degrees */
62 float hue; /* hue expressed in radians */
63 char *hue_deg_expr;
64 char *hue_expr;
65 AVExpr *hue_deg_pexpr;
66 AVExpr *hue_pexpr;
67 float saturation;
68 char *saturation_expr;
69 AVExpr *saturation_pexpr;
70 float brightness;
71 char *brightness_expr;
72 AVExpr *brightness_pexpr;
73 int hsub;
74 int vsub;
75 int is_first;
76 int32_t hue_sin;
77 int32_t hue_cos;
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 uint16_t lut_l16[65536];
83 uint16_t lut_u10[1024][1024];
84 uint16_t lut_v10[1024][1024];
85 } HueContext;
86
87 #define OFFSET(x) offsetof(HueContext, x)
88 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
89 static const AVOption hue_options[] = {
90 { "h", "set the hue angle degrees expression", OFFSET(hue_deg_expr), AV_OPT_TYPE_STRING,
91 { .str = NULL }, .flags = FLAGS },
92 { "s", "set the saturation expression", OFFSET(saturation_expr), AV_OPT_TYPE_STRING,
93 { .str = "1" }, .flags = FLAGS },
94 { "H", "set the hue angle radians expression", OFFSET(hue_expr), AV_OPT_TYPE_STRING,
95 { .str = NULL }, .flags = FLAGS },
96 { "b", "set the brightness expression", OFFSET(brightness_expr), AV_OPT_TYPE_STRING,
97 { .str = "0" }, .flags = FLAGS },
98 { NULL }
99 };
100
101 AVFILTER_DEFINE_CLASS(hue);
102
103 88 static inline void compute_sin_and_cos(HueContext *hue)
104 {
105 /*
106 * Scale the value to the norm of the resulting (U,V) vector, that is
107 * the saturation.
108 * This will be useful in the apply_lut function.
109 */
110 88 hue->hue_sin = lrint(sin(hue->hue) * (1 << 16) * hue->saturation);
111 88 hue->hue_cos = lrint(cos(hue->hue) * (1 << 16) * hue->saturation);
112 88 }
113
114 22 static inline void create_luma_lut(HueContext *h)
115 {
116 22 const float b = h->brightness;
117 int i;
118
119
2/2
✓ Branch 0 taken 5632 times.
✓ Branch 1 taken 22 times.
5654 for (i = 0; i < 256; i++) {
120 5632 h->lut_l[i] = av_clip_uint8(i + b * 25.5);
121 }
122
2/2
✓ Branch 0 taken 1441792 times.
✓ Branch 1 taken 22 times.
1441814 for (i = 0; i < 65536; i++) {
123 1441792 h->lut_l16[i] = av_clip_uintp2(i + b * 102.4, 10);
124 }
125 22 }
126
127 61 static inline void create_chrominance_lut(HueContext *h, const int32_t c,
128 const int32_t s)
129 {
130 int32_t i, j, u, v, new_u, new_v;
131
132 /*
133 * If we consider U and V as the components of a 2D vector then its angle
134 * is the hue and the norm is the saturation
135 */
136
2/2
✓ Branch 0 taken 15616 times.
✓ Branch 1 taken 61 times.
15677 for (i = 0; i < 256; i++) {
137
2/2
✓ Branch 0 taken 3997696 times.
✓ Branch 1 taken 15616 times.
4013312 for (j = 0; j < 256; j++) {
138 /* Normalize the components from range [16;240] to [-112;112] */
139 3997696 u = i - 128;
140 3997696 v = j - 128;
141 /*
142 * Apply the rotation of the vector : (c * u) - (s * v)
143 * (s * u) + (c * v)
144 * De-normalize the components (without forgetting to scale 128
145 * by << 16)
146 * Finally scale back the result by >> 16
147 */
148 3997696 new_u = ((c * u) - (s * v) + (1 << 15) + (128 << 16)) >> 16;
149 3997696 new_v = ((s * u) + (c * v) + (1 << 15) + (128 << 16)) >> 16;
150
151 /* Prevent a potential overflow */
152 3997696 h->lut_u[i][j] = av_clip_uint8(new_u);
153 3997696 h->lut_v[i][j] = av_clip_uint8(new_v);
154 }
155 }
156
2/2
✓ Branch 0 taken 62464 times.
✓ Branch 1 taken 61 times.
62525 for (i = 0; i < 1024; i++) {
157
2/2
✓ Branch 0 taken 63963136 times.
✓ Branch 1 taken 62464 times.
64025600 for (j = 0; j < 1024; j++) {
158 63963136 u = i - 512;
159 63963136 v = j - 512;
160 /*
161 * Apply the rotation of the vector : (c * u) - (s * v)
162 * (s * u) + (c * v)
163 * De-normalize the components (without forgetting to scale 512
164 * by << 16)
165 * Finally scale back the result by >> 16
166 */
167 63963136 new_u = ((c * u) - (s * v) + (1 << 15) + (512 << 16)) >> 16;
168 63963136 new_v = ((s * u) + (c * v) + (1 << 15) + (512 << 16)) >> 16;
169
170 /* Prevent a potential overflow */
171 63963136 h->lut_u10[i][j] = av_clip_uintp2(new_u, 10);
172 63963136 h->lut_v10[i][j] = av_clip_uintp2(new_v, 10);
173 }
174 }
175 61 }
176
177 20 static int set_expr(AVExpr **pexpr_ptr, char **expr_ptr,
178 const char *expr, const char *option, void *log_ctx)
179 {
180 int ret;
181 AVExpr *new_pexpr;
182 char *new_expr;
183
184 20 new_expr = av_strdup(expr);
185
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
20 if (!new_expr)
186 return AVERROR(ENOMEM);
187 20 ret = av_expr_parse(&new_pexpr, expr, var_names,
188 NULL, NULL, NULL, NULL, 0, log_ctx);
189
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
20 if (ret < 0) {
190 av_log(log_ctx, AV_LOG_ERROR,
191 "Error when evaluating the expression '%s' for %s\n",
192 expr, option);
193 av_free(new_expr);
194 return ret;
195 }
196
197
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
20 if (*pexpr_ptr)
198 av_expr_free(*pexpr_ptr);
199 20 *pexpr_ptr = new_pexpr;
200 20 av_freep(expr_ptr);
201 20 *expr_ptr = new_expr;
202
203 20 return 0;
204 }
205
206 8 static av_cold int init(AVFilterContext *ctx)
207 {
208 8 HueContext *hue = ctx->priv;
209 int ret;
210
211
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
8 if (hue->hue_expr && hue->hue_deg_expr) {
212 av_log(ctx, AV_LOG_ERROR,
213 "H and h options are incompatible and cannot be specified "
214 "at the same time\n");
215 return AVERROR(EINVAL);
216 }
217
218 #define SET_EXPR(expr, option) \
219 if (hue->expr##_expr) do { \
220 ret = set_expr(&hue->expr##_pexpr, &hue->expr##_expr, \
221 hue->expr##_expr, option, ctx); \
222 if (ret < 0) \
223 return ret; \
224 } while (0)
225
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
8 SET_EXPR(brightness, "b");
226
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
8 SET_EXPR(saturation, "s");
227
3/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
8 SET_EXPR(hue_deg, "h");
228
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
8 SET_EXPR(hue, "H");
229 #undef SET_EXPR
230
231 8 av_log(ctx, AV_LOG_VERBOSE,
232 "H_expr:%s h_deg_expr:%s s_expr:%s b_expr:%s\n",
233 hue->hue_expr, hue->hue_deg_expr, hue->saturation_expr, hue->brightness_expr);
234 8 compute_sin_and_cos(hue);
235 8 hue->is_first = 1;
236
237 8 return 0;
238 }
239
240 8 static av_cold void uninit(AVFilterContext *ctx)
241 {
242 8 HueContext *hue = ctx->priv;
243
244 8 av_expr_free(hue->brightness_pexpr);
245 8 av_expr_free(hue->hue_deg_pexpr);
246 8 av_expr_free(hue->hue_pexpr);
247 8 av_expr_free(hue->saturation_pexpr);
248 8 }
249
250 static const enum AVPixelFormat pix_fmts[] = {
251 AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P,
252 AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV411P,
253 AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV440P,
254 AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P,
255 AV_PIX_FMT_YUVA420P,
256 AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV422P10,
257 AV_PIX_FMT_YUV420P10,
258 AV_PIX_FMT_YUV440P10,
259 AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA422P10,
260 AV_PIX_FMT_YUVA420P10,
261 AV_PIX_FMT_NONE
262 };
263
264 4 static int config_props(AVFilterLink *inlink)
265 {
266 4 HueContext *hue = inlink->dst->priv;
267 4 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
268
269 4 hue->hsub = desc->log2_chroma_w;
270 4 hue->vsub = desc->log2_chroma_h;
271
272 4 hue->var_values[VAR_N] = 0;
273 4 hue->var_values[VAR_TB] = av_q2d(inlink->time_base);
274
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 hue->var_values[VAR_R] = inlink->frame_rate.num == 0 || inlink->frame_rate.den == 0 ?
275
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
8 NAN : av_q2d(inlink->frame_rate);
276
277 4 return 0;
278 }
279
280 19 static void apply_luma_lut(HueContext *s,
281 uint8_t *ldst, const int dst_linesize,
282 uint8_t *lsrc, const int src_linesize,
283 int w, int h)
284 {
285 int i;
286
287
2/2
✓ Branch 0 taken 5472 times.
✓ Branch 1 taken 19 times.
5491 while (h--) {
288
2/2
✓ Branch 0 taken 1926144 times.
✓ Branch 1 taken 5472 times.
1931616 for (i = 0; i < w; i++)
289 1926144 ldst[i] = s->lut_l[lsrc[i]];
290
291 5472 lsrc += src_linesize;
292 5472 ldst += dst_linesize;
293 }
294 19 }
295
296 static void apply_luma_lut10(HueContext *s,
297 uint16_t *ldst, const int dst_linesize,
298 uint16_t *lsrc, const int src_linesize,
299 int w, int h)
300 {
301 int i;
302
303 while (h--) {
304 for (i = 0; i < w; i++)
305 ldst[i] = s->lut_l16[lsrc[i]];
306
307 lsrc += src_linesize;
308 ldst += dst_linesize;
309 }
310 }
311
312 60 static void apply_lut(HueContext *s,
313 uint8_t *udst, uint8_t *vdst, const int dst_linesize,
314 uint8_t *usrc, uint8_t *vsrc, const int src_linesize,
315 int w, int h)
316 {
317 int i;
318
319
2/2
✓ Branch 0 taken 8640 times.
✓ Branch 1 taken 60 times.
8700 while (h--) {
320
2/2
✓ Branch 0 taken 1520640 times.
✓ Branch 1 taken 8640 times.
1529280 for (i = 0; i < w; i++) {
321 1520640 const int u = usrc[i];
322 1520640 const int v = vsrc[i];
323
324 1520640 udst[i] = s->lut_u[u][v];
325 1520640 vdst[i] = s->lut_v[u][v];
326 }
327
328 8640 usrc += src_linesize;
329 8640 vsrc += src_linesize;
330 8640 udst += dst_linesize;
331 8640 vdst += dst_linesize;
332 }
333 60 }
334
335 20 static void apply_lut10(HueContext *s,
336 uint16_t *udst, uint16_t *vdst, const int dst_linesize,
337 uint16_t *usrc, uint16_t *vsrc, const int src_linesize,
338 int w, int h)
339 {
340 int i;
341
342
2/2
✓ Branch 0 taken 5760 times.
✓ Branch 1 taken 20 times.
5780 while (h--) {
343
2/2
✓ Branch 0 taken 1013760 times.
✓ Branch 1 taken 5760 times.
1019520 for (i = 0; i < w; i++) {
344 1013760 const int u = av_clip_uintp2(usrc[i], 10);
345 1013760 const int v = av_clip_uintp2(vsrc[i], 10);
346
347 1013760 udst[i] = s->lut_u10[u][v];
348 1013760 vdst[i] = s->lut_v10[u][v];
349 }
350
351 5760 usrc += src_linesize;
352 5760 vsrc += src_linesize;
353 5760 udst += dst_linesize;
354 5760 vdst += dst_linesize;
355 }
356 20 }
357
358 80 static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
359 {
360 80 HueContext *hue = inlink->dst->priv;
361 80 AVFilterLink *outlink = inlink->dst->outputs[0];
362 AVFrame *outpic;
363 80 const int32_t old_hue_sin = hue->hue_sin, old_hue_cos = hue->hue_cos;
364 80 const float old_brightness = hue->brightness;
365 80 int direct = 0;
366 80 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
367
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 60 times.
80 const int bps = desc->comp[0].depth > 8 ? 2 : 1;
368
369
1/2
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
80 if (av_frame_is_writable(inpic)) {
370 80 direct = 1;
371 80 outpic = inpic;
372 } else {
373 outpic = ff_get_video_buffer(outlink, outlink->w, outlink->h);
374 if (!outpic) {
375 av_frame_free(&inpic);
376 return AVERROR(ENOMEM);
377 }
378 av_frame_copy_props(outpic, inpic);
379 }
380
381 80 hue->var_values[VAR_N] = inlink->frame_count_out;
382
1/2
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
80 hue->var_values[VAR_T] = TS2T(inpic->pts, inlink->time_base);
383
1/2
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
80 hue->var_values[VAR_PTS] = TS2D(inpic->pts);
384
385
1/2
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
80 if (hue->saturation_expr) {
386 80 hue->saturation = av_expr_eval(hue->saturation_pexpr, hue->var_values, NULL);
387
388
2/4
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 80 times.
80 if (hue->saturation < SAT_MIN_VAL || hue->saturation > SAT_MAX_VAL) {
389 hue->saturation = av_clip(hue->saturation, SAT_MIN_VAL, SAT_MAX_VAL);
390 av_log(inlink->dst, AV_LOG_WARNING,
391 "Saturation value not in range [%d,%d]: clipping value to %0.1f\n",
392 SAT_MIN_VAL, SAT_MAX_VAL, hue->saturation);
393 }
394 }
395
396
1/2
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
80 if (hue->brightness_expr) {
397 80 hue->brightness = av_expr_eval(hue->brightness_pexpr, hue->var_values, NULL);
398
399
2/4
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 80 times.
80 if (hue->brightness < -10 || hue->brightness > 10) {
400 hue->brightness = av_clipf(hue->brightness, -10, 10);
401 av_log(inlink->dst, AV_LOG_WARNING,
402 "Brightness value not in range [%d,%d]: clipping value to %0.1f\n",
403 -10, 10, hue->brightness);
404 }
405 }
406
407
2/2
✓ Branch 0 taken 40 times.
✓ Branch 1 taken 40 times.
80 if (hue->hue_deg_expr) {
408 40 hue->hue_deg = av_expr_eval(hue->hue_deg_pexpr, hue->var_values, NULL);
409 40 hue->hue = hue->hue_deg * M_PI / 180;
410
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
40 } else if (hue->hue_expr) {
411 hue->hue = av_expr_eval(hue->hue_pexpr, hue->var_values, NULL);
412 hue->hue_deg = hue->hue * 180 / M_PI;
413 }
414
415 80 av_log(inlink->dst, AV_LOG_DEBUG,
416 "H:%0.1f*PI h:%0.1f s:%0.1f b:%0.f t:%0.1f n:%d\n",
417 80 hue->hue/M_PI, hue->hue_deg, hue->saturation, hue->brightness,
418 80 hue->var_values[VAR_T], (int)hue->var_values[VAR_N]);
419
420 80 compute_sin_and_cos(hue);
421
6/6
✓ Branch 0 taken 76 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 38 times.
✓ Branch 4 taken 19 times.
✓ Branch 5 taken 19 times.
80 if (hue->is_first || (old_hue_sin != hue->hue_sin || old_hue_cos != hue->hue_cos))
422 61 create_chrominance_lut(hue, hue->hue_cos, hue->hue_sin);
423
424
6/6
✓ Branch 0 taken 76 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 19 times.
✓ Branch 3 taken 57 times.
✓ Branch 4 taken 18 times.
✓ Branch 5 taken 1 times.
80 if (hue->is_first || (old_brightness != hue->brightness && hue->brightness))
425 22 create_luma_lut(hue);
426
427
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 80 times.
80 if (!direct) {
428 if (!hue->brightness)
429 av_image_copy_plane(outpic->data[0], outpic->linesize[0],
430 inpic->data[0], inpic->linesize[0],
431 inlink->w * bps, inlink->h);
432 if (inpic->data[3])
433 av_image_copy_plane(outpic->data[3], outpic->linesize[3],
434 inpic->data[3], inpic->linesize[3],
435 inlink->w * bps, inlink->h);
436 }
437
438
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 60 times.
80 if (bps > 1) {
439 20 apply_lut10(hue, (uint16_t*)outpic->data[1], (uint16_t*)outpic->data[2], outpic->linesize[1]/2,
440 20 (uint16_t*) inpic->data[1], (uint16_t*) inpic->data[2], inpic->linesize[1]/2,
441 20 AV_CEIL_RSHIFT(inlink->w, hue->hsub),
442 20 AV_CEIL_RSHIFT(inlink->h, hue->vsub));
443
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
20 if (hue->brightness)
444 apply_luma_lut10(hue, (uint16_t*)outpic->data[0], outpic->linesize[0]/2,
445 (uint16_t*) inpic->data[0], inpic->linesize[0]/2, inlink->w, inlink->h);
446 } else {
447 60 apply_lut(hue, outpic->data[1], outpic->data[2], outpic->linesize[1],
448 60 inpic->data[1], inpic->data[2], inpic->linesize[1],
449 60 AV_CEIL_RSHIFT(inlink->w, hue->hsub),
450 60 AV_CEIL_RSHIFT(inlink->h, hue->vsub));
451
2/2
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 41 times.
60 if (hue->brightness)
452 19 apply_luma_lut(hue, outpic->data[0], outpic->linesize[0],
453 19 inpic->data[0], inpic->linesize[0], inlink->w, inlink->h);
454 }
455
456
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 80 times.
80 if (!direct)
457 av_frame_free(&inpic);
458
459 80 hue->is_first = 0;
460 80 return ff_filter_frame(outlink, outpic);
461 }
462
463 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
464 char *res, int res_len, int flags)
465 {
466 HueContext *hue = ctx->priv;
467 int ret;
468
469 #define SET_EXPR(expr, option) \
470 do { \
471 ret = set_expr(&hue->expr##_pexpr, &hue->expr##_expr, \
472 args, option, ctx); \
473 if (ret < 0) \
474 return ret; \
475 } while (0)
476
477 if (!strcmp(cmd, "h")) {
478 SET_EXPR(hue_deg, "h");
479 av_freep(&hue->hue_expr);
480 } else if (!strcmp(cmd, "H")) {
481 SET_EXPR(hue, "H");
482 av_freep(&hue->hue_deg_expr);
483 } else if (!strcmp(cmd, "s")) {
484 SET_EXPR(saturation, "s");
485 } else if (!strcmp(cmd, "b")) {
486 SET_EXPR(brightness, "b");
487 } else
488 return AVERROR(ENOSYS);
489
490 return 0;
491 }
492
493 static const AVFilterPad hue_inputs[] = {
494 {
495 .name = "default",
496 .type = AVMEDIA_TYPE_VIDEO,
497 .filter_frame = filter_frame,
498 .config_props = config_props,
499 },
500 };
501
502 const AVFilter ff_vf_hue = {
503 .name = "hue",
504 .description = NULL_IF_CONFIG_SMALL("Adjust the hue and saturation of the input video."),
505 .priv_size = sizeof(HueContext),
506 .init = init,
507 .uninit = uninit,
508 .process_command = process_command,
509 FILTER_INPUTS(hue_inputs),
510 FILTER_OUTPUTS(ff_video_default_filterpad),
511 FILTER_PIXFMTS_ARRAY(pix_fmts),
512 .priv_class = &hue_class,
513 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
514 };
515