summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/ipu3/cio2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcamera/pipeline/ipu3/cio2.cpp')
-rw-r--r--src/libcamera/pipeline/ipu3/cio2.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp
index ceaf665e..9cedcb5b 100644
--- a/src/libcamera/pipeline/ipu3/cio2.cpp
+++ b/src/libcamera/pipeline/ipu3/cio2.cpp
@@ -295,6 +295,14 @@ V4L2SubdeviceFormat CIO2Device::getSensorFormat(const std::vector<unsigned int>
continue;
float ratio = static_cast<float>(sz.width) / sz.height;
+ /*
+ * Ratios can differ by small mantissa difference which
+ * can affect the selection of the sensor output size
+ * wildly. We are interested in selection of the closest
+ * size with respect to the desired output size, hence
+ * comparing it with a single precision digit is enough.
+ */
+ ratio = static_cast<unsigned int>(ratio * 10) / 10.0;
float ratioDiff = fabsf(ratio - desiredRatio);
unsigned int area = sz.width * sz.height;
unsigned int areaDiff = area - desiredArea;
kwc">private: int capture(libcamera::FrameBufferAllocator *allocator); int queueRequest(libcamera::Request *request); void requestComplete(libcamera::Request *request); void processRequest(libcamera::Request *request); std::shared_ptr<libcamera::Camera> camera_; libcamera::CameraConfiguration *config_; std::map<const libcamera::Stream *, std::string> streamName_; BufferWriter *writer_; uint64_t last_; EventLoop *loop_; unsigned int queueCount_; unsigned int captureCount_; unsigned int captureLimit_; std::vector<std::unique_ptr<libcamera::Request>> requests_; }; #endif /* __CAM_CAPTURE_H__ */