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

Side by Side Diff: cc/resources/video_resource_updater.h

Issue 2763503002: Move HalfFloatMaker to media (Closed)
Patch Set: Moved HalffloatMaker and its implementation from cc to media Created 3 years, 9 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 #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
11 #include <list> 11 #include <list>
12 #include <memory> 12 #include <memory>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "cc/cc_export.h" 19 #include "cc/cc_export.h"
20 #include "cc/resources/release_callback_impl.h" 20 #include "cc/resources/release_callback_impl.h"
21 #include "cc/resources/resource_format.h" 21 #include "cc/resources/resource_format.h"
22 #include "cc/resources/texture_mailbox.h" 22 #include "cc/resources/texture_mailbox.h"
23 #include "media/video/half_float_maker.h"
24 #include "media/video/half_float_maker_lib_yuv.h"
25 #include "media/video/half_float_maker_xor.h"
23 #include "ui/gfx/geometry/size.h" 26 #include "ui/gfx/geometry/size.h"
24 27
25 namespace media { 28 namespace media {
26 class SkCanvasVideoRenderer; 29 class SkCanvasVideoRenderer;
27 class VideoFrame; 30 class VideoFrame;
28 } 31 }
29 32
30 namespace cc { 33 namespace cc {
31 class ContextProvider; 34 class ContextProvider;
32 class ResourceProvider; 35 class ResourceProvider;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 class CC_EXPORT VideoResourceUpdater 76 class CC_EXPORT VideoResourceUpdater
74 : public base::SupportsWeakPtr<VideoResourceUpdater> { 77 : public base::SupportsWeakPtr<VideoResourceUpdater> {
75 public: 78 public:
76 VideoResourceUpdater(ContextProvider* context_provider, 79 VideoResourceUpdater(ContextProvider* context_provider,
77 ResourceProvider* resource_provider); 80 ResourceProvider* resource_provider);
78 ~VideoResourceUpdater(); 81 ~VideoResourceUpdater();
79 82
80 VideoFrameExternalResources CreateExternalResourcesFromVideoFrame( 83 VideoFrameExternalResources CreateExternalResourcesFromVideoFrame(
81 scoped_refptr<media::VideoFrame> video_frame); 84 scoped_refptr<media::VideoFrame> video_frame);
82 85
83 // Base class for converting short integers to half-floats. 86 static std::unique_ptr<media::HalfFloatMaker> NewHalfFloatMaker(
84 // TODO(hubbe): Move this to media/.
85 class HalfFloatMaker {
86 public:
87 // Convert an array of short integers into an array of half-floats.
88 // |src| is an array of integers in range 0 .. 2^{bits_per_channel} - 1
89 // |num| is number of entries in input and output array.
90 // The numbers stored in |dst| will be half floats in range 0.0..1.0
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); 87 int bits_per_channel);
105 88
106 private: 89 private:
107 class PlaneResource { 90 class PlaneResource {
108 public: 91 public:
109 PlaneResource(unsigned resource_id, 92 PlaneResource(unsigned resource_id,
110 const gfx::Size& resource_size, 93 const gfx::Size& resource_size,
111 ResourceFormat resource_format, 94 ResourceFormat resource_format,
112 gpu::Mailbox mailbox); 95 gpu::Mailbox mailbox);
113 PlaneResource(const PlaneResource& other); 96 PlaneResource(const PlaneResource& other);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // Recycle resources so that we can reduce the number of allocations and 187 // Recycle resources so that we can reduce the number of allocations and
205 // data transfers. 188 // data transfers.
206 ResourceList all_resources_; 189 ResourceList all_resources_;
207 190
208 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); 191 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater);
209 }; 192 };
210 193
211 } // namespace cc 194 } // namespace cc
212 195
213 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ 196 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_
OLDNEW
« 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