Code review fixes.

This commit is contained in:
Alexander Smorkalov
2013-12-20 16:32:34 +04:00
parent 529bd41751
commit bc72f4d2a2
11 changed files with 54 additions and 27 deletions

View File

@@ -28,8 +28,10 @@ endif()
file(GLOB lib_cuda_hdrs "include/opencv2/${name}/cuda/*.hpp" "include/opencv2/${name}/cuda/*.h")
file(GLOB lib_cuda_hdrs_detail "include/opencv2/${name}/cuda/detail/*.hpp" "include/opencv2/${name}/cuda/detail/*.h")
if (HAVE_CUDA AND NOT ENABLE_DYNAMIC_CUDA)
if(HAVE_CUDA AND NOT ENABLE_DYNAMIC_CUDA)
file(GLOB lib_cuda "../dynamicuda/src/cuda/*.cu*")
ocv_include_directories(${CUDA_INCLUDE_DIRS})
ocv_cuda_compile(cuda_objs ${lib_cuda})
endif()
source_group("Cuda Headers" FILES ${lib_cuda_hdrs})
@@ -43,7 +45,7 @@ if (NOT HAVE_CUDA OR ENABLE_DYNAMIC_CUDA)
ocv_glob_module_sources(SOURCES "${opencv_core_BINARY_DIR}/version_string.inc"
HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail})
else()
ocv_glob_module_sources(SOURCES "${opencv_core_BINARY_DIR}/version_string.inc" ${lib_cuda}
ocv_glob_module_sources(SOURCES "${opencv_core_BINARY_DIR}/version_string.inc" ${lib_cuda} ${cuda_objs}
HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail})
endif()

View File

@@ -112,13 +112,13 @@ namespace cv { namespace gpu
// Creates DeviceInfo object for the given GPU
DeviceInfo(int device_id) : device_id_(device_id) { query(); }
std::string name() const;
std::string name() const { return name_; }
// Return compute capability versions
int majorVersion() const;
int minorVersion() const;
int majorVersion() const { return majorVersion_; }
int minorVersion() const { return minorVersion_; }
int multiProcessorCount() const;
int multiProcessorCount() const { return multi_processor_count_; }
size_t sharedMemPerBlock() const;
@@ -132,12 +132,9 @@ namespace cv { namespace gpu
// Checks whether the GPU module can be run on the given device
bool isCompatible() const;
int deviceID() const;
int deviceID() const { return device_id_; }
private:
// Private section is fictive to preserve bin compatibility.
// Changes in the private fields there have no effects.
// see deligate code.
void query();
int device_id_;

View File

@@ -263,12 +263,15 @@ size_t cv::gpu::DeviceInfo::freeMemory() const { return deviceInfoFuncTable()->f
size_t cv::gpu::DeviceInfo::totalMemory() const { return deviceInfoFuncTable()->totalMemory(); }
bool cv::gpu::DeviceInfo::supports(FeatureSet feature_set) const { return deviceInfoFuncTable()->supports(feature_set); }
bool cv::gpu::DeviceInfo::isCompatible() const { return deviceInfoFuncTable()->isCompatible(); }
int cv::gpu::DeviceInfo::deviceID() const { return deviceInfoFuncTable()->deviceID(); };
int cv::gpu::DeviceInfo::majorVersion() const { return deviceInfoFuncTable()->majorVersion(); }
int cv::gpu::DeviceInfo::minorVersion() const { return deviceInfoFuncTable()->minorVersion(); }
std::string cv::gpu::DeviceInfo::name() const { return deviceInfoFuncTable()->name(); }
int cv::gpu::DeviceInfo::multiProcessorCount() const { return deviceInfoFuncTable()->multiProcessorCount(); }
void cv::gpu::DeviceInfo::query() { deviceInfoFuncTable()->query(); }
void cv::gpu::DeviceInfo::query()
{
deviceInfoFuncTable()->query();
name_ = deviceInfoFuncTable()->name();
multi_processor_count_ = deviceInfoFuncTable()->multiProcessorCount();
majorVersion_ = deviceInfoFuncTable()->majorVersion();
minorVersion_ = deviceInfoFuncTable()->minorVersion();
}
void cv::gpu::printCudaDeviceInfo(int device) { deviceInfoFuncTable()->printCudaDeviceInfo(device); }
void cv::gpu::printShortCudaDeviceInfo(int device) { deviceInfoFuncTable()->printShortCudaDeviceInfo(device); }