From patchwork Mon Oct 3 09:55:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17499 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 6A1EFC327C for ; Mon, 3 Oct 2022 09:56:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C10FB62CEE; Mon, 3 Oct 2022 11:56:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664790968; bh=70dY/2yOG09GmxWV4XkYxNxjmwdy+OBE7EfCZ8fYhOQ=; 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=WcE2WDZkA1A3D3QAKh+aNftHp+wpDpgsnKL6dNpnjm9yjM7KwlUtmg+ZglbfAwgsk GAqNIFvAwv4J2dY80+7w+Iv0Ebv6vgBVmZcMUC5sFAuzFl1VyyMI1yIPRt/0ksya5R dqVxQ8UgHoBkJXKZa8M1nlcRFnr6qRD431ltgjFqpS21nfD4IxbOXROeF2W3zNUTRC jgaAoAqC07kAf6Bt6UnpHFUxJsU9DEarxkL3p+j333n2VINa1Dh8SW0x3Nn8+AvEWu QeHTzlxMogAjUntJC9nybYcfVd2VQbiNDze5whq3aEgiwPPWWTGTIB5IgV9HY9onOG C6hsgGGDoWGFQ== Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DC63262CDF for ; Mon, 3 Oct 2022 11:56:05 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="eCGhXujS"; dkim-atps=neutral Received: by mail-wr1-x430.google.com with SMTP id j16so3958597wrh.5 for ; Mon, 03 Oct 2022 02:56:05 -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=5AJn6sGm0U4RPdVN5h5oRKuT8tBty6smtZCUrNTqYQg=; b=eCGhXujSsWJnfF6hyYU1oGoBPF76Adn9olkEkjwnRtjF5D1ExGw7VATdskZtR0GHZU +3iCrV1totICFgVJ/O0PM58nYfK/xsZr0JNOC4sXHKHoFQHtwr7uX3W4/sDUKmDUOAKE b+kCaeeoEKUCDlpJQra2icY/i5wMbsjlCUI48gK21AqUxD+WbPmztLPrOFCW/KYGPdoE iDx/YTk675MR/KSmelYJXkDPZ+bPeH5iYYkXo2JZypZGyACJTPMhIKSI8Wfo3BeGjUgG NAal1o3yd+LNQB6l2CqD7h98DugbXZEv9ea76uDvVo3iYDHzmF4Wk6g+7DVOaUSpdMUW pqmg== 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=5AJn6sGm0U4RPdVN5h5oRKuT8tBty6smtZCUrNTqYQg=; b=ifIgZkdpmnUrRC6nWE9rXW1gecZBoU/UtUH/2luYr4Wxv8cv3p2W6J4WR8IYx6Orjm zhKKfVuQz3hSFwOALMCW6a4DVvr4We8c8ICO6canLvhBTYJztJyptXMmuKHdYTLLc4+P q2mpYCJwbeaHpPiT5no8FRuOHxNgNa7wUbaG+MHxi0Tm4wjoqIVaO5u9wPMJEddlFzst FHLfisBYetfEKucygB3nzGWOyCNt4i4i3clL/DKo2H1SUN0u31Epg3x5DHouA9Kzv5ra JBvu/Jndj8jqevv0UUwvUwwUCdSgjxtIVVnhw25QOLHIey5TTSs54TUD7+WMkEedQTWC XLNg== X-Gm-Message-State: ACrzQf2rXebkSdPq82CGyZQnO+qvVJGpkPTSLGCQzdb+OGwatngCgAnl r21Ykzkdiy/C+pTvYg8u0PQg2lSakfhNFw== X-Google-Smtp-Source: AMsMyM6FaQuXx6uPHzJ2Ksep5dnykcsOJO8lNL8VNoOyFaAs18ceytyhq9lZRJeFDgv18uf7IhcaEw== X-Received: by 2002:a5d:5846:0:b0:22a:f7d2:9045 with SMTP id i6-20020a5d5846000000b0022af7d29045mr13104889wrf.250.1664790965207; Mon, 03 Oct 2022 02:56:05 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id z10-20020a5d4c8a000000b002286670bafasm9120637wrs.48.2022.10.03.02.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 02:56:04 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 3 Oct 2022 10:55:56 +0100 Message-Id: <20221003095558.1993-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221003095558.1993-1-naush@raspberrypi.com> References: <20221003095558.1993-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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: David Plowman --- .../data/{imx296.json => imx296_mono.json} | 0 src/ipa/raspberrypi/data/meson.build | 2 +- .../pipeline/raspberrypi/raspberrypi.cpp | 20 +++++++++++++++---- 3 files changed, 17 insertions(+), 5 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..39a1c798df2e 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 + std::string model = sensor_->model(); + if (!configFromEnv || *configFromEnv == '\0') { + if (isMonoSensor(sensor_)) + model += "_mono"; + configurationFile = ipa_->configurationFile(model + ".json"); + } else { configurationFile = std::string(configFromEnv); + } - IPASettings settings(configurationFile, sensor_->model()); + IPASettings settings(configurationFile, model); return ipa_->init(settings, result); }