diff options
author | wm4 <wm4@nowhere> | 2019-10-20 01:39:38 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-10-20 01:44:22 +0200 |
commit | df8a0ecbf32dd9af914ceb67df1861743b84f1e8 (patch) | |
tree | 81df10aead03f3bee91e8987730aaebadab5d847 /video | |
parent | 986daac45e4a7345ad47c79ac8f663e91e724442 (diff) | |
download | mpv-df8a0ecbf32dd9af914ceb67df1861743b84f1e8.tar.bz2 mpv-df8a0ecbf32dd9af914ceb67df1861743b84f1e8.tar.xz |
img_format: update test program
The plane pointer checking assert() triggered at least on gray8, because
that has a "pseudo palettes" in ffmpeg, which mpv refuses to allocate.
Remove a strange duplicated printf().
Log the component type where available.
(Why is this even here, I hate it when there are commented test programs
in source files.)
Diffstat (limited to 'video')
-rw-r--r-- | video/img_format.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/video/img_format.c b/video/img_format.c index be81e15b41..0ac943b6f0 100644 --- a/video/img_format.c +++ b/video/img_format.c @@ -526,9 +526,6 @@ int main(int argc, char **argv) printf(" 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); - printf(" 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); printf(" {"); for (int n = 0; n < MP_MAX_PLANES; n++) printf("%d/%d/[%d:%d] ", d.bytes[n], d.bpp[n], d.xs[n], d.ys[n]); @@ -545,18 +542,29 @@ int main(int argc, char **argv) assert(mpi); // A rather fuzzy test, which might fail even if there's no bug. for (int n = 0; n < 4; n++) { - assert(!!mpi->planes[n] == !!fr->data[n]); - assert(mpi->stride[n] == fr->linesize[n]); + if (!!mpi->planes[n] != !!fr->data[n]) { + printf(" Warning: p%d: %p %p\n", n, + mpi->planes[n], fr->data[n]); + } + if (mpi->stride[n] != fr->linesize[n]) { + printf(" Warning: p%d: %d %d\n", n, + mpi->stride[n], fr->linesize[n]); + } } talloc_free(mpi); av_frame_free(&fr); } struct mp_regular_imgfmt reg; if (mp_get_regular_imgfmt(®, mpfmt)) { - printf(" Regular: %d planes, %d bytes per comp., %d bit-pad " - "%dx%d chroma\n", + const char *type = "unknown"; + switch (reg.component_type) { + case MP_COMPONENT_TYPE_UINT: type = "uint"; break; + case MP_COMPONENT_TYPE_FLOAT: type = "float"; break; + } + printf(" Regular: %d planes, %d bytes per comp., %d bit-pad, " + "%dx%d chroma, type=%s\n", reg.num_planes, reg.component_size, reg.component_pad, - reg.chroma_w, reg.chroma_h); + reg.chroma_w, reg.chroma_h, type); for (int n = 0; n < reg.num_planes; n++) { struct mp_regular_imgfmt_plane *plane = ®.planes[n]; printf(" %d: {", n); |