From 10d335d71513e432373dec9df46b5558cf6b074c Mon Sep 17 00:00:00 2001 From: cmhu <2657262686@qq.com> Date: Fri, 7 Jun 2024 16:27:31 +0800 Subject: [PATCH] 直接用乔熙的BGR输出 --- vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/DxDecoderWrap.cpp | 15 ++++++++------- vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.cpp | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/DxDecoderWrap.cpp b/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/DxDecoderWrap.cpp index d3f670a..460e662 100644 --- a/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/DxDecoderWrap.cpp +++ b/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/DxDecoderWrap.cpp @@ -294,6 +294,7 @@ void DxDecoderWrap::DxCUDADecoderCallback( void * buf, unsigned int size, int wi unsigned char *pHwData = nullptr; cudaError_t cudaStatus = cudaMalloc((void **)&pHwData, rgbSize); if (cudaStatus != cudaSuccess) { + m_queue_frames_mutex.unlock(); LOG_ERROR("[{}]- cudaMalloc failed !!!", m_name.c_str()); return ; } @@ -308,13 +309,13 @@ void DxDecoderWrap::DxCUDADecoderCallback( void * buf, unsigned int size, int wi // unsigned char* cpu_data = new unsigned char[rgb_size]; // cudaStatus = cudaMemcpy(cpu_data, pHwData, rgb_size * sizeof(unsigned char), cudaMemcpyDeviceToHost); - // if (timestamp > 245 && timestamp < 255) - // { - // string file_name = "./nv12/"+to_string(timestamp) + ".txt"; - // FILE* fp=fopen(file_name.c_str(),"wb"); - // fwrite(cpu_data, rgb_size, 1, fp); - // fclose(fp); - // } + // // if (timestamp > 245 && timestamp < 255) + // // { + // // string file_name = "./nv12/"+to_string(timestamp) + ".txt"; + // // FILE* fp=fopen(file_name.c_str(),"wb"); + // // fwrite(cpu_data, rgb_size, 1, fp); + // // fclose(fp); + // // } // cv::Mat img(m_height, m_width, CV_8UC3, cpu_data); // cv::imwrite("test.jpg", img); diff --git a/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.cpp b/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.cpp index b7df98d..849440b 100644 --- a/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.cpp +++ b/vehicle_structure_platform.git0708-3080-trt-face/src/SfxDecoder/SfxDecoder.cpp @@ -43,8 +43,8 @@ bool SfxDecoder::OpenDecoder(DxDecoderConfig& cfg) sfx_cfg->flags.useFastDecode = 0; sfx_cfg->flags.accelId = m_cfg.devId; sfx_cfg->flags.frameNumber = 1; - sfx_cfg->flags.fmt = SFX_VIDEO_FORMAT_NV12U8; - //sfx_cfg->flags.fmt = SFX_VIDEO_FORMAT_C3BGRU8; + // sfx_cfg->flags.fmt = SFX_VIDEO_FORMAT_NV12U8; + sfx_cfg->flags.fmt = SFX_VIDEO_FORMAT_C3BGRU8; m_handler = SfxStreamHandlerInterface::SfxGetInstance(sfx_cfg); -- libgit2 0.21.4