Reseting checkAvailability each run uncovered the fact that
CAMLI_DISABLE_DEBUG wasn't being properly reset, which affected later
tests.
Change-Id: I19b790ef8182b1bc2d54cbf33fa9dfe84dbe3903
Return error of type ErrDjpegFailed when djpeg or parsing the PNM returned
fails.
Attempt to decode image again with standard library.
Change-Id: I2a0cb7b52885732b7cbbffb8e34993d232781bc0
The new package pkg/images/fastjpeg uses djpeg(1) to quickly
down-sample images at load time as described here:
http://jpegclub.org/djpeg/
Add benchmark comparing std lib jpeg.Decode and fastjpeg.DecodeDownsample
with a factor of 1, 2, 4, and 8.
Benchmark resizes a 4000x4000 pixel JPEG to 128x128.
Refactor in pkg/images to make images.Decode a little more readable.
Change-Id: I571db1f3c3068f99da4a01ec84fd246ef098a18c
And quiet noisy logging on normal write failures.
We can now stress test the thumbnail generation by setting
CAMLI_DISABLE_THUMB_CACHE=1 which will make all the thumbnails in the
browsers be unique, and not write them to cache on the server.
Then, when we're happy with the thumbnails, we just increment the
thumbnailVersion string and that busts all the browser- and
server-side caches.
Change-Id: I3cda8e85ab8b1b0b2c9113f6dff613dfbf736028
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
Makes the assumption that our old image logic was 'If the image is
huge (>2400px) shrink it to twice the target thumbnail size with
resample (which is quick) then box filter the image in half (which is
slow)'. There was a bug there that was causing large intermediary
images to be allocated when the source image was just the right size
and in portrait orientation (mainly trigger by photos from my Nexus 4).
Generalizes resize code to always resample to 2 times the thumbnail
size and then smooth down. Throws more pixels away faster.
Add downsizing routines that operate inplace. This greatly reduces
our peak memory usage when generating thumbnails.
Add version optimized for our particular resize case (halving);
providing a speed boost over the generalized versions.
Add tests and benchmarks comparing new resize to old.
Test for pkg/misc/resize can be run with --output=output_dir/ to see
the images generated by the old and new resize routines along with
mask of their differences.
Addresses some of the concerns in https://camlistore.org/issue/237
Change-Id: I6464fa637da9db371f15761bb699c045604b6cb8
Running 'go run dev/envvardoc/envvardoc.go' now shows:
'All environment variables are documented'
I also took the liberty of cleaning-up our mishmash of logic for handling
boolean environment variables, and cleaned up a couple other spots that didn't
seem right.
This change adds docmentation for all variables starting with (CAM|DEV|AWS).
This leaves some variables still undocumented. If there are variables worth
documenting in the following list, maybe we should rename them to have a
CAM{LI} prefix for consistency's sake:
APPDATA pkg/osutil/paths.go:86
APPDATA pkg/osutil/paths.go:102
DISPLAY pkg/misc/gpgagent/gpgagent.go:126
GOPATH pkg/fileembed/genfileembed/genfileembed.go:321
GOPATH pkg/osutil/paths.go:168
GOPATH pkg/test/world.go:54
GOPATH server/appengine/build_test.go:77
GPGKEY cmd/camput/init.go:77
GPG_AGENT_INFO cmd/camput/init.go:153
GPG_AGENT_INFO pkg/misc/gpgagent/gpgagent.go:50
HOME pkg/jsonsign/keys.go:79
HOME pkg/jsonsign/signhandler/sig.go:64
HOME pkg/osutil/paths.go:36
HOMEPATH pkg/osutil/paths.go:34
PKG_CONFIG_PATH pkg/index/sqlite/dbschema.go:59
RUN_BROKEN_TESTS pkg/fs/fs_test.go:67
SKIP_DEP_TESTS pkg/test/testdep.go:29
TERM pkg/misc/gpgagent/gpgagent.go:133
TERM pkg/misc/pinentry/pinentry.go:99
TESTING_PORT_WRITE_FD pkg/webserver/webserver.go:135
TEST_GPGAGENT_LIB pkg/misc/gpgagent/gpgagent_test.go:27
USER pkg/netutil/ident.go:135
USER pkg/osutil/paths.go:45
USERNAME pkg/jsonconfig/eval.go:228
USERNAME pkg/osutil/paths.go:43
VERBOSE_FUSE pkg/fs/fs_test.go:133
VERBOSE_FUSE_STDERR pkg/fs/fs_test.go:137
XDG_CONFIG_HOME pkg/osutil/paths.go:104
Change-Id: Ief28710d3deefd1e65247cb5d3b1d8dde73e1f2d
images: DecodeConfig to get the predicted width
and height after EXIF correction
search&index: add GetImageInfo and use it in search
to predict the thumbnail dimensions
http://camlistore.org/issue/115
Change-Id: I358136a2ab03ea09c8f8fd2fa0dc574921c819c5
This allows to know after a call to images.Decode if the image
was actually rotated or flipped.
Without knowing this, when making a thumbnail, it could happen
(if there was no rescaling required) that an image that needed
being rotated/flipped would not get rotated, because
useBytesUnchanged would still be true.
Change-Id: Ifc5e1e1f5a8543e6754102e3b3a685b736ae8673
This change implements rotation and flipping on images.
It can be done automatically, using the EXIF Orientation as a hint,
or optionally forced.
Change-Id: I97e887599d6a191964344e81cf8e90922313d958