diff mbox series

vin-tests: Add capture script for RDACM21

Message ID 20200916155546.160450-1-jacopo@jmondi.org (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series vin-tests: Add capture script for RDACM21 | expand

Commit Message

Jacopo Mondi Sept. 16, 2020, 3:55 p.m. UTC
Add script to capture from RDACM21 on Eagle V3-M.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 gmsl-rdacm21-yavta.sh | 104 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)
 create mode 100755 gmsl-rdacm21-yavta.sh

--
2.28.0

Comments

Kieran Bingham Sept. 18, 2020, 1:03 p.m. UTC | #1
Hi Jacopo,

On 16/09/2020 16:55, Jacopo Mondi wrote:
> Add script to capture from RDACM21 on Eagle V3-M.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

Can we make this generic in any way with-in gmsl-yavta.sh?

Am I right in thinking only the frame size has changed in this script
against the original?

Perhaps can we read the configuration of the sensor and just propagate
it forwards?

--
Kieran


> ---
>  gmsl-rdacm21-yavta.sh | 104 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 104 insertions(+)
>  create mode 100755 gmsl-rdacm21-yavta.sh
> 
> diff --git a/gmsl-rdacm21-yavta.sh b/gmsl-rdacm21-yavta.sh
> new file mode 100755
> index 0000000..36ba024
> --- /dev/null
> +++ b/gmsl-rdacm21-yavta.sh
> @@ -0,0 +1,104 @@
> +#!/bin/bash
> +
> +base=$(dirname $(readlink -f $0))
> +
> +source $base/scripts/vin-tests.sh
> +source $base/scripts/boards.sh
> +
> +mdev=$(mc_get_mdev)
> +
> +out=$base/output
> +rm -fr $out
> +mkdir $out
> +
> +function conf() {
> +    CSI="$1"
> +    IDX="$2"
> +    VIN="$3"
> +
> +    media-ctl -d $mdev -V "'$CSI':$IDX [fmt:YUYV8_1X16/1280x1080 field:none]"
> +    mc_set_link "$CSI" $IDX "$VIN" 1
> +}
> +
> +function conf_gmsl() {
> +	set -x
> +	MAX9286="max9286 3-0048"
> +
> +    for pad in `seq 0 3`; do
> +		media-ctl -d $mdev -V "'$MAX9286':$pad [fmt:YUYV8_1X16/1280x1080 field:none colorspace:srgb xfer:none ycbcr:601 quantization:full-range]"
> +	done
> +
> +	set +x
> +}
> +
> +function capture() {
> +    VID="$1"
> +    vid=$(eval echo \$$VID)
> +    echo $vid
> +
> +    yavta -f YUYV -s 1280x1080 -c10 --skip 7 --file="$out/$VID-#.bin" /dev/$vid &
> +}
> +
> +mc_reset
> +
> +# Need to configure all formats going through each MAX9286
> +conf1234=0
> +conf5678=0
> +
> +for cam in "$@"; do
> +	case $cam in
> +        1|2|3|4)
> +            if [[ $conf1234 -ne 1 ]]; then
> +                conf  "$csi40name" 1 "$vinname0"
> +                conf  "$csi40name" 2 "$vinname1"
> +                conf  "$csi40name" 3 "$vinname2"
> +                conf  "$csi40name" 4 "$vinname3"
> +                conf1234=1
> +            fi
> +            ;;
> +        5|6|7|8)
> +            if [[ $conf5678 -ne 1 ]]; then
> +                conf  "$csi41name" 1 "$vinname4"
> +                conf  "$csi41name" 2 "$vinname5"
> +                conf  "$csi41name" 3 "$vinname6"
> +                conf  "$csi41name" 4 "$vinname7"
> +                conf5678=1
> +            fi
> +            ;;
> +	    *)
> +		echo "Unrecognised camera $cam"
> +		;;
> +	esac
> +done
> +
> +conf_gmsl
> +
> +for cam in "$@"
> +do
> +	echo "Capturing camera $cam"
> +	case $cam in
> +	    1)	capture vin0 ;;
> +	    2)	capture vin1 ;;
> +	    3)	capture vin2 ;;
> +	    4)	capture vin3 ;;
> +
> +	    5)	capture vin4 ;;
> +	    6)	capture vin5 ;;
> +	    7)	capture vin6 ;;
> +	    8)	capture vin7 ;;
> +
> +	    *)
> +		echo "Unrecognised camera $cam"
> +		;;
> +	esac
> +done;
> +
> +wait
> +
> +for f in $out/*bin; do
> +    name=$(basename $f .bin)
> +    raw2rgbpnm -f YUYV -s 1280x1080 $out/$name.bin $out/$name.ppm
> +    convert $out/$name.ppm $out/$name.png
> +done
> +
> +convert $out/vin*-000007.png -background white -append $out/collage.png
> --
> 2.28.0
>
Niklas Söderlund Oct. 15, 2020, 11:32 p.m. UTC | #2
Hi Jacopo, Kieran,

On 2020-09-18 14:03:51 +0100, Kieran Bingham wrote:
> Hi Jacopo,
> 
> On 16/09/2020 16:55, Jacopo Mondi wrote:
> > Add script to capture from RDACM21 on Eagle V3-M.
> > 
> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> 
> Can we make this generic in any way with-in gmsl-yavta.sh?
> 
> Am I right in thinking only the frame size has changed in this script
> against the original?
> 
> Perhaps can we read the configuration of the sensor and just propagate
> it forwards?

It has long been in my list to rewrite this ugly hack (all of vin-tests) 
with something more competent, maybe something in python? I'm not sure 
when I would find the time tho. Maybe we could do it in steps and have 
something generate a configuration.sh file that is sourced instead 
boards.sh to setup the local environment?

If anyone plans to  work on something like this please let me know. I'm 
also fine accumulating on helper scripts like this in vin-tests as I 
think it brings value in documenting our test setups and what needs to 
be considered if/when something more modular is built to replace it.

> 
> --
> Kieran
> 
> 
> > ---
> >  gmsl-rdacm21-yavta.sh | 104 ++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 104 insertions(+)
> >  create mode 100755 gmsl-rdacm21-yavta.sh
> > 
> > diff --git a/gmsl-rdacm21-yavta.sh b/gmsl-rdacm21-yavta.sh
> > new file mode 100755
> > index 0000000..36ba024
> > --- /dev/null
> > +++ b/gmsl-rdacm21-yavta.sh
> > @@ -0,0 +1,104 @@
> > +#!/bin/bash
> > +
> > +base=$(dirname $(readlink -f $0))
> > +
> > +source $base/scripts/vin-tests.sh
> > +source $base/scripts/boards.sh
> > +
> > +mdev=$(mc_get_mdev)
> > +
> > +out=$base/output
> > +rm -fr $out
> > +mkdir $out
> > +
> > +function conf() {
> > +    CSI="$1"
> > +    IDX="$2"
> > +    VIN="$3"
> > +
> > +    media-ctl -d $mdev -V "'$CSI':$IDX [fmt:YUYV8_1X16/1280x1080 field:none]"
> > +    mc_set_link "$CSI" $IDX "$VIN" 1
> > +}
> > +
> > +function conf_gmsl() {
> > +	set -x
> > +	MAX9286="max9286 3-0048"
> > +
> > +    for pad in `seq 0 3`; do
> > +		media-ctl -d $mdev -V "'$MAX9286':$pad [fmt:YUYV8_1X16/1280x1080 field:none colorspace:srgb xfer:none ycbcr:601 quantization:full-range]"
> > +	done
> > +
> > +	set +x
> > +}
> > +
> > +function capture() {
> > +    VID="$1"
> > +    vid=$(eval echo \$$VID)
> > +    echo $vid
> > +
> > +    yavta -f YUYV -s 1280x1080 -c10 --skip 7 --file="$out/$VID-#.bin" /dev/$vid &
> > +}
> > +
> > +mc_reset
> > +
> > +# Need to configure all formats going through each MAX9286
> > +conf1234=0
> > +conf5678=0
> > +
> > +for cam in "$@"; do
> > +	case $cam in
> > +        1|2|3|4)
> > +            if [[ $conf1234 -ne 1 ]]; then
> > +                conf  "$csi40name" 1 "$vinname0"
> > +                conf  "$csi40name" 2 "$vinname1"
> > +                conf  "$csi40name" 3 "$vinname2"
> > +                conf  "$csi40name" 4 "$vinname3"
> > +                conf1234=1
> > +            fi
> > +            ;;
> > +        5|6|7|8)
> > +            if [[ $conf5678 -ne 1 ]]; then
> > +                conf  "$csi41name" 1 "$vinname4"
> > +                conf  "$csi41name" 2 "$vinname5"
> > +                conf  "$csi41name" 3 "$vinname6"
> > +                conf  "$csi41name" 4 "$vinname7"
> > +                conf5678=1
> > +            fi
> > +            ;;
> > +	    *)
> > +		echo "Unrecognised camera $cam"
> > +		;;
> > +	esac
> > +done
> > +
> > +conf_gmsl
> > +
> > +for cam in "$@"
> > +do
> > +	echo "Capturing camera $cam"
> > +	case $cam in
> > +	    1)	capture vin0 ;;
> > +	    2)	capture vin1 ;;
> > +	    3)	capture vin2 ;;
> > +	    4)	capture vin3 ;;
> > +
> > +	    5)	capture vin4 ;;
> > +	    6)	capture vin5 ;;
> > +	    7)	capture vin6 ;;
> > +	    8)	capture vin7 ;;
> > +
> > +	    *)
> > +		echo "Unrecognised camera $cam"
> > +		;;
> > +	esac
> > +done;
> > +
> > +wait
> > +
> > +for f in $out/*bin; do
> > +    name=$(basename $f .bin)
> > +    raw2rgbpnm -f YUYV -s 1280x1080 $out/$name.bin $out/$name.ppm
> > +    convert $out/$name.ppm $out/$name.png
> > +done
> > +
> > +convert $out/vin*-000007.png -background white -append $out/collage.png
> > --
> > 2.28.0
> > 
>
diff mbox series

Patch

diff --git a/gmsl-rdacm21-yavta.sh b/gmsl-rdacm21-yavta.sh
new file mode 100755
index 0000000..36ba024
--- /dev/null
+++ b/gmsl-rdacm21-yavta.sh
@@ -0,0 +1,104 @@ 
+#!/bin/bash
+
+base=$(dirname $(readlink -f $0))
+
+source $base/scripts/vin-tests.sh
+source $base/scripts/boards.sh
+
+mdev=$(mc_get_mdev)
+
+out=$base/output
+rm -fr $out
+mkdir $out
+
+function conf() {
+    CSI="$1"
+    IDX="$2"
+    VIN="$3"
+
+    media-ctl -d $mdev -V "'$CSI':$IDX [fmt:YUYV8_1X16/1280x1080 field:none]"
+    mc_set_link "$CSI" $IDX "$VIN" 1
+}
+
+function conf_gmsl() {
+	set -x
+	MAX9286="max9286 3-0048"
+
+    for pad in `seq 0 3`; do
+		media-ctl -d $mdev -V "'$MAX9286':$pad [fmt:YUYV8_1X16/1280x1080 field:none colorspace:srgb xfer:none ycbcr:601 quantization:full-range]"
+	done
+
+	set +x
+}
+
+function capture() {
+    VID="$1"
+    vid=$(eval echo \$$VID)
+    echo $vid
+
+    yavta -f YUYV -s 1280x1080 -c10 --skip 7 --file="$out/$VID-#.bin" /dev/$vid &
+}
+
+mc_reset
+
+# Need to configure all formats going through each MAX9286
+conf1234=0
+conf5678=0
+
+for cam in "$@"; do
+	case $cam in
+        1|2|3|4)
+            if [[ $conf1234 -ne 1 ]]; then
+                conf  "$csi40name" 1 "$vinname0"
+                conf  "$csi40name" 2 "$vinname1"
+                conf  "$csi40name" 3 "$vinname2"
+                conf  "$csi40name" 4 "$vinname3"
+                conf1234=1
+            fi
+            ;;
+        5|6|7|8)
+            if [[ $conf5678 -ne 1 ]]; then
+                conf  "$csi41name" 1 "$vinname4"
+                conf  "$csi41name" 2 "$vinname5"
+                conf  "$csi41name" 3 "$vinname6"
+                conf  "$csi41name" 4 "$vinname7"
+                conf5678=1
+            fi
+            ;;
+	    *)
+		echo "Unrecognised camera $cam"
+		;;
+	esac
+done
+
+conf_gmsl
+
+for cam in "$@"
+do
+	echo "Capturing camera $cam"
+	case $cam in
+	    1)	capture vin0 ;;
+	    2)	capture vin1 ;;
+	    3)	capture vin2 ;;
+	    4)	capture vin3 ;;
+
+	    5)	capture vin4 ;;
+	    6)	capture vin5 ;;
+	    7)	capture vin6 ;;
+	    8)	capture vin7 ;;
+
+	    *)
+		echo "Unrecognised camera $cam"
+		;;
+	esac
+done;
+
+wait
+
+for f in $out/*bin; do
+    name=$(basename $f .bin)
+    raw2rgbpnm -f YUYV -s 1280x1080 $out/$name.bin $out/$name.ppm
+    convert $out/$name.ppm $out/$name.png
+done
+
+convert $out/vin*-000007.png -background white -append $out/collage.png