You can do the compression in two passes.