diff options
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/IMB_imbuf_types.h | 1 | ||||
-rw-r--r-- | source/blender/imbuf/intern/oiio/openimageio_api.cpp | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 13 |
3 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h index 61aa1f401a0..0568c425e78 100644 --- a/source/blender/imbuf/IMB_imbuf_types.h +++ b/source/blender/imbuf/IMB_imbuf_types.h @@ -291,6 +291,7 @@ enum { IB_alphamode_ignore = 1 << 15, IB_thumbnail = 1 << 16, IB_multiview = 1 << 17, + IB_halffloat = 1 << 18, }; /** \} */ diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp index e001b8b21c4..4746cec41d4 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp +++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp @@ -194,7 +194,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac { struct ImBuf *ibuf = NULL; int width, height, components; - bool is_float, is_alpha; + bool is_float, is_alpha, is_half; int basesize; char file_colorspace[IM_MAX_SPACE]; const bool is_colorspace_manually_set = (colorspace[0] != '\0'); @@ -243,6 +243,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac is_alpha = spec.alpha_channel != -1; basesize = spec.format.basesize(); is_float = basesize > 1; + is_half = spec.format == TypeDesc::HALF; /* we only handle certain number of components */ if (!(components >= 1 && components <= 4)) { @@ -271,6 +272,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac ibuf->ftype = IMB_FTYPE_PSD; ibuf->channels = 4; ibuf->planes = (3 + (is_alpha ? 1 : 0)) * 4 << basesize; + ibuf->flags |= (is_float && is_half) ? IB_halffloat : 0; try { return ibuf; diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index e1513169736..9fa2c7a28c5 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -1757,6 +1757,18 @@ static bool exr_has_alpha(MultiPartInputFile &file) return !(file.header(0).channels().findChannel("A") == NULL); } +static bool exr_is_half_float(MultiPartInputFile &file) +{ + const ChannelList &channels = file.header(0).channels(); + for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i) { + const Channel &channel = i.channel(); + if (channel.type != HALF) { + return false; + } + } + return true; +} + static bool imb_exr_is_multilayer_file(MultiPartInputFile &file) { const ChannelList &channels = file.header(0).channels(); @@ -1909,6 +1921,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem, const int is_alpha = exr_has_alpha(*file); ibuf = IMB_allocImBuf(width, height, is_alpha ? 32 : 24, 0); + ibuf->flags |= exr_is_half_float(*file) ? IB_halffloat : 0; if (hasXDensity(file->header(0))) { ibuf->ppm[0] = xDensity(file->header(0)) * 39.3700787f; |