[{"id":13404,"web_url":"https://patchwork.libcamera.org/comment/13404/","msgid":"<6ca671c4-e16b-a8e6-b23b-0d62b796a004@uajain.com>","date":"2020-10-22T07:46:58","subject":"Re: [libcamera-devel] [PATCH v3 1/4] android: Modify PostProcessor\n\tinterface","submitter":{"id":1,"url":"https://patchwork.libcamera.org/api/people/1/","name":"Umang Jain","email":"email@uajain.com"},"content":"Hi  all,\n\nI have re-reviewed the series and changes look good to me.\n\nPatches 3/4 and 4/4 will require changing const pointer style to use \nprefix-ed const. Apart from that, I don't think anything is blocking for \nmerging.\n\nThanks!\n\nOn 10/21/20 7:09 AM, Hirokazu Honda wrote:\n> In PostProcessor::process(), the |source| argument doesn't have\n> to be a pointer. This replaces its type, const pointer, with\n> const reference as the latter is preferred to the former.\n> libcamera::Span is cheap to construct/copy/move. We should deal\n> with the type as pass-by-value parameter. Therefore this also\n> drops the const reference in the |destination| argument.\n>\n> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> Reviewed-by: Umang Jain <email@uajain.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>   src/android/camera_stream.cpp            | 2 +-\n>   src/android/jpeg/post_processor_jpeg.cpp | 6 +++---\n>   src/android/jpeg/post_processor_jpeg.h   | 4 ++--\n>   src/android/post_processor.h             | 4 ++--\n>   4 files changed, 8 insertions(+), 8 deletions(-)\n>\n> diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\n> index eae451e..3e5d6be 100644\n> --- a/src/android/camera_stream.cpp\n> +++ b/src/android/camera_stream.cpp\n> @@ -102,7 +102,7 @@ int CameraStream::process(const libcamera::FrameBuffer &source,\n>   \tif (!postProcessor_)\n>   \t\treturn 0;\n>   \n> -\treturn postProcessor_->process(&source, dest->maps()[0], metadata);\n> +\treturn postProcessor_->process(source, dest->maps()[0], metadata);\n>   }\n>   \n>   FrameBuffer *CameraStream::getBuffer()\n> diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp\n> index 9d452b7..90bf10d 100644\n> --- a/src/android/jpeg/post_processor_jpeg.cpp\n> +++ b/src/android/jpeg/post_processor_jpeg.cpp\n> @@ -44,8 +44,8 @@ int PostProcessorJpeg::configure(const StreamConfiguration &inCfg,\n>   \treturn encoder_->configure(inCfg);\n>   }\n>   \n> -int PostProcessorJpeg::process(const libcamera::FrameBuffer *source,\n> -\t\t\t       const libcamera::Span<uint8_t> &destination,\n> +int PostProcessorJpeg::process(const libcamera::FrameBuffer &source,\n> +\t\t\t       libcamera::Span<uint8_t> destination,\n>   \t\t\t       CameraMetadata *metadata)\n>   {\n>   \tif (!encoder_)\n> @@ -67,7 +67,7 @@ int PostProcessorJpeg::process(const libcamera::FrameBuffer *source,\n>   \tif (exif.generate() != 0)\n>   \t\tLOG(JPEG, Error) << \"Failed to generate valid EXIF data\";\n>   \n> -\tint jpeg_size = encoder_->encode(source, destination, exif.data());\n> +\tint jpeg_size = encoder_->encode(&source, destination, exif.data());\n>   \tif (jpeg_size < 0) {\n>   \t\tLOG(JPEG, Error) << \"Failed to encode stream image\";\n>   \t\treturn jpeg_size;\n> diff --git a/src/android/jpeg/post_processor_jpeg.h b/src/android/jpeg/post_processor_jpeg.h\n> index 62c8650..ae636ff 100644\n> --- a/src/android/jpeg/post_processor_jpeg.h\n> +++ b/src/android/jpeg/post_processor_jpeg.h\n> @@ -23,8 +23,8 @@ public:\n>   \n>   \tint configure(const libcamera::StreamConfiguration &incfg,\n>   \t\t      const libcamera::StreamConfiguration &outcfg) override;\n> -\tint process(const libcamera::FrameBuffer *source,\n> -\t\t    const libcamera::Span<uint8_t> &destination,\n> +\tint process(const libcamera::FrameBuffer &source,\n> +\t\t    libcamera::Span<uint8_t> destination,\n>   \t\t    CameraMetadata *metadata) override;\n>   \n>   private:\n> diff --git a/src/android/post_processor.h b/src/android/post_processor.h\n> index a891c43..5f87a5d 100644\n> --- a/src/android/post_processor.h\n> +++ b/src/android/post_processor.h\n> @@ -20,8 +20,8 @@ public:\n>   \n>   \tvirtual int configure(const libcamera::StreamConfiguration &inCfg,\n>   \t\t\t      const libcamera::StreamConfiguration &outCfg) = 0;\n> -\tvirtual int process(const libcamera::FrameBuffer *source,\n> -\t\t\t    const libcamera::Span<uint8_t> &destination,\n> +\tvirtual int process(const libcamera::FrameBuffer &source,\n> +\t\t\t    libcamera::Span<uint8_t> destination,\n>   \t\t\t    CameraMetadata *metadata) = 0;\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 576EBBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Oct 2020 07:47:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B495C61059;\n\tThu, 22 Oct 2020 09:47:05 +0200 (CEST)","from mail.uajain.com (static.126.159.217.95.clients.your-server.de\n\t[95.217.159.126])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D95F560351\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Oct 2020 09:47:04 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=uajain.com header.i=@uajain.com\n\theader.b=\"NSUv/K1A\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=uajain.com; s=mail;\n\tt=1603352824; bh=/luQDIDFinjthIoD+ZghIK96g4zLnIaxbSFREjlutj4=;\n\th=Subject:To:Cc:References:From:In-Reply-To;\n\tb=NSUv/K1ATzOn8Spww96cFB1wi/odE/i2sg2r+XdbM+D0NWPMBV3d4MHnQTJDOR+Zm\n\t7zJ9NBBxBfb6ECx4avJaVvAj18ycMCxo174MCMBMcLF6J6ZHwmWR5Lsic18FbEqQRP\n\tosRua174Rc/jdG+LBzn5lQJVTxo1hsXZ5gZWcw91P/l5vVN0jMcOnsSEgL0ZOJW4Ya\n\tVbva2kGgMTpwMEtosQG2/2Me1in7sccnBwxS4RUjVo5pvopsBLCSWVwa1V9zM47liV\n\t7pMxwPKvgRvdqsH0ytlFRYxl21fRSK7Wlox0gL1G2x8RfHibXuI+1XvEeS9gC2Ngok\n\t+/5OLD5MnhozA==","To":"Hirokazu Honda <hiroh@chromium.org>, libcamera-devel@lists.libcamera.org","References":"<20201021013955.301790-1-hiroh@chromium.org>","From":"Umang Jain <email@uajain.com>","Message-ID":"<6ca671c4-e16b-a8e6-b23b-0d62b796a004@uajain.com>","Date":"Thu, 22 Oct 2020 13:16:58 +0530","Mime-Version":"1.0","In-Reply-To":"<20201021013955.301790-1-hiroh@chromium.org>","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH v3 1/4] android: Modify PostProcessor\n\tinterface","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":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":13407,"web_url":"https://patchwork.libcamera.org/comment/13407/","msgid":"<2dec6fc4-b707-14df-6337-526629f9df19@ideasonboard.com>","date":"2020-10-22T09:27:07","subject":"Re: [libcamera-devel] [PATCH v3 1/4] android: Modify PostProcessor\n\tinterface","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Umang, / Hiro,\n\nOn 22/10/2020 08:46, Umang Jain wrote:\n> Hi  all,\n> \n> I have re-reviewed the series and changes look good to me.\n> \n> Patches 3/4 and 4/4 will require changing const pointer style to use\n> prefix-ed const. Apart from that, I don't think anything is blocking for\n> merging.\n\nThanks, but these patches went in yesterday. And now I take a second\nlook, I am more dubious about the const conditions on some of those entries.\n\nIn locations where I think it looks like the intent was to stop the\nobject being modified, indeed, the const declarations are only stopping\nthe 'pointer' from being modified...\n\nHiro - Could you take another look please and evaluate if the code\nmatches your intentions?\n\nI find this to be a really useful tool in translating C sometimes ;-)\n\n\thttps://cdecl.org/\n\nFor example:\n\n  const class CameraDevice *cameraDevice_;\n  > declare cameraDevice_ as pointer to const class CameraDevice\n\n  (https://cdecl.org/?q=const+class+CameraDevice+*cameraDevice_%3B)\n\nvs\n\n  class CameraDevice *const cameraDevice_;\n  > declare cameraDevice_ as const pointer to class CameraDevice\n\n  (https://cdecl.org/?q=class+CameraDevice+*const+cameraDevice_%3B+)\n\nWhich while likely a true statement, stating that we can't modify the\npointer isn't as protective as stating that we can't modify the class\ninstance itself.\n\n--\nRegards\n\nKieran\n\n\n> \n> Thanks!\n> \n> On 10/21/20 7:09 AM, Hirokazu Honda wrote:\n>> In PostProcessor::process(), the |source| argument doesn't have\n>> to be a pointer. This replaces its type, const pointer, with\n>> const reference as the latter is preferred to the former.\n>> libcamera::Span is cheap to construct/copy/move. We should deal\n>> with the type as pass-by-value parameter. Therefore this also\n>> drops the const reference in the |destination| argument.\n>>\n>> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n>> Reviewed-by: Umang Jain <email@uajain.com>\n>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>> ---\n>>   src/android/camera_stream.cpp            | 2 +-\n>>   src/android/jpeg/post_processor_jpeg.cpp | 6 +++---\n>>   src/android/jpeg/post_processor_jpeg.h   | 4 ++--\n>>   src/android/post_processor.h             | 4 ++--\n>>   4 files changed, 8 insertions(+), 8 deletions(-)\n>>\n>> diff --git a/src/android/camera_stream.cpp\n>> b/src/android/camera_stream.cpp\n>> index eae451e..3e5d6be 100644\n>> --- a/src/android/camera_stream.cpp\n>> +++ b/src/android/camera_stream.cpp\n>> @@ -102,7 +102,7 @@ int CameraStream::process(const\n>> libcamera::FrameBuffer &source,\n>>       if (!postProcessor_)\n>>           return 0;\n>>   -    return postProcessor_->process(&source, dest->maps()[0],\n>> metadata);\n>> +    return postProcessor_->process(source, dest->maps()[0], metadata);\n>>   }\n>>     FrameBuffer *CameraStream::getBuffer()\n>> diff --git a/src/android/jpeg/post_processor_jpeg.cpp\n>> b/src/android/jpeg/post_processor_jpeg.cpp\n>> index 9d452b7..90bf10d 100644\n>> --- a/src/android/jpeg/post_processor_jpeg.cpp\n>> +++ b/src/android/jpeg/post_processor_jpeg.cpp\n>> @@ -44,8 +44,8 @@ int PostProcessorJpeg::configure(const\n>> StreamConfiguration &inCfg,\n>>       return encoder_->configure(inCfg);\n>>   }\n>>   -int PostProcessorJpeg::process(const libcamera::FrameBuffer *source,\n>> -                   const libcamera::Span<uint8_t> &destination,\n>> +int PostProcessorJpeg::process(const libcamera::FrameBuffer &source,\n>> +                   libcamera::Span<uint8_t> destination,\n>>                      CameraMetadata *metadata)\n>>   {\n>>       if (!encoder_)\n>> @@ -67,7 +67,7 @@ int PostProcessorJpeg::process(const\n>> libcamera::FrameBuffer *source,\n>>       if (exif.generate() != 0)\n>>           LOG(JPEG, Error) << \"Failed to generate valid EXIF data\";\n>>   -    int jpeg_size = encoder_->encode(source, destination,\n>> exif.data());\n>> +    int jpeg_size = encoder_->encode(&source, destination, exif.data());\n>>       if (jpeg_size < 0) {\n>>           LOG(JPEG, Error) << \"Failed to encode stream image\";\n>>           return jpeg_size;\n>> diff --git a/src/android/jpeg/post_processor_jpeg.h\n>> b/src/android/jpeg/post_processor_jpeg.h\n>> index 62c8650..ae636ff 100644\n>> --- a/src/android/jpeg/post_processor_jpeg.h\n>> +++ b/src/android/jpeg/post_processor_jpeg.h\n>> @@ -23,8 +23,8 @@ public:\n>>         int configure(const libcamera::StreamConfiguration &incfg,\n>>                 const libcamera::StreamConfiguration &outcfg) override;\n>> -    int process(const libcamera::FrameBuffer *source,\n>> -            const libcamera::Span<uint8_t> &destination,\n>> +    int process(const libcamera::FrameBuffer &source,\n>> +            libcamera::Span<uint8_t> destination,\n>>               CameraMetadata *metadata) override;\n>>     private:\n>> diff --git a/src/android/post_processor.h b/src/android/post_processor.h\n>> index a891c43..5f87a5d 100644\n>> --- a/src/android/post_processor.h\n>> +++ b/src/android/post_processor.h\n>> @@ -20,8 +20,8 @@ public:\n>>         virtual int configure(const libcamera::StreamConfiguration\n>> &inCfg,\n>>                     const libcamera::StreamConfiguration &outCfg) = 0;\n>> -    virtual int process(const libcamera::FrameBuffer *source,\n>> -                const libcamera::Span<uint8_t> &destination,\n>> +    virtual int process(const libcamera::FrameBuffer &source,\n>> +                libcamera::Span<uint8_t> destination,\n>>                   CameraMetadata *metadata) = 0;\n>>   };\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 98CDFC3D3C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Oct 2020 09:27:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 032406112D;\n\tThu, 22 Oct 2020 11:27:12 +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 C14D360351\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Oct 2020 11:27:10 +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 0B84B53;\n\tThu, 22 Oct 2020 11:27:09 +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=\"uJwwKQU6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1603358830;\n\tbh=H0e1f2KCVl/9p+ZhzZbOUr5ZklCe5FzHGSZqoeLNB1k=;\n\th=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=uJwwKQU6ONZ4jC97eRKkoE2+GQi1aXUdaYFxp16buyoX7n1igBJC4B8aheOXn2anP\n\tBTDTaEePX9osPPDIPHMyR1y+JTj+x231zsRrPQtJMoIAUlwu1gL/KBQtXhj/AesFZw\n\tE2LeKVC4HEit6CvVR99gNbGyRaG3E7hsU3L7nMRA=","To":"Umang Jain <email@uajain.com>, Hirokazu Honda <hiroh@chromium.org>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20201021013955.301790-1-hiroh@chromium.org>\n\t<6ca671c4-e16b-a8e6-b23b-0d62b796a004@uajain.com>","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":"<2dec6fc4-b707-14df-6337-526629f9df19@ideasonboard.com>","Date":"Thu, 22 Oct 2020 10:27:07 +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":"<6ca671c4-e16b-a8e6-b23b-0d62b796a004@uajain.com>","Content-Language":"en-GB","Subject":"Re: [libcamera-devel] [PATCH v3 1/4] android: Modify PostProcessor\n\tinterface","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=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":13411,"web_url":"https://patchwork.libcamera.org/comment/13411/","msgid":"<CAO5uPHNctCpO02yNi7qLVe_cfag53SMQns0EoRW9gi7fvU7KWQ@mail.gmail.com>","date":"2020-10-22T10:58:06","subject":"Re: [libcamera-devel] [PATCH v3 1/4] android: Modify PostProcessor\n\tinterface","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"On Thu, Oct 22, 2020 at 6:27 PM Kieran Bingham\n<kieran.bingham@ideasonboard.com> wrote:\n>\n> Hi Umang, / Hiro,\n>\n> On 22/10/2020 08:46, Umang Jain wrote:\n> > Hi  all,\n> >\n> > I have re-reviewed the series and changes look good to me.\n> >\n> > Patches 3/4 and 4/4 will require changing const pointer style to use\n> > prefix-ed const. Apart from that, I don't think anything is blocking for\n> > merging.\n>\n> Thanks, but these patches went in yesterday. And now I take a second\n> look, I am more dubious about the const conditions on some of those entries.\n>\n> In locations where I think it looks like the intent was to stop the\n> object being modified, indeed, the const declarations are only stopping\n> the 'pointer' from being modified...\n>\n> Hiro - Could you take another look please and evaluate if the code\n> matches your intentions?\n>\n\nI checked the patches.\nYes, they were what I intended. i.e. a const pointer to a class, e.g.,\nCameraDevice *const CameraDevice.\nFor instance, A class \"X\" is constructed with being given a class\npointer of \"Z\" but doesn't have the ownership of Z.\nThe X unlikely changes the pointer \"Z\" but should still be able to\nmodify the state of \"Z\".\nDoes it make sense?\n\nBest Regards,\n-Hiro\n\n> I find this to be a really useful tool in translating C sometimes ;-)\n>\n>         https://cdecl.org/\n>\n> For example:\n>\n>   const class CameraDevice *cameraDevice_;\n>   > declare cameraDevice_ as pointer to const class CameraDevice\n>\n>   (https://cdecl.org/?q=const+class+CameraDevice+*cameraDevice_%3B)\n>\n> vs\n>\n>   class CameraDevice *const cameraDevice_;\n>   > declare cameraDevice_ as const pointer to class CameraDevice\n>\n>   (https://cdecl.org/?q=class+CameraDevice+*const+cameraDevice_%3B+)\n>\n> Which while likely a true statement, stating that we can't modify the\n> pointer isn't as protective as stating that we can't modify the class\n> instance itself.\n>\n> --\n> Regards\n>\n> Kieran\n>\n>\n> >\n> > Thanks!\n> >\n> > On 10/21/20 7:09 AM, Hirokazu Honda wrote:\n> >> In PostProcessor::process(), the |source| argument doesn't have\n> >> to be a pointer. This replaces its type, const pointer, with\n> >> const reference as the latter is preferred to the former.\n> >> libcamera::Span is cheap to construct/copy/move. We should deal\n> >> with the type as pass-by-value parameter. Therefore this also\n> >> drops the const reference in the |destination| argument.\n> >>\n> >> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> >> Reviewed-by: Umang Jain <email@uajain.com>\n> >> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> >> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> >> ---\n> >>   src/android/camera_stream.cpp            | 2 +-\n> >>   src/android/jpeg/post_processor_jpeg.cpp | 6 +++---\n> >>   src/android/jpeg/post_processor_jpeg.h   | 4 ++--\n> >>   src/android/post_processor.h             | 4 ++--\n> >>   4 files changed, 8 insertions(+), 8 deletions(-)\n> >>\n> >> diff --git a/src/android/camera_stream.cpp\n> >> b/src/android/camera_stream.cpp\n> >> index eae451e..3e5d6be 100644\n> >> --- a/src/android/camera_stream.cpp\n> >> +++ b/src/android/camera_stream.cpp\n> >> @@ -102,7 +102,7 @@ int CameraStream::process(const\n> >> libcamera::FrameBuffer &source,\n> >>       if (!postProcessor_)\n> >>           return 0;\n> >>   -    return postProcessor_->process(&source, dest->maps()[0],\n> >> metadata);\n> >> +    return postProcessor_->process(source, dest->maps()[0], metadata);\n> >>   }\n> >>     FrameBuffer *CameraStream::getBuffer()\n> >> diff --git a/src/android/jpeg/post_processor_jpeg.cpp\n> >> b/src/android/jpeg/post_processor_jpeg.cpp\n> >> index 9d452b7..90bf10d 100644\n> >> --- a/src/android/jpeg/post_processor_jpeg.cpp\n> >> +++ b/src/android/jpeg/post_processor_jpeg.cpp\n> >> @@ -44,8 +44,8 @@ int PostProcessorJpeg::configure(const\n> >> StreamConfiguration &inCfg,\n> >>       return encoder_->configure(inCfg);\n> >>   }\n> >>   -int PostProcessorJpeg::process(const libcamera::FrameBuffer *source,\n> >> -                   const libcamera::Span<uint8_t> &destination,\n> >> +int PostProcessorJpeg::process(const libcamera::FrameBuffer &source,\n> >> +                   libcamera::Span<uint8_t> destination,\n> >>                      CameraMetadata *metadata)\n> >>   {\n> >>       if (!encoder_)\n> >> @@ -67,7 +67,7 @@ int PostProcessorJpeg::process(const\n> >> libcamera::FrameBuffer *source,\n> >>       if (exif.generate() != 0)\n> >>           LOG(JPEG, Error) << \"Failed to generate valid EXIF data\";\n> >>   -    int jpeg_size = encoder_->encode(source, destination,\n> >> exif.data());\n> >> +    int jpeg_size = encoder_->encode(&source, destination, exif.data());\n> >>       if (jpeg_size < 0) {\n> >>           LOG(JPEG, Error) << \"Failed to encode stream image\";\n> >>           return jpeg_size;\n> >> diff --git a/src/android/jpeg/post_processor_jpeg.h\n> >> b/src/android/jpeg/post_processor_jpeg.h\n> >> index 62c8650..ae636ff 100644\n> >> --- a/src/android/jpeg/post_processor_jpeg.h\n> >> +++ b/src/android/jpeg/post_processor_jpeg.h\n> >> @@ -23,8 +23,8 @@ public:\n> >>         int configure(const libcamera::StreamConfiguration &incfg,\n> >>                 const libcamera::StreamConfiguration &outcfg) override;\n> >> -    int process(const libcamera::FrameBuffer *source,\n> >> -            const libcamera::Span<uint8_t> &destination,\n> >> +    int process(const libcamera::FrameBuffer &source,\n> >> +            libcamera::Span<uint8_t> destination,\n> >>               CameraMetadata *metadata) override;\n> >>     private:\n> >> diff --git a/src/android/post_processor.h b/src/android/post_processor.h\n> >> index a891c43..5f87a5d 100644\n> >> --- a/src/android/post_processor.h\n> >> +++ b/src/android/post_processor.h\n> >> @@ -20,8 +20,8 @@ public:\n> >>         virtual int configure(const libcamera::StreamConfiguration\n> >> &inCfg,\n> >>                     const libcamera::StreamConfiguration &outCfg) = 0;\n> >> -    virtual int process(const libcamera::FrameBuffer *source,\n> >> -                const libcamera::Span<uint8_t> &destination,\n> >> +    virtual int process(const libcamera::FrameBuffer &source,\n> >> +                libcamera::Span<uint8_t> destination,\n> >>                   CameraMetadata *metadata) = 0;\n> >>   };\n> >>\n> >\n>\n> --\n> Regards\n> --\n> Kieran","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 77970BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Oct 2020 10:58:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E8216610B6;\n\tThu, 22 Oct 2020 12:58:18 +0200 (CEST)","from mail-ej1-x642.google.com (mail-ej1-x642.google.com\n\t[IPv6:2a00:1450:4864:20::642])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D743060352\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Oct 2020 12:58:16 +0200 (CEST)","by mail-ej1-x642.google.com with SMTP id p5so1645139ejj.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Oct 2020 03:58:16 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"Fh5mEzmO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=xZ6Sstpda/N5bNiLHxpycYAN7McyaD0AxmgYb/wy7Zw=;\n\tb=Fh5mEzmOmKGox2GwiuUWpn0xxmxncrddh7Mcymx9C8I719U+oN62hmpOG/8xiUrYZl\n\tNEHcOn7h84iTKOMcy3BHeo7DJTnl1PacnTKBEmqxuLiuA+2Q3TDZXp1dkARCRNKL6ayc\n\tN7MZ+MutGX8N3QvQ4DebLd6bkWQzFh1d+Z2FA=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=xZ6Sstpda/N5bNiLHxpycYAN7McyaD0AxmgYb/wy7Zw=;\n\tb=txg184M61mFwPgl/NCKbi3Mv22A160JUo25nDI6MjgUdLvgKTeAxkvScUjLjeNhIxB\n\tsAvfwhJn4b4rEWju87K65vudK0yoBJKzqSKu557LEQJN80Yz5ep5WXY339nV2tbVjO2R\n\tQyPUA7iGHRfsh6Wr0PaxgOL/ytae1vW2GRVjqOMSzhH5QtvW/qk0QhbzDQhv2KUPLGFf\n\tRgCojY5L3E5PH+NnKUBw822nXGIjfjdlHJoJzz2fMxMFIvOp7yXlKqU0EaKApQm+G3vl\n\tfZPZliJRQ/PDOk/s8cd6xzlDZnGeOSRqS6RewwfJXBrCds74lApb+Hm7XFmSjmlAva7P\n\tXEvQ==","X-Gm-Message-State":"AOAM5315IyRWrUzhQoZ6EgML6c7vzRAuOMbLF3WtgEz9AI4CD4J3Ushf\n\tFIroH8nxIeojrlpV+nhkpxbb+d5hAcoLkQDVs1vl3MePEgU=","X-Google-Smtp-Source":"ABdhPJx2ex7VgblAPLuIBPKT+An8OOB1UeHI5E9KCcsvskKoRxGLeGOuF9DjogPCiIzU4IYoLVoCTzSEBnVR0z8Wq3o=","X-Received":"by 2002:a17:906:6a47:: with SMTP id\n\tn7mr1619700ejs.306.1603364296303; \n\tThu, 22 Oct 2020 03:58:16 -0700 (PDT)","MIME-Version":"1.0","References":"<20201021013955.301790-1-hiroh@chromium.org>\n\t<6ca671c4-e16b-a8e6-b23b-0d62b796a004@uajain.com>\n\t<2dec6fc4-b707-14df-6337-526629f9df19@ideasonboard.com>","In-Reply-To":"<2dec6fc4-b707-14df-6337-526629f9df19@ideasonboard.com>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Thu, 22 Oct 2020 19:58:06 +0900","Message-ID":"<CAO5uPHNctCpO02yNi7qLVe_cfag53SMQns0EoRW9gi7fvU7KWQ@mail.gmail.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 1/4] android: Modify PostProcessor\n\tinterface","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":13413,"web_url":"https://patchwork.libcamera.org/comment/13413/","msgid":"<12441d0f-cefa-9fe7-a2ca-579264fae3f8@uajain.com>","date":"2020-10-22T11:59:32","subject":"Re: [libcamera-devel] [PATCH v3 1/4] android: Modify PostProcessor\n\tinterface","submitter":{"id":1,"url":"https://patchwork.libcamera.org/api/people/1/","name":"Umang Jain","email":"email@uajain.com"},"content":"Hi Hiro / Kieran,\n\nOn 10/22/20 4:28 PM, Hirokazu Honda wrote:\n> On Thu, Oct 22, 2020 at 6:27 PM Kieran Bingham\n> <kieran.bingham@ideasonboard.com> wrote:\n>> Hi Umang, / Hiro,\n>>\n>> On 22/10/2020 08:46, Umang Jain wrote:\n>>> Hi  all,\n>>>\n>>> I have re-reviewed the series and changes look good to me.\n>>>\n>>> Patches 3/4 and 4/4 will require changing const pointer style to use\n>>> prefix-ed const. Apart from that, I don't think anything is blocking for\n>>> merging.\n>> Thanks, but these patches went in yesterday. And now I take a second\n>> look, I am more dubious about the const conditions on some of those entries.\n>>\n>> In locations where I think it looks like the intent was to stop the\n>> object being modified, indeed, the const declarations are only stopping\n>> the 'pointer' from being modified...\n>>\n>> Hiro - Could you take another look please and evaluate if the code\n>> matches your intentions?\n>>\n> I checked the patches.\n> Yes, they were what I intended. i.e. a const pointer to a class, e.g.,\n> CameraDevice *const CameraDevice.\nI think I would digress here. I think what we needed here from the start \nwas: `const X *p`  i.e. pointer to an X that is constant.\nhttps://isocpp.org/wiki/faq/const-correctness#ptr-to-const\n> For instance, A class \"X\" is constructed with being given a class\n> pointer of \"Z\" but doesn't have the ownership of Z.\n> The X unlikely changes the pointer \"Z\" but should still be able to\n> modify the state of \"Z\".\n> Does it make sense?\n\nI don't think we need the ability to modify \"Z\", in this case (patch 3/4 \nand 4/4), Z is the cameraDevice_.  looking at both CameraStream and \nPostProcessorJpeg on how they use CameraDevice API, one can make out the \nboth (CameraStream and PostProcessor) does not _intent_ to change the \nstate of cameraDevice_ (you can also double-check via how all getters in \ncamera_device.h are declared `const`). Does this reasoning makes sense?\n\n--\nuajain\n\n\n>\n> Best Regards,\n> -Hiro\n>\n>> I find this to be a really useful tool in translating C sometimes ;-)\n>>\n>>          https://cdecl.org/\n>>\n>> For example:\n>>\n>>    const class CameraDevice *cameraDevice_;\n>>    > declare cameraDevice_ as pointer to const class CameraDevice\n>>\n>>    (https://cdecl.org/?q=const+class+CameraDevice+*cameraDevice_%3B)\n>>\n>> vs\n>>\n>>    class CameraDevice *const cameraDevice_;\n>>    > declare cameraDevice_ as const pointer to class CameraDevice\n>>\n>>    (https://cdecl.org/?q=class+CameraDevice+*const+cameraDevice_%3B+)\n>>\n>> Which while likely a true statement, stating that we can't modify the\n>> pointer isn't as protective as stating that we can't modify the class\n>> instance itself.\n>>\n>> --\n>> Regards\n>>\n>> Kieran\n>>\n>>\n>>> Thanks!\n>>>\n>>> On 10/21/20 7:09 AM, Hirokazu Honda wrote:\n>>>> In PostProcessor::process(), the |source| argument doesn't have\n>>>> to be a pointer. This replaces its type, const pointer, with\n>>>> const reference as the latter is preferred to the former.\n>>>> libcamera::Span is cheap to construct/copy/move. We should deal\n>>>> with the type as pass-by-value parameter. Therefore this also\n>>>> drops the const reference in the |destination| argument.\n>>>>\n>>>> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n>>>> Reviewed-by: Umang Jain <email@uajain.com>\n>>>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>>>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>>>> ---\n>>>>    src/android/camera_stream.cpp            | 2 +-\n>>>>    src/android/jpeg/post_processor_jpeg.cpp | 6 +++---\n>>>>    src/android/jpeg/post_processor_jpeg.h   | 4 ++--\n>>>>    src/android/post_processor.h             | 4 ++--\n>>>>    4 files changed, 8 insertions(+), 8 deletions(-)\n>>>>\n>>>> diff --git a/src/android/camera_stream.cpp\n>>>> b/src/android/camera_stream.cpp\n>>>> index eae451e..3e5d6be 100644\n>>>> --- a/src/android/camera_stream.cpp\n>>>> +++ b/src/android/camera_stream.cpp\n>>>> @@ -102,7 +102,7 @@ int CameraStream::process(const\n>>>> libcamera::FrameBuffer &source,\n>>>>        if (!postProcessor_)\n>>>>            return 0;\n>>>>    -    return postProcessor_->process(&source, dest->maps()[0],\n>>>> metadata);\n>>>> +    return postProcessor_->process(source, dest->maps()[0], metadata);\n>>>>    }\n>>>>      FrameBuffer *CameraStream::getBuffer()\n>>>> diff --git a/src/android/jpeg/post_processor_jpeg.cpp\n>>>> b/src/android/jpeg/post_processor_jpeg.cpp\n>>>> index 9d452b7..90bf10d 100644\n>>>> --- a/src/android/jpeg/post_processor_jpeg.cpp\n>>>> +++ b/src/android/jpeg/post_processor_jpeg.cpp\n>>>> @@ -44,8 +44,8 @@ int PostProcessorJpeg::configure(const\n>>>> StreamConfiguration &inCfg,\n>>>>        return encoder_->configure(inCfg);\n>>>>    }\n>>>>    -int PostProcessorJpeg::process(const libcamera::FrameBuffer *source,\n>>>> -                   const libcamera::Span<uint8_t> &destination,\n>>>> +int PostProcessorJpeg::process(const libcamera::FrameBuffer &source,\n>>>> +                   libcamera::Span<uint8_t> destination,\n>>>>                       CameraMetadata *metadata)\n>>>>    {\n>>>>        if (!encoder_)\n>>>> @@ -67,7 +67,7 @@ int PostProcessorJpeg::process(const\n>>>> libcamera::FrameBuffer *source,\n>>>>        if (exif.generate() != 0)\n>>>>            LOG(JPEG, Error) << \"Failed to generate valid EXIF data\";\n>>>>    -    int jpeg_size = encoder_->encode(source, destination,\n>>>> exif.data());\n>>>> +    int jpeg_size = encoder_->encode(&source, destination, exif.data());\n>>>>        if (jpeg_size < 0) {\n>>>>            LOG(JPEG, Error) << \"Failed to encode stream image\";\n>>>>            return jpeg_size;\n>>>> diff --git a/src/android/jpeg/post_processor_jpeg.h\n>>>> b/src/android/jpeg/post_processor_jpeg.h\n>>>> index 62c8650..ae636ff 100644\n>>>> --- a/src/android/jpeg/post_processor_jpeg.h\n>>>> +++ b/src/android/jpeg/post_processor_jpeg.h\n>>>> @@ -23,8 +23,8 @@ public:\n>>>>          int configure(const libcamera::StreamConfiguration &incfg,\n>>>>                  const libcamera::StreamConfiguration &outcfg) override;\n>>>> -    int process(const libcamera::FrameBuffer *source,\n>>>> -            const libcamera::Span<uint8_t> &destination,\n>>>> +    int process(const libcamera::FrameBuffer &source,\n>>>> +            libcamera::Span<uint8_t> destination,\n>>>>                CameraMetadata *metadata) override;\n>>>>      private:\n>>>> diff --git a/src/android/post_processor.h b/src/android/post_processor.h\n>>>> index a891c43..5f87a5d 100644\n>>>> --- a/src/android/post_processor.h\n>>>> +++ b/src/android/post_processor.h\n>>>> @@ -20,8 +20,8 @@ public:\n>>>>          virtual int configure(const libcamera::StreamConfiguration\n>>>> &inCfg,\n>>>>                      const libcamera::StreamConfiguration &outCfg) = 0;\n>>>> -    virtual int process(const libcamera::FrameBuffer *source,\n>>>> -                const libcamera::Span<uint8_t> &destination,\n>>>> +    virtual int process(const libcamera::FrameBuffer &source,\n>>>> +                libcamera::Span<uint8_t> destination,\n>>>>                    CameraMetadata *metadata) = 0;\n>>>>    };\n>>>>\n>> --\n>> Regards\n>> --\n>> Kieran","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 A9E28BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Oct 2020 11:59:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 254FE61439;\n\tThu, 22 Oct 2020 13:59:39 +0200 (CEST)","from mail.uajain.com (static.126.159.217.95.clients.your-server.de\n\t[95.217.159.126])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D6F1F60352\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Oct 2020 13:59:37 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=uajain.com header.i=@uajain.com\n\theader.b=\"SLG4pQCE\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=uajain.com; s=mail;\n\tt=1603367976; bh=4qsdrvZpVog/ISJoAHpU9Ta8O8FzkYRLi0guX4XE2wA=;\n\th=Subject:To:Cc:References:From:In-Reply-To;\n\tb=SLG4pQCE2y+iDPGAojaFtqwg3EzxXuFPelLZGkhrZb4zGFK83g+Q1l39nucQxwyOq\n\toOn3ULH+fxbPIaVMeO/ofJ8tka6Mf+ZpxzuKtnsB62tCGHX0xGSycMU+qWcoK78tfx\n\tkWSlOG0dsAK8+t3WnQH8nxuNNhcDAgS1TQIfjFo9P/rJuxHlfUDXVlJ+g0S7N+KdKP\n\tnhnWzTND0Knc78Conk7DtvO16k9AbmDjnDmYs1uH13M6BVAC+fhgFw/0D3Pj+58ZhE\n\tSdubM3jz4jpAawI0nPWemcWulVObVvKFU7LsCHcbv/MWMftyJbyC1yHe9VWPLXRVGn\n\t5IOpvyoh03Xqg==","To":"Hirokazu Honda <hiroh@chromium.org>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20201021013955.301790-1-hiroh@chromium.org>\n\t<6ca671c4-e16b-a8e6-b23b-0d62b796a004@uajain.com>\n\t<2dec6fc4-b707-14df-6337-526629f9df19@ideasonboard.com>\n\t<CAO5uPHNctCpO02yNi7qLVe_cfag53SMQns0EoRW9gi7fvU7KWQ@mail.gmail.com>","From":"Umang Jain <email@uajain.com>","Message-ID":"<12441d0f-cefa-9fe7-a2ca-579264fae3f8@uajain.com>","Date":"Thu, 22 Oct 2020 17:29:32 +0530","Mime-Version":"1.0","In-Reply-To":"<CAO5uPHNctCpO02yNi7qLVe_cfag53SMQns0EoRW9gi7fvU7KWQ@mail.gmail.com>","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH v3 1/4] android: Modify PostProcessor\n\tinterface","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":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":13416,"web_url":"https://patchwork.libcamera.org/comment/13416/","msgid":"<CAO5uPHPcP=u5o645vM-PxTGQ2gHVje69NYyx-0tLzT4XkguyKQ@mail.gmail.com>","date":"2020-10-22T13:40:51","subject":"Re: [libcamera-devel] [PATCH v3 1/4] android: Modify PostProcessor\n\tinterface","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"On Thu, Oct 22, 2020 at 8:59 PM Umang Jain <email@uajain.com> wrote:\n>\n> Hi Hiro / Kieran,\n>\n> On 10/22/20 4:28 PM, Hirokazu Honda wrote:\n> > On Thu, Oct 22, 2020 at 6:27 PM Kieran Bingham\n> > <kieran.bingham@ideasonboard.com> wrote:\n> >> Hi Umang, / Hiro,\n> >>\n> >> On 22/10/2020 08:46, Umang Jain wrote:\n> >>> Hi  all,\n> >>>\n> >>> I have re-reviewed the series and changes look good to me.\n> >>>\n> >>> Patches 3/4 and 4/4 will require changing const pointer style to use\n> >>> prefix-ed const. Apart from that, I don't think anything is blocking for\n> >>> merging.\n> >> Thanks, but these patches went in yesterday. And now I take a second\n> >> look, I am more dubious about the const conditions on some of those entries.\n> >>\n> >> In locations where I think it looks like the intent was to stop the\n> >> object being modified, indeed, the const declarations are only stopping\n> >> the 'pointer' from being modified...\n> >>\n> >> Hiro - Could you take another look please and evaluate if the code\n> >> matches your intentions?\n> >>\n> > I checked the patches.\n> > Yes, they were what I intended. i.e. a const pointer to a class, e.g.,\n> > CameraDevice *const CameraDevice.\n> I think I would digress here. I think what we needed here from the start\n> was: `const X *p`  i.e. pointer to an X that is constant.\n> https://isocpp.org/wiki/faq/const-correctness#ptr-to-const\n> > For instance, A class \"X\" is constructed with being given a class\n> > pointer of \"Z\" but doesn't have the ownership of Z.\n> > The X unlikely changes the pointer \"Z\" but should still be able to\n> > modify the state of \"Z\".\n> > Does it make sense?\n>\n> I don't think we need the ability to modify \"Z\", in this case (patch 3/4\n> and 4/4), Z is the cameraDevice_.  looking at both CameraStream and\n> PostProcessorJpeg on how they use CameraDevice API, one can make out the\n> both (CameraStream and PostProcessor) does not _intent_ to change the\n> state of cameraDevice_ (you can also double-check via how all getters in\n> camera_device.h are declared `const`). Does this reasoning makes sense?\n>\n\nI am fine to change it to so. It is aligned with the current usage.\n\nBest Regards,\n-Hiro\n> --\n> uajain\n>\n>\n> >\n> > Best Regards,\n> > -Hiro\n> >\n> >> I find this to be a really useful tool in translating C sometimes ;-)\n> >>\n> >>          https://cdecl.org/\n> >>\n> >> For example:\n> >>\n> >>    const class CameraDevice *cameraDevice_;\n> >>    > declare cameraDevice_ as pointer to const class CameraDevice\n> >>\n> >>    (https://cdecl.org/?q=const+class+CameraDevice+*cameraDevice_%3B)\n> >>\n> >> vs\n> >>\n> >>    class CameraDevice *const cameraDevice_;\n> >>    > declare cameraDevice_ as const pointer to class CameraDevice\n> >>\n> >>    (https://cdecl.org/?q=class+CameraDevice+*const+cameraDevice_%3B+)\n> >>\n> >> Which while likely a true statement, stating that we can't modify the\n> >> pointer isn't as protective as stating that we can't modify the class\n> >> instance itself.\n> >>\n> >> --\n> >> Regards\n> >>\n> >> Kieran\n> >>\n> >>\n> >>> Thanks!\n> >>>\n> >>> On 10/21/20 7:09 AM, Hirokazu Honda wrote:\n> >>>> In PostProcessor::process(), the |source| argument doesn't have\n> >>>> to be a pointer. This replaces its type, const pointer, with\n> >>>> const reference as the latter is preferred to the former.\n> >>>> libcamera::Span is cheap to construct/copy/move. We should deal\n> >>>> with the type as pass-by-value parameter. Therefore this also\n> >>>> drops the const reference in the |destination| argument.\n> >>>>\n> >>>> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> >>>> Reviewed-by: Umang Jain <email@uajain.com>\n> >>>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> >>>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> >>>> ---\n> >>>>    src/android/camera_stream.cpp            | 2 +-\n> >>>>    src/android/jpeg/post_processor_jpeg.cpp | 6 +++---\n> >>>>    src/android/jpeg/post_processor_jpeg.h   | 4 ++--\n> >>>>    src/android/post_processor.h             | 4 ++--\n> >>>>    4 files changed, 8 insertions(+), 8 deletions(-)\n> >>>>\n> >>>> diff --git a/src/android/camera_stream.cpp\n> >>>> b/src/android/camera_stream.cpp\n> >>>> index eae451e..3e5d6be 100644\n> >>>> --- a/src/android/camera_stream.cpp\n> >>>> +++ b/src/android/camera_stream.cpp\n> >>>> @@ -102,7 +102,7 @@ int CameraStream::process(const\n> >>>> libcamera::FrameBuffer &source,\n> >>>>        if (!postProcessor_)\n> >>>>            return 0;\n> >>>>    -    return postProcessor_->process(&source, dest->maps()[0],\n> >>>> metadata);\n> >>>> +    return postProcessor_->process(source, dest->maps()[0], metadata);\n> >>>>    }\n> >>>>      FrameBuffer *CameraStream::getBuffer()\n> >>>> diff --git a/src/android/jpeg/post_processor_jpeg.cpp\n> >>>> b/src/android/jpeg/post_processor_jpeg.cpp\n> >>>> index 9d452b7..90bf10d 100644\n> >>>> --- a/src/android/jpeg/post_processor_jpeg.cpp\n> >>>> +++ b/src/android/jpeg/post_processor_jpeg.cpp\n> >>>> @@ -44,8 +44,8 @@ int PostProcessorJpeg::configure(const\n> >>>> StreamConfiguration &inCfg,\n> >>>>        return encoder_->configure(inCfg);\n> >>>>    }\n> >>>>    -int PostProcessorJpeg::process(const libcamera::FrameBuffer *source,\n> >>>> -                   const libcamera::Span<uint8_t> &destination,\n> >>>> +int PostProcessorJpeg::process(const libcamera::FrameBuffer &source,\n> >>>> +                   libcamera::Span<uint8_t> destination,\n> >>>>                       CameraMetadata *metadata)\n> >>>>    {\n> >>>>        if (!encoder_)\n> >>>> @@ -67,7 +67,7 @@ int PostProcessorJpeg::process(const\n> >>>> libcamera::FrameBuffer *source,\n> >>>>        if (exif.generate() != 0)\n> >>>>            LOG(JPEG, Error) << \"Failed to generate valid EXIF data\";\n> >>>>    -    int jpeg_size = encoder_->encode(source, destination,\n> >>>> exif.data());\n> >>>> +    int jpeg_size = encoder_->encode(&source, destination, exif.data());\n> >>>>        if (jpeg_size < 0) {\n> >>>>            LOG(JPEG, Error) << \"Failed to encode stream image\";\n> >>>>            return jpeg_size;\n> >>>> diff --git a/src/android/jpeg/post_processor_jpeg.h\n> >>>> b/src/android/jpeg/post_processor_jpeg.h\n> >>>> index 62c8650..ae636ff 100644\n> >>>> --- a/src/android/jpeg/post_processor_jpeg.h\n> >>>> +++ b/src/android/jpeg/post_processor_jpeg.h\n> >>>> @@ -23,8 +23,8 @@ public:\n> >>>>          int configure(const libcamera::StreamConfiguration &incfg,\n> >>>>                  const libcamera::StreamConfiguration &outcfg) override;\n> >>>> -    int process(const libcamera::FrameBuffer *source,\n> >>>> -            const libcamera::Span<uint8_t> &destination,\n> >>>> +    int process(const libcamera::FrameBuffer &source,\n> >>>> +            libcamera::Span<uint8_t> destination,\n> >>>>                CameraMetadata *metadata) override;\n> >>>>      private:\n> >>>> diff --git a/src/android/post_processor.h b/src/android/post_processor.h\n> >>>> index a891c43..5f87a5d 100644\n> >>>> --- a/src/android/post_processor.h\n> >>>> +++ b/src/android/post_processor.h\n> >>>> @@ -20,8 +20,8 @@ public:\n> >>>>          virtual int configure(const libcamera::StreamConfiguration\n> >>>> &inCfg,\n> >>>>                      const libcamera::StreamConfiguration &outCfg) = 0;\n> >>>> -    virtual int process(const libcamera::FrameBuffer *source,\n> >>>> -                const libcamera::Span<uint8_t> &destination,\n> >>>> +    virtual int process(const libcamera::FrameBuffer &source,\n> >>>> +                libcamera::Span<uint8_t> destination,\n> >>>>                    CameraMetadata *metadata) = 0;\n> >>>>    };\n> >>>>\n> >> --\n> >> Regards\n> >> --\n> >> Kieran\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 D7189BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Oct 2020 13:41:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 761EF60352;\n\tThu, 22 Oct 2020 15:41:05 +0200 (CEST)","from mail-ej1-x644.google.com (mail-ej1-x644.google.com\n\t[IPv6:2a00:1450:4864:20::644])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E404260352\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Oct 2020 15:41:03 +0200 (CEST)","by mail-ej1-x644.google.com with SMTP id t25so2325881ejd.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Oct 2020 06:41:03 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"aNkLG+qv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=IArWjBYhy4xIS3RRFzQA4q9i24hG8zZuh5ONlbLW2r4=;\n\tb=aNkLG+qvmo1YijCQitRXTm1W9gNJYmLLboZxZuhOSLX6PayuiSRgkSOitx+tp2UA/8\n\tvdyslO+oTjlt0DXipI8VIJ7v039zCcCUM6rwhHRDIAl4GZ7Y58mgfE7mSrfIWm5bZecX\n\tlnqOPv8P+ZC0DHZH8jxpfeiBFKXc94NeKnN4o=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=IArWjBYhy4xIS3RRFzQA4q9i24hG8zZuh5ONlbLW2r4=;\n\tb=HR/dB/3Otz5tB/pmHpABJ+NwWn2NQuJNe7KwTvvI3nUtJQn1T9rDyEFEBHqUZj3ReU\n\tphrXFKIGndwZCTAGlieN8B9Ep/Ye8UG0gJERLjaRNkhrWhAM90AH+mtf4T/7B8yVTLHT\n\tjbZyrDnAIgNQwuqfWFRZjbU97A43xW5vdrrezy1s/hGYVfmn8+DP0lp1UWGpN5FE0U37\n\tiiD/UfiGsjmt0ZElVnrwGc0Cuw05owd47jeACz+d39nMAQenoyzNW5mIGIzKtpkZ72yR\n\tAlKNUSAv45Ua0dfFSyGX0AsgR1Ck6tv9RRdBJTamoYU2fBgiH75hCMhdiS6B+6Jj0pkY\n\t98Rw==","X-Gm-Message-State":"AOAM530h/gCZ9CDrjCTJxCoAQ6RdHQLOXIFnLjA/x8Lv6GrNMNdDIKf9\n\tzEUuFFUaLjAm8NVD9Lbdt2ci2Xu5QsJLHjPZEZbQPw==","X-Google-Smtp-Source":"ABdhPJyoCvzBbwDGQjlOdKe0F25cHpSkpqE92lK8/e8WhwctxxPPqopPASJKo18QBw9mYOD6JcOLjKcjaBGOFGz3Df8=","X-Received":"by 2002:a17:906:2894:: with SMTP id\n\to20mr2225043ejd.221.1603374063401; \n\tThu, 22 Oct 2020 06:41:03 -0700 (PDT)","MIME-Version":"1.0","References":"<20201021013955.301790-1-hiroh@chromium.org>\n\t<6ca671c4-e16b-a8e6-b23b-0d62b796a004@uajain.com>\n\t<2dec6fc4-b707-14df-6337-526629f9df19@ideasonboard.com>\n\t<CAO5uPHNctCpO02yNi7qLVe_cfag53SMQns0EoRW9gi7fvU7KWQ@mail.gmail.com>\n\t<12441d0f-cefa-9fe7-a2ca-579264fae3f8@uajain.com>","In-Reply-To":"<12441d0f-cefa-9fe7-a2ca-579264fae3f8@uajain.com>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Thu, 22 Oct 2020 22:40:51 +0900","Message-ID":"<CAO5uPHPcP=u5o645vM-PxTGQ2gHVje69NYyx-0tLzT4XkguyKQ@mail.gmail.com>","To":"Umang Jain <email@uajain.com>","Subject":"Re: [libcamera-devel] [PATCH v3 1/4] android: Modify PostProcessor\n\tinterface","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":13418,"web_url":"https://patchwork.libcamera.org/comment/13418/","msgid":"<20201022142934.GC3938@pendragon.ideasonboard.com>","date":"2020-10-22T14:29:34","subject":"Re: [libcamera-devel] [PATCH v3 1/4] android: Modify PostProcessor\n\tinterface","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hello everybody,\n\nOn Thu, Oct 22, 2020 at 10:40:51PM +0900, Hirokazu Honda wrote:\n> On Thu, Oct 22, 2020 at 8:59 PM Umang Jain wrote:\n> > On 10/22/20 4:28 PM, Hirokazu Honda wrote:\n> > > On Thu, Oct 22, 2020 at 6:27 PM Kieran Bingham wrote:\n> > >> On 22/10/2020 08:46, Umang Jain wrote:\n> > >>> Hi  all,\n> > >>>\n> > >>> I have re-reviewed the series and changes look good to me.\n> > >>>\n> > >>> Patches 3/4 and 4/4 will require changing const pointer style to use\n> > >>> prefix-ed const. Apart from that, I don't think anything is blocking for\n> > >>> merging.\n> > >>\n> > >> Thanks, but these patches went in yesterday. And now I take a second\n> > >> look, I am more dubious about the const conditions on some of those entries.\n> > >>\n> > >> In locations where I think it looks like the intent was to stop the\n> > >> object being modified, indeed, the const declarations are only stopping\n> > >> the 'pointer' from being modified...\n> > >>\n> > >> Hiro - Could you take another look please and evaluate if the code\n> > >> matches your intentions?\n> > >\n> > > I checked the patches.\n> > > Yes, they were what I intended. i.e. a const pointer to a class, e.g.,\n> > > CameraDevice *const CameraDevice.\n> >\n> > I think I would digress here. I think what we needed here from the start\n> > was: `const X *p`  i.e. pointer to an X that is constant.\n> > https://isocpp.org/wiki/faq/const-correctness#ptr-to-const\n\nI agree with Hiro on this. For class members that are meant to be set at\nconstruction time and not modified afterwards, T *const member_; is\ncorrect. It captures the fact that if code in the class tries to modify\nmember_, it's an error\n\nWe may or may not also need to qualify the object pointed to as const,\nthat is\n\n\tconst T *const member_;\n\ndepending on whether the class should be able to call non-const\nfunctions of the member. That's an orthogonal issue.\n\nAnd it's certainly also valid to have\n\n\tconst T *member_;\n\nwhen the pointer is meant to point to different instances of T during\nits lifetime.\n\nIn this specific case, we should likely use\n\n\tconst T* const cameraDevice_;\n\nas neither the pointer nor the object pointed to should be modified.\n\n> > > For instance, A class \"X\" is constructed with being given a class\n> > > pointer of \"Z\" but doesn't have the ownership of Z.\n> > > The X unlikely changes the pointer \"Z\" but should still be able to\n> > > modify the state of \"Z\".\n> > > Does it make sense?\n> >\n> > I don't think we need the ability to modify \"Z\", in this case (patch 3/4\n> > and 4/4), Z is the cameraDevice_.  looking at both CameraStream and\n> > PostProcessorJpeg on how they use CameraDevice API, one can make out the\n> > both (CameraStream and PostProcessor) does not _intent_ to change the\n> > state of cameraDevice_ (you can also double-check via how all getters in\n> > camera_device.h are declared `const`). Does this reasoning makes sense?\n> \n> I am fine to change it to so. It is aligned with the current usage.\n> \n> > >> I find this to be a really useful tool in translating C sometimes ;-)\n> > >>\n> > >>          https://cdecl.org/\n> > >>\n> > >> For example:\n> > >>\n> > >>    const class CameraDevice *cameraDevice_;\n> > >>    > declare cameraDevice_ as pointer to const class CameraDevice\n> > >>\n> > >>    (https://cdecl.org/?q=const+class+CameraDevice+*cameraDevice_%3B)\n> > >>\n> > >> vs\n> > >>\n> > >>    class CameraDevice *const cameraDevice_;\n> > >>    > declare cameraDevice_ as const pointer to class CameraDevice\n> > >>\n> > >>    (https://cdecl.org/?q=class+CameraDevice+*const+cameraDevice_%3B+)\n> > >>\n> > >> Which while likely a true statement, stating that we can't modify the\n> > >> pointer isn't as protective as stating that we can't modify the class\n> > >> instance itself.\n> > >>\n> > >> --\n> > >> Regards\n> > >>\n> > >> Kieran\n> > >>\n> > >>\n> > >>> Thanks!\n> > >>>\n> > >>> On 10/21/20 7:09 AM, Hirokazu Honda wrote:\n> > >>>> In PostProcessor::process(), the |source| argument doesn't have\n> > >>>> to be a pointer. This replaces its type, const pointer, with\n> > >>>> const reference as the latter is preferred to the former.\n> > >>>> libcamera::Span is cheap to construct/copy/move. We should deal\n> > >>>> with the type as pass-by-value parameter. Therefore this also\n> > >>>> drops the const reference in the |destination| argument.\n> > >>>>\n> > >>>> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> > >>>> Reviewed-by: Umang Jain <email@uajain.com>\n> > >>>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > >>>> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > >>>> ---\n> > >>>>    src/android/camera_stream.cpp            | 2 +-\n> > >>>>    src/android/jpeg/post_processor_jpeg.cpp | 6 +++---\n> > >>>>    src/android/jpeg/post_processor_jpeg.h   | 4 ++--\n> > >>>>    src/android/post_processor.h             | 4 ++--\n> > >>>>    4 files changed, 8 insertions(+), 8 deletions(-)\n> > >>>>\n> > >>>> diff --git a/src/android/camera_stream.cpp\n> > >>>> b/src/android/camera_stream.cpp\n> > >>>> index eae451e..3e5d6be 100644\n> > >>>> --- a/src/android/camera_stream.cpp\n> > >>>> +++ b/src/android/camera_stream.cpp\n> > >>>> @@ -102,7 +102,7 @@ int CameraStream::process(const\n> > >>>> libcamera::FrameBuffer &source,\n> > >>>>        if (!postProcessor_)\n> > >>>>            return 0;\n> > >>>>    -    return postProcessor_->process(&source, dest->maps()[0],\n> > >>>> metadata);\n> > >>>> +    return postProcessor_->process(source, dest->maps()[0], metadata);\n> > >>>>    }\n> > >>>>      FrameBuffer *CameraStream::getBuffer()\n> > >>>> diff --git a/src/android/jpeg/post_processor_jpeg.cpp\n> > >>>> b/src/android/jpeg/post_processor_jpeg.cpp\n> > >>>> index 9d452b7..90bf10d 100644\n> > >>>> --- a/src/android/jpeg/post_processor_jpeg.cpp\n> > >>>> +++ b/src/android/jpeg/post_processor_jpeg.cpp\n> > >>>> @@ -44,8 +44,8 @@ int PostProcessorJpeg::configure(const\n> > >>>> StreamConfiguration &inCfg,\n> > >>>>        return encoder_->configure(inCfg);\n> > >>>>    }\n> > >>>>    -int PostProcessorJpeg::process(const libcamera::FrameBuffer *source,\n> > >>>> -                   const libcamera::Span<uint8_t> &destination,\n> > >>>> +int PostProcessorJpeg::process(const libcamera::FrameBuffer &source,\n> > >>>> +                   libcamera::Span<uint8_t> destination,\n> > >>>>                       CameraMetadata *metadata)\n> > >>>>    {\n> > >>>>        if (!encoder_)\n> > >>>> @@ -67,7 +67,7 @@ int PostProcessorJpeg::process(const\n> > >>>> libcamera::FrameBuffer *source,\n> > >>>>        if (exif.generate() != 0)\n> > >>>>            LOG(JPEG, Error) << \"Failed to generate valid EXIF data\";\n> > >>>>    -    int jpeg_size = encoder_->encode(source, destination,\n> > >>>> exif.data());\n> > >>>> +    int jpeg_size = encoder_->encode(&source, destination, exif.data());\n> > >>>>        if (jpeg_size < 0) {\n> > >>>>            LOG(JPEG, Error) << \"Failed to encode stream image\";\n> > >>>>            return jpeg_size;\n> > >>>> diff --git a/src/android/jpeg/post_processor_jpeg.h\n> > >>>> b/src/android/jpeg/post_processor_jpeg.h\n> > >>>> index 62c8650..ae636ff 100644\n> > >>>> --- a/src/android/jpeg/post_processor_jpeg.h\n> > >>>> +++ b/src/android/jpeg/post_processor_jpeg.h\n> > >>>> @@ -23,8 +23,8 @@ public:\n> > >>>>          int configure(const libcamera::StreamConfiguration &incfg,\n> > >>>>                  const libcamera::StreamConfiguration &outcfg) override;\n> > >>>> -    int process(const libcamera::FrameBuffer *source,\n> > >>>> -            const libcamera::Span<uint8_t> &destination,\n> > >>>> +    int process(const libcamera::FrameBuffer &source,\n> > >>>> +            libcamera::Span<uint8_t> destination,\n> > >>>>                CameraMetadata *metadata) override;\n> > >>>>      private:\n> > >>>> diff --git a/src/android/post_processor.h b/src/android/post_processor.h\n> > >>>> index a891c43..5f87a5d 100644\n> > >>>> --- a/src/android/post_processor.h\n> > >>>> +++ b/src/android/post_processor.h\n> > >>>> @@ -20,8 +20,8 @@ public:\n> > >>>>          virtual int configure(const libcamera::StreamConfiguration\n> > >>>> &inCfg,\n> > >>>>                      const libcamera::StreamConfiguration &outCfg) = 0;\n> > >>>> -    virtual int process(const libcamera::FrameBuffer *source,\n> > >>>> -                const libcamera::Span<uint8_t> &destination,\n> > >>>> +    virtual int process(const libcamera::FrameBuffer &source,\n> > >>>> +                libcamera::Span<uint8_t> destination,\n> > >>>>                    CameraMetadata *metadata) = 0;\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 87E8EC3D3C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Oct 2020 14:30:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0223061439;\n\tThu, 22 Oct 2020 16:30:22 +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 BD68060352\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Oct 2020 16:30:20 +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 2BE4753;\n\tThu, 22 Oct 2020 16:30:20 +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=\"sQqJF8JS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1603377020;\n\tbh=V8u7SdtxW7sBPmkpnW5cs6Ylp9Xz45NrX6ceRN0V7VE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=sQqJF8JSy1d+28y8R1ltvl9ilQmr+9ugcPS2Cn4XYM0yAyA0hu2hLhsEMsCGHuyw0\n\tJD3e5M8SPSiek7rPIuP8LatYduKLC+0I6P74Z/N03Ev/2w/J/J8M0+Xo7PBkuJT8Uf\n\tRgD2X/gj4ez4jSWAn8RVYFKp+aZzcgNBZDZvqupY=","Date":"Thu, 22 Oct 2020 17:29:34 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Hirokazu Honda <hiroh@chromium.org>","Message-ID":"<20201022142934.GC3938@pendragon.ideasonboard.com>","References":"<20201021013955.301790-1-hiroh@chromium.org>\n\t<6ca671c4-e16b-a8e6-b23b-0d62b796a004@uajain.com>\n\t<2dec6fc4-b707-14df-6337-526629f9df19@ideasonboard.com>\n\t<CAO5uPHNctCpO02yNi7qLVe_cfag53SMQns0EoRW9gi7fvU7KWQ@mail.gmail.com>\n\t<12441d0f-cefa-9fe7-a2ca-579264fae3f8@uajain.com>\n\t<CAO5uPHPcP=u5o645vM-PxTGQ2gHVje69NYyx-0tLzT4XkguyKQ@mail.gmail.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<CAO5uPHPcP=u5o645vM-PxTGQ2gHVje69NYyx-0tLzT4XkguyKQ@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v3 1/4] android: Modify PostProcessor\n\tinterface","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>"}}]