[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50577] branches/soc-2011-tomato/source/ blender: Color Management: fix crash when strip failed to render

Sergey Sharybin sergey.vfx at gmail.com
Thu Sep 13 16:52:26 CEST 2012


Revision: 50577
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50577
Author:   nazgul
Date:     2012-09-13 14:52:25 +0000 (Thu, 13 Sep 2012)
Log Message:
-----------
Color Management: fix crash when strip failed to render

In this case sequencer would allocate empty image buffer which used to not to
have assigned color spaces but it was marked as non-linear float.

Assuming black would always be black in sequencer's color space no additional
transformation for display is needed.

Solved by removing NOLINEAR_FLOAT flag from image buffers and using check
image buffer's float_colorspace for NULL when needed to check whether float
buffer is linear or not.

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/blenkernel/intern/sequencer.c
    branches/soc-2011-tomato/source/blender/imbuf/IMB_imbuf_types.h
    branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/sequencer.c	2012-09-13 13:53:58 UTC (rev 50576)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/sequencer.c	2012-09-13 14:52:25 UTC (rev 50577)
@@ -2659,8 +2659,10 @@
 		}
 	}
 
-	if (ibuf == NULL)
+	if (ibuf == NULL) {
 		ibuf = IMB_allocImBuf(context.rectx, context.recty, 32, IB_rect);
+		BKE_sequencer_imbuf_assign_spaces(context.scene, ibuf);
+	}
 
 	if (ibuf->x != context.rectx || ibuf->y != context.recty)
 		use_preprocess = TRUE;
@@ -2739,7 +2741,6 @@
 	
 	if (count == 1) {
 		out = seq_render_strip(context, seq_arr[0], cfra);
-		out->colormanage_flags |= IMB_COLORMANAGE_NOLINEAR_FLOAT;
 
 		BKE_sequencer_cache_put(context, seq_arr[0], cfra, SEQ_STRIPELEM_IBUF_COMP, out);
 
@@ -2819,8 +2820,6 @@
 		BKE_sequencer_cache_put(context, seq_arr[i], cfra, SEQ_STRIPELEM_IBUF_COMP, out);
 	}
 
-	out->colormanage_flags |= IMB_COLORMANAGE_NOLINEAR_FLOAT;
-
 	return out;
 }
 

Modified: branches/soc-2011-tomato/source/blender/imbuf/IMB_imbuf_types.h
===================================================================
--- branches/soc-2011-tomato/source/blender/imbuf/IMB_imbuf_types.h	2012-09-13 13:53:58 UTC (rev 50576)
+++ branches/soc-2011-tomato/source/blender/imbuf/IMB_imbuf_types.h	2012-09-13 14:52:25 UTC (rev 50577)
@@ -128,9 +128,8 @@
 	unsigned int   encodedbuffersize; /* Size of encodedbuffer */
 
 	/* color management */
-	int colormanage_flags;                       /* color management flags field */
 	struct ColorSpace *rect_colorspace;          /* color space of byte buffer */
-	struct ColorSpace *float_colorspace;          /* color space of float buffer, used by sequencer only */
+	struct ColorSpace *float_colorspace;         /* color space of float buffer, used by sequencer only */
 	unsigned int *display_buffer_flags;          /* array of per-display display buffers dirty flags */
 	struct ColormanageCache *colormanage_cache;  /* cache used by color management */
 
@@ -262,9 +261,4 @@
 extern const char *imb_ext_movie[];
 extern const char *imb_ext_audio[];
 
-/* ImBuf->colormanage_flags */
-enum {
-	IMB_COLORMANAGE_NOLINEAR_FLOAT = (1 << 0)
-};
-
 #endif

Modified: branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c
===================================================================
--- branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c	2012-09-13 13:53:58 UTC (rev 50576)
+++ branches/soc-2011-tomato/source/blender/imbuf/intern/colormanagement.c	2012-09-13 14:52:25 UTC (rev 50577)
@@ -1068,8 +1068,6 @@
 	float dither;
 	int predivide;
 
-	int nolinear_float;
-
 	const char *byte_colorspace;
 	const char *float_colorspace;
 } DisplayBufferThread;
@@ -1128,8 +1126,6 @@
 
 	handle->byte_colorspace = init_data->byte_colorspace;
 	handle->float_colorspace = init_data->float_colorspace;
-
-	handle->nolinear_float = ibuf->colormanage_flags & IMB_COLORMANAGE_NOLINEAR_FLOAT;
 }
 
 static void *display_buffer_apply_get_linear_buffer(DisplayBufferThread *handle)
@@ -1168,7 +1164,7 @@
 		IMB_colormanagement_transform(linear_buffer, width, height, channels,
 		                              from_colorspace, to_colorspace, predivide);
 	}
-	else if (handle->nolinear_float) {
+	else if (handle->float_colorspace) {
 		/* currently float is non-linear only in sequencer, which is working
 		 * in it's own color space even to handle float buffers.
 		 * This color space is the same for byte and float images.




More information about the Bf-blender-cvs mailing list