From patchwork Fri Oct 6 13:19:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 19116 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 EF964C32BE for ; Fri, 6 Oct 2023 13:20:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A20C762975; Fri, 6 Oct 2023 15:20:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1696598417; bh=lxLUS7Hgi9jrttTfv8CuhWjCTyChmx++p2Hrtu/i7/Y=; 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=M7ldXRcZJPHdQ4ArIFdrrlgDz0dcSyMb1YQXhwlr00o0pcgjbbYmOqjYYVbb7A7ap 5Gv1kdpBD0OaCpMGPCNw/YiWDdXsZSlENwnr9iw1V/PeHWKWjUc3Zo71t7OdNac9jY GTjjSawUNnAuFdfvYq/+gUrDA+6hoKqA+go1oxKBJeop5Z+HEyMmTHyR3/rAE1F/92 TXB9vkdTw0+D6D7EMg5FMkYCZKiYH5Up+rFcZ8gSvGUwNHDMDOG3OB6f46Dhpg0eBo 0cIeUvaBpEhuFMrANuT2SVIMYgjM2CUtBXqwp1rSQi8MBeQVsMH1Owhb0GiAty3Qcq y8xzGzG0Tbe6A== Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 963E06298D for ; Fri, 6 Oct 2023 15:20:14 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="OiJXJ0hQ"; dkim-atps=neutral Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4060b623e64so13372705e9.0 for ; Fri, 06 Oct 2023 06:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1696598414; x=1697203214; darn=lists.libcamera.org; 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=3Ioik+ycSDe1X4mbw6aoWVc5szejZU03FQI4ZHIzFI0=; b=OiJXJ0hQETSJxjIeDd7uTs/ZZLnnHXp3ZM1KxphUGjfp0MmvDFjKWvjoRyiKFfylxI eYW5EfFNc/mSx/Q0XkbxZQPPfmh4ZukSAuPjni6o7W4qNdT2HLu6F+QNr2HPHFlm200P xfAMBeZ1xy9rXxrS4x7uiKhnrR+IulNUhdkzxC8x21XF1L/zNm/TOy6TQDbN/TSHCDzT P4NCLK4DU549nluBZRZ1LzZ/5LEXp20V/WS9j99IUdxMq5ROXA2kavrx0RFoGKLpN0xS OHD4VnD4NlOxhpXi6ExyCohOID0U6hyuDzEmX75oVVX2LeVaLwBWrDNvD3PsKsjB6sI8 yQig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696598414; x=1697203214; 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=3Ioik+ycSDe1X4mbw6aoWVc5szejZU03FQI4ZHIzFI0=; b=VwdqgE2EvlDuGq1wjF2cnoOoH3xWSC3ZLoPcJVQIMtg/lhYVm4H9nF9/iiXmBNikKj ExvNYIBxaP2Wdcd+2eNXig0+UZ0yGwdQnz+B4nBRkVIYq412RxNKIpqglvz8yqYE/naD zeIY1G7AlZfk51/3/JPKAWunkjRcGi+oyEosluXwQzfa09TV+50tT5fS62dopr3PKB8u cmNqVgqI2GffUSd8aJ7M1hLhUdbjZOt9UHfJAmTfhmtQkhiNwlk5CGfJlrZ1qbCruLLZ 8YoJYuFiLs489C7eQ396drT5ZhR+BngLMilMnauM8lb86BE4t2ydYJwilqmvplLUP90r DAXA== X-Gm-Message-State: AOJu0YwgepLJ/NrDGVyRnN+lOfKrVnF0shvFx55++zf0cdxR68pSFwXm Q+w13PEbH1yhR4Jxz/YBBoTr4OOCwumpgu/xwUJ8+Q== X-Google-Smtp-Source: AGHT+IEg2UTu8a7DdvyOJHd9irFWvSlNl3yK9NzyshQi95RiTq1HbOy4psOP7HgJm6T7GZ3IwtDSFA== X-Received: by 2002:a05:600c:3c94:b0:400:5962:6aa9 with SMTP id bg20-20020a05600c3c9400b0040059626aa9mr3873979wmb.11.1696598413951; Fri, 06 Oct 2023 06:20:13 -0700 (PDT) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id m8-20020a056000180800b00321773bb933sm1639478wrh.77.2023.10.06.06.20.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 06:20:13 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 6 Oct 2023 14:19:54 +0100 Message-Id: <20231006132000.23504-15-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231006132000.23504-1-naush@raspberrypi.com> References: <20231006132000.23504-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 14/20] pipeline: rpi: Move flip handling validation code 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" Move the handling of Bayer order changes due to flips entirely into platformValidate(). This removes the need for this code to be split between platformValidate() and validate() as it is right now. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- .../pipeline/rpi/common/pipeline_base.cpp | 14 -------------- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 12 ++++++++++-- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index 825eae80d014..7437d38dc9ba 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -242,20 +242,6 @@ CameraConfiguration::Status RPiCameraConfiguration::validate() if (ret) return Invalid; - /* - * Some sensors change their Bayer order when they are h-flipped - * or v-flipped, according to the transform. If this one does, we - * must advertise the transformed Bayer order in the raw stream. - * Note how we must fetch the "native" (i.e. untransformed) Bayer - * order, because the sensor may currently be flipped! - */ - BayerFormat bayer = BayerFormat::fromPixelFormat(raw.cfg->pixelFormat); - if (data_->flipsAlterBayerOrder_) { - bayer.order = data_->nativeBayerOrder_; - bayer = bayer.transform(combinedTransform_); - } - raw.cfg->pixelFormat = bayer.toPixelFormat(); - if (RPi::PipelineHandlerBase::updateStreamConfig(raw.cfg, raw.format)) status = Adjusted; } diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index 233473e2fe2b..4b42ddc71115 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -411,9 +411,17 @@ CameraConfiguration::Status Vc4CameraData::platformValidate(RPi::RPiCameraConfig StreamConfiguration *rawStream = rawStreams[0].cfg; BayerFormat rawBayer = BayerFormat::fromMbusCode(rpiConfig->sensorFormat_.mbus_code); - /* Handle flips to make sure to match the RAW stream format. */ - if (flipsAlterBayerOrder_) + /* + * Some sensors change their Bayer order when they are h-flipped + * or v-flipped, according to the transform. If this one does, we + * must advertise the transformed Bayer order in the raw stream. + * Note how we must fetch the "native" (i.e. untransformed) Bayer + * order, because the sensor may currently be flipped! + */ + if (flipsAlterBayerOrder_) { + rawBayer.order = nativeBayerOrder_; rawBayer = rawBayer.transform(rpiConfig->combinedTransform_); + } /* Apply the user requested packing. */ rawBayer.packing = BayerFormat::fromPixelFormat(rawStream->pixelFormat).packing;