diff options
Diffstat (limited to 'files/source/convert_from.cc')
-rw-r--r-- | files/source/convert_from.cc | 82 |
1 files changed, 79 insertions, 3 deletions
diff --git a/files/source/convert_from.cc b/files/source/convert_from.cc index d623731d..e0ebfb08 100644 --- a/files/source/convert_from.cc +++ b/files/source/convert_from.cc @@ -819,9 +819,9 @@ int I420ToARGB4444(const uint8* src_y, return 0; } -// Convert I420 to RGB565. +// Convert I420 to RGB565 with specified color matrix. LIBYUV_API -int I420ToRGB565(const uint8* src_y, +int I420ToRGB565Matrix(const uint8* src_y, int src_stride_y, const uint8* src_u, int src_stride_u, @@ -829,6 +829,7 @@ int I420ToRGB565(const uint8* src_y, int src_stride_v, uint8* dst_rgb565, int dst_stride_rgb565, + const struct YuvConstants* yuvconstants, int width, int height) { int y; @@ -879,7 +880,7 @@ int I420ToRGB565(const uint8* src_y, #endif for (y = 0; y < height; ++y) { - I422ToRGB565Row(src_y, src_u, src_v, dst_rgb565, &kYuvI601Constants, width); + I422ToRGB565Row(src_y, src_u, src_v, dst_rgb565, yuvconstants, width); dst_rgb565 += dst_stride_rgb565; src_y += src_stride_y; if (y & 1) { @@ -890,6 +891,81 @@ int I420ToRGB565(const uint8* src_y, return 0; } +// Convert I420 to RGB565. +LIBYUV_API +int I420ToRGB565(const uint8* src_y, + int src_stride_y, + const uint8* src_u, + int src_stride_u, + const uint8* src_v, + int src_stride_v, + uint8* dst_rgb565, + int dst_stride_rgb565, + int width, + int height) { + return I420ToRGB565Matrix(src_y, + src_stride_y, + src_u, + src_stride_u, + src_v, + src_stride_v, + dst_rgb565, + dst_stride_rgb565, + &kYuvI601Constants, + width, + height); +} + +// Convert J420 to RGB565. +LIBYUV_API +int J420ToRGB565(const uint8* src_y, + int src_stride_y, + const uint8* src_u, + int src_stride_u, + const uint8* src_v, + int src_stride_v, + uint8* dst_rgb565, + int dst_stride_rgb565, + int width, + int height) { + return I420ToRGB565Matrix(src_y, + src_stride_y, + src_u, + src_stride_u, + src_v, + src_stride_v, + dst_rgb565, + dst_stride_rgb565, + &kYuvJPEGConstants, + width, + height); +} + +// Convert H420 to RGB565. +LIBYUV_API +int H420ToRGB565(const uint8* src_y, + int src_stride_y, + const uint8* src_u, + int src_stride_u, + const uint8* src_v, + int src_stride_v, + uint8* dst_rgb565, + int dst_stride_rgb565, + int width, + int height) { + return I420ToRGB565Matrix(src_y, + src_stride_y, + src_u, + src_stride_u, + src_v, + src_stride_v, + dst_rgb565, + dst_stride_rgb565, + &kYuvH709Constants, + width, + height); +} + // Convert I422 to RGB565. LIBYUV_API int I422ToRGB565(const uint8* src_y, |