[Bf-blender-cvs] [2f08906c476] master: Tracking: Cleanup, replace clip user with frame number

Sergey Sharybin noreply at git.blender.org
Mon Nov 30 14:49:54 CET 2020


Commit: 2f08906c4766f84685365ee681d04649c9ca13c5
Author: Sergey Sharybin
Date:   Mon Nov 30 14:44:51 2020 +0100
Branches: master
https://developer.blender.org/rB2f08906c4766f84685365ee681d04649c9ca13c5

Tracking: Cleanup, replace clip user with frame number

Makes it more clear from intent and usage point of view.
The user was not used for anything else than frame number.

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

M	source/blender/blenkernel/intern/tracking_auto.c

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

diff --git a/source/blender/blenkernel/intern/tracking_auto.c b/source/blender/blenkernel/intern/tracking_auto.c
index 875299059da..995e25a1536 100644
--- a/source/blender/blenkernel/intern/tracking_auto.c
+++ b/source/blender/blenkernel/intern/tracking_auto.c
@@ -62,6 +62,10 @@ typedef struct AutoTrackContext {
    * NOTE: Measured in scene time frames, */
   int start_scene_frame;
 
+  /* Scene frame number from which tracker will perform the trackign step.
+   * The direction of the step is denoted by `is_backwards`. */
+  int current_scene_frame;
+
   /* True when tracking backwards (from higher frame number to lower frame number.) */
   bool is_backwards;
 
@@ -87,7 +91,6 @@ typedef struct AutoTrackContext {
   int num_input_tracks;
   MovieTrackingTrack **input_tracks;
 
-  MovieClipUser user;
   int frame_width, frame_height;
 
   struct libmv_AutoTrack *autotrack;
@@ -368,9 +371,7 @@ AutoTrackContext *BKE_autotrack_context_new(MovieClip *clip,
   /* TODO(sergey): Currently using only a single clip. */
   context->clips[0] = clip;
   context->num_clips = 1;
-  context->user = *user;
-  context->user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
-  context->user.render_flag = 0;
+  context->current_scene_frame = user->framenr;
   context->frame_width = frame_width;
   context->frame_height = frame_height;
   context->is_backwards = is_backwards;
@@ -413,7 +414,7 @@ static void autotrack_context_step_cb(void *__restrict userdata,
   libmv_TrackRegionResult libmv_result;
 
   MovieClip *clip = context->clips[clip_index];
-  const int frame = BKE_movieclip_remap_scene_to_clip_frame(clip, context->user.framenr);
+  const int frame = BKE_movieclip_remap_scene_to_clip_frame(clip, context->current_scene_frame);
   BLI_spin_lock(&context->spin_lock);
   const bool has_marker = libmv_autoTrackGetMarker(
       context->autotrack, clip_index, frame, track_index, &libmv_current_marker);
@@ -478,7 +479,7 @@ bool BKE_autotrack_context_step(AutoTrackContext *context)
 
   /* Advance the frame. */
   BLI_spin_lock(&context->spin_lock);
-  context->user.framenr += frame_delta;
+  context->current_scene_frame += frame_delta;
   BLI_spin_unlock(&context->spin_lock);
   return context->step_ok;
 }
@@ -488,7 +489,7 @@ void BKE_autotrack_context_sync(AutoTrackContext *context)
   int newframe, frame_delta = context->is_backwards ? -1 : 1;
 
   BLI_spin_lock(&context->spin_lock);
-  newframe = context->user.framenr;
+  newframe = context->current_scene_frame;
   for (int frame = context->sync_frame;
        frame != (context->is_backwards ? newframe - 1 : newframe + 1);
        frame += frame_delta) {



More information about the Bf-blender-cvs mailing list