OpenHEVC / openHEVC

HEVC decoder
http://openhevc.github.io/openHEVC/
532 stars 193 forks source link

Visual Studio compile error #60

Open leochan2009 opened 7 years ago

leochan2009 commented 7 years ago

Hi,
i am trying to compile the project on my windows 7 machine. I have the following configuration: Environment: Toolset=v140; Configuration: Debug; Platform: x86 However, i got the following error:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\stdio.h(1421): fatal error C1189: #error: Macro definition of vsnprintf conflicts with Standard Library function declaration [C:\projects\openigtlink\build\Deps\openHEVC-bin\LibOpenHevcWrapper.vcxproj] [C:\projects\openigtlink\build\openHEVC.vcxproj]

I could fix the error by deleting the vsnprintf definition in CmakeLists file, showed as below: if(WIN32) add_definitions( -Dsnprintf=avpriv_snprintf -Dvsnprintf=avpriv_vsnprintf -Dinline=inline -Drestrict=restrict ) endif()

Do you have a general solution for this problem?

Another issue is the function: static attribute(always_inline)) inline ................... This function also create error in compiling after deleting the attribute(always_inline)) , the compiling succeeded.

Your kind answer to my questions would be greatly appreciated.

Best Regards, Chan

pcabarat commented 7 years ago

Hi, Thanks for reporting, We use some compatibiliy macros for multiplatform into compat/ directory. You can have a look to compat/msvcrt/snprintf.h and see where does this problem comes from. Those were taken from ffmpeg and haven't been updated for a while. We usually use crossplatform build in order to test for windows, so build might be broken on visual studio. I'll try to have a look into this when I'll have some time for it.

Concerning the second issue, i'll need a bit more details to solve your problem, since we already have an inline after the always_inline attribute I believe deleting it should be ok. I don't know how to force inlining into visual studio (always_inline is a gcc option). You might like replacing the static attribute(always_inline)) inline by static av_always_inline This should do the trick. Where is this function located so I can fix it ?

Pierre-Loup

leochan2009 commented 7 years ago

Hi Pierre-Loup,

Thanks for your reply. I tested several H265 decoders (openHEVC libde265, and JCT-VC ) for real time decoding purpose. The decoding speed varies a lot, and openHEVC is the fastest implementation the fastest implementation. So I really would like to include this great library into my open source project. It would be really helpful if it works on multi-platforms (which is sometimes very hard...)

Yes, av_always_inline will do the trick, i tested in my visual studio 2015. The line is located in the \libavcodec\x86\hevc_sao_sse.c file. line 338

Thanks again, Best Regards, Longquan