sampledata.sh 1.64 KB
Newer Older
1 2 3
#!/bin/sh
set -e
AEC=../src/aec
4
CCSDS_DATA=${srcdir}/data/121B2TestData
5 6 7 8
ALLO=${CCSDS_DATA}/AllOptions
EXTP=${CCSDS_DATA}/ExtendedParameters
LOWE=${CCSDS_DATA}/LowEntropyOptions

Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
9 10 11 12
filesize () {
    wc -c $1 | awk '{print $1}'
}

13
decode () {
14
    $AEC -d $3 $1 test.dat
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
15
    cmp -n $(filesize $2) $2 test.dat
16 17 18
}

code () {
19
    $AEC $3 $2 test.rz
20 21 22 23
    cmp $1 test.rz
}

code_size () {
24
    $AEC $3 $2 test.rz
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
25
    if [ ! $(filesize test.rz) -eq $(filesize $1) ]; then
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
        echo "$1 size mismatch"
        exit 1
    fi
}

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

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

41 42 43
echo All Options
for i in 01 02 03 04
do
44 45 46
    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"
47 48 49
done
for i in 05 06 07 08 09 10 11 12 13 14 15 16
do
50 51
    cosdec $ALLO/test_p256n${i}.rz $ALLO/test_p256n${i}.dat \
        "-n$i -j16 -r16"
52 53 54
done
for i in 17 18 19 20 21 22 23 24
do
55 56
    cosdec $ALLO/test_p512n${i}.rz $ALLO/test_p512n${i}.dat \
        "-n$i -j16 -r32"
57 58 59 60 61 62 63
done

echo Low Entropy Options
for i in 1 2 3
do
    for j in 01 02 03 04
    do
64 65 66
        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"
67 68 69
    done
    for j in 05 06 07 08
    do
70
        codec $LOWE/Lowset${i}_8bit.n${j}.rz $LOWE/Lowset${i}_8bit.dat \
71
            "-n$j -j16 -r64"
72 73 74 75
    done
done

echo Extended Parameters
76 77
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"