nothings / single_file_libs

List of single-file C/C++ libraries.
8.97k stars 589 forks source link

Add NanoJPEG #69

Closed dbohdan closed 7 years ago

dbohdan commented 7 years ago

From the webpage:

... Here are the bullet points:

  • decodes baseline JPEG only, no progressive or lossless JPEG
  • supports 8-bit grayscale and YCbCr images, no 16 bit, CMYK or other color spaces
  • supports any power-of-two chroma subsampling ratio
  • supports restart markers
  • the four points above mean that it should be able to decode all digital camera JPEG files and many other JPEG files
  • below 900 lines of code (and that already includes over 200 lines of comments and empty lines!)
  • converts YCbCr to RGB
  • uses a bicubic chrominance upsampling filter (this is actually better than the mere bilinear filter of libjpeg!)
  • a little slower than libjpeg
  • memory requirements: ~512 KiB (static) + 1x the decoded image size for grayscale images or 2x the decoded image size for color images
  • very simple API
  • input: memory dumps of JPEG files
  • output: memory dumps of raw, uncompressed 8-bit grayscale or 24-bit RGB pixels
  • output format is compatible to the PGM/PPM file formats as well as OpenGL GL_LUMINANCE8/GL_RGB8 texture formats
  • not fault-tolerant – any bitstream error will stop the decoder immediately and return an error to the application
  • 100% pure C code
  • no warnings with GCC 4.3 -pedantic and MSVC /W3
  • 32-bit integer arithmetic only
  • supposed to be endianness independent
  • 64-bit clean
  • not thread-safe
  • platform-independent
  • includes some provisions to build ultra-small Win32 executables
  • open source (free-beer, but maybe not really free-speech software)
  • single C file
  • batteries example program included

Despite what it says about "free-beer, but maybe not really free-speech software" the license is now MIT.