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 > Video Encoding > New and alternative video codecs

Reply
 
Thread Tools Search this Thread Display Modes
Old 18th June 2011, 16:41   #13661  |  Link
clsid
*****
 
Join Date: Feb 2005
Posts: 5,640
Libavcodec is still single-threaded for H.264. It uses w32threads instead of pthreads. Last time I tried changing that it crashed, and haven't looked into it deeper yet.
__________________
MPC-HC 2.1.7.2
clsid is offline   Reply With Quote
Old 18th June 2011, 17:26   #13662  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
I see, thx.
sneaker_ger is offline   Reply With Quote
Old 18th June 2011, 18:53   #13663  |  Link
mark0077
Registered User
 
Join Date: Apr 2008
Posts: 1,106
Guys, when using things like avisynth frame interpolation in ffdshow, is it upto ffdshow or avisynth to correctly set the pin out details.

I frame interpolate everything to 50.00fps using avisynth, yet madVR video renderer reports "movie 23.974 fps (says source filter)". ffdshow pin out also says the following, rather than the correct output rate of 50.00 fps

Code:
Filter : ffdshow Video Decoder - CLSID : {04FE9017-F873-410E-871E-AB91661A4EF7}

- Connected to:

CLSID: {E1A8B82A-32CE-4B0D-BE0D-AA68C772E423}
Filter: madVR Renderer
Pin: Input

- Connection media type:

Video: YV12 2048x1080 (16:9) 23.97fps
mark0077 is offline   Reply With Quote
Old 18th June 2011, 20:15   #13664  |  Link
TheRyuu
warpsharpened
 
Join Date: Feb 2007
Posts: 787
Quote:
Originally Posted by clsid View Post
Libavcodec is still single-threaded for H.264. It uses w32threads instead of pthreads. Last time I tried changing that it crashed, and haven't looked into it deeper yet.
Don't use w32threads then.

ffmpeg-mt was merged. There's zero reason to maintain both of them as separate entities in ffdshow.

Also what still needs to get done for 10bit h264 decoding support?

Last edited by TheRyuu; 18th June 2011 at 20:18.
TheRyuu is offline   Reply With Quote
Old 18th June 2011, 20:53   #13665  |  Link
clsid
*****
 
Join Date: Feb 2005
Posts: 5,640
It crashed when using pthreads. But like I have said, I haven't looked into it yet.

For the 10bit stuff, ffdshow needs to be updated to recognize the 9/10/16bit colorspaces of ffmpeg and use swscale to convert them to the standard output colorspaces. Patches are welcome.
__________________
MPC-HC 2.1.7.2
clsid is offline   Reply With Quote
Old 19th June 2011, 01:09   #13666  |  Link
clsid
*****
 
Join Date: Feb 2005
Posts: 5,640
Ok, got it working. H.264 decoding is now multi-threaded in libavcodec. Everyone please test.
__________________
MPC-HC 2.1.7.2
clsid is offline   Reply With Quote
Old 19th June 2011, 01:21   #13667  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Quote:
Originally Posted by clsid View Post
Ok, got it working. H.264 decoding is now multi-threaded in libavcodec. Everyone please test.
Looking good, performance of libav and ffmpeg-mt are identical.
sneaker_ger is offline   Reply With Quote
Old 19th June 2011, 02:39   #13668  |  Link
TheRyuu
warpsharpened
 
Join Date: Feb 2007
Posts: 787
I'm not completly sure but doesn't autostatic in pthreads mean code like this:
Code:
--- trunk/src/ffmpeg/DllEntry.c	2011/06/18 11:59:34	3884
+++ trunk/src/ffmpeg/DllEntry.c	2011/06/18 23:43:03	3885
@@ -28,33 +28,37 @@
 
 CRITICAL_SECTION g_csStaticDataLock;
 
+BOOL pthread_win32_process_attach_np(void);
+BOOL pthread_win32_process_detach_np(void);
+BOOL pthread_win32_thread_attach_np(void);
+BOOL pthread_win32_thread_detach_np(void);
+
 // --- standard WIN32 entrypoints --------------------------------------
 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
 {
- //static int count=0;
- //char pomS[40];
- switch (dwReason)
-  {
-   case DLL_PROCESS_ATTACH:
-    //count++;
-    //snprintf(pomS,40,"ffmpeg: %i %i\n",count,hInstance);OutputDebugString(pomS);
-    DisableThreadLibraryCalls(hInstance);
-    InitializeCriticalSection( &g_csStaticDataLock );
-    break;
-   case DLL_PROCESS_DETACH:
-    //count--;
-    //snprintf(pomS,40,"ffmpeg: %i %i\n",count,hInstance);OutputDebugString(pomS);
-    DeleteCriticalSection( &g_csStaticDataLock );
-    break;
-  }
- return TRUE;
+    switch (dwReason)
+    {
+    case DLL_PROCESS_ATTACH:
+        pthread_win32_process_attach_np();
+        pthread_win32_thread_attach_np();
+        DisableThreadLibraryCalls(hInstance);
+        InitializeCriticalSection( &g_csStaticDataLock );
+        break;
+
+    case DLL_PROCESS_DETACH:
+        pthread_win32_thread_detach_np();
+        pthread_win32_process_detach_np();
+        DeleteCriticalSection( &g_csStaticDataLock );
+        break;
+    }
+    return TRUE;
 }
 
 static char av_datetime[]=__DATE__" "__TIME__;
 void getVersion(char **version,char **build,char **datetime,const char* *license)
 {
- if (version) *version=AV_STRINGIFY(LIBAVCODEC_VERSION)", "COMPILER COMPILER_X64 COMPILER_INFO;
- if (build) *build=AV_STRINGIFY(LIBAVCODEC_BUILD);
- if (datetime) *datetime=av_datetime;
- if (license) *license="";
+    if (version) *version=AV_STRINGIFY(LIBAVCODEC_VERSION)", "COMPILER COMPILER_X64 COMPILER_INFO;
+    if (build) *build=AV_STRINGIFY(LIBAVCODEC_BUILD);
+    if (datetime) *datetime=av_datetime;
+    if (license) *license="";
 }
Isn't needed anymore since "libav" is built using the gnu linker. I'm only curious because it looks so similar to the (really) old way of doing static pthreads in ffmpeg:
Code:
Index: libavcodec/allcodecs.c
===================================================================
--- libavcodec/allcodecs.c	(revision 15966)
+++ libavcodec/allcodecs.c	(working copy)
@@ -41,6 +41,14 @@
           extern AVBitStreamFilter x##_bsf; \
           if(ENABLE_##X##_BSF)     av_register_bitstream_filter(&x##_bsf); }
 
+#ifdef PTW32_STATIC_LIB
+static void detach_ptw32(void)
+{
+    pthread_win32_thread_detach_np();
+    pthread_win32_process_detach_np();
+}
+#endif
+
 /**
  * Register all the codecs, parsers and bitstream filters which were enabled at
  * configuration time. If you do not call this function you can select exactly
@@ -59,6 +67,12 @@
         return;
     initialized = 1;
 
+#ifdef PTW32_STATIC_LIB
+    pthread_win32_process_attach_np();
+    pthread_win32_thread_attach_np();
+    atexit(detach_ptw32);
+#endif
+
     /* video codecs */
     REGISTER_DECODER (AASC, aasc);
     REGISTER_DECODER (AMV, amv);
You shouldn't need any custom code for pthreads to work.

Last edited by TheRyuu; 19th June 2011 at 02:43.
TheRyuu is offline   Reply With Quote
Old 19th June 2011, 06:35   #13669  |  Link
jmone
Registered User
 
Join Date: Dec 2007
Posts: 652
Quote:
Originally Posted by clsid View Post
Ok, got it working. H.264 decoding is now multi-threaded in libavcodec. Everyone please test.
Nice Work!

Also Looking good for me and if anything the CPU useage of libav "may" be just slightly better thant ffmpeg-mt (hard to really tell), but it is certainly no worse.

Anyway, are there any benefits now to use ffmpeg-mt over libav? If not are you goint to remove the ffmpeg-mt option?

Thanks
Nathan

Next you will say that libav now supports interlaced VC-1!
jmone is offline   Reply With Quote
Old 19th June 2011, 08:23   #13670  |  Link
JEEB
もこたんインしたお!
 
JEEB's Avatar
 
Join Date: Jan 2008
Location: Finland / Japan
Posts: 512
Quote:
Originally Posted by jmone View Post
Anyway, are there any benefits now to use ffmpeg-mt over libav? If not are you goint to remove the ffmpeg-mt option?
It was merged, thus the ffmpeg-mt source tree by itself is now pretty much obsolete, if there will be any fixes, they will get into libav/ffmpeg's trunks, not into ffmpeg-mt from now on .

Quote:
Originally Posted by jmone View Post
Next you will say that libav now supports interlaced VC-1!
Saw people on #libav-devel working on it at least, but this was a while ago.
__________________
[I'm human, no debug]
JEEB is offline   Reply With Quote
Old 19th June 2011, 10:04   #13671  |  Link
VipZ
Registered User
 
Join Date: Jun 2009
Location: London
Posts: 378
Quote:
Originally Posted by clsid View Post
Ok, got it working. H.264 decoding is now multi-threaded in libavcodec. Everyone please test.
All seems good here
__________________
Windows 11 Pro, CPU: Ryzen 9 5900X, GPU: GeForce RTX 3090 /w 512.95, Audio: HDMI to Yamaha RX-A3060 (5.1)
VipZ is offline   Reply With Quote
Old 19th June 2011, 10:26   #13672  |  Link
clsid
*****
 
Join Date: Feb 2005
Posts: 5,640
@TheRyuu
It crashes in ntdll without that custom code. It probably needs it because out pthread lib is a bit old. I will try updating it and see if that code is still needed. Thanks for the hint.

@all
ffmpeg-mt has been integrated into libavcodec now. So if no problems are reported, ffmpeg-mt can be removed in the near future. Things are looking good so far. Please also test MPEG-1/2, DV, and FFV1, which all use slice-based threading in libavcodec.

@JEEB
Afaik, there is not much active development going on regarding interlaced VC-1. But there is a GSOC project for it, but there has been in past year as well without much results.
http://wiki.multimedia.cx/index.php?...ssing_features
__________________
MPC-HC 2.1.7.2
clsid is offline   Reply With Quote
Old 19th June 2011, 11:25   #13673  |  Link
VipZ
Registered User
 
Join Date: Jun 2009
Location: London
Posts: 378
Quote:
Originally Posted by clsid View Post
@all
ffmpeg-mt has been integrated into libavcodec now. So if no problems are reported, ffmpeg-mt can be removed in the near future. Things are looking good so far. Please also test MPEG-1/2, DV, and FFV1, which all use slice-based threading in libavcodec.
I have thrown all my previous known issue files at this in x64 as well and haven't had any issues, playback has become much more stable in the last 1-2 months

The only issue is but its been around for a while, is that ffdshow doesn't seem to read this info on h264 in MKV when using LAV Spiltter,
Code:
VIDEOINFOHEADER2:
dwInterlaceFlags: 0x00000000
dwCopyProtectFlags: 0x00000000
dwPictAspectRatioX: 16
dwPictAspectRatioY: 9
dwControlFlags: 0x00000000
dwReserved2: 0x00000000
__________________
Windows 11 Pro, CPU: Ryzen 9 5900X, GPU: GeForce RTX 3090 /w 512.95, Audio: HDMI to Yamaha RX-A3060 (5.1)
VipZ is offline   Reply With Quote
Old 20th June 2011, 08:53   #13674  |  Link
roytam1
Firefox User
 
Join Date: Sep 2003
Posts: 202
Quote:
Originally Posted by clsid View Post
@TheRyuu
It crashes in ntdll without that custom code. It probably needs it because out pthread lib is a bit old. I will try updating it and see if that code is still needed. Thanks for the hint.

@all
ffmpeg-mt has been integrated into libavcodec now. So if no problems are reported, ffmpeg-mt can be removed in the near future. Things are looking good so far. Please also test MPEG-1/2, DV, and FFV1, which all use slice-based threading in libavcodec.

@JEEB
Afaik, there is not much active development going on regarding interlaced VC-1. But there is a GSOC project for it, but there has been in past year as well without much results.
http://wiki.multimedia.cx/index.php?...ssing_features
What about vp3/theora/mpeg4/huffyuv in ffmpeg-mt in the past? Will they have multi threading with new libavcodec?
roytam1 is offline   Reply With Quote
Old 20th June 2011, 12:21   #13675  |  Link
upyzl
zj262144
 
upyzl's Avatar
 
Join Date: Sep 2010
Posts: 105
sorry to trouble, I've been meaning to ask...

what does splineResize stand for? spline16resize? spline36resize? spline64resize? could I tweak it as LanczosResize(taps)?
__________________
MPC-HC 1.7.8 / LAV Filters 0.64+ (tMod) / XySubFilter 3.1.0.705 / madVR 0.87.14

Direct264 Mod (src & win32 builds): code.google.com/p/direct264umod (maybe outdated)
upyzl is offline   Reply With Quote
Old 20th June 2011, 14:27   #13676  |  Link
clsid
*****
 
Join Date: Feb 2005
Posts: 5,640
Quote:
Originally Posted by roytam1 View Post
What about vp3/theora/mpeg4/huffyuv in ffmpeg-mt in the past? Will they have multi threading with new libavcodec?
Those codecs have sync issues when MT is enabled for them. So unless someone figures out a solution for that they won't be multi-threaded.
__________________
MPC-HC 2.1.7.2
clsid is offline   Reply With Quote
Old 20th June 2011, 14:36   #13677  |  Link
Superb
Registered User
 
Join Date: Feb 2010
Posts: 364
clsid: did you use the latest winpthreads from http://mingw-w64.svn.sourceforge.net...l/winpthreads/ ?
Superb is offline   Reply With Quote
Old 20th June 2011, 15:28   #13678  |  Link
mandarinka
Registered User
 
mandarinka's Avatar
 
Join Date: Jan 2007
Posts: 729
Quote:
Originally Posted by upyzl View Post
sorry to trouble, I've been meaning to ask...

what does splineResize stand for? spline16resize? spline36resize? spline64resize? could I tweak it as LanczosResize(taps)?
Spline resize in ffdshow isn't related to avisynth scalers, it comes from ffmpeg's swscale library. AFAIK it has a different effect from say spline36resize, too.
mandarinka is offline   Reply With Quote
Old 20th June 2011, 18:35   #13679  |  Link
clsid
*****
 
Join Date: Feb 2005
Posts: 5,640
Quote:
Originally Posted by Superb View Post
clsid: did you use the latest winpthreads from http://mingw-w64.svn.sourceforge.net...l/winpthreads/ ?
I use this:
http://sourceforge.net/projects/ming...d%29/pthreads/
__________________
MPC-HC 2.1.7.2
clsid is offline   Reply With Quote
Old 20th June 2011, 19:15   #13680  |  Link
VipZ
Registered User
 
Join Date: Jun 2009
Location: London
Posts: 378
I cant seem to compile ffmpeg x64 anymore, had no issue with build 3886

As a reference, I used the below cmd and currently use mingw_gcc_461_v20110506_x86-x64-pre-release.7z from xvidvideo.ru
Code:
rd /S /Q obj\MinGW64
cd src\ffmpeg
make 64BIT=yes
cd ..\..
pause
__________________
Windows 11 Pro, CPU: Ryzen 9 5900X, GPU: GeForce RTX 3090 /w 512.95, Audio: HDMI to Yamaha RX-A3060 (5.1)

Last edited by VipZ; 20th June 2011 at 19:22.
VipZ is offline   Reply With Quote
Reply

Tags
ffdshow, ffdshow tryouts, ffdshow-mt, ffplay, icl

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:09.


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