summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-09-13 16:13:13 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-09-13 20:17:22 +0300
commit5717f7fdedb200c00e2ce9020198738c20d46c62 (patch)
treeb13a27e31e51b0f3ec4616cb8bf4174c9db77deb /tests
parentb53652e38bb2f5042c743d34392a86759f6f989b (diff)
tests: Add flipping/rotation test with UDS
Insert a UDS in the pipeline to force image partitioning on Gen3 hardware and test all flipping and rotation combinations. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/vsp-unit-test-0016.sh135
1 files changed, 135 insertions, 0 deletions
diff --git a/tests/vsp-unit-test-0016.sh b/tests/vsp-unit-test-0016.sh
new file mode 100755
index 0000000..f4a1508
--- /dev/null
+++ b/tests/vsp-unit-test-0016.sh
@@ -0,0 +1,135 @@
+#!/bin/sh
+
+#
+# Test all combinations of horizontal flip, vertical flip and rotation on WPF.0
+# with image partitioning by inserting a UDS in the pipeline.
+#
+
+source vsp-lib.sh
+
+features="rpf.0 uds wpf.0 wpf.0[control:'Vertical+Flip']"
+optional_features="wpf.0[control:'Horizontal+Flip'] wpf.0[control:'Rotate']"
+
+directions="horizontal vertical rotate"
+dir_horizontal_control="Horizontal+Flip"
+dir_horizontal_label="hflip"
+dir_horizontal_values="0 1"
+dir_vertical_control="Vertical+Flip"
+dir_vertical_label="vflip"
+dir_vertical_values="0 1"
+dir_rotate_control="Rotate"
+dir_rotate_label="rotate"
+dir_rotate_values="0 90"
+
+format="RGB24"
+
+get_var() {
+ echo $(eval echo \$dir_$1_$2)
+}
+
+set_var() {
+ eval dir_$1_$2=$3
+}
+
+get_array_value() {
+ local index=$2
+
+ echo $1 | cut -d ' ' -f $((index+1))
+}
+
+get_array_length() {
+ echo $#
+}
+
+dir_next_value() {
+ # Get the direction name corresponding to the index
+ local direction=$(get_array_value "$supported_directions" $1)
+
+ # Get the current value index and increase it
+ local value=$(get_var $direction index)
+ value=$((value+1))
+
+ # If the index exceeds the possible values array length, reset it to 0.
+ if [ $value -ge $(get_array_length $(get_var $direction values)) ] ; then
+ value=0
+ fi
+
+ # Update the current value index for the direction
+ set_var $direction index $value
+
+ # Return whether we have exceeded the maximum
+ [ $value != 0 ]
+}
+
+dir_set_flipping_control() {
+ local direction=$1
+
+ local index=$(get_var $direction index)
+ local control=$(get_var $direction control)
+ local values=$(get_var $direction values)
+ local value=$(get_array_value "$values" $index)
+
+ vsp1_set_control wpf.0 "$control" $value
+}
+
+test_flipping() {
+ local label=$1
+ local insize=$2
+ local outsize=$3
+
+ test_start "$label $insize -> $outsize"
+
+ pipe_configure rpf-uds
+ format_configure rpf-uds $format $insize $format $outsize
+
+ vsp_runner rpf.0 &
+ vsp_runner wpf.0
+
+ local result=$(compare_frames $label)
+
+ test_complete $result
+}
+
+test_main() {
+ local direction
+
+ for direction in $directions ; do
+ $(vsp1_has_feature "wpf.0[control:'$(get_var $direction control)']") && {
+ set_var $direction index 0
+ supported_directions="$supported_directions $direction"
+ }
+ done
+
+ local dir_max=$(get_array_length $supported_directions)
+ local dir_current=0
+
+ while true ; do
+ # Update all controls
+ local label=
+ for direction in $supported_directions ; do
+ local index=$(get_var $direction index)
+ local values=$(get_var $direction values)
+ local value=$(get_array_value "$values" $index)
+ label="$label $(get_var $direction label)=$value"
+ dir_set_flipping_control $direction
+ done
+
+ test_flipping "$label" 640x480 640x480
+ test_flipping "$label" 640x480 1024x768
+ test_flipping "$label" 1024x768 640x480
+
+ while [ $dir_current -lt $dir_max ] ; do
+ dir_next_value $dir_current && break
+ dir_current=$((dir_current+1))
+ done
+
+ if [ $dir_current -ge $dir_max ] ; then
+ break
+ fi
+
+ dir_current=0
+ done
+}
+
+test_init $0 "$features" "$optional_features"
+test_run