[{"id":33551,"web_url":"https://patchwork.libcamera.org/comment/33551/","msgid":"<20250303205919.GD23684@pendragon.ideasonboard.com>","date":"2025-03-03T20:59:19","subject":"Re: [PATCH v1] apps: qcam: Simplify `PixelFormat` search","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Barnabás,\n\nThank you for the patch.\n\nOn Mon, Mar 03, 2025 at 08:33:39PM +0100, Barnabás Pőcze wrote:\n> Since `PixelFormat` has `operator==()`, `std::find()` can be used\n> directly, so do that to simplify.\n> \n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/apps/qcam/main_window.cpp | 5 +----\n>  1 file changed, 1 insertion(+), 4 deletions(-)\n> \n> diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp\n> index 3880a846e..d2ccbd231 100644\n> --- a/src/apps/qcam/main_window.cpp\n> +++ b/src/apps/qcam/main_window.cpp\n> @@ -386,10 +386,7 @@ int MainWindow::startCapture()\n>  \t/* Use a format supported by the viewfinder if available. */\n>  \tstd::vector<PixelFormat> formats = vfConfig.formats().pixelformats();\n>  \tfor (const PixelFormat &format : viewfinder_->nativeFormats()) {\n> -\t\tauto match = std::find_if(formats.begin(), formats.end(),\n> -\t\t\t\t\t  [&](const PixelFormat &f) {\n> -\t\t\t\t\t\t  return f == format;\n> -\t\t\t\t\t  });\n> +\t\tauto match = std::find(formats.begin(), formats.end(), format);\n>  \t\tif (match != formats.end()) {\n>  \t\t\tvfConfig.pixelFormat = format;\n>  \t\t\tbreak;","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 1E6EFBD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Mar 2025 20:59:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BDBB868822;\n\tMon,  3 Mar 2025 21:59:42 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DF8C968772\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Mar 2025 21:59:40 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3FC6B8DB;\n\tMon,  3 Mar 2025 21:58:09 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ZvLWfGde\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1741035489;\n\tbh=jHYlycQOuMb44UxIKGWt3K/z/OyEb8nTdRXb4RMKoxI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ZvLWfGde2TYfEmnHqOxqxKK9TyGRIe/HuU5TzhsZE5pBihOmhs0AwQZF3472MxQdd\n\tCEpBs3cZxqazDBqVFERB5socxFGMx7utQSNtQpVfPIeNpg9zvnmsGII/WyTQNN0LtN\n\tlXmGVOCDw+e3UJ1yX374uT4S1cUKCWf6E3XH8Jr0=","Date":"Mon, 3 Mar 2025 22:59:19 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v1] apps: qcam: Simplify `PixelFormat` search","Message-ID":"<20250303205919.GD23684@pendragon.ideasonboard.com>","References":"<20250303193339.785634-1-barnabas.pocze@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20250303193339.785634-1-barnabas.pocze@ideasonboard.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":33564,"web_url":"https://patchwork.libcamera.org/comment/33564/","msgid":"<174108273598.2914008.1927533679621097388@ping.linuxembedded.co.uk>","date":"2025-03-04T10:05:35","subject":"Re: [PATCH v1] apps: qcam: Simplify `PixelFormat` search","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Barnabás Pőcze (2025-03-03 19:33:39)\n> Since `PixelFormat` has `operator==()`, `std::find()` can be used\n> directly, so do that to simplify.\n> \n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\nI'm curious if this was possible when the auto match was added in the\nfirst place, or if the operator==() came later, but either way - no need\nto go into archeology for this so:\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> ---\n>  src/apps/qcam/main_window.cpp | 5 +----\n>  1 file changed, 1 insertion(+), 4 deletions(-)\n> \n> diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp\n> index 3880a846e..d2ccbd231 100644\n> --- a/src/apps/qcam/main_window.cpp\n> +++ b/src/apps/qcam/main_window.cpp\n> @@ -386,10 +386,7 @@ int MainWindow::startCapture()\n>         /* Use a format supported by the viewfinder if available. */\n>         std::vector<PixelFormat> formats = vfConfig.formats().pixelformats();\n>         for (const PixelFormat &format : viewfinder_->nativeFormats()) {\n> -               auto match = std::find_if(formats.begin(), formats.end(),\n> -                                         [&](const PixelFormat &f) {\n> -                                                 return f == format;\n> -                                         });\n> +               auto match = std::find(formats.begin(), formats.end(), format);\n>                 if (match != formats.end()) {\n>                         vfConfig.pixelFormat = format;\n>                         break;\n> -- \n> 2.48.1\n>","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 68B5BC3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  4 Mar 2025 10:05:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2A50E68826;\n\tTue,  4 Mar 2025 11:05:40 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A5A7968754\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  4 Mar 2025 11:05:38 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AF3E61083;\n\tTue,  4 Mar 2025 11:04:06 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"vDNye0+N\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1741082646;\n\tbh=8ab/r1Km34SSq72Qb2r1i4IneEj9zOBlhCMRMb1UQ8g=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=vDNye0+NMsNX/J0QWx3EGf+705LPagHLir6TFf/r0WwF9tmfheAgsPMl7cEhvep1m\n\tchpiIi7nt6rk7RI9oq7R/EvOOYVh2b7qA8G3ND7BZGwgoR1ivdVLl2YqirJsF/WKx2\n\t8EhO3CNGVjqwrSLL/BVlwVVQpEi1kkem2CMSN3aA=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250303193339.785634-1-barnabas.pocze@ideasonboard.com>","References":"<20250303193339.785634-1-barnabas.pocze@ideasonboard.com>","Subject":"Re: [PATCH v1] apps: qcam: Simplify `PixelFormat` search","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 04 Mar 2025 10:05:35 +0000","Message-ID":"<174108273598.2914008.1927533679621097388@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]