From patchwork Tue Jun 20 22:49:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 4067 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.22.4 with SMTP id 4csp1618740vsw; Tue, 20 Jun 2017 15:51:33 -0700 (PDT) X-Received: by 10.223.131.99 with SMTP id 90mr17382366wrd.123.1497999093908; Tue, 20 Jun 2017 15:51:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497999093; cv=none; d=google.com; s=arc-20160816; b=PsfYWdBkerSaEt8xfCN6Qyjpd0q5htH/DVwQpEOzQJYTTh7eZbg+zM5pa8h/zMxazE 3MH26z8nu03B+0UXrFmcazNp8zl6XMvlopINZ4Vfw5hFMPH1TDhu+L6ij9wZckCam5HE yGAYBU7ux9rWqG6PqT17ASck2WT49UWGjTn9jlsV8z69EtQ6R3qFkQzhiweue9wjR3ze +9h6wnysLFXElZPS3RkF4vtt+LbthWsC7XrwbiQyrteWU87nW+BNFQjVoYwxiOUSj8bH b3eI74otaXkAC21liKLOwpOnKqQcKdIibcBYz/RG48SzER0uEMzMmkptblR9eo5NleAS 9PsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=aWf0VyGdU6xX/1rwEHWE7FkuJOfvDGRuOklUJqK38JI=; b=SIATuEqm5nyELls937ylmv8DjOjsBIG22A1iSBRmRaP6GHQW+rqGChjbslzSanpN8S zdmh8+1bcHa1Zbm+ZrS3Hbq7s1BOiZsTcB8ogzEvLccwVvewqXGR7sO9AFJaEZjfnq84 QGaAzytkXeXtdMIUZNKQK/kiKoOYjvAUtNVqTWqfV5vqfe7r6WqE2aG6Sar3g66QMgQ/ MFy6PvxPhnZadRgZmZXunlZ+FEQmJyZ3vUsvOHF8/k2MdwcBxByPc7FdGx+iGj2b9sYA f6U7gzs83CSwwkpGCc6h3BjlTzBSz4jME+hEzcDrhuNN9D6MKSBL+881GF3c1Armukz1 gkew== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=ebJK59et; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w21si7298371wra.150.2017.06.20.15.51.33; Tue, 20 Jun 2017 15:51:33 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=ebJK59et; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E4E9368A377; Wed, 21 Jun 2017 01:50:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt0-f193.google.com (mail-qt0-f193.google.com [209.85.216.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 85EBE68A2B6 for ; Wed, 21 Jun 2017 01:50:40 +0300 (EEST) Received: by mail-qt0-f193.google.com with SMTP id s33so25132541qtg.3 for ; Tue, 20 Jun 2017 15:50:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=3w9bM79wLGD2vt4KZx1QKSmq+t0WutDWY2Pg1NB3NGE=; b=ebJK59etX4N3Y7MEysEjWOFDv4wOLXLwSccd5UIxVGYv80YmNFDTmw/Qx7iPjCbqKp 6uODRy+8GwDl1V2znwH0Bk41yJXRv6JTIBaOPwgCYLLNwFhKX25DcRz4qWIz5oJ0Ny7V y6C6WSaLP8JPd7tcHkXZTpbLgakai5XWK0bPCo8mEJebsz/RH/Thpx0g3Ci88Ud8ZDl0 PtEWd5bIcC4pNgJ0RcYgqBh1NahdyFqhoHmH+UrWwtyZj79KQE+ZsOiOLDnUv4ChKSFQ MOI8m6FINMC0VnfA5EfdhY8Ucla0x6gexrfP6mLLBEQ8mYXp5O1woFR1v1vb0N7gxBVk TU4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=3w9bM79wLGD2vt4KZx1QKSmq+t0WutDWY2Pg1NB3NGE=; b=V84YHlxVYX3jgAfscrCWQkw20hS1rn1Psyrgg8tNPCqMZ9RxranQJktngPQMuxgeX8 fdIWdjTcgaAPCdVfbwju8WvTjGD4M6OU4ZFsu/jS8do2T+3fUS9mcorMT30JJKlc4/Tq Szmin38oXVH8MCshjzvA+wyGG1F+/wbu2kMBIIPJ4Kodb1kUDi7qMcia642ENbSHiGT4 QI0FVEbQXdv9YV2wHP8efBG8aCLFQiZQdwJw18K9BIbcCzUvEBgWUpyWSGc8K3eN5MKU 0mbo+Va+jXBZH/aPM5cxcnbzQe33hE9wqhpaUh80lG+BXlW46/KmTXPvYmWwePzO5HD9 EKpg== X-Gm-Message-State: AKS2vOxpWWlrugzsbHChoT1xG18oGyb9vIzO/Ogkt8ojXE/zTxzqpiWA WY6iJDkylFkXY9kD X-Received: by 10.237.41.7 with SMTP id s7mr38224381qtd.178.1497999044896; Tue, 20 Jun 2017 15:50:44 -0700 (PDT) Received: from localhost.localdomain ([181.231.116.134]) by smtp.gmail.com with ESMTPSA id o3sm9880465qtb.57.2017.06.20.15.50.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 15:50:44 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Tue, 20 Jun 2017 19:49:59 -0300 Message-Id: <20170620224959.2008-6-jamrial@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170620224959.2008-1-jamrial@gmail.com> References: <20170620224959.2008-1-jamrial@gmail.com> Subject: [FFmpeg-devel] [PATCH 5/5] build: Prefer NASM assembler over YASM X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Diego Biurrun 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 57b753b445e23363c997a8ec1c556e0b0f6e9da3) Signed-off-by: James Almer --- .travis.yml | 4 ++-- Changelog | 2 ++ configure | 6 +++--- doc/optimization.txt | 8 ++++---- doc/platform.texi | 8 ++++---- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index e541ee1608..40f01f94c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ os: addons: apt: packages: - - yasm + - nasm - diffutils compiler: - clang @@ -17,7 +17,7 @@ cache: before_install: - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update --all; fi install: - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install yasm; fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install nasm; fi script: - mkdir -p ffmpeg-samples - ./configure --samples=ffmpeg-samples --cc=$CC diff --git a/Changelog b/Changelog index a893efa4f0..4f46edaddb 100644 --- a/Changelog +++ b/Changelog @@ -22,6 +22,8 @@ version : - headphone audio filter - superequalizer audio filter - roberts video filter +- The x86 assembler default switched from yasm to nasm, pass + --x86asmexe=yasm to configure to restore the old behavior. version 3.3: - CrystalHD decoder moved to new decode API diff --git a/configure b/configure index a1957b2843..f4ba6405ff 100755 --- a/configure +++ b/configure @@ -3258,7 +3258,7 @@ pkg_config_default=pkg-config ranlib_default="ranlib" strip_default="strip" version_script='--version-script' -x86asmexe_default="yasm" +x86asmexe_default="nasm" windres_default="windres" nvcc_default="nvcc" nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2" @@ -5505,7 +5505,7 @@ EOF } if ! disabled_any asm mmx x86asm; then - for program in $x86asmexe yasm nasm; do + for program in $x86asmexe nasm yasm; do probe_x86asm $program test -n "$x86asm_type" && break done @@ -5517,7 +5517,7 @@ EOF esac check_x86asm "movbe ecx, [5]" && enable x86asm || - die "yasm/nasm not found or too old. Use --disable-x86asm for a crippled build." + die "nasm/yasm not found or too old. Use --disable-x86asm for a crippled build." check_x86asm "vextracti128 xmm0, ymm0, 0" || disable avx2_external check_x86asm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external check_x86asm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external diff --git a/doc/optimization.txt b/doc/optimization.txt index c39e1e37b9..974e2f9af2 100644 --- a/doc/optimization.txt +++ b/doc/optimization.txt @@ -161,8 +161,8 @@ do{ For x86, mark registers that are clobbered in your asm. This means both general x86 registers (e.g. eax) as well as XMM registers. This last one is particularly important on Win64, where xmm6-15 are callee-save, and not -restoring their contents leads to undefined results. In external asm (e.g. -yasm), you do this by using: +restoring their contents leads to undefined results. In external asm, +you do this by using: cglobal function_name, num_args, num_regs, num_xmm_regs In inline asm, you specify clobbered registers at the end of your asm: __asm__(".." ::: "%eax"). @@ -199,12 +199,12 @@ actual lines causing issues. Inline asm vs. external asm --------------------------- Both inline asm (__asm__("..") in a .c file, handled by a compiler such as gcc) -and external asm (.s or .asm files, handled by an assembler such as yasm/nasm) +and external asm (.s or .asm files, handled by an assembler such as nasm/yasm) are accepted in FFmpeg. Which one to use differs per specific case. - if your code is intended to be inlined in a C function, inline asm is always better, because external asm cannot be inlined -- if your code calls external functions, yasm is always better +- if your code calls external functions, external asm is always better - if your code takes huge and complex structs as function arguments (e.g. MpegEncContext; note that this is not ideal and is discouraged if there are alternatives), then inline asm is always better, because predicting diff --git a/doc/platform.texi b/doc/platform.texi index 32d97cc58b..185bda5a07 100644 --- a/doc/platform.texi +++ b/doc/platform.texi @@ -71,9 +71,9 @@ Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from assembly functions. Put the Perl script somewhere in your PATH, FFmpeg's configure will pick it up automatically. -Mac OS X on amd64 and x86 requires @command{yasm} to build most of the +Mac OS X on amd64 and x86 requires @command{nasm} to build most of the optimized assembly functions. @uref{http://www.finkproject.org/, Fink}, -@uref{http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml, Gentoo Prefix}, +@uref{{https://wiki.gentoo.org/wiki/Project:Prefix, Gentoo Prefix}, @uref{https://mxcl.github.com/homebrew/, Homebrew} or @uref{http://www.macports.org, MacPorts} can easily provide it. @@ -141,7 +141,7 @@ them under @command{MinGW-w64 Win64 Shell} and @command{MinGW-w64 Win32 Shell}. pacman -S make pkgconf diffutils # mingw-w64 packages and toolchains -pacman -S mingw-w64-x86_64-yasm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL +pacman -S mingw-w64-x86_64-nasm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2 @end example 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: @item @uref{http://code.google.com/p/msinttypes/, msinttypes} (if using MSVC 2012 or earlier) @item @uref{http://msys2.github.io/, MSYS2} -@item @uref{http://yasm.tortall.net/, YASM} +@item @uref{http://www.nasm.us/, NASM} (Also available via MSYS2's package manager.) @end itemize