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