FFmpeg
format.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 Niklas Haas
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/avassert.h"
24 
25 #include "format.h"
26 
27 typedef struct FormatEntry {
28  uint8_t is_supported_in :1;
29  uint8_t is_supported_out :1;
31 } FormatEntry;
32 
33 /* Format support table for legacy swscale */
34 static const FormatEntry format_entries[] = {
35  [AV_PIX_FMT_YUV420P] = { 1, 1 },
36  [AV_PIX_FMT_YUYV422] = { 1, 1 },
37  [AV_PIX_FMT_RGB24] = { 1, 1 },
38  [AV_PIX_FMT_BGR24] = { 1, 1 },
39  [AV_PIX_FMT_YUV422P] = { 1, 1 },
40  [AV_PIX_FMT_YUV444P] = { 1, 1 },
41  [AV_PIX_FMT_YUV410P] = { 1, 1 },
42  [AV_PIX_FMT_YUV411P] = { 1, 1 },
43  [AV_PIX_FMT_GRAY8] = { 1, 1 },
44  [AV_PIX_FMT_MONOWHITE] = { 1, 1 },
45  [AV_PIX_FMT_MONOBLACK] = { 1, 1 },
46  [AV_PIX_FMT_PAL8] = { 1, 0 },
47  [AV_PIX_FMT_YUVJ420P] = { 1, 1 },
48  [AV_PIX_FMT_YUVJ411P] = { 1, 1 },
49  [AV_PIX_FMT_YUVJ422P] = { 1, 1 },
50  [AV_PIX_FMT_YUVJ444P] = { 1, 1 },
51  [AV_PIX_FMT_YVYU422] = { 1, 1 },
52  [AV_PIX_FMT_UYVY422] = { 1, 1 },
53  [AV_PIX_FMT_UYYVYY411] = { 1, 0 },
54  [AV_PIX_FMT_BGR8] = { 1, 1 },
55  [AV_PIX_FMT_BGR4] = { 0, 1 },
56  [AV_PIX_FMT_BGR4_BYTE] = { 1, 1 },
57  [AV_PIX_FMT_RGB8] = { 1, 1 },
58  [AV_PIX_FMT_RGB4] = { 0, 1 },
59  [AV_PIX_FMT_RGB4_BYTE] = { 1, 1 },
60  [AV_PIX_FMT_NV12] = { 1, 1 },
61  [AV_PIX_FMT_NV21] = { 1, 1 },
62  [AV_PIX_FMT_ARGB] = { 1, 1 },
63  [AV_PIX_FMT_RGBA] = { 1, 1 },
64  [AV_PIX_FMT_ABGR] = { 1, 1 },
65  [AV_PIX_FMT_BGRA] = { 1, 1 },
66  [AV_PIX_FMT_0RGB] = { 1, 1 },
67  [AV_PIX_FMT_RGB0] = { 1, 1 },
68  [AV_PIX_FMT_0BGR] = { 1, 1 },
69  [AV_PIX_FMT_BGR0] = { 1, 1 },
70  [AV_PIX_FMT_GRAY9BE] = { 1, 1 },
71  [AV_PIX_FMT_GRAY9LE] = { 1, 1 },
72  [AV_PIX_FMT_GRAY10BE] = { 1, 1 },
73  [AV_PIX_FMT_GRAY10LE] = { 1, 1 },
74  [AV_PIX_FMT_GRAY12BE] = { 1, 1 },
75  [AV_PIX_FMT_GRAY12LE] = { 1, 1 },
76  [AV_PIX_FMT_GRAY14BE] = { 1, 1 },
77  [AV_PIX_FMT_GRAY14LE] = { 1, 1 },
78  [AV_PIX_FMT_GRAY16BE] = { 1, 1 },
79  [AV_PIX_FMT_GRAY16LE] = { 1, 1 },
80  [AV_PIX_FMT_YUV440P] = { 1, 1 },
81  [AV_PIX_FMT_YUVJ440P] = { 1, 1 },
82  [AV_PIX_FMT_YUV440P10LE] = { 1, 1 },
83  [AV_PIX_FMT_YUV440P10BE] = { 1, 1 },
84  [AV_PIX_FMT_YUV440P12LE] = { 1, 1 },
85  [AV_PIX_FMT_YUV440P12BE] = { 1, 1 },
86  [AV_PIX_FMT_YUVA420P] = { 1, 1 },
87  [AV_PIX_FMT_YUVA422P] = { 1, 1 },
88  [AV_PIX_FMT_YUVA444P] = { 1, 1 },
89  [AV_PIX_FMT_YUVA420P9BE] = { 1, 1 },
90  [AV_PIX_FMT_YUVA420P9LE] = { 1, 1 },
91  [AV_PIX_FMT_YUVA422P9BE] = { 1, 1 },
92  [AV_PIX_FMT_YUVA422P9LE] = { 1, 1 },
93  [AV_PIX_FMT_YUVA444P9BE] = { 1, 1 },
94  [AV_PIX_FMT_YUVA444P9LE] = { 1, 1 },
95  [AV_PIX_FMT_YUVA420P10BE] = { 1, 1 },
96  [AV_PIX_FMT_YUVA420P10LE] = { 1, 1 },
97  [AV_PIX_FMT_YUVA422P10BE] = { 1, 1 },
98  [AV_PIX_FMT_YUVA422P10LE] = { 1, 1 },
99  [AV_PIX_FMT_YUVA444P10BE] = { 1, 1 },
100  [AV_PIX_FMT_YUVA444P10LE] = { 1, 1 },
101  [AV_PIX_FMT_YUVA420P16BE] = { 1, 1 },
102  [AV_PIX_FMT_YUVA420P16LE] = { 1, 1 },
103  [AV_PIX_FMT_YUVA422P16BE] = { 1, 1 },
104  [AV_PIX_FMT_YUVA422P16LE] = { 1, 1 },
105  [AV_PIX_FMT_YUVA444P16BE] = { 1, 1 },
106  [AV_PIX_FMT_YUVA444P16LE] = { 1, 1 },
107  [AV_PIX_FMT_RGB48BE] = { 1, 1 },
108  [AV_PIX_FMT_RGB48LE] = { 1, 1 },
109  [AV_PIX_FMT_RGBA64BE] = { 1, 1, 1 },
110  [AV_PIX_FMT_RGBA64LE] = { 1, 1, 1 },
111  [AV_PIX_FMT_RGB565BE] = { 1, 1 },
112  [AV_PIX_FMT_RGB565LE] = { 1, 1 },
113  [AV_PIX_FMT_RGB555BE] = { 1, 1 },
114  [AV_PIX_FMT_RGB555LE] = { 1, 1 },
115  [AV_PIX_FMT_BGR565BE] = { 1, 1 },
116  [AV_PIX_FMT_BGR565LE] = { 1, 1 },
117  [AV_PIX_FMT_BGR555BE] = { 1, 1 },
118  [AV_PIX_FMT_BGR555LE] = { 1, 1 },
119  [AV_PIX_FMT_YUV420P16LE] = { 1, 1 },
120  [AV_PIX_FMT_YUV420P16BE] = { 1, 1 },
121  [AV_PIX_FMT_YUV422P16LE] = { 1, 1 },
122  [AV_PIX_FMT_YUV422P16BE] = { 1, 1 },
123  [AV_PIX_FMT_YUV444P16LE] = { 1, 1 },
124  [AV_PIX_FMT_YUV444P16BE] = { 1, 1 },
125  [AV_PIX_FMT_RGB444LE] = { 1, 1 },
126  [AV_PIX_FMT_RGB444BE] = { 1, 1 },
127  [AV_PIX_FMT_BGR444LE] = { 1, 1 },
128  [AV_PIX_FMT_BGR444BE] = { 1, 1 },
129  [AV_PIX_FMT_YA8] = { 1, 1 },
130  [AV_PIX_FMT_YA16BE] = { 1, 1 },
131  [AV_PIX_FMT_YA16LE] = { 1, 1 },
132  [AV_PIX_FMT_BGR48BE] = { 1, 1 },
133  [AV_PIX_FMT_BGR48LE] = { 1, 1 },
134  [AV_PIX_FMT_BGRA64BE] = { 1, 1, 1 },
135  [AV_PIX_FMT_BGRA64LE] = { 1, 1, 1 },
136  [AV_PIX_FMT_YUV420P9BE] = { 1, 1 },
137  [AV_PIX_FMT_YUV420P9LE] = { 1, 1 },
138  [AV_PIX_FMT_YUV420P10BE] = { 1, 1 },
139  [AV_PIX_FMT_YUV420P10LE] = { 1, 1 },
140  [AV_PIX_FMT_YUV420P12BE] = { 1, 1 },
141  [AV_PIX_FMT_YUV420P12LE] = { 1, 1 },
142  [AV_PIX_FMT_YUV420P14BE] = { 1, 1 },
143  [AV_PIX_FMT_YUV420P14LE] = { 1, 1 },
144  [AV_PIX_FMT_YUV422P9BE] = { 1, 1 },
145  [AV_PIX_FMT_YUV422P9LE] = { 1, 1 },
146  [AV_PIX_FMT_YUV422P10BE] = { 1, 1 },
147  [AV_PIX_FMT_YUV422P10LE] = { 1, 1 },
148  [AV_PIX_FMT_YUV422P12BE] = { 1, 1 },
149  [AV_PIX_FMT_YUV422P12LE] = { 1, 1 },
150  [AV_PIX_FMT_YUV422P14BE] = { 1, 1 },
151  [AV_PIX_FMT_YUV422P14LE] = { 1, 1 },
152  [AV_PIX_FMT_YUV444P9BE] = { 1, 1 },
153  [AV_PIX_FMT_YUV444P9LE] = { 1, 1 },
154  [AV_PIX_FMT_YUV444P10BE] = { 1, 1 },
155  [AV_PIX_FMT_YUV444P10LE] = { 1, 1 },
156  [AV_PIX_FMT_YUV444P12BE] = { 1, 1 },
157  [AV_PIX_FMT_YUV444P12LE] = { 1, 1 },
158  [AV_PIX_FMT_YUV444P14BE] = { 1, 1 },
159  [AV_PIX_FMT_YUV444P14LE] = { 1, 1 },
160  [AV_PIX_FMT_GBRP] = { 1, 1 },
161  [AV_PIX_FMT_GBRP9LE] = { 1, 1 },
162  [AV_PIX_FMT_GBRP9BE] = { 1, 1 },
163  [AV_PIX_FMT_GBRP10LE] = { 1, 1 },
164  [AV_PIX_FMT_GBRP10BE] = { 1, 1 },
165  [AV_PIX_FMT_GBRAP10LE] = { 1, 1 },
166  [AV_PIX_FMT_GBRAP10BE] = { 1, 1 },
167  [AV_PIX_FMT_GBRP12LE] = { 1, 1 },
168  [AV_PIX_FMT_GBRP12BE] = { 1, 1 },
169  [AV_PIX_FMT_GBRAP12LE] = { 1, 1 },
170  [AV_PIX_FMT_GBRAP12BE] = { 1, 1 },
171  [AV_PIX_FMT_GBRP14LE] = { 1, 1 },
172  [AV_PIX_FMT_GBRP14BE] = { 1, 1 },
173  [AV_PIX_FMT_GBRAP14LE] = { 1, 1 },
174  [AV_PIX_FMT_GBRAP14BE] = { 1, 1 },
175  [AV_PIX_FMT_GBRP16LE] = { 1, 1 },
176  [AV_PIX_FMT_GBRP16BE] = { 1, 1 },
177  [AV_PIX_FMT_GBRPF32LE] = { 1, 1 },
178  [AV_PIX_FMT_GBRPF32BE] = { 1, 1 },
179  [AV_PIX_FMT_GBRAPF32LE] = { 1, 1 },
180  [AV_PIX_FMT_GBRAPF32BE] = { 1, 1 },
181  [AV_PIX_FMT_GBRPF16LE] = { 1, 0 },
182  [AV_PIX_FMT_GBRPF16BE] = { 1, 0 },
183  [AV_PIX_FMT_GBRAPF16LE] = { 1, 0 },
184  [AV_PIX_FMT_GBRAPF16BE] = { 1, 0 },
185  [AV_PIX_FMT_GBRAP] = { 1, 1 },
186  [AV_PIX_FMT_GBRAP16LE] = { 1, 1 },
187  [AV_PIX_FMT_GBRAP16BE] = { 1, 1 },
188  [AV_PIX_FMT_BAYER_BGGR8] = { 1, 0 },
189  [AV_PIX_FMT_BAYER_RGGB8] = { 1, 0 },
190  [AV_PIX_FMT_BAYER_GBRG8] = { 1, 0 },
191  [AV_PIX_FMT_BAYER_GRBG8] = { 1, 0 },
192  [AV_PIX_FMT_BAYER_BGGR16LE] = { 1, 0 },
193  [AV_PIX_FMT_BAYER_BGGR16BE] = { 1, 0 },
194  [AV_PIX_FMT_BAYER_RGGB16LE] = { 1, 0 },
195  [AV_PIX_FMT_BAYER_RGGB16BE] = { 1, 0 },
196  [AV_PIX_FMT_BAYER_GBRG16LE] = { 1, 0 },
197  [AV_PIX_FMT_BAYER_GBRG16BE] = { 1, 0 },
198  [AV_PIX_FMT_BAYER_GRBG16LE] = { 1, 0 },
199  [AV_PIX_FMT_BAYER_GRBG16BE] = { 1, 0 },
200  [AV_PIX_FMT_XYZ12BE] = { 1, 1, 1 },
201  [AV_PIX_FMT_XYZ12LE] = { 1, 1, 1 },
202  [AV_PIX_FMT_AYUV64LE] = { 1, 1},
203  [AV_PIX_FMT_AYUV64BE] = { 1, 1 },
204  [AV_PIX_FMT_P010LE] = { 1, 1 },
205  [AV_PIX_FMT_P010BE] = { 1, 1 },
206  [AV_PIX_FMT_P012LE] = { 1, 1 },
207  [AV_PIX_FMT_P012BE] = { 1, 1 },
208  [AV_PIX_FMT_P016LE] = { 1, 1 },
209  [AV_PIX_FMT_P016BE] = { 1, 1 },
210  [AV_PIX_FMT_GRAYF32LE] = { 1, 1 },
211  [AV_PIX_FMT_GRAYF32BE] = { 1, 1 },
212  [AV_PIX_FMT_GRAYF16LE] = { 1, 0 },
213  [AV_PIX_FMT_GRAYF16BE] = { 1, 0 },
214  [AV_PIX_FMT_YAF32LE] = { 1, 0 },
215  [AV_PIX_FMT_YAF32BE] = { 1, 0 },
216  [AV_PIX_FMT_YAF16LE] = { 1, 0 },
217  [AV_PIX_FMT_YAF16BE] = { 1, 0 },
218  [AV_PIX_FMT_YUVA422P12BE] = { 1, 1 },
219  [AV_PIX_FMT_YUVA422P12LE] = { 1, 1 },
220  [AV_PIX_FMT_YUVA444P12BE] = { 1, 1 },
221  [AV_PIX_FMT_YUVA444P12LE] = { 1, 1 },
222  [AV_PIX_FMT_NV24] = { 1, 1 },
223  [AV_PIX_FMT_NV42] = { 1, 1 },
224  [AV_PIX_FMT_Y210LE] = { 1, 1 },
225  [AV_PIX_FMT_Y212LE] = { 1, 1 },
226  [AV_PIX_FMT_Y216LE] = { 1, 1 },
227  [AV_PIX_FMT_X2RGB10LE] = { 1, 1 },
228  [AV_PIX_FMT_X2BGR10LE] = { 1, 1 },
229  [AV_PIX_FMT_P210BE] = { 1, 1 },
230  [AV_PIX_FMT_P210LE] = { 1, 1 },
231  [AV_PIX_FMT_P212BE] = { 1, 1 },
232  [AV_PIX_FMT_P212LE] = { 1, 1 },
233  [AV_PIX_FMT_P410BE] = { 1, 1 },
234  [AV_PIX_FMT_P410LE] = { 1, 1 },
235  [AV_PIX_FMT_P412BE] = { 1, 1 },
236  [AV_PIX_FMT_P412LE] = { 1, 1 },
237  [AV_PIX_FMT_P216BE] = { 1, 1 },
238  [AV_PIX_FMT_P216LE] = { 1, 1 },
239  [AV_PIX_FMT_P416BE] = { 1, 1 },
240  [AV_PIX_FMT_P416LE] = { 1, 1 },
241  [AV_PIX_FMT_NV16] = { 1, 1 },
242  [AV_PIX_FMT_VUYA] = { 1, 1 },
243  [AV_PIX_FMT_VUYX] = { 1, 1 },
244  [AV_PIX_FMT_RGBAF16BE] = { 1, 0 },
245  [AV_PIX_FMT_RGBAF16LE] = { 1, 0 },
246  [AV_PIX_FMT_RGBF16BE] = { 1, 0 },
247  [AV_PIX_FMT_RGBF16LE] = { 1, 0 },
248  [AV_PIX_FMT_RGBF32BE] = { 1, 0 },
249  [AV_PIX_FMT_RGBF32LE] = { 1, 0 },
250  [AV_PIX_FMT_XV30LE] = { 1, 1 },
251  [AV_PIX_FMT_XV36LE] = { 1, 1 },
252  [AV_PIX_FMT_XV36BE] = { 1, 1 },
253  [AV_PIX_FMT_XV48LE] = { 1, 1 },
254  [AV_PIX_FMT_XV48BE] = { 1, 1 },
255  [AV_PIX_FMT_AYUV] = { 1, 1 },
256  [AV_PIX_FMT_UYVA] = { 1, 1 },
257  [AV_PIX_FMT_VYU444] = { 1, 1 },
258  [AV_PIX_FMT_V30XLE] = { 1, 1 },
259 };
260 
262 {
263  return (unsigned)pix_fmt < FF_ARRAY_ELEMS(format_entries) ?
265 }
266 
268 {
269  return (unsigned)pix_fmt < FF_ARRAY_ELEMS(format_entries) ?
271 }
272 
274 {
275  return (unsigned)pix_fmt < FF_ARRAY_ELEMS(format_entries) ?
277 }
278 
279 /**
280  * This function also sanitizes and strips the input data, removing irrelevant
281  * fields for certain formats.
282  */
284 {
287  AVFrameSideData *sd;
288 
289  SwsFormat fmt = {
290  .width = frame->width,
291  .height = frame->height,
292  .format = frame->format,
293  .range = frame->color_range,
294  .csp = frame->colorspace,
295  .loc = frame->chroma_location,
296  .desc = desc,
297  .color = {
298  .prim = frame->color_primaries,
299  .trc = frame->color_trc,
300  },
301  };
302 
303  av_assert1(fmt.width > 0);
304  av_assert1(fmt.height > 0);
306  av_assert0(desc);
308  /* RGB-like family */
309  fmt.csp = AVCOL_SPC_RGB;
310  fmt.range = AVCOL_RANGE_JPEG;
311  } else if (desc->flags & AV_PIX_FMT_FLAG_XYZ) {
313  fmt.color = (SwsColor) {
314  .prim = AVCOL_PRI_BT709, /* swscale currently hard-codes this XYZ matrix */
315  .trc = AVCOL_TRC_SMPTE428,
316  };
317  } else if (desc->nb_components < 3) {
318  /* Grayscale formats */
321  if (desc->flags & AV_PIX_FMT_FLAG_FLOAT)
323  else
324  fmt.range = AVCOL_RANGE_JPEG; // FIXME: this restriction should be lifted
325  }
326 
327  switch (frame->format) {
328  case AV_PIX_FMT_YUVJ420P:
329  case AV_PIX_FMT_YUVJ411P:
330  case AV_PIX_FMT_YUVJ422P:
331  case AV_PIX_FMT_YUVJ444P:
332  case AV_PIX_FMT_YUVJ440P:
333  fmt.range = AVCOL_RANGE_JPEG;
334  break;
335  }
336 
337  if (!desc->log2_chroma_w && !desc->log2_chroma_h)
339 
340  if (frame->flags & AV_FRAME_FLAG_INTERLACED) {
341  fmt.height = (fmt.height + (field == FIELD_TOP)) >> 1;
342  fmt.interlaced = 1;
343  }
344 
345  /* Set luminance and gamut information */
346  fmt.color.min_luma = av_make_q(0, 1);
347  switch (fmt.color.trc) {
348  case AVCOL_TRC_SMPTE2084:
349  fmt.color.max_luma = av_make_q(10000, 1); break;
351  fmt.color.max_luma = av_make_q( 1000, 1); break; /* HLG reference display */
352  default:
353  fmt.color.max_luma = av_make_q( 203, 1); break; /* SDR reference brightness */
354  }
355 
357  if (primaries)
358  fmt.color.gamut = primaries->prim;
359 
362  if (mdm->has_luminance) {
363  fmt.color.min_luma = mdm->min_luminance;
364  fmt.color.max_luma = mdm->max_luminance;
365  }
366 
367  if (mdm->has_primaries) {
368  /* Ignore mastering display white point as it has no bearance on
369  * the underlying content */
370  fmt.color.gamut.r.x = mdm->display_primaries[0][0];
371  fmt.color.gamut.r.y = mdm->display_primaries[0][1];
372  fmt.color.gamut.g.x = mdm->display_primaries[1][0];
373  fmt.color.gamut.g.y = mdm->display_primaries[1][1];
374  fmt.color.gamut.b.x = mdm->display_primaries[2][0];
375  fmt.color.gamut.b.y = mdm->display_primaries[2][1];
376  }
377  }
378 
380  const AVDynamicHDRPlus *dhp = (const AVDynamicHDRPlus *) sd->data;
381  const AVHDRPlusColorTransformParams *pars = &dhp->params[0];
382  const AVRational nits = av_make_q(10000, 1);
383  AVRational maxrgb = pars->maxscl[0];
384 
385  if (!dhp->num_windows || dhp->application_version > 1)
386  goto skip_hdr10;
387 
388  /* Maximum of MaxSCL components */
389  if (av_cmp_q(pars->maxscl[1], maxrgb) > 0)
390  maxrgb = pars->maxscl[1];
391  if (av_cmp_q(pars->maxscl[2], maxrgb) > 0)
392  maxrgb = pars->maxscl[2];
393 
394  if (maxrgb.num > 0) {
395  /* Estimate true luminance from MaxSCL */
397  if (!luma)
398  goto skip_hdr10;
399  fmt.color.frame_peak = av_add_q(av_mul_q(luma->cr, pars->maxscl[0]),
400  av_add_q(av_mul_q(luma->cg, pars->maxscl[1]),
401  av_mul_q(luma->cb, pars->maxscl[2])));
402  /* Scale the scene average brightness by the ratio between the
403  * maximum luminance and the MaxRGB values */
404  fmt.color.frame_avg = av_mul_q(pars->average_maxrgb,
405  av_div_q(fmt.color.frame_peak, maxrgb));
406  } else {
407  /**
408  * Calculate largest value from histogram to use as fallback for
409  * clips with missing MaxSCL information. Note that this may end
410  * up picking the "reserved" value at the 5% percentile, which in
411  * practice appears to track the brightest pixel in the scene.
412  */
413  for (int i = 0; i < pars->num_distribution_maxrgb_percentiles; i++) {
414  const AVRational pct = pars->distribution_maxrgb[i].percentile;
415  if (av_cmp_q(pct, maxrgb) > 0)
416  maxrgb = pct;
417  fmt.color.frame_peak = maxrgb;
418  fmt.color.frame_avg = pars->average_maxrgb;
419  }
420  }
421 
422  /* Rescale to nits */
423  fmt.color.frame_peak = av_mul_q(nits, fmt.color.frame_peak);
424  fmt.color.frame_avg = av_mul_q(nits, fmt.color.frame_avg);
425  }
426 skip_hdr10:
427 
428  /* PQ is always scaled down to absolute zero, so ignore mastering metadata */
429  if (fmt.color.trc == AVCOL_TRC_SMPTE2084)
430  fmt.color.min_luma = av_make_q(0, 1);
431 
432  return fmt;
433 }
434 
435 static int infer_prim_ref(SwsColor *csp, const SwsColor *ref)
436 {
437  if (csp->prim != AVCOL_PRI_UNSPECIFIED)
438  return 0;
439 
440  /* Re-use the reference gamut only for "safe", similar primaries */
441  switch (ref->prim) {
442  case AVCOL_PRI_BT709:
443  case AVCOL_PRI_BT470M:
444  case AVCOL_PRI_BT470BG:
445  case AVCOL_PRI_SMPTE170M:
446  case AVCOL_PRI_SMPTE240M:
447  csp->prim = ref->prim;
448  csp->gamut = ref->gamut;
449  break;
450  default:
451  csp->prim = AVCOL_PRI_BT709;
453  break;
454  }
455 
456  return 1;
457 }
458 
459 static int infer_trc_ref(SwsColor *csp, const SwsColor *ref)
460 {
461  if (csp->trc != AVCOL_TRC_UNSPECIFIED)
462  return 0;
463 
464  /* Pick a suitable SDR transfer function, to try and minimize conversions */
465  switch (ref->trc) {
467  /* HDR curves, never default to these */
468  case AVCOL_TRC_SMPTE2084:
470  csp->trc = AVCOL_TRC_BT709;
471  csp->min_luma = av_make_q(0, 1);
472  csp->max_luma = av_make_q(203, 1);
473  break;
474  default:
475  csp->trc = ref->trc;
476  csp->min_luma = ref->min_luma;
477  csp->max_luma = ref->max_luma;
478  break;
479  }
480 
481  return 1;
482 }
483 
485 {
486  int incomplete = 0;
487 
488  incomplete |= infer_prim_ref(dst, src);
489  incomplete |= infer_prim_ref(src, dst);
492 
493  incomplete |= infer_trc_ref(dst, src);
494  incomplete |= infer_trc_ref(src, dst);
497 
498  return incomplete;
499 }
500 
502 {
504 }
505 
507 {
508  switch (csp) {
510  case AVCOL_SPC_RGB:
511  case AVCOL_SPC_BT709:
512  case AVCOL_SPC_BT470BG:
513  case AVCOL_SPC_SMPTE170M:
514  case AVCOL_SPC_FCC:
515  case AVCOL_SPC_SMPTE240M:
517  return 1;
518  default:
519  return 0;
520  }
521 }
522 
524 {
525  return prim > AVCOL_PRI_RESERVED0 && prim < AVCOL_PRI_NB &&
526  prim != AVCOL_PRI_RESERVED;
527 }
528 
530 {
532  : av_csp_itu_eotf(trc);
533  return trc == AVCOL_TRC_UNSPECIFIED || eotf != NULL;
534 }
535 
536 static int test_range(enum AVColorRange range)
537 {
538  return range >= 0 && range < AVCOL_RANGE_NB;
539 }
540 
541 static int test_loc(enum AVChromaLocation loc)
542 {
543  return loc >= 0 && loc < AVCHROMA_LOC_NB;
544 }
545 
546 int ff_test_fmt(const SwsFormat *fmt, int output)
547 {
548  return fmt->width > 0 && fmt->height > 0 &&
549  sws_test_format (fmt->format, output) &&
550  sws_test_colorspace(fmt->csp, output) &&
552  sws_test_transfer (fmt->color.trc, output) &&
553  test_range (fmt->range) &&
554  test_loc (fmt->loc);
555 }
556 
558 {
559  for (int field = 0; field < 2; field++) {
560  const SwsFormat fmt = ff_fmt_from_frame(frame, field);
561  if (!ff_test_fmt(&fmt, output))
562  return 0;
563  if (!fmt.interlaced)
564  break;
565  }
566 
567  return 1;
568 }
569 
570 int sws_is_noop(const AVFrame *dst, const AVFrame *src)
571 {
572  for (int field = 0; field < 2; field++) {
573  SwsFormat dst_fmt = ff_fmt_from_frame(dst, field);
574  SwsFormat src_fmt = ff_fmt_from_frame(src, field);
575  if (!ff_fmt_equal(&dst_fmt, &src_fmt))
576  return 0;
577  if (!dst_fmt.interlaced)
578  break;
579  }
580 
581  return 1;
582 }
AVCOL_PRI_RESERVED
@ AVCOL_PRI_RESERVED
Definition: pixfmt.h:619
AVLumaCoefficients::cr
AVRational cr
Definition: csp.h:49
AVMasteringDisplayMetadata::has_primaries
int has_primaries
Flag indicating whether the display primaries (and white point) are set.
Definition: mastering_display_metadata.h:62
ff_test_fmt
int ff_test_fmt(const SwsFormat *fmt, int output)
Definition: format.c:546
AV_PIX_FMT_XYZ12LE
@ AV_PIX_FMT_XYZ12LE
packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as lit...
Definition: pixfmt.h:196
AV_PIX_FMT_YUV420P9LE
@ AV_PIX_FMT_YUV420P9LE
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:154
AVDynamicHDRPlus::params
AVHDRPlusColorTransformParams params[3]
The color transform parameters for every processing window.
Definition: hdr_dynamic_metadata.h:264
AV_PIX_FMT_XV30LE
@ AV_PIX_FMT_XV30LE
packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb), little-endian, variant of Y410 where alpha channe...
Definition: pixfmt.h:415
AV_PIX_FMT_GRAY10BE
@ AV_PIX_FMT_GRAY10BE
Y , 10bpp, big-endian.
Definition: pixfmt.h:320
AVMasteringDisplayMetadata::max_luminance
AVRational max_luminance
Max luminance of mastering display (cd/m^2).
Definition: mastering_display_metadata.h:57
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
AV_PIX_FMT_BAYER_GBRG16LE
@ AV_PIX_FMT_BAYER_GBRG16LE
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian
Definition: pixfmt.h:293
AV_PIX_FMT_BGR48LE
@ AV_PIX_FMT_BGR48LE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
Definition: pixfmt.h:146
AV_PIX_FMT_P416BE
@ AV_PIX_FMT_P416BE
interleaved chroma YUV 4:4:4, 48bpp, big-endian
Definition: pixfmt.h:398
AV_PIX_FMT_YA8
@ AV_PIX_FMT_YA8
8 bits gray, 8 bits alpha
Definition: pixfmt.h:140
AV_PIX_FMT_BGRA64BE
@ AV_PIX_FMT_BGRA64BE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:204
AVColorTransferCharacteristic
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition: pixfmt.h:640
ff_fmt_from_frame
SwsFormat ff_fmt_from_frame(const AVFrame *frame, int field)
This function also sanitizes and strips the input data, removing irrelevant fields for certain format...
Definition: format.c:283
av_frame_get_side_data
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:693
AV_PIX_FMT_RGB444LE
@ AV_PIX_FMT_RGB444LE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:136
AV_PIX_FMT_GBRP16BE
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
Definition: pixfmt.h:171
SwsFormat::interlaced
int interlaced
Definition: format.h:77
AVColorPrimariesDesc
Struct that contains both white point location and primaries location, providing the complete descrip...
Definition: csp.h:78
AV_PIX_FMT_GBRP10BE
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
Definition: pixfmt.h:169
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3313
AV_PIX_FMT_YUV422P14LE
@ AV_PIX_FMT_YUV422P14LE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:274
av_div_q
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
Definition: rational.c:88
AVMasteringDisplayMetadata::display_primaries
AVRational display_primaries[3][2]
CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
Definition: mastering_display_metadata.h:42
AVMasteringDisplayMetadata::has_luminance
int has_luminance
Flag indicating whether the luminance (min_ and max_) have been set.
Definition: mastering_display_metadata.h:67
output
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
Definition: filter_design.txt:225
AV_PIX_FMT_RGBF16LE
@ AV_PIX_FMT_RGBF16LE
IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., little-endian.
Definition: pixfmt.h:452
AV_PIX_FMT_FLAG_FLOAT
#define AV_PIX_FMT_FLAG_FLOAT
The pixel format contains IEEE-754 floating point values.
Definition: pixdesc.h:158
AVHDRPlusColorTransformParams
Color transform parameters at a processing window in a dynamic metadata for SMPTE 2094-40.
Definition: hdr_dynamic_metadata.h:59
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:410
SwsFormat::range
enum AVColorRange range
Definition: format.h:79
AV_PIX_FMT_YUVA444P10BE
@ AV_PIX_FMT_YUVA444P10BE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:185
AV_PIX_FMT_RGBA64BE
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:202
AV_PIX_FMT_YUV440P12BE
@ AV_PIX_FMT_YUV440P12BE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:301
AV_PIX_FMT_GBRAPF32LE
@ AV_PIX_FMT_GBRAPF32LE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian.
Definition: pixfmt.h:344
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:746
AV_PIX_FMT_GBRPF32BE
@ AV_PIX_FMT_GBRPF32BE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian.
Definition: pixfmt.h:341
ff_infer_colors
int ff_infer_colors(SwsColor *src, SwsColor *dst)
Definition: format.c:484
av_csp_luma_coeffs_from_avcsp
const struct AVLumaCoefficients * av_csp_luma_coeffs_from_avcsp(enum AVColorSpace csp)
Retrieves the Luma coefficients necessary to construct a conversion matrix from an enum constant desc...
Definition: csp.c:58
AV_PIX_FMT_P412BE
@ AV_PIX_FMT_P412BE
interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, big-endian
Definition: pixfmt.h:429
sws_test_primaries
int sws_test_primaries(enum AVColorPrimaries prim, int output)
Test if a given set of color primaries is supported.
Definition: format.c:523
FIELD_TOP
@ FIELD_TOP
Definition: format.h:54
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:643
AV_PIX_FMT_P010BE
@ AV_PIX_FMT_P010BE
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits,...
Definition: pixfmt.h:308
AV_PIX_FMT_MONOWHITE
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
Definition: pixfmt.h:82
AV_PIX_FMT_YUV420P14BE
@ AV_PIX_FMT_YUV420P14BE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:269
AV_PIX_FMT_YUV420P16LE
@ AV_PIX_FMT_YUV420P16LE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:128
AVCOL_SPC_RGB
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
Definition: pixfmt.h:670
AV_PIX_FMT_GBRP14BE
@ AV_PIX_FMT_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
Definition: pixfmt.h:281
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:76
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:102
AVLumaCoefficients
Struct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar calculations.
Definition: csp.h:48
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
AVColorPrimaries
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:615
AV_PIX_FMT_YUV422P9BE
@ AV_PIX_FMT_YUV422P9BE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:163
AV_PIX_FMT_YUVA444P9BE
@ AV_PIX_FMT_YUVA444P9BE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:179
AV_PIX_FMT_BAYER_GRBG16BE
@ AV_PIX_FMT_BAYER_GRBG16BE
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian
Definition: pixfmt.h:296
format.h
AV_PIX_FMT_GRAY10LE
@ AV_PIX_FMT_GRAY10LE
Y , 10bpp, little-endian.
Definition: pixfmt.h:321
AV_PIX_FMT_GRAYF32LE
@ AV_PIX_FMT_GRAYF32LE
IEEE-754 single precision Y, 32bpp, little-endian.
Definition: pixfmt.h:364
AV_PIX_FMT_GBRAP14BE
@ AV_PIX_FMT_GBRAP14BE
planar GBR 4:4:4:4 56bpp, big-endian
Definition: pixfmt.h:432
AV_PIX_FMT_RGB555BE
@ AV_PIX_FMT_RGB555BE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
Definition: pixfmt.h:114
AV_PIX_FMT_RGBAF16LE
@ AV_PIX_FMT_RGBAF16LE
IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., little-endian.
Definition: pixfmt.h:404
AV_PIX_FMT_AYUV64LE
@ AV_PIX_FMT_AYUV64LE
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:302
AV_PIX_FMT_YUV444P16LE
@ AV_PIX_FMT_YUV444P16LE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:132
AV_PIX_FMT_BAYER_GBRG16BE
@ AV_PIX_FMT_BAYER_GBRG16BE
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian
Definition: pixfmt.h:294
AV_PIX_FMT_AYUV64BE
@ AV_PIX_FMT_AYUV64BE
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:303
AV_PIX_FMT_GBRAP12LE
@ AV_PIX_FMT_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
Definition: pixfmt.h:311
AV_PIX_FMT_GRAY16BE
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
Definition: pixfmt.h:104
SwsColor::gamut
AVPrimaryCoefficients gamut
Definition: format.h:61
primaries
enum AVColorPrimaries primaries
Definition: mediacodec_wrapper.c:2612
AVCOL_SPC_BT470BG
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
Definition: pixfmt.h:675
FormatEntry
Definition: format.c:27
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
AV_PIX_FMT_YUV420P12LE
@ AV_PIX_FMT_YUV420P12LE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:268
infer_prim_ref
static int infer_prim_ref(SwsColor *csp, const SwsColor *ref)
Definition: format.c:435
AV_PIX_FMT_GRAY9LE
@ AV_PIX_FMT_GRAY9LE
Y , 9bpp, little-endian.
Definition: pixfmt.h:339
AVCOL_RANGE_NB
@ AVCOL_RANGE_NB
Not part of ABI.
Definition: pixfmt.h:747
SwsColor::trc
enum AVColorTransferCharacteristic trc
Definition: format.h:60
AV_PIX_FMT_YUVA444P16BE
@ AV_PIX_FMT_YUVA444P16BE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:191
AVRational::num
int num
Numerator.
Definition: rational.h:59
AV_PIX_FMT_YUV444P10BE
@ AV_PIX_FMT_YUV444P10BE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:161
AV_PIX_FMT_YUV420P10LE
@ AV_PIX_FMT_YUV420P10LE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:156
AV_PIX_FMT_VUYA
@ AV_PIX_FMT_VUYA
packed VUYA 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), VUYAVUYA...
Definition: pixfmt.h:401
AV_PIX_FMT_YUV444P12LE
@ AV_PIX_FMT_YUV444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:276
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:283
FormatEntry::is_supported_endianness
uint8_t is_supported_endianness
Definition: format.c:30
AV_PIX_FMT_YUV422P12BE
@ AV_PIX_FMT_YUV422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:271
AV_PIX_FMT_YUV444P14LE
@ AV_PIX_FMT_YUV444P14LE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:278
AV_PIX_FMT_BGR8
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
Definition: pixfmt.h:90
avassert.h
AV_PIX_FMT_BAYER_RGGB16BE
@ AV_PIX_FMT_BAYER_RGGB16BE
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian
Definition: pixfmt.h:292
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
SwsFormat::height
int height
Definition: format.h:76
AVCOL_PRI_RESERVED0
@ AVCOL_PRI_RESERVED0
Definition: pixfmt.h:616
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:86
AV_PIX_FMT_GBRAP16BE
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
Definition: pixfmt.h:213
AV_PIX_FMT_GBRP16LE
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
Definition: pixfmt.h:172
AVCOL_PRI_NB
@ AVCOL_PRI_NB
Not part of ABI.
Definition: pixfmt.h:633
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_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:90
AV_PIX_FMT_P416LE
@ AV_PIX_FMT_P416LE
interleaved chroma YUV 4:4:4, 48bpp, little-endian
Definition: pixfmt.h:399
AV_PIX_FMT_BAYER_RGGB16LE
@ AV_PIX_FMT_BAYER_RGGB16LE
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian
Definition: pixfmt.h:291
AV_PIX_FMT_P210LE
@ AV_PIX_FMT_P210LE
interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, little-endian
Definition: pixfmt.h:390
format
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 format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
AV_PIX_FMT_BAYER_BGGR8
@ AV_PIX_FMT_BAYER_BGGR8
bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples
Definition: pixfmt.h:285
AVCOL_SPC_SMPTE170M
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
Definition: pixfmt.h:676
pix_fmt
static enum AVPixelFormat pix_fmt
Definition: demux_decode.c:41
AV_PIX_FMT_P016BE
@ AV_PIX_FMT_P016BE
like NV12, with 16bpp per component, big-endian
Definition: pixfmt.h:324
AV_PIX_FMT_GBRP12LE
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
Definition: pixfmt.h:280
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
AV_PIX_FMT_YUVA420P16BE
@ AV_PIX_FMT_YUVA420P16BE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:187
sws_test_colorspace
int sws_test_colorspace(enum AVColorSpace csp, int output)
Test if a given color space is supported.
Definition: format.c:506
AV_PIX_FMT_RGB4
@ AV_PIX_FMT_RGB4
packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in ...
Definition: pixfmt.h:94
field
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this field
Definition: writing_filters.txt:78
AVLumaCoefficients::cg
AVRational cg
Definition: csp.h:49
AV_PIX_FMT_GBRP10LE
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
Definition: pixfmt.h:170
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
AVCOL_PRI_SMPTE240M
@ AVCOL_PRI_SMPTE240M
identical to above, also called "SMPTE C" even though it uses D65
Definition: pixfmt.h:624
AV_PIX_FMT_GBRAPF16LE
@ AV_PIX_FMT_GBRAPF16LE
IEEE-754 half precision planar GBRA 4:4:4:4, 64bpp, little-endian.
Definition: pixfmt.h:469
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:618
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:100
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:87
AVCOL_PRI_BT470BG
@ AVCOL_PRI_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
Definition: pixfmt.h:622
AV_PIX_FMT_YUV444P10LE
@ AV_PIX_FMT_YUV444P10LE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:162
AV_PIX_FMT_BAYER_RGGB8
@ AV_PIX_FMT_BAYER_RGGB8
bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples
Definition: pixfmt.h:286
AVCOL_PRI_SMPTE170M
@ AVCOL_PRI_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
Definition: pixfmt.h:623
AV_PIX_FMT_YUVA422P10LE
@ AV_PIX_FMT_YUVA422P10LE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:184
if
if(ret)
Definition: filter_design.txt:179
AV_PIX_FMT_BAYER_GRBG16LE
@ AV_PIX_FMT_BAYER_GRBG16LE
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian
Definition: pixfmt.h:295
AV_PIX_FMT_YUV444P9BE
@ AV_PIX_FMT_YUV444P9BE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:159
SwsColor::frame_peak
AVRational frame_peak
Definition: format.h:64
AV_PIX_FMT_YUV422P10BE
@ AV_PIX_FMT_YUV422P10BE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:157
test_range
static int test_range(enum AVColorRange range)
Definition: format.c:536
AV_PIX_FMT_YUV422P16LE
@ AV_PIX_FMT_YUV422P16LE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:130
AV_PIX_FMT_RGB565LE
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
Definition: pixfmt.h:113
AVDynamicHDRPlus::application_version
uint8_t application_version
Application version in the application defining document in ST-2094 suite.
Definition: hdr_dynamic_metadata.h:253
AV_PIX_FMT_Y216LE
@ AV_PIX_FMT_Y216LE
packed YUV 4:2:2 like YUYV422, 32bpp, little-endian
Definition: pixfmt.h:461
AV_PIX_FMT_GBRAPF32BE
@ AV_PIX_FMT_GBRAPF32BE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian.
Definition: pixfmt.h:343
AV_PIX_FMT_GBRAP12BE
@ AV_PIX_FMT_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
Definition: pixfmt.h:310
AV_PIX_FMT_P012LE
@ AV_PIX_FMT_P012LE
like NV12, with 12bpp per component, data in the high bits, zeros in the low bits,...
Definition: pixfmt.h:408
NULL
#define NULL
Definition: coverity.c:32
AV_PIX_FMT_GBRAPF16BE
@ AV_PIX_FMT_GBRAPF16BE
IEEE-754 half precision planar GBRA 4:4:4:4, 64bpp, big-endian.
Definition: pixfmt.h:468
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:74
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
sws_is_noop
int sws_is_noop(const AVFrame *dst, const AVFrame *src)
Check if a given conversion is a noop.
Definition: format.c:570
AV_PIX_FMT_P210BE
@ AV_PIX_FMT_P210BE
interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, big-endian
Definition: pixfmt.h:389
AV_PIX_FMT_RGB48LE
@ AV_PIX_FMT_RGB48LE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
Definition: pixfmt.h:110
AV_PIX_FMT_YA16LE
@ AV_PIX_FMT_YA16LE
16 bits gray, 16 bits alpha (little-endian)
Definition: pixfmt.h:210
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:85
AV_PIX_FMT_MONOBLACK
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
Definition: pixfmt.h:83
AV_PIX_FMT_YUVA422P12LE
@ AV_PIX_FMT_YUVA422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian
Definition: pixfmt.h:367
AVCOL_PRI_BT709
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
Definition: pixfmt.h:617
AV_PIX_FMT_BGR565LE
@ AV_PIX_FMT_BGR565LE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
Definition: pixfmt.h:118
AV_PIX_FMT_RGBA64LE
@ AV_PIX_FMT_RGBA64LE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:203
AV_PIX_FMT_YUVA444P12BE
@ AV_PIX_FMT_YUVA444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian
Definition: pixfmt.h:368
sws_test_format
int sws_test_format(enum AVPixelFormat format, int output)
Test if a given pixel format is supported.
Definition: format.c:501
AV_PIX_FMT_YUVA444P9LE
@ AV_PIX_FMT_YUVA444P9LE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:180
AV_PIX_FMT_Y210LE
@ AV_PIX_FMT_Y210LE
packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, little-endian
Definition: pixfmt.h:382
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
Definition: frame.h:120
AV_PIX_FMT_YUVA420P16LE
@ AV_PIX_FMT_YUVA420P16LE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:188
AV_PIX_FMT_RGB8
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
Definition: pixfmt.h:93
AV_PIX_FMT_BGR0
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:265
AV_PIX_FMT_BGR4
@ AV_PIX_FMT_BGR4
packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in ...
Definition: pixfmt.h:91
AV_PIX_FMT_YUV440P10LE
@ AV_PIX_FMT_YUV440P10LE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:298
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
AV_PIX_FMT_BGR555BE
@ AV_PIX_FMT_BGR555BE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
Definition: pixfmt.h:119
AV_PIX_FMT_YUVA420P9LE
@ AV_PIX_FMT_YUVA420P9LE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
Definition: pixfmt.h:176
AV_PIX_FMT_YAF16BE
@ AV_PIX_FMT_YAF16BE
IEEE-754 half precision packed YA, 16 bits gray, 16 bits alpha, 32bpp, big-endian.
Definition: pixfmt.h:485
AV_PIX_FMT_ABGR
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:101
AVCOL_RANGE_UNSPECIFIED
@ AVCOL_RANGE_UNSPECIFIED
Definition: pixfmt.h:712
AV_PIX_FMT_YUV420P14LE
@ AV_PIX_FMT_YUV420P14LE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:270
AV_PIX_FMT_YUV444P14BE
@ AV_PIX_FMT_YUV444P14BE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:277
AV_PIX_FMT_BGR4_BYTE
@ AV_PIX_FMT_BGR4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
Definition: pixfmt.h:92
AVCIExy::x
AVRational x
Definition: csp.h:57
AV_PIX_FMT_X2RGB10LE
@ AV_PIX_FMT_X2RGB10LE
packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:384
AV_PIX_FMT_P212LE
@ AV_PIX_FMT_P212LE
interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, little-endian
Definition: pixfmt.h:427
AV_PIX_FMT_YUV420P9BE
@ AV_PIX_FMT_YUV420P9BE
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
Definition: pixfmt.h:153
AVCOL_TRC_SMPTE2084
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
Definition: pixfmt.h:657
AVPrimaryCoefficients::b
AVCIExy b
Definition: csp.h:65
AVPrimaryCoefficients::r
AVCIExy r
Definition: csp.h:65
AV_PIX_FMT_RGBF32BE
@ AV_PIX_FMT_RGBF32BE
IEEE-754 single precision packed RGB 32:32:32, 96bpp, RGBRGB..., big-endian.
Definition: pixfmt.h:420
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:75
AV_PIX_FMT_YUV440P12LE
@ AV_PIX_FMT_YUV440P12LE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:300
test_loc
static int test_loc(enum AVChromaLocation loc)
Definition: format.c:541
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
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
AV_PIX_FMT_BAYER_BGGR16LE
@ AV_PIX_FMT_BAYER_BGGR16LE
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian
Definition: pixfmt.h:289
AV_PIX_FMT_YUV420P12BE
@ AV_PIX_FMT_YUV420P12BE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:267
AV_PIX_FMT_YUV422P10LE
@ AV_PIX_FMT_YUV422P10LE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:158
AVDynamicHDRPlus::num_windows
uint8_t num_windows
The number of processing windows.
Definition: hdr_dynamic_metadata.h:259
AV_PIX_FMT_RGB444BE
@ AV_PIX_FMT_RGB444BE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
Definition: pixfmt.h:137
AV_PIX_FMT_XV36BE
@ AV_PIX_FMT_XV36BE
packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, big-endian,...
Definition: pixfmt.h:417
AV_PIX_FMT_YUV422P14BE
@ AV_PIX_FMT_YUV422P14BE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:273
AV_PIX_FMT_YA16BE
@ AV_PIX_FMT_YA16BE
16 bits gray, 16 bits alpha (big-endian)
Definition: pixfmt.h:209
av_make_q
static AVRational av_make_q(int num, int den)
Create an AVRational.
Definition: rational.h:71
AV_PIX_FMT_GRAY12LE
@ AV_PIX_FMT_GRAY12LE
Y , 12bpp, little-endian.
Definition: pixfmt.h:319
AV_PIX_FMT_GBRP9BE
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
Definition: pixfmt.h:167
AVFrameSideData::data
uint8_t * data
Definition: frame.h:267
AVPrimaryCoefficients::g
AVCIExy g
Definition: csp.h:65
AVCHROMA_LOC_UNSPECIFIED
@ AVCHROMA_LOC_UNSPECIFIED
Definition: pixfmt.h:766
SwsFormat
Definition: format.h:75
AV_PIX_FMT_YUV420P10BE
@ AV_PIX_FMT_YUV420P10BE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:155
AV_PIX_FMT_RGBAF16BE
@ AV_PIX_FMT_RGBAF16BE
IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., big-endian.
Definition: pixfmt.h:403
range
enum AVColorRange range
Definition: mediacodec_wrapper.c:2594
AV_PIX_FMT_NV16
@ AV_PIX_FMT_NV16
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:198
AV_PIX_FMT_BGR444BE
@ AV_PIX_FMT_BGR444BE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
Definition: pixfmt.h:139
AV_PIX_FMT_GBRP9LE
@ AV_PIX_FMT_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
Definition: pixfmt.h:168
SwsFormat::loc
enum AVChromaLocation loc
Definition: format.h:81
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
AV_PIX_FMT_GBRAP10LE
@ AV_PIX_FMT_GBRAP10LE
planar GBR 4:4:4:4 40bpp, little-endian
Definition: pixfmt.h:314
SwsColor
Definition: format.h:58
sws_test_transfer
int sws_test_transfer(enum AVColorTransferCharacteristic trc, int output)
Test if a given color transfer function is supported.
Definition: format.c:529
AV_PIX_FMT_BGR565BE
@ AV_PIX_FMT_BGR565BE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
Definition: pixfmt.h:117
AV_PIX_FMT_YAF32LE
@ AV_PIX_FMT_YAF32LE
IEEE-754 single precision packed YA, 32 bits gray, 32 bits alpha, 64bpp, little-endian.
Definition: pixfmt.h:483
AV_PIX_FMT_RGB0
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
Definition: pixfmt.h:263
sws_isSupportedInput
int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
Return a positive value if pix_fmt is a supported input format, 0 otherwise.
Definition: format.c:261
AV_PIX_FMT_P012BE
@ AV_PIX_FMT_P012BE
like NV12, with 12bpp per component, data in the high bits, zeros in the low bits,...
Definition: pixfmt.h:409
AV_PIX_FMT_P410LE
@ AV_PIX_FMT_P410LE
interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, little-endian
Definition: pixfmt.h:393
AV_PIX_FMT_YUVA420P10LE
@ AV_PIX_FMT_YUVA420P10LE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:182
SwsColor::frame_avg
AVRational frame_avg
Definition: format.h:65
AV_PIX_FMT_FLAG_BAYER
#define AV_PIX_FMT_FLAG_BAYER
The pixel format is following a Bayer pattern.
Definition: pixdesc.h:152
AVCOL_TRC_BT709
@ AVCOL_TRC_BT709
also ITU-R BT1361
Definition: pixfmt.h:642
AVChromaLocation
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:765
AV_PIX_FMT_AYUV
@ AV_PIX_FMT_AYUV
packed AYUV 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), AYUVAYUV...
Definition: pixfmt.h:442
AV_PIX_FMT_ARGB
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:99
AV_PIX_FMT_BGRA64LE
@ AV_PIX_FMT_BGRA64LE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:205
AV_PIX_FMT_YUVA422P10BE
@ AV_PIX_FMT_YUVA422P10BE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:183
AVCOL_SPC_SMPTE240M
@ AVCOL_SPC_SMPTE240M
derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
Definition: pixfmt.h:677
AV_PIX_FMT_UYVA
@ AV_PIX_FMT_UYVA
packed UYVA 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), UYVAUYVA...
Definition: pixfmt.h:444
AV_PIX_FMT_YUVA444P12LE
@ AV_PIX_FMT_YUVA444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian
Definition: pixfmt.h:369
AV_PIX_FMT_YUVA422P9BE
@ AV_PIX_FMT_YUVA422P9BE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
Definition: pixfmt.h:177
AV_PIX_FMT_RGB555LE
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:115
sws_isSupportedEndiannessConversion
int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt)
Definition: format.c:273
SwsFormat::format
enum AVPixelFormat format
Definition: format.h:78
AV_PIX_FMT_RGB48BE
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
Definition: pixfmt.h:109
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
FormatEntry::is_supported_in
uint8_t is_supported_in
Definition: format.c:28
AVCOL_SPC_BT2020_NCL
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
Definition: pixfmt.h:680
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:669
AV_PIX_FMT_GRAY9BE
@ AV_PIX_FMT_GRAY9BE
Y , 9bpp, big-endian.
Definition: pixfmt.h:338
AV_PIX_FMT_NV24
@ AV_PIX_FMT_NV24
planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:371
av_assert1
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:56
AV_PIX_FMT_YAF16LE
@ AV_PIX_FMT_YAF16LE
IEEE-754 half precision packed YA, 16 bits gray, 16 bits alpha, 32bpp, little-endian.
Definition: pixfmt.h:486
AV_PIX_FMT_BAYER_GBRG8
@ AV_PIX_FMT_BAYER_GBRG8
bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples
Definition: pixfmt.h:287
sws_isSupportedOutput
int sws_isSupportedOutput(enum AVPixelFormat pix_fmt)
Return a positive value if pix_fmt is a supported output format, 0 otherwise.
Definition: format.c:267
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:107
AV_PIX_FMT_XYZ12BE
@ AV_PIX_FMT_XYZ12BE
packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big...
Definition: pixfmt.h:197
SwsFormat::width
int width
Definition: format.h:76
sws_test_frame
int sws_test_frame(const AVFrame *frame, int output)
Helper function to run all sws_test_* against a frame, as well as testing the basic frame properties ...
Definition: format.c:557
AV_PIX_FMT_NV21
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
Definition: pixfmt.h:97
AVMasteringDisplayMetadata
Mastering display metadata capable of representing the color volume of the display used to master the...
Definition: mastering_display_metadata.h:38
AV_PIX_FMT_RGB4_BYTE
@ AV_PIX_FMT_RGB4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
Definition: pixfmt.h:95
AVCOL_SPC_UNSPECIFIED
@ AVCOL_SPC_UNSPECIFIED
Definition: pixfmt.h:672
AV_PIX_FMT_YUV444P16BE
@ AV_PIX_FMT_YUV444P16BE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:133
AV_PIX_FMT_GBRPF32LE
@ AV_PIX_FMT_GBRPF32LE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian.
Definition: pixfmt.h:342
AV_FRAME_FLAG_INTERLACED
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
Definition: frame.h:669
AV_PIX_FMT_NV42
@ AV_PIX_FMT_NV42
as above, but U and V bytes are swapped
Definition: pixfmt.h:372
av_csp_eotf_function
void(* av_csp_eotf_function)(double Lw, double Lb, double c[3])
Function pointer representing an ITU EOTF transfer for a given reference display configuration.
Definition: csp.h:162
AVDynamicHDRPlus
This struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2...
Definition: hdr_dynamic_metadata.h:243
av_cmp_q
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:89
AV_PIX_FMT_GBRAP16LE
@ AV_PIX_FMT_GBRAP16LE
planar GBRA 4:4:4:4 64bpp, little-endian
Definition: pixfmt.h:214
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:84
AV_PIX_FMT_GRAY12BE
@ AV_PIX_FMT_GRAY12BE
Y , 12bpp, big-endian.
Definition: pixfmt.h:318
AV_PIX_FMT_YVYU422
@ AV_PIX_FMT_YVYU422
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
Definition: pixfmt.h:207
AVCOL_PRI_BT470M
@ AVCOL_PRI_BT470M
also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition: pixfmt.h:620
AV_PIX_FMT_0BGR
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
Definition: pixfmt.h:264
AV_PIX_FMT_NV12
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:96
AV_PIX_FMT_Y212LE
@ AV_PIX_FMT_Y212LE
packed YUV 4:2:2 like YUYV422, 24bpp, data in the high bits, zeros in the low bits,...
Definition: pixfmt.h:412
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:264
AV_PIX_FMT_BAYER_BGGR16BE
@ AV_PIX_FMT_BAYER_BGGR16BE
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian
Definition: pixfmt.h:290
AV_PIX_FMT_P410BE
@ AV_PIX_FMT_P410BE
interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, big-endian
Definition: pixfmt.h:392
AV_PIX_FMT_P016LE
@ AV_PIX_FMT_P016LE
like NV12, with 16bpp per component, little-endian
Definition: pixfmt.h:323
ff_fmt_equal
static int ff_fmt_equal(const SwsFormat *fmt1, const SwsFormat *fmt2)
Definition: format.h:113
AVCIExy::y
AVRational y
Definition: csp.h:57
AV_PIX_FMT_GRAYF32BE
@ AV_PIX_FMT_GRAYF32BE
IEEE-754 single precision Y, 32bpp, big-endian.
Definition: pixfmt.h:363
AV_PIX_FMT_GRAYF16BE
@ AV_PIX_FMT_GRAYF16BE
IEEE-754 half precision Y, 16bpp, big-endian.
Definition: pixfmt.h:471
AV_PIX_FMT_RGBF16BE
@ AV_PIX_FMT_RGBF16BE
IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., big-endian.
Definition: pixfmt.h:451
AV_PIX_FMT_GBRP12BE
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
Definition: pixfmt.h:279
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:88
AV_PIX_FMT_YUV444P12BE
@ AV_PIX_FMT_YUV444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:275
AV_FRAME_DATA_DYNAMIC_HDR_PLUS
@ AV_FRAME_DATA_DYNAMIC_HDR_PLUS
HDR dynamic metadata associated with a video frame.
Definition: frame.h:159
AVCOL_TRC_ARIB_STD_B67
@ AVCOL_TRC_ARIB_STD_B67
ARIB STD-B67, known as "Hybrid log-gamma".
Definition: pixfmt.h:661
FormatEntry::is_supported_out
uint8_t is_supported_out
Definition: format.c:29
AV_PIX_FMT_FLAG_XYZ
#define AV_PIX_FMT_FLAG_XYZ
The pixel format contains XYZ-like data (as opposed to YUV/RGB/grayscale).
Definition: pixdesc.h:163
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AVCOL_SPC_FCC
@ AVCOL_SPC_FCC
FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition: pixfmt.h:674
AV_PIX_FMT_XV48LE
@ AV_PIX_FMT_XV48LE
packed XVYU 4:4:4, 64bpp, little-endian, variant of Y416 where alpha channel is left undefined
Definition: pixfmt.h:464
AV_PIX_FMT_YUV444P9LE
@ AV_PIX_FMT_YUV444P9LE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:160
SwsFormat::color
SwsColor color
Definition: format.h:83
hdr_dynamic_metadata.h
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
AV_PIX_FMT_P216LE
@ AV_PIX_FMT_P216LE
interleaved chroma YUV 4:2:2, 32bpp, little-endian
Definition: pixfmt.h:396
AV_PIX_FMT_RGBF32LE
@ AV_PIX_FMT_RGBF32LE
IEEE-754 single precision packed RGB 32:32:32, 96bpp, RGBRGB..., little-endian.
Definition: pixfmt.h:421
AVMasteringDisplayMetadata::min_luminance
AVRational min_luminance
Min luminance of mastering display (cd/m^2).
Definition: mastering_display_metadata.h:52
av_mul_q
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
Definition: rational.c:80
AV_PIX_FMT_YUVA420P10BE
@ AV_PIX_FMT_YUVA420P10BE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:181
SwsFormat::csp
enum AVColorSpace csp
Definition: format.h:80
SwsColor::min_luma
AVRational min_luma
Definition: format.h:62
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
AV_PIX_FMT_RGB565BE
@ AV_PIX_FMT_RGB565BE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
Definition: pixfmt.h:112
AV_PIX_FMT_YUV420P16BE
@ AV_PIX_FMT_YUV420P16BE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:129
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
AV_PIX_FMT_YUV422P16BE
@ AV_PIX_FMT_YUV422P16BE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:131
AV_PIX_FMT_P212BE
@ AV_PIX_FMT_P212BE
interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, big-endian
Definition: pixfmt.h:426
desc
const char * desc
Definition: libsvtav1.c:79
AV_PIX_FMT_GRAY16LE
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
Definition: pixfmt.h:105
AV_PIX_FMT_X2BGR10LE
@ AV_PIX_FMT_X2BGR10LE
packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:386
AV_PIX_FMT_V30XLE
@ AV_PIX_FMT_V30XLE
packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), little-endian
Definition: pixfmt.h:449
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
AV_PIX_FMT_P010LE
@ AV_PIX_FMT_P010LE
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits,...
Definition: pixfmt.h:307
SwsColor::max_luma
AVRational max_luma
Definition: format.h:63
mastering_display_metadata.h
AV_PIX_FMT_XV48BE
@ AV_PIX_FMT_XV48BE
packed XVYU 4:4:4, 64bpp, big-endian, variant of Y416 where alpha channel is left undefined
Definition: pixfmt.h:463
AV_PIX_FMT_YUVA444P10LE
@ AV_PIX_FMT_YUVA444P10LE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:186
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:265
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
AV_PIX_FMT_BGR555LE
@ AV_PIX_FMT_BGR555LE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:120
AV_PIX_FMT_YAF32BE
@ AV_PIX_FMT_YAF32BE
IEEE-754 single precision packed YA, 32 bits gray, 32 bits alpha, 64bpp, big-endian.
Definition: pixfmt.h:482
AV_PIX_FMT_P216BE
@ AV_PIX_FMT_P216BE
interleaved chroma YUV 4:2:2, 32bpp, big-endian
Definition: pixfmt.h:395
av_add_q
AVRational av_add_q(AVRational b, AVRational c)
Add two rationals.
Definition: rational.c:93
AV_PIX_FMT_P412LE
@ AV_PIX_FMT_P412LE
interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, little-endian
Definition: pixfmt.h:430
AV_PIX_FMT_GRAY14LE
@ AV_PIX_FMT_GRAY14LE
Y , 14bpp, little-endian.
Definition: pixfmt.h:361
AV_PIX_FMT_GRAYF16LE
@ AV_PIX_FMT_GRAYF16LE
IEEE-754 half precision Y, 16bpp, little-endian.
Definition: pixfmt.h:472
AVColorPrimariesDesc::prim
AVPrimaryCoefficients prim
Definition: csp.h:80
AV_PIX_FMT_XV36LE
@ AV_PIX_FMT_XV36LE
packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, little-endian,...
Definition: pixfmt.h:418
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:80
AV_PIX_FMT_GRAY14BE
@ AV_PIX_FMT_GRAY14BE
Y , 14bpp, big-endian.
Definition: pixfmt.h:360
AV_PIX_FMT_YUVA422P16BE
@ AV_PIX_FMT_YUVA422P16BE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:189
AV_PIX_FMT_YUV440P10BE
@ AV_PIX_FMT_YUV440P10BE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:299
AV_PIX_FMT_YUV422P9LE
@ AV_PIX_FMT_YUV422P9LE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:164
AV_PIX_FMT_YUVA422P16LE
@ AV_PIX_FMT_YUVA422P16LE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:190
AV_PIX_FMT_GBRP14LE
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
Definition: pixfmt.h:282
av_csp_itu_eotf
av_csp_eotf_function av_csp_itu_eotf(enum AVColorTransferCharacteristic trc)
Returns the ITU EOTF corresponding to a given TRC.
Definition: csp.c:605
AVCHROMA_LOC_NB
@ AVCHROMA_LOC_NB
Not part of ABI.
Definition: pixfmt.h:773
AV_PIX_FMT_0RGB
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
Definition: pixfmt.h:262
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79
format_entries
static const FormatEntry format_entries[]
Definition: format.c:34
AV_PIX_FMT_GBRAP10BE
@ AV_PIX_FMT_GBRAP10BE
planar GBR 4:4:4:4 40bpp, big-endian
Definition: pixfmt.h:313
AVCOL_TRC_SMPTE428
@ AVCOL_TRC_SMPTE428
SMPTE ST 428-1.
Definition: pixfmt.h:659
AVLumaCoefficients::cb
AVRational cb
Definition: csp.h:49
AV_PIX_FMT_YUVA444P16LE
@ AV_PIX_FMT_YUVA444P16LE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:192
AV_PIX_FMT_GBRPF16BE
@ AV_PIX_FMT_GBRPF16BE
IEEE-754 half precision planer GBR 4:4:4, 48bpp, big-endian.
Definition: pixfmt.h:466
AV_PIX_FMT_VUYX
@ AV_PIX_FMT_VUYX
packed VUYX 4:4:4:4, 32bpp, Variant of VUYA where alpha channel is left undefined
Definition: pixfmt.h:406
AV_PIX_FMT_VYU444
@ AV_PIX_FMT_VYU444
packed VYU 4:4:4, 24bpp (1 Cr & Cb sample per 1x1 Y), VYUVYU...
Definition: pixfmt.h:446
AV_PIX_FMT_YUVA422P12BE
@ AV_PIX_FMT_YUVA422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian
Definition: pixfmt.h:366
AVCOL_SPC_BT709
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
Definition: pixfmt.h:671
AVColorRange
AVColorRange
Visual content value range.
Definition: pixfmt.h:711
AV_PIX_FMT_FLAG_PAL
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
Definition: pixdesc.h:120
AV_PIX_FMT_BGR444LE
@ AV_PIX_FMT_BGR444LE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:138
AV_PIX_FMT_YUV422P12LE
@ AV_PIX_FMT_YUV422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:272
AV_PIX_FMT_YUVA420P9BE
@ AV_PIX_FMT_YUVA420P9BE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
Definition: pixfmt.h:175
AV_PIX_FMT_BAYER_GRBG8
@ AV_PIX_FMT_BAYER_GRBG8
bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples
Definition: pixfmt.h:288
src
#define src
Definition: vp8dsp.c:248
AV_PIX_FMT_GBRAP14LE
@ AV_PIX_FMT_GBRAP14LE
planar GBR 4:4:4:4 56bpp, little-endian
Definition: pixfmt.h:433
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_GBRPF16LE
@ AV_PIX_FMT_GBRPF16LE
IEEE-754 half precision planer GBR 4:4:4, 48bpp, little-endian.
Definition: pixfmt.h:467
infer_trc_ref
static int infer_trc_ref(SwsColor *csp, const SwsColor *ref)
Definition: format.c:459
SwsColor::prim
enum AVColorPrimaries prim
Definition: format.h:59
av_csp_itu_eotf_inv
av_csp_eotf_function av_csp_itu_eotf_inv(enum AVColorTransferCharacteristic trc)
Returns the mathematical inverse of the corresponding EOTF.
Definition: csp.c:631
AV_PIX_FMT_UYYVYY411
@ AV_PIX_FMT_UYYVYY411
packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
Definition: pixfmt.h:89
AV_PIX_FMT_BGR48BE
@ AV_PIX_FMT_BGR48BE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...
Definition: pixfmt.h:145
AV_PIX_FMT_YUVA422P9LE
@ AV_PIX_FMT_YUVA422P9LE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
Definition: pixfmt.h:178