diff options
Diffstat (limited to 'intern/cycles/render/colorspace.cpp')
-rw-r--r-- | intern/cycles/render/colorspace.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/intern/cycles/render/colorspace.cpp b/intern/cycles/render/colorspace.cpp index 4c9e86ea278..4540793f78d 100644 --- a/intern/cycles/render/colorspace.cpp +++ b/intern/cycles/render/colorspace.cpp @@ -192,6 +192,7 @@ void ColorSpaceManager::is_builtin_colorspace(ustring colorspace, return; } + OCIO::ConstCPUProcessorRcPtr device_processor = processor->getDefaultCPUProcessor(); is_scene_linear = true; is_srgb = true; for (int i = 0; i < 256; i++) { @@ -201,10 +202,10 @@ void ColorSpaceManager::is_builtin_colorspace(ustring colorspace, float cG[3] = {0, v, 0}; float cB[3] = {0, 0, v}; float cW[3] = {v, v, v}; - processor->applyRGB(cR); - processor->applyRGB(cG); - processor->applyRGB(cB); - processor->applyRGB(cW); + device_processor->applyRGB(cR); + device_processor->applyRGB(cG); + device_processor->applyRGB(cB); + device_processor->applyRGB(cW); /* Make sure that there is no channel crosstalk. */ if (fabsf(cR[1]) > 1e-5f || fabsf(cR[2]) > 1e-5f || fabsf(cG[0]) > 1e-5f || @@ -267,6 +268,7 @@ inline void processor_apply_pixels(const OCIO::Processor *processor, T *pixels, /* TODO: implement faster version for when we know the conversion * is a simple matrix transform between linear spaces. In that case * un-premultiply is not needed. */ + OCIO::ConstCPUProcessorRcPtr device_processor = processor->getDefaultCPUProcessor(); /* Process large images in chunks to keep temporary memory requirement down. */ const size_t chunk_size = std::min((size_t)(16 * 1024 * 1024), num_pixels); @@ -289,7 +291,7 @@ inline void processor_apply_pixels(const OCIO::Processor *processor, T *pixels, } OCIO::PackedImageDesc desc((float *)float_pixels.data(), width, 1, 4); - processor->apply(desc); + device_processor->apply(desc); for (size_t i = 0; i < width; i++) { float4 value = float_pixels[i]; @@ -345,13 +347,14 @@ void ColorSpaceManager::to_scene_linear(ColorSpaceProcessor *processor_, const OCIO::Processor *processor = (const OCIO::Processor *)processor_; if (processor) { + OCIO::ConstCPUProcessorRcPtr device_processor = processor->getDefaultCPUProcessor(); if (channels == 3) { - processor->applyRGB(pixel); + device_processor->applyRGB(pixel); } else if (channels == 4) { if (pixel[3] == 1.0f || pixel[3] == 0.0f) { /* Fast path for RGBA. */ - processor->applyRGB(pixel); + device_processor->applyRGB(pixel); } else { /* Un-associate and associate alpha since color management should not @@ -363,7 +366,7 @@ void ColorSpaceManager::to_scene_linear(ColorSpaceProcessor *processor_, pixel[1] *= inv_alpha; pixel[2] *= inv_alpha; - processor->applyRGB(pixel); + device_processor->applyRGB(pixel); pixel[0] *= alpha; pixel[1] *= alpha; |