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

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

Issue 148553003: Clean up histogram'd media enum max values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix naming collision Created 6 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
« no previous file with comments | « media/base/video_frame.h ('k') | media/ffmpeg/ffmpeg_common.cc » ('j') | no next file with comments »
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 case VideoFrame::NATIVE_TEXTURE: 56 case VideoFrame::NATIVE_TEXTURE:
57 return "NATIVE_TEXTURE"; 57 return "NATIVE_TEXTURE";
58 #if defined(VIDEO_HOLE) 58 #if defined(VIDEO_HOLE)
59 case VideoFrame::HOLE: 59 case VideoFrame::HOLE:
60 return "HOLE"; 60 return "HOLE";
61 #endif // defined(VIDEO_HOLE) 61 #endif // defined(VIDEO_HOLE)
62 case VideoFrame::YV12A: 62 case VideoFrame::YV12A:
63 return "YV12A"; 63 return "YV12A";
64 case VideoFrame::YV12J: 64 case VideoFrame::YV12J:
65 return "YV12J"; 65 return "YV12J";
66 case VideoFrame::HISTOGRAM_MAX:
67 return "HISTOGRAM_MAX";
68 } 66 }
69 NOTREACHED() << "Invalid videoframe format provided: " << format; 67 NOTREACHED() << "Invalid videoframe format provided: " << format;
70 return ""; 68 return "";
71 } 69 }
72 70
73 // static 71 // static
74 bool VideoFrame::IsValidConfig(VideoFrame::Format format, 72 bool VideoFrame::IsValidConfig(VideoFrame::Format format,
75 const gfx::Size& coded_size, 73 const gfx::Size& coded_size,
76 const gfx::Rect& visible_rect, 74 const gfx::Rect& visible_rect,
77 const gfx::Size& natural_size) { 75 const gfx::Size& natural_size) {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 #endif // defined(VIDEO_HOLE) 251 #endif // defined(VIDEO_HOLE)
254 return 0; 252 return 0;
255 case VideoFrame::YV12: 253 case VideoFrame::YV12:
256 case VideoFrame::YV16: 254 case VideoFrame::YV16:
257 case VideoFrame::I420: 255 case VideoFrame::I420:
258 case VideoFrame::YV12J: 256 case VideoFrame::YV12J:
259 return 3; 257 return 3;
260 case VideoFrame::YV12A: 258 case VideoFrame::YV12A:
261 return 4; 259 return 4;
262 case VideoFrame::UNKNOWN: 260 case VideoFrame::UNKNOWN:
263 case VideoFrame::HISTOGRAM_MAX:
264 break; 261 break;
265 } 262 }
266 NOTREACHED() << "Unsupported video frame format: " << format; 263 NOTREACHED() << "Unsupported video frame format: " << format;
267 return 0; 264 return 0;
268 } 265 }
269 266
270 static inline size_t RoundUp(size_t value, size_t alignment) { 267 static inline size_t RoundUp(size_t value, size_t alignment) {
271 // Check that |alignment| is a power of 2. 268 // Check that |alignment| is a power of 2.
272 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1))); 269 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1)));
273 return ((value + (alignment - 1)) & ~(alignment-1)); 270 return ((value + (alignment - 1)) & ~(alignment-1));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 return area; 316 return area;
320 case VideoFrame::kUPlane: 317 case VideoFrame::kUPlane:
321 case VideoFrame::kVPlane: 318 case VideoFrame::kVPlane:
322 return area / 2; 319 return area / 2;
323 default: 320 default:
324 break; 321 break;
325 } 322 }
326 } 323 }
327 case VideoFrame::UNKNOWN: 324 case VideoFrame::UNKNOWN:
328 case VideoFrame::NATIVE_TEXTURE: 325 case VideoFrame::NATIVE_TEXTURE:
329 case VideoFrame::HISTOGRAM_MAX:
330 #if defined(VIDEO_HOLE) 326 #if defined(VIDEO_HOLE)
331 case VideoFrame::HOLE: 327 case VideoFrame::HOLE:
332 #endif // defined(VIDEO_HOLE) 328 #endif // defined(VIDEO_HOLE)
333 break; 329 break;
334 } 330 }
335 NOTREACHED() << "Unsupported video frame format/plane: " 331 NOTREACHED() << "Unsupported video frame format/plane: "
336 << format << "/" << plane; 332 << format << "/" << plane;
337 return 0; 333 return 0;
338 } 334 }
339 335
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 break; 500 break;
505 for (int row = 0; row < rows(plane); ++row) { 501 for (int row = 0; row < rows(plane); ++row) {
506 base::MD5Update(context, base::StringPiece( 502 base::MD5Update(context, base::StringPiece(
507 reinterpret_cast<char*>(data(plane) + stride(plane) * row), 503 reinterpret_cast<char*>(data(plane) + stride(plane) * row),
508 row_bytes(plane))); 504 row_bytes(plane)));
509 } 505 }
510 } 506 }
511 } 507 }
512 508
513 } // namespace media 509 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame.h ('k') | media/ffmpeg/ffmpeg_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698