Commit Graph

844 Commits

Author SHA1 Message Date
Pascal Massimino
07db70d20f fix for big-endian
(Issue #150: https://code.google.com/p/webp/issues/detail?id=150)

Change-Id: Iad46d375a8c5eabae37cde8f55b3e7448601f264
(cherry picked from commit 4437061735)
2013-06-11 15:00:46 -07:00
Vikas Arora
498d4dd634 WebP-Lossless encoding improvements.
Lossy (with Alpha) image compression gets 2.3X speedup.
Compressing lossless images is 20%-40% faster now.

Change-Id: I41f0225838b48ae5c60b1effd1b0de72fecb3ae6
(cherry picked from commit 8eae188a62)
2013-06-11 15:00:45 -07:00
Urvang Joshi
b0ffc43700 Alpha decoding: significantly reduce memory usage
Simply get rid of an intermediate buffer of size width x height, by
using the fact that stride == width in this case.

Change-Id: I92376a2561a3beb6e723e8bcf7340c7f348e02c2
(cherry picked from commit edccd19436)
2013-06-11 15:00:44 -07:00
Urvang Joshi
11edf5e24b Demux: Fix a potential memleak
Change-Id: Ic0dcac010da088b791c130be4abacdd8c31e92cf
(cherry picked from commit 94328d6457)
2013-06-11 15:00:43 -07:00
James Zern
c7b92184df don't forward declare enums
doing so is not part of ISO C; removes some pedantic warnings

Change-Id: I739ad8c5cacc133e2546e9f45c0db9d92fb93d7e
(cherry picked from commit 96e948d7b0)
2013-06-11 15:00:43 -07:00
James Zern
7a650c6ad6 prevent signed int overflow in left shift ops
force unsigned when shifting by 24.

Change-Id: Ie229d252e2e4078107cd705b09397e686a321ffd
(cherry picked from commit f4f90880a8)
2013-06-11 15:00:43 -07:00
Pascal Massimino
31bea32408 add precision about dynamic output reallocation with IDecoder
The output surface CAN be changed inbetween calls to
WebPIUpdate() or WebPIAppend(), but with precautions.

Change-Id: I899afbd95738a6a8e0e7000f8daef3e74c99ddd8
(cherry picked from commit ff885bfe1f)
2013-06-11 15:00:43 -07:00
Urvang Joshi
c22877f70f Add incremental support for extended format files
This applies to images with optional chunks (e.g. images with ALPH
chunk,
ICCP chunk etc). Before this, the incremental decoding used to work like
non-incremental decoding for such files, that is, no rows were decoded
until
all data was available.

The change is in 2 parts:
- During optional chunk parsing, don't wait for the full VP8/VP8L chunk.
- Remap 'alpha_data' pointer whenever a new buffer is allocated/used in
WebPIAppend() and WebPIUpdate().

Change-Id: I6cfd6ca1f334b9c6610fcbf662cd85fa494f2a91
(cherry picked from commit ead4d47859)
2013-06-11 15:00:42 -07:00
Urvang Joshi
f4c7b6547b WebPEncode: An additional check.
Start VP8EncLoop/VP8EncTokenLoop only if VP8EncStartAlpha succeeded.

Change-Id: Id1faca3e6def88102329ae2b4974bd4d6d4c4a7a
(cherry picked from commit 67708d6701)
2013-06-11 15:00:42 -07:00
Pascal Massimino
dcbb1ca54a add WebPBlendAlpha() function to blend colors against background
new option: -blend_alpha 0xrrggbb
also: don't force picture.use_argb value for lossless. Instead,
delay the YUVA<->ARGB conversion till WebPEncode() is called.
This make the blending more accurate when source is ARGB
and lossy compression is used (YUVA).
This has an effect on cropping/rescaling. E.g. for PNG, these
are now done in ARGB colorspace instead of YUV when lossy compression
is used.

Change-Id: I18571f1b1179881737a8dbd23ad0aa8cddae3c6b
(cherry picked from commit e7d9548c9b)
2013-06-11 15:00:41 -07:00
Urvang Joshi
d52b405dbd Cosmetic fixes
Change-Id: Ia878115086edc3fdfee3f0ca76e5e74ea5906f21
(cherry picked from commit e9a7990bc5)
2013-03-29 15:49:15 -07:00
Pascal Massimino
6cb4a61825 misc style fix
(cherry picked from commit 142c46291e)

Conflicts:
	src/webp/format_constants.h

Change-Id: Ib764cb09bd78ab6e72c60f495d55b752ad4dbe4d
2013-03-29 15:49:05 -07:00
Pascal Massimino
68111ab02f add missing YUVA->ARGB automatic conversion in WebPEncode()
user can now call WebPEncode() with any YUVA or ARGB format, for
lossy or lossless compression

also: simplified error reporting, which is done in WebPPictureARGBToYUVA()
and WebPPictureYUVAToARGB()

Change-Id: Ifb68909217175bcf5a050e5c68d06de9849468f7
(cherry picked from commit 07d87bda1b)
2013-03-29 15:33:14 -07:00
James Zern
4299f39852 libwebp/mux: fix double free
transfer ownership of chunk passed in ChunkSetNth(). prevents freeing
the chunk in e.g., MuxImageParse() when a partial assignment (alpha but
no image) has occurred.

Change-Id: Ia69656b04fdf50f098f3816b54abd4e191248de3
2013-03-26 13:31:47 -07:00
James Zern
33f9a692d9 Merge "demux: keep a frame tail pointer; used in AddFrame" into 0.3.0 2013-03-26 13:30:10 -07:00
skal
a2a7b95916 use WebPDataCopy() instead of re-coding it.
also: fix some 0 vs NULL tests

Change-Id: I2b6f65a1e658211e5b4a323c4f9f502744206ec7
2013-03-26 20:40:24 +01:00
James Zern
6f18f12f99 demux: keep a frame tail pointer; used in AddFrame
this speeds up the parse of a file with a large number of frames.

Change-Id: Ibc61324eb50a04438f811a6f7787d378d763c104
2013-03-26 11:27:51 -07:00
skal
e5af49e9c0 add doc precision about WebPParseHeaders() return codes
Change-Id: I970900f4a5abb4877a716bd4eb15939655ef5dad
2013-03-25 17:54:46 -07:00
Pascal Massimino
3c8eb9a806 fix bad saturation order in QuantizeBlock
Saturation was done on input coeff, not quantized one.

This saturation is not absolutely needed: output of FTransformWHT
is in range [-16320, 16321]. At quality 100, max quantization steps is 8,
so the maximal range used by QuantizeBlock() is [-2040, 2040].
But there's some extra bias (mtx->bias_[] and mtx->sharpen_[]) so
it's better to leave this saturation check for now.

addresses issue #145

Change-Id: I4b14f71cdc80c46f9eaadb2a4e8e03d396879d28
2013-03-25 14:53:29 -07:00
James Zern
f43bafc3e6 Merge changes Iecccb09c,If5ee9fd2,I3e181ce4 into 0.3.0
* changes:
  dwebp: warn when decoding animated webp's
  Decode: return more meaningful error for animation
  WebPBitstreamFeatures: add has_animation field
2013-03-20 14:56:29 -07:00
James Zern
302efcdb41 Decode: return more meaningful error for animation
VP8_STATUS_NOT_ENOUGH_DATA -> VP8_STATUS_UNSUPPORTED_FEATURE

Change-Id: If5ee9fd2c99fc5502996d3c786848fd9cc118fe7
2013-03-20 13:59:22 -07:00
James Zern
ad452735c3 WebPBitstreamFeatures: add has_animation field
Change-Id: I3e181ce463b0e4833bfd29f8052b21ebe0bca977
2013-03-20 13:49:56 -07:00
Pascal Massimino
783dfa4995 disable FRGM decoding for good in libwebpmux
Change-Id: I2f24d100f93488f6b0bf9ccc5818f9177d73948b
2013-03-20 13:31:14 -07:00
James Zern
3e084f63f5 Merge "demux cosmetics: comments/rename internal function" into 0.3.0 2013-03-19 17:09:07 -07:00
James Zern
d3f8c621b5 Merge "move WebPFeatureFlags declaration" into 0.3.0 2013-03-19 17:08:31 -07:00
James Zern
7386fe5047 Merge "libwebp{demux,mux}: install mux_types.h" into 0.3.0 2013-03-19 17:07:32 -07:00
pascal massimino
d6cd4e9056 Merge "bump decode abi" into 0.3.0 2013-03-19 16:52:06 -07:00
James Zern
17f8da5c51 bump decode abi
treating as a patch number in this case to disambiguate releases.

Change-Id: Ica1379c66473a961f2dcd5f3282281b8bf1bc276
2013-03-19 16:48:56 -07:00
James Zern
f933fd2a27 move WebPFeatureFlags declaration
from private format_constants.h to public mux_types.h
also do the reverse for MKFOURCC()

Change-Id: I3aa86b007e9dbfed37a170989164ac3a77de2bd5
2013-03-19 16:10:41 -07:00
James Zern
289bc47b65 libwebp{demux,mux}: install mux_types.h
required by demux.h and mux.h

Change-Id: Ib33cee1d95e575233204e70b62caf7a6366772c7
2013-03-19 14:54:04 -07:00
Pascal Massimino
224e8d4630 add doc precision about WebPDemuxPartial()
it wasn't clear the data can be incomplete

Change-Id: I1482379aaea31e08a65c90f15e32edec2472e17e
2013-03-19 14:25:59 -07:00
James Zern
4c18e80cf7 demux cosmetics: comments/rename internal function
ParseFrame -> ParseAnimationFrame

Change-Id: I27538927d16285e0793be5be78b0f15f4155dd83
2013-03-19 13:55:29 -07:00
skal
f4ffb2d59a speed-up lossless (~3%) with ad-hoc histogram cost evaluation
* merge cost calculation functions (BitsEntropy() and HuffmanCost())
* have HistogramAdd() specialized into separate functions
* use threshold to bail-out early
* revamp code a bit

* also: save memory by freeing free(histogram_image)

Change-Id: I8ee5d2cfa1462d5d6ea6361f5c89925a3720ef55
2013-03-18 22:34:32 +01:00
pascal massimino
5621934e82 Merge "build: fix install race on shared headers" into 0.3.0 2013-03-17 02:38:16 -07:00
pascal massimino
70809d89bb Merge "bump version to 0.3.0" into 0.3.0 2013-03-17 02:32:37 -07:00
James Zern
d851cd1d85 demux: make the parse a bit more strict
* VP8L shouldn't have an alpha chunk
 * expect an animation to only contain frames, not a mix of image chunks
 * enforce ANIM/ANMF order
 * expect a full frame in a complete file

Change-Id: I953a8b6058f9bc00f1d042635548f158abdf6fce
2013-03-16 16:37:31 -07:00
James Zern
cef9388283 bump version to 0.3.0
libwebp{,decoder} - 0.3.0
libwebp libtool - 4.2.0 (compatible release)
libwebpdecoder libtool - 0.0.0 (new release)

mux/demux - 0.1.0
libtool - 0.0.0 (new release)

Change-Id: Ied6efa390b2f97f1f41fc8349a365613c639d6cc
2013-03-16 14:08:14 -07:00
James Zern
9048494df6 build: fix install race on shared headers
subdirectories with more than one target can have the install targets
run in parallel with make -jN. group the shared headers in one place to
produce a common install target.

Change-Id: I1f3aa338a8ee6d681de1e5d0b2c6244d2c3d5451
2013-03-16 13:29:49 -07:00
skal
744930dbe2 add support for BITS > 32
on x86_64 desktop, it's a little faster to use BITS=56
on MacOS (/llvm) it's _much_ faster (~10%)

Change-Id: I47c66ab7488341d8d1696d9301954b86b241b36d
2013-03-15 18:37:08 -07:00
James Zern
7bfc9056ad Merge "make alpha unfilter work in-place" into 0.3.0 2013-03-14 18:48:45 -07:00
James Zern
0037b2d280 Merge "add LUT-free reference code for YUV->RGB conversion." into 0.3.0 2013-03-14 18:44:29 -07:00
skal
126974b45b add LUT-free reference code for YUV->RGB conversion.
Reported to eventually be 4% on ARM
(see https://code.google.com/p/webp/issues/detail?id=134 for details)
We might activate it selectively later...

Output values is not bitwise the same as the LUT-based
version, but difference is only +/-1 at max.

Change-Id: I1cc790ff4459885ed2ae2e72f31c5f3740095f07
2013-03-15 01:37:55 +01:00
skal
0aef3ebdea make alpha unfilter work in-place
* remove a malloc
* remove the unused 'bpp' argument from filter/unfilter functions

Change-Id: I28d78baaaddc20f1d5a3bb2bd0b4e96a12a920d8
2013-03-15 01:36:38 +01:00
James Zern
252320e287 demux: disable fragment parsing
put this feature under WEBP_EXPERIMENTAL_FEATURES

Change-Id: I6405c5e6bed3ad1196aa1d111c83cca4c70c4c41
2013-03-13 13:54:53 -07:00
James Zern
5e338e0b9a Merge changes I33e8a613,I8e8a7b44 into 0.3.0
* changes:
  automake: add reference to libwebp for mux/demux
  libwebp{,decoder}.pc: add pthread flags
2013-03-13 13:17:24 -07:00
James Zern
d9d0ea1bf9 Merge changes If21e3ec7,I991fc30b into 0.3.0
* changes:
  add libwebpmux.pc
  add libwebpdemux.pc
2013-03-13 12:53:32 -07:00
James Zern
627f5ca66b automake: add reference to libwebp for mux/demux
this allows DLLs to be built under mingw and sets up a more obvious
dependency in the shared objects

Change-Id: I33e8a6132a16ca49563492438a1b3b74be9ed6a1
2013-03-13 12:29:37 -07:00
skal
eef73d07a3 don't consolidate proba stats too often
adds a minimum count before FinalizeToken() is called for update.

Change-Id: I445be6a3e347620583d87c33067cefa656a25039
2013-03-13 13:50:08 +01:00
James Zern
05ec4cc2d3 libwebp{,decoder}.pc: add pthread flags
expands to e.g., -lpthread/-pthread, etc. if --enable-threading is used
and additional libs/flags are required

Change-Id: I8e8a7b44450bee32ddc58097e1e309d972b1092a
2013-03-12 23:02:12 -07:00
James Zern
1bfcf5bf42 add libwebpmux.pc
Change-Id: If21e3ec73f2eb451c6042d1aecda8d03259f601f
2013-03-12 22:58:37 -07:00