[Bf-blender-cvs] [f75d2fd] master: Port fix from gooseberry that doesn't load the full res file if a proxy is requested.

Antony Riakiotakis noreply at git.blender.org
Wed Feb 4 18:49:09 CET 2015


Commit: f75d2fdd24ed0a8633682dadd57ca9b9929dd4f4
Author: Antony Riakiotakis
Date:   Wed Feb 4 18:48:47 2015 +0100
Branches: master
https://developer.blender.org/rBf75d2fdd24ed0a8633682dadd57ca9b9929dd4f4

Port fix from gooseberry that doesn't load the full res file if a proxy
is requested.

===================================================================

M	source/blender/blenkernel/BKE_image.h
M	source/blender/blenkernel/intern/image.c
M	source/blender/blenkernel/intern/sequencer.c
M	source/blender/imbuf/intern/anim_movie.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index 5ee8ae2..945224f 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -91,6 +91,7 @@ void    BKE_imformat_defaults(struct ImageFormatData *im_format);
 void    BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const struct ImBuf *imbuf);
 
 struct anim *openanim(const char *name, int flags, int streamindex, char colorspace[IMA_MAX_SPACE]);
+struct anim *openanim_noload(const char *name, int flags, int streamindex, char colorspace[IMA_MAX_SPACE]);
 
 void    BKE_image_de_interlace(struct Image *ima, int odd);
 
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index b405e0a..b130372 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2107,6 +2107,14 @@ void BKE_image_path_from_imtype(
 	image_path_makepicstring(string, base, relbase, frame, imtype, NULL, use_ext, use_frames);
 }
 
+struct anim *openanim_noload(const char *name, int flags, int streamindex, char colorspace[IMA_MAX_SPACE])
+{
+	struct anim *anim;
+
+	anim = IMB_open_anim(name, flags, streamindex, colorspace);
+	return anim;
+}
+
 /* used by sequencer too */
 struct anim *openanim(const char *name, int flags, int streamindex, char colorspace[IMA_MAX_SPACE])
 {
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 4503636..dd46fdc 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1330,7 +1330,7 @@ static double seq_rendersize_to_scale_factor(int size)
 	return 0.25;
 }
 
-static void seq_open_anim_file(Sequence *seq)
+static void seq_open_anim_file(Sequence *seq, bool openfile)
 {
 	char name[FILE_MAX];
 	StripProxy *proxy;
@@ -1343,8 +1343,14 @@ static void seq_open_anim_file(Sequence *seq)
 	                 seq->strip->dir, seq->strip->stripdata->name);
 	BLI_path_abs(name, G.main->name);
 	
-	seq->anim = openanim(name, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0),
-	                     seq->streamindex, seq->strip->colorspace_settings.name);
+	if (openfile) {
+		seq->anim = openanim(name, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0),
+		                     seq->streamindex, seq->strip->colorspace_settings.name);
+	}
+	else {
+		seq->anim = openanim_noload(name, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0),
+		                            seq->streamindex, seq->strip->colorspace_settings.name);
+	}
 
 	if (seq->anim == NULL) {
 		return;
@@ -1458,7 +1464,7 @@ static ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int c
 			return NULL;
 		}
  
-		seq_open_anim_file(seq);
+		seq_open_anim_file(seq, true);
 
 		frameno = IMB_anim_index_get_frame_index(seq->anim, seq->strip->proxy->tc, frameno);
 
@@ -1560,7 +1566,7 @@ SeqIndexBuildContext *BKE_sequencer_proxy_rebuild_context(Main *bmain, Scene *sc
 	context->seq = nseq;
 
 	if (nseq->type == SEQ_TYPE_MOVIE) {
-		seq_open_anim_file(nseq);
+		seq_open_anim_file(nseq, true);
 
 		if (nseq->anim) {
 			context->index_context = IMB_anim_index_rebuild_context(nseq->anim,
@@ -2780,7 +2786,7 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, Sequence *s
 
 		case SEQ_TYPE_MOVIE:
 		{
-			seq_open_anim_file(seq);
+			seq_open_anim_file(seq, false);
 
 			if (seq->anim) {
 				IMB_Proxy_Size proxy_size = seq_rendersize_to_proxysize(context->preview_render_size);
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index b8f6e66..ffdecb7 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -1314,25 +1314,27 @@ struct ImBuf *IMB_anim_absolute(struct anim *anim, int position,
 
 	filter_y = (anim->ib_flags & IB_animdeinterlace);
 
-	if (anim->curtype == 0) {
-		ibuf = anim_getnew(anim);
-		if (ibuf == NULL) {
-			return(NULL);
+	if (preview_size == IMB_PROXY_NONE) {
+		if (anim->curtype == 0) {
+			ibuf = anim_getnew(anim);
+			if (ibuf == NULL) {
+				return(NULL);
+			}
+
+			IMB_freeImBuf(ibuf); /* ???? */
+			ibuf = NULL;
 		}
 
-		IMB_freeImBuf(ibuf); /* ???? */
-		ibuf = NULL;
+		if (position < 0) return(NULL);
+		if (position >= anim->duration) return(NULL);
 	}
-
-	if (position < 0) return(NULL);
-	if (position >= anim->duration) return(NULL);
-
-	if (preview_size != IMB_PROXY_NONE) {
+	else {
 		struct anim *proxy = IMB_anim_open_proxy(anim, preview_size);
 
 		if (proxy) {
 			position = IMB_anim_index_get_frame_index(
 			    anim, tc, position);
+
 			return IMB_anim_absolute(
 			           proxy, position,
 			           IMB_TC_NONE, IMB_PROXY_NONE);




More information about the Bf-blender-cvs mailing list