diff options
Diffstat (limited to 'src/camera/veyeimx287m.h')
| -rw-r--r-- | src/camera/veyeimx287m.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/camera/veyeimx287m.h b/src/camera/veyeimx287m.h index d65b00d..3f591f7 100644 --- a/src/camera/veyeimx287m.h +++ b/src/camera/veyeimx287m.h @@ -44,8 +44,9 @@ public: [[nodiscard]] bool dequeueImageBuffer(size_t &image); // bool getImage(Image &image); - [[nodiscard]] bool getImage(Image *image) override; - [[nodiscard]] std::shared_ptr<Image> getImage() override; + // [[nodiscard]] bool getImage(Image *image) override; + [[nodiscard]] Image *getImage() override; + // [[nodiscard]] std::shared_ptr<Image> getImage() override; bool init(); @@ -66,7 +67,7 @@ public: public: /*! * \brief processedCounter - count of images processed in current second. - * Used for performance measurement and bottlenecks analysing + * Used for performance measurement and bottlenecks analysis */ uint32_t processedCounter{0}; @@ -76,6 +77,11 @@ private: [[nodiscard]] bool initI2C(); + /*! + * \brief getFramesLoop - get frames from camera and manage futher processing + * \note to be started in a soparate thread + * \param stopToken - asks to break the loop + */ void getFramesLoop(std::stop_token stopToken); private: @@ -96,21 +102,19 @@ private: */ std::array<std::mutex, BUFFER_COUNT> m_imageMutexes; - // TODO: split this - // there should be no chance of changing image by ioctl during futher processing struct buffer { void *mem{nullptr}; - std::shared_ptr<Image> image{std::make_shared<Image>()}; }; std::vector<buffer> m_rawBuffers; - // std::array<Image, BUFFER_COUNT> m_images; + std::array<Image, BUFFER_COUNT> m_images; + // std::optional<std::remove_const<decltype(BUFFER_COUNT)>> m_lastImageIdx; + std::optional<uint8_t> m_lastImageIdx; std::mutex m_camMtx; std::jthread m_streamThread; std::jthread m_getThreads[1]; - std::mutex m_lastImageMtx; std::shared_ptr<Image> m_lastProcessedImage{}; std::shared_ptr<veye::imx287m::i2c> m_i2c; |
