From 3573fe46ae367b2d33196ce1d56b4114bf817ebf Mon Sep 17 00:00:00 2001 From: Shanigen Date: Sat, 8 Sep 2018 12:31:11 +0200 Subject: [PATCH] Corrected warnings and errors in CUFFT version These problems were found by Travis CL. --- src/complexmat.cuh | 6 +++--- src/kcf.cpp | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/complexmat.cuh b/src/complexmat.cuh index a9d76cd..57ccee3 100644 --- a/src/complexmat.cuh +++ b/src/complexmat.cuh @@ -106,14 +106,14 @@ class ComplexMat { // text output friend std::ostream &operator<<(std::ostream &os, const ComplexMat &mat) { - float *data_cpu = (float *)malloc(mat.rows * mat.cols * mat.n_channels * sizeof(cufftComplex)); + float *data_cpu = reinterpret_cast(malloc(mat.rows * mat.cols * mat.n_channels * sizeof(cufftComplex))); CudaSafeCall(cudaMemcpy(data_cpu, mat.p_data, mat.rows * mat.cols * mat.n_channels * sizeof(cufftComplex), cudaMemcpyDeviceToHost)); // for (int i = 0; i < mat.n_channels; ++i){ for (int i = 0; i < 1; ++i) { os << "Channel " << i << std::endl; - for (int j = 0; j < mat.rows; ++j) { - for (int k = 0; k < 2 * mat.cols - 2; k += 2) + for (uint j = 0; j < mat.rows; ++j) { + for (uint k = 0; k < 2 * mat.cols - 2; k += 2) os << "(" << data_cpu[j * 2 * mat.cols + k] << "," << data_cpu[j * 2 * mat.cols + (k + 1)] << ")" << ", "; os << "(" << data_cpu[j * 2 * mat.cols + 2 * mat.cols - 2] << "," diff --git a/src/kcf.cpp b/src/kcf.cpp index 9c6554b..470c448 100644 --- a/src/kcf.cpp +++ b/src/kcf.cpp @@ -155,10 +155,9 @@ void KCF_Tracker::init(cv::Mat &img, const cv::Rect &bbox, int fit_size_x, int f std::exit(EXIT_FAILURE); } CudaSafeCall(cudaSetDeviceFlags(cudaDeviceMapHost)); - p_xf.create(uint(p_windows_size.height) / p_cell_size, (uint(p_windows_size.width) / p_cell_size) / 2 + 1, p_num_of_feats, this->stream); p_rot_labels_data = DynMem( ((uint(p_windows_size.width) / p_cell_size) * (uint(p_windows_size.height) / p_cell_size)) * sizeof(float)); - p_rot_labels = cv::Mat(p_windows_size.height / int(p_cell_size), windows_size.width / int(p_cell_size), CV_32FC1, + p_rot_labels = cv::Mat(p_windows_size.height / int(p_cell_size), p_windows_size.width / int(p_cell_size), CV_32FC1, p_rot_labels_data.hostMem()); #else p_xf.create(uint(p_windows_size.height / p_cell_size), (uint(p_windows_size.height / p_cell_size)) / 2 + 1, -- 2.39.2