Rate-distortion analysis for H.264/AVC video coding and its application to rate control