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

Reply
 
Thread Tools Search this Thread Display Modes
Old 5th May 2022, 22:20   #1  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 703
Sharpen function - nasty artifacts

I made a sharpen function called BSharp which works well in most cases and pretty fast. But the culprit that gives me the artifacts seen in the image below seems to be internal sharpen. Does someone have an idea how to get rid of these nasty artifacts yet still retain the sharpening?

Function:
Code:
function bsharp(clip c, float "str", float "pblur"){
str = Default(str, 0.5)
pblur = Default(pblur, 0.7)
B = merge(c,c.removegrain(20),(pblur))
S = B.sharpen(1.0).sharpen(str)
M = C.greyscale().ex_levels(47,0.76,170)
mt_merge(c,s,m,luma=true,Y=3,U=2,V=2)
return last
}
Artifacts
anton_foy is offline   Reply With Quote
Old 5th May 2022, 22:25   #2  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Not sure if this has something to do with it, but luma=true forces chroma processing in mt_merge. So U=2,V=2 does not do anything. Set luma to false and see if it helps any.

Last edited by Reel.Deel; 5th May 2022 at 22:27. Reason: typo
Reel.Deel is offline   Reply With Quote
Old 5th May 2022, 23:39   #3  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 703
Quote:
Originally Posted by Reel.Deel View Post
Set luma to false and see if it helps any.
Thanks it actually made it better in other ways but the main problem still remains. Maybe I should choose another sharpener, but which?
anton_foy is offline   Reply With Quote
Old 6th May 2022, 13:20   #4  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Quote:
Originally Posted by anton_foy View Post
Maybe I should choose another sharpener, but which?
Possibly, per the wiki: "Chaining calls to Sharpen is not a good idea, as the image quickly deteriorates."
Reel.Deel is offline   Reply With Quote
Old 6th May 2022, 15:15   #5  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 703
Quote:
Originally Posted by Reel.Deel View Post
Possibly, per the wiki: "Chaining calls to Sharpen is not a good idea, as the image quickly deteriorates."
Perfect thanks I believe that is the problem isolated then. Now to find another stronger sharpener.
anton_foy is offline   Reply With Quote
Old 6th May 2022, 15:26   #6  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 989
Quote:
Originally Posted by anton_foy View Post
Now to find another stronger sharpener.
Try all 9000 of them: http://avisynth.nl/index.php/Externa...ers#Sharpeners
VoodooFX is offline   Reply With Quote
Old 6th May 2022, 22:46   #7  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 703
Quote:
Originally Posted by VoodooFX View Post
Thanks!
anton_foy is offline   Reply With Quote
Old 7th May 2022, 15:58   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by Reel.Deel View Post
"Chaining calls to Sharpen is not a good idea, as the image quickly deteriorates."
Indeed, see last three images of colorbars below
Quote:
Originally Posted by StainlessS View Post
Below StringRepeater() script function does not use RT_Stats, but this a good as any place to put it, perhaps of use.

Code:
Function StringRepeater(String BaseS, String RepS, int n) { # https://forum.doom9.org/showthread.php?p=1878193#post1878193
    # Add n instances of repeat string RepS, to base string BaseS.
    return (n>=1) ? StringRepeater(BaseS+RepS,RepS,n-1):BaseS
}
Demo
Code:
# DEMO USE # For AVS+, GScript stuff commented out
# GScript("""
SSS=""
for(i=0,8) {
    S=StringRepeater("MyClip",".Blur(1.58,1.58)",i)
    SSS=RT_String("%s%d] %s\\n",SSS,i,S)
}

Colorbars(width=1024,Height=240).Subtitle(SSS,lsp=0)
# """)   # End Of GScript


EDIT: For above demo, could then do eg Eval(S) to to use one of the result strings.

eg
Code:
MyClip=Colorbars
Eval(StringRepeater("MyClip",".Blur(1.58,1.58)",10)) # for 10 iterations of blur(1.58,1.58), where 1.58 is MAX possible blur.
EDIT: Or Sharpen 10 times at max
Code:
MyClip=Colorbars
Return Eval(StringRepeater("MyClip",".Sharpen(1.0,1.0)",10)) # for 10 instances of Sharpen at max possible.
Sharpen @ Max x 10.


EDIT: Sharpen @ Max x 50.

EDIT: Sharpen @ Max x 250.


EDIT: Have not tried to max it out to find where stack overflow occurs, but for some other function many years ago a recursive
function using GScript maxed out at about 450 recurses, and error abort (probably using avs v2.58).
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 7th May 2022 at 16:04.
StainlessS 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 07:03.


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