mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 01:06:46 +08:00
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>
This commit is contained in:
parent
d53f1beecd
commit
a5a1102a60
@ -1907,6 +1907,20 @@ int I420ToRGB565Matrix(const uint8_t* src_y,
|
|||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
|
// Convert I422 to RGB565 with specified color matrix.
|
||||||
|
LIBYUV_API
|
||||||
|
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);
|
||||||
|
|
||||||
// Convert I420 to AR30 with matrix.
|
// Convert I420 to AR30 with matrix.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int I420ToAR30Matrix(const uint8_t* src_y,
|
int I420ToAR30Matrix(const uint8_t* src_y,
|
||||||
|
|||||||
@ -5035,9 +5035,9 @@ int H420ToRGB565(const uint8_t* src_y,
|
|||||||
&kYuvH709Constants, width, height);
|
&kYuvH709Constants, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert I422 to RGB565.
|
// Convert I422 to RGB565 with specified color matrix.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int I422ToRGB565(const uint8_t* src_y,
|
int I422ToRGB565Matrix(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,
|
||||||
@ -5045,6 +5045,7 @@ int I422ToRGB565(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;
|
||||||
@ -5103,7 +5104,7 @@ int I422ToRGB565(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;
|
||||||
src_u += src_stride_u;
|
src_u += src_stride_u;
|
||||||
@ -5112,6 +5113,23 @@ int I422ToRGB565(const uint8_t* src_y,
|
|||||||
return 0;
|
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.
|
// Ordered 8x8 dither for 888 to 565. Values from 0 to 7.
|
||||||
static const uint8_t kDither565_4x4[16] = {
|
static const uint8_t kDither565_4x4[16] = {
|
||||||
0, 4, 1, 5, 6, 2, 7, 3, 1, 5, 0, 4, 7, 3, 6, 2,
|
0, 4, 1, 5, 6, 2, 7, 3, 1, 5, 0, 4, 7, 3, 6, 2,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user