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

Unified Diff: cc/resources/video_resource_updater.h

Issue 2444463002: Change half-float conversion to use 1.0 multiplier (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/resources/video_resource_updater.cc » ('j') | cc/resources/video_resource_updater.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/video_resource_updater.h
diff --git a/cc/resources/video_resource_updater.h b/cc/resources/video_resource_updater.h
index a42784c9b999ca948b2ed1f4ee32fb8e09f10cf5..b9b5b95c02631e476cf1fbd76347af5052506b42 100644
--- a/cc/resources/video_resource_updater.h
+++ b/cc/resources/video_resource_updater.h
@@ -80,14 +80,28 @@ class CC_EXPORT VideoResourceUpdater
VideoFrameExternalResources CreateExternalResourcesFromVideoFrame(
scoped_refptr<media::VideoFrame> video_frame);
- // Convert an array of short integers into an array of half-floats.
- // |src| is an array of integers in range 0 .. 2^{bits_per_channel} - 1
- // |num| is number of entries in input and output array.
- // The numbers stored in |dst| will be half floats in range 0.0..1.0
- static void MakeHalfFloats(const uint16_t* src,
- int bits_per_channel,
- size_t num,
- uint16_t* dst);
+ // Base class for converting short integers to half-floats.
+ // TODO(hubbe): Move this to media/.
+ class HalfFloatMaker {
+ public:
+ // Convert an array of short integers into an array of half-floats.
+ // |src| is an array of integers in range 0 .. 2^{bits_per_channel} - 1
+ // |num| is number of entries in input and output array.
+ // 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
+ virtual void MakeHalfFloats(const uint16_t* src,
+ size_t num,
+ uint16_t* dst) = 0;
+ // The half-floats made needs by this class will be in the range
+ // [Offset() .. Offset() + 1.0/Multiplier]. So if you want results
+ // in the 0-1 range, you need to do:
+ // (half_float - Offset()) * Multiplier()
+ // to each returned value.
+ virtual float Offset() const = 0;
+ virtual float Multiplier() const = 0;
+ };
+
+ static std::unique_ptr<HalfFloatMaker> NewHalfFloatMaker(
+ int bits_per_channel);
private:
class PlaneResource {
« no previous file with comments | « no previous file | cc/resources/video_resource_updater.cc » ('j') | cc/resources/video_resource_updater.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698