SDL
2.0
|
#include "../SDL_internal.h"
#include "SDL_endian.h"
#include "SDL_video.h"
#include "SDL_pixels_c.h"
#include "yuv2rgb/yuv_rgb.h"
Go to the source code of this file.
Data Structures | |
struct | RGB2YUVFactors |
Macros | |
#define | SDL_YUV_SD_THRESHOLD 576 |
#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) |
#define | MAKE_U(r, g, b) (Uint8)((int)(cvt->u[0] * (r) + cvt->u[1] * (g) + cvt->u[2] * (b) + 0.5f) + 128) |
#define | MAKE_V(r, g, b) (Uint8)((int)(cvt->v[0] * (r) + cvt->v[1] * (g) + cvt->v[2] * (b) + 0.5f) + 128) |
#define | READ_2x2_PIXELS |
#define | READ_2x1_PIXELS |
#define | READ_1x2_PIXELS |
#define | READ_1x1_PIXEL |
#define | READ_TWO_RGB_PIXELS |
#define | READ_ONE_RGB_PIXEL READ_1x1_PIXEL |
#define | PACKED4_TO_PACKED4_ROW_SSE2(shuffle) |
Functions | |
void | SDL_SetYUVConversionMode (SDL_YUV_CONVERSION_MODE mode) |
Set the YUV conversion mode. More... | |
SDL_YUV_CONVERSION_MODE | SDL_GetYUVConversionMode () |
Get the YUV conversion mode. More... | |
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 conversion mode is SDL_YUV_CONVERSION_AUTOMATIC. More... | |
static int | GetYUVConversionType (int width, int height, YCbCrType *yuv_type) |
static SDL_bool | IsPlanar2x2Format (Uint32 format) |
static SDL_bool | IsPacked4Format (Uint32 format) |
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) |
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 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) |
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_ARGB8888_to_YUV (int width, int height, const void *src, int src_pitch, Uint32 dst_format, 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) |
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_SwapUVPlanes (int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) |
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_SwapNV (int width, int height, const void *src, int src_pitch, 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 | SDL_ConvertPixels_YUY2_to_UYVY (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) |
static int | SDL_ConvertPixels_UYVY_to_YUY2 (int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) |
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_YVYU_to_YUY2 (int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) |
static int | SDL_ConvertPixels_YVYU_to_UYVY (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 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 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) |
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) |
Variables | |
static SDL_YUV_CONVERSION_MODE | SDL_YUV_ConversionMode = SDL_YUV_CONVERSION_BT601 |
#define MAKE_U | ( | r, | |
g, | |||
b | |||
) | (Uint8)((int)(cvt->u[0] * (r) + cvt->u[1] * (g) + cvt->u[2] * (b) + 0.5f) + 128) |
Referenced by SDL_ConvertPixels_ARGB8888_to_YUV().
#define MAKE_V | ( | r, | |
g, | |||
b | |||
) | (Uint8)((int)(cvt->v[0] * (r) + cvt->v[1] * (g) + cvt->v[2] * (b) + 0.5f) + 128) |
Referenced by SDL_ConvertPixels_ARGB8888_to_YUV().
#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) |
Referenced by SDL_ConvertPixels_ARGB8888_to_YUV().
#define PACKED4_TO_PACKED4_ROW_SSE2 | ( | shuffle | ) |
Definition at line 1223 of file SDL_yuv.c.
Referenced by SDL_ConvertPixels_UYVY_to_YUY2(), SDL_ConvertPixels_UYVY_to_YVYU(), SDL_ConvertPixels_YUY2_to_UYVY(), SDL_ConvertPixels_YUY2_to_YVYU(), SDL_ConvertPixels_YVYU_to_UYVY(), and SDL_ConvertPixels_YVYU_to_YUY2().
#define READ_1x1_PIXEL |
Referenced by SDL_ConvertPixels_ARGB8888_to_YUV().
#define READ_1x2_PIXELS |
Referenced by SDL_ConvertPixels_ARGB8888_to_YUV().
#define READ_2x1_PIXELS |
Referenced by SDL_ConvertPixels_ARGB8888_to_YUV().
#define READ_2x2_PIXELS |
Referenced by SDL_ConvertPixels_ARGB8888_to_YUV().
#define READ_ONE_RGB_PIXEL READ_1x1_PIXEL |
Referenced by SDL_ConvertPixels_ARGB8888_to_YUV().
#define READ_TWO_RGB_PIXELS |
Referenced by SDL_ConvertPixels_ARGB8888_to_YUV().
#define SDL_YUV_SD_THRESHOLD 576 |
Definition at line 29 of file SDL_yuv.c.
Referenced by SDL_GetYUVConversionModeForResolution().
|
static |
Definition at line 58 of file SDL_yuv.c.
References SDL_GetYUVConversionModeForResolution(), SDL_SetError, SDL_YUV_CONVERSION_BT601, SDL_YUV_CONVERSION_BT709, SDL_YUV_CONVERSION_JPEG, YCBCR_601, YCBCR_709, and YCBCR_JPEG.
Referenced by SDL_ConvertPixels_RGB_to_YUV(), and SDL_ConvertPixels_YUV_to_RGB().
|
static |
Definition at line 91 of file SDL_yuv.c.
References NULL, SDL_GetPixelFormatName, SDL_PIXELFORMAT_IYUV, SDL_PIXELFORMAT_NV12, SDL_PIXELFORMAT_NV21, SDL_PIXELFORMAT_UYVY, SDL_PIXELFORMAT_YUY2, SDL_PIXELFORMAT_YV12, SDL_PIXELFORMAT_YVYU, and SDL_SetError.
Referenced by SDL_ConvertPixels_ARGB8888_to_YUV(), SDL_ConvertPixels_Packed4_to_Planar2x2(), SDL_ConvertPixels_Planar2x2_to_Packed4(), SDL_ConvertPixels_RGB_to_YUV(), and SDL_ConvertPixels_YUV_to_RGB().
Definition at line 84 of file SDL_yuv.c.
References SDL_PIXELFORMAT_UYVY, SDL_PIXELFORMAT_YUY2, and SDL_PIXELFORMAT_YVYU.
Referenced by SDL_ConvertPixels_YUV_to_YUV(), and SDL_ConvertPixels_YUV_to_YUV_Copy().
Definition at line 76 of file SDL_yuv.c.
References SDL_PIXELFORMAT_IYUV, SDL_PIXELFORMAT_NV12, SDL_PIXELFORMAT_NV21, and SDL_PIXELFORMAT_YV12.
Referenced by SDL_ConvertPixels_YUV_to_YUV(), and SDL_ConvertPixels_YUV_to_YUV_Copy().
|
static |
Definition at line 457 of file SDL_yuv.c.
References G, GetYUVPlanes(), i, j, MAKE_U, MAKE_V, MAKE_Y, READ_1x1_PIXEL, READ_1x2_PIXELS, READ_2x1_PIXELS, READ_2x2_PIXELS, READ_ONE_RGB_PIXEL, READ_TWO_RGB_PIXELS, SDL_GetPixelFormatName, SDL_GetYUVConversionModeForResolution(), SDL_PIXELFORMAT_IYUV, SDL_PIXELFORMAT_NV12, SDL_PIXELFORMAT_NV21, SDL_PIXELFORMAT_UYVY, SDL_PIXELFORMAT_YUY2, SDL_PIXELFORMAT_YV12, SDL_PIXELFORMAT_YVYU, and SDL_SetError.
Referenced by SDL_ConvertPixels_RGB_to_YUV().
|
static |
Definition at line 1492 of file SDL_yuv.c.
References SDL_ConvertPixels_UYVY_to_YUY2(), SDL_ConvertPixels_UYVY_to_YVYU(), SDL_ConvertPixels_YUY2_to_UYVY(), SDL_ConvertPixels_YUY2_to_YVYU(), SDL_ConvertPixels_YVYU_to_UYVY(), SDL_ConvertPixels_YVYU_to_YUY2(), SDL_GetPixelFormatName, SDL_PIXELFORMAT_UYVY, SDL_PIXELFORMAT_YUY2, SDL_PIXELFORMAT_YVYU, and SDL_SetError.
Referenced by SDL_ConvertPixels_YUV_to_YUV().
|
static |
Definition at line 1677 of file SDL_yuv.c.
References GetYUVPlanes(), SDL_PIXELFORMAT_NV12, SDL_PIXELFORMAT_NV21, SDL_SetError, and RGB2YUVFactors::y.
Referenced by SDL_ConvertPixels_YUV_to_YUV().
|
static |
Definition at line 951 of file SDL_yuv.c.
References NULL, SDL_free, SDL_HasSSE2, SDL_malloc, SDL_memcpy, SDL_OutOfMemory, RGB2YUVFactors::u, and RGB2YUVFactors::y.
Referenced by SDL_ConvertPixels_Planar2x2_to_Planar2x2().
|
static |
Definition at line 1534 of file SDL_yuv.c.
References GetYUVPlanes(), SDL_PIXELFORMAT_NV12, SDL_PIXELFORMAT_NV21, SDL_SetError, and RGB2YUVFactors::y.
Referenced by SDL_ConvertPixels_YUV_to_YUV().
|
static |
Definition at line 1152 of file SDL_yuv.c.
References i, SDL_ConvertPixels_PackUVPlanes_to_NV(), SDL_ConvertPixels_SplitNV_to_UVPlanes(), SDL_ConvertPixels_SwapNV(), SDL_ConvertPixels_SwapUVPlanes(), SDL_FALSE, SDL_GetPixelFormatName, SDL_memcpy, SDL_PIXELFORMAT_IYUV, SDL_PIXELFORMAT_NV12, SDL_PIXELFORMAT_NV21, SDL_PIXELFORMAT_YV12, SDL_SetError, and SDL_TRUE.
Referenced by SDL_ConvertPixels_YUV_to_YUV().
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 | ||
) |
Definition at line 783 of file SDL_yuv.c.
References GetYUVConversionType(), GetYUVPlanes(), NULL, rgb24_yuv420_std(), SDL_ConvertPixels, SDL_ConvertPixels_ARGB8888_to_YUV(), SDL_free, SDL_malloc, SDL_OutOfMemory, SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB24, RGB2YUVFactors::u, RGB2YUVFactors::v, and RGB2YUVFactors::y.
Referenced by SDL_ConvertPixels().
|
static |
Definition at line 1025 of file SDL_yuv.c.
References NULL, SDL_free, SDL_HasSSE2, SDL_malloc, SDL_memcpy, SDL_OutOfMemory, RGB2YUVFactors::u, and RGB2YUVFactors::y.
Referenced by SDL_ConvertPixels_Planar2x2_to_Planar2x2().
|
static |
Definition at line 1104 of file SDL_yuv.c.
References SDL_HasSSE2, SDL_Swap16(), RGB2YUVFactors::u, and RGB2YUVFactors::y.
Referenced by SDL_ConvertPixels_Planar2x2_to_Planar2x2().
|
static |
Definition at line 895 of file SDL_yuv.c.
References SDL_free, SDL_malloc, SDL_memcpy, SDL_OutOfMemory, and RGB2YUVFactors::y.
Referenced by SDL_ConvertPixels_Planar2x2_to_Planar2x2().
|
static |
Definition at line 1324 of file SDL_yuv.c.
References PACKED4_TO_PACKED4_ROW_SSE2, SDL_HasSSE2, V, and RGB2YUVFactors::y.
Referenced by SDL_ConvertPixels_Packed4_to_Packed4().
|
static |
Definition at line 1366 of file SDL_yuv.c.
References PACKED4_TO_PACKED4_ROW_SSE2, SDL_HasSSE2, V, and RGB2YUVFactors::y.
Referenced by SDL_ConvertPixels_Packed4_to_Packed4().
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 | ||
) |
Definition at line 394 of file SDL_yuv.c.
References GetYUVConversionType(), GetYUVPlanes(), NULL, SDL_ConvertPixels, SDL_ConvertPixels_YUV_to_RGB(), SDL_free, SDL_malloc, SDL_OutOfMemory, SDL_PIXELFORMAT_ARGB8888, SDL_SetError, YCBCR_601, yuv_rgb_sse(), and yuv_rgb_std().
Referenced by SDL_ConvertPixels(), and SDL_ConvertPixels_YUV_to_RGB().
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 | ||
) |
Definition at line 1809 of file SDL_yuv.c.
References IsPacked4Format(), IsPlanar2x2Format(), SDL_ConvertPixels_Packed4_to_Packed4(), SDL_ConvertPixels_Packed4_to_Planar2x2(), SDL_ConvertPixels_Planar2x2_to_Packed4(), SDL_ConvertPixels_Planar2x2_to_Planar2x2(), SDL_ConvertPixels_YUV_to_YUV_Copy(), SDL_GetPixelFormatName, and SDL_SetError.
Referenced by SDL_ConvertPixels().
|
static |
Definition at line 841 of file SDL_yuv.c.
References i, IsPacked4Format(), IsPlanar2x2Format(), SDL_GetPixelFormatName, SDL_memcpy, SDL_PIXELFORMAT_IYUV, SDL_PIXELFORMAT_NV12, SDL_PIXELFORMAT_NV21, SDL_PIXELFORMAT_YV12, and SDL_SetError.
Referenced by SDL_ConvertPixels_YUV_to_YUV().
|
static |
Definition at line 1240 of file SDL_yuv.c.
References PACKED4_TO_PACKED4_ROW_SSE2, SDL_HasSSE2, V, and RGB2YUVFactors::y.
Referenced by SDL_ConvertPixels_Packed4_to_Packed4().
|
static |
Definition at line 1282 of file SDL_yuv.c.
References PACKED4_TO_PACKED4_ROW_SSE2, SDL_HasSSE2, V, and RGB2YUVFactors::y.
Referenced by SDL_ConvertPixels_Packed4_to_Packed4().
|
static |
Definition at line 1450 of file SDL_yuv.c.
References PACKED4_TO_PACKED4_ROW_SSE2, SDL_HasSSE2, V, and RGB2YUVFactors::y.
Referenced by SDL_ConvertPixels_Packed4_to_Packed4().
|
static |
Definition at line 1408 of file SDL_yuv.c.
References PACKED4_TO_PACKED4_ROW_SSE2, SDL_HasSSE2, V, and RGB2YUVFactors::y.
Referenced by SDL_ConvertPixels_Packed4_to_Packed4().
SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionMode | ( | void | ) |
Get the YUV conversion mode.
Definition at line 40 of file SDL_yuv.c.
References SDL_YUV_ConversionMode.
Referenced by SDL_GetYUVConversionModeForResolution().
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 conversion mode is SDL_YUV_CONVERSION_AUTOMATIC.
Definition at line 45 of file SDL_yuv.c.
References SDL_GetYUVConversionMode(), SDL_YUV_CONVERSION_AUTOMATIC, SDL_YUV_CONVERSION_BT601, SDL_YUV_CONVERSION_BT709, and SDL_YUV_SD_THRESHOLD.
Referenced by GetYUVConversionType(), and SDL_ConvertPixels_ARGB8888_to_YUV().
void SDL_SetYUVConversionMode | ( | SDL_YUV_CONVERSION_MODE | mode | ) |
Set the YUV conversion mode.
Definition at line 35 of file SDL_yuv.c.
References SDL_YUV_ConversionMode.
|
static |
Definition at line 181 of file SDL_yuv.c.
References SDL_FALSE, SDL_HasSSE2, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGRX8888, SDL_PIXELFORMAT_IYUV, SDL_PIXELFORMAT_NV12, SDL_PIXELFORMAT_NV21, SDL_PIXELFORMAT_RGB24, SDL_PIXELFORMAT_RGB565, SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGBX8888, SDL_PIXELFORMAT_UYVY, SDL_PIXELFORMAT_YUY2, SDL_PIXELFORMAT_YV12, SDL_PIXELFORMAT_YVYU, SDL_TRUE, yuv420_abgr_sseu(), yuv420_argb_sseu(), yuv420_bgra_sseu(), yuv420_rgb24_sseu(), yuv420_rgb565_sseu(), yuv420_rgba_sseu(), yuv422_abgr_sseu(), yuv422_argb_sseu(), yuv422_bgra_sseu(), yuv422_rgb24_sseu(), yuv422_rgb565_sseu(), yuv422_rgba_sseu(), yuvnv12_abgr_sseu(), yuvnv12_argb_sseu(), yuvnv12_bgra_sseu(), yuvnv12_rgb24_sseu(), yuvnv12_rgb565_sseu(), and yuvnv12_rgba_sseu().
Referenced by SDL_ConvertPixels_YUV_to_RGB().
|
static |
Definition at line 290 of file SDL_yuv.c.
References SDL_FALSE, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGRX8888, SDL_PIXELFORMAT_IYUV, SDL_PIXELFORMAT_NV12, SDL_PIXELFORMAT_NV21, SDL_PIXELFORMAT_RGB24, SDL_PIXELFORMAT_RGB565, SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGBX8888, SDL_PIXELFORMAT_UYVY, SDL_PIXELFORMAT_YUY2, SDL_PIXELFORMAT_YV12, SDL_PIXELFORMAT_YVYU, SDL_TRUE, yuv420_abgr_std(), yuv420_argb_std(), yuv420_bgra_std(), yuv420_rgb24_std(), yuv420_rgb565_std(), yuv420_rgba_std(), yuv422_abgr_std(), yuv422_argb_std(), yuv422_bgra_std(), yuv422_rgb24_std(), yuv422_rgb565_std(), yuv422_rgba_std(), yuvnv12_abgr_std(), yuvnv12_argb_std(), yuvnv12_bgra_std(), yuvnv12_rgb24_std(), yuvnv12_rgb565_std(), and yuvnv12_rgba_std().
Referenced by SDL_ConvertPixels_YUV_to_RGB().
|
static |
Definition at line 32 of file SDL_yuv.c.
Referenced by SDL_GetYUVConversionMode(), and SDL_SetYUVConversionMode().