select: Convert quick_select to use list-of-lists.

Pivot functions are no longer needed, so remove them.
gck: Fix incorrect calculation of sign bit.
gck: Consider width of target when interleaving bases.

The target width is not always the same as the number of bases.
An example is the luma and chroma planes of an image. Here
you can only interleave one color plane at a time, so the
actual width of the target is larger when taking other planes into
consideration.
gck: Preserve a more-realistic test for posterity.

Also some other miscellaneous changes.
select: Check for a valid swapbuf.
select: Return numerical index of median.

This is for consistency with the current median selection using
quicksort in kdtree. Trying to minimize code changes in kdtree
since that is more finicky.
select: Add a n-dimensional pivot function.

This is necessary since the quickselect algorithm doesn't
guarantee all medians will be ordered <= the median in the case
of multiple median values. So we add a function to take a second
pass over the data, pivoting everything around the median.
kdtree: Use GCK to produce a dense set of WHT coeffs.

This commit is too big, I'm sorry for not breaking it up better.