From patchwork Mon Nov 15 16:12:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 14608 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 5B642BF415 for ; Mon, 15 Nov 2021 16:13:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 037276036C; Mon, 15 Nov 2021 17:13:05 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="XVMawex1"; dkim-atps=neutral Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6B5526038A for ; Mon, 15 Nov 2021 17:12:59 +0100 (CET) Received: by mail-wr1-x42e.google.com with SMTP id a9so5564227wrr.8 for ; Mon, 15 Nov 2021 08:12:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nUVlWu72PlyE29kbK+yxhDq/7AfELhGkPOIcJt8NS14=; b=XVMawex1WpM22FegeF6CknBX6PO3gxVlU5o/PF1oQtiDQucLhRtkcoOGOfMRHqUSPC WHR0/wg4xKHmcvVxU3/fctvePWjm+XjBtgTyuOMol1VD70073WRiYbJL8ojlZAzibn8N kFp98sg4g5AyX0HbUAUIPktYluKKd8zeKivSGwGGXqeIbqjkiAszjZPzjiZdHHC7YdRa RPnDbgtAPsfP+VqzgtJ22cs0Cy1ZqvzFWr96L9fDOYawU13+NaP6RyjtKaLrCMKPGUJB PL8k4OuLIYJh2rD5KctEIFOdyWF4L6SAlulOKOw8Wdw2Ny3DMCvYqBBXbGJVVMGyphyX F7cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nUVlWu72PlyE29kbK+yxhDq/7AfELhGkPOIcJt8NS14=; b=EdAiHo0IATwrecs2df8+0h9Km/nAz83Dq8UlX59vatiCbJefICe/24kTIREarbUn+3 7/ETZUzLm69uENGVRAtXVumUIEOw7yKDxSWJ/FNikDK07yN/OY5WOFqlXnS1Zr2cwc1s LpVDYu023NttZl4REygzFSUlN3EVTFzlmpOXEDGOR4PLALpmPdMi6nvPz0GEkY5sCdJw elbN2iyIsMNDDc74gC1nNSV67i3i94msOAh8u3HLPEkzFCEO7joERLFZWnkpuCYRiuxz ipYI9MQHgdPRUUCyaFk0qY/RdHYEqIRuN1+JNWzsZaBQtuTATm7UGGeCqHkzta+oYlf3 Hg0g== X-Gm-Message-State: AOAM531GuDfpPnrHPvd6P097xl+eQ12CcVWl1UpZmm9B1g8yPH0Q6USi JDMrH3INzpgRNlGAOhQYDJHJdA== X-Google-Smtp-Source: ABdhPJzFb0ubWNGB/FhLothieQB55Oanm48khGe1NurwGjcCN4DLho+q9T1NK1PIvLD3L8gp0cwoKg== X-Received: by 2002:a5d:68cb:: with SMTP id p11mr186357wrw.262.1636992779201; Mon, 15 Nov 2021 08:12:59 -0800 (PST) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:1ce1:9965:4328:89c4]) by smtp.gmail.com with ESMTPSA id j40sm16315615wms.16.2021.11.15.08.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 08:12:57 -0800 (PST) From: David Plowman To: hverkuil-cisco@xs4all.nl, laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com, jacopo@jmondi.org, tfiga@google.com, naush@raspberrypi.com, libcamera-devel@lists.libcamera.org Date: Mon, 15 Nov 2021 16:12:00 +0000 Message-Id: <20211115161205.24335-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211115161205.24335-1-david.plowman@raspberrypi.com> References: <20211115161205.24335-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 2/7] libcamera: Add ColorSpace fields to StreamConfiguration 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This is so that applications can choose appropriate color spaces which will then be passed down to the V4L2 devices. There are two fields: the "requestedColorSpace" which is the one an application wants, and the "actualColorSpace" which is what the underlying hardware can deliver, and which is filled in by the validate() method. Signed-off-by: David Plowman --- include/libcamera/stream.h | 4 ++++ src/libcamera/stream.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index 0c55e716..fe491ff5 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -47,6 +48,9 @@ struct StreamConfiguration { unsigned int bufferCount; + ColorSpace requestedColorSpace; + ColorSpace actualColorSpace; + Stream *stream() const { return stream_; } void setStream(Stream *stream) { stream_ = stream; } const StreamFormats &formats() const { return formats_; } diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index b421e17e..1ddbbb8c 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -329,6 +329,31 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats) * \brief Requested number of buffers to allocate for the stream */ +/** + * \var StreamConfiguration::requestedColorSpace + * \brief The ColorSpace this stream should have + * + * The generateConfiguration method will generate reasonable default + * values (ColorSpace::Jpeg for stills, ColorSpace::Rec709 for video and + * ColorSpace::Raw for raw streams) but applications are free to overwrite + * this value. + */ + +/** + * \var StreamConfiguration::actualColorSpace + * \brief The ColorSpace the will be used for this stream + * + * This field is filled in by CameraConfiguration::validate(). + * Normally this should match the requestedColorSpace, but it may differ + * if the hardware does not support it. + * + * In general cameras may have different constraints here, for example, + * they may require all output streams to share the same color space. + * Sometimes the fields within this color space may report "Undefined" + * values if the hardware drivers are going to use a color space that + * is not recognised by the ColorSpace class. + */ + /** * \fn StreamConfiguration::stream() * \brief Retrieve the stream associated with the configuration