summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-28 07:07:34 +0000
committerfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-28 07:07:34 +0000
commitaab328bdd9921ac6fea59b299ed3c79e9e265a49 (patch)
tree30b4c48295452210b99d8edb2d4d9c3efbf7350a /media
parentb49eb8716bbae4181c840c4a010665e3cc5aea8f (diff)
downloadchromium_src-aab328bdd9921ac6fea59b299ed3c79e9e265a49.zip
chromium_src-aab328bdd9921ac6fea59b299ed3c79e9e265a49.tar.gz
chromium_src-aab328bdd9921ac6fea59b299ed3c79e9e265a49.tar.bz2
pad yuv additional 15 bytes to allow 16 pixels at a time to be processed without going off end of buffer.
BUG=43970 TEST=play http://fbarchard0-w.ad.corp.google.com/mediatests/Etherworks-WebMadeMovies3BuildingABetterInternet799.ogg with scaling down (CTRL -). Should not crash. Review URL: http://codereview.chromium.org/2337001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48471 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/base/video_frame.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 9d81804..3e2164e 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -130,6 +130,8 @@ bool VideoFrame::AllocateRGB(size_t bytes_per_pixel) {
return (NULL != data_[VideoFrame::kRGBPlane]);
}
+static const int kFramePadBytes = 15; // allows faster SIMD YUV convert
+
bool VideoFrame::AllocateYUV() {
DCHECK(format_ == VideoFrame::YV12 ||
format_ == VideoFrame::YV16);
@@ -150,7 +152,7 @@ bool VideoFrame::AllocateYUV() {
if (format_ == VideoFrame::YV12) {
uv_bytes /= 2;
}
- uint8* data = new uint8[y_bytes + (uv_bytes * 2)];
+ uint8* data = new uint8[y_bytes + (uv_bytes * 2) + kFramePadBytes];
if (data) {
planes_ = VideoFrame::kNumYUVPlanes;
COMPILE_ASSERT(0 == VideoFrame::kYPlane, y_plane_data_must_be_index_0);