Commit Graph

241 Commits

Author SHA1 Message Date
Urvang Joshi
d0c79f0552 Mux API change:
Create common APIs for image, frame and tile.

Change-Id: I709ad752133094bd5bc89dd9c832ff79802aac68
2012-10-30 14:16:29 -07:00
pascal massimino
4828bb931d Merge "cwebp (windows): fix alpha image import on XP" 2012-10-23 00:57:21 -07:00
James Zern
eda8ee4b3b cwebp (windows): fix alpha image import on XP
Query the converter to ensure the format is supported; add BGR formats
as RGBA was failing for PNG on XP

Fixes issue 129

Change-Id: I02e0d74b3b21337bc5fffd6a5dc158b7809b9aa9
2012-10-19 18:48:47 -07:00
Pascal Massimino
f86e6abe1f add LSIM metric to WebPPictureDistortion()
LSIM stands for "local similarity": before matching
a compressed pixel to the source, we search around in the source
and minimise the squared error. So, this is close to PSNR calculation,
but mitigates some of its limitations (pure translation and noise for instance).

There's a new -print_lsim option to cwebp too.

Change-Id: Ia38561034c7a90e71d2ea0f55bb1de527eda245b
2012-10-19 06:48:11 -07:00
pascal massimino
cf1e90dec7 Merge "cwebp: fix jpg encodes on XP" 2012-10-09 00:04:19 -07:00
James Zern
f2b5d19b30 [cd]webp: always output windows errors
don't hide failures with -v.

Change-Id: I46485a66f266fd9e9e8c640d1051cd22cfa40658
2012-10-08 18:36:10 -07:00
James Zern
ecd66f774d cwebp: fix jpg encodes on XP
correct has_alpha check; previously it was controlled by keep_alpha,
which overrode the source format check.
fixes issue #127

Change-Id: I949be90419b03610c64900be0fd37f83b70cbe73
2012-10-08 18:26:21 -07:00
James Zern
d7a5ac86b9 vwebp: use demux interface
fixes broken build since:
 ab3234a Create WebPMuxFrameInfo struct for Mux APIs

Change-Id: I19d472f672b9234b15425a2e55ca89a3ea35bd64
2012-09-26 23:44:59 -07:00
Urvang Joshi
f6c096aad3 webpmux binary: Rename 'xmp' option to 'meta'
Change-Id: I00d7d2aa43ccb1e86b58e75e8677ea8ef7e1226e
2012-08-29 22:24:10 -07:00
Urvang Joshi
ddfe871a51 webpmux help correction
Clarify 'SET_OPTIONS'

Change-Id: I623ea955beb2a800709412b914a257abd95266cc
2012-08-29 22:23:12 -07:00
Urvang Joshi
1c04a0d438 Common APIs for chunks metadata and color profile.
Change-Id: Ie105ce913c0b56e34cc26fd7ec397103354f268a
2012-08-29 08:21:43 -07:00
Urvang Joshi
ab3234ae6b Create WebPMuxFrameInfo struct for Mux APIs
Change-Id: I1f3b15d679280b5347124e1d59865a3df089043b
2012-08-23 15:18:51 +05:30
Urvang Joshi
e3990fd8e4 Alignment fixes
Change-Id: I99b570a6621be271abd3df1c3316cdd7286cfe83
2012-08-23 13:22:59 +05:30
James Zern
292ec5cc7d quiet a few 'uninitialized' warnings
spurious in this case, but addresses e.g.,
... potentially uninitialized local variable 'weighted_average' used

Change-Id: Ib99998bf49e4af7a82ee66f13fb850ca5b17dc71
2012-08-02 14:03:30 -07:00
pascal massimino
5e7963000a Merge "WebPEncode: clear stats at the start of encode" into 0.2.0 2012-08-01 12:00:09 -07:00
Vikas Arora
dd1c3873fe Add image-hint for low-color images.
For low-color images, it may be better to not use color-palettes.
Users should treat this as one another hint (as with Photo &
Picture) and another parameter for tuning the compression density.
The optimum compression can still be obtained by running (outer loop)
compression with all possible tunable parameters.

Change-Id: Icb1a4face2a84774e16e801aee4a8ae97e232e8a
2012-07-31 23:11:19 -07:00
Pascal Massimino
4eb7aa64da Merge "WebPCheckMalloc() and WebPCheckCalloc():" into 0.2.0 2012-07-31 18:37:14 -07:00
James Zern
256afefa50 cwebp: exit immediately on version mismatch
{Picture,Config}Init don't do allocations and attempting to free any of
their contents on version mismatch will likely cause a crash

Change-Id: I2a5aece235f9680fb406aec4799adceea7f62cfc
2012-07-27 19:58:58 -07:00
James Zern
475d87d767 WebPEncode: clear stats at the start of encode
also relocate user_data from WebPAuxStats to the WebPPicture struct to
make clearing easier while placing it closer to the progress hook with
which it's used.
prior to this change some spurious lossless data could be reported in
the lossy (sans alpha) encoding case. additionally user_data could be
lost during lossless encoding.

Change-Id: I929fae3dfde4d445ff81bbaad51445ea586dd80b
2012-07-27 19:57:18 -07:00
Pascal Massimino
7d853d79dc add stats for lossless
* Extend AuxStats with new fields
  it's slightly ABI-incompatible, but i guess it's ok for 0.1.99+
  I expect to add more stats later, possibly (predictor stats, etc.)
* Have cwebp report the features used by lossless
  compression (either for alpha or full lossless coding)
* Print the PSNR for alpha (useful in case of -alpha_q)
* clean-up alpha.c signatures
+ misc cleanup (added const '* const ptr', etc.)

Change-Id: I157a21581f1793cb0c6cc0882e7b0a2dde68a970
2012-07-24 16:17:13 -07:00
James Zern
cbee59eba4 Merge commit 'v0.1.99'
* commit 'v0.1.99': (39 commits)
  Update ChangeLog
  add extra precision about default values and behaviour
  header/doc clean up
  Makefile.vc: fix webpmux.exe *-dynamic builds
  remove INAM, ICOP, ... chunks from the test webp file.
  harmonize authors as "Name (mail@address)"
  makefile.unix: provide examples/webpmux target
  update NEWS
  README: cosmetics
  man/cwebp.1: wording, change the date
  add a very crude progress report for lossless
  rename 'use_argb_input' to 'use_argb'
  add some padding bytes areas for later use
  fixing the findings by Frederic Kayser to the bitstream spec
  add missing ABI compatibility checks
  Doc: container spec text tweaks
  add ABI compatibility check
  mux.h: remove '* const' from function parameters
  encode.h: remove '* const' from function parameters
  decode.h: remove '* const' from function parameters
  ...

Conflicts:
	src/mux/muxinternal.c

Change-Id: I635d095c451742e878088464fe6232637a331511
2012-07-21 12:20:19 -07:00
James Zern
1889e9b6cc dwebp: report -alpha option
remove from WEBP_EXPERIMENTAL_FEATURES block; alpha is no longer
experimental.

Change-Id: I57df006ecac8122a987e52084813dc84ca7bcfd6
2012-07-20 19:42:56 -07:00
James Zern
d919ed06eb dwebp: add PAM output support
retains the alpha channel rather than stripping it as with PPM.

display from ImageMagick can render the files

Change-Id: I4f3a5d332937e0aeaf4e3fbd214fdae3b5382fb8
2012-07-20 19:06:01 -07:00
Pascal Massimino
8aacc7b056 remove INAM, ICOP, ... chunks from the test webp file.
Change-Id: Ia396d932b8b1af85717f693251c76985abc86395
2012-07-19 17:34:04 -07:00
James Zern
3e5bbe1c2e Merge "rename 'use_argb_input' to 'use_argb'" into 0.2.0 2012-07-18 23:26:42 -07:00
Pascal Massimino
0275159143 add a very crude progress report for lossless
better than nothing. Removed the warning in cwebp.c
(and silenced the warning in quiet mode too)

Change-Id: I85bbeaf77e0f60ead798886043dc053e6b44def5
2012-07-18 22:54:50 -07:00
Urvang Joshi
a4b9b1c604 Remove some unused enum values.
- WEBP_MUX_INVALID_PARAMETER: was used only at one place, and that too
should actually be an assert().
- WEBP_MUX_ERROR: was never used.

Change-Id: I8883cb4dfae7a7918507501f21fced0c04dda36a
2012-07-19 11:23:37 +05:30
Pascal Massimino
dd1081763c rename 'use_argb_input' to 'use_argb'
long name, and there's not really an 'output' equivalent

Change-Id: I9133ff734ae8d6572cb2f607211361f011fc0bc1
2012-07-18 22:47:16 -07:00
James Zern
12f9aede7e README: update cwebp help output
Change-Id: Ifc2fafca8131e53a894056e37bb22d25fedfa150
2012-07-13 14:55:39 -07:00
James Zern
8130c4cc64 Merge "build: remove libwebpmux from default targets/config" 2012-07-13 11:33:52 -07:00
James Zern
05108f6ea0 Merge "More spec/code matching in mux:" 2012-07-12 23:53:58 -07:00
Urvang Joshi
6808e69db8 More spec/code matching in mux:
- Match offsets, duration, width/height for frames/tiles and enforce
some constraints.
- Note that this also means using 'int's instead of 'uint32_t's for
16-bit and 24-bit fields.

Change-Id: If0b229ad9fce296372d961104aa36731a3b1304b
2012-07-13 11:47:24 +05:30
James Zern
e41a759615 build: remove libwebpmux from default targets/config
the extended file format is still under development and related
libs/binaries are not fit for release

configure:
--enable/disable-libwebpmux; default is disabled.

makefile.unix:
src/mux/libwebpmux.a and examples/webpmux must be explicitly specified

Makefile.vc:
$(DIRLIB)\libwebpmux.lib and $(DIRBIN)\webpmux.exe must be explicitly
specified

Change-Id: I8246746b256010dd2a2e4de58291222d7eaf0457
2012-07-11 14:25:41 -07:00
James Zern
a73b8978d1 vwebp: add checkboard background for alpha display
Change-Id: Iefb02f38c0479e61334844d9110cd1b735f0395d
2012-07-10 12:02:03 -07:00
James Zern
b35c07d9a7 vwebp: fix info display
change alpha intensity to 1 from 0; broken since alpha blending was enabled.

Change-Id: Ic8bb73b62e602ae56e08e9d5a77fdc6aa76b54c5
2012-07-09 22:47:10 -07:00
James Zern
16c46e83ac autoconf/make: cosmetics: break long lines
Change-Id: If08350a27cdfc4371dcb28ecb9d88d05eceaf977
2012-07-02 21:48:18 -07:00
James Zern
c17699b343 configure: add libtiff test
Change-Id: Ia5828797bae9c993a3d00ddd5e0089d3b828e975
2012-07-02 18:01:49 -07:00
pascal massimino
0e09732c5e Merge "cwebp: fix crash with yuv input + lossless" 2012-07-02 14:40:00 -07:00
James Zern
7bda392b50 cwebp: fix crash with yuv input + lossless
Change-Id: Ia27c925f532a4243369288e954abdc063b9f94f9
2012-07-02 14:33:25 -07:00
James Zern
d8921dd4e6 cwebp: name InputFileFormat members consistently
append an '_'. TIFF introduced TIFF_ to avoid a name clash.

Change-Id: Iebe484d43aeb8e1912cd5bd10d36e1c5e66a4b42
2012-07-02 11:24:23 -07:00
James Zern
6f76d246ba cwebp: add basic TIFF support
Change-Id: I29f354e1ef9cf8f23002cf2e15814a53a94b4ed5
2012-07-02 11:22:52 -07:00
Urvang Joshi
d11f6fcc82 webpmux returns error strings rather than numbers
Change-Id: Ifc8d8aaf0f6c03ecb1508ec7fbc34c918bf69c61
2012-06-27 16:55:57 +05:30
James Zern
b9ae4f0d88 cosmetics after mux changes b74ed6e, b494ad5
Change-Id: I8f693b1ba2537de89bda1dfbcf3b95abd17e420a
2012-06-22 14:30:01 -07:00
Urvang Joshi
b494ad5096 Mux: only allow adding frame/tiles at the end.
Change-Id: I5d685628da8c8ac85144cee2e5808b30ec79fef9
2012-06-22 11:18:18 -07:00
Vikas Arora
d373076a53 Added image characteristic hint for the codec.
This image type hint is used by codec to apply appropriate set of
transform filters to the image.

Change-Id: Ibb24e47ba14c40fa7f9f2c50ae86e03f2b29e9a6
2012-06-22 14:03:46 +05:30
Pascal Massimino
31b68fe639 cleanup WebPPicture struct and API
* add a real proper pointer for holding memory chunk pointer
  (instead of using y and argb fields)
* polish the doc with details
* add a WebPPictureView() that extract a view from a picture
  without any copy (kind of a fast-crop).
* properly snap the top-left corner for Crop/View. Previously,
  the luma position was not snapped, and was off compared to the chroma.

Change-Id: I8a3620c7f5fc6f7d1f8dd89d9da167c91e237439
2012-06-21 00:30:43 -07:00
Urvang Joshi
08220102d1 Enable alpha in vvwebp
Change-Id: I9499b6d4ea64b7eab18cb377f0bb09b6b494c534
2012-06-20 11:20:48 -07:00
Urvang Joshi
b74ed6e766 Mux API change:
'Set' and 'Get' methods for images take/return a bitstream as input,
instead of separate 'image' and 'alpha' arguments.

Also,
- Make WebPDataCopy() a public API
- Use WebPData for storing data in WebPChunk.
- Fix a potential memleak.

Change-Id: I4bf5ee6b39971384cb124b5b43921c27e9aabf3e
2012-06-20 11:00:42 -07:00
Vikas Arora
b7fb0ed567 Log warning for unsupported options for lossless.
Change-Id: I30d4e775959c7a4a8f5b649c8c90a4edb8cced47
2012-06-20 10:51:50 +05:30
Pascal Massimino
78f3e34504 Enable lossless encoder code
Remove USE_LOSSLESS_ENCODER compile flag
Update Makefile.am and makefile.unix

Change-Id: If7080c4d8f37994c7c784730c5e547bb0a851455
2012-06-13 00:26:58 -07:00
Urvang Joshi
fbdcb7ea38 NumNamedElements() should take an enum param.
- Move TAG_ID to webp/mux.h
- Rename it to WebPChunkId
- Rename IDs to WEBP_CHUNK_<tag>
- Remove "name" param from ChunkInfo struct and related changes.
- Rename WebPMuxNumNamedElements to WebPMuxNumChunks().
- WebPMuxNumChunks() takes WebPChunkId as param.

Change-Id: Ic6546e4a9ab823b556cdbc600faa137076546a2b
2012-06-11 12:26:13 +05:30
James Zern
c71ff9e359 cwebp: fix alpha reporting in stats output
Since
 437999f introduce a generic WebPPictureHasTransparency() function
lossy encodes will not encode alpha if the alpha channel is completely
opaque.

Change-Id: I1826669c3932483650d7f8ce806cfebd4e5225fc
2012-06-07 17:32:29 -07:00
Urvang Joshi
f3bab8eb27 Update vwebp
... with updated mux API calls.

Change-Id: I0f8a36eeffaeb041964ec4f582e369d48bba4978
2012-06-07 17:20:26 +05:30
Urvang Joshi
6d5c797cee Remove support for partial files in Mux.
Change-Id: Ie084f308c79a3cfaf2ea13e800397debc2643470
2012-06-07 13:46:42 +05:30
Urvang Joshi
f1df5587d9 WebPMuxAssemble() returns WebPData*.
Also add an API 'WebPDataFree()'

Change-Id: I00dc4c67fd78a541a18aaf0e65b8ef62d9769803
2012-06-07 11:05:57 +05:30
Urvang Joshi
814a063925 Rename 'Add' APIs to 'Set'.
Change-Id: I10a836a5bc3c9207b6f7fa423bb64bc9bcac055b
2012-06-05 20:37:51 +05:30
Urvang Joshi
4fc4a47f6e Use WebPData in MUX set APIs
Change-Id: Ibdede3c1cd02c6aeef333718592da313f10f6408
2012-06-05 14:21:46 +05:30
Pascal Massimino
437999fb77 introduce a generic WebPPictureHasTransparency() function
VP8-lossy will now avoid writing an ALPH chunk if the
alpha values are trivial.

+ changed DumpPicture() accordingly in cwebp
+ prevented the -d option to be active with lossless
 (DumpPicture wouldn't work).

Change-Id: I34fdb108a2b6207e93fa6cd00b1d2509a8e1dc4b
2012-06-04 16:17:55 -07:00
James Zern
880fd98ca1 vwebp: fix exit w/freeglut
GLUT_ACTION_CONTINUE_EXECUTION is required to allow glutMainLoop to
return.

Change-Id: I8eb7e657a52d6923858959b7b03447a7ddb53ca0
2012-05-25 15:06:21 -07:00
James Zern
00b29e282f normalize example header includes
headers from examples/ aren't installed so prefix with './' to be
explicit.

Change-Id: Ie6c1544a026a9859b7fc0cf238b21e031ef0013f
2012-05-15 13:48:11 -07:00
James Zern
061263a787 add example_util.[hc]
moves ReadFile to a common location

Change-Id: Ia81230671f16d7d4d218b9954a5be55577a85413
2012-05-15 13:42:57 -07:00
James Zern
1d38b258b8 cwebp/windows: use MAKE_REFGUID where appropriate
Change-Id: If595c75a833d37df86c16bf926da5f032015c68e
2012-05-09 11:52:01 -07:00
James Zern
817ef6e9af Merge "cwebp: fix WIC/Microsoft SDK compatibility issue" 2012-05-09 11:50:05 -07:00
James Zern
902d3e3b5f cwebp: fix WIC/Microsoft SDK compatibility issue
Fixes issue #115.
Define local copies of GUID_WICPixelFormat24bppRGB &
GUID_WICPixelFormat32bppRGBA (and GUID_WICPixelFormat32bppBGRA for
symmetry) to avoid link issues when building against older versions of
the SDK.

Change-Id: I2a26be1b7fe6d970feb3211cf0059e5898e3028d
2012-05-09 11:47:15 -07:00
Pascal Massimino
3927ff3abc remove unneeded error condition for WebPMuxNumNamedElements()
+ fix error message

Change-Id: If283ff6609ee0c5dff81a9c1c3f194faa729161c
2012-05-09 01:57:15 -07:00
Pascal Massimino
861a5b7bc9 add support for animation
it's using glutTimerFunc() for trigger next frame's decoding

Reminder: how to build and use manually (integration in makefile.unix coming soon)

Unix:
cd libwebp
make -f makefile.unix
cd examples
cc -o vwebp vwebp.c -framework GLUT -framework OpenGL -I../src/ ../src/libwebp.a ../src/mux/libwebpmux.a

Mac + xcode:
cd libwebp
make -f makefile.unix
cd examples
cc -o vwebp vwebp.c -lglut -lGL -lpthread -lm -I../src/ ../src/libwebp.a ../src/mux/libwebpmux.a

Change-Id: Id49e87c26628c2b58ec221f6030cbd2e46a807b4
2012-05-09 01:23:39 -07:00
Pascal Massimino
4abe04a204 fix the return value and handle missing input file case.
Change-Id: I42a64fcf7587ff3a487115808e2cfa51cec0031d
2012-05-09 00:34:30 -07:00
Vikas Arora
c4ccab6463 Print relevant lossless encoding stats in cwebp.
Change-Id: Ib8dfab498b1a05e49734bba2d3e72810343e8b0a
2012-05-09 11:31:41 +05:30
Pascal Massimino
72920caa61 introduce -lossless option, protected by USE_LOSSLESS_ENCODER
Change-Id: Ic5707082fefd964b9bcab0c9f9aa276992c22b06
2012-05-07 14:25:02 -07:00
James Zern
95667b8d86 mux: use size_t consistently
remove mixed use of uint32_t

Change-Id: I57f701a0d9fce255c4dd83c01e523079976ef5b5
2012-04-23 11:00:20 -07: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
James Zern
0f7820e65c webpmux: make more use of WebPData
Add WebPDataCopy and use it in ReadImage which now returns WebPData*s.
Update ReadData prototype variables used with it to avoid unnecessary
const casting back and forth from void*.

Change-Id: I3f83db6729306eab0db9027b68706c8a7005ec10
2012-01-24 17:18:45 -08:00
James Zern
974aaff360 examples: logging updates
- send errors to stderr
- send help to stdout
- add image size to webpmux -info output and send to stdout
- correct webpmux exit values

Change-Id: Ifd8e8493aab33a82765f7b7903cef345d96da9ae
2012-01-24 16:55:38 -08:00
James Zern
eec4b87718 mux: add WebPData type
slightly simplifies Get process

Change-Id: I9db365da29038e02a032494e0ef3d8a0d7515210
2012-01-23 17:51:01 -08:00
Pascal Massimino
d61479f95b add -print_psnr and -print_ssim options to cwebp.
These will report the 7x7-averaged PSNR or SSIM, using the
new internal function WebPPictureDistortion().
This is for information only. These flags have no encoding impact.

+misc opportunistic cosmetics

Change-Id: I64c0a7eca679134d39062e438886274b22bb643f
2012-01-20 07:37:29 -08:00
Pascal Massimino
2e3e8b2ef5 add a WebPCleanupTransparentArea() method
to 'clean up' the fully-transparent area and make it more compressible
new cwebp flags: -alpha_cleanup (off by default, since gain is not 100% guaranteed)

Change-Id: I74d77e1915eee146584cd61c9c1132a41db922eb
2012-01-18 14:01:24 -08:00
Urvang Joshi
8d6490dae6 Incremental support for some of the mux APIs.
This CL adds incremental support for WebPMuxCreate() and
WebPMuxGetFeatures()

Change-Id: I312122f5e817d58366e18ae238cb9e2a493811fb
2012-01-13 14:47:53 +05:30
Pascal Massimino
2e74ec8b5f fix compile under MINGW
there was a type conflict around INT32 (in libjpeg).

Patch by nipmarsh
Issue 102: http://code.google.com/p/webp/issues/detail?id=102

Change-Id: I6425b6b9b9861bcaa8bb1adc8a78541e44031a6e
2012-01-12 04:53:30 -08:00
Pascal Massimino
8ca2076de1 Introduce a 'fast' alpha mode
.. where only 2 filtering modes are potentially
tried, instead of all of them. This is fast than the exhaustive 'best'
mode, and not much worse.

Options for cwebp are:
 -alpha_filter none
 -alpha_filter fast      (<- default)
 -alpha_filter best      (<- slow)

Change-Id: I8cb90ee11b8f981811e013ea4ad5bf72ba3ea7d4
2012-01-09 02:37:44 -08:00
James Zern
ad1e163a0d cosmetics: normalize copyright headers
Change-Id: I5e2462b101e0447a4f15a1455c07131bc97a52dd
2012-01-06 14:49:06 -08:00
Vikas Arora
252028aaac Add predictive filtering option for Alpha.
Add predictive filtering option for Alpha plane.
Valid range for filter option is [0, 5] corresponding to prediction
methods none, horizontal, vertical, gradient & paeth filter.
The prediction method 5 will try all the prediction methods (0 to 4)
and pick the prediction method that gives best compression.

Change-Id: I9244d4a9c5017501a9696c7cec5045f04c16d49b
2012-01-05 13:55:35 +05:30
James Zern
911795490e vwebp: msvc build tweaks
snprintf -> _snprintf / remove double->float warnings

Change-Id: I5dcdc394cf7e2d37205beaf83ed0f80a18ec06ab
2011-12-16 19:30:33 -08:00
Pascal Massimino
7937b409e7 simple WebP viewer, based on OpenGL
Quite handy and simple (for now).
It's not yet incorporated within the build system (autotools or
makefile.unix), because it gets complicated with OpenGL. TODO(later).

For now, there's some ready-to-use command line for compiling on Linux
or Mac in the header of vwebp.c

Later, this tool will be supplemented with support for animation,
tiling, zooming, etc.

Change-Id: I292972cea4862536afbe8c9ec444c590d152f086
2011-12-13 14:02:04 -08:00
James Zern
2f741d1e13 webpmux: ReadImage: fix ptr free in error case
allocate to temporaries and deal with output pointers in one place to
reduce casting.

Change-Id: Ib12d866440184315536f35a15eb5adeba7879ae7
2011-12-02 17:58:20 -08:00
Pascal Massimino
30971c9e95 Implement progress report (and user abort)
New cwebp flag is -progress

Change-Id: Ied872cca13f512036860783bbee1bdbccad72768
2011-12-01 14:19:40 -08:00
pascal massimino
38bd5bb524 Merge "Better alpha support in webpmux binary" 2011-12-01 06:01:33 -08:00
Pascal Massimino
d71fbdcca3 fix small typo in error message array
Change-Id: If34537e53cc56b5f5daa15afaefb1f49d11602f5
2011-12-01 03:34:22 -08:00
Urvang Joshi
cdf97aa265 Better alpha support in webpmux binary
- Support for adding/getting frames/tiles with alpha in webpmux
- For "-info" option in webpmux binary, add alpha related info

Change-Id: Iccd2fd35ab8453dabd74779f12f2844ab76d0538
2011-12-01 16:15:57 +05:30
Vikas Arora
a0ec9aace9 Update WebP encoder (cwebp) to support Alpha.
Updated cwebp (Webp Encoder) binary to support Alpha encoding.
Modified man page and WebP container spec appropriately.

Change-Id: I52f6a5cb3e870c386591e9a7776293fa6a8fb04b
2011-12-01 15:13:17 +05:30
Urvang Joshi
c398f59536 MUX API Updates
- Add alpha support in mux.
- Remove WebPMuxAddNamedData() and WebPMuxGetNamedData() APIs. Add WebPMuxSetImage(), WebPmuxGetImage() and WebPMuxDeleteImage() APIs instead.
- Refactor code using WebPImage struct.
- Corresponding changes in webpmux binary.
- WebPMuxSetImage()/AddFrame()/AddTile() can now work with data which starts from "RIFF...". This simplifies reading a single-image webp file and adding it as an image/frame/tile in mux.

Change-Id: I7d98a6407dfe55c84a682ef7e46bc622f5a6f8d9
2011-11-23 19:03:13 +05:30
Urvang Joshi
372e2b463b Correct a bug in ReadPNG() with GRAY_ALPHA images
Change-Id: I4676160ee544ed914cc0de3f9cd140d9ee65addc
2011-11-16 18:56:23 -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
James Zern
04e84cf1f1 examples: slight cleanup
spelling/indent/condense a few lines
removal/restriction of extern "C" usage
add const where applicable

Change-Id: Idd49b3498b1d7fc391724b4cde63706022217cb0
2011-11-04 15:30:28 -07:00
Pascal Massimino
abd030b573 fix missing "(void)" in function signature
Change-Id: I7edfc36174b6d16df909594c2693e75a09e1ac13
2011-11-01 06:24:34 -07:00
Pascal Massimino
f6a7d75885 remove useless test
Change-Id: I1b31842ddf719ddcc185a5d6a5032a20d5e593e2
2011-11-01 05:18:46 -07:00
James Zern
b8634f7d8f webpmux: fix lib link order
fixes static link (--disable-shared)

Change-Id: Ife926179490954a1d966d2deb97dd366a9d0dacd
2011-10-28 18:11:00 -07:00
Urvang Joshi
a4f32caef4 Added WebPMux Binary.
This change adds a command line tool (webpmux) which uses MUX library
for manipulating WebP Mux container. This tool can be used to create a
WebP container file and extract/strip relevant data from the container
file.

Change-Id: If17818239448a428703760747fc84f77586045e4
2011-09-30 12:46:29 +05:30
Pascal Massimino
28ad70c56d Fix PNG decoding bug
some png with palette-based alpha channels were incorrectly
treated as alpha-less, causing segfault.

Change-Id: I03883590f9539848d5135d359b6f105d2b14329f
2011-09-20 07:59:43 -07:00
Pascal Massimino
ee697d9fc9 harmonize the include guards and #endif comments 2011-09-13 15:31:52 -07:00
Pascal Massimino
e06ac0887f create a separate libwebpdsp under src/dsp
Gathers all DSP-related function (and SSE2 implementations).
Clean-up some unwanted symbolic dependencies so that webp_encode,
webp_decode and webp_dsp are truly independent libraries.

+ opportunistic clean-up:
  * remove unneeded VP8DspInitTables(), now integrated in VP8DspInit()
  * make consistent use of VP8GetCPUInfo() in the various DspInit() funcs
  * change OUT macro to DST
2011-09-13 12:29:44 -07:00
Pascal Massimino
a5b78c81b5 wrap alpha-related options under WEBP_EXPERIMENTAL_FEATURES flag
Change-Id: I6d8f4b4ec7dca53054e28b969a536e7c93c1e5e2
2011-08-29 22:04:46 -07:00
Mikolaj Zalewski
2aa6b80efe Slience some Visual Studio warnings.
Change-Id: I62078af80bfcaa82bdc165fc2fc8fce2d2aad862
2011-08-29 10:37:13 +02:00
James Zern
c7e86abab6 cosmetics: fix comment line lengths
add additional '-' to //----... style comments globally instead of
polluting further commits

Change-Id: I951acc68b7b5384b4d6e235349b0067d1aa6fa8b
2011-08-26 12:19:33 -07:00
Pascal Massimino
900286e091 add a -partition_limit option to limit the number of bits used by intra4x4
Although it degrades quality, this option is useful to avoid the 512k
limit for partition #0.
If not enough to reach the lower bound of 4bits per macroblock header,
one should also limit the number of segments used (down to -segments 1)

See the man file for extra details.

Change-Id: Ia59ffac13176c85b809ddd6340d37b54ee9487ea
2011-08-23 15:58:22 -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
b4d0ef8f58 Makefile.vc: add DLL configs
(release|debug)-dynamic
These configurations will produce a dll in bin/ and an import lib under
lib/.
Currently the -noasm switch in the examples will be disabled for these
builds due to a dependency on VP8EncGetCPUInfo.

Change-Id: I2cbac0064f0e500698d14ffc03200791ca837090
2011-07-15 15:25:02 -07:00
James Zern
3827e1bce4 Merge "examples: (windows/WIC) add alpha support" 2011-07-08 14:10:17 -07:00
Pascal Massimino
5142a0be3a export alpha channel (if present) when dumping to PGM format
Change-Id: Ica1818937fa03b29a749887d28f49fe675c8b1db
2011-07-07 16:08:15 -07:00
James Zern
0805706252 examples: quiet warnings
When WEBP_HAVE_(JPEG|PNG) were undefined the stub functions would
produce warnings for unused parameters.

Change-Id: I79b2457c769d1f9382be834162de019c5427f94b
2011-06-24 16:50:02 -04:00
James Zern
3cfe0888ae examples: (windows/WIC) add alpha support
Portions based on a patch by Ismail Keskin (iskeskin at gmail dot com)
Fixes issue #83.

Change-Id: Ib54188910354240a2731b0a3a3d0915d17af2233
2011-06-22 12:01:48 -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
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
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
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
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
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
38369c03e0 cosmetics
Change-Id: I39c3bc671ab427dcb3e23aedee7fe8d81f4cb860
2011-05-04 23:25:40 -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
f7d9e261c5 fix merge problems
Change-Id: I6d0763734139d2852896872c80c5e7fa7889945a
2011-04-26 11:02:38 -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
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
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
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
6d978a6c8c add error messages
patch by Christian Duvivier

Change-Id: Iaea71f690b99e313561d0284759531b81c10d7e5
2011-03-17 14:53:57 -07:00
Pascal Massimino
0744e8420e Dont' open output file until we're sure the input file is valid
fixes http://code.google.com/p/webp/issues/detail?id=48

Change-Id: I9ce2e500623380ba71ae0e2c8faf80db4568ae50
2011-02-25 12:03:27 -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
81c966215b oops: forgotten call to Initialize()
+ move the error message to a more useful place

Change-Id: Id03a992491f907f278fcaad11e94f70f1baccd5f
2011-02-18 10:26:42 -08:00
Pascal Massimino
b04b857a35 * add decoding measurement using stopwatch.h (use -v option)
* support PNG output through WIC on Win32

Change-Id: I1dbcc6ab1360010aca25da80f30a74781aadc76d
2011-02-16 15:01:27 -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
3254fc5259 fix some petty constness
fix the ./configure file too

Change-Id: I96cfc84e08e9bab517dec24c92f856efa5ad04ca
2011-01-23 12:59:06 -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
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
a9b3eab6fd correct layout name is IMC4.
U-plane comes first, then V-plane.
see http://www.fourcc.org/yuv.php#IMC4

Change-Id: I65222176ca4d8f3b1e072783becd769dd4dd2f55
2011-01-03 11:05:13 -08:00
Pascal Massimino
e12109eefc dwebp: change -yuv option to -raw
change the layout to IMC2

This is easier visually
(cf http://www.fourcc.org/yuv.php#IMC2)

Change-Id: I8e8495908f98a392bf629d41f14eb7835ba027e1
2010-12-17 05:53:50 -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
cbfbb5c3b5 convert to plain-C
there were still some dandling local variables.
2010-10-31 00:36:33 -07:00
Pascal Massimino
c3f41cb47e Initial commit
Change-Id: I4712afb3912625e7aaccfa5160dcf78ee252f159
2010-09-30 09:55:07 -04:00