dagon icon indicating copy to clipboard operation
dagon copied to clipboard

Port stb_image to D?

Open gecko0307 opened this issue 3 years ago • 3 comments

It makes sence to port stb_image to D and thereby get rid of linking to a static library.

  • #74 suggests that the library may end up configuration specific and fail to link in some circumstances. Also precompiled libraries are currently only for Windows and Linux, and that makes the engine less portable. D version guarantees full portability
  • In fact, we only need image decoders that read from memory. Encoders and filesystem-related functionality in stb_image are unnecessary
  • Such port may be included in dlib 2.0 in future.

Obvious disadvantage is that changes from the original C version can't be easily applied to D version. So this is going to be a full-blown fork with serious discrepancies.

gecko0307 avatar Jan 25 '22 19:01 gecko0307

If you go that way, Walter Bright has an article on how to minimize the pain of converting C to D, if you haven't seen it already.

Out of curiosity, why did you stop using your own dlib.image?

Eric-P7 avatar Jan 26 '22 00:01 Eric-P7

It turned out that stb is much faster. I haven't compared them in detail, perhaps dlib.image can be improved, so porting stb to D will be a step towards this goal.

gecko0307 avatar Jan 26 '22 06:01 gecko0307

Thanks to recent optimization that makes dlib decoders perform not much worse than stb, this has lower priority now.

But stb is still useful to support progressive JPEG, so I'll keep the issue open.

gecko0307 avatar Aug 23 '22 12:08 gecko0307

I've decided to close this as impractical and too labor-consuming. I'd rather add progressive JPEG support to dlib (though I have no idea when 🤪)

gecko0307 avatar Jan 24 '24 21:01 gecko0307