From patchwork Thu Sep 29 07:23:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17457 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 2E736C327E for ; Thu, 29 Sep 2022 07:23:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D83476238C; Thu, 29 Sep 2022 09:23:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664436227; bh=kU9wz2MQ4WGRhLr0lOWv5a/QXb2aqxiDnVXEonkk9NQ=; 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=pIupJ0/HeRsnYTnStWkvGl4cw9bEnBV5WsnuK1BArZ84CMJ6/VRAXlFuZHv/vUlbN hUGRc81eZTPVOe/EzODe6LZJMIesvHvSxcPUb+Tag6iqa6WCgBAzy9mmZH8g/TougO lJ/f6uV9YmYaQ8y6suStVmeM2CQYL1OXBlj3mmJLVG3od7IrneOiYAgeQGCuAyPPTe OkcWPmb/mAA6TEDWYAmilviYtcAFDr9WzesBdhI4YXhXRPZqC+1cbUcUW7GjJUJgnI Lolho+bT6Iz065967FrtD2Nb781iIACgkfNZnvlQLIqPwtAtLl+aC2n7GcXH6FE/CX oyoTy9f8CAu7w== Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 34B6562382 for ; Thu, 29 Sep 2022 09:23:44 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="bwyGdUTV"; dkim-atps=neutral Received: by mail-wr1-x42b.google.com with SMTP id l18so715209wrw.9 for ; Thu, 29 Sep 2022 00:23:44 -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=kUDItE9+1JuV24FNoBhZOcSOH20Ov/sgW1kXAAJzY2k=; b=bwyGdUTVgyPAIKs4PBQzxhquMSON/aZYsjg1xQG3OjeBhwRawuTsApFySSQla5tf9P E/J+8DyNBjEx0qgNH1Vg7cnKRXiZ6YzCTvyorL+HBPUz4sx+AJhFHkkOE+HfhVmTfYx9 qfMgwjJpTwKpum3YbK4vW1bVaAzj8D2BV1Dujd2xKeG2G9qLVmjpvxBT9EU5W5nL3Qxq zOQqo6x+sRTGuGV6B5xjgJ0V/nWiVFOf6in5CcvFoY1ARuNw1pSNgkT5Y7xGx2+UaVvF mdT4SdBip+N/iVX28Q50jKqDJnL9w/jDzTvr7KTOroj0r2SBLIzWDnWq3wzYNZkEUXRp NFgw== 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=kUDItE9+1JuV24FNoBhZOcSOH20Ov/sgW1kXAAJzY2k=; b=hZpcdoFjapYXfpDBXN0KRYxj8JNfAVFNhw/FXrthQlG6bxp+VyXykm00q9+0IN3wbk HOgkm5A38I68CFQry+0tsa88qPLAjOb+jLgfUqX1cLXgZ+8nN+vda9fKTiHVS2gQQPbk KVq5r5uc/gq8Dhmk2EqCIGf4f7CMfTnfVVtuWKfe/9W9d0HIgOjE8G7TJkY8EZ44QOf2 a88Z5Rg+lXmYMroA0KlWHJJ1OznKIVPkqrL6S8WbgrVvi/Y2VdHzX2vbLbHBGP57ly9+ M5itHtlSAtQ1oNxQSHvthRCMeG4SVWadjQ0/so7MmVRtOjEaLIdUdAV9gBC/3+TqmUUz N8Vg== X-Gm-Message-State: ACrzQf1yh4n8LRHTZR577QTaa16u78Of2YS8Ddv4XxCw8Xbxy1Y4EuKW NiTOJg3iDyowCS5p5x5NoczzUrRMzP3NOw== X-Google-Smtp-Source: AMsMyM5NvljjxQV3znqTfkg7IxOJwk0rhBRFLoklkshFU3IWMO9cd9tYropKgAIJkqV3CEM4lOVKzQ== X-Received: by 2002:a05:6000:887:b0:21e:24a0:f302 with SMTP id ca7-20020a056000088700b0021e24a0f302mr1044314wrb.466.1664436223630; Thu, 29 Sep 2022 00:23:43 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id j6-20020a05600c1c0600b003b483000583sm3929805wms.48.2022.09.29.00.23.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 00:23:43 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 29 Sep 2022 08:23:21 +0100 Message-Id: <20220929072323.7400-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220929072323.7400-1-naush@raspberrypi.com> References: <20220929072323.7400-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/4] 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: Jacopo Mondi --- .../data/{imx296.json => imx296_mono.json} | 0 src/ipa/raspberrypi/data/meson.build | 2 +- .../pipeline/raspberrypi/raspberrypi.cpp | 22 ++++++++++++++----- 3 files changed, 18 insertions(+), 6 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..dab17c34d370 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,12 +1559,16 @@ 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 - configurationFile = std::string(configFromEnv); + std::string model = sensor_->model(); + if (!configFromEnv || *configFromEnv == '\0') { + if (isMonoSensor(sensor_)) + model += "_mono"; + configurationFile = ipa_->configurationFile(model + ".json"); + } else { + configurationFile = model; + } - IPASettings settings(configurationFile, sensor_->model()); + IPASettings settings(configurationFile, model); return ipa_->init(settings, result); }