| OLD | NEW |
| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "media/base/video_frame.h" | 6 #include "media/base/video_frame.h" |
| 7 #include "media/base/video_util.h" | 7 #include "media/base/video_util.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace media { | 10 namespace media { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 v_stride_ = v_stride; | 32 v_stride_ = v_stride; |
| 33 | 33 |
| 34 y_plane_.reset(new uint8[y_stride * height]); | 34 y_plane_.reset(new uint8[y_stride * height]); |
| 35 u_plane_.reset(new uint8[u_stride * height / 2]); | 35 u_plane_.reset(new uint8[u_stride * height / 2]); |
| 36 v_plane_.reset(new uint8[v_stride * height / 2]); | 36 v_plane_.reset(new uint8[v_stride * height / 2]); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void CreateDestinationFrame(int width, int height) { | 39 void CreateDestinationFrame(int width, int height) { |
| 40 gfx::Size size(width, height); | 40 gfx::Size size(width, height); |
| 41 destination_frame_ = | 41 destination_frame_ = |
| 42 VideoFrame::CreateFrame(VideoFrame::YV12, size, size, | 42 VideoFrame::CreateFrame(VideoFrame::YV12, size, gfx::Rect(size), size, |
| 43 base::TimeDelta()); | 43 base::TimeDelta()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void CopyPlanes() { | 46 void CopyPlanes() { |
| 47 CopyYPlane(y_plane_.get(), y_stride_, height_, destination_frame_); | 47 CopyYPlane(y_plane_.get(), y_stride_, height_, destination_frame_); |
| 48 CopyUPlane(u_plane_.get(), u_stride_, height_ / 2, destination_frame_); | 48 CopyUPlane(u_plane_.get(), u_stride_, height_ / 2, destination_frame_); |
| 49 CopyVPlane(v_plane_.get(), v_stride_, height_ / 2, destination_frame_); | 49 CopyVPlane(v_plane_.get(), v_stride_, height_ / 2, destination_frame_); |
| 50 } | 50 } |
| 51 | 51 |
| 52 private: | 52 private: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 76 CopyPlanes(); | 76 CopyPlanes(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 TEST_F(VideoUtilTest, CopyPlane_SmallerDestination) { | 79 TEST_F(VideoUtilTest, CopyPlane_SmallerDestination) { |
| 80 CreateSourceFrame(16, 16, 16, 8, 8); | 80 CreateSourceFrame(16, 16, 16, 8, 8); |
| 81 CreateDestinationFrame(8, 8); | 81 CreateDestinationFrame(8, 8); |
| 82 CopyPlanes(); | 82 CopyPlanes(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace media | 85 } // namespace media |
| OLD | NEW |