Commit Graph

2 Commits

Author SHA1 Message Date
Bill Thiede 2d4fb25c34 images: fix Decode when resize + rotate + max W/H.
Adds more tests to cover rotations with resize when used with
MaxWidth/MaxHeight, previously only ScaledWidth/ScaledHeight were
tested.

Improve tests to compare bounds when determining equality, otherwise
an image sized 0x0 is equal to all other images.

Sort test image filenames so test order is stable and obvious.

Keep more data in memory when indexing images upon receive.  Some
largish CR2 files need more data or the EXIF parsing will fail.

Should address some or all of https://camlistore.org/issue/274

Change-Id: I80d90c33538c9d62ce4480ccb58c003e18ee6629
2013-12-16 10:01:07 -08:00
Bill Thiede 59ab7e0075 pkg/images: add benchmark for resizing images.
Sample run on my computer:
$ go test -bench . -benchmem
PASS
BenchmarkRescale1000To50              50          45211076 ns/op           92224 B/op          3 allocs/op
BenchmarkRescale1000To100             50          45182185 ns/op          364608 B/op          3 allocs/op
BenchmarkRescale1000To200             50          46602272 ns/op         1445952 B/op          3 allocs/op
BenchmarkRescale1000To400             50          61513579 ns/op         5763136 B/op          3 allocs/op
BenchmarkRescale1000To800             20         104372086 ns/op        23040064 B/op          3 allocs/op
BenchmarkRescale2000To50              10         179838094 ns/op           92224 B/op          3 allocs/op
BenchmarkRescale2000To100             10         180684898 ns/op          364608 B/op          3 allocs/op
BenchmarkRescale2000To200             10         181488279 ns/op         1445952 B/op          3 allocs/op
BenchmarkRescale2000To400             10         186902466 ns/op         5763136 B/op          3 allocs/op
BenchmarkRescale2000To800             10         246418484 ns/op        23040064 B/op          3 allocs/op
BenchmarkRescale4000To50            2000           1305587 ns/op          133251 B/op          5 allocs/op
BenchmarkRescale4000To100            500           5179999 ns/op          528512 B/op          5 allocs/op
BenchmarkRescale4000To200            100          20733512 ns/op         2089088 B/op          5 allocs/op
BenchmarkRescale4000To400             20          82820323 ns/op         8323200 B/op          5 allocs/op
BenchmarkRescale4000To800              5         333289471 ns/op        33280128 B/op          5 allocs/op
BenchmarkRescale8000To50            2000           1397384 ns/op          133251 B/op          5 allocs/op
BenchmarkRescale8000To100            500           5219709 ns/op          528515 B/op          5 allocs/op
BenchmarkRescale8000To200            100          20863617 ns/op         2089089 B/op          5 allocs/op
BenchmarkRescale8000To400             20          83260367 ns/op         8323200 B/op          5 allocs/op
BenchmarkRescale8000To800              5         331035176 ns/op        33280128 B/op          5 allocs/op
ok      camlistore.org/pkg/images       46.780s

Change-Id: Iab21f28f06681faf44b01a75c3bb8b23fb508a81
2013-12-08 22:39:49 -08:00