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

Unified Diff: media/base/video_frame_unittest.cc

Issue 56713002: Remove RGB32 from VideoFrame::Format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@vframe_invalid
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/video_frame.cc ('k') | media/filters/video_renderer_base_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame_unittest.cc
diff --git a/media/base/video_frame_unittest.cc b/media/base/video_frame_unittest.cc
index b88d20c363973e9a1937a640829a5edca79d561b..710c69f4c52a6a07dc816807f9dc1af0dce047bd 100644
--- a/media/base/video_frame_unittest.cc
+++ b/media/base/video_frame_unittest.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/format_macros.h"
+#include "base/memory/aligned_memory.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/stringprintf.h"
#include "media/base/buffers.h"
@@ -46,40 +47,41 @@ void ExpectFrameColor(media::VideoFrame* yv12_frame, uint32 expect_rgb_color) {
ASSERT_EQ(VideoFrame::YV12, yv12_frame->format());
ASSERT_EQ(yv12_frame->stride(VideoFrame::kUPlane),
yv12_frame->stride(VideoFrame::kVPlane));
-
- scoped_refptr<media::VideoFrame> rgb_frame;
- rgb_frame = media::VideoFrame::CreateFrame(VideoFrame::RGB32,
- yv12_frame->coded_size(),
- yv12_frame->visible_rect(),
- yv12_frame->natural_size(),
- yv12_frame->GetTimestamp());
-
- ASSERT_EQ(yv12_frame->coded_size().width(),
- rgb_frame->coded_size().width());
- ASSERT_EQ(yv12_frame->coded_size().height(),
- rgb_frame->coded_size().height());
+ ASSERT_EQ(
+ yv12_frame->coded_size().width() & (VideoFrame::kFrameSizeAlignment - 1),
+ 0);
+ ASSERT_EQ(
+ yv12_frame->coded_size().height() & (VideoFrame::kFrameSizeAlignment - 1),
+ 0);
+
+ size_t bytes_per_row = yv12_frame->coded_size().width() * 4u;
+ uint8* rgb_data = reinterpret_cast<uint8*>(
+ base::AlignedAlloc(bytes_per_row * yv12_frame->coded_size().height() +
+ VideoFrame::kFrameSizePadding,
+ VideoFrame::kFrameAddressAlignment));
media::ConvertYUVToRGB32(yv12_frame->data(VideoFrame::kYPlane),
yv12_frame->data(VideoFrame::kUPlane),
yv12_frame->data(VideoFrame::kVPlane),
- rgb_frame->data(VideoFrame::kRGBPlane),
- rgb_frame->coded_size().width(),
- rgb_frame->coded_size().height(),
+ rgb_data,
+ yv12_frame->coded_size().width(),
+ yv12_frame->coded_size().height(),
yv12_frame->stride(VideoFrame::kYPlane),
yv12_frame->stride(VideoFrame::kUPlane),
- rgb_frame->stride(VideoFrame::kRGBPlane),
+ bytes_per_row,
media::YV12);
- for (int row = 0; row < rgb_frame->coded_size().height(); ++row) {
+ for (int row = 0; row < yv12_frame->coded_size().height(); ++row) {
uint32* rgb_row_data = reinterpret_cast<uint32*>(
- rgb_frame->data(VideoFrame::kRGBPlane) +
- (rgb_frame->stride(VideoFrame::kRGBPlane) * row));
- for (int col = 0; col < rgb_frame->coded_size().width(); ++col) {
+ rgb_data + (bytes_per_row * row));
+ for (int col = 0; col < yv12_frame->coded_size().width(); ++col) {
SCOPED_TRACE(
base::StringPrintf("Checking (%d, %d)", row, col));
EXPECT_EQ(expect_rgb_color, rgb_row_data[col]);
}
}
+
+ base::AlignedFree(rgb_data);
}
// Fill each plane to its reported extents and verify accessors report non
@@ -204,8 +206,6 @@ TEST(VideoFrame, CheckFrameExtents) {
// and the expected hash of all planes if filled with kFillByte (defined in
// ExpectFrameExtents).
ExpectFrameExtents(
- VideoFrame::RGB32, 1, 4, "de6d3d567e282f6a38d478f04fc81fb0");
- ExpectFrameExtents(
VideoFrame::YV12, 3, 1, "71113bdfd4c0de6cf62f48fb74f7a0b1");
ExpectFrameExtents(
VideoFrame::YV16, 3, 1, "9bb99ac3ff350644ebff4d28dc01b461");
« no previous file with comments | « media/base/video_frame.cc ('k') | media/filters/video_renderer_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698