summaryrefslogtreecommitdiffstats
path: root/video/img_format.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/img_format.c')
-rw-r--r--video/img_format.c95
1 files changed, 0 insertions, 95 deletions
diff --git a/video/img_format.c b/video/img_format.c
index ace8159ecf..4028bf0e0b 100644
--- a/video/img_format.c
+++ b/video/img_format.c
@@ -534,98 +534,3 @@ int mp_imgfmt_select_best_list(int *dst, int num_dst, int src)
best = best ? mp_imgfmt_select_best(best, dst[n], src) : dst[n];
return best;
}
-
-#if 0
-
-#include <libavutil/frame.h>
-#include "sws_utils.h"
-
-int main(int argc, char **argv)
-{
- const AVPixFmtDescriptor *avd = av_pix_fmt_desc_next(NULL);
- for (; avd; avd = av_pix_fmt_desc_next(avd)) {
- enum AVPixelFormat fmt = av_pix_fmt_desc_get_id(avd);
- if (fmt == AV_PIX_FMT_YUVJ420P || fmt == AV_PIX_FMT_YUVJ422P ||
- fmt == AV_PIX_FMT_YUVJ444P || fmt == AV_PIX_FMT_YUVJ440P)
- continue;
- printf("%s (%d)", avd->name, (int)fmt);
- int mpfmt = pixfmt2imgfmt(fmt);
- bool generic = mpfmt >= IMGFMT_AVPIXFMT_START &&
- mpfmt < IMGFMT_AVPIXFMT_END;
- printf(" mp=%d%s\n ", mpfmt, generic ? " [GENERIC]" : "");
- struct mp_imgfmt_desc d = mp_imgfmt_get_desc(mpfmt);
- if (d.id)
- assert(d.avformat == fmt);
-#define FLAG(t, c) if (d.flags & (t)) printf("[%s]", c);
- FLAG(MP_IMGFLAG_BYTE_ALIGNED, "BA")
- FLAG(MP_IMGFLAG_ALPHA, "a")
- FLAG(MP_IMGFLAG_YUV_P, "YUVP")
- FLAG(MP_IMGFLAG_YUV_NV, "NV")
- FLAG(MP_IMGFLAG_YUV, "yuv")
- FLAG(MP_IMGFLAG_RGB, "rgb")
- FLAG(MP_IMGFLAG_LE, "le")
- FLAG(MP_IMGFLAG_BE, "be")
- FLAG(MP_IMGFLAG_PAL, "pal")
- FLAG(MP_IMGFLAG_HWACCEL, "hw")
- int fcsp = mp_imgfmt_get_forced_csp(mpfmt);
- if (fcsp)
- printf(" fcsp=%d", fcsp);
- printf(" ctype=%d", mp_imgfmt_get_component_type(mpfmt));
- printf("\n");
- 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]);
- printf("}\n");
- if (mpfmt && !(d.flags & MP_IMGFLAG_HWACCEL) && fmt != AV_PIX_FMT_UYYVYY411)
- {
- AVFrame *fr = av_frame_alloc();
- fr->format = fmt;
- fr->width = 128;
- fr->height = 128;
- int err = av_frame_get_buffer(fr, MP_IMAGE_BYTE_ALIGN);
- assert(err >= 0);
- struct mp_image *mpi = mp_image_alloc(mpfmt, fr->width, fr->height);
- assert(mpi);
- // A rather fuzzy test, which might fail even if there's no bug.
- for (int n = 0; n < 4; 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(&reg, mpfmt)) {
- 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, type);
- for (int n = 0; n < reg.num_planes; n++) {
- struct mp_regular_imgfmt_plane *plane = &reg.planes[n];
- printf(" %d: {", n);
- for (int i = 0; i < plane->num_components; i++) {
- if (i > 0)
- printf(", ");
- printf("%d", plane->components[i]);
- }
- printf("}\n");
- }
- }
- }
-}
-
-#endif