From patchwork Mon Jul 24 09:59:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18874 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 32440C324E for ; Mon, 24 Jul 2023 09:59:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7EBC5628C5; Mon, 24 Jul 2023 11:59:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1690192781; 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=E+nh7xIP6qy0H25TTvzyFl7DFzF6DYNlzhKYvLFIusEpSvUjEQ+fhOE63ukg8xu/S +LSfL3NfWw6zzTUtLljfSixf7FP51S3jbpG/I+X4mZKIyjYsDP+2RW1L7HDO1MX1LU s5LA5RscoD3l7jt5VgVevX1DUBZI0apzDJh9Esbbtl8U3DvmyqidempVeQapfhLWgJ 4I1lQFpL+eVViw0weVEEyNUFb0sHszbjRrheUnifV/cN/MJkxeObMPa4wFf7RyikAV lxEwBOoNqfS9l8Seiz0IFy0xEr/g7urU6rGleJQ5CX2xMwahTU9ZmievdBsytCadEm BRLB/bhYz6ing== 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 03BFF60387 for ; Mon, 24 Jul 2023 11:59:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="BC84txmz"; dkim-atps=neutral Received: from uno.localdomain (mob-5-91-20-233.net.vodafone.it [5.91.20.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 14089127D; Mon, 24 Jul 2023 11:58:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1690192721; bh=9Kta1lfznw4qKHx0EmPOtWEqvppqoOB+TGqdiXb7qpA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BC84txmzKur1Yw8n3jHM/cApE1+wXMzcnRPphHpqRqKQLdzMqRobg79hjDoTjCVIp CCxXuyTM7+zjbwZvUxsyV59Bl7Wu9CaCbE2RgwmErahSaoE9Wy4ltG9ZDK3teotiVg nCFxcqeBRXxyykQyPEbFojy1Xjbv3NTweKQL4y+Q= To: libcamera-devel@lists.libcamera.org Date: Mon, 24 Jul 2023 11:59:23 +0200 Message-Id: <20230724095925.20877-2-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230724095925.20877-1-jacopo.mondi@ideasonboard.com> References: <20230724095925.20877-1-jacopo.mondi@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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