Commit d07e3a223fdafeae97e052f9778aea48d841241d
1 parent
80302362
修复width错误导致的拷贝错误
Showing
1 changed file
with
6 additions
and
12 deletions
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 |
46 | 46 | auto iterK = mp_key.find(snaphot_id); |
47 | 47 | if (iterK == mp_key.end()) |
48 | 48 | { |
49 | - //os1 << mp_frame.size() << std::endl; | |
50 | 49 | auto unaryF = [&frame_id](std::pair<FRAME_KEY, DxGPUFrame> & item_key) |
51 | 50 | { |
52 | 51 | if (item_key.first == frame_id) |
... | ... | @@ -84,7 +83,7 @@ void ImageSaveCache::insert(const OBJ_KEY &snaphot_id, const FRAME_KEY & frame_i |
84 | 83 | if (iterKey == mp_key.end() && iterFrame->second.width == frame.width && iterFrame->second.height == frame.height && iterFrame->second.size == frame.size) //����ô�ͼû���棬���ȱ�����ͼvector,���ijһ����ͼ���ݣ���������map����������ô�ô�ͼ���ݽ����������� |
85 | 84 | { |
86 | 85 | |
87 | - cudaError_t cudaStatus = cudaMemcpy(iterFrame->second.frame, frame.frame, IMG_CHANNELS * frame.size * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); | |
86 | + cudaError_t cudaStatus = cudaMemcpy(iterFrame->second.frame, frame.frame, IMG_CHANNELS * frame.width * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); | |
88 | 87 | if (cudaStatus != cudaSuccess) { |
89 | 88 | fprintf(stderr, "here cudaMemcpy failed! error: %s\n", cudaGetErrorString(cudaStatus)); |
90 | 89 | } |
... | ... | @@ -99,12 +98,8 @@ void ImageSaveCache::insert(const OBJ_KEY &snaphot_id, const FRAME_KEY & frame_i |
99 | 98 | } |
100 | 99 | } |
101 | 100 | DxGPUFrame dx_frame; |
102 | - /* cudaError_t cudaStatus = cudaMalloc((void**)&dx_frame.frame, frame.size * frame.height * IMG_CHANNELS * sizeof(float)); | |
103 | - if (cudaStatus != cudaSuccess) { | |
104 | - fprintf(stderr, "here cudaMalloc failed! error: %s\n", cudaGetErrorString(cudaStatus)); | |
105 | - }*/ | |
106 | - dx_frame.frame = malloc(frame.size * frame.height * IMG_CHANNELS * sizeof(unsigned char)); | |
107 | - cudaError_t cudaStatus = cudaMemcpy(dx_frame.frame, frame.frame, IMG_CHANNELS * frame.size * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); | |
101 | + dx_frame.frame = malloc(frame.width * frame.height * IMG_CHANNELS * sizeof(unsigned char)); | |
102 | + cudaError_t cudaStatus = cudaMemcpy(dx_frame.frame, frame.frame, IMG_CHANNELS * frame.width * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); | |
108 | 103 | if (cudaStatus != cudaSuccess) { |
109 | 104 | fprintf(stderr, "here cudaMemcpy failed! error: %s\n", cudaGetErrorString(cudaStatus)); |
110 | 105 | } |
... | ... | @@ -121,7 +116,6 @@ void ImageSaveCache::insert(const OBJ_KEY &snaphot_id, const FRAME_KEY & frame_i |
121 | 116 | } |
122 | 117 | else |
123 | 118 | { |
124 | - //os1 << mp_frame.size() << std::endl; | |
125 | 119 | auto unaryF = [&frame_id](std::pair<FRAME_KEY, DxGPUFrame> & item_key) |
126 | 120 | { |
127 | 121 | if (item_key.first == frame_id) |
... | ... | @@ -152,7 +146,7 @@ void ImageSaveCache::insert(const OBJ_KEY &snaphot_id, const FRAME_KEY & frame_i |
152 | 146 | |
153 | 147 | if (iterKey == mp_key.end()&& iterFrame->second.width == frame.width && iterFrame->second.height == frame.height && iterFrame->second.size == frame.size) //����ô�ͼû���棬���ȱ�����ͼvector,���ijһ����ͼ���ݣ���������map����������ô�ô�ͼ���ݽ����������� |
154 | 148 | { |
155 | - cudaError_t cudaStatus = cudaMemcpy(iterFrame->second.frame, frame.frame, IMG_CHANNELS * frame.size * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); | |
149 | + cudaError_t cudaStatus = cudaMemcpy(iterFrame->second.frame, frame.frame, IMG_CHANNELS * frame.width * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); | |
156 | 150 | if (cudaStatus != cudaSuccess) { |
157 | 151 | fprintf(stderr, "here cudaMemcpy failed! error: %s\n", cudaGetErrorString(cudaStatus)); |
158 | 152 | } |
... | ... | @@ -165,8 +159,8 @@ void ImageSaveCache::insert(const OBJ_KEY &snaphot_id, const FRAME_KEY & frame_i |
165 | 159 | } |
166 | 160 | } |
167 | 161 | DxGPUFrame dx_frame; |
168 | - dx_frame.frame = malloc(IMG_CHANNELS * frame.size * frame.height * sizeof(unsigned char)); | |
169 | - cudaError_t cudaStatus = cudaMemcpy(dx_frame.frame, frame.frame, IMG_CHANNELS * frame.size * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); | |
162 | + dx_frame.frame = malloc(IMG_CHANNELS * frame.width * frame.height * sizeof(unsigned char)); | |
163 | + cudaError_t cudaStatus = cudaMemcpy(dx_frame.frame, frame.frame, IMG_CHANNELS * frame.width * frame.height * sizeof(unsigned char), cudaMemcpyDeviceToHost); | |
170 | 164 | if (cudaStatus != cudaSuccess) { |
171 | 165 | fprintf(stderr, "here cudaMemcpy failed! error: %s\n", cudaGetErrorString(cudaStatus)); |
172 | 166 | } | ... | ... |