Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: media/base/video_frame.cc

Issue 9766007: Fix incorrect VideoFrame::row_bytes() for RGB. Add tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rework test. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/base/video_frame_unittest.cc » ('j') | media/base/video_frame_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/video_frame.h" 5 #include "media/base/video_frame.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/limits.h" 8 #include "media/base/limits.h"
9 #include "media/base/video_util.h" 9 #include "media/base/video_util.h"
10 10
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 199 }
200 200
201 int VideoFrame::stride(size_t plane) const { 201 int VideoFrame::stride(size_t plane) const {
202 DCHECK(IsValidPlane(plane)); 202 DCHECK(IsValidPlane(plane));
203 return strides_[plane]; 203 return strides_[plane];
204 } 204 }
205 205
206 int VideoFrame::row_bytes(size_t plane) const { 206 int VideoFrame::row_bytes(size_t plane) const {
207 DCHECK(IsValidPlane(plane)); 207 DCHECK(IsValidPlane(plane));
208 switch (format_) { 208 switch (format_) {
209 // 16bpp.
209 case RGB555: 210 case RGB555:
210 case RGB565: 211 case RGB565:
212 return width_ * 2;
213
214 // 24bpp.
211 case RGB24: 215 case RGB24:
216 return width_ * 3;
217
218 // 32bpp.
212 case RGB32: 219 case RGB32:
213 case RGBA: 220 case RGBA:
214 return width_; 221 return width_ * 4;
215 222
223 // Planar, 8bpp.
216 case YV12: 224 case YV12:
217 case YV16: 225 case YV16:
218 if (plane == kYPlane) 226 if (plane == kYPlane)
219 return width_; 227 return width_;
220 return RoundUp(width_, 2) / 2; 228 return RoundUp(width_, 2) / 2;
221 229
222 default: 230 default:
223 break; 231 break;
224 } 232 }
225 233
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 uint32 VideoFrame::texture_target() const { 274 uint32 VideoFrame::texture_target() const {
267 DCHECK_EQ(format_, NATIVE_TEXTURE); 275 DCHECK_EQ(format_, NATIVE_TEXTURE);
268 return texture_target_; 276 return texture_target_;
269 } 277 }
270 278
271 bool VideoFrame::IsEndOfStream() const { 279 bool VideoFrame::IsEndOfStream() const {
272 return format_ == VideoFrame::EMPTY; 280 return format_ == VideoFrame::EMPTY;
273 } 281 }
274 282
275 } // namespace media 283 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/base/video_frame_unittest.cc » ('j') | media/base/video_frame_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698