summaryrefslogtreecommitdiffstats
path: root/video/out/vo_vdpau.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/vo_vdpau.c')
-rw-r--r--video/out/vo_vdpau.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index e6acc4067e..c8836a8639 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -234,6 +234,13 @@ static void forget_frames(struct vo *vo, bool seek_reset)
vc->dropped_frame = false;
}
+static int s_size(int s, int disp)
+{
+ disp = MPMAX(1, disp);
+ s += s / 2;
+ return s >= disp ? s : disp;
+}
+
static void resize(struct vo *vo)
{
struct vdpctx *vc = vo->priv;
@@ -259,16 +266,8 @@ static void resize(struct vo *vo)
if (vc->output_surface_width < vo->dwidth
|| vc->output_surface_height < vo->dheight) {
- if (vc->output_surface_width < vo->dwidth) {
- vc->output_surface_width += vc->output_surface_width >> 1;
- vc->output_surface_width = FFMAX(vc->output_surface_width,
- vo->dwidth);
- }
- if (vc->output_surface_height < vo->dheight) {
- vc->output_surface_height += vc->output_surface_height >> 1;
- vc->output_surface_height = FFMAX(vc->output_surface_height,
- vo->dheight);
- }
+ vc->output_surface_width = s_size(vc->output_surface_width, vo->dwidth);
+ vc->output_surface_height = s_size(vc->output_surface_height, vo->dheight);
// Creation of output_surfaces
for (int i = 0; i < vc->num_output_surfaces; i++)
if (vc->output_surfaces[i] != VDP_INVALID_HANDLE) {