From 21a8f92b23be6ecfc5ba953e492bdc923cf5c085 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Mon, 13 Jul 2020 21:14:03 +0300 Subject: [PATCH] More code tidy --- CMakeLists.txt | 2 +- applications/gui2/src/modules/camera.cpp | 2 ++ applications/gui2/src/views/camera.cpp | 2 ++ applications/gui2/src/views/camera3d.cpp | 2 ++ components/audio/include/ftl/audio/buffer.hpp | 5 ++--- components/codecs/src/nvidia_encoder.cpp | 16 ++++++++-------- components/common/cpp/CMakeLists.txt | 2 ++ .../src/sources/middlebury/middlebury_source.hpp | 2 +- 8 files changed, 20 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e15d1bfce..9664c5a22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -436,7 +436,7 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) add_subdirectory(components/common/cpp) -add_subdirectory(applications/calibration) +#add_subdirectory(applications/calibration) add_subdirectory(components/codecs) add_subdirectory(components/structures) add_subdirectory(components/net) diff --git a/applications/gui2/src/modules/camera.cpp b/applications/gui2/src/modules/camera.cpp index fb1cf3174..cab53ca48 100644 --- a/applications/gui2/src/modules/camera.cpp +++ b/applications/gui2/src/modules/camera.cpp @@ -4,6 +4,8 @@ #include <ftl/rgbd/capabilities.hpp> #include <chrono> +#include <loguru.hpp> + using ftl::gui2::Camera; using ftl::codecs::Channel; using ftl::rgbd::Capability; diff --git a/applications/gui2/src/views/camera.cpp b/applications/gui2/src/views/camera.cpp index d21c72f96..767c0344b 100644 --- a/applications/gui2/src/views/camera.cpp +++ b/applications/gui2/src/views/camera.cpp @@ -10,6 +10,8 @@ #include "../widgets/popupbutton.hpp" +#include <loguru.hpp> + using ftl::gui2::Camera; using ftl::gui2::FixedWindow; using ftl::gui2::MediaPanel; diff --git a/applications/gui2/src/views/camera3d.cpp b/applications/gui2/src/views/camera3d.cpp index 25baa006b..e4432a503 100644 --- a/applications/gui2/src/views/camera3d.cpp +++ b/applications/gui2/src/views/camera3d.cpp @@ -1,6 +1,8 @@ #include "camera3d.hpp" #include "../modules/camera.hpp" +#include <loguru.hpp> + using ftl::gui2::CameraView3D; // ============================================================================= diff --git a/components/audio/include/ftl/audio/buffer.hpp b/components/audio/include/ftl/audio/buffer.hpp index 236762991..2eec5f385 100644 --- a/components/audio/include/ftl/audio/buffer.hpp +++ b/components/audio/include/ftl/audio/buffer.hpp @@ -4,8 +4,8 @@ #include <vector> #include <cmath> -#define LOGURU_REPLACE_GLOG 1 -#include <loguru.hpp> +//#define LOGURU_REPLACE_GLOG 1 +//#include <loguru.hpp> namespace ftl { namespace audio { @@ -102,7 +102,6 @@ class FixedBuffer : public ftl::audio::Buffer<T> { void reset() override { Buffer<T>::reset(); write_position_ = 0; //int(this->cur_delay_); - LOG(INFO) << "RESET AUDIO: " << write_position_; read_position_ = 0; } diff --git a/components/codecs/src/nvidia_encoder.cpp b/components/codecs/src/nvidia_encoder.cpp index 846eefeb7..91dab0454 100644 --- a/components/codecs/src/nvidia_encoder.cpp +++ b/components/codecs/src/nvidia_encoder.cpp @@ -1,5 +1,5 @@ #include <ftl/codecs/nvidia_encoder.hpp> -#include <loguru.hpp> +//#include <loguru.hpp> #include <ftl/timer.hpp> #include <ftl/codecs/codecs.hpp> #include <ftl/cuda_util.hpp> @@ -144,7 +144,7 @@ static bool validate(const cv::cuda::GpuMat &in, ftl::codecs::Packet &pkt) { } if (pkt.codec == codec_t::H264 && in.type() == CV_32F) { - LOG(ERROR) << "Lossy compression not supported with H264 currently"; + //LOG(ERROR) << "Lossy compression not supported with H264 currently"; return false; } @@ -153,12 +153,12 @@ static bool validate(const cv::cuda::GpuMat &in, ftl::codecs::Packet &pkt) { } if (in.empty()) { - LOG(WARNING) << "No data"; + //LOG(WARNING) << "No data"; return false; } if (in.type() != CV_32F && in.type() != CV_8UC4) { - LOG(ERROR) << "Input type does not match given format"; + //LOG(ERROR) << "Input type does not match given format"; pkt.flags = 0; return false; } @@ -199,7 +199,7 @@ bool NvidiaEncoder::encode(const cv::cuda::GpuMat &in, ftl::codecs::Packet &pkt) was_reset_ = false; if (cs == 0 || cs >= ftl::codecs::kVideoBufferSize) { - LOG(ERROR) << "Could not encode video frame"; + //LOG(ERROR) << "Could not encode video frame"; return false; } else { return true; @@ -211,7 +211,7 @@ bool NvidiaEncoder::_createEncoder(const cv::cuda::GpuMat &in, const ftl::codecs if (nvenc_ && (params == params_)) return true; uint64_t bitrate = calculateBitrate(in.cols*in.rows, float(pkt.bitrate)/255.0f) * pkt.frame_count; - LOG(INFO) << "Calculated bitrate " << ((params.is_float) ? "(float)" : "(rgb)") << ": " << bitrate; + //LOG(INFO) << "Calculated bitrate " << ((params.is_float) ? "(float)" : "(rgb)") << ": " << bitrate; params_ = params; @@ -226,7 +226,7 @@ bool NvidiaEncoder::_createEncoder(const cv::cuda::GpuMat &in, const ftl::codecs cuCtxGetCurrent(&cudaContext); if (nvenc_) { - LOG(INFO) << "Destroying old NVENC encoder"; + //LOG(INFO) << "Destroying old NVENC encoder"; std::vector<std::vector<uint8_t>> tmp; nvenc_->EndEncode(tmp); nvenc_->DestroyEncoder(); @@ -299,7 +299,7 @@ bool NvidiaEncoder::_createEncoder(const cv::cuda::GpuMat &in, const ftl::codecs //LOG(ERROR) << "Could not create video encoder"; return false; } else { - LOG(INFO) << "NVENC encoder created"; + //LOG(INFO) << "NVENC encoder created"; //nvenc_->SetIOCudaStreams(cv::cuda::StreamAccessor::getStream(stream_), cv::cuda::StreamAccessor::getStream(stream_)); diff --git a/components/common/cpp/CMakeLists.txt b/components/common/cpp/CMakeLists.txt index fe1d7671b..9b06a7831 100644 --- a/components/common/cpp/CMakeLists.txt +++ b/components/common/cpp/CMakeLists.txt @@ -19,7 +19,9 @@ check_function_exists(uriParseSingleUriA HAVE_URIPARSESINGLE) add_library(ftlcommon ${COMMONSRC}) +if (NOT WIN32) target_compile_options(ftlcommon PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-fPIC>) +endif() target_include_directories(ftlcommon PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> diff --git a/components/rgbd-sources/src/sources/middlebury/middlebury_source.hpp b/components/rgbd-sources/src/sources/middlebury/middlebury_source.hpp index d102dbeba..051df8d2c 100644 --- a/components/rgbd-sources/src/sources/middlebury/middlebury_source.hpp +++ b/components/rgbd-sources/src/sources/middlebury/middlebury_source.hpp @@ -2,7 +2,7 @@ #ifndef _FTL_RGBD_MIDDLEBURY_SOURCE_HPP_ #define _FTL_RGBD_MIDDLEBURY_SOURCE_HPP_ -#include <loguru.hpp> +//#include <loguru.hpp> #include "../../basesource.hpp" #include <ftl/cuda_common.hpp> -- GitLab