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

Side by Side Diff: cc/resources/video_resource_updater_unittest.cc

Issue 2122573003: media: replace LUMINANCE_F16 by RG_88 for 9/10-bit h264 videos Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to ToT Created 4 years, 2 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/resources/video_resource_updater.cc ('k') | cc/test/data/yuv_stripes_clipped_rg88.png » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/resources/video_resource_updater.h" 5 #include "cc/resources/video_resource_updater.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 TEST_F(VideoResourceUpdaterTest, SoftwareFrame) { 246 TEST_F(VideoResourceUpdaterTest, SoftwareFrame) {
247 VideoResourceUpdater updater(context_provider_.get(), 247 VideoResourceUpdater updater(context_provider_.get(),
248 resource_provider3d_.get()); 248 resource_provider3d_.get());
249 scoped_refptr<media::VideoFrame> video_frame = CreateTestYUVVideoFrame(); 249 scoped_refptr<media::VideoFrame> video_frame = CreateTestYUVVideoFrame();
250 250
251 VideoFrameExternalResources resources = 251 VideoFrameExternalResources resources =
252 updater.CreateExternalResourcesFromVideoFrame(video_frame); 252 updater.CreateExternalResourcesFromVideoFrame(video_frame);
253 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type); 253 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type);
254 } 254 }
255 255
256 TEST_F(VideoResourceUpdaterTest, HighBitFrameNoF16) { 256 TEST_F(VideoResourceUpdaterTest, HighBitFrameNo16bitTexture) {
257 VideoResourceUpdater updater(context_provider_.get(), 257 VideoResourceUpdater updater(context_provider_.get(),
258 resource_provider3d_.get()); 258 resource_provider3d_.get());
259 scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame(); 259 scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame();
260 260
261 VideoFrameExternalResources resources = 261 VideoFrameExternalResources resources =
262 updater.CreateExternalResourcesFromVideoFrame(video_frame); 262 updater.CreateExternalResourcesFromVideoFrame(video_frame);
263 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type); 263 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type);
264 } 264 }
265 265
266 class VideoResourceUpdaterTestWithF16 : public VideoResourceUpdaterTest { 266 class VideoResourceUpdaterTestWithF16 : public VideoResourceUpdaterTest {
(...skipping 16 matching lines...) Expand all
283 283
284 // Create the resource again, to test the path where the 284 // Create the resource again, to test the path where the
285 // resources are cached. 285 // resources are cached.
286 VideoFrameExternalResources resources2 = 286 VideoFrameExternalResources resources2 =
287 updater.CreateExternalResourcesFromVideoFrame(video_frame); 287 updater.CreateExternalResourcesFromVideoFrame(video_frame);
288 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources2.type); 288 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources2.type);
289 EXPECT_NEAR(resources2.multiplier, 2.0, 0.1); 289 EXPECT_NEAR(resources2.multiplier, 2.0, 0.1);
290 EXPECT_NEAR(resources2.offset, 0.5, 0.1); 290 EXPECT_NEAR(resources2.offset, 0.5, 0.1);
291 } 291 }
292 292
293 class VideoResourceUpdaterTestWithRG : public VideoResourceUpdaterTest {
294 public:
295 VideoResourceUpdaterTestWithRG() : VideoResourceUpdaterTest() {
296 context3d_->set_support_texture_rg(true);
297 }
298 };
299
300 TEST_F(VideoResourceUpdaterTestWithRG, HighBitFrame) {
301 VideoResourceUpdater updater(context_provider_.get(),
302 resource_provider3d_.get());
303 scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame();
304
305 VideoFrameExternalResources resources =
306 updater.CreateExternalResourcesFromVideoFrame(video_frame);
307 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type);
308 }
309
293 TEST_F(VideoResourceUpdaterTest, HighBitFrameSoftwareCompositor) { 310 TEST_F(VideoResourceUpdaterTest, HighBitFrameSoftwareCompositor) {
294 VideoResourceUpdater updater(nullptr, resource_provider_software_.get()); 311 VideoResourceUpdater updater(nullptr, resource_provider_software_.get());
295 scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame(); 312 scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame();
296 313
297 VideoFrameExternalResources resources = 314 VideoFrameExternalResources resources =
298 updater.CreateExternalResourcesFromVideoFrame(video_frame); 315 updater.CreateExternalResourcesFromVideoFrame(video_frame);
299 EXPECT_EQ(VideoFrameExternalResources::SOFTWARE_RESOURCE, resources.type); 316 EXPECT_EQ(VideoFrameExternalResources::SOFTWARE_RESOURCE, resources.type);
300 } 317 }
301 318
302 TEST_F(VideoResourceUpdaterTest, WonkySoftwareFrame) { 319 TEST_F(VideoResourceUpdaterTest, WonkySoftwareFrame) {
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 FromHalfFloat(half_floats[i] + 1) - FromHalfFloat(half_floats[i]); 575 FromHalfFloat(half_floats[i] + 1) - FromHalfFloat(half_floats[i]);
559 EXPECT_NEAR(FromHalfFloat(half_floats[i]), integers[i] * multiplier, 576 EXPECT_NEAR(FromHalfFloat(half_floats[i]), integers[i] * multiplier,
560 expected_precision) 577 expected_precision)
561 << "i = " << i << " bits = " << bits; 578 << "i = " << i << " bits = " << bits;
562 } 579 }
563 } 580 }
564 } 581 }
565 582
566 } // namespace 583 } // namespace
567 } // namespace cc 584 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/video_resource_updater.cc ('k') | cc/test/data/yuv_stripes_clipped_rg88.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698