diff options
author | wm4 <wm4@nowhere> | 2019-10-31 11:24:20 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-10-31 11:24:20 +0100 |
commit | 6d92e5550203b04b7254eb8ffe31734e57070d79 (patch) | |
tree | fcd9f88cddae110a8a65f9e7ea59703bd79f83c5 /sub | |
parent | 6fdfa7c9912ff9fda0ada6125bc4fed61b7220ea (diff) | |
download | mpv-6d92e5550203b04b7254eb8ffe31734e57070d79.tar.bz2 mpv-6d92e5550203b04b7254eb8ffe31734e57070d79.tar.xz |
Replace uses of FFMIN/MAX with MPMIN/MAX
And remove libavutil includes where possible.
Diffstat (limited to 'sub')
-rw-r--r-- | sub/draw_bmp.c | 7 | ||||
-rw-r--r-- | sub/img_convert.c | 16 | ||||
-rw-r--r-- | sub/osd_libass.c | 9 | ||||
-rw-r--r-- | sub/sd_lavc.c | 4 |
4 files changed, 16 insertions, 20 deletions
diff --git a/sub/draw_bmp.c b/sub/draw_bmp.c index 4125fc3009..a4847b1534 100644 --- a/sub/draw_bmp.c +++ b/sub/draw_bmp.c @@ -22,7 +22,6 @@ #include <inttypes.h> #include <libswscale/swscale.h> -#include <libavutil/common.h> #include "common/common.h" #include "draw_bmp.h" @@ -161,9 +160,9 @@ static void unpremultiply_and_split_BGR32(struct mp_image *img, int div = (int) aval; int add = div / 2; if (aval) { - rval = FFMIN(255, (rval * 255 + add) / div); - gval = FFMIN(255, (gval * 255 + add) / div); - bval = FFMIN(255, (bval * 255 + add) / div); + rval = MPMIN(255, (rval * 255 + add) / div); + gval = MPMIN(255, (gval * 255 + add) / div); + bval = MPMIN(255, (bval * 255 + add) / div); irow[x] = bval + (gval << 8) + (rval << 16) + (aval << 24); } arow[x] = aval; diff --git a/sub/img_convert.c b/sub/img_convert.c index 0ce5c7ac0a..a70bb0a24c 100644 --- a/sub/img_convert.c +++ b/sub/img_convert.c @@ -17,9 +17,7 @@ #include <string.h> #include <assert.h> - -#include <libavutil/mem.h> -#include <libavutil/common.h> +#include <limits.h> #include "mpv_talloc.h" @@ -52,15 +50,15 @@ bool mp_sub_bitmaps_bb(struct sub_bitmaps *imgs, struct mp_rect *out_bb) struct mp_rect bb = {INT_MAX, INT_MAX, INT_MIN, INT_MIN}; for (int n = 0; n < imgs->num_parts; n++) { struct sub_bitmap *p = &imgs->parts[n]; - bb.x0 = FFMIN(bb.x0, p->x); - bb.y0 = FFMIN(bb.y0, p->y); - bb.x1 = FFMAX(bb.x1, p->x + p->dw); - bb.y1 = FFMAX(bb.y1, p->y + p->dh); + bb.x0 = MPMIN(bb.x0, p->x); + bb.y0 = MPMIN(bb.y0, p->y); + bb.x1 = MPMAX(bb.x1, p->x + p->dw); + bb.y1 = MPMAX(bb.y1, p->y + p->dh); } // avoid degenerate bounding box if empty - bb.x0 = FFMIN(bb.x0, bb.x1); - bb.y0 = FFMIN(bb.y0, bb.y1); + bb.x0 = MPMIN(bb.x0, bb.x1); + bb.y0 = MPMIN(bb.y0, bb.y1); *out_bb = bb; diff --git a/sub/osd_libass.c b/sub/osd_libass.c index e51b7f4048..d5f7bb82bf 100644 --- a/sub/osd_libass.c +++ b/sub/osd_libass.c @@ -15,13 +15,12 @@ * License along with mpv. If not, see <http://www.gnu.org/licenses/>. */ +#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> -#include <libavutil/common.h> - #include "config.h" #include "mpv_talloc.h" @@ -288,7 +287,7 @@ struct ass_draw { static void ass_draw_start(struct ass_draw *d) { - d->scale = FFMAX(d->scale, 1); + d->scale = MPMAX(d->scale, 1); d->text = talloc_asprintf_append(d->text, "{\\p%d}", d->scale); } @@ -368,9 +367,9 @@ static void get_osd_bar_box(struct osd_state *osd, struct osd_object *obj, float base_size = 0.03125; style->Outline *= *o_h / track->PlayResY / base_size; // So that the chapter marks have space between them - style->Outline = FFMIN(style->Outline, *o_h / 5.2); + style->Outline = MPMIN(style->Outline, *o_h / 5.2); // So that the border is not 0 - style->Outline = FFMAX(style->Outline, *o_h / 32.0); + style->Outline = MPMAX(style->Outline, *o_h / 32.0); // Rendering with shadow is broken (because there's more than one shape) style->Shadow = 0; diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index 72c89913e0..d2e21fbd2b 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -249,8 +249,8 @@ static void read_sub_bitmaps(struct sd *sd, struct sub *sub) b->stride = sub->data->stride[0]; b->bitmap = sub->data->planes[0] + pos.y * b->stride + pos.x * 4; - sub->src_w = FFMAX(sub->src_w, b->x + b->w); - sub->src_h = FFMAX(sub->src_h, b->y + b->h); + sub->src_w = MPMAX(sub->src_w, b->x + b->w); + sub->src_h = MPMAX(sub->src_h, b->y + b->h); assert(r->nb_colors > 0); assert(r->nb_colors <= 256); |