diff --git a/applications/groupview/src/main.cpp b/applications/groupview/src/main.cpp index 99820d759b6c2ef6be37e34e6efea157295c0104..6b32221ef1a13ad05f9e5bb915c1186eca0aa52c 100644 --- a/applications/groupview/src/main.cpp +++ b/applications/groupview/src/main.cpp @@ -110,11 +110,12 @@ void modeLeftRight(ftl::Configurable *root) { }); int idx = 0; - int key; Mat show; while (ftl::running) { + int key; + while (!new_frames) { for (auto src : sources) { src->grab(30); } key = cv::waitKey(10); diff --git a/applications/reconstruct/include/ftl/cuda_matrix_util.hpp b/applications/reconstruct/include/ftl/cuda_matrix_util.hpp index e8d803e6fdf7b7c62d52d456ddce288bf554b233..4dd1db7fa8a58c84a40f9d93abd8cc0a492b2792 100644 --- a/applications/reconstruct/include/ftl/cuda_matrix_util.hpp +++ b/applications/reconstruct/include/ftl/cuda_matrix_util.hpp @@ -1606,6 +1606,7 @@ inline __device__ __host__ matNxM<2, 2> matNxM<2, 2>::getInverse() const // To Matrix from floatNxN template<> +// cppcheck-suppress syntaxError template<> inline __device__ __host__ matNxM<1, 1>::matNxM(const float& other) { diff --git a/applications/reconstruct/src/dibr.cu b/applications/reconstruct/src/dibr.cu index fade3634314698772c46b126218765862d1adbaf..66428ce3086e42b6a3e81c667ae126314d910c98 100644 --- a/applications/reconstruct/src/dibr.cu +++ b/applications/reconstruct/src/dibr.cu @@ -158,8 +158,7 @@ __global__ void OLD_dibr_visibility_kernel(TextureObject<int> depth, int cam, Sp const int upsample = min(UPSAMPLE_MAX, int((r) * params.camera.fx / camPos.z)); // Not on screen so stop now... - if (screenPos.x + upsample < 0 || screenPos.y + upsample < 0 || - screenPos.x - upsample >= depth.width() || screenPos.y - upsample >= depth.height()) return; + if (screenPos.x - upsample >= depth.width() || screenPos.y - upsample >= depth.height()) return; // TODO:(Nick) Check depth buffer and don't do anything if already hidden? @@ -181,7 +180,7 @@ __global__ void OLD_dibr_visibility_kernel(TextureObject<int> depth, int cam, Sp // and depth remains within the bounds. // How to find min and max depths? - float ld = nearest.z; + //float ld = nearest.z; // TODO: (Nick) Estimate depth using points plane, but needs better normals. //float t; @@ -241,7 +240,7 @@ __global__ void OLD_dibr_visibility_kernel(TextureObject<int> depth, int cam, Sp }*/ //nearest = params.camera.kinectDepthToSkeleton(screenPos.x+u,screenPos.y+v,d); // ld + (d - ld)*0.8f - ld = d; + //ld = d; } //} } @@ -287,8 +286,7 @@ __global__ void OLD_dibr_visibility_kernel(TextureObject<int> depth, int cam, Sp const int upsample = min(UPSAMPLE_MAX, int((4.0f*r) * params.camera.fx / camPos.z)); // Not on screen so stop now... - if (screenPos.x + upsample < 0 || screenPos.y + upsample < 0 || - screenPos.x - upsample >= depth.width() || screenPos.y - upsample >= depth.height()) return; + if (screenPos.x - upsample >= depth.width() || screenPos.y - upsample >= depth.height()) return; // TODO:(Nick) Check depth buffer and don't do anything if already hidden? @@ -575,7 +573,7 @@ __global__ void dibr_attribute_contrib_kernel( const ftl::voxhash::DepthCameraCUDA &camera = c_cameras[cam]; const int tid = (threadIdx.x + threadIdx.y * blockDim.x); - const int warp = tid / WARP_SIZE; + //const int warp = tid / WARP_SIZE; const int x = (blockIdx.x*blockDim.x + threadIdx.x) / WARP_SIZE; const int y = blockIdx.y*blockDim.y + threadIdx.y; @@ -592,8 +590,7 @@ __global__ void dibr_attribute_contrib_kernel( const int upsample = 8; //min(UPSAMPLE_MAX, int((5.0f*r) * params.camera.fx / camPos.z)); // Not on screen so stop now... - if (screenPos.x < 0 || screenPos.y < 0 || - screenPos.x >= depth_in.width() || screenPos.y >= depth_in.height()) return; + if (screenPos.x >= depth_in.width() || screenPos.y >= depth_in.height()) return; // Is this point near the actual surface and therefore a contributor? const float d = ((float)depth_in.tex2D((int)screenPos.x, (int)screenPos.y)/1000.0f); @@ -722,7 +719,7 @@ void ftl::cuda::dibr(const TextureObject<int> &depth_out, cudaSafeCall(cudaDeviceSynchronize()); #endif - int i=3; + //int i=3; bool noSplatting = params.m_flags & ftl::render::kNoSplatting; diff --git a/components/codecs/src/nvpipe_encoder.cpp b/components/codecs/src/nvpipe_encoder.cpp index cbae706ef8d5729615d4084ca8c024fc69333ea2..e03dc7073349a97bb7e090ce5b9a563b8ea2117a 100644 --- a/components/codecs/src/nvpipe_encoder.cpp +++ b/components/codecs/src/nvpipe_encoder.cpp @@ -30,8 +30,6 @@ void NvPipeEncoder::reset() { /* Check preset resolution is not better than actual resolution. */ definition_t NvPipeEncoder::_verifiedDefinition(definition_t def, const cv::Mat &in) { - bool is_float = in.type() == CV_32F; - int height = ftl::codecs::getHeight(def); // FIXME: Make sure this can't go forever diff --git a/components/common/cpp/src/configuration.cpp b/components/common/cpp/src/configuration.cpp index 476b09cabb72a4b82e4832721c21fd552b2a562b..8a3849e8ee8799119f3d15700dc277e1dece7654 100644 --- a/components/common/cpp/src/configuration.cpp +++ b/components/common/cpp/src/configuration.cpp @@ -458,7 +458,7 @@ Configurable *ftl::config::configure(ftl::config::json_t &cfg) { loguru::g_preamble_uptime = false; loguru::g_preamble_thread = false; int argc = 1; - const char *argv[] = {"d",0}; + const char *argv[]{"d",0}; loguru::init(argc, const_cast<char**>(argv), "--verbosity"); config_index.clear(); diff --git a/components/common/cpp/src/uri.cpp b/components/common/cpp/src/uri.cpp index 0db7a4af505f28bd162d81eed763241ed6f5ff9d..90fb33522c1c2d701fac47b0a6d43a5a6afee3a7 100644 --- a/components/common/cpp/src/uri.cpp +++ b/components/common/cpp/src/uri.cpp @@ -41,8 +41,9 @@ void URI::_parse(uri_t puri) { // NOTE: Non-standard additions to allow for Unix style relative file names. if (suri[0] == '.') { char cwdbuf[1024]; - getcwd(cwdbuf, 1024); - suri = string("file://") + string(cwdbuf) + suri.substr(1); + if (getcwd(cwdbuf, 1024)) { + suri = string("file://") + string(cwdbuf) + suri.substr(1); + } } else if (suri[0] == '~') { #ifdef WIN32 suri = string("file://") + string(std::getenv("HOMEDRIVE")) + string(std::getenv("HOMEPATH")) + suri.substr(1); diff --git a/components/rgbd-sources/src/snapshot.cpp b/components/rgbd-sources/src/snapshot.cpp index 8ce89fa080392eb755278f42d92c60a7b0fa0f1e..7a80ee677c6275f2446d0f2b404e3bc778745d08 100644 --- a/components/rgbd-sources/src/snapshot.cpp +++ b/components/rgbd-sources/src/snapshot.cpp @@ -169,7 +169,7 @@ bool SnapshotWriter::addRGBD(size_t source, const cv::Mat &rgb, const cv::Mat &d void SnapshotWriter::writeIndex() { FileStorage fs(".yml", FileStorage::WRITE + FileStorage::MEMORY); - vector<string> channels = {"time", "rgb_left", "depth_left"}; + vector<string> channels{"time", "rgb_left", "depth_left"}; fs << "sources" << sources_; fs << "params" <<params_; diff --git a/components/rgbd-sources/test/channel_unit.cpp b/components/rgbd-sources/test/channel_unit.cpp index eb88777bd4a8c564c9a57d5fd99b53cdc164d67c..25171678540f1970088d84e1e842865a4249455e 100644 --- a/components/rgbd-sources/test/channel_unit.cpp +++ b/components/rgbd-sources/test/channel_unit.cpp @@ -26,7 +26,7 @@ TEST_CASE("Channel or-ing", "") { cs |= Channel::Right; - REQUIRE( cs.count() == 2 ); + REQUIRE( (cs.count() == 2) ); REQUIRE( cs.has(Channel::Right) ); REQUIRE( cs.has(Channel::Depth) ); } @@ -36,7 +36,7 @@ TEST_CASE("Channel or-ing", "") { cs = Channel::Right | Channel::Flow | Channel::Left; - REQUIRE( cs.count() == 3 ); + REQUIRE( (cs.count() == 3) ); REQUIRE( cs.has(Channel::Right) ); REQUIRE( cs.has(Channel::Flow) ); REQUIRE( cs.has(Channel::Left) ); @@ -45,7 +45,7 @@ TEST_CASE("Channel or-ing", "") { SECTION("Combine multiple channels at init") { Channels cs = Channel::Right | Channel::Flow | Channel::Left; - REQUIRE( cs.count() == 3 ); + REQUIRE( (cs.count() == 3) ); REQUIRE( cs.has(Channel::Right) ); REQUIRE( cs.has(Channel::Flow) ); REQUIRE( cs.has(Channel::Left) ); @@ -58,7 +58,7 @@ TEST_CASE("Channel adding", "") { cs += Channel::Right; - REQUIRE( cs.count() == 2 ); + REQUIRE( (cs.count() == 2) ); REQUIRE( cs.has(Channel::Right) ); REQUIRE( cs.has(Channel::Depth) ); } @@ -68,7 +68,7 @@ TEST_CASE("Channel adding", "") { cs = Channel::Right + Channel::Flow + Channel::Left; - REQUIRE( cs.count() == 3 ); + REQUIRE( (cs.count() == 3) ); REQUIRE( cs.has(Channel::Right) ); REQUIRE( cs.has(Channel::Flow) ); REQUIRE( cs.has(Channel::Left) ); @@ -81,7 +81,7 @@ TEST_CASE("Channel subtracting", "") { cs -= Channel::Flow; - REQUIRE( cs.count() == 2 ); + REQUIRE( (cs.count() == 2) ); REQUIRE( cs.has(Channel::Right) ); REQUIRE( cs.has(Channel::Left) ); } diff --git a/components/rgbd-sources/test/source_unit.cpp b/components/rgbd-sources/test/source_unit.cpp index 4b14bee1887c956a2b646009b82d779e663b97d7..dca38be2ffb6e06b8be416c8de71a7a799c77867 100644 --- a/components/rgbd-sources/test/source_unit.cpp +++ b/components/rgbd-sources/test/source_unit.cpp @@ -14,7 +14,7 @@ class Snapshot {}; class SnapshotReader { public: - SnapshotReader(const std::string &) {} + explicit SnapshotReader(const std::string &) {} Snapshot readArchive() { return Snapshot(); }; }; @@ -22,7 +22,7 @@ namespace detail { class ImageSource : public ftl::rgbd::detail::Source { public: - ImageSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { + explicit ImageSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { last_type = "image"; } ImageSource(ftl::rgbd::Source *host, const std::string &f) : ftl::rgbd::detail::Source(host) { @@ -37,7 +37,7 @@ class ImageSource : public ftl::rgbd::detail::Source { class StereoVideoSource : public ftl::rgbd::detail::Source { public: - StereoVideoSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { + explicit StereoVideoSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { last_type = "video"; } StereoVideoSource(ftl::rgbd::Source *host, const std::string &f) : ftl::rgbd::detail::Source(host) { @@ -52,7 +52,7 @@ class StereoVideoSource : public ftl::rgbd::detail::Source { class NetSource : public ftl::rgbd::detail::Source { public: - NetSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { + explicit NetSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { last_type = "net"; } @@ -76,7 +76,7 @@ class SnapshotSource : public ftl::rgbd::detail::Source { class RealsenseSource : public ftl::rgbd::detail::Source { public: - RealsenseSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { + explicit RealsenseSource(ftl::rgbd::Source *host) : ftl::rgbd::detail::Source(host) { last_type = "realsense"; } @@ -122,11 +122,11 @@ using ftl::rgbd::Source; using ftl::config::json_t; TEST_CASE("ftl::create<Source>(cfg)", "[rgbd]") { - json_t global = {{"$id","ftl://test"}}; + json_t global = json_t{{"$id","ftl://test"}}; ftl::config::configure(global); SECTION("with valid image file uri") { - json_t cfg = { + json_t cfg = json_t{ {"$id","ftl://test/1"}, {"uri","file://" FTL_SOURCE_DIRECTORY "/components/rgbd-sources/test/data/image.png"} }; @@ -139,7 +139,7 @@ TEST_CASE("ftl::create<Source>(cfg)", "[rgbd]") { } SECTION("with valid video file uri") { - json_t cfg = { + json_t cfg = json_t{ {"$id","ftl://test/2"}, {"uri","file://" FTL_SOURCE_DIRECTORY "/components/rgbd-sources/test/data/video.mp4"} }; @@ -152,7 +152,7 @@ TEST_CASE("ftl::create<Source>(cfg)", "[rgbd]") { } SECTION("with valid net uri") { - json_t cfg = { + json_t cfg = json_t{ {"$id","ftl://test/2"}, {"uri","ftl://utu.fi/dummy"} }; @@ -165,7 +165,7 @@ TEST_CASE("ftl::create<Source>(cfg)", "[rgbd]") { } SECTION("with an invalid uri") { - json_t cfg = { + json_t cfg = json_t{ {"$id","ftl://test/2"}, {"uri","not a uri"} }; @@ -177,7 +177,7 @@ TEST_CASE("ftl::create<Source>(cfg)", "[rgbd]") { } SECTION("with an invalid file uri") { - json_t cfg = { + json_t cfg = json_t{ {"$id","ftl://test/2"}, {"uri","file:///not/a/file"} }; @@ -189,7 +189,7 @@ TEST_CASE("ftl::create<Source>(cfg)", "[rgbd]") { } SECTION("with a missing file") { - json_t cfg = { + json_t cfg = json_t{ {"$id","ftl://test/2"}, {"uri","file:///data/image2.png"} }; @@ -202,11 +202,11 @@ TEST_CASE("ftl::create<Source>(cfg)", "[rgbd]") { } TEST_CASE("Source::set(uri)", "[rgbd]") { - json_t global = {{"$id","ftl://test"}}; + json_t global = json_t{{"$id","ftl://test"}}; ftl::config::configure(global); SECTION("change to different valid URI type") { - json_t cfg = { + json_t cfg = json_t{ {"$id","ftl://test/1"}, {"uri","file://" FTL_SOURCE_DIRECTORY "/components/rgbd-sources/test/data/image.png"} };