summaryrefslogtreecommitdiff
path: root/src/camera/veyeimx287m.h
diff options
context:
space:
mode:
authorNikita Kostovsky <nikita@kostovsky.me>2025-11-30 01:19:33 +0100
committerNikita Kostovsky <nikita@kostovsky.me>2025-11-30 01:19:33 +0100
commitcf87257fc3b7132eccf305f3eca9ee56c151d913 (patch)
tree29ed0aed55050b27a2e589322a488ea29041ba30 /src/camera/veyeimx287m.h
parent81fd05d07b51e9cbb25de2d8bdbd4a51ead36994 (diff)
don't waste memory
Diffstat (limited to 'src/camera/veyeimx287m.h')
-rw-r--r--src/camera/veyeimx287m.h20
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;