PSharpen Refuses To Work

This forum is for questions and discussion of all the aspects of handling and cleaning up your footage with Avisynth.
Locked
User avatar
Melichan923
Joined: Tue May 30, 2006 8:21 am
Location: New Hampshire
Contact:
Org Profile

PSharpen Refuses To Work

Post by Melichan923 » Wed Oct 01, 2008 1:18 pm

After hours of struggling last night, I finally came to the board to ask for help. Scintilla suggested a wonderful filter to me called pSharpen in one of my previous threads, but I cannot get it to load in AviSynth no matter what I try. I get an error that says, "There is no function named pSharpen."

Here are the steps I've taken to try to get this to work:

- I copied the code from here: http://forum.doom9.org/showthread.php?p ... post683344.
- I made an AviSynth file named pSharpen and changed the extension to .avsi, put the code in it, saved it, and put it in my plugins folder.
- I tried adding pSharpen() to my current script and got the error message.
- I then tried making it load manually by using LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\pSharpen.avsi") and Import("C:\Program Files\AviSynth 2.5\plugins\pSharpen.avsi"), but I got an error message both times that said it was unable to load or open.
- I thought maybe a filter I had in the script along with it was conflicting with it, so I removed everything but pSharpen(), but nothing changed.
- Finally, I thought I needed to upgrade AviSynth, but I checked the version and it should work in my version: 2.57

I have no idea what else I can try. I used to be able to get plugins to work when I changed the extension to .avsi, but not anymore. It still says that the file is an "AviSynth Script" and not an "AviSynth Autoload Script" when I click on the file that I changed to .avsi. I don't know if that has anything to do with the problem though. Usually when I download a filter from a ZIP or RAR with the .dll file I can get it to work, but I can't find pSharpen uploaded anywhere. Maybe I need to try updating something?

I know too many files in the plugins folder can cause problems, so if it helps answer any questions, I have 78 files in my plugins folder.

Is there anything else I can try to get this filter to work?
Image
Image Image

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Post by Scintilla » Wed Oct 01, 2008 5:33 pm

What happens if you rename the file to .AVS and load it with:

<b>Import("C:\Program Files\AviSynth 2.5\plugins\pSharpen.avs")</b>

If even that doesn't work, then you've got serious problems.

Do you have any other filters in .AVSI functions in your plugins directory (LimitedSharpen, mfToon, derainbowers)? Do they still work normally?

And, of course, it never hurts to Image
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

User avatar
Melichan923
Joined: Tue May 30, 2006 8:21 am
Location: New Hampshire
Contact:
Org Profile

Post by Melichan923 » Wed Oct 01, 2008 6:03 pm

Scintilla wrote:What happens if you rename the file to .AVS and load it with:

<b>Import("C:\Program Files\AviSynth 2.5\plugins\pSharpen.avs")</b>
Yes, I had already tried it and for the heck of it, tried it again just now when you suggested it, no luck. :(

I get an error message that says, "Import: Couldn't open 'C:\Program Files\AviSynth 2.5\plugins\pSharpen.avs'"
Scintilla wrote:If even that doesn't work, then you've got serious problems.
:sweat: Wonder what I did now? Lol.
Scintilla wrote:Do you have any other filters in .AVSI functions in your plugins directory (LimitedSharpen, mfToon, derainbowers)? Do they still work normally?
Yes, I do. I have four that have .avsi at the end including pSharpen. I just tested them all out. None of them work. The only ones working with that extension have another file next to them with the same name not in that format. Meaning, I probably downloaded them from a zip.

I could never get FastLineDarken or DeHalo to work ages ago either. I remember now since I see them in the folder. They are there still not working with their extension changed to .avsi.
Scintilla wrote:And, of course, it never hurts to Image
True. :D

My script:

Code: Select all

Import("C:\Program Files\AviSynth 2.5\plugins\pSharpen.avs") 
MPEG2Source("C:\Documents and Settings\Desktop\dvdone.d2v", cpu=6)
BiFrost()
deint = TDeint(mode=2, mtnmode=3, blim=100)
TFM(cthresh=4, slow=2, clip2=deint)
TDecimate(mode=1) 
Crop(4,0,-4,-0)
Lanczos4Resize(640,480)
ttempsmooth(maxr=5, lthresh=7, cthresh=8, lmdiff=4, cmdiff=6, strength=5, fp=true, vis_blur=0)
undot()
pSharpen()
Converttorgb32()
Thanks for replying. I hope I didn't screw something up somehow since changing it to .avsi isn't working... *Nervous laugh*
Image
Image Image

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Post by Scintilla » Wed Oct 01, 2008 6:15 pm

Well, that's sure troubling. Just to be sure, you did save the AVSI file with a plain text editor such as Notepad, and not something like MS Word, right?
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

User avatar
Melichan923
Joined: Tue May 30, 2006 8:21 am
Location: New Hampshire
Contact:
Org Profile

Post by Melichan923 » Wed Oct 01, 2008 6:32 pm

Scintilla wrote:Well, that's sure troubling. Just to be sure, you did save the AVSI file with a plain text editor such as Notepad, and not something like MS Word, right?
Yes, Notepad. I'm really hoping it's just something that's outdated and will fix when I re-install something. :-? Too bad I'll probably never know what it is I'd need to install though, Lol.

Not sure if this will help any, but this is the exact code I am putting into the .avsi file:

Code: Select all

function pSharpen   (clip clp,
                    \int "strength", int "threshold",
                    \float "ss_x", float "ss_y",
                    \float "dest_x", float "dest_y")
{
    # getting the input image size
    ox = clp.width
    oy = clp.height
    
    # parsing the input values
    strength = default(strength, 25)
    threshold = default(threshold, 75)
    ss_x = default(ss_x, 1.0)
    ss_y = default(ss_y, 1.0)
    dest_x = default(dest_x, ox)
    dest_y = default(dest_y, oy)
    
    strength = strength<0>100? 100 : strength
    threshold = threshold<0>100? 100 : threshold
    ss_x = ss_x<1.0? 1.0 : ss_x
    ss_y = ss_y<1.0? 1.0 : ss_y
    
    # oversampling
    clp =   ss_x!=1.0 || ss_y!=1.0 ?
            \clp.lanczosresize(round(ox*ss_x/8)*8,round(oy*ss_y/8)*8) :
            \clp
    
    # val is initialized with the input luma value
    val = clp.greyscale()

    # calculating the max and min in every 3*3 square
    max = val.expand()
    min = val.inpand()
    
    # normalizing max and val to values from 0 to (max-min)
    nmax = yv12subtract(max,min,0,false)
    nval = yv12subtract(val,min,0,false)
    
    # initializing the strings used to obtain the output luma value
    s = string(strength/100.0)
    t = string(threshold/100.0)
    x0 = string((threshold/100.0)*(1.0-strength/100.0)/(1.0-(1.0-threshold/100.0)*(1.0-strength/100.0)))
    expr = \
        "x y / 2 * 1 - abs "+x0+" < "                   +\
            s+" 1 = "                                   +\
                "x y 2 / = 0 y 2 / ? "                  +\
                "x y / 2 * 1 - abs 1 "+s+" - / "        +\
            "? "                                        +\
            "x y / 2 * 1 - abs 1 "+t+" - * "+t+" + "    +\
        "? "                                            +\
        "x y 2 / > 1 -1 ? * 1 + y * 2 /"
    
    # calculates the new luma value pushing it towards min or max
    nval = yv12lutxy(nval,nmax,expr)
    
    # normalizing val to values from min to max
    val = yv12lutxy(nval,min,"x y +")
    
    # applying the new luma value to the original clip
    clp = clp.mergeluma(val)
    
    # resizing the image to the output values
    clp = ss_x!=1.0 || ss_y!=1.0 || dest_x!=ox || dest_y!=oy ? clp.lanczosresize(dest_x,dest_y) : clp
    
    return clp
}
Image
Image Image

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Post by Scintilla » Wed Oct 01, 2008 9:13 pm

And when you save the file, the "Encoding" option in the Save dialog box is set to "ANSI"?
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

User avatar
Melichan923
Joined: Tue May 30, 2006 8:21 am
Location: New Hampshire
Contact:
Org Profile

Post by Melichan923 » Thu Oct 02, 2008 2:05 pm

Scintilla wrote:And when you save the file, the "Encoding" option in the Save dialog box is set to "ANSI"?
Yes. However, I think something is starting to kick in when I tried it again this morning. I did as I usually do but instead of getting the normal error message when trying to view it I got this:

" Script Error: There is no function named 'expand.' "

And it's pointing to the line that pSharpen is on. Any ideas?
Image
Image Image

User avatar
Kariudo
Twilight prince
Joined: Fri Jul 15, 2005 11:08 pm
Status: 1924 bots banned and counting!
Location: Los taquitos unidos
Contact:
Org Profile

Post by Kariudo » Thu Oct 02, 2008 2:22 pm

expand is part of masktools.dll (not sure if it's the old version or mt_masktools)
my bet is on the old version...check to see if you have masktools1.5.x in your plugins folder
Image
Image

User avatar
Melichan923
Joined: Tue May 30, 2006 8:21 am
Location: New Hampshire
Contact:
Org Profile

Post by Melichan923 » Thu Oct 02, 2008 3:31 pm

Kariudo wrote:expand is part of masktools.dll (not sure if it's the old version or mt_masktools)
my bet is on the old version...check to see if you have masktools1.5.x in your plugins folder
The version in my folder is "mt_masktools" and it's the only masktools related file in the plugins folder.
Image
Image Image

User avatar
Scintilla
(for EXTREME)
Joined: Mon Mar 31, 2003 8:47 pm
Status: Quo
Location: New Jersey
Contact:
Org Profile

Post by Scintilla » Thu Oct 02, 2008 5:18 pm

Then you'll need MaskTools 1.5.8 as well, which can be found here:
http://manao4.free.fr/MaskTools-v1.5.8.zip

Funny that it suddenly started working again...
ImageImage
:pizza: :pizza: Image :pizza: :pizza:

Locked

Return to “AviSynth Help”