|
|
@@ -3,16 +3,14 @@ package resize
|
|
|
import (
|
|
|
"image"
|
|
|
"image/color"
|
|
|
- "image/png"
|
|
|
- "os"
|
|
|
- //"runtime"
|
|
|
+ "runtime"
|
|
|
"testing"
|
|
|
)
|
|
|
|
|
|
var img = image.NewGray16(image.Rect(0, 0, 3, 3))
|
|
|
|
|
|
func init() {
|
|
|
- //runtime.GOMAXPROCS(runtime.NumCPU())
|
|
|
+ runtime.GOMAXPROCS(runtime.NumCPU())
|
|
|
img.Set(1, 1, color.White)
|
|
|
}
|
|
|
|
|
|
@@ -125,21 +123,3 @@ func Benchmark_LargeJpegThumbLanczos2(b *testing.B) {
|
|
|
func Benchmark_LargeJpegThumbLanczos3(b *testing.B) {
|
|
|
jpegThumb(b, Lanczos3)
|
|
|
}
|
|
|
-
|
|
|
-func Benchmark_LargeN(b *testing.B) {
|
|
|
- file, _ := os.Open("M94A0467.png")
|
|
|
- defer file.Close()
|
|
|
- img, _ := png.Decode(file)
|
|
|
- var output image.Image
|
|
|
-
|
|
|
- b.ResetTimer()
|
|
|
- for i := 0; i < b.N; i++ {
|
|
|
- output = Resize(900, 0, img, Bicubic)
|
|
|
- }
|
|
|
- b.StopTimer()
|
|
|
-
|
|
|
- output.At(0, 0)
|
|
|
- outPng, _ := os.Create("out.png")
|
|
|
- defer outPng.Close()
|
|
|
- png.Encode(outPng, output)
|
|
|
-}
|