{"id":16593,"url":"https://patchwork.libcamera.org/api/1.1/patches/16593/?format=json","web_url":"https://patchwork.libcamera.org/patch/16593/","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":"<20220711164413.76229-1-umang.jain@ideasonboard.com>","date":"2022-07-11T16:44:13","name":"[libcamera-devel,RFC] utils: ipu3-process: Stream multiple frames using v4l2-ctl","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ea9ddecf8e99ec65967182afe7492315b08cdaa4","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/1.1/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16593/mbox/","series":[{"id":3271,"url":"https://patchwork.libcamera.org/api/1.1/series/3271/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3271","date":"2022-07-11T16:44:13","name":"[libcamera-devel,RFC] utils: ipu3-process: Stream multiple frames using v4l2-ctl","version":1,"mbox":"https://patchwork.libcamera.org/series/3271/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16593/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16593/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 E0309BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 11 Jul 2022 16:44:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 468F963316;\n\tMon, 11 Jul 2022 18:44:27 +0200 (CEST)","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 BB28D6330F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 11 Jul 2022 18:44:25 +0200 (CEST)","from perceval.ideasonboard.com (unknown\n\t[IPv6:2401:4900:1f3f:b3fb:3712:29bf:7855:376e])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7D0C7326;\n\tMon, 11 Jul 2022 18:44:24 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657557867;\n\tbh=kz6P4jk8D66MRZIjzvaoudIkr/n4DDsHiqanKAD2CLA=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=Bflgfb/uu1ssnoQ3w/NpPuPXxYpjiUy+S5pbuL2Rf8IKFA8cvPZuzy1BfNN8BlxaV\n\tBTnXYMgK1rPlb9WZb/px6O4Y3h7wSCvdcBgPPD2aKpI/TxQRQlhkK4VOCAHBXi7L33\n\tudKlXQB+PChu4bF1yhmi8JTfJ5Twa3FOT1ZETDLwlc52V2wZaPm+5s5yWiwEtLxwmQ\n\tjiDjKwXrPQbT94tu3SghmaQujlMFHpm61RSlmJupsA8Wm9/F9LwdjfXiebYy5alNsZ\n\tTZInf+LhfMS2GHvF3JGAJ2VYah00Ye2lBGQ5qib0n7gHedYTc+/iXk2QaE8SzMzVvG\n\t7p3gG3CNV+pAw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1657557865;\n\tbh=kz6P4jk8D66MRZIjzvaoudIkr/n4DDsHiqanKAD2CLA=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=EieOBzw5mF2+byEYB5OgYodDrmhmdWnHcNqUVhkzaWvlIrr4vEtjYlz9fnM2zJLI1\n\tSfUBbnI5QUquD3vdnTy1jnfcJKNanXRqkAqjTFgwI5ZUJo420TXUCdE+9zDeNgSclx\n\tZN6JVklFqmNj1kUks7H53v7dGNlNpm9m9Da1SEME="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"EieOBzw5\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 11 Jul 2022 22:14:13 +0530","Message-Id":"<20220711164413.76229-1-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH] utils: ipu3-process: Stream multiple\n\tframes using v4l2-ctl","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>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Stream IMGU using v4l2-ctl as it provides more granular controls\non the video nodes. The goal here is to stream a single input\nfile containing multiple frames in 10-bit IPU3 packed bayer format.\nSuch a input file can be created using the ipu3-pack utility.\n\nThis patch enables the IMGU's parameter node as well in\nconfigure_pipeline() without which, the input node won't stream\nsuccessive input frames.\n\nThe viewfinder and output nodes will still stream using yavta, so\nno changes required there.\n\nIt's is quite tricky to stream input and parameters nodes synchronously\nwith v4l2-ctl commands for each. The patch overcomes this short-coming\nby streaming both the nodes endlessly until both of them are killed.\nA sleep of 1 second is introduced to make sure $frame_count buffers\nare captured on the output and vf nodes.\n\nAnother short-coming of this patch is when specific parameter-buffer(s)\n(from a file) are needed to streamed on the parameters node, this might\nrequire some adjusting. For now, the parameters node streams with\nun-assigned buffers. It depends on the decision how this script is\nexpanded further down the line.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n utils/ipu3/ipu3-process.sh | 29 ++++++++++++++++++++++++-----\n 1 file changed, 24 insertions(+), 5 deletions(-)","diff":"diff --git a/utils/ipu3/ipu3-process.sh b/utils/ipu3/ipu3-process.sh\nindex bb4abbe8..48466d70 100755\n--- a/utils/ipu3/ipu3-process.sh\n+++ b/utils/ipu3/ipu3-process.sh\n@@ -37,11 +37,13 @@ configure_pipeline() {\n \tlocal enable_3a=1\n \tlocal enable_out=1\n \tlocal enable_vf=1\n+\tlocal enable_param=1\n \tlocal mode=0\n \n \t# Configure the links\n \t$mediactl -r\n \t$mediactl -l \"\\\"$imgu_entity input\\\":0 -> \\\"$imgu_entity\\\":0[1]\"\n+\t$mediactl -l \"\\\"$imgu_entity parameters\\\":0 -> \\\"$imgu_entity\\\":1[$enable_param]\"\n \t$mediactl -l \"\\\"$imgu_entity\\\":2 -> \\\"$imgu_entity output\\\":0[$enable_out]\"\n \t$mediactl -l \"\\\"$imgu_entity\\\":3 -> \\\"$imgu_entity viewfinder\\\":0[$enable_vf]\"\n \t$mediactl -l \"\\\"$imgu_entity\\\":4 -> \\\"$imgu_entity 3a stat\\\":0[$enable_3a]\"\n@@ -76,9 +78,26 @@ process_frames() {\n \t$yavta $($mediactl -e \"$imgu_entity 3a stat\") &\n \tsleep 0.5\n \n-\t# Feed the IMGU input.\n-\t$yavta -f $IMGU_IN_PIXELFORMAT -s $in_size \"-F$in_file\" \\\n-\t\t$($mediactl -e \"$imgu_entity input\")\n+\techo \"Feeding IMGU $in_size\"\n+\t# Start stream parameters node first\n+\tv4l2-ctl -d$($mediactl -e \"$imgu_entity parameters\") --stream-out-mmap &\n+\tlocal param_streaming=$!\n+\n+\t# Start streaming on input node\n+\tlocal width=$(echo $in_size | awk -F 'x' '{print $1}')\n+\tlocal height=$(echo $in_size | awk -F 'x' '{print $2}')\n+\tv4l2-ctl -d $($mediactl -e \"$imgu_entity input\") \\\n+                --set-fmt-video-out=width=$width,height=$height,pixelformat=$IMGU_IN_PIXELFORMAT \\\n+                --stream-out-mmap --stream-from=$in_file --stream-loop &\n+\tlocal input_streaming=$!\n+\n+\t# Sleep for 1 second and then kill the IMGU streaming. By then $frame_count output and vf\n+\t# buffers should have been captured.\n+\tsleep 1\n+\tkill $input_streaming\n+\tkill $param_streaming\n+\n+\techo \"IMGU FED\"\n }\n \n # Convert captured files to ppm\n@@ -98,7 +117,7 @@ convert_files() {\n }\n \n run_test() {\n-\tIMGU_IN_PIXELFORMAT=IPU3_SGRBG10\n+\tIMGU_IN_PIXELFORMAT=ip3G\n \tIMGU_OUT_PIXELFORMAT=NV12\n \tIMGU_VF_PIXELFORMAT=NV12\n \n@@ -193,6 +212,6 @@ mediactl=\"media-ctl -d $mdev\"\n echo \"Using device $mdev\"\n \n output_dir=\"/tmp\"\n-frame_count=5\n+frame_count=10\n nbufs=7\n run_test\n","prefixes":["libcamera-devel","RFC"]}