| 1 | <h2>Full Example</h2> |
| 2 | <pre><code>/* |
| 3 | * Example AviSynth script for PrismJS demonstration. |
| 4 | * By Zinfidel |
| 5 | */ |
| 6 | |
| 7 | SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE) |
| 8 | AddAutoloadDir("MAINSCRIPTDIR/programs/plugins") |
| 9 | |
| 10 | # Multiplies clip size and changes aspect ratio to 4:3 |
| 11 | function CorrectAspectRatio(clip c, int scaleFactor, bool "useNearestNeighbor") { |
| 12 | useNearestNeighbor = default(useNearestNeighbor, false) |
| 13 | stretchFactor = (c.Height * (4 / 3)) / c.Width |
| 14 | |
| 15 | return useNearestNeighbor \ |
| 16 | ? c.PointResize(c.Width * scaleFactor * stretchFactor, c.Height * scaleFactor) \ |
| 17 | : c.Lanczos4Resize(c.Width * scaleFactor * stretchFactor, c.Height * scaleFactor) |
| 18 | } |
| 19 | |
| 20 | AviSource("myclip.avi") |
| 21 | last.CorrectAspectRatio(3, yes) |
| 22 | |
| 23 | |
| 24 | Prefetch(4)</code></pre> |