Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-04-10 19:14:36 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-04-10 19:14:36 +0400
commitdf63e8fd9331594eaef0a7897b9322533188da79 (patch)
tree36995fba9daf540803b7e6ae9baef79c1bd7d41b /source/blender/blenkernel/intern/tracking.c
parent5d63f162d596d34998b3cdb4733a7a228fcb3341 (diff)
Speedup track preview widget for byte images
This gives a huge speedup gain for cases when you've got rather huge markers on a byte images. Done by skipping IMB_float_from_rect()/IMB_rect_from_float() for such cases. We can sample the buffers without color space conversion.
Diffstat (limited to 'source/blender/blenkernel/intern/tracking.c')
-rw-r--r--source/blender/blenkernel/intern/tracking.c32
1 files changed, 23 insertions, 9 deletions
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;