Log in

View Full Version : Guava Comb


Pages : [1] 2

High Speed Dubb
7th November 2002, 02:06
Here is Guava Comb, a software comb filter. It is meant to get rid of rainbows and dot crawl in stationary parts of an image.

This filter is dedicated to my dad, the guava hunter.

http://students.washington.edu/ldubb/computer/GuavaComb_v0_9a.zip

The Guava works through the efforts of a tiny demon, who watches to see which pixels are changing back and forth. When it spots one, it thwaps the pixel so it will learn to stop being so fickle. The demon’s efforts are quite inexpensive, as he has been unemployed ever since the passage of the second law of thermodynamics.

Oddly enough, that’s actually a moderately accurate description of this filter!

This is a version 0.9 release because I am not all that familiar with the right way to handle interlaced material in a script. That’s something of a handicap when designing a filter meant for interlaced clips. Please tell me if the way it’s handling clips (interlaced or otherwise) is messed up.


Dot crawl and rainbows are an artifact of mistakes in conversion of a composite signal into its individual color components. So if your video was never encoded as a composite signal, this filter will probably be useless. On the other hand, it’s possible that this filter might coincidentally help remove some other kinds of periodic artifacts. To test out that possibility, there is an extra Mode setting called “Progressive” which will force the filter to look for every other frame patterns.

If your video has been encoded as a composite signal — as an over the air broadcast, or over a composite cable — then comb filtering is likely to be very useful. Crosstalk can cause subtle picture problems even in video where it is not obvious.

The down side is that the settings are not easy to choose, and that this isn’t an especially sophisticated filter. As a result, it can cause artifacts. Take a look at the docs for ways to set the options to minimize problems.

soulfx
7th November 2002, 02:18
Sweet! Thank you very, very much for this filter. I'll test it out after I get Bernie Mac captured.

Zarxrax
7th November 2002, 04:50
Hmmm... it didn't even make a dent in a rainbow torture clip I have :(

High Speed Dubb
7th November 2002, 04:58
Hmm... could you try it at really permissive settings? i.e., something like

return AviSource("C:\CAPTUREcombExample.AVI").ConvertToYUY2().GuavaComb(mode="ntsc", MaxVariation=70, activation = 10, recall = 70)

That’ll cause too many artifacts to be useful, but should confirm whether the problem qualifies as crosstalk — or whether there’s something messed up with the phase [PS: that should have read frequency] of the filter.

Also, what is the resolution and duration of the clip? And is there any motion in the area of the crosstalk?

soulfx
7th November 2002, 05:51
From the testing I've just started it does sucessfully get rid of comb crawl, but I have to put it before the IVTC filter. If I put it after it seems like the filter somewhat fades in and out of what its supposed to do.

So it handles interlaced streams better then progressive it seems.

I've got some more testing to do, but so far it looks good.

High Speed Dubb
7th November 2002, 05:56
Yep, it should definitely be run before deinterlacing or inverse telecine.

High Speed Dubb
7th November 2002, 06:02
... though now that I think about it, it would be possible to allow a mode for material which has already been deinterlaced. That should work reasonably well for NTSC, but will still leave some residual artifacts on PAL stuff. Still, you’d always get better results running the comb filter before line doubling.

Xenoproctologist
7th November 2002, 06:04
*JOYGASM!*
I've been hoping someone would port this thing to avisynth for eons.


@soulfx:
It's not that it handles progressive better than interlaced. It's just that it depends on the shimmering having a certain regular period, and IVTC disturbs that period.

High Speed Dubb
7th November 2002, 06:36
Yep — Just how badly it will be disrupted depends on the kind of IVTC/deinterlacing.

NTSC deinterlacing will usually result in crosstalk regions being detected as motion, and bobbed. As coincidence has it, simple bobbing is an NTSC comb filter, so this could be dealt with by just checking every other line for crosstalk. (More sophisticated bobbing algorithms could cause trouble, though.)

PAL deinterlacing would probably be messy, with some crosstalk detected as motion, other crosstalk not. So that’s a case where comb filtering needs to go first.

2:2 pulldown material should be handled okay before or after comb filtering. But it would still be better to run the comb filter before, since correcting crosstalk makes things easier for the pattern detector.

Handling 3:2 pulldown material would depend on knowing the pattern which was applied. :( And besides, 3:2 pattern detection is badly mislead by crosstalk. (It causes an inflated difference between matching frames.) So that’s another case where comb filtering really needs to go first.

Boulder
7th November 2002, 07:06
Thanks Lindsey, I've been waiting for a good rainbow removal filter. I'll give it a go with my latest analog capture and see if it works:)

soulfx
7th November 2002, 07:21
I understand, I guess I just mis-read the inital post of "Please tell me if the way it’s handling clips (interlaced or otherwise) is messed up." Putting it on pure interlaced material works fine for me; that's all I have.

The default settings work great for me and I am just taken back at how still all my captures are now. The little crawly dots, chroma rainbows, -- it's all gone now.

I have noticed on scene changes it does leave little bits of color from what it was smoothing out on the previous scene, but compared to some temporal smoother's I've messed with in the past I can deal with it.

This filter is speedy too.

Xenoproctologist
7th November 2002, 07:37
@High Speed Dubb:
What's the likelyhood of getting scene-change detection implemented?

High Speed Dubb
7th November 2002, 07:52
Originally posted by soulfx
I understand, I guess I just mis-read the inital post of "Please tell me if the way it’s handling clips (interlaced or otherwise) is messed up." Putting it on pure interlaced material works fine for me; that's all I have.Sorry about that — I was thinking of 30 FPS 480x640ish captures as “progressive,” which isn’t really right.

As it’s written, the filter checks vi.field_based, and assumes each “frame” is really two weaved (woven?) fields if field_based is false. (That’s probably meaningless to you, but it might let some of the programmers catch any mistakes. I’ll put up the code reasonably soon to make this a little clearer.)

I’m mostly looking right now for
- Whether it works
- Whether the syntax is sensible, and follows the conventions for interlaced clips
- Reasonable parameters for PAL use

About the flashes after scene changes — A scene change detector seems like a bit of a kludge. It would work, but a better solution would be to look a couple frames ahead of the video, to confirm that crosstalk is continuing. That would also help get rid of scattered motion spots.

Then again, a scene detector would be faster and easier. ;)

Xenoproctologist
7th November 2002, 08:18
Originally posted by High Speed Dubb
About the flashes after scene changes — A scene change detector seems like a bit of a kludge. It would work, but a better solution would be to look a couple frames ahead of the video, to confirm that crosstalk is continuing. That would also help get rid of scattered motion spots.

Then again, a scene detector would be faster and easier. ;)
Reading ahead might be more elegant, but it wouldn't be more correct. A scene-change — when it occurs — should instantaneously kill all blending.

Now, the elegant and correct solution would be to read ahead and detect scene-changes. That way, all blending is killed at the moment of scenechange and crosstalk is blended anew on the first frame of the new scene.

High Speed Dubb
7th November 2002, 08:40
Hmm... No, I don’t agree. Logos and graphics will sometimes stay on screen through a scene change, and those should be smoothed.

A scene change can be thought of as motion which occurs throughout the screen. (Well, it gets to be different if you’re going to track motion vectors, but that’s much more sophisticated than I want to mess with for this.) So I’d prefer to just improve the motion detection. Besides, that needs improvement, regardless.

jarthel
7th November 2002, 15:04
will test later :)

jayel

lamer_de
7th November 2002, 18:25
First, let me thank you for your filter. :)

Unfortunately, it doesn't seem to have any effect on my Simpsons TV Cap in SVCD. Maybe i overlooked something, but i proceeded as stated in the readme, even tried the "insane" settings, but the only effect it had were strange artifacts and ghosting (with the extreme settings). Maybe the crawling is too little, or the source format is wrong (i tried NTSC (it's NTSC), PAL and Progressive, each with no visible changes)

I used this AVS:

LoadPlugin("c:\PROGRA~1\GORDIA~1\mpeg2dec.dll")
LoadPlugin("c:\PROGRA~1\GORDIA~1\GuavaComb.dll")
LoadPlugin("c:\PROGRA~1\GORDIA~1\DeComb.dll")
mpeg2source("C:\the.simpsons.14x01.svcd.d2v")
ConvertToYUY2()
# ConvertoYUV shouldn't be needed here, right?
GuavaComb(mode="ntsc", MaxVariation=70, activation = 10, recall = 70)
Telecide(chroma=true,threshold=8)
Decimate(cycle=5)

Note that the MaxVar,activation and recall values shown in this avs are too strong, but it was simpy to see the effect( which didn't show up ;)
I upped the corresponding scene here (http://acnova.com/~forumpic/dot.crawl.rar). I would be very happy if somebody could have a look on it or tell me what i did wrong. The crawling is most visible at Maggie's chair (see attached image [may take some time till approved by a moderator] EDIT: I guess i was too dumb to attach the image, so simply dl the rar ;) )

TIA,
lamer_de

soulfx
7th November 2002, 21:29
lamer_de,

Have you made sure you have ample amount of time up to the points you are looking at? Make sure if you want to look at specific frames to go back about 40 frames or so then play the video forward to the frame you want to look at.

I've had tremendous results with the filter, but you have to make sure you are running it on interlaced material. If it's not interlaced then it can't properly figure out what or where the comb problems exist.

But from the script and everything you've mentioned it should be working. Maybe you can cut out a little snippet of the video and put it up and see if someone here can trouble shoot it further.

I would be able to duplicate exactly the same clip (I captured the Halloween Special this last Sunday too), but I've allready processed it, deleted it and moved on.

High Speed Dubb
7th November 2002, 21:47
lamer_de,

It could be that the problem lies here
mpeg2source("C:\the.simpsons.14x01.svcd.d2v")

The compression may have disrupted the crosstalk artifacts enough to throw off the filter. I’ll take a look at the clip this afternoon to check.

Zarxrax
8th November 2002, 00:08
@High Speed Dub:

Nope, those settings didn't have any visible effect on the clip.
I'm sending you a private message so you can see whats wrong with it.

High Speed Dubb
8th November 2002, 01:48
lamer_de,

Um... I feel silly for asking this, but how do I view the clip? Is there a particular version of mpeg2source I should use?

Zarxrx,

Thanks again for sending over the video.

Hmm... It’s 24 FPS, but has the phase I’d expect of 50 FPS PAL stuff. It sounds like I need a manual override to let you specify the phase offset by hand, for any unusual cases. That’s not much fun, since I doubt anyone knows or cares about their video’s color phase offset. But it looks like it could be needed, occasionally. [PS: edited for technical accuracy]

Once I force it to use PAL interlaced phase, it works great for most of the clip. The strange blurring near the end does prevent the comb filter from working, though.

High Speed Dubb
8th November 2002, 01:53
While I’m at it — Does anyone know of a good general purpose (and free) color sampler accessory? That would be invaluable for this “just what was that pixel’s color?” kind of analysis.

High Speed Dubb
8th November 2002, 01:55
Oh, and I should report a known bug. The handling of random access into a clip is messed up at the moment. The good news is that fixing it should also improve the motion detection. :)

Zarxrax
8th November 2002, 02:36
Here's a great color thingy called Pixie, I use it all the time.
http://www.nattyware.com/pixie.html

High Speed Dubb
8th November 2002, 02:50
Thanks — That should do very nicely.

Just to show off, here is (with permission) a before/after comparison of part of a shot from Zarxrax’s clip. First before...

High Speed Dubb
8th November 2002, 02:51
And after...
(Unfortunately not all of it looks this nice — there was some kind of blurring/motion in part of the clip.)

High Speed Dubb
8th November 2002, 04:22
Zarxrax,

Until I post a new version, try using something like:
return AviSource("C:\RAINBOW.AVI").ConvertToYUY2().AssumeFieldBased().GuavaComb(mode="PAL", MaxVariation=25, activation = 60, recall = 75)

The trick there is the AssumeFieldBased() command.

Zarxrax
8th November 2002, 04:53
Wow thats nice :)

jarthel
8th November 2002, 07:38
nice Lindsay. Just a question. What's the speed penalty when you used guava? before and after FPS would be nice. :)

jayel

High Speed Dubb
8th November 2002, 08:01
I’m not sure how to benchmark an AVISynth filter — they seem mostly limited by disk speed and such. The DScaler version of this uses about 350 MHz. (In other words, if you have a 1.4 GHz processor, then it takes 1/4 of the processor time to process 60 720x240 fields per second.)

lamer_de
8th November 2002, 15:29
@HighSpeedDubb
Sorry, my fault. Forgot to put the .dv2 up, so you have to run it through dvd2avi first.
Soulfx mentioned that the effect needs some time to kick in, so i put up a bigger sample (1MB). The .dv2 points to C:\simpsons.dot.crawl.mpg, if you extract it to another location you'll have to cahnge the path in the .dv2 (open with notepad and correct path)

http://members.lycos.co.uk/tsheaven/dotcrawl.rar (Lycos may kick the account if they notice traffic, so you better dl it before it's down ;)

Thanks for your efforts, really appreciating this.

CU,
lamer_de

soulfx
8th November 2002, 22:51
The problem with the clip is that it is not FieldBased. It had interlacing artifacts, but the frames are progressive and do not contain feilds.

Subtitle(String(IsFieldBased()))

There is nothing for Guava to be able to figure out on progressive frames.

High Speed Dubb
9th November 2002, 06:11
Would anyone be able to post or send me a clip where the Guava causes motion or scene change artifacts? It would have to be HuffYUV compressed and before processsing with the comb filter. 30 fields (20 for NTSC) would probably be enough. I have some changes in mind, and would like to test whether they improve specificity.

jarthel
12th November 2002, 15:02
I have this script

--------------------
body=mpeg2source("d:\dvdrips\lodoss14\lodoss14.d2v").trim(0,40176).Telecide(Guide=1,Gthresh=40,Threshold=20,Chroma=True,dthreshold=10,Post=true).Decimate(cycle=5).crop(16,3,696,475)._2DCleanYUY2().GuavaComb(Mode="NTSC").lanczosresize(640,480)

return body
--------------------

well I previewed the output in vdub even without encoding it and rainbow effects are still there. I tried various settings (mainly from the .avs included in the zip file) without much luck. Any idea Lindsay. I'm using vobs to encode them. Maybe the rainbow is inherent to the frame?

Thanks

jayel

ps. If you need a huffyuv (passed through the filters stated above), I can send them to you. If you need a huffyuv with no filtering, I have to find out what frame is giving me error. Only 5 frames max as I'm on dialup. :)

High Speed Dubb
13th November 2002, 00:59
jarthel,

I would run the comb filter before Telecide() and Decimate(), which are bound to mess up any crosstalk patterns. It would also be better to run it before the 2D smoothing.

If that doesn’t work — Could you try cropping it to something like 32x32 (without resizing)? There’s no need to send the entire frame. Just make sure there’s some easy to see crosstalk in that box. It would need to have at least 20 fields, though.

ps. If you need a huffyuv (passed through the filters stated above), I can send them to you
No, don’t send the clip after processing — It would be much more useful if it were sent unprocessed (except for some cropping and HuffYUV compression).

jarthel
13th November 2002, 02:19
check your mail. It's huffyuv and resolution is around 250 x 180.
It's also unfiltered except for cropping.

Thank you.

jayel

High Speed Dubb
13th November 2002, 04:03
jarthel,

Thanks for the clip. It looks like there’s motion going on throughout it, though, which means this filter (which only provides temporal comb filtering) can’t improve it.

High Speed Dubb
13th November 2002, 04:07
Oh, and I’d forgotten to post earlier...

lamer_de,

Unfortunately, I think soulfx is right — the clip seems to have undergone some kind of inverse telecine/deinterlacing which has obscured the pattern of the crosstalk.

It also looks like MPEG encoding does suppress the crosstalk somewhat. That’s mostly a good thing, but for the purposes of this filter it makes the crosstalk somewhat harder to detect.


On a more positive note, I’ve discovered that this filter can often correct "hanging dots" problems, which are an artifact of an overenthusiastic 2D comb fitler. So it does make sense to run this even if your video input card has its own 2D comb filter. (But if your video input card has a 3D comb, you’ll probably want to skip this one.)

jarthel
13th November 2002, 04:17
Originally posted by High Speed Dubb
jarthel,

Thanks for the clip. It looks like there’s motion going on throughout it, though, which means this filter (which only provides temporal comb filtering) can’t improve it.

Ok Thanks Lindsay. Are you able to make a motion comb filter? :)

jayel

High Speed Dubb
13th November 2002, 04:26
I’ve tried to write a 2D comb filter, but so far the blurring has been worse than the crosstalk it was meant to solve.

Richard Berg
19th November 2002, 00:35
Hi Lindsey,

Your broadcast filters have worked wonders for me in general, but I've got a clip here that I can't get Guava to de-rainbow no matter the settings (had to follow it up with CNR2, which I'd rather not until it's better at avoiding ghosts). 30 frames of Huff (7.5MB) once it's done uploading: http://www.duke.edu/~jrb/rainbow.avi

High Speed Dubb
20th November 2002, 08:27
Richard,

For some reason, I keep getting a 0 KB file when I try the link.

Richard Berg
20th November 2002, 09:31
Hrm, me too. Check again in about 3 minutes.

edit: ok I'm pretty sure it should work now

High Speed Dubb
20th November 2002, 10:41
It is succeeding on some of the video — Starting at about field 15, the crosstalk in the thicker areas (especially the W) is reduced.

For the rest of it, the problem is that the area of crosstalk is very thin and italic. The filter is using a trick, and only looking for crosstalk in vertical pairs of pixels. That lets it identify the crosstalk more quickly (yes, without that it would take even longer to find it). But in the italic text, the shimmering is following a thin diagonal pattern, so only one of each pair of pixels is changing. That isn’t enough to trigger the filter.

pbristow
8th March 2016, 12:37
Just as a tip to fellow Guavacomb users: For any scenes with stubborn cross-chroma effects, try following GuavaComb with a call to TemporalSoften... or even two! =:o}

I'm using two passes of TemporalSoften(1, 4, 28, 15, 2) to nuke the truly horrific green/magenta strobing caused by some checquered pink and white bedding (as well as taking care of general analog video fizziness). It took a lot of testing and some lateral thought to get the best results, but the results confirm that for alternating colour patterns over several frames, two passes of radius 1 work better than a single pass of radius 2 (which tends to over-compensate) or 3 (which strikes a good balance bit is slower and more prone to flashing on sudden movements), and it allows you to reduce the colour difference threshold (the third number - I tried everything up to 52) to something that doesn't flatten legitimate colour changes so much.

Will try to post a sample later. (I need to go to work now! =:o} )

TheFluff
9th March 2016, 03:57
there are guavacomb users these days? none of them have posted in this thread for almost fourteen years, so you'd think interest in the filter isn't exactly at an all time high

there have been a few other filters that do the same thing released in the last decade, you know

(I think your post sets a new record for worst doom9 thread-necromancy of all time, by the way; we used to keep track, but I don't have the list of previous record holders anymore)

pbristow
9th March 2016, 05:23
*SHRUGS* I tried a few, found Guavacomb did what I wanted (dotcrawl removal, mainly) with the least fuss. It's still listed in the "official" docs that come with Avisynth, after all. =:o}

(I didn't even notice the age of the last post until after I'd made my post, anyway. [BLUSH] )

romangal
7th June 2020, 17:45
Ive used guavacomb many times. This filter is far from perfection but it works ok. Hope someone could update it add some optimizations. May be fix something. I dont know but ive found this filter better other doing the same job.

Madaqua
7th July 2020, 17:47
Hey guys, can somebody post this plugin? official link doesn't work.

StainlessS
7th July 2020, 18:14
official link doesn't work.
See Mediafire below this post in my sig, in HOSTED folder.

Also @ SendSpace below, for 30 days.