Replace libjpeg with libjpeg-turbo for PHP 8.1+ on Windows
[email protected] ("Christoph M. Becker") Sun, 9 May 2021 17:04:09 +0200
| Newsgroups | php.internals,php.internals.win |
|---|---|
| Message-ID | <[email protected]> |
Hi all, I suggest to replace libjpeg[1] with libjpeg-turbo[2] for future PHP releases on Windows, starting with PHP 8.1. The main reason is that libjpeg-turbo offers better performance, because it uses SIMD instructions on supported platforms (Windows x86 and x64 are supported). Note that many (all?) Linux distributions also support libjpeg-turbo. To my knowlege libjpeg-turbo can be used as compatible drop-in replacement for libjpeg. However, Windows builds are currently using libjeg 9c, for which there is no compat layer in libjpeg-turbo due to the controversial new color transform for the "Lossless SmartScale" format introduced in libjpeg 9. Besides that SmartScale is a non standard format, the chosen implementation introduces an ABI break. Anyhow, SmartScale is not used by ext/gd which is the most important client of libjpeg (I'm not sure if there other extensions which use libjpeg directly). I've pushed libjpeg-turbo to a feature branch in the winlibs repo[3], including the usual winlibs.mak. To build it, NASM or YASM is required. I did not test the latter, though. I also uploaded packages to windows.php.net[4] (libjpeg-turbo-2.1.0-vs16-x(64|86).zip). Whether you build yourself or use the prebuilt packages, you can just unzip into the deps/ folder of your build tree. I've got the same test results for ext/gd/tests with libjpeg-9c and libjpeg-turbo-2.1.0. Thoughts? Objections? [1] <http://ijg.org/> [2] <https://libjpeg-turbo.org/> [3] <https://github.com/winlibs/libjpeg/tree/libjpeg-turbo> [4] <https://windows.php.net/downloads/pecl/deps/> =2D- Christoph M. Becker