From patchwork Wed Dec 18 08:34:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 22392 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 3C788C3301 for ; Wed, 18 Dec 2024 08:36:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E2B0368094; Wed, 18 Dec 2024 09:36:19 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="eJguW1xJ"; dkim-atps=neutral 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 B22F067F24 for ; Wed, 18 Dec 2024 09:36:17 +0100 (CET) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-387897fae5dso490683f8f.2 for ; Wed, 18 Dec 2024 00:36:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1734510977; x=1735115777; darn=lists.libcamera.org; 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=B7RQnbyjyrsg/0lgDdzviLQ9dDzroinzgu5Rz/x5ULU=; b=eJguW1xJN6cJLtis5AXXpin4VmpEBGPzAEy6C5ZOOqjk2uCv/SkBi9nVNBlIyzXVZM ICQMpMjxhZfuNkmL39vxqPnVuTdcxSQAdSJA4jX1l7gCe/4Ddk7c/Ag7IZbVsd6khG2i b6v3dFKtQJU1KfZza015a7a6Ywg6Rw+xewEDG8yxXcHv5usikgxOoXTZdP+iu9Qcm/BO DFwKpXqCxcnZWl7fENG/bUakFrBe2irAesxnZ8kaQ+cKmWok/sILFwDc+N/KsvfocxXP LYmMxMffb39OC/yHbmnSs6uJwy9HqS/1ePpWZWUg2WNaiMhyxTgbgzcdW4YZPgs9s/S7 fTDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734510977; x=1735115777; 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=B7RQnbyjyrsg/0lgDdzviLQ9dDzroinzgu5Rz/x5ULU=; b=VhB4IkV4dyEZhEXiVG/2yccUMZfptJl1zBraiupJF+XyKg7nb/YTnRhZzcqWRVJcyD HF+cJI2RIujHurYGYiLs3mN07l0wA5uVcjRtM09BVuomJsoDfGFtcbfJihI0jUB08lLl TJHZbJBqsToFe7W5syWr+DdeG0jLR+3OB0Mgrsw7VNn5fTrKkRFqB5cPPpfCBe/EyB8Z RvqoY2wD9AdG1RqkUOXllfCT80VAlop/PwdBWXD/Oeu3YNaPGjrHyqmzPGF7bSFglsxD bfaJmSZmBj98ULTqP4An5YCUZOn++WhC+MCPljtFB8xVhuXipeOysys4dFN5Xyi0V7/m b8Pg== X-Gm-Message-State: AOJu0YxvgNmAaTwXq3uT7IkKwWS9ISH8ZNyCRBDJsZuDLasNizA82HSp CGeR3Ora34AZI2pWUhZnAOd9Er0FG6cMFkErVrS2531ECwJf+rd7qilNqJSlTEu649SEaGYIre7 A X-Gm-Gg: ASbGncvEKJQNZkBRONQF+OYoj1eBgzxqeQ/QM69NFDnVn49FP7/rWNxUhQX6GhK4tho Xpnl/TKr6hOvx8STK+v1N/he3B58gAtnylWYRn+rsgDMFKrGnfVgXfredHZ50kC3YTX9VusRbMJ 0TbzsHtklu5PeWjY2/4lv+13tOLFvy+IyaPpEUQbaL1EZK39Z5+Ptd0v5tF3O/LUuD+PFc764gS u+BcAnZccO1MJkXQV8tuCTWRh/4ItiCVFlhyyCzG/lIlYah2Aq/CL7srvh7+43wyZUzLxJIPPP/ X-Google-Smtp-Source: AGHT+IHmsmojrh1Y1bPisKNHTBIxow3jokfYri9mrX1mlBb06DzbuLXfCIVlG5TaD8emM+C1JG1K+w== X-Received: by 2002:a05:600c:19d0:b0:434:f537:f9c1 with SMTP id 5b1f17b1804b1-4365540f09bmr6307445e9.9.1734510976944; Wed, 18 Dec 2024 00:36:16 -0800 (PST) Received: from NAUSH-P-DELL.pitowers.org ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-388c804a2f9sm13585781f8f.77.2024.12.18.00.36.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 00:36:16 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , David Plowman , Laurent Pinchart Subject: [PATCH v2 1/4] ipa: rpi: Use r-value references in the set()/setLocked() functions Date: Wed, 18 Dec 2024 08:34:18 +0000 Message-ID: <20241218083610.2397879-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241218083610.2397879-1-naush@raspberrypi.com> References: <20241218083610.2397879-1-naush@raspberrypi.com> MIME-Version: 1.0 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" Use an r-value reference in set() and setLocked(), allowing more efficient metadata handling with std::forward and std::move if needed. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- src/ipa/rpi/controller/metadata.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ipa/rpi/controller/metadata.h b/src/ipa/rpi/controller/metadata.h index b4650d25170f..b884490918c7 100644 --- a/src/ipa/rpi/controller/metadata.h +++ b/src/ipa/rpi/controller/metadata.h @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -36,10 +37,10 @@ public: } template - void set(std::string const &tag, T const &value) + void set(std::string const &tag, T &&value) { std::scoped_lock lock(mutex_); - data_[tag] = value; + data_[tag] = std::forward(value); } template @@ -104,10 +105,10 @@ public: } template - void setLocked(std::string const &tag, T const &value) + void setLocked(std::string const &tag, T &&value) { /* Use this only if you're holding the lock yourself. */ - data_[tag] = value; + data_[tag] = std::forward(value); } /*