syoyo / tinygltf

Header only C++11 tiny glTF 2.0 library
MIT License
2.03k stars 410 forks source link

[Enhancement] Use wuffs/fpng for reading/writing images with better security and performance #410

Open syoyo opened 1 year ago

syoyo commented 1 year ago

Describe the issue

TinyGLTF currently uses stb_image, stb_image_write for reading/writing images. STB library is easy to use and embed, but has some security issues and slow to decode/encode(especially PNG)

are good alternative for reading/writing images with security/performance considered.

Support matrix

Expected behaviour

Add support to use wuffs and fpng(for PNG) for better security and performance. We also need a compile flag to disable using SIMD instrinsic for portability.

syoyo commented 1 year ago

wuffs jpeg decoder has been implemented: https://github.com/google/wuffs/blob/main/doc/std/image-decoders.md

Use wuffs-unsupported-snapshot.c for a while: https://github.com/google/wuffs/blob/main/release/c/wuffs-unsupported-snapshot.c (v0.3 does not support JPEG decoding)

syoyo commented 1 year ago

Created wuffs branch: https://github.com/syoyo/tinygltf/tree/wuffs