diff options
Diffstat (limited to 'source/blender/blenkernel/intern/tracking.c')
-rw-r--r-- | source/blender/blenkernel/intern/tracking.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 2ed9d992c3f..337f1b5d248 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -856,7 +856,7 @@ static void track_mask_gpencil_layer_rasterize(int frame_width, int frame_height } /* TODO: add an option to control whether AA is enabled or not */ - PLX_raskterize((float (*)[2])mask_points, stroke->totpoints, mask, mask_width, mask_height, FALSE); + PLX_raskterize((float (*)[2])mask_points, stroke->totpoints, mask, mask_width, mask_height); MEM_freeN(mask_points); } @@ -1043,14 +1043,6 @@ void BKE_tracking_marker_clamp(MovieTrackingMarker *marker, int event) } } } - else if (event == CLAMP_SEARCH_DIM) { - float dim[2]; - sub_v2_v2v2(dim, pat_max, pat_min); - for (a = 0; a < 2; a++) { - marker->search_min[a] = pat_min[a]; - marker->search_max[a] = pat_max[a]; - } - } } MovieTrackingMarker *BKE_tracking_marker_get(MovieTrackingTrack *track, int framenr) @@ -1627,7 +1619,6 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, ImBuf *sea float *mask = NULL; pattern_ibuf = IMB_allocImBuf(num_samples_x, num_samples_y, 32, IB_rectfloat); - pattern_ibuf->profile = IB_PROFILE_LINEAR_RGB; if (!search_ibuf->rect_float) { IMB_float_from_rect(search_ibuf); @@ -1722,7 +1713,6 @@ ImBuf *BKE_tracking_get_search_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, Mov h = (marker->search_max[1] - marker->search_min[1]) * ibuf->y; searchibuf = IMB_allocImBuf(w, h, 32, ibuf->rect_float ? IB_rectfloat : IB_rect); - searchibuf->profile = ibuf->profile; IMB_rectcpy(searchibuf, ibuf, 0, 0, x, y, w, h); @@ -2031,7 +2021,7 @@ static void track_context_free(void *customdata) { TrackContext *track_context = (TrackContext *)customdata; -#if WITH_LIBMV +#ifdef WITH_LIBMV if (track_context->search_area) MEM_freeN(track_context->search_area); @@ -2225,8 +2215,8 @@ static ImBuf *tracking_context_get_frame_ibuf(MovieTrackingContext *context, int return ibuf; } -MovieTrackingMarker *tracking_context_get_keyframed_marker(MovieTrackingContext *context, MovieTrackingTrack *track, - MovieTrackingMarker *marker) +static MovieTrackingMarker *tracking_context_get_keyframed_marker(MovieTrackingContext *context, MovieTrackingTrack *track, + MovieTrackingMarker *marker) { int a = marker - track->markers; MovieTrackingMarker *marker_keyed = marker; @@ -2291,9 +2281,9 @@ static ImBuf *tracking_context_get_reference_ibuf(MovieTrackingContext *context, return ibuf; } -static void track_context_update_reference(MovieTrackingContext *context, TrackContext *track_context, - MovieTrackingTrack *track, MovieTrackingMarker *marker, int curfra, - int frame_width, int frame_height) +static int track_context_update_reference(MovieTrackingContext *context, TrackContext *track_context, + MovieTrackingTrack *track, MovieTrackingMarker *marker, int curfra, + int frame_width, int frame_height) { MovieTrackingMarker *marker_keyed = NULL; ImBuf *reference_ibuf = NULL; @@ -2301,6 +2291,10 @@ static void track_context_update_reference(MovieTrackingContext *context, TrackC /* calculate patch for keyframed position */ reference_ibuf = tracking_context_get_reference_ibuf(context, track, marker, curfra, &marker_keyed); + + if (!reference_ibuf) + return FALSE; + track_context->marker = *marker_keyed; if (track_context->search_area) { @@ -2319,6 +2313,8 @@ static void track_context_update_reference(MovieTrackingContext *context, TrackC } IMB_freeImBuf(reference_ibuf); + + return TRUE; } static void tracking_configure_tracker(TrackContext *track_context, MovieTrackingTrack *track, @@ -2483,8 +2479,12 @@ int BKE_tracking_context_step(MovieTrackingContext *context) float *patch_new; if (need_readjust) { - track_context_update_reference(context, track_context, track, marker, - curfra, frame_width, frame_height); + if (track_context_update_reference(context, track_context, track, marker, + curfra, frame_width, frame_height) == FALSE) + { + /* happens when reference frame fails to be loaded */ + continue; + } } /* for now track to the same search area dimension as marker has got for current frame @@ -2778,7 +2778,7 @@ static int reconstruct_count_tracks_on_both_keyframes(MovieTracking *tracking, L int BKE_tracking_reconstruction_check(MovieTracking *tracking, MovieTrackingObject *object, char *error_msg, int error_size) { -#if WITH_LIBMV +#ifdef WITH_LIBMV ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, object); if (tracking->settings.motion_flag & TRACKING_MOTION_MODAL) { @@ -3317,7 +3317,6 @@ static ImBuf *stabilization_allocate_ibuf(ImBuf *cacheibuf, ImBuf *srcibuf, int } else { cacheibuf = IMB_allocImBuf(srcibuf->x, srcibuf->y, srcibuf->planes, flags); - cacheibuf->profile = srcibuf->profile; } return cacheibuf; |