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 #include <string.h>
25 
26 #include "libavutil/avutil.h"
27 #include "libavutil/bswap.h"
28 #include "libavutil/intreadwrite.h"
29 #include "libavutil/mathematics.h"
30 #include "libavutil/pixdesc.h"
31 #include "libavutil/avassert.h"
32 #include "config.h"
33 #include "rgb2rgb.h"
34 #include "swscale.h"
35 #include "swscale_internal.h"
36 
37 #define input_pixel(pos) (isBE(origin) ? AV_RB16(pos) : AV_RL16(pos))
38 
39 #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)
40 #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)
41 
42 static av_always_inline void
43 rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
44  enum AVPixelFormat origin, int32_t *rgb2yuv)
45 {
46  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
47  int i;
48  for (i = 0; i < width; i++) {
49  unsigned int r_b = input_pixel(&src[i*4+0]);
50  unsigned int g = input_pixel(&src[i*4+1]);
51  unsigned int b_r = input_pixel(&src[i*4+2]);
52 
53  dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
54  }
55 }
56 
57 static av_always_inline void
58 rgb64ToUV_c_template(uint16_t *dstU, uint16_t *dstV,
59  const uint16_t *src1, const uint16_t *src2,
60  int width, enum AVPixelFormat origin, int32_t *rgb2yuv)
61 {
62  int i;
63  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
64  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
66  for (i = 0; i < width; i++) {
67  int r_b = input_pixel(&src1[i*4+0]);
68  int g = input_pixel(&src1[i*4+1]);
69  int b_r = input_pixel(&src1[i*4+2]);
70 
71  dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
72  dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
73  }
74 }
75 
76 static av_always_inline void
77 rgb64ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV,
78  const uint16_t *src1, const uint16_t *src2,
79  int width, enum AVPixelFormat origin, int32_t *rgb2yuv)
80 {
81  int i;
82  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
83  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
85  for (i = 0; i < width; i++) {
86  int r_b = (input_pixel(&src1[8 * i + 0]) + input_pixel(&src1[8 * i + 4]) + 1) >> 1;
87  int g = (input_pixel(&src1[8 * i + 1]) + input_pixel(&src1[8 * i + 5]) + 1) >> 1;
88  int b_r = (input_pixel(&src1[8 * i + 2]) + input_pixel(&src1[8 * i + 6]) + 1) >> 1;
89 
90  dstU[i]= (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
91  dstV[i]= (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
92  }
93 }
94 
95 #define rgb64funcs(pattern, BE_LE, origin) \
96 static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, const uint8_t *unused1,\
97  int width, uint32_t *rgb2yuv) \
98 { \
99  const uint16_t *src = (const uint16_t *) _src; \
100  uint16_t *dst = (uint16_t *) _dst; \
101  rgb64ToY_c_template(dst, src, width, origin, rgb2yuv); \
102 } \
103  \
104 static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
105  const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
106  int width, uint32_t *rgb2yuv) \
107 { \
108  const uint16_t *src1 = (const uint16_t *) _src1, \
109  *src2 = (const uint16_t *) _src2; \
110  uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
111  rgb64ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv); \
112 } \
113  \
114 static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, \
115  const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
116  int width, uint32_t *rgb2yuv) \
117 { \
118  const uint16_t *src1 = (const uint16_t *) _src1, \
119  *src2 = (const uint16_t *) _src2; \
120  uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
121  rgb64ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv); \
122 }
123 
128 
129 static av_always_inline void rgb48ToY_c_template(uint16_t *dst,
130  const uint16_t *src, int width,
131  enum AVPixelFormat origin,
132  int32_t *rgb2yuv)
133 {
134  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
135  int i;
136  for (i = 0; i < width; i++) {
137  unsigned int r_b = input_pixel(&src[i * 3 + 0]);
138  unsigned int g = input_pixel(&src[i * 3 + 1]);
139  unsigned int b_r = input_pixel(&src[i * 3 + 2]);
140 
141  dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
142  }
143 }
144 
145 static av_always_inline void rgb48ToUV_c_template(uint16_t *dstU,
146  uint16_t *dstV,
147  const uint16_t *src1,
148  const uint16_t *src2,
149  int width,
150  enum AVPixelFormat origin,
151  int32_t *rgb2yuv)
152 {
153  int i;
154  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
155  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
156  av_assert1(src1 == src2);
157  for (i = 0; i < width; i++) {
158  int r_b = input_pixel(&src1[i * 3 + 0]);
159  int g = input_pixel(&src1[i * 3 + 1]);
160  int b_r = input_pixel(&src1[i * 3 + 2]);
161 
162  dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
163  dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
164  }
165 }
166 
167 static av_always_inline void rgb48ToUV_half_c_template(uint16_t *dstU,
168  uint16_t *dstV,
169  const uint16_t *src1,
170  const uint16_t *src2,
171  int width,
172  enum AVPixelFormat origin,
173  int32_t *rgb2yuv)
174 {
175  int i;
176  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
177  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
178  av_assert1(src1 == src2);
179  for (i = 0; i < width; i++) {
180  int r_b = (input_pixel(&src1[6 * i + 0]) +
181  input_pixel(&src1[6 * i + 3]) + 1) >> 1;
182  int g = (input_pixel(&src1[6 * i + 1]) +
183  input_pixel(&src1[6 * i + 4]) + 1) >> 1;
184  int b_r = (input_pixel(&src1[6 * i + 2]) +
185  input_pixel(&src1[6 * i + 5]) + 1) >> 1;
186 
187  dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
188  dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
189  }
190 }
191 
192 #undef r
193 #undef b
194 #undef input_pixel
195 
196 #define rgb48funcs(pattern, BE_LE, origin) \
197 static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst, \
198  const uint8_t *_src, \
199  const uint8_t *unused0, const uint8_t *unused1,\
200  int width, \
201  uint32_t *rgb2yuv) \
202 { \
203  const uint16_t *src = (const uint16_t *)_src; \
204  uint16_t *dst = (uint16_t *)_dst; \
205  rgb48ToY_c_template(dst, src, width, origin, rgb2yuv); \
206 } \
207  \
208 static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU, \
209  uint8_t *_dstV, \
210  const uint8_t *unused0, \
211  const uint8_t *_src1, \
212  const uint8_t *_src2, \
213  int width, \
214  uint32_t *rgb2yuv) \
215 { \
216  const uint16_t *src1 = (const uint16_t *)_src1, \
217  *src2 = (const uint16_t *)_src2; \
218  uint16_t *dstU = (uint16_t *)_dstU, \
219  *dstV = (uint16_t *)_dstV; \
220  rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv); \
221 } \
222  \
223 static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, \
224  uint8_t *_dstV, \
225  const uint8_t *unused0, \
226  const uint8_t *_src1, \
227  const uint8_t *_src2, \
228  int width, \
229  uint32_t *rgb2yuv) \
230 { \
231  const uint16_t *src1 = (const uint16_t *)_src1, \
232  *src2 = (const uint16_t *)_src2; \
233  uint16_t *dstU = (uint16_t *)_dstU, \
234  *dstV = (uint16_t *)_dstV; \
235  rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv); \
236 }
237 
242 
243 #define input_pixel(i) ((origin == AV_PIX_FMT_RGBA || \
244  origin == AV_PIX_FMT_BGRA || \
245  origin == AV_PIX_FMT_ARGB || \
246  origin == AV_PIX_FMT_ABGR) \
247  ? AV_RN32A(&src[(i) * 4]) \
248  : ((origin == AV_PIX_FMT_X2RGB10LE || \
249  origin == AV_PIX_FMT_X2BGR10LE) \
250  ? AV_RL32(&src[(i) * 4]) \
251  : (isBE(origin) ? AV_RB16(&src[(i) * 2]) \
252  : AV_RL16(&src[(i) * 2]))))
253 
254 static av_always_inline void rgb16_32ToY_c_template(int16_t *dst,
255  const uint8_t *src,
256  int width,
257  enum AVPixelFormat origin,
258  int shr, int shg,
259  int shb, int shp,
260  int maskr, int maskg,
261  int maskb, int rsh,
262  int gsh, int bsh, int S,
263  int32_t *rgb2yuv)
264 {
265  const int ry = rgb2yuv[RY_IDX]<<rsh, gy = rgb2yuv[GY_IDX]<<gsh, by = rgb2yuv[BY_IDX]<<bsh;
266  const unsigned rnd = (32<<((S)-1)) + (1<<(S-7));
267  int i;
268 
269  for (i = 0; i < width; i++) {
270  int px = input_pixel(i) >> shp;
271  int b = (px & maskb) >> shb;
272  int g = (px & maskg) >> shg;
273  int r = (px & maskr) >> shr;
274 
275  dst[i] = (ry * r + gy * g + by * b + rnd) >> ((S)-6);
276  }
277 }
278 
279 static av_always_inline void rgb16_32ToUV_c_template(int16_t *dstU,
280  int16_t *dstV,
281  const uint8_t *src,
282  int width,
283  enum AVPixelFormat origin,
284  int shr, int shg,
285  int shb, int shp,
286  int maskr, int maskg,
287  int maskb, int rsh,
288  int gsh, int bsh, int S,
289  int32_t *rgb2yuv)
290 {
291  const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
292  rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh);
293  const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
294  int i;
295 
296  for (i = 0; i < width; i++) {
297  int px = input_pixel(i) >> shp;
298  int b = (px & maskb) >> shb;
299  int g = (px & maskg) >> shg;
300  int r = (px & maskr) >> shr;
301 
302  dstU[i] = (ru * r + gu * g + bu * b + rnd) >> ((S)-6);
303  dstV[i] = (rv * r + gv * g + bv * b + rnd) >> ((S)-6);
304  }
305 }
306 
308  int16_t *dstV,
309  const uint8_t *src,
310  int width,
311  enum AVPixelFormat origin,
312  int shr, int shg,
313  int shb, int shp,
314  int maskr, int maskg,
315  int maskb, int rsh,
316  int gsh, int bsh, int S,
317  int32_t *rgb2yuv)
318 {
319  const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
320  rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh),
321  maskgx = ~(maskr | maskb);
322  const unsigned rnd = (256U<<(S)) + (1<<(S-6));
323  int i;
324 
325  maskr |= maskr << 1;
326  maskb |= maskb << 1;
327  maskg |= maskg << 1;
328  for (i = 0; i < width; i++) {
329  unsigned px0 = input_pixel(2 * i + 0) >> shp;
330  unsigned px1 = input_pixel(2 * i + 1) >> shp;
331  int b, r, g = (px0 & maskgx) + (px1 & maskgx);
332  int rb = px0 + px1 - g;
333 
334  b = (rb & maskb) >> shb;
335  if (shp ||
336  origin == AV_PIX_FMT_BGR565LE || origin == AV_PIX_FMT_BGR565BE ||
337  origin == AV_PIX_FMT_RGB565LE || origin == AV_PIX_FMT_RGB565BE) {
338  g >>= shg;
339  } else {
340  g = (g & maskg) >> shg;
341  }
342  r = (rb & maskr) >> shr;
343 
344  dstU[i] = (ru * r + gu * g + bu * b + (unsigned)rnd) >> ((S)-6+1);
345  dstV[i] = (rv * r + gv * g + bv * b + (unsigned)rnd) >> ((S)-6+1);
346  }
347 }
348 
349 #undef input_pixel
350 
351 #define rgb16_32_wrapper(fmt, name, shr, shg, shb, shp, maskr, \
352  maskg, maskb, rsh, gsh, bsh, S) \
353 static void name ## ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, \
354  int width, uint32_t *tab) \
355 { \
356  rgb16_32ToY_c_template((int16_t*)dst, src, width, fmt, shr, shg, shb, shp, \
357  maskr, maskg, maskb, rsh, gsh, bsh, S, tab); \
358 } \
359  \
360 static void name ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \
361  const uint8_t *unused0, const uint8_t *src, const uint8_t *dummy, \
362  int width, uint32_t *tab) \
363 { \
364  rgb16_32ToUV_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
365  shr, shg, shb, shp, \
366  maskr, maskg, maskb, rsh, gsh, bsh, S, tab);\
367 } \
368  \
369 static void name ## ToUV_half_c(uint8_t *dstU, uint8_t *dstV, \
370  const uint8_t *unused0, const uint8_t *src, \
371  const uint8_t *dummy, \
372  int width, uint32_t *tab) \
373 { \
374  rgb16_32ToUV_half_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
375  shr, shg, shb, shp, \
376  maskr, maskg, maskb, \
377  rsh, gsh, bsh, S, tab); \
378 }
379 
380 rgb16_32_wrapper(AV_PIX_FMT_BGR32, bgr32, 16, 0, 0, 0, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
381 rgb16_32_wrapper(AV_PIX_FMT_BGR32_1, bgr321, 16, 0, 0, 8, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
382 rgb16_32_wrapper(AV_PIX_FMT_RGB32, rgb32, 0, 0, 16, 0, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
383 rgb16_32_wrapper(AV_PIX_FMT_RGB32_1, rgb321, 0, 0, 16, 8, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
384 rgb16_32_wrapper(AV_PIX_FMT_BGR565LE, bgr16le, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
385 rgb16_32_wrapper(AV_PIX_FMT_BGR555LE, bgr15le, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
386 rgb16_32_wrapper(AV_PIX_FMT_BGR444LE, bgr12le, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
387 rgb16_32_wrapper(AV_PIX_FMT_RGB565LE, rgb16le, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
388 rgb16_32_wrapper(AV_PIX_FMT_RGB555LE, rgb15le, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
389 rgb16_32_wrapper(AV_PIX_FMT_RGB444LE, rgb12le, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
390 rgb16_32_wrapper(AV_PIX_FMT_BGR565BE, bgr16be, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
391 rgb16_32_wrapper(AV_PIX_FMT_BGR555BE, bgr15be, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
392 rgb16_32_wrapper(AV_PIX_FMT_BGR444BE, bgr12be, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
393 rgb16_32_wrapper(AV_PIX_FMT_RGB565BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
394 rgb16_32_wrapper(AV_PIX_FMT_RGB555BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
395 rgb16_32_wrapper(AV_PIX_FMT_RGB444BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
396 rgb16_32_wrapper(AV_PIX_FMT_X2RGB10LE, rgb30le, 16, 6, 0, 0, 0x3FF00000, 0xFFC00, 0x3FF, 0, 0, 4, RGB2YUV_SHIFT + 6)
397 rgb16_32_wrapper(AV_PIX_FMT_X2BGR10LE, bgr30le, 0, 6, 16, 0, 0x3FF, 0xFFC00, 0x3FF00000, 4, 0, 0, RGB2YUV_SHIFT + 6)
398 
399 static void gbr24pToUV_half_c(uint8_t *_dstU, uint8_t *_dstV,
400  const uint8_t *gsrc, const uint8_t *bsrc, const uint8_t *rsrc,
401  int width, uint32_t *rgb2yuv)
402 {
403  uint16_t *dstU = (uint16_t *)_dstU;
404  uint16_t *dstV = (uint16_t *)_dstV;
405  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
406  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
407 
408  int i;
409  for (i = 0; i < width; i++) {
410  unsigned int g = gsrc[2*i] + gsrc[2*i+1];
411  unsigned int b = bsrc[2*i] + bsrc[2*i+1];
412  unsigned int r = rsrc[2*i] + rsrc[2*i+1];
413 
414  dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
415  dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
416  }
417 }
418 
419 static void rgba64leToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
420  const uint8_t *unused2, int width, uint32_t *unused)
421 {
422  int16_t *dst = (int16_t *)_dst;
423  const uint16_t *src = (const uint16_t *)_src;
424  int i;
425  for (i = 0; i < width; i++)
426  dst[i] = AV_RL16(src + 4 * i + 3);
427 }
428 
429 static void rgba64beToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
430  const uint8_t *unused2, int width, uint32_t *unused)
431 {
432  int16_t *dst = (int16_t *)_dst;
433  const uint16_t *src = (const uint16_t *)_src;
434  int i;
435  for (i = 0; i < width; i++)
436  dst[i] = AV_RB16(src + 4 * i + 3);
437 }
438 
439 static void abgrToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
440 {
441  int16_t *dst = (int16_t *)_dst;
442  int i;
443  for (i=0; i<width; i++) {
444  dst[i]= src[4*i]<<6 | src[4*i]>>2;
445  }
446 }
447 
448 static void rgbaToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
449 {
450  int16_t *dst = (int16_t *)_dst;
451  int i;
452  for (i=0; i<width; i++) {
453  dst[i]= src[4*i+3]<<6 | src[4*i+3]>>2;
454  }
455 }
456 
457 static void palToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *pal)
458 {
459  int16_t *dst = (int16_t *)_dst;
460  int i;
461  for (i=0; i<width; i++) {
462  int d= src[i];
463 
464  dst[i]= (pal[d] >> 24)<<6 | pal[d]>>26;
465  }
466 }
467 
468 static void palToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *pal)
469 {
470  int16_t *dst = (int16_t *)_dst;
471  int i;
472  for (i = 0; i < width; i++) {
473  int d = src[i];
474 
475  dst[i] = (pal[d] & 0xFF)<<6;
476  }
477 }
478 
479 static void palToUV_c(uint8_t *_dstU, uint8_t *_dstV,
480  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
481  int width, uint32_t *pal)
482 {
483  uint16_t *dstU = (uint16_t *)_dstU;
484  int16_t *dstV = (int16_t *)_dstV;
485  int i;
486  av_assert1(src1 == src2);
487  for (i = 0; i < width; i++) {
488  int p = pal[src1[i]];
489 
490  dstU[i] = (uint8_t)(p>> 8)<<6;
491  dstV[i] = (uint8_t)(p>>16)<<6;
492  }
493 }
494 
495 static void monowhite2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
496 {
497  int16_t *dst = (int16_t *)_dst;
498  int i, j;
499  width = (width + 7) >> 3;
500  for (i = 0; i < width; i++) {
501  int d = ~src[i];
502  for (j = 0; j < 8; j++)
503  dst[8*i+j]= ((d>>(7-j))&1) * 16383;
504  }
505  if(width&7){
506  int d= ~src[i];
507  for (j = 0; j < (width&7); j++)
508  dst[8*i+j]= ((d>>(7-j))&1) * 16383;
509  }
510 }
511 
512 static void monoblack2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
513 {
514  int16_t *dst = (int16_t *)_dst;
515  int i, j;
516  width = (width + 7) >> 3;
517  for (i = 0; i < width; i++) {
518  int d = src[i];
519  for (j = 0; j < 8; j++)
520  dst[8*i+j]= ((d>>(7-j))&1) * 16383;
521  }
522  if(width&7){
523  int d = src[i];
524  for (j = 0; j < (width&7); j++)
525  dst[8*i+j] = ((d>>(7-j))&1) * 16383;
526  }
527 }
528 
529 static void yuy2ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
530  uint32_t *unused)
531 {
532  int i;
533  for (i = 0; i < width; i++)
534  dst[i] = src[2 * i];
535 }
536 
537 static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
538  const uint8_t *src2, int width, uint32_t *unused)
539 {
540  int i;
541  for (i = 0; i < width; i++) {
542  dstU[i] = src1[4 * i + 1];
543  dstV[i] = src1[4 * i + 3];
544  }
545  av_assert1(src1 == src2);
546 }
547 
548 static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
549  const uint8_t *src2, int width, uint32_t *unused)
550 {
551  int i;
552  for (i = 0; i < width; i++) {
553  dstV[i] = src1[4 * i + 1];
554  dstU[i] = src1[4 * i + 3];
555  }
556  av_assert1(src1 == src2);
557 }
558 
559 static void y210le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
560  const uint8_t *unused1, int width, uint32_t *unused2)
561 {
562  int i;
563  for (i = 0; i < width; i++) {
564  AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> 6);
565  AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> 6);
566  }
567 }
568 
569 static void y210le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0,
570  const uint8_t *unused1, int width, uint32_t *unused2)
571 {
572  int i;
573  for (i = 0; i < width; i++)
574  AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> 6);
575 }
576 
577 static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width,
578  uint32_t *unused)
579 {
580  int i;
581  const uint16_t *src = (const uint16_t *)_src;
582  uint16_t *dst = (uint16_t *)_dst;
583  for (i = 0; i < width; i++)
584  dst[i] = av_bswap16(src[i]);
585 }
586 
587 static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *_src1,
588  const uint8_t *_src2, int width, uint32_t *unused)
589 {
590  int i;
591  const uint16_t *src1 = (const uint16_t *)_src1,
592  *src2 = (const uint16_t *)_src2;
593  uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
594  for (i = 0; i < width; i++) {
595  dstU[i] = av_bswap16(src1[i]);
596  dstV[i] = av_bswap16(src2[i]);
597  }
598 }
599 
600 static void read_ya16le_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
601  uint32_t *unused)
602 {
603  int i;
604  for (i = 0; i < width; i++)
605  AV_WN16(dst + i * 2, AV_RL16(src + i * 4));
606 }
607 
608 static void read_ya16le_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
609  uint32_t *unused)
610 {
611  int i;
612  for (i = 0; i < width; i++)
613  AV_WN16(dst + i * 2, AV_RL16(src + i * 4 + 2));
614 }
615 
616 static void read_ya16be_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
617  uint32_t *unused)
618 {
619  int i;
620  for (i = 0; i < width; i++)
621  AV_WN16(dst + i * 2, AV_RB16(src + i * 4));
622 }
623 
624 static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
625  uint32_t *unused)
626 {
627  int i;
628  for (i = 0; i < width; i++)
629  AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
630 }
631 
632 static void read_ayuv64le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
633  uint32_t *unused2)
634 {
635  int i;
636  for (i = 0; i < width; i++)
637  AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2));
638 }
639 
640 
641 static void read_ayuv64le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
642  const uint8_t *unused1, int width, uint32_t *unused2)
643 {
644  int i;
645  for (i = 0; i < width; i++) {
646  AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 4));
647  AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6));
648  }
649 }
650 
651 static void read_ayuv64le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
652  uint32_t *unused2)
653 {
654  int i;
655  for (i = 0; i < width; i++)
656  AV_WN16(dst + i * 2, AV_RL16(src + i * 8));
657 }
658 
659 /* This is almost identical to the previous, end exists only because
660  * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */
661 static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
662  uint32_t *unused)
663 {
664  int i;
665  for (i = 0; i < width; i++)
666  dst[i] = src[2 * i + 1];
667 }
668 
669 static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
670  const uint8_t *src2, int width, uint32_t *unused)
671 {
672  int i;
673  for (i = 0; i < width; i++) {
674  dstU[i] = src1[4 * i + 0];
675  dstV[i] = src1[4 * i + 2];
676  }
677  av_assert1(src1 == src2);
678 }
679 
680 static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,
681  const uint8_t *src, int width)
682 {
683  int i;
684  for (i = 0; i < width; i++) {
685  dst1[i] = src[2 * i + 0];
686  dst2[i] = src[2 * i + 1];
687  }
688 }
689 
690 static void nv12ToUV_c(uint8_t *dstU, uint8_t *dstV,
691  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
692  int width, uint32_t *unused)
693 {
694  nvXXtoUV_c(dstU, dstV, src1, width);
695 }
696 
697 static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
698  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
699  int width, uint32_t *unused)
700 {
701  nvXXtoUV_c(dstV, dstU, src1, width);
702 }
703 
704 static void p010LEToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1,
705  const uint8_t *unused2, int width, uint32_t *unused)
706 {
707  int i;
708  for (i = 0; i < width; i++) {
709  AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> 6);
710  }
711 }
712 
713 static void p010BEToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1,
714  const uint8_t *unused2, int width, uint32_t *unused)
715 {
716  int i;
717  for (i = 0; i < width; i++) {
718  AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> 6);
719  }
720 }
721 
722 static void p010LEToUV_c(uint8_t *dstU, uint8_t *dstV,
723  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
724  int width, uint32_t *unused)
725 {
726  int i;
727  for (i = 0; i < width; i++) {
728  AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0) >> 6);
729  AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2) >> 6);
730  }
731 }
732 
733 static void p010BEToUV_c(uint8_t *dstU, uint8_t *dstV,
734  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
735  int width, uint32_t *unused)
736 {
737  int i;
738  for (i = 0; i < width; i++) {
739  AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0) >> 6);
740  AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2) >> 6);
741  }
742 }
743 
744 static void p016LEToUV_c(uint8_t *dstU, uint8_t *dstV,
745  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
746  int width, uint32_t *unused)
747 {
748  int i;
749  for (i = 0; i < width; i++) {
750  AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0));
751  AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2));
752  }
753 }
754 
755 static void p016BEToUV_c(uint8_t *dstU, uint8_t *dstV,
756  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
757  int width, uint32_t *unused)
758 {
759  int i;
760  for (i = 0; i < width; i++) {
761  AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0));
762  AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2));
763  }
764 }
765 
766 #define input_pixel(pos) (isBE(origin) ? AV_RB16(pos) : AV_RL16(pos))
767 
768 static void bgr24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,
769  int width, uint32_t *rgb2yuv)
770 {
771  int16_t *dst = (int16_t *)_dst;
772  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
773  int i;
774  for (i = 0; i < width; i++) {
775  int b = src[i * 3 + 0];
776  int g = src[i * 3 + 1];
777  int r = src[i * 3 + 2];
778 
779  dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
780  }
781 }
782 
783 static void bgr24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
784  const uint8_t *src2, int width, uint32_t *rgb2yuv)
785 {
786  int16_t *dstU = (int16_t *)_dstU;
787  int16_t *dstV = (int16_t *)_dstV;
788  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
789  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
790  int i;
791  for (i = 0; i < width; i++) {
792  int b = src1[3 * i + 0];
793  int g = src1[3 * i + 1];
794  int r = src1[3 * i + 2];
795 
796  dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
797  dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
798  }
799  av_assert1(src1 == src2);
800 }
801 
802 static void bgr24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
803  const uint8_t *src2, int width, uint32_t *rgb2yuv)
804 {
805  int16_t *dstU = (int16_t *)_dstU;
806  int16_t *dstV = (int16_t *)_dstV;
807  int i;
808  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
809  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
810  for (i = 0; i < width; i++) {
811  int b = src1[6 * i + 0] + src1[6 * i + 3];
812  int g = src1[6 * i + 1] + src1[6 * i + 4];
813  int r = src1[6 * i + 2] + src1[6 * i + 5];
814 
815  dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
816  dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
817  }
818  av_assert1(src1 == src2);
819 }
820 
821 static void rgb24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
822  uint32_t *rgb2yuv)
823 {
824  int16_t *dst = (int16_t *)_dst;
825  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
826  int i;
827  for (i = 0; i < width; i++) {
828  int r = src[i * 3 + 0];
829  int g = src[i * 3 + 1];
830  int b = src[i * 3 + 2];
831 
832  dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
833  }
834 }
835 
836 static void rgb24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
837  const uint8_t *src2, int width, uint32_t *rgb2yuv)
838 {
839  int16_t *dstU = (int16_t *)_dstU;
840  int16_t *dstV = (int16_t *)_dstV;
841  int i;
842  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
843  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
844  av_assert1(src1 == src2);
845  for (i = 0; i < width; i++) {
846  int r = src1[3 * i + 0];
847  int g = src1[3 * i + 1];
848  int b = src1[3 * i + 2];
849 
850  dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
851  dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
852  }
853 }
854 
855 static void rgb24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
856  const uint8_t *src2, int width, uint32_t *rgb2yuv)
857 {
858  int16_t *dstU = (int16_t *)_dstU;
859  int16_t *dstV = (int16_t *)_dstV;
860  int i;
861  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
862  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
863  av_assert1(src1 == src2);
864  for (i = 0; i < width; i++) {
865  int r = src1[6 * i + 0] + src1[6 * i + 3];
866  int g = src1[6 * i + 1] + src1[6 * i + 4];
867  int b = src1[6 * i + 2] + src1[6 * i + 5];
868 
869  dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
870  dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
871  }
872 }
873 
874 static void planar_rgb_to_y(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv)
875 {
876  uint16_t *dst = (uint16_t *)_dst;
877  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
878  int i;
879  for (i = 0; i < width; i++) {
880  int g = src[0][i];
881  int b = src[1][i];
882  int r = src[2][i];
883 
884  dst[i] = (ry*r + gy*g + by*b + (0x801<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
885  }
886 }
887 
888 static void planar_rgb_to_a(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *unused)
889 {
890  uint16_t *dst = (uint16_t *)_dst;
891  int i;
892  for (i = 0; i < width; i++)
893  dst[i] = src[3][i] << 6;
894 }
895 
896 static void planar_rgb_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4], int width, int32_t *rgb2yuv)
897 {
898  uint16_t *dstU = (uint16_t *)_dstU;
899  uint16_t *dstV = (uint16_t *)_dstV;
900  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
901  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
902  int i;
903  for (i = 0; i < width; i++) {
904  int g = src[0][i];
905  int b = src[1][i];
906  int r = src[2][i];
907 
908  dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
909  dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
910  }
911 }
912 
913 #define rdpx(src) \
914  (is_be ? AV_RB16(src) : AV_RL16(src))
915 static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_src[4],
916  int width, int bpc, int is_be, int32_t *rgb2yuv)
917 {
918  int i;
919  const uint16_t **src = (const uint16_t **)_src;
920  uint16_t *dst = (uint16_t *)_dst;
921  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
922  int shift = bpc < 16 ? bpc : 14;
923  for (i = 0; i < width; i++) {
924  int g = rdpx(src[0] + i);
925  int b = rdpx(src[1] + i);
926  int r = rdpx(src[2] + i);
927 
928  dst[i] = (ry*r + gy*g + by*b + (16 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
929  }
930 }
931 
932 static av_always_inline void planar_rgb16_to_a(uint8_t *_dst, const uint8_t *_src[4],
933  int width, int bpc, int is_be, int32_t *rgb2yuv)
934 {
935  int i;
936  const uint16_t **src = (const uint16_t **)_src;
937  uint16_t *dst = (uint16_t *)_dst;
938  int shift = bpc < 16 ? bpc : 14;
939 
940  for (i = 0; i < width; i++) {
941  dst[i] = rdpx(src[3] + i) << (14 - shift);
942  }
943 }
944 
945 static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV,
946  const uint8_t *_src[4], int width,
947  int bpc, int is_be, int32_t *rgb2yuv)
948 {
949  int i;
950  const uint16_t **src = (const uint16_t **)_src;
951  uint16_t *dstU = (uint16_t *)_dstU;
952  uint16_t *dstV = (uint16_t *)_dstV;
953  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
954  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
955  int shift = bpc < 16 ? bpc : 14;
956  for (i = 0; i < width; i++) {
957  int g = rdpx(src[0] + i);
958  int b = rdpx(src[1] + i);
959  int r = rdpx(src[2] + i);
960 
961  dstU[i] = (ru*r + gu*g + bu*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
962  dstV[i] = (rv*r + gv*g + bv*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
963  }
964 }
965 #undef rdpx
966 
967 #define rdpx(src) (is_be ? av_int2float(AV_RB32(src)): av_int2float(AV_RL32(src)))
968 
969 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)
970 {
971  int i;
972  const float **src = (const float **)_src;
973  uint16_t *dst = (uint16_t *)_dst;
974 
975  for (i = 0; i < width; i++) {
976  dst[i] = lrintf(av_clipf(65535.0f * rdpx(src[3] + i), 0.0f, 65535.0f));
977  }
978 }
979 
980 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)
981 {
982  int i;
983  const float **src = (const float **)_src;
984  uint16_t *dstU = (uint16_t *)_dstU;
985  uint16_t *dstV = (uint16_t *)_dstV;
986  int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu = rgb2yuv[BU_IDX];
987  int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv = rgb2yuv[BV_IDX];
988 
989  for (i = 0; i < width; i++) {
990  int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
991  int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
992  int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
993 
994  dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
995  dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
996  }
997 }
998 
999 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)
1000 {
1001  int i;
1002  const float **src = (const float **)_src;
1003  uint16_t *dst = (uint16_t *)_dst;
1004 
1005  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1006 
1007  for (i = 0; i < width; i++) {
1008  int g = lrintf(av_clipf(65535.0f * rdpx(src[0] + i), 0.0f, 65535.0f));
1009  int b = lrintf(av_clipf(65535.0f * rdpx(src[1] + i), 0.0f, 65535.0f));
1010  int r = lrintf(av_clipf(65535.0f * rdpx(src[2] + i), 0.0f, 65535.0f));
1011 
1012  dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1013  }
1014 }
1015 
1016 static av_always_inline void grayf32ToY16_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1017  const uint8_t *unused2, int width, int is_be, uint32_t *unused)
1018 {
1019  int i;
1020  const float *src = (const float *)_src;
1021  uint16_t *dst = (uint16_t *)_dst;
1022 
1023  for (i = 0; i < width; ++i){
1024  dst[i] = lrintf(av_clipf(65535.0f * rdpx(src + i), 0.0f, 65535.0f));
1025  }
1026 }
1027 
1028 #undef rdpx
1029 
1030 #define rgb9plus_planar_funcs_endian(nbits, endian_name, endian) \
1031 static void planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1032  int w, int32_t *rgb2yuv) \
1033 { \
1034  planar_rgb16_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1035 } \
1036 static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1037  const uint8_t *src[4], int w, int32_t *rgb2yuv) \
1038 { \
1039  planar_rgb16_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1040 } \
1041 
1042 #define rgb9plus_planar_transparency_funcs(nbits) \
1043 static void planar_rgb##nbits##le_to_a(uint8_t *dst, const uint8_t *src[4], \
1044  int w, int32_t *rgb2yuv) \
1045 { \
1046  planar_rgb16_to_a(dst, src, w, nbits, 0, rgb2yuv); \
1047 } \
1048 static void planar_rgb##nbits##be_to_a(uint8_t *dst, const uint8_t *src[4], \
1049  int w, int32_t *rgb2yuv) \
1050 { \
1051  planar_rgb16_to_a(dst, src, w, nbits, 1, rgb2yuv); \
1052 }
1053 
1054 #define rgb9plus_planar_funcs(nbits) \
1055  rgb9plus_planar_funcs_endian(nbits, le, 0) \
1056  rgb9plus_planar_funcs_endian(nbits, be, 1)
1057 
1063 
1067 
1068 #define rgbf32_planar_funcs_endian(endian_name, endian) \
1069 static void planar_rgbf32##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1070  int w, int32_t *rgb2yuv) \
1071 { \
1072  planar_rgbf32_to_y(dst, src, w, endian, rgb2yuv); \
1073 } \
1074 static void planar_rgbf32##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1075  const uint8_t *src[4], int w, int32_t *rgb2yuv) \
1076 { \
1077  planar_rgbf32_to_uv(dstU, dstV, src, w, endian, rgb2yuv); \
1078 } \
1079 static void planar_rgbf32##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1080  int w, int32_t *rgb2yuv) \
1081 { \
1082  planar_rgbf32_to_a(dst, src, w, endian, rgb2yuv); \
1083 } \
1084 static void grayf32##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, \
1085  const uint8_t *unused1, const uint8_t *unused2, \
1086  int width, uint32_t *unused) \
1087 { \
1088  grayf32ToY16_c(dst, src, unused1, unused2, width, endian, unused); \
1089 }
1090 
1093 
1095 {
1096  enum AVPixelFormat srcFormat = c->srcFormat;
1097 
1098  c->chrToYV12 = NULL;
1099  switch (srcFormat) {
1100  case AV_PIX_FMT_YUYV422:
1101  c->chrToYV12 = yuy2ToUV_c;
1102  break;
1103  case AV_PIX_FMT_YVYU422:
1104  c->chrToYV12 = yvy2ToUV_c;
1105  break;
1106  case AV_PIX_FMT_UYVY422:
1107  c->chrToYV12 = uyvyToUV_c;
1108  break;
1109  case AV_PIX_FMT_NV12:
1110  case AV_PIX_FMT_NV24:
1111  c->chrToYV12 = nv12ToUV_c;
1112  break;
1113  case AV_PIX_FMT_NV21:
1114  case AV_PIX_FMT_NV42:
1115  c->chrToYV12 = nv21ToUV_c;
1116  break;
1117  case AV_PIX_FMT_RGB8:
1118  case AV_PIX_FMT_BGR8:
1119  case AV_PIX_FMT_PAL8:
1120  case AV_PIX_FMT_BGR4_BYTE:
1121  case AV_PIX_FMT_RGB4_BYTE:
1122  c->chrToYV12 = palToUV_c;
1123  break;
1124  case AV_PIX_FMT_GBRP9LE:
1125  c->readChrPlanar = planar_rgb9le_to_uv;
1126  break;
1127  case AV_PIX_FMT_GBRAP10LE:
1128  case AV_PIX_FMT_GBRP10LE:
1129  c->readChrPlanar = planar_rgb10le_to_uv;
1130  break;
1131  case AV_PIX_FMT_GBRAP12LE:
1132  case AV_PIX_FMT_GBRP12LE:
1133  c->readChrPlanar = planar_rgb12le_to_uv;
1134  break;
1135  case AV_PIX_FMT_GBRP14LE:
1136  c->readChrPlanar = planar_rgb14le_to_uv;
1137  break;
1138  case AV_PIX_FMT_GBRAP16LE:
1139  case AV_PIX_FMT_GBRP16LE:
1140  c->readChrPlanar = planar_rgb16le_to_uv;
1141  break;
1142  case AV_PIX_FMT_GBRAPF32LE:
1143  case AV_PIX_FMT_GBRPF32LE:
1144  c->readChrPlanar = planar_rgbf32le_to_uv;
1145  break;
1146  case AV_PIX_FMT_GBRP9BE:
1147  c->readChrPlanar = planar_rgb9be_to_uv;
1148  break;
1149  case AV_PIX_FMT_GBRAP10BE:
1150  case AV_PIX_FMT_GBRP10BE:
1151  c->readChrPlanar = planar_rgb10be_to_uv;
1152  break;
1153  case AV_PIX_FMT_GBRAP12BE:
1154  case AV_PIX_FMT_GBRP12BE:
1155  c->readChrPlanar = planar_rgb12be_to_uv;
1156  break;
1157  case AV_PIX_FMT_GBRP14BE:
1158  c->readChrPlanar = planar_rgb14be_to_uv;
1159  break;
1160  case AV_PIX_FMT_GBRAP16BE:
1161  case AV_PIX_FMT_GBRP16BE:
1162  c->readChrPlanar = planar_rgb16be_to_uv;
1163  break;
1164  case AV_PIX_FMT_GBRAPF32BE:
1165  case AV_PIX_FMT_GBRPF32BE:
1166  c->readChrPlanar = planar_rgbf32be_to_uv;
1167  break;
1168  case AV_PIX_FMT_GBRAP:
1169  case AV_PIX_FMT_GBRP:
1170  c->readChrPlanar = planar_rgb_to_uv;
1171  break;
1172 #if HAVE_BIGENDIAN
1173  case AV_PIX_FMT_YUV420P9LE:
1174  case AV_PIX_FMT_YUV422P9LE:
1175  case AV_PIX_FMT_YUV444P9LE:
1190 
1202  c->chrToYV12 = bswap16UV_c;
1203  break;
1204 #else
1205  case AV_PIX_FMT_YUV420P9BE:
1206  case AV_PIX_FMT_YUV422P9BE:
1207  case AV_PIX_FMT_YUV444P9BE:
1222 
1234  c->chrToYV12 = bswap16UV_c;
1235  break;
1236 #endif
1237  case AV_PIX_FMT_AYUV64LE:
1238  c->chrToYV12 = read_ayuv64le_UV_c;
1239  break;
1240  case AV_PIX_FMT_P010LE:
1241  case AV_PIX_FMT_P210LE:
1242  case AV_PIX_FMT_P410LE:
1243  c->chrToYV12 = p010LEToUV_c;
1244  break;
1245  case AV_PIX_FMT_P010BE:
1246  case AV_PIX_FMT_P210BE:
1247  case AV_PIX_FMT_P410BE:
1248  c->chrToYV12 = p010BEToUV_c;
1249  break;
1250  case AV_PIX_FMT_P016LE:
1251  case AV_PIX_FMT_P216LE:
1252  case AV_PIX_FMT_P416LE:
1253  c->chrToYV12 = p016LEToUV_c;
1254  break;
1255  case AV_PIX_FMT_P016BE:
1256  case AV_PIX_FMT_P216BE:
1257  case AV_PIX_FMT_P416BE:
1258  c->chrToYV12 = p016BEToUV_c;
1259  break;
1260  case AV_PIX_FMT_Y210LE:
1261  c->chrToYV12 = y210le_UV_c;
1262  break;
1263  }
1264  if (c->chrSrcHSubSample) {
1265  switch (srcFormat) {
1266  case AV_PIX_FMT_RGBA64BE:
1267  c->chrToYV12 = rgb64BEToUV_half_c;
1268  break;
1269  case AV_PIX_FMT_RGBA64LE:
1270  c->chrToYV12 = rgb64LEToUV_half_c;
1271  break;
1272  case AV_PIX_FMT_BGRA64BE:
1273  c->chrToYV12 = bgr64BEToUV_half_c;
1274  break;
1275  case AV_PIX_FMT_BGRA64LE:
1276  c->chrToYV12 = bgr64LEToUV_half_c;
1277  break;
1278  case AV_PIX_FMT_RGB48BE:
1279  c->chrToYV12 = rgb48BEToUV_half_c;
1280  break;
1281  case AV_PIX_FMT_RGB48LE:
1282  c->chrToYV12 = rgb48LEToUV_half_c;
1283  break;
1284  case AV_PIX_FMT_BGR48BE:
1285  c->chrToYV12 = bgr48BEToUV_half_c;
1286  break;
1287  case AV_PIX_FMT_BGR48LE:
1288  c->chrToYV12 = bgr48LEToUV_half_c;
1289  break;
1290  case AV_PIX_FMT_RGB32:
1291  c->chrToYV12 = bgr32ToUV_half_c;
1292  break;
1293  case AV_PIX_FMT_RGB32_1:
1294  c->chrToYV12 = bgr321ToUV_half_c;
1295  break;
1296  case AV_PIX_FMT_BGR24:
1297  c->chrToYV12 = bgr24ToUV_half_c;
1298  break;
1299  case AV_PIX_FMT_BGR565LE:
1300  c->chrToYV12 = bgr16leToUV_half_c;
1301  break;
1302  case AV_PIX_FMT_BGR565BE:
1303  c->chrToYV12 = bgr16beToUV_half_c;
1304  break;
1305  case AV_PIX_FMT_BGR555LE:
1306  c->chrToYV12 = bgr15leToUV_half_c;
1307  break;
1308  case AV_PIX_FMT_BGR555BE:
1309  c->chrToYV12 = bgr15beToUV_half_c;
1310  break;
1311  case AV_PIX_FMT_GBRAP:
1312  case AV_PIX_FMT_GBRP:
1313  c->chrToYV12 = gbr24pToUV_half_c;
1314  break;
1315  case AV_PIX_FMT_BGR444LE:
1316  c->chrToYV12 = bgr12leToUV_half_c;
1317  break;
1318  case AV_PIX_FMT_BGR444BE:
1319  c->chrToYV12 = bgr12beToUV_half_c;
1320  break;
1321  case AV_PIX_FMT_BGR32:
1322  c->chrToYV12 = rgb32ToUV_half_c;
1323  break;
1324  case AV_PIX_FMT_BGR32_1:
1325  c->chrToYV12 = rgb321ToUV_half_c;
1326  break;
1327  case AV_PIX_FMT_RGB24:
1328  c->chrToYV12 = rgb24ToUV_half_c;
1329  break;
1330  case AV_PIX_FMT_RGB565LE:
1331  c->chrToYV12 = rgb16leToUV_half_c;
1332  break;
1333  case AV_PIX_FMT_RGB565BE:
1334  c->chrToYV12 = rgb16beToUV_half_c;
1335  break;
1336  case AV_PIX_FMT_RGB555LE:
1337  c->chrToYV12 = rgb15leToUV_half_c;
1338  break;
1339  case AV_PIX_FMT_RGB555BE:
1340  c->chrToYV12 = rgb15beToUV_half_c;
1341  break;
1342  case AV_PIX_FMT_RGB444LE:
1343  c->chrToYV12 = rgb12leToUV_half_c;
1344  break;
1345  case AV_PIX_FMT_RGB444BE:
1346  c->chrToYV12 = rgb12beToUV_half_c;
1347  break;
1348  case AV_PIX_FMT_X2RGB10LE:
1349  c->chrToYV12 = rgb30leToUV_half_c;
1350  break;
1351  case AV_PIX_FMT_X2BGR10LE:
1352  c->chrToYV12 = bgr30leToUV_half_c;
1353  break;
1354  }
1355  } else {
1356  switch (srcFormat) {
1357  case AV_PIX_FMT_RGBA64BE:
1358  c->chrToYV12 = rgb64BEToUV_c;
1359  break;
1360  case AV_PIX_FMT_RGBA64LE:
1361  c->chrToYV12 = rgb64LEToUV_c;
1362  break;
1363  case AV_PIX_FMT_BGRA64BE:
1364  c->chrToYV12 = bgr64BEToUV_c;
1365  break;
1366  case AV_PIX_FMT_BGRA64LE:
1367  c->chrToYV12 = bgr64LEToUV_c;
1368  break;
1369  case AV_PIX_FMT_RGB48BE:
1370  c->chrToYV12 = rgb48BEToUV_c;
1371  break;
1372  case AV_PIX_FMT_RGB48LE:
1373  c->chrToYV12 = rgb48LEToUV_c;
1374  break;
1375  case AV_PIX_FMT_BGR48BE:
1376  c->chrToYV12 = bgr48BEToUV_c;
1377  break;
1378  case AV_PIX_FMT_BGR48LE:
1379  c->chrToYV12 = bgr48LEToUV_c;
1380  break;
1381  case AV_PIX_FMT_RGB32:
1382  c->chrToYV12 = bgr32ToUV_c;
1383  break;
1384  case AV_PIX_FMT_RGB32_1:
1385  c->chrToYV12 = bgr321ToUV_c;
1386  break;
1387  case AV_PIX_FMT_BGR24:
1388  c->chrToYV12 = bgr24ToUV_c;
1389  break;
1390  case AV_PIX_FMT_BGR565LE:
1391  c->chrToYV12 = bgr16leToUV_c;
1392  break;
1393  case AV_PIX_FMT_BGR565BE:
1394  c->chrToYV12 = bgr16beToUV_c;
1395  break;
1396  case AV_PIX_FMT_BGR555LE:
1397  c->chrToYV12 = bgr15leToUV_c;
1398  break;
1399  case AV_PIX_FMT_BGR555BE:
1400  c->chrToYV12 = bgr15beToUV_c;
1401  break;
1402  case AV_PIX_FMT_BGR444LE:
1403  c->chrToYV12 = bgr12leToUV_c;
1404  break;
1405  case AV_PIX_FMT_BGR444BE:
1406  c->chrToYV12 = bgr12beToUV_c;
1407  break;
1408  case AV_PIX_FMT_BGR32:
1409  c->chrToYV12 = rgb32ToUV_c;
1410  break;
1411  case AV_PIX_FMT_BGR32_1:
1412  c->chrToYV12 = rgb321ToUV_c;
1413  break;
1414  case AV_PIX_FMT_RGB24:
1415  c->chrToYV12 = rgb24ToUV_c;
1416  break;
1417  case AV_PIX_FMT_RGB565LE:
1418  c->chrToYV12 = rgb16leToUV_c;
1419  break;
1420  case AV_PIX_FMT_RGB565BE:
1421  c->chrToYV12 = rgb16beToUV_c;
1422  break;
1423  case AV_PIX_FMT_RGB555LE:
1424  c->chrToYV12 = rgb15leToUV_c;
1425  break;
1426  case AV_PIX_FMT_RGB555BE:
1427  c->chrToYV12 = rgb15beToUV_c;
1428  break;
1429  case AV_PIX_FMT_RGB444LE:
1430  c->chrToYV12 = rgb12leToUV_c;
1431  break;
1432  case AV_PIX_FMT_RGB444BE:
1433  c->chrToYV12 = rgb12beToUV_c;
1434  break;
1435  case AV_PIX_FMT_X2RGB10LE:
1436  c->chrToYV12 = rgb30leToUV_c;
1437  break;
1438  case AV_PIX_FMT_X2BGR10LE:
1439  c->chrToYV12 = bgr30leToUV_c;
1440  break;
1441  }
1442  }
1443 
1444  c->lumToYV12 = NULL;
1445  c->alpToYV12 = NULL;
1446  switch (srcFormat) {
1447  case AV_PIX_FMT_GBRP9LE:
1448  c->readLumPlanar = planar_rgb9le_to_y;
1449  break;
1450  case AV_PIX_FMT_GBRAP10LE:
1451  c->readAlpPlanar = planar_rgb10le_to_a;
1452  case AV_PIX_FMT_GBRP10LE:
1453  c->readLumPlanar = planar_rgb10le_to_y;
1454  break;
1455  case AV_PIX_FMT_GBRAP12LE:
1456  c->readAlpPlanar = planar_rgb12le_to_a;
1457  case AV_PIX_FMT_GBRP12LE:
1458  c->readLumPlanar = planar_rgb12le_to_y;
1459  break;
1460  case AV_PIX_FMT_GBRP14LE:
1461  c->readLumPlanar = planar_rgb14le_to_y;
1462  break;
1463  case AV_PIX_FMT_GBRAP16LE:
1464  c->readAlpPlanar = planar_rgb16le_to_a;
1465  case AV_PIX_FMT_GBRP16LE:
1466  c->readLumPlanar = planar_rgb16le_to_y;
1467  break;
1468  case AV_PIX_FMT_GBRAPF32LE:
1469  c->readAlpPlanar = planar_rgbf32le_to_a;
1470  case AV_PIX_FMT_GBRPF32LE:
1471  c->readLumPlanar = planar_rgbf32le_to_y;
1472  break;
1473  case AV_PIX_FMT_GBRP9BE:
1474  c->readLumPlanar = planar_rgb9be_to_y;
1475  break;
1476  case AV_PIX_FMT_GBRAP10BE:
1477  c->readAlpPlanar = planar_rgb10be_to_a;
1478  case AV_PIX_FMT_GBRP10BE:
1479  c->readLumPlanar = planar_rgb10be_to_y;
1480  break;
1481  case AV_PIX_FMT_GBRAP12BE:
1482  c->readAlpPlanar = planar_rgb12be_to_a;
1483  case AV_PIX_FMT_GBRP12BE:
1484  c->readLumPlanar = planar_rgb12be_to_y;
1485  break;
1486  case AV_PIX_FMT_GBRP14BE:
1487  c->readLumPlanar = planar_rgb14be_to_y;
1488  break;
1489  case AV_PIX_FMT_GBRAP16BE:
1490  c->readAlpPlanar = planar_rgb16be_to_a;
1491  case AV_PIX_FMT_GBRP16BE:
1492  c->readLumPlanar = planar_rgb16be_to_y;
1493  break;
1494  case AV_PIX_FMT_GBRAPF32BE:
1495  c->readAlpPlanar = planar_rgbf32be_to_a;
1496  case AV_PIX_FMT_GBRPF32BE:
1497  c->readLumPlanar = planar_rgbf32be_to_y;
1498  break;
1499  case AV_PIX_FMT_GBRAP:
1500  c->readAlpPlanar = planar_rgb_to_a;
1501  case AV_PIX_FMT_GBRP:
1502  c->readLumPlanar = planar_rgb_to_y;
1503  break;
1504 #if HAVE_BIGENDIAN
1505  case AV_PIX_FMT_YUV420P9LE:
1506  case AV_PIX_FMT_YUV422P9LE:
1507  case AV_PIX_FMT_YUV444P9LE:
1522 
1523  case AV_PIX_FMT_GRAY9LE:
1524  case AV_PIX_FMT_GRAY10LE:
1525  case AV_PIX_FMT_GRAY12LE:
1526  case AV_PIX_FMT_GRAY14LE:
1527  case AV_PIX_FMT_GRAY16LE:
1528 
1529  case AV_PIX_FMT_P016LE:
1530  case AV_PIX_FMT_P216LE:
1531  case AV_PIX_FMT_P416LE:
1532  c->lumToYV12 = bswap16Y_c;
1533  break;
1545  c->lumToYV12 = bswap16Y_c;
1546  c->alpToYV12 = bswap16Y_c;
1547  break;
1548 #else
1549  case AV_PIX_FMT_YUV420P9BE:
1550  case AV_PIX_FMT_YUV422P9BE:
1551  case AV_PIX_FMT_YUV444P9BE:
1566 
1567  case AV_PIX_FMT_GRAY9BE:
1568  case AV_PIX_FMT_GRAY10BE:
1569  case AV_PIX_FMT_GRAY12BE:
1570  case AV_PIX_FMT_GRAY14BE:
1571  case AV_PIX_FMT_GRAY16BE:
1572 
1573  case AV_PIX_FMT_P016BE:
1574  case AV_PIX_FMT_P216BE:
1575  case AV_PIX_FMT_P416BE:
1576  c->lumToYV12 = bswap16Y_c;
1577  break;
1589  c->lumToYV12 = bswap16Y_c;
1590  c->alpToYV12 = bswap16Y_c;
1591  break;
1592 #endif
1593  case AV_PIX_FMT_YA16LE:
1594  c->lumToYV12 = read_ya16le_gray_c;
1595  break;
1596  case AV_PIX_FMT_YA16BE:
1597  c->lumToYV12 = read_ya16be_gray_c;
1598  break;
1599  case AV_PIX_FMT_AYUV64LE:
1600  c->lumToYV12 = read_ayuv64le_Y_c;
1601  break;
1602  case AV_PIX_FMT_YUYV422:
1603  case AV_PIX_FMT_YVYU422:
1604  case AV_PIX_FMT_YA8:
1605  c->lumToYV12 = yuy2ToY_c;
1606  break;
1607  case AV_PIX_FMT_UYVY422:
1608  c->lumToYV12 = uyvyToY_c;
1609  break;
1610  case AV_PIX_FMT_BGR24:
1611  c->lumToYV12 = bgr24ToY_c;
1612  break;
1613  case AV_PIX_FMT_BGR565LE:
1614  c->lumToYV12 = bgr16leToY_c;
1615  break;
1616  case AV_PIX_FMT_BGR565BE:
1617  c->lumToYV12 = bgr16beToY_c;
1618  break;
1619  case AV_PIX_FMT_BGR555LE:
1620  c->lumToYV12 = bgr15leToY_c;
1621  break;
1622  case AV_PIX_FMT_BGR555BE:
1623  c->lumToYV12 = bgr15beToY_c;
1624  break;
1625  case AV_PIX_FMT_BGR444LE:
1626  c->lumToYV12 = bgr12leToY_c;
1627  break;
1628  case AV_PIX_FMT_BGR444BE:
1629  c->lumToYV12 = bgr12beToY_c;
1630  break;
1631  case AV_PIX_FMT_RGB24:
1632  c->lumToYV12 = rgb24ToY_c;
1633  break;
1634  case AV_PIX_FMT_RGB565LE:
1635  c->lumToYV12 = rgb16leToY_c;
1636  break;
1637  case AV_PIX_FMT_RGB565BE:
1638  c->lumToYV12 = rgb16beToY_c;
1639  break;
1640  case AV_PIX_FMT_RGB555LE:
1641  c->lumToYV12 = rgb15leToY_c;
1642  break;
1643  case AV_PIX_FMT_RGB555BE:
1644  c->lumToYV12 = rgb15beToY_c;
1645  break;
1646  case AV_PIX_FMT_RGB444LE:
1647  c->lumToYV12 = rgb12leToY_c;
1648  break;
1649  case AV_PIX_FMT_RGB444BE:
1650  c->lumToYV12 = rgb12beToY_c;
1651  break;
1652  case AV_PIX_FMT_RGB8:
1653  case AV_PIX_FMT_BGR8:
1654  case AV_PIX_FMT_PAL8:
1655  case AV_PIX_FMT_BGR4_BYTE:
1656  case AV_PIX_FMT_RGB4_BYTE:
1657  c->lumToYV12 = palToY_c;
1658  break;
1659  case AV_PIX_FMT_MONOBLACK:
1660  c->lumToYV12 = monoblack2Y_c;
1661  break;
1662  case AV_PIX_FMT_MONOWHITE:
1663  c->lumToYV12 = monowhite2Y_c;
1664  break;
1665  case AV_PIX_FMT_RGB32:
1666  c->lumToYV12 = bgr32ToY_c;
1667  break;
1668  case AV_PIX_FMT_RGB32_1:
1669  c->lumToYV12 = bgr321ToY_c;
1670  break;
1671  case AV_PIX_FMT_BGR32:
1672  c->lumToYV12 = rgb32ToY_c;
1673  break;
1674  case AV_PIX_FMT_BGR32_1:
1675  c->lumToYV12 = rgb321ToY_c;
1676  break;
1677  case AV_PIX_FMT_RGB48BE:
1678  c->lumToYV12 = rgb48BEToY_c;
1679  break;
1680  case AV_PIX_FMT_RGB48LE:
1681  c->lumToYV12 = rgb48LEToY_c;
1682  break;
1683  case AV_PIX_FMT_BGR48BE:
1684  c->lumToYV12 = bgr48BEToY_c;
1685  break;
1686  case AV_PIX_FMT_BGR48LE:
1687  c->lumToYV12 = bgr48LEToY_c;
1688  break;
1689  case AV_PIX_FMT_RGBA64BE:
1690  c->lumToYV12 = rgb64BEToY_c;
1691  break;
1692  case AV_PIX_FMT_RGBA64LE:
1693  c->lumToYV12 = rgb64LEToY_c;
1694  break;
1695  case AV_PIX_FMT_BGRA64BE:
1696  c->lumToYV12 = bgr64BEToY_c;
1697  break;
1698  case AV_PIX_FMT_BGRA64LE:
1699  c->lumToYV12 = bgr64LEToY_c;
1700  break;
1701  case AV_PIX_FMT_P010LE:
1702  case AV_PIX_FMT_P210LE:
1703  case AV_PIX_FMT_P410LE:
1704  c->lumToYV12 = p010LEToY_c;
1705  break;
1706  case AV_PIX_FMT_P010BE:
1707  case AV_PIX_FMT_P210BE:
1708  case AV_PIX_FMT_P410BE:
1709  c->lumToYV12 = p010BEToY_c;
1710  break;
1711  case AV_PIX_FMT_GRAYF32LE:
1712  c->lumToYV12 = grayf32leToY16_c;
1713  break;
1714  case AV_PIX_FMT_GRAYF32BE:
1715  c->lumToYV12 = grayf32beToY16_c;
1716  break;
1717  case AV_PIX_FMT_Y210LE:
1718  c->lumToYV12 = y210le_Y_c;
1719  break;
1720  case AV_PIX_FMT_X2RGB10LE:
1721  c->lumToYV12 = rgb30leToY_c;
1722  break;
1723  case AV_PIX_FMT_X2BGR10LE:
1724  c->lumToYV12 = bgr30leToY_c;
1725  break;
1726  }
1727  if (c->needAlpha) {
1728  if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
1729  if (HAVE_BIGENDIAN == !isBE(srcFormat) && !c->readAlpPlanar)
1730  c->alpToYV12 = bswap16Y_c;
1731  }
1732  switch (srcFormat) {
1733  case AV_PIX_FMT_BGRA64LE:
1734  case AV_PIX_FMT_RGBA64LE: c->alpToYV12 = rgba64leToA_c; break;
1735  case AV_PIX_FMT_BGRA64BE:
1736  case AV_PIX_FMT_RGBA64BE: c->alpToYV12 = rgba64beToA_c; break;
1737  case AV_PIX_FMT_BGRA:
1738  case AV_PIX_FMT_RGBA:
1739  c->alpToYV12 = rgbaToA_c;
1740  break;
1741  case AV_PIX_FMT_ABGR:
1742  case AV_PIX_FMT_ARGB:
1743  c->alpToYV12 = abgrToA_c;
1744  break;
1745  case AV_PIX_FMT_YA8:
1746  c->alpToYV12 = uyvyToY_c;
1747  break;
1748  case AV_PIX_FMT_YA16LE:
1749  c->alpToYV12 = read_ya16le_alpha_c;
1750  break;
1751  case AV_PIX_FMT_YA16BE:
1752  c->alpToYV12 = read_ya16be_alpha_c;
1753  break;
1754  case AV_PIX_FMT_AYUV64LE:
1755  c->alpToYV12 = read_ayuv64le_A_c;
1756  break;
1757  case AV_PIX_FMT_PAL8 :
1758  c->alpToYV12 = palToA_c;
1759  break;
1760  }
1761  }
1762 }
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
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:147
AV_PIX_FMT_GRAY10BE
@ AV_PIX_FMT_GRAY10BE
Y , 10bpp, big-endian.
Definition: pixfmt.h:287
y210le_Y_c
static void y210le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, uint32_t *unused2)
Definition: input.c:569
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
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:139
AV_PIX_FMT_P416BE
@ AV_PIX_FMT_P416BE
interleaved chroma YUV 4:4:4, 48bpp, big-endian
Definition: pixfmt.h:365
AV_PIX_FMT_YA8
@ AV_PIX_FMT_YA8
8 bits gray, 8 bits alpha
Definition: pixfmt.h:133
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:197
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)
Definition: input.c:429
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)
Definition: input.c:548
AV_PIX_FMT_BGR32
#define AV_PIX_FMT_BGR32
Definition: pixfmt.h:379
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:129
u
#define u(width, name, range_min, range_max)
Definition: cbs_h2645.c:264
AV_PIX_FMT_GBRP16BE
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
Definition: pixfmt.h:164
p010LEToUV_c
static void p010LEToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)
Definition: input.c:722
AV_PIX_FMT_GBRP10BE
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
Definition: pixfmt.h:162
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:945
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:239
src1
const pixel * src1
Definition: h264pred_template.c:421
bswap16Y_c
static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
Definition: input.c:577
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)
Definition: input.c:836
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:178
pixdesc.h
RV_IDX
#define RV_IDX
Definition: swscale_internal.h:447
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:195
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:268
AV_PIX_FMT_GBRAPF32LE
@ AV_PIX_FMT_GBRAPF32LE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian.
Definition: pixfmt.h:311
RU_IDX
#define RU_IDX
Definition: swscale_internal.h:444
AV_PIX_FMT_GBRPF32BE
@ AV_PIX_FMT_GBRPF32BE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian.
Definition: pixfmt.h:308
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)
Definition: input.c:529
ff_sws_init_input_funcs
void ff_sws_init_input_funcs(SwsContext *c)
b
#define b
Definition: input.c:40
GV_IDX
#define GV_IDX
Definition: swscale_internal.h:448
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:75
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:275
rgb2yuv
static const char rgb2yuv[]
Definition: vf_scale_vulkan.c:68
BV_IDX
#define BV_IDX
Definition: swscale_internal.h:449
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:234
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:121
AV_PIX_FMT_RGB32_1
#define AV_PIX_FMT_RGB32_1
Definition: pixfmt.h:378
b_r
#define b_r
AV_PIX_FMT_GBRP14BE
@ AV_PIX_FMT_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
Definition: pixfmt.h:246
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:95
rgbf32_planar_funcs_endian
#define rgbf32_planar_funcs_endian(endian_name, endian)
mathematics.h
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:980
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:172
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:156
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:999
rgb16_32_wrapper
#define rgb16_32_wrapper(fmt, name, shr, shg, shb, shp, maskr, maskg, maskb, rsh, gsh, bsh, S)
Definition: input.c:351
AV_PIX_FMT_GRAY10LE
@ AV_PIX_FMT_GRAY10LE
Y , 10bpp, little-endian.
Definition: pixfmt.h:288
AV_PIX_FMT_GRAYF32LE
@ AV_PIX_FMT_GRAYF32LE
IEEE-754 single precision Y, 32bpp, little-endian.
Definition: pixfmt.h:331
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:107
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:269
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:125
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:278
AV_PIX_FMT_GRAY16BE
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
Definition: pixfmt.h:97
is16BPS
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
Definition: swscale_internal.h:696
rgb
Definition: rpzaenc.c:59
input_pixel
#define input_pixel(pos)
Definition: input.c:766
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:205
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:233
U
#define U(x)
Definition: vp56_arith.h:37
rgb12le
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT rgb12le
Definition: input.c:389
AV_PIX_FMT_GRAY9LE
@ AV_PIX_FMT_GRAY9LE
Y , 9bpp, little-endian.
Definition: pixfmt.h:306
isNBPS
static av_always_inline int isNBPS(enum AVPixelFormat pix_fmt)
Definition: swscale_internal.h:710
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)
Definition: input.c:802
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)
Definition: input.c:690
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:184
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)
Definition: input.c:457
rgb321
RGB2YUV_SHIFT rgb321
Definition: input.c:383
r
#define r
Definition: input.c:39
rgb12be
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT rgb12be
Definition: input.c:395
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:154
p010LEToY_c
static void p010LEToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
Definition: input.c:704
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:149
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)
Definition: input.c:697
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:241
p016BEToUV_c
static void p016BEToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)
Definition: input.c:755
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:236
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:243
r_b
#define r_b
AV_PIX_FMT_BGR8
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
Definition: pixfmt.h:83
avassert.h
rnd
#define rnd()
Definition: checkasm.h:112
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:969
AV_PIX_FMT_GBRAP16BE
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
Definition: pixfmt.h:206
width
#define width
intreadwrite.h
AV_PIX_FMT_GBRP16LE
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
Definition: pixfmt.h:165
AV_PIX_FMT_P416LE
@ AV_PIX_FMT_P416LE
interleaved chroma YUV 4:4:4, 48bpp, little-endian
Definition: pixfmt.h:366
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:357
g
const char * g
Definition: vf_curves.c:117
AV_PIX_FMT_P016BE
@ AV_PIX_FMT_P016BE
like NV12, with 16bpp per component, big-endian
Definition: pixfmt.h:291
AV_PIX_FMT_GBRP12LE
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
Definition: pixfmt.h:245
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:180
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
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)
Definition: input.c:669
AV_PIX_FMT_GBRP10LE
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
Definition: pixfmt.h:163
GY_IDX
#define GY_IDX
Definition: swscale_internal.h:442
f
#define f(width, name)
Definition: cbs_vp9.c:255
AV_PIX_FMT_BGR32_1
#define AV_PIX_FMT_BGR32_1
Definition: pixfmt.h:380
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:93
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:155
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:177
planar_rgb_to_y
static void planar_rgb_to_y(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv)
Definition: input.c:874
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:1016
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:152
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:150
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:123
AV_PIX_FMT_RGB565LE
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
Definition: pixfmt.h:106
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)
Definition: input.c:468
AV_PIX_FMT_GBRAPF32BE
@ AV_PIX_FMT_GBRAPF32BE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian.
Definition: pixfmt.h:310
AV_PIX_FMT_GBRAP12BE
@ AV_PIX_FMT_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
Definition: pixfmt.h:277
NULL
#define NULL
Definition: coverity.c:32
p016LEToUV_c
static void p016LEToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)
Definition: input.c:744
rgb9plus_planar_transparency_funcs
#define rgb9plus_planar_transparency_funcs(nbits)
Definition: input.c:1042
p010BEToUV_c
static void p010BEToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, int width, uint32_t *unused)
Definition: input.c:733
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:67
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:356
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:103
AV_PIX_FMT_YA16LE
@ AV_PIX_FMT_YA16LE
16 bits gray, 16 bits alpha (little-endian)
Definition: pixfmt.h:203
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:76
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:334
av_clipf
#define av_clipf
Definition: common.h:144
AV_PIX_FMT_BGR565LE
@ AV_PIX_FMT_BGR565LE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
Definition: pixfmt.h:111
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:196
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:335
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:915
read_ayuv64le_A_c
static void read_ayuv64le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width, uint32_t *unused2)
Definition: input.c:651
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:173
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:349
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:181
AV_PIX_FMT_RGB8
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
Definition: pixfmt.h:86
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:265
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)
Definition: input.c:279
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:112
rgb48funcs
#define rgb48funcs(pattern, BE_LE, origin)
Definition: input.c:196
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:169
AV_PIX_FMT_ABGR
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:94
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
rgb16le
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT rgb16le
Definition: input.c:387
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:235
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:242
AV_PIX_FMT_BGR4_BYTE
@ AV_PIX_FMT_BGR4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
Definition: pixfmt.h:85
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:351
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:146
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)
Definition: input.c:608
read_ayuv64le_UV_c
static void read_ayuv64le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, const uint8_t *unused1, int width, uint32_t *unused2)
Definition: input.c:641
isBE
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
Definition: swscale_internal.h:717
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:932
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
RY_IDX
#define RY_IDX
Definition: swscale_internal.h:441
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:267
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)
Definition: input.c:58
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:232
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:151
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:130
rgb9plus_planar_funcs
#define rgb9plus_planar_funcs(nbits)
Definition: input.c:1054
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:238
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)
Definition: input.c:167
AV_PIX_FMT_YA16BE
@ AV_PIX_FMT_YA16BE
16 bits gray, 16 bits alpha (big-endian)
Definition: pixfmt.h:202
AV_PIX_FMT_GRAY12LE
@ AV_PIX_FMT_GRAY12LE
Y , 12bpp, little-endian.
Definition: pixfmt.h:286
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)
Definition: input.c:145
AV_PIX_FMT_GBRP9BE
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
Definition: pixfmt.h:160
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)
Definition: input.c:448
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:148
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:132
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)
Definition: input.c:600
rgb64funcs
#define rgb64funcs(pattern, BE_LE, origin)
Definition: input.c:95
RGB2YUV_SHIFT
#define RGB2YUV_SHIFT
AV_PIX_FMT_GBRP9LE
@ AV_PIX_FMT_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
Definition: pixfmt.h:161
AV_PIX_FMT_RGB32
#define AV_PIX_FMT_RGB32
Definition: pixfmt.h:377
AV_PIX_FMT_GBRAP10LE
@ AV_PIX_FMT_GBRAP10LE
planar GBR 4:4:4:4 40bpp, little-endian
Definition: pixfmt.h:281
AV_PIX_FMT_BGR565BE
@ AV_PIX_FMT_BGR565BE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
Definition: pixfmt.h:110
av_bswap16
#define av_bswap16
Definition: bswap.h:31
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:360
nvXXtoUV_c
static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2, const uint8_t *src, int width)
Definition: input.c:680
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:175
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)
Definition: input.c:624
BY_IDX
#define BY_IDX
Definition: swscale_internal.h:443
AV_PIX_FMT_ARGB
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:92
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:198
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:176
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:336
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:170
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:108
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:102
lrintf
#define lrintf(x)
Definition: libm_mips.h:72
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
src2
const pixel * src2
Definition: h264pred_template.c:422
AV_PIX_FMT_GRAY9BE
@ AV_PIX_FMT_GRAY9BE
Y , 9bpp, big-endian.
Definition: pixfmt.h:305
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:338
av_assert1
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:53
av_always_inline
#define av_always_inline
Definition: attributes.h:49
swscale_internal.h
AV_PIX_FMT_NV21
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
Definition: pixfmt.h:90
AV_PIX_FMT_RGB4_BYTE
@ AV_PIX_FMT_RGB4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
Definition: pixfmt.h:88
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:126
AV_PIX_FMT_GBRPF32LE
@ AV_PIX_FMT_GBRPF32LE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian.
Definition: pixfmt.h:309
AV_PIX_FMT_NV42
@ AV_PIX_FMT_NV42
as above, but U and V bytes are swapped
Definition: pixfmt.h:339
rdpx
#define rdpx(src)
Definition: input.c:967
AV_PIX_FMT_GBRAP16LE
@ AV_PIX_FMT_GBRAP16LE
planar GBRA 4:4:4:4 64bpp, little-endian
Definition: pixfmt.h:207
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
AV_PIX_FMT_GRAY12BE
@ AV_PIX_FMT_GRAY12BE
Y , 12bpp, big-endian.
Definition: pixfmt.h:285
AV_PIX_FMT_YVYU422
@ AV_PIX_FMT_YVYU422
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
Definition: pixfmt.h:200
bgr30le
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT bgr30le
Definition: input.c:397
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)
Definition: input.c:512
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:89
bgr24ToY_c
static void bgr24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *rgb2yuv)
Definition: input.c:768
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:359
AV_PIX_FMT_P016LE
@ AV_PIX_FMT_P016LE
like NV12, with 16bpp per component, little-endian
Definition: pixfmt.h:290
y210le_UV_c
static void y210le_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)
Definition: input.c:559
AV_PIX_FMT_GRAYF32BE
@ AV_PIX_FMT_GRAYF32BE
IEEE-754 single precision Y, 32bpp, big-endian.
Definition: pixfmt.h:330
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)
Definition: input.c:632
rgb16be
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT rgb16be
Definition: input.c:393
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)
Definition: input.c:307
AV_PIX_FMT_GBRP12BE
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
Definition: pixfmt.h:244
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:81
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)
Definition: input.c:616
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)
Definition: input.c:821
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:240
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)
Definition: input.c:587
gbr24pToUV_half_c
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT static RGB2YUV_SHIFT 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)
Definition: input.c:399
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)
Definition: input.c:661
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)
Definition: input.c:855
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)
Definition: input.c:419
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)
Definition: input.c:439
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:153
bgr15be
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT bgr15be
Definition: input.c:391
AV_PIX_FMT_P216LE
@ AV_PIX_FMT_P216LE
interleaved chroma YUV 4:2:2, 32bpp, little-endian
Definition: pixfmt.h:363
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:174
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)
Definition: input.c:479
AV_PIX_FMT_RGB565BE
@ AV_PIX_FMT_RGB565BE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
Definition: pixfmt.h:105
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:122
shift
static int shift(int a, int b)
Definition: sonic.c:84
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:158
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:124
AV_PIX_FMT_GRAY16LE
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
Definition: pixfmt.h:98
avutil.h
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)
Definition: input.c:896
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:353
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)
Definition: input.c:43
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:274
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)
Definition: input.c:495
planar_rgb_to_a
static void planar_rgb_to_a(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *unused)
Definition: input.c:888
BU_IDX
#define BU_IDX
Definition: swscale_internal.h:446
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:179
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:113
AV_PIX_FMT_P216BE
@ AV_PIX_FMT_P216BE
interleaved chroma YUV 4:2:2, 32bpp, big-endian
Definition: pixfmt.h:362
AV_PIX_FMT_GRAY14LE
@ AV_PIX_FMT_GRAY14LE
Y , 14bpp, little-endian.
Definition: pixfmt.h:328
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
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)
Definition: input.c:537
AV_PIX_FMT_GRAY14BE
@ AV_PIX_FMT_GRAY14BE
Y , 14bpp, big-endian.
Definition: pixfmt.h:327
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:182
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:266
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:157
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:183
AV_PIX_FMT_GBRP14LE
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
Definition: pixfmt.h:247
d
d
Definition: ffmpeg_filter.c:153
int32_t
int32_t
Definition: audioconvert.c:56
AV_PIX_FMT_GBRAP10BE
@ AV_PIX_FMT_GBRAP10BE
planar GBR 4:4:4:4 40bpp, big-endian
Definition: pixfmt.h:280
GU_IDX
#define GU_IDX
Definition: swscale_internal.h:445
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:185
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:333
SwsContext
Definition: swscale_internal.h:300
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:131
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:237
bgr321
bgr321
Definition: input.c:381
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:168
rgb2rgb.h
p010BEToY_c
static void p010BEToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
Definition: input.c:713
swscale.h
bgr15le
RGB2YUV_SHIFT RGB2YUV_SHIFT bgr15le
Definition: input.c:385
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)
Definition: input.c:77
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)
Definition: input.c:783
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:138
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:171
AV_WN16
#define AV_WN16(p, v)
Definition: intreadwrite.h:372