| 445 | // ── Main ──────────────────────────────────────────────────────────────────── |
| 446 | |
| 447 | int main(int argc, char ** argv) { |
| 448 | std::string models_dir = "models/"; |
| 449 | std::string video_path = "data/test_video.mp4"; |
| 450 | float px = 315.0f; |
| 451 | float py = 250.0f; |
| 452 | int n_frames = 10; |
| 453 | int n_threads = 4; |
| 454 | int encode_img_size = 0; |
| 455 | bool cpu_only = false; |
| 456 | bool gpu_only = false; |
| 457 | std::string filter; |
| 458 | |
| 459 | for (int i = 1; i < argc; i++) { |
| 460 | std::string arg = argv[i]; |
| 461 | if (arg == "--models-dir" && i + 1 < argc) { models_dir = argv[++i]; } |
| 462 | else if (arg == "--video" && i + 1 < argc) { video_path = argv[++i]; } |
| 463 | else if (arg == "--point-x" && i + 1 < argc) { px = (float)atof(argv[++i]); } |
| 464 | else if (arg == "--point-y" && i + 1 < argc) { py = (float)atof(argv[++i]); } |
| 465 | else if (arg == "--n-frames" && i + 1 < argc) { n_frames = atoi(argv[++i]); } |
| 466 | else if (arg == "--n-threads" && i + 1 < argc) { n_threads = atoi(argv[++i]); } |
| 467 | else if (arg == "--encode-img-size" && i + 1 < argc) { encode_img_size = atoi(argv[++i]); } |
| 468 | else if (arg == "--cpu-only") { cpu_only = true; } |
| 469 | else if (arg == "--gpu-only") { gpu_only = true; } |
| 470 | else if (arg == "--filter" && i + 1 < argc) { filter = argv[++i]; } |
| 471 | else if (arg == "--help" || arg == "-h") { |
| 472 | fprintf(stderr, |
| 473 | "Usage: %s [options]\n" |
| 474 | " --models-dir <path> Models directory (default: models/)\n" |
| 475 | " --video <path> Video file (default: data/test_video.mp4)\n" |
| 476 | " --point-x <f> Click X (default: 315.0)\n" |
| 477 | " --point-y <f> Click Y (default: 250.0)\n" |
| 478 | " --n-frames <n> Frames to track (default: 10)\n" |
| 479 | " --n-threads <n> CPU threads (default: 4)\n" |
| 480 | " --cpu-only Skip Metal runs\n" |
| 481 | " --gpu-only Skip CPU runs\n" |
| 482 | " --filter <substr> Filter model filenames\n", |
| 483 | argv[0]); |
| 484 | return 0; |
| 485 | } else { |
| 486 | fprintf(stderr, "Unknown argument: %s\n", arg.c_str()); |
| 487 | return 1; |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | if (n_frames < 2) { |
| 492 | fprintf(stderr, "ERROR: --n-frames must be >= 2\n"); |
| 493 | return 1; |
| 494 | } |
| 495 | |
| 496 | // Discover models |
| 497 | auto entries = discover_models(models_dir, filter); |
| 498 | if (entries.empty()) { |
| 499 | fprintf(stderr, "ERROR: no .ggml files found in '%s'", models_dir.c_str()); |
| 500 | if (!filter.empty()) fprintf(stderr, " (filter: '%s')", filter.c_str()); |
| 501 | fprintf(stderr, "\n"); |
| 502 | return 1; |
| 503 | } |
| 504 |
nothing calls this directly
no test coverage detected