{"id":17457,"url":"https://patchwork.libcamera.org/api/patches/17457/?format=json","web_url":"https://patchwork.libcamera.org/patch/17457/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220929072323.7400-3-naush@raspberrypi.com>","date":"2022-09-29T07:23:21","name":"[libcamera-devel,v2,2/4] pipeline: raspberrypi: Update naming convention for tuning files","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d9a34a0341a080319d3ac29bd7a07349b5ec46fd","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/17457/mbox/","series":[{"id":3512,"url":"https://patchwork.libcamera.org/api/series/3512/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3512","date":"2022-09-29T07:23:19","name":"imx296 colour tuning","version":2,"mbox":"https://patchwork.libcamera.org/series/3512/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17457/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17457/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 2E736C327E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 29 Sep 2022 07:23:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D83476238C;\n\tThu, 29 Sep 2022 09:23:47 +0200 (CEST)","from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com\n\t[IPv6:2a00:1450:4864:20::42b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 34B6562382\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 29 Sep 2022 09:23:44 +0200 (CEST)","by mail-wr1-x42b.google.com with SMTP id l18so715209wrw.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 29 Sep 2022 00:23:44 -0700 (PDT)","from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tj6-20020a05600c1c0600b003b483000583sm3929805wms.48.2022.09.29.00.23.43\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 29 Sep 2022 00:23:43 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664436227;\n\tbh=kU9wz2MQ4WGRhLr0lOWv5a/QXb2aqxiDnVXEonkk9NQ=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=pIupJ0/HeRsnYTnStWkvGl4cw9bEnBV5WsnuK1BArZ84CMJ6/VRAXlFuZHv/vUlbN\n\thUGRc81eZTPVOe/EzODe6LZJMIesvHvSxcPUb+Tag6iqa6WCgBAzy9mmZH8g/TougO\n\tlJ/f6uV9YmYaQ8y6suStVmeM2CQYL1OXBlj3mmJLVG3od7IrneOiYAgeQGCuAyPPTe\n\tOkcWPmb/mAA6TEDWYAmilviYtcAFDr9WzesBdhI4YXhXRPZqC+1cbUcUW7GjJUJgnI\n\tLolho+bT6Iz065967FrtD2Nb781iIACgkfNZnvlQLIqPwtAtLl+aC2n7GcXH6FE/CX\n\toyoTy9f8CAu7w==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date;\n\tbh=kUDItE9+1JuV24FNoBhZOcSOH20Ov/sgW1kXAAJzY2k=;\n\tb=bwyGdUTVgyPAIKs4PBQzxhquMSON/aZYsjg1xQG3OjeBhwRawuTsApFySSQla5tf9P\n\tE/J+8DyNBjEx0qgNH1Vg7cnKRXiZ6YzCTvyorL+HBPUz4sx+AJhFHkkOE+HfhVmTfYx9\n\tqfMgwjJpTwKpum3YbK4vW1bVaAzj8D2BV1Dujd2xKeG2G9qLVmjpvxBT9EU5W5nL3Qxq\n\tzOQqo6x+sRTGuGV6B5xjgJ0V/nWiVFOf6in5CcvFoY1ARuNw1pSNgkT5Y7xGx2+UaVvF\n\tmdT4SdBip+N/iVX28Q50jKqDJnL9w/jDzTvr7KTOroj0r2SBLIzWDnWq3wzYNZkEUXRp\n\tNFgw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"bwyGdUTV\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date;\n\tbh=kUDItE9+1JuV24FNoBhZOcSOH20Ov/sgW1kXAAJzY2k=;\n\tb=hZpcdoFjapYXfpDBXN0KRYxj8JNfAVFNhw/FXrthQlG6bxp+VyXykm00q9+0IN3wbk\n\tHOgkm5A38I68CFQry+0tsa88qPLAjOb+jLgfUqX1cLXgZ+8nN+vda9fKTiHVS2gQQPbk\n\tKVq5r5uc/gq8Dhmk2EqCIGf4f7CMfTnfVVtuWKfe/9W9d0HIgOjE8G7TJkY8EZ44QOf2\n\ta88Z5Rg+lXmYMroA0KlWHJJ1OznKIVPkqrL6S8WbgrVvi/Y2VdHzX2vbLbHBGP57ly9+\n\tM5itHtlSAtQ1oNxQSHvthRCMeG4SVWadjQ0/so7MmVRtOjEaLIdUdAV9gBC/3+TqmUUz\n\tN8Vg==","X-Gm-Message-State":"ACrzQf1yh4n8LRHTZR577QTaa16u78Of2YS8Ddv4XxCw8Xbxy1Y4EuKW\n\tNiTOJg3iDyowCS5p5x5NoczzUrRMzP3NOw==","X-Google-Smtp-Source":"AMsMyM5NvljjxQV3znqTfkg7IxOJwk0rhBRFLoklkshFU3IWMO9cd9tYropKgAIJkqV3CEM4lOVKzQ==","X-Received":"by 2002:a05:6000:887:b0:21e:24a0:f302 with SMTP id\n\tca7-20020a056000088700b0021e24a0f302mr1044314wrb.466.1664436223630; \n\tThu, 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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 2/4] pipeline: raspberrypi: Update\n\tnaming convention for tuning files","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Append \"_mono\" to the sensor name when generating the tuning filename for\nmonochrome sensor variants. So the new naming convention is as follows:\n\n<sensor_name>.json - Standard colour sensor variant\n<sensor_name>_mono.json - Monochrom sensor variant\n\nRename the existing imx296.json file to imx296_mono.json as this tuning file\nis based on the monochrome variant of the IMX296.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../data/{imx296.json => imx296_mono.json}    |  0\n src/ipa/raspberrypi/data/meson.build          |  2 +-\n .../pipeline/raspberrypi/raspberrypi.cpp      | 22 ++++++++++++++-----\n 3 files changed, 18 insertions(+), 6 deletions(-)\n rename src/ipa/raspberrypi/data/{imx296.json => imx296_mono.json} (100%)","diff":"diff --git a/src/ipa/raspberrypi/data/imx296.json b/src/ipa/raspberrypi/data/imx296_mono.json\nsimilarity index 100%\nrename from src/ipa/raspberrypi/data/imx296.json\nrename to src/ipa/raspberrypi/data/imx296_mono.json\ndiff --git a/src/ipa/raspberrypi/data/meson.build b/src/ipa/raspberrypi/data/meson.build\nindex 211811cfa915..465a7a17ce6f 100644\n--- a/src/ipa/raspberrypi/data/meson.build\n+++ b/src/ipa/raspberrypi/data/meson.build\n@@ -4,7 +4,7 @@ conf_files = files([\n     'imx219.json',\n     'imx219_noir.json',\n     'imx290.json',\n-    'imx296.json',\n+    'imx296_mono.json',\n     'imx378.json',\n     'imx477.json',\n     'imx477_noir.json',\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex dcd81650c32d..dab17c34d370 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -67,6 +67,14 @@ SensorFormats populateSensorFormats(std::unique_ptr<CameraSensor> &sensor)\n \treturn formats;\n }\n \n+bool isMonoSensor(std::unique_ptr<CameraSensor> &sensor)\n+{\n+\tunsigned int mbusCode = sensor->mbusCodes()[0];\n+\tconst BayerFormat &bayer = BayerFormat::fromMbusCode(mbusCode);\n+\n+\treturn bayer.order == BayerFormat::Order::MONO;\n+}\n+\n PixelFormat mbusCodeToPixelFormat(unsigned int mbus_code,\n \t\t\t\t  BayerFormat::Packing packingReq)\n {\n@@ -1551,12 +1559,16 @@ int RPiCameraData::loadIPA(ipa::RPi::IPAInitResult *result)\n \t */\n \tstd::string configurationFile;\n \tchar const *configFromEnv = utils::secure_getenv(\"LIBCAMERA_RPI_TUNING_FILE\");\n-\tif (!configFromEnv || *configFromEnv == '\\0')\n-\t\tconfigurationFile = ipa_->configurationFile(sensor_->model() + \".json\");\n-\telse\n-\t\tconfigurationFile = std::string(configFromEnv);\n+\tstd::string model = sensor_->model();\n+\tif (!configFromEnv || *configFromEnv == '\\0') {\n+\t\tif (isMonoSensor(sensor_))\n+\t\t\tmodel += \"_mono\";\n+\t\tconfigurationFile = ipa_->configurationFile(model + \".json\");\n+\t} else {\n+\t\tconfigurationFile = model;\n+\t}\n \n-\tIPASettings settings(configurationFile, sensor_->model());\n+\tIPASettings settings(configurationFile, model);\n \n \treturn ipa_->init(settings, result);\n }\n","prefixes":["libcamera-devel","v2","2/4"]}