[{"id":19223,"web_url":"https://patchwork.libcamera.org/comment/19223/","msgid":"<YS6SAgxavtrpI8Cc@pendragon.ideasonboard.com>","date":"2021-08-31T20:33:06","subject":"Re: [libcamera-devel] [PATCH v3 1/3] android: camera_stream: Create\n\tpost processor in configure()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Hiro,\n\nThank you for the patch.\n\nOn Tue, Aug 31, 2021 at 06:34:37PM +0900, Hirokazu Honda wrote:\n> CameraStream creates PostProcessor and FrameBufferAllocator in\n> the constructor. CameraStream assumes that a used post processor\n> is JPEG post processor. Since we need to support various post\n> processors, we would rather move the creation to configure() so\n> as to return an error code if no proper post processor is found.\n> This also moves FrameBufferAllocator and Mutex creation for\n> consistency.\n> \n> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/android/camera_device.h   |  1 +\n>  src/android/camera_stream.cpp | 36 ++++++++++++++++++-----------------\n>  2 files changed, 20 insertions(+), 17 deletions(-)\n> \n> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> index a5576927..296c2f18 100644\n> --- a/src/android/camera_device.h\n> +++ b/src/android/camera_device.h\n> @@ -48,6 +48,7 @@ public:\n>  \n>  \tunsigned int id() const { return id_; }\n>  \tcamera3_device_t *camera3Device() { return &camera3Device_; }\n> +\tconst CameraCapabilities *capabilities() const { return &capabilities_; }\n>  \tconst std::shared_ptr<libcamera::Camera> &camera() const { return camera_; }\n>  \n>  \tconst std::string &maker() const { return maker_; }\n> diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\n> index 01909ec7..fb10bf06 100644\n> --- a/src/android/camera_stream.cpp\n> +++ b/src/android/camera_stream.cpp\n> @@ -10,6 +10,7 @@\n>  #include <sys/mman.h>\n>  \n>  #include \"camera_buffer.h\"\n> +#include \"camera_capabilities.h\"\n>  #include \"camera_device.h\"\n>  #include \"camera_metadata.h\"\n>  #include \"jpeg/post_processor_jpeg.h\"\n> @@ -47,20 +48,6 @@ CameraStream::CameraStream(CameraDevice *const cameraDevice,\n>  \t: cameraDevice_(cameraDevice), config_(config), type_(type),\n>  \t  camera3Stream_(camera3Stream), index_(index)\n>  {\n> -\tif (type_ == Type::Internal || type_ == Type::Mapped) {\n> -\t\t/*\n> -\t\t * \\todo There might be multiple post-processors. The logic\n> -\t\t * which should be instantiated here, is deferred for the\n> -\t\t * future. For now, we only have PostProcessorJpeg and that\n> -\t\t * is what we instantiate here.\n> -\t\t */\n> -\t\tpostProcessor_ = std::make_unique<PostProcessorJpeg>(cameraDevice_);\n> -\t}\n> -\n> -\tif (type == Type::Internal) {\n> -\t\tallocator_ = std::make_unique<FrameBufferAllocator>(cameraDevice_->camera());\n> -\t\tmutex_ = std::make_unique<std::mutex>();\n> -\t}\n>  }\n>  \n>  const StreamConfiguration &CameraStream::configuration() const\n> @@ -75,15 +62,30 @@ Stream *CameraStream::stream() const\n>  \n>  int CameraStream::configure()\n>  {\n> -\tif (postProcessor_) {\n> +\tif (type_ == Type::Internal || type_ == Type::Mapped) {\n> +\t\tconst PixelFormat outFormat =\n> +\t\t\tcameraDevice_->capabilities()->toPixelFormat(camera3Stream_->format);\n>  \t\tStreamConfiguration output = configuration();\n> -\t\toutput.pixelFormat = formats::MJPEG;\n> +\t\toutput.pixelFormat = outFormat;\n\nI'd add a blank line here. Please let me know what you prefer, and I'll\nhandle it when pushing.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t\tswitch (outFormat) {\n> +\t\tcase formats::MJPEG:\n> +\t\t\tpostProcessor_ = std::make_unique<PostProcessorJpeg>(cameraDevice_);\n> +\t\t\tbreak;\n> +\n> +\t\tdefault:\n> +\t\t\tLOG(HAL, Error) << \"Unsupported format: \" << outFormat;\n> +\t\t\treturn -EINVAL;\n> +\t\t}\n> +\n>  \t\tint ret = postProcessor_->configure(configuration(), output);\n>  \t\tif (ret)\n>  \t\t\treturn ret;\n>  \t}\n>  \n> -\tif (allocator_) {\n> +\tif (type_ == Type::Internal) {\n> +\t\tallocator_ = std::make_unique<FrameBufferAllocator>(cameraDevice_->camera());\n> +\t\tmutex_ = std::make_unique<std::mutex>();\n> +\n>  \t\tint ret = allocator_->allocate(stream());\n>  \t\tif (ret < 0)\n>  \t\t\treturn ret;","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 D7987BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 31 Aug 2021 20:33:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 321FD6916A;\n\tTue, 31 Aug 2021 22:33:23 +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 F1BF668890\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 31 Aug 2021 22:33:21 +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 63D5D24F;\n\tTue, 31 Aug 2021 22:33:21 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"FDPWX1lY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630442001;\n\tbh=FzYN/6nrZSrR9VmKxPqqA6GkFS2Sk/aJ18pJutJYgqA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=FDPWX1lYe66jQezbkDfZWnrqU0TM8K9EC3/B0M3mCmONe6sF6BJa0WpGOmdBo35Wh\n\t7McDdwU7qDF7wmPYD//xxEPJrE5qjs1W6DL+8JENvft4XBPnd+8LUA+FRY1tqU1fHU\n\tnxDS6eyVeYFo7W3xTFDgnImZj+5yAfJnkfDhdr60=","Date":"Tue, 31 Aug 2021 23:33:06 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Hirokazu Honda <hiroh@chromium.org>","Message-ID":"<YS6SAgxavtrpI8Cc@pendragon.ideasonboard.com>","References":"<20210831093439.853586-1-hiroh@chromium.org>\n\t<20210831093439.853586-2-hiroh@chromium.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210831093439.853586-2-hiroh@chromium.org>","Subject":"Re: [libcamera-devel] [PATCH v3 1/3] android: camera_stream: Create\n\tpost processor in configure()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":19228,"web_url":"https://patchwork.libcamera.org/comment/19228/","msgid":"<CAO5uPHNOAL6gHPDRP1iCzrYGqCQ4oXA2qpFSqHkn9JAcx-vvaw@mail.gmail.com>","date":"2021-08-31T20:45:28","subject":"Re: [libcamera-devel] [PATCH v3 1/3] android: camera_stream: Create\n\tpost processor in configure()","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Laurent,\n\nOn Wed, Sep 1, 2021 at 5:33 AM Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> Hi Hiro,\n>\n> Thank you for the patch.\n>\n> On Tue, Aug 31, 2021 at 06:34:37PM +0900, Hirokazu Honda wrote:\n> > CameraStream creates PostProcessor and FrameBufferAllocator in\n> > the constructor. CameraStream assumes that a used post processor\n> > is JPEG post processor. Since we need to support various post\n> > processors, we would rather move the creation to configure() so\n> > as to return an error code if no proper post processor is found.\n> > This also moves FrameBufferAllocator and Mutex creation for\n> > consistency.\n> >\n> > Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> > Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/android/camera_device.h   |  1 +\n> >  src/android/camera_stream.cpp | 36 ++++++++++++++++++-----------------\n> >  2 files changed, 20 insertions(+), 17 deletions(-)\n> >\n> > diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> > index a5576927..296c2f18 100644\n> > --- a/src/android/camera_device.h\n> > +++ b/src/android/camera_device.h\n> > @@ -48,6 +48,7 @@ public:\n> >\n> >       unsigned int id() const { return id_; }\n> >       camera3_device_t *camera3Device() { return &camera3Device_; }\n> > +     const CameraCapabilities *capabilities() const { return &capabilities_; }\n> >       const std::shared_ptr<libcamera::Camera> &camera() const { return camera_; }\n> >\n> >       const std::string &maker() const { return maker_; }\n> > diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\n> > index 01909ec7..fb10bf06 100644\n> > --- a/src/android/camera_stream.cpp\n> > +++ b/src/android/camera_stream.cpp\n> > @@ -10,6 +10,7 @@\n> >  #include <sys/mman.h>\n> >\n> >  #include \"camera_buffer.h\"\n> > +#include \"camera_capabilities.h\"\n> >  #include \"camera_device.h\"\n> >  #include \"camera_metadata.h\"\n> >  #include \"jpeg/post_processor_jpeg.h\"\n> > @@ -47,20 +48,6 @@ CameraStream::CameraStream(CameraDevice *const cameraDevice,\n> >       : cameraDevice_(cameraDevice), config_(config), type_(type),\n> >         camera3Stream_(camera3Stream), index_(index)\n> >  {\n> > -     if (type_ == Type::Internal || type_ == Type::Mapped) {\n> > -             /*\n> > -              * \\todo There might be multiple post-processors. The logic\n> > -              * which should be instantiated here, is deferred for the\n> > -              * future. For now, we only have PostProcessorJpeg and that\n> > -              * is what we instantiate here.\n> > -              */\n> > -             postProcessor_ = std::make_unique<PostProcessorJpeg>(cameraDevice_);\n> > -     }\n> > -\n> > -     if (type == Type::Internal) {\n> > -             allocator_ = std::make_unique<FrameBufferAllocator>(cameraDevice_->camera());\n> > -             mutex_ = std::make_unique<std::mutex>();\n> > -     }\n> >  }\n> >\n> >  const StreamConfiguration &CameraStream::configuration() const\n> > @@ -75,15 +62,30 @@ Stream *CameraStream::stream() const\n> >\n> >  int CameraStream::configure()\n> >  {\n> > -     if (postProcessor_) {\n> > +     if (type_ == Type::Internal || type_ == Type::Mapped) {\n> > +             const PixelFormat outFormat =\n> > +                     cameraDevice_->capabilities()->toPixelFormat(camera3Stream_->format);\n> >               StreamConfiguration output = configuration();\n> > -             output.pixelFormat = formats::MJPEG;\n> > +             output.pixelFormat = outFormat;\n>\n> I'd add a blank line here. Please let me know what you prefer, and I'll\n> handle it when pushing.\n>\n\nFair enough.\n\nThanks,\n-Hiro\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n> > +             switch (outFormat) {\n> > +             case formats::MJPEG:\n> > +                     postProcessor_ = std::make_unique<PostProcessorJpeg>(cameraDevice_);\n> > +                     break;\n> > +\n> > +             default:\n> > +                     LOG(HAL, Error) << \"Unsupported format: \" << outFormat;\n> > +                     return -EINVAL;\n> > +             }\n> > +\n> >               int ret = postProcessor_->configure(configuration(), output);\n> >               if (ret)\n> >                       return ret;\n> >       }\n> >\n> > -     if (allocator_) {\n> > +     if (type_ == Type::Internal) {\n> > +             allocator_ = std::make_unique<FrameBufferAllocator>(cameraDevice_->camera());\n> > +             mutex_ = std::make_unique<std::mutex>();\n> > +\n> >               int ret = allocator_->allocate(stream());\n> >               if (ret < 0)\n> >                       return ret;\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 8BC5ABD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 31 Aug 2021 20:45:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F340B6916A;\n\tTue, 31 Aug 2021 22:45:40 +0200 (CEST)","from mail-ed1-x531.google.com (mail-ed1-x531.google.com\n\t[IPv6:2a00:1450:4864:20::531])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4683768890\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 31 Aug 2021 22:45:39 +0200 (CEST)","by mail-ed1-x531.google.com with SMTP id q17so513968edv.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 31 Aug 2021 13:45:39 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"E7IvgU/X\"; 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=BvC4qnNWhqO7UJdNsxNP96fb2ZlLqWCA9SNiZDhYCqo=;\n\tb=E7IvgU/XjbaRZMgMWEUAkjiM3fXTooriFKLS7ixHVo5Fppdgr/CRnJPEUiCbZ4u7gz\n\tgKJud71a1yZykRhgNPiC65Xleziu2tB/5CzySWQf76m6u4Yub7WIpZZTOD8exGE8qZnq\n\t84Feoz7cXnoR/fHmckRX+e0zsSP3jT3FXBoYE=","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=BvC4qnNWhqO7UJdNsxNP96fb2ZlLqWCA9SNiZDhYCqo=;\n\tb=iA3Myl3GO5Z/+gud61DQMfhMLhQIDAiHZTEsrF2Tmudv7EQe4cXLisUJohAYpOSA9u\n\tA0KN3f5WK9PEnYOBoWeosCT6agAmrircoCgDV2yLipzczB6L9nvOe+a4uvTrJmqk/ncI\n\twtWwMTi63ViizqtiQZsPODhYM4Ea1ePZF7K9+9Ebuij9JQI1A8pLvuPn1k0HG12eRg7W\n\tdOQ94LQqxpOHU7fo6u4P1yDjMm+v5ZxWGX8JURLgv/EBpidNB80wjq8yxcFliGwlYUBE\n\tBKEL/bsTIQtYJm6K6CTOgF5RcX6WmMf3yHD9owyVE4uXZIeN0MawuIOL6f9Z+sWaCSfC\n\tfPnA==","X-Gm-Message-State":"AOAM533w6hjk7LtnlRGeYFKtQNI5kJ3hp7Rj7hLW/rtxisATUlfWgI7w\n\tgmkY9va+4CxZVRgc6V/FVl9VqBUOyPxsw78LnD6steg8hy4=","X-Google-Smtp-Source":"ABdhPJzl4sJzLNO7AMZyZ4Rn1R4fVWP4ONWnh9I8zkaeMg/1g4SKAGos1RyN4bLaZUCtL4E/ZbspNMo9/6HBS0SuEF8=","X-Received":"by 2002:a05:6402:caa:: with SMTP id\n\tcn10mr31314702edb.202.1630442738842; \n\tTue, 31 Aug 2021 13:45:38 -0700 (PDT)","MIME-Version":"1.0","References":"<20210831093439.853586-1-hiroh@chromium.org>\n\t<20210831093439.853586-2-hiroh@chromium.org>\n\t<YS6SAgxavtrpI8Cc@pendragon.ideasonboard.com>","In-Reply-To":"<YS6SAgxavtrpI8Cc@pendragon.ideasonboard.com>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Wed, 1 Sep 2021 05:45:28 +0900","Message-ID":"<CAO5uPHNOAL6gHPDRP1iCzrYGqCQ4oXA2qpFSqHkn9JAcx-vvaw@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v3 1/3] android: camera_stream: Create\n\tpost processor in configure()","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":19313,"web_url":"https://patchwork.libcamera.org/comment/19313/","msgid":"<6ba8e233-730c-2453-4c31-cbe2985294b5@ideasonboard.com>","date":"2021-09-03T06:46:04","subject":"Re: [libcamera-devel] [PATCH v3 1/3] android: camera_stream: Create\n\tpost processor in configure()","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Hiro\n\nOn 8/31/21 3:04 PM, Hirokazu Honda wrote:\n> CameraStream creates PostProcessor and FrameBufferAllocator in\n> the constructor. CameraStream assumes that a used post processor\n> is JPEG post processor. Since we need to support various post\n> processors, we would rather move the creation to configure() so\n> as to return an error code if no proper post processor is found.\n> This also moves FrameBufferAllocator and Mutex creation for\n> consistency.\n>\n> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n> ---\n>   src/android/camera_device.h   |  1 +\n>   src/android/camera_stream.cpp | 36 ++++++++++++++++++-----------------\n>   2 files changed, 20 insertions(+), 17 deletions(-)\n>\n> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> index a5576927..296c2f18 100644\n> --- a/src/android/camera_device.h\n> +++ b/src/android/camera_device.h\n> @@ -48,6 +48,7 @@ public:\n>   \n>   \tunsigned int id() const { return id_; }\n>   \tcamera3_device_t *camera3Device() { return &camera3Device_; }\n> +\tconst CameraCapabilities *capabilities() const { return &capabilities_; }\n>   \tconst std::shared_ptr<libcamera::Camera> &camera() const { return camera_; }\n>   \n>   \tconst std::string &maker() const { return maker_; }\n> diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\n> index 01909ec7..fb10bf06 100644\n> --- a/src/android/camera_stream.cpp\n> +++ b/src/android/camera_stream.cpp\n> @@ -10,6 +10,7 @@\n>   #include <sys/mman.h>\n>   \n>   #include \"camera_buffer.h\"\n> +#include \"camera_capabilities.h\"\n>   #include \"camera_device.h\"\n>   #include \"camera_metadata.h\"\n>   #include \"jpeg/post_processor_jpeg.h\"\n> @@ -47,20 +48,6 @@ CameraStream::CameraStream(CameraDevice *const cameraDevice,\n>   \t: cameraDevice_(cameraDevice), config_(config), type_(type),\n>   \t  camera3Stream_(camera3Stream), index_(index)\n>   {\n> -\tif (type_ == Type::Internal || type_ == Type::Mapped) {\n> -\t\t/*\n> -\t\t * \\todo There might be multiple post-processors. The logic\n> -\t\t * which should be instantiated here, is deferred for the\n> -\t\t * future. For now, we only have PostProcessorJpeg and that\n> -\t\t * is what we instantiate here.\n> -\t\t */\n> -\t\tpostProcessor_ = std::make_unique<PostProcessorJpeg>(cameraDevice_);\n> -\t}\n> -\n> -\tif (type == Type::Internal) {\n> -\t\tallocator_ = std::make_unique<FrameBufferAllocator>(cameraDevice_->camera());\n> -\t\tmutex_ = std::make_unique<std::mutex>();\n> -\t}\n>   }\n>   \n>   const StreamConfiguration &CameraStream::configuration() const\n> @@ -75,15 +62,30 @@ Stream *CameraStream::stream() const\n>   \n>   int CameraStream::configure()\n>   {\n> -\tif (postProcessor_) {\n> +\tif (type_ == Type::Internal || type_ == Type::Mapped) {\n> +\t\tconst PixelFormat outFormat =\n> +\t\t\tcameraDevice_->capabilities()->toPixelFormat(camera3Stream_->format);\n>   \t\tStreamConfiguration output = configuration();\n> -\t\toutput.pixelFormat = formats::MJPEG;\n> +\t\toutput.pixelFormat = outFormat;\n> +\t\tswitch (outFormat) {\n> +\t\tcase formats::MJPEG:\n> +\t\t\tpostProcessor_ = std::make_unique<PostProcessorJpeg>(cameraDevice_);\n> +\t\t\tbreak;\n> +\n> +\t\tdefault:\n> +\t\t\tLOG(HAL, Error) << \"Unsupported format: \" << outFormat;\n> +\t\t\treturn -EINVAL;\n> +\t\t}\n> +\n>   \t\tint ret = postProcessor_->configure(configuration(), output);\n>   \t\tif (ret)\n>   \t\t\treturn ret;\n>   \t}\n>   \n> -\tif (allocator_) {\n> +\tif (type_ == Type::Internal) {\n> +\t\tallocator_ = std::make_unique<FrameBufferAllocator>(cameraDevice_->camera());\n> +\t\tmutex_ = std::make_unique<std::mutex>();\n> +\n>   \t\tint ret = allocator_->allocate(stream());\n>   \t\tif (ret < 0)\n>   \t\t\treturn ret;","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 9BD57BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Sep 2021 06:46:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 007756916B;\n\tFri,  3 Sep 2021 08:46:10 +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 2E5B169166\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Sep 2021 08:46:09 +0200 (CEST)","from [192.168.1.104] (unknown [103.251.226.107])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4C3BCBBE;\n\tFri,  3 Sep 2021 08:46:08 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"AKnbZ9XV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630651568;\n\tbh=hznEgF4YmZlqiJ2aUrB29I+CBcUFe9POcVkc5aDnaAo=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=AKnbZ9XVGMpnxnS66p5+Zbk8zvWrffZMJ8EckeiokRVQPp5SQCdcyX7b7AnyTDH2Z\n\tOVyBb6+ciroP8iSEtZd5hdLxC7lzXuRP9bT6zbZDylZwTYPgu6IjVAZyF9K6/1UEI2\n\tk6S8CA91aKnl/ojLb6wbn4UczFcL4EIRojyYlRvg=","To":"Hirokazu Honda <hiroh@chromium.org>, libcamera-devel@lists.libcamera.org","References":"<20210831093439.853586-1-hiroh@chromium.org>\n\t<20210831093439.853586-2-hiroh@chromium.org>","From":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<6ba8e233-730c-2453-4c31-cbe2985294b5@ideasonboard.com>","Date":"Fri, 3 Sep 2021 12:16:04 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.10.2","MIME-Version":"1.0","In-Reply-To":"<20210831093439.853586-2-hiroh@chromium.org>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH v3 1/3] android: camera_stream: Create\n\tpost processor in configure()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]