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 
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 
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 y21xle_wrapper(16, 0)
605 
606 static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width,
607  uint32_t *unused, void *opq)
608 {
609  int i;
610  const uint16_t *src = (const uint16_t *)_src;
611  uint16_t *dst = (uint16_t *)_dst;
612  for (i = 0; i < width; i++)
613  dst[i] = av_bswap16(src[i]);
614 }
615 
616 static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *_src1,
617  const uint8_t *_src2, int width, uint32_t *unused, void *opq)
618 {
619  int i;
620  const uint16_t *src1 = (const uint16_t *)_src1,
621  *src2 = (const uint16_t *)_src2;
622  uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
623  for (i = 0; i < width; i++) {
624  dstU[i] = av_bswap16(src1[i]);
625  dstV[i] = av_bswap16(src2[i]);
626  }
627 }
628 
629 static void read_ya16le_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
630  uint32_t *unused, void *opq)
631 {
632  int i;
633  for (i = 0; i < width; i++)
634  AV_WN16(dst + i * 2, AV_RL16(src + i * 4));
635 }
636 
637 static void read_ya16le_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
638  uint32_t *unused, void *opq)
639 {
640  int i;
641  for (i = 0; i < width; i++)
642  AV_WN16(dst + i * 2, AV_RL16(src + i * 4 + 2));
643 }
644 
645 static void read_ya16be_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
646  uint32_t *unused, void *opq)
647 {
648  int i;
649  for (i = 0; i < width; i++)
650  AV_WN16(dst + i * 2, AV_RB16(src + i * 4));
651 }
652 
653 static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
654  uint32_t *unused, void *opq)
655 {
656  int i;
657  for (i = 0; i < width; i++)
658  AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
659 }
660 
661 static void read_ayuv64le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
662  uint32_t *unused2, void *opq)
663 {
664  int i;
665  for (i = 0; i < width; i++)
666  AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2));
667 }
668 
669 static void read_ayuv64be_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
670  uint32_t *unused2, void *opq)
671 {
672  int i;
673  for (i = 0; i < width; i++)
674  AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2));
675 }
676 
677 static av_always_inline void ayuv64le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width,
678  int u_offset, int v_offset)
679 {
680  int i;
681  for (i = 0; i < width; i++) {
682  AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + u_offset));
683  AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + v_offset));
684  }
685 }
686 
687 static av_always_inline void ayuv64be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width,
688  int u_offset, int v_offset)
689 {
690  int i;
691  for (i = 0; i < width; i++) {
692  AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + u_offset));
693  AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + v_offset));
694  }
695 }
696 
697 #define ayuv64_UV_funcs(pixfmt, U, V) \
698 static void read_ ## pixfmt ## le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, \
699  const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
700 { \
701  ayuv64le_UV_c(dstU, dstV, src, width, U, V); \
702 } \
703  \
704 static void read_ ## pixfmt ## be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, \
705  const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
706 { \
707  ayuv64be_UV_c(dstU, dstV, src, width, U, V); \
708 }
709 
710 ayuv64_UV_funcs(ayuv64, 4, 6)
711 ayuv64_UV_funcs(xv48, 0, 4)
712 
713 static void read_ayuv64le_A_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_RL16(src + i * 8));
719 }
720 
721 static void read_ayuv64be_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
722  uint32_t *unused2, void *opq)
723 {
724  int i;
725  for (i = 0; i < width; i++)
726  AV_WN16(dst + i * 2, AV_RB16(src + i * 8));
727 }
728 
729 static void read_vuyx_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
730  const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
731 {
732  int i;
733  for (i = 0; i < width; i++) {
734  dstU[i] = src[i * 4 + 1];
735  dstV[i] = src[i * 4];
736  }
737 }
738 
739 static void read_vuyx_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
740  uint32_t *unused2, void *opq)
741 {
742  int i;
743  for (i = 0; i < width; i++)
744  dst[i] = src[i * 4 + 2];
745 }
746 
747 static void read_vuya_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
748  uint32_t *unused2, void *opq)
749 {
750  int i;
751  for (i = 0; i < width; i++)
752  dst[i] = src[i * 4 + 3];
753 }
754 
755 static void read_ayuv_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
756  const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
757 {
758  int i;
759  for (i = 0; i < width; i++) {
760  dstU[i] = src[i * 4 + 2];
761  dstV[i] = src[i * 4 + 3];
762  }
763 }
764 
765 static void read_ayuv_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
766  uint32_t *unused2, void *opq)
767 {
768  int i;
769  for (i = 0; i < width; i++)
770  dst[i] = src[i * 4 + 1];
771 }
772 
773 static void read_ayuv_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
774  uint32_t *unused2, void *opq)
775 {
776  int i;
777  for (i = 0; i < width; i++)
778  dst[i] = src[i * 4];
779 }
780 
781 static void read_uyva_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
782  const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
783 {
784  int i;
785  for (i = 0; i < width; i++) {
786  dstU[i] = src[i * 4];
787  dstV[i] = src[i * 4 + 2];
788  }
789 }
790 
791 static void vyuToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
792  uint32_t *unused2, void *opq)
793 {
794  int i;
795  for (i = 0; i < width; i++)
796  dst[i] = src[i * 3 + 1];
797 }
798 
799 static void vyuToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
800  const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
801 {
802  int i;
803  for (i = 0; i < width; i++) {
804  dstU[i] = src[i * 3 + 2];
805  dstV[i] = src[i * 3];
806  }
807 }
808 
809 static void read_v30xle_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
810  uint32_t *unused2, void *opq)
811 {
812  int i;
813  for (i = 0; i < width; i++)
814  AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 12) & 0x3FFu);
815 }
816 
817 
818 static void read_v30xle_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
819  const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
820 {
821  int i;
822  for (i = 0; i < width; i++) {
823  unsigned int uv = AV_RL32(src + i * 4);
824  AV_WN16(dstU + i * 2, (uv >> 2) & 0x3FFu);
825  AV_WN16(dstV + i * 2, (uv >> 22) & 0x3FFu);
826  }
827 }
828 
829 static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
830  uint32_t *unused2, void *opq)
831 {
832  int i;
833  for (i = 0; i < width; i++)
834  AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 10) & 0x3FFu);
835 }
836 
837 
838 static void read_xv30le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
839  const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
840 {
841  int i;
842  for (i = 0; i < width; i++) {
843  AV_WN16(dstU + i * 2, AV_RL32(src + i * 4) & 0x3FFu);
844  AV_WN16(dstV + i * 2, (AV_RL32(src + i * 4) >> 20) & 0x3FFu);
845  }
846 }
847 
848 static void read_xv36le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
849  uint32_t *unused2, void *opq)
850 {
851  int i;
852  for (i = 0; i < width; i++)
853  AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2) >> 4);
854 }
855 
856 
857 static void read_xv36le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
858  const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
859 {
860  int i;
861  for (i = 0; i < width; i++) {
862  AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 0) >> 4);
863  AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 4) >> 4);
864  }
865 }
866 
867 static void read_xv36be_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
868  uint32_t *unused2, void *opq)
869 {
870  int i;
871  for (i = 0; i < width; i++)
872  AV_WN16(dst + i * 2, AV_RB16(src + i * 8 + 2) >> 4);
873 }
874 
875 
876 static void read_xv36be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
877  const uint8_t *unused1, int width, uint32_t *unused2, void *opq)
878 {
879  int i;
880  for (i = 0; i < width; i++) {
881  AV_WN16(dstU + i * 2, AV_RB16(src + i * 8 + 0) >> 4);
882  AV_WN16(dstV + i * 2, AV_RB16(src + i * 8 + 4) >> 4);
883  }
884 }
885 
886 /* This is almost identical to the previous, end exists only because
887  * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */
888 static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
889  uint32_t *unused, void *opq)
890 {
891  int i;
892  for (i = 0; i < width; i++)
893  dst[i] = src[2 * i + 1];
894 }
895 
896 static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
897  const uint8_t *src2, int width, uint32_t *unused, void *opq)
898 {
899  int i;
900  for (i = 0; i < width; i++) {
901  dstU[i] = src1[4 * i + 0];
902  dstV[i] = src1[4 * i + 2];
903  }
904  av_assert1(src1 == src2);
905 }
906 
907 static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,
908  const uint8_t *src, int width)
909 {
910  int i;
911  for (i = 0; i < width; i++) {
912  dst1[i] = src[2 * i + 0];
913  dst2[i] = src[2 * i + 1];
914  }
915 }
916 
917 static void nv12ToUV_c(uint8_t *dstU, uint8_t *dstV,
918  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
919  int width, uint32_t *unused, void *opq)
920 {
921  nvXXtoUV_c(dstU, dstV, src1, width);
922 }
923 
924 static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
925  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
926  int width, uint32_t *unused, void *opq)
927 {
928  nvXXtoUV_c(dstV, dstU, src1, width);
929 }
930 
931 #define p01x_uv_wrapper(bits, shift) \
932  static void p0 ## bits ## LEToUV_c(uint8_t *dstU, uint8_t *dstV, \
933  const uint8_t *unused0, \
934  const uint8_t *src1, \
935  const uint8_t *src2, int width, \
936  uint32_t *unused, void *opq) \
937  { \
938  int i; \
939  for (i = 0; i < width; i++) { \
940  AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0) >> shift); \
941  AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2) >> shift); \
942  } \
943  } \
944  \
945  static void p0 ## bits ## BEToUV_c(uint8_t *dstU, uint8_t *dstV, \
946  const uint8_t *unused0, \
947  const uint8_t *src1, \
948  const uint8_t *src2, int width, \
949  uint32_t *unused, void *opq) \
950  { \
951  int i; \
952  for (i = 0; i < width; i++) { \
953  AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0) >> shift); \
954  AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2) >> shift); \
955  } \
956  }
957 
958 #define p01x_wrapper(bits, shift) \
959  static void p0 ## bits ## LEToY_c(uint8_t *dst, const uint8_t *src, \
960  const uint8_t *unused1, \
961  const uint8_t *unused2, int width, \
962  uint32_t *unused, void *opq) \
963  { \
964  int i; \
965  for (i = 0; i < width; i++) { \
966  AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> shift); \
967  } \
968  } \
969  \
970  static void p0 ## bits ## BEToY_c(uint8_t *dst, const uint8_t *src, \
971  const uint8_t *unused1, \
972  const uint8_t *unused2, int width, \
973  uint32_t *unused, void *opq) \
974  { \
975  int i; \
976  for (i = 0; i < width; i++) { \
977  AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> shift); \
978  } \
979  } \
980  p01x_uv_wrapper(bits, shift)
981 
983 p01x_wrapper(12, 4)
984 p01x_uv_wrapper(16, 0)
985 
986 static void bgr24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,
987  int width, uint32_t *rgb2yuv, void *opq)
988 {
989  int16_t *dst = (int16_t *)_dst;
990  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
991  int i;
992  for (i = 0; i < width; i++) {
993  int b = src[i * 3 + 0];
994  int g = src[i * 3 + 1];
995  int r = src[i * 3 + 2];
996 
997  dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
998  }
999 }
1000 
1001 static void bgr24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1002  const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1003 {
1004  int16_t *dstU = (int16_t *)_dstU;
1005  int16_t *dstV = (int16_t *)_dstV;
1006  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1007  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1008  int i;
1009  for (i = 0; i < width; i++) {
1010  int b = src1[3 * i + 0];
1011  int g = src1[3 * i + 1];
1012  int r = src1[3 * i + 2];
1013 
1014  dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1015  dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1016  }
1017  av_assert1(src1 == src2);
1018 }
1019 
1020 static void bgr24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1021  const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1022 {
1023  int16_t *dstU = (int16_t *)_dstU;
1024  int16_t *dstV = (int16_t *)_dstV;
1025  int i;
1026  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1027  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1028  for (i = 0; i < width; i++) {
1029  int b = src1[6 * i + 0] + src1[6 * i + 3];
1030  int g = src1[6 * i + 1] + src1[6 * i + 4];
1031  int r = src1[6 * i + 2] + src1[6 * i + 5];
1032 
1033  dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1034  dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1035  }
1036  av_assert1(src1 == src2);
1037 }
1038 
1039 static void rgb24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
1040  uint32_t *rgb2yuv, void *opq)
1041 {
1042  int16_t *dst = (int16_t *)_dst;
1043  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1044  int i;
1045  for (i = 0; i < width; i++) {
1046  int r = src[i * 3 + 0];
1047  int g = src[i * 3 + 1];
1048  int b = src[i * 3 + 2];
1049 
1050  dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
1051  }
1052 }
1053 
1054 static void rgb24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1055  const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1056 {
1057  int16_t *dstU = (int16_t *)_dstU;
1058  int16_t *dstV = (int16_t *)_dstV;
1059  int i;
1060  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1061  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1062  av_assert1(src1 == src2);
1063  for (i = 0; i < width; i++) {
1064  int r = src1[3 * i + 0];
1065  int g = src1[3 * i + 1];
1066  int b = src1[3 * i + 2];
1067 
1068  dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1069  dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
1070  }
1071 }
1072 
1073 static void rgb24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
1074  const uint8_t *src2, int width, uint32_t *rgb2yuv, void *opq)
1075 {
1076  int16_t *dstU = (int16_t *)_dstU;
1077  int16_t *dstV = (int16_t *)_dstV;
1078  int i;
1079  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1080  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1081  av_assert1(src1 == src2);
1082  for (i = 0; i < width; i++) {
1083  int r = src1[6 * i + 0] + src1[6 * i + 3];
1084  int g = src1[6 * i + 1] + src1[6 * i + 4];
1085  int b = src1[6 * i + 2] + src1[6 * i + 5];
1086 
1087  dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1088  dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
1089  }
1090 }
1091 
1092 static void planar_rgb_to_y(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
1093 {
1094  uint16_t *dst = (uint16_t *)_dst;
1095  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1096  int i;
1097  for (i = 0; i < width; i++) {
1098  int g = src[0][i];
1099  int b = src[1][i];
1100  int r = src[2][i];
1101 
1102  dst[i] = (ry*r + gy*g + by*b + (0x801<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
1103  }
1104 }
1105 
1106 static void planar_rgb_to_a(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *unused, void *opq)
1107 {
1108  uint16_t *dst = (uint16_t *)_dst;
1109  int i;
1110  for (i = 0; i < width; i++)
1111  dst[i] = src[3][i] << 6;
1112 }
1113 
1114 static void planar_rgb_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opq)
1115 {
1116  uint16_t *dstU = (uint16_t *)_dstU;
1117  uint16_t *dstV = (uint16_t *)_dstV;
1118  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1119  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1120  int i;
1121  for (i = 0; i < width; i++) {
1122  int g = src[0][i];
1123  int b = src[1][i];
1124  int r = src[2][i];
1125 
1126  dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
1127  dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
1128  }
1129 }
1130 
1131 #define rdpx(src) \
1132  (is_be ? AV_RB16(src) : AV_RL16(src))
1133 static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_src[4],
1134  int width, int bpc, int is_be, int32_t *rgb2yuv)
1135 {
1136  int i;
1137  const uint16_t **src = (const uint16_t **)_src;
1138  uint16_t *dst = (uint16_t *)_dst;
1139  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1140  int shift = bpc < 16 ? bpc : 14;
1141  for (i = 0; i < width; i++) {
1142  int g = rdpx(src[0] + i);
1143  int b = rdpx(src[1] + i);
1144  int r = rdpx(src[2] + i);
1145 
1146  dst[i] = (ry*r + gy*g + by*b + (16 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
1147  }
1148 }
1149 
1150 static av_always_inline void planar_rgb16_to_a(uint8_t *_dst, const uint8_t *_src[4],
1151  int width, int bpc, int is_be, int32_t *rgb2yuv)
1152 {
1153  int i;
1154  const uint16_t **src = (const uint16_t **)_src;
1155  uint16_t *dst = (uint16_t *)_dst;
1156  int shift = bpc < 16 ? bpc : 14;
1157 
1158  for (i = 0; i < width; i++) {
1159  dst[i] = rdpx(src[3] + i) << (14 - shift);
1160  }
1161 }
1162 
1163 static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV,
1164  const uint8_t *_src[4], int width,
1165  int bpc, int is_be, int32_t *rgb2yuv)
1166 {
1167  int i;
1168  const uint16_t **src = (const uint16_t **)_src;
1169  uint16_t *dstU = (uint16_t *)_dstU;
1170  uint16_t *dstV = (uint16_t *)_dstV;
1171  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1172  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1173  int shift = bpc < 16 ? bpc : 14;
1174  for (i = 0; i < width; i++) {
1175  int g = rdpx(src[0] + i);
1176  int b = rdpx(src[1] + i);
1177  int r = rdpx(src[2] + i);
1178 
1179  dstU[i] = (ru*r + gu*g + bu*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
1180  dstV[i] = (rv*r + gv*g + bv*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
1181  }
1182 }
1183 #undef rdpx
1184 
1185 #define rdpx(src) (is_be ? av_int2float(AV_RB32(src)): av_int2float(AV_RL32(src)))
1186 
1187 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)
1188 {
1189  int i;
1190  const float **src = (const float **)_src;
1191  uint16_t *dst = (uint16_t *)_dst;
1192 
1193  for (i = 0; i < width; i++) {
1194  dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[3] + i), 0.0f, 65535.0f));
1195  }
1196 }
1197 
1198 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)
1199 {
1200  int i;
1201  const float **src = (const float **)_src;
1202  uint16_t *dstU = (uint16_t *)_dstU;
1203  uint16_t *dstV = (uint16_t *)_dstV;
1204  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1205  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1206 
1207  for (i = 0; i < width; i++) {
1208  int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
1209  int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
1210  int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1211 
1212  dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1213  dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1214  }
1215 }
1216 
1217 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)
1218 {
1219  int i;
1220  const float **src = (const float **)_src;
1221  uint16_t *dst = (uint16_t *)_dst;
1222 
1223  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1224 
1225  for (i = 0; i < width; i++) {
1226  int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
1227  int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
1228  int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1229 
1230  dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1231  }
1232 }
1233 
1234 static av_always_inline void rgbf32_to_uv_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused1,
1235  const uint8_t *_src, const uint8_t *unused2,
1236  int width, int is_be, int32_t *rgb2yuv)
1237 {
1238  int i;
1239  const float *src = (const float *)_src;
1240  uint16_t *dstU = (uint16_t *)_dstU;
1241  uint16_t *dstV = (uint16_t *)_dstV;
1242  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1243  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1244 
1245  for (i = 0; i < width; i++) {
1246  int r = lrintf(av_clipf(65535.0f * rdpx(&src[3*i]), 0.0f, 65535.0f));
1247  int g = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 1]), 0.0f, 65535.0f));
1248  int b = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 2]), 0.0f, 65535.0f));
1249 
1250  dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1251  dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1252  }
1253 }
1254 
1255 static av_always_inline void rgbf32_to_y_c(uint8_t *_dst, const uint8_t *_src,
1256  const uint8_t *unused1, const uint8_t *unused2,
1257  int width, int is_be, int32_t *rgb2yuv)
1258 {
1259  int i;
1260  const float *src = (const float *)_src;
1261  uint16_t *dst = (uint16_t *)_dst;
1262 
1263  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1264 
1265  for (i = 0; i < width; i++) {
1266  int r = lrintf(av_clipf(65535.0f * rdpx(&src[3*i]), 0.0f, 65535.0f));
1267  int g = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 1]), 0.0f, 65535.0f));
1268  int b = lrintf(av_clipf(65535.0f * rdpx(&src[3*i + 2]), 0.0f, 65535.0f));
1269 
1270  dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1271  }
1272 }
1273 
1274 static av_always_inline void grayf32ToY16_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1275  const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1276 {
1277  int i;
1278  const float *src = (const float *)_src;
1279  uint16_t *dst = (uint16_t *)_dst;
1280 
1281  for (i = 0; i < width; ++i){
1282  dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i), 0.0f, 65535.0f));
1283  }
1284 }
1285 
1286 #undef rdpx
1287 
1288 #define rgb9plus_planar_funcs_endian(nbits, endian_name, endian) \
1289 static void planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1290  int w, int32_t *rgb2yuv, void *opq) \
1291 { \
1292  planar_rgb16_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1293 } \
1294 static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1295  const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1296  void *opq) \
1297 { \
1298  planar_rgb16_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1299 } \
1300 
1301 #define rgb9plus_planar_transparency_funcs(nbits) \
1302 static void planar_rgb##nbits##le_to_a(uint8_t *dst, const uint8_t *src[4], \
1303  int w, int32_t *rgb2yuv, \
1304  void *opq) \
1305 { \
1306  planar_rgb16_to_a(dst, src, w, nbits, 0, rgb2yuv); \
1307 } \
1308 static void planar_rgb##nbits##be_to_a(uint8_t *dst, const uint8_t *src[4], \
1309  int w, int32_t *rgb2yuv, \
1310  void *opq) \
1311 { \
1312  planar_rgb16_to_a(dst, src, w, nbits, 1, rgb2yuv); \
1313 }
1314 
1315 #define rgb9plus_planar_funcs(nbits) \
1316  rgb9plus_planar_funcs_endian(nbits, le, 0) \
1317  rgb9plus_planar_funcs_endian(nbits, be, 1)
1318 
1324 
1329 
1330 #define rgbf32_funcs_endian(endian_name, endian) \
1331 static void planar_rgbf32##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1332  int w, int32_t *rgb2yuv, void *opq) \
1333 { \
1334  planar_rgbf32_to_y(dst, src, w, endian, rgb2yuv); \
1335 } \
1336 static void planar_rgbf32##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1337  const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1338  void *opq) \
1339 { \
1340  planar_rgbf32_to_uv(dstU, dstV, src, w, endian, rgb2yuv); \
1341 } \
1342 static void planar_rgbf32##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1343  int w, int32_t *rgb2yuv, void *opq) \
1344 { \
1345  planar_rgbf32_to_a(dst, src, w, endian, rgb2yuv); \
1346 } \
1347 static void rgbf32##endian_name##_to_y_c(uint8_t *dst, const uint8_t *src, \
1348  const uint8_t *unused1, const uint8_t *unused2, \
1349  int w, uint32_t *rgb2yuv, void *opq) \
1350 { \
1351  rgbf32_to_y_c(dst, src, unused1, unused2, w, endian, rgb2yuv); \
1352 } \
1353 static void rgbf32##endian_name##_to_uv_c(uint8_t *dstU, uint8_t *dstV, \
1354  const uint8_t *unused1, \
1355  const uint8_t *src, const uint8_t *unused2, \
1356  int w, uint32_t *rgb2yuv, \
1357  void *opq) \
1358 { \
1359  rgbf32_to_uv_c(dstU, dstV, unused1, src, unused2, w, endian, rgb2yuv); \
1360 } \
1361 static void grayf32##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, \
1362  const uint8_t *unused1, const uint8_t *unused2, \
1363  int width, uint32_t *unused, void *opq) \
1364 { \
1365  grayf32ToY16_c(dst, src, unused1, unused2, width, endian, unused); \
1366 }
1367 
1368 rgbf32_funcs_endian(le, 0)
1370 
1371 #define rdpx(src) av_int2float(half2float(is_be ? AV_RB16(&src) : AV_RL16(&src), h2f_tbl))
1372 
1373 static av_always_inline void rgbaf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1374  const uint16_t *src, int width,
1375  int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1376 {
1377  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1378  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1379  int i;
1380  for (i = 0; i < width; i++) {
1381  int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+0]), 0.0f, 65535.0f)) +
1382  lrintf(av_clipf(65535.0f * rdpx(src[i*8+4]), 0.0f, 65535.0f))) >> 1;
1383  int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+1]), 0.0f, 65535.0f)) +
1384  lrintf(av_clipf(65535.0f * rdpx(src[i*8+5]), 0.0f, 65535.0f))) >> 1;
1385  int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*8+2]), 0.0f, 65535.0f)) +
1386  lrintf(av_clipf(65535.0f * rdpx(src[i*8+6]), 0.0f, 65535.0f))) >> 1;
1387 
1388  dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1389  dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1390  }
1391 }
1392 
1393 static av_always_inline void rgbaf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1394  const uint16_t *src, int width,
1395  int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1396 {
1397  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1398  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1399  int i;
1400  for (i = 0; i < width; i++) {
1401  int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1402  int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1403  int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1404 
1405  dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1406  dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1407  }
1408 }
1409 
1410 static av_always_inline void rgbaf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1411  int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1412 {
1413  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1414  int i;
1415  for (i = 0; i < width; i++) {
1416  int r = lrintf(av_clipf(65535.0f * rdpx(src[i*4+0]), 0.0f, 65535.0f));
1417  int g = lrintf(av_clipf(65535.0f * rdpx(src[i*4+1]), 0.0f, 65535.0f));
1418  int b = lrintf(av_clipf(65535.0f * rdpx(src[i*4+2]), 0.0f, 65535.0f));
1419 
1420  dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1421  }
1422 }
1423 
1424 static av_always_inline void rgbaf16ToA_endian(uint16_t *dst, const uint16_t *src, int is_be,
1425  int width, Half2FloatTables *h2f_tbl)
1426 {
1427  int i;
1428  for (i=0; i<width; i++) {
1429  dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[i*4+3]), 0.0f, 65535.0f));
1430  }
1431 }
1432 
1433 static av_always_inline void rgbf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1434  const uint16_t *src, int width,
1435  int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1436 {
1437  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1438  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1439  int i;
1440  for (i = 0; i < width; i++) {
1441  int r = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+0]), 0.0f, 65535.0f)) +
1442  lrintf(av_clipf(65535.0f * rdpx(src[i*6+3]), 0.0f, 65535.0f))) >> 1;
1443  int g = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+1]), 0.0f, 65535.0f)) +
1444  lrintf(av_clipf(65535.0f * rdpx(src[i*6+4]), 0.0f, 65535.0f))) >> 1;
1445  int b = (lrintf(av_clipf(65535.0f * rdpx(src[i*6+2]), 0.0f, 65535.0f)) +
1446  lrintf(av_clipf(65535.0f * rdpx(src[i*6+5]), 0.0f, 65535.0f))) >> 1;
1447 
1448  dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1449  dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1450  }
1451 }
1452 
1453 static av_always_inline void rgbf16ToUV_endian(uint16_t *dstU, uint16_t *dstV, int is_be,
1454  const uint16_t *src, int width,
1455  int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1456 {
1457  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
1458  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
1459  int i;
1460  for (i = 0; i < width; i++) {
1461  int r = lrintf(av_clipf(65535.0f * rdpx(src[i*3+0]), 0.0f, 65535.0f));
1462  int g = lrintf(av_clipf(65535.0f * rdpx(src[i*3+1]), 0.0f, 65535.0f));
1463  int b = lrintf(av_clipf(65535.0f * rdpx(src[i*3+2]), 0.0f, 65535.0f));
1464 
1465  dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1466  dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1467  }
1468 }
1469 
1470 static av_always_inline void rgbf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be,
1471  int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
1472 {
1473  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1474  int i;
1475  for (i = 0; i < width; i++) {
1476  int r = lrintf(av_clipf(65535.0f * rdpx(src[i*3+0]), 0.0f, 65535.0f));
1477  int g = lrintf(av_clipf(65535.0f * rdpx(src[i*3+1]), 0.0f, 65535.0f));
1478  int b = lrintf(av_clipf(65535.0f * rdpx(src[i*3+2]), 0.0f, 65535.0f));
1479 
1480  dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
1481  }
1482 }
1483 
1484 #undef rdpx
1485 
1486 #define rgbaf16_funcs_endian(endian_name, endian) \
1487 static void rgbaf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1488  const uint8_t *src1, const uint8_t *src2, \
1489  int width, uint32_t *_rgb2yuv, void *opq) \
1490 { \
1491  const uint16_t *src = (const uint16_t*)src1; \
1492  uint16_t *dstU = (uint16_t*)_dstU; \
1493  uint16_t *dstV = (uint16_t*)_dstV; \
1494  int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1495  av_assert1(src1==src2); \
1496  rgbaf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1497 } \
1498 static void rgbaf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1499  const uint8_t *src1, const uint8_t *src2, \
1500  int width, uint32_t *_rgb2yuv, void *opq) \
1501 { \
1502  const uint16_t *src = (const uint16_t*)src1; \
1503  uint16_t *dstU = (uint16_t*)_dstU; \
1504  uint16_t *dstV = (uint16_t*)_dstV; \
1505  int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1506  av_assert1(src1==src2); \
1507  rgbaf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1508 } \
1509 static void rgbaf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1510  const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1511 { \
1512  const uint16_t *src = (const uint16_t*)_src; \
1513  uint16_t *dst = (uint16_t*)_dst; \
1514  int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1515  rgbaf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1516 } \
1517 static void rgbaf16##endian_name##ToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1518  const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
1519 { \
1520  const uint16_t *src = (const uint16_t*)_src; \
1521  uint16_t *dst = (uint16_t*)_dst; \
1522  rgbaf16ToA_endian(dst, src, endian, width, opq); \
1523 } \
1524 static void rgbf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1525  const uint8_t *src1, const uint8_t *src2, \
1526  int width, uint32_t *_rgb2yuv, void *opq) \
1527 { \
1528  const uint16_t *src = (const uint16_t*)src1; \
1529  uint16_t *dstU = (uint16_t*)_dstU; \
1530  uint16_t *dstV = (uint16_t*)_dstV; \
1531  int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1532  av_assert1(src1==src2); \
1533  rgbf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1534 } \
1535 static void rgbf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1536  const uint8_t *src1, const uint8_t *src2, \
1537  int width, uint32_t *_rgb2yuv, void *opq) \
1538 { \
1539  const uint16_t *src = (const uint16_t*)src1; \
1540  uint16_t *dstU = (uint16_t*)_dstU; \
1541  uint16_t *dstV = (uint16_t*)_dstV; \
1542  int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1543  av_assert1(src1==src2); \
1544  rgbf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1545 } \
1546 static void rgbf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1547  const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1548 { \
1549  const uint16_t *src = (const uint16_t*)_src; \
1550  uint16_t *dst = (uint16_t*)_dst; \
1551  int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1552  rgbf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1553 } \
1554 
1557 
1559  planar1_YV12_fn *lumToYV12,
1560  planar1_YV12_fn *alpToYV12,
1561  planar2_YV12_fn *chrToYV12,
1562  planarX_YV12_fn *readLumPlanar,
1563  planarX_YV12_fn *readAlpPlanar,
1564  planarX2_YV12_fn *readChrPlanar)
1565 {
1566  enum AVPixelFormat srcFormat = c->srcFormat;
1567 
1568  *chrToYV12 = NULL;
1569  switch (srcFormat) {
1570  case AV_PIX_FMT_YUYV422:
1571  *chrToYV12 = yuy2ToUV_c;
1572  break;
1573  case AV_PIX_FMT_YVYU422:
1574  *chrToYV12 = yvy2ToUV_c;
1575  break;
1576  case AV_PIX_FMT_UYVY422:
1577  *chrToYV12 = uyvyToUV_c;
1578  break;
1579  case AV_PIX_FMT_VYU444:
1580  *chrToYV12 = vyuToUV_c;
1581  break;
1582  case AV_PIX_FMT_NV12:
1583  case AV_PIX_FMT_NV16:
1584  case AV_PIX_FMT_NV24:
1585  *chrToYV12 = nv12ToUV_c;
1586  break;
1587  case AV_PIX_FMT_NV21:
1588  case AV_PIX_FMT_NV42:
1589  *chrToYV12 = nv21ToUV_c;
1590  break;
1591  case AV_PIX_FMT_RGB8:
1592  case AV_PIX_FMT_BGR8:
1593  case AV_PIX_FMT_PAL8:
1594  case AV_PIX_FMT_BGR4_BYTE:
1595  case AV_PIX_FMT_RGB4_BYTE:
1596  *chrToYV12 = palToUV_c;
1597  break;
1598  case AV_PIX_FMT_GBRP9LE:
1599  *readChrPlanar = planar_rgb9le_to_uv;
1600  break;
1601  case AV_PIX_FMT_GBRAP10LE:
1602  case AV_PIX_FMT_GBRP10LE:
1603  *readChrPlanar = planar_rgb10le_to_uv;
1604  break;
1605  case AV_PIX_FMT_GBRAP12LE:
1606  case AV_PIX_FMT_GBRP12LE:
1607  *readChrPlanar = planar_rgb12le_to_uv;
1608  break;
1609  case AV_PIX_FMT_GBRAP14LE:
1610  case AV_PIX_FMT_GBRP14LE:
1611  *readChrPlanar = planar_rgb14le_to_uv;
1612  break;
1613  case AV_PIX_FMT_GBRAP16LE:
1614  case AV_PIX_FMT_GBRP16LE:
1615  *readChrPlanar = planar_rgb16le_to_uv;
1616  break;
1617  case AV_PIX_FMT_GBRAPF32LE:
1618  case AV_PIX_FMT_GBRPF32LE:
1619  *readChrPlanar = planar_rgbf32le_to_uv;
1620  break;
1621  case AV_PIX_FMT_GBRP9BE:
1622  *readChrPlanar = planar_rgb9be_to_uv;
1623  break;
1624  case AV_PIX_FMT_GBRAP10BE:
1625  case AV_PIX_FMT_GBRP10BE:
1626  *readChrPlanar = planar_rgb10be_to_uv;
1627  break;
1628  case AV_PIX_FMT_GBRAP12BE:
1629  case AV_PIX_FMT_GBRP12BE:
1630  *readChrPlanar = planar_rgb12be_to_uv;
1631  break;
1632  case AV_PIX_FMT_GBRAP14BE:
1633  case AV_PIX_FMT_GBRP14BE:
1634  *readChrPlanar = planar_rgb14be_to_uv;
1635  break;
1636  case AV_PIX_FMT_GBRAP16BE:
1637  case AV_PIX_FMT_GBRP16BE:
1638  *readChrPlanar = planar_rgb16be_to_uv;
1639  break;
1640  case AV_PIX_FMT_GBRAPF32BE:
1641  case AV_PIX_FMT_GBRPF32BE:
1642  *readChrPlanar = planar_rgbf32be_to_uv;
1643  break;
1644  case AV_PIX_FMT_GBRAP:
1645  case AV_PIX_FMT_GBRP:
1646  *readChrPlanar = planar_rgb_to_uv;
1647  break;
1648 #if HAVE_BIGENDIAN
1649  case AV_PIX_FMT_YUV420P9LE:
1650  case AV_PIX_FMT_YUV422P9LE:
1651  case AV_PIX_FMT_YUV444P9LE:
1666 
1678  *chrToYV12 = bswap16UV_c;
1679  break;
1680 #else
1681  case AV_PIX_FMT_YUV420P9BE:
1682  case AV_PIX_FMT_YUV422P9BE:
1683  case AV_PIX_FMT_YUV444P9BE:
1698 
1710  *chrToYV12 = bswap16UV_c;
1711  break;
1712 #endif
1713  case AV_PIX_FMT_VUYA:
1714  case AV_PIX_FMT_VUYX:
1715  *chrToYV12 = read_vuyx_UV_c;
1716  break;
1717  case AV_PIX_FMT_XV30LE:
1718  *chrToYV12 = read_xv30le_UV_c;
1719  break;
1720  case AV_PIX_FMT_V30XLE:
1721  *chrToYV12 = read_v30xle_UV_c;
1722  break;
1723  case AV_PIX_FMT_AYUV:
1724  *chrToYV12 = read_ayuv_UV_c;
1725  break;
1726  case AV_PIX_FMT_AYUV64LE:
1727  *chrToYV12 = read_ayuv64le_UV_c;
1728  break;
1729  case AV_PIX_FMT_AYUV64BE:
1730  *chrToYV12 = read_ayuv64be_UV_c;
1731  break;
1732  case AV_PIX_FMT_UYVA:
1733  *chrToYV12 = read_uyva_UV_c;
1734  break;
1735  case AV_PIX_FMT_XV36LE:
1736  *chrToYV12 = read_xv36le_UV_c;
1737  break;
1738  case AV_PIX_FMT_XV36BE:
1739  *chrToYV12 = read_xv36be_UV_c;
1740  break;
1741  case AV_PIX_FMT_XV48LE:
1742  *chrToYV12 = read_xv48le_UV_c;
1743  break;
1744  case AV_PIX_FMT_XV48BE:
1745  *chrToYV12 = read_xv48be_UV_c;
1746  break;
1747  case AV_PIX_FMT_P010LE:
1748  case AV_PIX_FMT_P210LE:
1749  case AV_PIX_FMT_P410LE:
1750  *chrToYV12 = p010LEToUV_c;
1751  break;
1752  case AV_PIX_FMT_P010BE:
1753  case AV_PIX_FMT_P210BE:
1754  case AV_PIX_FMT_P410BE:
1755  *chrToYV12 = p010BEToUV_c;
1756  break;
1757  case AV_PIX_FMT_P012LE:
1758  case AV_PIX_FMT_P212LE:
1759  case AV_PIX_FMT_P412LE:
1760  *chrToYV12 = p012LEToUV_c;
1761  break;
1762  case AV_PIX_FMT_P012BE:
1763  case AV_PIX_FMT_P212BE:
1764  case AV_PIX_FMT_P412BE:
1765  *chrToYV12 = p012BEToUV_c;
1766  break;
1767  case AV_PIX_FMT_P016LE:
1768  case AV_PIX_FMT_P216LE:
1769  case AV_PIX_FMT_P416LE:
1770  *chrToYV12 = p016LEToUV_c;
1771  break;
1772  case AV_PIX_FMT_P016BE:
1773  case AV_PIX_FMT_P216BE:
1774  case AV_PIX_FMT_P416BE:
1775  *chrToYV12 = p016BEToUV_c;
1776  break;
1777  case AV_PIX_FMT_Y210LE:
1778  *chrToYV12 = y210le_UV_c;
1779  break;
1780  case AV_PIX_FMT_Y212LE:
1781  *chrToYV12 = y212le_UV_c;
1782  break;
1783  case AV_PIX_FMT_Y216LE:
1784  *chrToYV12 = y216le_UV_c;
1785  break;
1786  case AV_PIX_FMT_RGBF32LE:
1787  *chrToYV12 = rgbf32le_to_uv_c;
1788  break;
1789  case AV_PIX_FMT_RGBF32BE:
1790  *chrToYV12 = rgbf32be_to_uv_c;
1791  break;
1792  }
1793  if (c->chrSrcHSubSample) {
1794  switch (srcFormat) {
1795  case AV_PIX_FMT_RGBA64BE:
1796  *chrToYV12 = rgb64BEToUV_half_c;
1797  break;
1798  case AV_PIX_FMT_RGBA64LE:
1799  *chrToYV12 = rgb64LEToUV_half_c;
1800  break;
1801  case AV_PIX_FMT_BGRA64BE:
1802  *chrToYV12 = bgr64BEToUV_half_c;
1803  break;
1804  case AV_PIX_FMT_BGRA64LE:
1805  *chrToYV12 = bgr64LEToUV_half_c;
1806  break;
1807  case AV_PIX_FMT_RGB48BE:
1808  *chrToYV12 = rgb48BEToUV_half_c;
1809  break;
1810  case AV_PIX_FMT_RGB48LE:
1811  *chrToYV12 = rgb48LEToUV_half_c;
1812  break;
1813  case AV_PIX_FMT_BGR48BE:
1814  *chrToYV12 = bgr48BEToUV_half_c;
1815  break;
1816  case AV_PIX_FMT_BGR48LE:
1817  *chrToYV12 = bgr48LEToUV_half_c;
1818  break;
1819  case AV_PIX_FMT_RGB32:
1820  *chrToYV12 = bgr32ToUV_half_c;
1821  break;
1822  case AV_PIX_FMT_RGB32_1:
1823  *chrToYV12 = bgr321ToUV_half_c;
1824  break;
1825  case AV_PIX_FMT_BGR24:
1826  *chrToYV12 = bgr24ToUV_half_c;
1827  break;
1828  case AV_PIX_FMT_BGR565LE:
1829  *chrToYV12 = bgr16leToUV_half_c;
1830  break;
1831  case AV_PIX_FMT_BGR565BE:
1832  *chrToYV12 = bgr16beToUV_half_c;
1833  break;
1834  case AV_PIX_FMT_BGR555LE:
1835  *chrToYV12 = bgr15leToUV_half_c;
1836  break;
1837  case AV_PIX_FMT_BGR555BE:
1838  *chrToYV12 = bgr15beToUV_half_c;
1839  break;
1840  case AV_PIX_FMT_GBRAP:
1841  case AV_PIX_FMT_GBRP:
1842  *chrToYV12 = gbr24pToUV_half_c;
1843  break;
1844  case AV_PIX_FMT_BGR444LE:
1845  *chrToYV12 = bgr12leToUV_half_c;
1846  break;
1847  case AV_PIX_FMT_BGR444BE:
1848  *chrToYV12 = bgr12beToUV_half_c;
1849  break;
1850  case AV_PIX_FMT_BGR32:
1851  *chrToYV12 = rgb32ToUV_half_c;
1852  break;
1853  case AV_PIX_FMT_BGR32_1:
1854  *chrToYV12 = rgb321ToUV_half_c;
1855  break;
1856  case AV_PIX_FMT_RGB24:
1857  *chrToYV12 = rgb24ToUV_half_c;
1858  break;
1859  case AV_PIX_FMT_RGB565LE:
1860  *chrToYV12 = rgb16leToUV_half_c;
1861  break;
1862  case AV_PIX_FMT_RGB565BE:
1863  *chrToYV12 = rgb16beToUV_half_c;
1864  break;
1865  case AV_PIX_FMT_RGB555LE:
1866  *chrToYV12 = rgb15leToUV_half_c;
1867  break;
1868  case AV_PIX_FMT_RGB555BE:
1869  *chrToYV12 = rgb15beToUV_half_c;
1870  break;
1871  case AV_PIX_FMT_RGB444LE:
1872  *chrToYV12 = rgb12leToUV_half_c;
1873  break;
1874  case AV_PIX_FMT_RGB444BE:
1875  *chrToYV12 = rgb12beToUV_half_c;
1876  break;
1877  case AV_PIX_FMT_X2RGB10LE:
1878  *chrToYV12 = rgb30leToUV_half_c;
1879  break;
1880  case AV_PIX_FMT_X2BGR10LE:
1881  *chrToYV12 = bgr30leToUV_half_c;
1882  break;
1883  case AV_PIX_FMT_RGBAF16BE:
1884  *chrToYV12 = rgbaf16beToUV_half_c;
1885  break;
1886  case AV_PIX_FMT_RGBAF16LE:
1887  *chrToYV12 = rgbaf16leToUV_half_c;
1888  break;
1889  case AV_PIX_FMT_RGBF16BE:
1890  *chrToYV12 = rgbf16beToUV_half_c;
1891  break;
1892  case AV_PIX_FMT_RGBF16LE:
1893  *chrToYV12 = rgbf16leToUV_half_c;
1894  break;
1895  }
1896  } else {
1897  switch (srcFormat) {
1898  case AV_PIX_FMT_RGBA64BE:
1899  *chrToYV12 = rgb64BEToUV_c;
1900  break;
1901  case AV_PIX_FMT_RGBA64LE:
1902  *chrToYV12 = rgb64LEToUV_c;
1903  break;
1904  case AV_PIX_FMT_BGRA64BE:
1905  *chrToYV12 = bgr64BEToUV_c;
1906  break;
1907  case AV_PIX_FMT_BGRA64LE:
1908  *chrToYV12 = bgr64LEToUV_c;
1909  break;
1910  case AV_PIX_FMT_RGB48BE:
1911  *chrToYV12 = rgb48BEToUV_c;
1912  break;
1913  case AV_PIX_FMT_RGB48LE:
1914  *chrToYV12 = rgb48LEToUV_c;
1915  break;
1916  case AV_PIX_FMT_BGR48BE:
1917  *chrToYV12 = bgr48BEToUV_c;
1918  break;
1919  case AV_PIX_FMT_BGR48LE:
1920  *chrToYV12 = bgr48LEToUV_c;
1921  break;
1922  case AV_PIX_FMT_RGB32:
1923  *chrToYV12 = bgr32ToUV_c;
1924  break;
1925  case AV_PIX_FMT_RGB32_1:
1926  *chrToYV12 = bgr321ToUV_c;
1927  break;
1928  case AV_PIX_FMT_BGR24:
1929  *chrToYV12 = bgr24ToUV_c;
1930  break;
1931  case AV_PIX_FMT_BGR565LE:
1932  *chrToYV12 = bgr16leToUV_c;
1933  break;
1934  case AV_PIX_FMT_BGR565BE:
1935  *chrToYV12 = bgr16beToUV_c;
1936  break;
1937  case AV_PIX_FMT_BGR555LE:
1938  *chrToYV12 = bgr15leToUV_c;
1939  break;
1940  case AV_PIX_FMT_BGR555BE:
1941  *chrToYV12 = bgr15beToUV_c;
1942  break;
1943  case AV_PIX_FMT_BGR444LE:
1944  *chrToYV12 = bgr12leToUV_c;
1945  break;
1946  case AV_PIX_FMT_BGR444BE:
1947  *chrToYV12 = bgr12beToUV_c;
1948  break;
1949  case AV_PIX_FMT_BGR32:
1950  *chrToYV12 = rgb32ToUV_c;
1951  break;
1952  case AV_PIX_FMT_BGR32_1:
1953  *chrToYV12 = rgb321ToUV_c;
1954  break;
1955  case AV_PIX_FMT_RGB24:
1956  *chrToYV12 = rgb24ToUV_c;
1957  break;
1958  case AV_PIX_FMT_RGB565LE:
1959  *chrToYV12 = rgb16leToUV_c;
1960  break;
1961  case AV_PIX_FMT_RGB565BE:
1962  *chrToYV12 = rgb16beToUV_c;
1963  break;
1964  case AV_PIX_FMT_RGB555LE:
1965  *chrToYV12 = rgb15leToUV_c;
1966  break;
1967  case AV_PIX_FMT_RGB555BE:
1968  *chrToYV12 = rgb15beToUV_c;
1969  break;
1970  case AV_PIX_FMT_RGB444LE:
1971  *chrToYV12 = rgb12leToUV_c;
1972  break;
1973  case AV_PIX_FMT_RGB444BE:
1974  *chrToYV12 = rgb12beToUV_c;
1975  break;
1976  case AV_PIX_FMT_X2RGB10LE:
1977  *chrToYV12 = rgb30leToUV_c;
1978  break;
1979  case AV_PIX_FMT_X2BGR10LE:
1980  *chrToYV12 = bgr30leToUV_c;
1981  break;
1982  case AV_PIX_FMT_RGBAF16BE:
1983  *chrToYV12 = rgbaf16beToUV_c;
1984  break;
1985  case AV_PIX_FMT_RGBAF16LE:
1986  *chrToYV12 = rgbaf16leToUV_c;
1987  break;
1988  case AV_PIX_FMT_RGBF16BE:
1989  *chrToYV12 = rgbf16beToUV_c;
1990  break;
1991  case AV_PIX_FMT_RGBF16LE:
1992  *chrToYV12 = rgbf16leToUV_c;
1993  break;
1994  }
1995  }
1996 
1997  *lumToYV12 = NULL;
1998  *alpToYV12 = NULL;
1999  switch (srcFormat) {
2000  case AV_PIX_FMT_GBRP9LE:
2001  *readLumPlanar = planar_rgb9le_to_y;
2002  break;
2003  case AV_PIX_FMT_GBRAP10LE:
2004  *readAlpPlanar = planar_rgb10le_to_a;
2005  case AV_PIX_FMT_GBRP10LE:
2006  *readLumPlanar = planar_rgb10le_to_y;
2007  break;
2008  case AV_PIX_FMT_GBRAP12LE:
2009  *readAlpPlanar = planar_rgb12le_to_a;
2010  case AV_PIX_FMT_GBRP12LE:
2011  *readLumPlanar = planar_rgb12le_to_y;
2012  break;
2013  case AV_PIX_FMT_GBRAP14LE:
2014  *readAlpPlanar = planar_rgb14le_to_a;
2015  case AV_PIX_FMT_GBRP14LE:
2016  *readLumPlanar = planar_rgb14le_to_y;
2017  break;
2018  case AV_PIX_FMT_GBRAP16LE:
2019  *readAlpPlanar = planar_rgb16le_to_a;
2020  case AV_PIX_FMT_GBRP16LE:
2021  *readLumPlanar = planar_rgb16le_to_y;
2022  break;
2023  case AV_PIX_FMT_GBRAPF32LE:
2024  *readAlpPlanar = planar_rgbf32le_to_a;
2025  case AV_PIX_FMT_GBRPF32LE:
2026  *readLumPlanar = planar_rgbf32le_to_y;
2027  break;
2028  case AV_PIX_FMT_GBRP9BE:
2029  *readLumPlanar = planar_rgb9be_to_y;
2030  break;
2031  case AV_PIX_FMT_GBRAP10BE:
2032  *readAlpPlanar = planar_rgb10be_to_a;
2033  case AV_PIX_FMT_GBRP10BE:
2034  *readLumPlanar = planar_rgb10be_to_y;
2035  break;
2036  case AV_PIX_FMT_GBRAP12BE:
2037  *readAlpPlanar = planar_rgb12be_to_a;
2038  case AV_PIX_FMT_GBRP12BE:
2039  *readLumPlanar = planar_rgb12be_to_y;
2040  break;
2041  case AV_PIX_FMT_GBRAP14BE:
2042  *readAlpPlanar = planar_rgb14be_to_a;
2043  case AV_PIX_FMT_GBRP14BE:
2044  *readLumPlanar = planar_rgb14be_to_y;
2045  break;
2046  case AV_PIX_FMT_GBRAP16BE:
2047  *readAlpPlanar = planar_rgb16be_to_a;
2048  case AV_PIX_FMT_GBRP16BE:
2049  *readLumPlanar = planar_rgb16be_to_y;
2050  break;
2051  case AV_PIX_FMT_GBRAPF32BE:
2052  *readAlpPlanar = planar_rgbf32be_to_a;
2053  case AV_PIX_FMT_GBRPF32BE:
2054  *readLumPlanar = planar_rgbf32be_to_y;
2055  break;
2056  case AV_PIX_FMT_GBRAP:
2057  *readAlpPlanar = planar_rgb_to_a;
2058  case AV_PIX_FMT_GBRP:
2059  *readLumPlanar = planar_rgb_to_y;
2060  break;
2061 #if HAVE_BIGENDIAN
2062  case AV_PIX_FMT_YUV420P9LE:
2063  case AV_PIX_FMT_YUV422P9LE:
2064  case AV_PIX_FMT_YUV444P9LE:
2079 
2080  case AV_PIX_FMT_GRAY9LE:
2081  case AV_PIX_FMT_GRAY10LE:
2082  case AV_PIX_FMT_GRAY12LE:
2083  case AV_PIX_FMT_GRAY14LE:
2084  case AV_PIX_FMT_GRAY16LE:
2085 
2086  case AV_PIX_FMT_P016LE:
2087  case AV_PIX_FMT_P216LE:
2088  case AV_PIX_FMT_P416LE:
2089  *lumToYV12 = bswap16Y_c;
2090  break;
2102  *lumToYV12 = bswap16Y_c;
2103  *alpToYV12 = bswap16Y_c;
2104  break;
2105 #else
2106  case AV_PIX_FMT_YUV420P9BE:
2107  case AV_PIX_FMT_YUV422P9BE:
2108  case AV_PIX_FMT_YUV444P9BE:
2123 
2124  case AV_PIX_FMT_GRAY9BE:
2125  case AV_PIX_FMT_GRAY10BE:
2126  case AV_PIX_FMT_GRAY12BE:
2127  case AV_PIX_FMT_GRAY14BE:
2128  case AV_PIX_FMT_GRAY16BE:
2129 
2130  case AV_PIX_FMT_P016BE:
2131  case AV_PIX_FMT_P216BE:
2132  case AV_PIX_FMT_P416BE:
2133  *lumToYV12 = bswap16Y_c;
2134  break;
2146  *lumToYV12 = bswap16Y_c;
2147  *alpToYV12 = bswap16Y_c;
2148  break;
2149 #endif
2150  case AV_PIX_FMT_YA16LE:
2151  *lumToYV12 = read_ya16le_gray_c;
2152  break;
2153  case AV_PIX_FMT_YA16BE:
2154  *lumToYV12 = read_ya16be_gray_c;
2155  break;
2156  case AV_PIX_FMT_VUYA:
2157  case AV_PIX_FMT_VUYX:
2158  *lumToYV12 = read_vuyx_Y_c;
2159  break;
2160  case AV_PIX_FMT_XV30LE:
2161  *lumToYV12 = read_xv30le_Y_c;
2162  break;
2163  case AV_PIX_FMT_V30XLE:
2164  *lumToYV12 = read_v30xle_Y_c;
2165  break;
2166  case AV_PIX_FMT_AYUV:
2167  case AV_PIX_FMT_UYVA:
2168  *lumToYV12 = read_ayuv_Y_c;
2169  break;
2170  case AV_PIX_FMT_AYUV64LE:
2171  case AV_PIX_FMT_XV48LE:
2172  *lumToYV12 = read_ayuv64le_Y_c;
2173  break;
2174  case AV_PIX_FMT_AYUV64BE:
2175  case AV_PIX_FMT_XV48BE:
2176  *lumToYV12 = read_ayuv64be_Y_c;
2177  break;
2178  case AV_PIX_FMT_XV36LE:
2179  *lumToYV12 = read_xv36le_Y_c;
2180  break;
2181  case AV_PIX_FMT_XV36BE:
2182  *lumToYV12 = read_xv36be_Y_c;
2183  break;
2184  case AV_PIX_FMT_YUYV422:
2185  case AV_PIX_FMT_YVYU422:
2186  case AV_PIX_FMT_YA8:
2187  *lumToYV12 = yuy2ToY_c;
2188  break;
2189  case AV_PIX_FMT_UYVY422:
2190  *lumToYV12 = uyvyToY_c;
2191  break;
2192  case AV_PIX_FMT_VYU444:
2193  *lumToYV12 = vyuToY_c;
2194  break;
2195  case AV_PIX_FMT_BGR24:
2196  *lumToYV12 = bgr24ToY_c;
2197  break;
2198  case AV_PIX_FMT_BGR565LE:
2199  *lumToYV12 = bgr16leToY_c;
2200  break;
2201  case AV_PIX_FMT_BGR565BE:
2202  *lumToYV12 = bgr16beToY_c;
2203  break;
2204  case AV_PIX_FMT_BGR555LE:
2205  *lumToYV12 = bgr15leToY_c;
2206  break;
2207  case AV_PIX_FMT_BGR555BE:
2208  *lumToYV12 = bgr15beToY_c;
2209  break;
2210  case AV_PIX_FMT_BGR444LE:
2211  *lumToYV12 = bgr12leToY_c;
2212  break;
2213  case AV_PIX_FMT_BGR444BE:
2214  *lumToYV12 = bgr12beToY_c;
2215  break;
2216  case AV_PIX_FMT_RGB24:
2217  *lumToYV12 = rgb24ToY_c;
2218  break;
2219  case AV_PIX_FMT_RGB565LE:
2220  *lumToYV12 = rgb16leToY_c;
2221  break;
2222  case AV_PIX_FMT_RGB565BE:
2223  *lumToYV12 = rgb16beToY_c;
2224  break;
2225  case AV_PIX_FMT_RGB555LE:
2226  *lumToYV12 = rgb15leToY_c;
2227  break;
2228  case AV_PIX_FMT_RGB555BE:
2229  *lumToYV12 = rgb15beToY_c;
2230  break;
2231  case AV_PIX_FMT_RGB444LE:
2232  *lumToYV12 = rgb12leToY_c;
2233  break;
2234  case AV_PIX_FMT_RGB444BE:
2235  *lumToYV12 = rgb12beToY_c;
2236  break;
2237  case AV_PIX_FMT_RGB8:
2238  case AV_PIX_FMT_BGR8:
2239  case AV_PIX_FMT_PAL8:
2240  case AV_PIX_FMT_BGR4_BYTE:
2241  case AV_PIX_FMT_RGB4_BYTE:
2242  *lumToYV12 = palToY_c;
2243  break;
2244  case AV_PIX_FMT_MONOBLACK:
2245  *lumToYV12 = monoblack2Y_c;
2246  break;
2247  case AV_PIX_FMT_MONOWHITE:
2248  *lumToYV12 = monowhite2Y_c;
2249  break;
2250  case AV_PIX_FMT_RGB32:
2251  *lumToYV12 = bgr32ToY_c;
2252  break;
2253  case AV_PIX_FMT_RGB32_1:
2254  *lumToYV12 = bgr321ToY_c;
2255  break;
2256  case AV_PIX_FMT_BGR32:
2257  *lumToYV12 = rgb32ToY_c;
2258  break;
2259  case AV_PIX_FMT_BGR32_1:
2260  *lumToYV12 = rgb321ToY_c;
2261  break;
2262  case AV_PIX_FMT_RGB48BE:
2263  *lumToYV12 = rgb48BEToY_c;
2264  break;
2265  case AV_PIX_FMT_RGB48LE:
2266  *lumToYV12 = rgb48LEToY_c;
2267  break;
2268  case AV_PIX_FMT_BGR48BE:
2269  *lumToYV12 = bgr48BEToY_c;
2270  break;
2271  case AV_PIX_FMT_BGR48LE:
2272  *lumToYV12 = bgr48LEToY_c;
2273  break;
2274  case AV_PIX_FMT_RGBA64BE:
2275  *lumToYV12 = rgb64BEToY_c;
2276  break;
2277  case AV_PIX_FMT_RGBA64LE:
2278  *lumToYV12 = rgb64LEToY_c;
2279  break;
2280  case AV_PIX_FMT_BGRA64BE:
2281  *lumToYV12 = bgr64BEToY_c;
2282  break;
2283  case AV_PIX_FMT_BGRA64LE:
2284  *lumToYV12 = bgr64LEToY_c;
2285  break;
2286  case AV_PIX_FMT_P010LE:
2287  case AV_PIX_FMT_P210LE:
2288  case AV_PIX_FMT_P410LE:
2289  *lumToYV12 = p010LEToY_c;
2290  break;
2291  case AV_PIX_FMT_P010BE:
2292  case AV_PIX_FMT_P210BE:
2293  case AV_PIX_FMT_P410BE:
2294  *lumToYV12 = p010BEToY_c;
2295  break;
2296  case AV_PIX_FMT_P012LE:
2297  case AV_PIX_FMT_P212LE:
2298  case AV_PIX_FMT_P412LE:
2299  *lumToYV12 = p012LEToY_c;
2300  break;
2301  case AV_PIX_FMT_P012BE:
2302  case AV_PIX_FMT_P212BE:
2303  case AV_PIX_FMT_P412BE:
2304  *lumToYV12 = p012BEToY_c;
2305  break;
2306  case AV_PIX_FMT_GRAYF32LE:
2307  *lumToYV12 = grayf32leToY16_c;
2308  break;
2309  case AV_PIX_FMT_GRAYF32BE:
2310  *lumToYV12 = grayf32beToY16_c;
2311  break;
2312  case AV_PIX_FMT_Y210LE:
2313  *lumToYV12 = y210le_Y_c;
2314  break;
2315  case AV_PIX_FMT_Y212LE:
2316  *lumToYV12 = y212le_Y_c;
2317  break;
2318  case AV_PIX_FMT_Y216LE:
2319  *lumToYV12 = y216le_Y_c;
2320  break;
2321  case AV_PIX_FMT_X2RGB10LE:
2322  *lumToYV12 = rgb30leToY_c;
2323  break;
2324  case AV_PIX_FMT_X2BGR10LE:
2325  *lumToYV12 = bgr30leToY_c;
2326  break;
2327  case AV_PIX_FMT_RGBAF16BE:
2328  *lumToYV12 = rgbaf16beToY_c;
2329  break;
2330  case AV_PIX_FMT_RGBAF16LE:
2331  *lumToYV12 = rgbaf16leToY_c;
2332  break;
2333  case AV_PIX_FMT_RGBF16BE:
2334  *lumToYV12 = rgbf16beToY_c;
2335  break;
2336  case AV_PIX_FMT_RGBF16LE:
2337  *lumToYV12 = rgbf16leToY_c;
2338  break;
2339  case AV_PIX_FMT_RGBF32LE:
2340  *lumToYV12 = rgbf32le_to_y_c;
2341  break;
2342  case AV_PIX_FMT_RGBF32BE:
2343  *lumToYV12 = rgbf32be_to_y_c;
2344  break;
2345  }
2346  if (c->needAlpha) {
2347  if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
2348  if (HAVE_BIGENDIAN == !isBE(srcFormat) && !*readAlpPlanar)
2349  *alpToYV12 = bswap16Y_c;
2350  }
2351  switch (srcFormat) {
2352  case AV_PIX_FMT_BGRA64LE:
2353  case AV_PIX_FMT_RGBA64LE: *alpToYV12 = rgba64leToA_c; break;
2354  case AV_PIX_FMT_BGRA64BE:
2355  case AV_PIX_FMT_RGBA64BE: *alpToYV12 = rgba64beToA_c; break;
2356  case AV_PIX_FMT_BGRA:
2357  case AV_PIX_FMT_RGBA:
2358  *alpToYV12 = rgbaToA_c;
2359  break;
2360  case AV_PIX_FMT_ABGR:
2361  case AV_PIX_FMT_ARGB:
2362  *alpToYV12 = abgrToA_c;
2363  break;
2364  case AV_PIX_FMT_RGBAF16BE:
2365  *alpToYV12 = rgbaf16beToA_c;
2366  break;
2367  case AV_PIX_FMT_RGBAF16LE:
2368  *alpToYV12 = rgbaf16leToA_c;
2369  break;
2370  case AV_PIX_FMT_YA8:
2371  *alpToYV12 = uyvyToY_c;
2372  break;
2373  case AV_PIX_FMT_YA16LE:
2374  *alpToYV12 = read_ya16le_alpha_c;
2375  break;
2376  case AV_PIX_FMT_YA16BE:
2377  *alpToYV12 = read_ya16be_alpha_c;
2378  break;
2379  case AV_PIX_FMT_VUYA:
2380  case AV_PIX_FMT_UYVA:
2381  *alpToYV12 = read_vuya_A_c;
2382  break;
2383  case AV_PIX_FMT_AYUV:
2384  *alpToYV12 = read_ayuv_A_c;
2385  break;
2386  case AV_PIX_FMT_AYUV64LE:
2387  *alpToYV12 = read_ayuv64le_A_c;
2388  break;
2389  case AV_PIX_FMT_AYUV64BE:
2390  *alpToYV12 = read_ayuv64be_A_c;
2391  break;
2392  case AV_PIX_FMT_PAL8 :
2393  *alpToYV12 = palToA_c;
2394  break;
2395  }
2396  }
2397 }
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
_dst
uint8_t * _dst
Definition: dsp.h:52
read_ayuv64be_Y_c
static void read_ayuv64be_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:669
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:829
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:637
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:1001
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
read_v30xle_Y_c
static void read_v30xle_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:809
read_ayuv64be_A_c
static void read_ayuv64be_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:721
RGB64FUNCS
#define RGB64FUNCS(pattern, endianness, base_fmt)
Definition: input.c:124
AV_PIX_FMT_BGR32
#define AV_PIX_FMT_BGR32
Definition: pixfmt.h:477
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:251
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:1163
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
vyuToY_c
static void vyuToY_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:791
ayuv64be_UV_c
static av_always_inline void ayuv64be_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width, int u_offset, int v_offset)
Definition: input.c:687
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:645
AV_PIX_FMT_RGBF16LE
@ AV_PIX_FMT_RGBF16LE
IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., little-endian.
Definition: pixfmt.h:452
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:1092
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:1393
rgbf32_to_uv_c
static av_always_inline void rgbf32_to_uv_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused1, const uint8_t *_src, const uint8_t *unused2, int width, int is_be, int32_t *rgb2yuv)
Definition: input.c:1234
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:476
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:473
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
b
#define b
Definition: input.c:41
GV_IDX
#define GV_IDX
Definition: swscale_internal.h:477
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:69
BV_IDX
#define BV_IDX
Definition: swscale_internal.h:478
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:476
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
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:1198
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
rgbf16ToUV_endian
static av_always_inline void rgbf16ToUV_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:1453
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:1217
read_xv36be_Y_c
static void read_xv36be_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:867
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:838
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
_src
uint8_t ptrdiff_t const uint8_t * _src
Definition: dsp.h:52
AV_PIX_FMT_AYUV64LE
@ AV_PIX_FMT_AYUV64LE
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
Definition: pixfmt.h:302
AV_PIX_FMT_YUV444P16LE
@ AV_PIX_FMT_YUV444P16LE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:132
AV_PIX_FMT_AYUV64BE
@ AV_PIX_FMT_AYUV64BE
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
Definition: pixfmt.h:303
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:729
rgb
Definition: rpzaenc.c:60
input_pixel
#define input_pixel(pos)
Definition: input.c:251
ff_sws_init_input_funcs
void ff_sws_init_input_funcs(SwsInternal *c, planar1_YV12_fn *lumToYV12, planar1_YV12_fn *alpToYV12, planar2_YV12_fn *chrToYV12, planarX_YV12_fn *readLumPlanar, planarX_YV12_fn *readAlpPlanar, planarX2_YV12_fn *readChrPlanar)
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:743
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
rgbf32_funcs_endian
#define rgbf32_funcs_endian(endian_name, endian)
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:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), VUYAVUYA...
Definition: pixfmt.h:401
AV_PIX_FMT_YUV444P12LE
@ AV_PIX_FMT_YUV444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:276
AV_PIX_FMT_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:172
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:1187
AV_PIX_FMT_GBRAP16BE
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
Definition: pixfmt.h:213
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:616
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:128
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:661
rgbf32_to_y_c
static av_always_inline void rgbf32_to_y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width, int is_be, int32_t *rgb2yuv)
Definition: input.c:1255
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:1424
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:931
GY_IDX
#define GY_IDX
Definition: swscale_internal.h:471
AV_PIX_FMT_BGR32_1
#define AV_PIX_FMT_BGR32_1
Definition: pixfmt.h:478
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:958
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:1274
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:848
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:492
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_Y216LE
@ AV_PIX_FMT_Y216LE
packed YUV 4:2:2 like YUYV422, 32bpp, little-endian
Definition: pixfmt.h:461
AV_PIX_FMT_GBRAPF32BE
@ AV_PIX_FMT_GBRAPF32BE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian.
Definition: pixfmt.h:343
AV_PIX_FMT_GBRAP12BE
@ AV_PIX_FMT_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
Definition: pixfmt.h:310
AV_PIX_FMT_P012LE
@ AV_PIX_FMT_P012LE
like NV12, with 12bpp per component, data in the high bits, zeros in the low bits,...
Definition: pixfmt.h:408
AV_PIX_FMT_BGR48
#define AV_PIX_FMT_BGR48
Definition: pixfmt.h:493
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:653
rgbf16ToUV_half_endian
static av_always_inline void rgbf16ToUV_half_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:1433
planarX_YV12_fn
void(* planarX_YV12_fn)(uint8_t *dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opaque)
Unscaled conversion of arbitrary planar data (e.g.
Definition: swscale_internal.h:319
rgb9plus_planar_transparency_funcs
#define rgb9plus_planar_transparency_funcs(nbits)
Definition: input.c:1301
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:1106
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
ayuv64_UV_funcs
#define ayuv64_UV_funcs(pixfmt, U, V)
Definition: input.c:697
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:917
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:729
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:1133
planarX2_YV12_fn
void(* planarX2_YV12_fn)(uint8_t *dst, uint8_t *dst2, const uint8_t *src[4], int width, int32_t *rgb2yuv, void *opaque)
Definition: swscale_internal.h:322
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:122
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
read_v30xle_UV_c
static void read_v30xle_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:818
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_ayuv_Y_c
static void read_ayuv_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:765
planar2_YV12_fn
void(* planar2_YV12_fn)(uint8_t *dst, uint8_t *dst2, const uint8_t *src, const uint8_t *src2, const uint8_t *src3, int width, uint32_t *pal, void *opaque)
Unscaled conversion of chroma plane to YV12 for horizontal scaler.
Definition: swscale_internal.h:311
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:564
isBE
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
Definition: swscale_internal.h:750
f
f
Definition: af_crystalizer.c:122
AV_PIX_FMT_RGBF32BE
@ AV_PIX_FMT_RGBF32BE
IEEE-754 single precision packed RGB 32:32:32, 96bpp, RGBRGB..., big-endian.
Definition: pixfmt.h:420
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:1150
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:629
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:470
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
rgbf16ToY_endian
static av_always_inline void rgbf16ToY_endian(uint16_t *dst, const uint16_t *src, int is_be, int width, int32_t *rgb2yuv, Half2FloatTables *h2f_tbl)
Definition: input.c:1470
rgbaf16_funcs_endian
#define rgbaf16_funcs_endian(endian_name, endian)
Definition: input.c:1486
shift
static int shift(int a, int b)
Definition: bonk.c:261
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
AV_PIX_FMT_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:1315
AV_PIX_FMT_XV36BE
@ AV_PIX_FMT_XV36BE
packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, big-endian,...
Definition: pixfmt.h:417
AV_PIX_FMT_YUV422P14BE
@ AV_PIX_FMT_YUV422P14BE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
Definition: pixfmt.h:273
AV_PIX_FMT_YA16BE
@ AV_PIX_FMT_YA16BE
16 bits gray, 16 bits alpha (big-endian)
Definition: pixfmt.h:209
vyuToUV_c
static void vyuToUV_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:799
AV_PIX_FMT_RGB48
#define AV_PIX_FMT_RGB48
Definition: pixfmt.h:488
AV_PIX_FMT_GRAY12LE
@ AV_PIX_FMT_GRAY12LE
Y , 12bpp, little-endian.
Definition: pixfmt.h:319
planar1_YV12_fn
void(* planar1_YV12_fn)(uint8_t *dst, const uint8_t *src, const uint8_t *src2, const uint8_t *src3, int width, uint32_t *pal, void *opaque)
Unscaled conversion of luma/alpha plane to YV12 for horizontal scaler.
Definition: swscale_internal.h:304
AV_PIX_FMT_BGR555
#define AV_PIX_FMT_BGR555
Definition: pixfmt.h:495
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:1073
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:475
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
read_ayuv_UV_c
static void read_ayuv_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:755
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:1054
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:907
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:472
AV_PIX_FMT_AYUV
@ AV_PIX_FMT_AYUV
packed AYUV 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), AYUVAYUV...
Definition: pixfmt.h:442
AV_PIX_FMT_ARGB
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:99
AV_PIX_FMT_BGRA64LE
@ AV_PIX_FMT_BGRA64LE
packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:205
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_UYVA
@ AV_PIX_FMT_UYVA
packed UYVA 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), UYVAUYVA...
Definition: pixfmt.h:444
AV_PIX_FMT_YUVA444P12LE
@ AV_PIX_FMT_YUVA444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian
Definition: pixfmt.h:369
AV_PIX_FMT_YUVA422P9BE
@ AV_PIX_FMT_YUVA422P9BE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
Definition: pixfmt.h:177
AV_PIX_FMT_BGRA64
#define AV_PIX_FMT_BGRA64
Definition: pixfmt.h:497
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:256
ayuv64le_UV_c
static av_always_inline void ayuv64le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, int width, int u_offset, int v_offset)
Definition: input.c:677
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:924
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:496
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:857
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:490
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:563
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:747
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:494
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:489
rdpx
#define rdpx(src)
Definition: input.c:1185
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
SwsInternal
Definition: swscale_internal.h:330
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_RGBF16BE
@ AV_PIX_FMT_RGBF16BE
IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., big-endian.
Definition: pixfmt.h:451
AV_PIX_FMT_GBRP12BE
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
Definition: pixfmt.h:279
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:88
AV_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
read_ayuv_A_c
static void read_ayuv_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:773
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_XV48LE
@ AV_PIX_FMT_XV48LE
packed XVYU 4:4:4, 64bpp, little-endian, variant of Y416 where alpha channel is left undefined
Definition: pixfmt.h:464
AV_PIX_FMT_YUV444P9LE
@ AV_PIX_FMT_YUV444P9LE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
Definition: pixfmt.h:160
AV_PIX_FMT_P216LE
@ AV_PIX_FMT_P216LE
interleaved chroma YUV 4:2:2, 32bpp, little-endian
Definition: pixfmt.h:396
AV_PIX_FMT_RGBF32LE
@ AV_PIX_FMT_RGBF32LE
IEEE-754 single precision packed RGB 32:32:32, 96bpp, RGBRGB..., little-endian.
Definition: pixfmt.h:421
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:896
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_V30XLE
@ AV_PIX_FMT_V30XLE
packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), little-endian
Definition: pixfmt.h:449
AV_PIX_FMT_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
AV_PIX_FMT_XV48BE
@ AV_PIX_FMT_XV48BE
packed XVYU 4:4:4, 64bpp, big-endian, variant of Y416 where alpha channel is left undefined
Definition: pixfmt.h:463
BU_IDX
#define BU_IDX
Definition: swscale_internal.h:475
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:1410
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:888
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
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:1114
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:1020
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:474
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
width
#define width
Definition: dsp.h:85
AV_PIX_FMT_VUYX
@ AV_PIX_FMT_VUYX
packed VUYX 4:4:4:4, 32bpp, Variant of VUYA where alpha channel is left undefined
Definition: pixfmt.h:406
AV_PIX_FMT_VYU444
@ AV_PIX_FMT_VYU444
packed VYU 4:4:4, 24bpp (1 Cr & Cb sample per 1x1 Y), VYUVYU...
Definition: pixfmt.h:446
av_bswap16
#define av_bswap16
Definition: bswap.h:28
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
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
read_xv36be_UV_c
static void read_xv36be_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:876
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:739
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:1039
read_uyva_UV_c
static void read_uyva_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:781
src
#define src
Definition: vp8dsp.c:248
AV_PIX_FMT_GBRAP14LE
@ AV_PIX_FMT_GBRAP14LE
planar GBR 4:4:4:4 56bpp, little-endian
Definition: pixfmt.h:433
AV_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:491
AV_WN16
#define AV_WN16(p, v)
Definition: intreadwrite.h:368