At its core, the viewer works by just averaging the JPEG stack at varying offsets as described in this student project: https://inst.eecs.berkeley.edu/~cs194-26/fa14/upload/files/p...
I haven't looked into how they make everything efficient, but the source code for their flash viewer is here http://lightfield.stanford.edu/aperture.html