Centralized and distributed semi-parametric compression of piecewise smooth functions