From 6d92e5550203b04b7254eb8ffe31734e57070d79 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 31 Oct 2019 11:24:20 +0100 Subject: Replace uses of FFMIN/MAX with MPMIN/MAX And remove libavutil includes where possible. --- video/out/bitmap_packer.c | 18 +++++++++--------- video/out/gpu/osd.c | 6 ++---- video/out/vo_vdpau.c | 12 +++++------- 3 files changed, 16 insertions(+), 20 deletions(-) (limited to 'video') diff --git a/video/out/bitmap_packer.c b/video/out/bitmap_packer.c index 5169357e3a..4f7739f514 100644 --- a/video/out/bitmap_packer.c +++ b/video/out/bitmap_packer.c @@ -116,9 +116,9 @@ static int pack_rectangles(struct pos *in, struct pos *out, int num_rects, if (maxy < 0) stack[stackpos++] = s; s.x = right; - maxy = FFMAX(maxy, bottom); + maxy = MPMAX(maxy, bottom); } - *used_width = FFMAX(*used_width, s.x); + *used_width = MPMAX(*used_width, s.x); if (maxy > 0) s.bottom = maxy; } @@ -144,8 +144,8 @@ int packer_pack(struct bitmap_packer *packer) fprintf(stderr, "Invalid OSD / subtitle bitmap size\n"); abort(); } - xmax = FFMAX(xmax, in[i].x); - ymax = FFMAX(ymax, in[i].y); + xmax = MPMAX(xmax, in[i].x); + ymax = MPMAX(ymax, in[i].y); } if (xmax > packer->w) packer->w = 1 << (av_log2(xmax - 1) + 1); @@ -157,8 +157,8 @@ int packer_pack(struct bitmap_packer *packer) packer->w, packer->h, packer->scratch, &used_width); if (y >= 0) { - packer->used_width = FFMIN(used_width, packer->w); - packer->used_height = FFMIN(y, packer->h); + packer->used_width = MPMIN(used_width, packer->w); + packer->used_height = MPMIN(y, packer->h); assert(packer->w == 0 || IS_POWER_OF_2(packer->w)); assert(packer->h == 0 || IS_POWER_OF_2(packer->h)); if (packer->padding) { @@ -172,9 +172,9 @@ int packer_pack(struct bitmap_packer *packer) int w_max = packer->w_max > 0 ? packer->w_max : INT_MAX; int h_max = packer->h_max > 0 ? packer->h_max : INT_MAX; if (packer->w <= packer->h && packer->w != w_max) - packer->w = FFMIN(packer->w * 2, w_max); + packer->w = MPMIN(packer->w * 2, w_max); else if (packer->h != h_max) - packer->h = FFMIN(packer->h * 2, h_max); + packer->h = MPMIN(packer->h * 2, h_max); else { packer->w = w_orig; packer->h = h_orig; @@ -188,7 +188,7 @@ void packer_set_size(struct bitmap_packer *packer, int size) packer->count = size; if (size <= packer->asize) return; - packer->asize = FFMAX(packer->asize * 2, size); + packer->asize = MPMAX(packer->asize * 2, size); talloc_free(packer->result); talloc_free(packer->scratch); packer->in = talloc_realloc(packer, packer->in, struct pos, packer->asize); diff --git a/video/out/gpu/osd.c b/video/out/gpu/osd.c index 3ab11fcb2b..63a04481d2 100644 --- a/video/out/gpu/osd.c +++ b/video/out/gpu/osd.c @@ -19,8 +19,6 @@ #include #include -#include - #include "common/common.h" #include "common/msg.h" #include "video/csputils.h" @@ -140,8 +138,8 @@ static bool upload_osd(struct mpgl_osd *ctx, struct mpgl_osd_part *osd, ra_tex_free(ra, &osd->texture); osd->format = imgs->format; - osd->w = FFMAX(32, req_w); - osd->h = FFMAX(32, req_h); + osd->w = MPMAX(32, req_w); + osd->h = MPMAX(32, req_h); MP_VERBOSE(ctx, "Reallocating OSD texture to %dx%d.\n", osd->w, osd->h); diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c index 6bbd4f9e92..177fd5e270 100644 --- a/video/out/vo_vdpau.c +++ b/video/out/vo_vdpau.c @@ -31,8 +31,6 @@ #include #include -#include - #include "config.h" #include "video/vdpau.h" #include "video/vdpau_mixer.h" @@ -810,7 +808,7 @@ static void flip_page(struct vo *vo) * not make the target time in reality. Without this check we could drop * every frame, freezing the display completely if video lags behind. */ - if (now > PREV_VSYNC(FFMAX(pts, vc->last_queue_time + vc->vsync_interval))) + if (now > PREV_VSYNC(MPMAX(pts, vc->last_queue_time + vc->vsync_interval))) npts = UINT64_MAX; /* Allow flipping a frame at a vsync if its presentation time is a @@ -837,15 +835,15 @@ static void flip_page(struct vo *vo) vc->dropped_time = ideal_pts; - pts = FFMAX(pts, vc->last_queue_time + vc->vsync_interval); - pts = FFMAX(pts, now); + pts = MPMAX(pts, vc->last_queue_time + vc->vsync_interval); + pts = MPMAX(pts, now); if (npts < PREV_VSYNC(pts) + vc->vsync_interval) goto drop; int num_flips = update_presentation_queue_status(vo); vsync = vc->recent_vsync_time + num_flips * vc->vsync_interval; - pts = FFMAX(pts, now); - pts = FFMAX(pts, vsync + (vc->vsync_interval >> 2)); + pts = MPMAX(pts, now); + pts = MPMAX(pts, vsync + (vc->vsync_interval >> 2)); vsync = PREV_VSYNC(pts); if (npts < vsync + vc->vsync_interval) goto drop; -- cgit v1.2.3