mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-17 01:15:06 +03:00
ipa: raspberrypi: Add line length calculations helper functions
Add CamHelper::hblankToLineLength() to calculate the line length duration from the horizontal blanking (in pixels) value. Add CamHelper::lineLengthToHblank() to calculate the horizontal blanking (in pixels) value from the line length duration. Add CamHelper::lineLengthPckToDuration() to calculate the line length duration from the line length in pixels. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Tested-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
5661c934ec
commit
51ac3e2671
2 changed files with 19 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
|||
using namespace RPiController;
|
||||
using namespace libcamera;
|
||||
using libcamera::utils::Duration;
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
namespace libcamera {
|
||||
LOG_DECLARE_CATEGORY(IPARPI)
|
||||
|
@ -96,6 +97,21 @@ uint32_t CamHelper::getVBlanking(Duration &exposure,
|
|||
return vblank;
|
||||
}
|
||||
|
||||
Duration CamHelper::hblankToLineLength(uint32_t hblank) const
|
||||
{
|
||||
return (mode_.width + hblank) * (1.0s / mode_.pixelRate);
|
||||
}
|
||||
|
||||
uint32_t CamHelper::lineLengthToHblank(const Duration &lineLength) const
|
||||
{
|
||||
return (lineLength * mode_.pixelRate / 1.0s) - mode_.width;
|
||||
}
|
||||
|
||||
Duration CamHelper::lineLengthPckToDuration(uint32_t lineLengthPck) const
|
||||
{
|
||||
return lineLengthPck * (1.0s / mode_.pixelRate);
|
||||
}
|
||||
|
||||
void CamHelper::setCameraMode(const CameraMode &mode)
|
||||
{
|
||||
mode_ = mode;
|
||||
|
|
|
@ -85,6 +85,9 @@ public:
|
|||
virtual uint32_t getVBlanking(libcamera::utils::Duration &exposure,
|
||||
libcamera::utils::Duration minFrameDuration,
|
||||
libcamera::utils::Duration maxFrameDuration) const;
|
||||
libcamera::utils::Duration hblankToLineLength(uint32_t hblank) const;
|
||||
uint32_t lineLengthToHblank(const libcamera::utils::Duration &duration) const;
|
||||
libcamera::utils::Duration lineLengthPckToDuration(uint32_t lineLengthPck) const;
|
||||
virtual uint32_t gainCode(double gain) const = 0;
|
||||
virtual double gain(uint32_t gainCode) const = 0;
|
||||
virtual void getDelays(int &exposureDelay, int &gainDelay,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue