Rescale a video resolution to a target width or height, constrained by aspect ratio and an optional power-of-2 base for codec compatibility.