mark:x264编译选项
一、編譯命令行詳解
- 命令行參數(shù)列表
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
- 命令行參數(shù)理解
| 參數(shù)名 | 參數(shù)說明 | 備注 |
| extra-asflags | 匯編編譯選項參數(shù) | |
| extra-cflags | gcc編譯選項參數(shù) | 《微軟編譯選項》 |
| extra-ldflags | 鏈接外部庫使用 | |
| extra-rcflags | ||
| disable-cli | disable cli | 正式版本可以關(guān)閉該項。禁止命令行操作。 |
| system-libx264 | use system libx264 instead of internal | |
| enable-shared | build shared library | |
| enable-static | build static library | |
| disable-opencl | disable OpenCL features | |
| disable-gpl | disable GPL-only features | 商用版本注意GPL?license,使用該功能,自研優(yōu)化代碼需要開源。 |
| disable-thread | disable multithreaded encoding | |
| disable-win32thread | disable win32threads (windows only) | |
| disable-interlaced | disable interlaced encoding support | 是否禁止支持場編碼 |
| bit-depth | set output bit depth (8, 10, all) [all] | 若使用10,要求YUV數(shù)據(jù)就是10bit。 |
| chroma-format | output chroma format (400, 420, 422, 444, all) [all] | |
| disable-asm | disable platform-specific assembly optimizations | linux下要安裝yasm、windows下安裝nasm才能使能該功能。 |
| enable-lto | enable link-time optimization | 自動尋找可優(yōu)化函數(shù),進行內(nèi)聯(lián)優(yōu)化等 |
| enable-debug | add -g | |
| enable-gprof | add -pg | |
| enable-strip | add -s | |
| enable-pic | build position-independent code | 地址無關(guān)代碼 (position-independent code,PIC),又稱地址無關(guān)可執(zhí)行文件 (position-independent executable,PIE) ,是指可在主存儲器中任意位置正確地運行,而不受其絕對地址影響的一種機器碼。PIC廣泛使用于共享庫,使得同一個庫中的代碼能夠被加載到不同進程的地址空間中。PIC還用于缺少內(nèi)存管理單元的計算機系統(tǒng)中,使得操作系統(tǒng)能夠在單一的地址空間中將不同的運行程序隔離開來。 |
| disable-avs | disable avisynth support | 視頻后處理工具。參見:AviSynth |
| disable-swscale | disable swscale support | 用于視頻縮放處理。 |
| disable-lavf | disable libavformat support | 直接調(diào)用ffmpeg庫,解析輸入文件為YUV。 |
| disable-ffms | disable ffmpegsource support | FFmpegSource2(FFMS2)是 Libav/FFmpeg 的封裝庫,解析輸入文件為YUV。 |
| disable-gpac | disable gpac support | 參見《GPCA》 |
| disable-lsmash | disable lsmash support | 參見《lsmash》 |
二、編譯命令行示例
關(guān)閉一些不使用的編譯選項,減少不必要的代碼分支判斷,提高性能。
./configure --disable-avs --disable-swscale --disable-lavf --disable-ffms?--disable-interlaced --enable-shared --enable-lto --bit-depth=8 --chroma-format=420 --extra-ldflags=-Wl,--output-def=libx264.def
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
三、實測gcc編譯選項
gcc -Wno-maybe-uninitialized -Wshadow -O3 -ffast-math -m64 ?-Wall -I. -I. -D_POSIX_C_SOURCE=200112L -std=gnu99 -D_GNU_SOURCE -fomit-frame-pointer -flto -fno-tree-vectorize
四、實測nasm編譯選項
nasm -I. -I. -DARCH_X86_64=1 -I./common/x86/ -f win64 -DSTACK_ALIGNMENT=16 -DPIC
nasm官網(wǎng):https://www.nasm.us/
五、備注說明
在某些環(huán)境下,對可執(zhí)行文件的大小會有些限制,為減少可執(zhí)行文件的size,可以編譯的優(yōu)化選項有:
1、去掉-g
2、開啟O3
3、開啟strip
4、開啟ar -x,過濾不需要的.a(eg:有個.a,程序鏈接了它,但沒有使用任何符號,這個.a 就不會出現(xiàn)在可執(zhí)行文件里)
5、全局變量不要初始化,讓他在bss區(qū)
總結(jié)
以上是生活随笔為你收集整理的mark:x264编译选项的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CAD如何创建图层并绘制图形
- 下一篇: CDC类简介