{"id":10152,"url":"https://patchwork.libcamera.org/api/1.1/patches/10152/?format=json","web_url":"https://patchwork.libcamera.org/patch/10152/","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":"<20201021013955.301790-2-hiroh@chromium.org>","date":"2020-10-21T01:39:53","name":"[libcamera-devel,v3,2/4] android: Modify Encoder interface","commit_ref":"90c193f2a70093917730b86359c6e459c28d2c24","pull_url":null,"state":"accepted","archived":false,"hash":"aae134d20766e04ce5a5e4246e2a3fd787e7efea","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/10152/mbox/","series":[{"id":1395,"url":"https://patchwork.libcamera.org/api/1.1/series/1395/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1395","date":"2020-10-21T01:39:52","name":"[libcamera-devel,v3,1/4] android: Modify PostProcessor interface","version":3,"mbox":"https://patchwork.libcamera.org/series/1395/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10152/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10152/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 E1851BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 21 Oct 2020 01:40:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AFF1761D92;\n\tWed, 21 Oct 2020 03:40:07 +0200 (CEST)","from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com\n\t[IPv6:2607:f8b0:4864:20::1034])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FE1061D92\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Oct 2020 03:40:06 +0200 (CEST)","by mail-pj1-x1034.google.com with SMTP id az3so304333pjb.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Oct 2020 18:40:06 -0700 (PDT)","from hiroh.tok.corp.google.com\n\t([2401:fa00:8f:2:de4a:3eff:fe7d:f78f])\n\tby smtp.gmail.com with ESMTPSA id\n\tw2sm368066pgi.56.2020.10.20.18.40.02\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 20 Oct 2020 18:40:03 -0700 (PDT)"],"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=\"OrwyHBYn\"; 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=M1L+tvSkqyjLlNPAcNYzSqTS5DAX1JMc6YHt5RfYHCY=;\n\tb=OrwyHBYnJCBESzcsYtEkbJEl2aWDZ5LpTI/bKsslVNoUcN+234dZRL3FzUQ7Bw2x/U\n\tZ6cigpPY8YQC4AtUYm1V0gf6nhGL4mJJKBO+Ax0hNTZKw0GO8zv0PdIX0z8vPfaCRrdR\n\te+81ucrhPu6akDiOTsRqysjakEfWTFVq8fMk8=","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=M1L+tvSkqyjLlNPAcNYzSqTS5DAX1JMc6YHt5RfYHCY=;\n\tb=liqv1LPLWr9UG0NjrulkYxjDhxgtMGnKVvgfLJyEX4Zo+FPXeNUdFqhkfK2dTzG/11\n\tIyzD226BIb3gqUwnOhQEjRLnxL3FFyTBshkGF7jC9p/ysn1VOqOtjW8Oat8Sy9WD2xo9\n\thdkzERAlJVbCWG/ELvUr1xH4MnoRVfCCo26uF123tAHqMEvGX8eusSKsZ9mCgCAZFhju\n\t7epzrsBG3ei8AJDZdvuN9BOhdlH6Iq1hG5iPk9A1jeI+Sf6ADcE4+7JdfUilwLswe3QT\n\t1fGcECn+gsqwacfWIF0ObvzlWyXeytm8uHGU/ZnOAeQSwVPuKNMKiwk1ciq3l2zoI0z6\n\tWPqg==","X-Gm-Message-State":"AOAM531k9fIlYtbH7VJM7TfY5ReBZ3fWANON4yIdCKfTMXu90qPDTsYX\n\tS3ZMEvwnYwqyjmvcZNr8G1tTYcQ5g+WGZA==","X-Google-Smtp-Source":"ABdhPJw1/sWy5AvR9Wt/gbQoKIMFIKt915cWIjc9uPM65Mx3l0cIugwiiC2ZyTL4zCt5cyQmMKI9+A==","X-Received":"by 2002:a17:90a:c982:: with SMTP id\n\tw2mr783014pjt.205.1603244404580; \n\tTue, 20 Oct 2020 18:40:04 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 21 Oct 2020 10:39:53 +0900","Message-Id":"<20201021013955.301790-2-hiroh@chromium.org>","X-Mailer":"git-send-email 2.29.0.rc1.297.gfa9743e501-goog","In-Reply-To":"<20201021013955.301790-1-hiroh@chromium.org>","References":"<20201021013955.301790-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 2/4] android: Modify Encoder interface","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":"In Encoder::encode(), the |source| argument doesn't have to be a\npointer. This replaces its type, const pointer, with const\nreference as the latter is preferred to the former.\nlibcamera::Span is cheap to construct/copy/move. We should deal\nwith the type as pass-by-value parameter. Therefore this also\ndrops the const reference in the |destination| argument.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Umang Jain <email@uajain.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/jpeg/encoder.h               | 4 ++--\n src/android/jpeg/encoder_libjpeg.cpp     | 6 +++---\n src/android/jpeg/encoder_libjpeg.h       | 4 ++--\n src/android/jpeg/post_processor_jpeg.cpp | 2 +-\n 4 files changed, 8 insertions(+), 8 deletions(-)","diff":"diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h\nindex 4e85996..270ea60 100644\n--- a/src/android/jpeg/encoder.h\n+++ b/src/android/jpeg/encoder.h\n@@ -17,8 +17,8 @@ public:\n \tvirtual ~Encoder() {}\n \n \tvirtual int configure(const libcamera::StreamConfiguration &cfg) = 0;\n-\tvirtual int encode(const libcamera::FrameBuffer *source,\n-\t\t\t   const libcamera::Span<uint8_t> &destination,\n+\tvirtual int encode(const libcamera::FrameBuffer &source,\n+\t\t\t   libcamera::Span<uint8_t> destination,\n \t\t\t   const libcamera::Span<const uint8_t> &exifData) = 0;\n };\n \ndiff --git a/src/android/jpeg/encoder_libjpeg.cpp b/src/android/jpeg/encoder_libjpeg.cpp\nindex f11e004..5a2f88f 100644\n--- a/src/android/jpeg/encoder_libjpeg.cpp\n+++ b/src/android/jpeg/encoder_libjpeg.cpp\n@@ -179,11 +179,11 @@ void EncoderLibJpeg::compressNV(const libcamera::MappedBuffer *frame)\n \t}\n }\n \n-int EncoderLibJpeg::encode(const FrameBuffer *source,\n-\t\t\t   const libcamera::Span<uint8_t> &dest,\n+int EncoderLibJpeg::encode(const FrameBuffer &source,\n+\t\t\t   libcamera::Span<uint8_t> dest,\n \t\t\t   const libcamera::Span<const uint8_t> &exifData)\n {\n-\tMappedFrameBuffer frame(source, PROT_READ);\n+\tMappedFrameBuffer frame(&source, PROT_READ);\n \tif (!frame.isValid()) {\n \t\tLOG(JPEG, Error) << \"Failed to map FrameBuffer : \"\n \t\t\t\t << strerror(frame.error());\ndiff --git a/src/android/jpeg/encoder_libjpeg.h b/src/android/jpeg/encoder_libjpeg.h\nindex 934caef..391a53c 100644\n--- a/src/android/jpeg/encoder_libjpeg.h\n+++ b/src/android/jpeg/encoder_libjpeg.h\n@@ -21,8 +21,8 @@ public:\n \t~EncoderLibJpeg();\n \n \tint configure(const libcamera::StreamConfiguration &cfg) override;\n-\tint encode(const libcamera::FrameBuffer *source,\n-\t\t   const libcamera::Span<uint8_t> &destination,\n+\tint encode(const libcamera::FrameBuffer &source,\n+\t\t   libcamera::Span<uint8_t> destination,\n \t\t   const libcamera::Span<const uint8_t> &exifData) override;\n \n private:\ndiff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp\nindex 90bf10d..8b01bd6 100644\n--- a/src/android/jpeg/post_processor_jpeg.cpp\n+++ b/src/android/jpeg/post_processor_jpeg.cpp\n@@ -67,7 +67,7 @@ int PostProcessorJpeg::process(const libcamera::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, exif.data());\n \tif (jpeg_size < 0) {\n \t\tLOG(JPEG, Error) << \"Failed to encode stream image\";\n \t\treturn jpeg_size;\n","prefixes":["libcamera-devel","v3","2/4"]}