[FFmpeg-devel] [PATCH] split-radix FFT

Måns Rullgård mans
Wed Aug 6 00:51:20 CEST 2008


Loren Merritt <lorenm at u.washington.edu> writes:

> On Tue, 5 Aug 2008, M?ns Rullg?rd wrote:
>
>> Is "win32" a commonly used name for that object file format?
>
> It is also known as "win32/coff" (as opposed to other subtypes of coff)
>
>>> +        YASMFLAGS="-f ${objformat}64 -DARCH_X86_64"
>>
>> Is "macho64" a valid object format name?
>
> yes
>
>> I doubt "win3264" is...
>
> right, at which point check_yasm fails. but I can be more explicit.

Ramiro says FFmpeg builds and runs in mingw64.  I don't think we
should be changing that.

> From 2d070605e0c7027cc211cdd40386997bda1d9aa3 Mon Sep 17 00:00:00 2001
> From: Loren Merritt <pengvado at akuvian.org>
> Date: Sat, 2 Aug 2008 02:13:09 -0600
> Subject: [PATCH] yasm buildsystem
>
> ---
>  common.mak |    7 +++++++
>  configure  |   38 ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 45 insertions(+), 0 deletions(-)
>
> diff --git a/common.mak b/common.mak
> index 93176c5..cccd00b 100644
> --- a/common.mak
> +++ b/common.mak
> @@ -8,6 +8,7 @@ ifndef SUBDIR
>  vpath %.c $(SRC_DIR)
>  vpath %.h $(SRC_DIR)
>  vpath %.S $(SRC_DIR)
> +vpath %.asm $(SRC_DIR)
>
>  ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
>  BUILD_ROOT_REL = .
> @@ -96,6 +97,12 @@ $(SUBDIR)%-test.o: $(SUBDIR)%.c
>  $(SUBDIR)%-test.o: $(SUBDIR)%-test.c
>  	$(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
>
> +$(SUBDIR)i386/%.o: $(SUBDIR)i386/%.asm
> +	$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
> +
> +$(SUBDIR)i386/%.d: $(SUBDIR)i386/%.asm
> +	$(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$(@:%.d=%.o) $$< > $$@
> +

OK, assuming you tested it.

>  clean::
>  	rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
>  	    $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
> diff --git a/configure b/configure
> index 564ff03..a955592 100755
> --- a/configure
> +++ b/configure
> @@ -444,6 +444,14 @@ int foo(void){ asm volatile($asm); }
>  EOF
>  }
>
> +check_yasm(){
> +    log check_yasm "$@"
> +    echo "$1" > $TMPS
> +    log_file $TMPS
> +    shift 1
> +    check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
> +}
> +

OK

>  check_ld(){
>      log check_ld "$@"
>      check_cc || return
> @@ -778,6 +786,7 @@ HAVE_LIST="
>      termios_h
>      threads
>      winsock2_h
> +    yasm
>  "
>
>  CMDLINE_SELECT="
> @@ -829,6 +838,7 @@ mmx2_deps="x86 mmx"
>  neon_deps="armv4l"
>  ssse3_deps="x86"
>  vis_deps="sparc"
> +yasm_deps="x86 mmx"

What is the purpose of this?  Yasm is only used on x86, and it could
be used for non-mmx code.  (Side-note: should we separate mmx/sse/sse2?)
Either way, that line is in the wrong place; yasm is not a CPU feature.

>  # system headers and functions
>  byteswap_h_deps="!armv4l"
> @@ -927,12 +937,14 @@ shlibdir_default="$libdir_default"
>
>  # toolchain
>  cc="gcc"
> +yasmexe="yasm"
>  ar="ar"
>  nm="nm"
>  ranlib="ranlib"
>  strip="strip"
>  asmalign_pot="unknown"
>  ln_s="ln -sf"
> +objformat="elf"

OK

>  # machine
>  arch=`uname -m`
> @@ -1089,6 +1101,7 @@ echo "# $0 $@" > $logfile
>  set >> $logfile
>
>  cc="${cross_prefix}${cc}"
> +yasmexe="${cross_prefix}${yasmexe}"
>  ar="${cross_prefix}${ar}"
>  nm="${cross_prefix}${nm}"
>  ranlib="${cross_prefix}${ranlib}"
> @@ -1243,6 +1256,7 @@ case $target_os in
>          SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
>          SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
>          FFSERVERLDFLAGS=-Wl,-bind_at_load
> +        objformat="macho"
>          ;;
>      mingw32*)
>          target_os=mingw32
> @@ -1269,6 +1283,7 @@ case $target_os in
>              install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
>          SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
>          SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
> +        objformat="win32"
>          ;;
>      cygwin*)
>          target_os=cygwin
> @@ -1285,12 +1300,14 @@ case $target_os in
>          SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
>          SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
>          SHFLAGS='-shared -Wl,--enable-auto-image-base'
> +        objformat="win32"
>          ;;
>      *-dos|freedos|opendos)
>          disable ffplay ffserver vhook
>          disable $INDEV_LIST $OUTDEV_LIST
>          network_extralibs="-lsocket"
>          EXESUF=".exe"
> +        objformat="win32"
>          ;;
>      linux)
>          LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"

What is the correct value for objformat on win64?

> @@ -1534,6 +1551,25 @@ EOF
>      enabled mmx2  && check_asm mmx2  '"movss %xmm0, %xmm0"'
>
>      check_asm bswap '"bswap %%eax" ::: "%eax"'
> +
> +    enable yasm
> +    if enabled x86_64; then
> +        YASMFLAGS="-DARCH_X86_64"
> +        enabled shared && append YASMFLAGS "-DPIC"
> +        case "$objformat" in
> +            elf) objformat="elf64";;
> +            macho) objformat="macho64";;
> +            win32) disable yasm;;

As I said, we shouldn't break win64 (even if I don't care personally).

> +        esac
> +    else
> +        YASMFLAGS="-DARCH_X86_32"
> +    fi
> +    append YASMFLAGS "-f $objformat"

Hmm, maybe YASMFLAGS="-DARCH_$(toupper $arch) -f $objformat"

> +    case "$objformat" in
> +        elf*) enabled debug && append YASMFLAGS "-g dwarf2";;
> +        *) append YASMFLAGS "-DPREFIX";;
> +    esac

This looks a bit odd (totally unrelated flags being set), but I guess
it's OK.

> +    check_yasm "pabsw xmm0, xmm0" || disable yasm

Come to think of it, isn't enough to check_cmd yasm --version?  Either
it's there, or it's not.

>  fi
>
>  # check for assembler specific support
> @@ -2028,6 +2064,7 @@ echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
>  echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
>  echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
>  echo "CC=$cc" >> config.mak
> +echo "YASM=$yasmexe" >> config.mak
>  echo "AR=$ar" >> config.mak
>  echo "RANLIB=$ranlib" >> config.mak
>  echo "LN_S=$ln_s" >> config.mak
> @@ -2040,6 +2077,7 @@ echo "VHOOKCFLAGS=$VHOOKCFLAGS" >> config.mak
>  echo "LDFLAGS=$LDFLAGS" >> config.mak
>  echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
>  echo "SHFLAGS=$SHFLAGS" >> config.mak
> +echo "YASMFLAGS=$YASMFLAGS" >> config.mak
>  echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
>  echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
>  echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak

OK

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list