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 #ifndef CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 5 #ifndef CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 class CC_EXPORT VideoResourceUpdater | 73 class CC_EXPORT VideoResourceUpdater |
74 : public base::SupportsWeakPtr<VideoResourceUpdater> { | 74 : public base::SupportsWeakPtr<VideoResourceUpdater> { |
75 public: | 75 public: |
76 VideoResourceUpdater(ContextProvider* context_provider, | 76 VideoResourceUpdater(ContextProvider* context_provider, |
77 ResourceProvider* resource_provider); | 77 ResourceProvider* resource_provider); |
78 ~VideoResourceUpdater(); | 78 ~VideoResourceUpdater(); |
79 | 79 |
80 VideoFrameExternalResources CreateExternalResourcesFromVideoFrame( | 80 VideoFrameExternalResources CreateExternalResourcesFromVideoFrame( |
81 scoped_refptr<media::VideoFrame> video_frame); | 81 scoped_refptr<media::VideoFrame> video_frame); |
82 | 82 |
83 // Convert an array of short integers into an array of half-floats. | 83 // Base class for converting short integers to half-floats. |
84 // |src| is an array of integers in range 0 .. 2^{bits_per_channel} - 1 | 84 // TODO(hubbe): Move this to media/. |
85 // |num| is number of entries in input and output array. | 85 class HalfFloatMaker { |
86 // The numbers stored in |dst| will be half floats in range 0.0..1.0 | 86 public: |
87 static void MakeHalfFloats(const uint16_t* src, | 87 // Convert an array of short integers into an array of half-floats. |
88 int bits_per_channel, | 88 // |src| is an array of integers in range 0 .. 2^{bits_per_channel} - 1 |
89 size_t num, | 89 // |num| is number of entries in input and output array. |
90 uint16_t* dst); | 90 // The numbers stored in |dst| will be half floats in range 0.0..1.0 |
fbarchard1
2016/10/21 22:46:06
This comment needs update?
hubbe
2016/10/21 22:55:04
Will fix in separate cl (Since this one is checked
| |
91 virtual void MakeHalfFloats(const uint16_t* src, | |
92 size_t num, | |
93 uint16_t* dst) = 0; | |
94 // The half-floats made needs by this class will be in the range | |
95 // [Offset() .. Offset() + 1.0/Multiplier]. So if you want results | |
96 // in the 0-1 range, you need to do: | |
97 // (half_float - Offset()) * Multiplier() | |
98 // to each returned value. | |
99 virtual float Offset() const = 0; | |
100 virtual float Multiplier() const = 0; | |
101 }; | |
102 | |
103 static std::unique_ptr<HalfFloatMaker> NewHalfFloatMaker( | |
104 int bits_per_channel); | |
91 | 105 |
92 private: | 106 private: |
93 class PlaneResource { | 107 class PlaneResource { |
94 public: | 108 public: |
95 PlaneResource(unsigned resource_id, | 109 PlaneResource(unsigned resource_id, |
96 const gfx::Size& resource_size, | 110 const gfx::Size& resource_size, |
97 ResourceFormat resource_format, | 111 ResourceFormat resource_format, |
98 gpu::Mailbox mailbox); | 112 gpu::Mailbox mailbox); |
99 PlaneResource(const PlaneResource& other); | 113 PlaneResource(const PlaneResource& other); |
100 | 114 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 // Recycle resources so that we can reduce the number of allocations and | 203 // Recycle resources so that we can reduce the number of allocations and |
190 // data transfers. | 204 // data transfers. |
191 ResourceList all_resources_; | 205 ResourceList all_resources_; |
192 | 206 |
193 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); | 207 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); |
194 }; | 208 }; |
195 | 209 |
196 } // namespace cc | 210 } // namespace cc |
197 | 211 |
198 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ | 212 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ |
OLD | NEW |