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

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: resolve hubbe's concerns except for test. separate the CLs. 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
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 {
267 public: 267 public:
268 VideoResourceUpdaterTestWithF16() : VideoResourceUpdaterTest() { 268 VideoResourceUpdaterTestWithF16() : VideoResourceUpdaterTest() {
269 context3d_->set_support_texture_half_float_linear(true); 269 context3d_->set_support_texture_half_float_linear(true);
270 } 270 }
271 }; 271 };
272 272
273 TEST_F(VideoResourceUpdaterTestWithF16, HighBitFrame) { 273 TEST_F(VideoResourceUpdaterTestWithF16, HighBitFrame) {
274 VideoResourceUpdater updater(context_provider_.get(), 274 VideoResourceUpdater updater(context_provider_.get(),
275 resource_provider3d_.get()); 275 resource_provider3d_.get());
276 scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame(); 276 scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame();
277 277
278 VideoFrameExternalResources resources = 278 VideoFrameExternalResources resources =
279 updater.CreateExternalResourcesFromVideoFrame(video_frame); 279 updater.CreateExternalResourcesFromVideoFrame(video_frame);
280 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type); 280 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type);
281 } 281 }
282 282
283 class VideoResourceUpdaterTestWithRG : public VideoResourceUpdaterTest {
284 public:
285 VideoResourceUpdaterTestWithRG() : VideoResourceUpdaterTest() {
286 context3d_->set_support_texture_rg(true);
287 }
288 };
289
290 TEST_F(VideoResourceUpdaterTestWithRG, HighBitFrame) {
291 VideoResourceUpdater updater(context_provider_.get(),
292 resource_provider3d_.get());
293 scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame();
294
295 VideoFrameExternalResources resources =
296 updater.CreateExternalResourcesFromVideoFrame(video_frame);
297 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type);
298 }
299
283 TEST_F(VideoResourceUpdaterTest, HighBitFrameSoftwareCompositor) { 300 TEST_F(VideoResourceUpdaterTest, HighBitFrameSoftwareCompositor) {
284 VideoResourceUpdater updater(nullptr, resource_provider_software_.get()); 301 VideoResourceUpdater updater(nullptr, resource_provider_software_.get());
285 scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame(); 302 scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame();
286 303
287 VideoFrameExternalResources resources = 304 VideoFrameExternalResources resources =
288 updater.CreateExternalResourcesFromVideoFrame(video_frame); 305 updater.CreateExternalResourcesFromVideoFrame(video_frame);
289 EXPECT_EQ(VideoFrameExternalResources::SOFTWARE_RESOURCE, resources.type); 306 EXPECT_EQ(VideoFrameExternalResources::SOFTWARE_RESOURCE, resources.type);
290 } 307 }
291 308
292 TEST_F(VideoResourceUpdaterTest, WonkySoftwareFrame) { 309 TEST_F(VideoResourceUpdaterTest, WonkySoftwareFrame) {
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 FromHalfFloat(half_floats[i] + 1) - FromHalfFloat(half_floats[i]); 565 FromHalfFloat(half_floats[i] + 1) - FromHalfFloat(half_floats[i]);
549 EXPECT_NEAR(FromHalfFloat(half_floats[i]), integers[i] * multiplier, 566 EXPECT_NEAR(FromHalfFloat(half_floats[i]), integers[i] * multiplier,
550 expected_precision) 567 expected_precision)
551 << "i = " << i << " bits = " << bits; 568 << "i = " << i << " bits = " << bits;
552 } 569 }
553 } 570 }
554 } 571 }
555 572
556 } // namespace 573 } // namespace
557 } // namespace cc 574 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698