[{"id":34151,"web_url":"https://patchwork.libcamera.org/comment/34151/","msgid":"<174663893958.747038.1876776299418712102@ping.linuxembedded.co.uk>","date":"2025-05-07T17:28:59","subject":"Re: [PATCH] utils: raspberrypi: ctt: Fix integer division error\n\tcalculating LSC cell size","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting David Plowman (2025-05-07 16:31:03)\n> The cell sizes must be cast to integers as the parameters that\n> were passed in may be floats.\n> \n> Bug: https://github.com/raspberrypi/libcamera/issues/260\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> Fixes: 36ba0e551507 (\"utils: raspberrypi: ctt: Fix NaNs in lens shading tables\")\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  utils/raspberrypi/ctt/ctt_alsc.py | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/utils/raspberrypi/ctt/ctt_alsc.py b/utils/raspberrypi/ctt/ctt_alsc.py\n> index f4fd09e3..5d8b2ced 100644\n> --- a/utils/raspberrypi/ctt/ctt_alsc.py\n> +++ b/utils/raspberrypi/ctt/ctt_alsc.py\n> @@ -131,7 +131,7 @@ def alsc(Cam, Img, do_alsc_colour, plot=False, grid_size=(16, 12), max_gain=8.0)\n>      pixels.\n>      \"\"\"\n>      w, h = Img.w/2, Img.h/2\n> -    dx, dy = (w - 1) // (grid_w - 1), (h - 1) // (grid_h - 1)\n> +    dx, dy = int((w - 1) // (grid_w - 1)), int((h - 1) // (grid_h - 1))\n>  \n>      \"\"\"\n>      average the green channels into one\n> -- \n> 2.34.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 7B7D3C3200\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 May 2025 17:29:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 98B1F68B32;\n\tWed,  7 May 2025 19:29:03 +0200 (CEST)","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 6E89868B2F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 May 2025 19:29:02 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D55C7C59;\n\tWed,  7 May 2025 19:28:50 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"KVwOnW7a\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1746638930;\n\tbh=7Pd+b7XFWWun/vmVPB4w508lAbQBCIx4YBAvo3vT6ik=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=KVwOnW7akgFH7IJXQRX0YjSHzTgnPjiR+pYS43jqTTNGiqSHShavR4WTm4+1LTWm9\n\tEIPTJA+mBmeHZB9w51R0zBG/pKpkJjYDfN4VHksHuY717t0CIZs0Le+oUNOcJhuq39\n\t7AJ+q7fBw1IzorIfX77POyXPB5LyUo6jbpfl0UAc=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250507153103.253107-1-david.plowman@raspberrypi.com>","References":"<20250507153103.253107-1-david.plowman@raspberrypi.com>","Subject":"Re: [PATCH] utils: raspberrypi: ctt: Fix integer division error\n\tcalculating LSC cell size","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"David Plowman <david.plowman@raspberrypi.com>","To":"David Plowman <david.plowman@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 07 May 2025 18:28:59 +0100","Message-ID":"<174663893958.747038.1876776299418712102@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":34162,"web_url":"https://patchwork.libcamera.org/comment/34162/","msgid":"<CAEmqJPrLp-fLMr=u+Cqgg0h44YmNLPd-Ndjmwpex6V4--BDXGA@mail.gmail.com>","date":"2025-05-08T08:24:18","subject":"Re: [PATCH] utils: raspberrypi: ctt: Fix integer division error\n\tcalculating LSC cell size","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"Hi David,\n\nThanks for the fix.\n\nOn Wed, 7 May 2025 at 16:31, David Plowman\n<david.plowman@raspberrypi.com> wrote:\n>\n> The cell sizes must be cast to integers as the parameters that\n> were passed in may be floats.\n>\n> Bug: https://github.com/raspberrypi/libcamera/issues/260\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> Fixes: 36ba0e551507 (\"utils: raspberrypi: ctt: Fix NaNs in lens shading tables\")\n\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n\n> ---\n>  utils/raspberrypi/ctt/ctt_alsc.py | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/utils/raspberrypi/ctt/ctt_alsc.py b/utils/raspberrypi/ctt/ctt_alsc.py\n> index f4fd09e3..5d8b2ced 100644\n> --- a/utils/raspberrypi/ctt/ctt_alsc.py\n> +++ b/utils/raspberrypi/ctt/ctt_alsc.py\n> @@ -131,7 +131,7 @@ def alsc(Cam, Img, do_alsc_colour, plot=False, grid_size=(16, 12), max_gain=8.0)\n>      pixels.\n>      \"\"\"\n>      w, h = Img.w/2, Img.h/2\n> -    dx, dy = (w - 1) // (grid_w - 1), (h - 1) // (grid_h - 1)\n> +    dx, dy = int((w - 1) // (grid_w - 1)), int((h - 1) // (grid_h - 1))\n>\n>      \"\"\"\n>      average the green channels into one\n> --\n> 2.34.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 230D9C3200\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  8 May 2025 08:24:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5774B68B45;\n\tThu,  8 May 2025 10:24:55 +0200 (CEST)","from mail-vs1-xe33.google.com (mail-vs1-xe33.google.com\n\t[IPv6:2607:f8b0:4864:20::e33])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 63B7E617C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 May 2025 10:24:54 +0200 (CEST)","by mail-vs1-xe33.google.com with SMTP id\n\tada2fe7eead31-4c583b7d0b2so13353137.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 08 May 2025 01:24:54 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"VBNGUCeQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1746692693; x=1747297493;\n\tdarn=lists.libcamera.org; \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=TX1q/Cx3wOKmFCvIWdwTV/HnIO7C9B5gxwQLc5szudA=;\n\tb=VBNGUCeQYGG2Rn5VGo4pvRR5Tr0tf0UqE3yKV0zn+vnYAdaUytID6l9l3v1vqZNnCz\n\tEI0txurZ8qydsWP+en+BBfK82I2GA97K7+S2wUi48BDMU0f3fjxd/c19Cdh9LgBCTqfn\n\t7YRJX2nqWNKjH2E7ApMaOo7pUjalJwjInfwmUT1Zbir40KqliOLUVwtEvLSqLnEAP8pz\n\t8gjkv03CLlv3NzibPfZmf9VMzM4LbHLpMoL1pBUeYNbM8bAf2P35ySDsTJRKFXyCdDJD\n\t1Ejq2NKJ3iY2HNhP28nWy/wA95jq49P2+7m8urVZLSAht3WuJx33Cpl5vUdozbV37zVj\n\t6KVg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1746692693; x=1747297493;\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=TX1q/Cx3wOKmFCvIWdwTV/HnIO7C9B5gxwQLc5szudA=;\n\tb=RpJH+lc+O1dAU3k2e6GmOhH6CObJH+KE4bGG9xuvLSi7aC9N/ZmwwQLTysAzmDLO/3\n\t72+Zlc6FXyxN8yufXQTFx5V0FtymqyohYgLpSKFos/KKs/fUz+RRBqnzjnLjAzGh3wO8\n\tP+pV1JmX4I2UFMlNNyNKdCtECI18LwP8fq0x23FchQCh7KT657wzgpsC5kkwT6NAs8Yh\n\tXoif/mEa1UNE9FIPSaIw8M7SjZzWlAaS0JSn9Y0Qa+d4OrnZim/4XaB8K0xwIc5XKp94\n\tVp+fwGRCf4cBP0yyYTCYLjdG41478tWDKL/Lbc8P4I5+y/exHccS50YPs/QlVauuByC2\n\tHn5Q==","X-Gm-Message-State":"AOJu0Ywclkzz8miNhGq09o8WX6YmTqWrawgpYC56ndDkieEWUCQ6yzZO\n\tOUop3epWM0aATTNfso8mPofOpUWRLYWNIzbTY9cqhvu0SlLIdyr/78nLHIBDY2YbvNGqX+CAKtf\n\tXkl7uPmZJb+pweDGzSUXUTfsQoZIN9S1fUGjaDA==","X-Gm-Gg":"ASbGncuGgcb+0jTOGi7hbB+Bv+krwIt5oADYoHJduhGwJiypvGgM8rMHeiwZUBkf3UF\n\t70SuxdJ02ShcbMMPPC4NyQnMrjRHtaEJjzZjuge7YrP8lHOYnNywZwfnyF1cA/RQGr9dsgBQ3mh\n\tSPZpnW2u0pBYNPfbgQNRZD4dV6x/9psvQvhX4Dba3JwU0VHM2TI0DTSQAHI+LMrMVG","X-Google-Smtp-Source":"AGHT+IFHcCoEDy3j4UiLO2gwg3R6JysDKj7NlfTzNoHYTTpuNHUIS6Z2D7+ayYuEW0sTPxaYxzjxCTrjolrHjND8Uuo=","X-Received":"by 2002:a05:6102:108b:b0:4cd:6378:46b0 with SMTP id\n\tada2fe7eead31-4dc737adbfemr1473830137.1.1746692693161;\n\tThu, 08 May 2025 01:24:53 -0700 (PDT)","MIME-Version":"1.0","References":"<20250507153103.253107-1-david.plowman@raspberrypi.com>","In-Reply-To":"<20250507153103.253107-1-david.plowman@raspberrypi.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Thu, 8 May 2025 09:24:18 +0100","X-Gm-Features":"ATxdqUGAAn0tVIGSaeQNAN1slN2FaKnNnCdjUyFIU7rXqC-9N-_tdCGh4BASOwE","Message-ID":"<CAEmqJPrLp-fLMr=u+Cqgg0h44YmNLPd-Ndjmwpex6V4--BDXGA@mail.gmail.com>","Subject":"Re: [PATCH] utils: raspberrypi: ctt: Fix integer division error\n\tcalculating LSC cell size","To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"UTF-8\"","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]