Nanojpeg C++ port ported to Java without errors, but subtle errors may exist. These errors will be most likely due to incorrect offsets (the C++ version used pointer aliases and array notation to step through memory, translated to Java by introducing stateful offset values) also, other subtle errors may exist due to the strangeness of the java signed byte type (need to 0xFF & x in some places). This is just a point where the decoder is syntatically correct.