summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/cam_helper_imx477.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_imx477.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_imx477.cpp')
-rw-r--r--src/ipa/raspberrypi/cam_helper_imx477.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp
index 73a5ca7d..a4a58c15 100644
--- a/src/ipa/raspberrypi/cam_helper_imx477.cpp
+++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp
@@ -21,7 +21,7 @@ class MdParserImx477 : public MdParserSmia
{
public:
MdParserImx477();
- 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:
@@ -107,7 +107,7 @@ MdParserImx477::MdParserImx477()
reg_offsets_[0] = reg_offsets_[1] = reg_offsets_[2] = reg_offsets_[3] = -1;
}
-MdParser::Status MdParserImx477::Parse(void *data)
+MdParser::Status MdParserImx477::Parse(libcamera::Span<const uint8_t> buffer)
{
bool try_again = false;
@@ -126,7 +126,7 @@ MdParser::Status MdParserImx477::Parse(void *data)
GAINLO_REG
};
reg_offsets_[0] = reg_offsets_[1] = reg_offsets_[2] = reg_offsets_[3] = -1;
- int ret = static_cast<int>(findRegs(static_cast<uint8_t *>(data),
+ int ret = static_cast<int>(findRegs(buffer,
regs, reg_offsets_, 4));
/*
* > 0 means "worked partially but parse again next time",
@@ -142,7 +142,7 @@ MdParser::Status MdParserImx477::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. */