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

Message ID 20230630120303.33023-4-umang.jain@ideasonboard.com
State New
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_imx708.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

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

Thank you for your work.

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>
> ---
>  src/ipa/rpi/cam_helper/cam_helper_imx708.cpp | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp
> index d0382d63..6c3b54ed 100644
> --- a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp
> +++ b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp
> @@ -40,6 +40,8 @@ constexpr std::initializer_list<uint32_t> registerList =
>         { expHiReg, expLoReg, gainHiReg, gainLoReg, lineLengthHiReg,
>           lineLengthLoReg, frameLengthHiReg, frameLengthLoReg, temperatureReg };
>
> +/* No. of lines of embedded data on IMX708. */
> +constexpr uint32_t embeddedDataLinesImx708 = 2;
>  /* PDAF data is expect to occupy the third scanline of embedded data. */
>  constexpr uint32_t pdafLineOffsetImx708 = 2;

You only need one of these const values correct?
Perhaps these should be private members in the class like the other consts.
Also you can remove the imx708 suffix.

>
> @@ -109,10 +111,13 @@ void CamHelperImx708::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(),
> +                                                    embeddedDataLinesImx708 * bytesPerLine };
> +       parseEmbeddedData(embeddedData, metadata);
>
>         /* Parse sensor-specific PDAF data. */
> -       size_t bytesPerLine = (mode_.width * mode_.bitdepth) >> 3;
>         size_t pdafDataOffset = pdafLineOffsetImx708 * bytesPerLine;
>
>         if (buffer.size() > pdafDataOffset) {
> --
> 2.39.1
>

Patch
diff mbox series

diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp
index d0382d63..6c3b54ed 100644
--- a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp
+++ b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp
@@ -40,6 +40,8 @@  constexpr std::initializer_list<uint32_t> registerList =
 	{ expHiReg, expLoReg, gainHiReg, gainLoReg, lineLengthHiReg,
 	  lineLengthLoReg, frameLengthHiReg, frameLengthLoReg, temperatureReg };
 
+/* No. of lines of embedded data on IMX708. */
+constexpr uint32_t embeddedDataLinesImx708 = 2;
 /* PDAF data is expect to occupy the third scanline of embedded data. */
 constexpr uint32_t pdafLineOffsetImx708 = 2;
 
@@ -109,10 +111,13 @@  void CamHelperImx708::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(),
+						     embeddedDataLinesImx708 * bytesPerLine };
+	parseEmbeddedData(embeddedData, metadata);
 
 	/* Parse sensor-specific PDAF data. */
-	size_t bytesPerLine = (mode_.width * mode_.bitdepth) >> 3;
 	size_t pdafDataOffset = pdafLineOffsetImx708 * bytesPerLine;
 
 	if (buffer.size() > pdafDataOffset) {