| 2279 | } // namespace |
| 2280 | |
| 2281 | int main(int argc, char* argv[]) { |
| 2282 | try { |
| 2283 | const BenchmarkOptions options = ParseOptions(argc, argv); |
| 2284 | |
| 2285 | std::cout << "OpenShot Vulkan Benchmark\n"; |
| 2286 | std::cout << "video=" << options.video_path << "\n"; |
| 2287 | std::cout << "overlay=" << options.overlay_path << "\n"; |
| 2288 | std::cout << "vaapi_device=" << options.vaapi_device << "\n"; |
| 2289 | std::cout << "frames=" << options.max_frames << "\n"; |
| 2290 | std::cout << "mode=" << options.mode << "\n"; |
| 2291 | if (!options.dump_dir.empty()) |
| 2292 | std::cout << "dump_dir=" << options.dump_dir << " dump_every=" << options.dump_every << "\n"; |
| 2293 | if (!options.row_name.empty()) |
| 2294 | std::cout << "row=" << options.row_name << "\n"; |
| 2295 | if (options.output_width > 0 && options.output_height > 0) { |
| 2296 | std::cout << "output=" << options.output_width << "x" << options.output_height << "\n"; |
| 2297 | } else if (options.mode == "preview") { |
| 2298 | std::cout << "output=fit-" << options.preview_width << "x" << options.preview_height << "\n"; |
| 2299 | } else { |
| 2300 | std::cout << "output=input-size\n"; |
| 2301 | } |
| 2302 | |
| 2303 | const VulkanSummary summary = QueryVulkanSummary(); |
| 2304 | PrintVulkanSummary(summary); |
| 2305 | const BackendAvailability backends = ProbeBackends(options); |
| 2306 | std::cout << "backend_probe:" |
| 2307 | << " vaapi=" << (backends.vaapi ? "yes" : "no") |
| 2308 | << " cuda=" << (backends.cuda ? "yes" : "no") |
| 2309 | << " vulkan_runtime=" << (backends.vulkan_runtime ? "yes" : "no") |
| 2310 | << "\n"; |
| 2311 | |
| 2312 | const QImage overlay_image = LoadOverlayImage(options); |
| 2313 | std::vector<BenchmarkResult> results; |
| 2314 | auto row_enabled = [&](const std::string& name) { |
| 2315 | return options.row_name.empty() || options.row_name == name; |
| 2316 | }; |
| 2317 | auto run_row = [&](BenchmarkResult (*fn)(const BenchmarkOptions&, const QImage&), |
| 2318 | const std::string& fallback_name) { |
| 2319 | if (!row_enabled(fallback_name)) |
| 2320 | return; |
| 2321 | try { |
| 2322 | results.push_back(fn(options, overlay_image)); |
| 2323 | } catch (const std::exception& exc) { |
| 2324 | BenchmarkResult failed; |
| 2325 | failed.name = fallback_name; |
| 2326 | failed.decode_backend = "n/a"; |
| 2327 | failed.composite_backend = "n/a"; |
| 2328 | failed.note = std::string("skipped: ") + exc.what(); |
| 2329 | failed.skipped = true; |
| 2330 | results.push_back(failed); |
| 2331 | } |
| 2332 | }; |
| 2333 | auto run_custom_row = [&](auto builder, const std::string& fallback_name) { |
| 2334 | if (!row_enabled(fallback_name)) |
| 2335 | return; |
| 2336 | try { |
| 2337 | results.push_back(builder()); |
| 2338 | } catch (const std::exception& exc) { |
nothing calls this directly
no test coverage detected