Statistics for Image and Video Coding/Transcoding: A Rate Distortion Approach