Commit: 7e93d4eea3097e9e452c7c19953a01b6fab76163
Author: Sergey Sharybin
Date:   Mon Apr 6 14:47:19 2020 +0200
Branches: master
https://developer.blender.org/rB7e93d4eea3097e9e452c7c19953a01b6fab76163

Tracking: Fix (un)distortion happen in single thread

Need to communicate available number of threads to the camera
intrinsics implementation, otherwise default value of 1 is used.

Must have been single-threaded for a very long time.

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

M       intern/libmv/intern/camera_intrinsics.cc
M       intern/libmv/intern/camera_intrinsics.h
M       source/blender/blenkernel/intern/tracking_util.c

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

diff --git a/intern/libmv/intern/camera_intrinsics.cc 
b/intern/libmv/intern/camera_intrinsics.cc
index 4bd6b1270f5..89e3d0d1178 100644
--- a/intern/libmv/intern/camera_intrinsics.cc
+++ b/intern/libmv/intern/camera_intrinsics.cc
@@ -80,6 +80,8 @@ void libmv_cameraIntrinsicsUpdate(
    * are not freed.
    */
 
+  camera_intrinsics->SetThreads(libmv_camera_intrinsics_options->num_threads);
+
   if (camera_intrinsics->focal_length() != focal_length) {
     camera_intrinsics->SetFocalLength(focal_length, focal_length);
   }
diff --git a/intern/libmv/intern/camera_intrinsics.h 
b/intern/libmv/intern/camera_intrinsics.h
index 9e900892952..40a5826a9c4 100644
--- a/intern/libmv/intern/camera_intrinsics.h
+++ b/intern/libmv/intern/camera_intrinsics.h
@@ -33,6 +33,7 @@ enum {
 
 typedef struct libmv_CameraIntrinsicsOptions {
   // Common settings of all distortion models.
+  int num_threads;
   int distortion_model;
   int image_width, image_height;
   double focal_length;
diff --git a/source/blender/blenkernel/intern/tracking_util.c 
b/source/blender/blenkernel/intern/tracking_util.c
index 51758abdf3f..d7600c06a6b 100644
--- a/source/blender/blenkernel/intern/tracking_util.c
+++ b/source/blender/blenkernel/intern/tracking_util.c
@@ -35,6 +35,7 @@
 #include "BLI_math.h"
 #include "BLI_string.h"
 #include "BLI_string_utils.h"
+#include "BLI_threads.h"
 #include "BLI_utildefines.h"
 
 #include "BLT_translation.h"
@@ -442,6 +443,8 @@ void tracking_cameraIntrinscisOptionsFromTracking(
   MovieTrackingCamera *camera = &tracking->camera;
   float aspy = 1.0f / tracking->camera.pixel_aspect;
 
+  camera_intrinsics_options->num_threads = BLI_system_thread_count();
+
   camera_intrinsics_options->focal_length = camera->focal;
 
   camera_intrinsics_options->principal_point_x = camera->principal[0];

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to