ultravideo / kvazaar

An open-source HEVC encoder
BSD 3-Clause "New" or "Revised" License
826 stars 178 forks source link

Windows: use win32 thread API instead of using C++11 thread API #314

Open vtorri opened 2 years ago

vtorri commented 2 years ago

currently, c++11 thread API is used to emulate pthread API. But the Win32 API provides thread and semaphore API, and it also a C API.

So what about providing a interface for thread and semaphore, one with pthread, and the other for Windows ?

Also note that with mingw, winpthread is reported being suboptimal.

thank you

fador commented 2 years ago

Hi!

Yes, we chose to build our own using the C++11 since it's at least "portable" (even though we use it only for windows stuff) and we can include it inside Kvazaar, which was one of the problems of pthreads-win32 we used earlier. In other systems the default system pthreads is anyway used.. Actually I don't know if we did any exhaustive benchmarks, but the old solution was just annoying and it basically did the same thing of wrapping another thread API ;)

Sounds like an interesting optimization if it actually helps for the windows performance, but not really sure if it's worth the time right now =)

Thank you for the input!

vtorri commented 2 years ago

there will be less memory consumption for sure without c++ code. It will be a bit more faster, but i guess that the cirtical part is when dealing with encoding. So it will be hard to see an improvement in speed encoding.