public short[] Interleave(short[] ll, short[] hl,
short[] lh, short[] hh, int width)
{
short[] o = new short[ll.Length*4];
int height = ll.Length / width;
for(int y = 0; y < height; y++) {
for(int x = 0; x < width; x++) {
int pos = (x + y*width);
int outpos = 2*x + 4*y*width;
o[outpos] = ll[pos];
o[outpos+1] = hl[pos];
o[outpos+2*width] = lh[pos];
o[outpos+2*width+1] = hh[pos];
}
}
return o;
}