Commit Graph

2810 Commits

Author SHA1 Message Date
James Zern
28aedcb9b0 *.pc.in: rename lib_prefix to webp_libname_prefix
this will help avoid any future conflicts with the more generic autoconf
type name

Change-Id: I0311e03a11a541118025c7dbe8309365f6efa847
2022-10-24 16:44:42 -07:00
James Zern
dfc843aa63 Merge "*.pc.in: add lib prefix to lib names w/MSVC" into main 2022-10-20 18:25:42 +00:00
James Zern
2498209ba9 *.pc.in: add lib prefix to lib names w/MSVC
this fixes the library names output after:
9ac25bcb3 CMakeLists.txt,win32: match naming convention used by nmake

before this change:
pkg-config --libs --msvc-syntax \
  libwebp libwebpdemux libwebpmux libsharpyuv libwebpdecoder
/libpath:.../lib webpdemux.lib webpmux.lib webp.lib
  sharpyuv.lib webpdecoder.lib

after:
pkg-config --libs --msvc-syntax \
  libwebp libwebpdemux libwebpmux libsharpyuv libwebpdecoder
/libpath:.../lib libwebpdemux.lib libwebpmux.lib libwebp.lib
  libsharpyuv.lib libwebpdecoder.lib

Bug: webp:584
Change-Id: Ic3693b58a40e0ba683333065003b1c00aab0cf48
Fixed: webp:584
2022-10-17 14:07:02 -07:00
James Zern
5694476244 analysis_enc.c: fix a dead store warning
when threading is disabled; fixes:
src/enc/analysis_enc.c:429:15: warning: Value stored to 'split_row'
during its initialization is never read [deadcode.DeadStores]
    const int split_row = (9 * last_row + 15) >> 4;
              ^~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I2b02173bb8c930ed54360cce5c7b88ecce098d83
2022-10-14 19:20:00 -07:00
James Zern
e68765af42 dsp,neon: use vaddv in a few more places
SumToInt_NEON
horizontal_add_uint32x4

Change-Id: I881831a7b2bab35a1810b0d83fee761470f3e09f
2022-09-12 10:55:58 -07:00
James Zern
62b1bfe8bd Merge changes I2877e7bb,I777cad70,I15af7d1a,I686e6740,If10538a9, ... into main
* changes:
  picture_csp_enc.c: remove SafeInitSharpYuv
  sharpyuv: prefer webp/types.h
  sharpyuv,SharpYuvInit: add mutex protection when available
  sharyuv_{neon,sse2}.c: merge WEBP_USE_* sections
  add a few missing <stddef.h> includes for NULL
  sharpyuv.h: remove <inttypes.h>
2022-08-17 18:13:09 +00:00
James Zern
95c8fe5f3d Merge changes Iecea3603,I9dc228ab into main
* changes:
  cmake: fix dll exports
  cmake/cpu.cmake: remove unused variable
2022-08-17 18:11:27 +00:00
James Zern
e7c805cfad picture_csp_enc.c: remove SafeInitSharpYuv
thread safety was internalized in:
782ed48c sharpyuv,SharpYuvInit: add mutex protection when available

Change-Id: I2877e7bb78bf89ad7504c33d04b22952c0c0a968
2022-08-12 11:05:57 -07:00
James Zern
639619ce72 cmake: fix dll exports
move WEBP_EXTERN definition from Makefile.vc to webp/types.h using the
existing WEBP_DLL define to control its declaration to
__declspec(dllexport); the same is done for SHARPYUV_EXTERN

Change-Id: Iecea360305bdd19a878255470a00b9dcc344c730
2022-08-11 19:33:37 -07:00
James Zern
ef70ee06fa add a few missing <stddef.h> includes for NULL
and remove unused includes in sharpyuv/

Change-Id: If10538a994bd5dc55126f1485f2b163933ad8e91
2022-08-11 17:39:48 -07:00
James Zern
76c353bab7 picture_csp_enc.c,CheckNonOpaque: rm unneeded local
the ternary used with alpha_offset was removed in:
  3b07d327 Import,RGBA: fix for BigEndian import
use the ALPHA_OFFSET directly

Change-Id: Iee9b7c54f1498591e8c5834766dc4d34a321133d
2022-08-11 09:57:11 -07:00
James Zern
e17293095b Merge "WebPPictureHasTransparency: add missing pointer check" into main 2022-08-11 16:55:21 +00:00
James Zern
00ff988a59 vp8l_enc,AddSingleSubGreen: clear int sanitizer warnings
this localizes the conversion to int in the function; the parameter was
previously changed in:
6ab496ed fix some 'unsigned integer overflow' warnings in ubsan

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

Bug: b/229626362
Change-Id: I589eec11c0dabaeba99e153e705f956181c570d2
2022-08-08 17:41:25 -07:00
James Zern
e2fecc22e1 dsp/lossless_enc.c: clear int sanitizer warnings
in TransformColorBlue; make new_blue an int to avoid:

implicit conversion from type 'int' of value 264 (32-bit, signed) to
type 'uint8_t' (aka 'unsigned char') changed the value to 8 (8-bit,
unsigned)

Bug: b/229626362
Change-Id: Ife276a59231075788396204e1a192f3b0c6d9e21
2022-08-08 17:34:01 -07:00
James Zern
129cf9e97e dsp/lossless.c: clear int sanitizer warnings
add explicit casts in calls to ColorTransformDelta()

clears warnings of the form:
implicit conversion from type 'uint8_t' (aka 'unsigned char') of value
254 (8-bit, unsigned) to type 'int8_t' (aka 'signed char') changed the
value to -2 (8-bit, signed)

Bug: b/229626362
Change-Id: Ic049ad9c9b5c6b669a1c943287f416533d6c873c
2022-08-08 17:34:01 -07:00
James Zern
ad7d1753c5 dsp/lossless_enc.c: clear int sanitizer warnings
add explicit casts in calls to ColorTransformDelta()

clears warnings of the form:
implicit conversion from type 'uint8_t' (aka 'unsigned char') of value
254 (8-bit, unsigned) to type 'int8_t' (aka 'signed char') changed the
value to -2 (8-bit, signed)

Bug: b/229626362
Change-Id: I40618209509508f56d8053f9daa29cf2e6999766
2022-08-08 17:34:00 -07:00
James Zern
5037220e55 VP8LSubtractGreenFromBlueAndRed_C: clear int sanitizer warnings
previously the types were changed to int to prevent unsigned overflow
warnings:
6ab496ed fix some 'unsigned integer overflow' warnings in ubsan

clears warnings of the form:
implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
3724541952 (32-bit, unsigned) to type 'int' changed the value to
-570425344 (32-bit, signed)

implicit conversion from type 'int' of value -3361661 (32-bit, signed)
to type 'unsigned int' changed the value to 4291605635 (32-bit,
unsigned)

Bug: b/229626362
Change-Id: If1eb39c5dd7218d686c3c47fb7df72431b873be4
2022-08-08 17:34:00 -07:00
James Zern
2ee786c740 upsampling_sse2.c: clear int sanitizer warnings
clears warnings of the form:
src/dsp/upsampling_sse2.c:169:1: runtime error: implicit conversion from
type 'int' of value -16 (32-bit, signed) to type 'unsigned long' changed
the value to 18446744073709551600 (64-bit, unsigned)

Bug: b/229626362
Change-Id: I757d347808be5084e5fcf7c121a77d09812b743c
2022-08-08 17:34:00 -07:00
James Zern
4cc157d48a ParseOptionalChunks: clear int sanitizer warning
clears a warning of the form:
src/dec/webp_dec.c:182:62: runtime error: implicit conversion from type
'int' of value -2 (32-bit, signed) to type 'unsigned int' changed the
value to 4294967294 (32-bit, unsigned)

Bug: b/229626362
Change-Id: Ibf08f8bb9ec345381b51ca3872745368fca700c0
2022-08-08 17:34:00 -07:00
James Zern
892cf033b9 BuildHuffmanTable: clear int sanitizer warning
clears a warning of the form:
implicit conversion from type 'int' of value -1 (32-bit, signed) to type
'uint32_t' (aka 'unsigned int') changed the value to 4294967295 (32-bit,
unsigned)

Bug: b/229626362
Change-Id: I397fbd59bd3e6d787fcec1344b6230958b28d22c
2022-08-08 17:34:00 -07:00
James Zern
3a9a4d4589 VP8GetSigned: clear int sanitizer warnings
clears warnings of the form:
implicit conversion from type 'int32_t' (aka 'int') of value -1 (32-bit,
signed) to type 'unsigned int' changed the value to 4294967295 (32-bit,
unsigned)

Bug: b/229626362
Change-Id: I956671d4fee482c97c67bbe94032a97da49b0f6d
2022-08-08 17:34:00 -07:00
James Zern
704a3d0a1f dsp/lossless.c: quiet int sanitizer warnings
in calls to Clip255(); given the current implementation's use of a
logical shift the parameter is left as uint32_t and explicit casts are
added

clears warnings of the form:
src/dsp/lossless.c:52:18: runtime error: implicit conversion
from type 'int' of value -2 (32-bit, signed) to type 'uint32_t' (aka
'unsigned int') changed the value to 4294967294 (32-bit, unsigned)

Bug: b/229626362
Change-Id: If8a7f145c2d7e62e572e221da36b04281ed5c9bf
2022-08-08 17:30:45 -07:00
James Zern
1a6c109c99 WebPPictureHasTransparency: add missing pointer check
in the case of use_argb, alpha_offset may be non-zero which would cause
the null pointer check in CheckNonOpaque to pass

fixes a potential crash with invalid width/height set or an integer
sanitizer warning when passing a zeroed picture:
src/enc/picture_csp_enc.c:73:57: runtime error: applying non-zero offset
3 to null pointer

Change-Id: I9d499bba12c65ad5c65d8f9f3c8ee9298ac6081a
2022-08-08 16:45:20 -07:00
James Zern
866e349cef libwebp-1.2.4
- 8/4/2022: version 1.2.4
   This is a binary compatible release.
   * restore CMake libwebpmux target name for compatibility with 1.2.2 (#575)
   * fix lossless crunch mode encoding with WEBP_REDUCE_SIZE
     (chromium: #1345547, #1345595, #1345772, #1345804)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEaw5rcJdt4wPt8vYB+cPWvbgjK10FAmLtz8MACgkQ+cPWvbgj
 K10v/A//R+sAs759jvKryQGJYDweXMKqbHbWWdkNbluX4FoitQH44Wy+YPecMrr2
 En3vSJWM50Bb8UvscvO+FoCI3x6DhgniEC7VbRnx43sSHioyd1K6XYBp+Q8Ksj6n
 qpdslDsjzpwj4uAKrDnTmdBr9CdSK8qxlXvgskqtWBwRnlePetRWXFSWO3ke7JKa
 d+SeLxboGgsZ+zjoWSqK+f7LCOEPGEkJk/JP3xOwn9K+FusLP2YMDhVw5Q78rWfh
 qNCamsM0SUFN9hfHp0/0FQvHO0B+c8BtB/hh5hjctZt7j5O+fQC+KAmiStnB2B3f
 CVjilU3ajnVH2VD4SYcsfHCVEV8hM+fHHjTgvnHh7jtz3wlokfcidMW9F1JujLZu
 M4FnD6XbJXERfitKx9lEzJ1h9RbChvrl84waU8Tkx/GboNIvHUQF5kROlOjXz3BL
 t+nkuNywxcb5RPph17OhYXT9MqPwGVHctrVG5DaAn+QjSKcxa65k03CFtZclD4Xm
 V8ozMwtKXiRZBqJRPwg7iYvnUOHixS3p+6p3OsUyjKelJEOLFfo1Z1vv7JvnXsmo
 xpvyetWnfWCnzzdMglahCVDu3ENVrjmNGV5g4wMTgDCcF0g/++M+7Yv/NfHNz0DX
 Y0uppjsXYUwNaq8Q3GpveQcpeZNrGpHRZQ88PsZkLxoNDn+hWHo=
 =BQmU
 -----END PGP SIGNATURE-----

Merge tag 'v1.2.4'

libwebp-1.2.4

- 8/4/2022: version 1.2.4
  This is a binary compatible release.
  * restore CMake libwebpmux target name for compatibility with 1.2.2 (#575)
  * fix lossless crunch mode encoding with WEBP_REDUCE_SIZE
    (chromium: #1345547, #1345595, #1345772, #1345804)

* tag 'v1.2.4':
  update ChangeLog
  update NEWS
  bump version to 1.2.4
  lossless: fix crunch mode w/WEBP_REDUCE_SIZE
  CMakeLists.txt: correct libwebpmux name in WebPConfig.cmake
  Revert "cmake: fix webpmux lib name for cmake linking"

Bug: webp:579
Change-Id: I7e1aa268d1ea9c1f3b38334cff2681e177bbdf36
2022-08-08 15:47:16 -07:00
James Zern
9fde812779 bump version to 1.2.4
libwebp{,decoder} - 1.2.4
libwebp libtool - 8.5.1
libwebpdecoder libtool - 4.5.1

mux - 1.2.4
libtool - 3.10.0

demux - 1.2.4
libtool - 2.11.0

Bug: webp:579
Change-Id: I5fae4184ac6fe4b9c719856080020fd107f18b7f
2022-08-04 22:02:35 -07:00
James Zern
aff1c546ef dsp,x86: normalize types w/_mm_cvtsi128_si32 calls
fixes integer sanitizer warnings of the form:
implicit conversion from type 'int' of value -2122283647 (32-bit,
signed) to type 'uint32_t' (aka 'unsigned int') changed the value to
2172683649 (32-bit, unsigned)

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

Bug: b/229626362
Change-Id: I79f68e3e2fcab7cc0402477d2e88d629348c9ff4
2022-08-04 11:26:23 -07:00
James Zern
ab540ae0c5 dsp,x86: normalize types w/_mm_cvtsi32_si128 calls
fixes integer sanitizer warnings of the form:
implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
3724541952 (32-bit, unsigned) to type 'int' changed the value to
-570425344 (32-bit, signed)

Bug: b/229626362
Change-Id: Ie4d599aba88226e4e047250464ac37ca11d2cd3b
2022-08-04 11:26:23 -07:00
James Zern
8980362eed dsp,x86: normalize types w/_mm_set* calls (2)
missed in:
83539239 (origin/main, main) dsp,x86: normalize types w/_mm_set* calls

fixes integer sanitizer warnings of the form:
implicit conversion from type 'uint32_t' (aka 'unsigned int') of value
4292337446 (32-bit, unsigned) to type 'int' changed the value to
-2629850 (32-bit, signed)
runtime error: implicit conversion from type
'uint8_t' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type
'char' changed the value to -128 (8-bit, signed)

Bug: b/229626362
Change-Id: Ie904da8ded26725b4e0a9b82cc0679234f0a5388
2022-08-04 11:26:23 -07:00
James Zern
e626925cef 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
(cherry picked from commit 84163d9d02)
2022-08-03 23:57:12 +00:00
James Zern
835392393b dsp,x86: normalize types w/_mm_set* calls
fixes integer sanitizer warnings of the form:
runtime error: implicit conversion from type 'unsigned int' of value
4294967295 (32-bit, unsigned) to type 'int' changed the value to -1
(32-bit, signed)
runtime error: implicit conversion from type
'uint8_t' (aka 'unsigned char') of value 128 (8-bit, unsigned) to type
'char' changed the value to -128 (8-bit, signed)

Bug: b/229626362
Change-Id: I6be3c40407cf7a27b79d31ee32d3829ecb78ed66
2022-08-03 16:50:46 -07:00
James Zern
79be856e6e Merge changes I7111d1f7,I872cd62c into main
* changes:
  libwebp.pc: add libsharpyuv to requires
  libsharpyuv: add pkg-config file
2022-08-03 01:43:10 +00:00
Christopher Degawa
04764b56a0
libwebp.pc: add libsharpyuv to requires
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Change-Id: I7111d1f7738dad566dc74fc11be99ff92e11c50b
2022-08-02 15:58:49 -05:00
James Zern
c151e95bdc utils.h,WEBP_ALIGN: make bitmask unsigned
this fixes runtime warnings with clang -fsanitize=integer when using the
WEBP_ALIGN_CST constant in WEBP_ALIGN:
implicit conversion from type 'int' of value -32 (32-bit, signed) to
type 'unsigned int' changed the value to 4294967264 (32-bit, unsigned)

Bug: b/229626362
Change-Id: I524d80e620b9869de4e6d322b7de6ffa1ec8657f
2022-08-01 13:44:29 -07:00
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