Commit Graph

20 Commits

Author SHA1 Message Date
James Zern
2d0da681fb makefile.unix: disable Wvla by default
bad merge from fc7815d restored the flag.

Change-Id: Ifbc6c5f78f80934c0ddd26bcd2ea8ea110ab6385
2011-07-22 18:52:17 -07:00
Pascal Massimino
fc7815d692 multi-thread decoding: ~25-30% faster
To be enabled with the flag WEBP_USE_THREAD.
For now it's only available on unix (pthread), when using Makefile.unix
Will be switched on more generally later.

In-loop filtering and output (=rescaling/yuv->rgb conversion)
is done in parallel to bitstream decoding, lagging 1 row behind.

Example:
examples/dwebp bryce.webp -v
Time to decode picture: 0.680s

examples/dwebp bryce.webp -v -mt
Time to decode picture: 0.515s

Change-Id: Ic30a897423137a3bdace9c4e30465ef758fe53f2
2011-07-22 15:14:18 -07:00
James Zern
bf599d74a4 Merge "makefile.unix: disable -Wvla by default" 2011-07-12 13:38:10 -07:00
James Zern
993af3e29a makefile.unix: disable -Wvla by default
Rather than add bulk to test for the new flag, simply comment out -Wvla
to keep the base makefile simple.
-Wvla was added in gcc-4.3.0.

Change-Id: I21feb456d7498ea628defb436a50c3d828e7f971
2011-07-08 21:23:27 -04:00
Pascal Massimino
e291fae0fc SSE2 functions for the fancy upsampler.
~5-10% faster.
Heavy 8bit arithmetic trickery!
Patch by Somnath Banerjee (somnath at google dot com)

Change-Id: I9fd2c511d9f631e9cf4b008c46127b49fb527b47
2011-07-07 18:12:53 -07:00
James Zern
14d5731c7e makefile.unix: use uname to detect OSX environment
HOSTTYPE is x86_64 on e.g.,
bash 3.2.48(1)-release
ProductName:	Mac OS X
ProductVersion:	10.6.7
BuildVersion:	10J869

intel-mac seems to be the value under tcsh.

Change-Id: I814ad6d3b733933057cea605917b185ff6d423d0
2011-06-24 21:29:59 -04:00
Pascal Massimino
13ed94b8ad add compile warning for variable-length-array 2011-06-20 17:42:25 -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
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
eb66670c6f disable WEBP_EXPERIMENTAL_FEATURES
Change-Id: I39caa72d261a0fd668910b1bfe067489c48a2de1
2011-05-09 12:10:28 -07:00
Pascal Massimino
c5ae7f653a typo fix: USE_ => WEBP_
Change-Id: I8d31320ff8a28bc89b943606a695421f9eda692d
2011-05-06 20:09:41 -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
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
261abb8e24 add a 'superclean' section
wipes out everything that is not needed.
Used to create the tgz archives.

Change-Id: Icbb00edb0e3a77abd0de6135c39a11d6973f9cd3
2011-03-29 10:46:36 -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
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
6463e6ab94 add some install instructions, and fix intel-mac flags
patch by Christian Duvivier

Change-Id: I8e38f98c6738c3d89917cd3eb88f6c095335a428
2011-03-17 14:45:23 -07:00
Pascal Massimino
d5bd54c712 fix typo and buggy line
Change-Id: I744bcfe5e611a49af9ad8a00ba764b74ee8dd727
2011-02-20 11:57:49 -08:00
Pascal Massimino
f7a9549dcb Add a simple top-level makefile.unix for quick & easy build.
Just use:
  make -f makefile.unix
instead of the autoconf system.

Change-Id: Idcedfd22e543023d1731f5753fb4958f02d0dd75
2011-02-20 11:17:44 -08:00