From patchwork Thu Mar 20 16:26:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Zamazal X-Patchwork-Id: 22998 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 59E6BC3301 for ; Thu, 20 Mar 2025 16:26:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9F9FD68950; Thu, 20 Mar 2025 17:26:34 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="b2PeFW1h"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9C7A8617F5 for ; Thu, 20 Mar 2025 17:26:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742487992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gwSQdjqtGsaCNHNGxyNFn9Hapep9X9HyaHxlD6dLulI=; b=b2PeFW1hBCI+L7qqXVyxsdAOEFCSNSzVlUaj/jDJn6GhztY4kOyB9DXUYB2OtSFAilP1A5 59ljHfz8yTXJLsScj4FowR6+aRTfVb+Oiq2A8bXGR4inotHi8xUJSBnNdjLSr0Ei8Ryoqb tu26yNWFA8MeV+no1hfeRWjHdkxoH2c= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-156-BpFgKEyhOQutb6j5efG9YQ-1; Thu, 20 Mar 2025 12:26:31 -0400 X-MC-Unique: BpFgKEyhOQutb6j5efG9YQ-1 X-Mimecast-MFC-AGG-ID: BpFgKEyhOQutb6j5efG9YQ_1742487989 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A2E6B18EBE88; Thu, 20 Mar 2025 16:26:29 +0000 (UTC) Received: from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.32.102]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4CBDE1800268; Thu, 20 Mar 2025 16:26:27 +0000 (UTC) From: Milan Zamazal To: libcamera-devel@lists.libcamera.org Cc: Milan Zamazal , Kieran Bingham Subject: [PATCH] libcamera: software_isp: Assign colour spaces in configurations Date: Thu, 20 Mar 2025 17:26:24 +0100 Message-ID: <20250320162624.121616-1-mzamazal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: R31KWewRMmi1xQWME315EDdmct7mXAZ8sdbMGjLA5dk_1742487989 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true 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" StreamConfiguration's should have colorSpace set. This is not the case in the simple pipeline. Let's set it there, basically mimicking what rpi and rkisp1 pipelines do (having a common helper may be a consideration). This also fixes a crash in `cam' due to accessing an unset colorSpace. Signed-off-by: Milan Zamazal --- src/libcamera/pipeline/simple/simple.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 6e039bf3..62db96ca 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -1196,11 +1197,24 @@ SimplePipelineHandler::generateConfiguration(Camera *camera, Spanfirst; cfg.size = formats.begin()->second[0].max; + switch (role) { + case StreamRole::Raw: + cfg.colorSpace = ColorSpace::Raw; + break; + case StreamRole::StillCapture: + case StreamRole::Viewfinder: + cfg.colorSpace = ColorSpace::Sycc; + break; + case StreamRole::VideoRecording: + cfg.colorSpace = ColorSpace::Rec709; + break; + } + config->addConfiguration(cfg); }