Commit Graph

3121 Commits

Author SHA1 Message Date
James Zern
f6fb3877ed add swig interface
Currently only supports a subset of decode functions and likely only
works fully for java.

For java bindings:
The generated java source can be compiled and the class files added to
libwebp.jar.
The generated jni source can be compiled to, e.g., libwebp_jni.so, which
can then be loaded via System.loadLibrary("webp_jni").

Change-Id: I8225933cbaf85c9cfa4b78c2e5f167cee8b62408
2011-05-06 16:41:00 -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
842c009b38 fix -strong option
was checking the presence of a useless second argument

Change-Id: I2c524a79fc7317cb8b6146c10265ee9462cd1958
2011-05-05 18:10:08 -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
8aa50efd38 fix some 'man' typos 2011-04-18 18:50:34 -07:00
Pascal Massimino
d3f3bdda7f update ChangeLog
Change-Id: Ib5df31d998cbaf561f6bb14d634d9ce0e82c30d3
2011-04-01 00:51:29 -07:00
Pascal Massimino
d7e9a69c52 update contributor list
Change-Id: I3d8eb613e569787256b16b3185823a6a0531d1a3
2011-03-29 10:49:22 -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
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
Jan Engelhardt
2486845580 build: prepare libwebp.pc
libwebp.pc needs to be created from libwebp.pc.in, or installation
will fail.

Change-Id: If0afe8d5c722b3394778b309dc0b676e603a4282
2011-03-28 11:38:47 -07:00
Pascal Massimino
14ceb6e803 add "-version" description to man pages
Change-Id: I699899b11db3b62628c9438f07c379d2ae413031
2011-03-28 11:12:39 -07:00
Pascal Massimino
b247a3b279 Create the m4 directory, and also place .gitignore in there for libtool.
patch by Jan Engelhardt (jengelh at medozas dot de)

Fixes the error:
aclocal: couldn't open directory "m4": No such file or directory
autoreconf: aclocal failed with exit status: 1

Change-Id: I1c1cd2c3d96f0d7d25616ec084dfc9bf9077fd4f
2011-03-28 07:09:35 -07:00
Pascal Massimino
cdd734c9e3 Resolve automake warnings
patch by Jan Engelhardt (jengelh at medozas dot de)

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

Change-Id: Ifd07974e89bdc18da4c2f4667a9cae9f6c07e649
2011-03-26 10:25:21 -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
b20aaca285 build: just use autoreconf, avoid calling tools manually
patch by Jan Engelhardt (jengelh at medozas dot de)

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

Change-Id: I3fbb9124ce0b430b6340b3df5496e75cc5a9fedc
2011-03-26 09:50:31 -07:00
Pascal Massimino
4b0b0d66cc cwebp: use modern functions
patch by Jan Engelhardt (jengelh at medozas dot de)

Change-Id: I0e1766469fc4bc229488018b30416e3359c43012
2011-03-26 09:27:45 -07:00
Pascal Massimino
efbc6c41fc update Android.mk
idec.c was missing

Change-Id: I18fe8eb6576c52b56519567b9905ad5ac2db60c0
2011-03-26 07:33:19 -07:00
Pascal Massimino
7777570b9a better version of ChangeLog
(not including this Change, heh!)

+ fix NEWS's dates

Change-Id: I2bf6230a33d2a1606986432c53294240bac2dd2c
2011-03-25 18:15:34 -07:00
Pascal Massimino
fa70d2b771 update version number in the DOC
Change-Id: I791be1c6678fa4bd2f0f330cd53aa5837dedbebf
2011-03-25 16:54:47 -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
0de013b3a4 fix typos
Change-Id: Ib83202e639a16d569ce21e7d057fe83817479d61
2011-03-24 16:32:29 -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
be4867d2f8 doc for incremental decoding
Change-Id: Idff912525b38aaed22113557a50abcb8422a9ab5
2011-03-24 15:50:02 -07:00
Pascal Massimino
56732a1b4d add idec.obj in MSVC makefile
Change-Id: I5064805991cdb811bc230cd184276bdd3abf017e
2011-03-24 06:38:39 -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