matrice-streaming 0.1.67__py3-none-any.whl → 0.1.68__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- matrice_streaming/streaming_gateway/camera_streamer/nvdec.py +22 -13
- {matrice_streaming-0.1.67.dist-info → matrice_streaming-0.1.68.dist-info}/METADATA +1 -1
- {matrice_streaming-0.1.67.dist-info → matrice_streaming-0.1.68.dist-info}/RECORD +6 -6
- {matrice_streaming-0.1.67.dist-info → matrice_streaming-0.1.68.dist-info}/WHEEL +0 -0
- {matrice_streaming-0.1.67.dist-info → matrice_streaming-0.1.68.dist-info}/licenses/LICENSE.txt +0 -0
- {matrice_streaming-0.1.67.dist-info → matrice_streaming-0.1.68.dist-info}/top_level.txt +0 -0
|
@@ -420,8 +420,8 @@ def _get_nv12_resize_kernel():
|
|
|
420
420
|
"""Get or compile the NV12 resize kernel.
|
|
421
421
|
|
|
422
422
|
This kernel resizes NV12 directly (no color conversion).
|
|
423
|
-
Output: concatenated Y (
|
|
424
|
-
This is 50% smaller than RGB (
|
|
423
|
+
Output: concatenated Y (H*W) + UV ((H/2)*W) = H*W*1.5 bytes
|
|
424
|
+
This is 50% smaller than RGB (H*W*3 bytes).
|
|
425
425
|
|
|
426
426
|
Consumer will do: NV12→RGB→CHW→FP16 in one fused kernel.
|
|
427
427
|
"""
|
|
@@ -429,9 +429,9 @@ def _get_nv12_resize_kernel():
|
|
|
429
429
|
if _nv12_resize_kernel is None and CUPY_AVAILABLE:
|
|
430
430
|
_nv12_resize_kernel = cp.RawKernel(r'''
|
|
431
431
|
extern "C" __global__ void nv12_resize(
|
|
432
|
-
const unsigned char* src_y,
|
|
433
|
-
const unsigned char* src_uv,
|
|
434
|
-
unsigned char* dst,
|
|
432
|
+
const unsigned char* src_y,
|
|
433
|
+
const unsigned char* src_uv,
|
|
434
|
+
unsigned char* dst,
|
|
435
435
|
int src_h, int src_w,
|
|
436
436
|
int dst_h, int dst_w,
|
|
437
437
|
int y_stride, int uv_stride
|
|
@@ -477,8 +477,8 @@ def nv12_resize(y_plane: cp.ndarray, uv_plane: cp.ndarray,
|
|
|
477
477
|
dst_h: int = 640, dst_w: int = 640) -> cp.ndarray:
|
|
478
478
|
"""Resize NV12 without color conversion.
|
|
479
479
|
|
|
480
|
-
Output: concatenated Y (
|
|
481
|
-
Total size:
|
|
480
|
+
Output: concatenated Y (H*W) + UV ((H/2)*W) as single buffer.
|
|
481
|
+
Total size: H*W + (H/2)*W = H*W*1.5 bytes (50% of RGB).
|
|
482
482
|
"""
|
|
483
483
|
kernel = _get_nv12_resize_kernel()
|
|
484
484
|
if kernel is None:
|
|
@@ -504,7 +504,7 @@ def surface_to_nv12(frame, target_h: int = 640, target_w: int = 640) -> Optional
|
|
|
504
504
|
"""Convert NVDEC surface to resized NV12 (50% smaller than RGB).
|
|
505
505
|
|
|
506
506
|
Output: (H + H/2, W) uint8 - concatenated Y + UV planes.
|
|
507
|
-
Total size:
|
|
507
|
+
Total size: H*W*1.5 bytes (vs H*W*3 for RGB).
|
|
508
508
|
"""
|
|
509
509
|
if not CUPY_AVAILABLE or frame is None:
|
|
510
510
|
return None
|
|
@@ -552,11 +552,14 @@ def surface_to_nv12(frame, target_h: int = 640, target_w: int = 640) -> Optional
|
|
|
552
552
|
return nv12_frame[:, :, cp.newaxis] if nv12_frame is not None else None
|
|
553
553
|
|
|
554
554
|
except Exception as e:
|
|
555
|
-
# Safely
|
|
555
|
+
# Safely handle any characters in error message (CUDA errors may contain Unicode like ×)
|
|
556
556
|
try:
|
|
557
557
|
err_msg = str(e).encode('ascii', errors='replace').decode('ascii')
|
|
558
558
|
except Exception:
|
|
559
|
-
|
|
559
|
+
try:
|
|
560
|
+
err_msg = repr(str(e))[:200]
|
|
561
|
+
except Exception:
|
|
562
|
+
err_msg = "failed to format error message"
|
|
560
563
|
logger.warning(f"surface_to_nv12 failed: {err_msg}")
|
|
561
564
|
return None
|
|
562
565
|
|
|
@@ -569,7 +572,7 @@ class NVDECDecoderPool:
|
|
|
569
572
|
"""Pool of NVDEC decoders that time-multiplex streams.
|
|
570
573
|
|
|
571
574
|
Each decoder is exclusively owned by one worker thread.
|
|
572
|
-
Outputs NV12: 1.5
|
|
575
|
+
Outputs NV12: 1.5*H*W bytes (50% smaller than RGB).
|
|
573
576
|
"""
|
|
574
577
|
|
|
575
578
|
def __init__(self, pool_size: int, gpu_id: int = 0):
|
|
@@ -808,8 +811,14 @@ def nvdec_pool_worker(
|
|
|
808
811
|
if local_errors <= 3:
|
|
809
812
|
logger.error(f"Worker {worker_id} write error: {e}")
|
|
810
813
|
|
|
811
|
-
if decoded_frames
|
|
812
|
-
|
|
814
|
+
if decoded_frames:
|
|
815
|
+
# Sync all buffers that received frames in this round
|
|
816
|
+
# Critical for cross-container IPC - ensures GPU writes are visible
|
|
817
|
+
synced_cams = set()
|
|
818
|
+
for cam_id, _ in decoded_frames:
|
|
819
|
+
if cam_id in ring_buffers and cam_id not in synced_cams:
|
|
820
|
+
ring_buffers[cam_id].sync_writes()
|
|
821
|
+
synced_cams.add(cam_id)
|
|
813
822
|
|
|
814
823
|
if num_frames == 0:
|
|
815
824
|
time.sleep(0.0001)
|
|
@@ -33,7 +33,7 @@ matrice_streaming/streaming_gateway/camera_streamer/gstreamer_camera_streamer.py
|
|
|
33
33
|
matrice_streaming/streaming_gateway/camera_streamer/gstreamer_worker.py,sha256=AqKNJ6q_BxFphOlJ2GaS4WpoLCHXLEu5JVvoKQNrGV0,42822
|
|
34
34
|
matrice_streaming/streaming_gateway/camera_streamer/gstreamer_worker_manager.py,sha256=jlKwIWWMXpztdyKiyremGmkVyw9mf2AxEmT7154xnrc,22002
|
|
35
35
|
matrice_streaming/streaming_gateway/camera_streamer/message_builder.py,sha256=W295q6cIm05ReF1ooQus3rsKgZOG3EldZplbQco-OyM,10231
|
|
36
|
-
matrice_streaming/streaming_gateway/camera_streamer/nvdec.py,sha256=
|
|
36
|
+
matrice_streaming/streaming_gateway/camera_streamer/nvdec.py,sha256=Y3zhycfTpZ_bF5-Ef55J0iFi9wTLTv4Xxmw-woV1occ,53118
|
|
37
37
|
matrice_streaming/streaming_gateway/camera_streamer/nvdec_worker_manager.py,sha256=KlcwKFUPVZTQ3J1VIuhPev8Xv9BNw4dj2iLGHrREQCQ,16035
|
|
38
38
|
matrice_streaming/streaming_gateway/camera_streamer/platform_pipelines.py,sha256=UNjsYYWbUJteOq2tzxISFAbWMa2e9GUExSS6fWc2Aow,27303
|
|
39
39
|
matrice_streaming/streaming_gateway/camera_streamer/retry_manager.py,sha256=d8tlGoWoeSlgpCgXbUHTM61ekCQZki7TO1HzL2yPVzk,3607
|
|
@@ -49,8 +49,8 @@ matrice_streaming/streaming_gateway/debug/debug_streaming_gateway.py,sha256=ZiDg
|
|
|
49
49
|
matrice_streaming/streaming_gateway/debug/debug_utils.py,sha256=jWcSBgrk_YVt1QzSyw6geX17YBnTvgVdA5ubqO531a0,10477
|
|
50
50
|
matrice_streaming/streaming_gateway/debug/example_debug_streaming.py,sha256=-gS8zNDswAoj6oss66QQWYZhY24usfLiMH0FFK06vV0,7994
|
|
51
51
|
matrice_streaming/streaming_gateway/debug/test_videoplayback.py,sha256=s_dgWkoESiuJHlUAf_iv4d7OGmAhwocwDZmIcFUZzvo,11093
|
|
52
|
-
matrice_streaming-0.1.
|
|
53
|
-
matrice_streaming-0.1.
|
|
54
|
-
matrice_streaming-0.1.
|
|
55
|
-
matrice_streaming-0.1.
|
|
56
|
-
matrice_streaming-0.1.
|
|
52
|
+
matrice_streaming-0.1.68.dist-info/licenses/LICENSE.txt,sha256=_uQUZpgO0mRYL5-fPoEvLSbNnLPv6OmbeEDCHXhK6Qc,1066
|
|
53
|
+
matrice_streaming-0.1.68.dist-info/METADATA,sha256=vSC8p6EEAKwozRFvArLlVcJoipCaAe9KX7S_H9vyJ8I,2477
|
|
54
|
+
matrice_streaming-0.1.68.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
55
|
+
matrice_streaming-0.1.68.dist-info/top_level.txt,sha256=PM_trIe8f4JLc90J871rNMYGVM3Po9Inx4As5LrCFUU,18
|
|
56
|
+
matrice_streaming-0.1.68.dist-info/RECORD,,
|
|
File without changes
|
{matrice_streaming-0.1.67.dist-info → matrice_streaming-0.1.68.dist-info}/licenses/LICENSE.txt
RENAMED
|
File without changes
|
|
File without changes
|