diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/img_format.c | 31 | ||||
-rw-r--r-- | test/ref/img_formats.txt | 158 |
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 |