{"id":13613,"url":"https://patchwork.libcamera.org/api/patches/13613/?format=json","web_url":"https://patchwork.libcamera.org/patch/13613/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210902213128.1064018-3-umang.jain@ideasonboard.com>","date":"2021-09-02T21:31:25","name":"[libcamera-devel,RFC,v2,2/5] android: post_processor: Notify post processing completion status","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"7376f13427f0d47698bc2f0544af469f68f1c451","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":{"id":12,"url":"https://patchwork.libcamera.org/api/users/12/?format=json","username":"uajain","first_name":"Umang","last_name":"Jain","email":"umang.jain@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/13613/mbox/","series":[{"id":2443,"url":"https://patchwork.libcamera.org/api/series/2443/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2443","date":"2021-09-02T21:31:23","name":"Async PostProcessor","version":2,"mbox":"https://patchwork.libcamera.org/series/2443/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13613/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13613/checks/","tags":{},"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 6F45CC3241\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Sep 2021 21:31:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1C27F69169;\n\tThu,  2 Sep 2021 23:31:41 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5A51D69166\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Sep 2021 23:31:40 +0200 (CEST)","from perceval.ideasonboard.com (unknown [103.251.226.107])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 468BB45E;\n\tThu,  2 Sep 2021 23:31:39 +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=\"cHXsgVrh\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630618300;\n\tbh=yjLVUsdzUMZZIRV8/jXqXqXP9AC7Zl+AvZgOZ/iWMsk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=cHXsgVrh+8rRPtR6Kh8qjBpyxn5xjuW2N4pg9O7/o6t7Qw5KokvWxoF1PmKZ50gVR\n\tKiJgGuhCw3LBZZRwXtVXG2x0HlUAk5f1qAyYZT6ijTLjs+6pfERn8yA/435XTp02jK\n\t0upKjxzPiGZvLnULtS+VIehbHCAwHeebr5u9LEtQ=","From":"Umang Jain <umang.jain@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  3 Sep 2021 03:01:25 +0530","Message-Id":"<20210902213128.1064018-3-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210902213128.1064018-1-umang.jain@ideasonboard.com>","References":"<20210902213128.1064018-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH v2 2/5] android: post_processor:\n\tNotify post processing completion status","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>"},"content":"When a post-processor is running asynchronously, we should be able to\nknow whether the post-processing operation on the stream has been\ncompleted or not. Secondly, we should be able to know if it completed\nsuccessfully or encountered some errors. This commit introduces a\nSignal<> which when connected, will notify that the post-processing\nhas been completed. The status of PostProcessor::process() will be\npassed as a PostProcessor::Status argument.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/android/jpeg/post_processor_jpeg.cpp | 7 ++++++-\n src/android/post_processor.h             | 8 ++++++++\n src/android/yuv/post_processor_yuv.cpp   | 4 ++++\n 3 files changed, 18 insertions(+), 1 deletion(-)","diff":"diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp\nindex 723e8d18..906bd40b 100644\n--- a/src/android/jpeg/post_processor_jpeg.cpp\n+++ b/src/android/jpeg/post_processor_jpeg.cpp\n@@ -87,8 +87,10 @@ int PostProcessorJpeg::process(const FrameBuffer *source,\n \t\t\t       const CameraMetadata &requestMetadata,\n \t\t\t       CameraMetadata *resultMetadata)\n {\n-\tif (!encoder_)\n+\tif (!encoder_) {\n+\t\tprocessComplete.emit(PostProcessor::Status::Failed);\n \t\treturn 0;\n+\t}\n \n \tASSERT(destination->numPlanes() == 1);\n \n@@ -181,6 +183,7 @@ int PostProcessorJpeg::process(const FrameBuffer *source,\n \t\t\t\t\t exif.data(), quality);\n \tif (jpeg_size < 0) {\n \t\tLOG(JPEG, Error) << \"Failed to encode stream image\";\n+\t\tprocessComplete.emit(PostProcessor::Status::Failed);\n \t\treturn jpeg_size;\n \t}\n \n@@ -195,5 +198,7 @@ int PostProcessorJpeg::process(const FrameBuffer *source,\n \t/* Update the JPEG result Metadata. */\n \tresultMetadata->addEntry(ANDROID_JPEG_SIZE, jpeg_size);\n \n+\tprocessComplete.emit(PostProcessor::Status::Success);\n+\n \treturn 0;\n }\ndiff --git a/src/android/post_processor.h b/src/android/post_processor.h\nindex 61dfb6d4..edf1a4bf 100644\n--- a/src/android/post_processor.h\n+++ b/src/android/post_processor.h\n@@ -7,6 +7,8 @@\n #ifndef __ANDROID_POST_PROCESSOR_H__\n #define __ANDROID_POST_PROCESSOR_H__\n \n+#include <libcamera/base/signal.h>\n+\n #include <libcamera/framebuffer.h>\n #include <libcamera/stream.h>\n \n@@ -25,6 +27,12 @@ public:\n \t\t\t    CameraBuffer *destination,\n \t\t\t    const CameraMetadata &requestMetadata,\n \t\t\t    CameraMetadata *resultMetadata) = 0;\n+\n+\tenum Status {\n+\t\tSuccess,\n+\t\tFailed,\n+\t};\n+\tlibcamera::Signal<Status> processComplete;\n };\n \n #endif /* __ANDROID_POST_PROCESSOR_H__ */\ndiff --git a/src/android/yuv/post_processor_yuv.cpp b/src/android/yuv/post_processor_yuv.cpp\nindex 4f5f3f40..6c445726 100644\n--- a/src/android/yuv/post_processor_yuv.cpp\n+++ b/src/android/yuv/post_processor_yuv.cpp\n@@ -60,6 +60,7 @@ int PostProcessorYuv::process(const FrameBuffer *source,\n \tconst MappedFrameBuffer sourceMapped(source, MappedFrameBuffer::MapFlag::Read);\n \tif (!sourceMapped.isValid()) {\n \t\tLOG(YUV, Error) << \"Failed to mmap camera frame buffer\";\n+\t\tprocessComplete.emit(PostProcessor::Status::Failed);\n \t\treturn -EINVAL;\n \t}\n \n@@ -77,9 +78,12 @@ int PostProcessorYuv::process(const FrameBuffer *source,\n \t\t\t\t    libyuv::FilterMode::kFilterBilinear);\n \tif (ret) {\n \t\tLOG(YUV, Error) << \"Failed NV12 scaling: \" << ret;\n+\t\tprocessComplete.emit(PostProcessor::Status::Failed);\n \t\treturn -EINVAL;\n \t}\n \n+\tprocessComplete.emit(PostProcessor::Status::Success);\n+\n \treturn 0;\n }\n \n","prefixes":["libcamera-devel","RFC","v2","2/5"]}