Go to the documentation of this file.
31 #define input_pixel(pos) (is_be ? AV_RB16(pos) : AV_RL16(pos))
38 #define IS_BE(ENDIAN_IDENTIFIER) IS_BE_ ## ENDIAN_IDENTIFIER
40 #define r ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? b_r : r_b)
41 #define b ((origin == AV_PIX_FMT_BGR48BE || origin == AV_PIX_FMT_BGR48LE || origin == AV_PIX_FMT_BGRA64BE || origin == AV_PIX_FMT_BGRA64LE) ? r_b : b_r)
60 const uint16_t *
src1,
const uint16_t *
src2,
79 const uint16_t *
src1,
const uint16_t *
src2,
96 #define RGB64FUNCS_EXT(pattern, BE_LE, origin, is_be) \
97 static void pattern ## 64 ## BE_LE ## ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, const uint8_t *unused1,\
98 int width, uint32_t *rgb2yuv, void *opq) \
100 const uint16_t *src = (const uint16_t *) _src; \
101 uint16_t *dst = (uint16_t *) _dst; \
102 rgb64ToY_c_template(dst, src, width, origin, rgb2yuv, is_be); \
105 static void pattern ## 64 ## BE_LE ## ToUV_c(uint8_t *_dstU, uint8_t *_dstV, \
106 const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
107 int width, uint32_t *rgb2yuv, void *opq) \
109 const uint16_t *src1 = (const uint16_t *) _src1, \
110 *src2 = (const uint16_t *) _src2; \
111 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
112 rgb64ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
115 static void pattern ## 64 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, \
116 const uint8_t *unused0, const uint8_t *_src1, const uint8_t *_src2, \
117 int width, uint32_t *rgb2yuv, void *opq) \
119 const uint16_t *src1 = (const uint16_t *) _src1, \
120 *src2 = (const uint16_t *) _src2; \
121 uint16_t *dstU = (uint16_t *) _dstU, *dstV = (uint16_t *) _dstV; \
122 rgb64ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
124 #define RGB64FUNCS(pattern, endianness, base_fmt) \
125 RGB64FUNCS_EXT(pattern, endianness, base_fmt ## endianness, IS_BE(endianness))
150 const uint16_t *
src1,
151 const uint16_t *
src2,
172 const uint16_t *
src1,
173 const uint16_t *
src2,
199 #define RGB48FUNCS_EXT(pattern, BE_LE, origin, is_be) \
200 static void pattern ## 48 ## BE_LE ## ToY_c(uint8_t *_dst, \
201 const uint8_t *_src, \
202 const uint8_t *unused0, const uint8_t *unused1,\
207 const uint16_t *src = (const uint16_t *)_src; \
208 uint16_t *dst = (uint16_t *)_dst; \
209 rgb48ToY_c_template(dst, src, width, origin, rgb2yuv, is_be); \
212 static void pattern ## 48 ## BE_LE ## ToUV_c(uint8_t *_dstU, \
214 const uint8_t *unused0, \
215 const uint8_t *_src1, \
216 const uint8_t *_src2, \
221 const uint16_t *src1 = (const uint16_t *)_src1, \
222 *src2 = (const uint16_t *)_src2; \
223 uint16_t *dstU = (uint16_t *)_dstU, \
224 *dstV = (uint16_t *)_dstV; \
225 rgb48ToUV_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
228 static void pattern ## 48 ## BE_LE ## ToUV_half_c(uint8_t *_dstU, \
230 const uint8_t *unused0, \
231 const uint8_t *_src1, \
232 const uint8_t *_src2, \
237 const uint16_t *src1 = (const uint16_t *)_src1, \
238 *src2 = (const uint16_t *)_src2; \
239 uint16_t *dstU = (uint16_t *)_dstU, \
240 *dstV = (uint16_t *)_dstV; \
241 rgb48ToUV_half_c_template(dstU, dstV, src1, src2, width, origin, rgb2yuv, is_be); \
243 #define RGB48FUNCS(pattern, endianness, base_fmt) \
244 RGB48FUNCS_EXT(pattern, endianness, base_fmt ## endianness, IS_BE(endianness))
251 #define input_pixel(i) ((origin == AV_PIX_FMT_RGBA || \
252 origin == AV_PIX_FMT_BGRA || \
253 origin == AV_PIX_FMT_ARGB || \
254 origin == AV_PIX_FMT_ABGR) \
255 ? AV_RN32A(&src[(i) * 4]) \
256 : ((origin == AV_PIX_FMT_X2RGB10LE || \
257 origin == AV_PIX_FMT_X2BGR10LE) \
258 ? AV_RL32(&src[(i) * 4]) \
259 : (is_be ? AV_RB16(&src[(i) * 2]) \
260 : AV_RL16(&src[(i) * 2]))))
268 int maskr,
int maskg,
270 int gsh,
int bsh,
int S,
274 const unsigned rnd = (32<<((
S)-1)) + (1<<(
S-7));
279 int b = (px & maskb) >> shb;
280 int g = (px & maskg) >> shg;
281 int r = (px & maskr) >> shr;
283 dst[
i] = (ry *
r + gy *
g + by *
b +
rnd) >> ((
S)-6);
294 int maskr,
int maskg,
296 int gsh,
int bsh,
int S,
301 const unsigned rnd = (256
u<<((
S)-1)) + (1<<(
S-7));
306 int b = (px & maskb) >> shb;
307 int g = (px & maskg) >> shg;
308 int r = (px & maskr) >> shr;
310 dstU[
i] = (ru *
r + gu *
g + bu *
b +
rnd) >> ((
S)-6);
311 dstV[
i] = (rv *
r + gv *
g + bv *
b +
rnd) >> ((
S)-6);
322 int maskr,
int maskg,
324 int gsh,
int bsh,
int S,
329 maskgx = ~(maskr | maskb);
330 const unsigned rnd = (256
U<<(
S)) + (1<<(
S-6));
339 int b,
r,
g = (px0 & maskgx) + (px1 & maskgx);
340 int rb = px0 + px1 -
g;
342 b = (rb & maskb) >> shb;
348 g = (
g & maskg) >> shg;
350 r = (rb & maskr) >> shr;
352 dstU[
i] = (ru *
r + gu *
g + bu *
b + (unsigned)
rnd) >> ((
S)-6+1);
353 dstV[
i] = (rv *
r + gv *
g + bv *
b + (unsigned)
rnd) >> ((
S)-6+1);
359 #define RGB16_32FUNCS_EXT(fmt, name, shr, shg, shb, shp, maskr, \
360 maskg, maskb, rsh, gsh, bsh, S, is_be) \
361 static void name ## ToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, \
362 int width, uint32_t *tab, void *opq) \
364 rgb16_32ToY_c_template((int16_t*)dst, src, width, fmt, shr, shg, shb, shp, \
365 maskr, maskg, maskb, rsh, gsh, bsh, S, tab, is_be); \
368 static void name ## ToUV_c(uint8_t *dstU, uint8_t *dstV, \
369 const uint8_t *unused0, const uint8_t *src, const uint8_t *dummy, \
370 int width, uint32_t *tab, void *opq) \
372 rgb16_32ToUV_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
373 shr, shg, shb, shp, \
374 maskr, maskg, maskb, rsh, gsh, bsh, S, tab, is_be); \
377 static void name ## ToUV_half_c(uint8_t *dstU, uint8_t *dstV, \
378 const uint8_t *unused0, const uint8_t *src, \
379 const uint8_t *dummy, \
380 int width, uint32_t *tab, void *opq) \
382 rgb16_32ToUV_half_c_template((int16_t*)dstU, (int16_t*)dstV, src, width, fmt, \
383 shr, shg, shb, shp, \
384 maskr, maskg, maskb, \
385 rsh, gsh, bsh, S, tab, is_be); \
388 #define RGB16_32FUNCS(base_fmt, endianness, name, shr, shg, shb, shp, maskr, \
389 maskg, maskb, rsh, gsh, bsh, S) \
390 RGB16_32FUNCS_EXT(base_fmt ## endianness, name, shr, shg, shb, shp, maskr, \
391 maskg, maskb, rsh, gsh, bsh, S, IS_BE(endianness))
393 RGB16_32FUNCS(
AV_PIX_FMT_BGR32, , bgr32, 16, 0, 0, 0, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8,
RGB2YUV_SHIFT + 8)
394 RGB16_32FUNCS(
AV_PIX_FMT_BGR32_1, , bgr321, 16, 0, 0, 8, 0xFF0000, 0xFF00, 0x00FF, 8, 0, 8,
RGB2YUV_SHIFT + 8)
395 RGB16_32FUNCS(
AV_PIX_FMT_RGB32, , rgb32, 0, 0, 16, 0, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8,
RGB2YUV_SHIFT + 8)
396 RGB16_32FUNCS(
AV_PIX_FMT_RGB32_1, , rgb321, 0, 0, 16, 8, 0x00FF, 0xFF00, 0xFF0000, 8, 0, 8,
RGB2YUV_SHIFT + 8)
397 RGB16_32FUNCS(
AV_PIX_FMT_BGR565, LE, bgr16le, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0,
RGB2YUV_SHIFT + 8)
398 RGB16_32FUNCS(
AV_PIX_FMT_BGR555, LE, bgr15le, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0,
RGB2YUV_SHIFT + 7)
399 RGB16_32FUNCS(
AV_PIX_FMT_BGR444, LE, bgr12le, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0,
RGB2YUV_SHIFT + 4)
400 RGB16_32FUNCS(
AV_PIX_FMT_RGB565, LE, rgb16le, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11,
RGB2YUV_SHIFT + 8)
401 RGB16_32FUNCS(
AV_PIX_FMT_RGB555, LE, rgb15le, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10,
RGB2YUV_SHIFT + 7)
402 RGB16_32FUNCS(
AV_PIX_FMT_RGB444, LE, rgb12le, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8,
RGB2YUV_SHIFT + 4)
403 RGB16_32FUNCS(
AV_PIX_FMT_BGR565, BE, bgr16be, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, 11, 5, 0,
RGB2YUV_SHIFT + 8)
404 RGB16_32FUNCS(
AV_PIX_FMT_BGR555, BE, bgr15be, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, 10, 5, 0,
RGB2YUV_SHIFT + 7)
405 RGB16_32FUNCS(
AV_PIX_FMT_BGR444, BE, bgr12be, 0, 0, 0, 0, 0x000F, 0x00F0, 0x0F00, 8, 4, 0,
RGB2YUV_SHIFT + 4)
406 RGB16_32FUNCS(
AV_PIX_FMT_RGB565, BE, rgb16be, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, 0, 5, 11,
RGB2YUV_SHIFT + 8)
407 RGB16_32FUNCS(
AV_PIX_FMT_RGB555, BE, rgb15be, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, 0, 5, 10,
RGB2YUV_SHIFT + 7)
408 RGB16_32FUNCS(
AV_PIX_FMT_RGB444, BE, rgb12be, 0, 0, 0, 0, 0x0F00, 0x00F0, 0x000F, 0, 4, 8,
RGB2YUV_SHIFT + 4)
409 RGB16_32FUNCS(
AV_PIX_FMT_X2RGB10, LE, rgb30le, 16, 6, 0, 0, 0x3FF00000, 0xFFC00, 0x3FF, 0, 0, 4,
RGB2YUV_SHIFT + 6)
410 RGB16_32FUNCS(
AV_PIX_FMT_X2BGR10, LE, bgr30le, 0, 6, 16, 0, 0x3FF, 0xFFC00, 0x3FF00000, 4, 0, 0,
RGB2YUV_SHIFT + 6)
413 const uint8_t *gsrc, const uint8_t *bsrc, const uint8_t *rsrc,
416 uint16_t *dstU = (uint16_t *)_dstU;
417 uint16_t *dstV = (uint16_t *)_dstV;
423 unsigned int g = gsrc[2*
i] + gsrc[2*
i+1];
424 unsigned int b = bsrc[2*
i] + bsrc[2*
i+1];
425 unsigned int r = rsrc[2*
i] + rsrc[2*
i+1];
432 static void rgba64leToA_c(uint8_t *_dst,
const uint8_t *_src,
const uint8_t *unused1,
433 const uint8_t *unused2,
int width, uint32_t *unused,
void *opq)
435 int16_t *dst = (int16_t *)_dst;
436 const uint16_t *
src = (
const uint16_t *)_src;
442 static void rgba64beToA_c(uint8_t *_dst,
const uint8_t *_src,
const uint8_t *unused1,
443 const uint8_t *unused2,
int width, uint32_t *unused,
void *opq)
445 int16_t *dst = (int16_t *)_dst;
446 const uint16_t *
src = (
const uint16_t *)_src;
452 static void abgrToA_c(uint8_t *_dst,
const uint8_t *
src,
const uint8_t *unused1,
453 const uint8_t *unused2,
int width, uint32_t *unused,
void *opq)
455 int16_t *dst = (int16_t *)_dst;
462 static void rgbaToA_c(uint8_t *_dst,
const uint8_t *
src,
const uint8_t *unused1,
463 const uint8_t *unused2,
int width, uint32_t *unused,
void *opq)
465 int16_t *dst = (int16_t *)_dst;
472 static void palToA_c(uint8_t *_dst,
const uint8_t *
src,
const uint8_t *unused1,
473 const uint8_t *unused2,
int width, uint32_t *pal,
void *opq)
475 int16_t *dst = (int16_t *)_dst;
480 dst[
i]= (pal[
d] >> 24)<<6 | pal[
d]>>26;
484 static void palToY_c(uint8_t *_dst,
const uint8_t *
src,
const uint8_t *unused1,
485 const uint8_t *unused2,
int width, uint32_t *pal,
void *opq)
487 int16_t *dst = (int16_t *)_dst;
492 dst[
i] = (pal[
d] & 0xFF)<<6;
497 const uint8_t *unused0,
const uint8_t *
src1,
const uint8_t *
src2,
498 int width, uint32_t *pal,
void *opq)
500 uint16_t *dstU = (uint16_t *)_dstU;
501 int16_t *dstV = (int16_t *)_dstV;
505 int p = pal[
src1[
i]];
507 dstU[
i] = (uint8_t)(p>> 8)<<6;
508 dstV[
i] = (uint8_t)(p>>16)<<6;
513 const uint8_t *unused2,
int width, uint32_t *unused,
void *opq)
515 int16_t *dst = (int16_t *)_dst;
520 for (j = 0; j < 8; j++)
521 dst[8*
i+j]= ((
d>>(7-j))&1) * 16383;
525 for (j = 0; j < (
width&7); j++)
526 dst[8*
i+j]= ((
d>>(7-j))&1) * 16383;
531 const uint8_t *unused2,
int width, uint32_t *unused,
void *opq)
533 int16_t *dst = (int16_t *)_dst;
538 for (j = 0; j < 8; j++)
539 dst[8*
i+j]= ((
d>>(7-j))&1) * 16383;
543 for (j = 0; j < (
width&7); j++)
544 dst[8*
i+j] = ((
d>>(7-j))&1) * 16383;
548 static void yuy2ToY_c(uint8_t *dst,
const uint8_t *
src,
const uint8_t *unused1,
const uint8_t *unused2,
int width,
549 uint32_t *unused,
void *opq)
556 static void yuy2ToUV_c(uint8_t *dstU, uint8_t *dstV,
const uint8_t *unused0,
const uint8_t *
src1,
557 const uint8_t *
src2,
int width, uint32_t *unused,
void *opq)
561 dstU[
i] =
src1[4 *
i + 1];
562 dstV[
i] =
src1[4 *
i + 3];
567 static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV,
const uint8_t *unused0,
const uint8_t *
src1,
568 const uint8_t *
src2,
int width, uint32_t *unused,
void *opq)
572 dstV[
i] =
src1[4 *
i + 1];
573 dstU[
i] =
src1[4 *
i + 3];
578 #define y21xle_wrapper(bits, shift) \
579 static void y2 ## bits ## le_UV_c(uint8_t *dstU, uint8_t *dstV, \
580 const uint8_t *unused0, \
581 const uint8_t *src, \
582 const uint8_t *unused1, int width, \
583 uint32_t *unused2, void *opq) \
586 for (i = 0; i < width; i++) { \
587 AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> shift); \
588 AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> shift); \
592 static void y2 ## bits ## le_Y_c(uint8_t *dst, const uint8_t *src, \
593 const uint8_t *unused0, \
594 const uint8_t *unused1, int width, \
595 uint32_t *unused2, void *opq) \
598 for (i = 0; i < width; i++) \
599 AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> shift); \
605 static
void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2,
int width,
606 uint32_t *unused,
void *opq)
609 const uint16_t *
src = (
const uint16_t *)_src;
610 uint16_t *dst = (uint16_t *)_dst;
615 static void bswap16UV_c(uint8_t *_dstU, uint8_t *_dstV,
const uint8_t *unused0,
const uint8_t *_src1,
616 const uint8_t *_src2,
int width, uint32_t *unused,
void *opq)
619 const uint16_t *
src1 = (
const uint16_t *)_src1,
620 *
src2 = (
const uint16_t *)_src2;
621 uint16_t *dstU = (uint16_t *)_dstU, *dstV = (uint16_t *)_dstV;
629 uint32_t *unused,
void *opq)
637 uint32_t *unused,
void *opq)
645 uint32_t *unused,
void *opq)
653 uint32_t *unused,
void *opq)
661 uint32_t *unused2,
void *opq)
670 const uint8_t *unused1,
int width, uint32_t *unused2,
void *opq)
680 uint32_t *unused2,
void *opq)
687 static void read_vuyx_UV_c(uint8_t *dstU, uint8_t *dstV,
const uint8_t *unused0,
const uint8_t *
src,
688 const uint8_t *unused1,
int width, uint32_t *unused2,
void *opq)
692 dstU[
i] =
src[
i * 4 + 1];
693 dstV[
i] =
src[
i * 4];
697 static void read_vuyx_Y_c(uint8_t *dst,
const uint8_t *
src,
const uint8_t *unused0,
const uint8_t *unused1,
int width,
698 uint32_t *unused2,
void *opq)
702 dst[
i] =
src[
i * 4 + 2];
705 static void read_vuya_A_c(uint8_t *dst,
const uint8_t *
src,
const uint8_t *unused0,
const uint8_t *unused1,
int width,
706 uint32_t *unused2,
void *opq)
710 dst[
i] =
src[
i * 4 + 3];
714 uint32_t *unused2,
void *opq)
723 const uint8_t *unused1,
int width, uint32_t *unused2,
void *opq)
733 uint32_t *unused2,
void *opq)
742 const uint8_t *unused1,
int width, uint32_t *unused2,
void *opq)
753 static void uyvyToY_c(uint8_t *dst,
const uint8_t *
src,
const uint8_t *unused1,
const uint8_t *unused2,
int width,
754 uint32_t *unused,
void *opq)
758 dst[
i] =
src[2 *
i + 1];
761 static void uyvyToUV_c(uint8_t *dstU, uint8_t *dstV,
const uint8_t *unused0,
const uint8_t *
src1,
762 const uint8_t *
src2,
int width, uint32_t *unused,
void *opq)
766 dstU[
i] =
src1[4 *
i + 0];
767 dstV[
i] =
src1[4 *
i + 2];
777 dst1[
i] =
src[2 *
i + 0];
778 dst2[
i] =
src[2 *
i + 1];
783 const uint8_t *unused0,
const uint8_t *
src1,
const uint8_t *
src2,
784 int width, uint32_t *unused,
void *opq)
790 const uint8_t *unused0,
const uint8_t *
src1,
const uint8_t *
src2,
791 int width, uint32_t *unused,
void *opq)
796 #define p01x_uv_wrapper(bits, shift) \
797 static void p0 ## bits ## LEToUV_c(uint8_t *dstU, uint8_t *dstV, \
798 const uint8_t *unused0, \
799 const uint8_t *src1, \
800 const uint8_t *src2, int width, \
801 uint32_t *unused, void *opq) \
804 for (i = 0; i < width; i++) { \
805 AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0) >> shift); \
806 AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2) >> shift); \
810 static void p0 ## bits ## BEToUV_c(uint8_t *dstU, uint8_t *dstV, \
811 const uint8_t *unused0, \
812 const uint8_t *src1, \
813 const uint8_t *src2, int width, \
814 uint32_t *unused, void *opq) \
817 for (i = 0; i < width; i++) { \
818 AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0) >> shift); \
819 AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2) >> shift); \
823 #define p01x_wrapper(bits, shift) \
824 static void p0 ## bits ## LEToY_c(uint8_t *dst, const uint8_t *src, \
825 const uint8_t *unused1, \
826 const uint8_t *unused2, int width, \
827 uint32_t *unused, void *opq) \
830 for (i = 0; i < width; i++) { \
831 AV_WN16(dst + i * 2, AV_RL16(src + i * 2) >> shift); \
835 static void p0 ## bits ## BEToY_c(uint8_t *dst, const uint8_t *src, \
836 const uint8_t *unused1, \
837 const uint8_t *unused2, int width, \
838 uint32_t *unused, void *opq) \
841 for (i = 0; i < width; i++) { \
842 AV_WN16(dst + i * 2, AV_RB16(src + i * 2) >> shift); \
845 p01x_uv_wrapper(bits, shift)
851 static
void bgr24ToY_c(uint8_t *_dst, const uint8_t *
src, const uint8_t *unused1, const uint8_t *unused2,
854 int16_t *dst = (int16_t *)_dst;
858 int b =
src[
i * 3 + 0];
859 int g =
src[
i * 3 + 1];
860 int r =
src[
i * 3 + 2];
866 static void bgr24ToUV_c(uint8_t *_dstU, uint8_t *_dstV,
const uint8_t *unused0,
const uint8_t *
src1,
869 int16_t *dstU = (int16_t *)_dstU;
870 int16_t *dstV = (int16_t *)_dstV;
888 int16_t *dstU = (int16_t *)_dstU;
889 int16_t *dstV = (int16_t *)_dstV;
904 static void rgb24ToY_c(uint8_t *_dst,
const uint8_t *
src,
const uint8_t *unused1,
const uint8_t *unused2,
int width,
907 int16_t *dst = (int16_t *)_dst;
911 int r =
src[
i * 3 + 0];
912 int g =
src[
i * 3 + 1];
913 int b =
src[
i * 3 + 2];
919 static void rgb24ToUV_c(uint8_t *_dstU, uint8_t *_dstV,
const uint8_t *unused0,
const uint8_t *
src1,
922 int16_t *dstU = (int16_t *)_dstU;
923 int16_t *dstV = (int16_t *)_dstV;
941 int16_t *dstU = (int16_t *)_dstU;
942 int16_t *dstV = (int16_t *)_dstV;
959 uint16_t *dst = (uint16_t *)_dst;
973 uint16_t *dst = (uint16_t *)_dst;
976 dst[
i] =
src[3][
i] << 6;
981 uint16_t *dstU = (uint16_t *)_dstU;
982 uint16_t *dstV = (uint16_t *)_dstV;
997 (is_be ? AV_RB16(src) : AV_RL16(src))
1002 const uint16_t **
src = (
const uint16_t **)_src;
1003 uint16_t *dst = (uint16_t *)_dst;
1005 int shift = bpc < 16 ? bpc : 14;
1019 const uint16_t **
src = (
const uint16_t **)_src;
1020 uint16_t *dst = (uint16_t *)_dst;
1021 int shift = bpc < 16 ? bpc : 14;
1029 const uint8_t *_src[4],
int width,
1033 const uint16_t **
src = (
const uint16_t **)_src;
1034 uint16_t *dstU = (uint16_t *)_dstU;
1035 uint16_t *dstV = (uint16_t *)_dstV;
1038 int shift = bpc < 16 ? bpc : 14;
1050 #define rdpx(src) (is_be ? av_int2float(AV_RB32(src)): av_int2float(AV_RL32(src)))
1055 const float **
src = (
const float **)_src;
1056 uint16_t *dst = (uint16_t *)_dst;
1066 const float **
src = (
const float **)_src;
1067 uint16_t *dstU = (uint16_t *)_dstU;
1068 uint16_t *dstV = (uint16_t *)_dstV;
1085 const float **
src = (
const float **)_src;
1086 uint16_t *dst = (uint16_t *)_dst;
1100 const uint8_t *unused2,
int width,
int is_be, uint32_t *unused)
1103 const float *
src = (
const float *)_src;
1104 uint16_t *dst = (uint16_t *)_dst;
1113 #define rgb9plus_planar_funcs_endian(nbits, endian_name, endian) \
1114 static void planar_rgb##nbits##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1115 int w, int32_t *rgb2yuv, void *opq) \
1117 planar_rgb16_to_y(dst, src, w, nbits, endian, rgb2yuv); \
1119 static void planar_rgb##nbits##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1120 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1123 planar_rgb16_to_uv(dstU, dstV, src, w, nbits, endian, rgb2yuv); \
1126 #define rgb9plus_planar_transparency_funcs(nbits) \
1127 static void planar_rgb##nbits##le_to_a(uint8_t *dst, const uint8_t *src[4], \
1128 int w, int32_t *rgb2yuv, \
1131 planar_rgb16_to_a(dst, src, w, nbits, 0, rgb2yuv); \
1133 static void planar_rgb##nbits##be_to_a(uint8_t *dst, const uint8_t *src[4], \
1134 int w, int32_t *rgb2yuv, \
1137 planar_rgb16_to_a(dst, src, w, nbits, 1, rgb2yuv); \
1140 #define rgb9plus_planar_funcs(nbits) \
1141 rgb9plus_planar_funcs_endian(nbits, le, 0) \
1142 rgb9plus_planar_funcs_endian(nbits, be, 1)
1155 #define rgbf32_planar_funcs_endian(endian_name, endian) \
1156 static void planar_rgbf32##endian_name##_to_y(uint8_t *dst, const uint8_t *src[4], \
1157 int w, int32_t *rgb2yuv, void *opq) \
1159 planar_rgbf32_to_y(dst, src, w, endian, rgb2yuv); \
1161 static void planar_rgbf32##endian_name##_to_uv(uint8_t *dstU, uint8_t *dstV, \
1162 const uint8_t *src[4], int w, int32_t *rgb2yuv, \
1165 planar_rgbf32_to_uv(dstU, dstV, src, w, endian, rgb2yuv); \
1167 static void planar_rgbf32##endian_name##_to_a(uint8_t *dst, const uint8_t *src[4], \
1168 int w, int32_t *rgb2yuv, void *opq) \
1170 planar_rgbf32_to_a(dst, src, w, endian, rgb2yuv); \
1172 static void grayf32##endian_name##ToY16_c(uint8_t *dst, const uint8_t *src, \
1173 const uint8_t *unused1, const uint8_t *unused2, \
1174 int width, uint32_t *unused, void *opq) \
1176 grayf32ToY16_c(dst, src, unused1, unused2, width, endian, unused); \
1182 #define rdpx(src) av_int2float(half2float(is_be ? AV_RB16(&src) : AV_RL16(&src), h2f_tbl))
1184 static av_always_inline void rgbaf16ToUV_half_endian(uint16_t *dstU, uint16_t *dstV,
int is_be,
1246 #define rgbaf16_funcs_endian(endian_name, endian) \
1247 static void rgbaf16##endian_name##ToUV_half_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1248 const uint8_t *src1, const uint8_t *src2, \
1249 int width, uint32_t *_rgb2yuv, void *opq) \
1251 const uint16_t *src = (const uint16_t*)src1; \
1252 uint16_t *dstU = (uint16_t*)_dstU; \
1253 uint16_t *dstV = (uint16_t*)_dstV; \
1254 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1255 av_assert1(src1==src2); \
1256 rgbaf16ToUV_half_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1258 static void rgbaf16##endian_name##ToUV_c(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *unused, \
1259 const uint8_t *src1, const uint8_t *src2, \
1260 int width, uint32_t *_rgb2yuv, void *opq) \
1262 const uint16_t *src = (const uint16_t*)src1; \
1263 uint16_t *dstU = (uint16_t*)_dstU; \
1264 uint16_t *dstV = (uint16_t*)_dstV; \
1265 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1266 av_assert1(src1==src2); \
1267 rgbaf16ToUV_endian(dstU, dstV, endian, src, width, rgb2yuv, opq); \
1269 static void rgbaf16##endian_name##ToY_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1270 const uint8_t *unused1, int width, uint32_t *_rgb2yuv, void *opq) \
1272 const uint16_t *src = (const uint16_t*)_src; \
1273 uint16_t *dst = (uint16_t*)_dst; \
1274 int32_t *rgb2yuv = (int32_t*)_rgb2yuv; \
1275 rgbaf16ToY_endian(dst, src, endian, width, rgb2yuv, opq); \
1277 static void rgbaf16##endian_name##ToA_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused0, \
1278 const uint8_t *unused1, int width, uint32_t *unused2, void *opq) \
1280 const uint16_t *src = (const uint16_t*)_src; \
1281 uint16_t *dst = (uint16_t*)_dst; \
1282 rgbaf16ToA_endian(dst, src, endian, width, opq); \
1292 c->chrToYV12 =
NULL;
1293 switch (srcFormat) {
1320 c->readChrPlanar = planar_rgb9le_to_uv;
1324 c->readChrPlanar = planar_rgb10le_to_uv;
1328 c->readChrPlanar = planar_rgb12le_to_uv;
1332 c->readChrPlanar = planar_rgb14le_to_uv;
1336 c->readChrPlanar = planar_rgb16le_to_uv;
1340 c->readChrPlanar = planar_rgbf32le_to_uv;
1343 c->readChrPlanar = planar_rgb9be_to_uv;
1347 c->readChrPlanar = planar_rgb10be_to_uv;
1351 c->readChrPlanar = planar_rgb12be_to_uv;
1355 c->readChrPlanar = planar_rgb14be_to_uv;
1359 c->readChrPlanar = planar_rgb16be_to_uv;
1363 c->readChrPlanar = planar_rgbf32be_to_uv;
1450 c->chrToYV12 = p010LEToUV_c;
1455 c->chrToYV12 = p010BEToUV_c;
1460 c->chrToYV12 = p012LEToUV_c;
1465 c->chrToYV12 = p012BEToUV_c;
1470 c->chrToYV12 = p016LEToUV_c;
1475 c->chrToYV12 = p016BEToUV_c;
1478 c->chrToYV12 = y210le_UV_c;
1481 c->chrToYV12 = y212le_UV_c;
1484 if (
c->chrSrcHSubSample) {
1485 switch (srcFormat) {
1487 c->chrToYV12 = rgb64BEToUV_half_c;
1490 c->chrToYV12 = rgb64LEToUV_half_c;
1493 c->chrToYV12 = bgr64BEToUV_half_c;
1496 c->chrToYV12 = bgr64LEToUV_half_c;
1499 c->chrToYV12 = rgb48BEToUV_half_c;
1502 c->chrToYV12 = rgb48LEToUV_half_c;
1505 c->chrToYV12 = bgr48BEToUV_half_c;
1508 c->chrToYV12 = bgr48LEToUV_half_c;
1511 c->chrToYV12 = bgr32ToUV_half_c;
1514 c->chrToYV12 = bgr321ToUV_half_c;
1520 c->chrToYV12 = bgr16leToUV_half_c;
1523 c->chrToYV12 = bgr16beToUV_half_c;
1526 c->chrToYV12 = bgr15leToUV_half_c;
1529 c->chrToYV12 = bgr15beToUV_half_c;
1536 c->chrToYV12 = bgr12leToUV_half_c;
1539 c->chrToYV12 = bgr12beToUV_half_c;
1542 c->chrToYV12 = rgb32ToUV_half_c;
1545 c->chrToYV12 = rgb321ToUV_half_c;
1551 c->chrToYV12 = rgb16leToUV_half_c;
1554 c->chrToYV12 = rgb16beToUV_half_c;
1557 c->chrToYV12 = rgb15leToUV_half_c;
1560 c->chrToYV12 = rgb15beToUV_half_c;
1563 c->chrToYV12 = rgb12leToUV_half_c;
1566 c->chrToYV12 = rgb12beToUV_half_c;
1569 c->chrToYV12 = rgb30leToUV_half_c;
1572 c->chrToYV12 = bgr30leToUV_half_c;
1575 c->chrToYV12 = rgbaf16beToUV_half_c;
1578 c->chrToYV12 = rgbaf16leToUV_half_c;
1582 switch (srcFormat) {
1584 c->chrToYV12 = rgb64BEToUV_c;
1587 c->chrToYV12 = rgb64LEToUV_c;
1590 c->chrToYV12 = bgr64BEToUV_c;
1593 c->chrToYV12 = bgr64LEToUV_c;
1596 c->chrToYV12 = rgb48BEToUV_c;
1599 c->chrToYV12 = rgb48LEToUV_c;
1602 c->chrToYV12 = bgr48BEToUV_c;
1605 c->chrToYV12 = bgr48LEToUV_c;
1608 c->chrToYV12 = bgr32ToUV_c;
1611 c->chrToYV12 = bgr321ToUV_c;
1617 c->chrToYV12 = bgr16leToUV_c;
1620 c->chrToYV12 = bgr16beToUV_c;
1623 c->chrToYV12 = bgr15leToUV_c;
1626 c->chrToYV12 = bgr15beToUV_c;
1629 c->chrToYV12 = bgr12leToUV_c;
1632 c->chrToYV12 = bgr12beToUV_c;
1635 c->chrToYV12 = rgb32ToUV_c;
1638 c->chrToYV12 = rgb321ToUV_c;
1644 c->chrToYV12 = rgb16leToUV_c;
1647 c->chrToYV12 = rgb16beToUV_c;
1650 c->chrToYV12 = rgb15leToUV_c;
1653 c->chrToYV12 = rgb15beToUV_c;
1656 c->chrToYV12 = rgb12leToUV_c;
1659 c->chrToYV12 = rgb12beToUV_c;
1662 c->chrToYV12 = rgb30leToUV_c;
1665 c->chrToYV12 = bgr30leToUV_c;
1668 c->chrToYV12 = rgbaf16beToUV_c;
1671 c->chrToYV12 = rgbaf16leToUV_c;
1676 c->lumToYV12 =
NULL;
1677 c->alpToYV12 =
NULL;
1678 switch (srcFormat) {
1680 c->readLumPlanar = planar_rgb9le_to_y;
1683 c->readAlpPlanar = planar_rgb10le_to_a;
1685 c->readLumPlanar = planar_rgb10le_to_y;
1688 c->readAlpPlanar = planar_rgb12le_to_a;
1690 c->readLumPlanar = planar_rgb12le_to_y;
1693 c->readAlpPlanar = planar_rgb14le_to_a;
1695 c->readLumPlanar = planar_rgb14le_to_y;
1698 c->readAlpPlanar = planar_rgb16le_to_a;
1700 c->readLumPlanar = planar_rgb16le_to_y;
1703 c->readAlpPlanar = planar_rgbf32le_to_a;
1705 c->readLumPlanar = planar_rgbf32le_to_y;
1708 c->readLumPlanar = planar_rgb9be_to_y;
1711 c->readAlpPlanar = planar_rgb10be_to_a;
1713 c->readLumPlanar = planar_rgb10be_to_y;
1716 c->readAlpPlanar = planar_rgb12be_to_a;
1718 c->readLumPlanar = planar_rgb12be_to_y;
1721 c->readAlpPlanar = planar_rgb14be_to_a;
1723 c->readLumPlanar = planar_rgb14be_to_y;
1726 c->readAlpPlanar = planar_rgb16be_to_a;
1728 c->readLumPlanar = planar_rgb16be_to_y;
1731 c->readAlpPlanar = planar_rgbf32be_to_a;
1733 c->readLumPlanar = planar_rgbf32be_to_y;
1768 c->lumToYV12 = bswap16Y_c;
1781 c->lumToYV12 = bswap16Y_c;
1782 c->alpToYV12 = bswap16Y_c;
1812 c->lumToYV12 = bswap16Y_c;
1825 c->lumToYV12 = bswap16Y_c;
1826 c->alpToYV12 = bswap16Y_c;
1857 c->lumToYV12 = bgr24ToY_c;
1860 c->lumToYV12 = bgr16leToY_c;
1863 c->lumToYV12 = bgr16beToY_c;
1866 c->lumToYV12 = bgr15leToY_c;
1869 c->lumToYV12 = bgr15beToY_c;
1872 c->lumToYV12 = bgr12leToY_c;
1875 c->lumToYV12 = bgr12beToY_c;
1881 c->lumToYV12 = rgb16leToY_c;
1884 c->lumToYV12 = rgb16beToY_c;
1887 c->lumToYV12 = rgb15leToY_c;
1890 c->lumToYV12 = rgb15beToY_c;
1893 c->lumToYV12 = rgb12leToY_c;
1896 c->lumToYV12 = rgb12beToY_c;
1912 c->lumToYV12 = bgr32ToY_c;
1915 c->lumToYV12 = bgr321ToY_c;
1918 c->lumToYV12 = rgb32ToY_c;
1921 c->lumToYV12 = rgb321ToY_c;
1924 c->lumToYV12 = rgb48BEToY_c;
1927 c->lumToYV12 = rgb48LEToY_c;
1930 c->lumToYV12 = bgr48BEToY_c;
1933 c->lumToYV12 = bgr48LEToY_c;
1936 c->lumToYV12 = rgb64BEToY_c;
1939 c->lumToYV12 = rgb64LEToY_c;
1942 c->lumToYV12 = bgr64BEToY_c;
1945 c->lumToYV12 = bgr64LEToY_c;
1950 c->lumToYV12 = p010LEToY_c;
1955 c->lumToYV12 = p010BEToY_c;
1960 c->lumToYV12 = p012LEToY_c;
1965 c->lumToYV12 = p012BEToY_c;
1968 c->lumToYV12 = grayf32leToY16_c;
1971 c->lumToYV12 = grayf32beToY16_c;
1974 c->lumToYV12 = y210le_Y_c;
1977 c->lumToYV12 = y212le_Y_c;
1980 c->lumToYV12 = rgb30leToY_c;
1983 c->lumToYV12 = bgr30leToY_c;
1986 c->lumToYV12 = rgbaf16beToY_c;
1989 c->lumToYV12 = rgbaf16leToY_c;
1994 if (HAVE_BIGENDIAN == !
isBE(srcFormat) && !
c->readAlpPlanar)
1995 c->alpToYV12 = bswap16Y_c;
1997 switch (srcFormat) {
2011 c->alpToYV12 = rgbaf16beToA_c;
2014 c->alpToYV12 = rgbaf16leToA_c;
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
planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
@ AV_PIX_FMT_XV30LE
packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb), little-endian, variant of Y410 where alpha channe...
@ AV_PIX_FMT_GRAY10BE
Y , 10bpp, big-endian.
AVPixelFormat
Pixel format.
@ 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...
@ AV_PIX_FMT_P416BE
interleaved chroma YUV 4:4:4, 48bpp, big-endian
@ AV_PIX_FMT_YA8
8 bits gray, 8 bits alpha
@ 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...
@ AV_PIX_FMT_RGB444LE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
#define u(width, name, range_min, range_max)
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
@ AV_PIX_FMT_GBRP10BE
planar GBR 4:4:4 30bpp, big-endian
@ AV_PIX_FMT_YUV422P14LE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
@ AV_PIX_FMT_YUVA444P10BE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
@ 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...
@ AV_PIX_FMT_YUV440P12BE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
@ AV_PIX_FMT_GBRAPF32LE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian.
@ AV_PIX_FMT_GBRPF32BE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian.
@ AV_PIX_FMT_P412BE
interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, big-endian
void ff_sws_init_input_funcs(SwsContext *c)
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
@ AV_PIX_FMT_P010BE
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits,...
static const char rgb2yuv[]
@ AV_PIX_FMT_YUV420P14BE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
@ AV_PIX_FMT_YUV420P16LE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
#define AV_PIX_FMT_RGB32_1
@ AV_PIX_FMT_GBRP14BE
planar GBR 4:4:4 42bpp, big-endian
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
@ AV_PIX_FMT_YUVA444P9BE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian
@ AV_PIX_FMT_YUV422P9BE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
@ AV_PIX_FMT_GRAY10LE
Y , 10bpp, little-endian.
@ AV_PIX_FMT_GRAYF32LE
IEEE-754 single precision Y, 32bpp, little-endian.
@ AV_PIX_FMT_GBRAP14BE
planar GBR 4:4:4:4 56bpp, big-endian
@ AV_PIX_FMT_RGB555BE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
@ AV_PIX_FMT_RGBAF16LE
IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., little-endian.
@ AV_PIX_FMT_AYUV64LE
packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
@ AV_PIX_FMT_YUV444P16LE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
@ AV_PIX_FMT_GBRAP12LE
planar GBR 4:4:4:4 48bpp, little-endian
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_YUV420P12LE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
@ AV_PIX_FMT_GRAY9LE
Y , 9bpp, little-endian.
static av_always_inline int isNBPS(enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_YUVA444P16BE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian)
@ AV_PIX_FMT_YUV444P10BE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
@ AV_PIX_FMT_YUV420P10LE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
@ AV_PIX_FMT_VUYA
packed VUYA 4:4:4, 32bpp, VUYAVUYA...
@ AV_PIX_FMT_YUV444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
@ AV_PIX_FMT_YUV422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
@ AV_PIX_FMT_YUV444P14LE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
@ AV_PIX_FMT_GBRP16LE
planar GBR 4:4:4 48bpp, little-endian
@ AV_PIX_FMT_P416LE
interleaved chroma YUV 4:4:4, 48bpp, little-endian
@ AV_PIX_FMT_P210LE
interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, little-endian
@ AV_PIX_FMT_P016BE
like NV12, with 16bpp per component, big-endian
@ AV_PIX_FMT_GBRP12LE
planar GBR 4:4:4 36bpp, little-endian
@ AV_PIX_FMT_YUVA420P16BE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
@ AV_PIX_FMT_GBRP10LE
planar GBR 4:4:4 30bpp, little-endian
#define AV_PIX_FMT_BGR32_1
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_YUV444P10LE
planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
@ AV_PIX_FMT_YUVA422P10LE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
@ AV_PIX_FMT_YUV444P9BE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
@ AV_PIX_FMT_YUV422P10BE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
@ AV_PIX_FMT_YUV422P16LE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
#define AV_PIX_FMT_RGBA64
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
@ AV_PIX_FMT_GBRAPF32BE
IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian.
@ AV_PIX_FMT_GBRAP12BE
planar GBR 4:4:4:4 48bpp, big-endian
@ AV_PIX_FMT_P012LE
like NV12, with 12bpp per component, data in the high bits, zeros in the low bits,...
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
@ AV_PIX_FMT_P210BE
interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, big-endian
@ 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...
@ AV_PIX_FMT_YA16LE
16 bits gray, 16 bits alpha (little-endian)
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
@ AV_PIX_FMT_YUVA422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian
@ AV_PIX_FMT_BGR565LE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
@ 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...
@ AV_PIX_FMT_YUVA444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian
@ AV_PIX_FMT_YUVA444P9LE
planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian
@ AV_PIX_FMT_Y210LE
packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, little-endian
@ AV_PIX_FMT_YUVA420P16LE
planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
@ AV_PIX_FMT_YUV440P10LE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
@ AV_PIX_FMT_BGR555BE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
@ AV_PIX_FMT_YUVA420P9LE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
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
@ AV_PIX_FMT_YUV420P14LE
planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
@ AV_PIX_FMT_YUV444P14BE
planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
@ AV_PIX_FMT_BGR4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
@ AV_PIX_FMT_X2RGB10LE
packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined
@ AV_PIX_FMT_P212LE
interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, little-endian
@ AV_PIX_FMT_YUV420P9BE
The following 12 formats have the disadvantage of needing 1 format for each bit depth.
#define AV_PIX_FMT_X2BGR10
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_YUV440P12LE
planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian
static int shift(int a, int b)
@ AV_PIX_FMT_YUV420P12BE
planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
@ AV_PIX_FMT_YUV422P10LE
planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
@ AV_PIX_FMT_RGB444BE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined
@ AV_PIX_FMT_YUV422P14BE
planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
@ AV_PIX_FMT_YA16BE
16 bits gray, 16 bits alpha (big-endian)
@ AV_PIX_FMT_GRAY12LE
Y , 12bpp, little-endian.
#define AV_PIX_FMT_BGR555
@ AV_PIX_FMT_GBRP9BE
planar GBR 4:4:4 27bpp, big-endian
@ AV_PIX_FMT_YUV420P10BE
planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
@ AV_PIX_FMT_RGBAF16BE
IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., big-endian.
@ AV_PIX_FMT_NV16
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_BGR444BE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined
@ AV_PIX_FMT_GBRP9LE
planar GBR 4:4:4 27bpp, little-endian
@ AV_PIX_FMT_GBRAP10LE
planar GBR 4:4:4:4 40bpp, little-endian
@ AV_PIX_FMT_BGR565BE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
@ AV_PIX_FMT_P012BE
like NV12, with 12bpp per component, data in the high bits, zeros in the low bits,...
@ AV_PIX_FMT_P410LE
interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, little-endian
@ AV_PIX_FMT_YUVA420P10LE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian)
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
@ 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...
@ AV_PIX_FMT_YUVA422P10BE
planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
@ AV_PIX_FMT_YUVA444P12LE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian
@ AV_PIX_FMT_YUVA422P9BE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian
#define AV_PIX_FMT_BGRA64
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
@ 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...
#define i(width, name, range_min, range_max)
@ AV_PIX_FMT_GRAY9BE
Y , 9bpp, big-endian.
@ 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...
#define AV_PIX_FMT_BGR444
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define AV_PIX_FMT_RGB555
#define AV_PIX_FMT_X2RGB10
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
#define AV_PIX_FMT_BGR565
@ AV_PIX_FMT_RGB4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
@ AV_PIX_FMT_YUV444P16BE
planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
@ AV_PIX_FMT_GBRPF32LE
IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian.
@ AV_PIX_FMT_NV42
as above, but U and V bytes are swapped
#define AV_PIX_FMT_RGB565
@ AV_PIX_FMT_GBRAP16LE
planar GBRA 4:4:4:4 64bpp, little-endian
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
@ AV_PIX_FMT_GRAY12BE
Y , 12bpp, big-endian.
@ AV_PIX_FMT_YVYU422
packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
@ 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...
@ AV_PIX_FMT_Y212LE
packed YUV 4:2:2 like YUYV422, 24bpp, data in the high bits, zeros in the low bits,...
@ AV_PIX_FMT_P410BE
interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, big-endian
@ AV_PIX_FMT_P016LE
like NV12, with 16bpp per component, little-endian
@ AV_PIX_FMT_GRAYF32BE
IEEE-754 single precision Y, 32bpp, big-endian.
@ AV_PIX_FMT_GBRP12BE
planar GBR 4:4:4 36bpp, big-endian
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
@ AV_PIX_FMT_YUV444P12BE
planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
@ AV_PIX_FMT_YUV444P9LE
planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
@ AV_PIX_FMT_P216LE
interleaved chroma YUV 4:2:2, 32bpp, little-endian
@ AV_PIX_FMT_YUVA420P10BE
planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian)
@ AV_PIX_FMT_RGB565BE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
@ AV_PIX_FMT_YUV420P16BE
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_YUV422P16BE
planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
@ AV_PIX_FMT_P212BE
interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, big-endian
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
@ AV_PIX_FMT_X2BGR10LE
packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined
@ AV_PIX_FMT_P010LE
like NV12, with 10bpp per component, data in the high bits, zeros in the low bits,...
@ AV_PIX_FMT_YUVA444P10LE
planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
@ AV_PIX_FMT_BGR555LE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
@ AV_PIX_FMT_P216BE
interleaved chroma YUV 4:2:2, 32bpp, big-endian
@ AV_PIX_FMT_P412LE
interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, little-endian
@ AV_PIX_FMT_GRAY14LE
Y , 14bpp, little-endian.
@ AV_PIX_FMT_XV36LE
packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, little-endian,...
@ AV_PIX_FMT_GRAY14BE
Y , 14bpp, big-endian.
@ AV_PIX_FMT_YUVA422P16BE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian)
@ AV_PIX_FMT_YUV440P10BE
planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian
@ AV_PIX_FMT_YUV422P9LE
planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
@ AV_PIX_FMT_YUVA422P16LE
planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian)
@ AV_PIX_FMT_GBRP14LE
planar GBR 4:4:4 42bpp, little-endian
@ AV_PIX_FMT_GBRAP10BE
planar GBR 4:4:4:4 40bpp, big-endian
@ AV_PIX_FMT_YUVA444P16LE
planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian)
@ AV_PIX_FMT_VUYX
packed VUYX 4:4:4, 32bpp, Variant of VUYA where alpha channel is left undefined
@ AV_PIX_FMT_YUVA422P12BE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian
@ AV_PIX_FMT_BGR444LE
packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined
@ AV_PIX_FMT_YUV422P12LE
planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
@ AV_PIX_FMT_YUVA420P9BE
planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian
@ AV_PIX_FMT_GBRAP14LE
planar GBR 4:4:4:4 56bpp, little-endian
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
@ 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...
@ AV_PIX_FMT_YUVA422P9LE
planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian
#define AV_PIX_FMT_RGB444