From patchwork Fri Jul 14 14:26:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18833 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 26F2CC3243 for ; Fri, 14 Jul 2023 14:26:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1CD37628C6; Fri, 14 Jul 2023 16:26:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1689344817; bh=9Kta1lfznw4qKHx0EmPOtWEqvppqoOB+TGqdiXb7qpA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=HAxH7ynbZoi24lUXrrwZ87xtGHdCe82PE8+Py1RdWhlXcw2gj2ZtRpYH1dC4C1U0S RArzzgUsl6962WzOiRMQNBpbw4KX57cohQOw1SoHsDW0Ovl3woZghyz2Ggmyt0wljG FNaRLwNG91yJFRnxHfM2ng3bX/ur1HEUDAy01JsPV3Pql6biPGrO+kReXTRA9e77TA Qvv0o5qmYRvS0XJ6S2LCNIdmw7GWw79qdQF4V+z3DFesbNO5Y/UR2tTwbhhQWwQT62 iCl7kFNU2uO7JzGUhO+W5wLJSvfH1+K3IEs/ddj2XCi6GNqIBre2CwA/wHRzN5aY+h L3SGh1b4txYnQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E090460382 for ; Fri, 14 Jul 2023 16:26:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="H/XOOHUG"; dkim-atps=neutral Received: from uno.localdomain (mob-5-90-9-92.net.vodafone.it [5.90.9.92]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A5C6DB75; Fri, 14 Jul 2023 16:26:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1689344764; bh=9Kta1lfznw4qKHx0EmPOtWEqvppqoOB+TGqdiXb7qpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H/XOOHUGrWaa4yY2Vr4WofREzK2SxxhDTTyrZVfX/MH3exo8lgjJpSp9fmiz8mt4D fotVjTTW2Znh1JlodtDa04AH/3hN2jTKuD0GWalhYeAGSrQ34snnC1s9+sTY6zK+ho oAxEJ3BB1YqmVfAagEFLgc1V1IWK7BZZa+nHuoVg= To: libcamera-devel@lists.libcamera.org Date: Fri, 14 Jul 2023 16:26:32 +0200 Message-Id: <20230714142634.13134-2-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230714142634.13134-1-jacopo.mondi@ideasonboard.com> References: <20230714142634.13134-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/3] libcamera: rpi: pipeline_base: Remove populateSensorFormats() 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: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" populateSensorFormats() is a static helper that is called from a single place and performs a simple loop over the sensor camera formats. Remove it and in-line it in the caller to remove one static helper from the pipeline_base.cpp file. Signed-off-by: Jacopo Mondi Reviewed-by: Naushir Patuck Reviewed-by: Kieran Bingham --- .../pipeline/rpi/common/pipeline_base.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index 179a5b81a516..fb3756a47590 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -66,16 +66,6 @@ PixelFormat mbusCodeToPixelFormat(unsigned int mbus_code, return pix; } -SensorFormats populateSensorFormats(std::unique_ptr &sensor) -{ - SensorFormats formats; - - for (auto const mbusCode : sensor->mbusCodes()) - formats.emplace(mbusCode, sensor->sizes(mbusCode)); - - return formats; -} - bool isMonoSensor(std::unique_ptr &sensor) { unsigned int mbusCode = sensor->mbusCodes()[0]; @@ -804,7 +794,10 @@ int PipelineHandlerBase::registerCamera(std::unique_ptr &camera if (data->sensor_->init()) return -EINVAL; - data->sensorFormats_ = populateSensorFormats(data->sensor_); + /* Populate the map of sensor supported formats and sizes. */ + for (auto const mbusCode : data->sensor_->mbusCodes()) + data->sensorFormats_.emplace(mbusCode, + data->sensor_->sizes(mbusCode)); /* * Enumerate all the Video Mux/Bridge devices across the sensor -> Fr