aboutsummaryrefslogtreecommitdiff
path: root/source/convert_from.cc
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@chromium.org>2018-10-03 12:10:41 -0700
committerFrank Barchard <fbarchard@chromium.org>2018-10-03 19:14:01 +0000
commit20bf569a049bc5f4a4954c401cc6fff11d453274 (patch)
treeaa0bab8e93be70010f58328d98362433be03cf95 /source/convert_from.cc
parent9a07219dc8fbf2b77e390d16bd24809444838a91 (diff)
downloadlibyuv-20bf569a049bc5f4a4954c401cc6fff11d453274.tar.gz
Fix ConvertToI420() for odd crop_y
The original src_u calculation of FOURCC_I420 shifted half width if crop_y is odd. This CL fixs the problem and also add a test case for it. Bug: b:115278653 Test: pass libyuv_unittest Change-Id: Ia9732d22e64e13de26df47726ba44ad1c5a06484 Reviewed-on: https://chromium-review.googlesource.com/c/1258743 Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/convert_from.cc')
-rw-r--r--source/convert_from.cc62
1 files changed, 19 insertions, 43 deletions
diff --git a/source/convert_from.cc b/source/convert_from.cc
index 0a7048c9..706067bb 100644
--- a/source/convert_from.cc
+++ b/source/convert_from.cc
@@ -933,16 +933,16 @@ int I420ToARGB4444(const uint8_t* src_y,
// Convert I420 to RGB565 with specified color matrix.
LIBYUV_API
int I420ToRGB565Matrix(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 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,
@@ -1014,17 +1014,9 @@ int I420ToRGB565(const uint8_t* src_y,
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);
+ 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.
@@ -1039,17 +1031,9 @@ int J420ToRGB565(const uint8_t* src_y,
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);
+ 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.
@@ -1064,17 +1048,9 @@ int H420ToRGB565(const uint8_t* src_y,
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);
+ 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.