OLD | NEW |
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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 EXPECT_NEAR(resources.multiplier, 2.0, 0.1); |
| 282 EXPECT_NEAR(resources.offset, 0.5, 0.1); |
| 283 |
| 284 // Create the resource again, to test the path where the |
| 285 // resources are cached. |
| 286 VideoFrameExternalResources resources2 = |
| 287 updater.CreateExternalResourcesFromVideoFrame(video_frame); |
| 288 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources2.type); |
| 289 EXPECT_NEAR(resources2.multiplier, 2.0, 0.1); |
| 290 EXPECT_NEAR(resources2.offset, 0.5, 0.1); |
281 } | 291 } |
282 | 292 |
283 TEST_F(VideoResourceUpdaterTest, HighBitFrameSoftwareCompositor) { | 293 TEST_F(VideoResourceUpdaterTest, HighBitFrameSoftwareCompositor) { |
284 VideoResourceUpdater updater(nullptr, resource_provider_software_.get()); | 294 VideoResourceUpdater updater(nullptr, resource_provider_software_.get()); |
285 scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame(); | 295 scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame(); |
286 | 296 |
287 VideoFrameExternalResources resources = | 297 VideoFrameExternalResources resources = |
288 updater.CreateExternalResourcesFromVideoFrame(video_frame); | 298 updater.CreateExternalResourcesFromVideoFrame(video_frame); |
289 EXPECT_EQ(VideoFrameExternalResources::SOFTWARE_RESOURCE, resources.type); | 299 EXPECT_EQ(VideoFrameExternalResources::SOFTWARE_RESOURCE, resources.type); |
290 } | 300 } |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 FromHalfFloat(half_floats[i] + 1) - FromHalfFloat(half_floats[i]); | 558 FromHalfFloat(half_floats[i] + 1) - FromHalfFloat(half_floats[i]); |
549 EXPECT_NEAR(FromHalfFloat(half_floats[i]), integers[i] * multiplier, | 559 EXPECT_NEAR(FromHalfFloat(half_floats[i]), integers[i] * multiplier, |
550 expected_precision) | 560 expected_precision) |
551 << "i = " << i << " bits = " << bits; | 561 << "i = " << i << " bits = " << bits; |
552 } | 562 } |
553 } | 563 } |
554 } | 564 } |
555 | 565 |
556 } // namespace | 566 } // namespace |
557 } // namespace cc | 567 } // namespace cc |
OLD | NEW |