FFmpeg
Loading...
Searching...
No Matches
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
22#include "libavutil/avassert.h"
24#include "libavutil/hwcontext.h"
26#include "libavutil/refstruct.h"
27
28#include "format.h"
29#include "csputils.h"
30#include "ops_internal.h"
31#include "config_components.h"
32#include "swscale_internal.h"
33
34#define RET(x) \
35 do { \
36 int _ret = (x); \
37 if (_ret < 0) \
38 return _ret; \
39 } while (0)
40
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, 1 },
237 [AV_PIX_FMT_YAF32BE] = { 1, 1 },
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, 1 },
273 [AV_PIX_FMT_RGBF32LE] = { 1, 1 },
274 [AV_PIX_FMT_RGBAF32BE] = { 1, 1 },
275 [AV_PIX_FMT_RGBAF32LE] = { 1, 1 },
276 [AV_PIX_FMT_XV30LE] = { 1, 1 },
277 [AV_PIX_FMT_XV36LE] = { 1, 1 },
278 [AV_PIX_FMT_XV36BE] = { 1, 1 },
279 [AV_PIX_FMT_XV48LE] = { 1, 1 },
280 [AV_PIX_FMT_XV48BE] = { 1, 1 },
281 [AV_PIX_FMT_AYUV] = { 1, 1 },
282 [AV_PIX_FMT_UYVA] = { 1, 1 },
283 [AV_PIX_FMT_VYU444] = { 1, 1 },
284 [AV_PIX_FMT_V30XLE] = { 1, 1 },
285};
286
288{
289 return (unsigned)pix_fmt < FF_ARRAY_ELEMS(legacy_format_entries) ?
290 legacy_format_entries[pix_fmt].is_supported_in : 0;
291}
292
294{
295 return (unsigned)pix_fmt < FF_ARRAY_ELEMS(legacy_format_entries) ?
296 legacy_format_entries[pix_fmt].is_supported_out : 0;
297}
298
300{
301 return (unsigned)pix_fmt < FF_ARRAY_ELEMS(legacy_format_entries) ?
302 legacy_format_entries[pix_fmt].is_supported_endianness : 0;
303}
304
306{
308 /* RGB-like family */
309 fmt->csp = AVCOL_SPC_RGB;
310 fmt->range = AVCOL_RANGE_JPEG;
311 } else if (desc->flags & AV_PIX_FMT_FLAG_XYZ) {
313 fmt->color = (SwsColor) {
314 .prim = AVCOL_PRI_BT709, /* swscale currently hard-codes this XYZ matrix */
315 .trc = AVCOL_TRC_SMPTE428,
316 };
317 } else if (desc->nb_components < 3) {
318 /* Grayscale formats */
321 fmt->range = AVCOL_RANGE_JPEG; // FIXME: this restriction should be lifted
322 }
323
324 if (desc->flags & AV_PIX_FMT_FLAG_FLOAT)
326
327 switch (av_pix_fmt_desc_get_id(desc)) {
333 fmt->range = AVCOL_RANGE_JPEG;
334 break;
335 }
336
337 if (!desc->log2_chroma_w && !desc->log2_chroma_h)
339}
340
341/**
342 * This function also sanitizes and strips the input data, removing irrelevant
343 * fields for certain formats.
344 */
346{
348 AVFrameSideData *sd;
349
350 enum AVPixelFormat format = frame->format;
351 enum AVPixelFormat hw_format = AV_PIX_FMT_NONE;
352
353 const AVPixFmtDescriptor *hw_desc = av_pix_fmt_desc_get(frame->format);
354 av_assert0(hw_desc);
355
356 if (hw_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
357 av_assert0(frame->hw_frames_ctx);
358
359 AVHWFramesContext *hwfc = (AVHWFramesContext *)frame->hw_frames_ctx->data;
360 hw_format = frame->format;
361 format = hwfc->sw_format;
362 }
363
365
366 SwsFormat fmt = {
367 .width = frame->width,
368 .height = frame->height,
369 .format = format,
370 .hw_format = hw_format,
371 .range = frame->color_range,
372 .csp = frame->colorspace,
373 .loc = frame->chroma_location,
374 .desc = desc,
375 .color = {
376 .prim = frame->color_primaries,
377 .trc = frame->color_trc,
378 },
379 };
380
381 av_assert1(fmt.width > 0);
382 av_assert1(fmt.height > 0);
385 sanitize_fmt(&fmt, desc);
386
387 if (frame->flags & AV_FRAME_FLAG_INTERLACED) {
388 fmt.height = (fmt.height + (field == FIELD_TOP)) >> 1;
389 fmt.interlaced = 1;
390 fmt.field = field;
391 }
392
393 /* Set luminance and gamut information */
394 fmt.color.min_luma = av_make_q(0, 1);
395 switch (fmt.color.trc) {
397 fmt.color.max_luma = av_make_q(10000, 1); break;
399 fmt.color.max_luma = av_make_q( 1000, 1); break; /* HLG reference display */
400 default:
401 fmt.color.max_luma = av_make_q( 203, 1); break; /* SDR reference brightness */
402 }
403
405 if (primaries)
406 fmt.color.gamut = primaries->prim;
407
410 if (mdm->has_luminance) {
411 fmt.color.min_luma = mdm->min_luminance;
412 fmt.color.max_luma = mdm->max_luminance;
413 }
414
415 if (mdm->has_primaries) {
416 /* Ignore mastering display white point as it has no bearance on
417 * the underlying content */
418 fmt.color.gamut.r.x = mdm->display_primaries[0][0];
419 fmt.color.gamut.r.y = mdm->display_primaries[0][1];
420 fmt.color.gamut.g.x = mdm->display_primaries[1][0];
421 fmt.color.gamut.g.y = mdm->display_primaries[1][1];
422 fmt.color.gamut.b.x = mdm->display_primaries[2][0];
423 fmt.color.gamut.b.y = mdm->display_primaries[2][1];
424 }
425 }
426
428 const AVDynamicHDRPlus *dhp = (const AVDynamicHDRPlus *) sd->data;
429 const AVHDRPlusColorTransformParams *pars = &dhp->params[0];
430 const AVRational nits = av_make_q(10000, 1);
431 AVRational maxrgb = pars->maxscl[0];
432
433 if (!dhp->num_windows || dhp->application_version > 1)
434 goto skip_hdr10;
435
436 /* Maximum of MaxSCL components */
437 if (av_cmp_q(pars->maxscl[1], maxrgb) > 0)
438 maxrgb = pars->maxscl[1];
439 if (av_cmp_q(pars->maxscl[2], maxrgb) > 0)
440 maxrgb = pars->maxscl[2];
441
442 if (maxrgb.num > 0) {
443 /* Estimate true luminance from MaxSCL */
445 if (!luma)
446 goto skip_hdr10;
447 fmt.color.frame_peak = av_add_q(av_mul_q(luma->cr, pars->maxscl[0]),
448 av_add_q(av_mul_q(luma->cg, pars->maxscl[1]),
449 av_mul_q(luma->cb, pars->maxscl[2])));
450 /* Scale the scene average brightness by the ratio between the
451 * maximum luminance and the MaxRGB values */
453 av_div_q(fmt.color.frame_peak, maxrgb));
454 } else {
455 /**
456 * Calculate largest value from histogram to use as fallback for
457 * clips with missing MaxSCL information. Note that this may end
458 * up picking the "reserved" value at the 5% percentile, which in
459 * practice appears to track the brightest pixel in the scene.
460 */
461 for (int i = 0; i < pars->num_distribution_maxrgb_percentiles; i++) {
462 const AVRational pct = pars->distribution_maxrgb[i].percentile;
463 if (av_cmp_q(pct, maxrgb) > 0)
464 maxrgb = pct;
465 fmt.color.frame_peak = maxrgb;
466 fmt.color.frame_avg = pars->average_maxrgb;
467 }
468 }
469
470 /* Rescale to nits */
471 fmt.color.frame_peak = av_mul_q(nits, fmt.color.frame_peak);
472 fmt.color.frame_avg = av_mul_q(nits, fmt.color.frame_avg);
473 }
474skip_hdr10:
475
476 /* PQ is always scaled down to absolute zero, so ignore mastering metadata */
477 if (fmt.color.trc == AVCOL_TRC_SMPTE2084)
478 fmt.color.min_luma = av_make_q(0, 1);
479
480 return fmt;
481}
482
484{
485 ff_fmt_clear(fmt);
486 fmt->format = pixfmt;
488 sanitize_fmt(fmt, fmt->desc);
489}
490
491static int infer_prim_ref(SwsColor *csp, const SwsColor *ref)
492{
493 if (csp->prim != AVCOL_PRI_UNSPECIFIED)
494 return 0;
495
496 /* Reuse the reference gamut only for "safe", similar primaries */
497 switch (ref->prim) {
498 case AVCOL_PRI_BT709:
499 case AVCOL_PRI_BT470M:
503 csp->prim = ref->prim;
504 csp->gamut = ref->gamut;
505 break;
506 default:
507 csp->prim = AVCOL_PRI_BT709;
509 break;
510 }
511
512 return 1;
513}
514
515static int infer_trc_ref(SwsColor *csp, const SwsColor *ref)
516{
517 if (csp->trc != AVCOL_TRC_UNSPECIFIED)
518 return 0;
519
520 /* Pick a suitable SDR transfer function, to try and minimize conversions */
521 switch (ref->trc) {
523 /* HDR curves, never default to these */
526 csp->trc = AVCOL_TRC_BT709;
527 csp->min_luma = av_make_q(0, 1);
528 csp->max_luma = av_make_q(203, 1);
529 break;
530 default:
531 csp->trc = ref->trc;
532 csp->min_luma = ref->min_luma;
533 csp->max_luma = ref->max_luma;
534 break;
535 }
536
537 return 1;
538}
539
541{
542 int incomplete = 0;
543
544 incomplete |= infer_prim_ref(dst, src);
545 incomplete |= infer_prim_ref(src, dst);
548
549 incomplete |= infer_trc_ref(dst, src);
550 incomplete |= infer_trc_ref(src, dst);
553
554 return incomplete;
555}
556
557static int infer_loc_ref(SwsFormat *fmt, const SwsFormat *ref)
558{
559 if (fmt->loc != AVCHROMA_LOC_UNSPECIFIED ||
561 (!fmt->desc->log2_chroma_w && !fmt->desc->log2_chroma_h))
562 return 0;
563
564 fmt->loc = ref->loc;
565 return 1;
566}
567
569{
570 int incomplete = 0;
571
572 incomplete |= infer_loc_ref(dst, src);
573 incomplete |= infer_loc_ref(src, dst);
574
575 return incomplete;
576}
577
578void ff_sws_chroma_pos(const SwsFormat *fmt, bool *incomplete,
579 int *out_x_pos, int *out_y_pos)
580{
581 enum AVChromaLocation chroma_loc = fmt->loc;
582 const int sub_x = fmt->desc->log2_chroma_w;
583 const int sub_y = fmt->desc->log2_chroma_h;
584 int x_pos, y_pos;
585
586 /* Explicitly default to center siting for compatibility with swscale */
587 if (chroma_loc == AVCHROMA_LOC_UNSPECIFIED) {
588 chroma_loc = AVCHROMA_LOC_CENTER;
589 *incomplete |= sub_x || sub_y;
590 }
591
592 /* av_chroma_location_enum_to_pos() always gives us values in the range from
593 * 0 to 256, but we need to adjust this to the true value range of the
594 * subsampling grid, which may be larger for h/v_sub > 1 */
595 av_chroma_location_enum_to_pos(&x_pos, &y_pos, chroma_loc);
596 x_pos *= (1 << sub_x) - 1;
597 y_pos *= (1 << sub_y) - 1;
598
599 /* Fix vertical chroma position for interlaced frames */
600 if (sub_y && fmt->interlaced) {
601 /* When vertically subsampling, chroma samples are effectively only
602 * placed next to even rows. To access them from the odd field, we need
603 * to account for this shift by offsetting the distance of one luma row.
604 *
605 * For 4x vertical subsampling (v_sub == 2), they are only placed
606 * next to every *other* even row, so we need to shift by three luma
607 * rows to get to the chroma sample. */
608 if (fmt->field == FIELD_BOTTOM)
609 y_pos += (256 << sub_y) - 256;
610
611 /* Luma row distance is doubled for fields, so halve offsets */
612 y_pos >>= 1;
613 }
614
615 *out_x_pos = x_pos;
616 *out_y_pos = y_pos;
617}
618
619/* Variant of sws_test_format() for the ops-based code */
620static int test_format_ops(enum AVPixelFormat format, int output);
621static int test_format_legacy(enum AVPixelFormat format, int output)
622{
624}
625
627 enum AVPixelFormat format, int output)
628{
629 /* The only non-ops backend is the legacy backend */
630 const SwsBackend backends_ops = SWS_BACKEND_ALL ^ SWS_BACKEND_LEGACY;
631 return ((backends & SWS_BACKEND_LEGACY) && test_format_legacy(format, output)) ||
632 ((backends & backends_ops) && test_format_ops(format, output));
633}
634
636{
638}
639
641{
642 switch (format) {
643 case AV_PIX_FMT_NONE: return 1;
644#if CONFIG_SWSCALE_VULKAN
645 case AV_PIX_FMT_VULKAN: return 1;
646#endif
647 default: return 0;
648 }
649}
650
651int sws_test_colorspace(enum AVColorSpace csp, int output)
652{
653 switch (csp) {
655 case AVCOL_SPC_RGB:
656 case AVCOL_SPC_BT709:
659 case AVCOL_SPC_FCC:
662 return 1;
663 default:
664 return 0;
665 }
666}
667
668int sws_test_primaries(enum AVColorPrimaries prim, int output)
669{
670 return ((prim > AVCOL_PRI_RESERVED0 && prim < AVCOL_PRI_NB) ||
671 (prim >= AVCOL_PRI_EXT_BASE && prim < AVCOL_PRI_EXT_NB)) &&
672 prim != AVCOL_PRI_RESERVED;
673}
674
676{
677 av_csp_eotf_function eotf = output ? av_csp_itu_eotf_inv(trc)
678 : av_csp_itu_eotf(trc);
679 return trc == AVCOL_TRC_UNSPECIFIED || eotf != NULL;
680}
681
683{
684 return (unsigned)range < AVCOL_RANGE_NB;
685}
686
687static int test_loc(enum AVChromaLocation loc)
688{
689 return (unsigned)loc < AVCHROMA_LOC_NB;
690}
691
692int ff_test_fmt(const SwsBackend backends, const SwsFormat *fmt, int output)
693{
694 return fmt->width > 0 && fmt->height > 0 &&
696 sws_test_colorspace(fmt->csp, output) &&
697 sws_test_primaries (fmt->color.prim, output) &&
698 sws_test_transfer (fmt->color.trc, output) &&
700 test_range (fmt->range) &&
701 test_loc (fmt->loc);
702}
703
704int sws_test_frame(const AVFrame *frame, int output)
705{
706 for (int field = 0; field < 2; field++) {
707 const SwsFormat fmt = ff_fmt_from_frame(frame, field);
708 if (!ff_test_fmt(SWS_BACKEND_STABLE, &fmt, output))
709 return 0;
710 if (!fmt.interlaced)
711 break;
712 }
713
714 return 1;
715}
716
717int sws_is_noop(const AVFrame *dst, const AVFrame *src)
718{
719 for (int field = 0; field < 2; field++) {
720 SwsFormat dst_fmt = ff_fmt_from_frame(dst, field);
721 SwsFormat src_fmt = ff_fmt_from_frame(src, field);
722 ff_infer_chroma_loc(&src_fmt, &dst_fmt);
723 if (!ff_fmt_equal(&dst_fmt, &src_fmt))
724 return 0;
725 if (!dst_fmt.interlaced)
726 break;
727 }
728
729 return 1;
730}
731
733{
734 dst->format = src->format;
735 dst->width = src->width;
736 dst->height = src->height;
737 dst->avframe = src;
738 for (int i = 0; i < FF_ARRAY_ELEMS(dst->data); i++) {
739 dst->data[i] = src->data[i];
740 dst->linesize[i] = src->linesize[i];
741 }
742}
743
744/**
745 * Returns the underlying descriptor for fake formats like PAL8 whose
746 * descriptors alone do not fully describe the pixel data.
747 */
749{
750 if (fmt == AV_PIX_FMT_PAL8)
752
755 return desc;
756}
757
758/* Returns the type suitable for a pixel after fully decoding/unpacking it */
760{
761 const int bits = FFALIGN(desc->comp[0].depth, 8);
762 if (desc->flags & AV_PIX_FMT_FLAG_FLOAT) {
763 switch (bits) {
764 case 32: return SWS_PIXEL_F32;
765 /* TODO: no support for 16-bit float yet */
766 }
767 } else {
768 switch (bits) {
769 case 8: return SWS_PIXEL_U8;
770 case 16: return SWS_PIXEL_U16;
771 /* TODO: AVRational cannot represent UINT32_MAX */
772 }
773 }
774
775 return SWS_PIXEL_NONE;
776}
777
778/* A regular format is defined as any format that contains only a single
779 * component per elementary data type (i.e. no sub-byte pack/unpack needed),
780 * and whose components map 1:1 onto elementary data units */
781static int is_regular_fmt(enum AVPixelFormat fmt)
782{
785 return 0; /* no 1:1 correspondence between components and data units */
786 if (desc->flags & (AV_PIX_FMT_FLAG_BITSTREAM))
787 return 0; /* bitstream formats are packed by definition */
788 if ((desc->flags & AV_PIX_FMT_FLAG_PLANAR) || desc->nb_components == 1)
789 return 1; /* planar formats are regular by definition */
790
791 const int step = desc->comp[0].step;
792 int total_bits = 0;
793
794 for (int i = 0; i < desc->nb_components; i++) {
795 if (desc->comp[i].shift || desc->comp[i].step != step)
796 return 0; /* irregular/packed format */
797 total_bits += desc->comp[i].depth;
798 }
799
800 /* Exclude formats with missing components like RGB0, 0RGB, etc. */
801 return total_bits == step * 8;
802}
803
810
811#define BITSTREAM_FMT(SWIZ, FRAC, MODE, ...) (FmtInfo) { \
812 .rw = { .elems = 1, .frac = FRAC, .mode = MODE }, \
813 .swizzle = SWIZ, \
814 __VA_ARGS__ \
815}
816
817#define SUBPACKED_FMT(SWIZ, ...) (FmtInfo) { \
818 .rw = { .elems = 1, .mode = SWS_RW_PACKED }, \
819 .swizzle = SWIZ, \
820 .pack.pattern = {__VA_ARGS__}, \
821}
822
823#define PACKED_FMT(SWIZ, N, ...) (FmtInfo) { \
824 .rw = { .elems = N, .mode = SWS_RW_PACKED }, \
825 .swizzle = SWIZ, \
826 __VA_ARGS__ \
827}
828
829#define RGBA SWS_SWIZZLE(0, 1, 2, 3)
830#define BGRA SWS_SWIZZLE(2, 1, 0, 3)
831#define ARGB SWS_SWIZZLE(3, 0, 1, 2)
832#define ABGR SWS_SWIZZLE(3, 2, 1, 0)
833#define AVYU SWS_SWIZZLE(3, 2, 0, 1)
834#define VYUA SWS_SWIZZLE(2, 0, 1, 3)
835#define UYVA SWS_SWIZZLE(1, 0, 2, 3)
836#define VUYA BGRA
837
839{
840 switch (fmt) {
841 /* Bitstream formats */
844 return BITSTREAM_FMT(RGBA, 3, SWS_RW_PLANAR);
845 case AV_PIX_FMT_RGB4: return BITSTREAM_FMT(RGBA, 1, SWS_RW_PACKED, .pack = {{ 1, 2, 1 }});
846 case AV_PIX_FMT_BGR4: return BITSTREAM_FMT(BGRA, 1, SWS_RW_PACKED, .pack = {{ 1, 2, 1 }});
847
848 /* Sub-packed 8-bit aligned formats */
849 case AV_PIX_FMT_RGB4_BYTE: return SUBPACKED_FMT(RGBA, 1, 2, 1);
850 case AV_PIX_FMT_BGR4_BYTE: return SUBPACKED_FMT(BGRA, 1, 2, 1);
851 case AV_PIX_FMT_RGB8: return SUBPACKED_FMT(RGBA, 3, 3, 2);
852 case AV_PIX_FMT_BGR8: return SUBPACKED_FMT(BGRA, 2, 3, 3);
853
854 /* Sub-packed 16-bit aligned formats */
857 return SUBPACKED_FMT(RGBA, 5, 6, 5);
860 return SUBPACKED_FMT(BGRA, 5, 6, 5);
863 return SUBPACKED_FMT(RGBA, 5, 5, 5);
866 return SUBPACKED_FMT(BGRA, 5, 5, 5);
869 return SUBPACKED_FMT(RGBA, 4, 4, 4);
872 return SUBPACKED_FMT(BGRA, 4, 4, 4);
873
874 /* Sub-packed 32-bit aligned formats */
877 return SUBPACKED_FMT(ARGB, 2, 10, 10, 10);
880 return SUBPACKED_FMT(ABGR, 2, 10, 10, 10);
883 return SUBPACKED_FMT(AVYU, 2, 10, 10, 10);
886 return SUBPACKED_FMT(VYUA, 10, 10, 10, 2);
887
888 /* 3-component formats with extra padding */
889 case AV_PIX_FMT_RGB0: return PACKED_FMT(RGBA, 4);
890 case AV_PIX_FMT_BGR0: return PACKED_FMT(BGRA, 4);
891 case AV_PIX_FMT_0RGB: return PACKED_FMT(ARGB, 4);
892 case AV_PIX_FMT_0BGR: return PACKED_FMT(ABGR, 4);
893 case AV_PIX_FMT_VUYX: return PACKED_FMT(VUYA, 4);
896 return PACKED_FMT(UYVA, 4, .shift = 4);
899 return PACKED_FMT(UYVA, 4);
900
901 /* Miscellaneous irregular formats */
902 case AV_PIX_FMT_PAL8:
903 return (FmtInfo) {
904 .rw = { .elems = 4, .mode = SWS_RW_PALETTE },
905 /* PAL8 is explicitly defined as endian-dependent */
906 #if AV_HAVE_BIGENDIAN
907 .swizzle = ARGB,
908 #else
909 .swizzle = BGRA,
910 #endif
911 };
912 }
913
914 return (FmtInfo) {0};
915}
916
917struct comp {
918 int index;
919 int plane;
921};
922
923/* Compare by (plane, offset) */
924static int cmp_comp(const void *a, const void *b) {
925 const struct comp *ca = a;
926 const struct comp *cb = b;
927 if (ca->plane != cb->plane)
928 return ca->plane - cb->plane;
929 return ca->offset - cb->offset;
930}
931
933 SwsSwizzleOp *swizzle, SwsShiftOp *shift)
934{
935 if (desc->nb_components == 2) {
936 /* YA formats */
937 *swizzle = SWS_SWIZZLE(0, 3, 1, 2);
938 } else {
939 /* Sort by increasing component order */
940 struct comp sorted[4] = { {0}, {1}, {2}, {3} };
941 for (int i = 0; i < desc->nb_components; i++) {
942 sorted[i].plane = desc->comp[i].plane;
943 sorted[i].offset = desc->comp[i].offset;
944 }
945
946 qsort(sorted, desc->nb_components, sizeof(struct comp), cmp_comp);
947
948 SwsSwizzleOp swiz = SWS_SWIZZLE(0, 1, 2, 3);
949 for (int i = 0; i < desc->nb_components; i++)
950 swiz.in[i] = sorted[i].index;
951 *swizzle = swiz;
952 }
953
955 if (desc->nb_components > 1 && !(desc->flags & AV_PIX_FMT_FLAG_PLANAR))
957
958 *shift = (SwsShiftOp) { desc->comp[0].shift };
959 *rw_op = (SwsReadWriteOp) {
960 .type = fmt_pixel_type(desc),
961 .elems = desc->nb_components,
962 .mode = mode,
963 };
964 return 0;
965}
966
967static int fmt_analyze(enum AVPixelFormat fmt, SwsReadWriteOp *rw_op,
968 SwsPackOp *pack_op, SwsSwizzleOp *swizzle,
969 SwsShiftOp *shift, SwsPixelType *pixel_type)
970{
972 if (!desc)
973 return AVERROR(EINVAL);
974
975 /* No support for subsampled formats at the moment */
976 if (desc->log2_chroma_w || desc->log2_chroma_h)
977 return AVERROR(ENOTSUP);
978
979 /* XYZ decoding requires TRC support, which is not implemented yet */
980 if (desc->flags & AV_PIX_FMT_FLAG_XYZ)
981 return AVERROR(ENOTSUP);
982
983 /* No support for semi-planar formats at the moment */
984 if (desc->flags & AV_PIX_FMT_FLAG_PLANAR &&
985 av_pix_fmt_count_planes(fmt) < desc->nb_components)
986 return AVERROR(ENOTSUP);
987
988 *pixel_type = fmt_pixel_type(desc);
989 if (!*pixel_type)
990 return AVERROR(ENOTSUP);
991
992 if (is_regular_fmt(fmt)) {
993 *pack_op = (SwsPackOp) {0};
994 return fmt_analyze_regular(desc, rw_op, swizzle, shift);
995 }
996
997 FmtInfo info = fmt_info_irregular(fmt);
998 if (!info.rw.elems)
999 return AVERROR(ENOTSUP);
1000
1001 *rw_op = info.rw;
1002 *pack_op = info.pack;
1003 *swizzle = info.swizzle;
1004 *shift = (SwsShiftOp) { info.shift };
1005
1006 if (info.pack.pattern[0]) {
1007 const int sum = info.pack.pattern[0] + info.pack.pattern[1] +
1008 info.pack.pattern[2] + info.pack.pattern[3];
1009 if (sum > 16)
1010 rw_op->type = SWS_PIXEL_U32;
1011 else if (sum > 8)
1012 rw_op->type = SWS_PIXEL_U16;
1013 else
1014 rw_op->type = SWS_PIXEL_U8;
1015 } else {
1016 rw_op->type = *pixel_type;
1017 }
1018
1019 return 0;
1020}
1021
1022static int test_format_ops(enum AVPixelFormat format, int output)
1023{
1024 SwsReadWriteOp rw;
1025 SwsSwizzleOp swizzle;
1026 SwsPackOp pack;
1028 SwsPixelType pixel_type;
1029 int ret = fmt_analyze(format, &rw, &pack, &swizzle, &shift, &pixel_type);
1030 if (ret < 0)
1031 return 0;
1032 if (rw.mode == SWS_RW_PALETTE && output)
1033 return 0; /* palettes are currently only supported as input */
1034 return 1;
1035}
1036
1037static void swizzle_inv(SwsSwizzleOp *swiz)
1038{
1039 /* Input[x] =: Output[swizzle.x] */
1040 unsigned tmp[4];
1041 tmp[swiz->x] = 0;
1042 tmp[swiz->y] = 1;
1043 tmp[swiz->z] = 2;
1044 tmp[swiz->w] = 3;
1045 *swiz = (SwsSwizzleOp) {{ .x = tmp[0], tmp[1], tmp[2], tmp[3] }};
1046}
1047
1048/**
1049 * This initializes all absent components explicitly to zero. There is no
1050 * need to worry about the correct neutral value as fmt_decode() will
1051 * implicitly ignore and overwrite absent components in any case. This function
1052 * is just to ensure that we don't operate on undefined memory. In most cases,
1053 * it will end up getting pushed towards the output or optimized away entirely
1054 * by the optimization pass.
1055 */
1057{
1059 const bool has_chroma = desc->nb_components >= 3;
1060 const bool has_alpha = desc->flags & AV_PIX_FMT_FLAG_ALPHA;
1062
1063 SwsClearOp c = {
1064 .mask = SWS_COMP_NONE,
1065 };
1066
1067 if (!has_chroma) {
1068 c.mask |= SWS_COMP(1) | SWS_COMP(2);
1069 c.value[1] = c.value[2] = Q(0);
1070 c.type[1] = c.type[2] = type;
1071 }
1072
1073 if (!has_alpha) {
1074 c.mask |= SWS_COMP(3);
1075 c.value[3] = Q(0);
1076 c.type[3] = type;
1077 }
1078
1079 return c;
1080}
1081
1082#if HAVE_BIGENDIAN
1083# define NATIVE_ENDIAN_FLAG AV_PIX_FMT_FLAG_BE
1084#else
1085# define NATIVE_ENDIAN_FLAG 0
1086#endif
1087
1088static inline AVRational64 intmax_q64(int bits)
1089{
1090 av_assert1(bits >= 0 && bits < 64);
1091 return Q(UINT64_MAX >> (64 - bits));
1092}
1093
1094/* Decode raw pixel values (read, swap, unpack, swizzle, shift, clear) */
1095static int decode_pixfmt(SwsOpList *ops, const SwsFormat *fmt)
1096{
1098 SwsPixelType pixel_type;
1099 SwsReadWriteOp rw_op;
1100 SwsSwizzleOp swizzle;
1102 SwsOpPad *inputs = ops->inputs;
1104
1105 RET(fmt_analyze(fmt->format, &rw_op, &unpack, &swizzle, &shift, &pixel_type));
1106 swizzle_inv(&swizzle);
1107
1108 /* Set baseline pixel content flags */
1109 const int integer = ff_sws_pixel_type_is_int(rw_op.type);
1110 const int swapped = ff_sws_pixel_type_size(rw_op.type) > 1 &&
1112 for (int i = 0; i < rw_op.elems; i++) {
1113 inputs[i].flags = (integer ? SWS_COMP_EXACT : 0) |
1114 (swapped ? SWS_COMP_SWAPPED : 0);
1115 }
1116
1117 /* Generate value range information for simple unpacked formats */
1118 if (integer && !unpack.pattern[0]) {
1119 /* YA formats have desc->comp[] in the order {Y, A} instead of the
1120 * canonical order {Y, U, V, A} */
1121 const int is_ya = desc->nb_components == 2;
1122 for (int c = 0; c < desc->nb_components; c++) {
1123 const int bits = desc->comp[c].depth + shift.amount;
1124 const int idx = swizzle.in[is_ya ? 3 * c : c];
1125 inputs[idx].min = Q(0);
1126 inputs[idx].max = intmax_q64(bits);
1127 }
1128 }
1129
1130 /* TODO: handle subsampled or semipacked input formats */
1132 .op = SWS_OP_READ,
1133 .rw = rw_op,
1134 }));
1135
1136 if (swapped) {
1138 .op = SWS_OP_SWAP_BYTES,
1139 }));
1140 }
1141
1142 if (unpack.pattern[0]) {
1144 .op = SWS_OP_UNPACK,
1145 .pack = unpack,
1146 }));
1147
1149 .op = SWS_OP_CONVERT,
1150 .convert.to = pixel_type,
1151 }));
1152 }
1153
1155 .op = SWS_OP_SWIZZLE,
1156 .swizzle = swizzle,
1157 }));
1158
1159 if (shift.amount) {
1161 .op = SWS_OP_RSHIFT,
1162 .shift = shift,
1163 }));
1164 }
1165
1167 .op = SWS_OP_CLEAR,
1168 .clear = fmt_clear(fmt),
1169 }));
1170
1171 return 0;
1172}
1173
1174/* Encode raw pixel values (shift, swizzle, pack, swap, write) */
1175static int encode_pixfmt(SwsOpList *ops, const SwsFormat *fmt)
1176{
1178 SwsPixelType pixel_type;
1179 SwsReadWriteOp rw_op;
1180 SwsSwizzleOp swizzle;
1181 SwsPackOp pack;
1183
1184 RET(fmt_analyze(fmt->format, &rw_op, &pack, &swizzle, &shift, &pixel_type));
1185 if (rw_op.mode == SWS_RW_PALETTE)
1186 return AVERROR(ENOTSUP);
1187
1188 if (shift.amount) {
1190 .op = SWS_OP_LSHIFT,
1191 .shift = shift,
1192 }));
1193 }
1194
1195 if (rw_op.elems > desc->nb_components) {
1196 /* Format writes unused alpha channel, clear it explicitly for sanity */
1199 .op = SWS_OP_CLEAR,
1200 .clear.type[3] = pixel_type,
1201 .clear.mask = SWS_COMP(3),
1202 .clear.value[3] = Q(0),
1203 }));
1204 }
1205
1207 .op = SWS_OP_SWIZZLE,
1208 .swizzle = swizzle,
1209 }));
1210
1211 if (pack.pattern[0]) {
1213 .op = SWS_OP_CONVERT,
1214 .convert.to = rw_op.type,
1215 }));
1216
1218 .op = SWS_OP_PACK,
1219 .pack = pack,
1220 }));
1221 }
1222
1223 if (ff_sws_pixel_type_size(rw_op.type) > 1 &&
1226 .op = SWS_OP_SWAP_BYTES,
1227 }));
1228 }
1229
1231 .op = SWS_OP_WRITE,
1232 .rw = rw_op,
1233 }));
1234
1235 return 0;
1236}
1237
1239{
1240 return (AVRational64) { -x.num, x.den };
1241}
1242
1243#define LINEAR_OP_DATA(TYPE, ...) ((SwsLinearOp) { \
1244 .type = { TYPE, TYPE, TYPE, TYPE }, \
1245 .m = { __VA_ARGS__ }, \
1246})
1247
1249 bool *incomplete)
1250{
1251 const AVRational64 q0 = Q(0);
1252 const AVRational64 q1 = Q(1);
1253
1255 { q1, q0, q0, q0, q0 },
1256 { q0, q1, q0, q0, q0 },
1257 { q0, q0, q1, q0, q0 },
1258 { q0, q0, q0, q1, q0 },
1259 );
1260
1262 const int depth0 = desc->comp[0].depth;
1263 const int depth1 = desc->comp[1].depth;
1264 const int depth2 = desc->comp[2].depth;
1265 const int depth3 = desc->comp[3].depth;
1266
1267 if (desc->flags & AV_PIX_FMT_FLAG_FLOAT)
1268 return c; /* floats are directly output as-is */
1269
1270 if (fmt->csp == AVCOL_SPC_RGB || (desc->flags & AV_PIX_FMT_FLAG_XYZ)) {
1271 c.m[0][0] = intmax_q64(depth0);
1272 c.m[1][1] = intmax_q64(depth1);
1273 c.m[2][2] = intmax_q64(depth2);
1274 } else if (fmt->range == AVCOL_RANGE_JPEG) {
1275 /* Full range YUV */
1276 c.m[0][0] = intmax_q64(depth0);
1277 if (desc->nb_components >= 3) {
1278 /* This follows the ITU-R convention, which is slightly different
1279 * from the JFIF convention. */
1280 c.m[1][1] = intmax_q64(depth1);
1281 c.m[2][2] = intmax_q64(depth2);
1282 c.m[1][4] = Q(1 << (depth1 - 1));
1283 c.m[2][4] = Q(1 << (depth2 - 1));
1284 }
1285 } else {
1286 /* Limited range YUV */
1287 if (fmt->range == AVCOL_RANGE_UNSPECIFIED)
1288 *incomplete = true;
1289 c.m[0][0] = Q(219 << (depth0 - 8));
1290 c.m[0][4] = Q( 16 << (depth0 - 8));
1291 if (desc->nb_components >= 3) {
1292 c.m[1][1] = Q(224 << (depth1 - 8));
1293 c.m[2][2] = Q(224 << (depth2 - 8));
1294 c.m[1][4] = Q(128 << (depth1 - 8));
1295 c.m[2][4] = Q(128 << (depth2 - 8));
1296 }
1297 }
1298
1299 if (desc->flags & AV_PIX_FMT_FLAG_ALPHA) {
1300 const bool is_ya = desc->nb_components == 2;
1301 c.m[3][3] = intmax_q64(is_ya ? depth1 : depth3);
1302 }
1303
1304 if (fmt->format == AV_PIX_FMT_MONOWHITE) {
1305 /* This format is inverted, 0 = white, 1 = black */
1306 c.m[0][4] = ff_add_q64(c.m[0][4], c.m[0][0]);
1307 c.m[0][0] = av_neg_q64(c.m[0][0]);
1308 }
1309
1310 return c;
1311}
1312
1313static SwsLinearOp fmt_decode_range(const SwsFormat *fmt, SwsPixelType type, bool *incomplete)
1314{
1315 SwsLinearOp c = fmt_encode_range(fmt, type, incomplete);
1316
1317 /* Invert main diagonal + offset: x = s * y + k ==> y = (x - k) / s */
1318 for (int i = 0; i < 4; i++) {
1319 av_assert1(c.m[i][i].num);
1320 c.m[i][i] = ff_inv_q64(c.m[i][i]);
1321 c.m[i][4] = ff_mul_q64(c.m[i][4], av_neg_q64(c.m[i][i]));
1322 }
1323
1324 /* Explicitly initialize alpha for sanity */
1325 if (!(fmt->desc->flags & AV_PIX_FMT_FLAG_ALPHA))
1326 c.m[3][4] = Q(1);
1327
1328 return c;
1329}
1330
1331static AVRational64 *generate_bayer_matrix(const int size_log2)
1332{
1333 const int size = 1 << size_log2;
1334 const int num_entries = size * size;
1335 AVRational64 *m = ff_refstruct_calloc(num_entries, sizeof(*m));
1336 av_assert1(size_log2 < 16);
1337 if (!m)
1338 return NULL;
1339
1340 /* Start with a 1x1 matrix */
1341 m[0] = Q(0);
1342
1343 /* Generate three copies of the current, appropriately scaled and offset */
1344 for (int sz = 1; sz < size; sz <<= 1) {
1345 const int den = 4 * sz * sz;
1346 for (int y = 0; y < sz; y++) {
1347 for (int x = 0; x < sz; x++) {
1348 const AVRational64 cur = m[y * size + x];
1349 m[(y + sz) * size + x + sz] = ff_add_q64(cur, ff_make_q64(1, den));
1350 m[(y ) * size + x + sz] = ff_add_q64(cur, ff_make_q64(2, den));
1351 m[(y + sz) * size + x ] = ff_add_q64(cur, ff_make_q64(3, den));
1352 }
1353 }
1354 }
1355
1356 /**
1357 * To correctly round, we need to evenly distribute the result on [0, 1),
1358 * giving an average value of 1/2.
1359 *
1360 * After the above construction, we have a matrix with average value:
1361 * [ 0/N + 1/N + 2/N + ... (N-1)/N ] / N = (N-1)/(2N)
1362 * where N = size * size is the total number of entries.
1363 *
1364 * To make the average value equal to 1/2 = N/(2N), add a bias of 1/(2N).
1365 */
1366 for (int i = 0; i < num_entries; i++)
1367 m[i] = ff_add_q64(m[i], ff_make_q64(1, 2 * num_entries));
1368
1369 return m;
1370}
1371
1373{
1374 static_assert(AVCOL_TRC_NB == 19, "Update this list when adding TRCs");
1375 static_assert(AVCOL_TRC_EXT_NB == 257, "Update this list when adding TRCs");
1376 switch (trc) {
1377 case AVCOL_TRC_LOG:
1378 case AVCOL_TRC_LOG_SQRT:
1379 case AVCOL_TRC_V_LOG:
1382 return true;
1383 default:
1384 return false;
1385 }
1386}
1387
1389 const SwsFormat *src, const SwsFormat *dst)
1390{
1391 SwsDither mode = ctx->dither;
1393 const int bpc = dst->desc->comp[0].depth;
1394
1395 if (mode == SWS_DITHER_AUTO) {
1396 /* Visual threshold of perception: 12 bits for SDR, 14 bits for HDR */
1397 const int jnd_bits = trc_is_hdr(dst->color.trc) ? 14 : 12;
1398 mode = bpc >= jnd_bits ? SWS_DITHER_NONE : SWS_DITHER_BAYER;
1399 }
1400
1401 switch (mode) {
1402 case SWS_DITHER_NONE:
1403 if (ctx->flags & SWS_ACCURATE_RND) {
1404 /* Add constant 0.5 for correct rounding */
1406 if (!bias)
1407 return AVERROR(ENOMEM);
1408 *bias = (AVRational64) {1, 2};
1409 return ff_sws_op_list_append(ops, &(SwsOp) {
1410 .op = SWS_OP_DITHER,
1411 .dither.matrix = bias,
1412 .dither.min = *bias,
1413 .dither.max = *bias,
1414 });
1415 } else {
1416 return 0; /* No-op */
1417 }
1418 case SWS_DITHER_BAYER:
1419 /* Hardcode 16x16 matrix for now; in theory we could adjust this
1420 * based on the expected level of precision in the output, since lower
1421 * bit depth outputs can suffice with smaller dither matrices; however
1422 * in practice we probably want to use error diffusion for such low bit
1423 * depths anyway */
1424 dither.size_log2 = 4;
1425 dither.matrix = generate_bayer_matrix(dither.size_log2);
1426 if (!dither.matrix)
1427 return AVERROR(ENOMEM);
1428
1429 const int size = 1 << dither.size_log2;
1430 dither.min = dither.max = dither.matrix[0];
1431 for (int i = 1; i < size * size; i++) {
1432 if (ff_cmp_q64(dither.min, dither.matrix[i]) > 0)
1433 dither.min = dither.matrix[i];
1434 if (ff_cmp_q64(dither.matrix[i], dither.max) > 0)
1435 dither.max = dither.matrix[i];
1436 }
1437
1438 /* Brute-forced offsets; minimizes quantization error across a 16x16
1439 * bayer dither pattern for standard RGBA and YUVA pixel formats */
1440 const int offsets_16x16[4] = {0, 3, 2, 5};
1441 for (int i = 0; i < 4; i++) {
1442 av_assert0(offsets_16x16[i] <= INT8_MAX);
1443 dither.y_offset[i] = offsets_16x16[i];
1444 }
1445
1446 const AVPixFmtDescriptor *src_desc = fmt_desc_decoded(src->format);
1447 if (src_desc->nb_components < 3 && bpc >= 8) {
1448 /**
1449 * For high-bit-depth sources without chroma, use same matrix
1450 * offset for all color channels. This prevents introducing color
1451 * noise in grayscale images; and also allows optimizing the dither
1452 * operation. Skipped for low bit depth (<8 bpc) as the loss in
1453 * PSNR, from the inability to diffuse error among all three
1454 * channels, can be substantial.
1455 *
1456 * This shifts: { X, Y, Z, W } -> { X, X, X, Y }
1457 */
1458 dither.y_offset[3] = dither.y_offset[1];
1459 dither.y_offset[1] = dither.y_offset[2] = dither.y_offset[0];
1460 }
1461
1462 return ff_sws_op_list_append(ops, &(SwsOp) {
1463 .op = SWS_OP_DITHER,
1464 .dither = dither,
1465 });
1466 case SWS_DITHER_ED:
1469 return AVERROR(ENOTSUP);
1470
1471 case SWS_DITHER_NB:
1472 break;
1473 }
1474
1475 av_unreachable("Invalid dither mode");
1476 return AVERROR(EINVAL);
1477}
1478
1479#define Q64(x) ff_make_q64((x).num, (x).den)
1480
1481static inline SwsLinearOp
1483 const AVRational m00, const AVRational m01, const AVRational m02,
1484 const AVRational m10, const AVRational m11, const AVRational m12,
1485 const AVRational m20, const AVRational m21, const AVRational m22)
1486{
1487 return LINEAR_OP_DATA(type,
1488 { Q64(m00), Q64(m01), Q64(m02), Q(0), Q(0) },
1489 { Q64(m10), Q64(m11), Q64(m12), Q(0), Q(0) },
1490 { Q64(m20), Q64(m21), Q64(m22), Q(0), Q(0) },
1491 { Q(0), Q(0), Q(0), Q(1), Q(0) },
1492 );
1493}
1494
1495/* Transform decoded pixel values to normalized RGB */
1497 const SwsFormat *fmt, bool *incomplete)
1498{
1500 const SwsPixelType pixel_type = fmt_pixel_type(fmt->desc);
1501 if (!pixel_type)
1502 return AVERROR(ENOTSUP);
1503
1504 const AVRational q0 = av_make_q(0, 1);
1505 const AVRational q1 = av_make_q(1, 1);
1506 const AVRational q2 = av_make_q(2, 1);
1507
1509 .op = SWS_OP_CONVERT,
1510 .convert.to = type,
1511 }));
1512
1513 /* Decode pixel format into standardized range */
1515 .op = SWS_OP_LINEAR,
1516 .lin = fmt_decode_range(fmt, type, incomplete),
1517 }));
1518
1519 /* Final step, decode colorspace */
1520 switch (fmt->csp) {
1521 case AVCOL_SPC_RGB:
1522 return 0;
1525 *incomplete = true;
1527 case AVCOL_SPC_FCC:
1528 case AVCOL_SPC_BT470BG:
1530 case AVCOL_SPC_BT709:
1532 case AVCOL_SPC_BT2020_NCL: {
1533 AVRational crg = av_sub_q(q0, av_div_q(c->cr, c->cg));
1534 AVRational cbg = av_sub_q(q0, av_div_q(c->cb, c->cg));
1535 AVRational m02 = av_mul_q(q2, av_sub_q(q1, c->cr));
1536 AVRational m21 = av_mul_q(q2, av_sub_q(q1, c->cb));
1537 AVRational m11 = av_mul_q(cbg, m21);
1538 AVRational m12 = av_mul_q(crg, m02);
1539
1540 return ff_sws_op_list_append(ops, &(SwsOp) {
1541 .op = SWS_OP_LINEAR,
1542 .lin = linear_mat3(type,
1543 q1, q0, m02,
1544 q1, m11, m12,
1545 q1, m21, q0
1546 ),
1547 });
1548 }
1549
1550 case AVCOL_SPC_YCGCO:
1551 return ff_sws_op_list_append(ops, &(SwsOp) {
1552 .op = SWS_OP_LINEAR,
1553 .lin = linear_mat3(type,
1554 q1, av_make_q(-1, 1), av_make_q( 1, 1),
1555 q1, av_make_q( 1, 1), av_make_q( 0, 1),
1556 q1, av_make_q(-1, 1), av_make_q(-1, 1)
1557 ),
1558 });
1559
1564 case AVCOL_SPC_ICTCP:
1565 case AVCOL_SPC_IPT_C2:
1566 case AVCOL_SPC_YCGCO_RE:
1567 case AVCOL_SPC_YCGCO_RO:
1568 return AVERROR(ENOTSUP);
1569
1570 case AVCOL_SPC_RESERVED:
1571 return AVERROR(EINVAL);
1572
1573 case AVCOL_SPC_NB:
1574 break;
1575 }
1576
1577 av_unreachable("Corrupt AVColorSpace value?");
1578 return AVERROR(EINVAL);
1579}
1580
1581/* Transform decoded pixel values from normalized RGB */
1583 const SwsFormat *src, const SwsFormat *dst,
1584 bool *incomplete)
1585{
1587 const SwsPixelType pixel_type = fmt_pixel_type(dst->desc);
1588 if (!pixel_type)
1589 return AVERROR(ENOTSUP);
1590
1591 switch (dst->csp) {
1592 case AVCOL_SPC_RGB:
1593 break;
1596 *incomplete = true;
1598 case AVCOL_SPC_FCC:
1599 case AVCOL_SPC_BT470BG:
1601 case AVCOL_SPC_BT709:
1603 case AVCOL_SPC_BT2020_NCL: {
1604 AVRational cb1 = av_sub_q(c->cb, av_make_q(1, 1));
1605 AVRational cr1 = av_sub_q(c->cr, av_make_q(1, 1));
1606 AVRational m20 = av_make_q(1,2);
1607 AVRational m10 = av_mul_q(m20, av_div_q(c->cr, cb1));
1608 AVRational m11 = av_mul_q(m20, av_div_q(c->cg, cb1));
1609 AVRational m21 = av_mul_q(m20, av_div_q(c->cg, cr1));
1610 AVRational m22 = av_mul_q(m20, av_div_q(c->cb, cr1));
1611
1613 .op = SWS_OP_LINEAR,
1614 .lin = linear_mat3(type,
1615 c->cr, c->cg, c->cb,
1616 m10, m11, m20,
1617 m20, m21, m22
1618 ),
1619 }));
1620 break;
1621 }
1622
1623 case AVCOL_SPC_YCGCO:
1625 .op = SWS_OP_LINEAR,
1626 .lin = linear_mat3(type,
1627 av_make_q( 1, 4), av_make_q(1, 2), av_make_q( 1, 4),
1628 av_make_q( 1, 2), av_make_q(0, 1), av_make_q(-1, 2),
1629 av_make_q(-1, 4), av_make_q(1, 2), av_make_q(-1, 4)
1630 ),
1631 }));
1632 break;
1633
1638 case AVCOL_SPC_ICTCP:
1639 case AVCOL_SPC_IPT_C2:
1640 case AVCOL_SPC_YCGCO_RE:
1641 case AVCOL_SPC_YCGCO_RO:
1642 return AVERROR(ENOTSUP);
1643
1644 case AVCOL_SPC_RESERVED:
1645 case AVCOL_SPC_NB:
1646 return AVERROR(EINVAL);
1647 }
1648
1650 .op = SWS_OP_LINEAR,
1651 .lin = fmt_encode_range(dst, type, incomplete),
1652 }));
1653
1654 if (!(dst->desc->flags & AV_PIX_FMT_FLAG_FLOAT)) {
1655 SwsClampOp range = {0};
1656
1657 const bool is_ya = dst->desc->nb_components == 2;
1658 for (int i = 0; i < dst->desc->nb_components; i++) {
1659 /* Clamp to legal pixel range */
1660 const int idx = i * (is_ya ? 3 : 1);
1661 range.limit[idx] = intmax_q64(dst->desc->comp[i].depth);
1662 }
1663
1664 RET(fmt_dither(ctx, ops, src, dst));
1666 .op = SWS_OP_MAX,
1667 .clamp = {{ Q(0), Q(0), Q(0), Q(0) }},
1668 }));
1669
1671 .op = SWS_OP_MIN,
1672 .clamp = range,
1673 }));
1674 }
1675
1676 return ff_sws_op_list_append(ops, &(SwsOp) {
1677 .op = SWS_OP_CONVERT,
1678 .convert.to = pixel_type,
1679 });
1680}
1681
1683{
1684 if (ctx->scaler != SWS_SCALE_AUTO)
1685 return ctx->scaler;
1686
1687 /* Backwards compatibility with legacy flags API */
1688 if (ctx->flags & SWS_BILINEAR) {
1689 return SWS_SCALE_BILINEAR;
1690 } else if (ctx->flags & (SWS_BICUBIC | SWS_BICUBLIN)) {
1691 return SWS_SCALE_BICUBIC;
1692 } else if (ctx->flags & SWS_POINT) {
1693 return SWS_SCALE_POINT;
1694 } else if (ctx->flags & SWS_AREA) {
1695 return SWS_SCALE_AREA;
1696 } else if (ctx->flags & SWS_GAUSS) {
1697 return SWS_SCALE_GAUSSIAN;
1698 } else if (ctx->flags & SWS_SINC) {
1699 return SWS_SCALE_SINC;
1700 } else if (ctx->flags & SWS_LANCZOS) {
1701 return SWS_SCALE_LANCZOS;
1702 } else if (ctx->flags & SWS_SPLINE) {
1703 return SWS_SCALE_SPLINE;
1704 } else {
1705 return SWS_SCALE_AUTO;
1706 }
1707}
1708
1710 SwsOpType filter, int src_size, int dst_size)
1711{
1712 if (src_size == dst_size)
1713 return 0; /* no-op */
1714
1716 .scaler = get_scaler_fallback(ctx),
1717 .src_size = src_size,
1718 .dst_size = dst_size,
1719 };
1720
1721 for (int i = 0; i < SWS_NUM_SCALER_PARAMS; i++)
1722 params.scaler_params[i] = ctx->scaler_params[i];
1723
1724 SwsFilterWeights *kernel;
1725 int ret = ff_sws_filter_generate(ctx, &params, &kernel);
1726 if (ret == AVERROR(ENOTSUP)) {
1727 /* Filter size exceeds limit; cascade with geometric mean size */
1728 int mean = sqrt((int64_t) src_size * dst_size);
1729 if (mean == src_size || mean == dst_size)
1730 return AVERROR_BUG; /* sanity, prevent infinite loop */
1731 ret = add_filter(ctx, type, ops, filter, src_size, mean);
1732 if (ret < 0)
1733 return ret;
1734 return add_filter(ctx, type, ops, filter, mean, dst_size);
1735 } else if (ret < 0) {
1736 return ret;
1737 }
1738
1739 return ff_sws_op_list_append(ops, &(SwsOp) {
1740 .op = filter,
1741 .filter.kernel = kernel,
1742 .filter.type = type,
1743 });
1744}
1745
1747 const SwsFormat *src, const SwsFormat *dst)
1748{
1749 /**
1750 * Always perform horizontal scaling first, since it's much more likely to
1751 * benefit from small integer optimizations; we should maybe flip the order
1752 * here if we're downscaling the vertical resolution by a lot, though.
1753 */
1754 int ret = add_filter(ctx, type, ops, SWS_OP_FILTER_H, src->width, dst->width);
1755 if (ret < 0)
1756 return ret;
1757
1758 return add_filter(ctx, type, ops, SWS_OP_FILTER_V, src->height, dst->height);
1759}
1760
1761/* The input and output domain are assumed to be normalized [0, 1] RGBA */
1763 const SwsLut3D *lut3d)
1764{
1765 /* Unnormalize to LUT input domain and clamp */
1766 const AVRational64 domain = Q(INPUT_LUT_SIZE - 1);
1767
1769 .op = SWS_OP_LINEAR,
1770 .lin = LINEAR_OP_DATA(type,
1771 { domain, Q(0), Q(0), Q(0), Q(0) },
1772 { Q(0), domain, Q(0), Q(0), Q(0) },
1773 { Q(0), Q(0), domain, Q(0), Q(0) },
1774 { Q(0), Q(0), Q(0), Q(1), Q(0) },
1775 ),
1776 }));
1777
1779 .op = SWS_OP_MAX,
1780 .clamp = {{ Q(0), Q(0), Q(0) }},
1781 }));
1782
1784 .op = SWS_OP_MIN,
1785 .clamp = {{ domain, domain, domain }},
1786 }));
1787
1788 /* Apply the 3DLUT itself */
1790 .op = SWS_OP_LUT_3D,
1791 .lut3d.lut = av_refstruct_ref_c(lut3d),
1792 .lut3d.dynamic = lut3d->dynamic,
1793 }));
1794
1795 /* Normalize back to [0, 1] */
1796 const AVRational64 inv = ff_inv_q64(Q(UINT16_MAX));
1798 .op = SWS_OP_LINEAR,
1799 .lin = LINEAR_OP_DATA(type,
1800 { inv, Q(0), Q(0), Q(0), Q(0) },
1801 { Q(0), inv, Q(0), Q(0), Q(0) },
1802 { Q(0), Q(0), inv, Q(0), Q(0) },
1803 { Q(0), Q(0), Q(0), Q(1), Q(0) },
1804 ),
1805 }));
1806
1807 return 0;
1808}
1809
1811 const SwsLut3D *lut3d, SwsOpList *ops, bool *incomplete)
1812{
1814 RET(decode_pixfmt(ops, src));
1815 RET(decode_colors(ctx, type, ops, src, incomplete));
1816 RET(add_filters(ctx, type, ops, src, dst));
1817 if (lut3d)
1818 RET(apply_lut3d(ctx, type, ops, lut3d));
1819 RET(encode_colors(ctx, type, ops, src, dst, incomplete));
1820 RET(encode_pixfmt(ops, dst));
1821 return 0;
1822}
1823
1825 const SwsFormat *dst, const SwsLut3D *lut3d,
1826 SwsOpList **out_ops, bool *incomplete)
1827{
1828 /* The new code does not yet support alpha blending */
1829 if (src->desc->flags & AV_PIX_FMT_FLAG_ALPHA &&
1830 ctx->alpha_blend != SWS_ALPHA_BLEND_NONE)
1831 return AVERROR(ENOTSUP);
1832
1834 if (!ops)
1835 return AVERROR(ENOMEM);
1836 ops->src = *src;
1837 ops->dst = *dst;
1838
1839 int ret = fmt_convert(ctx, src, dst, lut3d, ops, incomplete);
1840 if (ret < 0)
1841 goto fail;
1842
1843 *out_ops = ops;
1844 return 0;
1845
1846fail:
1847 ff_sws_op_list_free(&ops);
1848 return ret;
1849}
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:97
SwsAArch64OpImplParams params
Definition ops.c:52
static const AVFilterPad inputs[]
Definition af_aap.c:299
static const char *const format[]
Definition af_aiir.c:445
static AVFormatContext * ctx
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition avassert.h:58
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
Definition avassert.h:109
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition avassert.h:42
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static enum AVPixelFormat pix_fmt
static AVFrame * frame
#define RGBA(r, g, b, a)
Definition dvbsubdec.c:42
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
static const uint8_t bits[8]
Definition fastaudio.c:100
int ret
Definition ffplay.c:391
int ff_sws_filter_generate(void *log, const SwsFilterParams *params, SwsFilterWeights **out)
Generate a filter kernel for the given parameters.
Definition filters.c:203
@ FIELD_TOP
Definition format.h:56
@ FIELD_BOTTOM
Definition format.h:57
static void ff_fmt_clear(SwsFormat *fmt)
Definition format.h:94
static int ff_fmt_equal(const SwsFormat *fmt1, const SwsFormat *fmt2)
Definition format.h:129
static av_always_inline AVRational64 ff_inv_q64(AVRational64 q)
Invert a 64-bit rational.
Definition rational64.h:131
AVRational64 ff_mul_q64(AVRational64 b, AVRational64 c)
Multiply two 64-bit rationals.
Definition rational64.c:208
static AVRational64 ff_make_q64(int64_t num, int64_t den)
Create an AVRational64.
Definition rational64.h:64
AVRational64 ff_add_q64(AVRational64 b, AVRational64 c)
Add two 64-bit rationals.
Definition rational64.c:222
int ff_cmp_q64(AVRational64 a, AVRational64 b)
Compare two 64-bit rationals.
Definition rational64.c:185
#define fail
Definition test.h:479
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition error.h:52
#define AVERROR(e)
Definition error.h:45
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
Definition frame.h:702
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
Definition frame.c:662
@ AV_FRAME_DATA_DYNAMIC_HDR_PLUS
HDR dynamic metadata associated with a video frame.
Definition frame.h:159
@ AV_FRAME_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata associated with a video frame.
Definition frame.h:120
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
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_csp_eotf_function av_csp_itu_eotf_inv(enum AVColorTransferCharacteristic trc)
Returns the mathematical inverse of the corresponding EOTF.
Definition csp.c:684
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
av_csp_eotf_function av_csp_itu_eotf(enum AVColorTransferCharacteristic trc)
Returns the ITU EOTF corresponding to a given TRC.
Definition csp.c:658
AVRational av_add_q(AVRational b, AVRational c)
Add two rationals.
Definition rational.c:93
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
Definition rational.c:80
static AVRational av_make_q(int num, int den)
Create an AVRational.
Definition rational.h:71
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition rational.h:89
AVRational av_sub_q(AVRational b, AVRational c)
Subtract one rational from another.
Definition rational.c:101
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
Definition rational.c:88
int sws_test_transfer(enum AVColorTransferCharacteristic trc, int output)
Test if a given color transfer function is supported.
Definition format.c:675
int sws_test_hw_format(enum AVPixelFormat format)
Test if a given hardware pixel format is supported by any backend, excluding unstable backends.
Definition format.c:640
int sws_test_colorspace(enum AVColorSpace csp, int output)
Test if a given color space is supported.
Definition format.c:651
int sws_test_primaries(enum AVColorPrimaries prim, int output)
Test if a given set of color primaries is supported.
Definition format.c:668
int sws_is_noop(const AVFrame *dst, const AVFrame *src)
Check if a given conversion is a noop.
Definition format.c:717
int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt)
Definition format.c:299
SwsDither
Definition swscale.h:77
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:704
SwsBackend
Definition swscale.h:110
int sws_test_format(enum AVPixelFormat format, int output)
Test if a given (software) pixel format is supported by any backend, excluding unstable backends.
Definition format.c:635
SwsScaler
Definition swscale.h:96
@ SWS_DITHER_NB
Definition swscale.h:84
@ SWS_DITHER_ED
Definition swscale.h:81
@ SWS_DITHER_A_DITHER
Definition swscale.h:82
@ SWS_DITHER_X_DITHER
Definition swscale.h:83
@ SWS_DITHER_AUTO
Definition swscale.h:79
@ SWS_DITHER_BAYER
Definition swscale.h:80
@ SWS_DITHER_NONE
Definition swscale.h:78
@ SWS_ALPHA_BLEND_NONE
Definition swscale.h:89
@ SWS_BACKEND_LEGACY
Legacy bespoke format-specific code.
Definition swscale.h:112
@ SWS_BACKEND_STABLE
Definition swscale.h:113
@ SWS_BACKEND_ALL
Definition swscale.h:127
@ SWS_SCALE_SPLINE
unwindowned natural cubic spline
Definition swscale.h:105
@ SWS_SCALE_POINT
nearest neighbor (point sampling)
Definition swscale.h:100
@ SWS_SCALE_LANCZOS
3-tap sinc/sinc
Definition swscale.h:104
@ SWS_SCALE_BILINEAR
bilinear filtering
Definition swscale.h:98
@ SWS_SCALE_GAUSSIAN
2-tap gaussian approximation
Definition swscale.h:102
@ SWS_SCALE_BICUBIC
2-tap cubic BC-spline
Definition swscale.h:99
@ SWS_SCALE_AREA
area averaging
Definition swscale.h:101
@ SWS_SCALE_SINC
unwindowed sinc
Definition swscale.h:103
@ SWS_SCALE_AUTO
Definition swscale.h:97
@ SWS_SPLINE
unwindowed natural cubic spline
Definition swscale.h:207
@ SWS_BICUBIC
2-tap cubic B-spline
Definition swscale.h:199
@ SWS_AREA
area averaging
Definition swscale.h:202
@ SWS_BICUBLIN
bicubic luma, bilinear chroma
Definition swscale.h:203
@ SWS_BILINEAR
bilinear filtering
Definition swscale.h:198
@ SWS_SINC
unwindowed sinc
Definition swscale.h:205
@ SWS_LANCZOS
3-tap sinc/sinc
Definition swscale.h:206
@ SWS_GAUSS
gaussian approximation
Definition swscale.h:204
@ SWS_ACCURATE_RND
Force bit-exact output.
Definition swscale.h:177
@ SWS_POINT
nearest neighbor
Definition swscale.h:201
int a
#define Q(q)
#define b
Definition input.c:43
enum MPFType type
Definition jpegmpfenc.c:55
enum AVPixelFormat pixfmt
Definition kmsgrab.c:367
static int shift(int a, int b)
Definition bonk.c:261
Macro definitions for various function/variable attributes.
#define av_fallthrough
Definition attributes.h:67
const char * desc
Definition libsvtav1.c:83
static int fmt_analyze(enum AVPixelFormat fmt, SwsReadWriteOp *rw_op, SwsPackOp *pack_op, SwsSwizzleOp *swizzle, SwsShiftOp *shift, SwsPixelType *pixel_type)
Definition format.c:967
#define PACKED_FMT(SWIZ, N,...)
Definition format.c:823
static SwsLinearOp linear_mat3(const SwsPixelType type, const AVRational m00, const AVRational m01, const AVRational m02, const AVRational m10, const AVRational m11, const AVRational m12, const AVRational m20, const AVRational m21, const AVRational m22)
Definition format.c:1482
static int encode_colors(SwsContext *ctx, SwsPixelType type, SwsOpList *ops, const SwsFormat *src, const SwsFormat *dst, bool *incomplete)
Definition format.c:1582
static int test_range(enum AVColorRange range)
Definition format.c:682
static const AVPixFmtDescriptor * fmt_desc_decoded(enum AVPixelFormat fmt)
Returns the underlying descriptor for fake formats like PAL8 whose descriptors alone do not fully des...
Definition format.c:748
#define Q64(x)
Definition format.c:1479
static int apply_lut3d(SwsContext *ctx, SwsPixelType type, SwsOpList *ops, const SwsLut3D *lut3d)
Definition format.c:1762
static SwsLinearOp fmt_encode_range(const SwsFormat *fmt, SwsPixelType type, bool *incomplete)
Definition format.c:1248
#define RET(x)
Definition format.c:34
static SwsLinearOp fmt_decode_range(const SwsFormat *fmt, SwsPixelType type, bool *incomplete)
Definition format.c:1313
#define ABGR
Definition format.c:832
int ff_sws_test_pixfmt_backend(const SwsBackend backends, enum AVPixelFormat format, int output)
Definition format.c:626
static bool trc_is_hdr(enum AVColorTransferCharacteristic trc)
Definition format.c:1372
static int add_filters(SwsContext *ctx, SwsPixelType type, SwsOpList *ops, const SwsFormat *src, const SwsFormat *dst)
Definition format.c:1746
static SwsClearOp fmt_clear(const SwsFormat *fmt)
This initializes all absent components explicitly to zero.
Definition format.c:1056
#define VUYA
Definition format.c:836
static FmtInfo fmt_info_irregular(enum AVPixelFormat fmt)
Definition format.c:838
static int fmt_analyze_regular(const AVPixFmtDescriptor *desc, SwsReadWriteOp *rw_op, SwsSwizzleOp *swizzle, SwsShiftOp *shift)
Definition format.c:932
static int decode_colors(SwsContext *ctx, SwsPixelType type, SwsOpList *ops, const SwsFormat *fmt, bool *incomplete)
Definition format.c:1496
static int decode_pixfmt(SwsOpList *ops, const SwsFormat *fmt)
Definition format.c:1095
static int test_format_ops(enum AVPixelFormat format, int output)
Definition format.c:1022
static AVRational64 * generate_bayer_matrix(const int size_log2)
Definition format.c:1331
bool ff_infer_colors(SwsColor *src, SwsColor *dst)
Definition format.c:540
void ff_sws_chroma_pos(const SwsFormat *fmt, bool *incomplete, int *out_x_pos, int *out_y_pos)
Wrapper around av_chroma_location_enum_to_pos() that accounts for the per-field offset introduced by ...
Definition format.c:578
#define SUBPACKED_FMT(SWIZ,...)
Definition format.c:817
static int is_regular_fmt(enum AVPixelFormat fmt)
Definition format.c:781
static int test_format_legacy(enum AVPixelFormat format, int output)
Definition format.c:621
#define ARGB
Definition format.c:831
static int test_loc(enum AVChromaLocation loc)
Definition format.c:687
#define UYVA
Definition format.c:835
#define VYUA
Definition format.c:834
static AVRational64 av_neg_q64(AVRational64 x)
Definition format.c:1238
static int fmt_dither(SwsContext *ctx, SwsOpList *ops, const SwsFormat *src, const SwsFormat *dst)
Definition format.c:1388
static int cmp_comp(const void *a, const void *b)
Definition format.c:924
#define NATIVE_ENDIAN_FLAG
Definition format.c:1085
#define AVYU
Definition format.c:833
int ff_sws_op_list_generate(SwsContext *ctx, const SwsFormat *src, const SwsFormat *dst, const SwsLut3D *lut3d, SwsOpList **out_ops, bool *incomplete)
Generate an SwsOpList defining a conversion from src to dst, with an optional 3DLUT for converting be...
Definition format.c:1824
#define BITSTREAM_FMT(SWIZ, FRAC, MODE,...)
Definition format.c:811
static int infer_loc_ref(SwsFormat *fmt, const SwsFormat *ref)
Definition format.c:557
static SwsScaler get_scaler_fallback(SwsContext *ctx)
Definition format.c:1682
static int fmt_convert(SwsContext *ctx, const SwsFormat *src, const SwsFormat *dst, const SwsLut3D *lut3d, SwsOpList *ops, bool *incomplete)
Definition format.c:1810
static AVRational64 intmax_q64(int bits)
Definition format.c:1088
void ff_fmt_from_pixfmt(enum AVPixelFormat pixfmt, SwsFormat *fmt)
Subset of ff_fmt_from_frame() that sets default metadata for the format.
Definition format.c:483
bool ff_infer_chroma_loc(SwsFormat *src, SwsFormat *dst)
Infers an unspecified chroma location of a subsampled format from the other format.
Definition format.c:568
static int add_filter(SwsContext *ctx, SwsPixelType type, SwsOpList *ops, SwsOpType filter, int src_size, int dst_size)
Definition format.c:1709
#define LINEAR_OP_DATA(TYPE,...)
Definition format.c:1243
int ff_test_fmt(const SwsBackend backends, const SwsFormat *fmt, int output)
Statically test if a given format is supported by the given set of backends.
Definition format.c:692
static int infer_prim_ref(SwsColor *csp, const SwsColor *ref)
Definition format.c:491
static void sanitize_fmt(SwsFormat *fmt, const AVPixFmtDescriptor *desc)
Definition format.c:305
static const LegacyFormatEntry legacy_format_entries[]
Definition format.c:48
static void swizzle_inv(SwsSwizzleOp *swiz)
Definition format.c:1037
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:345
void ff_sws_frame_from_avframe(SwsFrame *dst, const AVFrame *src)
Initialize a SwsFrame from an AVFrame.
Definition format.c:732
static int encode_pixfmt(SwsOpList *ops, const SwsFormat *fmt)
Definition format.c:1175
static SwsPixelType fmt_pixel_type(const AVPixFmtDescriptor *desc)
Definition format.c:759
static int infer_trc_ref(SwsColor *csp, const SwsColor *ref)
Definition format.c:515
#define BGRA
Definition format.c:830
@ INPUT_LUT_SIZE
Definition lut3d.h:36
#define FFALIGN(x, a)
Definition macros.h:78
enum AVColorPrimaries primaries
enum AVColorRange range
void ff_sws_op_list_free(SwsOpList **p_ops)
Definition ops.c:743
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:826
SwsOpList * ff_sws_op_list_alloc(void)
Definition ops.c:730
SwsOpType
Copyright (C) 2025 Niklas Haas.
Definition ops.h:36
@ SWS_OP_RSHIFT
Definition ops.h:49
@ SWS_OP_SWIZZLE
Definition ops.h:43
@ SWS_OP_LSHIFT
Definition ops.h:48
@ SWS_OP_FILTER_V
Definition ops.h:64
@ SWS_OP_FILTER_H
Definition ops.h:63
@ SWS_OP_WRITE
Definition ops.h:41
@ SWS_OP_READ
Definition ops.h:40
@ SWS_OP_CLEAR
Definition ops.h:52
@ SWS_OP_SWAP_BYTES
Definition ops.h:42
@ SWS_OP_MIN
Definition ops.h:54
@ SWS_OP_UNPACK
Definition ops.h:46
@ SWS_OP_LINEAR
Definition ops.h:57
@ SWS_OP_PACK
Definition ops.h:47
@ SWS_OP_DITHER
Definition ops.h:60
@ SWS_OP_MAX
Definition ops.h:55
@ SWS_OP_LUT_3D
Definition ops.h:67
@ SWS_OP_CONVERT
Definition ops.h:53
SwsReadWriteMode
Definition ops.h:77
@ SWS_RW_PALETTE
Definition ops.h:89
@ SWS_RW_PLANAR
Note: 1-component reads are either SWS_RW_PLANAR or SWS_RW_PACKED, depending on the underlying interp...
Definition ops.h:87
@ SWS_RW_PACKED
Definition ops.h:88
@ SWS_COMP_EXACT
Definition ops.h:230
@ SWS_COMP_SWAPPED
Definition ops.h:232
#define SWS_SWIZZLE(X, Y, Z, W)
Definition ops.h:141
#define sws_isSupportedOutput(x)
#define sws_isSupportedInput(x)
enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
Definition pixdesc.c:3503
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3524
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3484
int av_chroma_location_enum_to_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
Converts AVChromaLocation to swscale x/y chroma position.
Definition pixdesc.c:3926
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
Definition pixdesc.h:147
#define AV_PIX_FMT_FLAG_BITSTREAM
All values of a component are bit-wise packed end to end.
Definition pixdesc.h:124
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
Definition pixdesc.h:136
#define AV_PIX_FMT_FLAG_FLOAT
The pixel format contains IEEE-754 floating point values.
Definition pixdesc.h:158
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
Definition pixdesc.h:128
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
Definition pixdesc.h:132
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
Definition pixdesc.h:116
#define AV_PIX_FMT_FLAG_XYZ
The pixel format contains XYZ-like data (as opposed to YUV/RGB/grayscale).
Definition pixdesc.h:163
#define AV_PIX_FMT_FLAG_BAYER
The pixel format is following a Bayer pattern.
Definition pixdesc.h:152
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
Definition pixdesc.h:120
AVChromaLocation
Location of chroma samples.
Definition pixfmt.h:811
@ AVCHROMA_LOC_NB
Not part of ABI.
Definition pixfmt.h:819
@ AVCHROMA_LOC_CENTER
MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0.
Definition pixfmt.h:814
@ AVCHROMA_LOC_UNSPECIFIED
Definition pixfmt.h:812
AVColorRange
Visual content value range.
Definition pixfmt.h:757
@ AVCOL_RANGE_UNSPECIFIED
Definition pixfmt.h:758
@ AVCOL_RANGE_NB
Not part of ABI.
Definition pixfmt.h:793
@ AVCOL_RANGE_JPEG
Full range content.
Definition pixfmt.h:792
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_BAYER_GBRG8
bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples
Definition pixfmt.h:287
@ AV_PIX_FMT_YAF16BE
IEEE-754 half precision packed YA, 16 bits gray, 16 bits alpha, 32bpp, big-endian.
Definition pixfmt.h:485
@ AV_PIX_FMT_YUV444P16BE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition pixfmt.h:133
@ 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_GRAY16BE
Y , 16bpp, big-endian.
Definition pixfmt.h:104
@ 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_XYZ12LE
packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as lit...
Definition pixfmt.h:196
@ AV_PIX_FMT_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_YUV420P16BE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition pixfmt.h:129
@ 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_NONE
Definition pixfmt.h:72
@ 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_P010LE
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits,...
Definition pixfmt.h:307
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition pixfmt.h:379
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition pixfmt.h:75
@ AV_PIX_FMT_GRAY10LE
Y , 10bpp, little-endian.
Definition pixfmt.h:321
@ AV_PIX_FMT_GRAYF32LE
IEEE-754 single precision Y, 32bpp, little-endian.
Definition pixfmt.h:364
@ AV_PIX_FMT_P210LE
interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, little-endian
Definition pixfmt.h:390
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
Definition pixfmt.h:169
@ AV_PIX_FMT_YA16BE
16 bits gray, 16 bits alpha (big-endian)
Definition pixfmt.h:209
@ 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
@ 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_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_YUVA444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian
Definition pixfmt.h:368
@ AV_PIX_FMT_NV42
as above, but U and V bytes are swapped
Definition pixfmt.h:372
@ 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_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition pixfmt.h:106
@ 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_GBRPF16BE
IEEE-754 half precision planer GBR 4:4:4, 48bpp, big-endian.
Definition pixfmt.h:466
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
Definition pixfmt.h:97
@ AV_PIX_FMT_XV30LE
packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb), little-endian, variant of Y410 where alpha channe...
Definition pixfmt.h:415
@ AV_PIX_FMT_GBRPF32BE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian.
Definition pixfmt.h:341
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
Definition pixfmt.h:83
@ AV_PIX_FMT_BGR565BE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
Definition pixfmt.h:117
@ AV_PIX_FMT_RGBF32LE
IEEE-754 single precision packed RGB 32:32:32, 96bpp, RGBRGB..., little-endian.
Definition pixfmt.h:421
@ 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
@ 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_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition pixfmt.h:265
@ 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
@ 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_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
Definition pixfmt.h:168
@ 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
@ AV_PIX_FMT_GBRP10MSBBE
planar GBR 4:4:4 30bpp, lowest bits zero, big-endian
Definition pixfmt.h:495
@ 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_YUVA420P10BE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition pixfmt.h:181
@ 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
@ AV_PIX_FMT_P416LE
interleaved chroma YUV 4:4:4, 48bpp, little-endian
Definition pixfmt.h:399
@ 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_BAYER_GRBG16LE
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian
Definition pixfmt.h:295
@ AV_PIX_FMT_P016LE
like NV12, with 16bpp per component, little-endian
Definition pixfmt.h:323
@ 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_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_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition pixfmt.h:99
@ 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_YVYU422
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
Definition pixfmt.h:207
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
Definition pixfmt.h:279
@ 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
@ AV_PIX_FMT_GRAY12LE
Y , 12bpp, little-endian.
Definition pixfmt.h:319
@ 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_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
Definition pixfmt.h:310
@ 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
@ 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_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition pixfmt.h:102
@ AV_PIX_FMT_V30XBE
packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), big-endian
Definition pixfmt.h:448
@ AV_PIX_FMT_GRAY12BE
Y , 12bpp, big-endian.
Definition pixfmt.h:318
@ 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_GRAY8
Y , 8bpp.
Definition pixfmt.h:81
@ AV_PIX_FMT_GRAYF16BE
IEEE-754 half precision Y, 16bpp, big-endian.
Definition pixfmt.h:471
@ 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_YA16LE
16 bits gray, 16 bits alpha (little-endian)
Definition pixfmt.h:210
@ 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
@ AV_PIX_FMT_GRAY14LE
Y , 14bpp, little-endian.
Definition pixfmt.h:361
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition pixfmt.h:88
@ AV_PIX_FMT_Y210LE
packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, little-endian
Definition pixfmt.h:382
@ AV_PIX_FMT_P012LE
like NV12, with 12bpp per component, data in the high bits, zeros in the low bits,...
Definition pixfmt.h:408
@ 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
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition pixfmt.h:101
@ 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_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition pixfmt.h:108
@ AV_PIX_FMT_YUV422P10BE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition pixfmt.h:157
@ AV_PIX_FMT_P016BE
like NV12, with 16bpp per component, big-endian
Definition pixfmt.h:324
@ 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
@ 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_YUV420P10LE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition pixfmt.h:156
@ AV_PIX_FMT_GBRPF16LE
IEEE-754 half precision planer GBR 4:4:4, 48bpp, little-endian.
Definition pixfmt.h:467
@ 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_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition pixfmt.h:79
@ 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_RGB8
packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
Definition pixfmt.h:93
@ AV_PIX_FMT_NV24
planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition pixfmt.h:371
@ AV_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_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_GBRAP14BE
planar GBR 4:4:4:4 56bpp, big-endian
Definition pixfmt.h:432
@ 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_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
Definition pixfmt.h:264
@ 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_YUV422P16LE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition pixfmt.h:130
@ 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_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
Definition pixfmt.h:213
@ 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_BAYER_RGGB16LE
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian
Definition pixfmt.h:291
@ AV_PIX_FMT_GBRPF32LE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian.
Definition pixfmt.h:342
@ AV_PIX_FMT_YUVA444P9BE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition pixfmt.h:179
@ AV_PIX_FMT_YUV422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition pixfmt.h:272
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
Definition pixfmt.h:90
@ 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_YUV444P10BE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition pixfmt.h:161
@ AV_PIX_FMT_P410LE
interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, little-endian
Definition pixfmt.h:393
@ AV_PIX_FMT_YUV440P12LE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition pixfmt.h:300
@ AV_PIX_FMT_GBRP10MSBLE
planar GBR 4:4:4 30bpp, lowest bits zero, little-endian
Definition pixfmt.h:496
@ AV_PIX_FMT_RGB4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
Definition pixfmt.h:95
@ AV_PIX_FMT_BGR4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
Definition pixfmt.h:92
@ 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_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_YAF32LE
IEEE-754 single precision packed YA, 32 bits gray, 32 bits alpha, 64bpp, little-endian.
Definition pixfmt.h:483
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition pixfmt.h:100
@ 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_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_YUV444P9LE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition pixfmt.h:160
@ 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_RGBF16LE
IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., little-endian.
Definition pixfmt.h:452
@ AV_PIX_FMT_BAYER_GRBG8
bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples
Definition pixfmt.h:288
@ 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_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition pixfmt.h:212
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
Definition pixfmt.h:280
@ AV_PIX_FMT_GRAY9BE
Y , 9bpp, big-endian.
Definition pixfmt.h:338
@ 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_YUVA422P10BE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition pixfmt.h:183
@ AV_PIX_FMT_UYYVYY411
packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
Definition pixfmt.h:89
@ AV_PIX_FMT_P216LE
interleaved chroma YUV 4:2:2, 32bpp, little-endian
Definition pixfmt.h:396
@ 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_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
@ AV_PIX_FMT_P416BE
interleaved chroma YUV 4:4:4, 48bpp, big-endian
Definition pixfmt.h:398
@ AV_PIX_FMT_P212BE
interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, big-endian
Definition pixfmt.h:426
@ 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
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
Definition pixfmt.h:113
@ AV_PIX_FMT_BAYER_BGGR16BE
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian
Definition pixfmt.h:290
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
Definition pixfmt.h:171
@ 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_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
Definition pixfmt.h:311
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
Definition pixfmt.h:167
@ AV_PIX_FMT_YUVA420P16LE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition pixfmt.h:188
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
Definition pixfmt.h:115
@ 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_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_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_GBRAPF32BE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian.
Definition pixfmt.h:343
@ 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_GBRP12MSBLE
planar GBR 4:4:4 36bpp, lowest bits zero, little-endian
Definition pixfmt.h:498
@ 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
@ AV_PIX_FMT_Y216LE
packed YUV 4:2:2 like YUYV422, 32bpp, little-endian
Definition pixfmt.h:461
@ AV_PIX_FMT_BGR444LE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
Definition pixfmt.h:138
@ AV_PIX_FMT_YUVA420P16BE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition pixfmt.h:187
@ AV_PIX_FMT_YUV420P12LE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition pixfmt.h:268
@ AV_PIX_FMT_BAYER_RGGB16BE
bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian
Definition pixfmt.h:292
@ 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_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_YUV444P9BE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition pixfmt.h:159
@ AV_PIX_FMT_GBRAPF32LE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian.
Definition pixfmt.h:344
@ AV_PIX_FMT_P410BE
interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, big-endian
Definition pixfmt.h:392
@ AV_PIX_FMT_GBRAP14LE
planar GBR 4:4:4:4 56bpp, little-endian
Definition pixfmt.h:433
@ 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_YUV422P9LE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition pixfmt.h:164
@ AV_PIX_FMT_GRAYF32BE
IEEE-754 single precision Y, 32bpp, big-endian.
Definition pixfmt.h:363
@ 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_YUV422P9BE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition pixfmt.h:163
@ AV_PIX_FMT_BGR48LE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
Definition pixfmt.h:146
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
Definition pixfmt.h:282
@ AV_PIX_FMT_XV48LE
packed XVYU 4:4:4, 64bpp, little-endian, variant of Y416 where alpha channel is left undefined
Definition pixfmt.h:464
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
Definition pixfmt.h:263
@ AV_PIX_FMT_YUV422P10LE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition pixfmt.h:158
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
Definition pixfmt.h:105
@ 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_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
Definition pixfmt.h:170
@ AV_PIX_FMT_GBRAP10BE
planar GBR 4:4:4:4 40bpp, big-endian
Definition pixfmt.h:313
@ AV_PIX_FMT_GBRAPF16BE
IEEE-754 half precision planar GBRA 4:4:4:4, 64bpp, big-endian.
Definition pixfmt.h:468
@ 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
@ AV_PIX_FMT_GRAYF16LE
IEEE-754 half precision Y, 16bpp, little-endian.
Definition pixfmt.h:472
@ AV_PIX_FMT_BAYER_GRBG16BE
bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian
Definition pixfmt.h:296
@ AV_PIX_FMT_RGB565BE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
Definition pixfmt.h:112
@ AV_PIX_FMT_BGR555LE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
Definition pixfmt.h:120
@ AV_PIX_FMT_YUV420P12BE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition pixfmt.h:267
@ 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_YUV440P12BE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition pixfmt.h:301
@ AV_PIX_FMT_GBRAP10LE
planar GBR 4:4:4:4 40bpp, little-endian
Definition pixfmt.h:314
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition pixfmt.h:74
@ 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_BAYER_GBRG16LE
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian
Definition pixfmt.h:293
@ 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_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition pixfmt.h:84
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition pixfmt.h:76
@ AV_PIX_FMT_GRAY9LE
Y , 9bpp, little-endian.
Definition pixfmt.h:339
@ AV_PIX_FMT_VUYA
packed VUYA 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), VUYAVUYA...
Definition pixfmt.h:401
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition pixfmt.h:165
@ 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_YUV422P14LE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition pixfmt.h:274
@ AV_PIX_FMT_GBRAP16LE
planar GBRA 4:4:4:4 64bpp, little-endian
Definition pixfmt.h:214
@ AV_PIX_FMT_BAYER_BGGR16LE
bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian
Definition pixfmt.h:289
@ 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_GBRAPF16LE
IEEE-754 half precision planar GBRA 4:4:4:4, 64bpp, little-endian.
Definition pixfmt.h:469
@ AV_PIX_FMT_YUV420P9BE
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
Definition pixfmt.h:153
@ AV_PIX_FMT_GRAY10BE
Y , 10bpp, big-endian.
Definition pixfmt.h:320
@ 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_YUV440P10LE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition pixfmt.h:298
@ AV_PIX_FMT_RGBAF32BE
IEEE-754 single precision packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., big-endian.
Definition pixfmt.h:423
@ AV_PIX_FMT_YA8
8 bits gray, 8 bits alpha
Definition pixfmt.h:140
@ 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_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
Definition pixfmt.h:262
@ AV_PIX_FMT_GRAY14BE
Y , 14bpp, big-endian.
Definition pixfmt.h:360
@ 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_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
Definition pixfmt.h:281
@ AV_PIX_FMT_BGR565LE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
Definition pixfmt.h:118
@ 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_BAYER_GBRG16BE
bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian
Definition pixfmt.h:294
@ 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
@ 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
@ AV_PIX_FMT_P216BE
interleaved chroma YUV 4:2:2, 32bpp, big-endian
Definition pixfmt.h:395
@ 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_PIX_FMT_YUVA444P16BE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition pixfmt.h:191
@ 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_RGBF32BE
IEEE-754 single precision packed RGB 32:32:32, 96bpp, RGBRGB..., big-endian.
Definition pixfmt.h:420
@ 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_BAYER_RGGB8
bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples
Definition pixfmt.h:286
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
Definition pixfmt.h:172
@ AV_PIX_FMT_YUVA422P9BE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
Definition pixfmt.h:177
@ AV_PIX_FMT_VYU444
packed VYU 4:4:4, 24bpp (1 Cr & Cb sample per 1x1 Y), VYUVYU...
Definition pixfmt.h:446
@ 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
@ 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_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_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_YUV444P10LE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition pixfmt.h:162
@ 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_YUV422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition pixfmt.h:271
@ 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_PIX_FMT_P412BE
interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, big-endian
Definition pixfmt.h:429
@ AV_PIX_FMT_GBRP12MSBBE
planar GBR 4:4:4 36bpp, lowest bits zero, big-endian
Definition pixfmt.h:497
@ 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_BAYER_BGGR8
bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples
Definition pixfmt.h:285
@ AV_PIX_FMT_YUV420P16LE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition pixfmt.h:128
@ AV_PIX_FMT_RGBF16BE
IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., big-endian.
Definition pixfmt.h:451
@ AV_PIX_FMT_YUV444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition pixfmt.h:276
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition pixfmt.h:647
@ AVCOL_PRI_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
Definition pixfmt.h:654
@ AVCOL_PRI_NB
Not part of ABI.
Definition pixfmt.h:665
@ AVCOL_PRI_BT709
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B
Definition pixfmt.h:649
@ AVCOL_PRI_RESERVED
Definition pixfmt.h:651
@ AVCOL_PRI_EXT_NB
Not part of ABI.
Definition pixfmt.h:670
@ AVCOL_PRI_SMPTE240M
identical to above, also called "SMPTE C" even though it uses D65
Definition pixfmt.h:656
@ AVCOL_PRI_EXT_BASE
Definition pixfmt.h:668
@ AVCOL_PRI_UNSPECIFIED
Definition pixfmt.h:650
@ AVCOL_PRI_RESERVED0
Definition pixfmt.h:648
@ AVCOL_PRI_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
Definition pixfmt.h:655
@ AVCOL_PRI_BT470M
also FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition pixfmt.h:652
AVColorTransferCharacteristic
Color Transfer Characteristic.
Definition pixfmt.h:677
@ AVCOL_TRC_SMPTEST2084
Definition pixfmt.h:695
@ AVCOL_TRC_SMPTE2084
SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems.
Definition pixfmt.h:694
@ AVCOL_TRC_V_LOG
Definition pixfmt.h:703
@ AVCOL_TRC_LOG
"Logarithmic transfer characteristic (100:1 range)"
Definition pixfmt.h:687
@ AVCOL_TRC_ARIB_STD_B67
ARIB STD-B67, known as "Hybrid log-gamma".
Definition pixfmt.h:698
@ AVCOL_TRC_SMPTE428
SMPTE ST 428-1.
Definition pixfmt.h:696
@ AVCOL_TRC_LOG_SQRT
"Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
Definition pixfmt.h:688
@ AVCOL_TRC_EXT_NB
Not part of ABI.
Definition pixfmt.h:704
@ AVCOL_TRC_UNSPECIFIED
Definition pixfmt.h:680
@ AVCOL_TRC_BT709
also ITU-R BT1361
Definition pixfmt.h:679
@ AVCOL_TRC_NB
Not part of ABI.
Definition pixfmt.h:699
#define AV_PIX_FMT_RGB32
Definition pixfmt.h:520
AVColorSpace
YUV colorspace type.
Definition pixfmt.h:711
@ AVCOL_SPC_YCGCO_RE
YCgCo-R, even addition of bits.
Definition pixfmt.h:729
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
Definition pixfmt.h:713
@ 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:717
@ AVCOL_SPC_CHROMA_DERIVED_CL
Chromaticity-derived constant luminance system.
Definition pixfmt.h:726
@ AVCOL_SPC_BT2020_CL
ITU-R BT2020 constant luminance system.
Definition pixfmt.h:723
@ AVCOL_SPC_NB
Not part of ABI.
Definition pixfmt.h:731
@ AVCOL_SPC_RGB
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1
Definition pixfmt.h:712
@ AVCOL_SPC_BT2020_NCL
ITU-R BT2020 non-constant luminance system.
Definition pixfmt.h:722
@ AVCOL_SPC_SMPTE2085
SMPTE 2085, Y'D'zD'x.
Definition pixfmt.h:724
@ AVCOL_SPC_UNSPECIFIED
Definition pixfmt.h:714
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
Definition pixfmt.h:718
@ AVCOL_SPC_FCC
FCC Title 47 Code of Federal Regulations 73.682 (a)(20)
Definition pixfmt.h:716
@ AVCOL_SPC_CHROMA_DERIVED_NCL
Chromaticity-derived non-constant luminance system.
Definition pixfmt.h:725
@ AVCOL_SPC_SMPTE240M
derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries
Definition pixfmt.h:719
@ AVCOL_SPC_YCGCO_RO
YCgCo-R, odd addition of bits.
Definition pixfmt.h:730
@ AVCOL_SPC_YCGCO
used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
Definition pixfmt.h:720
@ AVCOL_SPC_ICTCP
ITU-R BT.2100-0, ICtCp.
Definition pixfmt.h:727
@ AVCOL_SPC_RESERVED
reserved for future use by ITU-T and ISO/IEC just like 15-255 are
Definition pixfmt.h:715
@ AVCOL_SPC_IPT_C2
SMPTE ST 2128, IPT-C2.
Definition pixfmt.h:728
const void * av_refstruct_ref_c(const void *obj)
Analog of av_refstruct_ref(), but for constant objects.
Definition refstruct.c:150
static void * av_refstruct_allocz(size_t size)
Equivalent to av_refstruct_alloc_ext(size, 0, NULL, NULL)
Definition refstruct.h:105
#define FF_ARRAY_ELEMS(a)
AVRational x
Definition csp.h:57
AVRational y
Definition csp.h:57
Struct that contains both white point location and primaries location, providing the complete descrip...
Definition csp.h:78
AVPrimaryCoefficients prim
Definition csp.h:80
This struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2...
AVHDRPlusColorTransformParams params[3]
The color transform parameters for every processing window.
uint8_t application_version
Application version in the application defining document in ST-2094 suite.
uint8_t num_windows
The number of processing windows.
Structure to hold side data for an AVFrame.
Definition frame.h:334
uint8_t * data
Definition frame.h:336
This structure describes decoded (raw) audio or video data.
Definition frame.h:479
Color transform parameters at a processing window in a dynamic metadata for SMPTE 2094-40.
AVRational average_maxrgb
The average of linearized maxRGB values in the processing window in the scene.
AVRational maxscl[3]
The maximum of the color components of linearized RGB values in the processing window in the scene.
AVHDRPlusPercentile distribution_maxrgb[15]
The linearized maxRGB values at given percentiles in the processing window in the scene.
uint8_t num_distribution_maxrgb_percentiles
The number of linearized maxRGB values at given percentiles in the processing window in the scene.
AVRational percentile
The linearized maxRGB value at a specific percentile in the processing window in the scene.
This struct describes a set or pool of "hardware" frames (i.e.
Definition hwcontext.h:118
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Definition hwcontext.h:213
Struct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar calculations.
Definition csp.h:48
AVRational cb
Definition csp.h:49
AVRational cr
Definition csp.h:49
AVRational cg
Definition csp.h:49
Mastering display metadata capable of representing the color volume of the display used to master the...
int has_primaries
Flag indicating whether the display primaries (and white point) are set.
AVRational max_luminance
Max luminance of mastering display (cd/m^2).
AVRational min_luminance
Min luminance of mastering display (cd/m^2).
AVRational display_primaries[3][2]
CIE 1931 xy chromaticity coords of color primaries (r, g, b order).
int has_luminance
Flag indicating whether the luminance (min_ and max_) have been set.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition pixdesc.h:69
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition pixdesc.h:80
uint64_t flags
Combination of AV_PIX_FMT_FLAG_... flags.
Definition pixdesc.h:94
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition pixdesc.h:89
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition pixdesc.h:71
64-bit Rational number (pair of numerator and denominator).
Definition rational64.h:52
int64_t num
Numerator.
Definition rational64.h:53
int64_t den
Denominator.
Definition rational64.h:54
Rational number (pair of numerator and denominator).
Definition rational.h:58
int num
Numerator.
Definition rational.h:59
SwsPackOp pack
Definition format.c:807
SwsReadWriteOp rw
Definition format.c:805
int shift
Definition format.c:808
SwsSwizzleOp swizzle
Definition format.c:806
uint8_t is_supported_in
Definition format.c:42
uint8_t is_supported_out
Definition format.c:43
uint8_t is_supported_endianness
Definition format.c:44
AVPrimaryCoefficients gamut
Definition format.h:67
AVRational min_luma
Definition format.h:68
enum AVColorPrimaries prim
Definition format.h:65
AVRational frame_peak
Definition format.h:70
AVRational max_luma
Definition format.h:69
AVRational frame_avg
Definition format.h:71
enum AVColorTransferCharacteristic trc
Definition format.h:66
Main external API structure.
Definition swscale.h:227
Represents a computed filter kernel.
Definition filters.h:91
SwsColor color
Definition format.h:91
enum AVPixelFormat format
Definition format.h:85
int interlaced
Definition format.h:83
int field
Definition format.h:84
enum AVPixelFormat hw_format
Definition format.h:86
const AVPixFmtDescriptor * desc
Definition format.h:90
enum AVColorSpace csp
Definition format.h:88
int width
Definition format.h:82
enum AVColorRange range
Definition format.h:87
int height
Definition format.h:82
enum AVChromaLocation loc
Definition format.h:89
Represents a view into a single field of frame data.
Definition format.h:206
bool dynamic
Definition lut3d.h:52
Helper struct for representing a list of operations.
Definition ops.h:318
SwsFormat dst
Definition ops.h:323
SwsOpPad inputs[4]
Source component metadata associated with pixel values from each corresponding component (in plane/me...
Definition ops.h:337
SwsFormat src
Definition ops.h:323
Definition ops.h:252
uint8_t pattern[4]
Packed bits are assumed to be LSB-aligned within the underlying integer type; i.e.
Definition ops.h:126
SwsReadWriteMode mode
Definition ops.h:103
SwsPixelType type
Examples: rgba = 4x u8 packed yuv444p = 3x u8 rgb565 = 1x u16 <- use SWS_OP_UNPACK to unpack monow = ...
Definition ops.h:102
uint8_t elems
Definition ops.h:104
uint8_t x
Definition ops.h:137
uint8_t z
Definition ops.h:137
uint8_t w
Definition ops.h:137
uint8_t in[4]
Definition ops.h:136
uint8_t y
Definition ops.h:137
Definition format.c:917
int index
Definition format.c:918
int plane
Definition format.c:919
int offset
Definition format.c:920
Definition swscale.c:85
int integer
#define SWS_NUM_SCALER_PARAMS
Extra parameters for fine-tuning certain scalers.
Definition swscale.h:243
static void * ff_refstruct_calloc(size_t n, size_t size)
static uint8_t tmp[40]
Definition aes_ctr.c:52
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
Definition h263dsp.c:29
#define src
Definition vp8dsp.c:248
static int ref[MAX_W *MAX_W]
int size
static const uint8_t q1[256]
Definition twofish.c:100
static const uint8_t q0[256]
Definition twofish.c:81
@ SWS_COMP_NONE
Definition uops.h:131
SwsPixelType
Definition uops.h:40
@ SWS_PIXEL_F32
Definition uops.h:45
@ SWS_PIXEL_U32
Definition uops.h:44
@ SWS_PIXEL_U16
Definition uops.h:43
@ SWS_PIXEL_NONE
Definition uops.h:41
@ SWS_PIXEL_U8
Definition uops.h:42
#define SWS_COMP(X)
Definition uops.h:133
static av_const bool ff_sws_pixel_type_is_int(SwsPixelType type)
Definition uops.h:64
static av_const int ff_sws_pixel_type_size(SwsPixelType type)
Definition uops.h:51
static const Backend backends[]
static double cb(void *priv, double x, double y)
Definition vf_geq.c:247
static const uint16_t dither[8][8]
Definition vf_gradfun.c:46
static float mean(const float *input, int size)
Definition vf_nnedi.c:792
static int bias(int x, int c)
Definition vqcdec.c:115
static double c[64]