fixed some warnings and errors under g++
This commit is contained in:
@@ -99,8 +99,8 @@ namespace cv
|
|||||||
|
|
||||||
string name() const { return name_; }
|
string name() const { return name_; }
|
||||||
|
|
||||||
int major() const { return major_; }
|
int majorVersion() const { return majorVersion_; }
|
||||||
int minor() const { return minor_; }
|
int minorVersion() const { return minorVersion_; }
|
||||||
|
|
||||||
int multiProcessorCount() const { return multi_processor_count_; }
|
int multiProcessorCount() const { return multi_processor_count_; }
|
||||||
|
|
||||||
@@ -118,7 +118,8 @@ namespace cv
|
|||||||
|
|
||||||
string name_;
|
string name_;
|
||||||
int multi_processor_count_;
|
int multi_processor_count_;
|
||||||
int major_, minor_;
|
int majorVersion_;
|
||||||
|
int minorVersion_;
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////// Error handling ////////////////////////
|
//////////////////////////////// Error handling ////////////////////////
|
||||||
|
@@ -1258,7 +1258,7 @@ Size cv::gpu::ConvolveBuf::estimateBlockSize(Size result_size, Size templ_size)
|
|||||||
Size bsize_min(1024, 1024);
|
Size bsize_min(1024, 1024);
|
||||||
|
|
||||||
// Check whether we use Fermi generation or newer GPU
|
// Check whether we use Fermi generation or newer GPU
|
||||||
if (DeviceInfo().major() >= 2)
|
if (DeviceInfo().majorVersion() >= 2)
|
||||||
{
|
{
|
||||||
bsize_min.width = 2048;
|
bsize_min.width = 2048;
|
||||||
bsize_min.height = 2048;
|
bsize_min.height = 2048;
|
||||||
@@ -1295,7 +1295,6 @@ void cv::gpu::convolve(const GpuMat& image, const GpuMat& templ, GpuMat& result,
|
|||||||
|
|
||||||
Size& block_size = buf.block_size;
|
Size& block_size = buf.block_size;
|
||||||
Size& dft_size = buf.dft_size;
|
Size& dft_size = buf.dft_size;
|
||||||
int& spect_len = buf.spect_len;
|
|
||||||
|
|
||||||
GpuMat& image_block = buf.image_block;
|
GpuMat& image_block = buf.image_block;
|
||||||
GpuMat& templ_block = buf.templ_block;
|
GpuMat& templ_block = buf.templ_block;
|
||||||
|
@@ -175,23 +175,20 @@ size_t cv::gpu::DeviceInfo::totalMemory() const
|
|||||||
|
|
||||||
bool cv::gpu::DeviceInfo::has(cv::gpu::GpuFeature feature) const
|
bool cv::gpu::DeviceInfo::has(cv::gpu::GpuFeature feature) const
|
||||||
{
|
{
|
||||||
if (feature == NATIVE_DOUBLE)
|
int version = majorVersion() * 10 + minorVersion();
|
||||||
return major() > 1 || (major() == 1 && minor() >= 3);
|
return version >= feature;
|
||||||
if (feature == ATOMICS)
|
|
||||||
return major() > 1 || (major() == 1 && minor() >= 1);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool cv::gpu::DeviceInfo::isCompatible() const
|
bool cv::gpu::DeviceInfo::isCompatible() const
|
||||||
{
|
{
|
||||||
// Check PTX compatibility
|
// Check PTX compatibility
|
||||||
if (TargetArchs::hasEqualOrLessPtx(major(), minor()))
|
if (TargetArchs::hasEqualOrLessPtx(majorVersion(), minorVersion()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Check BIN compatibility
|
// Check BIN compatibility
|
||||||
for (int i = minor(); i >= 0; --i)
|
for (int i = minorVersion(); i >= 0; --i)
|
||||||
if (TargetArchs::hasBin(major(), i))
|
if (TargetArchs::hasBin(majorVersion(), i))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -204,8 +201,8 @@ void cv::gpu::DeviceInfo::query()
|
|||||||
cudaSafeCall(cudaGetDeviceProperties(&prop, device_id_));
|
cudaSafeCall(cudaGetDeviceProperties(&prop, device_id_));
|
||||||
name_ = prop.name;
|
name_ = prop.name;
|
||||||
multi_processor_count_ = prop.multiProcessorCount;
|
multi_processor_count_ = prop.multiProcessorCount;
|
||||||
major_ = prop.major;
|
majorVersion_ = prop.major;
|
||||||
minor_ = prop.minor;
|
minorVersion_ = prop.minor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -88,7 +88,7 @@ bool cv::gpu::StereoBM_GPU::checkIfGpuCallReasonable()
|
|||||||
|
|
||||||
DeviceInfo device_info;
|
DeviceInfo device_info;
|
||||||
|
|
||||||
if (device_info.major() > 1 || device_info.multiProcessorCount() > 16)
|
if (device_info.majorVersion() > 1 || device_info.multiProcessorCount() > 16)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@@ -59,9 +59,12 @@ int main()
|
|||||||
|
|
||||||
for (int i = 0; i < num_devices; ++i)
|
for (int i = 0; i < num_devices; ++i)
|
||||||
{
|
{
|
||||||
if (!DeviceInfo(i).isCompatible())
|
DeviceInfo dev_info(i);
|
||||||
|
if (!dev_info.isCompatible())
|
||||||
{
|
{
|
||||||
cout << "GPU module isn't built for GPU #" << i << " (" << DeviceInfo(i).name() << ")";
|
cout << "GPU module isn't built for GPU #" << i << " ("
|
||||||
|
<< dev_info.name() << ", CC " << dev_info.majorVersion()
|
||||||
|
<< dev_info.minorVersion() << "\n";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -84,9 +84,12 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
for (int i = 0; i < num_devices; ++i)
|
for (int i = 0; i < num_devices; ++i)
|
||||||
{
|
{
|
||||||
if (!DeviceInfo(i).isCompatible())
|
DeviceInfo dev_info(i);
|
||||||
|
if (!dev_info.isCompatible())
|
||||||
{
|
{
|
||||||
cout << "GPU module isn't built for GPU #" << i << " (" << DeviceInfo(i).name() << ")";
|
cout << "GPU module isn't built for GPU #" << i << " ("
|
||||||
|
<< dev_info.name() << ", CC " << dev_info.majorVersion()
|
||||||
|
<< dev_info.minorVersion() << "\n";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,8 @@ struct CV_GpuMeanShiftTest : public CvTest
|
|||||||
cv::Mat img = cv::imread(std::string(ts->get_data_path()) + "meanshift/cones.png");
|
cv::Mat img = cv::imread(std::string(ts->get_data_path()) + "meanshift/cones.png");
|
||||||
cv::Mat img_template;
|
cv::Mat img_template;
|
||||||
|
|
||||||
if (cv::gpu::TargetArchs::builtWith(cv::gpu::COMPUTE_20) && cv::gpu::DeviceInfo().major() >= 2)
|
if (cv::gpu::TargetArchs::builtWith(cv::gpu::COMPUTE_20) &&
|
||||||
|
cv::gpu::DeviceInfo().has(cv::gpu::COMPUTE_20))
|
||||||
img_template = cv::imread(std::string(ts->get_data_path()) + "meanshift/con_result.png");
|
img_template = cv::imread(std::string(ts->get_data_path()) + "meanshift/con_result.png");
|
||||||
else
|
else
|
||||||
img_template = cv::imread(std::string(ts->get_data_path()) + "meanshift/con_result_CC1X.png");
|
img_template = cv::imread(std::string(ts->get_data_path()) + "meanshift/con_result_CC1X.png");
|
||||||
@@ -199,7 +200,8 @@ struct CV_GpuMeanShiftProcTest : public CvTest
|
|||||||
cv::Mat spmap_template;
|
cv::Mat spmap_template;
|
||||||
cv::FileStorage fs;
|
cv::FileStorage fs;
|
||||||
|
|
||||||
if (cv::gpu::TargetArchs::builtWith(cv::gpu::COMPUTE_20) && cv::gpu::DeviceInfo().major() >= 2)
|
if (cv::gpu::TargetArchs::builtWith(cv::gpu::COMPUTE_20) &&
|
||||||
|
cv::gpu::DeviceInfo().has(cv::gpu::COMPUTE_20))
|
||||||
fs.open(std::string(ts->get_data_path()) + "meanshift/spmap.yaml", cv::FileStorage::READ);
|
fs.open(std::string(ts->get_data_path()) + "meanshift/spmap.yaml", cv::FileStorage::READ);
|
||||||
else
|
else
|
||||||
fs.open(std::string(ts->get_data_path()) + "meanshift/spmap_CC1X.yaml", cv::FileStorage::READ);
|
fs.open(std::string(ts->get_data_path()) + "meanshift/spmap_CC1X.yaml", cv::FileStorage::READ);
|
||||||
|
@@ -69,7 +69,7 @@ struct CV_GpuMeanShiftSegmentationTest : public CvTest {
|
|||||||
{
|
{
|
||||||
stringstream path;
|
stringstream path;
|
||||||
path << ts->get_data_path() << "meanshift/cones_segmented_sp10_sr10_minsize" << minsize;
|
path << ts->get_data_path() << "meanshift/cones_segmented_sp10_sr10_minsize" << minsize;
|
||||||
if (TargetArchs::builtWith(COMPUTE_20) && DeviceInfo().major() >= 2)
|
if (TargetArchs::builtWith(COMPUTE_20) && DeviceInfo().has(COMPUTE_20))
|
||||||
path << ".png";
|
path << ".png";
|
||||||
else
|
else
|
||||||
path << "_CC1X.png";
|
path << "_CC1X.png";
|
||||||
|
Reference in New Issue
Block a user