rawTherapee/rtengine/clutstore.h
Flössie 29fe23e517 Move film_simulation_strength calculation into HaldCLUT::getRGB()
- Moved `film_simulation_strength` calculation into `HaldCLUT::getRGB()`
- Removed unneeded base class `CLUT`
- Used `_MM_SHUFFLE`
2016-04-29 17:26:56 +02:00

73 lines
1.4 KiB
C++

#pragma once
#include <memory>
#include <cstdint>
#include <gtkmm.h>
#include "cache.h"
#include "alignedbuffer.h"
namespace rtengine
{
class HaldCLUT
{
public:
HaldCLUT();
HaldCLUT(const HaldCLUT& other) = delete;
HaldCLUT& operator =(const HaldCLUT& other) = delete;
~HaldCLUT();
bool load(const Glib::ustring& filename);
explicit operator bool() const;
Glib::ustring getFilename() const;
Glib::ustring getProfile() const;
void getRGB(
float strength,
std::size_t line_size,
const float* r,
const float* g,
const float* b,
float* out_rgbx
) const;
static void splitClutFilename(
const Glib::ustring& filename,
Glib::ustring& name,
Glib::ustring& extension,
Glib::ustring& profile_name
);
private:
AlignedBuffer<std::uint16_t> clut_image;
unsigned int clut_level;
float flevel_minus_one;
float flevel_minus_two;
Glib::ustring clut_filename;
Glib::ustring clut_profile;
};
class CLUTStore
{
public:
static CLUTStore& getInstance();
CLUTStore(const CLUTStore& other) = delete;
CLUTStore& operator =(const CLUTStore& other) = delete;
std::shared_ptr<HaldCLUT> getClut(const Glib::ustring& filename);
void clearCache();
private:
CLUTStore();
Cache<Glib::ustring, std::shared_ptr<HaldCLUT>> cache;
};
}