From patchwork Tue Sep 22 09:50:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 9694 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 07C27C3B5B for ; Tue, 22 Sep 2020 09:50:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D692062FD8; Tue, 22 Sep 2020 11:50:33 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="HNJTogZS"; dkim-atps=neutral Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8819862FAD for ; Tue, 22 Sep 2020 11:50:32 +0200 (CEST) Received: by mail-wr1-x431.google.com with SMTP id a17so16297564wrn.6 for ; Tue, 22 Sep 2020 02:50:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JNhjNwAAOx0BvLaR6PdAoOduJ+KycefW1eswWQRArUk=; b=HNJTogZS3fIUiHPuPAM0JIg/8yuYMbymA8PE4DT8iH5UpYX1MLzHhBhhFz84JBhu3V D0J/r2qTspLDLrLLdE2kFtV2TBdDtIhQ5OqolOIysk03M50B9HoMkTxkENDBna13D2gP eiAKl92CViryATZ57ZsNU4kVSPtZ1sNGieDqEZ+V3B9CtKD02KQJg0yLe9toUTuTk/r6 krdAcyf6TyUGEiGyiTO8Tm6K5p4l/fV1jKm8F+cYr2JfCkMbMt8GfD75fLVNL3kbUTy6 2Z+BrH1fMILUJ2fuqXg2iHzaoxSIUXmpinFyRjti3Z63SQiqSH6tbRb2k0Ceo9SxfAvC WS/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JNhjNwAAOx0BvLaR6PdAoOduJ+KycefW1eswWQRArUk=; b=Gq47yXEvXkW3Kf9XFyWcrC5vSm/NX5Ir6ZuB25zap7nYJK4zz2Rjt9avLIJt8b0lpM rMdI/b5dS1TRwDV9TlrqIP4N5Jor8biq6oWzqwWpc+ZanG7sWIR0VmFBO7lFT55ykHOD g+ig18lgilAOKoQA9VVndfxuHLA8cRxI3EtNDJqPh+XHf9nft9J16SCpfSicUwlTKE3o aLiY8ao+ujAiFZOdsfXiSX5hUH3DAm+GlBePjzFP1AAnOQE9fqOxrkUqupYG/CZB/PK9 /iFU3ug2JJo8Nxhl0pAcJqCy7jfqPRITsjgNgZKW04c+6F0wAmYpqcKErwOTYcAj/agS aiqQ== X-Gm-Message-State: AOAM5324o5tgKGHtpSqg7cYj8/pGdrjK6dWFr9ahTtNCm66DFNDGoTCS rOVrVvRPMWi98M6BWXtP2RV+ahbFW24mvA== X-Google-Smtp-Source: ABdhPJylMo6Sa6BOa61swAe37fNfYTCHCfWzX4iy4ZddNCAcWtxG0rcb4j6TnLfeCQ7ms3k2KxN3/w== X-Received: by 2002:adf:f4c6:: with SMTP id h6mr4330817wrp.310.1600768231630; Tue, 22 Sep 2020 02:50:31 -0700 (PDT) Received: from naushir-VirtualBox.pitowers.org ([2a00:1098:3142:14:a00:27ff:fe4d:f6a2]) by smtp.gmail.com with ESMTPSA id h204sm3776187wmf.35.2020.09.22.02.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 02:50:30 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 22 Sep 2020 10:50:15 +0100 Message-Id: <20200922095018.68434-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200922095018.68434-1-naush@raspberrypi.com> References: <20200922095018.68434-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/4] pipeline: raspberrypi: Move RPiStream and RPiDevice to its own namespace 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" Rename RpiStream -> RPi::Stream and RPiDevice -> RPi::Device. There are no functional changes in this commit. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- .../pipeline/raspberrypi/raspberrypi.cpp | 42 +++++++++---------- .../pipeline/raspberrypi/rpi_stream.cpp | 34 +++++++-------- .../pipeline/raspberrypi/rpi_stream.h | 16 +++---- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 50f07182..5ed74d51 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -150,16 +150,16 @@ public: void ispOutputDequeue(FrameBuffer *buffer); void clearIncompleteRequests(); - void handleStreamBuffer(FrameBuffer *buffer, RPi::RPiStream *stream); - void handleExternalBuffer(FrameBuffer *buffer, RPi::RPiStream *stream); + void handleStreamBuffer(FrameBuffer *buffer, RPi::Stream *stream); + void handleExternalBuffer(FrameBuffer *buffer, RPi::Stream *stream); void handleState(); CameraSensor *sensor_; /* Array of Unicam and ISP device streams and associated buffers/streams. */ - RPi::RPiDevice unicam_; - RPi::RPiDevice isp_; + RPi::Device unicam_; + RPi::Device isp_; /* The vector below is just for convenience when iterating over all streams. */ - std::vector streams_; + std::vector streams_; /* Stores the ids of the buffers mapped in the IPA. */ std::unordered_set ipaBuffers_; @@ -189,7 +189,7 @@ private: void tryRunPipeline(); void tryFlushQueues(); FrameBuffer *updateQueue(std::queue &q, uint64_t timestamp, - RPi::RPiStream *stream); + RPi::Stream *stream); unsigned int ispOutputCount_; }; @@ -618,7 +618,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) int PipelineHandlerRPi::exportFrameBuffers([[maybe_unused]] Camera *camera, Stream *stream, std::vector> *buffers) { - RPi::RPiStream *s = static_cast(stream); + RPi::Stream *s = static_cast(stream); unsigned int count = stream->configuration().bufferCount; int ret = s->dev()->exportBuffers(count, buffers); @@ -787,14 +787,14 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) return false; /* Locate and open the unicam video streams. */ - data->unicam_[Unicam::Embedded] = RPi::RPiStream("Unicam Embedded", unicam_->getEntityByName("unicam-embedded")); - data->unicam_[Unicam::Image] = RPi::RPiStream("Unicam Image", unicam_->getEntityByName("unicam-image")); + data->unicam_[Unicam::Embedded] = RPi::Stream("Unicam Embedded", unicam_->getEntityByName("unicam-embedded")); + data->unicam_[Unicam::Image] = RPi::Stream("Unicam Image", unicam_->getEntityByName("unicam-image")); /* Tag the ISP input stream as an import stream. */ - data->isp_[Isp::Input] = RPi::RPiStream("ISP Input", isp_->getEntityByName("bcm2835-isp0-output0"), true); - data->isp_[Isp::Output0] = RPi::RPiStream("ISP Output0", isp_->getEntityByName("bcm2835-isp0-capture1")); - data->isp_[Isp::Output1] = RPi::RPiStream("ISP Output1", isp_->getEntityByName("bcm2835-isp0-capture2")); - data->isp_[Isp::Stats] = RPi::RPiStream("ISP Stats", isp_->getEntityByName("bcm2835-isp0-capture3")); + data->isp_[Isp::Input] = RPi::Stream("ISP Input", isp_->getEntityByName("bcm2835-isp0-output0"), true); + data->isp_[Isp::Output0] = RPi::Stream("ISP Output0", isp_->getEntityByName("bcm2835-isp0-capture1")); + data->isp_[Isp::Output1] = RPi::Stream("ISP Output1", isp_->getEntityByName("bcm2835-isp0-capture2")); + data->isp_[Isp::Stats] = RPi::Stream("ISP Stats", isp_->getEntityByName("bcm2835-isp0-capture3")); /* This is just for convenience so that we can easily iterate over all streams. */ for (auto &stream : data->unicam_) @@ -912,7 +912,7 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera) */ unsigned int maxBuffers = 0; for (const Stream *s : camera->streams()) - if (static_cast(s)->isExternal()) + if (static_cast(s)->isExternal()) maxBuffers = std::max(maxBuffers, s->configuration().bufferCount); for (auto const stream : data->streams_) { @@ -1133,13 +1133,13 @@ done: void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer) { - RPi::RPiStream *stream = nullptr; + RPi::Stream *stream = nullptr; int index; if (state_ == State::Stopped) return; - for (RPi::RPiStream &s : unicam_) { + for (RPi::Stream &s : unicam_) { index = s.getBufferId(buffer); if (index != -1) { stream = &s; @@ -1201,13 +1201,13 @@ void RPiCameraData::ispInputDequeue(FrameBuffer *buffer) void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer) { - RPi::RPiStream *stream = nullptr; + RPi::Stream *stream = nullptr; int index; if (state_ == State::Stopped) return; - for (RPi::RPiStream &s : isp_) { + for (RPi::Stream &s : isp_) { index = s.getBufferId(buffer); if (index != -1) { stream = &s; @@ -1297,7 +1297,7 @@ void RPiCameraData::clearIncompleteRequests() } } -void RPiCameraData::handleStreamBuffer(FrameBuffer *buffer, RPi::RPiStream *stream) +void RPiCameraData::handleStreamBuffer(FrameBuffer *buffer, RPi::Stream *stream) { if (stream->isExternal()) { /* @@ -1330,7 +1330,7 @@ void RPiCameraData::handleStreamBuffer(FrameBuffer *buffer, RPi::RPiStream *stre } } -void RPiCameraData::handleExternalBuffer(FrameBuffer *buffer, RPi::RPiStream *stream) +void RPiCameraData::handleExternalBuffer(FrameBuffer *buffer, RPi::Stream *stream) { unsigned int id = stream->getBufferId(buffer); @@ -1510,7 +1510,7 @@ void RPiCameraData::tryFlushQueues() } FrameBuffer *RPiCameraData::updateQueue(std::queue &q, uint64_t timestamp, - RPi::RPiStream *stream) + RPi::Stream *stream) { /* * If the unicam streams are external (both have be to the same), then we diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp index 2dcf96ca..3ee859e9 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp @@ -14,46 +14,46 @@ LOG_DEFINE_CATEGORY(RPISTREAM) namespace RPi { -V4L2VideoDevice *RPiStream::dev() const +V4L2VideoDevice *Stream::dev() const { return dev_.get(); } -std::string RPiStream::name() const +std::string Stream::name() const { return name_; } -void RPiStream::reset() +void Stream::reset() { external_ = false; clearBuffers(); } -void RPiStream::setExternal(bool external) +void Stream::setExternal(bool external) { /* Import streams cannot be external. */ ASSERT(!external || !importOnly_); external_ = external; } -bool RPiStream::isExternal() const +bool Stream::isExternal() const { return external_; } -void RPiStream::setExportedBuffers(std::vector> *buffers) +void Stream::setExportedBuffers(std::vector> *buffers) { for (auto const &buffer : *buffers) bufferMap_.emplace(id_.get(), buffer.get()); } -const BufferMap &RPiStream::getBuffers() const +const BufferMap &Stream::getBuffers() const { return bufferMap_; } -int RPiStream::getBufferId(FrameBuffer *buffer) const +int Stream::getBufferId(FrameBuffer *buffer) const { if (importOnly_) return -1; @@ -68,12 +68,12 @@ int RPiStream::getBufferId(FrameBuffer *buffer) const return it->first; } -void RPiStream::setExternalBuffer(FrameBuffer *buffer) +void Stream::setExternalBuffer(FrameBuffer *buffer) { bufferMap_.emplace(RPiBufferMask::EXTERNAL_BUFFER | id_.get(), buffer); } -void RPiStream::removeExternalBuffer(FrameBuffer *buffer) +void Stream::removeExternalBuffer(FrameBuffer *buffer) { int id = getBufferId(buffer); @@ -82,7 +82,7 @@ void RPiStream::removeExternalBuffer(FrameBuffer *buffer) bufferMap_.erase(id); } -int RPiStream::prepareBuffers(unsigned int count) +int Stream::prepareBuffers(unsigned int count) { int ret; @@ -108,7 +108,7 @@ int RPiStream::prepareBuffers(unsigned int count) return dev_->importBuffers(count); } -int RPiStream::queueBuffer(FrameBuffer *buffer) +int Stream::queueBuffer(FrameBuffer *buffer) { /* * A nullptr buffer implies an external stream, but no external @@ -147,7 +147,7 @@ int RPiStream::queueBuffer(FrameBuffer *buffer) return 0; } -void RPiStream::returnBuffer(FrameBuffer *buffer) +void Stream::returnBuffer(FrameBuffer *buffer) { /* This can only be called for external streams. */ ASSERT(external_); @@ -186,7 +186,7 @@ void RPiStream::returnBuffer(FrameBuffer *buffer) } } -int RPiStream::queueAllBuffers() +int Stream::queueAllBuffers() { int ret; @@ -204,13 +204,13 @@ int RPiStream::queueAllBuffers() return 0; } -void RPiStream::releaseBuffers() +void Stream::releaseBuffers() { dev_->releaseBuffers(); clearBuffers(); } -void RPiStream::clearBuffers() +void Stream::clearBuffers() { availableBuffers_ = std::queue{}; requestBuffers_ = std::queue{}; @@ -219,7 +219,7 @@ void RPiStream::clearBuffers() id_.reset(); } -int RPiStream::queueToDevice(FrameBuffer *buffer) +int Stream::queueToDevice(FrameBuffer *buffer) { LOG(RPISTREAM, Debug) << "Queuing buffer " << getBufferId(buffer) << " for " << name_; diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.h b/src/libcamera/pipeline/raspberrypi/rpi_stream.h index a2c21bcd..cb097e1c 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.h +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.h @@ -27,15 +27,15 @@ using BufferMap = std::unordered_map; * Device stream abstraction for either an internal or external stream. * Used for both Unicam and the ISP. */ -class RPiStream : public Stream +class Stream : public libcamera::Stream { public: - RPiStream() + Stream() : id_(RPiBufferMask::ID) { } - RPiStream(const char *name, MediaEntity *dev, bool importOnly = false) + Stream(const char *name, MediaEntity *dev, bool importOnly = false) : external_(false), importOnly_(importOnly), name_(name), dev_(std::make_unique(dev)), id_(RPiBufferMask::ID) { @@ -155,7 +155,7 @@ private: * streams indexed with an enum class. */ template -class RPiDevice : public std::array +class Device : public std::array { private: constexpr auto index(E e) const noexcept @@ -163,13 +163,13 @@ private: return static_cast>(e); } public: - RPiStream &operator[](E e) + Stream &operator[](E e) { - return std::array::operator[](index(e)); + return std::array::operator[](index(e)); } - const RPiStream &operator[](E e) const + const Stream &operator[](E e) const { - return std::array::operator[](index(e)); + return std::array::operator[](index(e)); } }; From patchwork Tue Sep 22 09:50:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 9695 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 79556C3B5B for ; Tue, 22 Sep 2020 09:50:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3DD9B62FDD; Tue, 22 Sep 2020 11:50:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="goJ6IrYb"; dkim-atps=neutral Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id ADFE362FD6 for ; Tue, 22 Sep 2020 11:50:33 +0200 (CEST) Received: by mail-wr1-x435.google.com with SMTP id x14so16289428wrl.12 for ; Tue, 22 Sep 2020 02:50:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W3B1SEh6B3BMPJIWyNG83jbhUKHNFkXZCUMYp2s0V4A=; b=goJ6IrYbLF/80hJLDPQxgVDoW9uv9j6Uv/nJrgn5sdty8eBWPNFmMYq+1RW2lsEcrB nM0+3vhXBmQvWSVfGeQmaTFcZQfKcxFDlLdElSV1+SgnLtX2Rj2uhzsyHjZ91t2vR6qB Wyd0iL7i26ew3++9EcP1J0K46QJE1NCnkVkBmYxvbrq4iW4g6fuwCCVsLWYeMzCqvKvd XZN4QNE94ubU2kp9OE4vgIr16qIAejASxCjwExcSbbH6LihcdHQZlKQJE/3/ETjJigf+ qSuzrk3+Q6oh8lU9nqlUpBfijURuFEfrYarL12jqO0AhtzhfH6cXmCFw1/C04bIMGBgD jLqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W3B1SEh6B3BMPJIWyNG83jbhUKHNFkXZCUMYp2s0V4A=; b=PLy4H3t+dvgqtsFVzbTI0k+Zl1MlzlEbCKaqjBIG57KUVzLMp+cGY6YAdb8OxChb7d 5qekyPvLffhBbFh3DdUWX2pXQpnFK2GvqEvlIx+W3hp+6Mr2rOYCG6a/z+iLXgyxwzl3 JtzqfnELiSUDMo/o0qAum72sX4S9fQeP4Wgdea4ZKFuVtlwwxKpTwHhxEkiozV8bct5E 7DRVNshZty8xSX82fw74IKjLKTDz7dkDp4XmjJDbbLNx9JHR3OdXH+ekd/6r1IEmKXBM SPoAEFpxtsRTMHyTHn8g3c/lAxeOWMRlfCZXDMwNd2tKv5Wyk7EcjMi4Uo7F3FWFTDbc RwBA== X-Gm-Message-State: AOAM530cW7Wzh56s5V/8qijB7r9AL5qyWZGXRl+0my7ntXtdhRDKPjeu jo9U7Y676pXF6oyloTlRF3dFm6PNmTarYA== X-Google-Smtp-Source: ABdhPJyby6ShfvFfSpvGzoWnRQefd/3ioWqS0/skvBShFeULPfWEll0nXSkHTt0YqvzSmAjEKx0mww== X-Received: by 2002:adf:f5c7:: with SMTP id k7mr4526270wrp.246.1600768232552; Tue, 22 Sep 2020 02:50:32 -0700 (PDT) Received: from naushir-VirtualBox.pitowers.org ([2a00:1098:3142:14:a00:27ff:fe4d:f6a2]) by smtp.gmail.com with ESMTPSA id h204sm3776187wmf.35.2020.09.22.02.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 02:50:31 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 22 Sep 2020 10:50:16 +0100 Message-Id: <20200922095018.68434-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200922095018.68434-1-naush@raspberrypi.com> References: <20200922095018.68434-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/4] ipa: raspberrypi: Move IPA parameters to the RPi namespace 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" All IPA related types/params are now moved to the RPi namespace. There are no functional changes in this commit. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi --- include/libcamera/ipa/raspberrypi.h | 40 +++++---- src/ipa/raspberrypi/raspberrypi.cpp | 82 +++++++++---------- .../pipeline/raspberrypi/raspberrypi.cpp | 40 ++++----- .../pipeline/raspberrypi/rpi_stream.cpp | 4 +- .../pipeline/raspberrypi/rpi_stream.h | 4 +- 5 files changed, 87 insertions(+), 83 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index dd6ebeac..c9d4aa81 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -10,25 +10,29 @@ #include #include -enum RPiConfigParameters { - RPI_IPA_CONFIG_LS_TABLE = (1 << 0), - RPI_IPA_CONFIG_STAGGERED_WRITE = (1 << 1), - RPI_IPA_CONFIG_SENSOR = (1 << 2), - RPI_IPA_CONFIG_DROP_FRAMES = (1 << 3), +namespace libcamera { + +namespace RPi { + +enum ConfigParameters { + IPA_CONFIG_LS_TABLE = (1 << 0), + IPA_CONFIG_STAGGERED_WRITE = (1 << 1), + IPA_CONFIG_SENSOR = (1 << 2), + IPA_CONFIG_DROP_FRAMES = (1 << 3), }; -enum RPiOperations { - RPI_IPA_ACTION_V4L2_SET_STAGGERED = 1, - RPI_IPA_ACTION_V4L2_SET_ISP, - RPI_IPA_ACTION_STATS_METADATA_COMPLETE, - RPI_IPA_ACTION_RUN_ISP, - RPI_IPA_ACTION_EMBEDDED_COMPLETE, - RPI_IPA_EVENT_SIGNAL_STAT_READY, - RPI_IPA_EVENT_SIGNAL_ISP_PREPARE, - RPI_IPA_EVENT_QUEUE_REQUEST, +enum Operations { + IPA_ACTION_V4L2_SET_STAGGERED = 1, + IPA_ACTION_V4L2_SET_ISP, + IPA_ACTION_STATS_METADATA_COMPLETE, + IPA_ACTION_RUN_ISP, + IPA_ACTION_EMBEDDED_COMPLETE, + IPA_EVENT_SIGNAL_STAT_READY, + IPA_EVENT_SIGNAL_ISP_PREPARE, + IPA_EVENT_QUEUE_REQUEST, }; -enum RPiBufferMask { +enum BufferMask { ID = 0x00ffff, STATS = 0x010000, EMBEDDED_DATA = 0x020000, @@ -39,10 +43,8 @@ enum RPiBufferMask { /* Size of the LS grid allocation. */ #define MAX_LS_GRID_SIZE (32 << 10) -namespace libcamera { - /* List of controls handled by the Raspberry Pi IPA */ -static const ControlInfoMap RPiControls = { +static const ControlInfoMap Controls = { { &controls::AeEnable, ControlInfo(false, true) }, { &controls::ExposureTime, ControlInfo(0, 999999) }, { &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) }, @@ -60,6 +62,8 @@ static const ControlInfoMap RPiControls = { { &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) }, }; +} /* namespace RPi */ + } /* namespace libcamera */ #endif /* __LIBCAMERA_IPA_INTERFACE_RASPBERRYPI_H__ */ diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 0555cc4e..28f81824 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -125,10 +125,10 @@ private: CameraMode lastMode_; /* Raspberry Pi controller specific defines. */ - std::unique_ptr helper_; - RPi::Controller controller_; + std::unique_ptr<::RPi::CamHelper> helper_; + ::RPi::Controller controller_; bool controllerInit_; - RPi::Metadata rpiMetadata_; + ::RPi::Metadata rpiMetadata_; /* * We count frames to decide if the frame must be hidden (e.g. from @@ -211,7 +211,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, */ std::string cameraName(sensorInfo.model); if (!helper_) { - helper_ = std::unique_ptr(RPi::CamHelper::Create(cameraName)); + helper_ = std::unique_ptr<::RPi::CamHelper>(::RPi::CamHelper::Create(cameraName)); /* * Pass out the sensor config to the pipeline handler in order * to setup the staggered writer class. @@ -224,7 +224,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, result->data.push_back(exposureDelay); result->data.push_back(sensorMetadata); - result->operation |= RPI_IPA_CONFIG_STAGGERED_WRITE; + result->operation |= RPi::IPA_CONFIG_STAGGERED_WRITE; } /* Re-assemble camera mode using the sensor info. */ @@ -250,7 +250,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, } result->data.push_back(drop_frame); - result->operation |= RPI_IPA_CONFIG_DROP_FRAMES; + result->operation |= RPi::IPA_CONFIG_DROP_FRAMES; struct AgcStatus agcStatus; /* These zero values mean not program anything (unless overwritten). */ @@ -268,7 +268,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, agcStatus.analogue_gain = DEFAULT_ANALOGUE_GAIN; } - RPi::Metadata metadata; + ::RPi::Metadata metadata; controller_.SwitchMode(mode_, &metadata); /* SwitchMode may supply updated exposure/gain values to use. */ @@ -278,13 +278,13 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, applyAGC(&agcStatus, ctrls); result->controls.push_back(ctrls); - result->operation |= RPI_IPA_CONFIG_SENSOR; + result->operation |= RPi::IPA_CONFIG_SENSOR; } lastMode_ = mode_; /* Store the lens shading table pointer and handle if available. */ - if (ipaConfig.operation & RPI_IPA_CONFIG_LS_TABLE) { + if (ipaConfig.operation & RPi::IPA_CONFIG_LS_TABLE) { /* Remove any previous table, if there was one. */ if (lsTable_) { munmap(lsTable_, MAX_LS_GRID_SIZE); @@ -340,7 +340,7 @@ void IPARPi::unmapBuffers(const std::vector &ids) void IPARPi::processEvent(const IPAOperationData &event) { switch (event.operation) { - case RPI_IPA_EVENT_SIGNAL_STAT_READY: { + case RPi::IPA_EVENT_SIGNAL_STAT_READY: { unsigned int bufferId = event.data[0]; if (++check_count_ != frame_count_) /* assert here? */ @@ -351,14 +351,14 @@ void IPARPi::processEvent(const IPAOperationData &event) reportMetadata(); IPAOperationData op; - op.operation = RPI_IPA_ACTION_STATS_METADATA_COMPLETE; - op.data = { bufferId & RPiBufferMask::ID }; + op.operation = RPi::IPA_ACTION_STATS_METADATA_COMPLETE; + op.data = { bufferId & RPi::BufferMask::ID }; op.controls = { libcameraMetadata_ }; queueFrameAction.emit(0, op); break; } - case RPI_IPA_EVENT_SIGNAL_ISP_PREPARE: { + case RPi::IPA_EVENT_SIGNAL_ISP_PREPARE: { unsigned int embeddedbufferId = event.data[0]; unsigned int bayerbufferId = event.data[1]; @@ -372,13 +372,13 @@ void IPARPi::processEvent(const IPAOperationData &event) /* Ready to push the input buffer into the ISP. */ IPAOperationData op; - op.operation = RPI_IPA_ACTION_RUN_ISP; - op.data = { bayerbufferId & RPiBufferMask::ID }; + op.operation = RPi::IPA_ACTION_RUN_ISP; + op.data = { bayerbufferId & RPi::BufferMask::ID }; queueFrameAction.emit(0, op); break; } - case RPI_IPA_EVENT_QUEUE_REQUEST: { + case RPi::IPA_EVENT_QUEUE_REQUEST: { queueRequest(event.controls[0]); break; } @@ -391,7 +391,7 @@ void IPARPi::processEvent(const IPAOperationData &event) void IPARPi::reportMetadata() { - std::unique_lock lock(rpiMetadata_); + std::unique_lock<::RPi::Metadata> lock(rpiMetadata_); /* * Certain information about the current frame and how it will be @@ -496,7 +496,7 @@ void IPARPi::queueRequest(const ControlList &controls) switch (ctrl.first) { case controls::AE_ENABLE: { - RPi::Algorithm *agc = controller_.GetAlgorithm("agc"); + ::RPi::Algorithm *agc = controller_.GetAlgorithm("agc"); ASSERT(agc); if (ctrl.second.get() == false) agc->Pause(); @@ -508,7 +508,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::EXPOSURE_TIME: { - RPi::AgcAlgorithm *agc = dynamic_cast( + ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( controller_.GetAlgorithm("agc")); ASSERT(agc); /* This expects units of micro-seconds. */ @@ -522,7 +522,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::ANALOGUE_GAIN: { - RPi::AgcAlgorithm *agc = dynamic_cast( + ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( controller_.GetAlgorithm("agc")); ASSERT(agc); agc->SetFixedAnalogueGain(ctrl.second.get()); @@ -536,7 +536,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AE_METERING_MODE: { - RPi::AgcAlgorithm *agc = dynamic_cast( + ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( controller_.GetAlgorithm("agc")); ASSERT(agc); @@ -552,7 +552,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AE_CONSTRAINT_MODE: { - RPi::AgcAlgorithm *agc = dynamic_cast( + ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( controller_.GetAlgorithm("agc")); ASSERT(agc); @@ -568,7 +568,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AE_EXPOSURE_MODE: { - RPi::AgcAlgorithm *agc = dynamic_cast( + ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( controller_.GetAlgorithm("agc")); ASSERT(agc); @@ -584,7 +584,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::EXPOSURE_VALUE: { - RPi::AgcAlgorithm *agc = dynamic_cast( + ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( controller_.GetAlgorithm("agc")); ASSERT(agc); @@ -600,7 +600,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AWB_ENABLE: { - RPi::Algorithm *awb = controller_.GetAlgorithm("awb"); + ::RPi::Algorithm *awb = controller_.GetAlgorithm("awb"); ASSERT(awb); if (ctrl.second.get() == false) @@ -614,7 +614,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AWB_MODE: { - RPi::AwbAlgorithm *awb = dynamic_cast( + ::RPi::AwbAlgorithm *awb = dynamic_cast<::RPi::AwbAlgorithm *>( controller_.GetAlgorithm("awb")); ASSERT(awb); @@ -631,7 +631,7 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::COLOUR_GAINS: { auto gains = ctrl.second.get>(); - RPi::AwbAlgorithm *awb = dynamic_cast( + ::RPi::AwbAlgorithm *awb = dynamic_cast<::RPi::AwbAlgorithm *>( controller_.GetAlgorithm("awb")); ASSERT(awb); @@ -644,7 +644,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::BRIGHTNESS: { - RPi::ContrastAlgorithm *contrast = dynamic_cast( + ::RPi::ContrastAlgorithm *contrast = dynamic_cast<::RPi::ContrastAlgorithm *>( controller_.GetAlgorithm("contrast")); ASSERT(contrast); @@ -655,7 +655,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::CONTRAST: { - RPi::ContrastAlgorithm *contrast = dynamic_cast( + ::RPi::ContrastAlgorithm *contrast = dynamic_cast<::RPi::ContrastAlgorithm *>( controller_.GetAlgorithm("contrast")); ASSERT(contrast); @@ -666,7 +666,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::SATURATION: { - RPi::CcmAlgorithm *ccm = dynamic_cast( + ::RPi::CcmAlgorithm *ccm = dynamic_cast<::RPi::CcmAlgorithm *>( controller_.GetAlgorithm("ccm")); ASSERT(ccm); @@ -677,7 +677,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::SHARPNESS: { - RPi::SharpenAlgorithm *sharpen = dynamic_cast( + ::RPi::SharpenAlgorithm *sharpen = dynamic_cast<::RPi::SharpenAlgorithm *>( controller_.GetAlgorithm("sharpen")); ASSERT(sharpen); @@ -699,8 +699,8 @@ void IPARPi::queueRequest(const ControlList &controls) void IPARPi::returnEmbeddedBuffer(unsigned int bufferId) { IPAOperationData op; - op.operation = RPI_IPA_ACTION_EMBEDDED_COMPLETE; - op.data = { bufferId & RPiBufferMask::ID }; + op.operation = RPi::IPA_ACTION_EMBEDDED_COMPLETE; + op.data = { bufferId & RPi::BufferMask::ID }; queueFrameAction.emit(0, op); } @@ -720,7 +720,7 @@ void IPARPi::prepareISP(unsigned int bufferId) controller_.Prepare(&rpiMetadata_); /* Lock the metadata buffer to avoid constant locks/unlocks. */ - std::unique_lock lock(rpiMetadata_); + std::unique_lock<::RPi::Metadata> lock(rpiMetadata_); AwbStatus *awbStatus = rpiMetadata_.GetLocked("awb.status"); if (awbStatus) @@ -764,7 +764,7 @@ void IPARPi::prepareISP(unsigned int bufferId) if (!ctrls.empty()) { IPAOperationData op; - op.operation = RPI_IPA_ACTION_V4L2_SET_ISP; + op.operation = RPi::IPA_ACTION_V4L2_SET_ISP; op.controls.push_back(ctrls); queueFrameAction.emit(0, op); } @@ -781,18 +781,18 @@ bool IPARPi::parseEmbeddedData(unsigned int bufferId, struct DeviceStatus &devic int size = buffers_.find(bufferId)->second.planes()[0].length; helper_->Parser().SetBufferSize(size); - RPi::MdParser::Status status = helper_->Parser().Parse(it->second); - if (status != RPi::MdParser::Status::OK) { + ::RPi::MdParser::Status status = helper_->Parser().Parse(it->second); + if (status != ::RPi::MdParser::Status::OK) { LOG(IPARPI, Error) << "Embedded Buffer parsing failed, error " << status; } else { uint32_t exposure_lines, gain_code; - if (helper_->Parser().GetExposureLines(exposure_lines) != RPi::MdParser::Status::OK) { + if (helper_->Parser().GetExposureLines(exposure_lines) != ::RPi::MdParser::Status::OK) { LOG(IPARPI, Error) << "Exposure time failed"; return false; } deviceStatus.shutter_speed = helper_->Exposure(exposure_lines); - if (helper_->Parser().GetGainCode(gain_code) != RPi::MdParser::Status::OK) { + if (helper_->Parser().GetGainCode(gain_code) != ::RPi::MdParser::Status::OK) { LOG(IPARPI, Error) << "Gain failed"; return false; } @@ -815,7 +815,7 @@ void IPARPi::processStats(unsigned int bufferId) } bcm2835_isp_stats *stats = static_cast(it->second); - RPi::StatisticsPtr statistics = std::make_shared(*stats); + ::RPi::StatisticsPtr statistics = std::make_shared(*stats); controller_.Process(statistics, &rpiMetadata_); struct AgcStatus agcStatus; @@ -824,7 +824,7 @@ void IPARPi::processStats(unsigned int bufferId) applyAGC(&agcStatus, ctrls); IPAOperationData op; - op.operation = RPI_IPA_ACTION_V4L2_SET_STAGGERED; + op.operation = RPi::IPA_ACTION_V4L2_SET_STAGGERED; op.controls.push_back(ctrls); queueFrameAction.emit(0, op); } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 5ed74d51..35dbe0fb 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -837,7 +837,7 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) } /* Register the controls that the Raspberry Pi IPA can handle. */ - data->controlInfo_ = RPiControls; + data->controlInfo_ = RPi::Controls; /* Initialize the camera properties. */ data->properties_ = data->sensor_->properties(); @@ -925,8 +925,8 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera) * Pass the stats and embedded data buffers to the IPA. No other * buffers need to be passed. */ - mapBuffers(camera, data->isp_[Isp::Stats].getBuffers(), RPiBufferMask::STATS); - mapBuffers(camera, data->unicam_[Unicam::Embedded].getBuffers(), RPiBufferMask::EMBEDDED_DATA); + mapBuffers(camera, data->isp_[Isp::Stats].getBuffers(), RPi::BufferMask::STATS); + mapBuffers(camera, data->unicam_[Unicam::Embedded].getBuffers(), RPi::BufferMask::EMBEDDED_DATA); return 0; } @@ -1017,7 +1017,7 @@ int RPiCameraData::configureIPA() return -ENOMEM; /* Allow the IPA to mmap the LS table via the file descriptor. */ - ipaConfig.operation = RPI_IPA_CONFIG_LS_TABLE; + ipaConfig.operation = RPi::IPA_CONFIG_LS_TABLE; ipaConfig.data = { static_cast(lsTable_.fd()) }; } @@ -1035,7 +1035,7 @@ int RPiCameraData::configureIPA() &result); unsigned int resultIdx = 0; - if (result.operation & RPI_IPA_CONFIG_STAGGERED_WRITE) { + if (result.operation & RPi::IPA_CONFIG_STAGGERED_WRITE) { /* * Setup our staggered control writer with the sensor default * gain and exposure delays. @@ -1048,13 +1048,13 @@ int RPiCameraData::configureIPA() } } - if (result.operation & RPI_IPA_CONFIG_SENSOR) { + if (result.operation & RPi::IPA_CONFIG_SENSOR) { const ControlList &ctrls = result.controls[0]; if (!staggeredCtrl_.set(ctrls)) LOG(RPI, Error) << "V4L2 staggered set failed"; } - if (result.operation & RPI_IPA_CONFIG_DROP_FRAMES) { + if (result.operation & RPi::IPA_CONFIG_DROP_FRAMES) { /* Configure the number of dropped frames required on startup. */ dropFrameCount_ = result.data[resultIdx++]; } @@ -1070,14 +1070,14 @@ void RPiCameraData::queueFrameAction([[maybe_unused]] unsigned int frame, * a stopped state. */ switch (action.operation) { - case RPI_IPA_ACTION_V4L2_SET_STAGGERED: { + case RPi::IPA_ACTION_V4L2_SET_STAGGERED: { const ControlList &controls = action.controls[0]; if (!staggeredCtrl_.set(controls)) LOG(RPI, Error) << "V4L2 staggered set failed"; goto done; } - case RPI_IPA_ACTION_V4L2_SET_ISP: { + case RPi::IPA_ACTION_V4L2_SET_ISP: { ControlList controls = action.controls[0]; isp_[Isp::Input].dev()->setControls(&controls); goto done; @@ -1092,7 +1092,7 @@ void RPiCameraData::queueFrameAction([[maybe_unused]] unsigned int frame, * is in a stopped state. */ switch (action.operation) { - case RPI_IPA_ACTION_STATS_METADATA_COMPLETE: { + case RPi::IPA_ACTION_STATS_METADATA_COMPLETE: { unsigned int bufferId = action.data[0]; FrameBuffer *buffer = isp_[Isp::Stats].getBuffers().at(bufferId); @@ -1103,14 +1103,14 @@ void RPiCameraData::queueFrameAction([[maybe_unused]] unsigned int frame, break; } - case RPI_IPA_ACTION_EMBEDDED_COMPLETE: { + case RPi::IPA_ACTION_EMBEDDED_COMPLETE: { unsigned int bufferId = action.data[0]; FrameBuffer *buffer = unicam_[Unicam::Embedded].getBuffers().at(bufferId); handleStreamBuffer(buffer, &unicam_[Unicam::Embedded]); break; } - case RPI_IPA_ACTION_RUN_ISP: { + case RPi::IPA_ACTION_RUN_ISP: { unsigned int bufferId = action.data[0]; FrameBuffer *buffer = unicam_[Unicam::Image].getBuffers().at(bufferId); @@ -1228,8 +1228,8 @@ void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer) */ if (stream == &isp_[Isp::Stats]) { IPAOperationData op; - op.operation = RPI_IPA_EVENT_SIGNAL_STAT_READY; - op.data = { RPiBufferMask::STATS | static_cast(index) }; + op.operation = RPi::IPA_EVENT_SIGNAL_STAT_READY; + op.data = { RPi::BufferMask::STATS | static_cast(index) }; ipa_->processEvent(op); } else { /* Any other ISP output can be handed back to the application now. */ @@ -1334,7 +1334,7 @@ void RPiCameraData::handleExternalBuffer(FrameBuffer *buffer, RPi::Stream *strea { unsigned int id = stream->getBufferId(buffer); - if (!(id & RPiBufferMask::EXTERNAL_BUFFER)) + if (!(id & RPi::BufferMask::EXTERNAL_BUFFER)) return; /* Stop the Stream object from tracking the buffer. */ @@ -1454,7 +1454,7 @@ void RPiCameraData::tryRunPipeline() * queue the ISP output buffer listed in the request to start the HW * pipeline. */ - op.operation = RPI_IPA_EVENT_QUEUE_REQUEST; + op.operation = RPi::IPA_EVENT_QUEUE_REQUEST; op.controls = { request->controls() }; ipa_->processEvent(op); @@ -1468,13 +1468,13 @@ void RPiCameraData::tryRunPipeline() unsigned int bayerId = unicam_[Unicam::Image].getBufferId(bayerBuffer); unsigned int embeddedId = unicam_[Unicam::Embedded].getBufferId(embeddedBuffer); - LOG(RPI, Debug) << "Signalling RPI_IPA_EVENT_SIGNAL_ISP_PREPARE:" + LOG(RPI, Debug) << "Signalling RPi::IPA_EVENT_SIGNAL_ISP_PREPARE:" << " Bayer buffer id: " << bayerId << " Embedded buffer id: " << embeddedId; - op.operation = RPI_IPA_EVENT_SIGNAL_ISP_PREPARE; - op.data = { RPiBufferMask::EMBEDDED_DATA | embeddedId, - RPiBufferMask::BAYER_DATA | bayerId }; + op.operation = RPi::IPA_EVENT_SIGNAL_ISP_PREPARE; + op.data = { RPi::BufferMask::EMBEDDED_DATA | embeddedId, + RPi::BufferMask::BAYER_DATA | bayerId }; ipa_->processEvent(op); } diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp index 3ee859e9..1a42cc17 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp @@ -70,7 +70,7 @@ int Stream::getBufferId(FrameBuffer *buffer) const void Stream::setExternalBuffer(FrameBuffer *buffer) { - bufferMap_.emplace(RPiBufferMask::EXTERNAL_BUFFER | id_.get(), buffer); + bufferMap_.emplace(RPi::BufferMask::EXTERNAL_BUFFER | id_.get(), buffer); } void Stream::removeExternalBuffer(FrameBuffer *buffer) @@ -78,7 +78,7 @@ void Stream::removeExternalBuffer(FrameBuffer *buffer) int id = getBufferId(buffer); /* Ensure we have this buffer in the stream, and it is marked external. */ - ASSERT(id != -1 && (id & RPiBufferMask::EXTERNAL_BUFFER)); + ASSERT(id != -1 && (id & RPi::BufferMask::EXTERNAL_BUFFER)); bufferMap_.erase(id); } diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.h b/src/libcamera/pipeline/raspberrypi/rpi_stream.h index cb097e1c..0b502f64 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.h +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.h @@ -31,13 +31,13 @@ class Stream : public libcamera::Stream { public: Stream() - : id_(RPiBufferMask::ID) + : id_(RPi::BufferMask::ID) { } Stream(const char *name, MediaEntity *dev, bool importOnly = false) : external_(false), importOnly_(importOnly), name_(name), - dev_(std::make_unique(dev)), id_(RPiBufferMask::ID) + dev_(std::make_unique(dev)), id_(RPi::BufferMask::ID) { } From patchwork Tue Sep 22 09:50:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 9696 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 02E74C3B5B for ; Tue, 22 Sep 2020 09:50:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C45E862FDC; Tue, 22 Sep 2020 11:50:37 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="d5DK9dus"; dkim-atps=neutral Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A571362FD4 for ; Tue, 22 Sep 2020 11:50:34 +0200 (CEST) Received: by mail-wr1-x434.google.com with SMTP id a17so16297686wrn.6 for ; Tue, 22 Sep 2020 02:50:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gtU0D6plBgHfabQmiYHoT2tclirF+QqpL/t+JMyMUoU=; b=d5DK9dusIW+tcwby4YpFFmE5kyheVqfZNnuS7fJDBT9zXVudFqbg8MWE9bcx6k/Wjk D2Su/TYaGNYzkyySE0aE7NrLb+/1pmSujuRgYZqsIpEjLiTE8Q1SpBZpac1d7MQLaPec qUagh/So6QBvj2hKAnvemzkXwQVvvbiarUIzYsYx8vRHYh7yfcmdvoThB5eW+1RhBFRl 5bdGELZWiXgGUikW3Eieus8yb6bX+MSptglN1Luc3rYatX1OuhgU1j0SaeCNc9u1cYfa 3yFjsz1TSzrXS+t9kl36sgjByzijNQemDR1gzlsAPbIylaSsnNb3HIv5o1BENzligLLd IqZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gtU0D6plBgHfabQmiYHoT2tclirF+QqpL/t+JMyMUoU=; b=LcHHCLpdEMOO0RuW4CdvD3FJL+eKpfqWxs4fXsAGzWRQLVCcnHf39PgtmF+ERkd7jH y9+OpoPKRcH+gHc9I6IolLMag4WQA6O8S7xuy598Whynf0zGFPQYnhzlj3QUcX0UtrcG LSURcvrWaFObTAPszPrGHfBzQ/glO8+HSgvT3hZmX7c3enC3mVL1oqvfNOpBM55aG2x8 +IejtYLjPxF6U2pHDztW0Z8cP/nIhg5axfSb6aYZqXh4y+KLeSvj+Sbn1WU4HPerl3yb 931AWkaY1BZCkWjCe4cpifOfBD1knE7MWa/lWjbiGGbe4f5KGCIiw/VNAXFh0pRNlQpz 7zKw== X-Gm-Message-State: AOAM531YoFxz0qd6nmpUfaNx7QJoa6CwP9clZWceaxrJJzkJGUR7RP6Y SQ1GS28w0GWW03uHOOMe0X4oUNQl7/XJ4g== X-Google-Smtp-Source: ABdhPJwSe1yZns/kJ3gjNuDefeUt41Hp/W33pBDos5fslc5tf9+nFJVYZD0OGV5pZ0rPc5JuFZ7jiA== X-Received: by 2002:adf:f34a:: with SMTP id e10mr4325312wrp.91.1600768233447; Tue, 22 Sep 2020 02:50:33 -0700 (PDT) Received: from naushir-VirtualBox.pitowers.org ([2a00:1098:3142:14:a00:27ff:fe4d:f6a2]) by smtp.gmail.com with ESMTPSA id h204sm3776187wmf.35.2020.09.22.02.50.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 02:50:32 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 22 Sep 2020 10:50:17 +0100 Message-Id: <20200922095018.68434-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200922095018.68434-1-naush@raspberrypi.com> References: <20200922095018.68434-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/4] ipa: raspberrypi: Rename the controller namespace from Rpi to RpiController 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" This avoids a namespace clash with the RPi namespace used by the ipa and pipeline handlers, and cleans up the syntax slightly. There are no functional changes in this commit. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/ipa/raspberrypi/cam_helper.cpp | 2 +- src/ipa/raspberrypi/cam_helper.hpp | 2 +- src/ipa/raspberrypi/cam_helper_imx219.cpp | 2 +- src/ipa/raspberrypi/cam_helper_imx477.cpp | 2 +- src/ipa/raspberrypi/cam_helper_ov5647.cpp | 2 +- .../raspberrypi/controller/agc_algorithm.hpp | 4 +- src/ipa/raspberrypi/controller/algorithm.cpp | 4 +- src/ipa/raspberrypi/controller/algorithm.hpp | 4 +- .../raspberrypi/controller/awb_algorithm.hpp | 4 +- .../raspberrypi/controller/ccm_algorithm.hpp | 4 +- .../controller/contrast_algorithm.hpp | 4 +- src/ipa/raspberrypi/controller/controller.cpp | 2 +- src/ipa/raspberrypi/controller/controller.hpp | 4 +- src/ipa/raspberrypi/controller/histogram.cpp | 2 +- src/ipa/raspberrypi/controller/histogram.hpp | 4 +- src/ipa/raspberrypi/controller/metadata.hpp | 4 +- src/ipa/raspberrypi/controller/pwl.cpp | 2 +- src/ipa/raspberrypi/controller/pwl.hpp | 4 +- src/ipa/raspberrypi/controller/rpi/agc.cpp | 2 +- src/ipa/raspberrypi/controller/rpi/agc.hpp | 4 +- src/ipa/raspberrypi/controller/rpi/alsc.cpp | 2 +- src/ipa/raspberrypi/controller/rpi/alsc.hpp | 4 +- src/ipa/raspberrypi/controller/rpi/awb.cpp | 2 +- src/ipa/raspberrypi/controller/rpi/awb.hpp | 4 +- .../controller/rpi/black_level.cpp | 2 +- .../controller/rpi/black_level.hpp | 4 +- src/ipa/raspberrypi/controller/rpi/ccm.cpp | 2 +- src/ipa/raspberrypi/controller/rpi/ccm.hpp | 4 +- .../raspberrypi/controller/rpi/contrast.cpp | 2 +- .../raspberrypi/controller/rpi/contrast.hpp | 4 +- src/ipa/raspberrypi/controller/rpi/dpc.cpp | 2 +- src/ipa/raspberrypi/controller/rpi/dpc.hpp | 4 +- src/ipa/raspberrypi/controller/rpi/focus.cpp | 2 +- src/ipa/raspberrypi/controller/rpi/focus.hpp | 4 +- src/ipa/raspberrypi/controller/rpi/geq.cpp | 2 +- src/ipa/raspberrypi/controller/rpi/geq.hpp | 4 +- src/ipa/raspberrypi/controller/rpi/lux.cpp | 2 +- src/ipa/raspberrypi/controller/rpi/lux.hpp | 4 +- src/ipa/raspberrypi/controller/rpi/noise.cpp | 2 +- src/ipa/raspberrypi/controller/rpi/noise.hpp | 4 +- src/ipa/raspberrypi/controller/rpi/sdn.cpp | 2 +- src/ipa/raspberrypi/controller/rpi/sdn.hpp | 4 +- .../raspberrypi/controller/rpi/sharpen.cpp | 2 +- .../raspberrypi/controller/rpi/sharpen.hpp | 4 +- .../controller/sharpen_algorithm.hpp | 4 +- src/ipa/raspberrypi/md_parser.cpp | 2 +- src/ipa/raspberrypi/md_parser.hpp | 2 +- src/ipa/raspberrypi/md_parser_rpi.cpp | 2 +- src/ipa/raspberrypi/md_parser_rpi.hpp | 2 +- src/ipa/raspberrypi/raspberrypi.cpp | 52 +++++++++---------- 50 files changed, 99 insertions(+), 99 deletions(-) diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp index b1343eb2..c8ac3232 100644 --- a/src/ipa/raspberrypi/cam_helper.cpp +++ b/src/ipa/raspberrypi/cam_helper.cpp @@ -16,7 +16,7 @@ #include "cam_helper.hpp" #include "md_parser.hpp" -using namespace RPi; +using namespace RPiController; static std::map cam_helpers; diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp index 97ce3e92..044c2866 100644 --- a/src/ipa/raspberrypi/cam_helper.hpp +++ b/src/ipa/raspberrypi/cam_helper.hpp @@ -13,7 +13,7 @@ #include "libcamera/internal/v4l2_videodevice.h" -namespace RPi { +namespace RPiController { // The CamHelper class provides a number of facilities that anyone trying // trying to drive a camera will need to know, but which are not provided by diff --git a/src/ipa/raspberrypi/cam_helper_imx219.cpp b/src/ipa/raspberrypi/cam_helper_imx219.cpp index 1b9ce382..db8ab879 100644 --- a/src/ipa/raspberrypi/cam_helper_imx219.cpp +++ b/src/ipa/raspberrypi/cam_helper_imx219.cpp @@ -23,7 +23,7 @@ #include "md_parser_rpi.hpp" #endif -using namespace RPi; +using namespace RPiController; /* Metadata parser implementation specific to Sony IMX219 sensors. */ diff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp index a53b47c0..0e896ac7 100644 --- a/src/ipa/raspberrypi/cam_helper_imx477.cpp +++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp @@ -13,7 +13,7 @@ #include "cam_helper.hpp" #include "md_parser.hpp" -using namespace RPi; +using namespace RPiController; /* Metadata parser implementation specific to Sony IMX477 sensors. */ diff --git a/src/ipa/raspberrypi/cam_helper_ov5647.cpp b/src/ipa/raspberrypi/cam_helper_ov5647.cpp index 3dbcb164..dc5d8275 100644 --- a/src/ipa/raspberrypi/cam_helper_ov5647.cpp +++ b/src/ipa/raspberrypi/cam_helper_ov5647.cpp @@ -10,7 +10,7 @@ #include "cam_helper.hpp" #include "md_parser_rpi.hpp" -using namespace RPi; +using namespace RPiController; class CamHelperOv5647 : public CamHelper { diff --git a/src/ipa/raspberrypi/controller/agc_algorithm.hpp b/src/ipa/raspberrypi/controller/agc_algorithm.hpp index f29bb3ac..b4ea54fb 100644 --- a/src/ipa/raspberrypi/controller/agc_algorithm.hpp +++ b/src/ipa/raspberrypi/controller/agc_algorithm.hpp @@ -8,7 +8,7 @@ #include "algorithm.hpp" -namespace RPi { +namespace RPiController { class AgcAlgorithm : public Algorithm { @@ -25,4 +25,4 @@ public: SetConstraintMode(std::string const &contraint_mode_name) = 0; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/algorithm.cpp b/src/ipa/raspberrypi/controller/algorithm.cpp index 1b80e296..43ad0a2b 100644 --- a/src/ipa/raspberrypi/controller/algorithm.cpp +++ b/src/ipa/raspberrypi/controller/algorithm.cpp @@ -7,7 +7,7 @@ #include "algorithm.hpp" -using namespace RPi; +using namespace RPiController; void Algorithm::Read([[maybe_unused]] boost::property_tree::ptree const ¶ms) { @@ -32,7 +32,7 @@ void Algorithm::Process([[maybe_unused]] StatisticsPtr &stats, // For registering algorithms with the system: static std::map algorithms; -std::map const &RPi::GetAlgorithms() +std::map const &RPiController::GetAlgorithms() { return algorithms; } diff --git a/src/ipa/raspberrypi/controller/algorithm.hpp b/src/ipa/raspberrypi/controller/algorithm.hpp index 187c50c6..6196b2f9 100644 --- a/src/ipa/raspberrypi/controller/algorithm.hpp +++ b/src/ipa/raspberrypi/controller/algorithm.hpp @@ -19,7 +19,7 @@ #include -namespace RPi { +namespace RPiController { // This defines the basic interface for all control algorithms. @@ -59,4 +59,4 @@ struct RegisterAlgorithm { }; std::map const &GetAlgorithms(); -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/awb_algorithm.hpp b/src/ipa/raspberrypi/controller/awb_algorithm.hpp index 22508ddd..5be0c9f4 100644 --- a/src/ipa/raspberrypi/controller/awb_algorithm.hpp +++ b/src/ipa/raspberrypi/controller/awb_algorithm.hpp @@ -8,7 +8,7 @@ #include "algorithm.hpp" -namespace RPi { +namespace RPiController { class AwbAlgorithm : public Algorithm { @@ -19,4 +19,4 @@ public: virtual void SetManualGains(double manual_r, double manual_b) = 0; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/ccm_algorithm.hpp b/src/ipa/raspberrypi/controller/ccm_algorithm.hpp index 21806cb0..33d0e30d 100644 --- a/src/ipa/raspberrypi/controller/ccm_algorithm.hpp +++ b/src/ipa/raspberrypi/controller/ccm_algorithm.hpp @@ -8,7 +8,7 @@ #include "algorithm.hpp" -namespace RPi { +namespace RPiController { class CcmAlgorithm : public Algorithm { @@ -18,4 +18,4 @@ public: virtual void SetSaturation(double saturation) = 0; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/contrast_algorithm.hpp b/src/ipa/raspberrypi/controller/contrast_algorithm.hpp index 9780322b..7f03bba5 100644 --- a/src/ipa/raspberrypi/controller/contrast_algorithm.hpp +++ b/src/ipa/raspberrypi/controller/contrast_algorithm.hpp @@ -8,7 +8,7 @@ #include "algorithm.hpp" -namespace RPi { +namespace RPiController { class ContrastAlgorithm : public Algorithm { @@ -19,4 +19,4 @@ public: virtual void SetContrast(double contrast) = 0; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/controller.cpp b/src/ipa/raspberrypi/controller/controller.cpp index 7c4b04fe..22461cc4 100644 --- a/src/ipa/raspberrypi/controller/controller.cpp +++ b/src/ipa/raspberrypi/controller/controller.cpp @@ -11,7 +11,7 @@ #include #include -using namespace RPi; +using namespace RPiController; Controller::Controller() : switch_mode_called_(false) {} diff --git a/src/ipa/raspberrypi/controller/controller.hpp b/src/ipa/raspberrypi/controller/controller.hpp index 6ba9412b..49b1a551 100644 --- a/src/ipa/raspberrypi/controller/controller.hpp +++ b/src/ipa/raspberrypi/controller/controller.hpp @@ -19,7 +19,7 @@ #include "device_status.h" #include "metadata.hpp" -namespace RPi { +namespace RPiController { class Algorithm; typedef std::unique_ptr AlgorithmPtr; @@ -51,4 +51,4 @@ protected: bool switch_mode_called_; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/histogram.cpp b/src/ipa/raspberrypi/controller/histogram.cpp index 103d3f60..9916b3ed 100644 --- a/src/ipa/raspberrypi/controller/histogram.cpp +++ b/src/ipa/raspberrypi/controller/histogram.cpp @@ -9,7 +9,7 @@ #include "histogram.hpp" -using namespace RPi; +using namespace RPiController; uint64_t Histogram::CumulativeFreq(double bin) const { diff --git a/src/ipa/raspberrypi/controller/histogram.hpp b/src/ipa/raspberrypi/controller/histogram.hpp index 06fc3aa7..90f5ac78 100644 --- a/src/ipa/raspberrypi/controller/histogram.hpp +++ b/src/ipa/raspberrypi/controller/histogram.hpp @@ -13,7 +13,7 @@ // A simple histogram class, for use in particular to find "quantiles" and // averages between "quantiles". -namespace RPi { +namespace RPiController { class Histogram { @@ -41,4 +41,4 @@ private: std::vector cumulative_; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/metadata.hpp b/src/ipa/raspberrypi/controller/metadata.hpp index 1d7624a0..f3a8dfab 100644 --- a/src/ipa/raspberrypi/controller/metadata.hpp +++ b/src/ipa/raspberrypi/controller/metadata.hpp @@ -15,7 +15,7 @@ #include -namespace RPi { +namespace RPiController { class Metadata { @@ -74,4 +74,4 @@ private: typedef std::shared_ptr MetadataPtr; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/pwl.cpp b/src/ipa/raspberrypi/controller/pwl.cpp index 7e11d8f3..aa134a1f 100644 --- a/src/ipa/raspberrypi/controller/pwl.cpp +++ b/src/ipa/raspberrypi/controller/pwl.cpp @@ -10,7 +10,7 @@ #include "pwl.hpp" -using namespace RPi; +using namespace RPiController; void Pwl::Read(boost::property_tree::ptree const ¶ms) { diff --git a/src/ipa/raspberrypi/controller/pwl.hpp b/src/ipa/raspberrypi/controller/pwl.hpp index bd7c7668..4f168551 100644 --- a/src/ipa/raspberrypi/controller/pwl.hpp +++ b/src/ipa/raspberrypi/controller/pwl.hpp @@ -11,7 +11,7 @@ #include -namespace RPi { +namespace RPiController { class Pwl { @@ -106,4 +106,4 @@ private: std::vector points_; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp index 3573f36b..df4d3647 100644 --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp @@ -18,7 +18,7 @@ #include "agc.hpp" -using namespace RPi; +using namespace RPiController; #define NAME "rpi.agc" diff --git a/src/ipa/raspberrypi/controller/rpi/agc.hpp b/src/ipa/raspberrypi/controller/rpi/agc.hpp index 9a7e89c1..ba7ae092 100644 --- a/src/ipa/raspberrypi/controller/rpi/agc.hpp +++ b/src/ipa/raspberrypi/controller/rpi/agc.hpp @@ -20,7 +20,7 @@ #define AGC_STATS_SIZE 15 -namespace RPi { +namespace RPiController { struct AgcMeteringMode { double weights[AGC_STATS_SIZE]; @@ -121,4 +121,4 @@ private: double fixed_analogue_gain_; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp index 0d0e0b0c..49e60b98 100644 --- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp +++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp @@ -11,7 +11,7 @@ // Raspberry Pi ALSC (Auto Lens Shading Correction) algorithm. -using namespace RPi; +using namespace RPiController; #define NAME "rpi.alsc" diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.hpp b/src/ipa/raspberrypi/controller/rpi/alsc.hpp index 95572af0..13d1ba54 100644 --- a/src/ipa/raspberrypi/controller/rpi/alsc.hpp +++ b/src/ipa/raspberrypi/controller/rpi/alsc.hpp @@ -13,7 +13,7 @@ #include "../algorithm.hpp" #include "../alsc_status.h" -namespace RPi { +namespace RPiController { // Algorithm to generate automagic LSC (Lens Shading Correction) tables. @@ -102,4 +102,4 @@ private: double lambda_b_[ALSC_CELLS_X * ALSC_CELLS_Y]; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp index a58fa11d..a5536e47 100644 --- a/src/ipa/raspberrypi/controller/rpi/awb.cpp +++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp @@ -10,7 +10,7 @@ #include "awb.hpp" -using namespace RPi; +using namespace RPiController; #define NAME "rpi.awb" diff --git a/src/ipa/raspberrypi/controller/rpi/awb.hpp b/src/ipa/raspberrypi/controller/rpi/awb.hpp index 36925252..9124d042 100644 --- a/src/ipa/raspberrypi/controller/rpi/awb.hpp +++ b/src/ipa/raspberrypi/controller/rpi/awb.hpp @@ -14,7 +14,7 @@ #include "../pwl.hpp" #include "../awb_status.h" -namespace RPi { +namespace RPiController { // Control algorithm to perform AWB calculations. @@ -175,4 +175,4 @@ static inline Awb::RGB operator*(Awb::RGB const &rgb, double d) return d * rgb; } -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/rpi/black_level.cpp b/src/ipa/raspberrypi/controller/rpi/black_level.cpp index 59c9f5a6..0629b77c 100644 --- a/src/ipa/raspberrypi/controller/rpi/black_level.cpp +++ b/src/ipa/raspberrypi/controller/rpi/black_level.cpp @@ -13,7 +13,7 @@ #include "black_level.hpp" -using namespace RPi; +using namespace RPiController; #define NAME "rpi.black_level" diff --git a/src/ipa/raspberrypi/controller/rpi/black_level.hpp b/src/ipa/raspberrypi/controller/rpi/black_level.hpp index 5d74c6da..65ec4d0e 100644 --- a/src/ipa/raspberrypi/controller/rpi/black_level.hpp +++ b/src/ipa/raspberrypi/controller/rpi/black_level.hpp @@ -11,7 +11,7 @@ // This is our implementation of the "black level algorithm". -namespace RPi { +namespace RPiController { class BlackLevel : public Algorithm { @@ -27,4 +27,4 @@ private: double black_level_b_; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/rpi/ccm.cpp b/src/ipa/raspberrypi/controller/rpi/ccm.cpp index 327cb71c..a8a2caff 100644 --- a/src/ipa/raspberrypi/controller/rpi/ccm.cpp +++ b/src/ipa/raspberrypi/controller/rpi/ccm.cpp @@ -13,7 +13,7 @@ #include "ccm.hpp" -using namespace RPi; +using namespace RPiController; // This algorithm selects a CCM (Colour Correction Matrix) according to the // colour temperature estimated by AWB (interpolating between known matricies as diff --git a/src/ipa/raspberrypi/controller/rpi/ccm.hpp b/src/ipa/raspberrypi/controller/rpi/ccm.hpp index f6f4dee1..fcf077e7 100644 --- a/src/ipa/raspberrypi/controller/rpi/ccm.hpp +++ b/src/ipa/raspberrypi/controller/rpi/ccm.hpp @@ -12,7 +12,7 @@ #include "../ccm_algorithm.hpp" #include "../pwl.hpp" -namespace RPi { +namespace RPiController { // Algorithm to calculate colour matrix. Should be placed after AWB. @@ -73,4 +73,4 @@ private: std::atomic saturation_; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/rpi/contrast.cpp b/src/ipa/raspberrypi/controller/rpi/contrast.cpp index c8d9ab61..103153db 100644 --- a/src/ipa/raspberrypi/controller/rpi/contrast.cpp +++ b/src/ipa/raspberrypi/controller/rpi/contrast.cpp @@ -11,7 +11,7 @@ #include "contrast.hpp" -using namespace RPi; +using namespace RPiController; // This is a very simple control algorithm which simply retrieves the results of // AGC and AWB via their "status" metadata, and applies digital gain to the diff --git a/src/ipa/raspberrypi/controller/rpi/contrast.hpp b/src/ipa/raspberrypi/controller/rpi/contrast.hpp index 2e38a762..6836f181 100644 --- a/src/ipa/raspberrypi/controller/rpi/contrast.hpp +++ b/src/ipa/raspberrypi/controller/rpi/contrast.hpp @@ -12,7 +12,7 @@ #include "../contrast_algorithm.hpp" #include "../pwl.hpp" -namespace RPi { +namespace RPiController { // Back End algorithm to appaly correct digital gain. Should be placed after // Back End AWB. @@ -48,4 +48,4 @@ private: std::mutex mutex_; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/rpi/dpc.cpp b/src/ipa/raspberrypi/controller/rpi/dpc.cpp index d31fae97..348e1609 100644 --- a/src/ipa/raspberrypi/controller/rpi/dpc.cpp +++ b/src/ipa/raspberrypi/controller/rpi/dpc.cpp @@ -8,7 +8,7 @@ #include "../logging.hpp" #include "dpc.hpp" -using namespace RPi; +using namespace RPiController; // We use the lux status so that we can apply stronger settings in darkness (if // necessary). diff --git a/src/ipa/raspberrypi/controller/rpi/dpc.hpp b/src/ipa/raspberrypi/controller/rpi/dpc.hpp index 9fb72867..d90285c4 100644 --- a/src/ipa/raspberrypi/controller/rpi/dpc.hpp +++ b/src/ipa/raspberrypi/controller/rpi/dpc.hpp @@ -9,7 +9,7 @@ #include "../algorithm.hpp" #include "../dpc_status.h" -namespace RPi { +namespace RPiController { // Back End algorithm to apply appropriate GEQ settings. @@ -29,4 +29,4 @@ private: DpcConfig config_; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/rpi/focus.cpp b/src/ipa/raspberrypi/controller/rpi/focus.cpp index ffe44362..bab4406f 100644 --- a/src/ipa/raspberrypi/controller/rpi/focus.cpp +++ b/src/ipa/raspberrypi/controller/rpi/focus.cpp @@ -11,7 +11,7 @@ #include "../focus_status.h" #include "focus.hpp" -using namespace RPi; +using namespace RPiController; using namespace libcamera; LOG_DEFINE_CATEGORY(RPiFocus) diff --git a/src/ipa/raspberrypi/controller/rpi/focus.hpp b/src/ipa/raspberrypi/controller/rpi/focus.hpp index a9756ea7..131b1d0f 100644 --- a/src/ipa/raspberrypi/controller/rpi/focus.hpp +++ b/src/ipa/raspberrypi/controller/rpi/focus.hpp @@ -15,7 +15,7 @@ * control. */ -namespace RPi { +namespace RPiController { class Focus : public Algorithm { @@ -25,4 +25,4 @@ public: void Process(StatisticsPtr &stats, Metadata *image_metadata) override; }; -} /* namespace RPi */ +} /* namespace RPiController */ diff --git a/src/ipa/raspberrypi/controller/rpi/geq.cpp b/src/ipa/raspberrypi/controller/rpi/geq.cpp index ee0cb95d..b6c98414 100644 --- a/src/ipa/raspberrypi/controller/rpi/geq.cpp +++ b/src/ipa/raspberrypi/controller/rpi/geq.cpp @@ -12,7 +12,7 @@ #include "geq.hpp" -using namespace RPi; +using namespace RPiController; // We use the lux status so that we can apply stronger settings in darkness (if // necessary). diff --git a/src/ipa/raspberrypi/controller/rpi/geq.hpp b/src/ipa/raspberrypi/controller/rpi/geq.hpp index 7d4bd38d..8ba3046b 100644 --- a/src/ipa/raspberrypi/controller/rpi/geq.hpp +++ b/src/ipa/raspberrypi/controller/rpi/geq.hpp @@ -9,7 +9,7 @@ #include "../algorithm.hpp" #include "../geq_status.h" -namespace RPi { +namespace RPiController { // Back End algorithm to apply appropriate GEQ settings. @@ -31,4 +31,4 @@ private: GeqConfig config_; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/rpi/lux.cpp b/src/ipa/raspberrypi/controller/rpi/lux.cpp index 154db153..5acd49a0 100644 --- a/src/ipa/raspberrypi/controller/rpi/lux.cpp +++ b/src/ipa/raspberrypi/controller/rpi/lux.cpp @@ -13,7 +13,7 @@ #include "lux.hpp" -using namespace RPi; +using namespace RPiController; #define NAME "rpi.lux" diff --git a/src/ipa/raspberrypi/controller/rpi/lux.hpp b/src/ipa/raspberrypi/controller/rpi/lux.hpp index eb935409..7b6c7258 100644 --- a/src/ipa/raspberrypi/controller/rpi/lux.hpp +++ b/src/ipa/raspberrypi/controller/rpi/lux.hpp @@ -14,7 +14,7 @@ // This is our implementation of the "lux control algorithm". -namespace RPi { +namespace RPiController { class Lux : public Algorithm { @@ -39,4 +39,4 @@ private: std::mutex mutex_; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/rpi/noise.cpp b/src/ipa/raspberrypi/controller/rpi/noise.cpp index 1b84ecb0..9e9eaf1b 100644 --- a/src/ipa/raspberrypi/controller/rpi/noise.cpp +++ b/src/ipa/raspberrypi/controller/rpi/noise.cpp @@ -13,7 +13,7 @@ #include "noise.hpp" -using namespace RPi; +using namespace RPiController; #define NAME "rpi.noise" diff --git a/src/ipa/raspberrypi/controller/rpi/noise.hpp b/src/ipa/raspberrypi/controller/rpi/noise.hpp index 25bf1885..6f6e0be9 100644 --- a/src/ipa/raspberrypi/controller/rpi/noise.hpp +++ b/src/ipa/raspberrypi/controller/rpi/noise.hpp @@ -11,7 +11,7 @@ // This is our implementation of the "noise algorithm". -namespace RPi { +namespace RPiController { class Noise : public Algorithm { @@ -29,4 +29,4 @@ private: std::atomic mode_factor_; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/rpi/sdn.cpp b/src/ipa/raspberrypi/controller/rpi/sdn.cpp index 28d9d983..aa82830b 100644 --- a/src/ipa/raspberrypi/controller/rpi/sdn.cpp +++ b/src/ipa/raspberrypi/controller/rpi/sdn.cpp @@ -10,7 +10,7 @@ #include "sdn.hpp" -using namespace RPi; +using namespace RPiController; // Calculate settings for the spatial denoise block using the noise profile in // the image metadata. diff --git a/src/ipa/raspberrypi/controller/rpi/sdn.hpp b/src/ipa/raspberrypi/controller/rpi/sdn.hpp index d48aab7e..486c000d 100644 --- a/src/ipa/raspberrypi/controller/rpi/sdn.hpp +++ b/src/ipa/raspberrypi/controller/rpi/sdn.hpp @@ -8,7 +8,7 @@ #include "../algorithm.hpp" -namespace RPi { +namespace RPiController { // Algorithm to calculate correct spatial denoise (SDN) settings. @@ -26,4 +26,4 @@ private: double strength_; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/rpi/sharpen.cpp b/src/ipa/raspberrypi/controller/rpi/sharpen.cpp index 356c1058..c953a7d9 100644 --- a/src/ipa/raspberrypi/controller/rpi/sharpen.cpp +++ b/src/ipa/raspberrypi/controller/rpi/sharpen.cpp @@ -12,7 +12,7 @@ #include "sharpen.hpp" -using namespace RPi; +using namespace RPiController; #define NAME "rpi.sharpen" diff --git a/src/ipa/raspberrypi/controller/rpi/sharpen.hpp b/src/ipa/raspberrypi/controller/rpi/sharpen.hpp index 568521b9..13a076a8 100644 --- a/src/ipa/raspberrypi/controller/rpi/sharpen.hpp +++ b/src/ipa/raspberrypi/controller/rpi/sharpen.hpp @@ -11,7 +11,7 @@ // This is our implementation of the "sharpen algorithm". -namespace RPi { +namespace RPiController { class Sharpen : public SharpenAlgorithm { @@ -31,4 +31,4 @@ private: double user_strength_; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/sharpen_algorithm.hpp b/src/ipa/raspberrypi/controller/sharpen_algorithm.hpp index 3b27a745..ca800308 100644 --- a/src/ipa/raspberrypi/controller/sharpen_algorithm.hpp +++ b/src/ipa/raspberrypi/controller/sharpen_algorithm.hpp @@ -8,7 +8,7 @@ #include "algorithm.hpp" -namespace RPi { +namespace RPiController { class SharpenAlgorithm : public Algorithm { @@ -18,4 +18,4 @@ public: virtual void SetStrength(double strength) = 0; }; -} // namespace RPi +} // namespace RPiController diff --git a/src/ipa/raspberrypi/md_parser.cpp b/src/ipa/raspberrypi/md_parser.cpp index ca809aa2..d82c102c 100644 --- a/src/ipa/raspberrypi/md_parser.cpp +++ b/src/ipa/raspberrypi/md_parser.cpp @@ -11,7 +11,7 @@ #include "md_parser.hpp" -using namespace RPi; +using namespace RPiController; // This function goes through the embedded data to find the offsets (not // values!), in the data block, where the values of the given registers can diff --git a/src/ipa/raspberrypi/md_parser.hpp b/src/ipa/raspberrypi/md_parser.hpp index 70d054b2..c9db62c0 100644 --- a/src/ipa/raspberrypi/md_parser.hpp +++ b/src/ipa/raspberrypi/md_parser.hpp @@ -50,7 +50,7 @@ parser->Reset(); before calling Parse again. */ -namespace RPi { +namespace RPiController { // Abstract base class from which other metadata parsers are derived. diff --git a/src/ipa/raspberrypi/md_parser_rpi.cpp b/src/ipa/raspberrypi/md_parser_rpi.cpp index a42b28f7..2b0bcfc5 100644 --- a/src/ipa/raspberrypi/md_parser_rpi.cpp +++ b/src/ipa/raspberrypi/md_parser_rpi.cpp @@ -9,7 +9,7 @@ #include "md_parser_rpi.hpp" -using namespace RPi; +using namespace RPiController; MdParserRPi::MdParserRPi() { diff --git a/src/ipa/raspberrypi/md_parser_rpi.hpp b/src/ipa/raspberrypi/md_parser_rpi.hpp index 1fa334f4..52f54f00 100644 --- a/src/ipa/raspberrypi/md_parser_rpi.hpp +++ b/src/ipa/raspberrypi/md_parser_rpi.hpp @@ -8,7 +8,7 @@ #include "md_parser.hpp" -namespace RPi { +namespace RPiController { class MdParserRPi : public MdParser { diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 28f81824..0c0dc743 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -125,10 +125,10 @@ private: CameraMode lastMode_; /* Raspberry Pi controller specific defines. */ - std::unique_ptr<::RPi::CamHelper> helper_; - ::RPi::Controller controller_; + std::unique_ptr helper_; + RPiController::Controller controller_; bool controllerInit_; - ::RPi::Metadata rpiMetadata_; + RPiController::Metadata rpiMetadata_; /* * We count frames to decide if the frame must be hidden (e.g. from @@ -211,7 +211,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, */ std::string cameraName(sensorInfo.model); if (!helper_) { - helper_ = std::unique_ptr<::RPi::CamHelper>(::RPi::CamHelper::Create(cameraName)); + helper_ = std::unique_ptr(RPiController::CamHelper::Create(cameraName)); /* * Pass out the sensor config to the pipeline handler in order * to setup the staggered writer class. @@ -268,7 +268,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, agcStatus.analogue_gain = DEFAULT_ANALOGUE_GAIN; } - ::RPi::Metadata metadata; + RPiController::Metadata metadata; controller_.SwitchMode(mode_, &metadata); /* SwitchMode may supply updated exposure/gain values to use. */ @@ -391,7 +391,7 @@ void IPARPi::processEvent(const IPAOperationData &event) void IPARPi::reportMetadata() { - std::unique_lock<::RPi::Metadata> lock(rpiMetadata_); + std::unique_lock lock(rpiMetadata_); /* * Certain information about the current frame and how it will be @@ -496,7 +496,7 @@ void IPARPi::queueRequest(const ControlList &controls) switch (ctrl.first) { case controls::AE_ENABLE: { - ::RPi::Algorithm *agc = controller_.GetAlgorithm("agc"); + RPiController::Algorithm *agc = controller_.GetAlgorithm("agc"); ASSERT(agc); if (ctrl.second.get() == false) agc->Pause(); @@ -508,7 +508,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::EXPOSURE_TIME: { - ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( + RPiController::AgcAlgorithm *agc = dynamic_cast( controller_.GetAlgorithm("agc")); ASSERT(agc); /* This expects units of micro-seconds. */ @@ -522,7 +522,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::ANALOGUE_GAIN: { - ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( + RPiController::AgcAlgorithm *agc = dynamic_cast( controller_.GetAlgorithm("agc")); ASSERT(agc); agc->SetFixedAnalogueGain(ctrl.second.get()); @@ -536,7 +536,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AE_METERING_MODE: { - ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( + RPiController::AgcAlgorithm *agc = dynamic_cast( controller_.GetAlgorithm("agc")); ASSERT(agc); @@ -552,7 +552,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AE_CONSTRAINT_MODE: { - ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( + RPiController::AgcAlgorithm *agc = dynamic_cast( controller_.GetAlgorithm("agc")); ASSERT(agc); @@ -568,7 +568,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AE_EXPOSURE_MODE: { - ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( + RPiController::AgcAlgorithm *agc = dynamic_cast( controller_.GetAlgorithm("agc")); ASSERT(agc); @@ -584,7 +584,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::EXPOSURE_VALUE: { - ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( + RPiController::AgcAlgorithm *agc = dynamic_cast( controller_.GetAlgorithm("agc")); ASSERT(agc); @@ -600,7 +600,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AWB_ENABLE: { - ::RPi::Algorithm *awb = controller_.GetAlgorithm("awb"); + RPiController::Algorithm *awb = controller_.GetAlgorithm("awb"); ASSERT(awb); if (ctrl.second.get() == false) @@ -614,7 +614,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AWB_MODE: { - ::RPi::AwbAlgorithm *awb = dynamic_cast<::RPi::AwbAlgorithm *>( + RPiController::AwbAlgorithm *awb = dynamic_cast( controller_.GetAlgorithm("awb")); ASSERT(awb); @@ -631,7 +631,7 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::COLOUR_GAINS: { auto gains = ctrl.second.get>(); - ::RPi::AwbAlgorithm *awb = dynamic_cast<::RPi::AwbAlgorithm *>( + RPiController::AwbAlgorithm *awb = dynamic_cast( controller_.GetAlgorithm("awb")); ASSERT(awb); @@ -644,7 +644,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::BRIGHTNESS: { - ::RPi::ContrastAlgorithm *contrast = dynamic_cast<::RPi::ContrastAlgorithm *>( + RPiController::ContrastAlgorithm *contrast = dynamic_cast( controller_.GetAlgorithm("contrast")); ASSERT(contrast); @@ -655,7 +655,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::CONTRAST: { - ::RPi::ContrastAlgorithm *contrast = dynamic_cast<::RPi::ContrastAlgorithm *>( + RPiController::ContrastAlgorithm *contrast = dynamic_cast( controller_.GetAlgorithm("contrast")); ASSERT(contrast); @@ -666,7 +666,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::SATURATION: { - ::RPi::CcmAlgorithm *ccm = dynamic_cast<::RPi::CcmAlgorithm *>( + RPiController::CcmAlgorithm *ccm = dynamic_cast( controller_.GetAlgorithm("ccm")); ASSERT(ccm); @@ -677,7 +677,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::SHARPNESS: { - ::RPi::SharpenAlgorithm *sharpen = dynamic_cast<::RPi::SharpenAlgorithm *>( + RPiController::SharpenAlgorithm *sharpen = dynamic_cast( controller_.GetAlgorithm("sharpen")); ASSERT(sharpen); @@ -720,7 +720,7 @@ void IPARPi::prepareISP(unsigned int bufferId) controller_.Prepare(&rpiMetadata_); /* Lock the metadata buffer to avoid constant locks/unlocks. */ - std::unique_lock<::RPi::Metadata> lock(rpiMetadata_); + std::unique_lock lock(rpiMetadata_); AwbStatus *awbStatus = rpiMetadata_.GetLocked("awb.status"); if (awbStatus) @@ -781,18 +781,18 @@ bool IPARPi::parseEmbeddedData(unsigned int bufferId, struct DeviceStatus &devic int size = buffers_.find(bufferId)->second.planes()[0].length; helper_->Parser().SetBufferSize(size); - ::RPi::MdParser::Status status = helper_->Parser().Parse(it->second); - if (status != ::RPi::MdParser::Status::OK) { + RPiController::MdParser::Status status = helper_->Parser().Parse(it->second); + if (status != RPiController::MdParser::Status::OK) { LOG(IPARPI, Error) << "Embedded Buffer parsing failed, error " << status; } else { uint32_t exposure_lines, gain_code; - if (helper_->Parser().GetExposureLines(exposure_lines) != ::RPi::MdParser::Status::OK) { + if (helper_->Parser().GetExposureLines(exposure_lines) != RPiController::MdParser::Status::OK) { LOG(IPARPI, Error) << "Exposure time failed"; return false; } deviceStatus.shutter_speed = helper_->Exposure(exposure_lines); - if (helper_->Parser().GetGainCode(gain_code) != ::RPi::MdParser::Status::OK) { + if (helper_->Parser().GetGainCode(gain_code) != RPiController::MdParser::Status::OK) { LOG(IPARPI, Error) << "Gain failed"; return false; } @@ -815,7 +815,7 @@ void IPARPi::processStats(unsigned int bufferId) } bcm2835_isp_stats *stats = static_cast(it->second); - ::RPi::StatisticsPtr statistics = std::make_shared(*stats); + RPiController::StatisticsPtr statistics = std::make_shared(*stats); controller_.Process(statistics, &rpiMetadata_); struct AgcStatus agcStatus; From patchwork Tue Sep 22 09:50:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 9697 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 81EF3C3B5B for ; Tue, 22 Sep 2020 09:50:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3CC6062FD2; Tue, 22 Sep 2020 11:50:38 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="n75ciYk2"; dkim-atps=neutral Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3089262FAD for ; Tue, 22 Sep 2020 11:50:35 +0200 (CEST) Received: by mail-wr1-x42a.google.com with SMTP id c18so16322928wrm.9 for ; Tue, 22 Sep 2020 02:50:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2kvmZTp1lcP7EVgB+p8ftux8nQarryqK5aJ+Qp0MEN0=; b=n75ciYk2wljI78QOVZaHBiLpzJy/JBtcmUv/SOSl0tx7ipn7g3NAetkNP2W6H2nnmL 0kNDg4Zq5ukn40e4pYpLMwCcD/IdwN1COFotMH61SnWZzYVDhWJV0A9n7priRTIItGub J5AMAUd1eQmtx9TUvdjl2FtUo9U+EB8STcX+5M2gL3o72JcH82Zg4FuYGAJQ0ZhpZx3d xoAoeP2G+ZeQBtUTDOp+Dz3E49DISfVoyJLhwnWLwp/1zVyEbQNVHvs3IpKSeSvYwzcP Dj7xVNET08KY/wxjye+T1OdxFNY0Hgi2aQq5IiEOE0p3hs5r3unb7xrFcTptSNa3UbDs XMzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2kvmZTp1lcP7EVgB+p8ftux8nQarryqK5aJ+Qp0MEN0=; b=lve8QgvIQeMC676WIodfbJODAzSGnT//Gzeyd19HCWz7rDxpE6H4WzabScYJ75/uof gUljR7kH/evEF9NeB9lE/jRCTXf3F7AMnsPH5UfqfHHwK9xN9cB1YZFQFanf3HaaWwlN 2X0/0BxwZzWViSG0RPjgs0CfZUiftf7TxZeSf6TRq4zqjSuUExO/mTs8drvkmP6BAdOC jHQdLslWML8rVrqM2G8XVpq24OClWuqI9NRmShFBXVsLH5844JKExkji5VjOaABX1xYf CggnFBpqxfbdmdI/JHz6K9EUy/0TDg+bS6S0q/7TmypAoSumIG/YYnO7tO1Q/L11snNE OHOA== X-Gm-Message-State: AOAM5308fveO8ojjjhuIvsFOg4ELFVivxeP31OpB+DewcLEgaaPUVl38 B+47sn8DUna7aprtiQVGyAQtt9nELTGUeQ== X-Google-Smtp-Source: ABdhPJzkW8ue7pCGHpAtiTA0fwi3p0t5rruFJnTUKS7sLZWkhpTakcY9m4ge76S51y5xL57m+gs44A== X-Received: by 2002:a5d:5602:: with SMTP id l2mr4646289wrv.410.1600768234317; Tue, 22 Sep 2020 02:50:34 -0700 (PDT) Received: from naushir-VirtualBox.pitowers.org ([2a00:1098:3142:14:a00:27ff:fe4d:f6a2]) by smtp.gmail.com with ESMTPSA id h204sm3776187wmf.35.2020.09.22.02.50.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 02:50:33 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 22 Sep 2020 10:50:18 +0100 Message-Id: <20200922095018.68434-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200922095018.68434-1-naush@raspberrypi.com> References: <20200922095018.68434-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 4/4] ipa: raspberrypi: Tidy up variable names to be consistent 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" Change variable names to camel case to be consistent with the rest of the source files. Remove #define consts and replace with constexpr. There are no functional changes in this commit. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- include/libcamera/ipa/raspberrypi.h | 2 +- src/ipa/raspberrypi/raspberrypi.cpp | 178 +++++++++--------- .../pipeline/raspberrypi/raspberrypi.cpp | 2 +- 3 files changed, 91 insertions(+), 91 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index c9d4aa81..b3041591 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -41,7 +41,7 @@ enum BufferMask { }; /* Size of the LS grid allocation. */ -#define MAX_LS_GRID_SIZE (32 << 10) +static constexpr unsigned int MaxLsGridSize = 32 << 10; /* List of controls handled by the Raspberry Pi IPA */ static const ControlInfoMap Controls = { diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 0c0dc743..c240eae8 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -55,8 +55,8 @@ namespace libcamera { /* Configure the sensor with these values initially. */ -#define DEFAULT_ANALOGUE_GAIN 1.0 -#define DEFAULT_EXPOSURE_TIME 20000 +constexpr unsigned int DefaultAnalogueGain = 1.0; +constexpr unsigned int DefaultExposureTime = 20000; LOG_DEFINE_CATEGORY(IPARPI) @@ -65,7 +65,7 @@ class IPARPi : public IPAInterface public: IPARPi() : lastMode_({}), controller_(), controllerInit_(false), - frame_count_(0), check_count_(0), mistrust_count_(0), + frameCount_(0), checkCount_(0), mistrustCount_(0), lsTable_(nullptr) { } @@ -73,7 +73,7 @@ public: ~IPARPi() { if (lsTable_) - munmap(lsTable_, MAX_LS_GRID_SIZE); + munmap(lsTable_, RPi::MaxLsGridSize); } int init(const IPASettings &settings) override; @@ -108,13 +108,13 @@ private: void applySharpen(const struct SharpenStatus *sharpenStatus, ControlList &ctrls); void applyDPC(const struct DpcStatus *dpcStatus, ControlList &ctrls); void applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls); - void resampleTable(uint16_t dest[], double const src[12][16], int dest_w, int dest_h); + void resampleTable(uint16_t dest[], double const src[12][16], int destW, int destH); std::map buffers_; std::map buffersMemory_; - ControlInfoMap unicam_ctrls_; - ControlInfoMap isp_ctrls_; + ControlInfoMap unicamCtrls_; + ControlInfoMap ispCtrls_; ControlList libcameraMetadata_; /* IPA configuration. */ @@ -134,11 +134,11 @@ private: * We count frames to decide if the frame must be hidden (e.g. from * display) or mistrusted (i.e. not given to the control algos). */ - uint64_t frame_count_; + uint64_t frameCount_; /* For checking the sequencing of Prepare/Process calls. */ - uint64_t check_count_; + uint64_t checkCount_; /* How many frames we should avoid running control algos on. */ - unsigned int mistrust_count_; + unsigned int mistrustCount_; /* LS table allocation passed in from the pipeline handler. */ FileDescriptor lsTableHandle_; void *lsTable_; @@ -199,8 +199,8 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, result->operation = 0; - unicam_ctrls_ = entityControls.at(0); - isp_ctrls_ = entityControls.at(1); + unicamCtrls_ = entityControls.at(0); + ispCtrls_ = entityControls.at(1); /* Setup a metadata ControlList to output metadata. */ libcameraMetadata_ = ControlList(controls::controls); @@ -238,18 +238,18 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, *"mistrusted", which depends on whether this is a startup from cold, * or merely a mode switch in a running system. */ - frame_count_ = 0; - check_count_ = 0; - unsigned int drop_frame = 0; + frameCount_ = 0; + checkCount_ = 0; + unsigned int dropFrame = 0; if (controllerInit_) { - drop_frame = helper_->HideFramesModeSwitch(); - mistrust_count_ = helper_->MistrustFramesModeSwitch(); + dropFrame = helper_->HideFramesModeSwitch(); + mistrustCount_ = helper_->MistrustFramesModeSwitch(); } else { - drop_frame = helper_->HideFramesStartup(); - mistrust_count_ = helper_->MistrustFramesStartup(); + dropFrame = helper_->HideFramesStartup(); + mistrustCount_ = helper_->MistrustFramesStartup(); } - result->data.push_back(drop_frame); + result->data.push_back(dropFrame); result->operation |= RPi::IPA_CONFIG_DROP_FRAMES; struct AgcStatus agcStatus; @@ -264,8 +264,8 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, controllerInit_ = true; /* Supply initial values for gain and exposure. */ - agcStatus.shutter_time = DEFAULT_EXPOSURE_TIME; - agcStatus.analogue_gain = DEFAULT_ANALOGUE_GAIN; + agcStatus.shutter_time = DefaultExposureTime; + agcStatus.analogue_gain = DefaultAnalogueGain; } RPiController::Metadata metadata; @@ -274,7 +274,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, /* SwitchMode may supply updated exposure/gain values to use. */ metadata.Get("agc.status", agcStatus); if (agcStatus.shutter_time != 0.0 && agcStatus.analogue_gain != 0.0) { - ControlList ctrls(unicam_ctrls_); + ControlList ctrls(unicamCtrls_); applyAGC(&agcStatus, ctrls); result->controls.push_back(ctrls); @@ -287,14 +287,14 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, if (ipaConfig.operation & RPi::IPA_CONFIG_LS_TABLE) { /* Remove any previous table, if there was one. */ if (lsTable_) { - munmap(lsTable_, MAX_LS_GRID_SIZE); + munmap(lsTable_, RPi::MaxLsGridSize); lsTable_ = nullptr; } /* Map the LS table buffer into user space. */ lsTableHandle_ = FileDescriptor(ipaConfig.data[0]); if (lsTableHandle_.isValid()) { - lsTable_ = mmap(nullptr, MAX_LS_GRID_SIZE, PROT_READ | PROT_WRITE, + lsTable_ = mmap(nullptr, RPi::MaxLsGridSize, PROT_READ | PROT_WRITE, MAP_SHARED, lsTableHandle_.fd(), 0); if (lsTable_ == MAP_FAILED) { @@ -343,9 +343,9 @@ void IPARPi::processEvent(const IPAOperationData &event) case RPi::IPA_EVENT_SIGNAL_STAT_READY: { unsigned int bufferId = event.data[0]; - if (++check_count_ != frame_count_) /* assert here? */ + if (++checkCount_ != frameCount_) /* assert here? */ LOG(IPARPI, Error) << "WARNING: Prepare/Process mismatch!!!"; - if (frame_count_ > mistrust_count_) + if (frameCount_ > mistrustCount_) processStats(bufferId); reportMetadata(); @@ -368,7 +368,7 @@ void IPARPi::processEvent(const IPAOperationData &event) * they are "unreliable". */ prepareISP(embeddedbufferId); - frame_count_++; + frameCount_++; /* Ready to push the input buffer into the ISP. */ IPAOperationData op; @@ -713,7 +713,7 @@ void IPARPi::prepareISP(unsigned int bufferId) returnEmbeddedBuffer(bufferId); if (success) { - ControlList ctrls(isp_ctrls_); + ControlList ctrls(ispCtrls_); rpiMetadata_.Clear(); rpiMetadata_.Set("device.status", deviceStatus); @@ -785,19 +785,19 @@ bool IPARPi::parseEmbeddedData(unsigned int bufferId, struct DeviceStatus &devic if (status != RPiController::MdParser::Status::OK) { LOG(IPARPI, Error) << "Embedded Buffer parsing failed, error " << status; } else { - uint32_t exposure_lines, gain_code; - if (helper_->Parser().GetExposureLines(exposure_lines) != RPiController::MdParser::Status::OK) { + uint32_t exposureLines, gainCode; + if (helper_->Parser().GetExposureLines(exposureLines) != RPiController::MdParser::Status::OK) { LOG(IPARPI, Error) << "Exposure time failed"; return false; } - deviceStatus.shutter_speed = helper_->Exposure(exposure_lines); - if (helper_->Parser().GetGainCode(gain_code) != RPiController::MdParser::Status::OK) { + deviceStatus.shutter_speed = helper_->Exposure(exposureLines); + if (helper_->Parser().GetGainCode(gainCode) != RPiController::MdParser::Status::OK) { LOG(IPARPI, Error) << "Gain failed"; return false; } - deviceStatus.analogue_gain = helper_->Gain(gain_code); + deviceStatus.analogue_gain = helper_->Gain(gainCode); LOG(IPARPI, Debug) << "Metadata - Exposure : " << deviceStatus.shutter_speed << " Gain : " << deviceStatus.analogue_gain; @@ -820,7 +820,7 @@ void IPARPi::processStats(unsigned int bufferId) struct AgcStatus agcStatus; if (rpiMetadata_.Get("agc.status", agcStatus) == 0) { - ControlList ctrls(unicam_ctrls_); + ControlList ctrls(unicamCtrls_); applyAGC(&agcStatus, ctrls); IPAOperationData op; @@ -832,14 +832,14 @@ void IPARPi::processStats(unsigned int bufferId) void IPARPi::applyAWB(const struct AwbStatus *awbStatus, ControlList &ctrls) { - const auto gainR = isp_ctrls_.find(V4L2_CID_RED_BALANCE); - if (gainR == isp_ctrls_.end()) { + const auto gainR = ispCtrls_.find(V4L2_CID_RED_BALANCE); + if (gainR == ispCtrls_.end()) { LOG(IPARPI, Error) << "Can't find red gain control"; return; } - const auto gainB = isp_ctrls_.find(V4L2_CID_BLUE_BALANCE); - if (gainB == isp_ctrls_.end()) { + const auto gainB = ispCtrls_.find(V4L2_CID_BLUE_BALANCE); + if (gainB == ispCtrls_.end()) { LOG(IPARPI, Error) << "Can't find blue gain control"; return; } @@ -855,31 +855,31 @@ void IPARPi::applyAWB(const struct AwbStatus *awbStatus, ControlList &ctrls) void IPARPi::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls) { - int32_t gain_code = helper_->GainCode(agcStatus->analogue_gain); - int32_t exposure_lines = helper_->ExposureLines(agcStatus->shutter_time); + int32_t gainCode = helper_->GainCode(agcStatus->analogue_gain); + int32_t exposureLines = helper_->ExposureLines(agcStatus->shutter_time); - if (unicam_ctrls_.find(V4L2_CID_ANALOGUE_GAIN) == unicam_ctrls_.end()) { + if (unicamCtrls_.find(V4L2_CID_ANALOGUE_GAIN) == unicamCtrls_.end()) { LOG(IPARPI, Error) << "Can't find analogue gain control"; return; } - if (unicam_ctrls_.find(V4L2_CID_EXPOSURE) == unicam_ctrls_.end()) { + if (unicamCtrls_.find(V4L2_CID_EXPOSURE) == unicamCtrls_.end()) { LOG(IPARPI, Error) << "Can't find exposure control"; return; } LOG(IPARPI, Debug) << "Applying AGC Exposure: " << agcStatus->shutter_time - << " (Shutter lines: " << exposure_lines << ") Gain: " + << " (Shutter lines: " << exposureLines << ") Gain: " << agcStatus->analogue_gain << " (Gain Code: " - << gain_code << ")"; + << gainCode << ")"; - ctrls.set(V4L2_CID_ANALOGUE_GAIN, gain_code); - ctrls.set(V4L2_CID_EXPOSURE, exposure_lines); + ctrls.set(V4L2_CID_ANALOGUE_GAIN, gainCode); + ctrls.set(V4L2_CID_EXPOSURE, exposureLines); } void IPARPi::applyDG(const struct AgcStatus *dgStatus, ControlList &ctrls) { - if (isp_ctrls_.find(V4L2_CID_DIGITAL_GAIN) == isp_ctrls_.end()) { + if (ispCtrls_.find(V4L2_CID_DIGITAL_GAIN) == ispCtrls_.end()) { LOG(IPARPI, Error) << "Can't find digital gain control"; return; } @@ -890,7 +890,7 @@ void IPARPi::applyDG(const struct AgcStatus *dgStatus, ControlList &ctrls) void IPARPi::applyCCM(const struct CcmStatus *ccmStatus, ControlList &ctrls) { - if (isp_ctrls_.find(V4L2_CID_USER_BCM2835_ISP_CC_MATRIX) == isp_ctrls_.end()) { + if (ispCtrls_.find(V4L2_CID_USER_BCM2835_ISP_CC_MATRIX) == ispCtrls_.end()) { LOG(IPARPI, Error) << "Can't find CCM control"; return; } @@ -911,7 +911,7 @@ void IPARPi::applyCCM(const struct CcmStatus *ccmStatus, ControlList &ctrls) void IPARPi::applyGamma(const struct ContrastStatus *contrastStatus, ControlList &ctrls) { - if (isp_ctrls_.find(V4L2_CID_USER_BCM2835_ISP_GAMMA) == isp_ctrls_.end()) { + if (ispCtrls_.find(V4L2_CID_USER_BCM2835_ISP_GAMMA) == ispCtrls_.end()) { LOG(IPARPI, Error) << "Can't find Gamma control"; return; } @@ -930,7 +930,7 @@ void IPARPi::applyGamma(const struct ContrastStatus *contrastStatus, ControlList void IPARPi::applyBlackLevel(const struct BlackLevelStatus *blackLevelStatus, ControlList &ctrls) { - if (isp_ctrls_.find(V4L2_CID_USER_BCM2835_ISP_BLACK_LEVEL) == isp_ctrls_.end()) { + if (ispCtrls_.find(V4L2_CID_USER_BCM2835_ISP_BLACK_LEVEL) == ispCtrls_.end()) { LOG(IPARPI, Error) << "Can't find black level control"; return; } @@ -948,7 +948,7 @@ void IPARPi::applyBlackLevel(const struct BlackLevelStatus *blackLevelStatus, Co void IPARPi::applyGEQ(const struct GeqStatus *geqStatus, ControlList &ctrls) { - if (isp_ctrls_.find(V4L2_CID_USER_BCM2835_ISP_GEQ) == isp_ctrls_.end()) { + if (ispCtrls_.find(V4L2_CID_USER_BCM2835_ISP_GEQ) == ispCtrls_.end()) { LOG(IPARPI, Error) << "Can't find geq control"; return; } @@ -966,7 +966,7 @@ void IPARPi::applyGEQ(const struct GeqStatus *geqStatus, ControlList &ctrls) void IPARPi::applyDenoise(const struct SdnStatus *denoiseStatus, ControlList &ctrls) { - if (isp_ctrls_.find(V4L2_CID_USER_BCM2835_ISP_DENOISE) == isp_ctrls_.end()) { + if (ispCtrls_.find(V4L2_CID_USER_BCM2835_ISP_DENOISE) == ispCtrls_.end()) { LOG(IPARPI, Error) << "Can't find denoise control"; return; } @@ -986,7 +986,7 @@ void IPARPi::applyDenoise(const struct SdnStatus *denoiseStatus, ControlList &ct void IPARPi::applySharpen(const struct SharpenStatus *sharpenStatus, ControlList &ctrls) { - if (isp_ctrls_.find(V4L2_CID_USER_BCM2835_ISP_SHARPEN) == isp_ctrls_.end()) { + if (ispCtrls_.find(V4L2_CID_USER_BCM2835_ISP_SHARPEN) == ispCtrls_.end()) { LOG(IPARPI, Error) << "Can't find sharpen control"; return; } @@ -1007,7 +1007,7 @@ void IPARPi::applySharpen(const struct SharpenStatus *sharpenStatus, ControlList void IPARPi::applyDPC(const struct DpcStatus *dpcStatus, ControlList &ctrls) { - if (isp_ctrls_.find(V4L2_CID_USER_BCM2835_ISP_DPC) == isp_ctrls_.end()) { + if (ispCtrls_.find(V4L2_CID_USER_BCM2835_ISP_DPC) == ispCtrls_.end()) { LOG(IPARPI, Error) << "Can't find DPC control"; return; } @@ -1023,7 +1023,7 @@ void IPARPi::applyDPC(const struct DpcStatus *dpcStatus, ControlList &ctrls) void IPARPi::applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls) { - if (isp_ctrls_.find(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING) == isp_ctrls_.end()) { + if (ispCtrls_.find(V4L2_CID_USER_BCM2835_ISP_LENS_SHADING) == ispCtrls_.end()) { LOG(IPARPI, Error) << "Can't find LS control"; return; } @@ -1032,18 +1032,18 @@ void IPARPi::applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls) * Program lens shading tables into pipeline. * Choose smallest cell size that won't exceed 63x48 cells. */ - const int cell_sizes[] = { 16, 32, 64, 128, 256 }; - unsigned int num_cells = ARRAY_SIZE(cell_sizes); - unsigned int i, w, h, cell_size; - for (i = 0; i < num_cells; i++) { - cell_size = cell_sizes[i]; - w = (mode_.width + cell_size - 1) / cell_size; - h = (mode_.height + cell_size - 1) / cell_size; + const int cellSizes[] = { 16, 32, 64, 128, 256 }; + unsigned int numCells = ARRAY_SIZE(cellSizes); + unsigned int i, w, h, cellSize; + for (i = 0; i < numCells; i++) { + cellSize = cellSizes[i]; + w = (mode_.width + cellSize - 1) / cellSize; + h = (mode_.height + cellSize - 1) / cellSize; if (w < 64 && h <= 48) break; } - if (i == num_cells) { + if (i == numCells) { LOG(IPARPI, Error) << "Cannot find cell size"; return; } @@ -1052,7 +1052,7 @@ void IPARPi::applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls) w++, h++; bcm2835_isp_lens_shading ls = { .enabled = 1, - .grid_cell_size = cell_size, + .grid_cell_size = cellSize, .grid_width = w, .grid_stride = w, .grid_height = h, @@ -1062,7 +1062,7 @@ void IPARPi::applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls) .gain_format = GAIN_FORMAT_U4P10 }; - if (!lsTable_ || w * h * 4 * sizeof(uint16_t) > MAX_LS_GRID_SIZE) { + if (!lsTable_ || w * h * 4 * sizeof(uint16_t) > RPi::MaxLsGridSize) { LOG(IPARPI, Error) << "Do not have a correctly allocate lens shading table!"; return; } @@ -1083,41 +1083,41 @@ void IPARPi::applyLS(const struct AlscStatus *lsStatus, ControlList &ctrls) } /* - * Resamples a 16x12 table with central sampling to dest_w x dest_h with corner + * Resamples a 16x12 table with central sampling to destW x destH with corner * sampling. */ void IPARPi::resampleTable(uint16_t dest[], double const src[12][16], - int dest_w, int dest_h) + int destW, int destH) { /* * Precalculate and cache the x sampling locations and phases to * save recomputing them on every row. */ - assert(dest_w > 1 && dest_h > 1 && dest_w <= 64); - int x_lo[64], x_hi[64]; + assert(destW > 1 && destH > 1 && destW <= 64); + int xLo[64], xHi[64]; double xf[64]; - double x = -0.5, x_inc = 16.0 / (dest_w - 1); - for (int i = 0; i < dest_w; i++, x += x_inc) { - x_lo[i] = floor(x); - xf[i] = x - x_lo[i]; - x_hi[i] = x_lo[i] < 15 ? x_lo[i] + 1 : 15; - x_lo[i] = x_lo[i] > 0 ? x_lo[i] : 0; + double x = -0.5, xInc = 16.0 / (destW - 1); + for (int i = 0; i < destW; i++, x += xInc) { + xLo[i] = floor(x); + xf[i] = x - xLo[i]; + xHi[i] = xLo[i] < 15 ? xLo[i] + 1 : 15; + xLo[i] = xLo[i] > 0 ? xLo[i] : 0; } /* Now march over the output table generating the new values. */ - double y = -0.5, y_inc = 12.0 / (dest_h - 1); - for (int j = 0; j < dest_h; j++, y += y_inc) { - int y_lo = floor(y); - double yf = y - y_lo; - int y_hi = y_lo < 11 ? y_lo + 1 : 11; - y_lo = y_lo > 0 ? y_lo : 0; - double const *row_above = src[y_lo]; - double const *row_below = src[y_hi]; - for (int i = 0; i < dest_w; i++) { - double above = row_above[x_lo[i]] * (1 - xf[i]) - + row_above[x_hi[i]] * xf[i]; - double below = row_below[x_lo[i]] * (1 - xf[i]) - + row_below[x_hi[i]] * xf[i]; + double y = -0.5, yInc = 12.0 / (destH - 1); + for (int j = 0; j < destH; j++, y += yInc) { + int yLo = floor(y); + double yf = y - yLo; + int yHi = yLo < 11 ? yLo + 1 : 11; + yLo = yLo > 0 ? yLo : 0; + double const *rowAbove = src[yLo]; + double const *rowBelow = src[yHi]; + for (int i = 0; i < destW; i++) { + double above = rowAbove[xLo[i]] * (1 - xf[i]) + + rowAbove[xHi[i]] * xf[i]; + double below = rowBelow[xLo[i]] * (1 - xf[i]) + + rowBelow[xHi[i]] * xf[i]; int result = floor(1024 * (above * (1 - yf) + below * yf) + .5); *(dest++) = result > 16383 ? 16383 : result; /* want u4.10 */ } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 35dbe0fb..8d40b0ed 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1012,7 +1012,7 @@ int RPiCameraData::configureIPA() /* Allocate the lens shading table via dmaHeap and pass to the IPA. */ if (!lsTable_.isValid()) { - lsTable_ = dmaHeap_.alloc("ls_grid", MAX_LS_GRID_SIZE); + lsTable_ = dmaHeap_.alloc("ls_grid", RPi::MaxLsGridSize); if (!lsTable_.isValid()) return -ENOMEM;