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; }; From patchwork Wed Oct 21 01:39:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 10152 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 E1851BDB13 for ; Wed, 21 Oct 2020 01:40:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AFF1761D92; Wed, 21 Oct 2020 03:40:07 +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="OrwyHBYn"; dkim-atps=neutral Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FE1061D92 for ; Wed, 21 Oct 2020 03:40:06 +0200 (CEST) Received: by mail-pj1-x1034.google.com with SMTP id az3so304333pjb.4 for ; Tue, 20 Oct 2020 18:40:06 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=M1L+tvSkqyjLlNPAcNYzSqTS5DAX1JMc6YHt5RfYHCY=; b=OrwyHBYnJCBESzcsYtEkbJEl2aWDZ5LpTI/bKsslVNoUcN+234dZRL3FzUQ7Bw2x/U Z6cigpPY8YQC4AtUYm1V0gf6nhGL4mJJKBO+Ax0hNTZKw0GO8zv0PdIX0z8vPfaCRrdR e+81ucrhPu6akDiOTsRqysjakEfWTFVq8fMk8= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=M1L+tvSkqyjLlNPAcNYzSqTS5DAX1JMc6YHt5RfYHCY=; b=liqv1LPLWr9UG0NjrulkYxjDhxgtMGnKVvgfLJyEX4Zo+FPXeNUdFqhkfK2dTzG/11 IyzD226BIb3gqUwnOhQEjRLnxL3FFyTBshkGF7jC9p/ysn1VOqOtjW8Oat8Sy9WD2xo9 hdkzERAlJVbCWG/ELvUr1xH4MnoRVfCCo26uF123tAHqMEvGX8eusSKsZ9mCgCAZFhju 7epzrsBG3ei8AJDZdvuN9BOhdlH6Iq1hG5iPk9A1jeI+Sf6ADcE4+7JdfUilwLswe3QT 1fGcECn+gsqwacfWIF0ObvzlWyXeytm8uHGU/ZnOAeQSwVPuKNMKiwk1ciq3l2zoI0z6 WPqg== X-Gm-Message-State: AOAM531k9fIlYtbH7VJM7TfY5ReBZ3fWANON4yIdCKfTMXu90qPDTsYX S3ZMEvwnYwqyjmvcZNr8G1tTYcQ5g+WGZA== X-Google-Smtp-Source: ABdhPJw1/sWy5AvR9Wt/gbQoKIMFIKt915cWIjc9uPM65Mx3l0cIugwiiC2ZyTL4zCt5cyQmMKI9+A== X-Received: by 2002:a17:90a:c982:: with SMTP id w2mr783014pjt.205.1603244404580; Tue, 20 Oct 2020 18:40:04 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 18:40:03 -0700 (PDT) From: Hirokazu Honda 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" In Encoder::encode(), 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/jpeg/encoder.h | 4 ++-- src/android/jpeg/encoder_libjpeg.cpp | 6 +++--- src/android/jpeg/encoder_libjpeg.h | 4 ++-- src/android/jpeg/post_processor_jpeg.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h index 4e85996..270ea60 100644 --- a/src/android/jpeg/encoder.h +++ b/src/android/jpeg/encoder.h @@ -17,8 +17,8 @@ public: virtual ~Encoder() {} virtual int configure(const libcamera::StreamConfiguration &cfg) = 0; - virtual int encode(const libcamera::FrameBuffer *source, - const libcamera::Span &destination, + virtual int encode(const libcamera::FrameBuffer &source, + libcamera::Span destination, const libcamera::Span &exifData) = 0; }; diff --git a/src/android/jpeg/encoder_libjpeg.cpp b/src/android/jpeg/encoder_libjpeg.cpp index f11e004..5a2f88f 100644 --- a/src/android/jpeg/encoder_libjpeg.cpp +++ b/src/android/jpeg/encoder_libjpeg.cpp @@ -179,11 +179,11 @@ void EncoderLibJpeg::compressNV(const libcamera::MappedBuffer *frame) } } -int EncoderLibJpeg::encode(const FrameBuffer *source, - const libcamera::Span &dest, +int EncoderLibJpeg::encode(const FrameBuffer &source, + libcamera::Span dest, const libcamera::Span &exifData) { - MappedFrameBuffer frame(source, PROT_READ); + MappedFrameBuffer frame(&source, PROT_READ); if (!frame.isValid()) { LOG(JPEG, Error) << "Failed to map FrameBuffer : " << strerror(frame.error()); diff --git a/src/android/jpeg/encoder_libjpeg.h b/src/android/jpeg/encoder_libjpeg.h index 934caef..391a53c 100644 --- a/src/android/jpeg/encoder_libjpeg.h +++ b/src/android/jpeg/encoder_libjpeg.h @@ -21,8 +21,8 @@ public: ~EncoderLibJpeg(); int configure(const libcamera::StreamConfiguration &cfg) override; - int encode(const libcamera::FrameBuffer *source, - const libcamera::Span &destination, + int encode(const libcamera::FrameBuffer &source, + libcamera::Span destination, const libcamera::Span &exifData) override; private: diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp index 90bf10d..8b01bd6 100644 --- a/src/android/jpeg/post_processor_jpeg.cpp +++ b/src/android/jpeg/post_processor_jpeg.cpp @@ -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; From patchwork Wed Oct 21 01:39:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 10153 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 48854BDB13 for ; Wed, 21 Oct 2020 01:40:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1618361DAB; Wed, 21 Oct 2020 03:40:10 +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="eD962NbE"; dkim-atps=neutral Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 406A761D98 for ; Wed, 21 Oct 2020 03:40:08 +0200 (CEST) Received: by mail-pf1-x42b.google.com with SMTP id c20so502182pfr.8 for ; Tue, 20 Oct 2020 18:40:08 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=B3yYJQA+QTIkRSTx3E4WlxnV44ortnpTrmlhQYrPOwM=; b=eD962NbETmX5QZT0TjOTjbVUm6XoCndAwD6RRc9cXypYYUu2CXRvqynrdLIjbw+0Pg gEkT88JsfZ1sI+fbdseDF/ie/KZ7Y2HtJ7ebfq1NnPyUyG5KV96lwngoKUeCrvXFUf5m RVO5ZbUtG5NCSwa1lZdixRR53sUZdJslCodSE= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=B3yYJQA+QTIkRSTx3E4WlxnV44ortnpTrmlhQYrPOwM=; b=ggnwqxkOMI+PSMH3v0HzI9vhsBWBIxlQPNo6lAOI4/IkaYrJ9dNsOApZmB6p9GuVjg swgOV5FWNSYuoVhGAoKgUULaMOp5+1FqRREhhf1+idER694JrAXE2Mdds7Zx/zVs1xBS JgkkWkm55X531YKy9rxRe5nju+OKp013QEcaoIY4EXbda1nJF/zfqbvxPjYjmhCJbaqL myPfVWY8jyaQGPPpeN/8halcyXbOZfcCw1BQ/H0QfrLPLEFKJPqW0z7AUHY7Pxvq34CS 5V+gP+XA8BGwIBOgR4zjqInEMqEyZygx/2r/d85wfVqEuWYH4lZX2xT6aGOCvcLy300+ Xf6A== X-Gm-Message-State: AOAM532P4IZ98L2/8E2ftoydqfyvn8fl+S48njZH61666l40oRvJz6RV 7qf0cWkiEem2dooWuE5kKrdfgZQ5cSqolw== X-Google-Smtp-Source: ABdhPJxnBU0B5iINwaWlVqSbcECYmLG3t+5XYeJxaGx+6i/xjt73l/IkBrefcGK5X8rAWR+nomKG3A== X-Received: by 2002:a65:63c5:: with SMTP id n5mr968439pgv.437.1603244406728; Tue, 20 Oct 2020 18:40:06 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 18:40:06 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 10:39:54 +0900 Message-Id: <20201021013955.301790-3-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 3/4] android: post_processor_jpeg: Make |cameraDevice_| constant 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" PostProcessorJpeg doesn't have the ownership of CameraDevice given in the constructor. To clarify it, this makes the member variable constant. Signed-off-by: Hirokazu Honda Reviewed-by: Umang Jain Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/android/jpeg/post_processor_jpeg.cpp | 2 +- src/android/jpeg/post_processor_jpeg.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp index 8b01bd6..fd1c7be 100644 --- a/src/android/jpeg/post_processor_jpeg.cpp +++ b/src/android/jpeg/post_processor_jpeg.cpp @@ -20,7 +20,7 @@ using namespace libcamera; LOG_DEFINE_CATEGORY(JPEG) -PostProcessorJpeg::PostProcessorJpeg(CameraDevice *device) +PostProcessorJpeg::PostProcessorJpeg(CameraDevice *const device) : cameraDevice_(device) { } diff --git a/src/android/jpeg/post_processor_jpeg.h b/src/android/jpeg/post_processor_jpeg.h index ae636ff..3706cec 100644 --- a/src/android/jpeg/post_processor_jpeg.h +++ b/src/android/jpeg/post_processor_jpeg.h @@ -19,7 +19,7 @@ class CameraDevice; class PostProcessorJpeg : public PostProcessor { public: - PostProcessorJpeg(CameraDevice *device); + PostProcessorJpeg(CameraDevice *const device); int configure(const libcamera::StreamConfiguration &incfg, const libcamera::StreamConfiguration &outcfg) override; @@ -28,7 +28,7 @@ public: CameraMetadata *metadata) override; private: - CameraDevice *cameraDevice_; + CameraDevice *const cameraDevice_; std::unique_ptr encoder_; libcamera::Size streamSize_; }; From patchwork Wed Oct 21 01:39:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 10154 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 9AD7EBDB13 for ; Wed, 21 Oct 2020 01:40:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 66E8661DCF; Wed, 21 Oct 2020 03:40:11 +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="Zbdb08lG"; dkim-atps=neutral Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6340461D98 for ; Wed, 21 Oct 2020 03:40:10 +0200 (CEST) Received: by mail-pf1-x431.google.com with SMTP id 10so510422pfp.5 for ; Tue, 20 Oct 2020 18:40:10 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=VsrjIa5fn9BIm7cmFlwzxqjDvLZ5QlFd0dv9kJ5Bx3c=; b=Zbdb08lGBT7rswY33ejR7uk+jonCvRLtDo7zA6WRyWqKM/04mjMyGkMzCUw1nPdEGr 7Na9ys79hqn77lRyOSYokygKekxn5yY7svel8lr6bnkcwxqM6uNMe8jP9xptBDhjJmv3 H+Qs1AaiMeOJXZe7sgWiDnbHdFQ8MAPVw27+4= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=VsrjIa5fn9BIm7cmFlwzxqjDvLZ5QlFd0dv9kJ5Bx3c=; b=e/b2n+6AL7e/uY+CEZoO2r9WSYOqBoAP90k9GOg3i4iwowJOMs0uG5gbNkQtUag4Z6 W88ICY2Qe5Fbq0mF/+TfjamDOaogW2L6+XLKdzPoL3/ofxj3ML1PurVOgIWb+hkI1GAc ib5BEXxvdjxtImNp7EAh3wxl8EmG1wpN1EGaDV53VOVeZHZRn/5HRJhE2+Y0/uFfk9BM T2zNmPWCwXctZSHMiK2xefBgSeiLQn8JAgtMec8WyllxzvVO/atrghcTFeOdkSpw7LP4 S/Pf7l08c7UPRYtLHra3RKLJE6xjCNv6ksZ0h3+iEGt9d2I8POVlYeA2RKa42Ww07bWZ Czkw== X-Gm-Message-State: AOAM530x1i3wvUMyr++VCW3ljg4IlBlTcdmi8UpeRniy5pPvzPdHp0lT J3qgs7D3ULG6y8I+ymFh6wuSUtu6aJxTVg== X-Google-Smtp-Source: ABdhPJyLyumRCeelgrgHalCXiOe/9FiQKQkRMnxI8+r+Aq8q1xcEHwiKsqyj5MjXuAHa1N/Mfmdx0w== X-Received: by 2002:a63:d90d:: with SMTP id r13mr904026pgg.99.1603244408832; Tue, 20 Oct 2020 18:40:08 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 18:40:08 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 10:39:55 +0900 Message-Id: <20201021013955.301790-4-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 4/4] android: camera_stream: Make some member variables constant 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" CameraStream initializes several member variables in the initializer list. Some of them are unchanged after. This makes them constant. Especially, doing to |cameraDevice_| represents CameraStream doesn't have the ownership of it. Signed-off-by: Hirokazu Honda Reviewed-by: Umang Jain Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/android/camera_stream.cpp | 7 +++---- src/android/camera_stream.h | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index 3e5d6be..dba351a 100644 --- a/src/android/camera_stream.cpp +++ b/src/android/camera_stream.cpp @@ -38,13 +38,12 @@ LOG_DECLARE_CATEGORY(HAL) * and buffer allocation. */ -CameraStream::CameraStream(CameraDevice *cameraDevice, Type type, +CameraStream::CameraStream(CameraDevice *const cameraDevice, Type type, camera3_stream_t *camera3Stream, unsigned int index) - : cameraDevice_(cameraDevice), type_(type), + : cameraDevice_(cameraDevice), + config_(cameraDevice->cameraConfiguration()), type_(type), camera3Stream_(camera3Stream), index_(index) { - config_ = cameraDevice_->cameraConfiguration(); - if (type_ == Type::Internal || type_ == Type::Mapped) { /* * \todo There might be multiple post-processors. The logic diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h index c367a5f..cc9d547 100644 --- a/src/android/camera_stream.h +++ b/src/android/camera_stream.h @@ -109,7 +109,7 @@ public: Internal, Mapped, }; - CameraStream(CameraDevice *cameraDevice, Type type, + CameraStream(CameraDevice *const cameraDevice, Type type, camera3_stream_t *camera3Stream, unsigned int index); Type type() const { return type_; } @@ -124,11 +124,11 @@ public: void putBuffer(libcamera::FrameBuffer *buffer); private: - CameraDevice *cameraDevice_; - libcamera::CameraConfiguration *config_; - Type type_; + CameraDevice *const cameraDevice_; + const libcamera::CameraConfiguration *config_; + const Type type_; camera3_stream_t *camera3Stream_; - unsigned int index_; + const unsigned int index_; std::unique_ptr allocator_; std::vector buffers_;