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

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th September 2002, 18:43   #1  |  Link
Kurosu
Registered User
 
Join Date: Sep 2002
Location: France
Posts: 422
"Rainbow edge" Filter: it's possible :)

Hi all, here I go for my first post here!

Reading OUTPinged_'s post on how some shimmer can happen on video captures, I came with the idea of a filter I've implemented. This is mainly experimental ground, therefore "slow as hell" but source is included to give you an idea. It's released under a license (first time for me), the GNU LGPL license. If you want me to clarify my notes on that matter, you're welcome. It is hear to respect the originals authors of avisynth and Visual C++.

You could read the text provided in the archive, but I list the "features":
- choice of the kernel type used for edge detection (first isn't very effective)
- edge detection threshold (values -1, -2, -3 will try to find a good value), yet the detection doesn't have to be that precise (it seems not all edges have to be chromafiltered)
- temporal chromasmooth strength (if you see the code, you'll understand it's more of a fancy name )
- choice of a spatial chroma smooth type (not strength, all available options lead to different function

I've attached the DLL to have moderators approval, but you may also get it from my "site".

One last note: I'll be away tuesday for like 20 days. I may reply, but I won't be able to update the dll.

Note: sorry for the earlier post

Last edited by Kurosu; 10th September 2002 at 20:21.
Kurosu is offline   Reply With Quote
Old 11th September 2002, 12:48   #2  |  Link
OUTPinged_
MooPolice 1st division
 
OUTPinged_'s Avatar
 
Join Date: Dec 2001
Location: VIlnius,LT
Posts: 448
n1

It works flawlessly on my test clip with default settings.

I dont have dvd atm but i will test it sooner or later.

Thank you for writing such a flexible tool.


note to everyone: use it _before_ resizing.


__________________
___________________MooPolice is watching you!____.o/________

Last edited by OUTPinged_; 11th September 2002 at 12:52.
OUTPinged_ is offline   Reply With Quote
Old 11th September 2002, 12:56   #3  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,924
@OUTPinged_

Any chance of posting small before and after pics? Thanks.

(BTW, about your mouth clip. I'm working on improvements to the field matching to address this. May take some time.)
Guest is offline   Reply With Quote
Old 11th September 2002, 14:02   #4  |  Link
OUTPinged_
MooPolice 1st division
 
OUTPinged_'s Avatar
 
Join Date: Dec 2001
Location: VIlnius,LT
Posts: 448
Here it is (yes, the result is incredible).

Basically the worst part of a source in this clip is a heavy shimmering of a rainbow. I can post a clip on http if somebody wishes for it.
__________________
___________________MooPolice is watching you!____.o/________
OUTPinged_ is offline   Reply With Quote
Old 11th September 2002, 14:08   #5  |  Link
OUTPinged_
MooPolice 1st division
 
OUTPinged_'s Avatar
 
Join Date: Dec 2001
Location: VIlnius,LT
Posts: 448
@DG:

err... There wasnt anything wrong with decomb and this clip until i tried to use mode=2 for telecide. With mode=0 it is supposed to work ok.
__________________
___________________MooPolice is watching you!____.o/________
OUTPinged_ is offline   Reply With Quote
Old 11th September 2002, 14:22   #6  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,924
Indeed, the result is impressive. Well done, Kurosu!

(OUT, then you just got "lucky" that Decimate threw out the badly matched frame. The field matching should not have emitted it.)
Guest is offline   Reply With Quote
Old 11th September 2002, 15:21   #7  |  Link
Marc FD
XviD fan
 
Marc FD's Avatar
 
Join Date: Jun 2002
Location: France
Posts: 907
Whow !!
impressive.

@Kurosu
a new coder, and a french one

i can take long holidays now

(EDIT : out topic @outpinged : i recognise the CowBoy Bepop End credits. right ??)

BTW, when i think on it, i remember i used Cnr2 on rainbow artifacts (VHS tapes like CowBoy Bepop & Blue sub. no 6) and there were all gone.
Have you tested ??

Last edited by Marc FD; 11th September 2002 at 16:46.
Marc FD is offline   Reply With Quote
Old 11th September 2002, 16:13   #8  |  Link
Defiler
Asker of Questions
 
Join Date: Oct 2001
Location: Florida
Posts: 433
Sugoi!
__________________
"The real trick to optimizing color space conversions is of course to not do them." --trbarry, April 2002
Defiler is offline   Reply With Quote
Old 11th September 2002, 20:14   #9  |  Link
Kurosu
Registered User
 
Join Date: Sep 2002
Location: France
Posts: 422
Well, just before I leave, some news for you guys out there.

@MarcFD
Hehe... Yeah, I thought it would be better that I try and write one myself, otherwise you would have even less time for your filters.
Btw, your version wasn't working on my comp, rewrote it a bit and went fine, so if you like I can send you the "new" code (I don't think I should attach it, it's your tool anyway )

@OutPinged_
Indeed, I try to write it for unresized videos, but looking more closely to it, I think it's the better way. Alas black borders may produce some bad results. I'll see if it usefull to add an "area of interest" (macroblock wise).

@all
Spatial filtering could may be do by DCTing/dropping high frequencies values/iDCTing... I think it's too computational, and my filter is already sluggish

- There's room for speed improvement. I don't know assembly language, so I can't optimize the processing that way.
- considering that most people will encounter "rainbow effect" on MPEG-like video, I'm trying to optimize the way it works using that fact: if rainbow, whole macroblock U/V planes are screwed => _heavy_ filtering. But that will change most parameters (I dropped selection of kernels, no more autothreshold for edge detetction): the plugin has to be rewritten. I have sort of branched/forked from the original version, but I don't think the previous branch won't evolve much...
- if you look closely to U/V planes using see() from MarcFD , you'll see that in fact it also filters needlessly some parts of the picture

The worst part of this work is that it seems to raise no questions

I think anyway that temporal averaging has better chances to clean the source than spatial one: haven't tested it extensively after I solved the bug, but something like .AntiBlink(3,-2,0,[1-4]) would let much rainbow artifacts left. Btw, there is no scene change detection, so temporal smoothing can smooth with wrong values... ChromaSmoothing is done a particular way ([1-3] are just region averages, 4 is a blur) and so settings [1-3] may produce strange results. Therefore, use them very scarcely (3 should the best one, stronger filtering than 4 is required). Yeah in fact, the strongest is 1, the weakest is 4...

I attach a version where I think I fixed some strange artifacts (don't ask why they were there, it was a shame I let them!). Maybe cosmetic, but the first one was so unreliable...

One final word is on the license: I rushed a bit to set it up, so it might no be done the proper way. Anyway, I found a page where to compile dlls with gcc: using its port to windows and/or for instance djgpp, one can withdraw the use of MS VC++, and use a real GPL license ( not sure on how should be the license when providing a DLL compiled with MS VC++). Or so I think... At last minus high optimizations from Intel/MS compilers
Kurosu is offline   Reply With Quote
Old 11th September 2002, 22:39   #10  |  Link
OUTPinged_
MooPolice 1st division
 
OUTPinged_'s Avatar
 
Join Date: Dec 2001
Location: VIlnius,LT
Posts: 448
@Kurosu:

The best part about your filter is that it works on my test clips =)

The spatial part is questionable and imo a detection of a non-temporal rainbow type can be done by an algo similar to one's used in interlaced lines detectors, and you will have to take into account U and V pixel values.

I think i had a PAL DVD with static rainbow, if i will find it i will probably introduce a torture clip that will most likely be tough for your plugin.
__________________
___________________MooPolice is watching you!____.o/________
OUTPinged_ is offline   Reply With Quote
Old 13th September 2002, 13:55   #11  |  Link
Ezzelin
Registered User
 
Ezzelin's Avatar
 
Join Date: Sep 2002
Location: Seattle, WA, USA
Posts: 4
Here's a torture picture. I can't seem to get this rainbow noise out, and I would be very impressed if anything could. Still, that doesn't mean it can't be done. I can send a huffy of more rainbow beard action if anybody wants it.
Ezzelin is offline   Reply With Quote
Old 15th September 2002, 19:06   #12  |  Link
Taranli Maren
Registered User
 
Taranli Maren's Avatar
 
Join Date: Nov 2001
Posts: 47
Color Ghosting

Using trigun as my test clip, I attempted to use this filter. In the intro though, I got a lot of what I can only describe as color ghosting. I've tried a number of settings, and they all do it, though setting the differential filter to 1 makes it less, its still there. Here is a picture of what it does with differential filter 2 and 3. (Notice the cloak)

http://zhentarim.cjb.net/pictures/color_ghosting.png

I've been using Tim Park's smart smoother IQ for a while now, and its been working well, though it is incredibly slow (since you have to use it twice in a row most often). Would not spacial smoothing work better than temporal for this, since it doesn't always *blink* a single frame or two.
Taranli Maren is offline   Reply With Quote
Old 16th September 2002, 13:47   #13  |  Link
Kurosu
Registered User
 
Join Date: Sep 2002
Location: France
Posts: 422
Hi all,

I can't fix those known problems for now (maybe in 2 weeks). They come from the fact I don't use scene change detection (and I think it's difficult when it only matters on a small part of the picture), and mostly because the algorithm I use is very primitive: find edge, temporalsmooth it (spatial removes almost no rainbow effect).

I have redesigned a bit the detection of those rainbow effects, it matches much better them (like 90% and only 20% badly detected, while the previous one is a bit ugly: test with range [3rd parameter? I'm a bit out of it atm] -1 to see the edges which will be used to detect rainbow effects.

If the new design doesn't help much, I may add something to detect changes (SAD) in the filtered macroblock. Please post those troublesome videos, but be aware I won't be able to use for the next 2 weeks.

Sorry for the ones that had high hopes in this filter, it's only experimental, and I was just intending to demonstrate my ideas on the matter.

@Taranli Maren
The first differential filter seems better, because it does a worse job at detecting the edges
I diagnose the problem as following: there are edges there, and I wasn't testing before if there was really rainbow effect. I fear that doing too many tests may slow down much the filter. Anyway the ghosting effect comes from the fact the cloack is moving fast. Temporal smoothing is needed to diminish this temporaly random effect, and here, it uses parts that have changed. Problem is that changes here are as important in chrominance as in luminance: detecting this change may not be easy.
Kurosu is offline   Reply With Quote
Old 17th September 2002, 00:35   #14  |  Link
ErMaC
Lurker in Training
 
ErMaC's Avatar
 
Join Date: Apr 2002
Location: Halfway Between The Gutter And The Stars
Posts: 157
I agree - the problem is that the red cape was there before, and now it's not and instead there are edges there... so the smoother sticks red there.

What could be done is the smoother could look in both temporal directions - one frame ahead and one frame behind, or more - and choose the chroma from the frame which more closely matches the chroma of the current frame.

From what I understand, this is basically just a temporal smoother paired with edge detection - like I suggested in a thread about Don's new filters a week or so ago (no I'm not claiming the idea). Why not take Don's edge detection (which appears to be fast) and then simply pair it with one of the current temporal smoother plugins (which also appear to be optimized). Or am I missing something obvious and/or I'm just stupid? I can't rule out either possibility.
__________________
Justin "ErMaC" Emerson
http://www.ermacstudios.org/amvsig2.gif
"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." -H2G2
ErMaC is offline   Reply With Quote
Old 17th September 2002, 00:43   #15  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,924
@ErMaC

I'm already working on that and have a beta out there already. It's called DGdnr(). There are still several important issues to be worked out.

See here:

http://forum.doom9.org/showthread.ph...ighlight=DGdnr
Guest is offline   Reply With Quote
Old 17th September 2002, 01:19   #16  |  Link
Taranli Maren
Registered User
 
Taranli Maren's Avatar
 
Join Date: Nov 2001
Posts: 47
@neuron2
Is your filter going to be able to smooth chroma?
Taranli Maren is offline   Reply With Quote
Old 17th September 2002, 01:24   #17  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,924
It would be optional. But be aware that there is no guarantee that the obstacles will be overcome. I am currently researching into edge detection and I can't predict if a good solution will emerge.
Guest is offline   Reply With Quote
Old 18th September 2002, 19:07   #18  |  Link
Kurosu
Registered User
 
Join Date: Sep 2002
Location: France
Posts: 422
@Taranli Maren

Could you post a sequence clip ?

@To Neuron2, or any person working around that matter...
If you observe closely the UV bands, you can see there are 2 points easy to notice:
- it changes frequently
- it has an high activity
- it happens mainly on macroblocks

The first point can be discarder, because a scene change produces the same result. However the second can prevent from applying a heavy temporal smoothing on edges that shouldn't.

In addition, to prevent ghosting effects, if an inter-frames comparison is needed, then it should be done on Y.

The last point drives me to the conclusion that 2 filters could be written:
- one especially used for DCT-based coders
- one that would try (because it seems harder) to do the same job but at much finer level...

I've implemented the first with my different remarks, I'm waiting now for a torture clip
Kurosu is offline   Reply With Quote
Old 18th September 2002, 20:02   #19  |  Link
Defiler
Asker of Questions
 
Join Date: Oct 2001
Location: Florida
Posts: 433
Kurosu:
In the other thread, I linked three versions of the same test sequence. I'm not sure if you say them:
XviD format, ~1MB:
http://hellninjacommando.com/misc/avisynth/rainbow.avi

HuffYUV, ~35MB:
http://hellninjacommando.com/misc/av...nbow-huffy.avi

HuffYUV, ~13MB:
http://hellninjacommando.com/misc/av...w-huffy-60.avi

I hope these help. They were some of the most obvious rainbows I had sitting around.
__________________
"The real trick to optimizing color space conversions is of course to not do them." --trbarry, April 2002
Defiler is offline   Reply With Quote
Old 18th September 2002, 22:04   #20  |  Link
Taranli Maren
Registered User
 
Taranli Maren's Avatar
 
Join Date: Nov 2001
Posts: 47
@Kurosu
I've emailed you a link to the file. It actually has a little bit of the color ghosting from the source, but nothing like what the image showed. I can also send you a clip of some incredibly bad cross-coloration, from the Armitage III OVA. R2 dvd.
Taranli Maren is offline   Reply With Quote
Reply

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:42.


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