Dynamic reference frames in video coding