gecko-dev/media
Timothy Nikkel 77d318b7de Bug 1737038. Make sure we pass the correct zlib strategy to zlib from libpng when encoding pngs. r=aosmond
We don't enable PNG_WRITE_FILTER_SUPPORTED that means that do_filter field on the png_struct will always be zero (it's initialized to 0, and any calls to png_set_filter will error out unless the result is setting it to 0 https://searchfox.org/mozilla-central/rev/489e82dcc1e5afbe691ff3b1c982382914637e38/media/libpng/pngwrite.c#1032 ).

Then this code in png_write_IHDR https://searchfox.org/mozilla-central/rev/489e82dcc1e5afbe691ff3b1c982382914637e38/media/libpng/pngwutil.c#829 will execute and set do_filter to PNG_ALL_FILTERS for non-paletted images with >=8 bit depth.

This this code https://searchfox.org/mozilla-central/rev/489e82dcc1e5afbe691ff3b1c982382914637e38/media/libpng/pngwutil.c#339 will execute and set our zlib strategy to PNG_Z_DEFAULT_STRATEGY (as opposed to PNG_Z_DEFAULT_NOFILTER_STRATEGY). PNG_Z_DEFAULT_STRATEGY is also known as Z_FILTERED inside of zlib.

From here https://searchfox.org/mozilla-central/rev/489e82dcc1e5afbe691ff3b1c982382914637e38/modules/zlib/src/zlib.h#589 that means: "Z_FILTERED for data produced by a filter (or predictor) ... Filtered data consists mostly of small values with a somewhat random distribution."

So that is not what we want to our non-filtered image data.

Switching this so that we use PNG_Z_DEFAULT_NOFILTER_STRATEGY improves both the compression and speed. The following is the avg time taken for toDataURL with a canvas containing 3 different images, and dataURL.length.

Z_FILTERED

very simple line art
49.7ms
17618

"very png compressable image from bug 1724331"
60.8ms
192214

a photo
241.3ms
4193966

Z_DEFAULT_STRATEGY

very simple line art
52.2ms
17590

"very png compressable image from bug 1724331"
61.2ms
186182

a photo
213ms
3555170

All images are smaller with Z_DEFAULT_STRATEGY, the photo being 15% smaller. The two compressable images are perhaps very slightly slower, but the large photo is 12% faster.

For bug 1724331 I want to turn on PNG_WRITE_FILTER_SUPPORTED, and this means we avoid this bug because do_filter gets set to PNG_FILTER_NONE which is not equal to PNG_NO_FILTERS (which is a bit confusing). Avoiding his bug means our png encoder produces different output and we have a couple of tests that check against the exact output of the pngencoder that need to be updated.

Differential Revision: https://phabricator.services.mozilla.com/D130019
2021-11-04 00:17:07 +00:00
..
ffvpx
gmp-clearkey/0.1 Bug 1727133 - Handle clear key cbcs media with 0:0 pattern. r=jolin 2021-08-25 20:41:43 +00:00
highway Bug 1731773 - Part 1: Run mach vendor for libjxl and highway r=tnikkel 2021-09-28 10:54:24 +00:00
kiss_fft
libaom
libcubeb Bug 1732479 - Update libcubeb to 8ef5a1ff. r=cubeb-reviewers,padenot 2021-10-12 19:25:57 +00:00
libdav1d Bug 1734058 - Update dav1d to new version f52aee04fbd711cddab23d0aa9b196e9c963e7b8 from 2021-10-04 21:58:36. r=mjf,haik 2021-10-26 17:11:36 +00:00
libjpeg Bug 1709303 - Part 2. Update libjpeg-turbo to 2.1.1. r=tnikkel 2021-09-13 21:55:13 +00:00
libjxl Bug 1736752 - Update libjxl r=tnikkel 2021-10-28 01:06:52 +00:00
libmkv
libnestegg Bug 1726042 - Update nestegg to ec6adfbb. r=bryce 2021-08-16 22:26:31 +00:00
libogg Bug 1733545 - Remove REQUIRES_UNIFIED_BUILD from third-party directories that don't need it. r=firefox-build-system-reviewers,andi 2021-10-01 09:01:27 +00:00
libopus Bug 1733545 - Remove REQUIRES_UNIFIED_BUILD from third-party directories that don't need it. r=firefox-build-system-reviewers,andi 2021-10-01 09:01:27 +00:00
libpng Bug 1737038. Make sure we pass the correct zlib strategy to zlib from libpng when encoding pngs. r=aosmond 2021-11-04 00:17:07 +00:00
libsoundtouch Bug 1733545 - Remove REQUIRES_UNIFIED_BUILD from third-party directories that don't need it. r=firefox-build-system-reviewers,andi 2021-10-01 09:01:27 +00:00
libspeex_resampler
libtheora Bug 1733545 - Remove REQUIRES_UNIFIED_BUILD from third-party directories that don't need it. r=firefox-build-system-reviewers,andi 2021-10-01 09:01:27 +00:00
libtremor
libvorbis Bug 1733545 - Remove REQUIRES_UNIFIED_BUILD from third-party directories that don't need it. r=firefox-build-system-reviewers,andi 2021-10-01 09:01:27 +00:00
libvpx
libwebp Bug 1729748 - Update libwebp to 1.2.1. r=jrmuizel 2021-09-08 18:55:06 +00:00
libyuv Bug 1654112 - deconflate the target and host architectures in libwebrtc build files; r=mjf 2021-07-14 22:28:13 +00:00
mp4parse-rust Bug 1723247 - Update mp4parse-rust to 5326af6 r=kinetik 2021-08-03 23:23:42 +00:00
openmax_dl
openmax_il/il112
psshparser
webrtc Bug 1729455 - Make GetRemoteSSRC return a Maybe. r=ng 2021-11-03 15:23:18 +00:00
moz.build
update-libjpeg.sh Bug 1709303 - Part 1. Prepare scripts and patches for libjpeg-turbo update. r=jrmuizel,tnikkel 2021-09-13 21:55:12 +00:00