21 #include "../SDL_internal.h"
30 #define SDL_YUV_SD_THRESHOLD 576
106 planes[0] = (
const Uint8 *)yuv;
114 planes[0] = (
const Uint8 *)yuv;
120 planes[0] = (
const Uint8 *)yuv;
199 switch (dst_format) {
231 switch (dst_format) {
262 switch (dst_format) {
303 switch (dst_format) {
335 switch (dst_format) {
366 switch (dst_format) {
398 Uint32 src_format,
const void *
src,
int src_pitch,
399 Uint32 dst_format,
void *
dst,
int dst_pitch)
416 if (
yuv_rgb_sse(src_format, dst_format,
width,
height,
y, u,
v, y_stride, uv_stride, (
Uint8*)
dst, dst_pitch, yuv_type)) {
420 if (
yuv_rgb_std(src_format, dst_format,
width,
height,
y, u,
v, y_stride, uv_stride, (
Uint8*)
dst, dst_pitch, yuv_type)) {
462 const int src_pitch_x_2 = src_pitch * 2;
463 const int height_half =
height / 2;
464 const int height_remainder = (
height & 0x1);
465 const int width_half =
width / 2;
466 const int width_remainder = (
width & 0x1);
474 { 0.2990f, 0.5870f, 0.1140f },
475 { -0.1687f, -0.3313f, 0.5000f },
476 { 0.5000f, -0.4187f, -0.0813f },
481 { 0.2568f, 0.5041f, 0.0979f },
482 { -0.1482f, -0.2910f, 0.4392f },
483 { 0.4392f, -0.3678f, -0.0714f },
488 { 0.1826f, 0.6142f, 0.0620f },
489 {-0.1006f, -0.3386f, 0.4392f },
490 { 0.4392f, -0.3989f, -0.0403f },
495 #define MAKE_Y(r, g, b) (Uint8)((int)(cvt->y[0] * (r) + cvt->y[1] * (g) + cvt->y[2] * (b) + 0.5f) + cvt->y_offset)
496 #define MAKE_U(r, g, b) (Uint8)((int)(cvt->u[0] * (r) + cvt->u[1] * (g) + cvt->u[2] * (b) + 0.5f) + 128)
497 #define MAKE_V(r, g, b) (Uint8)((int)(cvt->v[0] * (r) + cvt->v[1] * (g) + cvt->v[2] * (b) + 0.5f) + 128)
499 #define READ_2x2_PIXELS \
500 const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \
501 const Uint32 p2 = ((const Uint32 *)curr_row)[2 * i + 1]; \
502 const Uint32 p3 = ((const Uint32 *)next_row)[2 * i]; \
503 const Uint32 p4 = ((const Uint32 *)next_row)[2 * i + 1]; \
504 const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000) + (p3 & 0x00ff0000) + (p4 & 0x00ff0000)) >> 18; \
505 const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00) + (p3 & 0x0000ff00) + (p4 & 0x0000ff00)) >> 10; \
506 const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff) + (p3 & 0x000000ff) + (p4 & 0x000000ff)) >> 2; \
508 #define READ_2x1_PIXELS \
509 const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \
510 const Uint32 p2 = ((const Uint32 *)next_row)[2 * i]; \
511 const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000)) >> 17; \
512 const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00)) >> 9; \
513 const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff)) >> 1; \
515 #define READ_1x2_PIXELS \
516 const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \
517 const Uint32 p2 = ((const Uint32 *)curr_row)[2 * i + 1]; \
518 const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000)) >> 17; \
519 const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00)) >> 9; \
520 const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff)) >> 1; \
522 #define READ_1x1_PIXEL \
523 const Uint32 p = ((const Uint32 *)curr_row)[2 * i]; \
524 const Uint32 r = (p & 0x00ff0000) >> 16; \
525 const Uint32 g = (p & 0x0000ff00) >> 8; \
526 const Uint32 b = (p & 0x000000ff); \
528 #define READ_TWO_RGB_PIXELS \
529 const Uint32 p = ((const Uint32 *)curr_row)[2 * i]; \
530 const Uint32 r = (p & 0x00ff0000) >> 16; \
531 const Uint32 g = (p & 0x0000ff00) >> 8; \
532 const Uint32 b = (p & 0x000000ff); \
533 const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i + 1]; \
534 const Uint32 r1 = (p1 & 0x00ff0000) >> 16; \
535 const Uint32 g1 = (p1 & 0x0000ff00) >> 8; \
536 const Uint32 b1 = (p1 & 0x000000ff); \
537 const Uint32 R = (r + r1)/2; \
538 const Uint32 G = (g + g1)/2; \
539 const Uint32 B = (b + b1)/2; \
541 #define READ_ONE_RGB_PIXEL READ_1x1_PIXEL
550 const Uint8 *curr_row, *next_row;
555 Uint8 *plane_interleaved_uv;
556 Uint32 y_stride, uv_stride, y_skip, uv_skip;
559 (
const Uint8 **)&plane_y, (
const Uint8 **)&plane_u, (
const Uint8 **)&plane_v,
560 &y_stride, &uv_stride);
561 plane_interleaved_uv = (plane_y +
height * y_stride);
562 y_skip = (y_stride -
width);
570 const Uint32 r = (p1 & 0x00ff0000) >> 16;
571 const Uint32 g = (p1 & 0x0000ff00) >> 8;
572 const Uint32 b = (p1 & 0x000000ff);
576 curr_row += src_pitch;
581 next_row += src_pitch;
586 uv_skip = (uv_stride - (
width + 1)/2);
587 for (
j = 0;
j < height_half;
j++) {
588 for (
i = 0;
i < width_half;
i++) {
593 if (width_remainder) {
600 curr_row += src_pitch_x_2;
601 next_row += src_pitch_x_2;
603 if (height_remainder) {
604 for (
i = 0;
i < width_half;
i++) {
609 if (width_remainder) {
620 uv_skip = (uv_stride - ((
width + 1)/2)*2);
621 for (
j = 0;
j < height_half;
j++) {
622 for (
i = 0;
i < width_half;
i++) {
624 *plane_interleaved_uv++ =
MAKE_U(
r,
g,
b);
625 *plane_interleaved_uv++ =
MAKE_V(
r,
g,
b);
627 if (width_remainder) {
629 *plane_interleaved_uv++ =
MAKE_U(
r,
g,
b);
630 *plane_interleaved_uv++ =
MAKE_V(
r,
g,
b);
632 plane_interleaved_uv += uv_skip;
633 curr_row += src_pitch_x_2;
634 next_row += src_pitch_x_2;
636 if (height_remainder) {
637 for (
i = 0;
i < width_half;
i++) {
639 *plane_interleaved_uv++ =
MAKE_U(
r,
g,
b);
640 *plane_interleaved_uv++ =
MAKE_V(
r,
g,
b);
642 if (width_remainder) {
644 *plane_interleaved_uv++ =
MAKE_U(
r,
g,
b);
645 *plane_interleaved_uv++ =
MAKE_V(
r,
g,
b);
651 uv_skip = (uv_stride - ((
width + 1)/2)*2);
652 for (
j = 0;
j < height_half;
j++) {
653 for (
i = 0;
i < width_half;
i++) {
655 *plane_interleaved_uv++ =
MAKE_V(
r,
g,
b);
656 *plane_interleaved_uv++ =
MAKE_U(
r,
g,
b);
658 if (width_remainder) {
660 *plane_interleaved_uv++ =
MAKE_V(
r,
g,
b);
661 *plane_interleaved_uv++ =
MAKE_U(
r,
g,
b);
663 plane_interleaved_uv += uv_skip;
664 curr_row += src_pitch_x_2;
665 next_row += src_pitch_x_2;
667 if (height_remainder) {
668 for (
i = 0;
i < width_half;
i++) {
670 *plane_interleaved_uv++ =
MAKE_V(
r,
g,
b);
671 *plane_interleaved_uv++ =
MAKE_U(
r,
g,
b);
673 if (width_remainder) {
675 *plane_interleaved_uv++ =
MAKE_V(
r,
g,
b);
676 *plane_interleaved_uv++ =
MAKE_U(
r,
g,
b);
689 const int row_size = (4 * ((
width + 1) / 2));
692 if (dst_pitch < row_size) {
693 return SDL_SetError(
"Destination pitch is too small, expected at least %d\n", row_size);
695 plane_skip = (dst_pitch - row_size);
701 for (
i = 0;
i < width_half;
i++) {
709 if (width_remainder) {
718 curr_row += src_pitch;
724 for (
i = 0;
i < width_half;
i++) {
732 if (width_remainder) {
741 curr_row += src_pitch;
747 for (
i = 0;
i < width_half;
i++) {
755 if (width_remainder) {
764 curr_row += src_pitch;
776 #undef READ_2x2_PIXELS
777 #undef READ_2x1_PIXELS
778 #undef READ_1x2_PIXELS
779 #undef READ_1x1_PIXEL
780 #undef READ_TWO_RGB_PIXELS
781 #undef READ_ONE_RGB_PIXEL
787 Uint32 src_format,
const void *
src,
int src_pitch,
788 Uint32 dst_format,
void *
dst,
int dst_pitch)
845 const void *
src,
int src_pitch,
void *
dst,
int dst_pitch)
861 src_pitch = (src_pitch + 1) / 2;
862 dst_pitch = (dst_pitch + 1) / 2;
872 src_pitch = ((src_pitch + 1) / 2)*2;
873 dst_pitch = ((dst_pitch + 1) / 2)*2;
901 const int UVwidth = (
width + 1)/2;
902 const int UVheight = (
height + 1)/2;
909 int UVpitch = (dst_pitch + 1)/2;
919 for (
y = 0;
y < UVheight; ++
y) {
930 int srcUVPitch = ((src_pitch + 1)/2);
931 int dstUVPitch = ((dst_pitch + 1)/2);
935 dstUV = (
Uint8 *)
dst + UVheight * dstUVPitch;
936 for (
y = 0;
y < UVheight; ++
y) {
944 for (
y = 0;
y < UVheight; ++
y) {
957 const int UVwidth = (
width + 1)/2;
958 const int UVheight = (
height + 1)/2;
959 const int srcUVPitch = ((src_pitch + 1)/2);
960 const int srcUVPitchLeft = srcUVPitch - UVwidth;
961 const int dstUVPitch = ((dst_pitch + 1)/2)*2;
962 const int dstUVPitchLeft = dstUVPitch - UVwidth*2;
963 const Uint8 *src1, *src2;
986 src1 = src2 + UVheight * srcUVPitch;
989 src2 = src1 + UVheight * srcUVPitch;
999 __m128i
u = _mm_loadu_si128((__m128i *)src1);
1000 __m128i
v = _mm_loadu_si128((__m128i *)src2);
1001 __m128i uv1 = _mm_unpacklo_epi8(
u,
v);
1002 __m128i uv2 = _mm_unpackhi_epi8(
u,
v);
1003 _mm_storeu_si128((__m128i*)dstUV, uv1);
1004 _mm_storeu_si128((__m128i*)(dstUV + 16), uv2);
1016 src1 += srcUVPitchLeft;
1017 src2 += srcUVPitchLeft;
1018 dstUV += dstUVPitchLeft;
1031 const int UVwidth = (
width + 1)/2;
1032 const int UVheight = (
height + 1)/2;
1033 const int srcUVPitch = ((src_pitch + 1)/2)*2;
1034 const int srcUVPitchLeft = srcUVPitch - UVwidth*2;
1035 const int dstUVPitch = ((dst_pitch + 1)/2);
1036 const int dstUVPitchLeft = dstUVPitch - UVwidth;
1060 dst1 = dst2 + UVheight * dstUVPitch;
1063 dst2 = dst1 + UVheight * dstUVPitch;
1072 __m128i
mask = _mm_set1_epi16(0x00FF);
1074 __m128i uv1 = _mm_loadu_si128((__m128i*)srcUV);
1075 __m128i uv2 = _mm_loadu_si128((__m128i*)(srcUV+16));
1076 __m128i
u1 = _mm_and_si128(uv1,
mask);
1077 __m128i
u2 = _mm_and_si128(uv2,
mask);
1078 __m128i
u = _mm_packus_epi16(
u1,
u2);
1079 __m128i
v1 = _mm_srli_epi16(uv1, 8);
1080 __m128i
v2 = _mm_srli_epi16(uv2, 8);
1081 __m128i
v = _mm_packus_epi16(
v1,
v2);
1082 _mm_storeu_si128((__m128i*)dst1,
u);
1083 _mm_storeu_si128((__m128i*)dst2,
v);
1095 srcUV += srcUVPitchLeft;
1096 dst1 += dstUVPitchLeft;
1097 dst2 += dstUVPitchLeft;
1110 const int UVwidth = (
width + 1)/2;
1111 const int UVheight = (
height + 1)/2;
1112 const int srcUVPitch = ((src_pitch + 1)/2)*2;
1113 const int srcUVPitchLeft = (srcUVPitch - UVwidth*2)/
sizeof(
Uint16);
1114 const int dstUVPitch = ((dst_pitch + 1)/2)*2;
1115 const int dstUVPitchLeft = (dstUVPitch - UVwidth*2)/
sizeof(
Uint16);
1134 __m128i uv = _mm_loadu_si128((__m128i*)srcUV);
1135 __m128i
v = _mm_slli_epi16(uv, 8);
1136 __m128i
u = _mm_srli_epi16(uv, 8);
1137 __m128i vu = _mm_or_si128(
v,
u);
1138 _mm_storeu_si128((__m128i*)dstUV, vu);
1148 srcUV += srcUVPitchLeft;
1149 dstUV += dstUVPitchLeft;
1156 Uint32 src_format,
const void *
src,
int src_pitch,
1157 Uint32 dst_format,
void *
dst,
int dst_pitch)
1171 switch (src_format) {
1173 switch (dst_format) {
1185 switch (dst_format) {
1197 switch (dst_format) {
1209 switch (dst_format) {
1227 #define PACKED4_TO_PACKED4_ROW_SSE2(shuffle) \
1229 __m128i yuv = _mm_loadu_si128((__m128i*)srcYUV); \
1230 __m128i lo = _mm_unpacklo_epi8(yuv, _mm_setzero_si128()); \
1231 __m128i hi = _mm_unpackhi_epi8(yuv, _mm_setzero_si128()); \
1232 lo = _mm_shufflelo_epi16(lo, shuffle); \
1233 lo = _mm_shufflehi_epi16(lo, shuffle); \
1234 hi = _mm_shufflelo_epi16(hi, shuffle); \
1235 hi = _mm_shufflehi_epi16(hi, shuffle); \
1236 yuv = _mm_packus_epi16(lo, hi); \
1237 _mm_storeu_si128((__m128i*)dstYUV, yuv); \
1249 const int YUVwidth = (
width + 1)/2;
1250 const int srcYUVPitchLeft = (src_pitch - YUVwidth*4);
1251 const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4);
1263 PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 3, 0, 1));
1281 srcYUV += srcYUVPitchLeft;
1282 dstYUV += dstYUVPitchLeft;
1291 const int YUVwidth = (
width + 1)/2;
1292 const int srcYUVPitchLeft = (src_pitch - YUVwidth*4);
1293 const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4);
1305 PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(1, 2, 3, 0));
1323 srcYUV += srcYUVPitchLeft;
1324 dstYUV += dstYUVPitchLeft;
1333 const int YUVwidth = (
width + 1)/2;
1334 const int srcYUVPitchLeft = (src_pitch - YUVwidth*4);
1335 const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4);
1347 PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 3, 0, 1));
1365 srcYUV += srcYUVPitchLeft;
1366 dstYUV += dstYUVPitchLeft;
1375 const int YUVwidth = (
width + 1)/2;
1376 const int srcYUVPitchLeft = (src_pitch - YUVwidth*4);
1377 const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4);
1389 PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(0, 3, 2, 1));
1407 srcYUV += srcYUVPitchLeft;
1408 dstYUV += dstYUVPitchLeft;
1417 const int YUVwidth = (
width + 1)/2;
1418 const int srcYUVPitchLeft = (src_pitch - YUVwidth*4);
1419 const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4);
1431 PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(1, 2, 3, 0));
1449 srcYUV += srcYUVPitchLeft;
1450 dstYUV += dstYUVPitchLeft;
1459 const int YUVwidth = (
width + 1)/2;
1460 const int srcYUVPitchLeft = (src_pitch - YUVwidth*4);
1461 const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4);
1473 PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 1, 0, 3));
1491 srcYUV += srcYUVPitchLeft;
1492 dstYUV += dstYUVPitchLeft;
1499 Uint32 src_format,
const void *
src,
int src_pitch,
1500 Uint32 dst_format,
void *
dst,
int dst_pitch)
1502 switch (src_format) {
1504 switch (dst_format) {
1514 switch (dst_format) {
1524 switch (dst_format) {
1541 Uint32 src_format,
const void *
src,
int src_pitch,
1542 Uint32 dst_format,
void *
dst,
int dst_pitch)
1546 Uint32 srcY_pitch, srcUV_pitch;
1547 Uint32 srcY_pitch_left, srcUV_pitch_left, srcUV_pixel_stride;
1548 Uint8 *
dstY1, *dstY2, *dstU1, *dstU2, *dstV1, *dstV2;
1549 Uint32 dstY_pitch, dstUV_pitch;
1553 return SDL_SetError(
"Can't change YUV plane types in-place");
1557 &
srcY1, &srcU, &srcV, &srcY_pitch, &srcUV_pitch) < 0) {
1560 srcY2 =
srcY1 + srcY_pitch;
1561 srcY_pitch_left = (srcY_pitch -
width);
1564 srcUV_pixel_stride = 2;
1565 srcUV_pitch_left = (srcUV_pitch - 2*((
width + 1)/2));
1567 srcUV_pixel_stride = 1;
1568 srcUV_pitch_left = (srcUV_pitch - ((
width + 1)/2));
1573 &dstY_pitch, &dstUV_pitch) < 0) {
1576 dstY2 =
dstY1 + dstY_pitch;
1577 dstU2 = dstU1 + dstUV_pitch;
1578 dstV2 = dstV1 + dstUV_pitch;
1579 dst_pitch_left = (dstY_pitch - 4*((
width + 1)/2));
1583 for (
x = 0;
x < (
width - 1);
x += 2) {
1600 srcU += srcUV_pixel_stride;
1601 srcV += srcUV_pixel_stride;
1626 srcU += srcUV_pixel_stride;
1627 srcV += srcUV_pixel_stride;
1634 srcY1 += srcY_pitch_left + srcY_pitch;
1635 srcY2 += srcY_pitch_left + srcY_pitch;
1636 srcU += srcUV_pitch_left;
1637 srcV += srcUV_pitch_left;
1638 dstY1 += dst_pitch_left + dstY_pitch;
1639 dstY2 += dst_pitch_left + dstY_pitch;
1640 dstU1 += dst_pitch_left + dstUV_pitch;
1641 dstU2 += dst_pitch_left + dstUV_pitch;
1642 dstV1 += dst_pitch_left + dstUV_pitch;
1643 dstV2 += dst_pitch_left + dstUV_pitch;
1648 for (
x = 0;
x < (
width - 1);
x += 2) {
1657 srcU += srcUV_pixel_stride;
1658 srcV += srcUV_pixel_stride;
1673 srcU += srcUV_pixel_stride;
1674 srcV += srcUV_pixel_stride;
1684 Uint32 src_format,
const void *
src,
int src_pitch,
1685 Uint32 dst_format,
void *
dst,
int dst_pitch)
1688 const Uint8 *
srcY1, *srcY2, *srcU1, *srcU2, *srcV1, *srcV2;
1689 Uint32 srcY_pitch, srcUV_pitch;
1692 Uint32 dstY_pitch, dstUV_pitch;
1693 Uint32 dstY_pitch_left, dstUV_pitch_left, dstUV_pixel_stride;
1696 return SDL_SetError(
"Can't change YUV plane types in-place");
1700 &
srcY1, &srcU1, &srcV1, &srcY_pitch, &srcUV_pitch) < 0) {
1703 srcY2 =
srcY1 + srcY_pitch;
1704 srcU2 = srcU1 + srcUV_pitch;
1705 srcV2 = srcV1 + srcUV_pitch;
1706 src_pitch_left = (srcY_pitch - 4*((
width + 1)/2));
1710 &dstY_pitch, &dstUV_pitch) < 0) {
1713 dstY2 =
dstY1 + dstY_pitch;
1714 dstY_pitch_left = (dstY_pitch -
width);
1717 dstUV_pixel_stride = 2;
1718 dstUV_pitch_left = (dstUV_pitch - 2*((
width + 1)/2));
1720 dstUV_pixel_stride = 1;
1721 dstUV_pitch_left = (dstUV_pitch - ((
width + 1)/2));
1726 for (
x = 0;
x < (
width - 1);
x += 2) {
1746 dstU += dstUV_pixel_stride;
1747 dstV += dstUV_pixel_stride;
1771 dstU += dstUV_pixel_stride;
1772 dstV += dstUV_pixel_stride;
1775 srcY1 += src_pitch_left + srcY_pitch;
1776 srcY2 += src_pitch_left + srcY_pitch;
1777 srcU1 += src_pitch_left + srcUV_pitch;
1778 srcU2 += src_pitch_left + srcUV_pitch;
1779 srcV1 += src_pitch_left + srcUV_pitch;
1780 srcV2 += src_pitch_left + srcUV_pitch;
1781 dstY1 += dstY_pitch_left + dstY_pitch;
1782 dstY2 += dstY_pitch_left + dstY_pitch;
1783 dstU += dstUV_pitch_left;
1784 dstV += dstUV_pitch_left;
1789 for (
x = 0;
x < (
width - 1);
x += 2) {
1800 dstU += dstUV_pixel_stride;
1801 dstV += dstUV_pixel_stride;
1818 Uint32 src_format,
const void *
src,
int src_pitch,
1819 Uint32 dst_format,
void *
dst,
int dst_pitch)
1822 if (src_format == dst_format) {
#define SDL_GetPixelFormatName
#define SDL_ConvertPixels
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
#define SDL_OutOfMemory()
int uint32_t uint32_t uint32_t const uint32_t const uint32_t pitches[4]
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei width
GLdouble GLdouble GLdouble r
GLint GLint GLint GLint GLint x
GLint GLint GLsizei GLsizei height
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint GLint GLint dstY1
GLenum GLint GLint GLint GLint GLuint GLenum GLint GLint GLint dstY
GLfloat GLfloat GLfloat v2
GLenum GLint GLint GLint srcY
@ SDL_PIXELFORMAT_RGBA8888
@ SDL_PIXELFORMAT_BGRX8888
@ SDL_PIXELFORMAT_ABGR8888
@ SDL_PIXELFORMAT_BGRA8888
@ SDL_PIXELFORMAT_ARGB8888
@ SDL_PIXELFORMAT_RGBX8888
SDL_YUV_CONVERSION_MODE
The formula used for converting between YUV and RGB.
@ SDL_YUV_CONVERSION_BT601
@ SDL_YUV_CONVERSION_JPEG
@ SDL_YUV_CONVERSION_BT709
@ SDL_YUV_CONVERSION_AUTOMATIC
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
static int SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch)
static int SDL_ConvertPixels_YUV_to_YUV_Copy(int width, int height, Uint32 format, const void *src, int src_pitch, void *dst, int dst_pitch)
static int SDL_ConvertPixels_YUY2_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
static int SDL_ConvertPixels_Planar2x2_to_Packed4(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch)
static SDL_bool yuv_rgb_std(Uint32 src_format, Uint32 dst_format, Uint32 width, Uint32 height, const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, Uint8 *rgb, Uint32 rgb_stride, YCbCrType yuv_type)
static int SDL_ConvertPixels_SwapUVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
int SDL_ConvertPixels_RGB_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch)
#define READ_TWO_RGB_PIXELS
static int SDL_ConvertPixels_PackUVPlanes_to_NV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV)
static int SDL_ConvertPixels_SplitNV_to_UVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV)
static int SDL_ConvertPixels_UYVY_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
static int SDL_ConvertPixels_Packed4_to_Packed4(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch)
static SDL_bool IsPlanar2x2Format(Uint32 format)
int SDL_ConvertPixels_YUV_to_RGB(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch)
static int SDL_ConvertPixels_Planar2x2_to_Planar2x2(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch)
static int GetYUVConversionType(int width, int height, YCbCrType *yuv_type)
static int SDL_ConvertPixels_UYVY_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
static SDL_YUV_CONVERSION_MODE SDL_YUV_ConversionMode
static SDL_bool IsPacked4Format(Uint32 format)
#define READ_ONE_RGB_PIXEL
static int SDL_ConvertPixels_SwapNV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
static int SDL_ConvertPixels_Packed4_to_Planar2x2(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch)
#define SDL_YUV_SD_THRESHOLD
static SDL_bool yuv_rgb_sse(Uint32 src_format, Uint32 dst_format, Uint32 width, Uint32 height, const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, Uint8 *rgb, Uint32 rgb_stride, YCbCrType yuv_type)
static int SDL_ConvertPixels_YVYU_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
int SDL_ConvertPixels_YUV_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch)
static int SDL_ConvertPixels_YVYU_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
static int SDL_ConvertPixels_YUY2_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
void SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode)
Set the YUV conversion mode.
static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, int yuv_pitch, const Uint8 **y, const Uint8 **u, const Uint8 **v, Uint32 *y_stride, Uint32 *uv_stride)
SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionMode()
Get the YUV conversion mode.
SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionModeForResolution(int width, int height)
Get the YUV conversion mode, returning the correct mode for the resolution when the current conversio...
void rgb24_yuv420_std(uint32_t width, uint32_t height, const uint8_t *RGB, uint32_t RGB_stride, uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, YCbCrType yuv_type)
void yuv420_rgba_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuvnv12_abgr_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv420_bgra_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuvnv12_rgb565_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuvnv12_bgra_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv422_bgra_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuvnv12_bgra_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv420_argb_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuvnv12_rgb24_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv422_rgb24_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv422_abgr_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv422_rgba_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv420_abgr_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuvnv12_argb_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv422_rgb565_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv422_rgb24_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv420_abgr_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv422_bgra_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv420_rgb565_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv420_bgra_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv422_argb_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuvnv12_rgba_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv422_abgr_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuvnv12_rgb24_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv420_rgb565_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv420_rgba_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv422_rgb565_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv420_rgb24_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv422_argb_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv420_argb_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuvnv12_rgba_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv420_rgb24_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuvnv12_rgb565_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuvnv12_abgr_std(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuvnv12_argb_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)
void yuv422_rgba_sseu(uint32_t width, uint32_t height, const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, uint8_t *rgb, uint32_t rgb_stride, YCbCrType yuv_type)