mpegvideo: move frame size dependent memory management to separate functions