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 "media/base/video_util.h" | 5 #include "media/base/video_util.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 void CopyUPlane(const uint8* source, int stride, int rows, VideoFrame* frame) { | 57 void CopyUPlane(const uint8* source, int stride, int rows, VideoFrame* frame) { |
58 CopyPlane(VideoFrame::kUPlane, source, stride, rows, frame); | 58 CopyPlane(VideoFrame::kUPlane, source, stride, rows, frame); |
59 } | 59 } |
60 | 60 |
61 void CopyVPlane(const uint8* source, int stride, int rows, VideoFrame* frame) { | 61 void CopyVPlane(const uint8* source, int stride, int rows, VideoFrame* frame) { |
62 CopyPlane(VideoFrame::kVPlane, source, stride, rows, frame); | 62 CopyPlane(VideoFrame::kVPlane, source, stride, rows, frame); |
63 } | 63 } |
64 | 64 |
| 65 void CopyAPlane(const uint8* source, int stride, int rows, VideoFrame* frame) { |
| 66 CopyPlane(VideoFrame::kAPlane, source, stride, rows, frame); |
| 67 } |
| 68 |
| 69 void MakeOpaqueAPlane(int stride, int rows, VideoFrame* frame) { |
| 70 int rows_to_clear = std::min(frame->rows(VideoFrame::kAPlane), rows); |
| 71 memset(frame->data(VideoFrame::kAPlane), 255, |
| 72 frame->stride(VideoFrame::kAPlane) * rows_to_clear); |
| 73 } |
| 74 |
65 void FillYUV(VideoFrame* frame, uint8 y, uint8 u, uint8 v) { | 75 void FillYUV(VideoFrame* frame, uint8 y, uint8 u, uint8 v) { |
66 // Fill the Y plane. | 76 // Fill the Y plane. |
67 uint8* y_plane = frame->data(VideoFrame::kYPlane); | 77 uint8* y_plane = frame->data(VideoFrame::kYPlane); |
68 int y_rows = frame->rows(VideoFrame::kYPlane); | 78 int y_rows = frame->rows(VideoFrame::kYPlane); |
69 int y_row_bytes = frame->row_bytes(VideoFrame::kYPlane); | 79 int y_row_bytes = frame->row_bytes(VideoFrame::kYPlane); |
70 for (int i = 0; i < y_rows; ++i) { | 80 for (int i = 0; i < y_rows; ++i) { |
71 memset(y_plane, y, y_row_bytes); | 81 memset(y_plane, y, y_row_bytes); |
72 y_plane += frame->stride(VideoFrame::kYPlane); | 82 y_plane += frame->stride(VideoFrame::kYPlane); |
73 } | 83 } |
74 | 84 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 frame->data(kU) + uv_offset, | 293 frame->data(kU) + uv_offset, |
284 frame->data(kV) + uv_offset, | 294 frame->data(kV) + uv_offset, |
285 region_in_frame.width(), | 295 region_in_frame.width(), |
286 region_in_frame.height(), | 296 region_in_frame.height(), |
287 stride, | 297 stride, |
288 frame->stride(kY), | 298 frame->stride(kY), |
289 uv_stride); | 299 uv_stride); |
290 } | 300 } |
291 | 301 |
292 } // namespace media | 302 } // namespace media |
OLD | NEW |