[{"id":19488,"web_url":"https://patchwork.libcamera.org/comment/19488/","msgid":"<85ef8e1f-9a02-842f-5a78-8cb8759cdab9@ideasonboard.com>","date":"2021-09-07T00:00:09","subject":"Re: [libcamera-devel] [PATCH v3 19/30] android: jpeg: Use stride\n\tinstead of image width for line address","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 06/09/2021 23:56, Laurent Pinchart wrote:\n> When calculating the luma line address, the image width is used instead\n> of the stride. Without padding at the end of the line the the values\n> should be identical, but this is conceptually incorrect in any case. Fix\n> it.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/android/jpeg/encoder_libjpeg.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/android/jpeg/encoder_libjpeg.cpp b/src/android/jpeg/encoder_libjpeg.cpp\n> index b8b01e20a001..807a0949a8fc 100644\n> --- a/src/android/jpeg/encoder_libjpeg.cpp\n> +++ b/src/android/jpeg/encoder_libjpeg.cpp\n> @@ -152,7 +152,7 @@ void EncoderLibJpeg::compressNV(Span<const uint8_t> frame)\n>  \tfor (unsigned int y = 0; y < compress_.image_height; y++) {\n>  \t\tunsigned char *dst = &tmprowbuf[0];\n>  \n> -\t\tconst unsigned char *src_y = src + y * compress_.image_width;\n> +\t\tconst unsigned char *src_y = src + y * y_stride;\n>  \t\tconst unsigned char *src_cb = src_c + (y / vertSubSample) * c_stride + cb_pos;\n>  \t\tconst unsigned char *src_cr = src_c + (y / vertSubSample) * c_stride + cr_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 06BFCBDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Sep 2021 00:00:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8BF3C6916A;\n\tTue,  7 Sep 2021 02:00:14 +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 DE6B460253\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Sep 2021 02:00:12 +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 588BDF49;\n\tTue,  7 Sep 2021 02:00:12 +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=\"mipuTuM3\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630972812;\n\tbh=a4jDSdlSNosgwP7cdDXzwCE/QO2hgyY27ElPpeewbJw=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=mipuTuM3wA9jTFwIbgCOBatlDaVz1ga29/UZwKuXFcZ+CoyhMbziTVsdNoxPjyHBW\n\t/nNWWtugRYHLpAUi+0n7gyh3Qu4lHZOx/E5iq5s49WZjcQIlxVhwtT72eMfX1qHUsi\n\t5/Qv2jLG8pj5yqrfve3/Nuie4iUHwj35onG//1FQ=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210906225420.13275-1-laurent.pinchart@ideasonboard.com>\n\t<20210906225636.14683-19-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<85ef8e1f-9a02-842f-5a78-8cb8759cdab9@ideasonboard.com>","Date":"Tue, 7 Sep 2021 01:00:09 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.11.0","MIME-Version":"1.0","In-Reply-To":"<20210906225636.14683-19-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v3 19/30] android: jpeg: Use stride\n\tinstead of image width for line address","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":19516,"web_url":"https://patchwork.libcamera.org/comment/19516/","msgid":"<feefd484-c692-2d07-3477-7ce236695746@ideasonboard.com>","date":"2021-09-07T14:22:48","subject":"Re: [libcamera-devel] [PATCH v3 19/30] android: jpeg: Use stride\n\tinstead of image width for line address","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 07/09/2021 02:00, Kieran Bingham wrote:\n> On 06/09/2021 23:56, Laurent Pinchart wrote:\n>> When calculating the luma line address, the image width is used instead\n>> of the stride. Without padding at the end of the line the the values\n>> should be identical, but this is conceptually incorrect in any case. Fix\n>> it.\n>>\n>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> \n>> ---\n>>  src/android/jpeg/encoder_libjpeg.cpp | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/src/android/jpeg/encoder_libjpeg.cpp b/src/android/jpeg/encoder_libjpeg.cpp\n>> index b8b01e20a001..807a0949a8fc 100644\n>> --- a/src/android/jpeg/encoder_libjpeg.cpp\n>> +++ b/src/android/jpeg/encoder_libjpeg.cpp\n>> @@ -152,7 +152,7 @@ void EncoderLibJpeg::compressNV(Span<const uint8_t> frame)\n>>  \tfor (unsigned int y = 0; y < compress_.image_height; y++) {\n>>  \t\tunsigned char *dst = &tmprowbuf[0];\n>>  \n>> -\t\tconst unsigned char *src_y = src + y * compress_.image_width;\n>> +\t\tconst unsigned char *src_y = src + y * y_stride;\n>>  \t\tconst unsigned char *src_cb = src_c + (y / vertSubSample) * c_stride + cb_pos;\n>>  \t\tconst unsigned char *src_cr = src_c + (y / vertSubSample) * c_stride + cr_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 A9904BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Sep 2021 14:22:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2C6FB6916A;\n\tTue,  7 Sep 2021 16:22:53 +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 6A85960251\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Sep 2021 16:22:51 +0200 (CEST)","from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:e0a9:3439:7934:19a5])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F0A2124F;\n\tTue,  7 Sep 2021 16:22: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=\"WoafRpAl\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1631024571;\n\tbh=D0sO25n/4+6OXCRQyps46SbedeA3/BzYIr9Qjeane8o=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=WoafRpAl+2NKX7ws3bQ0NyNEn+0USbW9ppkXgIPPjw1sjmuapwQG7igABWp4PbiA/\n\tFpPcfgRK2xGILQ28apkJK4H+LXdC/aBXukMbGTQWE2qO8QJf2smOh8rJbTfSHpSXBI\n\tdAvr2yJZHqdfhHJs2dhD1WMJG7FpaZYXhLqdYgK4=","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210906225420.13275-1-laurent.pinchart@ideasonboard.com>\n\t<20210906225636.14683-19-laurent.pinchart@ideasonboard.com>\n\t<85ef8e1f-9a02-842f-5a78-8cb8759cdab9@ideasonboard.com>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<feefd484-c692-2d07-3477-7ce236695746@ideasonboard.com>","Date":"Tue, 7 Sep 2021 16:22:48 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.13.0","MIME-Version":"1.0","In-Reply-To":"<85ef8e1f-9a02-842f-5a78-8cb8759cdab9@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v3 19/30] android: jpeg: Use stride\n\tinstead of image width for line address","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>"}}]