Skip to content

Commit 4f9297a

Browse files
DonDiegojamrial
authored andcommitted
build: Prefer NASM assembler over YASM
NASM is more actively maintained and permits generating dependency information as a sideeffect of assembling, thus cutting build times in half. (Cherry-picked from libav commit 57b753b) Signed-off-by: James Almer <jamrial@gmail.com>
1 parent 3cc73d3 commit 4f9297a

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ os:
66
addons:
77
apt:
88
packages:
9-
- yasm
9+
- nasm
1010
- diffutils
1111
compiler:
1212
- clang
@@ -17,7 +17,7 @@ cache:
1717
before_install:
1818
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update --all; fi
1919
install:
20-
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install yasm; fi
20+
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install nasm; fi
2121
script:
2222
- mkdir -p ffmpeg-samples
2323
- ./configure --samples=ffmpeg-samples --cc=$CC

Changelog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ version <next>:
2222
- headphone audio filter
2323
- superequalizer audio filter
2424
- roberts video filter
25+
- The x86 assembler default switched from yasm to nasm, pass
26+
--x86asmexe=yasm to configure to restore the old behavior.
2527

2628
version 3.3:
2729
- CrystalHD decoder moved to new decode API

configure

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3258,7 +3258,7 @@ pkg_config_default=pkg-config
32583258
ranlib_default="ranlib"
32593259
strip_default="strip"
32603260
version_script='--version-script'
3261-
x86asmexe_default="yasm"
3261+
x86asmexe_default="nasm"
32623262
windres_default="windres"
32633263
nvcc_default="nvcc"
32643264
nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2"
@@ -5506,7 +5506,7 @@ EOF
55065506
}
55075507

55085508
if ! disabled_any asm mmx x86asm; then
5509-
for program in $x86asmexe yasm nasm; do
5509+
for program in $x86asmexe nasm yasm; do
55105510
probe_x86asm $program
55115511
test -n "$x86asm_type" && break
55125512
done
@@ -5518,7 +5518,7 @@ EOF
55185518
esac
55195519

55205520
check_x86asm "movbe ecx, [5]" && enable x86asm ||
5521-
die "yasm/nasm not found or too old. Use --disable-x86asm for a crippled build."
5521+
die "nasm/yasm not found or too old. Use --disable-x86asm for a crippled build."
55225522
check_x86asm "vextracti128 xmm0, ymm0, 0" || disable avx2_external
55235523
check_x86asm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
55245524
check_x86asm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external

doc/optimization.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ do{
161161
For x86, mark registers that are clobbered in your asm. This means both
162162
general x86 registers (e.g. eax) as well as XMM registers. This last one is
163163
particularly important on Win64, where xmm6-15 are callee-save, and not
164-
restoring their contents leads to undefined results. In external asm (e.g.
165-
yasm), you do this by using:
164+
restoring their contents leads to undefined results. In external asm,
165+
you do this by using:
166166
cglobal function_name, num_args, num_regs, num_xmm_regs
167167
In inline asm, you specify clobbered registers at the end of your asm:
168168
__asm__(".." ::: "%eax").
@@ -199,12 +199,12 @@ actual lines causing issues.
199199
Inline asm vs. external asm
200200
---------------------------
201201
Both inline asm (__asm__("..") in a .c file, handled by a compiler such as gcc)
202-
and external asm (.s or .asm files, handled by an assembler such as yasm/nasm)
202+
and external asm (.s or .asm files, handled by an assembler such as nasm/yasm)
203203
are accepted in FFmpeg. Which one to use differs per specific case.
204204

205205
- if your code is intended to be inlined in a C function, inline asm is always
206206
better, because external asm cannot be inlined
207-
- if your code calls external functions, yasm is always better
207+
- if your code calls external functions, external asm is always better
208208
- if your code takes huge and complex structs as function arguments (e.g.
209209
MpegEncContext; note that this is not ideal and is discouraged if there
210210
are alternatives), then inline asm is always better, because predicting

doc/platform.texi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from
7171
assembly functions. Put the Perl script somewhere
7272
in your PATH, FFmpeg's configure will pick it up automatically.
7373

74-
Mac OS X on amd64 and x86 requires @command{yasm} to build most of the
74+
Mac OS X on amd64 and x86 requires @command{nasm} to build most of the
7575
optimized assembly functions. @uref{http://www.finkproject.org/, Fink},
76-
@uref{http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml, Gentoo Prefix},
76+
@uref{https://wiki.gentoo.org/wiki/Project:Prefix, Gentoo Prefix},
7777
@uref{https://mxcl.github.com/homebrew/, Homebrew}
7878
or @uref{http://www.macports.org, MacPorts} can easily provide it.
7979

@@ -141,7 +141,7 @@ them under @command{MinGW-w64 Win64 Shell} and @command{MinGW-w64 Win32 Shell}.
141141
pacman -S make pkgconf diffutils
142142
143143
# mingw-w64 packages and toolchains
144-
pacman -S mingw-w64-x86_64-yasm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL
144+
pacman -S mingw-w64-x86_64-nasm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2
145145
@end example
146146

147147
To target 32 bits replace @code{x86_64} with @code{i686} in the command above.
@@ -159,7 +159,7 @@ You will need the following prerequisites:
159159
@item @uref{http://code.google.com/p/msinttypes/, msinttypes}
160160
(if using MSVC 2012 or earlier)
161161
@item @uref{http://msys2.github.io/, MSYS2}
162-
@item @uref{http://yasm.tortall.net/, YASM}
162+
@item @uref{http://www.nasm.us/, NASM}
163163
(Also available via MSYS2's package manager.)
164164
@end itemize
165165

0 commit comments

Comments
 (0)