Skip to content
Snippets Groups Projects
Commit 02bd7bad authored by Nicolas Pope's avatar Nicolas Pope
Browse files

More cppcheck error removals

parent b2fe31fd
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -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
......
......@@ -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();
......
......@@ -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);
......
......@@ -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_;
......
......@@ -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) );
}
......
......@@ -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"}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment