Optimal Transition Probability of Reversible Data Hiding for General Distortion Metrics and Its Applications