Commit Graph

2507 Commits

Author SHA1 Message Date
James Zern
fb3daad604 cpu: fix ssse3 check
ssse3 is bit #9 in ecx, bit 1 is sse3. this only controls the check for
slow ssse3 and likely had no ill effect.

Change-Id: I84ce73dc480e1cdbd085e37be06f3f402116c201
2017-09-29 16:27:47 -07:00
Vincent Rabaud
a5216efc8c Fix integer overflow warning.
Though the overflow could happen, it does not change the
end results.

Change-Id: I1b84e022a0776d35eab5c5c4fb7d3563f5667bfa
2017-09-25 11:02:22 +02:00
James Zern
a9c8916b87 decode.h,WebPIDecGetRGB: clarify output ptr validity
*last_y, *width, *height, *stride are only valid on non-NULL return

Change-Id: Iee2eeb29dd36392e2e7876d47df182a81dbb41ce
2017-09-22 16:58:33 -07:00
James Zern
f78da3dea6 add LOCAL_CLANG_PREREQ and avoid WORK_AROUND_GCC w/3.8+
this results in a 15-20% speedup for lossy decoding on a N5/S6/CM1

BUG=webp:339

Change-Id: Icdeb84c3e0b8908147ac276b4d8f76c3d565b735
2017-09-19 20:59:49 -07:00
James Zern
01c426f1e7 define WEBP_USE_INTRINSICS w/gcc-4.9+
32-bit builds are neutral to slightly faster using ndk r15c on a
N5/S6/CM1

BUG=webp:339

Change-Id: I94b9442e0ceaf2f5edb2b4026bc8b99cd77c918b
2017-09-19 20:59:43 -07:00
Vincent Rabaud
a80fcc4ae1 ifdef code not used by Chrome/Android.
Change-Id: Id086f6fd602b1fe3dc9034764b6a920a696ff1d2
2017-08-31 14:02:05 +02:00
Vincent Rabaud
3993af127e Fix signed integer overflows.
Change-Id: I62c9949f0edac58d69d991d6be5f85ae9e4d62a9
2017-08-31 11:56:42 +02:00
Pascal Massimino
6eba857b75 Merge "rationalize the Makefile.am" 2017-08-29 21:05:20 +00:00
Vincent Rabaud
c5e34fba66 function definition cleanup
Change-Id: I1f6bb4405f09c0c863d0bd1c77340636abdbae69
2017-08-29 14:09:35 +02:00
Pascal Massimino
3822762a6c rationalize the Makefile.am
one library addition per line, etc...

BUG=webp:355

Change-Id: I95761dea598a382db5632c5187210937e129ff75
2017-08-29 00:00:14 -07:00
James Zern
f324b7f9ba cosmetics: normalize fn proto & decl param names
BUG=webp:355

Change-Id: If020eb3b064cdb11853d1fa47058acae34752ce3
2017-08-26 14:17:31 -07:00
Vincent Rabaud
289e62a313 Remove declaration of unimplemented VP8ApplyNearLosslessPredict
Change-Id: I1bebea099a06bccfdd103ba0557320d6ad68af38
2017-08-23 17:16:29 +02:00
James Zern
34130afe8b anim_encode: fix integer overflow
calculate the file duration using unsigned math. this could still result
in an incorrect average duration calculation if there were multiple
rollovers. caching the duration is an option if it was desirable to
support such an extreme case.

Change-Id: I3875d94d081fec947c03a857055df6e27ff5351d
2017-08-18 16:52:57 -07:00
Pascal Massimino
42c79aa66b Merge "Encoder: harmonize function suffixes" 2017-08-09 18:13:57 +00:00
skal
b09307dcde Encoder: harmonize function suffixes
BUG=webp:355

Change-Id: Ia2fe95db7dfb303f3f64e390d43bc41b8933256c
2017-08-09 02:41:01 +00:00
James Zern
bed0456d58 Merge "SSIM: harmonize the function suffix" 2017-08-09 02:37:39 +00:00
skal
54f6a3cf3a lossless_sse2.c: fix some missed suffix changes
BUG=webp:355

Change-Id: If830e3169a4021899ed850aa7edfd94b81fa2cf9
2017-08-08 14:19:05 -07:00
skal
088f1dcce8 SSIM: harmonize the function suffix
BUG=webp:355

Change-Id: I751852ddb2abb7319e41e6c7d022ac4f288b4d08
2017-08-08 08:52:06 -07:00
skal
a0f72a4fe0 VP8LTransformColorFunc: drop an non-respected 'const' from the signature.
BUG=webp:355

Change-Id: Ie99bf377a55db2950bfbac9423bfe0967623ea5d
2017-08-07 19:05:01 -07:00
Pascal Massimino
8c934902cd Merge "Lossess dec: harmonize the function suffixes" 2017-08-08 02:04:10 +00:00
skal
622242aaba Lossess dec: harmonize the function suffixes
BUG=webp:355

Change-Id: I445d64df6aa2e347f41e7af306be12a77e2ac6a5
2017-08-07 18:22:41 -07:00
skal
1411f02761 Lossless Enc: harmonize the function suffixes
BUG=webp:355

Change-Id: I8baf506bd2a27095b956ef22a862b071f60c0d72
2017-08-07 18:02:07 -07:00
Vincent Rabaud
24ad2e3c99 add const to two variables
Change-Id: I97374ccbf118baa59425346ffc439036a4482bf4
2017-08-07 23:02:15 +02:00
Pascal Massimino
46efe062b8 Merge "Allow the lossless cruncher to work for alpha." 2017-08-07 21:00:02 +00:00
Vincent Rabaud
8c3f9a4706 Speed-up LZ77.
No need to look for a bigger maximum reach if we reach the end
of the image.

Change-Id: I56b166f9266f15cdff5aa59a75559972db19858f
2017-08-07 21:01:27 +02:00
Vincent Rabaud
1aef4c710b Allow the lossless cruncher to work for alpha.
Change-Id: I7185e75404fae8c739e0536026f4687d25decad7
2017-08-07 20:58:05 +02:00
Vincent Rabaud
b8821dbd81 Improve the box LZ77 speed.
For a pixel, we look for the longest match starting in a window around it.
For the following pixel, the previous result can be used and smaller
search window is used.

Change-Id: Ice16f9a7c8754099d068380848f0d77de3f756ac
2017-08-06 20:15:20 +02:00
James Zern
7beed2807b add missing ()s to macro parameters
BUG=webp:355

Change-Id: I616c6d3540d6551edd1b1cfdb5bffcf0a044c90f
2017-08-04 17:02:53 -07:00
James Zern
6473d20b3e Merge "fix Android standalone toolchain build" 2017-08-04 18:25:21 +00:00
James Zern
0c83a8bc69 Merge "yuv: harmonize suffix naming" 2017-08-02 06:35:36 +00:00
James Zern
c6d1db4b36 fix Android standalone toolchain build
add a check for cpu-features.h and rework some of the ifdef's around
android + neon. for android builds with cpu-features enabled the
*_neon.c files will still need to be flagged correctly (with e.g.,
.c.neon in Android.mk) to properly build them.

BUG=webp:353

Change-Id: I905ce305af0a204e560b915d8665093a3edaceb9
2017-08-01 22:59:03 -07:00
skal
663a6d9d2e unify the ALTERNATE_CODE flag usage
Pattern is now:
 #if !defined(FLAG)
 #define FLAG 0   // ALTERNATE_CODE
 #endif
...
 #if (FLAG == 1)
 ...
 #else
  ...
 #endif    // FLAG
...

Removed some unused code / flags:
  WEBP_YUV_USE_TABLE, WEBP_REFERENCE_IMPLEMENTATION,
  experimental code,  VP8YUVInit(), ...

BUG=webp:355

Change-Id: I98deb9189446a4cfd665c13ea8aa1ce6a308c63f
2017-08-01 20:49:29 -07:00
skal
73ea9f2702 yuv: harmonize suffix naming
BUG=webp:355

Change-Id: I403c4b3cdfc55b3b1648f98a1d189326a3e660a3
2017-08-01 20:40:00 -07:00
skal
c4568b47fd Rescaler: harmonize the suffix naming
BUG=webp:355

Change-Id: I7720502c62f96c780793d3d881eac7b3afae1418
2017-08-01 23:49:44 +00:00
Pascal Massimino
6cb13b0532 Merge "alpha_processing: harmonize the naming suffixes to be _C()" 2017-08-01 03:38:03 +00:00
James Zern
83a3e69a20 Merge "simplify WEBP_EXTERN macro" 2017-08-01 03:29:12 +00:00
Pascal Massimino
7295fde2e6 Merge "filters: harmonize the suffixes naming to _SSE2(), _C(), etc." 2017-08-01 01:55:48 +00:00
James Zern
8e42ba4c80 simplify WEBP_EXTERN macro
including the type in the macro doesn't bring much benefit to ordering,
current platforms work with a prefix, this would be insufficient if the
attribute needed to follow the function prototype. this form makes it
easier to override on the command line.

BUG=webp:355

Change-Id: Iba41ec0bb319403054be0e899c4cc472dd932fd9
2017-07-31 18:27:52 -07:00
skal
331ab34bcd cost*.c: harmonize the suffix namings
BUG=webp:355

Change-Id: Ic2e60eaab71cdffe1ebf93fc36aaa3eb25bbf08d
2017-07-31 17:18:32 -07:00
skal
b161f670f8 filters: harmonize the suffixes naming to _SSE2(), _C(), etc.
BUG=webp:355

Change-Id: I28f464eb13444c3046332cdda3c547f81700ecf4
2017-08-01 00:09:05 +00:00
skal
dec5e4d330 alpha_processing: harmonize the naming suffixes to be _C()
BUG=webp:355

Change-Id: Iae8221cd34957764ead21aa46abfc320e5514a4b
2017-07-31 23:34:24 +00:00
James Zern
92982609bc dsp.h: fix -Wundef w/__mips_dsp_rev
Change-Id: I552a543c7b039774041b43ace75b0cbea566b119
2017-07-11 16:12:32 -07:00
James Zern
88c73d8a7a backward_references_enc.h: fix WINDOW_SIZE_BITS check
this check was relocated in:
b903b80c Split cost-based backward references in its own file.

quiets -Wundef

Change-Id: I7f7a4773fb8cc77ca9f671b11f50d5db2275d415
2017-07-11 15:36:14 -07:00
James Zern
4ea49f6b82 rescaler_sse2.c: fix WEBP_RESCALER_FIX -> _RFIX typo
quiets -Wundef

Change-Id: I8f1facf401b6f1ab393005c93086ac3e2ae354d5
2017-07-11 15:35:27 -07:00
James Zern
b34a9db1a1 cosmetics,dec_sse2: remove some redundant comments
Change-Id: I5a59d6dde9b6638b318f36d51d0d53870a3de273
2017-07-06 23:19:18 -07:00
James Zern
66ad84f0f9 Merge "muxread: remove unreachable code" 2017-07-05 23:48:45 +00:00
Pascal Massimino
50ec3ab790 muxread: remove unreachable code
IDX_UNKNOWN chunks are handled separately in WebPMuxGetChunk()

Change-Id: Iaa0d3a1cd1080264c27671637551f52f71d73b07
2017-07-05 15:47:50 -07:00
hui su
7d67a1646d Lossy encoding: smoothen transparent areas to improve compression
If "exact" is false, we can modify the luma samples in fully transparent
areas to facilitate lossy compression. Experiments on some PNG images
show compression improvement of more than 20%.

Change-Id: I1a728cfa920a6652bc1f600d87c01f7f648c4942
2017-07-05 10:03:01 -07:00
James Zern
e50650c77f Merge "fix signature for DISABLE_TOKEN_BUFFER compilation" 2017-07-02 07:33:52 +00:00
Pascal Massimino
671d2567d4 fix signature for DISABLE_TOKEN_BUFFER compilation
Change-Id: Idb7aa2503c7870ef3b15a23325832428d47ae7c6
2017-07-01 14:46:28 -07:00
Vincent Rabaud
8acb4942f7 Remove the argb* files.
Half of the functionality was duplicated.
The rest is about the alpha channel handling so we
might as well put it in the appropriate file.

Change-Id: I8d5ef0afce82cc4842ab7132fd97995c42e6140a
2017-06-25 14:44:33 +02:00
Vincent Rabaud
7ca0df1363 Have the SSE2 version of PackARGB use common code.
The common code actually got sped-up by 25% by using the code
from PackARGB.

Change-Id: I94be6ccff2bfe02fff13c8e2698669e6a0d8fc74
2017-06-20 17:41:14 +02:00
Pascal Massimino
7b250459d6 Merge "Re-use the transformed image when trying several LZ77 in lossless." 2017-06-20 11:53:01 +00:00
Vincent Rabaud
e132072f0b Re-use the transformed image when trying several LZ77 in lossless.
Change-Id: If879b960131ba26859f8e4719a4c74cec1e0aaa8
2017-06-19 17:30:01 +02:00
Vincent Rabaud
5d7a50efee Get code to compile in C++.
Change-Id: I2f56e6b71e33ffecdba9e4fa9ef8f891c88f850f
2017-06-19 17:12:29 +02:00
Pascal Massimino
f1d5a397db multithread cruncher: only copy stats when picture->stats != NULL
BUG=webp:336

Change-Id: I6dfbbdcf61a6cb455f6cbf3dcd7f4c46578f42aa
2017-06-14 21:49:13 +02:00
Vincent Rabaud
f8c2ac15af Multi-thread the lossless cruncher.
BUG=webp:336

Change-Id: I8e861d6a61d51a5cdc4bbd00cd4f17d4ff006d2f
2017-06-14 16:50:36 +02:00
Vincent Rabaud
a88c6522f6 Merge "Integrate a new LZ77 looking for matches in the neighborhood of a pixel only." 2017-06-13 13:15:48 +00:00
Vincent Rabaud
8f6df1d0b9 Unroll Predictors 10, 11 and 12.
We see the following speed-ups:
10 -> 13%
11 -> 13%
12 -> 13%

Change-Id: I4734fd388d0f4e508884d0b123976bf2cbe69d2f
2017-06-08 20:37:47 +02:00
Vincent Rabaud
355c3d1bc7 Integrate a new LZ77 looking for matches in the neighborhood of a pixel only.
Change-Id: Ie2bbfee0a8d154b58f4a3068f3f634b7dad4c12d
2017-06-08 15:19:40 +02:00
Vincent Rabaud
a1779a017b Refactor LZ77 handling in preparation for a new method.
Change-Id: If305c328c8f508bd778d1af108e4eb979fbd2eca
2017-06-07 16:43:04 +02:00
Vincent Rabaud
f209a5481e Use the plane code and not the distance when computing statistics.
As backward references use the plane code when checking the cost
of a distance, statistics used to compute the cost should use it too.
This provides a small compression improvement at no speed cost.

Change-Id: Icade150929ee39ef6dc0d8b1fc85973086ecf41d
2017-06-01 17:08:43 +02:00
Vincent Rabaud
b903b80c30 Split cost-based backward references in its own file.
Change-Id: I4d8281e69b0e41f7c90337e5be70a6c65b044086
2017-06-01 16:22:31 +02:00
Vincent Rabaud
498cad34be Cosmetic changes in backward reference.
Change-Id: Ieb3dd65a647c034f67cf029e7b03f843b4650b0f
2017-06-01 14:20:16 +02:00
Vincent Rabaud
e4eb458741 lossless, VP8LTransformColor_C: make sure no overflow happens with colors.
Change-Id: Iec0d07cf1188ba96391cdb1b62131fc1469dfac6
2017-05-24 11:34:40 +02:00
Vincent Rabaud
7caef29b86 Fix typo that creeped in.
Change-Id: I600725721d9df80d6deddc65e00663649a47c941
2017-05-23 17:10:34 +02:00
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