mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 15:29:45 +03:00
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>
This commit is contained in:
parent
414babb60b
commit
df36fb4abb
4 changed files with 28 additions and 31 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue