Jon Olick
  • Home
  • Presentations
  • Publications
  • Patents
  • Videos
  • Code
  • Games
  • Art
  • Blogspot
  • Twitter
  • WikiCoder
  • Contact
  • Links
  • Home
  • Presentations
  • Publications
  • Patents
  • Videos
  • Code
  • Games
  • Art
  • Blogspot
  • Twitter
  • WikiCoder
  • Contact
  • Links
Contained in this page is a bunch of useful code. This page is still a WIP as I pick through stuff to upload to the site.

MPEG Writer

License: public domain
Features: Single File, 256 lines of C code, No memory allocation
jo_mpeg.cpp
File Size: 9 kb
File Type: cpp
Download File

GIF Writer

License: public domain
Features: Single File, Extremely small (398 LoC), No memory allocation
jo_gif.cpp
File Size: 13 kb
File Type: cpp
Download File

Simple Windows 2D Drawing Shim

License: public domain
jo_win_shim.cpp
File Size: 2 kb
File Type: cpp
Download File

Kodak Image Set 2x Super Resolution

License: public domain
kodak.zip
File Size: 84953 kb
File Type: zip
Download File

JPEG Writer

License: public domain
Features: Single File, Extremely small (336 LoC), No memory allocation
jo_jpeg.cpp
File Size: 19 kb
File Type: cpp
Download File

MPEG-1 Audio Layer 1 (MP1) Decoder

License: public domain
Features: Single File, Extremely small (397 LoC), No memory allocation
jo_mp1.cpp
File Size: 31 kb
File Type: cpp
Download File

Image Resizing

License: public domain
jo_resize.h
File Size: 20 kb
File Type: h
Download File

PCM/ADPCM WAV File Writing

License: public domain
jo_wav.h
File Size: 13 kb
File Type: h
Download File

TGA file Writer

    
WAV file writer

    
Bilinear texture sampling

    
HBAO Shader

    
DCT/IDCT 8x8

    
Portable fsync()

    
​Quality Experiments with Audio at various Bit Depths
These experiments are part of a twitter discussion on the quality of audio at various bitrates and its suitability as a super fast near lossless audio codec (a replacement for Flac) when combined with Zip or Lzma. The only artifacts from quantization is the volume of tape hiss and the dynamic range of the audio itself. Therefore if you can make the tape hiss inaudible, its pretty much equivalent to lossless. 

Try our your ears at this blind test between 8-bit and 16-bit audio here. 8-bit hiss is audible with quiet audio, but at 12-bits it becomes nearly inaudible at normal volume levels. 

Check out this download for some experiments. Contained in the Zip is the same audio at 1 to 16 bits per sample. The quantization method is naive and can certainly be better, but results are pretty good at bit depths >= 5.
archive.zip
File Size: 21663 kb
File Type: zip
Download File

Javascript NES emulator
  • Code on Github
  • Play some games
VA
​static const char *va(const char *fmt, ...) {
    static thread_local char tmp[0x10000];
    static thread_local int at = 0;
    char *ret = tmp+at;
    va_list args;
    va_start(args, fmt);
    at += 1 + vsnprintf(ret, sizeof(tmp)-at-1, fmt, args);
    va_end(args);
    if(at > sizeof(tmp) - 0x400) {
        at = 0;
    }
    return ret;
}
using C++ Lambdas as C callbacks