[{"id":25895,"web_url":"https://patchwork.libcamera.org/comment/25895/","msgid":"<CAHW6GY+Kg+cXb0y54_Fv2E5s-5gNfdZiX3s-veLfBRMBEmnE0A@mail.gmail.com>","date":"2022-11-24T13:19:29","subject":"Re: [libcamera-devel] [PATCH 3/9] libcamera: bayer_format: Expand\n\tdocumentation","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Jacopo\n\nThanks for doing all this!\n\nOn Thu, 24 Nov 2022 at 12:12, Jacopo Mondi <jacopo@jmondi.org> wrote:\n>\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 eases understanding\n> of the transform() function on a sensor's Bayer pattern.\n>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nThanks!\nDavid\n\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 fdbc4af1dcc0..dd8109ba85c2 100644\n> --- a/src/libcamera/bayer_format.cpp\n> +++ b/src/libcamera/bayer_format.cpp\n> @@ -367,11 +367,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 a horizontal flip on the Bayer pattern RGGB\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\n> + * the Bayer pattern RGGB causes the GB row to be read before the RG one and the\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> @@ -386,8 +389,11 @@ BayerFormat BayerFormat::transform(Transform t) const\n>\n>         /*\n>          * Observe that flipping bit 0 of the Order enum performs a horizontal\n> -        * mirror on the Bayer pattern (e.g. RGGB goes to GRBG). Similarly,\n> -        * flipping bit 1 performs a vertical mirror operation on it. Hence:\n> +        * mirror on the Bayer pattern (e.g. RG/GB goes to GR/BG). Similarly,\n> +        * flipping bit 1 performs a vertical mirror operation on it (e.g RG/GB\n> +        * goes to GB/RG). Applying both vertical and horizontal flips\n> +        * combines vertical and horizontal mirroring on the Bayer pattern\n> +        * (e.g. RG/GB goes to BG/GR). Hence:\n>          */\n>         if (!!(t & Transform::HFlip))\n>                 result.order = static_cast<Order>(result.order ^ 1);\n> --\n> 2.38.1\n>","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 17906BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Nov 2022 13:19:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 747A26331A;\n\tThu, 24 Nov 2022 14:19:43 +0100 (CET)","from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com\n\t[IPv6:2607:f8b0:4864:20::102d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3C60C632EA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Nov 2022 14:19:42 +0100 (CET)","by mail-pj1-x102d.google.com with SMTP id\n\tw4-20020a17090ac98400b002186f5d7a4cso5172954pjt.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Nov 2022 05:19:42 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669295983;\n\tbh=6W3M0ODi5+ktJWd1CYssi/DG7soaY3fdBSYkPqz/zvs=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=BAECtYmC+TFWdEkme79RTIYXaHlNf3Rs59lgWXPss+S7T+mO1i9IzMcLDyBpbIBLJ\n\t/UMg+WwVCHQRqevBONdzXpZcw84SGM5iaktmpE9WmKnH3fbx5TPOtF5Ym8mkd1l58N\n\tyZyCk0njFuAbStwK1A9LN+Lv2jDH6IbQpThAKr7WPn3x+fR4QInlRNhr8INbXGvqRa\n\tt5IngZ4oTTLCX2YP+SnAc7GcMrHzVceMIwEt/00hWABVESV6YPk6QFicia42xA4Az9\n\tIn8iKMZXEPLkjzTqhpCHZ0C2CiMOULTntbpJV0hUpAA66Era8gN/7zi0gxU3ud1cON\n\tPH24FZvjqUp7Q==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=ijaPPMFhEEVTrJ/YzJWM5Q/aFWlVSKFdbZEOJj2R5vs=;\n\tb=nlpHmd5VmajE0OB32TdhwrtbSDyDJy+TMLes6C4GDNdLLIlv3/4raiZr/BdG0CUqrZ\n\tgK+pM+7X0C3nrG4jpCZMPzcydIsHX+Scb4+5R84pkgBkUHiZWpwR2yyJY0VQjxpzpV0W\n\tAjL7NGzSPdW809U849Q5rObqNmH8mhj1uy/2Xn/uU7kGJdA9atdzpx0SjARaRYDyPw3x\n\t0KfKeCZQsxFDoQNPxseSrrTRHi96HnIqt2NIY0q6jgbCn3ZxsXgMi4Q9Gw6wQ5iDjIte\n\t8aJhS/qJGr/to3LpCPgj12+cFIoTPM3e9wNCzhhvqqn4w4pu8DBkq6DdORvM6V1JDtot\n\tnL3Q=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"nlpHmd5V\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=ijaPPMFhEEVTrJ/YzJWM5Q/aFWlVSKFdbZEOJj2R5vs=;\n\tb=tGjVHAh6NAM52ujTu+WhxS1dWtfXqSRRWBA6AbZWabl8QeoBOWwMOvZYmmMj5MujhG\n\tf7fFzlbYj6my+XtsYOcGU5qvU3BpG/Ts6hU8TfPQU5RfyO0VOk+gfYejd20v3ft5sVRc\n\tMqsliFSFagJkwf/MclJ6/RqmI+BD/+r3KJw3WcX/FoYQMrjD6pD+MGGDIqjTxFcCk6DP\n\tLO7CVJi7U16dsXL4Owzaysl2ZVxFaeFW5NX3CyBz7LfPFHlrdYNFzoMsJjZMUpqLhzuJ\n\tRoIWJpAADXS5oxqRzOXM3gO0k5JemqrvFrbeE3hkC/c/jfU6e6vo//6+1ZXb4X2uDIjK\n\tRPdQ==","X-Gm-Message-State":"ANoB5pn+4n9TYwqfyuW2bTXFjPcDYhwdZCXVoW6JMpQo/VggEdbbpDHs\n\tIfZZCGcKjgBBhUG8gBkwgBkj4Ly8ULQbB2zSc+T33g==","X-Google-Smtp-Source":"AA0mqf6iZWoNe0oJC+/UpJ99Wf5mMzHMpej5bEDVCVrBdRNbNLWrJ7wDvj7UZXp6iGDWmPBw7Vz87YOulHH6jGW4k4Y=","X-Received":"by 2002:a17:90a:a588:b0:218:8eb8:8502 with SMTP id\n\tb8-20020a17090aa58800b002188eb88502mr28619736pjq.179.1669295980699;\n\tThu, 24 Nov 2022 05:19:40 -0800 (PST)","MIME-Version":"1.0","References":"<20221124121220.47000-1-jacopo@jmondi.org>\n\t<20221124121220.47000-4-jacopo@jmondi.org>","In-Reply-To":"<20221124121220.47000-4-jacopo@jmondi.org>","Date":"Thu, 24 Nov 2022 13:19:29 +0000","Message-ID":"<CAHW6GY+Kg+cXb0y54_Fv2E5s-5gNfdZiX3s-veLfBRMBEmnE0A@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH 3/9] 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":"David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]