diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/tracking.c | 32 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 6 |
3 files changed, 27 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index f9cd1b2a6c5..de4846e1772 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -1243,7 +1243,6 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip scopes->track_disabled = false; if (ibuf && (ibuf->rect || ibuf->rect_float)) { - ImBuf *search_ibuf; MovieTrackingMarker undist_marker = *marker; if (user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT) { @@ -1261,16 +1260,7 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip undist_marker.pos[1] /= height * aspy; } - search_ibuf = BKE_tracking_get_search_imbuf(ibuf, track, &undist_marker, true, true); - - if (search_ibuf) { - if (!search_ibuf->rect_float) { - /* sampling happens in float buffer */ - IMB_float_from_rect(search_ibuf); - } - - scopes->track_search = search_ibuf; - } + scopes->track_search = BKE_tracking_get_search_imbuf(ibuf, track, &undist_marker, true, true); scopes->undist_marker = undist_marker; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index a96960c0345..8434fde3005 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1981,11 +1981,9 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, ImBuf *sea if (num_samples_x <= 0 || num_samples_y <= 0) return NULL; - pattern_ibuf = IMB_allocImBuf(num_samples_x, num_samples_y, 32, IB_rectfloat); - - if (!search_ibuf->rect_float) { - IMB_float_from_rect(search_ibuf); - } + pattern_ibuf = IMB_allocImBuf(num_samples_x, num_samples_y, + 32, + search_ibuf->rect_float ? IB_rectfloat : IB_rect); tracking_get_marker_coords_for_tracking(frame_width, frame_height, marker, src_pixel_x, src_pixel_y); @@ -2015,10 +2013,26 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, ImBuf *sea mask = BKE_tracking_track_get_mask(frame_width, frame_height, track, marker); } - libmv_samplePlanarPatch(search_ibuf->rect_float, search_ibuf->x, search_ibuf->y, 4, - src_pixel_x, src_pixel_y, num_samples_x, - num_samples_y, mask, pattern_ibuf->rect_float, - &warped_position_x, &warped_position_y); + if (search_ibuf->rect_float) { + libmv_samplePlanarPatch(search_ibuf->rect_float, + search_ibuf->x, search_ibuf->y, 4, + src_pixel_x, src_pixel_y, + num_samples_x, num_samples_y, + mask, + pattern_ibuf->rect_float, + &warped_position_x, + &warped_position_y); + } + else { + libmv_samplePlanarPatchByte((unsigned char *) search_ibuf->rect, + search_ibuf->x, search_ibuf->y, 4, + src_pixel_x, src_pixel_y, + num_samples_x, num_samples_y, + mask, + (unsigned char *) pattern_ibuf->rect, + &warped_position_x, + &warped_position_y); + } if (pos) { pos[0] = warped_position_x; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 42ee3681297..85c82efc347 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1522,9 +1522,9 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc IMB_freeImBuf(scopes->track_preview); tmpibuf = BKE_tracking_sample_pattern(scopes->frame_width, scopes->frame_height, - scopes->track_search, scopes->track, - &scopes->undist_marker, true, scopes->use_track_mask, - width, height, scopes->track_pos); + scopes->track_search, scopes->track, + &scopes->undist_marker, true, scopes->use_track_mask, + width, height, scopes->track_pos); if (tmpibuf) { if (tmpibuf->rect_float) |