{"id":13751,"url":"https://patchwork.libcamera.org/api/1.1/patches/13751/?format=json","web_url":"https://patchwork.libcamera.org/patch/13751/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20210907195704.338079-3-umang.jain@ideasonboard.com>","date":"2021-09-07T19:57:00","name":"[libcamera-devel,v1,2/6] 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/1.1/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":{"id":12,"url":"https://patchwork.libcamera.org/api/1.1/users/12/?format=json","username":"uajain","first_name":"Umang","last_name":"Jain","email":"umang.jain@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/13751/mbox/","series":[{"id":2493,"url":"https://patchwork.libcamera.org/api/1.1/series/2493/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2493","date":"2021-09-07T19:56:58","name":"Async post-processor","version":1,"mbox":"https://patchwork.libcamera.org/series/2493/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13751/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13751/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 57FC4BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Sep 2021 19:57:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 21A6769173;\n\tTue,  7 Sep 2021 21:57:23 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F336F69173\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Sep 2021 21:57:21 +0200 (CEST)","from perceval.ideasonboard.com (unknown [103.251.226.2])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CD149499;\n\tTue,  7 Sep 2021 21:57:20 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"kfzRWD5+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1631044641;\n\tbh=3BplGfXY1FTGqvHh7eVzwe/p1KioPek2cTP9UzC7uEE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=kfzRWD5+8wGYlM3Fxeb7zE0pO6usdYJ45rVWKp+Ld+1FgF/h9ii4z1DC3PR47ivWg\n\t6yocLjccXhAtba+4H1Qavkw6596rnp2Y6tA7kKyruv0TBApNqiM+TNcta+AARNbzt1\n\t8gh6k68NCYIZcCOesvm49QWC4S9CIKO7rReDlchg=","From":"Umang Jain <umang.jain@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  8 Sep 2021 01:27:00 +0530","Message-Id":"<20210907195704.338079-3-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210907195704.338079-1-umang.jain@ideasonboard.com>","References":"<20210907195704.338079-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v1 2/6] android: post_processor: Notify\n\tpost 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":"We should be able to know if post-processing has been 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. The signal will be required\nwhen the post-processor is meant to run asynchronously (in subsequent\ncommits).\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 fe41207a..69f3c5dd 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 0a874886..d1db9216 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","v1","2/6"]}