From patchwork Wed Oct 5 11:31:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17529 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 61C36BD16B for ; Wed, 5 Oct 2022 11:31:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BAF5A622F3; Wed, 5 Oct 2022 13:31:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664969512; bh=JbxNExpetysfWikibUElVypom/54EsDtBmEs15i+19c=; 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=ON++2pBtgZqSBngT/N2MfsJ/YPIhP0GCErT9GnWDtjsYG3DrOdkf7ROgZQ1O+MvYg j/8MwV6F1SK99G2vL1W5XAZyenhleteJCfyfyT99McJOrBX3pOI8sxaOSczRRQZ4nc +IyHubmvPigWCW4xaZCQhw6Rvd9z7WYOcbNQN7taVCR8tll3mNadTyXabPrhYKW/+t 5ayGu953SrPN8Vb6pCotfv34RomXq5OKe6AMmAbKl8WRECIfNcLGt7uiX78dIKc+jJ SdPn582O/ZggGp7TuxMuypL++uzIm930PY/KYy5ICGJjACUAVQjJlyJta3Ezqt95DW dao7MVsfg4g0Q== Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1CFDB601C7 for ; Wed, 5 Oct 2022 13:31:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="VQ8BoDQ0"; dkim-atps=neutral Received: by mail-wr1-x429.google.com with SMTP id bk15so25503698wrb.13 for ; Wed, 05 Oct 2022 04:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=Ni216vs3iUMM6P4IkW7PaMnrdX6UHLhWcGTCrT1tzE0=; b=VQ8BoDQ0u+WQ6bmVL+d9c367yru/ihya5ugvRIxW8ktM6sVbQuFrMKeBvA2ZoDrEd6 oU9UA4cE7MfDuEEsMuANhJlhZccsVIcAdqZxiktkJLImG+94Z9jEBqvZA/XG+Y5jg1Ee Z9BItju1PL34RRFASIcNQSJr3FSfZ6MkxWjwR1GfIbpywL268VsSJ0Kc9cgojt4vct7l 1ZeLDR2tVE9ra1VYYH9rBCb2SRNkirA+Vn2+kZ7j8sYQzfTdKNyoRNqyryDD9QHih6/K y1kZJ50nD/L7mwSjr/8Mn1O2DrZkGQrLaUtER/5YEVzTtGWJ6dYr0LNXcDR8jsTZH7T9 0UEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=Ni216vs3iUMM6P4IkW7PaMnrdX6UHLhWcGTCrT1tzE0=; b=lbrKMJxwNYnw097et8zKAFLLWB9HV7v+d3IA45SGXLJE3z/f8PWhXYPeGSf/iNpktr Fz4gTgsG5W492rTZ6sAF8jLAPzyRK1pso4CiN4JTt4AP/8mScaQbA3/lXgcehoa0Goif SysFI7MtcdexSMjVDPG2T5vtbTrHkUZuz+5tRTA18GrIDfLkwOVtv9in+jwGPCzhCVDA NhlpC9cgg5TU96JIzrc060bmRnJfXzo90OoqtlI4rZlGvIMeTi9wgsdVItwt49LlEzoj EPzmBW+vd7IFuYP2eMyH8t7szpOYaCUSQO0e5T2AKQyEJxN9ewz/Y5ZhdHqf6YZG95R1 rKZA== X-Gm-Message-State: ACrzQf1HQrVrFsN/Kp7zlC2cUb8PCMSLSf12qkVt0PLa8isOfCf8Uv72 enaXBlrESRiMGRaMANXS6CTXfxjkvvLCzA== X-Google-Smtp-Source: AMsMyM4xeOAsOc+1TPyqNq5fu35uext2zglJdony+fqho20GoH2b/o82xUH785hb1prjeBF0JvJUEw== X-Received: by 2002:a5d:4a4d:0:b0:22d:c8cb:8687 with SMTP id v13-20020a5d4a4d000000b0022dc8cb8687mr14898530wrs.554.1664969510503; Wed, 05 Oct 2022 04:31:50 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id ck14-20020a5d5e8e000000b0022e3978fd07sm9187429wrb.39.2022.10.05.04.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 04:31:50 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 5 Oct 2022 12:31:45 +0100 Message-Id: <20221005113145.9325-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221003095558.1993-3-naush@raspberrypi.com> References: <20221003095558.1993-3-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] pipeline: raspberrypi: Update naming convention for tuning files X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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" Append "_mono" to the sensor name when generating the tuning filename for monochrome sensor variants. So the new naming convention is as follows: .json - Standard colour sensor variant _mono.json - Monochrom sensor variant Rename the existing imx296.json file to imx296_mono.json as this tuning file is based on the monochrome variant of the IMX296. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- .../data/{imx296.json => imx296_mono.json} | 0 src/ipa/raspberrypi/data/meson.build | 2 +- .../pipeline/raspberrypi/raspberrypi.cpp | 18 +++++++++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) rename src/ipa/raspberrypi/data/{imx296.json => imx296_mono.json} (100%) diff --git a/src/ipa/raspberrypi/data/imx296.json b/src/ipa/raspberrypi/data/imx296_mono.json similarity index 100% rename from src/ipa/raspberrypi/data/imx296.json rename to src/ipa/raspberrypi/data/imx296_mono.json diff --git a/src/ipa/raspberrypi/data/meson.build b/src/ipa/raspberrypi/data/meson.build index 211811cfa915..465a7a17ce6f 100644 --- a/src/ipa/raspberrypi/data/meson.build +++ b/src/ipa/raspberrypi/data/meson.build @@ -4,7 +4,7 @@ conf_files = files([ 'imx219.json', 'imx219_noir.json', 'imx290.json', - 'imx296.json', + 'imx296_mono.json', 'imx378.json', 'imx477.json', 'imx477_noir.json', diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index dcd81650c32d..5d77715f3448 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -67,6 +67,14 @@ SensorFormats populateSensorFormats(std::unique_ptr &sensor) return formats; } +bool isMonoSensor(std::unique_ptr &sensor) +{ + unsigned int mbusCode = sensor->mbusCodes()[0]; + const BayerFormat &bayer = BayerFormat::fromMbusCode(mbusCode); + + return bayer.order == BayerFormat::Order::MONO; +} + PixelFormat mbusCodeToPixelFormat(unsigned int mbus_code, BayerFormat::Packing packingReq) { @@ -1551,10 +1559,14 @@ int RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result) */ std::string configurationFile; char const *configFromEnv = utils::secure_getenv("LIBCAMERA_RPI_TUNING_FILE"); - if (!configFromEnv || *configFromEnv == '\0') - configurationFile = ipa_->configurationFile(sensor_->model() + ".json"); - else + if (!configFromEnv || *configFromEnv == '\0') { + std::string model = sensor_->model(); + if (isMonoSensor(sensor_)) + model += "_mono"; + configurationFile = ipa_->configurationFile(model + ".json"); + } else { configurationFile = std::string(configFromEnv); + } IPASettings settings(configurationFile, sensor_->model());