From patchwork Tue Jul 26 12:45:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 16774 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 6E9A2C3275 for ; Tue, 26 Jul 2022 12:46:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 831B963317; Tue, 26 Jul 2022 14:45:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1658839559; bh=My4qxnyMZp0PwrV1myytSX52rkJbuun8Nf3Ub9QaA7o=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=m4k/Ntxld/sL1Sxyh8wqWTCirDLOKzoH5gM6g02lhiX7ARkv2qfIujZb7ev+lYAdJ TZHDmz6qvlkkjyzixzF3H/XCwjh+bUFBnNzxPJduvoLeAc47p1Cx2+DIHu6xHKZ4Ei eHUr6PpORCZNyQC4CrEnj16O/hAXI7AojdOTdrNM/nb7BAZxit0sfX2NV7t8ppvt0y aG99l9GFwO2QpHo5WHzEnNSetHYMO3jmsNA13a/HlmLXLIRNtjS9jHeE+27khzHPOG CLlwwNi0MvvcyMshDNoRJacakCwfD0cbLhQImCLYlf/iE7xgN/EhYfKl8XFmYIaKxA 2CMJSPpjd0MKQ== Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AED206330E for ; Tue, 26 Jul 2022 14:45:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="kbkMLOpP"; dkim-atps=neutral Received: by mail-wr1-x42d.google.com with SMTP id k12so2262121wrm.13 for ; Tue, 26 Jul 2022 05:45:56 -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=kKYwVgRcN08N55xcJHFdRUNxd+NLxWz9ywchhdW3jxM=; b=kbkMLOpPc58zrj15k5vdjnLZC8P/9c18X5LMYuqjCPYwSRzjZ8OGa0E9KUHAYKWrHM nMhT/OjbfbY5Vc4EhzgrgrVWNQBjp0dEtV9u+DVEahIvRIyiJnojlM9fqOYX80t59Iem 7Qicjtf7HWLidlVV5wSU/v/qjQDlXlwL99VEWyPaJUWYcRovYcMfoqXfYTKNzhBPyCjo aeA9OCUwpzNA4+uymJhh1tuHnt3xWhlP2C8xPhuUm2M0sOaLhn6nQk4lFdFK2FbCTdNJ LmlfJiEGyO2KLT2PwZV8ng9yniSVFFBmtoT+Keuoz1oEXZw1f+0VbiTwfVok7ZxWGRhA TADw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kKYwVgRcN08N55xcJHFdRUNxd+NLxWz9ywchhdW3jxM=; b=MfVRV+aK3JrEMfotPJDfwCc7cm4Z/EFZDHoi4pjjesQZ47YLbIoXNR7QLDMAKizRL1 4N0w4ihzVKFt2CCWcIj/2fICo9yhfCMBW4tAAtjYX5trd3DML6IMQLuQTZ23ccI1lM0r QlZi52qXZRQQgF5PD+jP68ZN9eVrhecbpFE7AotYFkqO6AcRlhIX0IOzgvlAwLde2RT7 tITlRjB22JC2Qz8oSwhYtJ4O+k+P5us7coRsqzk8hvYS28+LgtRKy1NN64Nv6AP1y7Xo ubgZNfUdStnOmkdvh/Wt2VM4kcfWR9Km/r5CaRv+RjlCX0aSl94WoDbpY30MNY/iP4gz PRdA== X-Gm-Message-State: AJIora+I9M5JFGQ9eR33soOK+89+s/uQfTtUP6Z2XIvmBmok/NKU9Eks llPniEe+JwFHXTqbsbT7u72q7jyXS8mS9g== X-Google-Smtp-Source: AGRyM1tQg6Ptf2IhDkChb5brd+wDDuzrJF6dXxpGY26ieR2pIo8wpHEY3ZAcYjSqlFe4M2kk24RyFg== X-Received: by 2002:a05:6000:887:b0:21e:24a0:f302 with SMTP id ca7-20020a056000088700b0021e24a0f302mr10446541wrb.466.1658839555551; Tue, 26 Jul 2022 05:45:55 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id y17-20020adfd091000000b0021e87ec980bsm5948460wrh.84.2022.07.26.05.45.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 05:45:54 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Tue, 26 Jul 2022 13:45:33 +0100 Message-Id: <20220726124549.1646-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220726124549.1646-1-naush@raspberrypi.com> References: <20220726124549.1646-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 01/17] DNI: ipa: raspberrypi: Code refactoring to match style guidelines 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: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Refactor the source files in src/ipa/raspberrypi/ to match the recommended formatting guidelines for the libcamera project. The vast majority of changes in this commit comprise of switching from snake_case to CamelCase, and starting class member functions with a lower case character. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- .../controller/sharpen_algorithm.hpp | 2 +- .../raspberrypi/controller/sharpen_status.h | 2 +- src/ipa/raspberrypi/md_parser.hpp | 44 +-- src/ipa/raspberrypi/md_parser_smia.cpp | 108 +++---- src/ipa/raspberrypi/raspberrypi.cpp | 272 +++++++++--------- 5 files changed, 214 insertions(+), 214 deletions(-) diff --git a/src/ipa/raspberrypi/controller/sharpen_algorithm.hpp b/src/ipa/raspberrypi/controller/sharpen_algorithm.hpp index ca800308fd6c..888f4569c56a 100644 --- a/src/ipa/raspberrypi/controller/sharpen_algorithm.hpp +++ b/src/ipa/raspberrypi/controller/sharpen_algorithm.hpp @@ -15,7 +15,7 @@ class SharpenAlgorithm : public Algorithm public: SharpenAlgorithm(Controller *controller) : Algorithm(controller) {} // A sharpness control algorithm must provide the following: - virtual void SetStrength(double strength) = 0; + virtual void setStrength(double strength) = 0; }; } // namespace RPiController diff --git a/src/ipa/raspberrypi/controller/sharpen_status.h b/src/ipa/raspberrypi/controller/sharpen_status.h index 7501b191d6f6..2b0490742fba 100644 --- a/src/ipa/raspberrypi/controller/sharpen_status.h +++ b/src/ipa/raspberrypi/controller/sharpen_status.h @@ -20,7 +20,7 @@ struct SharpenStatus { // upper limit of the allowed sharpening response double limit; // The sharpening strength requested by the user or application. - double user_strength; + double userStrength; }; #ifdef __cplusplus diff --git a/src/ipa/raspberrypi/md_parser.hpp b/src/ipa/raspberrypi/md_parser.hpp index d32d0f549b9c..298d51811256 100644 --- a/src/ipa/raspberrypi/md_parser.hpp +++ b/src/ipa/raspberrypi/md_parser.hpp @@ -75,40 +75,40 @@ public: }; MdParser() - : reset_(true), bits_per_pixel_(0), num_lines_(0), line_length_bytes_(0) + : reset_(true), bitsPerPixel_(0), numLines_(0), lineLengthBytes_(0) { } virtual ~MdParser() = default; - void Reset() + void reset() { reset_ = true; } - void SetBitsPerPixel(int bpp) + void setBitsPerPixel(int bpp) { - bits_per_pixel_ = bpp; + bitsPerPixel_ = bpp; } - void SetNumLines(unsigned int num_lines) + void setNumLines(unsigned int numLines) { - num_lines_ = num_lines; + numLines_ = numLines; } - void SetLineLengthBytes(unsigned int num_bytes) + void setLineLengthBytes(unsigned int numBytes) { - line_length_bytes_ = num_bytes; + lineLengthBytes_ = numBytes; } - virtual Status Parse(libcamera::Span buffer, + virtual Status parse(libcamera::Span buffer, RegisterMap ®isters) = 0; protected: bool reset_; - int bits_per_pixel_; - unsigned int num_lines_; - unsigned int line_length_bytes_; + int bitsPerPixel_; + unsigned int numLines_; + unsigned int lineLengthBytes_; }; /* @@ -123,7 +123,7 @@ class MdParserSmia final : public MdParser public: MdParserSmia(std::initializer_list registerList); - MdParser::Status Parse(libcamera::Span buffer, + MdParser::Status parse(libcamera::Span buffer, RegisterMap ®isters) override; private: @@ -133,18 +133,18 @@ private: /* * Note that error codes > 0 are regarded as non-fatal; codes < 0 * indicate a bad data buffer. Status codes are: - * PARSE_OK - found all registers, much happiness - * MISSING_REGS - some registers found; should this be a hard error? + * ParseOk - found all registers, much happiness + * MissingRegs - some registers found; should this be a hard error? * The remaining codes are all hard errors. */ enum ParseStatus { - PARSE_OK = 0, - MISSING_REGS = 1, - NO_LINE_START = -1, - ILLEGAL_TAG = -2, - BAD_DUMMY = -3, - BAD_LINE_END = -4, - BAD_PADDING = -5 + ParseOk = 0, + MissingRegs = 1, + NoLineStart = -1, + IllegalTag = -2, + BadDummy = -3, + BadLineEnd = -4, + BadPadding = -5 }; ParseStatus findRegs(libcamera::Span buffer); diff --git a/src/ipa/raspberrypi/md_parser_smia.cpp b/src/ipa/raspberrypi/md_parser_smia.cpp index ea5eac414b36..9fab6594baac 100644 --- a/src/ipa/raspberrypi/md_parser_smia.cpp +++ b/src/ipa/raspberrypi/md_parser_smia.cpp @@ -20,12 +20,12 @@ using namespace libcamera; * sensors, I think. */ -constexpr unsigned int LINE_START = 0x0a; -constexpr unsigned int LINE_END_TAG = 0x07; -constexpr unsigned int REG_HI_BITS = 0xaa; -constexpr unsigned int REG_LOW_BITS = 0xa5; -constexpr unsigned int REG_VALUE = 0x5a; -constexpr unsigned int REG_SKIP = 0x55; +constexpr unsigned int LineStart = 0x0a; +constexpr unsigned int LineEndTag = 0x07; +constexpr unsigned int RegHiBits = 0xaa; +constexpr unsigned int RegLowBits = 0xa5; +constexpr unsigned int RegValue = 0x5a; +constexpr unsigned int RegSkip = 0x55; MdParserSmia::MdParserSmia(std::initializer_list registerList) { @@ -33,7 +33,7 @@ MdParserSmia::MdParserSmia(std::initializer_list registerList) offsets_[r] = {}; } -MdParser::Status MdParserSmia::Parse(libcamera::Span buffer, +MdParser::Status MdParserSmia::parse(libcamera::Span buffer, RegisterMap ®isters) { if (reset_) { @@ -41,7 +41,7 @@ MdParser::Status MdParserSmia::Parse(libcamera::Span buffer, * Search again through the metadata for all the registers * requested. */ - ASSERT(bits_per_pixel_); + ASSERT(bitsPerPixel_); for (const auto &kv : offsets_) offsets_[kv.first] = {}; @@ -53,7 +53,7 @@ MdParser::Status MdParserSmia::Parse(libcamera::Span buffer, * * In either case, we retry parsing on the next frame. */ - if (ret != PARSE_OK) + if (ret != ParseOk) return ERROR; reset_ = false; @@ -76,74 +76,74 @@ MdParserSmia::ParseStatus MdParserSmia::findRegs(libcamera::Span { ASSERT(offsets_.size()); - if (buffer[0] != LINE_START) - return NO_LINE_START; + if (buffer[0] != LineStart) + return NoLineStart; - unsigned int current_offset = 1; /* after the LINE_START */ - unsigned int current_line_start = 0, current_line = 0; - unsigned int reg_num = 0, regs_done = 0; + unsigned int currentOffset = 1; /* after the LineStart */ + unsigned int currentLineStart = 0, currentLine = 0; + unsigned int regNum = 0, regsDone = 0; while (1) { - int tag = buffer[current_offset++]; - - if ((bits_per_pixel_ == 10 && - (current_offset + 1 - current_line_start) % 5 == 0) || - (bits_per_pixel_ == 12 && - (current_offset + 1 - current_line_start) % 3 == 0)) { - if (buffer[current_offset++] != REG_SKIP) - return BAD_DUMMY; + int tag = buffer[currentOffset++]; + + if ((bitsPerPixel_ == 10 && + (currentOffset + 1 - currentLineStart) % 5 == 0) || + (bitsPerPixel_ == 12 && + (currentOffset + 1 - currentLineStart) % 3 == 0)) { + if (buffer[currentOffset++] != RegSkip) + return BadDummy; } - int data_byte = buffer[current_offset++]; + int dataByte = buffer[currentOffset++]; - if (tag == LINE_END_TAG) { - if (data_byte != LINE_END_TAG) - return BAD_LINE_END; + if (tag == LineEndTag) { + if (dataByte != LineEndTag) + return BadLineEnd; - if (num_lines_ && ++current_line == num_lines_) - return MISSING_REGS; + if (numLines_ && ++currentLine == numLines_) + return MissingRegs; - if (line_length_bytes_) { - current_offset = current_line_start + line_length_bytes_; + if (lineLengthBytes_) { + currentOffset = currentLineStart + lineLengthBytes_; /* Require whole line to be in the buffer (if buffer size set). */ if (buffer.size() && - current_offset + line_length_bytes_ > buffer.size()) - return MISSING_REGS; + currentOffset + lineLengthBytes_ > buffer.size()) + return MissingRegs; - if (buffer[current_offset] != LINE_START) - return NO_LINE_START; + if (buffer[currentOffset] != LineStart) + return NoLineStart; } else { /* allow a zero line length to mean "hunt for the next line" */ - while (current_offset < buffer.size() && - buffer[current_offset] != LINE_START) - current_offset++; + while (currentOffset < buffer.size() && + buffer[currentOffset] != LineStart) + currentOffset++; - if (current_offset == buffer.size()) - return NO_LINE_START; + if (currentOffset == buffer.size()) + return NoLineStart; } - /* inc current_offset to after LINE_START */ - current_line_start = current_offset++; + /* inc current_offset to after LineStart */ + currentLineStart = currentOffset++; } else { - if (tag == REG_HI_BITS) - reg_num = (reg_num & 0xff) | (data_byte << 8); - else if (tag == REG_LOW_BITS) - reg_num = (reg_num & 0xff00) | data_byte; - else if (tag == REG_SKIP) - reg_num++; - else if (tag == REG_VALUE) { - auto reg = offsets_.find(reg_num); + if (tag == RegHiBits) + regNum = (regNum & 0xff) | (dataByte << 8); + else if (tag == RegLowBits) + regNum = (regNum & 0xff00) | dataByte; + else if (tag == RegSkip) + regNum++; + else if (tag == RegValue) { + auto reg = offsets_.find(regNum); if (reg != offsets_.end()) { - offsets_[reg_num] = current_offset - 1; + offsets_[regNum] = currentOffset - 1; - if (++regs_done == offsets_.size()) - return PARSE_OK; + if (++regsDone == offsets_.size()) + return ParseOk; } - reg_num++; + regNum++; } else - return ILLEGAL_TAG; + return IllegalTag; } } } diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index c7492a77a3fd..f315ebcd4c6b 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -208,7 +208,7 @@ int IPARPi::init(const IPASettings &settings, IPAInitResult *result) * that the kernel driver doesn't. We only do this the first time; we don't need * to re-parse the metadata after a simple mode-switch for no reason. */ - helper_ = std::unique_ptr(RPiController::CamHelper::Create(settings.sensorModel)); + helper_ = std::unique_ptr(RPiController::CamHelper::create(settings.sensorModel)); if (!helper_) { LOG(IPARPI, Error) << "Could not create camera helper for " << settings.sensorModel; @@ -220,8 +220,8 @@ int IPARPi::init(const IPASettings &settings, IPAInitResult *result) * to setup the staggered writer class. */ int gainDelay, exposureDelay, vblankDelay, sensorMetadata; - helper_->GetDelays(exposureDelay, gainDelay, vblankDelay); - sensorMetadata = helper_->SensorEmbeddedDataPresent(); + helper_->getDelays(exposureDelay, gainDelay, vblankDelay); + sensorMetadata = helper_->sensorEmbeddedDataPresent(); result->sensorConfig.gainDelay = gainDelay; result->sensorConfig.exposureDelay = exposureDelay; @@ -229,8 +229,8 @@ int IPARPi::init(const IPASettings &settings, IPAInitResult *result) result->sensorConfig.sensorMetadata = sensorMetadata; /* Load the tuning file for this sensor. */ - controller_.Read(settings.configurationFile.c_str()); - controller_.Initialise(); + controller_.read(settings.configurationFile.c_str()); + controller_.initialise(); /* Return the controls handled by the IPA */ ControlInfoMap::Map ctrlMap = ipaControls; @@ -249,15 +249,15 @@ void IPARPi::start(const ControlList &controls, StartConfig *startConfig) queueRequest(controls); } - controller_.SwitchMode(mode_, &metadata); + controller_.switchMode(mode_, &metadata); /* SwitchMode may supply updated exposure/gain values to use. */ AgcStatus agcStatus; - agcStatus.shutter_time = 0.0s; - agcStatus.analogue_gain = 0.0; + agcStatus.shutterTime = 0.0s; + agcStatus.analogueGain = 0.0; - metadata.Get("agc.status", agcStatus); - if (agcStatus.shutter_time && agcStatus.analogue_gain) { + metadata.get("agc.status", agcStatus); + if (agcStatus.shutterTime && agcStatus.analogueGain) { ControlList ctrls(sensorCtrls_); applyAGC(&agcStatus, ctrls); startConfig->controls = std::move(ctrls); @@ -271,8 +271,8 @@ void IPARPi::start(const ControlList &controls, StartConfig *startConfig) frameCount_ = 0; checkCount_ = 0; if (firstStart_) { - dropFrameCount_ = helper_->HideFramesStartup(); - mistrustCount_ = helper_->MistrustFramesStartup(); + dropFrameCount_ = helper_->hideFramesStartup(); + mistrustCount_ = helper_->mistrustFramesStartup(); /* * Query the AGC/AWB for how many frames they may take to @@ -283,18 +283,18 @@ void IPARPi::start(const ControlList &controls, StartConfig *startConfig) */ unsigned int agcConvergenceFrames = 0; RPiController::AgcAlgorithm *agc = dynamic_cast( - controller_.GetAlgorithm("agc")); + controller_.getAlgorithm("agc")); if (agc) { - agcConvergenceFrames = agc->GetConvergenceFrames(); + agcConvergenceFrames = agc->getConvergenceFrames(); if (agcConvergenceFrames) agcConvergenceFrames += mistrustCount_; } unsigned int awbConvergenceFrames = 0; RPiController::AwbAlgorithm *awb = dynamic_cast( - controller_.GetAlgorithm("awb")); + controller_.getAlgorithm("awb")); if (awb) { - awbConvergenceFrames = awb->GetConvergenceFrames(); + awbConvergenceFrames = awb->getConvergenceFrames(); if (awbConvergenceFrames) awbConvergenceFrames += mistrustCount_; } @@ -302,12 +302,12 @@ void IPARPi::start(const ControlList &controls, StartConfig *startConfig) dropFrameCount_ = std::max({ dropFrameCount_, agcConvergenceFrames, awbConvergenceFrames }); LOG(IPARPI, Debug) << "Drop " << dropFrameCount_ << " frames on startup"; } else { - dropFrameCount_ = helper_->HideFramesModeSwitch(); - mistrustCount_ = helper_->MistrustFramesModeSwitch(); + dropFrameCount_ = helper_->hideFramesModeSwitch(); + mistrustCount_ = helper_->mistrustFramesModeSwitch(); } startConfig->dropFrameCount = dropFrameCount_; - const Duration maxSensorFrameDuration = mode_.max_frame_length * mode_.line_length; + const Duration maxSensorFrameDuration = mode_.maxFrameLength * mode_.lineLength; startConfig->maxSensorFrameLengthMs = maxSensorFrameDuration.get(); firstStart_ = false; @@ -319,17 +319,17 @@ void IPARPi::setMode(const IPACameraSensorInfo &sensorInfo) mode_.bitdepth = sensorInfo.bitsPerPixel; mode_.width = sensorInfo.outputSize.width; mode_.height = sensorInfo.outputSize.height; - mode_.sensor_width = sensorInfo.activeAreaSize.width; - mode_.sensor_height = sensorInfo.activeAreaSize.height; - mode_.crop_x = sensorInfo.analogCrop.x; - mode_.crop_y = sensorInfo.analogCrop.y; + mode_.sensorWidth = sensorInfo.activeAreaSize.width; + mode_.sensorHeight = sensorInfo.activeAreaSize.height; + mode_.cropX = sensorInfo.analogCrop.x; + mode_.cropY = sensorInfo.analogCrop.y; /* * Calculate scaling parameters. The scale_[xy] factors are determined * by the ratio between the crop rectangle size and the output size. */ - mode_.scale_x = sensorInfo.analogCrop.width / sensorInfo.outputSize.width; - mode_.scale_y = sensorInfo.analogCrop.height / sensorInfo.outputSize.height; + mode_.scaleX = sensorInfo.analogCrop.width / sensorInfo.outputSize.width; + mode_.scaleY = sensorInfo.analogCrop.height / sensorInfo.outputSize.height; /* * We're not told by the pipeline handler how scaling is split between @@ -339,30 +339,30 @@ void IPARPi::setMode(const IPACameraSensorInfo &sensorInfo) * * \todo Get the pipeline handle to provide the full data */ - mode_.bin_x = std::min(2, static_cast(mode_.scale_x)); - mode_.bin_y = std::min(2, static_cast(mode_.scale_y)); + mode_.binX = std::min(2, static_cast(mode_.scaleX)); + mode_.binY = std::min(2, static_cast(mode_.scaleY)); /* The noise factor is the square root of the total binning factor. */ - mode_.noise_factor = sqrt(mode_.bin_x * mode_.bin_y); + mode_.noiseFactor = sqrt(mode_.binX * mode_.binY); /* * Calculate the line length as the ratio between the line length in * pixels and the pixel rate. */ - mode_.line_length = sensorInfo.lineLength * (1.0s / sensorInfo.pixelRate); + mode_.lineLength = sensorInfo.lineLength * (1.0s / sensorInfo.pixelRate); /* * Set the frame length limits for the mode to ensure exposure and * framerate calculations are clipped appropriately. */ - mode_.min_frame_length = sensorInfo.minFrameLength; - mode_.max_frame_length = sensorInfo.maxFrameLength; + mode_.minFrameLength = sensorInfo.minFrameLength; + mode_.maxFrameLength = sensorInfo.maxFrameLength; /* * Some sensors may have different sensitivities in different modes; * the CamHelper will know the correct value. */ - mode_.sensitivity = helper_->GetModeSensitivity(mode_); + mode_.sensitivity = helper_->getModeSensitivity(mode_); } int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, @@ -421,7 +421,7 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, } /* Pass the camera mode to the CamHelper to setup algorithms. */ - helper_->SetCameraMode(mode_); + helper_->setCameraMode(mode_); /* * Initialise this ControlList correctly, even if empty, in case the IPA is @@ -438,8 +438,8 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, /* Supply initial values for gain and exposure. */ AgcStatus agcStatus; - agcStatus.shutter_time = defaultExposureTime; - agcStatus.analogue_gain = defaultAnalogueGain; + agcStatus.shutterTime = defaultExposureTime; + agcStatus.analogueGain = defaultAnalogueGain; applyAGC(&agcStatus, ctrls); } @@ -451,25 +451,25 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, * based on the current sensor mode. */ ControlInfoMap::Map ctrlMap = ipaControls; - const Duration minSensorFrameDuration = mode_.min_frame_length * mode_.line_length; - const Duration maxSensorFrameDuration = mode_.max_frame_length * mode_.line_length; + const Duration minSensorFrameDuration = mode_.minFrameLength * mode_.lineLength; + const Duration maxSensorFrameDuration = mode_.maxFrameLength * mode_.lineLength; ctrlMap[&controls::FrameDurationLimits] = ControlInfo(static_cast(minSensorFrameDuration.get()), static_cast(maxSensorFrameDuration.get())); ctrlMap[&controls::AnalogueGain] = - ControlInfo(1.0f, static_cast(helper_->Gain(maxSensorGainCode_))); + ControlInfo(1.0f, static_cast(helper_->gain(maxSensorGainCode_))); /* * Calculate the max exposure limit from the frame duration limit as V4L2 * will limit the maximum control value based on the current VBLANK value. */ Duration maxShutter = Duration::max(); - helper_->GetVBlanking(maxShutter, minSensorFrameDuration, maxSensorFrameDuration); + helper_->getVBlanking(maxShutter, minSensorFrameDuration, maxSensorFrameDuration); const uint32_t exposureMin = sensorCtrls_.at(V4L2_CID_EXPOSURE).min().get(); ctrlMap[&controls::ExposureTime] = - ControlInfo(static_cast(helper_->Exposure(exposureMin).get()), + ControlInfo(static_cast(helper_->exposure(exposureMin).get()), static_cast(maxShutter.get())); result->controlInfo = ControlInfoMap(std::move(ctrlMap), controls::controls); @@ -536,54 +536,54 @@ void IPARPi::reportMetadata() * processed can be extracted and placed into the libcamera metadata * buffer, where an application could query it. */ - DeviceStatus *deviceStatus = rpiMetadata_.GetLocked("device.status"); + DeviceStatus *deviceStatus = rpiMetadata_.getLocked("device.status"); if (deviceStatus) { libcameraMetadata_.set(controls::ExposureTime, - deviceStatus->shutter_speed.get()); - libcameraMetadata_.set(controls::AnalogueGain, deviceStatus->analogue_gain); + deviceStatus->shutterSpeed.get()); + libcameraMetadata_.set(controls::AnalogueGain, deviceStatus->analogueGain); libcameraMetadata_.set(controls::FrameDuration, - helper_->Exposure(deviceStatus->frame_length).get()); - if (deviceStatus->sensor_temperature) - libcameraMetadata_.set(controls::SensorTemperature, *deviceStatus->sensor_temperature); + helper_->exposure(deviceStatus->frameLength).get()); + if (deviceStatus->sensorTemperature) + libcameraMetadata_.set(controls::SensorTemperature, *deviceStatus->sensorTemperature); } - AgcStatus *agcStatus = rpiMetadata_.GetLocked("agc.status"); + AgcStatus *agcStatus = rpiMetadata_.getLocked("agc.status"); if (agcStatus) { libcameraMetadata_.set(controls::AeLocked, agcStatus->locked); - libcameraMetadata_.set(controls::DigitalGain, agcStatus->digital_gain); + libcameraMetadata_.set(controls::DigitalGain, agcStatus->digitalGain); } - LuxStatus *luxStatus = rpiMetadata_.GetLocked("lux.status"); + LuxStatus *luxStatus = rpiMetadata_.getLocked("lux.status"); if (luxStatus) libcameraMetadata_.set(controls::Lux, luxStatus->lux); - AwbStatus *awbStatus = rpiMetadata_.GetLocked("awb.status"); + AwbStatus *awbStatus = rpiMetadata_.getLocked("awb.status"); if (awbStatus) { - libcameraMetadata_.set(controls::ColourGains, { static_cast(awbStatus->gain_r), - static_cast(awbStatus->gain_b) }); - libcameraMetadata_.set(controls::ColourTemperature, awbStatus->temperature_K); + libcameraMetadata_.set(controls::ColourGains, { static_cast(awbStatus->gainR), + static_cast(awbStatus->gainB) }); + libcameraMetadata_.set(controls::ColourTemperature, awbStatus->temperatureK); } - BlackLevelStatus *blackLevelStatus = rpiMetadata_.GetLocked("black_level.status"); + BlackLevelStatus *blackLevelStatus = rpiMetadata_.getLocked("black_level.status"); if (blackLevelStatus) libcameraMetadata_.set(controls::SensorBlackLevels, - { static_cast(blackLevelStatus->black_level_r), - static_cast(blackLevelStatus->black_level_g), - static_cast(blackLevelStatus->black_level_g), - static_cast(blackLevelStatus->black_level_b) }); + { static_cast(blackLevelStatus->blackLevelR), + static_cast(blackLevelStatus->blackLevelG), + static_cast(blackLevelStatus->blackLevelG), + static_cast(blackLevelStatus->blackLevelB) }); - FocusStatus *focusStatus = rpiMetadata_.GetLocked("focus.status"); + FocusStatus *focusStatus = rpiMetadata_.getLocked("focus.status"); if (focusStatus && focusStatus->num == 12) { /* * We get a 4x3 grid of regions by default. Calculate the average * FoM over the central two positions to give an overall scene FoM. * This can change later if it is not deemed suitable. */ - int32_t focusFoM = (focusStatus->focus_measures[5] + focusStatus->focus_measures[6]) / 2; + int32_t focusFoM = (focusStatus->focusMeasures[5] + focusStatus->focusMeasures[6]) / 2; libcameraMetadata_.set(controls::FocusFoM, focusFoM); } - CcmStatus *ccmStatus = rpiMetadata_.GetLocked("ccm.status"); + CcmStatus *ccmStatus = rpiMetadata_.getLocked("ccm.status"); if (ccmStatus) { float m[9]; for (unsigned int i = 0; i < 9; i++) @@ -695,7 +695,7 @@ void IPARPi::queueRequest(const ControlList &controls) switch (ctrl.first) { case controls::AE_ENABLE: { - RPiController::Algorithm *agc = controller_.GetAlgorithm("agc"); + RPiController::Algorithm *agc = controller_.getAlgorithm("agc"); if (!agc) { LOG(IPARPI, Warning) << "Could not set AE_ENABLE - no AGC algorithm"; @@ -703,9 +703,9 @@ void IPARPi::queueRequest(const ControlList &controls) } if (ctrl.second.get() == false) - agc->Pause(); + agc->pause(); else - agc->Resume(); + agc->resume(); libcameraMetadata_.set(controls::AeEnable, ctrl.second.get()); break; @@ -713,7 +713,7 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::EXPOSURE_TIME: { RPiController::AgcAlgorithm *agc = dynamic_cast( - controller_.GetAlgorithm("agc")); + controller_.getAlgorithm("agc")); if (!agc) { LOG(IPARPI, Warning) << "Could not set EXPOSURE_TIME - no AGC algorithm"; @@ -721,7 +721,7 @@ void IPARPi::queueRequest(const ControlList &controls) } /* The control provides units of microseconds. */ - agc->SetFixedShutter(ctrl.second.get() * 1.0us); + agc->setFixedShutter(ctrl.second.get() * 1.0us); libcameraMetadata_.set(controls::ExposureTime, ctrl.second.get()); break; @@ -729,14 +729,14 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::ANALOGUE_GAIN: { RPiController::AgcAlgorithm *agc = dynamic_cast( - controller_.GetAlgorithm("agc")); + controller_.getAlgorithm("agc")); if (!agc) { LOG(IPARPI, Warning) << "Could not set ANALOGUE_GAIN - no AGC algorithm"; break; } - agc->SetFixedAnalogueGain(ctrl.second.get()); + agc->setFixedAnalogueGain(ctrl.second.get()); libcameraMetadata_.set(controls::AnalogueGain, ctrl.second.get()); @@ -745,7 +745,7 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::AE_METERING_MODE: { RPiController::AgcAlgorithm *agc = dynamic_cast( - controller_.GetAlgorithm("agc")); + controller_.getAlgorithm("agc")); if (!agc) { LOG(IPARPI, Warning) << "Could not set AE_METERING_MODE - no AGC algorithm"; @@ -754,7 +754,7 @@ void IPARPi::queueRequest(const ControlList &controls) int32_t idx = ctrl.second.get(); if (MeteringModeTable.count(idx)) { - agc->SetMeteringMode(MeteringModeTable.at(idx)); + agc->setMeteringMode(MeteringModeTable.at(idx)); libcameraMetadata_.set(controls::AeMeteringMode, idx); } else { LOG(IPARPI, Error) << "Metering mode " << idx @@ -765,7 +765,7 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::AE_CONSTRAINT_MODE: { RPiController::AgcAlgorithm *agc = dynamic_cast( - controller_.GetAlgorithm("agc")); + controller_.getAlgorithm("agc")); if (!agc) { LOG(IPARPI, Warning) << "Could not set AE_CONSTRAINT_MODE - no AGC algorithm"; @@ -774,7 +774,7 @@ void IPARPi::queueRequest(const ControlList &controls) int32_t idx = ctrl.second.get(); if (ConstraintModeTable.count(idx)) { - agc->SetConstraintMode(ConstraintModeTable.at(idx)); + agc->setConstraintMode(ConstraintModeTable.at(idx)); libcameraMetadata_.set(controls::AeConstraintMode, idx); } else { LOG(IPARPI, Error) << "Constraint mode " << idx @@ -785,7 +785,7 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::AE_EXPOSURE_MODE: { RPiController::AgcAlgorithm *agc = dynamic_cast( - controller_.GetAlgorithm("agc")); + controller_.getAlgorithm("agc")); if (!agc) { LOG(IPARPI, Warning) << "Could not set AE_EXPOSURE_MODE - no AGC algorithm"; @@ -794,7 +794,7 @@ void IPARPi::queueRequest(const ControlList &controls) int32_t idx = ctrl.second.get(); if (ExposureModeTable.count(idx)) { - agc->SetExposureMode(ExposureModeTable.at(idx)); + agc->setExposureMode(ExposureModeTable.at(idx)); libcameraMetadata_.set(controls::AeExposureMode, idx); } else { LOG(IPARPI, Error) << "Exposure mode " << idx @@ -805,7 +805,7 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::EXPOSURE_VALUE: { RPiController::AgcAlgorithm *agc = dynamic_cast( - controller_.GetAlgorithm("agc")); + controller_.getAlgorithm("agc")); if (!agc) { LOG(IPARPI, Warning) << "Could not set EXPOSURE_VALUE - no AGC algorithm"; @@ -817,14 +817,14 @@ void IPARPi::queueRequest(const ControlList &controls) * So convert to 2^EV */ double ev = pow(2.0, ctrl.second.get()); - agc->SetEv(ev); + agc->setEv(ev); libcameraMetadata_.set(controls::ExposureValue, ctrl.second.get()); break; } case controls::AWB_ENABLE: { - RPiController::Algorithm *awb = controller_.GetAlgorithm("awb"); + RPiController::Algorithm *awb = controller_.getAlgorithm("awb"); if (!awb) { LOG(IPARPI, Warning) << "Could not set AWB_ENABLE - no AWB algorithm"; @@ -832,9 +832,9 @@ void IPARPi::queueRequest(const ControlList &controls) } if (ctrl.second.get() == false) - awb->Pause(); + awb->pause(); else - awb->Resume(); + awb->resume(); libcameraMetadata_.set(controls::AwbEnable, ctrl.second.get()); @@ -843,7 +843,7 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::AWB_MODE: { RPiController::AwbAlgorithm *awb = dynamic_cast( - controller_.GetAlgorithm("awb")); + controller_.getAlgorithm("awb")); if (!awb) { LOG(IPARPI, Warning) << "Could not set AWB_MODE - no AWB algorithm"; @@ -852,7 +852,7 @@ void IPARPi::queueRequest(const ControlList &controls) int32_t idx = ctrl.second.get(); if (AwbModeTable.count(idx)) { - awb->SetMode(AwbModeTable.at(idx)); + awb->setMode(AwbModeTable.at(idx)); libcameraMetadata_.set(controls::AwbMode, idx); } else { LOG(IPARPI, Error) << "AWB mode " << idx @@ -864,14 +864,14 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::COLOUR_GAINS: { auto gains = ctrl.second.get>(); RPiController::AwbAlgorithm *awb = dynamic_cast( - controller_.GetAlgorithm("awb")); + controller_.getAlgorithm("awb")); if (!awb) { LOG(IPARPI, Warning) << "Could not set COLOUR_GAINS - no AWB algorithm"; break; } - awb->SetManualGains(gains[0], gains[1]); + awb->setManualGains(gains[0], gains[1]); if (gains[0] != 0.0f && gains[1] != 0.0f) /* A gain of 0.0f will switch back to auto mode. */ libcameraMetadata_.set(controls::ColourGains, @@ -881,14 +881,14 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::BRIGHTNESS: { RPiController::ContrastAlgorithm *contrast = dynamic_cast( - controller_.GetAlgorithm("contrast")); + controller_.getAlgorithm("contrast")); if (!contrast) { LOG(IPARPI, Warning) << "Could not set BRIGHTNESS - no contrast algorithm"; break; } - contrast->SetBrightness(ctrl.second.get() * 65536); + contrast->setBrightness(ctrl.second.get() * 65536); libcameraMetadata_.set(controls::Brightness, ctrl.second.get()); break; @@ -896,14 +896,14 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::CONTRAST: { RPiController::ContrastAlgorithm *contrast = dynamic_cast( - controller_.GetAlgorithm("contrast")); + controller_.getAlgorithm("contrast")); if (!contrast) { LOG(IPARPI, Warning) << "Could not set CONTRAST - no contrast algorithm"; break; } - contrast->SetContrast(ctrl.second.get()); + contrast->setContrast(ctrl.second.get()); libcameraMetadata_.set(controls::Contrast, ctrl.second.get()); break; @@ -911,14 +911,14 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::SATURATION: { RPiController::CcmAlgorithm *ccm = dynamic_cast( - controller_.GetAlgorithm("ccm")); + controller_.getAlgorithm("ccm")); if (!ccm) { LOG(IPARPI, Warning) << "Could not set SATURATION - no ccm algorithm"; break; } - ccm->SetSaturation(ctrl.second.get()); + ccm->setSaturation(ctrl.second.get()); libcameraMetadata_.set(controls::Saturation, ctrl.second.get()); break; @@ -926,14 +926,14 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::SHARPNESS: { RPiController::SharpenAlgorithm *sharpen = dynamic_cast( - controller_.GetAlgorithm("sharpen")); + controller_.getAlgorithm("sharpen")); if (!sharpen) { LOG(IPARPI, Warning) << "Could not set SHARPNESS - no sharpen algorithm"; break; } - sharpen->SetStrength(ctrl.second.get()); + sharpen->setStrength(ctrl.second.get()); libcameraMetadata_.set(controls::Sharpness, ctrl.second.get()); break; @@ -952,7 +952,7 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::NOISE_REDUCTION_MODE: { RPiController::DenoiseAlgorithm *sdn = dynamic_cast( - controller_.GetAlgorithm("SDN")); + controller_.getAlgorithm("SDN")); if (!sdn) { LOG(IPARPI, Warning) << "Could not set NOISE_REDUCTION_MODE - no SDN algorithm"; @@ -962,7 +962,7 @@ void IPARPi::queueRequest(const ControlList &controls) int32_t idx = ctrl.second.get(); auto mode = DenoiseModeTable.find(idx); if (mode != DenoiseModeTable.end()) { - sdn->SetMode(mode->second); + sdn->setMode(mode->second); /* * \todo If the colour denoise is not going to run due to an @@ -1014,7 +1014,7 @@ void IPARPi::prepareISP(const ISPConfig &data) * This may overwrite the DeviceStatus using values from the sensor * metadata, and may also do additional custom processing. */ - helper_->Prepare(embeddedBuffer, rpiMetadata_); + helper_->prepare(embeddedBuffer, rpiMetadata_); /* Done with embedded data now, return to pipeline handler asap. */ if (data.embeddedBufferPresent) @@ -1030,7 +1030,7 @@ void IPARPi::prepareISP(const ISPConfig &data) * current frame, or any other bits of metadata that were added * in helper_->Prepare(). */ - rpiMetadata_.Merge(lastMetadata); + rpiMetadata_.merge(lastMetadata); processPending_ = false; return; } @@ -1040,48 +1040,48 @@ void IPARPi::prepareISP(const ISPConfig &data) ControlList ctrls(ispCtrls_); - controller_.Prepare(&rpiMetadata_); + controller_.prepare(&rpiMetadata_); /* Lock the metadata buffer to avoid constant locks/unlocks. */ std::unique_lock lock(rpiMetadata_); - AwbStatus *awbStatus = rpiMetadata_.GetLocked("awb.status"); + AwbStatus *awbStatus = rpiMetadata_.getLocked("awb.status"); if (awbStatus) applyAWB(awbStatus, ctrls); - CcmStatus *ccmStatus = rpiMetadata_.GetLocked("ccm.status"); + CcmStatus *ccmStatus = rpiMetadata_.getLocked("ccm.status"); if (ccmStatus) applyCCM(ccmStatus, ctrls); - AgcStatus *dgStatus = rpiMetadata_.GetLocked("agc.status"); + AgcStatus *dgStatus = rpiMetadata_.getLocked("agc.status"); if (dgStatus) applyDG(dgStatus, ctrls); - AlscStatus *lsStatus = rpiMetadata_.GetLocked("alsc.status"); + AlscStatus *lsStatus = rpiMetadata_.getLocked("alsc.status"); if (lsStatus) applyLS(lsStatus, ctrls); - ContrastStatus *contrastStatus = rpiMetadata_.GetLocked("contrast.status"); + ContrastStatus *contrastStatus = rpiMetadata_.getLocked("contrast.status"); if (contrastStatus) applyGamma(contrastStatus, ctrls); - BlackLevelStatus *blackLevelStatus = rpiMetadata_.GetLocked("black_level.status"); + BlackLevelStatus *blackLevelStatus = rpiMetadata_.getLocked("black_level.status"); if (blackLevelStatus) applyBlackLevel(blackLevelStatus, ctrls); - GeqStatus *geqStatus = rpiMetadata_.GetLocked("geq.status"); + GeqStatus *geqStatus = rpiMetadata_.getLocked("geq.status"); if (geqStatus) applyGEQ(geqStatus, ctrls); - DenoiseStatus *denoiseStatus = rpiMetadata_.GetLocked("denoise.status"); + DenoiseStatus *denoiseStatus = rpiMetadata_.getLocked("denoise.status"); if (denoiseStatus) applyDenoise(denoiseStatus, ctrls); - SharpenStatus *sharpenStatus = rpiMetadata_.GetLocked("sharpen.status"); + SharpenStatus *sharpenStatus = rpiMetadata_.getLocked("sharpen.status"); if (sharpenStatus) applySharpen(sharpenStatus, ctrls); - DpcStatus *dpcStatus = rpiMetadata_.GetLocked("dpc.status"); + DpcStatus *dpcStatus = rpiMetadata_.getLocked("dpc.status"); if (dpcStatus) applyDPC(dpcStatus, ctrls); @@ -1097,13 +1097,13 @@ void IPARPi::fillDeviceStatus(const ControlList &sensorControls) int32_t gainCode = sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get(); int32_t vblank = sensorControls.get(V4L2_CID_VBLANK).get(); - deviceStatus.shutter_speed = helper_->Exposure(exposureLines); - deviceStatus.analogue_gain = helper_->Gain(gainCode); - deviceStatus.frame_length = mode_.height + vblank; + deviceStatus.shutterSpeed = helper_->exposure(exposureLines); + deviceStatus.analogueGain = helper_->gain(gainCode); + deviceStatus.frameLength = mode_.height + vblank; LOG(IPARPI, Debug) << "Metadata - " << deviceStatus; - rpiMetadata_.Set("device.status", deviceStatus); + rpiMetadata_.set("device.status", deviceStatus); } void IPARPi::processStats(unsigned int bufferId) @@ -1117,11 +1117,11 @@ void IPARPi::processStats(unsigned int bufferId) Span mem = it->second.planes()[0]; bcm2835_isp_stats *stats = reinterpret_cast(mem.data()); RPiController::StatisticsPtr statistics = std::make_shared(*stats); - helper_->Process(statistics, rpiMetadata_); - controller_.Process(statistics, &rpiMetadata_); + helper_->process(statistics, rpiMetadata_); + controller_.process(statistics, &rpiMetadata_); struct AgcStatus agcStatus; - if (rpiMetadata_.Get("agc.status", agcStatus) == 0) { + if (rpiMetadata_.get("agc.status", agcStatus) == 0) { ControlList ctrls(sensorCtrls_); applyAGC(&agcStatus, ctrls); @@ -1131,19 +1131,19 @@ void IPARPi::processStats(unsigned int bufferId) void IPARPi::applyAWB(const struct AwbStatus *awbStatus, ControlList &ctrls) { - LOG(IPARPI, Debug) << "Applying WB R: " << awbStatus->gain_r << " B: " - << awbStatus->gain_b; + LOG(IPARPI, Debug) << "Applying WB R: " << awbStatus->gainR << " B: " + << awbStatus->gainB; ctrls.set(V4L2_CID_RED_BALANCE, - static_cast(awbStatus->gain_r * 1000)); + static_cast(awbStatus->gainR * 1000)); ctrls.set(V4L2_CID_BLUE_BALANCE, - static_cast(awbStatus->gain_b * 1000)); + static_cast(awbStatus->gainB * 1000)); } void IPARPi::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDuration) { - const Duration minSensorFrameDuration = mode_.min_frame_length * mode_.line_length; - const Duration maxSensorFrameDuration = mode_.max_frame_length * mode_.line_length; + const Duration minSensorFrameDuration = mode_.minFrameLength * mode_.lineLength; + const Duration maxSensorFrameDuration = mode_.maxFrameLength * mode_.lineLength; /* * This will only be applied once AGC recalculations occur. @@ -1164,20 +1164,20 @@ void IPARPi::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDur /* * Calculate the maximum exposure time possible for the AGC to use. - * GetVBlanking() will update maxShutter with the largest exposure + * getVBlanking() will update maxShutter with the largest exposure * value possible. */ Duration maxShutter = Duration::max(); - helper_->GetVBlanking(maxShutter, minFrameDuration_, maxFrameDuration_); + helper_->getVBlanking(maxShutter, minFrameDuration_, maxFrameDuration_); RPiController::AgcAlgorithm *agc = dynamic_cast( - controller_.GetAlgorithm("agc")); - agc->SetMaxShutter(maxShutter); + controller_.getAlgorithm("agc")); + agc->setMaxShutter(maxShutter); } void IPARPi::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls) { - int32_t gainCode = helper_->GainCode(agcStatus->analogue_gain); + int32_t gainCode = helper_->gainCode(agcStatus->analogueGain); /* * Ensure anything larger than the max gain code will not be passed to @@ -1186,15 +1186,15 @@ void IPARPi::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls) */ gainCode = std::min(gainCode, maxSensorGainCode_); - /* GetVBlanking might clip exposure time to the fps limits. */ - Duration exposure = agcStatus->shutter_time; - int32_t vblanking = helper_->GetVBlanking(exposure, minFrameDuration_, maxFrameDuration_); - int32_t exposureLines = helper_->ExposureLines(exposure); + /* getVBlanking might clip exposure time to the fps limits. */ + Duration exposure = agcStatus->shutterTime; + int32_t vblanking = helper_->getVBlanking(exposure, minFrameDuration_, maxFrameDuration_); + int32_t exposureLines = helper_->exposureLines(exposure); LOG(IPARPI, Debug) << "Applying AGC Exposure: " << exposure << " (Shutter lines: " << exposureLines << ", AGC requested " - << agcStatus->shutter_time << ") Gain: " - << agcStatus->analogue_gain << " (Gain Code: " + << agcStatus->shutterTime << ") Gain: " + << agcStatus->analogueGain << " (Gain Code: " << gainCode << ")"; /* @@ -1210,7 +1210,7 @@ void IPARPi::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls) void IPARPi::applyDG(const struct AgcStatus *dgStatus, ControlList &ctrls) { ctrls.set(V4L2_CID_DIGITAL_GAIN, - static_cast(dgStatus->digital_gain * 1000)); + static_cast(dgStatus->digitalGain * 1000)); } void IPARPi::applyCCM(const struct CcmStatus *ccmStatus, ControlList &ctrls) @@ -1250,9 +1250,9 @@ void IPARPi::applyBlackLevel(const struct BlackLevelStatus *blackLevelStatus, Co bcm2835_isp_black_level blackLevel; blackLevel.enabled = 1; - blackLevel.black_level_r = blackLevelStatus->black_level_r; - blackLevel.black_level_g = blackLevelStatus->black_level_g; - blackLevel.black_level_b = blackLevelStatus->black_level_b; + blackLevel.black_level_r = blackLevelStatus->blackLevelR; + blackLevel.black_level_g = blackLevelStatus->blackLevelG; + blackLevel.black_level_b = blackLevelStatus->blackLevelB; ControlValue c(Span{ reinterpret_cast(&blackLevel), sizeof(blackLevel) }); @@ -1281,8 +1281,8 @@ void IPARPi::applyDenoise(const struct DenoiseStatus *denoiseStatus, ControlList DenoiseMode mode = static_cast(denoiseStatus->mode); denoise.enabled = mode != DenoiseMode::Off; - denoise.constant = denoiseStatus->noise_constant; - denoise.slope.num = 1000 * denoiseStatus->noise_slope; + denoise.constant = denoiseStatus->noiseConstant; + denoise.slope.num = 1000 * denoiseStatus->noiseSlope; denoise.slope.den = 1000; denoise.strength.num = 1000 * denoiseStatus->strength; denoise.strength.den = 1000;