[{"id":32267,"web_url":"https://patchwork.libcamera.org/comment/32267/","msgid":"<87zflvfqvw.fsf@redhat.com>","date":"2024-11-19T10:40:35","subject":"Re: [PATCH v3 17/17] ipa: rkisp1: awb: Expand comment","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Laurent,\n\nthank you for the patch, such a clarification is always good.\n\nLaurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n\n> The RGB to YCbCr conversion matrix mentioned in a comment, coming from\n> the hardware documentation, does not match any of the canonical matrices\n> specified by any standard. While researching where the values came from,\n> it became apparent they are likely Bt.601 limited range coefficients\n> rounded to 6 bits of decimal precision. Record this in comments.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> ---\n>  src/ipa/rkisp1/algorithms/awb.cpp | 13 +++++++++----\n>  1 file changed, 9 insertions(+), 4 deletions(-)\n>\n> diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\n> index 26d7b8138f17..4bb4f5b88375 100644\n> --- a/src/ipa/rkisp1/algorithms/awb.cpp\n> +++ b/src/ipa/rkisp1/algorithms/awb.cpp\n> @@ -210,13 +210,18 @@ void Awb::process(IPAContext &context,\n>  \t\t});\n>  \n>  \t\t/*\n> -\t\t * Convert from YCbCr to RGB.\n> -\t\t * The hardware uses the following formulas:\n> -\t\t * Y = 16 + 0.2500 R + 0.5000 G + 0.1094 B\n> +\t\t * Convert from YCbCr to RGB. The hardware uses the following\n> +\t\t * formulas:\n> +\t\t *\n> +\t\t * Y  =  16 + 0.2500 R + 0.5000 G + 0.1094 B\n>  \t\t * Cb = 128 - 0.1406 R - 0.2969 G + 0.4375 B\n>  \t\t * Cr = 128 + 0.4375 R - 0.3750 G - 0.0625 B\n>  \t\t *\n> -\t\t * The inverse matrix is thus:\n> +\t\t * This seems to be based on limited range BT.601 with Q1.6\n> +\t\t * precision.\n> +\t\t *\n> +\t\t * The inverse matrix is:\n> +\t\t *\n>  \t\t * [[1,1636, -0,0623,  1,6008]\n>  \t\t *  [1,1636, -0,4045, -0,7949]\n>  \t\t *  [1,1636,  1,9912, -0,0250]]","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 13D9CC326B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Nov 2024 10:40:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 963AE65EF0;\n\tTue, 19 Nov 2024 11:40:44 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6888D65EE9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Nov 2024 11:40:42 +0100 (CET)","from mail-ej1-f71.google.com (mail-ej1-f71.google.com\n\t[209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-166-AG2CH_jNOFm8CmzCxkLc0g-1; Tue, 19 Nov 2024 05:40:39 -0500","by mail-ej1-f71.google.com with SMTP id\n\ta640c23a62f3a-a99fff1ad9cso404608066b.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Nov 2024 02:40:39 -0800 (PST)","from nuthatch ([2a00:102a:400a:489a:34bf:5bf1:e776:7185])\n\tby smtp.gmail.com with ESMTPSA id\n\ta640c23a62f3a-aa20e043316sm635305166b.135.2024.11.19.02.40.36\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 19 Nov 2024 02:40:36 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"Aq5G8HcM\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1732012841;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=+2ooZ7U8FqGMLyMikO1jcjygDhblHmYn9KJF0tzSJQo=;\n\tb=Aq5G8HcM78RgiTpNb51njsDwPYqmZCp+DCRwl37osKzogjmmBKp/eHh2O50y16EyIExA81\n\tGec4J75F7OGM2dSKIUd7ngRLNqSZy6TEQ4WBH69jqfEPKQpny/1h6rYIVTDWbgu/quRAq7\n\tck/qUTaqHeKdvIFFtLE6ADc2bgpazwQ=","X-MC-Unique":"AG2CH_jNOFm8CmzCxkLc0g-1","X-Mimecast-MFC-AGG-ID":"AG2CH_jNOFm8CmzCxkLc0g","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1732012838; x=1732617638;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=+2ooZ7U8FqGMLyMikO1jcjygDhblHmYn9KJF0tzSJQo=;\n\tb=KeoZdCxpVmT05n4w+d3qdCbNEnv2E7w77Vv8tZYfHngyACpHzrNJRMzYuUF88G5Sx1\n\t40p82yW/jClpBfflZCPAQ/wOrfK0B5ItWkipc5/mi3QgmYqhC2d+EiPNdUH3nLndKiaW\n\tFZTVej3NdmeswaUc8dumoNGTqco/YBrWY91J00LSVu3AfJP8xdAwCe9jHAz0BdfQV2Yx\n\t5rxB9hatmpiVMENa8LcFvUTC8jALFiyf09bjRzpFvI4fN8Ie+NVEW5t4pGibRW1MT1hz\n\tjaqTZ0QoFk8bqSQ4TzmUN+fKNqOeciv3NDA/HeYJSPOtQD5uXadERgzwPqDPABwPSfM1\n\tEz0w==","X-Gm-Message-State":"AOJu0Yy7P5TS4DQG46/jLChPNefnTobx+bj69YLUrXtasmqGok/7Cxm6\n\t7mvKvMf/z+Y9baMh+ZZQac0ng1KUX2zKTAR9QO/PuzU5pWox210zxrwYe0+FbP13q9FDQQFyIex\n\tdklzGDTG4atjcbt4DhzP0z+zAAwXJQEhg+Lr0js6wFkXESt7Sk/C1lAve+g3r8aphIWykcUnxLg\n\twcuzs+tsag6oDTwU+wLWbjof3AbvWUhStW8cREt3MWGfwnmMDGq9TDs7w=","X-Received":["by 2002:a17:907:f79b:b0:aa4:ce42:fa7f with SMTP id\n\ta640c23a62f3a-aa4ce4304fcmr140571366b.7.1732012837726; \n\tTue, 19 Nov 2024 02:40:37 -0800 (PST)","by 2002:a17:907:f79b:b0:aa4:ce42:fa7f with SMTP id\n\ta640c23a62f3a-aa4ce4304fcmr140569266b.7.1732012837299; \n\tTue, 19 Nov 2024 02:40:37 -0800 (PST)"],"X-Google-Smtp-Source":"AGHT+IHMxnJRl5c/CcsbU36vvJF1bflPbD6w6GU0UlQm6O6ZHvNMXjEExDyahGiDkFm6T1zzHCn4/w==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 17/17] ipa: rkisp1: awb: Expand comment","In-Reply-To":"<20241118221618.13953-18-laurent.pinchart@ideasonboard.com>\n\t(Laurent Pinchart's message of \"Tue, 19 Nov 2024 00:16:18 +0200\")","References":"<20241118221618.13953-1-laurent.pinchart@ideasonboard.com>\n\t<20241118221618.13953-18-laurent.pinchart@ideasonboard.com>","Date":"Tue, 19 Nov 2024 11:40:35 +0100","Message-ID":"<87zflvfqvw.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"uTL3t_rL7PpM12VDQkL-WTc9NCRuHUHS_sM-Cjuc7Jo_1732012838","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>"}}]