From patchwork Tue Nov 15 09:07:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17795 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 3214CBE08B for ; Tue, 15 Nov 2022 09:08:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 670D06308E; Tue, 15 Nov 2022 10:08:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1668503285; bh=MfJGzVF0xEaHzNXFhd8igfaQOfe1CDgC3OPO2CFqVWs=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Lo31s/RG4flgOT5WHtas6VgycKeI6fWLhVcUy/5Kuygj7hBwvYIwOJnJU3y7ott/Z pj1+azQmVIjC8FAiVDKLVo5DqudyjdLjxPRO8OmDwIU+bfHm8HgDv/SA4jdTNyZODw ytubN1efmaLcRPomsaqqzR5zDo2fLsRQ73QozWEGTxJYOi04nUmh0dJo0TU70rEGHk Uj5RYX/iQ2I34Fa40iiYTOz2Eq9Ok8wMGfbLt+Eb/Cfr1zCrdu5hGA2WAyCZeCL6ev G/14CxKTFa6HFGhFF4mrIWURJlH7UIJtoCm8x1PYL0bdl0Vu3HkeQ5ipeV3tNklUgy SuzaAeJi37ASQ== Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 11AC06307F for ; Tue, 15 Nov 2022 10:08:03 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="VftRBPRV"; dkim-atps=neutral Received: by mail-wr1-x431.google.com with SMTP id a14so23107936wru.5 for ; Tue, 15 Nov 2022 01:08:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9FLYHppxCNcOu0dK4WMQh2Nl/lRPe5xDxdYMrwqkS1s=; b=VftRBPRVTZxOp1ZTHk9r+v6tFnA3mJHco6eCeDunopuvTP/OVCR7N42QH/2hiqjawa h+kLdtMwwxMbreob8aHBF9fguSngO5MiV7JcyieOMLbwECw9NuqOBI7mSiYXhQByzTrF n4g2nbhLbPTyMqxotTgNfDqpIMzZ+xxnDky/2zkPQTpk4D3jex9Wn4O1/KLEz/a9X1Kq BfM77F6wSXqp+hnzNhn/N6vMc2bzDnCn47rXF3wMdjjjtILgC1ymienymjfdCZs+3gcw ObA/AffTbinQsyruX1o3keymzNU3mMG8WqUY0utkn9Aws/hllrkT46BCPbqZJJb3fur2 sxQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9FLYHppxCNcOu0dK4WMQh2Nl/lRPe5xDxdYMrwqkS1s=; b=WmAqAv50S5DBmE438Swivz0+60mZcRoUp6HK2kcUwsAv9zoaeMtnSZFAM7yiP5XCKk zSQZ/7vbJik2Rjfny+6mBoglOdL+scG7KiworzHKVPXWFET5KyYvcvZsG2ueTcmC0Xib GrV5xVv0PA2lBki+lLsN/q3+Df9M2t7y0mQ9AsYFE1DKAI6CCn2m95uiXAwHNjiqDA16 QhDiFeG5nZtiK9Ya01vksS4EeEaS6a4JCFW4zb6dnd4tNrBic9BATfWjrzOtK/QcBsd4 Yej+DhnMkdgL2mryHA4vkZW3PnmhqXI+YD9LZ3EyUSLe9hpBFsXSkE4Co2sWomwYhXge 4n5g== X-Gm-Message-State: ANoB5pm6zqZ8qmlWFQEtbEz7YmNwzkOTn5hEmLIeUmJGkES57SBqOcR6 x5tEp5PbK+RgrsXf+RtnWanoFyH/pR7U2g== X-Google-Smtp-Source: AA0mqf7X+W3C1SlspDynAKcMpXTJbSNGA3lGtw0bvq2fMGRq/nM4PEpmEFjMI25RuyCHHr1LKBxGCQ== X-Received: by 2002:adf:f502:0:b0:238:c1d5:3293 with SMTP id q2-20020adff502000000b00238c1d53293mr9733918wro.446.1668503282525; Tue, 15 Nov 2022 01:08:02 -0800 (PST) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id p25-20020a05600c1d9900b003c64c186206sm15143696wms.16.2022.11.15.01.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 01:08:01 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Tue, 15 Nov 2022 09:07:50 +0000 Message-Id: <20221115090755.2921-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221115090755.2921-1-naush@raspberrypi.com> References: <20221115090755.2921-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 3/8] pipeline: raspberrypi: delayed_controls: Template the ControlRingBuffer class 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: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Convert ControlRingBuffer to a templated class to allow arbitrary ring buffer array types to be defined. Rename ControlRingBuffer to RingBuffer to indicate this. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- .../pipeline/raspberrypi/delayed_controls.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/delayed_controls.h b/src/libcamera/pipeline/raspberrypi/delayed_controls.h index f7f246482968..238b86ab6cb4 100644 --- a/src/libcamera/pipeline/raspberrypi/delayed_controls.h +++ b/src/libcamera/pipeline/raspberrypi/delayed_controls.h @@ -56,17 +56,18 @@ private: }; static constexpr int listSize = 16; - class ControlRingBuffer : public std::array + template + class RingBuffer : public std::array { public: - Info &operator[](unsigned int index) + T &operator[](unsigned int index) { - return std::array::operator[](index % listSize); + return std::array::operator[](index % listSize); } - const Info &operator[](unsigned int index) const + const T &operator[](unsigned int index) const { - return std::array::operator[](index % listSize); + return std::array::operator[](index % listSize); } }; @@ -76,7 +77,7 @@ private: uint32_t queueCount_; uint32_t writeCount_; - std::unordered_map values_; + std::unordered_map> values_; }; } /* namespace RPi */