6 Commits

Author SHA1 Message Date
9f0a10a4c8 Improve ANSCV with sotfware decoder:
Thread-local staging Mat (video_player.cpp:1400-1407) — single biggest win. Eliminates the 12 MB per-call malloc/free cycle.
Contiguous get_buffer2 allocator (video_decoder.cpp:35-102) — keeps the 3 bulk memcpys cache-friendly. Would also enable FAST/zero-copy for resolutions where visible_h % 64 == 0.
SW-decoder thread config (video_decoder.cpp:528-540) — thread_count=0, thread_type=FRAME|SLICE. FRAME is downgraded to SLICE-only by AV_CODEC_FLAG_LOW_DELAY, but decode throughput is sufficient for your input rate.
SetTargetFPS(100) delivery throttle (already there) — caps onVideoFrame post-decode work at 10 FPS. Keeps the caller path warm-cached.
Instrumentation — [MEDIA_DecInit] / [MEDIA_Convert] / [MEDIA_SWDec] / [MEDIA_Timing] / [MEDIA_JpegTiming] — always-on regression detector, zero cost when ANSCORE_DEBUGVIEW=OFF.
2026-04-20 12:18:43 +10:00
0925aa1d63 Fix RTSP stall by releasing _mutex during BGR conversion
getImage() previously held _mutex across the 4K NV12->BGR sws_scale in
avframeToCVMat, blocking the decoder callback (onVideoFrame) for 100-300ms
per frame. Under multi-camera load this cascaded into 5-21s frame stalls
and STALE PTS events in the log.

- avframeToCVMat: drop outer _mutex. NV12/YUV420P paths touch no shared
  state; avframeAnyToCvmat still locks internally for swsCtx.
- getImage: split into two short locked phases with the BGR conversion
  unlocked between them. Decoder callbacks can push new frames and run
  the CUDA HW capture path in parallel with the reader's conversion.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 08:23:28 +10:00
e134ebdf15 Use software decoder by default 2026-04-04 20:19:54 +11:00
3a21026790 Disable NV12 path for ANSCV by default. Currenly use cv::Mat** directly 2026-04-04 10:09:47 +11:00
958cab6ae3 Fix NV12 crash issue when recreate camera object 2026-04-02 22:07:27 +11:00
7b4134133c Initial setup for CLion 2026-03-28 16:54:11 +11:00