Commit Graph

2391 Commits

Author SHA1 Message Date
Vincent Rabaud
39e19f927c Merge "near lossless: fix unsigned int overflow warnings." 2017-05-23 14:47:47 +00:00
Vincent Rabaud
9bbc0891c6 near lossless: fix unsigned int overflow warnings.
Change-Id: Ic1111a66761b5821cbbea1c91b038b2327dd20b5
2017-05-23 13:43:08 +02:00
James Zern
b588729740 cosmetics,FindClosestDiscretized: use uint in mask creation
Change-Id: Ib1edd74be1c051c10cfe2defadbea48cabe15135
2017-05-22 08:21:44 -07:00
James Zern
f1784aee04 near_lossless,FindClosestDiscretized: use unsigned ops
quiets undefined sanitizer warnings of the form:
left shift of 128 by 24 places cannot be represented in type 'int'

Change-Id: I8a389f2ac9238513517180f302f759425eeb7262
2017-05-22 03:11:03 -07:00
hui su
972104b34b webpmux: tolerate false positive Alpha flag
Change-Id: I390aebdda31f5320e83b7d7012735947a234650b
2017-05-19 11:26:37 -07:00
Vincent Rabaud
defc98d72c Doc: clarify the role of quality in WebPConfig.
Change-Id: I13706847f6263b9bb91eaf3c9284dd2d42ea7a85
2017-05-15 18:01:35 +02:00
Pascal Massimino
faf42213f4 NEON: implement ConvertRGB24ToY/BGR24/ARGB/RGBA32ToUV/ARGBToUV
Change-Id: Ie68aaed36d17f56d998c1b284514860cf5d28b8a
2017-05-09 15:57:20 +02:00
Vincent Rabaud
e644c556c5 Fix bad bit writer initialization.
When re-initializing a bit writer, we could set invalid values because
the bit writer was not big enough.

Change-Id: Id25ab6712603245a5a12d5f4a86fe35a9a799a5d
2017-05-02 18:59:01 +02:00
Pascal Massimino
b62cdad287 Merge "Implement a cruncher for lossless at method 6." 2017-04-28 14:37:57 +00:00
skal
da3e4dfb6f use the exact constant for the gamma transfer function
As found in BT2020 reference:
https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2020-2-201510-I!!PDF-E.pdf

The difference in output-size/PSNR are under the noise level.

Change-Id: I42c12000b61dca791226f3af772c5bd9d58201b8
2017-04-27 11:53:15 -07:00
Vincent Rabaud
adab8ce020 Implement a cruncher for lossless at method 6.
Go over the whole compression step for each of the
transforms and pick the best one.

Change-Id: I3a1b1458348c468558be0fcf491038a5724c9364
2017-04-27 18:16:04 +02:00
Vincent Rabaud
0dcd85b6c4 Fix VP8ApplyNearLossless to respect const and stride.
Change-Id: I94a90220b5a175228fc48a4b299847b60cf5081b
2017-04-25 19:04:52 +02:00
Pascal Massimino
f768218966 yuv: rationalize the C/SSE2 function naming
+ implement some easy missing targets in SSE2 (565/4444)

Change-Id: Ib575f7ada2a0ed7309cddd238f8bfc0e8999f145
2017-04-21 13:52:25 +02:00
Pascal Massimino
52245424b0 NEON implementation of some Sharp-YUV420 functions
Change-Id: I449ef9c76b06f971f6e2ad7f9db96bf906d8fe1f
new-file: dsp/yuv_neon.c
2017-04-18 19:22:37 +02:00
Vincent Rabaud
690efd82f8 Avoid several backward reference copies.
An extra VP8LBackwardRefs struct is used but it was used internally anyway.

Change-Id: Ifcb36ce42b8c21ef3c7a1daf38cb7f714687fcb2
2017-04-14 15:34:50 +02:00
hui su
4bb1f607d7 src/dec/vp8_dec.h, cosmetics: fix comments
Change-Id: If076cdf63965bad9b00cbe19c922320638b65f46
2017-04-07 15:29:57 -07:00
James Zern
78fd199c3b backward_references_enc.c: clear -Wshadow warnings
index -> position

similar to: 2f5e8934 remove -Wshadow warnings

Change-Id: Ieaf8363d726a8fdf4e799845a81364e1dfae438a
2017-03-22 23:52:19 -07:00
James Zern
ae836410bb WebPLog2FloorC: clear -Wshadow warning
log -> log_value

Change-Id: Iae7cea7e0875e59b0806de41eb0b58815307495e
2017-03-22 23:50:31 -07:00
Pascal Massimino
c08adb6fbc Merge "VP8LEnc: remove use of BitsLog2Ceiling()" 2017-03-20 13:12:19 +00:00
Pascal Massimino
28c37ebd5a VP8LEnc: remove use of BitsLog2Ceiling()
was only used once. Better fall back for Log2Floor.

Change-Id: Ibcc26505440971bffe62ba6aca3d179ca85791d4
2017-03-20 02:58:16 -07:00
Pascal Massimino
bb175a935e Merge "rename some symbols clashing with MSVC headers" 2017-03-16 17:53:37 +00:00
Vincent Rabaud
39eda6584f Remove a duplicated pixel hash implementation.
Change-Id: If0df61add2fdf404f9baf0820ca83faa50f2791c
2017-03-16 16:15:40 +01:00
Pascal Massimino
36b8274deb rename some symbols clashing with MSVC headers
This is to prepare the inclusion of <windows.h>

FrameRect => FrameRectangle
CLIP_MASK => CLIP_8b_MASK

Change-Id: Ia4b1fa4ac06137b4102c91e232206a1fb7159ce0
2017-03-16 10:42:00 +01:00
James Zern
976adac1ce Merge "lossless incremental decoding: fix missing eos_ test" 2017-03-01 02:54:13 +00:00
Pascal Massimino
f8fad4fac1 lossless incremental decoding: fix missing eos_ test
The patch  21735e0 introduced a bug where a goto path was not testing
the eos_ state.  If this happened just before a row_sync, a SaveState()
would be called that would store the eos_ state as '1' till the end
of the loop.  This usually was not a problem, except for the very last
chunk where we disable the incremental decoding altogether (we have all
the data). The termination tests were then going wrong.
The fix is to add a proper eos_ test and avoid falling in this inconsistent
state.

(21735e06f7)

BUG=webp:332

Change-Id: Ib16773aee26bfd068fbf4e9db3d2313bd978b269
2017-02-28 15:17:33 -08:00
Vincent Rabaud
6f75a51b58 Analyze the transform entropy on the whole image.
The first column was skipped before.

Change-Id: I11521a6a48288d771e8fb83869fda08753f0fbcb
2017-02-28 15:48:59 +01:00
Vincent Rabaud
a5e4e3aff1 Use palette only if we can in entropy analysis.
Change-Id: I2be74b4d5fe48e059d5ced619d76fd030db79f74
2017-02-28 11:43:13 +01:00
Vincent Rabaud
75a9c3c452 Improve compression by better entropy analysis.
Change-Id: I6b56ca8d7d9a046a581baa0e85504136685d1161
2017-02-27 21:58:22 +01:00
Vincent Rabaud
7d985bd1d0 Fix small entropy analysis bug.
Change-Id: I70554b5a898b38930dfd03ca1ed78a075261e84b
2017-02-24 13:38:41 +01:00
Vincent Rabaud
6e7caf06ee Optimize the color cache size.
Before, the color cache size was chosen optimally for LZ77 and
the same value was used for RLE. Now, we optimize its value
taking both LZ77 and RLE into account.

Unfortunately, that comes with a small CPU hit.

Change-Id: I6261f04af78cf0784bb8e8fc4b4af5f566a0e071
2017-02-23 18:20:00 +01:00
Vincent Rabaud
833c92198c More efficient stochastic histogram merge.
Between each iteration we keep track of the previously found
potential merge hence less work to do.

Change-Id: I2b6237447e79443516a6111727d96c24f10bd98a
2017-02-23 14:35:33 +01:00
Vincent Rabaud
5183326ba8 Refactor the greedy histogram merge.
This is preparatory work for an upcoming commit.
No impact on speed or compression.

Change-Id: I62488ae6d2dbb5398f1604068c212ab8e26e82bc
2017-02-22 15:47:47 +01:00
Pascal Massimino
99f6f462f5 Merge "histogram_enc.c,MyRand: s/ul/u/ for unsigned constants" 2017-02-22 06:29:40 +00:00
James Zern
80a2218668 ssim.c: remove dead include
Change-Id: Ia4be534b3b95d5d9f712ff53e530c98b942df860
2017-02-21 20:17:19 -08:00
James Zern
a128dfff51 histogram_enc.c,MyRand: s/ul/u/ for unsigned constants
this is more consistent with the rest of the code base

Change-Id: Ifcf5d2729b2ebf32ffa12017db0106166829c77e
2017-02-21 20:12:17 -08:00
Pascal Massimino
693bf74ec0 move the SSIM calculation code in ssim.c / ssim_sse2.c
Change-Id: I63a63fa7f44f257f2e17e45358b206c23069c448
2017-02-21 12:53:35 +01:00
Vincent Rabaud
10d791ca70 Merge "Fix the random generator in HistogramCombineStochastic." 2017-02-19 10:11:48 +00:00
Vincent Rabaud
fa63a96603 Fix the random generator in HistogramCombineStochastic.
It was a bad implementation of a Lehmer random number generator
(the saturation was done wrong and mostly & was used instead of % .....).

That lead to "for" loop stuck with the same values given a specific seed,
hence wasted "for" loops (e.g. seed getting at 374988608 and modulo of 64
later leads to 0 even when updating the seed with the old formula).

As the "for" loops now always return a proper pair of histograms, their
number can greatly be reduced, hence a speedup.

Change-Id: I9f5b44d66cc96fd4824189d92276c3756c8ead5b
2017-02-19 10:49:16 +01:00
skal
16be192f47 VP8LSetBitPos: remove the eos_ setting
This code is ultra-critical for lossless decoding, especially on ARM.
The extra call VP8LIsEndOfStream() was causing unnecessary slow-down.

Now, we check for bitstream-end separately in the main loop.

Change-Id: I739b5d74cc29578e2b712ba99b544fd995ef0e0d
2017-02-11 02:35:02 -08:00
Pascal Massimino
4105d565d3 disable WEBP_USE_XXX optimisations when EMSCRIPTEN is defined
Currently, none are available. If WEBP_HAVE_SSE2 eventually works,
we'll have to refine this conditionals.

BUG=webp:261

Change-Id: Ibc63ee1c013f2a4169eeb85cc8b6317b6420c2ad
2017-02-08 15:44:20 +00:00
Vincent Rabaud
868aa6901f Perform greedy histogram merge in a unified way.
Previously, the stochastic method for histogram
combination could finish in a greedy way
if the number of iterations to perform so was smaller.

Except that another greedy combination was performed
afterwards ... hence wasted CPU in some cases.

Change-Id: Ic0f26873e6dc746679486b91cb35d73efee91931
2017-02-07 11:57:20 +01:00
Pascal Massimino
b494fdec45 optimize the ARGB->ARGB Import to use memcpy
(instead of the generic VP8PackARGB call)

Change-Id: I86edeb5934e7c062593f0248de7607cca5f1027c
2017-02-03 16:54:52 +01:00
Vincent Rabaud
5cfd4ebc5e LZ77 interval speedups. Faster, smaller, simpler.
The initial re-writing of this part of the code with intervals
had to be done with a complex logic (mostly intervals with a
lower and upper bound, not a constant value like now) to properly
deal with the inefficiencies of the then LZ77 algorithm.
The improvements made to LZ77 since, now allow for a simpler logic.

There were also small errors in the interval insertion logic
that lead to small inefficiencies (hence a slightly better
compression rate).

Change-Id: If079a0cafaae7be8e3f253485d9015a7177cf973
2017-02-02 11:51:30 +01:00
Pascal Massimino
be73378684 Merge "Add clang build fix for MSA" 2017-02-01 12:43:09 +00:00
Parag Salasakar
aa893914fc Add clang build fix for MSA
Change-Id: If139f4ecbdce756c69ba4ae032a70f81179683f8
2017-02-01 17:45:17 +05:30
Jehan
32ed856f60 Fix "all|no frames are keyframes" settings.
Documentation says: "if kmin == 0, then key-frame insertion is disabled;
and if kmax == 0, then all frames will be key-frames."
Reading this, you'd expect that if kmax == 0, then with any kmin <= 0
all frames will be key-frames. But actually the kmin <= 0 test is caught
first and you get the opposite (no keyframes but the first). You'd have
instead to set kmax == 0 and any value kmin > 0, which is absolutely
counter-intuitive (reversing order).
Moreover kmax == 1 has no valid kmin (kmin == 1 conflicts with the
`kmax > kmin` rule and kmin == 0 conflicts with `kmin >= kmax / 2 + 1`).
So it should be considered an exception too.

Instead I propose this new logic:
- kmax == 1 means that all frames are keyframes (you are explicitly
  requesting a keyframe every 1 frame at most, i.e. all frames).
- kmax == 0 means no keyframes (you ask for a keyframe every 0 frames,
  i.e. never).
This is more "logical" language-wise, and also does not involve any
conflicts about what if both kmax and kmin are 0, since now a single
property value is meaningful for the 2 exceptional cases.

Change-Id: Ia90fb963bc26904ff078d2e4ef9f74b22b13a0fd
(cherry picked from commit 2dc0bdcaee)
2017-01-26 22:31:16 -08:00
James Zern
1c3190b6ed Merge "Fix "all|no frames are keyframes" settings." 2017-01-27 00:02:04 +00:00
Pascal Massimino
f4dc56fd77 disable GradientUnfilter_NEON
Compile with XCode, it appears quite slower than the C-version,
especially for arm64.

Change-Id: Ic46dba184a36be454fef674129d2f909003788fc
(cherry picked from commit 4f3e3bbd44)
2017-01-25 20:30:15 -08:00
Pascal Massimino
4f3e3bbd44 disable GradientUnfilter_NEON
Compile with XCode, it appears quite slower than the C-version,
especially for arm64.

Change-Id: Ic46dba184a36be454fef674129d2f909003788fc
2017-01-25 16:33:26 -08:00
Jehan
2dc0bdcaee Fix "all|no frames are keyframes" settings.
Documentation says: "if kmin == 0, then key-frame insertion is disabled;
and if kmax == 0, then all frames will be key-frames."
Reading this, you'd expect that if kmax == 0, then with any kmin <= 0
all frames will be key-frames. But actually the kmin <= 0 test is caught
first and you get the opposite (no keyframes but the first). You'd have
instead to set kmax == 0 and any value kmin > 0, which is absolutely
counter-intuitive (reversing order).
Moreover kmax == 1 has no valid kmin (kmin == 1 conflicts with the
`kmax > kmin` rule and kmin == 0 conflicts with `kmin >= kmax / 2 + 1`).
So it should be considered an exception too.

Instead I propose this new logic:
- kmax == 1 means that all frames are keyframes (you are explicitly
  requesting a keyframe every 1 frame at most, i.e. all frames).
- kmax == 0 means no keyframes (you ask for a keyframe every 0 frames,
  i.e. never).
This is more "logical" language-wise, and also does not involve any
conflicts about what if both kmax and kmin are 0, since now a single
property value is meaningful for the 2 exceptional cases.

Change-Id: Ia90fb963bc26904ff078d2e4ef9f74b22b13a0fd
2017-01-25 13:12:52 -08:00