Skip to content

Commit

Permalink
Testing convolution filter with and without parallelization
Browse files Browse the repository at this point in the history
  • Loading branch information
disintegration committed Dec 19, 2015
1 parent 5b564e5 commit ba7583a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions convolution_test.go
Expand Up @@ -186,15 +186,17 @@ func TestConvolution(t *testing.T) {
}

for _, d := range testData {
src := image.NewNRGBA(d.srcb)
src.Pix = d.srcPix
for _, parallel := range []bool{true, false} {
src := image.NewNRGBA(d.srcb)
src.Pix = d.srcPix

f := Convolution(d.kernel, d.normalize, d.alpha, d.abs, d.delta)
dst := image.NewNRGBA(f.Bounds(src.Bounds()))
f.Draw(dst, src, nil)
f := Convolution(d.kernel, d.normalize, d.alpha, d.abs, d.delta)
dst := image.NewNRGBA(f.Bounds(src.Bounds()))
f.Draw(dst, src, &Options{Parallelization: parallel})

if !checkBoundsAndPix(dst.Bounds(), d.dstb, dst.Pix, d.dstPix) {
t.Errorf("test [%s] failed: %#v, %#v", d.desc, dst.Bounds(), dst.Pix)
if !checkBoundsAndPix(dst.Bounds(), d.dstb, dst.Pix, d.dstPix) {
t.Errorf("test [%s] failed: %#v, %#v", d.desc, dst.Bounds(), dst.Pix)
}
}
}

Expand Down

0 comments on commit ba7583a

Please sign in to comment.