Commit Graph

3998 Commits

Author SHA1 Message Date
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
James Zern
54f2170a15 swig/java: basic encode support
Wrap WebPEncode???* to provide an interface similar to decode.
As only WebPGetEncoderVersion is wrapped directly from encode.h avoid
including it in the swig file to reduce %ignore's.
This change also removes unnecessary incremental decoding related enums.

Change-Id: I0b5424026aa6ae012c6a29ad2f2301c2681ca301
2011-06-15 10:37:53 -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
ea43f045b5 Merge "configure: mingw32 targets: test for WIC support" 2011-06-10 16:11:51 -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
James Zern
31f9dc6fdd configure: mingw32 targets: test for WIC support
Replace usage of _WIN32 in examples as this does not guarantee the
presence of wincodec.h.
mingw-w64 notably includes wincodec.h, though other releases do not.

Under cygwin the following can be used for a WIC enabled binary:
./configure --target=i686-pc-mingw32 CC=i686-w64-mingw32-gcc.exe

Change-Id: Ica6a714c3356a8eaf88486a1c3f5aa6adde394c0
2011-06-08 11:32:41 -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
pascal massimino
6c9405dbfb Merge "Makefile.vc: require CFG with clean target" 2011-06-01 17:04:35 -07:00
James Zern
0424ecd996 Makefile.vc: require CFG with clean target
Allows clean to target a specific CFG output directory which has the
side benefit of supporting of tree builds.
Earlier versions would clean the entire source tree possibly removing
multiple builds.

Change-Id: I63c0f32f73c0035f2b7fae0a88c02de3805d264b
2011-06-01 15:55:22 -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
e71418f899 more MSVC files to ignore
original patch by Vladimir Panteleev (vladimir at thecybershadow dot net)
2011-05-27 10:07:51 -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
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
James Zern
d041efae00 swig: add libwebp.jar/libwebp_java_wrap.c
for the swig-impaired

Change-Id: I10711c057c11bd9e59bc382fe3c6337883f5c4a6
2011-05-06 18:56:01 -07:00
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