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 #include "libavutil/refstruct.h"
25 
26 #include "format.h"
27 #include "csputils.h"
28 #include "ops_internal.h"
29 
30 #define Q(N) ((AVRational) { N, 1 })
31 #define Q0 Q(0)
32 #define Q1 Q(1)
33 
34 #define RET(x) \
35  do { \
36  int _ret = (x); \
37  if (_ret < 0) \
38  return _ret; \
39  } while (0)
40 
41 typedef struct LegacyFormatEntry {
42  uint8_t is_supported_in :1;
43  uint8_t is_supported_out :1;
46 
47 /* Format support table for legacy swscale */
49  [AV_PIX_FMT_YUV420P] = { 1, 1 },
50  [AV_PIX_FMT_YUYV422] = { 1, 1 },
51  [AV_PIX_FMT_RGB24] = { 1, 1 },
52  [AV_PIX_FMT_BGR24] = { 1, 1 },
53  [AV_PIX_FMT_YUV422P] = { 1, 1 },
54  [AV_PIX_FMT_YUV444P] = { 1, 1 },
55  [AV_PIX_FMT_YUV410P] = { 1, 1 },
56  [AV_PIX_FMT_YUV411P] = { 1, 1 },
57  [AV_PIX_FMT_GRAY8] = { 1, 1 },
58  [AV_PIX_FMT_MONOWHITE] = { 1, 1 },
59  [AV_PIX_FMT_MONOBLACK] = { 1, 1 },
60  [AV_PIX_FMT_PAL8] = { 1, 0 },
61  [AV_PIX_FMT_YUVJ420P] = { 1, 1 },
62  [AV_PIX_FMT_YUVJ411P] = { 1, 1 },
63  [AV_PIX_FMT_YUVJ422P] = { 1, 1 },
64  [AV_PIX_FMT_YUVJ444P] = { 1, 1 },
65  [AV_PIX_FMT_YVYU422] = { 1, 1 },
66  [AV_PIX_FMT_UYVY422] = { 1, 1 },
67  [AV_PIX_FMT_UYYVYY411] = { 1, 0 },
68  [AV_PIX_FMT_BGR8] = { 1, 1 },
69  [AV_PIX_FMT_BGR4] = { 0, 1 },
70  [AV_PIX_FMT_BGR4_BYTE] = { 1, 1 },
71  [AV_PIX_FMT_RGB8] = { 1, 1 },
72  [AV_PIX_FMT_RGB4] = { 0, 1 },
73  [AV_PIX_FMT_RGB4_BYTE] = { 1, 1 },
74  [AV_PIX_FMT_NV12] = { 1, 1 },
75  [AV_PIX_FMT_NV21] = { 1, 1 },
76  [AV_PIX_FMT_ARGB] = { 1, 1 },
77  [AV_PIX_FMT_RGBA] = { 1, 1 },
78  [AV_PIX_FMT_ABGR] = { 1, 1 },
79  [AV_PIX_FMT_BGRA] = { 1, 1 },
80  [AV_PIX_FMT_0RGB] = { 1, 1 },
81  [AV_PIX_FMT_RGB0] = { 1, 1 },
82  [AV_PIX_FMT_0BGR] = { 1, 1 },
83  [AV_PIX_FMT_BGR0] = { 1, 1 },
84  [AV_PIX_FMT_GRAY9BE] = { 1, 1 },
85  [AV_PIX_FMT_GRAY9LE] = { 1, 1 },
86  [AV_PIX_FMT_GRAY10BE] = { 1, 1 },
87  [AV_PIX_FMT_GRAY10LE] = { 1, 1 },
88  [AV_PIX_FMT_GRAY12BE] = { 1, 1 },
89  [AV_PIX_FMT_GRAY12LE] = { 1, 1 },
90  [AV_PIX_FMT_GRAY14BE] = { 1, 1 },
91  [AV_PIX_FMT_GRAY14LE] = { 1, 1 },
92  [AV_PIX_FMT_GRAY16BE] = { 1, 1 },
93  [AV_PIX_FMT_GRAY16LE] = { 1, 1 },
94  [AV_PIX_FMT_YUV440P] = { 1, 1 },
95  [AV_PIX_FMT_YUVJ440P] = { 1, 1 },
96  [AV_PIX_FMT_YUV440P10LE] = { 1, 1 },
97  [AV_PIX_FMT_YUV440P10BE] = { 1, 1 },
98  [AV_PIX_FMT_YUV440P12LE] = { 1, 1 },
99  [AV_PIX_FMT_YUV440P12BE] = { 1, 1 },
100  [AV_PIX_FMT_YUVA420P] = { 1, 1 },
101  [AV_PIX_FMT_YUVA422P] = { 1, 1 },
102  [AV_PIX_FMT_YUVA444P] = { 1, 1 },
103  [AV_PIX_FMT_YUVA420P9BE] = { 1, 1 },
104  [AV_PIX_FMT_YUVA420P9LE] = { 1, 1 },
105  [AV_PIX_FMT_YUVA422P9BE] = { 1, 1 },
106  [AV_PIX_FMT_YUVA422P9LE] = { 1, 1 },
107  [AV_PIX_FMT_YUVA444P9BE] = { 1, 1 },
108  [AV_PIX_FMT_YUVA444P9LE] = { 1, 1 },
109  [AV_PIX_FMT_YUVA420P10BE] = { 1, 1 },
110  [AV_PIX_FMT_YUVA420P10LE] = { 1, 1 },
111  [AV_PIX_FMT_YUVA422P10BE] = { 1, 1 },
112  [AV_PIX_FMT_YUVA422P10LE] = { 1, 1 },
113  [AV_PIX_FMT_YUVA444P10BE] = { 1, 1 },
114  [AV_PIX_FMT_YUVA444P10LE] = { 1, 1 },
115  [AV_PIX_FMT_YUVA420P16BE] = { 1, 1 },
116  [AV_PIX_FMT_YUVA420P16LE] = { 1, 1 },
117  [AV_PIX_FMT_YUVA422P16BE] = { 1, 1 },
118  [AV_PIX_FMT_YUVA422P16LE] = { 1, 1 },
119  [AV_PIX_FMT_YUVA444P16BE] = { 1, 1 },
120  [AV_PIX_FMT_YUVA444P16LE] = { 1, 1 },
121  [AV_PIX_FMT_RGB48BE] = { 1, 1 },
122  [AV_PIX_FMT_RGB48LE] = { 1, 1 },
123  [AV_PIX_FMT_RGBA64BE] = { 1, 1, 1 },
124  [AV_PIX_FMT_RGBA64LE] = { 1, 1, 1 },
125  [AV_PIX_FMT_RGB565BE] = { 1, 1 },
126  [AV_PIX_FMT_RGB565LE] = { 1, 1 },
127  [AV_PIX_FMT_RGB555BE] = { 1, 1 },
128  [AV_PIX_FMT_RGB555LE] = { 1, 1 },
129  [AV_PIX_FMT_BGR565BE] = { 1, 1 },
130  [AV_PIX_FMT_BGR565LE] = { 1, 1 },
131  [AV_PIX_FMT_BGR555BE] = { 1, 1 },
132  [AV_PIX_FMT_BGR555LE] = { 1, 1 },
133  [AV_PIX_FMT_YUV420P16LE] = { 1, 1 },
134  [AV_PIX_FMT_YUV420P16BE] = { 1, 1 },
135  [AV_PIX_FMT_YUV422P16LE] = { 1, 1 },
136  [AV_PIX_FMT_YUV422P16BE] = { 1, 1 },
137  [AV_PIX_FMT_YUV444P16LE] = { 1, 1 },
138  [AV_PIX_FMT_YUV444P16BE] = { 1, 1 },
139  [AV_PIX_FMT_RGB444LE] = { 1, 1 },
140  [AV_PIX_FMT_RGB444BE] = { 1, 1 },
141  [AV_PIX_FMT_BGR444LE] = { 1, 1 },
142  [AV_PIX_FMT_BGR444BE] = { 1, 1 },
143  [AV_PIX_FMT_YA8] = { 1, 1 },
144  [AV_PIX_FMT_YA16BE] = { 1, 1 },
145  [AV_PIX_FMT_YA16LE] = { 1, 1 },
146  [AV_PIX_FMT_BGR48BE] = { 1, 1 },
147  [AV_PIX_FMT_BGR48LE] = { 1, 1 },
148  [AV_PIX_FMT_BGRA64BE] = { 1, 1, 1 },
149  [AV_PIX_FMT_BGRA64LE] = { 1, 1, 1 },
150  [AV_PIX_FMT_YUV420P9BE] = { 1, 1 },
151  [AV_PIX_FMT_YUV420P9LE] = { 1, 1 },
152  [AV_PIX_FMT_YUV420P10BE] = { 1, 1 },
153  [AV_PIX_FMT_YUV420P10LE] = { 1, 1 },
154  [AV_PIX_FMT_YUV420P12BE] = { 1, 1 },
155  [AV_PIX_FMT_YUV420P12LE] = { 1, 1 },
156  [AV_PIX_FMT_YUV420P14BE] = { 1, 1 },
157  [AV_PIX_FMT_YUV420P14LE] = { 1, 1 },
158  [AV_PIX_FMT_YUV422P9BE] = { 1, 1 },
159  [AV_PIX_FMT_YUV422P9LE] = { 1, 1 },
160  [AV_PIX_FMT_YUV422P10BE] = { 1, 1 },
161  [AV_PIX_FMT_YUV422P10LE] = { 1, 1 },
162  [AV_PIX_FMT_YUV422P12BE] = { 1, 1 },
163  [AV_PIX_FMT_YUV422P12LE] = { 1, 1 },
164  [AV_PIX_FMT_YUV422P14BE] = { 1, 1 },
165  [AV_PIX_FMT_YUV422P14LE] = { 1, 1 },
166  [AV_PIX_FMT_YUV444P9BE] = { 1, 1 },
167  [AV_PIX_FMT_YUV444P9LE] = { 1, 1 },
168  [AV_PIX_FMT_YUV444P10BE] = { 1, 1 },
169  [AV_PIX_FMT_YUV444P10LE] = { 1, 1 },
170  [AV_PIX_FMT_YUV444P12BE] = { 1, 1 },
171  [AV_PIX_FMT_YUV444P12LE] = { 1, 1 },
172  [AV_PIX_FMT_YUV444P14BE] = { 1, 1 },
173  [AV_PIX_FMT_YUV444P14LE] = { 1, 1 },
174  [AV_PIX_FMT_YUV444P10MSBBE] = { 1, 1 },
175  [AV_PIX_FMT_YUV444P10MSBLE] = { 1, 1 },
176  [AV_PIX_FMT_YUV444P12MSBBE] = { 1, 1 },
177  [AV_PIX_FMT_YUV444P12MSBLE] = { 1, 1 },
178  [AV_PIX_FMT_GBRP] = { 1, 1 },
179  [AV_PIX_FMT_GBRP9LE] = { 1, 1 },
180  [AV_PIX_FMT_GBRP9BE] = { 1, 1 },
181  [AV_PIX_FMT_GBRP10LE] = { 1, 1 },
182  [AV_PIX_FMT_GBRP10BE] = { 1, 1 },
183  [AV_PIX_FMT_GBRAP10LE] = { 1, 1 },
184  [AV_PIX_FMT_GBRAP10BE] = { 1, 1 },
185  [AV_PIX_FMT_GBRP10MSBLE] = { 1, 1 },
186  [AV_PIX_FMT_GBRP10MSBBE] = { 1, 1 },
187  [AV_PIX_FMT_GBRP12LE] = { 1, 1 },
188  [AV_PIX_FMT_GBRP12BE] = { 1, 1 },
189  [AV_PIX_FMT_GBRP12MSBLE] = { 1, 1 },
190  [AV_PIX_FMT_GBRP12MSBBE] = { 1, 1 },
191  [AV_PIX_FMT_GBRAP12LE] = { 1, 1 },
192  [AV_PIX_FMT_GBRAP12BE] = { 1, 1 },
193  [AV_PIX_FMT_GBRP14LE] = { 1, 1 },
194  [AV_PIX_FMT_GBRP14BE] = { 1, 1 },
195  [AV_PIX_FMT_GBRAP14LE] = { 1, 1 },
196  [AV_PIX_FMT_GBRAP14BE] = { 1, 1 },
197  [AV_PIX_FMT_GBRP16LE] = { 1, 1 },
198  [AV_PIX_FMT_GBRP16BE] = { 1, 1 },
199  [AV_PIX_FMT_GBRPF32LE] = { 1, 1 },
200  [AV_PIX_FMT_GBRPF32BE] = { 1, 1 },
201  [AV_PIX_FMT_GBRAPF32LE] = { 1, 1 },
202  [AV_PIX_FMT_GBRAPF32BE] = { 1, 1 },
203  [AV_PIX_FMT_GBRPF16LE] = { 1, 0 },
204  [AV_PIX_FMT_GBRPF16BE] = { 1, 0 },
205  [AV_PIX_FMT_GBRAPF16LE] = { 1, 0 },
206  [AV_PIX_FMT_GBRAPF16BE] = { 1, 0 },
207  [AV_PIX_FMT_GBRAP] = { 1, 1 },
208  [AV_PIX_FMT_GBRAP16LE] = { 1, 1 },
209  [AV_PIX_FMT_GBRAP16BE] = { 1, 1 },
210  [AV_PIX_FMT_BAYER_BGGR8] = { 1, 0 },
211  [AV_PIX_FMT_BAYER_RGGB8] = { 1, 0 },
212  [AV_PIX_FMT_BAYER_GBRG8] = { 1, 0 },
213  [AV_PIX_FMT_BAYER_GRBG8] = { 1, 0 },
214  [AV_PIX_FMT_BAYER_BGGR16LE] = { 1, 0 },
215  [AV_PIX_FMT_BAYER_BGGR16BE] = { 1, 0 },
216  [AV_PIX_FMT_BAYER_RGGB16LE] = { 1, 0 },
217  [AV_PIX_FMT_BAYER_RGGB16BE] = { 1, 0 },
218  [AV_PIX_FMT_BAYER_GBRG16LE] = { 1, 0 },
219  [AV_PIX_FMT_BAYER_GBRG16BE] = { 1, 0 },
220  [AV_PIX_FMT_BAYER_GRBG16LE] = { 1, 0 },
221  [AV_PIX_FMT_BAYER_GRBG16BE] = { 1, 0 },
222  [AV_PIX_FMT_XYZ12BE] = { 1, 1, 1 },
223  [AV_PIX_FMT_XYZ12LE] = { 1, 1, 1 },
224  [AV_PIX_FMT_AYUV64LE] = { 1, 1},
225  [AV_PIX_FMT_AYUV64BE] = { 1, 1 },
226  [AV_PIX_FMT_P010LE] = { 1, 1 },
227  [AV_PIX_FMT_P010BE] = { 1, 1 },
228  [AV_PIX_FMT_P012LE] = { 1, 1 },
229  [AV_PIX_FMT_P012BE] = { 1, 1 },
230  [AV_PIX_FMT_P016LE] = { 1, 1 },
231  [AV_PIX_FMT_P016BE] = { 1, 1 },
232  [AV_PIX_FMT_GRAYF32LE] = { 1, 1 },
233  [AV_PIX_FMT_GRAYF32BE] = { 1, 1 },
234  [AV_PIX_FMT_GRAYF16LE] = { 1, 0 },
235  [AV_PIX_FMT_GRAYF16BE] = { 1, 0 },
236  [AV_PIX_FMT_YAF32LE] = { 1, 0 },
237  [AV_PIX_FMT_YAF32BE] = { 1, 0 },
238  [AV_PIX_FMT_YAF16LE] = { 1, 0 },
239  [AV_PIX_FMT_YAF16BE] = { 1, 0 },
240  [AV_PIX_FMT_YUVA422P12BE] = { 1, 1 },
241  [AV_PIX_FMT_YUVA422P12LE] = { 1, 1 },
242  [AV_PIX_FMT_YUVA444P12BE] = { 1, 1 },
243  [AV_PIX_FMT_YUVA444P12LE] = { 1, 1 },
244  [AV_PIX_FMT_NV24] = { 1, 1 },
245  [AV_PIX_FMT_NV42] = { 1, 1 },
246  [AV_PIX_FMT_Y210LE] = { 1, 1 },
247  [AV_PIX_FMT_Y212LE] = { 1, 1 },
248  [AV_PIX_FMT_Y216LE] = { 1, 1 },
249  [AV_PIX_FMT_X2RGB10LE] = { 1, 1 },
250  [AV_PIX_FMT_X2BGR10LE] = { 1, 1 },
251  [AV_PIX_FMT_NV20BE] = { 1, 1 },
252  [AV_PIX_FMT_NV20LE] = { 1, 1 },
253  [AV_PIX_FMT_P210BE] = { 1, 1 },
254  [AV_PIX_FMT_P210LE] = { 1, 1 },
255  [AV_PIX_FMT_P212BE] = { 1, 1 },
256  [AV_PIX_FMT_P212LE] = { 1, 1 },
257  [AV_PIX_FMT_P410BE] = { 1, 1 },
258  [AV_PIX_FMT_P410LE] = { 1, 1 },
259  [AV_PIX_FMT_P412BE] = { 1, 1 },
260  [AV_PIX_FMT_P412LE] = { 1, 1 },
261  [AV_PIX_FMT_P216BE] = { 1, 1 },
262  [AV_PIX_FMT_P216LE] = { 1, 1 },
263  [AV_PIX_FMT_P416BE] = { 1, 1 },
264  [AV_PIX_FMT_P416LE] = { 1, 1 },
265  [AV_PIX_FMT_NV16] = { 1, 1 },
266  [AV_PIX_FMT_VUYA] = { 1, 1 },
267  [AV_PIX_FMT_VUYX] = { 1, 1 },
268  [AV_PIX_FMT_RGBAF16BE] = { 1, 0 },
269  [AV_PIX_FMT_RGBAF16LE] = { 1, 0 },
270  [AV_PIX_FMT_RGBF16BE] = { 1, 0 },
271  [AV_PIX_FMT_RGBF16LE] = { 1, 0 },
272  [AV_PIX_FMT_RGBF32BE] = { 1, 0 },
273  [AV_PIX_FMT_RGBF32LE] = { 1, 0 },
274  [AV_PIX_FMT_XV30LE] = { 1, 1 },
275  [AV_PIX_FMT_XV36LE] = { 1, 1 },
276  [AV_PIX_FMT_XV36BE] = { 1, 1 },
277  [AV_PIX_FMT_XV48LE] = { 1, 1 },
278  [AV_PIX_FMT_XV48BE] = { 1, 1 },
279  [AV_PIX_FMT_AYUV] = { 1, 1 },
280  [AV_PIX_FMT_UYVA] = { 1, 1 },
281  [AV_PIX_FMT_VYU444] = { 1, 1 },
282  [AV_PIX_FMT_V30XLE] = { 1, 1 },
283 };
284 
286 {
287  return (unsigned)pix_fmt < FF_ARRAY_ELEMS(legacy_format_entries) ?
289 }
290 
292 {
293  return (unsigned)pix_fmt < FF_ARRAY_ELEMS(legacy_format_entries) ?
295 }
296 
298 {
299  return (unsigned)pix_fmt < FF_ARRAY_ELEMS(legacy_format_entries) ?
301 }
302 
303 /**
304  * This function also sanitizes and strips the input data, removing irrelevant
305  * fields for certain formats.
306  */
308 {
311  AVFrameSideData *sd;
312 
313  SwsFormat fmt = {
314  .width = frame->width,
315  .height = frame->height,
316  .format = frame->format,
317  .range = frame->color_range,
318  .csp = frame->colorspace,
319  .loc = frame->chroma_location,
320  .desc = desc,
321  .color = {
322  .prim = frame->color_primaries,
323  .trc = frame->color_trc,
324  },
325  };
326 
327  av_assert1(fmt.width > 0);
328  av_assert1(fmt.height > 0);
330  av_assert0(desc);
332  /* RGB-like family */
333  fmt.csp = AVCOL_SPC_RGB;
334  fmt.range = AVCOL_RANGE_JPEG;
335  } else if (desc->flags & AV_PIX_FMT_FLAG_XYZ) {
337  fmt.color = (SwsColor) {
338  .prim = AVCOL_PRI_BT709, /* swscale currently hard-codes this XYZ matrix */
339  .trc = AVCOL_TRC_SMPTE428,
340  };
341  } else if (desc->nb_components < 3) {
342  /* Grayscale formats */
345  if (desc->flags & AV_PIX_FMT_FLAG_FLOAT)
347  else
348  fmt.range = AVCOL_RANGE_JPEG; // FIXME: this restriction should be lifted
349  }
350 
351  switch (frame->format) {
352  case AV_PIX_FMT_YUVJ420P:
353  case AV_PIX_FMT_YUVJ411P:
354  case AV_PIX_FMT_YUVJ422P:
355  case AV_PIX_FMT_YUVJ444P:
356  case AV_PIX_FMT_YUVJ440P:
357  fmt.range = AVCOL_RANGE_JPEG;
358  break;
359  }
360 
361  if (!desc->log2_chroma_w && !desc->log2_chroma_h)
363 
364  if (frame->flags & AV_FRAME_FLAG_INTERLACED) {
365  fmt.height = (fmt.height + (field == FIELD_TOP)) >> 1;
366  fmt.interlaced = 1;
367  }
368 
369  /* Set luminance and gamut information */
370  fmt.color.min_luma = av_make_q(0, 1);
371  switch (fmt.color.trc) {
372  case AVCOL_TRC_SMPTE2084:
373  fmt.color.max_luma = av_make_q(10000, 1); break;
375  fmt.color.max_luma = av_make_q( 1000, 1); break; /* HLG reference display */
376  default:
377  fmt.color.max_luma = av_make_q( 203, 1); break; /* SDR reference brightness */
378  }
379 
381  if (primaries)
382  fmt.color.gamut = primaries->prim;
383 
386  if (mdm->has_luminance) {
387  fmt.color.min_luma = mdm->min_luminance;
388  fmt.color.max_luma = mdm->max_luminance;
389  }
390 
391  if (mdm->has_primaries) {
392  /* Ignore mastering display white point as it has no bearance on
393  * the underlying content */
394  fmt.color.gamut.r.x = mdm->display_primaries[0][0];
395  fmt.color.gamut.r.y = mdm->display_primaries[0][1];
396  fmt.color.gamut.g.x = mdm->display_primaries[1][0];
397  fmt.color.gamut.g.y = mdm->display_primaries[1][1];
398  fmt.color.gamut.b.x = mdm->display_primaries[2][0];
399  fmt.color.gamut.b.y = mdm->display_primaries[2][1];
400  }
401  }
402 
404  const AVDynamicHDRPlus *dhp = (const AVDynamicHDRPlus *) sd->data;
405  const AVHDRPlusColorTransformParams *pars = &dhp->params[0];
406  const AVRational nits = av_make_q(10000, 1);
407  AVRational maxrgb = pars->maxscl[0];
408 
409  if (!dhp->num_windows || dhp->application_version > 1)
410  goto skip_hdr10;
411 
412  /* Maximum of MaxSCL components */
413  if (av_cmp_q(pars->maxscl[1], maxrgb) > 0)
414  maxrgb = pars->maxscl[1];
415  if (av_cmp_q(pars->maxscl[2], maxrgb) > 0)
416  maxrgb = pars->maxscl[2];
417 
418  if (maxrgb.num > 0) {
419  /* Estimate true luminance from MaxSCL */
421  if (!luma)
422  goto skip_hdr10;
423  fmt.color.frame_peak = av_add_q(av_mul_q(luma->cr, pars->maxscl[0]),
424  av_add_q(av_mul_q(luma->cg, pars->maxscl[1]),
425  av_mul_q(luma->cb, pars->maxscl[2])));
426  /* Scale the scene average brightness by the ratio between the
427  * maximum luminance and the MaxRGB values */
428  fmt.color.frame_avg = av_mul_q(pars->average_maxrgb,
429  av_div_q(fmt.color.frame_peak, maxrgb));
430  } else {
431  /**
432  * Calculate largest value from histogram to use as fallback for
433  * clips with missing MaxSCL information. Note that this may end
434  * up picking the "reserved" value at the 5% percentile, which in
435  * practice appears to track the brightest pixel in the scene.
436  */
437  for (int i = 0; i < pars->num_distribution_maxrgb_percentiles; i++) {
438  const AVRational pct = pars->distribution_maxrgb[i].percentile;
439  if (av_cmp_q(pct, maxrgb) > 0)
440  maxrgb = pct;
441  fmt.color.frame_peak = maxrgb;
442  fmt.color.frame_avg = pars->average_maxrgb;
443  }
444  }
445 
446  /* Rescale to nits */
447  fmt.color.frame_peak = av_mul_q(nits, fmt.color.frame_peak);
448  fmt.color.frame_avg = av_mul_q(nits, fmt.color.frame_avg);
449  }
450 skip_hdr10:
451 
452  /* PQ is always scaled down to absolute zero, so ignore mastering metadata */
453  if (fmt.color.trc == AVCOL_TRC_SMPTE2084)
454  fmt.color.min_luma = av_make_q(0, 1);
455 
456  return fmt;
457 }
458 
459 static int infer_prim_ref(SwsColor *csp, const SwsColor *ref)
460 {
461  if (csp->prim != AVCOL_PRI_UNSPECIFIED)
462  return 0;
463 
464  /* Reuse the reference gamut only for "safe", similar primaries */
465  switch (ref->prim) {
466  case AVCOL_PRI_BT709:
467  case AVCOL_PRI_BT470M:
468  case AVCOL_PRI_BT470BG:
469  case AVCOL_PRI_SMPTE170M:
470  case AVCOL_PRI_SMPTE240M:
471  csp->prim = ref->prim;
472  csp->gamut = ref->gamut;
473  break;
474  default:
475  csp->prim = AVCOL_PRI_BT709;
477  break;
478  }
479 
480  return 1;
481 }
482 
483 static int infer_trc_ref(SwsColor *csp, const SwsColor *ref)
484 {
485  if (csp->trc != AVCOL_TRC_UNSPECIFIED)
486  return 0;
487 
488  /* Pick a suitable SDR transfer function, to try and minimize conversions */
489  switch (ref->trc) {
491  /* HDR curves, never default to these */
492  case AVCOL_TRC_SMPTE2084:
494  csp->trc = AVCOL_TRC_BT709;
495  csp->min_luma = av_make_q(0, 1);
496  csp->max_luma = av_make_q(203, 1);
497  break;
498  default:
499  csp->trc = ref->trc;
500  csp->min_luma = ref->min_luma;
501  csp->max_luma = ref->max_luma;
502  break;
503  }
504 
505  return 1;
506 }
507 
509 {
510  int incomplete = 0;
511 
512  incomplete |= infer_prim_ref(dst, src);
513  incomplete |= infer_prim_ref(src, dst);
516 
517  incomplete |= infer_trc_ref(dst, src);
518  incomplete |= infer_trc_ref(src, dst);
521 
522  return incomplete;
523 }
524 
526 {
528 }
529 
531 {
532  switch (csp) {
534  case AVCOL_SPC_RGB:
535  case AVCOL_SPC_BT709:
536  case AVCOL_SPC_BT470BG:
537  case AVCOL_SPC_SMPTE170M:
538  case AVCOL_SPC_FCC:
539  case AVCOL_SPC_SMPTE240M:
541  return 1;
542  default:
543  return 0;
544  }
545 }
546 
548 {
549  return ((prim > AVCOL_PRI_RESERVED0 && prim < AVCOL_PRI_NB) ||
550  (prim >= AVCOL_PRI_EXT_BASE && prim < AVCOL_PRI_EXT_NB)) &&
551  prim != AVCOL_PRI_RESERVED;
552 }
553 
555 {
557  : av_csp_itu_eotf(trc);
558  return trc == AVCOL_TRC_UNSPECIFIED || eotf != NULL;
559 }
560 
561 static int test_range(enum AVColorRange range)
562 {
563  return (unsigned)range < AVCOL_RANGE_NB;
564 }
565 
566 static int test_loc(enum AVChromaLocation loc)
567 {
568  return (unsigned)loc < AVCHROMA_LOC_NB;
569 }
570 
571 int ff_test_fmt(const SwsFormat *fmt, int output)
572 {
573  return fmt->width > 0 && fmt->height > 0 &&
574  sws_test_format (fmt->format, output) &&
575  sws_test_colorspace(fmt->csp, output) &&
577  sws_test_transfer (fmt->color.trc, output) &&
578  test_range (fmt->range) &&
579  test_loc (fmt->loc);
580 }
581 
583 {
584  for (int field = 0; field < 2; field++) {
585  const SwsFormat fmt = ff_fmt_from_frame(frame, field);
586  if (!ff_test_fmt(&fmt, output))
587  return 0;
588  if (!fmt.interlaced)
589  break;
590  }
591 
592  return 1;
593 }
594 
595 int sws_is_noop(const AVFrame *dst, const AVFrame *src)
596 {
597  for (int field = 0; field < 2; field++) {
598  SwsFormat dst_fmt = ff_fmt_from_frame(dst, field);
599  SwsFormat src_fmt = ff_fmt_from_frame(src, field);
600  if (!ff_fmt_equal(&dst_fmt, &src_fmt))
601  return 0;
602  if (!dst_fmt.interlaced)
603  break;
604  }
605 
606  return 1;
607 }
608 
609 #if CONFIG_UNSTABLE
610 
611 /* Returns the type suitable for a pixel after fully decoding/unpacking it */
612 static SwsPixelType fmt_pixel_type(enum AVPixelFormat fmt)
613 {
615  const int bits = FFALIGN(desc->comp[0].depth, 8);
616  if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) {
617  switch (bits) {
618  case 32: return SWS_PIXEL_F32;
619  }
620  } else {
621  switch (bits) {
622  case 8: return SWS_PIXEL_U8;
623  case 16: return SWS_PIXEL_U16;
624  case 32: return SWS_PIXEL_U32;
625  }
626  }
627 
628  return SWS_PIXEL_NONE;
629 }
630 
631 static SwsSwizzleOp fmt_swizzle(enum AVPixelFormat fmt)
632 {
633  switch (fmt) {
634  case AV_PIX_FMT_ARGB:
635  case AV_PIX_FMT_0RGB:
636  case AV_PIX_FMT_AYUV64LE:
637  case AV_PIX_FMT_AYUV64BE:
638  case AV_PIX_FMT_AYUV:
641  return (SwsSwizzleOp) {{ .x = 3, 0, 1, 2 }};
642  case AV_PIX_FMT_BGR24:
643  case AV_PIX_FMT_BGR8:
644  case AV_PIX_FMT_BGR4:
646  case AV_PIX_FMT_BGRA:
647  case AV_PIX_FMT_BGR565BE:
648  case AV_PIX_FMT_BGR565LE:
649  case AV_PIX_FMT_BGR555BE:
650  case AV_PIX_FMT_BGR555LE:
651  case AV_PIX_FMT_BGR444BE:
652  case AV_PIX_FMT_BGR444LE:
653  case AV_PIX_FMT_BGR48BE:
654  case AV_PIX_FMT_BGR48LE:
655  case AV_PIX_FMT_BGRA64BE:
656  case AV_PIX_FMT_BGRA64LE:
657  case AV_PIX_FMT_BGR0:
658  case AV_PIX_FMT_VUYA:
659  case AV_PIX_FMT_VUYX:
660  return (SwsSwizzleOp) {{ .x = 2, 1, 0, 3 }};
661  case AV_PIX_FMT_ABGR:
662  case AV_PIX_FMT_0BGR:
665  return (SwsSwizzleOp) {{ .x = 3, 2, 1, 0 }};
666  case AV_PIX_FMT_YA8:
667  case AV_PIX_FMT_YA16BE:
668  case AV_PIX_FMT_YA16LE:
669  return (SwsSwizzleOp) {{ .x = 0, 3, 1, 2 }};
670  case AV_PIX_FMT_XV30BE:
671  case AV_PIX_FMT_XV30LE:
672  return (SwsSwizzleOp) {{ .x = 3, 2, 0, 1 }};
673  case AV_PIX_FMT_VYU444:
674  case AV_PIX_FMT_V30XBE:
675  case AV_PIX_FMT_V30XLE:
676  return (SwsSwizzleOp) {{ .x = 2, 0, 1, 3 }};
677  case AV_PIX_FMT_XV36BE:
678  case AV_PIX_FMT_XV36LE:
679  case AV_PIX_FMT_XV48BE:
680  case AV_PIX_FMT_XV48LE:
681  case AV_PIX_FMT_UYVA:
682  return (SwsSwizzleOp) {{ .x = 1, 0, 2, 3 }};
683  case AV_PIX_FMT_GBRP:
684  case AV_PIX_FMT_GBRP9BE:
685  case AV_PIX_FMT_GBRP9LE:
686  case AV_PIX_FMT_GBRP10BE:
687  case AV_PIX_FMT_GBRP10LE:
688  case AV_PIX_FMT_GBRP12BE:
689  case AV_PIX_FMT_GBRP12LE:
690  case AV_PIX_FMT_GBRP14BE:
691  case AV_PIX_FMT_GBRP14LE:
692  case AV_PIX_FMT_GBRP16BE:
693  case AV_PIX_FMT_GBRP16LE:
696  case AV_PIX_FMT_GBRAP:
715  return (SwsSwizzleOp) {{ .x = 1, 2, 0, 3 }};
716  default:
717  return (SwsSwizzleOp) {{ .x = 0, 1, 2, 3 }};
718  }
719 }
720 
721 static SwsSwizzleOp swizzle_inv(SwsSwizzleOp swiz) {
722  /* Input[x] =: Output[swizzle.x] */
723  unsigned out[4];
724  out[swiz.x] = 0;
725  out[swiz.y] = 1;
726  out[swiz.z] = 2;
727  out[swiz.w] = 3;
728  return (SwsSwizzleOp) {{ .x = out[0], out[1], out[2], out[3] }};
729 }
730 
731 /* Shift factor for MSB aligned formats */
732 static int fmt_shift(enum AVPixelFormat fmt)
733 {
734  switch (fmt) {
735  case AV_PIX_FMT_P010BE:
736  case AV_PIX_FMT_P010LE:
737  case AV_PIX_FMT_P210BE:
738  case AV_PIX_FMT_P210LE:
739  case AV_PIX_FMT_Y210BE:
740  case AV_PIX_FMT_Y210LE:
745  return 6;
746  case AV_PIX_FMT_P012BE:
747  case AV_PIX_FMT_P012LE:
748  case AV_PIX_FMT_P212BE:
749  case AV_PIX_FMT_P212LE:
750  case AV_PIX_FMT_P412BE:
751  case AV_PIX_FMT_P412LE:
752  case AV_PIX_FMT_XV36BE:
753  case AV_PIX_FMT_XV36LE:
754  case AV_PIX_FMT_XYZ12BE:
755  case AV_PIX_FMT_XYZ12LE:
760  return 4;
761  }
762 
763  return 0;
764 }
765 
766 /**
767  * This initializes all absent components explicitly to zero. There is no
768  * need to worry about the correct neutral value as fmt_decode() will
769  * implicitly ignore and overwrite absent components in any case. This function
770  * is just to ensure that we don't operate on undefined memory. In most cases,
771  * it will end up getting pushed towards the output or optimized away entirely
772  * by the optimization pass.
773  */
774 static SwsConst fmt_clear(enum AVPixelFormat fmt)
775 {
777  const bool has_chroma = desc->nb_components >= 3;
778  const bool has_alpha = desc->flags & AV_PIX_FMT_FLAG_ALPHA;
779 
780  SwsConst c = {0};
781  if (!has_chroma)
782  c.q4[1] = c.q4[2] = Q0;
783  if (!has_alpha)
784  c.q4[3] = Q0;
785 
786  return c;
787 }
788 
789 static int fmt_read_write(enum AVPixelFormat fmt, SwsReadWriteOp *rw_op,
790  SwsPackOp *pack_op)
791 {
793  if (!desc)
794  return AVERROR(EINVAL);
795 
796  switch (fmt) {
797  case AV_PIX_FMT_NONE:
798  case AV_PIX_FMT_NB:
799  break;
800 
801  /* Packed bitstream formats */
804  *pack_op = (SwsPackOp) {0};
805  *rw_op = (SwsReadWriteOp) {
806  .elems = 1,
807  .frac = 3,
808  };
809  return 0;
810  case AV_PIX_FMT_RGB4:
811  case AV_PIX_FMT_BGR4:
812  *pack_op = (SwsPackOp) {{ 1, 2, 1 }};
813  *rw_op = (SwsReadWriteOp) {
814  .elems = 1,
815  .packed = true,
816  .frac = 1,
817  };
818  return 0;
819  /* Packed 8-bit aligned formats */
822  *pack_op = (SwsPackOp) {{ 1, 2, 1 }};
823  *rw_op = (SwsReadWriteOp) { .elems = 1, .packed = true };
824  return 0;
825  case AV_PIX_FMT_BGR8:
826  *pack_op = (SwsPackOp) {{ 2, 3, 3 }};
827  *rw_op = (SwsReadWriteOp) { .elems = 1, .packed = true };
828  return 0;
829  case AV_PIX_FMT_RGB8:
830  *pack_op = (SwsPackOp) {{ 3, 3, 2 }};
831  *rw_op = (SwsReadWriteOp) { .elems = 1, .packed = true };
832  return 0;
833 
834  /* Packed 16-bit aligned formats */
835  case AV_PIX_FMT_RGB565BE:
836  case AV_PIX_FMT_RGB565LE:
837  case AV_PIX_FMT_BGR565BE:
838  case AV_PIX_FMT_BGR565LE:
839  *pack_op = (SwsPackOp) {{ 5, 6, 5 }};
840  *rw_op = (SwsReadWriteOp) { .elems = 1, .packed = true };
841  return 0;
842  case AV_PIX_FMT_RGB555BE:
843  case AV_PIX_FMT_RGB555LE:
844  case AV_PIX_FMT_BGR555BE:
845  case AV_PIX_FMT_BGR555LE:
846  *pack_op = (SwsPackOp) {{ 5, 5, 5 }};
847  *rw_op = (SwsReadWriteOp) { .elems = 1, .packed = true };
848  return 0;
849  case AV_PIX_FMT_RGB444BE:
850  case AV_PIX_FMT_RGB444LE:
851  case AV_PIX_FMT_BGR444BE:
852  case AV_PIX_FMT_BGR444LE:
853  *pack_op = (SwsPackOp) {{ 4, 4, 4 }};
854  *rw_op = (SwsReadWriteOp) { .elems = 1, .packed = true };
855  return 0;
856  /* Packed 32-bit aligned 4:4:4 formats */
861  case AV_PIX_FMT_XV30BE:
862  case AV_PIX_FMT_XV30LE:
863  *pack_op = (SwsPackOp) {{ 2, 10, 10, 10 }};
864  *rw_op = (SwsReadWriteOp) { .elems = 1, .packed = true };
865  return 0;
866  case AV_PIX_FMT_V30XBE:
867  case AV_PIX_FMT_V30XLE:
868  *pack_op = (SwsPackOp) {{ 10, 10, 10, 2 }};
869  *rw_op = (SwsReadWriteOp) { .elems = 1, .packed = true };
870  return 0;
871  /* 3 component formats with one channel ignored */
872  case AV_PIX_FMT_RGB0:
873  case AV_PIX_FMT_BGR0:
874  case AV_PIX_FMT_0RGB:
875  case AV_PIX_FMT_0BGR:
876  case AV_PIX_FMT_XV36BE:
877  case AV_PIX_FMT_XV36LE:
878  case AV_PIX_FMT_XV48BE:
879  case AV_PIX_FMT_XV48LE:
880  case AV_PIX_FMT_VUYX:
881  *pack_op = (SwsPackOp) {0};
882  *rw_op = (SwsReadWriteOp) { .elems = 4, .packed = true };
883  return 0;
884  /* Unpacked byte-aligned 4:4:4 formats */
885  case AV_PIX_FMT_YUV444P:
886  case AV_PIX_FMT_YUVJ444P:
901  case AV_PIX_FMT_YUVA444P:
910  case AV_PIX_FMT_AYUV:
911  case AV_PIX_FMT_UYVA:
912  case AV_PIX_FMT_VYU444:
913  case AV_PIX_FMT_AYUV64BE:
914  case AV_PIX_FMT_AYUV64LE:
915  case AV_PIX_FMT_VUYA:
916  case AV_PIX_FMT_RGB24:
917  case AV_PIX_FMT_BGR24:
918  case AV_PIX_FMT_RGB48BE:
919  case AV_PIX_FMT_RGB48LE:
920  case AV_PIX_FMT_BGR48BE:
921  case AV_PIX_FMT_BGR48LE:
922  //case AV_PIX_FMT_RGB96BE: TODO: AVRational can't fit 2^32-1
923  //case AV_PIX_FMT_RGB96LE:
924  //case AV_PIX_FMT_RGBF16BE: TODO: no support for float16 currently
925  //case AV_PIX_FMT_RGBF16LE:
926  case AV_PIX_FMT_RGBF32BE:
927  case AV_PIX_FMT_RGBF32LE:
928  case AV_PIX_FMT_ARGB:
929  case AV_PIX_FMT_RGBA:
930  case AV_PIX_FMT_ABGR:
931  case AV_PIX_FMT_BGRA:
932  case AV_PIX_FMT_RGBA64BE:
933  case AV_PIX_FMT_RGBA64LE:
934  case AV_PIX_FMT_BGRA64BE:
935  case AV_PIX_FMT_BGRA64LE:
936  //case AV_PIX_FMT_RGBA128BE: TODO: AVRational can't fit 2^32-1
937  //case AV_PIX_FMT_RGBA128LE:
940  case AV_PIX_FMT_GBRP:
941  case AV_PIX_FMT_GBRP9BE:
942  case AV_PIX_FMT_GBRP9LE:
943  case AV_PIX_FMT_GBRP10BE:
944  case AV_PIX_FMT_GBRP10LE:
945  case AV_PIX_FMT_GBRP12BE:
946  case AV_PIX_FMT_GBRP12LE:
947  case AV_PIX_FMT_GBRP14BE:
948  case AV_PIX_FMT_GBRP14LE:
949  case AV_PIX_FMT_GBRP16BE:
950  case AV_PIX_FMT_GBRP16LE:
951  //case AV_PIX_FMT_GBRPF16BE: TODO
952  //case AV_PIX_FMT_GBRPF16LE:
959  case AV_PIX_FMT_GBRAP:
968  //case AV_PIX_FMT_GBRAPF16BE: TODO
969  //case AV_PIX_FMT_GBRAPF16LE:
972  case AV_PIX_FMT_GRAY8:
973  case AV_PIX_FMT_GRAY9BE:
974  case AV_PIX_FMT_GRAY9LE:
975  case AV_PIX_FMT_GRAY10BE:
976  case AV_PIX_FMT_GRAY10LE:
977  case AV_PIX_FMT_GRAY12BE:
978  case AV_PIX_FMT_GRAY12LE:
979  case AV_PIX_FMT_GRAY14BE:
980  case AV_PIX_FMT_GRAY14LE:
981  case AV_PIX_FMT_GRAY16BE:
982  case AV_PIX_FMT_GRAY16LE:
983  //case AV_PIX_FMT_GRAYF16BE: TODO
984  //case AV_PIX_FMT_GRAYF16LE:
985  //case AV_PIX_FMT_YAF16BE:
986  //case AV_PIX_FMT_YAF16LE:
989  case AV_PIX_FMT_YAF32BE:
990  case AV_PIX_FMT_YAF32LE:
991  case AV_PIX_FMT_YA8:
992  case AV_PIX_FMT_YA16LE:
993  case AV_PIX_FMT_YA16BE:
994  *pack_op = (SwsPackOp) {0};
995  *rw_op = (SwsReadWriteOp) {
996  .elems = desc->nb_components,
997  .packed = desc->nb_components > 1 && !(desc->flags & AV_PIX_FMT_FLAG_PLANAR),
998  };
999  return 0;
1000  }
1001 
1002  return AVERROR(ENOTSUP);
1003 }
1004 
1005 static SwsPixelType get_packed_type(SwsPackOp pack)
1006 {
1007  const int sum = pack.pattern[0] + pack.pattern[1] +
1008  pack.pattern[2] + pack.pattern[3];
1009  if (sum > 16)
1010  return SWS_PIXEL_U32;
1011  else if (sum > 8)
1012  return SWS_PIXEL_U16;
1013  else
1014  return SWS_PIXEL_U8;
1015 }
1016 
1017 #if HAVE_BIGENDIAN
1018 # define NATIVE_ENDIAN_FLAG AV_PIX_FMT_FLAG_BE
1019 #else
1020 # define NATIVE_ENDIAN_FLAG 0
1021 #endif
1022 
1023 int ff_sws_decode_pixfmt(SwsOpList *ops, enum AVPixelFormat fmt)
1024 {
1026  SwsPixelType pixel_type = fmt_pixel_type(fmt);
1027  SwsPixelType raw_type = pixel_type;
1028  SwsReadWriteOp rw_op;
1029  SwsPackOp unpack;
1030 
1031  RET(fmt_read_write(fmt, &rw_op, &unpack));
1032  if (unpack.pattern[0])
1033  raw_type = get_packed_type(unpack);
1034 
1035  /* TODO: handle subsampled or semipacked input formats */
1036  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1037  .op = SWS_OP_READ,
1038  .type = raw_type,
1039  .rw = rw_op,
1040  }));
1041 
1042  if ((desc->flags & AV_PIX_FMT_FLAG_BE) != NATIVE_ENDIAN_FLAG) {
1043  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1044  .op = SWS_OP_SWAP_BYTES,
1045  .type = raw_type,
1046  }));
1047  }
1048 
1049  if (unpack.pattern[0]) {
1050  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1051  .op = SWS_OP_UNPACK,
1052  .type = raw_type,
1053  .pack = unpack,
1054  }));
1055 
1056  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1057  .op = SWS_OP_CONVERT,
1058  .type = raw_type,
1059  .convert.to = pixel_type,
1060  }));
1061  }
1062 
1063  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1064  .op = SWS_OP_SWIZZLE,
1065  .type = pixel_type,
1066  .swizzle = swizzle_inv(fmt_swizzle(fmt)),
1067  }));
1068 
1069  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1070  .op = SWS_OP_RSHIFT,
1071  .type = pixel_type,
1072  .c.u = fmt_shift(fmt),
1073  }));
1074 
1075  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1076  .op = SWS_OP_CLEAR,
1077  .type = pixel_type,
1078  .c = fmt_clear(fmt),
1079  }));
1080 
1081  return 0;
1082 }
1083 
1084 int ff_sws_encode_pixfmt(SwsOpList *ops, enum AVPixelFormat fmt)
1085 {
1087  SwsPixelType pixel_type = fmt_pixel_type(fmt);
1088  SwsPixelType raw_type = pixel_type;
1089  SwsReadWriteOp rw_op;
1090  SwsPackOp pack;
1091 
1092  RET(fmt_read_write(fmt, &rw_op, &pack));
1093  if (pack.pattern[0])
1094  raw_type = get_packed_type(pack);
1095 
1096  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1097  .op = SWS_OP_LSHIFT,
1098  .type = pixel_type,
1099  .c.u = fmt_shift(fmt),
1100  }));
1101 
1102  if (rw_op.elems > desc->nb_components) {
1103  /* Format writes unused alpha channel, clear it explicitly for sanity */
1104  av_assert1(!(desc->flags & AV_PIX_FMT_FLAG_ALPHA));
1105  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1106  .op = SWS_OP_CLEAR,
1107  .type = pixel_type,
1108  .c.q4[3] = Q0,
1109  }));
1110  }
1111 
1112  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1113  .op = SWS_OP_SWIZZLE,
1114  .type = pixel_type,
1115  .swizzle = fmt_swizzle(fmt),
1116  }));
1117 
1118  if (pack.pattern[0]) {
1119  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1120  .op = SWS_OP_CONVERT,
1121  .type = pixel_type,
1122  .convert.to = raw_type,
1123  }));
1124 
1125  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1126  .op = SWS_OP_PACK,
1127  .type = raw_type,
1128  .pack = pack,
1129  }));
1130  }
1131 
1132  if ((desc->flags & AV_PIX_FMT_FLAG_BE) != NATIVE_ENDIAN_FLAG) {
1133  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1134  .op = SWS_OP_SWAP_BYTES,
1135  .type = raw_type,
1136  }));
1137  }
1138 
1139  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1140  .op = SWS_OP_WRITE,
1141  .type = raw_type,
1142  .rw = rw_op,
1143  }));
1144  return 0;
1145 }
1146 
1147 static inline AVRational av_neg_q(AVRational x)
1148 {
1149  return (AVRational) { -x.num, x.den };
1150 }
1151 
1152 static SwsLinearOp fmt_encode_range(const SwsFormat fmt, bool *incomplete)
1153 {
1154  SwsLinearOp c = { .m = {
1155  { Q1, Q0, Q0, Q0, Q0 },
1156  { Q0, Q1, Q0, Q0, Q0 },
1157  { Q0, Q0, Q1, Q0, Q0 },
1158  { Q0, Q0, Q0, Q1, Q0 },
1159  }};
1160 
1161  const int depth0 = fmt.desc->comp[0].depth;
1162  const int depth1 = fmt.desc->comp[1].depth;
1163  const int depth2 = fmt.desc->comp[2].depth;
1164  const int depth3 = fmt.desc->comp[3].depth;
1165 
1166  if (fmt.desc->flags & AV_PIX_FMT_FLAG_FLOAT)
1167  return c; /* floats are directly output as-is */
1168 
1169  if (fmt.csp == AVCOL_SPC_RGB || (fmt.desc->flags & AV_PIX_FMT_FLAG_XYZ)) {
1170  c.m[0][0] = Q((1 << depth0) - 1);
1171  c.m[1][1] = Q((1 << depth1) - 1);
1172  c.m[2][2] = Q((1 << depth2) - 1);
1173  } else if (fmt.range == AVCOL_RANGE_JPEG) {
1174  /* Full range YUV */
1175  c.m[0][0] = Q((1 << depth0) - 1);
1176  if (fmt.desc->nb_components >= 3) {
1177  /* This follows the ITU-R convention, which is slightly different
1178  * from the JFIF convention. */
1179  c.m[1][1] = Q((1 << depth1) - 1);
1180  c.m[2][2] = Q((1 << depth2) - 1);
1181  c.m[1][4] = Q(1 << (depth1 - 1));
1182  c.m[2][4] = Q(1 << (depth2 - 1));
1183  }
1184  } else {
1185  /* Limited range YUV */
1186  if (fmt.range == AVCOL_RANGE_UNSPECIFIED)
1187  *incomplete = true;
1188  c.m[0][0] = Q(219 << (depth0 - 8));
1189  c.m[0][4] = Q( 16 << (depth0 - 8));
1190  if (fmt.desc->nb_components >= 3) {
1191  c.m[1][1] = Q(224 << (depth1 - 8));
1192  c.m[2][2] = Q(224 << (depth2 - 8));
1193  c.m[1][4] = Q(128 << (depth1 - 8));
1194  c.m[2][4] = Q(128 << (depth2 - 8));
1195  }
1196  }
1197 
1198  if (fmt.desc->flags & AV_PIX_FMT_FLAG_ALPHA) {
1199  const bool is_ya = fmt.desc->nb_components == 2;
1200  c.m[3][3] = Q((1 << (is_ya ? depth1 : depth3)) - 1);
1201  }
1202 
1203  if (fmt.format == AV_PIX_FMT_MONOWHITE) {
1204  /* This format is inverted, 0 = white, 1 = black */
1205  c.m[0][4] = av_add_q(c.m[0][4], c.m[0][0]);
1206  c.m[0][0] = av_neg_q(c.m[0][0]);
1207  }
1208 
1209  c.mask = ff_sws_linear_mask(c);
1210  return c;
1211 }
1212 
1213 static SwsLinearOp fmt_decode_range(const SwsFormat fmt, bool *incomplete)
1214 {
1215  SwsLinearOp c = fmt_encode_range(fmt, incomplete);
1216 
1217  /* Invert main diagonal + offset: x = s * y + k ==> y = (x - k) / s */
1218  for (int i = 0; i < 4; i++) {
1219  c.m[i][i] = av_inv_q(c.m[i][i]);
1220  c.m[i][4] = av_mul_q(c.m[i][4], av_neg_q(c.m[i][i]));
1221  }
1222 
1223  /* Explicitly initialize alpha for sanity */
1224  if (!(fmt.desc->flags & AV_PIX_FMT_FLAG_ALPHA))
1225  c.m[3][4] = Q1;
1226 
1227  c.mask = ff_sws_linear_mask(c);
1228  return c;
1229 }
1230 
1231 static AVRational *generate_bayer_matrix(const int size_log2)
1232 {
1233  const int size = 1 << size_log2;
1234  const int num_entries = size * size;
1235  AVRational *m = av_refstruct_allocz(sizeof(*m) * num_entries);
1236  av_assert1(size_log2 < 16);
1237  if (!m)
1238  return NULL;
1239 
1240  /* Start with a 1x1 matrix */
1241  m[0] = Q0;
1242 
1243  /* Generate three copies of the current, appropriately scaled and offset */
1244  for (int sz = 1; sz < size; sz <<= 1) {
1245  const int den = 4 * sz * sz;
1246  for (int y = 0; y < sz; y++) {
1247  for (int x = 0; x < sz; x++) {
1248  const AVRational cur = m[y * size + x];
1249  m[(y + sz) * size + x + sz] = av_add_q(cur, av_make_q(1, den));
1250  m[(y ) * size + x + sz] = av_add_q(cur, av_make_q(2, den));
1251  m[(y + sz) * size + x ] = av_add_q(cur, av_make_q(3, den));
1252  }
1253  }
1254  }
1255 
1256  /**
1257  * To correctly round, we need to evenly distribute the result on [0, 1),
1258  * giving an average value of 1/2.
1259  *
1260  * After the above construction, we have a matrix with average value:
1261  * [ 0/N + 1/N + 2/N + ... (N-1)/N ] / N = (N-1)/(2N)
1262  * where N = size * size is the total number of entries.
1263  *
1264  * To make the average value equal to 1/2 = N/(2N), add a bias of 1/(2N).
1265  */
1266  for (int i = 0; i < num_entries; i++)
1267  m[i] = av_add_q(m[i], av_make_q(1, 2 * num_entries));
1268 
1269  return m;
1270 }
1271 
1272 static bool trc_is_hdr(enum AVColorTransferCharacteristic trc)
1273 {
1274  static_assert(AVCOL_TRC_NB == 19, "Update this list when adding TRCs");
1275  static_assert(AVCOL_TRC_EXT_NB == 257, "Update this list when adding TRCs");
1276  switch (trc) {
1277  case AVCOL_TRC_LOG:
1278  case AVCOL_TRC_LOG_SQRT:
1279  case AVCOL_TRC_V_LOG:
1280  case AVCOL_TRC_SMPTEST2084:
1282  return true;
1283  default:
1284  return false;
1285  }
1286 }
1287 
1288 static int fmt_dither(SwsContext *ctx, SwsOpList *ops,
1289  const SwsPixelType type, const SwsFormat fmt)
1290 {
1291  SwsDither mode = ctx->dither;
1293 
1294  if (mode == SWS_DITHER_AUTO) {
1295  /* Visual threshold of perception: 12 bits for SDR, 14 bits for HDR */
1296  const int jnd_bits = trc_is_hdr(fmt.color.trc) ? 14 : 12;
1297  const int bpc = fmt.desc->comp[0].depth;
1298  mode = bpc >= jnd_bits ? SWS_DITHER_NONE : SWS_DITHER_BAYER;
1299  }
1300 
1301  switch (mode) {
1302  case SWS_DITHER_NONE:
1303  if (ctx->flags & SWS_ACCURATE_RND) {
1304  /* Add constant 0.5 for correct rounding */
1305  AVRational *bias = av_refstruct_allocz(sizeof(*bias));
1306  if (!bias)
1307  return AVERROR(ENOMEM);
1308  *bias = (AVRational) {1, 2};
1309  return ff_sws_op_list_append(ops, &(SwsOp) {
1310  .op = SWS_OP_DITHER,
1311  .type = type,
1312  .dither.matrix = bias,
1313  });
1314  } else {
1315  return 0; /* No-op */
1316  }
1317  case SWS_DITHER_BAYER:
1318  /* Hardcode 16x16 matrix for now; in theory we could adjust this
1319  * based on the expected level of precision in the output, since lower
1320  * bit depth outputs can suffice with smaller dither matrices; however
1321  * in practice we probably want to use error diffusion for such low bit
1322  * depths anyway */
1323  dither.size_log2 = 4;
1324  dither.matrix = generate_bayer_matrix(dither.size_log2);
1325  if (!dither.matrix)
1326  return AVERROR(ENOMEM);
1327  return ff_sws_op_list_append(ops, &(SwsOp) {
1328  .op = SWS_OP_DITHER,
1329  .type = type,
1330  .dither = dither,
1331  });
1332  case SWS_DITHER_ED:
1333  case SWS_DITHER_A_DITHER:
1334  case SWS_DITHER_X_DITHER:
1335  return AVERROR(ENOTSUP);
1336 
1337  case SWS_DITHER_NB:
1338  break;
1339  }
1340 
1341  av_unreachable("Invalid dither mode");
1342  return AVERROR(EINVAL);
1343 }
1344 
1345 static inline SwsLinearOp
1346 linear_mat3(const AVRational m00, const AVRational m01, const AVRational m02,
1347  const AVRational m10, const AVRational m11, const AVRational m12,
1348  const AVRational m20, const AVRational m21, const AVRational m22)
1349 {
1350  SwsLinearOp c = {{
1351  { m00, m01, m02, Q0, Q0 },
1352  { m10, m11, m12, Q0, Q0 },
1353  { m20, m21, m22, Q0, Q0 },
1354  { Q0, Q0, Q0, Q1, Q0 },
1355  }};
1356 
1357  c.mask = ff_sws_linear_mask(c);
1358  return c;
1359 }
1360 
1362  SwsOpList *ops, const SwsFormat fmt, bool *incomplete)
1363 {
1365 
1366  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1367  .op = SWS_OP_CONVERT,
1368  .type = fmt_pixel_type(fmt.format),
1369  .convert.to = type,
1370  }));
1371 
1372  /* Decode pixel format into standardized range */
1373  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1374  .type = type,
1375  .op = SWS_OP_LINEAR,
1376  .lin = fmt_decode_range(fmt, incomplete),
1377  }));
1378 
1379  /* Final step, decode colorspace */
1380  switch (fmt.csp) {
1381  case AVCOL_SPC_RGB:
1382  return 0;
1383  case AVCOL_SPC_UNSPECIFIED:
1385  *incomplete = true;
1386  /* fall through */
1387  case AVCOL_SPC_FCC:
1388  case AVCOL_SPC_BT470BG:
1389  case AVCOL_SPC_SMPTE170M:
1390  case AVCOL_SPC_BT709:
1391  case AVCOL_SPC_SMPTE240M:
1392  case AVCOL_SPC_BT2020_NCL: {
1393  AVRational crg = av_sub_q(Q0, av_div_q(c->cr, c->cg));
1394  AVRational cbg = av_sub_q(Q0, av_div_q(c->cb, c->cg));
1395  AVRational m02 = av_mul_q(Q(2), av_sub_q(Q1, c->cr));
1396  AVRational m21 = av_mul_q(Q(2), av_sub_q(Q1, c->cb));
1397  AVRational m11 = av_mul_q(cbg, m21);
1398  AVRational m12 = av_mul_q(crg, m02);
1399 
1400  return ff_sws_op_list_append(ops, &(SwsOp) {
1401  .type = type,
1402  .op = SWS_OP_LINEAR,
1403  .lin = linear_mat3(
1404  Q1, Q0, m02,
1405  Q1, m11, m12,
1406  Q1, m21, Q0
1407  ),
1408  });
1409  }
1410 
1411  case AVCOL_SPC_YCGCO:
1412  return ff_sws_op_list_append(ops, &(SwsOp) {
1413  .type = type,
1414  .op = SWS_OP_LINEAR,
1415  .lin = linear_mat3(
1416  Q1, Q(-1), Q( 1),
1417  Q1, Q( 1), Q( 0),
1418  Q1, Q(-1), Q(-1)
1419  ),
1420  });
1421 
1422  case AVCOL_SPC_BT2020_CL:
1423  case AVCOL_SPC_SMPTE2085:
1426  case AVCOL_SPC_ICTCP:
1427  case AVCOL_SPC_IPT_C2:
1428  case AVCOL_SPC_YCGCO_RE:
1429  case AVCOL_SPC_YCGCO_RO:
1430  return AVERROR(ENOTSUP);
1431 
1432  case AVCOL_SPC_RESERVED:
1433  return AVERROR(EINVAL);
1434 
1435  case AVCOL_SPC_NB:
1436  break;
1437  }
1438 
1439  av_unreachable("Corrupt AVColorSpace value?");
1440  return AVERROR(EINVAL);
1441 }
1442 
1444  SwsOpList *ops, const SwsFormat fmt, bool *incomplete)
1445 {
1447 
1448  switch (fmt.csp) {
1449  case AVCOL_SPC_RGB:
1450  break;
1451  case AVCOL_SPC_UNSPECIFIED:
1453  *incomplete = true;
1454  /* fall through */
1455  case AVCOL_SPC_FCC:
1456  case AVCOL_SPC_BT470BG:
1457  case AVCOL_SPC_SMPTE170M:
1458  case AVCOL_SPC_BT709:
1459  case AVCOL_SPC_SMPTE240M:
1460  case AVCOL_SPC_BT2020_NCL: {
1461  AVRational cb1 = av_sub_q(c->cb, Q1);
1462  AVRational cr1 = av_sub_q(c->cr, Q1);
1463  AVRational m20 = av_make_q(1,2);
1464  AVRational m10 = av_mul_q(m20, av_div_q(c->cr, cb1));
1465  AVRational m11 = av_mul_q(m20, av_div_q(c->cg, cb1));
1466  AVRational m21 = av_mul_q(m20, av_div_q(c->cg, cr1));
1467  AVRational m22 = av_mul_q(m20, av_div_q(c->cb, cr1));
1468 
1469  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1470  .type = type,
1471  .op = SWS_OP_LINEAR,
1472  .lin = linear_mat3(
1473  c->cr, c->cg, c->cb,
1474  m10, m11, m20,
1475  m20, m21, m22
1476  ),
1477  }));
1478  break;
1479  }
1480 
1481  case AVCOL_SPC_YCGCO:
1482  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1483  .type = type,
1484  .op = SWS_OP_LINEAR,
1485  .lin = linear_mat3(
1486  av_make_q( 1, 4), av_make_q(1, 2), av_make_q( 1, 4),
1487  av_make_q( 1, 2), av_make_q(0, 1), av_make_q(-1, 2),
1488  av_make_q(-1, 4), av_make_q(1, 2), av_make_q(-1, 4)
1489  ),
1490  }));
1491  break;
1492 
1493  case AVCOL_SPC_BT2020_CL:
1494  case AVCOL_SPC_SMPTE2085:
1497  case AVCOL_SPC_ICTCP:
1498  case AVCOL_SPC_IPT_C2:
1499  case AVCOL_SPC_YCGCO_RE:
1500  case AVCOL_SPC_YCGCO_RO:
1501  return AVERROR(ENOTSUP);
1502 
1503  case AVCOL_SPC_RESERVED:
1504  case AVCOL_SPC_NB:
1505  return AVERROR(EINVAL);
1506  }
1507 
1508  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1509  .type = type,
1510  .op = SWS_OP_LINEAR,
1511  .lin = fmt_encode_range(fmt, incomplete),
1512  }));
1513 
1514  if (!(fmt.desc->flags & AV_PIX_FMT_FLAG_FLOAT)) {
1515  SwsConst range = {0};
1516 
1517  const bool is_ya = fmt.desc->nb_components == 2;
1518  for (int i = 0; i < fmt.desc->nb_components; i++) {
1519  /* Clamp to legal pixel range */
1520  const int idx = i * (is_ya ? 3 : 1);
1521  range.q4[idx] = Q((1 << fmt.desc->comp[i].depth) - 1);
1522  }
1523 
1524  RET(fmt_dither(ctx, ops, type, fmt));
1525  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1526  .op = SWS_OP_MAX,
1527  .type = type,
1528  .c.q4 = { Q0, Q0, Q0, Q0 },
1529  }));
1530 
1531  RET(ff_sws_op_list_append(ops, &(SwsOp) {
1532  .op = SWS_OP_MIN,
1533  .type = type,
1534  .c = range,
1535  }));
1536  }
1537 
1538  return ff_sws_op_list_append(ops, &(SwsOp) {
1539  .type = type,
1540  .op = SWS_OP_CONVERT,
1541  .convert.to = fmt_pixel_type(fmt.format),
1542  });
1543 }
1544 
1545 #endif /* CONFIG_UNSTABLE */
AVCOL_PRI_RESERVED
@ AVCOL_PRI_RESERVED
Definition: pixfmt.h:640
SWS_OP_READ
@ SWS_OP_READ
Definition: ops.h:47
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:571
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
SWS_PIXEL_U16
@ SWS_PIXEL_U16
Definition: ops.h:33
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
RET
#define RET(x)
Definition: format.c:34
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
SWS_OP_SWIZZLE
@ SWS_OP_SWIZZLE
Definition: ops.h:57
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
SWS_DITHER_AUTO
@ SWS_DITHER_AUTO
Definition: swscale.h:81
AV_PIX_FMT_P416BE
@ AV_PIX_FMT_P416BE
interleaved chroma YUV 4:4:4, 48bpp, big-endian
Definition: pixfmt.h:398
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
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
SWS_OP_LSHIFT
@ SWS_OP_LSHIFT
Definition: ops.h:55
SWS_OP_UNPACK
@ SWS_OP_UNPACK
Definition: ops.h:50
AVColorTransferCharacteristic
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition: pixfmt.h:666
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:307
out
FILE * out
Definition: movenc.c:55
av_frame_get_side_data
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition: frame.c:659
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
AVCOL_SPC_YCGCO_RE
@ AVCOL_SPC_YCGCO_RE
YCgCo-R, even addition of bits.
Definition: pixfmt.h:718
SwsFormat::interlaced
int interlaced
Definition: format.h:79
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:3456
SwsConst
Definition: ops.h:76
SWS_OP_CLEAR
@ SWS_OP_CLEAR
Definition: ops.h:54
ff_sws_linear_mask
uint32_t ff_sws_linear_mask(const SwsLinearOp c)
Definition: ops.c:313
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
AV_PIX_FMT_YUV444P12MSBBE
@ AV_PIX_FMT_YUV444P12MSBBE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, big-endian
Definition: pixfmt.h:493
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
SwsSwizzleOp::z
uint8_t z
Definition: ops.h:121
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:226
ff_sws_op_list_append
int ff_sws_op_list_append(SwsOpList *ops, SwsOp *op)
These will take over ownership of op and set it to {0}, even on failure.
Definition: ops.c:297
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
mode
Definition: swscale.c:56
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
SwsFormat::range
enum AVColorRange range
Definition: format.h:81
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
Q1
#define Q1
Definition: format.c:32
AV_PIX_FMT_X2BGR10BE
@ AV_PIX_FMT_X2BGR10BE
packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), big-endian, X=unused/undefined
Definition: pixfmt.h:387
AVCOL_RANGE_JPEG
@ AVCOL_RANGE_JPEG
Full range content.
Definition: pixfmt.h:777
SWS_DITHER_NONE
@ SWS_DITHER_NONE
Definition: swscale.h:80
SWS_OP_DITHER
@ SWS_OP_DITHER
Definition: ops.h:59
AV_PIX_FMT_GBRPF32BE
@ AV_PIX_FMT_GBRPF32BE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian.
Definition: pixfmt.h:341
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
AVComponentDescriptor::depth
int depth
Number of bits in the component.
Definition: pixdesc.h:57
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:547
AVCOL_SPC_NB
@ AVCOL_SPC_NB
Not part of ABI.
Definition: pixfmt.h:720
AVCOL_TRC_UNSPECIFIED
@ AVCOL_TRC_UNSPECIFIED
Definition: pixfmt.h:669
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:701
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
SWS_PIXEL_U32
@ SWS_PIXEL_U32
Definition: ops.h:34
AVColorPrimaries
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:636
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_sub_q
AVRational av_sub_q(AVRational b, AVRational c)
Subtract one rational from another.
Definition: rational.c:101
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
AVCOL_SPC_BT2020_CL
@ AVCOL_SPC_BT2020_CL
ITU-R BT2020 constant luminance system.
Definition: pixfmt.h:712
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
legacy_format_entries
static const LegacyFormatEntry legacy_format_entries[]
Definition: format.c:48
AV_PIX_FMT_NB
@ AV_PIX_FMT_NB
hardware decoding through openharmony
Definition: pixfmt.h:502
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
SwsPixelType
SwsPixelType
Copyright (C) 2025 Niklas Haas.
Definition: ops.h:30
AV_PIX_FMT_GRAY16BE
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
Definition: pixfmt.h:104
SwsColor::gamut
AVPrimaryCoefficients gamut
Definition: format.h:63
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:706
AVCOL_SPC_RESERVED
@ AVCOL_SPC_RESERVED
reserved for future use by ITU-T and ISO/IEC just like 15-255 are
Definition: pixfmt.h:704
SwsSwizzleOp::w
uint8_t w
Definition: ops.h:121
SWS_PIXEL_F32
@ SWS_PIXEL_F32
Definition: ops.h:35
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:459
SwsDitherOp
Definition: ops.h:132
SwsDither
SwsDither
Definition: swscale.h:77
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:778
SWS_PIXEL_U8
@ SWS_PIXEL_U8
Definition: ops.h:32
SwsReadWriteOp
Definition: ops.h:95
SwsSwizzleOp
Definition: ops.h:113
type
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 just let it vf type
Definition: writing_filters.txt:86
SwsColor::trc
enum AVColorTransferCharacteristic trc
Definition: format.h:62
SWS_DITHER_X_DITHER
@ SWS_DITHER_X_DITHER
Definition: swscale.h:85
AVCOL_TRC_LOG_SQRT
@ AVCOL_TRC_LOG_SQRT
"Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
Definition: pixfmt.h:677
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
refstruct.h
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_refstruct_allocz
static void * av_refstruct_allocz(size_t size)
Equivalent to av_refstruct_alloc_ext(size, 0, NULL, NULL)
Definition: refstruct.h:105
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
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:78
AVCOL_PRI_RESERVED0
@ AVCOL_PRI_RESERVED0
Definition: pixfmt.h:637
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
dither
static const uint16_t dither[8][8]
Definition: vf_gradfun.c:46
AV_PIX_FMT_XV30BE
@ AV_PIX_FMT_XV30BE
packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb), big-endian, variant of Y410 where alpha channel i...
Definition: pixfmt.h:414
AV_PIX_FMT_YUV444P10MSBBE
@ AV_PIX_FMT_YUV444P10MSBBE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, big-endian
Definition: pixfmt.h:491
AV_PIX_FMT_GBRP16LE
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
Definition: pixfmt.h:172
ff_sws_encode_colors
int ff_sws_encode_colors(SwsContext *ctx, SwsPixelType type, SwsOpList *ops, const SwsFormat fmt, bool *incomplete)
AVCOL_PRI_NB
@ AVCOL_PRI_NB
Not part of ABI.
Definition: pixfmt.h:654
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:95
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
AVFormatContext::flags
int flags
Flags modifying the (de)muxer behaviour.
Definition: avformat.h:1415
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:707
pix_fmt
static enum AVPixelFormat pix_fmt
Definition: demux_decode.c:41
AV_PIX_FMT_NV20BE
@ AV_PIX_FMT_NV20BE
interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:200
AV_PIX_FMT_P016BE
@ AV_PIX_FMT_P016BE
like NV12, with 16bpp per component, big-endian
Definition: pixfmt.h:324
LegacyFormatEntry::is_supported_in
uint8_t is_supported_in
Definition: format.c:42
bits
uint8_t bits
Definition: vp3data.h:128
SWS_DITHER_BAYER
@ SWS_DITHER_BAYER
Definition: swscale.h:82
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:41
SWS_OP_MIN
@ SWS_OP_MIN
Definition: ops.h:64
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:530
AV_PIX_FMT_FLAG_ALPHA
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
Definition: pixdesc.h:147
ctx
AVFormatContext * ctx
Definition: movenc.c:49
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
SWS_OP_LINEAR
@ SWS_OP_LINEAR
Definition: ops.h:62
LegacyFormatEntry::is_supported_out
uint8_t is_supported_out
Definition: format.c:43
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:645
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_SPC_IPT_C2
@ AVCOL_SPC_IPT_C2
SMPTE ST 2128, IPT-C2.
Definition: pixfmt.h:717
AVCOL_PRI_UNSPECIFIED
@ AVCOL_PRI_UNSPECIFIED
Definition: pixfmt.h:639
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_SPC_CHROMA_DERIVED_CL
@ AVCOL_SPC_CHROMA_DERIVED_CL
Chromaticity-derived constant luminance system.
Definition: pixfmt.h:715
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:643
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:644
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
Q0
#define Q0
Definition: format.c:31
AV_PIX_FMT_GBRP10MSBLE
@ AV_PIX_FMT_GBRP10MSBLE
planar GBR 4:4:4 30bpp, lowest bits zero, little-endian
Definition: pixfmt.h:496
SWS_OP_PACK
@ SWS_OP_PACK
Definition: ops.h:51
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:66
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:561
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
format
New swscale design to change SwsGraph is what coordinates multiple passes These can include cascaded scaling error diffusion and so on Or we could have separate passes for the vertical and horizontal scaling In between each SwsPass lies a fully allocated image buffer Graph passes may have different levels of e g we can have a single threaded error diffusion pass following a multi threaded scaling pass SwsGraph is internally recreated whenever the image format
Definition: swscale-v2.txt:14
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
AVPixFmtDescriptor::nb_components
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:71
bias
static int bias(int x, int c)
Definition: vqcdec.c:115
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
av_unreachable
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
Definition: avassert.h:108
sws_is_noop
int sws_is_noop(const AVFrame *dst, const AVFrame *src)
Check if a given conversion is a noop.
Definition: format.c:595
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
ff_infer_colors
bool ff_infer_colors(SwsColor *src, SwsColor *dst)
Definition: format.c:508
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:638
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:525
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
FIELD_TOP
@ FIELD_TOP
Definition: format.h:56
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
AVCOL_SPC_YCGCO
@ AVCOL_SPC_YCGCO
used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
Definition: pixfmt.h:709
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_GBRP12MSBLE
@ AV_PIX_FMT_GBRP12MSBLE
planar GBR 4:4:4 36bpp, lowest bits zero, little-endian
Definition: pixfmt.h:498
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
AVPixFmtDescriptor::flags
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
Definition: pixdesc.h:94
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:743
SWS_PIXEL_NONE
@ SWS_PIXEL_NONE
Definition: ops.h:31
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
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:683
AVPrimaryCoefficients::b
AVCIExy b
Definition: csp.h:65
SwsPackOp::pattern
uint8_t pattern[4]
Definition: ops.h:110
AV_PIX_FMT_YUV444P10MSBLE
@ AV_PIX_FMT_YUV444P10MSBLE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, little-endian
Definition: pixfmt.h:492
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
LegacyFormatEntry::is_supported_endianness
uint8_t is_supported_endianness
Definition: format.c:44
test_loc
static int test_loc(enum AVChromaLocation loc)
Definition: format.c:566
AV_PIX_FMT_GBRP10MSBBE
@ AV_PIX_FMT_GBRP10MSBBE
planar GBR 4:4:4 30bpp, lowest bits zero, big-endian
Definition: pixfmt.h:495
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:87
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
AVCOL_TRC_SMPTEST2084
@ AVCOL_TRC_SMPTEST2084
Definition: pixfmt.h:684
AVCOL_SPC_YCGCO_RO
@ AVCOL_SPC_YCGCO_RO
YCgCo-R, odd addition of bits.
Definition: pixfmt.h:719
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
AVCOL_TRC_LOG
@ AVCOL_TRC_LOG
"Logarithmic transfer characteristic (100:1 range)"
Definition: pixfmt.h:676
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
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
AV_PIX_FMT_GRAY12LE
@ AV_PIX_FMT_GRAY12LE
Y , 12bpp, little-endian.
Definition: pixfmt.h:319
SWS_OP_RSHIFT
@ SWS_OP_RSHIFT
Definition: ops.h:56
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:284
AVPrimaryCoefficients::g
AVCIExy g
Definition: csp.h:65
AVCHROMA_LOC_UNSPECIFIED
@ AVCHROMA_LOC_UNSPECIFIED
Definition: pixfmt.h:797
SwsFormat
Definition: format.h:77
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
AV_PIX_FMT_GBRP12MSBBE
@ AV_PIX_FMT_GBRP12MSBBE
planar GBR 4:4:4 36bpp, lowest bits zero, big-endian
Definition: pixfmt.h:497
range
enum AVColorRange range
Definition: mediacodec_wrapper.c:2594
SWS_OP_WRITE
@ SWS_OP_WRITE
Definition: ops.h:48
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:83
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
AVCOL_TRC_EXT_NB
@ AVCOL_TRC_EXT_NB
Not part of ABI.
Definition: pixfmt.h:693
SwsColor
Definition: format.h:60
sws_test_transfer
int sws_test_transfer(enum AVColorTransferCharacteristic trc, int output)
Test if a given color transfer function is supported.
Definition: format.c:554
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
SWS_DITHER_NB
@ SWS_DITHER_NB
Definition: swscale.h:86
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:285
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
SwsLinearOp
Definition: ops.h:137
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
AVCOL_SPC_CHROMA_DERIVED_NCL
@ AVCOL_SPC_CHROMA_DERIVED_NCL
Chromaticity-derived non-constant luminance system.
Definition: pixfmt.h:714
SwsColor::frame_avg
AVRational frame_avg
Definition: format.h:67
Q
#define Q(N)
Definition: format.c:30
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:668
AVChromaLocation
AVChromaLocation
Location of chroma samples.
Definition: pixfmt.h:796
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:708
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
unpack
static int unpack(const uint8_t *src, const uint8_t *src_end, uint8_t *dst, int width, int height)
Unpack buffer.
Definition: eatgv.c:73
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:297
SwsFormat::format
enum AVPixelFormat format
Definition: format.h:80
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
AVCOL_SPC_BT2020_NCL
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
Definition: pixfmt.h:711
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:700
SwsPackOp
Definition: ops.h:109
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
SwsFormat::desc
const AVPixFmtDescriptor * desc
Definition: format.h:84
av_assert1
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:57
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:291
AV_PIX_FMT_NV20LE
@ AV_PIX_FMT_NV20LE
interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:199
ops_internal.h
AV_PIX_FMT_FLAG_BE
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
Definition: pixdesc.h:116
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
AV_PIX_FMT_X2RGB10BE
@ AV_PIX_FMT_X2RGB10BE
packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined
Definition: pixfmt.h:385
av_inv_q
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
Definition: rational.h:159
SwsFormat::width
int width
Definition: format.h:78
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:582
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
SwsOp
Definition: ops.h:178
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:703
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
ff_sws_decode_pixfmt
int ff_sws_decode_pixfmt(SwsOpList *ops, enum AVPixelFormat fmt)
Append a set of operations for decoding/encoding raw pixels.
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:650
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:178
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
SWS_DITHER_ED
@ SWS_DITHER_ED
Definition: swscale.h:83
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:641
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:265
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
SWS_OP_MAX
@ SWS_OP_MAX
Definition: ops.h:65
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:129
ff_sws_decode_colors
int ff_sws_decode_colors(SwsContext *ctx, SwsPixelType type, SwsOpList *ops, const SwsFormat fmt, bool *incomplete)
Append a set of operations for transforming decoded pixel values to/from normalized RGB in the specif...
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
AV_PIX_FMT_RGBAF32BE
@ AV_PIX_FMT_RGBAF32BE
IEEE-754 single precision packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., big-endian.
Definition: pixfmt.h:423
SWS_DITHER_A_DITHER
@ SWS_DITHER_A_DITHER
Definition: swscale.h:84
AVCOL_TRC_ARIB_STD_B67
@ AVCOL_TRC_ARIB_STD_B67
ARIB STD-B67, known as "Hybrid log-gamma".
Definition: pixfmt.h:687
AVCOL_PRI_EXT_NB
@ AVCOL_PRI_EXT_NB
Not part of ABI.
Definition: pixfmt.h:659
AV_PIX_FMT_Y210BE
@ AV_PIX_FMT_Y210BE
packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, big-endian
Definition: pixfmt.h:381
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
AVRational::den
int den
Denominator.
Definition: rational.h:60
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:705
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
SwsSwizzleOp::y
uint8_t y
Definition: ops.h:121
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
SWS_OP_SWAP_BYTES
@ SWS_OP_SWAP_BYTES
Definition: ops.h:49
SwsFormat::color
SwsColor color
Definition: format.h:85
hdr_dynamic_metadata.h
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
AVPixFmtDescriptor::comp
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:105
AV_PIX_FMT_FLAG_PLANAR
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
Definition: pixdesc.h:132
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
AV_PIX_FMT_V30XBE
@ AV_PIX_FMT_V30XBE
packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), big-endian
Definition: pixfmt.h:448
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
SwsSwizzleOp::x
uint8_t x
Definition: ops.h:121
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:82
SwsColor::min_luma
AVRational min_luma
Definition: format.h:64
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:78
SwsReadWriteOp::elems
uint8_t elems
Definition: ops.h:96
AV_PIX_FMT_RGBAF32LE
@ AV_PIX_FMT_RGBAF32LE
IEEE-754 single precision packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., little-endian.
Definition: pixfmt.h:424
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:65
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:282
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
LegacyFormatEntry
Definition: format.c:41
AVCOL_TRC_V_LOG
@ AVCOL_TRC_V_LOG
Definition: pixfmt.h:692
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
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
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
AVCOL_SPC_SMPTE2085
@ AVCOL_SPC_SMPTE2085
SMPTE 2085, Y'D'zD'x.
Definition: pixfmt.h:713
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
SWS_OP_CONVERT
@ SWS_OP_CONVERT
Definition: ops.h:58
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:684
AV_PIX_FMT_YUV444P12MSBLE
@ AV_PIX_FMT_YUV444P12MSBLE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, little-endian
Definition: pixfmt.h:494
AVCHROMA_LOC_NB
@ AVCHROMA_LOC_NB
Not part of ABI.
Definition: pixfmt.h:804
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
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:685
SWS_ACCURATE_RND
@ SWS_ACCURATE_RND
Force bit-exact output.
Definition: swscale.h:155
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
SwsOpList
Helper struct for representing a list of operations.
Definition: ops.h:208
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:702
AVColorRange
AVColorRange
Visual content value range.
Definition: pixfmt.h:742
SwsContext
Main external API structure.
Definition: swscale.h:189
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
AVCOL_SPC_ICTCP
@ AVCOL_SPC_ICTCP
ITU-R BT.2100-0, ICtCp.
Definition: pixfmt.h:716
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
csputils.h
src
#define src
Definition: vp8dsp.c:248
AVCOL_PRI_EXT_BASE
@ AVCOL_PRI_EXT_BASE
Definition: pixfmt.h:657
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
ff_sws_encode_pixfmt
int ff_sws_encode_pixfmt(SwsOpList *ops, enum AVPixelFormat fmt)
infer_trc_ref
static int infer_trc_ref(SwsColor *csp, const SwsColor *ref)
Definition: format.c:483
SwsColor::prim
enum AVColorPrimaries prim
Definition: format.h:61
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:710
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