use CompressedImage in encoder internals; also partial fix to reversible dwt