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:
authorCampbell Barton <ideasman42@gmail.com>2010-07-12 18:54:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-07-12 18:54:05 +0400
commit731824c464e03b133ea9698c2d74dbb8e7f890be (patch)
tree6a278064b16944ae21e2879c6b4e5cbaf3ffe285 /source/blender/imbuf/intern/openexr
parent9e57892b90b84bd33f825afcbb90a021b06b374f (diff)
support for colorspace conversion when saving srgb float buffers (from the sequencer) as openexr.
Diffstat (limited to 'source/blender/imbuf/intern/openexr')
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 22af379d949..a0969979817 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -229,29 +229,44 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, char *name, int flags)
sizeof(float), sizeof(float) * -width));
if(ibuf->rect_float) {
float *from;
-
- for (int i = ibuf->y-1; i >= 0; i--)
- {
- from= ibuf->rect_float + channels*i*width;
-
- for (int j = ibuf->x; j > 0; j--)
+
+ if(ibuf->profile == IB_PROFILE_LINEAR_RGB) {
+ for (int i = ibuf->y-1; i >= 0; i--)
{
- to->r = from[0];
- to->g = from[1];
- to->b = from[2];
- to->a = (channels >= 4)? from[3]: 1.0f;
- to++; from += 4;
+ from= ibuf->rect_float + channels*i*width;
+
+ for (int j = ibuf->x; j > 0; j--)
+ {
+ to->r = from[0];
+ to->g = from[1];
+ to->b = from[2];
+ to->a = (channels >= 4)? from[3]: 1.0f;
+ to++; from += 4;
+ }
+ }
+ }
+ else {
+ for (int i = ibuf->y-1; i >= 0; i--)
+ {
+ from= ibuf->rect_float + channels*i*width;
+
+ for (int j = ibuf->x; j > 0; j--)
+ {
+ to->r = srgb_to_linearrgb(from[0]);
+ to->g = srgb_to_linearrgb(from[1]);
+ to->b = srgb_to_linearrgb(from[2]);
+ to->a = (channels >= 4)? from[3]: 1.0f;
+ to++; from += 4;
+ }
}
}
}
else {
unsigned char *from;
- if(ibuf->profile != IB_PROFILE_NONE) {
+ if(ibuf->profile == IB_PROFILE_LINEAR_RGB) {
for (int i = ibuf->y-1; i >= 0; i--)
{
- from= (unsigned char *)ibuf->rect + channels*i*width;
-
for (int j = ibuf->x; j > 0; j--)
{
to->r = (float)(from[0])/255.0;
@@ -265,8 +280,6 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, char *name, int flags)
else {
for (int i = ibuf->y-1; i >= 0; i--)
{
- from= (unsigned char *)ibuf->rect + channels*i*width;
-
for (int j = ibuf->x; j > 0; j--)
{
to->r = srgb_to_linearrgb((float)from[0] / 255.0);