FFmpeg
fflcms2.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 Niklas Haas
3  * This file is part of FFmpeg.
4  *
5  * FFmpeg is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * FFmpeg is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with FFmpeg; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #include "libavutil/csp.h"
21 
22 #include "fflcms2.h"
23 
24 static void log_cb(cmsContext ctx, cmsUInt32Number error, const char *str)
25 {
26  FFIccContext *s = cmsGetContextUserData(ctx);
27  av_log(s->avctx, AV_LOG_ERROR, "lcms2: [%"PRIu32"] %s\n", error, str);
28 }
29 
31 {
32  memset(s, 0, sizeof(*s));
33  s->avctx = avctx;
34  s->ctx = cmsCreateContext(NULL, s);
35  if (!s->ctx)
36  return AVERROR(ENOMEM);
37 
38  cmsSetLogErrorHandlerTHR(s->ctx, log_cb);
39  return 0;
40 }
41 
43 {
44  for (int i = 0; i < FF_ARRAY_ELEMS(s->curves); i++)
45  cmsFreeToneCurve(s->curves[i]);
46  cmsDeleteContext(s->ctx);
47  memset(s, 0, sizeof(*s));
48 }
49 
51  cmsToneCurve **out_curve)
52 {
53  if ((unsigned)trc < AVCOL_TRC_NB && s->curves[trc])
54  goto done;
55 
56  switch (trc) {
57  case AVCOL_TRC_LINEAR:
58  s->curves[trc] = cmsBuildGamma(s->ctx, 1.0);
59  break;
60  case AVCOL_TRC_GAMMA22:
61  s->curves[trc] = cmsBuildGamma(s->ctx, 2.2);
62  break;
63  case AVCOL_TRC_GAMMA28:
64  s->curves[trc] = cmsBuildGamma(s->ctx, 2.8);
65  break;
66  case AVCOL_TRC_BT709:
70  s->curves[trc] = cmsBuildParametricToneCurve(s->ctx, 4, (double[5]) {
71  /* γ = */ 1/0.45,
72  /* a = */ 1/1.099296826809442,
73  /* b = */ 1 - 1/1.099296826809442,
74  /* c = */ 1/4.5,
75  /* d = */ 4.5 * 0.018053968510807,
76  });
77  break;
79  s->curves[trc] = cmsBuildParametricToneCurve(s->ctx, 4, (double[5]) {
80  /* γ = */ 1/0.45,
81  /* a = */ 1/1.1115,
82  /* b = */ 1 - 1/1.1115,
83  /* c = */ 1/4.0,
84  /* d = */ 4.0 * 0.0228,
85  });
86  break;
87  case AVCOL_TRC_LOG:
88  s->curves[trc] = cmsBuildParametricToneCurve(s->ctx, 8, (double[5]) {
89  /* a = */ 1.0,
90  /* b = */ 10.0,
91  /* c = */ 2.0,
92  /* d = */ -1.0,
93  /* e = */ 0.0
94  });
95  break;
96  case AVCOL_TRC_LOG_SQRT:
97  s->curves[trc] = cmsBuildParametricToneCurve(s->ctx, 8, (double[5]) {
98  /* a = */ 1.0,
99  /* b = */ 10.0,
100  /* c = */ 2.5,
101  /* d = */ -1.0,
102  /* e = */ 0.0
103  });
104  break;
106  s->curves[trc] = cmsBuildParametricToneCurve(s->ctx, 4, (double[5]) {
107  /* γ = */ 2.4,
108  /* a = */ 1/1.055,
109  /* b = */ 1 - 1/1.055,
110  /* c = */ 1/12.92,
111  /* d = */ 12.92 * 0.0031308,
112  });
113  break;
114  case AVCOL_TRC_SMPTE428:
115  s->curves[trc] = cmsBuildParametricToneCurve(s->ctx, 2, (double[3]) {
116  /* γ = */ 2.6,
117  /* a = */ pow(52.37/48.0, 1/2.6),
118  /* b = */ 0.0
119  });
120  break;
121 
122  /* Can't be represented using the existing parametric tone curves.
123  * FIXME: use cmsBuildTabulatedToneCurveFloat instead */
126  case AVCOL_TRC_SMPTE2084:
128  case AVCOL_TRC_V_LOG:
129  return AVERROR_PATCHWELCOME;
130 
131  default:
132  return AVERROR_INVALIDDATA;
133  }
134 
135  if (!s->curves[trc])
136  return AVERROR(ENOMEM);
137 
138 done:
139  *out_curve = s->curves[trc];
140  return 0;
141 }
142 
144  enum AVColorPrimaries color_prim,
145  enum AVColorTransferCharacteristic color_trc,
146  cmsHPROFILE *out_profile)
147 {
148  cmsToneCurve *tonecurve;
149  const AVColorPrimariesDesc *prim;
150  int ret;
151 
152  if (!(prim = av_csp_primaries_desc_from_id(color_prim)))
153  return AVERROR_INVALIDDATA;
154  if ((ret = get_curve(s, color_trc, &tonecurve)) < 0)
155  return ret;
156 
157  *out_profile = cmsCreateRGBProfileTHR(s->ctx,
158  &(cmsCIExyY) { av_q2d(prim->wp.x), av_q2d(prim->wp.y), 1.0 },
159  &(cmsCIExyYTRIPLE) {
160  .Red = { av_q2d(prim->prim.r.x), av_q2d(prim->prim.r.y), 1.0 },
161  .Green = { av_q2d(prim->prim.g.x), av_q2d(prim->prim.g.y), 1.0 },
162  .Blue = { av_q2d(prim->prim.b.x), av_q2d(prim->prim.b.y), 1.0 },
163  },
164  (cmsToneCurve *[3]) { tonecurve, tonecurve, tonecurve }
165  );
166 
167  return *out_profile == NULL ? AVERROR(ENOMEM) : 0;
168 }
169 
171 {
172  cmsUInt32Number size;
173  AVBufferRef *buf;
174 
175  if (!cmsSaveProfileToMem(profile, NULL, &size))
176  return AVERROR_EXTERNAL;
177 
178  buf = av_buffer_alloc(size);
179  if (!buf)
180  return AVERROR(ENOMEM);
181 
182  if (!cmsSaveProfileToMem(profile, buf->data, &size) || size != buf->size) {
183  av_buffer_unref(&buf);
184  return AVERROR_EXTERNAL;
185  }
186 
188  av_buffer_unref(&buf);
189  return AVERROR(ENOMEM);
190  }
191 
192  return 0;
193 }
194 
195 static av_always_inline void XYZ_xy(cmsCIEXYZ XYZ, AVCIExy *xy)
196 {
197  double k = 1.0 / (XYZ.X + XYZ.Y + XYZ.Z);
198  xy->x = av_d2q(k * XYZ.X, 100000);
199  xy->y = av_d2q(k * XYZ.Y, 100000);
200 }
201 
203 {
204  AVRational diff = av_sub_q(r1, r2);
205  /* denominator assumed to be positive */
206  return av_make_q(abs(diff.num), diff.den);
207 }
208 
209 static const AVCIExy wp_d50 = { {3457, 10000}, {3585, 10000} }; /* CIE D50 */
210 
212 {
213  cmsCIEXYZ *white, fixed;
214  AVCIExy wpxy;
215  AVRational diff, z;
216  if (!profile)
217  return 0;
218 
219  if (cmsGetEncodedICCversion(profile) >= 0x4000000) { // ICC v4
220  switch (cmsGetHeaderRenderingIntent(profile)) {
221  case INTENT_RELATIVE_COLORIMETRIC:
222  case INTENT_ABSOLUTE_COLORIMETRIC: ;
223  /* ICC v4 colorimetric profiles are specified to always use D50
224  * media white point, anything else is a violation of the spec.
225  * Sadly, such profiles are incredibly common (Apple...), so make
226  * an effort to fix them. */
227  if (!(white = cmsReadTag(profile, cmsSigMediaWhitePointTag)))
228  return AVERROR_INVALIDDATA;
229  XYZ_xy(*white, &wpxy);
230  diff = av_add_q(abs_sub_q(wpxy.x, wp_d50.x), abs_sub_q(wpxy.y, wp_d50.y));
231  if (av_cmp_q(diff, av_make_q(1, 1000)) > 0) {
232  av_log(s->avctx, AV_LOG_WARNING, "Invalid colorimetric ICCv4 "
233  "profile media white point tag (expected %.4f %.4f, "
234  "got %.4f %.4f)\n",
236  av_q2d(wpxy.x), av_q2d(wpxy.y));
237  /* x+y+z = 1 */
238  z = av_sub_q(av_sub_q(av_make_q(1, 1), wp_d50.x), wp_d50.y);
239  fixed.X = av_q2d(av_div_q(wp_d50.x, wp_d50.y)) * white->Y;
240  fixed.Y = white->Y;
241  fixed.Z = av_q2d(av_div_q(z, wp_d50.y)) * white->Y;
242  if (!cmsWriteTag(profile, cmsSigMediaWhitePointTag, &fixed))
243  return AVERROR_EXTERNAL;
244  }
245  break;
246  default: break;
247  }
248  }
249 
250  return 0;
251 }
252 
254  AVColorPrimariesDesc *out_primaries)
255 {
256  static const uint8_t testprimaries[4][3] = {
257  { 0xFF, 0, 0 }, /* red */
258  { 0, 0xFF, 0 }, /* green */
259  { 0, 0, 0xFF }, /* blue */
260  { 0xFF, 0xFF, 0xFF }, /* white */
261  };
262 
263  AVWhitepointCoefficients *wp = &out_primaries->wp;
264  AVPrimaryCoefficients *prim = &out_primaries->prim;
265  cmsFloat64Number prev_adapt;
266  cmsHPROFILE xyz;
267  cmsHTRANSFORM tf;
268  cmsCIEXYZ dst[4];
269 
270  xyz = cmsCreateXYZProfileTHR(s->ctx);
271  if (!xyz)
272  return AVERROR(ENOMEM);
273 
274  /* We need to use an unadapted observer to get the raw values */
275  prev_adapt = cmsSetAdaptationStateTHR(s->ctx, 0.0);
276  tf = cmsCreateTransformTHR(s->ctx, profile, TYPE_RGB_8, xyz, TYPE_XYZ_DBL,
277  INTENT_ABSOLUTE_COLORIMETRIC,
278  /* Note: These flags mostly don't do anything
279  * anyway, but specify them regardless */
280  cmsFLAGS_NOCACHE |
281  cmsFLAGS_NOOPTIMIZE |
282  cmsFLAGS_LOWRESPRECALC |
283  cmsFLAGS_GRIDPOINTS(2));
284  cmsSetAdaptationStateTHR(s->ctx, prev_adapt);
285  cmsCloseProfile(xyz);
286  if (!tf) {
287  av_log(s->avctx, AV_LOG_ERROR, "Invalid ICC profile (e.g. CMYK)\n");
288  return AVERROR_INVALIDDATA;
289  }
290 
291  cmsDoTransform(tf, testprimaries, dst, 4);
292  cmsDeleteTransform(tf);
293  XYZ_xy(dst[0], &prim->r);
294  XYZ_xy(dst[1], &prim->g);
295  XYZ_xy(dst[2], &prim->b);
296  XYZ_xy(dst[3], wp);
297  return 0;
298 }
299 
301  enum AVColorTransferCharacteristic *out_trc)
302 {
303  /* 8-bit linear grayscale ramp */
304  static const uint8_t testramp[16][3] = {
305  { 1, 1, 1}, /* avoid exact zero due to log100 etc. */
306  { 17, 17, 17},
307  { 34, 34, 34},
308  { 51, 51, 51},
309  { 68, 68, 68},
310  { 85, 85, 85},
311  { 02, 02, 02},
312  {119, 119, 119},
313  {136, 136, 136},
314  {153, 153, 153},
315  {170, 170, 170},
316  {187, 187, 187},
317  {204, 204, 204},
318  {221, 221, 221},
319  {238, 238, 238},
320  {255, 255, 255},
321  };
322 
323  double dst[FF_ARRAY_ELEMS(testramp)];
324 
325  for (enum AVColorTransferCharacteristic trc = 0; trc < AVCOL_TRC_NB; trc++) {
326  cmsToneCurve *tonecurve;
327  cmsHPROFILE ref;
328  cmsHTRANSFORM tf;
329  double delta = 0.0;
330  if (get_curve(s, trc, &tonecurve) < 0)
331  continue;
332 
333  ref = cmsCreateGrayProfileTHR(s->ctx, cmsD50_xyY(), tonecurve);
334  if (!ref)
335  return AVERROR(ENOMEM);
336 
337  tf = cmsCreateTransformTHR(s->ctx, profile, TYPE_RGB_8, ref, TYPE_GRAY_DBL,
338  INTENT_RELATIVE_COLORIMETRIC,
339  cmsFLAGS_NOCACHE | cmsFLAGS_NOOPTIMIZE);
340  cmsCloseProfile(ref);
341  if (!tf) {
342  av_log(s->avctx, AV_LOG_ERROR, "Invalid ICC profile (e.g. CMYK)\n");
343  return AVERROR_INVALIDDATA;
344  }
345 
346  cmsDoTransform(tf, testramp, dst, FF_ARRAY_ELEMS(dst));
347  cmsDeleteTransform(tf);
348 
349  for (int i = 0; i < FF_ARRAY_ELEMS(dst); i++)
350  delta += fabs(testramp[i][0] / 255.0 - dst[i]);
351  if (delta < 0.01) {
352  *out_trc = trc;
353  return 0;
354  }
355  }
356 
357  *out_trc = AVCOL_TRC_UNSPECIFIED;
358  return 0;
359 }
error
static void error(const char *err)
Definition: target_bsf_fuzzer.c:32
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:216
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
ff_icc_profile_read_primaries
int ff_icc_profile_read_primaries(FFIccContext *s, cmsHPROFILE profile, AVColorPrimariesDesc *out_primaries)
Read the color primaries and white point coefficients encoded by an ICC profile, and return the raw v...
Definition: fflcms2.c:253
AVColorTransferCharacteristic
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition: pixfmt.h:666
curves
static const Curve curves[]
Definition: vf_pseudocolor.c:192
AVColorPrimariesDesc::wp
AVWhitepointCoefficients wp
Definition: csp.h:79
AVColorPrimariesDesc
Struct that contains both white point location and primaries location, providing the complete descrip...
Definition: csp.h:78
XYZ
#define XYZ(X, Y, Z)
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:90
AVCOL_TRC_LINEAR
@ AVCOL_TRC_LINEAR
"Linear transfer characteristics"
Definition: pixfmt.h:675
av_div_q
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
Definition: rational.c:88
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:427
AVCOL_TRC_NB
@ AVCOL_TRC_NB
Not part of ABI.
Definition: pixfmt.h:688
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:669
AVCOL_TRC_BT2020_12
@ AVCOL_TRC_BT2020_12
ITU-R BT2020 for 12-bit system.
Definition: pixfmt.h:682
AVColorPrimaries
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:636
av_sub_q
AVRational av_sub_q(AVRational b, AVRational c)
Subtract one rational from another.
Definition: rational.c:101
ff_icc_profile_attach
int ff_icc_profile_attach(FFIccContext *s, cmsHPROFILE profile, AVFrame *frame)
Attach an ICC profile to a frame.
Definition: fflcms2.c:170
XYZ_xy
static av_always_inline void XYZ_xy(cmsCIEXYZ XYZ, AVCIExy *xy)
Definition: fflcms2.c:195
AVCOL_TRC_IEC61966_2_1
@ AVCOL_TRC_IEC61966_2_1
IEC 61966-2-1 (sRGB or sYCC)
Definition: pixfmt.h:680
ff_icc_context_init
int ff_icc_context_init(FFIccContext *s, void *avctx)
Initializes an FFIccContext.
Definition: fflcms2.c:30
AVPrimaryCoefficients
Struct defining the red, green, and blue primary locations in terms of CIE 1931 chromaticity x and y.
Definition: csp.h:64
AVCOL_TRC_GAMMA28
@ AVCOL_TRC_GAMMA28
also ITU-R BT470BG
Definition: pixfmt.h:672
AVCOL_TRC_LOG_SQRT
@ AVCOL_TRC_LOG_SQRT
"Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
Definition: pixfmt.h:677
AVCOL_TRC_GAMMA22
@ AVCOL_TRC_GAMMA22
also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
Definition: pixfmt.h:671
wp_d50
static const AVCIExy wp_d50
Definition: fflcms2.c:209
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
get_curve
static int get_curve(FFIccContext *s, enum AVColorTransferCharacteristic trc, cmsToneCurve **out_curve)
Definition: fflcms2.c:50
s
#define s(width, name)
Definition: cbs_vp9.c:198
av_csp_primaries_desc_from_id
const AVColorPrimariesDesc * av_csp_primaries_desc_from_id(enum AVColorPrimaries prm)
Retrieves a complete gamut description from an enum constant describing the color primaries.
Definition: csp.c:95
AVCOL_TRC_BT1361_ECG
@ AVCOL_TRC_BT1361_ECG
ITU-R BT1361 Extended Colour Gamut.
Definition: pixfmt.h:679
av_q2d
static double av_q2d(AVRational a)
Convert an AVRational to a double.
Definition: rational.h:104
ctx
AVFormatContext * ctx
Definition: movenc.c:49
ff_icc_context_uninit
void ff_icc_context_uninit(FFIccContext *s)
Definition: fflcms2.c:42
fabs
static __device__ float fabs(float a)
Definition: cuda_runtime.h:182
NULL
#define NULL
Definition: coverity.c:32
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
av_buffer_unref
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Definition: buffer.c:139
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVCOL_TRC_IEC61966_2_4
@ AVCOL_TRC_IEC61966_2_4
IEC 61966-2-4.
Definition: pixfmt.h:678
AV_FRAME_DATA_ICC_PROFILE
@ AV_FRAME_DATA_ICC_PROFILE
The data contains an ICC profile as an opaque octet buffer following the format described by ISO 1507...
Definition: frame.h:144
av_frame_new_side_data_from_buf
AVFrameSideData * av_frame_new_side_data_from_buf(AVFrame *frame, enum AVFrameSideDataType type, AVBufferRef *buf)
Add a new side data to a frame from an existing AVBufferRef.
Definition: frame.c:638
AVCOL_TRC_BT2020_10
@ AVCOL_TRC_BT2020_10
ITU-R BT2020 for 10-bit system.
Definition: pixfmt.h:681
abs
#define abs(x)
Definition: cuda_runtime.h:35
ff_icc_profile_detect_transfer
int ff_icc_profile_detect_transfer(FFIccContext *s, cmsHPROFILE profile, enum AVColorTransferCharacteristic *out_trc)
Attempt detecting the transfer characteristic that best approximates the transfer function encoded by...
Definition: fflcms2.c:300
AVCIExy
Struct containing chromaticity x and y values for the standard CIE 1931 chromaticity definition.
Definition: csp.h:56
fflcms2.h
ff_icc_profile_generate
int ff_icc_profile_generate(FFIccContext *s, enum AVColorPrimaries color_prim, enum AVColorTransferCharacteristic color_trc, cmsHPROFILE *out_profile)
Generate an ICC profile for a given combination of color primaries and transfer function.
Definition: fflcms2.c:143
AVCIExy::x
AVRational x
Definition: csp.h:57
AVCOL_TRC_SMPTE2084
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
Definition: pixfmt.h:683
AVPrimaryCoefficients::b
AVCIExy b
Definition: csp.h:65
AVPrimaryCoefficients::r
AVCIExy r
Definition: csp.h:65
AVCOL_TRC_SMPTE240M
@ AVCOL_TRC_SMPTE240M
Definition: pixfmt.h:674
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
AVCOL_TRC_LOG
@ AVCOL_TRC_LOG
"Logarithmic transfer characteristic (100:1 range)"
Definition: pixfmt.h:676
size
int size
Definition: twinvq_data.h:10344
av_make_q
static AVRational av_make_q(int num, int den)
Create an AVRational.
Definition: rational.h:71
AVPrimaryCoefficients::g
AVCIExy g
Definition: csp.h:65
diff
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
Definition: vf_paletteuse.c:166
csp.h
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
av_buffer_alloc
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
Definition: buffer.c:77
fixed
#define fixed(width, name, value)
Definition: cbs_apv.c:75
AVBufferRef::size
size_t size
Size of data in bytes.
Definition: buffer.h:94
AVCOL_TRC_BT709
@ AVCOL_TRC_BT709
also ITU-R BT1361
Definition: pixfmt.h:668
FFIccContext
Definition: fflcms2.h:34
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
delta
float delta
Definition: vorbis_enc_data.h:430
av_always_inline
#define av_always_inline
Definition: attributes.h:63
av_d2q
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
Definition: rational.c:106
profile
int profile
Definition: mxfenc.c:2297
av_cmp_q
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:89
ret
ret
Definition: filter_design.txt:187
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:265
AVCIExy::y
AVRational y
Definition: csp.h:57
AVCOL_TRC_ARIB_STD_B67
@ AVCOL_TRC_ARIB_STD_B67
ARIB STD-B67, known as "Hybrid log-gamma".
Definition: pixfmt.h:687
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
AVCOL_TRC_SMPTE170M
@ AVCOL_TRC_SMPTE170M
also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
Definition: pixfmt.h:673
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
ff_icc_profile_sanitize
int ff_icc_profile_sanitize(FFIccContext *s, cmsHPROFILE profile)
Sanitize an ICC profile to try and fix badly broken values.
Definition: fflcms2.c:211
AVCOL_TRC_V_LOG
@ AVCOL_TRC_V_LOG
Definition: pixfmt.h:692
av_add_q
AVRational av_add_q(AVRational b, AVRational c)
Add two rationals.
Definition: rational.c:93
AVColorPrimariesDesc::prim
AVPrimaryCoefficients prim
Definition: csp.h:80
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
AVCOL_TRC_SMPTE428
@ AVCOL_TRC_SMPTE428
SMPTE ST 428-1.
Definition: pixfmt.h:685
log_cb
static void log_cb(cmsContext ctx, cmsUInt32Number error, const char *str)
Definition: fflcms2.c:24
abs_sub_q
static av_always_inline AVRational abs_sub_q(AVRational r1, AVRational r2)
Definition: fflcms2.c:202