Fix NV12 crash issue when recreate camera object
(new structure) does not work
This commit is contained in:
@@ -276,6 +276,7 @@ namespace ANSCENTER {
|
||||
const bool useZeroCopy = isCudaDevice && gpuMatch;
|
||||
|
||||
// --- Debug: log pointer state before reading ---
|
||||
#if defined(ANSCORE_GPU_DEBUG) && ANSCORE_GPU_DEBUG
|
||||
{
|
||||
char _nv12_dbg[512];
|
||||
snprintf(_nv12_dbg, sizeof(_nv12_dbg),
|
||||
@@ -294,6 +295,7 @@ namespace ANSCENTER {
|
||||
#endif
|
||||
fprintf(stderr, "%s", _nv12_dbg);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Effective plane pointers — for zero-copy, use CUDA device ptrs;
|
||||
// for CPU upload, use the CPU snapshot buffers.
|
||||
@@ -362,7 +364,7 @@ namespace ANSCENTER {
|
||||
cv::cuda::GpuMat gpuY, gpuUV;
|
||||
|
||||
if (useZeroCopy) {
|
||||
// CUDA zero-copy: wrap NVDEC device pointers directly
|
||||
// CUDA zero-copy: wrap pool buffer device pointers directly
|
||||
gpuY = cv::cuda::GpuMat(frameH, frameW, CV_8UC1,
|
||||
effYPlane, static_cast<size_t>(effYLinesize));
|
||||
gpuUV = cv::cuda::GpuMat(frameH / 2, frameW, CV_8UC1,
|
||||
@@ -455,6 +457,7 @@ namespace ANSCENTER {
|
||||
gpuResized.create(inputH, inputW, CV_8UC3);
|
||||
|
||||
cudaStream_t rawStream = cv::cuda::StreamAccessor::getStream(stream);
|
||||
#if defined(ANSCORE_GPU_DEBUG) && ANSCORE_GPU_DEBUG
|
||||
{
|
||||
char _nv12_dbg2[256];
|
||||
snprintf(_nv12_dbg2, sizeof(_nv12_dbg2),
|
||||
@@ -467,6 +470,7 @@ namespace ANSCENTER {
|
||||
#endif
|
||||
fprintf(stderr, "%s", _nv12_dbg2);
|
||||
}
|
||||
#endif
|
||||
launcher(gpuY, gpuUV, gpuResized, frameW, frameH, inputW, inputH, rawStream);
|
||||
|
||||
stream.waitForCompletion();
|
||||
|
||||
Reference in New Issue
Block a user