sampledata.sh 2.3 KB
Newer Older
1
2
3
4
5
6
7
8
#!/bin/sh
set -e
AEC=../src/aec
CCSDS_DATA=121B2TestData
ALLO=${CCSDS_DATA}/AllOptions
EXTP=${CCSDS_DATA}/ExtendedParameters
LOWE=${CCSDS_DATA}/LowEntropyOptions
archive=121B2TestData.zip
9
archive_url=http://cwe.ccsds.org/sls/docs/SLS-DC/BB121B2TestData/$archive
10
if [ ! -f $archive ]; then
11
12
    type curl >/dev/null 2>&1 || {
        echo >&2 "curl not found. Please download $archive_url by other means and place it in tests.\nAborting."
13
14
        exit 1
    }
15
    curl $archive_url -O || {
16
17
18
        echo >&2 "Could not download $archive_url. Please download $archive by other means and place it in tests. Aborting."
        exit 1
    }
19
fi
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
20
21
22
23
type unzip >/dev/null 2>&1 || {
    echo >&2 "unzip not found. Please install unzip or unpack $archive in tests.\nAborting."
    exit 1
}
24
25
unzip -oq $archive

Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
26
27
28
29
filesize () {
    wc -c $1 | awk '{print $1}'
}

30
decode () {
31
    $AEC -d $3 $1 test.dat
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
32
    cmp -n $(filesize $2) $2 test.dat
33
34
35
}

code () {
36
    $AEC $3 $2 test.rz
37
38
39
40
    cmp $1 test.rz
}

code_size () {
41
    $AEC $3 $2 test.rz
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
42
    if [ ! $(filesize test.rz) -eq $(filesize $1) ]; then
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
        echo "$1 size mismatch"
        exit 1
    fi
}

codec () {
    code "$@"
    decode "$@"
}

cosdec () {
    code_size "$@"
    decode "$@"
}

58
echo All Options
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
59
mv -f ${ALLO}/test_P512n22.dat ${ALLO}/test_p512n22.dat
60
61
for i in 01 02 03 04
do
62
63
64
    uf=$ALLO/test_p256n${i}.dat
    codec $ALLO/test_p256n${i}-basic.rz $uf "-n$i -j16 -r16"
    codec $ALLO/test_p256n${i}-restricted.rz $uf "-n$i -j16 -r16 -t"
65
66
67
done
for i in 05 06 07 08 09 10 11 12 13 14 15 16
do
68
69
    cosdec $ALLO/test_p256n${i}.rz $ALLO/test_p256n${i}.dat \
        "-n$i -j16 -r16"
70
71
72
done
for i in 17 18 19 20 21 22 23 24
do
73
74
    cosdec $ALLO/test_p512n${i}.rz $ALLO/test_p512n${i}.dat \
        "-n$i -j16 -r32"
75
76
77
78
79
80
81
done

echo Low Entropy Options
for i in 1 2 3
do
    for j in 01 02 03 04
    do
82
83
84
        uf=$LOWE/Lowset${i}_8bit.dat
        codec $LOWE/Lowset${i}_8bit.n${j}-basic.rz $uf "-n$j -j16 -r64"
        codec $LOWE/Lowset${i}_8bit.n${j}-restricted.rz $uf "-n$j -j16 -r64 -t"
85
86
87
    done
    for j in 05 06 07 08
    do
88
        codec $LOWE/Lowset${i}_8bit.n${j}.rz $LOWE/Lowset${i}_8bit.dat \
89
            "-n$j -j16 -r64"
90
91
92
93
    done
done

echo Extended Parameters
94
95
decode $EXTP/sar32bit.j16.r256.rz $EXTP/sar32bit.dat "-n32 -j16 -r256 -p"
decode $EXTP/sar32bit.j64.r4096.rz $EXTP/sar32bit.dat "-n32 -j64 -r4096 -p"