Bug #2595 in OpenCV Manager fixed.

OpenCV Manager 2.x marks old 2.4.2 binary package for Tegra as "in use".
The latest version of OpenCV library compatible with platform is used now.
This commit is contained in:
Alexander Smorkalov 2012-12-05 13:04:45 +04:00
parent 7852b68c20
commit d2ed8e5f30
2 changed files with 45 additions and 38 deletions

View File

@ -77,22 +77,16 @@ string CommonPackageManager::GetPackagePathByVersion(const std::string& version,
} }
if (!packages.empty()) if (!packages.empty())
{
vector<PackageInfo>::iterator found = find(packages.begin(), packages.end(), target_package);
if (packages.end() != found)
{
result = found->GetInstalationPath();
}
else
{ {
int OptRating = -1; int OptRating = -1;
std::string OptVersion = "";
std::vector<std::pair<int, int> >& group = CommonPackageManager::ArmRating; std::vector<std::pair<int, int> >& group = CommonPackageManager::ArmRating;
if ((cpu_id & ARCH_X86) || (cpu_id & ARCH_X64)) if ((cpu_id & ARCH_X86) || (cpu_id & ARCH_X64))
group = CommonPackageManager::IntelRating; group = CommonPackageManager::IntelRating;
int HardwareRating = GetHardwareRating(platform, cpu_id, group); int HardwareRating = GetHardwareRating(platform, cpu_id, group);
LOGD("Current hardware platform %d, %d", platform, cpu_id); LOGD("Current hardware platform rating %d for (%d,%d)", HardwareRating, platform, cpu_id);
if (-1 == HardwareRating) if (-1 == HardwareRating)
{ {
@ -100,14 +94,17 @@ string CommonPackageManager::GetPackagePathByVersion(const std::string& version,
} }
else else
{ {
vector<PackageInfo>::iterator found = packages.end();
for (vector<PackageInfo>::iterator it = packages.begin(); it != packages.end(); ++it) for (vector<PackageInfo>::iterator it = packages.begin(); it != packages.end(); ++it)
{ {
int PackageRating = GetHardwareRating(it->GetPlatform(), it->GetCpuID(), group); int PackageRating = GetHardwareRating(it->GetPlatform(), it->GetCpuID(), group);
if (PackageRating >= 0) LOGD("Package \"%s\" rating %d for (%d,%d)", it->GetFullName().c_str(), PackageRating, it->GetPlatform(), it->GetCpuID());
if ((PackageRating >= 0) && (PackageRating <= HardwareRating))
{ {
if ((PackageRating <= HardwareRating) && (PackageRating > OptRating)) if (((it->GetVersion() >= OptVersion) && (PackageRating >= OptRating)) || (it->GetVersion() > OptVersion))
{ {
OptRating = PackageRating; OptRating = PackageRating;
OptVersion = it->GetVersion();
found = it; found = it;
} }
} }
@ -123,7 +120,6 @@ string CommonPackageManager::GetPackagePathByVersion(const std::string& version,
} }
} }
} }
}
return result; return result;
} }
@ -171,13 +167,13 @@ std::vector<std::pair<int, int> > CommonPackageManager::InitArmRating()
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv6 | FEATURES_HAS_VFPv3 | FEATURES_HAS_VFPv3d16)); result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv6 | FEATURES_HAS_VFPv3 | FEATURES_HAS_VFPv3d16));
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7)); result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7));
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3d16)); result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3d16));
result.push_back(std::pair<int, int>(PLATFORM_TEGRA2, ARCH_ARMv7 | FEATURES_HAS_VFPv3d16));
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3)); result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3));
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3d16 | FEATURES_HAS_VFPv3)); result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3d16 | FEATURES_HAS_VFPv3));
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_NEON)); result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_NEON));
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3d16 | FEATURES_HAS_NEON)); result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3d16 | FEATURES_HAS_NEON));
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON)); result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON));
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_VFPv3d16 | FEATURES_HAS_NEON)); result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_VFPv3d16 | FEATURES_HAS_NEON));
result.push_back(std::pair<int, int>(PLATFORM_TEGRA2, ARCH_ARMv7 | FEATURES_HAS_VFPv3d16));
result.push_back(std::pair<int, int>(PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON)); result.push_back(std::pair<int, int>(PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON));
return result; return result;

View File

@ -197,6 +197,7 @@ InstallPath("")
#ifndef __SUPPORT_TEGRA3 #ifndef __SUPPORT_TEGRA3
Platform = PLATFORM_UNKNOWN; Platform = PLATFORM_UNKNOWN;
#endif #endif
FullName = BasePackageName + "_v" + Version.substr(0, Version.size()-1); FullName = BasePackageName + "_v" + Version.substr(0, Version.size()-1);
if (PLATFORM_UNKNOWN != Platform) if (PLATFORM_UNKNOWN != Platform)
{ {
@ -392,7 +393,17 @@ InstallPath(install_path)
Platform = SplitPlatfrom(features); Platform = SplitPlatfrom(features);
if (PLATFORM_UNKNOWN != Platform) if (PLATFORM_UNKNOWN != Platform)
{ {
CpuID = 0; switch (Platform)
{
case PLATFORM_TEGRA2:
{
CpuID = ARCH_ARMv7 | FEATURES_HAS_VFPv3d16;
} break;
case PLATFORM_TEGRA3:
{
CpuID = ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON;
} break;
}
} }
else else
{ {