Move code from https://bitbucket.org/rallen/rajmipmap to here.
remove pd license since this is marked GPL3 from before
update