added support for getting the magz_ref from metadata
added magzp and scale reading for image info

Also cleaned up pointer arith