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

Unified Diff: cc/output/renderer_pixeltest.cc

Issue 92703003: Support videos with JPEG color range in GPU YUV convert path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@yuv_v2
Patch Set: add dark_grey image Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/quads/draw_quad_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/renderer_pixeltest.cc
diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc
index 2bf5152d2139073110e480ba164ec9f9483062e1..ab8509904564a09090c42c3969b93412dbc7df4f 100644
--- a/cc/output/renderer_pixeltest.cc
+++ b/cc/output/renderer_pixeltest.cc
@@ -405,7 +405,13 @@ TEST_F(GLRendererPixelTest, NonPremultipliedTextureWithBackground) {
class VideoGLRendererPixelTest : public GLRendererPixelTest {
protected:
scoped_ptr<YUVVideoDrawQuad> CreateTestYUVVideoDrawQuad(
- SharedQuadState* shared_state, bool with_alpha, bool is_transparent) {
+ SharedQuadState* shared_state,
+ bool with_alpha,
+ bool is_transparent,
+ bool has_jpeg_color_range,
+ uint8 y,
+ uint8 u,
+ uint8 v) {
gfx::Rect rect(this->device_viewport_size_);
gfx::Rect opaque_rect(0, 0, 0, 0);
@@ -447,10 +453,10 @@ class VideoGLRendererPixelTest : public GLRendererPixelTest {
scoped_ptr<uint8_t[]> a_plane;
if (with_alpha)
a_plane.reset(new uint8_t[y_plane_size]);
- // YUV values representing Green.
- memset(y_plane.get(), 149, y_plane_size);
- memset(u_plane.get(), 43, uv_plane_size);
- memset(v_plane.get(), 21, uv_plane_size);
+ // YUV values from params.
+ memset(y_plane.get(), y, y_plane_size);
+ memset(u_plane.get(), u, uv_plane_size);
+ memset(v_plane.get(), v, uv_plane_size);
if (with_alpha)
memset(a_plane.get(), is_transparent ? 0 : 128, y_plane_size);
@@ -466,8 +472,15 @@ class VideoGLRendererPixelTest : public GLRendererPixelTest {
}
scoped_ptr<YUVVideoDrawQuad> yuv_quad = cc::YUVVideoDrawQuad::Create();
- yuv_quad->SetNew(shared_state, rect, opaque_rect, gfx::Size(),
- y_resource, u_resource, v_resource, a_resource);
+ yuv_quad->SetNew(shared_state,
+ rect,
+ opaque_rect,
+ gfx::Size(),
+ y_resource,
+ u_resource,
+ v_resource,
+ a_resource,
+ has_jpeg_color_range);
return yuv_quad.Pass();
}
};
@@ -481,8 +494,9 @@ TEST_F(VideoGLRendererPixelTest, SimpleYUVRect) {
scoped_ptr<SharedQuadState> shared_state =
CreateTestSharedQuadState(gfx::Transform(), rect);
- scoped_ptr<YUVVideoDrawQuad> yuv_quad =
- CreateTestYUVVideoDrawQuad(shared_state.get(), false, false);
+ // YUV of (149,43,21) should be green (0,255,0) in RGB.
+ scoped_ptr<YUVVideoDrawQuad> yuv_quad = CreateTestYUVVideoDrawQuad(
+ shared_state.get(), false, false, false, 149, 43, 21);
pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>());
@@ -496,6 +510,83 @@ TEST_F(VideoGLRendererPixelTest, SimpleYUVRect) {
ExactPixelComparator(true)));
}
+TEST_F(VideoGLRendererPixelTest, SimpleYUVRectBlack) {
+ gfx::Rect rect(this->device_viewport_size_);
+
+ RenderPass::Id id(1, 1);
+ scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect);
+
+ scoped_ptr<SharedQuadState> shared_state =
+ CreateTestSharedQuadState(gfx::Transform(), rect);
+
+ // In MPEG color range YUV values of (15,128,128) should produce black.
+ scoped_ptr<YUVVideoDrawQuad> yuv_quad = CreateTestYUVVideoDrawQuad(
+ shared_state.get(), false, false, false, 15, 128, 128);
+
+ pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>());
+
+ RenderPassList pass_list;
+ pass_list.push_back(pass.Pass());
+
+ // If we didn't get black out of the YUV values above, then we probably have a
+ // color range issue.
+ EXPECT_TRUE(this->RunPixelTest(
+ &pass_list,
+ PixelTest::NoOffscreenContext,
+ base::FilePath(FILE_PATH_LITERAL("black.png")),
+ ExactPixelComparator(true)));
+}
+
+TEST_F(VideoGLRendererPixelTest, SimpleYUVJRect) {
+ gfx::Rect rect(this->device_viewport_size_);
+
+ RenderPass::Id id(1, 1);
+ scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect);
+
+ scoped_ptr<SharedQuadState> shared_state =
+ CreateTestSharedQuadState(gfx::Transform(), rect);
+
+ // YUV of (149,43,21) should be green (0,255,0) in RGB.
+ scoped_ptr<YUVVideoDrawQuad> yuv_quad = CreateTestYUVVideoDrawQuad(
+ shared_state.get(), false, false, true, 149, 43, 21);
+
+ pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>());
+
+ RenderPassList pass_list;
+ pass_list.push_back(pass.Pass());
+
+ EXPECT_TRUE(this->RunPixelTest(
+ &pass_list,
+ PixelTest::NoOffscreenContext,
+ base::FilePath(FILE_PATH_LITERAL("green.png")),
+ ExactPixelComparator(true)));
+}
+
+TEST_F(VideoGLRendererPixelTest, SimpleYUVJRectGrey) {
+ gfx::Rect rect(this->device_viewport_size_);
+
+ RenderPass::Id id(1, 1);
+ scoped_ptr<RenderPass> pass = CreateTestRootRenderPass(id, rect);
+
+ scoped_ptr<SharedQuadState> shared_state =
+ CreateTestSharedQuadState(gfx::Transform(), rect);
+
+ // Dark grey in JPEG color range (in MPEG, this is black).
+ scoped_ptr<YUVVideoDrawQuad> yuv_quad = CreateTestYUVVideoDrawQuad(
+ shared_state.get(), false, false, true, 15, 128, 128);
+
+ pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>());
+
+ RenderPassList pass_list;
+ pass_list.push_back(pass.Pass());
+
+ EXPECT_TRUE(this->RunPixelTest(
+ &pass_list,
+ PixelTest::NoOffscreenContext,
+ base::FilePath(FILE_PATH_LITERAL("dark_grey.png")),
+ ExactPixelComparator(true)));
+}
+
TEST_F(VideoGLRendererPixelTest, SimpleYUVARect) {
gfx::Rect rect(this->device_viewport_size_);
@@ -505,8 +596,9 @@ TEST_F(VideoGLRendererPixelTest, SimpleYUVARect) {
scoped_ptr<SharedQuadState> shared_state =
CreateTestSharedQuadState(gfx::Transform(), rect);
- scoped_ptr<YUVVideoDrawQuad> yuv_quad =
- CreateTestYUVVideoDrawQuad(shared_state.get(), true, false);
+ // YUV of (149,43,21) should be green (0,255,0) in RGB.
+ scoped_ptr<YUVVideoDrawQuad> yuv_quad = CreateTestYUVVideoDrawQuad(
+ shared_state.get(), true, false, false, 149, 43, 21);
pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>());
@@ -534,8 +626,8 @@ TEST_F(VideoGLRendererPixelTest, FullyTransparentYUVARect) {
scoped_ptr<SharedQuadState> shared_state =
CreateTestSharedQuadState(gfx::Transform(), rect);
- scoped_ptr<YUVVideoDrawQuad> yuv_quad =
- CreateTestYUVVideoDrawQuad(shared_state.get(), true, true);
+ scoped_ptr<YUVVideoDrawQuad> yuv_quad = CreateTestYUVVideoDrawQuad(
danakj 2013/12/04 21:00:12 I like your // YUV of (x,x,x) should be green (y,y
+ shared_state.get(), true, true, false, 149, 43, 21);
pass->quad_list.push_back(yuv_quad.PassAs<DrawQuad>());
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/quads/draw_quad_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698