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>2015-06-19 14:00:18 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-06-19 14:34:11 +0300
commit9d796df4f6376809f14ca0dd0484f63df9c72494 (patch)
tree2a01240bcdd82af1bc6c1507f41abf5df20c95a7 /source/blender/compositor/operations
parent0d3555fe2ea39e896a4679598723add20609f0c8 (diff)
Support half float file format storage for Multilayer EXR
Quite straightforward implementation -- all the conversion magic is happening in IMB_exr_write_channels() and remained changes are only needed to pass information whether channels is to be converted to half float or not. Regular file output will use full-float for Z pass, which matches behavior of the single layer EXR files. But when saving happens with File Output node then all the passes are respecting half float settings because it's not possible to distinguish whether we're saving Z pass or not. Reviewers: juicyfruit, campbellbarton Reviewed By: campbellbarton Subscribers: maxon, effstops, fsiddi Differential Revision: https://developer.blender.org/D1353
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r--source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp19
-rw-r--r--source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h3
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.cpp26
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.h7
4 files changed, 34 insertions, 21 deletions
diff --git a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp
index e89af9cc15b..7786359c06a 100644
--- a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp
+++ b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp
@@ -74,7 +74,7 @@ void *OutputOpenExrSingleLayerMultiViewOperation::get_handle(const char *filenam
continue;
IMB_exr_add_view(exrhandle, srv->name);
- add_exr_channels(exrhandle, NULL, this->m_datatype, srv->name, width, NULL);
+ add_exr_channels(exrhandle, NULL, this->m_datatype, srv->name, width, false, NULL);
}
BLI_make_existing_file(filename);
@@ -108,7 +108,8 @@ void OutputOpenExrSingleLayerMultiViewOperation::deinitExecution()
(this->m_rd->scemode & R_EXTENSION) != 0, true, NULL);
exrhandle = this->get_handle(filename);
- add_exr_channels(exrhandle, NULL, this->m_datatype, this->m_viewName, width, this->m_outputBuffer);
+ add_exr_channels(exrhandle, NULL, this->m_datatype, this->m_viewName, width,
+ this->m_format->depth == R_IMF_CHAN_DEPTH_16, this->m_outputBuffer);
/* memory can only be freed after we write all views to the file */
this->m_outputBuffer = NULL;
@@ -130,8 +131,9 @@ void OutputOpenExrSingleLayerMultiViewOperation::deinitExecution()
/************************************ OpenEXR Multilayer Multiview *****************************************/
OutputOpenExrMultiLayerMultiViewOperation::OutputOpenExrMultiLayerMultiViewOperation(
- const RenderData *rd, const bNodeTree *tree, const char *path, char exr_codec, const char *viewName)
- : OutputOpenExrMultiLayerOperation(rd, tree, path, exr_codec, viewName)
+ const RenderData *rd, const bNodeTree *tree, const char *path,
+ char exr_codec, bool exr_half_float, const char *viewName)
+ : OutputOpenExrMultiLayerOperation(rd, tree, path, exr_codec, exr_half_float, viewName)
{
}
@@ -162,7 +164,8 @@ void *OutputOpenExrMultiLayerMultiViewOperation::get_handle(const char *filename
IMB_exr_add_view(exrhandle, srv->name);
for (unsigned int i = 0; i < this->m_layers.size(); ++i)
- add_exr_channels(exrhandle, this->m_layers[i].name, this->m_layers[i].datatype, srv->name, width, NULL);
+ add_exr_channels(exrhandle, this->m_layers[i].name, this->m_layers[i].datatype,
+ srv->name, width, this->m_exr_half_float, NULL);
}
BLI_make_existing_file(filename);
@@ -197,7 +200,8 @@ void OutputOpenExrMultiLayerMultiViewOperation::deinitExecution()
exrhandle = this->get_handle(filename);
for (unsigned int i = 0; i < this->m_layers.size(); ++i)
- add_exr_channels(exrhandle, this->m_layers[i].name, this->m_layers[i].datatype, this->m_viewName, width, this->m_layers[i].outputBuffer);
+ add_exr_channels(exrhandle, this->m_layers[i].name, this->m_layers[i].datatype, this->m_viewName,
+ width, this->m_exr_half_float, this->m_layers[i].outputBuffer);
for (unsigned int i = 0; i < this->m_layers.size(); ++i) {
/* memory can only be freed after we write all views to the file */
@@ -269,7 +273,8 @@ void OutputStereoOperation::deinitExecution()
float *buf = this->m_outputBuffer;
/* populate single EXR channel with view data */
- IMB_exr_add_channel(exrhandle, NULL, this->m_name, this->m_viewName, 1, this->m_channels * width * height, buf);
+ IMB_exr_add_channel(exrhandle, NULL, this->m_name, this->m_viewName, 1, this->m_channels * width * height, buf,
+ this->m_format->depth == R_IMF_CHAN_DEPTH_16);
this->m_imageInput = NULL;
this->m_outputBuffer = NULL;
diff --git a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h
index 25716fdb9e1..0e3cde66897 100644
--- a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h
+++ b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h
@@ -51,7 +51,8 @@ public:
class OutputOpenExrMultiLayerMultiViewOperation : public OutputOpenExrMultiLayerOperation {
private:
public:
- OutputOpenExrMultiLayerMultiViewOperation(const RenderData *rd, const bNodeTree *tree, const char *path, char exr_codec, const char *viewName);
+ OutputOpenExrMultiLayerMultiViewOperation(const RenderData *rd, const bNodeTree *tree, const char *path,
+ char exr_codec, bool exr_half_float, const char *viewName);
void *get_handle(const char *filename);
void deinitExecution();
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
index b99b0d5b875..fdf5a0b48cf 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
@@ -40,23 +40,24 @@ extern "C" {
# include "IMB_imbuf_types.h"
}
-void add_exr_channels(void *exrhandle, const char *layerName, const DataType datatype, const char *viewName, const size_t width, float *buf)
+void add_exr_channels(void *exrhandle, const char *layerName, const DataType datatype,
+ const char *viewName, const size_t width, bool use_half_float, float *buf)
{
/* create channels */
switch (datatype) {
case COM_DT_VALUE:
- IMB_exr_add_channel(exrhandle, layerName, "V", viewName, 1, width, buf ? buf : NULL);
+ IMB_exr_add_channel(exrhandle, layerName, "V", viewName, 1, width, buf ? buf : NULL, use_half_float);
break;
case COM_DT_VECTOR:
- IMB_exr_add_channel(exrhandle, layerName, "X", viewName, 3, 3 * width, buf ? buf : NULL);
- IMB_exr_add_channel(exrhandle, layerName, "Y", viewName, 3, 3 * width, buf ? buf + 1 : NULL);
- IMB_exr_add_channel(exrhandle, layerName, "Z", viewName, 3, 3 * width, buf ? buf + 2 : NULL);
+ IMB_exr_add_channel(exrhandle, layerName, "X", viewName, 3, 3 * width, buf ? buf : NULL, use_half_float);
+ IMB_exr_add_channel(exrhandle, layerName, "Y", viewName, 3, 3 * width, buf ? buf + 1 : NULL, use_half_float);
+ IMB_exr_add_channel(exrhandle, layerName, "Z", viewName, 3, 3 * width, buf ? buf + 2 : NULL, use_half_float);
break;
case COM_DT_COLOR:
- IMB_exr_add_channel(exrhandle, layerName, "R", viewName, 4, 4 * width, buf ? buf : NULL);
- IMB_exr_add_channel(exrhandle, layerName, "G", viewName, 4, 4 * width, buf ? buf + 1 : NULL);
- IMB_exr_add_channel(exrhandle, layerName, "B", viewName, 4, 4 * width, buf ? buf + 2 : NULL);
- IMB_exr_add_channel(exrhandle, layerName, "A", viewName, 4, 4 * width, buf ? buf + 3 : NULL);
+ IMB_exr_add_channel(exrhandle, layerName, "R", viewName, 4, 4 * width, buf ? buf : NULL, use_half_float);
+ IMB_exr_add_channel(exrhandle, layerName, "G", viewName, 4, 4 * width, buf ? buf + 1 : NULL, use_half_float);
+ IMB_exr_add_channel(exrhandle, layerName, "B", viewName, 4, 4 * width, buf ? buf + 2 : NULL, use_half_float);
+ IMB_exr_add_channel(exrhandle, layerName, "A", viewName, 4, 4 * width, buf ? buf + 3 : NULL, use_half_float);
break;
default:
break;
@@ -227,13 +228,15 @@ OutputOpenExrLayer::OutputOpenExrLayer(const char *name_, DataType datatype_, bo
}
OutputOpenExrMultiLayerOperation::OutputOpenExrMultiLayerOperation(
- const RenderData *rd, const bNodeTree *tree, const char *path, char exr_codec, const char *viewName)
+ const RenderData *rd, const bNodeTree *tree, const char *path,
+ char exr_codec, bool exr_half_float, const char *viewName)
{
this->m_rd = rd;
this->m_tree = tree;
BLI_strncpy(this->m_path, path, sizeof(this->m_path));
this->m_exr_codec = exr_codec;
+ this->m_exr_half_float = exr_half_float;
this->m_viewName = viewName;
}
@@ -284,7 +287,8 @@ void OutputOpenExrMultiLayerOperation::deinitExecution()
if (!layer.imageInput)
continue; /* skip unconnected sockets */
- add_exr_channels(exrhandle, this->m_layers[i].name, this->m_layers[i].datatype, "", width, this->m_layers[i].outputBuffer);
+ add_exr_channels(exrhandle, this->m_layers[i].name, this->m_layers[i].datatype, "", width,
+ this->m_exr_half_float, this->m_layers[i].outputBuffer);
}
/* when the filename has no permissions, this can fail */
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h
index 58ebf055583..93468977a66 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.h
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.h
@@ -85,11 +85,13 @@ protected:
char m_path[FILE_MAX];
char m_exr_codec;
+ bool m_exr_half_float;
LayerList m_layers;
const char *m_viewName;
public:
- OutputOpenExrMultiLayerOperation(const RenderData *rd, const bNodeTree *tree, const char *path, char exr_codec, const char *viewName);
+ OutputOpenExrMultiLayerOperation(const RenderData *rd, const bNodeTree *tree, const char *path,
+ char exr_codec, bool exr_half_float, const char *viewName);
void add_layer(const char *name, DataType datatype, bool use_layer);
@@ -102,7 +104,8 @@ public:
bool isFileOutputOperation() const { return true; }
};
-void add_exr_channels(void *exrhandle, const char *layerName, const DataType datatype, const char *viewName, const size_t width, float *buf);
+void add_exr_channels(void *exrhandle, const char *layerName, const DataType datatype, const char *viewName,
+ const size_t width, bool use_half_float, float *buf);
void free_exr_channels(void *exrhandle, const RenderData *rd, const char *layerName, const DataType datatype);
int get_datatype_size(DataType datatype);