From patchwork Mon Jun 5 08:26:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18701 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 D09A1C328F for ; Mon, 5 Jun 2023 08:26:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AEAFE62888; Mon, 5 Jun 2023 10:26:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1685953572; bh=0TjsBclAlE6H5qPR1974twQdZQ9SbFZs1nB0jRN66Gc=; 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=oQEFADirT+y8DQdyje0aDI2RN50/VwX3TMNcZnGaSHJ/sqe6hmSJgLnm9WEbQ0ZaR i0I3ZRq84BqYVme3DMQnVmb0g05CwVj6SdHzaIyu4skaeYlVSALLNYIEhbek8z8o/k IPTitvy1Dh+zItJlMpLbiA0sSJfy5DdE08v3xJeBLSs23EfRbNeaXkMyrQ8GVV8taC eP/oArPu8XsMbOGIzx17pIZDcELWNhUEm7+S+RReQFRunEN7V2LVyQa6JgQubYAc2P IO1NTXgK2sw8ycI+K0kS0w+9+FIB5L8fDyVbTYaTZ5lPxdk76rNC44y4sC/E6jIG74 KQinuZ+re+LBA== Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 27C0A61EA2 for ; Mon, 5 Jun 2023 10:26:11 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="YNY9WF8n"; dkim-atps=neutral Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f6a6b9c079so37527225e9.1 for ; Mon, 05 Jun 2023 01:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1685953570; x=1688545570; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GJ1SsWfssQVXGTqyavpfiDT9rBEE80I2lxQHY49BRFw=; b=YNY9WF8nq7uhUrVEhAGnNQE6DdppO2I4S++9xtgGXyFbvZ/7sYZ9YBy42cgiD6ftjB 205ZRd3/we+BeKPKnQwPdNfLQQm3YZbfRYeXwA8JBpVezMNAqgXg4jGXWyQy6RRjNwvI EMOWg5CK6sTb+sZMFiy5CQ84kSbu6LjBczvDs3jsYZJpuFB+K/HvE8pAPEsSThZAg1/p 7Y7WG3D7aQN8FpCtPLZvOQoOu3LK5nyLn/XyKg3ndt42ipMEDtq75/7/Kd64aRk2n745 dDgFjYFzBwR07zgonJSp9pk1ahsDdRqKBHohONPpIYlARedu6Sm+klY/3/XIH5KwesXu L8FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685953570; x=1688545570; 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:message-id:reply-to; bh=GJ1SsWfssQVXGTqyavpfiDT9rBEE80I2lxQHY49BRFw=; b=MRq0KIeMVorrlNuBWfcxwGf673akBAGX9VyqP6XsCFm+89ITwH7uDEGRAh/YhXyB2w b/cuYRcLy4QpxdVmzPgBwiBVrIwTBxNg8C5T1EbOBbN5qudhtvpsexO+cQkTZoOgut20 I4vMHfI1yPShuuGrGtDeXD7hLbpsn+P3nTPNfCRBJCDCoDqiTAsTvmHK3LslyziA4JzV CxIuF/4u4KWiO9LZqKYLzm5u4BBaYNZKzQAlrTBEIboBW+tpJfkTxb1tK1qKWFQK/EJD DZHVP8KbKOEMveoebKnR0a7GBLew6AoPkikr4mh21d44Adg3vqaxb75VWbro6nNjgZmw 8XUg== X-Gm-Message-State: AC+VfDyH+jU6zexLuPTu99j9bPXnvJ+J0tVKhGnDH9wLZrjNiKlItUag DwVys6k5csu+IIgNriw88wANz1mI/DIVbJg6tc9U/A== X-Google-Smtp-Source: ACHHUZ7VdFNLwLLPOrthhd+S1yzOIrl4QotNwludWleuo/f7Q/VVVMxIG2Ft/sBXSFyCrsahcX7tbw== X-Received: by 2002:a7b:ce89:0:b0:3f6:552:8722 with SMTP id q9-20020a7bce89000000b003f605528722mr6277290wmj.18.1685953570463; Mon, 05 Jun 2023 01:26:10 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id 12-20020a05600c020c00b003f080b2f9f4sm13520686wmi.27.2023.06.05.01.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jun 2023 01:26:09 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 5 Jun 2023 09:26:04 +0100 Message-Id: <20230605082605.9993-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230605082605.9993-1-naush@raspberrypi.com> References: <20230605082605.9993-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/2] camera_sensor: ipa: core: Add CFA pattern to IPACameraSensorInfo 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" Add a new cfaPattern field to the IPACameraSensorInfo to pass the CFA/Bayer pattern for the current sensor configuration to the IPA. This field takes a value from properties::draft::ColorFilterArrangementEnum. Populate cfaPattern in CameraSensor::sensorInfo(), called by the pipeline handler before it calls ipa->init() and ipa->config(). Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/core.mojom | 13 +++++++++++++ src/libcamera/camera_sensor.cpp | 3 +++ 2 files changed, 16 insertions(+) diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom index 5cef340d014c..bce797245829 100644 --- a/include/libcamera/ipa/core.mojom +++ b/include/libcamera/ipa/core.mojom @@ -140,6 +140,18 @@ module libcamera; * image sensor */ +/** + * \var IPACameraSensorInfo::cfaPattern + * \brief The arrangement of colour filters on the image sensor + * + * This takes a value defined by properties::draft::ColorFilterArrangementEnum. + * For non-Bayer colour sensors, the cfaPattern will be set to + * properties::draft::ColorFilterArrangementEnum::RGB. + * + * \todo Make this variable optional once mojom supports it, instead of using + * RGB for sensors that don't have a CFA. + */ + /** * \var IPACameraSensorInfo::activeAreaSize * \brief The size of the pixel array active area of the sensor @@ -229,6 +241,7 @@ struct IPACameraSensorInfo { string model; uint32 bitsPerPixel; + uint32 cfaPattern; Size activeAreaSize; Rectangle analogCrop; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 06f315210240..60bf87b49e6e 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -956,6 +956,9 @@ int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const info->bitsPerPixel = format.bitsPerPixel(); info->outputSize = format.size; + std::optional cfa = properties_.get(properties::draft::ColorFilterArrangement); + info->cfaPattern = cfa ? *cfa : properties::draft::RGB; + /* * Retrieve the pixel rate, line length and minimum/maximum frame * duration through V4L2 controls. Support for the V4L2_CID_PIXEL_RATE,