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 January 2014, 19:34   #161  |  Link
Nico8583
Registered User
 
Join Date: Jan 2010
Location: France
Posts: 851
If I have found this if it can help you to understand how AVC + MVC could become an elementary stream :
Quote:
The first NAL-Unit in the bytestream is preceded by a four byte sequence which is
0x00000001. Every other NAL-Unit is preceded by a three byte sequence which is
0x000001. In addition each NAL-Unit can be succeeded by one or more null bytes (0x00).
As explained before, the NAL-Unit header is one byte, but it can be three additional
octets for MVC NAL-Units. The first byte of the header consists of a zero bit (a bit
which is always zero), the next two bits indicate whether the data in the NAL-Unit is
used by upcoming frames or if it can be discarded after decoding. The five remaining bits
in the one byte NAL-Unit header is the NAL-Unit type. A value of 14 or 20 indicates
an extended header for MVC. That means that whenever a NAL-Unit header has one of
those two types that NAL-Unit can be ignored for decoding when only 2D-playback is
desired.
The resulting bytestream is a AVC/MVC Elementary Stream (ES). It needs to be
packetized and encapsulated once again into a Packetized Elementary Stream (PES) as
described in ISO/IEC 13818-1:2000
It is extracted from this : http://www.nt.uni-saarland.de/filead...o_Viets_01.pdf page 19 & 20

Last edited by Nico8583; 17th January 2014 at 19:39.
Nico8583 is offline   Reply With Quote
Old 17th January 2014, 19:44   #162  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Thanks, but it is too light on details. Don't worry, I have adequate information sources.
Guest is offline   Reply With Quote
Old 17th January 2014, 19:52   #163  |  Link
Nico8583
Registered User
 
Join Date: Jan 2010
Location: France
Posts: 851
I have tested beta 2, it works very well for left & right views inverted
Nico8583 is offline   Reply With Quote
Old 17th January 2014, 20:03   #164  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Sweet. Thank you for your testing.
Guest is offline   Reply With Quote
Old 17th January 2014, 20:12   #165  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
I confirm. Good job! :-)

However, the problem of the script freezing when libmfxsw32.dll is not in the system path is still present. Neuron2, can you do something to load it from the same directory than DGMVCDecode.dll, or at least issue a meaningful error message when it cannot be loaded? It's not urgent, but imo something must be done for the final version, as currently the situation is confusing for the new users, because there is nothing to inform them of the necessity to properly install the Intel DLL.
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 17th January 2014, 20:32   #166  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Ah, changing your perfect priorities now, eh?

I will look into it. Tell me, as I am new to all this Intel stuff, where does that DLL normally come from for users? Is it part of Windows, part of an Intel driver, part of the Media SDK, ...?

Last edited by Guest; 17th January 2014 at 20:36.
Guest is offline   Reply With Quote
Old 17th January 2014, 20:45   #167  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
It's part of the Intel Media SDK, AFAIK.
I am on Windows 7/64 and had to put it into the SysWOW64 folder in order to "forget" it.
Sharc is offline   Reply With Quote
Old 17th January 2014, 20:52   #168  |  Link
Nico8583
Registered User
 
Join Date: Jan 2010
Location: France
Posts: 851
This DLL must be in a path described in environment variable path like %SystemRoot%\system32,%SystemRoot%,etc...
When you install Intel Media SDK, it adds C:\Program Files (x86)\Intel\Media SDK 2013 R2\bin\x64 and C:\Program Files (x86)\Intel\Media SDK 2013 R2\bin\win32 to environment variable path
But I don't know if it must be register via regsvr32 or not
Nico8583 is offline   Reply With Quote
Old 17th January 2014, 22:08   #169  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
For now I have included libmfxsw32.dll in the ZIP file and in the instructions I say to copy it to your system directory. Maybe later I will do something more intelligent but I am not totally free because of the Intel restrictions.

"Copy the included libmfxsw32.dll to your c:\Windows\System32 directory for 32-bit Windows,
or your c:\Windows\SysWOW64 directory for 64-bit Windows."

Last edited by Guest; 17th January 2014 at 22:17.
Guest is offline   Reply With Quote
Old 17th January 2014, 22:24   #170  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
Quote:
Originally Posted by neuron2 View Post
Ah, changing your perfect priorities now, eh?
Not really. I just think that dealing with the intel DLL properly is important, and should be in the todo list, but not necessarily at the first position.

Indeed, I confirm that your filter works fine only if the Intel DLL is copied in syswow64, or if it is in the same directory than the AVS script. Of course, the second solution is not acceptable. I wonder if it is possible to locate it and pre-load it in memory if it is in the same directory than the plugin. That way, it will not be necessary to install the intel SDK the official way, and it will be sufficient to just copy the two DLLs somewhere. Honestly, I don't know if it's possible. (I know however that it's not possible with pistacho's DLL.)

Please forget it for the moment, and continue to implement the more important things...
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 17th January 2014, 22:30   #171  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Why two DLLs? I checked dependencies and it seems only libmfxsw32.dll is needed. What other one are you talking about?

I tried to load it directly from a path of my choosing but it failed unaccountably. The error was file not found but it is definitely there. Rather than get bogged down in this, let's move on and possibly revisit it, as you suggest.
Guest is offline   Reply With Quote
Old 17th January 2014, 22:40   #172  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
Quote:
Originally Posted by neuron2 View Post
Why two DLLs? I checked dependencies and it seems only libmfxsw32.dll is needed. What other one are you talking about?
Your DLL, the avisynth source. I would like to have the possibility to leave them grouped together, in the same directory. Unfortunately, usually, the avisynth plugins are not placed in the system PATH. It's why I suggest to try to find a way to pre-load the intel DLL. It seems that that doesn't work. Not a big deal.

Quote:
Originally Posted by neuron2 View Post
Rather than get bogged down in this, let's move on and possibly revisit it, as you suggest.
I agree. Other things are more important.
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV
r0lZ is offline   Reply With Quote
Old 18th January 2014, 00:20   #173  |  Link
Nico8583
Registered User
 
Join Date: Jan 2010
Location: France
Posts: 851
Quote:
Originally Posted by r0lZ View Post
I agree. Other things are more important.
At this rate the "to do list" will quickly decrease
Nico8583 is offline   Reply With Quote
Old 18th January 2014, 01:00   #174  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by r0lZ View Post
Indeed, I confirm that your filter works fine only if the Intel DLL is copied in syswow64, or if it is in the same directory than the AVS script. Of course, the second solution is not acceptable. I wonder if it is possible to locate it and pre-load it in memory if it is in the same directory than the plugin.
It's simply because of Windows DLL search order. If a DLL is not loaded explicitly via LoadLibrary() and with a full path, then the standard DLL search order applies!

This means Windows will look at those directories:

1. The directory where the current program's EXE file resides
2. The System32 directory (Syswow64 for 32-Bit programs running on Win64)
3. The Windows directory
4. The current directory (this one is skipped with "safe" DLL loading enabled)
5. The directories in your PATH environment variable

This means that if the application loads DLL X (e.g. the Avisynth plug-in) from some directory, and DLL X depends on another DLL Y (e.g. the Intel DLL), then Windows will not search for DLL Y in the directory where DLL X is located

But it will, eventually, look in the "current" directory - which probably is why it works if you put the Intel DLL into the folder where the Avisynth script is located (assuming that one becomes the application's "current" directory).

Of course it also works if you put DLL Y into the System directory or into the directory where the program's EXE file is located. One workaround would be modifying DLL X to not depend on DLL Y, but instead make DLL X load DLL Y at runtime.

When DLL X uses LoadLibrary() at runtime, it can load DLL Y from wherever it wants to. So it could, for example, determine it's own module path and then try to load DLL Y from exactly that directory.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 18th January 2014 at 01:08.
LoRd_MuldeR is offline   Reply With Quote
Old 18th January 2014, 11:26   #175  |  Link
r0lZ
PgcEdit daemon
 
r0lZ's Avatar
 
Join Date: Jul 2003
Posts: 7,469
Thanks for the clarification, Lord, although I did know that.
And, yes, it seems that avisynth changes its CD to the directory containing the AVS script. I use that feature often to test a new avisynth filter without having to install it in the avisynth plugins directory or type its full path. It works in the case of the DGMVCDecode and libmfxsw32 DLLs, but it's not a practical solution.
Quote:
Originally Posted by LoRd_MuldeR View Post
One workaround would be modifying DLL X to not depend on DLL Y, but instead make DLL X load DLL Y at runtime.

When DLL X uses LoadLibrary() at runtime, it can load DLL Y from wherever it wants to. So it could, for example, determine it's own module path and then try to load DLL Y from exactly that directory.
It's exactly what I suggested. But in our case, that means that DGMVCDecode.dll must know the path of the directory where it is located and from where it is loaded by avisynth, to search for libmfxsw32.dll in that location. I don't know if it's possible. And libmfxsw32.dll must also support to be loaded with LoadLibrary(). Is it the case of all libraries?

In the worse case, it will be necessary to copy the intel DLL in system32/syswow64. I don't like that much, as touching the system folders without a good reason is always a bad thing, and anyway, I prefer standalone or portable installations. Currently, my GUI builds a batch file that must be launched to compute the output file, and it adds its toolset folder to the PATH in that script. With that trick, it is possible to modify locally the system PATH variable to include the toolset, without having to modify it in the whole system. That works pretty well, but that means that the avs script cannot be encoded by another application (such as for example your Simple x264 Launcher), because it will not have the correct PATH. It's why I would like a solution for that problem.

Anyway, that DLL path problem is for later.
__________________
r0lZ
PgcEdit homepage (hosted by VideoHelp)
BD3D2MK3D A tool to convert 3D blu-rays to SBS, T&B or FS MKV

Last edited by r0lZ; 18th January 2014 at 11:29.
r0lZ is offline   Reply With Quote
Old 18th January 2014, 15:53   #176  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by r0lZ View Post
But in our case, that means that DGMVCDecode.dll must know the path of the directory where it is located and from where it is loaded by avisynth, to search for libmfxsw32.dll in that location. I don't know if it's possible.
Call GetModuleFileName() with hinstDLL

(Doen't give you the DLL's directory, but the full path of the DLL file itself. But extracting the desired path should be trivial)
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 18th January 2014 at 16:26.
LoRd_MuldeR is offline   Reply With Quote
Old 18th January 2014, 16:30   #177  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Do you have working code that I can put in an Avisynth filter DLL that prints the path of that DLL file? If so, I can temporarily change the current directory for the IM SDK init to allow it to find the co-located libmfxsw32.dll.

Last edited by Guest; 18th January 2014 at 16:59.
Guest is offline   Reply With Quote
Old 18th January 2014, 16:44   #178  |  Link
jdobbs
Moderator
 
Join Date: Oct 2001
Posts: 20,975
Thanks for all the hard work DG. I'm setting up for testing... exciting stuff.
__________________
Help with development of new apps: Donations.
Website: www.jdobbs.net
jdobbs is offline   Reply With Quote
Old 18th January 2014, 17:19   #179  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Quote:
Originally Posted by neuron2 View Post
Do you have working code that I can put in an Avisynth filter DLL that prints the path of that DLL file? If so, I can temporarily change the current directory for the IM SDK init to allow it to find the co-located libmfxsw32.dll.
I made something that works:

Code:
char dllpath[1024];
HMODULE hm = NULL;
AVSValue __cdecl Create_AVCSource(AVSValue args, void*, IScriptEnvironment* env);

if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | 
        GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
        (LPCSTR) &Create_AVCSource, 
        &hm))
{
    int ret = GetLastError();
    fprintf(stderr, "GetModuleHandle returned %d\n", ret);
}
GetModuleFileNameA(hm, dllpath, sizeof(dllpath));
Now I will try changing the current directory to there and see if the libmfxsw32.dll can be loaded from there.

@jdobbs

Thanks! It's always a pleasure to work with you.
Guest is offline   Reply With Quote
Old 18th January 2014, 17:35   #180  |  Link
jdobbs
Moderator
 
Join Date: Oct 2001
Posts: 20,975
It seems to work fine... I just created a test with a 3 minute "Road Runner" cartoon. All works as it should. One note, though, I noticed that if I try to open the AVS in MPC, and the source file name is misspelled, it hung and required me to kill it from Task Manager. But that's a minor thing.

Cool.
__________________
Help with development of new apps: Donations.
Website: www.jdobbs.net
jdobbs 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 23:21.


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