1import vapoursynth as vs
2core = vs.core
3
4colorfamilies = (vs.GRAY, vs.YUV, vs.RGB, vs.YCOCG)
5intbitdepths = (8, 9, 10, 11, 12, 13, 14, 15, 16)
6floatbitdepths = (16, 32)
7yuvss = (0, 1, 2)
8
9formatids = []
10
11for cfs in colorfamilies:
12    for bps in intbitdepths:
13        if cfs in (vs.YUV, vs.YCOCG):
14            for wss in yuvss:
15                for hss in yuvss:
16                    formatids.append(core.register_format(cfs, vs.INTEGER, bps, wss, hss).id)
17        else:
18            formatids.append(core.register_format(cfs, vs.INTEGER, bps, 0, 0).id)
19
20for cfs in colorfamilies:
21    for bps in floatbitdepths:
22        if cfs in (vs.YUV, vs.YCOCG):
23            for wss in yuvss:
24                for hss in yuvss:
25                    formatids.append(core.register_format(cfs, vs.FLOAT, bps, wss, hss).id)
26        else:
27            formatids.append(core.register_format(cfs, vs.FLOAT, bps, 0, 0).id)
28
29print(len(formatids))
30
31cid = 0
32
33for informat in formatids:
34    cid = cid + 1
35    print(cid)
36    for outformat in formatids:
37        clip = core.std.BlankClip(format=informat)
38        try:
39            if (clip.format.color_family in (vs.YUV, vs.GRAY)):
40                clip = core.resize.Bicubic(clip, format=outformat, matrix_in_s="709")
41            elif (core.get_format(outformat).color_family in (vs.YUV, vs.GRAY)):
42                clip = core.resize.Bicubic(clip, format=outformat, matrix_s="709")
43            else:
44                clip = core.resize.Bicubic(clip, format=outformat)
45            clip.get_frame(0)
46        except vs.Error as e:
47            print(core.get_format(informat).name + ' ' + core.get_format(outformat).name)
48            print(e)
49
50