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 > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 12th October 2019, 05:55   #3581  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
Looking at that tinyvs.py, ...,this is a magic. How can you come up with stuff like this ,
core object is not copied, not wrapped but instead its attributes, plugins dir is just forwarded/copied to a new object so domains can be hijacked in script but functionality is kept.
_Al_ is offline   Reply With Quote
Old 12th October 2019, 06:42   #3582  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
It must be me but I fail to see any benefit in overriding Vapoursynth core functions, I only see disadvantages.
Cary Knoop is offline   Reply With Quote
Old 12th October 2019, 09:32   #3583  |  Link
WolframRhodium
Registered User
 
Join Date: Jan 2016
Posts: 162
Quote:
Originally Posted by _Al_ View Post
Looking at that tinyvs.py, ...,this is a magic. How can you come up with stuff like this ,
core object is not copied, not wrapped but instead its attributes, plugins dir is just forwarded/copied to a new object so domains can be hijacked in script but functionality is kept.
I just want it to be tiny to show that it's possible. If you want certain level of safety, consider protections like using __getattr__ method to get attribute from "core".

Last edited by WolframRhodium; 12th October 2019 at 09:54.
WolframRhodium is offline   Reply With Quote
Old 12th October 2019, 22:21   #3584  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
Quote:
Originally Posted by Cary Knoop View Post
It must be me but I fail to see any benefit in overriding Vapoursynth core functions, I only see disadvantages.
you could branch to the whole lot of stuff, checking for correct cmd , returning error that is easier to understand, launch helper utility , program, gui for cropping and returning those values...

Quote:
Originally Posted by WolframRhodium View Post
I just want it to be tiny to show that it's possible. If you want certain level of safety, consider protections like using __getattr__ method to get attribute from "core".
so would this be any safer?, I don't know really why. It just creates an attribute if needed:
Code:
import vapoursynth as vs
from vapoursynth import core as _vscore
import functools

class _Core:
    def __getattr__(self, name):
        attr = getattr(_vscore, name)
        if isinstance(attr, vs.Plugin):
            self.__dict__.update({name : _Plugin(attr)})
            return _Plugin(attr)
        else:
            self.__dict__.update({name : attr})
            return attr     
    
class _Plugin:
    def __init__(self, namespace):
        self.__dict__.update((name, getattr(namespace, name)) for name in dir(namespace)) # func_name : func

def CropAbs_extra(f):
    @functools.wraps(f)
    def wrapper(*args, **kwargs):
        print('in wrapper')
        c = f(*args, **kwargs)
        return c
    return wrapper

core = _Core()
core.std.CropAbs = CropAbs_extra(core.std.CropAbs)
clip = core.std.BlankClip(width=640, height=360, format = vs.YUV420P8)
clip = core.std.CropAbs(clip, 360,240, 0,0)
at the moment I try to pass that vs.Plugin attribute to __getatttr__as well so it is _Plugin does not go thru the all namespace dir functions

Last edited by _Al_; 12th October 2019 at 22:42.
_Al_ is offline   Reply With Quote
Old 12th October 2019, 22:32   #3585  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
Quote:
Originally Posted by _Al_ View Post
you could branch to the whole lot of stuff, checking for correct cmd , returning error that is easier to understand, launch helper utility , program, gui for cropping and returning those values...
Sure, but the classical way is to use wrappers with your own functions.

Redefining API's to me is like writing a novel while changing the meaning of the words. It's possible, but what would be the point?

Please don't get me wrong, if you feel like doing it you certainly can, and if you want to do it don't let me stop you, but I personally think it is not a good idea.
Cary Knoop is offline   Reply With Quote
Old 12th October 2019, 23:07   #3586  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
It might be a dumb idea, I don't deny it and dealing should be done using outputs only.
_Al_ is offline   Reply With Quote
Old 12th October 2019, 23:21   #3587  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
If you really want to change the API that much it's a lot easier to just poke the cython code that generates the module directly. It's basically normal python with a few extensions.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 13th October 2019, 22:38   #3588  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
R48-test2 64bit

Nothing new as such, just fixes all found regressions. Give it a try again. Speed comparisons with R46 also welcome.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 16th October 2019, 21:33   #3589  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
R48 RC1

Go test it everywhere. Once again all known regressions have been fixed. Mask all the things!

Code:
r48:
it's now possible to select which optimized code path is used for internal filters (sekrit-twc)
avx2 optimization in many filters, previously the internal ones were mostly sse2 (sekrit-twc)
expr filter can now better optimize expressions (sekrit-twc)
the 7zip executable is now bundled with vsrepo
the portable version now includes the documentation as well
the portable version now includes all the plugins bundled with the normal installer again
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 20th October 2019, 20:13   #3590  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Now that python 3.8 is final, will R48 support it?
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is online now   Reply With Quote
Old 20th October 2019, 20:18   #3591  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by ChaosKing View Post
Now that python 3.8 is final, will R48 support it?
Nope, there's no cython release with proper 3.8 support yet.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 21st October 2019, 17:55   #3592  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
R48-RC2

More bugs and minor issues fixed. Should be the final RC unless someone finds a serious bug within a week. Test the new add to PATH option a bit extra.

Code:
r48:
it's now possible to select which optimized code path is used for internal filters (sekrit-twc)
avx2 optimization in many filters, previously the internal ones were mostly sse2 (sekrit-twc)
expr filter can now better optimize expressions (sekrit-twc)
the 7zip executable is now bundled with vsrepo
the portable version now includes the documentation as well
the portable version now includes all the plugins bundled with the normal installer again
fixed deadlock when setMessageHandler is called a second time
added an option to add vspipe, avfs and vsrepo to path in the installer
added registry entries for the path to vspipe and vsrepo
imwri is now included in the installer
the overwrite argument in imwri now also disables the requirement for output filesnames to contain a number
fixed corrupt output from imwri when requesting alpha output but the read image doesn't have an alpha channel
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 21st October 2019, 18:15   #3593  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
The PATH stuff works for me (vspipe, vsrepo, avfs). Green stripes are fixed too.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is online now   Reply With Quote
Old 21st October 2019, 18:25   #3594  |  Link
l00t
Where's my loot?
 
Join Date: May 2019
Posts: 63
Unfortunately I still have the pink borders, when bbmod (from latest havsfunc) is used. See sample pics:

R47.2:
https://images2.imgbox.com/21/ee/LCxpNQn8_o.png

R48-RC2:
https://images2.imgbox.com/f0/df/Nlp16rcQ_o.png

Relevant part of the VS code:
Code:
clip = core.std.SetFieldBased(clip, 0)
clip = core.std.CropRel(clip=clip, left=0, right=0, top=20, bottom=20)
clip = core.fb.FillBorders(clip, left=0, right=0, top=1, bottom=1, mode="fillmargins") 
clip = havsfunc.bbmod(clip, cTop = 2, cBottom = 2, cLeft = 0, cRight = 0, thresh = 128, blur = 999)
clip = core.resize.Spline36(clip, width=clip.width-0-0, height=clip.height-1-1, src_left=0, src_top=1, src_width=clip.width-0-0, src_height=clip.height-1-1)
I used the portable version of R47.2 and R48-RC2 (both x64) with VSEditor r19 and Python 3.7.5 (embedded). Video is loaded with dgdecodenv.DGSource, most recent version.

Last edited by l00t; 21st October 2019 at 18:44.
l00t is offline   Reply With Quote
Old 21st October 2019, 18:35   #3595  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by l00t View Post
Unfortunately I still have the pink borders, when bbmod (from latest havsfunc) is used. See sample pics:

R47.2:
https://images2.imgbox.com/21/ee/LCxpNQn8_o.png

R48-RC2:
https://images2.imgbox.com/f0/df/Nlp16rcQ_o.png

Relevant part of the VS code:
Code:
clip = core.fb.FillBorders(clip, left=0, right=0, top=1, bottom=1, mode="fillmargins") 
clip = havsfunc.bbmod(clip, cTop = 2, cBottom = 2, cLeft = 0, cRight = 0, thresh = 128, blur = 999)
clip = core.resize.Spline36(clip, width=clip.width-0-0, height=clip.height-1-1, src_left=0, src_top=1, src_width=clip.width-0-0, src_height=clip.height-1-1)
I used the portable version of R47.2 and R48-RC2 (both x64) with VSEditor r19 and Python 3.7.5 (embedded). Video is loaded with dgdecodenv.DGSource, most recent version.
Can't reproduce. CPU and input video format+resolution?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet

Last edited by Myrsloik; 21st October 2019 at 18:40.
Myrsloik is offline   Reply With Quote
Old 21st October 2019, 18:43   #3596  |  Link
l00t
Where's my loot?
 
Join Date: May 2019
Posts: 63
Quote:
Originally Posted by Myrsloik View Post
Can't reproduce. CPU and input video format+resolution?
CPU: Intel i7-9750H
Video format: YUV420P8; 25fps; input resolution: 1920x1080; final resolution: 1920x1038

(added 2 more lines, which might be important as well...)

Last edited by l00t; 21st October 2019 at 18:47.
l00t is offline   Reply With Quote
Old 21st October 2019, 18:47   #3597  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by l00t View Post
CPU: Intel i7-9750H
Video format: YUV420P8; 25fps; resolution: 1920x1038

(added 2 more lines, which might be important as well...)
Added how? Ideally I want a way to reproduce it using blankclip as the source and a complete script.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 21st October 2019, 18:52   #3598  |  Link
l00t
Where's my loot?
 
Join Date: May 2019
Posts: 63
Quote:
Originally Posted by Myrsloik View Post
Added how? Ideally I want a way to reproduce it using blankclip as the source and a complete script.
Sorry for being a bit misleading, these were already in the script, when the pictures were taken... (I just wanted to emphasize, that something is happening in bbmod, the script looks fine without it). Nevermind, here's the complete script:

Code:
clip = core.dgdecodenv.DGSource(r'some_hd_video.dgi')
clip = core.resize.Spline36(clip, matrix_in_s="709", transfer_in_s="709", primaries_in_s="709", range_s="limited")
clip = core.std.AssumeFPS(clip, fpsnum=25000, fpsden=1000)
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
clip = core.std.SetFieldBased(clip, 0)
clip = core.std.CropRel(clip=clip, left=0, right=0, top=20, bottom=20)
clip = core.fb.FillBorders(clip, left=0, right=0, top=1, bottom=1, mode="fillmargins")
clip = havsfunc.bbmod(clip, cTop = 2, cBottom = 2, cLeft = 0, cRight = 0, thresh = 128, blur = 999)
clip = core.resize.Spline36(clip, width=clip.width-0-0, height=clip.height-1-1, src_left=0, src_top=1, src_width=clip.width-0-0, src_height=clip.height-1-1)
clip = core.remap.ReplaceFramesSimple(baseclip=clip, sourceclip=core.f3kdb.Deband(clip, range=20, grainy=32, grainc=24, sample_mode=2, dither_algo=3, keep_tv_range=1, blur_first=1, dynamic_grain=0), mappings="[0 1070]")
clip.set_output()

Last edited by l00t; 21st October 2019 at 18:54.
l00t is offline   Reply With Quote
Old 22nd October 2019, 16:49   #3599  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
R48-RC3

Fixes the aformentioned pink line at top and bottom (general expr bug) and another 32bit bug in expr as well. Keep testing it.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 22nd October 2019, 18:12   #3600  |  Link
l00t
Where's my loot?
 
Join Date: May 2019
Posts: 63
Wow, so fast, thank you very much! The pinkies are now gone, hooray
l00t is offline   Reply With Quote
Reply

Tags
speed, vaporware, vapoursynth

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 09:53.


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