From patchwork Fri Dec 16 14:33:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 18035 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 5D647C328E for ; Fri, 16 Dec 2022 14:33:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DE16A633A3; Fri, 16 Dec 2022 15:33:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1671201229; bh=AjsZ5OBxjl+SqU7Re2waHsIwAPXf1FOEa0JjUaSIn9U=; 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=G+idHKnW2ZQpbG+kl2rjFhtBI1LX2GdHvUOA3OV4muJWs4yZJC0KUn0zix3te6nyY xJJd4BMzgSE9g1yKpcn2tftGRAJbQuxF7jB3lbbRNqW8jVAmXzWnIXkdV6VENmZb7d lfcRBwOSFmYkJxLrRva0u2nySuty3jPCspinOn8YL3v4uSR4TIhwG6JCFalJFQU1n2 usfespGaLmVGtBEV66LzycFdnKWb7s8ncN+eLC4c8hpjjVCzKEwkFmuzIPXfzKrfn4 aw4bnGucF4SPEmwdLsd3jnchuCTqmvLY70ez7I47jZZt9NEuE18kKm6qFuzGp6SyiC 4iko8JgTSmQ3w== Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 923746339A for ; Fri, 16 Dec 2022 15:33:48 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="CJjEyuhf"; dkim-atps=neutral Received: by mail-ej1-x629.google.com with SMTP id b2so6567806eja.7 for ; Fri, 16 Dec 2022 06:33:48 -0800 (PST) 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:subject:date :message-id:reply-to; bh=K49KIMd4v47JvPDJ6npG1gv54cNQtVc9KB/uy2SBRng=; b=CJjEyuhfC4ikK33ptAK90b9QarT9HbxsZCkGNwW/+vMavXExZURnwtFGMq0dUPzEww SKqy+K0HXY6BPAyeICBFmszt+R8+kCGBJUzggeqoqw3KLAWEycnSdi6mUTKHO43CizKH b08aY1meLxZtJe2auvd5VP5FF1M07PBF1ZktaEGq+4Tdlu3ZZuubtjGOy1l2jLV44eNw 4roDuIBEYqUwDtbq9Lnu27ARqyqTgf1Jq+8qgY4oNt6zog3Vqr2uYgUUZQMCUtBa7erl 1zLwU3m8NlPBIDUIsVMDepDvB0b5YskAV9LXb+6zZG+zKV1j0/n+t8IDvrJM5TJJrAaZ E99A== 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 :subject:date:message-id:reply-to; bh=K49KIMd4v47JvPDJ6npG1gv54cNQtVc9KB/uy2SBRng=; b=7xa+V9Z/dp1AK/I9IGQbFaftq7wPQ2qqjXLB7TQN5gAuPWhNFCF16AJTwYKYjA/yFH /uXbr4otffouuk3V061j+S9l0cP2AfH6AWmYqvmTvtYW+TvX/HSfbQLiRuvSD0Qp+ax3 Oz0WoylSjfx0kZCyx2it0V11/bc5YLoAc4veD+PRVX96vU8oeAOpvX8E1BAgPlukDoeH sa6IuQzXgHI0Zai9ezHPzLWOYz47PL7XF+eVoLLRnFlYeqdP2LZBZKJQNKD/XF0/oFON vagcfPWOuwQrWbxCA+iC5Fe5nzU1VixGKwJS6IYjIQ+0eUstCq4dPkO4ua1YFrZ91uVz qmsw== X-Gm-Message-State: ANoB5pmQNxKXtiu4BzSf4dQVZTR9e2uHmezYpzlib1cpkBBKu/VYtymT DvKBzX5pavDIdEEttqAQH5sqI0X28lxt7d1B X-Google-Smtp-Source: AA0mqf4zQpnvMpC2qRAI46ZxyyN0Z8LCgMPKM/O45Eo9+szWv6U5AXBhcyXKflNIAEufCHw6vDBLRA== X-Received: by 2002:a17:906:a886:b0:7c1:8f53:83a0 with SMTP id ha6-20020a170906a88600b007c18f5383a0mr12165568ejb.13.1671201227961; Fri, 16 Dec 2022 06:33:47 -0800 (PST) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id mb4-20020a170906eb0400b0073dd8e5a39fsm907903ejb.156.2022.12.16.06.33.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 06:33:47 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 16 Dec 2022 14:33:42 +0000 Message-Id: <20221216143344.8177-2-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221216143344.8177-1-david.plowman@raspberrypi.com> References: <20221216143344.8177-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] libcamera: camera: fix validateColorSpaces to choose the correct "main" colour space 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 intention is that the "main" colour space is the colour space of the largest non-raw stream. Unfortunately the use of "config_[i].size" is clearly incorrect, and has been copied from prior versions of the code. This small change merely corrects the error. Signed-off-by: David Plowman --- src/libcamera/camera.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 2d947a44..0da167a7 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -361,6 +361,7 @@ CameraConfiguration::Status CameraConfiguration::validateColorSpaces(ColorSpaceF * largest non-raw stream with a defined color space (if there is one). */ std::optional colorSpace; + Size size; for (auto [i, cfg] : utils::enumerate(config_)) { if (!cfg.colorSpace) @@ -369,9 +370,10 @@ CameraConfiguration::Status CameraConfiguration::validateColorSpaces(ColorSpaceF if (cfg.colorSpace->adjust(cfg.pixelFormat)) status = Adjusted; - if (cfg.colorSpace != ColorSpace::Raw && - (!colorSpace || cfg.size > config_[i].size)) + if (cfg.colorSpace != ColorSpace::Raw && cfg.size > size) { colorSpace = cfg.colorSpace; + size = cfg.size; + } } if (!colorSpace || !(flags & ColorSpaceFlag::StreamsShareColorSpace))