summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/test-pattern
diff options
context:
space:
mode:
authorMichael Hanson <hansonorders@verison.net>2010-04-21 02:00:48 (GMT)
committerMichael Hanson <hansonorders@verison.net>2010-04-21 02:00:48 (GMT)
commit78a3acb31c01c3513fb2ed41165f35532df445cf (patch)
treef8d00ddce7224d26e5b16cf892f02d542c3913a5 /abs/core-testing/test-pattern
parent74e0c0bd66b79a35ac5491ad2714aad4f9712fd6 (diff)
parentba16cf27ca4bf8150cf14735174837c361ec9f5e (diff)
downloadlinhes_pkgbuild-78a3acb31c01c3513fb2ed41165f35532df445cf.zip
linhes_pkgbuild-78a3acb31c01c3513fb2ed41165f35532df445cf.tar.gz
linhes_pkgbuild-78a3acb31c01c3513fb2ed41165f35532df445cf.tar.bz2
Merge branch 'master' of mihanson@knoppmyth.net:LinHES-PKGBUILD
Diffstat (limited to 'abs/core-testing/test-pattern')
-rw-r--r--abs/core-testing/test-pattern/PKGBUILD6
-rwxr-xr-xabs/core-testing/test-pattern/test_pattern.bash97
2 files changed, 88 insertions, 15 deletions
diff --git a/abs/core-testing/test-pattern/PKGBUILD b/abs/core-testing/test-pattern/PKGBUILD
index f79ae6a..db15a0d 100644
--- a/abs/core-testing/test-pattern/PKGBUILD
+++ b/abs/core-testing/test-pattern/PKGBUILD
@@ -1,10 +1,10 @@
pkgname=test-pattern
pkgver=1.0
-pkgrel=1
+pkgrel=4
arch=('i686')
pkgdesc="script to create test pattern videos"
depends=(imagemagick)
-
+license=('GPL')
source=(test_pattern.bash)
build() {
@@ -13,4 +13,4 @@ build() {
install -m755 -D test_pattern.bash $startdir/pkg/usr/bin/test_pattern.bash
}
-md5sums=('a6b424b0ebc07574fa5716eced807127')
+md5sums=('fbe06cf5a38090e2242f4c3e42f3fc7a')
diff --git a/abs/core-testing/test-pattern/test_pattern.bash b/abs/core-testing/test-pattern/test_pattern.bash
index 9cf3228..6e7fff9 100755
--- a/abs/core-testing/test-pattern/test_pattern.bash
+++ b/abs/core-testing/test-pattern/test_pattern.bash
@@ -1,13 +1,52 @@
#!/bin/bash
-w=1280
-h=1024
+# Set default options to be overriden by command line arguments.
-w=1920
-h=1080
+w=400
+h=325
+rate=50
+TEMPDIR=
+unset remove_tempdir
+interlaced=
-w=640
-h=480
+while getopts ":w:h:t:r:i" opt; do
+ case $opt in
+ w)
+ w=$OPTARG
+ ;;
+ h)
+ h=$OPTARG
+ ;;
+ t)
+ TEMPDIR=$OPTARG
+ ;;
+ r)
+ rate=$OPTARG
+ ;;
+ i)
+ interlaced=TRUE
+ ;;
+ \?)
+ echo -n"\
+Error: Invalid option -$OPTARG
+
+Usage:
+ test_pattern.bash [options]
+ -w width
+ The width in pixels.
+ -h height
+ The height in pixels.
+ -t tempdir
+ Temporary directory for intermediate files. If no directory is specified, one is created and deleted at the end of processing.
+ -r framerate
+ -i
+ Generate an interlaced test pattern
+"
+ exit 1
+ esac
+done
+
+# Calculate some dimensions based on the requested size.
barw=$((w/32))
barstep=$((w/90))
@@ -29,12 +68,18 @@ echo nhgrid=$nhgrid
echo gridstartx=$gridstartx
echo gridstarty=$gridstarty
-TEMPDIR=./tmp
-if [ ! -d "$TEMPDIR" ] ; then
- mkdir $TEMPDIR
+echo parsed tempdir $TEMPDIR
+
+if [ -z "$TEMPDIR" ] ; then
+ TEMPDIR=$(mktemp -d --tmpdir=/tmp)
+ remove_tempdir=1
+else
+ if [ ! -d "$TEMPDIR" ] ; then
+ mkdir $TEMPDIR
+ fi
fi
-#TEMPDIR=$(mktemp -d --tmpdir=/tmp)
+echo parsed tempdir $TEMPDIR $remove_tempdir
unset checker
checker=( -fill "rgb(192,192,192)" )
@@ -201,9 +246,16 @@ convert -size ${w}x${h} xc:grey50 \
convert -size ${w}x${h} ${TEMPDIR}/grid.png ${TEMPDIR}/centre.png ${TEMPDIR}/circle.png -composite ${TEMPDIR}/background.png
+if [ -n "$interlaced" ] ; then
+ interlaced_frame=0
+ convert -size 1x${h} -tile-offset +0+1 pattern:gray50 \
+ -scale ${w}x${h}\! ${TEMPDIR}/interlace.png
+fi
+
for ((i=0; i < $frames; i++)) ; do
- image_name=${TEMPDIR}/test$(printf "%03d" $i).jpg
+ prev_image_name=$image_name
+ image_name=${TEMPDIR}/test$(printf "%03d" $i).png
echo creating image $image_name
convert -size ${w}x${h} ${TEMPDIR}/background.png \
@@ -214,7 +266,28 @@ for ((i=0; i < $frames; i++)) ; do
-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' \
+ -depth 8 \
${image_name}
+
+ if [ -n "$interlaced" ] ; then
+ interlaced_frame=$((interlaced_frame + 1))
+
+ if [ $interlaced_frame = 2 ] ; then
+ echo interlacing $((i-1)) and $i
+ interlaced_frame=0
+ convert -size ${w}x${h} -depth 8 $prev_image_name $image_name ${TEMPDIR}/interlace.png -composite ${TEMPDIR}/interlaced$(printf "%03d" $((i/2))).png
+ fi
+ fi
done
-ffmpeg -i ${TEMPDIR}/test%03d.jpg -y test.mpg
+if [ -n "$interlaced" ] ; then
+ ffmpeg -r ${rate} -i ${TEMPDIR}/interlaced%03d.png -r ${rate} \
+ -vcodec mpeg2video -flags +ilme+ildct -y test.mpg
+else
+ ffmpeg -r ${rate} -i ${TEMPDIR}/test%03d.png -r ${rate} \
+ -vcodec mpeg2video -y test.mpg
+fi
+
+if [ -n "$remove_tempdir" ] ; then
+ rm -Rf $TEMPDIR
+fi