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