-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Replace libvpx with libwebp #1429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ext/gd/libgd/gd_webp.c has been taken from libgd[1]. Mainly, gd_error(X) has been subsituted by zend_error(E_ERROR, X) and BGD_DECLARE(X) by X. Further modifications are obvious from the diff. All GD tests are passing, what raises hope, but we need more WebP tests, anyway. [1] <https://github.com/libgd/libgd/blob/7ec030c4f1dae75ed5d82c3eed2abe6775742c75/src/gd_webp.c>
@cmb69 After talking to @remicollet it turned out that this change might create an issue to the downstream redists using various libgd versions (2.0, 2.1, 2.2). I've managed to build libvpx on Windows (finally!) http://windows.php.net/downloads/php-sdk/deps/vc14/x64/libvpx-1.4.0-vc14-x64.zip Quite a complicated process, but as it works - probably we shouldn't introduce changes that could break something else, at least not ATM. I pity your work very much. Maybe you could check a libvpx build? We probably should use them for beta2. /cc @pierrejoye Thanks. |
Well, if we have to cater to downstream distros, it seems to me that we'd have to support both libvpx as well as libwebp. libgd-master has been already switched to libwebp… Besides additional maintenance in the long run, this mostly seems to be a config issue for now. We'd have to undelete webpimg.c/h as well as bring back the old gd_webp.c (the collision with the new gd_webp.c would have to be resolved somehow), and we'd have to modifiy config.* accordingly. I'll have a look at your libvpx builds anyway. Do you have some documentation regarding the build process available? |
5.x must remain using vpx. 7 can go with webp. Vpx usage for webp is a call
|
Also vpx was fairly easy to build with vc9/11. Maybe they change some
|
Sorry but I think it is a bad idea which will introduce more confusion, and nightmare for downstream distribution which use system libgd. We should try to reduce diff with libgd upstream first, instead of increasing the mess. |
@cmb69 you mean the php build process? It's nothing special, just drop libvpx into deps and --with-libvpx ... for building the libvpx itself there are docs on the home page. @pierrejoye At the end - MSYS from MingW, but not a normal one - the one explicitly used by the Chromium deps is what has worked. It's a tool issue, obviously including my head :) IMHO we should hold on till 7.1, then we stand better with the overall stability. Thanks. |
Gd 2.2 will be released before 7. I do not think there are any issues with The PHP extension code does not depend at all on any of these libraries but If a distro uses the system library then php will provide the features the If a distro uses 7 and the bundled gd, libwebp will be installed too. It Or do I miss something?
|
I do not see why we should wait 7.1 but won't battle too much for it. Keeping in mind that libwebp is by far superior to libvpx custom
|
Ok, in this case i would pull this in beta2. Checked also Debian/Ubuntu and they all use the shared lib. On the other hand, it'll simplify the Windows maintanance part a lot, so probably is worthy. Thanks. |
Comment on behalf of ab at php.net: merged in beta2 |
However, several improvements have made to the bundled libgd which have not all been backported to upstream.
Thanks. However, it appears the issue is over now. :) |
If true, this is obviously not acceptable. |
See, for instance, my latest ticket for libgd. The clipping to the upper bounds had been implemented for the bundled libgd in 2003. I suspect that more changes had been made back then, which are not yet implemented upstream. Wrt. to recent changes see, for instance, reading webp is broken which had been reported two years ago. As apparently none of the libgd developers had the time to look into this issue, I have fixed it for the bundled libgd to be able to write a meaningful PHPT to test imagewebp() and imagecreatefromwebp() to be able to check at least the basic working of this PR, and of course to make imagecreatefromwebp() available at least to those who use the bundled libgd. BTW, imagewebp() has a similar severe issue which I fixed in the bundled libgd (and reported to upstream). |
There are no improvement (as in feature) in php-src's gd since 5.4 afaict. All new features go upstream first. Some features are only in PHP for BC
|
ext/gd/libgd/gd_webp.c has been taken from libgd[1]. Mainly, gd_error(X) has been subsituted by zend_error(E_ERROR, X) and BGD_DECLARE(X) by X. Further modifications are obvious from the diff. All GD tests are passing, what raises hope, but we need more WebP tests, anyway. [1] <https://github.com/libgd/libgd/blob/7ec030c4f1dae75ed5d82c3eed2abe6775742c75/src/gd_webp.c>
@weltling With respect to #1429 (comment) I did it with Cygwin. I am calling Cygwin as follows:
Then in Cygwin:
This generates a vpx.sln for VC 2013. Open this vpx.sln in VC14, upgrade all *.vcxproj's amd you are almost there. --target=x86-win32-vs11 should work as well, I guess. But I did not try that. Almost, because in the third_party\libyuv sources two commands are not compatible with VC14:
You can just remove those, because VC14 does the aligning. Once you get the grip of it, the process is fairly easy. Something to document on github/winlibs/libvpx |
@Jan-E you should principally avoid cygwin because it breaks anything possible on the system, you never know. Did you also build that project? Earlier version of libvpx was generating broken paths with cygwin. Anyway, MSYS worked now, but we don't need it now anyway. Thanks. |
All was done with the cl.exe, lib.exe and/or link.exe from the MSVC's on my system. Nothing native Cygwin. And in the end I just had a vpx.sln that I could open outside of Cygwin. |
Maybe cygwin has improved, but i'd better not to try to find out :) |
With libvpx 1.1.0 the paths are still broken. Libvpx has improved, Cygwin is still the same. See 'Configure The Build Root' at http://www.webmproject.org/code/build-prerequisites/
|
Or maybe both. MingW was anyway not much better to the time of libvpx 1.1.0, make was just crashing AFAIR. We have improved as well by not having to use all that. Thanks. |
If I want to integrate current gd master code in PHP 5.x by rebuilding from source code in order to fix some webp encoding problem, is there any problems or known issues ? |
@yanjiuhuang Which encoding problems have you found? Maybe these are resolved in PHP 5.6.12 (fixed bug #70102 (imagecreatefromwebm() shifts colors); fixed bug #66590 (imagewebp() doesn't pad to even length)); backporting these fixes, if necessary, might be easier for you. If there are still issue, please feel free to file a bug report. |
@remicollet Given the extended life of 5.6, I would be fine if we backport this PR to 5.6. To other, any opposition? |
Shouldn't be a problem for the Windows builds. I just created the static libs for VC11, using https://github.com/winlibs/libwebp and that went OK. |
Yes we use it already in 7.x. The question is about using it in 5.6+ as well.
|
Yes, I was referring to 5.6. Note the 'VC11'. |
Maybe we could backport the webp part so there's a choice between libwebp and libvpx in 5.6? Then it would allow to have consistent dependency without produce a BC breach. Thanks. |
See the respective bug report and a related discussion.