summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/cam_helper_imx219.cpp
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2021-05-07 12:37:27 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-05-08 02:49:03 +0300
commitdf36fb4abb37c216d1eaf60a1772047b5205d0b7 (patch)
treeb8d4e7088c48eb6a3cc0f2c8b4e2da6cc4bd40ff /src/ipa/raspberrypi/cam_helper_imx219.cpp
parent414babb60b5453bf2a2d206088c0b4a1b48da15e (diff)
ipa: raspberrypi: Make sensor embedded data parser use Span class
Improve MdParser::Parse() by taking a Span, pointing to const data that it should not change, as its input buffer. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa/raspberrypi/cam_helper_imx219.cpp')
-rw-r--r--src/ipa/raspberrypi/cam_helper_imx219.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ipa/raspberrypi/cam_helper_imx219.cpp b/src/ipa/raspberrypi/cam_helper_imx219.cpp
index 566ecbca..e550fba6 100644
--- a/src/ipa/raspberrypi/cam_helper_imx219.cpp
+++ b/src/ipa/raspberrypi/cam_helper_imx219.cpp
@@ -29,7 +29,7 @@ class MdParserImx219 : public MdParserSmia
{
public:
MdParserImx219();
- Status Parse(void *data) override;
+ Status Parse(libcamera::Span<const uint8_t> buffer) override;
Status GetExposureLines(unsigned int &lines) override;
Status GetGainCode(unsigned int &gain_code) override;
private:
@@ -118,7 +118,7 @@ MdParserImx219::MdParserImx219()
reg_offsets_[0] = reg_offsets_[1] = reg_offsets_[2] = -1;
}
-MdParser::Status MdParserImx219::Parse(void *data)
+MdParser::Status MdParserImx219::Parse(libcamera::Span<const uint8_t> buffer)
{
bool try_again = false;
@@ -132,7 +132,7 @@ MdParser::Status MdParserImx219::Parse(void *data)
/* Need to be ordered */
uint32_t regs[3] = { GAIN_REG, EXPHI_REG, EXPLO_REG };
reg_offsets_[0] = reg_offsets_[1] = reg_offsets_[2] = -1;
- int ret = static_cast<int>(findRegs(static_cast<uint8_t *>(data),
+ int ret = static_cast<int>(findRegs(buffer,
regs, reg_offsets_, 3));
/*
* > 0 means "worked partially but parse again next time",
@@ -148,7 +148,7 @@ MdParser::Status MdParserImx219::Parse(void *data)
if (reg_offsets_[i] == -1)
continue;
- reg_values_[i] = static_cast<uint8_t *>(data)[reg_offsets_[i]];
+ reg_values_[i] = buffer[reg_offsets_[i]];
}
/* Re-parse next time if we were unhappy in some way. */