summaryrefslogtreecommitdiffstats
path: root/test/img_format.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-05-19 23:58:36 +0200
committerwm4 <wm4@nowhere>2020-05-20 00:02:27 +0200
commit176f422213a6a72529f8a6394c34b06ff04f2fb3 (patch)
tree704624347a59a4c04a5858da4310b4ac6fad1c9e /test/img_format.c
parenta20ae0417f2d1e1a2c173f5eaf66a81974df0008 (diff)
downloadmpv-176f422213a6a72529f8a6394c34b06ff04f2fb3.tar.bz2
mpv-176f422213a6a72529f8a6394c34b06ff04f2fb3.tar.xz
video: shuffle imgfmt metadata code around
I guess I decided to stuff it all into mp_imgfmt_desc (the "old" struct). This is probably a mistake. At first I was afraid that this struct would get too fat (probably justified, and hereby happened), but on the other hand mp_imgfmt_get_desc() (which builds the struct) calls the former mp_imgfmt_get_layout(), and the separation doesn't make too much sense anyway. Just merge them. Still, try to keep out the extra info for packed YUV bullshit. I think the result is OK, and there's as much information as there was before. The test output changes a little. There's no independent bits[] array anymore, so formats which did not previously have set this now show it. (These formats are mpv-only and are still missing the metadata. To be added later). Also, the output for the cursed packed formats changes.
Diffstat (limited to 'test/img_format.c')
-rw-r--r--test/img_format.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/test/img_format.c b/test/img_format.c
index 02bda18bd4..f7a7354d1a 100644
--- a/test/img_format.c
+++ b/test/img_format.c
@@ -110,17 +110,12 @@ static void run(struct test_ctx *ctx)
fprintf(f, " [NODESC]\n");
}
- struct mp_imgfmt_layout pd;
- mp_imgfmt_get_layout(mpfmt, &pd);
-
for (int n = 0; n < d.num_planes; n++) {
- fprintf(f, " %d: %dbits", n, pd.bits[n]);
- if (pd.extra_w)
- fprintf(f, " w=%d", pd.extra_w + 1);
- if (pd.endian_bytes)
- fprintf(f, " endian_bytes=%d", pd.endian_bytes);
+ fprintf(f, " %d: %dbits", n, d.bpp[n]);
+ if (d.endian_shift)
+ fprintf(f, " endian_bytes=%d", 1 << d.endian_shift);
for (int x = 0; x < MP_NUM_COMPONENTS; x++) {
- struct mp_imgfmt_comp_desc cm = pd.comps[x];
+ struct mp_imgfmt_comp_desc cm = d.comps[x];
fprintf(f, " {");
if (cm.plane == n) {
if (cm.size) {
@@ -133,12 +128,22 @@ static void run(struct test_ctx *ctx)
}
}
fprintf(f, "}");
+ if (!(d.flags & (MP_IMGFLAG_PACKED_SS_YUV | MP_IMGFLAG_HAS_COMPS)))
+ {
+ assert(cm.size == 0);
+ assert(cm.offset == 0);
+ assert(cm.pad == 0);
+ }
}
fprintf(f, "\n");
- if (pd.extra_w) {
- fprintf(f, " extra_luma_offsets=[");
- for (int x = 0; x < pd.extra_w; x++)
- fprintf(f, " %d", pd.extra_luma_offsets[x]);
+ if (d.flags & MP_IMGFLAG_PACKED_SS_YUV) {
+ assert(!(d.flags & MP_IMGFLAG_HAS_COMPS));
+ uint8_t offsets[10];
+ bool r = mp_imgfmt_get_packed_yuv_locations(mpfmt, offsets);
+ assert(r);
+ fprintf(f, " luma_offsets=[");
+ for (int x = 0; x < d.align_x; x++)
+ fprintf(f, " %d", offsets[x]);
fprintf(f, "]\n");
}
}