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:
authorLukas Stockner <lukas.stockner@freenet.de>2019-05-02 16:45:31 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-03 16:42:49 +0300
commit68b15fc3ad4f74be192150d3a2fb35e7ef2d4edd (patch)
tree26c2aa7b37c3520417acf13b4a80c3023346b1c2 /intern/cycles/render/image.h
parentdba4684f82a179a5c8abdae5940bc7c35e65a1a7 (diff)
Cycles: support loading images from arbitrary OpenColorIO color space
These are the internal changes to Cycles, for Blender integration there are no functional changes in this commit. Images are converted to scene linear color space on file load, and on reading from the OpenImageIO texture cache. 8-bit images are compressed with the sRGB transfer function to avoid precision loss while keeping memory usages low. This also means that for common cases of 8-bit sRGB images no conversion happens at all on image loading. Initial patch by Lukas, completed by Brecht. Differential Revision: https://developer.blender.org/D3491
Diffstat (limited to 'intern/cycles/render/image.h')
-rw-r--r--intern/cycles/render/image.h38
1 files changed, 33 insertions, 5 deletions
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index 34f046692f6..d5bc37e58d7 100644
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@ -20,6 +20,8 @@
#include "device/device.h"
#include "device/device_memory.h"
+#include "render/colorspace.h"
+
#include "util/util_image.h"
#include "util/util_string.h"
#include "util/util_thread.h"
@@ -32,6 +34,7 @@ class Device;
class Progress;
class RenderStats;
class Scene;
+class ColorSpaceProcessor;
class ImageMetaData {
public:
@@ -43,13 +46,29 @@ class ImageMetaData {
/* Automatically set. */
ImageDataType type;
- bool is_linear;
+ ustring colorspace;
+ bool compress_as_srgb;
+
+ ImageMetaData()
+ : is_float(false),
+ is_half(false),
+ channels(0),
+ width(0),
+ height(0),
+ depth(0),
+ builtin_free_cache(NULL),
+ type(IMAGE_DATA_NUM_TYPES),
+ colorspace(u_colorspace_raw),
+ compress_as_srgb(false)
+ {
+ }
bool operator==(const ImageMetaData &other) const
{
return is_float == other.is_float && is_half == other.is_half && channels == other.channels &&
width == other.width && height == other.height && depth == other.depth &&
- type == other.type && is_linear == other.is_linear;
+ type == other.type && colorspace == other.colorspace &&
+ compress_as_srgb == other.compress_as_srgb;
}
};
@@ -65,19 +84,25 @@ class ImageManager {
InterpolationType interpolation,
ExtensionType extension,
bool use_alpha,
+ ustring colorspace,
ImageMetaData &metadata);
void remove_image(int flat_slot);
void remove_image(const string &filename,
void *builtin_data,
InterpolationType interpolation,
ExtensionType extension,
- bool use_alpha);
+ bool use_alpha,
+ ustring colorspace);
void tag_reload_image(const string &filename,
void *builtin_data,
InterpolationType interpolation,
ExtensionType extension,
- bool use_alpha);
- bool get_image_metadata(const string &filename, void *builtin_data, ImageMetaData &metadata);
+ bool use_alpha,
+ ustring colorspace);
+ bool get_image_metadata(const string &filename,
+ void *builtin_data,
+ ustring colorspace,
+ ImageMetaData &metadata);
bool get_image_metadata(int flat_slot, ImageMetaData &metadata);
void device_update(Device *device, Scene *scene, Progress &progress);
@@ -120,6 +145,7 @@ class ImageManager {
void *builtin_data;
ImageMetaData metadata;
+ ustring colorspace;
bool use_alpha;
bool need_load;
bool animated;
@@ -152,6 +178,8 @@ class ImageManager {
int texture_limit,
device_vector<DeviceType> &tex_img);
+ void metadata_detect_colorspace(ImageMetaData &metadata, const char *file_format);
+
void device_load_image(
Device *device, Scene *scene, ImageDataType type, int slot, Progress *progress);
void device_free_image(Device *device, ImageDataType type, int slot);