Commit Graph

620 Commits

Author SHA1 Message Date
James Zern
3cdec847a5 vwebp: normalize the number of .'s in the help message
Change-Id: Iadaa5a8f64cd8093eeeaf829ba609bef034d63b5
2016-06-24 19:29:43 -07:00
James Zern
bdf6241e70 cwebp: normalize the number of .'s in the help message
Change-Id: I0208c01a671bd822ee707c6d8ead3d5348b3e2c6
2016-06-24 19:29:43 -07:00
Pascal Massimino
97b9e64459 normalize the number of .'s in the help message
Change-Id: I2dbb36cbdc3cb93364d9e1dd6da10d3a5f9470af
2016-06-23 16:06:09 -07:00
James Zern
bb50bf42b0 pngdec,ReadFunc: throw an error on invalid read
convert the assert() to an error check to avoid crashing when reading
malformed files.

BUG=webp:302

Change-Id: I25eed9cab5c0a439bd3411beacc83f3a27af2bbf
2016-06-22 23:09:30 -07:00
Pascal Massimino
d77b877cc9 introduce a common signature for all image reader function
-> WebPImageReader

Introduce a variant of image-guessing function that returns a reader
directly: WebPGuessImageReader()

Change-Id: I5ddc53024fcf941e33d997b2be6aa1a963d939ab
2016-06-01 22:51:41 +00:00
Pascal Massimino
ae2a7222ce collect all decoding utilities from examples/ in libexampledec.a
adds a generic examples/image_dec.[ch] entry point too.

WebPGuessImageType() can be used to infer image type.

Change-Id: I8337e7b6ad91863c9cf118e4791668d2d175079b
2016-06-01 05:39:55 +00:00
Pascal Massimino
ab8d669887 ReadWebP: avoid conversion to ARGB if final format is YUVA
Adds ExUtilCopyPlane() in example_utils.[ch], borrowed from
src/util/utils.h

(removes a TODO)

Change-Id: Iadfc19da3914c9439608f296e86225d279263566
2016-05-26 05:49:16 +00:00
Urvang Joshi
47dd07080f anim_diff: Add an experimental option for max inter-frame diff.
After the introduction of lossy frame rectangles
we need equivalent option in anim_diff for merging similar frames.

Change-Id: I1d03acace396ec4cb0212586c6e8b8ec5b0b0bfc
2016-04-06 17:25:19 -07:00
Urvang Joshi
f80400843f gif2webp: Remove the 'prev_to_prev_canvas' buffer.
This was never used.

Change-Id: Icf50e658418b851af7b6c9c3f552cdfdfa68d6ae
2016-03-31 20:58:37 -07:00
Pascal Massimino
abdb109f3b add extra meaning to WebPDecBuffer::is_external_memory
If value is '2', it means the buffer is a 'slow' one, like GPU-mapped memory.

This change is backward compatible (setting is_external_memory to 2
will be a no-op in previous libraries)

dwebp:  add flags to force a particular colorspace format
new flags is:
   -pixel_format {RGB,RGBA,BGR,BGRA,ARGB,RGBA_4444,RGB_565,
                  rgbA,bgrA,Argb,rgbA_4444,YUV,YUVA}
and also,external_memory {0,1,2}
These flags are mostly for debuggging purpose, and hence are not documented.

Change-Id: Iac88ce1e10b35163dd7af57f9660f062f5d8ed5e
2016-03-09 09:00:13 +01:00
James Zern
8200643017 anim_util: quiet static analysis warning
in ReadAnimatedWebP() frame_index is tied to the reported frame_count.

Change-Id: I69241e5d77a0b8bac1deabd992d0ad2ecf51a4ec
2016-02-23 11:13:38 -08:00
Pascal Massimino
4ed650a13d force "-pass 6" if -psnr or -size is used but -pass isn't.
This is to prevent users shooting in the foot using -psnr or
-size alone and not getting the expected result.

Change-Id: I67a3289e4ec0a2a813c98807f2ec5e600f52dc63
2016-02-13 10:22:32 +01:00
James Zern
5e122bd6d6 gif2webp: set enc_options.verbose = 0 w/-quiet
Change-Id: I4852d18f7c04f1f48684459f0ac5b002a8c2f27b
2016-02-01 17:00:51 -08:00
James Zern
4b025f10f7 Merge "configure: disable asserts by default" 2015-12-17 22:28:37 +00:00
James Zern
b4106c44b0 anim_diff: add brief description of options
Change-Id: I193d3d94704c008edea7ae40349a8fbff2b5ede6
2015-12-16 20:36:15 -08:00
James Zern
b9d80fa4e8 configure: disable asserts by default
--enable-asserts can be used to avoid defining NDEBUG

Change-Id: I6216668e3f79f69bd8c453f0b36cecb3b585688e
2015-12-16 13:15:53 -08:00
Pascal Massimino
46bb1e34b0 Merge "gifdec: remove utils.h include" 2015-12-12 13:39:59 +00:00
James Zern
4077d9447b gifdec: remove utils.h include
though visible WebPCopyPlane & WebPCopyPixels are not part of the public
api; avoid using a private header within this public module.

Change-Id: I5c8615fcc07090ffaa8933b00af418d8431936eb
2015-12-11 19:34:52 -08:00
James Zern
64da45a9d3 cosmetics, cwebp: fix indent
Change-Id: Iaab63050193d43ccd7e10bb5bdfff20ec3361ce0
2015-12-11 16:40:23 -08:00
James Zern
79fcf29af8 wicdec: add support for reading from stdin
This adds stdin support to cwebp when built with WIC support

Change-Id: I3f8b0321322e6fb08af60ac5297cbd448e6547db
2015-12-08 19:04:22 -08:00
Pascal Massimino
a9947c3244 cwebp: add support for stdin input
we map the input file into memory, even in the non-stdin case.
This is less efficient than letting the png/jpeg/... decoding libraries
use fread()'s, but more general.

Change-Id: I4501cb9a1daf69593eb8e3326c115cd8cbdf92fd
2015-12-08 12:45:41 +01:00
Pascal Massimino
4c60f63c64 make ReadPNG and ReadJPEG take a filename instead of a FILE
-> read is a bit slower (memory allocation and such) than reading directly from disk.

-> we're not yet ready to accept stdin as input (-- -) because we still need to guess
the file type with GetImageType(). And since we can't rewind on stdin, this will need
a bit more work before being able to read from stdin.

Change-Id: I6491fac4b07d28d1854518325ead88669656ddbf
2015-12-06 09:23:17 +01:00
Pascal Massimino
3391459590 vwebp: work around the transparent background with GLUT bug
we setenv XLIB_SKIP_ARGB_VISUALS=1 before any GLUT call.

Change-Id: I4cff5b6c6155d5a074fa22fe56219f241558666e
2015-12-03 10:36:21 +01:00
Pascal Massimino
d73d1c8b73 Merge "Make discarding invisible RGB values (cleanup alpha) the default." 2015-11-22 07:46:59 +00:00
Lode Vandevenne
1f9be97c22 Make discarding invisible RGB values (cleanup alpha) the default.
Rename the flag to exact instead of the opposite cleanup_alpha. Add the flag to
WebPConfig. Do the cleanup in the webp encoder library rather than the cwebp
binary, this will be needed for the next stage: smarter alpha cleanup for
better compression which cannot be done as a preprocessing due to depending on
predictor choices in the encoder.

Change-Id: I2fbf57f918a35f2da6186ef0b5d85e5fd0020eef
2015-11-21 12:32:32 -08:00
Lode Vandevenne
f240117bef Make dwebp listen more to the -quiet flag
it was still printing "Saved file ...".

Change-Id: Ie450535d9d54b4ac213e486ab7f3c50761fefe2a
2015-11-21 11:58:28 -08:00
Urvang Joshi
397863bd66 Refactor CopyPlane() and CopyPixels() methods: put them in utils.
Change-Id: I0e1533df557a0fa42c670e3b826fc0675c36e0a5
2015-11-13 11:39:22 -08:00
Pascal Massimino
1c1702d818 use ExReadFile() for ReadYUV()
this allows read-from-stdin.

+ report error on invalid -s option

Change-Id: I0cbb2e7ab95442f9fa5891b47fc3ab71ca07d78b
2015-11-12 16:12:21 -08:00
Urvang Joshi
c13245c7d8 AnimEncoder: Add a GetError() method.
We now get error string instead of printing it.
The verbose option is now only used to print info and warnings.

Change-Id: I985c5acd427a9d1973068e7b7a8af5dd0d6d2585
2015-11-11 16:14:09 -08:00
Urvang Joshi
3584abca16 AnimDecoder: option to decode to common color modes.
Change-Id: I77ddab9abe3c4b35a9bcfe4c90b3e43d3aef166d
2015-11-10 09:27:59 -08:00
Pascal Massimino
96201e50ea migrate anim_diff tool from C++ to C89
+ jenkins fixes for native config (library order)
+ add a missing -lm
+ replace log10 by log, just in case
+ partially reverted configure.ac to remove the C++ part

Change-Id: Iee099c544451b23c6cfaca53d5a95d2d332e066e
2015-11-09 18:12:06 -08:00
Pascal Massimino
922268fdd4 s/TIFF/WebP
Change-Id: I0850bba7fe24af92ed246b72dcb87d9a8a4a8598
2015-10-28 02:04:28 -07:00
Pascal Massimino
7861578bd6 for ReadXXXX() image-readers, use the value of pic->use_argb
This is to infer the needed conversion to YUV(A) or RGB(A).

This is useful to avoid some conversion steps between ARGB and YUVA.
For instance, if the input file is a JPEG, we decode to RGB and
convert to YUV right away, without the intermediate step to ARGB.

The only caveat is that cropping/scaling might give slightly different result,
because of YUV420 downsampling. Therefore, we omit this feature
at cwebp level, when -crop or -rescale is used.

Change-Id: I5a3abe5108982f2a4570e841e3d9baffc73f5bee
2015-10-27 22:54:11 +01:00
Pascal Massimino
469ba2cdfd vwebp: fix incorrect clipping w/NO_BLEND
when the previous frame does not specify dispose to background only the
current frame's rectangle should be cleared

related to bug #245

Change-Id: I2fc4f5be99057e0bf87d8fedec57b06859b070bd
2015-10-23 12:18:39 -07:00
James Zern
badfcbaa1e wicdec: fix alpha detection w/64bpp BGRA/RGBA
Change-Id: Ia712cf736e490d482a52b63d8e2816d0b7035cd0
2015-10-08 20:33:33 -07:00
Pascal Massimino
0dd282672e Merge "Add delta_palettization feature to WebP" 2015-10-03 05:42:36 +00:00
Mislav Bradac
48f66b6687 Add delta_palettization feature to WebP
Change-Id: Ibaf4e49aa67d63d0eb11848cca4fd0c60815864a
2015-10-02 14:29:54 -07:00
Urvang Joshi
27933e2a8e anim_encoder: drop a frame if it has same pixels as the prev frame.
Earlier, we stored a 1x1 frame for such frames. Now, we drop every such
frame and increase the duration of its previous frame instead.

Also, modify the anim_diff tool to handle animated images that are
equivalent, but have different number of frames.

Change-Id: I2688b1771e1f5f9f6a78e48ec81b01c3cd495403
2015-10-01 11:14:49 -07:00
Pascal Massimino
df9f6ec829 Merge "webpmux/DisplayInfo: send non-error output to stdout" 2015-09-26 05:36:40 +00:00
James Zern
cc020a8c96 webpmux/DisplayInfo: send non-error output to stdout
Change-Id: I4ed0d10e4a7cbc8f2d204b33a483990f1ace58ff
2015-09-25 18:49:08 -07:00
James Zern
c4c3cf2d0e pngdec: fix type conversion warnings
Change-Id: I1719cbed4521b492d3504a8a478cdd395060d43e
2015-09-25 18:43:01 -07:00
James Zern
bef8e97d5d webpmux: fix type conversion warning
Change-Id: I65de23f376570346a9489c2116a0effa60345157
2015-09-25 18:42:31 -07:00
Urvang Joshi
d39dc8f3cc Create a WebPAnimDecoder API.
This is designed for the simple use-case where one wants to decode all
frames one-by-one in order.

Also, use this API in anim_util library, which is in turn used by
anim_diff tool.

Change-Id: Ie8b653c04e867d40fd23321b3dd41b87689656c7
2015-09-02 16:23:10 -07:00
skal
03fb75221c gif2webp: print output file size
Change-Id: I6ce367baa209911f1c07d23ca6283fcb3fe1d7a4
2015-08-24 17:36:57 -07:00
skal
41a5d99d55 add a -quiet option to 'dwebp'
(useful for tests)

Change-Id: Ia07f407bc1e819a1d3cab64a02317d058733261b
2015-08-17 20:07:46 -07:00
James Zern
1e595fe1e8 dwebp: add -resize as a synonym for -scale
-resize is used in cwebp for the same purpose

Change-Id: I2756f3d23c4799fc9a10c4fe8c4c17057beebca9
2015-08-13 22:46:02 -07:00
skal
56a2e9f5e7 WebPPictureDistortion: support ARGB format for 'pic' when computing distortion.
using a *tmp_plane buffer to split a/r/g/b planes up appeared to
be the easiest route, compared to copy-pasting the whole code and
making it x_stride aware...

Change-Id: I0898ef1df62bd3e1713b77187b31b5eeef3832fe
2015-08-11 17:28:29 -07:00
Pascal Massimino
acb297e9c2 anim_diff: add a -raw_comparison flag
If this flag is not used, RGB is premultiplied before comparison.
Otherwise, the raw R/G/B values are compared, which can be a problem
in transparent area (alpha=0 R/G/B=anything)

Change-Id: I131cc10ec92414ad508b81f599a60d0097cac470
2015-08-06 20:29:14 -07:00
Urvang Joshi
acd7b5af0f Introduce a test tool anim_diff.
It can be used to test if given pair of animated images (GIF and/or
WebP) are identical in terms of pixel match and other animation
properties.

Change-Id: I84adea145e9d062be6ad06a0d4fcdc9658cf52d4
2015-05-06 17:17:03 -07:00
Urvang Joshi
feab45ef99 gifdec: Move inclusion of webp/config.h to header.
Given that we are checking GIFLIB_MAJOR etc in the header, we need the
config in header.

Change-Id: I5d502bd67555752a57589a8ce789efcf0945d72e
2015-04-17 12:43:17 -07:00
James Zern
b69a6c35b2 vwebp: don't redefine snprintf with VS2015+
Change-Id: I30a4ad2f57e931bc11d0b73feaee4db686f79f4d
2015-04-14 16:36:54 -07:00
Urvang Joshi
d484555024 AnimEncoder API: Use timestamp instead of duration as input to Add().
When converting from video sources, the duration of current frame
is often unavailable until the next frame. So, we internally convert
timestamps to durations.

Change-Id: I20ad86361c22e014be7eb91f00d5d40108281351
2015-04-14 12:00:57 -07:00
James Zern
6cef0e4fa4 examples/Android.mk: add webpmux_example target
renamed from 'webpmux' to avoid name clash with the library module name

Change-Id: I33bbdbdcb25a6f35bd85c9a0dbbb93b2428b05f3
2015-02-25 16:38:21 -08:00
James Zern
1579de3cae vwebp: clear canvas at the beginning of each loop
this is in line with the recommendation in the spec, cf.,
5603947 webp-container-spec: clarify background clear on loop

Change-Id: Id3910395b05a1a1f2804be841b61f97bd4bac593
2015-02-05 22:52:09 -08:00
Vikas Arora
4c82284d2e Updated the near-lossless level mapping.
Updated the near-lossless level mapping and make it correlated to lossy
quality i.e 100 => minimum loss (in-fact no-loss) and the visual-quality loss
increases with decrease in near-lossless level (quality) till value 0.

The new mapping implies following (PSNR) loss-metric:
-near_lossless 100: No-loss (bit-stream same as -lossless).
-near_lossless  80: Very very high PSNR (around 54dB).
-near_lossless  60: Very high PSNR (around 48dB).
-near_lossless  40: High PSNR (around 42dB).
-near_lossless  20: Moderate PSNR (around 36dB).
-near_lossless   0: Low PSNR (around 30dB).

Change-Id: I930de4b18950faf2868c97d42e9e49ba0b642960
2015-02-05 11:17:14 -08:00
Urvang Joshi
fe42739cc8 Use integers for kmin/kmax for simplicity.
Change-Id: I62237975d663641552107759af8d2d329b70a7c4
2015-02-03 13:57:52 -08:00
James Zern
2c906c407c vwebp: remove unnecessary static Help() prototype
all uses occur after its declaration

Change-Id: I775642ce6d1dec3bc6da2fa0d5d87490992c7e6c
2015-02-02 23:35:01 -08:00
James Zern
0f017b56f3 vwebp/animation: display last frame on end-of-loop
previously the first frame would be redisplayed, which might be
unexpected if the final frame was meant to be a composite, for example.

Change-Id: I4da795623c71501e2fa426e8fba8fb2ffcbab58a
2015-02-02 20:05:54 -08:00
Vikas Arora
98c8138663 Enable Near-lossless feature.
Enable the WebP near-lossless feature by pre-processing the image to smoothen
the pixels.

On a 1000 PNG image corpus, for which WebP lossless (default settings) gets
25% compression gains, following is the performance of near-lossless feature
at various '-near_lossless' levels:
-near_lossless 90: 30% (very very high PSNR 54-60dB)
-near_lossless 75: 38% (very high PSNR 48-54dB)
-near_lossless 50: 45% (high PSNR 42-48dB)
-near_lossless 25: 48% (moderate PSNR 36-42dB)
-near_lossless 10: 50% (PSNR 30-36dB)

WebP near-lossless is specifically useful for discrete-tone images like
line-art, icons etc.

Change-Id: I7d12a2c9362ccd076d09710ea05c85fa64664c38
2015-01-29 16:10:20 -08:00
pascal massimino
b8c2013512 Merge "wicdec: (msvs) quiet some /analyze warnings" 2015-01-17 12:15:16 -08:00
James Zern
9b228b5416 wicdec: (msvs) quiet some /analyze warnings
add additional return checks and asserts to avoid:
C6102: Using 'XXX' from failed function call ...

Change-Id: I51f5fa630324e0cd7b2d9fceefecb4f4021474b1
2015-01-17 11:50:47 -08:00
James Zern
7a191398ca dwebp/WritePNG: mark png variables volatile
these are used on both sides of the setjmp().

Change-Id: I4a789bfb3a5d56946a22286c5a140008d90e1ba2
2015-01-16 19:26:32 -08:00
James Zern
775dfad297 dwebp: include setjmp.h w/WEBP_HAVE_PNG
setjmp() is used in WritePNG().

Change-Id: Iadd836272fc7d368d635c891507ce2a08c4d3dec
2015-01-16 19:26:21 -08:00
James Zern
47d26be760 dwebp: correct sign in format strings
width / height are unsigned; fixes a warning with msvs /analyze:
C6340: Mismatch on sign: 'const unsigned int' passed as _Param_(4) when
some signed type is required in call to 'fprintf'.

Change-Id: I5f1fad4c93745baf17d70178a5e66579ccd2b155
2015-01-16 19:26:20 -08:00
Urvang Joshi
d1c4ffae89 gif2webp: Move GIF decoding related code to a support library.
Change-Id: Ifa5e663eb0db7e1e08174fe6608bd45950281abb
2015-01-13 17:07:33 -08:00
Urvang Joshi
0f54f1ec5f Remove gif2webp_util which is no longer needed.
Change-Id: I5e1237ab250273bc1e6fb4c422fb502f8ca8aeb6
2015-01-09 13:06:29 -08:00
James Zern
ac79ed19ef webpmux: remove experimental fragment handling
Change-Id: I1c418b76b43dfb20cbf7f97d7011ca0d76472ba0
2015-01-08 20:03:51 -08:00
Urvang Joshi
67720c8bde Move over gif2webp to the new AnimEncoder API.
As frame disposal and blending are GIF specific, they are handled in gif2webp
itself now.

Change-Id: Idcf557bd48edf5c283ce7fef151789c3ffb8ce12
2015-01-08 03:47:00 -08:00
Urvang Joshi
5cccdadf2e FlattenSimilarBlocks should only be tried when blending is possible.
This is because, FlattenSimilarBlocks() replaces some opaque pixels by
transparent ones. This results in an equivalent output only if blending
is turned on for the current frame.

Change-Id: I05612c952fdbd4b3a6e0ac9f3a7d49822f0cfb9b
2014-11-05 10:44:07 -08:00
Urvang Joshi
7489b0e72b gif2webp: Add '-min-size' option to get best compression.
This disables key-frame insertion and tries both dispose methods for
each frame.

Change-Id: Ib167747198fd1d98cb93321f76826e91228f24d8
2014-10-30 15:17:09 -07:00
Urvang Joshi
c94ed49efd gif2webp: Use the default hint instead of WEBP_HINT_GRAPH.
This is much faster and the compression is slightly better too.

Change-Id: Ibf0d10eea83bfabfcc44ee497074767462ff41b1
2014-10-27 16:41:39 -07:00
Urvang Joshi
65e5eb8a62 gif2webp: Support GIF_DISPOSE_RESTORE_PREVIOUS
Tweaked the gif2webp_util API to support this.

Requested in: https://code.google.com/p/webp/issues/detail?id=144

Change-Id: I0e8c4edc39227355cd8d3acc55795186e25d0c3a
2014-10-22 17:02:07 -07:00
Urvang Joshi
e4c829efe9 gif2webp: Handle frames with odd offsets + disposal to background.
Snapping odd offsets in GIF to even offsets in WebP was causing extra row/column
being disposed in such cases.

Code is rewritten to maintain previous and current canvas (it used to maintain
previous canvas and current frame earlier). And we recompute change rectangles
as those from GIF may no longer apply.
Also, this renders methods like ReduceTransparency() and ConvertToKeyFrame()
redundant, as internally maintained current canvas is always independent of
previous canvases.

Disposal method choice: we pick the disposal method that results in the smallest
change rectangle.

Change-Id: Ic31186d98fe1a2a790a89d1571b17e3abd127e79
2014-10-22 15:43:26 -07:00
James Zern
54edbf65ff stopwatch.h: fix includes
WEBP_INLINE -> webp/types.h
memcpy -> string.h

Change-Id: Iab2ea8b553dc98be75eede751de62ab0292d1f97
2014-10-22 17:25:41 +02:00
Pascal Massimino
f358eeb891 add code for testing random incremental decoding in dwebp
(protected with WEBP_EXPERIMENTAL_FEATURES flag)

Change-Id: I6cc2488810ce2ccd5d45882bd12f34a3d0c8eab8
2014-10-16 17:01:32 +02:00
Urvang Joshi
0cc811d7d6 gif2webp: Background color correction
For some GIF images, the first frame is missing the corresponding
graphic control extension. For such cases, we were never calling
GetBackgroundColor(), and default background color value (white) was being used
incorrectly.
So, we call GetBackgroundColor() when we encounter the first image
descriptor instead, to make sure that it is always called.

Change-Id: I00fc8e943d8a0c1578dcd718f3e74dec7de4ed61
2014-09-18 15:07:28 -07:00
Vikas Arora
b901416b90 Record the lossless size stats.
Record and show the lossless header and image data sizes in the cwebp.

Change-Id: I08f19693cb7a756b6fdce5b55d71f5367b5f02fc
2014-09-17 15:16:05 -07:00
James Zern
924fcfd900 Merge "webpmux: simplify InitializeConfig()" 2014-09-12 00:43:06 -07:00
James Zern
c0a462cac2 webpmux: simplify InitializeConfig()
put WebPMuxConfig on the stack in main() rather than allocating it in
InitializeConfig(); removes a level of indirection there.

Change-Id: I81d386f7472ebbd322dd3fdbfda9d78dbeb62a66
2014-09-12 00:23:06 -07:00
James Zern
6986bb5e12 webpmux: fix indent
+ remove unnecessary cast

Change-Id: I2070fbe6aeda49f5790c69390e5b539a2c1a5616
2014-09-12 00:11:56 -07:00
James Zern
f89e1690df webpmux: fix exit status on numeric value parse error
in most cases 'ok' is set via a goto macro

Change-Id: I17c832446bf3e716d3bcd323dbcc72bec544029c
2014-09-12 00:10:09 -07:00
pascal massimino
2172cb626a Merge "webpmux: fix loop_count range check" 2014-09-11 23:02:37 -07:00
pascal massimino
e3b343ece7 Merge "examples: warn on invalid numeric parameters" 2014-09-11 23:02:18 -07:00
James Zern
0e23c487da webpmux: fix loop_count range check
explicitly check [0, 65535], the use of 'long' was removed in a prior
commit

Change-Id: I70d5bf286908459b5d4d619c657853f0e833b6ea
2014-09-11 15:26:11 -07:00
Urvang Joshi
d51f3e4069 gif2webp: Handle frames with missing graphic control extension
According to the GIF spec (http://www.w3.org/Graphics/GIF/spec-gif89a.txt),
this block is optional, and its scope is only the first graphic rendering block
that follows.

The spec doesn't mention what default values of frame dimensions, offsets,
duration and transparent index to use in such a case, though. So, we use the
defaults used by GIF reader in Chromium:
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.h&l=186

Change-Id: Iecc6967847192483770e85ac15fe2835cd01ce7b
2014-09-11 14:35:21 -07:00
James Zern
96d43a873a examples: warn on invalid numeric parameters
add ExUtilGet[U]Int / ExUtilGetFloat which print an error message on
parse failure.
fixes issue #219.

Change-Id: Ie537f5aebd138925bf1a48289b6b5e261b3af2ca
2014-09-11 11:18:28 -07:00
James Zern
a6140194ff ExUtilReadFromStdin: (windows) open stdin in bin mode
fixes input/decode from stdin in the examples

Change-Id: Ie8052da758a9ef64477501b709408236d258da82
2014-08-29 19:25:46 -07:00
James Zern
e80eab1fbc webpmux: (windows) open stdout in binary mode
prevents corrupt output. related to issue #217

Change-Id: I6f0dac8131127717ba72b0709fb35d421ab41acb
2014-08-29 19:25:45 -07:00
James Zern
e9bfb1166d cwebp: (windows) open stdout in binary mode
prevents corrupt output. fixes issue #217

Change-Id: If90afb441636144300da66d64f0e7f78505b4060
2014-08-29 19:11:41 -07:00
James Zern
5927e15bc7 example_util: add ExUtilSetBinaryMode
use it in dwebp when dealing with 'stdout'

Change-Id: I8b8a0b0de9e73731e913ac3c83b5e2b33c693175
2014-08-29 19:07:17 -07:00
skal
b5a36cc9ad add -near_lossless [0..100] experimental option
This compresses the uimage using lossless compression and controlable
decimating pre-process.
Code is under WEBP_EXPERIMENTAL_FEATURE while it's being experimented with.

Change-Id: I8b7f4cfcc3c6afc52a556102842bdbb045ed5ee8
2014-08-05 19:17:10 +02:00
James Zern
29a9fe222a libwebp 0.4.1
- 7/24/14: version 0.4.1
   This is a binary compatible release.
   * AArch64 (arm64) & MIPS support/optimizations
   * NEON assembly additions:
     - ~25% faster lossy decode / encode (-m 4)
     - ~10% faster lossless decode
     - ~5-10% faster lossless encode (-m 3/4)
   * dwebp/vwebp can read from stdin
   * cwebp/gif2webp can write to stdout
   * cwebp can read webp files; useful if storing sources as webp lossless
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJT1xp9AAoJEPnD1r24IytdjDEP/3ZOnrWG0OIThlGE6bqgO3oy
 Y5O7RrvzFuPdGEZ1Kl9jDXjzsYY018/+HJmOD3kf+Qt/+F/8hpGH520VuEiJdVIW
 UcvoYaYq9xrmKNqEJx910Vh8TP7wE2T62OJcqKWg2JEczfUWn8WOKjmM5c8N1kJ2
 q6EbpCdWlxcD49L/MavJ5Yfw9jSZAjKzOIxxz0C294iMTK4IcSmeVvdqhkdyh96E
 CABw3o8sJfqB6p+KXjweXcE2KOhvzAWqTRcIogDC0jV/PgOlindf6k0am2FJHvMM
 A+sf/pmD0YKI1vEaXW+Vs6cz6LzvwbIkJSwuzBA7FYHAG5yqTSkQDxTSttw/RwiW
 fUScqHjQVBUqkM5bdOsdYBSDutQKDF2+WfcK5jXFdnydkQi59HKHV2R0K5cXYqfN
 Tu7aMBqFcfGunLlzfKCJcz8SElEmUjG6oAzRZYcdM9dmnR7ypQK17A/GbaysKKOE
 HMmep7uNX25w+6AL7zExnmPPPtSz+kj1SXt9fgldkelDhg1faAgfwXb/N4E+00lA
 1+aJD3gHcR4QnDI4gnKBKHyIktQPfNKMQ6xuL0oyvsalQ/loz08wu0aACcGDFrg4
 uOVVxTqU+pEITuwGcNk228+O2EbMWzzi3+Vhi1v3Gg3jJ3TRB3QN6NohmrsIackL
 4W2V5NoX5i2VizGfLy2g
 =GWd5
 -----END PGP SIGNATURE-----

Merge tag 'v0.4.1'

libwebp 0.4.1
- 7/24/14: version 0.4.1
  This is a binary compatible release.
  * AArch64 (arm64) & MIPS support/optimizations
  * NEON assembly additions:
    - ~25% faster lossy decode / encode (-m 4)
    - ~10% faster lossless decode
    - ~5-10% faster lossless encode (-m 3/4)
  * dwebp/vwebp can read from stdin
  * cwebp/gif2webp can write to stdout
  * cwebp can read webp files; useful if storing sources as webp lossless

* tag 'v0.4.1':
  update ChangeLog
  iosbuild.sh: specify optimization flags
  update ChangeLog
  makefile.unix: add vwebp.1 to the dist target
  update ChangeLog
  gif2webp: dust up the help message
  remove -noalphadither option from README/vwebp.1
  update NEWS for the next release
  update AUTHORS
  bump version to 0.4.1
  restore mux API compatibility
  remove the !WEBP_REFERENCE_IMPLEMENTATION tweak in Put8x8uv
  restore encode API compatibility
  restore decode API compatibility
  gif2webp: fix compile with giflib 5.1.0
  gif2webp: simplify giflib version checking

Change-Id: Icf599f29bc6c0db757bc133aaddb3dbbbc316e08
2014-07-29 18:06:58 -07:00
Vikas Arora
e09e9ff6e5 Record & log the image pre-processing time.
Change-Id: If0ecec3046e87fe0021446a98f3e94c7e0576bb8
2014-07-28 16:05:42 -07:00
James Zern
2def1fe635 gif2webp: dust up the help message
* try to avoid trailing '.'
* rationalize capitalization

missed in:
0a8b886 dust up the help message

Change-Id: I6f80736cc8a2ff4f185f63d463a57d5bbf88a0db
2014-07-23 20:03:49 -07:00
James Zern
fb668d78b3 remove -noalphadither option from README/vwebp.1
+ vwebp's -help output

this is a future option; missed in:
793368e restore decode API compatibility

Change-Id: If920df2cf8de57ebad93a6b98830562149396d8d
2014-07-23 19:54:34 -07:00
James Zern
862d296cf9 restore mux API compatibility
protect WebPMuxSetCanvasSize w/a WEBP_MUX_ABI_VERSION check

Change-Id: I6b01af55ebb4cc4c860d3cbf43be722077896748
2014-07-23 16:13:56 -07:00
James Zern
d713a69644 Merge changes If4debc15,I437a5d5f into 0.4.1
* changes:
  restore encode API compatibility
  restore decode API compatibility
2014-07-23 13:56:27 -07:00
James Zern
c2fc52e4ec restore encode API compatibility
protect WebPConfigLosslessPreset/WebPMemoryWriterClear w/a
WEBP_ENCODER_ABI_VERSION check

Change-Id: If4debc15fee172a3f18079bc2bd29eb8447bc14b
2014-07-22 22:19:55 -07:00
James Zern
793368e8c6 restore decode API compatibility
protect flip/alpha_dither w/a WEBP_DECODER_ABI_VERSION check

Change-Id: I437a5d5f78800f71b7e7e323faa321f946bf9515
2014-07-22 20:03:52 -07:00
James Zern
b8984f3151 gif2webp: fix compile with giflib 5.1.0
DGifCloseFile() added an error code output parameter
http://giflib.sourceforge.net/gif_lib.html#compatibility

fixes issue #209

original patch by grizzly dot nyo at gmail

Change-Id: I5554de2bd70dbfd95fd356424ad5fb800ac94592
2014-07-22 17:50:30 -07:00
James Zern
222f9b1a9d gif2webp: simplify giflib version checking
introduce LOCAL_GIF_PREREQ/VERSION similar to the GCC variants in dsp.

Change-Id: I00ba5d523047b3b1c14ade992172e75e69043eb3
2014-07-22 17:41:55 -07:00
skal
4595b62b7c Merge "use explicit size of kErrorMessages[] arrays" 2014-07-21 13:37:49 -07:00
skal
fbda2f499c JPEG decoder: delay conversion to YUV to WebPEncode() call
We store the raw RGB samples decoded from JPEG, and avoid precision loss.

Note that this may increase the encoding time reported by
cwebp -v, since RGB->YUV now occur during WebPEncode call
(in case of lossy), instead of ReadJPEG().
This also increases the memory use, since we're carying the
source ARGB samples around.

Change-Id: Ic2180206cfc9f5574f391e91c3b89b9d81695d01
2014-07-21 22:26:22 +02:00
skal
0b747b1b39 use explicit size of kErrorMessages[] arrays
Change-Id: If02864e3a07ae37814bf379bf347862cd2871bf4
2014-07-21 13:21:56 -07:00
Pascal Massimino
257adfb0be remove experimental YUV444 YUV422 and YUV400 code
(never used)

Change-Id: I12a886703592133939607df05132e9b498f916c1
2014-07-03 22:26:25 -07:00
James Zern
380cca4f2c configure.ac: add AC_C_BIGENDIAN
this defines WORDS_BIGENDIAN, replacing uses of
__BIG_ENDIAN__/__BYTE_ORDER__ with it

+ fixes lossless BGRA output with big-endian toolchains
  that do not define __BIG_ENDIAN__ (codesourcery mips gcc)

Change-Id: Ieaccd623292d235343b5e34b7a720fc251c432d7
2014-07-03 18:15:50 -07:00
Pascal Massimino
9d5629025c make alpha-detection loop in IsKeyFrame() in good x/y order
Change-Id: Ifeeb855e66c7b6b849e8584787dc24e7371b1e67
2014-07-02 21:03:35 -07:00
skal
4536e7c49c add WebPMuxSetCanvasSize() to the mux API
previously, the final canvas size was adjusted tightly from the
animation frames. Now, it can be specified separately (to be larger, in particular).

calling WebPMuxSetCanvasSize(mux, 0, 0) triggers the 'adjust tightly' behaviour.
This can be useful after calling WebPMuxCreate() if further image addition
is expected.

-> Fixed gif2webp accordingly.

also: made WebPMuxAssemble() more robust by systematically zero-ing WebPData.

Change-Id: Ib4f7eac372cf9dbf6e25cd686a77960e386a0b7f
2014-06-30 07:00:49 +02:00
skal
1b6a263566 Merge "Fix handling of weird GIF with canvas dimension 0x0" 2014-06-25 02:14:54 -07:00
skal
1582e402fd Fix handling of weird GIF with canvas dimension 0x0
Similarly to Chrome, we then use the first sub-rectangle
to set the canvas size.

Also: add check for too-large GIF dimensions (>MAX_CANVAS_SIZE)

Change-Id: Idce55f1e6f6982a8f0e082aac540e16b530e023e
2014-06-24 17:40:40 +02:00
skal
db8b8b5fc2 Fix logic in the GIF LOOP-detection parsing
We align with Blink/Chromium code by:
  - checking for ANIMEXTS1.0 signature too
  - using ByteCount >= 3 instead of requiring ByteCount==3

Change-Id: Idc484ca62878517df3dccb1fdb3bb45104a5e066
see: http://odur.let.rug.nl/kleiweg/gif/netscape.html
2014-06-23 23:26:36 +02:00
James Zern
c6af999168 Merge "dust up the help message" 2014-06-19 23:12:02 -07:00
skal
0a8b8863cc dust up the help message
* try to avoid trailing '.'
* rationalize capitalization

Change-Id: I50939baf01b1ab44d3031eee916ba51f2338af8a
2014-06-20 07:13:11 +02:00
James Zern
2bc0dc3edc Merge "webpmux: warn when odd frame offsets are used" 2014-06-18 12:18:09 -07:00
James Zern
3114ebe46c Merge changes Id8edd3c1,Id418eb96,Ide05e3be
* changes:
  examples/Android.mk: add cwebp
  Android.mk: move dwebp to examples/Android.mk
  Android.mk: add ENABLE_SHARED flag
2014-06-18 12:17:15 -07:00
James Zern
c072663493 webpmux: warn when odd frame offsets are used
offsets are stored as (x/2, y/2)

Change-Id: Ic8f727ab7996a84c1f8c57f4f6dbaf8701bf8eae
2014-06-18 10:47:23 -07:00
James Zern
d51467841e examples/Android.mk: add cwebp
Change-Id: Id8edd3c17d82e4ab0087c315cd3ead1cb285e714
2014-06-17 23:41:12 -07:00
James Zern
ca0fa7c7a5 Android.mk: move dwebp to examples/Android.mk
this depends on the top-level Android.mk for shared flags

Change-Id: Id418eb9639e839518a921ffcb6a376ce10aafbd2
2014-06-17 23:41:01 -07:00
skal
bbe32df1e3 add alpha dithering for lossy
new options:
 dwebp -alpha_dither
 vwebp -noalphadither

When the source was marked as quantized, we use a threshold-averaging
filter to smooth the decoded alpha plane.
Note: this option forces the decoding of alpha data in one pass, and
might slow the decoding a bit.

The new field in WebPDecoderOptions struct is 'alpha_dithering_strength'
(0 by default, means: off). Max strength value is '100'.

Change-Id: I218e21af96360d4781587fede95f8ea4e2b7287a
2014-06-14 00:06:16 +02:00
Pascal Massimino
d6cd6358ff Merge "fix orig_rect==NULL case" 2014-06-12 00:48:30 -07:00
Pascal Massimino
2bfd1ffaba fix orig_rect==NULL case
Change-Id: I3bb4fbebf59cba2a67681e74530fc0fe51f1958f
2014-06-12 00:26:33 -07:00
James Zern
059e21c195 Merge "configure: move config.h to src/webp/config.h" 2014-06-11 22:52:07 -07:00
skal
f05fe006c2 properly report back encoding error code in WebPFrameCacheAddFrame()
User-hook can fail but error was not propagated back.

Change-Id: Ic79f9543bf767634a127eccfef90af855ff15c34
Also: some ad-hoc clean-up and API dusting. More to come later...
2014-06-11 23:26:47 +02:00
James Zern
32b3137936 configure: move config.h to src/webp/config.h
this change has the side-effect of using directory names in the
include, silencing a lint warning.

Change-Id: Ib91cf63a90534e32fadfa5c2372bfdb29f854d02
2014-06-10 23:42:00 -07:00
skal
385e334019 real fix for longjmp warning
the 'volatile' qualifier was at the wrong place

Patch by Paul Pluzhnikov

Change-Id: I26e6f311a0ccd145de640b3505fe92965389c1d9
2014-06-04 11:02:42 +02:00
skal
ac591cf22e fix for gcc-4.9 warnings about longjmp + local variables
Needed to add 'volatile' and some casts.
Relevant excerpt from the 'man longjmp':

===============
The values of automatic variables are unspecified after a call to longjmp() if they meet all the following criteria:
  ·  they are local to the function that made the corresponding setjmp(3) call;
  ·  their values are changed between the calls to setjmp(3) and longjmp(); and
  ·  they are not declared as volatile.
===============

Change-Id: Ic72dc92669513a820369ca52a038afa9ec88091f
2014-05-30 10:19:10 -07:00
James Zern
4c398699ef Merge "cwebp: fallback to native webp decode in WIC builds" 2014-05-28 15:03:34 -07:00
James Zern
7d039fc32d cwebp: fallback to native webp decode in WIC builds
this gives precedence to WIC, but attempts to decode the file as WebP if
it fails

Change-Id: I3d894f39a26aea88897a8ebd345139b82f74f312
2014-05-27 16:28:37 -07:00
James Zern
d471f424da cwebp: add some missing newlines in longhelp output
+ update README

Change-Id: Ia84d8857d575bc29ab3ce9c0f10264c042067e78
2014-05-27 16:28:02 -07:00
skal
dc5b122f23 try to remove the spurious warning for static analysis
Change-Id: Ib81f16c70a0bfad05021401c1cf6788c974b63bd
2014-05-26 18:31:00 +02:00
Pascal Massimino
f1e771735a remove all unused layer code
Change-Id: I220590162b24c70f404fe3087f19dd3e6cac3608
2014-05-08 22:37:38 -07:00
James Zern
e0609ade15 dwebp: fix exit code on webp load failure
on ExUtilLoadWebP() failure no allocated memory will be returned, so
it's safe to exit immediately. additionally, any webp specific problems
will already have been reported as part of the call to
WebPGetFeatures().

broken since:
4a0e739 dwebp: move webp decoding to example_util

Change-Id: Ibc632015a1f52bae7f96d063252624123fa7c2da
2014-04-28 17:22:29 -07:00
James Zern
8955da2149 example_util.h: avoid forward declaring enums
doing so is not part of ISO C; removes some pedantic warnings.
use webp/decode.h to pickup VP8StatusCode instead.

Change-Id: I19b35e0f8a36fb7c45944ae9ca86838e08b90548
2014-04-28 14:56:19 -07:00
James Zern
1b2fe14de5 example_util: add ExUtilDecodeWebPIncremental
simplifies ExUtilDecodeWebP() call

Change-Id: I33b42ec1c398b9fc0a895ad9deb89ab01a33b3da
2014-04-27 01:58:25 -07:00
James Zern
8e5f90b086 Merge "make ExUtilLoadWebP() accept NULL bitstream param." 2014-04-26 12:22:53 -07:00
James Zern
ddeb6ac802 cwebp: add webpdec
simple webp decoding, no metadata support

Change-Id: I2752fd1442c87513922878cbf72f001d45b631bc
2014-04-26 02:20:41 -07:00
Pascal Massimino
f0b65c9a1e make ExUtilLoadWebP() accept NULL bitstream param.
Change-Id: Ifce379873ca39e46d011a1cb829beab89de5f15d
2014-04-26 01:11:44 -07:00
James Zern
4a0e73904d dwebp: move webp decoding to example_util
this will allow reuse by cwebp

Change-Id: I667252fdacfc5436112d21b040ca299273ec1515
2014-04-22 20:31:41 -07:00
skal
af93bdd6bc use WebPSafe[CM]alloc/WebPSafeFree instead of [cm]alloc/free
there's still some malloc/free in the external example
This is an encoder API change because of the introduction
of WebPMemoryWriterClear() for symmetry reasons.

The MemoryWriter object should probably go in examples/ instead
of being in the main lib, though.
mux_types.h stil contain some inlined free()/malloc() that are
harder to remove (we need to put them in the libwebputils lib
and make sure link is ok). Left as a TODO for now.

Also: WebPDecodeRGB*() function are still returning a pointer
that needs to be free()'d. We should call WebPSafeFree() on
these, but it means exposing the whole mechanism. TODO(later).

Change-Id: Iad2c9060f7fa6040e3ba489c8b07f4caadfab77b
2014-03-27 15:50:59 -07:00
James Zern
24ca3678f9 Merge "allow 'cwebp -o -' to emit output to stdout" 2014-03-12 14:01:15 -07:00
skal
e12f874eea allow 'cwebp -o -' to emit output to stdout
Change-Id: I423d25898e1ba317ccbf456bb28ce45663a3b3d2
2014-03-12 13:56:15 -07:00
skal
2bcad89b4c allow some more stdin/stout I/O
* allow reading from stdin for dwebp / vwebp
 * allow writing to stdout for gif2webp

by introducing a new function ExUtilReadFromStdin()

Example use: cat in.webp | dwebp -o - -- - > out.png

Note that the '-- -' option must appear *last*
(as per general fashion for '--' option parsing)

Change-Id: I8df0f3a246cc325925d6b6f668ba060f7dd81d68
2014-03-12 19:32:16 +01:00
skal
65b99f1c92 add a -z option to cwebp, and WebPConfigLosslessPreset() function
These are presets for lossless coding, similar to zlib.
The shortcut for lossless coding is now, e.g.:
   cwebp -z 5 in.png -o out_lossless.webp

There are 10 possible values for -z parameter:
   0 (fastest, lowest compression)
to 9 (slowest, best compression)

A reasonable tradeoff is -z 6, e.g.
-z 9 can be quite slow, so use with care.

This -z option is just a shortcut for some pre-defined
'-lossless -m xx -q yy' combinations.

Change-Id: I6ae716456456aea065469c916c2d5ca4d6c6cf04
2014-03-11 23:25:35 +01:00
skal
5da185522b add a decoding option to flip image vertically
New API options: WebPDecoderOptions.flip and 'dwebp -flip ...'

it uses negative stride trick.

Also changed the decoder code to support user-supplied
buffers with negative stride, independently of the
WebPDecoderOptions.flip value.

Change-Id: I4dc0d06f0c87e51a3f3428be4fee2d6b5ad76053
2014-01-16 15:48:43 +01:00
James Zern
effcb0fdfa libwebp 0.4.0
- 12/19/13: version 0.4.0
   * improved gif2webp tool
   * numerous fixes, compression improvement and speed-up
   * dither option added to decoder (dwebp -dither 50 ...)
   * improved multi-threaded modes (-mt option)
   * improved filtering strength determination
   * New function: WebPMuxGetCanvasSize
   * BMP and TIFF format output added to 'dwebp'
   * Significant memory reduction for decoding lossy images with alpha.
   * Intertwined decoding of RGB and alpha for a shorter
     time-to-first-decoded-pixel.
   * WebPIterator has a new member 'has_alpha' denoting whether the frame
     contains transparency.
   * Container spec amended with new 'blending method' for animation.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSwa+nAAoJEPnD1r24IytdJeQQAI7JT/lyhcVdFw9yGsb8SaXr
 kzz0OR+4WYIIuHVJSYJ5scun6kXYkj3AXBfBi/ctmKzLSPkAPumX/HTdZgD4e9Hx
 qyLK9GlISr3BvQu3PLQWOrebxHNmm+MwZAWSiVm2mwFTx6KQiJBfgNRUy+BKyS4m
 KQxkpMY1p9An73+e1OBrtJae1hdgBX8ClRqju56v8xqYbOEjbrTD0CTV0Cu1h3mz
 xp7mQx8EPfo77k5HCEdYf2xRPRbCfQ4jy8SO8AW/zNPRLJVXFnpLb6jpinNlABFU
 Al38om5BIRgX4amndSpLFH6ysaCEeqWIR/2OHDlLmiNeeukTuqZdg0ewLy5JpbFU
 ByD5tG9BA3vXGf+sGH7RAiVdLjArAZb3Npp2hSCuzJj9UI9r+9ofjoXSd8BcMct3
 xb+vXmGSjKt3rpdUiREeXBYUd/Yhr5S4sMsFlx99XBeHvc1nxKsJBua5P3ixv4v9
 p6hJ3Ngri38Zo83aOBZkS+p1VETbaTwxC6q8oJ5pk4w8IcM03ViBizTMNshohF1k
 d1uVHd4ZwM3HYS2L21JZW0KCN6iwGmgcfNFm8RvHoAkxw27vRd6eRmz+SU97n/VD
 Ne5oZlHiKrqTnobSfY2c3tK5gpVewwPo4dpgLJbvij86IRwnNHfoSYhsOPTVi3O1
 pup4AUMY8kAUwmUUceoL
 =K/1E
 -----END PGP SIGNATURE-----

Merge tag 'v0.4.0'

libwebp 0.4.0
- 12/19/13: version 0.4.0
  * improved gif2webp tool
  * numerous fixes, compression improvement and speed-up
  * dither option added to decoder (dwebp -dither 50 ...)
  * improved multi-threaded modes (-mt option)
  * improved filtering strength determination
  * New function: WebPMuxGetCanvasSize
  * BMP and TIFF format output added to 'dwebp'
  * Significant memory reduction for decoding lossy images with alpha.
  * Intertwined decoding of RGB and alpha for a shorter
    time-to-first-decoded-pixel.
  * WebPIterator has a new member 'has_alpha' denoting whether the frame
    contains transparency.
  * Container spec amended with new 'blending method' for animation.

* tag 'v0.4.0':
  update ChangeLog
  update NEWS description with new general features
  gif2webp: don't use C99 %zu
  cwebp: fix metadata output w/lossy+alpha
  makefile.unix: clean up libgif2webp_util.a
  update Changelog
  bump version to 0.4.0
  update AUTHORS & .mailmap
  update NEWS for 0.4.0

Change-Id: I6df1b512fe0b697192f1f9b29431cd59aa6063d1
2013-12-30 09:57:59 -08:00
skal
fff2a11b03 make -short work with -print_ssim, -print_psnr, etc.
PSNR was always printed when using -short

Change-Id: I826785917961d355a980e4ac27dd1cf1295cb6de
2013-12-23 12:03:00 +01:00
James Zern
296253407c Merge "gif2webp: don't use C99 %zu" into 0.4.0 2013-12-20 00:06:33 -08:00
James Zern
3b9f9dd07b gif2webp: don't use C99 %zu
this would require a PRIuS or similar macro for proper platform
compatibility (Visual Studio for instance would be variants of %lu)

Change-Id: I2b9fcb1639db024775fb47dbcf79a2240f3d98f2
2013-12-19 18:52:48 -08:00
James Zern
b5b2e3c7f5 cwebp: fix metadata output w/lossy+alpha
Change-Id: Ic96da6523fc73a7b67c68ef8a4c9d12081f8a535
2013-12-19 10:17:08 -08:00
James Zern
b4fa0a47ea webpmux: let -- stop parameter parsing
this enables webpmux to accept input files starting with '-' when using
-get/-set/-strip; -info & -frame expect an input file as one of their
parameters so no changes are necessary there.

Change-Id: I154eb6dc388258a7fb743ec76ba869bf9589be1b
2013-12-17 20:50:46 -08:00
Urvang Joshi
a9a20acfa6 gif2webp: Add a multi-threaded encode option
Change-Id: If16a5f434e0ab2965a7ac9392633ecaf8c4aff46
2013-12-17 17:01:59 -08:00
James Zern
605a712701 simplify __cplusplus ifdef
drop c_plusplus which is from a quite ancient pre-standard compiler

Change-Id: I9e357b3292a6b52b14c2641ba11f4f872c04b7fb
2013-12-16 20:16:02 -08:00
James Zern
33109f990a Merge "drop: ifdef __cplusplus checks from C files" 2013-12-16 20:13:09 -08:00
James Zern
7f9de0b948 Merge changes I994a5587,I8467bb71,I13b50688,I1e2c9c7b
* changes:
  gif2webp: let -- stop parameter parsing
  vwebp: let -- stop parameter parsing
  cwebp: let -- stop parameter parsing
  dwebp: let -- stop parameter parsing
2013-12-16 16:53:27 -08:00
James Zern
5459030be0 gif2webp: let -- stop parameter parsing
this enables gif2webp to accept input files starting with '-'

Change-Id: I994a5587e16e3af83ca45bfda8caf2dc39068b6c
2013-12-16 15:15:20 -08:00
James Zern
a4b0aa06ee vwebp: let -- stop parameter parsing
this enables vwebp to accept input files starting with '-'

Change-Id: I8467bb719ba745b2aa14a5c5ce2ff392cd9601d5
2013-12-16 15:14:00 -08:00
James Zern
98af68fe26 cwebp: let -- stop parameter parsing
this enables cwebp to accept input files starting with '-'

Change-Id: I13b506886c3df8a4e8fb350f3d365eaf7e072a4a
2013-12-16 15:13:54 -08:00
James Zern
a33831e21a dwebp: let -- stop parameter parsing
this enables dwebp to accept input files starting with '-'

Change-Id: I1e2c9c7bc2963d77be039c99e72f744560f0b0a2
2013-12-16 15:13:32 -08:00
Pascal Massimino
363012497b add some checks on error paths
malloc failure could lead to free'ing non-initialized pointers

Change-Id: I8156aac1fce9a47825cfd0d88eb2bd8c38a630d5
2013-12-16 13:33:45 -08:00
James Zern
5227d99146 drop: ifdef __cplusplus checks from C files
the prototypes are already marked in the headers

Change-Id: I172fe742200c939ca32a70a2299809b8baf9b094
2013-12-13 11:42:13 -08:00
James Zern
f91034f241 Merge "cwebp: print metadata stats when no output file is given" 2013-12-12 19:28:35 -08:00
Urvang Joshi
d49345533f gif2webp: Backward compatibility for giflib version <= 4.1.3
Fixes https://code.google.com/p/webp/issues/detail?id=172

We use 'int' instead of 'GifWord', which was introduced in version
4.1.4.

Tested OK on 4.1.3
(http://sourceforge.net/projects/giflib/files/giflib-4.x/giflib%204.1.3/)
and 5.0.4

Change-Id: I77628b0f9175a91eb3a22e64fc55dd00633add1f
2013-12-11 08:46:38 -08:00
Urvang Joshi
4c617d3286 gif2webp: Disable output of ICC profile by default
This is to discourage generation of animated WebP images with ICC
profile, as
the real-world use-case for such images is rare at best.

Output of ICC/XMP metadata is now controlled by the '-metadata' option.

Change-Id: I8e3e29878c32bf46cbc661f50661bac602603c43
2013-12-10 14:53:06 -08:00
James Zern
7049043775 cwebp: print metadata stats when no output file is given
this is more consistent with the encode stats

Change-Id: I5793062b3b29f5cb891461d6faaa53b43c0a4482
2013-12-09 20:15:54 -08:00
James Zern
ad9dec0c24 Merge "cosmetics: dwebp: fix local function name format" 2013-12-07 13:38:54 -08:00
James Zern
dbebd33be7 cosmetics: dwebp: fix local function name format
error_function -> PNGErrorFunction

Change-Id: Ic6c0e676cc47bca2c1a1e0d8e95639e780982b1b
2013-12-07 13:26:05 -08:00
James Zern
2774995185 dwebp: remove a dead store
Change-Id: I48205472e99e997702d25c39f1b4d7a4699c15d6
2013-12-07 13:22:22 -08:00
Pascal Massimino
ebef7fb307 fix -print_psnr / ssim options
original/compressed pictures were not converted to an adequate YUVA
colorspace before computing the distortion.

Change-Id: I37775e9b7dbd6eca16c38e235e1df325858d36a1
2013-12-05 14:03:59 -08:00
skal
cbdd3e6e53 add a -dither dithering option to the decoder
Even at high quality setting, the U/V quantizer step is limited
to 4 which can lead to banding on gradient.
This option allows to selectively apply some randomness to
potentially flattened-out U/V blocks and attenuate the banding.

This option is off by default in 'dwebp', but set to -dither 50
by default in 'vwebp'.

Note: depending on the number of blocks selectively dithered,
we can have up to a 10% slow-down in decoding speed it seems.

Change-Id: Icc2446007f33ddacb60b3a80a9e63f2d5ad162de
2013-11-27 00:57:51 -08:00
Urvang Joshi
73f52133a1 gif2webp: Add a mixed compression mode
When '-mixed' option is given, each frame would be heuristically chosen
to be
encoded using lossy or lossless compression.

The heuristic is based on the number of colors in the image:
- If num_colors <= 31, pick lossless compression
- If num_colors >= 194, pick lossy compression
- Otherwise, try both and pick the one that compresses better.

Change-Id: I908c73493ddc38e8db35b7b1959300569e6d3a97
2013-11-17 18:04:07 -08:00
Urvang Joshi
36555983f0 gif2webp: kmin = 0 should suppress key-frame addition.
This is to conform to man/gif2webp.1
Earlier, one needed to give both '-kmin 0' and '-kmax 0' for this to
work.

Also, suppress further warnings for kmin = 0 and/or kmax = 0 case.

Change-Id: I6f5eeb609aeffc159d0252a40a5734162f7e4e7d
2013-11-01 12:01:59 -07:00
Pascal Massimino
86c0031eb2 add a 'format' field to WebPBitstreamFeatures
Change-Id: I79a688e4c34fb77527127bbdf4bc844efa6aa9a4
2013-10-25 20:34:06 +02:00
Urvang Joshi
38efdc2e9c Simplify the gif2webp tool: move the optimization details to util
Specifically:
- Merge OptimizeAndEncodeFrame with WebPFrameCacheAddFrame: they use the same
  if-else structure.
- Move maintenance of 'prev_canvas' and 'curr_canvas' to util.
- Move ReduceTransparency() and FlattenPixels() calls to SetFrame(): This is in
  preparation for the next patch: which will try try lossless encoding for
  each frame, even when '-lossy' option is given.
- Make most methods static inside util.

No changes to output expected.

Change-Id: I1f65af25246665508cb20f0f6e338f9aaba9367b
2013-10-14 14:39:46 -07:00
skal
d155507cb9 Merge "use HINT_GRAPH as image_hint for gif source" 2013-10-09 02:58:15 -07:00
skal
9c561646ac Merge "only print GIF_DISPOSE_WARNING once" 2013-10-09 02:56:45 -07:00
skal
05879865da use HINT_GRAPH as image_hint for gif source
quite rarely, it gives a different output
then without the HINT, but that's often for
a smaller size (tested with default -m and -m 6)

Change-Id: I51d221ab61f8e007983325031345728e8d80b241
2013-10-09 11:55:51 +02:00
skal
00125196f3 gif2webp: detect and flatten uniformly similar blocks
helps during lossless compression.

10% average saving, but that's mostly on what was previously
'difficult' cases, where the gain is ~30-50% actually.
Non-difficult cases are mostly unchanged.
Tested over ~7k random web gifs.

Change-Id: I09db4560e4ab09105d1cad28e6dbf83842eda8e9
2013-10-08 15:04:52 +02:00
skal
0deaf0fa44 only print GIF_DISPOSE_WARNING once
Change-Id: Iece235a6ee767cc2e3866bb6c9bb1d56d9a9ffb9
2013-10-08 15:02:33 +02:00
skal
5a7533ceb3 small gif2webp fix
the old kmin value was printed instead of the new one.

Change-Id: I0dcf23a29b7ce6bad08013a1980c5ce027b1bfe9
2013-10-04 21:13:35 +02:00
Urvang Joshi
606c4304c4 gif2webp: Improved compression for lossy animated WebP
We reduce transparency by turning some transparent pixels into
corresponding RGB values from previous canvas.

This improves compression by about 23%.

Change-Id: I02d70a43a1d0906ac09a7e2dc510be3b2d38f593
2013-09-30 16:48:39 -07:00
Urvang Joshi
fb887f7fe6 gif2webp: Different kmin/kmax defaults for lossy and lossless
These were the best values found considering the compression gain and
decoding speed.

Change-Id: Iddae4c5b78c6aa42b1f8a034d1c1b93843071a81
2013-09-30 14:25:58 -07:00
skal
5cd43e4316 Add -incremental option to dwebp
useful for testing. Not listed in the man or README, since
it's only useful for testing the incremental decoding
(e.g. measuring the timing difference compared to non-incremental)

Change-Id: I8df8046e031d21006242babb5bcac09f8ff9f710
2013-09-19 13:20:45 +02:00
Urvang Joshi
54b8e3f6e2 webpmux: DisplayInfo(): remove unnecessary error checks.
As WebPMuxCreate() would have succeeded by then, many of the calls
cannot fail.

Change-Id: I3220c59e9aa47c948da9f8741b4098c47b91a8fc
2013-09-18 11:44:24 -07:00
Urvang Joshi
0e6747f88d webpmux -info: display dimensions and has_alpha per frame
Also, more readable dispose and blend methods.

Change-Id: I318431f94dcdee4c5da296a48e6f3762aa254c1f
2013-09-16 15:29:24 -07:00
Urvang Joshi
d78a82c407 Sanity check for underflow
Change-Id: I52dbdcbd02c344c6260f196afad30005d14d3ee0
2013-09-16 13:35:13 -07:00
Pascal Massimino
8498f4bfe2 Merge "remove -Wshadow warnings" 2013-09-16 13:19:39 -07:00
Urvang Joshi
e89c6fc867 Avoid a potential memleak
Change-Id: I76f30fb40743a989bce25b40238cf0db55bd07e0
2013-09-16 13:12:33 -07:00
Pascal Massimino
2f5e893400 remove -Wshadow warnings
"warning: declaration of ‘index’ shadows a global declaration"

Change-Id: I65f079aa4cd300cd1b3887a040b75c6b0f36ca1d
2013-09-14 02:02:09 -07:00
Pascal Massimino
bf3a29b302 Merge "add proper WEBP_HAVE_GIF and WEBP_HAVE_GL flags" 2013-09-14 01:57:36 -07:00
skal
2b0a759335 Merge "fix some warnings from static analysis" 2013-09-13 13:00:12 -07:00
Pascal Massimino
79ff03460a add proper WEBP_HAVE_GIF and WEBP_HAVE_GL flags
...and make gif2webp and vwebp compile without them.

Makefile.vc still to be updated...
Meanwhile the CL environment variable can be supplemented with

set CL=/DWEBP_HAVE_GL /IC:\opt\freeglut\include

Change-Id: I37a60b8c32aafd125bffa98b6cc9f57c022ebbd0
2013-09-13 12:46:41 -07:00
skal
d51f45f047 fix some warnings from static analysis
http://code.google.com/p/webp/issues/detail?id=138

Change-Id: I21470e965357cc14eab356e2c477c7846ff76ef2
2013-09-13 11:33:30 +02:00
Urvang Joshi
d538cea8c2 gif2webp: Support a 'min' and 'max' key frame interval
Change-Id: If910c8849d7210e7227db0f45affa26fce7da102
2013-09-12 13:41:09 -07:00
Pascal Massimino
b11c9d6284 dwebp: use default dct_method
No significant speed diff was observed.
Avoids idct mismatch artifacts.

Change-Id: I9ca64d165d313f23b4aa231e7a97a20213ff86c7
2013-09-03 15:48:41 -07:00
Urvang Joshi
e81fac86dd Add support for "no blend" in webpmux binary
Change-Id: I6d07b120626317df73f1a6f026931c5b9485a340
2013-08-26 18:04:52 -07:00
Urvang Joshi
3b80bc4859 gif2webp: Separate out each step into a method
We now have ReadFrame(), OptimizeFrame(), EncodeFrame() and
DisposeFrame()
methods.

Change-Id: I522834bad18dd6a7a3ddac7c00dfd829c48248f8
2013-08-22 11:14:51 -07:00
James Zern
61405a143d dwebp: enable stdout output with WIC
Change-Id: Ieb73a414784480945bba6cb2687468517e24e755
2013-08-20 19:59:30 -07:00
pascal massimino
e58cc13706 Merge "dwebp: s/unsigned char/uint8_t/" 2013-08-20 15:03:46 -07:00
James Zern
72501d4309 dwebp: s/unsigned char/uint8_t/
Change-Id: I579e9b0a4d03998ca1dd8683d83d30d852551e45
2013-08-20 14:57:35 -07:00
Urvang Joshi
f0d6a14b64 gif2webp: Insert independent frames at regular intervals.
We use the 'do not blend' option for creating independent frames.
We also mark the already independent frames as 'do not blend'.

This bounds the maximum number of frames that need to be decoded to
decode a given frame, thus leading to a much better decoding performance.

Change-Id: I7cef98af2b53751ec36993fd2bd54f7f4c4aad2b
2013-08-20 11:47:48 -07:00