View Full Version : Unit-Testing Avisynth?
MysteryX
29th October 2021, 15:48
Has anyone ever developed a Unit-Testing framework for Avisynth?
It has become increasingly popular in the programming world; it increases development time but greatly reduces debugging time, reduces bugs and increases stability.
In Avisynth, it's particularly a pain to test all the various pixel formats (and CPU optimization flgas?), and personally I often completely overlook formats like YUY2 and YUV411 and can't tell how it would behave.
Resizing/resampling libraries can in particular be a pain in the butt to test all the possibilities. Does it handle chroma position correctly in all scenarios?
If we could run series of automated tests in Avisynth/VapourSynth, that would test all the formats, flags and options and check the output -- at the minimum ensuring it doesn't crash. That could be very useful.
Then when you find a bug:
1) create a unit test that reproduces the bug and fails
2) fix the code until the test passes
3) you'll be sure that bug won't ever re-appear again
wonkey_monkey
29th October 2021, 18:05
In Avisynth, it's particularly a pain to test all the various pixel formats [...], and personally I often completely overlook formats like YUY2 and YUV411 and can't tell how it would behave.
That's what DebugColourSpaces (https://forum.doom9.org/showthread.php?t=182817) is for.
StainlessS
29th October 2021, 19:19
by MX,
I often completely overlook formats like YUY2 and YUV411
Maybe something in this thread is also of use.
[ All AVS+ Colorspaces [for testing] ]:- https://forum.doom9.org/showthread.php?t=182703
EDIT: from above thread:
ColorSpaceInfo_Testing_123
Alt=0 Alt=1 Alt=2 Alt=3 : Full Imp Bpc RGB Chans Planar HSubS VSubS Dupe
------------------------------------------------------------------------------------------------------------------
1] YUY2 YUY2 YUY2 YUY2 : $0240 v2.58 8 False 3 False 1 0 False
2] RGB24 RGB24 RGB24 RGB24 : $0060 v2.58 8 True 3 False 0 0 False
3] RGB32 RGB32 RGB32 RGB32 : $00A0 v2.58 8 True 4 False 0 0 False
4] YV12 YV12 YUV420 YUV420P8 : $8B40 v2.58 8 False 3 True 1 1 True
5] YV16 YV16 YUV422 YUV422P8 : $8341 v2.60 8 False 3 True 1 0 True
6] YV24 YV24 YUV444 YUV444P8 : $8141 v2.60 8 False 3 True 0 0 True
7] YV411 YV411 YUV411 YUV411P8 : $8541 v2.60 8 False 3 True 2 0 True
8] Y8 Y8 Y8 Y8 : $0101 v2.60 8 False 1 True 0 0 False
9] YUVA420 YUVA420P8 YUVA420 YUVA420P8 : $8B82 Avs+ 8 False 4 True 1 1 True
10] YUVA422 YUVA422P8 YUVA422 YUVA422P8 : $8382 Avs+ 8 False 4 True 1 0 True
11] YUVA444 YUVA444P8 YUVA444 YUVA444P8 : $8182 Avs+ 8 False 4 True 0 0 True
12] RGBP RGBP8 RGBP RGBP8 : $8162 Avs+ 8 True 3 True 0 0 True
13] RGBAP RGBAP8 RGBAP RGBAP8 : $81A2 Avs+ 8 True 4 True 0 0 True
14] Y10 Y10 Y10 Y10 : $0106 Avs+ 10 False 1 True 0 0 False
15] YUV420P10 YUV420P10 YUV420P10 YUV420P10 : $0B46 Avs+ 10 False 3 True 1 1 False
16] YUV422P10 YUV422P10 YUV422P10 YUV422P10 : $0346 Avs+ 10 False 3 True 1 0 False
17] YUV444P10 YUV444P10 YUV444P10 YUV444P10 : $0146 Avs+ 10 False 3 True 0 0 False
18] YUVA420P10 YUVA420P10 YUVA420P10 YUVA420P10 : $0B86 Avs+ 10 False 4 True 1 1 False
19] YUVA422P10 YUVA422P10 YUVA422P10 YUVA422P10 : $0386 Avs+ 10 False 4 True 1 0 False
20] YUVA444P10 YUVA444P10 YUVA444P10 YUVA444P10 : $0186 Avs+ 10 False 4 True 0 0 False
21] RGBP10 RGBP10 RGBP10 RGBP10 : $0166 Avs+ 10 True 3 True 0 0 False
22] RGBAP10 RGBAP10 RGBAP10 RGBAP10 : $01A6 Avs+ 10 True 4 True 0 0 False
23] Y12 Y12 Y12 Y12 : $010A Avs+ 12 False 1 True 0 0 False
24] YUV420P12 YUV420P12 YUV420P12 YUV420P12 : $0B4A Avs+ 12 False 3 True 1 1 False
25] YUV422P12 YUV422P12 YUV422P12 YUV422P12 : $034A Avs+ 12 False 3 True 1 0 False
26] YUV444P12 YUV444P12 YUV444P12 YUV444P12 : $014A Avs+ 12 False 3 True 0 0 False
27] YUVA420P12 YUVA420P12 YUVA420P12 YUVA420P12 : $0B8A Avs+ 12 False 4 True 1 1 False
28] YUVA422P12 YUVA422P12 YUVA422P12 YUVA422P12 : $038A Avs+ 12 False 4 True 1 0 False
29] YUVA444P12 YUVA444P12 YUVA444P12 YUVA444P12 : $018A Avs+ 12 False 4 True 0 0 False
30] RGBP12 RGBP12 RGBP12 RGBP12 : $016A Avs+ 12 True 3 True 0 0 False
31] RGBAP12 RGBAP12 RGBAP12 RGBAP12 : $01AA Avs+ 12 True 4 True 0 0 False
32] Y14 Y14 Y14 Y14 : $010E Avs+ 14 False 1 True 0 0 False
33] YUV420P14 YUV420P14 YUV420P14 YUV420P14 : $0B4E Avs+ 14 False 3 True 1 1 False
34] YUV422P14 YUV422P14 YUV422P14 YUV422P14 : $034E Avs+ 14 False 3 True 1 0 False
35] YUV444P14 YUV444P14 YUV444P14 YUV444P14 : $014E Avs+ 14 False 3 True 0 0 False
36] YUVA420P14 YUVA420P14 YUVA420P14 YUVA420P14 : $0B8E Avs+ 14 False 4 True 1 1 False
37] YUVA422P14 YUVA422P14 YUVA422P14 YUVA422P14 : $038E Avs+ 14 False 4 True 1 0 False
38] YUVA444P14 YUVA444P14 YUVA444P14 YUVA444P14 : $018E Avs+ 14 False 4 True 0 0 False
39] RGBP14 RGBP14 RGBP14 RGBP14 : $016E Avs+ 14 True 3 True 0 0 False
40] RGBAP14 RGBAP14 RGBAP14 RGBAP14 : $01AE Avs+ 14 True 4 True 0 0 False
41] Y16 Y16 Y16 Y16 : $0112 Avs+ 16 False 1 True 0 0 False
42] YUV420P16 YUV420P16 YUV420P16 YUV420P16 : $0B52 Avs+ 16 False 3 True 1 1 False
43] YUV422P16 YUV422P16 YUV422P16 YUV422P16 : $0352 Avs+ 16 False 3 True 1 0 False
44] YUV444P16 YUV444P16 YUV444P16 YUV444P16 : $0152 Avs+ 16 False 3 True 0 0 False
45] YUVA420P16 YUVA420P16 YUVA420P16 YUVA420P16 : $0B92 Avs+ 16 False 4 True 1 1 False
46] YUVA422P16 YUVA422P16 YUVA422P16 YUVA422P16 : $0392 Avs+ 16 False 4 True 1 0 False
47] YUVA444P16 YUVA444P16 YUVA444P16 YUVA444P16 : $0192 Avs+ 16 False 4 True 0 0 False
48] RGBP16 RGBP16 RGBP16 RGBP16 : $0172 Avs+ 16 True 3 True 0 0 False
49] RGBAP16 RGBAP16 RGBAP16 RGBAP16 : $01B2 Avs+ 16 True 4 True 0 0 False
50] RGB48 RGB48 RGB48 RGB48 : $0072 Avs+ 16 True 3 False 0 0 False
51] RGB64 RGB64 RGB64 RGB64 : $00B2 Avs+ 16 True 4 False 0 0 False
52] Y32 Y32 Y32 Y32 : $0116 Avs+ 32 False 1 True 0 0 False
53] YUV420PS YUV420PS YUV420PS YUV420PS : $0B56 Avs+ 32 False 3 True 1 1 False
54] YUV422PS YUV422PS YUV422PS YUV422PS : $0356 Avs+ 32 False 3 True 1 0 False
55] YUV444PS YUV444PS YUV444PS YUV444PS : $0156 Avs+ 32 False 3 True 0 0 False
56] YUVA420PS YUVA420PS YUVA420PS YUVA420PS : $0B96 Avs+ 32 False 4 True 1 1 False
57] YUVA422PS YUVA422PS YUVA422PS YUVA422PS : $0396 Avs+ 32 False 4 True 1 0 False
58] YUVA444PS YUVA444PS YUVA444PS YUVA444PS : $0196 Avs+ 32 False 4 True 0 0 False
59] RGBPS RGBPS RGBPS RGBPS : $0176 Avs+ 32 True 3 True 0 0 False
60] RGBAPS RGBAPS RGBAPS RGBAPS : $01B6 Avs+ 32 True 4 True 0 0 False
MysteryX
29th October 2021, 19:25
Oh, another thing I never test: what happens to the Alpha plane?
Then frame properties will also require testing from now on.
For reference, the most popular unit-testing framework in the .NET world is xUnit (https://xunit.net/).
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.