Use software decoder by default

This commit is contained in:
2026-04-04 20:19:54 +11:00
parent 3a21026790
commit e134ebdf15
24 changed files with 693 additions and 215 deletions

View File

@@ -3,6 +3,7 @@
#include <cmath>
#include <json.hpp>
#include "ANSODEngine.h"
#include "ANSLicense.h" // ANS_DBG macro
#include "ANSYOLOOD.h"
#include "ANSTENSORRTOD.h"
#include "ANSTENSORRTCL.h"
@@ -879,6 +880,9 @@ namespace ANSCENTER
std::vector<Object> allResults;
allResults.clear();
try {
ANS_DBG("ODEngine", "SAHI START: %dx%d tile=%dx%d overlap=%.1f cam=%s",
input.cols, input.rows, tiledWidth, tiledHeight, overLap, camera_id.c_str());
auto _sahiStart = std::chrono::steady_clock::now();
cv::Mat image = input.clone();
if (image.empty() || !image.data || !image.u) {
return allResults;
@@ -920,6 +924,16 @@ namespace ANSCENTER
//4. Apply Non-Maximum Suppression (NMS) to merge overlapping results
float iouThreshold = 0.1;
std::vector<Object> finalResults = ANSUtilityHelper::ApplyNMS(allResults, iouThreshold);
{
double _sahiMs = std::chrono::duration<double, std::milli>(
std::chrono::steady_clock::now() - _sahiStart).count();
ANS_DBG("ODEngine", "SAHI DONE: %.1fms patches=%zu results=%zu cam=%s",
_sahiMs, patches.size() + 1, finalResults.size(), camera_id.c_str());
if (_sahiMs > 2000.0) {
ANS_DBG("ODEngine", "SAHI SLOW: %.1fms — %zu patches held _mutex entire time!",
_sahiMs, patches.size() + 1);
}
}
image.release();
return finalResults;
}
@@ -2103,6 +2117,8 @@ namespace ANSCENTER
// No coarse _mutex — sub-components (engines, trackers) have their own locks.
// LabVIEW semaphore controls concurrency at the caller level.
try {
ANS_DBG("ODEngine", "RunInferenceWithOption: cam=%s %dx%d mode=%s",
camera_id.c_str(), input.cols, input.rows, activeROIMode.c_str());
int mode = 0;
double confidenceThreshold = 0.35;
std::vector<int> trackingObjectIds;