Blender V4.3
tracking_auto.cc File Reference
#include <cstdlib>
#include "MEM_guardedalloc.h"
#include "DNA_movieclip_types.h"
#include "DNA_object_types.h"
#include "BLI_listbase.h"
#include "BLI_math_vector.h"
#include "BLI_task.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "libmv-capi.h"
#include "tracking_private.h"

Go to the source code of this file.

Classes

struct  AutoTrackClip
 
struct  AutoTrackTrack
 
struct  AutoTrackMarker
 
struct  AutoTrackTrackingResult
 
struct  AutoTrackContext
 
struct  AutoTrackTLS
 

Functions

Marker coordinate system conversion.
static void normalized_to_libmv_frame (const float normalized[2], const int frame_dimensions[2], float result[2])
 
static void normalized_relative_to_libmv_frame (const float normalized[2], const float origin[2], const int frame_dimensions[2], float result[2])
 
static void libmv_frame_to_normalized (const float frame_coord[2], const int frame_dimensions[2], float result[2])
 
static void libmv_frame_to_normalized_relative (const float frame_coord[2], const float origin[2], const int frame_dimensions[2], float result[2])
 
Conversion of markers between Blender's DNA and Libmv.
static libmv_Marker dna_marker_to_libmv_marker (MovieTrackingTrack &track, const MovieTrackingMarker &marker, const int clip, const int track_index, const int frame_width, const int frame_height, const bool backwards)
 
static MovieTrackingMarker libmv_marker_to_dna_marker (const libmv_Marker &libmv_marker, const int frame_width, const int frame_height)
 
General helpers.

TODO(sergey): Should be moved to tracking_util.cc.

static bool tracking_check_marker_margin (const libmv_Marker &libmv_marker, const int margin, const int frame_width, const int frame_height)
 
Auto-Track Context Initialization
static bool autotrack_is_marker_usable (const MovieTrackingMarker &marker)
 
static bool autotrack_is_track_trackable (const AutoTrackContext *context, const AutoTrackTrack *autotrack_track)
 
static void autotrack_context_init_clips (AutoTrackContext *context, MovieClip *clip, MovieClipUser *user)
 
static void autotrack_context_init_tracks_for_clip (AutoTrackContext *context, int clip_index)
 
static void autotrack_context_init_tracks (AutoTrackContext *context)
 
static void autotrack_context_init_image_accessor (AutoTrackContext *context)
 
static size_t autotrack_count_all_usable_markers (AutoTrackContext *context)
 
static int autotrack_count_trackable_markers (AutoTrackContext *context)
 
static void autotrack_context_init_autotrack (AutoTrackContext *context)
 
static void autotrack_context_init_markers (AutoTrackContext *context)
 
AutoTrackContextBKE_autotrack_context_new (MovieClip *clip, MovieClipUser *user, const bool is_backwards)
 
Context tracking start.

Called from possible job once before performing tracking steps.

static void reference_keyframed_image_buffers (AutoTrackContext *context)
 
void BKE_autotrack_context_start (AutoTrackContext *context)
 
Threaded context step (tracking process).
static void autotrack_context_step_cb (void *__restrict userdata, const int marker_index, const TaskParallelTLS *__restrict tls)
 
static void autotrack_context_reduce (const void *__restrict, void *__restrict chunk_join, void *__restrict chunk)
 
bool BKE_autotrack_context_step (AutoTrackContext *context)
 
Context data synchronization.

Used to copy tracking result to Blender side, while the tracking is still happening in its thread.

void BKE_autotrack_context_sync (AutoTrackContext *context)
 
void BKE_autotrack_context_sync_user (AutoTrackContext *context, MovieClipUser *user)
 
Finalization.
void BKE_autotrack_context_finish (AutoTrackContext *context)
 
static void release_keyframed_image_buffers (AutoTrackContext *context)
 
void BKE_autotrack_context_free (AutoTrackContext *context)
 

Function Documentation

◆ autotrack_context_init_autotrack()

◆ autotrack_context_init_clips()

static void autotrack_context_init_clips ( AutoTrackContext * context,
MovieClip * clip,
MovieClipUser * user )
static

Definition at line 341 of file tracking_auto.cc.

References BKE_movieclip_get_size().

Referenced by BKE_autotrack_context_new().

◆ autotrack_context_init_image_accessor()

static void autotrack_context_init_image_accessor ( AutoTrackContext * context)
static

◆ autotrack_context_init_markers()

◆ autotrack_context_init_tracks()

static void autotrack_context_init_tracks ( AutoTrackContext * context)
static

Definition at line 390 of file tracking_auto.cc.

References autotrack_context_init_tracks_for_clip(), and BLI_assert.

Referenced by BKE_autotrack_context_new().

◆ autotrack_context_init_tracks_for_clip()

◆ autotrack_context_reduce()

static void autotrack_context_reduce ( const void * __restrict,
void *__restrict chunk_join,
void *__restrict chunk )
static

◆ autotrack_context_step_cb()

◆ autotrack_count_all_usable_markers()

static size_t autotrack_count_all_usable_markers ( AutoTrackContext * context)
static

◆ autotrack_count_trackable_markers()

static int autotrack_count_trackable_markers ( AutoTrackContext * context)
static

Definition at line 442 of file tracking_auto.cc.

References AutoTrackTrack::is_trackable.

Referenced by autotrack_context_init_markers().

◆ autotrack_is_marker_usable()

static bool autotrack_is_marker_usable ( const MovieTrackingMarker & marker)
static

◆ autotrack_is_track_trackable()

◆ BKE_autotrack_context_finish()

◆ BKE_autotrack_context_free()

◆ BKE_autotrack_context_new()

◆ BKE_autotrack_context_start()

void BKE_autotrack_context_start ( AutoTrackContext * context)

Definition at line 610 of file tracking_auto.cc.

References reference_keyframed_image_buffers().

Referenced by track_markers_startjob().

◆ BKE_autotrack_context_step()

◆ BKE_autotrack_context_sync()

◆ BKE_autotrack_context_sync_user()

void BKE_autotrack_context_sync_user ( AutoTrackContext * context,
MovieClipUser * user )

Definition at line 822 of file tracking_auto.cc.

References MovieClipUser::framenr.

Referenced by clip_main_region_draw().

◆ dna_marker_to_libmv_marker()

◆ libmv_frame_to_normalized()

static void libmv_frame_to_normalized ( const float frame_coord[2],
const int frame_dimensions[2],
float result[2] )
static

Definition at line 156 of file tracking_auto.cc.

Referenced by libmv_marker_to_dna_marker().

◆ libmv_frame_to_normalized_relative()

static void libmv_frame_to_normalized_relative ( const float frame_coord[2],
const float origin[2],
const int frame_dimensions[2],
float result[2] )
static

Definition at line 164 of file tracking_auto.cc.

Referenced by libmv_marker_to_dna_marker().

◆ libmv_marker_to_dna_marker()

◆ normalized_relative_to_libmv_frame()

static void normalized_relative_to_libmv_frame ( const float normalized[2],
const float origin[2],
const int frame_dimensions[2],
float result[2] )
static

Definition at line 147 of file tracking_auto.cc.

References normalized().

Referenced by dna_marker_to_libmv_marker().

◆ normalized_to_libmv_frame()

static void normalized_to_libmv_frame ( const float normalized[2],
const int frame_dimensions[2],
float result[2] )
static

Definition at line 139 of file tracking_auto.cc.

References normalized().

Referenced by dna_marker_to_libmv_marker().

◆ reference_keyframed_image_buffers()

◆ release_keyframed_image_buffers()

static void release_keyframed_image_buffers ( AutoTrackContext * context)
static

Definition at line 864 of file tracking_auto.cc.

References IMB_freeImBuf(), MEM_freeN(), and ImBuf::userflags.

Referenced by BKE_autotrack_context_free().

◆ tracking_check_marker_margin()

static bool tracking_check_marker_margin ( const libmv_Marker & libmv_marker,
const int margin,
const int frame_width,
const int frame_height )
static