Commit Graph

51 Commits

Author SHA1 Message Date
Vincent Rabaud
41a5e582c2 Fix errors when compiling code as C++
Change-Id: Iba94e24e764038640f39d61fb2bc9cfb3434cc8f
2024-07-10 10:30:48 +02:00
James Zern
f6d15cb747 bump version to 1.4.0
libwebp{,decoder} - 1.4.0
libwebp libtool - 8.9.1
libwebpdecoder libtool - 4.9.1

mux - 1.4.0
libtool - 4.0.1

demux - 1.4.0
libtool - 2.15.0

sharpyuv - 0.4.0
libtool - 1.0.1

Bug: webp:627
Change-Id: I9a61d83ee92809de1c2501d1b4fb68aa38f98850
2024-04-01 15:37:40 -07:00
Ozkan Sezer
8487860a8c windows exports: use dllexport attribute, instead of visibility.
With older toolchains, at the least, visibility attributes don't
work and all symbols are exported along with lots of unsupported
warnings.

Change-Id: I6ffe220b7589a6bda00f42c17ead35592de7cc5a
2024-03-07 01:14:37 +03:00
James Zern
5efd6300dc mv SharpYuvEstimate420Risk to extras/
There's no need for this in libsharpyuv currently. This avoids an ABI
bump and library size increase.

Change-Id: I3e4c79052fdb4d628a2d36491547233dd0b6dc34
2024-01-12 15:25:27 -08:00
Maryla
d7a0506dcc Add YUV420 riskiness metric.
Basic version for 8 bit only and C only (no simd).

Hidden behind a compile flag because the precompiled table is
fairly large (114kiB) and more than triples the size of the library.

Change-Id: I165c78e863df6a17b32f578bdbffe3adda9ac1d0
2023-12-05 10:17:15 +01:00
James Zern
a429c0de64 sharpyuv: convert some for() to do/while
With loops that don't use an immediate value in the conditional, this
can produce fewer tests.

Change-Id: I75401c51f7f7653be2f8c04d5f3c4ce04aefc3fc
2023-10-25 12:25:16 -07:00
James Zern
f0cd786125 DoSharpArgbToYuv: remove constant from loop
pre-calculating rgb_bit_depth + GetPrecisionShift(rgb_bit_depth)
produces better assembly with clang.

Change-Id: Ic4c3a620c1634fb5ea7001fa709d28c547769f79
2023-10-25 12:25:12 -07:00
James Zern
339231cc37 SharpYuvConvertWithOptions,cosmetics: fix formatting
Change-Id: Ieffe5877c6d715d168b0e9526d8fa1a946860771
2023-10-25 12:25:08 -07:00
Maryla
deadc339d5 Fix transfer functions where toGamma and toLinear are swapped.
Change-Id: I2f7ef84d227009181dad1c17883741bd98bf92b6
2023-10-12 16:57:32 +02:00
Maryla
54ca975245 Fix bug in FromLinearLog100.
Change-Id: Iddfa7d16fe44e375a93deae9636eadc8bef42767
2023-10-11 15:08:24 +02:00
Vincent Rabaud
e2c85878f6 Add an initializer for the SharpYuvOptions struct.
Change-Id: I36510bc361b040d3d3e7d261ab67b24ffc3013a6
2023-07-01 21:15:37 +02:00
James Zern
4222b00679 libwebp-1.3.1
- 6/23/2023: version 1.3.1
   This is a binary compatible release.
   * security fixes for lossless encoder (#603, chromium: #1420107, #1455619,
     CVE-2023-1999)
   * improve error reporting through WebPPicture error codes
   * fix upsampling for RGB565 and RGBA4444 in NEON builds
   * img2webp: add -sharp_yuv & -near_lossless
   * Windows builds:
     - fix compatibility with clang-cl (#607)
     - improve Arm64 performance with cl.exe
     - add Arm64EC support
   * fix webp_js with emcc >= 3.1.27 (stack size change, #614)
   * CMake fixes (#592, #610, #612)
   * further updates to the container and lossless bitstream docs (#581, #611)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEaw5rcJdt4wPt8vYB+cPWvbgjK10FAmSc53oACgkQ+cPWvbgj
 K120Fg//f0JkK3oKnO8P4B5XSAK26/5845xBPU8D06UuUqhct+mjfF5kM1CFxxex
 49W4rT7RJCpgGlwmRFFgRB3a9j7cW4C+Kt5MAfM++vudVrxnpnX6o3rdVDQ60PEZ
 C4T5u2jio/HuZAkPWYwwmIAz1vfqTjYpi0D12hn7yoBoketGcISlMuTgmwfjyQKg
 bn3JcjcjKtERfXSH36aCtnGAXJdf0Ok2WJtwS4kAcZiMByi5wf0AdEK0pnhmE3Y6
 YFPc0/RM50RXITnsDxmLZVRqpsAYr4l3RZvHwDDWVFMELWBsGWNF/kgzWlZ3/KjO
 4CUPE+810P4oVGJuRZ8++0hMSD0L1qh17awElpqLoBlDXfS1fEIw5QodbmoJzi0H
 mhiLH7fIZlpjoZyWuwNCzlkhykRLO4cEIaxxq28p5eoC70LXsv77rWqomfAja/6/
 88BQz6wrxHr0k4MmdOa+G8B5sMOBRVXXeW4bP1XCVGUfk8FN2rz0vlhbHk8sx/6/
 jqW19Bk3t2QnUZschBi1GKHKa0KkefFhTezTm/CV4fPmT50Z4k/+TTjJ6snSxAAX
 oYabJDtVARLgPxOcN64Hbsy1t5L9pWGLTfwbYBTVipX4lmofL9SHhgyg6oYVnZd5
 qbCVdqpYOOrbXXT/AByOuzo3tuaLMd8Ytas0I5/HHnI6QCTthg0=
 =/atT
 -----END PGP SIGNATURE-----

Merge tag 'v1.3.1'

libwebp-1.3.1

- 6/23/2023: version 1.3.1
  This is a binary compatible release.
  * security fixes for lossless encoder (#603, chromium: #1420107, #1455619,
    CVE-2023-1999)
  * improve error reporting through WebPPicture error codes
  * fix upsampling for RGB565 and RGBA4444 in NEON builds
  * img2webp: add -sharp_yuv & -near_lossless
  * Windows builds:
    - fix compatibility with clang-cl (#607)
    - improve Arm64 performance with cl.exe
    - add Arm64EC support
  * fix webp_js with emcc >= 3.1.27 (stack size change, #614)
  * CMake fixes (#592, #610, #612)
  * further updates to the container and lossless bitstream docs (#581, #611)

* tag 'v1.3.1':
  update ChangeLog
  update NEWS
  enc/*: normalize WebPEncodingSetError() calls
  enc/*: add missing WebPEncodingSetError() calls
  EncodeAlphaInternal: add missing error check
  vp8l_enc,WriteImage: add missing error check
  muxread,MuxImageParse: add missing error checks
  cmake,emscripten: explicitly set stack size
  WebPDecodeYUV: check u/v/stride/uv_stride ptrs
  Call png_get_channels() to see if image has alpha
  update ChangeLog
  update NEWS
  bump version to 1.3.1
  update AUTHORS
  update .mailmap

Bug: webp:608
Bug: b/281615350
Change-Id: Ic3e1956c92fef0ae22040bbc3e81b297c65008af
2023-06-28 19:34:13 -07:00
Vincent Rabaud
25d94f473b Implement more transfer functions in libsharpyuv
This is inspired by https://github.com/AOMediaCodec/libavif/pull/444/files

Change-Id: I98fae61696b3b8bbc1b5941e7950810d3ac3d588
2023-06-28 11:43:37 +02:00
James Zern
7138bf8fc3 bump version to 1.3.1
libwebp{,decoder} - 1.3.1
libwebp libtool - 8.7.1
libwebpdecoder libtool - 4.7.1

mux - 1.3.1
libtool - 3.12.0

demux - 1.3.1
libtool - 2.13.0

sharpyuv - 0.2.1
libtool - 0.1.0

Bug: webp:608
Change-Id: Ia80c54651a45caa1baa595f66820a3c1091d05c4
2023-06-01 18:56:12 -07:00
James Zern
8151f388eb move VP8GetCPUInfo declaration to cpu.c
This avoids defining a version in each translation unit when using
__declspec(dllexport) which causes failures due to multiply defined
symbols with clang-cl:

lld-link: error: duplicate symbol: VP8GetCPUInfo
>>> defined at CMakeFiles\webpdecode.dir\Debug\src\dec\alpha_dec.c.obj
>>> defined at CMakeFiles\webpdsp.dir\Debug\src\dsp\dec_sse41.c.obj
...

Bug: webp:607
Change-Id: I6cd1ee75b3db984aa513263a05516e867a64925d
2023-04-27 12:39:13 -07:00
James Zern
3f73e8f7ac sharpyuv: add SharpYuvGetVersion()
Change-Id: Ic7e93c7c3ec33b8ab0105a6e81b76a7869422b55
2022-10-28 19:15:32 -07:00
James Zern
ce2f2d668e SharpYuvConvert: fix a race on SharpYuvGetCPUInfo
Rather than make a copy, requiring an additional lock/unlock only to set
the pointer to itself, pass the address of SharpYuvGetCPUInfo and use it
as a sentinel to avoid updating the pointer.

Change-Id: I22fb467f1659c16805c0d3bc7aaeba6a1bb16dbb
2022-10-27 13:52:01 -07:00
James Zern
a458e3086c sharpyuv_dsp.h: restore sharpyuv_cpu.h include
this was removed in:
979c0ebb sharpyuv: add SharpYuvGetCPUInfo

but currently, consumers of sharpyuv_dsp.h depend on the presence of
WEBP_USE_*

Change-Id: I9524aa5ab767a1b46770022220372455a86f198f
2022-10-26 15:22:48 -07:00
James Zern
9ba800a745 Merge changes Id72fbf3b,Ic59d23a2 into main
* changes:
  sharpyuv: add SharpYuvGetCPUInfo
  cpu.c,cosmetics: fix a typo
2022-10-26 20:56:42 +00:00
James Zern
979c0ebbcd sharpyuv: add SharpYuvGetCPUInfo
This gives a similar structure to libwebp and fixes a bug where passing
NULL to SharpYuvInit() would unconditionally set optimized function
pointers. SharpYuvInit() is left as an undocumented public function and
SharpYuvGetCPUInfo is kept private to serialize updates to the pointer.

Change-Id: Id72fbf3ba5b396367510e3bcd1ee2e4e11b95b8c
2022-10-26 13:07:01 -07:00
James Zern
8bab09a4a8 Merge "*.pc.in: rename lib_prefix to webp_libname_prefix" into main 2022-10-26 19:57:24 +00:00
James Zern
a02978c250 sharpyuv/Makefile.am+cmake: add missing -lm
this lib uses functions from math.h

Change-Id: I316f058c9e42e4888cce0d380472518a77e21517
2022-10-25 15:58:21 -07:00
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
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
Maryla
780db75618 Update Windows makefile to build libsharpyuv library.
Change-Id: I2d260aa11c06ba1c33e40e94537f5a9afe5d3880
2022-10-05 14:21:35 +02:00
Maryla
e8f83de286 Set libsharpyuv include dir to 'webp' subdirectory.
Change-Id: I57cf12fd3d544485312fb0342aac3dcf5585136f
2022-08-19 10:22:30 +02: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
6af8845a8f sharpyuv: prefer webp/types.h
this provides better compatibility for older Visual Studio versions;
stdint.h is a part of C99.

this is consistent with the core libwebp library:
8fbb9188 prefer webp/types.h over stdint.h

Change-Id: I777cad70d9a407646c4193db9ca0f09e65d88735
2022-08-12 10:55:39 -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
782ed48cd3 sharpyuv,SharpYuvInit: add mutex protection when available
this is similar to WEBP_DSP_INIT and avoids the potential for a race in
initializing the function pointers and gamma table

Change-Id: I15af7d1a3e92c42eaa735751ca33eba0d1e83283
2022-08-11 18:58:40 -07:00
James Zern
cad0d5adb6 sharyuv_{neon,sse2}.c: merge WEBP_USE_* sections
Change-Id: I686e6740717902d632fb01f9151e47fd3cb2cf79
2022-08-11 17:48:11 -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
f0f9eda406 sharpyuv.h: remove <inttypes.h>
this hasn't been needed since:
93c54371 sharpyuv: add support for 10/12/16 bit rgb and 10/12 bit yuv.

Change-Id: I02051e8b576d7fd27824e13be0d087dc4e18209e
2022-08-11 17:18:49 -07:00
Christopher Degawa
7deee8103e
libsharpyuv: add pkg-config file
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Change-Id: I872cd62ccdf096044c7921afda8289849d141531
2022-08-02 15:46:19 -05:00
Maryla
a3b68c195e Build libsharpyuv as a full installable library.
Headers are installed in a "sharpyuv" subdirectory of the webp
dir, e.g. /usr/local/include/webp/sharpyuv/
Remove unnecessary dependency from sharpyuv to webp/types.h

Add SHARPYUV_EXTERN so that only symbols meant to be public
are exported.

Sharpyuv users can use the library with:

find_package(WebP)
if(TARGET WebP::sharpyuv)
  # ... use WebP::sharpyuv
endif()

Change-Id: I602a25521a135a2edc39d6587610484fe6447ec5
2022-07-28 12:31:59 +00:00
Maryla
f83bdb5251 libsharpyuv: add version defines
Change-Id: I2dbe69d1ce5abaf7f5bd83daec99655520b5abad
2022-06-28 11:08:14 +02:00
Maryla
ec9e782a35 sharpyuv: remove minimum image size from sharpyuv library
libwebp still has a size threshold of 4 pixels in picture_csp_enc.c
but the sharpyuv library itself can handle any image size.

Change-Id: Ic1c78c8f8fae528395fa46a74f717f47cb13098e
2022-06-14 14:55:12 +02:00
Maryla
2d607ee646 sharpyuv: increase precision of gamma<->linear conversion
Change-Id: I261bae3628315bda4ec0dafb8798c7512dd03a36
2022-06-01 15:38:44 +02:00
Maryla
266cbbc511 sharpyuv: add 32bit version of SharpYuvFilterRow.
This allows increasing intermediate value precision from 10 bits to 14 bits.

Change-Id: I0fc33400d200a849bcc2c677ab8346215a9dbc3b
2022-06-01 13:42:29 +02: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
Maryla
d3006f4b96 sharpyuv: slightly improve precision
- Remove SHALF constant so that we get back the original value when
  calling UpScale then downscale with rounding
- Make the linear->gamma precomputed table bigger (8 bits rather than 5)
- Round values in kLinearToGammaTabS

Change-Id: Ic9634d32cf93de321d2f6e9e4cad7f156d8d07df
2022-05-17 10:36:44 +02:00
James Zern
a3927cc800 sharpyuv.c,cosmetics: fix indent
+ a few typos in sharpyuv_csp.c

Change-Id: I34b208d10d7808b42afb39b0618fb2e5d76633eb
2022-05-11 11:53:25 -07: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
Frank Barchard
8f4b5c62b7 Fix typo in color constants: Marix -> Matrix
Change-Id: Ia5dc8b37ea7ddbb3dba923e24ef07633edb822eb
2022-04-11 14:54:43 -07:00
James Zern
ed643f619d Merge changes I452d2485,Ic6d75475 into main
* changes:
  SharpYuvComputeConversionMatrix: quiet int->float warnings
  Makefile.vc: add sharpyuv_csp.obj to SHARPYUV_OBJS
2022-04-11 18:54:25 +00:00
Maryla
8fa053d134 Rename SharpYUV to SharpYuv for consistency.
Change-Id: I21df96b4c8f8fa97bfd2ac9c806c7e5119b55691
2022-04-11 11:55:10 +02:00
James Zern
99a8756201 SharpYuvComputeConversionMatrix: quiet int->float warnings
under some versions of visual studio:
sharpyuv\sharpyuv_csp.c(43): warning C4244: '=': conversion from 'int' to
'float', possible loss of data
sharpyuv\sharpyuv_csp.c(35): warning C4244: 'initializing': conversion from
'int' to 'float', possible loss of data

Change-Id: I452d24857b43b8a80fae0f339163b4b3965f2d9f
2022-04-09 11:07:09 -07:00
Maryla
01a05de1a7 libsharpyuv: add colorspace utilities
Change-Id: I620c8593dc81f39e747de5ed354332adb7278bed
2022-04-08 10:07:22 +02: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