Richard Berg
1st July 2002, 10:09
I know you've all been waiting on the edge of your seats (;)), but it's finally here.
Demo
avisource("l:\bebop.avi")
# 5x5 gaussian
generalconvolution(0, "0 1 2 4 0
1 4 8 4 1
2 8 16 8 2
1 4 8 4 1
0 4 2 1 0")
# 3x3 sharpen
generalconvolution(0, "-1 -1 -1
-1 9 -1
-1 -1 -1")
The first argument is an additive bias. It'll be optional (defaulting to 0) as soon as I can get Avisynth to not crash when I do so...
It's no speed demon, but not terribly shabby either. 512x384 HuffYUV video -> XviD via a 5x5 kernel goes at about 11fps on a 1.4Ghz Pally. (L:\ is a network share to the HTPC capture drive, but I don't think bandwidth was the limiting factor since it was compressed on the return route.) That's without any optimizations at all, though I'm not too confident there's much to be gained from MMX/SSE etc. since the algorithm really thrashes the L1 cache. Source code is in the ZIP, though, so Trbarry et al. are welcome to prove me wrong :)
Speaking of the code -- if you haven't noticed, it's in a .h/.cpp file of its own. In general all you have to do is add GeneralConvolution_filters in 2 places at the very beginning of avisynth.cpp, but this filter also required some hacking of script.cpp to allow newlines within single commands. Not to worry; the binary is posted, and I hope to get at least the major code-revision issues banged out ASAP...keep up with the "leadership" thread for the latest, I suppose...
Demo
avisource("l:\bebop.avi")
# 5x5 gaussian
generalconvolution(0, "0 1 2 4 0
1 4 8 4 1
2 8 16 8 2
1 4 8 4 1
0 4 2 1 0")
# 3x3 sharpen
generalconvolution(0, "-1 -1 -1
-1 9 -1
-1 -1 -1")
The first argument is an additive bias. It'll be optional (defaulting to 0) as soon as I can get Avisynth to not crash when I do so...
It's no speed demon, but not terribly shabby either. 512x384 HuffYUV video -> XviD via a 5x5 kernel goes at about 11fps on a 1.4Ghz Pally. (L:\ is a network share to the HTPC capture drive, but I don't think bandwidth was the limiting factor since it was compressed on the return route.) That's without any optimizations at all, though I'm not too confident there's much to be gained from MMX/SSE etc. since the algorithm really thrashes the L1 cache. Source code is in the ZIP, though, so Trbarry et al. are welcome to prove me wrong :)
Speaking of the code -- if you haven't noticed, it's in a .h/.cpp file of its own. In general all you have to do is add GeneralConvolution_filters in 2 places at the very beginning of avisynth.cpp, but this filter also required some hacking of script.cpp to allow newlines within single commands. Not to worry; the binary is posted, and I hope to get at least the major code-revision issues banged out ASAP...keep up with the "leadership" thread for the latest, I suppose...