FFmpeg
vf_pseudocolor.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Paul B Mahol
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "libavutil/attributes.h"
22 #include "libavutil/common.h"
23 #include "libavutil/eval.h"
24 #include "libavutil/imgutils.h"
25 #include "libavutil/opt.h"
26 #include "libavutil/pixdesc.h"
27 #include "avfilter.h"
28 #include "internal.h"
29 #include "video.h"
30 
31 static const char *const var_names[] = {
32  "w", ///< width of the input video
33  "h", ///< height of the input video
34  "val", ///< input value for the pixel
35  "ymin",
36  "umin",
37  "vmin",
38  "amin",
39  "ymax",
40  "umax",
41  "vmax",
42  "amax",
43  NULL
44 };
45 
46 enum var_name {
59 };
60 
61 enum Curves {
77 };
78 
79 enum Presets {
102 };
103 
104 typedef double (*curve_fun)(double x);
105 
106 typedef struct Curve {
107  double coef[3][8];
108  double offset[3];
110  int yuv;
111 } Curve;
112 
113 typedef struct Fill {
114  float fill[4];
115 } Fill;
116 
117 typedef struct Range {
119 } Range;
120 
121 typedef struct Preset {
123  const Range *ranges;
124  const Curve *curves;
125  const Fill *fills;
126 } Preset;
127 
128 static const Range full_range = {{0, 1}, {1, 1}};
129 static const Range nominal_range[] = {{{0, 1}, {4096, 65536}}, {{4096, 65536}, {60161, 65536}}, {{60161, 65536}, {1, 1}}};
130 static const Range preferred_range[] = {{{0, 1}, {1280, 65536}}, {{1280, 65536}, {62977, 65536}}, {{62977, 65536}, {1, 1}}};
131 static const Range total_range[] = {{{0, 1}, {256, 65536}}, {{256, 65536}, {65280, 65536}}, {{65280, 65536}, {1, 1}}};
132 static const Range spec1_range[] = {{{0, 1}, {16, 256}}, {{16, 256}, {236, 256}}, {{236, 256}, {256, 256}}};
133 static const Range spec2_range[] = {{{0, 1}, {16, 256}}, {{16, 256}, {22, 256}}, {{22, 256}, {226, 256}}, {{226, 256}, {236, 256}}, {{236, 256}, {256, 256}}};
134 static const Range shadows_range[] = {{{0, 1}, {32, 256}}, {{32, 256}, {256, 256}}};
135 static const Range highlights_range[] = {{{0,1}, {214,256}}, {{214, 256}, {224, 256}}, {{224, 256}, {256, 256}}};
136 
137 static const Fill spec1_fills[] = {{{0.5f, 0.f, .5f, 1.f}}, {{-1.f, -1.f, -1.f, 1.f}}, {{1.f, 0.f, 0.f, 1.f}}};
138 static const Fill spec2_fills[] = {{{0.5f, 0.f, .5f, 1.f}}, {{0.f, 1.f, 1.f, 1.f}}, {{-1.f, -1.f, -1.f, 1.f}}, {{1.f, 1.f, 0.f, 1.f}}, {{1.f, 0.f, 0.f, 1.f}}};
139 static const Fill shadows_fills[] = {{{0.8f, 0.4f, .8f, 1.f}}, {{-1.f, -1.f, -1.f, 1.f}}};
140 static const Fill highlights_fills[] = {{{-1.f, -1.f, -1.f, 1.f}}, {{1.f, 0.3f, 0.6f, 1.f}}, {{1.f, 0.2f, .5f, 1.f}}};
141 
142 static double limit(double x)
143 {
144  return av_clipd(x, 0., 1.);
145 }
146 
147 static double solarfun(double x)
148 {
149  return 0.5 * sin(x) + 0.5;
150 }
151 
152 static double coolfunu(double x)
153 {
154  return 0.25 * sin(2.0 * x * M_PI - M_PI) + 0.5;
155 }
156 
157 static double coolfunv(double x)
158 {
159  return 0.25 * sin(2.0 * x * M_PI) + 0.5;
160 }
161 
162 static double heatfunu(double x)
163 {
164  return 0.25 * cos(2.0 * x * M_PI + M_PI) + 0.75;
165 }
166 
167 static double heatfunv(double x)
168 {
169  return 0.25 * sin(2.0 * x * M_PI) + 0.5;
170 }
171 
172 static double fieryfunu(double x)
173 {
174  return 0.75 - 0.25 * cos(2.0 * x * M_PI);
175 }
176 
177 static double fieryfunv(double x)
178 {
179  return 0.25 + 0.25 * cos(2.0 * x * M_PI);
180 }
181 
182 static double helixfunu(double x)
183 {
184  return 0.5 + 0.15 * sin(5.0 * x * M_PI + M_PI);
185 }
186 
187 static double helixfunv(double x)
188 {
189  return 0.5 + 0.15 * cos(6.0 * x * M_PI + M_PI_2);
190 }
191 
192 static const Curve curves[] =
193 {
194  [MAGMA] = {{
195  {-7.5631093e-16, 7.4289183e-13, -2.8525484e-10, 5.4446085e-08, -5.5596238e-06, 3.0569325e-04, -2.3137421e-03, 1.2152095e-02 },
196  { 1.3217636e-15, -1.2214648e-12, 4.4319712e-10, -8.0197993e-08, 7.6598370e-06, -3.6523704e-04, 8.4836670e-03, -2.5536888e-02 },
197  {-1.1446568e-15, 1.0013446e-12, -3.5651575e-10, 6.6775016e-08, -6.7120346e-06, 2.7346619e-04, 4.7969657e-03, 1.1971441e-02 },
198  }, .fun = { limit, limit, limit }, },
199  [INFERNO] = {{
200  {-3.9848859e-18, 9.4821649e-14, -6.7371977e-11, 1.8469937e-08, -2.5359307e-06, 1.7959053e-04, 3.9782564e-04, 2.8845935e-04 },
201  { 6.8408539e-16, -6.5499979e-13, 2.4562526e-10, -4.5989298e-08, 4.5723324e-06, -2.2111913e-04, 5.2023164e-03, -1.1226064e-02 },
202  {-2.9921470e-15, 2.5864165e-12, -8.7403799e-10, 1.4713388e-07, -1.2701505e-05, 4.5159935e-04, 3.1087989e-03, 1.9122831e-02 },
203  }, .fun = { limit, limit, limit }, },
204  [PLASMA] = {{
205  { 3.6196089e-16, -3.3623041e-13, 1.2324010e-10, -2.2769060e-08, 2.2297792e-06, -1.2567829e-04, 9.9791629e-03, 5.7247918e-02 },
206  { 5.0262888e-16, -5.3193896e-13, 2.2451715e-10, -4.7529623e-08, 5.1374873e-06, -2.3260136e-04, 3.1502825e-03, 1.5362491e-02 },
207  {-1.7782261e-16, 2.2487839e-13, -1.0610236e-10, 2.4112644e-08, -2.6331623e-06, 8.9499751e-05, 2.1386328e-03, 5.3824268e-01 },
208  }, .fun = { limit, limit, limit }, },
209  [VIRIDIS] = {{
210  { 9.4850045e-16, -8.6629383e-13, 3.0310944e-10, -5.1340396e-08, 4.6024275e-06, -2.2744239e-04, 4.5559993e-03, 2.5662350e-01 },
211  { 9.6461041e-17, -6.9209477e-14, 1.7625397e-11, -2.0229773e-09, 1.4900110e-07, -1.9315187e-05, 5.8967339e-03, 3.9544827e-03 },
212  { 5.1785449e-16, -3.6663004e-13, 1.0249990e-10, -1.5431998e-08, 1.5007941e-06, -1.2001502e-04, 7.6951526e-03, 3.2292815e-01 },
213  }, .fun = { limit, limit, limit }, },
214  [TURBO] = {{
215  {-4.3683890e-15, 3.7020347e-12, -1.1712592e-09, 1.6401790e-07, -8.6842919e-06, -1.8542465e-06, 8.4485325e-03, 1.6267077e-01 },
216  {-4.0011069e-16, 2.7861423e-13, -6.3388921e-11, 5.8872238e-09, -5.4466522e-07, 1.8037114e-05, 1.0599869e-02, 7.6914696e-02 },
217  {-2.8242609e-15, 2.9234108e-12, -1.1726546e-09, 2.2552115e-07, -2.0059387e-05, 5.0595552e-04, 1.7714932e-02, 2.7271836e-01 },
218  }, .fun = { limit, limit, limit }, },
219  [CIVIDIS] = {{
220  {-9.5484131e-16, 9.6988184e-13, -4.0058766e-10, 8.5743924e-08, -9.9644797e-06, 5.9197908e-04, -1.0361579e-02, 3.3164429e-02 },
221  { 1.2731941e-17, -9.4238449e-15, 2.2808841e-12, -1.1548296e-10, -2.3888913e-08, 3.8986680e-06, 2.5879330e-03, 1.2769733e-01 },
222  { 4.6004608e-16, -5.0686849e-13, 2.2753449e-10, -5.3074099e-08, 6.7196096e-06, -4.4120020e-04, 1.3435551e-02, 2.8293355e-01 },
223  }, .fun = { limit, limit, limit }, },
224  [SOLAR] = {{
225  { 0, 0, 0, 0, 0.000001983938313, -0.0007618323, 0.2, -M_PI_2 },
226  { 0, 0, 0, 0, 0.000001983938313, -0.0007618323, 0.2, -M_PI_2 },
227  { 0, 0, 0, 0, 0.000001983938313, -0.0007618323, 0.2, -M_PI_2 },
228  },
229  .offset = { 0., -9., 9. },
230  .fun = { solarfun, solarfun, solarfun }, },
231  [SPECTRAL] = {{
232  { -1.6820e-15, 1.4982e-12, -5.0442e-10, 8.0490e-08, -6.1903e-06, 1.5821e-04, 6.4359e-03, 6.2887e-01 },
233  { 1.2526e-15, -1.2203e-12, 4.7013e-10, -8.9360e-08, 8.3839e-06, -3.6642e-04, 1.4784e-02, -9.8075e-03 },
234  { 1.4755e-15, -1.6765e-12, 7.3188e-10, -1.5522e-07, 1.6406e-05, -7.7883e-04, 1.4502e-02, 2.1597e-01 },
235  }, .fun = { limit, limit, limit }, },
236  [COOL] = {{
237  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
238  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
239  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
240  },
241  .offset = { 0., 0., 0 },
242  .yuv = 1,
243  .fun = { coolfunu, limit, coolfunv }, },
244  [HEAT] = {{
245  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
246  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
247  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
248  },
249  .offset = { 0., 0., 0 },
250  .yuv = 1,
251  .fun = { heatfunu, limit, heatfunv }, },
252  [FIERY] = {{
253  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
254  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
255  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
256  },
257  .offset = { 0., 0., 0 },
258  .yuv = 1,
259  .fun = { fieryfunu, limit, fieryfunv }, },
260  [BLUES] = {{
261  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
262  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
263  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
264  },
265  .offset = { 0., 0., 0 },
266  .yuv = 1,
267  .fun = { fieryfunv, limit, fieryfunu }, },
268  [GREEN] = {{
269  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
270  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
271  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
272  },
273  .offset = { 0., 0., 0 },
274  .yuv = 1,
275  .fun = { fieryfunv, limit, fieryfunv }, },
276  [HELIX] = {{
277  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
278  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
279  { 0, 0, 0, 0, 0, 0, 1./256, 0 },
280  },
281  .offset = { 0., 0., 0 },
282  .yuv = 1,
283  .fun = { helixfunu, limit, helixfunv }, },
284 };
285 
286 static const Preset presets[] =
287 {
288  [PRESET_MAGMA] = { 1, &full_range, &curves[MAGMA], NULL },
289  [PRESET_INFERNO] = { 1, &full_range, &curves[INFERNO], NULL },
290  [PRESET_PLASMA] = { 1, &full_range, &curves[PLASMA], NULL },
291  [PRESET_VIRIDIS] = { 1, &full_range, &curves[VIRIDIS], NULL },
292  [PRESET_TURBO] = { 1, &full_range, &curves[TURBO], NULL },
293  [PRESET_CIVIDIS] = { 1, &full_range, &curves[CIVIDIS], NULL },
301  [PRESET_SOLAR] = { 1, &full_range, &curves[SOLAR], NULL },
303  [PRESET_COOL] = { 1, &full_range, &curves[COOL], NULL },
304  [PRESET_HEAT] = { 1, &full_range, &curves[HEAT], NULL },
305  [PRESET_FIERY] = { 1, &full_range, &curves[FIERY], NULL },
306  [PRESET_BLUES] = { 1, &full_range, &curves[BLUES], NULL },
307  [PRESET_GREEN] = { 1, &full_range, &curves[GREEN], NULL },
308  [PRESET_HELIX] = { 1, &full_range, &curves[HELIX], NULL },
309 };
310 
311 typedef struct PseudoColorContext {
312  const AVClass *class;
313  int preset;
314  float opacity;
315  int max;
316  int index;
318  int color;
319  int linesize[4];
320  int width[4], height[4];
322  char *comp_expr_str[4];
324  float lut[4][256*256];
325 
326  void (*filter[4])(int max, int width, int height,
327  const uint8_t *index, const uint8_t *src,
328  uint8_t *dst,
329  ptrdiff_t ilinesize,
330  ptrdiff_t slinesize,
331  ptrdiff_t dlinesize,
332  float *lut,
333  float opacity);
335 
336 #define OFFSET(x) offsetof(PseudoColorContext, x)
337 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
338 
339 static const AVOption pseudocolor_options[] = {
340  { "c0", "set component #0 expression", OFFSET(comp_expr_str[0]), AV_OPT_TYPE_STRING, {.str="val"}, .flags = FLAGS },
341  { "c1", "set component #1 expression", OFFSET(comp_expr_str[1]), AV_OPT_TYPE_STRING, {.str="val"}, .flags = FLAGS },
342  { "c2", "set component #2 expression", OFFSET(comp_expr_str[2]), AV_OPT_TYPE_STRING, {.str="val"}, .flags = FLAGS },
343  { "c3", "set component #3 expression", OFFSET(comp_expr_str[3]), AV_OPT_TYPE_STRING, {.str="val"}, .flags = FLAGS },
344  { "index", "set component as base", OFFSET(index), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, .flags = FLAGS },
345  { "i", "set component as base", OFFSET(index), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, .flags = FLAGS },
346  { "preset", "set preset", OFFSET(preset), AV_OPT_TYPE_INT, {.i64=-1},-1, NB_PRESETS-1, .flags = FLAGS, .unit = "preset" },
347  { "p", "set preset", OFFSET(preset), AV_OPT_TYPE_INT, {.i64=-1},-1, NB_PRESETS-1, .flags = FLAGS, .unit = "preset" },
348  { "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64=-1}, .flags = FLAGS, .unit = "preset" },
349  { "magma", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_MAGMA}, .flags = FLAGS, .unit = "preset" },
350  { "inferno", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_INFERNO}, .flags = FLAGS, .unit = "preset" },
351  { "plasma", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_PLASMA}, .flags = FLAGS, .unit = "preset" },
352  { "viridis", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_VIRIDIS}, .flags = FLAGS, .unit = "preset" },
353  { "turbo", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_TURBO}, .flags = FLAGS, .unit = "preset" },
354  { "cividis", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_CIVIDIS}, .flags = FLAGS, .unit = "preset" },
355  { "range1", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_RANGE1}, .flags = FLAGS, .unit = "preset" },
356  { "range2", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_RANGE2}, .flags = FLAGS, .unit = "preset" },
357  { "shadows", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_SHADOWS}, .flags = FLAGS, .unit = "preset" },
358  { "highlights", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_HIGHLIGHTS},.flags=FLAGS, .unit = "preset" },
359  { "solar", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_SOLAR}, .flags=FLAGS, .unit = "preset" },
360  { "nominal", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_NOMINAL}, .flags=FLAGS, .unit = "preset" },
361  { "preferred", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_PREFERRED},.flags=FLAGS, .unit = "preset" },
362  { "total", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_TOTAL}, .flags=FLAGS, .unit = "preset" },
363  { "spectral", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_SPECTRAL},.flags = FLAGS, .unit = "preset" },
364  { "cool", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_COOL}, .flags = FLAGS, .unit = "preset" },
365  { "heat", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_HEAT}, .flags = FLAGS, .unit = "preset" },
366  { "fiery", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_FIERY}, .flags = FLAGS, .unit = "preset" },
367  { "blues", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_BLUES}, .flags = FLAGS, .unit = "preset" },
368  { "green", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_GREEN}, .flags = FLAGS, .unit = "preset" },
369  { "helix", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_HELIX}, .flags = FLAGS, .unit = "preset" },
370  { "opacity", "set pseudocolor opacity",OFFSET(opacity), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 1, .flags = FLAGS },
371  { NULL }
372 };
373 
374 static const enum AVPixelFormat pix_fmts[] = {
401 };
402 
403 static inline float lerpf(float v0, float v1, float f)
404 {
405  return v0 + (v1 - v0) * f;
406 }
407 
408 #define PCLIP(v, max, dst, src, x) \
409  if (v >= 0 && v <= max) { \
410  dst[x] = lerpf(src[x], v, opacity);\
411  } else { \
412  dst[x] = src[x]; \
413  }
414 
415 static void pseudocolor_filter(int max, int width, int height,
416  const uint8_t *index,
417  const uint8_t *src,
418  uint8_t *dst,
419  ptrdiff_t ilinesize,
420  ptrdiff_t slinesize,
421  ptrdiff_t dlinesize,
422  float *lut,
423  float opacity)
424 {
425  int x, y;
426 
427  for (y = 0; y < height; y++) {
428  for (x = 0; x < width; x++) {
429  int v = lut[index[x]];
430 
431  PCLIP(v, max, dst, src, x);
432  }
433  index += ilinesize;
434  src += slinesize;
435  dst += dlinesize;
436  }
437 }
438 
439 static void pseudocolor_filter_11(int max, int width, int height,
440  const uint8_t *index,
441  const uint8_t *src,
442  uint8_t *dst,
443  ptrdiff_t ilinesize,
444  ptrdiff_t slinesize,
445  ptrdiff_t dlinesize,
446  float *lut,
447  float opacity)
448 {
449  int x, y;
450 
451  for (y = 0; y < height; y++) {
452  for (x = 0; x < width; x++) {
453  int v = lut[index[(y << 1) * ilinesize + (x << 1)]];
454 
455  PCLIP(v, max, dst, src, x);
456  }
457  src += slinesize;
458  dst += dlinesize;
459  }
460 }
461 
462 static void pseudocolor_filter_11d(int max, int width, int height,
463  const uint8_t *index,
464  const uint8_t *src,
465  uint8_t *dst,
466  ptrdiff_t ilinesize,
467  ptrdiff_t slinesize,
468  ptrdiff_t dlinesize,
469  float *lut,
470  float opacity)
471 {
472  int x, y;
473 
474  for (y = 0; y < height; y++) {
475  for (x = 0; x < width; x++) {
476  int v = lut[index[(y >> 1) * ilinesize + (x >> 1)]];
477 
478  PCLIP(v, max, dst, src, x);
479  }
480  src += slinesize;
481  dst += dlinesize;
482  }
483 }
484 
485 static void pseudocolor_filter_10(int max, int width, int height,
486  const uint8_t *index,
487  const uint8_t *src,
488  uint8_t *dst,
489  ptrdiff_t ilinesize,
490  ptrdiff_t slinesize,
491  ptrdiff_t dlinesize,
492  float *lut,
493  float opacity)
494 {
495  int x, y;
496 
497  for (y = 0; y < height; y++) {
498  for (x = 0; x < width; x++) {
499  int v = lut[index[x << 1]];
500 
501  PCLIP(v, max, dst, src, x);
502  }
503  index += ilinesize;
504  src += slinesize;
505  dst += dlinesize;
506  }
507 }
508 
509 static void pseudocolor_filter_10d(int max, int width, int height,
510  const uint8_t *index,
511  const uint8_t *src,
512  uint8_t *dst,
513  ptrdiff_t ilinesize,
514  ptrdiff_t slinesize,
515  ptrdiff_t dlinesize,
516  float *lut,
517  float opacity)
518 {
519  int x, y;
520 
521  for (y = 0; y < height; y++) {
522  for (x = 0; x < width; x++) {
523  int v = lut[index[x >> 1]];
524 
525  PCLIP(v, max, dst, src, x);
526  }
527  index += ilinesize;
528  src += slinesize;
529  dst += dlinesize;
530  }
531 }
532 
533 static void pseudocolor_filter_16(int max, int width, int height,
534  const uint8_t *iindex,
535  const uint8_t *ssrc,
536  uint8_t *ddst,
537  ptrdiff_t ilinesize,
538  ptrdiff_t slinesize,
539  ptrdiff_t dlinesize,
540  float *lut,
541  float opacity)
542 {
543  const uint16_t *index = (const uint16_t *)iindex;
544  const uint16_t *src = (const uint16_t *)ssrc;
545  uint16_t *dst = (uint16_t *)ddst;
546  int x, y;
547 
548  for (y = 0; y < height; y++) {
549  for (x = 0; x < width; x++) {
550  int v = lut[index[x]];
551 
552  PCLIP(v, max, dst, src, x);
553  }
554  index += ilinesize / 2;
555  src += slinesize / 2;
556  dst += dlinesize / 2;
557  }
558 }
559 
560 static void pseudocolor_filter_16_10(int max, int width, int height,
561  const uint8_t *iindex,
562  const uint8_t *ssrc,
563  uint8_t *ddst,
564  ptrdiff_t ilinesize,
565  ptrdiff_t slinesize,
566  ptrdiff_t dlinesize,
567  float *lut,
568  float opacity)
569 {
570  const uint16_t *index = (const uint16_t *)iindex;
571  const uint16_t *src = (const uint16_t *)ssrc;
572  uint16_t *dst = (uint16_t *)ddst;
573  int x, y;
574 
575  for (y = 0; y < height; y++) {
576  for (x = 0; x < width; x++) {
577  int v = lut[index[x << 1]];
578 
579  PCLIP(v, max, dst, src, x);
580  }
581  index += ilinesize / 2;
582  src += slinesize / 2;
583  dst += dlinesize / 2;
584  }
585 }
586 
587 static void pseudocolor_filter_16_10d(int max, int width, int height,
588  const uint8_t *iindex,
589  const uint8_t *ssrc,
590  uint8_t *ddst,
591  ptrdiff_t ilinesize,
592  ptrdiff_t slinesize,
593  ptrdiff_t dlinesize,
594  float *lut,
595  float opacity)
596 {
597  const uint16_t *index = (const uint16_t *)iindex;
598  const uint16_t *src = (const uint16_t *)ssrc;
599  uint16_t *dst = (uint16_t *)ddst;
600  int x, y;
601 
602  for (y = 0; y < height; y++) {
603  for (x = 0; x < width; x++) {
604  int v = lut[index[x >> 1]];
605 
606  PCLIP(v, max, dst, src, x);
607  }
608  index += ilinesize / 2;
609  src += slinesize / 2;
610  dst += dlinesize / 2;
611  }
612 }
613 
614 static void pseudocolor_filter_16_11(int max, int width, int height,
615  const uint8_t *iindex,
616  const uint8_t *ssrc,
617  uint8_t *ddst,
618  ptrdiff_t ilinesize,
619  ptrdiff_t slinesize,
620  ptrdiff_t dlinesize,
621  float *lut,
622  float opacity)
623 {
624  const uint16_t *index = (const uint16_t *)iindex;
625  const uint16_t *src = (const uint16_t *)ssrc;
626  uint16_t *dst = (uint16_t *)ddst;
627  int x, y;
628 
629  ilinesize /= 2;
630  dlinesize /= 2;
631  slinesize /= 2;
632 
633  for (y = 0; y < height; y++) {
634  for (x = 0; x < width; x++) {
635  int v = lut[index[(y << 1) * ilinesize + (x << 1)]];
636 
637  PCLIP(v, max, dst, src, x);
638  }
639  src += slinesize;
640  dst += dlinesize;
641  }
642 }
643 
644 static void pseudocolor_filter_16_11d(int max, int width, int height,
645  const uint8_t *iindex,
646  const uint8_t *ssrc,
647  uint8_t *ddst,
648  ptrdiff_t ilinesize,
649  ptrdiff_t slinesize,
650  ptrdiff_t dlinesize,
651  float *lut,
652  float opacity)
653 {
654  const uint16_t *index = (const uint16_t *)iindex;
655  const uint16_t *src = (const uint16_t *)ssrc;
656  uint16_t *dst = (uint16_t *)ddst;
657  int x, y;
658 
659  ilinesize /= 2;
660  dlinesize /= 2;
661  slinesize /= 2;
662 
663  for (y = 0; y < height; y++) {
664  for (x = 0; x < width; x++) {
665  int v = lut[index[(y >> 1) * ilinesize + (x >> 1)]];
666 
667  PCLIP(v, max, dst, src, x);
668  }
669  src += slinesize;
670  dst += dlinesize;
671  }
672 }
673 
674 #define RGB_TO_Y_BT709(r, g, b) \
675 ((0.21260*219.0/255.0) * (r) + (0.71520*219.0/255.0) * (g) + \
676  (0.07220*219.0/255.0) * (b))
677 
678 #define RGB_TO_U_BT709(r1, g1, b1, max) \
679 (-(0.11457*224.0/255.0) * r1 - (0.38543*224.0/255.0) * g1 + \
680  (0.50000*224.0/255.0) * b1 + max * 0.5)
681 
682 #define RGB_TO_V_BT709(r1, g1, b1, max) \
683 ((0.50000*224.0/255.0) * r1 - (0.45415*224.0/255.0) * g1 - \
684  (0.04585*224.0/255.0) * b1 + max * 0.5)
685 
686 #define Wr 0.2126
687 #define Wb 0.0722
688 #define Wg (1 - Wr - Wb)
689 #define Umax 0.436
690 #define Vmax 0.615
691 
692 #define YUV_BT709_TO_R(y, u, v, max) \
693  ((y + v * (1 - Wr) / Vmax) * max)
694 #define YUV_BT709_TO_G(y, u, v, max) \
695  ((y - (u * Wb * (1 - Wb) / (Umax * Wg)) - (v * Wr * (1 - Wr) / (Vmax * Wg))) * max)
696 #define YUV_BT709_TO_B(y, u, v, max) \
697  ((y + u * (1 - Wb) / Umax) * max)
698 
699 static double poly_eval(const double *const poly, double x, curve_fun fun)
700 {
701  double res = 0.;
702 
703  for (int i = 0; i < 8; i++) {
704  res += pow(x, i) * poly[7-i];
705  }
706 
707  return fun(res);
708 }
709 
711 {
712  AVFilterContext *ctx = inlink->dst;
713  PseudoColorContext *s = ctx->priv;
715  int depth, ret, hsub, vsub, color, rgb;
716 
717  rgb = desc->flags & AV_PIX_FMT_FLAG_RGB;
718  depth = desc->comp[0].depth;
719  s->max = (1 << depth) - 1;
720  s->nb_planes = av_pix_fmt_count_planes(inlink->format);
721 
722  if (s->index >= s->nb_planes) {
723  av_log(ctx, AV_LOG_ERROR, "index out of allowed range\n");
724  return AVERROR(EINVAL);
725  }
726 
727  if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
728  return ret;
729 
730  hsub = desc->log2_chroma_w;
731  vsub = desc->log2_chroma_h;
732  s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
733  s->height[0] = s->height[3] = inlink->h;
734  s->width[1] = s->width[2] = AV_CEIL_RSHIFT(inlink->w, hsub);
735  s->width[0] = s->width[3] = inlink->w;
736 
737  s->var_values[VAR_W] = inlink->w;
738  s->var_values[VAR_H] = inlink->h;
739 
740  s->var_values[VAR_YMIN] = 16 * (1 << (depth - 8));
741  s->var_values[VAR_UMIN] = 16 * (1 << (depth - 8));
742  s->var_values[VAR_VMIN] = 16 * (1 << (depth - 8));
743  s->var_values[VAR_AMIN] = 0;
744  s->var_values[VAR_YMAX] = 235 * (1 << (depth - 8));
745  s->var_values[VAR_UMAX] = 240 * (1 << (depth - 8));
746  s->var_values[VAR_VMAX] = 240 * (1 << (depth - 8));
747  s->var_values[VAR_AMAX] = s->max;
748 
749  for (color = 0; color < s->nb_planes && s->preset < 0; color++) {
750  double res;
751  int val;
752 
753  /* create the parsed expression */
754  av_expr_free(s->comp_expr[color]);
755  s->comp_expr[color] = NULL;
756  ret = av_expr_parse(&s->comp_expr[color], s->comp_expr_str[color],
757  var_names, NULL, NULL, NULL, NULL, 0, ctx);
758  if (ret < 0) {
760  "Error when parsing the expression '%s' for the component %d and color %d.\n",
761  s->comp_expr_str[color], color, color);
762  return AVERROR(EINVAL);
763  }
764 
765  /* compute the lut */
766  for (val = 0; val < FF_ARRAY_ELEMS(s->lut[color]); val++) {
767  s->var_values[VAR_VAL] = val;
768 
769  res = av_expr_eval(s->comp_expr[color], s->var_values, s);
770  if (isnan(res)) {
772  "Error when evaluating the expression '%s' for the value %d for the component %d.\n",
773  s->comp_expr_str[color], val, color);
774  return AVERROR(EINVAL);
775  }
776  s->lut[color][val] = res;
777  }
778  }
779 
780  if (s->preset >= 0) {
781  int nb_segments = presets[s->preset].nb_segments;
782 
783  for (int seg = 0; seg < nb_segments; seg++) {
784  AVRational rstart = presets[s->preset].ranges[seg].start;
785  AVRational rend = presets[s->preset].ranges[seg].end;
786  int start = av_rescale_rnd(s->max + 1, rstart.num, rstart.den, AV_ROUND_UP);
787  int end = av_rescale_rnd(s->max + 1, rend.num, rend.den, AV_ROUND_UP);
788 
789  for (int i = start; i < end; i++) {
790  if (!presets[s->preset].curves) {
791  const Fill fill = presets[s->preset].fills[seg];
792  double r, g, b, a;
793 
794  g = fill.fill[1];
795  b = fill.fill[2];
796  r = fill.fill[0];
797  a = fill.fill[3];
798 
799  if (g >= 0.f && b >= 0.f && r >= 0.f) {
800  g *= s->max;
801  b *= s->max;
802  r *= s->max;
803 
804  if (!rgb) {
805  double y = RGB_TO_Y_BT709(r, g, b);
806  double u = RGB_TO_U_BT709(r, g, b, s->max);
807  double v = RGB_TO_V_BT709(r, g, b, s->max);
808 
809  r = v;
810  g = y;
811  b = u;
812  }
813  }
814 
815  s->lut[0][i] = g;
816  s->lut[1][i] = b;
817  s->lut[2][i] = r;
818  s->lut[3][i] = a * s->max;
819  } else {
820  const Curve curve = presets[s->preset].curves[seg];
821  const double lf = i / (double)s->max * 256.;
822  double r, g, b;
823 
824  g = poly_eval(curve.coef[1], lf + curve.offset[1], curve.fun[1]);
825  b = poly_eval(curve.coef[2], lf + curve.offset[2], curve.fun[2]);
826  r = poly_eval(curve.coef[0], lf + curve.offset[0], curve.fun[0]);
827 
828  if (!curve.yuv || !rgb) {
829  g *= s->max;
830  b *= s->max;
831  r *= s->max;
832  }
833 
834  if (!rgb && !curve.yuv) {
835  double y = RGB_TO_Y_BT709(r, g, b);
836  double u = RGB_TO_U_BT709(r, g, b, s->max);
837  double v = RGB_TO_V_BT709(r, g, b, s->max);
838 
839  r = v;
840  g = y;
841  b = u;
842  } else if (rgb && curve.yuv) {
843  double y = g;
844  double u = b - 0.5;
845  double v = r - 0.5;
846 
847  r = av_clipd(YUV_BT709_TO_R(y, u, v, s->max), 0, s->max);
848  g = av_clipd(YUV_BT709_TO_G(y, u, v, s->max), 0, s->max);
849  b = av_clipd(YUV_BT709_TO_B(y, u, v, s->max), 0, s->max);
850  }
851 
852  s->lut[0][i] = g;
853  s->lut[1][i] = b;
854  s->lut[2][i] = r;
855  s->lut[3][i] = 1.f * s->max;
856  }
857  }
858  }
859  }
860 
861  switch (inlink->format) {
862  case AV_PIX_FMT_YUV444P:
863  case AV_PIX_FMT_YUVA444P:
864  case AV_PIX_FMT_GBRP:
865  case AV_PIX_FMT_GBRAP:
866  case AV_PIX_FMT_GRAY8:
867  s->filter[0] = s->filter[1] = s->filter[2] = s->filter[3] = pseudocolor_filter;
868  break;
869  case AV_PIX_FMT_YUV420P:
870  case AV_PIX_FMT_YUVA420P:
871  switch (s->index) {
872  case 0:
873  case 3:
874  s->filter[0] = s->filter[3] = pseudocolor_filter;
875  s->filter[1] = s->filter[2] = pseudocolor_filter_11;
876  break;
877  case 1:
878  case 2:
879  s->filter[0] = s->filter[3] = pseudocolor_filter_11d;
880  s->filter[1] = s->filter[2] = pseudocolor_filter;
881  break;
882  }
883  break;
884  case AV_PIX_FMT_YUV422P:
885  case AV_PIX_FMT_YUVA422P:
886  switch (s->index) {
887  case 0:
888  case 3:
889  s->filter[0] = s->filter[3] = pseudocolor_filter;
890  s->filter[1] = s->filter[2] = pseudocolor_filter_10;
891  break;
892  case 1:
893  case 2:
894  s->filter[0] = s->filter[3] = pseudocolor_filter_10d;
895  s->filter[1] = s->filter[2] = pseudocolor_filter;
896  break;
897  }
898  break;
899  case AV_PIX_FMT_YUV444P9:
908  case AV_PIX_FMT_GBRP9:
909  case AV_PIX_FMT_GBRP10:
910  case AV_PIX_FMT_GBRP12:
911  case AV_PIX_FMT_GBRP14:
912  case AV_PIX_FMT_GBRP16:
913  case AV_PIX_FMT_GBRAP10:
914  case AV_PIX_FMT_GBRAP12:
915  case AV_PIX_FMT_GBRAP14:
916  case AV_PIX_FMT_GBRAP16:
917  case AV_PIX_FMT_GRAY9:
918  case AV_PIX_FMT_GRAY10:
919  case AV_PIX_FMT_GRAY12:
920  case AV_PIX_FMT_GRAY14:
921  case AV_PIX_FMT_GRAY16:
922  s->filter[0] = s->filter[1] = s->filter[2] = s->filter[3] = pseudocolor_filter_16;
923  break;
924  case AV_PIX_FMT_YUV422P9:
933  switch (s->index) {
934  case 0:
935  case 3:
936  s->filter[0] = s->filter[3] = pseudocolor_filter_16;
937  s->filter[1] = s->filter[2] = pseudocolor_filter_16_10;
938  break;
939  case 1:
940  case 2:
941  s->filter[0] = s->filter[3] = pseudocolor_filter_16_10d;
942  s->filter[1] = s->filter[2] = pseudocolor_filter_16;
943  break;
944  }
945  break;
946  case AV_PIX_FMT_YUV420P9:
954  switch (s->index) {
955  case 0:
956  case 3:
957  s->filter[0] = s->filter[3] = pseudocolor_filter_16;
958  s->filter[1] = s->filter[2] = pseudocolor_filter_16_11;
959  break;
960  case 1:
961  case 2:
962  s->filter[0] = s->filter[3] = pseudocolor_filter_16_11d;
963  s->filter[1] = s->filter[2] = pseudocolor_filter_16;
964  break;
965  }
966  break;
967  }
968 
969  return 0;
970 }
971 
972 typedef struct ThreadData {
973  AVFrame *in, *out;
974 } ThreadData;
975 
976 static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
977 {
978  PseudoColorContext *s = ctx->priv;
979  ThreadData *td = arg;
980  AVFrame *in = td->in;
981  AVFrame *out = td->out;
982 
983  for (int plane = 0; plane < s->nb_planes; plane++) {
984  const int slice_start = (s->height[plane] * jobnr) / nb_jobs;
985  const int slice_end = (s->height[plane] * (jobnr+1)) / nb_jobs;
986  const int islice_start = (s->height[s->index] * jobnr) / nb_jobs;
987  ptrdiff_t ilinesize = in->linesize[s->index];
988  ptrdiff_t slinesize = in->linesize[plane];
989  ptrdiff_t dlinesize = out->linesize[plane];
990  const uint8_t *index = in->data[s->index] + islice_start * ilinesize;
991  const uint8_t *src = in->data[plane] + slice_start * slinesize;
992  uint8_t *dst = out->data[plane] + slice_start * dlinesize;
993 
994  s->filter[plane](s->max, s->width[plane], slice_end - slice_start,
995  index, src, dst, ilinesize, slinesize,
996  dlinesize, s->lut[plane], s->opacity);
997  }
998 
999  return 0;
1000 }
1001 
1003 {
1004  AVFilterContext *ctx = inlink->dst;
1005  PseudoColorContext *s = ctx->priv;
1006  AVFilterLink *outlink = ctx->outputs[0];
1007  ThreadData td;
1008  AVFrame *out;
1009 
1010  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
1011  if (!out) {
1012  av_frame_free(&in);
1013  return AVERROR(ENOMEM);
1014  }
1015  av_frame_copy_props(out, in);
1016 
1017  td.out = out, td.in = in;
1019  FFMIN(s->height[1], ff_filter_get_nb_threads(ctx)));
1020 
1021  av_frame_free(&in);
1022  return ff_filter_frame(outlink, out);
1023 }
1024 
1025 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
1026  char *res, int res_len, int flags)
1027 {
1028  int ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
1029 
1030  if (ret < 0)
1031  return ret;
1032 
1033  return config_input(ctx->inputs[0]);
1034 }
1035 
1036 static const AVFilterPad inputs[] = {
1037  {
1038  .name = "default",
1039  .type = AVMEDIA_TYPE_VIDEO,
1040  .filter_frame = filter_frame,
1041  .config_props = config_input,
1042  },
1043 };
1044 
1046 {
1047  PseudoColorContext *s = ctx->priv;
1048  int i;
1049 
1050  for (i = 0; i < 4; i++) {
1051  av_expr_free(s->comp_expr[i]);
1052  s->comp_expr[i] = NULL;
1053  }
1054 }
1055 
1056 AVFILTER_DEFINE_CLASS(pseudocolor);
1057 
1059  .name = "pseudocolor",
1060  .description = NULL_IF_CONFIG_SMALL("Make pseudocolored video frames."),
1061  .priv_size = sizeof(PseudoColorContext),
1062  .priv_class = &pseudocolor_class,
1063  .uninit = uninit,
1068  .process_command = process_command,
1069 };
helixfunu
static double helixfunu(double x)
Definition: vf_pseudocolor.c:182
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: vf_pseudocolor.c:1025
PRESET_VIRIDIS
@ PRESET_VIRIDIS
Definition: vf_pseudocolor.c:83
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:112
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:522
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:501
pseudocolor_filter_10
static void pseudocolor_filter_10(int max, int width, int height, const uint8_t *index, const uint8_t *src, uint8_t *dst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
Definition: vf_pseudocolor.c:485
td
#define td
Definition: regdef.h:70
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
PseudoColorContext::width
int width[4]
Definition: vf_pseudocolor.c:320
Preset::nb_segments
int nb_segments
Definition: vf_pseudocolor.c:122
r
const char * r
Definition: vf_curves.c:126
AVERROR
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
opt.h
var_name
var_name
Definition: noise.c:46
out
FILE * out
Definition: movenc.c:54
curves
static const Curve curves[]
Definition: vf_pseudocolor.c:192
color
Definition: vf_paletteuse.c:511
u
#define u(width, name, range_min, range_max)
Definition: cbs_h2645.c:250
filter_slice
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_pseudocolor.c:976
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1018
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2962
PseudoColorContext::linesize
int linesize[4]
Definition: vf_pseudocolor.c:319
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:162
PseudoColorContext::color
int color
Definition: vf_pseudocolor.c:318
inlink
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
Definition: filter_design.txt:212
spec2_fills
static const Fill spec2_fills[]
Definition: vf_pseudocolor.c:138
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:160
VAR_AMAX
@ VAR_AMAX
Definition: vf_pseudocolor.c:57
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:514
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:375
pixdesc.h
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:521
spec1_range
static const Range spec1_range[]
Definition: vf_pseudocolor.c:132
M_PI_2
#define M_PI_2
Definition: mathematics.h:73
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:516
AVOption
AVOption.
Definition: opt.h:346
PRESET_NOMINAL
@ PRESET_NOMINAL
Definition: vf_pseudocolor.c:91
b
#define b
Definition: input.c:41
solarfun
static double solarfun(double x)
Definition: vf_pseudocolor.c:147
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:478
heatfunv
static double heatfunv(double x)
Definition: vf_pseudocolor.c:167
VAR_UMAX
@ VAR_UMAX
Definition: vf_pseudocolor.c:55
TURBO
@ TURBO
Definition: vf_pseudocolor.c:66
PRESET_GREEN
@ PRESET_GREEN
Definition: vf_pseudocolor.c:99
lerpf
static float lerpf(float v0, float v1, float f)
Definition: vf_pseudocolor.c:403
max
#define max(a, b)
Definition: cuda_runtime.h:33
PRESET_RANGE1
@ PRESET_RANGE1
Definition: vf_pseudocolor.c:86
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
ThreadData::out
AVFrame * out
Definition: af_adeclick.c:526
video.h
HELIX
@ HELIX
Definition: vf_pseudocolor.c:75
ThreadData::in
AVFrame * in
Definition: af_adecorrelate.c:153
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:517
SPECTRAL
@ SPECTRAL
Definition: vf_pseudocolor.c:69
Preset::curves
const Curve * curves
Definition: vf_pseudocolor.c:124
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:458
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:396
pseudocolor_filter_16_10
static void pseudocolor_filter_16_10(int max, int width, int height, const uint8_t *iindex, const uint8_t *ssrc, uint8_t *ddst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
Definition: vf_pseudocolor.c:560
hsub
static void hsub(htype *dst, const htype *src, int bins)
Definition: vf_median.c:73
av_expr_parse
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:711
PRESET_RANGE2
@ PRESET_RANGE2
Definition: vf_pseudocolor.c:87
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3002
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:513
FIERY
@ FIERY
Definition: vf_pseudocolor.c:72
rgb
Definition: rpzaenc.c:60
PseudoColorContext::comp_expr
AVExpr * comp_expr[4]
Definition: vf_pseudocolor.c:323
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:496
COOL
@ COOL
Definition: vf_pseudocolor.c:70
GREEN
@ GREEN
Definition: vf_pseudocolor.c:74
VIRIDIS
@ VIRIDIS
Definition: vf_pseudocolor.c:65
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
highlights_fills
static const Fill highlights_fills[]
Definition: vf_pseudocolor.c:140
v0
#define v0
Definition: regdef.h:26
presets
static const Preset presets[]
Definition: vf_pseudocolor.c:286
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:494
PRESET_TOTAL
@ PRESET_TOTAL
Definition: vf_pseudocolor.c:93
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:523
pseudocolor_filter_16
static void pseudocolor_filter_16(int max, int width, int height, const uint8_t *iindex, const uint8_t *ssrc, uint8_t *ddst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
Definition: vf_pseudocolor.c:533
pseudocolor_filter_16_11d
static void pseudocolor_filter_16_11d(int max, int width, int height, const uint8_t *iindex, const uint8_t *ssrc, uint8_t *ddst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
Definition: vf_pseudocolor.c:644
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:476
PRESET_SHADOWS
@ PRESET_SHADOWS
Definition: vf_pseudocolor.c:88
val
static double val(void *priv, double ch)
Definition: aeval.c:78
AV_ROUND_UP
@ AV_ROUND_UP
Round toward +infinity.
Definition: mathematics.h:134
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:462
PRESET_BLUES
@ PRESET_BLUES
Definition: vf_pseudocolor.c:98
av_expr_free
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
Definition: eval.c:359
AVRational::num
int num
Numerator.
Definition: rational.h:59
Curve::offset
double offset[3]
Definition: vf_pseudocolor.c:108
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:481
preset
preset
Definition: vf_curves.c:46
slice_start
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
Definition: vvcdec.c:685
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:490
PRESET_HIGHLIGHTS
@ PRESET_HIGHLIGHTS
Definition: vf_pseudocolor.c:89
ff_video_default_filterpad
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition: video.c:37
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:498
PLASMA
@ PLASMA
Definition: vf_pseudocolor.c:64
width
#define width
av_image_fill_linesizes
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
Definition: imgutils.c:89
RGB_TO_Y_BT709
#define RGB_TO_Y_BT709(r, g, b)
Definition: vf_pseudocolor.c:674
s
#define s(width, name)
Definition: cbs_vp9.c:198
AV_PIX_FMT_GBRAP14
#define AV_PIX_FMT_GBRAP14
Definition: pixfmt.h:500
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:499
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:108
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:491
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
PRESET_COOL
@ PRESET_COOL
Definition: vf_pseudocolor.c:95
g
const char * g
Definition: vf_curves.c:127
RGB_TO_U_BT709
#define RGB_TO_U_BT709(r1, g1, b1, max)
Definition: vf_pseudocolor.c:678
PRESET_FIERY
@ PRESET_FIERY
Definition: vf_pseudocolor.c:97
YUV_BT709_TO_B
#define YUV_BT709_TO_B(y, u, v, max)
Definition: vf_pseudocolor.c:696
SOLAR
@ SOLAR
Definition: vf_pseudocolor.c:68
slice_end
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:1725
nominal_range
static const Range nominal_range[]
Definition: vf_pseudocolor.c:129
VAR_VMIN
@ VAR_VMIN
Definition: vf_pseudocolor.c:52
shadows_fills
static const Fill shadows_fills[]
Definition: vf_pseudocolor.c:139
coolfunu
static double coolfunu(double x)
Definition: vf_pseudocolor.c:152
heatfunu
static double heatfunu(double x)
Definition: vf_pseudocolor.c:162
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:520
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:475
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:489
ctx
AVFormatContext * ctx
Definition: movenc.c:48
av_expr_eval
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
Definition: eval.c:793
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:461
AVExpr
Definition: eval.c:159
VAR_YMAX
@ VAR_YMAX
Definition: vf_pseudocolor.c:54
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
arg
const char * arg
Definition: jacosubdec.c:67
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:459
Presets
Presets
Definition: vf_pseudocolor.c:79
pseudocolor_filter_10d
static void pseudocolor_filter_10d(int max, int width, int height, const uint8_t *index, const uint8_t *src, uint8_t *dst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
Definition: vf_pseudocolor.c:509
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:497
shadows_range
static const Range shadows_range[]
Definition: vf_pseudocolor.c:134
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
CIVIDIS
@ CIVIDIS
Definition: vf_pseudocolor.c:67
NULL
#define NULL
Definition: coverity.c:32
PRESET_SPECTRAL
@ PRESET_SPECTRAL
Definition: vf_pseudocolor.c:94
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:709
YUV_BT709_TO_R
#define YUV_BT709_TO_R(y, u, v, max)
Definition: vf_pseudocolor.c:692
MAGMA
@ MAGMA
Definition: vf_pseudocolor.c:62
pseudocolor_filter_16_10d
static void pseudocolor_filter_16_10d(int max, int width, int height, const uint8_t *iindex, const uint8_t *ssrc, uint8_t *ddst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
Definition: vf_pseudocolor.c:587
VAR_VARS_NB
@ VAR_VARS_NB
Definition: vf_pseudocolor.c:58
spec2_range
static const Range spec2_range[]
Definition: vf_pseudocolor.c:133
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
isnan
#define isnan(x)
Definition: libm.h:340
NB_PRESETS
@ NB_PRESETS
Definition: vf_pseudocolor.c:101
OFFSET
#define OFFSET(x)
Definition: vf_pseudocolor.c:336
var_names
static const char *const var_names[]
Definition: vf_pseudocolor.c:31
double
double
Definition: af_crystalizer.c:131
HEAT
@ HEAT
Definition: vf_pseudocolor.c:71
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:479
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
VAR_UMIN
@ VAR_UMIN
Definition: vf_pseudocolor.c:51
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:493
FLAGS
#define FLAGS
Definition: vf_pseudocolor.c:337
Range
Definition: vf_colorbalance.c:37
index
int index
Definition: gxfenc.c:89
VAR_VMAX
@ VAR_VMAX
Definition: vf_pseudocolor.c:56
total_range
static const Range total_range[]
Definition: vf_pseudocolor.c:131
av_rescale_rnd
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
Definition: mathematics.c:58
eval.h
Preset::ranges
const Range * ranges
Definition: vf_pseudocolor.c:123
f
f
Definition: af_crystalizer.c:121
RGB_TO_V_BT709
#define RGB_TO_V_BT709(r1, g1, b1, max)
Definition: vf_pseudocolor.c:682
pseudocolor_options
static const AVOption pseudocolor_options[]
Definition: vf_pseudocolor.c:339
PseudoColorContext::height
int height[4]
Definition: vf_pseudocolor.c:320
PseudoColorContext::comp_expr_str
char * comp_expr_str[4]
Definition: vf_pseudocolor.c:322
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:106
PseudoColorContext::nb_planes
int nb_planes
Definition: vf_pseudocolor.c:317
AV_PIX_FMT_FLAG_RGB
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition: pixdesc.h:136
Curve
Definition: vf_pseudocolor.c:106
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:483
PCLIP
#define PCLIP(v, max, dst, src, x)
Definition: vf_pseudocolor.c:408
poly_eval
static double poly_eval(const double *const poly, double x, curve_fun fun)
Definition: vf_pseudocolor.c:699
PRESET_HEAT
@ PRESET_HEAT
Definition: vf_pseudocolor.c:96
PseudoColorContext::index
int index
Definition: vf_pseudocolor.c:316
color
static const uint32_t color[16+AV_CLASS_CATEGORY_NB]
Definition: log.c:94
PRESET_MAGMA
@ PRESET_MAGMA
Definition: vf_pseudocolor.c:80
YUV_BT709_TO_G
#define YUV_BT709_TO_G(y, u, v, max)
Definition: vf_pseudocolor.c:694
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:485
Curve::yuv
int yuv
Definition: vf_pseudocolor.c:110
ff_filter_process_command
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.
Definition: avfilter.c:890
pseudocolor_filter
static void pseudocolor_filter(int max, int width, int height, const uint8_t *index, const uint8_t *src, uint8_t *dst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
Definition: vf_pseudocolor.c:415
height
#define height
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
curve_fun
double(* curve_fun)(double x)
Definition: vf_pseudocolor.c:104
Fill
Definition: vf_pseudocolor.c:113
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:174
VAR_W
@ VAR_W
Definition: vf_pseudocolor.c:47
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:518
attributes.h
PRESET_HELIX
@ PRESET_HELIX
Definition: vf_pseudocolor.c:100
PseudoColorContext
Definition: vf_pseudocolor.c:311
M_PI
#define M_PI
Definition: mathematics.h:67
full_range
static const Range full_range
Definition: vf_pseudocolor.c:128
VAR_H
@ VAR_H
Definition: vf_pseudocolor.c:48
internal.h
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:147
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:238
Fill::fill
float fill[4]
Definition: vf_pseudocolor.c:114
PRESET_PLASMA
@ PRESET_PLASMA
Definition: vf_pseudocolor.c:82
Curve::coef
double coef[3][8]
Definition: vf_pseudocolor.c:107
PRESET_CIVIDIS
@ PRESET_CIVIDIS
Definition: vf_pseudocolor.c:85
Curve::fun
curve_fun fun[3]
Definition: vf_pseudocolor.c:109
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_pseudocolor.c:1045
Preset::fills
const Fill * fills
Definition: vf_pseudocolor.c:125
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:495
common.h
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:825
pseudocolor_filter_16_11
static void pseudocolor_filter_16_11(int max, int width, int height, const uint8_t *iindex, const uint8_t *ssrc, uint8_t *ddst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
Definition: vf_pseudocolor.c:614
ThreadData
Used for passing data between threads.
Definition: dsddec.c:69
pseudocolor_filter_11
static void pseudocolor_filter_11(int max, int width, int height, const uint8_t *index, const uint8_t *src, uint8_t *dst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
Definition: vf_pseudocolor.c:439
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
helixfunv
static double helixfunv(double x)
Definition: vf_pseudocolor.c:187
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_pseudocolor.c:374
inputs
static const AVFilterPad inputs[]
Definition: vf_pseudocolor.c:1036
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:477
limit
static double limit(double x)
Definition: vf_pseudocolor.c:142
fieryfunu
static double fieryfunu(double x)
Definition: vf_pseudocolor.c:172
AVFilter
Filter definition.
Definition: avfilter.h:166
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_pseudocolor.c:710
ret
ret
Definition: filter_design.txt:187
PseudoColorContext::var_values
double var_values[VAR_VARS_NB]
Definition: vf_pseudocolor.c:321
PRESET_TURBO
@ PRESET_TURBO
Definition: vf_pseudocolor.c:84
fieryfunv
static double fieryfunv(double x)
Definition: vf_pseudocolor.c:177
Preset
Definition: vf_pseudocolor.c:121
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:515
PRESET_SOLAR
@ PRESET_SOLAR
Definition: vf_pseudocolor.c:90
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:482
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:487
VAR_YMIN
@ VAR_YMIN
Definition: vf_pseudocolor.c:50
spec1_fills
static const Fill spec1_fills[]
Definition: vf_pseudocolor.c:137
Range::end
AVRational end
Definition: vf_pseudocolor.c:118
VAR_VAL
@ VAR_VAL
Definition: vf_pseudocolor.c:49
ff_vf_pseudocolor
const AVFilter ff_vf_pseudocolor
Definition: vf_pseudocolor.c:1058
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:519
NB_CURVES
@ NB_CURVES
Definition: vf_pseudocolor.c:76
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
avfilter.h
VAR_AMIN
@ VAR_AMIN
Definition: vf_pseudocolor.c:53
BLUES
@ BLUES
Definition: vf_pseudocolor.c:73
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
Range::start
AVRational start
Definition: vf_pseudocolor.c:118
AVFilterContext
An instance of a filter.
Definition: avfilter.h:407
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(pseudocolor)
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:117
desc
const char * desc
Definition: libsvtav1.c:75
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
coolfunv
static double coolfunv(double x)
Definition: vf_pseudocolor.c:157
INFERNO
@ INFERNO
Definition: vf_pseudocolor.c:63
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
PseudoColorContext::filter
void(* filter[4])(int max, int width, int height, const uint8_t *index, const uint8_t *src, uint8_t *dst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
Definition: vf_pseudocolor.c:326
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
pseudocolor_filter_11d
static void pseudocolor_filter_11d(int max, int width, int height, const uint8_t *index, const uint8_t *src, uint8_t *dst, ptrdiff_t ilinesize, ptrdiff_t slinesize, ptrdiff_t dlinesize, float *lut, float opacity)
Definition: vf_pseudocolor.c:462
PRESET_INFERNO
@ PRESET_INFERNO
Definition: vf_pseudocolor.c:81
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
imgutils.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition: frame.h:420
rgb
static const SheerTable rgb[2]
Definition: sheervideodata.h:32
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
Curves
Curves
Definition: vf_pseudocolor.c:61
PseudoColorContext::opacity
float opacity
Definition: vf_pseudocolor.c:314
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_pseudocolor.c:1002
PseudoColorContext::lut
float lut[4][256 *256]
Definition: vf_pseudocolor.c:324
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:488
preferred_range
static const Range preferred_range[]
Definition: vf_pseudocolor.c:130
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:460
ff_filter_execute
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: internal.h:134
highlights_range
static const Range highlights_range[]
Definition: vf_pseudocolor.c:135
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:173
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:486
av_clipd
av_clipd
Definition: af_crystalizer.c:131
PseudoColorContext::preset
int preset
Definition: vf_pseudocolor.c:313
PseudoColorContext::max
int max
Definition: vf_pseudocolor.c:315
PRESET_PREFERRED
@ PRESET_PREFERRED
Definition: vf_pseudocolor.c:92