libbpg (copy of the source code for easy access)