[{"id":16476,"web_url":"https://patchwork.libcamera.org/comment/16476/","msgid":"<CAO5uPHOOFqOak=zaFHu=eAfLxB9Rz5RSFW-xuwotK3kLGckkFQ@mail.gmail.com>","date":"2021-04-22T03:17:57","subject":"Re: [libcamera-devel] [PATCH v3 01/16] libcamera: controls: Add a\n\tfunction to merge two control lists","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Jacopo, thank you for the patch.\n\nOn Thu, Apr 22, 2021 at 1:02 AM Jacopo Mondi <jacopo@jmondi.org> wrote:\n>\n> From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n> Add a new ControlList::merge() function to merge two control lists. The\n> semantics is identical to std::unordered_map::merge(). This can be used\n> by pipeline handlers to merge metadata they populate with metadata\n> received from an IPA.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  include/libcamera/controls.h |  2 ++\n>  src/libcamera/controls.cpp   | 20 ++++++++++++++++++++\n>  2 files changed, 22 insertions(+)\n>\n> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\n> index 1a5690a5ccbe..16726ce9b1ed 100644\n> --- a/include/libcamera/controls.h\n> +++ b/include/libcamera/controls.h\n> @@ -363,7 +363,9 @@ public:\n>\n>         bool empty() const { return controls_.empty(); }\n>         std::size_t size() const { return controls_.size(); }\n> +\n>         void clear() { controls_.clear(); }\n> +       void merge(ControlList &source);\n>\n>         bool contains(const ControlId &id) const;\n>         bool contains(unsigned int id) const;\n> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\n> index c58ed3946f3b..58555ea64c95 100644\n> --- a/src/libcamera/controls.cpp\n> +++ b/src/libcamera/controls.cpp\n> @@ -874,6 +874,26 @@ ControlList::ControlList(const ControlInfoMap &infoMap, ControlValidator *valida\n>   * \\brief Removes all controls from the list\n>   */\n>\n> +/**\n> + * \\brief Merge the \\a source into the ControlList\n> + * \\param[in] source The ControlList to merge into this object\n> + *\n> + * Merging two control lists extracts elements from the \\a source and insert\n> + * them in *this. If the \\a source contains elements whose key is already\n> + * present in *this, then those elements are not extracted. The semantics is\n> + * identical to std::unordered_map::merge() in that only internal pointers to\n> + * nodes are updated, without copying or moving the elements.\n> + *\n> + * Only control lists created from the same ControlIdMap or ControlInfoMap may\n> + * be merged. Attempting to do otherwise results in undefined behaviour.\n> + */\n> +void ControlList::merge(ControlList &source)\n> +{\n> +       ASSERT(idmap_ == source.idmap_);\n> +\n> +       controls_.merge(source.controls_);\n> +}\n> +\n>  /**\n>   * \\brief Check if the list contains a control with the specified \\a id\n>   * \\param[in] id The control ID\n> --\n> 2.31.1\n\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C4715BDB17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Apr 2021 03:18:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 28A4E68847;\n\tThu, 22 Apr 2021 05:18:09 +0200 (CEST)","from mail-ed1-x532.google.com (mail-ed1-x532.google.com\n\t[IPv6:2a00:1450:4864:20::532])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 22FF360514\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Apr 2021 05:18:08 +0200 (CEST)","by mail-ed1-x532.google.com with SMTP id h8so11535514edb.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Apr 2021 20:18:08 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"NNh4/Bg9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=KyGMwFoRpP6fEGNER/lsJ/FKOxVWCZeMh1ZqmRMR9fs=;\n\tb=NNh4/Bg904AW5M9kRdaLA1en0xuUUYTjucnaX2cQruDG/MmTc29YGXOJqOEqs2u4do\n\tmrbXOGWOYjEC8SVP9vvtIYTISahbllUEaE3MDsXWpofQc4ZoU6MxC4w2/SXaQljNWyY8\n\tXJLWHa5Sattu3RCDy/CoGoOCn9olXx+qXwS4s=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=KyGMwFoRpP6fEGNER/lsJ/FKOxVWCZeMh1ZqmRMR9fs=;\n\tb=e120eVGBpNljftw9HObNB3Uhj8bh8/2h5MBpq2ScajNn5vr2EUDfzt0mHbOPEwNSzi\n\tCGA3aXxLQCLkdR3CRK7IxhM5MO/evNrzHBycvOxjkJTeFOP5GwKwLDSgiGZ9IjLXD6as\n\t8l3Rx4VES2KJhEC5BiYQaIxE1UKsxhkaiyaRPL1FldmuHsKjuOwBztK4jPntESBdlOo4\n\t1g0r6EQKEhPqBGBhwxbPtSm/6T1QqqvBHnPtBU9R94nyh+IQPuQCL7ge7B4XEulDYnl7\n\tWVEzOIZpnYgDs/gEULrz7Z4O21K66cHkBnV2+zb2/eJ7iFxSeOc6R9dPw4gvpRHZt/n7\n\tRqcg==","X-Gm-Message-State":"AOAM5320pw92NzNF6QVlonfth8ATCypf3QOUJUPDRPGTue5xnTxTh5OJ\n\tNwC0uzB87YNVqkq8ZgieiFDzYFzCN5xFbN2cP9qxKopJzB0=","X-Google-Smtp-Source":"ABdhPJzpcpxbk/pF45XopDSyBXQzRyV4Fp3uUGDixtuRDAhB31EYDYrxDTeIVPCNxvftMNACmHyn7MifHNixvDts2p8=","X-Received":"by 2002:a05:6402:488:: with SMTP id\n\tk8mr1130572edv.233.1619061487771; \n\tWed, 21 Apr 2021 20:18:07 -0700 (PDT)","MIME-Version":"1.0","References":"<20210421160319.42251-1-jacopo@jmondi.org>\n\t<20210421160319.42251-2-jacopo@jmondi.org>","In-Reply-To":"<20210421160319.42251-2-jacopo@jmondi.org>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Thu, 22 Apr 2021 12:17:57 +0900","Message-ID":"<CAO5uPHOOFqOak=zaFHu=eAfLxB9Rz5RSFW-xuwotK3kLGckkFQ@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v3 01/16] libcamera: controls: Add a\n\tfunction to merge two control lists","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]