Commit Graph

2877 Commits

Author SHA1 Message Date
James Zern
748e92bbb9 add WebPInt32ToMem
and use it in calls containing _mm_cvtsi32_si128; this calls
WebPUint32ToMem, but corrects the type to avoid runtime warnings with
clang -fsanitize=integer of the form:

implicit conversion from type 'int' of value -1904123502 (32-bit,
signed) to type 'uint32_t' (aka 'unsigned int') changed the value to
2390843794 (32-bit, unsigned)

Bug: b/229626362
Change-Id: I20545e822d8045fa44f688241879206055a0a148
2022-08-01 13:44:20 -07:00
James Zern
4f402f34a1 add WebPMemToInt32
and use it with calls to _mm_cvtsi32_si128 and _mm_set_epi32; this calls
WebPMemToUint32, but corrects the type to avoid runtime warnings with
clang -fsanitize=integer of the form:

implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
2155905152 (32-bit, unsigned) to type 'int' changed the value to
-2139062144 (32-bit, signed)

Bug: b/229626362
Change-Id: I50101ba2b46dfaa852f02d46830f3511c80b02d9
2022-07-28 22:10:22 -07:00
James Zern
84163d9d02 lossless: fix crunch mode w/WEBP_REDUCE_SIZE
WEBP_REDUCE_SIZE was introduced to bring down the library size by
removing cropping and scaling support. Previously WebPPictureView() was
only used with these two, but in
  ec178f2c Add progress hook granularity in lossless
an additional use was added in VP8LEncodeStream() when extra side
configurations are used in crunch mode (-mt, quality == 100 & method ==
6 or quality >= 75 & method == 5 with a palette present currently).

WebPPictureView() and, for coherency, WebPPictureIsView() are
restored in this configuration to avoid affecting the general encode
path.

Previously WebPPictureView() was assumed to always succeed in these
cases which could result in crashes with WEBP_REDUCE_SIZE defined.

Bug: chromium:1345547
Bug: chromium:1345595
Bug: chromium:1345772
Bug: chromium:1345804
Change-Id: Ifecde36a726a434510478a764514b1469942c684
2022-07-20 22:04:34 -07:00
James Zern
56a480e80c dsp/cpu.h: add missing extern "C"
fixes linking of tests/fuzzer/animencoder_fuzzer on windows

Change-Id: I0bd14b0e8c7ecb261e861689c25cd4b7fdaecbfd
2022-07-08 15:44:39 -07:00
James Zern
34b1dc336d bump version to 1.2.3
libwebp{,decoder} - 1.2.3
libwebp libtool - 8.4.1
libwebpdecoder libtool - 4.4.1

mux - 1.2.3
libtool - 3.4.0

demux - 1.2.3
libtool - 2.10.0

Bug: webp:568
Change-Id: I943bae1b7eacb445f6a4e13123e63170ac8bb142
2022-06-30 19:30:31 -07:00
James Zern
e15b356014 add WEBP_MSAN
and use it to suppress a false positive related to data that passes
through RGBA32PackedToPlanar_16b_SSE41(). Current versions (tested with
clang 13.0.1, using -O0 and the build from oss-fuzz of enc_dec_fuzzer)
model shuffles incorrectly reporting use of uninitialized
data related to the alpha change that's removed when converting to YUV.
valgrind behaves correctly, however.

Bug: webp:573
Change-Id: If76997668dcdd436adf280a2e6dcffba766a2875
2022-06-14 21:49:46 -07:00
Maryla Ustarroz-Calonge
20ef48f05a Merge "sharpyuv: add support for 10/12/16 bit rgb and 10/12 bit yuv." into main 2022-05-24 11:05:08 +00:00
Maryla
93c5437115 sharpyuv: add support for 10/12/16 bit rgb and 10/12 bit yuv.
10bit+ input is truncated to 10bits for now.

Change-Id: I7ac00ca54c623d94c76ccd8954418e11095997d2
2022-05-23 20:48:44 +02:00
James Zern
53cf2b4997 normalize WebPValidatePicture declaration w/definition
quiets a warning under visual studio:
src\enc\picture_enc.c(48) : warning C4028: formal parameter 1 different
from declaration

Change-Id: Ic3affbbb0e22ac8c43fa183e13506eee72e180dc
2022-05-17 09:46:51 -07:00
Vincent Rabaud
30453ea4e6 Add an internal WebPValidatePicture.
Change-Id: Ia01bd3975f7bd0d47eb0a1764807baed16f0d268
2022-05-16 17:37:20 +02:00
Vincent Rabaud
6c43219a5f Some renamings for consistency.
- pic->picture in public header
- match implementation to declaration in PictureImport, WebPPictureRescale, WebpBlendAlpha

Change-Id: Ibf3771af22d671bba6fd657684add618c6f32978
2022-05-16 17:33:49 +02:00
Vincent Rabaud
6c45cef7ff Make sure the stride has a minimum value in the importer.
Bug: webp:569
Change-Id: Ia48d064dbb10e7179ae3da04ca8d769d1c447276
2022-05-10 10:18:46 +02:00
Maryla
0c8b0e67a4 sharpyuv: cleanup/cosmetic changes
Remove unused constants.
Use ALL_CAPS for defines and kCamelCase for static const values.
Change some defines into static constants if they are not used in array sizes.

Change-Id: I036b0f99215fd0414a33f099bd6b809ff8ee4541
2022-05-09 15:10:14 +02:00
James Zern
dc3841e077 {histogram,predictor}_enc: quiet int -> float warnings
after:
a19a25bb Replace doubles by floats in lossless misc cost estimations.

Change-Id: Idc5888b40ce5b591b72c6e51a188a9ab8c5d9823
2022-04-20 10:10:27 -07:00
Vincent Rabaud
a19a25bb03 Replace doubles by floats in lossless misc cost estimations.
Doubles are slower and use more RAM for no benefit.

Change-Id: I05b313576f9b33388c7c39d7fed8de84170c3753
2022-04-17 21:07:54 +02:00
brianpl@google.com
779597d443 demux,IsValidExtendedFormat: remove unused variable
quiets -Wunused-but-set-variable

frame_count has been unused in this function since:
ab714b8a demux, Frame: remove is_fragment_ field

Change-Id: Ie6afda915c6b82736e05e7490eba0165c3dd37e4
2022-04-08 15:28:05 -07:00
Maryla Ustarroz-Calonge
40e8aa57f8 Merge "libsharpyuv: add colorspace utilities" into main 2022-04-08 09:06:23 +00:00
Maryla
01a05de1a7 libsharpyuv: add colorspace utilities
Change-Id: I620c8593dc81f39e747de5ed354332adb7278bed
2022-04-08 10:07:22 +02:00
James Zern
2de4b05a56 Merge changes Id9890a60,I376d81e6,I1c958838 into main
* changes:
  GetBackwardReferences: fail on alloc error
  BackwardReferencesHashChainDistanceOnly: fix segfault on OOM
  VP8LEncodeStream: fix segfault on OOM
2022-04-06 20:04:25 +00:00
Pascal Massimino
e8e77b9c47 Merge changes I479bc487,I39864691,I5d486c2c,I186d13be into main
* changes:
  mux{edit,internal}: fix leaks on error
  ExUtilInitCommandLineArguments: fix leak on error
  anim_util: fix leaks on error
  gif2webp: fix segfault on OOM
2022-04-05 05:51:53 +00:00
James Zern
10c5084842 normalize label indent
1 space is most common in the source; this fixes some mixed cases within
lossless files, likely from clang-format

Change-Id: I504206d5bf418781d4131ee73570ecee4e0a69a1
2022-04-04 12:47:41 -07:00
James Zern
89f774e61d mux{edit,internal}: fix leaks on error
several calls to ChunkSetHead() were unchecked, causing the chunk to
leak should the call fail due to OOM

Tested:
for i in `seq 1 1125`; do
  export MALLOC_FAIL_AT=$i
  ./examples/gif2webp gif_file
  ./examples/gif2webp -mixed gif_file
done
for i in `seq 1 171`; do
  export MALLOC_FAIL_AT=$i
  ./examples/img2webp jpeg_file -o /dev/null
  ./examples/img2webp -mixed jpeg_file -o /dev/null
done

Change-Id: I479bc487f61b493e5ce033872d353007055c172a
2022-04-04 11:26:25 -07:00
James Zern
e3cfafaf71 GetBackwardReferences: fail on alloc error
previously failures in the call to
VP8LBackwardReferencesTraceBackwards() would be ignored which, though it
wouldn't result in a crash, would produce non-deterministic output

Change-Id: Id9890a60883c3270ec75e968506d46eea32b76d4
2022-04-04 11:24:06 -07:00
James Zern
a828a59b49 BackwardReferencesHashChainDistanceOnly: fix segfault on OOM
change CostManager to calloc to avoid frees on undefined pointer
values in CostManagerClear() should the cost_model allocation succeed,
but the cost_manager allocation fail

since:
v0.5.0-93-g3e023c17 Speed-up BackwardReferencesHashChainDistanceOnly.

Tested:
for i in `seq 1 639`; do
  export MALLOC_FAIL_AT=$i
  ./examples/cwebp -m 6 -q 100 -lossless jpeg_file
done

Bug: webp:565
Change-Id: I376d81e6f41eb73529053e9e30c142b4b4f6b45b
2022-04-04 11:23:39 -07:00
James Zern
fe153fae98 VP8LEncodeStream: fix segfault on OOM
initialize bw_side before calling EncoderAnalyze() & EncoderInit() which
may fail; previously this would cause a free of an invalid pointer in
VP8LBitWriterWipeOut().

since at least:
v0.6.0-120-gf8c2ac15 Multi-thread the lossless cruncher.

Tested:
for i in `seq 1 639`; do
  export MALLOC_FAIL_AT=$i
  ./examples/cwebp -m 6 -q 100 -lossless jpeg_file
done

Bug: webp:565
Change-Id: I1c95883834b6e4b13aee890568ce3bad0f4266f0
2022-04-04 11:21:30 -07:00
Maryla
841960b670 Make libsharpyuv self-contained by removing dependency on cpu.c
Change-Id: I2edac1afa38bfddf2a91e7829e38425bd3519feb
2022-03-30 15:04:35 +02:00
Maryla
7a68afaac5 Let SharpArgbToYuv caller pass in an RGB>YUV conversion matrix.
Change-Id: I4ed2dfc00ce63361abd49c693f31f307e0b0262f
2022-03-24 16:37:47 +01:00
James Zern
5ccbd6ed8c vp8l_dec.c,cosmetics: fix a few typos
Change-Id: Ia2906883e7d19bd96f355b4ade98d29ac2efe8cc
2022-03-14 10:15:31 -07:00
Maryla Ustarroz-Calonge
d0d2292e1a Merge "Make libwebp depend on libsharpyuv." into main 2022-03-07 09:34:37 +00:00
James Zern
03d1219055 alpha_processing_neon.c: fix 0x01... typo
one instance was overlong leading to a int64->uint32 conversion warning

Change-Id: I56d5ab75d89960c79293f62cd489d7ab519bbc34
2022-03-04 15:26:21 -08:00
Maryla
d55d447c9a Make libwebp depend on libsharpyuv.
Change-Id: I6d8ebfe1f855024fc0694b1aa584f71fa27b83ae
2022-03-04 11:35:03 +01:00
Vincent Rabaud
e4cbcdd2b5 Fix lossless encoding for MIPS.
Bug: webp:558
Change-Id: I3d3ddb64ed26a8d8ff5664664c5f20f6eadfeb4f
2022-03-01 14:01:49 +01:00
James Zern
924e7ca654 alpha_processing_neon.c: fix Dispatch/ExtractAlpha_NEON
the trailing width % 8 bytes would clear the upper bytes of
alpha_mask as they're done one at a time

since:
49d0280d NEON: implement several alpha-processing functions

Change-Id: Iff76c0af3094597285a6aa6ed032b345f9856aae
2022-02-28 13:57:23 -08:00
Maryla
29cc95ce4c Basic version of libsharpyuv in libwebp, in C.
It's self contained apart from a dependency on src/webp/types.h and src/dsp/cpu.h
For now it's only set up as an internal library, not an installable one.
Webp doesn't depend on it yet, the code is only duplicated.

Change-Id: I752799894f9d4105d0d296ddebd9f9641181a1ec
2022-02-18 14:52:44 +00:00
James Zern
b9d2f9cd3b quant_enc.c: use WEBP_RESTRICT qualifier
results in code layout changes, a couple fewer instructions; some of the
smaller functions were unaffected as they were inlined, but are updated
for consistency. this mostly affects VP8Decimate(), ReconstructIntra16()
and ReconstructUV().

Change-Id: Icc2582278987a66ad1110bab683d1e0c21e6591a
2022-02-10 11:07:18 -08:00
Yannis Guyon
ec178f2c7f Add progress hook granularity in lossless
A WebPPicture instance is necessary to call WebPReportProgress() which
sets WebPPicture::error_code so as well use WebPEncodingSetError() to
record errors too, instead of functions returning a WebPEncodingError.
However there must be one WebPPicture instance per thread, with error
codes merged at sync time. A mutex could simplify that but it is not
the objective of this change.

https://groups.google.com/a/webmproject.org/g/webp-discuss/c/yOiP8APubgc/m/vCTvxl6ODgAJ

Change-Id: Ia1a8f9d1199202e1c88484ce719b0180a80447ce
2022-02-07 11:00:09 +01:00
Yannis Guyon
26139c7398 Rename MAX_COST to MAX_BIT_COST in histogram_enc.c
To differentiate it with the one in vp8i_enc.h

Change-Id: If4ecc40246cb1c6e42a2ae77328966c4069d441c
2022-02-03 09:57:30 +01:00
James Zern
6f49654024 libwebp-1.2.2
- 1/11/2022: version 1.2.2
   This is a binary compatible release.
   * webpmux: add "-set bgcolor A,R,G,B"
   * add ARM64 NEON support for MSVC builds (#539)
   * fix duplicate include error in Xcode when using multiple XCFrameworks in a
     project (#542)
   * doc updates and bug fixes (#538, #544, #548, #550)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEaw5rcJdt4wPt8vYB+cPWvbgjK10FAmHoy90ACgkQ+cPWvbgj
 K10DLg/7BS8mjKMJGkH1HD3PT12K54H9a9BReD2lPMfUTmclLbLktwG9/cn8pHG1
 xTTJp7HQWr5d0VEkv2X2XZYIAdAb+6FICdFDp+J26jqErZU62LLK2Gq0gWs+bRNE
 36u8Q0qyJdt2BAdDgfUEBHZeAz+uevp1u5YVCg05u3FcBejLEGx6Bc+fvIrk5Al9
 C1zjbP7kFRVE/6OEGFc/jLHGfzTHhfgIW0GDUIKav/x9/cjkqjcC34Uwgz6/y4+K
 C6HAzfHfgiKUzDpwTYC9HkpulKhuIfMF4wTytaIfyoYXMScbKRWq989NW6a7ctGv
 1+nOh//37RRf2gXnGFW2eXGD1vFdXwLSm04AXzpXIE1o9jQzII3akw6vQX4gGE0d
 n3X0GUjpvAkgPH1P1/qF5qZSKuBSLlfYYAbdZNNoUvKCviF/zOj2A0T19727OdnV
 EtXvL6Yd9B7E+Uu15FyoCeJYiGwFFEJSTC1fhMnGPgiLa0JN/7QD4Q9RFg/O45Q3
 e3DvYv7x6sg83MJipWNh7BTXhcX9Q0zNXmySAwuM53g+hhtkVliojZV4+7vzdO/0
 /aVfNAErAtPNUPofDUOIj9qrbx+PvLCeiI5lhFWs1sBWtSdU7XNnewzzYJKJAexp
 HMbwpVM0KnMbX7D3VzT8mo11M5KYQGbzIjaM1DzqiaobLSVmVs8=
 =HlsB
 -----END PGP SIGNATURE-----

Merge tag 'v1.2.2'

libwebp-1.2.2

- 1/11/2022: version 1.2.2
  This is a binary compatible release.
  * webpmux: add "-set bgcolor A,R,G,B"
  * add ARM64 NEON support for MSVC builds (#539)
  * fix duplicate include error in Xcode when using multiple XCFrameworks in a
    project (#542)
  * doc updates and bug fixes (#538, #544, #548, #550)

* tag 'v1.2.2':
  update ChangeLog
  libwebp: Fix VP8EncTokenLoop() progress
  BMP enc: fix the transparency case
  libwebp: do not destroy jpeg codec twice on error
  update ChangeLog
  update NEWS
  man/img2webp.1: update date
  Reword img2webp synopsis command line
  anim_decode: fix alpha blending with big-endian
  webpinfo: fix fourcc comparison w/big-endian
  update ChangeLog
  update NEWS
  bump version to 1.2.2
  update AUTHORS

Bug: webp:541, b/202302177
Change-Id: Iae875b6ec3084157837cc774c94088ca72e8dd91
2022-01-20 10:17:37 -08:00
James Zern
4074acf873 dsp.h: bump msvc arm64 version requirement to 16.6
there was a bug in 16.4 causing compile failures with vtbl4_u8():

src\dsp\lossless_neon.c(105): error C2143: syntax error: missing ')'
before '{'
src\dsp\lossless_neon.c(105): error C2168: 'neon_tbl2_q8': too few
actual parameters for intrinsic function

https://developercommunity.visualstudio.com/t/cannot-compile-arm64-neon-vtbl4-u8-function-in-c-f/859331

Change-Id: I87c21850b3c597aa5cb41a8105b81e2135a9f890
2022-01-19 21:49:59 -08:00
Yannis Guyon
6db8248c01 libwebp: Fix VP8EncTokenLoop() progress
Encoding the image found in the user bug report below would result in
a progress rising up to 173% because of the extra 20% caused by each
of the 4 extra lossy passes. It happened at methods 3 to 6.

https://groups.google.com/a/webmproject.org/g/webp-discuss/c/yOiP8APubgc/m/FP3r5X2rDAAJ

Change-Id: I95318d0dc4df546044eb926c786c04bb7f915cbe
(cherry picked from commit db25f1b4ed)
2022-01-19 18:07:42 +00:00
Yannis Guyon
db25f1b4ed libwebp: Fix VP8EncTokenLoop() progress
Encoding the image found in the user bug report below would result in
a progress rising up to 173% because of the extra 20% caused by each
of the 4 extra lossy passes. It happened at methods 3 to 6.

https://groups.google.com/a/webmproject.org/g/webp-discuss/c/yOiP8APubgc/m/FP3r5X2rDAAJ

Change-Id: I95318d0dc4df546044eb926c786c04bb7f915cbe
2022-01-18 21:12:11 +00:00
James Zern
f084244d9f anim_decode: fix alpha blending with big-endian
images are decoded in RGBA/BGRA, but represented as uint32_t during the
blend process; this fixes the channel extraction

Bug: webp:548
Change-Id: Ie74aa43d8f87d3552d5afc0abba466335f5d1617
(cherry picked from commit e4886716d3)
2021-12-23 14:49:14 +00:00
James Zern
e4886716d3 anim_decode: fix alpha blending with big-endian
images are decoded in RGBA/BGRA, but represented as uint32_t during the
blend process; this fixes the channel extraction

Bug: webp:548
Change-Id: Ie74aa43d8f87d3552d5afc0abba466335f5d1617
2021-12-22 17:03:58 -08:00
James Zern
973390b618 bump version to 1.2.2
libwebp{,decoder} - 1.2.2
libwebp libtool - 8.3.1
libwebpdecoder libtool - 4.3.1

mux - 1.2.2
libtool - 3.8.0

demux - 1.2.2
libtool - 2.9.0

Bug: webp:541
Change-Id: Ia9adda28f0320714335156552d0f5b563e1babb6
2021-12-14 19:58:29 -08:00
jzern@google.com
02ca04c348 add missing USE_{MSA,NEON} checks in headers
msa_macro.h
neon.h

allows the headers to be built / analyzed under different target
configurations

Change-Id: Ibbcfada210b54988aa5279674d53af8e21fd4a97
2021-12-14 22:21:57 +00:00
James Zern
b6f756e82b update http links
- prefer https

- metadataworkinggroup.org/com seem to be offline; the web archive link
  was obtained from exiftool: https://exiftool.org/TagNames/MWG.html

- fix kramdown link, rubyforge has been gone a long time

- fix png/zlib links

Bug: webp:544
Bug: b/202302177
Change-Id: Id69de4553e7baf00393f12a2c1acb262443a1a93
2021-11-23 10:13:40 -08:00
James Zern
8f5cb4c18e update rfc links
to https://datatracker.ietf.org/doc/html/... the http tools.ietf.org
links redirect here sometimes, in other cases they 404.

Bug: webp:544
Change-Id: I900972070d6c5659c45a86a89e78b870f42fe5bc
2021-11-17 11:03:35 -08:00
Pascal Massimino
8ea81561d2 change VP8LPredictorFunc signature to avoid reading 'left'
... when it's not available. Even if the value was discarded and
never used, some msan config were complaining about reading it
and passing it around.

Change-Id: Iab8d24676c5bb58e607a829121e36c2862da397c
2021-11-05 16:22:31 +01:00
James Zern
e23cd5481c dsp.h: enable NEON w/VS2019+ ARM64 targets
Visual Studio added ARM64 support, but requires arm64_neon.h to be
included rather than arm_neon.h. Visual Studio 2019 addressed this so
we'll start with that version and leave a local adapter include for a
follow up.

Bug: webp:539
Change-Id: If975c029dafffba99210b3bb2d670035a83e8105
2021-09-13 19:56:19 -07:00
Vincent Rabaud
1a8f0d45d3 Have a hard-coded value for memset in TrellisQuantizeBlock.
Change-Id: I1b842bb0cfec9e8559d0f11b3db8fa1bc1c9692f
2021-08-30 18:50:11 +02:00
Vincent Rabaud
934801604e Speed up TrellisQuantizeBlock
- only initialize variable when needed
- perform first loop outside the for loop
- perform computation only if know we are not already worse
- not adding base_score every time

Change-Id: I2cb8231fcaec1113b5902ed61b685f0ae3c78823
2021-08-30 17:07:42 +02:00
James Zern
53b6f76209 fix indent
after:
277d3074 Fix size_t overflow in  WebPRescalerInit

Change-Id: I9adf7f01f28ddd54305512762e2ed28713282966
(cherry picked from commit d2caaba435)
2021-07-28 20:22:18 +00:00
James Zern
d250f01d95 dsp/*: use WEBP_HAVE_* to determine Init availability
after:
  ece18e55 dsp.h: respect --disable-sse2/sse4.1/neon
WEBP_USE_* will be set when a module is targeting a particular
instruction set, e.g., sse4.1, and not overridden if WEBP_HAVE_SSE41 is
set, as previously this would ignore the case where the instruction set
was disabled via config.h and the HAVE macro was unset.

dsp.h not ensures WEBP_HAVE_* are set when WEBP_USE_* to cover cases
where the files are built without config.h.

Change-Id: Ia1c2dcf4100cc1081d968acb6e085e2a1768ece6
(cherry picked from commit 1fe3162541)
2021-07-26 20:44:58 +00:00
James Zern
b2bc809346 bump version to 1.2.1
libwebp{,decoder} - 1.2.1
libwebp libtool - 8.2.1
libwebpdecoder libtool - 4.2.1

mux - 1.2.1
libtool - 3.7.0

demux - 1.2.1
libtool - 2.8.0

Bug: webp:521
Change-Id: I098e3e9df698baa275dea85315b9136e565e9971
2021-07-20 18:12:24 -07:00
James Zern
ece18e5520 dsp.h: respect --disable-sse2/sse4.1/neon
previously this would be overridden if the instruction set was enabled
via -msse4.1, __aarch64__, etc.

Change-Id: I51e87a7da7589c6093d260b848ab41d89ec7b990
2021-07-17 12:14:38 -07:00
James Zern
8f5946634e alpha_processing: fix visual studio warnings
similar to '* const', __restrict needs to be included in the
declaration to avoid warnings like:
src\dsp\alpha_processing.c(429): warning C4028: formal parameter 1
different from declaration

this change also moves WEBP_RESTRICT to dsp.h to avoid a circular
dependency between it and utils.h which already includes dsp.h

Change-Id: Ib070d358a372e76fae4be5445ab288940b9baac0
2021-07-13 23:41:45 +00:00
James Zern
a1e5dae0f0 alpha_processing*: use WEBP_RESTRICT qualifier
this helps both auto-vectorization in the C code and the optimized code
generation

Change-Id: Ide570d6be45125ffef7248bdc40e9eb08f00e832
2021-07-07 15:39:21 -07:00
Pascal Massimino
e1a8d4f3fe Merge "bit_reader_inl_utils: uniformly apply WEBP_RESTRICT" into main 2021-06-28 23:19:21 +00:00
Skal
4de35f4383 rescaler.c: fix alignment
Change-Id: Ifc2d0d301280baaa403fcdf8722fce42d28a1853
2021-06-28 11:08:50 +02:00
James Zern
0f13eec7bf bit_reader_inl_utils: uniformly apply WEBP_RESTRICT
this can help with some aliasing issues with some versions of clang/gcc,
similar to:
3e265136 Add WEBP_RESTRICT & use it in VP8BitReader

Change-Id: I863e53cc9d707c9a4b21373ca743c3089aed012e
2021-06-26 10:53:01 -07:00
Skal
277d30749f Fix size_t overflow in WebPRescalerInit
we need to surface potential error up, so lot of signature changes.

Change-Id: I7c11a46c4542564d06417203cd1158754e30a9e4
2021-06-25 14:54:42 -07:00
James Zern
72fe52f623 anim_encode.c,cosmetics: normalize indent
Change-Id: Iba33a60850ec481b73b7eccb67492e7f1dd3d10e
2021-06-23 15:14:04 -07:00
James Zern
116d235c30 anim_encode: Fix encoded_frames_[] overflow
Check encoded_frames_ count and call FlushFrames if necessary after
IncreasePreviousDuration. Avoids an overflow in encoded_frames_[] with
-kmax 0 and an assertion failure related to the previous and keyframe
durations when a frame is forced in this way.

Based on patch by tomwei7g <at> gmail

Bug: webp:518
Change-Id: Idef685e6c06a67d48fcdc048265ca0e672a01263
2021-06-23 15:13:43 -07:00
James Zern
b1cf887f86 define WEBP_RESTRICT for MSVC
__restrict is supported:
https://docs.microsoft.com/en-us/cpp/cpp/extension-restrict?view=msvc-160

+ add a comment and simplify the __restrict__ check, clang defines
__GNUC__

Change-Id: I76d8d3cbd1b730f492c6fc0b2114f1897886b677
2021-06-18 19:30:38 -07:00
Clement Courbet
3e26513656 Add WEBP_RESTRICT & use it in VP8BitReader
Marking the `VP8BitReader` as `__restrict__` helps the compiler generate
better code avoiding issues related to aliasing (re-loads/stores).

Change-Id: Ib7178f57e27e5f40572efc3e567cdf994ea6d928
2021-06-18 19:28:54 -07:00
James Zern
f6d2924757 vp8l_dec::ProcessRows: fix int overflow in multiply
use 64-bit math in calculating the offsets as they may exceed 32-bits
when scaling

Bug: chromium:1196850
Change-Id: I6a484fc4dded6f6c4b82346ef145eb69c1477b3c
2021-06-16 10:50:44 -07:00
James Zern
4edea4a695 Init{RGB,YUV}Rescaler: fix a few more int overflows
promote out_width to size_t before multiplying

src/dec/io_dec.c:301:30: runtime error: signed integer overflow: 2 *
1224167500 cannot be represented in type 'int'
  #0 0x55fd9e8de2bd in InitYUVRescaler src/dec/io_dec.c:301:30
  #1 0x55fd9e8de2bd in CustomSetup src/dec/io_dec.c:571:54

Bug: chromium:1196850
Change-Id: I70d0aac1b5eef163a3f353b721fb9ab561e02040
2021-06-14 12:22:28 -07:00
James Zern
c9e26bdb35 rescaler_utils: set max valid scaled w/h to INT_MAX/2
this will avoid the potential for some integer overflows in rescaler
calculations

Bug: chromium:1196850
Change-Id: Iaa09f5d6b888b39aaeb2154d470279620362d6eb
2021-06-14 12:22:28 -07:00
James Zern
28d488e6f1 utils.h: add SizeOverflow()
this normalizes the 'size != (size_t)size' checks in the libraries.

Change-Id: I1e8ccd0d3697266f23911ecf0f7a546f011befde
2021-06-14 12:22:28 -07:00
James Zern
695bdaa2f6 Export/EmitRescaledRowsRGBA: fix pointer offset int overflow
in Export increment the dst pointer, but in EmitRescaledRowsRGBA use
64-bit math as the number of output lines is variable and may still
overflow when incrementing.

Bug: chromium:1196850
Change-Id: I5c65b875894ee9da0fef1e24d27e507171800c4a
2021-06-14 12:22:21 -07:00
jzern@google.com
685d073ee1 Init{RGB,YUV}Rescaler: fix int overflows in multiplication
with large sizes the intermediate calculations may exceed 32-bits

src/dec/io_dec.c:491:17: runtime error: signed integer overflow: 3 *
788529152 cannot be represented in type 'int'
  #0 0x557a3ad972b2 in InitRGBRescaler src/dec/io_dec.c:491:17
  #1 0x557a3ad972b2 in CustomSetup src/dec/io_dec.c:563:29

Bug: chromium:1196850
Change-Id: Iaf2e8a6de9481dfea31dcd7fccb2d4eca767bddf
2021-06-10 15:26:44 -07:00
jzern@google.com
d38bd0dda0 WebPFlipBuffer: fix integer overflow
with large scale values the offset to the end of the buffer may exceed
32-bits range.

src/dec/buffer_dec.c:158:39: runtime error: signed integer overflow: 2 *
1275068416 cannot be represented in type 'int'
  #0 0x56444802bea5 in WebPFlipBuffer src/dec/buffer_dec.c:158:39

Bug: chromium:1196850
Change-Id: I08c8b69ada5d5dd3e9bf2b9006dffa0c5f2103a5
2021-06-10 15:26:34 -07:00
James Zern
109ff0f100 utils: allow MALLOC_LIMIT to indicate a max
in addition to checking the environment for "MALLOC_LIMIT"; the
environment will still take precedence.
this is in preparation for adding extreme config value coverage to
advanced_api_fuzzer

Bug: chromium:1196850
Change-Id: Ibe22f5e39e030a422fd6e383269bde35252d3fae
2021-06-07 18:59:39 -07:00
James Zern
a2fce86744 WebPRescalerImportRowExpand_C: promote some vals before multiply
avoids integer overflow in extreme cases:
src/dsp/rescaler.c:45:32: runtime error: signed integer overflow: 129 *
16777215 cannot be represented in type 'int'
    #0 0x556bde3538e3 in WebPRescalerImportRowExpand_C src/dsp/rescaler.c:45:32
    #1 0x556bde357465 in RescalerImportRowExpand_SSE2 src/dsp/rescaler_sse2.c:56:5
    ...

Bug: chromium:1196850
Change-Id: I4f923807f106713e113f3eec62a1d1c346066345
2021-06-07 18:59:33 -07:00
James Zern
776983d427 AllocateBuffer: fix int multiplication overflow check
after the check using 64-bit math we used a signed integer in the
multiplication. previously unsigned integer max was tested.

fixes cases like:
src/dec/buffer_dec.c:108:16: runtime error: signed integer overflow:
944731466 * 4 cannot be represented in type 'int'
    #0 0x55e56187dc1d in AllocateBuffer src/dec/buffer_dec.c:108:16
    #1 0x55e56187dc1d in WebPAllocateDecBuffer src/dec/buffer_dec.c:216:12
    ...

Bug: chromium:1196850
Change-Id: I6e5b3e5d1d5b50b5c98c39bbf9813a63fedc5ca7
2021-06-07 18:59:24 -07:00
James Zern
315abbd60b Merge "Revert "Do not use a palette for one color images."" 2021-05-24 18:53:42 +00:00
James Zern
1f5791398c cosmetics: remove use of 'sanity' / 'master'
replace with more inclusive terms or remove the comment entirely if the
meaning was already clear.

Bug: webp:507
Change-Id: Ica3bbf751ebf79f6668df6e6209af770248ff4ca
2021-05-21 10:38:40 -07:00
James Zern
29b6129c78 WebPAnimEncoderNewInternal: remove some unnecessary inits
enc is allocated with WebPSafeCalloc so there's no need to clear the
pointers afterward.
this has the side-effect of removing a non-inclusive term.

Bug: webp:507
Change-Id: I82f82954936638c4c15d33b2d6f0497a6a13571f
2021-05-21 10:31:50 -07:00
James Zern
b60869a18e Revert "Do not use a palette for one color images."
This reverts commit b6513fbaa8.

This change can produce files that can cause decode failures in some
versions of chrome and safari/ios/macos.

https://chromium-review.googlesource.com/c/chromium/src/+/2876279

The chrome fix will be available in M92. This change can be revisited
after it and the mac updates are more widely deployed.

Bug: b/186640109,b/188702956
Change-Id: I296b8fe88c6c48219e3edf532226c4f972f1605b
2021-05-21 10:26:37 -07:00
James Zern
6fb4cddc93 demux: move padded size calc post unpadded validation
though the max chunk/payload sizes were checked and would fail the
padded size was being calculated beforehand which could result in a
(harmless) unsigned int overflow warning.

Bug: webp:508
Change-Id: I4fa30ded2b027c1577b03049a2deeb7bf75e5472
2021-05-15 10:59:06 -07:00
James Zern
05b72d4205 vp8l_enc.c: normalize index types
fixes conversion warnings in visual studio after:
b1674240 Add modified Zeng's method to palette sorting.

src\enc\vp8l_enc.c(296) : warning C4244: '=' : conversion from 'const
uint16_t' to 'uint8_t', possible loss of data
src\enc\vp8l_enc.c(299) : warning C4244: '=' : conversion from 'const
uint16_t' to 'uint8_t', possible loss of data

Change-Id: I981b1ba4912edbbafbd49f1f5b1043bf12266920
2021-04-28 15:09:34 -07:00
Vincent Rabaud
b6513fbaa8 Do not use a palette for one color images.
1 color images now always take 30 bytes.

Change-Id: Ifa86bc5320362c659672b3836160353d63576467
2021-04-28 13:14:28 +02:00
Vincent Rabaud
98bbe35b51 Fix multi-threading with palettes.
Change-Id: Ifa23378c1f9c489d5963b4928781e104a14eb01a
2021-04-27 16:54:03 +02:00
Vincent Rabaud
b1674240f9 Add modified Zeng's method to palette sorting.
Also add palette sorting to crunch configurations.

Change-Id: I010a8bf8f1921279db6e9c7209307d8d19a4d105
2021-04-27 13:11:18 +02:00
James Zern
6a9916d734 WebPRescalerInit: add missing int64_t promotion
large values of x_add and y_add may rollover an int causing a later
assertion to fail in WebPRescalerExportRow due to fxy_scale incorrectly
being set to 0.

fixes:
src/dsp/rescaler.c:178: void WebPRescalerExportRow(WebPRescaler *const):
Assertion `wrk->src_height == wrk->dst_height && wrk->x_add == 1'
failed.

Bug: chromium:1196480
Change-Id: I2c00f015d61a1257033d8edb1edd4d060d6878b7
2021-04-23 11:46:45 -07:00
James Zern
b6cf52d5b8 WebPIoInitFromOptions: treat use_scaling as a bool
this matches the description in WebPDecoderOptions and prevents a
mismatch between the user supplied options and the ones used by io.

Bug: chromium:1196773, chromium:1196775, chromium:1196480
Change-Id: I3603b806884cfc6969b093d06b7980b0cc13199b
2021-04-23 11:46:45 -07:00
James Zern
3b12b7f4b4 WebPIoInitFromOptions: treat use_cropping as a bool
this matches the description in WebPDecoderOptions and prevents a
mismatch between the user supplied options and the ones used by io.

Bug: chromium:1196480
Change-Id: Id464f999d737078078f9d21afe25b349317f5ab4
2021-04-23 11:46:45 -07:00
James Zern
595fa13f83 add WebPCheckCropDimensions()
and avoid integer overflow in test of x/width and y/height parameters
against the image width/height

Bug: chromium:1196778, chromium:1196777, chromium:1196480
Change-Id: I7b8f1f4dbebfe073b1ba260b8317979488655dcc
2021-04-23 11:46:45 -07:00
Vincent Rabaud
8fdaecb09d Disable cross-color when palette is used.
With palette+predictors, cross-color was forced (because of predictors).
No need for cross-color for palettes as R/B==0.
This saves 10 bytes per image that uses palette+predictors.

Change-Id: If2184d16cdabe1e8498009062284ad3e37ef1342
2021-04-23 17:43:36 +02:00
James Zern
8933bac212 WebPIoInitFromOptions: respect incoming bypass_filtering val
if bypass_filtering was set to 1 in the user provided options it
shouldn't be reset in the use_scaling pass even if the image satisfies
the scaling requirements.

Change-Id: I036029907886acb63748872d5f8763954a7c607b
2021-04-19 19:02:13 -07:00
James Zern
5d4ee4c3c0 cosmetics: remove use of the term 'dummy'
this is replaced with more inclusive / informative text

Bug: webp:507
Change-Id: Ib77f0c79dd548601bf2bc3169985af4b5edf0a62
2021-03-15 11:39:06 -07:00
Ilya Kurdyukov
01b38ee19a faster CollectColorXXXTransforms_SSE41
3/4% faster overall.

Change-Id: If555c5530238ca0342b8d97b0d708b1bdc888d3f
2021-02-19 20:45:07 +01:00
Pascal Massimino
652aa34424 Merge "Use BitCtz for FastSLog2Slow_C" 2021-02-19 17:39:30 +00:00
Skal
0320e1e36f add the missing default BitsCtz() code
Change-Id: Iff3ea946a380837b9dfad58350173b68b45e1347
2021-02-19 17:04:35 +00:00
Ilya Kurdyukov
8886f620c0 Use BitCtz for FastSLog2Slow_C
Change-Id: Icc6068b8934e481e6f17efd30616392e68d504ad
2021-02-19 15:11:42 +01:00
Ilya Kurdyukov
fae416179e faster CombinedShannonEntropy_SSE2
optimized for sparse histograms

Change-Id: I54412f5f8fc53d2598964a5be91f6c54ece3f21b
2021-02-19 13:14:46 +01:00
Ilya Kurdyukov
5bd2704e30 Introduce the BitCtz() function.
* Use a WEBP_HAVE_SLOW_CLZ_CTZ flag when they are slow (LUT-based).

Change-Id: If707c121b8800438be404594a39bb123ef25b0f0
2021-02-19 11:52:05 +01:00
James Zern
33ddb894b1 lossless_sse{2,41}: remove some unneeded includes
Change-Id: Icd2cffd32b39c6bf017eee353ac04a4b6d337a11
2021-02-18 10:54:09 -08:00
Pascal Massimino
b78494a933 Merge "Fix undefined signed shift." 2021-02-18 16:51:17 +00:00
Vincent Rabaud
e79974cd6a Fix undefined signed shift.
Using the fix from SSE2.

Change-Id: Ie53d0163d97322da5a722c3e49f9d5f057ee1d91
2021-02-18 16:56:22 +01:00
Ilya Kurdyukov
a885339448 SSE4.1 versions of BGRA to RGB/BGR color-space conversions
Change-Id: Iacafd2f6402080b02fcbf75831e69c488f447454
2021-02-18 15:32:30 +01:00
Ilya Kurdyukov
a09a647241 SSE4.1 version of TransformColorInverse
Change-Id: I6ba5cb35917eef7a52152c4924eca205b4af7220
2021-02-18 12:42:39 +01:00
Skal
06c1e72e71 Code cleanup
* match param names

Change-Id: Ib75197a3c6bcc735049c6724dce6c240684108ae
2021-02-10 22:14:45 +01:00
James Zern
9c367bc602 WebPAnimDecoderNewInternal: validate bitstream before alloc
this avoids large allocations with corrupt files due to the canvas size

BUG=oss-fuzz:28658

Change-Id: Idd1957e5447a2dadaef1fadaf68820fcb29f045a
2021-02-05 13:01:27 -08:00
James Zern
47f64f6edd filters_sse2: import Chromium change
VerticalUnfilter_SSE2 has long been disabled due to a crash in an
Android emulator that hasn't reproduced elsewhere (crbug.com/654974).
this synchronizes the code for now to avoid needing to locally edit the
file on import.

Bug: 1141126
Change-Id: Ib61aeab93caaff1759606566b9e499eaac1576cf
2021-01-30 11:44:07 -08:00
James Zern
8599571935 disable CombinedShannonEntropy_SSE2 on x86
this function produces different results from the C code due to
use of double/float resulting in output differences when compared to
-noasm.

Bug: webp:499
Change-Id: Ia039b168c0a66da723fb434656657ba1948db8ae
2021-01-18 16:41:44 -08:00
James Zern
28c4982064 bump version to 1.2.0
libwebp{,decoder} - 1.2.0
libwebp libtool - 8.1.1
libwebpdecoder libtool - 4.1.1

mux - 1.2.0
libtool - 3.6.0

demux - 1.1.0
libtool - 2.7.0

Bug: webp:484
Change-Id: I458940f407515e0d95d20bbfd670ee29255c12eb
2020-12-23 19:54:29 -08:00
James Zern
7363dff25c webp/encode.h: restore WEBP_ENCODER_ABI_VERSION to v1.1.0
this was missed in:
f9b30586 fix ABI breakage introduced by 6a0ff358

Bug: webp:484
Change-Id: I64c9e5d1113209727f1ede467316549b4f2ad116
2020-12-23 19:50:03 -08:00
Pascal Massimino
2e7bed7925 WebPPicture: clarify the ownership of user-owned data.
It's explicitly safe (and recommended!) to plug external data into
the pic->y/u/v/argb fields. They are guaranteed to be preserved
by the encoding process if no conversion is needed.

Change-Id: I325ca41a6a834f7f028431c605dddef67e9542cc
2020-12-14 12:28:52 +01:00
James Zern
ae54553461 dsp.h: allow config.h to override MSVC SIMD autodetection
this fixes builds with cmake targeting visual studio that set
-DWEBP_ENABLE_SIMD=0

BUG=webp:478

Change-Id: I21b61b112c79ff9cbab9e4502a25d3f1fa096c8b
2020-12-03 10:22:04 -08:00
Vincent Rabaud
fc14fc038b Have C encoding predictors use decoding predictors.
libwebp.a in Release mode with no symbols size in bytes:
986430 -> 975114  (-1.1%)

Change-Id: Ia96192a6be2911779e359b72132bdba60b60a13d
2020-12-02 11:54:59 +01:00
Pascal Massimino
988b02abfd Merge "Couple of fixes to allow SIMD on Emscripten" 2020-11-20 08:18:41 +00:00
Ingvar Stepanyan
52273943c6 Couple of fixes to allow SIMD on Emscripten
- Add `-msimd128` to flags to actually enable WebAssembly SIMD
   when performing SIMD detection. It's currently required in
   addition to `-msse*` / `-mfpu=neon` flags which only perform
   translation of corresponding intrinsics to Wasm SIMD ones.
   See a discussion at emscripten-core/emscripten#12714 for
   automating this and making easier in the future.
 - Remove compilation branch that prevented definitions of
   `WEBP_USE_SSE` and `WEBP_USE_NEON` on Emscripten even when
   SIMD support was detected at compile-time.
 - Add an implementation of `VP8GetCPUInfo` for Emscripten which
   uses static `WEBP_USE_*` flags to determine if a corresponding
   SIMD instruction is supported. This is because Wasm doesn't
   have proper feature detection (yet) and requires making separate
   build for SIMD version anyway.

Change-Id: I77592081b91fd0e4cbc9242f5600ce905184f506
2020-11-18 21:51:41 +00:00
Pascal Massimino
8870ba7f06 Fix skia bug #10952
The offset *can* be negative, but the sanitizer reports strange
address behaviour when row_offset is unsigned size_t.

For safety, use int64_t instead (probably overkill. int32_t is probably ok).

Change-Id: I1bd424bfdb5447b3839f40679581d6bdea075320
2020-11-18 14:59:34 +01:00
Wan-Teh Chang
4b3c6953ef Detect if StoreFrame read more than anmf_payload_size bytes
After ParseAnimationFrame() calls StoreFrame(), check if StoreFrame() reads
more than anmf_payload_size bytes from dmux->mem_. Treat that as PARSE_ERROR.

Change-Id: I0d03885c19d32792af78de7bed1a944ca01f1dc6
2020-11-17 07:57:24 +01:00
James Zern
17fd4ba820 webp/decode.h,cosmetics: normalize 'flip' comment
have it match the other boolean options with 'if true...'

Change-Id: I5a3e7c17b35a21fc5146ecaf10e226486a2dc740
2020-10-29 16:00:44 -07:00
James Zern
411d3677ca remove some unreachable break statements
following a goto.
+ enable -Wunreachable-code-aggressive if available

Change-Id: I0312800d84d8984dbc51925600ed5d7d438413fd
2020-10-26 18:45:24 -07:00
James Zern
3700ffd7e1 WebPPictureHasTransparency: remove unreachable return
Change-Id: Ia8077918b5110fb7fc74f326d4d16b38d9ed1b38
2020-10-26 15:52:20 -07:00
James Zern
64425a0884 picture_tools_enc: fix windows build warning
with WebPReplaceTransparentPixels() function signature:

src\enc\picture_tools_enc.c(86): warning C4028: formal parameter 1
different from declaration

Change-Id: I0140d61b0dfebcbb4189707e8f2f4b1af802a4d7
2020-10-14 13:13:53 -07:00
James Zern
cf847cba58 use WEBP_DSP_INIT_FUNC for Init{GammaTables*,GetCoeffs}
this provides stronger synchronization when pthreads are available as
was done in 'd77bf512 add WEBP_DSP_INIT / WEBP_DSP_INIT_FUNC' for the
other init functions.

Change-Id: I2ffe4e24454d276c2411ece34dca38d23d4756d5
2020-09-11 11:57:51 -07:00
Skal
55a080e50a Add WebPReplaceTransparentPixels() in dsp
with SSE2 implementation.

(Extracted from side experiment)

Change-Id: I62d457fb6643645291cffd6d2d205d4a5ffa4517
2020-09-09 08:15:22 +02:00
Vincent Rabaud
cf2f88b38f Add palette and spatial for q >= 75 and -m 5
Change-Id: I12198b7eb82a4247e606bc60342595abf4d6eee0
2020-06-17 12:51:40 +02:00
Vincent Rabaud
f0110baec0 Add no-color cache configuration to the cruncher
Fix another pessimization found by the pingo image compressor.

Refactoring is necessary to make LZ77 computation
common to cache or no-cache analysis.
Slower by 1.7x instead of 2x

Change-Id: I396701ea6e88543dbfe9471eb552877f6c8ce1e3
2020-06-09 19:04:44 +02:00
Vincent Rabaud
749a8b99f7 Better estimate of the cache cost.
Change-Id: I171a8f80f1597bbdeb724957e789b947df3c2885
2020-06-05 16:07:58 +02:00
Vincent Rabaud
4f9f00ccf4 Use spatial predictors on top of palette no matter what.
This is fixing another inefficiency found by the pingo image optimizer.

Change-Id: Icecb0d39fcbd17b403667e8e2095c7705b1dd493
2020-06-04 18:03:57 +02:00
Vincent Rabaud
7658c68613 Add spatial prediction on top of palette in cruncher.
Change-Id: I3765ab628ef915eedf2e541a80c65ce9880dff36
2020-06-04 14:38:08 +02:00
Vincent Rabaud
e3c259a278 Fix integer overflow in EmitFancyRGB.
+ enhance the assert in WebPCopyPlane()

Change-Id: Id9b01d00a8dce6caf0d4721a6fbe8def40b8bb85
2020-05-05 14:57:19 +02:00
Pascal Massimino
f9b30586eb fix ABI breakage introduced by 6a0ff358
qmin / qmax are now using the pad[] spot at the end of the struct,
 and we don't need to bump the ABI major number.

Change-Id: I41adcaf1600b29a5a05c9fe380bfd977cf425124
2020-04-21 19:17:56 +00:00
Yannis Guyon
47309ef52d webp: WEBP_OFFSET_PTR()
Removes undefined behavior of offsetting NULL.

Change-Id: I7c83d0c913c631c091a5fb128f6d6b46b1d116db
2020-03-20 11:39:06 +01:00
James Zern
687ab00e6e DC{4,8,16}_NEON: replace vmovl w/vaddl
4/8/16 fewer instructions

Change-Id: I38fe08722e7b839e3f3e0bf4df7e0fa8e7a0138f
2020-03-05 09:41:14 -08:00
James Zern
1b92fe75a1 DC16_NEON,aarch64: use vaddlv
saves 3 instructions, neutral to mildly faster on a pixel 3a

Change-Id: I6ae57e8e38d4149167ea14e27cd2b32113b4f8e7
2020-03-04 23:12:20 -08:00
James Zern
53f3d8cf7e dec_neon,DC8_NEON: use vaddlv instead of movl+vaddv
one fewer instruction

Change-Id: I2f599fd6f9eebbb0cab81ae9855244fc401d4323
2020-03-04 15:46:38 -08:00
Yannis Guyon
27d082403c Fix integer overflow in WebPAnimDecoderGetNext()
Change-Id: Ic53263b6125ca125d5fb3791474eab78043fec18
2020-02-27 20:23:37 +01:00
Skal
a99078c1cf remove call to MBAnalyzeBestIntra4Mode for method >= 5
this was not giving a good alpha value, making the method 5/6 a little
blurrier than method 4 (!).

Change-Id: I69b9890dea21499c1af1753e87d9f7adf8b433de
2020-02-07 14:38:13 +01:00
Skal
71690b524e fix MSVC warning
"warning C4244: '=': conversion from 'const int' to 'float', possible loss of data"

Change-Id: Ie0769e50c19efd48332ffeadb026d4538fec9919
2020-01-30 09:25:26 +01:00
Skal
6a0ff35872 Enc: add a qmin / qmax range for quality factor
This is particularly useful for multi-pass search (but not only),
to prevent the search from going over or below a reasonable threshold.
E.g.: 'cwebp -qrange 50 80 ...' will prevent any unreasonable degradation.

new cwebp option: -qrange min max

Change-Id: I59f394533535fc20b6996bc0895f4301476d5eff
2020-01-29 14:52:02 +01:00
James Zern
30f0955160 bump version to 1.1.0
libwebp{,decoder} - 1.1.0
libwebp libtool - 8.0.1
libwebpdecoder libtool - 4.0.1

mux - 1.1.0
libtool - 3.5.0

demux - 1.1.0
libtool - 2.6.0 (no code change)

BUG=webp:441

Change-Id: I458940f407515e0d95d20bbfd670ee29255c12eb
2019-12-18 00:06:50 -08:00
James Zern
22cbae33e5 idec_dec: fix 0 offset of NULL pointer
in RemapMemBuffer() and AppendToMemBuffer()

BUG=chromium:1028716,chromium:1027136

Change-Id: Ibc321d233b6207be3cb5cef4d9e8a60498e32457
2019-12-14 17:14:30 -08:00
James Zern
290dd0b426 muxread: fix 0 offset of NULL pointer
BUG=chromium:1028620,chromium:1027409

Change-Id: I2b5527a223a03161afbf39c297c4646954a91fbc
2019-12-14 12:57:39 -08:00
James Zern
0df474ac9e Merge "lossless_(enc_|)sse2: avoid offsetting a NULL pointer" 2019-12-13 22:04:44 +00:00
James Zern
c6b75a1966 lossless_(enc_|)sse2: avoid offsetting a NULL pointer
PredictorSub0_SSE2 doesn't use 'upper' (neither does
VP8LPredictorsSub_C[0]); just pass NULL when dealing with trailing
pixels to avoid undefined behavior when offsetting a NULL pointer

BUG=chromium:1026858,oss-fuzz:19430

Change-Id: I08be8899ed2e34f26aaee34defe68dbd0fe216d3
2019-12-13 18:33:10 +00:00
Skal
295e5e3801 fix UBSAN warning
"applying non-zero offset 2044 to null pointer"

  Fixes chromium bug #19447

Change-Id: I530ae27dc64e92ed0018f36469264c448329e042
2019-12-13 13:26:16 +00:00
James Zern
e2575e05cb DC8_NEON,aarch64: use vaddv
results in one fewer instruction for both DC8uv_NEON and
DC8uvNoLeft_NEON

Change-Id: Ia4e6f4dbc070079cdc2496a698bd4b34198ea164
2019-12-06 09:38:48 -08:00
Cheng Yi
b0e09e346f dec_neon: Fix build failure under some toolchains
some toolchains may implement vcreate_u64 as an assignment to a vector
causing a type mismatch:
 invalid conversion between vector type 'uint64x1_t' (vector of 1
'uint64_t' value) and integer type 'unsigned int' of different size
  const uint64x1_t LKJI____ = vcreate_u64(L | (K << 8) | (J << 16) | (I << 24));
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I5c7b0076ad66d4b3fcdcb7ee9f59bbaa6f19b783
2019-12-06 00:06:44 -08:00
Oliver Wolff
cf0e903c89 dsp/lossless: Fix non gcc ARM builds
The workaround for GCC ARM must not be applied when another toolchain
(like MSVC) is used for the build.

Change-Id: I11ec4558902063ccb085d3f435e24b3a60739dd5
2019-11-27 15:05:08 +01:00
Vincent Rabaud
bb7bc40b6d Remove ubsan errors.
'upper' could be NULL and it would be increased.
But that is for predictor zero that does not use 'upper'.

Change-Id: Icd4ae6792cc55ea021b4f828c3dbdb5f03e120d8
2019-11-06 14:08:14 +01:00
Skal
a4df4aae73 Expose WebPMalloc() in addition to WebPFree()
and use it at various places, including for WebPData.

This is an API change!

Change-Id: Ic041323a1179c465292a4f981a86c4c34635d243
2019-10-15 23:19:50 +02:00
Nico Weber
af650c0bd2 Fix a Wxor-used-as-pow false positive
Since people seem to write "2 ^ X" hoping that it means "1 << X", clang
recently added a warning for this pattern.

It incorrectly fires on this file. To suppress it, restructure the code
to be less clever. (Alternatively we could use "xor" instead of "^" or
write "0x2" instead of "2" but both seem worse.)

No intended behavior change.

Bug: chromium:995200
Change-Id: I64744345be5f5a8cd1f4aaeaf0982da239b378a7
2019-09-04 23:35:46 -07:00
Skal
0e48d889eb bugfix: last alpha rows were incorrectly decoded
sometimes, the last rows of the alpha plane contain more than NUM_ARGB_CACHE_ROWS
rows to process. But ExtractAlphaRows() was repeatedly calling ApplyInverseTransforms()
without updating the dec->last_row_ field, which is the starting row used as starting
point.

Fix would consist of either updating correctly dec->last_row_ before calling
ApplyInverseTransforms(). Or pass the starting row explicitly, which is simpler.

BUG=webp:439

Change-Id: Id99f2c28662d02b2b866cb79e666050be9d59e04
2019-08-30 14:13:28 +02:00
James Zern
fab8f9cfcf cosmetics: normalize '*' association
we associate '*' with types rather than variables

Change-Id: Id93ed65272a8a88e604278693e3850649639e9b6
2019-07-26 01:04:09 -07:00