Log in

View Full Version : Ultimately accurate filtering plugin


Mystery Keeper
29th March 2008, 16:55
I wrote a simple, but very powerful plugin that applies any custom filter to exact frame ranges leaving "healthy" frames untouched. I mainly use it for accurate deinterlacing in DVD with different filters for different ranges. The effect is awesome! But it's applications are not limited to deinterlacing.

Get it here (http://www.mediafire.com/?ebnyjdvnogs).

Readme file:
Lom v1.01 for AviSynth 2.5
by Aleksey [Mystery Keeper] Lyashin Jr.

mail, Jabber: mystkeeper@gmail.com
ICQ: 73041684
MSN: mysteryk@pisem.net
AIM: beyondkawaii

Pluging is intended for accurate filtering of heterogeneous video source. It takes in two clips and a range or list file of frames. When frame is requested it checks if it's in the list. If it's not, it returns the frame from the first clip, if it is - from the second.

Possible application:
-Accurate deinterlacing in DVD
-Deblocking of high motion scenes
-Logotype removing
-Mosaicing
-Anything that comes in mind

Syntax:
Lom(clip, clip2, int firstf, int lastf)
Lomf(clip, clip2, string hintfile)

Hint file syntax:

frame1[-frame2[(4)]], frame1[-frame2[(4)]], ... ,frame1[-frame2[(4)]]

example: 20-35,38,40-52(4)

frame2 must be equal or greater than frame1. Each next range must contain greater frames than previous. Expression "frame1-frame2(4)" is used to filter every 4th frame starting with frame1 and is validated by expression "(frame2-frame1) mod 4=0".

Questions and answers:

Q: What is "Lom"?
A: "Lom" is Russian for "crowbar" and is taken from the proverb "There's no trick against a crowbar."

Q: Can instanses of Lom stack and overlap?
A: Yes, they can.

Q: Why would I need to filter every 4th frame?
A: Frame sequences with interlaced every 4th frame seem to be an often case in Japanese DVD.

Q: What extension does hint file use?
A: Any of your liking. Plugin doesn't care. But it must be a text in ANSI encoding.

Q: Can I break lines in the hint file?
A: Yes, you can. Line breaks, spaces and tabs are ignored. Any other symbol apart from "," and "-" will cause an error.

TheFluff
29th March 2008, 17:02
Is it just me or did you just reinvent trim(), interleave() and selectrangeevery()?

Mystery Keeper
29th March 2008, 17:11
Of course you can use combination of those plugins, but if you'd look at my frame lists for deinterlacing of short (~5min) clips, you wouldn't want that. There is always LOT of separate frame ranges need filtering. Disassembling, filtering and reassembling them with the filters you named in the script is inconvenient.

Zarxrax
29th March 2008, 17:14
How is this different from ApplyRange?

Mystery Keeper
29th March 2008, 17:22
Hmm... Was oblivious to its existence for some reason. Well, the difference for the first function is that last frame can match first for a single frame filtering. And the second function is completely different, more complex and powerful. It's MUCH more convenient than using ApplyRange to every range.

Gavino
29th March 2008, 20:35
Hmm... Was oblivious to its existence for some reason. Well, the difference for the first function is that last frame can match first for a single frame filtering. And the second function is completely different, more complex and powerful. It's MUCH more convenient than using ApplyRange to every range.
ApplyRange supports single-frame ranges (at least in 2.57).

Your second function is a bit like ConditionalReader.

Mystery Keeper
29th March 2008, 21:00
Ok. Then my first function isn't needed. Just never knew about ApplyRange. But I don't see how the second is like ConditionalReader.

Fizick
30th March 2008, 01:32
good start!
But the topic name (...filtering) is not ultimately accurate :)
The plugin itself does not filter anything.
It is sort of frame re-arranging plugin.

Mystery Keeper
30th March 2008, 01:56
Thanks ^_^ But the plugin doesn't rearrange anything. It's made to apply custom filters at the exact places. It won't even work with anything that changes frames properties and count. Source clip and fliter are compared for width, height, colorspace and frames count match.

As for the essence - it does text file parsing, linearly connected list forming, checking and foolproofing. Rather simple tool, but it's exactly what I needed at the time, and thus it was born. As it worked great for me, I just thought I'd share.

stickboy
30th March 2008, 06:12
Sounds pretty similar to my ReplaceFramesSimple function (http://www.avisynth.org/stickboy/).

Gavino
30th March 2008, 13:16
Ok. Then my first function isn't needed. Just never knew about ApplyRange. But I don't see how the second is like ConditionalReader.
The documentation that comes with Avisynth (not the on-line wiki) has an example of using ConditionalReader and ConditionalFilter to select between two clips on a frame-by-frame basis, as an alternative to a sequence of ApplyRange calls.

So I think your function can be emulated by existing features. That doesn't make it worthless, of course, if it is faster and more convenient to use.