{"id":10942,"url":"https://patchwork.libcamera.org/api/1.1/patches/10942/?format=json","web_url":"https://patchwork.libcamera.org/patch/10942/","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":"<20210122092335.254626-1-hiroh@chromium.org>","date":"2021-01-22T09:23:34","name":"[libcamera-devel,1/2] android: post_processor: Change the type destination in process()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"b9cb9c3ffd5379a9a8c613b6660d7eb36cc63f9e","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/1.1/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10942/mbox/","series":[{"id":1595,"url":"https://patchwork.libcamera.org/api/1.1/series/1595/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1595","date":"2021-01-22T09:23:34","name":"[libcamera-devel,1/2] android: post_processor: Change the type destination in process()","version":1,"mbox":"https://patchwork.libcamera.org/series/1595/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10942/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10942/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 A278ABD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Jan 2021 09:23:45 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1C29B6822F;\n\tFri, 22 Jan 2021 10:23:45 +0100 (CET)","from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com\n\t[IPv6:2607:f8b0:4864:20::102a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A96D6681DF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jan 2021 10:23:43 +0100 (CET)","by mail-pj1-x102a.google.com with SMTP id e6so3377431pjj.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jan 2021 01:23:43 -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\tmv17sm8466031pjb.17.2021.01.22.01.23.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 22 Jan 2021 01:23:40 -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=\"NN5F7kWp\"; 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=jUbURkHoqZRN4MBSE8Edz5lGPkBFHeRc3jP1R9FJXS0=;\n\tb=NN5F7kWpbm7muYCgyzMVAGg09Qz1sRWYvz1EH24TlCeLQsR+TW6T0AM3Y6b/rRJEP1\n\tPIm62kUjcJIIZ6MYHKflLlijguGjczC0fL1Q1EtRXA90ImvBEQb8oaHopsnnCHbD8YUc\n\tXZDxtHQFFwfKubktMCJSDGHZFDrzIWQHM4nQM=","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=jUbURkHoqZRN4MBSE8Edz5lGPkBFHeRc3jP1R9FJXS0=;\n\tb=AvDr9XTLeujF5PaCBOIZOjWgHtVOBqCnvZhsKpivqlCyj/rD/Qri35ux2d51BZwJJS\n\tDNARmMWTgBUFi2V0xlsSGaOPaNBYKv0NmDV6HMZLKLe1Sd3NwIqbeOh02xF58RwMTf5U\n\tsDLg7WuJYunteChgNmKUQdzuXpcBpwjhepbJqcaGwMk33CBKDlTAAFrWr/deWjrZHjH6\n\tzRfG5/3CGe2ry5M2tIcoQCLC876rKB2QxMPqwaDqZ7l4xr9DYY6Q0wBSWqPFvie5SwkZ\n\tYtkfX3gXltRPtwhRm05Gk2YdibYR+WUUAv5owa8hT1DSW6YmUp27dKF4GJGFNvXdQfpC\n\tThOA==","X-Gm-Message-State":"AOAM533BGGjqUYmIJszjon1CGs1gs0e8/GhYCTH6WCZkeit579Gl6y5f\n\tbsDJjJZfnwldGioZwQn10y+j1nPpzQ5eEA==","X-Google-Smtp-Source":"ABdhPJxc/lSQEq5f+e0gRyhPeGlqStqW3oanoKMivaVP2PnMJ+pDlG7b2svyNw3PIdqJuR+Eb1Javg==","X-Received":"by 2002:a17:90b:1b50:: with SMTP id\n\tnv16mr4105789pjb.153.1611307421834; \n\tFri, 22 Jan 2021 01:23:41 -0800 (PST)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 22 Jan 2021 09:23:34 +0000","Message-Id":"<20210122092335.254626-1-hiroh@chromium.org>","X-Mailer":"git-send-email 2.30.0.280.ga3ce27912f-goog","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 1/2] android: post_processor: Change the\n\ttype 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>\n---\n src/android/camera_stream.cpp            | 5 +++--\n src/android/camera_stream.h              | 5 +++--\n src/android/jpeg/post_processor_jpeg.cpp | 7 ++++---\n src/android/jpeg/post_processor_jpeg.h   | 2 +-\n src/android/post_processor.h             | 3 ++-\n 5 files changed, 13 insertions(+), 9 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 dba351a4..33d0e005 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -96,12 +96,13 @@ int CameraStream::configure()\n }\n\n int CameraStream::process(const libcamera::FrameBuffer &source,\n-\t\t\t  MappedCamera3Buffer *dest, CameraMetadata *metadata)\n+\t\t\t  libcamera::MappedBuffer *destination,\n+\t\t\t  CameraMetadata *metadata)\n {\n \tif (!postProcessor_)\n \t\treturn 0;\n\n-\treturn postProcessor_->process(source, dest->maps()[0], metadata);\n+\treturn postProcessor_->process(source, destination, metadata);\n }\n\n FrameBuffer *CameraStream::getBuffer()\ndiff --git a/src/android/camera_stream.h b/src/android/camera_stream.h\nindex cc9d5470..7d7b2b16 100644\n--- a/src/android/camera_stream.h\n+++ b/src/android/camera_stream.h\n@@ -17,11 +17,11 @@\n #include <libcamera/camera.h>\n #include <libcamera/framebuffer_allocator.h>\n #include <libcamera/geometry.h>\n+#include <libcamera/internal/buffer.h>\n #include <libcamera/pixel_format.h>\n\n class CameraDevice;\n class CameraMetadata;\n-class MappedCamera3Buffer;\n class PostProcessor;\n\n class CameraStream\n@@ -119,7 +119,8 @@ public:\n\n \tint configure();\n \tint process(const libcamera::FrameBuffer &source,\n-\t\t    MappedCamera3Buffer *dest, CameraMetadata *metadata);\n+\t\t    libcamera::MappedBuffer *destination,\n+\t\t    CameraMetadata *metadata);\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 436a50f8..2374716d 100644\n--- a/src/android/jpeg/post_processor_jpeg.cpp\n+++ b/src/android/jpeg/post_processor_jpeg.cpp\n@@ -79,7 +79,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       CameraMetadata *metadata)\n {\n \tif (!encoder_)\n@@ -107,7 +107,8 @@ int PostProcessorJpeg::process(const FrameBuffer &source,\n \tif (exif.generate() != 0)\n \t\tLOG(JPEG, Error) << \"Failed to generate valid EXIF data\";\n\n-\tint jpeg_size = encoder_->encode(source, destination, exif.data());\n+\tint jpeg_size = encoder_->encode(source, destination->maps()[0],\n+\t\t\t\t\t exif.data());\n \tif (jpeg_size < 0) {\n \t\tLOG(JPEG, Error) << \"Failed to encode stream image\";\n \t\treturn jpeg_size;\n@@ -125,7 +126,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 5afa831c..68a38410 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    CameraMetadata *metadata) override;\n\n private:\ndiff --git a/src/android/post_processor.h b/src/android/post_processor.h\nindex e0f91880..368e0fe5 100644\n--- a/src/android/post_processor.h\n+++ b/src/android/post_processor.h\n@@ -7,6 +7,7 @@\n #ifndef __ANDROID_POST_PROCESSOR_H__\n #define __ANDROID_POST_PROCESSOR_H__\n\n+#include <libcamera/internal/buffer.h>\n #include <libcamera/buffer.h>\n #include <libcamera/span.h>\n #include <libcamera/stream.h>\n@@ -21,7 +22,7 @@ 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    CameraMetadata *metadata) = 0;\n };\n\n","prefixes":["libcamera-devel","1/2"]}