diff options
author | Vignesh Venkatasubramanian <vigneshv@google.com> | 2022-08-09 11:50:03 -0700 |
---|---|---|
committer | Frank Barchard <fbarchard@chromium.org> | 2022-08-09 20:15:44 +0000 |
commit | a5a1102a60fee22358607d08bf3ad7f2fcee4f53 (patch) | |
tree | bb5b0e43536e6cc3d71a2063e92ba270f3424b3d /source/convert_argb.cc | |
parent | d53f1beecdd8d959f7a3f2e19bd0bd7e7227a233 (diff) | |
download | libyuv-a5a1102a60fee22358607d08bf3ad7f2fcee4f53.tar.gz |
Add I422ToRGB565Matrix
The code already exists to use a specific matrix. This CL simply
adds a function to use a generic YUV matrix for the conversion.
Bug: b/241451603
Change-Id: I0eea7e96a891d045905a9c963b56c053097029ec
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3820903
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/convert_argb.cc')
-rw-r--r-- | source/convert_argb.cc | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/source/convert_argb.cc b/source/convert_argb.cc index 71ef8c10..1ebb107a 100644 --- a/source/convert_argb.cc +++ b/source/convert_argb.cc @@ -5035,18 +5035,19 @@ int H420ToRGB565(const uint8_t* src_y, &kYuvH709Constants, width, height); } -// Convert I422 to RGB565. +// Convert I422 to RGB565 with specified color matrix. LIBYUV_API -int I422ToRGB565(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) { +int I422ToRGB565Matrix(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, + const struct YuvConstants* yuvconstants, + int width, + int height) { int y; void (*I422ToRGB565Row)(const uint8_t* y_buf, const uint8_t* u_buf, const uint8_t* v_buf, uint8_t* rgb_buf, @@ -5103,7 +5104,7 @@ int I422ToRGB565(const uint8_t* 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; src_u += src_stride_u; @@ -5112,6 +5113,23 @@ int I422ToRGB565(const uint8_t* src_y, return 0; } +// Convert I422 to RGB565. +LIBYUV_API +int I422ToRGB565(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 I422ToRGB565Matrix(src_y, src_stride_y, src_u, src_stride_u, src_v, + src_stride_v, dst_rgb565, dst_stride_rgb565, + &kYuvI601Constants, width, height); +} + // Ordered 8x8 dither for 888 to 565. Values from 0 to 7. static const uint8_t kDither565_4x4[16] = { 0, 4, 1, 5, 6, 2, 7, 3, 1, 5, 0, 4, 7, 3, 6, 2, |