[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13104] trunk/blender/source/blender/src: == Sequencer ==

Peter Schlaile peter at schlaile.de
Wed Jan 2 23:39:47 CET 2008


Revision: 13104
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13104
Author:   schlaile
Date:     2008-01-02 23:39:46 +0100 (Wed, 02 Jan 2008)

Log Message:
-----------
== Sequencer ==

Fixed:

* crash with gamma tabs and blend modes
* crash on rect -> rect_float blend mode input
* alpha over and under have now input swapped

Modified Paths:
--------------
    trunk/blender/source/blender/src/seqeffects.c
    trunk/blender/source/blender/src/sequence.c

Modified: trunk/blender/source/blender/src/seqeffects.c
===================================================================
--- trunk/blender/source/blender/src/seqeffects.c	2008-01-02 21:40:05 UTC (rev 13103)
+++ trunk/blender/source/blender/src/seqeffects.c	2008-01-02 22:39:46 UTC (rev 13104)
@@ -786,9 +786,9 @@
    ********************************************************************** */
 
 /* copied code from initrender.c */
-static unsigned short *gamtab = 0;
-static unsigned short *igamtab1 = 0;
-static int gamma_tabs_refcount = 0;
+static unsigned short gamtab[65536];
+static unsigned short igamtab1[256];
+static int gamma_tabs_init = FALSE;
 
 #define RE_GAMMA_TABLE_SIZE 400
 
@@ -882,9 +882,6 @@
 	float val, igamma= 1.0f/gamma;
 	int a;
 	
-	gamtab= MEM_mallocN(65536*sizeof(short), "initGaus2");
-	igamtab1= MEM_mallocN(256*sizeof(short), "initGaus2");
-
 	/* gamtab: in short, out short */
 	for(a=0; a<65536; a++) {
 		val= a;
@@ -907,36 +904,25 @@
 
 }
 
-static void alloc_or_ref_gammatabs()
+static void build_gammatabs()
 {
-	if (gamma_tabs_refcount == 0) {
+	if (gamma_tabs_init == FALSE) {
 		gamtabs(2.0f);
 		makeGammaTables(2.0f);
+		gamma_tabs_init = TRUE;
 	}
-	gamma_tabs_refcount++;
 }
 
 static void init_gammacross(Sequence * seq)
 {
-	alloc_or_ref_gammatabs();
 }
 
 static void load_gammacross(Sequence * seq)
 {
-	alloc_or_ref_gammatabs();
 }
 
 static void free_gammacross(Sequence * seq)
 {
-	if (--gamma_tabs_refcount == 0) {
-		MEM_freeN(gamtab);
-		MEM_freeN(igamtab1);
-		gamtab = 0;
-		igamtab1 = 0;
-	}
-	if (gamma_tabs_refcount < 0) {
-		fprintf(stderr, "seqeffects: free_gammacross double free!\n");
-	}
 }
 
 static void do_gammacross_effect_byte(float facf0, float facf1, 
@@ -1043,6 +1029,8 @@
 				 struct ImBuf *ibuf1, struct ImBuf *ibuf2, 
 				 struct ImBuf *ibuf3, struct ImBuf *out)
 {
+	build_gammatabs();
+
 	if (out->rect_float) {
 		do_gammacross_effect_float(
 			facf0, facf1, x, y,

Modified: trunk/blender/source/blender/src/sequence.c
===================================================================
--- trunk/blender/source/blender/src/sequence.c	2008-01-02 21:40:05 UTC (rev 13103)
+++ trunk/blender/source/blender/src/sequence.c	2008-01-02 22:39:46 UTC (rev 13104)
@@ -1498,7 +1498,7 @@
 			break;
 		}
 
-		sh = get_sequence_blend(seq_arr[i]);
+		sh = get_sequence_blend(seq);
 
 		seq->facf0 = seq->facf1 = 1.0;
 
@@ -1549,7 +1549,7 @@
 			}
 			break;
 		}
-		
+	
 		if (se->ibuf_comp) {
 			break;
 		}
@@ -1568,6 +1568,7 @@
 		case 0: {
 			int x= se2->ibuf->x;
 			int y= se2->ibuf->y;
+			int swap_input = FALSE;
 
 			if (se1->ibuf_comp->rect_float ||
 			    se2->ibuf->rect_float) {
@@ -1592,16 +1593,32 @@
 
 			if (!se1->ibuf_comp->rect && 
 			    !se2->ibuf_comp->rect_float) {
-				IMB_rect_from_float(se1->ibuf);
+				IMB_rect_from_float(se1->ibuf_comp);
 			}
 			if (!se2->ibuf->rect && 
 			    !se2->ibuf_comp->rect_float) {
 				IMB_rect_from_float(se2->ibuf);
 			}
 
-			sh.execute(seq, cfra, seq->facf0, seq->facf1, x, y, 
-				   se1->ibuf_comp, se2->ibuf, 0,
-				   se2->ibuf_comp);
+			/* bad hack, to fix crazy input ordering of 
+			   those two effects */
+
+			if (seq->blend_mode == SEQ_ALPHAOVER ||
+			    seq->blend_mode == SEQ_ALPHAUNDER) {
+				swap_input = TRUE;
+			}
+
+			if (swap_input) {
+				sh.execute(seq, cfra, 
+					   seq->facf0, seq->facf1, x, y, 
+					   se2->ibuf, se1->ibuf_comp, 0,
+					   se2->ibuf_comp);
+			} else {
+				sh.execute(seq, cfra, 
+					   seq->facf0, seq->facf1, x, y, 
+					   se1->ibuf_comp, se2->ibuf, 0,
+					   se2->ibuf_comp);
+			}
 			
 			IMB_cache_limiter_insert(se2->ibuf_comp);
 			IMB_cache_limiter_ref(se2->ibuf_comp);





More information about the Bf-blender-cvs mailing list