]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/commitdiff
Remove unused functions
authorMichal Sojka <michal.sojka@cvut.cz>
Fri, 12 Oct 2018 11:36:34 +0000 (13:36 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Fri, 12 Oct 2018 11:41:55 +0000 (13:41 +0200)
src/CMakeLists.txt
src/cuda_functions.cu [deleted file]
src/cuda_functions.h [deleted file]
src/kcf.cpp
src/kcf.h

index 80a8387ea71e86b52b3ee55adb67a4d628be4d21..7ed9f6051359f99ee430142e87749e1d294da7e7 100644 (file)
@@ -40,7 +40,7 @@ ELSEIF(FFT STREQUAL "cuFFTW")
   add_definitions(-DFFTW -DCUFFTW)
   set(use_cuda ON)
 ELSEIF(FFT STREQUAL "cuFFT")
-    list(APPEND KCF_LIB_SRC fft_cufft.cpp cuda_functions.h cuda_functions.cu)
+    list(APPEND KCF_LIB_SRC fft_cufft.cpp)
     add_definitions(-DCUFFT)
     set(use_cuda ON)
     iF(CUDA_DEBUG)
diff --git a/src/cuda_functions.cu b/src/cuda_functions.cu
deleted file mode 100644 (file)
index 508ebe0..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#include "cuda_functions.h"
-
-__global__ void gaussian_correlation_kernel(float *data_in, float *data_out, float *xf_sqr_norm, float *yf_sqr_norm,
-                                            int rows, int cols, int channels_per_scale, double sigma)
-{
-    extern __shared__ float sdata[];
-    int blockId = blockIdx.y * gridDim.x + blockIdx.x;
-    int threadId = blockId * (blockDim.x + channels_per_scale / 2) + threadIdx.x;
-
-    sdata[threadIdx.x] = 0;
-    sdata[threadIdx.x] = data_in[threadId] + data_in[threadId + blockDim.x];
-    __syncthreads();
-
-    for (unsigned int s = (channels_per_scale / 2 + 1) / 2, old_s = channels_per_scale / 2; s > 0; s >>= 1) {
-
-        if (old_s & 1) s += 1;
-
-        if (threadIdx.x < s && threadIdx.x + s < old_s) {
-            sdata[threadIdx.x] += sdata[threadIdx.x + s];
-        }
-        old_s = s;
-        __syncthreads();
-    }
-
-    if (threadIdx.x == 0) {
-        float accumulate_res = sdata[0];
-
-        float numel_xf_inv = 1.f / ((cols / 2 + 1) * rows * (channels_per_scale));
-
-        float tmp = (xf_sqr_norm[blockIdx.x] + yf_sqr_norm[0] - 2 * accumulate_res) * numel_xf_inv;
-
-        if (tmp > 0) {
-            data_out[blockIdx.x * rows * cols + blockIdx.y] = expf(-1.f / (sigma * sigma) * tmp);
-        } else {
-            data_out[blockIdx.x * rows * cols + blockIdx.y] = expf(0);
-        }
-    }
-}
-
-void cuda_gaussian_correlation(float *data_in, float *data_out, float *xf_sqr_norm, float *yf_sqr_norm, double sigma,
-                               int n_channels, int n_scales, int rows, int cols)
-{
-    dim3 threadsPerBlock((n_channels / n_scales) / 2);
-    dim3 numBlocks(n_scales, rows * cols);
-
-    gaussian_correlation_kernel<<<numBlocks, threadsPerBlock, ((n_channels / n_scales) / 2) * sizeof(float)>>>(
-        data_in, data_out, xf_sqr_norm, yf_sqr_norm, rows, cols, n_channels / n_scales, sigma);
-    CudaCheckError();
-
-    //    float *data_cpu = (float*) malloc(rows*cols*n_scales*sizeof(float));
-    //    CudaSafeCall(cudaMemcpy(data_cpu, data_out, rows*cols*n_scales*sizeof(float), cudaMemcpyDeviceToHost));
-    //    for (int j = 0; j < rows*n_scales; ++j) {
-    //                for (int k = 0; k < cols-1; ++k)
-    //                   std::cout  << data_cpu[j*cols  + k]  << ", ";
-    //                std::cout << data_cpu[j*cols + cols-1] <<  std::endl;
-    //            }
-    //    std::cout << std::endl << std::endl;
-    //    free(data_cpu);
-    return;
-}
diff --git a/src/cuda_functions.h b/src/cuda_functions.h
deleted file mode 100644 (file)
index 99cf132..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef CUDA_FUNCTIONS_H
-#define CUDA_FUNCTIONS_H
-
-#include "cuda_runtime.h"
-#include "cuda_error_check.hpp"
-
-void cuda_gaussian_correlation(float *data_in, float *data_out, float *xf_sqr_norm, float *yf_sqr_norm, double sigma,
-                               int n_channels, int n_scales, int rows, int cols);
-
-#endif
index 69c8a9ae0b4ac6830e12890b32d8d4476aeb561f..17777a685f9ccadd5e2692513b672ce1b0d5ae52 100644 (file)
@@ -689,12 +689,6 @@ void KCF_Tracker::GaussianCorrelation::operator()(ComplexMat &result, const Comp
     DEBUG_PRINTM(xyf_sum);
     kcf.fft.inverse(xyf_sum, ifft_res);
     DEBUG_PRINTM(ifft_res);
-#if 0 && defined(CUFFT)
-    // FIXME
-    cuda_gaussian_correlation(ifft_res.deviceMem(), k.deviceMem(), xf_sqr_norm.deviceMem(),
-                              auto_correlation ? xf_sqr_norm.deviceMem() : yf_sqr_norm.deviceMem(), sigma,
-                              xf.n_channels, xf.n_scales, kcf.feature_size.height, kcf.feature_size.width);
-#else
 
     float numel_xf_inv = 1.f / (xf.cols * xf.rows * (xf.channels() / xf.n_scales));
     for (uint i = 0; i < xf.n_scales; ++i) {
@@ -704,7 +698,7 @@ void KCF_Tracker::GaussianCorrelation::operator()(ComplexMat &result, const Comp
                 * numel_xf_inv, 0), plane);
         DEBUG_PRINTM(plane);
     }
-#endif
+
     kcf.fft.forward(ifft_res, result);
 }
 
index 349083b03aeb80ec2761858a6a20ca111da1d9e0..2ea31f00661cfd0ae4275510c262bead9fd3fb24 100644 (file)
--- a/src/kcf.h
+++ b/src/kcf.h
@@ -8,7 +8,6 @@
 
 #include "complexmat.hpp"
 #ifdef CUFFT
-#include "cuda_functions.h"
 #include "cuda_error_check.hpp"
 #include <cuda_runtime.h>
 #endif