summaryrefslogtreecommitdiffstats
path: root/video/sws_utils.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-05-17 14:57:13 +0200
committerwm4 <wm4@nowhere>2020-05-18 01:54:59 +0200
commitcaee8748da5c25b928f699bfa9f1ac4a5f3ae0ce (patch)
tree492d46f6ab40eee4c5b3e17b3666d21843db4166 /video/sws_utils.c
parent00ac63c37b18ef3e7fbe5c227eb10073b264a26a (diff)
downloadmpv-caee8748da5c25b928f699bfa9f1ac4a5f3ae0ce.tar.bz2
mpv-caee8748da5c25b928f699bfa9f1ac4a5f3ae0ce.tar.xz
video: clean up some imgfmt related stuff
Remove the vaguely defined plane_bits and component_bits fields from struct mp_imgfmt_desc. Add weird replacements for existing uses. Remove the bytes[] field, replace uses with bpp[]. Fix some potential alignment issues in existing code. As a compromise, split mp_image_pixel_ptr() into 2 functions, because I think it's a bad idea to implicitly round, but for some callers being slightly less strict is convenient. This shouldn't really change anything. In fact, it's a 100% useless change. I'm just cleaning up what I started almost 8 years ago (see commit 00653a3eb052). With this I've decided to keep mp_imgfmt_desc, just removing the weird parts, and keeping the saner parts.
Diffstat (limited to 'video/sws_utils.c')
-rw-r--r--video/sws_utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/video/sws_utils.c b/video/sws_utils.c
index faa61670b1..800e4f34b3 100644
--- a/video/sws_utils.c
+++ b/video/sws_utils.c
@@ -400,7 +400,7 @@ struct mp_image *mp_img_swap_to_native(struct mp_image *img)
}
if (to == AV_PIX_FMT_NONE || !mp_image_make_writeable(img))
return img;
- int elems = img->fmt.bytes[0] / 2 * img->w;
+ int elems = img->fmt.bpp[0] / 8 / 2 * img->w;
for (int y = 0; y < img->h; y++) {
uint16_t *p = (uint16_t *)(img->planes[0] + y * img->stride[0]);
for (int i = 0; i < elems; i++)