Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: cc/output/renderer_pixeltest.cc

Issue 1008493002: Increase YUV video clamping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/output/shader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "cc/output/gl_renderer.h" 6 #include "cc/output/gl_renderer.h"
7 #include "cc/quads/draw_quad.h" 7 #include "cc/quads/draw_quad.h"
8 #include "cc/quads/picture_draw_quad.h" 8 #include "cc/quads/picture_draw_quad.h"
9 #include "cc/quads/texture_draw_quad.h" 9 #include "cc/quads/texture_draw_quad.h"
10 #include "cc/resources/video_resource_updater.h" 10 #include "cc/resources/video_resource_updater.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 SingleReleaseCallbackImpl::Create( 240 SingleReleaseCallbackImpl::Create(
241 resources.release_callbacks[media::VideoFrame::kVPlane])); 241 resources.release_callbacks[media::VideoFrame::kVPlane]));
242 ResourceProvider::ResourceId a_resource = 0; 242 ResourceProvider::ResourceId a_resource = 0;
243 if (with_alpha) { 243 if (with_alpha) {
244 a_resource = resource_provider->CreateResourceFromTextureMailbox( 244 a_resource = resource_provider->CreateResourceFromTextureMailbox(
245 resources.mailboxes[media::VideoFrame::kAPlane], 245 resources.mailboxes[media::VideoFrame::kAPlane],
246 SingleReleaseCallbackImpl::Create( 246 SingleReleaseCallbackImpl::Create(
247 resources.release_callbacks[media::VideoFrame::kAPlane])); 247 resources.release_callbacks[media::VideoFrame::kAPlane]));
248 } 248 }
249 249
250 const gfx::Size ya_tex_size = video_frame->coded_size();
251 const gfx::Size uv_tex_size = media::VideoFrame::PlaneSize(
252 video_frame->format(), media::VideoFrame::kUPlane,
253 video_frame->coded_size());
254 DCHECK(uv_tex_size == media::VideoFrame::PlaneSize(
255 video_frame->format(), media::VideoFrame::kVPlane,
256 video_frame->coded_size()));
257 if (with_alpha) {
258 DCHECK(ya_tex_size == media::VideoFrame::PlaneSize(
259 video_frame->format(), media::VideoFrame::kAPlane,
260 video_frame->coded_size()));
261 }
262
250 YUVVideoDrawQuad* yuv_quad = 263 YUVVideoDrawQuad* yuv_quad =
251 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); 264 render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>();
252 yuv_quad->SetNew(shared_state, rect, opaque_rect, visible_rect, 265 yuv_quad->SetNew(shared_state, rect, opaque_rect, visible_rect,
253 tex_coord_rect, video_frame->coded_size(), y_resource, 266 tex_coord_rect, ya_tex_size, uv_tex_size, y_resource,
254 u_resource, v_resource, a_resource, color_space); 267 u_resource, v_resource, a_resource, color_space);
255 } 268 }
256 269
257 void CreateTestYUVVideoDrawQuad_Striped( 270 void CreateTestYUVVideoDrawQuad_Striped(
258 const SharedQuadState* shared_state, 271 const SharedQuadState* shared_state,
259 media::VideoFrame::Format format, 272 media::VideoFrame::Format format,
260 bool is_transparent, 273 bool is_transparent,
261 const gfx::RectF& tex_coord_rect, 274 const gfx::RectF& tex_coord_rect,
262 RenderPass* render_pass, 275 RenderPass* render_pass,
263 VideoResourceUpdater* video_resource_updater, 276 VideoResourceUpdater* video_resource_updater,
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 static_cast<float>(green_rect.width()) / background_size.width(), 945 static_cast<float>(green_rect.width()) / background_size.width(),
933 static_cast<float>(green_rect.height()) / background_size.height()); 946 static_cast<float>(green_rect.height()) / background_size.height());
934 947
935 // YUV of (149,43,21) should be green (0,255,0) in RGB. 948 // YUV of (149,43,21) should be green (0,255,0) in RGB.
936 // Create a video frame that has a non-green background rect, with a 949 // Create a video frame that has a non-green background rect, with a
937 // green sub-rectangle that should be the only thing displayed in 950 // green sub-rectangle that should be the only thing displayed in
938 // the final image. Bleeding will appear on all four sides of the video 951 // the final image. Bleeding will appear on all four sides of the video
939 // if the tex coords are not clamped. 952 // if the tex coords are not clamped.
940 CreateTestYUVVideoDrawQuad_TwoColor( 953 CreateTestYUVVideoDrawQuad_TwoColor(
941 shared_state, format, false, tex_coord_rect, background_size, 954 shared_state, format, false, tex_coord_rect, background_size,
942 gfx::Rect(background_size), 0, 0, 0, green_rect, 149, 43, 21, 955 gfx::Rect(background_size), 128, 128, 128, green_rect, 149, 43, 21,
943 pass.get(), video_resource_updater_.get(), resource_provider_.get()); 956 pass.get(), video_resource_updater_.get(), resource_provider_.get());
944 pass_list->push_back(pass.Pass()); 957 pass_list->push_back(pass.Pass());
945 } 958 }
946 959
947 void SetUp() override { 960 void SetUp() override {
948 GLRendererPixelTest::SetUp(); 961 GLRendererPixelTest::SetUp();
949 video_resource_updater_.reset(new VideoResourceUpdater( 962 video_resource_updater_.reset(new VideoResourceUpdater(
950 output_surface_->context_provider(), resource_provider_.get())); 963 output_surface_->context_provider(), resource_provider_.get()));
951 } 964 }
952 965
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after
2926 ? FILE_PATH_LITERAL("four_blue_green_checkers.png") 2939 ? FILE_PATH_LITERAL("four_blue_green_checkers.png")
2927 : FILE_PATH_LITERAL("checkers_big.png"); 2940 : FILE_PATH_LITERAL("checkers_big.png");
2928 EXPECT_TRUE(this->RunPixelTest(&pass_list, base::FilePath(path), 2941 EXPECT_TRUE(this->RunPixelTest(&pass_list, base::FilePath(path),
2929 ExactPixelComparator(true))); 2942 ExactPixelComparator(true)));
2930 } 2943 }
2931 2944
2932 #endif // !defined(OS_ANDROID) 2945 #endif // !defined(OS_ANDROID)
2933 2946
2934 } // namespace 2947 } // namespace
2935 } // namespace cc 2948 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/output/shader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698