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 7th February 2017, 11:29   #81  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
because if only build Source.cpp

https://forum.doom9.org/showpost.php...9&postcount=70

and if build both source.cpp and Source_AVX_FMA3.cpp the plugin is loaded and seems work
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 7th February 2017, 11:33   #82  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
of course you should compile both files, what's the problem here?
feisty2 is offline   Reply With Quote
Old 7th February 2017, 11:45   #83  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
again. this make conflicts if the processor don't support AVX/FMA3?
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 7th February 2017, 11:55   #84  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by sl1pkn07 View Post
again. this make conflicts if the processor don't support AVX/FMA3?
ahh, I wish I could speak Spanish so it would be less painful for us to communicate..

like I said a million times before, you MUST compile Source_AVX_FMA.cpp (even if AVX and FMA are not supported by your CPU, forcibly compile it with -march=haswell if that's the case)
and it won't matter because the AVX/FMA functions will be rejected at RUNTIME if they are not supported by your CPU.
feisty2 is offline   Reply With Quote
Old 7th February 2017, 12:58   #85  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
then all fine
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 8th February 2017, 05:11   #86  |  Link
Jindadil007
Registered User
 
Join Date: Dec 2016
Posts: 71
Really Good Filter...Got very good results...Thanks Feisty2
Jindadil007 is offline   Reply With Quote
Old 22nd February 2017, 13:24   #87  |  Link
KingLir
Registered User
 
Join Date: Jan 2017
Posts: 146
Trying to build this on macOS and getting the following error. Any ideas ?

meson-log seems ok, here is a copy.

[1/4] Compiling cpp object 'avxfma@sta/Source_AVX_FMA.cpp.o'
FAILED: avxfma@sta/Source_AVX_FMA.cpp.o
c++ '-Iavxfma@sta' '-I.' '-I..' '-I/usr/local/Cellar/vapoursynth/36/include/vapoursynth' '-I/usr/local/Cellar/zimg/2.4/include' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-std=c++14' '-O3' '-mavx' '-mfma' '-MMD' '-MQ' 'avxfma@sta/Source_AVX_FMA.cpp.o' '-MF' 'avxfma@sta/Source_AVX_FMA.cpp.o.d' -o 'avxfma@sta/Source_AVX_FMA.cpp.o' -c ../Source_AVX_FMA.cpp
In file included from ../Source_AVX_FMA.cpp:1:
../Shared.hpp:8:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
^
1 error generated.
[2/4] Compiling cpp object 'fixtelecinedfades@sha/Source.cpp.o'
FAILED: fixtelecinedfades@sha/Source.cpp.o
c++ '-Ifixtelecinedfades@sha' '-I.' '-I..' '-I/usr/local/Cellar/vapoursynth/36/include/vapoursynth' '-I/usr/local/Cellar/zimg/2.4/include' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-std=c++14' '-O3' '-MMD' '-MQ' 'fixtelecinedfades@sha/Source.cpp.o' '-MF' 'fixtelecinedfades@sha/Source.cpp.o.d' -o 'fixtelecinedfades@sha/Source.cpp.o' -c ../Source.cpp
In file included from ../Source.cpp:1:
../Shared.hpp:8:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
^
1 error generated.
ninja: build stopped: subcommand failed.
KingLir is offline   Reply With Quote
Old 22nd February 2017, 13:54   #88  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by KingLir View Post
Trying to build this on macOS and getting the following error. Any ideas ?

meson-log seems ok, here is a copy.

[1/4] Compiling cpp object 'avxfma@sta/Source_AVX_FMA.cpp.o'
FAILED: avxfma@sta/Source_AVX_FMA.cpp.o
c++ '-Iavxfma@sta' '-I.' '-I..' '-I/usr/local/Cellar/vapoursynth/36/include/vapoursynth' '-I/usr/local/Cellar/zimg/2.4/include' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-std=c++14' '-O3' '-mavx' '-mfma' '-MMD' '-MQ' 'avxfma@sta/Source_AVX_FMA.cpp.o' '-MF' 'avxfma@sta/Source_AVX_FMA.cpp.o.d' -o 'avxfma@sta/Source_AVX_FMA.cpp.o' -c ../Source_AVX_FMA.cpp
In file included from ../Source_AVX_FMA.cpp:1:
../Shared.hpp:8:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
^
1 error generated.
[2/4] Compiling cpp object 'fixtelecinedfades@sha/Source.cpp.o'
FAILED: fixtelecinedfades@sha/Source.cpp.o
c++ '-Ifixtelecinedfades@sha' '-I.' '-I..' '-I/usr/local/Cellar/vapoursynth/36/include/vapoursynth' '-I/usr/local/Cellar/zimg/2.4/include' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-std=c++14' '-O3' '-MMD' '-MQ' 'fixtelecinedfades@sha/Source.cpp.o' '-MF' 'fixtelecinedfades@sha/Source.cpp.o.d' -o 'fixtelecinedfades@sha/Source.cpp.o' -c ../Source.cpp
In file included from ../Source.cpp:1:
../Shared.hpp:8:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
^
1 error generated.
ninja: build stopped: subcommand failed.
the error basically tells you that a header file "malloc.h" is missing
"malloc.h" should be provided by the compiler and it's also where the dynamic stack memory allocation function "alloca()" (unlike C99 and later versions of C, variable length array in stack frame (std::vector is a heap array, which means it's much slower than alloca()) is not allowed in C++, which leaves alloca() the only option to do such thing) should be defined..

"malloc.h" should be available in Visual Studio and GCC, maybe you should try one of these 2 compilers
feisty2 is offline   Reply With Quote
Old 22nd February 2017, 14:03   #89  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by feisty2 View Post
the error basically tells you that a header file "malloc.h" is missing
"malloc.h" should be provided by the compiler and it's also where the dynamic stack memory allocation function "alloca()" (unlike C99 and later versions of C, variable length array in stack frame (std::vector is a heap array, which means it's much slower than alloca()) is not allowed in C++, which leaves alloca() the only option to do such thing) should be defined..

"malloc.h" should be available in Visual Studio and GCC, maybe you should try one of these 2 compilers
You wouldn't need the nonstandard alloca function if you would use the plane pointers directly.

Try to include alloca.h instead of malloc.h.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 22nd February 2017, 14:24   #90  |  Link
KingLir
Registered User
 
Join Date: Jan 2017
Posts: 146
Quote:
Originally Posted by feisty2 View Post
"malloc.h" should be available in Visual Studio and GCC, maybe you should try one of these 2 compilers
The instructions says to use meson build system - so that what I used. Anyway, it's not straightforward to just build it with Visual Studio on macOS

I did what jackoneill suggested and changed the line in Shared.hpp to alloca.h instead of malloc.h.

It now build successfully with just one warning:

../Source.cpp:165:23: warning: 'VapourSynthPluginInit' has C-linkage specified, but returns user-defined type 'auto' which is incompatible with C [-Wreturn-type-c-linkage]
VS_EXTERNAL_API(auto) VapourSynthPluginInit(VSConfigPlugin configFunc, VSRegisterFunction registerFunc, VSPlugin *plugin) {
^
1 warning generated.

Is this warning OK ? And are there any forseen impact (performance and etc) in using alloca instead of malloc ?

Last edited by KingLir; 22nd February 2017 at 14:38.
KingLir is offline   Reply With Quote
Old 22nd February 2017, 14:29   #91  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by jackoneill View Post
You wouldn't need the nonstandard alloca function if you would use the plane pointers directly.
but alloca freed me from the misery of pointer arithmetic which is dangerous and error-prone and a very ugly style of programming imho, it also restored the image back to its physical representation (2D instead of 1D in RAM), so "alloca" is definitely a big YEEESSSS to me

Quote:
Try to include alloca.h instead of malloc.h.
got it.
feisty2 is offline   Reply With Quote
Old 22nd February 2017, 14:39   #92  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by KingLir View Post
The instruction says to use meson build system - so that what I used. Anyway, it's not straightforward to just build it with Visual Studio on macOS

I did what jackoneill suggested an changed the line in Shared.hpp to alloca.h instead of malloc.h.

It now build successfully with just one warning:

../Source.cpp:165:23: warning: 'VapourSynthPluginInit' has C-linkage specified, but returns user-defined type 'auto' which is incompatible with C [-Wreturn-type-c-linkage]
VS_EXTERNAL_API(auto) VapourSynthPluginInit(VSConfigPlugin configFunc, VSRegisterFunction registerFunc, VSPlugin *plugin) {
^
1 warning generated.

Is this warning OK ?
it's okay, just ignore the warning.

Quote:
And are there any forseen impact (performance and etc) in using alloca instead of malloc ?
alloca() could be translated into simply 1 assembly instruction if inlined (ignoring the 16 byte alignment of rsp)
Code:
sub    rsp, size
and "malloc()" is much more complicated than "alloca()" at the assembly level, so alloca() is WAY faster than malloc(), at least ~1000 times faster from my previous tests.

Last edited by feisty2; 22nd February 2017 at 14:41.
feisty2 is offline   Reply With Quote
Old 22nd February 2017, 14:47   #93  |  Link
KingLir
Registered User
 
Join Date: Jan 2017
Posts: 146
Thank you guys! You should go and do a commit with the change.

A newbie question, what does it means " vapoursynth.Error: FixFades: input clip must be single precision fp, with constant dimensions. " ?
I am using a DVD (mpeg2) source. What conversation should I do ?
KingLir is offline   Reply With Quote
Old 22nd February 2017, 14:50   #94  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
core.fmtc.bitdepth(xxx, bits=32, fulls=False, fulld=True)
feisty2 is offline   Reply With Quote
Old 22nd February 2017, 15:11   #95  |  Link
KingLir
Registered User
 
Join Date: Jan 2017
Posts: 146
Quote:
Originally Posted by feisty2 View Post
core.fmtc.bitdepth(xxx, bits=32, fulls=False, fulld=True)
Thanks. I am getting only "pipe:: Invalid data found when processing input" for the following script:

clip = core.ffms2.Source(source.mkv)
clip = core.fmtc.bitdepth(clip=clip, bits=32, fulls=False, fulld=True)
clip = core.ftf.FixFades(clip=clip, mode=0, threshold=0.002, color=[0.0, 0.0, 0.0], opt=True)
clip.set_output()
KingLir is offline   Reply With Quote
Old 22nd February 2017, 15:17   #96  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
your script is correct, maybe your output program does not support 32bits precision videos (I mean even the crappy 10bits gets to be so called "high bitdepth")
feisty2 is offline   Reply With Quote
Old 22nd February 2017, 15:19   #97  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by feisty2 View Post
but alloca freed me from the misery of pointer arithmetic which is dangerous and error-prone and a very ugly style of programming imho, it also restored the image back to its physical representation (2D instead of 1D in RAM), so "alloca" is definitely a big YEEESSSS to me


got it.
Code:
srcp[i] = reinterpret_cast<const float *>(vsapi->getReadPtr(src, plane)) + i * src_stride;
dstp[i] = reinterpret_cast<float *>(vsapi->getWritePtr(dst, plane)) + i * dst_stride;
That's pointer arithmetic right there.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 22nd February 2017, 15:36   #98  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by jackoneill View Post
Code:
srcp[i] = reinterpret_cast<const float *>(vsapi->getReadPtr(src, plane)) + i * src_stride;
dstp[i] = reinterpret_cast<float *>(vsapi->getWritePtr(dst, plane)) + i * dst_stride;
That's pointer arithmetic right there.
I think pointer arithmetic like this is kind of safe at least, basically because it's a one-time thing, initialize once with pointer arithmetic and no more afterwards.

and if there's no alloca() doing the dirty work before you get the actual thing started, you will have to later write a lot of crap like
Code:
srcp += src_stride;
dstp += dst_stride;
everytime you dereference the pointers within a loop...

and say you're out of your mind for a sec and forget to write that crap in the loop, what's about to happen is:
BOOM! crash!

and when that happens, it's again, extremely hard to find where the program went wrong.

and "alloca()" freed you from all these troubles
feisty2 is offline   Reply With Quote
Old 22nd February 2017, 17:45   #99  |  Link
KingLir
Registered User
 
Join Date: Jan 2017
Posts: 146
Quote:
Originally Posted by feisty2 View Post
your script is correct, maybe your output program does not support 32bits precision videos (I mean even the crappy 10bits gets to be so called "high bitdepth")
Oh, I am using ffmpeg. Should I look for a special build of ffmpeg that support 32bits precision ? Do you know where I can find it ?
KingLir is offline   Reply With Quote
Old 22nd February 2017, 20:33   #100  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by KingLir View Post
Oh, I am using ffmpeg. Should I look for a special build of ffmpeg that support 32bits precision ? Do you know where I can find it ?
ffmpeg doesn't like floating point formats. You'll have to convert back to some integer format before output.

Or nag feisty2 to add support for integer clips, because there's no reason not to.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Reply

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 02:43.


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