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/cpu.h"
29 #include "libavutil/intreadwrite.h"
30 #include "libavutil/mathematics.h"
31 #include "libavutil/pixdesc.h"
32 #include "libavutil/avassert.h"
33 #include "config.h"
34 #include "rgb2rgb.h"
35 #include "swscale.h"
36 #include "swscale_internal.h"
37 
38 #define input_pixel(pos) (isBE(origin) ? AV_RB16(pos) : AV_RL16(pos))
39 
40 #define r ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? b_r : r_b)
41 #define b ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? r_b : b_r)
42 
43 static av_always_inline void
44 rgb64ToY_c_template(uint16_t *dst, const uint16_t *src, int width,
45  enum AVPixelFormat origin, int32_t *rgb2yuv)
46 {
47  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
48  int i;
49  for (i = 0; i < width; i++) {
50  unsigned int r_b = input_pixel(&src[i*4+0]);
51  unsigned int g = input_pixel(&src[i*4+1]);
52  unsigned int b_r = input_pixel(&src[i*4+2]);
53 
54  dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
55  }
56 }
57 
58 static av_always_inline void
59 rgb64ToUV_c_template(uint16_t *dstU, uint16_t *dstV,
60  const uint16_t *src1, const uint16_t *src2,
61  int width, enum AVPixelFormat origin, int32_t *rgb2yuv)
62 {
63  int i;
66  av_assert1(src1==src2);
67  for (i = 0; i < width; i++) {
68  int r_b = input_pixel(&src1[i*4+0]);
69  int g = input_pixel(&src1[i*4+1]);
70  int b_r = input_pixel(&src1[i*4+2]);
71 
72  dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
73  dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
74  }
75 }
76 
77 static av_always_inline void
78 rgb64ToUV_half_c_template(uint16_t *dstU, uint16_t *dstV,
79  const uint16_t *src1, const uint16_t *src2,
80  int width, enum AVPixelFormat origin, int32_t *rgb2yuv)
81 {
82  int i;
85  av_assert1(src1==src2);
86  for (i = 0; i < width; i++) {
87  int r_b = (input_pixel(&src1[8 * i + 0]) + input_pixel(&src1[8 * i + 4]) + 1) >> 1;
88  int g = (input_pixel(&src1[8 * i + 1]) + input_pixel(&src1[8 * i + 5]) + 1) >> 1;
89  int b_r = (input_pixel(&src1[8 * i + 2]) + input_pixel(&src1[8 * i + 6]) + 1) >> 1;
90 
91  dstU[i]= (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
92  dstV[i]= (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
93  }
94 }
95 
96 #define rgb64funcs(pattern, BE_LE, origin) \
97 static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, const uint8_t *unused1,\
98  int width, uint32_t *rgb2yuv) \
99 { \
100  const uint16_t *src = (const uint16_t *) _src; \
101  uint16_t *dst = (uint16_t *) _dst; \
102  rgb64ToY_c_template(dst, src, width, origin, rgb2yuv); \
103 } \
104  \
105 static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
106  const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
107  int width, uint32_t *rgb2yuv) \
108 { \
109  const uint16_t *src1 = (const uint16_t *) _src1, \
110  *src2 = (const uint16_t *) _src2; \
111  uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
112  rgb64ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv); \
113 } \
114  \
115 static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, \
116  const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
117  int width, uint32_t *rgb2yuv) \
118 { \
119  const uint16_t *src1 = (const uint16_t *) _src1, \
120  *src2 = (const uint16_t *) _src2; \
121  uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
122  rgb64ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv); \
123 }
124 
129 
130 static av_always_inline void rgb48ToY_c_template(uint16_t *dst,
131  const uint16_t *src, int width,
132  enum AVPixelFormat origin,
133  int32_t *rgb2yuv)
134 {
135  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
136  int i;
137  for (i = 0; i < width; i++) {
138  unsigned int r_b = input_pixel(&src[i * 3 + 0]);
139  unsigned int g = input_pixel(&src[i * 3 + 1]);
140  unsigned int b_r = input_pixel(&src[i * 3 + 2]);
141 
142  dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
143  }
144 }
145 
146 static av_always_inline void rgb48ToUV_c_template(uint16_t *dstU,
147  uint16_t *dstV,
148  const uint16_t *src1,
149  const uint16_t *src2,
150  int width,
151  enum AVPixelFormat origin,
152  int32_t *rgb2yuv)
153 {
154  int i;
157  av_assert1(src1 == src2);
158  for (i = 0; i < width; i++) {
159  int r_b = input_pixel(&src1[i * 3 + 0]);
160  int g = input_pixel(&src1[i * 3 + 1]);
161  int b_r = input_pixel(&src1[i * 3 + 2]);
162 
163  dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
164  dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
165  }
166 }
167 
168 static av_always_inline void rgb48ToUV_half_c_template(uint16_t *dstU,
169  uint16_t *dstV,
170  const uint16_t *src1,
171  const uint16_t *src2,
172  int width,
173  enum AVPixelFormat origin,
174  int32_t *rgb2yuv)
175 {
176  int i;
179  av_assert1(src1 == src2);
180  for (i = 0; i < width; i++) {
181  int r_b = (input_pixel(&src1[6 * i + 0]) +
182  input_pixel(&src1[6 * i + 3]) + 1) >> 1;
183  int g = (input_pixel(&src1[6 * i + 1]) +
184  input_pixel(&src1[6 * i + 4]) + 1) >> 1;
185  int b_r = (input_pixel(&src1[6 * i + 2]) +
186  input_pixel(&src1[6 * i + 5]) + 1) >> 1;
187 
188  dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
189  dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
190  }
191 }
192 
193 #undef r
194 #undef b
195 #undef input_pixel
196 
197 #define rgb48funcs(pattern, BE_LE, origin) \
198 static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst, \
199  const uint8_t *_src, \
200  const uint8_t *unused0, const uint8_t *unused1,\
201  int width, \
202  uint32_t *rgb2yuv) \
203 { \
204  const uint16_t *src = (const uint16_t *)_src; \
205  uint16_t *dst = (uint16_t *)_dst; \
206  rgb48ToY_c_template(dst, src, width, origin, rgb2yuv); \
207 } \
208  \
209 static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU, \
210  uint8_t *_dstV, \
211  const uint8_t *unused0, \
212  const uint8_t *_src1, \
213  const uint8_t *_src2, \
214  int width, \
215  uint32_t *rgb2yuv) \
216 { \
217  const uint16_t *src1 = (const uint16_t *)_src1, \
218  *src2 = (const uint16_t *)_src2; \
219  uint16_t *dstU = (uint16_t *)_dstU, \
220  *dstV = (uint16_t *)_dstV; \
221  rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv); \
222 } \
223  \
224 static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, \
225  uint8_t *_dstV, \
226  const uint8_t *unused0, \
227  const uint8_t *_src1, \
228  const uint8_t *_src2, \
229  int width, \
230  uint32_t *rgb2yuv) \
231 { \
232  const uint16_t *src1 = (const uint16_t *)_src1, \
233  *src2 = (const uint16_t *)_src2; \
234  uint16_t *dstU = (uint16_t *)_dstU, \
235  *dstV = (uint16_t *)_dstV; \
236  rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv); \
237 }
238 
243 
244 #define input_pixel(i) ((origin == AV_PIX_FMT_RGBA || \
245  origin == AV_PIX_FMT_BGRA || \
246  origin == AV_PIX_FMT_ARGB || \
247  origin == AV_PIX_FMT_ABGR) \
248  ? AV_RN32A(&src[(i) * 4]) \
249  : ((origin == AV_PIX_FMT_X2RGB10LE) \
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 
398 static void gbr24pToUV_half_c(uint8_t *_dstU, uint8_t *_dstV,
399  const uint8_t *gsrc, const uint8_t *bsrc, const uint8_t *rsrc,
400  int width, uint32_t *rgb2yuv)
401 {
402  uint16_t *dstU = (uint16_t *)_dstU;
403  uint16_t *dstV = (uint16_t *)_dstV;
406 
407  int i;
408  for (i = 0; i < width; i++) {
409  unsigned int g = gsrc[2*i] + gsrc[2*i+1];
410  unsigned int b = bsrc[2*i] + bsrc[2*i+1];
411  unsigned int r = rsrc[2*i] + rsrc[2*i+1];
412 
413  dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
414  dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-6))) >> (RGB2YUV_SHIFT-6+1);
415  }
416 }
417 
418 static void rgba64leToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
419  const uint8_t *unused2, int width, uint32_t *unused)
420 {
421  int16_t *dst = (int16_t *)_dst;
422  const uint16_t *src = (const uint16_t *)_src;
423  int i;
424  for (i = 0; i < width; i++)
425  dst[i] = AV_RL16(src + 4 * i + 3);
426 }
427 
428 static void rgba64beToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
429  const uint8_t *unused2, int width, uint32_t *unused)
430 {
431  int16_t *dst = (int16_t *)_dst;
432  const uint16_t *src = (const uint16_t *)_src;
433  int i;
434  for (i = 0; i < width; i++)
435  dst[i] = AV_RB16(src + 4 * i + 3);
436 }
437 
438 static void abgrToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
439 {
440  int16_t *dst = (int16_t *)_dst;
441  int i;
442  for (i=0; i<width; i++) {
443  dst[i]= src[4*i]<<6 | src[4*i]>>2;
444  }
445 }
446 
447 static void rgbaToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
448 {
449  int16_t *dst = (int16_t *)_dst;
450  int i;
451  for (i=0; i<width; i++) {
452  dst[i]= src[4*i+3]<<6 | src[4*i+3]>>2;
453  }
454 }
455 
456 static void palToA_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *pal)
457 {
458  int16_t *dst = (int16_t *)_dst;
459  int i;
460  for (i=0; i<width; i++) {
461  int d= src[i];
462 
463  dst[i]= (pal[d] >> 24)<<6 | pal[d]>>26;
464  }
465 }
466 
467 static void palToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *pal)
468 {
469  int16_t *dst = (int16_t *)_dst;
470  int i;
471  for (i = 0; i < width; i++) {
472  int d = src[i];
473 
474  dst[i] = (pal[d] & 0xFF)<<6;
475  }
476 }
477 
478 static void palToUV_c(uint8_t *_dstU, uint8_t *_dstV,
479  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
480  int width, uint32_t *pal)
481 {
482  uint16_t *dstU = (uint16_t *)_dstU;
483  int16_t *dstV = (int16_t *)_dstV;
484  int i;
485  av_assert1(src1 == src2);
486  for (i = 0; i < width; i++) {
487  int p = pal[src1[i]];
488 
489  dstU[i] = (uint8_t)(p>> 8)<<6;
490  dstV[i] = (uint8_t)(p>>16)<<6;
491  }
492 }
493 
494 static void monowhite2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
495 {
496  int16_t *dst = (int16_t *)_dst;
497  int i, j;
498  width = (width + 7) >> 3;
499  for (i = 0; i < width; i++) {
500  int d = ~src[i];
501  for (j = 0; j < 8; j++)
502  dst[8*i+j]= ((d>>(7-j))&1) * 16383;
503  }
504  if(width&7){
505  int d= ~src[i];
506  for (j = 0; j < (width&7); j++)
507  dst[8*i+j]= ((d>>(7-j))&1) * 16383;
508  }
509 }
510 
511 static void monoblack2Y_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused)
512 {
513  int16_t *dst = (int16_t *)_dst;
514  int i, j;
515  width = (width + 7) >> 3;
516  for (i = 0; i < width; i++) {
517  int d = src[i];
518  for (j = 0; j < 8; j++)
519  dst[8*i+j]= ((d>>(7-j))&1) * 16383;
520  }
521  if(width&7){
522  int d = src[i];
523  for (j = 0; j < (width&7); j++)
524  dst[8*i+j] = ((d>>(7-j))&1) * 16383;
525  }
526 }
527 
528 static void yuy2ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
529  uint32_t *unused)
530 {
531  int i;
532  for (i = 0; i < width; i++)
533  dst[i] = src[2 * i];
534 }
535 
536 static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
537  const uint8_t *src2, int width, uint32_t *unused)
538 {
539  int i;
540  for (i = 0; i < width; i++) {
541  dstU[i] = src1[4 * i + 1];
542  dstV[i] = src1[4 * i + 3];
543  }
544  av_assert1(src1 == src2);
545 }
546 
547 static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
548  const uint8_t *src2, int width, uint32_t *unused)
549 {
550  int i;
551  for (i = 0; i < width; i++) {
552  dstV[i] = src1[4 * i + 1];
553  dstU[i] = src1[4 * i + 3];
554  }
555  av_assert1(src1 == src2);
556 }
557 
558 static void y210le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
559  const uint8_t *unused1, int width, uint32_t *unused2)
560 {
561  int i;
562  for (i = 0; i < width; i++) {
563  AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> 6);
564  AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> 6);
565  }
566 }
567 
568 static void y210le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0,
569  const uint8_t *unused1, int width, uint32_t *unused2)
570 {
571  int i;
572  for (i = 0; i < width; i++)
573  AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> 6);
574 }
575 
576 static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width,
577  uint32_t *unused)
578 {
579  int i;
580  const uint16_t *src = (const uint16_t *)_src;
581  uint16_t *dst = (uint16_t *)_dst;
582  for (i = 0; i < width; i++)
583  dst[i] = av_bswap16(src[i]);
584 }
585 
586 static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *_src1,
587  const uint8_t *_src2, int width, uint32_t *unused)
588 {
589  int i;
590  const uint16_t *src1 = (const uint16_t *)_src1,
591  *src2 = (const uint16_t *)_src2;
592  uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
593  for (i = 0; i < width; i++) {
594  dstU[i] = av_bswap16(src1[i]);
595  dstV[i] = av_bswap16(src2[i]);
596  }
597 }
598 
599 static void read_ya16le_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
600  uint32_t *unused)
601 {
602  int i;
603  for (i = 0; i < width; i++)
604  AV_WN16(dst + i * 2, AV_RL16(src + i * 4));
605 }
606 
607 static void read_ya16le_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
608  uint32_t *unused)
609 {
610  int i;
611  for (i = 0; i < width; i++)
612  AV_WN16(dst + i * 2, AV_RL16(src + i * 4 + 2));
613 }
614 
615 static void read_ya16be_gray_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
616  uint32_t *unused)
617 {
618  int i;
619  for (i = 0; i < width; i++)
620  AV_WN16(dst + i * 2, AV_RB16(src + i * 4));
621 }
622 
623 static void read_ya16be_alpha_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
624  uint32_t *unused)
625 {
626  int i;
627  for (i = 0; i < width; i++)
628  AV_WN16(dst + i * 2, AV_RB16(src + i * 4 + 2));
629 }
630 
631 static void read_ayuv64le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
632  uint32_t *unused2)
633 {
634  int i;
635  for (i = 0; i < width; i++)
636  AV_WN16(dst + i * 2, AV_RL16(src + i * 8 + 2));
637 }
638 
639 
640 static void read_ayuv64le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
641  const uint8_t *unused1, int width, uint32_t *unused2)
642 {
643  int i;
644  for (i = 0; i < width; i++) {
645  AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 4));
646  AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6));
647  }
648 }
649 
650 static void read_ayuv64le_A_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, const uint8_t *unused1, int width,
651  uint32_t *unused2)
652 {
653  int i;
654  for (i = 0; i < width; i++)
655  AV_WN16(dst + i * 2, AV_RL16(src + i * 8));
656 }
657 
658 /* This is almost identical to the previous, end exists only because
659  * yuy2ToY/UV)(dst, src + 1, ...) would have 100% unaligned accesses. */
660 static void uyvyToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
661  uint32_t *unused)
662 {
663  int i;
664  for (i = 0; i < width; i++)
665  dst[i] = src[2 * i + 1];
666 }
667 
668 static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
669  const uint8_t *src2, int width, uint32_t *unused)
670 {
671  int i;
672  for (i = 0; i < width; i++) {
673  dstU[i] = src1[4 * i + 0];
674  dstV[i] = src1[4 * i + 2];
675  }
676  av_assert1(src1 == src2);
677 }
678 
679 static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2,
680  const uint8_t *src, int width)
681 {
682  int i;
683  for (i = 0; i < width; i++) {
684  dst1[i] = src[2 * i + 0];
685  dst2[i] = src[2 * i + 1];
686  }
687 }
688 
689 static void nv12ToUV_c(uint8_t *dstU, uint8_t *dstV,
690  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
691  int width, uint32_t *unused)
692 {
693  nvXXtoUV_c(dstU, dstV, src1, width);
694 }
695 
696 static void nv21ToUV_c(uint8_t *dstU, uint8_t *dstV,
697  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
698  int width, uint32_t *unused)
699 {
700  nvXXtoUV_c(dstV, dstU, src1, width);
701 }
702 
703 static void p010LEToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1,
704  const uint8_t *unused2, int width, uint32_t *unused)
705 {
706  int i;
707  for (i = 0; i < width; i++) {
708  AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> 6);
709  }
710 }
711 
712 static void p010BEToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1,
713  const uint8_t *unused2, int width, uint32_t *unused)
714 {
715  int i;
716  for (i = 0; i < width; i++) {
717  AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> 6);
718  }
719 }
720 
721 static void p010LEToUV_c(uint8_t *dstU, uint8_t *dstV,
722  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
723  int width, uint32_t *unused)
724 {
725  int i;
726  for (i = 0; i < width; i++) {
727  AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0) >> 6);
728  AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2) >> 6);
729  }
730 }
731 
732 static void p010BEToUV_c(uint8_t *dstU, uint8_t *dstV,
733  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
734  int width, uint32_t *unused)
735 {
736  int i;
737  for (i = 0; i < width; i++) {
738  AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0) >> 6);
739  AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2) >> 6);
740  }
741 }
742 
743 static void p016LEToUV_c(uint8_t *dstU, uint8_t *dstV,
744  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
745  int width, uint32_t *unused)
746 {
747  int i;
748  for (i = 0; i < width; i++) {
749  AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0));
750  AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2));
751  }
752 }
753 
754 static void p016BEToUV_c(uint8_t *dstU, uint8_t *dstV,
755  const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2,
756  int width, uint32_t *unused)
757 {
758  int i;
759  for (i = 0; i < width; i++) {
760  AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0));
761  AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2));
762  }
763 }
764 
765 #define input_pixel(pos) (isBE(origin) ? AV_RB16(pos) : AV_RL16(pos))
766 
767 static void bgr24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2,
768  int width, uint32_t *rgb2yuv)
769 {
770  int16_t *dst = (int16_t *)_dst;
771  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
772  int i;
773  for (i = 0; i < width; i++) {
774  int b = src[i * 3 + 0];
775  int g = src[i * 3 + 1];
776  int r = src[i * 3 + 2];
777 
778  dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
779  }
780 }
781 
782 static void bgr24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
783  const uint8_t *src2, int width, uint32_t *rgb2yuv)
784 {
785  int16_t *dstU = (int16_t *)_dstU;
786  int16_t *dstV = (int16_t *)_dstV;
789  int i;
790  for (i = 0; i < width; i++) {
791  int b = src1[3 * i + 0];
792  int g = src1[3 * i + 1];
793  int r = src1[3 * i + 2];
794 
795  dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
796  dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
797  }
798  av_assert1(src1 == src2);
799 }
800 
801 static void bgr24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
802  const uint8_t *src2, int width, uint32_t *rgb2yuv)
803 {
804  int16_t *dstU = (int16_t *)_dstU;
805  int16_t *dstV = (int16_t *)_dstV;
806  int i;
809  for (i = 0; i < width; i++) {
810  int b = src1[6 * i + 0] + src1[6 * i + 3];
811  int g = src1[6 * i + 1] + src1[6 * i + 4];
812  int r = src1[6 * i + 2] + src1[6 * i + 5];
813 
814  dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
815  dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
816  }
817  av_assert1(src1 == src2);
818 }
819 
820 static void rgb24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, int width,
821  uint32_t *rgb2yuv)
822 {
823  int16_t *dst = (int16_t *)_dst;
824  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
825  int i;
826  for (i = 0; i < width; i++) {
827  int r = src[i * 3 + 0];
828  int g = src[i * 3 + 1];
829  int b = src[i * 3 + 2];
830 
831  dst[i] = ((ry*r + gy*g + by*b + (32<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6));
832  }
833 }
834 
835 static void rgb24ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
836  const uint8_t *src2, int width, uint32_t *rgb2yuv)
837 {
838  int16_t *dstU = (int16_t *)_dstU;
839  int16_t *dstV = (int16_t *)_dstV;
840  int i;
843  av_assert1(src1 == src2);
844  for (i = 0; i < width; i++) {
845  int r = src1[3 * i + 0];
846  int g = src1[3 * i + 1];
847  int b = src1[3 * i + 2];
848 
849  dstU[i] = (ru*r + gu*g + bu*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
850  dstV[i] = (rv*r + gv*g + bv*b + (256<<(RGB2YUV_SHIFT-1)) + (1<<(RGB2YUV_SHIFT-7)))>>(RGB2YUV_SHIFT-6);
851  }
852 }
853 
854 static void rgb24ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused0, const uint8_t *src1,
855  const uint8_t *src2, int width, uint32_t *rgb2yuv)
856 {
857  int16_t *dstU = (int16_t *)_dstU;
858  int16_t *dstV = (int16_t *)_dstV;
859  int i;
862  av_assert1(src1 == src2);
863  for (i = 0; i < width; i++) {
864  int r = src1[6 * i + 0] + src1[6 * i + 3];
865  int g = src1[6 * i + 1] + src1[6 * i + 4];
866  int b = src1[6 * i + 2] + src1[6 * i + 5];
867 
868  dstU[i] = (ru*r + gu*g + bu*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
869  dstV[i] = (rv*r + gv*g + bv*b + (256<<RGB2YUV_SHIFT) + (1<<(RGB2YUV_SHIFT-6)))>>(RGB2YUV_SHIFT-5);
870  }
871 }
872 
873 static void planar_rgb_to_y(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *rgb2yuv)
874 {
875  uint16_t *dst = (uint16_t *)_dst;
876  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
877  int i;
878  for (i = 0; i < width; i++) {
879  int g = src[0][i];
880  int b = src[1][i];
881  int r = src[2][i];
882 
883  dst[i] = (ry*r + gy*g + by*b + (0x801<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
884  }
885 }
886 
887 static void planar_rgb_to_a(uint8_t *_dst, const uint8_t *src[4], int width, int32_t *unused)
888 {
889  uint16_t *dst = (uint16_t *)_dst;
890  int i;
891  for (i = 0; i < width; i++)
892  dst[i] = src[3][i] << 6;
893 }
894 
895 static void planar_rgb_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4], int width, int32_t *rgb2yuv)
896 {
897  uint16_t *dstU = (uint16_t *)_dstU;
898  uint16_t *dstV = (uint16_t *)_dstV;
901  int i;
902  for (i = 0; i < width; i++) {
903  int g = src[0][i];
904  int b = src[1][i];
905  int r = src[2][i];
906 
907  dstU[i] = (ru*r + gu*g + bu*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
908  dstV[i] = (rv*r + gv*g + bv*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
909  }
910 }
911 
912 #define rdpx(src) \
913  is_be ? AV_RB16(src) : AV_RL16(src)
914 static av_always_inline void planar_rgb16_to_y(uint8_t *_dst, const uint8_t *_src[4],
915  int width, int bpc, int is_be, int32_t *rgb2yuv)
916 {
917  int i;
918  const uint16_t **src = (const uint16_t **)_src;
919  uint16_t *dst = (uint16_t *)_dst;
920  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
921  int shift = bpc < 16 ? bpc : 14;
922  for (i = 0; i < width; i++) {
923  int g = rdpx(src[0] + i);
924  int b = rdpx(src[1] + i);
925  int r = rdpx(src[2] + i);
926 
927  dst[i] = (ry*r + gy*g + by*b + (16 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
928  }
929 }
930 
931 static av_always_inline void planar_rgb16_to_a(uint8_t *_dst, const uint8_t *_src[4],
932  int width, int bpc, int is_be, int32_t *rgb2yuv)
933 {
934  int i;
935  const uint16_t **src = (const uint16_t **)_src;
936  uint16_t *dst = (uint16_t *)_dst;
937  int shift = bpc < 16 ? bpc : 14;
938 
939  for (i = 0; i < width; i++) {
940  dst[i] = rdpx(src[3] + i) << (14 - shift);
941  }
942 }
943 
944 static av_always_inline void planar_rgb16_to_uv(uint8_t *_dstU, uint8_t *_dstV,
945  const uint8_t *_src[4], int width,
946  int bpc, int is_be, int32_t *rgb2yuv)
947 {
948  int i;
949  const uint16_t **src = (const uint16_t **)_src;
950  uint16_t *dstU = (uint16_t *)_dstU;
951  uint16_t *dstV = (uint16_t *)_dstV;
954  int shift = bpc < 16 ? bpc : 14;
955  for (i = 0; i < width; i++) {
956  int g = rdpx(src[0] + i);
957  int b = rdpx(src[1] + i);
958  int r = rdpx(src[2] + i);
959 
960  dstU[i] = (ru*r + gu*g + bu*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
961  dstV[i] = (rv*r + gv*g + bv*b + (128 << (RGB2YUV_SHIFT + bpc - 8)) + (1 << (RGB2YUV_SHIFT + shift - 15))) >> (RGB2YUV_SHIFT + shift - 14);
962  }
963 }
964 #undef rdpx
965 
966 #define rdpx(src) (is_be ? av_int2float(AV_RB32(src)): av_int2float(AV_RL32(src)))
967 
968 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)
969 {
970  int i;
971  const float **src = (const float **)_src;
972  uint16_t *dst = (uint16_t *)_dst;
973 
974  for (i = 0; i < width; i++) {
975  dst[i] = av_clip_uint16(lrintf(65535.0f * rdpx(src[3] + i)));
976  }
977 }
978 
979 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)
980 {
981  int i;
982  const float **src = (const float **)_src;
983  uint16_t *dstU = (uint16_t *)_dstU;
984  uint16_t *dstV = (uint16_t *)_dstV;
987 
988  for (i = 0; i < width; i++) {
989  int g = av_clip_uint16(lrintf(65535.0f * rdpx(src[0] + i)));
990  int b = av_clip_uint16(lrintf(65535.0f * rdpx(src[1] + i)));
991  int r = av_clip_uint16(lrintf(65535.0f * rdpx(src[2] + i)));
992 
993  dstU[i] = (ru*r + gu*g + bu*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
994  dstV[i] = (rv*r + gv*g + bv*b + (0x10001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
995  }
996 }
997 
998 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)
999 {
1000  int i;
1001  const float **src = (const float **)_src;
1002  uint16_t *dst = (uint16_t *)_dst;
1003 
1004  int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by = rgb2yuv[BY_IDX];
1005 
1006  for (i = 0; i < width; i++) {
1007  int g = av_clip_uint16(lrintf(65535.0f * rdpx(src[0] + i)));
1008  int b = av_clip_uint16(lrintf(65535.0f * rdpx(src[1] + i)));
1009  int r = av_clip_uint16(lrintf(65535.0f * rdpx(src[2] + i)));
1010 
1011  dst[i] = (ry*r + gy*g + by*b + (0x2001 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT;
1012  }
1013 }
1014 
1015 #undef rdpx
1016 
1017 static av_always_inline void grayf32ToY16_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1018  const uint8_t *unused2, int width, uint32_t *unused)
1019 {
1020  int i;
1021  const float *src = (const float *)_src;
1022  uint16_t *dst = (uint16_t *)_dst;
1023 
1024  for (i = 0; i < width; ++i){
1025  dst[i] = av_clip_uint16(lrintf(65535.0f * src[i]));
1026  }
1027 }
1028 
1029 static av_always_inline void grayf32ToY16_bswap_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1,
1030  const uint8_t *unused2, int width, uint32_t *unused)
1031 {
1032  int i;
1033  const uint32_t *src = (const uint32_t *)_src;
1034  uint16_t *dst = (uint16_t *)_dst;
1035 
1036  for (i = 0; i < width; ++i){
1037  dst[i] = av_clip_uint16(lrintf(65535.0f * av_int2float(av_bswap32(src[i]))));
1038  }
1039 }
1040 
1041 #define rgb9plus_planar_funcs_endian(nbits, endian_name, endian) \
1042 static void planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1043  int w, int32_t *rgb2yuv) \
1044 { \
1045  planar_rgb16_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1046 } \
1047 static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1048  const uint8_t *src[4], int w, int32_t *rgb2yuv) \
1049 { \
1050  planar_rgb16_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1051 } \
1052 
1053 #define rgb9plus_planar_transparency_funcs(nbits) \
1054 static void planar_rgb##nbits##le_to_a(uint8_t *dst, const uint8_t *src[4], \
1055  int w, int32_t *rgb2yuv) \
1056 { \
1057  planar_rgb16_to_a(dst, src, w, nbits, 0, rgb2yuv); \
1058 } \
1059 static void planar_rgb##nbits##be_to_a(uint8_t *dst, const uint8_t *src[4], \
1060  int w, int32_t *rgb2yuv) \
1061 { \
1062  planar_rgb16_to_a(dst, src, w, nbits, 1, rgb2yuv); \
1063 }
1064 
1065 #define rgb9plus_planar_funcs(nbits) \
1066  rgb9plus_planar_funcs_endian(nbits, le, 0) \
1067  rgb9plus_planar_funcs_endian(nbits, be, 1)
1068 
1074 
1078 
1079 #define rgbf32_planar_funcs_endian(endian_name, endian) \
1080 static void planar_rgbf32##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1081  int w, int32_t *rgb2yuv) \
1082 { \
1083  planar_rgbf32_to_y(dst, src, w, endian, rgb2yuv); \
1084 } \
1085 static void planar_rgbf32##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1086  const uint8_t *src[4], int w, int32_t *rgb2yuv) \
1087 { \
1088  planar_rgbf32_to_uv(dstU, dstV, src, w, endian, rgb2yuv); \
1089 } \
1090 static void planar_rgbf32##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1091  int w, int32_t *rgb2yuv) \
1092 { \
1093  planar_rgbf32_to_a(dst, src, w, endian, rgb2yuv); \
1094 }
1095 
1098 
1100 {
1101  enum AVPixelFormat srcFormat = c->srcFormat;
1102 
1103  c->chrToYV12 = NULL;
1104  switch (srcFormat) {
1105  case AV_PIX_FMT_YUYV422:
1106  c->chrToYV12 = yuy2ToUV_c;
1107  break;
1108  case AV_PIX_FMT_YVYU422:
1109  c->chrToYV12 = yvy2ToUV_c;
1110  break;
1111  case AV_PIX_FMT_UYVY422:
1112  c->chrToYV12 = uyvyToUV_c;
1113  break;
1114  case AV_PIX_FMT_NV12:
1115  case AV_PIX_FMT_NV24:
1116  c->chrToYV12 = nv12ToUV_c;
1117  break;
1118  case AV_PIX_FMT_NV21:
1119  case AV_PIX_FMT_NV42:
1120  c->chrToYV12 = nv21ToUV_c;
1121  break;
1122  case AV_PIX_FMT_RGB8:
1123  case AV_PIX_FMT_BGR8:
1124  case AV_PIX_FMT_PAL8:
1125  case AV_PIX_FMT_BGR4_BYTE:
1126  case AV_PIX_FMT_RGB4_BYTE:
1127  c->chrToYV12 = palToUV_c;
1128  break;
1129  case AV_PIX_FMT_GBRP9LE:
1130  c->readChrPlanar = planar_rgb9le_to_uv;
1131  break;
1132  case AV_PIX_FMT_GBRAP10LE:
1133  case AV_PIX_FMT_GBRP10LE:
1134  c->readChrPlanar = planar_rgb10le_to_uv;
1135  break;
1136  case AV_PIX_FMT_GBRAP12LE:
1137  case AV_PIX_FMT_GBRP12LE:
1138  c->readChrPlanar = planar_rgb12le_to_uv;
1139  break;
1140  case AV_PIX_FMT_GBRP14LE:
1141  c->readChrPlanar = planar_rgb14le_to_uv;
1142  break;
1143  case AV_PIX_FMT_GBRAP16LE:
1144  case AV_PIX_FMT_GBRP16LE:
1145  c->readChrPlanar = planar_rgb16le_to_uv;
1146  break;
1147  case AV_PIX_FMT_GBRAPF32LE:
1148  case AV_PIX_FMT_GBRPF32LE:
1149  c->readChrPlanar = planar_rgbf32le_to_uv;
1150  break;
1151  case AV_PIX_FMT_GBRP9BE:
1152  c->readChrPlanar = planar_rgb9be_to_uv;
1153  break;
1154  case AV_PIX_FMT_GBRAP10BE:
1155  case AV_PIX_FMT_GBRP10BE:
1156  c->readChrPlanar = planar_rgb10be_to_uv;
1157  break;
1158  case AV_PIX_FMT_GBRAP12BE:
1159  case AV_PIX_FMT_GBRP12BE:
1160  c->readChrPlanar = planar_rgb12be_to_uv;
1161  break;
1162  case AV_PIX_FMT_GBRP14BE:
1163  c->readChrPlanar = planar_rgb14be_to_uv;
1164  break;
1165  case AV_PIX_FMT_GBRAP16BE:
1166  case AV_PIX_FMT_GBRP16BE:
1167  c->readChrPlanar = planar_rgb16be_to_uv;
1168  break;
1169  case AV_PIX_FMT_GBRAPF32BE:
1170  case AV_PIX_FMT_GBRPF32BE:
1171  c->readChrPlanar = planar_rgbf32be_to_uv;
1172  break;
1173  case AV_PIX_FMT_GBRAP:
1174  case AV_PIX_FMT_GBRP:
1175  c->readChrPlanar = planar_rgb_to_uv;
1176  break;
1177 #if HAVE_BIGENDIAN
1178  case AV_PIX_FMT_YUV420P9LE:
1179  case AV_PIX_FMT_YUV422P9LE:
1180  case AV_PIX_FMT_YUV444P9LE:
1195 
1207  c->chrToYV12 = bswap16UV_c;
1208  break;
1209 #else
1210  case AV_PIX_FMT_YUV420P9BE:
1211  case AV_PIX_FMT_YUV422P9BE:
1212  case AV_PIX_FMT_YUV444P9BE:
1227 
1239  c->chrToYV12 = bswap16UV_c;
1240  break;
1241 #endif
1242  case AV_PIX_FMT_AYUV64LE:
1243  c->chrToYV12 = read_ayuv64le_UV_c;
1244  break;
1245  case AV_PIX_FMT_P010LE:
1246  c->chrToYV12 = p010LEToUV_c;
1247  break;
1248  case AV_PIX_FMT_P010BE:
1249  c->chrToYV12 = p010BEToUV_c;
1250  break;
1251  case AV_PIX_FMT_P016LE:
1252  c->chrToYV12 = p016LEToUV_c;
1253  break;
1254  case AV_PIX_FMT_P016BE:
1255  c->chrToYV12 = p016BEToUV_c;
1256  break;
1257  case AV_PIX_FMT_Y210LE:
1258  c->chrToYV12 = y210le_UV_c;
1259  break;
1260  }
1261  if (c->chrSrcHSubSample) {
1262  switch (srcFormat) {
1263  case AV_PIX_FMT_RGBA64BE:
1264  c->chrToYV12 = rgb64BEToUV_half_c;
1265  break;
1266  case AV_PIX_FMT_RGBA64LE:
1267  c->chrToYV12 = rgb64LEToUV_half_c;
1268  break;
1269  case AV_PIX_FMT_BGRA64BE:
1270  c->chrToYV12 = bgr64BEToUV_half_c;
1271  break;
1272  case AV_PIX_FMT_BGRA64LE:
1273  c->chrToYV12 = bgr64LEToUV_half_c;
1274  break;
1275  case AV_PIX_FMT_RGB48BE:
1276  c->chrToYV12 = rgb48BEToUV_half_c;
1277  break;
1278  case AV_PIX_FMT_RGB48LE:
1279  c->chrToYV12 = rgb48LEToUV_half_c;
1280  break;
1281  case AV_PIX_FMT_BGR48BE:
1282  c->chrToYV12 = bgr48BEToUV_half_c;
1283  break;
1284  case AV_PIX_FMT_BGR48LE:
1285  c->chrToYV12 = bgr48LEToUV_half_c;
1286  break;
1287  case AV_PIX_FMT_RGB32:
1288  c->chrToYV12 = bgr32ToUV_half_c;
1289  break;
1290  case AV_PIX_FMT_RGB32_1:
1291  c->chrToYV12 = bgr321ToUV_half_c;
1292  break;
1293  case AV_PIX_FMT_BGR24:
1294  c->chrToYV12 = bgr24ToUV_half_c;
1295  break;
1296  case AV_PIX_FMT_BGR565LE:
1297  c->chrToYV12 = bgr16leToUV_half_c;
1298  break;
1299  case AV_PIX_FMT_BGR565BE:
1300  c->chrToYV12 = bgr16beToUV_half_c;
1301  break;
1302  case AV_PIX_FMT_BGR555LE:
1303  c->chrToYV12 = bgr15leToUV_half_c;
1304  break;
1305  case AV_PIX_FMT_BGR555BE:
1306  c->chrToYV12 = bgr15beToUV_half_c;
1307  break;
1308  case AV_PIX_FMT_GBRAP:
1309  case AV_PIX_FMT_GBRP:
1310  c->chrToYV12 = gbr24pToUV_half_c;
1311  break;
1312  case AV_PIX_FMT_BGR444LE:
1313  c->chrToYV12 = bgr12leToUV_half_c;
1314  break;
1315  case AV_PIX_FMT_BGR444BE:
1316  c->chrToYV12 = bgr12beToUV_half_c;
1317  break;
1318  case AV_PIX_FMT_BGR32:
1319  c->chrToYV12 = rgb32ToUV_half_c;
1320  break;
1321  case AV_PIX_FMT_BGR32_1:
1322  c->chrToYV12 = rgb321ToUV_half_c;
1323  break;
1324  case AV_PIX_FMT_RGB24:
1325  c->chrToYV12 = rgb24ToUV_half_c;
1326  break;
1327  case AV_PIX_FMT_RGB565LE:
1328  c->chrToYV12 = rgb16leToUV_half_c;
1329  break;
1330  case AV_PIX_FMT_RGB565BE:
1331  c->chrToYV12 = rgb16beToUV_half_c;
1332  break;
1333  case AV_PIX_FMT_RGB555LE:
1334  c->chrToYV12 = rgb15leToUV_half_c;
1335  break;
1336  case AV_PIX_FMT_RGB555BE:
1337  c->chrToYV12 = rgb15beToUV_half_c;
1338  break;
1339  case AV_PIX_FMT_RGB444LE:
1340  c->chrToYV12 = rgb12leToUV_half_c;
1341  break;
1342  case AV_PIX_FMT_RGB444BE:
1343  c->chrToYV12 = rgb12beToUV_half_c;
1344  break;
1345  case AV_PIX_FMT_X2RGB10LE:
1346  c->chrToYV12 = rgb30leToUV_half_c;
1347  break;
1348  }
1349  } else {
1350  switch (srcFormat) {
1351  case AV_PIX_FMT_RGBA64BE:
1352  c->chrToYV12 = rgb64BEToUV_c;
1353  break;
1354  case AV_PIX_FMT_RGBA64LE:
1355  c->chrToYV12 = rgb64LEToUV_c;
1356  break;
1357  case AV_PIX_FMT_BGRA64BE:
1358  c->chrToYV12 = bgr64BEToUV_c;
1359  break;
1360  case AV_PIX_FMT_BGRA64LE:
1361  c->chrToYV12 = bgr64LEToUV_c;
1362  break;
1363  case AV_PIX_FMT_RGB48BE:
1364  c->chrToYV12 = rgb48BEToUV_c;
1365  break;
1366  case AV_PIX_FMT_RGB48LE:
1367  c->chrToYV12 = rgb48LEToUV_c;
1368  break;
1369  case AV_PIX_FMT_BGR48BE:
1370  c->chrToYV12 = bgr48BEToUV_c;
1371  break;
1372  case AV_PIX_FMT_BGR48LE:
1373  c->chrToYV12 = bgr48LEToUV_c;
1374  break;
1375  case AV_PIX_FMT_RGB32:
1376  c->chrToYV12 = bgr32ToUV_c;
1377  break;
1378  case AV_PIX_FMT_RGB32_1:
1379  c->chrToYV12 = bgr321ToUV_c;
1380  break;
1381  case AV_PIX_FMT_BGR24:
1382  c->chrToYV12 = bgr24ToUV_c;
1383  break;
1384  case AV_PIX_FMT_BGR565LE:
1385  c->chrToYV12 = bgr16leToUV_c;
1386  break;
1387  case AV_PIX_FMT_BGR565BE:
1388  c->chrToYV12 = bgr16beToUV_c;
1389  break;
1390  case AV_PIX_FMT_BGR555LE:
1391  c->chrToYV12 = bgr15leToUV_c;
1392  break;
1393  case AV_PIX_FMT_BGR555BE:
1394  c->chrToYV12 = bgr15beToUV_c;
1395  break;
1396  case AV_PIX_FMT_BGR444LE:
1397  c->chrToYV12 = bgr12leToUV_c;
1398  break;
1399  case AV_PIX_FMT_BGR444BE:
1400  c->chrToYV12 = bgr12beToUV_c;
1401  break;
1402  case AV_PIX_FMT_BGR32:
1403  c->chrToYV12 = rgb32ToUV_c;
1404  break;
1405  case AV_PIX_FMT_BGR32_1:
1406  c->chrToYV12 = rgb321ToUV_c;
1407  break;
1408  case AV_PIX_FMT_RGB24:
1409  c->chrToYV12 = rgb24ToUV_c;
1410  break;
1411  case AV_PIX_FMT_RGB565LE:
1412  c->chrToYV12 = rgb16leToUV_c;
1413  break;
1414  case AV_PIX_FMT_RGB565BE:
1415  c->chrToYV12 = rgb16beToUV_c;
1416  break;
1417  case AV_PIX_FMT_RGB555LE:
1418  c->chrToYV12 = rgb15leToUV_c;
1419  break;
1420  case AV_PIX_FMT_RGB555BE:
1421  c->chrToYV12 = rgb15beToUV_c;
1422  break;
1423  case AV_PIX_FMT_RGB444LE:
1424  c->chrToYV12 = rgb12leToUV_c;
1425  break;
1426  case AV_PIX_FMT_RGB444BE:
1427  c->chrToYV12 = rgb12beToUV_c;
1428  break;
1429  case AV_PIX_FMT_X2RGB10LE:
1430  c->chrToYV12 = rgb30leToUV_c;
1431  break;
1432  }
1433  }
1434 
1435  c->lumToYV12 = NULL;
1436  c->alpToYV12 = NULL;
1437  switch (srcFormat) {
1438  case AV_PIX_FMT_GBRP9LE:
1439  c->readLumPlanar = planar_rgb9le_to_y;
1440  break;
1441  case AV_PIX_FMT_GBRAP10LE:
1442  c->readAlpPlanar = planar_rgb10le_to_a;
1443  case AV_PIX_FMT_GBRP10LE:
1444  c->readLumPlanar = planar_rgb10le_to_y;
1445  break;
1446  case AV_PIX_FMT_GBRAP12LE:
1447  c->readAlpPlanar = planar_rgb12le_to_a;
1448  case AV_PIX_FMT_GBRP12LE:
1449  c->readLumPlanar = planar_rgb12le_to_y;
1450  break;
1451  case AV_PIX_FMT_GBRP14LE:
1452  c->readLumPlanar = planar_rgb14le_to_y;
1453  break;
1454  case AV_PIX_FMT_GBRAP16LE:
1455  c->readAlpPlanar = planar_rgb16le_to_a;
1456  case AV_PIX_FMT_GBRP16LE:
1457  c->readLumPlanar = planar_rgb16le_to_y;
1458  break;
1459  case AV_PIX_FMT_GBRAPF32LE:
1460  c->readAlpPlanar = planar_rgbf32le_to_a;
1461  case AV_PIX_FMT_GBRPF32LE:
1462  c->readLumPlanar = planar_rgbf32le_to_y;
1463  break;
1464  case AV_PIX_FMT_GBRP9BE:
1465  c->readLumPlanar = planar_rgb9be_to_y;
1466  break;
1467  case AV_PIX_FMT_GBRAP10BE:
1468  c->readAlpPlanar = planar_rgb10be_to_a;
1469  case AV_PIX_FMT_GBRP10BE:
1470  c->readLumPlanar = planar_rgb10be_to_y;
1471  break;
1472  case AV_PIX_FMT_GBRAP12BE:
1473  c->readAlpPlanar = planar_rgb12be_to_a;
1474  case AV_PIX_FMT_GBRP12BE:
1475  c->readLumPlanar = planar_rgb12be_to_y;
1476  break;
1477  case AV_PIX_FMT_GBRP14BE:
1478  c->readLumPlanar = planar_rgb14be_to_y;
1479  break;
1480  case AV_PIX_FMT_GBRAP16BE:
1481  c->readAlpPlanar = planar_rgb16be_to_a;
1482  case AV_PIX_FMT_GBRP16BE:
1483  c->readLumPlanar = planar_rgb16be_to_y;
1484  break;
1485  case AV_PIX_FMT_GBRAPF32BE:
1486  c->readAlpPlanar = planar_rgbf32be_to_a;
1487  case AV_PIX_FMT_GBRPF32BE:
1488  c->readLumPlanar = planar_rgbf32be_to_y;
1489  break;
1490  case AV_PIX_FMT_GBRAP:
1491  c->readAlpPlanar = planar_rgb_to_a;
1492  case AV_PIX_FMT_GBRP:
1493  c->readLumPlanar = planar_rgb_to_y;
1494  break;
1495 #if HAVE_BIGENDIAN
1496  case AV_PIX_FMT_YUV420P9LE:
1497  case AV_PIX_FMT_YUV422P9LE:
1498  case AV_PIX_FMT_YUV444P9LE:
1513 
1514  case AV_PIX_FMT_GRAY9LE:
1515  case AV_PIX_FMT_GRAY10LE:
1516  case AV_PIX_FMT_GRAY12LE:
1517  case AV_PIX_FMT_GRAY14LE:
1518  case AV_PIX_FMT_GRAY16LE:
1519 
1520  case AV_PIX_FMT_P016LE:
1521  c->lumToYV12 = bswap16Y_c;
1522  break;
1534  c->lumToYV12 = bswap16Y_c;
1535  c->alpToYV12 = bswap16Y_c;
1536  break;
1537 #else
1538  case AV_PIX_FMT_YUV420P9BE:
1539  case AV_PIX_FMT_YUV422P9BE:
1540  case AV_PIX_FMT_YUV444P9BE:
1555 
1556  case AV_PIX_FMT_GRAY9BE:
1557  case AV_PIX_FMT_GRAY10BE:
1558  case AV_PIX_FMT_GRAY12BE:
1559  case AV_PIX_FMT_GRAY14BE:
1560  case AV_PIX_FMT_GRAY16BE:
1561 
1562  case AV_PIX_FMT_P016BE:
1563  c->lumToYV12 = bswap16Y_c;
1564  break;
1576  c->lumToYV12 = bswap16Y_c;
1577  c->alpToYV12 = bswap16Y_c;
1578  break;
1579 #endif
1580  case AV_PIX_FMT_YA16LE:
1581  c->lumToYV12 = read_ya16le_gray_c;
1582  break;
1583  case AV_PIX_FMT_YA16BE:
1584  c->lumToYV12 = read_ya16be_gray_c;
1585  break;
1586  case AV_PIX_FMT_AYUV64LE:
1587  c->lumToYV12 = read_ayuv64le_Y_c;
1588  break;
1589  case AV_PIX_FMT_YUYV422:
1590  case AV_PIX_FMT_YVYU422:
1591  case AV_PIX_FMT_YA8:
1592  c->lumToYV12 = yuy2ToY_c;
1593  break;
1594  case AV_PIX_FMT_UYVY422:
1595  c->lumToYV12 = uyvyToY_c;
1596  break;
1597  case AV_PIX_FMT_BGR24:
1598  c->lumToYV12 = bgr24ToY_c;
1599  break;
1600  case AV_PIX_FMT_BGR565LE:
1601  c->lumToYV12 = bgr16leToY_c;
1602  break;
1603  case AV_PIX_FMT_BGR565BE:
1604  c->lumToYV12 = bgr16beToY_c;
1605  break;
1606  case AV_PIX_FMT_BGR555LE:
1607  c->lumToYV12 = bgr15leToY_c;
1608  break;
1609  case AV_PIX_FMT_BGR555BE:
1610  c->lumToYV12 = bgr15beToY_c;
1611  break;
1612  case AV_PIX_FMT_BGR444LE:
1613  c->lumToYV12 = bgr12leToY_c;
1614  break;
1615  case AV_PIX_FMT_BGR444BE:
1616  c->lumToYV12 = bgr12beToY_c;
1617  break;
1618  case AV_PIX_FMT_RGB24:
1619  c->lumToYV12 = rgb24ToY_c;
1620  break;
1621  case AV_PIX_FMT_RGB565LE:
1622  c->lumToYV12 = rgb16leToY_c;
1623  break;
1624  case AV_PIX_FMT_RGB565BE:
1625  c->lumToYV12 = rgb16beToY_c;
1626  break;
1627  case AV_PIX_FMT_RGB555LE:
1628  c->lumToYV12 = rgb15leToY_c;
1629  break;
1630  case AV_PIX_FMT_RGB555BE:
1631  c->lumToYV12 = rgb15beToY_c;
1632  break;
1633  case AV_PIX_FMT_RGB444LE:
1634  c->lumToYV12 = rgb12leToY_c;
1635  break;
1636  case AV_PIX_FMT_RGB444BE:
1637  c->lumToYV12 = rgb12beToY_c;
1638  break;
1639  case AV_PIX_FMT_RGB8:
1640  case AV_PIX_FMT_BGR8:
1641  case AV_PIX_FMT_PAL8:
1642  case AV_PIX_FMT_BGR4_BYTE:
1643  case AV_PIX_FMT_RGB4_BYTE:
1644  c->lumToYV12 = palToY_c;
1645  break;
1646  case AV_PIX_FMT_MONOBLACK:
1647  c->lumToYV12 = monoblack2Y_c;
1648  break;
1649  case AV_PIX_FMT_MONOWHITE:
1650  c->lumToYV12 = monowhite2Y_c;
1651  break;
1652  case AV_PIX_FMT_RGB32:
1653  c->lumToYV12 = bgr32ToY_c;
1654  break;
1655  case AV_PIX_FMT_RGB32_1:
1656  c->lumToYV12 = bgr321ToY_c;
1657  break;
1658  case AV_PIX_FMT_BGR32:
1659  c->lumToYV12 = rgb32ToY_c;
1660  break;
1661  case AV_PIX_FMT_BGR32_1:
1662  c->lumToYV12 = rgb321ToY_c;
1663  break;
1664  case AV_PIX_FMT_RGB48BE:
1665  c->lumToYV12 = rgb48BEToY_c;
1666  break;
1667  case AV_PIX_FMT_RGB48LE:
1668  c->lumToYV12 = rgb48LEToY_c;
1669  break;
1670  case AV_PIX_FMT_BGR48BE:
1671  c->lumToYV12 = bgr48BEToY_c;
1672  break;
1673  case AV_PIX_FMT_BGR48LE:
1674  c->lumToYV12 = bgr48LEToY_c;
1675  break;
1676  case AV_PIX_FMT_RGBA64BE:
1677  c->lumToYV12 = rgb64BEToY_c;
1678  break;
1679  case AV_PIX_FMT_RGBA64LE:
1680  c->lumToYV12 = rgb64LEToY_c;
1681  break;
1682  case AV_PIX_FMT_BGRA64BE:
1683  c->lumToYV12 = bgr64BEToY_c;
1684  break;
1685  case AV_PIX_FMT_BGRA64LE:
1686  c->lumToYV12 = bgr64LEToY_c;
1687  break;
1688  case AV_PIX_FMT_P010LE:
1689  c->lumToYV12 = p010LEToY_c;
1690  break;
1691  case AV_PIX_FMT_P010BE:
1692  c->lumToYV12 = p010BEToY_c;
1693  break;
1694  case AV_PIX_FMT_GRAYF32LE:
1695 #if HAVE_BIGENDIAN
1696  c->lumToYV12 = grayf32ToY16_bswap_c;
1697 #else
1698  c->lumToYV12 = grayf32ToY16_c;
1699 #endif
1700  break;
1701  case AV_PIX_FMT_GRAYF32BE:
1702 #if HAVE_BIGENDIAN
1703  c->lumToYV12 = grayf32ToY16_c;
1704 #else
1705  c->lumToYV12 = grayf32ToY16_bswap_c;
1706 #endif
1707  break;
1708  case AV_PIX_FMT_Y210LE:
1709  c->lumToYV12 = y210le_Y_c;
1710  break;
1711  case AV_PIX_FMT_X2RGB10LE:
1712  c->lumToYV12 =rgb30leToY_c;
1713  break;
1714  }
1715  if (c->needAlpha) {
1716  if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
1717  if (HAVE_BIGENDIAN == !isBE(srcFormat) && !c->readAlpPlanar)
1718  c->alpToYV12 = bswap16Y_c;
1719  }
1720  switch (srcFormat) {
1721  case AV_PIX_FMT_BGRA64LE:
1722  case AV_PIX_FMT_RGBA64LE: c->alpToYV12 = rgba64leToA_c; break;
1723  case AV_PIX_FMT_BGRA64BE:
1724  case AV_PIX_FMT_RGBA64BE: c->alpToYV12 = rgba64beToA_c; break;
1725  case AV_PIX_FMT_BGRA:
1726  case AV_PIX_FMT_RGBA:
1727  c->alpToYV12 = rgbaToA_c;
1728  break;
1729  case AV_PIX_FMT_ABGR:
1730  case AV_PIX_FMT_ARGB:
1731  c->alpToYV12 = abgrToA_c;
1732  break;
1733  case AV_PIX_FMT_YA8:
1734  c->alpToYV12 = uyvyToY_c;
1735  break;
1736  case AV_PIX_FMT_YA16LE:
1737  c->alpToYV12 = read_ya16le_alpha_c;
1738  break;
1739  case AV_PIX_FMT_YA16BE:
1740  c->alpToYV12 = read_ya16be_alpha_c;
1741  break;
1742  case AV_PIX_FMT_AYUV64LE:
1743  c->alpToYV12 = read_ayuv64le_A_c;
1744  break;
1745  case AV_PIX_FMT_PAL8 :
1746  c->alpToYV12 = palToA_c;
1747  break;
1748  }
1749  }
1750 }
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:568
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:428
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:547
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:721
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:944
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:399
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:576
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:835
bu
int32_t bu
Definition: input.c:404
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:413
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:410
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:528
ff_sws_init_input_funcs
void ff_sws_init_input_funcs(SwsContext *c)
b
#define b
Definition: input.c:41
GV_IDX
#define GV_IDX
Definition: swscale_internal.h:414
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:415
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:979
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:998
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:646
rgb
Definition: rpzaenc.c:59
input_pixel
#define input_pixel(pos)
Definition: input.c:765
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_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:1029
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:660
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:801
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:1017
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:689
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:456
rgb321
RGB2YUV_SHIFT rgb321
Definition: input.c:383
r
#define r
Definition: input.c:40
rgb12be
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT rgb12be
Definition: input.c:395
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:399
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:703
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:696
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:754
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:118
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:968
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:668
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:408
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:873
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:401
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:467
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:405
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:743
rgb9plus_planar_transparency_funcs
#define rgb9plus_planar_transparency_funcs(nbits)
Definition: input.c:1053
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:732
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:398
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:914
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:650
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:197
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
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:400
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:607
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:640
gu
int32_t gu
Definition: input.c:404
isBE
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
Definition: swscale_internal.h:667
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:931
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:407
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:59
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
cpu.h
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:1065
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:168
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:146
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:447
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:599
rgb64funcs
#define rgb64funcs(pattern, BE_LE, origin)
Definition: input.c:96
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:399
nvXXtoUV_c
static av_always_inline void nvXXtoUV_c(uint8_t *dst1, uint8_t *dst2, const uint8_t *src, int width)
Definition: input.c:679
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:623
BY_IDX
#define BY_IDX
Definition: swscale_internal.h:409
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:407
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:405
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:966
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:511
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:767
gv
int32_t gv
Definition: input.c:405
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:558
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:631
rgb16be
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT rgb16be
Definition: input.c:393
ru
int32_t ru
Definition: input.c:404
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:615
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:820
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:586
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:660
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:854
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:418
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:438
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:403
bgr15be
RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT RGB2YUV_SHIFT bgr15be
Definition: input.c:391
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:478
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:134
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:895
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:44
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:494
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:887
BU_IDX
#define BU_IDX
Definition: swscale_internal.h:412
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:536
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:411
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:283
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:712
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:78
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:782
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