Skip to content

Commit

Permalink
texture: fix non-OMP code and some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcseacave committed Nov 11, 2023
1 parent 3c19cdd commit ac43899
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 26 deletions.
8 changes: 4 additions & 4 deletions apps/DensifyPointCloud/DensifyPointCloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,12 @@ int main(int argc, LPCTSTR* argv)
return EXIT_SUCCESS;
}
PointCloud sparsePointCloud;
if (OPT::nArchiveType != ARCHIVE_MVS || sceneType == Scene::SCENE_INTERFACE) {
if ((ARCHIVE_TYPE)OPT::nArchiveType != ARCHIVE_MVS || sceneType == Scene::SCENE_INTERFACE) {
#if TD_VERBOSE != TD_VERBOSE_OFF
if (VERBOSITY_LEVEL > 1 && !scene.pointcloud.IsEmpty())
scene.pointcloud.PrintStatistics(scene.images.data(), &scene.obb);
#endif
if (OPT::nArchiveType == ARCHIVE_MVS)
if ((ARCHIVE_TYPE)OPT::nArchiveType == ARCHIVE_MVS)
sparsePointCloud = scene.pointcloud;
TD_TIMER_START();
if (!scene.DenseReconstruction(OPT::nFusionMode, OPT::bCrop2ROI, OPT::fBorderROI)) {
Expand All @@ -420,12 +420,12 @@ int main(int argc, LPCTSTR* argv)

// save the final point-cloud
const String baseFileName(MAKE_PATH_SAFE(Util::getFileFullName(OPT::strOutputFileName)));
scene.pointcloud.Save(baseFileName+_T(".ply"), OPT::nArchiveType==ARCHIVE_MVS);
scene.pointcloud.Save(baseFileName+_T(".ply"), (ARCHIVE_TYPE)OPT::nArchiveType == ARCHIVE_MVS);
#if TD_VERBOSE != TD_VERBOSE_OFF
if (VERBOSITY_LEVEL > 2)
scene.ExportCamerasMLP(baseFileName+_T(".mlp"), baseFileName+_T(".ply"));
#endif
if (OPT::nArchiveType == ARCHIVE_MVS)
if ((ARCHIVE_TYPE)OPT::nArchiveType == ARCHIVE_MVS)
scene.pointcloud.Swap(sparsePointCloud);
scene.Save(baseFileName+_T(".mvs"), (ARCHIVE_TYPE)OPT::nArchiveType);
return EXIT_SUCCESS;
Expand Down
4 changes: 2 additions & 2 deletions apps/InterfaceMVSNet/InterfaceMVSNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ bool ParseSceneNerfstudio(Scene& scene, const String& strPath)
(float)dMin, (float)dMax,
depthMap, normalMap, confMap, viewsMap))
{
VERBOSE("Unable to save dmap: %s", dmapPath);
VERBOSE("Unable to save dmap: %s", dmapPath.c_str());
continue;
}
}
Expand Down Expand Up @@ -633,7 +633,7 @@ bool ParseSceneRTMV(Scene& scene, const String& strPath)
(float)dMin, (float)dMax,
depthMap, normalMap, confMap, viewsMap))
{
VERBOSE("Unable to save dmap: %s", dmapPath);
VERBOSE("Unable to save dmap: %s", dmapPath.c_str());
continue;
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/ReconstructMesh/ReconstructMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ bool Application::Initialize(size_t argc, LPCTSTR* argv)
Util::ensureValidPath(OPT::strImportROIFileName);
Util::ensureValidPath(OPT::strImagePointsFileName);
Util::ensureValidPath(OPT::strMeshFileName);
if (OPT::strPointCloudFileName.empty() && OPT::nArchiveType == ARCHIVE_MVS)
if (OPT::strPointCloudFileName.empty() && (ARCHIVE_TYPE)OPT::nArchiveType == ARCHIVE_MVS)
OPT::strPointCloudFileName = Util::getFileFullName(OPT::strInputFileName) + _T(".ply");
if (OPT::strOutputFileName.empty())
OPT::strOutputFileName = Util::getFileFullName(OPT::strInputFileName) + _T("_mesh.mvs");
Expand Down Expand Up @@ -483,7 +483,7 @@ int main(int argc, LPCTSTR* argv)
if (VERBOSITY_LEVEL > 2)
scene.ExportCamerasMLP(baseFileName+_T(".mlp"), baseFileName+OPT::strExportType);
#endif
if (OPT::nArchiveType != ARCHIVE_MVS || sceneType != Scene::SCENE_INTERFACE)
if ((ARCHIVE_TYPE)OPT::nArchiveType != ARCHIVE_MVS || sceneType != Scene::SCENE_INTERFACE)
scene.Save(baseFileName+_T(".mvs"), (ARCHIVE_TYPE)OPT::nArchiveType);
}

Expand Down
4 changes: 2 additions & 2 deletions apps/RefineMesh/RefineMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ bool Application::Initialize(size_t argc, LPCTSTR* argv)
// initialize optional options
Util::ensureValidPath(OPT::strMeshFileName);
Util::ensureValidPath(OPT::strOutputFileName);
if (OPT::strMeshFileName.empty() && OPT::nArchiveType == ARCHIVE_MVS)
if (OPT::strMeshFileName.empty() && (ARCHIVE_TYPE)OPT::nArchiveType == ARCHIVE_MVS)
OPT::strMeshFileName = Util::getFileFullName(OPT::strInputFileName) + _T(".ply");
if (OPT::strOutputFileName.empty())
OPT::strOutputFileName = Util::getFileFullName(OPT::strInputFileName) + _T("_refine.mvs");
Expand Down Expand Up @@ -259,7 +259,7 @@ int main(int argc, LPCTSTR* argv)
if (VERBOSITY_LEVEL > 2)
scene.ExportCamerasMLP(baseFileName+_T(".mlp"), baseFileName+OPT::strExportType);
#endif
if (OPT::nArchiveType != ARCHIVE_MVS || sceneType != Scene::SCENE_INTERFACE)
if ((ARCHIVE_TYPE)OPT::nArchiveType != ARCHIVE_MVS || sceneType != Scene::SCENE_INTERFACE)
scene.Save(baseFileName+_T(".mvs"), (ARCHIVE_TYPE)OPT::nArchiveType);
return EXIT_SUCCESS;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/TextureMesh/TextureMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ bool Application::Initialize(size_t argc, LPCTSTR* argv)
Util::ensureValidPath(OPT::strMeshFileName);
Util::ensureValidPath(OPT::strOutputFileName);
Util::ensureValidPath(OPT::strViewsFileName);
if (OPT::strMeshFileName.empty() && OPT::nArchiveType == ARCHIVE_MVS)
if (OPT::strMeshFileName.empty() && (ARCHIVE_TYPE)OPT::nArchiveType == ARCHIVE_MVS)
OPT::strMeshFileName = Util::getFileFullName(OPT::strInputFileName) + _T(".ply");
if (OPT::strOutputFileName.empty())
OPT::strOutputFileName = Util::getFileFullName(OPT::strInputFileName) + _T("_texture.mvs");
Expand Down Expand Up @@ -318,7 +318,7 @@ int main(int argc, LPCTSTR* argv)
if (VERBOSITY_LEVEL > 2)
scene.ExportCamerasMLP(baseFileName+_T(".mlp"), baseFileName+OPT::strExportType);
#endif
if (OPT::nArchiveType != ARCHIVE_MVS || sceneType != Scene::SCENE_INTERFACE)
if ((ARCHIVE_TYPE)OPT::nArchiveType != ARCHIVE_MVS || sceneType != Scene::SCENE_INTERFACE)
scene.Save(baseFileName+_T(".mvs"), (ARCHIVE_TYPE)OPT::nArchiveType);
}

Expand Down
6 changes: 3 additions & 3 deletions apps/TransformScene/TransformScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ bool Application::Initialize(size_t argc, LPCTSTR* argv)
Util::ensureValidPath(OPT::strPointCloudFileName);
Util::ensureValidPath(OPT::strMeshFileName);
Util::ensureValidPath(OPT::strOutputFileName);
if (OPT::strMeshFileName.empty() && OPT::nArchiveType == ARCHIVE_MVS && strInputFileNameExt == MVS_EXT)
if (OPT::strMeshFileName.empty() && (ARCHIVE_TYPE)OPT::nArchiveType == ARCHIVE_MVS && strInputFileNameExt == MVS_EXT)
OPT::strMeshFileName = Util::getFileFullName(OPT::strInputFileName) + _T(".ply");
if (OPT::strOutputFileName.empty())
OPT::strOutputFileName = Util::getFileName(OPT::strInputFileName) + _T("_transformed") MVS_EXT;
Expand Down Expand Up @@ -318,9 +318,9 @@ int main(int argc, LPCTSTR* argv)
// write transformed scene
if (scene.IsValid())
scene.Save(MAKE_PATH_SAFE(OPT::strOutputFileName), (ARCHIVE_TYPE)OPT::nArchiveType);
if (!scene.IsValid() || OPT::nArchiveType == ARCHIVE_MVS) {
if (!scene.IsValid() || (ARCHIVE_TYPE)OPT::nArchiveType == ARCHIVE_MVS) {
if (!scene.pointcloud.IsEmpty())
scene.pointcloud.Save(baseFileName + _T(".ply"), OPT::nArchiveType==ARCHIVE_MVS);
scene.pointcloud.Save(baseFileName + _T(".ply"), (ARCHIVE_TYPE)OPT::nArchiveType == ARCHIVE_MVS);
if (!scene.mesh.IsEmpty())
scene.mesh.Save(baseFileName + OPT::strExportType);
}
Expand Down
1 change: 1 addition & 0 deletions build/Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ macro(optimize_default_compiler_settings)
add_extra_compiler_option(-Wno-delete-incomplete)
add_extra_compiler_option(-Wno-unnamed-type-template-args)
add_extra_compiler_option(-Wno-int-in-bool-context)
add_extra_compiler_option(-Wno-deprecated-declarations)
endif()
add_extra_compiler_option(-fdiagnostics-show-option)
add_extra_compiler_option(-ftemplate-backtrace-limit=0)
Expand Down
2 changes: 1 addition & 1 deletion libs/Common/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ LPTSTR Timer::GetClock(uint8_t* nHH, uint8_t* nMM, LPTSTR szChar) const
if (szChar == NULL)
return NULL;

_stprintf(szChar, "%.2d:%.2d:%.2d", m_nHH, m_nMM, m_nSS);
_sntprintf(szChar, 32, "%.2d:%.2d:%.2d", m_nHH, m_nMM, m_nSS);
return szChar;
} // GetClock
/*----------------------------------------------------------------*/
Expand Down
10 changes: 5 additions & 5 deletions libs/Common/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,34 +598,34 @@ class GENERAL_API Util
uint32_t rez = (uint32_t)(sTime / ((int64_t)24*3600*1000));
if (rez) {
++nrNumbers;
len += _stprintf(buf+len, "%ud", rez);
len += _sntprintf(buf+len, 128, "%ud", rez);
}
if (nAproximate > 3 && nrNumbers > 0)
return buf;
rez = (uint32_t)((sTime%((int64_t)24*3600*1000)) / (3600*1000));
if (rez) {
++nrNumbers;
len += _stprintf(buf+len, "%uh", rez);
len += _sntprintf(buf+len, 128, "%uh", rez);
}
if (nAproximate > 2 && nrNumbers > 0)
return buf;
rez = (uint32_t)((sTime%((int64_t)3600*1000)) / (60*1000));
if (rez) {
++nrNumbers;
len += _stprintf(buf+len, "%um", rez);
len += _sntprintf(buf+len, 128, "%um", rez);
}
if (nAproximate > 1 && nrNumbers > 0)
return buf;
rez = (uint32_t)((sTime%((int64_t)60*1000)) / (1*1000));
if (rez) {
++nrNumbers;
len += _stprintf(buf+len, "%us", rez);
len += _sntprintf(buf+len, 128, "%us", rez);
}
if (nAproximate > 0 && nrNumbers > 0)
return buf;
rez = (uint32_t)(sTime%((int64_t)1*1000));
if (rez || !nrNumbers)
len += _stprintf(buf+len, "%ums", rez);
len += _sntprintf(buf+len, 128, "%ums", rez);

return String(buf, len);
}
Expand Down
6 changes: 3 additions & 3 deletions libs/MVS/RectsBinPack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ MaxRectsBinPack::RectWIdxArr MaxRectsBinPack::Insert(RectWIdxArr& unplacedRects,
IDX privBestRectIndex = NO_IDX;
Rect privBestNode;
#pragma omp for nowait
for (int_t i=0; i<(int_t)unplacedRects.GetSize(); ++i) {
for (int_t i=0; i<(int_t)unplacedRects.size(); ++i) {
int score1, score2;
Rect newNode(ScoreRect(unplacedRects[i].rect.width, unplacedRects[i].rect.height, method, score1, score2));
if (score1 < privBestScore1 || (score1 == privBestScore1 && score2 < privBestScore2)) {
Expand All @@ -127,9 +127,9 @@ MaxRectsBinPack::RectWIdxArr MaxRectsBinPack::Insert(RectWIdxArr& unplacedRects,
}
}
#else
FOREACH(i, rects) {
FOREACH(i, unplacedRects) {
int score1, score2;
Rect newNode(ScoreRect(rects[i].width, rects[i].height, method, score1, score2));
Rect newNode(ScoreRect(unplacedRects[i].rect.width, unplacedRects[i].rect.height, method, score1, score2));
if (score1 < bestScore1 || (score1 == bestScore1 && score2 < bestScore2)) {
bestScore1 = score1;
bestScore2 = score2;
Expand Down
2 changes: 0 additions & 2 deletions libs/MVS/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1926,8 +1926,6 @@ PointCloud Scene::BuildTowerMesh(const PointCloud& origPointCloud, const Point2f
const float aboveRad(circleRadii[ri - 1]);
float& circleRadius = circleRadii[ri];
const float belowRad(circleRadii[ri + 1]);
const float AbvCrtDeltaPrc = ABS(aboveRad - circleRadius) / aboveRad;
const float BelCrtDeltaPrc = ABS(circleRadius - belowRad) / circleRadius;
// set current radius as average of the most similar values in the closest 7 neighbors
if (ri > 2 && ri < circleRadii.size() - 5) {
FloatArr neighSeven(7);
Expand Down

0 comments on commit ac43899

Please sign in to comment.