Chromium Code Reviews| Index: cc/output/renderer_pixeltest.cc |
| diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc |
| index dcac7138787cd5d074685e26e7f59fd9d0c62cd4..3e69d2aab756585c4c4af858c7998d4d6a3afc46 100644 |
| --- a/cc/output/renderer_pixeltest.cc |
| +++ b/cc/output/renderer_pixeltest.cc |
| @@ -16,6 +16,7 @@ |
| #include "cc/test/fake_raster_source.h" |
| #include "cc/test/fake_recording_source.h" |
| #include "cc/test/pixel_test.h" |
| +#include "cc/test/test_in_process_context_provider.h" |
| #include "gpu/command_buffer/client/gles2_interface.h" |
| #include "media/base/video_frame.h" |
| #include "third_party/skia/include/core/SkColorPriv.h" |
| @@ -276,6 +277,11 @@ void CreateTestYUVVideoDrawQuad_FromVideoFrame( |
| video_frame->format() == media::PIXEL_FORMAT_YUV422P10 || |
| video_frame->format() == media::PIXEL_FORMAT_YUV444P10) { |
| bits_per_channel = 10; |
| + ResourceFormat yuv_highbit_resource_format = |
| + resource_provider->YuvResourceFormat(bits_per_channel); |
| + if (yuv_highbit_resource_format != RG_88 && |
| + yuv_highbit_resource_format != RGBA_8888) |
| + bits_per_channel = 8; |
| } |
| yuv_quad->SetNew(shared_state, rect, opaque_rect, visible_rect, |
| @@ -1097,9 +1103,28 @@ class VideoGLRendererPixelTest : public GLRendererPixelTest { |
| std::unique_ptr<VideoResourceUpdater> video_resource_updater_; |
| }; |
| +enum class HighbitTexture { |
| + Y8, |
| + RG88, |
| +}; |
| + |
| class VideoGLRendererPixelHiLoTest |
| : public VideoGLRendererPixelTest, |
| - public ::testing::WithParamInterface<bool> {}; |
| + public ::testing::WithParamInterface< |
| + ::testing::tuple<bool, HighbitTexture>> { |
| + public: |
| + void SetSupportHighbitTexture(HighbitTexture texture) { |
| + switch (texture) { |
| + case HighbitTexture::Y8: |
| + resource_provider_->SetYUVHighbitResourceFormatForTesting(LUMINANCE_8); |
| + break; |
| + case HighbitTexture::RG88: |
| + // |context_provider_| for test doesn't support RG texture, so use RGBA. |
| + resource_provider_->SetYUVHighbitResourceFormatForTesting(RGBA_8888); |
| + break; |
| + } |
| + } |
| +}; |
| TEST_P(VideoGLRendererPixelHiLoTest, SimpleYUVRect) { |
| gfx::Rect rect(this->device_viewport_size_); |
| @@ -1110,7 +1135,9 @@ TEST_P(VideoGLRendererPixelHiLoTest, SimpleYUVRect) { |
| SharedQuadState* shared_state = |
| CreateTestSharedQuadState(gfx::Transform(), rect, pass.get()); |
| - bool highbit = GetParam(); |
| + const bool highbit = testing::get<0>(GetParam()); |
| + const HighbitTexture format = testing::get<1>(GetParam()); |
| + SetSupportHighbitTexture(format); |
| CreateTestYUVVideoDrawQuad_Striped( |
| shared_state, media::PIXEL_FORMAT_YV12, false, highbit, |
| gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f), pass.get(), |
| @@ -1119,10 +1146,13 @@ TEST_P(VideoGLRendererPixelHiLoTest, SimpleYUVRect) { |
| RenderPassList pass_list; |
| pass_list.push_back(std::move(pass)); |
| - EXPECT_TRUE( |
| - this->RunPixelTest(&pass_list, |
| - base::FilePath(FILE_PATH_LITERAL("yuv_stripes.png")), |
| - FuzzyPixelOffByOneComparator(true))); |
| + base::FilePath file_path = |
| + base::FilePath(FILE_PATH_LITERAL("yuv_stripes.png")); |
| + if (highbit && format == HighbitTexture::RG88) { |
| + file_path = base::FilePath(FILE_PATH_LITERAL("yuv_stripes_rg88.png")); |
|
dshwang
2016/10/05 15:13:42
RG88 path in shader.cc cannot produce exactly same
hubbe
2016/10/05 18:03:25
The values in these files differ quite a lot actua
dshwang
2016/10/07 12:35:01
Good point. To verity it, I added |disable_one_com
|
| + } |
| + EXPECT_TRUE(this->RunPixelTest(&pass_list, file_path, |
| + FuzzyPixelOffByOneComparator(true))); |
| } |
| TEST_P(VideoGLRendererPixelHiLoTest, ClippedYUVRect) { |
| @@ -1136,7 +1166,9 @@ TEST_P(VideoGLRendererPixelHiLoTest, ClippedYUVRect) { |
| SharedQuadState* shared_state = |
| CreateTestSharedQuadState(gfx::Transform(), viewport, pass.get()); |
| - bool highbit = GetParam(); |
| + const bool highbit = testing::get<0>(GetParam()); |
| + const HighbitTexture format = testing::get<1>(GetParam()); |
| + SetSupportHighbitTexture(format); |
| CreateTestYUVVideoDrawQuad_Striped( |
| shared_state, media::PIXEL_FORMAT_YV12, false, highbit, |
| gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f), pass.get(), |
| @@ -1145,9 +1177,14 @@ TEST_P(VideoGLRendererPixelHiLoTest, ClippedYUVRect) { |
| RenderPassList pass_list; |
| pass_list.push_back(std::move(pass)); |
| - EXPECT_TRUE(this->RunPixelTest( |
| - &pass_list, base::FilePath(FILE_PATH_LITERAL("yuv_stripes_clipped.png")), |
| - FuzzyPixelOffByOneComparator(true))); |
| + base::FilePath file_path = |
| + base::FilePath(FILE_PATH_LITERAL("yuv_stripes_clipped.png")); |
| + if (highbit && format == HighbitTexture::RG88) { |
| + file_path = |
| + base::FilePath(FILE_PATH_LITERAL("yuv_stripes_clipped_rg88.png")); |
|
dshwang
2016/10/05 15:13:42
ditto
|
| + } |
| + EXPECT_TRUE(this->RunPixelTest(&pass_list, file_path, |
| + FuzzyPixelOffByOneComparator(true))); |
| } |
| TEST_F(VideoGLRendererPixelHiLoTest, OffsetYUVRect) { |
| @@ -1199,7 +1236,12 @@ TEST_F(VideoGLRendererPixelTest, SimpleYUVRectBlack) { |
| } |
| // First argument (test case prefix) is intentionally left empty. |
| -INSTANTIATE_TEST_CASE_P(, VideoGLRendererPixelHiLoTest, ::testing::Bool()); |
| +INSTANTIATE_TEST_CASE_P( |
| + , |
| + VideoGLRendererPixelHiLoTest, |
| + ::testing::Combine(::testing::Bool(), |
| + ::testing::Values(HighbitTexture::Y8, |
| + HighbitTexture::RG88))); |
| TEST_F(VideoGLRendererPixelTest, SimpleYUVJRect) { |
| gfx::Rect rect(this->device_viewport_size_); |