summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--abs/core-testing/test-pattern/PKGBUILD16
-rwxr-xr-xabs/core-testing/test-pattern/test_pattern.bash220
2 files changed, 236 insertions, 0 deletions
diff --git a/abs/core-testing/test-pattern/PKGBUILD b/abs/core-testing/test-pattern/PKGBUILD
new file mode 100644
index 0000000..f79ae6a
--- /dev/null
+++ b/abs/core-testing/test-pattern/PKGBUILD
@@ -0,0 +1,16 @@
+pkgname=test-pattern
+pkgver=1.0
+pkgrel=1
+arch=('i686')
+pkgdesc="script to create test pattern videos"
+depends=(imagemagick)
+
+source=(test_pattern.bash)
+
+build() {
+ cd $startdir/src
+# mkdir $startdir/pkg/usr/bin/
+ install -m755 -D test_pattern.bash $startdir/pkg/usr/bin/test_pattern.bash
+}
+
+md5sums=('a6b424b0ebc07574fa5716eced807127')
diff --git a/abs/core-testing/test-pattern/test_pattern.bash b/abs/core-testing/test-pattern/test_pattern.bash
new file mode 100755
index 0000000..9cf3228
--- /dev/null
+++ b/abs/core-testing/test-pattern/test_pattern.bash
@@ -0,0 +1,220 @@
+#!/bin/bash
+
+w=1280
+h=1024
+
+w=1920
+h=1080
+
+w=640
+h=480
+
+barw=$((w/32))
+barstep=$((w/90))
+barstart=$((-barw/barstep-1))
+
+frames=$((w/2))
+
+unit=$((h*2/27))
+gridlw=$((unit*3/43))
+
+nvgrid=$(((h-gridlw)/unit))
+nhgrid=$(((((w-gridlw)/unit)-1)/2*2+1))
+
+gridstartx=$((w/2-(nhgrid*unit+gridlw)/2-1))
+gridstarty=$((h/2-(nvgrid*unit+gridlw)/2-1))
+
+echo nvgrid=$nvgrid
+echo nhgrid=$nhgrid
+echo gridstartx=$gridstartx
+echo gridstarty=$gridstarty
+
+TEMPDIR=./tmp
+if [ ! -d "$TEMPDIR" ] ; then
+ mkdir $TEMPDIR
+fi
+
+#TEMPDIR=$(mktemp -d --tmpdir=/tmp)
+
+unset checker
+checker=( -fill "rgb(192,192,192)" )
+for ((g=-9;g<=7;g=g+2)) ; do
+ checker=( "${checker[@]}"
+ -draw
+ "rectangle $((w/2+g*unit*7/10)),$((gridstarty+unit*3+gridlw)) $((w/2+(g+1)*unit*7/10)),$((gridstarty+unit*4+gridlw))" )
+done
+
+checker=( "${checker[@]}" -fill black )
+for ((g=-8;g<=8;g=g+2)) ; do
+ checker=( "${checker[@]}"
+ -draw
+ "rectangle $((w/2+g*unit*7/10)),$((gridstarty+unit*3+gridlw)) $((w/2+(g+1)*unit*7/10)),$((gridstarty+unit*4+gridlw))" )
+done
+
+unset stripe
+stripe=( -fill white )
+
+for ((g=0;g<5;g++)) ; do
+ startx=$((w/2+(3-g*2)*unit))
+ endx=$((startx+2*unit))
+
+ for ((x=startx;x<endx;x=x+2*(g+1))) ; do
+ stripe=( "${stripe[@]}"
+ -draw
+ "rectangle $x,$((gridstarty+unit*7+gridlw)) $((x+g)),$((gridstarty+unit*9+gridlw))" )
+ done
+done
+
+for ((g=0;g<13;g++)) ; do
+ stripe=( "${stripe[@]}"
+ -draw
+ "rectangle $((gridstartx+(nhgrid/2-6+g)*unit)),$((gridstarty+unit*6+gridlw)) $((gridstartx+(nhgrid/2-6+g)*unit+gridlw)),$((gridstarty+unit*7+gridlw-1))" )
+done
+
+convert -size ${w}x${h} xc:white \
+ -fill "rgb(204,204,0)" \
+ -draw "rectangle $((w/2-6*unit)),$((gridstarty+unit*4+gridlw)) $((w/2-4*unit)),$((gridstarty+unit*6+gridlw))" \
+ -draw "rectangle $((w/2-6*unit)),$((gridstarty+unit*11+gridlw)) $((w/2+6*unit)),$((gridstarty+unit*13+gridlw))" \
+ -fill "rgb(0,204,204)" \
+ -draw "rectangle $((w/2-4*unit)),$((gridstarty+unit*4+gridlw)) $((w/2-2*unit)),$((gridstarty+unit*6+gridlw))" \
+ -fill "rgb(0,204,0)" \
+ -draw "rectangle $((w/2-2*unit)),$((gridstarty+unit*4+gridlw)) $((w/2-0*unit)),$((gridstarty+unit*6+gridlw))" \
+ -fill "rgb(204,0,204)" \
+ -draw "rectangle $((w/2-0*unit)),$((gridstarty+unit*4+gridlw)) $((w/2+2*unit)),$((gridstarty+unit*6+gridlw))" \
+ -fill "rgb(204,0,0)" \
+ -draw "rectangle $((w/2+2*unit)),$((gridstarty+unit*4+gridlw)) $((w/2+4*unit)),$((gridstarty+unit*6+gridlw))" \
+ -draw "rectangle $((w/2-unit/2)),$((gridstarty+unit*11+gridlw)) $((w/2+unit/2)),$((gridstarty+unit*13+gridlw))" \
+ -fill "rgb(0,0,204)" \
+ -draw "rectangle $((w/2+4*unit)),$((gridstarty+unit*4+gridlw)) $((w/2+6*unit)),$((gridstarty+unit*6+gridlw))" \
+\
+ -fill black \
+ -draw "rectangle $((w/2-6*unit)),$((gridstarty+unit*6+gridlw)) $((w/2+6*unit)),$((gridstarty+unit*9+gridlw))" \
+ "${stripe[@]}" \
+ -fill black \
+ -draw "rectangle $((w/2-(unit-gridlw)/2)),$((gridstarty+unit*5+gridlw)) $((w/2+(unit-gridlw)/2-1)),$((gridstarty+unit*8+gridlw))" \
+ -fill white \
+ -draw "rectangle $((w/2-6*unit)),$((h/2-gridlw/2)) $((w/2+6*unit)),$((h/2-gridlw/2+gridlw))" \
+ -draw "rectangle $((w/2-gridlw/2)),$((gridstarty+unit*5+gridlw)) $((w/2-gridlw/2+gridlw)),$((gridstarty+unit*8+gridlw))" \
+\
+ -fill "rgb(0,0,0)" \
+ -draw "rectangle $((w/2-6*unit)),$((gridstarty+unit*9+gridlw)) $((w/2-4*unit)),$((gridstarty+unit*10+gridlw))" \
+ -fill "rgb(51,51,51)" \
+ -draw "rectangle $((w/2-4*unit)),$((gridstarty+unit*9+gridlw)) $((w/2-2*unit)),$((gridstarty+unit*10+gridlw))" \
+ -fill "rgb(102,102,102)" \
+ -draw "rectangle $((w/2-2*unit)),$((gridstarty+unit*9+gridlw)) $((w/2-0*unit)),$((gridstarty+unit*10+gridlw))" \
+ -fill "rgb(153,153,153)" \
+ -draw "rectangle $((w/2-0*unit)),$((gridstarty+unit*9+gridlw)) $((w/2+2*unit)),$((gridstarty+unit*10+gridlw))" \
+ -fill "rgb(204,204,204)" \
+ -draw "rectangle $((w/2+2*unit)),$((gridstarty+unit*9+gridlw)) $((w/2+4*unit)),$((gridstarty+unit*10+gridlw))" \
+ -fill "rgb(255,255,255)" \
+ -draw "rectangle $((w/2+4*unit)),$((gridstarty+unit*9+gridlw)) $((w/2+6*unit)),$((gridstarty+unit*10+gridlw))" \
+\
+ -fill black \
+ -draw "rectangle $((w/2-2*unit)),$((gridstarty+unit*1+gridlw)) $((w/2+2*unit)),$((gridstarty+unit*2+gridlw))" \
+ -draw "rectangle $((w/2-6*unit)),$((gridstarty+unit*2+gridlw)) $((w/2-3*unit)),$((gridstarty+unit*3+gridlw))" \
+ -draw "rectangle $((w/2+6*unit)),$((gridstarty+unit*2+gridlw)) $((w/2+3*unit)),$((gridstarty+unit*3+gridlw))" \
+ -draw "rectangle $((gridstartx+(nhgrid/2-2)*unit)),$((gridstarty+unit*2+gridlw)) $((gridstartx+(nhgrid/2-2)*unit+gridlw)),$((gridstarty+unit*3+gridlw))" \
+ -draw "rectangle $((w/2-3*unit+1)),$((gridstarty+unit*10+gridlw)) $((w/2+3*unit)),$((gridstarty+unit*11+gridlw))" \
+ -fill white \
+ -draw "rectangle $((gridstartx+(nhgrid/2-2)*unit)),$((gridstarty+unit*10+gridlw)) $((gridstartx+(nhgrid/2-2)*unit+gridlw)),$((gridstarty+unit*11+gridlw))" \
+ "${checker[@]}" \
+ ${TEMPDIR}/centre.png
+
+convert -size ${w}x${h} xc:black \
+ -fill white \
+ -draw "circle $((w/2)),$((h/2)) $((w/2)),$((h/2-6*unit))" \
+ ${TEMPDIR}/circle.png
+
+unset drawgrid
+drawgrid=( -fill white )
+for ((g=0;g<=$nhgrid;g++)) ; do
+ drawgrid=( "${drawgrid[@]}"
+ -draw
+ "rectangle $((gridstartx+g*unit)),0 $((gridstartx+g*unit+gridlw)),$h" )
+done
+
+for ((g=0;g<=$nvgrid;g++)) ; do
+ drawgrid=( "${drawgrid[@]}"
+ -draw
+ "rectangle 0,$((gridstarty+g*unit)) $w,$((gridstarty+g*unit+gridlw))" )
+done
+
+drawgrid=( "${drawgrid[@]}"
+ -draw "rectangle 0,0 $gridstartx,$h"
+ -draw "rectangle 0,0 $w,$gridstarty"
+ -draw "rectangle $w,$h $((gridstartx+nhgrid*unit)),0"
+ -draw "rectangle $w,$h 0,$((gridstarty+nvgrid*unit))"
+ -fill black
+)
+
+for ((g=0;g<=$nhgrid;g=g+2)) ; do
+ drawgrid=( "${drawgrid[@]}"
+ -draw
+ "rectangle $((gridstartx+g*unit+gridlw+1)),0 $((gridstartx+(g+1)*unit)),$((gridstarty-1))"
+ -draw
+ "rectangle $((gridstartx+g*unit+gridlw+1)),$((gridstarty+nvgrid*unit+gridlw+1)) $((gridstartx+(g+1)*unit)),$h"
+ )
+done
+
+for ((g=0;g<=$nvgrid;g=g+2)) ; do
+ drawgrid=( "${drawgrid[@]}"
+ -draw
+ "rectangle 0,$((gridstarty+g*unit+gridlw+1)) $((gridstartx-1)),$((gridstarty+(g+1)*unit-1))"
+ -draw
+ "rectangle $((gridstartx+nhgrid*unit+gridlw+1)),$((gridstarty+g*unit+gridlw+1)) $w,$((gridstarty+(g+1)*unit-1))"
+ )
+done
+
+diagonals=(
+ -fill white
+ -linewidth 10
+ -fill white
+ -draw "line 0,0 $((w/2)),$((h-1))"
+ -draw "line 0,0 $((w-1)),$((h/2))"
+ -draw "line 0,$((h-1)) $((w/2)),0"
+ -draw "line 0,$((h-1)) $((w-1)),$((h/2))"
+ -draw "line $((w-1)),0 $((w/2)),$((h-1))"
+ -draw "line $((w-1)),0 0,$((h/2))"
+ -draw "line $((w-1)),$((h-1)) $((w/2)),0"
+ -draw "line $((w-1)),$((h-1)) 0,$((h/2))" )
+
+convert -size ${w}x${h} xc:grey50 \
+ "${diagonals[@]}" \
+ "${drawgrid[@]}" \
+ -fill "rgb(51,153,102)" \
+ -draw "rectangle $((gridstartx+(nhgrid/2-7)*unit+gridlw+1)),$((gridstarty+unit+gridlw+1)) $((gridstartx+(nhgrid/2-6)*unit-1)),$((h/2))" \
+ -fill "rgb(204,102,102)" \
+ -draw "rectangle $((gridstartx+(nhgrid/2-7)*unit+gridlw+1)),$((h/2)) $((gridstartx+(nhgrid/2-6)*unit-1)),$((gridstarty+unit*12-1))" \
+ -fill "rgb(102,102,255)" \
+ -draw "rectangle $((gridstartx+(nhgrid/2-6)*unit)),$((gridstarty+unit+gridlw+1)) $((gridstartx+(nhgrid/2-5)*unit-1)),$((gridstarty+unit*3-1))" \
+ -fill "rgb(153,102,0)" \
+ -draw "rectangle $((gridstartx+(nhgrid/2-6)*unit)),$((gridstarty+10*unit+gridlw+1)) $((gridstartx+(nhgrid/2-5)*unit-1)),$((gridstarty+unit*12-1))" \
+ -fill "rgb(128,128,0)" \
+ -draw "rectangle $((gridstartx+(nhgrid/2+7)*unit+gridlw+1)),$((gridstarty+unit+gridlw+1)) $((gridstartx+(nhgrid/2+8)*unit-1)),$((h/2))" \
+ -fill "rgb(102,102,255)" \
+ -draw "rectangle $((gridstartx+(nhgrid/2+7)*unit+gridlw+1)),$((h/2)) $((gridstartx+(nhgrid/2+8)*unit-1)),$((gridstarty+unit*12-1))" \
+ -fill "rgb(102,102,255)" \
+ -draw "rectangle $((gridstartx+(nhgrid/2+6)*unit+gridlw+1)),$((gridstarty+unit+gridlw+1)) $((gridstartx+(nhgrid/2+7)*unit+gridlw)),$((gridstarty+unit*3-1))" \
+ -fill "rgb(153,102,0)" \
+ -draw "rectangle $((gridstartx+(nhgrid/2+6)*unit+gridlw+1)),$((gridstarty+10*unit+gridlw+1)) $((gridstartx+(nhgrid/2+7)*unit+gridlw)),$((gridstarty+unit*12-1))" \
+ ${TEMPDIR}/grid.png
+
+convert -size ${w}x${h} ${TEMPDIR}/grid.png ${TEMPDIR}/centre.png ${TEMPDIR}/circle.png -composite ${TEMPDIR}/background.png
+
+for ((i=0; i < $frames; i++)) ; do
+
+ image_name=${TEMPDIR}/test$(printf "%03d" $i).jpg
+ echo creating image $image_name
+
+ convert -size ${w}x${h} ${TEMPDIR}/background.png \
+ -fill black \
+ -draw "rectangle $(((barstart+i)*barstep)),0 $(((barstart+i)*barstep+barw)),${h}" \
+ -font Arial-Black-Regular \
+ -pointsize $unit \
+ -fill white \
+ -stroke black -strokewidth 5 -annotate +$((w-2*i))+$((gridstartx+11*unit)) 'Judder Test' \
+ -stroke none -annotate +$((w-2*i))+$((gridstartx+11*unit)) 'Judder Test' \
+ ${image_name}
+done
+
+ffmpeg -i ${TEMPDIR}/test%03d.jpg -y test.mpg