Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.


Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Thread Tools Search this Thread Display Modes
Old 21st May 2004, 10:19   #1  |  Link
Registered User
Join Date: Dec 2003
Location: MO, US
Posts: 999
New filter: TCombMask

This isn't completely new, I had posted this towards the end of another thread that I pretty much hijacked with it ... though if anyone actually tried to use the original version I would feel sorry for them . Basically, this filter creates a comb mask (i.e. it will output a binary mask with combed pixels marked with a different value then non-combed pixels). It supports a wide selection of area combing metrics and motion detection options.


The original version had some unwanted features (bugs in the motion detection), but those are now fixed. This version also includes the ability to do double thresholds (like fielddeinterlace with full=false), meaning you can create a mask with one set of settings... then have TCombMask check whether or not it is combed. If it is, TCombMask will output another mask based off the other settings or output a blank mask. So it would now be useful for ivtc post processing. Also, the pixel values that combed and non-combed pixels get set to are now user definable and no longer fixed at 255 and 0. Two other area combing metrics have been added, as well as a few other parameters and features. I also added in two very basic MMX/SSE2 optimized masking functions that make it easier to use TCombMask's output for something useful. These functions could be accomplished with other masking functions (ones from MaskTools or AviSynth's overlay) though this makes it more straight forward and sometimes helps to avoid calls to levels().

The first is TMaskedMerge which takes two clips, a mask clip, and a value, for every pixel it checks if the value of the mask pixel is equal to the value parameter. If it is, then the pixel from the first clip is used... if not the pixel from the second clip is used. The second is TMaskedMerge3 which is exactly like TMaskedMerge but chooses between 3 clips based on 2 values instead of 2 clips based on 1 value. This all means you can do things like the following.

To make a simple same frame rate cubic deinterlacer:
d = last.bob().selecteven()
m = last.tcombmask(high=0,low=255)

Or TMaskedMerge3 allows slightly more interesting things to be done relatively easily, but usually will require the very nice and unbelievably useful MaskTools filter as well (note that parts of this must be adjusted depending on the field order of the clip):
n = last.separatefields().trim(1,0).weave()
d = last.bob().selectodd()
mc = last.tcombmask(high=0,low=255)
mn = n.tcombmask(high=0,low=128)
mt = logic(mc,mn,"or")

Anyways... in general this isn't really too useful of a filter, though someone might find a use for it.
tritical is offline   Reply With Quote
Old 23rd May 2004, 23:22   #2  |  Link
Registered User
Join Date: Apr 2003
Location: USA
Posts: 91

Looks like a lot of work went into it. If I understand correctly the filter outputs a mask of where combing is in the frame. This combing, I presume, is the result of motion in an interlaced video. I think I understand the first script but the second is a bit much for me. Could you explain it?

Don't you think you would get better results by blurring the mask a bit before using it? Or don't the sharp edges matter?
t_2 is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 03:25.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.