Slow PNG encode? Memory stick issue?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

bulb
Posts: 50
Joined: Thu Jan 19, 2006 10:59 pm

Post by bulb »

patpsp,

I would advise against changing the libpng sources. Why? Because you would have to do that everytime the libpng would get updated. Not to mention every time check for the changes in library, so that file IO and memory management functions would not be used elsewhere.

It is better to register to WriteToFile callback (see png_set_write_fn), where you receive small encoded buffer that you could either write to file or copy to larger buffer that will be written to file when the time is right. I used the latter method and it works like a charm.

I would also advise against changing the CRT library sources.

In using this callback you have only less than an hour work and in case of new library release no maintenance whatsoever. On the other hand, you will spend the same amount of time to change the sources and a life time maintenance work.

Don't do more than needed. Good programmer is lazy programmer. :)
Post Reply