[{"id":26225,"web_url":"https://patchwork.libcamera.org/comment/26225/","msgid":"<Y8SdsRtfblqLX0/q@pendragon.ideasonboard.com>","date":"2023-01-16T00:43:29","subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: bayer_format: Expand\n\tdocumentation","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Sat, Jan 14, 2023 at 08:01:34PM +0100, Jacopo Mondi via libcamera-devel wrote:\n> The current documentation of the BayerFormat::transform() function\n> reports examples on the Bayer components ordering transformation for\n> horizontal flip (mirroring) but not for vertical flip or for the\n> combination of the two.\n> \n> It might be useful to complete the documentation to ease understanding\n> of the transform() function on a sensor's Bayer pattern.\n\nIf it only \"might\" be useful, I \"might\" have doubts about this patch, so\nlet's write \"It is useful\" to make sure I accept it ;-)\n\n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>\n> ---\n>  src/libcamera/bayer_format.cpp | 20 +++++++++++++-------\n>  1 file changed, 13 insertions(+), 7 deletions(-)\n> \n> diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\n> index f27cc1662d25..d2f6698a67ca 100644\n> --- a/src/libcamera/bayer_format.cpp\n> +++ b/src/libcamera/bayer_format.cpp\n> @@ -356,11 +356,14 @@ BayerFormat BayerFormat::fromPixelFormat(PixelFormat format)\n>   * \\brief Apply a transform to this BayerFormat\n>   * \\param[in] t The transform to apply\n>   *\n> - * Appplying a transform to an image stored in a Bayer format affects the Bayer\n> - * order. For example, performing a horizontal flip on the Bayer pattern\n> - * RGGB causes the RG rows of pixels to become GR, and the GB rows to become BG.\n> - * The transformed image would have a GRBG order. The bit depth and modifiers\n> - * are not affected.\n> + * Applying a transform to an image stored in a Bayer format affects the Bayer\n> + * order. For example, performing an horizontal flip on the Bayer pattern RGGB\n\ns/an horizontal/a horizontal/\n\n> + * causes the RG rows of pixels to become GR, and the GB rows to become BG. The\n> + * transformed image would have a GRBG order. Performing a vertical flip on the\n> + * Bayer pattern RGGB causes the GB rows to be read before the RG ones and the\n\nLet's keep this generic, avoiding the mention of \"read\" as it applies to\npixel formats in memory, not just sensor readout order:\n\n\"causes the GB rows to come before the RG rows\"\n\nor something similar.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> + * transformed image would have GBRG order. Applying both vertical and\n> + * horizontal flips on the Bayer patter RGGB results in transformed images with\n> + * BGGR order. The bit depth and modifiers are not affected.\n>   *\n>   * Horizontal and vertical flips are applied before transpose.\n>   *\n> @@ -375,8 +378,11 @@ BayerFormat BayerFormat::transform(Transform t) const\n> \n>  \t/*\n>  \t * Observe that flipping bit 0 of the Order enum performs a horizontal\n> -\t * mirror on the Bayer pattern (e.g. RGGB goes to GRBG). Similarly,\n> -\t * flipping bit 1 performs a vertical mirror operation on it. Hence:\n> +\t * mirror on the Bayer pattern (e.g. RG/GB goes to GR/BG). Similarly,\n> +\t * flipping bit 1 performs a vertical mirror operation on it (e.g RG/GB\n> +\t * goes to GB/RG). Applying both vertical and horizontal flips\n> +\t * combines vertical and horizontal mirroring on the Bayer pattern\n> +\t * (e.g. RG/GB goes to BG/GR). Hence:\n>  \t */\n>  \tif (!!(t & Transform::HFlip))\n>  \t\tresult.order = static_cast<Order>(result.order ^ 1);","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 1F6FFBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Jan 2023 00:43:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8EE9C625E4;\n\tMon, 16 Jan 2023 01:43:31 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2CA6A625D0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Jan 2023 01:43:30 +0100 (CET)","from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi\n\t[213.243.189.158])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8F0C9997;\n\tMon, 16 Jan 2023 01:43:29 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1673829811;\n\tbh=qAEGRaPegjxPPg91T7WdpQubJb3GA0k53kQnLlCs3z0=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=O/ewMttHA+SPVHYvqHcO2rg2x3zijWk+L2YDy0SumjWKQXfHLgKOzXUCmMD2H7k7q\n\t+625yr6odkaeyuMgK9jQyzuWUfYG4zVpK1qZARyTKZuXSPdKLOEJliqKaIn0/u1n5T\n\ta/U/ialbOwUgbEkD6QrZvKUPml6+qTB7rp4vyUcuK5ufqu0Jxw6phJ1QP7mOAvggro\n\tkavl97naX49JTjq1oygZ0xWRAWxJ5T4UIKD4NxQW02deMa7N9uKOTIIjB6B9lIJPuD\n\tPezbPWh9KTxMjNPjUhvK20HyoIT8/59hC/B9jYSvCjNbV0aXuRdkDSxneWvC3Pe93F\n\tu16r38VrBBN+Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1673829809;\n\tbh=qAEGRaPegjxPPg91T7WdpQubJb3GA0k53kQnLlCs3z0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Hc+exjNUCcomTeOSc0uXHxhBqraZpLwalhbfcGdJS845qQkEsUjWPXHjSvNcPlXBO\n\tm9fYwHFb28WXrgWrI5p3tHjPSWF5AxUCPuPfmcSoHqB/fReTCoLUhKgV4ja/Jmvo3c\n\txyQ8DS9uaYIsYoQPoKk/QKwd1LcNqcZUoN7lTlaQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Hc+exjNU\"; dkim-atps=neutral","Date":"Mon, 16 Jan 2023 02:43:29 +0200","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Message-ID":"<Y8SdsRtfblqLX0/q@pendragon.ideasonboard.com>","References":"<20230114190135.19703-1-jacopo.mondi@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230114190135.19703-1-jacopo.mondi@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 1/2] libcamera: bayer_format: Expand\n\tdocumentation","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]