optimize decompress jpg data and fix warnings