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 17th September 2015, 19:02   #1701  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by jackoneill View Post
It uses std.Lut2 inside. With two 16 bit clips, that means there will be a table of 65536 * 65536 elements, which is over 4 billion. With 2 bytes per element, that requires 8 GiB of RAM and probably takes a while to initialise.
Actually that should be rejected and the memory allocation would fail first. But there's probably something weird going on in general.
Definitely sounds like a 16bit bug in one filter.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 17th September 2015, 19:10   #1702  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,731
But basically it doesn't make sense to try contrasharpening 16-bit clips?
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 17th September 2015, 20:06   #1703  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
Quote:
Originally Posted by Myrsloik View Post
Actually that should be rejected and the memory allocation would fail first. But there's probably something weird going on in general.
Definitely sounds like a 16bit bug in one filter.
Not actually, because that function tries to allocate the full table in memory before sending it to std.Lut2 (I think).

Code:
                lut = []
                for y in lut_range:
                        for x in lut_range:
                                lut.append(clamp(0, expr(x, y), vmax))
                return self.core.std.Lut2(c1, c2, lut=lut, planes=planes)
@Boulder: That module is like super unmaintained, it's surprising it even loads. For contrasharpening try with the one in havsfunc, it uses std.Expr so it should work OK with 16 bit clips.
Are_ is offline   Reply With Quote
Old 17th September 2015, 20:07   #1704  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Replace lut2 with expr
Edit: too slow

Edit2: lut stuff needs to initialize before running, and that would burn your poor machine up if the bit depth is too high, basically it works fine on low bit depth clips
Expr doesn't need to initialize, it executes the RPN on each pixel at runtime, it's the right tool to work around high bit depth pixel manipulations, it works even at 96 bits input (32 bits float input x3)

Last edited by feisty2; 17th September 2015 at 20:26.
feisty2 is offline   Reply With Quote
Old 18th September 2015, 05:08   #1705  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,731
Quote:
Originally Posted by Are_ View Post
@Boulder: That module is like super unmaintained, it's surprising it even loads. For contrasharpening try with the one in havsfunc, it uses std.Expr so it should work OK with 16 bit clips.
Yes, it seems to work fine. Funny that there's at least three versions of contrasharpening out and I end up picking the wrong one
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 18th September 2015, 08:28   #1706  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
That one's not wrong, just gotta take some more time...
feisty2 is offline   Reply With Quote
Old 19th September 2015, 22:02   #1707  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
R28 test4. Now works with (and prefers) per user python installations. Expr has also had several big fixes (ternary operator, crashes and so on) so give it a try again. Log, pow and maybe exp is probably not working properly. Everything else should be working though so try it out.

On the positive size Expr can now have up to 26 inputs, x-z, a-w.

Expr correctness and speed comparisons welcome.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 20th September 2015, 02:51   #1708  |  Link
nu774
Registered User
 
Join Date: Mar 2011
Posts: 16
The following script works via VSScipt, but fails when directly executed from python3.5 command.
Using Python3.5 on windows, vapoursynth git latest. Both of 32bit/64bit result in the same.

Error:
Code:
Traceback (most recent call last):
  File "Baloon.issue.vpy", line 5, in <module>
    last = core.std.FrameEval(last, lambda n, c=last: c)
  File "src\cython\vapoursynth.pyx", line 1360, in vapoursynth.Function.__call__ (build\temp.win32-3.5\Release\pyrex\vapoursynth.c:24919)
vapoursynth.Error: FrameEval: Internal environment id not set. Report this function wrapper creation error.
Script:
Code:
import vapoursynth as vs

core = vs.get_core()
last = core.lsmas.LibavSMASHSource('baloon-pops.mp4')
last = core.std.FrameEval(last, lambda n, c=last: c)
last.set_output()
nu774 is offline   Reply With Quote
Old 20th September 2015, 11:53   #1709  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
Is current git supposed to compile with gcc? I was about to give new expr a try but no luck.

Loads of:
Code:
/var/tmp/portage/media-libs/vapoursynth-9999/work/vapoursynth-9999/src/core/jitasm.h:1935:11: error: expected ‘)’ before ‘const’
/var/tmp/portage/media-libs/vapoursynth-9999/work/vapoursynth-9999/src/core/jitasm.h:1935:10: error: expected ‘;’ at end of member declaration
  void and(const Reg8& dst, const Imm8& imm)  {AppendInstr(I_AND, 0x80, E_SPECIAL, Imm8(4), RW(dst), imm);}
          ^
/var/tmp/portage/media-libs/vapoursynth-9999/work/vapoursynth-9999/src/core/jitasm.h:1935:28: error: expected unqualified-id before ‘const’
  void and(const Reg8& dst, const Imm8& imm)  {AppendInstr(I_AND, 0x80, E_SPECIAL, Imm8(4), RW(dst), imm);}
                            ^
EDIT: I didn't say anything, jackoneill fixed it while I was typing this.

Last edited by Are_; 20th September 2015 at 12:00.
Are_ is offline   Reply With Quote
Old 20th September 2015, 12:00   #1710  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by Are_ View Post
Is current git supposed to compile with gcc? I was about to give new expr a try but no luck.

Loads of:
Code:
/var/tmp/portage/media-libs/vapoursynth-9999/work/vapoursynth-9999/src/core/jitasm.h:1935:11: error: expected ‘)’ before ‘const’
/var/tmp/portage/media-libs/vapoursynth-9999/work/vapoursynth-9999/src/core/jitasm.h:1935:10: error: expected ‘;’ at end of member declaration
  void and(const Reg8& dst, const Imm8& imm)  {AppendInstr(I_AND, 0x80, E_SPECIAL, Imm8(4), RW(dst), imm);}
          ^
/var/tmp/portage/media-libs/vapoursynth-9999/work/vapoursynth-9999/src/core/jitasm.h:1935:28: error: expected unqualified-id before ‘const’
  void and(const Reg8& dst, const Imm8& imm)  {AppendInstr(I_AND, 0x80, E_SPECIAL, Imm8(4), RW(dst), imm);}
                            ^
No, still working on the not windows part.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 22nd September 2015, 21:35   #1711  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Another test version. This one should have a fully working Expr with no bugs at all. It also fixes the issue nu774 reported that was introduced in the test versions.

This version is also compiled with some extra checks to see if any plugins trigger them. Report any that do.

R28 test5
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 22nd September 2015, 22:14   #1712  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
Some speed comparasions:

r27
Code:
finesharp-lut
Output 2001 frames in 29.26 seconds (68.38 fps)
Output 2001 frames in 30.64 seconds (65.31 fps)
Output 2001 frames in 32.25 seconds (62.05 fps)
Average fps for finesharp-lut: 65.24

finesharp
Output 2001 frames in 56.01 seconds (35.73 fps)
Output 2001 frames in 55.35 seconds (36.15 fps)
Output 2001 frames in 54.97 seconds (36.40 fps)
Average fps for finesharp: 36.09

psharpen
Output 2001 frames in 40.66 seconds (49.21 fps)
Output 2001 frames in 41.05 seconds (48.74 fps)
Output 2001 frames in 41.24 seconds (48.52 fps)
Average fps for psharpen: 48.82
git
Code:
finesharp
Output 2001 frames in 47.69 seconds (41.95 fps)
Output 2001 frames in 46.86 seconds (42.70 fps)
Output 2001 frames in 47.46 seconds (42.16 fps)
Average fps for finesharp: 42.27

psharpen
Output 2001 frames in 28.09 seconds (71.24 fps)
Output 2001 frames in 27.21 seconds (73.53 fps)
Output 2001 frames in 26.59 seconds (75.25 fps)
Average fps for psharpen: 73.34

Last edited by Are_; 23rd September 2015 at 01:32.
Are_ is offline   Reply With Quote
Old 23rd September 2015, 00:15   #1713  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Interesting comparison. But where can I find psharpen for vs?

I think I can make it even faster by combining several expr calls. At least finesharp is kinda inefficient in that eay.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 23rd September 2015, 00:40   #1714  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Quote:
Originally Posted by Myrsloik View Post
Interesting comparison. But where can I find psharpen for vs?

I think I can make it even faster by combining several expr calls. At least finesharp is kinda inefficient in that eay.
I'm not aware of psharpen for vs but here's the avs version: http://forum.doom9.org/showthread.php?t=172422
Reel.Deel is offline   Reply With Quote
Old 23rd September 2015, 01:27   #1715  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
Sorry, I somehow f..... up the test, speed is a little better, results updated. psharpen.py

Last edited by sh0dan; 23rd September 2015 at 09:33. Reason: removed profanity
Are_ is offline   Reply With Quote
Old 23rd September 2015, 12:09   #1716  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
I can'y get assvapour to do anything at all, and as far as I can tell I'm using it right:
Code:
import vapoursynth as vs
core = vs.get_core()
std = core.std

vid = core.lsmas.LWLibavSource(r'C:\train\karaoke\work\Rilo Kiley - Portions for Foxes.mkv')
subs = core.assvapour.AssRender(vid,r'Rilo Kiley - Portions for Foxes.ass')
subs[0] = core.resize.Bicubic(subs[0], format=vid.format.id)
vid = std.MaskedMerge(vid, subs[0], subs[1])
vid.set_output()
I get pure black video. What it should look like, you can use this as input above. The subs are muxed and work fine in MPC and MPDN.

Edit: Also attempted
Quote:
vsfilter = core.avs.LoadPlugin(r'vsfilter_avs.dll')
subs = vsfilter.TextSub(vid,r'Rilo Kiley - Portions for Foxes.ass')
and that was also a no-go, with error "Python exception: 'NoneType' object has no attribute 'TextSub'", although it worked perfectly from Avisynth.

Last edited by foxyshadis; 23rd September 2015 at 12:30.
foxyshadis is offline   Reply With Quote
Old 23rd September 2015, 13:08   #1717  |  Link
splinter98
Registered User
 
Join Date: Oct 2010
Posts: 36
Quote:
Originally Posted by foxyshadis View Post
Edit: Also attempted
Code:
vsfilter = core.avs.LoadPlugin(r'vsfilter_avs.dll')
subs = vsfilter.TextSub(vid,r'Rilo Kiley - Portions for Foxes.ass')
and that was also a no-go, with error "Python exception: 'NoneType' object has no attribute 'TextSub'", although it worked perfectly from Avisynth.
That's because you're using avs Loadplugin incorrectly. Loadedplugins go into the core.avs namespace

Try: (untested)
Code:
core.avs.LoadPlugin(r'vsfilter_avs.dll')
subs = core.avs.vsfilter.TextSub(vid,r'Rilo Kiley - Portions for Foxes.ass')
Regarding AssRender not working, I get the same output on the latest build, however on an older build it works as expected.
splinter98 is offline   Reply With Quote
Old 23rd September 2015, 13:27   #1718  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by foxyshadis View Post
I can'y get assvapour to do anything at all, and as far as I can tell I'm using it right:
Code:
import vapoursynth as vs
core = vs.get_core()
std = core.std

vid = core.lsmas.LWLibavSource(r'C:\train\karaoke\work\Rilo Kiley - Portions for Foxes.mkv')
subs = core.assvapour.AssRender(vid,r'Rilo Kiley - Portions for Foxes.ass')
subs[0] = core.resize.Bicubic(subs[0], format=vid.format.id)
vid = std.MaskedMerge(vid, subs[0], subs[1])
vid.set_output()
I get pure black video. What it should look like, you can use this as input above. The subs are muxed and work fine in MPC and MPDN.

Edit: Also attempted

and that was also a no-go, with error "Python exception: 'NoneType' object has no attribute 'TextSub'", although it worked perfectly from Avisynth.
Your assvapour script works perfectly for me with r28 test5.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 23rd September 2015, 13:37   #1719  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Look at the output of Assvapour directly, both clips. How do they compare to the last working version?
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 23rd September 2015, 14:22   #1720  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
Quote:
Originally Posted by splinter98 View Post
That's because you're using avs Loadplugin incorrectly. Loadedplugins go into the core.avs namespace
Thanks! I'm sure I knew this before, but I've been VS-only so long now that I screwed up the syntax. The VS docs are good, but this is one of the areas that isn't written up.

Quote:
Originally Posted by Myrsloik View Post
Your assvapour script works perfectly for me with r28 test5.
I'm cranky now because I tested with both r27 and r28t5 and neither showed. Now they do and I don't know why. Sigh. Computers, man.
foxyshadis 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 08:30.


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