diff --git a/CMakeLists.txt b/CMakeLists.txt index f60dd1cd25bceed84ca19d424e9d1d0126a3cee6..bc61a7a6736a252e5b39583dca9246b526719dcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -328,9 +328,9 @@ if (WIN32) # TODO(nick) Should do based upon compiler (VS) set(OS_LIBS "") else() add_definitions(-DUNIX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -msse3 -Werror") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -pg -Wall") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -Wall -mfpmath=sse") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -msse3 -Werror -Wall") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -pg") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -mfpmath=sse") set(OS_LIBS "dl") endif() diff --git a/applications/calibration/src/lens.cpp b/applications/calibration/src/lens.cpp index ffa3cd078593a3533b6cfa105ff3eae7f21e5f5e..72694ebacda05370a4a32a214e400c72a6d94d0e 100644 --- a/applications/calibration/src/lens.cpp +++ b/applications/calibration/src/lens.cpp @@ -193,7 +193,7 @@ void ftl::calibration::intrinsic(map<string, string> &opt) { cv::destroyAllWindows(); - bool calib_ok = true; + //bool calib_ok = true; for (int c = 0; c < n_cameras; c++) { LOG(INFO) << "Calculating intrinsic paramters for camera " << std::to_string(c); @@ -219,7 +219,7 @@ void ftl::calibration::intrinsic(map<string, string> &opt) { continue; } - calib_ok = true; + //calib_ok = true; calibrate_flags &= ~cv::CALIB_FIX_K1 & ~cv::CALIB_FIX_K2 & ~cv::CALIB_FIX_K3; double fovx, fovy, focal_length, aspect_ratio; diff --git a/applications/vision/CMakeLists.txt b/applications/vision/CMakeLists.txt index 78d4bb28c548e41bf0b26b5e04019db75e21f63b..a40126b95f7cc9234078528a0f59263eecf0f802 100644 --- a/applications/vision/CMakeLists.txt +++ b/applications/vision/CMakeLists.txt @@ -6,7 +6,7 @@ set(CVNODESRC src/main.cpp - src/middlebury.cpp + #src/middlebury.cpp ) add_executable(ftl-vision ${CVNODESRC}) diff --git a/applications/vision/src/main.cpp b/applications/vision/src/main.cpp index 06c352b25b6cbac045bafa8e3e96bb49ca93abd9..2dfabcc42bcbe52bdc07f5ad2632fd558f90b8ba 100644 --- a/applications/vision/src/main.cpp +++ b/applications/vision/src/main.cpp @@ -17,7 +17,7 @@ #include <opencv2/opencv.hpp> #include <ftl/rgbd.hpp> -#include <ftl/middlebury.hpp> +//#include <ftl/middlebury.hpp> #include <ftl/net/universe.hpp> #include <ftl/master.hpp> #include <nlohmann/json.hpp> diff --git a/components/calibration/src/parameters.cpp b/components/calibration/src/parameters.cpp index ef352b8a10908c7c57c8332b14d5fc4f53ee722a..d0e20aa63428670b6b7783fa3e7b1129c69585e7 100644 --- a/components/calibration/src/parameters.cpp +++ b/components/calibration/src/parameters.cpp @@ -206,7 +206,7 @@ bool ftl::calibration::validate::distortionCoefficients(const Mat &D, Size size) (D.total() == 8) || (D.total() == 12))) { return false; } - for (int i = 0; i < D.total(); i++) { + for (size_t i = 0; i < D.total(); i++) { if (!std::isfinite(D.at<double>(i))) { return false; } } diff --git a/components/common/cpp/include/ftl/configurable.hpp b/components/common/cpp/include/ftl/configurable.hpp index dfe84dc131f79bbc8744f078e51c1b068d9e2228..1c157ba601c01a1bb8cb01df5eddfd07b60b6269 100644 --- a/components/common/cpp/include/ftl/configurable.hpp +++ b/components/common/cpp/include/ftl/configurable.hpp @@ -15,6 +15,9 @@ #define REQUIRED(...) required(__func__, __VA_ARGS__) +// TODO: Find a better place for this +#define UNUSED(A) (void)(A) + namespace ftl { class Configurable; diff --git a/components/common/cpp/include/ftl/cuda_texture.hpp b/components/common/cpp/include/ftl/cuda_texture.hpp index 8edf9c3fee32ad58659b93690caf492c64a100b7..6f710d9b76ed9812bcfe4597af404f34e1ad56e5 100644 --- a/components/common/cpp/include/ftl/cuda_texture.hpp +++ b/components/common/cpp/include/ftl/cuda_texture.hpp @@ -53,8 +53,8 @@ class TextureObjectBase { inline size_t pixelPitch() const { return pitch2_; } inline uchar *devicePtr() const { return ptr_; }; __host__ __device__ inline uchar *devicePtr(int v) const { return &ptr_[v*pitch_]; } - __host__ __device__ inline int width() const { return width_; } - __host__ __device__ inline int height() const { return height_; } + __host__ __device__ inline size_t width() const { return width_; } + __host__ __device__ inline size_t height() const { return height_; } __host__ __device__ inline cudaTextureObject_t cudaTexture() const { return texobj_; } cv::cuda::GpuMat to_gpumat() const; @@ -72,8 +72,8 @@ class TextureObjectBase { cudaTextureObject_t texobj_; size_t pitch_; size_t pitch2_; // in T units - int width_; - int height_; + size_t width_; + size_t height_; uchar *ptr_; // Device memory pointer bool needsfree_; // We manage memory, so free it bool needsdestroy_; // The texture object needs to be destroyed @@ -107,7 +107,7 @@ class TextureObject : public TextureObjectBase { operator cv::cuda::GpuMat(); void create(const cv::Size &); - void create(int w, int h); + void create(size_t w, size_t h); __host__ __device__ T *devicePtr() const { return (T*)(ptr_); }; __host__ __device__ T *devicePtr(int v) const { return &(T*)(ptr_)[v*pitch2_]; } @@ -292,7 +292,7 @@ void TextureObject<T>::create(const cv::Size &s) { } template <typename T> -void TextureObject<T>::create(int w, int h) { +void TextureObject<T>::create(size_t w, size_t h) { if (width_ != w || height_ != h) { *this = std::move(TextureObject<T>(w, h)); } diff --git a/components/common/cpp/src/timer.cpp b/components/common/cpp/src/timer.cpp index 79fb8720bd43fb7bbd35f1fff3fa0f7a537d195e..7d1cc2b5f315558ec282bfea7c7253948f72d732 100644 --- a/components/common/cpp/src/timer.cpp +++ b/components/common/cpp/src/timer.cpp @@ -54,7 +54,6 @@ double ftl::timer::get_time_seconds() { } static void waitTimePoint() { - auto start = high_resolution_clock::now(); int64_t now = get_time(); int64_t target = now / mspf; int64_t msdelay = mspf - (now % mspf); diff --git a/components/net/cpp/src/universe.cpp b/components/net/cpp/src/universe.cpp index d3b4d1f328119551e79c07a97397502e9258ad1b..d5aeb743ac545ae525b2ee9a8c89cb86c098de38 100644 --- a/components/net/cpp/src/universe.cpp +++ b/components/net/cpp/src/universe.cpp @@ -46,8 +46,8 @@ callback_t ftl::net::Universe::cbid__ = 0; Universe::Universe() : Configurable(), active_(true), - impl_(new ftl::net::NetImplDetail), this_peer(ftl::net::this_peer), + impl_(new ftl::net::NetImplDetail), phase_(0), send_size_(TCP_SEND_BUFFER_SIZE), recv_size_(TCP_RECEIVE_BUFFER_SIZE), @@ -62,8 +62,8 @@ Universe::Universe() : Universe::Universe(nlohmann::json &config) : Configurable(config), active_(true), - impl_(new ftl::net::NetImplDetail), this_peer(ftl::net::this_peer), + impl_(new ftl::net::NetImplDetail), phase_(0), send_size_(value("tcp_send_buffer",TCP_SEND_BUFFER_SIZE)), recv_size_(value("tcp_recv_buffer",TCP_RECEIVE_BUFFER_SIZE)), diff --git a/components/net/cpp/test/net_integration.cpp b/components/net/cpp/test/net_integration.cpp index 200e3c5f999e1428128dc2f382d92dee425b88ba..3f43ceb27c61ed0cce51b3a9c55b4b487915a2b4 100644 --- a/components/net/cpp/test/net_integration.cpp +++ b/components/net/cpp/test/net_integration.cpp @@ -286,6 +286,7 @@ TEST_CASE("Peer::call() __ping__", "") { for (int i=0; i<100; ++i) { ftl::pool.push([&count, p](int id) { int64_t res = p->call<int64_t>("__ping__"); + REQUIRE( res > 0 ); count++; }); } @@ -297,6 +298,7 @@ TEST_CASE("Peer::call() __ping__", "") { bool errored = false; try { int64_t res = p->call<int64_t>("__ping2__"); + REQUIRE( res > 0 ); // Not called or required actually } catch (const ftl::exception &e) { errored = true; } diff --git a/components/renderers/cpp/src/CUDARender.cpp b/components/renderers/cpp/src/CUDARender.cpp index a3fb4cdd221d1852046011bea4edbec4848307b5..9fb3c045c66bbefa8fa7adaf820d9b8662ba7098 100644 --- a/components/renderers/cpp/src/CUDARender.cpp +++ b/components/renderers/cpp/src/CUDARender.cpp @@ -31,16 +31,6 @@ using ftl::cuda::Mask; using ftl::render::parseCUDAColour; using ftl::render::parseCVColour; -static Eigen::Affine3d create_rotation_matrix(float ax, float ay, float az) { - Eigen::Affine3d rx = - Eigen::Affine3d(Eigen::AngleAxisd(ax, Eigen::Vector3d(1, 0, 0))); - Eigen::Affine3d ry = - Eigen::Affine3d(Eigen::AngleAxisd(ay, Eigen::Vector3d(0, 1, 0))); - Eigen::Affine3d rz = - Eigen::Affine3d(Eigen::AngleAxisd(az, Eigen::Vector3d(0, 0, 1))); - return rz * rx * ry; -} - CUDARender::CUDARender(nlohmann::json &config) : ftl::render::Renderer(config), scene_(nullptr) { /*if (config["clipping"].is_object()) { auto &c = config["clipping"]; @@ -208,7 +198,7 @@ void CUDARender::_adjustDepthThresholds(const ftl::rgbd::Camera &fcam) { ftl::cuda::TextureObject<float> &CUDARender::_getDepthBuffer(const cv::Size &size) { for (auto *b : depth_buffers_) { - if (b->width() == size.width && b->height() == size.height) return *b; + if (b->width() == static_cast<size_t>(size.width) && b->height() == static_cast<size_t>(size.height)) return *b; } auto *nb = new ftl::cuda::TextureObject<float>(size.width, size.height); depth_buffers_.push_back(nb); @@ -217,7 +207,7 @@ ftl::cuda::TextureObject<float> &CUDARender::_getDepthBuffer(const cv::Size &siz ftl::cuda::TextureObject<short2> &CUDARender::_getScreenBuffer(const cv::Size &size) { for (auto *b : screen_buffers_) { - if (b->width() == size.width && b->height() == size.height) return *b; + if (b->width() == static_cast<size_t>(size.width) && b->height() == static_cast<size_t>(size.height)) return *b; } auto *nb = new ftl::cuda::TextureObject<short2>(size.width, size.height); screen_buffers_.push_back(nb); diff --git a/components/renderers/cpp/src/overlay.cpp b/components/renderers/cpp/src/overlay.cpp index 78e6645c7ce6c79ba1dd83156f502ba47b608a11..9ea3af5edb14153aac4cdf58aa02747ab24ca3e1 100644 --- a/components/renderers/cpp/src/overlay.cpp +++ b/components/renderers/cpp/src/overlay.cpp @@ -177,6 +177,8 @@ void Overlay::_drawFilledShape(Shape shape, const Eigen::Matrix4d &pose, float s Eigen::Matrix4f mv = pose.cast<float>(); auto [offset,count, loffset, lcount] = shapes_[shape]; + UNUSED(loffset); + UNUSED(lcount); oShader.setUniform("scale", scale); oShader.setUniform("pose", mv); oShader.setUniform("blockColour", Eigen::Vector4f(float(c.x)/255.0f,float(c.y)/255.0f,float(c.z)/255.0f,float(c.w)/255.0f)); @@ -215,6 +217,9 @@ void Overlay::_drawAxis(const Eigen::Matrix4d &pose, const Eigen::Vector3f &scal Eigen::Matrix4f mv = pose.cast<float>(); auto [offset,count,loffset,lcount] = shapes_[Shape::AXIS]; + UNUSED(offset); + UNUSED(count); + UNUSED(lcount); oShader.setUniform("scale", scale); oShader.setUniform("pose", mv); diff --git a/components/rgbd-sources/include/ftl/rgbd/frame.hpp b/components/rgbd-sources/include/ftl/rgbd/frame.hpp index 688e5fed2ddd9d1ab53a92d5a5ddd8751c8be26a..6cbfcec5599b3eecee7a68e115d5874027eae13f 100644 --- a/components/rgbd-sources/include/ftl/rgbd/frame.hpp +++ b/components/rgbd-sources/include/ftl/rgbd/frame.hpp @@ -210,7 +210,7 @@ ftl::cuda::TextureObject<T> &Frame::getTexture(ftl::codecs::Channel c) { auto &m = getData(c); if (!m.isgpu) throw FTL_Error("Texture channel is not on GPU"); - if (m.tex.cvType() != ftl::traits::OpenCVType<T>::value || m.tex.width() != m.gpu.cols || m.tex.height() != m.gpu.rows || m.gpu.type() != m.tex.cvType()) { + if (m.tex.cvType() != ftl::traits::OpenCVType<T>::value || m.tex.width() != static_cast<size_t>(m.gpu.cols) || m.tex.height() != static_cast<size_t>(m.gpu.rows) || m.gpu.type() != m.tex.cvType()) { throw FTL_Error("Texture has not been created properly for this channel: " << (int)c); } @@ -240,7 +240,7 @@ ftl::cuda::TextureObject<T> &Frame::createTexture(ftl::codecs::Channel c, const if (m.tex.devicePtr() == nullptr) { //LOG(INFO) << "Creating texture object"; m.tex = ftl::cuda::TextureObject<T>(m.gpu, interpolated); - } else if (m.tex.cvType() != ftl::traits::OpenCVType<T>::value || m.tex.width() != m.gpu.cols || m.tex.height() != m.gpu.rows) { + } else if (m.tex.cvType() != ftl::traits::OpenCVType<T>::value || m.tex.width() != static_cast<size_t>(m.gpu.cols) || m.tex.height() != static_cast<size_t>(m.gpu.rows)) { //LOG(INFO) << "Recreating texture object for '" << ftl::codecs::name(c) << "'"; m.tex.free(); m.tex = ftl::cuda::TextureObject<T>(m.gpu, interpolated); @@ -272,7 +272,7 @@ ftl::cuda::TextureObject<T> &Frame::createTexture(ftl::codecs::Channel c, bool i if (m.tex.devicePtr() == nullptr) { //LOG(INFO) << "Creating texture object"; m.tex = ftl::cuda::TextureObject<T>(m.gpu, interpolated); - } else if (m.tex.cvType() != ftl::traits::OpenCVType<T>::value || m.tex.width() != m.gpu.cols || m.tex.height() != m.gpu.rows || m.tex.devicePtr() != m.gpu.data) { + } else if (m.tex.cvType() != ftl::traits::OpenCVType<T>::value || m.tex.width() != static_cast<size_t>(m.gpu.cols) || m.tex.height() != static_cast<size_t>(m.gpu.rows) || m.tex.devicePtr() != m.gpu.data) { //LOG(INFO) << "Recreating texture object for '" << ftl::codecs::name(c) << "'."; m.tex.free(); m.tex = ftl::cuda::TextureObject<T>(m.gpu, interpolated);