From 85b089a0ca08738812ec776a4c9c0ae472335948 Mon Sep 17 00:00:00 2001 From: "leozwang@webrtc.org" Date: Mon, 30 Apr 2012 17:59:08 +0000 Subject: [PATCH] Fix ConvertI420ToRGB565 bug BUG= TEST=test on android Review URL: https://webrtc-codereview.appspot.com/541005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2150 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/common_video/libyuv/libyuv.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common_video/libyuv/libyuv.cc b/src/common_video/libyuv/libyuv.cc index 1cb9f0b1b..88afa9322 100644 --- a/src/common_video/libyuv/libyuv.cc +++ b/src/common_video/libyuv/libyuv.cc @@ -165,13 +165,13 @@ int ConvertI420ToRGB565(const uint8_t* src_frame, int width, int height) { int abs_height = (height < 0) ? -height : height; const uint8_t* yplane = src_frame; - const uint8_t* uplane = src_frame + width * abs_height; - const uint8_t* vplane = uplane + (width * abs_height / 4); + const uint8_t* uplane = yplane + width * abs_height; + const uint8_t* vplane = uplane + (width + 1) / 2 * (abs_height + 1) / 2; return libyuv::I420ToRGB565(yplane, width, - uplane, width / 2, - vplane, width / 2, - dst_frame, width, + uplane, (width + 1) / 2, + vplane, (width + 1) / 2, + dst_frame, width * 2, width, height); }