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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th March 2022, 20:13   #2001  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,384
Out of curiosity, what about propclearall() right after indexing?
FranceBB is offline   Reply With Quote
Old 21st March 2022, 05:32   #2002  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,862
Code:
ClearAutoloadDirs()
LoadPlugin("I:\INNOIN~1\64bit\Avisynth\AVISYN~1\LSMASHSource.dll")
LoadPlugin("I:\INNOIN~1\64bit\Avisynth\AVISYN~1\MosquitoNR.dll")
LWLibavVideoSource("G:\TESTCL~1\test.avi",cache=false,dr=true,format="YUV420P8", prefer_hw=0)
propclearall()
MosquitoNR()
ConvertToRGB32(matrix="Rec601")
return last
also crashes at the initial invoke call and without the 'ConvertToRGB32' it crashes when 'ConvertToRGB32' is later called.
-> no change
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 21st March 2022, 10:18   #2003  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,384
Ok, so I've tried to test a bit:

Code:
ColorBars(848, 480, pixel_type="YV12")
MosquitoNR()
ConverttoRGB(matrix="Rec601")
works.
So I tried with a real video, an XDCAM-50 file and it works too:


Code:
FFVideoSource("\\mibctvan000.avid.mi.bc.sky.it\Ingest\MEDIA\temp\Test9_UCN_manual_QC_SubITA_DolbyE_DolbyE_PCM_PCM.mxf")
propClearAll()
MosquitoNR()
ConverttoRGB(matrix="Rec601")
Last but not least, I've tried LWLibavVideoSource() which is the indexer you were trying to use and... it works:

Code:
LWLibavVideoSource("\\mibctvan000.avid.mi.bc.sky.it\Ingest\MEDIA\temp\Test9_UCN_manual_QC_SubITA_DolbyE_DolbyE_PCM_PCM.mxf")
propClearAll()
MosquitoNR()
ConverttoRGB(matrix="Rec601")


and even your exact same command line:




Avisynth 3.7.2 Stable x64
Windows 11 x64

Out of curiosity, are you using this build of MosquitoNR? Link
FranceBB is offline   Reply With Quote
Old 21st March 2022, 13:03   #2004  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,862
I know that it works in avspmod, problem is that it does not work in my code.

Quote:
Out of curiosity, are you using this build of MosquitoNR?
Yes, I do.

Cu Selur
__________________
Hybrid here in the forum, homepage, its own forum

Last edited by Selur; 21st March 2022 at 15:24.
Selur is offline   Reply With Quote
Old 21st March 2022, 16:35   #2005  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,535
Quote:
Originally Posted by Selur View Post
Using latest AviSynth+ 3.7.2

When I use:
...
my code crashes when loading the the file:
Code:
AVS_linkage = m_env->GetAVSLinkage();
    const char* infile = m_currentInput.toLocal8Bit(); //convert input name to char*
    std::cout << "Importing " << infile << std::endl;
    AVSValue arg(infile);
    m_res = m_env->Invoke("Import", AVSValue(&arg, 1)); // <- here it dies
see: https://github.com/Selur/avsViewer/b...iewer.cpp#L142
...
-> any idea?

Cu Selur
Just a faint guess. it is the first use of m_res. Maybe the crash is related to it.
In the avsViewer::avsViewer there is an initialization of AVSValue m_res in that initialization list. Here:
https://github.com/Selur/avsViewer/b...Viewer.cpp#L28
But the global variable const AVS_Linkage *AVS_linkage which is needed as a bridge to fill/initialize an AVSValue does not exist yet. I'd try to remove m_res from the initialization list. Otherwise your code seems to be correct: toLocal8Bit is providing a safe null-terminated buffer; I guess 'm_env' exists just fine, so GetAVSLinkage should work as well.
pinterf is offline   Reply With Quote
Old 21st March 2022, 17:07   #2006  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,862
Sadly, removing m_res from the initialization list doesn't help.
The strange thing is that if the .avs script doesn't include any "ConvertTo..." calls the loading of the script works fine, but then it crashes when I call ConvertToRGB32. :/
When I use:
Code:
bool avsViewer::invokeFunction(const QString& name)
{
  try {
    std::cout << "invoking " << qPrintable(name) << std::endl;
    const char* function = name.toLocal8Bit();
    if (!m_env->FunctionExists(function)) {
       m_env->ThrowError(name.toLocal8Bit() + " does not exist!");
    }
    m_res = m_env->Invoke(function, AVSValue(&m_res, 1)); // invoking the function
    std::cerr << "invoked " << qPrintable(name) << std::endl;
    return true;
  } catch (AvisynthError err) { //catch AvisynthErrors
    std::cerr << "Avisynth error " << qPrintable(m_currentInput) << ": " << std::endl << err.msg << std::endl;
  } catch (...) { //catch the rest
    std::cerr << "Unknown C++ exception" << std::endl;
  }
  return false;
}
I see:
Code:
Initializing the avisynth script environment,..
loaded avisynth dll,..(I:/workspace/avsViewer/release/AviSynth.dll)
loaded CreateScriptEnvironment definition from dll,..
Importing c:\Users\Selur\Desktop\test.avs

Color: YV12, Resolution: 640x352, Frame rate: 25 fps, Length: 429 frames, PRO

Current color space: YV12
invoking ConvertToRGB32
so it dies in
Code:
m_res = m_env->Invoke(function, AVSValue(&m_res, 1)); // invoking the function
This is driving me nuts.

Cu Selur
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 21st March 2022, 17:24   #2007  |  Link
Ceppo
Registered User
 
Join Date: Feb 2016
Location: Nonsense land
Posts: 339
I'm not in the right mind at the moment but:
Code:
m_res = m_env->Invoke(function, AVSValue(&m_res, 1)); // invoking the function
Is assigning a value to m_res and to use it with a reference at the same time... legit??

/I'mNotAProgrammer
Ceppo is offline   Reply With Quote
Old 21st March 2022, 17:40   #2008  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,862
Since the right side should be evaluated before the assignment I see no problem with it.

Cu Selur

Ps.: Can someone compile MosquitoNR with MVSC++ 2019?
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 21st March 2022, 18:22   #2009  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,823
We should probably pop all this out into its own thread. But for now, I can confirm that

Code:
		temp = env->Invoke("colorbars", 1280); // how do you invoke a filter with no parameters?
		temp = env->Invoke("converttoyv12", AVSValue(&temp, 1));
		temp = env->Invoke("mosquitonr", AVSValue(&temp, 1));
		temp = env->Invoke("converttorgb32", AVSValue(&temp, 1));
crashes (MSVC2019, Avisynth+ 3.7.1), but doesn't crash if I remove the converttogrb32.

Yet putting ConvertToRGB32 directly in a script after MosquitoNR works fine. Very strange.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 21st March 2022, 18:43   #2010  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,676
Quote:
Originally Posted by Selur View Post
Ps.: Can someone compile MosquitoNR with MVSC++ 2019?
For x64 it would have to be with the Intel compiler since the source contains assembly.

On a side note, for anyone with the means to do it. The following plugins were all compiled with the Intel compiler as well. Downside is that they are compiled for the 2.5 interface and may be problematic as stated here: https://github.com/AviSynth/AviSynthPlus/issues/272

Quote:
Originally Posted by pinterf
Not only unaware of frame props.
SmoothD2 is an AviSynth 2.5 plugin which can use hardcoded ("baked") code for frame manipulation instead of Avisynth interface calls. Behavior is uncontrolled and random.
  • Decomb
  • IT_YV12
  • MosquitoNR
  • SmoothD
  • SmoothD2

A 2.6 interface update for these plugins would be appreciated .
Reel.Deel is offline   Reply With Quote
Old 21st March 2022, 19:02   #2011  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,862
Quote:
But for now, I can confirm that
Man I'm happy that this does not happen to just me.

Quote:
crashes (MSVC2019, Avisynth+ 3.7.1), but doesn't crash if I remove the converttogrb32.
hmm,.. I'm using 3.7.2 and there "putting ConvertToRGB32 directly in a script after MosquitoNR" does not work fine here. :/

Quote:
A 2.6 interface update for these plugins would be appreciated
Yup, that would be cool.

Cu Selur
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 21st March 2022, 19:04   #2012  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,823
I'm trying to build 3.7.2 from source with MSVC 2019. I download the source, use "Open a local folder" and it imports everything fine. I then go to Manage Configurations... which gives me a GUI to make changes to CMakeSettings.json. I take out the default Debug build and replace it with x64-Release, and I change the Configuration type to Release.

When I try to build, I get a number of unresolved externals:


The funny thing is I can do the exact same thing on my work computer, and it works fine. But not at home. Does anyone know what's wrong with my setup? Am I missing some required part of MSVC?

Edit: I CAN successfully build an x64-Debug version. But not Release.
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 21st March 2022 at 19:07.
wonkey_monkey is offline   Reply With Quote
Old 21st March 2022, 19:10   #2013  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,823
Quote:
Originally Posted by Selur View Post

hmm,.. I'm using 3.7.2 and there "putting ConvertToRGB32 directly in a script after MosquitoNR" does not work fine here. :/
Does your program still invoke ConvertToRGB32 when it is already in the script?

What worked for me was putting ConvertToRGB32 in a script and then running the script with AVSMeter64. If I try to load the script in my viewer - which invokes ConvertToRGB32 a further time, regardless of what type the script produces - it crashes.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 21st March 2022, 19:18   #2014  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,862
Quote:
Does your program still invoke ConvertToRGB32 when it is already in the script?
Nope, ConvertToRGB32 is only invoked if the input isn't already RGB32.
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 21st March 2022, 19:57   #2015  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,535
Quote:
Originally Posted by wonkey_monkey View Post
I'm trying to build 3.7.2 from source with MSVC 2019. I download the source, use "Open a local folder" and it imports everything fine. I then go to Manage Configurations... which gives me a GUI to make changes to CMakeSettings.json. I take out the default Debug build and replace it with x64-Release, and I change the Configuration type to Release.

When I try to build, I get a number of unresolved externals:


The funny thing is I can do the exact same thing on my work computer, and it works fine. But not at home. Does anyone know what's wrong with my setup? Am I missing some required part of MSVC?

Edit: I CAN successfully build an x64-Debug version. But not Release.
I've never used cmake from Visual Studio GUI.
I'm using CMakeGUI and using it to generate the .sln solution for all projects and dlls in Avisynth+.
https://avisynthplus.readthedocs.io/...from-cmake-gui
Then I open the generated sln and can use both debug and release build from Visual Studio IDE.
pinterf is offline   Reply With Quote
Old 21st March 2022, 20:08   #2016  |  Link
Ceppo
Registered User
 
Join Date: Feb 2016
Location: Nonsense land
Posts: 339
Might be unrelated, but when I used invoke with vinverse, when passing directly the value in the invoke call I got the float converted to int for no reason, then I declared first the array and then I set the value of each index individually and the problem was gone, give it a shot, you got nothing to lose after all...

3 nights without sleeping
Ceppo is offline   Reply With Quote
Old 21st March 2022, 20:16   #2017  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,862
On my way to bed, you mean like this?
Code:
AVSValue tmp[1] = { &m_res }; 
m_res = m_env->Invoke(function, tmp);
(will try tomorrow after work)
__________________
Hybrid here in the forum, homepage, its own forum
Selur is offline   Reply With Quote
Old 21st March 2022, 20:36   #2018  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,535
Is it easy and straightforward to build and use avsviewer cloned from git? Does it have any prerequisites?
pinterf is offline   Reply With Quote
Old 21st March 2022, 20:47   #2019  |  Link
Ceppo
Registered User
 
Join Date: Feb 2016
Location: Nonsense land
Posts: 339
Quote:
On my way to bed, you mean like this?
Code:
AVSValue tmp[1];
tmp[0] =  &m_res;
Ceppo is offline   Reply With Quote
Old 22nd March 2022, 00:29   #2020  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,375
I wonder if frame props are broken? I expect frame properties assigned to frame 0 be retrieved outside a runtime environment.

Code:
ScriptClip( function[] () {
SelectEvery(1,-current_frame)
AverageLuma() > 98 ? propSet("_TestFP", 4) : propSet("_TestFP", 1)
SelectEvery(1, current_frame)
subtitle(string(AverageLuma()),align=8,y=100)
} )

subtitle(string(propGetInt("_TestFP")),align=8)
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway 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 11:07.


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