Commit Graph

424 Commits

Author SHA1 Message Date
skal
ad6ac32d7c simplify upsampler calls: only allow 'bottom' to be NULL
If 'top' was meant to be NULL, then bottom and top can be
swapped. Logic is simpler.

+ fix compilation in non-FANCY_UPSAMPLING mode

Change-Id: I7c62bbb59454017f072c0945d1ff2d24d89286ff
2013-08-19 16:47:51 -07:00
Pascal Massimino
d17186328c slightly faster ParseIntraMode
+ cosmetics

Change-Id: Icb906d5f84f025ef9e04b71a73801a22cc990ee5
2013-08-09 02:15:21 -07:00
skal
4038ed154d fix indent
Change-Id: I7f226ec4276e5e1b46896086a7d96cb67f36de6a
2013-07-26 17:03:19 -07:00
Pascal Massimino
8dcae8b3cf fix rescaling-with-alpha inaccuracy
(still missing YUVA decoding case for now)

https://code.google.com/p/webp/issues/detail?id=160

Change-Id: If723b4a5c0a303d0853ec9d839f995adce056095
2013-07-26 12:10:26 -07:00
Urvang Joshi
6df743a33e Decoder: handle fragments case correctly too.
Exit early from ParseHeaderInternal() in case of fragmented image too.

Change-Id: I3e24be2c869cc2d87c43b705257f21be81127dbd
2013-07-18 19:23:57 -07:00
Jyrki Alakuijala
b7346a1ed2 0.1 % speedup to decoding
Change-Id: If2add8a8b6f339f1d4b6a9581ce8d3d0f792d372
2013-07-09 18:47:06 -07:00
Pascal Massimino
f626fe2e9f Detect canvas and image size mismatch in decoder.
Will probably have to be re-visited when FRGM are
switched on.

Change-Id: I51c15e4c3887ab8f04d92ec783deca274cd09f41
2013-07-02 16:19:08 -07:00
Vikas Arora
8967b9f37e SSE2 for lossless decoding (critical) functions.
This speeds up WebP lossless decoding by 20%. In particular, the
photographic images get 35% speedup.

Change-Id: Idb94750342a140ec05df52c07e12be4bba335adc
2013-06-27 11:42:45 -07:00
Jyrki Alakuijala
699d80ea6b Jump-lookup for Huffman coding
speeds up those codes that are not part of the main lookup.
This gives a 10 % speedup for a photographic image.

Change-Id: Ief54b0ad77db790a01314402ad351b40ac9a7be4
2013-06-27 08:59:55 +02:00
skal
c34307abda fix some VS9 warnings about type conversion
Change-Id: Ia6db5f70cecb1d0c29536d710a22cc5107e242ea
2013-06-27 08:49:01 +02:00
skal
a4d5f59d9e Faster lossless decoding
Specialize and simplify the alpha-decoding case, which is used when:
 - no color-cache is use
 - all red/blue/alpha values are the same (and hence their Huffman tree has
 only 1 symbol. We don't need to consume any bits for reading these).

 + revamped the loop to use size_t and offsets instead of pointers.

 ~2-3% faster on Unix (gcc) but up to 25% faster lossy+alpha decoding
 on Mac (llvm) and ARM.

Change-Id: I43c9688d1e4811cab0ecf0108a5b8f45781083e6
2013-06-24 09:34:30 +02:00
James Zern
30e77d0f66 Merge branch '0.3.0'
* 0.3.0: (57 commits)
  update ChangeLog
  Regression fix for alpha channels using color cache:
  wicdec: silence a format warning
  muxedit: silence some uninitialized warnings
  update ChangeLog
  update NEWS
  bump version to 0.3.1
  Revert "add WebPBlendAlpha() function to blend colors against background"
  Simplify forward-WHT + SSE2 version
  probe input file and quick-check for WebP format.
  configure: improve gl/glut library test
  update copyright text
  configure: remove use of AS_VAR_APPEND
  fix EXIF parsing in PNG
  add doc precision for WebPPictureCopy() and WebPPictureView()
  remove datatype qualifier for vmnv
  fix a memory leak in gif2webp
  fix two minor memory leaks in webpmux
  remove some cruft from swig/libwebp.jar
  README: update swig notes
  ...

Conflicts:
	NEWS
	examples/gif2webp.c
	src/dec/alpha.c
	src/dec/idec.c
	src/dec/vp8l.c
	src/enc/alpha.c
	src/enc/vp8l.c

Change-Id: Ib202fad7825a090c3b3a5169acd171369cface47
2013-06-20 14:47:48 -07:00
skal
24cc307ae3 ~20% faster lossless decoding
We use help from small LUTs for Huffman decoding.

Change-Id: I58db4ecd37282822094519f2aa14cf544beba975
2013-06-20 09:41:29 +02:00
skal
313d853fa9 Speedup for decoding lossless WebP photographs:
use bit_pos instead num_bit to update the bit-reader
37.69 MB/s -> 39.79 MB/s, 5.6 %

Change-Id: Ica476cc3e2fc2db084d6961bea8586b050bb221d
2013-06-18 17:26:52 +02:00
skal
24ee098a00 change the bytes_per_pixels_ field into more evocative use_8b_decode
+ split AllocateInternalBuffers() into two 32b/8b variants instead of
trying to do everything in one function.

Change-Id: I35cac9fcd990a2194c95da4b2a4046ca3a514343
2013-06-18 17:24:14 +02:00
Urvang Joshi
7288950b88 Regression fix for alpha channels using color cache:
Considering the fact that insert to/lookup from the color cache is always 32
bit, use DecodeImageData() variant in that case.

Conflicts:
	src/dec/vp8l.c

Change-Id: I6c665a6cfbd9bd10651c1e82fa54e687cbd54a2b
(cherry picked from commit a37eff47d6)
2013-06-17 16:29:09 -07:00
Urvang Joshi
a37eff47d6 Regression fix for alpha channels using color cache:
Considering the fact that insert to/lookup from the color cache is always 32
bit, use DecodeImageData() variant in that case.

Change-Id: I6c665a6cfbd9bd10651c1e82fa54e687cbd54a2b
2013-06-17 03:49:30 -07:00
James Zern
a368db81c6 dec/vp8l: quiet vs9 x64 type conversion warning
src\dec\vp8l.c(816) : warning C4244: '=' : conversion from '__int64' to
'int', possible loss of data
src\dec\vp8l.c(817) : warning C4244: '=' : conversion from '__int64' to
'int', possible loss of data

Change-Id: I1d376d5dea909395bff8741aba16e8eed83a6e8f
2013-06-14 19:24:54 -07:00
James Zern
5a92c1a5e9 bump version to 0.3.1
libwebp{,decoder} - 0.3.1
libwebp libtool - 4.3.0 (compatible release)
libwebpdecoder libtool - 0.1.0 (compatible release)

mux/demux - 0.1.1
libtool - 0.1.0 (compatible release)

Change-Id: Icc8329a6bcd9eea5a715ea83f1535a66d6ba4b58
2013-06-12 23:19:13 -07:00
skal
86daf77c47 store top Y/U/V samples in packed fashion
More cache-line friendly than storing them split.

Change-Id: Ifb23cc3518ff1b5c37afe007558d4278868d75ea
2013-06-13 06:01:27 +02:00
Urvang Joshi
068db59e26 Intertwined decoding of alpha and RGB
This will reduce the time to first decoded pixel.

Change-Id: I07b900c0ed4af3aac806b2731e11cd18ec16d016
2013-06-12 14:10:59 -07:00
Urvang Joshi
3fa595a571 Support decoding upto given row in DECODE_DATA_FUNC
This is in preparation for supporting Intertwined decoding of RGB and
alpha.

Change-Id: Ie1905d1212f4a00718a64dca020be3f4b1b870ec
2013-06-11 16:00:58 -07:00
Urvang Joshi
520f005f85 DequantizeLevels(): Add 'row' and 'num_rows' args
Change-Id: I0032e25c30f34362105d942f2dbb9ac75200f911
2013-06-11 15:59:21 -07:00
Urvang Joshi
47374b8273 Alpha unfilter for given set of rows
Support reconstruction of small number of rows at a time.

Change-Id: Ief1bc78c7ad011ec6df856551f3beb5f907fd8e0
2013-06-11 15:57:42 -07:00
James Zern
c7e89cbb02 update copyright text
rather than symlink the webm/vpx terms, use the same header as libvpx to
reference in-tree files

based on the discussion in:
https://codereview.chromium.org/12771026/

Change-Id: Ia3067ecddefaa7ee01550136e00f7b3f086d4af4
(cherry picked from commit d640614d54)
2013-06-11 15:03:22 -07:00
skal
8112c8cf54 remove some warnings:
* "declaration of ‘index’ shadows a global declaration [-Wshadow]"
* "signed and unsigned type in conditional expression [-Wsign-compare]"

Change-Id: I891182d919b18b6c84048486e0385027bd93b57d
(cherry picked from commit 87a4fca25f)
2013-06-11 15:00:46 -07:00
Urvang Joshi
cc128e0bfc Further reduce memory to decode lossy+alpha images
Earlier such images were using roughly 9 * width * height bytes for
decoding. Now, they take 6 * width * height memory.

Change-Id: Ie4a681ca5074d96d64f30b2597fafdca648dd8f7
(cherry picked from commit 64c844863a)
2013-06-11 15:00:46 -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
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
James Zern
d640614d54 update copyright text
rather than symlink the webm/vpx terms, use the same header as libvpx to
reference in-tree files

based on the discussion in:
https://codereview.chromium.org/12771026/

Change-Id: Ia3067ecddefaa7ee01550136e00f7b3f086d4af4
2013-06-06 23:09:14 -07:00
skal
f4710e3b89 collect macroblock reconstruction data in VP8MBData struct
This is to better separate bitstream parsing from reconstruction.

Change-Id: I872b58e9940c4b14f72ebee50fba545468ff754c
2013-05-31 22:38:12 +02:00
skal
91413be2f9 reduce memory for VP8MB and remove bitfields use
~1% faster on ARMv7

Change-Id: I3e3524e0c25ebd31a04269aae0d304932f1a781a
2013-05-21 23:20:04 +02:00
skal
2451e47dca misc code cleanup
* remove dec->skip_
* fix some naming

(no speed diff observed)

Change-Id: I12545ef79d29dd6f893c344d8fb171b0a8c7cc46
2013-05-15 20:03:15 +02:00
skal
8983b83ee1 remove use of bit-fields in VP8FInfo
(in favor of just plain uint8_t's)

Change-Id: I6187587a4d8a9f5c304a132d98ec42ce24fd244a
2013-05-15 09:21:30 +02:00
skal
87a4fca25f remove some warnings:
* "declaration of ‘index’ shadows a global declaration [-Wshadow]"
* "signed and unsigned type in conditional expression [-Wsign-compare]"

Change-Id: I891182d919b18b6c84048486e0385027bd93b57d
2013-05-14 22:28:32 +02:00
Urvang Joshi
64c844863a Further reduce memory to decode lossy+alpha images
Earlier such images were using roughly 9 * width * height bytes for
decoding. Now, they take 6 * width * height memory.

Change-Id: Ie4a681ca5074d96d64f30b2597fafdca648dd8f7
2013-05-13 16:24:49 -07:00
Urvang Joshi
3ef79fefec Cosmetic: "width * height"
Change-Id: I567c0d95355160a9f6721f949b38e2b8b6270b7a
2013-05-10 13:39:58 -07:00
Urvang Joshi
edccd19436 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
2013-05-02 18:24:46 -07:00
skal
878b9da5bf fix missed optim
it's not often the case, but could happen, that chroma has non-zero
coeff but luma hasn't. In such case, we should skip luma right away

Change-Id: I9515573ffaec8aad8b069d2c02ffbda4a6eff97c
2013-04-25 22:46:12 +02:00
Urvang Joshi
00046171a5 VP8GetInfo(): Check for zero width or height.
Change-Id: I0bf40621ed0776e1a185ad8abab5a914a3d29d69
2013-04-25 12:08:40 -07:00
skal
5da165cfad fix CheckMode() signature
should have been 'const VP8Decoder* const dec', but actually
we just need to pass mb_x_ and mb_y_

Change-Id: I21ca0d67ab33302d6eaa45698d53ed6c2de76981
2013-04-24 14:33:44 +02:00
James Zern
9dbc9d1909 explicitly pad bitfields to 32-bits
suggested by fbarchard@chromium; may affect alignment in some cases

Change-Id: I63552eb1a0f9e81754d30ce6e9b1cfe5748bdbc9
2013-04-22 13:00:28 -07:00
James Zern
7ebdf110af Merge "Fix few missing comparisons to NULL" 2013-04-13 10:42:51 -07:00
Pascal Massimino
1579989e7b Fix few missing comparisons to NULL
Change-Id: I0d2ff8e8b507d17e80669b2b59fd5b017af995ed
2013-04-13 10:36:33 -07:00
Pascal Massimino
ea1b21cfdb Cleaned up VP8GetHeaders() so that it parses only frame header
Removed a call to WebPParseHeaders() inside VP8GetHeaders(). This was not needed
anyway, as all call flows already call WebPParseHeaders() before calling
VP8GetHeaders().

This avoids duplicate calls to WebPParseHeaders().

Change-Id: Icb2d618bd26c44220d956c17a69c9c45a62d5237
2013-04-11 11:35:18 -07:00
Urvang Joshi
a681b4f4e5 Rename PRE_VP8 state to WEBP_HEADER
Also, rename state VP8_FRAME_HEADER to VP8_HEADER (to be consistent with
VP8L_HEADER).

Change-Id: Ief2d2f483e36d37f00d8d0db87026ad059f27327
2013-04-08 14:46:05 -07:00
Urvang Joshi
ead4d47859 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
2013-04-08 14:29:14 -07:00
Urvang Joshi
d52b405dbd Cosmetic fixes
Change-Id: Ia878115086edc3fdfee3f0ca76e5e74ea5906f21
(cherry picked from commit e9a7990bc5)
2013-03-29 15:49:15 -07:00
skal
e5af49e9c0 add doc precision about WebPParseHeaders() return codes
Change-Id: I970900f4a5abb4877a716bd4eb15939655ef5dad
2013-03-25 17:54:46 -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
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
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
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
Urvang Joshi
956b217a8b WebPGetFeatures() behavior change:
It should return VP8_STATUS_NOT_ENOUGH_DATA when it doesn't have enough
data.

Change-Id: I5acff04f9ba51dab150dc6d137c5ad00ea61c64a
2013-02-27 15:27:43 -08:00
skal
5cf7792e40 split quant_levels.c into decoder and encoder version
-> split libraries further into decoder / encoder
-> add libwebpdecoder.a in Makefile.unix
-> make dwebp link against libwebpdecoder.a in Makefile.unix

also: in makefile.unix, pass EXTRA_FLAGS to LDFLAGS too
(otherwise, -m32 wouldn't work, e.g.)

Change-Id: Ief3da02a729dd86bbaf949ed048836716941657f
2013-02-24 21:40:39 +01:00
Pascal Massimino
ec2030a8a2 merge two lines together
Change-Id: I6f7935cfdac52d793ba08b1c050160d3417b8eb0
2013-02-19 23:01:10 -08:00
skal
1667bded67 Remove ReadOneBit() and ReadSymbolUnsafe()
Simplify and re-organize the VP8L bit-reader functions
(e.g.: the 40-bit look-ahead code was helping much)

Speed-up with LBITS=64, on arm7-a:

=> before:
./dwebp_justify_24_neon -v bryce_ll.webp
Time to decode picture: 11.393s
File bryce_ll.webp can be decoded (dimensions: 11158 x 2156).
...

=> after (LBITS=64):	Time to decode picture: 9.953s

making the VP8L bit-reader in 32 bit mode is going to be
harder (because we need to be able to read two symbols
at a time, each with max length 15 bits)

Change-Id: I89746fb103b87b5e2fd40a3208a6fbc584b88297
2013-02-20 00:13:23 +01:00
Pascal Massimino
b7adf37621 allow WebPINewRGB/YUVA to be passed a NULL output buffer.
If a NULL pre-allocated buffer is passed, a buffer will be automatically
allocated.

+ add some parameter checks.

reported in http://code.google.com/p/webp/issues/detail?id=139

Change-Id: I9e14ed97db30ee12e46b5e92aac7eeaaeb99bfd5
2013-01-28 00:07:32 -08:00
skal
8b2152c579 Merge "add an extra assert to check memory bounds" 2013-01-22 14:10:02 -08:00
skal
0d19fbff51 remove some -Wshadow warnings
these are quite noisy, but it's not a big deal to remove
them.

Change-Id: I5deb08f10263feb77e2cc8a70be44ad4f725febd
2013-01-22 23:06:28 +01:00
skal
cd22f655e8 add an extra assert to check memory bounds
-> will remove a static-analysis warning about unused value.
addresses issue #138

Change-Id: I8ba4bf71a41e32759da41907aab73108dd230bc4
2013-01-22 13:38:58 +01:00
Pascal Massimino
0f57dcc31f decoding speed-up (~1%)
- precompute filtering strength once for all at the beginning
  instead of per-macroblock
- reduce size of VP8MB struct from 8 bytes to 4.
- removed VP8StoreBlock() accordingly

Change-Id: Icf3d329473e21c464770be3d72a04c9ee4c321f2
2012-12-14 10:22:54 -08:00
skal
c34a3758ad introduce GetLargeValue() to slim-fast GetCoeffs().
GetCoeffs is (by far) the most consuming function of the decoder.
No speed change (unfortunately), but the main loop is somehow clearer.

Change-Id: I78f1c10cadc2c8696c041f5cbda86cab92cc6598
2012-11-28 08:24:23 +01:00
Urvang Joshi
23782f95b4 Separate out mux and demux code and libraries:
- Separate out mux.h and demux.h
- muxtypes.h: new header for data types common to mux/demux
- Move some misc read/write utilities to utils/utils.h
- Remove some duplicate methods.
- Separate out mux/demux libraries

Change-Id: If9b9569b10d55d922ad9317ef51710544315d6de
2012-11-19 11:40:18 -08:00
Urvang Joshi
a00a3daf5b Use 'frgm' instead of 'tile' in webpmux parameters
- Also, use the term 'fragments' instead of 'tiling' in code
- This makes code consistent with the spec.

Change-Id: Ibeccffc35db23bbedb88cc5e18e29e51621931f8
2012-11-06 16:09:10 -08:00
Urvang Joshi
f903cbab9a Chunk fourCCs for XMP/EXIF
Use separate fourCCs "XMP " and "EXIF" instead of a common "META"
Also, some refactorization in webpmux.c

Change-Id: Iad3337e5c1b81e785c60670ce28b1f536dd7ee31
2012-11-06 14:53:21 -08:00
James Zern
25f585c4f2 bump version to 0.2.1
lib - 0.2.1
libtool - 4.1.0 (compatible release)

Change-Id: Ib6ca47f2008d5c97d818422816ac60d0d0d8cffa
2012-10-29 19:17:17 -07:00
James Zern
fed7c0485a libwebp: validate chunk size in ParseOptionalChunks
the max wasn't checked leading to a rollover case, possibly exploitable.
additionally check the RIFF size early, to avoid similar issues.

pulled from chromium:
 http://codereview.chromium.org/11229048/

Change-Id: I4050b13a7e61ec023c0ef50958c45f651cf34c49
2012-10-29 14:00:33 -07:00
James Zern
c655380c36 dec/io.c: cosmetics
- deindent EmitAlphaRGB*
- add some missing consts

Change-Id: I65f88da295e6a0afa383fadc2ef90a40613c2d62
2012-08-15 10:27:54 -07:00
James Zern
fe1958f17d RGBA4444: harmonize lossless/lossy alpha values
lossy was rounding with a bias toward opaque:
[232+, 8] -> [15, 1]
now both paths use the range:
[240+, 16] -> [15, 1]

Change-Id: I3da2063b4959b9e9f45bae09e640acc1f43470c5
2012-08-14 14:02:30 -07:00
James Zern
681cb30ad2 fix RGBA4444 output w/fancy upsampling
compensates for the 1-line delay in the upscaler, outputting the correct
alpha row

Change-Id: Ia9a65bcb3cfa19e42185523cc6e706101a39d45d
2012-08-14 13:11:53 -07:00
James Zern
f06c1d8f7b Merge "Alignment fix" into 0.2.0 2012-08-09 16:09:58 -07:00
Urvang Joshi
f56e98fd11 Alignment fix
Change-Id: Ia5475247f03456b01571ae7531da90f74c068045
2012-08-10 02:10:32 +05:30
Pascal Massimino
6fe843baeb avoid rgb-premultiply if there's only trivial alpha values
With this, MODE_rgbA can safely be used without speed penalty
even in case of pure-lossy alpha-less input.
It's also an optimization when cropping a fully-opaque region from
an image with alpha: premultiply is then skipped

Change-Id: Ibee28c75744f193dacdfccd5a2e7cd1e44604db6
2012-08-09 11:33:29 -07:00
Urvang Joshi
a0a488554d Lossless decoder fix for a special transform order
Fix the lossless decoder for the case when it has to apply other
inverse transforms before applying Color indexing inverse transform.

The main idea is to make ColorIndexingInverse virtually in-place: we
use the fact that the argb_cache is allocated to accommodate all
*unpacked* pixels of a macro-row, not just *packed* pixels.

Change-Id: I27f11f3043f863dfd753cc2580bc5b36376800c4
2012-08-08 23:52:08 -07:00
Pascal Massimino
6f4272b090 remove unused ApplyInverseTransform()
transforms are only allowed for is_level0

Change-Id: Iec8ce8bdbe024aae6cae2688e2934ab8f445000c
2012-08-07 22:41:25 -07:00
Pascal Massimino
43b0d6107a add support for ARGB -> YUVA conversion for lossless decoder
This was returning an (hard-to-explain) error before.
(through WebPDecodeYUV() for instance).

+ rationalize the incremental API:
-> add WebPINewYUVA
-> deprecated WebPINewYUV
-> add WebPIDecGetYUVA
-> deprecated WebPIDecGetYUV

+ some NULL cosmetics

Change-Id: I39a6bd6018a34294d898b29f6c40e2cf76f1037e
2012-08-03 15:41:01 -07:00
Pascal Massimino
33705ca093 bump version to 0.2.0
Change-Id: I01cb50b9c4c8e9245aede3947481cbbd27d6a19d
2012-08-03 15:41:01 -07:00
Pascal Massimino
c40d7ef125 fix alpha-plane check + add extra checks
Change-Id: I9d8c9743f9d4f3d394544773ed2d0c31a9acf24d
2012-08-03 14:44:35 -07:00
James Zern
a06f802325 MODE_YUVA: set alpha to opaque if the image has none
this change avoids returning uninitialized alpha values when decoding
lossy with alpha to YUVA

Change-Id: I1e02459ac28b36f1f2b422063d057a5faba2f8f2
2012-08-03 12:04:44 -07:00
Pascal Massimino
bff34ac1ca harness some malloc/calloc to use WebPSafeMalloc and WebPSafeCalloc
quite a large security sweep.

Change-Id: If150dfbb46e6e9b56210473a109c8ad6ccd0cea4
2012-08-01 12:06:04 -07:00
Pascal Massimino
5955cf5e89 replace x*155/100 by x*101581>>16
Don't expect a visible speed diff. it's just cool.
(and, that's one less TODO in the code).

Change-Id: Iaeb2f1c930debb51501e170ee806f2f945fb1a8d
2012-07-24 15:06:00 -07:00
Pascal Massimino
2fc1301577 harmonize authors as "Name (mail@address)"
Change-Id: I85bfae61a37de75a5ed945a906002de2ef75149f
2012-07-19 16:09:47 -07:00
James Zern
ce156afccf add missing ABI compatibility checks
original change:
f7f16a2 add ABI compatibility check

Change-Id: I7cd6508f8d8e0d957a3d62ad52a117876fa5ec29
2012-07-18 22:24:33 -07:00
Pascal Massimino
f7f16a2976 add ABI compatibility check
minor revision shouldn't matter, we only check major revision number.
Bumped all version numbers so that incompatibility starts *now*

Change-Id: Id06c20f03039845ae4cfb3fd121807b931d67ee4
2012-07-18 11:53:25 -07:00
James Zern
9838e5d5ff decode.h: remove '* const' from function parameters
makes the public interface consistent and more readable

Change-Id: I067eb5ecc1094216ef6aecc65f636f69873de8f9
2012-07-17 15:48:00 -07:00
James Zern
9ff00cae72 bump encoder/decoder versions
those returned by WebPGet(Encoder|Decoder)Version()

Change-Id: I7584d04060ae7ca552f8f3aaf9df294d310a5be6
2012-07-17 13:43:39 -07:00
James Zern
d5e5ad6356 move decode_vp8.h from webp/ to dec/
the functions contained in it are now private

Change-Id: Ief6c81b32ae3f6d97052edac625716e5b909e66e
2012-07-16 22:12:59 -07:00
James Zern
02201c35a0 Merge "remove one malloc() by making color_cache non dynamic" into 0.2.0 2012-07-16 19:21:05 -07:00
James Zern
ab2da3e9fd Merge "add a malloc() check" into 0.2.0 2012-07-16 19:18:28 -07:00
Pascal Massimino
2d571bd89f add a malloc() check
mostly a sanity measure to be future-proof

Change-Id: I55a81345819b2a8e939c98f0da883dc5c0cc16a2
2012-07-16 19:15:00 -07:00
Pascal Massimino
7f0c178e46 remove one malloc() by making color_cache non dynamic
Change-Id: I7c71a056f79a79bfacfe64a263f1eb8476c05456
2012-07-16 19:13:58 -07:00
James Zern
ff771e7705 don't install webp/decode_vp8.h
the VP8 decode functions do not need to be public; only
GetInfo/CheckSignature need to be marked extern as they're used by
libwebpmux.

Change-Id: Id9ab4d6166b0271cf5d04563c6dac1fcc84adbdc
2012-07-14 21:23:03 -07:00
Pascal Massimino
b5e9067a28 fix some int <-> size_t mix for buffer sizes
could have led to some negative overflow on 32bit arch
(if it was not for the "total_size == (size_t)total_size" test)

Change-Id: I7640340b605b9c674d30dd58a1e2144707299683
2012-07-12 07:23:01 -07:00
Pascal Massimino
48b39eb17a fix underflow for very short bitstreams
+ hardened the asserts

Change-Id: Ie798ef2f9d848c131f6f84a35ea28ef254822d1e
2012-07-09 16:47:34 -07:00
Pascal Massimino
0fa844fb8f cosmetic fixes on assert and 'const' where applicable
Change-Id: Iede15b8464be453e7d12929513ed82183921265c
2012-07-03 05:50:36 -07:00
Pascal Massimino
7f22bd2596 check limit of width * height is 32 bits
Update the RIFF-specs file too

Change-Id: I113a7e25da2f7a19c1344c1dc5d496127cfe2596
2012-07-03 05:42:13 -07:00
James Zern
4c3975792b Merge "mark VP8{,L}{GetInfo,CheckSignature} as WEBP_EXTERN" 2012-06-29 10:31:26 -07:00
Urvang Joshi
3ba81bbe8b WebP Decoding error handling:
- Don't allow any extended chunks (except ALPH) without RIFF & VP8X
chunks.
- Also, don't allow VP8X without RIFF.

Change-Id: I1beba43e617ec637901aeeb93f2f484ec086a75d
2012-06-29 14:32:21 +05:30
Pascal Massimino
e012dfd90f make width/height coding match the spec
* width/height in VP8X chunk is 24bit now
* Added some more constants #defines

Change-Id: I2f8ca7f965a247bccd341dd079ed2abf549c39d7
2012-06-28 00:20:28 -07:00
James Zern
228d96a538 mark VP8{,L}{GetInfo,CheckSignature} as WEBP_EXTERN
these functions are used by libwebpmux

Change-Id: Ifcb79e685f3a6b53007c0dc5f220737daba97d47
2012-06-27 16:07:33 -07:00
Pascal Massimino
9144a18643 add overflow check before calling malloc()
It's preferable to be over-strict and paranoid here.

Change-Id: Ia928b279b753fa8f836d17decb17a35e6dc441b3
2012-06-20 23:58:43 -07:00
James Zern
69d022176d cosmetics: add missing const
Change-Id: I0c0e89bbe826961b02a40ada5a6f89e02abee378
2012-06-19 22:28:34 -07:00
Vikas Arora
8a69c7d8af Bug-fix: Clamp backward dist to 1.
Check for valid bounds on the 'dist' in backward reference case.
Clamp it to 1 in case of zero and negative values.

Change-Id: I78e956d4595955efa02b1f9628b475093f6ee001
2012-06-19 16:44:03 +05:30
James Zern
900285dac3 dec/vp8: avoid setting decoder status twice
Has the potential of returning confusing USER_ABORT for bitstream errors
in some cases.

Change-Id: I358fdb0b36549179df6dc2a95c09a872bd35aa24
2012-06-18 14:10:01 -07:00
James Zern
2f66668882 Merge "modify WebPParseHeaders to allow reuse by GetFeatures" 2012-06-12 23:51:55 -07:00
James Zern
fb4943bdf9 modify WebPParseHeaders to allow reuse by GetFeatures
moves the implementation to ParseHeadersInternal. this also allows
decoding to start at a VP8X sub-chunk, e.g. 'ALPH'.

Change-Id: I06791f87d90f888de32746ecb02705e4b0ff227a
2012-06-08 14:55:14 -07:00
Vikas Arora
eaee9e79f7 Bug-Fix: Decode small (less than 32 bytes) images.
ParseVP8X was checking for presence of extra 20 bytes (after RIFF header).
This check should not be executed for non-mux (non-VP8X) images.

Change-Id: I3fc89fa098ac0a53102e7bbf6c291269817c8e47
2012-06-08 14:30:56 +05:30
Vikas Arora
70eb2bd687 Stop indefinite recursion for Huffman Image.
Ensure that the lossless bit-stream doesn't allow for such cases and
safe-gaurd decoder against indefinite recursion.

Change-Id: Ia6d7f519291de8739f79a977a5800982872aae71
2012-06-07 17:27:19 +05:30
Pascal Massimino
d2b6c6c03b cosmetic fixes after Idaba281a
Change-Id: I275a3dee5696fe1a3e2db0976f8241f2044be512
2012-06-04 13:19:28 -07:00
Pascal Massimino
b4e6645c61 Merge "add colorspace for premultiplied alpha" 2012-06-04 07:56:37 -07:00
Pascal Massimino
48f827574e add colorspace for premultiplied alpha
The new modes are
       MODE_rgbA
       MODE_bgrA
       MODE_Argb
       MODE_rgbA_4444
It's binary incompatible, since the enums changed.

While at it, i removed the now unneeded KeepAlpha methods.
-> Saved ~12k of code!

* made explicit mention that alpha_plane is persistent,
so we have access to the full alpha plane data at all time.
Incremental decoding of alpha was planned for, but not
implemented. So better not dragged this constaint for now
and make the code easier until we revisit that.

Change-Id: Idaba281a6ca819965ca062d1c23329f36d90c7ff
2012-06-04 07:50:41 -07:00
Vikas Arora
069f903a08 Change in lossless bit-stream.
Change the lossless signature to 0x2f
Add 1 bit indicator for 'droppable (or trivial) alpha)'.
Add 3 bit lossless version (for future extension like yuv support).
Change the sub-resolution information to 3 bits implying range [2 .. 9]

Change-Id: Ic7b8c069240bbcd326cf5d5d4cd2dde8667851e2
2012-06-04 12:47:01 +05:30
Urvang Joshi
9ef3228301 Add support for raw lossless bitstream in decoder.
Previously, it used to assume any raw bitstream is a VP8 one.

Also,
- Factor out VP8CheckSignature() & VP8LCheckSignature().
- Use a local var for *data_ptr in ParseVP8Header() for
readability.

Change-Id: I0fa8aa177dad7865e00c8898f7e7ce76a9db19d5
2012-05-31 14:03:17 +05:30
Vikas Arora
7cbee29afa Fix bug: InitIo reseting fancy_upsampling flag.
frame's InitIo should not reset fancy_upsampling flag.
This flag (fancy_upsampling) is set via CustomSetup -> WebPIoInitFromOptions
and frame's InitIo() is resetting it to 0.

Change-Id: I64b54cdfba43799c0a5aa8e384575af5d6331674
2012-05-30 14:46:22 +05:30
Pascal Massimino
3bde22d768 fix bug with lossy-alpha output stride
dec->width_ != final_width in case of Bundle transform!

thanks to Pepijn for spotting the problem

Change-Id: I08b451a32097dcbf23b73deabc8cc6a2d59f0119
2012-05-24 08:54:02 -07:00
Urvang Joshi
c13f663261 Move consts to internal header format_constants.h
Change-Id: Ic6180c16d0b4245680738992925e4608c593fbe8
2012-05-24 15:02:02 +05:30
Pascal Massimino
7f2dfc92dc use a bit-set transforms_seen_ instead of looping
may be useful later for instance to bypass some code
if we know we don't use the Bundle+ColorMap transform.

Change-Id: I9dc70d18165b2363ad9ede763684ef3d8eba5903
2012-05-24 02:04:23 -07:00
Pascal Massimino
8f9117a9f0 cosmetics: signature fixes
Change-Id: Id0e1026d43c0a6928dd740c88117df638bfb6db6
2012-05-23 12:45:05 -07:00
Pascal Massimino
39bf5d6497 use header-less lossless bitstream for alpha channel
This saves ~26 bytes of headers.
* introduce new VP8LDecodeAlphaImageStream() for decoding
* use VP8LEncodeStream() for encoding
* refactor code a bit

still TODO: make the alpha-quality/enc-method user-configurable

Change-Id: I23e599bebe335cfb5868e746e076c3358ef12e71
2012-05-23 08:01:44 -07:00
Vikas Arora
9fc64edc21 Disallow re-use of same transformation.
Limit the overall number of transformations to 4 and disallow any
duplicate transform for decoding an image.

Change-Id: Ic4b0ecd553db96702e117fd073617237d95e45c0
2012-05-23 17:04:57 +05:30
Pascal Massimino
98ec717f1e use a function pointer for ProcessRows()
this allows later customization of data output method.
No perf diff observed, even if ProcessRows is no longer inlined.

Change-Id: I6933a3612a9cf6c108cf2776dfde0ae80c6c07c0
2012-05-23 02:00:14 -07:00
Pascal Massimino
140b89a323 factor out buffer alloc in AllocateARGBBuffers()
+ small opportunistic fixes:
  * allow NULL decoded_data to be passed to DecodeStream
    and clarity (with assert()) when to do so
  * AllocateAndInitRescaler() was already setting error status,
    as it should. No need to do it at caller's site

Change-Id: I30867e596564a7f459a0d1ddbf6f5d312414b7fd
2012-05-23 01:53:57 -07:00
Urvang Joshi
a107dfa806 Rectify WebPParseOptionalChunks().
Now it stops at either VP8/VP8L chunk.

Change-Id: Iadac4fa47396b61b9b720b8b7b19138c89df24cc
2012-05-23 13:59:52 +05:30
Vikas Arora
237eab6764 Add two more color-spaces for lossless decoding.
Added color-spaces (RGBA_4444 and RGB_565), required for Android device
to lossless decoding.

Change-Id: I229832edd4deca59e066f463e7454f77457c5bcd
2012-05-23 12:10:13 +05:30
Pascal Massimino
638528cd1e bitstream update for lossy alpha compression
now, we only use 2 bits for the filtering method, and 2 bits
for the compression method.
There's two additional bits which are INFORMATIVE, to specify
whether the source has been pre-processed (level reduction)
during compression. This can be used at decompression time
for some post-processing (see DequantizeLevels()).

New relevant spec excerpt:

     0                   1                   2                   3
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                      ChunkHeader('ALPH')                      |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |Rsv| P | F | C |     Alpha Bitstream...                        |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Compression method (C): 2 bits

: The compression method used:

  * `0`: No compression.
  * `1`: Backward reference counts encoded with arithmetic encoder.

Filtering method (F): 2 bits

: The filtering method used:

  * `0`: None.
  * `1`: Horizontal filter.
  * `2`: Vertical filter.
  * `3`: Gradient filter.

Pre-processing (P): 2 bits

: These INFORMATIVE bits are used to signal the pre-processing that has
been performed during compression. The decoder can use this information to
e.g. dither the values or smooth the gradients prior to display.

  * `0`: no pre-processing
  * `1`: level reduction

Decoders are not required to use this information in any specified way.

Reserved (Rsv): 2 bits

: SHOULD be `0`.

Alpha bitstream: _Chunk Size_ - `1` bytes

: Encoded alpha bitstream.

This optional chunk contains encoded alpha data for a single tile.
Either **ALL or NONE** of the tiles must contain this chunk.

The alpha channel data is losslessly stored as raw data (when
compression method is '0') or compressed using the lossless format
(when the compression method is '1').

Change-Id: Ied8f5fb922707a953e6a2b601c69c73e552dda6b
2012-05-22 02:36:22 -07:00
Pascal Massimino
3e863dda61 remove tcoder, switch alpha-plane compression to lossless
* Method #1 is now calling the lossless encoder on the alpha plane.
Format is not final, it's just a first draft. We need ad-hoc functions.
* removed now useless utils/alpha.*
* added utils/quant_levels.h instead
* removed the TCoder code altogether

Change-Id: I636840b6129a43171b74860e0a0fc5bb1bcffc6a
2012-05-21 06:24:48 -07:00
Urvang Joshi
9f547450e0 Catch an error in DecodeImageData().
When we are at end-of-stream, but haven't decoded all pixels, we should
return an error.
Also remove an obsolete TODO.

Change-Id: I3fb1646136e706da536d537a54d1fa487a890630
2012-05-11 14:10:01 +05:30
Urvang Joshi
14757f8ae2 Make sure huffman trees always have valid symbols
- Symbols added to the tree are valid inside HuffmanTreeBuildExplicit().
- In HuffmanTreeBuildImplicit(), make sure 'root_symbol' is
valid in case of a single symbol tree.

Change-Id: I7de5de71ff28f41e2d6228b29ed8dd4a20813e99
2012-05-10 11:40:18 +05:30
Urvang Joshi
ce69177a41 Fix a crash due to wrong pointer-integer arithmetic.
[Basically, the condition "src - dist < data" can be wrongly evaluated
to be false if "src < dist" due to underflow. Instead, "src - data <
dist" is the correct condition, as "src > data" is always true and so
there would never be an underflow].

Change-Id: Ic9f64bfe76a9acae97abc1fb7c1f4868e81f1eb8
2012-05-09 14:40:06 +05:30
Urvang Joshi
e40a3684f5 Fix a crash in lossless decoder.
This was due to incorrect update of 'ok'.

Change-Id: I91edfb5682527e8bc7eaa10e635c0261edb016b6
2012-05-09 14:35:11 +05:30
James Zern
126e160672 cosmetics
vp8.[hc]:fix '*' placement in pointer types
vp8l.c: remove trailing ',' from enum
decode.h: fix stray WebPINew()

Change-Id: Id6749a14a12ed0a090649f28ef4267fda45a37a8
2012-05-07 17:47:51 -07:00
Vikas Arora
781c01f421 Simple Huffman code changes.
No empty trees are codified with the simple Huffman code. The simple Huffman
code is simplified to be either a 1-bit code or 8-bit code for symbols.

Change-Id: I3e2813027b5a643862729339303d80197c497aff
2012-05-07 14:25:21 -07:00
Urvang Joshi
a2849bc502 Lossless decoder: remove an unneeded param in ReadHuffmanCodeLengths().
Change-Id: I279452fdf38b680737d5ba6e868a219281bc8962
2012-05-07 14:25:20 -07:00
Pascal Massimino
8415ddf3be further simplification for the meta-Huffman coding
* don't transmit the number of Huffman tree group explicitly
* move color-cache information before the meta-Huffman block

* also add a check that color_cache_bits is in [1..11] range, as per spec.

Change-Id: I81d7711068653b509cdbc1151d93e229c4254580
2012-05-07 14:25:07 -07:00
Vikas Arora
e38b40a996 Factorize code for clearing HtreeGroup.
Change-Id: I29de6dab7383b8cf071eec155e01340d5fdadee5
2012-05-07 14:24:53 -07:00
James Zern
5c5be8ba69 VP8[L]GetInfo: check input pointers
validate data before using & width/height before assigning.

Change-Id: I0872e80fcbfea295d7c633b0d4cb7809e1d1883b
2012-05-02 16:05:02 -07:00
James Zern
02f27fbd3b dec: remove deprecated WebPINew()
Change-Id: I22ad1d297333f5ebc84456d142426a4e0e9a044b
2012-04-27 19:47:35 -07:00
Pascal Massimino
c8139fbe5d Merge "few cosmetics" 2012-04-24 23:47:06 -07:00
James Zern
532020f24a lossless: remove some size_t -> int conversions
Sizes are given as ints in the documentation and used as such elsewhere.

Change-Id: I51ecd9e501cf9b4e3948aa0e947d2c9b5c85a30f
2012-04-24 16:00:00 -07:00
Pascal Massimino
23be6edfd4 few cosmetics
Change-Id: I85b44d811ecc7c551b75e74e64115e74645836b6
2012-04-24 11:53:10 -07:00
James Zern
39a57dae22 Makefile.am: header file maintenance
src/dec/Makefile.am: add missing reference to vp8li.h
src/{dec,dsp,enc}/Makefile.am: move some headers to noinst_

Change-Id: I0e2bc69980bd8175d99ad0ab63f537ef9e425b77
2012-04-23 18:53:48 -07:00
Vikas Arora
231ec1fb6d Removing the indirection of meta-huffman tables.
Now, the indexing refers directly to 5 huffman codes  that must be encoded separately.

Change-Id: I4deeb04de1997e6d20c376046d2053ec7ee918de
2012-04-23 08:36:14 -07:00
James Zern
2e75a9a1ba Merge "decode.h: use size_t consistently" 2012-04-19 22:49:47 -07:00
James Zern
9b3d1f3a1b decode.h: use size_t consistently
replaces mixed use of int/uint32_t for buffer sizes
further changes the API/ABI.

Change-Id: I91d70fd82ee3e1ac34b884b8ead9a114a9b1015a
2012-04-19 14:31:31 -07:00
pascal massimino
64083d3c89 Merge "Makefile.am: cosmetics" 2012-04-19 13:51:33 -07:00
James Zern
dceb8b4d9a Merge changes If1331d3c,I86fe3847
* changes:
  types.h: centralize use of stddef.h
  vp8io: use size_t for buffer size
2012-04-14 13:01:14 -07:00
Pascal Massimino
fac0f12e1b rename BitReader to VP8LBitReader
Change-Id: I192b76422e131a94fb58c2c4a5520a5dba807126
2012-04-13 01:56:31 -07:00
James Zern
fbd82b5a39 types.h: centralize use of stddef.h
for size_t / NULL

Change-Id: If1331d3cf44296ed0ba9e838eae2f5b1bcaeb61b
2012-04-12 17:14:58 -07:00
James Zern
2154835f73 Makefile.am: cosmetics
- use common file organization across subdir makefiles
- append lib/source/header list variables and sort

Change-Id: I0653e1c73a4552b0c43d21f321b22b4972d6e87b
2012-04-12 15:53:06 -07:00
James Zern
90ead710dc fix some more uint32_t -> size_t typing
Change-Id: Ibbe85ff4a700b17126a65e9ca5a3fa8cbf00b8a6
2012-04-12 13:06:54 -07:00
James Zern
8d254a0927 cosmetics
long line, remove out of date TODO

Change-Id: Ic8a40c9d731178af85645b3e24c1cbd807d7d58b
2012-04-11 15:44:48 -07:00
Pascal Massimino
6860c2ea9d fix some uint32_t -> size_t typing
Change-Id: I078243802a67498dfcd3d15b5f1bebf4b6b3b1bb
2012-04-11 04:27:45 -07:00
Urvang Joshi
4af1858a10 Fix a crash due to max symbol in a tree >= alphabet size
(cherry picked from commit 15253f91567ce7a2a4a3de8d70e54ba4b0641af3)

Change-Id: I4fbeaea4c712dae3bef078aef9d302b44bc39ffb
2012-04-10 23:07:13 -07:00
Pascal Massimino
6f01b830e2 split the VP8 and VP8L decoding properly
* each with their own decoder instances.
* Refactor the incremental buffer-update code a lot.
* remove br_offset_ for VP8LDecoder along the way
* make VP8GetHeaders() be used only for VP8, not VP8L bitstream
* remove VP8LInitDecoder()
* rename VP8LBitReaderResize() to VP8LBitReaderSetBuffer()
(cherry picked from commit 5529a2e6d47212a721ca4ab003215f97bd88ebb4)

Change-Id: I58f0b8abe1ef31c8b0e1a6175d2d86b863793ead
2012-04-10 23:06:58 -07:00
James Zern
f2623dbe58 enable lossless decoder
import changes from experimental 5529a2e^
and enable build in autoconf and makefile.unix; windows will be treated
separately.

Change-Id: Ie2e177a99db63190b4cd647b3edee3b4e13719e9
2012-04-10 23:06:36 -07:00
James Zern
b96efd7d50 add dec/vp8i.h changes from experimental
Pulled from 5529a2e^.

Change-Id: I51fe7a9c3acf1be4c43af834fd525ab3be5d7e65
2012-04-10 23:05:57 -07:00
James Zern
19f6398ed7 add dec/vp8l{i.h,.c} from experimental
Pulled from 5529a2e^.
The history of this and related files is a bit entangled so rather
trying to split the changes and introduce some noise in master's history
we'll start with a fresh snapshot.
The file progression is still available in the experimental branch.

Change-Id: I490a49cb0084d556a29d7c5257c986ea695ce60c
2012-04-10 23:05:14 -07:00
Pascal Massimino
1db888ba40 take colorspace into account when cropping
(cherry picked from commit 4e33653b52637c74ae30adde7990265d1d43994b)

Conflicts:

	src/dec/vp8l.c
2012-03-30 12:48:24 -07:00
Pascal Massimino
61c2d51fd7 move the rescaling code into its own file and make enc/ and dec/ use it.
(cherry picked from commit 8e92d9e380a89b7443a2e2c3d16ce5a222e8c1e8)

Conflicts:

	Android.mk
	makefile.unix
	src/dec/vp8l.c
	src/utils/Makefile.am
2012-03-30 12:16:25 -07:00
Urvang Joshi
efc2016a31 Make rescaler methods generic
to be used in rescaling of lossless bitstreams.
(cherry picked from commit 2e12a3045498b6faf13b93bc25391e8226119f0a)
2012-03-30 11:57:07 -07:00
Urvang Joshi
3eacee8158 Move rescaler methods out of io.c.
(cherry picked from commit b5e9db1824f6efbe0bfb87e94b8d6e88a7973ef7)
2012-03-30 11:56:51 -07:00
Scott LaVarnway
ed278e2279 Removed unnecessary lookup
The lookup value is the same as the index.  The index in this
case is either a 0 or 1.

Change-Id: I0432dfcbea9e7bb20bca7574e25fb1fd8a51c8e9
2012-03-26 11:44:04 -04:00
Pascal Massimino
cd8c3ba78f fix some warnings: down-cast and possibly-uninitialized variable
Change-Id: I5baf59bbcd5dcff69316b0601483ff5abe8e1454
2012-03-16 20:20:33 -07:00
pascal massimino
8abaf82083 Merge "silence some type size related warnings" 2012-02-09 19:21:39 -08:00
James Zern
1601a39b09 silence some type size related warnings
size_t/ptrdiff_t -> uint32_t

Change-Id: Ic4d889b9239752311b9ed906c83076829d850874
2012-02-09 13:00:09 -08:00
pascal massimino
f3abe520ac Merge "idec: simplify buffer size calculation" 2012-02-09 01:25:00 -08:00
James Zern
a9c5cd4c97 idec: simplify buffer size calculation
Change-Id: Id0e20c44704ef9b0e14dcf5e71a05cea488fd95a
2012-02-08 14:29:25 -08:00
James Zern
5081db78be configure/automake: no -version-info for convenience libs
Silences:
libtool: link: warning: `-version-info/-version-number' is ignored for
convenience libraries

Change-Id: I5705383b58f529fb06c2bf0932976b5a202446b6
2012-02-07 18:06:20 -08:00
pascal massimino
85b6ff6897 Merge "idec: fix WebPIUpdate failure" 2012-01-31 23:39:02 -08:00
James Zern
7bb6a9ccd6 idec: fix internal state corruption
A call to Append/Update would index the parts_ array w/-1 as num_parts_
had yet to be set by DecodePartition0. This would cause corruption
within the VP8Decoder member.

Fixes issue #106.

Change-Id: Ib9f2811594ff19e948a66fda862a4e0a384bb9aa
2012-01-31 17:10:29 -08:00
James Zern
89cd1bb85b idec: fix WebPIUpdate failure
If the first call to WebPIUpdate contained all of partition 0, but not
enough to decode a macroblock the test for max macro block size could
fail (4096 bytes) due to a memory buffer offset not being updated.
This change offsets the buffer in the same manner as Append().

Fixes issue #105.

Change-Id: I90ca3d0dde92eedc076933b8349d2d297f2469e8
2012-01-31 16:55:10 -08:00
pascal massimino
631117ea5e Merge "cosmetics & warnings" 2012-01-30 22:04:11 -08:00
James Zern
a0b2736d79 cosmetics & warnings
- remove some unused functions
- move global arrays from data to read only section
- explicitly cast malloc returns; not specifically necessary, but helps
  show intent
- miscellaneous formatting

Change-Id: Ib15fe5b37fe6c29c369ad928bdc3a7290cd13c84
2012-01-30 17:19:53 -08:00
Pascal Massimino
f73947f41d use 32bit for storing dequant coeffs, instead of 16b.
is a tad faster

Change-Id: Ibef8f3b4f3f04a9a647098e5946f616e211a61cd
2012-01-29 17:38:37 -08:00
Pascal Massimino
28a9d9b41a speed-up GetResidualCost()
+ misc cosmetics and code polishing

Change-Id: I5830cd2f268d64c072b1cbccc0a4674833875055
2012-01-23 02:36:38 -08:00
Pascal Massimino
378086bd0a misc cosmetics
Change-Id: Iafc73f9fece13b5ca900a8b9c1039268872a181b
2012-01-22 23:20:53 -08:00
Pascal Massimino
f0d2c7a76f pass of cosmetics
Change-Id: Id031221b7499e8cfc460c873d0f8124c9bef3aa3
2012-01-17 18:32:27 -08:00
Vikas Arora
221a06bb16 Fix bug for Alpha in RGBA_4444 color-mode.
Fix bug for Alpha data in RGBA_4444 color-mode.
The Alpha data is required to be clipped [0, 15] while
converting from 8 bits to 4 bits.

Change-Id: I80705d575c35121beb9633a05ec8823435c79586
2012-01-09 14:07:30 +05:30
James Zern
ad1e163a0d cosmetics: normalize copyright headers
Change-Id: I5e2462b101e0447a4f15a1455c07131bc97a52dd
2012-01-06 14:49:06 -08:00
James Zern
b1662b0530 fix some more type conversion warnings w/MSVC
API & memory related warnings will be dealt with separately

Change-Id: I8a7893baa4d5035c963fb3c16e0bb4eee742e968
2011-12-21 16:07:16 -08:00
Pascal Massimino
223d8c60aa fix some uint64_t -> int conversion warnings with MSC
Change-Id: I5dc314c9d1a3cbda095be3c90886983500104867
2011-12-21 14:43:52 -08:00
James Zern
421eb99db3 Merge "Remove assigned-but-not-used variable "br"" 2011-12-08 10:41:18 -08:00
Martin Olsson
a5d7ed5c4b Remove assigned-but-not-used variable "br"
Fixes gcc 4.6.x -Wunused-but-set-variable compiler warning:

	libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -Wextra -Wall -Wunused-but-set-variable -MT libwebpdecode_la-idec.lo -MD -MP -MF .deps/libwebpdecode_la-idec.Tpo -c idec.c  -fPIC -DPIC -o .libs/libwebpdecode_la-idec.o
	idec.c: In function 'DecodeRemaining':
	idec.c:371:17: warning: variable 'br' set but not used [-Wunused-but-set-variable]

Change-Id: Ib037be9634b5b802ba9f1e2ef156a8fdf9630752
2011-12-08 15:42:01 +01:00
Pascal Massimino
f62d2c9497 remove unused 'has_alpha' from VP8GetInfo() signature
alpha information is not to be found at RIFF chunks level, not
in the VP8 bitstream (that was a tmp hack)

Change-Id: Idd1629c696b03c26f6f30650d7216f627f1761df
2011-12-08 06:41:40 -08:00
Urvang Joshi
8666a93aae Some bug-fixes for images with alpha.
- Fix the off-by-one diff when cropping with simple-filter.
- Fix a bug in incremental decoding in case of alpha.
- In VP8FinishRow(), do not decode alpha when y_start > y_end.
- Correct output of alpha channel for MODE_ARGB.
- Correct output of alpha channel for MODE_RGBA_4444.

Change-Id: I785763a2a704b973cc742ad93ffbb53699d1fc0a
2011-12-07 15:12:50 +05:30
Pascal Massimino
273a12a013 fix off-by-1 diff in case cropping and simple filtering
Change-Id: I6dea172d0cf129f9986b8a3e1eea85fa97a70402
2011-12-05 08:37:55 -08:00
James Zern
721f3f48e7 fix alpha decode
- remove left-over WEBP_EXPERIMENTAL_FEATURES #ifdef

Change-Id: I2b91ccd2e2b3ebea63d5f698f90206feec30a4db
2011-12-02 11:00:27 -08:00
Pascal Massimino
60942c8cea fix the has_alpha_ order
Change-Id: I26211732584f6181bf763497818b45515e394c21
2011-12-02 10:26:42 -08:00
Vikas Arora
885f25bc83 Updated the includes to relative paths.
Change-Id: I0ea1a59dd0f6cb1df9f41e048e0c5a13e7fb8335
2011-12-01 15:30:41 +05:30
Vikas Arora
d117a94046 Add Alpha Decode support from WebPDecode.
Extend WebP decode functionality to extract Alpha data (support ALPH
chunk) and decode the Alpha plane using Alpha (utils/alpha) core-lib.

Change-Id: I6f0ee1b189c13caba3c1dd9b681383bfd00aa212
2011-12-01 11:24:50 +05:30
pascal massimino
059f03ef99 Merge "dec: validate colorspace before using as array index" 2011-11-17 10:24:59 -08:00
James Zern
469d6eb974 Merge "Makefile.am: remove redundant noinst_HEADERS" 2011-11-16 18:41:55 -08:00
James Zern
9fe3372f19 dec: validate colorspace before using as array index
Change-Id: I5bcf01769d58d39a5f8d50f54cf0cd83a2309602
2011-11-16 18:21:56 -08:00
James Zern
ced3e3f4e0 Makefile.am: remove redundant noinst_HEADERS
When they appear in _SOURCES they won't be installed [1].

[1]: http://www.gnu.org/software/automake/manual/automake.html#Headers

Change-Id: I14fd816294682e7bd0fccefd6428e1526c9470d8
2011-11-11 16:29:32 -08:00
James Zern
964387ed19 use WEBP_INLINE for inline function declarations
removes a #define inline, objectionable in certain projects

Change-Id: Iebe0ce0b25a030756304d402679ef769e5f854d1
2011-11-11 10:53:58 -08:00
Vikas Arora
f07b2138cd Rectify the Chunk parsing logic.
For odd-sized chunk-payload, there's one Byte padding at the end to make the
next chunk start at even-address. The chunk-skip logic needs to be updated to
handle such cases.

Change-Id: I8939ed07584a6195092fbe703eb0ea711fa5f153
2011-10-31 18:47:33 -07:00
Pascal Massimino
42c2e682e0 Fix missing coma (on uncompiled code)
Spotted by Jakub, Thanks!

Change-Id: Ic2509acc683690748089b831ee3d109ad2162dc2
2011-10-27 06:37:36 -07:00
James Zern
563e52d62e cosmetics after '76036f5 Refactor decoder library'
reference 'VP8X' consistently / spelling
sort header size defines alphabetically on their logical boundaries
drop useless cast
const updates

Change-Id: I9409814c5b89773ae8910dc74887f91435e6ac82
2011-09-16 12:32:03 -07:00