FFmpeg
input.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2001-2012 Michael Niedermayer <michaelni@gmx.at>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include <math.h>
22 #include <stdint.h>
23 #include <stdio.h>
24 
25 #include "libavutil/bswap.h"
26 #include "libavutil/intreadwrite.h"
27 #include "libavutil/avassert.h"
28 #include "config.h"
29 #include "swscale_internal.h"
30 
31 #define input_pixel(pos) (is_be ? AV_RB16(pos) : AV_RL16(pos))
32 
33 #define IS_BE_LE 0
34 #define IS_BE_BE 1
35 #define IS_BE_ 0
36 /* ENDIAN_IDENTIFIER needs to be "BE", "LE" or "". The latter is intended
37  * for single-byte cases where the concept of endianness does not apply. */
38 #define IS_BE(ENDIAN_IDENTIFIER) IS_BE_ ## ENDIAN_IDENTIFIER
39 
40 #define r ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? b_r : r_b)
41 #define b ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? r_b : b_r)
42 
43 static av_always_inline void
44 rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
45  enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
46 {
47  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
48  int i;
49  for (i = 0; i < width; i++) {
50  unsigned int r_b = input_pixel(&src[i*4+0]);
51  unsigned int g = input_pixel(&src[i*4+1]);
52  unsigned int b_r = input_pixel(&src[i*4+2]);
53 
54  dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
55  }
56 }
57 
58 static av_always_inline void
59 rgb64ToUV_c_template(uint16_t *dstU, uint16_t *dstV,
60  const uint16_t *src1, const uint16_t *src2,
61  int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
62 {
63  int i;
64  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
65  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
67  for (i = 0; i < width; i++) {
68  unsigned int r_b = input_pixel(&src1[i*4+0]);
69  unsigned int g = input_pixel(&src1[i*4+1]);
70  unsigned int b_r = input_pixel(&src1[i*4+2]);
71 
72  dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
73  dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
74  }
75 }
76 
77 static av_always_inline void
78 rgb64ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV,
79  const uint16_t *src1, const uint16_t *src2,
80  int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
81 {
82  int i;
83  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
84  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
86  for (i = 0; i < width; i++) {
87  unsigned r_b = (input_pixel(&src1[8 * i + 0]) + input_pixel(&src1[8 * i + 4]) + 1) >> 1;
88  unsigned g = (input_pixel(&src1[8 * i + 1]) + input_pixel(&src1[8 * i + 5]) + 1) >> 1;
89  unsigned b_r = (input_pixel(&src1[8 * i + 2]) + input_pixel(&src1[8 * i + 6]) + 1) >> 1;
90 
91  dstU[i]= (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
92  dstV[i]= (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
93  }
94 }
95 
96 #define RGB64FUNCS_EXT(pattern, BE_LE, origin, is_be) \
97 static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, const uint8_t *unused1,\
98  int width, uint32_t *rgb2yuv, void *opq) \
99 { \
100  const uint16_t *src = (const uint16_t *) _src; \
101  uint16_t *dst = (uint16_t *) _dst; \
102  rgb64ToY_c_template(dst, src, width, origin, rgb2yuv, is_be); \
103 } \
104  \
105 static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
106  const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
107  int width, uint32_t *rgb2yuv, void *opq) \
108 { \
109  const uint16_t *src1 = (const uint16_t *) _src1, \
110  *src2 = (const uint16_t *) _src2; \
111  uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
112  rgb64ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
113 } \
114  \
115 static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, \
116  const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
117  int width, uint32_t *rgb2yuv, void *opq) \
118 { \
119  const uint16_t *src1 = (const uint16_t *) _src1, \
120  *src2 = (const uint16_t *) _src2; \
121  uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
122  rgb64ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
123 }
124 #define RGB64FUNCS(pattern, endianness, base_fmt) \
125  RGB64FUNCS_EXT(pattern, endianness, base_fmt ## endianness, IS_BE(endianness))
126 
131 
132 static av_always_inline void rgb48ToY_c_template(uint16_t *dst,
133  const uint16_t *src, int width,
134  enum AVPixelFormat origin,
135  int32_t *rgb2yuv, int is_be)
136 {
137  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
138  int i;
139  for (i = 0; i < width; i++) {
140  unsigned int r_b = input_pixel(&src[i * 3 + 0]);
141  unsigned int g = input_pixel(&src[i * 3 + 1]);
142  unsigned int b_r = input_pixel(&src[i * 3 + 2]);
143 
144  dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
145  }
146 }
147 
148 static av_always_inline void rgb48ToUV_c_template(uint16_t *dstU,
149  uint16_t *dstV,
150  const uint16_t *src1,
151  const uint16_t *src2,
152  int width,
153  enum AVPixelFormat origin,
154  int32_t *rgb2yuv, int is_be)
155 {
156  int i;
157  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
158  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
159  av_assert1(src1 == src2);
160  for (i = 0; i < width; i++) {
161  unsigned r_b = input_pixel(&src1[i * 3 + 0]);
162  unsigned g = input_pixel(&src1[i * 3 + 1]);
163  unsigned b_r = input_pixel(&src1[i * 3 + 2]);
164 
165  dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
166  dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
167  }
168 }
169 
170 static av_always_inline void rgb48ToUV_half_c_template(uint16_t *dstU,
171  uint16_t *dstV,
172  const uint16_t *src1,
173  const uint16_t *src2,
174  int width,
175  enum AVPixelFormat origin,
176  int32_t *rgb2yuv, int is_be)
177 {
178  int i;
179  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
180  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
181  av_assert1(src1 == src2);
182  for (i = 0; i < width; i++) {
183  unsigned r_b = (input_pixel(&src1[6 * i + 0]) +
184  input_pixel(&src1[6 * i + 3]) + 1) >> 1;
185  unsigned g = (input_pixel(&src1[6 * i + 1]) +
186  input_pixel(&src1[6 * i + 4]) + 1) >> 1;
187  unsigned b_r = (input_pixel(&src1[6 * i + 2]) +
188  input_pixel(&src1[6 * i + 5]) + 1) >> 1;
189 
190  dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
191  dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
192  }
193 }
194 
195 #undef r
196 #undef b
197 #undef input_pixel
198 
199 #define RGB48FUNCS_EXT(pattern, BE_LE, origin, is_be) \
200 static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst, \
201  const uint8_t *_src, \
202  const uint8_t *unused0, const uint8_t *unused1,\
203  int width, \
204  uint32_t *rgb2yuv, \
205  void *opq) \
206 { \
207  const uint16_t *src = (const uint16_t *)_src; \
208  uint16_t *dst = (uint16_t *)_dst; \
209  rgb48ToY_c_template(dst, src, width, origin, rgb2yuv, is_be); \
210 } \
211  \
212 static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU, \
213  uint8_t *_dstV, \
214  const uint8_t *unused0, \
215  const uint8_t *_src1, \
216  const uint8_t *_src2, \
217  int width, \
218  uint32_t *rgb2yuv, \
219  void *opq) \
220 { \
221  const uint16_t *src1 = (const uint16_t *)_src1, \
222  *src2 = (const uint16_t *)_src2; \
223  uint16_t *dstU = (uint16_t *)_dstU, \
224  *dstV = (uint16_t *)_dstV; \
225  rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
226 } \
227  \
228 static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, \
229  uint8_t *_dstV, \
230  const uint8_t *unused0, \
231  const uint8_t *_src1, \
232  const uint8_t *_src2, \
233  int width, \
234  uint32_t *rgb2yuv, \
235  void *opq) \
236 { \
237  const uint16_t *src1 = (const uint16_t *)_src1, \
238  *src2 = (const uint16_t *)_src2; \
239  uint16_t *dstU = (uint16_t *)_dstU, \
240  *dstV = (uint16_t *)_dstV; \
241  rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
242 }
243 #define RGB48FUNCS(pattern, endianness, base_fmt) \
244  RGB48FUNCS_EXT(pattern, endianness, base_fmt ## endianness, IS_BE(endianness))
245 
250 
251 #define input_pixel(i) ((origin == AV_PIX_FMT_RGBA || \
252  origin == AV_PIX_FMT_BGRA || \
253  origin == AV_PIX_FMT_ARGB || \
254  origin == AV_PIX_FMT_ABGR) \
255  ? AV_RN32A(&src[(i) * 4]) \
256  : ((origin == AV_PIX_FMT_X2RGB10LE || \
257  origin == AV_PIX_FMT_X2BGR10LE) \
258  ? AV_RL32(&src[(i) * 4]) \
259  : (is_be ? AV_RB16(&src[(i) * 2]) \
260  : AV_RL16(&src[(i) * 2]))))
261 
262 static av_always_inline void rgb16_32ToY_c_template(int16_t *dst,
263  const uint8_t *src,
264  int width,
265  enum AVPixelFormat origin,
266  int shr, int shg,
267  int shb, int shp,
268  int maskr, int maskg,
269  int maskb, int rsh,
270  int gsh, int bsh, int S,
271  int32_t *rgb2yuv, int is_be)
272 {
273  const int ry = rgb2yuv[RY_IDX]<<rsh, gy = rgb2yuv[GY_IDX]<<gsh, by = rgb2yuv[BY_IDX]<<bsh;
274  const unsigned rnd = (32<<((S)-1)) + (1<<(S-7));
275  int i;
276 
277  for (i = 0; i < width; i++) {
278  int px = input_pixel(i) >> shp;
279  int b = (px & maskb) >> shb;
280  int g = (px & maskg) >> shg;
281  int r = (px & maskr) >> shr;
282 
283  dst[i] = (ry * r + gy * g + by * b + rnd) >> ((S)-6);
284  }
285 }
286 
287 static av_always_inline void rgb16_32ToUV_c_template(int16_t *dstU,
288  int16_t *dstV,
289  const uint8_t *src,
290  int width,
291  enum AVPixelFormat origin,
292  int shr, int shg,
293  int shb, int shp,
294  int maskr, int maskg,
295  int maskb, int rsh,
296  int gsh, int bsh, int S,
297  int32_t *rgb2yuv, int is_be)
298 {
299  const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
300  rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh);
301  const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
302  int i;
303 
304  for (i = 0; i < width; i++) {
305  int px = input_pixel(i) >> shp;
306  int b = (px & maskb) >> shb;
307  int g = (px & maskg) >> shg;
308  int r = (px & maskr) >> shr;
309 
310  dstU[i] = (ru * r + gu * g + bu * b + rnd) >> ((S)-6);
311  dstV[i] = (rv * r + gv * g + bv * b + rnd) >> ((S)-6);
312  }
313 }
314 
316  int16_t *dstV,
317  const uint8_t *src,
318  int width,
319  enum AVPixelFormat origin,
320  int shr, int shg,
321  int shb, int shp,
322  int maskr, int maskg,
323  int maskb, int rsh,
324  int gsh, int bsh, int S,
325  int32_t *rgb2yuv, int is_be)
326 {
327  const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
328  rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh),
329  maskgx = ~(maskr | maskb);
330  const unsigned rnd = (256U<<(S)) + (1<<(S-6));
331  int i;
332 
333  maskr |= maskr << 1;
334  maskb |= maskb << 1;
335  maskg |= maskg << 1;
336  for (i = 0; i < width; i++) {
337  unsigned px0 = input_pixel(2 * i + 0) >> shp;
338  unsigned px1 = input_pixel(2 * i + 1) >> shp;
339  int b, r, g = (px0 & maskgx) + (px1 & maskgx);
340  int rb = px0 + px1 - g;
341 
342  b = (rb & maskb) >> shb;
343  if (shp ||
344  origin == AV_PIX_FMT_BGR565LE || origin == AV_PIX_FMT_BGR565BE ||
345  origin == AV_PIX_FMT_RGB565LE || origin == AV_PIX_FMT_RGB565BE) {
346  g >>= shg;
347  } else {
348  g = (g & maskg) >> shg;
349  }
350  r = (rb & maskr) >> shr;
351 
352  dstU[i] = (ru * r + gu * g + bu * b + (unsigned)rnd) >> ((S)-6+1);
353  dstV[i] = (rv * r + gv * g + bv * b + (unsigned)rnd) >> ((S)-6+1);
354  }
355 }
356 
357 #undef input_pixel
358 
359 #define RGB16_32FUNCS_EXT(fmt, name, shr, shg, shb, shp, maskr, \
360  maskg, maskb, rsh, gsh, bsh, S, is_be) \
361 static void name ## ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, \
362  int width, uint32_t *tab, void *opq) \
363 { \
364  rgb16_32ToY_c_template((int16_t*)dst, src, width, fmt, shr, shg, shb, shp, \
365  maskr, maskg, maskb, rsh, gsh, bsh, S, tab, is_be); \
366 } \
367  \
368 static void name ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \
369  const uint8_t *unused0, const uint8_t *src, const uint8_t *dummy, \
370  int width, uint32_t *tab, void *opq) \
371 { \
372  rgb16_32ToUV_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
373  shr, shg, shb, shp, \
374  maskr, maskg, maskb, rsh, gsh, bsh, S, tab, is_be); \
375 } \
376  \
377 static void name ## ToUV_half_c(uint8_t *dstU, uint8_t *dstV, \
378  const uint8_t *unused0, const uint8_t *src, \
379  const uint8_t *dummy, \
380  int width, uint32_t *tab, void *opq) \
381 { \
382  rgb16_32ToUV_half_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
383  shr, shg, shb, shp, \
384  maskr, maskg, maskb, \
385  rsh, gsh, bsh, S, tab, is_be); \
386 }
387 
388 #define RGB16_32FUNCS(base_fmt, endianness, name, shr, shg, shb, shp, maskr, \
389  maskg, maskb, rsh, gsh, bsh, S) \
390  RGB16_32FUNCS_EXT(base_fmt ## endianness, name, shr, shg, shb, shp, maskr, \
391  maskg, maskb, rsh, gsh, bsh, S, IS_BE(endianness))
392 
393 RGB16_32FUNCS(AV_PIX_FMT_BGR32, , bgr32, 16, 0, 0, 0, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
394 RGB16_32FUNCS(AV_PIX_FMT_BGR32_1, , bgr321, 16, 0, 0, 8, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
395 RGB16_32FUNCS(AV_PIX_FMT_RGB32, , rgb32, 0, 0, 16, 0, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
396 RGB16_32FUNCS(AV_PIX_FMT_RGB32_1, , rgb321, 0, 0, 16, 8, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
397 RGB16_32FUNCS(AV_PIX_FMT_BGR565, LE, bgr16le, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
398 RGB16_32FUNCS(AV_PIX_FMT_BGR555, LE, bgr15le, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
399 RGB16_32FUNCS(AV_PIX_FMT_BGR444, LE, bgr12le, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
400 RGB16_32FUNCS(AV_PIX_FMT_RGB565, LE, rgb16le, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
401 RGB16_32FUNCS(AV_PIX_FMT_RGB555, LE, rgb15le, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
402 RGB16_32FUNCS(AV_PIX_FMT_RGB444, LE, rgb12le, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
403 RGB16_32FUNCS(AV_PIX_FMT_BGR565, BE, bgr16be, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
404 RGB16_32FUNCS(AV_PIX_FMT_BGR555, BE, bgr15be, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
405 RGB16_32FUNCS(AV_PIX_FMT_BGR444, BE, bgr12be, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
406 RGB16_32FUNCS(AV_PIX_FMT_RGB565, BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
407 RGB16_32FUNCS(AV_PIX_FMT_RGB555, BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
408 RGB16_32FUNCS(AV_PIX_FMT_RGB444, BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
409 RGB16_32FUNCS(AV_PIX_FMT_X2RGB10, LE, rgb30le, 16, 6, 0, 0, 0x3FF00000, 0xFFC00, 0x3FF, 0, 0, 4, RGB2YUV_SHIFT + 6)
410 RGB16_32FUNCS(AV_PIX_FMT_X2BGR10, LE, bgr30le, 0, 6, 16, 0, 0x3FF, 0xFFC00, 0x3FF00000, 4, 0, 0, RGB2YUV_SHIFT + 6)
411 
412 static void gbr24pToUV_half_c(uint8_t *_dstU, uint8_t *_dstV,
413  const uint8_t *gsrc, const uint8_t *bsrc, const uint8_t *rsrc,
414  int width, uint32_t *rgb2yuv, void *opq)
415 {
416  uint16_t *dstU = (uint16_t *)_dstU;
417  uint16_t *dstV = (uint16_t *)_dstV;
418  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
419  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
420 
421  int i;
422  for (i = 0; i < width; i++) {
423  unsigned int g = gsrc[2*i] + gsrc[2*i+1];
424  unsigned int b = bsrc[2*i] + bsrc[2*i+1];
425  unsigned int r = rsrc[2*i] + rsrc[2*i+1];
426 
427  dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
428  dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
429  }
430 }
431 
432 static void rgba64leToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
433  const uint8_t *unused2, int width, uint32_t *unused, void *opq)
434 {
435  int16_t *dst = (int16_t *)_dst;
436  const uint16_t *src = (const uint16_t *)_src;
437  int i;
438  for (i = 0; i < width; i++)
439  dst[i] = AV_RL16(src + 4 * i + 3);
440 }
441 
442 static void rgba64beToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
443  const uint8_t *unused2, int width, uint32_t *unused, void *opq)
444 {
445  int16_t *dst = (int16_t *)_dst;
446  const uint16_t *src = (const uint16_t *)_src;
447  int i;
448  for (i = 0; i < width; i++)
449  dst[i] = AV_RB16(src + 4 * i + 3);
450 }
451 
452 static void abgrToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
453  const uint8_t *unused2, int width, uint32_t *unused, void *opq)
454 {
455  int16_t *dst = (int16_t *)_dst;
456  int i;
457  for (i=0; i<width; i++) {
458  dst[i]= src[4*i]<<6 | src[4*i]>>2;
459  }
460 }
461 
462 static void rgbaToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
463  const uint8_t *unused2, int width, uint32_t *unused, void *opq)
464 {
465  int16_t *dst = (int16_t *)_dst;
466  int i;
467  for (i=0; i<width; i++) {
468  dst[i]= src[4*i+3]<<6 | src[4*i+3]>>2;
469  }
470 }
471 
472 static void palToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
473  const uint8_t *unused2, int width, uint32_t *pal, void *opq)
474 {
475  int16_t *dst = (int16_t *)_dst;
476  int i;
477  for (i=0; i<width; i++) {
478  int d= src[i];
479 
480  dst[i]= (pal[d] >> 24)<<6 | pal[d]>>26;
481  }
482 }
483 
484 static void palToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
485  const uint8_t *unused2, int width, uint32_t *pal, void *opq)
486 {
487  int16_t *dst = (int16_t *)_dst;
488  int i;
489  for (i = 0; i < width; i++) {
490  int d = src[i];
491 
492  dst[i] = (pal[d] & 0xFF)<<6;
493  }
494 }
495 
496 static void palToUV_c(uint8_t *_dstU, uint8_t *_dstV,
497  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
498  int width, uint32_t *pal, void *opq)
499 {
500  uint16_t *dstU = (uint16_t *)_dstU;
501  int16_t *dstV = (int16_t *)_dstV;
502  int i;
503  av_assert1(src1 == src2);
504  for (i = 0; i < width; i++) {
505  int p = pal[src1[i]];
506 
507  dstU[i] = (uint8_t)(p>> 8)<<6;
508  dstV[i] = (uint8_t)(p>>16)<<6;
509  }
510 }
511 
512 static void monowhite2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
513  const uint8_t *unused2, int width, uint32_t *unused, void *opq)
514 {
515  int16_t *dst = (int16_t *)_dst;
516  int i, j;
517  width = (width + 7) >> 3;
518  for (i = 0; i < width; i++) {
519  int d = ~src[i];
520  for (j = 0; j < 8; j++)
521  dst[8*i+j]= ((d>>(7-j))&1) * 16383;
522  }
523  if(width&7){
524  int d= ~src[i];
525  for (j = 0; j < (width&7); j++)
526  dst[8*i+j]= ((d>>(7-j))&1) * 16383;
527  }
528 }
529 
530 static void monoblack2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
531  const uint8_t *unused2, int width, uint32_t *unused, void *opq)
532 {
533  int16_t *dst = (int16_t *)_dst;
534  int i, j;
535  width = (width + 7) >> 3;
536  for (i = 0; i < width; i++) {
537  int d = src[i];
538  for (j = 0; j < 8; j++)
539  dst[8*i+j]= ((d>>(7-j))&1) * 16383;
540  }
541  if(width&7){
542  int d = src[i];
543  for (j = 0; j < (width&7); j++)
544  dst[8*i+j] = ((d>>(7-j))&1) * 16383;
545  }
546 }
547 
548 static void yuy2ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
549  uint32_t *unused, void *opq)
550 {
551  int i;
552  for (i = 0; i < width; i++)
553  dst[i] = src[2 * i];
554 }
555 
556 static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
557  const uint8_t *src2, int width, uint32_t *unused, void *opq)
558 {
559  int i;
560  for (i = 0; i < width; i++) {
561  dstU[i] = src1[4 * i + 1];
562  dstV[i] = src1[4 * i + 3];
563  }
564  av_assert1(src1 == src2);
565 }
566 
567 static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
568  const uint8_t *src2, int width, uint32_t *unused, void *opq)
569 {
570  int i;
571  for (i = 0; i < width; i++) {
572  dstV[i] = src1[4 * i + 1];
573  dstU[i] = src1[4 * i + 3];
574  }
575  av_assert1(src1 == src2);
576 }
577 
578 #define y21xle_wrapper(bits, shift) \
579  static void y2 ## bits ## le_UV_c(uint8_t *dstU, uint8_t *dstV, \
580  const uint8_t *unused0, \
581  const uint8_t *src, \
582  const uint8_t *unused1, int width, \
583  uint32_t *unused2, void *opq) \
584  { \
585  int i; \
586  for (i = 0; i < width; i++) { \
587  AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> shift); \
588  AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> shift); \
589  } \
590  } \
591  \
592  static void y2 ## bits ## le_Y_c(uint8_t *dst, const uint8_t *src, \
593  const uint8_t *unused0, \
594  const uint8_t *unused1, int width, \
595  uint32_t *unused2, void *opq) \
596  { \
597  int i; \
598  for (i = 0; i < width; i++) \
599  AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> shift); \
600  }
601 
603 y21xle_wrapper(12, 4)
604 
605 static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width,
606  uint32_t *unused, void *opq)
607 {
608  int i;
609  const uint16_t *src = (const uint16_t *)_src;
610  uint16_t *dst = (uint16_t *)_dst;
611  for (i = 0; i < width; i++)
612  dst[i] = av_bswap16(src[i]);
613 }
614 
615 static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *_src1,
616  const uint8_t *_src2, int width, uint32_t *unused, void *opq)
617 {
618  int i;
619  const uint16_t *src1 = (const uint16_t *)_src1,
620  *src2 = (const uint16_t *)_src2;
621  uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
622  for (i = 0; i < width; i++) {
623  dstU[i] = av_bswap16(src1[i]);
624  dstV[i] = av_bswap16(src2[i]);
625  }
626 }
627 
628 static void read_ya16le_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
629  uint32_t *unused, void *opq)
630 {
631  int i;
632  for (i = 0; i < width; i++)
633  AV_WN16(dst + i * 2, AV_RL16(src + i * 4));
634 }
635 
636 static void read_ya16le_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
637  uint32_t *unused, void *opq)
638 {
639  int i;
640  for (i = 0; i < width; i++)
641  AV_WN16(dst + i * 2, AV_RL16(src + i * 4 + 2));
642 }
643 
644 static void read_ya16be_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
645  uint32_t *unused, void *opq)
646 {
647  int i;
648  for (i = 0; i < width; i++)
649  AV_WN16(dst + i * 2, AV_RB16(src + i * 4));
650 }
651 
652 static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
653  uint32_t *unused, void *opq)
654 {
655  int i;
656  for (i = 0; i < width; i++)
657  AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
658 }
659 
660 static void read_ayuv64le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
661  uint32_t *unused2, void *opq)
662 {
663  int i;
664  for (i = 0; i < width; i++)
665  AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2));
666 }
667 
668 
669 static void read_ayuv64le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
670  const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
671 {
672  int i;
673  for (i = 0; i < width; i++) {
674  AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 4));
675  AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6));
676  }
677 }
678 
679 static void read_ayuv64le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
680  uint32_t *unused2, void *opq)
681 {
682  int i;
683  for (i = 0; i < width; i++)
684  AV_WN16(dst + i * 2, AV_RL16(src + i * 8));
685 }
686 
687 static void read_vuyx_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
688  const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
689 {
690  int i;
691  for (i = 0; i < width; i++) {
692  dstU[i] = src[i * 4 + 1];
693  dstV[i] = src[i * 4];
694  }
695 }
696 
697 static void read_vuyx_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
698  uint32_t *unused2, void *opq)
699 {
700  int i;
701  for (i = 0; i < width; i++)
702  dst[i] = src[i * 4 + 2];
703 }
704 
705 static void read_vuya_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
706  uint32_t *unused2, void *opq)
707 {
708  int i;
709  for (i = 0; i < width; i++)
710  dst[i] = src[i * 4 + 3];
711 }
712 
713 static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
714  uint32_t *unused2, void *opq)
715 {
716  int i;
717  for (i = 0; i < width; i++)
718  AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 10) & 0x3FFu);
719 }
720 
721 
722 static void read_xv30le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
723  const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
724 {
725  int i;
726  for (i = 0; i < width; i++) {
727  AV_WN16(dstU + i * 2, AV_RL32(src + i * 4) & 0x3FFu);
728  AV_WN16(dstV + i * 2, (AV_RL32(src + i * 4) >> 20) & 0x3FFu);
729  }
730 }
731 
732 static void read_xv36le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
733  uint32_t *unused2, void *opq)
734 {
735  int i;
736  for (i = 0; i < width; i++)
737  AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2) >> 4);
738 }
739 
740 
741 static void read_xv36le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
742  const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
743 {
744  int i;
745  for (i = 0; i < width; i++) {
746  AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 0) >> 4);
747  AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 4) >> 4);
748  }
749 }
750 
751 /* This is almost identical to the previous, end exists only because
752  * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */
753 static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
754  uint32_t *unused, void *opq)
755 {
756  int i;
757  for (i = 0; i < width; i++)
758  dst[i] = src[2 * i + 1];
759 }
760 
761 static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
762  const uint8_t *src2, int width, uint32_t *unused, void *opq)
763 {
764  int i;
765  for (i = 0; i < width; i++) {
766  dstU[i] = src1[4 * i + 0];
767  dstV[i] = src1[4 * i + 2];
768  }
769  av_assert1(src1 == src2);
770 }
771 
772 static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,
773  const uint8_t *src, int width)
774 {
775  int i;
776  for (i = 0; i < width; i++) {
777  dst1[i] = src[2 * i + 0];
778  dst2[i] = src[2 * i + 1];
779  }
780 }
781 
782 static void nv12ToUV_c(uint8_t *dstU, uint8_t *dstV,
783  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
784  int width, uint32_t *unused, void *opq)
785 {
786  nvXXtoUV_c(dstU, dstV, src1, width);
787 }
788 
789 static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
790  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
791  int width, uint32_t *unused, void *opq)
792 {
793  nvXXtoUV_c(dstV, dstU, src1, width);
794 }
795 
796 #define p01x_uv_wrapper(bits, shift) \
797  static void p0 ## bits ## LEToUV_c(uint8_t *dstU, uint8_t *dstV, \
798  const uint8_t *unused0, \
799  const uint8_t *src1, \
800  const uint8_t *src2, int width, \
801  uint32_t *unused, void *opq) \
802  { \
803  int i; \
804  for (i = 0; i < width; i++) { \
805  AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0) >> shift); \
806  AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2) >> shift); \
807  } \
808  } \
809  \
810  static void p0 ## bits ## BEToUV_c(uint8_t *dstU, uint8_t *dstV, \
811  const uint8_t *unused0, \
812  const uint8_t *src1, \
813  const uint8_t *src2, int width, \
814  uint32_t *unused, void *opq) \
815  { \
816  int i; \
817  for (i = 0; i < width; i++) { \
818  AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0) >> shift); \
819  AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2) >> shift); \
820  } \
821  }
822 
823 #define p01x_wrapper(bits, shift) \
824  static void p0 ## bits ## LEToY_c(uint8_t *dst, const uint8_t *src, \
825  const uint8_t *unused1, \
826  const uint8_t *unused2, int width, \
827  uint32_t *unused, void *opq) \
828  { \
829  int i; \
830  for (i = 0; i < width; i++) { \
831  AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> shift); \
832  } \
833  } \
834  \
835  static void p0 ## bits ## BEToY_c(uint8_t *dst, const uint8_t *src, \
836  const uint8_t *unused1, \
837  const uint8_t *unused2, int width, \
838  uint32_t *unused, void *opq) \
839  { \
840  int i; \
841  for (i = 0; i < width; i++) { \
842  AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> shift); \
843  } \
844  } \
845  p01x_uv_wrapper(bits, shift)
846 
848 p01x_wrapper(12, 4)
849 p01x_uv_wrapper(16, 0)
850 
851 static void bgr24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,
852  int width, uint32_t *rgb2yuv, void *opq)
853 {
854  int16_t *dst = (int16_t *)_dst;
855  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
856  int i;
857  for (i = 0; i < width; i++) {
858  int b = src[i * 3 + 0];
859  int g = src[i * 3 + 1];
860  int r = src[i * 3 + 2];
861 
862  dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
863  }
864 }
865 
866 static void bgr24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
867  const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
868 {
869  int16_t *dstU = (int16_t *)_dstU;
870  int16_t *dstV = (int16_t *)_dstV;
871  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
872  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
873  int i;
874  for (i = 0; i < width; i++) {
875  int b = src1[3 * i + 0];
876  int g = src1[3 * i + 1];
877  int r = src1[3 * i + 2];
878 
879  dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
880  dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
881  }
882  av_assert1(src1 == src2);
883 }
884 
885 static void bgr24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
886  const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
887 {
888  int16_t *dstU = (int16_t *)_dstU;
889  int16_t *dstV = (int16_t *)_dstV;
890  int i;
891  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
892  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
893  for (i = 0; i < width; i++) {
894  int b = src1[6 * i + 0] + src1[6 * i + 3];
895  int g = src1[6 * i + 1] + src1[6 * i + 4];
896  int r = src1[6 * i + 2] + src1[6 * i + 5];
897 
898  dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
899  dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
900  }
901  av_assert1(src1 == src2);
902 }
903 
904 static void rgb24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
905  uint32_t *rgb2yuv, void *opq)
906 {
907  int16_t *dst = (int16_t *)_dst;
908  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
909  int i;
910  for (i = 0; i < width; i++) {
911  int r = src[i * 3 + 0];
912  int g = src[i * 3 + 1];
913  int b = src[i * 3 + 2];
914 
915  dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
916  }
917 }
918 
919 static void rgb24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
920  const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
921 {
922  int16_t *dstU = (int16_t *)_dstU;
923  int16_t *dstV = (int16_t *)_dstV;
924  int i;
925  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
926  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
927  av_assert1(src1 == src2);
928  for (i = 0; i < width; i++) {
929  int r = src1[3 * i + 0];
930  int g = src1[3 * i + 1];
931  int b = src1[3 * i + 2];
932 
933  dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
934  dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
935  }
936 }
937 
938 static void rgb24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
939  const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
940 {
941  int16_t *dstU = (int16_t *)_dstU;
942  int16_t *dstV = (int16_t *)_dstV;
943  int i;
944  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
945  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
946  av_assert1(src1 == src2);
947  for (i = 0; i < width; i++) {
948  int r = src1[6 * i + 0] + src1[6 * i + 3];
949  int g = src1[6 * i + 1] + src1[6 * i + 4];
950  int b = src1[6 * i + 2] + src1[6 * i + 5];
951 
952  dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
953  dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
954  }
955 }
956 
957 static void planar_rgb_to_y(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
958 {
959  uint16_t *dst = (uint16_t *)_dst;
960  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
961  int i;
962  for (i = 0; i < width; i++) {
963  int g = src[0][i];
964  int b = src[1][i];
965  int r = src[2][i];
966 
967  dst[i] = (ry*r + gy*g + by*b + (0x801<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
968  }
969 }
970 
971 static void planar_rgb_to_a(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *unused, void *opq)
972 {
973  uint16_t *dst = (uint16_t *)_dst;
974  int i;
975  for (i = 0; i < width; i++)
976  dst[i] = src[3][i] << 6;
977 }
978 
979 static void planar_rgb_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
980 {
981  uint16_t *dstU = (uint16_t *)_dstU;
982  uint16_t *dstV = (uint16_t *)_dstV;
983  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
984  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
985  int i;
986  for (i = 0; i < width; i++) {
987  int g = src[0][i];
988  int b = src[1][i];
989  int r = src[2][i];
990 
991  dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
992  dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
993  }
994 }
995 
996 #define rdpx(src) \
997  (is_be ? AV_RB16(src) : AV_RL16(src))
998 static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_src[4],
999  int width, int bpc, int is_be, int32_t *rgb2yuv)
1000 {
1001  int i;
1002  const uint16_t **src = (const uint16_t **)_src;
1003  uint16_t *dst = (uint16_t *)_dst;
1004  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1005  int shift = bpc < 16 ? bpc : 14;
1006  for (i = 0; i < width; i++) {
1007  int g = rdpx(src[0] + i);
1008  int b = rdpx(src[1] + i);
1009  int r = rdpx(src[2] + i);
1010 
1011  dst[i] = (ry*r + gy*g + by*b + (16 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
1012  }
1013 }
1014 
1015 static av_always_inline void planar_rgb16_to_a(uint8_t *_dst, const uint8_t *_src[4],
1016  int width, int bpc, int is_be, int32_t *rgb2yuv)
1017 {
1018  int i;
1019  const uint16_t **src = (const uint16_t **)_src;
1020  uint16_t *dst = (uint16_t *)_dst;
1021  int shift = bpc < 16 ? bpc : 14;
1022 
1023  for (i = 0; i < width; i++) {
1024  dst[i] = rdpx(src[3] + i) << (14 - shift);
1025  }
1026 }
1027 
1028 static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV,
1029  const uint8_t *_src[4], int width,
1030  int bpc, int is_be, int32_t *rgb2yuv)
1031 {
1032  int i;
1033  const uint16_t **src = (const uint16_t **)_src;
1034  uint16_t *dstU = (uint16_t *)_dstU;
1035  uint16_t *dstV = (uint16_t *)_dstV;
1036  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1037  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1038  int shift = bpc < 16 ? bpc : 14;
1039  for (i = 0; i < width; i++) {
1040  int g = rdpx(src[0] + i);
1041  int b = rdpx(src[1] + i);
1042  int r = rdpx(src[2] + i);
1043 
1044  dstU[i] = (ru*r + gu*g + bu*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
1045  dstV[i] = (rv*r + gv*g + bv*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
1046  }
1047 }
1048 #undef rdpx
1049 
1050 #define rdpx(src) (is_be ? av_int2float(AV_RB32(src)): av_int2float(AV_RL32(src)))
1051 
1052 static av_always_inline void planar_rgbf32_to_a(uint8_t *_dst, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
1053 {
1054  int i;
1055  const float **src = (const float **)_src;
1056  uint16_t *dst = (uint16_t *)_dst;
1057 
1058  for (i = 0; i < width; i++) {
1059  dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[3] + i), 0.0f, 65535.0f));
1060  }
1061 }
1062 
1063 static av_always_inline void planar_rgbf32_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
1064 {
1065  int i;
1066  const float **src = (const float **)_src;
1067  uint16_t *dstU = (uint16_t *)_dstU;
1068  uint16_t *dstV = (uint16_t *)_dstV;
1069  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1070  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1071 
1072  for (i = 0; i < width; i++) {
1073  int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
1074  int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
1075  int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1076 
1077  dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1078  dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1079  }
1080 }
1081 
1082 static av_always_inline void planar_rgbf32_to_y(uint8_t *_dst, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
1083 {
1084  int i;
1085  const float **src = (const float **)_src;
1086  uint16_t *dst = (uint16_t *)_dst;
1087 
1088  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1089 
1090  for (i = 0; i < width; i++) {
1091  int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
1092  int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
1093  int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1094 
1095  dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1096  }
1097 }
1098 
1099 static av_always_inline void grayf32ToY16_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1100  const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1101 {
1102  int i;
1103  const float *src = (const float *)_src;
1104  uint16_t *dst = (uint16_t *)_dst;
1105 
1106  for (i = 0; i < width; ++i){
1107  dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i), 0.0f, 65535.0f));
1108  }
1109 }
1110 
1111 #undef rdpx
1112 
1113 #define rgb9plus_planar_funcs_endian(nbits, endian_name, endian) \
1114 static void planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1115  int w, int32_t *rgb2yuv, void *opq) \
1116 { \
1117  planar_rgb16_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1118 } \
1119 static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1120  const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1121  void *opq) \
1122 { \
1123  planar_rgb16_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1124 } \
1125 
1126 #define rgb9plus_planar_transparency_funcs(nbits) \
1127 static void planar_rgb##nbits##le_to_a(uint8_t *dst, const uint8_t *src[4], \
1128  int w, int32_t *rgb2yuv, \
1129  void *opq) \
1130 { \
1131  planar_rgb16_to_a(dst, src, w, nbits, 0, rgb2yuv); \
1132 } \
1133 static void planar_rgb##nbits##be_to_a(uint8_t *dst, const uint8_t *src[4], \
1134  int w, int32_t *rgb2yuv, \
1135  void *opq) \
1136 { \
1137  planar_rgb16_to_a(dst, src, w, nbits, 1, rgb2yuv); \
1138 }
1139 
1140 #define rgb9plus_planar_funcs(nbits) \
1141  rgb9plus_planar_funcs_endian(nbits, le, 0) \
1142  rgb9plus_planar_funcs_endian(nbits, be, 1)
1143 
1149 
1154 
1155 #define rgbf32_planar_funcs_endian(endian_name, endian) \
1156 static void planar_rgbf32##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1157  int w, int32_t *rgb2yuv, void *opq) \
1158 { \
1159  planar_rgbf32_to_y(dst, src, w, endian, rgb2yuv); \
1160 } \
1161 static void planar_rgbf32##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1162  const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1163  void *opq) \
1164 { \
1165  planar_rgbf32_to_uv(dstU, dstV, src, w, endian, rgb2yuv); \
1166 } \
1167 static void planar_rgbf32##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1168  int w, int32_t *rgb2yuv, void *opq) \
1169 { \
1170  planar_rgbf32_to_a(dst, src, w, endian, rgb2yuv); \
1171 } \
1172 static void grayf32##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, \
1173  const uint8_t *unused1, const uint8_t *unused2, \
1174  int width, uint32_t *unused, void *opq) \
1175 { \
1176  grayf32ToY16_c(dst, src, unused1, unused2, width, endian, unused); \
1177 }
1178 
1181 
1182 #define rdpx(src) av_int2float(half2float(is_be ? AV_RB16(&src) : AV_RL16(&src), h2f_tbl))
1183 
1184 static av_always_inline void rgbaf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1185  const uint16_t *src, int width,
1186  int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1187 {
1188  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1189  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1190  int i;
1191  for (i = 0; i < width; i++) {
1192  int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+0]), 0.0f, 65535.0f)) +
1193  lrintf(av_clipf(65535.0f * rdpx(src[i*8+4]), 0.0f, 65535.0f))) >> 1;
1194  int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+1]), 0.0f, 65535.0f)) +
1195  lrintf(av_clipf(65535.0f * rdpx(src[i*8+5]), 0.0f, 65535.0f))) >> 1;
1196  int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+2]), 0.0f, 65535.0f)) +
1197  lrintf(av_clipf(65535.0f * rdpx(src[i*8+6]), 0.0f, 65535.0f))) >> 1;
1198 
1199  dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1200  dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1201  }
1202 }
1203 
1204 static av_always_inline void rgbaf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1205  const uint16_t *src, int width,
1206  int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1207 {
1208  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1209  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1210  int i;
1211  for (i = 0; i < width; i++) {
1212  int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1213  int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1214  int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1215 
1216  dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1217  dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1218  }
1219 }
1220 
1221 static av_always_inline void rgbaf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1222  int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1223 {
1224  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1225  int i;
1226  for (i = 0; i < width; i++) {
1227  int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1228  int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1229  int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1230 
1231  dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1232  }
1233 }
1234 
1235 static av_always_inline void rgbaf16ToA_endian(uint16_t *dst, const uint16_t *src, int is_be,
1236  int width, Half2FloatTables *h2f_tbl)
1237 {
1238  int i;
1239  for (i=0; i<width; i++) {
1240  dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[i*4+3]), 0.0f, 65535.0f));
1241  }
1242 }
1243 
1244 #undef rdpx
1245 
1246 #define rgbaf16_funcs_endian(endian_name, endian) \
1247 static void rgbaf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1248  const uint8_t *src1, const uint8_t *src2, \
1249  int width, uint32_t *_rgb2yuv, void *opq) \
1250 { \
1251  const uint16_t *src = (const uint16_t*)src1; \
1252  uint16_t *dstU = (uint16_t*)_dstU; \
1253  uint16_t *dstV = (uint16_t*)_dstV; \
1254  int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1255  av_assert1(src1==src2); \
1256  rgbaf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1257 } \
1258 static void rgbaf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1259  const uint8_t *src1, const uint8_t *src2, \
1260  int width, uint32_t *_rgb2yuv, void *opq) \
1261 { \
1262  const uint16_t *src = (const uint16_t*)src1; \
1263  uint16_t *dstU = (uint16_t*)_dstU; \
1264  uint16_t *dstV = (uint16_t*)_dstV; \
1265  int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1266  av_assert1(src1==src2); \
1267  rgbaf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1268 } \
1269 static void rgbaf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1270  const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1271 { \
1272  const uint16_t *src = (const uint16_t*)_src; \
1273  uint16_t *dst = (uint16_t*)_dst; \
1274  int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1275  rgbaf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1276 } \
1277 static void rgbaf16##endian_name##ToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1278  const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
1279 { \
1280  const uint16_t *src = (const uint16_t*)_src; \
1281  uint16_t *dst = (uint16_t*)_dst; \
1282  rgbaf16ToA_endian(dst, src, endian, width, opq); \
1283 }
1284 
1287 
1289 {
1290  enum AVPixelFormat srcFormat = c->srcFormat;
1291 
1292  c->chrToYV12 = NULL;
1293  switch (srcFormat) {
1294  case AV_PIX_FMT_YUYV422:
1295  c->chrToYV12 = yuy2ToUV_c;
1296  break;
1297  case AV_PIX_FMT_YVYU422:
1298  c->chrToYV12 = yvy2ToUV_c;
1299  break;
1300  case AV_PIX_FMT_UYVY422:
1301  c->chrToYV12 = uyvyToUV_c;
1302  break;
1303  case AV_PIX_FMT_NV12:
1304  case AV_PIX_FMT_NV16:
1305  case AV_PIX_FMT_NV24:
1306  c->chrToYV12 = nv12ToUV_c;
1307  break;
1308  case AV_PIX_FMT_NV21:
1309  case AV_PIX_FMT_NV42:
1310  c->chrToYV12 = nv21ToUV_c;
1311  break;
1312  case AV_PIX_FMT_RGB8:
1313  case AV_PIX_FMT_BGR8:
1314  case AV_PIX_FMT_PAL8:
1315  case AV_PIX_FMT_BGR4_BYTE:
1316  case AV_PIX_FMT_RGB4_BYTE:
1317  c->chrToYV12 = palToUV_c;
1318  break;
1319  case AV_PIX_FMT_GBRP9LE:
1320  c->readChrPlanar = planar_rgb9le_to_uv;
1321  break;
1322  case AV_PIX_FMT_GBRAP10LE:
1323  case AV_PIX_FMT_GBRP10LE:
1324  c->readChrPlanar = planar_rgb10le_to_uv;
1325  break;
1326  case AV_PIX_FMT_GBRAP12LE:
1327  case AV_PIX_FMT_GBRP12LE:
1328  c->readChrPlanar = planar_rgb12le_to_uv;
1329  break;
1330  case AV_PIX_FMT_GBRAP14LE:
1331  case AV_PIX_FMT_GBRP14LE:
1332  c->readChrPlanar = planar_rgb14le_to_uv;
1333  break;
1334  case AV_PIX_FMT_GBRAP16LE:
1335  case AV_PIX_FMT_GBRP16LE:
1336  c->readChrPlanar = planar_rgb16le_to_uv;
1337  break;
1338  case AV_PIX_FMT_GBRAPF32LE:
1339  case AV_PIX_FMT_GBRPF32LE:
1340  c->readChrPlanar = planar_rgbf32le_to_uv;
1341  break;
1342  case AV_PIX_FMT_GBRP9BE:
1343  c->readChrPlanar = planar_rgb9be_to_uv;
1344  break;
1345  case AV_PIX_FMT_GBRAP10BE:
1346  case AV_PIX_FMT_GBRP10BE:
1347  c->readChrPlanar = planar_rgb10be_to_uv;
1348  break;
1349  case AV_PIX_FMT_GBRAP12BE:
1350  case AV_PIX_FMT_GBRP12BE:
1351  c->readChrPlanar = planar_rgb12be_to_uv;
1352  break;
1353  case AV_PIX_FMT_GBRAP14BE:
1354  case AV_PIX_FMT_GBRP14BE:
1355  c->readChrPlanar = planar_rgb14be_to_uv;
1356  break;
1357  case AV_PIX_FMT_GBRAP16BE:
1358  case AV_PIX_FMT_GBRP16BE:
1359  c->readChrPlanar = planar_rgb16be_to_uv;
1360  break;
1361  case AV_PIX_FMT_GBRAPF32BE:
1362  case AV_PIX_FMT_GBRPF32BE:
1363  c->readChrPlanar = planar_rgbf32be_to_uv;
1364  break;
1365  case AV_PIX_FMT_GBRAP:
1366  case AV_PIX_FMT_GBRP:
1367  c->readChrPlanar = planar_rgb_to_uv;
1368  break;
1369 #if HAVE_BIGENDIAN
1370  case AV_PIX_FMT_YUV420P9LE:
1371  case AV_PIX_FMT_YUV422P9LE:
1372  case AV_PIX_FMT_YUV444P9LE:
1387 
1399  c->chrToYV12 = bswap16UV_c;
1400  break;
1401 #else
1402  case AV_PIX_FMT_YUV420P9BE:
1403  case AV_PIX_FMT_YUV422P9BE:
1404  case AV_PIX_FMT_YUV444P9BE:
1419 
1431  c->chrToYV12 = bswap16UV_c;
1432  break;
1433 #endif
1434  case AV_PIX_FMT_VUYA:
1435  case AV_PIX_FMT_VUYX:
1436  c->chrToYV12 = read_vuyx_UV_c;
1437  break;
1438  case AV_PIX_FMT_XV30LE:
1439  c->chrToYV12 = read_xv30le_UV_c;
1440  break;
1441  case AV_PIX_FMT_AYUV64LE:
1442  c->chrToYV12 = read_ayuv64le_UV_c;
1443  break;
1444  case AV_PIX_FMT_XV36LE:
1445  c->chrToYV12 = read_xv36le_UV_c;
1446  break;
1447  case AV_PIX_FMT_P010LE:
1448  case AV_PIX_FMT_P210LE:
1449  case AV_PIX_FMT_P410LE:
1450  c->chrToYV12 = p010LEToUV_c;
1451  break;
1452  case AV_PIX_FMT_P010BE:
1453  case AV_PIX_FMT_P210BE:
1454  case AV_PIX_FMT_P410BE:
1455  c->chrToYV12 = p010BEToUV_c;
1456  break;
1457  case AV_PIX_FMT_P012LE:
1458  case AV_PIX_FMT_P212LE:
1459  case AV_PIX_FMT_P412LE:
1460  c->chrToYV12 = p012LEToUV_c;
1461  break;
1462  case AV_PIX_FMT_P012BE:
1463  case AV_PIX_FMT_P212BE:
1464  case AV_PIX_FMT_P412BE:
1465  c->chrToYV12 = p012BEToUV_c;
1466  break;
1467  case AV_PIX_FMT_P016LE:
1468  case AV_PIX_FMT_P216LE:
1469  case AV_PIX_FMT_P416LE:
1470  c->chrToYV12 = p016LEToUV_c;
1471  break;
1472  case AV_PIX_FMT_P016BE:
1473  case AV_PIX_FMT_P216BE:
1474  case AV_PIX_FMT_P416BE:
1475  c->chrToYV12 = p016BEToUV_c;
1476  break;
1477  case AV_PIX_FMT_Y210LE:
1478  c->chrToYV12 = y210le_UV_c;
1479  break;
1480  case AV_PIX_FMT_Y212LE:
1481  c->chrToYV12 = y212le_UV_c;
1482  break;
1483  }
1484  if (c->chrSrcHSubSample) {
1485  switch (srcFormat) {
1486  case AV_PIX_FMT_RGBA64BE:
1487  c->chrToYV12 = rgb64BEToUV_half_c;
1488  break;
1489  case AV_PIX_FMT_RGBA64LE:
1490  c->chrToYV12 = rgb64LEToUV_half_c;
1491  break;
1492  case AV_PIX_FMT_BGRA64BE:
1493  c->chrToYV12 = bgr64BEToUV_half_c;
1494  break;
1495  case AV_PIX_FMT_BGRA64LE:
1496  c->chrToYV12 = bgr64LEToUV_half_c;
1497  break;
1498  case AV_PIX_FMT_RGB48BE:
1499  c->chrToYV12 = rgb48BEToUV_half_c;
1500  break;
1501  case AV_PIX_FMT_RGB48LE:
1502  c->chrToYV12 = rgb48LEToUV_half_c;
1503  break;
1504  case AV_PIX_FMT_BGR48BE:
1505  c->chrToYV12 = bgr48BEToUV_half_c;
1506  break;
1507  case AV_PIX_FMT_BGR48LE:
1508  c->chrToYV12 = bgr48LEToUV_half_c;
1509  break;
1510  case AV_PIX_FMT_RGB32:
1511  c->chrToYV12 = bgr32ToUV_half_c;
1512  break;
1513  case AV_PIX_FMT_RGB32_1:
1514  c->chrToYV12 = bgr321ToUV_half_c;
1515  break;
1516  case AV_PIX_FMT_BGR24:
1517  c->chrToYV12 = bgr24ToUV_half_c;
1518  break;
1519  case AV_PIX_FMT_BGR565LE:
1520  c->chrToYV12 = bgr16leToUV_half_c;
1521  break;
1522  case AV_PIX_FMT_BGR565BE:
1523  c->chrToYV12 = bgr16beToUV_half_c;
1524  break;
1525  case AV_PIX_FMT_BGR555LE:
1526  c->chrToYV12 = bgr15leToUV_half_c;
1527  break;
1528  case AV_PIX_FMT_BGR555BE:
1529  c->chrToYV12 = bgr15beToUV_half_c;
1530  break;
1531  case AV_PIX_FMT_GBRAP:
1532  case AV_PIX_FMT_GBRP:
1533  c->chrToYV12 = gbr24pToUV_half_c;
1534  break;
1535  case AV_PIX_FMT_BGR444LE:
1536  c->chrToYV12 = bgr12leToUV_half_c;
1537  break;
1538  case AV_PIX_FMT_BGR444BE:
1539  c->chrToYV12 = bgr12beToUV_half_c;
1540  break;
1541  case AV_PIX_FMT_BGR32:
1542  c->chrToYV12 = rgb32ToUV_half_c;
1543  break;
1544  case AV_PIX_FMT_BGR32_1:
1545  c->chrToYV12 = rgb321ToUV_half_c;
1546  break;
1547  case AV_PIX_FMT_RGB24:
1548  c->chrToYV12 = rgb24ToUV_half_c;
1549  break;
1550  case AV_PIX_FMT_RGB565LE:
1551  c->chrToYV12 = rgb16leToUV_half_c;
1552  break;
1553  case AV_PIX_FMT_RGB565BE:
1554  c->chrToYV12 = rgb16beToUV_half_c;
1555  break;
1556  case AV_PIX_FMT_RGB555LE:
1557  c->chrToYV12 = rgb15leToUV_half_c;
1558  break;
1559  case AV_PIX_FMT_RGB555BE:
1560  c->chrToYV12 = rgb15beToUV_half_c;
1561  break;
1562  case AV_PIX_FMT_RGB444LE:
1563  c->chrToYV12 = rgb12leToUV_half_c;
1564  break;
1565  case AV_PIX_FMT_RGB444BE:
1566  c->chrToYV12 = rgb12beToUV_half_c;
1567  break;
1568  case AV_PIX_FMT_X2RGB10LE:
1569  c->chrToYV12 = rgb30leToUV_half_c;
1570  break;
1571  case AV_PIX_FMT_X2BGR10LE:
1572  c->chrToYV12 = bgr30leToUV_half_c;
1573  break;
1574  case AV_PIX_FMT_RGBAF16BE:
1575  c->chrToYV12 = rgbaf16beToUV_half_c;
1576  break;
1577  case AV_PIX_FMT_RGBAF16LE:
1578  c->chrToYV12 = rgbaf16leToUV_half_c;
1579  break;
1580  }
1581  } else {
1582  switch (srcFormat) {
1583  case AV_PIX_FMT_RGBA64BE:
1584  c->chrToYV12 = rgb64BEToUV_c;
1585  break;
1586  case AV_PIX_FMT_RGBA64LE:
1587  c->chrToYV12 = rgb64LEToUV_c;
1588  break;
1589  case AV_PIX_FMT_BGRA64BE:
1590  c->chrToYV12 = bgr64BEToUV_c;
1591  break;
1592  case AV_PIX_FMT_BGRA64LE:
1593  c->chrToYV12 = bgr64LEToUV_c;
1594  break;
1595  case AV_PIX_FMT_RGB48BE:
1596  c->chrToYV12 = rgb48BEToUV_c;
1597  break;
1598  case AV_PIX_FMT_RGB48LE:
1599  c->chrToYV12 = rgb48LEToUV_c;
1600  break;
1601  case AV_PIX_FMT_BGR48BE:
1602  c->chrToYV12 = bgr48BEToUV_c;
1603  break;
1604  case AV_PIX_FMT_BGR48LE:
1605  c->chrToYV12 = bgr48LEToUV_c;
1606  break;
1607  case AV_PIX_FMT_RGB32:
1608  c->chrToYV12 = bgr32ToUV_c;
1609  break;
1610  case AV_PIX_FMT_RGB32_1:
1611  c->chrToYV12 = bgr321ToUV_c;
1612  break;
1613  case AV_PIX_FMT_BGR24:
1614  c->chrToYV12 = bgr24ToUV_c;
1615  break;
1616  case AV_PIX_FMT_BGR565LE:
1617  c->chrToYV12 = bgr16leToUV_c;
1618  break;
1619  case AV_PIX_FMT_BGR565BE:
1620  c->chrToYV12 = bgr16beToUV_c;
1621  break;
1622  case AV_PIX_FMT_BGR555LE:
1623  c->chrToYV12 = bgr15leToUV_c;
1624  break;
1625  case AV_PIX_FMT_BGR555BE:
1626  c->chrToYV12 = bgr15beToUV_c;
1627  break;
1628  case AV_PIX_FMT_BGR444LE:
1629  c->chrToYV12 = bgr12leToUV_c;
1630  break;
1631  case AV_PIX_FMT_BGR444BE:
1632  c->chrToYV12 = bgr12beToUV_c;
1633  break;
1634  case AV_PIX_FMT_BGR32:
1635  c->chrToYV12 = rgb32ToUV_c;
1636  break;
1637  case AV_PIX_FMT_BGR32_1:
1638  c->chrToYV12 = rgb321ToUV_c;
1639  break;
1640  case AV_PIX_FMT_RGB24:
1641  c->chrToYV12 = rgb24ToUV_c;
1642  break;
1643  case AV_PIX_FMT_RGB565LE:
1644  c->chrToYV12 = rgb16leToUV_c;
1645  break;
1646  case AV_PIX_FMT_RGB565BE:
1647  c->chrToYV12 = rgb16beToUV_c;
1648  break;
1649  case AV_PIX_FMT_RGB555LE:
1650  c->chrToYV12 = rgb15leToUV_c;
1651  break;
1652  case AV_PIX_FMT_RGB555BE:
1653  c->chrToYV12 = rgb15beToUV_c;
1654  break;
1655  case AV_PIX_FMT_RGB444LE:
1656  c->chrToYV12 = rgb12leToUV_c;
1657  break;
1658  case AV_PIX_FMT_RGB444BE:
1659  c->chrToYV12 = rgb12beToUV_c;
1660  break;
1661  case AV_PIX_FMT_X2RGB10LE:
1662  c->chrToYV12 = rgb30leToUV_c;
1663  break;
1664  case AV_PIX_FMT_X2BGR10LE:
1665  c->chrToYV12 = bgr30leToUV_c;
1666  break;
1667  case AV_PIX_FMT_RGBAF16BE:
1668  c->chrToYV12 = rgbaf16beToUV_c;
1669  break;
1670  case AV_PIX_FMT_RGBAF16LE:
1671  c->chrToYV12 = rgbaf16leToUV_c;
1672  break;
1673  }
1674  }
1675 
1676  c->lumToYV12 = NULL;
1677  c->alpToYV12 = NULL;
1678  switch (srcFormat) {
1679  case AV_PIX_FMT_GBRP9LE:
1680  c->readLumPlanar = planar_rgb9le_to_y;
1681  break;
1682  case AV_PIX_FMT_GBRAP10LE:
1683  c->readAlpPlanar = planar_rgb10le_to_a;
1684  case AV_PIX_FMT_GBRP10LE:
1685  c->readLumPlanar = planar_rgb10le_to_y;
1686  break;
1687  case AV_PIX_FMT_GBRAP12LE:
1688  c->readAlpPlanar = planar_rgb12le_to_a;
1689  case AV_PIX_FMT_GBRP12LE:
1690  c->readLumPlanar = planar_rgb12le_to_y;
1691  break;
1692  case AV_PIX_FMT_GBRAP14LE:
1693  c->readAlpPlanar = planar_rgb14le_to_a;
1694  case AV_PIX_FMT_GBRP14LE:
1695  c->readLumPlanar = planar_rgb14le_to_y;
1696  break;
1697  case AV_PIX_FMT_GBRAP16LE:
1698  c->readAlpPlanar = planar_rgb16le_to_a;
1699  case AV_PIX_FMT_GBRP16LE:
1700  c->readLumPlanar = planar_rgb16le_to_y;
1701  break;
1702  case AV_PIX_FMT_GBRAPF32LE:
1703  c->readAlpPlanar = planar_rgbf32le_to_a;
1704  case AV_PIX_FMT_GBRPF32LE:
1705  c->readLumPlanar = planar_rgbf32le_to_y;
1706  break;
1707  case AV_PIX_FMT_GBRP9BE:
1708  c->readLumPlanar = planar_rgb9be_to_y;
1709  break;
1710  case AV_PIX_FMT_GBRAP10BE:
1711  c->readAlpPlanar = planar_rgb10be_to_a;
1712  case AV_PIX_FMT_GBRP10BE:
1713  c->readLumPlanar = planar_rgb10be_to_y;
1714  break;
1715  case AV_PIX_FMT_GBRAP12BE:
1716  c->readAlpPlanar = planar_rgb12be_to_a;
1717  case AV_PIX_FMT_GBRP12BE:
1718  c->readLumPlanar = planar_rgb12be_to_y;
1719  break;
1720  case AV_PIX_FMT_GBRAP14BE:
1721  c->readAlpPlanar = planar_rgb14be_to_a;
1722  case AV_PIX_FMT_GBRP14BE:
1723  c->readLumPlanar = planar_rgb14be_to_y;
1724  break;
1725  case AV_PIX_FMT_GBRAP16BE:
1726  c->readAlpPlanar = planar_rgb16be_to_a;
1727  case AV_PIX_FMT_GBRP16BE:
1728  c->readLumPlanar = planar_rgb16be_to_y;
1729  break;
1730  case AV_PIX_FMT_GBRAPF32BE:
1731  c->readAlpPlanar = planar_rgbf32be_to_a;
1732  case AV_PIX_FMT_GBRPF32BE:
1733  c->readLumPlanar = planar_rgbf32be_to_y;
1734  break;
1735  case AV_PIX_FMT_GBRAP:
1736  c->readAlpPlanar = planar_rgb_to_a;
1737  case AV_PIX_FMT_GBRP:
1738  c->readLumPlanar = planar_rgb_to_y;
1739  break;
1740 #if HAVE_BIGENDIAN
1741  case AV_PIX_FMT_YUV420P9LE:
1742  case AV_PIX_FMT_YUV422P9LE:
1743  case AV_PIX_FMT_YUV444P9LE:
1758 
1759  case AV_PIX_FMT_GRAY9LE:
1760  case AV_PIX_FMT_GRAY10LE:
1761  case AV_PIX_FMT_GRAY12LE:
1762  case AV_PIX_FMT_GRAY14LE:
1763  case AV_PIX_FMT_GRAY16LE:
1764 
1765  case AV_PIX_FMT_P016LE:
1766  case AV_PIX_FMT_P216LE:
1767  case AV_PIX_FMT_P416LE:
1768  c->lumToYV12 = bswap16Y_c;
1769  break;
1781  c->lumToYV12 = bswap16Y_c;
1782  c->alpToYV12 = bswap16Y_c;
1783  break;
1784 #else
1785  case AV_PIX_FMT_YUV420P9BE:
1786  case AV_PIX_FMT_YUV422P9BE:
1787  case AV_PIX_FMT_YUV444P9BE:
1802 
1803  case AV_PIX_FMT_GRAY9BE:
1804  case AV_PIX_FMT_GRAY10BE:
1805  case AV_PIX_FMT_GRAY12BE:
1806  case AV_PIX_FMT_GRAY14BE:
1807  case AV_PIX_FMT_GRAY16BE:
1808 
1809  case AV_PIX_FMT_P016BE:
1810  case AV_PIX_FMT_P216BE:
1811  case AV_PIX_FMT_P416BE:
1812  c->lumToYV12 = bswap16Y_c;
1813  break;
1825  c->lumToYV12 = bswap16Y_c;
1826  c->alpToYV12 = bswap16Y_c;
1827  break;
1828 #endif
1829  case AV_PIX_FMT_YA16LE:
1830  c->lumToYV12 = read_ya16le_gray_c;
1831  break;
1832  case AV_PIX_FMT_YA16BE:
1833  c->lumToYV12 = read_ya16be_gray_c;
1834  break;
1835  case AV_PIX_FMT_VUYA:
1836  case AV_PIX_FMT_VUYX:
1837  c->lumToYV12 = read_vuyx_Y_c;
1838  break;
1839  case AV_PIX_FMT_XV30LE:
1840  c->lumToYV12 = read_xv30le_Y_c;
1841  break;
1842  case AV_PIX_FMT_AYUV64LE:
1843  c->lumToYV12 = read_ayuv64le_Y_c;
1844  break;
1845  case AV_PIX_FMT_XV36LE:
1846  c->lumToYV12 = read_xv36le_Y_c;
1847  break;
1848  case AV_PIX_FMT_YUYV422:
1849  case AV_PIX_FMT_YVYU422:
1850  case AV_PIX_FMT_YA8:
1851  c->lumToYV12 = yuy2ToY_c;
1852  break;
1853  case AV_PIX_FMT_UYVY422:
1854  c->lumToYV12 = uyvyToY_c;
1855  break;
1856  case AV_PIX_FMT_BGR24:
1857  c->lumToYV12 = bgr24ToY_c;
1858  break;
1859  case AV_PIX_FMT_BGR565LE:
1860  c->lumToYV12 = bgr16leToY_c;
1861  break;
1862  case AV_PIX_FMT_BGR565BE:
1863  c->lumToYV12 = bgr16beToY_c;
1864  break;
1865  case AV_PIX_FMT_BGR555LE:
1866  c->lumToYV12 = bgr15leToY_c;
1867  break;
1868  case AV_PIX_FMT_BGR555BE:
1869  c->lumToYV12 = bgr15beToY_c;
1870  break;
1871  case AV_PIX_FMT_BGR444LE:
1872  c->lumToYV12 = bgr12leToY_c;
1873  break;
1874  case AV_PIX_FMT_BGR444BE:
1875  c->lumToYV12 = bgr12beToY_c;
1876  break;
1877  case AV_PIX_FMT_RGB24:
1878  c->lumToYV12 = rgb24ToY_c;
1879  break;
1880  case AV_PIX_FMT_RGB565LE:
1881  c->lumToYV12 = rgb16leToY_c;
1882  break;
1883  case AV_PIX_FMT_RGB565BE:
1884  c->lumToYV12 = rgb16beToY_c;
1885  break;
1886  case AV_PIX_FMT_RGB555LE:
1887  c->lumToYV12 = rgb15leToY_c;
1888  break;
1889  case AV_PIX_FMT_RGB555BE:
1890  c->lumToYV12 = rgb15beToY_c;
1891  break;
1892  case AV_PIX_FMT_RGB444LE:
1893  c->lumToYV12 = rgb12leToY_c;
1894  break;
1895  case AV_PIX_FMT_RGB444BE:
1896  c->lumToYV12 = rgb12beToY_c;
1897  break;
1898  case AV_PIX_FMT_RGB8:
1899  case AV_PIX_FMT_BGR8:
1900  case AV_PIX_FMT_PAL8:
1901  case AV_PIX_FMT_BGR4_BYTE:
1902  case AV_PIX_FMT_RGB4_BYTE:
1903  c->lumToYV12 = palToY_c;
1904  break;
1905  case AV_PIX_FMT_MONOBLACK:
1906  c->lumToYV12 = monoblack2Y_c;
1907  break;
1908  case AV_PIX_FMT_MONOWHITE:
1909  c->lumToYV12 = monowhite2Y_c;
1910  break;
1911  case AV_PIX_FMT_RGB32:
1912  c->lumToYV12 = bgr32ToY_c;
1913  break;
1914  case AV_PIX_FMT_RGB32_1:
1915  c->lumToYV12 = bgr321ToY_c;
1916  break;
1917  case AV_PIX_FMT_BGR32:
1918  c->lumToYV12 = rgb32ToY_c;
1919  break;
1920  case AV_PIX_FMT_BGR32_1:
1921  c->lumToYV12 = rgb321ToY_c;
1922  break;
1923  case AV_PIX_FMT_RGB48BE:
1924  c->lumToYV12 = rgb48BEToY_c;
1925  break;
1926  case AV_PIX_FMT_RGB48LE:
1927  c->lumToYV12 = rgb48LEToY_c;
1928  break;
1929  case AV_PIX_FMT_BGR48BE:
1930  c->lumToYV12 = bgr48BEToY_c;
1931  break;
1932  case AV_PIX_FMT_BGR48LE:
1933  c->lumToYV12 = bgr48LEToY_c;
1934  break;
1935  case AV_PIX_FMT_RGBA64BE:
1936  c->lumToYV12 = rgb64BEToY_c;
1937  break;
1938  case AV_PIX_FMT_RGBA64LE:
1939  c->lumToYV12 = rgb64LEToY_c;
1940  break;
1941  case AV_PIX_FMT_BGRA64BE:
1942  c->lumToYV12 = bgr64BEToY_c;
1943  break;
1944  case AV_PIX_FMT_BGRA64LE:
1945  c->lumToYV12 = bgr64LEToY_c;
1946  break;
1947  case AV_PIX_FMT_P010LE:
1948  case AV_PIX_FMT_P210LE:
1949  case AV_PIX_FMT_P410LE:
1950  c->lumToYV12 = p010LEToY_c;
1951  break;
1952  case AV_PIX_FMT_P010BE:
1953  case AV_PIX_FMT_P210BE:
1954  case AV_PIX_FMT_P410BE:
1955  c->lumToYV12 = p010BEToY_c;
1956  break;
1957  case AV_PIX_FMT_P012LE:
1958  case AV_PIX_FMT_P212LE:
1959  case AV_PIX_FMT_P412LE:
1960  c->lumToYV12 = p012LEToY_c;
1961  break;
1962  case AV_PIX_FMT_P012BE:
1963  case AV_PIX_FMT_P212BE:
1964  case AV_PIX_FMT_P412BE:
1965  c->lumToYV12 = p012BEToY_c;
1966  break;
1967  case AV_PIX_FMT_GRAYF32LE:
1968  c->lumToYV12 = grayf32leToY16_c;
1969  break;
1970  case AV_PIX_FMT_GRAYF32BE:
1971  c->lumToYV12 = grayf32beToY16_c;
1972  break;
1973  case AV_PIX_FMT_Y210LE:
1974  c->lumToYV12 = y210le_Y_c;
1975  break;
1976  case AV_PIX_FMT_Y212LE:
1977  c->lumToYV12 = y212le_Y_c;
1978  break;
1979  case AV_PIX_FMT_X2RGB10LE:
1980  c->lumToYV12 = rgb30leToY_c;
1981  break;
1982  case AV_PIX_FMT_X2BGR10LE:
1983  c->lumToYV12 = bgr30leToY_c;
1984  break;
1985  case AV_PIX_FMT_RGBAF16BE:
1986  c->lumToYV12 = rgbaf16beToY_c;
1987  break;
1988  case AV_PIX_FMT_RGBAF16LE:
1989  c->lumToYV12 = rgbaf16leToY_c;
1990  break;
1991  }
1992  if (c->needAlpha) {
1993  if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
1994  if (HAVE_BIGENDIAN == !isBE(srcFormat) && !c->readAlpPlanar)
1995  c->alpToYV12 = bswap16Y_c;
1996  }
1997  switch (srcFormat) {
1998  case AV_PIX_FMT_BGRA64LE:
1999  case AV_PIX_FMT_RGBA64LE: c->alpToYV12 = rgba64leToA_c; break;
2000  case AV_PIX_FMT_BGRA64BE:
2001  case AV_PIX_FMT_RGBA64BE: c->alpToYV12 = rgba64beToA_c; break;
2002  case AV_PIX_FMT_BGRA:
2003  case AV_PIX_FMT_RGBA:
2004  c->alpToYV12 = rgbaToA_c;
2005  break;
2006  case AV_PIX_FMT_ABGR:
2007  case AV_PIX_FMT_ARGB:
2008  c->alpToYV12 = abgrToA_c;
2009  break;
2010  case AV_PIX_FMT_RGBAF16BE:
2011  c->alpToYV12 = rgbaf16beToA_c;
2012  break;
2013  case AV_PIX_FMT_RGBAF16LE:
2014  c->alpToYV12 = rgbaf16leToA_c;
2015  break;
2016  case AV_PIX_FMT_YA8:
2017  c->alpToYV12 = uyvyToY_c;
2018  break;
2019  case AV_PIX_FMT_YA16LE:
2020  c->alpToYV12 = read_ya16le_alpha_c;
2021  break;
2022  case AV_PIX_FMT_YA16BE:
2023  c->alpToYV12 = read_ya16be_alpha_c;
2024  break;
2025  case AV_PIX_FMT_VUYA:
2026  c->alpToYV12 = read_vuya_A_c;
2027  break;
2028  case AV_PIX_FMT_AYUV64LE:
2029  c->alpToYV12 = read_ayuv64le_A_c;
2030  break;
2031  case AV_PIX_FMT_PAL8 :
2032  c->alpToYV12 = palToA_c;
2033  break;
2034  }
2035  }
2036 }
be
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it be(in the first position) for now. Options ------- Then comes the options array. This is what will define the user accessible options. For example
read_xv30le_Y_c
static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
Definition: input.c:713
AV_PIX_FMT_YUV420P9LE
@ AV_PIX_FMT_YUV420P9LE
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:154
AV_PIX_FMT_XV30LE
@ AV_PIX_FMT_XV30LE
packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb), little-endian, variant of Y410 where alpha channe...
Definition: pixfmt.h:415
AV_PIX_FMT_GRAY10BE
@ AV_PIX_FMT_GRAY10BE
Y , 10bpp, big-endian.
Definition: pixfmt.h:320
read_ya16le_alpha_c
static void read_ya16le_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq)
Definition: input.c:636
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
AV_PIX_FMT_BGR48LE
@ AV_PIX_FMT_BGR48LE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as lit...
Definition: pixfmt.h:146
bgr24ToUV_c
static void bgr24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
Definition: input.c:866
Half2FloatTables
Definition: half2float.h:27
AV_PIX_FMT_P416BE
@ AV_PIX_FMT_P416BE
interleaved chroma YUV 4:4:4, 48bpp, big-endian
Definition: pixfmt.h:398
AV_PIX_FMT_YA8
@ AV_PIX_FMT_YA8
8 bits gray, 8 bits alpha
Definition: pixfmt.h:140
AV_PIX_FMT_BGRA64BE
@ AV_PIX_FMT_BGRA64BE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:204
RGB64FUNCS
#define RGB64FUNCS(pattern, endianness, base_fmt)
Definition: input.c:124
AV_PIX_FMT_BGR32
#define AV_PIX_FMT_BGR32
Definition: pixfmt.h:453
AV_PIX_FMT_RGB444LE
@ AV_PIX_FMT_RGB444LE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:136
u
#define u(width, name, range_min, range_max)
Definition: cbs_h2645.c:250
AV_PIX_FMT_GBRP16BE
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
Definition: pixfmt.h:171
rgb64ToUV_c_template
static av_always_inline void rgb64ToUV_c_template(uint16_t *dstU, uint16_t *dstV, const uint16_t *src1, const uint16_t *src2, int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
Definition: input.c:59
AV_PIX_FMT_GBRP10BE
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
Definition: pixfmt.h:169
planar_rgb16_to_uv
static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src[4], int width, int bpc, int is_be, int32_t *rgb2yuv)
Definition: input.c:1028
AV_PIX_FMT_YUV422P14LE
@ AV_PIX_FMT_YUV422P14LE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:274
src1
const pixel * src1
Definition: h264pred_template.c:421
read_ya16be_gray_c
static void read_ya16be_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq)
Definition: input.c:644
planar_rgb_to_y
static void planar_rgb_to_y(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
Definition: input.c:957
rgbaf16ToUV_endian
static av_always_inline void rgbaf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be, const uint16_t *src, int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
Definition: input.c:1204
AV_PIX_FMT_YUVA444P10BE
@ AV_PIX_FMT_YUVA444P10BE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:185
RV_IDX
#define RV_IDX
Definition: swscale_internal.h:446
AV_PIX_FMT_RGBA64BE
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:202
AV_PIX_FMT_YUV440P12BE
@ AV_PIX_FMT_YUV440P12BE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:301
AV_PIX_FMT_GBRAPF32LE
@ AV_PIX_FMT_GBRAPF32LE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian.
Definition: pixfmt.h:344
RU_IDX
#define RU_IDX
Definition: swscale_internal.h:443
AV_PIX_FMT_GBRPF32BE
@ AV_PIX_FMT_GBRPF32BE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian.
Definition: pixfmt.h:341
monoblack2Y_c
static void monoblack2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq)
Definition: input.c:530
AV_PIX_FMT_P412BE
@ AV_PIX_FMT_P412BE
interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, big-endian
Definition: pixfmt.h:429
ff_sws_init_input_funcs
void ff_sws_init_input_funcs(SwsContext *c)
b
#define b
Definition: input.c:41
GV_IDX
#define GV_IDX
Definition: swscale_internal.h:447
AV_PIX_FMT_MONOWHITE
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
Definition: pixfmt.h:82
AV_PIX_FMT_P010BE
@ AV_PIX_FMT_P010BE
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits,...
Definition: pixfmt.h:308
rgb2yuv
static const char rgb2yuv[]
Definition: vf_scale_vulkan.c:70
BV_IDX
#define BV_IDX
Definition: swscale_internal.h:448
AV_PIX_FMT_YUV420P14BE
@ AV_PIX_FMT_YUV420P14BE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:269
AV_PIX_FMT_YUV420P16LE
@ AV_PIX_FMT_YUV420P16LE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:128
AV_PIX_FMT_RGB32_1
#define AV_PIX_FMT_RGB32_1
Definition: pixfmt.h:452
AV_PIX_FMT_GBRP14BE
@ AV_PIX_FMT_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
Definition: pixfmt.h:281
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:76
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:102
rgbf32_planar_funcs_endian
#define rgbf32_planar_funcs_endian(endian_name, endian)
planar_rgbf32_to_uv
static av_always_inline void planar_rgbf32_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
Definition: input.c:1063
AV_PIX_FMT_YUVA444P9BE
@ AV_PIX_FMT_YUVA444P9BE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:179
AV_PIX_FMT_YUV422P9BE
@ AV_PIX_FMT_YUV422P9BE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:163
planar_rgbf32_to_y
static av_always_inline void planar_rgbf32_to_y(uint8_t *_dst, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
Definition: input.c:1082
AV_PIX_FMT_GRAY10LE
@ AV_PIX_FMT_GRAY10LE
Y , 10bpp, little-endian.
Definition: pixfmt.h:321
AV_PIX_FMT_GRAYF32LE
@ AV_PIX_FMT_GRAYF32LE
IEEE-754 single precision Y, 32bpp, little-endian.
Definition: pixfmt.h:364
AV_PIX_FMT_GBRAP14BE
@ AV_PIX_FMT_GBRAP14BE
planar GBR 4:4:4:4 56bpp, big-endian
Definition: pixfmt.h:432
read_xv30le_UV_c
static void read_xv30le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
Definition: input.c:722
rgba64beToA_c
static void rgba64beToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq)
Definition: input.c:442
AV_PIX_FMT_RGB555BE
@ AV_PIX_FMT_RGB555BE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
Definition: pixfmt.h:114
AV_PIX_FMT_RGBAF16LE
@ AV_PIX_FMT_RGBAF16LE
IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., little-endian.
Definition: pixfmt.h:404
AV_PIX_FMT_AYUV64LE
@ AV_PIX_FMT_AYUV64LE
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:302
AV_PIX_FMT_YUV444P16LE
@ AV_PIX_FMT_YUV444P16LE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:132
S
#define S(s, c, i)
Definition: flacdsp_template.c:46
AV_PIX_FMT_GBRAP12LE
@ AV_PIX_FMT_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
Definition: pixfmt.h:311
AV_PIX_FMT_GRAY16BE
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
Definition: pixfmt.h:104
is16BPS
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
Definition: swscale_internal.h:703
rgb
Definition: rpzaenc.c:60
input_pixel
#define input_pixel(pos)
Definition: input.c:251
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
AV_PIX_FMT_YUV420P12LE
@ AV_PIX_FMT_YUV420P12LE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:268
AV_PIX_FMT_GRAY9LE
@ AV_PIX_FMT_GRAY9LE
Y , 9bpp, little-endian.
Definition: pixfmt.h:339
isNBPS
static av_always_inline int isNBPS(enum AVPixelFormat pix_fmt)
Definition: swscale_internal.h:717
AV_PIX_FMT_YUVA444P16BE
@ AV_PIX_FMT_YUVA444P16BE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
Definition: pixfmt.h:191
r
#define r
Definition: input.c:40
AV_PIX_FMT_YUV444P10BE
@ AV_PIX_FMT_YUV444P10BE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:161
AV_PIX_FMT_YUV420P10LE
@ AV_PIX_FMT_YUV420P10LE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:156
AV_PIX_FMT_VUYA
@ AV_PIX_FMT_VUYA
packed VUYA 4:4:4, 32bpp, VUYAVUYA...
Definition: pixfmt.h:401
AV_PIX_FMT_YUV444P12LE
@ AV_PIX_FMT_YUV444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:276
AV_PIX_FMT_YUV422P12BE
@ AV_PIX_FMT_YUV422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:271
AV_PIX_FMT_YUV444P14LE
@ AV_PIX_FMT_YUV444P14LE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:278
AV_PIX_FMT_BGR8
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
Definition: pixfmt.h:90
avassert.h
rnd
#define rnd()
Definition: checkasm.h:163
rgb16_32ToY_c_template
static av_always_inline void rgb16_32ToY_c_template(int16_t *dst, const uint8_t *src, int width, enum AVPixelFormat origin, int shr, int shg, int shb, int shp, int maskr, int maskg, int maskb, int rsh, int gsh, int bsh, int S, int32_t *rgb2yuv, int is_be)
Definition: input.c:262
av_cold
#define av_cold
Definition: attributes.h:90
planar_rgbf32_to_a
static av_always_inline void planar_rgbf32_to_a(uint8_t *_dst, const uint8_t *_src[4], int width, int is_be, int32_t *rgb2yuv)
Definition: input.c:1052
AV_PIX_FMT_GBRAP16BE
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
Definition: pixfmt.h:213
width
#define width
intreadwrite.h
rgba64leToA_c
static void rgba64leToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq)
Definition: input.c:432
AV_PIX_FMT_GBRP16LE
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
Definition: pixfmt.h:172
bswap16UV_c
static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, int width, uint32_t *unused, void *opq)
Definition: input.c:615
AV_PIX_FMT_P416LE
@ AV_PIX_FMT_P416LE
interleaved chroma YUV 4:4:4, 48bpp, little-endian
Definition: pixfmt.h:399
AV_PIX_FMT_P210LE
@ AV_PIX_FMT_P210LE
interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, little-endian
Definition: pixfmt.h:390
g
const char * g
Definition: vf_curves.c:127
read_ayuv64le_Y_c
static void read_ayuv64le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
Definition: input.c:660
rgbaf16ToA_endian
static av_always_inline void rgbaf16ToA_endian(uint16_t *dst, const uint16_t *src, int is_be, int width, Half2FloatTables *h2f_tbl)
Definition: input.c:1235
AV_PIX_FMT_P016BE
@ AV_PIX_FMT_P016BE
like NV12, with 16bpp per component, big-endian
Definition: pixfmt.h:324
AV_PIX_FMT_GBRP12LE
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
Definition: pixfmt.h:280
AV_PIX_FMT_YUVA420P16BE
@ AV_PIX_FMT_YUVA420P16BE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:187
monowhite2Y_c
static void monowhite2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq)
Definition: input.c:512
AV_RL16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
Definition: bytestream.h:94
AV_PIX_FMT_GBRP10LE
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
Definition: pixfmt.h:170
p01x_uv_wrapper
#define p01x_uv_wrapper(bits, shift)
Definition: input.c:796
GY_IDX
#define GY_IDX
Definition: swscale_internal.h:441
AV_PIX_FMT_BGR32_1
#define AV_PIX_FMT_BGR32_1
Definition: pixfmt.h:454
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:100
p01x_wrapper
#define p01x_wrapper(bits, shift)
Definition: input.c:823
AV_PIX_FMT_YUV444P10LE
@ AV_PIX_FMT_YUV444P10LE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:162
rgb48ToY_c_template
static av_always_inline void rgb48ToY_c_template(uint16_t *dst, const uint16_t *src, int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
Definition: input.c:132
AV_PIX_FMT_YUVA422P10LE
@ AV_PIX_FMT_YUVA422P10LE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:184
abgrToA_c
static void abgrToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq)
Definition: input.c:452
grayf32ToY16_c
static av_always_inline void grayf32ToY16_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width, int is_be, uint32_t *unused)
Definition: input.c:1099
AV_PIX_FMT_YUV444P9BE
@ AV_PIX_FMT_YUV444P9BE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:159
AV_PIX_FMT_YUV422P10BE
@ AV_PIX_FMT_YUV422P10BE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:157
b_r
#define b_r
read_xv36le_Y_c
static void read_xv36le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
Definition: input.c:732
AV_PIX_FMT_YUV422P16LE
@ AV_PIX_FMT_YUV422P16LE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:130
AV_PIX_FMT_RGBA64
#define AV_PIX_FMT_RGBA64
Definition: pixfmt.h:468
AV_PIX_FMT_RGB565LE
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
Definition: pixfmt.h:113
AV_PIX_FMT_GBRAPF32BE
@ AV_PIX_FMT_GBRAPF32BE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian.
Definition: pixfmt.h:343
AV_PIX_FMT_GBRAP12BE
@ AV_PIX_FMT_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
Definition: pixfmt.h:310
AV_PIX_FMT_P012LE
@ AV_PIX_FMT_P012LE
like NV12, with 12bpp per component, data in the high bits, zeros in the low bits,...
Definition: pixfmt.h:408
AV_PIX_FMT_BGR48
#define AV_PIX_FMT_BGR48
Definition: pixfmt.h:469
NULL
#define NULL
Definition: coverity.c:32
read_ya16be_alpha_c
static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq)
Definition: input.c:652
rgb9plus_planar_transparency_funcs
#define rgb9plus_planar_transparency_funcs(nbits)
Definition: input.c:1126
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:74
AV_PIX_FMT_P210BE
@ AV_PIX_FMT_P210BE
interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, big-endian
Definition: pixfmt.h:389
AV_PIX_FMT_RGB48LE
@ AV_PIX_FMT_RGB48LE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
Definition: pixfmt.h:110
AV_PIX_FMT_YA16LE
@ AV_PIX_FMT_YA16LE
16 bits gray, 16 bits alpha (little-endian)
Definition: pixfmt.h:210
planar_rgb_to_a
static void planar_rgb_to_a(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *unused, void *opq)
Definition: input.c:971
AV_PIX_FMT_MONOBLACK
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
Definition: pixfmt.h:83
AV_PIX_FMT_YUVA422P12LE
@ AV_PIX_FMT_YUVA422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian
Definition: pixfmt.h:367
RGB48FUNCS
#define RGB48FUNCS(pattern, endianness, base_fmt)
Definition: input.c:243
nv12ToUV_c
static void nv12ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused, void *opq)
Definition: input.c:782
AV_PIX_FMT_BGR565LE
@ AV_PIX_FMT_BGR565LE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
Definition: pixfmt.h:118
AV_PIX_FMT_RGBA64LE
@ AV_PIX_FMT_RGBA64LE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:203
read_vuyx_UV_c
static void read_vuyx_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
Definition: input.c:687
AV_PIX_FMT_YUVA444P12BE
@ AV_PIX_FMT_YUVA444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian
Definition: pixfmt.h:368
planar_rgb16_to_y
static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_src[4], int width, int bpc, int is_be, int32_t *rgb2yuv)
Definition: input.c:998
AV_PIX_FMT_YUVA444P9LE
@ AV_PIX_FMT_YUVA444P9LE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:180
AV_PIX_FMT_Y210LE
@ AV_PIX_FMT_Y210LE
packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, little-endian
Definition: pixfmt.h:382
yuy2ToUV_c
static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused, void *opq)
Definition: input.c:556
AV_PIX_FMT_YUVA420P16LE
@ AV_PIX_FMT_YUVA420P16LE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:188
AV_PIX_FMT_RGB8
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
Definition: pixfmt.h:93
rgb16_32ToUV_c_template
static av_always_inline void rgb16_32ToUV_c_template(int16_t *dstU, int16_t *dstV, const uint8_t *src, int width, enum AVPixelFormat origin, int shr, int shg, int shb, int shp, int maskr, int maskg, int maskb, int rsh, int gsh, int bsh, int S, int32_t *rgb2yuv, int is_be)
Definition: input.c:287
palToA_c
static void palToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *pal, void *opq)
Definition: input.c:472
AV_PIX_FMT_YUV440P10LE
@ AV_PIX_FMT_YUV440P10LE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:298
av_clipf
av_clipf
Definition: af_crystalizer.c:121
palToUV_c
static void palToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *pal, void *opq)
Definition: input.c:496
AV_PIX_FMT_BGR555BE
@ AV_PIX_FMT_BGR555BE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
Definition: pixfmt.h:119
AV_PIX_FMT_YUVA420P9LE
@ AV_PIX_FMT_YUVA420P9LE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
Definition: pixfmt.h:176
read_ayuv64le_UV_c
static void read_ayuv64le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
Definition: input.c:669
AV_PIX_FMT_ABGR
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:101
rgb48ToUV_half_c_template
static av_always_inline void rgb48ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV, const uint16_t *src1, const uint16_t *src2, int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
Definition: input.c:170
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
AV_PIX_FMT_YUV420P14LE
@ AV_PIX_FMT_YUV420P14LE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
Definition: pixfmt.h:270
AV_PIX_FMT_YUV444P14BE
@ AV_PIX_FMT_YUV444P14BE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:277
AV_PIX_FMT_BGR4_BYTE
@ AV_PIX_FMT_BGR4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
Definition: pixfmt.h:92
AV_PIX_FMT_X2RGB10LE
@ AV_PIX_FMT_X2RGB10LE
packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:384
AV_PIX_FMT_P212LE
@ AV_PIX_FMT_P212LE
interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, little-endian
Definition: pixfmt.h:427
AV_PIX_FMT_YUV420P9BE
@ AV_PIX_FMT_YUV420P9BE
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
Definition: pixfmt.h:153
AV_PIX_FMT_X2BGR10
#define AV_PIX_FMT_X2BGR10
Definition: pixfmt.h:537
isBE
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
Definition: swscale_internal.h:724
f
f
Definition: af_crystalizer.c:121
planar_rgb16_to_a
static av_always_inline void planar_rgb16_to_a(uint8_t *_dst, const uint8_t *_src[4], int width, int bpc, int is_be, int32_t *rgb2yuv)
Definition: input.c:1015
read_ya16le_gray_c
static void read_ya16le_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq)
Definition: input.c:628
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:75
RY_IDX
#define RY_IDX
Definition: swscale_internal.h:440
AV_PIX_FMT_YUV440P12LE
@ AV_PIX_FMT_YUV440P12LE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
Definition: pixfmt.h:300
rgbaf16_funcs_endian
#define rgbaf16_funcs_endian(endian_name, endian)
Definition: input.c:1246
shift
static int shift(int a, int b)
Definition: bonk.c:262
AV_PIX_FMT_YUV420P12BE
@ AV_PIX_FMT_YUV420P12BE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:267
AV_PIX_FMT_YUV422P10LE
@ AV_PIX_FMT_YUV422P10LE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:158
AV_PIX_FMT_RGB444BE
@ AV_PIX_FMT_RGB444BE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
Definition: pixfmt.h:137
rgb9plus_planar_funcs
#define rgb9plus_planar_funcs(nbits)
Definition: input.c:1140
AV_PIX_FMT_YUV422P14BE
@ AV_PIX_FMT_YUV422P14BE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:273
AV_PIX_FMT_YA16BE
@ AV_PIX_FMT_YA16BE
16 bits gray, 16 bits alpha (big-endian)
Definition: pixfmt.h:209
AV_PIX_FMT_RGB48
#define AV_PIX_FMT_RGB48
Definition: pixfmt.h:464
AV_PIX_FMT_GRAY12LE
@ AV_PIX_FMT_GRAY12LE
Y , 12bpp, little-endian.
Definition: pixfmt.h:319
AV_PIX_FMT_BGR555
#define AV_PIX_FMT_BGR555
Definition: pixfmt.h:471
AV_PIX_FMT_GBRP9BE
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
Definition: pixfmt.h:167
AV_PIX_FMT_YUV420P10BE
@ AV_PIX_FMT_YUV420P10BE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:155
AV_PIX_FMT_RGBAF16BE
@ AV_PIX_FMT_RGBAF16BE
IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., big-endian.
Definition: pixfmt.h:403
rgb24ToUV_half_c
static void rgb24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
Definition: input.c:938
AV_PIX_FMT_NV16
@ AV_PIX_FMT_NV16
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:198
palToY_c
static void palToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *pal, void *opq)
Definition: input.c:484
AV_PIX_FMT_BGR444BE
@ AV_PIX_FMT_BGR444BE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
Definition: pixfmt.h:139
RGB2YUV_SHIFT
#define RGB2YUV_SHIFT
AV_PIX_FMT_GBRP9LE
@ AV_PIX_FMT_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
Definition: pixfmt.h:168
AV_PIX_FMT_RGB32
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:451
AV_PIX_FMT_GBRAP10LE
@ AV_PIX_FMT_GBRAP10LE
planar GBR 4:4:4:4 40bpp, little-endian
Definition: pixfmt.h:314
AV_PIX_FMT_BGR565BE
@ AV_PIX_FMT_BGR565BE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
Definition: pixfmt.h:117
AV_PIX_FMT_P012BE
@ AV_PIX_FMT_P012BE
like NV12, with 12bpp per component, data in the high bits, zeros in the low bits,...
Definition: pixfmt.h:409
AV_PIX_FMT_P410LE
@ AV_PIX_FMT_P410LE
interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, little-endian
Definition: pixfmt.h:393
rgb24ToUV_c
static void rgb24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
Definition: input.c:919
y21xle_wrapper
#define y21xle_wrapper(bits, shift)
Definition: input.c:578
nvXXtoUV_c
static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2, const uint8_t *src, int width)
Definition: input.c:772
AV_PIX_FMT_YUVA420P10LE
@ AV_PIX_FMT_YUVA420P10LE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
Definition: pixfmt.h:182
BY_IDX
#define BY_IDX
Definition: swscale_internal.h:442
AV_PIX_FMT_ARGB
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:99
AV_PIX_FMT_BGRA64LE
@ AV_PIX_FMT_BGRA64LE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:205
rgbaToA_c
static void rgbaToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq)
Definition: input.c:462
AV_PIX_FMT_YUVA422P10BE
@ AV_PIX_FMT_YUVA422P10BE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:183
AV_PIX_FMT_YUVA444P12LE
@ AV_PIX_FMT_YUVA444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian
Definition: pixfmt.h:369
AV_PIX_FMT_YUVA422P9BE
@ AV_PIX_FMT_YUVA422P9BE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
Definition: pixfmt.h:177
AV_PIX_FMT_BGRA64
#define AV_PIX_FMT_BGRA64
Definition: pixfmt.h:473
AV_PIX_FMT_RGB555LE
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:115
AV_PIX_FMT_RGB48BE
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
Definition: pixfmt.h:109
lrintf
#define lrintf(x)
Definition: libm_mips.h:72
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
nv21ToUV_c
static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused, void *opq)
Definition: input.c:789
src2
const pixel * src2
Definition: h264pred_template.c:422
AV_PIX_FMT_GRAY9BE
@ AV_PIX_FMT_GRAY9BE
Y , 9bpp, big-endian.
Definition: pixfmt.h:338
AV_PIX_FMT_NV24
@ AV_PIX_FMT_NV24
planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:371
AV_PIX_FMT_BGR444
#define AV_PIX_FMT_BGR444
Definition: pixfmt.h:472
read_xv36le_UV_c
static void read_xv36le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
Definition: input.c:741
av_assert1
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:56
AV_PIX_FMT_RGB555
#define AV_PIX_FMT_RGB555
Definition: pixfmt.h:466
av_always_inline
#define av_always_inline
Definition: attributes.h:49
swscale_internal.h
rgb64ToY_c_template
static av_always_inline void rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
Definition: input.c:44
AV_PIX_FMT_X2RGB10
#define AV_PIX_FMT_X2RGB10
Definition: pixfmt.h:536
gbr24pToUV_half_c
static void gbr24pToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *gsrc, const uint8_t *bsrc, const uint8_t *rsrc, int width, uint32_t *rgb2yuv, void *opq)
Definition: input.c:412
read_vuya_A_c
static void read_vuya_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
Definition: input.c:705
AV_PIX_FMT_NV21
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
Definition: pixfmt.h:97
AV_PIX_FMT_BGR565
#define AV_PIX_FMT_BGR565
Definition: pixfmt.h:470
AV_PIX_FMT_RGB4_BYTE
@ AV_PIX_FMT_RGB4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
Definition: pixfmt.h:95
AV_PIX_FMT_YUV444P16BE
@ AV_PIX_FMT_YUV444P16BE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:133
AV_PIX_FMT_GBRPF32LE
@ AV_PIX_FMT_GBRPF32LE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian.
Definition: pixfmt.h:342
AV_PIX_FMT_NV42
@ AV_PIX_FMT_NV42
as above, but U and V bytes are swapped
Definition: pixfmt.h:372
AV_PIX_FMT_RGB565
#define AV_PIX_FMT_RGB565
Definition: pixfmt.h:465
rdpx
#define rdpx(src)
Definition: input.c:1050
AV_PIX_FMT_GBRAP16LE
@ AV_PIX_FMT_GBRAP16LE
planar GBRA 4:4:4:4 64bpp, little-endian
Definition: pixfmt.h:214
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:84
AV_PIX_FMT_GRAY12BE
@ AV_PIX_FMT_GRAY12BE
Y , 12bpp, big-endian.
Definition: pixfmt.h:318
AV_PIX_FMT_YVYU422
@ AV_PIX_FMT_YVYU422
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
Definition: pixfmt.h:207
bswap.h
AV_PIX_FMT_NV12
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:96
AV_PIX_FMT_Y212LE
@ AV_PIX_FMT_Y212LE
packed YUV 4:2:2 like YUYV422, 24bpp, data in the high bits, zeros in the low bits,...
Definition: pixfmt.h:412
rgb64ToUV_half_c_template
static av_always_inline void rgb64ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV, const uint16_t *src1, const uint16_t *src2, int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
Definition: input.c:78
AV_PIX_FMT_P410BE
@ AV_PIX_FMT_P410BE
interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, big-endian
Definition: pixfmt.h:392
AV_PIX_FMT_P016LE
@ AV_PIX_FMT_P016LE
like NV12, with 16bpp per component, little-endian
Definition: pixfmt.h:323
AV_PIX_FMT_GRAYF32BE
@ AV_PIX_FMT_GRAYF32BE
IEEE-754 single precision Y, 32bpp, big-endian.
Definition: pixfmt.h:363
AV_PIX_FMT_GBRP12BE
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
Definition: pixfmt.h:279
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:88
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:92
U
#define U(x)
Definition: vpx_arith.h:37
AV_PIX_FMT_YUV444P12BE
@ AV_PIX_FMT_YUV444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
Definition: pixfmt.h:275
yuy2ToY_c
static void yuy2ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq)
Definition: input.c:548
AV_PIX_FMT_YUV444P9LE
@ AV_PIX_FMT_YUV444P9LE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:160
read_ayuv64le_A_c
static void read_ayuv64le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
Definition: input.c:679
AV_PIX_FMT_P216LE
@ AV_PIX_FMT_P216LE
interleaved chroma YUV 4:2:2, 32bpp, little-endian
Definition: pixfmt.h:396
uyvyToUV_c
static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused, void *opq)
Definition: input.c:761
AV_PIX_FMT_YUVA420P10BE
@ AV_PIX_FMT_YUVA420P10BE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
Definition: pixfmt.h:181
AV_PIX_FMT_RGB565BE
@ AV_PIX_FMT_RGB565BE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
Definition: pixfmt.h:112
AV_PIX_FMT_YUV420P16BE
@ AV_PIX_FMT_YUV420P16BE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Definition: pixfmt.h:129
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
rgb48ToUV_c_template
static av_always_inline void rgb48ToUV_c_template(uint16_t *dstU, uint16_t *dstV, const uint16_t *src1, const uint16_t *src2, int width, enum AVPixelFormat origin, int32_t *rgb2yuv, int is_be)
Definition: input.c:148
AV_PIX_FMT_YUV422P16BE
@ AV_PIX_FMT_YUV422P16BE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:131
AV_PIX_FMT_P212BE
@ AV_PIX_FMT_P212BE
interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, big-endian
Definition: pixfmt.h:426
AV_PIX_FMT_GRAY16LE
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
Definition: pixfmt.h:105
AV_PIX_FMT_X2BGR10LE
@ AV_PIX_FMT_X2BGR10LE
packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:386
AV_PIX_FMT_P010LE
@ AV_PIX_FMT_P010LE
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits,...
Definition: pixfmt.h:307
BU_IDX
#define BU_IDX
Definition: swscale_internal.h:445
AV_PIX_FMT_YUVA444P10LE
@ AV_PIX_FMT_YUVA444P10LE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:186
AV_PIX_FMT_BGR555LE
@ AV_PIX_FMT_BGR555LE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:120
AV_PIX_FMT_P216BE
@ AV_PIX_FMT_P216BE
interleaved chroma YUV 4:2:2, 32bpp, big-endian
Definition: pixfmt.h:395
AV_PIX_FMT_P412LE
@ AV_PIX_FMT_P412LE
interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, little-endian
Definition: pixfmt.h:430
AV_PIX_FMT_GRAY14LE
@ AV_PIX_FMT_GRAY14LE
Y , 14bpp, little-endian.
Definition: pixfmt.h:361
rgbaf16ToY_endian
static av_always_inline void rgbaf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be, int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
Definition: input.c:1221
uyvyToY_c
static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq)
Definition: input.c:753
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
AV_PIX_FMT_XV36LE
@ AV_PIX_FMT_XV36LE
packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, little-endian,...
Definition: pixfmt.h:418
AV_PIX_FMT_GRAY14BE
@ AV_PIX_FMT_GRAY14BE
Y , 14bpp, big-endian.
Definition: pixfmt.h:360
AV_PIX_FMT_YUVA422P16BE
@ AV_PIX_FMT_YUVA422P16BE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
Definition: pixfmt.h:189
AV_PIX_FMT_YUV440P10BE
@ AV_PIX_FMT_YUV440P10BE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
Definition: pixfmt.h:299
RGB16_32FUNCS
#define RGB16_32FUNCS(base_fmt, endianness, name, shr, shg, shb, shp, maskr, maskg, maskb, rsh, gsh, bsh, S)
Definition: input.c:388
AV_PIX_FMT_YUV422P9LE
@ AV_PIX_FMT_YUV422P9LE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:164
AV_PIX_FMT_YUVA422P16LE
@ AV_PIX_FMT_YUVA422P16LE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
Definition: pixfmt.h:190
rgb16_32ToUV_half_c_template
static av_always_inline void rgb16_32ToUV_half_c_template(int16_t *dstU, int16_t *dstV, const uint8_t *src, int width, enum AVPixelFormat origin, int shr, int shg, int shb, int shp, int maskr, int maskg, int maskb, int rsh, int gsh, int bsh, int S, int32_t *rgb2yuv, int is_be)
Definition: input.c:315
AV_PIX_FMT_GBRP14LE
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
Definition: pixfmt.h:282
d
d
Definition: ffmpeg_filter.c:409
int32_t
int32_t
Definition: audioconvert.c:56
planar_rgb_to_uv
static void planar_rgb_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
Definition: input.c:979
bgr24ToUV_half_c
static void bgr24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
Definition: input.c:885
AV_PIX_FMT_GBRAP10BE
@ AV_PIX_FMT_GBRAP10BE
planar GBR 4:4:4:4 40bpp, big-endian
Definition: pixfmt.h:313
r_b
#define r_b
yvy2ToUV_c
static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused, void *opq)
Definition: input.c:567
GU_IDX
#define GU_IDX
Definition: swscale_internal.h:444
AV_PIX_FMT_YUVA444P16LE
@ AV_PIX_FMT_YUVA444P16LE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
Definition: pixfmt.h:192
AV_PIX_FMT_VUYX
@ AV_PIX_FMT_VUYX
packed VUYX 4:4:4, 32bpp, Variant of VUYA where alpha channel is left undefined
Definition: pixfmt.h:406
av_bswap16
#define av_bswap16
Definition: bswap.h:27
AV_PIX_FMT_YUVA422P12BE
@ AV_PIX_FMT_YUVA422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian
Definition: pixfmt.h:366
SwsContext
Definition: swscale_internal.h:299
AV_PIX_FMT_BGR444LE
@ AV_PIX_FMT_BGR444LE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:138
AV_PIX_FMT_YUV422P12LE
@ AV_PIX_FMT_YUV422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
Definition: pixfmt.h:272
AV_PIX_FMT_YUVA420P9BE
@ AV_PIX_FMT_YUVA420P9BE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
Definition: pixfmt.h:175
read_vuyx_Y_c
static void read_vuyx_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
Definition: input.c:697
rgb24ToY_c
static void rgb24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *rgb2yuv, void *opq)
Definition: input.c:904
AV_PIX_FMT_GBRAP14LE
@ AV_PIX_FMT_GBRAP14LE
planar GBR 4:4:4:4 56bpp, little-endian
Definition: pixfmt.h:433
AV_RB16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
Definition: bytestream.h:98
AV_PIX_FMT_BGR48BE
@ AV_PIX_FMT_BGR48BE
packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big...
Definition: pixfmt.h:145
AV_PIX_FMT_YUVA422P9LE
@ AV_PIX_FMT_YUVA422P9LE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
Definition: pixfmt.h:178
AV_PIX_FMT_RGB444
#define AV_PIX_FMT_RGB444
Definition: pixfmt.h:467
AV_WN16
#define AV_WN16(p, v)
Definition: intreadwrite.h:370