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/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "gpu/GLES2/gl2extchromium.h" | 6 #include "gpu/GLES2/gl2extchromium.h" |
7 #include "gpu/command_buffer/client/gles2_interface_stub.h" | 7 #include "gpu/command_buffer/client/gles2_interface_stub.h" |
8 #include "media/base/timestamp_constants.h" | 8 #include "media/base/timestamp_constants.h" |
9 #include "media/base/video_frame.h" | 9 #include "media/base/video_frame.h" |
10 #include "media/base/video_util.h" | 10 #include "media/base/video_util.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // Bl Bl R R R R R R | 149 // Bl Bl R R R R R R |
150 // Bl Bl R R R R R R | 150 // Bl Bl R R R R R R |
151 // G G B B B B B B | 151 // G G B B B B B B |
152 // G G B B B B B B | 152 // G G B B B B B B |
153 // G G B B B B B B | 153 // G G B B B B B B |
154 // G G B B B B B B | 154 // G G B B B B B B |
155 // | 155 // |
156 // Each color region in the cropped frame is on a 2x2 block granularity, to | 156 // Each color region in the cropped frame is on a 2x2 block granularity, to |
157 // avoid sharing UV samples between regions. | 157 // avoid sharing UV samples between regions. |
158 | 158 |
159 static const uint8 cropped_y_plane[] = { | 159 static const uint8_t cropped_y_plane[] = { |
160 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, | 160 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, |
161 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, | 161 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, |
162 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, | 162 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, |
163 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, | 163 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, |
164 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, | 164 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, |
165 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, | 165 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, |
166 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, | 166 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, |
167 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, | 167 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76, 76, |
168 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, | 168 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, |
169 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, | 169 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, |
170 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, | 170 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, |
171 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, | 171 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, |
172 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, | 172 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, |
173 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, | 173 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, |
174 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, | 174 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, |
175 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, | 175 149, 149, 149, 149, 149, 149, 149, 149, 29, 29, 29, 29, 29, 29, 29, 29, |
176 }; | 176 }; |
177 | 177 |
178 static const uint8 cropped_u_plane[] = { | 178 static const uint8_t cropped_u_plane[] = { |
179 128, 128, 128, 128, 84, 84, 84, 84, 128, 128, 128, 128, 84, | 179 128, 128, 128, 128, 84, 84, 84, 84, 128, 128, 128, 128, 84, |
180 84, 84, 84, 128, 128, 128, 128, 84, 84, 84, 84, 128, 128, | 180 84, 84, 84, 128, 128, 128, 128, 84, 84, 84, 84, 128, 128, |
181 128, 128, 84, 84, 84, 84, 43, 43, 43, 43, 255, 255, 255, | 181 128, 128, 84, 84, 84, 84, 43, 43, 43, 43, 255, 255, 255, |
182 255, 43, 43, 43, 43, 255, 255, 255, 255, 43, 43, 43, 43, | 182 255, 43, 43, 43, 43, 255, 255, 255, 255, 43, 43, 43, 43, |
183 255, 255, 255, 255, 43, 43, 43, 43, 255, 255, 255, 255, | 183 255, 255, 255, 255, 43, 43, 43, 43, 255, 255, 255, 255, |
184 }; | 184 }; |
185 static const uint8 cropped_v_plane[] = { | 185 static const uint8_t cropped_v_plane[] = { |
186 128, 128, 128, 128, 255, 255, 255, 255, 128, 128, 128, 128, 255, | 186 128, 128, 128, 128, 255, 255, 255, 255, 128, 128, 128, 128, 255, |
187 255, 255, 255, 128, 128, 128, 128, 255, 255, 255, 255, 128, 128, | 187 255, 255, 255, 128, 128, 128, 128, 255, 255, 255, 255, 128, 128, |
188 128, 128, 255, 255, 255, 255, 21, 21, 21, 21, 107, 107, 107, | 188 128, 128, 255, 255, 255, 255, 21, 21, 21, 21, 107, 107, 107, |
189 107, 21, 21, 21, 21, 107, 107, 107, 107, 21, 21, 21, 21, | 189 107, 21, 21, 21, 21, 107, 107, 107, 107, 21, 21, 21, 21, |
190 107, 107, 107, 107, 21, 21, 21, 21, 107, 107, 107, 107, | 190 107, 107, 107, 107, 21, 21, 21, 21, 107, 107, 107, 107, |
191 }; | 191 }; |
192 | 192 |
193 libyuv::I420Copy(cropped_y_plane, 16, cropped_u_plane, 8, cropped_v_plane, 8, | 193 libyuv::I420Copy(cropped_y_plane, 16, cropped_u_plane, 8, cropped_v_plane, 8, |
194 cropped_frame()->data(VideoFrame::kYPlane), | 194 cropped_frame()->data(VideoFrame::kYPlane), |
195 cropped_frame()->stride(VideoFrame::kYPlane), | 195 cropped_frame()->stride(VideoFrame::kYPlane), |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 gpu::MailboxHolder mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), | 493 gpu::MailboxHolder mailbox(gpu::Mailbox::Generate(), gpu::SyncToken(), |
494 GL_TEXTURE_RECTANGLE_ARB); | 494 GL_TEXTURE_RECTANGLE_ARB); |
495 auto video_frame = VideoFrame::WrapNativeTexture( | 495 auto video_frame = VideoFrame::WrapNativeTexture( |
496 PIXEL_FORMAT_UYVY, mailbox, base::Bind(MailboxHoldersReleased), size, | 496 PIXEL_FORMAT_UYVY, mailbox, base::Bind(MailboxHoldersReleased), size, |
497 gfx::Rect(size), size, kNoTimestamp()); | 497 gfx::Rect(size), size, kNoTimestamp()); |
498 | 498 |
499 renderer_.Paint(video_frame, &canvas, kNaturalRect, 0xFF, | 499 renderer_.Paint(video_frame, &canvas, kNaturalRect, 0xFF, |
500 SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_90, context_3d); | 500 SkXfermode::kSrcOver_Mode, VIDEO_ROTATION_90, context_3d); |
501 } | 501 } |
502 } // namespace media | 502 } // namespace media |
OLD | NEW |