diff options
author | wm4 <wm4@nowhere> | 2020-05-17 14:57:13 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-05-18 01:54:59 +0200 |
commit | caee8748da5c25b928f699bfa9f1ac4a5f3ae0ce (patch) | |
tree | 492d46f6ab40eee4c5b3e17b3666d21843db4166 /test/img_format.c | |
parent | 00ac63c37b18ef3e7fbe5c227eb10073b264a26a (diff) | |
download | mpv-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 'test/img_format.c')
-rw-r--r-- | test/img_format.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/img_format.c b/test/img_format.c index 2e4e899203..9cd8186ab6 100644 --- a/test/img_format.c +++ b/test/img_format.c @@ -82,7 +82,7 @@ static void run(struct test_ctx *ctx) struct mp_imgfmt_desc d = mp_imgfmt_get_desc(mpfmt); if (d.id) { - fprintf(f, " Legacy desc: "); + fprintf(f, " Basic desc: "); #define FLAG(t, c) if (d.flags & (t)) fprintf(f, "[%s]", c); FLAG(MP_IMGFLAG_BYTE_ALIGNED, "ba") FLAG(MP_IMGFLAG_ALPHA, "a") @@ -95,13 +95,15 @@ static void run(struct test_ctx *ctx) FLAG(MP_IMGFLAG_PAL, "pal") FLAG(MP_IMGFLAG_HWACCEL, "hw") fprintf(f, "\n"); - fprintf(f, " planes=%d, chroma=%d:%d align=%d:%d bits=%d cbits=%d\n", - d.num_planes, d.chroma_xs, d.chroma_ys, d.align_x, d.align_y, - d.plane_bits, d.component_bits); + fprintf(f, " planes=%d, chroma=%d:%d align=%d:%d\n", + d.num_planes, d.chroma_xs, d.chroma_ys, d.align_x, d.align_y); fprintf(f, " {"); for (int n = 0; n < MP_MAX_PLANES; n++) { - fprintf(f, "%d/%d/[%d:%d] ", d.bytes[n], d.bpp[n], - d.xs[n], d.ys[n]); + if (n >= d.num_planes) { + assert(d.bpp[n] == 0 && d.xs[n] == 0 && d.ys[n] == 0); + continue; + } + fprintf(f, "%d/[%d:%d] ", d.bpp[n], d.xs[n], d.ys[n]); } fprintf(f, "}\n"); } else { |