Also adds fakeexpand mode and dedup support.
This is useful for dumping to high-precision YUV.Note that this code is very preliminary and thus probably very buggy.