@@ -2,5 +2,6 @@
libcamera_sources += files([
'rkisp1.cpp',
+ 'rkisp1_dewarper.cpp',
'rkisp1_path.cpp',
])
new file mode 100644
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2024, Ideas On Board Oy
+ *
+ * i.MX8MP Dewarp Engine integration
+ */
+
+#include "rkisp1_dewarper.h"
+
+#include <libcamera/base/log.h>
+
+#include <libcamera/geometry.h>
+
+#include "libcamera/internal/media_device.h"
+#include "libcamera/internal/v4l2_videodevice.h"
+
+namespace libcamera {
+
+LOG_DECLARE_CATEGORY(RkISP1)
+
+RkISP1Dewarper::RkISP1Dewarper(std::shared_ptr<MediaDevice> media)
+ : V4L2M2MConverter(media.get())
+{
+}
+
+int RkISP1Dewarper::setScalerCrop(unsigned int output, Rectangle rect)
+{
+ int ret;
+
+ ret = setSelection(output, V4L2_SEL_TGT_CROP, &rect);
+ if (ret < 0)
+ LOG(RkISP1, Error) << "Failed to set scaler crop on dewarper "
+ << strerror(-ret);
+
+ return ret;
+}
+
+} /* namespace libcamera */
new file mode 100644
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2024, Ideas On Board Oy
+ *
+ *i.MX8MP Dewarp Engine integration
+ */
+
+#pragma once
+
+#include "libcamera/internal/converter/converter_v4l2_m2m.h"
+
+namespace libcamera {
+
+class Rectangle;
+struct MediaDevice;
+
+class RkISP1Dewarper : public V4L2M2MConverter
+{
+public:
+ RkISP1Dewarper(std::shared_ptr<MediaDevice> media);
+
+ int setScalerCrop(unsigned int output, Rectangle rect);
+};
+
+} /* namespace libcamera */
DW100 Dewarp engine is present on I.MX8MP SoC. This patch provides a base RkISP1Dewarper class (inherited from V4L2M2MConverter) which then can be used to load a dewarp config file and scaling capabilites. \todo: Add plumbing to load a vertex map on top Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> --- src/libcamera/pipeline/rkisp1/meson.build | 1 + .../pipeline/rkisp1/rkisp1_dewarper.cpp | 38 +++++++++++++++++++ .../pipeline/rkisp1/rkisp1_dewarper.h | 25 ++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 src/libcamera/pipeline/rkisp1/rkisp1_dewarper.cpp create mode 100644 src/libcamera/pipeline/rkisp1/rkisp1_dewarper.h