summaryrefslogtreecommitdiffstats
path: root/test
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
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')
-rw-r--r--test/img_format.c31
-rw-r--r--test/ref/img_formats.txt158
2 files changed, 97 insertions, 92 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");
}
}
diff --git a/test/ref/img_formats.txt b/test/ref/img_formats.txt
index 0a4c24eba6..71bbb288ca 100644
--- a/test/ref/img_formats.txt
+++ b/test/ref/img_formats.txt
@@ -517,9 +517,9 @@ gbrp1: fcsp=rgb ctype=uint
Basic desc: [ba][rgb][le]
planes=3, chroma=0:0 align=1:1
{8/[0:0] 8/[0:0] 8/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
+ 0: 8bits {} {} {} {}
+ 1: 8bits {} {} {} {}
+ 2: 8bits {} {} {} {}
Regular: planes=3 compbytes=1 bitpad=-7 chroma=1x1 ctype=uint
0: {2}
1: {3}
@@ -632,9 +632,9 @@ gbrp2: fcsp=rgb ctype=uint
Basic desc: [ba][rgb][le]
planes=3, chroma=0:0 align=1:1
{8/[0:0] 8/[0:0] 8/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
+ 0: 8bits {} {} {} {}
+ 1: 8bits {} {} {} {}
+ 2: 8bits {} {} {} {}
Regular: planes=3 compbytes=1 bitpad=-6 chroma=1x1 ctype=uint
0: {2}
1: {3}
@@ -643,9 +643,9 @@ gbrp3: fcsp=rgb ctype=uint
Basic desc: [ba][rgb][le]
planes=3, chroma=0:0 align=1:1
{8/[0:0] 8/[0:0] 8/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
+ 0: 8bits {} {} {} {}
+ 1: 8bits {} {} {} {}
+ 2: 8bits {} {} {} {}
Regular: planes=3 compbytes=1 bitpad=-5 chroma=1x1 ctype=uint
0: {2}
1: {3}
@@ -654,9 +654,9 @@ gbrp4: fcsp=rgb ctype=uint
Basic desc: [ba][rgb][le]
planes=3, chroma=0:0 align=1:1
{8/[0:0] 8/[0:0] 8/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
+ 0: 8bits {} {} {} {}
+ 1: 8bits {} {} {} {}
+ 2: 8bits {} {} {} {}
Regular: planes=3 compbytes=1 bitpad=-4 chroma=1x1 ctype=uint
0: {2}
1: {3}
@@ -665,9 +665,9 @@ gbrp5: fcsp=rgb ctype=uint
Basic desc: [ba][rgb][le]
planes=3, chroma=0:0 align=1:1
{8/[0:0] 8/[0:0] 8/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
+ 0: 8bits {} {} {} {}
+ 1: 8bits {} {} {} {}
+ 2: 8bits {} {} {} {}
Regular: planes=3 compbytes=1 bitpad=-3 chroma=1x1 ctype=uint
0: {2}
1: {3}
@@ -676,9 +676,9 @@ gbrp6: fcsp=rgb ctype=uint
Basic desc: [ba][rgb][le]
planes=3, chroma=0:0 align=1:1
{8/[0:0] 8/[0:0] 8/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
+ 0: 8bits {} {} {} {}
+ 1: 8bits {} {} {} {}
+ 2: 8bits {} {} {} {}
Regular: planes=3 compbytes=1 bitpad=-2 chroma=1x1 ctype=uint
0: {2}
1: {3}
@@ -828,8 +828,8 @@ grayaf32: ctype=float
Basic desc: [ba][a][yuvp][yuv][le]
planes=2, chroma=0:0 align=1:1
{32/[0:0] 32/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
+ 0: 32bits {} {} {} {}
+ 1: 32bits {} {} {} {}
Regular: planes=2 compbytes=4 bitpad=0 chroma=1x1 ctype=float
0: {1}
1: {4}
@@ -1190,8 +1190,8 @@ uyvy422: ctype=uint
Basic desc: [ba][yuv][le][be]
planes=1, chroma=1:0 align=2:1
{16/[0:0] }
- 0: 32bits w=2 {8:8} {0:8} {16:8} {}
- extra_luma_offsets=[ 24]
+ 0: 16bits {8:8} {0:8} {16:8} {}
+ luma_offsets=[ 8 24]
AVD: name=uyvy422 chroma=1:0 flags=0x0
0: p=0 st=2 o=1 sh=0 d=8
1: p=0 st=4 o=0 sh=0 d=8
@@ -1200,8 +1200,8 @@ uyyvyy411: [GENERIC] ctype=uint
Basic desc: [yuv][le][be]
planes=1, chroma=2:0 align=4:1
{12/[0:0] }
- 0: 48bits w=4 {8:8} {0:8} {24:8} {}
- extra_luma_offsets=[ 16 32 40]
+ 0: 12bits {8:8} {0:8} {24:8} {}
+ luma_offsets=[ 8 16 32 40]
AVD: name=uyyvyy411 chroma=2:0 flags=0x0
0: p=0 st=4 o=1 sh=0 d=8
1: p=0 st=6 o=0 sh=0 d=8
@@ -1269,15 +1269,15 @@ y1: fcsp=rgb ctype=uint
Basic desc: [ba][rgb][le]
planes=1, chroma=0:0 align=1:1
{8/[0:0] }
- 0: 0bits {} {} {} {}
+ 0: 8bits {} {} {} {}
Regular: planes=1 compbytes=1 bitpad=-7 chroma=1x1 ctype=uint
0: {1}
y210: [GENERIC] ctype=uint
Basic desc: [ba][yuv][le]
planes=1, chroma=1:0 align=2:1
{32/[0:0] }
- 0: 64bits w=2 {0:16/6} {16:16/6} {48:16/6} {}
- extra_luma_offsets=[ 32]
+ 0: 32bits {0:16/6} {16:16/6} {48:16/6} {}
+ luma_offsets=[ 0 32]
AVD: name=y210le chroma=1:0 flags=0x0
0: p=0 st=4 o=0 sh=6 d=10
1: p=0 st=8 o=2 sh=6 d=10
@@ -1286,8 +1286,8 @@ y210be: [GENERIC] ctype=uint
Basic desc: [ba][yuv][be]
planes=1, chroma=1:0 align=2:1
{32/[0:0] }
- 0: 64bits w=2 endian_bytes=2 {0:16/6} {16:16/6} {48:16/6} {}
- extra_luma_offsets=[ 32]
+ 0: 32bits endian_bytes=2 {0:16/6} {16:16/6} {48:16/6} {}
+ luma_offsets=[ 0 32]
AVD: name=y210be chroma=1:0 flags=0x1 [be]
0: p=0 st=4 o=0 sh=6 d=10
1: p=0 st=8 o=2 sh=6 d=10
@@ -1324,8 +1324,8 @@ yap16: ctype=uint
Basic desc: [ba][a][yuvp][yuv][le]
planes=2, chroma=0:0 align=1:1
{16/[0:0] 16/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
+ 0: 16bits {} {} {} {}
+ 1: 16bits {} {} {} {}
Regular: planes=2 compbytes=2 bitpad=0 chroma=1x1 ctype=uint
0: {1}
1: {4}
@@ -1333,8 +1333,8 @@ yap8: ctype=uint
Basic desc: [ba][a][yuvp][yuv][le]
planes=2, chroma=0:0 align=1:1
{8/[0:0] 8/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
+ 0: 8bits {} {} {} {}
+ 1: 8bits {} {} {} {}
Regular: planes=2 compbytes=1 bitpad=0 chroma=1x1 ctype=uint
0: {1}
1: {4}
@@ -1357,9 +1357,9 @@ yuv410pf: ctype=float
Basic desc: [ba][yuvp][yuv][le]
planes=3, chroma=2:2 align=4:4
{32/[0:0] 32/[2:2] 32/[2:2] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
+ 0: 32bits {} {} {} {}
+ 1: 32bits {} {} {} {}
+ 2: 32bits {} {} {} {}
Regular: planes=3 compbytes=4 bitpad=0 chroma=4x4 ctype=float
0: {1}
1: {2}
@@ -1383,9 +1383,9 @@ yuv411pf: ctype=float
Basic desc: [ba][yuvp][yuv][le]
planes=3, chroma=2:0 align=4:1
{32/[0:0] 32/[2:0] 32/[2:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
+ 0: 32bits {} {} {} {}
+ 1: 32bits {} {} {} {}
+ 2: 32bits {} {} {} {}
Regular: planes=3 compbytes=4 bitpad=0 chroma=4x1 ctype=float
0: {1}
1: {2}
@@ -1540,9 +1540,9 @@ yuv420pf: ctype=float
Basic desc: [ba][yuvp][yuv][le]
planes=3, chroma=1:1 align=2:2
{32/[0:0] 32/[1:1] 32/[1:1] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
+ 0: 32bits {} {} {} {}
+ 1: 32bits {} {} {} {}
+ 2: 32bits {} {} {} {}
Regular: planes=3 compbytes=4 bitpad=0 chroma=2x2 ctype=float
0: {1}
1: {2}
@@ -1696,9 +1696,9 @@ yuv422pf: ctype=float
Basic desc: [ba][yuvp][yuv][le]
planes=3, chroma=1:0 align=2:1
{32/[0:0] 32/[1:0] 32/[1:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
+ 0: 32bits {} {} {} {}
+ 1: 32bits {} {} {} {}
+ 2: 32bits {} {} {} {}
Regular: planes=3 compbytes=4 bitpad=0 chroma=2x1 ctype=float
0: {1}
1: {2}
@@ -1774,9 +1774,9 @@ yuv440pf: ctype=float
Basic desc: [ba][yuvp][yuv][le]
planes=3, chroma=0:1 align=1:2
{32/[0:0] 32/[0:1] 32/[0:1] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
+ 0: 32bits {} {} {} {}
+ 1: 32bits {} {} {} {}
+ 2: 32bits {} {} {} {}
Regular: planes=3 compbytes=4 bitpad=0 chroma=1x2 ctype=float
0: {1}
1: {2}
@@ -1931,9 +1931,9 @@ yuv444pf: ctype=float
Basic desc: [ba][yuvp][yuv][le]
planes=3, chroma=0:0 align=1:1
{32/[0:0] 32/[0:0] 32/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
+ 0: 32bits {} {} {} {}
+ 1: 32bits {} {} {} {}
+ 2: 32bits {} {} {} {}
Regular: planes=3 compbytes=4 bitpad=0 chroma=1x1 ctype=float
0: {1}
1: {2}
@@ -1942,10 +1942,10 @@ yuva410pf: ctype=float
Basic desc: [ba][a][yuvp][yuv][le]
planes=4, chroma=2:2 align=4:4
{32/[0:0] 32/[2:2] 32/[2:2] 32/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
- 3: 0bits {} {} {} {}
+ 0: 32bits {} {} {} {}
+ 1: 32bits {} {} {} {}
+ 2: 32bits {} {} {} {}
+ 3: 32bits {} {} {} {}
Regular: planes=4 compbytes=4 bitpad=0 chroma=4x4 ctype=float
0: {1}
1: {2}
@@ -1955,10 +1955,10 @@ yuva411pf: ctype=float
Basic desc: [ba][a][yuvp][yuv][le]
planes=4, chroma=2:0 align=4:1
{32/[0:0] 32/[2:0] 32/[2:0] 32/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
- 3: 0bits {} {} {} {}
+ 0: 32bits {} {} {} {}
+ 1: 32bits {} {} {} {}
+ 2: 32bits {} {} {} {}
+ 3: 32bits {} {} {} {}
Regular: planes=4 compbytes=4 bitpad=0 chroma=4x1 ctype=float
0: {1}
1: {2}
@@ -2079,10 +2079,10 @@ yuva420pf: ctype=float
Basic desc: [ba][a][yuvp][yuv][le]
planes=4, chroma=1:1 align=2:2
{32/[0:0] 32/[1:1] 32/[1:1] 32/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
- 3: 0bits {} {} {} {}
+ 0: 32bits {} {} {} {}
+ 1: 32bits {} {} {} {}
+ 2: 32bits {} {} {} {}
+ 3: 32bits {} {} {} {}
Regular: planes=4 compbytes=4 bitpad=0 chroma=2x2 ctype=float
0: {1}
1: {2}
@@ -2234,10 +2234,10 @@ yuva422pf: ctype=float
Basic desc: [ba][a][yuvp][yuv][le]
planes=4, chroma=1:0 align=2:1
{32/[0:0] 32/[1:0] 32/[1:0] 32/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
- 3: 0bits {} {} {} {}
+ 0: 32bits {} {} {} {}
+ 1: 32bits {} {} {} {}
+ 2: 32bits {} {} {} {}
+ 3: 32bits {} {} {} {}
Regular: planes=4 compbytes=4 bitpad=0 chroma=2x1 ctype=float
0: {1}
1: {2}
@@ -2247,10 +2247,10 @@ yuva440pf: ctype=float
Basic desc: [ba][a][yuvp][yuv][le]
planes=4, chroma=0:1 align=1:2
{32/[0:0] 32/[0:1] 32/[0:1] 32/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
- 3: 0bits {} {} {} {}
+ 0: 32bits {} {} {} {}
+ 1: 32bits {} {} {} {}
+ 2: 32bits {} {} {} {}
+ 3: 32bits {} {} {} {}
Regular: planes=4 compbytes=4 bitpad=0 chroma=1x2 ctype=float
0: {1}
1: {2}
@@ -2402,10 +2402,10 @@ yuva444pf: ctype=float
Basic desc: [ba][a][yuvp][yuv][le]
planes=4, chroma=0:0 align=1:1
{32/[0:0] 32/[0:0] 32/[0:0] 32/[0:0] }
- 0: 0bits {} {} {} {}
- 1: 0bits {} {} {} {}
- 2: 0bits {} {} {} {}
- 3: 0bits {} {} {} {}
+ 0: 32bits {} {} {} {}
+ 1: 32bits {} {} {} {}
+ 2: 32bits {} {} {} {}
+ 3: 32bits {} {} {} {}
Regular: planes=4 compbytes=4 bitpad=0 chroma=1x1 ctype=float
0: {1}
1: {2}
@@ -2460,8 +2460,8 @@ yuyv422: [GENERIC] ctype=uint
Basic desc: [ba][yuv][le][be]
planes=1, chroma=1:0 align=2:1
{16/[0:0] }
- 0: 32bits w=2 {0:8} {8:8} {24:8} {}
- extra_luma_offsets=[ 16]
+ 0: 16bits {0:8} {8:8} {24:8} {}
+ luma_offsets=[ 0 16]
AVD: name=yuyv422 chroma=1:0 flags=0x0
0: p=0 st=2 o=0 sh=0 d=8
1: p=0 st=4 o=1 sh=0 d=8
@@ -2470,8 +2470,8 @@ yvyu422: [GENERIC] ctype=uint
Basic desc: [ba][yuv][le][be]
planes=1, chroma=1:0 align=2:1
{16/[0:0] }
- 0: 32bits w=2 {0:8} {24:8} {8:8} {}
- extra_luma_offsets=[ 16]
+ 0: 16bits {0:8} {24:8} {8:8} {}
+ luma_offsets=[ 0 16]
AVD: name=yvyu422 chroma=1:0 flags=0x0
0: p=0 st=2 o=0 sh=0 d=8
1: p=0 st=4 o=3 sh=0 d=8