webm/libwebp.git
19 hours agoOptimize BackwardReferenceHashChainFollowPath. 59/71959/2 master
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

2 days 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

4 days 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"

4 days 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

4 days 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 days 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 days 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 days 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 days 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

6 days 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

6 days 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

6 days 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

9 days 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

11 days 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

11 days 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

12 days 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"

12 days 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

13 days 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

2 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()"

2 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

2 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

2 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

2 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

3 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."

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

3 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"

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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"

4 weeks 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

4 weeks 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

4 weeks 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

4 weeks agoMerge "prepare VP8LDecodeImage for incremental decode"
skal [Tue, 23 Sep 2014 07:31:27 +0000 (00:31 -0700)]
Merge "prepare VP8LDecodeImage for incremental decode"

4 weeks agoMerge "MIPS: dspr2: added optimization for function FilterLoop26"
pascal massimino [Tue, 23 Sep 2014 07:17:25 +0000 (00:17 -0700)]
Merge "MIPS: dspr2: added optimization for function FilterLoop26"

4 weeks agoprepare VP8LDecodeImage for incremental decode 38/71638/1
skal [Tue, 23 Sep 2014 07:13:52 +0000 (00:13 -0700)]
prepare VP8LDecodeImage for incremental decode

- don't call VP8LClear() when there's no error (and let the caller do it)
- only initialize output once if state_ is not READ_DATA
- don't over-set dec->status_ = READ_DATA
- don't re-set dec->status_ if DecodeImageStream() fails
- remove unneeded dec->action_ field
- make ReadImageInfo() check br->eos_
- use ErrorStatusLossless() more consistently

Change-Id: Ica6e4b1c82e3fce8b1ce0274def551a886b73b0b

4 weeks agoremove br->error_ field 37/71637/1
skal [Tue, 23 Sep 2014 07:04:58 +0000 (00:04 -0700)]
remove br->error_ field

it's somewhat redundant with br->eos_

also make the status-check coherent.

Change-Id: I98e755e037d45acb0760baf2344bf11fb5fb5cda

4 weeks agoMIPS: dspr2: added optimization for function FilterLoop26 36/71636/1
Djordje Pesut [Fri, 19 Sep 2014 10:04:27 +0000 (12:04 +0200)]
MIPS: dspr2: added optimization for function FilterLoop26

affected functions: VFilter16, HFilter16, VFilter8 and HFilter8

Change-Id: Ib2fc41aaa00b10c2906d689bdc5a10f4568e70a8

4 weeks agoiobuild.sh: only install .h files in Headers 35/71635/1
James Zern [Tue, 23 Sep 2014 00:28:51 +0000 (17:28 -0700)]
iobuild.sh: only install .h files in Headers

cp * -> cp *.h; avoids picking up autoconf files

Change-Id: I57c04562d554431ddf4605af65077f32d90ac58e

4 weeks agoPremultiply with alpha during U/V downsampling 55/71555/7
skal [Fri, 19 Sep 2014 06:40:34 +0000 (23:40 -0700)]
Premultiply with alpha during U/V downsampling

This prevents the 'alpha-leak' reported in issue #220

Speed-diff is kept minimal.

Change-Id: I1976de5e6de7cfcec89a54df9233c1a6586a5846

4 weeks agogif2webp: Background color correction 12/71612/1
Urvang Joshi [Thu, 18 Sep 2014 22:07:28 +0000 (15:07 -0700)]
gif2webp: Background color correction

For some GIF images, the first frame is missing the corresponding
graphic control extension. For such cases, we were never calling
GetBackgroundColor(), and default background color value (white) was being used
incorrectly.
So, we call GetBackgroundColor() when we encounter the first image
descriptor instead, to make sure that it is always called.

Change-Id: I00fc8e943d8a0c1578dcd718f3e74dec7de4ed61

4 weeks agoAmend the lossless spec according to issue #205, #206 and #224 05/71605/1
Pascal Massimino [Thu, 18 Sep 2014 06:21:02 +0000 (08:21 +0200)]
Amend the lossless spec according to issue #205, #206 and #224

http://code.google.com/p/webp/issues/detail?id=205 <- Select()
http://code.google.com/p/webp/issues/detail?id=206 <- out-of-bound colormap index
http://code.google.com/p/webp/issues/detail?id=224 <- version number MUST be 0

Change-Id: I56a575529862dfc8ad189ddcfc47ef59a58f273d

4 weeks agoRecord the lossless size stats. 01/71601/3
Vikas Arora [Wed, 17 Sep 2014 21:11:52 +0000 (14:11 -0700)]
Record the lossless size stats.

Record and show the lossless header and image data sizes in the cwebp.

Change-Id: I08f19693cb7a756b6fdce5b55d71f5367b5f02fc

5 weeks agoAdd a WebPExtractAlpha function to dsp 72/71572/2
Pascal Massimino [Mon, 15 Sep 2014 06:11:36 +0000 (08:11 +0200)]
Add a WebPExtractAlpha function to dsp

This is the opposite of WebPDispatchAlpha

+ Implement the SSE2 version

Change-Id: I0c297309255f508c5261da8aad01f7e57f924d6c

5 weeks agofix indent after I0204949917836f74c0eb4ba5a7f4052a4797833b 57/71557/1
Pascal Massimino [Fri, 12 Sep 2014 17:59:53 +0000 (19:59 +0200)]
fix indent after I0204949917836f74c0eb4ba5a7f4052a4797833b

Change-Id: I5d9e5d0a2ad2cefd8c539571d2eaee948da60ad5

5 weeks agoOptimize lossless decoding for trivial(ARB) codes. 56/71556/1
Vikas Arora [Fri, 12 Sep 2014 16:06:35 +0000 (09:06 -0700)]
Optimize lossless decoding for trivial(ARB) codes.

Optimize the decoding for region that have trivial literal codes.
The trivial literal is defined as huffman image with Red, Blue and Alpha
huffman trees with only single code values.
This speeds up lossless decoding by 3%

Change-Id: I0204949917836f74c0eb4ba5a7f4052a4797833b

5 weeks agoMerge "webpmux: simplify InitializeConfig()"
James Zern [Fri, 12 Sep 2014 07:43:06 +0000 (00:43 -0700)]
Merge "webpmux: simplify InitializeConfig()"

5 weeks agowebpmux: simplify InitializeConfig() 54/71554/2
James Zern [Fri, 12 Sep 2014 07:03:28 +0000 (00:03 -0700)]
webpmux: simplify InitializeConfig()

put WebPMuxConfig on the stack in main() rather than allocating it in
InitializeConfig(); removes a level of indirection there.

Change-Id: I81d386f7472ebbd322dd3fdbfda9d78dbeb62a66

5 weeks agowebpmux: fix indent 53/71553/2
James Zern [Fri, 12 Sep 2014 06:53:05 +0000 (23:53 -0700)]
webpmux: fix indent

+ remove unnecessary cast

Change-Id: I2070fbe6aeda49f5790c69390e5b539a2c1a5616

5 weeks agowebpmux: fix exit status on numeric value parse error 51/71551/2
James Zern [Fri, 12 Sep 2014 06:36:12 +0000 (23:36 -0700)]
webpmux: fix exit status on numeric value parse error

in most cases 'ok' is set via a goto macro

Change-Id: I17c832446bf3e716d3bcd323dbcc72bec544029c

5 weeks agoMerge "webpmux: fix loop_count range check"
pascal massimino [Fri, 12 Sep 2014 06:02:37 +0000 (23:02 -0700)]
Merge "webpmux: fix loop_count range check"

5 weeks agoMerge "examples: warn on invalid numeric parameters"
pascal massimino [Fri, 12 Sep 2014 06:02:18 +0000 (23:02 -0700)]
Merge "examples: warn on invalid numeric parameters"

5 weeks agowebpmux: fix loop_count range check 44/71544/1
James Zern [Thu, 11 Sep 2014 22:26:11 +0000 (15:26 -0700)]
webpmux: fix loop_count range check

explicitly check [0, 65535], the use of 'long' was removed in a prior
commit

Change-Id: I70d5bf286908459b5d4d619c657853f0e833b6ea

5 weeks agoMerge "fix loop bug in DispatchAlpha()"
Pascal Massimino [Thu, 11 Sep 2014 21:48:19 +0000 (14:48 -0700)]
Merge "fix loop bug in DispatchAlpha()"

5 weeks agogif2webp: Handle frames with missing graphic control extension 43/71543/1
Urvang Joshi [Thu, 11 Sep 2014 21:35:21 +0000 (14:35 -0700)]
gif2webp: Handle frames with missing  graphic control extension

According to the GIF spec (http://www.w3.org/Graphics/GIF/spec-gif89a.txt),
this block is optional, and its scope is only the first graphic rendering block
that follows.

The spec doesn't mention what default values of frame dimensions, offsets,
duration and transparent index to use in such a case, though. So, we use the
defaults used by GIF reader in Chromium:
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageReader.h&l=186

Change-Id: Iecc6967847192483770e85ac15fe2835cd01ce7b

5 weeks agofix loop bug in DispatchAlpha() 41/71541/1
Pascal Massimino [Thu, 11 Sep 2014 20:35:08 +0000 (22:35 +0200)]
fix loop bug in DispatchAlpha()

* We were re-doing most of the work in plain-C as 'left-over'.
* we were always returning has_alpha = true because of a bad mask all_0xff

These bugs were conservative and silent, in the sense that we were 'just' doing
more work than necessary.

Now, the SSE2 version is really 2x faster than the C version.

Change-Id: I6c8132a267fe3c7a3d1fa70e7a5fcd10719543fa

5 weeks agoexamples: warn on invalid numeric parameters 27/71527/3
James Zern [Thu, 11 Sep 2014 06:35:48 +0000 (23:35 -0700)]
examples: warn on invalid numeric parameters

add ExUtilGet[U]Int / ExUtilGetFloat which print an error message on
parse failure.
fixes issue #219.

Change-Id: Ie537f5aebd138925bf1a48289b6b5e261b3af2ca

5 weeks agoMIPS: dspr2: added optimization for TransformOne 28/71528/3
Djordje Pesut [Tue, 2 Sep 2014 12:24:10 +0000 (14:24 +0200)]
MIPS: dspr2: added optimization for TransformOne

added macros for TransformOne, TransformAC3 and TransfromDC

Change-Id: I4341450f443cf46dcf91c0db17bde63c8fb8afee

5 weeks agoSSE2 for inverse Mult(ARGB)Row and ApplyAlphaMultiply 26/71526/1
Pascal Massimino [Thu, 11 Sep 2014 05:58:42 +0000 (07:58 +0200)]
SSE2 for inverse Mult(ARGB)Row and ApplyAlphaMultiply

Change-Id: Iab5c0e4a4d2b31f86736a9b277e62b6e28c3d2b4
WebPMultRow: ~7x faster
WebPMultARGBRow: ~3x faster
ApplyAlphaMultiply: 60% faster

5 weeks agoRemove default initialization of decoder status. 24/71524/1
Vikas Arora [Wed, 10 Sep 2014 21:54:20 +0000 (14:54 -0700)]
Remove default initialization of decoder status.

emove the default initialization of decoder status in the method
VP8LDecodeImage().

Change-Id: Ie6b949606349f4e937c4c1dd2c02ff2a4f86870f

6 weeks agoconfigure: simplify libpng-config invocation 16/71516/1
James Zern [Wed, 10 Sep 2014 05:55:29 +0000 (22:55 -0700)]
configure: simplify libpng-config invocation

use --ldflags over --prefix + --libs combination

based on comment in issue #180.

Change-Id: If2ca06053d5237b6722ddf4117917e5f3c06ab59

6 weeks agoRectify bug in lossless incremental decoding. 11/71511/1
Vikas Arora [Tue, 9 Sep 2014 22:30:47 +0000 (15:30 -0700)]
Rectify bug in lossless incremental decoding.

Handle the corner case when VP8LDecodeImage() method is called with an invalid
header data. The lossless decoding doesn't support incremental mode yet.
Return the error status as BITSTREAM error in case not all pixels are decoded
with the provided bit-stream. Also added asserts in the VP8LDecodeImage() method
to validate the decoder header with appropriate/valid data for huffman trees
(htree_groups_ etc).

Change-Id: Ibac9fcfc4bd0a2c5f624bb9d4a2b9f6459aa19ea

6 weeks agoMIPS: dspr2: added optimization for TransformAC3 01/71501/1
Djordje Pesut [Tue, 2 Sep 2014 12:18:51 +0000 (14:18 +0200)]
MIPS: dspr2: added optimization for TransformAC3

Change-Id: Icd789ee5f6d764297e7dc0a0f8a3bc47ab92ac65

6 weeks agoMIPS: dspr2: added optimization for TransformDC 00/71500/1
Djordje Pesut [Tue, 2 Sep 2014 12:03:13 +0000 (14:03 +0200)]
MIPS: dspr2: added optimization for TransformDC

Change-Id: Iee69758f6442ea9c80ddaa32cea8d00dda4c6252

6 weeks agoMerge "Slightly faster lossless decoding (1%)"
Pascal Massimino [Tue, 9 Sep 2014 10:55:00 +0000 (03:55 -0700)]
Merge "Slightly faster lossless decoding (1%)"

6 weeks agoSlightly faster lossless decoding (1%) 67/71467/5
Pascal Massimino [Sat, 6 Sep 2014 06:26:28 +0000 (08:26 +0200)]
Slightly faster lossless decoding (1%)

-> introduce special case 64b pattern-copy, similar to the 8b one for alpha.
-> use mempcy() for non-overlapping areas
+ cosmetics and homogenezation of the code

Change-Id: I0e65e04b96fec94c009a4614137dfba2a0f98561

6 weeks agoMIPS: dspr2: added optimization for ColorIndexInverseTransforms 43/71443/4
Djordje Pesut [Tue, 2 Sep 2014 14:34:52 +0000 (16:34 +0200)]
MIPS: dspr2: added optimization for ColorIndexInverseTransforms

Change-Id: I5b6094ce489d4f896bc4b8f575142eb3c5054beb

6 weeks agomake VP8LSetBitPos() set br->eos_ flag 83/71483/1
Pascal Massimino [Sat, 6 Sep 2014 06:40:20 +0000 (08:40 +0200)]
make VP8LSetBitPos() set br->eos_ flag

ReadSymbol() finishes with a VP8LSetBitPos() call only and could miss an eos_ during the decode loop.

Things are faster because of inlining too.

Change-Id: I2d2a275f38834ba005bc767d45c5de72d032103e

6 weeks agoLossless decoding: fix eos_ flag condition 69/71469/2
Pascal Massimino [Fri, 5 Sep 2014 18:21:17 +0000 (20:21 +0200)]
Lossless decoding: fix eos_ flag condition

eos_ needs to be set only when superfluous bits have actually
been requested.
Earlier, we were assuming pre-mature end-of-stream to be an error.
Now, more precisely, we mark error when we have encountered end-of-stream *and*
we attempt to read more bits after that.

This handles cases where image data requires no bits to be read

Change-Id: I628e2c39c64f10c443fb51f86b1f5919cc9fd299

6 weeks agofix erroneous dec->status_ setting 68/71468/1
Pascal Massimino [Fri, 5 Sep 2014 17:48:11 +0000 (19:48 +0200)]
fix erroneous dec->status_ setting

We only need to set BITSTREAM_ERROR if !ok.

Change-Id: I5bd13e64797e8bc509477edb29158abb39cb0ee1

6 weeks agoMIPS: dspr2: add some specific mips code to commit I2c3f2b12f8df15b785fad5a9c56316e95... 42/71442/1
Djordje Pesut [Thu, 4 Sep 2014 11:38:15 +0000 (13:38 +0200)]
MIPS: dspr2: add some specific mips code to commit I2c3f2b12f8df15b785fad5a9c56316e954ae0c53

added some C-code tuning also

Change-Id: I67ce70a063ef6b5821b9158a4defd6987eccbb9a

6 weeks agoMerge "further refine the COPY_PATTERN optim for DecodeAlpha"
skal [Thu, 4 Sep 2014 10:43:55 +0000 (03:43 -0700)]
Merge "further refine the COPY_PATTERN optim for DecodeAlpha"

6 weeks agoenc/histogram.c: reindent after f4059d0 33/71433/1
James Zern [Wed, 3 Sep 2014 23:58:49 +0000 (16:58 -0700)]
enc/histogram.c: reindent after f4059d0

fixes indent in HistogramRemap after:
f4059d0 Code cleanup for HistogramRemap.

Change-Id: I9f53a088749e9100a70331bda1662488666c5156

6 weeks agoMerge "~3-5% faster encoding optimizing PickBestIntra*()"
skal [Wed, 3 Sep 2014 22:53:32 +0000 (15:53 -0700)]
Merge "~3-5% faster encoding optimizing PickBestIntra*()"

6 weeks agofurther refine the COPY_PATTERN optim for DecodeAlpha 32/71432/1
skal [Wed, 3 Sep 2014 22:25:27 +0000 (00:25 +0200)]
further refine the COPY_PATTERN optim for DecodeAlpha

* use functions instead of MACRO
* adjust var's name

Overall, same speed, with more readible code

Change-Id: I2c3f2b12f8df15b785fad5a9c56316e954ae0c53

6 weeks agoadded C-level optimization for DecodeAlphaData function 04/71404/8
Djordje Pesut [Thu, 28 Aug 2014 14:53:33 +0000 (16:53 +0200)]
added C-level optimization for DecodeAlphaData function

Copies with short distances of 1,2 and 4 are specialized.

up to 10-14% faster alpha decoding.

Change-Id: I9708e98193910bfaf8ef43091f3fdea73b63896d

7 weeks agoadd a fallback to ALPHA_NO_COMPRESSION 12/71412/1
skal [Tue, 2 Sep 2014 19:55:13 +0000 (21:55 +0200)]
add a fallback to ALPHA_NO_COMPRESSION

if ALPHA_LOSSLESS_COMPRESSION produces a too big file (very rare!),
we fall-back to no-compression automatically.

Change-Id: I5f3f509c635ce43a5e7c23f5d0f0c8329a5f24b7

7 weeks ago~3-5% faster encoding optimizing PickBestIntra*() 02/71402/1
skal [Mon, 1 Sep 2014 12:05:46 +0000 (14:05 +0200)]
~3-5% faster encoding optimizing PickBestIntra*()

* Add early-out check for Intra16
* replace some memcpy() by pointer swap

Change-Id: I5edc5f7fbc8e39984deb48e6c045c97c61418589

7 weeks agoExUtilReadFromStdin: (windows) open stdin in bin mode 01/71401/1
James Zern [Sat, 30 Aug 2014 02:16:54 +0000 (19:16 -0700)]
ExUtilReadFromStdin: (windows) open stdin in bin mode

fixes input/decode from stdin in the examples

Change-Id: Ie8052da758a9ef64477501b709408236d258da82

7 weeks agowebpmux: (windows) open stdout in binary mode 00/71400/1
James Zern [Sat, 30 Aug 2014 02:11:41 +0000 (19:11 -0700)]
webpmux: (windows) open stdout in binary mode

prevents corrupt output. related to issue #217

Change-Id: I6f0dac8131127717ba72b0709fb35d421ab41acb

7 weeks agocwebp: (windows) open stdout in binary mode 99/71399/1
James Zern [Sat, 30 Aug 2014 02:11:41 +0000 (19:11 -0700)]
cwebp: (windows) open stdout in binary mode

prevents corrupt output. fixes issue #217

Change-Id: If90afb441636144300da66d64f0e7f78505b4060

7 weeks agoexample_util: add ExUtilSetBinaryMode 98/71398/1
James Zern [Sat, 30 Aug 2014 02:07:17 +0000 (19:07 -0700)]
example_util: add ExUtilSetBinaryMode

use it in dwebp when dealing with 'stdout'

Change-Id: I8b8a0b0de9e73731e913ac3c83b5e2b33c693175

7 weeks agowebpmux man page: Clarify some title, descriptions and examples 95/71395/2
Urvang Joshi [Fri, 29 Aug 2014 20:13:49 +0000 (13:13 -0700)]
webpmux man page: Clarify some title, descriptions and examples

Based on the feedback here:
https://groups.google.com/a/webmproject.org/d/msg/webp-discuss/qY6rWJLqRTY/pF8oSj8DOGYJ

Change-Id: I9119ea8e211ffb269026010e3c590385bc6a9f17

7 weeks agoaddress cosmetic comments from patch #71380 90/71390/1
skal [Fri, 29 Aug 2014 01:08:00 +0000 (18:08 -0700)]
address cosmetic comments from patch #71380

Change-Id: Iaba301b9e77aa4febe0efe1e6016fab42d5589f3

7 weeks agoSpeed up Huffman decoding for lossless 80/71380/4
skal [Thu, 28 Aug 2014 15:35:19 +0000 (08:35 -0700)]
Speed up Huffman decoding for lossless

speed-up is ~1.6% for photographic image to 10% for graphical image
(1000 images corpus was sped up by 5.8 %)

Code by akramarz@google.com and jyrki@google.com

Change-Id: Iceb2e50e6cc761b9315a3865d22ec9d19b8011c6

7 weeks agodsp/lossless: workaround gcc-4.9 bug on arm 79/71379/2
James Zern [Fri, 18 Jul 2014 00:48:42 +0000 (17:48 -0700)]
dsp/lossless: workaround gcc-4.9 bug on arm

force Sub3() to not be inlined, otherwise the code in Select() will be
incorrect.
https://android-review.googlesource.com/#/c/102511

Change-Id: I90ae58bf3e6cc92ca9897f69974733d562e29aaf

7 weeks agodsp.h: collect gcc/clang version test macros 78/71378/1
James Zern [Thu, 28 Aug 2014 02:33:09 +0000 (19:33 -0700)]
dsp.h: collect gcc/clang version test macros

endian_inl.h already relies on dsp.h, grab the definitions from there.

Change-Id: I445f7d0631723043c55da1070498f89965bec7b1

7 weeks agomove static initialization of WebPYUV444Converters[] to the Init function. 70/71370/2
skal [Wed, 27 Aug 2014 14:55:34 +0000 (07:55 -0700)]
move static initialization of WebPYUV444Converters[] to the Init function.

Split initialization of YUV444Converters[] out of Upsamplers init.

update test for NULL function pointers

Change-Id: I9603f54250f90c85a12ffbecfd6c59e9b06c47e0

7 weeks agoMerge "fix indentation"
skal [Wed, 27 Aug 2014 14:52:36 +0000 (07:52 -0700)]
Merge "fix indentation"

8 weeks agoCode cleanup for HistogramRemap. 63/71363/1
Vikas Arora [Tue, 26 Aug 2014 22:44:04 +0000 (15:44 -0700)]
Code cleanup for HistogramRemap.

Avoid call to HistogramAddThresh when there's only one Histogram image.
Change-Id: I43b09e8e2d218c95969567034224777dcce37ab9

8 weeks agofix indentation 54/71354/2
skal [Tue, 26 Aug 2014 06:52:09 +0000 (23:52 -0700)]
fix indentation

Change-Id: I2294a6c83e5f345f64bd5120b91532e00ed6c543

8 weeks agoMerge "add a DispatchAlpha() for SSE2 that handles 8 pixels at a time"
skal [Tue, 26 Aug 2014 05:43:42 +0000 (22:43 -0700)]
Merge "add a DispatchAlpha() for SSE2 that handles 8 pixels at a time"

8 weeks agoadd a DispatchAlpha() for SSE2 that handles 8 pixels at a time 51/71351/2
skal [Tue, 26 Aug 2014 03:55:28 +0000 (20:55 -0700)]
add a DispatchAlpha() for SSE2 that handles 8 pixels at a time

Only slightly faster.

Change-Id: Ie2e57e6a0950166124cf1075c6c9b45b7abdad8c

8 weeks agointroduce VP8EncQuantize2Blocks to quantize two blocks at a time 42/71342/2
skal [Mon, 25 Aug 2014 20:16:14 +0000 (13:16 -0700)]
introduce VP8EncQuantize2Blocks to quantize two blocks at a time

No speed diff for now. We might reorder better the instructions later,
to speed things up.

Change-Id: I1949525a0b329c7fd861b8dbea7db4b23d37709c