From be259be15c762abe4aa67dd0c932c389105cabd4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 9 Apr 2015 21:11:20 +0200 Subject: mp_image: get rid of chroma_width/height fields They are redundant. They were used by draw_bmp.c only, and only in a special code path that 1. used fixed image formats, and 2. had image sized perfectly aligned to chroma boundaries (so computing the chroma width/height is trivial). --- sub/draw_bmp.c | 9 ++++----- video/mp_image.h | 2 -- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/sub/draw_bmp.c b/sub/draw_bmp.c index d9cb0522df..228d8a2dde 100644 --- a/sub/draw_bmp.c +++ b/sub/draw_bmp.c @@ -481,9 +481,9 @@ static struct mp_image *chroma_up(struct mp_draw_sub_cache *cache, int imgfmt, // The whole point is not having swscale copy the Y plane struct mp_image t_dst = *temp; mp_image_setfmt(&t_dst, IMGFMT_Y8); - mp_image_set_size(&t_dst, temp->chroma_width, temp->chroma_height); + mp_image_set_size(&t_dst, temp->w, temp->h); struct mp_image t_src = t_dst; - mp_image_set_size(&t_src, src->chroma_width, src->chroma_height); + mp_image_set_size(&t_src, src->w >> 1, src->h >> 1); for (int c = 0; c < 2; c++) { t_dst.planes[0] = temp->planes[1 + c]; t_dst.stride[0] = temp->stride[1 + c]; @@ -511,10 +511,9 @@ static void chroma_down(struct mp_image *old_src, struct mp_image *temp) assert(temp->planes[0] == old_src->planes[0]); struct mp_image t_dst = *temp; mp_image_setfmt(&t_dst, IMGFMT_Y8); - mp_image_set_size(&t_dst, old_src->chroma_width, - old_src->chroma_height); + mp_image_set_size(&t_dst, old_src->w >> 1, old_src->h >> 1); struct mp_image t_src = t_dst; - mp_image_set_size(&t_src, temp->chroma_width, temp->chroma_height); + mp_image_set_size(&t_src, temp->w, temp->h); for (int c = 0; c < 2; c++) { t_dst.planes[0] = old_src->planes[1 + c]; t_dst.stride[0] = old_src->stride[1 + c]; diff --git a/video/mp_image.h b/video/mp_image.h index 70931ffb55..16862f9882 100644 --- a/video/mp_image.h +++ b/video/mp_image.h @@ -96,8 +96,6 @@ typedef struct mp_image { int fields; /* redundant */ - int chroma_width; - int chroma_height; int plane_w[MP_MAX_PLANES]; int plane_h[MP_MAX_PLANES]; -- cgit v1.2.3