[{"id":12418,"web_url":"https://patchwork.libcamera.org/comment/12418/","msgid":"<20200910111648.GN4095624@oden.dyn.berto.se>","date":"2020-09-10T11:16:48","subject":"Re: [libcamera-devel] [PATCH 1/8] android: camera_device: Add\n\tCameraStream::Type","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2020-09-09 17:54:50 +0200, Jacopo Mondi wrote:\n> Define the CameraStream::Type enumeration and assign it to\n> each CameraStream instance at construction time.\n> \n> The CameraStream type will be used to decide if memory needs to be\n> allocated on its behalf or if the stream is backed by memory externally\n> allocated by the Android framework.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/android/camera_device.cpp | 14 ++++--\n>  src/android/camera_device.h   | 87 ++++++++++++++++++++++++++++++++++-\n>  2 files changed, 96 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 50923df22a8f..3c58523e528e 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -168,9 +168,11 @@ MappedCamera3Buffer::MappedCamera3Buffer(const buffer_handle_t camera3buffer,\n>  \t}\n>  }\n>  \n> -CameraStream::CameraStream(PixelFormat format, Size size,\n> +CameraStream::CameraStream(PixelFormat format, Size size, Type type,\n>  \t\t\t   unsigned int index, Encoder *encoder)\n> -\t: format_(format), size_(size), index_(index), encoder_(encoder)\n> +\n> +\t: format_(format), size_(size), type_(type), index_(index),\n> +\t  encoder_(encoder)\n>  {\n>  }\n>  \n> @@ -1215,12 +1217,14 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n>  \n>  \t\tconfig_->addConfiguration(streamConfiguration);\n>  \t\tunsigned int index = config_->size() - 1;\n> -\t\tstreams_.emplace_back(format, size, index);\n> +\t\tstreams_.emplace_back(format, size, CameraStream::Type::Direct,\n> +\t\t\t\t      index);\n>  \t\tstream->priv = static_cast<void *>(&streams_.back());\n>  \t}\n>  \n>  \t/* Now handle MJPEG streams, adding a new stream if required. */\n>  \tif (jpegStream) {\n> +\t\tCameraStream::Type type;\n>  \t\tint index = -1;\n>  \n>  \t\t/* Search for a compatible stream in the non-JPEG ones. */\n> @@ -1238,6 +1242,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n>  \t\t\tLOG(HAL, Info)\n>  \t\t\t\t<< \"Android JPEG stream mapped on stream \" << i;\n>  \n> +\t\t\ttype = CameraStream::Type::Mapped;\n>  \t\t\tindex = i;\n>  \t\t\tbreak;\n>  \t\t}\n> @@ -1262,6 +1267,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n>  \t\t\tLOG(HAL, Info) << \"Adding \" << streamConfiguration.toString()\n>  \t\t\t\t       << \" for MJPEG support\";\n>  \n> +\t\t\ttype = CameraStream::Type::Internal;\n>  \t\t\tconfig_->addConfiguration(streamConfiguration);\n>  \t\t\tindex = config_->size() - 1;\n>  \t\t}\n> @@ -1280,7 +1286,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n>  \t\t\treturn ret;\n>  \t\t}\n>  \n> -\t\tstreams_.emplace_back(formats::MJPEG, cfg.size, index, encoder);\n> +\t\tstreams_.emplace_back(formats::MJPEG, cfg.size, type, index, encoder);\n>  \t\tjpegStream->priv = static_cast<void *>(&streams_.back());\n>  \t}\n>  \n> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> index 912c59aeb5a8..9dea7c42bdb5 100644\n> --- a/src/android/camera_device.h\n> +++ b/src/android/camera_device.h\n> @@ -30,17 +30,102 @@ class CameraMetadata;\n>  class CameraStream\n>  {\n>  public:\n> +\t/*\n> +\t * Enumeration of CameraStream types.\n> +\t *\n> +\t * A camera stream associates an Android stream to a libcamera stream.\n> +\t * This enumeration describes how the two streams are associated and how\n> +\t * and where data produced from libcamera are delivered to the\n> +\t * Android framework.\n> +\t *\n> +\t * Direct:\n> +\t *\n> +\t * The Android stream is directly mapped onto a libcamera stream: frames\n> +\t * are delivered by the library directly in the memory location\n> +\t * specified by the Android stream (buffer_handle_t->data) and provided\n> +\t * to the framework as they are. The Android stream characteristics are\n> +\t * directly translated to the libcamera stream configuration.\n> +\t *\n> +\t * +-----+                +-----+\n> +\t * |  A  |                |  L  |\n> +\t * +-----+                +-----+\n> +\t *    |                      |\n> +\t *    V                      V\n> +\t * +-----+                +------+\n> +\t * |  B  |<---------------|  FB  |\n> +\t * +-----+                +------+\n> +\t *\n> +\t *\n> +\t * Internal:\n> +\t *\n> +\t * Data for the Android stream are produced by processing a libcamera\n> +\t * stream created by the HAL for that purpose. The libcamera stream\n> +\t * needs to be supplied with intermediate buffers where the library\n> +\t * delivers frames to be processed and then provided to the framework.\n> +\t * The libcamera stream configuration is not a direct translation of the\n> +\t * Android stream characteristics, but it describes the format and size\n> +\t * required for the processing procedure to produce frames in the\n> +\t * Android required format.\n> +\t *\n> +\t * +-----+                +-----+    +----+\n> +\t * |  A  |                |  L  |--->|  B |\n> +\t * +-----+                +-----+    +----+\n> +\t *    |                      |         ^\n> +\t *    V                      V         |\n> +\t * +-----+                +------+     |\n> +\t * |  B  |                |  FB  |-----+\n> +\t * +-----+                +------+\n> +\t *   ^                       |\n> +\t *   |-------Processing------|\n> +\t *\n> +\t *\n> +\t * Mapped:\n> +\t *\n> +\t * Data for the Android stream are produced by processing a libcamera\n> +\t * stream associated with another CameraStream. Mapped camera streams do\n> +\t * not need any memory to be reserved for them as they process data\n> +\t * produced by libcamera for a different stream whose format and size\n> +\t * is compatible with the processing procedure requirements to produce\n> +\t * frames in the Android required format.\n> +\t *\n> +\t * +-----+      +-----+          +-----+\n> +\t * |  A  |      |  A' |          |  L  |\n> +\t * +-----+      +-----+          +-----+\n> +\t *    |            |                |\n> +\t *    V            V                V\n> +\t * +-----+      +-----+          +------+\n> +\t * |  B  |      |  B' |<---------|  FB  |\n> +\t * +-----+      +-----+          +------+\n> +\t *   ^              |\n> +\t *   |--Processing--|\n> +\t *\n> +\t *\n> +\t * --------------------------------------------------------------------\n> +\t * A  = Android stream\n> +\t * L  = libcamera stream\n> +\t * B  = memory buffer\n> +\t * FB = libcamera FrameBuffer\n> +\t * \"Processing\" = Frame processing procedure (Encoding, scaling etc)\n> +\t */\n> +\tenum Type {\n> +\t\tDirect,\n> +\t\tInternal,\n> +\t\tMapped,\n> +\t};\n\nI really like the diagrams!\n\nI'm scratching my head trying to think of other names that are more self \nexplanatory from a HAL point-of-view. What about Direct, Processed and \nCopyProcessed ?\n\nI don't want to block this over bike-shedding and we can always argue \nover names on-top so,\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> +\n>  \tCameraStream(libcamera::PixelFormat format, libcamera::Size size,\n> -\t\t     unsigned int index, Encoder *encoder = nullptr);\n> +\t\t     Type type, unsigned int index, Encoder *encoder = nullptr);\n>  \n>  \tconst libcamera::PixelFormat &format() const { return format_; }\n>  \tconst libcamera::Size &size() const { return size_; }\n>  \tunsigned int index() const { return index_; }\n>  \tEncoder *encoder() const { return encoder_.get(); }\n> +\tType type() const { return type_; }\n>  \n>  private:\n>  \tlibcamera::PixelFormat format_;\n>  \tlibcamera::Size size_;\n> +\tType type_;\n>  \t/*\n>  \t * The index of the libcamera StreamConfiguration as added during\n>  \t * configureStreams(). A single libcamera Stream may be used to deliver\n> -- \n> 2.28.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 A22D5BDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Sep 2020 11:16:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3DB2E62D27;\n\tThu, 10 Sep 2020 13:16:52 +0200 (CEST)","from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com\n\t[IPv6:2a00:1450:4864:20::12c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 82E0C62D04\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Sep 2020 13:16:50 +0200 (CEST)","by mail-lf1-x12c.google.com with SMTP id x69so3387827lff.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Sep 2020 04:16:50 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id\n\ty196sm1296503lfa.0.2020.09.10.04.16.49\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 10 Sep 2020 04:16:49 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"ZkxYYqN4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=FoDXjzkhb1bZUmSq7hUCFfM78lRgeYFo0G27GtP2PXU=;\n\tb=ZkxYYqN4t2hg+t5zEX+h2Wp3cXPxHrmyBcBFL/4Ot/BnMZSjSm+pNZbjw2GwUPAgT7\n\tiKApv19JEozg3Fmdcubb/x8QtL6MYc/v5yPtYkmlMGKWfYGzpNRT4+elSZjd3qg+tzKn\n\tncrdOAGGXGF8In8S/HVaC7EI07ufpGCy3aJ0kDWmy42L/0YIX5kAurqOiLYTCJvasprE\n\tvw8VD7jleXtx7Dil9gy5SWORdXP19maq0bzlOaPKbySTusjqOfzFHQGReIA4YGnnPlEr\n\tCuKmTLnnuSxKBNl+RQ+wQKqy6AMNoi+9C8Yc5QeJsuIIsZOHnhAk/hOXE68+I9z4wlPf\n\tySRQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=FoDXjzkhb1bZUmSq7hUCFfM78lRgeYFo0G27GtP2PXU=;\n\tb=XtHCgiuNThDKYD2sjFZR5kfJB6qaOM1E3/oD7z9fej1aOQzW/+QE95OyeV+S/6UESW\n\tbwY5bPpgNedV+Kz73SbDS3IYHCwDN4kO9FdF+TaqbMnlFrTG8rBatlsgMEPmDzGSETLG\n\tw3wuHi+GVHzK+Bp1B4rtkLqyxgS28IrsUP4JoP97YzehXAJc4Fg6MXR3z7JYodg+qxgS\n\trq+82d8pTAkNtC0cYBjlyBRDmdK73jUQdHjxf18Fx5z95TVt77mI+xw4GKSxjFGAmqlO\n\tLLiDSAzivfBx34e8F0NluoVsp3xa9mAQsTC8DLIUuBXKu5PYTTccrjqV9NpkjQ108Wp6\n\tFz4A==","X-Gm-Message-State":"AOAM531arG5vIpFMrULTcaLpVxz8wTS8tVBQ9CRhlcwE2uD1s+bqoKil\n\t8wA6HZ7LxASWZp10vqDPB4EOig==","X-Google-Smtp-Source":"ABdhPJwQNZzRC0sjvEuPPOshaZ1zfQY4crvjKtmAnxHBn/DbFaYcMGB/MkvZS1cbf4152Z7ubhMV1g==","X-Received":"by 2002:a19:c8c6:: with SMTP id\n\ty189mr4012828lff.125.1599736609861; \n\tThu, 10 Sep 2020 04:16:49 -0700 (PDT)","Date":"Thu, 10 Sep 2020 13:16:48 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200910111648.GN4095624@oden.dyn.berto.se>","References":"<20200909155457.153907-1-jacopo@jmondi.org>\n\t<20200909155457.153907-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200909155457.153907-2-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH 1/8] android: camera_device: Add\n\tCameraStream::Type","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":"hanlinchen@chromium.org, libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":12442,"web_url":"https://patchwork.libcamera.org/comment/12442/","msgid":"<CAO5uPHO_NNpCj+h8P8nOiJ94_0HZXuy0YrE8EPHUJazpF6314Q@mail.gmail.com>","date":"2020-09-11T04:26:54","subject":"Re: [libcamera-devel] [PATCH 1/8] android: camera_device: Add\n\tCameraStream::Type","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"On Thu, Sep 10, 2020 at 8:16 PM Niklas Söderlund\n<niklas.soderlund@ragnatech.se> wrote:\n>\n> Hi Jacopo,\n>\n> Thanks for your work.\n>\n> On 2020-09-09 17:54:50 +0200, Jacopo Mondi wrote:\n> > Define the CameraStream::Type enumeration and assign it to\n> > each CameraStream instance at construction time.\n> >\n> > The CameraStream type will be used to decide if memory needs to be\n> > allocated on its behalf or if the stream is backed by memory externally\n> > allocated by the Android framework.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/android/camera_device.cpp | 14 ++++--\n> >  src/android/camera_device.h   | 87 ++++++++++++++++++++++++++++++++++-\n> >  2 files changed, 96 insertions(+), 5 deletions(-)\n> >\n> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> > index 50923df22a8f..3c58523e528e 100644\n> > --- a/src/android/camera_device.cpp\n> > +++ b/src/android/camera_device.cpp\n> > @@ -168,9 +168,11 @@ MappedCamera3Buffer::MappedCamera3Buffer(const buffer_handle_t camera3buffer,\n> >       }\n> >  }\n> >\n> > -CameraStream::CameraStream(PixelFormat format, Size size,\n> > +CameraStream::CameraStream(PixelFormat format, Size size, Type type,\n> >                          unsigned int index, Encoder *encoder)\n> > -     : format_(format), size_(size), index_(index), encoder_(encoder)\n> > +\n> > +     : format_(format), size_(size), type_(type), index_(index),\n> > +       encoder_(encoder)\n> >  {\n> >  }\n> >\n> > @@ -1215,12 +1217,14 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n> >\n> >               config_->addConfiguration(streamConfiguration);\n> >               unsigned int index = config_->size() - 1;\n> > -             streams_.emplace_back(format, size, index);\n> > +             streams_.emplace_back(format, size, CameraStream::Type::Direct,\n> > +                                   index);\n> >               stream->priv = static_cast<void *>(&streams_.back());\n> >       }\n> >\n> >       /* Now handle MJPEG streams, adding a new stream if required. */\n> >       if (jpegStream) {\n> > +             CameraStream::Type type;\n> >               int index = -1;\n> >\n> >               /* Search for a compatible stream in the non-JPEG ones. */\n> > @@ -1238,6 +1242,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n> >                       LOG(HAL, Info)\n> >                               << \"Android JPEG stream mapped on stream \" << i;\n> >\n> > +                     type = CameraStream::Type::Mapped;\n> >                       index = i;\n> >                       break;\n> >               }\n> > @@ -1262,6 +1267,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n> >                       LOG(HAL, Info) << \"Adding \" << streamConfiguration.toString()\n> >                                      << \" for MJPEG support\";\n> >\n> > +                     type = CameraStream::Type::Internal;\n> >                       config_->addConfiguration(streamConfiguration);\n> >                       index = config_->size() - 1;\n> >               }\n> > @@ -1280,7 +1286,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n> >                       return ret;\n> >               }\n> >\n> > -             streams_.emplace_back(formats::MJPEG, cfg.size, index, encoder);\n> > +             streams_.emplace_back(formats::MJPEG, cfg.size, type, index, encoder);\n> >               jpegStream->priv = static_cast<void *>(&streams_.back());\n> >       }\n> >\n> > diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> > index 912c59aeb5a8..9dea7c42bdb5 100644\n> > --- a/src/android/camera_device.h\n> > +++ b/src/android/camera_device.h\n> > @@ -30,17 +30,102 @@ class CameraMetadata;\n> >  class CameraStream\n> >  {\n> >  public:\n> > +     /*\n> > +      * Enumeration of CameraStream types.\n> > +      *\n> > +      * A camera stream associates an Android stream to a libcamera stream.\n> > +      * This enumeration describes how the two streams are associated and how\n> > +      * and where data produced from libcamera are delivered to the\n> > +      * Android framework.\n> > +      *\n> > +      * Direct:\n> > +      *\n> > +      * The Android stream is directly mapped onto a libcamera stream: frames\n> > +      * are delivered by the library directly in the memory location\n> > +      * specified by the Android stream (buffer_handle_t->data) and provided\n> > +      * to the framework as they are. The Android stream characteristics are\n> > +      * directly translated to the libcamera stream configuration.\n> > +      *\n> > +      * +-----+                +-----+\n> > +      * |  A  |                |  L  |\n> > +      * +-----+                +-----+\n> > +      *    |                      |\n> > +      *    V                      V\n> > +      * +-----+                +------+\n> > +      * |  B  |<---------------|  FB  |\n> > +      * +-----+                +------+\n> > +      *\n> > +      *\n> > +      * Internal:\n> > +      *\n> > +      * Data for the Android stream are produced by processing a libcamera\n> > +      * stream created by the HAL for that purpose. The libcamera stream\n> > +      * needs to be supplied with intermediate buffers where the library\n> > +      * delivers frames to be processed and then provided to the framework.\n> > +      * The libcamera stream configuration is not a direct translation of the\n> > +      * Android stream characteristics, but it describes the format and size\n> > +      * required for the processing procedure to produce frames in the\n> > +      * Android required format.\n> > +      *\n> > +      * +-----+                +-----+    +----+\n> > +      * |  A  |                |  L  |--->|  B |\n> > +      * +-----+                +-----+    +----+\n> > +      *    |                      |         ^\n> > +      *    V                      V         |\n> > +      * +-----+                +------+     |\n> > +      * |  B  |                |  FB  |-----+\n> > +      * +-----+                +------+\n> > +      *   ^                       |\n> > +      *   |-------Processing------|\n> > +      *\n> > +      *\n> > +      * Mapped:\n> > +      *\n> > +      * Data for the Android stream are produced by processing a libcamera\n> > +      * stream associated with another CameraStream. Mapped camera streams do\n> > +      * not need any memory to be reserved for them as they process data\n> > +      * produced by libcamera for a different stream whose format and size\n> > +      * is compatible with the processing procedure requirements to produce\n> > +      * frames in the Android required format.\n> > +      *\n> > +      * +-----+      +-----+          +-----+\n> > +      * |  A  |      |  A' |          |  L  |\n> > +      * +-----+      +-----+          +-----+\n> > +      *    |            |                |\n> > +      *    V            V                V\n> > +      * +-----+      +-----+          +------+\n> > +      * |  B  |      |  B' |<---------|  FB  |\n> > +      * +-----+      +-----+          +------+\n> > +      *   ^              |\n> > +      *   |--Processing--|\n> > +      *\n> > +      *\n> > +      * --------------------------------------------------------------------\n> > +      * A  = Android stream\n> > +      * L  = libcamera stream\n> > +      * B  = memory buffer\n> > +      * FB = libcamera FrameBuffer\n> > +      * \"Processing\" = Frame processing procedure (Encoding, scaling etc)\n> > +      */\n> > +     enum Type {\n> > +             Direct,\n> > +             Internal,\n> > +             Mapped,\n> > +     };\n>\n\nnit: enum class\n\n> I really like the diagrams!\n>\n> I'm scratching my head trying to think of other names that are more self\n> explanatory from a HAL point-of-view. What about Direct, Processed and\n> CopyProcessed ?\n>\n> I don't want to block this over bike-shedding and we can always argue\n> over names on-top so,\n>\n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n>\n> > +\n> >       CameraStream(libcamera::PixelFormat format, libcamera::Size size,\n> > -                  unsigned int index, Encoder *encoder = nullptr);\n> > +                  Type type, unsigned int index, Encoder *encoder = nullptr);\n> >\n> >       const libcamera::PixelFormat &format() const { return format_; }\n> >       const libcamera::Size &size() const { return size_; }\n> >       unsigned int index() const { return index_; }\n> >       Encoder *encoder() const { return encoder_.get(); }\n> > +     Type type() const { return type_; }\n> >\n\nhuge nit: Put type() after size() to follow the order of arguments and\nvariable declarations.\n\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n> >  private:\n> >       libcamera::PixelFormat format_;\n> >       libcamera::Size size_;\n> > +     Type type_;\n> >       /*\n> >        * The index of the libcamera StreamConfiguration as added during\n> >        * configureStreams(). A single libcamera Stream may be used to deliver\n> > --\n> > 2.28.0\n> >\n> > _______________________________________________\n> > libcamera-devel mailing list\n> > libcamera-devel@lists.libcamera.org\n> > https://lists.libcamera.org/listinfo/libcamera-devel\n>\n> --\n> Regards,\n> Niklas Söderlund\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 26A53C3B5B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 11 Sep 2020 04:27:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AA8CD62D38;\n\tFri, 11 Sep 2020 06:27:07 +0200 (CEST)","from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com\n\t[IPv6:2a00:1450:4864:20::62f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 394086036C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Sep 2020 06:27:06 +0200 (CEST)","by mail-ej1-x62f.google.com with SMTP id i22so11955860eja.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Sep 2020 21:27:06 -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=\"ifqFsenH\"; 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:content-transfer-encoding;\n\tbh=TorrYgEvJZ9kqaioaSq1dZNUPBH/RlTIwEqEpVVqlX8=;\n\tb=ifqFsenH8aJx2x8QkKX8LpwePrICuR552I1T/CVMoGNQCCRsCX89vE86Bh+afn3hPp\n\tjy2cJCrSSXV+Q/EufUsrFCXmzhio1lpMC2tTd8Oo7oOsAUiEk6/KEjdL6AWu/bHR933H\n\t5Be45lmJXFvGYFLVj7Xj0Lxgo2m4axXPXoFdA=","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:content-transfer-encoding;\n\tbh=TorrYgEvJZ9kqaioaSq1dZNUPBH/RlTIwEqEpVVqlX8=;\n\tb=aVbRGinknN0syztS8KNeA8f0xZwEHwVbZRHHCs/ms9KR1KnGWW5hctzEuKSPUbGuc0\n\twyWQn5w2Bx30GBp27OTp+6G6c5/QvsqMfpt6caQn5fxMVWhueSWicGw3jqlAnWQnxrH3\n\tOIhY88f+qkmYmZCelnjOFQcu75Ihj8P+1u+N7aAo72HBPu+Lb7rUhY2ZvwGKqKmJ6ny8\n\tI0kkm8qdzsUp8YWRI18084+0lTEG8NsZSAJ6E8Y5DK/4VvM4d3LcmAVsR6aHk3igddMJ\n\taqeXfSqjojHR6zOL37sQpKVBRNn2PrmIVLnseuVKG4QM4fF0PB3syWWCQVGdptzcnQXL\n\tNVBA==","X-Gm-Message-State":"AOAM533LBvEkrcspw+sn1EAo1p3JJlGPgkgwuaT63/wqPphpytF8n/nO\n\trXYJE8FTtcj1eybICBD/XJ/aXrT6iKvFlb9CUuPuEw==","X-Google-Smtp-Source":"ABdhPJx6mRmUnRPPd/UH5gSGwbV8oAn4CvN4EeMMT/cqAwznNjiYFizrIINARgJ9u5JQGEhPZO4wH/NNy7nZDENOpvI=","X-Received":"by 2002:a17:906:344e:: with SMTP id\n\td14mr291379ejb.42.1599798425714; \n\tThu, 10 Sep 2020 21:27:05 -0700 (PDT)","MIME-Version":"1.0","References":"<20200909155457.153907-1-jacopo@jmondi.org>\n\t<20200909155457.153907-2-jacopo@jmondi.org>\n\t<20200910111648.GN4095624@oden.dyn.berto.se>","In-Reply-To":"<20200910111648.GN4095624@oden.dyn.berto.se>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Fri, 11 Sep 2020 13:26:54 +0900","Message-ID":"<CAO5uPHO_NNpCj+h8P8nOiJ94_0HZXuy0YrE8EPHUJazpF6314Q@mail.gmail.com>","To":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH 1/8] android: camera_device: Add\n\tCameraStream::Type","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":"Hanlin Chen <hanlinchen@chromium.org>,\n\tlibcamera-devel@lists.libcamera.org","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":12452,"web_url":"https://patchwork.libcamera.org/comment/12452/","msgid":"<23f58ba7-98c8-e247-feed-1b3f4959c943@ideasonboard.com>","date":"2020-09-11T13:50:46","subject":"Re: [libcamera-devel] [PATCH 1/8] android: camera_device: Add\n\tCameraStream::Type","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn 09/09/2020 16:54, Jacopo Mondi wrote:\n> Define the CameraStream::Type enumeration and assign it to\n> each CameraStream instance at construction time.\n> \n> The CameraStream type will be used to decide if memory needs to be\n> allocated on its behalf or if the stream is backed by memory externally\n> allocated by the Android framework.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/android/camera_device.cpp | 14 ++++--\n>  src/android/camera_device.h   | 87 ++++++++++++++++++++++++++++++++++-\n>  2 files changed, 96 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 50923df22a8f..3c58523e528e 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -168,9 +168,11 @@ MappedCamera3Buffer::MappedCamera3Buffer(const buffer_handle_t camera3buffer,\n>  \t}\n>  }\n>  \n> -CameraStream::CameraStream(PixelFormat format, Size size,\n> +CameraStream::CameraStream(PixelFormat format, Size size, Type type,\n>  \t\t\t   unsigned int index, Encoder *encoder)\n> -\t: format_(format), size_(size), index_(index), encoder_(encoder)\n> +\n> +\t: format_(format), size_(size), type_(type), index_(index),\n> +\t  encoder_(encoder)\n>  {\n>  }\n>  \n> @@ -1215,12 +1217,14 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n>  \n>  \t\tconfig_->addConfiguration(streamConfiguration);\n>  \t\tunsigned int index = config_->size() - 1;\n> -\t\tstreams_.emplace_back(format, size, index);\n> +\t\tstreams_.emplace_back(format, size, CameraStream::Type::Direct,\n> +\t\t\t\t      index);\n>  \t\tstream->priv = static_cast<void *>(&streams_.back());\n>  \t}\n>  \n>  \t/* Now handle MJPEG streams, adding a new stream if required. */\n>  \tif (jpegStream) {\n> +\t\tCameraStream::Type type;\n>  \t\tint index = -1;\n>  \n>  \t\t/* Search for a compatible stream in the non-JPEG ones. */\n> @@ -1238,6 +1242,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n>  \t\t\tLOG(HAL, Info)\n>  \t\t\t\t<< \"Android JPEG stream mapped on stream \" << i;\n>  \n> +\t\t\ttype = CameraStream::Type::Mapped;\n>  \t\t\tindex = i;\n>  \t\t\tbreak;\n>  \t\t}\n> @@ -1262,6 +1267,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n>  \t\t\tLOG(HAL, Info) << \"Adding \" << streamConfiguration.toString()\n>  \t\t\t\t       << \" for MJPEG support\";\n>  \n> +\t\t\ttype = CameraStream::Type::Internal;\n>  \t\t\tconfig_->addConfiguration(streamConfiguration);\n>  \t\t\tindex = config_->size() - 1;\n>  \t\t}\n> @@ -1280,7 +1286,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n>  \t\t\treturn ret;\n>  \t\t}\n>  \n> -\t\tstreams_.emplace_back(formats::MJPEG, cfg.size, index, encoder);\n> +\t\tstreams_.emplace_back(formats::MJPEG, cfg.size, type, index, encoder);\n>  \t\tjpegStream->priv = static_cast<void *>(&streams_.back());\n>  \t}\n>  \n> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> index 912c59aeb5a8..9dea7c42bdb5 100644\n> --- a/src/android/camera_device.h\n> +++ b/src/android/camera_device.h\n> @@ -30,17 +30,102 @@ class CameraMetadata;\n>  class CameraStream\n>  {\n>  public:\n> +\t/*\n> +\t * Enumeration of CameraStream types.\n> +\t *\n> +\t * A camera stream associates an Android stream to a libcamera stream.\n> +\t * This enumeration describes how the two streams are associated and how\n> +\t * and where data produced from libcamera are delivered to the\n> +\t * Android framework.\n> +\t *\n> +\t * Direct:\n> +\t *\n> +\t * The Android stream is directly mapped onto a libcamera stream: frames\n> +\t * are delivered by the library directly in the memory location\n> +\t * specified by the Android stream (buffer_handle_t->data) and provided\n> +\t * to the framework as they are. The Android stream characteristics are\n> +\t * directly translated to the libcamera stream configuration.\n> +\t *\n> +\t * +-----+                +-----+\n> +\t * |  A  |                |  L  |\n> +\t * +-----+                +-----+\n> +\t *    |                      |\n> +\t *    V                      V\n> +\t * +-----+                +------+\n> +\t * |  B  |<---------------|  FB  |\n> +\t * +-----+                +------+\n> +\t *\n> +\t *\n> +\t * Internal:\n> +\t *\n> +\t * Data for the Android stream are produced by processing a libcamera\n\nstream is produced\n\n> +\t * stream created by the HAL for that purpose. The libcamera stream\n> +\t * needs to be supplied with intermediate buffers where the library\n> +\t * delivers frames to be processed and then provided to the framework.\n> +\t * The libcamera stream configuration is not a direct translation of the\n> +\t * Android stream characteristics, but it describes the format and size\n> +\t * required for the processing procedure to produce frames in the\n> +\t * Android required format.\n> +\t *\n> +\t * +-----+                +-----+    +----+\n> +\t * |  A  |                |  L  |--->|  B |\n> +\t * +-----+                +-----+    +----+\n> +\t *    |                      |         ^\n> +\t *    V                      V         |\n> +\t * +-----+                +------+     |\n> +\t * |  B  |                |  FB  |-----+\n> +\t * +-----+                +------+\n\nI think libcamera always writes to a FrameBuffer right? Shouldn't 'B' be\nan intermeddiate step between FB and processing?\n\nThe arrows seem a bit odd otherwise, L points to both B and FB, but 'B'\ndoesn't go anywhere?\n\n> +\t *   ^                       |\n> +\t *   |-------Processing------|\n> +\t *\n> +\t *\n> +\t * Mapped:\n> +\t *\n> +\t * Data for the Android stream are produced by processing a libcamera\n\n/stream are produced/stream is produced/\n\nOther than that, this all sounds good.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n> +\t * stream associated with another CameraStream. Mapped camera streams do\n> +\t * not need any memory to be reserved for them as they process data\n> +\t * produced by libcamera for a different stream whose format and size\n> +\t * is compatible with the processing procedure requirements to produce\n> +\t * frames in the Android required format.\n> +\t *\n> +\t * +-----+      +-----+          +-----+\n> +\t * |  A  |      |  A' |          |  L  |\n> +\t * +-----+      +-----+          +-----+\n> +\t *    |            |                |\n> +\t *    V            V                V\n> +\t * +-----+      +-----+          +------+\n> +\t * |  B  |      |  B' |<---------|  FB  |\n> +\t * +-----+      +-----+          +------+\n> +\t *   ^              |\n> +\t *   |--Processing--|\n> +\t *\n> +\t *\n> +\t * --------------------------------------------------------------------\n> +\t * A  = Android stream\n> +\t * L  = libcamera stream\n> +\t * B  = memory buffer\n> +\t * FB = libcamera FrameBuffer\n> +\t * \"Processing\" = Frame processing procedure (Encoding, scaling etc)\n> +\t */\n> +\tenum Type {\n> +\t\tDirect,\n> +\t\tInternal,\n> +\t\tMapped,\n> +\t};\n> +\n>  \tCameraStream(libcamera::PixelFormat format, libcamera::Size size,\n> -\t\t     unsigned int index, Encoder *encoder = nullptr);\n> +\t\t     Type type, unsigned int index, Encoder *encoder = nullptr);\n>  \n>  \tconst libcamera::PixelFormat &format() const { return format_; }\n>  \tconst libcamera::Size &size() const { return size_; }\n>  \tunsigned int index() const { return index_; }\n>  \tEncoder *encoder() const { return encoder_.get(); }\n> +\tType type() const { return type_; }\n>  \n>  private:\n>  \tlibcamera::PixelFormat format_;\n>  \tlibcamera::Size size_;\n> +\tType type_;\n>  \t/*\n>  \t * The index of the libcamera StreamConfiguration as added during\n>  \t * configureStreams(). A single libcamera Stream may be used to deliver\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 7D4AEBDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 11 Sep 2020 13:51:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 12E0C62C8C;\n\tFri, 11 Sep 2020 15:51:05 +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 AF38F60534\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Sep 2020 15:51:03 +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 DCEE9A17;\n\tFri, 11 Sep 2020 15:50:48 +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=\"UgHfuwmG\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1599832249;\n\tbh=zVUAHPqZfC3KH1QNVf++ACsQSuZZIzcJj/ZmqrGVt0o=;\n\th=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=UgHfuwmGfnHzfZgc3bTlUu97GsvW9Fxd5Rt+RnQM2J4NC5TFXd5/V7/xo02cNMyFu\n\tfbL/voJjS3AF1r0kYrwpCKFtj/ktAWMPq1J/kvCvAdzaiTQuhsFL1Fb5Nrqniztxz9\n\trL5yiu7Gz+xlMsvMJpV1WLG9cQfyO4WYUSrkCoB0=","To":"Jacopo Mondi <jacopo@jmondi.org>, libcamera-devel@lists.libcamera.org","References":"<20200909155457.153907-1-jacopo@jmondi.org>\n\t<20200909155457.153907-2-jacopo@jmondi.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":"<23f58ba7-98c8-e247-feed-1b3f4959c943@ideasonboard.com>","Date":"Fri, 11 Sep 2020 14:50:46 +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":"<20200909155457.153907-2-jacopo@jmondi.org>","Content-Language":"en-GB","Subject":"Re: [libcamera-devel] [PATCH 1/8] android: camera_device: Add\n\tCameraStream::Type","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","Cc":"hanlinchen@chromium.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":12453,"web_url":"https://patchwork.libcamera.org/comment/12453/","msgid":"<20200911160053.eirv2wk5rc5epjrq@uno.localdomain>","date":"2020-09-11T16:00:53","subject":"Re: [libcamera-devel] [PATCH 1/8] android: camera_device: Add\n\tCameraStream::Type","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Kieran,\n\nOn Fri, Sep 11, 2020 at 02:50:46PM +0100, Kieran Bingham wrote:\n> Hi Jacopo,\n>\n> On 09/09/2020 16:54, Jacopo Mondi wrote:\n> > Define the CameraStream::Type enumeration and assign it to\n> > each CameraStream instance at construction time.\n> >\n> > The CameraStream type will be used to decide if memory needs to be\n> > allocated on its behalf or if the stream is backed by memory externally\n> > allocated by the Android framework.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/android/camera_device.cpp | 14 ++++--\n> >  src/android/camera_device.h   | 87 ++++++++++++++++++++++++++++++++++-\n> >  2 files changed, 96 insertions(+), 5 deletions(-)\n> >\n> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> > index 50923df22a8f..3c58523e528e 100644\n> > --- a/src/android/camera_device.cpp\n> > +++ b/src/android/camera_device.cpp\n> > @@ -168,9 +168,11 @@ MappedCamera3Buffer::MappedCamera3Buffer(const buffer_handle_t camera3buffer,\n> >  \t}\n> >  }\n> >\n> > -CameraStream::CameraStream(PixelFormat format, Size size,\n> > +CameraStream::CameraStream(PixelFormat format, Size size, Type type,\n> >  \t\t\t   unsigned int index, Encoder *encoder)\n> > -\t: format_(format), size_(size), index_(index), encoder_(encoder)\n> > +\n> > +\t: format_(format), size_(size), type_(type), index_(index),\n> > +\t  encoder_(encoder)\n> >  {\n> >  }\n> >\n> > @@ -1215,12 +1217,14 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n> >\n> >  \t\tconfig_->addConfiguration(streamConfiguration);\n> >  \t\tunsigned int index = config_->size() - 1;\n> > -\t\tstreams_.emplace_back(format, size, index);\n> > +\t\tstreams_.emplace_back(format, size, CameraStream::Type::Direct,\n> > +\t\t\t\t      index);\n> >  \t\tstream->priv = static_cast<void *>(&streams_.back());\n> >  \t}\n> >\n> >  \t/* Now handle MJPEG streams, adding a new stream if required. */\n> >  \tif (jpegStream) {\n> > +\t\tCameraStream::Type type;\n> >  \t\tint index = -1;\n> >\n> >  \t\t/* Search for a compatible stream in the non-JPEG ones. */\n> > @@ -1238,6 +1242,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n> >  \t\t\tLOG(HAL, Info)\n> >  \t\t\t\t<< \"Android JPEG stream mapped on stream \" << i;\n> >\n> > +\t\t\ttype = CameraStream::Type::Mapped;\n> >  \t\t\tindex = i;\n> >  \t\t\tbreak;\n> >  \t\t}\n> > @@ -1262,6 +1267,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n> >  \t\t\tLOG(HAL, Info) << \"Adding \" << streamConfiguration.toString()\n> >  \t\t\t\t       << \" for MJPEG support\";\n> >\n> > +\t\t\ttype = CameraStream::Type::Internal;\n> >  \t\t\tconfig_->addConfiguration(streamConfiguration);\n> >  \t\t\tindex = config_->size() - 1;\n> >  \t\t}\n> > @@ -1280,7 +1286,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n> >  \t\t\treturn ret;\n> >  \t\t}\n> >\n> > -\t\tstreams_.emplace_back(formats::MJPEG, cfg.size, index, encoder);\n> > +\t\tstreams_.emplace_back(formats::MJPEG, cfg.size, type, index, encoder);\n> >  \t\tjpegStream->priv = static_cast<void *>(&streams_.back());\n> >  \t}\n> >\n> > diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> > index 912c59aeb5a8..9dea7c42bdb5 100644\n> > --- a/src/android/camera_device.h\n> > +++ b/src/android/camera_device.h\n> > @@ -30,17 +30,102 @@ class CameraMetadata;\n> >  class CameraStream\n> >  {\n> >  public:\n> > +\t/*\n> > +\t * Enumeration of CameraStream types.\n> > +\t *\n> > +\t * A camera stream associates an Android stream to a libcamera stream.\n> > +\t * This enumeration describes how the two streams are associated and how\n> > +\t * and where data produced from libcamera are delivered to the\n> > +\t * Android framework.\n> > +\t *\n> > +\t * Direct:\n> > +\t *\n> > +\t * The Android stream is directly mapped onto a libcamera stream: frames\n> > +\t * are delivered by the library directly in the memory location\n> > +\t * specified by the Android stream (buffer_handle_t->data) and provided\n> > +\t * to the framework as they are. The Android stream characteristics are\n> > +\t * directly translated to the libcamera stream configuration.\n> > +\t *\n> > +\t * +-----+                +-----+\n> > +\t * |  A  |                |  L  |\n> > +\t * +-----+                +-----+\n> > +\t *    |                      |\n> > +\t *    V                      V\n> > +\t * +-----+                +------+\n> > +\t * |  B  |<---------------|  FB  |\n> > +\t * +-----+                +------+\n> > +\t *\n> > +\t *\n> > +\t * Internal:\n> > +\t *\n> > +\t * Data for the Android stream are produced by processing a libcamera\n>\n> stream is produced\n>\n> > +\t * stream created by the HAL for that purpose. The libcamera stream\n> > +\t * needs to be supplied with intermediate buffers where the library\n> > +\t * delivers frames to be processed and then provided to the framework.\n> > +\t * The libcamera stream configuration is not a direct translation of the\n> > +\t * Android stream characteristics, but it describes the format and size\n> > +\t * required for the processing procedure to produce frames in the\n> > +\t * Android required format.\n> > +\t *\n> > +\t * +-----+                +-----+    +----+\n> > +\t * |  A  |                |  L  |--->|  B |\n> > +\t * +-----+                +-----+    +----+\n> > +\t *    |                      |         ^\n> > +\t *    V                      V         |\n> > +\t * +-----+                +------+     |\n> > +\t * |  B  |                |  FB  |-----+\n> > +\t * +-----+                +------+\n>\n> I think libcamera always writes to a FrameBuffer right? Shouldn't 'B' be\n> an intermeddiate step between FB and processing?\n\nShould I swap FB and B here ? I probably makes sense and aligns to the\nother drawings\n\n>\n> The arrows seem a bit odd otherwise, L points to both B and FB, but 'B'\n> doesn't go anywhere?\n>\n> > +\t *   ^                       |\n> > +\t *   |-------Processing------|\n> > +\t *\n> > +\t *\n> > +\t * Mapped:\n> > +\t *\n> > +\t * Data for the Android stream are produced by processing a libcamera\n>\n> /stream are produced/stream is produced/\n>\n> Other than that, this all sounds good.\n>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nThanks\n  j\n\n>\n>\n> > +\t * stream associated with another CameraStream. Mapped camera streams do\n> > +\t * not need any memory to be reserved for them as they process data\n> > +\t * produced by libcamera for a different stream whose format and size\n> > +\t * is compatible with the processing procedure requirements to produce\n> > +\t * frames in the Android required format.\n> > +\t *\n> > +\t * +-----+      +-----+          +-----+\n> > +\t * |  A  |      |  A' |          |  L  |\n> > +\t * +-----+      +-----+          +-----+\n> > +\t *    |            |                |\n> > +\t *    V            V                V\n> > +\t * +-----+      +-----+          +------+\n> > +\t * |  B  |      |  B' |<---------|  FB  |\n> > +\t * +-----+      +-----+          +------+\n> > +\t *   ^              |\n> > +\t *   |--Processing--|\n> > +\t *\n> > +\t *\n> > +\t * --------------------------------------------------------------------\n> > +\t * A  = Android stream\n> > +\t * L  = libcamera stream\n> > +\t * B  = memory buffer\n> > +\t * FB = libcamera FrameBuffer\n> > +\t * \"Processing\" = Frame processing procedure (Encoding, scaling etc)\n> > +\t */\n> > +\tenum Type {\n> > +\t\tDirect,\n> > +\t\tInternal,\n> > +\t\tMapped,\n> > +\t};\n> > +\n> >  \tCameraStream(libcamera::PixelFormat format, libcamera::Size size,\n> > -\t\t     unsigned int index, Encoder *encoder = nullptr);\n> > +\t\t     Type type, unsigned int index, Encoder *encoder = nullptr);\n> >\n> >  \tconst libcamera::PixelFormat &format() const { return format_; }\n> >  \tconst libcamera::Size &size() const { return size_; }\n> >  \tunsigned int index() const { return index_; }\n> >  \tEncoder *encoder() const { return encoder_.get(); }\n> > +\tType type() const { return type_; }\n> >\n> >  private:\n> >  \tlibcamera::PixelFormat format_;\n> >  \tlibcamera::Size size_;\n> > +\tType type_;\n> >  \t/*\n> >  \t * The index of the libcamera StreamConfiguration as added during\n> >  \t * configureStreams(). A single libcamera Stream may be used to deliver\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 29F7FC3B5B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 11 Sep 2020 15:57:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A8C9E62D86;\n\tFri, 11 Sep 2020 17:57:05 +0200 (CEST)","from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 02BC060534\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Sep 2020 17:57:03 +0200 (CEST)","from uno.localdomain (93-34-118-233.ip49.fastwebnet.it\n\t[93.34.118.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 4BF7720008;\n\tFri, 11 Sep 2020 15:57:03 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","Date":"Fri, 11 Sep 2020 18:00:53 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<20200911160053.eirv2wk5rc5epjrq@uno.localdomain>","References":"<20200909155457.153907-1-jacopo@jmondi.org>\n\t<20200909155457.153907-2-jacopo@jmondi.org>\n\t<23f58ba7-98c8-e247-feed-1b3f4959c943@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<23f58ba7-98c8-e247-feed-1b3f4959c943@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 1/8] android: camera_device: Add\n\tCameraStream::Type","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":"hanlinchen@chromium.org, 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":12562,"web_url":"https://patchwork.libcamera.org/comment/12562/","msgid":"<20200917131236.r4ikippk7mgze6vd@uno.localdomain>","date":"2020-09-17T13:12:36","subject":"Re: [libcamera-devel] [PATCH 1/8] android: camera_device: Add\n\tCameraStream::Type","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Niklas,\n\nOn Thu, Sep 10, 2020 at 01:16:48PM +0200, Niklas Söderlund wrote:\n> Hi Jacopo,\n>\n> Thanks for your work.\n>\n> On 2020-09-09 17:54:50 +0200, Jacopo Mondi wrote:\n> > Define the CameraStream::Type enumeration and assign it to\n> > each CameraStream instance at construction time.\n> >\n> > The CameraStream type will be used to decide if memory needs to be\n> > allocated on its behalf or if the stream is backed by memory externally\n> > allocated by the Android framework.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/android/camera_device.cpp | 14 ++++--\n> >  src/android/camera_device.h   | 87 ++++++++++++++++++++++++++++++++++-\n> >  2 files changed, 96 insertions(+), 5 deletions(-)\n> >\n> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> > index 50923df22a8f..3c58523e528e 100644\n> > --- a/src/android/camera_device.cpp\n> > +++ b/src/android/camera_device.cpp\n> > @@ -168,9 +168,11 @@ MappedCamera3Buffer::MappedCamera3Buffer(const buffer_handle_t camera3buffer,\n> >  \t}\n> >  }\n> >\n> > -CameraStream::CameraStream(PixelFormat format, Size size,\n> > +CameraStream::CameraStream(PixelFormat format, Size size, Type type,\n> >  \t\t\t   unsigned int index, Encoder *encoder)\n> > -\t: format_(format), size_(size), index_(index), encoder_(encoder)\n> > +\n> > +\t: format_(format), size_(size), type_(type), index_(index),\n> > +\t  encoder_(encoder)\n> >  {\n> >  }\n> >\n> > @@ -1215,12 +1217,14 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n> >\n> >  \t\tconfig_->addConfiguration(streamConfiguration);\n> >  \t\tunsigned int index = config_->size() - 1;\n> > -\t\tstreams_.emplace_back(format, size, index);\n> > +\t\tstreams_.emplace_back(format, size, CameraStream::Type::Direct,\n> > +\t\t\t\t      index);\n> >  \t\tstream->priv = static_cast<void *>(&streams_.back());\n> >  \t}\n> >\n> >  \t/* Now handle MJPEG streams, adding a new stream if required. */\n> >  \tif (jpegStream) {\n> > +\t\tCameraStream::Type type;\n> >  \t\tint index = -1;\n> >\n> >  \t\t/* Search for a compatible stream in the non-JPEG ones. */\n> > @@ -1238,6 +1242,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n> >  \t\t\tLOG(HAL, Info)\n> >  \t\t\t\t<< \"Android JPEG stream mapped on stream \" << i;\n> >\n> > +\t\t\ttype = CameraStream::Type::Mapped;\n> >  \t\t\tindex = i;\n> >  \t\t\tbreak;\n> >  \t\t}\n> > @@ -1262,6 +1267,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n> >  \t\t\tLOG(HAL, Info) << \"Adding \" << streamConfiguration.toString()\n> >  \t\t\t\t       << \" for MJPEG support\";\n> >\n> > +\t\t\ttype = CameraStream::Type::Internal;\n> >  \t\t\tconfig_->addConfiguration(streamConfiguration);\n> >  \t\t\tindex = config_->size() - 1;\n> >  \t\t}\n> > @@ -1280,7 +1286,7 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n> >  \t\t\treturn ret;\n> >  \t\t}\n> >\n> > -\t\tstreams_.emplace_back(formats::MJPEG, cfg.size, index, encoder);\n> > +\t\tstreams_.emplace_back(formats::MJPEG, cfg.size, type, index, encoder);\n> >  \t\tjpegStream->priv = static_cast<void *>(&streams_.back());\n> >  \t}\n> >\n> > diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> > index 912c59aeb5a8..9dea7c42bdb5 100644\n> > --- a/src/android/camera_device.h\n> > +++ b/src/android/camera_device.h\n> > @@ -30,17 +30,102 @@ class CameraMetadata;\n> >  class CameraStream\n> >  {\n> >  public:\n> > +\t/*\n> > +\t * Enumeration of CameraStream types.\n> > +\t *\n> > +\t * A camera stream associates an Android stream to a libcamera stream.\n> > +\t * This enumeration describes how the two streams are associated and how\n> > +\t * and where data produced from libcamera are delivered to the\n> > +\t * Android framework.\n> > +\t *\n> > +\t * Direct:\n> > +\t *\n> > +\t * The Android stream is directly mapped onto a libcamera stream: frames\n> > +\t * are delivered by the library directly in the memory location\n> > +\t * specified by the Android stream (buffer_handle_t->data) and provided\n> > +\t * to the framework as they are. The Android stream characteristics are\n> > +\t * directly translated to the libcamera stream configuration.\n> > +\t *\n> > +\t * +-----+                +-----+\n> > +\t * |  A  |                |  L  |\n> > +\t * +-----+                +-----+\n> > +\t *    |                      |\n> > +\t *    V                      V\n> > +\t * +-----+                +------+\n> > +\t * |  B  |<---------------|  FB  |\n> > +\t * +-----+                +------+\n> > +\t *\n> > +\t *\n> > +\t * Internal:\n> > +\t *\n> > +\t * Data for the Android stream are produced by processing a libcamera\n> > +\t * stream created by the HAL for that purpose. The libcamera stream\n> > +\t * needs to be supplied with intermediate buffers where the library\n> > +\t * delivers frames to be processed and then provided to the framework.\n> > +\t * The libcamera stream configuration is not a direct translation of the\n> > +\t * Android stream characteristics, but it describes the format and size\n> > +\t * required for the processing procedure to produce frames in the\n> > +\t * Android required format.\n> > +\t *\n> > +\t * +-----+                +-----+    +----+\n> > +\t * |  A  |                |  L  |--->|  B |\n> > +\t * +-----+                +-----+    +----+\n> > +\t *    |                      |         ^\n> > +\t *    V                      V         |\n> > +\t * +-----+                +------+     |\n> > +\t * |  B  |                |  FB  |-----+\n> > +\t * +-----+                +------+\n> > +\t *   ^                       |\n> > +\t *   |-------Processing------|\n> > +\t *\n> > +\t *\n> > +\t * Mapped:\n> > +\t *\n> > +\t * Data for the Android stream are produced by processing a libcamera\n> > +\t * stream associated with another CameraStream. Mapped camera streams do\n> > +\t * not need any memory to be reserved for them as they process data\n> > +\t * produced by libcamera for a different stream whose format and size\n> > +\t * is compatible with the processing procedure requirements to produce\n> > +\t * frames in the Android required format.\n> > +\t *\n> > +\t * +-----+      +-----+          +-----+\n> > +\t * |  A  |      |  A' |          |  L  |\n> > +\t * +-----+      +-----+          +-----+\n> > +\t *    |            |                |\n> > +\t *    V            V                V\n> > +\t * +-----+      +-----+          +------+\n> > +\t * |  B  |      |  B' |<---------|  FB  |\n> > +\t * +-----+      +-----+          +------+\n> > +\t *   ^              |\n> > +\t *   |--Processing--|\n> > +\t *\n> > +\t *\n> > +\t * --------------------------------------------------------------------\n> > +\t * A  = Android stream\n> > +\t * L  = libcamera stream\n> > +\t * B  = memory buffer\n> > +\t * FB = libcamera FrameBuffer\n> > +\t * \"Processing\" = Frame processing procedure (Encoding, scaling etc)\n> > +\t */\n> > +\tenum Type {\n> > +\t\tDirect,\n> > +\t\tInternal,\n> > +\t\tMapped,\n> > +\t};\n>\n> I really like the diagrams!\n>\n> I'm scratching my head trying to think of other names that are more self\n> explanatory from a HAL point-of-view. What about Direct, Processed and\n> CopyProcessed ?\n\nThanks, I like \"direct\" and \"processed\", not much \"CopyProcessed\"\nthough...\n\nLet me send v2 with the names I have here, we can continue discussing\nthem on that series\n\nThanks\n  j\n>\n> I don't want to block this over bike-shedding and we can always argue\n> over names on-top so,\n>\n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n>\n> > +\n> >  \tCameraStream(libcamera::PixelFormat format, libcamera::Size size,\n> > -\t\t     unsigned int index, Encoder *encoder = nullptr);\n> > +\t\t     Type type, unsigned int index, Encoder *encoder = nullptr);\n> >\n> >  \tconst libcamera::PixelFormat &format() const { return format_; }\n> >  \tconst libcamera::Size &size() const { return size_; }\n> >  \tunsigned int index() const { return index_; }\n> >  \tEncoder *encoder() const { return encoder_.get(); }\n> > +\tType type() const { return type_; }\n> >\n> >  private:\n> >  \tlibcamera::PixelFormat format_;\n> >  \tlibcamera::Size size_;\n> > +\tType type_;\n> >  \t/*\n> >  \t * The index of the libcamera StreamConfiguration as added during\n> >  \t * configureStreams(). A single libcamera Stream may be used to deliver\n> > --\n> > 2.28.0\n> >\n> > _______________________________________________\n> > libcamera-devel mailing list\n> > libcamera-devel@lists.libcamera.org\n> > https://lists.libcamera.org/listinfo/libcamera-devel\n>\n> --\n> Regards,\n> Niklas Söderlund","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 213E5C3B5B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Sep 2020 13:08:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7B41E62F67;\n\tThu, 17 Sep 2020 15:08:47 +0200 (CEST)","from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 00A7460368\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Sep 2020 15:08:45 +0200 (CEST)","from uno.localdomain (93-34-118-233.ip49.fastwebnet.it\n\t[93.34.118.233]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 579962001B;\n\tThu, 17 Sep 2020 13:08:45 +0000 (UTC)"],"X-Originating-IP":"93.34.118.233","Date":"Thu, 17 Sep 2020 15:12:36 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20200917131236.r4ikippk7mgze6vd@uno.localdomain>","References":"<20200909155457.153907-1-jacopo@jmondi.org>\n\t<20200909155457.153907-2-jacopo@jmondi.org>\n\t<20200910111648.GN4095624@oden.dyn.berto.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200910111648.GN4095624@oden.dyn.berto.se>","Subject":"Re: [libcamera-devel] [PATCH 1/8] android: camera_device: Add\n\tCameraStream::Type","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":"hanlinchen@chromium.org, libcamera-devel@lists.libcamera.org","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>"}}]