[{"id":12227,"web_url":"https://patchwork.libcamera.org/comment/12227/","msgid":"<386baf97-2075-a9b4-9e50-c83bafcf5549@ideasonboard.com>","date":"2020-08-31T09:33:22","subject":"Re: [libcamera-devel] [RFC PATCH] qcam: format_converter: add 10\n\tand 12 bit packed raw Bayer formats","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Andrey,\n\nOn 31/08/2020 09:46, Andrey Konovalov wrote:\n> No interpolation is used to get more speed by the price of lower image\n> quality. In qcam format_converter is used for viewfinder only, and in\n> this case lower lag is more important than the image quality.\n> \n\nGreat, I think this will be useful for early bring up of a new platform\n/ sensor when we just want to 'see' the image as quickly as possible.\n\nWe should really get more 'information' presented in Qcam regarding what\nprocessing is going on - so that it's clear to a viewer this is doing\nsoftware debayering or such - but that's way out of scope for this patch.\n\n\n\n> Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n> ---\n>  Only SRGGB10P and SRGGB12P formats were tested (the ones I can get from\n>  the camera sensor I am currently using)\n> \n>  src/qcam/format_converter.cpp | 118 ++++++++++++++++++++++++++++++++++\n>  src/qcam/format_converter.h   |  14 ++++\n>  2 files changed, 132 insertions(+)\n> \n> diff --git a/src/qcam/format_converter.cpp b/src/qcam/format_converter.cpp\n> index 4b9722d..c9f94d3 100644\n> --- a/src/qcam/format_converter.cpp\n> +++ b/src/qcam/format_converter.cpp\n> @@ -136,6 +136,62 @@ int FormatConverter::configure(const libcamera::PixelFormat &format,\n>  \t\tformatFamily_ = MJPEG;\n>  \t\tbreak;\n>  \n> +\tcase libcamera::formats::SRGGB10_CSI2P:\n> +\t\tformatFamily_ = RAW_CSI2P;\n> +\t\tr_pos_ = 0;\n> +\t\tbpp_numer_ = 4;\n> +\t\tbpp_denom_ = 5;\n> +\t\tbreak;\n> +\n> +\tcase libcamera::formats::SGRBG10_CSI2P:\n> +\t\tformatFamily_ = RAW_CSI2P;\n> +\t\tr_pos_ = 1;\n> +\t\tbpp_numer_ = 4;\n> +\t\tbpp_denom_ = 5;\n> +\t\tbreak;\n> +\n> +\tcase libcamera::formats::SGBRG10_CSI2P:\n> +\t\tformatFamily_ = RAW_CSI2P;\n> +\t\tr_pos_ = 2;\n> +\t\tbpp_numer_ = 4;\n> +\t\tbpp_denom_ = 5;\n> +\t\tbreak;\n> +\n> +\tcase libcamera::formats::SBGGR10_CSI2P:\n> +\t\tformatFamily_ = RAW_CSI2P;\n> +\t\tr_pos_ = 3;\n> +\t\tbpp_numer_ = 4;\n> +\t\tbpp_denom_ = 5;\n> +\t\tbreak;\n> +\n> +\tcase libcamera::formats::SRGGB12_CSI2P:\n> +\t\tformatFamily_ = RAW_CSI2P;\n> +\t\tr_pos_ = 0;\n> +\t\tbpp_numer_ = 2;\n> +\t\tbpp_denom_ = 3;\n> +\t\tbreak;\n> +\n> +\tcase libcamera::formats::SGRBG12_CSI2P:\n> +\t\tformatFamily_ = RAW_CSI2P;\n> +\t\tr_pos_ = 1;\n> +\t\tbpp_numer_ = 2;\n> +\t\tbpp_denom_ = 3;\n> +\t\tbreak;\n> +\n> +\tcase libcamera::formats::SGBRG12_CSI2P:\n> +\t\tformatFamily_ = RAW_CSI2P;\n> +\t\tr_pos_ = 2;\n> +\t\tbpp_numer_ = 2;\n> +\t\tbpp_denom_ = 3;\n> +\t\tbreak;\n> +\n> +\tcase libcamera::formats::SBGGR12_CSI2P:\n> +\t\tformatFamily_ = RAW_CSI2P;\n> +\t\tr_pos_ = 3;\n> +\t\tbpp_numer_ = 2;\n> +\t\tbpp_denom_ = 3;\n> +\t\tbreak;\n> +\n>  \tdefault:\n>  \t\treturn -EINVAL;\n>  \t};\n> @@ -163,9 +219,71 @@ void FormatConverter::convert(const unsigned char *src, size_t size,\n>  \tcase NV:\n>  \t\tconvertNV(src, dst->bits());\n>  \t\tbreak;\n> +\tcase RAW_CSI2P:\n> +\t\tconvertRAW_CSI2P(src, dst->bits());\n> +\t\tbreak;\n>  \t};\n>  }\n>  \n> +/*\n> + * The pixels are processed in groups of 4 (2 by 2 squares), and the\n> + * assumption is that height_ and width_ are even numbers.\n\nDo we need an assertion, or round-down in here to make sure we don't\noverflow if the assumption is even numbers?\n\n(I can't imagine having an odd number on a bayer pattern, but with\ncropping or such perhaps it could happen - I don't know)\n\n\nAlso - I wonder how cache-efficient it is processing like that. I'm not\nsure if there's a way to make it more efficient, but even if there was,\nthat could be handled later and out of scope of this patch as this just\ngets new functionality all the same.\n\n\n> + */\n> +void FormatConverter::convertRAW_CSI2P(const unsigned char *src,\n> +\t\t\t\t       unsigned char *dst)\n> +{\n> +\tunsigned int r_pos, b_pos, g1_pos, g2_pos;\n> +\tunsigned char r, g1, g2, b;\n> +\tunsigned int s_linelen = width_ * bpp_denom_ / bpp_numer_;\n> +\tunsigned int d_linelen = width_ * 4;\n> +\n> +\t/*\n> +\t * Calculate the offsets of the color values in the src buffer.\n> +\t * g1 is green value from the even (upper) line, g2 is the green\n> +\t * value from the odd (lower) line.\n> +\t */\n> +\tif ( r_pos_ > 1) {\n> +\t\tr_pos = r_pos_ - 2 + s_linelen;\n> +\t\tb_pos = 3 - r_pos_;\n> +\t} else {\n> +\t\tr_pos = r_pos_;\n> +\t\tb_pos = 1 - r_pos_ + s_linelen;\n> +\t}\n> +\tg1_pos = (r_pos == 0 || b_pos == 0) ? 1 : 0;\n> +\tg2_pos = 1 - g1_pos + s_linelen;\n\nCould those calculations be done at configure time rather than per-frame?\n\n> +\n> +\tfor (unsigned int y = 0; y < height_; y += 2) {\n> +\t\tfor (unsigned x = 0; x < width_; x += bpp_numer_) {\n> +\t\t\tfor (unsigned int i = 0; i < bpp_numer_ ; i += 2) {\n> +\t\t\t\t/* read the colors for the current 2x2 group: */\n> +\t\t\t\tr = src[r_pos];\n> +\t\t\t\tg1 = src[g1_pos];\n> +\t\t\t\tg2 = src[g2_pos];\n> +\t\t\t\tb = src[b_pos];\n> +\t\t\t\tsrc += 2;\n> +\t\t\t\t/* two left pixels of the four: */\n> +\t\t\t\tdst[0] = dst[0 + d_linelen] = b;\n> +\t\t\t\tdst[1] = g1;\n> +\t\t\t\tdst[1 + d_linelen] = g2;\n> +\t\t\t\tdst[2] = dst[2 + d_linelen] = r;\n> +\t\t\t\tdst[3] = dst[3 + d_linelen] = 0xff;\n> +\t\t\t\tdst += 4;\n> +\t\t\t\t/* two right pixels of the four: */\n> +\t\t\t\tdst[0] = dst[0 + d_linelen] = b;\n> +\t\t\t\tdst[1] = g1;\n> +\t\t\t\tdst[1 + d_linelen] = g2;\n> +\t\t\t\tdst[2] = dst[2 + d_linelen] = r;\n> +\t\t\t\tdst[3] = dst[3 + d_linelen] = 0xff;\n> +\t\t\t\tdst += 4;\n> +\t\t\t}\n> +\t\t\tsrc += bpp_denom_ - bpp_numer_;\n> +\t\t}\n> +\t\t/* move to the next even line: */\n> +\t\tsrc += s_linelen;\n> +\t\tdst += d_linelen;\n> +\t}\n> +}\n> +\n>  static void yuv_to_rgb(int y, int u, int v, int *r, int *g, int *b)\n>  {\n>  \tint c = y - 16;\n> diff --git a/src/qcam/format_converter.h b/src/qcam/format_converter.h\n> index e389b24..5d4f31f 100644\n> --- a/src/qcam/format_converter.h\n> +++ b/src/qcam/format_converter.h\n> @@ -26,11 +26,13 @@ private:\n>  \tenum FormatFamily {\n>  \t\tMJPEG,\n>  \t\tNV,\n> +\t\tRAW_CSI2P,\n>  \t\tRGB,\n>  \t\tYUV,\n>  \t};\n>  \n>  \tvoid convertNV(const unsigned char *src, unsigned char *dst);\n> +\tvoid convertRAW_CSI2P(const unsigned char *src, unsigned char *dst);\n>  \tvoid convertRGB(const unsigned char *src, unsigned char *dst);\n>  \tvoid convertYUV(const unsigned char *src, unsigned char *dst);\n>  \n> @@ -45,6 +47,18 @@ private:\n>  \tunsigned int vertSubSample_;\n>  \tbool nvSwap_;\n>  \n> +\t/* RAW Bayer CSI2P parameters */\n> +\t/*\n> +\t * Bytes per pixel is a fractional number, and is represented by\n> +\t * integer numerator and denominator.\n> +\t */\n> +\tunsigned int bpp_numer_;\n> +\tunsigned int bpp_denom_;\n> +\t/*\n> +\t * Unsigned int r_pos_ from RGB parameters is reused; blue\n> +\t * and green positions are deduced from the red one.\n> +\t */\n\nHrm ... I suspect it might be nicer to put the different configurations\ninto a union, rather than using a parameters of another configuration type.\n\nThat would also make it neater to pre-compute and store the Bayer\nspecific offsets too...\n\n--\nKieran\n\n\n> +\n>  \t/* RGB parameters */\n>  \tunsigned int bpp_;\n>  \tunsigned int r_pos_;\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 E9C33BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 31 Aug 2020 09:33:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5156E62925;\n\tMon, 31 Aug 2020 11:33:28 +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 97AAF60376\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 Aug 2020 11:33:26 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0FF65277;\n\tMon, 31 Aug 2020 11:33:25 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"BS+FUsWW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1598866406;\n\tbh=aolJEdZXdxjUn/jMDhXGp/NV62D6YHuPUxqgEPcIXcs=;\n\th=Reply-To:Subject:To:References:From:Date:In-Reply-To:From;\n\tb=BS+FUsWW+VvMBbIPeMWh1uCqh8oq8IEX9JeYRUjvSJ2xur1/k/xlxO9F6TctgVDzd\n\tKJiq1bHyN8OrM4tq1UW5KQHBP+J/D8XnqICoTltNy7pmNfqncfILpVY+J+Z35CcTcS\n\tiV46Zt/HUQ94YbNuT9z2dSpCiRU4mAlDXFbppqcs=","To":"Andrey Konovalov <andrey.konovalov@linaro.org>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20200831084645.20683-1-andrey.konovalov@linaro.org>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\t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\n\tWZw01QYHU/GUV/zHJSFk","Organization":"Ideas on Board","Message-ID":"<386baf97-2075-a9b4-9e50-c83bafcf5549@ideasonboard.com>","Date":"Mon, 31 Aug 2020 10:33:22 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101\n\tThunderbird/68.10.0","MIME-Version":"1.0","In-Reply-To":"<20200831084645.20683-1-andrey.konovalov@linaro.org>","Content-Language":"en-GB","Subject":"Re: [libcamera-devel] [RFC PATCH] qcam: format_converter: add 10\n\tand 12 bit packed raw Bayer formats","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>","Reply-To":"kieran.bingham@ideasonboard.com","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":12229,"web_url":"https://patchwork.libcamera.org/comment/12229/","msgid":"<c27309f6-fda6-95d8-689e-f9a28e115499@linaro.org>","date":"2020-08-31T11:23:22","subject":"Re: [libcamera-devel] [RFC PATCH] qcam: format_converter: add 10\n\tand 12 bit packed raw Bayer formats","submitter":{"id":25,"url":"https://patchwork.libcamera.org/api/people/25/","name":"Andrey Konovalov","email":"andrey.konovalov@linaro.org"},"content":"Hi Kieran,\n\nThank you for the review!\n\nOn 31.08.2020 12:33, Kieran Bingham wrote:\n> Hi Andrey,\n> \n> On 31/08/2020 09:46, Andrey Konovalov wrote:\n>> No interpolation is used to get more speed by the price of lower image\n>> quality. In qcam format_converter is used for viewfinder only, and in\n>> this case lower lag is more important than the image quality.\n>>\n> \n> Great, I think this will be useful for early bring up of a new platform\n> / sensor when we just want to 'see' the image as quickly as possible.\n> \n> We should really get more 'information' presented in Qcam regarding what\n> processing is going on - so that it's clear to a viewer this is doing\n> software debayering or such - but that's way out of scope for this patch.\n> \n> \n> \n>> Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n>> ---\n>>   Only SRGGB10P and SRGGB12P formats were tested (the ones I can get from\n>>   the camera sensor I am currently using)\n>>\n>>   src/qcam/format_converter.cpp | 118 ++++++++++++++++++++++++++++++++++\n>>   src/qcam/format_converter.h   |  14 ++++\n>>   2 files changed, 132 insertions(+)\n>>\n>> diff --git a/src/qcam/format_converter.cpp b/src/qcam/format_converter.cpp\n>> index 4b9722d..c9f94d3 100644\n>> --- a/src/qcam/format_converter.cpp\n>> +++ b/src/qcam/format_converter.cpp\n>> @@ -136,6 +136,62 @@ int FormatConverter::configure(const libcamera::PixelFormat &format,\n>>   \t\tformatFamily_ = MJPEG;\n>>   \t\tbreak;\n>>   \n>> +\tcase libcamera::formats::SRGGB10_CSI2P:\n>> +\t\tformatFamily_ = RAW_CSI2P;\n>> +\t\tr_pos_ = 0;\n>> +\t\tbpp_numer_ = 4;\n>> +\t\tbpp_denom_ = 5;\n>> +\t\tbreak;\n>> +\n>> +\tcase libcamera::formats::SGRBG10_CSI2P:\n>> +\t\tformatFamily_ = RAW_CSI2P;\n>> +\t\tr_pos_ = 1;\n>> +\t\tbpp_numer_ = 4;\n>> +\t\tbpp_denom_ = 5;\n>> +\t\tbreak;\n>> +\n>> +\tcase libcamera::formats::SGBRG10_CSI2P:\n>> +\t\tformatFamily_ = RAW_CSI2P;\n>> +\t\tr_pos_ = 2;\n>> +\t\tbpp_numer_ = 4;\n>> +\t\tbpp_denom_ = 5;\n>> +\t\tbreak;\n>> +\n>> +\tcase libcamera::formats::SBGGR10_CSI2P:\n>> +\t\tformatFamily_ = RAW_CSI2P;\n>> +\t\tr_pos_ = 3;\n>> +\t\tbpp_numer_ = 4;\n>> +\t\tbpp_denom_ = 5;\n>> +\t\tbreak;\n>> +\n>> +\tcase libcamera::formats::SRGGB12_CSI2P:\n>> +\t\tformatFamily_ = RAW_CSI2P;\n>> +\t\tr_pos_ = 0;\n>> +\t\tbpp_numer_ = 2;\n>> +\t\tbpp_denom_ = 3;\n>> +\t\tbreak;\n>> +\n>> +\tcase libcamera::formats::SGRBG12_CSI2P:\n>> +\t\tformatFamily_ = RAW_CSI2P;\n>> +\t\tr_pos_ = 1;\n>> +\t\tbpp_numer_ = 2;\n>> +\t\tbpp_denom_ = 3;\n>> +\t\tbreak;\n>> +\n>> +\tcase libcamera::formats::SGBRG12_CSI2P:\n>> +\t\tformatFamily_ = RAW_CSI2P;\n>> +\t\tr_pos_ = 2;\n>> +\t\tbpp_numer_ = 2;\n>> +\t\tbpp_denom_ = 3;\n>> +\t\tbreak;\n>> +\n>> +\tcase libcamera::formats::SBGGR12_CSI2P:\n>> +\t\tformatFamily_ = RAW_CSI2P;\n>> +\t\tr_pos_ = 3;\n>> +\t\tbpp_numer_ = 2;\n>> +\t\tbpp_denom_ = 3;\n>> +\t\tbreak;\n>> +\n>>   \tdefault:\n>>   \t\treturn -EINVAL;\n>>   \t};\n>> @@ -163,9 +219,71 @@ void FormatConverter::convert(const unsigned char *src, size_t size,\n>>   \tcase NV:\n>>   \t\tconvertNV(src, dst->bits());\n>>   \t\tbreak;\n>> +\tcase RAW_CSI2P:\n>> +\t\tconvertRAW_CSI2P(src, dst->bits());\n>> +\t\tbreak;\n>>   \t};\n>>   }\n>>   \n>> +/*\n>> + * The pixels are processed in groups of 4 (2 by 2 squares), and the\n>> + * assumption is that height_ and width_ are even numbers.\n> \n> Do we need an assertion, or round-down in here to make sure we don't\n> overflow if the assumption is even numbers?\n\nIndeed, I need to handle this (if e.g. height_ is odd, the [height_] line\nwould be accessed while (y < height_) in the \"for\" loop is still true).\n\nI would go with round-down and qWarning() (so that qcam would continue to\nwork, with 1-pixel wide lines of random data at the leftmost and the lowest\npositions in the viewfinder window in the worst case).\n\nWill fix that in the next version of the patch.\n\n> (I can't imagine having an odd number on a bayer pattern, but with\n> cropping or such perhaps it could happen - I don't know)\n> \n> \n> Also - I wonder how cache-efficient it is processing like that. I'm not\n> sure if there's a way to make it more efficient, but even if there was,\n> that could be handled later and out of scope of this patch as this just\n> gets new functionality all the same.\n\nOK. I'll see if I could do something with that (not as part of this patch).\n\n>> + */\n>> +void FormatConverter::convertRAW_CSI2P(const unsigned char *src,\n>> +\t\t\t\t       unsigned char *dst)\n>> +{\n>> +\tunsigned int r_pos, b_pos, g1_pos, g2_pos;\n>> +\tunsigned char r, g1, g2, b;\n>> +\tunsigned int s_linelen = width_ * bpp_denom_ / bpp_numer_;\n>> +\tunsigned int d_linelen = width_ * 4;\n>> +\n>> +\t/*\n>> +\t * Calculate the offsets of the color values in the src buffer.\n>> +\t * g1 is green value from the even (upper) line, g2 is the green\n>> +\t * value from the odd (lower) line.\n>> +\t */\n>> +\tif ( r_pos_ > 1) {\n>> +\t\tr_pos = r_pos_ - 2 + s_linelen;\n>> +\t\tb_pos = 3 - r_pos_;\n>> +\t} else {\n>> +\t\tr_pos = r_pos_;\n>> +\t\tb_pos = 1 - r_pos_ + s_linelen;\n>> +\t}\n>> +\tg1_pos = (r_pos == 0 || b_pos == 0) ? 1 : 0;\n>> +\tg2_pos = 1 - g1_pos + s_linelen;\n> \n> Could those calculations be done at configure time rather than per-frame?\n\nRight, they could.\nMy only concern is how fast using the class member vs (hopefully) a register\nas an array index is (src[r_pos_] vs src[r_pos]).\nI'll check, and if there is no impact on performance will fix that in the next\nversion of the patch.\n\n>> +\n>> +\tfor (unsigned int y = 0; y < height_; y += 2) {\n>> +\t\tfor (unsigned x = 0; x < width_; x += bpp_numer_) {\n>> +\t\t\tfor (unsigned int i = 0; i < bpp_numer_ ; i += 2) {\n>> +\t\t\t\t/* read the colors for the current 2x2 group: */\n>> +\t\t\t\tr = src[r_pos];\n>> +\t\t\t\tg1 = src[g1_pos];\n>> +\t\t\t\tg2 = src[g2_pos];\n>> +\t\t\t\tb = src[b_pos];\n>> +\t\t\t\tsrc += 2;\n>> +\t\t\t\t/* two left pixels of the four: */\n>> +\t\t\t\tdst[0] = dst[0 + d_linelen] = b;\n>> +\t\t\t\tdst[1] = g1;\n>> +\t\t\t\tdst[1 + d_linelen] = g2;\n>> +\t\t\t\tdst[2] = dst[2 + d_linelen] = r;\n>> +\t\t\t\tdst[3] = dst[3 + d_linelen] = 0xff;\n>> +\t\t\t\tdst += 4;\n>> +\t\t\t\t/* two right pixels of the four: */\n>> +\t\t\t\tdst[0] = dst[0 + d_linelen] = b;\n>> +\t\t\t\tdst[1] = g1;\n>> +\t\t\t\tdst[1 + d_linelen] = g2;\n>> +\t\t\t\tdst[2] = dst[2 + d_linelen] = r;\n>> +\t\t\t\tdst[3] = dst[3 + d_linelen] = 0xff;\n>> +\t\t\t\tdst += 4;\n>> +\t\t\t}\n>> +\t\t\tsrc += bpp_denom_ - bpp_numer_;\n>> +\t\t}\n>> +\t\t/* move to the next even line: */\n>> +\t\tsrc += s_linelen;\n>> +\t\tdst += d_linelen;\n>> +\t}\n>> +}\n>> +\n>>   static void yuv_to_rgb(int y, int u, int v, int *r, int *g, int *b)\n>>   {\n>>   \tint c = y - 16;\n>> diff --git a/src/qcam/format_converter.h b/src/qcam/format_converter.h\n>> index e389b24..5d4f31f 100644\n>> --- a/src/qcam/format_converter.h\n>> +++ b/src/qcam/format_converter.h\n>> @@ -26,11 +26,13 @@ private:\n>>   \tenum FormatFamily {\n>>   \t\tMJPEG,\n>>   \t\tNV,\n>> +\t\tRAW_CSI2P,\n>>   \t\tRGB,\n>>   \t\tYUV,\n>>   \t};\n>>   \n>>   \tvoid convertNV(const unsigned char *src, unsigned char *dst);\n>> +\tvoid convertRAW_CSI2P(const unsigned char *src, unsigned char *dst);\n>>   \tvoid convertRGB(const unsigned char *src, unsigned char *dst);\n>>   \tvoid convertYUV(const unsigned char *src, unsigned char *dst);\n>>   \n>> @@ -45,6 +47,18 @@ private:\n>>   \tunsigned int vertSubSample_;\n>>   \tbool nvSwap_;\n>>   \n>> +\t/* RAW Bayer CSI2P parameters */\n>> +\t/*\n>> +\t * Bytes per pixel is a fractional number, and is represented by\n>> +\t * integer numerator and denominator.\n>> +\t */\n>> +\tunsigned int bpp_numer_;\n>> +\tunsigned int bpp_denom_;\n>> +\t/*\n>> +\t * Unsigned int r_pos_ from RGB parameters is reused; blue\n>> +\t * and green positions are deduced from the red one.\n>> +\t */\n> \n> Hrm ... I suspect it might be nicer to put the different configurations\n> into a union, rather than using a parameters of another configuration type.\n\nI'd add a patch to put NV parameters, RGB parameters, and YUV parameters\ninto the union first, and this \"RAW Bayer CSI2P\" patch would be the next\nin the series.\nDoes it make sense?\n\n> That would also make it neater to pre-compute and store the Bayer\n> specific offsets too...\n\nSounds good.\n\n\nThanks,\nAndrey\n\n> --\n> Kieran\n> \n> \n>> +\n>>   \t/* RGB parameters */\n>>   \tunsigned int bpp_;\n>>   \tunsigned int r_pos_;\n>>\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 9F190BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 31 Aug 2020 11:23:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 09FC562919;\n\tMon, 31 Aug 2020 13:23:26 +0200 (CEST)","from mail-lj1-x242.google.com (mail-lj1-x242.google.com\n\t[IPv6:2a00:1450:4864:20::242])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B3E0E61ADE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 Aug 2020 13:23:24 +0200 (CEST)","by mail-lj1-x242.google.com with SMTP id g6so6173932ljn.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 Aug 2020 04:23:24 -0700 (PDT)","from [192.168.118.216] (37-144-159-139.broadband.corbina.ru.\n\t[37.144.159.139]) by smtp.gmail.com with ESMTPSA id\n\tk12sm1916104lfe.68.2020.08.31.04.23.22\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tMon, 31 Aug 2020 04:23:23 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"lZShmOat\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=subject:to:references:from:message-id:date:user-agent:mime-version\n\t:in-reply-to:content-language:content-transfer-encoding;\n\tbh=ei7cITb5XcNtsC66K4kpyoe3GjAoY8tgav79ZuD/nVc=;\n\tb=lZShmOatWcahSttzHaMqShxHxPrAHwwb4BCdYuIaexharmx8hkf7DoeVLs4/TeJHbI\n\tOZt3cQVYdcNG2G2S0NJGi/hhqdeNzWtcREEV3zPEKty8J51uxuXa7P8xjGSm6qj4O3sC\n\tHXG43nf+fAPt3DXAech2gBcVCsDUdkok4hswL4dl0HZyS877DrVn/cL7btfqmTZOt0Vt\n\tlkb1w+3AYLpDeDu7KUn6JDu6YRjU3Y8IJGh2ka2Aw7Q7wfNfIEaHu7OJAop43A0i+Pn1\n\t/9sjqTPl71pgmko9TRTbJTiCJvTITnWGnFIb+0dpljv6v8Lh8zyGITBTMZzvLhWn6uws\n\t7cSQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:to:references:from:message-id:date\n\t:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=ei7cITb5XcNtsC66K4kpyoe3GjAoY8tgav79ZuD/nVc=;\n\tb=RkqR7ImS0aOXNskeQtfj9Oi0xA9BP2T4v8A4JhqJsQSYs2EBw5Hw2rOQ27XhvLfCPk\n\toowsyUaTuR7krOG+ELLprlAmUgi4u+dxgikrtTQXxZlhyLP1ZYY7qziZ8zlT+stFS9Tt\n\teWIUQVQQi5LtnVBFCj5kY9fKp1HtEoTGc3PRHJZffuYZuuuEc5Lfs8Rc5Yvmq9YpgPNw\n\tg1NT04MyOmai8hfIHAHEBQR7JUpfye9frkaRG+GqXpdELUNI5Fq1Sm3bhC3zxaizo3ym\n\tweAfHIKGUPikPH/2JsSP2aGiZsUVk5kc2YBT5kew5EAIT7PhRyJLv780UENltS9ouM0M\n\tZiOA==","X-Gm-Message-State":"AOAM530v1TeQ50rF/FcItso4rGvDe2TQW0jRZIDMYPh9xJVP7muehEoS\n\tdQP7GmnOiPdnCKhgDsNHjdJP8A==","X-Google-Smtp-Source":"ABdhPJxHVHh9xZHru0F2bQihOhjW+iDFhI3aMld0JHb6lTs/ORbLRZ8qiMiX9uc3eVYme/RxxoIuZQ==","X-Received":"by 2002:a2e:9ccd:: with SMTP id g13mr455975ljj.29.1598873003892; \n\tMon, 31 Aug 2020 04:23:23 -0700 (PDT)","To":"kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org","References":"<20200831084645.20683-1-andrey.konovalov@linaro.org>\n\t<386baf97-2075-a9b4-9e50-c83bafcf5549@ideasonboard.com>","From":"Andrey Konovalov <andrey.konovalov@linaro.org>","Message-ID":"<c27309f6-fda6-95d8-689e-f9a28e115499@linaro.org>","Date":"Mon, 31 Aug 2020 14:23:22 +0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101\n\tThunderbird/68.10.0","MIME-Version":"1.0","In-Reply-To":"<386baf97-2075-a9b4-9e50-c83bafcf5549@ideasonboard.com>","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [RFC PATCH] qcam: format_converter: add 10\n\tand 12 bit packed raw Bayer formats","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>","Content-Transfer-Encoding":"7bit","Content-Type":"text/plain; charset=\"us-ascii\"; Format=\"flowed\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":12231,"web_url":"https://patchwork.libcamera.org/comment/12231/","msgid":"<20200831145255.GG16155@pendragon.ideasonboard.com>","date":"2020-08-31T14:52:55","subject":"Re: [libcamera-devel] [RFC PATCH] qcam: format_converter: add 10\n\tand 12 bit packed raw Bayer formats","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Andrey,\n\nOn Mon, Aug 31, 2020 at 02:23:22PM +0300, Andrey Konovalov wrote:\n> On 31.08.2020 12:33, Kieran Bingham wrote:\n> > On 31/08/2020 09:46, Andrey Konovalov wrote:\n> >> No interpolation is used to get more speed by the price of lower image\n> >> quality. In qcam format_converter is used for viewfinder only, and in\n> >> this case lower lag is more important than the image quality.\n> > \n> > Great, I think this will be useful for early bring up of a new platform\n> > / sensor when we just want to 'see' the image as quickly as possible.\n> > \n> > We should really get more 'information' presented in Qcam regarding what\n> > processing is going on - so that it's clear to a viewer this is doing\n> > software debayering or such - but that's way out of scope for this patch.\n> > \n> >> Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n> >> ---\n> >>   Only SRGGB10P and SRGGB12P formats were tested (the ones I can get from\n> >>   the camera sensor I am currently using)\n> >>\n> >>   src/qcam/format_converter.cpp | 118 ++++++++++++++++++++++++++++++++++\n> >>   src/qcam/format_converter.h   |  14 ++++\n> >>   2 files changed, 132 insertions(+)\n> >>\n> >> diff --git a/src/qcam/format_converter.cpp b/src/qcam/format_converter.cpp\n> >> index 4b9722d..c9f94d3 100644\n> >> --- a/src/qcam/format_converter.cpp\n> >> +++ b/src/qcam/format_converter.cpp\n> >> @@ -136,6 +136,62 @@ int FormatConverter::configure(const libcamera::PixelFormat &format,\n> >>   \t\tformatFamily_ = MJPEG;\n> >>   \t\tbreak;\n> >>   \n> >> +\tcase libcamera::formats::SRGGB10_CSI2P:\n> >> +\t\tformatFamily_ = RAW_CSI2P;\n> >> +\t\tr_pos_ = 0;\n> >> +\t\tbpp_numer_ = 4;\n> >> +\t\tbpp_denom_ = 5;\n> >> +\t\tbreak;\n> >> +\n> >> +\tcase libcamera::formats::SGRBG10_CSI2P:\n> >> +\t\tformatFamily_ = RAW_CSI2P;\n> >> +\t\tr_pos_ = 1;\n> >> +\t\tbpp_numer_ = 4;\n> >> +\t\tbpp_denom_ = 5;\n> >> +\t\tbreak;\n> >> +\n> >> +\tcase libcamera::formats::SGBRG10_CSI2P:\n> >> +\t\tformatFamily_ = RAW_CSI2P;\n> >> +\t\tr_pos_ = 2;\n> >> +\t\tbpp_numer_ = 4;\n> >> +\t\tbpp_denom_ = 5;\n> >> +\t\tbreak;\n> >> +\n> >> +\tcase libcamera::formats::SBGGR10_CSI2P:\n> >> +\t\tformatFamily_ = RAW_CSI2P;\n> >> +\t\tr_pos_ = 3;\n> >> +\t\tbpp_numer_ = 4;\n> >> +\t\tbpp_denom_ = 5;\n> >> +\t\tbreak;\n> >> +\n> >> +\tcase libcamera::formats::SRGGB12_CSI2P:\n> >> +\t\tformatFamily_ = RAW_CSI2P;\n> >> +\t\tr_pos_ = 0;\n> >> +\t\tbpp_numer_ = 2;\n> >> +\t\tbpp_denom_ = 3;\n> >> +\t\tbreak;\n> >> +\n> >> +\tcase libcamera::formats::SGRBG12_CSI2P:\n> >> +\t\tformatFamily_ = RAW_CSI2P;\n> >> +\t\tr_pos_ = 1;\n> >> +\t\tbpp_numer_ = 2;\n> >> +\t\tbpp_denom_ = 3;\n> >> +\t\tbreak;\n> >> +\n> >> +\tcase libcamera::formats::SGBRG12_CSI2P:\n> >> +\t\tformatFamily_ = RAW_CSI2P;\n> >> +\t\tr_pos_ = 2;\n> >> +\t\tbpp_numer_ = 2;\n> >> +\t\tbpp_denom_ = 3;\n> >> +\t\tbreak;\n> >> +\n> >> +\tcase libcamera::formats::SBGGR12_CSI2P:\n> >> +\t\tformatFamily_ = RAW_CSI2P;\n> >> +\t\tr_pos_ = 3;\n> >> +\t\tbpp_numer_ = 2;\n> >> +\t\tbpp_denom_ = 3;\n> >> +\t\tbreak;\n> >> +\n> >>   \tdefault:\n> >>   \t\treturn -EINVAL;\n> >>   \t};\n> >> @@ -163,9 +219,71 @@ void FormatConverter::convert(const unsigned char *src, size_t size,\n> >>   \tcase NV:\n> >>   \t\tconvertNV(src, dst->bits());\n> >>   \t\tbreak;\n> >> +\tcase RAW_CSI2P:\n> >> +\t\tconvertRAW_CSI2P(src, dst->bits());\n\nconvertRawCSI2P ?\n\n> >> +\t\tbreak;\n> >>   \t};\n> >>   }\n> >>   \n> >> +/*\n> >> + * The pixels are processed in groups of 4 (2 by 2 squares), and the\n> >> + * assumption is that height_ and width_ are even numbers.\n> > \n> > Do we need an assertion, or round-down in here to make sure we don't\n> > overflow if the assumption is even numbers?\n> \n> Indeed, I need to handle this (if e.g. height_ is odd, the [height_] line\n> would be accessed while (y < height_) in the \"for\" loop is still true).\n> \n> I would go with round-down and qWarning() (so that qcam would continue to\n> work, with 1-pixel wide lines of random data at the leftmost and the lowest\n> positions in the viewfinder window in the worst case).\n> \n> Will fix that in the next version of the patch.\n\nIt could be good if the warning was printed at configure time, to avoid\nrepeating it for every frame.\n\n> > (I can't imagine having an odd number on a bayer pattern, but with\n> > cropping or such perhaps it could happen - I don't know)\n> > \n> > Also - I wonder how cache-efficient it is processing like that. I'm not\n> > sure if there's a way to make it more efficient, but even if there was,\n> > that could be handled later and out of scope of this patch as this just\n> > gets new functionality all the same.\n> \n> OK. I'll see if I could do something with that (not as part of this patch).\n\nA more cache-friendly implementation could indeed improv performances.\n\n> >> + */\n> >> +void FormatConverter::convertRAW_CSI2P(const unsigned char *src,\n> >> +\t\t\t\t       unsigned char *dst)\n> >> +{\n> >> +\tunsigned int r_pos, b_pos, g1_pos, g2_pos;\n> >> +\tunsigned char r, g1, g2, b;\n> >> +\tunsigned int s_linelen = width_ * bpp_denom_ / bpp_numer_;\n\nsrc_linelen, or better, srcLineLength.\n\n> >> +\tunsigned int d_linelen = width_ * 4;\n\nAnd dst there.\n\nI think we need to take the stride into account, not just the width.\nThat's true for all other formats too, so it doesn't need to be\naddressed in this patch.\n\n> >> +\n> >> +\t/*\n> >> +\t * Calculate the offsets of the color values in the src buffer.\n> >> +\t * g1 is green value from the even (upper) line, g2 is the green\n> >> +\t * value from the odd (lower) line.\n> >> +\t */\n> >> +\tif ( r_pos_ > 1) {\n\nExtra space after (\n\n> >> +\t\tr_pos = r_pos_ - 2 + s_linelen;\n> >> +\t\tb_pos = 3 - r_pos_;\n> >> +\t} else {\n> >> +\t\tr_pos = r_pos_;\n> >> +\t\tb_pos = 1 - r_pos_ + s_linelen;\n> >> +\t}\n> >> +\tg1_pos = (r_pos == 0 || b_pos == 0) ? 1 : 0;\n> >> +\tg2_pos = 1 - g1_pos + s_linelen;\n> > \n> > Could those calculations be done at configure time rather than per-frame?\n> \n> Right, they could.\n> My only concern is how fast using the class member vs (hopefully) a register\n> as an array index is (src[r_pos_] vs src[r_pos]).\n> I'll check, and if there is no impact on performance will fix that in the next\n> version of the patch.\n> \n> >> +\n> >> +\tfor (unsigned int y = 0; y < height_; y += 2) {\n> >> +\t\tfor (unsigned x = 0; x < width_; x += bpp_numer_) {\n> >> +\t\t\tfor (unsigned int i = 0; i < bpp_numer_ ; i += 2) {\n> >> +\t\t\t\t/* read the colors for the current 2x2 group: */\n> >> +\t\t\t\tr = src[r_pos];\n> >> +\t\t\t\tg1 = src[g1_pos];\n> >> +\t\t\t\tg2 = src[g2_pos];\n\nI wonder if we shouldn't average the two green components.\n\n> >> +\t\t\t\tb = src[b_pos];\n> >> +\t\t\t\tsrc += 2;\n> >> +\t\t\t\t/* two left pixels of the four: */\n> >> +\t\t\t\tdst[0] = dst[0 + d_linelen] = b;\n> >> +\t\t\t\tdst[1] = g1;\n> >> +\t\t\t\tdst[1 + d_linelen] = g2;\n> >> +\t\t\t\tdst[2] = dst[2 + d_linelen] = r;\n> >> +\t\t\t\tdst[3] = dst[3 + d_linelen] = 0xff;\n> >> +\t\t\t\tdst += 4;\n> >> +\t\t\t\t/* two right pixels of the four: */\n> >> +\t\t\t\tdst[0] = dst[0 + d_linelen] = b;\n> >> +\t\t\t\tdst[1] = g1;\n> >> +\t\t\t\tdst[1 + d_linelen] = g2;\n> >> +\t\t\t\tdst[2] = dst[2 + d_linelen] = r;\n> >> +\t\t\t\tdst[3] = dst[3 + d_linelen] = 0xff;\n> >> +\t\t\t\tdst += 4;\n> >> +\t\t\t}\n> >> +\t\t\tsrc += bpp_denom_ - bpp_numer_;\n> >> +\t\t}\n> >> +\t\t/* move to the next even line: */\n> >> +\t\tsrc += s_linelen;\n> >> +\t\tdst += d_linelen;\n> >> +\t}\n> >> +}\n> >> +\n> >>   static void yuv_to_rgb(int y, int u, int v, int *r, int *g, int *b)\n> >>   {\n> >>   \tint c = y - 16;\n> >> diff --git a/src/qcam/format_converter.h b/src/qcam/format_converter.h\n> >> index e389b24..5d4f31f 100644\n> >> --- a/src/qcam/format_converter.h\n> >> +++ b/src/qcam/format_converter.h\n> >> @@ -26,11 +26,13 @@ private:\n> >>   \tenum FormatFamily {\n> >>   \t\tMJPEG,\n> >>   \t\tNV,\n> >> +\t\tRAW_CSI2P,\n> >>   \t\tRGB,\n> >>   \t\tYUV,\n> >>   \t};\n> >>   \n> >>   \tvoid convertNV(const unsigned char *src, unsigned char *dst);\n> >> +\tvoid convertRAW_CSI2P(const unsigned char *src, unsigned char *dst);\n> >>   \tvoid convertRGB(const unsigned char *src, unsigned char *dst);\n> >>   \tvoid convertYUV(const unsigned char *src, unsigned char *dst);\n> >>   \n> >> @@ -45,6 +47,18 @@ private:\n> >>   \tunsigned int vertSubSample_;\n> >>   \tbool nvSwap_;\n> >>   \n> >> +\t/* RAW Bayer CSI2P parameters */\n> >> +\t/*\n> >> +\t * Bytes per pixel is a fractional number, and is represented by\n> >> +\t * integer numerator and denominator.\n> >> +\t */\n> >> +\tunsigned int bpp_numer_;\n> >> +\tunsigned int bpp_denom_;\n> >> +\t/*\n> >> +\t * Unsigned int r_pos_ from RGB parameters is reused; blue\n> >> +\t * and green positions are deduced from the red one.\n> >> +\t */\n> > \n> > Hrm ... I suspect it might be nicer to put the different configurations\n> > into a union, rather than using a parameters of another configuration type.\n> \n> I'd add a patch to put NV parameters, RGB parameters, and YUV parameters\n> into the union first, and this \"RAW Bayer CSI2P\" patch would be the next\n> in the series.\n> Does it make sense?\n> \n> > That would also make it neater to pre-compute and store the Bayer\n> > specific offsets too...\n> \n> Sounds good.\n> \n> >> +\n> >>   \t/* RGB parameters */\n> >>   \tunsigned int bpp_;\n> >>   \tunsigned int r_pos_;","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 E2619BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 31 Aug 2020 14:53:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7826562925;\n\tMon, 31 Aug 2020 16:53:20 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 876B461ADE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 Aug 2020 16:53:19 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0DF0A277;\n\tMon, 31 Aug 2020 16:53:16 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"jHgVKGDt\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1598885597;\n\tbh=fNVJX1AixZU40omaSQVNnIlqRZahw8jWuWvv7vhvu5A=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=jHgVKGDtexJqZdOjxSunGs/YDy1zEL5Hd6ueyN7J0KQm+gQ3K2j9T2cHKP7W5oYxg\n\t9Pql6sOz8Lu3Ox24tW99XgX2fLjh77TtB392G6XwEpsbntReBFwkTgtKHV3xxyr+rI\n\tPkzu56jhNs6jG2jUMbhN8PCfJsMdGFGaDBwaGirs=","Date":"Mon, 31 Aug 2020 17:52:55 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Andrey Konovalov <andrey.konovalov@linaro.org>","Message-ID":"<20200831145255.GG16155@pendragon.ideasonboard.com>","References":"<20200831084645.20683-1-andrey.konovalov@linaro.org>\n\t<386baf97-2075-a9b4-9e50-c83bafcf5549@ideasonboard.com>\n\t<c27309f6-fda6-95d8-689e-f9a28e115499@linaro.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<c27309f6-fda6-95d8-689e-f9a28e115499@linaro.org>","Subject":"Re: [libcamera-devel] [RFC PATCH] qcam: format_converter: add 10\n\tand 12 bit packed raw Bayer formats","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","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":12232,"web_url":"https://patchwork.libcamera.org/comment/12232/","msgid":"<b51ec84e-01cf-9175-d63a-7c4f94baffe0@linaro.org>","date":"2020-08-31T15:15:25","subject":"Re: [libcamera-devel] [RFC PATCH] qcam: format_converter: add 10\n\tand 12 bit packed raw Bayer formats","submitter":{"id":25,"url":"https://patchwork.libcamera.org/api/people/25/","name":"Andrey Konovalov","email":"andrey.konovalov@linaro.org"},"content":"Hi Laurent,\n\nThank you for the review!\n\nOn 31.08.2020 17:52, Laurent Pinchart wrote:\n> Hi Andrey,\n> \n> On Mon, Aug 31, 2020 at 02:23:22PM +0300, Andrey Konovalov wrote:\n>> On 31.08.2020 12:33, Kieran Bingham wrote:\n>>> On 31/08/2020 09:46, Andrey Konovalov wrote:\n>>>> No interpolation is used to get more speed by the price of lower image\n>>>> quality. In qcam format_converter is used for viewfinder only, and in\n>>>> this case lower lag is more important than the image quality.\n>>>\n>>> Great, I think this will be useful for early bring up of a new platform\n>>> / sensor when we just want to 'see' the image as quickly as possible.\n>>>\n>>> We should really get more 'information' presented in Qcam regarding what\n>>> processing is going on - so that it's clear to a viewer this is doing\n>>> software debayering or such - but that's way out of scope for this patch.\n>>>\n>>>> Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>\n>>>> ---\n>>>>    Only SRGGB10P and SRGGB12P formats were tested (the ones I can get from\n>>>>    the camera sensor I am currently using)\n>>>>\n>>>>    src/qcam/format_converter.cpp | 118 ++++++++++++++++++++++++++++++++++\n>>>>    src/qcam/format_converter.h   |  14 ++++\n>>>>    2 files changed, 132 insertions(+)\n>>>>\n>>>> diff --git a/src/qcam/format_converter.cpp b/src/qcam/format_converter.cpp\n>>>> index 4b9722d..c9f94d3 100644\n>>>> --- a/src/qcam/format_converter.cpp\n>>>> +++ b/src/qcam/format_converter.cpp\n>>>> @@ -136,6 +136,62 @@ int FormatConverter::configure(const libcamera::PixelFormat &format,\n>>>>    \t\tformatFamily_ = MJPEG;\n>>>>    \t\tbreak;\n>>>>    \n>>>> +\tcase libcamera::formats::SRGGB10_CSI2P:\n>>>> +\t\tformatFamily_ = RAW_CSI2P;\n>>>> +\t\tr_pos_ = 0;\n>>>> +\t\tbpp_numer_ = 4;\n>>>> +\t\tbpp_denom_ = 5;\n>>>> +\t\tbreak;\n>>>> +\n>>>> +\tcase libcamera::formats::SGRBG10_CSI2P:\n>>>> +\t\tformatFamily_ = RAW_CSI2P;\n>>>> +\t\tr_pos_ = 1;\n>>>> +\t\tbpp_numer_ = 4;\n>>>> +\t\tbpp_denom_ = 5;\n>>>> +\t\tbreak;\n>>>> +\n>>>> +\tcase libcamera::formats::SGBRG10_CSI2P:\n>>>> +\t\tformatFamily_ = RAW_CSI2P;\n>>>> +\t\tr_pos_ = 2;\n>>>> +\t\tbpp_numer_ = 4;\n>>>> +\t\tbpp_denom_ = 5;\n>>>> +\t\tbreak;\n>>>> +\n>>>> +\tcase libcamera::formats::SBGGR10_CSI2P:\n>>>> +\t\tformatFamily_ = RAW_CSI2P;\n>>>> +\t\tr_pos_ = 3;\n>>>> +\t\tbpp_numer_ = 4;\n>>>> +\t\tbpp_denom_ = 5;\n>>>> +\t\tbreak;\n>>>> +\n>>>> +\tcase libcamera::formats::SRGGB12_CSI2P:\n>>>> +\t\tformatFamily_ = RAW_CSI2P;\n>>>> +\t\tr_pos_ = 0;\n>>>> +\t\tbpp_numer_ = 2;\n>>>> +\t\tbpp_denom_ = 3;\n>>>> +\t\tbreak;\n>>>> +\n>>>> +\tcase libcamera::formats::SGRBG12_CSI2P:\n>>>> +\t\tformatFamily_ = RAW_CSI2P;\n>>>> +\t\tr_pos_ = 1;\n>>>> +\t\tbpp_numer_ = 2;\n>>>> +\t\tbpp_denom_ = 3;\n>>>> +\t\tbreak;\n>>>> +\n>>>> +\tcase libcamera::formats::SGBRG12_CSI2P:\n>>>> +\t\tformatFamily_ = RAW_CSI2P;\n>>>> +\t\tr_pos_ = 2;\n>>>> +\t\tbpp_numer_ = 2;\n>>>> +\t\tbpp_denom_ = 3;\n>>>> +\t\tbreak;\n>>>> +\n>>>> +\tcase libcamera::formats::SBGGR12_CSI2P:\n>>>> +\t\tformatFamily_ = RAW_CSI2P;\n>>>> +\t\tr_pos_ = 3;\n>>>> +\t\tbpp_numer_ = 2;\n>>>> +\t\tbpp_denom_ = 3;\n>>>> +\t\tbreak;\n>>>> +\n>>>>    \tdefault:\n>>>>    \t\treturn -EINVAL;\n>>>>    \t};\n>>>> @@ -163,9 +219,71 @@ void FormatConverter::convert(const unsigned char *src, size_t size,\n>>>>    \tcase NV:\n>>>>    \t\tconvertNV(src, dst->bits());\n>>>>    \t\tbreak;\n>>>> +\tcase RAW_CSI2P:\n>>>> +\t\tconvertRAW_CSI2P(src, dst->bits());\n> \n> convertRawCSI2P ?\n\nOK, will fix in v2 of the patch.\n\n>>>> +\t\tbreak;\n>>>>    \t};\n>>>>    }\n>>>>    \n>>>> +/*\n>>>> + * The pixels are processed in groups of 4 (2 by 2 squares), and the\n>>>> + * assumption is that height_ and width_ are even numbers.\n>>>\n>>> Do we need an assertion, or round-down in here to make sure we don't\n>>> overflow if the assumption is even numbers?\n>>\n>> Indeed, I need to handle this (if e.g. height_ is odd, the [height_] line\n>> would be accessed while (y < height_) in the \"for\" loop is still true).\n>>\n>> I would go with round-down and qWarning() (so that qcam would continue to\n>> work, with 1-pixel wide lines of random data at the leftmost and the lowest\n>> positions in the viewfinder window in the worst case).\n>>\n>> Will fix that in the next version of the patch.\n> \n> It could be good if the warning was printed at configure time, to avoid\n> repeating it for every frame.\n\nThat's good point. Thanks!\n\n>>> (I can't imagine having an odd number on a bayer pattern, but with\n>>> cropping or such perhaps it could happen - I don't know)\n>>>\n>>> Also - I wonder how cache-efficient it is processing like that. I'm not\n>>> sure if there's a way to make it more efficient, but even if there was,\n>>> that could be handled later and out of scope of this patch as this just\n>>> gets new functionality all the same.\n>>\n>> OK. I'll see if I could do something with that (not as part of this patch).\n> \n> A more cache-friendly implementation could indeed improv performances.\n\nOK. Something for me to investigate\n\n>>>> + */\n>>>> +void FormatConverter::convertRAW_CSI2P(const unsigned char *src,\n>>>> +\t\t\t\t       unsigned char *dst)\n>>>> +{\n>>>> +\tunsigned int r_pos, b_pos, g1_pos, g2_pos;\n>>>> +\tunsigned char r, g1, g2, b;\n>>>> +\tunsigned int s_linelen = width_ * bpp_denom_ / bpp_numer_;\n> \n> src_linelen, or better, srcLineLength.\n\nOK\n\n>>>> +\tunsigned int d_linelen = width_ * 4;\n> \n> And dst there.\n\nOK\n\n> I think we need to take the stride into account, not just the width.\n> That's true for all other formats too, so it doesn't need to be\n> addressed in this patch.\n\nOK, fine for me.\n\n>>>> +\n>>>> +\t/*\n>>>> +\t * Calculate the offsets of the color values in the src buffer.\n>>>> +\t * g1 is green value from the even (upper) line, g2 is the green\n>>>> +\t * value from the odd (lower) line.\n>>>> +\t */\n>>>> +\tif ( r_pos_ > 1) {\n> \n> Extra space after (\n\nOops..\n\n>>>> +\t\tr_pos = r_pos_ - 2 + s_linelen;\n>>>> +\t\tb_pos = 3 - r_pos_;\n>>>> +\t} else {\n>>>> +\t\tr_pos = r_pos_;\n>>>> +\t\tb_pos = 1 - r_pos_ + s_linelen;\n>>>> +\t}\n>>>> +\tg1_pos = (r_pos == 0 || b_pos == 0) ? 1 : 0;\n>>>> +\tg2_pos = 1 - g1_pos + s_linelen;\n>>>\n>>> Could those calculations be done at configure time rather than per-frame?\n>>\n>> Right, they could.\n>> My only concern is how fast using the class member vs (hopefully) a register\n>> as an array index is (src[r_pos_] vs src[r_pos]).\n>> I'll check, and if there is no impact on performance will fix that in the next\n>> version of the patch.\n>>\n>>>> +\n>>>> +\tfor (unsigned int y = 0; y < height_; y += 2) {\n>>>> +\t\tfor (unsigned x = 0; x < width_; x += bpp_numer_) {\n>>>> +\t\t\tfor (unsigned int i = 0; i < bpp_numer_ ; i += 2) {\n>>>> +\t\t\t\t/* read the colors for the current 2x2 group: */\n>>>> +\t\t\t\tr = src[r_pos];\n>>>> +\t\t\t\tg1 = src[g1_pos];\n>>>> +\t\t\t\tg2 = src[g2_pos];\n> \n> I wonder if we shouldn't average the two green components.\n\nProbably.\n\nJust I don't have proper means other than naked eyes to check that at the moment.\n(E.g. if I had a more precise demosaic implementation - this is in plans too - I could\njust check which of the options gives the result closest to the output of the advanced\nalgorithm. And I would need a good set of test images to make a valid choice.)\n\nThanks,\nAndrey\n\n>>>> +\t\t\t\tb = src[b_pos];\n>>>> +\t\t\t\tsrc += 2;\n>>>> +\t\t\t\t/* two left pixels of the four: */\n>>>> +\t\t\t\tdst[0] = dst[0 + d_linelen] = b;\n>>>> +\t\t\t\tdst[1] = g1;\n>>>> +\t\t\t\tdst[1 + d_linelen] = g2;\n>>>> +\t\t\t\tdst[2] = dst[2 + d_linelen] = r;\n>>>> +\t\t\t\tdst[3] = dst[3 + d_linelen] = 0xff;\n>>>> +\t\t\t\tdst += 4;\n>>>> +\t\t\t\t/* two right pixels of the four: */\n>>>> +\t\t\t\tdst[0] = dst[0 + d_linelen] = b;\n>>>> +\t\t\t\tdst[1] = g1;\n>>>> +\t\t\t\tdst[1 + d_linelen] = g2;\n>>>> +\t\t\t\tdst[2] = dst[2 + d_linelen] = r;\n>>>> +\t\t\t\tdst[3] = dst[3 + d_linelen] = 0xff;\n>>>> +\t\t\t\tdst += 4;\n>>>> +\t\t\t}\n>>>> +\t\t\tsrc += bpp_denom_ - bpp_numer_;\n>>>> +\t\t}\n>>>> +\t\t/* move to the next even line: */\n>>>> +\t\tsrc += s_linelen;\n>>>> +\t\tdst += d_linelen;\n>>>> +\t}\n>>>> +}\n>>>> +\n>>>>    static void yuv_to_rgb(int y, int u, int v, int *r, int *g, int *b)\n>>>>    {\n>>>>    \tint c = y - 16;\n>>>> diff --git a/src/qcam/format_converter.h b/src/qcam/format_converter.h\n>>>> index e389b24..5d4f31f 100644\n>>>> --- a/src/qcam/format_converter.h\n>>>> +++ b/src/qcam/format_converter.h\n>>>> @@ -26,11 +26,13 @@ private:\n>>>>    \tenum FormatFamily {\n>>>>    \t\tMJPEG,\n>>>>    \t\tNV,\n>>>> +\t\tRAW_CSI2P,\n>>>>    \t\tRGB,\n>>>>    \t\tYUV,\n>>>>    \t};\n>>>>    \n>>>>    \tvoid convertNV(const unsigned char *src, unsigned char *dst);\n>>>> +\tvoid convertRAW_CSI2P(const unsigned char *src, unsigned char *dst);\n>>>>    \tvoid convertRGB(const unsigned char *src, unsigned char *dst);\n>>>>    \tvoid convertYUV(const unsigned char *src, unsigned char *dst);\n>>>>    \n>>>> @@ -45,6 +47,18 @@ private:\n>>>>    \tunsigned int vertSubSample_;\n>>>>    \tbool nvSwap_;\n>>>>    \n>>>> +\t/* RAW Bayer CSI2P parameters */\n>>>> +\t/*\n>>>> +\t * Bytes per pixel is a fractional number, and is represented by\n>>>> +\t * integer numerator and denominator.\n>>>> +\t */\n>>>> +\tunsigned int bpp_numer_;\n>>>> +\tunsigned int bpp_denom_;\n>>>> +\t/*\n>>>> +\t * Unsigned int r_pos_ from RGB parameters is reused; blue\n>>>> +\t * and green positions are deduced from the red one.\n>>>> +\t */\n>>>\n>>> Hrm ... I suspect it might be nicer to put the different configurations\n>>> into a union, rather than using a parameters of another configuration type.\n>>\n>> I'd add a patch to put NV parameters, RGB parameters, and YUV parameters\n>> into the union first, and this \"RAW Bayer CSI2P\" patch would be the next\n>> in the series.\n>> Does it make sense?\n>>\n>>> That would also make it neater to pre-compute and store the Bayer\n>>> specific offsets too...\n>>\n>> Sounds good.\n>>\n>>>> +\n>>>>    \t/* RGB parameters */\n>>>>    \tunsigned int bpp_;\n>>>>    \tunsigned int r_pos_;\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 4B317BF019\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 31 Aug 2020 15:15:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A63E262919;\n\tMon, 31 Aug 2020 17:15:37 +0200 (CEST)","from mail-lf1-x144.google.com (mail-lf1-x144.google.com\n\t[IPv6:2a00:1450:4864:20::144])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5606661ADE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 Aug 2020 17:15:35 +0200 (CEST)","by mail-lf1-x144.google.com with SMTP id z17so3685741lfi.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 Aug 2020 08:15:35 -0700 (PDT)","from [192.168.118.216] (37-144-159-139.broadband.corbina.ru.\n\t[37.144.159.139]) by smtp.gmail.com with ESMTPSA id\n\tx6sm2021256lfn.76.2020.08.31.08.15.32\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tMon, 31 Aug 2020 08:15:33 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"XnEEkLc3\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=Ij4IQZPNAQ9f3F2AafQc8pQJSAgcDWJQsnV/5vg/Cdg=;\n\tb=XnEEkLc34O7KqIAB0KcQnJ0T6l0LT6ig8NRfYI67O+6/ql5eQ3voFxENrkmmLtz9U+\n\tl9Hdcwptv3CNyQRfQuFuyOUG6CO1YGf/+rusaAhGJqa3CNN/t/O+B8bTuENaTAdhbCTH\n\tWTkmnqHKwJbIoeP3/DHH3mYmOIKpupgeAB0ZmTZNaqIuaycWQBajMupNuRVKz6tlbyl/\n\tfh6CNdggQffoa9jMNCmFHcJ61JQzb5M8RdknV9iwiGFK+xr09QhsmPuhHvyfOix7J0A0\n\twwM8U5YrUSA43jkfoTN/nWfzrCbqRo4l25BVQ+2uoSptYr5us2l79UJOBHU0IpD7zRV2\n\t89TQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:to:cc:references:from:message-id:date\n\t:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=Ij4IQZPNAQ9f3F2AafQc8pQJSAgcDWJQsnV/5vg/Cdg=;\n\tb=B/HFht94My8jEuYUKy9uTDPNB8E0dTn+exyotfpQAGaUctraAEgEhwXtX79l4/xSIj\n\tIU/S6PN/lAqCxdblzcwNz1rYMMh11pqmAR/d1D5HuDh3KainvfRMdVDI/kVQYQS1k4xp\n\tx0gbw6mdQOZJI4UEY37YYI8rJOQJ0YNrhotM1MjwaVDjMn0g5ViDaD8JwNan22ePL4wC\n\tGSc0MrNYDwJaudtyFCDoZ1E9EOpFdlkgHEInW6/xXPFxuoEbRRJD0agDHC+vgANCo2Fa\n\tScY38aJ7IFiVGXemhTWi613ZOzNLF3QqanyAaaLOKDoirCDILTyfpviYMVcf/+bvnxVl\n\tZ06g==","X-Gm-Message-State":"AOAM530B894eugHcOayor967xmNh0TjKAvxknSi1BbbROFReRhfIV8x8\n\tml8pVqcWEwDzBB4xiLNqEXxWVQ==","X-Google-Smtp-Source":"ABdhPJwTCsSLMRMueGFf8vnwCDlCUCPzj3SgsNa/u6C1gXD7dGkOfbWERcVcP4yF9Qv+zMA2Q/FYTA==","X-Received":"by 2002:ac2:42cd:: with SMTP id n13mr897991lfl.190.1598886934325;\n\tMon, 31 Aug 2020 08:15:34 -0700 (PDT)","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20200831084645.20683-1-andrey.konovalov@linaro.org>\n\t<386baf97-2075-a9b4-9e50-c83bafcf5549@ideasonboard.com>\n\t<c27309f6-fda6-95d8-689e-f9a28e115499@linaro.org>\n\t<20200831145255.GG16155@pendragon.ideasonboard.com>","From":"Andrey Konovalov <andrey.konovalov@linaro.org>","Message-ID":"<b51ec84e-01cf-9175-d63a-7c4f94baffe0@linaro.org>","Date":"Mon, 31 Aug 2020 18:15:25 +0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101\n\tThunderbird/68.10.0","MIME-Version":"1.0","In-Reply-To":"<20200831145255.GG16155@pendragon.ideasonboard.com>","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [RFC PATCH] qcam: format_converter: add 10\n\tand 12 bit packed raw Bayer formats","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","Content-Transfer-Encoding":"7bit","Content-Type":"text/plain; charset=\"us-ascii\"; Format=\"flowed\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]