pnggroup / libpng

LIBPNG: Portable Network Graphics support, official libpng repository
http://libpng.sf.net
Other
1.25k stars 611 forks source link

Optimize png16 with loongson mmi for 64-bit os #521

Closed XiWeiGu closed 7 months ago

XiWeiGu commented 7 months ago

The author of PR #225 is no longer maintaining it. I have updated this portion of the code and made several fixes on top of it.

XiWeiGu commented 7 months ago

@jinboson,please help me review the code.

jbowler commented 7 months ago

For the record I feel that all hardware optimisations should require an explicit "switch on" in the build. All of them, without exception. I can test loongson compiles (I haven't tested this one) and I can test the compiles of, I believe, all the other hardware opts that are in there but I have no way of verifying that they work when run on the required very wide variety of hardware.

There's too much danger of whack-a-mole here with the wide range of different hardware available; fix one instance, break another. I had previously thought that compiler checks would be sufficient but anything that uses a run-time check of any form has the very real chance of failing on some hardware; this has happened in the past with Intel runtime checks.

ctruta commented 7 months ago

For the record I feel that all hardware optimisations should require an explicit "switch on" in the build.

I concur. This is what I want us to do in "libpng-ng".

But for libpng-1.6.x, that ship has sailed. The CMake file is rather atrocious, and it doesn't need to be. The configure script is even worse. The simplest of the makefiles (e.g. scripts/makefile.gcc) require that NOHWOPT thing (take a look!)

At the time of libpng-1.0, the makefiles were the second-simplest thing to use after

ls png*.c | xargs gcc

Now, of course, I understand the need of everything that came after that. And yet, grabbing all source files and writing a shell command or two on top of those should work intuitively, without requiring anything like -DPNG_OBSCURE_THING=1

The files scripts/makefile.* were broken for a very long time during the life of libpng-1.6.x, while nobody (myself included) was looking.

And, let's fix that.

jbowler commented 7 months ago

Agreed. But if you start with just *.[ch] you end up with the same mess. It's necessary to delete most of the code too. Much of it is never used and most of it is hardly used.

I guess I might try on my gentoo system with a pngusr.dfa that starts "everything=off". The big players have their own, heavily hacked, version of libpng and the small players, real people, don't need most of it.