ShiftMediaProject / x264

Unofficial X264 with added custom native Visual Studio project build tools. X264: A free software library and application for encoding video streams into the H.264/MPEG-4 AVC format.

Home Page:http://www.videolan.org/developers/x264.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't build 10 bit

Dan203 opened this issue · comments

I'm trying to build a 10 bit version of x264 in VS. I set the BIT_DEPTH to 10 in x264_config.h and add #define HIGH_BIT_DEPTH 1 to config.h but I get a bunch of linker errors. If I build the exact same source using mingw with this config it works fine...

./configure --disable-cli --enable-shared --bit-depth=10

Do you have any idea what needs to be done to make 10bit work in VS?

Based on a quick glance at the makefile it appears you need to disable sad-a.asm and add sad16-a.asm to the project (haven't tested this though).

I was hoping that someone would add functionality to x264 like the did with x265 that would allow 8b and 10b to be compiled into a single lib. That way I could add support for it into the provided projects. However x264 seems to be mostly undeveloped these days compared to x265.

Looks like Vittorio's patch to enable 8bit and 10bit combined builds has been added to x264s sandbox repo (9 days ago at time of writing this). So at some point soon this hopefully will get merged across into the main x264 stable branch at which point the projects here will get updated. Not sure when the x264 people will do this but as soon as they do i will update the project accordingly.

I tried replacing sad-a.asm with sad16-asm and it did eliminate some of the errors but I still get a bunch of linker errors. Here is an example of one...

Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _x264_sub8x16_dct_dc_avx referenced in function _x264_dct_init libx264 C:\Users\Dan\Desktop\x264-master\SMP\dct.obj 1

There are 112 of these from different modules.

Also I only get it when trying to build the DLL. The lib configuration works.

Also I noticed that when you enable 10bit in the normal ./config in mingw it also disables OpenCL, so I did the same in the VS project and disabled all the opencl related code files. Unfortunately that didn't fix the issue.

It looks like the files are referencing functions that don't exist. However a lot of the functions are generated using macros so it's hard to tell where they are getting created

Also I only get it when trying to build the DLL. The lib configuration works.

Thats because only Dlls do a link stage. With the static lib youll still get those errors but only when you build that lib into a final exe/dll.

It looks like the files are referencing functions that don't exist. However a lot of the functions are
generated using macros so it's hard to tell where they are getting created

Youll have to try and scan the Makefiles and configure file and try and reverse engineer what they are doing.

If you can wait till the combined 8b/10b support lands then ill update the projects for that. However the way that projects need to be changed to add 10b now and to support the combined 8b/10b later are different so any work now will just have to be redone when the changes land.

Thanks for your input. I was looking at the make file yesterday trying to figure it out but it seems the missing functions are related to SSE and I can't even figure out where they are generated. There are some macros in the asm files, so maybe there but I don't know assembly so those are hard for me to read.

For now I'll just hold off and wait for the patch you mentioned. This isn't urgent as I can still build with mingw.

My boss figured out how to get this to work. There are BIT_DEPTH and HIGH_BIT_DEPTH defines in the Netwide Assembler->Preprocessing section. If you change those too then the 10 bit version will build.

I didn't even notice those when I was trying to get it to work

Upstream x264 has now been updated so that it can now encode both 8bit and 10bit in the same lib/exe. The provided projects have already been updated to support this which you can compile yourself or grab any one of the existing compiled releases from the release page.
FFmpeg now also supports specifying the bit depth when using x264 which has also been updated in the supplied projects.