#############################################################################
# $Id: test.tcl,v 1.1 2006-01-17 14:27:50+01 rolf Exp rolf $
#############################################################################
catch {console show; wm withdraw .}

# tile=0, img=1, MSB=20, real EUROPA image, rate=11 (1 tile / 1 frame)
set Europa0 340067360100249041203B51C71E1902830E802101E016A82100003BF000640103AD840180000624B0630100C898E0203CC730006716004C800CF0007800013A0320EE29E88D006044001820040448C2001EE0010000091CA3802C86E5A000D600180400E0C8C800E000B00301F02620040E0E8070600000D01A4B521589CBDC0100000170C1964400700040000000000900208126780800FD9D450880A4D80C206E80000000318B30830000000080090000000019003D40A0F2EF51642CC2CD183508202000FE0902000037010085262980278246B400CC03000180800A4A00B052FF3D7E292E6F7010057D71D664B0804E10CEA48796636208C3F0
package ifneeded Decoder 0.1 {
    load Debug/Decoder.dll
}
package require Decoder
puts "Decoder version [package versions Decoder]"

decoder::new_img 1024 1024 64
# decoder::new_img 64 64 64

# real EUROPA image, see above
set data [binary format H* $::Europa0]
decoder::swap data

# tile=0, img=3, MSB=10
#    set data [binary format H* 006A]abcdefghijklmnopqrstuvwxyz

# tile=97, img=3, MSB=21
#    set data [binary format H* 6175]abcdefghijklmnopqrstuvwxyz
set result [decoder::decode_tile $data]
puts "Decoding result=$result, End at bitplane [expr $result/3]/[expr $result%3]"

set data [decoder::get_img]
binary scan [string range $data 0 19] s* x
puts "After decode:"
puts $x

decoder::wavelet_rev

set data [decoder::get_img]
puts "size=[string length $data] 2MB=[expr 1024*1024*2]"
binary scan [string range $data 0 19] s* x
puts "After wavelet:"
puts $x

set out [open x.raw w]
fconfigure $out -translation binary
puts -nonewline $out $data
close $out
