From patchwork Sat Jan 14 19:01:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 18109 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 195E2C3292 for ; Sat, 14 Jan 2023 19:01:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5E630625E6; Sat, 14 Jan 2023 20:01:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1673722915; bh=Zc0DY01v0mqDBgfRySrNg2kWg8llcEGHBbvGMqw/P9M=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ZTHORwFFEHqsWq+hN1smD36ySa3Y1atzhU+nYx2oXHfsPeTowP8BjGfDoqi/j1LtB MKiYx8n7j7VeQHnc0XzLC6x/1NE/s6612Smf0hBYQBuTdw/4GgLyyg23xhG1rZSshc uIWRZlqWrD0f7Gp7rRlumKSMn+4rcciYHXpXJnXRLSS1fZuXyTO+LX9FEUK4z2UBDE rYkej28H6S/GopEFw+3MsGzkUd7rf6axiPwvRJiJxSG7d44RcFSMHOmCSTb3D+lN0S BmVr6Gtj2DTBd8LP523PoFDaSynZ4e/A+HO6VBByMukWw49LSdYo/OaHfDfbG5NC9T PSre2Hvl6/jEg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E826B625D0 for ; Sat, 14 Jan 2023 20:01:53 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="siZzL3Ue"; dkim-atps=neutral Received: from uno.LocalDomain (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0A7AA4D4; Sat, 14 Jan 2023 20:01:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1673722913; bh=Zc0DY01v0mqDBgfRySrNg2kWg8llcEGHBbvGMqw/P9M=; h=From:To:Cc:Subject:Date:From; b=siZzL3UeveAIyClAb+gZojGrptXh4hGptAqjy0ZPg/Q4yPu4WIoKdCGCP+jQUf2oi wVQk9INVHm1xUa3B+0ZVqajlmiJJI5tM7KlaSbMcyM4kaEGfcYCw/BNdazIJ7lmVHF fcB2DEIayQLgXquoCqeChLzXuNUEVW/JNCfDabu4= To: libcamera-devel@lists.libcamera.org Date: Sat, 14 Jan 2023 20:01:34 +0100 Message-Id: <20230114190135.19703-1-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] libcamera: bayer_format: Expand documentation 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: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The current documentation of the BayerFormat::transform() function reports examples on the Bayer components ordering transformation for horizontal flip (mirroring) but not for vertical flip or for the combination of the two. It might be useful to complete the documentation to ease understanding of the transform() function on a sensor's Bayer pattern. Signed-off-by: Jacopo Mondi Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- src/libcamera/bayer_format.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) -- 2.39.0 diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp index f27cc1662d25..d2f6698a67ca 100644 --- a/src/libcamera/bayer_format.cpp +++ b/src/libcamera/bayer_format.cpp @@ -356,11 +356,14 @@ BayerFormat BayerFormat::fromPixelFormat(PixelFormat format) * \brief Apply a transform to this BayerFormat * \param[in] t The transform to apply * - * Appplying a transform to an image stored in a Bayer format affects the Bayer - * order. For example, performing a horizontal flip on the Bayer pattern - * RGGB causes the RG rows of pixels to become GR, and the GB rows to become BG. - * The transformed image would have a GRBG order. The bit depth and modifiers - * are not affected. + * Applying a transform to an image stored in a Bayer format affects the Bayer + * order. For example, performing an horizontal flip on the Bayer pattern RGGB + * causes the RG rows of pixels to become GR, and the GB rows to become BG. The + * transformed image would have a GRBG order. Performing a vertical flip on the + * Bayer pattern RGGB causes the GB rows to be read before the RG ones and the + * transformed image would have GBRG order. Applying both vertical and + * horizontal flips on the Bayer patter RGGB results in transformed images with + * BGGR order. The bit depth and modifiers are not affected. * * Horizontal and vertical flips are applied before transpose. * @@ -375,8 +378,11 @@ BayerFormat BayerFormat::transform(Transform t) const /* * Observe that flipping bit 0 of the Order enum performs a horizontal - * mirror on the Bayer pattern (e.g. RGGB goes to GRBG). Similarly, - * flipping bit 1 performs a vertical mirror operation on it. Hence: + * mirror on the Bayer pattern (e.g. RG/GB goes to GR/BG). Similarly, + * flipping bit 1 performs a vertical mirror operation on it (e.g RG/GB + * goes to GB/RG). Applying both vertical and horizontal flips + * combines vertical and horizontal mirroring on the Bayer pattern + * (e.g. RG/GB goes to BG/GR). Hence: */ if (!!(t & Transform::HFlip)) result.order = static_cast(result.order ^ 1);