[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44965] trunk/blender/source/blender/ blenkernel/intern/sequencer.c: == Sequencer ==

Peter Schlaile peter at schlaile.de
Sun Mar 18 12:13:33 CET 2012


Revision: 44965
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44965
Author:   schlaile
Date:     2012-03-18 11:13:28 +0000 (Sun, 18 Mar 2012)
Log Message:
-----------
== Sequencer ==

Fix for:
[#29758] Sequencer `Image Offset` error with render percentage

also:
* make preprocess parameters completely independent from render resolution
  (they are always relative to *final* resolution now)
* fix yesterdays fix for proxy resolution rendering (the case of unbuild
  proxies wasn't handled correctly)

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/sequencer.c

Modified: trunk/blender/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sequencer.c	2012-03-18 09:35:09 UTC (rev 44964)
+++ trunk/blender/source/blender/blenkernel/intern/sequencer.c	2012-03-18 11:13:28 UTC (rev 44965)
@@ -1687,7 +1687,8 @@
 }
 
 static ImBuf * input_preprocess(
-	SeqRenderData context, Sequence *seq, float UNUSED(cfra), ImBuf * ibuf)
+	SeqRenderData context, Sequence *seq, float UNUSED(cfra), ImBuf * ibuf,
+	int is_proxy_image, int is_preprocessed)
 {
 	float mul;
 
@@ -1701,12 +1702,17 @@
 		StripCrop c= {0};
 		StripTransform t= {0};
 		int sx,sy,dx,dy;
+		double xscale = 1.0;
+		double yscale = 1.0;
 
-		double f = seq_rendersize_to_scale_factor(
-			context.preview_render_size);
+		if (is_proxy_image) {
+			double f = seq_rendersize_to_scale_factor(
+				context.preview_render_size);
 
-		if (f != 1.0) {
-			IMB_scalefastImBuf(ibuf, ibuf->x / f, ibuf->y / f);
+			if (f != 1.0) {
+				IMB_scalefastImBuf(
+					ibuf, ibuf->x / f, ibuf->y / f);
+			}
 		}
 
 		if(seq->flag & SEQ_USE_CROP && seq->strip->crop) {
@@ -1716,23 +1722,43 @@
 			t = *seq->strip->transform;
 		}
 
+		xscale = context.scene->r.xsch ? 
+			((double) context.rectx / 
+			 (double) context.scene->r.xsch) : 1.0;
+		yscale = context.scene->r.ysch ? 
+			((double) context.recty / 
+			 (double) context.scene->r.ysch) : 1.0;
+
+		c.left *= xscale; c.right *= yscale;
+		c.top *= yscale; c.bottom *= yscale;
+
+		t.xofs *= xscale; t.yofs *= yscale;
+
 		sx = ibuf->x - c.left - c.right;
 		sy = ibuf->y - c.top - c.bottom;
 		dx = sx;
 		dy = sy;
 
 		if (seq->flag & SEQ_USE_TRANSFORM) {
-			dx = context.scene->r.xsch;
-			dy = context.scene->r.ysch;
+			if (is_preprocessed) {
+				dx = context.rectx;
+				dy = context.recty;
+			} else {
+				dx = context.scene->r.xsch;
+				dy = context.scene->r.ysch;
+			}
 		}
 
-		if (c.top + c.bottom >= ibuf->y || c.left + c.right >= ibuf->x ||
-				t.xofs >= dx || t.yofs >= dy) {
+		if (c.top+c.bottom >= ibuf->y || c.left+c.right >= ibuf->x ||
+		    t.xofs >= dx || t.yofs >= dy) {
 			make_black_ibuf(ibuf);
 		} else {
-			ImBuf * i = IMB_allocImBuf(dx, dy,32, ibuf->rect_float ? IB_rectfloat : IB_rect);
+			ImBuf * i = IMB_allocImBuf(
+				dx, dy, 32, 
+				ibuf->rect_float ? IB_rectfloat : IB_rect);
 
-			IMB_rectcpy(i, ibuf, t.xofs, t.yofs, c.left, c.bottom, sx, sy);
+			IMB_rectcpy(i, ibuf, 
+				    t.xofs, t.yofs, c.left, c.bottom, sx, sy);
 			
 			IMB_freeImBuf(ibuf);
 
@@ -2111,9 +2137,11 @@
 	ImBuf * ibuf = NULL;
 	char name[FILE_MAX];
 	int use_preprocess = input_have_to_preprocess(context, seq, cfra);
+	int is_proxy_image = FALSE;
 	float nr = give_stripelem_index(seq, cfra);
 	/* all effects are handled similarly with the exception of speed effect */
 	int type = (seq->type & SEQ_EFFECT && seq->type != SEQ_SPEED) ? SEQ_EFFECT : seq->type;
+	int is_preprocessed = !ELEM3(type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SCENE);
 
 	ibuf = seq_stripelem_cache_get(context, seq, cfra, SEQ_STRIPELEM_IBUF);
 
@@ -2125,8 +2153,10 @@
 	if (ibuf == NULL)
 		ibuf = copy_from_ibuf_still(context, seq, nr);
 	
-	if (ibuf == NULL)
+	if (ibuf == NULL) {
 		ibuf = seq_proxy_fetch(context, seq, cfra);
+		is_proxy_image = (ibuf != NULL);
+	}
 
 	if(ibuf == NULL) switch(type) {
 		case SEQ_META:
@@ -2148,6 +2178,7 @@
 					ibuf = i;
 				}
 			}
+
 			break;
 		}
 		case SEQ_SPEED:
@@ -2253,7 +2284,8 @@
 		use_preprocess = TRUE;
 
 	if (use_preprocess)
-		ibuf = input_preprocess(context, seq, cfra, ibuf);
+		ibuf = input_preprocess(context, seq, cfra, ibuf, 
+					is_proxy_image, is_preprocessed);
 
 	seq_stripelem_cache_put(context, seq, cfra, SEQ_STRIPELEM_IBUF, ibuf);
 




More information about the Bf-blender-cvs mailing list