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

Unified Diff: cc/resources/video_resource_updater_unittest.cc

Issue 2969223002: [media]: Replace LUMINANCE_F16 by R16 for 9/10-bit h264 videos.
Patch Set: Fix in resource_format_utils Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/video_resource_updater.cc ('k') | cc/test/test_context_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/video_resource_updater_unittest.cc
diff --git a/cc/resources/video_resource_updater_unittest.cc b/cc/resources/video_resource_updater_unittest.cc
index 4788e0ec77b5fc6610065fb3c49e7e96cb325818..e7c982f52487dcdb880ddc5a06b10933e346a7bf 100644
--- a/cc/resources/video_resource_updater_unittest.cc
+++ b/cc/resources/video_resource_updater_unittest.cc
@@ -311,6 +311,40 @@ TEST_F(VideoResourceUpdaterTestWithF16, HighBitFrame) {
EXPECT_NEAR(resources2.offset, 0.5, 0.1);
}
+class VideoResourceUpdaterTestWithR16 : public VideoResourceUpdaterTest {
+ public:
+ VideoResourceUpdaterTestWithR16() : VideoResourceUpdaterTest() {
+ context3d_->set_support_texture_norm16(true);
+ }
+};
+
+TEST_F(VideoResourceUpdaterTestWithR16, HighBitFrame) {
+ bool use_stream_video_draw_quad = false;
+ VideoResourceUpdater updater(context_provider_.get(),
+ resource_provider3d_.get(),
+ use_stream_video_draw_quad);
+ updater.UseR16ForTesting(true);
+ resource_provider3d_->SetYUVHighbitResourceFormatForTesting(viz::R16_EXT);
+ scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame();
+
+ VideoFrameExternalResources resources =
+ updater.CreateExternalResourcesFromVideoFrame(video_frame);
+ EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type);
+
+ // multiplier = (1 << shift) + 1.0 / (1 << (bits_per_channel - shift))
+ // where shift = 16 - bits_per_channel, and bits_per_channel = 10
+ EXPECT_NEAR(resources.multiplier, 64.0625, 0.1);
+ EXPECT_NEAR(resources.offset, 0.0, 0.1);
+
+ // Create the resource again, to test the path where the
+ // resources are cached.
+ VideoFrameExternalResources resources2 =
+ updater.CreateExternalResourcesFromVideoFrame(video_frame);
+ EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources2.type);
+ EXPECT_NEAR(resources2.multiplier, 64.0625, 0.1);
+ EXPECT_NEAR(resources2.offset, 0.0, 0.1);
+}
+
TEST_F(VideoResourceUpdaterTest, HighBitFrameSoftwareCompositor) {
bool use_stream_video_draw_quad = false;
VideoResourceUpdater updater(nullptr, resource_provider_software_.get(),
« no previous file with comments | « cc/resources/video_resource_updater.cc ('k') | cc/test/test_context_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698