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

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

Issue 113407: ScaleYV12 optimization.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/media/video_renderer_impl.cc ('k') | media/base/yuv_convert.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/buffers.h" 5 #include "media/base/buffers.h"
6 #include "media/base/mock_media_filters.h" 6 #include "media/base/mock_media_filters.h"
7 #include "media/base/video_frame_impl.h" 7 #include "media/base/video_frame_impl.h"
8 #include "media/base/yuv_convert.h" 8 #include "media/base/yuv_convert.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 24 matching lines...) Expand all
35 yuv_surface.height, 35 yuv_surface.height,
36 yv12_frame->GetTimestamp(), 36 yv12_frame->GetTimestamp(),
37 yv12_frame->GetDuration(), 37 yv12_frame->GetDuration(),
38 &rgb_frame); 38 &rgb_frame);
39 media::VideoSurface rgb_surface; 39 media::VideoSurface rgb_surface;
40 EXPECT_TRUE(rgb_frame->Lock(&rgb_surface)); 40 EXPECT_TRUE(rgb_frame->Lock(&rgb_surface));
41 EXPECT_EQ(rgb_surface.width, yuv_surface.width); 41 EXPECT_EQ(rgb_surface.width, yuv_surface.width);
42 EXPECT_EQ(rgb_surface.height, yuv_surface.height); 42 EXPECT_EQ(rgb_surface.height, yuv_surface.height);
43 EXPECT_EQ(rgb_surface.planes, expect_rgb_planes); 43 EXPECT_EQ(rgb_surface.planes, expect_rgb_planes);
44 44
45 media::ConvertYV12ToRGB32(yuv_surface.data[VideoSurface::kYPlane], 45 media::ConvertYUVToRGB32(yuv_surface.data[VideoSurface::kYPlane],
46 yuv_surface.data[VideoSurface::kUPlane], 46 yuv_surface.data[VideoSurface::kUPlane],
47 yuv_surface.data[VideoSurface::kVPlane], 47 yuv_surface.data[VideoSurface::kVPlane],
48 rgb_surface.data[VideoSurface::kRGBPlane], 48 rgb_surface.data[VideoSurface::kRGBPlane],
49 rgb_surface.width, 49 rgb_surface.width,
50 rgb_surface.height, 50 rgb_surface.height,
51 yuv_surface.strides[VideoSurface::kYPlane], 51 yuv_surface.strides[VideoSurface::kYPlane],
52 yuv_surface.strides[VideoSurface::kUPlane], 52 yuv_surface.strides[VideoSurface::kUPlane],
53 rgb_surface.strides[VideoSurface::kRGBPlane]); 53 rgb_surface.strides[VideoSurface::kRGBPlane],
54 media::YV12);
54 55
55 for (size_t row = 0; row < rgb_surface.height; ++row) { 56 for (size_t row = 0; row < rgb_surface.height; ++row) {
56 uint32* rgb_row_data = reinterpret_cast<uint32*>( 57 uint32* rgb_row_data = reinterpret_cast<uint32*>(
57 rgb_surface.data[VideoSurface::kRGBPlane] + 58 rgb_surface.data[VideoSurface::kRGBPlane] +
58 (rgb_surface.strides[VideoSurface::kRGBPlane] * row)); 59 (rgb_surface.strides[VideoSurface::kRGBPlane] * row));
59 for (size_t col = 0; col < rgb_surface.width; ++col) { 60 for (size_t col = 0; col < rgb_surface.width; ++col) {
60 EXPECT_EQ(rgb_row_data[col], expect_rgb_color); 61 EXPECT_EQ(rgb_row_data[col], expect_rgb_color);
61 } 62 }
62 } 63 }
63 rgb_frame->Unlock(); 64 rgb_frame->Unlock();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 EXPECT_TRUE(frame->IsDiscontinuous()); 99 EXPECT_TRUE(frame->IsDiscontinuous());
99 frame->SetDiscontinuous(false); 100 frame->SetDiscontinuous(false);
100 EXPECT_FALSE(frame->IsDiscontinuous()); 101 EXPECT_FALSE(frame->IsDiscontinuous());
101 102
102 // Test VideoFrame implementation. 103 // Test VideoFrame implementation.
103 media::MockVideoDecoder::InitializeYV12Frame(frame, 0.0f); 104 media::MockVideoDecoder::InitializeYV12Frame(frame, 0.0f);
104 ExpectFrameColor(frame, 0xFF000000); 105 ExpectFrameColor(frame, 0xFF000000);
105 media::MockVideoDecoder::InitializeYV12Frame(frame, 1.0f); 106 media::MockVideoDecoder::InitializeYV12Frame(frame, 1.0f);
106 ExpectFrameColor(frame, 0xFFFFFFFF); 107 ExpectFrameColor(frame, 0xFFFFFFFF);
107 } 108 }
OLDNEW
« no previous file with comments | « chrome/renderer/media/video_renderer_impl.cc ('k') | media/base/yuv_convert.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698