Robert Martens
25th December 2010, 03:18
TurnsTile 0.3.2
Avisynth 2.5 - Windows - x86 (http://www.gyroshot.com/files/turnstile/TurnsTile-0.3.2-AVS2.5-x86.zip)
Source (http://www.gyroshot.com/files/turnstile/TurnsTile-0.3.2-Source.zip) - GitHub (https://github.com/ItEndsWithTens/TurnsTile/tree/v0.3.2)
Use TurnsTile() to achieve a blocky, low-res mosaic effect on your input, and the companion CLUTer() to apply an arbitrary color palette. Several sample tilesheets, and one sample palette, are included.
Both functions support RGB32, RGB24, YUY2, and YV12.
Old versions:
0.3.1 (http://www.gyroshot.com/files/turnstile/TurnsTile031.zip) - GitHub (https://github.com/ItEndsWithTens/TurnsTile/tree/v0.3.1)
0.3.0 (http://www.gyroshot.com/files/turnstile/TurnsTile030.zip) - GitHub (https://github.com/ItEndsWithTens/TurnsTile/tree/v0.3.0)
0.2.1 (http://www.gyroshot.com/files/turnstile/TurnsTile021.zip) - GitHub (https://github.com/ItEndsWithTens/TurnsTile/tree/v0.2.1)
0.2.0 (http://www.gyroshot.com/files/turnstile/TurnsTile020.zip) - GitHub (https://github.com/ItEndsWithTens/TurnsTile/tree/v0.2.0)
0.1.0 (http://www.gyroshot.com/files/turnstile/TurnsTile010.zip) - GitHub (https://github.com/ItEndsWithTens/TurnsTile/tree/v0.1.0)
Previous OP follows.
----
As intimidating as it feels to join this side of the AviSynth world, I'm going to dip my toes into the waters of plugin development and offer this, the result of about three weeks of fiddling with Visual C++. TurnsTile takes an input video in RGB32, RGB24, or YUY2 formats and builds a mosaic based on it, pulling image data for each tile from either the video itself (for basic mosaic operation) or from a custom sheet that you provide (to provide something similar to a palette effect, though true palettizing is still only a plan I've got for future releases).
Sample stills (see a few posts down for one showing off 0.2.0's updated 'res' parameter) don't show off the effect as well as actual video, so take a look at a collection of samples I strung together in this Youtube clip: http://www.youtube.com/watch?v=WFJreg-LW50
If you just want to try it out, everything you'll need is included in the download. Everyone else settle in for another of my history lessons, I'm about to drift off on a tangent.
I've been a fan of the rogue-like computer game Dwarf Fortress (http://www.bay12games.com/) since its first public release in 2006, and although my interest is intermittent (I'm not a very good player, it's easy to get discouraged) I come back to it now and again. The game's graphics are old-school pseudo ASCII text, and over the months I spent developing SimpleSlugUpscale (http://forum.doom9.org/showthread.php?t=153860), I got the itch to use my newfound script writing abilities to try and simulate the effect in AviSynth. A few weeks back I put together a script, employing Gavino's wonderful GScript (http://forum.doom9.org/showthread.php?t=147846) and GRunT (http://forum.doom9.org/showthread.php?t=139337) plugins, that accomplished what I was after, successfully chopping up the game's modified CP437 tilesheet (hence "pseudo" ASCII; the game uses OpenGL to draw its tiles) and applying the characters to the input video.
The only problem was the 0.04 frames per second render speed. Frankly I'm not sure "frames" deserves that 's'.
Some careful rethinking of my approach allowed me to shuffle the ScriptClip ugliness to a better place, to do as little work per frame as possible, and I managed to tweak the script up to 0.8~0.9 fps. This, mind you, for a 640x480, 30p input clip. "Improved by an order of magnitude" if you're in advertising, "still laughably unusable" if you're the rest of us. I spent some time trying to convince myself that writing a plugin was stupid, and performance wouldn't see much improvement, if any. The Crop and Stack filters I used in the script are fairly low cost, as I understand, and the GScript loops are compile time constructs that don't themselves impact runtime performance. RGBDifference/AverageLuma are more demanding, but still very well optimized by people who know a lot more about this than I do.
Eventually, I got over my self-doubt and set to digging through the Filter SDK, SimpleSample (thanks to Simon Walters and everyone else who worked on that!), and the AviSynth Development board. After a while, despite fourteen years of false starts learning C/C++, I managed to wrap my head around the principles involved and get a plugin to compile.
Apparently, the nature of the effect I was after is a bit demanding for a user created script, no matter how efficient the underlying code, because with the same clip and tilesheet, the plugin version of my idea running on the same system hits well over a hundred frames per second. Of course, now that I've gone through the process of creating TurnsTile, I would hardly be surprised to find that a more experienced scripter could do what I failed to without having to write a plugin. It was useful C++ experience, though, so I chalk this one up to a win.
Should you want to try and turn out frames a bit faster, I've tested this plugin with SEt's AviSynth 2.5.8 MT, and it seems to work in mode 1. I can't make any promises (I'm still trying to understand the idea of "reentrant" functions, and how they provide, or at least help thread safety), but it's worth trying if you're really in a rush. Just make sure you have a fire extinguisher handy.
Planar support is going to have to wait until my brain catches up to the idea, as will assembly optimizations. One thing at a time, I'm sure I'll get there eventually.
Included in the 'extras' folder in the archive are a few goodies I thought might be of interest:
-A handful of solid color gradient tilesheets to get you started
-The barebones tilesheet generator I wrote to create said tilesets
-AnimatedTiles.avs, a script that blends through a rainbow of the aforementioned sample sheets, to be used with AVISource as another tilesheet (as I did with the highway footage in the sample clip)
-A tilesheet pieced together from the others, meant to provide a "poor man's thermal camera" effect (as per the third video sample), along with the script that built it
-TurnsTile_Script.avs, the positively tectonic script version of TurnsTile 0.1.0 that motivated the plugin (requires GScript (http://forum.doom9.org/showthread.php?t=147846) and GRunT (http://forum.doom9.org/showthread.php?t=139337))
All told, this code is undoubtedly naive, and I'm sure you'll find some real groaners in the source, but it seems to do the intended job well enough that I thought someone else might like to play with it.
Avisynth 2.5 - Windows - x86 (http://www.gyroshot.com/files/turnstile/TurnsTile-0.3.2-AVS2.5-x86.zip)
Source (http://www.gyroshot.com/files/turnstile/TurnsTile-0.3.2-Source.zip) - GitHub (https://github.com/ItEndsWithTens/TurnsTile/tree/v0.3.2)
Use TurnsTile() to achieve a blocky, low-res mosaic effect on your input, and the companion CLUTer() to apply an arbitrary color palette. Several sample tilesheets, and one sample palette, are included.
Both functions support RGB32, RGB24, YUY2, and YV12.
Old versions:
0.3.1 (http://www.gyroshot.com/files/turnstile/TurnsTile031.zip) - GitHub (https://github.com/ItEndsWithTens/TurnsTile/tree/v0.3.1)
0.3.0 (http://www.gyroshot.com/files/turnstile/TurnsTile030.zip) - GitHub (https://github.com/ItEndsWithTens/TurnsTile/tree/v0.3.0)
0.2.1 (http://www.gyroshot.com/files/turnstile/TurnsTile021.zip) - GitHub (https://github.com/ItEndsWithTens/TurnsTile/tree/v0.2.1)
0.2.0 (http://www.gyroshot.com/files/turnstile/TurnsTile020.zip) - GitHub (https://github.com/ItEndsWithTens/TurnsTile/tree/v0.2.0)
0.1.0 (http://www.gyroshot.com/files/turnstile/TurnsTile010.zip) - GitHub (https://github.com/ItEndsWithTens/TurnsTile/tree/v0.1.0)
Previous OP follows.
----
As intimidating as it feels to join this side of the AviSynth world, I'm going to dip my toes into the waters of plugin development and offer this, the result of about three weeks of fiddling with Visual C++. TurnsTile takes an input video in RGB32, RGB24, or YUY2 formats and builds a mosaic based on it, pulling image data for each tile from either the video itself (for basic mosaic operation) or from a custom sheet that you provide (to provide something similar to a palette effect, though true palettizing is still only a plan I've got for future releases).
Sample stills (see a few posts down for one showing off 0.2.0's updated 'res' parameter) don't show off the effect as well as actual video, so take a look at a collection of samples I strung together in this Youtube clip: http://www.youtube.com/watch?v=WFJreg-LW50
If you just want to try it out, everything you'll need is included in the download. Everyone else settle in for another of my history lessons, I'm about to drift off on a tangent.
I've been a fan of the rogue-like computer game Dwarf Fortress (http://www.bay12games.com/) since its first public release in 2006, and although my interest is intermittent (I'm not a very good player, it's easy to get discouraged) I come back to it now and again. The game's graphics are old-school pseudo ASCII text, and over the months I spent developing SimpleSlugUpscale (http://forum.doom9.org/showthread.php?t=153860), I got the itch to use my newfound script writing abilities to try and simulate the effect in AviSynth. A few weeks back I put together a script, employing Gavino's wonderful GScript (http://forum.doom9.org/showthread.php?t=147846) and GRunT (http://forum.doom9.org/showthread.php?t=139337) plugins, that accomplished what I was after, successfully chopping up the game's modified CP437 tilesheet (hence "pseudo" ASCII; the game uses OpenGL to draw its tiles) and applying the characters to the input video.
The only problem was the 0.04 frames per second render speed. Frankly I'm not sure "frames" deserves that 's'.
Some careful rethinking of my approach allowed me to shuffle the ScriptClip ugliness to a better place, to do as little work per frame as possible, and I managed to tweak the script up to 0.8~0.9 fps. This, mind you, for a 640x480, 30p input clip. "Improved by an order of magnitude" if you're in advertising, "still laughably unusable" if you're the rest of us. I spent some time trying to convince myself that writing a plugin was stupid, and performance wouldn't see much improvement, if any. The Crop and Stack filters I used in the script are fairly low cost, as I understand, and the GScript loops are compile time constructs that don't themselves impact runtime performance. RGBDifference/AverageLuma are more demanding, but still very well optimized by people who know a lot more about this than I do.
Eventually, I got over my self-doubt and set to digging through the Filter SDK, SimpleSample (thanks to Simon Walters and everyone else who worked on that!), and the AviSynth Development board. After a while, despite fourteen years of false starts learning C/C++, I managed to wrap my head around the principles involved and get a plugin to compile.
Apparently, the nature of the effect I was after is a bit demanding for a user created script, no matter how efficient the underlying code, because with the same clip and tilesheet, the plugin version of my idea running on the same system hits well over a hundred frames per second. Of course, now that I've gone through the process of creating TurnsTile, I would hardly be surprised to find that a more experienced scripter could do what I failed to without having to write a plugin. It was useful C++ experience, though, so I chalk this one up to a win.
Should you want to try and turn out frames a bit faster, I've tested this plugin with SEt's AviSynth 2.5.8 MT, and it seems to work in mode 1. I can't make any promises (I'm still trying to understand the idea of "reentrant" functions, and how they provide, or at least help thread safety), but it's worth trying if you're really in a rush. Just make sure you have a fire extinguisher handy.
Planar support is going to have to wait until my brain catches up to the idea, as will assembly optimizations. One thing at a time, I'm sure I'll get there eventually.
Included in the 'extras' folder in the archive are a few goodies I thought might be of interest:
-A handful of solid color gradient tilesheets to get you started
-The barebones tilesheet generator I wrote to create said tilesets
-AnimatedTiles.avs, a script that blends through a rainbow of the aforementioned sample sheets, to be used with AVISource as another tilesheet (as I did with the highway footage in the sample clip)
-A tilesheet pieced together from the others, meant to provide a "poor man's thermal camera" effect (as per the third video sample), along with the script that built it
-TurnsTile_Script.avs, the positively tectonic script version of TurnsTile 0.1.0 that motivated the plugin (requires GScript (http://forum.doom9.org/showthread.php?t=147846) and GRunT (http://forum.doom9.org/showthread.php?t=139337))
All told, this code is undoubtedly naive, and I'm sure you'll find some real groaners in the source, but it seems to do the intended job well enough that I thought someone else might like to play with it.