aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-08-17 22:15:17 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-08-17 22:15:17 +0000
commit94a6f539e121313c3da9704e9ea5c02a65bda3f5 (patch)
tree3cdd4bfd13e050d66cbdf781c8ab56a56d1b5619
parent237d98acc923bd02ed6d04b359e43d9d5971cbf4 (diff)
parent58eae5dfed3d36aa439b08f0a2e536f0681a5e75 (diff)
downloadlibyuv-master-cuttlefish-testing-release.tar.gz
-rw-r--r--files/include/libyuv/convert_from.h24
-rw-r--r--files/source/convert_from.cc82
2 files changed, 103 insertions, 3 deletions
diff --git a/files/include/libyuv/convert_from.h b/files/include/libyuv/convert_from.h
index a050e445..528d8dda 100644
--- a/files/include/libyuv/convert_from.h
+++ b/files/include/libyuv/convert_from.h
@@ -201,6 +201,30 @@ int I420ToRGB565(const uint8* src_y,
int height);
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_frame,
+ int dst_stride_frame,
+ int width,
+ int height);
+
+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_frame,
+ int dst_stride_frame,
+ int width,
+ int height);
+
+LIBYUV_API
int I422ToRGB565(const uint8* src_y,
int src_stride_y,
const uint8* src_u,
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,