diff --git a/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/ImageSaveCache.cpp b/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/ImageSaveCache.cpp index 4167c17..b1f9ad1 100644 --- a/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/ImageSaveCache.cpp +++ b/vehicle_structure_platform.git0708-3080-trt-face/src/VPT/ImageSaveCache.cpp @@ -46,7 +46,6 @@ void ImageSaveCache::insert(const OBJ_KEY &snaphot_id, const FRAME_KEY & frame_i auto iterK = mp_key.find(snaphot_id); if (iterK == mp_key.end()) { - //os1 << mp_frame.size() << std::endl; auto unaryF = [&frame_id](std::pair & item_key) { if (item_key.first == frame_id) @@ -84,7 +83,7 @@ void ImageSaveCache::insert(const OBJ_KEY &snaphot_id, const FRAME_KEY & frame_i if (iterKey == mp_key.end() && iterFrame->second.width == frame.width && iterFrame->second.height == frame.height && iterFrame->second.size == frame.size) //����ô�ͼû���棬���ȱ�����ͼvector,���ijһ����ͼ���ݣ���������map����������ô�ô�ͼ���ݽ����������� { - cudaError_t cudaStatus = cudaMemcpy(iterFrame->second.frame, frame.frame, IMG_CHANNELS * frame.size * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); + cudaError_t cudaStatus = cudaMemcpy(iterFrame->second.frame, frame.frame, IMG_CHANNELS * frame.width * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); if (cudaStatus != cudaSuccess) { fprintf(stderr, "here cudaMemcpy failed! error: %s\n", cudaGetErrorString(cudaStatus)); } @@ -99,12 +98,8 @@ void ImageSaveCache::insert(const OBJ_KEY &snaphot_id, const FRAME_KEY & frame_i } } DxGPUFrame dx_frame; - /* cudaError_t cudaStatus = cudaMalloc((void**)&dx_frame.frame, frame.size * frame.height * IMG_CHANNELS * sizeof(float)); - if (cudaStatus != cudaSuccess) { - fprintf(stderr, "here cudaMalloc failed! error: %s\n", cudaGetErrorString(cudaStatus)); - }*/ - dx_frame.frame = malloc(frame.size * frame.height * IMG_CHANNELS * sizeof(unsigned char)); - cudaError_t cudaStatus = cudaMemcpy(dx_frame.frame, frame.frame, IMG_CHANNELS * frame.size * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); + dx_frame.frame = malloc(frame.width * frame.height * IMG_CHANNELS * sizeof(unsigned char)); + cudaError_t cudaStatus = cudaMemcpy(dx_frame.frame, frame.frame, IMG_CHANNELS * frame.width * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); if (cudaStatus != cudaSuccess) { fprintf(stderr, "here cudaMemcpy failed! error: %s\n", cudaGetErrorString(cudaStatus)); } @@ -121,7 +116,6 @@ void ImageSaveCache::insert(const OBJ_KEY &snaphot_id, const FRAME_KEY & frame_i } else { - //os1 << mp_frame.size() << std::endl; auto unaryF = [&frame_id](std::pair & item_key) { if (item_key.first == frame_id) @@ -152,7 +146,7 @@ void ImageSaveCache::insert(const OBJ_KEY &snaphot_id, const FRAME_KEY & frame_i if (iterKey == mp_key.end()&& iterFrame->second.width == frame.width && iterFrame->second.height == frame.height && iterFrame->second.size == frame.size) //����ô�ͼû���棬���ȱ�����ͼvector,���ijһ����ͼ���ݣ���������map����������ô�ô�ͼ���ݽ����������� { - cudaError_t cudaStatus = cudaMemcpy(iterFrame->second.frame, frame.frame, IMG_CHANNELS * frame.size * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); + cudaError_t cudaStatus = cudaMemcpy(iterFrame->second.frame, frame.frame, IMG_CHANNELS * frame.width * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); if (cudaStatus != cudaSuccess) { fprintf(stderr, "here cudaMemcpy failed! error: %s\n", cudaGetErrorString(cudaStatus)); } @@ -165,8 +159,8 @@ void ImageSaveCache::insert(const OBJ_KEY &snaphot_id, const FRAME_KEY & frame_i } } DxGPUFrame dx_frame; - dx_frame.frame = malloc(IMG_CHANNELS * frame.size * frame.height * sizeof(unsigned char)); - cudaError_t cudaStatus = cudaMemcpy(dx_frame.frame, frame.frame, IMG_CHANNELS * frame.size * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); + dx_frame.frame = malloc(IMG_CHANNELS * frame.width * frame.height * sizeof(unsigned char)); + cudaError_t cudaStatus = cudaMemcpy(dx_frame.frame, frame.frame, IMG_CHANNELS * frame.width * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); if (cudaStatus != cudaSuccess) { fprintf(stderr, "here cudaMemcpy failed! error: %s\n", cudaGetErrorString(cudaStatus)); }