[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51188] tags/blender-2.64a-release/blender : Merging color management fixes from trunk into 2.64a tag

Sergey Sharybin sergey.vfx at gmail.com
Mon Oct 8 16:07:04 CEST 2012


Revision: 51188
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51188
Author:   nazgul
Date:     2012-10-08 14:07:03 +0000 (Mon, 08 Oct 2012)
Log Message:
-----------
Merging color management fixes from trunk into 2.64a tag

This includes revisions: 51041-51043, 51060, 51076, 51108, 51158, 51056, 51168, 51184

Modified Paths:
--------------
    tags/blender-2.64a-release/blender/intern/opencolorio/CMakeLists.txt
    tags/blender-2.64a-release/blender/intern/opencolorio/SConscript
    tags/blender-2.64a-release/blender/intern/opencolorio/ocio_capi.h
    tags/blender-2.64a-release/blender/source/blender/blenkernel/intern/scene.c
    tags/blender-2.64a-release/blender/source/blender/blenkernel/intern/sequencer.c
    tags/blender-2.64a-release/blender/source/blender/blenlib/BLI_fileops.h
    tags/blender-2.64a-release/blender/source/blender/blenlib/intern/fileops.c
    tags/blender-2.64a-release/blender/source/blender/imbuf/intern/IMB_colormanagement_intern.h
    tags/blender-2.64a-release/blender/source/blender/imbuf/intern/colormanagement.c
    tags/blender-2.64a-release/blender/source/blender/imbuf/intern/divers.c
    tags/blender-2.64a-release/blender/source/blender/render/intern/source/pipeline.c

Added Paths:
-----------
    tags/blender-2.64a-release/blender/intern/opencolorio/fallback_impl.cc
    tags/blender-2.64a-release/blender/intern/opencolorio/ocio_capi.cc
    tags/blender-2.64a-release/blender/intern/opencolorio/ocio_impl.cc
    tags/blender-2.64a-release/blender/intern/opencolorio/ocio_impl.h

Removed Paths:
-------------
    tags/blender-2.64a-release/blender/intern/opencolorio/ocio_capi.cpp
    tags/blender-2.64a-release/blender/intern/opencolorio/ocio_capi_stub.cpp

Property Changed:
----------------
    tags/blender-2.64a-release/blender/
    tags/blender-2.64a-release/blender/source/blender/editors/interface/interface.c
    tags/blender-2.64a-release/blender/source/blender/editors/space_outliner/


Property changes on: tags/blender-2.64a-release/blender
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152,44229-44230,45623-45625,46037,48089,48092,48551-48552,48679,48790,48792-48793,49076,49087,49292,49294,49466,49894,50052,50126
/trunk/blender:51017-51025,51186
   + /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152,44229-44230,45623-45625,46037,48089,48092,48551-48552,48679,48790,48792-48793,49076,49087,49292,49294,49466,49894,50052,50126
/trunk/blender:51017-51025,51041-51043,51056,51060,51076,51108,51158,51168,51184,51186

Modified: tags/blender-2.64a-release/blender/intern/opencolorio/CMakeLists.txt
===================================================================
--- tags/blender-2.64a-release/blender/intern/opencolorio/CMakeLists.txt	2012-10-08 13:58:56 UTC (rev 51187)
+++ tags/blender-2.64a-release/blender/intern/opencolorio/CMakeLists.txt	2012-10-08 14:07:03 UTC (rev 51188)
@@ -26,41 +26,39 @@
 set(INC
 	.
 	../guardedalloc
+	../../source/blender/blenlib
 )
 
 set(INC_SYS
 )
 
+set(SRC
+	ocio_capi.cc
+	fallback_impl.cc
 
+	ocio_capi.h
+	ocio_impl.h
+)
+
 if(WITH_OPENCOLORIO)
+	add_definitions(
+		-DWITH_OCIO
+	)
 
 	list(APPEND INC_SYS
 		${OPENCOLORIO_INCLUDE_DIRS}
 	)
 
+	list(APPEND SRC
+		ocio_impl.cc
+	)
+
 	if(WIN32 AND NOT MINGW)
 		list(APPEND INC_SYS
 			${BOOST_INCLUDE_DIR}
 		)
 	endif()
-
-	set(SRC
-		ocio_capi.cpp
-		ocio_capi.h
-	)
-else()
-	list(APPEND INC
-		../../source/blender/blenlib
-	)
-
-	set(SRC
-		ocio_capi_stub.cpp
-		ocio_capi.h
-	)
 endif()
 
-add_definitions(
-)
 
 blender_add_lib(bf_intern_opencolorio "${SRC}" "${INC}" "${INC_SYS}")
-

Modified: tags/blender-2.64a-release/blender/intern/opencolorio/SConscript
===================================================================
--- tags/blender-2.64a-release/blender/intern/opencolorio/SConscript	2012-10-08 13:58:56 UTC (rev 51187)
+++ tags/blender-2.64a-release/blender/intern/opencolorio/SConscript	2012-10-08 14:07:03 UTC (rev 51188)
@@ -2,18 +2,18 @@
 
 Import('env')
 
-sources = env.Glob('*.cpp')
+sources = env.Glob('*.cc')
 
 incs = '. ../guardedalloc ../../source/blender/blenlib'
+defs = []
 
 if env['WITH_BF_OCIO']:
-    sources.remove('ocio_capi_stub.cpp')
-
+    defs.append('WITH_OCIO')
     incs += ' ' + env['BF_OCIO_INC']
 
     if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
         incs += ' ' + env['BF_BOOST_INC']
 else:
-    sources.remove('ocio_capi.cpp')
+    sources.remove('ocio_impl.cc')
 
-env.BlenderLib( 'bf_intern_opencolorio', sources, Split(incs), [], libtype=['extern','player'], priority=[10, 185])
+env.BlenderLib( 'bf_intern_opencolorio', sources, Split(incs), defs, libtype=['extern','player'], priority=[10, 185])

Copied: tags/blender-2.64a-release/blender/intern/opencolorio/fallback_impl.cc (from rev 51043, trunk/blender/intern/opencolorio/fallback_impl.cc)
===================================================================
--- tags/blender-2.64a-release/blender/intern/opencolorio/fallback_impl.cc	                        (rev 0)
+++ tags/blender-2.64a-release/blender/intern/opencolorio/fallback_impl.cc	2012-10-08 14:07:03 UTC (rev 51188)
@@ -0,0 +1,382 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Brecht van Lommel
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+#include "BLI_math_color.h"
+
+#include "ocio_impl.h"
+
+#define CONFIG_DEFAULT           ((OCIO_ConstConfigRcPtr*)1)
+
+#define PROCESSOR_LINEAR_TO_SRGB ((OCIO_ConstProcessorRcPtr*)1)
+#define PROCESSOR_SRGB_TO_LINEAR ((OCIO_ConstProcessorRcPtr*)2)
+#define PROCESSOR_UNKNOWN        ((OCIO_ConstProcessorRcPtr*)3)
+
+#define COLORSPACE_LINEAR        ((OCIO_ConstColorSpaceRcPtr*)1)
+#define COLORSPACE_SRGB          ((OCIO_ConstColorSpaceRcPtr*)2)
+
+typedef struct OCIO_PackedImageDescription {
+	float *data;
+	long width;
+	long height;
+	long numChannels;
+	long chanStrideBytes;
+	long xStrideBytes;
+	long yStrideBytes;
+} OCIO_PackedImageDescription;
+
+OCIO_ConstConfigRcPtr *FallbackImpl::getCurrentConfig(void)
+{
+	return CONFIG_DEFAULT;
+}
+
+void FallbackImpl::setCurrentConfig(const OCIO_ConstConfigRcPtr *)
+{
+}
+
+OCIO_ConstConfigRcPtr *FallbackImpl::configCreateFromEnv(void)
+{
+	return CONFIG_DEFAULT;
+}
+
+OCIO_ConstConfigRcPtr *FallbackImpl::configCreateFromFile(const char *)
+{
+	return CONFIG_DEFAULT;
+}
+
+void FallbackImpl::configRelease(OCIO_ConstConfigRcPtr *)
+{
+}
+
+int FallbackImpl::configGetNumColorSpaces(OCIO_ConstConfigRcPtr *)
+{
+	return 2;
+}
+
+const char *FallbackImpl::configGetColorSpaceNameByIndex(OCIO_ConstConfigRcPtr *, int index)
+{
+	if (index == 0)
+		return "Linear";
+	else if (index == 1)
+		return "sRGB";
+	
+	return NULL;
+}
+
+OCIO_ConstColorSpaceRcPtr *FallbackImpl::configGetColorSpace(OCIO_ConstConfigRcPtr *, const char *name)
+{
+	if (strcmp(name, "scene_linear") == 0)
+		return COLORSPACE_LINEAR;
+	else if (strcmp(name, "color_picking") == 0)
+		return COLORSPACE_SRGB;
+	else if (strcmp(name, "texture_paint") == 0)
+		return COLORSPACE_LINEAR;
+	else if (strcmp(name, "default_byte") == 0)
+		return COLORSPACE_SRGB;
+	else if (strcmp(name, "default_float") == 0)
+		return COLORSPACE_LINEAR;
+	else if (strcmp(name, "default_sequencer") == 0)
+		return COLORSPACE_SRGB;
+	else if (strcmp(name, "Linear") == 0)
+		return COLORSPACE_LINEAR;
+	else if (strcmp(name, "sRGB") == 0)
+		return COLORSPACE_SRGB;
+
+	return NULL;
+}
+
+int FallbackImpl::configGetIndexForColorSpace(OCIO_ConstConfigRcPtr *config, const char *name)
+{
+	OCIO_ConstColorSpaceRcPtr *cs = configGetColorSpace(config, name);
+
+	if (cs == COLORSPACE_LINEAR)
+		return 0;
+	else if (cs == COLORSPACE_SRGB)
+		return 1;
+
+	return -1;
+}
+
+const char *FallbackImpl::configGetDefaultDisplay(OCIO_ConstConfigRcPtr *)
+{
+	return "sRGB";
+}
+
+int FallbackImpl::configGetNumDisplays(OCIO_ConstConfigRcPtr* config)
+{
+	return 1;
+}
+
+const char *FallbackImpl::configGetDisplay(OCIO_ConstConfigRcPtr *, int index)
+{
+	if (index == 0)
+		return "sRGB";
+	
+	return NULL;
+}
+
+const char *FallbackImpl::configGetDefaultView(OCIO_ConstConfigRcPtr *, const char *)
+{
+	return "Default";
+}
+
+int FallbackImpl::configGetNumViews(OCIO_ConstConfigRcPtr *, const char *)
+{
+	return 1;
+}
+
+const char *FallbackImpl::configGetView(OCIO_ConstConfigRcPtr *, const char *, int index)
+{
+	if (index == 0)
+		return "Default";
+
+	return NULL;
+}
+
+const char *FallbackImpl::configGetDisplayColorSpaceName(OCIO_ConstConfigRcPtr *, const char *, const char *)
+{
+	return "sRGB";
+}
+
+int FallbackImpl::colorSpaceIsInvertible(OCIO_ConstColorSpaceRcPtr *cs)
+{
+	return 1;
+}
+
+int FallbackImpl::colorSpaceIsData(OCIO_ConstColorSpaceRcPtr *cs)
+{
+	return 0;
+}
+
+void FallbackImpl::colorSpaceRelease(OCIO_ConstColorSpaceRcPtr *cs)
+{
+}
+
+OCIO_ConstProcessorRcPtr *FallbackImpl::configGetProcessorWithNames(OCIO_ConstConfigRcPtr *config, const char *srcName, const char *dstName)
+{
+	OCIO_ConstColorSpaceRcPtr *cs_src = configGetColorSpace(config, srcName);
+	OCIO_ConstColorSpaceRcPtr *cs_dst = configGetColorSpace(config, dstName);
+
+	if (cs_src == COLORSPACE_LINEAR && cs_dst == COLORSPACE_SRGB)
+		return PROCESSOR_LINEAR_TO_SRGB;
+	else if (cs_src == COLORSPACE_SRGB && cs_dst == COLORSPACE_LINEAR)
+		return PROCESSOR_SRGB_TO_LINEAR;
+
+	return 0;
+}
+
+OCIO_ConstProcessorRcPtr *FallbackImpl::configGetProcessor(OCIO_ConstConfigRcPtr *, OCIO_ConstTransformRcPtr *tfm)
+{
+	return (OCIO_ConstProcessorRcPtr*)tfm;
+}
+
+void FallbackImpl::processorApply(OCIO_ConstProcessorRcPtr *processor, OCIO_PackedImageDesc *img)
+{
+	/* OCIO_TODO stride not respected, channels must be 3 or 4 */
+	OCIO_PackedImageDescription *desc = (OCIO_PackedImageDescription*)img;
+	int channels = desc->numChannels;
+	float *pixels = desc->data;
+	int width = desc->width;
+	int height = desc->height;
+	int x, y;
+
+	for (y = 0; y < height; y++) {
+		for (x = 0; x < width; x++) {
+			float *pixel = pixels + channels * (y * width + x);
+
+			if (channels == 4)
+				processorApplyRGBA(processor, pixel);
+			else if (channels == 3)
+				processorApplyRGB(processor, pixel);
+		}
+	}
+}
+
+void FallbackImpl::processorApply_predivide(OCIO_ConstProcessorRcPtr *processor, OCIO_PackedImageDesc *img)
+{
+	/* OCIO_TODO stride not respected, channels must be 3 or 4 */
+	OCIO_PackedImageDescription *desc = (OCIO_PackedImageDescription*)img;
+	int channels = desc->numChannels;
+	float *pixels = desc->data;
+	int width = desc->width;
+	int height = desc->height;
+	int x, y;
+
+	for (y = 0; y < height; y++) {
+		for (x = 0; x < width; x++) {
+			float *pixel = pixels + channels * (y * width + x);
+
+			if (channels == 4)

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list