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

Reply
 
Thread Tools Search this Thread Display Modes
Old 27th October 2013, 13:59   #1001  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
Thank you. Installed R21 RC, and it has become fast.
This plugin interpolates between frames within (radius) using linear approximation/regression.

update: Compared unfiltered and filtered single planes. Filtered look like they have something like valid output, but much brighter (twice as bright?). That shouldn't be happening though, since all I'm doing is finding the linear approximation between the same pixels of several frames. Then, of course, I'm doing the bit depth conversion. But it shouldn't be different between planes, right?

update2: Checked the Y plane, and it is actually getting brighter too. So, there's a general mistake somewhere in my calculations.

update3: Silly silly me. I forgot to calculate xsum. Fixed. Now need to test with different bit depths and maybe optimize a little.
__________________
...desu!

Last edited by Mystery Keeper; 27th October 2013 at 15:12.
Mystery Keeper is offline   Reply With Quote
Old 27th October 2013, 15:25   #1002  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Here's R21 RC2.

It will probably be released with no further changes. This final RC is just to see so I didn't break anything when moving some code around. It also has a fix for an issue no one ever noticed.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 27th October 2013, 15:26   #1003  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
Ok. Now something unrelated seems to have popped up.
Code:
ret = core.fmtc.bitdepth(ret, bits=16)
ret = core.tla.TempLinearApproximate(ret, radius=10, outBits=8)
Gives me an error in AvsPmod: AVISource: couldn't locate a decompressor for fourcc P016.
Both RC1 and RC2.
__________________
...desu!

Last edited by Mystery Keeper; 27th October 2013 at 15:28.
Mystery Keeper is offline   Reply With Quote
Old 27th October 2013, 15:49   #1004  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by Mystery Keeper View Post
Thank you. Installed R21 RC, and it has become fast.
This plugin interpolates between frames within (radius) using linear approximation/regression.

update: Compared unfiltered and filtered single planes. Filtered look like they have something like valid output, but much brighter (twice as bright?). That shouldn't be happening though, since all I'm doing is finding the linear approximation between the same pixels of several frames. Then, of course, I'm doing the bit depth conversion. But it shouldn't be different between planes, right?

update2: Checked the Y plane, and it is actually getting brighter too. So, there's a general mistake somewhere in my calculations.

update3: Silly silly me. I forgot to calculate xsum. Fixed. Now need to test with different bit depths and maybe optimize a little.
I noticed some things in your code:

1. VS doesn't allow less than 8 bits per sample to keep things simple so
Code:
if((outBitsPerSample < 1) || (outBitsPerSample > 16))
;
is wrong.

2. You are NEVER supposed to created your own VSFormat struct copies.
WRONG!
Code:
    internalData.format = *internalData.videoInfo.format;
    internalData.videoInfo.format = &internalData.format;
You have to keep the pointer around. If you need to get a VSFormat describing a certain format either use getFormatPreset or registerFormat.

Your format error is because the output is 16 bit and you have nothing that can play it. Convert it to 8 bit to preview.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 27th October 2013, 15:54   #1005  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
ret = core.tla.TempLinearApproximate(ret, radius=10, outBits=8)
It does convert to 8bit.
Well, I'll try to register format properly. Haven't found an example of how to do that properly so far.
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 27th October 2013, 15:56   #1006  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by HolyWu View Post


Python get crashed when using the argument prop_src?
I found the typo. Will put up RC3 soon.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 27th October 2013, 15:59   #1007  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by Mystery Keeper View Post
ret = core.tla.TempLinearApproximate(ret, radius=10, outBits=8)
It does convert to 8bit.
Well, I'll try to register format properly. Haven't found an example of how to do that properly so far.
The relevant lines from ShufflePlanes. It's very simple. You enter all the parameters for the format you want and then you get a VSFormat * back you can use in VSVideoInfo (or anywhere else, really).
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 27th October 2013, 16:56   #1008  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
Fixed the format. Works well so far. Still there are things to do, but hopefully shall release soon.
http://paste.org.ru/?vaevta
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 27th October 2013, 17:23   #1009  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by HolyWu View Post
Another problem, I am unable to get result from both assvapour.AssRender and assvapour.Subtitle. In the shell, it just stays there. No any error message. No crash.
It's not stuck. AssVapour uses fontconfig which needs to create a font index the first run. It's very slow. Give it up to 5 minutes. (or possibly more)
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 27th October 2013, 17:42   #1010  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Here's R21 RC3. Fixes the prop_src crash and checks so a proper VSFormat is passed to setVideoInfo().

Quote:
Originally Posted by Mystery Keeper View Post
Fixed the format. Works well so far. Still there are things to do, but hopefully shall release soon.
http://paste.org.ru/?vaevta
1. I've decided that all argument names should be lowercase and with underscores. So outBits => out_bits.

2. I also specify the planes to process as an int array in all internal filters. See Lut which is called like this: Lut(clip, planes=[1,2], long_lut_array).

3. You probably don't want to have this condition
Code:
                        uint32_t outValue;
                        if(inBytesPS == 2)
                            outValue = ((uint16_t *)srcp)[w];
                        else
                            outValue = srcp[w];
in the inner loop. Accept that you may need to write the outer loop several times instead. Again see how MaskedMerge works.

There's also the obivious question of why this filter is doing bitdepth conversion at all. Especially downconversion by truncation probably isn't what most people really want. Maybe you should leave that to fmtconv?

Upconversion from 8 to 16 bit is also extremely cheap to do in a separate filter placed in front of TLA so maybe drop that complexity?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 27th October 2013, 19:06   #1011  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
Yup, you're right. I did normalization of the source values, and I shouldn't. Double precision should be enough for 16-bit calculations on any reasonable radius. If it isn't - normalization wouldn't help anyway. So I'll drop normalization, bit depth conversion and format change altogether.
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 27th October 2013, 20:33   #1012  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
Here you go. As fast as it gets. Still a draft, but usable.
http://paste.org.ru/?h6sf34
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 27th October 2013, 21:12   #1013  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by Mystery Keeper View Post
Here you go. As fast as it gets. Still a draft, but usable.
http://paste.org.ru/?h6sf34
1. You can drop the (internalData.videoInfo->numFrames != 0) check. Requesting frames beyond the end is allowed (you'll get the last actual frame back)

2. You're calling vsapi->getReadPtr() in the inner loop, you probably want to store the pointers in a local array before the loop

3. You can automatically copy planes using newVideoFrame2() (which is free since it uses some reference counting behind the scenes). See ShufflePlanes as an example of how it's used. Basically you pass an array of 3 frame and another of the planes that should be copied from them. If you pass 0 as the frame pointer you get a normal blank plane.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 28th October 2013, 19:02   #1014  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
Quote:
Originally Posted by Myrsloik View Post
1. You can drop the (internalData.videoInfo->numFrames != 0) check. Requesting frames beyond the end is allowed (you'll get the last actual frame back)
I'm afraid I can't. This plugin needs to know the exact number of frames so it would take the proper range near the end.
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 28th October 2013, 21:51   #1015  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
I assume zero length clips are valid in VapourSynth as they are in Avisynth.

Zero length clips need to be handled gracefully.
IanB is offline   Reply With Quote
Old 28th October 2013, 21:56   #1016  |  Link
Tima
Registered User
 
Join Date: Aug 2004
Location: Russia, Novosibirsk
Posts: 176
Quote:
Originally Posted by IanB View Post
I assume zero length clips are valid in VapourSynth as they are in Avisynth.

Zero length clips need to be handled gracefully.
Another corner case could be nonzero-length clips with both (or just one!) dimensions being zero
Tima is offline   Reply With Quote
Old 28th October 2013, 22:00   #1017  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by IanB View Post
I assume zero length clips are valid in VapourSynth as they are in Avisynth.

Zero length clips need to be handled gracefully.
If the length is zero it means that it is unknown. The actual number has to be determined some other way. Call it an esoteric feature. It can be useful for streaming and such. If you request a frame beyond the end all filters should return the last valid frame.

Clips that actually have 0 frames aren't allowed and can't be created for obvious reasons.

As for clips either both or no dimensions are known. You will trigger a fatal error if you try to set only one of width and height to zero.

I have plenty of extra argument checks going on to stop some common mistakes from happening. If VapourSynth ever "just quits" run it from the commandline to see the stderr output. It usually prints the reason and offending filter (if any).
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 29th October 2013, 22:15   #1018  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
I finally released R21. Changelog in the first post. Download link on the website.

Blog post here.

Same procedure as every time... Now for some plugin writing.

Download link now fixed.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet

Last edited by Myrsloik; 30th October 2013 at 00:12.
Myrsloik is offline   Reply With Quote
Old 30th October 2013, 04:14   #1019  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
Great work, Myrsloik! Is there MVTools among the priority plugins?
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 30th October 2013, 09:35   #1020  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by Mystery Keeper View Post
Great work, Myrsloik! Is there MVTools among the priority plugins?
Of course it is. I actually do write these things down on the bug tracker and blog...

I don't know if there is any other really popular plugin left to port. I think I got all the extremely useful ones but correct me if I'm wrong.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Reply

Tags
speed, vaporware, vapoursynth


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 13:59.


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