From patchwork Tue Oct 20 07:42:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 10121 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 87DCFBDB13 for ; Tue, 20 Oct 2020 07:42:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5A270613B4; Tue, 20 Oct 2020 09:42:41 +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="HjB6j1nV"; dkim-atps=neutral Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 124DF61373 for ; Tue, 20 Oct 2020 09:42:39 +0200 (CEST) Received: by mail-pl1-x62a.google.com with SMTP id y1so578392plp.6 for ; Tue, 20 Oct 2020 00:42:38 -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=KnajaLNsKfoDlc1CN0qMNCfYL0YiPngBQIC/4FGwMBs=; b=HjB6j1nVg9cvWdzr43RpwD78d17sPvg47pO+g0E8C6Q+fPhz96wIWf6UpsHeoCTLey 0/OAMoJw2Fx67cJCh9buS6SoFd2h4/A42e4r4ONooPAjxzKyhBAp5S9k2cttEjs334w1 1Ttcx2yzblJlLmJILVbzckkApZD+TvYP83RYA= 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=KnajaLNsKfoDlc1CN0qMNCfYL0YiPngBQIC/4FGwMBs=; b=lspVoREQo1bBDmkGXEDYlS8lQLN1IAnFg2D6hrIKN4VtNBu5xkcM0Oc5lyZ8p7NhBi 2DtDZHX5SOoUmv3QjByKZOPpHDcjAeUlCTu8iVKJCwHyaV3yXC7ByPQSQh6YYSC2dha3 RNabhzD+hxejAkKgixhj6bZYaG9UjR3PB4EXU1TowbhJ6Wm1bsf4OXuM/Ax3t1Df0vDr 2HA4Xboh8hwm9n9CMWadel6E18yfPtNPCGvHkAkfJVB4tcJqNVsMRG3r5sRh8mdn9RsV mWb0BtJWz/zTP+3cPoWUomN9sAwNEaJSH4mzQ5Oz+39mzKM2RDcO8QnEiwg6bda1dhot 3xhg== X-Gm-Message-State: AOAM533CcbmW1bsVXOzd708UKLV1Ra6d0zV4Rd5jZFDmXyYnVBy82Zz+ sp41z36FnfL4HAc/e04TBAOmU76e/hcHaw== X-Google-Smtp-Source: ABdhPJyb6Ek1wqsvsyRy1xH9GbX8FIk0/0m9mXd7k1ujy6e2xUQw3lFtTNdgDmAbMm3Yxnx5n+SnCQ== X-Received: by 2002:a17:902:ff14:b029:d3:f1e5:c992 with SMTP id f20-20020a170902ff14b02900d3f1e5c992mr1778085plj.72.1603179757417; Tue, 20 Oct 2020 00:42:37 -0700 (PDT) Received: from hiroh.tok.corp.google.com ([2401:fa00:8f:2:de4a:3eff:fe7d:f78f]) by smtp.gmail.com with ESMTPSA id d26sm1193684pfo.82.2020.10.20.00.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 00:42:36 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 16:42:26 +0900 Message-Id: <20201020074229.119151-1-hiroh@chromium.org> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 replace 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 1b8afa8..28a6e09 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 753c28e..55b9088 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 Tue Oct 20 07:42:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 10122 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 DBD24BDB13 for ; Tue, 20 Oct 2020 07:42:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A391361373; Tue, 20 Oct 2020 09:42:42 +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="TuMte7+Q"; dkim-atps=neutral Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3E6C760353 for ; Tue, 20 Oct 2020 09:42:41 +0200 (CEST) Received: by mail-pl1-x642.google.com with SMTP id b19so590651pld.0 for ; Tue, 20 Oct 2020 00:42:41 -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=4GFgfk9SMXWs9mals3D4EQq8xd4Or6Xym7sScIqjpis=; b=TuMte7+QUDeHCHGfCLp6R7xz0kHdzXy7pHjgq17Xa3tl3mwH+TaMWLzMeZk1WQKIU9 urmKvNHuK4a+FqTgX37YpyeN0uefs3YVdlkQLhReyX1lF1WAliUGLPiI6pnyK0RCAE92 0Dfwpa+kJo0TGcmsYzA1Y6uJYsJOFPK5HzMk4= 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=4GFgfk9SMXWs9mals3D4EQq8xd4Or6Xym7sScIqjpis=; b=sCXkLwFXy/P17WzSvEO3nOl1jEf5QFdzZPcI4lnqbrVSq0mGdfIYZI06fUtcxA8nGh ckRicBtDjRVniJBLJcoZz1dGAXj8t40/zfcF+EKYq/3XSWQk7cZxVWqETOJyvImcvD0e fQ0FdmGmWOiyPMYJo6him1sFUurXjr/4Wqa9/I6J/Mg53v1kHvyXoXjpcXpX2FrxPPdC JxK48MxudYl+C1uueChsAmwBeb0OPd9v+hWH15DhA4zjOaAtHdyu9NGPm+D4bYb6hK9T NfpfRYMXHgDE9zJfkiMlKhufmINH351c6KsPMuOCuoYMC4AeQIE0GfNQsTSTO+IdazpI z0ZQ== X-Gm-Message-State: AOAM531QaOFragg/js3b4MyPGPqfO6VaGP7Cdeo1mduDihND13MupStq q9QshpmFw2VAY9ZIFGjp4VEQF+L0H5YGfA== X-Google-Smtp-Source: ABdhPJyEtfXDOoq6rjGlqorfuP/OLIsfzWW6Z4P+ufnkgDEfyUfkCWhK8hf2B3GM9NF1Pr0b+wUy/Q== X-Received: by 2002:a17:90b:438c:: with SMTP id in12mr1750546pjb.32.1603179759542; Tue, 20 Oct 2020 00:42:39 -0700 (PDT) Received: from hiroh.tok.corp.google.com ([2401:fa00:8f:2:de4a:3eff:fe7d:f78f]) by smtp.gmail.com with ESMTPSA id d26sm1193684pfo.82.2020.10.20.00.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 00:42:39 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 16:42:27 +0900 Message-Id: <20201020074229.119151-2-hiroh@chromium.org> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog In-Reply-To: <20201020074229.119151-1-hiroh@chromium.org> References: <20201020074229.119151-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 chea 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 --- 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 4483153..4fe71cf 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 8995ba5..4236c9d 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 55b9088..6f33631 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 Tue Oct 20 07:42:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 10123 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 38D53BDB13 for ; Tue, 20 Oct 2020 07:42:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 03DDA60353; Tue, 20 Oct 2020 09:42:45 +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="EU/ORs1+"; dkim-atps=neutral Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0AB866052F for ; Tue, 20 Oct 2020 09:42:43 +0200 (CEST) Received: by mail-pf1-x435.google.com with SMTP id a200so686986pfa.10 for ; Tue, 20 Oct 2020 00:42:42 -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=QWv+f2AKbdD4kKXg1LU+l+aZjUgqahucd+R0EdJRvEU=; b=EU/ORs1+f0qX/hsbd1YI5kaV135Ht27jREDNn9CKoT2H1BjGsMyUtMXCUIO8luJaVK yuNbGOvSI9IRV1R0qpvwZkb+DstbCjR0sHfE6tsqQ5x0m/S+m+g6TbhvRAK3/MU6FzMu ffL4cxrHkQF9jLwcNfhhnYNBU8IOR0o5BQLYQ= 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=QWv+f2AKbdD4kKXg1LU+l+aZjUgqahucd+R0EdJRvEU=; b=mWVBBAbzjr2+EJGb3PgxFD6XHCNZZsrB301xOiHzPtDJXhy1t3fbMeQMieyrrHR79f M1iirkqKBZFwBF65aR0Ubc8K2i6JO0/iz0M1rwEV8WNQCdeuyV9H9q9f+oXatWGisTPR lJHBl9x77eSBoy8JiF6UXipF84b1+CZGfewY+mNIQ//dF8hzQIx9kDcPSZUS7408ZyOq Q/hZwjvXcAM53VvWZJxFQBGNkWx5iK9bcu3NvoasUZwk5gL8BWIpKWvYJ/43jQSE2j2G Q1kHUYmIBUn7Rofz0aD0ELr6SbK+4S7tYgwV8jMxgymS6RlolfbKzBxuxtRqNEQnIpKv NL5A== X-Gm-Message-State: AOAM533EJlcqXRDB4hI3JKdeYuksfFEWMM4p5RZxyf6oC8XoRT6+ngVG zrhEO9wIuUnJJpz7ysJWvPNb2E8fpwUENA== X-Google-Smtp-Source: ABdhPJwkTtTOV9foeilfoWwHJg//Y7rvfAZ+ygBq9Jqchcnu9scjOt3dbYcIQnufB2s4L13/RlDLMw== X-Received: by 2002:a65:4144:: with SMTP id x4mr1580062pgp.432.1603179761527; Tue, 20 Oct 2020 00:42:41 -0700 (PDT) Received: from hiroh.tok.corp.google.com ([2401:fa00:8f:2:de4a:3eff:fe7d:f78f]) by smtp.gmail.com with ESMTPSA id d26sm1193684pfo.82.2020.10.20.00.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 00:42:40 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 16:42:28 +0900 Message-Id: <20201020074229.119151-3-hiroh@chromium.org> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog In-Reply-To: <20201020074229.119151-1-hiroh@chromium.org> References: <20201020074229.119151-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 --- 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 6f33631..f895d1f 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..8e25b29 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 Tue Oct 20 07:42:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 10124 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 8200FBDB13 for ; Tue, 20 Oct 2020 07:42:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4E633610C4; Tue, 20 Oct 2020 09:42:46 +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="dnzjYHx4"; dkim-atps=neutral Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 06CB761394 for ; Tue, 20 Oct 2020 09:42:45 +0200 (CEST) Received: by mail-pg1-x531.google.com with SMTP id t14so589135pgg.1 for ; Tue, 20 Oct 2020 00:42:44 -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=DHCLfJ0ITVxCOAjl+xiD/qqBE4LmukKaknHvfygvs/o=; b=dnzjYHx4pOO4r6mO20SrCg0hdqV6eAE78uXNBjOpAB3TeEHPDWM+3JvQtl1xcq2BWu qfeJ8LLyLf1xY8ZK1Ig50Snu04zBSTWxjwp47A9gQKyFFX+yYQ8NXz9zhA6SPYf4OhqH MdL8t3xd5myqWIJ2oYE9BRw91Ac0ZR//3buUQ= 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=DHCLfJ0ITVxCOAjl+xiD/qqBE4LmukKaknHvfygvs/o=; b=CJB9qgg2RFGTiqwRTxIBwXXsiYgv3JA/NzYxRflntJurCjy4lxnD68PyGdJ/nCt1My A25b0ARuK93GpcalKrRs9LUa5s/hfhLaV6KVOph4ex0xLDr1mzIQdSTRAwOmg8JNepFf lCBraBdNmx+d9QoPj0OHUu1GHkBkL0MrpczOzUTTfXQRXfjWNDw0Lj4/5KcNe/jq2QN5 79qtaMPaPbPuS9o3FSuHMH4mfZWvgL0CSFa8kVUg3YqafMe85M/+2rHEU4V140l5cH6U bzVcnGE7QZ0nadYpsXUBgeBidHplO0+pBCzghNQiOXqi81xSCdS5HE1g5afoSsUSVyGU uNOg== X-Gm-Message-State: AOAM5318Lrr4JJ0HL8b7jTwJ4V3VrwSthocNEEpinIfK+1LvE2II4QJ9 +fm+q6ZIkxKb14aDti+oLBapdsPlZEJb9w== X-Google-Smtp-Source: ABdhPJzWS51yACj38RQUzxBGxTOwIbhrF4Ov/sNx4g7aR3Q6JjE6HSNwTZt7oKjSgYNJLmRKvfsMzg== X-Received: by 2002:a65:5b48:: with SMTP id y8mr1582578pgr.67.1603179763376; Tue, 20 Oct 2020 00:42:43 -0700 (PDT) Received: from hiroh.tok.corp.google.com ([2401:fa00:8f:2:de4a:3eff:fe7d:f78f]) by smtp.gmail.com with ESMTPSA id d26sm1193684pfo.82.2020.10.20.00.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 00:42:42 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 16:42:29 +0900 Message-Id: <20201020074229.119151-4-hiroh@chromium.org> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog In-Reply-To: <20201020074229.119151-1-hiroh@chromium.org> References: <20201020074229.119151-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 --- 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 28a6e09..9644b74 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..23c139d 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_;