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 17th October 2004, 19:37   #21  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
Little late now, but I had a go at a YV12 only median filter yesterday as well. It is similar to the filters in mask tools in that it takes 3 parameters (Y, U, V) so each plane can have its own radius, or depending on the settings planes can be copied, memset to specific values, or simply not processed at all. Also, this filter will handle the edges of the image (less then radius distance away). In a little speed test it appeared to be about twice as fast as medianblur for the same radius.

Also, it seems the reason tsp's filter does not do anything is that it literally doesn't... at the end it returns the original frame instead of the processed frame. I've been there before .

EDITED: removed link. tsp's is faster now and supports all the same things.. grab his.

Last edited by tritical; 31st October 2004 at 05:27.
tritical is offline   Reply With Quote
Old 17th October 2004, 20:36   #22  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
embarrasing . Fixed that little bug, same link. Doesn't change the fact that it is slow. Working on another sort algorithm. Should speed the filter up.
Also I have added the feature to add seperate radius for each plane. if the radius is set to 0 the plane is unchange and if set to -1 the plane isn't processed at all.

the syntax is now:

medianblur(clip,radiusy,radiusu,radiusv)

Last edited by tsp; 17th October 2004 at 21:13.
tsp is offline   Reply With Quote
Old 18th October 2004, 05:19   #23  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
wow, tsp's medianblur does very funny (and cool looking) things to the picture. almost like a motion-blur. perhaps MVtools will give cleaner vectors if i feed it with this?

question: why is photoshop's median so much faster? adobe are definitely not known for optimizing anything (ever...).
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 18th October 2004, 06:57   #24  |  Link
HighInBC
Registered User
 
HighInBC's Avatar
 
Join Date: Jan 2003
Location: Victoria, BC, Canada
Posts: 144
Thanks tsp, this will work great! Problem solved. It is slow, but I can deal with that, would be nice if it gets faster tho hehe

-HighInBC
HighInBC is offline   Reply With Quote
Old 18th October 2004, 14:42   #25  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
HighInBC If you only need a medianblur with a binary clip, I think it should be possible to make a very fast version.
tsp is offline   Reply With Quote
Old 18th October 2004, 14:49   #26  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
Indeed : you make a convolution with a uniform matrix, followed by a binarize with a threshold at 128.
Manao is offline   Reply With Quote
Old 18th October 2004, 15:25   #27  |  Link
Leak
ffdshow/AviSynth wrangler
 
Leak's Avatar
 
Join Date: Feb 2003
Location: Austria
Posts: 2,441
Quote:
Originally posted by Manao
Indeed : you make a convolution with a uniform matrix, followed by a binarize with a threshold at 128.
How about just counting the number of white pixels and setting the current pixel to white if more than half of the surrounding pixels is white?

Isn't a full-fledged convolution a bit overkill for this case?

np: Phoenecia - Biorepo (Brownout)
Leak is offline   Reply With Quote
Old 18th October 2004, 15:29   #28  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
A convolution by a kernel filled with ones amounts to count the white pixels. And some convolutions ( YV12Convolution at least ) are optimized in order not to recompute lines / columns already computed, so it will be almost as fast.
Manao is offline   Reply With Quote
Old 19th October 2004, 21:04   #29  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
Updated medianblur. It is now minimum 3 times faster for radius 1 to about 10^6 times faster for radius 150 and up. You can get it here and the sourcecode here.
The filter now creates a variable called DEBUG that containes the time in msec that the filter uses to calculate each frame.

Get the time like this:
Code:
scriptclip("subtitle(string(DEBUG),x=50,y=50)",after_frame=true)
tsp is offline   Reply With Quote
Old 21st October 2004, 03:21   #30  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
wow, that is a lot faster.

seems to mess up chroma on non-mod16 resolutions. that's not really a problem though.

[edit]

here's a very simple median-denoiser. i have a photoshop action that does the same thing (only much slower) for making jpegs more compressible.

Code:
clean = last.medianblur(4)
mask = yv12lutxy(last,clean,yexpr="x y - abs 256 6 / *")
maskedmerge(clean,last,mask)
it'd be cool to see a variable radius temporal filter too... might be a little faster with only 1 dimension to work in.
__________________
sucking the life out of your videos since 2004

Last edited by Mug Funky; 21st October 2004 at 03:38.
Mug Funky is offline   Reply With Quote
Old 21st October 2004, 17:51   #31  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
I finnished version 0.3 of medianblur. It is now even faster and can now process the borders too. Get it here (52 KB). Sourcecode is included.

Next I will add a temporal filter or a binary median blur.
tsp is offline   Reply With Quote
Old 22nd October 2004, 17:50   #32  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
whoa! bloody good work. it's faster than potatoshop now. i knew there was a good way to do this
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 23rd October 2004, 12:39   #33  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Thanks tsp and tritical for implementing this. Please continue the race to make your filter faster than the other one's

BTW, anyone noticed yet that a median blur makes a wonderful base for removing edge halos ... ?
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 24th October 2004, 11:12   #34  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
Well I think that race is over before it got started . tsp had to go and do it the smart way , that spoils all the fun. I'll leave mine up just because it has this median resize algo that I remembered seeing in a book I read (though it is pretty crappy). It also has a center weighted median option though tsp's filter could have a center weighted option added fairly easily and be faster. tsp's is definitely faster if you want a plain median blur so I would recommended his filter...
tritical is offline   Reply With Quote
Old 25th October 2004, 14:35   #35  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Hmh. The results of MedianBlur() and TMedian() are very different.

Actually, TMedian() gives the result I expect from a median filter. MedianBlur() produces a strange "widening" of small features such as thin lines, which were rather supposed to disappear instead of getting widened:



Am I missing something here?
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 25th October 2004, 15:17   #36  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
nope it's caused by a couple of bugs. I'm fixing them right now. Expect version 0.31 to be released shortly
tsp is offline   Reply With Quote
Old 25th October 2004, 16:39   #37  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
Done. Get it here. By the way how would you like the default value for the u and v plane radius? Half the value of the y plane. Same value as y or as now allways 2?
tsp is offline   Reply With Quote
Old 25th October 2004, 21:30   #38  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
Made version 0.4 that adds a centerweighted medianblur

usage:

medianblurcw(clip,int radiusy,int radiusu,int radiusv,int weighty,int weightu,weightv, bool calcborder)

Get it here.
tsp is offline   Reply With Quote
Old 27th October 2004, 14:03   #39  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,733
Should this thread be moved to the usage forum? Many people don't peek in here often - including me.

Thanks for the filter, it might be useful with my TV caps
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 27th October 2004, 14:58   #40  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
I will make a thread there when I have added the binary and temporal median blur. At the moment I'm implementing the integer SSE optimization of the binary median blur.
tsp 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 02:01.


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