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;
65  av_assert1(src1==src2);
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;
84  av_assert1(src1==src2);
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;
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;
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  ? AV_RL32(&src[(i) * 4]) \
250  : (isBE(origin) ? AV_RB16(&src[(i) * 2]) \
251  : AV_RL16(&src[(i) * 2]))))
252 
253 static av_always_inline void rgb16_32ToY_c_template(int16_t *dst,
254  const uint8_t *src,
255  int width,
256  enum AVPixelFormat origin,
257  int shr, int shg,
258  int shb, int shp,
259  int maskr, int maskg,
260  int maskb, int rsh,
261  int gsh, int bsh, int S,
262  int32_t *rgb2yuv)
263 {
264  const int ry = rgb2yuv[RY_IDX]<<rsh, gy = rgb2yuv[GY_IDX]<<gsh, by = rgb2yuv[BY_IDX]<<bsh;
265  const unsigned rnd = (32<<((S)-1)) + (1<<(S-7));
266  int i;
267 
268  for (i = 0; i < width; i++) {
269  int px = input_pixel(i) >> shp;
270  int b = (px & maskb) >> shb;
271  int g = (px & maskg) >> shg;
272  int r = (px & maskr) >> shr;
273 
274  dst[i] = (ry * r + gy * g + by * b + rnd) >> ((S)-6);
275  }
276 }
277 
278 static av_always_inline void rgb16_32ToUV_c_template(int16_t *dstU,
279  int16_t *dstV,
280  const uint8_t *src,
281  int width,
282  enum AVPixelFormat origin,
283  int shr, int shg,
284  int shb, int shp,
285  int maskr, int maskg,
286  int maskb, int rsh,
287  int gsh, int bsh, int S,
288  int32_t *rgb2yuv)
289 {
290  const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
291  rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh);
292  const unsigned rnd = (256u<<((S)-1)) + (1<<(S-7));
293  int i;
294 
295  for (i = 0; i < width; i++) {
296  int px = input_pixel(i) >> shp;
297  int b = (px & maskb) >> shb;
298  int g = (px & maskg) >> shg;
299  int r = (px & maskr) >> shr;
300 
301  dstU[i] = (ru * r + gu * g + bu * b + rnd) >> ((S)-6);
302  dstV[i] = (rv * r + gv * g + bv * b + rnd) >> ((S)-6);
303  }
304 }
305 
307  int16_t *dstV,
308  const uint8_t *src,
309  int width,
310  enum AVPixelFormat origin,
311  int shr, int shg,
312  int shb, int shp,
313  int maskr, int maskg,
314  int maskb, int rsh,
315  int gsh, int bsh, int S,
316  int32_t *rgb2yuv)
317 {
318  const int ru = rgb2yuv[RU_IDX] * (1 << rsh), gu = rgb2yuv[GU_IDX] * (1 << gsh), bu = rgb2yuv[BU_IDX] * (1 << bsh),
319  rv = rgb2yuv[RV_IDX] * (1 << rsh), gv = rgb2yuv[GV_IDX] * (1 << gsh), bv = rgb2yuv[BV_IDX] * (1 << bsh),
320  maskgx = ~(maskr | maskb);
321  const unsigned rnd = (256U<<(S)) + (1<<(S-6));
322  int i;
323 
324  maskr |= maskr << 1;
325  maskb |= maskb << 1;
326  maskg |= maskg << 1;
327  for (i = 0; i < width; i++) {
328  unsigned px0 = input_pixel(2 * i + 0) >> shp;
329  unsigned px1 = input_pixel(2 * i + 1) >> shp;
330  int b, r, g = (px0 & maskgx) + (px1 & maskgx);
331  int rb = px0 + px1 - g;
332 
333  b = (rb & maskb) >> shb;
334  if (shp ||
335  origin == AV_PIX_FMT_BGR565LE || origin == AV_PIX_FMT_BGR565BE ||
336  origin == AV_PIX_FMT_RGB565LE || origin == AV_PIX_FMT_RGB565BE) {
337  g >>= shg;
338  } else {
339  g = (g & maskg) >> shg;
340  }
341  r = (rb & maskr) >> shr;
342 
343  dstU[i] = (ru * r + gu * g + bu * b + (unsigned)rnd) >> ((S)-6+1);
344  dstV[i] = (rv * r + gv * g + bv * b + (unsigned)rnd) >> ((S)-6+1);
345  }
346 }
347 
348 #undef input_pixel
349 
350 #define rgb16_32_wrapper(fmt, name, shr, shg, shb, shp, maskr, \
351  maskg, maskb, rsh, gsh, bsh, S) \
352 static void name ## ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, \
353  int width, uint32_t *tab) \
354 { \
355  rgb16_32ToY_c_template((int16_t*)dst, src, width, fmt, shr, shg, shb, shp, \
356  maskr, maskg, maskb, rsh, gsh, bsh, S, tab); \
357 } \
358  \
359 static void name ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \
360  const uint8_t *unused0, const uint8_t *src, const uint8_t *dummy, \
361  int width, uint32_t *tab) \
362 { \
363  rgb16_32ToUV_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
364  shr, shg, shb, shp, \
365  maskr, maskg, maskb, rsh, gsh, bsh, S, tab);\
366 } \
367  \
368 static void name ## ToUV_half_c(uint8_t *dstU, uint8_t *dstV, \
369  const uint8_t *unused0, const uint8_t *src, \
370  const uint8_t *dummy, \
371  int width, uint32_t *tab) \
372 { \
373  rgb16_32ToUV_half_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
374  shr, shg, shb, shp, \
375  maskr, maskg, maskb, \
376  rsh, gsh, bsh, S, tab); \
377 }
378 
379 rgb16_32_wrapper(AV_PIX_FMT_BGR32, bgr32, 16, 0, 0, 0, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
380 rgb16_32_wrapper(AV_PIX_FMT_BGR32_1, bgr321, 16, 0, 0, 8, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8, RGB2YUV_SHIFT + 8)
381 rgb16_32_wrapper(AV_PIX_FMT_RGB32, rgb32, 0, 0, 16, 0, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
382 rgb16_32_wrapper(AV_PIX_FMT_RGB32_1, rgb321, 0, 0, 16, 8, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8, RGB2YUV_SHIFT + 8)
383 rgb16_32_wrapper(AV_PIX_FMT_BGR565LE, bgr16le, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
384 rgb16_32_wrapper(AV_PIX_FMT_BGR555LE, bgr15le, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
385 rgb16_32_wrapper(AV_PIX_FMT_BGR444LE, bgr12le, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
386 rgb16_32_wrapper(AV_PIX_FMT_RGB565LE, rgb16le, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
387 rgb16_32_wrapper(AV_PIX_FMT_RGB555LE, rgb15le, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
388 rgb16_32_wrapper(AV_PIX_FMT_RGB444LE, rgb12le, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
389 rgb16_32_wrapper(AV_PIX_FMT_BGR565BE, bgr16be, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0, RGB2YUV_SHIFT + 8)
390 rgb16_32_wrapper(AV_PIX_FMT_BGR555BE, bgr15be, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0, RGB2YUV_SHIFT + 7)
391 rgb16_32_wrapper(AV_PIX_FMT_BGR444BE, bgr12be, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0, RGB2YUV_SHIFT + 4)
392 rgb16_32_wrapper(AV_PIX_FMT_RGB565BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11, RGB2YUV_SHIFT + 8)
393 rgb16_32_wrapper(AV_PIX_FMT_RGB555BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10, RGB2YUV_SHIFT + 7)
394 rgb16_32_wrapper(AV_PIX_FMT_RGB444BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8, RGB2YUV_SHIFT + 4)
395 rgb16_32_wrapper(AV_PIX_FMT_X2RGB10LE, rgb30le, 16, 6, 0, 0, 0x3FF00000, 0xFFC00, 0x3FF, 0, 0, 4, RGB2YUV_SHIFT + 6)
396 
397 static void gbr24pToUV_half_c(uint8_t *_dstU, uint8_t *_dstV,
398  const uint8_t *gsrc, const uint8_t *bsrc, const uint8_t *rsrc,
399  int width, uint32_t *rgb2yuv)
400 {
401  uint16_t *dstU = (uint16_t *)_dstU;
402  uint16_t *dstV = (uint16_t *)_dstV;
405 
406  int i;
407  for (i = 0; i < width; i++) {
408  unsigned int g = gsrc[2*i] + gsrc[2*i+1];
409  unsigned int b = bsrc[2*i] + bsrc[2*i+1];
410  unsigned int r = rsrc[2*i] + rsrc[2*i+1];
411 
412  dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
413  dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
414  }
415 }
416 
417 static void rgba64leToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
418  const uint8_t *unused2, int width, uint32_t *unused)
419 {
420  int16_t *dst = (int16_t *)_dst;
421  const uint16_t *src = (const uint16_t *)_src;
422  int i;
423  for (i = 0; i < width; i++)
424  dst[i] = AV_RL16(src + 4 * i + 3);
425 }
426 
427 static void rgba64beToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
428  const uint8_t *unused2, int width, uint32_t *unused)
429 {
430  int16_t *dst = (int16_t *)_dst;
431  const uint16_t *src = (const uint16_t *)_src;
432  int i;
433  for (i = 0; i < width; i++)
434  dst[i] = AV_RB16(src + 4 * i + 3);
435 }
436 
437 static void abgrToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
438 {
439  int16_t *dst = (int16_t *)_dst;
440  int i;
441  for (i=0; i<width; i++) {
442  dst[i]= src[4*i]<<6 | src[4*i]>>2;
443  }
444 }
445 
446 static void rgbaToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
447 {
448  int16_t *dst = (int16_t *)_dst;
449  int i;
450  for (i=0; i<width; i++) {
451  dst[i]= src[4*i+3]<<6 | src[4*i+3]>>2;
452  }
453 }
454 
455 static void palToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *pal)
456 {
457  int16_t *dst = (int16_t *)_dst;
458  int i;
459  for (i=0; i<width; i++) {
460  int d= src[i];
461 
462  dst[i]= (pal[d] >> 24)<<6 | pal[d]>>26;
463  }
464 }
465 
466 static void palToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *pal)
467 {
468  int16_t *dst = (int16_t *)_dst;
469  int i;
470  for (i = 0; i < width; i++) {
471  int d = src[i];
472 
473  dst[i] = (pal[d] & 0xFF)<<6;
474  }
475 }
476 
477 static void palToUV_c(uint8_t *_dstU, uint8_t *_dstV,
478  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
479  int width, uint32_t *pal)
480 {
481  uint16_t *dstU = (uint16_t *)_dstU;
482  int16_t *dstV = (int16_t *)_dstV;
483  int i;
484  av_assert1(src1 == src2);
485  for (i = 0; i < width; i++) {
486  int p = pal[src1[i]];
487 
488  dstU[i] = (uint8_t)(p>> 8)<<6;
489  dstV[i] = (uint8_t)(p>>16)<<6;
490  }
491 }
492 
493 static void monowhite2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
494 {
495  int16_t *dst = (int16_t *)_dst;
496  int i, j;
497  width = (width + 7) >> 3;
498  for (i = 0; i < width; i++) {
499  int d = ~src[i];
500  for (j = 0; j < 8; j++)
501  dst[8*i+j]= ((d>>(7-j))&1) * 16383;
502  }
503  if(width&7){
504  int d= ~src[i];
505  for (j = 0; j < (width&7); j++)
506  dst[8*i+j]= ((d>>(7-j))&1) * 16383;
507  }
508 }
509 
510 static void monoblack2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
511 {
512  int16_t *dst = (int16_t *)_dst;
513  int i, j;
514  width = (width + 7) >> 3;
515  for (i = 0; i < width; i++) {
516  int d = src[i];
517  for (j = 0; j < 8; j++)
518  dst[8*i+j]= ((d>>(7-j))&1) * 16383;
519  }
520  if(width&7){
521  int d = src[i];
522  for (j = 0; j < (width&7); j++)
523  dst[8*i+j] = ((d>>(7-j))&1) * 16383;
524  }
525 }
526 
527 static void yuy2ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
528  uint32_t *unused)
529 {
530  int i;
531  for (i = 0; i < width; i++)
532  dst[i] = src[2 * i];
533 }
534 
535 static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
536  const uint8_t *src2, int width, uint32_t *unused)
537 {
538  int i;
539  for (i = 0; i < width; i++) {
540  dstU[i] = src1[4 * i + 1];
541  dstV[i] = src1[4 * i + 3];
542  }
543  av_assert1(src1 == src2);
544 }
545 
546 static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
547  const uint8_t *src2, int width, uint32_t *unused)
548 {
549  int i;
550  for (i = 0; i < width; i++) {
551  dstV[i] = src1[4 * i + 1];
552  dstU[i] = src1[4 * i + 3];
553  }
554  av_assert1(src1 == src2);
555 }
556 
557 static void y210le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
558  const uint8_t *unused1, int width, uint32_t *unused2)
559 {
560  int i;
561  for (i = 0; i < width; i++) {
562  AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> 6);
563  AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> 6);
564  }
565 }
566 
567 static void y210le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0,
568  const uint8_t *unused1, int width, uint32_t *unused2)
569 {
570  int i;
571  for (i = 0; i < width; i++)
572  AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> 6);
573 }
574 
575 static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width,
576  uint32_t *unused)
577 {
578  int i;
579  const uint16_t *src = (const uint16_t *)_src;
580  uint16_t *dst = (uint16_t *)_dst;
581  for (i = 0; i < width; i++)
582  dst[i] = av_bswap16(src[i]);
583 }
584 
585 static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *_src1,
586  const uint8_t *_src2, int width, uint32_t *unused)
587 {
588  int i;
589  const uint16_t *src1 = (const uint16_t *)_src1,
590  *src2 = (const uint16_t *)_src2;
591  uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
592  for (i = 0; i < width; i++) {
593  dstU[i] = av_bswap16(src1[i]);
594  dstV[i] = av_bswap16(src2[i]);
595  }
596 }
597 
598 static void read_ya16le_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
599  uint32_t *unused)
600 {
601  int i;
602  for (i = 0; i < width; i++)
603  AV_WN16(dst + i * 2, AV_RL16(src + i * 4));
604 }
605 
606 static void read_ya16le_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
607  uint32_t *unused)
608 {
609  int i;
610  for (i = 0; i < width; i++)
611  AV_WN16(dst + i * 2, AV_RL16(src + i * 4 + 2));
612 }
613 
614 static void read_ya16be_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
615  uint32_t *unused)
616 {
617  int i;
618  for (i = 0; i < width; i++)
619  AV_WN16(dst + i * 2, AV_RB16(src + i * 4));
620 }
621 
622 static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
623  uint32_t *unused)
624 {
625  int i;
626  for (i = 0; i < width; i++)
627  AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
628 }
629 
630 static void read_ayuv64le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
631  uint32_t *unused2)
632 {
633  int i;
634  for (i = 0; i < width; i++)
635  AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2));
636 }
637 
638 
639 static void read_ayuv64le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
640  const uint8_t *unused1, int width, uint32_t *unused2)
641 {
642  int i;
643  for (i = 0; i < width; i++) {
644  AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 4));
645  AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6));
646  }
647 }
648 
649 static void read_ayuv64le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
650  uint32_t *unused2)
651 {
652  int i;
653  for (i = 0; i < width; i++)
654  AV_WN16(dst + i * 2, AV_RL16(src + i * 8));
655 }
656 
657 /* This is almost identical to the previous, end exists only because
658  * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */
659 static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
660  uint32_t *unused)
661 {
662  int i;
663  for (i = 0; i < width; i++)
664  dst[i] = src[2 * i + 1];
665 }
666 
667 static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
668  const uint8_t *src2, int width, uint32_t *unused)
669 {
670  int i;
671  for (i = 0; i < width; i++) {
672  dstU[i] = src1[4 * i + 0];
673  dstV[i] = src1[4 * i + 2];
674  }
675  av_assert1(src1 == src2);
676 }
677 
678 static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,
679  const uint8_t *src, int width)
680 {
681  int i;
682  for (i = 0; i < width; i++) {
683  dst1[i] = src[2 * i + 0];
684  dst2[i] = src[2 * i + 1];
685  }
686 }
687 
688 static void nv12ToUV_c(uint8_t *dstU, uint8_t *dstV,
689  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
690  int width, uint32_t *unused)
691 {
692  nvXXtoUV_c(dstU, dstV, src1, width);
693 }
694 
695 static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
696  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
697  int width, uint32_t *unused)
698 {
699  nvXXtoUV_c(dstV, dstU, src1, width);
700 }
701 
702 static void p010LEToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1,
703  const uint8_t *unused2, int width, uint32_t *unused)
704 {
705  int i;
706  for (i = 0; i < width; i++) {
707  AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> 6);
708  }
709 }
710 
711 static void p010BEToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1,
712  const uint8_t *unused2, int width, uint32_t *unused)
713 {
714  int i;
715  for (i = 0; i < width; i++) {
716  AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> 6);
717  }
718 }
719 
720 static void p010LEToUV_c(uint8_t *dstU, uint8_t *dstV,
721  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
722  int width, uint32_t *unused)
723 {
724  int i;
725  for (i = 0; i < width; i++) {
726  AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0) >> 6);
727  AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2) >> 6);
728  }
729 }
730 
731 static void p010BEToUV_c(uint8_t *dstU, uint8_t *dstV,
732  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
733  int width, uint32_t *unused)
734 {
735  int i;
736  for (i = 0; i < width; i++) {
737  AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0) >> 6);
738  AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2) >> 6);
739  }
740 }
741 
742 static void p016LEToUV_c(uint8_t *dstU, uint8_t *dstV,
743  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
744  int width, uint32_t *unused)
745 {
746  int i;
747  for (i = 0; i < width; i++) {
748  AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0));
749  AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2));
750  }
751 }
752 
753 static void p016BEToUV_c(uint8_t *dstU, uint8_t *dstV,
754  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
755  int width, uint32_t *unused)
756 {
757  int i;
758  for (i = 0; i < width; i++) {
759  AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0));
760  AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2));
761  }
762 }
763 
764 #define input_pixel(pos) (isBE(origin) ? AV_RB16(pos) : AV_RL16(pos))
765 
766 static void bgr24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,
767  int width, uint32_t *rgb2yuv)
768 {
769  int16_t *dst = (int16_t *)_dst;
770  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
771  int i;
772  for (i = 0; i < width; i++) {
773  int b = src[i * 3 + 0];
774  int g = src[i * 3 + 1];
775  int r = src[i * 3 + 2];
776 
777  dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
778  }
779 }
780 
781 static void bgr24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
782  const uint8_t *src2, int width, uint32_t *rgb2yuv)
783 {
784  int16_t *dstU = (int16_t *)_dstU;
785  int16_t *dstV = (int16_t *)_dstV;
788  int i;
789  for (i = 0; i < width; i++) {
790  int b = src1[3 * i + 0];
791  int g = src1[3 * i + 1];
792  int r = src1[3 * i + 2];
793 
794  dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
795  dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
796  }
797  av_assert1(src1 == src2);
798 }
799 
800 static void bgr24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
801  const uint8_t *src2, int width, uint32_t *rgb2yuv)
802 {
803  int16_t *dstU = (int16_t *)_dstU;
804  int16_t *dstV = (int16_t *)_dstV;
805  int i;
808  for (i = 0; i < width; i++) {
809  int b = src1[6 * i + 0] + src1[6 * i + 3];
810  int g = src1[6 * i + 1] + src1[6 * i + 4];
811  int r = src1[6 * i + 2] + src1[6 * i + 5];
812 
813  dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
814  dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
815  }
816  av_assert1(src1 == src2);
817 }
818 
819 static void rgb24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
820  uint32_t *rgb2yuv)
821 {
822  int16_t *dst = (int16_t *)_dst;
823  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
824  int i;
825  for (i = 0; i < width; i++) {
826  int r = src[i * 3 + 0];
827  int g = src[i * 3 + 1];
828  int b = src[i * 3 + 2];
829 
830  dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
831  }
832 }
833 
834 static void rgb24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
835  const uint8_t *src2, int width, uint32_t *rgb2yuv)
836 {
837  int16_t *dstU = (int16_t *)_dstU;
838  int16_t *dstV = (int16_t *)_dstV;
839  int i;
842  av_assert1(src1 == src2);
843  for (i = 0; i < width; i++) {
844  int r = src1[3 * i + 0];
845  int g = src1[3 * i + 1];
846  int b = src1[3 * i + 2];
847 
848  dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
849  dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
850  }
851 }
852 
853 static void rgb24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
854  const uint8_t *src2, int width, uint32_t *rgb2yuv)
855 {
856  int16_t *dstU = (int16_t *)_dstU;
857  int16_t *dstV = (int16_t *)_dstV;
858  int i;
861  av_assert1(src1 == src2);
862  for (i = 0; i < width; i++) {
863  int r = src1[6 * i + 0] + src1[6 * i + 3];
864  int g = src1[6 * i + 1] + src1[6 * i + 4];
865  int b = src1[6 * i + 2] + src1[6 * i + 5];
866 
867  dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
868  dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
869  }
870 }
871 
872 static void planar_rgb_to_y(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv)
873 {
874  uint16_t *dst = (uint16_t *)_dst;
875  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
876  int i;
877  for (i = 0; i < width; i++) {
878  int g = src[0][i];
879  int b = src[1][i];
880  int r = src[2][i];
881 
882  dst[i] = (ry*r + gy*g + by*b + (0x801<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
883  }
884 }
885 
886 static void planar_rgb_to_a(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *unused)
887 {
888  uint16_t *dst = (uint16_t *)_dst;
889  int i;
890  for (i = 0; i < width; i++)
891  dst[i] = src[3][i] << 6;
892 }
893 
894 static void planar_rgb_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4], int width, int32_t *rgb2yuv)
895 {
896  uint16_t *dstU = (uint16_t *)_dstU;
897  uint16_t *dstV = (uint16_t *)_dstV;
900  int i;
901  for (i = 0; i < width; i++) {
902  int g = src[0][i];
903  int b = src[1][i];
904  int r = src[2][i];
905 
906  dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
907  dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
908  }
909 }
910 
911 #define rdpx(src) \
912  is_be ? AV_RB16(src) : AV_RL16(src)
913 static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_src[4],
914  int width, int bpc, int is_be, int32_t *rgb2yuv)
915 {
916  int i;
917  const uint16_t **src = (const uint16_t **)_src;
918  uint16_t *dst = (uint16_t *)_dst;
919  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
920  int shift = bpc < 16 ? bpc : 14;
921  for (i = 0; i < width; i++) {
922  int g = rdpx(src[0] + i);
923  int b = rdpx(src[1] + i);
924  int r = rdpx(src[2] + i);
925 
926  dst[i] = (ry*r + gy*g + by*b + (16 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
927  }
928 }
929 
930 static av_always_inline void planar_rgb16_to_a(uint8_t *_dst, const uint8_t *_src[4],
931  int width, int bpc, int is_be, int32_t *rgb2yuv)
932 {
933  int i;
934  const uint16_t **src = (const uint16_t **)_src;
935  uint16_t *dst = (uint16_t *)_dst;
936  int shift = bpc < 16 ? bpc : 14;
937 
938  for (i = 0; i < width; i++) {
939  dst[i] = rdpx(src[3] + i) << (14 - shift);
940  }
941 }
942 
943 static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV,
944  const uint8_t *_src[4], int width,
945  int bpc, int is_be, int32_t *rgb2yuv)
946 {
947  int i;
948  const uint16_t **src = (const uint16_t **)_src;
949  uint16_t *dstU = (uint16_t *)_dstU;
950  uint16_t *dstV = (uint16_t *)_dstV;
953  int shift = bpc < 16 ? bpc : 14;
954  for (i = 0; i < width; i++) {
955  int g = rdpx(src[0] + i);
956  int b = rdpx(src[1] + i);
957  int r = rdpx(src[2] + i);
958 
959  dstU[i] = (ru*r + gu*g + bu*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
960  dstV[i] = (rv*r + gv*g + bv*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
961  }
962 }
963 #undef rdpx
964 
965 #define rdpx(src) (is_be ? av_int2float(AV_RB32(src)): av_int2float(AV_RL32(src)))
966 
967 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)
968 {
969  int i;
970  const float **src = (const float **)_src;
971  uint16_t *dst = (uint16_t *)_dst;
972 
973  for (i = 0; i < width; i++) {
974  dst[i] = av_clip_uint16(lrintf(65535.0f * rdpx(src[3] + i)));
975  }
976 }
977 
978 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)
979 {
980  int i;
981  const float **src = (const float **)_src;
982  uint16_t *dstU = (uint16_t *)_dstU;
983  uint16_t *dstV = (uint16_t *)_dstV;
986 
987  for (i = 0; i < width; i++) {
988  int g = av_clip_uint16(lrintf(65535.0f * rdpx(src[0] + i)));
989  int b = av_clip_uint16(lrintf(65535.0f * rdpx(src[1] + i)));
990  int r = av_clip_uint16(lrintf(65535.0f * rdpx(src[2] + i)));
991 
992  dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
993  dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
994  }
995 }
996 
997 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)
998 {
999  int i;
1000  const float **src = (const float **)_src;
1001  uint16_t *dst = (uint16_t *)_dst;
1002 
1003  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1004 
1005  for (i = 0; i < width; i++) {
1006  int g = av_clip_uint16(lrintf(65535.0f * rdpx(src[0] + i)));
1007  int b = av_clip_uint16(lrintf(65535.0f * rdpx(src[1] + i)));
1008  int r = av_clip_uint16(lrintf(65535.0f * rdpx(src[2] + i)));
1009 
1010  dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1011  }
1012 }
1013 
1014 #undef rdpx
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, 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] = av_clip_uint16(lrintf(65535.0f * src[i]));
1025  }
1026 }
1027 
1028 static av_always_inline void grayf32ToY16_bswap_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1029  const uint8_t *unused2, int width, uint32_t *unused)
1030 {
1031  int i;
1032  const uint32_t *src = (const uint32_t *)_src;
1033  uint16_t *dst = (uint16_t *)_dst;
1034 
1035  for (i = 0; i < width; ++i){
1036  dst[i] = av_clip_uint16(lrintf(65535.0f * av_int2float(av_bswap32(src[i]))));
1037  }
1038 }
1039 
1040 #define rgb9plus_planar_funcs_endian(nbits, endian_name, endian) \
1041 static void planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1042  int w, int32_t *rgb2yuv) \
1043 { \
1044  planar_rgb16_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1045 } \
1046 static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1047  const uint8_t *src[4], int w, int32_t *rgb2yuv) \
1048 { \
1049  planar_rgb16_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1050 } \
1051 
1052 #define rgb9plus_planar_transparency_funcs(nbits) \
1053 static void planar_rgb##nbits##le_to_a(uint8_t *dst, const uint8_t *src[4], \
1054  int w, int32_t *rgb2yuv) \
1055 { \
1056  planar_rgb16_to_a(dst, src, w, nbits, 0, rgb2yuv); \
1057 } \
1058 static void planar_rgb##nbits##be_to_a(uint8_t *dst, const uint8_t *src[4], \
1059  int w, int32_t *rgb2yuv) \
1060 { \
1061  planar_rgb16_to_a(dst, src, w, nbits, 1, rgb2yuv); \
1062 }
1063 
1064 #define rgb9plus_planar_funcs(nbits) \
1065  rgb9plus_planar_funcs_endian(nbits, le, 0) \
1066  rgb9plus_planar_funcs_endian(nbits, be, 1)
1067 
1073 
1077 
1078 #define rgbf32_planar_funcs_endian(endian_name, endian) \
1079 static void planar_rgbf32##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1080  int w, int32_t *rgb2yuv) \
1081 { \
1082  planar_rgbf32_to_y(dst, src, w, endian, rgb2yuv); \
1083 } \
1084 static void planar_rgbf32##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1085  const uint8_t *src[4], int w, int32_t *rgb2yuv) \
1086 { \
1087  planar_rgbf32_to_uv(dstU, dstV, src, w, endian, rgb2yuv); \
1088 } \
1089 static void planar_rgbf32##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1090  int w, int32_t *rgb2yuv) \
1091 { \
1092  planar_rgbf32_to_a(dst, src, w, endian, rgb2yuv); \
1093 }
1094 
1097 
1099 {
1100  enum AVPixelFormat srcFormat = c->srcFormat;
1101 
1102  c->chrToYV12 = NULL;
1103  switch (srcFormat) {
1104  case AV_PIX_FMT_YUYV422:
1105  c->chrToYV12 = yuy2ToUV_c;
1106  break;
1107  case AV_PIX_FMT_YVYU422:
1108  c->chrToYV12 = yvy2ToUV_c;
1109  break;
1110  case AV_PIX_FMT_UYVY422:
1111  c->chrToYV12 = uyvyToUV_c;
1112  break;
1113  case AV_PIX_FMT_NV12:
1114  case AV_PIX_FMT_NV24:
1115  c->chrToYV12 = nv12ToUV_c;
1116  break;
1117  case AV_PIX_FMT_NV21:
1118  case AV_PIX_FMT_NV42:
1119  c->chrToYV12 = nv21ToUV_c;
1120  break;
1121  case AV_PIX_FMT_RGB8:
1122  case AV_PIX_FMT_BGR8:
1123  case AV_PIX_FMT_PAL8:
1124  case AV_PIX_FMT_BGR4_BYTE:
1125  case AV_PIX_FMT_RGB4_BYTE:
1126  c->chrToYV12 = palToUV_c;
1127  break;
1128  case AV_PIX_FMT_GBRP9LE:
1129  c->readChrPlanar = planar_rgb9le_to_uv;
1130  break;
1131  case AV_PIX_FMT_GBRAP10LE:
1132  case AV_PIX_FMT_GBRP10LE:
1133  c->readChrPlanar = planar_rgb10le_to_uv;
1134  break;
1135  case AV_PIX_FMT_GBRAP12LE:
1136  case AV_PIX_FMT_GBRP12LE:
1137  c->readChrPlanar = planar_rgb12le_to_uv;
1138  break;
1139  case AV_PIX_FMT_GBRP14LE:
1140  c->readChrPlanar = planar_rgb14le_to_uv;
1141  break;
1142  case AV_PIX_FMT_GBRAP16LE:
1143  case AV_PIX_FMT_GBRP16LE:
1144  c->readChrPlanar = planar_rgb16le_to_uv;
1145  break;
1146  case AV_PIX_FMT_GBRAPF32LE:
1147  case AV_PIX_FMT_GBRPF32LE:
1148  c->readChrPlanar = planar_rgbf32le_to_uv;
1149  break;
1150  case AV_PIX_FMT_GBRP9BE:
1151  c->readChrPlanar = planar_rgb9be_to_uv;
1152  break;
1153  case AV_PIX_FMT_GBRAP10BE:
1154  case AV_PIX_FMT_GBRP10BE:
1155  c->readChrPlanar = planar_rgb10be_to_uv;
1156  break;
1157  case AV_PIX_FMT_GBRAP12BE:
1158  case AV_PIX_FMT_GBRP12BE:
1159  c->readChrPlanar = planar_rgb12be_to_uv;
1160  break;
1161  case AV_PIX_FMT_GBRP14BE:
1162  c->readChrPlanar = planar_rgb14be_to_uv;
1163  break;
1164  case AV_PIX_FMT_GBRAP16BE:
1165  case AV_PIX_FMT_GBRP16BE:
1166  c->readChrPlanar = planar_rgb16be_to_uv;
1167  break;
1168  case AV_PIX_FMT_GBRAPF32BE:
1169  case AV_PIX_FMT_GBRPF32BE:
1170  c->readChrPlanar = planar_rgbf32be_to_uv;
1171  break;
1172  case AV_PIX_FMT_GBRAP:
1173  case AV_PIX_FMT_GBRP:
1174  c->readChrPlanar = planar_rgb_to_uv;
1175  break;
1176 #if HAVE_BIGENDIAN
1177  case AV_PIX_FMT_YUV420P9LE:
1178  case AV_PIX_FMT_YUV422P9LE:
1179  case AV_PIX_FMT_YUV444P9LE:
1194 
1206  c->chrToYV12 = bswap16UV_c;
1207  break;
1208 #else
1209  case AV_PIX_FMT_YUV420P9BE:
1210  case AV_PIX_FMT_YUV422P9BE:
1211  case AV_PIX_FMT_YUV444P9BE:
1226 
1238  c->chrToYV12 = bswap16UV_c;
1239  break;
1240 #endif
1241  case AV_PIX_FMT_AYUV64LE:
1242  c->chrToYV12 = read_ayuv64le_UV_c;
1243  break;
1244  case AV_PIX_FMT_P010LE:
1245  c->chrToYV12 = p010LEToUV_c;
1246  break;
1247  case AV_PIX_FMT_P010BE:
1248  c->chrToYV12 = p010BEToUV_c;
1249  break;
1250  case AV_PIX_FMT_P016LE:
1251  c->chrToYV12 = p016LEToUV_c;
1252  break;
1253  case AV_PIX_FMT_P016BE:
1254  c->chrToYV12 = p016BEToUV_c;
1255  break;
1256  case AV_PIX_FMT_Y210LE:
1257  c->chrToYV12 = y210le_UV_c;
1258  break;
1259  }
1260  if (c->chrSrcHSubSample) {
1261  switch (srcFormat) {
1262  case AV_PIX_FMT_RGBA64BE:
1263  c->chrToYV12 = rgb64BEToUV_half_c;
1264  break;
1265  case AV_PIX_FMT_RGBA64LE:
1266  c->chrToYV12 = rgb64LEToUV_half_c;
1267  break;
1268  case AV_PIX_FMT_BGRA64BE:
1269  c->chrToYV12 = bgr64BEToUV_half_c;
1270  break;
1271  case AV_PIX_FMT_BGRA64LE:
1272  c->chrToYV12 = bgr64LEToUV_half_c;
1273  break;
1274  case AV_PIX_FMT_RGB48BE:
1275  c->chrToYV12 = rgb48BEToUV_half_c;
1276  break;
1277  case AV_PIX_FMT_RGB48LE:
1278  c->chrToYV12 = rgb48LEToUV_half_c;
1279  break;
1280  case AV_PIX_FMT_BGR48BE:
1281  c->chrToYV12 = bgr48BEToUV_half_c;
1282  break;
1283  case AV_PIX_FMT_BGR48LE:
1284  c->chrToYV12 = bgr48LEToUV_half_c;
1285  break;
1286  case AV_PIX_FMT_RGB32:
1287  c->chrToYV12 = bgr32ToUV_half_c;
1288  break;
1289  case AV_PIX_FMT_RGB32_1:
1290  c->chrToYV12 = bgr321ToUV_half_c;
1291  break;
1292  case AV_PIX_FMT_BGR24:
1293  c->chrToYV12 = bgr24ToUV_half_c;
1294  break;
1295  case AV_PIX_FMT_BGR565LE:
1296  c->chrToYV12 = bgr16leToUV_half_c;
1297  break;
1298  case AV_PIX_FMT_BGR565BE:
1299  c->chrToYV12 = bgr16beToUV_half_c;
1300  break;
1301  case AV_PIX_FMT_BGR555LE:
1302  c->chrToYV12 = bgr15leToUV_half_c;
1303  break;
1304  case AV_PIX_FMT_BGR555BE:
1305  c->chrToYV12 = bgr15beToUV_half_c;
1306  break;
1307  case AV_PIX_FMT_GBRAP:
1308  case AV_PIX_FMT_GBRP:
1309  c->chrToYV12 = gbr24pToUV_half_c;
1310  break;
1311  case AV_PIX_FMT_BGR444LE:
1312  c->chrToYV12 = bgr12leToUV_half_c;
1313  break;
1314  case AV_PIX_FMT_BGR444BE:
1315  c->chrToYV12 = bgr12beToUV_half_c;
1316  break;
1317  case AV_PIX_FMT_BGR32:
1318  c->chrToYV12 = rgb32ToUV_half_c;
1319  break;
1320  case AV_PIX_FMT_BGR32_1:
1321  c->chrToYV12 = rgb321ToUV_half_c;
1322  break;
1323  case AV_PIX_FMT_RGB24:
1324  c->chrToYV12 = rgb24ToUV_half_c;
1325  break;
1326  case AV_PIX_FMT_RGB565LE:
1327  c->chrToYV12 = rgb16leToUV_half_c;
1328  break;
1329  case AV_PIX_FMT_RGB565BE:
1330  c->chrToYV12 = rgb16beToUV_half_c;
1331  break;
1332  case AV_PIX_FMT_RGB555LE:
1333  c->chrToYV12 = rgb15leToUV_half_c;
1334  break;
1335  case AV_PIX_FMT_RGB555BE:
1336  c->chrToYV12 = rgb15beToUV_half_c;
1337  break;
1338  case AV_PIX_FMT_RGB444LE:
1339  c->chrToYV12 = rgb12leToUV_half_c;
1340  break;
1341  case AV_PIX_FMT_RGB444BE:
1342  c->chrToYV12 = rgb12beToUV_half_c;
1343  break;
1344  case AV_PIX_FMT_X2RGB10LE:
1345  c->chrToYV12 = rgb30leToUV_half_c;
1346  break;
1347  }
1348  } else {
1349  switch (srcFormat) {
1350  case AV_PIX_FMT_RGBA64BE:
1351  c->chrToYV12 = rgb64BEToUV_c;
1352  break;
1353  case AV_PIX_FMT_RGBA64LE:
1354  c->chrToYV12 = rgb64LEToUV_c;
1355  break;
1356  case AV_PIX_FMT_BGRA64BE:
1357  c->chrToYV12 = bgr64BEToUV_c;
1358  break;
1359  case AV_PIX_FMT_BGRA64LE:
1360  c->chrToYV12 = bgr64LEToUV_c;
1361  break;
1362  case AV_PIX_FMT_RGB48BE:
1363  c->chrToYV12 = rgb48BEToUV_c;
1364  break;
1365  case AV_PIX_FMT_RGB48LE:
1366  c->chrToYV12 = rgb48LEToUV_c;
1367  break;
1368  case AV_PIX_FMT_BGR48BE:
1369  c->chrToYV12 = bgr48BEToUV_c;
1370  break;
1371  case AV_PIX_FMT_BGR48LE:
1372  c->chrToYV12 = bgr48LEToUV_c;
1373  break;
1374  case AV_PIX_FMT_RGB32:
1375  c->chrToYV12 = bgr32ToUV_c;
1376  break;
1377  case AV_PIX_FMT_RGB32_1:
1378  c->chrToYV12 = bgr321ToUV_c;
1379  break;
1380  case AV_PIX_FMT_BGR24:
1381  c->chrToYV12 = bgr24ToUV_c;
1382  break;
1383  case AV_PIX_FMT_BGR565LE:
1384  c->chrToYV12 = bgr16leToUV_c;
1385  break;
1386  case AV_PIX_FMT_BGR565BE:
1387  c->chrToYV12 = bgr16beToUV_c;
1388  break;
1389  case AV_PIX_FMT_BGR555LE:
1390  c->chrToYV12 = bgr15leToUV_c;
1391  break;
1392  case AV_PIX_FMT_BGR555BE:
1393  c->chrToYV12 = bgr15beToUV_c;
1394  break;
1395  case AV_PIX_FMT_BGR444LE:
1396  c->chrToYV12 = bgr12leToUV_c;
1397  break;
1398  case AV_PIX_FMT_BGR444BE:
1399  c->chrToYV12 = bgr12beToUV_c;
1400  break;
1401  case AV_PIX_FMT_BGR32:
1402  c->chrToYV12 = rgb32ToUV_c;
1403  break;
1404  case AV_PIX_FMT_BGR32_1:
1405  c->chrToYV12 = rgb321ToUV_c;
1406  break;
1407  case AV_PIX_FMT_RGB24:
1408  c->chrToYV12 = rgb24ToUV_c;
1409  break;
1410  case AV_PIX_FMT_RGB565LE:
1411  c->chrToYV12 = rgb16leToUV_c;
1412  break;
1413  case AV_PIX_FMT_RGB565BE:
1414  c->chrToYV12 = rgb16beToUV_c;
1415  break;
1416  case AV_PIX_FMT_RGB555LE:
1417  c->chrToYV12 = rgb15leToUV_c;
1418  break;
1419  case AV_PIX_FMT_RGB555BE:
1420  c->chrToYV12 = rgb15beToUV_c;
1421  break;
1422  case AV_PIX_FMT_RGB444LE:
1423  c->chrToYV12 = rgb12leToUV_c;
1424  break;
1425  case AV_PIX_FMT_RGB444BE:
1426  c->chrToYV12 = rgb12beToUV_c;
1427  break;
1428  case AV_PIX_FMT_X2RGB10LE:
1429  c->chrToYV12 = rgb30leToUV_c;
1430  break;
1431  }
1432  }
1433 
1434  c->lumToYV12 = NULL;
1435  c->alpToYV12 = NULL;
1436  switch (srcFormat) {
1437  case AV_PIX_FMT_GBRP9LE:
1438  c->readLumPlanar = planar_rgb9le_to_y;
1439  break;
1440  case AV_PIX_FMT_GBRAP10LE:
1441  c->readAlpPlanar = planar_rgb10le_to_a;
1442  case AV_PIX_FMT_GBRP10LE:
1443  c->readLumPlanar = planar_rgb10le_to_y;
1444  break;
1445  case AV_PIX_FMT_GBRAP12LE:
1446  c->readAlpPlanar = planar_rgb12le_to_a;
1447  case AV_PIX_FMT_GBRP12LE:
1448  c->readLumPlanar = planar_rgb12le_to_y;
1449  break;
1450  case AV_PIX_FMT_GBRP14LE:
1451  c->readLumPlanar = planar_rgb14le_to_y;
1452  break;
1453  case AV_PIX_FMT_GBRAP16LE:
1454  c->readAlpPlanar = planar_rgb16le_to_a;
1455  case AV_PIX_FMT_GBRP16LE:
1456  c->readLumPlanar = planar_rgb16le_to_y;
1457  break;
1458  case AV_PIX_FMT_GBRAPF32LE:
1459  c->readAlpPlanar = planar_rgbf32le_to_a;
1460  case AV_PIX_FMT_GBRPF32LE:
1461  c->readLumPlanar = planar_rgbf32le_to_y;
1462  break;
1463  case AV_PIX_FMT_GBRP9BE:
1464  c->readLumPlanar = planar_rgb9be_to_y;
1465  break;
1466  case AV_PIX_FMT_GBRAP10BE:
1467  c->readAlpPlanar = planar_rgb10be_to_a;
1468  case AV_PIX_FMT_GBRP10BE:
1469  c->readLumPlanar = planar_rgb10be_to_y;
1470  break;
1471  case AV_PIX_FMT_GBRAP12BE:
1472  c->readAlpPlanar = planar_rgb12be_to_a;
1473  case AV_PIX_FMT_GBRP12BE:
1474  c->readLumPlanar = planar_rgb12be_to_y;
1475  break;
1476  case AV_PIX_FMT_GBRP14BE:
1477  c->readLumPlanar = planar_rgb14be_to_y;
1478  break;
1479  case AV_PIX_FMT_GBRAP16BE:
1480  c->readAlpPlanar = planar_rgb16be_to_a;
1481  case AV_PIX_FMT_GBRP16BE:
1482  c->readLumPlanar = planar_rgb16be_to_y;
1483  break;
1484  case AV_PIX_FMT_GBRAPF32BE:
1485  c->readAlpPlanar = planar_rgbf32be_to_a;
1486  case AV_PIX_FMT_GBRPF32BE:
1487  c->readLumPlanar = planar_rgbf32be_to_y;
1488  break;
1489  case AV_PIX_FMT_GBRAP:
1490  c->readAlpPlanar = planar_rgb_to_a;
1491  case AV_PIX_FMT_GBRP:
1492  c->readLumPlanar = planar_rgb_to_y;
1493  break;
1494 #if HAVE_BIGENDIAN
1495  case AV_PIX_FMT_YUV420P9LE:
1496  case AV_PIX_FMT_YUV422P9LE:
1497  case AV_PIX_FMT_YUV444P9LE:
1512 
1513  case AV_PIX_FMT_GRAY9LE:
1514  case AV_PIX_FMT_GRAY10LE:
1515  case AV_PIX_FMT_GRAY12LE:
1516  case AV_PIX_FMT_GRAY14LE:
1517  case AV_PIX_FMT_GRAY16LE:
1518 
1519  case AV_PIX_FMT_P016LE:
1520  c->lumToYV12 = bswap16Y_c;
1521  break;
1533  c->lumToYV12 = bswap16Y_c;
1534  c->alpToYV12 = bswap16Y_c;
1535  break;
1536 #else
1537  case AV_PIX_FMT_YUV420P9BE:
1538  case AV_PIX_FMT_YUV422P9BE:
1539  case AV_PIX_FMT_YUV444P9BE:
1554 
1555  case AV_PIX_FMT_GRAY9BE:
1556  case AV_PIX_FMT_GRAY10BE:
1557  case AV_PIX_FMT_GRAY12BE:
1558  case AV_PIX_FMT_GRAY14BE:
1559  case AV_PIX_FMT_GRAY16BE:
1560 
1561  case AV_PIX_FMT_P016BE:
1562  c->lumToYV12 = bswap16Y_c;
1563  break;
1575  c->lumToYV12 = bswap16Y_c;
1576  c->alpToYV12 = bswap16Y_c;
1577  break;
1578 #endif
1579  case AV_PIX_FMT_YA16LE:
1580  c->lumToYV12 = read_ya16le_gray_c;
1581  break;
1582  case AV_PIX_FMT_YA16BE:
1583  c->lumToYV12 = read_ya16be_gray_c;
1584  break;
1585  case AV_PIX_FMT_AYUV64LE:
1586  c->lumToYV12 = read_ayuv64le_Y_c;
1587  break;
1588  case AV_PIX_FMT_YUYV422:
1589  case AV_PIX_FMT_YVYU422:
1590  case AV_PIX_FMT_YA8:
1591  c->lumToYV12 = yuy2ToY_c;
1592  break;
1593  case AV_PIX_FMT_UYVY422:
1594  c->lumToYV12 = uyvyToY_c;
1595  break;
1596  case AV_PIX_FMT_BGR24:
1597  c->lumToYV12 = bgr24ToY_c;
1598  break;
1599  case AV_PIX_FMT_BGR565LE:
1600  c->lumToYV12 = bgr16leToY_c;
1601  break;
1602  case AV_PIX_FMT_BGR565BE:
1603  c->lumToYV12 = bgr16beToY_c;
1604  break;
1605  case AV_PIX_FMT_BGR555LE:
1606  c->lumToYV12 = bgr15leToY_c;
1607  break;
1608  case AV_PIX_FMT_BGR555BE:
1609  c->lumToYV12 = bgr15beToY_c;
1610  break;
1611  case AV_PIX_FMT_BGR444LE:
1612  c->lumToYV12 = bgr12leToY_c;
1613  break;
1614  case AV_PIX_FMT_BGR444BE:
1615  c->lumToYV12 = bgr12beToY_c;
1616  break;
1617  case AV_PIX_FMT_RGB24:
1618  c->lumToYV12 = rgb24ToY_c;
1619  break;
1620  case AV_PIX_FMT_RGB565LE:
1621  c->lumToYV12 = rgb16leToY_c;
1622  break;
1623  case AV_PIX_FMT_RGB565BE:
1624  c->lumToYV12 = rgb16beToY_c;
1625  break;
1626  case AV_PIX_FMT_RGB555LE:
1627  c->lumToYV12 = rgb15leToY_c;
1628  break;
1629  case AV_PIX_FMT_RGB555BE:
1630  c->lumToYV12 = rgb15beToY_c;
1631  break;
1632  case AV_PIX_FMT_RGB444LE:
1633  c->lumToYV12 = rgb12leToY_c;
1634  break;
1635  case AV_PIX_FMT_RGB444BE:
1636  c->lumToYV12 = rgb12beToY_c;
1637  break;
1638  case AV_PIX_FMT_RGB8:
1639  case AV_PIX_FMT_BGR8:
1640  case AV_PIX_FMT_PAL8:
1641  case AV_PIX_FMT_BGR4_BYTE:
1642  case AV_PIX_FMT_RGB4_BYTE:
1643  c->lumToYV12 = palToY_c;
1644  break;
1645  case AV_PIX_FMT_MONOBLACK:
1646  c->lumToYV12 = monoblack2Y_c;
1647  break;
1648  case AV_PIX_FMT_MONOWHITE:
1649  c->lumToYV12 = monowhite2Y_c;
1650  break;
1651  case AV_PIX_FMT_RGB32:
1652  c->lumToYV12 = bgr32ToY_c;
1653  break;
1654  case AV_PIX_FMT_RGB32_1:
1655  c->lumToYV12 = bgr321ToY_c;
1656  break;
1657  case AV_PIX_FMT_BGR32:
1658  c->lumToYV12 = rgb32ToY_c;
1659  break;
1660  case AV_PIX_FMT_BGR32_1:
1661  c->lumToYV12 = rgb321ToY_c;
1662  break;
1663  case AV_PIX_FMT_RGB48BE:
1664  c->lumToYV12 = rgb48BEToY_c;
1665  break;
1666  case AV_PIX_FMT_RGB48LE:
1667  c->lumToYV12 = rgb48LEToY_c;
1668  break;
1669  case AV_PIX_FMT_BGR48BE:
1670  c->lumToYV12 = bgr48BEToY_c;
1671  break;
1672  case AV_PIX_FMT_BGR48LE:
1673  c->lumToYV12 = bgr48LEToY_c;
1674  break;
1675  case AV_PIX_FMT_RGBA64BE:
1676  c->lumToYV12 = rgb64BEToY_c;
1677  break;
1678  case AV_PIX_FMT_RGBA64LE:
1679  c->lumToYV12 = rgb64LEToY_c;
1680  break;
1681  case AV_PIX_FMT_BGRA64BE:
1682  c->lumToYV12 = bgr64BEToY_c;
1683  break;
1684  case AV_PIX_FMT_BGRA64LE:
1685  c->lumToYV12 = bgr64LEToY_c;
1686  break;
1687  case AV_PIX_FMT_P010LE:
1688  c->lumToYV12 = p010LEToY_c;
1689  break;
1690  case AV_PIX_FMT_P010BE:
1691  c->lumToYV12 = p010BEToY_c;
1692  break;
1693  case AV_PIX_FMT_GRAYF32LE:
1694 #if HAVE_BIGENDIAN
1695  c->lumToYV12 = grayf32ToY16_bswap_c;
1696 #else
1697  c->lumToYV12 = grayf32ToY16_c;
1698 #endif
1699  break;
1700  case AV_PIX_FMT_GRAYF32BE:
1701 #if HAVE_BIGENDIAN
1702  c->lumToYV12 = grayf32ToY16_c;
1703 #else
1704  c->lumToYV12 = grayf32ToY16_bswap_c;
1705 #endif
1706  break;
1707  case AV_PIX_FMT_Y210LE:
1708  c->lumToYV12 = y210le_Y_c;
1709  break;
1710  case AV_PIX_FMT_X2RGB10LE:
1711  c->lumToYV12 =rgb30leToY_c;
1712  break;
1713  }
1714  if (c->needAlpha) {
1715  if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
1716  if (HAVE_BIGENDIAN == !isBE(srcFormat) && !c->readAlpPlanar)
1717  c->alpToYV12 = bswap16Y_c;
1718  }
1719  switch (srcFormat) {
1720  case AV_PIX_FMT_BGRA64LE:
1721  case AV_PIX_FMT_RGBA64LE: c->alpToYV12 = rgba64leToA_c; break;
1722  case AV_PIX_FMT_BGRA64BE:
1723  case AV_PIX_FMT_RGBA64BE: c->alpToYV12 = rgba64beToA_c; break;
1724  case AV_PIX_FMT_BGRA:
1725  case AV_PIX_FMT_RGBA:
1726  c->alpToYV12 = rgbaToA_c;
1727  break;
1728  case AV_PIX_FMT_ABGR:
1729  case AV_PIX_FMT_ARGB:
1730  c->alpToYV12 = abgrToA_c;
1731  break;
1732  case AV_PIX_FMT_YA8:
1733  c->alpToYV12 = uyvyToY_c;
1734  break;
1735  case AV_PIX_FMT_YA16LE:
1736  c->alpToYV12 = read_ya16le_alpha_c;
1737  break;
1738  case AV_PIX_FMT_YA16BE:
1739  c->alpToYV12 = read_ya16be_alpha_c;
1740  break;
1741  case AV_PIX_FMT_AYUV64LE:
1742  c->alpToYV12 = read_ayuv64le_A_c;
1743  break;
1744  case AV_PIX_FMT_PAL8 :
1745  c->alpToYV12 = palToA_c;
1746  break;
1747  }
1748  }
1749 }
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:567
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_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:427
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:546
AV_PIX_FMT_BGR32
#define AV_PIX_FMT_BGR32
Definition: pixfmt.h:364
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:720
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:943
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
bsrc
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT uint8_t const uint8_t const uint8_t * bsrc
Definition: input.c:398
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:575
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:834
bu
int32_t bu
Definition: input.c:403
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:527
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
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:363
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:978
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:997
rgb16_32_wrapper
#define rgb16_32_wrapper(fmt, name, shr, shg, shb, shp, maskr, maskg, maskb, rsh, gsh, bsh, S)
Definition: input.c:350
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:764
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:388
av_int2float
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
Definition: intfloat.h:40
grayf32ToY16_bswap_c
static av_always_inline void grayf32ToY16_bswap_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
Definition: input.c:1028
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:800
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, uint32_t *unused)
Definition: input.c:1016
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:688
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:455
rgb321
RGB2YUV_SHIFT rgb321
Definition: input.c:382
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:394
gsrc
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT uint8_t const uint8_t * gsrc
Definition: input.c:398
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:702
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:695
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
av_bswap32
#define av_bswap32
Definition: bswap.h:33
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:753
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:111
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:967
AV_PIX_FMT_GBRAP16BE
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
Definition: pixfmt.h:206
intreadwrite.h
AV_PIX_FMT_GBRP16LE
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
Definition: pixfmt.h:165
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:667
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:365
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:872
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
rgb2yuv
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT uint8_t const uint8_t const uint8_t const uint8_t int uint32_t * rgb2yuv
Definition: input.c:400
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:466
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
rv
int32_t rv
Definition: input.c:404
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:742
rgb9plus_planar_transparency_funcs
#define rgb9plus_planar_transparency_funcs(nbits)
Definition: input.c:1052
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:731
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_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
_dstV
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT uint8_t * _dstV
Definition: input.c:397
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_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
src
#define src
Definition: vp8dsp.c:255
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:913
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:649
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:278
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:386
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
width
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT uint8_t const uint8_t const uint8_t const uint8_t int width
Definition: input.c:399
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:606
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:639
gu
int32_t gu
Definition: input.c:403
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:930
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:1064
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:446
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:598
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:362
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
rsrc
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT uint8_t const uint8_t const uint8_t const uint8_t * rsrc
Definition: input.c:398
nvXXtoUV_c
static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2, const uint8_t *src, int width)
Definition: input.c:678
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:622
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
src1
#define src1
Definition: h264pred.c:140
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
i
int i
Definition: input.c:406
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
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
bv
int32_t bv
Definition: input.c:404
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:965
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
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:510
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:766
gv
int32_t gv
Definition: input.c:404
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:557
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:630
rgb16be
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT rgb16be
Definition: input.c:392
ru
int32_t ru
Definition: input.c:403
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:306
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:614
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:819
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:585
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:659
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:853
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:417
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:437
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
dstV
uint16_t * dstV
Definition: input.c:402
bgr15be
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT bgr15be
Definition: input.c:390
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:477
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_clip_uint16
#define av_clip_uint16
Definition: common.h:108
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:83
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:894
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:493
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:886
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_GRAY14LE
@ AV_PIX_FMT_GRAY14LE
Y , 14bpp, little-endian.
Definition: pixfmt.h:328
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:535
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:156
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:380
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:711
swscale.h
bgr15le
RGB2YUV_SHIFT RGB2YUV_SHIFT bgr15le
Definition: input.c:384
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:781
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