40 #define strcpy strcpy_s
41 #define sprintf sprintf_s
164 char filenamebuf[1024];
188 ofstream out(filenamebuf);
194 out <<
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"
195 <<
"ncam = " << ncam <<
"; npt = " << npt <<
"; nproj = " << nproj
197 <<
"%% overhead = " << overhead <<
";\n"
198 <<
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"
200 <<
"\t linear systems solved;\n"
202 <<
"\t conjugated gradient steps;\n"
204 <<
"\t seconds used overall;\n"
206 <<
"\t seconds on pre-processing;\n"
207 <<
"%% " << std::setw(10)
210 <<
"\t seconds on upload;\n"
212 <<
"\t seconds on optimization;\n"
213 <<
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"
227 << (i % 7 == 6 ?
'\n' :
'\t');
232 std::cout <<
"\n---------------------------------------\n" << filenamebuf;
236 #define REPORT_FUNCTION_TIME(FID) \
237 std::setw(5) << (((int)(BundleTimerGet(FID) * 100 + 50)) * 0.01) << "(" \
239 << 0.1f * ((int)(1000 * BundleTimerGet(FID) / \
240 BundleTimerGet(TIMER_OPTIMIZATION))) \
247 std::cout <<
"\n---------------------------------------\n" << std::setw(10)
250 <<
"\t linear systems solved;\n" << std::setw(10)
253 <<
"\t seconds used overall;\n" << std::setw(10)
255 <<
"\t seconds on allocation;\n" << std::setw(10)
257 <<
"\t seconds on pre-processing;\n" << std::setw(10)
260 <<
"\t seconds on optimization;\n";
263 <<
"\t seconds on jacobians;\n"
265 <<
"\t seconds on projections;\n"
267 <<
"\t seconds on JX;\n"
269 <<
"\t seconds on JtE;\n"
271 <<
"\t seconds to compute preconditioner;\n"
273 <<
"\t seconds to apply preconditioner;\n"
275 <<
"\t seconds to update parameters;\n";
277 std::cout <<
"---------------------------------------\n"
281 <<
"---------------------------------------\n";
286 return clock() / double(CLOCKS_PER_SEC);
288 static int started = 0;
289 static struct timeval tstart;
291 gettimeofday(&tstart,
NULL);
296 gettimeofday(&now,
NULL);
297 return ((now.tv_usec - tstart.tv_usec) / 1000000.0 +
298 (now.tv_sec - tstart.tv_sec));
341 #define CHAR1_TO_INT(x) ((x >= 'A' && x <= 'Z') ? x + 32 : x)
342 #define CHAR2_TO_INT(str, i) \
343 (str[i] ? CHAR1_TO_INT(str[i]) + (CHAR1_TO_INT(str[i + 1]) << 8) : 0)
344 #define CHAR3_TO_INT(str, i) \
345 (str[i] ? CHAR1_TO_INT(str[i]) + (CHAR2_TO_INT(str, i + 1) << 8) : 0)
346 #define STRING_TO_INT(str) (CHAR1_TO_INT(str[0]) + (CHAR3_TO_INT(str, 1) << 8))
350 #define MAKEINT1(a) (#@ a)
351 #define sscanf sscanf_s
383 #define MAKEINT1(a) (mychar##a)
385 #define MAKEINT2(a, b) (MAKEINT1(a) + (MAKEINT1(b) << 8))
386 #define MAKEINT3(a, b, c) (MAKEINT1(a) + (MAKEINT2(b, c) << 8))
387 #define MAKEINT4(a, b, c, d) (MAKEINT1(a) + (MAKEINT3(b, c, d) << 8))
389 char *arg, *param, *opt;
392 for (
int i = 0; i < argc; i++) {
394 if (arg ==
NULL || arg[0] !=
'-' || !arg[1])
continue;
402 if (i + 1 < argc && sscanf(param,
"%d", &argi) && argi > 0)
406 if (i + 1 < argc && sscanf(param,
"%f", &argf) && argf >= 0)
410 if (i + 1 < argc && sscanf(param,
"%f", &argf) && argf >= 0)
414 if (i + 1 < argc && sscanf(param,
"%f", &argf) && argf > 0)
418 if (i + 1 < argc && sscanf(param,
"%f", &argf) && argf > 0)
422 if (i + 1 < argc && sscanf(param,
"%f", &argf) && argf > 0)
426 if (i + 1 < argc && sscanf(param,
"%f", &argf) && argf > 0)
430 if (i + 1 < argc && sscanf(param,
"%d", &argi) && argi > 0)
434 if (i + 1 < argc && sscanf(param,
"%d", &argi) && argi > 0)
438 if (i + 1 < argc && sscanf(param,
"%f", &argf) && argf > 0)
442 if (i + 1 < argc && sscanf(param,
"%f", &argf) && argf > 0)
446 if (i + 1 < argc && sscanf(param,
"%d", &argi) && argi > 0)
450 if (i + 1 < argc && sscanf(param,
"%d", &argi) && argi >= 0)
454 if (i + 1 < argc && sscanf(param,
"%d", &argi) && argi >= 0)
458 if (i + 1 < argc && sscanf(param,
"%d", &argi) && argi >= 0)
462 if (i + 1 < argc && sscanf(param,
"%d", &argi) && argi >= 0)
466 if (i + 1 < argc && sscanf(param,
"%d", &argi) && argi > 0)
519 if (i + 1 < argc && sscanf(param,
"%f", &argf) && argf > 0)
556 if (i + 1 < argc && sscanf(param,
"%f", &argf) && argf > 0)
560 if (i + 1 < argc && sscanf(param,
"%f", &argf) && argf > 0 &&
#define REPORT_FUNCTION_TIME(FID)
#define MAKEINT4(a, b, c, d)
#define STRING_TO_INT(str)
#define MAKEINT3(a, b, c)
void ParseParam(int argc, char **argv)
bool __verbose_function_time
std::vector< float > __bundle_records
bool __jacobian_normalize
bool __verbose_cg_iteration
bool __jc_store_transpose
void PrintBundleStatistics()
bool __cpu_thread_profile
int __num_camera_modified
void BundleTimerSwap(int timer1, int timer2)
bool __lm_use_diagonal_damp
bool __depth_degeneracy_fix
bool __matlab_format_stat
float __lm_delta_threshold
bool __verbose_allocation
void BundleTimerSwitch(int timer)
float __depth_check_epsilon
float __cg_norm_threshold
void SaveBundleStatistics(int ncam, int npt, int nproj)
int __use_radial_distortion
bool __cg_schur_complement
bool __accurate_gain_ratio
void SaveBundleRecord(int iter, float res, float damping, float gn, float gi)
float __data_normalize_median
const char * __driver_output
float __lm_damping_auto_switch
double __timer_record[NUM_TIMER]
float __lm_gradient_threshold
bool __reset_initial_distortion
float BundleTimerGet(int timer)
int __cg_recalculate_freq
int __num_projection_eval
int __num_cpu_thread[NUM_FUNC]
void BundleTimerStart(int timer)
bool __multiply_jx_usenoj
float BundleTimerGetNow(int timer=TIMER_OPTIMIZATION)
void ResetTemporarySetting()
int __bundle_current_mode
void ResetBundleStatistics()
bool __save_gradient_norm
bool IsTimeBudgetAvailable()
__host__ __device__ float dot(float2 a, float2 b)