Commit Graph

337 Commits

Author SHA1 Message Date
Johann
ba503fdac6 NEON TransformOne
As with the loop filter, implementing this with intrinsics is difficult
because we require subscript access for reading and writing 32 bits at a
time.

Approximately 5% decode speed improvement. This could be increased by
exposing TransformOne and rewriting TransformTwo to only handle dual
IDCTs.

Change-Id: Idd409264ab5d154a537107a1d54b419a48f7c1a8
2012-01-26 11:37:32 -08:00
Pascal Massimino
f76d3587e5 gcc warning fix: remove the 'const' qualifier.
Change-Id: I47b8f147f54072cb9b62669efd78c7b958aa5c08
2012-01-25 15:50:24 -08:00
Pascal Massimino
1f7b8595ae re-organize the error-handling in the main loop a bit
Change-Id: Id74298131df9c33a86b989e15c11ffb6d04960d8
2012-01-25 08:34:58 -08:00
Pascal Massimino
1336fa719d Only recompute level_cost_[] when needed
Add a dirty_ flag to keep track of updated probabilities and the need to
recompute the level costs.
This only makes a difference for "-m 2" method which was sub-optimal.
But it's overall cleaner to have this flag.

Change-Id: I21c71201e1d07a923d97a3adf2fbbd7d67d35433
2012-01-25 07:52:34 -08:00
Pascal Massimino
6c14aaddc4 Merge "better token buffer code" 2012-01-23 18:55:11 -08:00
Pascal Massimino
f40542508c better token buffer code
(still not finished, but compiles and works ok)

Change-Id: I7002bf8017e31e7af34a53126072b625d23e2589
2012-01-23 18:54:24 -08:00
James Zern
18d959fa9a Merge "mux: add WebPData type" 2012-01-23 18:00:21 -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
0de3096b3a use 16bit counters for recording proba counts
This proved being ok, even for large pictures, provided one
takes care of overflow. When an overflow is bound to occur, the
counters are renormalized.
Overall, shaves ~12k of memory.

Change-Id: I2ba21a407964fe1a34c352371cba15166e0c4548
2012-01-23 17:50:58 -08:00
Pascal Massimino
7f23678da0 fix for LevelCost + little speed-up
the p0 proba was incorrectly accumulated. Merging its contribution into
the LevelCost[] was creating more problems than anything (esp. with trellis)
so let's just not.

Change-Id: I4c07bfee471085df901228d97b20a4d9606ba44e
2012-01-23 09:21:17 -08:00
Pascal Massimino
7107d54483 further speed-up/cleanup of RecordCoeffs() and GetResidualCost()
(note: Incorporated the cost of bin #1 into the LevelCost[])

Change-Id: I6408b2a822efdb97ad6a3a21d380bc7b0da9c715
2012-01-23 07:01:37 -08:00
Pascal Massimino
fd22104022 Introduce Token buffer (unused for now)
Later, will be useful to collect stats and code bitstream in one single pass

Change-Id: Icf866473958b5eff879e219dbb1d7e350f2268ba
2012-01-23 05:57:12 -08:00
Pascal Massimino
5fa148f47c Merge "speed-up GetResidualCost()" 2012-01-23 02:50:58 -08:00
Pascal Massimino
28a9d9b41a speed-up GetResidualCost()
+ misc cosmetics and code polishing

Change-Id: I5830cd2f268d64c072b1cbccc0a4674833875055
2012-01-23 02:36:38 -08:00
Pascal Massimino
11e7dadd96 Merge "misc cosmetics" 2012-01-22 23:52:29 -08:00
Pascal Massimino
378086bd0a misc cosmetics
Change-Id: Iafc73f9fece13b5ca900a8b9c1039268872a181b
2012-01-22 23:20:53 -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
James Zern
552c121715 Merge "mux: plug some memory leaks on error" 2012-01-18 13:46:38 -08:00
James Zern
a2a81f7d61 Merge "fix Mach-O shared library build" 2012-01-18 13:16:12 -08:00
James Zern
b3482c4300 Merge "fix gcc-4.0 apple 32-bit build" 2012-01-18 13:15:23 -08:00
James Zern
e4e3ec19ad fix gcc-4.0 apple 32-bit build
gcc-4.0 defines __PIC__ but not __pic__. This leaves the test for
__pic__ should the inverse case exist.
Fixes issue #103; build failing with:
"error: can't find a register in class 'BREG' while reloading 'asm'"

Change-Id: Ia767a733de6ce0294146f9477ff9c46f0ebe13b0
2012-01-18 13:12:45 -08:00
Urvang Joshi
b0d2fecf25 mux: plug some memory leaks on error
Make sure chunk->data and wpi are not leaked by
MuxAddFrameTileInternal() in case of MEMORY_ERROR in ChunkSetNth().

Change-Id: Ie20e84b92f4bdcb7c3b94520f36b20dd2e730545
2012-01-17 18:40:25 -08:00
Pascal Massimino
f0d2c7a76f pass of cosmetics
Change-Id: Id031221b7499e8cfc460c873d0f8124c9bef3aa3
2012-01-17 18:32:27 -08:00
James Zern
b309a6f901 fix Mach-O shared library build
Add extern to kChunks[] in muxi.h.
Fixes:
ld: duplicate symbol _kChunks in .libs/muxinternal.o and .libs/muxedit.o

Change-Id: Ibeb060f7fdec5fe904097a2443f0cda2f7ede884
2012-01-17 16:51:19 -08:00
James Zern
7e4371c5b3 WebPMuxCreate: fix unchecked malloc
Change-Id: Ic824cdfbede4abe8e5106904dd17d564bb1b32d4
2012-01-15 11:18:23 -08:00
James Zern
a85c363186 Merge "correct EncodeAlpha documentation" 2012-01-13 14:27:03 -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
James Zern
b5855fc78d correct EncodeAlpha documentation
The paeth filter was removed in 8ca2076

Change-Id: I743502147da4e0b5506e49382311b8f592973d41
2012-01-12 18:37:45 -08:00
Pascal Massimino
716d1d7f87 fix suboptimal MAX_LEN cut-off limit
MAX_LEN -> max_len
This was sub-optimal at the end of the picture, when there's
less than MAX_LEN bytes left to match.

Change-Id: I5ebe1fca4e7c112dcd34748a082d1c97f95eb099
2012-01-10 07:41:11 -08:00
Pascal Massimino
57cab7b891 Harmonize the alpha-filter predictions at boundary
often reduces compressed size by ~10's of bytes
+ refactored / sped-up the prediction code (gradient: ~30% faster)

Change-Id: I26bd983655dad4f85d5c5ddc20a1980f384c4dd6
2012-01-10 03:21:13 -08:00
pascal massimino
3a9895340f Merge "Fix bug for Alpha in RGBA_4444 color-mode." 2012-01-09 02:59:59 -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
Vikas Arora
221a06bb16 Fix bug for Alpha in RGBA_4444 color-mode.
Fix bug for Alpha data in RGBA_4444 color-mode.
The Alpha data is required to be clipped [0, 15] while
converting from 8 bits to 4 bits.

Change-Id: I80705d575c35121beb9633a05ec8823435c79586
2012-01-09 14:07:30 +05:30
James Zern
ad1e163a0d cosmetics: normalize copyright headers
Change-Id: I5e2462b101e0447a4f15a1455c07131bc97a52dd
2012-01-06 14:49:06 -08:00
James Zern
c77424d7eb cosmetics: light include cleanup
remove some unused includes

Change-Id: I07fabf707e8eac7f204757e68dab1057fd21aef1
2012-01-06 14:38:34 -08:00
James Zern
9d0e17c9a9 fix msvc build breakage after 252028a
replace inline with WEBP_INLINE; inline is reserved for c++ code
w/visual studio

Change-Id: Ib06c6a12fd786701740d8b260d9aa310ee81fddf
2012-01-05 18:26:40 -08:00
Urvang Joshi
7c4c177c39 Some readability fixes for mux library
Add a #define for UNDEFINED_CHUNK_SIZE and remove a misleading comment.

Change-Id: I5c56a12f1245e647f913c35c6a34d2e5d658415e
2012-01-05 17:53:51 +05:30
pascal massimino
d8a47e66f7 Merge "Add predictive filtering option for Alpha." 2012-01-05 00:33:32 -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
pascal massimino
9b69be1cdc Merge "Simplify mux library code" 2012-01-05 00:15:48 -08:00
Urvang Joshi
a056170eca Simplify mux library code
Refactor mux code into Read APIs, Set/Delete APIs and internal
objects/utils.

Change-Id: Ia4ce32ec18cf0c1c75de9084fbb28840d46892b4
2012-01-05 12:23:08 +05:30
James Zern
992187a380 improve log2 test
- add check for native log2 to configure
- use a common define (NOT_HAVE_LOG2) to enable use of local library
  version for non-autoconf platforms without their own version,
  currently msvc and android

This uses a negative (NOT_HAVE_) to simplify the ifdef

Change-Id: Id0610eed507f8bb9c5da338918112853d5c8127a
2012-01-04 18:49:37 -08:00
Pascal Massimino
a90cb2be6e reduce number of copies and mallocs in alpha plane enc/dec
Change-Id: Ice48d2dd403c18870567ee6e1b210b1eb3d5b44f
2011-12-23 01:21:53 -08:00
James Zern
b1662b0530 fix some more type conversion warnings w/MSVC
API & memory related warnings will be dealt with separately

Change-Id: I8a7893baa4d5035c963fb3c16e0bb4eee742e968
2011-12-21 16:07:16 -08:00
Pascal Massimino
223d8c60aa fix some uint64_t -> int conversion warnings with MSC
Change-Id: I5dc314c9d1a3cbda095be3c90886983500104867
2011-12-21 14:43:52 -08:00
James Zern
c1a0437b87 Merge "simplify checks for enabling SSE2 code" 2011-12-20 17:42:59 -08:00
James Zern
f06817aaea simplify checks for enabling SSE2 code
also fixes build issues under vs11 which has a native arm compiler for
windows 8 targets

Change-Id: Id76c2deae9fc9de147d13ad0d34edffcb5a726c4
2011-12-20 17:41:55 -08:00
James Zern
948d4fe94f silence a msvc build warning
implicit double -> float conversion; avoiding sqrtf (c99) for
compatibility

Change-Id: If9b367dde237fc5173c1445cc60b16aa6ad2821c
2011-12-19 23:04:01 -08:00
Pascal Massimino
6aac1df17b add a bunch of missing 'extern "C"'
Change-Id: I8c0ada049ce9fa7ef14164b90d58e999cdabba53
2011-12-13 10:51:32 -08:00
James Zern
421eb99db3 Merge "Remove assigned-but-not-used variable "br"" 2011-12-08 10:41:18 -08:00
Pascal Massimino
91e27f4573 better fitting names for upsampling functions
Change-Id: I816e81586c9e1a74ebc5516598dbd4ae0ddf48d8
2011-12-08 06:42:53 -08:00
Martin Olsson
a5d7ed5c4b Remove assigned-but-not-used variable "br"
Fixes gcc 4.6.x -Wunused-but-set-variable compiler warning:

	libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -Wextra -Wall -Wunused-but-set-variable -MT libwebpdecode_la-idec.lo -MD -MP -MF .deps/libwebpdecode_la-idec.Tpo -c idec.c  -fPIC -DPIC -o .libs/libwebpdecode_la-idec.o
	idec.c: In function 'DecodeRemaining':
	idec.c:371:17: warning: variable 'br' set but not used [-Wunused-but-set-variable]

Change-Id: Ib037be9634b5b802ba9f1e2ef156a8fdf9630752
2011-12-08 15:42:01 +01:00
Pascal Massimino
f62d2c9497 remove unused 'has_alpha' from VP8GetInfo() signature
alpha information is not to be found at RIFF chunks level, not
in the VP8 bitstream (that was a tmp hack)

Change-Id: Idd1629c696b03c26f6f30650d7216f627f1761df
2011-12-08 06:41:40 -08:00
Pascal Massimino
08e865822a trap alpha-decoding error
Improves robustness to bad bitstream.

Change-Id: I87ca03ccd12d4d690904b35f8dfc2a20a28fb47b
2011-12-08 06:34:00 -08:00
Pascal Massimino
b361eca1c5 add cut-off to arith coder probability update.
This speeds things up for long message, while not damaging
the stats too much for usual-sized cases

Change-Id: I3f45e28b771d701e2e1da11eb800de18c4ed12fc
2011-12-08 06:27:11 -08:00
Urvang Joshi
8666a93aae Some bug-fixes for images with alpha.
- Fix the off-by-one diff when cropping with simple-filter.
- Fix a bug in incremental decoding in case of alpha.
- In VP8FinishRow(), do not decode alpha when y_start > y_end.
- Correct output of alpha channel for MODE_ARGB.
- Correct output of alpha channel for MODE_RGBA_4444.

Change-Id: I785763a2a704b973cc742ad93ffbb53699d1fc0a
2011-12-07 15:12:50 +05:30
Pascal Massimino
273a12a013 fix off-by-1 diff in case cropping and simple filtering
Change-Id: I6dea172d0cf129f9986b8a3e1eea85fa97a70402
2011-12-05 08:37:55 -08:00
James Zern
721f3f48e7 fix alpha decode
- remove left-over WEBP_EXPERIMENTAL_FEATURES #ifdef

Change-Id: I2b91ccd2e2b3ebea63d5f698f90206feec30a4db
2011-12-02 11:00:27 -08:00
Pascal Massimino
60942c8cea fix the has_alpha_ order
Change-Id: I26211732584f6181bf763497818b45515e394c21
2011-12-02 10:26:42 -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
James Zern
eda520a92e cosmetics after 9523f2a
spelling, indent and other style conformance

Change-Id: Iad720c0d85f2147676e302439d57628712d3b109
2011-12-01 13:05:31 -08:00
Vikas Arora
885f25bc83 Updated the includes to relative paths.
Change-Id: I0ea1a59dd0f6cb1df9f41e048e0c5a13e7fb8335
2011-12-01 15:30:41 +05:30
Vikas Arora
667b769aee Fixed the include for types.h within mux.h
Made the include (for types.h) to relative path w.r.t mux.h

Change-Id: Ifb2a36557d7c8b63490738a2cc48e03993d24639
2011-12-01 13:47:32 +05:30
Vikas Arora
9523f2a5de Add Alpha Encode support from WebPEncode.
Extend WebP Encode functionality to encode Alpha data and produce
bit-stream (RIFF+VP8X+ALPH+VP8) corresponding to WebP-Alpha.

Change-Id: I983b4cd97be94a86a8e6d03b3b9c728db851bf48
2011-12-01 12:15:58 +05:30
pascal massimino
16612ddd30 Merge "Add Alpha Decode support from WebPDecode." 2011-11-30 22:02:03 -08:00
Vikas Arora
d117a94046 Add Alpha Decode support from WebPDecode.
Extend WebP decode functionality to extract Alpha data (support ALPH
chunk) and decode the Alpha plane using Alpha (utils/alpha) core-lib.

Change-Id: I6f0ee1b189c13caba3c1dd9b681383bfd00aa212
2011-12-01 11:24:50 +05:30
James Zern
67228734dc cosmetics after e1947a9
indent / spelling / line length & a couple missing consts

Change-Id: Id282cb7bc6881d4738a3d9fa912b5b22a007c4d2
2011-11-30 18:51:20 -08:00
Vikas Arora
e1947a9299 Add Alpha encode/decode code.
Add code for Alpha encoding & decoding. The alpha compression is done
via backward reference counts encoded with Arithmetic encoder (TCoder).
Also provided is lossy Alpha pre-processing option via level-quantizations
using kNN heuristic.

Change-Id: Ib6b13530c1a4ab6493edcb586ad29fe242bc1766
2011-11-30 17:53:09 +05:30
Pascal Massimino
afc4c5d695 simplify code by introducing a CopyPlane() helper func
Change-Id: Id1a2a5d8a3bf48cf614213442c1386a77c0d6880
2011-11-23 18:00:39 -08:00
pascal massimino
113b312881 Merge "MUX API Updates" 2011-11-23 05:58:02 -08:00
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
Somnath Banerjee
5acf04ef8c remove orphan source file
similar to 8962030 enc/enc_sse2.c became a part of dsp/ w/e06ac08.

Change-Id: Ia0cef3133e3f8ec5da0bd7a5172c22e86f1d41cb
2011-11-19 11:01:19 -08:00
pascal massimino
059f03ef99 Merge "dec: validate colorspace before using as array index" 2011-11-17 10:24:59 -08:00
Pascal Massimino
9b243b3db0 factorize some code
Change-Id: Iac4cf0cf05888b7dd6613028dac619d8f5b0501b
2011-11-16 19:00:27 -08:00
James Zern
469d6eb974 Merge "Makefile.am: remove redundant noinst_HEADERS" 2011-11-16 18:41:55 -08:00
James Zern
9fe3372f19 dec: validate colorspace before using as array index
Change-Id: I5bcf01769d58d39a5f8d50f54cf0cd83a2309602
2011-11-16 18:21:56 -08:00
James Zern
8962030f52 remove orphan source file
enc/enc.c became a part of dsp/ w/e06ac08.

Change-Id: I9e99aa6eac7b28162f58f3f0dc180a68a279d136
2011-11-14 19:31:02 -08:00
James Zern
ced3e3f4e0 Makefile.am: remove redundant noinst_HEADERS
When they appear in _SOURCES they won't be installed [1].

[1]: http://www.gnu.org/software/automake/manual/automake.html#Headers

Change-Id: I14fd816294682e7bd0fccefd6428e1526c9470d8
2011-11-11 16:29:32 -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
Vikas Arora
f07b2138cd Rectify the Chunk parsing logic.
For odd-sized chunk-payload, there's one Byte padding at the end to make the
next chunk start at even-address. The chunk-skip logic needs to be updated to
handle such cases.

Change-Id: I8939ed07584a6195092fbe703eb0ea711fa5f153
2011-10-31 18:47:33 -07:00
Pascal Massimino
42c2e682e0 Fix missing coma (on uncompiled code)
Spotted by Jakub, Thanks!

Change-Id: Ic2509acc683690748089b831ee3d109ad2162dc2
2011-10-27 06:37:36 -07:00
Vikas Arora
9f761cfae9 Changed function signature for WebPMuxCreate
Changed function signature of method WebPMuxCreate and few other minor nits.
Header file has been re-organised to have declaration of set/get/Delete
methods for different use-cases (Metadata, ColorProfile etc) in one place
instead of declaring all Set methods together followed by Get & Delete.

Change-Id: I52f6dffd216b1c343423d55a5b45fa1b9b9c1347
2011-09-29 10:58:40 +05:30
Vikas Arora
2315785f2c Add Mux library for manipulating WebP container.
This change adds the WebP Mux library for manipulating the WebP Mux
Container. The library document and command line tool exhibiting the
usage of this libary will follow in subsequent Git change.

Change-Id: I4cba7dd12307483185ad5a68df33af6c36c154c8
2011-09-27 14:14:46 +05:30
James Zern
563e52d62e cosmetics after '76036f5 Refactor decoder library'
reference 'VP8X' consistently / spelling
sort header size defines alphabetically on their logical boundaries
drop useless cast
const updates

Change-Id: I9409814c5b89773ae8910dc74887f91435e6ac82
2011-09-16 12:32:03 -07:00
Urvang Joshi
76036f547e Refactor decoder library
- Move common defines to dec/webpi.h
 - Regularize naming and parameters of various "CheckAndSkip" functions.
   Also they return VP8StatusCode for clarity.
 - Move WebP header/chunk parsing functions to webpi.h
 - Fix a bug in static function GetFeatures()

Change-Id: Ibc3da4ba210d860551724dc40741959750d66b89
2011-09-16 10:55:24 -07:00
Pascal Massimino
7a8d8762c1 use a user-visible MACRO for max width/height.
This has been pointed as a useful information to have in the header (for
the non VP8-specs savvy ones)

Change-Id: I494b1da41dfafce882a94e3677d1cd6206bc504b
2011-09-13 16:07:30 -07:00
Somnath Banerjee
d4e9f5598d NEON decode support in WebP
Change-Id: I0d6fa456ca68468353adcd64669f1737d1446f65
2011-09-13 16:00:47 -07:00
James Zern
0ee683b593 update libtool version-info
consistent with:
  http://www.gnu.org/software/libtool/manual/libtool.html#Versioning

current=2 matches the ABI version for both encode & decode

Change-Id: Ie175b2bdb8f5e14690f4cf6357fc0e0c6c78fe7d
2011-09-13 15:49:13 -07:00
James Zern
fdbe02c581 windows: match _cond_destroy logic w/return variable name
CloseHandle returns non-zero on success so earlier versions would leave
'ok' with a misleading value, though the return itself was correct.

Change-Id: I21b74a59d90f7bf1b484a55f3960962e933f577b
2011-09-13 15:48:33 -07:00
Pascal Massimino
6a32a0f5bf make VP8BitReader a typedef, for better re-use
Change-Id: Id91f8c5649f9fd078facc9f280a314377193b5e8
2011-09-13 15:47:24 -07:00
Pascal Massimino
b112e83647 create a libwebputils under src/utils
with bit_reader bit_writer and thread for now.

Change-Id: If961933fcfc43e60220913fe4d527230ba8f46bb
2011-09-13 15:34:15 -07:00
Pascal Massimino
ee697d9fc9 harmonize the include guards and #endif comments 2011-09-13 15:31:52 -07:00
Somnath Banerjee
a1ec07a618 Fixing compiler error in non x86 arch.
Compiler is not getting the definition of NULL.

Change-Id: I521a99c715bb43e633abd4a26d73ad25bbbafc94
2011-09-13 15:27:58 -07:00
Somnath Banerjee
dcfa509a28 Fixed recursive inclusion of bit_writer.h and vp8enci.h.
Was getting compiler error when I included bit_writer.h from non libwebp
directory. bit_writer.h includes vp8enci.h and that uses VP8BitWriter without
having it's definition.

Change-Id: I1ca82594292979b9eb7e60e2fffb22c16768dd30
2011-09-13 15:26:39 -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
James Zern
ebeb412aa5 use unsigned int for bitfields
uint8_t is a gcc extension which msvc similarly supports, but for
greater compatibility, and to match the change already made in
dec/vp8i.h, update the remaining bitfield to use unsigned int.

Change-Id: Id9dca470345871e00e82893255a306dfe5d3fa29
2011-09-13 12:19:00 -07:00
Pascal Massimino
341cc56a8c make kNewRange a static array
Change-Id: I78096e2a28e6f732e13df6bde790a1266053838c
2011-09-13 11:51:32 -07:00
Pascal Massimino
812dfa1ae1 bump up versions in preparations for 0.1.3
Change-Id: Icbadada515a5be7810473ff530565c2cb4fb904d
2011-08-29 22:52:47 -07:00
James Zern
7c43663036 Silence some (more) Visual Studio warnings.
Change-Id: Idac44feac894ab13630e032222c4744d6fa785df
2011-08-29 18:08:26 -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
6215595cd1 Merge "add a -partition_limit option to limit the number of bits used by intra4x4" 2011-08-23 16:09:10 -07:00
Pascal Massimino
3814b76c48 Merge "reorganize chunk-parsing code" 2011-08-23 16:03:05 -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
cd12b4b0ac add the missing cost for I4/I16 mode selection
was missing from the RD-computation of intra-4x4 score.
Doesn't change anything significantly, it's just More Correct.

Change-Id: I25c5b53a810d97e6fb7f98c549fd23bbe55e1bf4
2011-08-18 20:48:06 -07:00
Pascal Massimino
dfcc2136e1 reorganize chunk-parsing code
make room for future VP8X extensions

Change-Id: Ic78217c26f142403b733740b17980aa81602f83d
2011-08-18 11:07:13 -07:00
Pascal Massimino
3cf2030653 initialize pointers to function within VP8DspInit()
makes testing easier, allowing a reset to C-version

Change-Id: I707d8338fedff4ae993e52eefe730c236ca3dcb5
2011-08-18 10:03:19 -07:00
James Zern
d21b479581 Merge "windows: add decode threading support" 2011-08-05 16:31:50 -07:00
James Zern
473ae95324 fix hang on thread creation failure
with assertions enabled the code would abort in
WebPWorkerChangeState with:
Assertion `worker->status_ >= OK'

without them the code would hang in the _cond_wait.

this change makes WebPWorkerChangeState a no-op in this case.

Change-Id: Iea855568bbdef2865ae61ab54473b3a7c230e91a
2011-08-05 15:01:16 -07:00
James Zern
fccca4202f windows: add decode threading support
Change-Id: Iad923550569ceec1ff469852ec68e66de3f6062b
2011-08-05 12:28:40 -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
Pascal Massimino
acd8ba4229 io->teardown() was not always called upon error
Change-Id: I8317139b583124fc20754b9b19aa4dba51cd05af
2011-07-20 07:49:57 -07:00
James Zern
e1e9be3502 cosmetics: spelling/grammar in README and lib headers
Change-Id: Ib8648adf652d29dd38887e5e07b09b4aa3965c6e
2011-07-15 18:58:56 -07:00
Pascal Massimino
998754a734 remove unused nb_i4_ and nb_i16_ fields.
Change-Id: Idf361e5528bddb3b25f3bc12502fdfd5c4cf9149
2011-07-15 14:57:07 -07:00
Pascal Massimino
9f01ce3afa rename WebPDecBuffer::memory -> private_memory
This makes it clear that it shouldn't be used externally.

Change-Id: I10c04c6606abbe851b6a3b424832803e842b2057
2011-07-15 14:49:01 -07:00
Pascal Massimino
fb5d659bbd fix an overflow bug in LUT calculation
round(clip()) != clip(round())

Change-Id: Ia53f845b62e01bce672456cb7cdf8581f1a7ce44
2011-07-14 22:22:46 -07:00
Pascal Massimino
78aeed4088 add missing WebPDecodeARGBInto() and switch ARGB4444 to RGBA4444 as was intended 2011-07-14 11:41:23 -07:00
James Zern
cd7c5292e9 explicitly mark library functions as extern
Add WEBP_EXTERN(type) macro which should make Windows DLL builds simpler
by allowing the signature to be changed.

Change-Id: I0cfa45dff779985680b1a38ddff30973a0d26639
2011-07-13 17:48:39 -07:00
Pascal Massimino
19db59f80f add support for RGB565, ARGB4444 and ARGB colorspace (decoder)
RGB565 and ARGB4444 are only supported through the advanced decoding API.
ARGB being somewhat generic, there's an easy WebPDecodeARGB()
new function for convenience.

Patch by Vikas Arora (vikaas dot arora at gmail dot com)

Change-Id: Ic7b6f72bd70aca458d14e7fdd23679212430ebca
2011-07-13 09:08:58 -07:00
Pascal Massimino
c915fb2aa7 encoder speed-up: hardcode special level values
1-3% faster

Change-Id: Ib2131989fbf819bcbfa6456adbeea0ba27c914f7
2011-07-12 18:21:22 -07:00
Pascal Massimino
c558bdad28 Rename and improve the API to retrieve decoded area
Change-Id: Iec7e0a1361c27dcf2dc8445170ab5b400454fce9
2011-07-12 13:59:51 -07:00
Pascal Massimino
c9ea03d770 SSE2 version of strong filtering
~10% faster decoding
Patch by Somnath Banerjee (somnath at google dot com)

Change-Id: I10e380c036ff61afe24afc26084a508ab01e8502
2011-07-11 23:04:26 -07: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
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