{"id":14113,"url":"https://patchwork.libcamera.org/api/1.1/patches/14113/?format=json","web_url":"https://patchwork.libcamera.org/patch/14113/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20211013012630.18877-3-laurent.pinchart@ideasonboard.com>","date":"2021-10-13T01:26:30","name":"[libcamera-devel,2/2] libcamera: pipeline: ipu3: Use new Size grownBy() and shrunkBy() helpers","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"ae4186a4538d4d1dfa51cead5069b900643c0505","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14113/mbox/","series":[{"id":2620,"url":"https://patchwork.libcamera.org/api/1.1/series/2620/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2620","date":"2021-10-13T01:26:28","name":"libcamera: Add new helpers to the Size class","version":1,"mbox":"https://patchwork.libcamera.org/series/2620/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14113/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14113/checks/","tags":{},"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 06321BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Oct 2021 01:26:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7B85D68F57;\n\tWed, 13 Oct 2021 03:26:51 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 30F3968F4D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Oct 2021 03:26:49 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BDB04291;\n\tWed, 13 Oct 2021 03:26:48 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ZVfwA6yS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634088409;\n\tbh=7NVSWSd6dd4hFhb4gdpGU87X3Do1cfXYrwebrxaaGyw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ZVfwA6ySP4u0BVoOtOKTFVH1Ea+7dSr8E/FIix2aPw4brN3lGHTkD4CL2iYPgwO6h\n\t8BhugOCEBZJJ4fGh8CiuJchIIOX3kXwchoIP22WX6O/GfQXzq/2dPzAPwX/iruoGqJ\n\teZbUWAdHfPwI0Lx1IEkn5o2g0qzK+HA/sc+PLDSo=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 13 Oct 2021 04:26:30 +0300","Message-Id":"<20211013012630.18877-3-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.32.0","In-Reply-To":"<20211013012630.18877-1-laurent.pinchart@ideasonboard.com>","References":"<20211013012630.18877-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 2/2] libcamera: pipeline: ipu3: Use new\n\tSize grownBy() and shrunkBy() helpers","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>"},"content":"The Size class has new helpers that can simplify the code in the IPU3\npipeline handler. Use them.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 15 ++++++---------\n 1 file changed, 6 insertions(+), 9 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 92e869257e53..262b9a23703e 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -438,11 +438,10 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera,\n \t\t\t * \\todo Clarify the alignment constraints as explained\n \t\t\t * in validate()\n \t\t\t */\n-\t\t\tsize = sensorResolution.boundedTo(IMGU_OUTPUT_MAX_SIZE);\n-\t\t\tsize.width = utils::alignDown(size.width - 1,\n-\t\t\t\t\t\t      IMGU_OUTPUT_WIDTH_MARGIN);\n-\t\t\tsize.height = utils::alignDown(size.height - 1,\n-\t\t\t\t\t\t       IMGU_OUTPUT_HEIGHT_MARGIN);\n+\t\t\tsize = sensorResolution.boundedTo(IMGU_OUTPUT_MAX_SIZE)\n+\t\t\t\t.shrunkBy({ 1, 1 })\n+\t\t\t\t.alignedDownTo(IMGU_OUTPUT_WIDTH_MARGIN,\n+\t\t\t\t\t       IMGU_OUTPUT_HEIGHT_MARGIN);\n \t\t\tpixelFormat = formats::NV12;\n \t\t\tbufferCount = IPU3_BUFFER_COUNT;\n \t\t\tstreamFormats[pixelFormat] = { { IMGU_OUTPUT_MIN_SIZE, size } };\n@@ -996,8 +995,7 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)\n \t */\n \n \t/* The strictly smaller size than the sensor resolution, aligned to margins. */\n-\tSize minSize = Size(sensor->resolution().width - 1,\n-\t\t\t    sensor->resolution().height - 1)\n+\tSize minSize = sensor->resolution().shrunkBy({ 1, 1 })\n \t\t       .alignedDownTo(IMGU_OUTPUT_WIDTH_MARGIN,\n \t\t\t\t      IMGU_OUTPUT_HEIGHT_MARGIN);\n \n@@ -1005,8 +1003,7 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)\n \t * Either the smallest margin-aligned size larger than the viewfinder\n \t * size or the adjusted sensor resolution.\n \t */\n-\tminSize = Size(IPU3ViewfinderSize.width + 1,\n-\t\t       IPU3ViewfinderSize.height + 1)\n+\tminSize = IPU3ViewfinderSize.grownBy({ 1, 1 })\n \t\t  .alignedUpTo(IMGU_OUTPUT_WIDTH_MARGIN,\n \t\t\t       IMGU_OUTPUT_HEIGHT_MARGIN)\n \t\t  .boundedTo(minSize);\n","prefixes":["libcamera-devel","2/2"]}