{"id":11034,"url":"https://patchwork.libcamera.org/api/patches/11034/?format=json","web_url":"https://patchwork.libcamera.org/patch/11034/","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":"<20210128011351.2495050-1-hiroh@chromium.org>","date":"2021-01-28T01:13:49","name":"[libcamera-devel,v3,1/2] android: post_processor: Change the type destination in process()","commit_ref":null,"pull_url":null,"state":"superseded","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/11034/mbox/","series":[{"id":1617,"url":"https://patchwork.libcamera.org/api/series/1617/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1617","date":"2021-01-28T01:13:49","name":"[libcamera-devel,v3,1/2] android: post_processor: Change the type destination in process()","version":3,"mbox":"https://patchwork.libcamera.org/series/1617/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11034/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11034/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 19304BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 28 Jan 2021 01:14:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 91A7368374;\n\tThu, 28 Jan 2021 02:14:00 +0100 (CET)","from mail-pl1-x629.google.com (mail-pl1-x629.google.com\n\t[IPv6:2607:f8b0:4864:20::629])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9A4AA60308\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 28 Jan 2021 02:13:59 +0100 (CET)","by mail-pl1-x629.google.com with SMTP id s15so2381227plr.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Jan 2021 17:13:59 -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\tbr21sm3331103pjb.9.2021.01.27.17.13.55\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 27 Jan 2021 17:13:56 -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=\"aKi7Owpo\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=LV90NSM8M8tB06QknQg/zmzlmudY4l+0sEattC6Jz0U=;\n\tb=aKi7Owpoj6dtN6vMMq0OuoWqYXbrQMNeO3qzE/e5pOxn2pMxPP1CILOnXXMeUenoYI\n\tzvTEW3V6yE7zh4m+l+/MvQ+CcmMnR5uThe+CbLApBz0zRYPyjcv3h86HNqkiHSu38Zlj\n\tIO8RavCwGr/ROPrZwbDvtkaKHIfXHiRNM7B6c=","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:mime-version\n\t:content-transfer-encoding;\n\tbh=LV90NSM8M8tB06QknQg/zmzlmudY4l+0sEattC6Jz0U=;\n\tb=aLEzhbscv5O7Kf0rSb37tc1+mSSMWjzRTO1CLl+pDUc30x5BJTCYNi4gyVBQka+gqd\n\tsaWmY3jUrDaHyNYZ3R4nhR8+rFq2MJ2JgoEI2h3/cmCL6iW/45ihlCn4/pYhYHw2/qVZ\n\tUFRGU4znAURVeQQRbPhfqejypit0xdxRND+4iUb5bjzmiHVj4o/tziTSE8VZqgzaTFh3\n\tatP1aTWITJXG/9obxnMNT7V6Avn66y5RnYesgvLKiqPHzJ7POf2msRnGYhUt0srqPnpK\n\tDXNRaG4OW17TH+UesaQdQGOWPoGtvZcOE66SSjpmnLL+kjGB1rWhapddIvjk+W1aDoDM\n\tL0pQ==","X-Gm-Message-State":"AOAM532Y0mkayjXIjUJwWaJKUH25KTuWVTdrmdlh09Ry+Cd64tEhHrKI\n\tjJRD3Qp3BLXhRaPf8OZmpPePWpekRQVsASxO","X-Google-Smtp-Source":"ABdhPJy2Fj+Vlq1mvna12G9beYtti6ylEAD8JvLVNzqF0JmvmkwR9xp8cRB3WjUAUr7c0/uBzy2UUg==","X-Received":"by 2002:a17:90a:760b:: with SMTP id\n\ts11mr8389533pjk.187.1611796437298; \n\tWed, 27 Jan 2021 17:13:57 -0800 (PST)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 28 Jan 2021 01:13:49 +0000","Message-Id":"<20210128011351.2495050-1-hiroh@chromium.org>","X-Mailer":"git-send-email 2.30.0.280.ga3ce27912f-goog","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 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.280.ga3ce27912f-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"]}