From patchwork Mon Aug 15 14:16:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 17126 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 126E3C3275 for ; Mon, 15 Aug 2022 14:16:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 471AB61FC3; Mon, 15 Aug 2022 16:16:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660573004; bh=rIIajOFKp9ZjL0mcrvMOoRmPXcgEIbo4XaxMju+7nYA=; 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=DXi63At4tl3hFqaXVixgfIfXnXWd+IhZIZkzNhC2Mtw0hKA0vY9j5WEnoTdpaSV7c w1Tc1g10tFmM8qJ0AWqLjrgKNNFs29wvvH1WjTe40KIVCllj8oB0o0lNG6wiugajyQ Q7t9iYyQvdBg1CbNXDNh7dce3HKpIr4Q8LSLggxrf+pwFmSFv3E5dqV6c/PWqu3qUP hKMA5PvV/aMhCu7vyM9tBTx3emAUwtTTGCO8l3saNS937BNybWd/hJK0vBW2lezOuQ HfOm4P1x2vNGzeTqIyCP4RAriOW+5aulGsbZnxez6lKZcgF1BcwG7Gk4baUi8HNt3O IngGQlvvN1usw== Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C910261FB9 for ; Mon, 15 Aug 2022 16:16:41 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="e46ATPYl"; dkim-atps=neutral Received: by mail-wr1-x434.google.com with SMTP id p10so9234373wru.8 for ; Mon, 15 Aug 2022 07:16:41 -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; bh=WqJMQJDQa8+nipPssOgsvURKS1sR066j+Z99ngQ+u8E=; b=e46ATPYliZCMvRUUFxZb+EITQ2M7bjRbXSznDYXbI8xUCPtnw0kCxyqbXrd39wNSsX JFE/VU0CC1lB542tOOfCfovERqS1ndQtFsi8OfQVjOXVzfjj+KEmQ28JiXGD1TyoSBQD PJR8BChGVuEuoGOnIPT7v7XhescLO5VCteNHVTn6dbRiLaG8zxjPrh4Io2PaNTvmCgaT 2FO1nfCQm3liabei3owLCXEXpainkSeGurcrrPwnZWiVnJOU5hb+GOuC7A/Xwnrzcdqy hYEFpVaT52tY/xQT339y8jn7P9/W1WqtJ2CqOq7/2PqOAfWE+IQs4f9sWcVjW5O4MjDN Y3sw== 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; bh=WqJMQJDQa8+nipPssOgsvURKS1sR066j+Z99ngQ+u8E=; b=1IPsN49fDq/ZxPnFZAXf1RsjTaaLwmiKXHDNE6+sjmVdidXo9zcOr1hRzRysegfe9A EJtJWsnhzcYbhXlILucVDHgHV8oBLmKU1YXPZ3YcAL+7k9mo6CseOXebzLrq6xkFZBJr 6mYN69c24aqsegNE/sl8F7mhO0CdqphMMiQsKF2zexZcLRqweJGSSat5qPaJbh4HI8vg m12ypLArvIjJeT/PI+dzgoo6SpoeSlzCDN4OMiQ52wsbjiBZX24T+1TpXKh5WYD6VyBz /E1MRkvRbnJw9lnjZTAx1OIqVswwug4XRw/ncZcU027ino06s6SeeDOy4gLs1ffDMQ6Y 2SeA== X-Gm-Message-State: ACgBeo1WvfzGOemunCoaSr4Tx3v3B5xh7AXvvA68iuQe248W3HImsi9x +XGFzgNWV5MwPtxwbc1fnrulo4TQ4LzmHw== X-Google-Smtp-Source: AA6agR73ru1PSXPtjZMZ6xKc0WIpuUsO4jm3UjUKJGzkTfnCsZZoTTY8kJwOM2G9xvtctdTqM+oaQA== X-Received: by 2002:a5d:61c4:0:b0:21e:e00c:f8b4 with SMTP id q4-20020a5d61c4000000b0021ee00cf8b4mr8453386wrv.145.1660573001282; Mon, 15 Aug 2022 07:16:41 -0700 (PDT) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:e4a2:3070:eea4:e434]) by smtp.gmail.com with ESMTPSA id bk12-20020a0560001d8c00b0021f0ff1bc6csm7294282wrb.41.2022.08.15.07.16.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 07:16:40 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 15 Aug 2022 15:16:37 +0100 Message-Id: <20220815141637.4159-2-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220815141637.4159-1-david.plowman@raspberrypi.com> References: <20220815141637.4159-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/1] pipeline: raspberrypi: Detect monochrome "R" formats as being raw 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: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The "R" pixel formats (R8, R10, R10_CSI2P etc.) record the associated colour space as being YUV rather than RAW, meaning that the code was not detecting them as being raw formats. In the case of Raspberry Pi, we deal only with raw formats, so the revised test must work correctly for both these and the standard Bayer formats. Signed-off-by: David Plowman Reviewed-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index e895584d..fae8e45e 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -105,18 +105,8 @@ V4L2DeviceFormat toV4L2DeviceFormat(const V4L2VideoDevice *dev, bool isRaw(const PixelFormat &pixFmt) { - /* - * The isRaw test might be redundant right now the pipeline handler only - * supports RAW sensors. Leave it in for now, just as a sanity check. - */ - if (!pixFmt.isValid()) - return false; - - const PixelFormatInfo &info = PixelFormatInfo::info(pixFmt); - if (!info.isValid()) - return false; - - return info.colourEncoding == PixelFormatInfo::ColourEncodingRAW; + /* This test works for both Bayer and raw mono formats. */ + return BayerFormat::fromPixelFormat(pixFmt).isValid(); } double scoreFormat(double desired, double actual)