source pkgsNeeded.tcl

ui_init "t_thread.tcl"
SetFileTypes

PH "Concurrent image processing"

set sw [poImgUtil NewSwatch]

poImgUtil SetCompressionRGB $RLE $RLE $RLE

set imgsize 1024
set img     [poImage NewImage $imgsize $imgsize]
set imgsave [poImage NewImage $imgsize $imgsize]
$img ReadImage "testIn/keksi$fInfo(suf)" true
$imgsave CopyImage $img

for { set i 1 } { $i <= 4 } { incr i } {
    set fname "testOut/threadBlur${i}$fInfo(suf)"
    set msg   "$fname: Blur filtering by 3 ($i thread)"
    P $msg
    $img CopyImage $imgsave
    poImageMode SetNumThreads $i
    $sw reset
    $sw run
    $img Blur 3
    PSec "Required time" [$sw lookup]
    $img WriteSimple $fname $fInfo(fmt) $fInfo(vsn)
    ui_addimg $img $msg
}

poImgUtil DeleteSwatch $sw
poImgUtil DeleteImg $img
poImgUtil DeleteImg $imgsave

PS
P "End of test"

ui_show

if { [lindex $argv 0] eq "auto" } {
    ui_exit
    exit 0
}
