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 Development
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th April 2006, 15:36   #1  |  Link
violao
Registered User
 
Join Date: Feb 2004
Posts: 252
removeblend update

I have recently been involved with some Super8 dvd conversion and revisited removeblend filter development in order to fix some things. As a result two new versions 0.2.3 and 0.3 are now available for download

Removeblend 0.2.3 fixes memory leak problem discovered and there is a new parameter added pt. I realized that regardless of a capture device the final conversion result would not be a linear function of it's inputs, For example if pixels from within neighbour frames with luma values 40 and 60 produce a blend with value 100 that doesn't mean that values 80 and 120 will produce 200. In reality all recording devices are non-linear, so using this parameter it is possible to narrow down the pixel values used to a certain range where the recording function is supposed to be linear. Of course it's impossible to know about this range without experimenting. pt will exclude all pixels with:

luma below 16 + pt
and
luma above 235 - pt

For Removeblend 0.3 I've rewritten blend detection engine. Instead of using statistical sample of most different pixels it now uses ALL pixels within a frame that conform to pt and threshold conditions being met. First I calculate histogram from those pixel luma values and calculate average luma values for the corresponding pixels in previous and next frames. These values are then used in blend detection. After finding all possible coefficients they are sorted by distance from median value and a certain number of outliers removed, depending on the new othresh parameter. Also pixels parameter is now obsolete, since it's value is set internally and it's still there only for compatibility reasons.

It appears that blend detection is now more reliable but it also depends highly on the new parameters. Furthermore the main dthresh threshold value is higly dependant on the chioce of the values for threshold, othresh and pt. Tipically narrowing down the pixel value range will produce smaller variances, therfore requiring smaller dthresh.

As I see this filter has been occasionally discussed and used I might add some words in order for the users to better understand how it works. The idea behind it is that for higly related frames (blends and duplicates) calculated weight coefficients A and B will be highly correlated, having small variance (controlled by dthresh), while this won't happen for different frames. In reality there are a number of factors that can offset these values in both directions, so other parameters bthresh and cthresh are added to restrict blend detection in certain cases. For example if the avarage value of a certain coefficient is found to be < 0 this definitely cannot represent a blend. If it's around 1 then it's considered duplicate. Also there are certain situation that further restrict blend and duplicate detection in interlaced mode. For example if the following sequence is detected:
Code:
A B B
a a b
this is clearly impossible and considered an error.

Suggested usage is to increase dthresh until all blends are reliably detected, while all erroneous detections supressed by cthrech and dthresh.

Since we are finding duplicate fields/frames this information is also used for decombing in interlaced mode. Since some blends might pass through, as well as some duplicates might be missed I still recommend running the clip through telecide() after removeblend. Final step is decimate. I use multidecimate() but have to warn you that while removeblend is not affected much by flickering, multidecimate apparently is so I suggest running antiflicker() before multidecimate. Be careful not to run any filter that interfere with luma before removeblend since this will obviously compromise blend detection.

Following is the script I use. Levels and ColorYUV parameters values are set after inspecting histogram in Virtualdub. Super8Equal is usefol only for recorded projections and is best set on uniform white or grey frames.
Code:
###############################
# 1. remove blends
###############################
assumetff()
converttoyv12(interlaced=true)
removeblend(threshold=10, dthresh=1.0, cthresh=0.05, bthresh=1.55, othresh=0.7,
info=false, mode=0, interlaced=true, tff=true, decomb=true, pt=16)

###############################
# 2. deflicker
###############################
converttoyuy2()
antiflicker()

###############################
# 3. telecide
###############################
Telecide(order=1,post=2,vthresh=70,show=false)

###############################
# 4. equalize lines
###############################
EquLines(deltamax=120)

###############################
# 5. decimate
###############################
MultiDecimate(pass=1)
#MultiDecimate(pass=2)

##############################
# 6. hotspot/brightness/contrast 
##############################
Super8Equal(center=1.0, rim=1.5, exp=6.0)
levels (40, 1.0, 235, 16, 235, coring=false) 
colorYUV(autogain=false, autowhite=false, off_u=2, off_v=-12, opt="coring")

###############################
# 7. chroma noise filter
###############################
converttoYV12()
Cnr2("xxx",4,5,255) 

##############################
# 8. telecine 16.67 -> 25
##############################
separatefields()
selectevery(4, 0, 1, 0, 3, 2, 3)
weave()
assumefps(25)
It is also helpful to stack top and bottom fields to resulting frame while finding values for thresholds in removeblend, such as:
Code:
assumetff()
w=width()/2
h=height()/2
top=separatefields().selecteven().bicubicresize(w,h)
bottom=separatefields().selectodd().bicubicresize(w,h)
control=stackvertical(top,bottom)

removeblend(threshold=10, dthresh=1.0, cthresh=0.05, bthresh=1.55, othresh=0.7,
info=true, mode=0, interlaced=true, tff=true, decomb=true, pt=16)

stackhorizontal(control)
Happy deblending!

Last edited by violao; 7th April 2006 at 22:29.
violao is offline   Reply With Quote
Old 31st October 2014, 20:18   #2  |  Link
violao
Registered User
 
Join Date: Feb 2004
Posts: 252
removeblend hosted at Google Code

Sorry to dig such an old post, but I just wanted to inform anyone who might be still interested in this old plugin. The last version (0.3) can now be downloaded from;

https://code.google.com/p/removeblend/
violao is offline   Reply With Quote
Reply


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 22:31.


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