Patch Detail
Show a patch.
GET /api/patches/16988/?format=api
{ "id": 16988, "url": "https://patchwork.libcamera.org/api/patches/16988/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16988/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220805181850.848886-2-umang.jain@ideasonboard.com>", "date": "2022-08-05T18:18:46", "name": "[libcamera-devel,1/5] utils: ipu3-process: Stream multiple frames using v4l2-ctl", "commit_ref": null, "pull_url": null, "state": "deferred", "archived": false, "hash": "7b34cfb61c94681107ab314726563fa8d7e69077", "submitter": { "id": 86, "url": "https://patchwork.libcamera.org/api/people/86/?format=api", "name": "Umang Jain", "email": "umang.jain@ideasonboard.com" }, "delegate": { "id": 12, "url": "https://patchwork.libcamera.org/api/users/12/?format=api", "username": "uajain", "first_name": "Umang", "last_name": "Jain", "email": "umang.jain@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/16988/mbox/", "series": [ { "id": 3378, "url": "https://patchwork.libcamera.org/api/series/3378/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3378", "date": "2022-08-05T18:18:45", "name": "IMGU standalone streaming", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3378/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16988/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16988/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 756E0BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 5 Aug 2022 18:19:02 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2EFE86332F;\n\tFri, 5 Aug 2022 20:19:02 +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 5DFFC603F0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 5 Aug 2022 20:18:59 +0200 (CEST)", "from perceval.ideasonboard.com (unknown\n\t[IPv6:2401:4900:1f3e:69e0:a479:4ccc:ab2a:bf48])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 57AF0480;\n\tFri, 5 Aug 2022 20:18:58 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659723542;\n\tbh=jUULhcV8lDdhRTK48rcn6x/3aLIjh+YoUlTmj2AV7DI=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=02u2k3SIjDOzBfQEkMEMJsxvPUUJE+HCNc1J7Zj4j8AAWa2RULQxFnMM0yXzN6oGB\n\t0qjxXHby6WwGOnC8f49eq8FvjaAaUhj7nM6Yk4cTp88L9a5nVNoTZdRIwoUbkcxoSG\n\tcecSREUBnLK+HIfxSA2ZYLAAHW5da3El5/BvrJixVKJPO3UywfXw9JFtB0D1bIbKYf\n\tOHgADpPLpV6Gl6MlFsdshtKi6UMuHnl4XCeFya8q63uXCHaoxAECxsQDYDaK0W/qzo\n\tXM/bHqUGWZyWgYJdThzr5H5OppjQum4wMnRWAYs65SNHVxpX9sSiixOTJXfXK5GVZm\n\tFpsk+tGaHds8A==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1659723539;\n\tbh=jUULhcV8lDdhRTK48rcn6x/3aLIjh+YoUlTmj2AV7DI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ZIlBqN2mlARrcrZnbkHHYMugiYNhgxzcHCnA+rseitdux6/9Ph4s6WrgV3YU89CqU\n\tjEhZBp+3A76mJje47j9RP3igec851JgdBmjD3KyczF6QhU52AwCkH+KGkTqhHvZGui\n\tpi+YAep9sV4u11PKdpijEH76cVAVF0t8/Lo8aPjU=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ZIlBqN2m\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 5 Aug 2022 23:48:46 +0530", "Message-Id": "<20220805181850.848886-2-umang.jain@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20220805181850.848886-1-umang.jain@ideasonboard.com>", "References": "<20220805181850.848886-1-umang.jain@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 1/5] 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 an 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\nyavta commands have been replaced with equivalent v4l2-ctl commands.\nAlso the v4l2-ctl outputs a single file(--stream-to=<file>) as opposed\nto yavta's one frame per file, so the conversion via raw2pnm needed\nadjusting. raw2pnm will now read from a single input file (produced\nas a result of v4l2-ctl ... --stream-to<file>) and use the bytes\noffset to output separate frames.\n\nLastly, $nbufs have reduced to 4 and $frame_count has been increased to\n10.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n utils/ipu3/ipu3-process.sh | 54 +++++++++++++++++++++++++++-----------\n 1 file changed, 38 insertions(+), 16 deletions(-)", "diff": "diff --git a/utils/ipu3/ipu3-process.sh b/utils/ipu3/ipu3-process.sh\nindex bb4abbe8..828a72f8 100755\n--- a/utils/ipu3/ipu3-process.sh\n+++ b/utils/ipu3/ipu3-process.sh\n@@ -11,7 +11,7 @@\n #\n # - media-ctl (from v4l-utils git://linuxtv.org/v4l-utils.git)\n # - raw2pnm (from nvt https://github.com/intel/nvt.git)\n-# - yavta (from git://git.ideasonboard.org/yavta.git)\n+# - v4l2-ctl (from http://git.linuxtv.org/v4l-utils.git)\n \n imgu_entity=\"ipu3-imgu 0\"\n \n@@ -37,17 +37,19 @@ 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 \n \t# Select processing mode (0 for video, 1 for still image)\n-\tyavta --no-query -w \"0x009819c1 $mode\" $($mediactl -e \"$imgu_entity\")\n+\tv4l2-ctl -d $($mediactl -e \"$imgu_entity\") -c 0x009819c1=$mode\n \n \t# Set formats. The media bus code doesn't matter as it is ignored by the\n \t# driver. We should use the FIXED format, but media-ctl doesn't support\n@@ -62,23 +64,41 @@ configure_pipeline() {\n process_frames() {\n \tconfigure_pipeline\n \n-\tlocal yavta=\"yavta -n $nbufs -c$frame_count\"\n+\tlocal stream_setting=\" --stream-mmap $nbufs --stream-count=$frame_count\"\n+\tlocal out_width=$(echo $out_size | awk -F 'x' '{print $1}')\n+\tlocal out_height=$(echo $out_size | awk -F 'x' '{print $2}')\n+\tlocal vf_width=$(echo $vf_size | awk -F 'x' '{print $1}')\n+\tlocal vf_height=$(echo $vf_size | awk -F 'x' '{print $2}')\n+\tlocal in_width=$(echo $in_size | awk -F 'x' '{print $1}')\n+\tlocal in_height=$(echo $in_size | awk -F 'x' '{print $2}')\n \n \t# Save the main and viewfinder outputs to disk, capture and drop 3A\n-\t# statistics. Sleep 500ms between each execution of yavta to keep the\n+\t# statistics. Sleep 500ms between each execution of v4l2-ctl to keep the\n \t# stdout messages readable.\n-\t$yavta -f $IMGU_OUT_PIXELFORMAT -s $out_size \"-F$output_dir/frame-out-#.bin\" \\\n-\t\t$($mediactl -e \"$imgu_entity output\") &\n+\tv4l2-ctl -d$($mediactl -e \"$imgu_entity output\") \\\n+\t\t--set-fmt-video=pixelformat=$IMGU_OUT_PIXELFORMAT,width=$out_width,height=$out_height \\\n+\t\t$stream_setting --stream-to=$output_dir/frames-out.bin &\n \tsleep 0.5\n-\t$yavta -f $IMGU_VF_PIXELFORMAT -s $vf_size \"-F$output_dir/frame-vf-#.bin\" \\\n-\t\t$($mediactl -e \"$imgu_entity viewfinder\") &\n+\tv4l2-ctl -d$($mediactl -e \"$imgu_entity viewfinder\") \\\n+\t\t--set-fmt-video=pixelformat=$IMGU_OUT_PIXELFORMAT,width=$vf_width,height=$vf_height \\\n+\t\t$stream_setting --stream-to=$output_dir/frames-vf.bin &\n \tsleep 0.5\n-\t$yavta $($mediactl -e \"$imgu_entity 3a stat\") &\n+\tv4l2-ctl -d $($mediactl -e \"$imgu_entity 3a stat\") $stream_setting &\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+\n+\t# To stream out $frame_count on output and vf nodes, input and parameters nodes need to atleast\n+\t# stream ($frame_count + $nbufs) frames.\n+\tlocal in_stream_count=$(expr $nbufs + $frame_count)\n+\tv4l2-ctl -d $($mediactl -e \"$imgu_entity input\") \\\n+\t\t--set-fmt-video-out=width=$in_width\\,height=$in_height\\,pixelformat=$IMGU_IN_PIXELFORMAT \\\n+\t\t--stream-out-mmap $nbufs --stream-from=$in_file --stream-count=$in_stream_count \\\n+\t\t--stream-loop --stream-poll &\n+\n+\t# The input node would not stream until parameters start streaming.\n+\tv4l2-ctl -d$($mediactl -e \"$imgu_entity parameters\") --stream-out-mmap 1 \\\n+\t\t--stream-count=$in_stream_count --stream-poll\n }\n \n # Convert captured files to ppm\n@@ -92,13 +112,15 @@ convert_files() {\n \tlocal height=$(echo $size | awk -F 'x' '{print $2}')\n \tlocal padded_width=$(expr $(expr $width + 63) / 64 \\* 64)\n \n-\traw2pnm -x$padded_width -y$height -f$format \\\n-\t\t$output_dir/frame-$type-$index.bin \\\n+\tlocal bytes_offset=$(expr $index \\* $(expr $padded_width \\* $height \\* 12) / 8)\n+\techo $bytes_offset\n+\traw2pnm -x$padded_width -y$height -f$format -b $bytes_offset \\\n+\t\t$output_dir/frames-$type.bin \\\n \t\t$output_dir/frame-$type-$index.ppm\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 +215,6 @@ mediactl=\"media-ctl -d $mdev\"\n echo \"Using device $mdev\"\n \n output_dir=\"/tmp\"\n-frame_count=5\n-nbufs=7\n+frame_count=10\n+nbufs=4\n run_test\n", "prefixes": [ "libcamera-devel", "1/5" ] }