move jpeg parser utility functions up
fix huffman table decoding (with 0 elements bug)