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 20th June 2021, 20:47   #341  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,361
Format() is AVS+ only I think, don't know from what version.

This is an HBD aware TV<->PC levels conversion function. link

And here is an HBD aware Levels function. link

They both require ExTools found in the repo.
I'm in the middle of a rebase so I'm taking my time and preparing an elaborated post for possible solutions, so if something triggers an error let me know, or use an earlier version of ExTools (v1.6 or v1.7).

EDIT: Oh by the way, this all to linearize an image/source right? I'm also in the middle of a refactor for Transforms Pack but the gamma function is very functional at this state. Pick the alpha and gamma value from this list.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread

Last edited by Dogway; 20th June 2021 at 20:51.
Dogway is offline   Reply With Quote
Old 20th June 2021, 22:48   #342  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
I got gamma correction working with Levels. That's probably the best option.
MysteryX is offline   Reply With Quote
Old 20th June 2021, 22:55   #343  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,361
Good luck!
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 21st June 2021, 03:15   #344  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Releasing FrameRateConvert v2.0-Beta, DLL only. Works in both VapourSynth and Avisynth.

- Ported to VapourSynth
- Fixed a bug in StripeMask
- StripeMask linear gamma correction is now more accurate
- StripeMask now accounts for PC vs TV range
- StripeMask: added fullRange parameter, set to True if input is in full range

For VapourSynth, FMTC dll is required. For Avisynth, you can use the previous AVSI file and the StripeMask will have a few corrections. Note that StripeMask thr parameter default is now 28 instead of 26, and possibly could use further adjustment.
MysteryX is offline   Reply With Quote
Old 21st June 2021, 04:45   #345  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
Thanks
kedautinh12 is offline   Reply With Quote
Old 21st June 2021, 08:31   #346  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Thx for the port.
I see some warnings / problems in vsedit

Code:
clip = core.frc.StripeMask(clip)
Quote:
Core freed but 6 filter instance(s) still exist
Core freed but 1075200 bytes still allocated in framebuffers
Plugin C:/Users/anato/AppData/Roaming/VapourSynth/plugins64/FrameRateConverter-x64.dll tried to register 'ConvertFpsLimit' more than once. Second registration ignored.
Plugin C:/Users/anato/AppData/Roaming/VapourSynth/plugins64/FrameRateConverter-x64.dll tried to register 'ConvertFpsLimit' more than once. Second registration ignored.
Plugin C:/Users/anato/AppData/Roaming/VapourSynth/plugins64/FrameRateConverter-x64.dll tried to register 'ConvertFpsLimit' more than once. Second registration ignored.
and if I want to preview the mask I get
Code:
Error on frame 0 request:
Resize error -1: invalid graph state L910: !m_state.has_chroma() || m_state.plan

Code:
core.frc.ContinuousMask(clip, 24000, 1000) #crashes the editor
Code:
Log shows this msg
setVideoInfo: The frame rate specified by ContinuousMask must be a reduced fraction. (Instead, it is 24000/1000.)
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 21st June 2021, 19:52   #347  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Fixed most of those bugs.

Quote:
Error on frame 0 request:
Resize error -1: invalid graph state L910: !m_state.has_chroma() || m_state.plan
This error is in FMTC.transfer; but it works when run in VirtualDub.

Code:
video = core.resize.Point(video, format=vs.GRAY16)
video = core.fmtc.transfer(video, transs="709", transd="linear")
video = core.resize.Point(video, format=vs.GRAY8)
There's the option of converting to RGBS but it would be slower and would produce a slightly brighter output than in Avisynth.

I released a new beta at the same link.

Last edited by MysteryX; 21st June 2021 at 19:56.
MysteryX is offline   Reply With Quote
Old 21st June 2021, 20:24   #348  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Is 16bit int or 32bit float input supported? Output of ContinuousMask() looks strange with non 8bit input.


The parameter seems to be ConvertFpsLimit(clip, num, den, ratio) but I get this error msg when calling ConvertFpsLimit(clip, 24000, 1000, 1)
Code:
vapoursynth.Error: ConvertFpsLimit: Can only set one of the following parameters: num/den (fraction), fps (float), preset (string) or match (clip).
+ it crashes with just ConvertFpsLimit(clip)
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 21st June 2021, 20:51   #349  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
ContinuousMask gives strange output on regular clips. It's meant to process masks. I didn't document it either -- don't remember what it did exactly :P Works in the context it's used for though. Gives same output as it did before in Avisynth.

Since I can't register ConvertFpsLimit several times like in Avisynth, the syntax is now

Code:
"clip:clip;"
"num:int:opt;"
"den:int:opt;"
"fps:float:opt;"
"preset:data:opt;"
"match:clip:opt;"
"ratio:int:opt;"
Forgot to validate if none is set; fixed it.

Last edited by MysteryX; 21st June 2021 at 20:54.
MysteryX is offline   Reply With Quote
Old 21st June 2021, 22:48   #350  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Quote:
Originally Posted by MysteryX View Post
ContinuousMask gives strange output on regular clips. It's meant to process masks.
I'm pretty sure this output is stranger then it should be
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 22nd June 2021, 03:47   #351  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Quote:
Originally Posted by ChaosKing View Post
I'm pretty sure this output is stranger then it should be
I'll answer like Microsoft. It's by design.

Just finished porting the first function. Only problem: GaussResize doesn't exist in VapourSynth. Also is BoxBlur equivalent to Avisynth Blur?

I could use some help here

Code:
import vapoursynth as vs
core = vs.get_core()

def frc_GaussianBlur42(input, var = None, rad = None, vvar = None, vrad = None, p = None):
{
    if not isinstance(input, vs.VideoNode):
        raise vs.Error('frc_GaussianBlur42: input is not a clip')

    var = max(0.0, float(var or 1.0)))
    rad = max(1.0, float(rad or pow(var, 0.5)))
    var = pow(min(max(0.0, rad), 60.0), 1.9) ## arbitrary max radius = 60

    vvar = max(0.0, float(vvar or var)))
    vrad = max(1.0, float(vrad or pow(vvar, 0.5)))
    vvar = pow(min(max(0.0, vrad), 60.0), 1.9)
    p    = p or 19

    w0 = input.width
    h0 = input.height
    w1 = round(w0/rad)
    h1 = round(h0/vrad) 

    B = input.resize.Bilinear( \
            min(max(4, w1 + (w1 % 2)), w0), \
            min(max(4, h1 + (h1 % 2)), h0))

    B = B.std.BoxBlur(hpasses=2, vpasses=2)
    
    if var < 0.01 and vvar < 0.01:
        return input
    elif B.Width > 8 and B.Height > 8):
        return B.std.GaussResize(w0, h0, p=p) ### NOT IN VAPOURSYNTH
    else:
        return B.std.Bilinear(w0, h0)
}
Note: just realized that ConvertFpsLimit can be quite useful in VapourSynth since ConvertFps doesn't exist! Good thing it's already ported.

Last edited by MysteryX; 22nd June 2021 at 14:01.
MysteryX is offline   Reply With Quote
Old 22nd June 2021, 05:42   #352  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
fmtconv have GaussResize
https://github.com/AkarinVS/fmtconv/...onv.html#L1080
kedautinh12 is offline   Reply With Quote
Old 22nd June 2021, 14:53   #353  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
Thanks. Another issue. I had already ported ConvertFps, but ChangeFps (no blending) doesn't exist in VapourSynth either. What's the best solution? It's actually used several times for masks.

Also to consider: what to do in case of variable framerate input?

Finally... MaskTools2 hasn't been ported to VapourSynth??

Last edited by MysteryX; 22nd June 2021 at 15:33.
MysteryX is offline   Reply With Quote
Old 22nd June 2021, 15:52   #354  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
Mt_lutspa: https://github.com/kewenyu/VapourSynth-Draw

mt_motion: https://github.com/dubhater/vapoursynth-motionmask
kedautinh12 is offline   Reply With Quote
Old 22nd June 2021, 15:58   #355  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
havsfunc have ChangeFPS: https://github.com/HomeOfVapourSynth...sfunc.py#L5353
kedautinh12 is offline   Reply With Quote
Old 22nd June 2021, 17:25   #356  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
I think you need convert masktool2 from avisynth to internal functions of Vapoursynth. Here for example convert:
https://forum.doom9.org/showthread.php?p=1802951
kedautinh12 is offline   Reply With Quote
Old 22nd June 2021, 18:25   #357  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
I need:
mt_inpand
mt_lut
mt_lutxy
mt_expand
mt_binarize
mt_circle
mt_merge

Pretty much the whole suite
MysteryX is offline   Reply With Quote
Old 22nd June 2021, 20:37   #358  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Quote:
Originally Posted by MysteryX View Post
I need:
mt_inpand
mt_lut
mt_lutxy
mt_expand
mt_binarize
mt_circle
mt_merge

Pretty much the whole suite

Not sure about mt_circle.

Last edited by Reel.Deel; 22nd June 2021 at 20:39.
Reel.Deel is offline   Reply With Quote
Old 22nd June 2021, 21:39   #359  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
That's was i said
kedautinh12 is offline   Reply With Quote
Old 22nd June 2021, 21:54   #360  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Quote:
Originally Posted by kedautinh12 View Post
That's was i said

Umm I guess ... You posted a link to another thread which has a script with all kinds of things that are mostly not relevant to the question that MysteryX asked ... but hey, it's nice to see you actually writing something instead of 'thanks' on every post

Last edited by Reel.Deel; 22nd June 2021 at 21:56.
Reel.Deel 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 02:06.


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