OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "cc/output/gl_renderer.h" | 9 #include "cc/output/gl_renderer.h" |
10 #include "cc/quads/draw_quad.h" | 10 #include "cc/quads/draw_quad.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 YUVVideoDrawQuad* yuv_quad = | 265 YUVVideoDrawQuad* yuv_quad = |
266 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); | 266 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); |
267 yuv_quad->SetNew(shared_state, rect, opaque_rect, visible_rect, | 267 yuv_quad->SetNew(shared_state, rect, opaque_rect, visible_rect, |
268 ya_tex_coord_rect, uv_tex_coord_rect, ya_tex_size, | 268 ya_tex_coord_rect, uv_tex_coord_rect, ya_tex_size, |
269 uv_tex_size, y_resource, u_resource, v_resource, a_resource, | 269 uv_tex_size, y_resource, u_resource, v_resource, a_resource, |
270 color_space, 0.0f, 1.0f); | 270 color_space, 0.0f, 1.0f); |
271 } | 271 } |
272 | 272 |
273 // Upshift video frame to 10 bit. | 273 // Upshift video frame to 10 bit. |
274 scoped_refptr<media::VideoFrame> CreateHighbitVideoFrame( | 274 scoped_refptr<media::VideoFrame> CreateHighbitVideoFrame( |
275 const scoped_refptr<media::VideoFrame>& video_frame) { | 275 media::VideoFrame* video_frame) { |
276 media::VideoPixelFormat format; | 276 media::VideoPixelFormat format; |
277 switch (video_frame->format()) { | 277 switch (video_frame->format()) { |
278 case media::PIXEL_FORMAT_I420: | 278 case media::PIXEL_FORMAT_I420: |
279 case media::PIXEL_FORMAT_YV12: | 279 case media::PIXEL_FORMAT_YV12: |
280 format = media::PIXEL_FORMAT_YUV420P10; | 280 format = media::PIXEL_FORMAT_YUV420P10; |
281 break; | 281 break; |
282 case media::PIXEL_FORMAT_YV16: | 282 case media::PIXEL_FORMAT_YV16: |
283 format = media::PIXEL_FORMAT_YUV422P10; | 283 format = media::PIXEL_FORMAT_YUV422P10; |
284 break; | 284 break; |
285 case media::PIXEL_FORMAT_YV24: | 285 case media::PIXEL_FORMAT_YV24: |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 video_frame->stride(media::VideoFrame::kVPlane) * i; | 351 video_frame->stride(media::VideoFrame::kVPlane) * i; |
352 for (int j = 0; j < video_frame->row_bytes(media::VideoFrame::kUPlane); | 352 for (int j = 0; j < video_frame->row_bytes(media::VideoFrame::kUPlane); |
353 ++j) { | 353 ++j) { |
354 u_row[j] = (u_value += 3); | 354 u_row[j] = (u_value += 3); |
355 v_row[j] = (v_value += 5); | 355 v_row[j] = (v_value += 5); |
356 } | 356 } |
357 } | 357 } |
358 uint8_t alpha_value = is_transparent ? 0 : 128; | 358 uint8_t alpha_value = is_transparent ? 0 : 128; |
359 | 359 |
360 if (highbit) | 360 if (highbit) |
361 video_frame = CreateHighbitVideoFrame(video_frame); | 361 video_frame = CreateHighbitVideoFrame(video_frame.get()); |
362 | 362 |
363 CreateTestYUVVideoDrawQuad_FromVideoFrame( | 363 CreateTestYUVVideoDrawQuad_FromVideoFrame( |
364 shared_state, video_frame, alpha_value, tex_coord_rect, render_pass, | 364 shared_state, video_frame, alpha_value, tex_coord_rect, render_pass, |
365 video_resource_updater, rect, visible_rect, resource_provider); | 365 video_resource_updater, rect, visible_rect, resource_provider); |
366 } | 366 } |
367 | 367 |
368 // Creates a video frame of size background_size filled with yuv_background, | 368 // Creates a video frame of size background_size filled with yuv_background, |
369 // and then draws a foreground rectangle in a different color on top of | 369 // and then draws a foreground rectangle in a different color on top of |
370 // that. The foreground rectangle must have coordinates that are divisible | 370 // that. The foreground rectangle must have coordinates that are divisible |
371 // by 2 because YUV is a block format. | 371 // by 2 because YUV is a block format. |
(...skipping 2750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3122 | 3122 |
3123 EXPECT_TRUE(this->RunPixelTest( | 3123 EXPECT_TRUE(this->RunPixelTest( |
3124 &pass_list, base::FilePath(FILE_PATH_LITERAL("spiral.png")), | 3124 &pass_list, base::FilePath(FILE_PATH_LITERAL("spiral.png")), |
3125 FuzzyPixelOffByOneComparator(true))); | 3125 FuzzyPixelOffByOneComparator(true))); |
3126 } | 3126 } |
3127 | 3127 |
3128 #endif // !defined(OS_ANDROID) | 3128 #endif // !defined(OS_ANDROID) |
3129 | 3129 |
3130 } // namespace | 3130 } // namespace |
3131 } // namespace cc | 3131 } // namespace cc |
OLD | NEW |