Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/movieclip.c')
-rw-r--r--source/blender/blenkernel/intern/movieclip.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index c90faa7e0ca..69b32ce46f8 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -64,6 +64,7 @@
#include "BLI_mempool.h"
#include "BLI_threads.h"
+#include "BKE_animsys.h"
#include "BKE_constraint.h"
#include "BKE_library.h"
#include "BKE_global.h"
@@ -276,9 +277,10 @@ typedef struct MovieClipCache {
struct {
ImBuf *ibuf;
int framenr;
+ int postprocess_flag;
- float loc[2], scale, angle;
- int proxy;
+ float loc[2], scale, angle, aspect;
+ int proxy, filter;
short render_flag;
} stabilized;
} MovieClipCache;
@@ -701,9 +703,10 @@ ImBuf *BKE_movieclip_get_postprocessed_ibuf(MovieClip *clip, MovieClipUser *user
return movieclip_get_postprocessed_ibuf(clip, user, clip->flag, postprocess_flag, 0);
}
-static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int framenr)
+static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int framenr, int postprocess_flag)
{
MovieClipCache *cache = clip->cache;
+ MovieTracking *tracking = &clip->tracking;
ImBuf *stableibuf;
float tloc[2], tscale, tangle;
short proxy = IMB_PROXY_NONE;
@@ -722,6 +725,16 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int
if(cache->stabilized.render_flag!=render_flag || cache->stabilized.proxy!=proxy)
return NULL;
+ if(cache->stabilized.postprocess_flag != postprocess_flag)
+ return NULL;
+
+ /* stabilization also depends on pixel aspect ratio */
+ if(cache->stabilized.aspect != tracking->camera.pixel_aspect)
+ return NULL;
+
+ if(cache->stabilized.filter != tracking->stabilization.filter)
+ return NULL;
+
stableibuf = cache->stabilized.ibuf;
BKE_tracking_stabilization_data(&clip->tracking, framenr, stableibuf->x, stableibuf->y, tloc, &tscale, &tangle);
@@ -739,9 +752,11 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int
return stableibuf;
}
-static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, int framenr)
+static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf,
+ int framenr, int postprocess_flag)
{
MovieClipCache *cache = clip->cache;
+ MovieTracking *tracking = &clip->tracking;
ImBuf *stableibuf;
float tloc[2], tscale, tangle;
@@ -757,6 +772,8 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user
cache->stabilized.scale = tscale;
cache->stabilized.angle = tangle;
cache->stabilized.framenr = framenr;
+ cache->stabilized.aspect = tracking->camera.pixel_aspect;
+ cache->stabilized.filter = tracking->stabilization.filter;
if(clip->flag&MCLIP_USE_PROXY) {
cache->stabilized.proxy= rendersize_to_proxy(user, clip->flag);
@@ -767,6 +784,8 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user
cache->stabilized.render_flag = 0;
}
+ cache->stabilized.postprocess_flag = postprocess_flag;
+
IMB_refImBuf(stableibuf);
return stableibuf;
@@ -785,10 +804,10 @@ ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float
if(clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) {
MovieClipCache *cache= clip->cache;
- stableibuf= get_stable_cached_frame(clip, user, framenr);
+ stableibuf= get_stable_cached_frame(clip, user, framenr, postprocess_flag);
if(!stableibuf)
- stableibuf= put_stabilized_frame_to_cache(clip, user, ibuf, framenr);
+ stableibuf= put_stabilized_frame_to_cache(clip, user, ibuf, framenr, postprocess_flag);
if(loc) copy_v2_v2(loc, cache->stabilized.loc);
if(scale) *scale= cache->stabilized.scale;
@@ -889,6 +908,8 @@ static void free_buffers(MovieClip *clip)
IMB_free_anim(clip->anim);
clip->anim= FALSE;
}
+
+ BKE_free_animdata((ID *) clip);
}
void BKE_movieclip_reload(MovieClip *clip)