diff options
Diffstat (limited to 'source')
6 files changed, 16 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 52c9ec4cb59..68adb599c6c 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -773,6 +773,7 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int float tloc[2], tscale, tangle; short proxy = IMB_PROXY_NONE; int render_flag = 0; + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, framenr); if (clip->flag & MCLIP_USE_PROXY) { proxy = rendersize_to_proxy(user, clip->flag); @@ -799,7 +800,7 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int stableibuf = cache->stabilized.ibuf; - BKE_tracking_stabilization_data_get(&clip->tracking, framenr, stableibuf->x, stableibuf->y, tloc, &tscale, &tangle); + BKE_tracking_stabilization_data_get(&clip->tracking, clip_framenr, stableibuf->x, stableibuf->y, tloc, &tscale, &tangle); /* check for stabilization parameters */ if (tscale != cache->stabilized.scale || @@ -821,11 +822,12 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user MovieTracking *tracking = &clip->tracking; ImBuf *stableibuf; float tloc[2], tscale, tangle; + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, framenr); if (cache->stabilized.ibuf) IMB_freeImBuf(cache->stabilized.ibuf); - stableibuf = BKE_tracking_stabilize_frame(&clip->tracking, framenr, ibuf, tloc, &tscale, &tangle); + stableibuf = BKE_tracking_stabilize_frame(&clip->tracking, clip_framenr, ibuf, tloc, &tscale, &tangle); cache->stabilized.ibuf = stableibuf; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 43fe94d625b..dfe71c48536 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -3301,6 +3301,7 @@ static ImBuf *stabilization_allocate_ibuf(ImBuf *cacheibuf, ImBuf *srcibuf, int return cacheibuf; } +/* NOTE: frame number should be in clip space, not scene space */ void BKE_tracking_stabilization_data_get(MovieTracking *tracking, int framenr, int width, int height, float loc[2], float *scale, float *angle) { @@ -3340,6 +3341,7 @@ void BKE_tracking_stabilization_data_get(MovieTracking *tracking, int framenr, i } } +/* NOTE: frame number should be in clip space, not scene space */ ImBuf *BKE_tracking_stabilize_frame(MovieTracking *tracking, int framenr, ImBuf *ibuf, float loc[2], float *scale, float *angle) { diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.cpp b/source/blender/compositor/nodes/COM_MovieClipNode.cpp index 6a325d7d885..083d1bf42b9 100644 --- a/source/blender/compositor/nodes/COM_MovieClipNode.cpp +++ b/source/blender/compositor/nodes/COM_MovieClipNode.cpp @@ -91,7 +91,9 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex if (ibuf) { if (stab->flag&TRACKING_2D_STABILIZATION) { - BKE_tracking_stabilization_data_get(&movieClip->tracking, context->getFramenumber(), ibuf->x, ibuf->y, loc, &scale, &angle); + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movieClip, context->getFramenumber()); + + BKE_tracking_stabilization_data_get(&movieClip->tracking, clip_framenr, ibuf->x, ibuf->y, loc, &scale, &angle); } } diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp index 5a2e58d6b21..d9f9801e2e1 100644 --- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp @@ -23,6 +23,7 @@ #include "COM_MovieClipAttributeOperation.h" extern "C" { #include "BKE_tracking.h" + #include "BKE_movieclip.h" } MovieClipAttributeOperation::MovieClipAttributeOperation(): NodeOperation() { @@ -41,7 +42,8 @@ void MovieClipAttributeOperation::executePixel(float *outputValue, float x, floa scale = 1.0f; angle = 0.0f; if (clip) { - BKE_tracking_stabilization_data_get(&clip->tracking, framenumber, getWidth(), getHeight(), loc, &scale, &angle); + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, framenumber); + BKE_tracking_stabilization_data_get(&clip->tracking, clip_framenr, getWidth(), getHeight(), loc, &scale, &angle); } switch (this->attribute) { case MCA_SCALE: diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.c b/source/blender/nodes/composite/nodes/node_composite_movieclip.c index dfd36c3990a..e8f09ae08d7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_movieclip.c +++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.c @@ -120,8 +120,9 @@ static void node_composit_exec_movieclip(void *data, bNode *node, bNodeStack **U if (stab->flag & TRACKING_2D_STABILIZATION) { float loc[2], scale, angle; + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, rd->cfra); - BKE_tracking_stabilization_data_get(&clip->tracking, rd->cfra, stackbuf->x, stackbuf->y, + BKE_tracking_stabilization_data_get(&clip->tracking, clip_framenr, stackbuf->x, stackbuf->y, loc, &scale, &angle); out[1]->vec[0] = loc[0]; diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c index 44582d6de33..fabdf8c0536 100644 --- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c +++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c @@ -53,8 +53,9 @@ static void node_composit_exec_stabilize2d(void *data, bNode *node, bNodeStack * CompBuf *cbuf = typecheck_compbuf(in[0]->data, CB_RGBA); CompBuf *stackbuf; float loc[2], scale, angle; + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, rd->cfra); - BKE_tracking_stabilization_data_get(&clip->tracking, rd->cfra, cbuf->x, cbuf->y, loc, &scale, &angle); + BKE_tracking_stabilization_data_get(&clip->tracking, clip_framenr, cbuf->x, cbuf->y, loc, &scale, &angle); stackbuf = node_composit_transform(cbuf, loc[0], loc[1], angle, scale, node->custom1); |