{"id":3810,"url":"https://patchwork.libcamera.org/api/patches/3810/?format=json","web_url":"https://patchwork.libcamera.org/patch/3810/","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":"<20200519030624.15985-2-laurent.pinchart@ideasonboard.com>","date":"2020-05-19T03:06:24","name":"[libcamera-devel,2/2] libcamera: pipeline: simple: Add scaling support","commit_ref":null,"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/3810/mbox/","series":[{"id":911,"url":"https://patchwork.libcamera.org/api/series/911/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=911","date":"2020-05-19T03:06:23","name":"[libcamera-devel,1/2] libcamera: pipeline: simple: converter: Add scaling support","version":1,"mbox":"https://patchwork.libcamera.org/series/911/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3810/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3810/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8A34160E1A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 May 2020 05:06:37 +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 367B59CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 May 2020 05:06:37 +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=\"c3cK/ahS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1589857597;\n\tbh=xHyu2tEdZXAUPTLMxMQkrBCRpYFBAKj9eSrjzxyrQI8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=c3cK/ahS5vWuo4hqZQYxk4mmxQRDIf7NcCp315Mh1DP8uAWUbdDAZYzA3ueN55rev\n\t/iOxcBy+8e7u5FNECqqkg5g3sHcInahZfutb/XeJvCMQTRALdJGAq3FVjOh39eG4Ts\n\twE3chhvUXl+Nxo3nywRwq+KZiHU2Tzqh3nrSfKUI=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 19 May 2020 06:06:24 +0300","Message-Id":"<20200519030624.15985-2-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.26.2","In-Reply-To":"<20200519030624.15985-1-laurent.pinchart@ideasonboard.com>","References":"<20200519030624.15985-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 2/2] 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 03:06:37 -0000"},"content":"Use the converter to implement scaling.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\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 b21ad82e1a05..dbaacbeafefa 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@@ -554,7 +562,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","2/2"]}