Commit Graph

413 Commits

Author SHA1 Message Date
Pascal Massimino
a06bbe2e80 add WebPISetIOHooks() to set some custom hooks on the incremental decoder object.
Change-Id: I01e973a1e45e3d60dc11fd284df3cbb938cf0485
2011-07-07 16:38:03 -07:00
Pascal Massimino
5a18eb1a31 Merge "add Advanced Decoding Interface" 2011-06-20 16:30:01 -07:00
Pascal Massimino
5c4f27f9f5 add missing \n 2011-06-20 15:47:35 -07:00
Pascal Massimino
f4c4e416c0 80 cols fix 2011-06-20 15:39:40 -07:00
Pascal Massimino
d260310511 add Advanced Decoding Interface
You can now use WebPDecBuffer, WebPBitstreamFeatures and WebPDecoderOptions
to have better control over the decoding process (and the speed/quality tradeoff).

WebPDecoderOptions allow to:
 - turn fancy upsampler on/off
 - turn in-loop filter on/off
 - perform on-the-fly cropping
 - perform on the-fly rescale
(and more to come. Not all features are implemented yet).

On-the-fly cropping and scaling allow to save quite some memory
(as the decoding operation will now scale with the output's size, not
the input's one). It saves some CPU too (since for instance,
in-loop filtering is partially turned off where it doesn't matter,
and some YUV->RGB conversion operations are ommitted too).

The scaler uses summed area, so is mainly meant to be used for
downscaling (like: for generating thumbnails or previews).

Incremental decoding works with these new options.
More doc to come soon.

dwebp is now using the new decoding interface, with the new flags:
  -nofancy
  -nofilter
  -crop top left width height
  -scale width height

Change-Id: I08baf2fa291941686f4ef70a9cc2e4137874e85e
2011-06-20 15:30:52 -07:00
Pascal Massimino
bd2f65f67c sse2 version of the complex filter
12-15% faster.
(only inner edge is implemented for now)

patch by Somnath Banerjee (somnath at google dot com)
2011-06-20 00:27:47 -07:00
Pascal Massimino
96ed9ce0fb perform two idct transforms at a time when possible
patch by Christian Duvivier (cduvivier at google dot com)
2011-06-20 00:22:37 -07:00
Pascal Massimino
01af7b69cd use aligned stored 2011-06-18 08:27:16 -07:00
James Zern
23bf351e71 Enable decode SSE2 for Visual Studio
Change-Id: If32f8b1cfe415b2f9330af36a5dd0e31e49582b2
2011-06-17 18:12:01 -07:00
Somnath Banerjee
131a4b7b7b dec/dsp_sse2: fix visual studio compile
This addresses issue #80

Change-Id: Ia81ae21f85266dd64d39da63ff2fae33f9a572dc
2011-06-17 18:04:08 -07:00
Pascal Massimino
3be57b166f fix MSVC compile for WEBP_EXPERIMENTAL_FEATURES
patch by Ismail Keskin (iskeskin at gmail dot com)
fixes issue #82
2011-06-16 13:33:07 -07:00
James Zern
40a7e347ff dec/dsp: disable sse2 for Visual Studio builds
This is a temporary workaround for issue #80.

Currently dec/dsp_sse2 is not included in Makefile.vc. Simply adding it
will cause a build error, however, as cl does not support aligning
function parameters producing, e.g.,
src\dec\dsp_sse2.c(228) : error C2719: 'q1': formal parameter with
__declspec(align('16')) won't be aligned

Change-Id: Id29e6802dd29110e59c4f6d13ffa5d4793c750a0
2011-06-15 13:53:14 -07:00
Pascal Massimino
e4d540c842 add SSE2 code for transform
Pretty similar to the encoder's version
3% faster decoding on average

patch by Christian Duvivier (cduvivier at google dot com)
2011-06-15 10:51:31 -07:00
Pascal Massimino
c5d4584b2c call function pointers instead of C-version
will potentially call SSE2 version instead of the plain-C one
catch by Christian Duvivier (cduvivier at google dot com)
2011-06-14 18:57:50 -07:00
Pascal Massimino
a11009d7fc SSE2 version of simple in-loop filtering
~10% faster decoding

Patch by Somnath Banerjee (somnath at google dot com)

Change-Id: I200db408272b4f61cda9d9261d2d4370a698d6c4
2011-06-10 15:10:18 -07:00
Pascal Massimino
42548da9e3 shave one unneeded filter-cache line
There was 1 unneeded sample line allocated for the filter cache in of simple filtering.
+ Add an explaining comment.

Change-Id: I775a596c8b8643e773e0eade8aa341dc23fb290f
2011-06-09 12:08:08 -07:00
Pascal Massimino
1955969925 Merge "split expression in two." 2011-06-08 09:08:54 -07:00
Pascal Massimino
415dbe4625 split expression in two.
makes order of evaluation strictly defined.
(cf http://en.wikipedia.org/wiki/Sequence_point)

Suggestion by mr dot gnu dot jr at gmail dot com
2011-06-08 09:06:03 -07:00
James Zern
e29072a8ce configure: test for zlib only w/--enable-experimental
Only builds with --enable-experimental require zlib currently.
A base install of mingw will not include the development headers and
library. libwebp itself will now build in such environments.
Additionally, remove -lz from **/Makefile.am, -lz will be added to LIBS
by AC_CHECK_LIB when necessary.

Change-Id: Iae8319cdf00162ecb7ed44661c02f40beb34f155
2011-06-07 14:12:53 -07:00
James Zern
b2b0090b4c Simplify Visual Studio ifdefs
Use _MSC_VER as the intrinsics compile without /arch:SSE2 on x86.
Also avoids applying the same flag to all files which defeated the
purpose of the runtime cpu-detection.

Thanks to Frank B. for the suggestion!

Change-Id: Iae9933a3cee704e663d9bbd53d0fa68e8c025425
2011-06-03 11:40:15 -07:00
Pascal Massimino
ca7a2fd66d Add error reporting from encoding failures.
picture->error_code can be looked up for finer error diagnose.
Added readable error messages to cwebp too.

Should close bug #75 (http://code.google.com/p/webp/issues/detail?id=75)

Change-Id: I8889d06642d90702f698cd5c27441a058ddb3636
2011-06-02 07:06:39 -07:00
James Zern
003417c7c7 Enable SSE2 for Visual Studio builds
Based on the remnants of change #2273.
Adds an auto-detect for ARCH based on the environment.

Change-Id: I4644eae7509f3982a8b385b49beac03675a2e0e8
2011-06-01 12:57:18 -07:00
Pascal Massimino
af10db4aa4 little speed up for VP8BitUpdate()
1% faster on average

Patch by Somnath Banerjee (somnath at google dot com)

Change-Id: I44cbc125024d3b7ba8621643e9161b72f0eac281
2011-05-29 22:35:44 -07:00
Pascal Massimino
46d90363af cosmetics 2011-05-27 10:04:36 -07:00
Pascal Massimino
edf59ab320 typo fix 2011-05-27 09:55:47 -07:00
Mikolaj Zalewski
72229f5f34 Add support for x64 and SSE2 builds under Windows. 2011-05-26 16:50:46 +02:00
Pascal Massimino
92e5c6e1d4 VP8GetInfo() + WebPResetDecParams()
- add an internal VP8GetInfo() to parse header
- add WebPResetDecParams() for proper initialization

Change-Id: Ic39ea634d1d8016d25bdcfef2cb0d00b6dad83e9
2011-05-19 19:17:05 -07:00
Pascal Massimino
416b7a6b95 raise the fixed-point precision for the rescaler
for super-large upscaling factor (32x and up), 20bits was not enough.

Change-Id: I7b0d1975d0609948d464cfc3aeff1a70df16dc57
2011-05-16 17:12:37 -07:00
Pascal Massimino
aa87e4e063 fix alignment
Change-Id: I72d2c7a0faf240d3cada1b6fb86ffb32bead3eb2
2011-05-16 14:39:47 -07:00
Pascal Massimino
e9273902f1 align buffer for double too
sometimes, gcc insert sse2 storeu instructions (like in VP8InitFilter())
with aligment requirements.

Bug was visible 'sometimes' in non-debug mode, when trying to use -af.

Change-Id: If3ec282bbbb9f9d0d33ca4b2c4bed46cd26fe495
2011-05-05 19:32:38 -07:00
Pascal Massimino
d0a7038792 Merge "cosmetics" 2011-05-05 16:47:19 -07:00
Pascal Massimino
fc0a02e55d fix the dichotomy loop
we were reading past the end of the dqs[] array.

reported by Mathias Schindler (on cygwin only)
http://code.google.com/p/webp/issues/detail?id=71

Change-Id: Ib38c4c139e3cac3e8915626d63e16b403d6bbd63
2011-05-05 16:35:12 -07:00
Pascal Massimino
38369c03e0 cosmetics
Change-Id: I39c3bc671ab427dcb3e23aedee7fe8d81f4cb860
2011-05-04 23:25:40 -07:00
Pascal Massimino
8dfc4c6f17 factorize and unify GetAlpha() between the C and SSE2 version
patch by Christian Duvivier (cduvivier at google dot com)

Change-Id: I47ac75010aa4036cf09f13d23043e654c4966a00
2011-05-04 17:02:35 -07:00
Pascal Massimino
6d0e66c23e prepare experimentation with yuv444 / 422
+ add a simple rescaling function: WebPPictureRescale() for encoding
+ clean-up the memory managment around the alpha plane
+ fix some includes path by using "../webp/xxx.h" instead of "webp/xxx.h"

New flags for 'cwebp':
 -resize <width> <height>
 -444  (no effect)
 -422  (no effect)
 -400

Change-Id: I25a95f901493f939c2dd789e658493b83bd1abfa
2011-05-04 15:41:08 -07:00
Pascal Massimino
79cc49f5eb add a --enable-experimental option to './configure'
This will enable USE_EXPERIMENTAL_FEATURES instead of having a header-level #define

Change-Id: I860b007f64220ddf92d0becd18f7d100c718f8d1
2011-05-04 15:17:54 -07:00
Pascal Massimino
d757523889 sse2 version of CollectHistogram()
~3% faster encoding.

Patch by Christian Duvivier (cduvivier at google dot com)

Change-Id: I8c11d63d0cffb35e145fe0ea74cb66a53f4950d9
2011-04-28 17:00:57 -07:00
Pascal Massimino
c1c728d617 add an extra #ifdef WEBP_EXPERIMENTAL_FEATURES to avoid 'unused variable' warning
Change-Id: I8a42781eab1fad75e13cb85ac3f768d2405726e0
2011-04-28 16:31:14 -07:00
Pascal Massimino
60c61d2d54 always call VP*EncDeleteAlpha() unconditionnally, for simplicity
Change-Id: I145f94adf6ea11618170c0955e6ef2fa60756f1f
2011-04-28 16:30:48 -07:00
Pascal Massimino
0f8c63849d simply don't call WriteExtensions() if WEBP_EXPERIMENTAL_FEATURES is not defined
Change-Id: I81867dcc505376c800ba65d81f6a50e02161e707
2011-04-28 16:03:34 -07:00
Pascal Massimino
47c661d50f rename swap -> swap_rb
Change-Id: I054a4517376a027611cffb2484b22248adae2b77
2011-04-28 16:01:46 -07:00
Pascal Massimino
10d55bbb06 move chunk[] declaration out of the for() loop
Change-Id: I10df4b5d6d186bae2b9b1a174aab13c401c54b01
2011-04-28 15:52:44 -07:00
Pascal Massimino
517cec21b9 fix indentation
Change-Id: I868ec38999dc5249e9b93048049dd51422113677
2011-04-28 15:52:06 -07:00
Pascal Massimino
f7d9e261c5 fix merge problems
Change-Id: I6d0763734139d2852896872c80c5e7fa7889945a
2011-04-26 11:02:38 -07:00
Pascal Massimino
8fd42b3a81 add a stride 'a_stride' for the alpha plane
(instead of hardcoding it to 'width')

Change-Id: Ibce97285bfe8ff4aea45b5797f53a53d3f60adab
2011-04-26 07:31:57 -07:00
Pascal Massimino
b8dcbf2f35 fix alpha-plane copy and crop methods
the alpha-plane was not reallocated properly.

Change-Id: I5db445c7086b3c7c5cf98631d714350119dd7c2a
2011-04-26 06:37:45 -07:00
Pascal Massimino
cdef89de0e fix some 'unused variable' warning
Change-Id: I1d2747480675b68f57d7ef7bf0b0010d267cb32b
2011-04-26 06:34:39 -07:00
Pascal Massimino
fb29c26201 SSE2 version of the fwd transform and the squared sum metric
average 10% faster encoding.

Patch by Christian Duvivier (cduvivier at google dot com)

Change-Id: Iff1bba402b280522af323f73e0c817a3d665354a
2011-04-26 00:03:55 -07:00
Pascal Massimino
2ab4b72f53 EXPERIMENTAL: add support for alpha channel
This is a (minor) bitstream change: if the 'color_space' bit is set to '1'
(which is normally an undefined/invalid behaviour), we add extra data at the
end of partition #0 (so-called 'extensions')

Namely, we add the size of the extension data as 3 bytes (little-endian),
followed by a set of bits telling which extensions we're incorporating.
The data then _preceeds_ this trailing tags.

This is all experimental, and you'll need to have
'#define WEBP_EXPERIMENTAL_FEATURES' in webp/types.h to enable this code
(at your own risk! :))

Still, this hack produces almost-valid WebP file for decoders that don't
check this color_space bit. In particular, previous 'dwebp' (and for instance
Chrome) will recognize this files and decode them, but without the alpha
of course. Other decoder will just see random extra stuff at the end of
partition #0.

To experiment with the alpha-channel, you need to compile on Unix platform
and use PNGs for input/output.

If 'alpha.png' is a source with alpha channel, then you can try (on Unix):

  cwebp alpha.png -o alpha.webp
  dwebp alpha.webp -o test.png

cwebp now has a '-noalpha' flag to ignore any alpha information from the
source, if present.

More hacking and experimenting welcome!

Change-Id: I3c7b1fd8411c9e7a9f77690e898479ad85c52f3e
2011-04-25 23:29:39 -07:00
Pascal Massimino
cfbf88a6c4 add SSE2 functions. ~2x faster encoding on average.
For now, SSE2 functions are compiled a-minima: only on platforms
where __SSE2__ is defined. Let's later add some autoconf-based
config to enable/disable at will.

One can disable SSE2 at run-time by hooking-up VP8GetInfo.
There is a new option "-noasm" in cwebp for that.
Output should be binary the same between C and SSE2 version. If not,
that's a bug!

patch by Christian Duvivier (cduvivier at google dot com)

Change-Id: Iae006c3cdcb7e8280e846cedb94d239dab1e42ae
2011-04-22 15:34:23 -07:00
Pascal Massimino
e7ff3f9af6 merge two ITransforms together when applicable and change the TTransform
to return the sum directly.

output is bitwise the same, speed up 1-2%. This is preparatory to a
more efficient SSE2 implementation.

Change-Id: I0bcdf05808c93420fbe9dcb75e5e7e55a4ae5b89
2011-04-21 13:35:56 -07:00
Pascal Massimino
ca554137d2 fix WebPIDecGetRGB() to accept any RGB(A) mode, not just MODE_RGB
Change-Id: I8780582ecd0868c84e2b1310addebd6c8989e727
2011-04-20 08:42:08 -07:00
Pascal Massimino
276ae82512 Remove files not mean to be in git, and update .gitignore
Makes things lighter at the expense of requiring the user
to be up-to-date for autotools.

patch by Jan Engelhardt (jengelh at medozas dot de)

Change-Id: Icfcab2d899828a213d9fade0dab350dacd0c070a
2011-03-29 09:07:06 -07:00
Pascal Massimino
c5fa726e18 build: add pkgconfig files
patch by Jan Engelhardt (jengelh at medozas dot de)

fixes http://code.google.com/p/webp/issues/detail?id=64

Change-Id: I5b3bc9b88af967e48b949d9c85daacda45693b1f
2011-03-26 10:15:44 -07:00
Pascal Massimino
f8db5d5d1c more C89-fixes
going down to strict -ansi c89 is quite overkill (no 'inline',
and /* */-style comments).
But with these fixes, the code compiles with the stringent flags:
 -Wextra -Wold-style-definition -Wmissing-prototypes
 -Wmissing-declarations and -Wdeclaration-after-statement

Change-Id: I36222f8f505bcba3d9d1309ad98b5ccb04ec17e3
2011-03-25 15:19:37 -07:00
Pascal Massimino
650ffa3bbb add version getters for decoder and encoder
WebPGetDecoderVersion() and WebPGetEncoderVersion()
will not return 0.1.2 encoded as 0x000102

dwebp and cwebp also have a new "-version" flag

Change-Id: I4fb4b5a8fc4e53681a386ff4b74fffb639fa237a
2011-03-24 16:17:10 -07:00
Pascal Massimino
208afb5ea1 add c++ guards
Change-Id: I0d4fa090e88499e2e3f1571b149666bde3304cda
2011-03-23 18:41:18 -07:00
Pascal Massimino
8bf76fe0c8 add incremental decoding
The object WebPIDecoder is available to store the
decoding state. The flow is typically:

   WebPIDecoder* const idec = WebPINew(mode);
   while (has_more_data) {
     // ... (get additional data)
     status = WebPIAppend(idec, new_data, new_data_size);
     if (status != VP8_STATUS_SUSPENDED ||
       break;
     }

     // The above call decodes the current available buffer.
     // Part of the image can now be refreshed by calling to
     // WebPIDecGetRGB()/WebPIDecGetYUV() etc.
   }
   WebPIDelete(idec);

Doing so, one can try and decode new macroblocks everytime fresh
bytes are available.
There's two operating modes: either appending fresh bytes, or
updating the whole buffer with additional data in the end.
The latter requires less memcpy()'s

main patch by Somnath Banerjee (somnath at google.com)

Change-Id: Ie81cbd0b50f175743af06b1f964de838b9a10a4a
2011-03-23 18:33:26 -07:00
Pascal Massimino
1f28832834 'inline' isn't defined in strict ansi c89
=> don't use it if ANSI is define

Change-Id: Iebd7df224ff7f0e4bfddd3b2f17c1133e57c346f
2011-03-23 17:42:48 -07:00
Pascal Massimino
8b77c63262 move the quantization function to dsp.c
and add a function pointer for it

Change-Id: Ic7012e35c74a474bf140bb23cdaf9d6950026bc6
2011-03-23 17:41:00 -07:00
Pascal Massimino
b2c3575c8f add a 'last_y' field to WebPDecParams
this allows to keep an exact track of the last displayable pixel row

Change-Id: I590306735a82b9249e7bc9fe64eeb3e5bea3376b
2011-03-23 17:24:31 -07:00
Pascal Massimino
2654c3dadc correctly pass along the exact same status returned from ParsePartitions
Change-Id: I5e4ff98dd548b6dceaf36675faa988efb1f47b77
2011-03-23 17:22:07 -07:00
James Zern
e532b9abb1 Makefile: allow out of tree builds
use top_srcdir rather than top_builddir for AM_CPPFLAGS
add EXTRA_DIST to man Makefile. fixes distcheck target.

Change-Id: I308dc1c98f096de1efe188f63d040ef953598e78
2011-03-15 15:31:25 -07:00
Pascal Massimino
4c0da7aad5 enable sparse dc/ac transforms
non-zero dc-bit was mixed with non-zero ac-bit, preventing
finer optimization during VP8ReconstructBlock.
Depending on sparsity, i see 2-5% gain on average.

Change-Id: I7f34f18d0701c77837de3540b732e5b7d85d7c5d
2011-03-14 12:33:50 -07:00
Pascal Massimino
07dbb8d5af clarify the return logic
Change-Id: I2b5b239496da6545df2deede6d0ca28a2f9d46bf
2011-03-14 10:29:02 -07:00
Pascal Massimino
5c69e1bb4d fix bigger-by-1 array
and use enums for that.
props to Nigel Tao (at google dot com) for the fix

Change-Id: I68194cb510760dd82a2ae83359154bf622502991
2011-03-13 22:43:35 -07:00
Pascal Massimino
7c5267e36e fix a (harmless) typo: non_zero_ -> non_zero_ac_
props to Nigel Tao (at google dot com) for spotting it!

Change-Id: I113d714242e98edf02328a1898eb235899c07601
2011-03-13 20:36:43 -07:00
Pascal Massimino
bc75213572 fix missing free()
Change-Id: Ia09869321e00bb3fb8e92e5d91993ff583dc6cdf
2011-03-13 00:22:57 -08:00
Pascal Massimino
af3e2aaa04 remove trailing spaces
Change-Id: Ic92addd7c152e0216d5c9a35f5661914a5671f03
2011-03-10 15:57:18 -08:00
Pascal Massimino
13e50da6f8 make the bitreader preload at least 8bits, instead of post-load them
(this makes initialization easier and will be helpful for incremental
decoding).
Modify ParsePartitions() to accommodate for truncated input.

Change-Id: I62f52078d6b7a2314a11880a20d9eac5b4714bd0
2011-03-10 15:05:59 -08:00
Pascal Massimino
f4888f7702 emit 9 - nb_bits trailing zeros instead of 8
Change-Id: I3bd3eb8dac5bcc9fb0d41612ec610ca2046e8c7b
2011-03-10 14:57:38 -08:00
Pascal Massimino
3db6525574 separate block-parsing into a visible VP8DecodeMB()
This is to prepare for incremental decoding.

Change-Id: Ifc7e2df3e18eb56af3752cba8dfe08d370036d7f
2011-03-09 21:29:36 -08:00
Pascal Massimino
a871de0255 add missing extern "C"
Change-Id: Ie325dbbb1c1f0f55a3f207a32c67139f59c03bf2
2011-03-09 21:25:53 -08:00
Pascal Massimino
b3ce8c522a remove a gcc warning about type pun by using a proper union'd type
Change-Id: Ie2dd4aa696318daa84b90de009218311153c0613
2011-03-09 07:18:51 -08:00
Pascal Massimino
e1863715bf update after addition of webpi.h
Change-Id: I747bb0e6ba89ab6733d85ed688db2c608f7e6973
2011-03-09 07:03:40 -08:00
Pascal Massimino
3e856e2dd6 Extract some useful functions around decoding buffer WebPDecParams.
This is to prepare for incremental decoding.

Change-Id: Ibb1ac6c1f2d10e096c4fbcf0c06bce77b30ca457
2011-03-08 19:23:16 -08:00
Pascal Massimino
d5bc05a47b make the filtering process match libvpx and ffvp8
libvpx (and ffvp8) implementations are completely skipping the deblocking
step if loop_filter_level is 0, which is _not_ equivalent to performing
the loop-filtering with a 0 value for loop_filter_level. In the latter case
(which we followed), few pixels were modified here and there and you could
observe off-by-1 errors on few places.

This patch will reconcile the 3 implementations (since the difference
is minor, skipping the deblocking step will save CPU for virtually
no visible difference).

The spec will be made clearer about the expected behaviour:
* if the global loop_filter_level is 0, turn deblocking off.
* if it's not 0 but the local loop_filter_level ends up being 0 for whatever
reason (lf_delta, mode delta, ref delta, etc.) on a particular
macroblock, skip the deblocking too.

Change-Id: I157f1f8de463b8a76caddb3f347b7fbc7bd527d2
2011-03-08 18:47:08 -08:00
Pascal Massimino
c4fa36448b fix header
Change-Id: I982868e480434d19e2870780100b1df83df0800a
2011-02-27 21:51:10 -08:00
Pascal Massimino
5b70b378bd * add an option to bypass_filtering in VP8Io.
This will make the decoder skip the filtering process if needed,
resulting in speed-up, but also non-compliant (blocky?) output
+ Add a versioning check for VP8InitIo(), since we've adding a field to VP8Io
+ add some more error checks while at it

Change-Id: I4e9899edc24ecf8600cbb27aa4038490b7b2cef3
2011-02-27 10:55:33 -08:00
Pascal Massimino
b97a4003c0 simplify QuantizeBlock code a bit
Change-Id: I1130859756fa88e88957781f60a3701be354e2a3
2011-02-27 10:46:28 -08:00
Pascal Massimino
84b58ebba3 add more checks around picture allocation
covers overflow corner cases for 32/64bit platforms.

Change-Id: I0c9169264c33a4e9d0bbfdb026fb0d82c7e56de8
2011-02-27 10:31:20 -08:00
Pascal Massimino
b65a3e101e remove absolute_delta_ field and syntax code
we'll always encode using absolute value, not relative ones.
    Both methods use the same number of bits, so we'll go for the
    simpler and most robust one.
    + add some extra checks about pic->u/v being NULL.

Change-Id: I98ea01a1a6b133ab3c816c0fbc50e18269bd2098
2011-02-27 10:27:07 -08:00
Pascal Massimino
f61d14aabf a WebP encoder
converts PNG & JPEG to WebP

This is an experimental early version, with lot of room
of later optimizations in both speed and quality.

Compile with the usual `./configure && make`
Command line example is examples/cwebp

Usage:

   cwebp [options] -q quality input.png -o output.webp

where 'quality' is between 0 (poor) to 100 (very good).
Typical value is around 80.

More encoding options with 'cwebp -longhelp'

Change-Id: I577a94f6f622a0c44bdfa9daf1086ace89d45539
2011-02-18 23:54:59 -08:00
Pascal Massimino
87ffa005de typo: fix a missing 'R', was confusing.
Change-Id: I769ded6058f6c7eabc97fc7a772bc44a42cd826e
2011-02-17 09:59:34 -08:00
Pascal Massimino
746a4820b9 * make (*put)() hook return a bool for abort request.
* add an enum for VP8Status() to make things clearer

Change-Id: I458aeabab93f95d28e8ee10be699b677c04b4acb
2011-02-16 14:33:16 -08:00
Pascal Massimino
73c973e6da * strengthen riff/chunk size checks
* don't consider odd-sized chunks being an error

Change-Id: I2901b071232bb996680cf155e1a25a6a9388f222
2011-02-16 13:24:55 -08:00
Pascal Massimino
1dc4611a3a add support for PNG output (default)
regularize include guards

Change-Id: Ia1d0fa49c8c98e2c11f775b839d04a24e5450170
2011-01-31 22:25:44 -08:00
Pascal Massimino
860641df3f fix a typo: sizeof(kYModeProbaInter0) => sizeof(kUVModeProbaInter0)
report by mr dot gnu do jr at gmail dot org.

Change-Id: Iccd701ab1ec613a019f216e5cb37a18e5adfb4cf
2011-01-31 21:12:19 -08:00
Pascal Massimino
504d33937c fix eof_ mis-initialization
For very very short partitions, the initial GetByte() could
set eof_ to 1, whereas some bits were available but unread yet.
So we set eof_ to 0 last.

Change-Id: Ic6b68271bc72efa4de4e64e1f57307d1d8fb613c
2011-01-17 00:25:18 -08:00
Pascal Massimino
2bc0778f85 leftover Makefile.* from previous commit
Change-Id: If89dde15cd3f4a27ad95401a66f27fd5e079c5da
2011-01-08 07:16:20 -08:00
Pascal Massimino
d2cf04e48e move Makefile.am one level below, to src/dec
fix typos here and there
dwebp is now an installed program

autotools = lot of fun :)

Change-Id: Idd12a944dd8d6614e393122c4378e1f7ecf0e209
2011-01-07 18:16:04 -08:00
Pascal Massimino
ade92de8e0 typo: vp8.h -> decode_vp8.h
Change-Id: I860183182b5e531d38f10b81769c3e5911880b0b
2011-01-07 11:45:29 -08:00
Pascal Massimino
d7241241d1 forgot to declare types.h to be installed
Change-Id: I5edab197829e0148cbabd4a6dfe9e56279204fc6
2011-01-06 19:44:43 -08:00
Pascal Massimino
6421a7a4fb move the decoder sourcetree to a sub-location src/dec
to make room for future libs sources

also extract the types declaration into its own types.h file

Change-Id: I8bae8a323a479a29375cf509792228ae6af51c7a
2011-01-06 08:57:14 -08:00
Pascal Massimino
2330522cff handle corner case of zero-dimensions
Change-Id: I943a335b92b5ee6c2980c2ba9d4092f0b79f9a6b
2010-12-20 12:09:07 -08:00
Pascal Massimino
280c36583f make VP8Init() handle short buffers (< 2 bytes) correctly
Change-Id: Ie354a97f0dc44d95bd5fad92851a76cfdedae3de
2010-12-20 05:50:16 -08:00
Pascal Massimino
b1c9e8b48c handle error cases more robustly
Change-Id: I252fd9596d10db26026b8c577ad7f29ffd373f4c
2010-12-20 05:28:57 -08:00
Pascal Massimino
1e0a2d25f6 table-less version of clip_8b()
added some dynamic range analysis too.

Change-Id: I76804adbfceccd83639c5821b4f0f5b9e7d6c82c
2010-12-17 05:56:37 -08:00
Pascal Massimino
d72180a489 speed-up fancy upscaler
by processing two rows at a time.
The [9 3 3 1] weights are decomposed as
[1 1 1 1] + [0 2 2 0] + [8 0 0 0] for better
reuse of sub-expressions, too.

Change-Id: I87ab549048ed249d38add73bb3241dfa0c583328
2010-12-14 13:57:05 -08:00
Pascal Massimino
9145f3bc93 reset eof_ at construction time
not critical, but makes things sound

Change-Id: Ib013259924d38dca6f7521d7f1ab09ecc1d3b933
2010-12-02 11:39:29 -08:00
Pascal Massimino
a7ee0559f3 simplify the logic of GetCoeffs()
We only need to know _if_ there's some non-zero coeffs at all,
not the exact number of these.

+ code-style nits clean-up

Change-Id: Ice9acf00aef999d70affe4629cb56ae7709140ab
2010-11-28 23:13:33 -08:00
Pascal Massimino
f67b5939ad lot of cosmetics
just flushing the pile:
 - get rid of Put4 in dsp.c
 - move LD4 enum value
 - move more fields and code under the ONLY_KEYFRAME_CODE compile flag
 - update test_ref.ppm reference (now with FANCY_UPSCALER)
 - simplify VP8GetSignedValue()
 - use HE and VE naming for prediction mode instead of H and V
 - some missing c89 fixes
 - code style nits

all test vectors still passing
2010-11-17 20:09:47 -08:00
Pascal Massimino
ea27d7c6a8 fix endian problem on PowerPC
not super-elegant, but should work without
having to go into deeper hacking (like: creating
an endian.h file, etc.)

Change-Id: I43100ec67a22393c87e11357078efffc750060f5
2010-11-08 15:44:37 -08:00
Pascal Massimino
beb0a1badb fix signature of VP8StoreBlock
cygwin spotted that.

Change-Id: I24a0767b438b0937c5dbd85f8a6db1be8ab51e70
2010-11-03 17:52:00 -07:00
Pascal Massimino
b128c5e268 Merge "fancy chroma upscaling" 2010-11-03 16:33:13 -07:00
Pascal Massimino
6a37a2aaa9 fancy chroma upscaling
When FANCY_UPSCALING is defined, use a smoothing filter for upscaling
the U/V chroma fields. The filter used is a separable t[1 3 3 1] x [1 3 3 1]
filter. It can be easily changed in macros MIX_*.

The upscaling code reside on the thing shell between user and core
decoding (in webp.c), and not in the core decoder. As such, this smoothing
process can still be offloaded to GPU in some future and is not integral
part of the decoding process.

Coincidentaly: changed the way data is tranfered to user. For profile 2 (no
filtering), it used to be on a per-block basis. Now, for all profiles, we
emit rows of pixels (between 8 and 24 in height) when they are ready.
This makes the upscaling code much easier.

Will update the test vectors MD5 sums soon (as they'll be broken
after this change)

Change-Id: I2640ff12596cb8b843a4a376d7347447d9b9f778
2010-11-03 15:05:48 -07:00
Pascal Massimino
ff565edc25 fix two numeric typos
Change-Id: I817bb424919f26c64475795935135ee8783486dd
2010-11-03 14:17:21 -07:00
Pascal Massimino
5a936a0a21 use uintptr_t for casting pointers to ints
this is required on 32bit platforms
(and is the recommended way to do so, actually)

Change-Id: I8785be523e91a6ed2806612984b3830eab4da757
2010-11-01 15:07:12 -07:00
Pascal Massimino
296f691441 fix output loop for small height
the logic was broken in case of small height (1 macroblock row only).
2010-10-31 09:27:06 -07:00
Pascal Massimino
f09f96ee3f Fix declaration after statement warning
Change-Id: I038a3d547ada367c85d99cdae202562d644f19e0
2010-10-19 17:16:49 -04:00
Pascal Massimino
5981ee55ce Fix UV plane ac/dc quantizer transposition
Typo caused incorrect quantizer to be used for UV blocks.

Change-Id: I26faad370a16ea5b35ae49396d17b8903602499e
2010-10-14 20:38:23 -04:00
Pierre Joye
c8d15efa12 convert to ANSI-C 2010-10-06 14:37:28 -07:00
Pascal Massimino
c3f41cb47e Initial commit
Change-Id: I4712afb3912625e7aaccfa5160dcf78ee252f159
2010-09-30 09:55:07 -04:00