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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 17th May 2019, 17:19   #4681  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Location: Germany
Posts: 5,564
Is it possible to fully automate ConvertFromDoubleWidth meaning calling it only when it is double width. When the aspect ratio is > 3.5 then it is very likely double width and that's good enough for me, my problem is I don't know what to use as bits argument, how do I know if it is 10 or 16 bit?
stax76 is offline   Reply With Quote
Old 17th May 2019, 20:01   #4682  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 153
Isn't it better to write a patch for lsmashsource plugin and don't rely on vague heuristics?
__________________
Me on GitHub | My Telegram
DJATOM is offline   Reply With Quote
Old 17th May 2019, 20:05   #4683  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Location: Germany
Posts: 5,564
It's better sure but if it was trivial somebody would have already done it.
stax76 is offline   Reply With Quote
Old 17th May 2019, 20:19   #4684  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 153
It looks trivial for me, but I don't have much time to spend for coding. I'm working everyday from December.
__________________
Me on GitHub | My Telegram
DJATOM is offline   Reply With Quote
Old 27th May 2019, 03:21   #4685  |  Link
tyee
Registered User
 
Join Date: Oct 2001
Posts: 407
Just a quick question - I am finally upgrading to avisynth+ and have done it manually and it seems to be working fine but I am wondering a couple of things -

1. I copied the 2 avisynth.dll's in my 64 bit system to the required windows folders
2. I updated the registry with the new location of my "plugins+" folder. My old folder seems to be used if I rename this new folder, which is correct according to the docs although the 2 registry entries that my original avisynth is supposed to use do not exist!
3. In my new "avisynth+" folder I have copied the two folders that came in the zipfile, these are "c_api" and "system" and the files within. "c_api" folder has "avisynth.lib" and "avisynth.exp". Is this where they should be left?

Everything seems to work ok. I can load a video and one filter I added does work.

Oh, one last question - Do I have to use any MT commands in my scripts like in the older version? I'm using pinterf's avisynth+.

Update on MT - OK, found the info on MT and it's commands. Just tried it and I see no speed increase using Prefetch(4).

Last edited by tyee; 27th May 2019 at 04:34.
tyee is offline   Reply With Quote
Old 27th May 2019, 09:12   #4686  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 869
Quote:
Originally Posted by tyee View Post
Just a quick question - I am finally upgrading to avisynth+ and have done it manually and it seems to be working fine but I am wondering a couple of things -

1. I copied the 2 avisynth.dll's in my 64 bit system to the required windows folders
2. I updated the registry with the new location of my "plugins+" folder. My old folder seems to be used if I rename this new folder, which is correct according to the docs although the 2 registry entries that my original avisynth is supposed to use do not exist!
3. In my new "avisynth+" folder I have copied the two folders that came in the zipfile, these are "c_api" and "system" and the files within. "c_api" folder has "avisynth.lib" and "avisynth.exp". Is this where they should be left?

Everything seems to work ok. I can load a video and one filter I added does work.

Oh, one last question - Do I have to use any MT commands in my scripts like in the older version? I'm using pinterf's avisynth+.

Update on MT - OK, found the info on MT and it's commands. Just tried it and I see no speed increase using Prefetch(4).
3. you don't need these files. There is a "Universal Avisynth Installer" https://forum.doom9.org/showthread.php?t=172124 which does all the work for you. You just need to set the path in the bat file.
ChaosKing is online now   Reply With Quote
Old 1st June 2019, 11:17   #4687  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,168
Pinterf, just pointing out this line
https://github.com/pinterf/AviSynthP...s/fps.cpp#L655

Code:
// :FIXME: Use fast plane blend routine from Merge here
MysteryX is offline   Reply With Quote
Old 1st June 2019, 11:31   #4688  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,213
Quote:
Originally Posted by MysteryX View Post
Pinterf, just pointing out this line
https://github.com/pinterf/AviSynthP...s/fps.cpp#L655

Code:
// :FIXME: Use fast plane blend routine from Merge here
Done already
https://github.com/pinterf/AviSynthP...s/fps.cpp#L671
Up to avx2
pinterf is offline   Reply With Quote
Old 1st June 2019, 12:09   #4689  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,168
dammit I was using the wrong source code. I always have a hard time finding the right source code version.

I'm looking at ConvertFps code. Why is it that when I debug the code and step frame by frame, in ConvertFPS::GetFrame, mix_ratio is always 1023 (out of 1024) and thus doesn't perform any blend? Then if I seek elsewhere in the file then it starts blending with other ratios.

Really something looks wrong. If I debug and put a breakpoint right after discarding based on threshold, and I play the video, blending doesn't get triggered at all because all frames have ratio of 1023!?? Then if I seek, it's a different ratio but all the frames will have that same ratio until I seek again. I'm using your version now, but something doesn't look right.

That's debugging a copy of your code I made into my project; so it's possible something got broken during copy too.

EDIT:
Never mind my source video was already a 60fps!!!

Last edited by MysteryX; 1st June 2019 at 12:35.
MysteryX is offline   Reply With Quote
Old 1st June 2019, 12:48   #4690  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,168
Oh. Interesting. Pinterf, your new code for ConvertFps calculates mix_ratio and mix_ratio_f but never uses them!! Thus altering those variables shows no difference whatsoever!

Seems like the function is only capable of doing a 50/50 blend?

Edit: it's using frac_f instead of mix_ratio; but then it's ignoring the threshold calculation.

Last edited by MysteryX; 1st June 2019 at 12:59.
MysteryX is offline   Reply With Quote
Old 1st June 2019, 15:55   #4691  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,213
Quote:
Originally Posted by MysteryX View Post
Edit: it's using frac_f instead of mix_ratio; but then it's ignoring the threshold calculation.
Thanks I'm gonna check it soon.
pinterf is offline   Reply With Quote
Old 1st June 2019, 19:47   #4692  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,213
Quote:
Originally Posted by MysteryX View Post
Oh. Interesting. Pinterf, your new code for ConvertFps calculates mix_ratio and mix_ratio_f but never uses them!! Thus altering those variables shows no difference whatsoever!

Seems like the function is only capable of doing a 50/50 blend?

Edit: it's using frac_f instead of mix_ratio; but then it's ignoring the threshold calculation.
No problem there, in this section mix_ratio is used for threshold comparison, but the frac_f holds the real blending weight of the two neightbouring frames. Anyway, I have deleted some unused variables to make it a bit clearer.
pinterf is offline   Reply With Quote
Old 2nd June 2019, 00:03   #4693  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,765
I'm writing a C++ program that creates its own Avisynth environment. When I compile it, I get:

Code:
error LNK2001: unresolved external symbol "struct AVS_Linkage const * const AVS_linkage" (?AVS_linkage@@3PEBUAVS_Linkage@@EB)
That goes away if I add:

Code:
#define AVS_LINKAGE_DLLIMPORT
which is what I used to do in my old plugins. Nowadays, in my plugins, I do:

Code:
const AVS_Linkage *AVS_linkage = 0;

extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors) {
	AVS_linkage = vectors;
	...
but I don't know how to, or if I should, translate this to my standalone C++ program. So - since I have no idea what this vectors thing is about - what's the right thing to do?
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 2nd June 2019, 00:39   #4694  |  Link
Groucho2004
 
Groucho2004's Avatar
 
Join Date: Mar 2006
Location: A wretched hive of scum and villainy
Posts: 4,286
Quote:
Originally Posted by wonkey_monkey View Post
I'm writing a C++ program that creates its own Avisynth environment. When I compile it, I get:

Code:
error LNK2001: unresolved external symbol "struct AVS_Linkage const * const AVS_linkage" (?AVS_linkage@@3PEBUAVS_Linkage@@EB)
That goes away if I add:

Code:
#define AVS_LINKAGE_DLLIMPORT
which is what I used to do in my old plugins. Nowadays, in my plugins, I do:

Code:
const AVS_Linkage *AVS_linkage = 0;

extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors) {
	AVS_linkage = vectors;
	...
but I don't know how to, or if I should, translate this to my standalone C++ program. So - since I have no idea what this vectors thing is about - what's the right thing to do?
Have a look at my avsr code, "avsr.cpp" in particular.
It basically boils down to this:
Code:
//global defs
const AVS_Linkage *AVS_linkage = 0;
typedef IScriptEnvironment * __stdcall CREATE_ENV(int);

HINSTANCE hDLL;
hDLL = ::LoadLibrary("avisynth");

if (!hDLL)
{
  //Error handling
  return;
}

int iInterfaceVersion;
IScriptEnvironment *AVS_env = 0;

try
{
 CREATE_ENV *CreateEnvironment = (CREATE_ENV *)GetProcAddress(hDLL, "CreateScriptEnvironment");
 if (!CreateEnvironment)
 {
  ::FreeLibrary(hDLL);
  //Error handling
  return;
 }

 iInterfaceVersion = 6;
 while (!AVS_env)
 {
  if (iInterfaceVersion < 5)
  {
   ::FreeLibrary(hDLL);
  //Error handling
   return;
  }

  AVS_env = CreateEnvironment(iInterfaceVersion);
  iInterfaceVersion--;
 }

 AVS_linkage = AVS_env->GetAVSLinkage();

 //do your stuff
 ...


 //important!
 AVS_env->DeleteScriptEnvironment();
 AVS_env = 0;
 AVS_linkage = 0;
}
catch (AvisynthError err)
{
  //Error handling
}
catch (other error handling mechanisms)
{
 //Error handling
}

::FreeLibrary(hDLL);
__________________
Groucho's Avisynth Stuff

Last edited by Groucho2004; 2nd June 2019 at 00:57.
Groucho2004 is offline   Reply With Quote
Old 2nd June 2019, 05:24   #4695  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,168
Quote:
Originally Posted by pinterf View Post
No problem there, in this section mix_ratio is used for threshold comparison, but the frac_f holds the real blending weight of the two neightbouring frames. Anyway, I have deleted some unused variables to make it a bit clearer.
Why isn't it calculating the threshold on the same frac_f directly?
MysteryX is offline   Reply With Quote
Old 2nd June 2019, 10:54   #4696  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,765
Quote:
Originally Posted by Groucho2004 View Post
Have a look at my avsr code, "avsr.cpp" in particular.
It basically boils down to this:
That's a lot of stuff! What am I missing out on if I just use #define AVS_LINKAGE_DLLIMPORT intead?
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 2nd June 2019, 11:02   #4697  |  Link
Groucho2004
 
Groucho2004's Avatar
 
Join Date: Mar 2006
Location: A wretched hive of scum and villainy
Posts: 4,286
Quote:
Originally Posted by wonkey_monkey View Post
That's a lot of stuff! What am I missing out on if I just use #define AVS_LINKAGE_DLLIMPORT intead?
Don't know, never tried it. I developed this initialisation over the years, some bits are courtesy of IanB's suggestions. It's not a lot of stuff, it's the bare minimum.

What is your program supposed to do?

Edit: A couple of examples can also be found on avisynth.nl:
http://avisynth.nl/index.php/Filter_SDK/avs2yuv
http://avisynth.nl/index.php/Filter_SDK/avs2pcm
__________________
Groucho's Avisynth Stuff

Last edited by Groucho2004; 2nd June 2019 at 11:10.
Groucho2004 is offline   Reply With Quote
Old 2nd June 2019, 15:55   #4698  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,168
Hey Pinterf, I just realized that if any AVS script is running and auto-loading plugins, even if it's not using them, it's locking all those files on the hard drive. There's probably a better way of doing that.
MysteryX is offline   Reply With Quote
Old 2nd June 2019, 16:28   #4699  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,817
What if eg Scriptclip() on occasion [EDIT: not every frame] uses a function/filter, you dont 100% for sure know that its never gonna use it.
[ EDIT: or do you ? - same situation with plugin, where defo cant be sure ED: or can you ? ]

Best leave alone, let user decide what he/she/it is gonna lock-n'-load.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 2nd June 2019 at 16:47.
StainlessS is offline   Reply With Quote
Old 3rd June 2019, 01:59   #4700  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,168
Quote:
Originally Posted by StainlessS View Post
What if eg Scriptclip() on occasion [EDIT: not every frame] uses a function/filter, you dont 100% for sure know that its never gonna use it.
[ EDIT: or do you ? - same situation with plugin, where defo cant be sure ED: or can you ? ]
No problem.
1. Do a discovery of all DLLs and what's in them
2. Once the script is loaded and started rendering, unload everything that is not in use
NOTE: We still know what functions are available and where
3. If a function is later called that is unloaded, load it.

Otherwise, while we have any script playing that uses auto-loading, we cannot update any dll files.
MysteryX 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 12:05.


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