add rate_distortionTest function