OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_OUTPUT_COLOR_LUT_CACHE_H_ |
| 6 #define CC_OUTPUT_COLOR_LUT_CACHE_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/containers/mru_cache.h" |
| 11 #include "base/macros.h" |
| 12 #include "media/base/video_color_space.h" |
| 13 #include "ui/gfx/color_space.h" |
| 14 |
| 15 namespace gpu { |
| 16 namespace gles2 { |
| 17 class GLES2Interface; |
| 18 } |
| 19 } |
| 20 |
| 21 class ColorLUTCache { |
| 22 public: |
| 23 explicit ColorLUTCache(gpu::gles2::GLES2Interface* gl); |
| 24 ~ColorLUTCache(); |
| 25 |
| 26 unsigned int GetLUT(const media::VideoColorSpace& from, |
| 27 const gfx::ColorSpace& to, |
| 28 int lut_samples); |
| 29 |
| 30 // End of frame, assume all LUTs handed out are no longer used. |
| 31 void Swap(); |
| 32 |
| 33 private: |
| 34 unsigned int MakeLUT(const media::VideoColorSpace& from, |
| 35 const gfx::ColorSpace& to, |
| 36 int lut_samples); |
| 37 typedef std::pair<media::VideoColorSpace, std::pair<gfx::ColorSpace, size_t>> |
| 38 CacheKey; |
| 39 |
| 40 base::MRUCache<CacheKey, std::pair<unsigned int, size_t>> lut_cache_; |
| 41 uint32_t current_frame_; |
| 42 gpu::gles2::GLES2Interface* gl_; |
| 43 DISALLOW_COPY_AND_ASSIGN(ColorLUTCache); |
| 44 }; |
| 45 |
| 46 #endif // CC_OUTPUT_COLOR_LUT_CACHE_H_ |
OLD | NEW |