diff --git a/.claude/settings.local.json b/.claude/settings.local.json index f88d38e..ad81280 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -50,7 +50,42 @@ "Bash(awk '{print \"OCR_Leak: \"$1}')", "Bash(awk 'NR==1 || NR%20==0 || NR==157 { *)", "Bash(xargs file *)", - "Bash(xargs grep *)" + "Bash(xargs grep *)", + "Bash(awk '{print \"BYTETracker heartbeat: \"$1}')", + "Bash(awk 'NR==1 || NR%30==0 || NR==352 { *)", + "Bash(awk '{for\\(i=1;i<=NF;i++\\){if\\($i~/total=/\\)print substr\\($i, index\\($i,\"=\"\\)+1\\)}}')", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{p50=int\\(c*0.50\\); p95=int\\(c*0.95\\); p99=int\\(c*0.99\\); print \"YOLO_Timing total ms: n=\"c, \"p50=\"a[p50], \"p95=\"a[p95], \"p99=\"a[p99], \"max=\"a[c-1]}')", + "Bash(awk '{for\\(i=1;i<=NF;i++\\){if\\($i~/preproc=/\\)print substr\\($i, index\\($i,\"=\"\\)+1\\)}}')", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{p50=int\\(c*0.50\\); p95=int\\(c*0.95\\); p99=int\\(c*0.99\\); print \"YOLO_Timing preproc ms: n=\"c, \"p50=\"a[p50], \"p95=\"a[p95], \"p99=\"a[p99], \"max=\"a[c-1]}')", + "Bash(awk '{for\\(i=1;i<=NF;i++\\){if\\($i~/inf=/\\)print substr\\($i, index\\($i,\"=\"\\)+1\\)}}')", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{p50=int\\(c*0.50\\); p95=int\\(c*0.95\\); p99=int\\(c*0.99\\); print \"YOLO_Timing inference ms: n=\"c, \"p50=\"a[p50], \"p95=\"a[p95], \"p99=\"a[p99], \"max=\"a[c-1]}')", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{p50=int\\(c*0.50\\); p95=int\\(c*0.95\\); p99=int\\(c*0.99\\); print \"MEDIA_Timing getImage total ms: n=\"c, \"p50=\"a[p50], \"p95=\"a[p95], \"p99=\"a[p99], \"max=\"a[c-1]}')", + "Bash(awk '{for\\(i=1;i<=NF;i++\\){if\\($i~/pull=/\\)print substr\\($i, index\\($i,\"=\"\\)+1\\)}}')", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{p50=int\\(c*0.50\\); p95=int\\(c*0.95\\); p99=int\\(c*0.99\\); print \"MEDIA_Timing pull ms: n=\"c, \"p50=\"a[p50], \"p95=\"a[p95], \"p99=\"a[p99], \"max=\"a[c-1]}')", + "Bash(awk '{for\\(i=1;i<=NF;i++\\){if\\($i~/convert=/\\)print substr\\($i, index\\($i,\"=\"\\)+1\\)}}')", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{p50=int\\(c*0.50\\); p95=int\\(c*0.95\\); p99=int\\(c*0.99\\); print \"MEDIA_Timing convert ms: n=\"c, \"p50=\"a[p50], \"p95=\"a[p95], \"p99=\"a[p99], \"max=\"a[c-1]}')", + "Bash(awk '{print $2}')", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{p50=int\\(c*0.50\\); p95=int\\(c*0.95\\); p99=int\\(c*0.99\\); print \"TRT_Slow timestamps \\(sec\\): n=\"c, \"p50=\"a[p50], \"p95=\"a[p95], \"p99=\"a[p99], \"max=\"a[c-1]}')", + "Bash(awk -F'total=' '{print $2}')", + "Bash(awk '{print $1}')", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{p50=int\\(c*0.50\\); p95=int\\(c*0.95\\); p99=int\\(c*0.99\\); print \"TRT_Slow total ms: n=\"c, \"p50=\"a[p50], \"p95=\"a[p95], \"p99=\"a[p99], \"max=\"a[c-1]}')", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{p50=int\\(c*0.50\\); p95=int\\(c*0.95\\); p99=int\\(c*0.99\\); print \"SLOW memcpy timestamps \\(sec\\): n=\"c, \"p50=\"a[p50], \"p95=\"a[p95], \"p99=\"a[p99], \"max=\"a[c-1]}')", + "Bash(awk -F. '{print int\\($1/100\\)}')", + "Bash(awk -F' ' '{print $3}')", + "Bash(awk '$1 > 200')", + "Bash(awk -F'net=' '{print $2}')", + "Bash(awk -F'bytesMB=' '{print $2}')", + "Bash(awk -F'bytesMB=' '{gsub\\(/[^0-9.]/,\"\",$2\\); print $2}')", + "Bash(awk -F'ids_tot=' '{print $2}')", + "Bash(dumpbin /symbols \"C:/Projects/CLionProjects/ANSCORE/cmake-build-release/bin/ANSCV.dll\")", + "Bash(mkdir -p \"C:/ProgramData/ANSCENTER\")", + "Bash(touch \"C:/ProgramData/ANSCENTER/ansvisdebugview.txt\")", + "Read(//c/ProgramData/ANSCENTER/**)", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{printf \"YOLO_total: n=%d p50=%.1f p95=%.1f p99=%.1f max=%.1f\\\\n\", c, a[int\\(c*0.5\\)], a[int\\(c*0.95\\)], a[int\\(c*0.99\\)], a[c-1]}')", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{printf \"YOLO_preproc: n=%d p50=%.1f p95=%.1f p99=%.1f max=%.1f\\\\n\", c, a[int\\(c*0.5\\)], a[int\\(c*0.95\\)], a[int\\(c*0.99\\)], a[c-1]}')", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{printf \"YOLO_inf: n=%d p50=%.1f p95=%.1f p99=%.1f max=%.1f\\\\n\", c, a[int\\(c*0.5\\)], a[int\\(c*0.95\\)], a[int\\(c*0.99\\)], a[c-1]}')", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{printf \"MEDIA_total: n=%d p50=%.2f p95=%.2f p99=%.2f max=%.2f\\\\n\", c, a[int\\(c*0.5\\)], a[int\\(c*0.95\\)], a[int\\(c*0.99\\)], a[c-1]}')", + "Bash(awk 'BEGIN{c=0}{a[c++]=$1}END{printf \"MEDIA_convert: n=%d p50=%.2f p95=%.2f p99=%.2f max=%.2f\\\\n\", c, a[int\\(c*0.5\\)], a[int\\(c*0.95\\)], a[int\\(c*0.99\\)], a[c-1]}')" ] } } diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b8f4af..9736bd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,19 +107,27 @@ endif() # Default: OFF. Enable with `-DANSCORE_USE_LIBYUV=ON` only after switching # the project's compiler to clang-cl / clang / gcc. option(ANSCORE_USE_LIBYUV "Use libyuv for YUV→BGR conversion (only effective on Clang/GCC, NOT MSVC)" OFF) -if(ANSCORE_USE_LIBYUV AND EXISTS "${CMAKE_SOURCE_DIR}/3rdparty/libyuv/CMakeLists.txt") - if(MSVC AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - message(WARNING "ANSCORE_USE_LIBYUV=ON but compiler is MSVC cl.exe — " - "libyuv's SIMD paths (row_gcc.cc) won't compile. " - "Expect ~10× slowdown vs cv::cvtColor. " - "Use clang-cl (LLVM) instead, or keep ANSCORE_USE_LIBYUV=OFF.") - endif() - # Prevent libyuv from finding a system libjpeg and enabling HAVE_JPEG - # (we don't use libyuv's MJPEG codepaths; avoids an unnecessary runtime dep). - set(CMAKE_DISABLE_FIND_PACKAGE_JPEG TRUE) - add_subdirectory(3rdparty/libyuv EXCLUDE_FROM_ALL) +# Prebuilt libyuv path — built separately with clang-cl so its SIMD rows compile, +# then linked into the MSVC main build (clang-cl output is MSVC-ABI-compatible). +# Override with -DANSCORE_LIBYUV_LIB= if the .lib lives elsewhere. +set(ANSCORE_LIBYUV_LIB "${CMAKE_SOURCE_DIR}/3rdparty/libyuv/build-clangcl/Release/yuv.lib" + CACHE FILEPATH "Path to the prebuilt libyuv static library (built with clang-cl)") + +if(ANSCORE_USE_LIBYUV AND EXISTS "${ANSCORE_LIBYUV_LIB}") + add_library(yuv STATIC IMPORTED GLOBAL) + set_target_properties(yuv PROPERTIES + IMPORTED_LOCATION "${ANSCORE_LIBYUV_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/3rdparty/libyuv/include") set(ANSCORE_HAS_LIBYUV ON) - message(STATUS "libyuv: ENABLED (vendored from 3rdparty/libyuv, static target 'yuv')") + message(STATUS "libyuv: ENABLED (prebuilt static lib at ${ANSCORE_LIBYUV_LIB})") +elseif(ANSCORE_USE_LIBYUV) + set(ANSCORE_HAS_LIBYUV OFF) + message(WARNING "ANSCORE_USE_LIBYUV=ON but prebuilt libyuv not found at " + "${ANSCORE_LIBYUV_LIB}. Build it first with clang-cl:\n" + " cmake -S 3rdparty/libyuv -B 3rdparty/libyuv/build-clangcl " + "-G \"Visual Studio 17 2022\" -T ClangCL -A x64\n" + " cmake --build 3rdparty/libyuv/build-clangcl --config Release\n" + "Falling back to cv::cvtColor path.") else() set(ANSCORE_HAS_LIBYUV OFF) message(STATUS "libyuv: DISABLED — using cv::cvtColor+IPP path (fast on MSVC)") diff --git a/MediaClient/media/video_player.h b/MediaClient/media/video_player.h index 8ebcb95..cf57e56 100644 --- a/MediaClient/media/video_player.h +++ b/MediaClient/media/video_player.h @@ -299,7 +299,7 @@ protected: static const int SETTLE_FRAME_COUNT = 5; // Number of clean frames before delivering new frames // Frame rate limiting — skip post-decode processing for frames beyond target interval - double m_targetIntervalMs = 100.0; // default 100ms (~10 FPS), 0 = no limit (process all frames) + double m_targetIntervalMs = 0.0; // 0 = no limit (process all frames), e.g. 100 = ~10 FPS std::chrono::steady_clock::time_point m_lastProcessedTime; // timestamp of last processed frame bool m_targetFPSInitialized = false; // first-frame flag diff --git a/modules/ANSFR/ANSFaceRecognizer.cpp b/modules/ANSFR/ANSFaceRecognizer.cpp index 8c9e21e..2ddbc70 100644 --- a/modules/ANSFR/ANSFaceRecognizer.cpp +++ b/modules/ANSFR/ANSFaceRecognizer.cpp @@ -255,8 +255,8 @@ namespace ANSCENTER { if (engineType == EngineType::NVIDIA_GPU) { optimizedModelFolder = GetParentFolder(_modelFilePath); - m_options.optBatchSize = 8; - m_options.maxBatchSize = 32; + m_options.optBatchSize = 2; + m_options.maxBatchSize = 4; m_options.engineFileDir = optimizedModelFolder; m_options.precision = fp16 ? Precision::FP16 : Precision::FP32; diff --git a/modules/ANSMOT/ByteTrackNCNN/src/NCNNRect.cpp b/modules/ANSMOT/ByteTrackNCNN/src/NCNNRect.cpp index 532b751..60a7bd8 100644 --- a/modules/ANSMOT/ByteTrackNCNN/src/NCNNRect.cpp +++ b/modules/ANSMOT/ByteTrackNCNN/src/NCNNRect.cpp @@ -124,13 +124,13 @@ float ByteTrackNCNN::Rect::calcIoU(const Rect& other) const } template -ByteTrackNCNN::Rect generate_rect_by_tlbr(const ByteTrackNCNN::Tlbr& tlbr) +ByteTrackNCNN::Rect ByteTrackNCNN::generate_rect_by_tlbr(const ByteTrackNCNN::Tlbr& tlbr) { return ByteTrackNCNN::Rect(tlbr[0], tlbr[1], tlbr[2] - tlbr[0], tlbr[3] - tlbr[1]); } template -ByteTrackNCNN::Rect generate_rect_by_xyah(const ByteTrackNCNN::Xyah& xyah) +ByteTrackNCNN::Rect ByteTrackNCNN::generate_rect_by_xyah(const ByteTrackNCNN::Xyah& xyah) { const auto width = xyah[2] * xyah[3]; return ByteTrackNCNN::Rect(xyah[0] - width / 2, xyah[1] - xyah[3] / 2, width, xyah[3]); diff --git a/tests/ANSCV-UnitTest/ANSCV-UnitTest.cpp b/tests/ANSCV-UnitTest/ANSCV-UnitTest.cpp index da22b30..42e9bd5 100644 --- a/tests/ANSCV-UnitTest/ANSCV-UnitTest.cpp +++ b/tests/ANSCV-UnitTest/ANSCV-UnitTest.cpp @@ -848,12 +848,12 @@ int RSTPTestCVClient() { int index = 0; while (true) { index++; - std::cout << "Index=" << index << std::endl; - if ((index == 200) || (index == 800) || (index == 1200)) { StopRTSP(&rtspClient); } - if ((index == 400) || (index == 1000) || (index == 1500)) { StartRTSP(&rtspClient); } + //std::cout << "Index=" << index << std::endl; + //if ((index == 200) || (index == 800) || (index == 1200)) { StopRTSP(&rtspClient); } + //if ((index == 400) || (index == 1000) || (index == 1500)) { StartRTSP(&rtspClient); } //if ((index == 1800) || (index == 2200) || (index == 2500)) { StartRTSP(&rtspClient); } //if ((index == 2000) || (index == 2300) || (index == 2700)) { StartRTSP(&rtspClient); } - if (index > 20000) break; + //if (index > 20000) break; auto start = std::chrono::system_clock::now(); cv::Mat* image = nullptr; // ✅ Use a pointer to hold the allocated image GetRTSPCVImage(&rtspClient, width, height, pts,&image);