diff options
author | Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> | 2016-08-17 16:38:02 +0000 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2017-03-03 20:02:53 +0200 |
commit | d6d7d83cc612d786d4211c0a73398e171580498c (patch) | |
tree | f355768a769f671616862d7b0d776e421dd3cf79 | |
parent | 264b400e43a910f016627e0682d681f3623985a6 (diff) |
tests: Add HGT test
Test HGT histogram during video streaming.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | README | 2 | ||||
-rwxr-xr-x | scripts/vsp-lib.sh | 59 | ||||
-rwxr-xr-x | tests/vsp-unit-test-0023.sh | 40 |
3 files changed, 98 insertions, 3 deletions
@@ -45,7 +45,7 @@ system in a directory included in $PATH. * yavta (available at git://git.ideasonboard.org/yavta.git) All but the HGO and CLU/LUT tests can be run with the latest version of these -tools. To test the HGO and CLU/LUT, the 'vsp' branch of 'yavta' is currently +tools. To test the HGO, HGT and CLU/LUT, the 'vsp' branch of 'yavta' is currently needed. The following tool is additionally required to run some of the tests. If the diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh index fd3ce55..726ff79 100755 --- a/scripts/vsp-lib.sh +++ b/scripts/vsp-lib.sh @@ -189,8 +189,12 @@ reference_histogram() { local format=$2 local size=$3 local type=$4 + local hgt_hue_areas=$5 - $genimage -i $format -f $format -s $size -H $file --histogram-type $type \ + local hue= + [[ "x$hgt_hue_areas" != x ]] && hue="--histogram-areas $hgt_hue_areas" + + $genimage -i $format -f $format -s $size -H $file --histogram-type $type $hue \ frames/frame-reference-1024x768.pnm } @@ -322,6 +326,7 @@ compare_histogram() { } compare_histograms() { + local hgt_hue_areas=$__vsp_hgt_hue_areas local format=$__vsp_wpf_format local type=$__vsp_histo_type local wpf=$__vsp_wpf_index @@ -329,7 +334,7 @@ compare_histograms() { local fmt=$(echo $format | tr '[:upper:]' '[:lower:]') local size=$(vsp1_entity_get_size wpf.$wpf 1) - reference_histogram ${frames_dir}ref-histogram.bin $format $size $type + reference_histogram ${frames_dir}ref-histogram.bin $format $size $type $hgt_hue_areas local result="pass" for histo in ${frames_dir}histo-*.bin ; do @@ -399,6 +404,16 @@ pipe_rpf_hst() { $mediactl -d $mdev -l "'$dev wpf.0':1 -> '$dev wpf.0 output':0 [1]" } +pipe_rpf_hgt() { + $mediactl -d $mdev -l "'$dev rpf.0':1 -> '$dev hst':0 [1]" + $mediactl -d $mdev -l "'$dev hst':1 -> '$dev hgt':0 [1]" + $mediactl -d $mdev -l "'$dev hst':1 -> '$dev hsi':0 [1]" + $mediactl -d $mdev -l "'$dev hsi':1 -> '$dev wpf.0':0 [1]" + $mediactl -d $mdev -l "'$dev wpf.0':1 -> '$dev wpf.0 output':0 [1]" + + __vsp_wpf_index=0 +} + pipe_rpf_lut() { $mediactl -d $mdev -l "'$dev rpf.0':1 -> '$dev lut':0 [1]" $mediactl -d $mdev -l "'$dev lut':1 -> '$dev wpf.0':0 [1]" @@ -604,6 +619,24 @@ format_rpf_hgo() { __vsp_wpf_format=$1 } +format_rpf_hgt() { + local format=$(format_v4l2_to_mbus $1) + local size=$2 + local crop=${3:+crop:$3} + local compose=${4:+compose:$4} + + $mediactl -d $mdev -V "'$dev rpf.0':0 [fmt:$format/$size]" + $mediactl -d $mdev -V "'$dev hst':0 [fmt:$format/$size]" + $mediactl -d $mdev -V "'$dev hgt':0 [fmt:$format/$size $crop $compose]" + $mediactl -d $mdev -V "'$dev hsi':0 [fmt:$format/$size]" + $mediactl -d $mdev -V "'$dev wpf.0':0 [fmt:$format/$size]" + $mediactl -d $mdev -V "'$dev wpf.0':1 [fmt:$format/$size]" + + __vsp_histo_type=hgt + __vsp_rpf_format=$1 + __vsp_wpf_format=$1 +} + format_rpf_lut() { local format=$(format_v4l2_to_mbus $1) local size=$2 @@ -785,6 +818,18 @@ format_configure() { } # ------------------------------------------------------------------------------ +# Module-specific configuration +# + +hgt_configure() { + local hue_areas=$1 + + vsp1_set_control hgt 'Boundary Values for Hue Area' "{$hue_areas}" + + __vsp_hgt_hue_areas=$hue_areas +} + +# ------------------------------------------------------------------------------ # Frame capture and output # @@ -863,6 +908,12 @@ vsp_runner() { buffers=10 ;; + hgt) + videodev=$(vsp1_entity_subdev "hgt histo") + file="${frames_dir}histo-#.bin" + buffers=10 + ;; + rpf.*) videodev=$(vsp1_entity_subdev "$entity input") format=$__vsp_rpf_format @@ -893,6 +944,10 @@ vsp_runner_find() { videodev=$(vsp1_entity_subdev "hgo histo") ;; + hgt) + videodev=$(vsp1_entity_subdev "hgt histo") + ;; + rpf.*) videodev=$(vsp1_entity_subdev "$entity input") ;; diff --git a/tests/vsp-unit-test-0023.sh b/tests/vsp-unit-test-0023.sh new file mode 100755 index 0000000..0c61a5e --- /dev/null +++ b/tests/vsp-unit-test-0023.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# +# Test 2D histogram generation. Use a RPF -> HST -> HSI -> WPF pipeline +# with the HGT hooked up at the HST output. +# + +source vsp-lib.sh + +features="hgt hsi hst rpf.0 wpf.0" + +test_histogram() { + local hue_areas=$1 + + test_start "histogram HGT with hue areas $hue_areas" + + pipe_configure rpf-hgt + format_configure rpf-hgt RGB24 1024x768 + hgt_configure "$hue_areas" + + vsp_runner hgt & + vsp_runner rpf.0 & + vsp_runner wpf.0 + + result=$(compare_histograms $hue_areas) + + test_complete $result +} + +test_main() { + test_histogram "0,255,255,255,255,255,255,255,255,255,255,255" + test_histogram "0,40,40,80,80,120,120,160,160,200,200,255" + test_histogram "220,40,40,80,80,120,120,160,160,200,200,220" + test_histogram "0,10,50,60,100,110,150,160,200,210,250,255" + test_histogram "10,20,50,60,100,110,150,160,200,210,230,240" + test_histogram "240,20,60,80,100,120,140,160,180,200,210,220" +} + +test_init $0 "$features" +test_run |