webm/libwebp.git
3 days agoMove Entropy methods to lossless.c 21/72221/1 master
Vikas Arora [Thu, 20 Nov 2014 21:46:36 +0000 (13:46 -0800)]
Move Entropy methods to lossless.c

Move all the Entropy evaluation methods to lossless.c (from histogram.c).
There's slight difference in the way entropy is computed for evaluating
entropy in prediction methods and histogram (literal) for huffman trees.
Plan (later) to merge few (static) methods and reduce the code size.

This change has no impact on the compression speed/density.

Change-Id: Ife3d96a3c4a8d78a91723d9e0a8d1b78c0256a15

9 days agoiosbuild: add x64_64 simulator support 79/72179/1
James Zern [Sat, 15 Nov 2014 00:38:42 +0000 (16:38 -0800)]
iosbuild: add x64_64 simulator support

based on the patch here:
https://github.com/pixelkind/webp-ios-build

Change-Id: Iaa346b751e5f18e8cf13a8e5c4064b0c2a3f5f6c

10 days agoRemove handling for WEBP_HINT_GRAPH 64/72164/1
Vikas Arora [Thu, 13 Nov 2014 23:47:48 +0000 (15:47 -0800)]
Remove handling for WEBP_HINT_GRAPH

Remove handling for WEBP_HINT_GRAPH w.r.t use_palette flag.

The WEBP_HINT_GRAPH is now used at one place, to set the initial size of the
Bit Writer as bpp for photo images are generally larger than the graphical
images.

Change-Id: I1b9c4436c85a8f69da74c0dbcd292397323f2696

10 days agoMove static method definition before its usage. 58/72158/1
Vikas Arora [Thu, 13 Nov 2014 21:17:24 +0000 (13:17 -0800)]
Move static method definition before its usage.

Change-Id: Id766c2bea92e7ebf0de65046f73429b74b4fdda4

10 days agoUpdate BackwardRefsWithLocalCache. 45/72145/4
Vikas Arora [Thu, 13 Nov 2014 00:53:46 +0000 (16:53 -0800)]
Update BackwardRefsWithLocalCache.

Update BackwardRefsWithLocalCache to do in-place update of backward
references w.r.t local color cache index.

No impact on the compression density or compression speed.

Change-Id: Ie066251464c3928c044e037b43df3af28b48ca30

11 days agoRemove TODOs from lossless encoder code. 43/72143/2
Vikas Arora [Wed, 12 Nov 2014 23:21:29 +0000 (15:21 -0800)]
Remove TODOs from lossless encoder code.

histogram.c:
 - Verified (earlier) that there's low correlation between Red & Blue colors
   (particularly after applying Cross-color transform). The Bin based histogram
   merge, bins on three entropies viz literal, red & blue symbols. Removing
   either of blue or red increases the compression density. So keeping the bins
   for red & blue sybmols.
 - Keeping the compact bins method as-is. This way it's simpler to read.
huffman_encode.h: Added field comments for struct HuffmanTree and removed the TODO.

Change-Id: Ia76f7bc730079d1b3b644038c5d9931db3797f0e

11 days agoOptmize VP8LGetBackwardReferences LZ77 references. 35/72135/2
Vikas Arora [Tue, 11 Nov 2014 19:24:02 +0000 (11:24 -0800)]
Optmize VP8LGetBackwardReferences LZ77 references.

Use the refs_lz77 computed (with cache_bits=0) in the method 'CalculateBestCacheSize'
to regenerate the LZ77 references corresponding to the optimum cache_bits and avoid
calling costly 'BackwardReferencesLz77' one extra time.

This change leaves the compression density unchanged and speeds up compression
by 10-15%.

Change-Id: I5a92e11788d3c3f656aa7e1fba54fb5d96ee0027

2 weeks agoMIPS: dspr2: added optimization for function Select 10/72110/1
Djordje Pesut [Fri, 7 Nov 2014 08:44:16 +0000 (09:44 +0100)]
MIPS: dspr2: added optimization for function Select

Change-Id: I22470d8b9ab8c5e90c5330ff12c9852676da1a3d

2 weeks agoMerge "WebPEncode: Support encoding same pic twice (even if modified)"
pascal massimino [Fri, 7 Nov 2014 06:20:01 +0000 (22:20 -0800)]
Merge "WebPEncode: Support encoding same pic twice (even if modified)"

2 weeks agoWebPEncode: Support encoding same pic twice (even if modified) 04/72104/1
Urvang Joshi [Thu, 6 Nov 2014 21:52:48 +0000 (13:52 -0800)]
WebPEncode: Support encoding same pic twice (even if modified)

This wasn't working for this specific scenario:
- Encode an RGBA 'pic' (with trivial alpha) using lossy encoding.
(so that pic->a == NULL after import happens).
- Modify the 'pic->argb' so that it has non-trivial alpha.
- Encode the same 'pic' again.
This used to fail to encode alpha data as pic->a == NULL.

Change-Id: Ieaaa7bd09825c42f54fbd99e6781d98f0b19cc0c

2 weeks agoMerge "Updated VP8LGetBackwardReferences and color cache."
pascal massimino [Thu, 6 Nov 2014 21:47:21 +0000 (13:47 -0800)]
Merge "Updated VP8LGetBackwardReferences and color cache."

2 weeks agoUpdated VP8LGetBackwardReferences and color cache. 01/72101/1
Vikas Arora [Thu, 6 Nov 2014 21:13:00 +0000 (13:13 -0800)]
Updated VP8LGetBackwardReferences and color cache.

- The optimal cache bits is evaluated inside the method 'VP8LGetBackwardReferences'.
- The input cache_bits to 'VP8LGetBackwardReferences' sets the maximum cache
  bits to use (passing 0 implies disabling the local color cache).
- The local color cache is disabled for lowerf (<= 25) quality levels (as before).
- Enabled local color cache for palette images as well. This saves additional
  0.017% bytes with a slight (2-3%) improvement in the compression speed.
- Removed 'use_2d_locality' parameter from method VP8LGetBackwardReferences, as
  this option is not an option now (after we freeze the lossless bit-stream).

Change-Id: I33430401e465474fa1be899f330387cd2b466280

2 weeks agoMIPS: dspr2: added optimization for function FTransform 97/72097/1
Djordje Pesut [Thu, 6 Nov 2014 13:15:29 +0000 (14:15 +0100)]
MIPS: dspr2: added optimization for function FTransform

Change-Id: Ib5850edbc2a586ec9781f494b2337f024e22af78

2 weeks agoMIPS: dspr2: Added optimization for function VP8LSubtractGreenFromBlueAndRed 96/72096/2
Djordje Pesut [Thu, 6 Nov 2014 08:37:02 +0000 (09:37 +0100)]
MIPS: dspr2: Added optimization for function VP8LSubtractGreenFromBlueAndRed

Change-Id: I683c73cceee4a40ca810deba15e54fbf7dbe8918

2 weeks agoMerge "FlattenSimilarBlocks should only be tried when blending is possible."
pascal massimino [Wed, 5 Nov 2014 22:19:40 +0000 (14:19 -0800)]
Merge "FlattenSimilarBlocks should only be tried when blending is possible."

2 weeks agoFlattenSimilarBlocks should only be tried when blending is possible. 86/72086/1
Urvang Joshi [Wed, 5 Nov 2014 18:44:07 +0000 (10:44 -0800)]
FlattenSimilarBlocks should only be tried when blending is possible.

This is because, FlattenSimilarBlocks() replaces some opaque pixels by
transparent ones. This results in an equivalent output only if blending
is turned on for the current frame.

Change-Id: I05612c952fdbd4b3a6e0ac9f3a7d49822f0cfb9b

2 weeks agoMIPS: dspr2: added optimization for Disto4x4 84/72084/1
Djordje Pesut [Wed, 5 Nov 2014 11:06:15 +0000 (12:06 +0100)]
MIPS: dspr2: added optimization for Disto4x4

enc/dec common macros moved to mips_macro.h

Change-Id: I38d491e772554ac663dd5eb4d15485c0343f23b1

2 weeks agobackward_references.c: reindent after c8581b0 71/72071/1
James Zern [Tue, 4 Nov 2014 16:34:35 +0000 (17:34 +0100)]
backward_references.c: reindent after c8581b0

Change-Id: Icfc0fe8e266c0f67a70b8cb095e5aaee155290b6

2 weeks agoOptimize BackwardReferences for RLE encoding. 69/72069/1
Vikas Arora [Tue, 4 Nov 2014 16:10:31 +0000 (08:10 -0800)]
Optimize BackwardReferences for RLE encoding.

Updated BackwardReferencesRle method by utilizing the local color cache.
Also changed the name of method BackwardReferencesHashChain to
BackwardReferencesLz77 to reflect the LZ77 coding.

For the 1000 image corpus, this change saves 0.2% bytes
(at default settings) and is 2-5% faster to encode.

Change-Id: Ic3f288253b3bbb101a69945a80994c3fd0917f8b

2 weeks agoMIPS: dspr2: unfilters bugfix (Ie7b7387478a6b5c3f08691628ae00f059cf6d899) 59/72059/1
Djordje Pesut [Mon, 3 Nov 2014 14:37:00 +0000 (15:37 +0100)]
MIPS: dspr2: unfilters bugfix (Ie7b7387478a6b5c3f08691628ae00f059cf6d899)

Change-Id: I78d97960efbd1ec1af51a5426e38dc01bdb48140

3 weeks agoOptimize backwardreferences 55/72055/1
Vikas Arora [Sat, 1 Nov 2014 01:07:11 +0000 (18:07 -0700)]
Optimize backwardreferences

Optimize backwardreferences (about 0.1% byte savings) with almost same
compression speed (3% faster on defaut compression settings).
1.) Simplified iteration logic for HashChainFindCopy.
    - Remapped the iter_max constant.
2.) Simplified main for loop for BackwardReferencesHashChain
    - Removed 'if' conditions for corner cases in the main loop.
    - Refactored the method(AddSingleLiteral) for adding one pixel.

Change-Id: I1bc44832fd81f11e714868a13e606c8f83157e64

3 weeks agoMerge "webp/types.h: use inline for clang++/-std=c++11"
James Zern [Fri, 31 Oct 2014 10:53:06 +0000 (03:53 -0700)]
Merge "webp/types.h: use inline for clang++/-std=c++11"

3 weeks agogif2webp: Add '-min-size' option to get best compression. 50/72050/1
Urvang Joshi [Thu, 30 Oct 2014 22:17:09 +0000 (15:17 -0700)]
gif2webp: Add '-min-size' option to get best compression.

This disables key-frame insertion and tries both dispose methods for
each frame.

Change-Id: Ib167747198fd1d98cb93321f76826e91228f24d8

3 weeks agoSpeed up BackwardReferences 47/72047/1
Vikas Arora [Thu, 30 Oct 2014 17:53:15 +0000 (10:53 -0700)]
Speed up BackwardReferences

Speed up BackwardReferencesHashChainDistanceOnly method by:
1.) Remove for loop for shortmax code path.
2.) Execute the shortmax code path after regular call to
HashChainFindCopy, only if HashChainFindCopy() returns length > 2 (MIN_LENGTH).
3.) Also for shortmax, call method HashChainFindOffset (for length = 2),
instead of expensive method HashChainFindCopy().
4.) Handling first pixel (i==0) outside main loop and removing one if
condition (i > 0) per pixel.
5.) Handle the last pixel outside the main 'for' loop.

Overall compression speedup observed is around 5% (+/- noise).

Change-Id: Ifa30c4035f8d26e6e43e3c4881244d777961c22b

3 weeks agowebp/types.h: use inline for clang++/-std=c++11 44/72044/2
James Zern [Thu, 30 Oct 2014 13:49:31 +0000 (14:49 +0100)]
webp/types.h: use inline for clang++/-std=c++11

at least clang 3.[45] in c++ mode with -std=c++11 define __STRICT_ANSI__
this change set WEBP_INLINE to inline for c++/non-strict-ansi/> c99

fixes crbug.com/428383

Change-Id: Ief2b934353c336a75865c73c90cc3dc5e4f83913

3 weeks agoEnable entropy based merge histo for (q<100) 37/72037/3
Vikas Arora [Wed, 29 Oct 2014 21:52:43 +0000 (14:52 -0700)]
Enable entropy based merge histo for (q<100)

Enable bin-partition entropy based heuristic for merging histograms
for higher (q >= 90) qualities as well. Keep the old behavior at the
maximum quality level (q==100).

This speeds up the compression between Q=90-99 (method=4) by factor 5-7X
and with loss of 0.5-0.8% in the compression density.

Change-Id: I011182cb8ae5403c565a150362bc302630b3f330

3 weeks agofilters_mips_dsp_r2.c: disable unfilters 43/72043/1
James Zern [Thu, 30 Oct 2014 10:08:05 +0000 (11:08 +0100)]
filters_mips_dsp_r2.c: disable unfilters

the output does not match the C-code.

Change-Id: Ie7b7387478a6b5c3f08691628ae00f059cf6d899

3 weeks agoMIPS: dspr2: Added optimization for function ClampedAddSubtractFull 34/72034/3
Djordje Pesut [Wed, 29 Oct 2014 10:42:30 +0000 (11:42 +0100)]
MIPS: dspr2: Added optimization for function ClampedAddSubtractFull

Change-Id: Iee98eaf007158f44a299dd5ba8d972d0d4108380

3 weeks agoMIPS: dspr2: added optimization for function ClampedAddSubtractHalf 32/72032/2
Djordje Pesut [Fri, 10 Oct 2014 08:35:43 +0000 (10:35 +0200)]
MIPS: dspr2: added optimization for function ClampedAddSubtractHalf

Change-Id: Iec22e897a4f56e79c18ec00f8caa9cefac67f186

3 weeks agoMIPS: dspr2: added optimization for ITransform 15/72015/5
Djordje Pesut [Fri, 10 Oct 2014 10:31:00 +0000 (12:31 +0200)]
MIPS: dspr2: added optimization for ITransform

Change-Id: I3534fca143535c53d18a3749b3a1b0c8a7563463

3 weeks agogif2webp: Use the default hint instead of WEBP_HINT_GRAPH. 24/72024/1
Urvang Joshi [Mon, 27 Oct 2014 23:41:39 +0000 (16:41 -0700)]
gif2webp: Use the default hint instead of WEBP_HINT_GRAPH.

This is much faster and the compression is slightly better too.

Change-Id: Ibf0d10eea83bfabfcc44ee497074767462ff41b1

3 weeks agoIncrease the MAX_COLOR_CACHE_BITS from 9 to 10. 21/72021/1
Vikas Arora [Mon, 27 Oct 2014 21:18:07 +0000 (14:18 -0700)]
Increase the MAX_COLOR_CACHE_BITS from 9 to 10.

The Maximum allowed limit is 11.
The Q=25 and below is not impacted as cache bits are forced to 0.
This saves 0.05% - 0.1% bytes for other quality with almost same compression
speed (+/- 2-3%, that's more of a noise).

Change-Id: Icf972a98f298c89e140e37a627baf709134be9a0

3 weeks agoChange the logic adjusting the Histogram bits. 17/72017/1
Vikas Arora [Mon, 27 Oct 2014 16:56:24 +0000 (09:56 -0700)]
Change the logic adjusting the Histogram bits.

Updated the logic to limit the Histogram size to a constant, instead of
computing the same based on the Histogram size (that's variable size based on
the cache bits) for the maximum possible cache bits. The actual cache bits may
be lower than the maximum.
Note: The constant 2600 is 16MB/Sizeof(HistogramSize(MAX_COLOR_CACHE_BITS)).

The compression density remains the same with this change, with little faster
compression speed.

Change-Id: I3149894962852e9dad2501b9aa16bb847a20fd86

3 weeks agoMerge "Fix bug in VP8LCalculateEstimateForCacheSize."
pascal massimino [Mon, 27 Oct 2014 09:31:10 +0000 (02:31 -0700)]
Merge "Fix bug in VP8LCalculateEstimateForCacheSize."

4 weeks agoFix bug in VP8LCalculateEstimateForCacheSize. 98/71998/3
Vikas Arora [Thu, 23 Oct 2014 16:01:46 +0000 (09:01 -0700)]
Fix bug in VP8LCalculateEstimateForCacheSize.

The method VP8LCalculateEstimateForCacheSize is not evaluating the all possible
range for cache_bits.
Also added a small penality for choosing the larger cache-size. This is done to
strike a balance between additional memory/CPU cost (with larger cache-size) and
byte savings from smaller WebP lossless files.

This change saves about 0.07% bytes and speeds up compression by 8% (default
settings). There's small speedup at Q=50 along with byte savings as well.
Compression at Quality=25 is not effected by this change.

Change-Id: Id8f87dee6b5bccb2baa6dbdee479ee9cda8f4f77

4 weeks agoMerge "dec_neon: add RD4 intra predictor"
pascal massimino [Sun, 26 Oct 2014 20:55:03 +0000 (13:55 -0700)]
Merge "dec_neon: add RD4 intra predictor"

4 weeks agoMerge "Makefile.vc: add a 'legacy' RTLIBCFG option"
pascal massimino [Sun, 26 Oct 2014 20:54:36 +0000 (13:54 -0700)]
Merge "Makefile.vc: add a 'legacy' RTLIBCFG option"

4 weeks agodec_neon: add RD4 intra predictor 13/72013/1
James Zern [Fri, 24 Oct 2014 19:22:07 +0000 (21:22 +0200)]
dec_neon: add RD4 intra predictor

based on the SSE2 version; a bit rough around the loads, but still ~38%
faster.

Change-Id: I22426d939a7354cbc9a85ca8c68235d6081b882f

4 weeks agoupdate NEWS 96/71996/1
James Zern [Mon, 13 Oct 2014 15:13:49 +0000 (17:13 +0200)]
update NEWS

Change-Id: Ib9b48e3611b77214bc875524249366ff62451c1b
(cherry picked from commit 0c1b98d28c1dec2ea45c101fca979b31b8db1e5b)

4 weeks agoMerge "dec_neon: DC4: use pair-wise adds for top row"
James Zern [Thu, 23 Oct 2014 15:08:34 +0000 (08:08 -0700)]
Merge "dec_neon: DC4: use pair-wise adds for top row"

4 weeks agoMakefile.vc: add a 'legacy' RTLIBCFG option 95/71995/1
James Zern [Thu, 23 Oct 2014 14:57:34 +0000 (07:57 -0700)]
Makefile.vc: add a 'legacy' RTLIBCFG option

disables buffer security checks (/GS-) and any machine optimizations
(e.g., sse2)

fixes issue #228

Change-Id: I81fa483dc1654199b2017626320383d2d63317dc

4 weeks agoMerge "dsp/dec_{neon,sse2}: VE4: normalize variable names"
pascal massimino [Thu, 23 Oct 2014 14:29:27 +0000 (07:29 -0700)]
Merge "dsp/dec_{neon,sse2}: VE4: normalize variable names"

4 weeks agodsp/dec_{neon,sse2}: VE4: normalize variable names 94/71994/1
James Zern [Thu, 23 Oct 2014 14:04:13 +0000 (16:04 +0200)]
dsp/dec_{neon,sse2}: VE4: normalize variable names

use '0' rather than '_' when dealing with variables that result from a
shift

Change-Id: I29280c0dead645ce39dc4bb42c3e19929b302fd4

4 weeks agodec_neon: DC4: use pair-wise adds for top row 93/71993/2
James Zern [Thu, 23 Oct 2014 13:01:50 +0000 (15:01 +0200)]
dec_neon: DC4: use pair-wise adds for top row

reduces load count, slightly faster

Change-Id: I880340ef8ef75ce4ce321c330f56f86b758bda08

4 weeks agoUnify the API between VP8BitWriter and VP8LBitWriter 92/71992/1
Pascal Massimino [Thu, 23 Oct 2014 13:35:16 +0000 (15:35 +0200)]
Unify the API between VP8BitWriter and VP8LBitWriter

BitReader will be next...

Change-Id: Icd9e7ab2e3890131e664c0523627d9b8c5399a74

4 weeks agoMerge changes I2e06907b,Ia9ed4ca6,I782282ff
pascal massimino [Thu, 23 Oct 2014 13:31:54 +0000 (06:31 -0700)]
Merge changes I2e06907b,Ia9ed4ca6,I782282ff

* changes:
  dec_neon: add DC4 intra predictor
  dec_neon: add TM4 intra predictor
  dec_neon: add LD4 intra predictor

4 weeks agoMerge "dec_neon: add VE4 intra predictor"
pascal massimino [Thu, 23 Oct 2014 12:38:41 +0000 (05:38 -0700)]
Merge "dec_neon: add VE4 intra predictor"

4 weeks agodec_neon: add DC4 intra predictor 83/71983/3
James Zern [Wed, 22 Oct 2014 15:02:28 +0000 (17:02 +0200)]
dec_neon: add DC4 intra predictor

~70% faster

Change-Id: I2e06907b8d69be71a8c5581832c931923c24bab0

4 weeks agodec_neon: add TM4 intra predictor 82/71982/3
James Zern [Wed, 22 Oct 2014 09:56:22 +0000 (11:56 +0200)]
dec_neon: add TM4 intra predictor

~21% faster

Change-Id: Ia9ed4ca650f9d544821fa1faf3173611806a272a

4 weeks agodec_neon: add LD4 intra predictor 81/71981/4
James Zern [Wed, 22 Oct 2014 18:43:36 +0000 (20:43 +0200)]
dec_neon: add LD4 intra predictor

based on SSE2 version, ~55% faster

Change-Id: I782282ffc31dcf238890b3ba0decccf1d793dad0

4 weeks agodec_neon: add VE4 intra predictor 80/71980/2
James Zern [Tue, 21 Oct 2014 16:06:08 +0000 (18:06 +0200)]
dec_neon: add VE4 intra predictor

based on SSE2 version, ~59% faster

Change-Id: Iaa2181eb51bd975de0e9fe5c7b66ed18188f0e3b

4 weeks agoMerge "Modify CostModel to allocate optimal memory."
James Zern [Thu, 23 Oct 2014 09:00:39 +0000 (02:00 -0700)]
Merge "Modify CostModel to allocate optimal memory."

4 weeks agogif2webp: Support GIF_DISPOSE_RESTORE_PREVIOUS 90/71990/1
Urvang Joshi [Thu, 23 Oct 2014 00:02:07 +0000 (17:02 -0700)]
gif2webp: Support GIF_DISPOSE_RESTORE_PREVIOUS

Tweaked the gif2webp_util API to support this.

Requested in: https://code.google.com/p/webp/issues/detail?id=144

Change-Id: I0e8c4edc39227355cd8d3acc55795186e25d0c3a

4 weeks agogif2webp: Handle frames with odd offsets + disposal to background. 88/71988/1
Urvang Joshi [Wed, 22 Oct 2014 22:43:26 +0000 (15:43 -0700)]
gif2webp: Handle frames with odd offsets + disposal to background.

Snapping odd offsets in GIF to even offsets in WebP was causing extra row/column
being disposed in such cases.

Code is rewritten to maintain previous and current canvas (it used to maintain
previous canvas and current frame earlier). And we recompute change rectangles
as those from GIF may no longer apply.
Also, this renders methods like ReduceTransparency() and ConvertToKeyFrame()
redundant, as internally maintained current canvas is always independent of
previous canvases.

Disposal method choice: we pick the disposal method that results in the smallest
change rectangle.

Change-Id: Ic31186d98fe1a2a790a89d1571b17e3abd127e79

4 weeks agoModify CostModel to allocate optimal memory. 79/71979/3
Vikas Arora [Wed, 22 Oct 2014 18:14:37 +0000 (11:14 -0700)]
Modify CostModel to allocate optimal memory.

Change-Id: I7d52675d28bfc109d4e901581fc24cd36fcb79ee

4 weeks agoimplement VE4/HE4/RD4/... in SSE2 72/71972/2
Pascal Massimino [Wed, 22 Oct 2014 16:25:36 +0000 (18:25 +0200)]
implement VE4/HE4/RD4/... in SSE2

(30% faster prediction functions, but overall speed-up is ~1% only)

Change-Id: I2c6e7074aa26a2359c9198a9015e5cbe143c2765

4 weeks agomake VP8PredLuma4[] non-const and initialize array in VP8DspInit() 73/71973/1
Pascal Massimino [Wed, 22 Oct 2014 16:14:20 +0000 (18:14 +0200)]
make VP8PredLuma4[] non-const and initialize array in VP8DspInit()

also convert 'type *dst' to 'type* dst'

Change-Id: I41ab66ad15b548cc45d1cb8b10bbca4fe1528cae

4 weeks agoMerge "PrintReg: output to stderr"
pascal massimino [Wed, 22 Oct 2014 15:55:10 +0000 (08:55 -0700)]
Merge "PrintReg: output to stderr"

4 weeks agoMerge "stopwatch.h: fix includes"
pascal massimino [Wed, 22 Oct 2014 15:28:55 +0000 (08:28 -0700)]
Merge "stopwatch.h: fix includes"

4 weeks agoPrintReg: output to stderr 71/71971/1
James Zern [Wed, 22 Oct 2014 15:28:19 +0000 (17:28 +0200)]
PrintReg: output to stderr

allows use of '-o -' while testing

Change-Id: Ibc02d7cede2df4eb8be0a28c0ca4bf5e91864191

4 weeks agostopwatch.h: fix includes 70/71970/1
James Zern [Wed, 22 Oct 2014 15:25:41 +0000 (17:25 +0200)]
stopwatch.h: fix includes

WEBP_INLINE -> webp/types.h
memcpy -> string.h

Change-Id: Iab2ea8b553dc98be75eede751de62ab0292d1f97

4 weeks agoOptimize BackwardReferenceHashChainFollowPath. 59/71959/2
Vikas Arora [Tue, 21 Oct 2014 06:44:01 +0000 (23:44 -0700)]
Optimize BackwardReferenceHashChainFollowPath.

Instead of calling HashChainFindMethod, call a new (subset) method
HashChainFindOffset to get the offset/distance for a given length.

The encoding is tad faster at default compression

                       Before              After
                     bpp/rate            bpp/rate
442 Palette     0.2720/5.270 MP/s      0.2720/5.790 MP/s
558 non-palette 3.7607/0.797 MP/s      3.7607/0.816 MP/s

Change-Id: If4041a9c18f7e972f49fcbab8c3e2f013d8bf1cf

4 weeks agoenc/backward_references.c: fix indent 44/71944/1
James Zern [Mon, 20 Oct 2014 09:35:20 +0000 (11:35 +0200)]
enc/backward_references.c: fix indent

reindent after c24f895

Change-Id: I55adcbef21ea3fdaded84b138745515596191a09

5 weeks agoMerge "sync version numbers to 0.4.2 release"
James Zern [Fri, 17 Oct 2014 18:47:30 +0000 (11:47 -0700)]
Merge "sync version numbers to 0.4.2 release"

5 weeks agosync version numbers to 0.4.2 release 37/71937/1
James Zern [Fri, 17 Oct 2014 17:49:30 +0000 (19:49 +0200)]
sync version numbers to 0.4.2 release

libwebp{,decoder} - 0.4.2
libwebp libtool - 5.2.0
libwebpdecoder libtool - 1.2.0

mux/demux - 0.2.2
libtool - 1.2.0

(cherry picked from commit eec5f5f12179a4d950fc27aef1c70f087beade59)
(cherry picked from commit 857578a811ea96abfa3235e4e47dd1ab4726e655)

Change-Id: Ie9d10c68e28083674a8865ad8447b1a70dcea95d

5 weeks agoSimplify and speedup Backward refs computation. 33/71933/1
Vikas Arora [Fri, 17 Oct 2014 16:20:02 +0000 (09:20 -0700)]
Simplify and speedup Backward refs computation.

Updated VP8LGetBackwardReferences and HashChainFindCopy method with following:
- Remove the recursive CostModelBuild.
- Reuse the lz77 backward refs in CostModelBuild, instead of evaluating it
  again (as it was done for recursion_level=0).
- Consolidated the Match-length logic inside FindMatchLength method.
- Removed the logic for altering best_length/val based on the 2D distance.
  The additional 162 value (+= 9 * 9 + 9 * 9 - y * y - x * x) can't change the
  best_val eval computation to choose a different curr_length, as best_val was
  set to 'curr_length << 16'.

  Following is the impact on the compression speed/density at default & max
  quality, overall this speeds up compression by 5-15% (q=100 -> 75) with a tad
  drop (0.02-0.03%) in compression density for the non-palette images.

                  Before                After
                bpp/Rate(MP/s)        bpp/Rate(MP/s)
q=75 (def)
All 1000        2.4492/1.049 MP/s     2.4498/1.230 MP/s
Palette         0.2719/5.060 MP/s     0.2719/6.110 MP/s
non-Palette     3.7597/0.732 MP/s     3.7607/0.840 MP/s

q=100
All 1000        2.4134/0.125 MP/s     2.4142/0.131 MP/s
Palette         0.2692/2.585 MP/s     0.2692/2.885 MP/s
non-Palette     3.7040/0.079 MP/s     3.7053/0.083 MP/s

Change-Id: I27a5eff3356d876c3e949fd32262244b25678b7a

5 weeks agofix shared object build with -fvisibility=hidden 69/71569/3
James Zern [Sat, 13 Sep 2014 04:07:19 +0000 (21:07 -0700)]
fix shared object build with -fvisibility=hidden

set WEBP_EXTERN to visibility=default
+ explicitly mark VP8GetCPUInfo as it's referenced within the examples

Change-Id: Ie3d2b15088e888f0b55203b205993eba75899d99

5 weeks agoWEBP_TSAN_IGNORE_FUNCTION: fix gcc compat warning 19/71919/1
James Zern [Thu, 16 Oct 2014 16:06:43 +0000 (18:06 +0200)]
WEBP_TSAN_IGNORE_FUNCTION: fix gcc compat warning

move the attribute to the front of the function to quiet clang warning:
GCC does not allow no_sanitize_thread attribute in this position on a
function definition

Change-Id: Ie4cc6e35a07bd00eab67d9cd6801bd2be9cfe676

5 weeks agoadd code for testing random incremental decoding in dwebp 17/71917/1
Pascal Massimino [Thu, 16 Oct 2014 15:01:32 +0000 (17:01 +0200)]
add code for testing random incremental decoding in dwebp

(protected with WEBP_EXPERIMENTAL_FEATURES flag)

Change-Id: I6cc2488810ce2ccd5d45882bd12f34a3d0c8eab8

5 weeks agomark some init function as being safe for thread_sanitizer. 15/71915/1
Pascal Massimino [Thu, 16 Oct 2014 14:34:07 +0000 (16:34 +0200)]
mark some init function as being safe for thread_sanitizer.

introduces the macro WEBP_TSAN_IGNORE_FUNCTION

Change-Id: I3de2b6c1a2076fba4da7ae50322551e026b2082b

5 weeks agobit_reader.h: cosmetics: fix a typo 06/71906/1
James Zern [Thu, 16 Oct 2014 08:51:57 +0000 (10:51 +0200)]
bit_reader.h: cosmetics: fix a typo

Change-Id: I1ba09124700b3120f18eb3705eb5ba805feb2ca0

5 weeks agoImproved near-lossless mode. 89/71889/2
Pascal Massimino [Wed, 15 Oct 2014 12:28:19 +0000 (14:28 +0200)]
Improved near-lossless mode.

Compared to previous mode it gives another 10-30% improvement in compression keeping comparable PSNR on corresponding quality settings.

Still protected by the WEBP_EXPERIMENTAL_FEATURES flag.

Change-Id: I4821815b9a508f4f38c98821acaddb74c73c60ac

5 weeks agoenc_mips32: workaround gcc-4.9 bug 93/71893/2
James Zern [Wed, 15 Oct 2014 17:08:29 +0000 (19:08 +0200)]
enc_mips32: workaround gcc-4.9 bug

avoids an ICE with NDK r10b + NDK_TOOLCHAIN_VERSION=4.9

In function 'SSE16x16':
enc_mips32.c (684) internal compiler error: Segmentation fault

Change-Id: I1a3d33c0a9534c97633ab93bcdf9bf59d3a7e473

5 weeks agoenc/vp8l.c: fix indent 10/71810/1
James Zern [Mon, 13 Oct 2014 09:33:23 +0000 (11:33 +0200)]
enc/vp8l.c: fix indent

reindent after ca00502

Change-Id: I8c88dbc11dc96c117531b17682b764a235ef23bb

6 weeks agoEvaluate non-palette compression for palette image 96/71796/1
Vikas Arora [Fri, 10 Oct 2014 18:50:52 +0000 (11:50 -0700)]
Evaluate non-palette compression for palette image

Evaluate if for Palette images (num_colors <= 256), non-palette
compression path (Subtract green, predictor transform etc) yield an
optimal compression density.

This change reduces the WebP file (for palette images) size by 0.4% with
drop of 3-5% in compression speed.

Change-Id: I1ad66fa94db4fd7ba7bc215763791ef662cd4f42

6 weeks agoAssignSegments: quiet -Warray-bounds warning 90/71790/2
James Zern [Thu, 25 Sep 2014 06:51:46 +0000 (23:51 -0700)]
AssignSegments: quiet -Warray-bounds warning

the number of segments are previously validated, but an explicit check
is needed to avoid a warning under gcc-4.9

Change-Id: Ifa7c0dd7f3f075b3860fa8ec176d2c98ff54fcea

6 weeks agoMerge "enc_neon: initialize vectors w/vdup_n_u32"
pascal massimino [Thu, 9 Oct 2014 19:23:18 +0000 (12:23 -0700)]
Merge "enc_neon: initialize vectors w/vdup_n_u32"

6 weeks ago1-3% faster encoding optimizing SSE_NxN functions 80/71780/1
Pascal Massimino [Thu, 9 Oct 2014 14:20:00 +0000 (07:20 -0700)]
1-3% faster encoding optimizing SSE_NxN functions

got rid of the |a-b|^|b-a| method and went back
to just (a-b)^2 instead.

quality | size(bytes) after/before | time (ms) after/before

Change-Id: Ia3e0e6507b3f903deb1e182f78dad6df07380fd0

6 weeks agoenc_neon: initialize vectors w/vdup_n_u32 79/71779/1
James Zern [Thu, 9 Oct 2014 10:35:41 +0000 (12:35 +0200)]
enc_neon: initialize vectors w/vdup_n_u32

replaces {} initialization gnu-ism

Change-Id: I5a7b2d4246f0205e4bfb7f4b77d720c47d8674ec

6 weeks agoMerge "Fix return code of EncodeImageInternal()"
Pascal Massimino [Wed, 8 Oct 2014 06:49:29 +0000 (23:49 -0700)]
Merge "Fix return code of EncodeImageInternal()"

6 weeks agoFix return code of EncodeImageInternal() 67/71767/1
Pascal Massimino [Tue, 7 Oct 2014 14:24:16 +0000 (16:24 +0200)]
Fix return code of EncodeImageInternal()

It was returning 'VP8_ENC_OK' in case of memory error.

Change-Id: I184a3e29c9f1b863637cacbe389b058d75c3dbf8

6 weeks agooptimize palette ordering 49/71749/2
Pascal Massimino [Wed, 8 Oct 2014 06:42:36 +0000 (08:42 +0200)]
optimize palette ordering

We compact the palette by weighted distance, favoring the green channel.

Average gain on paletted file is ~0.5%, with gain up to 6-7% on some favorable cases.
Encoding speed is unaffected.

Disabled for alpha (or any single-channel input)

Also: always use quality=20 for EncodePalette() since it
doesn't make any real difference.

Change-Id: I19fb14316a366f139a941b45aef5663a33c905e1

6 weeks agodon't set the alpha value for histogram index image 66/71766/1
Pascal Massimino [Wed, 8 Oct 2014 06:24:19 +0000 (08:24 +0200)]
don't set the alpha value for histogram index image

This leads to tiny extra compression (~few bytes per file) for free

Change-Id: Ia4d8cef3de4365e32eacefd69a57689c80042a23

6 weeks agoadd WebPDispatchAlphaToGreen() to dsp 42/71742/1
Pascal Massimino [Mon, 6 Oct 2014 21:15:44 +0000 (23:15 +0200)]
add WebPDispatchAlphaToGreen() to dsp

SSE2 version is 2.1x faster

This is used to transfer the alpha plane to green channel before lossless compression.

Change-Id: I01d9df0051c183b1ff5d6eb69961d4f43e33141a

7 weeks agoMerge "Change Entropy based Histogram Combine heuristic."
pascal massimino [Wed, 1 Oct 2014 06:50:51 +0000 (23:50 -0700)]
Merge "Change Entropy based Histogram Combine heuristic."

7 weeks agoMerge "iosbuild: cleanup"
James Zern [Tue, 30 Sep 2014 23:26:30 +0000 (16:26 -0700)]
Merge "iosbuild: cleanup"

7 weeks agoMerge "iosbuild: output autoconf req. on failure"
James Zern [Tue, 30 Sep 2014 23:25:32 +0000 (16:25 -0700)]
Merge "iosbuild: output autoconf req. on failure"

7 weeks agoChange Entropy based Histogram Combine heuristic. 93/71693/1
Vikas Arora [Tue, 30 Sep 2014 20:40:38 +0000 (13:40 -0700)]
Change Entropy based Histogram Combine heuristic.

Don't combine the Histograms that have trivial (single valued A, R & B)
  symbols.
Following is the compression savings data along with compression time (before
& after) per image.
                     Before             After
                     bpp, rate(MP/s)    bpp, rate(MP/s)
Q=25, method = 4     2.508, 1.807       2.499, 1.916
Q=50, method = 4     2.460, 1.488       2.456, 1.512
Q=75, method = 4     2.452, 1.078       2.450, 1.092
Q=25, method = 5     2.505, 1.398       2.496, 1.383
Q=50, method = 5     2.458, 1.170       2.453, 1.143
Q=75, method = 5     2.453, 0.886       2.450, 0.855

This change provides 0.1-0.4% compression gains and speeds up the lossless
compression for the default method=4 (the drop in compression speed is between 1-3.5% for method=5).

Change-Id: Idfd88c2092f37afacd26a97097b3053f8183953a

8 weeks agofix MSVC float->int conversion warning 83/71683/1
Pascal Massimino [Sat, 27 Sep 2014 07:36:01 +0000 (00:36 -0700)]
fix MSVC float->int conversion warning

+ add a clarifying comment

Change-Id: I8ac1df1de2e5277f2d968dec489546e680bb5e0c

8 weeks agoiosbuild: cleanup 73/71673/2
James Zern [Sat, 27 Sep 2014 02:28:45 +0000 (19:28 -0700)]
iosbuild: cleanup

- s/declare -r/readonly/
- remove unnecessary build variables
- echo configure line

Change-Id: I4489d8413934dcec57d60abf136a72d08fa0fd99

8 weeks agoiosbuild: output autoconf req. on failure 72/71672/2
James Zern [Fri, 26 Sep 2014 06:44:45 +0000 (23:44 -0700)]
iosbuild: output autoconf req. on failure

Change-Id: I2a6d80cf22f5b58e80345a411c48f047fecdbb47

8 weeks agoHistoHeapInit: correct positions allocation size 80/71680/1
James Zern [Fri, 26 Sep 2014 18:21:19 +0000 (11:21 -0700)]
HistoHeapInit: correct positions allocation size

Change-Id: I1879fd48bee3aea6f0504926d7030b504dd9be07

8 weeks agolossless: entropy clustering for high qualities. 75/71675/1
Pascal Massimino [Fri, 26 Sep 2014 13:26:56 +0000 (15:26 +0200)]
lossless: entropy clustering for high qualities.

Tested on 1000 pngs corpus with quality 90-100 it gives ~0.15% improvement
in compression density and ~7% speed up.

Change-Id: I460f56c96707edb3c1f0b51a024e5122e10458df

8 weeks agofix type warning for VS9_x64 71/71671/2
Pascal Massimino [Fri, 26 Sep 2014 06:09:35 +0000 (23:09 -0700)]
fix type warning for VS9_x64

Error report was:
src\utils\color_cache.c(48) : warning C4334: '<<' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)

Change-Id: I93463ba7cd94faf1cf04986acbfaa06b62700d26

8 weeks agoiosbuild: make iOS 6 the minimum requirement 60/71660/1
James Zern [Thu, 25 Sep 2014 02:42:53 +0000 (19:42 -0700)]
iosbuild: make iOS 6 the minimum requirement

iOS 5 support isn't available in the Xcode 6 install; iOS 6 covers
phones starting at the 3GS, so should be a reasonable base line

Change-Id: Ie5603c9e30cb52114b372509e183febbf679a69a

8 weeks agoRemove unused VP8LDecoder member variable 54/71654/1
Vikas Arora [Wed, 24 Sep 2014 18:58:51 +0000 (11:58 -0700)]
Remove unused VP8LDecoder member variable

Remove the unused VP8LDecoder member variable (last_cached_)

Change-Id: I4a7d2f1b72d166efb978850e061dc69c8509e224

8 weeks agoMerge "rewrite Disto4x4 in enc_neon.c with intrinsic"
James Zern [Wed, 24 Sep 2014 17:51:47 +0000 (10:51 -0700)]
Merge "rewrite Disto4x4 in enc_neon.c with intrinsic"

2 months agoadd lossless incremental decoding support 29/71629/4
Pascal Massimino [Wed, 24 Sep 2014 07:38:52 +0000 (09:38 +0200)]
add lossless incremental decoding support

* We don't need to change DecodeAlpha, since incremental
decoding is not useful for Alpha (we already decode
progressively along the RGB)
* Similarly, we don't do incremental decoding for level>0 planes:
   the metadata don't turn into visible pixel (only the ones in level0), so...
(No visible speed change)

Change-Id: I2fd4b9ba227561a7dbede647686584b752be7baa

2 months agorewrite Disto4x4 in enc_neon.c with intrinsic 62/71462/9
Yang Zhang [Thu, 4 Sep 2014 09:20:52 +0000 (17:20 +0800)]
rewrite Disto4x4 in enc_neon.c with intrinsic

Performance test:
Platform: A9
Input data: bryce.yuv  11158x2156
performance of assembly is the base. Less ratio is better.
|toolchain |assembly |intrinsic |
|gcc4.6    |100%     |97.15%    |
|gcc4.8    |100%     |95.51     |

Change-Id: Idc2446685acdeb58a4dbdcdae533c68a83a1b879

2 months agoMIPS: dspr2: added optimization for function FilterLoop24 39/71639/2
Djordje Pesut [Fri, 19 Sep 2014 10:13:31 +0000 (12:13 +0200)]
MIPS: dspr2: added optimization for function FilterLoop24

affected functions: VFilter16i, HFilter16i, VFilter8i and HFilter8i

Change-Id: I5d2bc7716e60e048a33d630fe4a86011bfb6d42e