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

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

Issue 1286623002: Update padding/alignment constants to match ffmpeg. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
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/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/aligned_memory.h" 10 #include "base/memory/aligned_memory.h"
(...skipping 30 matching lines...) Expand all
41 v_plane += frame->stride(VideoFrame::kVPlane); 41 v_plane += frame->stride(VideoFrame::kVPlane);
42 } 42 }
43 } 43 }
44 44
45 // Given a |yv12_frame| this method converts the YV12 frame to RGBA and 45 // Given a |yv12_frame| this method converts the YV12 frame to RGBA and
46 // makes sure that all the pixels of the RBG frame equal |expect_rgb_color|. 46 // makes sure that all the pixels of the RBG frame equal |expect_rgb_color|.
47 void ExpectFrameColor(media::VideoFrame* yv12_frame, uint32 expect_rgb_color) { 47 void ExpectFrameColor(media::VideoFrame* yv12_frame, uint32 expect_rgb_color) {
48 ASSERT_EQ(PIXEL_FORMAT_YV12, yv12_frame->format()); 48 ASSERT_EQ(PIXEL_FORMAT_YV12, yv12_frame->format());
49 ASSERT_EQ(yv12_frame->stride(VideoFrame::kUPlane), 49 ASSERT_EQ(yv12_frame->stride(VideoFrame::kUPlane),
50 yv12_frame->stride(VideoFrame::kVPlane)); 50 yv12_frame->stride(VideoFrame::kVPlane));
51 ASSERT_EQ( 51 for (size_t plane = 0; plane < 3; ++plane) {
52 yv12_frame->coded_size().width() & (VideoFrame::kFrameSizeAlignment - 1), 52 ASSERT_EQ(yv12_frame->stride(plane) & (VideoFrame::kFrameSizeAlignment - 1),
chcunningham 2015/08/10 23:45:36 I don't think this was asserting the correct thing
53 0); 53 0);
54 ASSERT_EQ( 54 }
55 yv12_frame->coded_size().height() & (VideoFrame::kFrameSizeAlignment - 1),
56 0);
57 55
58 size_t bytes_per_row = yv12_frame->coded_size().width() * 4u; 56 size_t bytes_per_row = yv12_frame->coded_size().width() * 4u;
59 uint8* rgb_data = reinterpret_cast<uint8*>( 57 uint8* rgb_data = reinterpret_cast<uint8*>(
60 base::AlignedAlloc(bytes_per_row * yv12_frame->coded_size().height() + 58 base::AlignedAlloc(bytes_per_row * yv12_frame->coded_size().height() +
61 VideoFrame::kFrameSizePadding, 59 VideoFrame::kFrameSizePadding,
62 VideoFrame::kFrameAddressAlignment)); 60 VideoFrame::kFrameAddressAlignment));
63 61
64 media::ConvertYUVToRGB32(yv12_frame->data(VideoFrame::kYPlane), 62 media::ConvertYUVToRGB32(yv12_frame->data(VideoFrame::kYPlane),
65 yv12_frame->data(VideoFrame::kUPlane), 63 yv12_frame->data(VideoFrame::kUPlane),
66 yv12_frame->data(VideoFrame::kVPlane), 64 yv12_frame->data(VideoFrame::kVPlane),
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 452
455 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { 453 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) {
456 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); 454 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i);
457 int value = -1; 455 int value = -1;
458 EXPECT_TRUE(result.GetInteger(key, &value)); 456 EXPECT_TRUE(result.GetInteger(key, &value));
459 EXPECT_EQ(i, value); 457 EXPECT_EQ(i, value);
460 } 458 }
461 } 459 }
462 460
463 } // namespace media 461 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698