[libcamera-devel,RFC,4/5] ipa: rpi: cam_helper_imx477: Only pass embedded buffer in parseEmbeddedData()
diff mbox series

Message ID 20230630120303.33023-5-umang.jain@ideasonboard.com
State Deferred
Headers show
Series
  • ipa: rpi: CamHelper improvements
Related show

Commit Message

Umang Jain June 30, 2023, 12:03 p.m. UTC
Only the embedded data section should be passed while parsing the
embedded data through parseEmbeddedData().

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 src/ipa/rpi/cam_helper/cam_helper_imx477.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Naushir Patuck June 30, 2023, 1 p.m. UTC | #1
Hi Umang,

On Fri, 30 Jun 2023 at 13:03, Umang Jain <umang.jain@ideasonboard.com> wrote:
>
> Only the embedded data section should be passed while parsing the
> embedded data through parseEmbeddedData().
>
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>

I'm not sure if this patch is needed.  IMX477 only passes out embedded data, so
subdividing the buffer in the span will not do anything.

Regards,
Naush

> ---
>  src/ipa/rpi/cam_helper/cam_helper_imx477.cpp | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx477.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx477.cpp
> index bc769ca7..3753fd0b 100644
> --- a/src/ipa/rpi/cam_helper/cam_helper_imx477.cpp
> +++ b/src/ipa/rpi/cam_helper/cam_helper_imx477.cpp
> @@ -42,6 +42,9 @@ constexpr std::initializer_list<uint32_t> registerList =
>         { expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg,
>           lineLengthHiReg, lineLengthLoReg, temperatureReg };
>
> +/* No. of lines of embedded data on IMX477. */
> +constexpr uint32_t embeddedDataLinesImx477 = 2;
> +
>  class CamHelperImx477 : public CamHelper
>  {
>  public:
> @@ -95,7 +98,11 @@ void CamHelperImx477::prepare(libcamera::Span<const uint8_t> buffer, Metadata &m
>                 return;
>         }
>
> -       parseEmbeddedData(buffer, metadata);
> +       size_t bytesPerLine = (mode_.width * mode_.bitdepth) >> 3;
> +       libcamera::Span<const uint8_t> embeddedData{ buffer.data(),
> +                                                    embeddedDataLinesImx477 * bytesPerLine };
> +
> +       parseEmbeddedData(embeddedData, metadata);
>
>         /*
>          * The DeviceStatus struct is first populated with values obtained from
> --
> 2.39.1
>

Patch
diff mbox series

diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx477.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx477.cpp
index bc769ca7..3753fd0b 100644
--- a/src/ipa/rpi/cam_helper/cam_helper_imx477.cpp
+++ b/src/ipa/rpi/cam_helper/cam_helper_imx477.cpp
@@ -42,6 +42,9 @@  constexpr std::initializer_list<uint32_t> registerList =
 	{ expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg,
 	  lineLengthHiReg, lineLengthLoReg, temperatureReg };
 
+/* No. of lines of embedded data on IMX477. */
+constexpr uint32_t embeddedDataLinesImx477 = 2;
+
 class CamHelperImx477 : public CamHelper
 {
 public:
@@ -95,7 +98,11 @@  void CamHelperImx477::prepare(libcamera::Span<const uint8_t> buffer, Metadata &m
 		return;
 	}
 
-	parseEmbeddedData(buffer, metadata);
+	size_t bytesPerLine = (mode_.width * mode_.bitdepth) >> 3;
+	libcamera::Span<const uint8_t> embeddedData{ buffer.data(),
+						     embeddedDataLinesImx477 * bytesPerLine };
+
+	parseEmbeddedData(embeddedData, metadata);
 
 	/*
 	 * The DeviceStatus struct is first populated with values obtained from