Commit b6b1c273 authored by Chong Zhang's avatar Chong Zhang Committed by Frank Barchard

libyuv: choose matrix for YUV to RGB565 conversion

bug: 109762970
Change-Id: Iccfdc5dded2dc7695f8a7795b2f32b6401efea0d
Reviewed-on: https://chromium-review.googlesource.com/1169687
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Reviewed-by: 's avatarFrank Barchard <fbarchard@chromium.org>
parent c417d577
...@@ -239,6 +239,30 @@ int I420ToRGB565(const uint8_t* src_y, ...@@ -239,6 +239,30 @@ int I420ToRGB565(const uint8_t* src_y,
int width, int width,
int height); int height);
LIBYUV_API
int J420ToRGB565(const uint8_t* src_y,
int src_stride_y,
const uint8_t* src_u,
int src_stride_u,
const uint8_t* src_v,
int src_stride_v,
uint8_t* dst_frame,
int dst_stride_frame,
int width,
int height);
LIBYUV_API
int H420ToRGB565(const uint8_t* src_y,
int src_stride_y,
const uint8_t* src_u,
int src_stride_u,
const uint8_t* src_v,
int src_stride_v,
uint8_t* dst_frame,
int dst_stride_frame,
int width,
int height);
LIBYUV_API LIBYUV_API
int I422ToRGB565(const uint8_t* src_y, int I422ToRGB565(const uint8_t* src_y,
int src_stride_y, int src_stride_y,
......
...@@ -930,9 +930,9 @@ int I420ToARGB4444(const uint8_t* src_y, ...@@ -930,9 +930,9 @@ int I420ToARGB4444(const uint8_t* src_y,
return 0; return 0;
} }
// Convert I420 to RGB565. // Convert I420 to RGB565 with specified color matrix.
LIBYUV_API LIBYUV_API
int I420ToRGB565(const uint8_t* src_y, int I420ToRGB565Matrix(const uint8_t* src_y,
int src_stride_y, int src_stride_y,
const uint8_t* src_u, const uint8_t* src_u,
int src_stride_u, int src_stride_u,
...@@ -940,6 +940,7 @@ int I420ToRGB565(const uint8_t* src_y, ...@@ -940,6 +940,7 @@ int I420ToRGB565(const uint8_t* src_y,
int src_stride_v, int src_stride_v,
uint8_t* dst_rgb565, uint8_t* dst_rgb565,
int dst_stride_rgb565, int dst_stride_rgb565,
const struct YuvConstants* yuvconstants,
int width, int width,
int height) { int height) {
int y; int y;
...@@ -990,7 +991,7 @@ int I420ToRGB565(const uint8_t* src_y, ...@@ -990,7 +991,7 @@ int I420ToRGB565(const uint8_t* src_y,
#endif #endif
for (y = 0; y < height; ++y) { 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; dst_rgb565 += dst_stride_rgb565;
src_y += src_stride_y; src_y += src_stride_y;
if (y & 1) { if (y & 1) {
...@@ -1001,6 +1002,81 @@ int I420ToRGB565(const uint8_t* src_y, ...@@ -1001,6 +1002,81 @@ int I420ToRGB565(const uint8_t* src_y,
return 0; return 0;
} }
// Convert I420 to RGB565.
LIBYUV_API
int I420ToRGB565(const uint8_t* src_y,
int src_stride_y,
const uint8_t* src_u,
int src_stride_u,
const uint8_t* src_v,
int src_stride_v,
uint8_t* 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_t* src_y,
int src_stride_y,
const uint8_t* src_u,
int src_stride_u,
const uint8_t* src_v,
int src_stride_v,
uint8_t* 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_t* src_y,
int src_stride_y,
const uint8_t* src_u,
int src_stride_u,
const uint8_t* src_v,
int src_stride_v,
uint8_t* 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. // Convert I422 to RGB565.
LIBYUV_API LIBYUV_API
int I422ToRGB565(const uint8_t* src_y, int I422ToRGB565(const uint8_t* src_y,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment