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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 } | 54 } |
55 | 55 |
56 void CopyUPlane(const uint8* source, int stride, int rows, VideoFrame* frame) { | 56 void CopyUPlane(const uint8* source, int stride, int rows, VideoFrame* frame) { |
57 CopyPlane(VideoFrame::kUPlane, source, stride, rows, frame); | 57 CopyPlane(VideoFrame::kUPlane, source, stride, rows, frame); |
58 } | 58 } |
59 | 59 |
60 void CopyVPlane(const uint8* source, int stride, int rows, VideoFrame* frame) { | 60 void CopyVPlane(const uint8* source, int stride, int rows, VideoFrame* frame) { |
61 CopyPlane(VideoFrame::kVPlane, source, stride, rows, frame); | 61 CopyPlane(VideoFrame::kVPlane, source, stride, rows, frame); |
62 } | 62 } |
63 | 63 |
64 void CopyAPlane(const uint8* source, int stride, int rows, VideoFrame* frame) { | |
65 CopyPlane(VideoFrame::kAPlane, source, stride, rows, frame); | |
66 } | |
67 | |
68 void MakeOpaqueAPlane(int stride, int rows, VideoFrame *frame) { | |
scherkus (not reviewing)
2013/02/27 07:28:26
pointers go with types
VideoFrame* frame
vignesh
2013/03/28 21:45:12
Done.
| |
69 int rows_to_clear = std::min(frame->rows(VideoFrame::kAPlane), rows); | |
70 memset(frame->data(VideoFrame::kAPlane), 255, | |
71 frame->stride(VideoFrame::kAPlane) * rows_to_clear); | |
72 } | |
73 | |
64 void FillYUV(VideoFrame* frame, uint8 y, uint8 u, uint8 v) { | 74 void FillYUV(VideoFrame* frame, uint8 y, uint8 u, uint8 v) { |
65 // Fill the Y plane. | 75 // Fill the Y plane. |
66 uint8* y_plane = frame->data(VideoFrame::kYPlane); | 76 uint8* y_plane = frame->data(VideoFrame::kYPlane); |
67 int y_rows = frame->rows(VideoFrame::kYPlane); | 77 int y_rows = frame->rows(VideoFrame::kYPlane); |
68 int y_row_bytes = frame->row_bytes(VideoFrame::kYPlane); | 78 int y_row_bytes = frame->row_bytes(VideoFrame::kYPlane); |
69 for (int i = 0; i < y_rows; ++i) { | 79 for (int i = 0; i < y_rows; ++i) { |
70 memset(y_plane, y, y_row_bytes); | 80 memset(y_plane, y, y_row_bytes); |
71 y_plane += frame->stride(VideoFrame::kYPlane); | 81 y_plane += frame->stride(VideoFrame::kYPlane); |
72 } | 82 } |
73 | 83 |
74 // Fill the U and V planes. | 84 // Fill the U and V planes. |
75 uint8* u_plane = frame->data(VideoFrame::kUPlane); | 85 uint8* u_plane = frame->data(VideoFrame::kUPlane); |
76 uint8* v_plane = frame->data(VideoFrame::kVPlane); | 86 uint8* v_plane = frame->data(VideoFrame::kVPlane); |
77 int uv_rows = frame->rows(VideoFrame::kUPlane); | 87 int uv_rows = frame->rows(VideoFrame::kUPlane); |
78 int u_row_bytes = frame->row_bytes(VideoFrame::kUPlane); | 88 int u_row_bytes = frame->row_bytes(VideoFrame::kUPlane); |
79 int v_row_bytes = frame->row_bytes(VideoFrame::kVPlane); | 89 int v_row_bytes = frame->row_bytes(VideoFrame::kVPlane); |
80 for (int i = 0; i < uv_rows; ++i) { | 90 for (int i = 0; i < uv_rows; ++i) { |
81 memset(u_plane, u, u_row_bytes); | 91 memset(u_plane, u, u_row_bytes); |
82 memset(v_plane, v, v_row_bytes); | 92 memset(v_plane, v, v_row_bytes); |
83 u_plane += frame->stride(VideoFrame::kUPlane); | 93 u_plane += frame->stride(VideoFrame::kUPlane); |
84 v_plane += frame->stride(VideoFrame::kVPlane); | 94 v_plane += frame->stride(VideoFrame::kVPlane); |
85 } | 95 } |
86 } | 96 } |
87 | 97 |
88 } // namespace media | 98 } // namespace media |
OLD | NEW |