Fast algorithm for n-dimensional DCT
Since these are very short vector lengths, a &quot;conventional&quot; fast transform is not going to give you any gains.
Your best bet is probably to hand code each possible transform length indivdiually, unrolling all the loops and taking advantage of all &quot;trivial &quot; coefficients manually.
Another option could be to reduce the dimonsionality of the data but that depends how much codec gain you get in each dimension. If there is one dimension that has most of the codec gain, you can keep this and just linearize the other ones.