OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |