{"id":3824,"url":"https://patchwork.libcamera.org/api/patches/3824/?format=json","web_url":"https://patchwork.libcamera.org/patch/3824/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20200519165543.30465-3-laurent.pinchart@ideasonboard.com>","date":"2020-05-19T16:55:43","name":"[libcamera-devel,v2,3/3] libcamera: pipeline: simple: Add scaling support","commit_ref":"2ed5259098c0aa52bc34f6d47076729d3e8da758","pull_url":null,"state":"accepted","archived":false,"hash":"e2a33b60befb5062002d2af0dd652f1a782c01e3","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3824/mbox/","series":[{"id":915,"url":"https://patchwork.libcamera.org/api/series/915/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=915","date":"2020-05-19T16:55:41","name":"[libcamera-devel,v2,1/3] libcamera: pipeline: simple: Add stride support","version":2,"mbox":"https://patchwork.libcamera.org/series/915/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3824/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3824/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DB4F760E4B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 May 2020 18:55:58 +0200 (CEST)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 02B5130C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 May 2020 18:55:57 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ZcLFLdQX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1589907358;\n\tbh=SWWL5T+v5y1I0P3QzUD3x/xXqK6U1ANjDWntoaMHjSA=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=ZcLFLdQXbKAMkbUNnNF+HJlg8664ZVaqPnix9DrIgt0e1LRIjjVYgRLasjjkGNNwg\n\tn+9HfGCOAiDaHxr4jUxstvZfl4u1tLmqH0c5wlP4suNYGHVX1lway1EZMbM2014hp3\n\tRiugPHj1PW6XFUmz/KyxzWLaevsbChJMRByeU8GQ=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 19 May 2020 19:55:43 +0300","Message-Id":"<20200519165543.30465-3-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.26.2","In-Reply-To":"<20200519165543.30465-1-laurent.pinchart@ideasonboard.com>","References":"<20200519165543.30465-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 3/3] libcamera: pipeline: simple: Add\n\tscaling support","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>","X-List-Received-Date":"Tue, 19 May 2020 16:55:59 -0000"},"content":"Use the converter to implement scaling.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/pipeline/simple/simple.cpp | 30 +++++++++++++++---------\n 1 file changed, 19 insertions(+), 11 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 686639c3b0c9..1ec8d0f7de03 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -75,7 +75,8 @@ public:\n \tstruct Configuration {\n \t\tuint32_t code;\n \t\tPixelFormat pixelFormat;\n-\t\tSize size;\n+\t\tSize captureSize;\n+\t\tSizeRange outputSizes;\n \t};\n \n \tStream stream_;\n@@ -301,13 +302,16 @@ int SimpleCameraData::init()\n \t\t\tConfiguration config;\n \t\t\tconfig.code = code;\n \t\t\tconfig.pixelFormat = pixelFormat;\n-\t\t\tconfig.size = format.size;\n+\t\t\tconfig.captureSize = format.size;\n \n \t\t\tif (!converter) {\n+\t\t\t\tconfig.outputSizes = config.captureSize;\n \t\t\t\tformats_[pixelFormat] = config;\n \t\t\t\tcontinue;\n \t\t\t}\n \n+\t\t\tconfig.outputSizes = converter->sizes(format.size);\n+\n \t\t\tfor (PixelFormat format : converter->formats(pixelFormat))\n \t\t\t\tformats_[format] = config;\n \t\t}\n@@ -440,15 +444,16 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n \t}\n \n \tconst SimpleCameraData::Configuration &pipeConfig = it->second;\n-\tif (cfg.size != pipeConfig.size) {\n+\tif (!pipeConfig.outputSizes.contains(cfg.size)) {\n \t\tLOG(SimplePipeline, Debug)\n \t\t\t<< \"Adjusting size from \" << cfg.size.toString()\n-\t\t\t<< \" to \" << pipeConfig.size.toString();\n-\t\tcfg.size = pipeConfig.size;\n+\t\t\t<< \" to \" << pipeConfig.captureSize.toString();\n+\t\tcfg.size = pipeConfig.captureSize;\n \t\tstatus = Adjusted;\n \t}\n \n-\tneedConversion_ = cfg.pixelFormat != pipeConfig.pixelFormat;\n+\tneedConversion_ = cfg.pixelFormat != pipeConfig.pixelFormat\n+\t\t\t|| cfg.size != pipeConfig.captureSize;\n \n \tcfg.bufferCount = 3;\n \n@@ -485,7 +490,7 @@ CameraConfiguration *SimplePipelineHandler::generateConfiguration(Camera *camera\n \t\t       std::inserter(formats, formats.end()),\n \t\t       [](const auto &format) -> decltype(formats)::value_type {\n \t\t\t       const PixelFormat &pixelFormat = format.first;\n-\t\t\t       const Size &size = format.second.size;\n+\t\t\t       const Size &size = format.second.captureSize;\n \t\t\t       return { pixelFormat, { size } };\n \t\t       });\n \n@@ -537,15 +542,18 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n \n \tV4L2DeviceFormat captureFormat = {};\n \tcaptureFormat.fourcc = videoFormat;\n-\tcaptureFormat.size = cfg.size;\n+\tcaptureFormat.size = pipeConfig.captureSize;\n \n \tret = video->setFormat(&captureFormat);\n \tif (ret)\n \t\treturn ret;\n \n-\tif (captureFormat.fourcc != videoFormat || captureFormat.size != cfg.size) {\n+\tif (captureFormat.fourcc != videoFormat ||\n+\t    captureFormat.size != pipeConfig.captureSize) {\n \t\tLOG(SimplePipeline, Error)\n-\t\t\t<< \"Unable to configure capture in \" << cfg.toString();\n+\t\t\t<< \"Unable to configure capture in \"\n+\t\t\t<< pipeConfig.captureSize.toString() << \"-\"\n+\t\t\t<< videoFormat.toString();\n \t\treturn -EINVAL;\n \t}\n \n@@ -556,7 +564,7 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)\n \n \tif (useConverter_) {\n \t\tint ret = converter_->configure(pipeConfig.pixelFormat,\n-\t\t\t\t\t\tcfg.size, &cfg);\n+\t\t\t\t\t\tpipeConfig.captureSize, &cfg);\n \t\tif (ret < 0) {\n \t\t\tLOG(SimplePipeline, Error)\n \t\t\t\t<< \"Unable to configure converter\";\n","prefixes":["libcamera-devel","v2","3/3"]}