Quantcast Avisynth: Fixvhsoversharp (Beta) - digitalFAQ.com Forums [Archives]
  #1  
03-03-2003, 10:31 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks to MrTibs for releasing an AviSYnth VHS oversharp filter

DLL here:
http://www.kvcd.net/FixVHSOversharp.dll
Readme here ( and listed below ):
http://www.kvcd.net/fixVHSoversharp.txt

For AviSynth 2.52 ( YUY2 *ONLY * )
www.kvcd.net/FixVHSOversharp2_5.dll


Code:
FixVHSOversharp (Beta)

This filter aims to repair the light and dark halos that follow high contrast edges in VHS sources. You can see this effect particularly in B/W videos or anywhere that is a high brightness.  (You sometimes see this same effect on DVD sources as well - not nearly as noticeable though.)  This filter targets the areas of the frame that are effected only thus avoiding applying any kind of blur or smooth filter to the entire frame.

The filter dll includes two filters: FixVHSOversharp, which fixes the edges where the oversharp is on the right of the edge and FixVHSOversharpL which fixes the problem on the left of the edge.  I usually run both filters on every frame.


Usage

FixVHSOversharp(clip clip, int brightness_change, int detection_width, int offset)

FixVHSOversharpL(clip clip, int brightness_change, int detection_width, int offset)


brightness_change: The minimum brightness change to examine for the oversharp problem.  (If there isn't an oversharp problem it won't try to fix anything.) I usually set this to 40.

detection_width: The width in pixels of the oversharp scanning window.  I usually set this value to 12 or 14.
Offset: The position in pixels of the working pixel.  I usually set this to 8 (or detection_width-4).


Limitations
This filter is YUV format only.


Known Issues

Some times a "flickering flame" appears on a repaired edge.  I think this is related to a noisy source (ala VHS) but it can usually be eliminated with temporal filters.


Usage Suggestions

Apply this filter high up in your filter chain.  The filter algorithm operates on the one scan line at a time so it is safe to use on interlaced material. If "flickering" edges appear after using this filter, try applying this filter after a temporal filter.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
03-13-2003, 04:46 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Update. Beta 2 is available here: http://www.kvcd.net/FixVHSOversharp_beta2.zip

Thanks MrTibs

-kwag
Reply With Quote
  #3  
03-13-2003, 04:49 PM
MrTibs MrTibs is offline
Free Member
 
Join Date: Aug 2002
Location: Canada
Posts: 200
Thanks: 0
Thanked 0 Times in 0 Posts
Please post any comments, suggestions, questions or requests here in this forum.

Once most people seem happy with the filter, I'll post the source (ala GPL).
Reply With Quote
  #4  
03-19-2003, 08:07 AM
Malcolm Malcolm is offline
Free Member
 
Join Date: Mar 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Hi MrTibs,
i used your Filter some days ago while converting an old VHS-recording to SVCD with great success! Your Filter works perfect! Thank you for that piece of work!
I will do another conversion from VHS to SVCD this evening. I have to use avisynth 2.51 for that, because of some other filters which only works in YV12 colorspace. So, unfortunately i can't use fixVHSoversharp...

Don't you have a version for avisynth 2.51? Are you planning to convert it to avs 2.51 (and maybe to YV12 colorspace)?

Btw. I'd find it yery useful if your filter would also work vertically! I do have oversharpening on horizontal edges on my VHS-captures. Maybe, the user can get around interlacing problems by doing a separateFields() before applying your Filter and doing a weave() afterwards. If that doesn't work, because the left-out lines affect your filter so it can't work correctly, then maybe your filter could take care itself about interlaceing?!?
Btw. There's a filter (turn.dll) that can turn frames by 90 degree left or right. So, you can use your existing filter for eliminating vertical oversharpening. But it's very slow, because turn.dll only works in RGB colorspace, so you have to do a

convertToRGB()
turnLeft()
convertToYUY2()
vhsoversharp()
vhsoversharpL()
convertToRGB()
turnRight()
convertToYUY2()

bye,
Malcolm
Reply With Quote
  #5  
03-19-2003, 02:32 PM
MrTibs MrTibs is offline
Free Member
 
Join Date: Aug 2002
Location: Canada
Posts: 200
Thanks: 0
Thanked 0 Times in 0 Posts
I didn't have plans for a 2.5 version but if you want it, I'll take a look. (Perhaps I'll get the help from some more expericened 2.5 filter writers ...hint hint.)

As for oversharp problems on the vertical, I hadn't seen that so I never considered fixing it. I'll take a look at that too. Are you seeing oversharp problems above or below the edges?
Reply With Quote
  #6  
03-20-2003, 05:09 AM
sh0dan sh0dan is offline
Free Member
 
Join Date: Mar 2003
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
Porting to 2.51 is quite easy, and can probably be done in 15 minutes.

Include the new avisynth.h, change AviSynthPluginInit to AviSynthPluginInit2 - cross your finger - compile.

If you're interested I could do it for you, if you mail the source to kpo (at) zenaria (dot) com
__________________
Regards, sh0dan // VoxPod
Reply With Quote
  #7  
03-26-2003, 03:09 AM
morsa morsa is offline
Free Member
 
Join Date: Mar 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Well, first of all Hi to all members.
Second, I've been using FixVHS.. on some video not VHS source but DV.
The results aren't very good.The output has a lot of artifacts produced by FixVHS. Some letters on a public telephone get very messed up.And last but not least, the head of the guy who is talking by telephone gets merged with every structure that is behind it.
Am I making something terribly wrong?
Reply With Quote
  #8  
03-26-2003, 12:47 PM
MrTibs MrTibs is offline
Free Member
 
Join Date: Aug 2002
Location: Canada
Posts: 200
Thanks: 0
Thanked 0 Times in 0 Posts
I'm sorry to hear that you are having trouble with the filter but perhaps I can offer some suggestions:

First, make sure you are using the second beta of the filter. (It produces a much softer result with less dramatic errors.)

FixVHS does seem to mess up letters. This is due to the nature of text usually being bright (near white) on dark backgrounds as well as being closely spaced together. You can, however, make changes to the settings to minimize the problem:

1: Try raising the contrast change value until it only effects the problem areas.

2. Adjust the "detection width" to either below 8 or above 14. (Keep the Offset value 4 pixels below the Detection Width.)

3. Run the filter more than once with different Brightness_change and Detection_width settings to deal with different areas.

4. If my suggested values don't work, try your own. Don't be afraid to throw wild values at the filter.

5. Of course you can break up the source using Trim statements and apply the filter with different settings to different clips. This is time consuming but in the end it may be the only way.

Edit: Edge errors you see on your computer screen often don't show up on your TV. Test your results on your TV, only there will you be able to judge the results.


Some explanation on how the filter works:

The filter scans each line comparing the brightness values between pixel n and n+detection_width. If the difference between n and n+detection_width is above the brightness_change value, it then checks to see if there is an oversharp problem. (if pixel n+offset is greater than or less than n+detection_width) If there is an oversharp problem, it attempts to restore the edge by replacing the brightness value in the oversharped area (n+offset) with a blend the brightness values of n and n+detection_width.

Explanation of the various settings:

brightness_change: This is the minimum brightness change of the edge. The higher the value, the more edges that the filter will ignore.

detection_width: This value is theoretically the minimum width of the edge plus the width of the oversharp effect. In other words, this value needs to be wide enough to clear the oversharp problem. Setting this value very high (16+) will cause the filter to ignore edges that are closely spaced together (like text). Trial and error it the name of the game. This value must always be a multiple of 2.

offset: this value is the oversharp detection location. Only trial and error will find the best result for your source. This value must always be a multiple of 2.

Perhaps a Max_brightness_change value is needed to "ignore" certain areas or to allow the filter to more accurately "target" specific areas.
Reply With Quote
  #9  
07-04-2003, 02:52 PM
FredThompson FredThompson is offline
Free Member
 
Join Date: Jun 2003
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
MrTibs,

any chance you'll be releasing a 2.5 version?
Reply With Quote
  #10  
07-04-2003, 09:33 PM
MrTibs MrTibs is offline
Free Member
 
Join Date: Aug 2002
Location: Canada
Posts: 200
Thanks: 0
Thanked 0 Times in 0 Posts
Yup. Actually I've been re-writing the filter but in the mean time, I'll compile a 2.5 version.

Do you need YV12 or is YUY2 OK for now?
Reply With Quote
  #11  
07-04-2003, 09:38 PM
jorel jorel is offline
Invalid Email / Banned / Spammer
 
Join Date: Aug 2002
Location: Brasil - MG - third stone from the sun
Posts: 5,570
Thanks: 0
Thanked 0 Times in 0 Posts

see what means knowledge,wisdom and frienship:

the developer show the "menu" to the next compilation!

Do you need YV12 or is YUY2 OK for now?
Reply With Quote
  #12  
07-05-2003, 09:34 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Message sent by MrTibs:
"Here is a simple re-compile of the FixVHS filter for Avisynth 2.5. It still
operates in YUY2 format and has very little testing but here it is:"
www.kvcd.net/FixVHSOversharp2_5.dll

Thanks MrTibs

-kwag
Reply With Quote
  #13  
07-05-2003, 02:03 PM
FredThompson FredThompson is offline
Free Member
 
Join Date: Jun 2003
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Wow, that's really cool. Thanks

YUY2 is just fine as I'm cleaning up some DV passthru stuff lately. Thanks.
Reply With Quote
  #14  
07-05-2003, 10:44 PM
FredThompson FredThompson is offline
Free Member
 
Join Date: Jun 2003
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
You know, a YV12 version would be nice when you have the time to work on it. ScriptClip requires YV12 so that sort of encourages moving everything in that direction.
Reply With Quote
  #15  
07-15-2003, 11:52 PM
FredThompson FredThompson is offline
Free Member
 
Join Date: Jun 2003
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Would someone please create some before and after screenshots for this filter? The hardware I've got is quite good and I don't seem to have the problem this filter is supposed to correct. I'd like to see what it does.
Reply With Quote
  #16  
07-17-2003, 09:55 AM
MrTibs MrTibs is offline
Free Member
 
Join Date: Aug 2002
Location: Canada
Posts: 200
Thanks: 0
Thanked 0 Times in 0 Posts
Before and after screen shots are included in the Beta 2 zip file posted on this page. I created both screen captures and a word document to demonstrate the results.

As for the VHS oversharp problem, I tested quite a number of VHS machines both new and old and they all had the same problem. Some old TV shows demonstrate the problem (but new ones don't).

I assume that Digital Video cameras don't have the problem (I've only worked with one DV camera) so if you are doing DV conversion, you may not need this filter.

Of course, I've never tested Beta tapes.
Reply With Quote
  #17  
07-17-2003, 12:18 PM
FredThompson FredThompson is offline
Free Member
 
Join Date: Jun 2003
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
ok, in examining sample picture 5 I see what you are doing. If you look at the people, their immediate right edge has a light color halo int he before but not in the after. The after has some corruption, however, in the calendar and top of the open door.

FWIW, this type of thing also happens with NTSC DV and seems to be when there is a large contrast between two adjacent pixels. It shows up a lot on lettering because of the sharp edges and high contrast which is naturally on such items.
Reply With Quote
  #18  
07-17-2003, 01:33 PM
MrTibs MrTibs is offline
Free Member
 
Join Date: Aug 2002
Location: Canada
Posts: 200
Thanks: 0
Thanked 0 Times in 0 Posts
You are very correct about the corruption problem. When I wrote the filter, I was doing it without actually seeing the graph of the oversharp problem (since, I've written a luma graphing filter that actually allows me to see the oversharped edge's shape). Text is badly corrupted when using the filter but my overall feeling was that the frames looked better with the filter than without.

I am rewriting the filter with a new oversharp detection/correction method. I hope to correctly identify only the oversharpened edges and then correctly repair the edges. Believe it or not, this has proven to be quite a challenge since the oversharpened edges have different incorrect profiles depending on a number of factors surrounding the effected edge.
Reply With Quote
  #19  
07-17-2003, 01:54 PM
FredThompson FredThompson is offline
Free Member
 
Join Date: Jun 2003
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
I'll be more than happy to test this against DV as well.

On my support page (http://www.geocities.com/fredthompson6) you'll see some red links in the middle of the page. Two of those are for screenshots from DV. THis is a pretty good test clip for a number of reasons. TemporalSoften wipes out a lot of subtle detail in the banner and smoke of this clip. You'll see some text but also a graphic image in the upper right of the banner.
Reply With Quote
  #20  
07-17-2003, 06:26 PM
MrTibs MrTibs is offline
Free Member
 
Join Date: Aug 2002
Location: Canada
Posts: 200
Thanks: 0
Thanked 0 Times in 0 Posts
@FredThompson

When capturing from you DV camera, are you going directly from the camera or are you using a VCR to play the tape?
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: DGMPEGDec 1.0.13 beta 5 released incredible Avisynth Scripting 0 01-13-2005 09:00 AM
D.I.K.O. 0.76 Beta 3 e Gold 1.46 Beta 3 - Reportem os Bugs! vmesquita Conversão e Codificação de Vídeo (Português) 3 10-14-2004 06:10 PM
D.I.K.O. 0.76 Beta 2 e Gold 1.46 Beta 2 - Reportem os Bugs! vmesquita Conversão e Codificação de Vídeo (Português) 23 09-20-2004 02:54 PM
AviSynth 2.5.0 beta jorel Avisynth Scripting 1 01-28-2003 10:50 PM
Avisynth: Auto crop using avisynth filter beta? black prince Avisynth Scripting 6 11-28-2002 08:51 AM

Thread Tools



 
All times are GMT -5. The time now is 07:06 PM  —  vBulletin © Jelsoft Enterprises Ltd