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

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

Issue 1254953004: Hacking ffvp9 decoder support for profiling. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Supress windows warning Created 4 years, 8 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.h » ('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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 } 46 }
47 47
48 // Given a |yv12_frame| this method converts the YV12 frame to RGBA and 48 // Given a |yv12_frame| this method converts the YV12 frame to RGBA and
49 // makes sure that all the pixels of the RBG frame equal |expect_rgb_color|. 49 // makes sure that all the pixels of the RBG frame equal |expect_rgb_color|.
50 void ExpectFrameColor(media::VideoFrame* yv12_frame, 50 void ExpectFrameColor(media::VideoFrame* yv12_frame,
51 uint32_t expect_rgb_color) { 51 uint32_t expect_rgb_color) {
52 ASSERT_EQ(PIXEL_FORMAT_YV12, yv12_frame->format()); 52 ASSERT_EQ(PIXEL_FORMAT_YV12, yv12_frame->format());
53 ASSERT_EQ(yv12_frame->stride(VideoFrame::kUPlane), 53 ASSERT_EQ(yv12_frame->stride(VideoFrame::kUPlane),
54 yv12_frame->stride(VideoFrame::kVPlane)); 54 yv12_frame->stride(VideoFrame::kVPlane));
55 ASSERT_EQ( 55 for (size_t plane = 0; plane < 3; ++plane) {
56 yv12_frame->coded_size().width() & (VideoFrame::kFrameSizeAlignment - 1), 56 ASSERT_EQ(yv12_frame->stride(plane) & (VideoFrame::kFrameSizeAlignment - 1),
57 0); 57 0);
58 ASSERT_EQ( 58 }
59 yv12_frame->coded_size().height() & (VideoFrame::kFrameSizeAlignment - 1),
60 0);
61 59
62 size_t bytes_per_row = yv12_frame->coded_size().width() * 4u; 60 size_t bytes_per_row = yv12_frame->coded_size().width() * 4u;
63 uint8_t* rgb_data = reinterpret_cast<uint8_t*>( 61 uint8_t* rgb_data = reinterpret_cast<uint8_t*>(
64 base::AlignedAlloc(bytes_per_row * yv12_frame->coded_size().height() + 62 base::AlignedAlloc(bytes_per_row * yv12_frame->coded_size().height() +
65 VideoFrame::kFrameSizePadding, 63 VideoFrame::kFrameSizePadding,
66 VideoFrame::kFrameAddressAlignment)); 64 VideoFrame::kFrameAddressAlignment));
67 65
68 media::ConvertYUVToRGB32(yv12_frame->data(VideoFrame::kYPlane), 66 media::ConvertYUVToRGB32(yv12_frame->data(VideoFrame::kYPlane),
69 yv12_frame->data(VideoFrame::kUPlane), 67 yv12_frame->data(VideoFrame::kUPlane),
70 yv12_frame->data(VideoFrame::kVPlane), 68 yv12_frame->data(VideoFrame::kVPlane),
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 504
507 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { 505 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) {
508 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); 506 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i);
509 int value = -1; 507 int value = -1;
510 EXPECT_TRUE(result.GetInteger(key, &value)); 508 EXPECT_TRUE(result.GetInteger(key, &value));
511 EXPECT_EQ(i, value); 509 EXPECT_EQ(i, value);
512 } 510 }
513 } 511 }
514 512
515 } // namespace media 513 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame.h ('k') | media/ffmpeg/ffmpeg_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698