[Enhancement] Use wuffs/fpng for reading/writing images with better security and performance
syoyo opened this issue · 2 comments
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
- JPEG decoding: wuffs
- JPEG encoding: No support in wuffs. We still need stb_image_write to encode JPEG
- PNG decoding: wuffs or fpng
- PNG encodng: fpng
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.
- Add compile option to on/off SIMD instrinsics for better portablity
- fpng: https://github.com/richgel999/fpng/blob/main/src/fpng.cpp#L25
- wuffs:
WUFFS_CONFIG__AVOID_CPU_ARCH
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)
Created wuffs
branch: https://github.com/syoyo/tinygltf/tree/wuffs