[libcamera-devel,2/3] android: camera_device: Map HAL RAW to libcamera RAW formats

Message ID 20200728185548.3361465-3-niklas.soderlund@ragnatech.se
State Superseded
Headers show
Series
  • android: camera_device: Add RAW support
Related show

Commit Message

Niklas Söderlund July 28, 2020, 6:55 p.m. UTC
Add a mapping from HAL RAW formats to the direct equivalent of libcamera
formats. With this change it is possible to capture RAW images as long
as the hardware can deliver frames in a format that is native to the
HAL.

More work is needed to deal with unpacked 8, 10 and 12 RAW formats as
they don't directly map to a native HAL format. Nor do they belong in
the RAW_OPAQUE category as the content format is generic and not
uncommonly supported by hardware.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 src/android/camera_device.cpp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Patch

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 265627a98422bd67..95a563b1aafe86de 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -73,6 +73,26 @@  const std::map<int, const Camera3Format> camera3FormatsMap = {
 			{ formats::NV12, formats::NV21 },
 			"IMPLEMENTATION_DEFINED"
 		}
+	}, {
+		HAL_PIXEL_FORMAT_RAW10, {
+			{ formats::SBGGR10_CSI2P, formats::SGBRG10_CSI2P, formats::SGRBG10_CSI2P, formats::SRGGB10_CSI2P },
+			"RAW10"
+		}
+	}, {
+		HAL_PIXEL_FORMAT_RAW12, {
+			{ formats::SBGGR12_CSI2P, formats::SGBRG12_CSI2P, formats::SGRBG12_CSI2P, formats::SRGGB12_CSI2P },
+			"RAW12"
+		}
+	}, {
+		HAL_PIXEL_FORMAT_RAW16, {
+			{ formats::SBGGR16, formats::SGBRG16, formats::SGRBG16, formats::SRGGB16 },
+			"RAW16"
+		}
+	}, {
+		HAL_PIXEL_FORMAT_RAW_OPAQUE, {
+			{ formats::SBGGR10_IPU3, formats::SGBRG10_IPU3, formats::SGRBG10_IPU3, formats::SRGGB10_IPU3 },
+			"RAW_OPAQUE"
+		}
 	},
 };