OLD | NEW |
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 "base/string_piece.h" | 8 #include "base/string_piece.h" |
9 #include "media/base/limits.h" | 9 #include "media/base/limits.h" |
10 #include "media/base/video_util.h" | 10 #include "media/base/video_util.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 200 } |
201 | 201 |
202 int VideoFrame::stride(size_t plane) const { | 202 int VideoFrame::stride(size_t plane) const { |
203 DCHECK(IsValidPlane(plane)); | 203 DCHECK(IsValidPlane(plane)); |
204 return strides_[plane]; | 204 return strides_[plane]; |
205 } | 205 } |
206 | 206 |
207 int VideoFrame::row_bytes(size_t plane) const { | 207 int VideoFrame::row_bytes(size_t plane) const { |
208 DCHECK(IsValidPlane(plane)); | 208 DCHECK(IsValidPlane(plane)); |
209 switch (format_) { | 209 switch (format_) { |
| 210 // 16bpp. |
210 case RGB555: | 211 case RGB555: |
211 case RGB565: | 212 case RGB565: |
| 213 return width_ * 2; |
| 214 |
| 215 // 24bpp. |
212 case RGB24: | 216 case RGB24: |
| 217 return width_ * 3; |
| 218 |
| 219 // 32bpp. |
213 case RGB32: | 220 case RGB32: |
214 case RGBA: | 221 case RGBA: |
215 return width_; | 222 return width_ * 4; |
216 | 223 |
| 224 // Planar, 8bpp. |
217 case YV12: | 225 case YV12: |
218 case YV16: | 226 case YV16: |
219 if (plane == kYPlane) | 227 if (plane == kYPlane) |
220 return width_; | 228 return width_; |
221 return RoundUp(width_, 2) / 2; | 229 return RoundUp(width_, 2) / 2; |
222 | 230 |
223 default: | 231 default: |
224 break; | 232 break; |
225 } | 233 } |
226 | 234 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 break; | 287 break; |
280 for(int row = 0; row < rows(plane); row++) { | 288 for(int row = 0; row < rows(plane); row++) { |
281 base::MD5Update(context, base::StringPiece( | 289 base::MD5Update(context, base::StringPiece( |
282 reinterpret_cast<char*>(data(plane) + stride(plane) * row), | 290 reinterpret_cast<char*>(data(plane) + stride(plane) * row), |
283 row_bytes(plane))); | 291 row_bytes(plane))); |
284 } | 292 } |
285 } | 293 } |
286 } | 294 } |
287 | 295 |
288 } // namespace media | 296 } // namespace media |
OLD | NEW |