{"id":11046,"url":"https://patchwork.libcamera.org/api/patches/11046/?format=json","web_url":"https://patchwork.libcamera.org/patch/11046/","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":"<20210128224217.2919790-2-hiroh@chromium.org>","date":"2021-01-28T22:42:15","name":"[libcamera-devel,v3,1/2] android: post_processor: Change the type destination in process()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"f09422478fa9e925210039af35479d48041c006f","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11046/mbox/","series":[{"id":1622,"url":"https://patchwork.libcamera.org/api/series/1622/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1622","date":"2021-01-28T22:42:14","name":"Introduce post processor using libyuv","version":3,"mbox":"https://patchwork.libcamera.org/series/1622/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11046/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11046/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 6605DBD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 28 Jan 2021 22:42:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 34B4768397;\n\tThu, 28 Jan 2021 23:42:28 +0100 (CET)","from mail-pg1-x529.google.com (mail-pg1-x529.google.com\n\t[IPv6:2607:f8b0:4864:20::529])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2207F68392\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Jan 2021 23:42:26 +0100 (CET)","by mail-pg1-x529.google.com with SMTP id z21so5289317pgj.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Jan 2021 14:42:26 -0800 (PST)","from hiroh.c.googlers.com.com\n\t(128.141.236.35.bc.googleusercontent.com. [35.236.141.128])\n\tby smtp.gmail.com with ESMTPSA id\n\tmd7sm5866288pjb.52.2021.01.28.14.42.22\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 28 Jan 2021 14:42:23 -0800 (PST)"],"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=\"aDhr12tb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=870VFbxCNzznAQu57QWTH6FxCHRak+Ro7c8lj5zTWrU=;\n\tb=aDhr12tbhGSPaknqAX0tv9Pkgbz67I9n6OUYjleW7NCC5ZM0KVXXs5flFWqPL3NprJ\n\txCi/veDrWlHg+bzUzp0BkNgaLHYuZ+4/iyouLAkO4y9Ne85vYKsgAXFgM6KvNk4MNBuT\n\trHdOi6V56yP9uKRDTNjAhaZSnJ6PNSgaVn97w=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=870VFbxCNzznAQu57QWTH6FxCHRak+Ro7c8lj5zTWrU=;\n\tb=B6EezuAhZmx8FVZzXpnLaPJJyoJJgFKMyDw4pAIdX1GIW+9ep3G6udoPph90I7FWDI\n\tiT+RVK/gthv7fOKh331OUDCxUIEwf5G1zuuEDg3+zJi7WL+ZTIRi5BbL2A9WDyX4M8ur\n\tY6WVrSxm1IWt7Icz3T+18Bp9qtKdPbL72PIs+Z3WsjVun2CkIXWizvrVrJI3vXpIt1nE\n\tlonVEVH0kXDW0ZykDXnL1TSmQ5Ij8RWCO0d32QhdAWDppi9ltz5dHMBM3+TATHnLRJ4j\n\tSaFR4TYDxzplRHwK5v6hu1HnpGHrUrYeSPA0M+3Ouj5W+Uy+rEjbrwcHJQWgfKZ3TIJd\n\tNx8A==","X-Gm-Message-State":"AOAM531O39Bzl+4jkWG1mgHrNwvpCxcIAeAXqTzHIxyXn7o8l/Qm95+j\n\tt0Fed+jph6RYn3LF7yqRtsyCkML7LIwr/0My","X-Google-Smtp-Source":"ABdhPJz9l9VlqCwjAR2HZENeAtS4gWXtEdDU+UCxFuSx85a6c0TVni7zOvgbMnQOHZn+SQoof/Ez1A==","X-Received":"by 2002:a63:3303:: with SMTP id z3mr1586846pgz.302.1611873744541;\n\tThu, 28 Jan 2021 14:42:24 -0800 (PST)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 28 Jan 2021 22:42:15 +0000","Message-Id":"<20210128224217.2919790-2-hiroh@chromium.org>","X-Mailer":"git-send-email 2.30.0.365.g02bc693789-goog","In-Reply-To":"<20210128224217.2919790-1-hiroh@chromium.org>","References":"<20210128224217.2919790-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 1/2] android: post_processor: Change\n\tthe type destination in process()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-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>"},"content":"The type of the destination buffer in PostProcessor::process() is\nlibcamera::Span. libcamera::Span is used for one dimension buffer\n(e.g. blob buffer). The destination can be multiple dimensions\nbuffer (e.g. yuv frame). Therefore, this changes the type of the\ndestination buffer to MappedFrameBuffer.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\n src/android/camera_stream.cpp            | 4 ++--\n src/android/camera_stream.h              | 6 ++++--\n src/android/jpeg/post_processor_jpeg.cpp | 6 +++---\n src/android/jpeg/post_processor_jpeg.h   | 2 +-\n src/android/post_processor.h             | 7 ++++---\n 5 files changed, 14 insertions(+), 11 deletions(-)\n\n--\n2.30.0.365.g02bc693789-goog","diff":"diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\nindex 4c8020e5..611ec0d1 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -96,14 +96,14 @@ int CameraStream::configure()\n }\n\n int CameraStream::process(const libcamera::FrameBuffer &source,\n-\t\t\t  MappedCamera3Buffer *dest,\n+\t\t\t  libcamera::MappedBuffer *destination,\n \t\t\t  const CameraMetadata &requestMetadata,\n \t\t\t  CameraMetadata *resultMetadata)\n {\n \tif (!postProcessor_)\n \t\treturn 0;\n\n-\treturn postProcessor_->process(source, dest->maps()[0],\n+\treturn postProcessor_->process(source, destination,\n \t\t\t\t       requestMetadata, resultMetadata);\n }\n\ndiff --git a/src/android/camera_stream.h b/src/android/camera_stream.h\nindex 298ffbf6..73bac0ba 100644\n--- a/src/android/camera_stream.h\n+++ b/src/android/camera_stream.h\n@@ -19,9 +19,10 @@\n #include <libcamera/geometry.h>\n #include <libcamera/pixel_format.h>\n\n+#include <libcamera/internal/buffer.h>\n+\n class CameraDevice;\n class CameraMetadata;\n-class MappedCamera3Buffer;\n class PostProcessor;\n\n class CameraStream\n@@ -119,9 +120,10 @@ public:\n\n \tint configure();\n \tint process(const libcamera::FrameBuffer &source,\n-\t\t    MappedCamera3Buffer *dest,\n+\t\t    libcamera::MappedBuffer *destination,\n \t\t    const CameraMetadata &requestMetadata,\n \t\t    CameraMetadata *resultMetadata);\n+\n \tlibcamera::FrameBuffer *getBuffer();\n \tvoid putBuffer(libcamera::FrameBuffer *buffer);\n\ndiff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp\nindex cac0087b..74e81c6f 100644\n--- a/src/android/jpeg/post_processor_jpeg.cpp\n+++ b/src/android/jpeg/post_processor_jpeg.cpp\n@@ -83,7 +83,7 @@ void PostProcessorJpeg::generateThumbnail(const FrameBuffer &source,\n }\n\n int PostProcessorJpeg::process(const FrameBuffer &source,\n-\t\t\t       Span<uint8_t> destination,\n+\t\t\t       libcamera::MappedBuffer *destination,\n \t\t\t       const CameraMetadata &requestMetadata,\n \t\t\t       CameraMetadata *resultMetadata)\n {\n@@ -171,8 +171,8 @@ int PostProcessorJpeg::process(const FrameBuffer &source,\n \tret = requestMetadata.getEntry(ANDROID_JPEG_QUALITY, &entry);\n \tconst uint8_t quality = ret ? *entry.data.u8 : 95;\n \tresultMetadata->addEntry(ANDROID_JPEG_QUALITY, &quality, 1);\n+\tint jpeg_size = encoder_->encode(source, destination->maps()[0], exif.data(), quality);\n\n-\tint jpeg_size = encoder_->encode(source, destination, exif.data(), quality);\n \tif (jpeg_size < 0) {\n \t\tLOG(JPEG, Error) << \"Failed to encode stream image\";\n \t\treturn jpeg_size;\n@@ -190,7 +190,7 @@ int PostProcessorJpeg::process(const FrameBuffer &source,\n \t * \\todo Investigate if the buffer size mismatch is an issue or\n \t * expected behaviour.\n \t */\n-\tuint8_t *resultPtr = destination.data() +\n+\tuint8_t *resultPtr = destination->maps()[0].data() +\n \t\t\t     cameraDevice_->maxJpegBufferSize() -\n \t\t\t     sizeof(struct camera3_jpeg_blob);\n \tauto *blob = reinterpret_cast<struct camera3_jpeg_blob *>(resultPtr);\ndiff --git a/src/android/jpeg/post_processor_jpeg.h b/src/android/jpeg/post_processor_jpeg.h\nindex d2dfa450..7689de73 100644\n--- a/src/android/jpeg/post_processor_jpeg.h\n+++ b/src/android/jpeg/post_processor_jpeg.h\n@@ -25,7 +25,7 @@ public:\n \tint configure(const libcamera::StreamConfiguration &incfg,\n \t\t      const libcamera::StreamConfiguration &outcfg) override;\n \tint process(const libcamera::FrameBuffer &source,\n-\t\t    libcamera::Span<uint8_t> destination,\n+\t\t    libcamera::MappedBuffer *destination,\n \t\t    const CameraMetadata &requestMetadata,\n \t\t    CameraMetadata *resultMetadata) override;\n\ndiff --git a/src/android/post_processor.h b/src/android/post_processor.h\nindex bda93bb4..f5c99f03 100644\n--- a/src/android/post_processor.h\n+++ b/src/android/post_processor.h\n@@ -8,9 +8,10 @@\n #define __ANDROID_POST_PROCESSOR_H__\n\n #include <libcamera/buffer.h>\n-#include <libcamera/span.h>\n #include <libcamera/stream.h>\n\n+#include <libcamera/internal/buffer.h>\n+\n class CameraMetadata;\n\n class PostProcessor\n@@ -21,9 +22,9 @@ public:\n \tvirtual int configure(const libcamera::StreamConfiguration &inCfg,\n \t\t\t      const libcamera::StreamConfiguration &outCfg) = 0;\n \tvirtual int process(const libcamera::FrameBuffer &source,\n-\t\t\t    libcamera::Span<uint8_t> destination,\n+\t\t\t    libcamera::MappedBuffer *destination,\n \t\t\t    const CameraMetadata &requestMetadata,\n-\t\t\t    CameraMetadata *resultMetadata) = 0;\n+\t\t\t    CameraMetadata *metadata) = 0;\n };\n\n #endif /* __ANDROID_POST_PROCESSOR_H__ */\n","prefixes":["libcamera-devel","v3","1/2"]}