Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-09-15 14:05:07 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-09-15 14:05:07 +0400
commita73dd3476e7d180d3320afc04d218ce22f2f3bfc (patch)
treea540f5657bc9e8692eb0d3417de71393bad6bece /source/blender/compositor
parentb93da9b01e163158a830872d29f8bd874f63d54d (diff)
Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces only with OpenColorIO-based pipeline. This introduces two configurable color spaces: - Input color space for images and movie clips. This space is used to convert images/movies from color space in which file is saved to Blender's linear space (for float images, byte images are not internally converted, only input space is stored for such images and used later). This setting could be found in image/clip data block settings. - Display color space which defines space in which particular display is working. This settings could be found in scene's Color Management panel. When render result is being displayed on the screen, apart from converting image to display space, some additional conversions could happen. This conversions are: - View, which defines tone curve applying before display transformation. These are different ways to view the image on the same display device. For example it could be used to emulate film view on sRGB display. - Exposure affects on image exposure before tone map is applied. - Gamma is post-display gamma correction, could be used to match particular display gamma. - RGB curves are user-defined curves which are applying before display transformation, could be used for different purposes. All this settings by default are only applying on render result and does not affect on other images. If some particular image needs to be affected by this transformation, "View as Render" setting of image data block should be set to truth. Movie clips are always affected by all display transformations. This commit also introduces configurable color space in which sequencer is working. This setting could be found in scene's Color Management panel and it should be used if such stuff as grading needs to be done in color space different from sRGB (i.e. when Film view on sRGB display is use, using VD16 space as sequencer's internal space would make grading working in space which is close to the space using for display). Some technical notes: - Image buffer's float buffer is now always in linear space, even if it was created from 16bit byte images. - Space of byte buffer is stored in image buffer's rect_colorspace property. - Profile of image buffer was removed since it's not longer meaningful. - OpenGL and GLSL is supposed to always work in sRGB space. It is possible to support other spaces, but it's quite large project which isn't so much important. - Legacy Color Management option disabled is emulated by using None display. It could have some regressions, but there's no clear way to avoid them. - If OpenColorIO is disabled on build time, it should make blender behaving in the same way as previous release with color management enabled. More details could be found at this page (more details would be added soon): http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management -- Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO integration and to Brecht van Lommel for some further development and code/ usecase review!
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/COM_compositor.h15
-rw-r--r--source/blender/compositor/intern/COM_CompositorContext.cpp12
-rw-r--r--source/blender/compositor/intern/COM_CompositorContext.h26
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.cpp6
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.h4
-rw-r--r--source/blender/compositor/intern/COM_Node.cpp8
-rw-r--r--source/blender/compositor/intern/COM_Node.h4
-rw-r--r--source/blender/compositor/intern/COM_compositor.cpp8
-rw-r--r--source/blender/compositor/nodes/COM_BlurNode.cpp8
-rw-r--r--source/blender/compositor/nodes/COM_BokehImageNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_ChannelMatteNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_ChromaMatteNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_ColorMatteNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_CompositorNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_DespeckleNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_DilateErodeNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_DistanceMatteNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_FilterNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_ImageNode.cpp4
-rw-r--r--source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_MixNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_MovieClipNode.cpp22
-rw-r--r--source/blender/compositor/nodes/COM_OutputFileNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_RenderLayersNode.cpp62
-rw-r--r--source/blender/compositor/nodes/COM_RenderLayersNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_SplitViewerNode.cpp7
-rw-r--r--source/blender/compositor/nodes/COM_TextureNode.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_ViewerNode.cpp7
-rw-r--r--source/blender/compositor/operations/COM_ImageOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.h7
-rw-r--r--source/blender/compositor/operations/COM_PreviewOperation.cpp13
-rw-r--r--source/blender/compositor/operations/COM_PreviewOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_SplitViewerOperation.cpp18
-rw-r--r--source/blender/compositor/operations/COM_ViewerBaseOperation.cpp31
-rw-r--r--source/blender/compositor/operations/COM_ViewerBaseOperation.h13
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.cpp16
38 files changed, 188 insertions, 156 deletions
diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h
index f35bf71392c..a64583b68ff 100644
--- a/source/blender/compositor/COM_compositor.h
+++ b/source/blender/compositor/COM_compositor.h
@@ -24,6 +24,7 @@
extern "C" {
#endif
+#include "DNA_color_types.h"
#include "DNA_node_types.h"
/**
@@ -299,8 +300,20 @@ extern "C" {
*
* - output nodes can have different priorities in the WorkScheduler.
* This is implemented in the COM_execute function.
+ *
+ * @param viewSettings
+ * reference to view settings used for color management
+ *
+ * @param displaySettings
+ * reference to display settings used for color management
+ *
+ * OCIO_TODO: this options only used in rare cases, namely in output file node,
+ * so probably this settings could be passed in a nicer way.
+ * should be checked further, probably it'll be also needed for preview
+ * generation in display space
*/
-void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering);
+void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering,
+ const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings);
/**
* @brief Deinitialize the compositor caches and allocated memory.
diff --git a/source/blender/compositor/intern/COM_CompositorContext.cpp b/source/blender/compositor/intern/COM_CompositorContext.cpp
index fbdb4cd6b28..e1cc25d028a 100644
--- a/source/blender/compositor/intern/COM_CompositorContext.cpp
+++ b/source/blender/compositor/intern/COM_CompositorContext.cpp
@@ -31,6 +31,8 @@ CompositorContext::CompositorContext()
this->m_hasActiveOpenCLDevices = false;
this->m_activegNode = NULL;
this->m_fastCalculation = false;
+ this->m_viewSettings = NULL;
+ this->m_displaySettings = NULL;
}
const int CompositorContext::getFramenumber() const
@@ -42,13 +44,3 @@ const int CompositorContext::getFramenumber() const
return -1; /* this should never happen */
}
}
-
-const int CompositorContext::isColorManaged() const
-{
- if (this->m_rd) {
- return this->m_rd->color_mgt_flag & R_COLOR_MANAGEMENT;
- }
- else {
- return 0; /* this should never happen */
- }
-}
diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h
index 2f6abf39985..2f5e8c0648d 100644
--- a/source/blender/compositor/intern/COM_CompositorContext.h
+++ b/source/blender/compositor/intern/COM_CompositorContext.h
@@ -27,6 +27,7 @@
#include "BKE_text.h"
#include <string>
#include "DNA_node_types.h"
+#include "DNA_color_types.h"
#include "BLI_rect.h"
#include "DNA_scene_types.h"
#include "COM_defines.h"
@@ -79,6 +80,9 @@ private:
*/
bool m_fastCalculation;
+ /* @brief color management settings */
+ const ColorManagedViewSettings *m_viewSettings;
+ const ColorManagedDisplaySettings *m_displaySettings;
public:
/**
* @brief constructor initializes the context with default values.
@@ -126,6 +130,26 @@ public:
const RenderData *getRenderData() const { return this->m_rd; }
/**
+ * @brief set view settings of color color management
+ */
+ void setViewSettings(const ColorManagedViewSettings *viewSettings) { this->m_viewSettings = viewSettings; }
+
+ /**
+ * @brief get view settings of color color management
+ */
+ const ColorManagedViewSettings *getViewSettings() const { return this->m_viewSettings; }
+
+ /**
+ * @brief set display settings of color color management
+ */
+ void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings) { this->m_displaySettings = displaySettings; }
+
+ /**
+ * @brief get display settings of color color management
+ */
+ const ColorManagedDisplaySettings *getDisplaySettings() const { return this->m_displaySettings; }
+
+ /**
* @brief set the quality
*/
void setQuality(CompositorQuality quality) { this->m_quality = quality; }
@@ -152,8 +176,6 @@ public:
int getChunksize() { return this->getbNodeTree()->chunksize; }
- const int isColorManaged() const;
-
void setFastCalculation(bool fastCalculation) {this->m_fastCalculation = fastCalculation;}
bool isFastCalculation() {return this->m_fastCalculation;}
};
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index 801505e9d39..a13717c9d86 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -44,7 +44,8 @@
#include "MEM_guardedalloc.h"
#endif
-ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation)
+ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation,
+ const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings)
{
this->m_context.setbNodeTree(editingtree);
this->m_context.setFastCalculation(fastcalculation);
@@ -69,6 +70,9 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool re
ExecutionSystemHelper::addbNodeTree(*this, 0, editingtree, NULL);
this->m_context.setRenderData(rd);
+ this->m_context.setViewSettings(viewSettings);
+ this->m_context.setDisplaySettings(displaySettings);
+
this->convertToOperations();
this->groupOperations(); /* group operations in ExecutionGroups */
unsigned int index;
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h
index 39e7bc80279..56a60bf7a03 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.h
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.h
@@ -25,6 +25,7 @@ class ExecutionGroup;
#ifndef _COM_ExecutionSystem_h
#define _COM_ExecutionSystem_h
+#include "DNA_color_types.h"
#include "DNA_node_types.h"
#include <vector>
#include "COM_Node.h"
@@ -156,7 +157,8 @@ public:
* @param editingtree [bNodeTree *]
* @param rendering [true false]
*/
- ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation);
+ ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation,
+ const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings);
/**
* Destructor
diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp
index 50393d14f35..5922b0e6b08 100644
--- a/source/blender/compositor/intern/COM_Node.cpp
+++ b/source/blender/compositor/intern/COM_Node.cpp
@@ -75,12 +75,12 @@ void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket
graph->addOperation(operation);
}
-void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket)
+void Node::addPreviewOperation(ExecutionSystem *system, CompositorContext *context, OutputSocket *outputSocket)
{
if (this->isInActiveGroup()) {
if (!(this->getbNode()->flag & NODE_HIDDEN)) { // do not calculate previews of hidden nodes.
if (this->getbNode()->flag & NODE_PREVIEW) {
- PreviewOperation *operation = new PreviewOperation();
+ PreviewOperation *operation = new PreviewOperation(context->getViewSettings(), context->getDisplaySettings());
system->addOperation(operation);
operation->setbNode(this->getbNode());
operation->setbNodeTree(system->getContext().getbNodeTree());
@@ -90,11 +90,11 @@ void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSock
}
}
-void Node::addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket)
+void Node::addPreviewOperation(ExecutionSystem *system, CompositorContext *context, InputSocket *inputSocket)
{
if (inputSocket->isConnected() && this->isInActiveGroup()) {
OutputSocket *outputsocket = inputSocket->getConnection()->getFromSocket();
- this->addPreviewOperation(system, outputsocket);
+ this->addPreviewOperation(system, context, outputsocket);
}
}
diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h
index 7ce40e3cb34..bfccd069ad1 100644
--- a/source/blender/compositor/intern/COM_Node.h
+++ b/source/blender/compositor/intern/COM_Node.h
@@ -135,8 +135,8 @@ public:
*/
OutputSocket *findOutputSocketBybNodeSocket(bNodeSocket *socket);
protected:
- void addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket);
- void addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket);
+ void addPreviewOperation(ExecutionSystem *system, CompositorContext *context, InputSocket *inputSocket);
+ void addPreviewOperation(ExecutionSystem *system, CompositorContext *context, OutputSocket *outputSocket);
bNodeSocket *getEditorInputSocket(int editorNodeInputSocketIndex);
bNodeSocket *getEditorOutputSocket(int editorNodeOutputSocketIndex);
diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp
index cb9166c929d..5cfcd83f8f1 100644
--- a/source/blender/compositor/intern/COM_compositor.cpp
+++ b/source/blender/compositor/intern/COM_compositor.cpp
@@ -42,7 +42,9 @@ void intern_freeCompositorCaches()
deintializeDistortionCache();
}
-void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
+void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering,
+ const ColorManagedViewSettings *viewSettings,
+ const ColorManagedDisplaySettings *displaySettings)
{
/* initialize mutex, TODO this mutex init is actually not thread safe and
* should be done somewhere as part of blender startup, all the other
@@ -71,7 +73,7 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
bool twopass = (editingtree->flag & NTREE_TWO_PASS) > 0 && !rendering;
/* initialize execution system */
if (twopass) {
- ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, twopass);
+ ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, twopass, viewSettings, displaySettings);
system->execute();
delete system;
@@ -84,7 +86,7 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering)
}
- ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, false);
+ ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, false, viewSettings, displaySettings);
system->execute();
delete system;
diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp
index e39ef2b3f23..4f120ea5a6e 100644
--- a/source/blender/compositor/nodes/COM_BlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BlurNode.cpp
@@ -57,7 +57,7 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
this->getInputSocket(1)->relinkConnections(operationfgb->getInputSocket(1), 1, graph);
this->getOutputSocket(0)->relinkConnections(operationfgb->getOutputSocket(0));
graph->addOperation(operationfgb);
- addPreviewOperation(graph, operationfgb->getOutputSocket());
+ addPreviewOperation(graph, context, operationfgb->getOutputSocket());
}
else if (editorNode->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) {
MathAddOperation *clamp = new MathAddOperation();
@@ -97,7 +97,7 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
addLink(graph, operationy->getOutputSocket(), operation->getInputSocket(1));
graph->addOperation(operation);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
- addPreviewOperation(graph, operation->getOutputSocket());
+ addPreviewOperation(graph, context, operation->getOutputSocket());
}
else if (!data->bokeh) {
GaussianXBlurOperation *operationx = new GaussianXBlurOperation();
@@ -115,7 +115,7 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
graph->addOperation(operationy);
addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
addLink(graph, operationx->getInputSocket(1)->getConnection()->getFromSocket(), operationy->getInputSocket(1));
- addPreviewOperation(graph, operationy->getOutputSocket());
+ addPreviewOperation(graph, context, operationy->getOutputSocket());
if (!connectedSizeSocket) {
operationx->setSize(size);
@@ -131,7 +131,7 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
operation->setQuality(quality);
graph->addOperation(operation);
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
- addPreviewOperation(graph, operation->getOutputSocket());
+ addPreviewOperation(graph, context, operation->getOutputSocket());
if (!connectedSizeSocket) {
operation->setSize(size);
diff --git a/source/blender/compositor/nodes/COM_BokehImageNode.cpp b/source/blender/compositor/nodes/COM_BokehImageNode.cpp
index f6abbbb9a9a..a89ed9e0c64 100644
--- a/source/blender/compositor/nodes/COM_BokehImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_BokehImageNode.cpp
@@ -35,5 +35,5 @@ void BokehImageNode::convertToOperations(ExecutionSystem *graph, CompositorConte
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
graph->addOperation(operation);
operation->setData((NodeBokehImage *)this->getbNode()->storage);
- addPreviewOperation(graph, operation->getOutputSocket(0));
+ addPreviewOperation(graph, context, operation->getOutputSocket(0));
}
diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
index eab921863e9..c1511ee611b 100644
--- a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
@@ -84,7 +84,7 @@ void ChannelMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCon
graph->addOperation(operationAlpha);
addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
- addPreviewOperation(graph, operationAlpha->getOutputSocket());
+ addPreviewOperation(graph, context, operationAlpha->getOutputSocket());
if (outputSocketImage->isConnected()) {
outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
index 0fb09157351..4c4b77ba6cc 100644
--- a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
@@ -65,7 +65,7 @@ void ChromaMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCont
addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
graph->addOperation(operationAlpha);
- addPreviewOperation(graph, operationAlpha->getOutputSocket());
+ addPreviewOperation(graph, context, operationAlpha->getOutputSocket());
if (outputSocketImage->isConnected()) {
outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
diff --git a/source/blender/compositor/nodes/COM_ColorMatteNode.cpp b/source/blender/compositor/nodes/COM_ColorMatteNode.cpp
index 38ab6ba8da2..54e6762961b 100644
--- a/source/blender/compositor/nodes/COM_ColorMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_ColorMatteNode.cpp
@@ -62,7 +62,7 @@ void ColorMatteNode::convertToOperations(ExecutionSystem *graph, CompositorConte
addLink(graph, operationRGBToHSV_Image->getInputSocket(0)->getConnection()->getFromSocket(), operationAlpha->getInputSocket(0));
addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
graph->addOperation(operationAlpha);
- addPreviewOperation(graph, operationAlpha->getOutputSocket());
+ addPreviewOperation(graph, context, operationAlpha->getOutputSocket());
if (outputSocketImage->isConnected()) {
outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cpp b/source/blender/compositor/nodes/COM_CompositorNode.cpp
index d0d66a81c77..e3313750e66 100644
--- a/source/blender/compositor/nodes/COM_CompositorNode.cpp
+++ b/source/blender/compositor/nodes/COM_CompositorNode.cpp
@@ -45,5 +45,5 @@ void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorConte
alphaSocket->relinkConnections(compositorOperation->getInputSocket(1));
depthSocket->relinkConnections(compositorOperation->getInputSocket(2));
graph->addOperation(compositorOperation);
- addPreviewOperation(graph, compositorOperation->getInputSocket(0));
+ addPreviewOperation(graph, context, compositorOperation->getInputSocket(0));
}
diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.cpp b/source/blender/compositor/nodes/COM_DespeckleNode.cpp
index 603ddcd1389..a97714c870e 100644
--- a/source/blender/compositor/nodes/COM_DespeckleNode.cpp
+++ b/source/blender/compositor/nodes/COM_DespeckleNode.cpp
@@ -44,7 +44,7 @@ void DespeckleNode::convertToOperations(ExecutionSystem *graph, CompositorContex
inputImageSocket->relinkConnections(operation->getInputSocket(0), 1, graph);
inputSocket->relinkConnections(operation->getInputSocket(1), 0, graph);
outputSocket->relinkConnections(operation->getOutputSocket());
- addPreviewOperation(graph, operation->getOutputSocket(0));
+ addPreviewOperation(graph, context, operation->getOutputSocket(0));
graph->addOperation(operation);
}
diff --git a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
index 6dca049a6ae..b5ad07be319 100644
--- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
@@ -51,5 +51,5 @@ void DifferenceMatteNode::convertToOperations(ExecutionSystem *graph, Compositor
addLink(graph, operationSet->getOutputSocket(), operation->getInputSocket(1));
outputSocketImage->relinkConnections(operation->getOutputSocket());
graph->addOperation(operation);
- addPreviewOperation(graph, operation->getOutputSocket());
+ addPreviewOperation(graph, context, operation->getOutputSocket());
}
diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
index cecc3bf6e86..5bd2f78d8a6 100644
--- a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
+++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
@@ -106,7 +106,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
graph->addOperation(operationy);
addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
// addLink(graph, operationx->getInputSocket(1)->getConnection()->getFromSocket(), operationy->getInputSocket(1)); // no size input yet
- addPreviewOperation(graph, operationy->getOutputSocket());
+ addPreviewOperation(graph, context, operationy->getOutputSocket());
/* TODO? */
/* see gaussian blue node for original usage */
diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
index 87e7b9d0788..782c897f6fb 100644
--- a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
@@ -77,7 +77,7 @@ void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCo
addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
graph->addOperation(operationAlpha);
- addPreviewOperation(graph, operationAlpha->getOutputSocket());
+ addPreviewOperation(graph, context, operationAlpha->getOutputSocket());
if (outputSocketImage->isConnected()) {
outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
diff --git a/source/blender/compositor/nodes/COM_FilterNode.cpp b/source/blender/compositor/nodes/COM_FilterNode.cpp
index 021ec6c2508..990cdb480ca 100644
--- a/source/blender/compositor/nodes/COM_FilterNode.cpp
+++ b/source/blender/compositor/nodes/COM_FilterNode.cpp
@@ -77,7 +77,7 @@ void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
inputImageSocket->relinkConnections(operation->getInputSocket(0), 1, graph);
inputSocket->relinkConnections(operation->getInputSocket(1), 0, graph);
outputSocket->relinkConnections(operation->getOutputSocket());
- addPreviewOperation(graph, operation->getOutputSocket(0));
+ addPreviewOperation(graph, context, operation->getOutputSocket(0));
graph->addOperation(operation);
}
diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp
index 2d13ffb82b6..4ebd28d710a 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_ImageNode.cpp
@@ -111,7 +111,7 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
break;
}
if (index == 0 && operation) {
- addPreviewOperation(graph, operation->getOutputSocket());
+ addPreviewOperation(graph, context, operation->getOutputSocket());
}
}
}
@@ -134,7 +134,7 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
operation->setImageUser(imageuser);
operation->setFramenumber(framenumber);
graph->addOperation(operation);
- addPreviewOperation(graph, operation->getOutputSocket());
+ addPreviewOperation(graph, context, operation->getOutputSocket());
}
if (numberOfOutputs > 1) {
diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
index be949e2cacb..4656e00b006 100644
--- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
@@ -55,7 +55,7 @@ void LuminanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorC
addLink(graph, rgbToYUV->getInputSocket(0)->getConnection()->getFromSocket(), operation->getInputSocket(0));
addLink(graph, operationSet->getOutputSocket(), operation->getInputSocket(1));
graph->addOperation(operation);
- addPreviewOperation(graph, operation->getOutputSocket());
+ addPreviewOperation(graph, context, operation->getOutputSocket());
if (outputSocketImage->isConnected()) {
outputSocketImage->relinkConnections(operation->getOutputSocket());
diff --git a/source/blender/compositor/nodes/COM_MixNode.cpp b/source/blender/compositor/nodes/COM_MixNode.cpp
index 7aeaaf56c98..ab4e464327d 100644
--- a/source/blender/compositor/nodes/COM_MixNode.cpp
+++ b/source/blender/compositor/nodes/COM_MixNode.cpp
@@ -128,7 +128,7 @@ void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext *con
color1Socket->relinkConnections(convertProg->getInputSocket(1), 1, graph);
color2Socket->relinkConnections(convertProg->getInputSocket(2), 2, graph);
outputSocket->relinkConnections(convertProg->getOutputSocket(0));
- addPreviewOperation(graph, convertProg->getOutputSocket(0));
+ addPreviewOperation(graph, context, convertProg->getOutputSocket(0));
convertProg->getInputSocket(2)->setResizeMode(color2Socket->getResizeMode());
diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.cpp b/source/blender/compositor/nodes/COM_MovieClipNode.cpp
index 6d5b9bba8aa..5d5e68fba37 100644
--- a/source/blender/compositor/nodes/COM_MovieClipNode.cpp
+++ b/source/blender/compositor/nodes/COM_MovieClipNode.cpp
@@ -62,25 +62,9 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
// always connect the output image
MovieClipOperation *operation = new MovieClipOperation();
- if (ibuf && context->isColorManaged() && ibuf->profile == IB_PROFILE_NONE) {
- ConvertColorProfileOperation *converter = new ConvertColorProfileOperation();
- converter->setFromColorProfile(IB_PROFILE_LINEAR_RGB);
- converter->setToColorProfile(IB_PROFILE_SRGB);
- addLink(graph, operation->getOutputSocket(), converter->getInputSocket(0));
- addPreviewOperation(graph, converter->getOutputSocket());
- if (outputMovieClip->isConnected()) {
- outputMovieClip->relinkConnections(converter->getOutputSocket());
- }
- graph->addOperation(converter);
- if (ibuf) {
- converter->setPredivided(ibuf->flags & IB_cm_predivide);
- }
- }
- else {
- addPreviewOperation(graph, operation->getOutputSocket());
- if (outputMovieClip->isConnected()) {
- outputMovieClip->relinkConnections(operation->getOutputSocket());
- }
+ addPreviewOperation(graph, context, operation->getOutputSocket());
+ if (outputMovieClip->isConnected()) {
+ outputMovieClip->relinkConnections(operation->getOutputSocket());
}
operation->setMovieClip(movieClip);
diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cpp b/source/blender/compositor/nodes/COM_OutputFileNode.cpp
index b8cee29fee6..921b9e63a73 100644
--- a/source/blender/compositor/nodes/COM_OutputFileNode.cpp
+++ b/source/blender/compositor/nodes/COM_OutputFileNode.cpp
@@ -62,7 +62,7 @@ void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorConte
input->relinkConnections(outputOperation->getInputSocket(i));
}
}
- if (hasConnections) addPreviewOperation(graph, outputOperation->getInputSocket(0));
+ if (hasConnections) addPreviewOperation(graph, context, outputOperation->getInputSocket(0));
graph->addOperation(outputOperation);
}
@@ -80,11 +80,12 @@ void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorConte
BLI_join_dirfile(path, FILE_MAX, storage->base_path, sockdata->path);
OutputSingleLayerOperation *outputOperation = new OutputSingleLayerOperation(
- context->getRenderData(), context->getbNodeTree(), input->getDataType(), format, path);
+ context->getRenderData(), context->getbNodeTree(), input->getDataType(), format, path,
+ context->getViewSettings(), context->getDisplaySettings());
input->relinkConnections(outputOperation->getInputSocket(0));
graph->addOperation(outputOperation);
if (!previewAdded) {
- addPreviewOperation(graph, outputOperation->getInputSocket(0));
+ addPreviewOperation(graph, context, outputOperation->getInputSocket(0));
previewAdded = true;
}
}
diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
index dfb46af841c..b57e99754d6 100644
--- a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
+++ b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp
@@ -52,7 +52,7 @@ RenderLayersNode::RenderLayersNode(bNode *editorNode) : Node(editorNode)
/* pass */
}
-void RenderLayersNode::testSocketConnection(ExecutionSystem *system, int outputSocketNumber, RenderLayersBaseProg *operation)
+void RenderLayersNode::testSocketConnection(ExecutionSystem *system, CompositorContext *context, int outputSocketNumber, RenderLayersBaseProg *operation)
{
OutputSocket *outputSocket = this->getOutputSocket(outputSocketNumber);
Scene *scene = (Scene *)this->getbNode()->id;
@@ -64,7 +64,7 @@ void RenderLayersNode::testSocketConnection(ExecutionSystem *system, int outputS
outputSocket->relinkConnections(operation->getOutputSocket());
system->addOperation(operation);
if (outputSocketNumber == 0) { // only do for image socket if connected
- addPreviewOperation(system, operation->getOutputSocket());
+ addPreviewOperation(system, context, operation->getOutputSocket());
}
}
else {
@@ -72,7 +72,7 @@ void RenderLayersNode::testSocketConnection(ExecutionSystem *system, int outputS
system->addOperation(operation);
operation->setScene(scene);
operation->setLayerId(layerId);
- addPreviewOperation(system, operation->getOutputSocket());
+ addPreviewOperation(system, context, operation->getOutputSocket());
}
else {
delete operation;
@@ -82,34 +82,34 @@ void RenderLayersNode::testSocketConnection(ExecutionSystem *system, int outputS
void RenderLayersNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
- testSocketConnection(graph, 0, new RenderLayersColorProg());
- testSocketConnection(graph, 1, new RenderLayersAlphaProg());
- testSocketConnection(graph, 2, new RenderLayersDepthProg());
- testSocketConnection(graph, 3, new RenderLayersNormalOperation());
- testSocketConnection(graph, 4, new RenderLayersUVOperation());
- testSocketConnection(graph, 5, new RenderLayersSpeedOperation());
- testSocketConnection(graph, 6, new RenderLayersColorOperation());
- testSocketConnection(graph, 7, new RenderLayersDiffuseOperation());
- testSocketConnection(graph, 8, new RenderLayersSpecularOperation());
- testSocketConnection(graph, 9, new RenderLayersShadowOperation());
- testSocketConnection(graph, 10, new RenderLayersAOOperation());
- testSocketConnection(graph, 11, new RenderLayersReflectionOperation());
- testSocketConnection(graph, 12, new RenderLayersRefractionOperation());
- testSocketConnection(graph, 13, new RenderLayersIndirectOperation());
- testSocketConnection(graph, 14, new RenderLayersObjectIndexOperation());
- testSocketConnection(graph, 15, new RenderLayersMaterialIndexOperation());
- testSocketConnection(graph, 16, new RenderLayersMistOperation());
- testSocketConnection(graph, 17, new RenderLayersEmitOperation());
- testSocketConnection(graph, 18, new RenderLayersEnvironmentOperation());
+ testSocketConnection(graph, context, 0, new RenderLayersColorProg());
+ testSocketConnection(graph, context, 1, new RenderLayersAlphaProg());
+ testSocketConnection(graph, context, 2, new RenderLayersDepthProg());
+ testSocketConnection(graph, context, 3, new RenderLayersNormalOperation());
+ testSocketConnection(graph, context, 4, new RenderLayersUVOperation());
+ testSocketConnection(graph, context, 5, new RenderLayersSpeedOperation());
+ testSocketConnection(graph, context, 6, new RenderLayersColorOperation());
+ testSocketConnection(graph, context, 7, new RenderLayersDiffuseOperation());
+ testSocketConnection(graph, context, 8, new RenderLayersSpecularOperation());
+ testSocketConnection(graph, context, 9, new RenderLayersShadowOperation());
+ testSocketConnection(graph, context, 10, new RenderLayersAOOperation());
+ testSocketConnection(graph, context, 11, new RenderLayersReflectionOperation());
+ testSocketConnection(graph, context, 12, new RenderLayersRefractionOperation());
+ testSocketConnection(graph, context, 13, new RenderLayersIndirectOperation());
+ testSocketConnection(graph, context, 14, new RenderLayersObjectIndexOperation());
+ testSocketConnection(graph, context, 15, new RenderLayersMaterialIndexOperation());
+ testSocketConnection(graph, context, 16, new RenderLayersMistOperation());
+ testSocketConnection(graph, context, 17, new RenderLayersEmitOperation());
+ testSocketConnection(graph, context, 18, new RenderLayersEnvironmentOperation());
// cycles passes
- testSocketConnection(graph, 19, new RenderLayersCyclesOperation(SCE_PASS_DIFFUSE_DIRECT));
- testSocketConnection(graph, 20, new RenderLayersCyclesOperation(SCE_PASS_DIFFUSE_INDIRECT));
- testSocketConnection(graph, 21, new RenderLayersCyclesOperation(SCE_PASS_DIFFUSE_COLOR));
- testSocketConnection(graph, 22, new RenderLayersCyclesOperation(SCE_PASS_GLOSSY_DIRECT));
- testSocketConnection(graph, 23, new RenderLayersCyclesOperation(SCE_PASS_GLOSSY_INDIRECT));
- testSocketConnection(graph, 24, new RenderLayersCyclesOperation(SCE_PASS_GLOSSY_COLOR));
- testSocketConnection(graph, 25, new RenderLayersCyclesOperation(SCE_PASS_TRANSM_DIRECT));
- testSocketConnection(graph, 26, new RenderLayersCyclesOperation(SCE_PASS_TRANSM_INDIRECT));
- testSocketConnection(graph, 27, new RenderLayersCyclesOperation(SCE_PASS_TRANSM_COLOR));
+ testSocketConnection(graph, context, 19, new RenderLayersCyclesOperation(SCE_PASS_DIFFUSE_DIRECT));
+ testSocketConnection(graph, context, 20, new RenderLayersCyclesOperation(SCE_PASS_DIFFUSE_INDIRECT));
+ testSocketConnection(graph, context, 21, new RenderLayersCyclesOperation(SCE_PASS_DIFFUSE_COLOR));
+ testSocketConnection(graph, context, 22, new RenderLayersCyclesOperation(SCE_PASS_GLOSSY_DIRECT));
+ testSocketConnection(graph, context, 23, new RenderLayersCyclesOperation(SCE_PASS_GLOSSY_INDIRECT));
+ testSocketConnection(graph, context, 24, new RenderLayersCyclesOperation(SCE_PASS_GLOSSY_COLOR));
+ testSocketConnection(graph, context, 25, new RenderLayersCyclesOperation(SCE_PASS_TRANSM_DIRECT));
+ testSocketConnection(graph, context, 26, new RenderLayersCyclesOperation(SCE_PASS_TRANSM_INDIRECT));
+ testSocketConnection(graph, context, 27, new RenderLayersCyclesOperation(SCE_PASS_TRANSM_COLOR));
}
diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.h b/source/blender/compositor/nodes/COM_RenderLayersNode.h
index 32672c8ba2d..9bd74624b0c 100644
--- a/source/blender/compositor/nodes/COM_RenderLayersNode.h
+++ b/source/blender/compositor/nodes/COM_RenderLayersNode.h
@@ -33,5 +33,5 @@ public:
RenderLayersNode(bNode *editorNode);
void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
private:
- void testSocketConnection(ExecutionSystem *graph, int outputSocketNumber, RenderLayersBaseProg *operation);
+ void testSocketConnection(ExecutionSystem *graph, CompositorContext *context, int outputSocketNumber, RenderLayersBaseProg *operation);
};
diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.cpp b/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
index 388466cee3c..37b888becca 100644
--- a/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_SplitViewerNode.cpp
@@ -39,13 +39,14 @@ void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorCont
ImageUser *imageUser = (ImageUser *) this->getbNode()->storage;
if (image1Socket->isConnected() && image2Socket->isConnected()) {
SplitViewerOperation *splitViewerOperation = new SplitViewerOperation();
- splitViewerOperation->setColorManagement(context->getRenderData()->color_mgt_flag & R_COLOR_MANAGEMENT);
- splitViewerOperation->setColorPredivide(context->getRenderData()->color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
splitViewerOperation->setImage(image);
splitViewerOperation->setImageUser(imageUser);
splitViewerOperation->setActive((this->getbNode()->flag & NODE_DO_OUTPUT) && this->isInActiveGroup());
splitViewerOperation->setSplitPercentage(this->getbNode()->custom1);
+ splitViewerOperation->setViewSettings(context->getViewSettings());
+ splitViewerOperation->setDisplaySettings(context->getDisplaySettings());
+
/* defaults - the viewer node has these options but not exposed for split view
* we could use the split to define an area of interest on one axis at least */
splitViewerOperation->setChunkOrder(COM_ORDER_OF_CHUNKS_DEFAULT);
@@ -55,7 +56,7 @@ void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorCont
splitViewerOperation->setXSplit(!this->getbNode()->custom2);
image1Socket->relinkConnections(splitViewerOperation->getInputSocket(0), 0, graph);
image2Socket->relinkConnections(splitViewerOperation->getInputSocket(1), 1, graph);
- addPreviewOperation(graph, splitViewerOperation->getInputSocket(0));
+ addPreviewOperation(graph, context, splitViewerOperation->getInputSocket(0));
graph->addOperation(splitViewerOperation);
}
}
diff --git a/source/blender/compositor/nodes/COM_TextureNode.cpp b/source/blender/compositor/nodes/COM_TextureNode.cpp
index b035e0a392c..5b386a504e4 100644
--- a/source/blender/compositor/nodes/COM_TextureNode.cpp
+++ b/source/blender/compositor/nodes/COM_TextureNode.cpp
@@ -40,7 +40,7 @@ void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext
operation->setTexture(texture);
operation->setRenderData(context->getRenderData());
system->addOperation(operation);
- addPreviewOperation(system, operation->getOutputSocket());
+ addPreviewOperation(system, context, operation->getOutputSocket());
if (this->getOutputSocket(0)->isConnected()) {
TextureAlphaOperation *alphaOperation = new TextureAlphaOperation();
diff --git a/source/blender/compositor/nodes/COM_ViewerNode.cpp b/source/blender/compositor/nodes/COM_ViewerNode.cpp
index 88ce0ff2016..d67e9e274b0 100644
--- a/source/blender/compositor/nodes/COM_ViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_ViewerNode.cpp
@@ -40,8 +40,6 @@ void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
ImageUser *imageUser = (ImageUser *) this->getbNode()->storage;
bNode *editorNode = this->getbNode();
ViewerOperation *viewerOperation = new ViewerOperation();
- viewerOperation->setColorManagement(context->getRenderData()->color_mgt_flag & R_COLOR_MANAGEMENT);
- viewerOperation->setColorPredivide(context->getRenderData()->color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
viewerOperation->setbNodeTree(context->getbNodeTree());
viewerOperation->setImage(image);
viewerOperation->setImageUser(imageUser);
@@ -50,6 +48,9 @@ void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
viewerOperation->setCenterX(editorNode->custom3);
viewerOperation->setCenterY(editorNode->custom4);
+ viewerOperation->setViewSettings(context->getViewSettings());
+ viewerOperation->setDisplaySettings(context->getDisplaySettings());
+
viewerOperation->setResolutionInputSocketIndex(0);
if (!imageSocket->isConnected())
{
@@ -62,5 +63,5 @@ void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
alphaSocket->relinkConnections(viewerOperation->getInputSocket(1));
depthSocket->relinkConnections(viewerOperation->getInputSocket(2));
graph->addOperation(viewerOperation);
- addPreviewOperation(graph, viewerOperation->getInputSocket(0));
+ addPreviewOperation(graph, context, viewerOperation->getInputSocket(0));
}
diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp
index 4ec5643c0bb..fb3efbb67ed 100644
--- a/source/blender/compositor/operations/COM_ImageOperation.cpp
+++ b/source/blender/compositor/operations/COM_ImageOperation.cpp
@@ -33,6 +33,7 @@ extern "C" {
#include "RE_render_ext.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
+ #include "IMB_colormanagement.h"
}
BaseImageOperation::BaseImageOperation() : NodeOperation()
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
index b72875ab2f9..21ecfdb5272 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
@@ -31,9 +31,12 @@
#include "BKE_global.h"
#include "BKE_main.h"
+#include "DNA_color_types.h"
+
extern "C" {
#include "MEM_guardedalloc.h"
#include "IMB_imbuf.h"
+ #include "IMB_colormanagement.h"
#include "IMB_imbuf_types.h"
}
@@ -91,7 +94,8 @@ static void write_buffer_rect(rcti *rect, const bNodeTree *tree,
OutputSingleLayerOperation::OutputSingleLayerOperation(
- const RenderData *rd, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path)
+ const RenderData *rd, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path,
+ const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings)
{
this->m_rd = rd;
this->m_tree = tree;
@@ -104,6 +108,9 @@ OutputSingleLayerOperation::OutputSingleLayerOperation(
this->m_format = format;
BLI_strncpy(this->m_path, path, sizeof(this->m_path));
+
+ this->m_viewSettings = viewSettings;
+ this->m_displaySettings = displaySettings;
}
void OutputSingleLayerOperation::initExecution()
@@ -131,8 +138,7 @@ void OutputSingleLayerOperation::deinitExecution()
ibuf->mall |= IB_rectfloat;
ibuf->dither = this->m_rd->dither_intensity;
- if (this->m_rd->color_mgt_flag & R_COLOR_MANAGEMENT)
- ibuf->profile = IB_PROFILE_LINEAR_RGB;
+ IMB_display_buffer_to_imbuf_rect(ibuf, m_viewSettings, m_displaySettings);
BKE_makepicstring(filename, this->m_path, bmain->name, this->m_rd->cfra, this->m_format->imtype,
(this->m_rd->scemode & R_EXTENSION), true);
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h
index 532242c97ce..69d1ad48ced 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.h
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.h
@@ -28,6 +28,8 @@
#include "BLI_rect.h"
#include "BLI_path_util.h"
+#include "DNA_color_types.h"
+
#include "intern/openexr/openexr_multi.h"
/* Writes the image to a single-layer file. */
@@ -43,8 +45,11 @@ private:
DataType m_datatype;
SocketReader *m_imageInput;
+ const ColorManagedViewSettings *m_viewSettings;
+ const ColorManagedDisplaySettings *m_displaySettings;
public:
- OutputSingleLayerOperation(const RenderData *rd, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path);
+ OutputSingleLayerOperation(const RenderData *rd, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path,
+ const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings);
void executeRegion(rcti *rect, unsigned int tileNumber);
bool isOutputOperation(bool rendering) const { return true; }
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp
index aff374cdded..6e58b277f66 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.cpp
+++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp
@@ -35,16 +35,19 @@ extern "C" {
#include "MEM_guardedalloc.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
+ #include "IMB_colormanagement.h"
}
-PreviewOperation::PreviewOperation() : NodeOperation()
+PreviewOperation::PreviewOperation(const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings) : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE);
this->m_outputBuffer = NULL;
this->m_input = NULL;
this->m_divider = 1.0f;
this->m_node = NULL;
+ this->m_viewSettings = viewSettings;
+ this->m_displaySettings = displaySettings;
}
void PreviewOperation::initExecution()
@@ -82,6 +85,10 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber)
{
int offset;
float color[4];
+ struct ColormanageProcessor *cm_processor;
+
+ cm_processor = IMB_colormanagement_display_processor_new(this->m_viewSettings, this->m_displaySettings);
+
for (int y = rect->ymin; y < rect->ymax; y++) {
offset = (y * getWidth() + rect->xmin) * 4;
for (int x = rect->xmin; x < rect->xmax; x++) {
@@ -93,11 +100,13 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int tileNumber)
color[2] = 0.0f;
color[3] = 1.0f;
this->m_input->read(color, rx, ry, COM_PS_NEAREST);
- linearrgb_to_srgb_v4(color, color);
+ IMB_colormanagement_processor_apply_v4(cm_processor, color);
F4TOCHAR4(color, this->m_outputBuffer + offset);
offset += 4;
}
}
+
+ IMB_colormanagement_processor_free(cm_processor);
}
bool PreviewOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h
index ffd80ff27af..9e774d0e41b 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.h
+++ b/source/blender/compositor/operations/COM_PreviewOperation.h
@@ -24,6 +24,7 @@
#define _COM_PreviewOperation_h
#include "COM_NodeOperation.h"
#include "DNA_image_types.h"
+#include "DNA_color_types.h"
#include "BLI_rect.h"
class PreviewOperation : public NodeOperation {
@@ -37,8 +38,10 @@ protected:
SocketReader *m_input;
float m_divider;
+ const ColorManagedViewSettings *m_viewSettings;
+ const ColorManagedDisplaySettings *m_displaySettings;
public:
- PreviewOperation();
+ PreviewOperation(const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings);
bool isOutputOperation(bool rendering) const { return true; }
void initExecution();
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_SplitViewerOperation.cpp b/source/blender/compositor/operations/COM_SplitViewerOperation.cpp
index d59d1f9f10d..7325e32a863 100644
--- a/source/blender/compositor/operations/COM_SplitViewerOperation.cpp
+++ b/source/blender/compositor/operations/COM_SplitViewerOperation.cpp
@@ -62,7 +62,6 @@ void SplitViewerOperation::deinitExecution()
void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
{
float *buffer = this->m_outputBuffer;
- unsigned char *bufferDisplay = this->m_outputBufferDisplay;
if (!buffer) return;
int x1 = rect->xmin;
@@ -76,7 +75,6 @@ void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
for (y = y1; y < y2; y++) {
for (x = x1; x < x2; x++) {
bool image1;
- float srgb[4];
image1 = this->m_xSplit ? x > perc : y > perc;
if (image1) {
this->m_image1Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST);
@@ -84,21 +82,7 @@ void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
else {
this->m_image2Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST);
}
- /// @todo: linear conversion only when scene color management is selected, also check predivide.
- if (this->m_doColorManagement) {
- if (this->m_doColorPredivide) {
- linearrgb_to_srgb_predivide_v4(srgb, buffer + offset);
- }
- else {
- linearrgb_to_srgb_v4(srgb, buffer + offset);
- }
- }
- else {
- copy_v4_v4(srgb, buffer + offset);
- }
-
- rgba_float_to_uchar(bufferDisplay + offset, srgb);
-
+
offset += 4;
}
offset += (this->getWidth() - (x2 - x1)) * 4;
diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
index f443c33cd54..d9ca131721f 100644
--- a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
@@ -34,6 +34,7 @@ extern "C" {
#include "MEM_guardedalloc.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
+ #include "IMB_colormanagement.h"
}
@@ -43,10 +44,10 @@ ViewerBaseOperation::ViewerBaseOperation() : NodeOperation()
this->setImageUser(NULL);
this->m_outputBuffer = NULL;
this->m_depthBuffer = NULL;
- this->m_outputBufferDisplay = NULL;
this->m_active = false;
- this->m_doColorManagement = true;
this->m_doDepthBuffer = false;
+ this->m_viewSettings = NULL;
+ this->m_displaySettings = NULL;
}
void ViewerBaseOperation::initExecution()
@@ -60,7 +61,7 @@ void ViewerBaseOperation::initImage()
{
Image *anImage = this->m_image;
ImBuf *ibuf = BKE_image_acquire_ibuf(anImage, this->m_imageUser, &this->m_lock);
-
+
if (!ibuf) return;
BLI_lock_thread(LOCK_DRAW_IMAGE);
if (ibuf->x != (int)getWidth() || ibuf->y != (int)getHeight()) {
@@ -70,30 +71,44 @@ void ViewerBaseOperation::initImage()
IMB_freezbuffloatImBuf(ibuf);
ibuf->x = getWidth();
ibuf->y = getHeight();
- imb_addrectImBuf(ibuf);
imb_addrectfloatImBuf(ibuf);
anImage->ok = IMA_OK_LOADED;
+ ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
+
+ BLI_unlock_thread(LOCK_DRAW_IMAGE);
}
+
if (m_doDepthBuffer)
{
addzbuffloatImBuf(ibuf);
}
BLI_unlock_thread(LOCK_DRAW_IMAGE);
-
-
+
/* now we combine the input with ibuf */
this->m_outputBuffer = ibuf->rect_float;
- this->m_outputBufferDisplay = (unsigned char *)ibuf->rect;
+
+ /* needed for display buffer update
+ *
+ * no need to lock / reference the image buffer because it's seems
+ * to be the single place which changes buffers of viewer image
+ * which is this node
+ */
+ this->m_ibuf = ibuf;
+
if (m_doDepthBuffer)
{
this->m_depthBuffer = ibuf->zbuf_float;
}
-
+
BKE_image_release_ibuf(this->m_image, this->m_lock);
}
void ViewerBaseOperation:: updateImage(rcti *rect)
{
+ IMB_partial_display_buffer_update(this->m_ibuf, this->m_outputBuffer, NULL, getWidth(), 0, 0,
+ this->m_viewSettings, this->m_displaySettings,
+ rect->xmin, rect->ymin, rect->xmax, rect->ymax);
+
WM_main_add_notifier(NC_WINDOW | ND_DRAW, NULL);
}
diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.h b/source/blender/compositor/operations/COM_ViewerBaseOperation.h
index d90eb343f6c..f7d479eb3b8 100644
--- a/source/blender/compositor/operations/COM_ViewerBaseOperation.h
+++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.h
@@ -30,7 +30,6 @@ class ViewerBaseOperation : public NodeOperation {
protected:
float *m_outputBuffer;
float *m_depthBuffer;
- unsigned char *m_outputBufferDisplay;
Image *m_image;
ImageUser *m_imageUser;
void *m_lock;
@@ -38,9 +37,11 @@ protected:
float m_centerX;
float m_centerY;
OrderOfChunks m_chunkOrder;
- bool m_doColorManagement;
- bool m_doColorPredivide;
bool m_doDepthBuffer;
+ ImBuf *m_ibuf;
+
+ const ColorManagedViewSettings *m_viewSettings;
+ const ColorManagedDisplaySettings *m_displaySettings;
public:
bool isOutputOperation(bool rendering) const { return isActiveViewerOutput(); }
@@ -57,10 +58,10 @@ public:
float getCenterY() { return this->m_centerY; }
OrderOfChunks getChunkOrder() { return this->m_chunkOrder; }
const CompositorPriority getRenderPriority() const;
- void setColorManagement(bool doColorManagement) { this->m_doColorManagement = doColorManagement; }
- void setColorPredivide(bool doColorPredivide) { this->m_doColorPredivide = doColorPredivide; }
bool isViewerOperation() { return true; }
-
+
+ void setViewSettings(const ColorManagedViewSettings *viewSettings) { this->m_viewSettings = viewSettings; }
+ void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings) { this->m_displaySettings = displaySettings; }
protected:
ViewerBaseOperation();
void updateImage(rcti *rect);
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp
index b85b86bddc3..576d5da4d74 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp
@@ -72,7 +72,6 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
{
float *buffer = this->m_outputBuffer;
float *depthbuffer = this->m_depthBuffer;
- unsigned char *bufferDisplay = this->m_outputBufferDisplay;
if (!buffer) return;
const int x1 = rect->xmin;
const int y1 = rect->ymin;
@@ -82,7 +81,7 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
const int offsetadd4 = offsetadd * 4;
int offset = (y1 * this->getWidth() + x1);
int offset4 = offset * 4;
- float alpha[4], srgb[4], depth[4];
+ float alpha[4], depth[4];
int x;
int y;
bool breaked = false;
@@ -98,19 +97,6 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
this->m_depthInput->read(depth, x, y, COM_PS_NEAREST);
depthbuffer[offset] = depth[0];
}
- if (this->m_doColorManagement) {
- if (this->m_doColorPredivide) {
- linearrgb_to_srgb_predivide_v4(srgb, buffer + offset4);
- }
- else {
- linearrgb_to_srgb_v4(srgb, buffer + offset4);
- }
- }
- else {
- copy_v4_v4(srgb, buffer + offset4);
- }
-
- rgba_float_to_uchar(bufferDisplay + offset4, srgb);
offset ++;
offset4 += 4;