[Bf-blender-cvs] [9c99292a16d] master: Fix T54117 Movie clip undistorted - proxy not working Add movieclip fallback render option, for case, when proxies are not enabled or built

Richard Antalik noreply at git.blender.org
Mon Mar 18 21:11:54 CET 2019


Commit: 9c99292a16df35a5d244606cc49e06949a4ef535
Author: Richard Antalik
Date:   Mon Mar 18 12:01:40 2019 -0700
Branches: master
https://developer.blender.org/rB9c99292a16df35a5d244606cc49e06949a4ef535

Fix T54117 Movie clip undistorted - proxy not working
Add movieclip fallback render option, for case, when proxies are not enabled or built

Reviewers: sergey

Differential Revision: https://developer.blender.org/D4219

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

M	source/blender/blenkernel/intern/movieclip.c
M	source/blender/blenkernel/intern/sequencer.c
M	source/blender/makesdna/DNA_movieclip_types.h

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

diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index e4d7af555ed..d4d5a696128 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -832,24 +832,24 @@ static ImBuf *get_undistorted_ibuf(MovieClip *clip,
 	return undistibuf;
 }
 
-static int need_undistortion_postprocess(const MovieClipUser *user)
-{
-	int result = 0;
-
-	/* only full undistorted render can be used as on-fly undistorting image */
-	result |= (user->render_size == MCLIP_PROXY_RENDER_SIZE_FULL) &&
+static bool need_undistortion_postprocess(const MovieClipUser *user, int clip_flag)
+{
+	bool result = 0;
+	const bool uses_full_frame =
+	        ((clip_flag & MCLIP_USE_PROXY) == 0) ||
+	        (user->render_size == MCLIP_PROXY_RENDER_SIZE_FULL);
+	/* Only full undistorted render can be used as on-fly undistorting image. */
+	result |= uses_full_frame &&
 	          (user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT) != 0;
-
 	return result;
 }
 
-static int need_postprocessed_frame(const MovieClipUser *user,
-                                    int postprocess_flag)
+static bool need_postprocessed_frame(const MovieClipUser *user,
+                                     int clip_flag,
+                                     int postprocess_flag)
 {
-	int result = postprocess_flag;
-
-	result |= need_undistortion_postprocess(user);
-
+	bool result = (postprocess_flag != 0);
+	result |= need_undistortion_postprocess(user, clip_flag);
 	return result;
 }
 
@@ -908,7 +908,7 @@ static ImBuf *get_postprocessed_cached_frame(const MovieClip *clip,
 	if (cache->postprocessed.flag != postprocess_flag)
 		return NULL;
 
-	if (need_undistortion_postprocess(user)) {
+	if (need_undistortion_postprocess(user, flag)) {
 		if (!check_undistortion_cache_flags(clip))
 			return NULL;
 	}
@@ -923,11 +923,12 @@ static ImBuf *get_postprocessed_cached_frame(const MovieClip *clip,
 static ImBuf *postprocess_frame(MovieClip *clip,
                                 const MovieClipUser *user,
                                 ImBuf *ibuf,
+                                int flag,
                                 int postprocess_flag)
 {
 	ImBuf *postproc_ibuf = NULL;
 
-	if (need_undistortion_postprocess(user)) {
+	if (need_undistortion_postprocess(user, flag)) {
 		postproc_ibuf = get_undistorted_ibuf(clip, NULL, ibuf);
 	}
 	else {
@@ -968,7 +969,7 @@ static void put_postprocessed_frame_to_cache(MovieClip *clip,
 		cache->postprocessed.render_flag = 0;
 	}
 
-	if (need_undistortion_postprocess(user)) {
+	if (need_undistortion_postprocess(user, flag)) {
 		cache->postprocessed.distortion_model = camera->distortion_model;
 		copy_v2_v2(cache->postprocessed.principal, camera->principal);
 		copy_v3_v3(&cache->postprocessed.polynomial_k1, &camera->k1);
@@ -1002,7 +1003,7 @@ static ImBuf *movieclip_get_postprocessed_ibuf(MovieClip *clip,
 	BLI_thread_lock(LOCK_MOVIECLIP);
 
 	/* try to obtain cached postprocessed frame first */
-	if (need_postprocessed_frame(user, postprocess_flag)) {
+	if (need_postprocessed_frame(user, flag, postprocess_flag)) {
 		ibuf = get_postprocessed_cached_frame(clip, user, flag, postprocess_flag);
 
 		if (!ibuf)
@@ -1038,7 +1039,7 @@ static ImBuf *movieclip_get_postprocessed_ibuf(MovieClip *clip,
 		/* postprocess frame and put to cache if needed*/
 		if (need_postprocess) {
 			ImBuf *tmpibuf = ibuf;
-			ibuf = postprocess_frame(clip, user, tmpibuf, postprocess_flag);
+			ibuf = postprocess_frame(clip, user, tmpibuf, flag, postprocess_flag);
 			IMB_freeImBuf(tmpibuf);
 			if (ibuf && (cache_flag & MOVIECLIP_CACHE_SKIP) == 0) {
 				put_postprocessed_frame_to_cache(clip, user, ibuf, flag, postprocess_flag);
@@ -1048,6 +1049,17 @@ static ImBuf *movieclip_get_postprocessed_ibuf(MovieClip *clip,
 
 	BLI_thread_unlock(LOCK_MOVIECLIP);
 
+	/* Fallback render in case proxies are not enabled or built */
+	if (!ibuf &&
+		user->render_flag & MCLIP_PROXY_RENDER_USE_FALLBACK_RENDER &&
+		user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL)
+	{
+		MovieClipUser user_fallback = *user;
+		user_fallback.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
+
+		ibuf = movieclip_get_postprocessed_ibuf(clip, &user_fallback, flag, postprocess_flag, cache_flag);
+	}
+
 	return ibuf;
 }
 
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index f9a1eed0ba7..9609a4ab1f4 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -3060,8 +3060,9 @@ static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, Sequence
 
 	BKE_movieclip_user_set_frame(&user, nr + seq->anim_startofs + seq->clip->start_frame);
 
-	user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
+	user.render_flag |= MCLIP_PROXY_RENDER_USE_FALLBACK_RENDER;
 
+	user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
 	switch (seq_rendersize_to_proxysize(context->preview_render_size)) {
 		case IMB_PROXY_NONE:
 			user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
@@ -3081,14 +3082,14 @@ static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, Sequence
 	}
 
 	if (seq->clip_flag & SEQ_MOVIECLIP_RENDER_UNDISTORTED) {
-		user.render_flag = MCLIP_PROXY_RENDER_UNDISTORT;
+		user.render_flag |= MCLIP_PROXY_RENDER_UNDISTORT;
 	}
 
 	if (seq->clip_flag & SEQ_MOVIECLIP_RENDER_STABILIZED) {
 		ibuf = BKE_movieclip_get_stable_ibuf(seq->clip, &user, tloc, &tscale, &tangle, 0);
 	}
 	else {
-		ibuf = BKE_movieclip_get_ibuf_flag(seq->clip, &user, 0, MOVIECLIP_CACHE_SKIP);
+		ibuf = BKE_movieclip_get_ibuf_flag(seq->clip, &user, seq->clip->flag, MOVIECLIP_CACHE_SKIP);
 	}
 
 	return ibuf;
diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h
index 790b44466c5..342bad4e067 100644
--- a/source/blender/makesdna/DNA_movieclip_types.h
+++ b/source/blender/makesdna/DNA_movieclip_types.h
@@ -190,6 +190,8 @@ enum {
 /* MovieClip->render_flag */
 enum {
 	MCLIP_PROXY_RENDER_UNDISTORT = 1,
+	/** Use original, if proxy is not found. */
+	MCLIP_PROXY_RENDER_USE_FALLBACK_RENDER = 2,
 };
 
 #endif



More information about the Bf-blender-cvs mailing list