MAINT: refactor packbits/unpackbits

Pushes the GIL release one loop outward.
Note it doesn't handle negative values of `axis`.