diff options
author | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-07 07:47:22 +0000 |
---|---|---|
committer | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-07 07:47:22 +0000 |
commit | f9448203ebc9706c605e022fb2e931b28d3c0319 (patch) | |
tree | b3e33db5919803bf73622e85330bc1cb7c3f9f4d /media/base/yuv_convert.cc | |
parent | 3d29912aabadc1413d481e4d9b8b5f1d24516817 (diff) | |
download | chromium_src-f9448203ebc9706c605e022fb2e931b28d3c0319.zip chromium_src-f9448203ebc9706c605e022fb2e931b28d3c0319.tar.gz chromium_src-f9448203ebc9706c605e022fb2e931b28d3c0319.tar.bz2 |
Introducing helper wrappers for copying a rectangle from a one partial buffer to another. YUV to RGB and RGB to RGB operations are supported. YUV to RGB allows down-scaling of rectangles. The wrappers hide (to some degree) gory details of manipulations with buffer pointers and rectangles. Added unit tests (remoting_unittests.Yuv2Rgb) to verify functionality of the YUV to RGB wrapper.
BUG=109938
TEST=remoting_unittests.Yuv2Rgb
Review URL: http://codereview.chromium.org/9320025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/yuv_convert.cc')
-rw-r--r-- | media/base/yuv_convert.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/media/base/yuv_convert.cc b/media/base/yuv_convert.cc index 8d5073b..ed9bed4 100644 --- a/media/base/yuv_convert.cc +++ b/media/base/yuv_convert.cc @@ -335,8 +335,9 @@ void ScaleYUVToRGB32WithRect(const uint8* y_buf, // Determine the parts of the Y, U and V buffers to interpolate. int source_y_left = source_left >> kFractionBits; - int source_y_right = (source_right >> kFractionBits) + 2; - DCHECK(source_y_right <= source_width); + int source_y_right = std::min( + (source_right >> kFractionBits) + 2, + source_width + 1); int source_uv_left = source_y_left / 2; int source_uv_right = std::min( |