From patchwork Wed Aug 11 06:12:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siyuan Fan X-Patchwork-Id: 13295 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id EA3ACC3241 for ; Wed, 11 Aug 2021 06:13:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 16B6B68888; Wed, 11 Aug 2021 08:13:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=foxmail.com header.i=@foxmail.com header.b="e+7iYt7R"; dkim-atps=neutral Received: from out203-205-221-173.mail.qq.com (out203-205-221-173.mail.qq.com [203.205.221.173]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D68D660261 for ; Wed, 11 Aug 2021 08:13:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1628662405; bh=bKjfddsYLO/vZgypLTtEZ9UOa5oMmmI3W8CdpeQXtD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=e+7iYt7R2nTM7PybMi1Rwm//paCSPdeeJLb/C1Xr6XKVj4rRt7EWka9bOmuBWQGL8 eapo4zRXvyYFNOXlQouUbsswrDDJ9JbavfoGzdOsc9f/IWOk+q/zMDLtL84LAiFjLI S8Oi/+o7lGxCue0JVofOolrRaB69L2aZQzCMbAxg= Received: from localhost.localdomain ([123.126.82.8]) by newxmesmtplogicsvrszc9.qq.com (NewEsmtp) with SMTP id 3569928F; Wed, 11 Aug 2021 14:13:22 +0800 X-QQ-mid: xmsmtpt1628662404tiw8dybl6 Message-ID: X-QQ-XMAILINFO: OYpbVsTx4C81v8OvB++dVdoZgfaYp5yEeKh9IJvO7g3AYn7XuArdghl0aFh7uo CQb78NSt7Ofkji0GDVUvgXugAGw5m0ip477dAWz0ZS7WgSZ7OQcgyKtbcCNiy6k1YNqZ5QXD0LfQ utPdAggbiqnqFpo2yozuMx+Z9dDdPSZBB0HNC+PbDQ7oqrT7LR+y1hp7mxqCO8Dqt9y7rXJ5ST/2 1N7UUguqDX+gwTXvWj0aPQuHuZbab3Dl2u7SMFUThKZLqY56X108LTyJ/yxBBUISiMy29RFpqEzV lZ9TmW4sQev+sBxelE6QMy6kupHUrvBANzflnPs1Cbg084CAesBGnswj2lUZHcdMLk76uEm+Bai+ H7LMKqaPI9tTAKJ20j0AiVXZTgq1Qet0p7XLz3okQ4s+WPIsLp0/swBKsQ4PMH4LCGNLkLttrMPj aVyIHJaXk7/QF0zYbVBQGZUQF4BIQS1RnApI1BK2Z9gOETkwdjh4RGDc0jiiqFk8ajL1tUGAy8Ht ZYTArmrMu6FLZ4TwA2zDX8wbcYja0dKOHJ1TGefkz1+VBMFAL655HX1XaRMSU9t/G7m0heb4Y0T3 oS6KSADp1ZE1O6EJea6YeqNPpGAhx0ZmQ9+0tr82m+19hW1F5AzH5Yx1WqS6ghjDitOVa04if+Pd Do4Xd1TQXyKxdBuFqeU/O6Cutl4BTOlAHghwbNsbjNt43CCBdkbplurR0scet6s2Rf74TeYs40qE tvvS+76FIV+I0bpLL0HK4wSI+kueQ6AQsobvgpV1zJqrRlMRU9WeN/R/74jsW+kydXKPNZlWEdSQ Y6yS+dHjXQSIbJ7I4uEE16bz626CAjzXit7xyw2V09mC6HrKMaedpGBKPIpsvRwdYOws79HdkKUo Vs7LTq6Nsyqp9ZZ0beWSmZiS9w9HNdwcOdVIR/Wc6bNpa6Cfon1UlXNrejEi3gyecZJIdmhAzliV huWhAlKPB46f7tsWK2jVfNREpa8zREm7ex3vQDenU= From: Siyuan Fan To: libcamera-devel@lists.libcamera.org Date: Wed, 11 Aug 2021 07:12:55 +0100 X-OQ-MSGID: <20210811061258.7421-2-siyuan.fan@foxmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210811061258.7421-1-siyuan.fan@foxmail.com> References: <20210811061258.7421-1-siyuan.fan@foxmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v2 1/4] pipeline: isp: The software ISP-based pipeline handler X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Fan Siyuan Changes in V2: -fix the raw and rgb data flow based queue model in pipeline handler -move buffer alloc and thread to ISP class -Fill metadata information in dstBuffer Signed-off-by: Fan Siyuan --- src/libcamera/pipeline/isp/isp.cpp | 306 +++++++++++++++++++++++++++++ 1 file changed, 306 insertions(+) create mode 100644 src/libcamera/pipeline/isp/isp.cpp diff --git a/src/libcamera/pipeline/isp/isp.cpp b/src/libcamera/pipeline/isp/isp.cpp new file mode 100644 index 00000000..c6b7808c --- /dev/null +++ b/src/libcamera/pipeline/isp/isp.cpp @@ -0,0 +1,306 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021, Siyuan Fan + * + * isp.cpp - The software ISP-based pipeline handler + */ + +#include "../../swisp/isp.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "libcamera/internal/device_enumerator.h" +#include "libcamera/internal/media_device.h" +#include "libcamera/internal/pipeline_handler.h" +#include "libcamera/internal/v4l2_videodevice.h" + +namespace libcamera { + +LOG_DEFINE_CATEGORY(ISP) + +class ISPCameraData : public CameraData +{ +public: + ISPCameraData(PipelineHandler *pipe, MediaDevice *media) + : CameraData(pipe), media_(media), video_(nullptr) + { + } + + ~ISPCameraData() + { + delete video_; + } + + int init(); + void bufferReady(FrameBuffer *buffer); + void ISPCompleted(FrameBuffer *buffer); + + Stream stream_; + CPU_ISP isp_; + int width_; + int height_; + + std::vector> rawBuffers_; + std::vector rawQueueBuffers_; + std::vector rgbQueueBuffers_; + + MediaDevice *media_; + V4L2VideoDevice *video_; +}; + + +class ISPCameraConfiguration : public CameraConfiguration +{ +public: + ISPCameraConfiguration(); + + Status validate() override; +}; + +class PipelineHandlerISP : public PipelineHandler +{ +public: + PipelineHandlerISP(CameraManager *manager); + + CameraConfiguration *generateConfiguration(Camera *camera, + const StreamRoles &roles) override; + int configure(Camera *camera, CameraConfiguration *config) override; + + int exportFrameBuffers(Camera *camera, Stream *stream, + std::vector> *buffers) override; + + int start(Camera *camera, const ControlList *controls) override; + void stop(Camera *camera) override; + + int queueRequestDevice(Camera *camera, Request *request) override; + + bool match(DeviceEnumerator *enumerator) override; + +private: + ISPCameraData *cameraData(const Camera *camera) + { + return static_cast( + PipelineHandler::cameraData(camera)); + } +}; + +ISPCameraConfiguration::ISPCameraConfiguration() + : CameraConfiguration() +{ +} + +CameraConfiguration::Status ISPCameraConfiguration::validate() +{ + Status status = Valid; + + return status; +} + +PipelineHandlerISP::PipelineHandlerISP(CameraManager *manager) + : PipelineHandler(manager) +{ +} + +CameraConfiguration *PipelineHandlerISP::generateConfiguration(Camera *camera, + const StreamRoles &roles) +{ + ISPCameraData *data = cameraData(camera); + CameraConfiguration *config = new ISPCameraConfiguration(); + + if (roles.empty()) + return config; + + std::map> v4l2Formats = + data->video_->formats(); + std::map> deviceFormats; + std::transform(v4l2Formats.begin(), v4l2Formats.end(), + std::inserter(deviceFormats, deviceFormats.begin()), + [&](const decltype(v4l2Formats)::value_type &format) { + return decltype(deviceFormats)::value_type{ + format.first.toPixelFormat(), + format.second + }; + }); + + StreamFormats formats(deviceFormats); + StreamConfiguration cfg(formats); + + cfg.pixelFormat = formats::RGB888; + cfg.size = { 640, 480 }; + cfg.bufferCount = 4; + + config->addConfiguration(cfg); + + config->validate(); + + return config; +} + +int PipelineHandlerISP::configure(Camera *camera, CameraConfiguration *config) +{ + ISPCameraData *data = cameraData(camera); + StreamConfiguration &cfg = config->at(0); + + V4L2VideoDevice::Formats fmts = data->video_->formats(); + V4L2PixelFormat v4l2Format = fmts.begin()->first; + + V4L2DeviceFormat format = {}; + format.fourcc = v4l2Format; + format.size = cfg.size; + + data->width_ = format.size.width; + data->height_ = format.size.height; + + int ret = data->video_->setFormat(&format); + if (ret) + return ret; + + cfg.setStream(&data->stream_); + cfg.stride = format.planes[0].bpl; + + return 0; +} + +int PipelineHandlerISP::exportFrameBuffers(Camera *camera, Stream *stream, + std::vector> *buffers) +{ + unsigned int count = stream->configuration().bufferCount; + ISPCameraData *data = cameraData(camera); + + count = data->isp_.exportBuffers(buffers, count, data->width_, data->height_); + + return count; + +} + +int PipelineHandlerISP::start(Camera *camera, [[maybe_unused]] const ControlList *controls) +{ + ISPCameraData *data = cameraData(camera); + unsigned int count = data->stream_.configuration().bufferCount; + + int ret = data->video_->allocateBuffers(count, &data->rawBuffers_); + if (ret < 0) { + LOG(ISP, Error) << strerror(-ret); + return ret; + } + + for (unsigned int i = 0; i < count; i++) { + data->rawQueueBuffers_.push_back(data->rawBuffers_[i].get()); + } + + + ret = data->video_->streamOn(); + if (ret < 0) { + data->video_->releaseBuffers(); + return ret; + } + + data->isp_.startThreadISP(); + + return 0; +} + +void PipelineHandlerISP::stop(Camera *camera) +{ + ISPCameraData *data = cameraData(camera); + + if (!(data->rawBuffers_.empty())) { + data->rawBuffers_.clear(); + } + + data->isp_.stopThreadISP(); + + data->video_->streamOff(); + data->video_->releaseBuffers(); +} + +int PipelineHandlerISP::queueRequestDevice(Camera *camera, Request *request) +{ + ISPCameraData *data = cameraData(camera); + FrameBuffer *rgbBuffer = request->findBuffer(&data->stream_); + data->rgbQueueBuffers_.push_back(rgbBuffer); + + if (!rgbBuffer) { + LOG(ISP, Error) << "Attempt to queue request with invalid stream"; + return -ENOENT; + } + + int ret = data->video_->queueBuffer(data->rawQueueBuffers_[0]); + if (ret < 0) + return ret; + FrameBuffer *temp = data->rawQueueBuffers_[0]; + data->rawQueueBuffers_.erase(data->rawQueueBuffers_.begin()); + data->rawQueueBuffers_.push_back(std::move(temp)); + + return 0; +} + +bool PipelineHandlerISP::match(DeviceEnumerator *enumerator) +{ + DeviceMatch unicam("unicam"); + + unicam.add("unicam-embedded"); + unicam.add("unicam-image"); + + MediaDevice *unicam_ = acquireMediaDevice(enumerator, unicam); + if (!unicam_) { + LOG(ISP, Debug) << "unicam Device not found"; + return false; + } + + LOG(ISP, Debug) << "unicam Device Identified"; + + std::unique_ptr data = std::make_unique(this, unicam_); + + if(data->init()) return false; + + std::set streams{&data->stream_}; + std::shared_ptr camera = Camera::create(this, data->video_->deviceName(), streams); + registerCamera(std::move(camera), std::move(data)); + + return true; +} + + +void ISPCameraData::ISPCompleted(FrameBuffer *buffer) +{ + Request *request = buffer->request(); + + pipe_->completeBuffer(request, buffer); + pipe_->completeRequest(request); + +} + +void ISPCameraData::bufferReady(FrameBuffer *buffer) +{ + LOG(ISP, Debug) << rgbQueueBuffers_[0]->planes()[0].fd.fd(); + isp_.invokeMethod(&CPU_ISP::processing, ConnectionTypeQueued, buffer, rgbQueueBuffers_[0], width_, height_); + rgbQueueBuffers_.erase(rgbQueueBuffers_.begin()); + rgbQueueBuffers_.shrink_to_fit(); + +} + +int ISPCameraData::init() +{ + video_ = new V4L2VideoDevice(media_->getEntityByName("unicam-image")); + if (video_->open()) + return -ENODEV; + + video_->bufferReady.connect(this, &ISPCameraData::bufferReady); + isp_.ispCompleted.connect(this, &ISPCameraData::ISPCompleted); + + return 0; +} + +REGISTER_PIPELINE_HANDLER(PipelineHandlerISP) + +} /* namespace libcamera */ From patchwork Wed Aug 11 06:12:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siyuan Fan X-Patchwork-Id: 13296 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id CA9C3C3240 for ; Wed, 11 Aug 2021 06:13:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7F2BF68887; Wed, 11 Aug 2021 08:13:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=foxmail.com header.i=@foxmail.com header.b="lYfkTV9m"; dkim-atps=neutral Received: from out203-205-221-239.mail.qq.com (out203-205-221-239.mail.qq.com [203.205.221.239]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BA3E760261 for ; Wed, 11 Aug 2021 08:13:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1628662425; bh=UUxf8YzWkicuLPPbKmd5HQVEu9LR0W1YIB+C7AjdmxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lYfkTV9mk8hDGIuPxiABXgcxj0UCu7blevgkZhs6nlGCmDhS9N4yVZtTpPtJktR0D abWk15cDwfVKaMknsl0p2iKm7zIPGhWBCyfONIbwcQMtPPaEuzJh2grH2hxYpjFv1Q OkmqQc9qbVHHQIA+d5Zj5bs2b9b/RNQBpXObs8xQ= Received: from localhost.localdomain ([123.126.82.8]) by newxmesmtplogicsvrszc9.qq.com (NewEsmtp) with SMTP id 3569928F; Wed, 11 Aug 2021 14:13:22 +0800 X-QQ-mid: xmsmtpt1628662405tls74qumv Message-ID: X-QQ-XMAILINFO: N4ZILu3POr3OC73HyoXAn++rILiOp5rnqKOnh9dMrO6TaOj4ygobtWTpvUHWpL wdHSYea8kL2YpOxxPhL4DnrIpFpsOoaxmDNmlDj/rAJK67jjdcx08q/T+vzaguLzQuRwqXLHHx1Z UXKzLEwnzK3wtvzh7zVuB8xVJ3KT9fg0H6rHygEWiiHWjAlSvqzH3WNCw6YoDgRO9x5dOKJAKp/Y Th5ov1u/mgZtOk/rdf7uixzGDDwEFaoT61dnCFJ5PIeFPzJK/3/WUCqDMxB5PjbhPM1YY3WF+9Ne qZ8X0R+J93ajLnuZrm7PRrW2WViOxAJh2Ng5jrf3JDf2Z/GBzxohYgLJHwaMhtduQyiI4V5rw50z TecauHf0/6sAxHbu+ChLNeLUo3tp1aApwqxz4kc6VOc3tTHA95/qXGbxtjh/CuFOb4z2McQbVUVF aeG2EKFsx1PB5qYfq9L/8cnUleQdHsPHxT3JMHQG/v2WBncIjwhn//sbwP/Ip4TROJl7/PQ90Ib3 okzL7oE1FvSimZ1FYQSijXX/GhsjJDB+fQ+giEEqO8mLzIoAFnVLRtOUUPImQ/kBg6iqQ5c+El7y YJLUWuxmhoV+yyItV/buI1ZEYL5Opo2WV15V76SvNRuXAjWc4urvG3NqYY55x7nggFi68Wr1B7fW bhFvWmqZJE+eeiWqH41DoTN6x6Ja6V1QOl91FG1Pt5btopXJfBTUDeogXZStw8l4NHBEBHFNr4bl GVmEhCPzFbchOqgDSKwWewAbO/LRPW2SK94wspv68YvUDQxfoXaJPf5yYUmi1P1JNZFMGiLJgyVP nDnZ7oE8ymSN3wR5LeSL4DFEp72soM4zNHGeOojPd2G9e9ze58dq0GY0+momPda4gkOeQDUKesLH 6Q9T00pOR2U66dsxOs6GiS9zVGZbQT9RxpbvI64tiaT5rbhg+kQYsE9UElOXhXfdAV2MfcZUOYdI gE83llGVI71cRbiXcr6w== From: Siyuan Fan To: libcamera-devel@lists.libcamera.org Date: Wed, 11 Aug 2021 07:12:56 +0100 X-OQ-MSGID: <20210811061258.7421-3-siyuan.fan@foxmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210811061258.7421-1-siyuan.fan@foxmail.com> References: <20210811061258.7421-1-siyuan.fan@foxmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v2 2/4] libcamera: swisp: The software ISP class X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Fan Siyuan Changes in V2: -Design the abstract class ISP, CPU_ISP and future GPU_ISP inherit from it. -Add the rgb buf alloc and thread control member function Now the ISP must implement the below process: BLC-->demosaic-->AWB-->tone mapping-->gamma-->Noise reduction Plan to add: lens shading correct-->Color correct-->color space transform Signed-off-by: Fan Siyuan --- src/libcamera/swisp/isp.cpp | 643 ++++++++++++++++++++++++++++++++++++ src/libcamera/swisp/isp.h | 92 ++++++ 2 files changed, 735 insertions(+) create mode 100644 src/libcamera/swisp/isp.cpp create mode 100644 src/libcamera/swisp/isp.h diff --git a/src/libcamera/swisp/isp.cpp b/src/libcamera/swisp/isp.cpp new file mode 100644 index 00000000..6d073040 --- /dev/null +++ b/src/libcamera/swisp/isp.cpp @@ -0,0 +1,643 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021, Siyuan Fan + * + * isp.cpp - The software ISP class + */ + +#include "isp.h" + +#include +#include +#include +#include +#include + +#include +#include + +#include "libcamera/base/log.h" + +namespace libcamera{ + +LOG_DECLARE_CATEGORY(ISP) + +void CPU_ISP::autoContrast(uint16_t *data, float lowCut, float highCut, int width, int height) +{ + int blue, gr, gb, red; + int histBlue[1024] = {0}, histGb[1024] = {0}, histGr[1024] = {0}, histRed[1024] = {0}; + + int index; + for (int i = 0; i < height; i++) { + index = i * width; + for (int j = 0; j < width; j++) { + if (i % 2 == 0 && j % 2 == 0) { + blue = data[index]; + histBlue[blue]++; + } + else if ((i % 2 == 0 && j % 2 == 1)) { + gb = data[index]; + histGb[gb]++; + } + else if ((i % 2 == 1 && j % 2 == 0)) { + gr = data[index]; + histGr[gr]++; + } + else { + red = data[index]; + histRed[red]++; + } + index++; + } + } + + int pixelAmount = width * height; + int sum = 0; + int minBlue; + for (int i = 0; i < 1024; i++){ + sum = sum + histBlue[i]; + if (sum >= pixelAmount * lowCut * 0.01) { + minBlue = i; + break; + } + } + + sum = 0; + int maxBlue; + for (int i = 1023; i >= 0; i--){ + sum = sum + histBlue[i]; + if (sum >= pixelAmount * highCut * 0.01) { + maxBlue = i; + break; + } + } + + sum = 0; + int minGb; + for (int i = 0; i < 1024; i++){ + sum = sum + histGb[i]; + if (sum >= pixelAmount * lowCut * 0.01) { + minGb = i; + break; + } + } + + sum = 0; + int maxGb; + for (int i = 1023; i >= 0; i--){ + sum = sum + histGb[i]; + if (sum >= pixelAmount * highCut * 0.01) { + maxGb = i; + break; + } + } + + sum = 0; + int minGr; + for (int i = 0; i < 1024; i++){ + sum = sum + histGr[i]; + if (sum >= pixelAmount * lowCut * 0.01) { + minGr = i; + break; + } + } + + sum = 0; + int maxGr; + for (int i = 1023; i >= 0; i--){ + sum = sum + histGr[i]; + if (sum >= pixelAmount * highCut * 0.01) { + maxGr = i; + break; + } + } + + sum = 0; + int minRed; + for (int i = 0; i < 1024; i++){ + sum = sum + histRed[i]; + if (sum >= pixelAmount * lowCut * 0.01) { + minRed = i; + break; + } + } + + sum = 0; + int maxRed; + for (int i = 1023; i >= 0; i--){ + sum = sum + histRed[i]; + if (sum >= pixelAmount * highCut * 0.01) { + maxRed = i; + break; + } + } + + int blueMap[1024]; + float norb = 1.0 / (maxBlue - minBlue); + for (int i = 0; i < 1024; i++) { + if (i < minBlue) { + blueMap[i] = 0; + } + else if (i > maxBlue) { + blueMap[i] = 1023; + } + else { + blueMap[i] = (i - minBlue) * norb * 1023; + } + if (blueMap[i] > 1023) blueMap[i] = 1023; + } + + int gbMap[1024]; + float norgb = 1.0 / (maxGb - minGb); + for (int i = 0; i < 1024; i++) { + if (i < minGb) { + gbMap[i] = 0; + } + else if (i > maxGb) { + gbMap[i] = 1023; + } + else { + gbMap[i] = (i - minGb) * norgb * 1023; + } + if (gbMap[i] > 1023) gbMap[i] = 1023; + } + + int grMap[1024]; + float norgr = 1.0 / (maxGr - minGr); + for (int i = 0; i < 1024; i++) { + if (i < minGr) { + grMap[i] = 0; + } + else if (i > maxGr) { + grMap[i] = 1023; + } + else { + grMap[i] = (i - minGr) * norgr * 1023; + } + if (grMap[i] > 1023) grMap[i] = 1023; + } + + int redMap[1024]; + float norr = 1.0 / (maxRed - minRed); + for (int i = 0; i < 1024; i++) { + if (i < minRed) { + redMap[i] = 0; + } + else if (i > maxRed) { + redMap[i] = 1023; + } + else{ + redMap[i] = (i - minRed) * norr * 1023; + } + if (redMap[i] > 1023) redMap[i] = 1023; + } + + for (int i = 0;i < height; i++) { + for (int j = 0; j < width; j++){ + index = i * width; + if (i % 2 == 0 && j % 2 == 0) { + data[index] = blueMap[data[index]]; + } + else if (i % 2 == 0 && j % 2 == 1) { + data[index] = gbMap[data[index]]; + } + else if (i % 2 == 1 && j % 2 == 0) { + data[index] = grMap[data[index]]; + } + else { + data[index] = redMap[data[index]]; + } + index++; + } + } +} + +void CPU_ISP::blackLevelCorrect(uint16_t *data, uint16_t offset, int width, int height) +{ + int len = width * height; + for(int i = 0; i < len; i++) { + if (data[i] < offset){ + data[i] = 0; + } + else { + data[i] -= offset; + } + } +} + +void CPU_ISP::readChannels(uint16_t *data, uint16_t *R, uint16_t *G, uint16_t *B, + int width, int height) +{ + int index; + for (int i = 0; i < height; i++) { + index = i * width; + for (int j = 0; j < width; j++) { + if (i % 2 == 0 && j % 2 == 0) { + B[index] = data[index]; + } + else if ((i % 2 == 0 && j % 2 == 1) || (i % 2 == 1 && j % 2 == 0)){ + G[index] = data[index]; + } + else { + R[index] = data[index]; + } + index++; + } + } +} + +void CPU_ISP::firstPixelInsert(uint16_t *src, uint16_t *dst, int width, int height) +{ + int index; + for (int i = 0; i < height; i++) { + index = i * width; + for (int j = 0; j < width; j++){ + if (i % 2 == 0 && j % 2 == 1) { + if (j == (width - 1)) { + dst[index] = src[index - 1]; + } + else { + dst[index] = (src[index - 1] + + src[index + 1]) >> 1; + } + } + + if (i % 2 == 1 && j % 2 == 0) { + if(i == height - 1) { + dst[index] = src[index - width]; + } + else { + dst[index] = (src[index - width]+ + src[index + width]) >> 1; + } + } + + if (i % 2 == 1 && j % 2 == 1) { + if (j < width - 1 && i < height - 1) { + dst[index] = (src[index - width - 1] + + src[index - width + 1] + + src[index + width - 1] + + src[index + width + 1]) >> 2; + } + else if (i == height - 1 && j < width - 1) { + dst[index] = (src[index - width - 1] + + src[index - width + 1]) >> 1; + } + else if (i < height - 1 && j == width - 1) { + dst[index] = (src[index - width - 1] + + src[index + width - 1]) >> 1; + } + else { + dst[index] = src[index - width - 1]; + } + } + index++; + } + } +} + +void CPU_ISP::twoPixelInsert(uint16_t *src, uint16_t *dst, int width, int height) +{ + int index; + for (int i = 0; i < height; i++) { + index = i * width; + for (int j = 0; j < width; j++) { + if (i == 0 && j == 0) { + dst[index] = (src[index + width] + + src[index + 1]) >> 1; + } + else if (i == 0 && j > 0 && j % 2 == 0) { + dst[index] = (src[index - 1] + + src[index + width] + + src[index + 1]) / 3; + } + else if (i > 0 && j == 0 && i % 2 == 0) { + dst[index] = (src[index - width] + + src[index + 1] + + src[index + width]) / 3; + } + else if (i == (height - 1) && j < (width - 1) && j % 2 == 1) { + dst[index] = (src[index - 1] + + src[index - width] + + src[index + 1]) / 3; + } + else if (i < (height - 1) && j == (width - 1) && i % 2 == 1) { + dst[index] = (src[index - width] + + src[index - 1] + + src[index + width]) / 3; + } + else if (i == (height - 1) && j == (width - 1)) { + dst[index] = (src[index - width] + + src[index - 1]) >> 1; + } + else if ((i % 2 == 0 && j % 2 == 0) || (i % 2 == 1 && j % 2 == 1)) { + dst[index] = (src[index - 1] + + src[index + 1] + + src[index - width] + + src[index + width]) / 4; + } + index++; + } + } +} + +void CPU_ISP::lastPixelInsert(uint16_t *src, uint16_t *dst, int width, int height) +{ + int index; + for (int i = 0; i < height; i++) { + index = i * width; + for (int j = 0; j < width; j++){ + if (i % 2 == 1 && j % 2 == 0) { + if (j == 0) { + dst[index] = src[index + 1]; + } + else { + dst[index] = (src[index - 1] + + src[index + 1]) >> 1; + } + } + + if (i % 2 == 0 && j % 2 == 1) { + if(i == 0) { + dst[index] = src[index + width]; + } + else { + dst[index] = (src[index - width]+ + src[index + width]) >> 1; + } + } + + if (i % 2 == 0 && j % 2 == 0) { + if (i > 0 && j > 0) { + dst[index] = (src[index - width - 1] + + src[index - width + 1] + + src[index + width - 1] + + src[index + width + 1]) >> 2; + } + else if (i == 0 && j > 0) { + dst[index] = (src[index + width - 1] + + src[index + width + 1]) >> 1; + } + else if (i > 0 && j == 0) { + dst[index] = (src[index - width + 1] + + src[index + width + 1]) >> 1; + } + else { + dst[index] = src[index + width + 1]; + } + } + index++; + } + } +} + +void CPU_ISP::demosaic(uint16_t *data, uint16_t *R, uint16_t *G, uint16_t *B, + int width, int height) +{ + firstPixelInsert(data, B, width, height); + twoPixelInsert(data, G, width, height); + lastPixelInsert(data, R, width, height); +} + +void CPU_ISP::autoWhiteBalance(uint16_t *R, uint16_t *G, uint16_t *B, int width, int height) +{ + float aveB = 0, aveG = 0, aveR = 0; + float Kb, Kg, Kr; + + for (int i = 0; i < width * height; i++) { + aveB += 1.0 * B[i]; + aveG += 1.0 * G[i]; + aveR += 1.0 * R[i]; + } + + aveB *= (1.0 / (width * height)); + aveG *= (1.0 / (width * height)); + aveR *= (1.0 / (width * height)); + + Kr = (aveB + aveG + aveR) / aveR * (1.0 / 3.0); + Kg = (aveB + aveG + aveR) / aveG * (1.0 / 3.0); + Kb = (aveB + aveG + aveR) / aveB * (1.0 / 3.0); + + for (int i = 0; i < width * height; i++) { + B[i] = B[i] * Kb; + G[i] = G[i] * Kg; + R[i] = R[i] * Kr; + + if (R[i] > 1023) R[i] = 1023; + if (G[i] > 1023) G[i] = 1023; + if (R[i] > 1023) B[i] = 1023; + } +} + +void CPU_ISP::gammaCorrect(uint16_t *R, uint16_t *G, uint16_t *B, float val, int width, int height) +{ + float nor = 1.0 / 1023.0; + float gamma = 1.0 / val; + for (int i = 0; i < width * height; i++) { + R[i] = pow(R[i] * nor, gamma) * 1023; + G[i] = pow(G[i] * nor, gamma) * 1023; + B[i] = pow(B[i] * nor, gamma) * 1023; + + if (R[i] > 1023) R[i] = 1023; + if (G[i] > 1023) G[i] = 1023; + if (B[i] > 1023) B[i] = 1023; + } +} + +void CPU_ISP::compress_10bit_to_8bit (uint16_t *src, uint8_t *dst, int width, int height) +{ + for (int i = 0; i < width * height; i++) { + dst[i] = src[i] >> 2 & 0xff; + } +} + +float CPU_ISP::distance(int x, int y, int i, int j) +{ + return float(sqrt(pow(x - i, 2) + pow(y - j, 2))); +} + +double CPU_ISP::gaussian(float x, double sigma) +{ + return exp(-(pow(x, 2)) / (2 * pow(sigma, 2))) / (2 * 3.1415926 * pow(sigma, 2)); +} + +void CPU_ISP::bilateralFilter(uint16_t *R, uint16_t *G, uint16_t *B, + int diameter, double sigmaI, + double sigmaS, int width, int height) +{ + for (int i = 2; i < height - 2; i++) { + for (int j = 2; j < width - 2; j++) { + double iFiltered = 0; + double wp = 0; + int neighbor_x = 0; + int neighbor_y = 0; + int half = diameter / 2; + + for (int k = 0; k < diameter; k++) { + for (int l = 0; l < diameter; l++) { + neighbor_x = i - (half - k); + neighbor_y = j - (half - l); + double gi = gaussian(R[neighbor_x * width + neighbor_y] - R[i * width +j], sigmaI); + double gs = gaussian(distance(i, j, neighbor_x, neighbor_y), sigmaS); + double w = gi * gs; + iFiltered = iFiltered + R[neighbor_x * width + neighbor_y] * w; + wp = wp + w; + } + } + + iFiltered = iFiltered / wp; + R[i * width + j] = iFiltered; + } + } + + for (int i = 2; i < height - 2; i++) { + for (int j = 2; j < width - 2; j++) { + double iFiltered = 0; + double wp = 0; + int neighbor_x = 0; + int neighbor_y = 0; + int half = diameter / 2; + + for (int k = 0; k < diameter; k++) { + for (int l = 0; l < diameter; l++) { + neighbor_x = i - (half - k); + neighbor_y = j - (half - l); + double gi = gaussian(G[neighbor_x * width + neighbor_y] - G[i * width +j], sigmaI); + double gs = gaussian(distance(i, j, neighbor_x, neighbor_y), sigmaS); + double w = gi * gs; + iFiltered = iFiltered + G[neighbor_x * width + neighbor_y] * w; + wp = wp + w; + } + } + + iFiltered = iFiltered / wp; + G[i * width + j] = iFiltered; + } + } + + for (int i = 2; i < height - 2; i++) { + for (int j = 2; j < width - 2; j++) { + double iFiltered = 0; + double wp = 0; + int neighbor_x = 0; + int neighbor_y = 0; + int half = diameter / 2; + + for (int k = 0; k < diameter; k++) { + for (int l = 0; l < diameter; l++) { + neighbor_x = i - (half - k); + neighbor_y = j - (half - l); + double gi = gaussian(B[neighbor_x * width + neighbor_y] - B[i * width +j], sigmaI); + double gs = gaussian(distance(i, j, neighbor_x, neighbor_y), sigmaS); + double w = gi * gs; + iFiltered = iFiltered + B[neighbor_x * width + neighbor_y] * w; + wp = wp + w; + } + } + + iFiltered = iFiltered / wp; + B[i * width + j] = iFiltered; + } + } +} + +void CPU_ISP::noiseReduction(uint16_t *R, uint16_t *G, uint16_t *B, int width, int height) +{ + bilateralFilter(R, G, B, 5, 24.0, 32.0, width, height); +} + +void CPU_ISP::processing(FrameBuffer *srcBuffer, FrameBuffer *dstBuffer, int width, int height) +{ + uint8_t *rgb_buf; + uint16_t *rawData; + uint16_t *rgbData = new std::uint16_t[width * height * 3]; + + uint16_t *rData = rgbData; + uint16_t *gData = rData + width * height; + uint16_t *bData = gData + width * height; + memset(rgbData, 0x0, width * height * 3); + + const FrameBuffer::Plane &plane = srcBuffer->planes()[0]; + rawData = (uint16_t *)mmap(NULL, plane.length, PROT_READ|PROT_WRITE, MAP_SHARED, plane.fd.fd(), 0); + LOG(ISP, Debug) << plane.length << " " << plane.fd.fd(); + if (rawData == MAP_FAILED) { + LOG(ISP, Error) << "Read raw data failed"; + ispCompleted.emit(dstBuffer); + } + + blackLevelCorrect(rawData, 16, width, height); + readChannels(rawData, rData, gData, bData, width, height); + demosaic(rawData, rData, gData, bData, width, height); + autoWhiteBalance(rData, gData, bData, width, height); + autoContrast(rData, 0.01, 0.01, width, height); + autoContrast(gData, 0.01, 0.01, width, height); + autoContrast(bData, 0.01, 0.01, width, height); + gammaCorrect(rData, gData, bData, 2.2, width, height); + //bilateralFilter(rData, gData, bData, 5, 24.0, 32.0, width, height); + + const FrameBuffer::Plane &rgbPlane = dstBuffer->planes()[0]; + rgb_buf = (uint8_t *)mmap(NULL, rgbPlane.length, PROT_READ|PROT_WRITE, MAP_SHARED, rgbPlane.fd.fd(), 0); + if (rgb_buf == MAP_FAILED) { + LOG(ISP, Error) << "Read rgb data failed"; + ispCompleted.emit(dstBuffer); + } + + uint8_t *rData_8 = rgb_buf; + uint8_t *gData_8 = rData_8 + width * height; + uint8_t *bData_8 = gData_8 + width * height; + + compress_10bit_to_8bit(rData, rData_8, width, height); + compress_10bit_to_8bit(gData, gData_8, width, height); + compress_10bit_to_8bit(bData, bData_8, width, height); + + dstBuffer->metadata_.status = srcBuffer->metadata().status; + dstBuffer->metadata_.sequence = srcBuffer->metadata().sequence; + dstBuffer->metadata_.timestamp = srcBuffer->metadata().timestamp; + + dstBuffer->metadata_.planes.clear(); + dstBuffer->metadata_.planes.push_back({rgbPlane.length}); + + delete[] rgbData; + + ispCompleted.emit(dstBuffer); +} + +int CPU_ISP::exportBuffers(std::vector> *buffers, + unsigned int count, int width, int height) +{ + int bufferByte = width * height * 3; + + for (unsigned int i = 0; i < count; i++) { + std::string name = "frame-" + std::to_string(i); + + const int isp_fd = memfd_create(name.c_str(), 0); + int ret = ftruncate(isp_fd, bufferByte); + if (ret < 0) { + LOG(ISP, Error) << "Failed to resize memfd" << strerror(-ret); + return ret; + } + + FrameBuffer::Plane rgbPlane; + rgbPlane.fd = FileDescriptor(std::move(isp_fd)); + rgbPlane.length = bufferByte; + + std::vector planes{rgbPlane}; + buffers->emplace_back(std::make_unique(std::move(planes))); + } + + return count; +} + +void CPU_ISP::startThreadISP() +{ + moveToThread(&thread_); + thread_.start(); +} + +void CPU_ISP::stopThreadISP() +{ + thread_.exit(); + thread_.wait(); +} + +} /* namespace libcamera */ \ No newline at end of file diff --git a/src/libcamera/swisp/isp.h b/src/libcamera/swisp/isp.h new file mode 100644 index 00000000..4099e2c6 --- /dev/null +++ b/src/libcamera/swisp/isp.h @@ -0,0 +1,92 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021, Siyuan Fan + * + * isp.h - The software ISP class + */ +#ifndef __LIBCAMERA_SWISP_ISP_H__ +#define __LIBCAMERA_SWISP_ISP_H__ + +#include + +#include "libcamera/base/object.h" +#include "libcamera/base/signal.h" +#include "libcamera/base/thread.h" + +namespace libcamera{ + +using std::uint16_t; +using std::uint8_t; + +class ISP : public Object +{ +public: + ISP() {} + + virtual void blackLevelCorrect(uint16_t *data, uint16_t offset, int width, int height) = 0; + + virtual void demosaic(uint16_t *data, uint16_t *R, uint16_t *G, uint16_t *B, + int width, int height) = 0; + + virtual void autoWhiteBalance(uint16_t *R, uint16_t *G, uint16_t *B, int width, int height) = 0; + + virtual void gammaCorrect(uint16_t *R, uint16_t *G, uint16_t *B, float val, int width, int height) = 0; + + virtual void noiseReduction(uint16_t *R, uint16_t *G, uint16_t *B, int width, int height) = 0; + + virtual ~ISP() {} +}; + +class CPU_ISP : public ISP +{ +public: + void autoContrast(uint16_t *data, float lowCut, float highCut, int width, int height); + + void blackLevelCorrect(uint16_t *data, uint16_t offset, int width, int height) override; + + void readChannels(uint16_t *data, uint16_t *R, uint16_t *G, uint16_t *B, + int width, int height); + + void firstPixelInsert(uint16_t *src, uint16_t *dst, int width, int height); + + void twoPixelInsert(uint16_t *src, uint16_t *dst, int width, int height); + + void lastPixelInsert(uint16_t *src, uint16_t *dst, int width, int height); + + void demosaic(uint16_t *data, uint16_t *R, uint16_t *G, uint16_t *B, + int width, int height) override; + + void autoWhiteBalance(uint16_t *R, uint16_t *G, uint16_t *B, int width, int height) override; + + void gammaCorrect(uint16_t *R, uint16_t *G, uint16_t *B, float val, int width, int height) override; + + float distance(int x, int y, int i, int j); + + double gaussian(float x, double sigma); + + void bilateralFilter(uint16_t *R, uint16_t *G, uint16_t *B, + int diameter, double sigmaI, double sigmaS, + int width, int height); + + void noiseReduction(uint16_t *R, uint16_t *G, uint16_t *B, int width, int height) override; + + void compress_10bit_to_8bit(uint16_t *src, uint8_t *dst, int width, int height); + + void processing(FrameBuffer *srcBuffer, FrameBuffer *dstBuffer, int width, int height); + + int exportBuffers(std::vector> *buffers, + unsigned int count, int width, int height); + + void startThreadISP(); + + void stopThreadISP(); + + Signal ispCompleted; + +private: + Thread thread_; +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_SWISP_ISP_H__ */ \ No newline at end of file From patchwork Wed Aug 11 06:12:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siyuan Fan X-Patchwork-Id: 13297 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 7EE7DC3241 for ; Wed, 11 Aug 2021 06:13:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2ECAA6884E; Wed, 11 Aug 2021 08:13:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=foxmail.com header.i=@foxmail.com header.b="M8p9BPMq"; dkim-atps=neutral Received: from out162-62-57-252.mail.qq.com (out162-62-57-252.mail.qq.com [162.62.57.252]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9282C60261 for ; Wed, 11 Aug 2021 08:13:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1628662427; bh=EIqLODHjrEbAGuJ2JGkHGKc4vTVmI0zsqYyym2mcLZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=M8p9BPMq7lT6o6qF5qqRttnreHy0BKCWD6FXB5Ru+h/1MretUjo/gjrIqhTFI0X0N ttlcFQhuy/s9AaQeMIMlBaOuvjSmqIKxQj4EM3OnMvdxExhHNMhOS6QXCp4i177m2i tWNrAGRGeUmAzKDwdVL1P9TvikauwXC4wzoy7kdA= Received: from localhost.localdomain ([123.126.82.8]) by newxmesmtplogicsvrszc9.qq.com (NewEsmtp) with SMTP id 3569928F; Wed, 11 Aug 2021 14:13:22 +0800 X-QQ-mid: xmsmtpt1628662425tqdn9z0a2 Message-ID: X-QQ-XMAILINFO: Nqr6iIg7be4re8l0I7sKGAuPsoPVpDC/eRRJLYj8kb+r4k7XuwrKOVqGmlL1bE Vxd85up2sBGUZiG2wjedm2vAD/mojulEo+eCONbvvUjgJ+fIIZFfYS+o1aZvOzFBGsEV2+QpeEja qTwlGHfGr98OeFe4mgselQRM+NfqWd93hCLO+meDnaGo5Jib0pKTW9IOf+s1OiR7Q+ydmUc75PMU LocrI4lcT6JbCUoLgHhBxUGUTrYd1KqIZrtor+1OcMvlw51XRB1qzl851dsvSuRoGgTZvd0Y230O 2/CKW7UWrCRLvt5JM8IkSHmrdVCigV6p7RoZLq0VtHD9HQrQA3+y53QI2SiXT5nzOvrXi6Pog1+M KRgo6srdLQULpeVY1Va5iVZqHh6mb0/X1Fh1W+o5XnRAxcC7293jtuvOGzCeH0WkXGTrMJ7I3/Fe MIvvZf2uf3FwyMX3UAjwMbLaetN3csVuzeDdmoKJZwuEVAs4Ew2C92eni4TlL7GazVRZJee0VCR2 XPdDZVIcJWn+LYQ/Ca/V3dKOccjUkLp78Xi0D+b8sSbEUwHePG7UoV5KawNXCRTxNkC8Qyizo6t9 GttA0AtlgpN9K97VGzPjPOrJNoWfgAlzgYMp+9wMvd0GIChA+5ceNKfiC1Q9x7VXVyFPBtDgX85O Zs+6iIioP0P357T9otl16yjBXYeVRKZsuvTPWrN8udl1Kwxdefsyv3/93ylKKb40MbRWK+WBEa5k wJtvVxyhwbC3G1x+yWtnNJCOJGmgkRu9wI0eMZvxhFbrNwU5IgdiBfZv4Sjok6pLoeWjLvgl/8Mc xQIBO6XWcrt+SxzKUq5V0t3js21VqIqT3BVaM6WRRoNuyIWAzM3gqktEAr7UZ3GAekIpEJWv/k/e 50ltaf+Jor1CniVR0vRsKRdqLzOGG3mudPA7uKyz1TvW6jmfrQJ7TJVIXA2smt8A== From: Siyuan Fan To: libcamera-devel@lists.libcamera.org Date: Wed, 11 Aug 2021 07:12:57 +0100 X-OQ-MSGID: <20210811061258.7421-4-siyuan.fan@foxmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210811061258.7421-1-siyuan.fan@foxmail.com> References: <20210811061258.7421-1-siyuan.fan@foxmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v2 3/4] libcamera: framebuffer: Add the friend class CPU_ISP X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Fan Siyuan In order to fill in dstBuffer->metadata(), we need to add the friend class CPU_ISP. Signed-off-by: Fan Siyuan --- include/libcamera/framebuffer.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h index 28307890..9cc1b760 100644 --- a/include/libcamera/framebuffer.h +++ b/include/libcamera/framebuffer.h @@ -61,6 +61,7 @@ private: LIBCAMERA_DISABLE_COPY_AND_MOVE(FrameBuffer) friend class V4L2VideoDevice; /* Needed to update metadata_. */ + friend class CPU_ISP; std::vector planes_; From patchwork Wed Aug 11 06:12:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siyuan Fan X-Patchwork-Id: 13298 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id CBC0DC3240 for ; Wed, 11 Aug 2021 06:15:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 95F416884F; Wed, 11 Aug 2021 08:15:01 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=foxmail.com header.i=@foxmail.com header.b="fRYh9kRL"; dkim-atps=neutral Received: from out162-62-57-252.mail.qq.com (out162-62-57-252.mail.qq.com [162.62.57.252]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1E37A60261 for ; Wed, 11 Aug 2021 08:14:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1628662494; bh=MT4trZgnCNZ1I2wgKwAIkPnntKxO6K+2hhqKdaDg3Fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fRYh9kRLugABc0E3dtHXfKQdj2A8DTo+VPpUpWPMcuJGy5mfmM58HxMs7sYiwUTIX qIgpBy66tcIOIVKNJs7WvWrsPKqwSgl0Dc2BDJXhh2n+3t2fEO0sseMk8PwHymnz1Q k3WCVzDaGMir4mgud7GKz3Jk1L/OTw6nSzWWJeo8= Received: from localhost.localdomain ([123.126.82.8]) by newxmesmtplogicsvrszc9.qq.com (NewEsmtp) with SMTP id 3569928F; Wed, 11 Aug 2021 14:13:22 +0800 X-QQ-mid: xmsmtpt1628662427tbbae01vs Message-ID: X-QQ-XMAILINFO: NSHyY+L3HkGiMSypBABbI6rrWi6SOxU+b7lbHJpA7gb2/khXut9PWd/FfnAUqw 30UGrTNL0WTuDN6e4HHTBqxTF3WjvzeYe47NBA/778zvmLNA23NH1HO/pLrpuPAd+N1g2OLj62Kj JwqY90nxt+symA0mD9grSH2etuI/LNcx0+f6Fv/T3FfiFJZTdmy9jg4byU7txxMcoPQ4wFIyqdWm thlnCFtSkA41rAjNko/DizSo9H4Pj0IM2Zc7TjfP8nleS2yyN4DQO9ZIaIMJjxudYZOZFkhvtJ/2 mAqUY0Hzi3OxilxAHuJ0n6k0sqXNqLdPKoTypTLZmML/cSUuDoOJ/0JcDGDAZs4Iza/DmJGL5Fnz Rl2mlV+4KE3XSHs0D8Ntg2yV2A8QZvecr+jVSHIQEQfBt4DpTUc7IbjPUk8AIyWPmW03IcOmju6r 0SAMmYLEBisSGTsbdmKRNulwf36chk2wQFId636iByKPR3JjKxYUwenB0kpimn5A69EIzVR4FY0o O5bJPzw0R1IK0HidZC7aPpQ8OyurZMFOlO7AhO/PrK7kbabdOUoKKeD0loxj13dYW+tOTrEXYJJj sIw1zhSwUGnx3+PW1Nar+nKS5pi/EEdQ5/aFuT1zl/i/qk8UaKHr6wR8HZgplmy7XemoxyNDAG71 pTLyXbnW0R3qFMJHxNK4kUGdzUE2vfNPD6ryMT57QOWnKG0jjte+Oe0CvgUjT9gDAjH/NtGvmipT OcvESncOee9nUMuq9yRDQJ4L/gJGZN657ovCFmpDY9kTibsmf5CG79Wrt3dYTeRZgd+9fphfL5Yq jA1iIecsag5jd9aqDgmpJ8QJvgBq/ZuQ4IsSR11HQPWjYr3toNQ+VmU6AhAjWF11jdV/vcZMv0T5 otMUyGksuBta40NgeYwJrV0+WlNX+LC9vA7y87ymmK0Y9ZDrcbvBxzdNSEi6mhNA== From: Siyuan Fan To: libcamera-devel@lists.libcamera.org Date: Wed, 11 Aug 2021 07:12:58 +0100 X-OQ-MSGID: <20210811061258.7421-5-siyuan.fan@foxmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210811061258.7421-1-siyuan.fan@foxmail.com> References: <20210811061258.7421-1-siyuan.fan@foxmail.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v2 4/4] pipeline: isp: All meson configure files X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Fan Siyuan We move the ISP to a new path and modify the path. Signed-off-by: Fan Siyuan --- meson_options.txt | 2 +- src/libcamera/pipeline/isp/meson.build | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 src/libcamera/pipeline/isp/meson.build diff --git a/meson_options.txt b/meson_options.txt index 2c80ad8b..03110587 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -37,7 +37,7 @@ option('lc-compliance', option('pipelines', type : 'array', - choices : ['ipu3', 'raspberrypi', 'rkisp1', 'simple', 'uvcvideo', 'vimc'], + choices : ['ipu3', 'raspberrypi', 'rkisp1', 'simple', 'uvcvideo', 'vimc', 'isp'], description : 'Select which pipeline handlers to include') option('qcam', diff --git a/src/libcamera/pipeline/isp/meson.build b/src/libcamera/pipeline/isp/meson.build new file mode 100644 index 00000000..1e80ea84 --- /dev/null +++ b/src/libcamera/pipeline/isp/meson.build @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: CC0-1.0 + +libcamera_sources += files([ + 'isp.cpp', + '../../swisp/isp.cpp' +]) \ No newline at end of file