diff options
Diffstat (limited to 'contrib/SDL-3.2.8/src/video/yuv2rgb/yuv_rgb_std.h')
| -rw-r--r-- | contrib/SDL-3.2.8/src/video/yuv2rgb/yuv_rgb_std.h | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/video/yuv2rgb/yuv_rgb_std.h b/contrib/SDL-3.2.8/src/video/yuv2rgb/yuv_rgb_std.h new file mode 100644 index 0000000..c9f856b --- /dev/null +++ b/contrib/SDL-3.2.8/src/video/yuv2rgb/yuv_rgb_std.h | |||
| @@ -0,0 +1,143 @@ | |||
| 1 | // Copyright 2016 Adrien Descamps | ||
| 2 | // Distributed under BSD 3-Clause License | ||
| 3 | |||
| 4 | // Provide optimized functions to convert images from 8bits yuv420 to rgb24 format | ||
| 5 | |||
| 6 | // There are a few slightly different variations of the YCbCr color space with different parameters that | ||
| 7 | // change the conversion matrix. | ||
| 8 | // The three most common YCbCr color space, defined by BT.601, BT.709 and JPEG standard are implemented here. | ||
| 9 | // See the respective standards for details | ||
| 10 | // The matrix values used are derived from http://www.equasys.de/colorconversion.html | ||
| 11 | |||
| 12 | // YUV420 is stored as three separate channels, with U and V (Cb and Cr) subsampled by a 2 factor | ||
| 13 | // For conversion from yuv to rgb, no interpolation is done, and the same UV value are used for 4 rgb pixels. This | ||
| 14 | // is suboptimal for image quality, but by far the fastest method. | ||
| 15 | |||
| 16 | // For all methods, width and height should be even, if not, the last row/column of the result image won't be affected. | ||
| 17 | // For sse methods, if the width if not divisable by 32, the last (width%32) pixels of each line won't be affected. | ||
| 18 | |||
| 19 | /*#include <stdint.h>*/ | ||
| 20 | |||
| 21 | #include "yuv_rgb_common.h" | ||
| 22 | |||
| 23 | // yuv to rgb, standard c implementation | ||
| 24 | void yuv420_rgb565_std( | ||
| 25 | uint32_t width, uint32_t height, | ||
| 26 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 27 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 28 | YCbCrType yuv_type); | ||
| 29 | |||
| 30 | void yuv420_rgb24_std( | ||
| 31 | uint32_t width, uint32_t height, | ||
| 32 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 33 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 34 | YCbCrType yuv_type); | ||
| 35 | |||
| 36 | void yuv420_rgba_std( | ||
| 37 | uint32_t width, uint32_t height, | ||
| 38 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 39 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 40 | YCbCrType yuv_type); | ||
| 41 | |||
| 42 | void yuv420_bgra_std( | ||
| 43 | uint32_t width, uint32_t height, | ||
| 44 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 45 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 46 | YCbCrType yuv_type); | ||
| 47 | |||
| 48 | void yuv420_argb_std( | ||
| 49 | uint32_t width, uint32_t height, | ||
| 50 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 51 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 52 | YCbCrType yuv_type); | ||
| 53 | |||
| 54 | void yuv420_abgr_std( | ||
| 55 | uint32_t width, uint32_t height, | ||
| 56 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 57 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 58 | YCbCrType yuv_type); | ||
| 59 | |||
| 60 | void yuv422_rgb565_std( | ||
| 61 | uint32_t width, uint32_t height, | ||
| 62 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 63 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 64 | YCbCrType yuv_type); | ||
| 65 | |||
| 66 | void yuv422_rgb24_std( | ||
| 67 | uint32_t width, uint32_t height, | ||
| 68 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 69 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 70 | YCbCrType yuv_type); | ||
| 71 | |||
| 72 | void yuv422_rgba_std( | ||
| 73 | uint32_t width, uint32_t height, | ||
| 74 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 75 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 76 | YCbCrType yuv_type); | ||
| 77 | |||
| 78 | void yuv422_bgra_std( | ||
| 79 | uint32_t width, uint32_t height, | ||
| 80 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 81 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 82 | YCbCrType yuv_type); | ||
| 83 | |||
| 84 | void yuv422_argb_std( | ||
| 85 | uint32_t width, uint32_t height, | ||
| 86 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 87 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 88 | YCbCrType yuv_type); | ||
| 89 | |||
| 90 | void yuv422_abgr_std( | ||
| 91 | uint32_t width, uint32_t height, | ||
| 92 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 93 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 94 | YCbCrType yuv_type); | ||
| 95 | |||
| 96 | void yuvnv12_rgb565_std( | ||
| 97 | uint32_t width, uint32_t height, | ||
| 98 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 99 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 100 | YCbCrType yuv_type); | ||
| 101 | |||
| 102 | void yuvnv12_rgb24_std( | ||
| 103 | uint32_t width, uint32_t height, | ||
| 104 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 105 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 106 | YCbCrType yuv_type); | ||
| 107 | |||
| 108 | void yuvnv12_rgba_std( | ||
| 109 | uint32_t width, uint32_t height, | ||
| 110 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 111 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 112 | YCbCrType yuv_type); | ||
| 113 | |||
| 114 | void yuvnv12_bgra_std( | ||
| 115 | uint32_t width, uint32_t height, | ||
| 116 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 117 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 118 | YCbCrType yuv_type); | ||
| 119 | |||
| 120 | void yuvnv12_argb_std( | ||
| 121 | uint32_t width, uint32_t height, | ||
| 122 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 123 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 124 | YCbCrType yuv_type); | ||
| 125 | |||
| 126 | void yuvnv12_abgr_std( | ||
| 127 | uint32_t width, uint32_t height, | ||
| 128 | const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 129 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 130 | YCbCrType yuv_type); | ||
| 131 | |||
| 132 | void yuvp010_xbgr2101010_std( | ||
| 133 | uint32_t width, uint32_t height, | ||
| 134 | const uint16_t *y, const uint16_t *u, const uint16_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 135 | uint8_t *rgb, uint32_t rgb_stride, | ||
| 136 | YCbCrType yuv_type); | ||
| 137 | |||
| 138 | // rgb to yuv, standard c implementation | ||
| 139 | void rgb24_yuv420_std( | ||
| 140 | uint32_t width, uint32_t height, | ||
| 141 | const uint8_t *rgb, uint32_t rgb_stride, | ||
| 142 | uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, | ||
| 143 | YCbCrType yuv_type); | ||
