From patchwork Wed Oct 21 01:39:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 10151 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id C2B89BDB13 for ; Wed, 21 Oct 2020 01:40:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5A48F60350; Wed, 21 Oct 2020 03:40:05 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="VNgDkRxE"; dkim-atps=neutral Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3061D60350 for ; Wed, 21 Oct 2020 03:40:04 +0200 (CEST) Received: by mail-pg1-x52b.google.com with SMTP id x13so462507pgp.7 for ; Tue, 20 Oct 2020 18:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hMwZvuv76r0YbJRKt3pnmTGsLoXKw4TVQfjOvprmc8Q=; b=VNgDkRxEsO9wFePTU18nNyLWlyHa4RkVEfS/WVMx1mUC80ylu5blA0gECM+jzKh2S4 FPz5kyvDbQi27puE41HCfRnh112AWoQh3xacoXAofT9VVwslurjTn4UTSZ4UjpL8/Dmo z/Ud3+JfxCiRIsEzaK0yAtqU7oRCXYNfNOHnk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hMwZvuv76r0YbJRKt3pnmTGsLoXKw4TVQfjOvprmc8Q=; b=Lgl8vb62AgpyEgpNwqqY2nKoiH5K9QjK2jUgz5l+NPgs7RWRG2pXi/SktdWPepw1Zg Iq8WltHtfb/7cRzAQJk6B7DTJ/IxvQHyuXEWwd7+Y/T70El+XK2L8bRpSHKLFVw8d86s v761WhChl3Ylp33AXjRbl848H32zMX7heRloNCemv1FOInQ+YH9lNmYkISb87Qc/l/DF tLO7LON1i3UIMdIys4qiZkk1p7vs4zzHt7Ua45l0srV4WLmNPNzMPOE0EtOBXlX+i+qG gtXz7uh+2vkdesJ1Xut5R3mw5OpFBnZhbqLCVvYEBCNAW/LBNTL8R1YxJKfm9FU/s6sO 7wng== X-Gm-Message-State: AOAM533Gk+k5lXKZihb0BC+tCi2ZsjI+sQ5bFnTCPoy4n/qBC5PpnFZq aNyRbfrnShX4i4cAxz7eKuwh7nbH+h271g== X-Google-Smtp-Source: ABdhPJy2DW4UH2f5pmlopKnMWpOmPAeB201KyxvsKpHbPyj4kFFukzGz3IYWvOUdvYPZt9Tus1xf9w== X-Received: by 2002:a63:cb51:: with SMTP id m17mr948642pgi.337.1603244402155; Tue, 20 Oct 2020 18:40:02 -0700 (PDT) Received: from hiroh.tok.corp.google.com ([2401:fa00:8f:2:de4a:3eff:fe7d:f78f]) by smtp.gmail.com with ESMTPSA id w2sm368066pgi.56.2020.10.20.18.40.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 18:40:01 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 10:39:52 +0900 Message-Id: <20201021013955.301790-1-hiroh@chromium.org> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/4] android: Modify PostProcessor interface X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" In PostProcessor::process(), the |source| argument doesn't have to be a pointer. This replaces its type, const pointer, with const reference as the latter is preferred to the former. libcamera::Span is cheap to construct/copy/move. We should deal with the type as pass-by-value parameter. Therefore this also drops the const reference in the |destination| argument. Signed-off-by: Hirokazu Honda Reviewed-by: Umang Jain Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/android/camera_stream.cpp | 2 +- src/android/jpeg/post_processor_jpeg.cpp | 6 +++--- src/android/jpeg/post_processor_jpeg.h | 4 ++-- src/android/post_processor.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index eae451e..3e5d6be 100644 --- a/src/android/camera_stream.cpp +++ b/src/android/camera_stream.cpp @@ -102,7 +102,7 @@ int CameraStream::process(const libcamera::FrameBuffer &source, if (!postProcessor_) return 0; - return postProcessor_->process(&source, dest->maps()[0], metadata); + return postProcessor_->process(source, dest->maps()[0], metadata); } FrameBuffer *CameraStream::getBuffer() diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp index 9d452b7..90bf10d 100644 --- a/src/android/jpeg/post_processor_jpeg.cpp +++ b/src/android/jpeg/post_processor_jpeg.cpp @@ -44,8 +44,8 @@ int PostProcessorJpeg::configure(const StreamConfiguration &inCfg, return encoder_->configure(inCfg); } -int PostProcessorJpeg::process(const libcamera::FrameBuffer *source, - const libcamera::Span &destination, +int PostProcessorJpeg::process(const libcamera::FrameBuffer &source, + libcamera::Span destination, CameraMetadata *metadata) { if (!encoder_) @@ -67,7 +67,7 @@ int PostProcessorJpeg::process(const libcamera::FrameBuffer *source, if (exif.generate() != 0) LOG(JPEG, Error) << "Failed to generate valid EXIF data"; - int jpeg_size = encoder_->encode(source, destination, exif.data()); + int jpeg_size = encoder_->encode(&source, destination, exif.data()); if (jpeg_size < 0) { LOG(JPEG, Error) << "Failed to encode stream image"; return jpeg_size; diff --git a/src/android/jpeg/post_processor_jpeg.h b/src/android/jpeg/post_processor_jpeg.h index 62c8650..ae636ff 100644 --- a/src/android/jpeg/post_processor_jpeg.h +++ b/src/android/jpeg/post_processor_jpeg.h @@ -23,8 +23,8 @@ public: int configure(const libcamera::StreamConfiguration &incfg, const libcamera::StreamConfiguration &outcfg) override; - int process(const libcamera::FrameBuffer *source, - const libcamera::Span &destination, + int process(const libcamera::FrameBuffer &source, + libcamera::Span destination, CameraMetadata *metadata) override; private: diff --git a/src/android/post_processor.h b/src/android/post_processor.h index a891c43..5f87a5d 100644 --- a/src/android/post_processor.h +++ b/src/android/post_processor.h @@ -20,8 +20,8 @@ public: virtual int configure(const libcamera::StreamConfiguration &inCfg, const libcamera::StreamConfiguration &outCfg) = 0; - virtual int process(const libcamera::FrameBuffer *source, - const libcamera::Span &destination, + virtual int process(const libcamera::FrameBuffer &source, + libcamera::Span destination, CameraMetadata *metadata) = 0; };