[{"id":22065,"web_url":"https://patchwork.libcamera.org/comment/22065/","msgid":"<20220124165027.GA703894@xps15-9570.lan>","date":"2022-01-24T16:50:27","subject":"Re: [libcamera-devel] [PATCH v1 0/6] IPA RkISP1 awb and misc\n\timprovements","submitter":{"id":33,"url":"https://patchwork.libcamera.org/api/people/33/","name":"Peter Griffin","email":"peter.griffin@linaro.org"},"content":"Hi Jean-Michel,\n\nOn Thu, 02 Dec 2021, Jean-Michel Hautbois wrote:\n\n> Hello,\n> \n> This series introduces several algorithms or tuning parameters for the\n> RkISP1 IPA.\n> \n> First, the imx219 is a non linear CMOS sensor and its channels are\n> compressed. In order to have a better exposed output frame, we need to\n> apply a deGamma curve on the raw pixels, which is done by a simple\n> look-up table on the ISP side. The values are taken from the imx219.json\n> tuning file in the RPi IPA.\n> \n> The next algorithm is the black level correction. The output is washed\n> out if no black correction is applied. Again, use the tuning values from\n> the imx219 data file in RPi.\n> \n> Now, we can estimate the AWB gains to apply on the red and blue\n> channels. The RkISP1 could theoretically give us the red, green and blue\n> mean values for the current frame, but the kernel seems to lack support\n> for this. Use the YCrCb estimation instead, and convert the values to\n> RGB before estimating the gains. We don't have a grid of average values,\n> only a global mean for each channel.\n> \n> Next, the color correction matric needs to be a bit modified as the\n> default one is a simple identity matrix. A very simple estimation uses\n> the red and blue gains calculated but a real tuning file would be\n> better, based on color temperature as the imx219 data file.\n> \n> Last patch introduces the histogram IQ mean estimation as for the IPU3\n> and uses the maximum of the relative luminance gain and the iqMean gain\n> to determine the shutter speed and analogue gain to apply.\n> \n> I wanted to post captured images for each of those algorithm to see the\n> evolution but I accidentaly broke my sd card connector... and I am now\n> stuck until I can repair it... :-(\n\nI tested this series on my RockPi4b with Sony IMX219, and the image quality looks\nmuch better :)\n\nI didn't take captured images after each algorithm, but I did do some captures\nbefore this series was applied, and after. The captures can be found here:\n\nhttps://people.linaro.org/~peter.griffin/rkisp1captures/\n\nI have been using ffplay to view them with the following command\n\nffplay -loglevel warning -v info -f rawvideo -pixel_format nv12 -video_size\n\"3280x2464\" cam0-stream0-000009\n\nFWIW for the series:\n\nTested-by: Peter Griffin <peter.griffin@linaro.org>\n\nregards,\n\nPeter.","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 17863BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Jan 2022 16:50:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 51AF060987;\n\tMon, 24 Jan 2022 17:50:32 +0100 (CET)","from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BFC2B6020E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Jan 2022 17:50:30 +0100 (CET)","by mail-wr1-x42a.google.com with SMTP id r22so7116114wra.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Jan 2022 08:50:30 -0800 (PST)","from xps15-9570.lan ([85.210.223.90])\n\tby smtp.gmail.com with ESMTPSA id\n\tx4sm15438888wrp.13.2022.01.24.08.50.29\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 24 Jan 2022 08:50:29 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"QfLIpHDW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:in-reply-to;\n\tbh=rl94C3sNTsE8+W4gugI/OtwcUTSbyKJv7Hxzobv4JbE=;\n\tb=QfLIpHDWHZg1TPRSoXDaVOhFI55mw3NboTcd7Worn/BD8jsH0bstwnUq45GOMRbqWC\n\tmuxOQgK2imBmEGsjz76fwlYMg3pFUpyf69YpbeSUsDMAdPkUS8m+LE8vgC2fjqYyQkzF\n\ts6zXez4TQpe0TxoVfHI1HHfjI5qVlFLzCchUYhCpiTOjVjECns9YLjatgY88gES/X+8q\n\tug6YbR0lqE9fss1xteb5cSqzP2OjLGHLMXyHV5dG7TYyMsGWyhzkysqf2wRpN7xF++U+\n\t9uZO2tlEeX/6gcoJV4aTvuxFpzvx1hp1AqhCKoDApip6rn7BOuBjiCnH9nKXmQfY4rbH\n\tJEpw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:in-reply-to;\n\tbh=rl94C3sNTsE8+W4gugI/OtwcUTSbyKJv7Hxzobv4JbE=;\n\tb=t1HKjv6L5LP9TP6pGBdgC7YIYiJphnr2164F1W/mMby9ky+//719gs7uIMcHTkuhln\n\tF1TWh2VcMXulUq2tOZw28UF51FGwWXf8nBBE74LYYNDzp8O9hjM4+52AyQ/cEK05AmQA\n\tZqWALU1j4ouy4L9TOLPDGFToRl9kmkmLwKW9yC8O7+z8fqln13y7abIovusPgEJTTflQ\n\tjSaVhpMeqHCDuzoMP3cLgH+8z+3xIXKZIE3bRuV58bZ2qT66cXm407/zaxNSth6fvq2x\n\tfvqMnpWcHh4Vu9VUyLrhHgMQOCHx7L92JUwG0Yosk8xS+lmfeIJo1CwY55WFk4uGN+5J\n\tzTUQ==","X-Gm-Message-State":"AOAM532wOt8mCBPPJFioQx+RNVKV80XXLGc1YWawDyuaOJiLZi4Yv0FP\n\tGweRKeCnSLSXoWIbLWUYDwExgw==","X-Google-Smtp-Source":"ABdhPJxF6cquvX/6eys8bXSxFwbYjMlHf1ES2IjJJMiYAMW2jADJWeGhys3rAFe/uKQ3/cBqbbQs+w==","X-Received":"by 2002:a05:6000:1543:: with SMTP id\n\t3mr14837624wry.683.1643043030287; \n\tMon, 24 Jan 2022 08:50:30 -0800 (PST)","Date":"Mon, 24 Jan 2022 16:50:27 +0000","From":"Peter Griffin <peter.griffin@linaro.org>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<20220124165027.GA703894@xps15-9570.lan>","References":"<20211202180410.518232-1-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20211202180410.518232-1-jeanmichel.hautbois@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v1 0/6] IPA RkISP1 awb and misc\n\timprovements","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22066,"web_url":"https://patchwork.libcamera.org/comment/22066/","msgid":"<33b20389-6ff0-ce0f-7396-074ab675150e@ideasonboard.com>","date":"2022-01-24T17:09:31","subject":"Re: [libcamera-devel] [PATCH v1 0/6] IPA RkISP1 awb and misc\n\timprovements","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"Hi Peter !\n\nOn 24/01/2022 17:50, Peter Griffin wrote:\n> Hi Jean-Michel,\n> \n> On Thu, 02 Dec 2021, Jean-Michel Hautbois wrote:\n> \n>> Hello,\n>>\n>> This series introduces several algorithms or tuning parameters for the\n>> RkISP1 IPA.\n>>\n>> First, the imx219 is a non linear CMOS sensor and its channels are\n>> compressed. In order to have a better exposed output frame, we need to\n>> apply a deGamma curve on the raw pixels, which is done by a simple\n>> look-up table on the ISP side. The values are taken from the imx219.json\n>> tuning file in the RPi IPA.\n>>\n>> The next algorithm is the black level correction. The output is washed\n>> out if no black correction is applied. Again, use the tuning values from\n>> the imx219 data file in RPi.\n>>\n>> Now, we can estimate the AWB gains to apply on the red and blue\n>> channels. The RkISP1 could theoretically give us the red, green and blue\n>> mean values for the current frame, but the kernel seems to lack support\n>> for this. Use the YCrCb estimation instead, and convert the values to\n>> RGB before estimating the gains. We don't have a grid of average values,\n>> only a global mean for each channel.\n>>\n>> Next, the color correction matric needs to be a bit modified as the\n>> default one is a simple identity matrix. A very simple estimation uses\n>> the red and blue gains calculated but a real tuning file would be\n>> better, based on color temperature as the imx219 data file.\n>>\n>> Last patch introduces the histogram IQ mean estimation as for the IPU3\n>> and uses the maximum of the relative luminance gain and the iqMean gain\n>> to determine the shutter speed and analogue gain to apply.\n>>\n>> I wanted to post captured images for each of those algorithm to see the\n>> evolution but I accidentaly broke my sd card connector... and I am now\n>> stuck until I can repair it... :-(\n> \n> I tested this series on my RockPi4b with Sony IMX219, and the image quality looks\n> much better :)\n> \n> I didn't take captured images after each algorithm, but I did do some captures\n> before this series was applied, and after. The captures can be found here:\n> \n> https://people.linaro.org/~peter.griffin/rkisp1captures/\n> \n> I have been using ffplay to view them with the following command\n> \n> ffplay -loglevel warning -v info -f rawvideo -pixel_format nv12 -video_size\n> \"3280x2464\" cam0-stream0-000009\n> \n> FWIW for the series:\n> \n> Tested-by: Peter Griffin <peter.griffin@linaro.org>\n\nThanks for testing !\nIn order to ease the viewing here are the 9th frame without 3A:\nhttps://pasteboard.co/RVvX1N5XBHeY.png\n\nAnd with 3A:\nhttps://pasteboard.co/Eav971LRIN3I.png\n\nJM\n\n> \n> regards,\n> \n> Peter.","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 5450EBDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Jan 2022 17:09:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B3FBE60987;\n\tMon, 24 Jan 2022 18:09:34 +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 B7FAE6020E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Jan 2022 18:09:33 +0100 (CET)","from [IPV6:2a01:e0a:169:7140:a4e1:516a:5b0c:f502] (unknown\n\t[IPv6:2a01:e0a:169:7140:a4e1:516a:5b0c:f502])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5D5EB143B;\n\tMon, 24 Jan 2022 18:09:33 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"EG8DYXP2\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1643044173;\n\tbh=0qXWJjtsa/HJyUsYGG3XRCwyUq0g0EyWzwU4xJqTh9E=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=EG8DYXP20661PU8CYmjtRyAVae9gmr+jtBDDMaPnoK/8NaidnCA4GZXTpx/bVoPjP\n\tZexzSEuReW03Bx6XFiZNodNICAzV6gyr9Q1wBnePzpgoLYp2BgIVUccxkg0xAAepe8\n\tB2AlnU1nYS9kTOjyjFFchiJdHJ12fGdHsHQHHT6k=","Message-ID":"<33b20389-6ff0-ce0f-7396-074ab675150e@ideasonboard.com>","Date":"Mon, 24 Jan 2022 18:09:31 +0100","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.5.0","Content-Language":"en-US","To":"Peter Griffin <peter.griffin@linaro.org>","References":"<20211202180410.518232-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20220124165027.GA703894@xps15-9570.lan>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","In-Reply-To":"<20220124165027.GA703894@xps15-9570.lan>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v1 0/6] IPA RkISP1 awb and misc\n\timprovements","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]