We study the compression of polynomially samplable sources. In particular, we give efficient prefix-free compression and decompression algorithms for three classes of such sources (whose support is a subset of {0,1}^n).
1. We show how to compress sources X samplable by logspace machines to expected length H(X)+O(1).
Our next results concern flat sources whose support is in P:
2. If H(X) <= k = n-O(log n), we show how to compress to length k + delta*(n-k) for any constant delta>0; in quasi-polynomial time we show how to compress to length k + polylog(n-k) even if k = n - polylog(n).
3. If the support of X is the witness set for a self-reducible NP relation, then we show how to compress to expected length H(X) + 5.