transcode-1.0.0beta2/autotools/compile100555 001750 000000 00000007072 10203520431 0013476#! /bin/sh # Wrapper for compilers which do not understand `-c -o'. scriptversion=2003-11-09.00 # Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand `-c -o'. Remove `-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF exit 0 ;; -v | --v*) echo "compile $scriptversion" exit 0 ;; esac prog=$1 shift ofile= cfile= args= while test $# -gt 0; do case "$1" in -o) # configure might choose to run compile as `compile cc -o foo foo.c'. # So we do something ugly here. ofile=$2 shift case "$ofile" in *.o | *.obj) ;; *) args="$args -o $ofile" ofile= ;; esac ;; *.c) cfile=$1 args="$args $1" ;; *) args="$args $1" ;; esac shift done if test -z "$ofile" || test -z "$cfile"; then # If no `-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. exec "$prog" $args fi # Name of file we expect compiler to create. cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` # Create the lock directory. # Note: use `[/.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d while true; do if mkdir $lockdir > /dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir $lockdir; exit 1" 1 2 15 # Run the compile. "$prog" $args status=$? if test -f "$cofile"; then mv "$cofile" "$ofile" fi rmdir $lockdir exit $status # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: transcode-1.0.0beta2/autotools/config.guess100555 001750 000000 00000125020 10203520422 0014432#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2004-03-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amd64:OpenBSD:*:*) echo x86_64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; cats:OpenBSD:*:*) echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pegasos:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit 0 ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha*:OpenVMS:*:*) echo alpha-hp-vms exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; *:OS400:*:*) echo powerpc-ibm-os400 exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit 0 ;; DRS?6000:UNIX_SV:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then # avoid double evaluation of $set_cc_for_build test -n "$CC_FOR_BUILD" || eval $set_cc_for_build if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) # Determine whether the default compiler uses glibc. eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #if __GLIBC__ >= 2 LIBC=gnu #else LIBC= #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` # GNU/KFreeBSD systems have a "k" prefix to indicate we are using # FreeBSD's kernel, but not the complete OS. case ${LIBC} in gnu) kernel_only='k' ;; esac echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:[34]*) echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit 0 ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) case `uname -p` in *86) UNAME_PROCESSOR=i686 ;; powerpc) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: transcode-1.0.0beta2/autotools/config.sub100555 001750 000000 00000074604 10203520422 0014110#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2004-02-23' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32r | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | msp430-* \ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nv1) basic_machine=nv1-cray os=-unicosmp ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: transcode-1.0.0beta2/autotools/depcomp100555 001750 000000 00000034771 10203520435 0013507#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2003-11-08.23 # Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit 0 ;; -v | --v*) echo "depcomp $scriptversion" exit 0 ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. if test -z "$depfile"; then base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` dir=`echo "$object" | sed 's,/.*$,/,'` if test "$dir" = "$object"; then dir= fi # FIXME: should be _deps on DOS. depfile="$dir.deps/$base" fi tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1="$dir.libs/$base.lo.d" tmpdepfile2="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: transcode-1.0.0beta2/autotools/install-sh100555 001750 000000 00000021770 10203520407 0014130#!/bin/sh # install - install a program, script, or datafile scriptversion=2004-02-15.20 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename= transform_arg= instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= usage="Usage: $0 [OPTION]... SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 -d DIRECTORIES... In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. In the second, create the directory path DIR. Options: -b=TRANSFORMBASENAME -c copy source (using $cpprog) instead of moving (using $mvprog). -d create directories instead of installing files. -g GROUP $chgrp installed files to GROUP. -m MODE $chmod installed files to MODE. -o USER $chown installed files to USER. -s strip installed files (using $stripprog). -t=TRANSFORM --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; -c) instcmd=$cpprog shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit 0;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; --version) echo "$0 $scriptversion"; exit 0;; *) # When -d is used, all remaining arguments are directories to create. test -n "$dir_arg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then instcmd=: chmodcmd= else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" || lasterr=$? # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $instcmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else # If we're going to rename the final executable, determine the name now. if test -z "$transformarg"; then dstfile=`basename "$dst"` else dstfile=`basename "$dst" $transformbasename \ | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename. test -z "$dstfile" && dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 # Move or copy the file name to the temp name $doit $instcmd "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now remove or move aside any old file at destination location. We # try this two ways since rm can't unlink itself on some systems and # the destination file might be busy for other reasons. In this case, # the final cleanup might fail but the new file should still install # successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" fi || { (exit 1); exit; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: transcode-1.0.0beta2/autotools/ltmain.sh100644 001750 000000 00000543626 10203520366 0013763# ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. basename="s,^.*/,,g" # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool VERSION=1.5.10 TIMESTAMP=" (1.1220.2.131 2004/09/19 12:46:56)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else # Restart under the correct shell, and then maybe $echo will work. exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE fi # Global variables. mode=$default_mode nonopt= prev= prevopt= run= show="$echo" show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" ##################################### # Shell function definitions: # This seems to be the best place for them # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then win32_libid_type="x86 archive import" else win32_libid_type="x86 archive static" fi fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $echo $win32_libid_type } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac CC_quoted="$CC_quoted $arg" done case "$@ " in " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then $echo "$modename: unable to infer tagged configuration" $echo "$modename: specify a tag with \`--tag'" 1>&2 exit $EXIT_FAILURE # else # $echo "$modename: using $tagname tagged configuration" fi ;; esac fi } # func_extract_archives gentop oldlib ... func_extract_archives () { my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" my_status="" $show "${rm}r $my_gentop" $run ${rm}r "$my_gentop" $show "$mkdir $my_gentop" $run $mkdir "$my_gentop" my_status=$? if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then exit $my_status fi for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` my_xdir="$my_gentop/$my_xlib" $show "${rm}r $my_xdir" $run ${rm}r "$my_xdir" $show "$mkdir $my_xdir" $run $mkdir "$my_xdir" status=$? if test "$status" -ne 0 && test ! -d "$my_xdir"; then exit $status fi case $host in *-darwin*) $show "Extracting $my_xabs" # Do not bother doing anything if just a dry run if test -z "$run"; then darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename $darwin_archive` darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` if test -n "$darwin_arches"; then darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= $show "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" # Remove the table of contents from the thin files. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" $AR -xo "${darwin_base_archive}" rm "${darwin_base_archive}" cd "$darwin_curdir" done # $darwin_arches ## Okay now we have a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` lipo -create -output "$darwin_file" $darwin_files done # $darwin_filelist rm -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir (cd $my_xdir && $AR x $my_xabs) || exit $? fi # $darwin_arches fi # $run ;; *) # We will extract separately just the conflicting names and we will # no longer touch any unique names. It is faster to leave these # extract automatically by $AR in one run. $show "(cd $my_xdir && $AR x $my_xabs)" $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 $AR t "$my_xabs" | sort | uniq -cd | while read -r count name do i=1 while test "$i" -le "$count" do # Put our $i before any first dot (extension) # Never overwrite any file name_to="$name" while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" do name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` done $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? i=`expr $i + 1` done done fi ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # End of Shell function definitions ##################################### # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Parse our command line options once, thoroughly. while test "$#" -gt 0 do arg="$1" shift case $arg in -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; tag) tagname="$arg" preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 exit $EXIT_FAILURE ;; esac case $tagname in CC) # Don't test for the "default" C tag, as we know, it's there, but # not specially marked. ;; *) if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi ;; esac ;; *) eval "$prev=\$arg" ;; esac prev= prevopt= continue fi # Have we seen a non-optional argument yet? case $arg in --help) show_help=yes ;; --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo $echo "Copyright (C) 2003 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit $EXIT_SUCCESS ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done exit $EXIT_SUCCESS ;; --debug) $echo "$progname: enabling shell trace mode" set -x preserve_args="$preserve_args $arg" ;; --dry-run | -n) run=: ;; --features) $echo "host: $host" if test "$build_libtool_libs" = yes; then $echo "enable shared libraries" else $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then $echo "enable static libraries" else $echo "disable static libraries" fi exit $EXIT_SUCCESS ;; --finish) mode="finish" ;; --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; --preserve-dup-deps) duplicate_deps="yes" ;; --quiet | --silent) show=: preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag ;; --tag=*) set tag "$optarg" ${1+"$@"} shift prev=tag preserve_args="$preserve_args --tag" ;; -dlopen) prevopt="-dlopen" prev=execute_dlfiles ;; -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *) nonopt="$arg" break ;; esac done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do case $arg in -c) mode=compile break ;; esac done ;; *db | *dbx | *strace | *truss) mode=execute ;; *install*|cp|mv) mode=install ;; *rm) mode=uninstall ;; *) # If we have no mode, but dlfiles were specified, then do execute mode. test -n "$execute_dlfiles" && mode=execute # Just use the default operation mode. if test -z "$mode"; then if test -n "$nonopt"; then $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 else $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 fi fi ;; esac fi # Only execute mode is allowed to have -dlopen flags. if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$modename --help --mode=$mode' for more information." # These modes are in order of execution frequency so that they run quickly. case $mode in # libtool compile mode compile) modename="$modename: compile" # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= for arg do case "$arg_mode" in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 exit $EXIT_FAILURE fi arg_mode=target continue ;; -static | -prefer-pic | -prefer-non-pic) later="$later $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac lastarg="$lastarg $arg" done IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` # Add the arguments to base_compile. base_compile="$base_compile $lastarg" continue ;; * ) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac base_compile="$base_compile $lastarg" done # for arg case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit $EXIT_FAILURE ;; *) # Get the name of the library object. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; *.ads) xform=ads ;; *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; *.ii) xform=ii ;; *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` case $libobj in *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 exit $EXIT_FAILURE ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -static) build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then xdir= else xdir=$xdir/ fi lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2*) pic_mode=default ;; esac if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi $run $rm "$libobj" "${libobj}T" # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then $show "$mv $output_obj $lobj" if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the PIC object to the libtool object file. test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else error=$? $run $rm $removelist exit $error fi fi # Append the name of the non-PIC object the libtool object file. # Only append if the libtool object file exists. test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi else if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi fi build_libtool_libs=no build_old_libs=yes prefer_static_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; esac libtool_args="$libtool_args $qarg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) compile_command="$compile_command @OUTPUT@" finalize_command="$finalize_command @OUTPUT@" ;; esac case $prev in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" finalize_command="$finalize_command @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" else dlprefiles="$dlprefiles $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" exit $EXIT_FAILURE fi prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat $save_arg` do # moreargs="$moreargs $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi done else $echo "$modename: link input file \`$save_arg' does not exist" exit $EXIT_FAILURE fi arg=$save_arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) rpath="$rpath $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) xrpath="$xrpath $arg" ;; esac fi prev= continue ;; xcompiler) compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; xlinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $wl$qarg" prev= compile_command="$compile_command $wl$qarg" finalize_command="$finalize_command $wl$qarg" continue ;; xcclinker) linker_flags="$linker_flags $qarg" compiler_flags="$compiler_flags $qarg" prev= compile_command="$compile_command $qarg" finalize_command="$finalize_command $qarg" continue ;; shrext) shrext_cmds="$arg" prev= continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg="$arg" case $arg in -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 continue ;; -avoid-version) avoid_version=yes continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; esac continue ;; -L*) dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 exit $EXIT_FAILURE fi dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "*) ;; *) deplibs="$deplibs -L$dir" lib_search_path="$lib_search_path $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$dir:"*) ;; *) dllsearchpath="$dllsearchpath:$dir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-pw32* | *-*-beos*) # These systems don't actually have a C or math library (as such) continue ;; *-*-mingw* | *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework deplibs="$deplibs -framework System" continue esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi deplibs="$deplibs $arg" continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) deplibs="$deplibs $arg" continue ;; -module) module=yes continue ;; # gcc -m* arguments should be passed to the linker via $compiler_flags # in order to pass architecture information to the linker # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo # but this is not reliable with gcc because gcc may use -mfoo to # select a different linker, different libraries, etc, while # -Wl,-mfoo simply passes -mfoo to the linker. -m*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" if test "$with_gcc" = "yes" ; then compiler_flags="$compiler_flags $arg" fi continue ;; -shrext) prev=shrext continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) # The PATH hackery in wrapper scripts is required on Windows # in order for the loader to find any dlls it needs. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 exit $EXIT_FAILURE ;; esac case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac continue ;; -static) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac arg="$arg $wl$flag" compiler_flags="$compiler_flags $wl$flag" linker_flags="$linker_flags $flag" done IFS="$save_ifs" arg=`$echo "X$arg" | $Xsed -e "s/^ //"` ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; *.$objext) # A standard object. objs="$objs $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then pic_object= non_pic_object= # Read the .lo file # If there is no directory component, then add one. case $arg in */* | *\\*) . $arg ;; *) . ./$arg ;; esac if test -z "$pic_object" || \ test -z "$non_pic_object" || test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 exit $EXIT_FAILURE fi # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then dlfiles="$dlfiles $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. dlprefiles="$dlprefiles $pic_object" prev= fi # A PIC object. libobjs="$libobjs $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object non_pic_objects="$non_pic_objects $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi fi else # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 exit $EXIT_FAILURE else # Dry-run case. # Extract subdirectory from the argument. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$arg"; then xdir= else xdir="$xdir/" fi pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` libobjs="$libobjs $pic_object" non_pic_objects="$non_pic_objects $non_pic_object" fi fi ;; *.$libext) # An archive. deplibs="$deplibs $arg" old_deplibs="$old_deplibs $arg" continue ;; *.la) # A libtool-controlled library. if test "$prev" = dlfiles; then # This library was specified with -dlopen. dlfiles="$dlfiles $arg" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. dlprefiles="$dlprefiles $arg" prev= else deplibs="$deplibs $arg" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi done # argument parsing loop if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" else output_objdir="$output_objdir/$objdir" fi # Create the object directory. if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi # Determine the type of output case $output in "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac case $host in *cygwin* | *mingw* | *pw32*) # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) duplicate_compiler_generated_deps=$duplicate_deps ;; esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if test "X$duplicate_deps" = "Xyes" ; then case "$libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi libs="$libs $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; esac pre_post_deps="$pre_post_deps $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 exit $EXIT_FAILURE ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then library_names= old_library= case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) xrpath="$xrpath $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) lib="$deplib" ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` if eval $echo \"$deplib\" 2>/dev/null \ | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because the file extensions .$libext of this argument makes me believe" $echo "*** that it is just a static archive that I should not used here." else $echo $echo "*** Warning: Linking the shared library $output against the" $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else newdlfiles="$newdlfiles $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` test "X$ladir" = "X$lib" && ladir="." dlname= dlopen= dlpreopen= libdir= library_names= old_library= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no # Read the .la file case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" old_convenience="$old_convenience $ladir/$objdir/$old_library" elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit $EXIT_FAILURE fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= for l in $old_library $library_names; do linklib="$l" done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 abs_ladir="$ladir" fi ;; esac laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then $echo "$modename: warning: library \`$lib' was moved." 1>&2 dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$libdir" absdir="$libdir" fi else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later notinst_path="$notinst_path $abs_ladir" fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then newdlprefiles="$newdlprefiles $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then newdlprefiles="$newdlprefiles $dir/$dlname" else newdlprefiles="$newdlprefiles $dir/$linklib" fi fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; *" $absdir "*) ;; *) temp_rpath="$temp_rpath $dir" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi # This is a shared library # Warn about portability, can't link against -module's on # some systems (darwin) if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi $echo "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names realname="$2" shift; shift libname=`eval \\$echo \"$libname_spec\"` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" soname=`$echo $soroot | ${SED} -e 's/^.*\///'` newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a module then we can not link against # it, someone is ignoring the new warnings I added if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo $echo "** And there doesn't seem to be a static archive available" $echo "** The link will probably fail, sorry" else add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && \ test "$hardcode_minus_L" != yes && \ test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test -f $libdir/$linklib; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. $echo $echo "*** Warning: This system can not link to static lib archive $lib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then $echo "*** But as you try to build a module library, libtool will still create " $echo "*** a static module, that should work as long as the dlopening application" $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` case " $xrpath " in *" $temp_xrpath "*) ;; *) xrpath="$xrpath $temp_xrpath";; esac;; *) temp_deplibs="$temp_deplibs $libdir";; esac done dependency_libs="$temp_deplibs" fi newlib_search_path="$newlib_search_path $absdir" # Link against this library test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" if test "X$duplicate_deps" = "Xyes" ; then case "$tmp_libs " in *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; esac fi tmp_libs="$tmp_libs $deplib" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in -L*) path="$deplib" ;; *.la) dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$deplib" && dir="." # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 absdir="$dir" fi ;; esac if grep "^installed=no" $deplib > /dev/null; then path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi path="$absdir" fi depdepl= case $host in *-*-darwin*) # we do not want to link against static libs, # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; *) newlib_search_path="$newlib_search_path $path";; esac fi path="" ;; *) path="-L$path" ;; esac ;; -l*) case $host in *-*-darwin*) # Again, we only want to link against shared libraries eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` for tmp in $newlib_search_path ; do if test -f "$tmp/lib$tmp_libs.dylib" ; then eval depdepl="$tmp/lib$tmp_libs.dylib" break fi done path="" ;; *) continue ;; esac ;; *) continue ;; esac case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) lib_search_path="$lib_search_path $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) tmp_libs="$tmp_libs $deplib" ;; esac ;; *) tmp_libs="$tmp_libs $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then tmp_libs="$tmp_libs $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" objs="$objs$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi if test "$dlself" != no; then $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 fi set dummy $rpath if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 fi else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$2" number_minor="$3" number_revision="$4" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in darwin|linux|osf|windows) current=`expr $number_major + $number_minor` age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) current=`expr $number_major + $number_minor - 1` age="$number_minor" revision="$number_minor" ;; esac ;; no) current="$2" revision="$3" age="$4" ;; esac # Check that each of the things are valid numbers. case $current in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $revision in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac case $age in 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header major=.`expr $current - $age` versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current"; ;; irix | nonstopux) major=`expr $current - $age + 1` case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) major=.`expr $current - $age` versuffix="$major.$age.$revision" ;; osf) major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" done # Make executables depend on our current version. verstring="$verstring:${current}.0" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. major=`expr $current - $age` versuffix="-$major" ;; *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi if test "$mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$echo "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi removelist="$removelist $p" ;; *) ;; esac done if test -n "$removelist"; then $show "${rm}r $removelist" $run ${rm}r $removelist fi fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then oldlibs="$oldlibs $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi # Eliminate all temporary directories. for path in $notinst_path; do lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do temp_xrpath="$temp_xrpath -R$libdir" case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) dlfiles="$dlfiles $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) dlprefiles="$dlprefiles $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework deplibs="$deplibs -framework System" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $rm conftest.c cat > conftest.c </dev/null` for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for file magic test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a file magic. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) newdeplibs="$newdeplibs $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval \\$echo \"$libname_spec\"` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval $echo \"$potent_lib\" 2>/dev/null \ | ${SED} 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes $echo $echo "*** Warning: linker path does not have real file for library $a_deplib." $echo "*** I have the capability to make that library automatically link in when" $echo "*** you link to this library. But I can only do this if you have a" $echo "*** shared version of the library, which you do not appear to have" $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else $echo "*** with $libname and none of the candidates passed a file format test" $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else # Add a -L argument. newdeplibs="$newdeplibs $a_deplib" fi done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` done fi if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | grep . >/dev/null; then $echo if test "X$deplibs_check_method" = "Xnone"; then $echo "*** Warning: inter-library dependencies are not supported in this platform." else $echo "*** Warning: inter-library dependencies are not known to be supported." fi $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac if test "$droppeddeps" = yes; then if test "$module" = yes; then $echo $echo "*** Warning: libtool could not satisfy all declared inter-library" $echo "*** dependencies of module $libname. Therefore, libtool will create" $echo "*** a static module, that should work as long as the dlopening" $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then $echo $echo "*** However, this would only work if libtool was able to extract symbol" $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" $echo "*** not find such a program. So, this module is probably useless." $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else $echo "*** The inter-library dependencies that have been dropped here will be" $echo "*** automatically added whenever a program is linked with this library" $echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then $echo $echo "*** Since this library must not contain undefined symbols," $echo "*** because either the platform does not support them or" $echo "*** it was explicitly requested with -no-undefined," $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" dep_rpath="$dep_rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" if test -n "$hardcode_libdir_flag_spec_ld"; then eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" else eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath="$finalize_shlibpath" test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" shift; shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" for link do linknames="$linknames $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" $run eval "$cmd" || exit $? skipped_export=false else # The command line is too long to execute in one step. $show "using reloadable object file for export list..." skipped_export=: fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $convenience libobjs="$libobjs $func_extract_archives_result" fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" fi # Make a backup of the uninstalled library when relinking if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise. $echo "creating reloadable object files..." # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= delfiles= last_robj= k=1 output=$output_objdir/$save_output-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do eval test_cmds=\"$reload_cmds $objlist $last_robj\" if test "X$objlist" = X || { len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; }; then objlist="$objlist $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. eval concat_cmds=\"$reload_cmds $objlist $last_robj\" else # All subsequent reloadable object files will link in # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi last_robj=$output_objdir/$save_output-${k}.$objext k=`expr $k + 1` output=$output_objdir/$save_output-${k}.$objext objlist=$obj len=1 fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" if ${skipped_export-false}; then $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols libobjs=$output # Append the command to create the export file. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi # Set up a command to remove the reloadale object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? fi done # If -module or -export-dynamic was specified, set the dlname. if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi if test -n "$rpath"; then $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 fi if test -n "$xrpath"; then $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 fi if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 fi case $output in *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $run $rm $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" generated="$generated $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # Create the old-style object. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi if test -n "$gentop"; then $show "${rm}r $gentop" $run ${rm}r $gentop fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 fi if test -n "$release"; then $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 fi if test "$preload" = yes; then if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` ;; esac case $host in *darwin*) # Don't allow lazy linking, it breaks C++ global constructors if test "$tagname" = CXX ; then compile_command="$compile_command ${wl}-bind_at_load" finalize_command="$finalize_command ${wl}-bind_at_load" fi ;; esac compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) perm_rpath="$perm_rpath $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) case :$dllsearchpath: in *":$libdir:"*) ;; *) dllsearchpath="$dllsearchpath:$libdir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath="$rpath" rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" rpath="$rpath $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath="$rpath" if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 fi fi if test -n "$dlsyms"; then case $dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${outputname}.nm" $show "$rm $nlist ${nlist}S ${nlist}T" $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. $show "creating $output_objdir/$dlsyms" test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ #ifdef __cplusplus extern \"C\" { #endif /* Prevent the only kind of declaration conflicts we can make. */ #define lt_preloaded_symbols some_other_symbol /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then $show "generating symbol list for \`$output'" test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` for arg in $progfiles; do $show "extracting global C symbols from \`$arg'" $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done if test -z "$run"; then # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if grep -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ # define lt_ptr void * #else # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; lt_ptr address; } lt_preloaded_symbols[] = {\ " eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " fi pic_flag_for_symtable= case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 exit $EXIT_FAILURE ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" status=$? # Delete the generated files. if test -n "$dlsyms"; then $show "$rm $output_objdir/${outputname}S.${objext}" $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status fi if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= for dir in $temp_rpath; do case $dir in [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; *) # Relative path: add a thisdir entry. rpath="$rpath\$thisdir/$dir:" ;; esac done temp_rpath="$rpath" fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do rpath="$rpath$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do rpath="$rpath$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $run $rm $output # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi # Quote $echo for shipping. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then case $progpath in [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` fi # Only actually do things if our run command is non-null. if test -z "$run"; then # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource <> $cwrappersource<<"EOF" #include #include #include #include #include #include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef DIR_SEPARATOR #define DIR_SEPARATOR '/' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) #define HAVE_DOS_BASED_FILE_SYSTEM #ifndef DIR_SEPARATOR_2 #define DIR_SEPARATOR_2 '\\' #endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); char * fnqualify(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); int main (int argc, char *argv[]) { char **newargz; int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); newargz = XMALLOC(char *, argc+2); EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" newargz[1] = fnqualify(argv[0]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; EOF cat >> $cwrappersource <> $cwrappersource <<"EOF" } void * xmalloc (size_t num) { void * p = (void *) malloc (num); if (!p) lt_fatal ("Memory exhausted"); return p; } char * xstrdup (const char *string) { return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL ; } char * basename (const char *name) { const char *base; #if defined (HAVE_DOS_BASED_FILE_SYSTEM) /* Skip over the disk name in MSDOS pathnames. */ if (isalpha (name[0]) && name[1] == ':') name += 2; #endif for (base = name; *name; name++) if (IS_DIR_SEPARATOR (*name)) base = name + 1; return (char *) base; } char * fnqualify(const char *path) { size_t size; char *p; char tmp[LT_PATHMAX + 1]; assert(path != NULL); /* Is it qualified already? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha (path[0]) && path[1] == ':') return xstrdup (path); #endif if (IS_DIR_SEPARATOR (path[0])) return xstrdup (path); /* prepend the current directory */ /* doesn't handle '~' */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ p = XMALLOC(char, size); sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); return p; } char * strendzap(char *str, const char *pat) { size_t len, patlen; assert(str != NULL); assert(pat != NULL); len = strlen(str); patlen = strlen(pat); if (patlen <= len) { str += len - patlen; if (strcmp(str, pat) == 0) *str = '\0'; } return str; } static void lt_error_core (int exit_status, const char * mode, const char * message, va_list ap) { fprintf (stderr, "%s: %s: ", program_name, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, "FATAL", message, ap); va_end (ap); } EOF # we should really use a build-platform specific compiler # here, but OTOH, the wrappers (shell script and this C one) # are only useful if you want to execute the "real" binary. # Since the "real" binary is built for $host, then this # wrapper might as well be built for $host, too. $run $LTCC -s -o $cwrapper $cwrappersource ;; esac $rm $output trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variable: notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then echo=\"$qecho\" file=\"\$0\" # Make sure echo works. if test \"X\$1\" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then # Yippee, \$echo works! : else # Restart under the correct shell, and then maybe \$echo will work. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} fi fi\ " $echo >> $output "\ # Find the directory that this script lives in. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $mkdir \"\$progdir\" else $rm \"\$progdir/\$file\" fi" $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit $EXIT_FAILURE fi fi $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $rm \"\$progdir/\$program\"; $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } $rm \"\$progdir/\$file\" fi" else $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var " fi # fixup the dll searchpath if we need to. if test -n "$dllsearchpath"; then $echo >> $output "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ exec \$progdir\\\\\$program \${1+\"\$@\"} " ;; *) $echo >> $output "\ exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit $EXIT_FAILURE fi fi\ " chmod +x $output fi exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" generated="$generated $gentop" func_extract_archives $gentop $addlibs oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs # GNU ar 2.10+ was changed to match POSIX; thus no paths are # encoded into archives. This makes 'ar r' malfunction in # this piecewise linking case whenever conflicting object # names appear in distinct ar calls; check, warn and compensate. if (for obj in $save_oldobjs do $echo "X$obj" | $Xsed -e 's%^.*/%%' done | sort | sort -uc >/dev/null 2>&1); then : else $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 AR_FLAGS=cq fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done for obj in $save_oldobjs do oldobjs="$objlist $obj" objlist="$objlist $obj" eval test_cmds=\"$old_archive_cmds\" if len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$generated"; then $show "${rm}r$generated" $run ${rm}r$generated fi # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; *) newdependency_libs="$newdependency_libs $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlfiles="$newdlfiles $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac newdlprefiles="$newdlprefiles $abs" done dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi done fi # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac exit $EXIT_SUCCESS ;; # libtool install mode install) modename="$modename: install" # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$arg " arg="$1" shift else install_prog= arg="$nonopt" fi # The real first argument should be the name of the installation program. # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog$arg" # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= for arg do if test -n "$dest"; then files="$files $dest" dest="$arg" continue fi case $arg in -d) isdir=yes ;; -f) prev="-f" ;; -g) prev="-g" ;; -m) prev="-m" ;; -o) prev="-o" ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then prev= else dest="$arg" continue fi ;; esac # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac install_prog="$install_prog $arg" done if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi if test -z "$files"; then if test -z "$dest"; then $echo "$modename: no file or destination specified" 1>&2 else $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` test "X$destdir" = "X$dest" && destdir=. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` # Not a directory, so check to see that there is only one file specified. set dummy $files if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. staticlibs="$staticlibs $file" ;; *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi library_names= old_library= relink_command= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) current_libdirs="$current_libdirs $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) future_libdirs="$future_libdirs $libdir" ;; esac fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 exit $EXIT_FAILURE fi fi # See the names of the shared library. set dummy $library_names if test -n "$2"; then realname="$2" shift shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? if test -n "$stripme" && test -n "$striplib"; then $show "$striplib $destdir/$realname" $run eval "$striplib $destdir/$realname" || exit $? fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" fi done fi # Do each command in the postinstall commands. lib="$destdir/$realname" cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" fi # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? # Maybe install the static library, too. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` ;; *.$objext) staticdest="$destfile" destfile= ;; *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac # Install the libtool object if requested. if test -n "$destfile"; then $show "$install_prog $file $destfile" $run eval "$install_prog $file $destfile" || exit $? fi # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then file=`$echo $file|${SED} 's,.exe$,,'` stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit $EXIT_FAILURE fi finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then # If there is no directory component, then add one. case $lib in */* | *\\*) . $lib ;; *) . ./$lib ;; esac fi libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 finalize=no fi done relink_command= # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. case $build in *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; *) wrapperdot=${wrapper} ;; esac # If there is no directory component, then add one. case $file in */* | *\\*) . ${wrapperdot} ;; *) . ./${wrapperdot} ;; esac outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" tmpdir="$tmpdir/libtool-$$" save_umask=`umask` umask 0077 if $mkdir "$tmpdir"; then umask $save_umask else umask $save_umask $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 ${rm}r "$tmpdir" continue fi file="$outputname" else $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; esac $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done for file in $staticlibs; do name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` # Set up the ranlib parameters. oldlib="$destdir/$name" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" done if test -n "$future_libdirs"; then $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 fi if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi ;; # libtool finish mode finish) modename="$modename: finish" libdirs="$nonopt" admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir do libdirs="$libdirs $dir" done for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $run eval "$cmds" || admincmds="$admincmds $cmds" fi done fi # Exit here if they wanted silent mode. test "$show" = : && exit $EXIT_SUCCESS exit $EXIT_SUCCESS ;; # libtool execute mode execute) modename="$modename: execute" # The first argument is the command name. cmd="$nonopt" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. for file in $execute_dlfiles; do if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi # Read the libtool library. dlname= library_names= # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" continue fi dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. if test -f "$dir/$objdir/$dlname"; then dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 exit $EXIT_FAILURE fi ;; *.lo) # Just add the directory containing the .lo file. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` test "X$dir" = "X$file" && dir=. ;; *) $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= for file do case $file in -*) ;; *) # Do a test to see if this is really a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; *) . ./$file ;; esac # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` args="$args \"$file\"" done if test -z "$run"; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi if test "${save_LANG+set}" = set; then LANG="$save_LANG"; export LANG fi # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; # libtool clean and uninstall mode clean | uninstall) modename="$modename: $mode" rm="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) rm="$rm $arg"; rmforce=yes ;; -*) rm="$rm $arg" ;; *) files="$files $arg" ;; esac done if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE fi rmdirs= origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. objdir="$origobjdir" else objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif test "$rmforce" = yes; then continue fi rmfiles="$file" case $name in *.la) # Possibly a libtool archive, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done IFS="$save_ifs" fi # FIXME: should reinstall the best remaining shared library. fi fi ;; *.lo) # Possibly a libtool object, so verify it. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # Read the .lo file . $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" \ && test "$pic_object" != none; then rmfiles="$rmfiles $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" \ && test "$non_pic_object" != none; then rmfiles="$rmfiles $dir/$non_pic_object" fi fi ;; *) if test "$mode" = clean ; then noexename=$name case $file in *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, # add $file without .exe rmfiles="$rmfiles $file" ;; esac # Do a test to see if this is a libtool program. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$noexename # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then rmfiles="$rmfiles $objdir/lt-$name" fi if test "X$noexename" != "X$name" ; then rmfiles="$rmfiles $objdir/lt-${noexename}.c" fi fi fi ;; esac $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then $show "rmdir $dir" $run rmdir $dir >/dev/null 2>&1 fi done exit $exit_status ;; "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd exit $EXIT_FAILURE fi # We need to display help for each of the modes. case $mode in "") $echo \ "Usage: $modename [OPTION]... [MODE-ARG]... Provide generalized library-building support services. --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." exit $EXIT_SUCCESS ;; clean) $echo \ "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $echo \ "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -prefer-pic try to building PIC objects only -prefer-non-pic try to building non-PIC objects only -static always build a \`.o' file suitable for static linking COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix \`.c' with the library object suffix, \`.lo'." ;; execute) $echo \ "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $echo \ "Usage: $modename [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the \`--dry-run' option if you just want to see what would be executed." ;; install) $echo \ "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the \`install' or \`cp' program. The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $echo \ "Usage: $modename [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -static do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] All other options (arguments beginning with \`-') are ignored. Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created using \`ar' and \`ranlib', or on Windows using \`lib'. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: transcode-1.0.0beta2/autotools/missing100555 001750 000000 00000024666 10203520407 0013532#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2003-09-02.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: transcode-1.0.0beta2/filter/Makefile.am100644 001750 000000 00000017311 10172633255 0013425# # Process this file with automake to produce Makefile.in. AM_CPPFLAGS = \ $(PTHREAD_CFLAGS) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ $(AVILIB_CFLAGS) \ $(AVIFILE_CFLAGS) \ $(LAME_CFLAGS) \ $(AC3_CFLAGS) \ $(IMAGEMAGICK_CFLAGS) \ $(FT2_CFLAGS) pkgdir = $(MOD_PATH) if HAVE_MMX F_MMX = filter_dilyuvmmx.la else F_MMX= endif if HAVE_FREETYPE2 F_TEXT = filter_text.la endif if HAVE_IMAGEMAGICK F_LOGO = filter_logo.la filter_logoaway.la filter_compare.la endif if CAN_COMPILE_C_ALTIVEC if SYSTEM_DARWIN ALTIVEC = -faltivec else ALTIVEC = -maltivec -mabi=altivec endif endif if HAVE_GCC2 F_TOMSMOCOMP = else if ARCH_X86 if HAVE_MMX if HAVE_SSE if HAVE_3DNOW F_TOMSMOCOMP = tomsmocomp endif endif endif endif endif AM_CFLAGS = $(ALTIVEC) pkg_LTLIBRARIES = \ filter_29to23.la \ filter_32detect.la \ filter_32drop.la \ filter_aclip.la \ filter_ascii.la \ filter_astat.la \ filter_clone.la \ filter_control.la \ filter_cpaudio.la \ filter_cshift.la \ filter_cut.la \ filter_denoise3d.la \ filter_detectclipping.la \ filter_detectsilence.la \ filter_dnr.la \ filter_doublefps.la \ filter_facemask.la \ filter_fieldanalysis.la\ filter_fields.la \ filter_fps.la \ filter_hqdn3d.la \ filter_invert.la \ filter_levels.la \ filter_lowpass.la \ filter_mask.la \ filter_modfps.la \ filter_msharpen.la \ filter_nored.la \ filter_normalize.la \ filter_null.la \ filter_skip.la \ filter_slowmo.la \ filter_smartbob.la \ filter_smartdeinter.la \ filter_smartyuv.la \ filter_smooth.la \ filter_tc_audio.la \ filter_tc_video.la \ filter_testframe.la \ filter_unsharp.la \ filter_videocore.la \ filter_whitebalance.la \ filter_xsharpen.la \ filter_yuy2toyv12.la \ $(F_LOGO) \ $(F_MMX) \ $(F_TEXT) filter_29to23_la_SOURCES = filter_29to23.c filter_29to23_la_LDFLAGS = -module -avoid-version filter_32detect_la_SOURCES = filter_32detect.c filter_32detect_la_LDFLAGS = -module -avoid-version filter_32drop_la_SOURCES = filter_32drop.c filter_32drop_la_LDFLAGS = -module -avoid-version filter_aclip_la_SOURCES = filter_aclip.c filter_aclip_la_LDFLAGS = -module -avoid-version filter_ascii_la_SOURCES = filter_ascii.c ../export/vid_aux.c filter_ascii_la_LDFLAGS = -module -avoid-version filter_ascii_la_LIBADD = $(LIBVO_LIBS) filter_astat_la_SOURCES = filter_astat.c filter_astat_la_LDFLAGS = -module -avoid-version filter_clone_la_SOURCES = filter_clone.c filter_clone_la_LDFLAGS = -module -avoid-version filter_control_la_SOURCES = filter_control.c filter_control_la_LDFLAGS = -module -avoid-version filter_cpaudio_la_SOURCES = filter_cpaudio.c filter_cpaudio_la_LDFLAGS = -module -avoid-version filter_cshift_la_SOURCES = filter_cshift.c filter_cshift_la_LDFLAGS = -module -avoid-version filter_cut_la_SOURCES = filter_cut.c filter_cut_la_LDFLAGS = -module -avoid-version filter_denoise3d_la_SOURCES = filter_denoise3d.c filter_denoise3d_la_LDFLAGS = -module -avoid-version filter_detectclipping_la_SOURCES = filter_detectclipping.c filter_detectclipping_la_LDFLAGS = -module -avoid-version filter_detectsilence_la_SOURCES = filter_detectsilence.c filter_detectsilence_la_LDFLAGS = -module -avoid-version filter_dnr_la_SOURCES = filter_dnr.c filter_dnr_la_LDFLAGS = -module -avoid-version filter_dnr_la_LIBADD = -lm filter_doublefps_la_SOURCES = filter_doublefps.c filter_doublefps_la_LDFLAGS = -module -avoid-version filter_facemask_la_SOURCES = filter_facemask.c ../export/vid_aux.c filter_facemask_la_LDFLAGS = -module -avoid-version filter_facemask_la_LIBADD = $(LIBVO_LIBS) filter_fieldanalysis_la_SOURCES = filter_fieldanalysis.c filter_fieldanalysis_la_LDFLAGS = -module -avoid-version filter_fields_la_SOURCES = filter_fields.c filter_fields_la_LDFLAGS = -module -avoid-version filter_fps_la_SOURCES = filter_fps.c filter_fps_la_LDFLAGS = -module -avoid-version filter_hqdn3d_la_SOURCES = filter_hqdn3d.c filter_hqdn3d_la_LDFLAGS = -module -avoid-version filter_invert_la_SOURCES = filter_invert.c filter_invert_la_LDFLAGS = -module -avoid-version filter_levels_la_SOURCES = filter_levels.c filter_levels_la_LDFLAGS = -module -avoid-version filter_lowpass_la_SOURCES = filter_lowpass.c filter_lowpass_la_LDFLAGS = -module -avoid-version filter_mask_la_SOURCES = filter_mask.c filter_mask_la_LDFLAGS = -module -avoid-version filter_modfps_la_SOURCES = filter_modfps.c filter_modfps_la_LDFLAGS = -module -avoid-version filter_modfps_la_LIBADD = -lm filter_msharpen_la_SOURCES = filter_msharpen.c ../export/vid_aux.c filter_msharpen_la_LDFLAGS = -module -avoid-version filter_msharpen_la_LIBADD = $(LIBVO_LIBS) filter_nored_la_SOURCES = filter_nored.c filter_nored_la_LDFLAGS = -module -avoid-version filter_normalize_la_SOURCES = filter_normalize.c filter_normalize_la_LDFLAGS = -module -avoid-version filter_normalize_la_LIBADD = -lm filter_null_la_SOURCES = filter_null.c filter_null_la_LDFLAGS = -module -avoid-version filter_skip_la_SOURCES = filter_skip.c filter_skip_la_LDFLAGS = -module -avoid-version filter_slowmo_la_SOURCES = filter_slowmo.c filter_slowmo_la_LDFLAGS = -module -avoid-version filter_smartbob_la_SOURCES = filter_smartbob.c ../export/vid_aux.c filter_smartbob_la_LDFLAGS = -module -avoid-version filter_smartbob_la_LIBADD = $(LIBVO_LIBS) filter_smartdeinter_la_SOURCES = filter_smartdeinter.c ../export/vid_aux.c filter_smartdeinter_la_LDFLAGS = -module -avoid-version filter_smartdeinter_la_LIBADD = $(LIBVO_LIBS) filter_smartyuv_la_SOURCES = filter_smartyuv.c filter_smartyuv_la_LDFLAGS = -module -avoid-version filter_smooth_la_SOURCES = filter_smooth.c filter_smooth_la_LDFLAGS = -module -avoid-version filter_tc_audio_la_SOURCES = filter_tc_audio.c filter_tc_audio_la_LDFLAGS = -module -avoid-version filter_tc_video_la_SOURCES = filter_tc_video.c filter_tc_video_la_LDFLAGS = -module -avoid-version filter_testframe_la_SOURCES = filter_testframe.c filter_testframe_la_LDFLAGS = -module -avoid-version filter_unsharp_la_SOURCES = filter_unsharp.c filter_unsharp_la_LDFLAGS = -module -avoid-version filter_videocore_la_SOURCES = filter_videocore.c filter_videocore_la_LDFLAGS = -module -avoid-version filter_whitebalance_la_SOURCES = filter_whitebalance.c ../export/vid_aux.c filter_whitebalance_la_LDFLAGS = -module -avoid-version filter_whitebalance_la_LIBADD = $(LIBVO_LIBS) -lm filter_xsharpen_la_SOURCES = filter_xsharpen.c filter_xsharpen_la_LDFLAGS = -module -avoid-version filter_yuy2toyv12_la_SOURCES = filter_yuy2toyv12.c filter_yuy2toyv12_la_LDFLAGS = -module -avoid-version # F_LOGO = filter_logo.la filter_logoaway.la filter_compare.la filter_logo_la_SOURCES = filter_logo.c ../export/vid_aux.c filter_logo_la_LDFLAGS = -module -avoid-version filter_logo_la_LIBADD = $(IMAGEMAGICK_LIBS) $(LIBVO_LIBS) filter_logoaway_la_SOURCES = filter_logoaway.c filter_logoaway_la_LDFLAGS = -module -avoid-version filter_logoaway_la_LIBADD = $(IMAGEMAGICK_LIBS) filter_compare_la_SOURCES = filter_compare.c ../export/vid_aux.c filter_compare_la_LDFLAGS = -module -avoid-version filter_compare_la_LIBADD = $(IMAGEMAGICK_LIBS) $(LIBVO_LIBS) # F_MMX = filter_dilyuvmmx.la filter_dilyuvmmx_la_SOURCES = filter_dilyuvmmx.c deinterlace.c filter_dilyuvmmx_la_LDFLAGS = -module -avoid-version # F_TEXT = filter_text.la filter_text_la_SOURCES = filter_text.c filter_text_la_LDFLAGS = -module -avoid-version filter_text_la_LIBADD = $(FT2_LIBS) EXTRA_DIST = \ parse_csv.awk.in \ filter_list.awk.in \ mmx.h if HAVE_FREETYPE2 if HAVE_XAW_SIMPLE if HAVE_LIBXPM if HAVE_LIBICONV ADD2 = subtitler endif endif endif endif if HAVE_X11 SUBDIRS = \ pp \ divxkey \ extsub \ resample \ test \ yuvdenoise \ ivtc \ $(F_TOMSMOCOMP) \ preview \ $(ADD2) else SUBDIRS = \ pp \ divxkey \ extsub \ resample \ test \ yuvdenoise \ ivtc \ $(F_TOMSMOCOMP) endif pkg_SCRIPTS = \ filter_list.awk \ parse_csv.awk transcode-1.0.0beta2/filter/Makefile.in100644 001750 000000 00000176476 10203520425 0013445# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Process this file with automake to produce Makefile.in. SOURCES = $(filter_29to23_la_SOURCES) $(filter_32detect_la_SOURCES) $(filter_32drop_la_SOURCES) $(filter_aclip_la_SOURCES) $(filter_ascii_la_SOURCES) $(filter_astat_la_SOURCES) $(filter_clone_la_SOURCES) $(filter_compare_la_SOURCES) $(filter_control_la_SOURCES) $(filter_cpaudio_la_SOURCES) $(filter_cshift_la_SOURCES) $(filter_cut_la_SOURCES) $(filter_denoise3d_la_SOURCES) $(filter_detectclipping_la_SOURCES) $(filter_detectsilence_la_SOURCES) $(filter_dilyuvmmx_la_SOURCES) $(filter_dnr_la_SOURCES) $(filter_doublefps_la_SOURCES) $(filter_facemask_la_SOURCES) $(filter_fieldanalysis_la_SOURCES) $(filter_fields_la_SOURCES) $(filter_fps_la_SOURCES) $(filter_hqdn3d_la_SOURCES) $(filter_invert_la_SOURCES) $(filter_levels_la_SOURCES) $(filter_logo_la_SOURCES) $(filter_logoaway_la_SOURCES) $(filter_lowpass_la_SOURCES) $(filter_mask_la_SOURCES) $(filter_modfps_la_SOURCES) $(filter_msharpen_la_SOURCES) $(filter_nored_la_SOURCES) $(filter_normalize_la_SOURCES) $(filter_null_la_SOURCES) $(filter_skip_la_SOURCES) $(filter_slowmo_la_SOURCES) $(filter_smartbob_la_SOURCES) $(filter_smartdeinter_la_SOURCES) $(filter_smartyuv_la_SOURCES) $(filter_smooth_la_SOURCES) $(filter_tc_audio_la_SOURCES) $(filter_tc_video_la_SOURCES) $(filter_testframe_la_SOURCES) $(filter_text_la_SOURCES) $(filter_unsharp_la_SOURCES) $(filter_videocore_la_SOURCES) $(filter_whitebalance_la_SOURCES) $(filter_xsharpen_la_SOURCES) $(filter_yuy2toyv12_la_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = filter DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/filter_list.awk.in $(srcdir)/parse_csv.awk.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = parse_csv.awk filter_list.awk am__installdirs = "$(DESTDIR)$(pkgdir)" "$(DESTDIR)$(pkgdir)" pkgLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(pkg_LTLIBRARIES) filter_29to23_la_LIBADD = am_filter_29to23_la_OBJECTS = filter_29to23.lo filter_29to23_la_OBJECTS = $(am_filter_29to23_la_OBJECTS) filter_32detect_la_LIBADD = am_filter_32detect_la_OBJECTS = filter_32detect.lo filter_32detect_la_OBJECTS = $(am_filter_32detect_la_OBJECTS) filter_32drop_la_LIBADD = am_filter_32drop_la_OBJECTS = filter_32drop.lo filter_32drop_la_OBJECTS = $(am_filter_32drop_la_OBJECTS) filter_aclip_la_LIBADD = am_filter_aclip_la_OBJECTS = filter_aclip.lo filter_aclip_la_OBJECTS = $(am_filter_aclip_la_OBJECTS) am__DEPENDENCIES_1 = filter_ascii_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_filter_ascii_la_OBJECTS = filter_ascii.lo vid_aux.lo filter_ascii_la_OBJECTS = $(am_filter_ascii_la_OBJECTS) filter_astat_la_LIBADD = am_filter_astat_la_OBJECTS = filter_astat.lo filter_astat_la_OBJECTS = $(am_filter_astat_la_OBJECTS) filter_clone_la_LIBADD = am_filter_clone_la_OBJECTS = filter_clone.lo filter_clone_la_OBJECTS = $(am_filter_clone_la_OBJECTS) filter_compare_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_filter_compare_la_OBJECTS = filter_compare.lo vid_aux.lo filter_compare_la_OBJECTS = $(am_filter_compare_la_OBJECTS) filter_control_la_LIBADD = am_filter_control_la_OBJECTS = filter_control.lo filter_control_la_OBJECTS = $(am_filter_control_la_OBJECTS) filter_cpaudio_la_LIBADD = am_filter_cpaudio_la_OBJECTS = filter_cpaudio.lo filter_cpaudio_la_OBJECTS = $(am_filter_cpaudio_la_OBJECTS) filter_cshift_la_LIBADD = am_filter_cshift_la_OBJECTS = filter_cshift.lo filter_cshift_la_OBJECTS = $(am_filter_cshift_la_OBJECTS) filter_cut_la_LIBADD = am_filter_cut_la_OBJECTS = filter_cut.lo filter_cut_la_OBJECTS = $(am_filter_cut_la_OBJECTS) filter_denoise3d_la_LIBADD = am_filter_denoise3d_la_OBJECTS = filter_denoise3d.lo filter_denoise3d_la_OBJECTS = $(am_filter_denoise3d_la_OBJECTS) filter_detectclipping_la_LIBADD = am_filter_detectclipping_la_OBJECTS = filter_detectclipping.lo filter_detectclipping_la_OBJECTS = \ $(am_filter_detectclipping_la_OBJECTS) filter_detectsilence_la_LIBADD = am_filter_detectsilence_la_OBJECTS = filter_detectsilence.lo filter_detectsilence_la_OBJECTS = \ $(am_filter_detectsilence_la_OBJECTS) filter_dilyuvmmx_la_LIBADD = am_filter_dilyuvmmx_la_OBJECTS = filter_dilyuvmmx.lo deinterlace.lo filter_dilyuvmmx_la_OBJECTS = $(am_filter_dilyuvmmx_la_OBJECTS) filter_dnr_la_DEPENDENCIES = am_filter_dnr_la_OBJECTS = filter_dnr.lo filter_dnr_la_OBJECTS = $(am_filter_dnr_la_OBJECTS) filter_doublefps_la_LIBADD = am_filter_doublefps_la_OBJECTS = filter_doublefps.lo filter_doublefps_la_OBJECTS = $(am_filter_doublefps_la_OBJECTS) filter_facemask_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_filter_facemask_la_OBJECTS = filter_facemask.lo vid_aux.lo filter_facemask_la_OBJECTS = $(am_filter_facemask_la_OBJECTS) filter_fieldanalysis_la_LIBADD = am_filter_fieldanalysis_la_OBJECTS = filter_fieldanalysis.lo filter_fieldanalysis_la_OBJECTS = \ $(am_filter_fieldanalysis_la_OBJECTS) filter_fields_la_LIBADD = am_filter_fields_la_OBJECTS = filter_fields.lo filter_fields_la_OBJECTS = $(am_filter_fields_la_OBJECTS) filter_fps_la_LIBADD = am_filter_fps_la_OBJECTS = filter_fps.lo filter_fps_la_OBJECTS = $(am_filter_fps_la_OBJECTS) filter_hqdn3d_la_LIBADD = am_filter_hqdn3d_la_OBJECTS = filter_hqdn3d.lo filter_hqdn3d_la_OBJECTS = $(am_filter_hqdn3d_la_OBJECTS) filter_invert_la_LIBADD = am_filter_invert_la_OBJECTS = filter_invert.lo filter_invert_la_OBJECTS = $(am_filter_invert_la_OBJECTS) filter_levels_la_LIBADD = am_filter_levels_la_OBJECTS = filter_levels.lo filter_levels_la_OBJECTS = $(am_filter_levels_la_OBJECTS) filter_logo_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_filter_logo_la_OBJECTS = filter_logo.lo vid_aux.lo filter_logo_la_OBJECTS = $(am_filter_logo_la_OBJECTS) filter_logoaway_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_filter_logoaway_la_OBJECTS = filter_logoaway.lo filter_logoaway_la_OBJECTS = $(am_filter_logoaway_la_OBJECTS) filter_lowpass_la_LIBADD = am_filter_lowpass_la_OBJECTS = filter_lowpass.lo filter_lowpass_la_OBJECTS = $(am_filter_lowpass_la_OBJECTS) filter_mask_la_LIBADD = am_filter_mask_la_OBJECTS = filter_mask.lo filter_mask_la_OBJECTS = $(am_filter_mask_la_OBJECTS) filter_modfps_la_DEPENDENCIES = am_filter_modfps_la_OBJECTS = filter_modfps.lo filter_modfps_la_OBJECTS = $(am_filter_modfps_la_OBJECTS) filter_msharpen_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_filter_msharpen_la_OBJECTS = filter_msharpen.lo vid_aux.lo filter_msharpen_la_OBJECTS = $(am_filter_msharpen_la_OBJECTS) filter_nored_la_LIBADD = am_filter_nored_la_OBJECTS = filter_nored.lo filter_nored_la_OBJECTS = $(am_filter_nored_la_OBJECTS) filter_normalize_la_DEPENDENCIES = am_filter_normalize_la_OBJECTS = filter_normalize.lo filter_normalize_la_OBJECTS = $(am_filter_normalize_la_OBJECTS) filter_null_la_LIBADD = am_filter_null_la_OBJECTS = filter_null.lo filter_null_la_OBJECTS = $(am_filter_null_la_OBJECTS) filter_skip_la_LIBADD = am_filter_skip_la_OBJECTS = filter_skip.lo filter_skip_la_OBJECTS = $(am_filter_skip_la_OBJECTS) filter_slowmo_la_LIBADD = am_filter_slowmo_la_OBJECTS = filter_slowmo.lo filter_slowmo_la_OBJECTS = $(am_filter_slowmo_la_OBJECTS) filter_smartbob_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_filter_smartbob_la_OBJECTS = filter_smartbob.lo vid_aux.lo filter_smartbob_la_OBJECTS = $(am_filter_smartbob_la_OBJECTS) filter_smartdeinter_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_filter_smartdeinter_la_OBJECTS = filter_smartdeinter.lo vid_aux.lo filter_smartdeinter_la_OBJECTS = $(am_filter_smartdeinter_la_OBJECTS) filter_smartyuv_la_LIBADD = am_filter_smartyuv_la_OBJECTS = filter_smartyuv.lo filter_smartyuv_la_OBJECTS = $(am_filter_smartyuv_la_OBJECTS) filter_smooth_la_LIBADD = am_filter_smooth_la_OBJECTS = filter_smooth.lo filter_smooth_la_OBJECTS = $(am_filter_smooth_la_OBJECTS) filter_tc_audio_la_LIBADD = am_filter_tc_audio_la_OBJECTS = filter_tc_audio.lo filter_tc_audio_la_OBJECTS = $(am_filter_tc_audio_la_OBJECTS) filter_tc_video_la_LIBADD = am_filter_tc_video_la_OBJECTS = filter_tc_video.lo filter_tc_video_la_OBJECTS = $(am_filter_tc_video_la_OBJECTS) filter_testframe_la_LIBADD = am_filter_testframe_la_OBJECTS = filter_testframe.lo filter_testframe_la_OBJECTS = $(am_filter_testframe_la_OBJECTS) filter_text_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_filter_text_la_OBJECTS = filter_text.lo filter_text_la_OBJECTS = $(am_filter_text_la_OBJECTS) filter_unsharp_la_LIBADD = am_filter_unsharp_la_OBJECTS = filter_unsharp.lo filter_unsharp_la_OBJECTS = $(am_filter_unsharp_la_OBJECTS) filter_videocore_la_LIBADD = am_filter_videocore_la_OBJECTS = filter_videocore.lo filter_videocore_la_OBJECTS = $(am_filter_videocore_la_OBJECTS) filter_whitebalance_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am_filter_whitebalance_la_OBJECTS = filter_whitebalance.lo vid_aux.lo filter_whitebalance_la_OBJECTS = $(am_filter_whitebalance_la_OBJECTS) filter_xsharpen_la_LIBADD = am_filter_xsharpen_la_OBJECTS = filter_xsharpen.lo filter_xsharpen_la_OBJECTS = $(am_filter_xsharpen_la_OBJECTS) filter_yuy2toyv12_la_LIBADD = am_filter_yuy2toyv12_la_OBJECTS = filter_yuy2toyv12.lo filter_yuy2toyv12_la_OBJECTS = $(am_filter_yuy2toyv12_la_OBJECTS) pkgSCRIPT_INSTALL = $(INSTALL_SCRIPT) SCRIPTS = $(pkg_SCRIPTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autotools/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/deinterlace.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_29to23.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_32detect.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_32drop.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_aclip.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_ascii.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_astat.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_clone.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_compare.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_control.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_cpaudio.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_cshift.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_cut.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_denoise3d.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_detectclipping.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_detectsilence.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_dilyuvmmx.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_dnr.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_doublefps.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_facemask.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_fieldanalysis.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_fields.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_fps.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_hqdn3d.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_invert.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_levels.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_logo.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_logoaway.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_lowpass.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_mask.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_modfps.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_msharpen.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_nored.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_normalize.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_null.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_skip.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_slowmo.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_smartbob.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_smartdeinter.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_smartyuv.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_smooth.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_tc_audio.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_tc_video.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_testframe.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_text.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_unsharp.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_videocore.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_whitebalance.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_xsharpen.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/filter_yuy2toyv12.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/vid_aux.Plo COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(filter_29to23_la_SOURCES) $(filter_32detect_la_SOURCES) \ $(filter_32drop_la_SOURCES) $(filter_aclip_la_SOURCES) \ $(filter_ascii_la_SOURCES) $(filter_astat_la_SOURCES) \ $(filter_clone_la_SOURCES) $(filter_compare_la_SOURCES) \ $(filter_control_la_SOURCES) $(filter_cpaudio_la_SOURCES) \ $(filter_cshift_la_SOURCES) $(filter_cut_la_SOURCES) \ $(filter_denoise3d_la_SOURCES) \ $(filter_detectclipping_la_SOURCES) \ $(filter_detectsilence_la_SOURCES) \ $(filter_dilyuvmmx_la_SOURCES) $(filter_dnr_la_SOURCES) \ $(filter_doublefps_la_SOURCES) $(filter_facemask_la_SOURCES) \ $(filter_fieldanalysis_la_SOURCES) $(filter_fields_la_SOURCES) \ $(filter_fps_la_SOURCES) $(filter_hqdn3d_la_SOURCES) \ $(filter_invert_la_SOURCES) $(filter_levels_la_SOURCES) \ $(filter_logo_la_SOURCES) $(filter_logoaway_la_SOURCES) \ $(filter_lowpass_la_SOURCES) $(filter_mask_la_SOURCES) \ $(filter_modfps_la_SOURCES) $(filter_msharpen_la_SOURCES) \ $(filter_nored_la_SOURCES) $(filter_normalize_la_SOURCES) \ $(filter_null_la_SOURCES) $(filter_skip_la_SOURCES) \ $(filter_slowmo_la_SOURCES) $(filter_smartbob_la_SOURCES) \ $(filter_smartdeinter_la_SOURCES) \ $(filter_smartyuv_la_SOURCES) $(filter_smooth_la_SOURCES) \ $(filter_tc_audio_la_SOURCES) $(filter_tc_video_la_SOURCES) \ $(filter_testframe_la_SOURCES) $(filter_text_la_SOURCES) \ $(filter_unsharp_la_SOURCES) $(filter_videocore_la_SOURCES) \ $(filter_whitebalance_la_SOURCES) \ $(filter_xsharpen_la_SOURCES) $(filter_yuy2toyv12_la_SOURCES) DIST_SOURCES = $(filter_29to23_la_SOURCES) \ $(filter_32detect_la_SOURCES) $(filter_32drop_la_SOURCES) \ $(filter_aclip_la_SOURCES) $(filter_ascii_la_SOURCES) \ $(filter_astat_la_SOURCES) $(filter_clone_la_SOURCES) \ $(filter_compare_la_SOURCES) $(filter_control_la_SOURCES) \ $(filter_cpaudio_la_SOURCES) $(filter_cshift_la_SOURCES) \ $(filter_cut_la_SOURCES) $(filter_denoise3d_la_SOURCES) \ $(filter_detectclipping_la_SOURCES) \ $(filter_detectsilence_la_SOURCES) \ $(filter_dilyuvmmx_la_SOURCES) $(filter_dnr_la_SOURCES) \ $(filter_doublefps_la_SOURCES) $(filter_facemask_la_SOURCES) \ $(filter_fieldanalysis_la_SOURCES) $(filter_fields_la_SOURCES) \ $(filter_fps_la_SOURCES) $(filter_hqdn3d_la_SOURCES) \ $(filter_invert_la_SOURCES) $(filter_levels_la_SOURCES) \ $(filter_logo_la_SOURCES) $(filter_logoaway_la_SOURCES) \ $(filter_lowpass_la_SOURCES) $(filter_mask_la_SOURCES) \ $(filter_modfps_la_SOURCES) $(filter_msharpen_la_SOURCES) \ $(filter_nored_la_SOURCES) $(filter_normalize_la_SOURCES) \ $(filter_null_la_SOURCES) $(filter_skip_la_SOURCES) \ $(filter_slowmo_la_SOURCES) $(filter_smartbob_la_SOURCES) \ $(filter_smartdeinter_la_SOURCES) \ $(filter_smartyuv_la_SOURCES) $(filter_smooth_la_SOURCES) \ $(filter_tc_audio_la_SOURCES) $(filter_tc_video_la_SOURCES) \ $(filter_testframe_la_SOURCES) $(filter_text_la_SOURCES) \ $(filter_unsharp_la_SOURCES) $(filter_videocore_la_SOURCES) \ $(filter_whitebalance_la_SOURCES) \ $(filter_xsharpen_la_SOURCES) $(filter_yuy2toyv12_la_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ install-recursive installcheck-recursive installdirs-recursive \ pdf-recursive ps-recursive uninstall-info-recursive \ uninstall-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = pp divxkey extsub resample test yuvdenoise ivtc \ tomsmocomp preview subtitler DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A52_CFLAGS = @A52_CFLAGS@ A52_LIBS = @A52_LIBS@ AC3_CFLAGS = @AC3_CFLAGS@ AC3_LIBS = @AC3_LIBS@ ACLIB_CFLAGS = @ACLIB_CFLAGS@ ACLIB_LIBS = @ACLIB_LIBS@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALTIVEC_CFLAGS = @ALTIVEC_CFLAGS@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ ARCH_PPC_FALSE = @ARCH_PPC_FALSE@ ARCH_PPC_TRUE = @ARCH_PPC_TRUE@ ARCH_X86_64_FALSE = @ARCH_X86_64_FALSE@ ARCH_X86_64_TRUE = @ARCH_X86_64_TRUE@ ARCH_X86_FALSE = @ARCH_X86_FALSE@ ARCH_X86_TRUE = @ARCH_X86_TRUE@ ASFLAGS = @ASFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AVIFILE_CFLAGS = @AVIFILE_CFLAGS@ AVIFILE_LIBS = @AVIFILE_LIBS@ AVILIB_CFLAGS = @AVILIB_CFLAGS@ AVILIB_LIBS = @AVILIB_LIBS@ AWK = @AWK@ CAN_COMPILE_C_ALTIVEC_FALSE = @CAN_COMPILE_C_ALTIVEC_FALSE@ CAN_COMPILE_C_ALTIVEC_TRUE = @CAN_COMPILE_C_ALTIVEC_TRUE@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLDARWININCL = @DLDARWININCL@ DLDARWINLIB = @DLDARWINLIB@ DLDARWINOBJECTS = @DLDARWINOBJECTS@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEG_LIBS_BUILD = @FFMPEG_LIBS_BUILD@ FFMPEG_LIBS_CFLAGS = @FFMPEG_LIBS_CFLAGS@ FFMPEG_LIBS_LIBS = @FFMPEG_LIBS_LIBS@ FFMPEG_LIBS_VERSION = @FFMPEG_LIBS_VERSION@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ HAVE_3DNOW_FALSE = @HAVE_3DNOW_FALSE@ HAVE_3DNOW_TRUE = @HAVE_3DNOW_TRUE@ HAVE_A52_FALSE = @HAVE_A52_FALSE@ HAVE_A52_TRUE = @HAVE_A52_TRUE@ HAVE_AVIFILE_FALSE = @HAVE_AVIFILE_FALSE@ HAVE_AVIFILE_TRUE = @HAVE_AVIFILE_TRUE@ HAVE_BKTR_FALSE = @HAVE_BKTR_FALSE@ HAVE_BKTR_TRUE = @HAVE_BKTR_TRUE@ HAVE_DIVX_DECORE_FALSE = @HAVE_DIVX_DECORE_FALSE@ HAVE_DIVX_DECORE_TRUE = @HAVE_DIVX_DECORE_TRUE@ HAVE_DIVX_ENCORE2_FALSE = @HAVE_DIVX_ENCORE2_FALSE@ HAVE_DIVX_ENCORE2_TRUE = @HAVE_DIVX_ENCORE2_TRUE@ HAVE_FFMPEG_FALSE = @HAVE_FFMPEG_FALSE@ HAVE_FFMPEG_TRUE = @HAVE_FFMPEG_TRUE@ HAVE_FOMIT_FP_FALSE = @HAVE_FOMIT_FP_FALSE@ HAVE_FOMIT_FP_TRUE = @HAVE_FOMIT_FP_TRUE@ HAVE_FREETYPE2_FALSE = @HAVE_FREETYPE2_FALSE@ HAVE_FREETYPE2_TRUE = @HAVE_FREETYPE2_TRUE@ HAVE_GCC2_FALSE = @HAVE_GCC2_FALSE@ HAVE_GCC2_TRUE = @HAVE_GCC2_TRUE@ HAVE_GCC_FALSE = @HAVE_GCC_FALSE@ HAVE_GCC_TRUE = @HAVE_GCC_TRUE@ HAVE_GTK_FALSE = @HAVE_GTK_FALSE@ HAVE_GTK_TRUE = @HAVE_GTK_TRUE@ HAVE_IBP_FALSE = @HAVE_IBP_FALSE@ HAVE_IBP_TRUE = @HAVE_IBP_TRUE@ HAVE_IMAGEMAGICK_FALSE = @HAVE_IMAGEMAGICK_FALSE@ HAVE_IMAGEMAGICK_TRUE = @HAVE_IMAGEMAGICK_TRUE@ HAVE_LAME_FALSE = @HAVE_LAME_FALSE@ HAVE_LAME_TRUE = @HAVE_LAME_TRUE@ HAVE_LIBDVDREAD_FALSE = @HAVE_LIBDVDREAD_FALSE@ HAVE_LIBDVDREAD_TRUE = @HAVE_LIBDVDREAD_TRUE@ HAVE_LIBDV_FALSE = @HAVE_LIBDV_FALSE@ HAVE_LIBDV_TRUE = @HAVE_LIBDV_TRUE@ HAVE_LIBFAME_FALSE = @HAVE_LIBFAME_FALSE@ HAVE_LIBFAME_TRUE = @HAVE_LIBFAME_TRUE@ HAVE_LIBICONV_FALSE = @HAVE_LIBICONV_FALSE@ HAVE_LIBICONV_TRUE = @HAVE_LIBICONV_TRUE@ HAVE_LIBJPEG_FALSE = @HAVE_LIBJPEG_FALSE@ HAVE_LIBJPEG_TRUE = @HAVE_LIBJPEG_TRUE@ HAVE_LIBLVE_FALSE = @HAVE_LIBLVE_FALSE@ HAVE_LIBLVE_TRUE = @HAVE_LIBLVE_TRUE@ HAVE_LIBMPEG3_FALSE = @HAVE_LIBMPEG3_FALSE@ HAVE_LIBMPEG3_TRUE = @HAVE_LIBMPEG3_TRUE@ HAVE_LIBQUICKTIME_FALSE = @HAVE_LIBQUICKTIME_FALSE@ HAVE_LIBQUICKTIME_TRUE = @HAVE_LIBQUICKTIME_TRUE@ HAVE_LIBXML2_FALSE = @HAVE_LIBXML2_FALSE@ HAVE_LIBXML2_TRUE = @HAVE_LIBXML2_TRUE@ HAVE_LIBXPM_FALSE = @HAVE_LIBXPM_FALSE@ HAVE_LIBXPM_TRUE = @HAVE_LIBXPM_TRUE@ HAVE_LIBXV_FALSE = @HAVE_LIBXV_FALSE@ HAVE_LIBXV_TRUE = @HAVE_LIBXV_TRUE@ HAVE_LZO_FALSE = @HAVE_LZO_FALSE@ HAVE_LZO_TRUE = @HAVE_LZO_TRUE@ HAVE_MJPEGTOOLS_FALSE = @HAVE_MJPEGTOOLS_FALSE@ HAVE_MJPEGTOOLS_TRUE = @HAVE_MJPEGTOOLS_TRUE@ HAVE_MMX_FALSE = @HAVE_MMX_FALSE@ HAVE_MMX_TRUE = @HAVE_MMX_TRUE@ HAVE_OGG_FALSE = @HAVE_OGG_FALSE@ HAVE_OGG_TRUE = @HAVE_OGG_TRUE@ HAVE_PVM3_FALSE = @HAVE_PVM3_FALSE@ HAVE_PVM3_TRUE = @HAVE_PVM3_TRUE@ HAVE_SDL_FALSE = @HAVE_SDL_FALSE@ HAVE_SDL_TRUE = @HAVE_SDL_TRUE@ HAVE_SSE2_FALSE = @HAVE_SSE2_FALSE@ HAVE_SSE2_TRUE = @HAVE_SSE2_TRUE@ HAVE_SSE_FALSE = @HAVE_SSE_FALSE@ HAVE_SSE_TRUE = @HAVE_SSE_TRUE@ HAVE_SUNAU_FALSE = @HAVE_SUNAU_FALSE@ HAVE_SUNAU_TRUE = @HAVE_SUNAU_TRUE@ HAVE_THEORA_FALSE = @HAVE_THEORA_FALSE@ HAVE_THEORA_TRUE = @HAVE_THEORA_TRUE@ HAVE_V4L_FALSE = @HAVE_V4L_FALSE@ HAVE_V4L_TRUE = @HAVE_V4L_TRUE@ HAVE_VORBIS_FALSE = @HAVE_VORBIS_FALSE@ HAVE_VORBIS_TRUE = @HAVE_VORBIS_TRUE@ HAVE_X11_FALSE = @HAVE_X11_FALSE@ HAVE_X11_TRUE = @HAVE_X11_TRUE@ HAVE_XAW_SIMPLE_FALSE = @HAVE_XAW_SIMPLE_FALSE@ HAVE_XAW_SIMPLE_TRUE = @HAVE_XAW_SIMPLE_TRUE@ IBP_LIBS = @IBP_LIBS@ IMAGEMAGICK_CFLAGS = @IMAGEMAGICK_CFLAGS@ IMAGEMAGICK_LIBS = @IMAGEMAGICK_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAME_CFLAGS = @LAME_CFLAGS@ LAME_LIBS = @LAME_LIBS@ LDFLAGS = @LDFLAGS@ LIBDVDREAD_CFLAGS = @LIBDVDREAD_CFLAGS@ LIBDVDREAD_LIBS = @LIBDVDREAD_LIBS@ LIBDV_CFLAGS = @LIBDV_CFLAGS@ LIBDV_LIBS = @LIBDV_LIBS@ LIBFAME_CFLAGS = @LIBFAME_CFLAGS@ LIBFAME_CONFIG = @LIBFAME_CONFIG@ LIBFAME_LIBS = @LIBFAME_LIBS@ LIBICONV_CFLAGS = @LIBICONV_CFLAGS@ LIBICONV_LIBS = @LIBICONV_LIBS@ LIBJPEG_CFLAGS = @LIBJPEG_CFLAGS@ LIBJPEG_LIBS = @LIBJPEG_LIBS@ LIBMPEG3_CFLAGS = @LIBMPEG3_CFLAGS@ LIBMPEG3_LIBS = @LIBMPEG3_LIBS@ LIBOBJS = @LIBOBJS@ LIBQUICKTIME_CFLAGS = @LIBQUICKTIME_CFLAGS@ LIBQUICKTIME_LIBS = @LIBQUICKTIME_LIBS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBVO_CFLAGS = @LIBVO_CFLAGS@ LIBVO_LIBS = @LIBVO_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LVE_CFLAGS = @LVE_CFLAGS@ LVE_LIBS = @LVE_LIBS@ LZO_CFLAGS = @LZO_CFLAGS@ LZO_LIBS = @LZO_LIBS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MJPEGTOOLS_CFLAGS = @MJPEGTOOLS_CFLAGS@ MJPEGTOOLS_LIBS = @MJPEGTOOLS_LIBS@ MOD_PATH = @MOD_PATH@ MPEG2CVS_CFLAGS = @MPEG2CVS_CFLAGS@ MPEG2CVS_LIBS = @MPEG2CVS_LIBS@ NET_STREAM_FALSE = @NET_STREAM_FALSE@ NET_STREAM_TRUE = @NET_STREAM_TRUE@ OBJEXT = @OBJEXT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_TO_AWK = @PATH_TO_AWK@ PKG_CONFIG = @PKG_CONFIG@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PVM3_CFLAGS = @PVM3_CFLAGS@ PVM3_LIB = @PVM3_LIB@ PVM3_PVMGS = @PVM3_PVMGS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUPPORT_INCLUDES = @SUPPORT_INCLUDES@ SUPPORT_LIBS = @SUPPORT_LIBS@ SUPPORT_OBJECTS = @SUPPORT_OBJECTS@ SYSTEM_DARWIN_FALSE = @SYSTEM_DARWIN_FALSE@ SYSTEM_DARWIN_TRUE = @SYSTEM_DARWIN_TRUE@ TCIOAUX_CFLAGS = @TCIOAUX_CFLAGS@ TCIOAUX_LIBS = @TCIOAUX_LIBS@ THEORA_CFLAGS = @THEORA_CFLAGS@ THEORA_LIBS = @THEORA_LIBS@ VERSION = @VERSION@ VORBIS_CFLAGS = @VORBIS_CFLAGS@ VORBIS_LIBS = @VORBIS_LIBS@ WORDS_BIGENDIAN_FALSE = @WORDS_BIGENDIAN_FALSE@ WORDS_BIGENDIAN_TRUE = @WORDS_BIGENDIAN_TRUE@ XIO_CFLAGS = @XIO_CFLAGS@ XIO_LIBS = @XIO_LIBS@ XVID_DEFAULT = @XVID_DEFAULT@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ a52_config = @a52_config@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ avifile_config = @avifile_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ ffmpeg_bin = @ffmpeg_bin@ ffmpeg_libs_config = @ffmpeg_libs_config@ gtk_config = @gtk_config@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ imagemagick_config = @imagemagick_config@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ lame_config = @lame_config@ libdir = @libdir@ libdv_config = @libdv_config@ libdvdread_config = @libdvdread_config@ libexecdir = @libexecdir@ libiconv_config = @libiconv_config@ libmpeg3_config = @libmpeg3_config@ libquicktime_config = @libquicktime_config@ libxml2_config = @libxml2_config@ localstatedir = @localstatedir@ lzo_config = @lzo_config@ mandir = @mandir@ mjpegtools_config = @mjpegtools_config@ mkdir_p = @mkdir_p@ ogg_config = @ogg_config@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ theora_config = @theora_config@ vorbis_config = @vorbis_config@ x_includes = @x_includes@ x_libraries = @x_libraries@ AM_CPPFLAGS = \ $(PTHREAD_CFLAGS) \ -I$(top_srcdir) \ -I$(top_srcdir)/src \ $(AVILIB_CFLAGS) \ $(AVIFILE_CFLAGS) \ $(LAME_CFLAGS) \ $(AC3_CFLAGS) \ $(IMAGEMAGICK_CFLAGS) \ $(FT2_CFLAGS) pkgdir = $(MOD_PATH) @HAVE_MMX_FALSE@F_MMX = @HAVE_MMX_TRUE@F_MMX = filter_dilyuvmmx.la @HAVE_FREETYPE2_TRUE@F_TEXT = filter_text.la @HAVE_IMAGEMAGICK_TRUE@F_LOGO = filter_logo.la filter_logoaway.la filter_compare.la @CAN_COMPILE_C_ALTIVEC_TRUE@@SYSTEM_DARWIN_FALSE@ALTIVEC = -maltivec -mabi=altivec @CAN_COMPILE_C_ALTIVEC_TRUE@@SYSTEM_DARWIN_TRUE@ALTIVEC = -faltivec @ARCH_X86_TRUE@@HAVE_3DNOW_TRUE@@HAVE_GCC2_FALSE@@HAVE_MMX_TRUE@@HAVE_SSE_TRUE@F_TOMSMOCOMP = tomsmocomp @HAVE_GCC2_TRUE@F_TOMSMOCOMP = AM_CFLAGS = $(ALTIVEC) pkg_LTLIBRARIES = \ filter_29to23.la \ filter_32detect.la \ filter_32drop.la \ filter_aclip.la \ filter_ascii.la \ filter_astat.la \ filter_clone.la \ filter_control.la \ filter_cpaudio.la \ filter_cshift.la \ filter_cut.la \ filter_denoise3d.la \ filter_detectclipping.la \ filter_detectsilence.la \ filter_dnr.la \ filter_doublefps.la \ filter_facemask.la \ filter_fieldanalysis.la\ filter_fields.la \ filter_fps.la \ filter_hqdn3d.la \ filter_invert.la \ filter_levels.la \ filter_lowpass.la \ filter_mask.la \ filter_modfps.la \ filter_msharpen.la \ filter_nored.la \ filter_normalize.la \ filter_null.la \ filter_skip.la \ filter_slowmo.la \ filter_smartbob.la \ filter_smartdeinter.la \ filter_smartyuv.la \ filter_smooth.la \ filter_tc_audio.la \ filter_tc_video.la \ filter_testframe.la \ filter_unsharp.la \ filter_videocore.la \ filter_whitebalance.la \ filter_xsharpen.la \ filter_yuy2toyv12.la \ $(F_LOGO) \ $(F_MMX) \ $(F_TEXT) filter_29to23_la_SOURCES = filter_29to23.c filter_29to23_la_LDFLAGS = -module -avoid-version filter_32detect_la_SOURCES = filter_32detect.c filter_32detect_la_LDFLAGS = -module -avoid-version filter_32drop_la_SOURCES = filter_32drop.c filter_32drop_la_LDFLAGS = -module -avoid-version filter_aclip_la_SOURCES = filter_aclip.c filter_aclip_la_LDFLAGS = -module -avoid-version filter_ascii_la_SOURCES = filter_ascii.c ../export/vid_aux.c filter_ascii_la_LDFLAGS = -module -avoid-version filter_ascii_la_LIBADD = $(LIBVO_LIBS) filter_astat_la_SOURCES = filter_astat.c filter_astat_la_LDFLAGS = -module -avoid-version filter_clone_la_SOURCES = filter_clone.c filter_clone_la_LDFLAGS = -module -avoid-version filter_control_la_SOURCES = filter_control.c filter_control_la_LDFLAGS = -module -avoid-version filter_cpaudio_la_SOURCES = filter_cpaudio.c filter_cpaudio_la_LDFLAGS = -module -avoid-version filter_cshift_la_SOURCES = filter_cshift.c filter_cshift_la_LDFLAGS = -module -avoid-version filter_cut_la_SOURCES = filter_cut.c filter_cut_la_LDFLAGS = -module -avoid-version filter_denoise3d_la_SOURCES = filter_denoise3d.c filter_denoise3d_la_LDFLAGS = -module -avoid-version filter_detectclipping_la_SOURCES = filter_detectclipping.c filter_detectclipping_la_LDFLAGS = -module -avoid-version filter_detectsilence_la_SOURCES = filter_detectsilence.c filter_detectsilence_la_LDFLAGS = -module -avoid-version filter_dnr_la_SOURCES = filter_dnr.c filter_dnr_la_LDFLAGS = -module -avoid-version filter_dnr_la_LIBADD = -lm filter_doublefps_la_SOURCES = filter_doublefps.c filter_doublefps_la_LDFLAGS = -module -avoid-version filter_facemask_la_SOURCES = filter_facemask.c ../export/vid_aux.c filter_facemask_la_LDFLAGS = -module -avoid-version filter_facemask_la_LIBADD = $(LIBVO_LIBS) filter_fieldanalysis_la_SOURCES = filter_fieldanalysis.c filter_fieldanalysis_la_LDFLAGS = -module -avoid-version filter_fields_la_SOURCES = filter_fields.c filter_fields_la_LDFLAGS = -module -avoid-version filter_fps_la_SOURCES = filter_fps.c filter_fps_la_LDFLAGS = -module -avoid-version filter_hqdn3d_la_SOURCES = filter_hqdn3d.c filter_hqdn3d_la_LDFLAGS = -module -avoid-version filter_invert_la_SOURCES = filter_invert.c filter_invert_la_LDFLAGS = -module -avoid-version filter_levels_la_SOURCES = filter_levels.c filter_levels_la_LDFLAGS = -module -avoid-version filter_lowpass_la_SOURCES = filter_lowpass.c filter_lowpass_la_LDFLAGS = -module -avoid-version filter_mask_la_SOURCES = filter_mask.c filter_mask_la_LDFLAGS = -module -avoid-version filter_modfps_la_SOURCES = filter_modfps.c filter_modfps_la_LDFLAGS = -module -avoid-version filter_modfps_la_LIBADD = -lm filter_msharpen_la_SOURCES = filter_msharpen.c ../export/vid_aux.c filter_msharpen_la_LDFLAGS = -module -avoid-version filter_msharpen_la_LIBADD = $(LIBVO_LIBS) filter_nored_la_SOURCES = filter_nored.c filter_nored_la_LDFLAGS = -module -avoid-version filter_normalize_la_SOURCES = filter_normalize.c filter_normalize_la_LDFLAGS = -module -avoid-version filter_normalize_la_LIBADD = -lm filter_null_la_SOURCES = filter_null.c filter_null_la_LDFLAGS = -module -avoid-version filter_skip_la_SOURCES = filter_skip.c filter_skip_la_LDFLAGS = -module -avoid-version filter_slowmo_la_SOURCES = filter_slowmo.c filter_slowmo_la_LDFLAGS = -module -avoid-version filter_smartbob_la_SOURCES = filter_smartbob.c ../export/vid_aux.c filter_smartbob_la_LDFLAGS = -module -avoid-version filter_smartbob_la_LIBADD = $(LIBVO_LIBS) filter_smartdeinter_la_SOURCES = filter_smartdeinter.c ../export/vid_aux.c filter_smartdeinter_la_LDFLAGS = -module -avoid-version filter_smartdeinter_la_LIBADD = $(LIBVO_LIBS) filter_smartyuv_la_SOURCES = filter_smartyuv.c filter_smartyuv_la_LDFLAGS = -module -avoid-version filter_smooth_la_SOURCES = filter_smooth.c filter_smooth_la_LDFLAGS = -module -avoid-version filter_tc_audio_la_SOURCES = filter_tc_audio.c filter_tc_audio_la_LDFLAGS = -module -avoid-version filter_tc_video_la_SOURCES = filter_tc_video.c filter_tc_video_la_LDFLAGS = -module -avoid-version filter_testframe_la_SOURCES = filter_testframe.c filter_testframe_la_LDFLAGS = -module -avoid-version filter_unsharp_la_SOURCES = filter_unsharp.c filter_unsharp_la_LDFLAGS = -module -avoid-version filter_videocore_la_SOURCES = filter_videocore.c filter_videocore_la_LDFLAGS = -module -avoid-version filter_whitebalance_la_SOURCES = filter_whitebalance.c ../export/vid_aux.c filter_whitebalance_la_LDFLAGS = -module -avoid-version filter_whitebalance_la_LIBADD = $(LIBVO_LIBS) -lm filter_xsharpen_la_SOURCES = filter_xsharpen.c filter_xsharpen_la_LDFLAGS = -module -avoid-version filter_yuy2toyv12_la_SOURCES = filter_yuy2toyv12.c filter_yuy2toyv12_la_LDFLAGS = -module -avoid-version # F_LOGO = filter_logo.la filter_logoaway.la filter_compare.la filter_logo_la_SOURCES = filter_logo.c ../export/vid_aux.c filter_logo_la_LDFLAGS = -module -avoid-version filter_logo_la_LIBADD = $(IMAGEMAGICK_LIBS) $(LIBVO_LIBS) filter_logoaway_la_SOURCES = filter_logoaway.c filter_logoaway_la_LDFLAGS = -module -avoid-version filter_logoaway_la_LIBADD = $(IMAGEMAGICK_LIBS) filter_compare_la_SOURCES = filter_compare.c ../export/vid_aux.c filter_compare_la_LDFLAGS = -module -avoid-version filter_compare_la_LIBADD = $(IMAGEMAGICK_LIBS) $(LIBVO_LIBS) # F_MMX = filter_dilyuvmmx.la filter_dilyuvmmx_la_SOURCES = filter_dilyuvmmx.c deinterlace.c filter_dilyuvmmx_la_LDFLAGS = -module -avoid-version # F_TEXT = filter_text.la filter_text_la_SOURCES = filter_text.c filter_text_la_LDFLAGS = -module -avoid-version filter_text_la_LIBADD = $(FT2_LIBS) EXTRA_DIST = \ parse_csv.awk.in \ filter_list.awk.in \ mmx.h @HAVE_FREETYPE2_TRUE@@HAVE_LIBICONV_TRUE@@HAVE_LIBXPM_TRUE@@HAVE_XAW_SIMPLE_TRUE@ADD2 = subtitler @HAVE_X11_FALSE@SUBDIRS = \ @HAVE_X11_FALSE@ pp \ @HAVE_X11_FALSE@ divxkey \ @HAVE_X11_FALSE@ extsub \ @HAVE_X11_FALSE@ resample \ @HAVE_X11_FALSE@ test \ @HAVE_X11_FALSE@ yuvdenoise \ @HAVE_X11_FALSE@ ivtc \ @HAVE_X11_FALSE@ $(F_TOMSMOCOMP) @HAVE_X11_TRUE@SUBDIRS = \ @HAVE_X11_TRUE@ pp \ @HAVE_X11_TRUE@ divxkey \ @HAVE_X11_TRUE@ extsub \ @HAVE_X11_TRUE@ resample \ @HAVE_X11_TRUE@ test \ @HAVE_X11_TRUE@ yuvdenoise \ @HAVE_X11_TRUE@ ivtc \ @HAVE_X11_TRUE@ $(F_TOMSMOCOMP) \ @HAVE_X11_TRUE@ preview \ @HAVE_X11_TRUE@ $(ADD2) pkg_SCRIPTS = \ filter_list.awk \ parse_csv.awk all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu filter/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu filter/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh parse_csv.awk: $(top_builddir)/config.status $(srcdir)/parse_csv.awk.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ filter_list.awk: $(top_builddir)/config.status $(srcdir)/filter_list.awk.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ else :; fi; \ done uninstall-pkgLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ p="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ done clean-pkgLTLIBRARIES: -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" = "$$p" && dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done filter_29to23.la: $(filter_29to23_la_OBJECTS) $(filter_29to23_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_29to23_la_LDFLAGS) $(filter_29to23_la_OBJECTS) $(filter_29to23_la_LIBADD) $(LIBS) filter_32detect.la: $(filter_32detect_la_OBJECTS) $(filter_32detect_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_32detect_la_LDFLAGS) $(filter_32detect_la_OBJECTS) $(filter_32detect_la_LIBADD) $(LIBS) filter_32drop.la: $(filter_32drop_la_OBJECTS) $(filter_32drop_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_32drop_la_LDFLAGS) $(filter_32drop_la_OBJECTS) $(filter_32drop_la_LIBADD) $(LIBS) filter_aclip.la: $(filter_aclip_la_OBJECTS) $(filter_aclip_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_aclip_la_LDFLAGS) $(filter_aclip_la_OBJECTS) $(filter_aclip_la_LIBADD) $(LIBS) filter_ascii.la: $(filter_ascii_la_OBJECTS) $(filter_ascii_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_ascii_la_LDFLAGS) $(filter_ascii_la_OBJECTS) $(filter_ascii_la_LIBADD) $(LIBS) filter_astat.la: $(filter_astat_la_OBJECTS) $(filter_astat_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_astat_la_LDFLAGS) $(filter_astat_la_OBJECTS) $(filter_astat_la_LIBADD) $(LIBS) filter_clone.la: $(filter_clone_la_OBJECTS) $(filter_clone_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_clone_la_LDFLAGS) $(filter_clone_la_OBJECTS) $(filter_clone_la_LIBADD) $(LIBS) filter_compare.la: $(filter_compare_la_OBJECTS) $(filter_compare_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_compare_la_LDFLAGS) $(filter_compare_la_OBJECTS) $(filter_compare_la_LIBADD) $(LIBS) filter_control.la: $(filter_control_la_OBJECTS) $(filter_control_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_control_la_LDFLAGS) $(filter_control_la_OBJECTS) $(filter_control_la_LIBADD) $(LIBS) filter_cpaudio.la: $(filter_cpaudio_la_OBJECTS) $(filter_cpaudio_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_cpaudio_la_LDFLAGS) $(filter_cpaudio_la_OBJECTS) $(filter_cpaudio_la_LIBADD) $(LIBS) filter_cshift.la: $(filter_cshift_la_OBJECTS) $(filter_cshift_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_cshift_la_LDFLAGS) $(filter_cshift_la_OBJECTS) $(filter_cshift_la_LIBADD) $(LIBS) filter_cut.la: $(filter_cut_la_OBJECTS) $(filter_cut_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_cut_la_LDFLAGS) $(filter_cut_la_OBJECTS) $(filter_cut_la_LIBADD) $(LIBS) filter_denoise3d.la: $(filter_denoise3d_la_OBJECTS) $(filter_denoise3d_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_denoise3d_la_LDFLAGS) $(filter_denoise3d_la_OBJECTS) $(filter_denoise3d_la_LIBADD) $(LIBS) filter_detectclipping.la: $(filter_detectclipping_la_OBJECTS) $(filter_detectclipping_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_detectclipping_la_LDFLAGS) $(filter_detectclipping_la_OBJECTS) $(filter_detectclipping_la_LIBADD) $(LIBS) filter_detectsilence.la: $(filter_detectsilence_la_OBJECTS) $(filter_detectsilence_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_detectsilence_la_LDFLAGS) $(filter_detectsilence_la_OBJECTS) $(filter_detectsilence_la_LIBADD) $(LIBS) filter_dilyuvmmx.la: $(filter_dilyuvmmx_la_OBJECTS) $(filter_dilyuvmmx_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_dilyuvmmx_la_LDFLAGS) $(filter_dilyuvmmx_la_OBJECTS) $(filter_dilyuvmmx_la_LIBADD) $(LIBS) filter_dnr.la: $(filter_dnr_la_OBJECTS) $(filter_dnr_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_dnr_la_LDFLAGS) $(filter_dnr_la_OBJECTS) $(filter_dnr_la_LIBADD) $(LIBS) filter_doublefps.la: $(filter_doublefps_la_OBJECTS) $(filter_doublefps_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_doublefps_la_LDFLAGS) $(filter_doublefps_la_OBJECTS) $(filter_doublefps_la_LIBADD) $(LIBS) filter_facemask.la: $(filter_facemask_la_OBJECTS) $(filter_facemask_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_facemask_la_LDFLAGS) $(filter_facemask_la_OBJECTS) $(filter_facemask_la_LIBADD) $(LIBS) filter_fieldanalysis.la: $(filter_fieldanalysis_la_OBJECTS) $(filter_fieldanalysis_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_fieldanalysis_la_LDFLAGS) $(filter_fieldanalysis_la_OBJECTS) $(filter_fieldanalysis_la_LIBADD) $(LIBS) filter_fields.la: $(filter_fields_la_OBJECTS) $(filter_fields_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_fields_la_LDFLAGS) $(filter_fields_la_OBJECTS) $(filter_fields_la_LIBADD) $(LIBS) filter_fps.la: $(filter_fps_la_OBJECTS) $(filter_fps_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_fps_la_LDFLAGS) $(filter_fps_la_OBJECTS) $(filter_fps_la_LIBADD) $(LIBS) filter_hqdn3d.la: $(filter_hqdn3d_la_OBJECTS) $(filter_hqdn3d_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_hqdn3d_la_LDFLAGS) $(filter_hqdn3d_la_OBJECTS) $(filter_hqdn3d_la_LIBADD) $(LIBS) filter_invert.la: $(filter_invert_la_OBJECTS) $(filter_invert_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_invert_la_LDFLAGS) $(filter_invert_la_OBJECTS) $(filter_invert_la_LIBADD) $(LIBS) filter_levels.la: $(filter_levels_la_OBJECTS) $(filter_levels_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_levels_la_LDFLAGS) $(filter_levels_la_OBJECTS) $(filter_levels_la_LIBADD) $(LIBS) filter_logo.la: $(filter_logo_la_OBJECTS) $(filter_logo_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_logo_la_LDFLAGS) $(filter_logo_la_OBJECTS) $(filter_logo_la_LIBADD) $(LIBS) filter_logoaway.la: $(filter_logoaway_la_OBJECTS) $(filter_logoaway_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_logoaway_la_LDFLAGS) $(filter_logoaway_la_OBJECTS) $(filter_logoaway_la_LIBADD) $(LIBS) filter_lowpass.la: $(filter_lowpass_la_OBJECTS) $(filter_lowpass_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_lowpass_la_LDFLAGS) $(filter_lowpass_la_OBJECTS) $(filter_lowpass_la_LIBADD) $(LIBS) filter_mask.la: $(filter_mask_la_OBJECTS) $(filter_mask_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_mask_la_LDFLAGS) $(filter_mask_la_OBJECTS) $(filter_mask_la_LIBADD) $(LIBS) filter_modfps.la: $(filter_modfps_la_OBJECTS) $(filter_modfps_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_modfps_la_LDFLAGS) $(filter_modfps_la_OBJECTS) $(filter_modfps_la_LIBADD) $(LIBS) filter_msharpen.la: $(filter_msharpen_la_OBJECTS) $(filter_msharpen_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_msharpen_la_LDFLAGS) $(filter_msharpen_la_OBJECTS) $(filter_msharpen_la_LIBADD) $(LIBS) filter_nored.la: $(filter_nored_la_OBJECTS) $(filter_nored_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_nored_la_LDFLAGS) $(filter_nored_la_OBJECTS) $(filter_nored_la_LIBADD) $(LIBS) filter_normalize.la: $(filter_normalize_la_OBJECTS) $(filter_normalize_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_normalize_la_LDFLAGS) $(filter_normalize_la_OBJECTS) $(filter_normalize_la_LIBADD) $(LIBS) filter_null.la: $(filter_null_la_OBJECTS) $(filter_null_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_null_la_LDFLAGS) $(filter_null_la_OBJECTS) $(filter_null_la_LIBADD) $(LIBS) filter_skip.la: $(filter_skip_la_OBJECTS) $(filter_skip_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_skip_la_LDFLAGS) $(filter_skip_la_OBJECTS) $(filter_skip_la_LIBADD) $(LIBS) filter_slowmo.la: $(filter_slowmo_la_OBJECTS) $(filter_slowmo_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_slowmo_la_LDFLAGS) $(filter_slowmo_la_OBJECTS) $(filter_slowmo_la_LIBADD) $(LIBS) filter_smartbob.la: $(filter_smartbob_la_OBJECTS) $(filter_smartbob_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_smartbob_la_LDFLAGS) $(filter_smartbob_la_OBJECTS) $(filter_smartbob_la_LIBADD) $(LIBS) filter_smartdeinter.la: $(filter_smartdeinter_la_OBJECTS) $(filter_smartdeinter_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_smartdeinter_la_LDFLAGS) $(filter_smartdeinter_la_OBJECTS) $(filter_smartdeinter_la_LIBADD) $(LIBS) filter_smartyuv.la: $(filter_smartyuv_la_OBJECTS) $(filter_smartyuv_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_smartyuv_la_LDFLAGS) $(filter_smartyuv_la_OBJECTS) $(filter_smartyuv_la_LIBADD) $(LIBS) filter_smooth.la: $(filter_smooth_la_OBJECTS) $(filter_smooth_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_smooth_la_LDFLAGS) $(filter_smooth_la_OBJECTS) $(filter_smooth_la_LIBADD) $(LIBS) filter_tc_audio.la: $(filter_tc_audio_la_OBJECTS) $(filter_tc_audio_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_tc_audio_la_LDFLAGS) $(filter_tc_audio_la_OBJECTS) $(filter_tc_audio_la_LIBADD) $(LIBS) filter_tc_video.la: $(filter_tc_video_la_OBJECTS) $(filter_tc_video_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_tc_video_la_LDFLAGS) $(filter_tc_video_la_OBJECTS) $(filter_tc_video_la_LIBADD) $(LIBS) filter_testframe.la: $(filter_testframe_la_OBJECTS) $(filter_testframe_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_testframe_la_LDFLAGS) $(filter_testframe_la_OBJECTS) $(filter_testframe_la_LIBADD) $(LIBS) filter_text.la: $(filter_text_la_OBJECTS) $(filter_text_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_text_la_LDFLAGS) $(filter_text_la_OBJECTS) $(filter_text_la_LIBADD) $(LIBS) filter_unsharp.la: $(filter_unsharp_la_OBJECTS) $(filter_unsharp_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_unsharp_la_LDFLAGS) $(filter_unsharp_la_OBJECTS) $(filter_unsharp_la_LIBADD) $(LIBS) filter_videocore.la: $(filter_videocore_la_OBJECTS) $(filter_videocore_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_videocore_la_LDFLAGS) $(filter_videocore_la_OBJECTS) $(filter_videocore_la_LIBADD) $(LIBS) filter_whitebalance.la: $(filter_whitebalance_la_OBJECTS) $(filter_whitebalance_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_whitebalance_la_LDFLAGS) $(filter_whitebalance_la_OBJECTS) $(filter_whitebalance_la_LIBADD) $(LIBS) filter_xsharpen.la: $(filter_xsharpen_la_OBJECTS) $(filter_xsharpen_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_xsharpen_la_LDFLAGS) $(filter_xsharpen_la_OBJECTS) $(filter_xsharpen_la_LIBADD) $(LIBS) filter_yuy2toyv12.la: $(filter_yuy2toyv12_la_OBJECTS) $(filter_yuy2toyv12_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_yuy2toyv12_la_LDFLAGS) $(filter_yuy2toyv12_la_OBJECTS) $(filter_yuy2toyv12_la_LIBADD) $(LIBS) install-pkgSCRIPTS: $(pkg_SCRIPTS) @$(NORMAL_INSTALL) test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" @list='$(pkg_SCRIPTS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f $$d$$p; then \ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ echo " $(pkgSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ $(pkgSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ else :; fi; \ done uninstall-pkgSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(pkg_SCRIPTS)'; for p in $$list; do \ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ echo " rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgdir)/$$f"; \ done mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deinterlace.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_29to23.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_32detect.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_32drop.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_aclip.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_ascii.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_astat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_clone.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_compare.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_control.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_cpaudio.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_cshift.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_cut.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_denoise3d.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_detectclipping.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_detectsilence.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_dilyuvmmx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_dnr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_doublefps.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_facemask.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_fieldanalysis.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_fields.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_fps.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_hqdn3d.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_invert.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_levels.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_logo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_logoaway.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_lowpass.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_mask.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_modfps.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_msharpen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_nored.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_normalize.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_null.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_skip.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_slowmo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_smartbob.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_smartdeinter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_smartyuv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_smooth.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_tc_audio.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_tc_video.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_testframe.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_text.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_unsharp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_videocore.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_whitebalance.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_xsharpen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_yuy2toyv12.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vid_aux.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< vid_aux.o: ../export/vid_aux.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vid_aux.o -MD -MP -MF "$(DEPDIR)/vid_aux.Tpo" -c -o vid_aux.o `test -f '../export/vid_aux.c' || echo '$(srcdir)/'`../export/vid_aux.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vid_aux.Tpo" "$(DEPDIR)/vid_aux.Po"; else rm -f "$(DEPDIR)/vid_aux.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../export/vid_aux.c' object='vid_aux.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vid_aux.Po' tmpdepfile='$(DEPDIR)/vid_aux.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vid_aux.o `test -f '../export/vid_aux.c' || echo '$(srcdir)/'`../export/vid_aux.c vid_aux.obj: ../export/vid_aux.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vid_aux.obj -MD -MP -MF "$(DEPDIR)/vid_aux.Tpo" -c -o vid_aux.obj `if test -f '../export/vid_aux.c'; then $(CYGPATH_W) '../export/vid_aux.c'; else $(CYGPATH_W) '$(srcdir)/../export/vid_aux.c'; fi`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vid_aux.Tpo" "$(DEPDIR)/vid_aux.Po"; else rm -f "$(DEPDIR)/vid_aux.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../export/vid_aux.c' object='vid_aux.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vid_aux.Po' tmpdepfile='$(DEPDIR)/vid_aux.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vid_aux.obj `if test -f '../export/vid_aux.c'; then $(CYGPATH_W) '../export/vid_aux.c'; else $(CYGPATH_W) '$(srcdir)/../export/vid_aux.c'; fi` vid_aux.lo: ../export/vid_aux.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT vid_aux.lo -MD -MP -MF "$(DEPDIR)/vid_aux.Tpo" -c -o vid_aux.lo `test -f '../export/vid_aux.c' || echo '$(srcdir)/'`../export/vid_aux.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/vid_aux.Tpo" "$(DEPDIR)/vid_aux.Plo"; else rm -f "$(DEPDIR)/vid_aux.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../export/vid_aux.c' object='vid_aux.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/vid_aux.Plo' tmpdepfile='$(DEPDIR)/vid_aux.TPlo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o vid_aux.lo `test -f '../export/vid_aux.c' || echo '$(srcdir)/'`../export/vid_aux.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if (etags --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ else \ include_option=--include; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || mkdir "$(distdir)/$$subdir" \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="../$(top_distdir)" \ distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgdir)" "$(DESTDIR)$(pkgdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \ mostlyclean-am distclean: distclean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-pkgLTLIBRARIES install-pkgSCRIPTS install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES \ uninstall-pkgSCRIPTS uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ clean clean-generic clean-libtool clean-pkgLTLIBRARIES \ clean-recursive ctags ctags-recursive distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-recursive distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-pkgLTLIBRARIES \ install-pkgSCRIPTS install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive \ mostlyclean mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ tags tags-recursive uninstall uninstall-am uninstall-info-am \ uninstall-pkgLTLIBRARIES uninstall-pkgSCRIPTS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: transcode-1.0.0beta2/filter/filter_list.awk.in100644 001750 000000 00000002620 10161256042 0015010#!@PATH_TO_AWK@ -f BEGIN { if (ARGC <= 2) { print "Usage: prog MOD_PATH TMPFILE" exit 1 } else { indir = ARGV[1] outfile = ARGV[2] } while ( ("ls "indir"/filter_*.so" | getline) > 0) { ++sizeOfArray; sub (/.*filter_/, ""); sub (/\.so$/, ""); filters[sizeOfArray]= $0; } for (i=1; i<= sizeOfArray; i++) { printf ("%2d: %-15s", i, filters[i]); if (! (i%4)) printf ("\n") } printf ("\n"); done = 0; while (1) { printf ("[%d-%d|name]? ", 1, sizeOfArray); getline reply < "-"; #is a number if (reply ~ /^[0-9]+$/) { # valid number? if (reply in filters) { selfilter = filters[reply]; break; } else { print "** Invalid number"; } } else { for (i in filters) { if (filters[i] == reply) { selfilter = reply; done=1; break; } } if (done) break; print "** Invalid name"; continue; } } while (1) { printf ("(c)onfig (d)isable [default (c)]? "); getline reply < "-"; if (reply ~ /c|^$/ ) { addstr = "(c)"; break; } else if (reply ~ /d/) { addstr = "(d)"; break; } else { print "** Invalid response"; continue; } } if (addstr != "(d)") { printf ("Initial string? "); getline str < "-"; } print "You have entered filter \""selfilter addstr"="str"\"."; print selfilter"="str > outfile print addstr >> outfile } transcode-1.0.0beta2/filter/parse_csv.awk.in100644 001750 000000 00000012377 10161256042 0014467#!@PATH_TO_AWK@ -f # "strength", "Blending factor.", "%f", "0.9", "0.0", "2.0" # "range", "Apply the filter only to a range", "%u-%u", "0-0", "0", "-1", "0", "-1" # "pre", "Run as a PRE filter", "", "0" # "log", "Logfile for verbose info", "%s", "/tmp/logfile" # "filter_logoaway.so", "remove an image from the video", "v0.1.0 (2002-12-04)", "Thomas Wehrspann", "VRY", "1" # "range", "Frame Range", "%d-%d", "0-0", "0", "-1", "0", "-1" # "pos", "Position of logo", "%dx%d", "0x0", "0", "width", "0", "height" # "size", "Size of logo", "%dx%d", "10x10", "0", "widht", "0", "height" # "mode", "Filter Mode (0=none, 1=solid, 2=xy)", "%d", "0", "0", "3" # "border", "Visible Border", "", "0" # "xweight", "X-Y Weight(0%-100%)", "%d", "50", "0", "100" # "fill", "Solid Fill Color(RGB)", "%x%x%x", "0x0x0", "0", "255", "0", "255", "0", "255" # CSV parser # NR := current Record # NF := Number of fields BEGIN { if (ARGC <= 3) { print "Usage: prog INFILE FILTER_PREFIX OUTFILE" exit 1 } fprefix = ARGV[2]; delete ARGV[2]; sub(/=.*/, "", fprefix); fstring = fprefix "=" outputfile=ARGV[3]; delete ARGV[3]; init_done = 1; j = 1; FS = "\" *, *\""; } # first line is special NR == 1{ sub(/^\"/,"",$1) sub(/\"$/,"",$6) filter_name = $1; filter_comment = $2; filter_version = $3; filter_author = $4; capabilities = $5; frames_needed = $6; next } { gsub(/^\"/,"",$1) name[j] = $1; comment[j] = $2; format[j] = $3; if (format[j] ~ /^$/) { format[j] = "bool" } val[j, 0] = NF-4 for (i=4; i <= NF; i++) { gsub(/"$/,"", $i) val[j, i-3] = $i; } j++; } function parameters () { while (1) { maxlen = 0; for (i in name) { if (maxlen < length(name[i])) { maxlen = length(name[i]); } } fmt = "%-"maxlen"s" for (i=1; i<=size; i++) { str = sprintf ("%2d: "fmt" [%-3s]", i, name[i], val[i, 1]); #printf ("%2d: "fmt" [%-3s] (%s)\n", i, name[i], val[i, 1], comment[i]); printf ("%s ", str); lenstr = length(str); lencom = length(comment[i]) # if a comment ist longer than 75 chars, break it if (lenstr+lencom>=75) { com = comment[i]; j=0; blanks = "" while (j <= lenstr+1) { blanks = blanks " "; j++; } for (j = 0; j < lencom+lenstr; j+=75) { mstr = substr (com, 1, 75-lenstr); com = substr (com, 75-lenstr+1, length(com)); if (j == 0) { print "("mstr; } else { printf ("%s%s", blanks, mstr); if (j+75 >= lencom+lenstr) { printf (")\n"); } else { printf ("\n"); } } } # for } else { print "("comment[i]")"; } } print " ** Outputstring: "fstring printf ("[%d-%d (q)uit (f)ree]? ", 1, size); getline reply < "-" if (reply ~ /[Ff](ree)?/) { printf ("? "); getline newval < "-"; fstringold = fstring; fstring = fstring newval; if (fstring !~ /:$/) { fstring = fstring ":" } return -1 } if (reply ~ /[QqEe](uit|xit)?/) { print "** Quitting ..." break } if (reply !~ /^[0-9]+$/) { print "** Not a number" continue } if (reply < 1 || reply > size) { print "** Invalid number" continue } return reply } return 0 } END { if (!init_done) exit 1 size = j-1 print "Parameter for " filter_name " by " filter_author print "-- "filter_comment" --" print "Version ("filter_version") ("capabilities") (need "frames_needed" frames)" print "----------------------------" if (NR == 0) { print "** No options available"; printf ("[press anykey to continue]"); getline newval < "-"; exit 1; } doparam=1 while (doparam){ print ""; print " ** Outputstring: "fstring; printf ("(d)one (a)dd (c)ancel (u)undo (p)rint (h)elp? "); getline newval < "-"; if (newval ~ /[Cc](ancel)?/) { fstring = fprefix "="; continue; } else if (newval ~ /[Uu](ndo)?/) { fstring = fstringold; continue; } else if (newval ~ /[Dd](one)?/) { printf ("%s\n", fstring) > outputfile; fstring = fprefix; doparam=0; break } else if (newval ~ /[Aa](dd)?/) { } else if (newval ~ /[Pp](rint)?/) { print "** String: "fstring; continue; } else if (newval ~ /[Hh?](help)?/) { print "** Help **"; print "(d) ... Write the string and exit"; print "(a) ... Add a string"; print "(c) ... Will delete the string you have built so far"; print "(u) ... Will delete the last value you have added"; print "(p) ... Print the string build so far"; print "(h) ... This help"; continue; } else if (newval ~ /^?/) { continue; } else { print "** Invalid response" continue; } reply = parameters(); if (reply > 0) { print "----------------------------"; printf ("** Changing %s [%s] ** Current %s", name[reply], format[reply], val[reply,1]); for (t=2; t <= val[reply,0]; t+=2) { printf(" ** from %s to %s", val[reply,t], val[reply,t+1]); } printf ("\n"); printf ("Value? "); getline newval < "-"; fstringold = fstring; fstring = fstring name[reply] "=" newval ":"; } else if (reply < 0) { # free string } else { break; } } } transcode-1.0.0beta2/filter/filter_29to23.c100644 001750 000000 00000010610 10134622236 0014032/* * filter_29to23.c * * Copyright (C) Tilmann Bitterberg - September 2002 * (C) Max Alekseyev - July 2003 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_29to23.so" #define MOD_VERSION "v0.3 (2003-07-18)" #define MOD_CAP "frame rate conversion filter (interpolating 29 to 23)" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static unsigned char *f1 = NULL; static unsigned char *f2 = NULL; int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; if (ptr->tag & TC_AUDIO) return 0; //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_GET_CONFIG && options) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "Max Alekseyev, Tilmann Bitterberg", "VRYE", "1"); return 0; } if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. f1 = malloc (SIZE_RGB_FRAME); f2 = malloc (SIZE_RGB_FRAME); if (!f1 || !f2) { printf("[%s]: Malloc failed in %d\n", MOD_NAME, __LINE__); return -1; } if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (f1) free (f1); if (f2) free (f2); return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- /* Interpolate every 5 consecutive frames with four ones * * Original frame/time scale: * frame #: 0 1 2 3 4 * *-------*-------*-------*-------*--... * time: 0 .2 .4 .6 .8 * * Interpolated frame/time scale: * frame #: 0 1 2 3 * *-------*-x-----*---x---*-----x-*--... * time: 0 .25 .5 .75 * * Linear interpolation suggests: * NewFrame[0] = OldFrame[0] * NewFrame[1] = ( 3*OldFrame[1] + OldFrame[2] ) / 4 * NewFrame[2] = ( OldFrame[2] + OldFrame[3] ) / 2 * NewFrame[3] = ( OldFrame[3] + 3*OldFrame[4] ) / 4 */ if( ptr->tag & TC_PRE_S_PROCESS && (vob->im_v_codec == CODEC_YUV || vob->im_v_codec == CODEC_RGB) ) { int i; unsigned char *f3; switch ( ptr->id % 5 ) { case 0: break; case 1: tc_memcpy (f1, ptr->video_buf, ptr->video_size); ptr->attributes |= TC_FRAME_IS_SKIPPED; break; case 2: tc_memcpy (f2, ptr->video_buf, ptr->video_size); for (i = 0; ivideo_size; i++) ptr->video_buf[i] = (3*f1[i] + f2[i] + 1)/4; break; case 3: tc_memcpy (f1, ptr->video_buf, ptr->video_size); for (i = 0; ivideo_size; i++) ptr->video_buf[i] = (f1[i] + f2[i])/2; break; case 4: //tc_memcpy (f2, ptr->video_buf, ptr->video_size); f3 = ptr->video_buf; for (i = 0; ivideo_size; i++) ptr->video_buf[i] = (f1[i] + 3*f3[i] + 1)/4; break; } } return(0); } transcode-1.0.0beta2/filter/filter_32detect.c100644 001750 000000 00000022275 10161261376 0014523/* * filter_32detect.c * * Copyright (C) Thomas streich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_32detect.so" #define MOD_VERSION "v0.2.4 (2003-07-22)" #define MOD_CAP "3:2 pulldown / interlace detection plugin" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "transcode.h" #include "framebuffer.h" #include "filter.h" #include "optstr.h" // basic parameter #define COLOR_EQUAL 10 #define COLOR_DIFF 30 #define THRESHOLD 9 static int color_diff_threshold1[MAX_FILTER]; //=COLOR_EQUAL; static int color_diff_threshold2[MAX_FILTER]; //=COLOR_DIFF; static int chroma_diff_threshold1[MAX_FILTER]; //=COLOR_EQUAL/2; static int chroma_diff_threshold2[MAX_FILTER]; //=COLOR_DIFF/2; static int force_mode=0; static int threshold[MAX_FILTER]; //=THRESHOLD; static int chroma_threshold[MAX_FILTER]; //=THRESHOLD/2; static int show_results[MAX_FILTER]; //=0; static int pre[MAX_FILTER];// = 0; /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static inline int sq( int d ) { return d * d; } static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf(" This filter checks for interlaced video frames.\n"); printf(" Subsequent de-interlacing with transcode can be enforced with 'force_mode' option\n"); printf ("* Options\n"); printf (" 'threshold' interlace detection threshold [%d]\n", THRESHOLD); printf (" 'chromathres' interlace detection chroma threshold [%d]\n", THRESHOLD/2); printf (" 'equal' threshold for equal colors [%d]\n", COLOR_EQUAL); printf (" 'chromaeq' threshold for equal chroma [%d]\n", COLOR_EQUAL/2); printf (" 'diff' threshold for different colors [%d]\n", COLOR_DIFF); printf (" 'chromadi' threshold for different colors [%d]\n", COLOR_DIFF/2); printf (" 'force_mode' set internal force de-interlace flag with mode -I N [0]\n"); printf (" 'pre' run as pre filter [1]\n"); printf (" 'verbose' show results [off]\n"); } static int interlace_test(char *video_buf, int width, int height, int id, int instance, int thres, int eq, int diff) { int j, n, off, block, cc_1, cc_2, cc, flag; uint16_t s1, s2, s3, s4; cc_1 = 0; cc_2 = 0; block = width; flag = 0; for(j=0; j diff)) ++cc_1; if((abs(s2 - s4) < eq) && (abs(s2 - s3) > diff)) ++cc_2; off +=2*block; } } // compare results cc = (int)((cc_1 + cc_2)*1000.0/(width*height)); flag = (cc > thres) ? 1:0; if(show_results[instance]) fprintf(stderr, "(%d) frame [%06d]: (1) = %5d | (2) = %5d | (3) = %3d | interlaced = %s\n", instance, id, cc_1, cc_2, cc, ((flag)?"yes":"no")); return(flag); } int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; int is_interlaced = 0; int instance = ptr->filter_id; //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[255]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "Thomas", "VRYMEO", "1"); snprintf(buf, sizeof(buf), "%d", THRESHOLD); optstr_param (options, "threshold", "Interlace detection threshold", "%d", buf, "0", "255"); snprintf(buf, sizeof(buf), "%d", THRESHOLD/2); optstr_param (options, "chromathres", "Interlace detection chroma threshold", "%d", buf, "0", "255"); snprintf(buf, sizeof(buf), "%d", COLOR_EQUAL); optstr_param (options, "equal", "threshold for equal colors", "%d", buf, "0", "255"); snprintf(buf, sizeof(buf), "%d", COLOR_EQUAL/2); optstr_param (options, "chromaeq", "threshold for equal chroma", "%d", buf, "0", "255"); snprintf(buf, sizeof(buf), "%d", COLOR_DIFF); optstr_param (options, "diff", "threshold for different colors", "%d", buf, "0", "255"); snprintf(buf, sizeof(buf), "%d", COLOR_DIFF/2); optstr_param (options, "chromadi", "threshold for different chroma", "%d", buf, "0", "255"); optstr_param (options, "force_mode", "set internal force de-interlace flag with mode -I N", "%d", "0", "0", "5"); optstr_param (options, "pre", "run as pre filter", "%d", "1", "0", "1"); optstr_param (options, "verbose", "show results", "", "0"); return (0); } if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); color_diff_threshold1[instance] = COLOR_EQUAL; chroma_diff_threshold1[instance] = COLOR_EQUAL/2; color_diff_threshold2[instance] = COLOR_DIFF; chroma_diff_threshold2[instance] = COLOR_DIFF/2; threshold[instance] = THRESHOLD; chroma_threshold[instance] = THRESHOLD/2; show_results[instance] = 0; pre[instance] = 1; // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); // process filter options: if (options != NULL) { if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get (options, "threshold", "%d", &threshold[instance]); optstr_get (options, "chromathres", "%d", &chroma_threshold[instance]); optstr_get (options, "force_mode", "%d", &force_mode); optstr_get (options, "equal", "%d", &color_diff_threshold1[instance]); optstr_get (options, "chromaeq", "%d", &chroma_diff_threshold1[instance]); optstr_get (options, "diff", "%d", &color_diff_threshold2[instance]); optstr_get (options, "chromadi", "%d", &chroma_diff_threshold2[instance]); optstr_get (options, "pre", "%d", &pre[instance]); if (optstr_get (options, "verbose", "") >= 0) { show_results[instance]=1; } if (optstr_get (options, "help", "") >= 0) { help_optstr(); } } return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if (!(ptr->tag & TC_VIDEO)) return (0); //if((ptr->tag & TC_PRE_M_PROCESS) && (ptr->tag & TC_VIDEO)) { if(((ptr->tag & TC_PRE_M_PROCESS && pre[instance]) || (ptr->tag & TC_POST_M_PROCESS && !pre[instance])) && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { //if (ptr->tag & TC_PRE_M_PROCESS) fprintf(stderr, "32#%d pre (%d)\n", instance, ptr->id); //if (ptr->tag & TC_POST_M_PROCESS) fprintf(stderr, "32#%d post (%d)\n", instance, ptr->id); if(vob->im_v_codec==CODEC_RGB) { is_interlaced = interlace_test(ptr->video_buf, 3*ptr->v_width, ptr->v_height, ptr->id, instance, threshold[instance], color_diff_threshold1[instance], color_diff_threshold2[instance]); } else { is_interlaced += interlace_test(ptr->video_buf, ptr->v_width, ptr->v_height, ptr->id, instance, threshold[instance], color_diff_threshold1[instance], color_diff_threshold2[instance]); is_interlaced += interlace_test(ptr->video_buf+ptr->v_width*ptr->v_height, ptr->v_width/2, ptr->v_height/2, ptr->id, instance, chroma_threshold[instance], chroma_diff_threshold1[instance], chroma_diff_threshold2[instance]); is_interlaced += interlace_test(ptr->video_buf+ptr->v_width*ptr->v_height*5/4, ptr->v_width/2, ptr->v_height/2, ptr->id, instance, chroma_threshold[instance], chroma_diff_threshold1[instance], chroma_diff_threshold2[instance]); } //force de-interlacing? if(force_mode && is_interlaced) { ptr->attributes |= TC_FRAME_IS_INTERLACED; ptr->deinter_flag = force_mode; } //reset is_interlaced=0; } return(0); } transcode-1.0.0beta2/filter/filter_32drop.c100644 001750 000000 00000014211 10134622237 0014203/* * filter_32detect.c * * Copyright (C) Thomas streich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_32drop.so" #define MOD_VERSION "v0.4 (2003-02-01)" #define MOD_CAP "3:2 inverse telecine removal plugin" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "transcode.h" #include "framebuffer.h" #include "optstr.h" // basic parameter static int color_diff_threshold1=50; static int color_diff_threshold2=100; static double critical_threshold=0.00005; /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ // static int sq( int d ) { return d * d; } // unused, EMS static int interlace_test(char *video_buf, int width, int height, int id, int verbose) { int j, n, off, block, cc_1, cc_2, cc; uint16_t s1, s2, s3, s4; cc_1 = 0; cc_2 = 0; block = width; for(j=0; j color_diff_threshold2)) ++cc_1; if((abs(s2 - s4) < color_diff_threshold1) && (abs(s2 - s3) > color_diff_threshold2)) ++cc_2; off +=2*block; } } // compare results cc = (((double) (cc_1 + cc_2))/(width*height) > critical_threshold) ? 1:0; if(0) fprintf(stderr, "frame [%06d]: (1) = %5d | (2) = %5d | (3) = %f | interlaced = %s\n", id, cc_1, cc_2, (double)(cc_1 + cc_2)/(width*height), ((cc)?"yes":"no")); return(cc); } void merge_frames(unsigned char *f1, unsigned char *f2, int width, int height, int pw) { int i; char *cbuf1, *cbuf2; /* In YUV, only merge the Y plane, since CrCb planes can't be discerned * due to the merger. This lets us also reuse the code for RGB */ for (i = 0; i < height; i += 2) { tc_memcpy(&f2[i * width * pw], &f1[i * width * pw], width * pw); } /* If we're in YUV mode, the previous frame has the correct color data */ if (pw == 1) { cbuf1 = &f1[height * width]; cbuf2 = &f2[height * width]; tc_memcpy(cbuf2, cbuf1, (height * width / 2)); } } int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; static char *lastframe, *lastiframe; static int linum = -1, lfnum = -1, fnum = 0, isint = 0, dcnt = 0, dfnum = 0; if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "Thomas Oestreich", "VRYE", "1"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); lastframe = malloc(SIZE_RGB_FRAME); lastiframe = malloc(SIZE_RGB_FRAME); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { free(lastframe); free(lastiframe); return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if((ptr->tag & TC_PRE_PROCESS) && (ptr->tag & TC_VIDEO)) { if(vob->im_v_codec==CODEC_RGB) { isint = interlace_test(ptr->video_buf, 3*ptr->v_width, ptr->v_height, ptr->id, 1); } else { isint = interlace_test(ptr->video_buf, ptr->v_width, ptr->v_height, ptr->id, 1); } // fprintf(stderr, "%d %d\n", fnum, dcnt); if (isint) { linum = fnum; /* If this is the second interlaced frame in a row, do a copy of the * bottom field of the previous frame. */ if ((fnum - lfnum) == 2) { merge_frames(lastiframe, ptr->video_buf, ptr->v_width, ptr->v_height, ((vob->im_v_codec == CODEC_RGB) ? 3:1) ); } else { tc_memcpy(lastiframe, ptr->video_buf, ptr->video_size); /* The use of the drop counter ensures syncronization even with * video-based sources. */ if (dcnt < 8) { ptr->attributes |= TC_FRAME_IS_SKIPPED; dcnt += 5; dfnum++; } else { /* If we'd lose sync by dropping, copy the last frame in. * If there are more than 3 interlaced frames in a row, it's * probably video and we don't want to copy the last frame over */ if (((fnum - lfnum) < 3) && fnum) tc_memcpy(ptr->video_buf, lastframe, ptr->video_size); } } } else { tc_memcpy(lastframe, ptr->video_buf, ptr->video_size); lfnum = fnum; } /* If we're dealing with a non-interlaced source, or close to it, it won't * drop enough interlaced frames, so drop here to keep sync */ if (dcnt <= -5) { ptr->attributes |= TC_FRAME_IS_SKIPPED; dcnt += 5; dfnum++; } fnum++; dcnt--; } return(0); } transcode-1.0.0beta2/filter/filter_aclip.c100644 001750 000000 00000011363 07725633330 0014177/* * filter_aclip.c * * Copyright (C) Thomas streich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_aclip.so" #define MOD_VERSION "v0.1.1 (2003-09-04)" #define MOD_CAP "generate audio clips from source" #include #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" static uint64_t total=0; static int level=10, range=25, range_ctr=0, skip_mode=0; /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static int is_optstr(char *a) { if (strchr(a, '=')) return 1; if (strchr(a, 'h')) return 1; return 0; } int tc_filter(aframe_list_t *ptr, char *options) { int n; double sum; short *s; vob_t *vob=NULL; // API explanation: // ================ // // (1) need more infos, than get pointer to transcode global // information structure vob_t as defined in transcode.h. // // (2) 'tc_get_vob' and 'verbose' are exported by transcode. // // (3) filter is called first time with TC_FILTER_INIT flag set. // // (4) make sure to exit immediately if context (video/audio) or // placement of call (pre/post) is not compatible with the filters // intended purpose, since the filter is called 4 times per frame. // // (5) see framebuffer.h for a complete list of frame_list_t variables. // // (6) filter is last time with TC_FILTER_CLOSE flag set if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "Thomas Oestreich", "AE", "1"); optstr_param (options, "level", "The audio must be under this level to be skipped", "%d", "10", "0", "255"); optstr_param (options, "range", "Number of samples over level will be keyframes", "%d", "25", "0", "255"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); if(options!=NULL) { if (!is_optstr(options)) { n=sscanf(options,"%d:%d", &level, &range); } else { optstr_get (options, "level", "%d", &level); optstr_get (options, "range", "%d", &range); } } range_ctr=range; return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- if(verbose & TC_STATS) printf("[%s] %s/%s %s %s\n", MOD_NAME, vob->mod_path, MOD_NAME, MOD_VERSION, MOD_CAP); // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if(ptr->tag & TC_PRE_S_PROCESS && ptr->tag & TC_AUDIO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { total += (uint64_t) ptr->audio_size; s=(short *) ptr->audio_buf; sum=0; for(n=0; naudio_size>>1; ++n) { sum+=(double) ((int)(*s) * (int)(*s)); s++; } if(ptr->audio_size>0) sum = sqrt(sum)/(ptr->audio_size>>1); sum *= 1000; if(verbose & TC_DEBUG) printf("frame=%d sum=%f\n", ptr->id, sum); if(sumattributes |= TC_FRAME_IS_SKIPPED; skip_mode=1; } else ++range_ctr; } else { if(skip_mode) ptr->attributes |= TC_FRAME_IS_KEYFRAME; skip_mode = 0; range_ctr = 0; } } return(0); } transcode-1.0.0beta2/filter/filter_ascii.c100644 001750 000000 00000027037 10157425235 0014200/* * filter_ascii.c * * Copyright (C) Julien Tierny - October 2004 * Copyright (C) Thomas streich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA]. * */ #define MOD_NAME "filter_ascii.so" #define MOD_VERSION "v0.5 (2004-12-08)" #define MOD_CAP "Colored ascii-art filter plugin; render a movie into ascii-art." #define MAX_LENGTH 1024 #define TMP_FILE "raw" #define TMP_STRING_SIZE 7 #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "tc_defaults.h" #include "framebuffer.h" #include "filter.h" /* RGB2YUV features */ #include "../export/vid_aux.h" #include "optstr.h" /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ typedef struct parameter_struct{ char aart_font[PATH_MAX]; char aart_pallete[PATH_MAX]; int aart_threads; int aart_buffer; } parameter_struct; static parameter_struct *parameters = NULL; static void help_optstr(void){ printf ("[%s] Help:\n", MOD_NAME); printf ("\n* Overview:\n"); printf(" This filter renders a video sample into colored ascii art, using the `aart` package.\n"); printf(" Both YUV and RGB formats are supported, in multithreaded mode.\n"); printf("\n* Warning:\n"); printf(" Rendering a video sample into colored ascii art might take a VERY LONG TIME for the moment.\n"); printf(" Please only consider short video samples for this very version of the filter.\n"); printf ("\n* Options:\n"); printf (" 'font':\tValid PSF font file (provided with the `aart` package)\n"); printf (" 'pallete':\tValid PAL pallete file (provided with the `aart` package)\n"); printf (" 'threads':\tUse multiple-threaded routine for picture rendering (recommended = 1)\n"); printf (" 'buffer':\tUse `aart` internal buffer for output (recommended off)\n"); } int write_tmpfile(char* header, char* content, int content_size, int slot_id){ FILE* tmp = NULL; int i = 0; char* filename = NULL; filename = (char *) malloc(sizeof(char)*(strlen(TMP_FILE) + TMP_STRING_SIZE)); if (!filename){ tc_error("[%s] ... Out of memory !!!", MOD_NAME); return -1; } if (verbose & TC_DEBUG) tc_info("[%s] Temporary filename correctly allocated.\n", MOD_NAME); snprintf(filename, strlen(TMP_FILE) + TMP_STRING_SIZE, "%s-%d.tmp", TMP_FILE, slot_id); tmp = fopen(filename, "w"); if (!tmp){ tc_error("[%s] Cannot write temporary file !\n", MOD_NAME); return -1; } for(i=0; itag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "Julien Tierny", "VRYMO", "1"); optstr_param (options, "font", "Valid PSF font file (provided with the `aart` package)", "%s", "default8x9.psf"); optstr_param (options, "pallete", "Valid pallete file (provided with the `aart` package)", "%s", "colors.pal"); optstr_param(options, "threads", "Use multiple-threaded routine for picture rendering", "%d", "0", "1", "oo"); /* Boolean parameter */ optstr_param(options, "buffer", "Use `aart` internal buffer for output", "", "-1"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); /* aart sanity check */ if (tc_test_program("aart") !=0 ) return -1; /* Now, let's handle the options ... */ if((parameters = (parameter_struct *) malloc (sizeof(parameter_struct))) == NULL){ tc_error("[%s] ... Out of memory !!!", MOD_NAME); return -1; } /* Filter default options */ if (verbose & TC_DEBUG) tc_info("[%s] Preparing default options.\n", MOD_NAME); strncpy(parameters->aart_font, "default8x9.psf", strlen("default8x9.psf")); if (verbose & TC_DEBUG) tc_info("[%s] Default options correctly formated.\n", MOD_NAME); strncpy(parameters->aart_pallete, "colors.pal", strlen("colors.pal")); parameters->aart_threads = 1; parameters->aart_buffer = -1; if (options){ /* Get filter options via transcode core */ if (verbose & TC_DEBUG) tc_info("[%s] Merging options from transcode.\n", MOD_NAME); optstr_get(options, "font", "%s", ¶meters->aart_font); clean_parameter(parameters->aart_font); optstr_get(options, "pallete", "%s", ¶meters->aart_pallete); clean_parameter(parameters->aart_pallete); optstr_get(options, "threads", "%d", ¶meters->aart_threads); if (optstr_get(options, "buffer", "") >= 0) parameters->aart_buffer=1; if (optstr_get(options, "help", "") >=0) help_optstr(); if (verbose & TC_DEBUG) tc_info("[%s] Options correctly merged.\n", MOD_NAME); } if (vob->im_v_codec == CODEC_YUV){ if (tc_yuv2rgb_init(vob->im_v_width, vob->im_v_height)<0) { tc_error("[%s] Error at YUV to RGB conversion initialization.\n", MOD_NAME); return(-1); } if (tc_rgb2yuv_init(vob->im_v_width, vob->im_v_height)<0) { tc_error("[%s] Error at RGB to YUV conversion initialization.\n", MOD_NAME); return(-1); } } /* Init thread slots (multithread support)*/ init_slots(slots); if(verbose) fprintf(stdout, "[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { /* * TODO : * Provide a `aart` kill routine in case of cancel. * For the moment, transcode waits for the `aart` * process to finish before exiting. */ /* Let's free the parameter structure */ free(parameters); parameters = NULL; if (vob->im_v_codec == CODEC_YUV){ if (tc_yuv2rgb_close()<0) { tc_error("[%s] Error at YUV to RGB conversion closure.\n", MOD_NAME); return(-1); } if (tc_rgb2yuv_close()<0) { tc_error("[%s] Error at RGB to YUV conversion closure.\n", MOD_NAME); return(-1); } } return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- if(ptr->tag & TC_POST_PROCESS && ptr->tag & TC_VIDEO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { frame_slot = find_empty_slot(ptr->id, slots); switch(vob->im_v_codec){ case CODEC_RGB: return aart_render(ptr->video_buf, ptr->v_width, ptr->v_height, frame_slot, parameters->aart_font, parameters->aart_pallete, parameters->aart_threads, parameters->aart_buffer); break; case CODEC_YUV: if (tc_yuv2rgb_core(ptr->video_buf) == -1){ tc_error("[%s] Error: cannot convert YUV stream to RGB format !\n", MOD_NAME); return -1; } if (aart_render(ptr->video_buf, ptr->v_width, ptr->v_height, frame_slot, parameters->aart_font, parameters->aart_pallete, parameters->aart_threads, parameters->aart_buffer) == -1){return -1;} if (tc_rgb2yuv_core(ptr->video_buf) == -1){ tc_error("[%s] Error: cannot convert RGB stream to YUV format !\n", MOD_NAME); return -1; } break; default: tc_error("[%s] Internal video codec is not supported.\n", MOD_NAME); return -1; } free_slot(ptr->id, slots); } return(0); } transcode-1.0.0beta2/filter/filter_astat.c100644 001750 000000 00000012407 10134566042 0014214/* * filter_astat.c * * Copyright (C) Thomas streich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_astat.so" #define MOD_VERSION "v0.1.3 (2003-09-04)" #define MOD_CAP "audio statistics filter plugin" #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDINT_H #include #endif #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" static int min=0, max=0, bytes_per_sec; static long total=0; static int a_rate, a_bits, chan; static double fps, fmin, fmax, vol; static char *file; static void check (int v) { if (v > max) { max = v; } else if (v < min) { min = v; } return; } /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static int is_optstr(char *a) { if (strlen(a)>4) if (strncmp(a,"help",4)==0) return 1; if (strchr(a, '=')) return 1; return 0; } int tc_filter(aframe_list_t *ptr, char *options) { int n; short *s; vob_t *vob=NULL; // API explanation: // ================ // // (1) need more infos, than get pointer to transcode global // information structure vob_t as defined in transcode.h. // // (2) 'tc_get_vob' and 'verbose' are exported by transcode. // // (3) filter is called first time with TC_FILTER_INIT flag set. // // (4) make sure to exit immediately if context (video/audio) or // placement of call (pre/post) is not compatible with the filters // intended purpose, since the filter is called 4 times per frame. // // (5) see framebuffer.h for a complete list of frame_list_t variables. // // (6) filter is last time with TC_FILTER_CLOSE flag set if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "Thomas Oestreich", "AE", "1"); optstr_param (options, "file", "File to save the calculated volume rescale number to", "%s", ""); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); /* extract file name */ file = NULL; if(options!=NULL) { if (!is_optstr(options)) { file = strdup(options); } else { file = malloc(1024); optstr_get(options, "file", "%[^:]", file); } if(verbose) printf("[%s] saving audio scale value to '%s'\n", MOD_NAME, file); } fps=vob->fps; a_bits=vob->a_bits; a_rate=vob->a_rate; chan = vob->a_chan; return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { bytes_per_sec = a_rate * (a_bits/8) * chan; //frames = (fps*((double)total)/bytes_per_sec); fmin = -((double) min)/SHRT_MAX; fmax = ((double) max)/SHRT_MAX; if(min==0 || max == 0) exit(0); vol = (fminmod_path, MOD_NAME, MOD_VERSION, MOD_CAP); // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if(ptr->tag & TC_PRE_S_PROCESS && ptr->tag & TC_AUDIO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { total += (uint64_t) ptr->audio_size; s=(short *) ptr->audio_buf; for(n=0; naudio_size>>1; ++n) { check((int) (*s)); s++; } } return(0); } transcode-1.0.0beta2/filter/filter_clone.c100644 001750 000000 00000006711 10134574664 0014212/* * filter_clone.c * * Copyright (C) Thomas streich - August 2002 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_clone.so" #define MOD_VERSION "v0.1 (2002-08-13)" #define MOD_CAP "frame rate conversion filter" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ // demo filter, it does nothing! int tc_filter(vframe_list_t *ptr, char *options) { static int mycount=0; static int ofps=25; vob_t *vob=NULL; // API explanation: // ================ // // (1) need more infos, than get pointer to transcode global // information structure vob_t as defined in transcode.h. // // (2) 'tc_get_vob' and 'verbose' are exported by transcode. // // (3) filter is called first time with TC_FILTER_INIT flag set. // // (4) make sure to exit immediately if context (video/audio) or // placement of call (pre/post) is not compatible with the filters // intended purpose, since the filter is called 4 times per frame. // // (5) see framebuffer.h for a complete list of frame_list_t variables. // // (6) filter is last time with TC_FILTER_CLOSE flag set //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); if (options) ofps=atoi(options); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if(ptr->tag & TC_POST_S_PROCESS && ptr->tag & TC_VIDEO) { //printf("mycount (%d) ptr->id (%d) (%f)\n", mycount, ptr->id, (double)mycount*15.0/25.0); if (((double)mycount*15.0)/25.0 < (double)ptr->id) { ptr->attributes |= TC_FRAME_IS_CLONED; } // converts from 15 fps to 25 fps ++mycount; } return(0); } transcode-1.0.0beta2/filter/filter_compare.c100644 001750 000000 00000027232 10134574664 0014541/* * filter_compare * * Copyright (C) Antonio Beamud Montero * Copyright (C) Microgenesis S.A. * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_compare.so" #define MOD_VERSION "v0.1.2 (2003-08-29)" #define MOD_CAP "compare with other image to find a pattern" #define MOD_AUTHOR "Antonio Beamud" #define DELTA_COLOR 45.0 #include #include #include #include #include // FIXME: Try to implement the YUV colorspace /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "transcode.h" #include "framebuffer.h" #include "filter.h" #include "optstr.h" // transcode defines this as well as ImageMagick. #undef PACKAGE_NAME #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #undef PACKAGE_STRING #include typedef struct pixelsMask { unsigned int row; unsigned int col; unsigned char r,g,b; unsigned char delta_r,delta_g,delta_b; struct pixelsMask *next; }pixelsMask; typedef struct compareData { FILE *results; float delta; int step; pixelsMask *pixel_mask; vob_t *vob; unsigned int frames; int width, height; int size; } compareData; static compareData *compare[MAX_FILTER]; extern int rgbswap; /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" Generate a file in with information about the times, \n"); printf (" frame, etc the pattern defined in the image \n"); printf (" parameter is observed.\n"); printf ("* Options\n"); printf (" 'pattern' path to the file used like pattern\n"); printf (" 'results' path to the file used to write the results\n"); printf (" 'delta' delta error allowed\n"); } int tc_filter(vframe_list_t *ptr, char *options) { int instance = ptr->filter_id; Image *pattern, *resized, *orig = 0; ImageInfo *image_info; PixelPacket *pixel_packet; pixelsMask *pixel_last; ExceptionInfo exception_info; if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[128]; optstr_filter_desc(options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYMO", "1"); snprintf(buf, 128, "/dev/null"); optstr_param(options, "pattern", "Pattern image file path", "%s", buf); snprintf(buf, 128, "results.dat"); optstr_param(options, "results", "Results file path" , "%s", buf); snprintf(buf, 128, "%f", compare[instance]->delta); optstr_param(options, "delta", "Delta error", "%f",buf,"0.0", "100.0"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { unsigned int t,r,index; pixelsMask *temp; if((compare[instance] = (compareData *)malloc(sizeof(compareData))) == NULL) return (-1); if((compare[instance]->vob = tc_get_vob())==NULL) return(-1); compare[instance]->delta=DELTA_COLOR; compare[instance]->step=1; compare[instance]->width=0; compare[instance]->height=0; compare[instance]->frames = 0; compare[instance]->pixel_mask = NULL; pixel_last = NULL; compare[instance]->width = compare[instance]->vob->ex_v_width; compare[instance]->height = compare[instance]->vob->ex_v_height; if (options != NULL) { char pattern_name[PATH_MAX]; char results_name[PATH_MAX]; memset(pattern_name,0,PATH_MAX); memset(results_name,0,PATH_MAX); if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get(options, "pattern", "%[^:]", &pattern_name); optstr_get(options, "results", "%[^:]", &results_name); optstr_get(options, "delta", "%f", &compare[instance]->delta); if (verbose > 1) { printf("Compare Image Settings:\n"); printf(" pattern = %s\n", pattern_name); printf(" results = %s\n", results_name); printf(" delta = %f\n", compare[instance]->delta); } if (strlen(results_name) == 0) { // Ponemos el nombre del fichero al original con extension dat strcpy(results_name,"/tmp/compare.dat"); } if (!(compare[instance]->results = fopen(results_name, "w"))) { perror("could not open file for writing"); } InitializeMagick(""); if (verbose > 1) printf("[%s] Magick Initialized successfully\n", MOD_NAME); GetExceptionInfo(&exception_info); image_info = CloneImageInfo ((ImageInfo *) NULL); strcpy(image_info->filename,pattern_name); if (verbose > 1) printf("Trying to open image\n"); orig = ReadImage(image_info, &exception_info); if (orig == (Image *) NULL) { MagickWarning(exception_info.severity, exception_info.reason, exception_info.description); strcpy(pattern_name, "/dev/null"); }else{ if (verbose > 1) printf("[%s] Image loaded successfully\n", MOD_NAME); } } else{ perror("Not image provided"); } if (options != NULL) if (optstr_lookup (options, "help")) { help_optstr(); } fprintf(compare[instance]->results,"#fps:%f\n",compare[instance]->vob->fps); if (orig != NULL){ // Flip and resize if (compare[instance]->vob->im_v_codec == CODEC_YUV) TransformRGBImage(orig,YCbCrColorspace); if (verbose > 1) printf("[%s] Resizing the Image\n", MOD_NAME); resized = ResizeImage(orig, compare[instance]->width, compare[instance]->height, GaussianFilter, 1, &exception_info); if (verbose > 1) printf("[%s] Flipping the Image\n", MOD_NAME); pattern = FlipImage(resized, &exception_info); if (pattern == (Image *) NULL) { MagickError (exception_info.severity, exception_info.reason, exception_info.description); } // Filling the matrix with the pixels values not // alpha if (verbose > 1) printf("[%s] GetImagePixels\n", MOD_NAME); pixel_packet = GetImagePixels(pattern,0,0, pattern->columns, pattern->rows); if (verbose > 1) printf("[%s] Filling the Image matrix\n", MOD_NAME); for (t = 0; t < pattern->rows; t++) for (r = 0; r < pattern->columns; r++){ index = t*pattern->columns + r; if (pixel_packet[index].opacity == 0){ temp=(pixelsMask *)malloc(sizeof(struct pixelsMask)); temp->row=t; temp->col=r; temp->r = (unsigned char)pixel_packet[index].red; temp->g = (unsigned char)pixel_packet[index].green; temp->b = (unsigned char)pixel_packet[index].blue; temp->next=NULL; if (pixel_last == NULL){ pixel_last = temp; compare[instance]->pixel_mask = temp; }else{ pixel_last->next = temp; pixel_last = temp; } } } if (verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); } return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (compare[instance] != NULL) { fclose(compare[instance]->results); free(compare[instance]); } DestroyMagick(); compare[instance]=NULL; return(0); } /* filter close */ //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audio frame processing routines // or after and determines video/audio context if((ptr->tag & TC_POST_PROCESS) && (ptr->tag & TC_VIDEO)) { // For now I only support RGB color space pixelsMask *item = NULL; double sr,sg,sb; double avg_dr,avg_dg,avg_db; if (compare[instance]->vob->im_v_codec == CODEC_RGB){ int r,g,b,c; double width_long; if (compare[instance]->pixel_mask != NULL) { item = compare[instance]->pixel_mask; c = 0; sr = 0.0; sg = 0.0; sb = 0.0; width_long = compare[instance]->width*3; while(item){ r = item->row*width_long + item->col*3; g = item->row*width_long + item->col*3 + 1; b = item->row*width_long + item->col*3 + 2; // diff between points // Interchange RGB values if necesary sr = sr + (double)abs((unsigned char)ptr->video_buf[r] - item->r); sg = sg + (double)abs((unsigned char)ptr->video_buf[g] - item->g); sb = sb + (double)abs((unsigned char)ptr->video_buf[b] - item->b); item = item->next; c++; } avg_dr = sr/(double)c; avg_dg = sg/(double)c; avg_db = sb/(double)c; if ((avg_dr < compare[instance]->delta) && (avg_dg < compare[instance]->delta) && (avg_db < compare[instance]->delta)) fprintf(compare[instance]->results,"1"); else fprintf(compare[instance]->results,"n"); fflush(compare[instance]->results); } compare[instance]->frames++; return(0); }else{ // The colospace is YUV // FIXME: Doesn't works, I need to code all this part // again int Y,Cr,Cb,c; if (compare[instance]->pixel_mask != NULL) { item = compare[instance]->pixel_mask; c = 0; sr = 0.0; sg = 0.0; sb = 0.0; while(item){ Y = item->row*compare[instance]->width + item->col; Cb = compare[instance]->height*compare[instance]->width + (int)((item->row*compare[instance]->width + item->col)/4); Cr = compare[instance]->height*compare[instance]->width + (int)((compare[instance]->height*compare[instance]->width)/4) + (int)((item->row*compare[instance]->width + item->col)/4); // diff between points // Interchange RGB values if necesary sr = sr + (double)abs((unsigned char)ptr->video_buf[Y] - item->r); sg = sg + (double)abs((unsigned char)ptr->video_buf[Cb] - item->g); sb = sb + (double)abs((unsigned char)ptr->video_buf[Cr] - item->b); item = item->next; c++; } avg_dr = sr/(double)c; avg_dg = sg/(double)c; avg_db = sb/(double)c; if ((avg_dr < compare[instance]->delta) && (avg_dg < compare[instance]->delta) && (avg_db < compare[instance]->delta)) fprintf(compare[instance]->results,"1"); else fprintf(compare[instance]->results,"n"); } compare[instance]->frames++; return(0); } } return(0); } // Proposal: // Tilmann Bitterberg Sat, 14 Jun 2003 00:29:06 +0200 (CEST) // // char *Y, *Cb, *Cr; // Y = p->video_buf; // Cb = p->video_buf + mydata->width*mydata->height; // Cr = p->video_buf + 5*mydata->width*mydata->height/4; // for (i=0; iwidth*mydata->height; i++) { // pixel_packet->red == *Y++; // get_next_pixel(); // } // for (i=0; iwidth*mydata->height>>2; i++) { // pixel_packet->green == *Cr++; // pixel_packet->blue == *Cb++; // get_next_pixel(); // } transcode-1.0.0beta2/filter/filter_control.c100644 001750 000000 00000016220 07762635671 0014577/* * filter_control * * Copyright (C) Tilmann Bitterberg - June 2002 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_control.so" #define MOD_VERSION "v0.0.1 (2003-11-29)" #define MOD_CAP "apply a filter control list" #define MOD_AUTHOR "Tilmann Bitterberg" #include #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "transcode.h" #include "framebuffer.h" #include "optstr.h" #include "src/socket.h" #ifndef M_BUF_SIZE #define M_BUF_SIZE 8192 #endif typedef struct cmd_t { char *cmd; int (*action)(char *); } cmd_t; struct cmd_t actions[]={ {"preview", tc_socket_preview }, {"parameter", tc_socket_parameter}, {"list", tc_socket_list }, {"config", tc_socket_config }, {"disable", tc_socket_disable }, {"enable", tc_socket_enable }, {"load", tc_socket_load }, {NULL, NULL } }; static int init_done = 0; typedef struct ctrl_t{ char *file; FILE *f; char *ofile; FILE *of; } ctrl_t; typedef struct flist_t { unsigned int frame; char *line; struct cmd_t *cmd; struct flist_t *next; } flist_t; #define cprintf(fmt,args...) fprintf(stderr, "[control] " fmt "\n", ## args) #define mmalloc(str,type) \ do { \ str = (type *)malloc(sizeof(type)); \ if (!str) { cprintf("(%s:%d) No Memory for %s", __FILE__, __LINE__, #str); return -1;} \ memset(str, 0, sizeof(type)); \ } while (0) static int parse_input_list (ctrl_t *ctrl, flist_t **flist_tofill); int tc_filter(frame_list_t *ptr, char *options) { static ctrl_t *ctrl = NULL; static flist_t *flist = NULL; static flist_t *first = NULL; if (ptr->tag & TC_AUDIO) return 0; if (ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "Tilmann Bitterberg", "VRYE", "1"); optstr_param (options, "file", "read commands to apply from file.", "%s", ""); optstr_param (options, "ofile", "write output of commands to output file", "%s", "/dev/null"); return 0; } if (ptr->tag & TC_FILTER_INIT && !init_done) { char *file = NULL; int ret; if (!options) { cprintf("This filter makes no sense without options"); goto init_e_out; } mmalloc(ctrl, ctrl_t); file = malloc (M_BUF_SIZE); memset (file, 0, M_BUF_SIZE); optstr_get (options, "file", "%[^:]", file); if (strlen(file)>0) { ctrl->file = strdup(file); } else { cprintf("The \"file\" option is mandatory"); goto init_e_out; } if (NULL == (ctrl->f = fopen(ctrl->file, "r"))) { cprintf("Cannot open \"%s\"", ctrl->file); goto init_e_out; } memset (file, 0, M_BUF_SIZE); optstr_get (options, "ofile", "%[^:]", file); if (strlen(file)>0) { ctrl->ofile = strdup(file); if (NULL == (ctrl->of = fopen(ctrl->ofile, "w"))) { cprintf("Cannot open \"%s\"", ctrl->ofile); goto init_e_out; } } ret = parse_input_list (ctrl, &flist); if (ret < 0) { cprintf("An error occurred parsing the command file"); return -1; } if (flist == NULL) { cprintf("WTF? Nothing to do"); return -1; } first = flist; for (first = flist; flist->next; flist = flist->next) { //cprintf("Frame %u -> %s", flist->frame, flist->line); } // sort the list? flist = first; init_done++; free(file); return 0; init_e_out: if (ctrl && ctrl->ofile) free (ctrl->ofile); ctrl->ofile = NULL; if (ctrl && ctrl->file) free (ctrl->file); ctrl->file = NULL; if (ctrl) free(ctrl); ctrl = NULL; if (file) free(file); file = NULL; return -1; } // INIT if(ptr->tag & TC_FILTER_CLOSE) { flist = first; while (flist) { first = flist->next; free(flist->line); free(flist); flist = first; } if (!ctrl) return 0; if (ctrl->f) fclose (ctrl->f); if (ctrl->of) fclose (ctrl->of); if (ctrl->ofile) free(ctrl->ofile); if (ctrl->file) free(ctrl->file); free (ctrl); ctrl = NULL; } // CLOSE if(ptr->tag & TC_PRE_S_PROCESS) { int ret; char buf[M_BUF_SIZE]; flist = first; if (!flist) { cprintf("No more actions"); return 0; } // there may be more actions per frame while (ptr->id == flist->frame) { strcpy (buf, flist->line); ret = flist->cmd->action(buf); if (buf[strlen(buf)-1] == '\n') { if (ctrl->of) { fprintf(ctrl->of, "** Result at frame %d of \"%s\":\n", ptr->id, flist->line); fprintf(ctrl->of, "%s", buf); } } //if (verbose & TC_DEBUG) cprintf("Executed at %d \"%s\"", ptr->id, flist->line); first = flist->next; free (flist->line); free (flist); flist = first; if (flist == NULL) break; } return 0; } // PROCESS return 0; } #define skipws(a) while (a && *a && isspace(*a++)) static int parse_input_list (ctrl_t *ctrl, flist_t **flist_tofill) { char *buf; int count = 1; flist_t *first; flist_t *flist; char *fnum, *action, *line; fnum = action = line = NULL; buf = malloc (M_BUF_SIZE); memset (buf, 0, M_BUF_SIZE); mmalloc (flist, flist_t); first = flist; while ( fgets(buf, M_BUF_SIZE, ctrl->f) ) { cmd_t *cmd = &actions[0]; buf[strlen(buf)-1] = '\0'; line = buf; skipws(line); if (!line) { cprintf("Syntax error at line %d -- empty?", count); return -2;} line--; fnum = line; if (*fnum == '#' || strlen(line)<2) { count++; continue; } action = strchr(line, ' '); if (!action) { cprintf("Syntax error at line %d", count); return -2;} skipws(action); if (!action) { cprintf("Syntax error at line %d", count); return -2;} action--; // fnum points to the frame number // action points to the requested function name // look up the requested action in the table while (cmd->cmd) { if (strncasecmp(cmd->cmd, action, 4) == 0) break; cmd++; } if (cmd->cmd == NULL) { cprintf("Warning at line %d: unknown command (%s) found -- ignored", count, action); count++; continue; } flist->frame = strtol(fnum, (char **)NULL, 10); flist->line = strdup (action); flist->cmd = cmd; mmalloc (flist->next, flist_t); flist = flist->next; count++; } count--; cprintf("Found %d lines", count); *flist_tofill = first; return 0; } transcode-1.0.0beta2/filter/filter_cpaudio.c100644 001750 000000 00000011716 07745724331 0014541/* * filter_cpaudio.c * * Copyright (C) William H Wittig - May 2003 * Still GPL, of course * * This filter takes the audio signal on one channel and dupes it on * the other channel. * Only supports 16 bit stereo (for now) * * based on filter_null.c from transcode - orignal copyright below * * Copyright (C) Thomas streich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_cpaudio.so" #define MOD_VERSION "v0.1 (2003-04-30)" #define MOD_CAP "copy one audio channel to the other channel filter plugin" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" /*------------------------------------------------- * local utility functions *-------------------------------------------------*/ static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" Copies audio from one channel to another\n"); printf ("* Options\n"); printf (" 'source=['l' or 'r']\n"); } /*------------------------------------------------- * single function interface *-------------------------------------------------*/ int tc_filter(aframe_list_t *ptr, char *options) { vob_t *vob=NULL; static int sourceChannel = 0; // Init to left. '1' = right // API explanation: // ================ // // (1) need more info, then get pointer to transcode global // information structure vob_t as defined in transcode.h. // // (2) 'tc_get_vob' and 'verbose' are exported by transcode. // // (3) filter is called first time with TC_FILTER_INIT flag set. // // (4) make sure to exit immediately if context (video/audio) or // placement of call (pre/post) is not compatible with the filters // intended purpose, since the filter is called 4 times per frame. // // (5) see framebuffer.h for a complete list of frame_list_t variables. // // (6) filter is called last time with TC_FILTER_CLOSE flag set if (ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "William H Wittig", "AO", "1"); optstr_param (options, "source", "Source channel (l=left, r=right)", "%c", "l", "l", "r"); return 0; } //---------------------------------- // filter init //---------------------------------- if (ptr->tag & TC_FILTER_INIT) { if ((vob = tc_get_vob()) == NULL) return (-1); if (vob->dm_bits != 16) { fprintf (stderr, "This filter only works for 16 bit samples\n"); return (-1); } if (options != NULL) { char srcChannel; optstr_get(options, "source", "%c", &srcChannel); if (srcChannel == 'l') sourceChannel = 0; else sourceChannel = 1; } if (options) if (optstr_lookup (options, "help")) { help_optstr(); } // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); return(0); } //---------------------------------- // filter close //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { return(0); } //---------------------------------- // filter frame routine //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if(ptr->tag & TC_POST_PROCESS && ptr->tag & TC_AUDIO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { int16_t* data = (int16_t *)ptr->audio_buf; int len = ptr->audio_size / 2; // 16 bits samples int i; // if(verbose) printf("[%s] Length: %d, Source: %d\n", MOD_NAME, len, sourceChannel); for (i = 0; i < len; i += 2) // Implicitly assumes even number of samples (e.g. l,r pairs) { if (sourceChannel == 0) data[i+1] = data[i]; else data[i] = data[i+1]; } } return(0); } transcode-1.0.0beta2/filter/filter_cshift.c100644 001750 000000 00000014176 10134622237 0014364/* * filter_cshift.c * * Copyright (C) Thomas streich, Chad Page - February/March 2002 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_cshift.so" #define MOD_VERSION "v0.2.1 (2003-01-21)" #define MOD_CAP "chroma-lag shifter" #define MOD_AUTHOR "Thomas streich, Chad Page" #include #include static char *buffer; static int loop=1; /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" void crshift_yuv(char * buffer, vob_t *vob, int shift) { int x, y; char * craddr; char * cbaddr; char * addr; craddr = &buffer[(vob->im_v_width * vob->im_v_height)]; cbaddr = &buffer[(vob->im_v_width * vob->im_v_height) * 5 / 4]; for (y = 0; y < (vob->im_v_height / 2); y++) { for (x = 0; x < ((vob->im_v_width / 2) - shift); x++) { addr = &craddr[(y * (vob->im_v_width / 2)) + x]; *addr = addr[shift]; addr = &cbaddr[(y * (vob->im_v_width / 2)) + x]; *addr = addr[shift]; } } } void rgb2yuv(unsigned char *out, unsigned char *in, int width) { int i, r, g, b; /* i = Y, i+1 = Cr, i+2 = Cb */ for (i = 0; i < (width * 3); i+=3) { r = in[i]; g = in[i+1]; b = in[i+2]; out[i] = (r * 299 / 1000) + (g * 587 / 1000) + (b * 115 / 1000); out[i+1] = (-(r * 169 / 1000) - (g * 331 / 1000) + (b / 2)) + 128; out[i+2] = ((r / 2) - (g * 418 / 1000) - (b * 816 / 10000)) + 128; } } void yuv2rgb(unsigned char *out, unsigned char *in, int width) { int i, r, g, b; /* i = Y, i+1 = Cr, i+2 = Cb */ for (i = 0; i < (width * 3); i+=3) { b = in[i] + ((in[i+1] - 128) * 14022 / 10000); g = in[i] - ((in[i+2] - 128) * 3456 / 10000) - ((in[i+1] - 128.0) * 7145 / 10000); r = in[i] + ((in[i+2] - 128) * 1771 / 1000); if (r < 0) r = 0; if (g < 0) g = 0; if (b < 0) b = 0; if (r > 255) r = 255; if (g > 255) g = 255; if (b > 255) b = 255; out[i] = r; out[i+1] = g; out[i+2] = b; } } void crshift_rgb(unsigned char * buffer, vob_t *vob, int shift) { unsigned char buffer_yuv[4096]; int y, x; for (y = 0; y < vob->im_v_height; y++) { rgb2yuv(buffer_yuv, &buffer[y * (vob->im_v_width * 3)], vob->im_v_width); for (x = 0; x < ((vob->im_v_width - shift) * 3); x+=3) { buffer_yuv[x + 1] = buffer_yuv[x + ((shift * 3) + 1)]; buffer_yuv[x + 2] = buffer_yuv[x + ((shift * 3) + 2)]; } yuv2rgb(&buffer[y * (vob->im_v_width * 3)], buffer_yuv, vob->im_v_width); } } /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ // old or new syntax? int is_optstr (char *buf) { if (strchr(buf, '=')) return 1; if (strchr(buf, 's')) return 1; if (strchr(buf, 'h')) return 1; return 0; } int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; // API explanation: // ================ // // (1) need more infos, than get pointer to transcode global // information structure vob_t as defined in transcode.h. // // (2) 'tc_get_vob' and 'verbose' are exported by transcode. // // (3) filter is called first time with TC_FILTER_INIT flag set. // // (4) make sure to exit immediately if context (video/audio) or // placement of call (pre/post) is not compatible with the filters // intended purpose, since the filter is called 4 times per frame. // // (5) see framebuffer.h for a complete list of frame_list_t variables. // // (6) filter is last time with TC_FILTER_CLOSE flag set if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[32]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYE", "1"); snprintf(buf, 32, "%d", loop); optstr_param (options, "shift", "Shift chroma(color) to the left", "%d", buf, "0", "width"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); if (!buffer) buffer = malloc(SIZE_RGB_FRAME); if(options != NULL) { if (!is_optstr(options)) { // old syntax loop=atoi(options); } else { optstr_get (options, "shift", "%d", &loop); } } return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (buffer) free(buffer); buffer = NULL; return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if(ptr->tag & TC_PRE_M_PROCESS && ptr->tag & TC_VIDEO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { tc_memcpy(buffer, ptr->video_buf, ptr->v_width*ptr->v_height*3); if (vob->im_v_codec == CODEC_YUV) crshift_yuv(buffer, vob, loop); if (vob->im_v_codec == CODEC_RGB) crshift_rgb(buffer, vob, loop); tc_memcpy(ptr->video_buf, buffer, ptr->v_width*ptr->v_height*3); } return(0); } transcode-1.0.0beta2/filter/filter_cut.c100644 001750 000000 00000012475 10174077273 0013707/** * @file filter_cut.c Encode only listed frames * * Copyright (C) Thomas streich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* * ChangeLog: * v0.1.0 (2003-05-03) * * v0.2 (2005-01-05) Thomas Wehrspann * -Documentation added * -optstr_filter_desc now returns * the right capability flags */ #define MOD_NAME "filter_cut.so" #define MOD_VERSION "v0.2 (2005-01-05)" #define MOD_CAP "encode only listed frames" #define MOD_AUTHOR "Thomas streich" #include #include #include #include // do the mod/step XXX /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" #include "libioaux/framecode.h" extern int max_frame_buffer; extern void tc_import_stop(void); /** * Help text. * This function prints out a small description of this filter and * the command-line options when the "help" parameter is given *********************************************************/ static void help_optstr(void) { printf ("[%s] help : * Overview \n", MOD_NAME); printf ("[%s] help : This filter extracts frame regions, so that only frames in the \n", MOD_NAME); printf ("[%s] help : listed ranges get encoded. \n", MOD_NAME); printf ("[%s] help : \n", MOD_NAME); printf ("[%s] help : * Options \n", MOD_NAME); printf ("[%s] help : 'help' Prints out this help text \n", MOD_NAME); printf ("[%s] help : 'start-end/step [...]' Encodes only frames in the given ranges (start-end/step) [0-oo/1]\n", MOD_NAME); } /** * Main function of a filter. * This is the single function interface to transcode. This is the only function needed for a filter plugin. * @param ptr frame accounting structure * @param options command-line options of the filter * * @return 0, if everything went OK. *********************************************************/ int tc_filter(vframe_list_t *ptr, char *options) { static struct fc_time *list; static double avoffset=1.0; char separator[] = " "; vob_t *vob=NULL; //---------------------------------- // // filter get config // //---------------------------------- if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VARY4E", "1"); optstr_param (options, "start-end/step [...]", "Encodes only frames in the given ranges", "%s", ""); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(verbose & TC_DEBUG) printf("[%s] options=%s\n", MOD_NAME, options); // Parameter parsing if(options == NULL) return(0); else if (optstr_lookup (options, "help")) { help_optstr(); return (0); } else { if( parse_fc_time_string( options, vob->fps, separator, verbose, &list ) == -1 ) { help_optstr(); return (-1); } } avoffset = vob->fps/vob->ex_fps; return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audio frame processing routines // or after and determines video/audio context if((ptr->tag & TC_PRE_S_PROCESS) && (ptr->tag & TC_VIDEO)) { // fc_frame_in_time returns the step frequency int ret = fc_frame_in_time(list, ptr->id); if (!(ret && !(ptr->id%ret))) ptr->attributes |= TC_FRAME_IS_SKIPPED; // last cut region finished? if (tail_fc_time(list)->etf+max_frame_buffer < ptr->id) tc_import_stop(); } else if ((ptr->tag & TC_PRE_S_PROCESS) && (ptr->tag & TC_AUDIO)){ int ret; int tmp_id; tmp_id = (int)((double)ptr->id*avoffset); ret = fc_frame_in_time(list, tmp_id); if (!(ret && !(tmp_id%ret))) ptr->attributes |= TC_FRAME_IS_SKIPPED; } return(0); } transcode-1.0.0beta2/filter/filter_denoise3d.c100644 001750 000000 00000034502 10134574664 0014766/* Copyright (C) 2003 Daniel Moreno Converted for use in transcode by Tilmann Bitterberg Converted hqdn3d -> denoise3d and also heavily optimised for transcode by Erik Slagter (GPL) 2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define MOD_NAME "filter_denoise3d.so" #define MOD_VERSION "v1.0.6 (2003-12-20)" #define MOD_CAP "High speed 3D Denoiser" #define MOD_AUTHOR "Daniel Moreno & A'rpi" #define module "[" MOD_NAME "]: " /* set tabstop=4 for best layout Changelog 1.0.3 EMS first public version 1.0.4 EMS added YUV422 support 1.0.5 EMS added RGB support large cleanup added arbitrary layout support denoising U&V (colour) planes now actually works 1.0.6 EMS fixed annoying typo */ #include #include #include #include #include #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "filter.h" #include "optstr.h" #define MAX_PLANES 3 #define DEFAULT_LUMA_SPATIAL 4.0 #define DEFAULT_CHROMA_SPATIAL 3.0 #define DEFAULT_LUMA_TEMPORAL 6.0 #define DEFAULT_CHROMA_TEMPORAL 4.0 typedef enum { dn3d_yuv420p, dn3d_yuv422, dn3d_rgb } dn3d_fmt_t; typedef enum { dn3d_planar, dn3d_packed } dn3d_basic_layout_t; typedef enum { dn3d_luma, dn3d_chroma, dn3d_disabled } dn3d_plane_type_t; typedef enum { dn3d_off_y420, dn3d_off_u420, dn3d_off_v420, dn3d_off_y, dn3d_off_u, dn3d_off_v, dn3d_off_r, dn3d_off_g, dn3d_off_b } dn3d_offset_t; typedef struct { dn3d_plane_type_t plane_type; dn3d_offset_t offset; int skip; int scale_x; int scale_y; } dn3d_single_layout_t; typedef struct { int tc_fmt; dn3d_fmt_t fmt; dn3d_basic_layout_t layout_type; dn3d_single_layout_t layout[MAX_PLANES]; } dn3d_layout_t; typedef struct { vob_t * vob; dn3d_layout_t layout_data; struct { double luma_spatial; double chroma_spatial; double luma_temporal; double chroma_temporal; } parameter; int coefficients[4][512]; unsigned char * lineant; unsigned char * previous; int prefilter; int enable_luma; int enable_chroma; } dn3d_private_data_t; static dn3d_private_data_t dn3d_private_data[MAX_FILTER]; static const dn3d_layout_t dn3d_layout[] = { { CODEC_YUV, dn3d_yuv420p, dn3d_planar, {{ dn3d_luma, dn3d_off_y420, 1, 1, 1 }, { dn3d_chroma, dn3d_off_u420, 1, 2, 2 }, { dn3d_chroma, dn3d_off_v420, 1, 2, 2 }}}, { CODEC_YUV422, dn3d_yuv422, dn3d_packed, {{ dn3d_luma, dn3d_off_y, 2, 1, 1 }, { dn3d_chroma, dn3d_off_u, 4, 2, 1 }, { dn3d_chroma, dn3d_off_v, 4, 2, 1 }}}, { CODEC_RGB, dn3d_rgb, dn3d_packed, {{ dn3d_luma, dn3d_off_r, 3, 1, 1 }, { dn3d_luma, dn3d_off_g, 3, 1, 1 }, { dn3d_luma, dn3d_off_b, 3, 1, 1 }}} }; #define LowPass(prev, curr, coef) (curr + coef[prev - curr]) static inline int ABS(int i) { return(((i) >= 0) ? i : (0 - i)); } static void deNoise(unsigned char * frame, unsigned char * frameprev, unsigned char * lineant, int w, int h, int * horizontal, int * vertical, int * temporal, int offset, int skip) { int x, y; unsigned char pixelant; unsigned char * lineantptr = lineant; horizontal += 256; vertical += 256; temporal += 256; frame += offset; frameprev += offset; // First pixel has no left nor top neighbour, only previous frame *lineantptr = pixelant = *frame; *frame = *frameprev = LowPass(*(frameprev), *lineantptr, temporal); frame += skip; frameprev += skip; lineantptr++; // First line has no top neighbour, only left one for each pixel and last frame for(x = 1; x < w; x++) { pixelant = LowPass(pixelant, *frame, horizontal); *lineantptr = pixelant; *frame = *frameprev = LowPass(*(frameprev), *lineantptr, temporal); frame += skip; frameprev += skip; lineantptr++; } for (y = 1; y < h; y++) { lineantptr = lineant; // First pixel on each line doesn't have previous pixel pixelant = *frame; *lineantptr = LowPass(*lineantptr, pixelant, vertical); *frame = *frameprev = LowPass(*(frameprev), *lineantptr, temporal); frame += skip; frameprev += skip; lineantptr++; for (x = 1; x < w; x++) { // The rest is normal pixelant = LowPass(pixelant, *frame, horizontal); *lineantptr = LowPass(*lineantptr, pixelant, vertical); *frame = *frameprev = LowPass(*(frameprev), *lineantptr, temporal); // *frame ^= 255; // debug frame += skip; frameprev += skip; lineantptr++; } } } static void PrecalcCoefs(int * ct, double dist25) { int i; double gamma, simil, c; gamma = log(0.25) / log(1.0 - dist25 / 255.0); for(i = -256; i <= 255; i++) { simil = 1.0 - (double)ABS(i) / 255.0; c = pow(simil, gamma) * (double)i; ct[256 + i] = (int)((c < 0) ? (c - 0.5) : (c + 0.5)); } } static void help_optstr() { fprintf(stderr, "[%s] (%s) help\n", MOD_NAME, MOD_CAP); fprintf(stderr, "* Overview\n"); fprintf(stderr, " This filter aims to reduce image noise producing\n"); fprintf(stderr, " smooth images and making still images really still\n"); fprintf(stderr, " (This should enhance compressibility).\n"); fprintf(stderr, "* Options\n"); fprintf(stderr, " luma: spatial luma strength (%f)\n", DEFAULT_LUMA_SPATIAL); fprintf(stderr, " chroma: spatial chroma strength (%f)\n", DEFAULT_CHROMA_SPATIAL); fprintf(stderr, " luma_strength: temporal luma strength (%f)\n", DEFAULT_LUMA_TEMPORAL); fprintf(stderr, " chroma_strength: temporal chroma strength (%f)\n", DEFAULT_CHROMA_TEMPORAL); fprintf(stderr, " pre: run as a pre filter (0)\n"); } int tc_filter(vframe_list_t * vframe, char * options) { int instance; int tag = vframe->tag; dn3d_private_data_t * pd; if(tag & TC_AUDIO) return(0); instance = vframe->filter_id; pd = &dn3d_private_data[instance]; if(tag & TC_FILTER_GET_CONFIG) { char buf[128]; optstr_filter_desc(options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VYMOE", "2"); snprintf(buf, 128, "%f", DEFAULT_LUMA_SPATIAL); optstr_param(options, "luma", "spatial luma strength", "%f", buf, "0.0", "100.0" ); snprintf(buf, 128, "%f", DEFAULT_CHROMA_SPATIAL); optstr_param(options, "chroma", "spatial chroma strength", "%f", buf, "0.0", "100.0" ); snprintf(buf, 128, "%f", DEFAULT_LUMA_TEMPORAL); optstr_param(options, "luma_strength", "temporal luma strength", "%f", buf, "0.0", "100.0" ); snprintf(buf, 128, "%f", DEFAULT_CHROMA_TEMPORAL); optstr_param(options, "chroma_strength", "temporal chroma strength", "%f", buf, "0.0", "100.0" ); snprintf(buf, 128, "%d", dn3d_private_data[instance].prefilter); optstr_param(options, "pre", "run as a pre filter", "%d", buf, "0", "1" ); } if(tag & TC_FILTER_INIT) { int format_index, plane_index, found; const dn3d_layout_t * lp; size_t size; if(!(pd->vob = tc_get_vob())) return(TC_IMPORT_ERROR); pd->parameter.luma_spatial = 0; pd->parameter.luma_temporal = 0; pd->parameter.chroma_spatial = 0; pd->parameter.chroma_temporal = 0; if(!options) { fprintf(stderr, module "options not set!\n"); return(TC_IMPORT_ERROR); } if(optstr_lookup(options, "help")) { help_optstr(); return(TC_IMPORT_ERROR); } optstr_get(options, "luma", "%lf", &pd->parameter.luma_spatial); optstr_get(options, "luma_strength", "%lf", &pd->parameter.luma_temporal); optstr_get(options, "chroma", "%lf", &pd->parameter.chroma_spatial); optstr_get(options, "chroma_strength", "%lf", &pd->parameter.chroma_temporal); optstr_get(options, "pre", "%d", &dn3d_private_data[instance].prefilter); if((pd->parameter.luma_spatial < 0) || (pd->parameter.luma_temporal < 0)) pd->enable_luma = 0; else { pd->enable_luma = 1; if(pd->parameter.luma_spatial == 0) { if(pd->parameter.luma_temporal == 0) { pd->parameter.luma_spatial = DEFAULT_LUMA_SPATIAL; pd->parameter.luma_temporal = DEFAULT_LUMA_TEMPORAL; } else { pd->parameter.luma_spatial = pd->parameter.luma_temporal * 3 / 2; } } else { if(pd->parameter.luma_temporal == 0) { pd->parameter.luma_temporal = pd->parameter.luma_spatial * 2 / 3; } } } if((pd->parameter.chroma_spatial < 0) || (pd->parameter.chroma_temporal < 0)) pd->enable_chroma = 0; else { pd->enable_chroma = 1; if(pd->parameter.chroma_spatial == 0) { if(pd->parameter.chroma_temporal == 0) { pd->parameter.chroma_spatial = DEFAULT_CHROMA_SPATIAL; pd->parameter.chroma_temporal = DEFAULT_CHROMA_TEMPORAL; } else { pd->parameter.chroma_spatial = pd->parameter.chroma_temporal * 3 / 2; } } else { if(pd->parameter.chroma_temporal == 0) { pd->parameter.chroma_temporal = pd->parameter.chroma_spatial * 2 / 3; } } } for(format_index = 0, found = 0; format_index < (sizeof(dn3d_layout) / sizeof(*dn3d_layout)); format_index++) { if(pd->vob->im_v_codec == dn3d_layout[format_index].tc_fmt) { found = 1; break; } } if(!found) { fprintf(stderr, "[%s] This filter is only capable of YUV, YUV422 and RGB mode\n", MOD_NAME); return(TC_IMPORT_ERROR); } lp = &dn3d_layout[format_index]; pd->layout_data = *lp; for(plane_index = 0; plane_index < MAX_PLANES; plane_index++) { if((pd->layout_data.layout[plane_index].plane_type == dn3d_luma) && !pd->enable_luma) pd->layout_data.layout[plane_index].plane_type = dn3d_disabled; if((pd->layout_data.layout[plane_index].plane_type == dn3d_chroma) && !pd->enable_chroma) pd->layout_data.layout[plane_index].plane_type = dn3d_disabled; } size = pd->vob->im_v_width * MAX_PLANES * sizeof(char) * 2; if(!!(pd->lineant = malloc(size))) memset(pd->lineant, 0, size); else fprintf(stderr, module "malloc failed\n"); size *= pd->vob->im_v_height * 2; if(!!(pd->previous = malloc(size))) memset(pd->previous, 0, size); else fprintf(stderr, module "malloc failed\n"); PrecalcCoefs(pd->coefficients[0], pd->parameter.luma_spatial); PrecalcCoefs(pd->coefficients[1], pd->parameter.luma_temporal); PrecalcCoefs(pd->coefficients[2], pd->parameter.chroma_spatial); PrecalcCoefs(pd->coefficients[3], pd->parameter.chroma_temporal); if(verbose) { fprintf(stderr, "[%s]: %s %s #%d\n", MOD_NAME, MOD_VERSION, MOD_CAP, instance); fprintf(stderr, "[%s]: Settings luma (spatial): %.2f luma_strength (temporal): %.2f chroma (spatial): %.2f chroma_strength (temporal): %.2f\n", MOD_NAME, pd->parameter.luma_spatial, pd->parameter.luma_temporal, pd->parameter.chroma_spatial, pd->parameter.chroma_temporal); printf("[%s]: luma enabled: %s, chroma enabled: %s\n", MOD_NAME, pd->enable_luma ? "yes" : "no", pd->enable_chroma ? "yes" : "no"); } } if(((tag & TC_PRE_PROCESS && pd->prefilter) || (tag & TC_POST_PROCESS && !pd->prefilter)) && !(vframe->attributes & TC_FRAME_IS_SKIPPED)) { int plane_index, coef[2]; int offset = 0; const dn3d_single_layout_t * lp; for(plane_index = 0; plane_index < MAX_PLANES; plane_index++) { lp = &pd->layout_data.layout[plane_index]; if(lp->plane_type != dn3d_disabled) { // if(plane_index != 2) // debug // continue; coef[0] = (lp->plane_type == dn3d_luma) ? 0 : 2; coef[1] = coef[0] + 1; switch(lp->offset) { case(dn3d_off_r): offset = 0; break; case(dn3d_off_g): offset = 1; break; case(dn3d_off_b): offset = 2; break; case(dn3d_off_y420): offset = vframe->v_width * vframe->v_height * 0 / 4; break; case(dn3d_off_u420): offset = vframe->v_width * vframe->v_height * 4 / 4; break; case(dn3d_off_v420): offset = vframe->v_width * vframe->v_height * 5 / 4; break; case(dn3d_off_y): offset = 1; break; case(dn3d_off_u): offset = 0; break; case(dn3d_off_v): offset = 2; break; } #if 0 fprintf(stderr, "buffers1: %lu, %lu, %lu\nbuffers2: %lu, %lu, %lu\n", vframe->video_buf_Y[0] - vframe->video_buf, vframe->video_buf_U[0] - vframe->video_buf, vframe->video_buf_V[0] - vframe->video_buf, 0, (pd->vob->im_v_width * pd->vob->im_v_height * 4/4), (pd->vob->im_v_width * pd->vob->im_v_height * 5/4)); #endif #if 0 fprintf(stderr, "%d -> %p, %p, %p\n%d,%d\n%p, %p, %p\n%d, %d\n", plane_index, vframe->video_buf, // frame pd->previous, // previous (saved) frame pd->lineant, // line buffer vframe->v_width / lp->scale_x, // width (pixels) vframe->v_height / lp->scale_y, // height (pixels) pd->coefficients[coef[0]], // horizontal (spatial) strength pd->coefficients[coef[0]], // vertical (spatial) strength pd->coefficients[coef[1]], // temporal strength offset, // offset in bytes of first relevant pixel in frame lp->skip // skip this amount of bytes between two pixels ); #endif deNoise(vframe->video_buf, // frame pd->previous, // previous (saved) frame pd->lineant, // line buffer vframe->v_width / lp->scale_x, // width (pixels) vframe->v_height / lp->scale_y, // height (pixels) // debug pd->coefficients[coef[0]], // horizontal (spatial) strength pd->coefficients[coef[0]], // vertical (spatial) strength pd->coefficients[coef[1]], // temporal strength offset, // offset in bytes of first relevant pixel in frame lp->skip // skip this amount of bytes between two pixels ); } } } if(tag & TC_FILTER_CLOSE) { if(pd->previous) { free(pd->previous); pd->previous = 0; } if(pd->lineant) { free(pd->lineant); pd->lineant = 0; } } return(0); } transcode-1.0.0beta2/filter/filter_detectclipping.c100644 001750 000000 00000021437 10134574664 0016112/* * filter_detectclipping * * Copyright (C) Tilmann Bitterberg - June 2002 * Based on Code from mplayers cropdetect by A'rpi * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_detectclipping.so" #define MOD_VERSION "v0.1.0 (2003-11-01)" #define MOD_CAP "detect clipping parameters (-j or -Y)" #define MOD_AUTHOR "Tilmann Bitterberg, A'rpi" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "transcode.h" #include "framebuffer.h" #include "optstr.h" // basic parameter typedef struct MyFilterData { /* configurable */ unsigned int start; unsigned int end; unsigned int step; int post; int limit; int x1, y1, x2, y2; /* internal */ int stride, bpp; int fno; int boolstep; } MyFilterData; static MyFilterData *mfd[16]; /* should probably honor the other flags too */ /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" Detect black regions on top, bottom, left and right of an image\n"); printf (" It is suggested that the filter is run for around 100 frames.\n"); printf (" It will print its detected parameters every frame. If you\n"); printf (" don't notice any change in the printout for a while, the filter\n"); printf (" probably won't find any other values.\n"); printf (" The filter converges, meaning it will learn.\n"); printf ("* Options\n"); printf (" 'range' apply filter to [start-end]/step frames [0-oo/1]\n"); printf (" 'limit' the sum of a line must be below this limit to be considered black\n"); printf (" 'post' run as a POST filter (calc -Y instead of the default -j)\n"); } static int checkline(unsigned char* src,int stride,int len,int bpp){ int total=0; int div=len; switch(bpp){ case 1: while(--len>=0){ total+=src[0]; src+=stride; } break; case 3: case 4: while(--len>=0){ total+=src[0]+src[1]+src[2]; src+=stride; } div*=3; break; } total/=div; return total; } int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; if (ptr->tag & TC_AUDIO) return 0; if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[128]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYEOM", "1"); snprintf(buf, 128, "%u-%u/%d", mfd[ptr->filter_id]->start, mfd[ptr->filter_id]->end, mfd[ptr->filter_id]->step); optstr_param (options, "range", "apply filter to [start-end]/step frames", "%u-%u/%d", buf, "0", "oo", "0", "oo", "1", "oo"); optstr_param (options, "limit", "the sum of a line must be below this limit to be considered as black", "%d", "24", "0", "255"); optstr_param (options, "post", "run as a POST filter (calc -Y instead of the default -j)", "", "0"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); if((mfd[ptr->filter_id] = (MyFilterData *)malloc (sizeof(MyFilterData))) == NULL) return (-1); mfd[ptr->filter_id]->start=0; mfd[ptr->filter_id]->end=(unsigned int)-1; mfd[ptr->filter_id]->step=1; mfd[ptr->filter_id]->limit=24; mfd[ptr->filter_id]->post = 0; if (options != NULL) { if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get (options, "range", "%u-%u/%d", &mfd[ptr->filter_id]->start, &mfd[ptr->filter_id]->end, &mfd[ptr->filter_id]->step); optstr_get (options, "limit", "%d", &mfd[ptr->filter_id]->limit); if (optstr_get (options, "post", "")>=0) mfd[ptr->filter_id]->post = 1; } if (verbose > 1) { printf (" detectclipping#%d Settings:\n", ptr->filter_id); printf (" range = %u-%u\n", mfd[ptr->filter_id]->start, mfd[ptr->filter_id]->end); printf (" step = %u\n", mfd[ptr->filter_id]->step); printf (" limit = %u\n", mfd[ptr->filter_id]->limit); printf (" run POST filter = %s\n", mfd[ptr->filter_id]->post?"yes":"no"); } if (options) if (optstr_lookup (options, "help")) { help_optstr(); } if (mfd[ptr->filter_id]->start % mfd[ptr->filter_id]->step == 0) mfd[ptr->filter_id]->boolstep = 0; else mfd[ptr->filter_id]->boolstep = 1; if (!mfd[ptr->filter_id]->post) { mfd[ptr->filter_id]->x1 = vob->im_v_width; mfd[ptr->filter_id]->y1 = vob->im_v_height; } else { mfd[ptr->filter_id]->x1 = vob->ex_v_width; mfd[ptr->filter_id]->y1 = vob->ex_v_height; } mfd[ptr->filter_id]->x2 = 0; mfd[ptr->filter_id]->y2 = 0; mfd[ptr->filter_id]->fno = 0; if (vob->im_v_codec == CODEC_YUV) { mfd[ptr->filter_id]->stride = mfd[ptr->filter_id]->post?vob->ex_v_width:vob->im_v_width; mfd[ptr->filter_id]->bpp = 1; } else if (vob->im_v_codec == CODEC_RGB) { mfd[ptr->filter_id]->stride = mfd[ptr->filter_id]->post?(vob->ex_v_width*3):(vob->im_v_width*3); mfd[ptr->filter_id]->bpp = 3; } else { fprintf (stderr, "[%s] unsupported colorspace\n", MOD_NAME); return -1; } // filter init ok. if (verbose) printf("[%s] %s %s #%d\n", MOD_NAME, MOD_VERSION, MOD_CAP, ptr->filter_id); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (mfd[ptr->filter_id]) { free(mfd[ptr->filter_id]); } mfd[ptr->filter_id]=NULL; return(0); } /* filter close */ //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if(((ptr->tag & TC_PRE_M_PROCESS && !mfd[ptr->filter_id]->post) || (ptr->tag & TC_POST_M_PROCESS && mfd[ptr->filter_id]->post)) && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { int y; char *p = ptr->video_buf; int l,r,t,b; if (mfd[ptr->filter_id]->fno++ < 3) return 0; if (mfd[ptr->filter_id]->start <= ptr->id && ptr->id <= mfd[ptr->filter_id]->end && ptr->id%mfd[ptr->filter_id]->step == mfd[ptr->filter_id]->boolstep) { for (y = 0; y < mfd[ptr->filter_id]->y1; y++) { if(checkline(p+mfd[ptr->filter_id]->stride*y, mfd[ptr->filter_id]->bpp, ptr->v_width, mfd[ptr->filter_id]->bpp) > mfd[ptr->filter_id]->limit) { mfd[ptr->filter_id]->y1 = y; break; } } for (y=ptr->v_height-1; y>mfd[ptr->filter_id]->y2; y--) { if (checkline(p+mfd[ptr->filter_id]->stride*y, mfd[ptr->filter_id]->bpp, ptr->v_width, mfd[ptr->filter_id]->bpp) > mfd[ptr->filter_id]->limit) { mfd[ptr->filter_id]->y2 = y; break; } } for (y = 0; y < mfd[ptr->filter_id]->x1; y++) { if(checkline(p+mfd[ptr->filter_id]->bpp*y, mfd[ptr->filter_id]->stride, ptr->v_height, mfd[ptr->filter_id]->bpp) > mfd[ptr->filter_id]->limit) { mfd[ptr->filter_id]->x1 = y; break; } } for (y = ptr->v_width-1; y > mfd[ptr->filter_id]->x2; y--) { if(checkline(p+mfd[ptr->filter_id]->bpp*y, mfd[ptr->filter_id]->stride, ptr->v_height, mfd[ptr->filter_id]->bpp) > mfd[ptr->filter_id]->limit) { mfd[ptr->filter_id]->x2 = y; break; } } t = (mfd[ptr->filter_id]->y1+1)&(~1); l = (mfd[ptr->filter_id]->x1+1)&(~1); b = ptr->v_height - ((mfd[ptr->filter_id]->y2+1)&(~1)); r = ptr->v_width - ((mfd[ptr->filter_id]->x2+1)&(~1)); printf("[detectclipping#%d] valid area: X: %d..%d Y: %d..%d -> %s %d,%d,%d,%d\n", ptr->filter_id, mfd[ptr->filter_id]->x1,mfd[ptr->filter_id]->x2, mfd[ptr->filter_id]->y1,mfd[ptr->filter_id]->y2, mfd[ptr->filter_id]->post?"-Y":"-j", t, l, b, r ); } } return(0); } transcode-1.0.0beta2/filter/filter_dilyuvmmx.c100644 001750 000000 00000005475 07712721160 0015147/* * filter_dilyuvmmx.c * * Copyright (C) Thomas streich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_dilyuvmmx.so" #define MOD_VERSION "v0.1.1 (2002-02-21)" #define MOD_CAP "yuv de-interlace filter plugin" #define MOD_AUTHOR "Thomas Oestreich" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "transcode.h" #include "framebuffer.h" #include "mmx.h" #include "optstr.h" /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VYE", "1"); return 0; } if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if((ptr->tag & TC_PRE_PROCESS) && (ptr->tag & TC_VIDEO) && (vob->im_v_codec==CODEC_YUV) && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { deinterlace_bob_yuv_mmx(ptr->video_buf, ptr->video_buf, ptr->v_width, ptr->v_height); } return(0); } transcode-1.0.0beta2/filter/filter_detectsilence.c100644 001750 000000 00000012222 10161261376 0015710/* * filter_detectsilence.c * * Copyright (C) Tilmann Bitterberg - July 2003 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_detectsilence.so" #define MOD_VERSION "v0.0.1 (2003-07-26)" #define MOD_CAP "audio silence detection with tcmp3cut commandline generation" #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDINT_H #include #endif #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" static int a_rate, a_bits, chan; /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ #define SILENCE_FRAMES 4 #define MAX_SONGS 50 int tc_filter(aframe_list_t *ptr, char *options) { int n; short *s; int sum; double p; static int zero=0; static int next=0; static int songs[MAX_SONGS]; char cmd[1024]; vob_t *vob=NULL; // API explanation: // ================ // // (1) need more infos, than get pointer to transcode global // information structure vob_t as defined in transcode.h. // // (2) 'tc_get_vob' and 'verbose' are exported by transcode. // // (3) filter is called first time with TC_FILTER_INIT flag set. // // (4) make sure to exit immediately if context (video/audio) or // placement of call (pre/post) is not compatible with the filters // intended purpose, since the filter is called 4 times per frame. // // (5) see framebuffer.h for a complete list of frame_list_t variables. // // (6) filter is last time with TC_FILTER_CLOSE flag set if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "Tilmann Bitterberg", "AE", "1"); } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { int i; if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); a_bits=vob->a_bits; a_rate=vob->a_rate; chan = vob->a_chan; for (i=0; itag & TC_FILTER_CLOSE) { int i, len=0; if (next<1) return 0; if((vob = tc_get_vob())==NULL) return(-1); //len += sprintf(cmd, "tcmp3cut -i %s -o %s ", vob->audio_in_file, vob->audio_out_file?vob->audio_out_file:vob->audio_in_file); len += snprintf(cmd, sizeof(cmd), "tcmp3cut -i in.mp3 -o base "); printf("\n ********** Songs ***********\n"); if (next>0) { printf("%d", songs[0]); len += snprintf(cmd+len, sizeof(cmd) - len, "-t %d", songs[0]); } for (i=1; itag & TC_PRE_S_PROCESS && ptr->tag & TC_AUDIO) { s=(short *) ptr->audio_buf; p=0.0; for(n=0; naudio_size>>1; ++n) { double d=(double)(*s++)/((double)SHRT_MAX*1.0); p += (d>0.0?d:-d); } sum = (int)p; // Is this frame silence? if (sum == 0) zero++; // if we have found SILENCE_FRAMES in a row, there must be a song change. if (zero>=SILENCE_FRAMES && sum) { // somwhere in the middle of silence, the +3 is just a number int tot = (ptr->id - zero)*ptr->audio_size; tot *= 8; tot /= (a_rate*chan*a_bits/1000); songs[next++] = tot; if (next > MAX_SONGS) { tc_error("[%s] Cannot save more songs", MOD_NAME); return (-1); } //printf("\nCut at time %d frame %d\n", tot, ptr->id - (zero+2)/2); zero=0; } //printf("%5d: sum (%07.3f)\n", ptr->id, p); } return(0); } // vim: sw=2 transcode-1.0.0beta2/filter/deinterlace.c100644 001750 000000 00000012757 10134622236 0014020/* * Copyright (C) Thomas streich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * Code taken from the xine project: * Copyright (C) 2001 the xine project * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * Deinterlace routines by Miguel Freitas * based of DScaler project sources (deinterlace.sourceforge.net) * * Currently only available for Xv driver and MMX extensions * */ #include "config.h" #include #include #include #include #include "mmx.h" #include "transcode.h" /* DeinterlaceFieldBob algorithm Based on Virtual Dub plugin by Gunnar Thalin MMX asm version from dscaler project (deinterlace.sourceforge.net) Linux version for Xine player by Miguel Freitas Todo: use a MMX optimized memcpy */ void deinterlace_bob_yuv_mmx(uint8_t *pdst, uint8_t *psrc, int width, int height ) { int Line; long long* YVal1; long long* YVal2; long long* YVal3; long long* Dest; uint8_t* pEvenLines = psrc; uint8_t* pOddLines = psrc+width; int LineLength = width; int Pitch = width * 2; int IsOdd = 1; long EdgeDetect = 625; long JaggieThreshold = 73; int n; unsigned long long qwEdgeDetect; unsigned long long qwThreshold; const unsigned long long Mask = 0xfefefefefefefefeULL; const unsigned long long YMask = 0x00ff00ff00ff00ffULL; qwEdgeDetect = EdgeDetect; qwEdgeDetect += (qwEdgeDetect << 48) + (qwEdgeDetect << 32) + (qwEdgeDetect << 16); qwThreshold = JaggieThreshold; qwThreshold += (qwThreshold << 48) + (qwThreshold << 32) + (qwThreshold << 16); // copy first even line no matter what, and the first odd line if we're // processing an odd field. tc_memcpy(pdst, pEvenLines, LineLength); if (IsOdd) tc_memcpy(pdst + LineLength, pOddLines, LineLength); height = height / 2; for (Line = 0; Line < height - 1; ++Line) { if (IsOdd) { YVal1 = (long long *)(pOddLines + Line * Pitch); YVal2 = (long long *)(pEvenLines + (Line + 1) * Pitch); YVal3 = (long long *)(pOddLines + (Line + 1) * Pitch); Dest = (long long *)(pdst + (Line * 2 + 2) * LineLength); } else { YVal1 = (long long *)(pEvenLines + Line * Pitch); YVal2 = (long long *)(pOddLines + Line * Pitch); YVal3 = (long long *)(pEvenLines + (Line + 1) * Pitch); Dest = (long long *)(pdst + (Line * 2 + 1) * LineLength); } // For ease of reading, the comments below assume that we're operating on an odd // field (i.e., that bIsOdd is true). The exact same processing is done when we // operate on an even field, but the roles of the odd and even fields are reversed. // It's just too cumbersome to explain the algorithm in terms of "the next odd // line if we're doing an odd field, or the next even line if we're doing an // even field" etc. So wherever you see "odd" or "even" below, keep in mind that // half the time this function is called, those words' meanings will invert. // Copy the odd line to the overlay verbatim. tc_memcpy((char *)Dest + LineLength, YVal3, LineLength); n = LineLength >> 3; while( n-- ) { movq_m2r (*YVal1++, mm0); movq_m2r (*YVal2++, mm1); movq_m2r (*YVal3++, mm2); // get intensities in mm3 - 4 movq_r2r ( mm0, mm3 ); movq_r2r ( mm1, mm4 ); movq_r2r ( mm2, mm5 ); pand_m2r ( *&YMask, mm3 ); pand_m2r ( *&YMask, mm4 ); pand_m2r ( *&YMask, mm5 ); // get average in mm0 pand_m2r ( *&Mask, mm0 ); pand_m2r ( *&Mask, mm2 ); psrlw_i2r ( 01, mm0 ); psrlw_i2r ( 01, mm2 ); paddw_r2r ( mm2, mm0 ); // work out (O1 - E) * (O2 - E) / 2 - EdgeDetect * (O1 - O2) ^ 2 >> 12 // result will be in mm6 psrlw_i2r ( 01, mm3 ); psrlw_i2r ( 01, mm4 ); psrlw_i2r ( 01, mm5 ); movq_r2r ( mm3, mm6 ); psubw_r2r ( mm4, mm6 ); //mm6 = O1 - E movq_r2r ( mm5, mm7 ); psubw_r2r ( mm4, mm7 ); //mm7 = O2 - E pmullw_r2r ( mm7, mm6 ); // mm6 = (O1 - E) * (O2 - E) movq_r2r ( mm3, mm7 ); psubw_r2r ( mm5, mm7 ); // mm7 = (O1 - O2) pmullw_r2r ( mm7, mm7 ); // mm7 = (O1 - O2) ^ 2 psrlw_i2r ( 12, mm7 ); // mm7 = (O1 - O2) ^ 2 >> 12 pmullw_m2r ( *&qwEdgeDetect, mm7 );// mm7 = EdgeDetect * (O1 - O2) ^ 2 >> 12 psubw_r2r ( mm7, mm6 ); // mm6 is what we want pcmpgtw_m2r ( *&qwThreshold, mm6 ); movq_r2r ( mm6, mm7 ); pand_r2r ( mm6, mm0 ); pandn_r2r ( mm1, mm7 ); por_r2r ( mm0, mm7 ); movq_r2m ( mm7, *Dest++ ); } } // Copy last odd line if we're processing an even field. if (! IsOdd) { tc_memcpy(pdst + (height * 2 - 1) * LineLength, pOddLines + (height - 1) * Pitch, LineLength); } // clear out the MMX registers ready for doing floating point // again emms(); } transcode-1.0.0beta2/filter/filter_dnr.c100644 001750 000000 00000042123 10134622237 0013660/* * filter_dnr.c * * Copyright (C) Gerhard Monzel - November 2001 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_dnr.so" #define MOD_VERSION "v0.2 (2003-01-21)" #define MOD_CAP "dynamic noise reduction" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include "transcode.h" #include "framebuffer.h" #include "optstr.h" typedef unsigned char T_PIXEL; typedef struct t_dnr_filter_ctx { int is_first_frame; int pPartial; int pThreshold; int pThreshold2; int pPixellock; int pPixellock2; int pScene; int isYUV; T_PIXEL *lastframe; T_PIXEL *origframe; int gu_ofs, rv_ofs; unsigned char lookup[256][256]; unsigned char *lockhistory; T_PIXEL *src_data; T_PIXEL *undo_data; long src_h, src_w; int img_size; int hist_size; int pitch; int line_size_c; int line_size_l; int undo; } T_DNR_FILTER_CTX; static int dnr_run(T_DNR_FILTER_CTX *fctx, T_PIXEL *data) { T_PIXEL *RY1, *RY2, *RY3, *GU1, *GU2, *GU3, *BV1, *BV2, *BV3; int rl, rc, w, h, update_needed, totpixels; int threshRY, threshGU=0, threshBV=0; int ry1, ry2, gu1=0, gu2=0, bv1=0, bv2=0; long totlocks = 0; unsigned char *lockhistory = fctx->lockhistory; //-- get data into account -- fctx->src_data = data; //-- if we are dealing with the first -- //-- frame, just make a copy. -- if (fctx->is_first_frame) { tc_memcpy(fctx->lastframe, fctx->src_data, fctx->img_size); fctx->undo_data = fctx->lastframe; fctx->is_first_frame = 0; return 0; } //-- make sure to preserve the existing frame -- //-- in case this is a scene change -- tc_memcpy(fctx->origframe, fctx->src_data, fctx->img_size); if (fctx->isYUV) { RY1 = fctx->src_data; GU1 = RY1 + fctx->gu_ofs; BV1 = RY1 + fctx->rv_ofs; RY2 = fctx->lastframe; GU2 = RY2 + fctx->gu_ofs; BV2 = RY2 + fctx->rv_ofs; RY3 = fctx->src_data; GU3 = RY3 + fctx->gu_ofs; BV3 = RY3 + fctx->rv_ofs; } else { BV1 = fctx->src_data; GU1 = BV1 + fctx->gu_ofs; RY1 = BV1 + fctx->rv_ofs; BV2 = fctx->lastframe; GU2 = BV2 + fctx->gu_ofs; RY2 = BV2 + fctx->rv_ofs; BV3 = fctx->src_data; GU3 = BV3 + fctx->gu_ofs; RY3 = BV3 + fctx->rv_ofs; } h = fctx->src_h; do { w = fctx->src_w; rl = rc = 0; do { update_needed = 1; //-- on every row get (luma) actual/locked pixels -- //-- -> calculate thresold (biased diff.) -- //-------------------------------------------------- ry1 = RY1[rl]; ry2 = RY2[rl]; threshRY = fctx->lookup[ry1][ry2]; //-- in YUV-Mode on every even row (RGB every -- //-- row) get (chroma) actual/locked pixels -- //-- -> calculate thresold (biased diff.) -- //----------------------------------------------- if (!fctx->isYUV || !(rl&0x01)) { gu1 = GU1[rc]; bv1 = BV1[rc]; gu2 = GU2[rc]; bv2 = BV2[rc]; threshGU = fctx->lookup[gu1][gu2]; threshBV = fctx->lookup[bv1][bv2]; } //-- PARTIAL -- //------------- if (fctx->pPartial) { // we're doing a full pixel lock since we're -- // under all thresholds in a couple of time -- //--------------------------------------------- if ( (threshRY < fctx->pPixellock) && (threshGU < fctx->pPixellock2) && (threshBV < fctx->pPixellock2)) { //-- if we've locked more than 30 times at -- //-- this point, let's refresh the pixel. -- if (*lockhistory > 30) { *lockhistory = 0; ry1 = (ry1 + ry2) / 2; gu1 = (gu1 + gu2) / 2; bv1 = (bv1 + bv2) / 2; } else { *lockhistory = *lockhistory + 1; //-- take locked pixels -- ry1 = ry2; gu1 = gu2; bv1 = bv2; } } //-- If the luma is within pixellock, and the chroma is within -- //-- blend, lets blend the chroma and lock the luma. //----------------------------------------------------------------- else if ( (threshRY < fctx->pPixellock) && (threshGU < fctx->pThreshold2) && (threshBV < fctx->pThreshold2) ) { *lockhistory = 0; ry1 = ry2; gu1 = (gu1 + gu2) / 2; bv1 = (bv1 + bv2) / 2; } //-- We are above pixellock in luma and chroma, but -- //-- below the blend thresholds in both, so let's blend -- //-------------------------------------------------------- else if ( (threshRY < fctx->pThreshold) && (threshGU < fctx->pThreshold2) && (threshBV < fctx->pThreshold2) ) { *lockhistory = 0; ry1 = (ry1 + ry2) / 2; gu1 = (gu1 + gu2) / 2; bv1 = (bv1 + bv2) / 2; } //-- if we are above all thresholds, -- //-- just leave the output untouched -- //------------------------------------- else { *lockhistory = 0; update_needed = 0; totlocks++; } } //-- nonPARTIAL -- //---------------- else { //-- beneath pixellock so lets keep -- //-- the existing pixel (most likely) -- //-------------------------------------- if ( (threshRY < fctx->pPixellock) && (threshGU < fctx->pPixellock2) && (threshBV < fctx->pPixellock2) ) { // if we've locked more than 30 times at this point, // let's refresh the pixel if (*lockhistory > 30) { *lockhistory = 0; ry1 = (ry1 + ry2) / 2; gu1 = (gu1 + gu2) / 2; bv1 = (bv1 + bv2) / 2; } else { *lockhistory = *lockhistory + 1; ry1 = ry2; gu1 = gu2; bv1 = bv2; } } //-- we are above pixellock, but below the -- //-- blend threshold so we want to blend -- //------------------------------------------- else if ( (threshRY < fctx->pThreshold) && (threshGU < fctx->pThreshold2) && (threshBV < fctx->pThreshold2) ) { *lockhistory = 0; ry1 = (ry1 + ry2) / 2; gu1 = (gu1 + gu2) / 2; bv1 = (bv1 + bv2) / 2; } //-- it's beyond the thresholds, just leave it alone -- //----------------------------------------------------- else { *lockhistory = 0; update_needed = 0; totlocks++; } } //-- set destination -- //--------------------- if (update_needed) { RY3[rl] = ry1; GU3[rc] = gu1; BV3[rc] = bv1; } //-- refresh locked pixels -- //--------------------------- if ( *lockhistory == 0 ) { RY2[rl] = ry1; GU2[rc] = gu1; BV2[rc] = bv1; } lockhistory++; rl += fctx->pitch; rc = (fctx->isYUV) ? (rl>>1) : rl; } while(--w); //-- next line ... -- RY1 += fctx->line_size_l; RY2 += fctx->line_size_l; RY3 += fctx->line_size_l; //-- ... in YUV-Mode for chromas, only on even luma-lines -- if (!fctx->isYUV || !(h&0x01) ) { GU1 += fctx->line_size_c; BV1 += fctx->line_size_c; GU2 += fctx->line_size_c; BV2 += fctx->line_size_c; GU3 += fctx->line_size_c; BV3 += fctx->line_size_c; } } while(--h); totpixels = fctx->src_h * fctx->src_w; totpixels *= fctx->pScene; totpixels /= 100; // If more than the specified percent of pixels have exceeded all thresholds // then we restore the saved frame. (this doesn't happen very often // hopefully) We also set the pixellock history to 0 for all frames if (totlocks > totpixels) { T_PIXEL *ptmp = fctx->lastframe; fctx->lastframe = fctx->origframe; fctx->undo_data = fctx->lastframe; fctx->origframe = ptmp; fctx->undo = 1; memset(fctx->lockhistory, 0, fctx->hist_size); } else { fctx->undo_data = fctx->src_data; fctx->undo = 0; } return 0; } static void dnr_cleanup(T_DNR_FILTER_CTX *fctx) { if (fctx->lastframe) free(fctx->lastframe); if (fctx->origframe) free(fctx->origframe); if (fctx->lockhistory) free(fctx->lockhistory); fctx->lastframe = NULL; fctx->origframe = NULL; fctx->lockhistory = NULL; } #define DEFAULT_LT 10 #define DEFAULT_LL 4 #define DEFAULT_CT 16 #define DEFAULT_CL 8 #define DEFAULT_SC 30 static T_DNR_FILTER_CTX *dnr_init(int src_w, int src_h, int isYUV) { double low1, low2; double high1, high2; int a, b, dif1, dif2; T_DNR_FILTER_CTX *fctx = malloc (sizeof(T_DNR_FILTER_CTX)); //-- PARAMETERS -- fctx->pThreshold = DEFAULT_LT; // threshold to blend luma/red (default 10) fctx->pPixellock = DEFAULT_LL; // threshold to lock luma/red (default 4) fctx->pThreshold2 = DEFAULT_CT; // threshold to blend croma/green+blue (default 16) fctx->pPixellock2 = DEFAULT_CL; // threshold to lock croma/green+blue (default 8) fctx->pScene = DEFAULT_SC; // percentage of picture difference // to interpret as a new scene (default 30%) fctx->pPartial = 0; // operating mode [0,1] (default 0) //---------------- fctx->isYUV = isYUV; fctx->is_first_frame = 1; fctx->lastframe = (T_PIXEL *)calloc(src_h * src_w, 3); fctx->origframe = (T_PIXEL *)calloc(src_h * src_w, 3); fctx->lockhistory = (unsigned char *)calloc(src_h * src_w, 1); fctx->src_h = src_h; fctx->src_w = src_w; fctx->hist_size = src_h * src_w; if (isYUV) { fctx->img_size = (fctx->hist_size * 3) / 2; fctx->gu_ofs = fctx->hist_size; fctx->rv_ofs = (fctx->hist_size * 5) / 4; fctx->pitch = 1; fctx->line_size_c = (src_w >> 1); fctx->line_size_l = src_w; } else { fctx->img_size = fctx->hist_size * 3; fctx->gu_ofs = 1; fctx->rv_ofs = 2; fctx->pitch = 3; fctx->line_size_c = src_w * 3; fctx->line_size_l = src_w * 3; } if (!fctx->lastframe || !fctx->origframe || !fctx->lockhistory) { dnr_cleanup(fctx); return NULL; } // setup a biased thresholding difference matrix // this is an expensive operation we only want to to once for (a = 0; a < 256; a++) { for (b = 0; b < 256; b++) { // instead of scaling linearly // we scale according to the following formulas // val1 = 256 * (x / 256) ^ .9 // and // val2 = 256 * (x / 256) ^ (1/.9) // and we choose the maximum distance between two points // based on these two scales low1 = a; low2 = b; low1 = low1 / 256; low1 = 256 * pow(low1, .9); low2 = low2 / 256; low2 = 256 * pow(low2, .9); // the low scale should make all values larger // and the high scale should make all values smaller high1 = a; high2 = b; high1 = high1 / 256; high2 = high2 / 256; high1 = 256 * pow(high1, 1.0/.9); high2 = 256 * pow(high2, 1.0/.9); dif1 = (int) (low1 - low2); if (dif1 < 0) dif1 *= -1; dif2 = (int) (high1 - high2); if (dif2 < 0) dif2 *= -1; dif1 = (dif1 > dif2) ? dif1 : dif2; fctx->lookup[a][b] = dif1; } } return fctx; } // old or new syntax? int is_optstr (char *buf) { if (strchr(buf, '=')) return 1; if (strchr(buf, 'l')) return 1; if (strchr(buf, 'c')) return 1; return 0; } /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob = NULL; static T_DNR_FILTER_CTX *my_fctx = NULL; //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[32]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "Gerhard Monzel", "VYRO", "1"); snprintf(buf, 32, "%d", my_fctx->pThreshold); optstr_param (options, "lt", "Threshold to blend luma/red", "%d", buf, "1", "128"); snprintf(buf, 32, "%d", my_fctx->pPixellock); optstr_param (options, "ll", "Threshold to lock luma/red", "%d", buf, "1", "128"); snprintf(buf, 32, "%d", my_fctx->pThreshold2); optstr_param (options, "ct", "Threshold to blend croma/green+blue", "%d", buf, "1", "128"); snprintf(buf, 32, "%d", my_fctx->pPixellock2); optstr_param (options, "cl", "Threshold to lock croma/green+blue", "%d", buf, "1", "128"); snprintf(buf, 32, "%d", my_fctx->pScene); optstr_param (options, "sc", "Percentage of picture difference (scene change)", "%d", buf, "1", "90"); return 0; } if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); //-- initialization -- my_fctx = dnr_init( vob->ex_v_width, vob->ex_v_height, (vob->im_v_codec==CODEC_RGB)? 0:1 ); if (!my_fctx) { return (-1); } if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if (options) { if (!is_optstr(options)) { char *p1, *p2; char hlp_str[128]; p1 = options; p2 = hlp_str; do { if (*p1 == ':') { *p2 = ' '; p2++; } *p2 = *p1; p1++; p2++; } while (*p1); *p2 = '\0'; if(verbose & TC_DEBUG) printf("[%s] options=%s\n", MOD_NAME, options); if ( (p1 = strtok(hlp_str,":")) != NULL) my_fctx->pThreshold = atoi(p1); if ( (p1 = strtok(NULL, ":")) != NULL ) my_fctx->pPixellock = atoi(p1); if ( (p1 = strtok(NULL, ":")) != NULL ) my_fctx->pThreshold2 = atoi(p1); if ( (p1 = strtok(NULL, ":")) != NULL ) my_fctx->pPixellock2 = atoi(p1); if ( (p1 = strtok(NULL, ":")) != NULL ) my_fctx->pScene = atoi(p1); } else { // new options optstr_get (options, "lt", "%d", &my_fctx->pThreshold); optstr_get (options, "ll", "%d", &my_fctx->pPixellock); optstr_get (options, "ct", "%d", &my_fctx->pThreshold2); optstr_get (options, "cl", "%d", &my_fctx->pPixellock2); optstr_get (options, "sc", "%d", &my_fctx->pScene); } if (my_fctx->pThreshold > 128 || my_fctx->pThreshold < 1) my_fctx->pThreshold = DEFAULT_LT; if (my_fctx->pPixellock > 128 || my_fctx->pPixellock < 1) my_fctx->pPixellock = DEFAULT_LL; if (my_fctx->pThreshold2 > 128 || my_fctx->pThreshold2 < 1) my_fctx->pThreshold2 = DEFAULT_CT; if (my_fctx->pPixellock2 > 128 || my_fctx->pPixellock2 < 1) my_fctx->pPixellock2 = DEFAULT_CL; if (my_fctx->pScene > 90 || my_fctx->pScene < 1) my_fctx->pScene = DEFAULT_SC; /* fprintf(stderr, "*** (%d:%d:%d:%d:%d)\n", my_fctx->pThreshold, my_fctx->pPixellock, my_fctx->pThreshold2, my_fctx->pPixellock2, my_fctx->pScene); */ } return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { dnr_cleanup(my_fctx); my_fctx = NULL; return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if((ptr->tag & TC_POST_PROCESS) && (ptr->tag & TC_VIDEO) && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { dnr_run(my_fctx, ptr->video_buf); if (my_fctx->undo) tc_memcpy(ptr->video_buf, my_fctx->undo_data, my_fctx->img_size); } return(0); } transcode-1.0.0beta2/filter/filter_doublefps.c100644 001750 000000 00000013033 10134622237 0015056/* * filter_slowmo.c * * Copyright (C) Tilmann Bitterberg - June 2003 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_doublefps.so" #define MOD_VERSION "v0.2 (2003-06-23)" #define MOD_CAP "double frame rate by creating frames from fields" #define MOD_AUTHOR "Tilmann Bitterberg" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; static char *lines = NULL; static int width, height, codec; int h; static int evenfirst=0; // API explanation: // ================ // // (1) need more infos, than get pointer to transcode global // information structure vob_t as defined in transcode.h. // // (2) 'tc_get_vob' and 'verbose' are exported by transcode. // // (3) filter is called first time with TC_FILTER_INIT flag set. // // (4) make sure to exit immediately if context (video/audio) or // placement of call (pre/post) is not compatible with the filters // intended purpose, since the filter is called 4 times per frame. // // (5) see framebuffer.h for a complete list of frame_list_t variables. // // (6) filter is last time with TC_FILTER_CLOSE flag set //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_AUDIO) return 0; if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); width = vob->ex_v_width; height = vob->ex_v_height; codec = vob->im_v_codec; // dirty, dirty, dirty. //vob->ex_v_height /= 2; //height_mod = vob->ex_v_height; if (!lines) lines = (char *) malloc (width*height*3); if (!lines) { fprintf(stderr, "[%s] No lines buffer available\n", MOD_NAME); return -1; } if(options) { if (verbose & TC_INFO) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get (options, "shiftEven", "%d", &evenfirst ); } // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return(0); } //---------------------------------- // // filter configure // //---------------------------------- if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYO", "1"); optstr_param (options, "shiftEven", "Assume even field dominance", "%d", "0", "0", "1"); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (lines) free(lines); lines=NULL; return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context // this must be POST_S_PROCESS otherwise we won't see a cloned frame again. if(ptr->tag & TC_POST_S_PROCESS) { int stride = ptr->v_width*3; if (codec==CODEC_YUV) stride = ptr->v_width; if (!(ptr->attributes & TC_FRAME_WAS_CLONED)) { char *p = ptr->video_buf; char *s = lines+((evenfirst)?stride:0); //printf("Is cloned\n"); ptr->attributes |= TC_FRAME_IS_CLONED; tc_memcpy (lines, ptr->video_buf, ptr->video_size); for (h = 0; h < height/2; h++) { tc_memcpy (p, s, stride); s += 2*stride; p += stride; } if (codec==CODEC_YUV) { for (h = 0; h < height/4; h++) { tc_memcpy (p, s, stride/2); s += 2*stride/2; p += stride/2; } for (h = 0; h < height/4; h++) { tc_memcpy (p, s, stride/2); s += 2*stride/2; p += stride/2; } } //memset (p, 128, ptr->video_size/2); } else { char *p = ptr->video_buf; char *s = lines+((evenfirst)?0:stride); // printf("WAS cloned\n"); for (h = 0; h < height/2; h++) { tc_memcpy (p, s, stride); s += 2*stride; p += stride; } if (codec==CODEC_YUV) { for (h = 0; h < height/4; h++) { tc_memcpy (p, s, stride/2); s += 2*stride/2; p += stride/2; } for (h = 0; h < height/4; h++) { tc_memcpy (p, s, stride/2); s += 2*stride/2; p += stride/2; } } //memset (p, 128, ptr->video_size/2); } //ptr->v_height = height_mod; } return(0); } transcode-1.0.0beta2/filter/filter_facemask.c100644 001750 000000 00000020514 10147050600 0014640/* * filter_facemask.c * * Copyright (C) Julien Tierny - October 2004 * Copyright (C) Thomas streich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA]. * */ #define MOD_NAME "filter_facemask.so" #define MOD_VERSION "v0.2 (2004-11-01)" #define MOD_CAP "Mask people faces in video interviews." #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "filter.h" /* RGB2YUV features */ #include "../export/vid_aux.h" #include "optstr.h" /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ typedef struct parameter_struct{ int xpos, ypos, xresolution, yresolution, xdim, ydim; } parameter_struct; static parameter_struct *parameters = NULL; static void help_optstr(void){ printf ("[%s] Help:\n", MOD_NAME); printf ("\n* Overview:\n"); printf(" This filter can mask people faces in video interviews.\n"); printf(" Both YUV and RGB formats are supported, in multithreaded mode.\n"); printf("\n* Warning:\n"); printf(" You have to calibrate by your own the mask dimensions and positions so as it fits to your video sample.\n"); printf(" You also have to choose a resolution that is multiple of the mask dimensions.\n"); printf ("\n* Options:\n"); printf (" 'xpos':\t\tPosition of the upper left corner of the mask (x)\n"); printf (" 'ypos':\t\tPosition of the upper left corner of the mask (y)\n"); printf (" 'xresolution':\tResolution of the mask (width)\n"); printf (" 'yresolution':\tResolution of the mask (height)\n"); printf (" 'xdim':\t\tWidth of the mask (= n*xresolution)\n"); printf (" 'ydim':\t\tHeight of the mask (= m*yresolution)\n"); } int check_parameters(int x, int y, int w, int h, int W, int H, vob_t *vob){ /* First, we check if the face-zone is contained in the picture */ if ((x+W) > vob->im_v_width){ tc_error("[%s] Face zone is larger than the picture !\n", MOD_NAME); return -1; } if ((y+H) > vob->im_v_height){ tc_error("[%s] Face zone is taller than the picture !\n", MOD_NAME); return -1; } /* Then, we check the resolution */ if ((H%h) != 0) { tc_error("[%s] Uncorrect Y resolution !", MOD_NAME); return -1; } if ((W%w) != 0) { tc_error("[%s] Uncorrect X resolution !", MOD_NAME); return -1; } return 0; } int average_neighbourhood(int x, int y, int w, int h, unsigned char *buffer, int width){ unsigned int red=0, green=0, blue=0; int i=0,j=0; for (j=y; j<=y+h; j++){ for (i=3*(x + width*(j-1)); i<3*(x + w + (j-1)*width); i+=3){ red += (int) buffer[i]; green += (int) buffer[i+1]; blue += (int) buffer[i+2]; } } red /= ((w+1)*h); green /= ((w+1)*h); blue /= ((w+1)*h); /* Now let's print values in buffer */ for (j=y; jvideo_buf, ptr->v_width); return 0; } int tc_filter(vframe_list_t *ptr, char *options){ static vob_t *vob=NULL; if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "Julien Tierny", "VRYMEO", "1"); optstr_param(options, "xpos", "Position of the upper left corner of the mask (x)", "%d", "0", "0", "oo"); optstr_param(options, "ypos", "Position of the upper left corner of the mask (y)", "%d", "0", "0", "oo"); optstr_param(options, "xresolution", "Resolution of the mask (width)", "%d", "0", "1", "oo"); optstr_param(options, "yresolution", "Resolution of the mask (height)", "%d", "0", "1", "oo"); optstr_param(options, "xdim", "Width of the mask (= n*xresolution)", "%d", "0", "1", "oo"); optstr_param(options, "ydim", "Height of the mask (= m*yresolution)", "%d", "0", "1", "oo"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); /* Now, let's handle the options ... */ if((parameters = (parameter_struct *) malloc (sizeof(parameter_struct))) == NULL) return -1; /* Filter default options */ if (verbose & TC_DEBUG) tc_info("[%s] Preparing default options.\n", MOD_NAME); parameters->xpos = 0; parameters->ypos = 0; parameters->xresolution = 1; parameters->yresolution = 1; parameters->xdim = 1; parameters->ydim = 1; if (options){ /* Get filter options via transcode core */ if (verbose & TC_DEBUG) tc_info("[%s] Merging options from transcode.\n", MOD_NAME); optstr_get(options, "xpos", "%d", ¶meters->xpos); optstr_get(options, "ypos", "%d", ¶meters->ypos); optstr_get(options, "xresolution", "%d", ¶meters->xresolution); optstr_get(options, "yresolution", "%d", ¶meters->yresolution); optstr_get(options, "xdim", "%d", ¶meters->xdim); optstr_get(options, "ydim", "%d", ¶meters->ydim); if (optstr_get(options, "help", "") >=0) help_optstr(); } if (vob->im_v_codec == CODEC_YUV){ if (tc_yuv2rgb_init(vob->im_v_width, vob->im_v_height)<0) { tc_error("[%s] Error at YUV to RGB conversion initialization.\n", MOD_NAME); return(-1); } if (tc_rgb2yuv_init(vob->im_v_width, vob->im_v_height)<0) { tc_error("[%s] Error at RGB to YUV conversion initialization.\n", MOD_NAME); return(-1); } } if (check_parameters(parameters->xpos, parameters->ypos, parameters->xresolution, parameters->yresolution, parameters->xdim, parameters->ydim, vob) < 0) return -1; if(verbose) fprintf(stdout, "[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { /* Let's free the parameter structure */ free(parameters); parameters = NULL; if (vob->im_v_codec == CODEC_YUV){ if (tc_yuv2rgb_close()<0) { tc_error("[%s] Error at YUV to RGB conversion closure.\n", MOD_NAME); return(-1); } if (tc_rgb2yuv_close()<0) { tc_error("[%s] Error at RGB to YUV conversion closure.\n", MOD_NAME); return(-1); } } return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- if(ptr->tag & TC_POST_PROCESS && ptr->tag & TC_VIDEO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { switch(vob->im_v_codec){ case CODEC_RGB: return print_mask(parameters->xpos, parameters->ypos, parameters->xresolution, parameters->yresolution, parameters->xdim, parameters->ydim, ptr); break; case CODEC_YUV: if (tc_yuv2rgb_core(ptr->video_buf) == -1){ tc_error("[%s] Error: cannot convert YUV stream to RGB format !\n", MOD_NAME); return -1; } if ((print_mask(parameters->xpos, parameters->ypos, parameters->xresolution, parameters->yresolution, parameters->xdim, parameters->ydim, ptr))<0) return -1; if (tc_rgb2yuv_core(ptr->video_buf) == -1){ tc_error("[%s] Error: cannot convert RGB stream to YUV format !\n", MOD_NAME); return -1; } break; default: tc_error("[%s] Internal video codec is not supported.\n", MOD_NAME); return -1; } } return(0); } transcode-1.0.0beta2/filter/filter_fieldanalysis.c100644 001750 000000 00000055174 10175607624 0015746/* * filter_fieldanalysis.c * * (c) by Matthias Hopf - August 2004 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* * This filter determines the type of video * (interlaced / progressive / field shifed / telecined) * by analysing the luminance field of the input frames. */ #define MOD_NAME "filter_fieldanalysis.so" #define MOD_VERSION "v1.0 pl1 (2004-08-13)" #define MOD_CAP "Field analysis for detecting interlace and telecine" #define MOD_AUTHORS "Matthias Hopf" #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #ifdef HAVE_STDINT_H #include #endif #include #include "transcode.h" #include "framebuffer.h" #include "optstr.h" #if 0 #include "aclib/ac.h" #endif /* * State */ typedef struct { double interlaceDiff; double unknownDiff; double progressiveDiff; double progressiveChange; double changedIfMore; int forceTelecineDetect; int verbose; int outDiff; float fps; int codec; int width; int height; int size; /* lumance fields, current (In) and previous, * top original T (bottom interpolated) and bottom original B */ uint8_t *lumIn, *lumPrev, *lumInT, *lumInB, *lumPrevT, *lumPrevB; int telecineState; int numFrames; int unknownFrames; int topFirstFrames; int bottomFirstFrames; int interlacedFrames; int progressiveFrames; int fieldShiftFrames; int telecineFrames; } myfilter_t; static myfilter_t *myf_global = NULL; /* Internal state flag values */ enum { IS_UNKNOWN = -1, IS_FALSE = 0, IS_TRUE = 1 }; /* API */ extern int tc_filter (vframe_list_t *ptr, char *options); /* * transcoders Any -> Luminance */ /* packed YUV 4:2:2 is Y[i] U[i] Y[i+1] V[i] (YUY2)*/ /* packed YUV 4:2:2 is U[i] Y[i] V[i] Y[i+1] (UYVY)*/ void uyvytoy (uint8_t *input, uint8_t *output, int width, int height) { int i; for (i = width*height/2; i; i--) { *output++ = input[1]; *output++ = input[3]; input += 4; } } void yuy2toy (uint8_t *input, uint8_t *output, int width, int height) { int i; for (i = width*height/2; i; i--) { *output++ = input[0]; *output++ = input[2]; input += 4; } } void rgbtoy (uint8_t *input, uint8_t *output, int width, int height) { int i; for (i = width*height; i; i--) { /* This is a rough approximation of (0.3)(r) + (0.59)(g) + (0.11)(b) */ *output++ = (((short)input[0]) * 5 + ((short)input[1]) * 9 + ((short)input[2]) * 2) >> 4; input += 3; } } /* * Helper functions */ /* bob a single field */ void bob_field (uint8_t *in, uint8_t *out, int width, int height) { int i, j, w2 = 2*width; for (i = 0; i < height; i++) { /* First bob (average lines) */ for (j = 0; j < width; j++) out[j] = (((short)in[j]) + ((short)in[j+w2])) >>1; /* Then copy original line */ tc_memcpy (out+width, in+w2, width); in += w2; out += w2; } } /* compare images: calc squared 2-norm of difference image * maximum difference is 255^2 = 65025 */ double pic_compare (uint8_t *p1, uint8_t *p2, int width, int height, int modulo) { long long res = 0; int i, j; for (i = height; i; i--) { for (j = width; j; j--) { int d = ((int)*p1++) - ((int)*p2++); res += d*d; } p1 += modulo; p2 += modulo; } return ((double) res) / (width*height); } /* create scaled difference image (for outdiff) */ void pic_diff (uint8_t *p1, uint8_t *p2, uint8_t *dest, int size, int scale) { int i; for (i = size ; i; i--) { int d = scale * (((int)*p1++) - ((int)*p2++)); d = d > 0 ? d : -d; *dest++ = d > 255 ? 255 : d; } } /* * main function: check interlace state */ void check_interlace (myfilter_t *myf, int id) { double pixDiff, pixShiftChangedT, pixShiftChangedB; double pixLastT, pixLastB, pixLast; int isChangedT = IS_FALSE, isChangedB = IS_FALSE; int isProg = IS_UNKNOWN; int isShift = IS_UNKNOWN, isTop = IS_UNKNOWN; int *counter = &myf->unknownFrames; /* Determine frame parmeters */ pixDiff = pic_compare (myf->lumInT, myf->lumInB, myf->width, myf->height-2, 0); pixShiftChangedT = pic_compare (myf->lumInT, myf->lumPrevB, myf->width, myf->height-2, 0); pixShiftChangedB = pic_compare (myf->lumInB, myf->lumPrevT, myf->width, myf->height-2, 0); pixLastT = pic_compare (myf->lumIn, myf->lumPrev, myf->width, myf->height/2, myf->width); pixLastB = pic_compare (myf->lumIn + myf->width, myf->lumPrev + myf->width, myf->width, myf->height/2, myf->width); pixLast = (pixLastT + pixLastB) / 2; /* Check for changed fields */ if (pixLastT > myf->changedIfMore) isChangedT = IS_TRUE; if (pixLastB > myf->changedIfMore) isChangedB = IS_TRUE; /* Major field detection */ if (pixShiftChangedT * myf->interlaceDiff < pixShiftChangedB) isTop = IS_TRUE; if (pixShiftChangedB * myf->interlaceDiff < pixShiftChangedT) isTop = IS_FALSE; /* Check for progessive frame */ if (pixDiff * myf->unknownDiff > pixShiftChangedT || pixDiff * myf->unknownDiff > pixShiftChangedB) isProg = IS_FALSE; if (pixDiff * myf->progressiveDiff < pixShiftChangedT && pixDiff * myf->progressiveDiff < pixShiftChangedB && pixDiff < pixLast * myf->progressiveChange) isProg = IS_TRUE; /* Check for shifted progressive frame */ /* not completely equivalent to check.prog.frame. (pixLast) */ /* TODO: this triggers too often for regular interlaced material */ if (pixShiftChangedT * myf->progressiveDiff < pixDiff && pixShiftChangedT * myf->progressiveDiff < pixShiftChangedB && pixShiftChangedT < myf->progressiveChange * pixLast) isShift = IS_TRUE; if (pixShiftChangedB * myf->progressiveDiff < pixDiff && pixShiftChangedB * myf->progressiveDiff < pixShiftChangedT && pixShiftChangedT < myf->progressiveChange * pixLast) isShift = IS_TRUE; /* Detect telecine */ /* telecined material will create a sequence like this (TopfieldFirst): * 0t1b (0)1t1b (1)2t2b (2)3t3b (3)3t4b (4)4t5b (0)5t5b ... * and vice versa for BottomfieldFirst. * We start looking for an progressive frame (1t1b) with one field * equal to the last frame and continue checking the frames for * adhering to the pattern. * We only count frames as valid telecine frames, if the pattern has been * detected twice in a row (telecineState > 10). * Undecidable frames (isProg == UNKNOWN && isTop == UNKNOWN) and * frames without changes (isChangedT != TRUE && isChangedB != TRUE) * are only accepted, if telecineState > 10. * Only happens for NTSC (29.97fps). * If a test fails, it reduces the current telecineState by 20. * Max. telecineState is 100. */ /* TODO: currently no field insertion/deletion is detected, * requires resync right now */ if ((myf->fps > 29.9 && myf->fps < 30.1) || myf->forceTelecineDetect) { if ((isChangedT == IS_TRUE || isChangedB == IS_TRUE) && (isProg != IS_UNKNOWN || isTop != IS_UNKNOWN || myf->telecineState > 10)){ switch (myf->telecineState % 5) { case 0: /* if (isProg == IS_FALSE) myf->telecineState -= 20; */ /* prog. detmination may fail */ switch (isTop) { case IS_TRUE: if (isChangedB == IS_TRUE) myf->telecineState -= 20; break; case IS_FALSE: if (isChangedT == IS_TRUE) myf->telecineState -= 20; break; } break; case 1: case 2: if (isProg == IS_FALSE) myf->telecineState -= 20; break; case 3: if (isProg == IS_TRUE) myf->telecineState -= 20; switch (isTop) { case IS_TRUE: if (isChangedT == IS_TRUE) myf->telecineState -= 20; break; case IS_FALSE: if (isChangedB == IS_TRUE) myf->telecineState -= 20; break; } break; case 4: if (isProg == IS_TRUE) myf->telecineState -= 20; break; } if (myf->telecineState < 0) myf->telecineState = 0; if (myf->telecineState == 0) { /* Frame has another chance to be case 0 */ /* if (isProg == IS_FALSE) myf->telecineState = -1; */ /* prog. detmination may fail */ switch (isTop) { case IS_TRUE: if (isChangedB == IS_TRUE) myf->telecineState = -1; break; case IS_FALSE: if (isChangedT == IS_TRUE) myf->telecineState = -1; break; } } myf->telecineState++; } else if (myf->telecineState > 10) myf->telecineState++; else myf->telecineState = 0; if (myf->telecineState > 100) myf->telecineState -= 10; } /* Detect inconstistencies */ if (isProg == IS_FALSE && isTop == IS_UNKNOWN) isProg = IS_UNKNOWN; if (isProg != IS_FALSE && isTop != IS_UNKNOWN) { isTop = IS_UNKNOWN; isProg = IS_UNKNOWN; } if (isChangedT == IS_FALSE || isChangedB == IS_FALSE) { isProg = IS_UNKNOWN; isTop = IS_UNKNOWN; isShift = IS_UNKNOWN; } /* verbose output */ if (myf->verbose) { char verboseBuffer[64]; char *outType = 0, *outField = " "; memset (verboseBuffer, ' ', 63); if (pixDiff * myf->unknownDiff < pixShiftChangedT) memcpy (&verboseBuffer[0], "pt", 2); if (pixDiff * myf->progressiveDiff < pixShiftChangedT) memcpy (&verboseBuffer[0], "Pt", 2); if (pixDiff * myf->unknownDiff < pixShiftChangedB) memcpy (&verboseBuffer[2], "pb", 2); if (pixDiff * myf->progressiveDiff < pixShiftChangedB) memcpy (&verboseBuffer[2], "Pb", 2); if (pixDiff < myf->progressiveChange*pixLast) verboseBuffer[5] = 'c'; if (pixShiftChangedT * myf->interlaceDiff < pixShiftChangedB) verboseBuffer[7] = 't'; if (pixShiftChangedB * myf->interlaceDiff < pixShiftChangedT) verboseBuffer[7] = 'b'; if (isChangedT == IS_FALSE) memcpy (&verboseBuffer[9], "st", 2); if (isChangedB == IS_FALSE) memcpy (&verboseBuffer[11], "sb", 2); verboseBuffer[13] = 0; if (myf->verbose > 1) { fprintf (stderr, "[%s] frame %d: pixDiff %.3f pixShiftChanged %.3fT/%.3fB pixLast %.3fT/%.3fB telecineState %d\n", MOD_NAME, id, pixDiff, pixShiftChangedT, pixShiftChangedB, pixLastT, pixLastB, myf->telecineState); } switch (isProg) { case IS_UNKNOWN: outType = "unknown "; break; case IS_FALSE: outType = "interlaced "; break; case IS_TRUE: outType = "progressive"; break; } if (isChangedT == IS_FALSE && isChangedB == IS_FALSE) outType = "low change "; if (isShift == IS_TRUE) outType = "shifted p "; if (myf->telecineState > 10) outType = "telecined "; switch (isTop) { case IS_FALSE: outField = "B"; break; case IS_TRUE: outField = "T"; break; } fprintf (stderr, "[%s] frame %d: %s %s [%s] \n", MOD_NAME, id, outType, outField, verboseBuffer); } /* Count types */ switch (isProg) { case IS_UNKNOWN: counter = &myf->unknownFrames; break; case IS_FALSE: counter = &myf->interlacedFrames; break; case IS_TRUE: counter = &myf->progressiveFrames; break; } if (isChangedT == IS_FALSE && isChangedB == IS_FALSE) counter = &myf->unknownFrames; if (isShift == IS_TRUE) counter = &myf->fieldShiftFrames; if (myf->telecineState > 10) counter = &myf->telecineFrames; switch (isTop) { case IS_FALSE: myf->bottomFirstFrames++; break; case IS_TRUE: myf->topFirstFrames++; break; } assert (counter); (*counter)++; myf->numFrames++; } /* * transcode API */ int tc_filter (vframe_list_t *ptr, char *options) { vob_t *vob = NULL; myfilter_t *myf = myf_global; /* * filter init */ if (ptr->tag & TC_FILTER_INIT) { if (! (vob = tc_get_vob ())) return -1; if (! (myf = myf_global = calloc (1, sizeof (myfilter_t)))) { fprintf (stderr, "calloc() failed\n"); return -1; } if (verbose) /* global verbose */ printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); /* default values */ myf->interlaceDiff = 1.1; myf->unknownDiff = 1.5; myf->progressiveDiff = 8; myf->progressiveChange = 0.2; myf->changedIfMore = 10; myf->forceTelecineDetect = 0; myf->verbose = 0; myf->outDiff = 0; /* video parameters */ switch (vob->im_v_codec) { case CODEC_YUY2: case CODEC_YUV: case CODEC_YUV422: case CODEC_RGB: break; default: fprintf (stderr, "[%s]: Unsupported codec - need one of RGB YUV YUY2 YUV422\n", MOD_NAME); return -1; } myf->codec = vob->im_v_codec; myf->width = vob->im_v_width; myf->height = vob->im_v_height; myf->fps = vob->fps; myf->size = myf->width * myf->height; if (options) { optstr_get (options, "interlacediff", "%lf", &myf->interlaceDiff); optstr_get (options, "unknowndiff", "%lf", &myf->unknownDiff); optstr_get (options, "progressivediff", "%lf", &myf->progressiveDiff); optstr_get (options, "progressivechange", "%lf", &myf->progressiveChange); optstr_get (options, "changedifmore", "%lf", &myf->changedIfMore); optstr_get (options, "forcetelecinedetect", "%d", &myf->forceTelecineDetect); optstr_get (options, "verbose", "%d", &myf->verbose); optstr_get (options, "outdiff", "%d", &myf->outDiff); if (optstr_get (options, "help", "") >= 0) { printf ("[%s] (%s) help\n\n" "* Overview:\n" " 'fieldanalysis' scans video for interlacing artifacts and\n" " detects progressive / interlaced / telecined video.\n" " It also determines the major field for interlaced video.\n" "* Verbose Output: [PtPb c t stsb]\n" " Pt, Pb: progressivediff succeeded, per field.\n" " pt, pb: unknowndiff succeeded, progressivediff failed.\n" " c: progressivechange succeeded.\n" " t: topFieldFirst / b: bottomFieldFirst detected.\n" " st, sb: changedifmore failed (fields are similar to last frame).\n\n", MOD_NAME, MOD_CAP); } } /* frame memory */ if (! (myf->lumIn = calloc (1, myf->size)) || ! (myf->lumPrev = calloc (1, myf->size)) || ! (myf->lumInT = calloc (1, myf->size)) || ! (myf->lumInB = calloc (1, myf->size)) || ! (myf->lumPrevT = calloc (1, myf->size)) || ! (myf->lumPrevB = calloc (1, myf->size))) { fprintf (stderr, "calloc() failed\n"); return -1; } if (verbose) { /* global verbose */ printf("[%s] interlacediff %.2f, unknowndiff %.2f, progressivediff %.2f\n" "[%s] progressivechange %.2f, changedifmore %.2f\n" "[%s] forcetelecinedetect %s, verbose %d, outdiff %d\n", MOD_NAME, myf->interlaceDiff, myf->unknownDiff, myf->progressiveDiff, MOD_NAME, myf->progressiveChange, myf->changedIfMore, MOD_NAME, myf->forceTelecineDetect ? "True":"False", myf->verbose, myf->outDiff); } return 0; } /* * filter close */ if (ptr->tag & TC_FILTER_CLOSE) { int total = myf->numFrames - myf->unknownFrames; int totalfields = myf->topFirstFrames + myf->bottomFirstFrames; /* Cleanup */ free (myf->lumIn); free (myf->lumPrev); free (myf->lumInT); free (myf->lumInB); free (myf->lumPrevT); free (myf->lumPrevB); myf->lumIn = myf->lumPrev = myf->lumInT = myf->lumInB = myf->lumPrevT = myf->lumPrevB = NULL; /* Output results */ if (totalfields < 1) totalfields = 1; printf ("\n" "[%s] RESULTS: Frames: %d (100%%) Unknown: %d (%.3g%%)\n" "[%s] RESULTS: Progressive: %d (%.3g%%) Interlaced: %d (%.3g%%)\n" "[%s] RESULTS: FieldShift: %d (%.3g%%) Telecined: %d (%.3g%%)\n" "[%s] RESULTS: MajorField: TopFirst %d (%.3g%%) BottomFirst %d (%.3g%%)\n", MOD_NAME, myf->numFrames, myf->unknownFrames, 100.0 * myf->unknownFrames / (double)myf->numFrames, MOD_NAME, myf->progressiveFrames, 100.0 * myf->progressiveFrames / (double)myf->numFrames, myf->interlacedFrames, 100.0 * myf->interlacedFrames / (double)myf->numFrames, MOD_NAME, myf->fieldShiftFrames, 100.0 * myf->fieldShiftFrames / (double)myf->numFrames, myf->telecineFrames, 100.0 * myf->telecineFrames / (double)myf->numFrames, MOD_NAME, myf->topFirstFrames, 100.0 * myf->topFirstFrames / (double)totalfields, myf->bottomFirstFrames, 100.0 * myf->bottomFirstFrames / (double)totalfields); if (total < 50) printf ("\n[%s] less than 50 frames analyzed correctly, no conclusion.\n\n", MOD_NAME); else if (myf->unknownFrames * 10 > myf->numFrames * 9) printf ("\n[%s] less than 10%% frames analyzed correctly, no conclusion.\n\n", MOD_NAME); else if (myf->progressiveFrames * 8 > total * 7) printf ("\n[%s] CONCLUSION: progressive video.\n\n", MOD_NAME); else if (myf->topFirstFrames * 8 > myf->bottomFirstFrames && myf->bottomFirstFrames * 8 > myf->topFirstFrames) printf ("\n[%s] major field unsure, no conclusion. Use deinterlacer for processing.\n\n", MOD_NAME); else if (myf->telecineFrames * 4 > total * 3) printf ("\n[%s] CONCLUSION: telecined video, %s field first.\n\n", MOD_NAME, myf->topFirstFrames > myf->bottomFirstFrames ? "top" : "bottom"); else if (myf->fieldShiftFrames * 4 > total * 3) printf ("\n[%s] CONCLUSION: field shifted progressive video, %s field first.\n\n", MOD_NAME, myf->topFirstFrames > myf->bottomFirstFrames ? "top" : "bottom"); else if (myf->interlacedFrames > myf->fieldShiftFrames && (myf->interlacedFrames+myf->fieldShiftFrames) * 8 > total * 7) printf ("\n[%s] CONCLUSION: interlaced video, %s field first.\n\n", MOD_NAME, myf->topFirstFrames > myf->bottomFirstFrames ? "top" : "bottom"); else printf ("\n[%s] mixed video, no conclusion. Use deinterlacer for processing.\n\n", MOD_NAME); return 0; } /* * filter description */ if (ptr->tag & TC_FILTER_GET_CONFIG) { char buf[255]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHORS, "VRY4E", "2"); snprintf (buf, sizeof(buf), "%g", myf->interlaceDiff); optstr_param (options, "interlacediff", "Minimum temporal inter-field difference for detecting interlaced video", "%f", buf, "1.0", "inf"); snprintf (buf, sizeof(buf), "%g", myf->unknownDiff); optstr_param (options, "unknowndiff", "Maximum inter-frame change vs. detail differences for neglecting interlaced video", "%f", buf, "1.0", "inf"); snprintf (buf, sizeof(buf), "%g", myf->progressiveDiff); optstr_param (options, "progressivediff", "Minimum inter-frame change vs. detail differences for detecting progressive video" ,"%f", buf, "unknowndiff", "inf"); snprintf (buf, sizeof(buf), "%g", myf->progressiveChange); optstr_param (options, "progressivechange", "Minimum temporal change needed for detecting progressive video" ,"%f", buf, "0", "inf"); snprintf (buf, sizeof(buf), "%g", myf->changedIfMore); optstr_param (options, "changedifmore", "Minimum temporal change for detecting truly changed frames" ,"%f", buf, "0", "65025"); snprintf (buf, sizeof(buf), "%d", myf->forceTelecineDetect); optstr_param (options, "forcetelecinedetect", "Detect telecine even on non-NTSC (29.97fps) video", "%d", buf, "0", "1"); snprintf (buf, sizeof(buf), "%d", myf->verbose); optstr_param (options, "verbose", "Output analysis for every frame", "%d", buf, "0", "2"); snprintf (buf, sizeof(buf), "%d", myf->outDiff); optstr_param (options, "outdiff", "Output internal debug frames as luminance of YUV video (see source)", "%d", buf, "0", "11"); } /* * filter frame routine */ /* need to process frames in-order */ if ((ptr->tag & TC_PRE_S_PROCESS) && (ptr->tag & TC_VIDEO)) { uint8_t *tmp; int i, j; assert (ptr->free == 0 || ptr->free == 1); assert (ptr->video_buf_Y[!ptr->free] == ptr->video_buf); /* Convert / Copy to luminance only */ switch (myf->codec) { case CODEC_RGB: rgbtoy (ptr->video_buf, myf->lumIn, myf->width, myf->height); break; case CODEC_YUY2: yuy2toy (ptr->video_buf, myf->lumIn, myf->width, myf->height); break; case CODEC_YUV: tc_memcpy (myf->lumIn, ptr->video_buf, myf->size); break; case CODEC_YUV422: uyvytoy (ptr->video_buf, myf->lumIn, myf->width, myf->height); break; default: assert (0); } /* Bob Top field */ bob_field (myf->lumIn, myf->lumInT, myf->width, myf->height/2-1); /* Bob Bottom field */ tc_memcpy (myf->lumInB, myf->lumIn + myf->width, myf->width); bob_field (myf->lumIn + myf->width, myf->lumInB + myf->width, myf->width, myf->height/2-1); /* last copied line is ignored, buffer is large enough */ if (myf->numFrames == 0) myf->numFrames++; else if (! (ptr->tag & TC_FRAME_IS_SKIPPED)) { /* check_it */ check_interlace (myf, ptr->id); } /* only works with YUV data correctly */ switch (myf->outDiff) { case 1: /* lumIn */ tc_memcpy (ptr->video_buf, myf->lumIn, myf->size); break; case 2: /* field shift */ for (i = 0 ; i < myf->height-2; i += 2) for (j = 0; j < myf->width; j++) { ptr->video_buf [myf->width*i+j] = myf->lumIn [myf->width*i+j]; ptr->video_buf [myf->width*(i+1)+j] = myf->lumPrev [myf->width*(i+1)+j]; } break; case 3: /* lumInT */ tc_memcpy (ptr->video_buf, myf->lumInT, myf->size); break; case 4: /* lumInB */ tc_memcpy (ptr->video_buf, myf->lumInB, myf->size); break; case 5: /* lumPrevT */ tc_memcpy (ptr->video_buf, myf->lumPrevT, myf->size); break; case 6: /* lumPrevB */ tc_memcpy (ptr->video_buf, myf->lumPrevB, myf->size); break; case 7: /* pixDiff */ pic_diff (myf->lumInT, myf->lumInB, ptr->video_buf, myf->size,4); break; case 8: /* pixShiftChangedT */ pic_diff (myf->lumInT, myf->lumPrevB, ptr->video_buf, myf->size,4); break; case 9: /* pixShiftChangedB */ pic_diff (myf->lumInB, myf->lumPrevT, ptr->video_buf, myf->size,4); break; case 10: /* pixLastT */ pic_diff (myf->lumInT, myf->lumPrevT, ptr->video_buf, myf->size,4); break; case 11: /* pixLastB */ pic_diff (myf->lumInB, myf->lumPrevB, ptr->video_buf, myf->size,4); break; } /* The current frame gets the next previous frame :-P */ tmp = myf->lumPrev; myf->lumPrev = myf->lumIn; myf->lumIn = tmp; tmp = myf->lumPrevT; myf->lumPrevT = myf->lumInT; myf->lumInT = tmp; tmp = myf->lumPrevB; myf->lumPrevB = myf->lumInB; myf->lumInB = tmp; } return 0; } transcode-1.0.0beta2/filter/filter_fields.c100644 001750 000000 00000025455 10134622237 0014354/* * filter_fields.c * * Copyright (C) Alex Stewart - July 2002 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ /***************************************************************************** * Standard C Includes * *****************************************************************************/ #include #include /***************************************************************************** * Standard Transcode Filter Defines and Includes * *****************************************************************************/ #define MOD_NAME "filter_fields.so" #define MOD_VERSION "v0.1.1 (2003-01-21)" #define MOD_CAP "Field adjustment plugin" #define MOD_AUTHOR "Alex Stewart" #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" /***************************************************************************** * Global Filter Variables and Defines * *****************************************************************************/ static const char *help_text[] = { "", "Transcode field-adjustment filter (filter_fields) help", "------------------------------------------------------", "", "The 'fields' filter is designed to shift, reorder, and", "generally rearrange independent fields of an interlaced", "video input. Input retrieved from broadcast (PAL, NTSC,", "etc) video sources generally comes in an interlaced form", "where each pass from top to bottom of the screen displays", "every other scanline, and then the next pass displays the", "lines between the lines from the first pass. Each pass is", "known as a \"field\" (there are generally two fields per", "frame). When this form of video is captured and manipulated", "digitally, the two fields of each frame are usually merged", "together into one flat (planar) image per frame. This", "usually produces reasonable results, however there are", "conditions which can cause this merging to be performed", "incorrectly or less-than-optimally, which is where this", "filter can help.", "", "The following options are supported for this filter", "(they can be separated by colons):", "", " shift - Shift the video by one field (half a frame),", " changing frame boundaries appropriately. This is", " useful if a video capture started grabbing video", " half a frame (one field) off from where frame", " boundaries were actually intended to be.", "", " flip - Exchange the top field and bottom field of each", " frame. This can be useful if the video signal was", " sent \"bottom field first\" (which can happen", " sometimes with PAL video sources) or other", " oddities occurred which caused the frame", " boundaries to be at the right place, but the", " scanlines to be swapped.", "", " flip_first", " - Normally shifting is performed before flipping if", " both are specified. This option reverses that", " behavior. You should not normally need to use", " this unless you have some extremely odd input", " material, it is here mainly for completeness.", "", " help - Print this text.", "", "Note: the 'shift' function may produce slight color", "discrepancies if YV12 is used as the internal transcode", "video format (-V flag). This is because YV12 does not", "contain enough information to do field shifting cleanly. For", "best (but slower) results, use RGB mode for field shifting.", "", 0 // End of Text }; #define FIELD_OP_FLIP 0x01 #define FIELD_OP_SHIFT 0x02 #define FIELD_OP_REVERSE 0x04 #define FIELD_OP_SHIFTFLIP (FIELD_OP_SHIFT | FIELD_OP_FLIP) #define FIELD_OP_FLIPSHIFT (FIELD_OP_SHIFTFLIP | FIELD_OP_REVERSE) static vob_t *vob = NULL; static char *buffer = NULL; static int buf_field = 0; static int field_ops = 0; static int rgb_mode; /***************************************************************************** * Filter Utility Functions * *****************************************************************************/ /* show_help - Print the contents of help_text for the user. */ static void show_help(void) { const char **line; for (line=help_text; *line; line++) { printf("[%s] %s\n", MOD_NAME, *line); } } /* copy_field - Copy one field of a frame (every other line) from one buffer * to another. */ static inline void copy_field(char *to, char *from, int width, int height) { int increment = width << 1; height >>= 1; while (height--) { tc_memcpy(to, from, width); to += increment; from += increment; } } /* swap_fields - Exchange one field of a frame (every other line) with another * NOTE: This function uses 'buffer' as a temporary space. */ static inline void swap_fields(char *f1, char *f2, int width, int height) { int increment = width << 1; height >>= 1; while (height--) { tc_memcpy(buffer, f1, width); tc_memcpy(f1, f2, width); tc_memcpy(f2, buffer, width); f1 += increment; f2 += increment; } } /***************************************************************************** * Main Filter Functions * *****************************************************************************/ static int filter_get_config(char *options) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYE", "1"); optstr_param (options, "flip", "Exchange the top field and bottom field of each frame", "", "0"); optstr_param (options, "shift", "Shift the video by one field", "", "0"); optstr_param (options, "flip_first", "Normally shifting is performed before flipping, this option reverses that", "", "0"); return 0; } static int filter_init(char *options) { int help_shown = 0; vob = tc_get_vob(); if (!vob) return -1; if (verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); buffer = malloc(SIZE_RGB_FRAME); if (!buffer) { fprintf(stderr, "[%s] ERROR: Unable to allocate memory. Aborting.\n", MOD_NAME); return -1; } // Some of the data in buffer may get used for half of the first frame (when // shifting) so make sure it's blank to start with. memset(buffer, 0, SIZE_RGB_FRAME); if(options != NULL) { if (optstr_get (options, "flip", "") >= 0) field_ops |= FIELD_OP_FLIP; if (optstr_get (options, "shift", "") >= 0) field_ops |= FIELD_OP_SHIFT; if (optstr_get (options, "flip_first", "") >= 0) field_ops |= FIELD_OP_REVERSE; if (optstr_get (options, "help", "") >= 0) { show_help(); help_shown = 1; } } // FIELD_OP_REVERSE (aka flip_first) only makes sense if we're doing // both operations. If we're not, unset it. if (field_ops != FIELD_OP_FLIPSHIFT) field_ops &= ~FIELD_OP_REVERSE; if(verbose) { if (field_ops & FIELD_OP_SHIFT) printf("[%s] Adjusting frame positions (shift)\n", MOD_NAME); if (field_ops & FIELD_OP_FLIP) printf("[%s] Transposing input fields (flip)\n", MOD_NAME); if (field_ops & FIELD_OP_REVERSE) printf("[%s] Flipping will occur before shifting (flip_first)\n", MOD_NAME); } if (!field_ops) { fprintf(stderr, "[%s] ERROR: No operations specified to perform.\n", MOD_NAME); if (!help_shown) { fprintf(stderr, "[%s] Use the 'help' option for more information.\n", MOD_NAME); } return -1; } rgb_mode = (vob->im_v_codec == CODEC_RGB); return 0; } static int filter_video_frame(vframe_list_t *ptr) { int width = ptr->v_width * (rgb_mode ? 3 : 1); int height = ptr->v_height; char *f1 = ptr->video_buf; char *f2 = ptr->video_buf + width; char *b1 = buffer; char *b2 = buffer + width; switch (field_ops) { case FIELD_OP_FLIP: swap_fields(f1, f2, width, height); break; case FIELD_OP_SHIFT: copy_field(buf_field ? b2 : b1, f2, width, height); copy_field(f2, f1, width, height); copy_field(f1, buf_field ? b1 : b2, width, height); break; case FIELD_OP_SHIFTFLIP: // Shift + Flip is the same result as just delaying the second field by // one frame, so do that because it's faster. copy_field(buf_field ? b1 : b2, f2, width, height); copy_field(f2, buf_field ? b2 : b1, width, height); break; case FIELD_OP_FLIPSHIFT: // Flip + Shift is the same result as just delaying the first field by // one frame, so do that because it's faster. copy_field(buf_field ? b1 : b2, f1, width, height); copy_field(f1, buf_field ? b2 : b1, width, height); // Chroma information is usually taken from the top field, which we're // shifting here. We probably should move the chroma info with it, but // this will be used so rarely (and this is only an issue in YUV mode // anyway, which is not reccomended to start with) that it's probably not // worth bothering. break; } buf_field ^= 1; return 0; } static int filter_close(void) { free(buffer); buffer=NULL; return 0; } /***************************************************************************** * Filter Entry Point * *****************************************************************************/ int tc_filter(vframe_list_t *ptr, char *options) { if(ptr->tag & TC_FILTER_INIT) { return filter_init(options); } if(ptr->tag & TC_FILTER_GET_CONFIG) { return filter_get_config(options); } if(ptr->tag & TC_FILTER_CLOSE) { return filter_close(); } // This filter is a video-only filter, which hooks into the single-threaded // preprocessing stage. (we need to be single-threaded because field-shifting // relies on getting the frames in the correct order) if(ptr->tag & TC_PRE_S_PROCESS && ptr->tag & TC_VIDEO) { return filter_video_frame(ptr); } return 0; } transcode-1.0.0beta2/filter/filter_fps.c100644 001750 000000 00000010375 10137130173 0013665/* * filter_fps.c * * Copyright 2003, 2004 Christopher Cramer * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with transcode; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_fps.so" #define MOD_VERSION "v1.1 (2004-05-01)" #define MOD_CAP "convert video frame rate, gets defaults from -f and --export_fps" #include #include #include #include #include #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" static int parse_options(char *options, int *pre, double *infps, double *outfps) { char *p, *q, *r; size_t len; vob_t *vob; int default_pre, i; /* defaults from -f and --export_fps */ vob = tc_get_vob(); if (!vob) return -1; *infps = vob->fps; *outfps = vob->ex_fps; default_pre = 1; if (!options || !*options) return 0; if (!strcmp(options, "help")) { printf("[%s] help\n" "This filter converts the video frame rate," " by repeating or dropping frames.\n" "options: :\n" "example: -J fps=25:29.97 will convert" " from PAL to NTSC\n" "In addition to the frame rate options," " you may also specify pre or post." "If no rate options are given, defaults" " or -f/--export_fps/--export_frc will be used.\n" "If no pre or post options are given," " decreasing rates will preprocess and" " increasing rates will postprocess.\n", MOD_NAME); return -1; } len = strlen(options); p = alloca(len + 1); tc_memcpy(p, options, len); p[len] = '\0'; i = 0; do { q = memchr(p, ':', len); if (q) *q++ = '\0'; if (!strcmp(p, "pre")) { *pre = 1; default_pre = 0; } else if (!strncmp(p, "pre=", 4) && *(p + 4)) { *pre = strtol(p + 4, &r, 0); if (r == p) return -1; default_pre = 0; } else if (!strcmp(p, "post")) { *pre = 0; default_pre = 0; } else if (!strncmp(p, "post=", 5) && *(p + 5)) { *pre = !strtol(p + 4, &r, 0); if (r == p) return -1; default_pre = 0; } else { if (i == 0) { *infps = strtod(p, &r); if (r == p) return -1; } else if (i == 1) { *outfps = strtod(p, &r); if (r == p) return -1; } else return -1; i++; } } while (q && (p = q)); if (default_pre) { if (*infps > *outfps) *pre = 1; else if (*infps < *outfps) *pre = 0; } return 0; } int tc_filter(vframe_list_t *ptr, char *options) { static double infps, outfps; static unsigned long framesin = 0, framesout = 0; static int pre = 0; if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "Christopher Cramer", "VRYEO", "1"); return 0; } if(ptr->tag & TC_FILTER_INIT) { if (verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if (parse_options(options, &pre, &infps, &outfps) == -1) return -1; if (verbose && options) printf("[%s] options=%s", MOD_NAME, options); if (verbose && !options) printf("[%s] no options", MOD_NAME); if (verbose) printf(", converting from %g fps to %g fps," " %sprocessing\n", infps, outfps, pre ? "pre" : "post"); return 0; } if (ptr->tag & TC_VIDEO && ((pre && ptr->tag & TC_PRE_S_PROCESS) || (!pre && ptr->tag & TC_POST_S_PROCESS))) { if (infps > outfps) { if ((double)++framesin / infps > (double)framesout / outfps) framesout++; else ptr->attributes |= TC_FRAME_IS_SKIPPED; return 0; } else if (infps < outfps) { if (!(ptr->attributes & TC_FRAME_WAS_CLONED)) framesin++; if ((double)framesin / infps > (double)++framesout / outfps) ptr->attributes |= TC_FRAME_IS_CLONED; } } return 0; } transcode-1.0.0beta2/filter/filter_hqdn3d.c100644 001750 000000 00000025575 10134572655 0014302/* Copyright (C) 2003 Daniel Moreno Converted for use in transcode by Tilmann Bitterberg This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define MOD_NAME "filter_hqdn3d.so" #define MOD_VERSION "v1.0.2 (2003-08-15)" #define MOD_CAP "High Quality 3D Denoiser" #define MOD_AUTHOR "Daniel Moreno & A'rpi" #include #include #include #include #include #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "filter.h" #include "optstr.h" #define PARAM1_DEFAULT 4.0 #define PARAM2_DEFAULT 3.0 #define PARAM3_DEFAULT 6.0 //===========================================================================// typedef struct vf_priv_s { int Coefs[4][512*16]; unsigned int *Line; unsigned short *Frame[3]; int pre; } MyFilterData; /***************************************************************************/ static inline unsigned int LowPassMul(unsigned int PrevMul, unsigned int CurrMul, int* Coef){ // int dMul= (PrevMul&0xFFFFFF)-(CurrMul&0xFFFFFF); int dMul= PrevMul-CurrMul; int d=((dMul+0x10007FF)/(65536/16)); return CurrMul + Coef[d]; } static void deNoise(unsigned char *Frame, // mpi->planes[x] unsigned char *FrameDest, // dmpi->planes[x] unsigned int *LineAnt, // vf->priv->Line (width bytes) unsigned short **FrameAntPtr, int W, int H, int sStride, int dStride, int *Horizontal, int *Vertical, int *Temporal) { int X, Y; int sLineOffs = 0, dLineOffs = 0; unsigned int PixelAnt; int PixelDst; unsigned short* FrameAnt=(*FrameAntPtr); if(!FrameAnt){ (*FrameAntPtr)=FrameAnt=malloc(W*H*sizeof(unsigned short)); for (Y = 0; Y < H; Y++){ unsigned short* dst=&FrameAnt[Y*W]; unsigned char* src=Frame+Y*sStride; for (X = 0; X < W; X++) dst[X]=src[X]<<8; } } /* First pixel has no left nor top neightbour. Only previous frame */ LineAnt[0] = PixelAnt = Frame[0]<<16; PixelDst = LowPassMul(FrameAnt[0]<<8, PixelAnt, Temporal); FrameAnt[0] = ((PixelDst+0x1000007F)/256); FrameDest[0]= ((PixelDst+0x10007FFF)/65536); /* Fist line has no top neightbour. Only left one for each pixel and * last frame */ for (X = 1; X < W; X++){ LineAnt[X] = PixelAnt = LowPassMul(PixelAnt, Frame[X]<<16, Horizontal); PixelDst = LowPassMul(FrameAnt[X]<<8, PixelAnt, Temporal); FrameAnt[X] = ((PixelDst+0x1000007F)/256); FrameDest[X]= ((PixelDst+0x10007FFF)/65536); } for (Y = 1; Y < H; Y++){ unsigned int PixelAnt; unsigned short* LinePrev=&FrameAnt[Y*W]; sLineOffs += sStride, dLineOffs += dStride; /* First pixel on each line doesn't have previous pixel */ PixelAnt = Frame[sLineOffs]<<16; LineAnt[0] = LowPassMul(LineAnt[0], PixelAnt, Vertical); PixelDst = LowPassMul(LinePrev[0]<<8, LineAnt[0], Temporal); LinePrev[0] = ((PixelDst+0x1000007F)/256); FrameDest[dLineOffs]= ((PixelDst+0x10007FFF)/65536); for (X = 1; X < W; X++){ int PixelDst; /* The rest are normal */ PixelAnt = LowPassMul(PixelAnt, Frame[sLineOffs+X]<<16, Horizontal); LineAnt[X] = LowPassMul(LineAnt[X], PixelAnt, Vertical); PixelDst = LowPassMul(LinePrev[X]<<8, LineAnt[X], Temporal); LinePrev[X] = ((PixelDst+0x1000007F)/256); FrameDest[dLineOffs+X]= ((PixelDst+0x10007FFF)/65536); } } } //===========================================================================// static void PrecalcCoefs(int *Ct, double Dist25) { int i; double Gamma, Simil, C; Gamma = log(0.25) / log(1.0 - Dist25/255.0 - 0.00001); for (i = -256*16; i < 256*16; i++) { Simil = 1.0 - (i>0?i:-i) / (16*255.0); C = pow(Simil, Gamma) * 65536.0 * (double)i / 16.0; Ct[16*256+i] = (C<0) ? (C-0.5) : (C+0.5); } } static void help_optstr() { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" This filter aims to reduce image noise producing\n"); printf (" smooth images and making still images really still\n"); printf (" (This should enhance compressibility).\n"); printf ("* Options\n"); printf (" luma : spatial luma strength (%f)\n", PARAM1_DEFAULT); printf (" chroma : spatial chroma strength (%f)\n", PARAM2_DEFAULT); printf (" luma_strength : temporal luma strength (%f)\n", PARAM3_DEFAULT); printf (" chroma_strength : temporal chroma strength (%f)\n", PARAM3_DEFAULT*PARAM2_DEFAULT/PARAM1_DEFAULT); printf (" pre : run as a pre filter (0)\n"); } // main filter routine int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; static MyFilterData *mfd[MAX_FILTER]; static char *buffer[MAX_FILTER]; int instance = ptr->filter_id; if(ptr->tag & TC_AUDIO) return 0; if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[128]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VYMOE", "2"); snprintf(buf, 128, "%f", PARAM1_DEFAULT); optstr_param (options, "luma", "spatial luma strength", "%f", buf, "0.0", "100.0" ); snprintf(buf, 128, "%f", PARAM2_DEFAULT); optstr_param (options, "chroma", "spatial chroma strength", "%f", buf, "0.0", "100.0" ); snprintf(buf, 128, "%f", PARAM3_DEFAULT); optstr_param (options, "luma_strength", "temporal luma strength", "%f", buf, "0.0", "100.0" ); snprintf(buf, 128, "%f", PARAM3_DEFAULT*PARAM2_DEFAULT/PARAM1_DEFAULT); optstr_param (options, "chroma_strength", "temporal chroma strength", "%f", buf, "0.0", "100.0" ); snprintf(buf, 128, "%d", mfd[instance]->pre); optstr_param (options, "pre", "run as a pre filter", "%d", buf, "0", "1" ); return 0; } if(ptr->tag & TC_FILTER_INIT) { double LumSpac, LumTmp, ChromSpac, ChromTmp; double Param1=0.0, Param2=0.0, Param3=0.0, Param4=0.0; if((vob = tc_get_vob())==NULL) return(-1); if (vob->im_v_codec == CODEC_RGB) { fprintf(stderr, "[%s] This filter is only capable of YUV mode\n", MOD_NAME); return -1; } mfd[instance] = malloc(sizeof(MyFilterData)); memset(mfd[instance], 0, sizeof(MyFilterData)); if (mfd[instance]) { mfd[instance]->Line = malloc(TC_MAX_V_FRAME_WIDTH*sizeof(int)); memset(mfd[instance]->Line, 0, TC_MAX_V_FRAME_WIDTH*sizeof(int)); } buffer[instance] = (char *)malloc(SIZE_RGB_FRAME); memset(buffer[instance], 0, SIZE_RGB_FRAME); if (!mfd[instance] || !mfd[instance]->Line || !buffer[instance]) { fprintf(stderr, "[%s] Malloc failed\n", MOD_NAME); return -1; } // defaults LumSpac = PARAM1_DEFAULT; LumTmp = PARAM3_DEFAULT; ChromSpac = PARAM2_DEFAULT; ChromTmp = LumTmp * ChromSpac / LumSpac; if (options) { if (optstr_lookup (options, "help")) { help_optstr(); } optstr_get (options, "luma", "%lf", &Param1); optstr_get (options, "luma_strength", "%lf", &Param3); optstr_get (options, "chroma", "%lf", &Param2); optstr_get (options, "chroma_strength","%lf", &Param4); optstr_get (options, "pre", "%d", &mfd[instance]->pre); // recalculate only the needed params if (Param1!=0.0) { LumSpac = Param1; LumTmp = PARAM3_DEFAULT * Param1 / PARAM1_DEFAULT; ChromSpac = PARAM2_DEFAULT * Param1 / PARAM1_DEFAULT; ChromTmp = LumTmp * ChromSpac / LumSpac; } if (Param2!=0.0) { ChromSpac = Param2; ChromTmp = LumTmp * ChromSpac / LumSpac; } if (Param3!=0.0) { LumTmp = Param3; ChromTmp = LumTmp * ChromSpac / LumSpac; } if (Param4!=0.0) { ChromTmp = Param4; } } PrecalcCoefs(mfd[instance]->Coefs[0], LumSpac); PrecalcCoefs(mfd[instance]->Coefs[1], LumTmp); PrecalcCoefs(mfd[instance]->Coefs[2], ChromSpac); PrecalcCoefs(mfd[instance]->Coefs[3], ChromTmp); if(verbose) { printf("[%s] %s %s #%d\n", MOD_NAME, MOD_VERSION, MOD_CAP, instance); printf("[%s] Settings luma=%.2f chroma=%.2f luma_strength=%.2f chroma_strength=%.2f\n", MOD_NAME, LumSpac, ChromSpac, LumTmp, ChromTmp); } return 0; } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (buffer[instance]) {free(buffer[instance]); buffer[instance]=NULL;} if (mfd[instance]) { if(mfd[instance]->Line){free(mfd[instance]->Line);mfd[instance]->Line=NULL;} if(mfd[instance]->Frame[0]){free(mfd[instance]->Frame[0]);mfd[instance]->Frame[0]=NULL;} if(mfd[instance]->Frame[1]){free(mfd[instance]->Frame[1]);mfd[instance]->Frame[1]=NULL;} if(mfd[instance]->Frame[2]){free(mfd[instance]->Frame[2]);mfd[instance]->Frame[2]=NULL;} free(mfd[instance]); } mfd[instance]=NULL; return(0); } /* filter close */ //actually do the filter if(((ptr->tag & TC_PRE_PROCESS && mfd[instance]->pre) || (ptr->tag & TC_POST_PROCESS && !mfd[instance]->pre)) && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { tc_memcpy (buffer[instance], ptr->video_buf, ptr->video_size); deNoise(buffer[instance], ptr->video_buf, mfd[instance]->Line, &mfd[instance]->Frame[0], ptr->v_width, ptr->v_height, ptr->v_width, ptr->v_width, mfd[instance]->Coefs[0], mfd[instance]->Coefs[0], mfd[instance]->Coefs[1]); deNoise(buffer[instance] + ptr->v_width*ptr->v_height, ptr->video_buf + ptr->v_width*ptr->v_height, mfd[instance]->Line, &mfd[instance]->Frame[1], ptr->v_width>>1, ptr->v_height>>1, ptr->v_width>>1, ptr->v_width>>1, mfd[instance]->Coefs[2], mfd[instance]->Coefs[2], mfd[instance]->Coefs[3]); deNoise(buffer[instance] + 5*ptr->v_width*ptr->v_height/4, ptr->video_buf + 5*ptr->v_width*ptr->v_height/4, mfd[instance]->Line, &mfd[instance]->Frame[2], ptr->v_width>>1, ptr->v_height>>1, ptr->v_width>>1, ptr->v_width>>1, mfd[instance]->Coefs[2], mfd[instance]->Coefs[2], mfd[instance]->Coefs[3]); } return 0; } //===========================================================================// transcode-1.0.0beta2/filter/filter_invert.c100644 001750 000000 00000010452 10134574664 0014416/* * filter_invert * * Copyright (C) Tilmann Bitterberg - June 2002 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_invert.so" #define MOD_VERSION "v0.1.4 (2003-10-12)" #define MOD_CAP "invert the image" #define MOD_AUTHOR "Tilmann Bitterberg" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "transcode.h" #include "framebuffer.h" #include "optstr.h" // basic parameter typedef struct MyFilterData { unsigned int start; unsigned int end; unsigned int step; int boolstep; } MyFilterData; static MyFilterData *mfd = NULL; /* should probably honor the other flags too */ /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" Invert an image\n"); printf ("* Options\n"); printf (" 'range' apply filter to [start-end]/step frames [0-oo/1]\n"); } int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; int w; if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[128]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRY4O", "1"); snprintf(buf, 128, "%u-%u/%d", mfd->start, mfd->end, mfd->step); optstr_param (options, "range", "apply filter to [start-end]/step frames", "%u-%u/%d", buf, "0", "oo", "0", "oo", "1", "oo"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); if((mfd = (MyFilterData *)malloc (sizeof(MyFilterData))) == NULL) return (-1); mfd->start=0; mfd->end=(unsigned int)-1; mfd->step=1; if (options != NULL) { if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get (options, "range", "%u-%u/%d", &mfd->start, &mfd->end, &mfd->step); } if (verbose > 1) { printf (" Invert Image Settings:\n"); printf (" range = %u-%u\n", mfd->start, mfd->end); printf (" step = %u\n", mfd->step); } if (options) if (optstr_lookup (options, "help")) { help_optstr(); } if (mfd->start % mfd->step == 0) mfd->boolstep = 0; else mfd->boolstep = 1; // filter init ok. if (verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (mfd) { free(mfd); } mfd=NULL; return(0); } /* filter close */ //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if((ptr->tag & TC_POST_PROCESS) && (ptr->tag & TC_VIDEO) && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { char *p = ptr->video_buf; if (mfd->start <= ptr->id && ptr->id <= mfd->end && ptr->id%mfd->step == mfd->boolstep) { for (w = 0; w < ptr->video_size; w++, p++) *p = 255 - *p; } } return(0); } transcode-1.0.0beta2/filter/filter_levels.c100644 001750 000000 00000013134 10134566565 0014402/* Copyright (C) 2004 Bryan Mayland For use in transcode by Tilmann Bitterberg This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define MOD_NAME "filter_levels.so" #define MOD_VERSION "v1.0.0 (2004-06-09)" #define MOD_CAP "Luminosity level scaler" #define MOD_AUTHOR "Bryan Mayland" #define module "[" MOD_NAME "]: " #include #include #include #include #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "filter.h" #include "optstr.h" #define DEFAULT_IN_BLACK 0 #define DEFAULT_IN_WHITE 255 #define DEFAULT_IN_GAMMA 1.0 #define DEFAULT_OUT_BLACK 0 #define DEFAULT_OUT_WHITE 255 typedef struct { struct { int in_black; int in_white; float in_gamma; int out_black; int out_white; } parameter; unsigned char lumamap[256]; } levels_private_data_t; static levels_private_data_t levels_private_data[MAX_FILTER]; static void doColorScale(levels_private_data_t *pd, unsigned char *data, int width, int height) { int y_size = width * height; unsigned char *map = pd->lumamap; while (y_size--) { *data = map[*data]; data++; } } void build_map(unsigned char *map, int inlow, int inhigh, float ingamma, int outlow, int outhigh) { int i; float f; for (i=0; i<256; i++) { if (i <= inlow) map[i] = outlow; else if (i >= inhigh) map[i] = outhigh; else { f = (float)(i - inlow) / (inhigh - inlow); map[i] = pow(f, 1/ingamma) * (outhigh - outlow) + outlow; } } /* for i 0-255 */ } static void help_optstr() { fprintf(stderr, "[%s] (%s) help\n", MOD_NAME, MOD_CAP); fprintf(stderr, "* Overview\n"); fprintf(stderr, " Scales luminosity values in the source image, similar to\n"); fprintf(stderr, " VirtualDub's 'levels' filter. This is useful to scale ITU-R601\n"); fprintf(stderr, " video (which limits luma to 16-253) back to the full 0-255 range.\n"); fprintf(stderr, "* Options\n"); fprintf(stderr, " input: luma range of input (%d-%d)\n", DEFAULT_IN_BLACK, DEFAULT_IN_WHITE); fprintf(stderr, " gamma: gamma ramp to apply to input luma (%f)\n", DEFAULT_IN_GAMMA); fprintf(stderr, " output: luma range of output (%d-%d)\n", DEFAULT_OUT_BLACK, DEFAULT_OUT_WHITE); } int tc_filter(vframe_list_t *vframe, char *options) { levels_private_data_t *pd; int tag = vframe->tag; if(tag & TC_AUDIO) return(0); pd = &levels_private_data[vframe->filter_id]; if(tag & TC_FILTER_GET_CONFIG) { char buf[64]; optstr_filter_desc(options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VYMO", "1"); snprintf(buf, 64, "%d-%d", DEFAULT_IN_BLACK, DEFAULT_IN_WHITE ); optstr_param(options, "input", "input luma range (black-white)", "%d-%d", buf, "0", "255", "0", "255" ); snprintf(buf, 64, "%f", DEFAULT_IN_GAMMA ); optstr_param(options, "gamma", "input luma gamma", "%f", buf, "0.5", "3.5" ); snprintf(buf, 64, "%d-%d", DEFAULT_OUT_BLACK, DEFAULT_OUT_WHITE ); optstr_param(options, "output", "output luma range (black-white)", "%d-%d", buf, "0", "255", "0", "255" ); } if(tag & TC_FILTER_INIT) { vob_t *vob; if(!(vob = tc_get_vob())) return(TC_IMPORT_ERROR); pd->parameter.in_black = DEFAULT_IN_BLACK; pd->parameter.in_white = DEFAULT_IN_WHITE; pd->parameter.in_gamma = DEFAULT_IN_GAMMA; pd->parameter.out_black = DEFAULT_OUT_BLACK; pd->parameter.out_white = DEFAULT_OUT_WHITE; if (options) { if(optstr_lookup(options, "help")) { help_optstr(); return(TC_IMPORT_ERROR); } optstr_get(options, "input", "%d-%d", &pd->parameter.in_black, &pd->parameter.in_white ); optstr_get(options, "gamma", "%f", &pd->parameter.in_gamma ); optstr_get(options, "output", "%d-%d", &pd->parameter.out_black, &pd->parameter.out_white ); } /* if options */ if(vob->im_v_codec != CODEC_YUV) { fprintf(stderr, "[%s] This filter is only capable of YUV mode\n", MOD_NAME); return(TC_IMPORT_ERROR); } build_map(pd->lumamap, pd->parameter.in_black, pd->parameter.in_white, pd->parameter.in_gamma, pd->parameter.out_black, pd->parameter.out_white); if(verbose) fprintf(stderr, "[%s]: %s %s #%d\n", MOD_NAME, MOD_VERSION, MOD_CAP, vframe->filter_id); fprintf(stderr, "[%s]: scaling %d-%d gamma %f to %d-%d\n", MOD_NAME, pd->parameter.in_black, pd->parameter.in_white, pd->parameter.in_gamma, pd->parameter.out_black, pd->parameter.out_white ); } /* if INIT */ if((tag & TC_POST_PROCESS) && !(vframe->attributes & TC_FRAME_IS_SKIPPED)) doColorScale(pd, vframe->video_buf, vframe->v_width, vframe->v_height); return(0); } transcode-1.0.0beta2/filter/filter_logo.c100644 001750 000000 00000037322 10134622237 0014042/* * filter_logo.c * * Copyright (C) Tilmann Bitterberg - April 2002 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* TODO: - animated gif/png support -> done - sequences of jpgs maybe would be nice. */ #define MOD_NAME "filter_logo.so" #define MOD_VERSION "v0.10 (2003-10-16)" #define MOD_CAP "render image in videostream" #define MOD_AUTHOR "Tilmann Bitterberg" /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "optstr.h" #include #include #include #include #include #include "framebuffer.h" #include "filter.h" #include "export/vid_aux.h" // transcode defines this as well as ImageMagick. #undef PACKAGE_NAME #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #undef PACKAGE_STRING #include // basic parameter enum POS { NONE, TOP_LEFT, TOP_RIGHT, BOT_LEFT, BOT_RIGHT, CENTER }; typedef struct MyFilterData { /* public */ char file[PATH_MAX]; /* input filename */ int posx; /* X offset in video */ int posy; /* Y offset in video */ enum POS pos; /* predifined position */ int flip; /* bool if to flip image */ int ignoredelay; /* allow the user to ignore delays */ int rgbswap; /* bool if swap colors */ int grayout; /* only render lume values */ unsigned int start, end; /* ranges */ /* private */ unsigned int nr_of_images; /* animated: number of images */ unsigned int cur_seq; /* animated: current image */ int cur_delay; /* animated: current delay */ char **yuv; /* buffer for rgb2yuv conversion */ } MyFilterData; static MyFilterData *mfd = NULL; /* from /src/transcode.c */ extern int rgbswap; extern int flip; /* should probably honor the other flags too */ /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf(" This filter renders an user specified image into the video.\n"); printf(" Any image format ImageMagick can read is accepted.\n"); printf(" Transparent images are also supported.\n"); printf(" Image origin is at the very top left.\n"); printf ("* Options\n"); printf (" 'file' Image filename (required) [logo.png]\n"); printf (" 'pos' Position (0-width x 0-height) [0x0]\n"); printf (" 'posdef' Position (0=None, 1=TopL, 2=TopR, 3=BotL, 4=BotR, 5=Center) [0]\n"); printf (" 'range' Restrict rendering to framerange (0-oo) [0-end]\n"); printf (" 'flip' Mirror image (0=off, 1=on) [0]\n"); printf (" 'rgbswap' Swap colors [0]\n"); printf (" 'grayout' YUV only: don't write Cb and Cr, makes a nice effect [0]\n"); printf (" 'ignoredelay' Ignore delay specified in animations [0]\n"); } int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; static ExceptionInfo exception_info; static ImageInfo *image_info; static Image *image; static Image *images; static PixelPacket *pixel_packet; Image *timg; Image *nimg; int column, row; int rgb_off = 0; //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYO", "1"); // buf, name, comment, format, val, from, to optstr_param (options, "file", "Image filename", "%s", "logo.png"); optstr_param (options, "posdef", "Position (0=None, 1=TopL, 2=TopR, 3=BotL, 4=BotR, 5=Center)", "%d", "0", "0", "5"); optstr_param (options, "pos", "Position (0-width x 0-height)", "%dx%d", "0x0", "0", "width", "0", "height"); optstr_param (options, "range", "Restrict rendering to framerange", "%u-%u", "0-0", "0", "oo", "0", "oo"); // bools optstr_param (options, "ignoredelay", "Ignore delay specified in animations", "", "0"); optstr_param (options, "rgbswap", "Swap red/blue colors", "", "0"); optstr_param (options, "grayout", "YUV only: don't write Cb and Cr, makes a nice effect", "", "0"); optstr_param (options, "flip", "Mirror image", "", "0"); return 0; } if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); if((mfd = (MyFilterData *)malloc (sizeof(MyFilterData))) == NULL) return (-1); //mfd->file = filename; strcpy (mfd->file, "logo.png"); mfd->yuv = NULL; mfd->flip = 0; mfd->pos = 0; mfd->posx = 0; mfd->posy = 0; mfd->start = 0; mfd->end = (unsigned int)-1; mfd->ignoredelay = 0; mfd->rgbswap = 0; mfd->grayout = 0; mfd->nr_of_images = 0; mfd->cur_seq = 0; if (options != NULL) { if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get (options, "file", "%[^:]", &mfd->file); optstr_get (options, "posdef", "%d", &mfd->pos); optstr_get (options, "pos", "%dx%d", &mfd->posx, &mfd->posy); optstr_get (options, "range", "%u-%u", &mfd->start, &mfd->end); if (optstr_get (options, "ignoredelay", "") >= 0) mfd->ignoredelay=!mfd->ignoredelay; if (optstr_get (options, "flip", "") >= 0) mfd->flip = !mfd->flip; if (optstr_get (options, "rgbswap", "") >= 0) mfd->rgbswap=!mfd->rgbswap; if (optstr_get (options, "grayout", "") >= 0) mfd->grayout=!mfd->grayout; if (optstr_get (options, "help", "") >= 0) help_optstr(); } if (verbose > 1) { printf (" Logo renderer Settings:\n"); printf (" file = %s\n", mfd->file); printf (" posdef = %d\n", mfd->pos); printf (" pos = %dx%d\n", mfd->posx, mfd->posy); printf (" range = %u-%u\n", mfd->start, mfd->end); printf (" flip = %d\n", mfd->flip); printf (" ignoredelay = %d\n", mfd->ignoredelay); printf (" rgbswap = %d\n", mfd->rgbswap); } InitializeMagick(""); GetExceptionInfo (&exception_info); image_info = CloneImageInfo ((ImageInfo *) NULL); strcpy(image_info->filename, mfd->file); image = ReadImage (image_info, &exception_info); if (image == (Image *) NULL) { MagickWarning (exception_info.severity, exception_info.reason, exception_info.description); strcpy(mfd->file, "/dev/null"); return 0; } if (image->columns > vob->ex_v_width || image->rows > vob->ex_v_height) { fprintf(stderr, "[%s] ERROR \"%s\" is too large\n", MOD_NAME, mfd->file); return(-1); } if (vob->im_v_codec == CODEC_YUV) { if ( (image->columns&1) || (image->rows&1)) { fprintf(stderr, "[%s] ERROR \"%s\" has odd sizes\n", MOD_NAME, mfd->file); return(-1); } } images = (Image *)GetFirstImageInList(image); nimg = NewImageList(); while ( images != (Image *)NULL) { if (mfd->flip || flip) { timg = FlipImage (images, &exception_info); if (timg == (Image *) NULL) { MagickError (exception_info.severity, exception_info.reason, exception_info.description); return -1; } AppendImageToList(&nimg, timg); } images = GetNextImageInList(images); mfd->nr_of_images++; } // check for memleaks; //DestroyImageList(image); if (mfd->flip || flip) { image = nimg; } /* initial delay. real delay = 1/100 sec * delay */ mfd->cur_delay = image->delay*vob->fps/100; if (verbose & TC_DEBUG) printf("Nr: %d Delay: %d image->del %lu|\n", mfd->nr_of_images, mfd->cur_delay, image->delay ); if (vob->im_v_codec == CODEC_YUV) { int i; if (!mfd->yuv) { mfd->yuv = (char **) malloc(sizeof(char *) * mfd->nr_of_images); if (!mfd->yuv) { fprintf (stderr, "[%s:%d] ERROR out of memory\n", __FILE__, __LINE__); return (-1); } for (i=0; inr_of_images; i++) { mfd->yuv[i]=(char *)malloc(sizeof(char)*image->columns*image->rows*3); if (!mfd->yuv[i]) { fprintf (stderr, "[%s:%d] ERROR out of memory\n", __FILE__, __LINE__); return (-1); } } } if (tc_rgb2yuv_init(image->columns, image->rows)<0) { fprintf(stderr, "[%s] ERROR rgb2yuv init failed\n", MOD_NAME); return(-1); } /* convert Magick RGB format to 24bit RGB */ if (!(rgbswap || mfd->rgbswap)) { images = image; for (i=0; inr_of_images; i++) { pixel_packet = GetImagePixels(images, 0, 0, images->columns, images->rows); for (row = 0; row < image->rows; row++) { for (column = 0; column < image->columns; column++) { mfd->yuv[i][(row * image->columns + column) * 3 + 0] = pixel_packet[image->columns*row + column].blue; mfd->yuv[i][(row * image->columns + column) * 3 + 1] = pixel_packet[image->columns*row + column].green; mfd->yuv[i][(row * image->columns + column) * 3 + 2] = pixel_packet[image->columns*row + column].red; } } images=images->next; } } else { images = image; for (i=0; inr_of_images; i++) { pixel_packet = GetImagePixels(images, 0, 0, images->columns, images->rows); for (row = 0; row < image->rows; row++) { for (column = 0; column < image->columns; column++) { mfd->yuv[i][(row * image->columns + column) * 3 + 0] = pixel_packet[image->columns*row + column].red; mfd->yuv[i][(row * image->columns + column) * 3 + 1] = pixel_packet[image->columns*row + column].green; mfd->yuv[i][(row * image->columns + column) * 3 + 2] = pixel_packet[image->columns*row + column].blue; } } images=images->next; } } for (i=0; inr_of_images; i++) { if(tc_rgb2yuv_core(mfd->yuv[i])<0) { fprintf(stderr, "[%s] ERROR rgb2yuv conversion failed\n", MOD_NAME); return(-1); } } } else { /* for RGB format is origin bottom left */ rgb_off = vob->ex_v_height - image->rows; mfd->posy = rgb_off - mfd->posy; } switch (mfd->pos) { case NONE: /* 0 */ break; case TOP_LEFT: mfd->posx = 0; mfd->posy = rgb_off; break; case TOP_RIGHT: mfd->posx = vob->ex_v_width - image->columns; break; case BOT_LEFT: mfd->posy = vob->ex_v_height - image->rows - rgb_off; break; case BOT_RIGHT: mfd->posx = vob->ex_v_width - image->columns; mfd->posy = vob->ex_v_height - image->rows - rgb_off; break; case CENTER: mfd->posx = (vob->ex_v_width - image->columns)/2; mfd->posy = (vob->ex_v_height- image->rows)/2; /* align to not cause color disruption */ if (mfd->posx&1) mfd->posx++; if (mfd->posy&1) mfd->posy++; break; } if ( mfd->posy < 0 || mfd->posx < 0 || mfd->posx+image->columns > vob->ex_v_width || mfd->posy+image->rows > vob->ex_v_height) { fprintf(stderr, "[%s] ERROR invalid position\n", MOD_NAME); return (-1); } /* for running through image sequence */ images = image; // filter init ok. if (verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (mfd) { int i; if (mfd->yuv) { for (i=0; inr_of_images; i++) if (mfd->yuv[i]) { free(mfd->yuv[i]); mfd->yuv[i] = NULL; } free(mfd->yuv); mfd->yuv = NULL; } free(mfd); mfd = NULL; } if (vob->im_v_codec == CODEC_YUV) tc_rgb2yuv_close(); if (image) { DestroyImage(image); DestroyImageInfo(image_info); } DestroyMagick(); return(0); } /* filter close */ //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if((ptr->tag & TC_POST_PROCESS) && (ptr->tag & TC_VIDEO) && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { int seq; if (ptr->id < mfd->start || ptr->id > mfd->end) return (0); if (!strcmp(mfd->file, "/dev/null")) return 0; mfd->cur_delay--; if (mfd->cur_delay < 0 || mfd->ignoredelay) { mfd->cur_seq = (mfd->cur_seq + 1) % mfd->nr_of_images; images = image; for (seq=0; seqcur_seq; seq++) images=images->next; mfd->cur_delay = images->delay*vob->fps/100; } pixel_packet = GetImagePixels(images, 0, 0, images->columns, images->rows); if(vob->im_v_codec == CODEC_RGB) { if (rgbswap || mfd->rgbswap) { for (row = 0; row < image->rows; row++) { for (column = 0; column < image->columns; column++) { if (pixel_packet[(images->rows - row - 1) * images->columns + column].opacity == 0) { int packet_off = (images->rows - row - 1) * images->columns + column; int ptr_off = ((row+mfd->posy)* vob->ex_v_width + column+mfd->posx) * 3; ptr->video_buf[ptr_off + 0] = pixel_packet[packet_off].red; ptr->video_buf[ptr_off + 1] = pixel_packet[packet_off].green; ptr->video_buf[ptr_off + 2] = pixel_packet[packet_off].blue; } /* !opaque */ } } } else { /* !rgbswap */ for (row = 0; row < images->rows; row++) { for (column = 0; column < images->columns; column++) { if (pixel_packet[(images->rows - row - 1) * images->columns + column].opacity == 0) { int packet_off = (images->rows - row - 1) * images->columns + column; int ptr_off = ((row+mfd->posy)* vob->ex_v_width + column+mfd->posx) * 3; ptr->video_buf[ptr_off + 0] = pixel_packet[packet_off].blue; ptr->video_buf[ptr_off + 1] = pixel_packet[packet_off].green; ptr->video_buf[ptr_off + 2] = pixel_packet[packet_off].red; } /* !opaque */ } } } } else { /* !RGB */ int size = vob->ex_v_width*vob->ex_v_height; int block = images->columns*images->rows; char *p1, *p2; char *y1, *y2; /* Y' */ for (row = 0; row < images->rows; row++) { for (column = 0; column < images->columns; column++) { if (pixel_packet[images->columns*row + column].opacity == 0) { *(ptr->video_buf + (row+mfd->posy)*vob->ex_v_width + column + mfd->posx) = mfd->yuv[mfd->cur_seq][images->columns*row + column]; } } } if (mfd->grayout) return(0); /* Cb, Cr */ p1 = ptr->video_buf + size + mfd->posy*vob->ex_v_width/4 + mfd->posx/2; y1 = &(mfd->yuv[mfd->cur_seq][block]); p2 = ptr->video_buf + 5*size/4 + mfd->posy*vob->ex_v_width/4 + mfd->posx/2; y2 = &mfd->yuv[mfd->cur_seq][5*block/4]; for (row = 0; row < images->rows/2; row++) { for (column = 0; column < images->columns/2; column++) { if (pixel_packet[images->columns*row*2 + column*2].opacity == 0) { p1[column] = y1[column]; p2[column] = y2[column]; } } p1 += vob->ex_v_width/2; y1 += images->columns/2; p2 += vob->ex_v_width/2; y2 += images->columns/2; } } } return(0); } transcode-1.0.0beta2/filter/filter_logoaway.c100644 001750 000000 00000107137 10161261376 0014731/* * filter_logoaway.c * * Copyright (C) Thomas Wehrspann - 2002/2003 * * This plugin is based on ideas of Krzysztof Wojdon's * logoaway filter for VirtualDub * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* * TODO: * -blur - */ /* * ChangeLog: * v0.1 (2002-12-04) Thomas Wehrspann * -First version * * v0.1 (2002-12-19) Tilmann Bitterberg * -Support for new filter-API(optstr_param) added * * v0.2 (2003-01-15) Thomas Wehrspann * -Fixed RGB-SOLID-mode * -Added alpha channel * now you need ImageMagick * -Documentation added * * v0.2 (2003-01-21) Tilmann Bitterberg * -More support for new filter-API. * * v0.2 (2003-04-08) Tilmann Bitterberg * -change include order to avoid warnings from Magick * * v0.3 (2003-04-24) Thomas Wehrspann * -Fixed bug with multiple instances * -coordinates in RGB=YUV * -Added SHAPE-mode * -Documentation updated * * v0.4 (2003-09-03) Tilmann Bitterberg * -add information for shape mode * * v0.5 (2004-03-07) Thomas Wehrspann * -Changed filter to PRE process * -Added dump image function (RGB only) */ #define MOD_NAME "filter_logoaway.so" #define MOD_VERSION "v0.5 (2004-03-07)" #define MOD_CAP "remove an image from the video" #define MOD_AUTHOR "Thomas Wehrspann " /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "transcode.h" #include "framebuffer.h" #include "filter.h" #include "optstr.h" #include "tc_func_excl.h" // transcode defines this as well as ImageMagick. #undef PACKAGE_NAME #undef PACKAGE_TARNAME #undef PACKAGE_VERSION #undef PACKAGE_STRING #include static vob_t *vob=NULL; static char *modes[] = {"NONE", "SOLID", "XY", "SHAPE"}; typedef struct logoaway_data { unsigned int start, end; int xpos, ypos; int width, height; int mode; int border; int xweight, yweight; int rcolor, gcolor, bcolor; int ycolor, ucolor, vcolor; char file[PATH_MAX]; int alpha; ExceptionInfo exception_info; Image *image; ImageInfo *image_info; PixelPacket *pixel_packet; int dump; char *dump_buf; Image *dumpimage; ImageInfo *dumpimage_info; } logoaway_data; static logoaway_data *data[MAX_FILTER]; /********************************************************* * help text * this function prints out a small description * of this filter and the commandline options, * when the "help" option is given * @param void nothing * @return void nothing *********************************************************/ static void help_optstr(void) { printf ("%s", WHITE); printf ("[%s] (%s) help \n", MOD_NAME, MOD_CAP); printf ("* Overview \n"); printf (" This filter removes an image in a user specified area from the video. \n"); printf (" You can choose from different methods. \n"); printf (" \n"); printf ("* Options \n"); printf (" 'range' Frame Range (0-oo) [0-end] \n"); printf (" 'pos' Position (0-width x 0-height) [0x0] \n"); printf (" 'size' Size (0-width x 0-height) [10x10] \n"); printf (" 'mode' Filter Mode (0=none,1=solid,2=xy,3=shape) [0] \n"); printf (" 'border' Visible Border \n"); printf (" 'dump' Dump filter area to file \n"); printf (" 'xweight' X-Y Weight (0%%-100%%) [50] \n"); printf (" 'fill' Solid Fill Color (RRGGBB) [000000] \n"); printf (" 'file' Image with alpha/shape information [] \n"); printf (" \n"); printf ("%s", GRAY); } /********************************************************* * blend two pixel * this function blends two pixel with the given * weight * @param srcPixel source pixel value * destPixel source pixel value * alpha weight * @return unsigned char new pixel value *********************************************************/ unsigned char alpha_blending(unsigned char srcPixel, unsigned char destPixel, int alpha) { return ( ( ( alpha * ( srcPixel - destPixel ) ) >> 8 ) + destPixel ); } /********************************************************* * processing of the video frame (RGB codec) * processes the actual frame depending on the * selected mode * @param buffer video buffer * width video width * height video height * instance filter instance * @return void nothing *********************************************************/ void work_with_rgb_frame(char *buffer, int width, int height, int instance) { int row, col, i; int xdistance, ydistance, distance_west, distance_north; unsigned char hcalc, vcalc; int buf_off, packet_off, buf_off_xpos, buf_off_width, buf_off_ypos, buf_off_height; int alpha_hori, alpha_vert; if(data[instance]->dump) { // DUMP for(row=data[instance]->ypos; rowheight; ++row) { for(col=data[instance]->xpos; colwidth; ++col) { packet_off = ((row-data[instance]->ypos)*(data[instance]->width-data[instance]->xpos)+(col-data[instance]->xpos)) * 3; buf_off = ((height-row)*width+col) * 3; /* R */ data[instance]->dump_buf[packet_off +0] = buffer[buf_off +0]; /* G */ data[instance]->dump_buf[packet_off +1] = buffer[buf_off +1]; /* B */ data[instance]->dump_buf[packet_off +2] = buffer[buf_off +2]; } } data[instance]->dumpimage = ConstituteImage(data[instance]->width-data[instance]->xpos, data[instance]->height-data[instance]->ypos, "RGB", CharPixel, data[instance]->dump_buf, &data[instance]->exception_info); snprintf (data[instance]->dumpimage->filename, MaxTextExtent, "dump[%d].png", instance); WriteImage(data[instance]->dumpimage_info, data[instance]->dumpimage); } switch(data[instance]->mode) { case 0: // NONE break; case 1: // SOLID for(row=data[instance]->ypos; rowheight; ++row) { for(col=data[instance]->xpos; colwidth; ++col) { buf_off = ((height-row)*width+col) * 3; packet_off = (row-data[instance]->ypos) * (data[instance]->width-data[instance]->xpos) + (col-data[instance]->xpos); /* R */ buffer[buf_off +0] = data[instance]->alpha?(alpha_blending( buffer[buf_off +0], data[instance]->rcolor, data[instance]->pixel_packet[packet_off].red >> 8 )):data[instance]->rcolor; /* G */ buffer[buf_off +1] = data[instance]->alpha?(alpha_blending( buffer[buf_off +1], data[instance]->gcolor, data[instance]->pixel_packet[packet_off].green >> 8 )):data[instance]->gcolor; /* B */ buffer[buf_off +2] = data[instance]->alpha?(alpha_blending( buffer[buf_off +2], data[instance]->bcolor, data[instance]->pixel_packet[packet_off].blue >> 8 )):data[instance]->bcolor; } } break; case 2: // XY xdistance = 256 / (data[instance]->width - data[instance]->xpos); ydistance = 256 / (data[instance]->height - data[instance]->ypos); for(row=data[instance]->ypos; rowheight; ++row) { distance_north = data[instance]->height - row; alpha_vert = ydistance * distance_north; buf_off_xpos = ((height-row)*width+data[instance]->xpos) * 3; buf_off_width = ((height-row)*width+data[instance]->width) * 3; for(col=data[instance]->xpos; colwidth; ++col) { distance_west = data[instance]->width - col; alpha_hori = xdistance * distance_west; buf_off_ypos = ((height-data[instance]->ypos)*width+col) * 3; buf_off_height = ((height-data[instance]->height)*width+col) * 3; buf_off = ((height-row)*width+col) * 3; packet_off = (row-data[instance]->ypos) * (data[instance]->width-data[instance]->xpos) + (col-data[instance]->xpos); /* R */ hcalc = alpha_blending( buffer[buf_off_xpos +0], buffer[buf_off_width +0], alpha_hori ); vcalc = alpha_blending( buffer[buf_off_ypos +0], buffer[buf_off_height +0], alpha_vert ); buffer[buf_off +0] = data[instance]->alpha?alpha_blending( buffer[buf_off +0], (hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100, data[instance]->pixel_packet[packet_off].red >> 8):((hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100); /* G */ hcalc = alpha_blending( buffer[buf_off_xpos +1], buffer[buf_off_width +1], alpha_hori ); vcalc = alpha_blending( buffer[buf_off_ypos +1], buffer[buf_off_height +1], alpha_vert ); buffer[buf_off +1] = data[instance]->alpha?alpha_blending( buffer[buf_off +1], (hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100, data[instance]->pixel_packet[packet_off].red >> 8):((hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100); /* B */ hcalc = alpha_blending( buffer[buf_off_xpos +2], buffer[buf_off_width +2], alpha_hori ); vcalc = alpha_blending( buffer[buf_off_ypos +2], buffer[buf_off_height +2], alpha_vert ); buffer[buf_off +2] = data[instance]->alpha?alpha_blending( buffer[buf_off +2], (hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100, data[instance]->pixel_packet[packet_off].red >> 8):((hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100); } } break; case 3: // SHAPE xdistance = 256 / (data[instance]->width - data[instance]->xpos); ydistance = 256 / (data[instance]->height - data[instance]->ypos); for(row=data[instance]->ypos; rowheight; ++row) { distance_north = data[instance]->height - row; alpha_vert = ydistance * distance_north; for(col=data[instance]->xpos; colwidth; ++col) { distance_west = data[instance]->width - col; alpha_hori = xdistance * distance_west; buf_off = ((height-row)*width+col) * 3; packet_off = (row-data[instance]->ypos) * (data[instance]->width-data[instance]->xpos) + (col-data[instance]->xpos); buf_off_xpos = ((height-row)*width+data[instance]->xpos) * 3; buf_off_width = ((height-row)*width+data[instance]->width) * 3; buf_off_ypos = ((height-data[instance]->ypos)*width+col) * 3; buf_off_height = ((height-data[instance]->height)*width+col) * 3; i=0; while( (data[instance]->pixel_packet[packet_off-i].red != 65535) && (col-i>data[instance]->xpos) ) i++; // FIXME : ImageMagick MaxRGB=256 oder 65536 buf_off_xpos = ((height-row)*width + col-i) * 3; i=0; while( (data[instance]->pixel_packet[packet_off+i].red != 65535) && (col+iwidth) ) i++; buf_off_width = ((height-row)*width + col+i) * 3; i=0; while( (data[instance]->pixel_packet[packet_off-i*(data[instance]->width-data[instance]->xpos)].red != 65535) && (row-i>data[instance]->ypos) ) i++; buf_off_ypos = (height*width*3)-((row-i)*width - col) * 3; i=0; while( (data[instance]->pixel_packet[packet_off+i*(data[instance]->width-data[instance]->xpos)].red != 65535) && (row+iheight) ) i++; buf_off_height = (height*width*3)-((row+i)*width - col) * 3; /* R */ hcalc = alpha_blending( buffer[buf_off_xpos +0], buffer[buf_off_width +0], alpha_hori ); vcalc = alpha_blending( buffer[buf_off_ypos +0], buffer[buf_off_height +0], alpha_vert ); buffer[buf_off +0] = data[instance]->alpha?alpha_blending( buffer[buf_off +0], (hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100, data[instance]->pixel_packet[packet_off].red >> 8):((hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100); /* G */ hcalc = alpha_blending( buffer[buf_off_xpos +1], buffer[buf_off_width +1], alpha_hori ); vcalc = alpha_blending( buffer[buf_off_ypos +1], buffer[buf_off_height +1], alpha_vert ); buffer[buf_off +1] = data[instance]->alpha?alpha_blending( buffer[buf_off +1], (hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100, data[instance]->pixel_packet[packet_off].red >> 8):((hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100); /* B */ hcalc = alpha_blending( buffer[buf_off_xpos +2], buffer[buf_off_width +2], alpha_hori ); vcalc = alpha_blending( buffer[buf_off_ypos +2], buffer[buf_off_height +2], alpha_vert ); buffer[buf_off +2] = data[instance]->alpha?alpha_blending( buffer[buf_off +2], (hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100, data[instance]->pixel_packet[packet_off].red >> 8):((hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100); } } break; } if(data[instance]->border) { // BORDER for(row=data[instance]->ypos; rowheight; ++row) { if((row == data[instance]->ypos) || (row==data[instance]->height-1)) { for(col=data[instance]->xpos*3; colwidth*3; ++col) if(col&1) buffer[((height-row)*width*3+col)] = 255 & 0xff; } if(row&1) { buf_off = ((height-row)*width+data[instance]->xpos)*3; buffer[buf_off +0] = 255; buffer[buf_off +1] = 255; buffer[buf_off +2] = 255; } if(row&1) { buf_off = ((height-row)*width+data[instance]->width)*3; buffer[buf_off +0] = 255; buffer[buf_off +1] = 255; buffer[buf_off +2] = 255; } } } } /********************************************************* * processing of the video frame (YUV codec) * processes the actual frame depend on the * selected mode * @param buffer video buffer * width video width * height video height * instance filter instance * @return void nothing *********************************************************/ void work_with_yuv_frame(char *buffer, int width, int height, int instance) { int row, col, i; int craddr, cbaddr; int xdistance, ydistance, distance_west, distance_north; unsigned char hcalc, vcalc; int buf_off, packet_off=0, buf_off_xpos, buf_off_width, buf_off_ypos, buf_off_height; int alpha_hori, alpha_vert; craddr = (width * height); cbaddr = (width * height) * 5 / 4; switch(data[instance]->mode) { case 0: // NONE break; case 1: // SOLID //FIXME : "Rnder" entfernen /* Y */ for(row=data[instance]->ypos; rowheight; ++row) { for(col=data[instance]->xpos; colwidth; ++col) { buf_off = row*width+col; packet_off = (row-data[instance]->ypos) * (data[instance]->width-data[instance]->xpos) + (col-data[instance]->xpos); buffer[buf_off] = data[instance]->alpha?alpha_blending( buffer[buf_off], data[instance]->ycolor, data[instance]->pixel_packet[packet_off].red >> 8):data[instance]->ycolor; } } /* Cb, Cr */ for(row=data[instance]->ypos/2+1; rowheight/2; ++row) { for(col=data[instance]->xpos/2+1; colwidth/2; ++col) { buf_off = row*width/2+col; packet_off = (row*2-data[instance]->ypos) * (data[instance]->width-data[instance]->xpos) + (col*2-data[instance]->xpos); buffer[craddr + buf_off] = data[instance]->alpha?alpha_blending( buffer[craddr + buf_off], data[instance]->ucolor, data[instance]->pixel_packet[packet_off].red >> 8):data[instance]->ucolor; buffer[cbaddr + buf_off] = data[instance]->alpha?alpha_blending( buffer[cbaddr + buf_off], data[instance]->vcolor, data[instance]->pixel_packet[packet_off].red >> 8):data[instance]->vcolor; } } break; case 2: // XY /* Y' */ xdistance = 256 / (data[instance]->width - data[instance]->xpos); ydistance = 256 / (data[instance]->height - data[instance]->ypos); for(row=data[instance]->ypos; rowheight; ++row) { distance_north = data[instance]->height - row; alpha_vert = ydistance * distance_north; buf_off_xpos = row*width+data[instance]->xpos; buf_off_width = row*width+data[instance]->width; for(col=data[instance]->xpos; colwidth; ++col) { distance_west = data[instance]->width - col; alpha_hori = xdistance * distance_west; buf_off = row*width+col; buf_off_ypos = data[instance]->ypos*width+col; buf_off_height = data[instance]->height*width+col; packet_off = (row-data[instance]->ypos) * (data[instance]->width-data[instance]->xpos) + (col-data[instance]->xpos); hcalc = alpha_blending( buffer[buf_off_xpos], buffer[buf_off_width], alpha_hori ); vcalc = alpha_blending( buffer[buf_off_ypos], buffer[buf_off_height], alpha_vert ); buffer[buf_off] = data[instance]->alpha?alpha_blending( buffer[buf_off], (hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100, data[instance]->pixel_packet[packet_off].red >> 8):((hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100); } } /* Cb, Cr */ xdistance = 512 / (data[instance]->width - data[instance]->xpos); ydistance = 512 / (data[instance]->height - data[instance]->ypos); for (row=data[instance]->ypos/2+1; rowheight/2; ++row) { distance_north = data[instance]->height/2 - row; alpha_vert = ydistance * distance_north; buf_off_xpos = row*width/2+data[instance]->xpos/2; buf_off_width = row*width/2+data[instance]->width/2; for (col=data[instance]->xpos/2+1; colwidth/2; ++col) { distance_west = data[instance]->width/2 - col; alpha_hori = xdistance * distance_west; buf_off = row*width/2+col; buf_off_ypos = data[instance]->ypos/2*width/2+col; buf_off_height = data[instance]->height/2*width/2+col; packet_off = (row*2-data[instance]->ypos) * (data[instance]->width-data[instance]->xpos) + (col*2-data[instance]->xpos); hcalc = alpha_blending( buffer[craddr + buf_off_xpos], buffer[craddr + buf_off_width], alpha_hori ); vcalc = alpha_blending( buffer[craddr + buf_off_ypos], buffer[craddr + buf_off_height], alpha_vert ); buffer[craddr + buf_off] = data[instance]->alpha?alpha_blending( buffer[craddr + buf_off], (hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100, data[instance]->pixel_packet[packet_off].red >> 8):((hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100); hcalc = alpha_blending( buffer[cbaddr + buf_off_xpos], buffer[cbaddr + buf_off_width], alpha_hori ); vcalc = alpha_blending( buffer[cbaddr + buf_off_ypos], buffer[cbaddr + buf_off_height], alpha_vert ); buffer[cbaddr + buf_off] = data[instance]->alpha?alpha_blending( buffer[cbaddr + buf_off], (hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100, data[instance]->pixel_packet[packet_off].red >> 8):((hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100); } } break; case 3: // SHAPE xdistance = 256 / (data[instance]->width - data[instance]->xpos); ydistance = 256 / (data[instance]->height - data[instance]->ypos); for(row=data[instance]->ypos; rowheight; ++row) { distance_north = data[instance]->height - row; alpha_vert = ydistance * distance_north; for(col=data[instance]->xpos; colwidth; ++col) { distance_west = data[instance]->width - col; alpha_hori = xdistance * distance_west; buf_off = (row*width+col); packet_off = (row-data[instance]->ypos) * (data[instance]->width-data[instance]->xpos) + (col-data[instance]->xpos); i=0; while( (data[instance]->pixel_packet[packet_off-i].red != 65535) && (col-i>data[instance]->xpos) ) i++; // FIXME : ImageMagick MaxRGB=256 oder 65536 buf_off_xpos = (row*width + col-i); i=0; while( (data[instance]->pixel_packet[packet_off+i].red != 65535) && (col+iwidth) ) i++; buf_off_width = (row*width + col+i); i=0; while( (data[instance]->pixel_packet[packet_off-i*(data[instance]->width-data[instance]->xpos)].red != 65535) && (row-i>data[instance]->ypos) ) i++; buf_off_ypos = ((row-i)*width + col); i=0; while( (data[instance]->pixel_packet[packet_off+i*(data[instance]->width-data[instance]->xpos)].red != 65535) && (row+iheight) ) i++; buf_off_height = ((row+i)*width + col); hcalc = alpha_blending( buffer[buf_off_xpos], buffer[buf_off_width], alpha_hori ); vcalc = alpha_blending( buffer[buf_off_ypos], buffer[buf_off_height], alpha_vert ); buffer[buf_off] = data[instance]->alpha?alpha_blending( buffer[buf_off], (hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100, data[instance]->pixel_packet[packet_off].red >> 8):((hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100); } } /* Cb, Cr */ xdistance = 512 / (data[instance]->width - data[instance]->xpos); ydistance = 512 / (data[instance]->height - data[instance]->ypos); for (row=data[instance]->ypos/2+1; rowheight/2; ++row) { distance_north = data[instance]->height/2 - row; alpha_vert = ydistance * distance_north; for (col=data[instance]->xpos/2+1; colwidth/2; ++col) { distance_west = data[instance]->width/2 - col; alpha_hori = xdistance * distance_west; i=0; while( (data[instance]->pixel_packet[packet_off-i].red != 65535) && (col-i>data[instance]->xpos) ) i++; // FIXME : ImageMagick MaxRGB=256 oder 65536 buf_off_xpos = (row*width/2 + col-i); i=0; while( (data[instance]->pixel_packet[packet_off+i].red != 65535) && (col+iwidth) ) i++; buf_off_width = (row*width/2 + col+i); i=0; while( (data[instance]->pixel_packet[packet_off-i*(data[instance]->width-data[instance]->xpos)].red != 65535) && (row-i>data[instance]->ypos) ) i++; buf_off_ypos = ((row-i)*width/2 + col); i=0; while( (data[instance]->pixel_packet[packet_off+i*(data[instance]->width-data[instance]->xpos)].red != 65535) && (row+iheight) ) i++; buf_off_height = ((row+i)*width/2 + col); buf_off = row*width/2+col; buf_off_ypos = data[instance]->ypos/2*width/2+col; buf_off_height = data[instance]->height/2*width/2+col; packet_off = (row*2-data[instance]->ypos) * (data[instance]->width-data[instance]->xpos) + (col*2-data[instance]->xpos); hcalc = alpha_blending( buffer[craddr + buf_off_xpos], buffer[craddr + buf_off_width], alpha_hori ); vcalc = alpha_blending( buffer[craddr + buf_off_ypos], buffer[craddr + buf_off_height], alpha_vert ); buffer[craddr + buf_off] = data[instance]->alpha?alpha_blending( buffer[craddr + buf_off], (hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100, data[instance]->pixel_packet[packet_off].red >> 8):((hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100); hcalc = alpha_blending( buffer[cbaddr + buf_off_xpos], buffer[cbaddr + buf_off_width], alpha_hori ); vcalc = alpha_blending( buffer[cbaddr + buf_off_ypos], buffer[cbaddr + buf_off_height], alpha_vert ); buffer[cbaddr + buf_off] = data[instance]->alpha?alpha_blending( buffer[cbaddr + buf_off], (hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100, data[instance]->pixel_packet[packet_off].red >> 8):((hcalc*data[instance]->xweight + vcalc*data[instance]->yweight)/100); } } break; buf_off_xpos = (row*width+data[instance]->xpos); buf_off_width = (row*width+data[instance]->width); buf_off_ypos = (data[instance]->ypos*width+col); buf_off_height = (data[instance]->height*width+col); } if(data[instance]->border) { // BORDER for(row=data[instance]->ypos; rowheight; ++row) { if((row == data[instance]->ypos) || (row==data[instance]->height-1)) { for(col=data[instance]->xpos; colwidth; ++col) if(col&1) buffer[row*width+col] = 255 & 0xff; } if(row&1) buffer[row*width+data[instance]->xpos] = 255 & 0xff; if(row&1) buffer[row*width+data[instance]->width] = 255 & 0xff; } } } /*------------------------------------------------- * * main * *-------------------------------------------------*/ int tc_filter(vframe_list_t *ptr, char *options) { int instance=ptr->filter_id; //---------------------------------- // // filter get config // //---------------------------------- if(ptr->tag & TC_FILTER_GET_CONFIG && options) { char buf[255]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYOM", "1"); snprintf (buf, sizeof(buf), "%u-%u", data[instance]->start, data[instance]->end); optstr_param (options, "range", "Frame Range", "%d-%d", buf, "0", "oo", "0", "oo"); snprintf (buf, sizeof(buf), "%dx%d", data[instance]->xpos, data[instance]->ypos); optstr_param (options, "pos", "Position of logo", "%dx%d", buf, "0", "width", "0", "height"); snprintf (buf, sizeof(buf), "%dx%d", data[instance]->width, data[instance]->height); optstr_param (options, "size", "Size of logo", "%dx%d", buf, "0", "width", "0", "height"); snprintf (buf, sizeof(buf), "%d", data[instance]->mode); optstr_param (options, "mode", "Filter Mode (0=none,1=solid,2=xy,3=shape)", "%d", buf, "0", "3"); snprintf (buf, sizeof(buf), "%d", data[instance]->border); optstr_param (options, "border", "Visible Border", "", buf); snprintf (buf, sizeof(buf), "%d", data[instance]->dump); optstr_param (options, "dump", "Dump filterarea to file", "", buf); snprintf (buf, sizeof(buf), "%d", data[instance]->xweight); optstr_param (options, "xweight","X-Y Weight(0%-100%)", "%d", buf, "0", "100"); snprintf (buf, sizeof(buf), "%x%x%x", data[instance]->rcolor, data[instance]->gcolor, data[instance]->bcolor); optstr_param (options, "fill", "Solid Fill Color(RGB)", "%2x%2x%2x", buf, "00", "FF", "00", "FF", "00", "FF"); snprintf (buf, sizeof(buf), "%s", data[instance]->file); optstr_param (options, "file", "Image with alpha/shape information", "%s", buf); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); if((data[instance] = (logoaway_data *)malloc (sizeof(logoaway_data))) == NULL) { fprintf (stderr, "[%s:%d] ERROR: out of memory\n", __FILE__, __LINE__); return (-1); } data[instance]->start = 0; data[instance]->end = (unsigned int)-1; data[instance]->xpos = -1; data[instance]->ypos = -1; data[instance]->width = -1; data[instance]->height = -1; data[instance]->mode = 0; data[instance]->border = 0; data[instance]->xweight = 50; data[instance]->yweight = 50; data[instance]->rcolor = 0; data[instance]->gcolor = 0; data[instance]->bcolor = 0; data[instance]->ycolor = 16; data[instance]->ucolor = 128; data[instance]->vcolor = 128; data[instance]->alpha = 0; data[instance]->dump = 0; // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(options!=NULL) { optstr_get (options, "range", "%d-%d", &data[instance]->start, &data[instance]->end); optstr_get (options, "pos", "%dx%d", &data[instance]->xpos, &data[instance]->ypos); optstr_get (options, "size", "%dx%d", &data[instance]->width, &data[instance]->height); data[instance]->width += data[instance]->xpos; data[instance]->height += data[instance]->ypos; optstr_get (options, "mode", "%d", &data[instance]->mode); if (optstr_get (options, "border", "") >= 0) data[instance]->border = 1; if (optstr_get (options, "help", "") >= 0) help_optstr(); optstr_get (options, "xweight", "%d", &data[instance]->xweight); data[instance]->yweight = 100 - data[instance]->xweight; optstr_get (options, "fill", "%2x%2x%2x", &data[instance]->rcolor, &data[instance]->gcolor, &data[instance]->bcolor); data[instance]->ycolor = (0.257 * data[instance]->rcolor) + (0.504 * data[instance]->gcolor) + (0.098 * data[instance]->bcolor) + 16; data[instance]->ucolor = (0.439 * data[instance]->rcolor) - (0.368 * data[instance]->gcolor) - (0.071 * data[instance]->bcolor) + 128; data[instance]->vcolor = -(0.148 * data[instance]->rcolor) - (0.291 * data[instance]->gcolor) + (0.439 * data[instance]->bcolor) + 128; if (optstr_get (options, "file", "%[^:]", &data[instance]->file) >= 0) data[instance]->alpha = 1; if (optstr_get (options, "dump", "") >= 0) data[instance]->dump = 1; } if(verbose) printf("[%s] instance(%d) options=%s\n", MOD_NAME, instance, options); if(verbose > 1) { printf (" LogoAway Filter Settings: \n"); printf (" pos = %dx%d \n", data[instance]->xpos, data[instance]->ypos); printf (" size = %dx%d \n", data[instance]->width-data[instance]->xpos, data[instance]->height-data[instance]->ypos); printf (" mode = %d(%s) \n", data[instance]->mode, modes[data[instance]->mode]); printf (" border = %d \n", data[instance]->border); printf (" x-y weight = %d:%d \n", data[instance]->xweight, data[instance]->yweight); printf (" fill color = %2X%2X%2X\n", data[instance]->rcolor, data[instance]->gcolor, data[instance]->bcolor); if(data[instance]->alpha) printf (" file = %s \n", data[instance]->file); if(data[instance]->dump) printf (" dump = %d \n", data[instance]->dump); } if( (data[instance]->xpos > vob->im_v_width) || (data[instance]->ypos > vob->im_v_height) || (data[instance]->xpos < 0) || (data[instance]->ypos < 0) ) { fprintf(stderr, "[%s] ERROR: invalid position\n", MOD_NAME); return(-1); } if( (data[instance]->width > vob->im_v_width) || (data[instance]->height > vob->im_v_height) || (data[instance]->width-data[instance]->xpos < 0) || (data[instance]->height-data[instance]->ypos < 0) ) { fprintf(stderr, "[%s] ERROR: invalid size\n", MOD_NAME); return(-1); } if( (data[instance]->xweight > 100) || (data[instance]->xweight < 0) ) { fprintf(stderr, "[%s] ERROR: invalid x weight\n", MOD_NAME); return(-1); } if( (data[instance]->mode < 0) || (data[instance]->mode > 3) ) { fprintf(stderr, "[%s] ERROR: invalid mode\n", MOD_NAME); return(-1); } if( (data[instance]->mode == 3) && (data[instance]->alpha == 0) ) { fprintf(stderr, "[%s] ERROR: alpha/shape file needed for SHAPE-mode\n", MOD_NAME); return(-1); } if((data[instance]->alpha) || (data[instance]->dump)) { InitializeMagick(""); GetExceptionInfo(&data[instance]->exception_info); if(data[instance]->alpha) { data[instance]->image_info = CloneImageInfo((ImageInfo *) NULL); strcpy(data[instance]->image_info->filename, data[instance]->file); data[instance]->image = ReadImage(data[instance]->image_info, &data[instance]->exception_info); if (data[instance]->image == (Image *) NULL) { fprintf(stderr, "[%s] ERROR: ", MOD_NAME); MagickWarning (data[instance]->exception_info.severity, data[instance]->exception_info.reason, data[instance]->exception_info.description); return(-1); } if ((data[instance]->image->columns != (data[instance]->width-data[instance]->xpos)) || (data[instance]->image->rows != (data[instance]->height-data[instance]->ypos))) { fprintf(stderr, "[%s] ERROR: \"%s\" has incorrect size\n", MOD_NAME, data[instance]->file); return(-1); } data[instance]->pixel_packet = GetImagePixels(data[instance]->image, 0, 0, data[instance]->image->columns, data[instance]->image->rows); } if(data[instance]->dump) { if((data[instance]->dump_buf = malloc ((data[instance]->width-data[instance]->xpos)*(data[instance]->height-data[instance]->ypos)*3)) == NULL) fprintf (stderr, "[%s:%d] ERROR: out of memory\n", __FILE__, __LINE__); data[instance]->dumpimage_info = CloneImageInfo((ImageInfo *) NULL); } } return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (data[instance]->image != (Image *)NULL) { DestroyImage(data[instance]->image); DestroyImageInfo(data[instance]->image_info); } if (data[instance]->dumpimage != (Image *)NULL) { DestroyImage(data[instance]->dumpimage); DestroyImageInfo(data[instance]->dumpimage_info); DestroyConstitute(); } DestroyExceptionInfo(&data[instance]->exception_info); DestroyMagick(); if(data[instance]->dump_buf) free(data[instance]->dump_buf); if(data[instance]) free(data[instance]); data[instance] = NULL; return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- if(ptr->tag & TC_PRE_PROCESS && ptr->tag & TC_VIDEO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { if (ptr->id < data[instance]->start || ptr->id > data[instance]->end) return (0); if(vob->im_v_codec==CODEC_RGB) { work_with_rgb_frame(ptr->video_buf, vob->im_v_width, vob->im_v_height, instance); } else { work_with_yuv_frame(ptr->video_buf, vob->im_v_width, vob->im_v_height, instance); } } return(0); } transcode-1.0.0beta2/filter/filter_lowpass.c100644 001750 000000 00000011317 10161261376 0014571/* * filter_lowpass.c * * Based on `filt'-code by Markus Wandel * http://wandel.ca/homepage/audiohacks.html * Copyright (C) Tilmann Bitterberg * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_lowpass.so" #define MOD_VERSION "v0.1.0 (2002-02-26)" #define MOD_CAP "High and low pass filter" #define MOD_AUTHOR "Tilmann Bitterberg" #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDINT_H #include #endif #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" static short *array_l = NULL, *array_r = NULL; static int taps = 30; static int highpass = 0; static int p = 0; static int mono = 0; /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ int tc_filter(aframe_list_t *ptr, char *options) { vob_t *vob=NULL; //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(options != NULL) { optstr_get(options, "taps", "%d", &taps); } if(taps < 0) { taps = -taps; highpass = 1; } array_r = malloc (taps * sizeof(short)); array_l = malloc (taps * sizeof(short)); if (!array_r || !array_l) { fprintf (stderr, "[%s] Malloc failed in %d\n", MOD_NAME, __LINE__); return TC_IMPORT_ERROR; } memset (array_r, 0, taps * sizeof(short)); memset (array_l, 0, taps * sizeof(short)); if (vob->a_chan == 1) { mono = 1; } if (vob->a_bits != 16) { fprintf(stderr, "[%s] This filter only supports 16 bit samples\n", MOD_NAME); return (TC_IMPORT_ERROR); } return(0); } //---------------------------------- // // filter get config // //---------------------------------- if(ptr->tag & TC_FILTER_GET_CONFIG && options) { char buf[255]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "AE", "1"); snprintf (buf, sizeof(buf), "%d", taps); optstr_param (options, "taps", "strength (may be negative)", "%d", buf, "-50", "50"); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (array_r) { free (array_r); array_r = NULL; } if (array_l) { free (array_l); array_l = NULL; } return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if(ptr->tag & TC_PRE_S_PROCESS && ptr->tag & TC_AUDIO) { int i, j; int al = 0, ar = 0; short *s = (short *)ptr->audio_buf; if (taps == 0) return 0; if (mono) { // mono, 16bit only for (i = 0; iaudio_size>>1; i++) { array_r[p] = s[i]; for (j=0; jaudio_size>>1; i++) { array_l[p] = s[i+0]; array_r[p] = s[i+1]; for (j=0; j #include static char *buffer; /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ void ymask_yuv(unsigned char *buf, vob_t *vob, int top, int bottom) { int i; unsigned char *bufcr, *bufcb; int w2 = vob->im_v_width / 2; // printf("%d %d\n", top, bottom); bufcr = buf + vob->im_v_width * vob->im_v_height; bufcb = buf + vob->im_v_width * vob->im_v_height * 5/ 4; for (i = top; i <= bottom; i+=2) { memset(&buf[i * vob->im_v_width], 0x10, vob->im_v_width); memset(&buf[(i + 1) * vob->im_v_width], 0x10, vob->im_v_width); memset(&bufcr[(i / 2) * w2], 128, w2); memset(&bufcb[(i / 2) * w2], 128, w2); } } void ymask_yuv422(unsigned char *buf, vob_t *vob, int top, int bottom) { int i,j; unsigned char *t; for (i = top; i <= bottom; i++) { t = buf + i * vob->im_v_width * 2; for (j=0; jim_v_width*2; j++) *t++ = (j&1)?0x10:0x80; } } void ymask_rgb(unsigned char *buf, vob_t *vob, int top, int bottom) { int i; for (i = top; i <= bottom; i++) { memset(&buf[i * vob->im_v_width * 3], 0, vob->im_v_width * 3); } } void xmask_yuv(unsigned char *buf, vob_t *vob, int left, int right) { int i; unsigned char *bufcr, *bufcb; unsigned char *ptr, *ptrmax; // printf("%d %d\n", left, right); bufcr = buf + vob->im_v_width * vob->im_v_height; bufcb = buf + vob->im_v_width * vob->im_v_height * 5/ 4; /* Y */ for (i = left; i < right; i++) { ptr = &buf[i]; ptrmax = &buf[i + (vob->im_v_height * vob->im_v_width)]; while (ptr < ptrmax) { *ptr = 0x10; ptr += vob->im_v_width; } } /* Cr */ for (i = left; i < right; i++) { ptr = &bufcr[i/2]; ptrmax = &bufcr[i/2 + (vob->im_v_height/2 * vob->im_v_width/2)]; while (ptr < ptrmax) { *ptr = 128; ptr += vob->im_v_width/2; } } /* Cb */ for (i = left; i < right; i++) { ptr = &bufcb[i/2]; ptrmax = &bufcb[i/2 + (vob->im_v_height/2 * vob->im_v_width/2)]; while (ptr < ptrmax) { *ptr = 128; ptr += vob->im_v_width/2; } } } void xmask_yuv422(unsigned char *buf, vob_t *vob, int left, int right) { int y, j; unsigned short *t; unsigned short mask = ((0x80 << 8)&0xff00) | ((0x10)&0xff); for (y = 0; y < vob->im_v_height; y++) { t = (unsigned short *)(buf + y * vob->im_v_width * 2 + left*2); for (j=0; j<(right-left); j++) *t++ = mask; } } void xmask_rgb(unsigned char *buf, vob_t *vob, int left, int right) { int y; unsigned char *ptr; for (y = 0; y < vob->im_v_height; y++) { ptr = &buf[(y * vob->im_v_width * 3) + (left * 3)]; memset(ptr, 0, (right - left) * 3); } } // old or new syntax? static int is_optstr (char *buf) { if (strchr(buf, '=')) return 1; if (strchr(buf, 't')) return 1; if (strchr(buf, 'h')) return 1; return 0; } static void help_optstr() { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" This filter applies an rectangular mask to the video.\n"); printf (" Everything outside the mask is set to black.\n"); printf ("* Options\n"); printf (" lefttop : Upper left corner of the box\n"); printf (" rightbot : Lower right corner of the box\n"); } int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; static int lc, rc, tc, bc; int _rc, _bc; // API explanation: // ================ // // (1) need more infos, than get pointer to transcode global // information structure vob_t as defined in transcode.h. // // (2) 'tc_get_vob' and 'verbose' are exported by transcode. // // (3) filter is called first time with TC_FILTER_INIT flag set. // // (4) make sure to exit immediately if context (video/audio) or // placement of call (pre/post) is not compatible with the filters // intended purpose, since the filter is called 4 times per frame. // // (5) see framebuffer.h for a complete list of frame_list_t variables. // // (6) filter is last time with TC_FILTER_CLOSE flag set if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[32]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRY4E", "1"); snprintf(buf, 32, "%dx%d", lc, tc); optstr_param (options, "lefttop", "Upper left corner of the box", "%dx%d", buf, "0", "width", "0", "height"); snprintf(buf, 32, "%dx%d", rc, bc); optstr_param (options, "rightbot", "Lower right corner of the box", "%dx%d", buf, "0", "width", "0", "height"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); if (!buffer) buffer = malloc(SIZE_RGB_FRAME); lc = 0; tc = 0; _rc = 0; _bc = 0; rc = vob->im_v_width; bc = vob->im_v_height; if(options != NULL) { if (!is_optstr(options)) { // old syntax sscanf(options, "%d:%d:%d:%d", &lc, &_rc, &tc, &_bc); rc = vob->im_v_width - _rc; bc = vob->im_v_height - _bc; } else { optstr_get (options, "lefttop", "%dx%d", &lc, &tc); optstr_get (options, "rightbot", "%dx%d", &rc, &bc); if (optstr_lookup(options, "help")) help_optstr(); } } return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (buffer) free(buffer); buffer = NULL; return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if(ptr->tag & TC_PRE_M_PROCESS && ptr->tag & TC_VIDEO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { // tc_memcpy(buffer, ptr->video_buf, SIZE_RGB_FRAME); // tc_memcpy(ptr->video_buf, buffer, SIZE_RGB_FRAME); if (vob->im_v_codec==CODEC_YUV) { if (tc > 2) ymask_yuv(ptr->video_buf, vob, 0, tc - 1); if ((vob->im_v_height - bc) > 1) ymask_yuv(ptr->video_buf, vob, bc, vob->im_v_height - 1); if (lc > 2) xmask_yuv(ptr->video_buf, vob, 0, lc - 1); if ((vob->im_v_width - rc) > 1) xmask_yuv(ptr->video_buf, vob, rc, vob->im_v_width - 1); } if (vob->im_v_codec==CODEC_RGB) { if (tc > 2) ymask_rgb(ptr->video_buf, vob, 0, tc - 1); if ((vob->im_v_height - bc) > 1) ymask_rgb(ptr->video_buf, vob, bc, vob->im_v_height - 1); if (lc > 2) xmask_rgb(ptr->video_buf, vob, 0, lc - 1); if ((vob->im_v_width - rc) > 1) xmask_rgb(ptr->video_buf, vob, rc, vob->im_v_width - 1); } if (vob->im_v_codec==CODEC_YUV422) { if (tc > 2) ymask_yuv422(ptr->video_buf, vob, 0, tc - 1); if ((vob->im_v_height - bc) > 1) ymask_yuv422(ptr->video_buf, vob, bc, vob->im_v_height - 1); if (lc > 2) xmask_yuv422(ptr->video_buf, vob, 0, lc - 1); if ((vob->im_v_width - rc) > 1) xmask_yuv422(ptr->video_buf, vob, rc, vob->im_v_width - 1); } } return(0); } transcode-1.0.0beta2/filter/filter_modfps.c100644 001750 000000 00000056672 10161261376 0014406/* * filter_modfps.c * * Copyright (C) Marrq - July 2003 * * This file is part of transcode, a linux video stream processing tool * Based on the excellent work of Donald Graft in Decomb and of * Thanassis Tsiodras of transcode's decimate filter and Tilmann Bitterberg * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ // ----------------- Changes // 0.9 -> 0.10: marrq // added scene change detection code courtesy of Tilmann Bitterberg // so we won't blend if there's a change of scene (we'll still interpolate) // added clone_phosphor_average // 0.8 -> 0.9: marrq // added fancy_clone and associated functions // 0.7 -> 0.8: Tilmann Bitterberg // make mode=1 the default // 0.6 -> 0.7: marrq // make mode=1 independant of frame numbers, and modified verbose // mode to make a bit more sense given the conditionals // modified "todo" to reflect this // 0.5 -> 0.6: Tilmann Bitterberg // Make mode=0 independent of the Frame number transcode // gives us. // 0.4 -> 0.5: marrq // initialize memory at runtime. // skip at PRE_S_ clone at POST_S_ // fix counting/buffering bugs related to mode=1 // 0.3 -> 0.4: Tilmann Bitterberg // Fix a typo in the optstr_param printout and correct the filter // flags. // Fix a bug related to scanrange. #define MOD_NAME "filter_modfps.so" #define MOD_VERSION "v0.10 (2003-08-18)" #define MOD_CAP "plugin to modify framerate" #define MOD_AUTHOR "Marrq" //#define DEBUG 1 #include #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include "transcode.h" #include "framebuffer.h" #include "optstr.h" // FIXME extern long int lrint(double x); static int show_results=0; /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static int mode=1; static double infps = 29.97; static double outfps = 23.976; static int infrc = 0; // default settings for NTSC 29.97 -> 23.976 static int numSample=5; static int offset = 32; static int runnow = 0; static char **frames = NULL; static int frbufsize; static int frameIn = 0, frameOut = 0; static int *framesOK, *framesScore; static int scanrange = 0; static int clonetype = 0; static double frc_table[16] = {0, NTSC_FILM, 24, 25, NTSC_VIDEO, 30, 50, (2*NTSC_VIDEO), 60, 1, 5, 10, 12, 15, 0, 0}; static void help_optstr() { printf("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" This filter aims to allow transcode to alter the fps\n"); printf (" of video. While one can reduce the fps to any amount,\n"); printf (" one can only increase the fps to at most twice the\n"); printf (" original fps\n"); printf (" There are two modes of operation, buffered and unbuffered,\n"); printf (" unbuffered is quick, but buffered, especially when dropping frames\n"); printf (" should look better\n"); printf (" For most users, modfps will need either no options, or just mode=1\n"); printf ("* Options\n"); printf ("\tmode : (0=unbuffered, 1=buffered [%d]\n", mode); printf ("\tinfps : original fps (override what transcode supplies) [%f]\n",infps); printf ("\tinfrc : original frc (overwrite infps) [%d]\n",infrc); printf ("\tbuffer : number of frames to buffer [%d]\n",numSample); printf ("\tsubsample : number of pixels to subsample when examining buffers [%d]\n",offset); printf ("\tclonetype : when cloning and mode=1 do something special [%d]\n",clonetype); printf ("\t\t 0 = none\n"); printf ("\t\t 1 = merge fields, cloned frame first(good for interlaced displays)\n"); printf ("\t\t 2 = merge fields, cloned frame 2nd (good for interlaced displays)\n"); printf ("\t\t 3 = average frames\n"); printf ("\t\t 4 = temporally average frame\n"); printf ("\t\t 5 = pseudo-phosphor average frames (YUV only) (slow)\n"); printf ("\tverbose : 0 = not verbose, 1 is verbose [%d]\n",show_results); } #define ABS_u8(a) (((a)^((a)>>7))-((a)>>7)) static int yuv_detect_scenechange(uint8_t *_src, uint8_t *_prev, const int _threshold, const int _scenethreshold, int _width, const int _height, const int srcpitch){ uint8_t *src, *src_buf, *srcminus, *prev; const int w=_width; const int h=_height; const int hminus1 = h-1; int x,y,count=0,scenechange=0; /* Skip first and last lines, they'll get a free ride. */ src_buf = _src; src = src_buf + srcpitch; srcminus = src - srcpitch; prev = _prev + srcpitch; for (y = 1; y < hminus1; y++){ if (y & 1){ for (x=0; x _threshold) & (ABS_u8(p1) > _threshold)); ++prev; } } else { for (x=0; x _threshold) & (ABS_u8(p1) > _threshold)); ++prev; } } srcminus += srcpitch; } if ((100L * count) / (h * w) >= _scenethreshold){ scenechange = 1; } else { scenechange = 0; } return scenechange; } static int tc_detect_scenechange(unsigned char*clone, unsigned char *next, vframe_list_t *ptr){ const int thresh = 14; const int scenethresh = 31; if(ptr->v_codec == CODEC_YUV){ return yuv_detect_scenechange((uint8_t *)next, (uint8_t *)clone, thresh, scenethresh, ptr->v_width, ptr->v_height, ptr->v_width); } else { // implement RGB and YUY2 return 0; } } /********** * phosphor average will likely only make sense for YUV data. * we'll do a straight average for the UV data, but for the Y * data, we'll cube the pixel, average them and take the cube root * of that. This way, brightness (and hopefully motion) is easily * noticed by the eye **********/ static void clone_phosphor_average(unsigned char *clone, unsigned char *next, vframe_list_t *ptr){ int i; // let's not blend if there's a scenechange if (tc_detect_scenechange(clone,next,ptr)){ return; } // else for(i=0;i<(ptr->v_width*ptr->v_height);i++){ //ptr->video_buf[i] = (unsigned char)lrint(pow( ( pow((double)clone[i], 3.0) + // pow((double)next[i], 3.0) ) / 2.0, // 1.0/3.0)); #ifdef HAVE_LIBM_LRINT ptr->video_buf[i] = (unsigned char)lrint(pow((double) (( clone[i]*clone[i]*clone[i] + next[i]*next[i]*next[i]) >> 1), 1.0/3.0)); #else ptr->video_buf[i] = (unsigned char)(long)rint(pow((double) (( clone[i]*clone[i]*clone[i] + next[i]*next[i]*next[i]) >> 1), 1.0/3.0)); #endif } for(; ivideo_size; i++){ ptr->video_buf[i] = (unsigned char)( ((short int)clone[i] + (short int)next[i]) >> 1); } } static void clone_average(unsigned char *clone, unsigned char *next, vframe_list_t *ptr){ int i; // let's not blend if there's a scenechange if (tc_detect_scenechange(clone,next,ptr)){ return; } // else for(i=0;ivideo_size;i++){ ptr->video_buf[i] = (unsigned char)( ((short int)clone[i] + (short int)next[i]) >> 1); } } static void clone_temporal_average(unsigned char *clone, unsigned char*next, vframe_list_t *ptr, int tin, int tout){ // basic algorithm is to weight the pixels of a frame based // on how close the blended frame should be if this frame was // perfectly placed since's we'll be merging the tin and the tin+1 // frame into the tout'th frame, we calculate the time that // tout will be played at, and compare it to tin and tin+1 // because the main body is buffering frames, when we're called, tin and tout might // not be appropriate for when clones should be called (in otherwords, the // buffering allows a small amount of AV slippage) ... what this means, is // that sometimes to have things match up temporally best, we should just // copy in the next frame This tends to happen when outfps < 1.5*infps double weight1,weight2; int i; static int first=1; weight1 = 1.0 - ( (double)tout/outfps*infps - (double)tin ); weight2 = 1.0 - ( (double)(tin+1) - (double)(tout)/outfps*infps ); // weight2 is also 1.0-weight1 if (show_results){ printf("[%s] temporal_clone tin=%4d tout=%4d w1=%1.5f w2=%1.5f\n",MOD_NAME,tin,tout,weight1,weight2); } if (weight1 < 0.0){ if (show_results){ printf("[%s] temporal_clone: w1 is weak, copying next frame\n",MOD_NAME); } tc_memcpy(ptr->video_buf,next,ptr->video_size); return; } // else if (weight2 < 0.0){ // I think this case cannot happen if (show_results){ printf("[%s] temporal_clone: w2 is weak, simple cloning of frame\n",MOD_NAME); } // no memcpy needed, as we're keeping the orig return; } // else // let's not blend if there's a scenechange if (tc_detect_scenechange(clone,next,ptr)){ return; } // else if (weight1 > 1.0 || weight2 > 1.0){ fprintf(stderr, "[%s] clone_temporal_average: error: weights are out of range, w1=%f w2=%f\n", MOD_NAME,weight1,weight2); return; } // else for(i=0; ivideo_size; i++){ ptr->video_buf[i] = (unsigned char)( (double)(clone[i])*weight1 + (double)(next[i])*weight2); } first=0; } static void clone_interpolate(char *clone, char *next, vframe_list_t *ptr){ int i,width = 0,height; char *dest, *s1, *s2; if (CODEC_RGB == ptr->v_codec){ // in RGB, the data is packed, three bytes per pixel width = 3*ptr->v_width; } else if (CODEC_YUY2 == ptr->v_codec){ // in YUY2, the data again is packed. width = 2*ptr->v_width; } else if (CODEC_YUV == ptr->v_codec){ // we'll handle the planar colours later width = ptr->v_width; } height = ptr->v_height; dest = ptr->video_buf; s1 = clone; s2 = next+width; for(i=0;iv_codec){ // here we handle the planar color part of the data dest = ptr->video_buf + width*height; s1 = ptr->video_buf+width*height; s2 = ptr->video_buf+width*height+(width>>1); // we'll save some shifting and recalc width; width = width >>1; // we don't have to divide the height by 2 because we've // got two colors, we'll handle them in one sweep. for(i=0;ivideo_buf == NULL)){ fprintf(stderr,"[%s] Big error; we're about to dereference NULL\n",MOD_NAME); return; } //printf("[%s] fancy_clone clonetype: %d tin=%4d tout=%4d\n",MOD_NAME,clonetype,tin,tout); switch (clonetype){ case 0: tc_memcpy(ptr->video_buf,clone,ptr->video_size); break; case 1: clone_interpolate(clone,next,ptr); break; case 2: clone_interpolate(next,clone,ptr); break; case 3: clone_average(clone,next,ptr); break; case 4: clone_temporal_average(clone,next,ptr,tin,tout); break; case 5: if (ptr->v_codec != CODEC_YUV){ printf("[%s] Erroor, phosphor merge only implemented for YUV data\n",MOD_NAME); return; } clone_phosphor_average(clone,next,ptr); break; default: printf("[%s] Error, unimplemented clonetype\n",MOD_NAME); break; } return; } static int memory_init(vframe_list_t * ptr){ int i; frbufsize = numSample +1; if (ptr->v_codec == CODEC_YUV){ // we only care about luminance scanrange = ptr->v_height*ptr->v_width; } else if (ptr->v_codec == CODEC_RGB){ scanrange = ptr->v_height*ptr->v_width*3; } else if (ptr->v_codec == CODEC_YUY2){ // we only care about luminance, but since this is packed // we'll look at everything. scanrange = ptr->v_height*ptr->v_width*2; } if (scanrange > ptr->video_size){ // error, we'll overwalk boundaries later on fprintf(stderr, "[%s] Error, video_size doesn't look to be big enough (scan=%d video_size=%d).\n",MOD_NAME,scanrange,ptr->video_size); return -1; } frames = (char**)malloc(sizeof (char*)*frbufsize); if (NULL == frames){ fprintf(stderr, "[%s] Error allocating memory in init\n",MOD_NAME); return -1; } // else for (i=0;ivideo_size); if (NULL == frames[i]){ fprintf(stderr, "[%s] Error allocating memory in init\n",MOD_NAME); return -1; } } framesOK = (int*)malloc(sizeof(int)*frbufsize); if (NULL == framesOK){ fprintf(stderr, "[%s] Error allocating memory in init\n",MOD_NAME); return -1; } framesScore = (int*)malloc(sizeof(int)*frbufsize); if (NULL == framesScore){ fprintf(stderr, "[%s] Error allocating memory in init\n",MOD_NAME); return -1; } if (mode == 1){ return 0; } return -1; } int tc_filter(vframe_list_t * ptr, char *options) { static vob_t *vob = NULL; static int framesin = 0; static int init = 1; static int cloneq = 0; // queue'd clones ;) static int outframes = 0; //---------------------------------- // // filter init // //---------------------------------- if (ptr->tag & TC_FILTER_INIT) { if ((vob = tc_get_vob()) == NULL) return (-1); // defaults outfps = vob->ex_fps; infps = vob->fps; infrc = vob->im_frc; // filter init ok. if (options != NULL) { if (optstr_lookup (options, "help")) { help_optstr(); } optstr_get (options, "verbose", "%d", &show_results); optstr_get (options, "mode", "%d", &mode); optstr_get (options, "infps", "%f", &infps); optstr_get (options, "infrc", "%d", &infrc); optstr_get (options, "buffer", "%d", &numSample); optstr_get (options, "subsample", "%d", &offset); optstr_get (options, "clonetype", "%d", &clonetype); } if (infrc>0 && infrc < 16){ infps = frc_table[infrc]; } if (verbose){ printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); printf("[%s] converting from %2.4ffps to %2.4ffps\n",MOD_NAME,infps,outfps); } if (outfps > infps*2.0){ fprintf(stderr, "[%s] Error, desired output fps can not be greater\n",MOD_NAME); fprintf(stderr, "[%s] than twice the input fps\n", MOD_NAME); return -1; } if ( (outfps == infps) || (infrc && infrc == vob->ex_frc)) { fprintf(stderr, "[%s] No framerate conversion requested, exiting\n",MOD_NAME); return -1; } // clone in POST_S skip in PRE_S if (outfps > infps){ runnow = TC_POST_S_PROCESS; } else { runnow = TC_PRE_S_PROCESS; } if ((mode >= 0) && (mode < 2)){ return 0; } // else fprintf (stderr, "[%s] Error, only two modes of operation.\n",MOD_NAME); return -1; } if (ptr->tag & TC_FILTER_GET_CONFIG){ char buf[255]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VYRE", "1"); snprintf(buf, sizeof(buf), "%d",mode); optstr_param(options,"mode","mode of operation", "%d", buf, "0", "1"); snprintf(buf, sizeof(buf), "%f", infps); optstr_param(options, "infps", "Original fps", "%f", buf, "MIN_FPS", "200.0"); snprintf(buf, sizeof(buf), "%d", infrc); optstr_param(options, "infrc", "Original frc", "%d", buf, "0", "16"); snprintf(buf, sizeof(buf), "%d", numSample); optstr_param(options,"examine", "How many frames to buffer", "%d", buf, "2", "25"); snprintf(buf, sizeof(buf), "%d", offset); optstr_param(options, "subsample", "How many pixels to subsample", "%d", buf, "1", "256"); snprintf(buf, sizeof(buf), "%d", clonetype); optstr_param(options, "clonetype", "How to clone frames", "%d", buf, "0", "16"); snprintf(buf, sizeof(buf), "%d", verbose); optstr_param(options, "verbose", "run in verbose mode", "%d", buf, "0", "1"); return 0; } //---------------------------------- // // filter close // //---------------------------------- if (ptr->tag & TC_FILTER_CLOSE) { return (0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audio frame processing routines // or after and determines video/audio context if ((ptr->tag & runnow) && (ptr->tag & TC_VIDEO)) { if (mode == 0){ if (show_results){ printf("[%s] in=%5d out=%5d win=%05.3f wout=%05.3f ",MOD_NAME,framesin,outframes,(double)framesin/infps,outframes/outfps); } if (infps < outfps){ // Notes; since we currently only can clone frames (and just clone // them once, we can at most double the input framerate. if (ptr->attributes & TC_FRAME_WAS_CLONED){ // we can't clone it again, so we'll record the outframe and exit ++outframes; if (show_results){ printf("\n"); } return 0; } // else if ((double)framesin++/infps > (double)outframes++/outfps){ if (show_results){ printf("FRAME IS CLONED"); } ptr->attributes |= TC_FRAME_IS_CLONED; } } else { if ((double)framesin++/infps > outframes / outfps){ ++outframes; } else { if (show_results){ printf("FRAME IS SKIPPED"); } ptr->attributes |= TC_FRAME_IS_SKIPPED; } } if (show_results){ printf("\n"); } return(0); } // else if (mode == 1){ int i; if (init){ init = 0; i = memory_init(ptr); if(i!=0){ return i; } } if (show_results){ printf("[%s] frameIn=%d frameOut=%d in=%5d out=%5d win=%05.3f wout=%05.3f ",MOD_NAME,frameIn,frameOut,framesin-numSample,outframes+cloneq,(double)(framesin-numSample)/infps,(double)(outframes+cloneq)/outfps); } if (ptr->attributes & TC_FRAME_WAS_CLONED){ // don't do anything. Since it's cloned, we don't // want to put it our buffers, as it will just clog // them up. Later, we can try some merging/interpolation // as the user requests and then leave, but for now, we'll // just flee. if (framesOK[(frameIn+0)%frbufsize]){ fprintf(stderr, "[%s] Oppps, this frame wasn't cloned but we thought it was\n",MOD_NAME); } ++outframes; --cloneq; if (show_results){ printf("no slot needed for clones\n"); } fancy_clone(frames[frameIn],frames[(frameIn+1)%frbufsize],ptr,framesin-numSample,outframes+cloneq+1); return 0; } // else tc_memcpy(frames[frameIn], ptr->video_buf, ptr->video_size); framesOK[frameIn] = 1; #ifdef DEBUG printf("Inserted frame %d into slot %d \n",framesin, frameIn); #endif // DEBUG // Now let's look and see if we should compute a frame's // score. if (framesin > 0){ char *t1, *t2; int *score,t; t=(frameIn+numSample)%frbufsize; score = &framesScore[t]; t1 = frames[t]; t2 = frames[frameIn]; #ifdef DEBUG printf("score: slot=%d, t1=%p t2=%p ", t,t1,t2); #endif // DEBUG *score=0; for(i=0; ivideo_size; i+=offset){ *score += abs(t2[i] - t1[i]); } #ifdef DEBUG printf("score = %d\n",*score); #endif // DEBUG } // the first frbufsize-1 frames are not processed; only buffered // so that we might be able to effectively see the future frames // when deciding about a frame. if(framesin < frbufsize-1){ ptr->attributes |= TC_FRAME_IS_SKIPPED; frameIn = (frameIn+1) % frbufsize; ++framesin; if (show_results){ printf("\n"); } return 0; } // else // having filled the buffer, we will now check to see if we // are ready to clone/skip a frame. If we are, we look for the frame to skip // in the buffer if (infps < outfps){ if ((double)(framesin-numSample)/infps > (double)(cloneq+outframes++)/outfps){ // we have to find a frame to clone int diff=-1, mod=-1; #ifdef DEBUG printf("start=%d end=%d\n",(frameIn+1)%frbufsize,frameIn); #endif // DEBUG fflush(stdout); for(i=((frameIn+1)%frbufsize); i!=frameIn; i=((i+1)%frbufsize)){ #ifdef DEBUG printf("i=%d Ok=%d Score=%d\n",i,framesOK[i],framesScore[i]); #endif // DEBUG // make sure we haven't skipped/cloned this frame already if(framesOK[i]){ // look for the frame with the most difference from it's next neighbor if (framesScore[i] > diff){ diff = framesScore[i]; mod = i; } } } if (mod == -1){ fprintf(stderr,"[%s] Error calculating frame to clone\n",MOD_NAME); return -1; } #ifdef DEBUG printf("XXX cloning %d\n",mod); #endif // DEBUG ++cloneq; framesOK[mod] = 0; } tc_memcpy(ptr->video_buf,frames[frameOut],ptr->video_size); if (framesOK[frameOut]){ if (show_results){ printf("giving slot %2d frame %6d\n",frameOut,ptr->id); } } else { ptr->attributes |= TC_FRAME_IS_CLONED; if (show_results){ printf("cloning slot %2d frame %6d\n",frameOut,ptr->id); } } frameOut = (frameOut+1) % frbufsize; } else { // check to skip frames if ((double)(framesin-numSample)/infps < (double)(outframes)/outfps){ int diff=INT_MAX, mod=-1; // since we're skipping, we look for the frame with the lowest // difference between the frame which follows it. for(i=((frameIn+1)%frbufsize); i!=frameIn; i=((i+1)%frbufsize)){ #ifdef DEBUG printf("i=%d Ok=%d Score=%d\n",i,framesOK[i],framesScore[i]); #endif // debug // make sure we haven't skipped/cloned this frame already if(framesOK[i]){ if (framesScore[i] < diff){ diff = framesScore[i]; mod = i; } } } if (mod == -1){ fprintf(stderr,"[%s] Error calculating frame to skip\n",MOD_NAME); return -1; } framesOK[mod] = 0; } else { ++outframes; } if (framesOK[frameOut]){ tc_memcpy(ptr->video_buf,frames[frameOut],ptr->video_size); if (show_results){ printf("giving slot %2d frame %6d\n",frameOut,ptr->id); } } else { ptr->attributes |= TC_FRAME_IS_SKIPPED; if (show_results){ printf("skipping slot %2d frame %6d\n",frameOut,ptr->id); } } frameOut = (frameOut+1) % frbufsize; } frameIn = (frameIn+1) % frbufsize; ++framesin; return 0; } fprintf(stderr, "[%s] Oppps, currently only 2 modes of operation\n",MOD_NAME); return(-1); } return (0); } transcode-1.0.0beta2/filter/filter_msharpen.c100644 001750 000000 00000034563 10161261376 0014726/* filter_msharpen.c Copyright (C) 1999-2000 Donal A. Graft modified 2003 by William Hawkins for use with transcode MSharpen Filter for VirtualDub -- performs sharpening limited to edge areas of the frame. Copyright (C) 1999-2000 Donald A. Graft This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author can be contacted at: Donald Graft neuron2@home.com. */ #define MOD_NAME "filter_msharpen.so" #define MOD_VERSION "(1.0) (2003-07-17)" #define MOD_CAP "VirtualDub's MSharpen Filter" #define MOD_AUTHOR "Donald Graft, William Hawkins" #include #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" #include "export/vid_aux.h" static vob_t *vob=NULL; /* vdub compat */ typedef unsigned int Pixel; typedef unsigned int Pixel32; typedef unsigned char Pixel8; typedef int PixCoord; typedef int PixDim; typedef int PixOffset; #define R_MASK (0x00ff0000) #define G_MASK (0x0000ff00) #define B_MASK (0x000000ff) #define R_SHIFT (16) #define G_SHIFT (8) #define B_SHIFT (0) /* convert transcode RGB (3*8 Bit) to vdub ARGB (32Bit) */ void convert_rgb2argb (char * in, Pixel32 *out, int width, int height) { int run; int size = width*height; for (run = 0; run < size; run++) { *out = (((((Pixel32) *(in+0)) & 0xff) << R_SHIFT) | ((((Pixel32) *(in+1)) & 0xff) << G_SHIFT) | ((((Pixel32) *(in+2)) & 0xff))) & 0x00ffffff; out++; in += 3; } } /* convert vdub ARGB (32Bit) to transcode RGB (3*8 Bit) */ void convert_argb2rgb (Pixel32 *in, char * out, int width, int height) { int run; int size = width*height; for (run = 0; run < size; run++) { *(out+0) = ((*in & R_MASK) >> R_SHIFT); *(out+1) = ((*in & G_MASK) >> G_SHIFT); *(out+2) = (*in) & B_MASK; in++; out += 3; } } /////////////////////////////////////////////////////////////////////////// typedef struct MyFilterData { Pixel32 *convertFrameIn; Pixel32 *convertFrameOut; unsigned char *blur; unsigned char *work; int strength; int threshold; int mask; int highq; } MyFilterData; static MyFilterData *mfd; static void help_optstr(void) { printf("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" This plugin implements an unusual concept in spatial sharpening.\n"); printf (" Although designed specifically for anime, it also works well with\n"); printf (" normal video. The filter is very effective at sharpening important\n"); printf (" edges without amplifying noise.\n"); printf ("* Options\n"); printf (" * Strength 'strength' (0-255) [100]\n"); printf (" This is the strength of the sharpening to be applied to the edge\n"); printf (" detail areas. It is applied only to the edge detail areas as\n"); printf (" determined by the 'threshold' parameter. Strength 255 is the\n"); printf (" strongest sharpening.\n"); printf (" * Threshold 'threshold' (0-255) [10]\n"); printf (" This parameter determines what is detected as edge detail and\n"); printf (" thus sharpened. To see what edge detail areas will be sharpened,\n"); printf (" use the 'mask' parameter.\n"); printf (" * Mask 'mask' (0-1) [0]\n"); printf (" When set to true, the areas to be sharpened are shown in white\n"); printf (" against a black background. Use this to set the level of detail to\n"); printf (" be sharpened. This function also makes a basic edge detection filter.\n"); printf (" * HighQ 'highq' (0-1) [1]\n"); printf (" This parameter lets you tradeoff speed for quality of detail\n"); printf (" detection. Set it to true for the best detail detection. Set it to\n"); printf (" false for maximum speed.\n"); } int tc_filter(vframe_list_t *ptr, char *options) { //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { int width, height; if((vob = tc_get_vob())==NULL) return(-1); mfd = (MyFilterData *) malloc(sizeof(MyFilterData)); if (!mfd) { fprintf(stderr, "[%s] No memory at %d!\n", MOD_NAME, __LINE__); return (-1); } height = vob->ex_v_height; width = vob->ex_v_width; /* default values */ mfd->strength = 100; /* A little bird told me this was a good value */ mfd->threshold = 10; mfd->mask = TC_FALSE; /* not sure what this does at the moment */ mfd->highq = TC_TRUE; /* high Q or not? */ if (options != NULL) { if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get (options, "strength", "%d", &mfd->strength); optstr_get (options, "threshold", "%d", &mfd->threshold); optstr_get (options, "highq", "%d", &mfd->highq); optstr_get (options, "mask", "%d", &mfd->mask); } if (verbose > 1) { printf (" MSharpen Filter Settings (%dx%d):\n", width,height); printf (" strength = %d\n", mfd->strength); printf (" threshold = %d\n", mfd->threshold); printf (" highq = %d\n", mfd->highq); printf (" mask = %d\n", mfd->mask); } if (options) if ( optstr_get(options, "help", "") >= 0) { help_optstr(); } /* fetch memory */ mfd->blur = (unsigned char *) malloc(4 * width * height); if (!mfd->blur){ fprintf(stderr, "[%s] No memory at %d!\n", MOD_NAME, __LINE__); return (-1); } mfd->work = (unsigned char *) malloc(4 * width * height); if (!mfd->work){ fprintf(stderr, "[%s] No memory at %d!\n", MOD_NAME, __LINE__); return (-1); } mfd->convertFrameIn = (Pixel32 *) malloc (width*height*sizeof(Pixel32)); if (!mfd->convertFrameIn) { fprintf(stderr, "[%s] No memory at %d!\n", MOD_NAME, __LINE__); return (-1); } memset(mfd->convertFrameIn, 0, width*height*sizeof(Pixel32)); mfd->convertFrameOut = (Pixel32 *) malloc (width*height*sizeof(Pixel32)); if (!mfd->convertFrameOut) { fprintf(stderr, "[%s] No memory at %d!\n", MOD_NAME, __LINE__); return (-1); } memset(mfd->convertFrameOut, 0, width*height*sizeof(Pixel32)); if (vob->im_v_codec == CODEC_YUV) { tc_rgb2yuv_init(width, height); tc_yuv2rgb_init(width, height); } // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return 0; } /* TC_FILTER_INIT */ if(ptr->tag & TC_FILTER_GET_CONFIG) { if (options) { char buf[256]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYO", "1"); snprintf (buf, sizeof(buf), "%d", mfd->strength); optstr_param (options, "strength", "How much of the effect", "%d", buf, "0", "255"); snprintf (buf, sizeof(buf), "%d", mfd->threshold); optstr_param (options, "threshold", "How close a pixel must be to the brightest or dimmest pixel to be mapped", "%d", buf, "0", "255"); snprintf (buf, sizeof(buf), "%d", mfd->highq); optstr_param (options, "highq", "Tradeoff speed for quality of detail detection", "%d", buf, "0", "1"); snprintf (buf, sizeof(buf), "%d", mfd->mask); optstr_param (options, "mask", "Areas to be sharpened are shown in white", "%d", buf, "0", "1"); } } if(ptr->tag & TC_FILTER_CLOSE) { if (mfd->convertFrameIn) free (mfd->convertFrameIn); mfd->convertFrameIn = NULL; if (mfd->convertFrameOut) free (mfd->convertFrameOut); mfd->convertFrameOut = NULL; if (mfd->blur) free ( mfd->blur); mfd->blur = NULL; if (mfd->work) free(mfd->work); mfd->work = NULL; if (mfd) free(mfd); mfd = NULL; if (vob->im_v_codec == CODEC_YUV) { tc_rgb2yuv_close(); tc_yuv2rgb_close(); } return 0; } /* TC_FILTER_CLOSE */ /////////////////////////////////////////////////////////////////////////// if(ptr->tag & TC_POST_PROCESS && ptr->tag & TC_VIDEO) { const PixDim width = ptr->v_width; const PixDim height = ptr->v_height; const long pitch = ptr->v_width*sizeof(Pixel32); int bwidth = 4 * width; unsigned char *src; unsigned char *dst; unsigned char *srcpp, *srcp, *srcpn, *workp, *blurp, *blurpn, *dstp; int r1, r2, r3, r4, g1, g2, g3, g4, b1, b2, b3, b4; int x, y, max; int strength = mfd->strength, invstrength = 255 - strength; int threshold = mfd->threshold; // const int srcpitch = ptr->v_width*sizeof(Pixel32); const int dstpitch = ptr->v_width*sizeof(Pixel32); if (vob->im_v_codec == CODEC_YUV) { tc_yuv2rgb_core(ptr->video_buf); } convert_rgb2argb (ptr->video_buf, mfd->convertFrameIn, ptr->v_width, ptr->v_height); src = (unsigned char *)mfd->convertFrameIn; dst = (unsigned char *)mfd->convertFrameOut; /* Blur the source image prior to detail detection. Separate dimensions for speed. */ /* Vertical. */ srcpp = src; srcp = srcpp + pitch; srcpn = srcp + pitch; workp = mfd->work + bwidth; for (y = 1; y < height - 1; y++) { for (x = 0; x < bwidth; x++) { workp[x] = (srcpp[x] + srcp[x] + srcpn[x]) / 3; } srcpp += pitch; srcp += pitch; srcpn += pitch; workp += bwidth; } /* Horizontal. */ workp = mfd->work; blurp = mfd->blur; for (y = 0; y < height; y++) { for (x = 4; x < bwidth - 4; x++) { blurp[x] = (workp[x-4] + workp[x] + workp[x+4]) / 3; } workp += bwidth; blurp += bwidth; } /* Fix up blur frame borders. */ srcp = src; blurp = mfd->blur; tc_memcpy(blurp, srcp, bwidth); tc_memcpy(blurp + (height-1)*bwidth, srcp + (height-1)*pitch, bwidth); for (y = 0; y < height; y++) { *((unsigned int *)(&blurp[0])) = *((unsigned int *)(&srcp[0])); *((unsigned int *)(&blurp[bwidth-4])) = *((unsigned int *)(&srcp[bwidth-4])); srcp += pitch; blurp += bwidth; } /* Diagonal detail detection. */ blurp = mfd->blur; blurpn = blurp + bwidth; workp = mfd->work; for (y = 0; y < height - 1; y++) { b1 = blurp[0]; g1 = blurp[1]; r1 = blurp[2]; b3 = blurpn[0]; g3 = blurpn[1]; r3 = blurpn[2]; for (x = 0; x < bwidth - 4; x+=4) { b2 = blurp[x+4]; g2 = blurp[x+5]; r2 = blurp[x+6]; b4 = blurpn[x+4]; g4 = blurpn[x+5]; r4 = blurpn[x+6]; if ((abs(b1 - b4) >= threshold) || (abs(g1 - g4) >= threshold) || (abs(r1 - r4) >= threshold) || (abs(b2 - b3) >= threshold) || (abs(g2 - g3) >= threshold) || (abs(g2 - g3) >= threshold)) { *((unsigned int *)(&workp[x])) = 0xffffffff; } else { *((unsigned int *)(&workp[x])) = 0x0; } b1 = b2; b3 = b4; g1 = g2; g3 = g4; r1 = r2; r3 = r4; } workp += bwidth; blurp += bwidth; blurpn += bwidth; } if (mfd->highq == TC_TRUE) // if (1) { /* Vertical detail detection. */ for (x = 0; x < bwidth; x+=4) { blurp = mfd->blur; blurpn = blurp + bwidth; workp = mfd->work; b1 = blurp[x]; g1 = blurp[x+1]; r1 = blurp[x+2]; for (y = 0; y < height - 1; y++) { b2 = blurpn[x]; g2 = blurpn[x+1]; r2 = blurpn[x+2]; if (abs(b1 - b2) >= threshold || abs(g1 - g2) >= threshold || abs(r1 - r2) >= threshold) { *((unsigned int *)(&workp[x])) = 0xffffffff; } b1 = b2; g1 = g2; r1 = r2; workp += bwidth; blurp += bwidth; blurpn += bwidth; } } /* Horizontal detail detection. */ blurp = mfd->blur; workp = mfd->work; for (y = 0; y < height; y++) { b1 = blurp[0]; g1 = blurp[1]; r1 = blurp[2]; for (x = 0; x < bwidth - 4; x+=4) { b2 = blurp[x+4]; g2 = blurp[x+5]; r2 = blurp[x+6]; if (abs(b1 - b2) >= threshold || abs(g1 - g2) >= threshold || abs(r1 - r2) >= threshold) { *((unsigned int *)(&workp[x])) = 0xffffffff; } b1 = b2; g1 = g2; r1 = r2; } workp += bwidth; blurp += bwidth; } } /* Fix up detail map borders. */ memset(mfd->work + (height-1)*bwidth, 0, bwidth); workp = mfd->work; for (y = 0; y < height; y++) { *((unsigned int *)(&workp[bwidth-4])) = 0; workp += bwidth; } if (mfd->mask == TC_TRUE) { workp = mfd->work; dstp = dst; for (y = 0; y < height; y++) { for (x = 0; x < bwidth; x++) { dstp[x] = workp[x]; } workp += bwidth; dstp = dstp + dstpitch; } return 0; } /* Fix up output frame borders. */ srcp = src; dstp = dst; tc_memcpy(dstp, srcp, bwidth); tc_memcpy(dstp + (height-1)*pitch, srcp + (height-1)*pitch, bwidth); for (y = 0; y < height; y++) { *((unsigned int *)(&dstp[0])) = *((unsigned int *)(&srcp[0])); *((unsigned int *)(&dstp[bwidth-4])) = *((unsigned int *)(&srcp[bwidth-4])); srcp += pitch; dstp += pitch; } /* Now sharpen the edge areas and we're done! */ srcp = src + pitch; dstp = dst + pitch; workp = mfd->work + bwidth; blurp = mfd->blur + bwidth; for (y = 1; y < height - 1; y++) { for (x = 4; x < bwidth - 4; x+=4) { int xplus1 = x + 1, xplus2 = x + 2; if (workp[x]) { b4 = (4*(int)srcp[x] - 3*blurp[x]); g4 = (4*(int)srcp[x+1] - 3*blurp[x+1]); r4 = (4*(int)srcp[x+2] - 3*blurp[x+2]); if (b4 < 0) b4 = 0; if (g4 < 0) g4 = 0; if (r4 < 0) r4 = 0; max = b4; if (g4 > max) max = g4; if (r4 > max) max = r4; if (max > 255) { b4 = (b4 * 255) / max; g4 = (g4 * 255) / max; r4 = (r4 * 255) / max; } dstp[x] = (strength * b4 + invstrength * srcp[x]) >> 8; dstp[xplus1] = (strength * g4 + invstrength * srcp[xplus1]) >> 8; dstp[xplus2] = (strength * r4 + invstrength * srcp[xplus2]) >> 8; } else { dstp[x] = srcp[x]; dstp[xplus1] = srcp[xplus1]; dstp[xplus2] = srcp[xplus2]; } } srcp += pitch; dstp += pitch; workp += bwidth; blurp += bwidth; } convert_argb2rgb (mfd->convertFrameOut, ptr->video_buf, ptr->v_width, ptr->v_height); if (vob->im_v_codec == CODEC_YUV) { tc_rgb2yuv_core(ptr->video_buf); } return 0; } return 0; } transcode-1.0.0beta2/filter/filter_nored.c100644 001750 000000 00000011525 07712721160 0014211/* * filter_nored * * Copyright (C) Tilmann Bitterberg - June 2002 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_nored.so" #define MOD_VERSION "v0.1.3 (2003-01-26)" #define MOD_CAP "nored the image" #define MOD_AUTHOR "Tilmann Bitterberg" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "transcode.h" #include "framebuffer.h" #include "optstr.h" // basic parameter typedef struct MyFilterData { unsigned int start; unsigned int end; unsigned int step; int subst; int boolstep; } MyFilterData; static MyFilterData *mfd = NULL; /* should probably honor the other flags too */ /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" nored an image\n"); printf ("* Options\n"); printf (" 'range' apply filter to [start-end]/step frames [0-oo/1]\n"); } int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; static int width, height; static int size; int h; if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[128]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VYE", "1"); snprintf(buf, 128, "%ux%u/%d", mfd->start, mfd->end, mfd->step); optstr_param (options, "range", "apply filter to [start-end]/step frames", "%u-%u/%d", buf, "0", "oo", "0", "oo", "1", "oo"); snprintf(buf, 128, "%d", mfd->subst); optstr_param (options, "subst", "substract N red from Cr", "%d", buf, "-127", "127" ); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); if((mfd = (MyFilterData *)malloc (sizeof(MyFilterData))) == NULL) return (-1); mfd->start=0; mfd->end=(unsigned int)-1; mfd->step=1; mfd->subst=2; if (options != NULL) { if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get (options, "range", "%u-%u/%d", &mfd->start, &mfd->end, &mfd->step); optstr_get (options, "subst", "%d", &mfd->subst); } if (verbose > 1) { printf (" nored Image Settings:\n"); printf (" range = %u-%u\n", mfd->start, mfd->end); printf (" step = %u\n", mfd->step); } if (options) if (optstr_lookup (options, "help")) { help_optstr(); } if (mfd->start % mfd->step == 0) mfd->boolstep = 0; else mfd->boolstep = 1; width = vob->ex_v_width; height = vob->ex_v_height; if (vob->im_v_codec == CODEC_RGB) { fprintf(stderr, "[%s] This filter is only capable of YUV mode\n", MOD_NAME); return -1; } else size = width*3/2; // filter init ok. if (verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (mfd) { free(mfd); } mfd=NULL; return(0); } /* filter close */ //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if((ptr->tag & TC_POST_PROCESS) && (ptr->tag & TC_VIDEO) && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { char *p; if (mfd->start <= ptr->id && ptr->id <= mfd->end && ptr->id%mfd->step == mfd->boolstep) { p = ptr->video_buf + ptr->v_height*ptr->v_width; for (h = 0; h < height*width/4; h++) { *p = (*p-mfd->subst)&0xff; p++; } } } return(0); } transcode-1.0.0beta2/filter/filter_normalize.c100644 001750 000000 00000020117 07725633330 0015104/* * filter_normalize.c * * Copyright (C) pl 2002 and beyond... * Tilmann Bitterberg - June 2002 ported to transcode * * Sources: some ideas from volnorm plugin for xmms * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 2. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Values for AVG: * 1: uses a 1 value memory and coefficients new=a*old+b*cur (with a+b=1) * * 2: uses several samples to smooth the variations (standard weighted mean * on past samples) * * Limitations: * - only AFMT_S16_LE supported * * */ #define MOD_NAME "filter_normalize.so" #define MOD_VERSION "v0.1.1 (2002-06-18)" #define MOD_CAP "Volume normalizer" #include #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "transcode.h" #include "framebuffer.h" #include "optstr.h" // basic parameter // mul is the value by which the samples are scaled // and has to be in [MUL_MIN, MUL_MAX] #define MUL_INIT 1.0 #define MUL_MIN 0.1 #define MUL_MAX 5.0 #define MIN_SAMPLE_SIZE 32000 // Some limits #define MIN_S16 -32768 #define MAX_S16 32767 // "Ideal" level #define MID_S16 (MAX_S16 * 0.25) // Silence level // FIXME: should be relative to the level of the samples #define SIL_S16 (MAX_S16 * 0.01) // Local data #define NSAMPLES 128 struct mem_t { double avg; // average level of the sample int32_t len; // sample size (weight) }; typedef struct MyFilterData { int format; double mul; double SMOOTH_MUL; double SMOOTH_LASTAVG; double lastavg; int idx; struct mem_t mem[NSAMPLES]; int AVG; } MyFilterData; static MyFilterData *mfd = NULL; /* should probably honor the other flags too */ /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" normalizes audio\n"); printf ("* Options\n"); printf (" 'smooth' double for smoothing ]0.0 1.0[ [0.06]\n"); printf (" 'smoothlast' double for smoothing last sample ]0.0, 1.0[ [0.06]\n"); printf (" 'algo' Which algorithm to use (1 or 2) [1]\n"); printf (" 1: uses a 1 value memory and coefficients new=a*old+b*cur (with a+b=1)\n"); printf (" 2: uses several samples to smooth the variations (standard weighted mean\n"); printf (" on past samples)\n"); } static void reset(void){ int i; mfd->mul = MUL_INIT; switch(mfd->format) { case(1): /* XXX: bogus */ mfd->lastavg = MID_S16; for(i=0; i < NSAMPLES; ++i) { mfd->mem[i].len = 0; mfd->mem[i].avg = 0; } mfd->idx = 0; break; default: break; //fprintf(stderr,"[pl_volnorm] internal inconsistency - bugreport !\n"); //*(char *) 0 = 0; } } int tc_filter(aframe_list_t *ptr, char *options) { static vob_t *vob=NULL; if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "pl, Tilmann Bitterberg", "AE", "1"); optstr_param (options, "smooth", "Value for smoothing ]0.0 1.0[", "%f", "0.06", "0.0", "1.0"); optstr_param (options, "smoothlast", "Value for smoothing last sample ]0.0, 1.0[", "%f", "0.06", "0.0", "1.0"); optstr_param (options, "algo", "Algorithm to use (1 or 2). 1=uses a 1 value memory and coefficients new=a*old+b*cur (with a+b=1). 2=uses several samples to smooth the variations (standard weighted mean on past samples)", "%d", "1", "1", "2"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); if (vob->a_bits != 16) { fprintf(stderr, "This filter only works for 16 bit samples\n"); return (-1); } if((mfd = (MyFilterData *)malloc (sizeof(MyFilterData))) == NULL) return (-1); mfd->format = 1; /* XXX bogus */ mfd->mul = MUL_INIT; mfd->lastavg = MID_S16; mfd->idx = 0; mfd->SMOOTH_MUL = 0.06; mfd->SMOOTH_LASTAVG = 0.06; mfd->AVG = 1; reset(); if (options != NULL) { if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get(options, "smooth", "%f", &mfd->SMOOTH_MUL); optstr_get(options, "smoothlast", "%f", &mfd->SMOOTH_LASTAVG); optstr_get(options, "algo", "%d", &mfd->AVG); if (mfd->AVG > 2) mfd->AVG = 2; if (mfd->AVG < 1) mfd->AVG = 1; } if (verbose > 1) { printf (" Normalize Filter Settings:\n"); } if (options) if (optstr_lookup (options, "help")) { help_optstr(); } // filter init ok. if (verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (mfd) { free(mfd); } return(0); } /* filter close */ //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if((ptr->tag & TC_PRE_PROCESS) && (ptr->tag & TC_AUDIO) && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { #define CLAMP(x,m,M) do { if ((x)<(m)) (x) = (m); else if ((x)>(M)) (x) = (M); } while(0) int16_t* data=(int16_t *)ptr->audio_buf; int len=ptr->audio_size / 2; // 16 bits samples int32_t i, tmp; double curavg, newavg; double neededmul; double avg; int32_t totallen; // Evaluate current samples average level curavg = 0.0; for (i = 0; i < len ; ++i) { tmp = data[i]; curavg += tmp * tmp; } curavg = sqrt(curavg / (double) len); // Evaluate an adequate 'mul' coefficient based on previous state, current // samples level, etc if (mfd->AVG == 1) { if (curavg > SIL_S16) { neededmul = MID_S16 / ( curavg * mfd->mul); mfd->mul = (1.0 - mfd->SMOOTH_MUL) * mfd->mul + mfd->SMOOTH_MUL * neededmul; // Clamp the mul coefficient CLAMP(mfd->mul, MUL_MIN, MUL_MAX); } } else if (mfd->AVG == 2) { avg = 0.0; totallen = 0; for (i = 0; i < NSAMPLES; ++i) { avg += mfd->mem[i].avg * (double) mfd->mem[i].len; totallen += mfd->mem[i].len; } if (totallen > MIN_SAMPLE_SIZE) { avg /= (double) totallen; if (avg >= SIL_S16) { mfd->mul = (double) MID_S16 / avg; CLAMP(mfd->mul, MUL_MIN, MUL_MAX); } } } // Scale & clamp the samples for (i = 0; i < len ; ++i) { tmp = mfd->mul * data[i]; CLAMP(tmp, MIN_S16, MAX_S16); data[i] = tmp; } // Evaluation of newavg (not 100% accurate because of values clamping) newavg = mfd->mul * curavg; // Stores computed values for future smoothing if (mfd->AVG == 1) { mfd->lastavg = (1.0-mfd->SMOOTH_LASTAVG)*mfd->lastavg + mfd->SMOOTH_LASTAVG*newavg; //printf("\rmfd->mul=%02.1f ", mfd->mul); } else if (mfd->AVG == 2) { mfd->mem[mfd->idx].len = len; mfd->mem[mfd->idx].avg = newavg; mfd->idx = (mfd->idx + 1) % NSAMPLES; //printf("\rmfd->mul=%02.1f (%04dKiB) ", mfd->mul, totallen/1024); } } return(0); } transcode-1.0.0beta2/filter/mmx.h100644 001750 000000 00000025317 07632371531 0012353/* * Copyright (C) Thomas streich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * --> deinterlace code taken from the xine project: * Copyright (C) 2001 the xine project * * --> mmx.h definitions * Copyright (C) 1997-2001 H. Dietz and R. Fisher * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * Deinterlace routines by Miguel Freitas * based of DScaler project sources (deinterlace.sourceforge.net) * * Currently only available for Xv driver and MMX extensions * */ #ifndef __DEINTERLACE_H__ #define __DEINTERLACE_H__ void deinterlace_bob_yuv_mmx( uint8_t *pdst, uint8_t *psrc, int width, int height ); /* * The type of an value that fits in an MMX register (note that long * long constant values MUST be suffixed by LL and unsigned long long * values by ULL, lest they be truncated by the compiler) */ #ifdef ATTRIBUTE_ALIGNED_MAX #define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "filter.h" #include "optstr.h" /** * Help text. * This function prints out a small description of this filter and * the command-line options when the "help" parameter is given *********************************************************/ static void help_optstr(void) { printf ("[%s] help : * Overview \n", MOD_NAME); printf ("[%s] help : This exists for demonstration purposes only. It does NOTHING! \n", MOD_NAME); printf ("[%s] help : \n", MOD_NAME); printf ("[%s] help : * Options \n", MOD_NAME); printf ("[%s] help : 'help' Prints out this help text \n", MOD_NAME); printf ("[%s] help : \n", MOD_NAME); } /** * Main function of a filter. * This is the single function interface to transcode. This is the only function needed for a filter plugin. * @param ptr frame accounting structure * @param options command-line options of the filter * * @return 0, if everything went OK. *********************************************************/ int tc_filter(vframe_list_t *ptr, char *options) { int pre=0, vid=0; vob_t *vob=NULL; // API explanation: // ================ // // (1) need more infos, than get pointer to transcode global // information structure vob_t as defined in transcode.h. // // (2) 'tc_get_vob' and 'verbose' are exported by transcode. // // (3) filter is called first time with TC_FILTER_INIT flag set. // // (4) make sure to exit immediately if context (video/audio) or // placement of call (pre/post) is not compatible with the filters // intended purpose, since the filter is called 4 times per frame. // // (5) see framebuffer.h for a complete list of frame_list_t variables. // // (6) filter is last time with TC_FILTER_CLOSE flag set //---------------------------------- // // filter get config // //---------------------------------- if(ptr->tag & TC_FILTER_GET_CONFIG) { // Valid flags for the string of filter capabilities: // "V" : Can do Video // "A" : Can do Audio // "R" : Can do RGB // "Y" : Can do YUV // "4" : Can do YUV422 // "M" : Can do Multiple Instances // "E" : Is a PRE filter // "O" : Is a POST filter optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VARY4EO", "1"); optstr_param (options, "help", "Prints out a short help", "", "0"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(verbose & TC_DEBUG) printf("[%s] options=%s\n", MOD_NAME, options); // Parameter parsing if (options) if (optstr_lookup (options, "help")) { help_optstr(); return(0); } return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audio frame processing routines // or after and determines video/audio context if(verbose & TC_STATS) { printf("[%s] %s/%s %s %s\n", MOD_NAME, vob->mod_path, MOD_NAME, MOD_VERSION, MOD_CAP); // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if(ptr->tag & TC_PRE_PROCESS) pre=1; if(ptr->tag & TC_POST_PROCESS) pre=0; if(ptr->tag & TC_VIDEO) vid=1; if(ptr->tag & TC_AUDIO) vid=0; printf("[%s] frame [%06d] %s %16s call\n", MOD_NAME, ptr->id, (vid)?"(video)":"(audio)", (pre)?"pre-process filter":"post-process filter"); } return(0); } transcode-1.0.0beta2/filter/filter_skip.c100644 001750 000000 00000011714 10174077273 0014055/** * @file filter_skip.c Skip all listed frames * * Copyright (C) Thomas streich - June 2001, * Thomas Wehrspann - January 2005 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* * ChangeLog: * v0.0.1 (2001-11-27) * * v0.2 (2005-01-05) Thomas Wehrspann * -Rewritten, based on filter_cut * -Documentation added * -New help function * -optstr_filter_desc now returns * the right capability flags */ #define MOD_NAME "filter_skip.so" #define MOD_VERSION "v0.2 (2005-01-05)" #define MOD_CAP "skip all listed frames" #define MOD_AUTHOR "Thomas streich, Thomas Wehrspann" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" #include "libioaux/framecode.h" /** * Help text. * This function prints out a small description of this filter and * the command-line options when the "help" parameter is given *********************************************************/ static void help_optstr(void) { printf ("[%s] help : * Overview \n", MOD_NAME); printf ("[%s] help : This filter skips all listed frames. \n", MOD_NAME); printf ("[%s] help : \n", MOD_NAME); printf ("[%s] help : * Options \n", MOD_NAME); printf ("[%s] help : 'help' Prints out this help text \n", MOD_NAME); printf ("[%s] help : 'start-end/step [...]' List of frame ranges to skip (start-end/step) [] \n", MOD_NAME); } /** * Main function of a filter. * This is the single function interface to transcode. This is the only function needed for a filter plugin. * @param ptr frame accounting structure * @param options command-line options of the filter * * @return 0, if everything went OK. *********************************************************/ int tc_filter(vframe_list_t *ptr, char *options) { static struct fc_time *list; static double avoffset=1.0; char separator[] = " "; vob_t *vob=NULL; if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VARY4E", "1"); optstr_param (options, "start-end/step [...]", "Skip frames", "%s", ""); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(verbose & TC_DEBUG) printf("[%s] options=%s\n", MOD_NAME, options); if(options == NULL) return(0); // Parameter parsing if(options == NULL) return(0); else if (optstr_lookup (options, "help")) { help_optstr(); return (0); } else { if( parse_fc_time_string( options, vob->fps, separator, verbose, &list ) == -1 ) { help_optstr(); return (-1); } } avoffset = vob->fps/vob->ex_fps; return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audio frame processing routines // or after and determines video/audio context if((ptr->tag & TC_PRE_S_PROCESS) && (ptr->tag & TC_VIDEO)) { // fc_frame_in_time returns the step frequency int ret = fc_frame_in_time(list, ptr->id); if ((ret && !(ptr->id%ret))) ptr->attributes |= TC_FRAME_IS_SKIPPED; } else if ((ptr->tag & TC_PRE_S_PROCESS) && (ptr->tag & TC_AUDIO)){ int ret; int tmp_id; tmp_id = (int)((double)ptr->id*avoffset); ret = fc_frame_in_time(list, tmp_id); if ((ret && !(tmp_id%ret))) ptr->attributes |= TC_FRAME_IS_SKIPPED; } return(0); } transcode-1.0.0beta2/filter/filter_slowmo.c100644 001750 000000 00000010623 10134566042 0014416/* * filter_clone.c * * Copyright (C) Thomas streich - August 2002 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_slowmo.so" #define MOD_VERSION "v0.3 (2003-29-11)" #define MOD_CAP "very cheap slow-motion effect" #define MOD_AUTHOR "Tilmann Bitterberg" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" This filter produces a simple slow-motion effect by\n"); printf (" duplicating certain frames. I have seen this effect\n"); printf (" on TV and despite its the simple algorithm it works\n"); printf (" quite well. The filter has no options.\n"); } static int do_clone (int id) { static int last = 0; if ((id) % 3 == 0) { last = 0; return 1; } if (last>0) { last--; return 0; } if (last == 0) { last = -1; return 1; } return 0; } int tc_filter(vframe_list_t *ptr, char *options) { vob_t *vob=NULL; // API explanation: // ================ // // (1) need more infos, than get pointer to transcode global // information structure vob_t as defined in transcode.h. // // (2) 'tc_get_vob' and 'verbose' are exported by transcode. // // (3) filter is called first time with TC_FILTER_INIT flag set. // // (4) make sure to exit immediately if context (video/audio) or // placement of call (pre/post) is not compatible with the filters // intended purpose, since the filter is called 4 times per frame. // // (5) see framebuffer.h for a complete list of frame_list_t variables. // // (6) filter is last time with TC_FILTER_CLOSE flag set //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if (options) { if (verbose) printf("[%s] options=%s\n", MOD_NAME, options); if (optstr_get(options, "help", "")>=0) help_optstr(); } return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { return(0); } //---------------------------------- // // filter read configure // //---------------------------------- if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYE", "1"); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context // 1 <- // 2 <- // 3 = 2 // 4 <- // 5 = 4 // 6 <- // 7 <- // 8 = 7 // 9 <- // 10 = 9 // 11 <- // 12 <- // 13 = 12 // 14 <- // 15 = 14 if(ptr->tag & TC_PRE_S_PROCESS && ptr->tag & TC_VIDEO) { if(!(ptr->tag & TC_FRAME_WAS_CLONED) && do_clone(ptr->id)) { //fprintf(stderr, "cloning frame %d\n", ptr->id); ptr->attributes |= TC_FRAME_IS_CLONED; } } return(0); } transcode-1.0.0beta2/filter/filter_smartbob.c100644 001750 000000 00000037451 10161261376 0014721/* filter_smartbob.c This file is part of transcode, a linux video stream processing tool Smart Bob Filter for VirtualDub -- Break fields into frames using a motion-adaptive algorithm. Copyright (C) 1999-2001 Donald A. Graft This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author can be contacted at: Donald Graft neuron2@home.com. modified 2003 by Tilmann Bitterberg for use with transcode This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author can be contacted at: Donald Graft neuron2@home.com. http://sauron.mordor.net/dgraft/ */ #define MOD_NAME "filter_smartbob.so" #define MOD_VERSION "v1.1beta2 (2003-06-23)" #define MOD_CAP "Motion-adaptive deinterlacing for double-frame-rate output." #define MOD_AUTHOR "Donald Graft, Tilmann Bitterberg" #include #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" #include "export/vid_aux.h" static vob_t *vob=NULL; /* vdub compat */ typedef unsigned int Pixel; typedef unsigned int Pixel32; typedef unsigned char Pixel8; typedef int PixCoord; typedef int PixDim; typedef int PixOffset; /////////////////////////////////////////////////////////////////////////// #define DENOISE_DIAMETER 5 #define DENOISE_THRESH 7 typedef struct MyFilterData { Pixel32 *convertFrameIn; Pixel32 *convertFrameOut; int *prevFrame; unsigned char *moving; unsigned char *fmoving; int bShiftEven; int bMotionOnly; int bDenoise; int threshold; int codec; } MyFilterData; static MyFilterData *mfd; /* * Colorspace conversions */ #define R_MASK (0x00ff0000) #define G_MASK (0x0000ff00) #define B_MASK (0x000000ff) #define R_SHIFT (16) #define G_SHIFT (8) #define B_SHIFT (0) /* convert transcode RGB (3*8 Bit) to vdub ARGB (32Bit) */ void convert_rgb2argb (char * in, Pixel32 *out, int width, int height) { int run; int size = width*height; for (run = 0; run < size; run++) { *out = (((((Pixel32) *(in+0)) & 0xff) << R_SHIFT) | ((((Pixel32) *(in+1)) & 0xff) << G_SHIFT) | ((((Pixel32) *(in+2)) & 0xff))) & 0x00ffffff; out++; in += 3; } } /* convert vdub ARGB (32Bit) to transcode RGB (3*8 Bit) */ void convert_argb2rgb (Pixel32 *in, char * out, int width, int height) { int run; int size = width*height; for (run = 0; run < size; run++) { *(out+0) = ((*in & R_MASK) >> R_SHIFT)&0xff; *(out+1) = ((*in & G_MASK) >> G_SHIFT)&0xff; *(out+2) = (*in) & B_MASK; in++; out += 3; } } static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" This filter only makes sence when fed by -J doublefps.\n"); printf (" It will take the field-frames which filter_doublefps\n"); printf (" produces and generates full-sized motion adaptive deinterlaced \n"); printf (" output at the double import framerate.\n"); printf (" If you force reading the imput file twice its actual frames \n"); printf (" per second, A/V will stay in sync (for PAL):\n"); printf (" -f 50 -J doublefps=shiftEven=1,smartbob=denoise=1:threshold=12\n"); printf ("* Options\n"); printf (" 'motionOnly' Show motion areas only (0=off, 1=on) [1]\n"); printf (" 'threshold' Motion Threshold (0-255) [15]\n"); printf (" 'denoise' denoise (0=off, 1=on) [0]\n"); printf (" 'shiftEven' Phase shift (0=off, 1=on) [0]\n"); } int tc_filter(vframe_list_t *ptr, char *options) { //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { unsigned int width, height; if((vob = tc_get_vob())==NULL) return(-1); mfd = (MyFilterData *) malloc(sizeof(MyFilterData)); if (!mfd) { fprintf(stderr, "No memory!\n"); return (-1); } memset (mfd, 0, sizeof(MyFilterData)); width = vob->im_v_width; height = vob->im_v_height; /* default values */ mfd->bShiftEven = 0; mfd->bMotionOnly = 0; mfd->bDenoise = 1; mfd->threshold = 12; mfd->codec = vob->im_v_codec; if (options != NULL) { if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get (options, "motionOnly", "%d", &mfd->bMotionOnly ); optstr_get (options, "shiftEven", "%d", &mfd->bShiftEven ); optstr_get (options, "threshold", "%d", &mfd->threshold ); optstr_get (options, "denoise", "%d", &mfd->bDenoise ); if (optstr_get (options, "help", "") >= 0) { help_optstr(); } } if (verbose > 1) { printf (" Smart Deinterlacer Filter Settings (%dx%d):\n", width, height); printf (" motionOnly = %d\n", mfd->bMotionOnly); printf (" denois = %d\n", mfd->bDenoise); printf (" threshold = %d\n", mfd->threshold); printf (" shiftEven = %d\n", mfd->bShiftEven); } /* fetch memory */ mfd->convertFrameIn = (Pixel32 *) malloc (width * height * sizeof(Pixel32)); memset(mfd->convertFrameIn, 0, width * height * sizeof(Pixel32)); mfd->convertFrameOut = (Pixel32 *) malloc (width * height * sizeof(Pixel32)); memset(mfd->convertFrameOut, 0, width * height * sizeof(Pixel32)); mfd->prevFrame = (int *) malloc (width*height*sizeof(int)); memset(mfd->prevFrame, 0, width*height*sizeof(int)); mfd->moving = (unsigned char *) malloc(sizeof(unsigned char)*width*height); memset(mfd->moving, 0, width*height*sizeof(unsigned char)); mfd->fmoving = (unsigned char *) malloc(sizeof(unsigned char)*width*height); memset(mfd->fmoving, 0, width*height*sizeof(unsigned char)); if (mfd->codec == CODEC_YUV) { tc_yuv2rgb_init(width, height/2); tc_rgb2yuv_init(width, height); } // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return 0; } /* TC_FILTER_INIT */ if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[255]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYO", "1"); snprintf (buf, sizeof(buf), "%d", mfd->bMotionOnly); optstr_param (options, "motionOnly", "Show motion areas only" ,"%d", buf, "0", "1"); snprintf (buf, sizeof(buf), "%d", mfd->bShiftEven); optstr_param (options, "shiftEven", "Blend instead of interpolate in motion areas", "%d", buf, "0", "1" ); snprintf (buf, sizeof(buf), "%d", mfd->threshold); optstr_param (options, "threshold", "Motion Threshold", "%d", buf, "0", "255" ); snprintf (buf, sizeof(buf), "%d", mfd->bDenoise); optstr_param (options, "denoise", "Phase shift", "%d", buf, "0", "1" ); return (0); } if(ptr->tag & TC_FILTER_CLOSE) { if (!mfd) return 0; if (mfd->prevFrame) free(mfd->prevFrame); mfd->prevFrame = NULL; if (mfd->moving) free(mfd->moving); mfd->moving = NULL; if (mfd->fmoving) free(mfd->fmoving); mfd->fmoving = NULL; if (mfd->convertFrameIn) { free (mfd->convertFrameIn); mfd->convertFrameIn = NULL; } if (mfd->convertFrameOut) { free (mfd->convertFrameOut); mfd->convertFrameOut = NULL; } if (mfd->codec == CODEC_YUV) { tc_rgb2yuv_close(); tc_yuv2rgb_close(); } if (mfd) free(mfd); return 0; } /* TC_FILTER_CLOSE */ /////////////////////////////////////////////////////////////////////////// if(ptr->tag & TC_POST_S_PROCESS && ptr->tag & TC_VIDEO) { Pixel32 *src, *dst, *srcn, *srcnn, *srcp; unsigned char *moving, *fmoving; int x, y, *prev; long currValue, prevValue, nextValue, nextnextValue, luma, lumap, luman; int r, g, b, rp, gp, bp, rn, gn, bn, rnn, gnn, bnn, R, G, B, T = mfd->threshold * mfd->threshold; int h = ptr->v_height/2; int w = ptr->v_width; int hminus = ptr->v_height/2 - 1; int hminus2 = ptr->v_height/2 - 2; int wminus = ptr->v_width - 1; int iOddEven = mfd->bShiftEven ? 0 : 1; int pitch = ptr->v_width*4; Pixel32 * dst_buf; Pixel32 * src_buf; if (mfd->codec == CODEC_YUV) { tc_yuv2rgb_core(ptr->video_buf); } convert_rgb2argb (ptr->video_buf, mfd->convertFrameIn, ptr->v_width, ptr->v_height/2); src_buf = mfd->convertFrameIn; dst_buf = mfd->convertFrameOut; #if 0 #endif /* Calculate the motion map. */ moving = mfd->moving; /* Threshold 0 means treat all areas as moving, i.e., dumb bob. */ if (mfd->threshold == 0) { memset(moving, 1, ptr->v_height/2 * ptr->v_width); } else { memset(moving, 0, ptr->v_height/2 * ptr->v_width); src = (Pixel32 *)src_buf; srcn = (Pixel32 *)((char *)src + pitch); prev = mfd->prevFrame; if((ptr->tag & TC_FRAME_WAS_CLONED) == iOddEven) prev += ptr->v_width; for (y = 0; y < hminus; y++) { for (x = 0; x < w; x++) { currValue = prev[x]; nextValue = srcn[x]; prevValue = src[x]; r = (currValue >> 16) & 0xff; rp = (prevValue >> 16) & 0xff; rn = (nextValue >> 16) & 0xff; g = (currValue >> 8) & 0xff; gp = (prevValue >> 8) & 0xff; gn = (nextValue >> 8) & 0xff; b = currValue & 0xff; bp = prevValue & 0xff; bn = nextValue & 0xff; luma = (55 * r + 182 * g + 19 * b) >> 8; lumap = (55 * rp + 182 * gp + 19 * bp) >> 8; luman = (55 * rn + 182 * gn + 19 * bn) >> 8; if ((lumap - luma) * (luman - luma) >= T) moving[x] = 1; } src = (Pixel32 *)((char *)src + pitch); srcn = (Pixel32 *)((char *)srcn + pitch); moving += w; prev += w; } /* Can't diff the last line. */ memset(moving, 0, ptr->v_width); /* Motion map denoising. */ if (mfd->bDenoise) { int xlo, xhi, ylo, yhi, xsize; int u, v; int N = DENOISE_DIAMETER; int Nover2 = N/2; int sum; unsigned char *m; // Erode. moving = mfd->moving; fmoving = mfd->fmoving; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { if (moving[x] == 0) { fmoving[x] = 0; continue; } xlo = x - Nover2; if (xlo < 0) xlo = 0; xhi = x + Nover2; if (xhi >= w) xhi = wminus; ylo = y - Nover2; if (ylo < 0) ylo = 0; yhi = y + Nover2; if (yhi >= h) yhi = hminus; for (u = ylo, sum = 0, m = mfd->moving + ylo * w; u <= yhi; u++) { for (v = xlo; v <= xhi; v++) { sum += m[v]; } m += w; } if (sum > DENOISE_THRESH) fmoving[x] = 1; else fmoving[x] = 0; } moving += w; fmoving += w; } // Dilate. moving = mfd->moving; fmoving = mfd->fmoving; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { if (fmoving[x] == 0) { moving[x] = 0; continue; } xlo = x - Nover2; if (xlo < 0) xlo = 0; xhi = x + Nover2; /* Use w here instead of wminus so we don't have to add 1 in the the assignment of xsize. */ if (xhi >= w) xhi = w; xsize = xhi - xlo; ylo = y - Nover2; if (ylo < 0) ylo = 0; yhi = y + Nover2; if (yhi >= h) yhi = hminus; m = mfd->moving + ylo * w; for (u = ylo; u <= yhi; u++) { memset(&m[xlo], 1, xsize); m += w; } } moving += w; fmoving += w; } } } /* Output the destination frame. */ if (!mfd->bMotionOnly) { /* Output the destination frame. */ src = (Pixel32 *)src_buf; srcn = (Pixel32 *)((char *)src_buf + pitch); srcnn = (Pixel32 *)((char *)src_buf + 2 * pitch); srcp = (Pixel32 *)((char *)src_buf - pitch); dst = (Pixel32 *)dst_buf; if((ptr->tag & TC_FRAME_WAS_CLONED) == iOddEven) { /* Shift this frame's output up by one line. */ tc_memcpy(dst, src, ptr->v_width * sizeof(Pixel32)); dst = (Pixel32 *)((char *)dst + pitch); prev = mfd->prevFrame + w; } else { prev = mfd->prevFrame; } moving = mfd->moving; for (y = 0; y < hminus; y++) { /* Even output line. Pass it through. */ tc_memcpy(dst, src, ptr->v_width * sizeof(Pixel32)); dst = (Pixel32 *)((char *)dst + pitch); /* Odd output line. Synthesize it. */ for (x = 0; x < w; x++) { if (moving[x] == 1) { /* Make up a new line. Use cubic interpolation where there are enough samples and linear where there are not enough. */ nextValue = srcn[x]; r = (src[x] >> 16) & 0xff; rn = (nextValue >> 16) & 0xff; g = (src[x] >> 8) & 0xff; gn = (nextValue >>8) & 0xff; b = src[x] & 0xff; bn = nextValue & 0xff; if (y == 0 || y == hminus2) { /* Not enough samples; use linear. */ R = (r + rn) >> 1; G = (g + gn) >> 1; B = (b + bn) >> 1; } else { /* Enough samples; use cubic. */ prevValue = srcp[x]; nextnextValue = srcnn[x]; rp = (prevValue >> 16) & 0xff; rnn = (nextnextValue >>16) & 0xff; gp = (prevValue >> 8) & 0xff; gnn = (nextnextValue >> 8) & 0xff; bp = prevValue & 0xff; bnn = nextnextValue & 0xff; R = (5 * (r + rn) - (rp + rnn)) >> 3; if (R > 255) R = 255; else if (R < 0) R = 0; G = (5 * (g + gn) - (gp + gnn)) >> 3; if (G > 255) G = 255; else if (G < 0) G = 0; B = (5 * (b + bn) - (bp + bnn)) >> 3; if (B > 255) B = 255; else if (B < 0) B = 0; } dst[x] = ( ((R << 16)&0xff0000) | ((G << 8)&0xff00) | (B&0xff)) & 0x00ffffff; } else { /* Use line from previous field. */ dst[x] = prev[x]; } } src = (Pixel32 *)((char *)src + pitch); srcn = (Pixel32 *)((char *)srcn + pitch); srcnn = (Pixel32 *)((char *)srcnn + pitch); srcp = (Pixel32 *)((char *)srcp + pitch); dst = (Pixel32 *)((char *)dst + pitch); moving += w; prev += w; } /* Copy through the last source line. */ tc_memcpy(dst, src, ptr->v_width * sizeof(Pixel32)); if((ptr->tag & TC_FRAME_WAS_CLONED)!= iOddEven) { dst = (Pixel32 *)((char *)dst + pitch); tc_memcpy(dst, src, ptr->v_width * sizeof(Pixel32)); } } else { /* Show motion only. */ moving = mfd->moving; src = (Pixel32 *)src_buf; dst = (Pixel32 *)dst_buf; for (y = 0; y < hminus; y++) { for (x = 0; x < w; x++) { if (moving[x]) { dst[x] = ((Pixel32 *)((char *)dst + pitch))[x] = src[x]; } else { dst[x] = ((Pixel32 *)((char *)dst + pitch))[x] = 0; } } src = (Pixel32 *)((char *)src + pitch); dst = (Pixel32 *)((char *)dst + pitch); dst = (Pixel32 *)((char *)dst + pitch); moving += w; } } /* Buffer the input frame (aka field). */ src = (Pixel32 *)src_buf; prev = mfd->prevFrame; for (y = 0; y < h; y++) { tc_memcpy(prev, src, w * sizeof(Pixel32)); src = (Pixel32 *)((char *)src + pitch); prev += w; } convert_argb2rgb (mfd->convertFrameOut, ptr->video_buf, ptr->v_width, ptr->v_height); if (mfd->codec == CODEC_YUV) tc_rgb2yuv_core(ptr->video_buf); return 0; } return 0; } transcode-1.0.0beta2/filter/filter_smartdeinter.c100644 001750 000000 00000075014 10161261376 0015606/* filter_smartdeinter.c This file is part of transcode, a linux video stream processing tool Smart Deinterlacing Filter for VirtualDub -- performs deinterlacing only in moving picture areas, allowing full resolution in static areas. Copyright (C) 1999-2001 Donald A. Graft Miscellaneous suggestions and optimizations by Avery Lee. Useful suggestions by Hans Zimmer, Jim Casaburi, Ondrej Kavka, and Gunnar Thalin. Field-only differencing based on algorithm by Gunnar Thalin. modified 2002 by Tilmann Bitterberg for use with transcode This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author can be contacted at: Donald Graft neuron2@home.com. http://sauron.mordor.net/dgraft/ */ #define MOD_NAME "filter_smartdeinter.so" #define MOD_VERSION "v2.7b (2003-02-01)" #define MOD_CAP "VirtualDub's smart deinterlacer" #define MOD_AUTHOR "Donald Graft" #include #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" #include "export/vid_aux.h" static vob_t *vob=NULL; /* vdub compat */ typedef unsigned int Pixel; typedef unsigned int Pixel32; typedef unsigned char Pixel8; typedef int PixCoord; typedef int PixDim; typedef int PixOffset; /////////////////////////////////////////////////////////////////////////// #define FRAME_ONLY 0 #define FIELD_ONLY 1 #define FRAME_AND_FIELD 2 typedef struct MyFilterData { int *prevFrame; int *saveFrame; Pixel32 *convertFrameIn; Pixel32 *convertFrameOut; unsigned char *moving; unsigned char *fmoving; int srcPitch; int dstPitch; int motionOnly; int Blend; int threshold; int scenethreshold; int fieldShift; int inswap; int outswap; int highq; int diffmode; int colordiff; int noMotion; int cubic; int codec; } MyFilterData; static MyFilterData *mfd; /* * Colorspace conversions */ #define R_MASK (0x00ff0000) #define G_MASK (0x0000ff00) #define B_MASK (0x000000ff) #define R_SHIFT (16) #define G_SHIFT (8) #define B_SHIFT (0) /* convert transcode RGB (3*8 Bit) to vdub ARGB (32Bit) */ void convert_rgb2argb (char * in, Pixel32 *out, int width, int height) { int run; int size = width*height; for (run = 0; run < size; run++) { *out = (((((Pixel32) *(in+0)) & 0xff) << R_SHIFT) | ((((Pixel32) *(in+1)) & 0xff) << G_SHIFT) | ((((Pixel32) *(in+2)) & 0xff))) & 0x00ffffff; out++; in += 3; } } /* convert vdub ARGB (32Bit) to transcode RGB (3*8 Bit) */ void convert_argb2rgb (Pixel32 *in, char * out, int width, int height) { int run; int size = width*height; for (run = 0; run < size; run++) { *(out+0) = ((*in & R_MASK) >> R_SHIFT)&0xff; *(out+1) = ((*in & G_MASK) >> G_SHIFT)&0xff; *(out+2) = (*in) & B_MASK; in++; out += 3; } } static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" This filter provides a smart, motion-based deinterlacing\n"); printf (" capability. In static picture areas, interlacing artifacts do not\n"); printf (" appear, so data from both fields is used to provide full detail. In\n"); printf (" moving areas, deinterlacing is performed\n"); printf ("* Options\n"); printf (" 'threshold' Motion Threshold (0-255) [15]\n"); printf (" 'scenethreshold' Scene Change Threshold (0-255) [100]:\n"); printf (" 'diffmode' Motion Detection (0=frame, 1=field, 2=both) [0] \n"); printf (" 'colordiff' Compare color channels instead of luma (0=off, 1=on) [1]\n"); printf (" 'motionOnly' Show motion areas only (0=off, 1=on) [0]\n"); printf (" 'Blend' Blend instead of interpolate in motion areas (0=off, 1=on) [0]\n"); printf (" 'cubic' Use cubic for interpolation (0=off, 1=on) [0]\n"); printf (" 'fieldShift' Phase shift (0=off, 1=on) [0]\n"); printf (" 'inswap' Field swap before phase shift (0=off, 1=on) [0]\n"); printf (" 'outswap' Field swap after phase shift (0=off, 1=on) [0]\n"); printf (" 'highq' Motion map denoising for field-only (0=off, 1=on) [0]\n"); printf (" 'noMotion' Disable motion processing (0=off, 1=on) [0]\n"); } int tc_filter(vframe_list_t *ptr, char *options) { //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { unsigned int width, height; if((vob = tc_get_vob())==NULL) return(-1); mfd = (MyFilterData *) malloc(sizeof(MyFilterData)); if (!mfd) { fprintf(stderr, "No memory!\n"); return (-1); } memset (mfd, 0, sizeof(MyFilterData)); width = vob->im_v_width; height = vob->im_v_height; /* default values */ mfd->threshold = 15; mfd->scenethreshold = 100; mfd->highq = 0; mfd->diffmode = FRAME_ONLY; mfd->colordiff = 1; mfd->noMotion = 0; mfd->cubic = 0; mfd->codec = vob->im_v_codec; if (options != NULL) { if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get (options, "motionOnly", "%d", &mfd->motionOnly ); optstr_get (options, "Blend", "%d", &mfd->Blend ); optstr_get (options, "threshold", "%d", &mfd->threshold ); optstr_get (options, "scenethreshold", "%d", &mfd->scenethreshold ); optstr_get (options, "fieldShift", "%d", &mfd->fieldShift ); optstr_get (options, "inswap", "%d", &mfd->inswap ); optstr_get (options, "outswap", "%d", &mfd->outswap ); optstr_get (options, "noMotion", "%d", &mfd->noMotion ); optstr_get (options, "highq", "%d", &mfd->highq ); optstr_get (options, "diffmode", "%d", &mfd->diffmode ); optstr_get (options, "colordiff", "%d", &mfd->colordiff ); optstr_get (options, "cubic", "%d", &mfd->cubic ); if (optstr_get (options, "help", "") >= 0) { help_optstr(); } } if (verbose > 1) { printf (" Smart Deinterlacer Filter Settings (%dx%d):\n", width, height); printf (" motionOnly = %d\n", mfd->motionOnly); printf (" Blend = %d\n", mfd->Blend); printf (" threshold = %d\n", mfd->threshold); printf (" scenethreshold = %d\n", mfd->scenethreshold); printf (" fieldShift = %d\n", mfd->fieldShift); printf (" inswap = %d\n", mfd->inswap); printf (" outswap = %d\n", mfd->outswap); printf (" noMotion = %d\n", mfd->noMotion); printf (" highq = %d\n", mfd->highq); printf (" diffmode = %d\n", mfd->diffmode); printf (" colordiff = %d\n", mfd->colordiff); printf (" cubic = %d\n", mfd->cubic); } /* fetch memory */ mfd->convertFrameIn = (Pixel32 *) malloc (width * height * sizeof(Pixel32)); memset(mfd->convertFrameIn, 0, width * height * sizeof(Pixel32)); mfd->convertFrameOut = (Pixel32 *) malloc (width * height * sizeof(Pixel32)); memset(mfd->convertFrameOut, 0, width * height * sizeof(Pixel32)); if (mfd->diffmode == FRAME_ONLY || mfd->diffmode == FRAME_AND_FIELD) { mfd->prevFrame = (int *) malloc (width*height*sizeof(int)); memset(mfd->prevFrame, 0, width*height*sizeof(int)); } if (mfd->fieldShift || (mfd->inswap && !mfd->outswap) || (!mfd->inswap && mfd->outswap)) { mfd->saveFrame = (int *) malloc (width*height*sizeof(int)); } if (!mfd->noMotion) { mfd->moving = (unsigned char *) malloc(sizeof(unsigned char)*width*height); memset(mfd->moving, 0, width*height*sizeof(unsigned char)); } if (mfd->highq) { mfd->fmoving = (unsigned char *) malloc(sizeof(unsigned char)*width*height); } if (mfd->codec == CODEC_YUV) { tc_rgb2yuv_init(width, height); tc_yuv2rgb_init(width, height); } // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return 0; } /* TC_FILTER_INIT */ if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[255]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYE", "1"); snprintf (buf, sizeof(buf), "%d", mfd->motionOnly); optstr_param (options, "motionOnly", "Show motion areas only" ,"%d", buf, "0", "1"); snprintf (buf, sizeof(buf), "%d", mfd->Blend); optstr_param (options, "Blend", "Blend instead of interpolate in motion areas", "%d", buf, "0", "1" ); snprintf (buf, sizeof(buf), "%d", mfd->threshold); optstr_param (options, "threshold", "Motion Threshold", "%d", buf, "0", "255" ); snprintf (buf, sizeof(buf), "%d", mfd->scenethreshold); optstr_param (options, "scenethreshold", "Scene Change Threshold", "%d", buf, "0", "255" ); snprintf (buf, sizeof(buf), "%d", mfd->fieldShift); optstr_param (options, "fieldShift", "Phase shift", "%d", buf, "0", "1" ); snprintf (buf, sizeof(buf), "%d", mfd->inswap); optstr_param (options, "inswap", "Field swap before phase shift", "%d", buf, "0", "1" ); snprintf (buf, sizeof(buf), "%d", mfd->outswap); optstr_param (options, "outswap", "Field swap after phase shift", "%d", buf, "0", "1" ); snprintf (buf, sizeof(buf), "%d", mfd->noMotion); optstr_param (options, "noMotion", "Disable motion processing", "%d", buf, "0", "1" ); snprintf (buf, sizeof(buf), "%d", mfd->highq); optstr_param (options, "highq", "Motion map denoising for field-only", "%d", buf, "0", "1" ); snprintf (buf, sizeof(buf), "%d", mfd->diffmode); optstr_param (options, "diffmode", "Motion Detection (0=frame, 1=field, 2=both)", "%d", buf, "0", "2" ); snprintf (buf, sizeof(buf), "%d", mfd->colordiff); optstr_param (options, "colordiff", "Compare color channels instead of luma", "%d", buf, "0", "1" ); snprintf (buf, sizeof(buf), "%d", mfd->cubic); optstr_param (options, "cubic", "Use cubic for interpolation", "%d", buf, "0", "1" ); return (0); } if(ptr->tag & TC_FILTER_CLOSE) { if (!mfd) return 0; if (mfd->diffmode == FRAME_ONLY || mfd->diffmode == FRAME_AND_FIELD) { if (mfd->prevFrame) free(mfd->prevFrame); mfd->prevFrame = NULL; } if (mfd->fieldShift || (mfd->inswap && !mfd->outswap) || (!mfd->inswap && mfd->outswap)) { if (mfd->saveFrame) free(mfd->saveFrame); mfd->saveFrame = NULL; } if (!mfd->noMotion) { if (mfd->moving) free(mfd->moving); mfd->moving = NULL; } if (mfd->highq) { if (mfd->fmoving) free(mfd->fmoving); mfd->fmoving = NULL; } if (mfd->convertFrameIn) { free (mfd->convertFrameIn); mfd->convertFrameIn = NULL; } if (mfd->convertFrameOut) { free (mfd->convertFrameOut); mfd->convertFrameOut = NULL; } if (mfd->codec == CODEC_YUV) { tc_rgb2yuv_close(); tc_yuv2rgb_close(); } if (mfd) free(mfd); return 0; } /* TC_FILTER_CLOSE */ /////////////////////////////////////////////////////////////////////////// if(ptr->tag & TC_PRE_PROCESS && ptr->tag & TC_VIDEO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { const int srcpitch = ptr->v_width*sizeof(Pixel32); const int srcpitchtimes2 = 2 * srcpitch; const int dstpitch = ptr->v_width*sizeof(Pixel32); const int dstpitchtimes2 = 2 * dstpitch; const PixDim w = ptr->v_width; const int wminus1 = w - 1; const int wtimes2 = w * 2; const int wtimes4 = w * 4; const PixDim h = ptr->v_height; const int hminus1 = h - 1; const int hminus3 = h - 3; const int hover2 = h / 2; Pixel32 *src, *dst, *srcminus, *srcplus, *srcminusminus=NULL, *srcplusplus=NULL; unsigned char *moving, *movingminus, *movingplus; unsigned char *fmoving; int *saved=NULL, *sv; Pixel32 *src1=NULL, *src2=NULL, *s1, *s2; Pixel32 *dst1=NULL, *dst2=NULL, *d1, *d2; int *prev; int scenechange; long count; int x, y; long prevValue, nextValue, luma=0, lumap, luman; Pixel32 p0, p1, p2; long r, g, b, rp, gp, bp, rn, gn, bn, T; long rpp, gpp, bpp, rnn, gnn, bnn, R, G, B; unsigned char frMotion, fiMotion; int copyback; int cubic = mfd->cubic; Pixel32 * dst_buf; Pixel32 * src_buf; if (mfd->codec == CODEC_YUV) { tc_yuv2rgb_core(ptr->video_buf); } convert_rgb2argb (ptr->video_buf, mfd->convertFrameIn, ptr->v_width, ptr->v_height); src_buf = mfd->convertFrameIn; dst_buf = mfd->convertFrameOut; /* If we are performing Advanced Processing... */ if (mfd->inswap || mfd->outswap || mfd->fieldShift) { /* Advanced Processing is used typically to clean up PAL video which has erroneously been digitized with the field phase off by one field. The result is that the frames look interlaced, but really if we can phase shift by one field, we'll get back the original progressive frames. Also supported are field swaps before and/or after the phase shift to accommodate different capture cards and telecining methods, as explained in the help file. Finally, the user can optionally disable full motion processing after this processing. */ copyback = 1; if (!mfd->fieldShift) { /* No phase shift enabled, but we have swap(s) enabled. */ if (mfd->inswap && mfd->outswap) { if (mfd->noMotion) { /* Swapping twice is a null operation. */ src1 = src_buf; dst1 = dst_buf; for (y = 0; y < h; y++) { tc_memcpy(dst1, src1, wtimes4); src1 = (Pixel *)((char *)src1 + srcpitch); dst1 = (Pixel *)((char *)dst1 + dstpitch); } goto filter_done; } else { copyback = 0; } } else { /* Swap fields. */ src1 = (Pixel32 *)((char *)src_buf + srcpitch); saved = mfd->saveFrame + w; for (y = 0; y < hover2; y++) { tc_memcpy(saved, src1, wtimes4); src1 = (Pixel *)((char *)src1 + srcpitchtimes2); saved += wtimes2; } src1 = src_buf; dst1 = (Pixel32 *)((char *)dst_buf+ dstpitch); for (y = 0; y < hover2; y++) { tc_memcpy(dst1, src1, wtimes4); src1 = (Pixel *)((char *)src1 + srcpitchtimes2); dst1 = (Pixel *)((char *)dst1 + dstpitchtimes2); } dst1 = dst_buf; saved = mfd->saveFrame + w; for (y = 0; y < hover2; y++) { tc_memcpy(dst1, saved, wtimes4); dst1 = (Pixel *)((char *)dst1 + dstpitchtimes2); saved += wtimes2; } } } /* If we reach here, then phase shift has been enabled. */ else { switch (mfd->inswap | (mfd->outswap << 1)) { case 0: /* No inswap, no outswap. */ src1 = src_buf; src2 = (Pixel32 *)((char *)src1 + srcpitch); dst1 = (Pixel32 *)((char *)dst_buf+ dstpitch); dst2 = dst_buf; saved = mfd->saveFrame + w; break; case 1: /* Inswap, no outswap. */ src1 = (Pixel32 *)((char *)src_buf + srcpitch); src2 = src_buf; dst1 = (Pixel32 *)((char *)dst_buf+ dstpitch); dst2 = dst_buf; saved = mfd->saveFrame; break; case 2: /* No inswap, outswap. */ src1 = src_buf; src2 = (Pixel32 *)((char *)src_buf + srcpitch); dst1 = dst_buf; dst2 = (Pixel32 *)((char *)dst_buf + dstpitch); saved = mfd->saveFrame + w; break; case 3: /* Inswap, outswap. */ src1 = (Pixel32 *)((char *)src_buf + srcpitch); src2 = src_buf; dst1 = dst_buf; dst2 = (Pixel32 *)((char *)dst_buf + dstpitch); saved = mfd->saveFrame; break; } s1 = src1; d1 = dst1; for (y = 0; y < hover2; y++) { tc_memcpy(d1, s1, wtimes4); s1 = (Pixel *)((char *)s1 + srcpitchtimes2); d1 = (Pixel *)((char *)d1 + dstpitchtimes2); } /* If this is not the first frame, copy the buffered field of the last frame to the output. This creates a correct progressive output frame. If this is the first frame, a buffered field is not available, so interpolate the field from the current field. */ if (ptr->id <= 1 ) { s1 = src1; d2 = dst2; for (y = 0; y < hover2; y++) { tc_memcpy(d2, s1, wtimes4); s1 = (Pixel *)((char *)s1 + srcpitchtimes2); d2 = (Pixel *)((char *)d2 + dstpitchtimes2); } } else { d2 = dst2; sv = saved; for (y = 0; y < hover2; y++) { tc_memcpy(d2, sv, wtimes4); sv += wtimes2; d2 = (Pixel *)((char *)d2 + dstpitchtimes2); } } /* Finally, save the unused field of the current frame in the buffer. It will be used to create the next frame. */ s2 = src2; sv = saved; for (y = 0; y < hover2; y++) { tc_memcpy(sv, s2, wtimes4); sv += wtimes2; s2 = (Pixel *)((char *)s2 + srcpitchtimes2); } } if (mfd->noMotion) goto filter_done; if (copyback) { /* We're going to do motion processing also, so copy the result back into the src bitmap. */ src1 = dst_buf; dst1 = src_buf; for (y = 0; y < h; y++) { tc_memcpy(dst1, src1, wtimes4); src1 = (Pixel *)((char *)src1 + srcpitch); dst1 = (Pixel *)((char *)dst1 + dstpitch); } } } else if (mfd->noMotion) { /* Well, I suppose somebody might select no advanced processing options but tick disable motion processing. This covers that. */ src1 = src_buf; dst1 = dst_buf; for (y = 0; y < h; y++) { tc_memcpy(dst1, src1, srcpitch); src1 = (Pixel *)((char *)src1 + srcpitch); dst1 = (Pixel *)((char *)dst1 + dstpitch); } goto filter_done; } /* End advanced processing mode code. Now do full motion-adaptive deinterlacing. */ /* Not much deinterlacing to do if there aren't at least 2 lines. */ if (h < 2) goto filter_done; count = 0; if (mfd->diffmode == FRAME_ONLY || mfd->diffmode == FRAME_AND_FIELD) { /* Skip first and last lines, they'll get a free ride. */ src = (Pixel *)((char *)src_buf + srcpitch); srcminus = (Pixel *)((char *)src - srcpitch); prev = mfd->prevFrame + w; moving = mfd->moving + w; for (y = 1; y < hminus1; y++) { x = 0; do { // First check frame motion. // Set the moving flag if the diff exceeds the configured // threshold. moving[x] = 0; frMotion = 0; prevValue = *prev; if (!mfd->colordiff) { r = (src[x] >> 16) & 0xff; g = (src[x] >> 8) & 0xff; b = src[x] & 0xff; luma = (76 * r + 30 * b + 150 * g) >> 8; if (abs(luma - prevValue) > mfd->threshold) frMotion = 1; } else { b = src[x] & 0xff; bp = prevValue & 0xff; if (abs(b - bp) > mfd->threshold) frMotion = 1; else { r = (src[x] >>16) & 0xff; rp = (prevValue >> 16) & 0xff; if (abs(r - rp) > mfd->threshold) frMotion = 1; else { g = (src[x] >> 8) & 0xff; gp = (prevValue >> 8) & 0xff; if (abs(g - gp) > mfd->threshold) frMotion = 1; } } } // Now check field motion if applicable. if (mfd->diffmode == FRAME_ONLY) moving[x] = frMotion; else { fiMotion = 0; if (y & 1) prevValue = srcminus[x]; else prevValue = *(prev + w); if (!mfd->colordiff) { r = (src[x] >> 16) & 0xff; g = (src[x] >> 8) & 0xff; b = src[x] & 0xff; luma = (76 * r + 30 * b + 150 * g) >> 8; if (abs(luma - prevValue) > mfd->threshold) fiMotion = 1; } else { b = src[x] & 0xff; bp = prevValue & 0xff; if (abs(b - bp) > mfd->threshold) fiMotion = 1; else { r = (src[x] >> 16) & 0xff; rp = (prevValue >> 16) & 0xff; if (abs(r - rp) > mfd->threshold) fiMotion = 1; else { g = (src[x] >> 8) & 0xff; gp = (prevValue >> 8) & 0xff; if (abs(g - gp) > mfd->threshold) fiMotion = 1; } } } moving[x] = (fiMotion && frMotion); } if (!mfd->colordiff) *prev++ = luma; else *prev++ = src[x]; /* Keep a count of the number of moving pixels for the scene change detection. */ if (moving[x]) count++; } while(++x < w); src = (Pixel *)((char *)src + srcpitch); srcminus = (Pixel *)((char *)srcminus + srcpitch); moving += w; } /* Determine whether a scene change has occurred. */ if ((100L * count) / (h * w) >= mfd->scenethreshold) scenechange = 1; else scenechange = 0; /* printf("Frame (%04d) count (%8ld) sc (%d) calc (%02ld)\n", ptr->id, count, scenechange, (100 * count) / (h * w)); */ /* Perform a denoising of the motion map if enabled. */ if (!scenechange && mfd->highq) { int xlo, xhi, ylo, yhi; int u, v; int N = 5; int Nover2 = N/2; int sum; unsigned char *m; // Erode. fmoving = mfd->fmoving; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { if (!((mfd->moving + y * w)[x])) { fmoving[x] = 0; continue; } xlo = x - Nover2; if (xlo < 0) xlo = 0; xhi = x + Nover2; if (xhi >= w) xhi = wminus1; ylo = y - Nover2; if (ylo < 0) ylo = 0; yhi = y + Nover2; if (yhi >= h) yhi = hminus1; m = mfd->moving + ylo * w; sum = 0; for (u = ylo; u <= yhi; u++) { for (v = xlo; v <= xhi; v++) { sum += m[v]; } m += w; } if (sum > 9) fmoving[x] = 1; else fmoving[x] = 0; } fmoving += w; } // Dilate. N = 5; Nover2 = N/2; moving = mfd->moving; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { if (!((mfd->fmoving + y * w)[x])) { moving[x] = 0; continue; } xlo = x - Nover2; if (xlo < 0) xlo = 0; xhi = x + Nover2; if (xhi >= w) xhi = wminus1; ylo = y - Nover2; if (ylo < 0) ylo = 0; yhi = y + Nover2; if (yhi >= h) yhi = hminus1; m = mfd->moving + ylo * w; for (u = ylo; u <= yhi; u++) { for (v = xlo; v <= xhi; v++) { m[v] = 1; } m += w; } } moving += w; } } } else { /* Field differencing only mode. */ T = mfd->threshold * mfd->threshold; src = (Pixel *)((char *)src_buf + srcpitch); srcminus = (Pixel *)((char *)src - srcpitch); srcplus = (Pixel *)((char *)src + srcpitch); moving = mfd->moving + w; for (y = 1; y < hminus1; y++) { x = 0; do { // Set the moving flag if the diff exceeds the configured // threshold. moving[x] = 0; if (y & 1) { // Now check field motion. fiMotion = 0; nextValue = srcplus[x]; prevValue = srcminus[x]; if (!mfd->colordiff) { r = (src[x] >> 16) & 0xff; rp = (prevValue >> 16) & 0xff; rn = (nextValue >> 16) & 0xff; g = (src[x] >> 8) & 0xff; gp = (prevValue >> 8) & 0xff; gn = (nextValue >> 8) & 0xff; b = src[x] & 0xff; bp = prevValue & 0xff; bn = nextValue & 0xff; luma = (76 * r + 30 * b + 150 * g) >> 8; lumap = (76 * rp + 30 * bp + 150 * gp) >> 8; luman = (76 * rn + 30 * bn + 150 * gn) >> 8; if ((lumap - luma) * (luman - luma) > T) moving[x] = 1; } else { b = src[x] & 0xff; bp = prevValue & 0xff; bn = nextValue & 0xff; if ((bp - b) * (bn - b) > T) moving[x] = 1; else { r = (src[x] >> 16) & 0xff; rp = (prevValue >> 16) & 0xff; rn = (nextValue >> 16) & 0xff; if ((rp - r) * (rn - r) > T) moving[x] = 1; else { g = (src[x] >> 8) & 0xff; gp = (prevValue >> 8) & 0xff; gn = (nextValue >> 8) & 0xff; if ((gp - g) * (gn - g) > T) moving[x] = 1; } } } } /* Keep a count of the number of moving pixels for the scene change detection. */ if (moving[x]) count++; } while(++x < w); src = (Pixel *)((char *)src + srcpitch); srcminus = (Pixel *)((char *)srcminus + srcpitch); srcplus = (Pixel *)((char *)srcplus + srcpitch); moving += w; } /* Determine whether a scene change has occurred. */ if ((100L * count) / (h * w) >= mfd->scenethreshold) scenechange = 1; else scenechange = 0; /* Perform a denoising of the motion map if enabled. */ if (!scenechange && mfd->highq) { int xlo, xhi, ylo, yhi; int u, v; int N = 5; int Nover2 = N/2; int sum; unsigned char *m; // Erode. fmoving = mfd->fmoving; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { if (!((mfd->moving + y * w)[x])) { fmoving[x] = 0; continue; } xlo = x - Nover2; if (xlo < 0) xlo = 0; xhi = x + Nover2; if (xhi >= w) xhi = wminus1; ylo = y - Nover2; if (ylo < 0) ylo = 0; yhi = y + Nover2; if (yhi >= h) yhi = hminus1; m = mfd->moving + ylo * w; sum = 0; for (u = ylo; u <= yhi; u++) { for (v = xlo; v <= xhi; v++) { sum += m[v]; } m += w; } if (sum > 9) fmoving[x] = 1; else fmoving[x] = 0; } fmoving += w; } // Dilate. N = 5; Nover2 = N/2; moving = mfd->moving; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { if (!((mfd->fmoving + y * w)[x])) { moving[x] = 0; continue; } xlo = x - Nover2; if (xlo < 0) xlo = 0; xhi = x + Nover2; if (xhi >= w) xhi = wminus1; ylo = y - Nover2; if (ylo < 0) ylo = 0; yhi = y + Nover2; if (yhi >= h) yhi = hminus1; m = mfd->moving + ylo * w; for (u = ylo; u <= yhi; u++) { for (v = xlo; v <= xhi; v++) { m[v] = 1; } m += w; } } moving += w; } } } // Render. // The first line gets a free ride. src = src_buf; dst = dst_buf; tc_memcpy(dst, src, wtimes4); src = (Pixel *)((char *)src_buf + srcpitch); srcminus = (Pixel *)((char *)src - srcpitch); srcplus = (Pixel *)((char *)src + srcpitch); if (cubic) { srcminusminus = (Pixel *)((char *)src - 3 * srcpitch); srcplusplus = (Pixel *)((char *)src + 3 * srcpitch); } dst = (Pixel *)((char *)dst_buf + dstpitch); moving = mfd->moving + w; movingminus = moving - w; movingplus = moving + w; for (y = 1; y < hminus1; y++) { if (mfd->motionOnly) { if (mfd->Blend) { x = 0; do { if (!(movingminus[x] | moving[x] | movingplus[x]) && !scenechange) dst[x] = 0x7f7f7f; else { /* Blend fields. */ p0 = src[x]; p0 &= 0x00fefefe; p1 = srcminus[x]; p1 &= 0x00fcfcfc; p2 = srcplus[x]; p2 &= 0x00fcfcfc; dst[x] = (p0>>1) + (p1>>2) + (p2>>2); } } while(++x < w); } else { x = 0; do { if (!(movingminus[x] | moving[x] | movingplus[x]) && !scenechange) dst[x] = 0x7f7f7f; else if (y & 1) { if (cubic && (y > 2) && (y < hminus3)) { rpp = (srcminusminus[x] >> 16) & 0xff; rp = (srcminus[x] >> 16) & 0xff; rn = (srcplus[x] >> 16) & 0xff; rnn = (srcplusplus[x] >>16) & 0xff; gpp = (srcminusminus[x] >> 8) & 0xff; gp = (srcminus[x] >> 8) & 0xff; gn = (srcplus[x] >>8) & 0xff; gnn = (srcplusplus[x] >> 8) & 0xff; bpp = (srcminusminus[x]) & 0xff; bp = (srcminus[x]) & 0xff; bn = (srcplus[x]) & 0xff; bnn = (srcplusplus[x]) & 0xff; R = (5 * (rp + rn) - (rpp + rnn)) >> 3; if (R > 255) R = 255; else if (R < 0) R = 0; G = (5 * (gp + gn) - (gpp + gnn)) >> 3; if (G > 255) G = 255; else if (G < 0) G = 0; B = (5 * (bp + bn) - (bpp + bnn)) >> 3; if (B > 255) B = 255; else if (B < 0) B = 0; dst[x] = (R << 16) | (G << 8) | B; } else { p1 = srcminus[x]; p1 &= 0x00fefefe; p2 = srcplus[x]; p2 &= 0x00fefefe; dst[x] = (p1>>1) + (p2>>1); } } else dst[x] = src[x]; } while(++x < w); } } else /* Not motion only */ { if (mfd->Blend) { x = 0; do { if (!(movingminus[x] | moving[x] | movingplus[x]) && !scenechange) dst[x] = src[x]; else { /* Blend fields. */ p0 = src[x]; p0 &= 0x00fefefe; p1 = srcminus[x]; p1 &= 0x00fcfcfc; p2 = srcplus[x]; p2 &= 0x00fcfcfc; dst[x] = (p0>>1) + (p1>>2) + (p2>>2); } } while(++x < w); } else { // Doing line interpolate. Thus, even lines are going through // for moving and non-moving mode. Odd line pixels will be subject // to the motion test. if (y&1) { x = 0; do { if (!(movingminus[x] | moving[x] | movingplus[x]) && !scenechange) dst[x] = src[x]; else { if (cubic && (y > 2) && (y < hminus3)) { rpp = (srcminusminus[x] >> 16) & 0xff; rp = (srcminus[x] >> 16) & 0xff; rn = (srcplus[x] >> 16) & 0xff; rnn = (srcplusplus[x] >>16) & 0xff; gpp = (srcminusminus[x] >> 8) & 0xff; gp = (srcminus[x] >> 8) & 0xff; gn = (srcplus[x] >>8) & 0xff; gnn = (srcplusplus[x] >> 8) & 0xff; bpp = (srcminusminus[x]) & 0xff; bp = (srcminus[x]) & 0xff; bn = (srcplus[x]) & 0xff; bnn = (srcplusplus[x]) & 0xff; R = (5 * (rp + rn) - (rpp + rnn)) >> 3; if (R > 255) R = 255; else if (R < 0) R = 0; G = (5 * (gp + gn) - (gpp + gnn)) >> 3; if (G > 255) G = 255; else if (G < 0) G = 0; B = (5 * (bp + bn) - (bpp + bnn)) >> 3; if (B > 255) B = 255; else if (B < 0) B = 0; dst[x] = (R << 16) | (G << 8) | B; } else { p1 = srcminus[x]; p1 &= 0x00fefefe; p2 = srcplus[x]; p2 &= 0x00fefefe; dst[x] = (p1>>1) + (p2>>1); } } } while(++x < w); } else { // Even line; pass it through. tc_memcpy(dst, src, wtimes4); } } } src = (Pixel *)((char *)src + srcpitch); srcminus = (Pixel *)((char *)srcminus + srcpitch); srcplus = (Pixel *)((char *)srcplus + srcpitch); if (cubic) { srcminusminus = (Pixel *)((char *)srcminusminus + srcpitch); srcplusplus = (Pixel *)((char *)srcplusplus + srcpitch); } dst = (Pixel *)((char *)dst + dstpitch); moving += w; movingminus += w; movingplus += w; } // The last line gets a free ride. tc_memcpy(dst, src, wtimes4); filter_done: convert_argb2rgb (mfd->convertFrameOut, ptr->video_buf, ptr->v_width, ptr->v_height); if (mfd->codec == CODEC_YUV) tc_rgb2yuv_core(ptr->video_buf); return 0; } return 0; } transcode-1.0.0beta2/filter/filter_smartyuv.c100644 001750 000000 00000121460 10172633256 0014776/* filter_smartyuv.c This file is part of transcode, a linux video stream processing tool 2003 by Tilmann Bitterberg, based on code by Donald Graft. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define MOD_NAME "filter_smartyuv.so" #define MOD_VERSION "0.1.4 (2003-10-13)" #define MOD_CAP "Motion-adaptive deinterlacing" #define MOD_AUTHOR "Tilmann Bitterberg" #include #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" //#undef HAVE_MMX //#undef CAN_COMPILE_C_ALTIVEC // mmx gives a speedup of about 3 fps // when running without highq, mmx gives 12 fps // altivec does not give much, about 1 fps #ifdef HAVE_ASM_MMX # include "mmx.h" #endif #ifndef HAVE_ASM_MMX # define emms() do{}while(0) #endif #define rdtscll(val) __asm__ __volatile__("rdtsc" : "=A" (val)) static vob_t *vob=NULL; /////////////////////////////////////////////////////////////////////////// // this value is "hardcoded" in the optimized code for speed reasons #define DENOISE_DIAMETER 5 #define DENOISE_THRESH 7 #define BLACK_BYTE_Y 16 #define BLACK_BYTE_UV 128 #define MIN_Y 16 #define MAX_Y 240 #define FRAME_ONLY 0 #define FIELD_ONLY 1 #define FRAME_AND_FIELD 2 #define LUMA_THRESHOLD 14 #define CHROMA_THRESHOLD 7 #define SCENE_THRESHOLD 31 // We pad the moving maps with 16 pixels left and right, to make sure // that we always can do aligned loads and stores at a multiple of 16. // this is especially important when doing altivec but might help in // other cases as well. #define PAD 32 static unsigned char clamp_Y(unsigned char x) { return (x>MAX_Y?MAX_Y:(x 7); } fmoving++; if (*moving++) { res[1]+=res[2]; res[1]+=res[3]; res[1]+=res[4]; res[1]+=res[5]; *fmoving = (res[1] > 7); } fmoving++; if (*moving++) { res[2]+=res[3]; res[2]+=res[4]; res[2]+=res[5]; res[2]+=res[6]; *fmoving = (res[2] > 7); } fmoving++; if (*moving++) { res[3]+=res[4]; res[3]+=res[5]; res[3]+=res[6]; res[3]+=res[7]; *fmoving = (res[3] > 7); } fmoving++; p += 4; } fmoving += PAD; moving += PAD; p += PAD; } else #endif { for (x = 0; x < width; x++) { if (!(fmoving[x] = moving[x]) ) continue; m = moving + x - 2*w4 -2; sum = 1; //sum += m[0] + m[1] + m[2] + m[3] + m[4]; //max sum is 25 or better 1<<25 sum <<= m[0]; sum <<= m[1]; sum <<= m[2]; sum <<= m[3]; sum <<= m[4]; m += w4; sum <<= m[0]; sum <<= m[1]; sum <<= m[2]; sum <<= m[3]; sum <<= m[4]; m += w4; sum <<= m[0]; sum <<= m[1]; sum <<= m[2]; sum <<= m[3]; sum <<= m[4]; m += w4; sum <<= m[0]; sum <<= m[1]; sum <<= m[2]; sum <<= m[3]; sum <<= m[4]; m += w4; sum <<= m[0]; sum <<= m[1]; sum <<= m[2]; sum <<= m[3]; sum <<= m[4]; // check if the only bit set has an index of 8 or greater (threshold is 7) fmoving[x] = (sum > 128); } fmoving += w4; moving += w4; } // else can use mmx } emms(); // Dilate. fmoving = _fmoving; moving = _moving; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { if ((moving[x] = fmoving[x])) { m = moving + x - 2*w4 -2; memset(m, 1, 5); m += w4; memset(m, 1, 5); m += w4; memset(m, 1, 5); m += w4; memset(m, 1, 5); m += w4; memset(m, 1, 5); } } moving += w4; fmoving += w4; } } static void inline Blendline_c (uint8_t *dst, uint8_t *src, uint8_t *srcminus, uint8_t *srcplus, uint8_t *moving, uint8_t *movingminus, uint8_t *movingplus, const int w, const int scenechange) { int x=0; do { if (movingminus[x] | moving[x] | movingplus[x] | scenechange) /* Blend fields. */ dst[x] = ((src[x]>>1) + (srcminus[x]>>2) + (srcplus[x]>>2)) & 0xff; else { dst[x] = src[x]; } } while(++x < w); } // this works fine on OSX too #define ABS_u8(a) (((a)^((a)>>7))-((a)>>7)) static void smartyuv_core (char *_src, char *_dst, char *_prev, int _width, int _height, int _srcpitch, int _dstpitch, unsigned char *_moving, unsigned char *_fmoving, unsigned char(*clamp_f)(unsigned char x), int _threshold ) { const int srcpitch = _srcpitch; const int dstpitch = _dstpitch; const int w = _width; const int wminus1 = w - 1; const int h = _height; const int hminus1 = h - 1; const int hminus3 = h - 3; char *src, *dst, *srcminus=NULL, *srcplus, *srcminusminus=NULL, *srcplusplus=NULL; unsigned char *moving, *movingminus, *movingplus; unsigned char *fmoving; char *prev; int scenechange=0; long count=0; int x, y; int luma, luman, lumap, T; int p1, p2; int rp, rn, rpp, rnn, R; unsigned char fiMotion; int cubic = mfd->cubic; static int counter=0; #ifdef HAVE_ASM_MMX const int can_use_mmx = !(w%8); // width must a multiple of 8 #endif #ifdef CAN_COMPILE_C_ALTIVEC const int can_use_altivec = !(w%16); // width must a multiple of 16 #endif char * dst_buf; char * src_buf; //memset(ptr->video_buf+h*w, BLACK_BYTE_UV, h*w/2); src_buf = _src; dst_buf = _dst; /* Not much deinterlacing to do if there aren't at least 2 lines. */ if (h < 2) return; /* Skip first and last lines, they'll get a free ride. */ src = src_buf + srcpitch; srcminus = src - srcpitch; srcplus = src + srcpitch; moving = _moving + w+PAD; prev = _prev + w; //printf("Aligned src %p prev %p moving %p\n", src, prev, moving); if (mfd->diffmode == FRAME_ONLY || mfd->diffmode == FRAME_AND_FIELD) { if (mfd->diffmode == FRAME_ONLY) { #ifdef HAVE_ASM_MMX if (can_use_mmx) { uint64_t mask1 = 0x00FF00FF00FF00FFULL; uint64_t thres = (_threshold<<16) | (_threshold); thres = (thres << 32) | (thres); movq_m2r (mask1, mm6); movq_m2r (thres, mm5); // thres -> mm6 count = 0; for (y = 1; y < hminus1; y++) { for (x=0; x 01 vmov = (vector unsigned char)vec_cmpgt(vmov, vthres); vmov = vec_sr(vmov, shift); vec_st(vmov, 0, (unsigned char *)moving); /* Keep a count of the number of moving pixels for the scene change detection. */ for (i=0; i<16; i++) { count += *moving++; *prev++ = *src++; } } moving += PAD; } #if 0 { FILE *f = fopen("mov.dat", "w"); printf ("COUNT %d size1 (%d) size2 (%d)\n", count, sizeof (*moving), sizeof (unsigned char)); fwrite (_moving, h*w, 1, f); fclose (f); exit(0); } #endif } else #endif { count = 0; for (y = 1; y < hminus1; y++) { for (x=0; x _threshold)); /* Keep a count of the number of moving pixels for the scene change detection. */ count += *moving++; } moving += PAD; } } // cannot use mmx } else if (mfd->diffmode == FRAME_AND_FIELD) { #ifdef HAVE_ASM_MMX if (can_use_mmx) { uint64_t mask1 = 0x00FF00FF00FF00FFULL; uint64_t thres = (_threshold<<16) | (_threshold); thres = (thres << 32) | (thres); movq_m2r (mask1, mm6); movq_m2r (thres, mm5); // thres -> mm6 // --------------------- // create the motion map // --------------------- count = 0; for (y = 1; y < hminus1; y++) { if (y & 1) { // odd lines for (x=0; x>15))-(mm0>>15)) psraw_i2r(15, mm3); psraw_i2r(15, mm4); pxor_r2r(mm3, mm0); pxor_r2r(mm4, mm7); psubw_r2r(mm3, mm0); psubw_r2r(mm4, mm7); pcmpgtw_r2r(mm5, mm0); //compare if greater than thres pcmpgtw_r2r(mm5, mm7); psrlw_i2r(15, mm0); // norm psrlw_i2r(15, mm7); // norm packuswb_r2r(mm0, mm0); // pack to bytes packuswb_r2r(mm7, mm7); // pack to bytes // mm0: result first compare // mm1-mm4: free // mm5: threshold // mm6: mask // mm7: copy of src pand_r2r(mm7, mm0); // write to moving movd_r2m(mm0, *moving); tc_memcpy(prev, src, 4); src+=4; prev+=4; srcminus+=4; count += *moving++; count += *moving++; count += *moving++; count += *moving++; } } else { // even lines for (x=0; x>15))-(mm0>>15)) psraw_i2r(15, mm3); psraw_i2r(15, mm4); pxor_r2r(mm3, mm0); pxor_r2r(mm4, mm7); psubw_r2r(mm3, mm0); psubw_r2r(mm4, mm7); pcmpgtw_r2r(mm5, mm0); //compare if greater than thres pcmpgtw_r2r(mm5, mm7); psrlw_i2r(15, mm0); // norm psrlw_i2r(15, mm7); // norm packuswb_r2r(mm0, mm0); // pack to bytes packuswb_r2r(mm7, mm7); // pack to bytes // mm0: result first compare // mm1-mm4: free // mm5: threshold // mm6: mask // mm7: copy of src pand_r2r(mm7, mm0); // write to moving movd_r2m(mm0, *moving); tc_memcpy(prev, src, 4); src+=4; prev+=4; count += *moving++; count += *moving++; count += *moving++; count += *moving++; } } srcminus += srcpitch; moving += PAD; } emms(); } else // cannot use mmx #elif CAN_COMPILE_C_ALTIVEC_FIXME_BROKEN if (can_use_altivec) { vector unsigned char vthres; vector unsigned char shift = vec_splat_u8(7); unsigned char __attribute__ ((aligned(16))) tdata[16]; int i; memset(tdata, _threshold, 16); vthres = vec_ld(0, tdata); count = 0; //printf ("Align: %p %p %p\n", src, srcminus, prev); for (y = 1; y < hminus1; y++) { if (y & 1) { // odd lines for (x=0; x 01 vmov = vec_sr(vmov, shift); vec_st(vmov, 0, (unsigned char *)moving); /* Keep a count of the number of moving pixels for the scene change detection. */ for (i=0; i<16; i++) { count += *moving++; *prev++ = *src++; } } } else { // even lines for (x=0; x 01 vmov = vec_sr(vmov, shift); vec_st(vmov, 0, (unsigned char *)moving); /* Keep a count of the number of moving pixels for the scene change detection. */ for (i=0; i<16; i++) { count += *moving++; *prev++ = *src++; } } } // odd vs. even srcminus += srcpitch; moving += PAD; } // height printf ("COUNT %d|\n", count); } else #endif { count = 0; for (y = 1; y < hminus1; y++) { x = 0; if (y & 1) { do { int luma = *src++&0xff; int p0 = luma - (*(srcminus+x)&0xff); int p1 = luma - (*prev&0xff); /* 15:11 < GomGom> abs can be replaced by i^(i>>31)-(i>>31) */ *prev++ = luma; *moving = ((ABS_u8(p0) > _threshold) & (ABS_u8(p1) > _threshold)); count += *moving++; } while(++x < w); } else { do { int luma = *src++ & 0xff; int p0 = luma - (*(prev+w)&0xff); int p1 = luma - (*prev&0xff); *prev++ = luma; *moving = ((ABS_u8(p0) > _threshold) & (ABS_u8(p1) > _threshold)); count += *moving++; } while(++x < w); } moving += PAD; srcminus += srcpitch; } //printf ("XXXCOUNT %d|\n", count); } } /* Determine whether a scene change has occurred. */ if ((100L * count) / (h * w) >= mfd->scenethreshold) scenechange = 1; else scenechange = 0; if (scenechange && mfd->verbose) printf("[%s] Scenechange at %6d (%6ld moving pixels)\n", MOD_NAME, counter, count); /* printf("Frame (%04d) count (%8ld) sc (%d) calc (%02ld)\n", counter, count, scenechange, (100 * count) / (h * w)); */ /* Perform a denoising of the motion map if enabled. */ if (!scenechange && mfd->highq) { //uint64_t before = 0; //uint64_t after = 0; //rdtscll(before); Erode_Dilate(_moving, _fmoving, w, h); //rdtscll(after); //printf("%6d : %8lld\n", count, after-before); } } if (mfd->diffmode == FIELD_ONLY) { /* Field differencing only mode. */ T = _threshold * _threshold; for (y = 1; y < hminus1; y++) { x = 0; do { // Set the moving flag if the diff exceeds the configured // threshold. moving[x] = 0; if (y & 1) { // Now check field motion. fiMotion = 0; luma = (src[x]) & 0xff; lumap= (srcminus[x]) & 0xff; luman = (srcplus[x]) & 0xff; if ((lumap - luma) * (luman - luma) > T) moving[x] = 1; } /* Keep a count of the number of moving pixels for the scene change detection. */ if (moving[x]) count++; } while(++x < w); src = src + srcpitch; srcminus = srcminus + srcpitch; srcplus = srcplus + srcpitch; moving += (w+PAD); } /* Determine whether a scene change has occurred. */ if ((100L * count) / (h * w) >= mfd->scenethreshold) scenechange = 1; else scenechange = 0; /* Perform a denoising of the motion map if enabled. */ if (!scenechange && mfd->highq) { int xlo, xhi, ylo, yhi; int u, v; int N = 5; int Nover2 = N/2; int sum; unsigned char *m; // Erode. fmoving = _fmoving; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { if (!((_moving + y * (w+PAD))[x])) { fmoving[x] = 0; continue; } xlo = x - Nover2; if (xlo < 0) xlo = 0; xhi = x + Nover2; if (xhi >= w) xhi = wminus1; ylo = y - Nover2; if (ylo < 0) ylo = 0; yhi = y + Nover2; if (yhi >= h) yhi = hminus1; m = _moving + ylo * (w+PAD); sum = 0; for (u = ylo; u <= yhi; u++) { for (v = xlo; v <= xhi; v++) { sum += m[v]; } m += w; } if (sum > 9) fmoving[x] = 1; else fmoving[x] = 0; } fmoving += (w+PAD); } // Dilate. N = 5; Nover2 = N/2; moving = _moving; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { if (!((_fmoving + y * (w+PAD))[x])) { moving[x] = 0; continue; } xlo = x - Nover2; if (xlo < 0) xlo = 0; xhi = x + Nover2; if (xhi >= w) xhi = wminus1; ylo = y - Nover2; if (ylo < 0) ylo = 0; yhi = y + Nover2; if (yhi >= h) yhi = hminus1; m = _moving + ylo * (w+PAD); for (u = ylo; u <= yhi; u++) { for (v = xlo; v <= xhi; v++) { m[v] = 1; } m += (w+PAD); } } moving += (w+PAD); } } } // ----------------- // Render. // ----------------- // The first line gets a free ride. src = src_buf; dst = dst_buf; tc_memcpy(dst, src, w); src = src_buf + srcpitch; srcminus = src - srcpitch; srcplus = src + srcpitch; if (cubic) { srcminusminus = src - 3 * srcpitch; srcplusplus = src + 3 * srcpitch; } dst = dst_buf + dstpitch; moving = _moving + w+PAD; movingminus = _moving; movingplus = moving + w+PAD; /* */ if (mfd->motionOnly) { for (y = 1; y < hminus1; y++) { if (mfd->Blend) { x = 0; do { if (!(movingminus[x] | moving[x] | movingplus[x]) && !scenechange) dst[x] = (clamp_f==clamp_Y)?BLACK_BYTE_Y:BLACK_BYTE_UV; else { /* Blend fields. */ dst[x] = (((src[x]&0xff)>>1) + ((srcminus[x]&0xff)>>2) + ((srcplus[x]&0xff)>>2))&0xff; } } while(++x < w); } else { x = 0; do { if (!(movingminus[x] | moving[x] | movingplus[x]) && !scenechange) dst[x] = (clamp_f==clamp_Y)?BLACK_BYTE_Y:BLACK_BYTE_UV; else if (y & 1) { if (cubic && (y > 2) && (y < hminus3)) { rpp = (srcminusminus[x]) & 0xff; rp = (srcminus[x]) & 0xff; rn = (srcplus[x]) & 0xff; rnn = (srcplusplus[x]) & 0xff; R = (5 * (rp + rn) - (rpp + rnn)) >> 3; /* if (R>240) R = 240; else if (R<16) R=16; */ dst[x] = clamp_f(R & 0xff)&0xff; } else { p1 = srcminus[x] &0xff; p1 &= 0xfe; p2 = srcplus[x] &0xff; p2 &= 0xfe; dst[x] = ((p1>>1) + (p2>>1)) &0xff; } } else dst[x] = src[x]; } while(++x < w); } src = src + srcpitch; srcminus = srcminus + srcpitch; srcplus = srcplus + srcpitch; if (cubic) { srcminusminus = srcminusminus + srcpitch; srcplusplus = srcplusplus + srcpitch; } dst = dst + dstpitch; moving += (w+PAD); movingminus += (w+PAD); movingplus += (w+PAD); } // The last line gets a free ride. tc_memcpy(dst, src, w); if (clamp_f == clamp_Y) counter++; return; } if (mfd->Blend) { // linear blend, see Blendline_c for a plainC version for (y = 1; y < hminus1; y++) { #ifdef HAVE_ASM_MMX if (can_use_mmx) { uint64_t scmask = (scenechange<<24) | (scenechange<<16) | (scenechange<<8) | scenechange; scmask = (scmask << 32) | scmask; pcmpeqw_r2r(mm4, mm4); psrlw_i2r(9,mm4); packuswb_r2r(mm4, mm4); // build 0x7f7f7f7f7f7f7f7f pcmpeqw_r2r(mm6, mm6); psrlw_i2r(10,mm6); packuswb_r2r(mm6, mm6); // build 0x3f3f3f3f3f3f3f3f for (x=0; x>1 and src together dependand on moving mask // mm0: mask, if 0 don't shift, if ff shift // mm1: complete src // mm2: srcminus // mm3: srcplus // mm4: 0x7f mask // mm5: free // mm6: 0x3f mask // mm7: free // handle srcm(inus) and srcp(lus) pand_r2r (mm0, mm2); pand_r2r (mm0, mm3); psrlw_i2r(2, mm2); // srcm>>2 psrlw_i2r(2, mm3); // srcp>>2 pand_r2r (mm6, mm2); // clear highest two bits pand_r2r (mm6, mm3); paddusb_r2r (mm2, mm1); // src>>1 + srcn>>2 + srcp>>2 paddusb_r2r (mm3, mm1); movq_r2m(mm1, dst[x]); } } else // cannot use mmx #elif CAN_COMPILE_C_ALTIVEC if (can_use_altivec) { unsigned char tdata[16]; memset (tdata, scenechange, 16); vector unsigned char vscene = vec_ld(0, tdata); vector unsigned char vmov, vsrc2, vdest; vector unsigned char vsrc, vsrcminus, vsrcplus; vector unsigned char zero = vec_splat_u8(0); vector unsigned char ones = vec_splat_u8(1); vector unsigned char twos = vec_splat_u8(2); for (x=0; x 2) & (y < hminus3)) { R = (5 * ((srcminus[x] & 0xff) + (srcplus[x] & 0xff)) - ((srcminusminus[x] & 0xff) + (srcplusplus[x] & 0xff))) >> 3; dst[x] = clamp_f(R & 0xff)&0xff; } else { dst[x] = (((srcminus[x]&0xff) >> 1) + ((srcplus[x]&0xff) >> 1)) & 0xff; } else { dst[x] = src[x]; } } while(++x < w); } else { // Even line; pass it through. tc_memcpy(dst, src, w); } src += srcpitch; srcminus += srcpitch; srcplus += srcpitch; if (cubic) { srcminusminus += srcpitch; srcplusplus += srcpitch; } dst += dstpitch; moving += (w+PAD); movingminus += (w+PAD); movingplus += (w+PAD); } // The last line gets a free ride. tc_memcpy(dst, src, w); if (clamp_f == clamp_Y) counter++; return; } int tc_filter(vframe_list_t *ptr, char *options) { //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { unsigned int width, height; int msize; if((vob = tc_get_vob())==NULL) return(-1); mfd = (MyFilterData *) malloc(sizeof(MyFilterData)); if (!mfd) { fprintf(stderr, "No memory!\n"); return (-1); } memset (mfd, 0, sizeof(MyFilterData)); width = vob->im_v_width; height = vob->im_v_height; /* default values */ mfd->motionOnly = 0; mfd->threshold = LUMA_THRESHOLD; mfd->chromathres = CHROMA_THRESHOLD; mfd->scenethreshold = SCENE_THRESHOLD; mfd->diffmode = FRAME_ONLY; mfd->codec = vob->im_v_codec; mfd->highq = 1; mfd->cubic = 1; mfd->doChroma = 1; mfd->Blend = 1; mfd->verbose = 0; if (mfd->codec != CODEC_YUV) { tc_warn ("[%s] This filter is only capable of YUV mode", MOD_NAME); return -1; } if (options != NULL) { if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get (options, "motionOnly", "%d", &mfd->motionOnly ); optstr_get (options, "threshold", "%d", &mfd->threshold ); optstr_get (options, "chromathres", "%d", &mfd->chromathres ); optstr_get (options, "Blend", "%d", &mfd->Blend ); optstr_get (options, "scenethres", "%d", &mfd->scenethreshold ); optstr_get (options, "highq", "%d", &mfd->highq ); optstr_get (options, "cubic", "%d", &mfd->cubic ); optstr_get (options, "diffmode", "%d", &mfd->diffmode ); optstr_get (options, "doChroma", "%d", &mfd->doChroma ); optstr_get (options, "verbose", "%d", &mfd->verbose ); if (optstr_get (options, "help", "") >= 0) { help_optstr(); } } if (verbose > 1) { printf (" Smart YUV Deinterlacer Test Filter Settings (%dx%d):\n", width, height); printf (" motionOnly = %d\n", mfd->motionOnly); printf (" diffmode = %d\n", mfd->diffmode); printf (" threshold = %d\n", mfd->threshold); printf (" chromathres = %d\n", mfd->chromathres); printf (" scenethres = %d\n", mfd->scenethreshold); printf (" cubic = %d\n", mfd->cubic); printf (" highq = %d\n", mfd->highq); printf (" Blend = %d\n", mfd->Blend); printf (" doChroma = %d\n", mfd->doChroma); printf (" verbose = %d\n", mfd->verbose); } /* fetch memory */ mfd->buf = bufalloc (width*height*3, mfd->Rbuf); mfd->prevFrame = bufalloc (width*height*3, mfd->RprevFrame); msize = width*height + 4*(width+PAD) + PAD*height; mfd->movingY = (unsigned char *) bufalloc(sizeof(unsigned char)*msize, (char *)mfd->RmovingY); mfd->fmovingY = (unsigned char *) bufalloc(sizeof(unsigned char)*msize, (char *)mfd->RfmovingY); msize = width*height/4 + 4*(width+PAD) + PAD*height; mfd->movingU = (unsigned char *) bufalloc(sizeof(unsigned char)*msize, (char *)mfd->RmovingU); mfd->movingV = (unsigned char *) bufalloc(sizeof(unsigned char)*msize, (char *)mfd->RmovingV); mfd->fmovingU = (unsigned char *) bufalloc(sizeof(unsigned char)*msize, (char *)mfd->RfmovingU); mfd->fmovingV = (unsigned char *) bufalloc(sizeof(unsigned char)*msize, (char *)mfd->RfmovingV); if ( !mfd->movingY || !mfd->movingU || !mfd->movingV || !mfd->fmovingY || !mfd->fmovingU || !mfd->fmovingV || !mfd->buf || !mfd->prevFrame) { fprintf (stderr, "[%s] Memory allocation error\n", MOD_NAME); return -1; } memset(mfd->prevFrame, BLACK_BYTE_Y, width*height); memset(mfd->prevFrame+width*height, BLACK_BYTE_UV, width*height/2); memset(mfd->buf, BLACK_BYTE_Y, width*height); memset(mfd->buf+width*height, BLACK_BYTE_UV, width*height/2); msize = width*height + 4*(width+PAD) + PAD*height; memset(mfd->movingY, 0, msize); memset(mfd->fmovingY, 0, msize); msize = width*height/4 + 4*(width+PAD) + PAD*height; memset(mfd->movingU, 0, msize); memset(mfd->movingV, 0, msize); memset(mfd->fmovingU, 0, msize); memset(mfd->fmovingV, 0, msize); // Optimisation // For the motion maps a little bit more than the needed memory is // allocated. This is done, because than we don't have to use // conditional borders int the erode and dilate routines. 2 extra lines // on top and bottom and 2 pixels left and right for each line. // This is also the reason for the w+4's all over the place. // // This gives an speedup factor in erode+denoise of about 3. // // A lot of brain went into the optimisations, here are some numbers of // the separate steps. Note, to get these numbers I used the rdtsc // instruction to read the CPU cycle counter in seperate programms: // o Motion map creation // orig: 26.283.387 Cycles // now: 8.991.686 Cycles // mmx: 5.062.952 // o Erode+dilate // orig: 55.847.077 // now: 21.764.997 // Erodemmx: 18.765.878 // o Blending // orig: 8.162.287 // now: 5.384.433 // mmx: 4.569.875 // new mmx: 3.656.537 // o Cubic interpolation // orig: 7.487.338 // now: 6.684.908 // more: 3.554.580 // // Overall improvement in transcode: // 11.57 -> 22.78 frames per second for the test clip. // // filter init ok. if(verbose) printf("[%s] " #ifdef HAVE_ASM_MMX "(MMX) " #endif #ifdef CAN_COMPILE_C_ALTIVEC "(ALTIVEC) " #endif "%s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return 0; } /* TC_FILTER_INIT */ if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[255]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VYE", "1"); snprintf (buf, sizeof(buf), "%d", mfd->motionOnly); optstr_param (options, "motionOnly", "Show motion areas only, blacking out static areas" ,"%d", buf, "0", "1"); snprintf (buf, sizeof(buf), "%d", mfd->diffmode); optstr_param (options, "diffmode", "Motion Detection (0=frame, 1=field, 2=both)", "%d", buf, "0", "2" ); snprintf (buf, sizeof(buf), "%d", mfd->threshold); optstr_param (options, "threshold", "Motion Threshold (luma)", "%d", buf, "0", "255" ); snprintf (buf, sizeof(buf), "%d", mfd->chromathres); optstr_param (options, "chromathres", "Motion Threshold (chroma)", "%d", buf, "0", "255" ); snprintf (buf, sizeof(buf), "%d", mfd->scenethreshold); optstr_param (options, "scenethres", "Threshold for detecting scenechanges", "%d", buf, "0", "255" ); snprintf (buf, sizeof(buf), "%d", mfd->highq); optstr_param (options, "highq", "High-Quality processing (motion Map denoising)", "%d", buf, "0", "1" ); snprintf (buf, sizeof(buf), "%d", mfd->cubic); optstr_param (options, "cubic", "Do cubic interpolation", "%d", buf, "0", "1" ); snprintf (buf, sizeof(buf), "%d", mfd->Blend); optstr_param (options, "Blend", "Blend the frames for deinterlacing", "%d", buf, "0", "1" ); snprintf (buf, sizeof(buf), "%d", mfd->doChroma); optstr_param (options, "doChroma", "Enable chroma processing (slower but more accurate)", "%d", buf, "0", "1" ); snprintf (buf, sizeof(buf), "%d", mfd->verbose); optstr_param (options, "verbose", "Verbose mode", "%d", buf, "0", "1" ); return (0); } if(ptr->tag & TC_FILTER_CLOSE) { if (!mfd) return 0; if (mfd->Rbuf) free(mfd->Rbuf); mfd->buf = NULL; mfd->Rbuf = NULL; if (mfd->RprevFrame) free(mfd->RprevFrame); mfd->prevFrame = NULL; mfd->RprevFrame = NULL; if (mfd->RmovingY) free(mfd->RmovingY); mfd->RmovingY = NULL; mfd->movingY = NULL; if (mfd->RmovingU) free(mfd->RmovingU); mfd->RmovingU = NULL; mfd->movingU = NULL; if (mfd->RmovingV) free(mfd->RmovingV); mfd->RmovingV = NULL; mfd->movingV = NULL; if (mfd->RfmovingY) free(mfd->RfmovingY); mfd->RfmovingY = NULL; mfd->fmovingY = NULL; if (mfd->RfmovingU) free(mfd->RfmovingU); mfd->RfmovingU = NULL; mfd->fmovingU = NULL; if (mfd->RfmovingV) free(mfd->RfmovingV); mfd->RfmovingV = NULL; mfd->fmovingV = NULL; if (mfd) free(mfd); return 0; } /* TC_FILTER_CLOSE */ /////////////////////////////////////////////////////////////////////////// //if(ptr->tag & TC_PRE_S_PROCESS && ptr->tag & TC_VIDEO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { if(ptr->tag & TC_PRE_PROCESS && ptr->tag & TC_VIDEO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { int U = ptr->v_width*ptr->v_height; int V = ptr->v_width*ptr->v_height*5/4; int w2 = ptr->v_width/2; int h2 = ptr->v_height/2; int msize = ptr->v_width*ptr->v_height + 4*(ptr->v_width+PAD) + PAD*ptr->v_height; int off = 2*(ptr->v_width+PAD)+PAD/2; memset(mfd->movingY, 0, msize); memset(mfd->fmovingY, 0, msize); /* */ smartyuv_core(ptr->video_buf, mfd->buf, mfd->prevFrame, ptr->v_width, ptr->v_height, ptr->v_width, ptr->v_width, mfd->movingY+off, mfd->fmovingY+off, clamp_Y, mfd->threshold); if (mfd->doChroma) { msize = ptr->v_width*ptr->v_height/4 + 4*(ptr->v_width+PAD) + PAD*ptr->v_height; off = 2*(ptr->v_width/2+PAD)+PAD/2; memset(mfd->movingU, 0, msize); memset(mfd->fmovingU, 0, msize); memset(mfd->movingV, 0, msize); memset(mfd->fmovingV, 0, msize); /* */ smartyuv_core(ptr->video_buf+U, mfd->buf+U, mfd->prevFrame+U, w2, h2, w2, w2, mfd->movingU+off, mfd->fmovingU+off, clamp_UV, mfd->chromathres); smartyuv_core(ptr->video_buf+V, mfd->buf+V, mfd->prevFrame+V, w2, h2, w2, w2, mfd->movingV+off, mfd->fmovingV+off, clamp_UV, mfd->chromathres); } else { //pass through tc_memcpy(mfd->buf+U, ptr->video_buf+U, ptr->v_width*ptr->v_height/2); //memset(mfd->buf+U, BLACK_BYTE_UV, ptr->v_width*ptr->v_height/2); } /* memset(mfd->buf, BLACK_BYTE_Y, ptr->v_width*ptr->v_height); memset(mfd->buf+U, BLACK_BYTE_UV, ptr->v_width*ptr->v_height/2); */ tc_memcpy (ptr->video_buf, mfd->buf, ptr->video_size); return 0; } return 0; } transcode-1.0.0beta2/filter/filter_smooth.c100644 001750 000000 00000017307 10134572655 0014424/* * filter_smooth.c * * Copyright (C) Chad Page - October 2002 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_smooth.so" #define MOD_VERSION "v0.2.3 (2003-03-27)" #define MOD_CAP "(single-frame) smoothing plugin" #define MOD_AUTHOR "Chad Page" #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "filter.h" #include "optstr.h" /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static unsigned char *tbuf[MAX_FILTER]; void smooth_yuv(unsigned char *buf, int width, int height, int maxdiff, int maxldiff, int maxdist, float level, int instance) { int x, y, pu, cpu, cdiff; int xa, ya, oval, ldiff; unsigned char *bufcr, *bufcb; unsigned char *tbufcr, *tbufcb, *ltbuf; float dist, ratio, nval; ltbuf = tbuf[instance]; tbufcr = <buf[width * height]; tbufcb = &tbufcr[(width * height) / 4]; tc_memcpy(ltbuf, buf, (width * height) * 3 / 2); bufcr = &buf[width * height]; bufcb = &bufcr[(width * height) / 4]; /* First pass - horizontal */ for (y = 0; y < (height); y++) { for (x = 0; x < width; x++) { pu = ((y * width) / 2) + (x / 2); nval = ((float)buf[x + (y * width)]); oval = buf[x + (y * width)]; for (xa = x - maxdist; (xa <= (x + maxdist)) && (xa < width); xa++) { if (xa < 0) xa = 0; if (xa == x) xa++; cpu = ((y * width) / 2) + (xa / 2); cdiff = abs(tbufcr[pu] - tbufcr[cpu]); cdiff += abs(tbufcb[pu] - tbufcb[cpu]); /* If color difference not too great, average the pixel according to distance */ ldiff = abs(ltbuf[xa + (y * width)] - oval); if ((cdiff < maxdiff) && (ldiff < maxldiff)) { dist = abs(xa - x); ratio = level / dist; nval = nval * (1 - ratio); nval += ((float)ltbuf[xa + (y * width)]) * ratio; } } buf[x + (y * width)] = (unsigned char)(nval + 0.5); } } /* Second pass - vertical lines */ tc_memcpy(ltbuf, buf, (width * height) * 3 / 2); for (y = 0; y < (height); y++) { for (x = 0; x < width; x++) { pu = ((y * width) / 2) + (x / 2); nval = ((float)buf[x + (y * width)]); oval = buf[x + (y * width)]; for (ya = y - maxdist; (ya <= (y + maxdist)) && (ya < height); ya++) { if (ya < 0) ya = 0; if (ya == y) ya++; cpu = ((ya * width) / 2) + (x / 2); cdiff = abs(tbufcr[pu] - tbufcr[cpu]); cdiff += abs(tbufcb[pu] - tbufcb[cpu]); /* If color difference not too great, average the pixel according to distance */ ldiff = abs(ltbuf[x + (ya * width)] - oval); if ((cdiff < maxdiff) && (ldiff < maxldiff)) { dist = abs(ya - y); ratio = level / dist; nval = nval * (1 - ratio); nval += ((float)ltbuf[x + (ya * width)]) * ratio; // printf("%d %d %d %d %f %f\n", xa, ya, tbuf[x * (y * width)], buf[x + (y * width)], nval, ratio); } } buf[x + (y * width)] = (unsigned char)(nval + 0.5); } } } int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; static int cdiff[MAX_FILTER], ldiff[MAX_FILTER], range[MAX_FILTER]; static float strength[MAX_FILTER]; int instance = ptr->filter_id; // API explanation: // ================ // // (1) need more infos, than get pointer to transcode global // information structure vob_t as defined in transcode.h. // // (2) 'tc_get_vob' and 'verbose' are exported by transcode. // // (3) filter is called first time with TC_FILTER_INIT flag set. // // (4) make sure to exit immediately if context (video/audio) or // placement of call (pre/post) is not compatible with the filters // intended purpose, since the filter is called 4 times per frame. // // (5) see framebuffer.h for a complete list of frame_list_t variables. // // (6) filter is last time with TC_FILTER_CLOSE flag set //---------------------------------- // // filter print configure // //---------------------------------- if(ptr->tag & TC_FILTER_GET_CONFIG) { char buf[32]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VYEM", "1"); // buf, name, comment, format, val, from, to snprintf (buf, 32, "%.2f", strength[instance]); optstr_param (options, "strength", "Blending factor", "%f", buf, "0.0", "0.9"); snprintf (buf, 32, "%d", cdiff[instance]); optstr_param (options, "cdiff", "Max difference in chroma values", "%d", buf, "0", "16"); snprintf (buf, 32, "%d", ldiff[instance]); optstr_param (options, "ldiff", "Max difference in luma value", "%d", buf, "0", "16"); snprintf (buf, 32, "%d", range[instance]); optstr_param (options, "range", "Search Range", "%d", buf, "0", "16"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. // set defaults strength[instance] = 0.25; /* Blending factor. Do not exceed 2 ever */ cdiff[instance] = 6; /* Max difference in UV values */ ldiff[instance] = 8; /* Max difference in Y value */ range[instance] = 4; /* Search range */ if (options != NULL) { if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get (options, "strength", "%f", &strength[instance]); optstr_get (options, "cdiff", "%d", &cdiff[instance]); optstr_get (options, "ldiff", "%d", &ldiff[instance]); optstr_get (options, "range", "%d", &range[instance]); } tbuf[instance] = (unsigned char *) malloc(SIZE_RGB_FRAME); if (strength[instance]> 0.9) strength[instance] = 0.9; memset(tbuf[instance], 0, SIZE_RGB_FRAME); if (vob->im_v_codec == CODEC_RGB) { if (verbose) fprintf(stderr, "[%s] only capable of YUV mode\n", MOD_NAME); return -1; } if(verbose) printf("[%s] %s %s #%d\n", MOD_NAME, MOD_VERSION, MOD_CAP, ptr->filter_id); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (tbuf[instance]) free(tbuf[instance]); tbuf[instance] = NULL; return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if(ptr->tag & TC_PRE_PROCESS && ptr->tag & TC_VIDEO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { if (vob->im_v_codec == CODEC_YUV) smooth_yuv(ptr->video_buf, ptr->v_width, ptr->v_height, cdiff[instance], ldiff[instance], range[instance], strength[instance], instance); } return(0); } transcode-1.0.0beta2/filter/filter_tc_audio.c100644 001750 000000 00000014227 10134572655 0014700/* * filter_tc_audio.c * * Copyright (C) Tilmann Bitterberg - August 2002 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_tc_audio.so" #define MOD_VERSION "v0.1 (2002-08-13)" #define MOD_CAP "audio 23.9 -> 29.9 telecide filter" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ // telecine filter int tc_filter(aframe_list_t *ptr, char *options) { static vob_t *vob=NULL; static char *audio_buf[2] = {NULL, NULL}; double fch; int leap_bytes1, leap_bytes2; // API explanation: // ================ // // (1) need more infos, than get pointer to transcode global // information structure vob_t as defined in transcode.h. // // (2) 'tc_get_vob' and 'verbose' are exported by transcode. // // (3) filter is called first time with TC_FILTER_INIT flag set. // // (4) make sure to exit immediately if context (video/audio) or // placement of call (pre/post) is not compatible with the filters // intended purpose, since the filter is called 4 times per frame. // // (5) see framebuffer.h for a complete list of frame_list_t variables. // // (6) filter is last time with TC_FILTER_CLOSE flag set //---------------------------------- // // filter init // //---------------------------------- if (ptr->tag & TC_VIDEO) return (0); if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); /* thank god there is no write protection for variables */ // if keep_ifps is supplied, do NOT change import_audio size if (options && optstr_lookup (options, "keep_ifps")) { ; } else { // copied verbatim from transcode.c fch = vob->a_rate/NTSC_FILM; // bytes per audio frame vob->im_a_size = (int)(fch * (vob->dm_bits/8) * vob->dm_chan); vob->im_a_size = (vob->im_a_size>>2)<<2; // rest: fch *= (vob->dm_bits/8) * vob->dm_chan; leap_bytes1 = TC_LEAP_FRAME * (fch - vob->im_a_size); leap_bytes2 = - leap_bytes1 + TC_LEAP_FRAME * (vob->dm_bits/8) * vob->dm_chan; leap_bytes1 = (leap_bytes1 >>2)<<2; leap_bytes2 = (leap_bytes2 >>2)<<2; if(leap_bytes1a_leap_bytes = leap_bytes1; } else { vob->a_leap_bytes = -leap_bytes2; vob->im_a_size += (vob->dm_bits/8) * vob->dm_chan; } } if (!audio_buf[0] && !audio_buf[1]) { audio_buf[0] = malloc (SIZE_PCM_FRAME); audio_buf[1] = malloc (SIZE_PCM_FRAME); if (!audio_buf[0] || !audio_buf[1]) { fprintf(stderr, "[%s] [%s:%d] malloc failed\n", MOD_NAME, __FILE__, __LINE__); return (-1); } } if (verbose & TC_DEBUG) printf("[%s] changing audio bufsize (%d) -> (%d)\n", MOD_NAME, vob->im_a_size, vob->ex_a_size); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context /* pass-through */ if (ptr->id == 0) return 0; /* in: T1 B1 | T2 B2 | T3 B3 | T4 B4 */ /* out: T1 B1 | T2 B2 | T2 B3 | T3 B4 | T4 B4 */ // rearrange the audio buffers, do not add or delete data // 4*8008 -> 5*6408 /* XXX: Is this really working?? appearantly -- tibit*/ if(ptr->tag & TC_POST_S_PROCESS && ptr->tag & TC_AUDIO) { int mod = ptr->id % 4; int ex = vob->ex_a_size; // 6408 // int diff = im - ex; int diff = ex/4; switch (mod) { case 1: tc_memcpy (audio_buf[0], ptr->audio_buf+ex, 1*diff); ptr->audio_size=ex; break; case 2: tc_memcpy (audio_buf[0]+1*diff , ptr->audio_buf , ex-1*diff); tc_memcpy (audio_buf[1] , ptr->audio_buf+ex-1*diff , 2*diff); tc_memcpy (ptr->audio_buf , audio_buf[0] , ex); ptr->audio_size=ex; break; case 3: tc_memcpy (audio_buf[1]+2*diff , ptr->audio_buf , ex-2*diff); tc_memcpy (audio_buf[0] , ptr->audio_buf+ex-2*diff, 3*diff); tc_memcpy (ptr->audio_buf , audio_buf[1] , ex); ptr->audio_size=ex; break; case 0: if (!(ptr->attributes & TC_FRAME_WAS_CLONED)) { ptr->attributes |= TC_FRAME_IS_CLONED; if (verbose & TC_DEBUG) printf("[A] frame cloned (%d)\n", ptr->id); tc_memcpy (audio_buf[0]+3*diff , ptr->audio_buf , ex-3*diff); tc_memcpy (audio_buf[1] , ptr->audio_buf+ex-3*diff, 4*diff); tc_memcpy (ptr->audio_buf , audio_buf[0] , ex); ptr->audio_size=ex; } else { // tc_memcpy (audio_buf[1]+4*diff , ptr->audio_buf , ex-4*diff); tc_memcpy (ptr->audio_buf , audio_buf[1] , ex); ptr->audio_size=ex; } break; } } return(0); } transcode-1.0.0beta2/filter/filter_tc_video.c100644 001750 000000 00000017022 10134572655 0014701/* * filter_tc_video.c * * Copyright (C) Tilmann Bitterberg - August 2002 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_tc_video.so" #define MOD_VERSION "v0.2 (2003-06-10)" #define MOD_CAP "video 23.9 -> 29.9 telecide filter" #define MOD_AUTHOR "Tilmann Bitterberg" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" // this variable is for external control from transcode. Not enabled right now // extern int tc_do_telecide; /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ // telecine filter int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; static char *video_buf[2] = {NULL, NULL}; if (ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VYE", "1"); return 0; } if (ptr->tag & TC_AUDIO) return (0); // API explanation: // ================ // // (1) need more infos, than get pointer to transcode global // information structure vob_t as defined in transcode.h. // // (2) 'tc_get_vob' and 'verbose' are exported by transcode. // // (3) filter is called first time with TC_FILTER_INIT flag set. // // (4) make sure to exit immediately if context (video/audio) or // placement of call (pre/post) is not compatible with the filters // intended purpose, since the filter is called 4 times per frame. // // (5) see framebuffer.h for a complete list of frame_list_t variables. // // (6) filter is last time with TC_FILTER_CLOSE flag set //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); if (!video_buf[0] && !video_buf[1]) { video_buf[0] = malloc (SIZE_RGB_FRAME); video_buf[1] = malloc (SIZE_RGB_FRAME); if (!video_buf[0] || !video_buf[1]) { fprintf(stderr, "[%s] [%s:%d] malloc failed\n", MOD_NAME, __FILE__, __LINE__); return (-1); } } return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context /* pass-through */ if (ptr->id == 0) return 0; /* in: T1 B1 | T2 B2 | T3 B3 | T4 B4 */ /* out: T1 B1 | T2 B2 | T2 B3 | T3 B4 | T4 B4 */ if(ptr->tag & TC_PRE_PROCESS && ptr->tag & TC_VIDEO) { if (vob->im_v_codec == CODEC_YUV) { int mod = ptr->id % 4; int height = vob->ex_v_height; int width = vob->ex_v_width; int width2 = width/2; int wh = width*height; int y; char *Y1, *Cr1; char *Y2, *Cr2; /* if (!tc_do_telecide) { tc_memcpy (video_buf[0], ptr->video_buf, height*width*3/2); tc_memcpy (video_buf[1], ptr->video_buf, height*width*3/2); return 0; } */ //fprintf(stderr, "Doing operations on frame %d\n", ptr->id); switch (mod) { case 1: /* nothing, pass frame through */ break; case 2: Y1 = video_buf[0]; Cr1 = video_buf[0]+wh; Y2 = ptr->video_buf; Cr2 = ptr->video_buf+wh; /* save top2 lines */ for (y=0; y<(height+1)/2; y++) { tc_memcpy (Y1, Y2, width); Y1 += width*2; Y2 += width*2; } /* color */ for (y=0; y<(height+1)/2; y++) { tc_memcpy (Cr1, Cr2, width2); Cr1 += width; Cr2 += width; } break; case 3: Y1 = video_buf[1]; Cr1 = video_buf[1]+wh; Y2 = ptr->video_buf; Cr2 = ptr->video_buf+wh; /* save top3 lines */ for (y=0; y<(height+1)/2; y++) { tc_memcpy (Y1, Y2, width); Y1 += width*2; Y2 += width*2; } /* color */ for (y=0; y<(height+1)/2; y++) { tc_memcpy (Cr1, Cr2, width2); Cr1 += width; Cr2 += width; } Y1 = ptr->video_buf; Cr1 = ptr->video_buf+wh; Y2 = video_buf[0]; Cr2 = video_buf[0]+wh; /* merge bot3 with top2 */ for (y=0; y<(height+1)/2; y++) { tc_memcpy (Y1, Y2, width); Y1 += width*2; Y2 += width*2; } /* color */ for (y=0; y<(height+1)/2; y++) { tc_memcpy (Cr1, Cr2, width2); Cr1 += width; Cr2 += width; } break; case 0: if (!(ptr->attributes & TC_FRAME_WAS_CLONED)) { ptr->attributes |= TC_FRAME_IS_CLONED; /* save complete frame */ tc_memcpy (video_buf[0], ptr->video_buf, height*width*3/2); /* merge bot4 with top3 */ Y1 = ptr->video_buf; Cr1 = ptr->video_buf+wh; Y2 = video_buf[1]; Cr2 = video_buf[1]+wh; for (y=0; y<(height+1)/2; y++) { tc_memcpy (Y1, Y2, width); Y1 += width*2; Y2 += width*2; } /* color */ for (y=0; y<(height+1)/2; y++) { tc_memcpy (Cr1, Cr2, width2); Cr1 += width; Cr2 += width; } } else { /* restore frame4 = frame 5 */ // this is the cloned frame tc_memcpy (ptr->video_buf, video_buf[0], height*width*3/2); } break; } // switch mod } else if (vob->im_v_codec == CODEC_RGB) { // This is wrong int mod = ptr->id % 4; int height = vob->ex_v_height; int width = vob->ex_v_width; int width3 = width*3; int y; switch (mod) { case 1: /* nothing, pass frame through */ break; case 2: /* save top2 lines */ for (y=0; yvideo_buf+y*width3, width3); break; case 3: /* save top3 lines */ for (y=0; yvideo_buf+y*width3, width3); /* merge bot3 with top2 */ for (y=0; yvideo_buf+y*width3, video_buf[0]+y*width3, width3); break; case 0: if (!(ptr->attributes & TC_FRAME_WAS_CLONED)) { ptr->attributes |= TC_FRAME_IS_CLONED; /* save complete frame */ tc_memcpy (video_buf[0], ptr->video_buf, height*width3); /* merge bot4 with top3 */ for (y=0; yvideo_buf+y*width3, video_buf[1]+y*width3, width3); } else { /* restore frame4 = frame 5 */ // this is the cloned frame tc_memcpy (ptr->video_buf, video_buf[0], height*width3); } break; } // switch mod } // CODEC_RGB } return(0); } transcode-1.0.0beta2/filter/filter_testframe.c100644 001750 000000 00000014256 07725567123 0015113/* * filter_testframe.c * * Copyright (C) Thomas streich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_testframe.so" #define MOD_VERSION "v0.1.3 (2003-09-04)" #define MOD_CAP "generate stream of testframes" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" static int mode=0; static vob_t *vob=NULL; void generate_rgb_frame(char *buffer, int width, int height) { int n, j, row_bytes; row_bytes = width*3; memset(buffer, 0, width*height*3); switch(mode) { case 0: for(n=0; ntag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "Thomas Oestreich", "VRYE", "1"); optstr_param (options, "mode", "Choose the test pattern (0-4 interlaced, 5 colorfull)", "%d", "0", "0", "5"); } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); if (options) { if (is_optstr(options)) { optstr_get(options, "mode", "%d", &mode); } else sscanf(options, "%d", &mode); } if(mode <0) { fprintf(stderr, "[%s] Invalid mode\n", MOD_NAME); return(-1); } return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if(ptr->tag & TC_PRE_PROCESS && ptr->tag & TC_VIDEO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { if(vob->im_v_codec==CODEC_RGB) { generate_rgb_frame(ptr->video_buf, ptr->v_width, ptr->v_height); } else { generate_yuv_frame(ptr->video_buf, ptr->v_width, ptr->v_height); } } return(0); } transcode-1.0.0beta2/filter/filter_text.c100644 001750 000000 00000051622 10175614673 0014077/* * filter_text * * Copyright (C) Tilmann Bitterberg - April 2003 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_text.so" #define MOD_VERSION "v0.1.4 (2004-02-14)" #define MOD_CAP "write text in the image" #define MOD_AUTHOR "Tilmann Bitterberg" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include // FreeType specific includes #include #ifdef FT_FREETYPE_H #include FT_FREETYPE_H #include "transcode.h" #include "framebuffer.h" #include "optstr.h" #include "video_trans.h" // basic parameter enum POS { NONE, TOP_LEFT, TOP_RIGHT, BOT_LEFT, BOT_RIGHT, CENTER, BOT_CENTER }; #define MAX_OPACITY 100 static unsigned char yuv255to224[] = { 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 26, 27, 27, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, 38, 39, 40, 41, 41, 42, 43, 44, 45, 46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 63, 64, 65, 66, 67, 68, 69, 70, 70, 71, 72, 73, 74, 75, 76, 77, 77, 78, 79, 80, 81, 82, 83, 84, 85, 85, 86, 87, 88, 89, 90, 91, 92, 92, 93, 94, 95, 96, 97, 98, 99, 99, 100, 101, 102, 103, 104, 105, 106, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 121, 122, 123, 124, 125, 126, 127, 128, 128, 129, 130, 131, 132, 133, 134, 135, 135, 136, 137, 138, 139, 140, 141, 142, 142, 143, 144, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 156, 157, 157, 158, 159, 160, 161, 162, 163, 164, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 179, 180, 181, 182, 183, 184, 185, 186, 186, 187, 188, 189, 190, 191, 192, 193, 193, 194, 195, 196, 197, 198, 199, 200, 200, 201, 202, 203, 204, 205, 206, 207, 207, 208, 209, 210, 211, 212, 213, 214, 215, 215, 216, 217, 218, 219, 220, 221, 222, 222, 223, 224, 225, 226, 227, 228, 229, 229, 230, 231, 232, 233, 234, 235, 236, 236, 237, 238, 239, 240 }; typedef struct MyFilterData { /* public */ unsigned int start; /* start frame */ unsigned int end; /* end frame */ unsigned int step; /* every Nth frame */ unsigned int dpi; /* dots per inch resolution */ unsigned int points; /* pointsize */ char *font; /* full path to font to use */ int posx; /* X offset in video */ int posy; /* Y offset in video */ enum POS pos; /* predifined position */ char *string; /* text to display */ int fade; /* fade in/out (speed) */ int transparent; /* do not draw a black bounding box */ int tstamp; /* */ int antialias; /* do sub frame anti-aliasing (not done) */ int R, G, B; /* color to apply in RGB */ int Y, U, V; /* color to apply in YUV */ int flip; /* private */ int opaque; /* Opaqueness of the text */ int boolstep; int top_space; int do_time; int start_fade_out; int boundX, boundY; int fade_in, fade_out; FT_Library library; FT_Face face; FT_GlyphSlot slot; } MyFilterData; static MyFilterData *mfd = NULL; static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" This filter renders text into the video stream\n"); printf ("* Options\n"); printf (" 'range' apply filter to [start-end]/step frames [0-oo/1]\n"); printf (" 'dpi' dots-per-inch resolution [96]\n"); printf (" 'points' point size of font in 1/64 [25]\n"); printf (" 'font' full path to font file [/usr/X11R6/.../arial.ttf]\n"); printf (" 'string' text to print [date]\n"); printf (" 'fade' Fade in and/or fade out [0=off, 1=slow, 10=fast]\n"); printf (" 'notransparent' disable transparency\n"); printf (" 'pos' Position (0-width x 0-height) [0x0]\n"); printf (" 'posdef' Position (0=None 1=TopL 2=TopR 3=BotL 4=BotR 5=Cent 6=BotCent) [0]\n"); printf (" 'tstamp' add timestamp to each frame (overrides string)\n"); } static void font_render(int width, int height, int size, int codec, int w, int h, int i, char *p, char *q, char *buf) { int error; //render into temp buffer if (codec == CODEC_YUV) { memset (buf, 16, height*width); memset (buf+height*width, 128, height*width/2); p = buf+mfd->posy*width+mfd->posx; for (i=0; istring); i++) { error = FT_Load_Char( mfd->face, mfd->string[i], FT_LOAD_RENDER); mfd->slot = mfd->face->glyph; if (verbose > 1) { // see http://www.freetype.org/freetype2/docs/tutorial/metrics.png /* printf ("`%c\': rows(%2d) width(%2d) pitch(%2d) left(%2d) top(%2d) " "METRIC: width(%2d) height(%2d) bearX(%2d) bearY(%2d)\n", mfd->string[i], mfd->slot->bitmap.rows, mfd->slot->bitmap.width, mfd->slot->bitmap.pitch, mfd->slot->bitmap_left, mfd->slot->bitmap_top, mfd->slot->metrics.width>>6, mfd->slot->metrics.height>>6, mfd->slot->metrics.horiBearingX>>6, mfd->slot->metrics.horiBearingY>>6); */ } for (h=0; hslot->bitmap.rows; h++) { for (w=0; wslot->bitmap.width; w++) { unsigned char c = mfd->slot->bitmap.buffer[h*mfd->slot->bitmap.width+w] &0xff; c = yuv255to224[c]; // make it transparent if (mfd->transparent && c==16) continue; p[width*(h+mfd->top_space - mfd->slot->bitmap_top) + w+mfd->slot->bitmap_left] = c&0xff; } } p+=((mfd->slot->advance.x >> 6) - (mfd->slot->advance.y >> 6)*width); } } else if (codec == CODEC_RGB) { memset (buf, 0, height*size); p = buf + 3*(height-mfd->posy)*width + 3*mfd->posx; for (i=0; istring); i++) { // render the char error = FT_Load_Char( mfd->face, mfd->string[i], FT_LOAD_RENDER); mfd->slot = mfd->face->glyph; // shortcut for (h=0; hslot->bitmap.rows; h++) { for (w=0; wslot->bitmap.width; w++) { unsigned char c = mfd->slot->bitmap.buffer[h*mfd->slot->bitmap.width+w]; c = c>254?254:c; c = c<16?16:c; // make it transparent if (mfd->transparent && c==16) continue; p[3*(width*(-(h+mfd->top_space - mfd->slot->bitmap_top)) + w+mfd->slot->bitmap_left)-2] = c&0xff; p[3*(width*(-(h+mfd->top_space - mfd->slot->bitmap_top)) + w+mfd->slot->bitmap_left)-1] = c&0xff; p[3*(width*(-(h+mfd->top_space - mfd->slot->bitmap_top)) + w+mfd->slot->bitmap_left)-0] = c&0xff; } } p+=3*((mfd->slot->advance.x >> 6) - (mfd->slot->advance.y >> 6)); } } } /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; static int width=0, height=0; static int size, codec=0; static int w, h, i; int error; static time_t mytime=0; static int hh, mm, ss, ss_frame; static float elapsed_ss; static char *buf = NULL; static char *p, *q; char *default_font = "/usr/X11R6/lib/X11/fonts/TrueType/arial.ttf"; extern int flip; // transcode.c if (ptr->tag & TC_AUDIO) return 0; if(ptr->tag & TC_FILTER_GET_CONFIG) { char b[128]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYO", "1"); snprintf(b, 128, "%u-%u/%d", mfd->start, mfd->end, mfd->step); optstr_param (options, "range", "apply filter to [start-end]/step frames", "%u-%u/%d", b, "0", "oo", "0", "oo", "1", "oo"); optstr_param (options, "string", "text to display (no ':') [defaults to `date`]", "%s", mfd->string); optstr_param (options, "font", "full path to font file [defaults to arial.ttf]", "%s", mfd->font); snprintf(b, 128, "%d", mfd->points); optstr_param (options, "points", "size of font (in points)", "%d", b, "1", "100"); snprintf(b, 128, "%d", mfd->dpi); optstr_param (options, "dpi", "resolution of font (in dpi)", "%d", b, "72", "300"); snprintf(b, 128, "%d", mfd->fade); optstr_param (options, "fade", "fade in/out (0=off, 1=slow, 10=fast)", "%d", b, "0", "10"); snprintf(b, 128, "%d", mfd->antialias); optstr_param (options, "antialias", "Anti-Alias text (0=off 1=on)", "%d", b, "0", "10"); optstr_param (options, "pos", "Position (0-width x 0-height)", "%dx%d", "0x0", "0", "width", "0", "height"); optstr_param (options, "posdef", "Position (0=None 1=TopL 2=TopR 3=BotL 4=BotR 5=Cent 6=BotCent)", "%d", "0", "0", "5"); optstr_param (options, "notransparent", "disable transparency (enables block box)", "", "0"); optstr_param (options, "tstamp", "add timestamp to each frame (overrides string)", "", "0"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); if((mfd = (MyFilterData *)malloc (sizeof(MyFilterData))) == NULL) return (-1); // just to be safe memset (mfd, 0, sizeof(MyFilterData)); mfd->start=0; mfd->end=(unsigned int)-1; mfd->step=1; mfd->points=25; mfd->dpi = 96; mfd->font = strdup(default_font); mfd->string = NULL; mfd->fade = 0; mfd->posx=0; mfd->posy=0; mfd->pos=NONE; mfd->transparent=1; mfd->antialias=1; mfd->do_time=1; mfd->tstamp=0; mfd->opaque=MAX_OPACITY; mfd->fade_in = 0; mfd->fade_out = 0; mfd->start_fade_out=0; mfd->top_space = 0; mfd->boundX=0; mfd->boundY=0; mfd->flip = flip; //if the user wants flipping, do it here in this filter if (mfd->flip) flip=TC_FALSE; mfd->R = mfd->B = mfd->G = 0xff; // white mfd->Y = 240; mfd->U = mfd->V = 128; if (options != NULL) { char font[PATH_MAX]; char string[PATH_MAX]; memset (font, 0, PATH_MAX); memset (string, 0, PATH_MAX); if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get (options, "range", "%u-%u/%d", &mfd->start, &mfd->end, &mfd->step); optstr_get (options, "dpi", "%u", &mfd->dpi); optstr_get (options, "points", "%u", &mfd->points); optstr_get (options, "font", "%[^:]", &font); optstr_get (options, "posdef", "%d", &mfd->pos); optstr_get (options, "pos", "%dx%d", &mfd->posx, &mfd->posy); optstr_get (options, "string", "%[^:]", &string); optstr_get (options, "fade", "%d", &mfd->fade); optstr_get (options, "antialias", "%d", &mfd->antialias); optstr_get (options, "color", "%2x%2x%2x", &mfd->R, &mfd->G, &mfd->B); mfd->Y = (0.257 * mfd->R) + (0.504 * mfd->G) + (0.098 * mfd->B) + 16; mfd->U = (0.439 * mfd->R) - (0.368 * mfd->G) - (0.071 * mfd->B) + 128; mfd->V = -(0.148 * mfd->R) - (0.291 * mfd->G) + (0.439 * mfd->B) + 128; if (optstr_lookup (options, "notransparent") ) { mfd->transparent = !mfd->transparent; } if (font && strlen(font)>0) { free (mfd->font); mfd->font=strdup(font); } if (string && strlen(string)>0) { mfd->string=strdup(string); mfd->do_time=0; } else if (optstr_lookup (options, "tstamp") ) { // mytime = time(NULL); mfd->string=strdup("[ timestamp ]"); mfd->do_time = 0; mfd->tstamp = 1; } else { // do `date` as default mytime = time(NULL); mfd->string = ctime(&mytime); mfd->string[strlen(mfd->string)-1] = '\0'; } } if (verbose) { printf (" Text Settings:\n"); printf (" string = \"%s\"\n", mfd->string); printf (" range = %u-%u\n", mfd->start, mfd->end); printf (" step = %u\n", mfd->step); printf (" dpi = %u\n", mfd->dpi); printf (" points = %u\n", mfd->points); printf (" font = %s\n", mfd->font); printf (" posdef = %d\n", mfd->pos); printf (" pos = %dx%d\n", mfd->posx, mfd->posy); printf (" color (RGB) = %x %x %x\n", mfd->R, mfd->G, mfd->B); printf (" color (YUV) = %x %x %x\n", mfd->Y, mfd->U, mfd->V); } if (options) if (optstr_lookup (options, "help")) { help_optstr(); } if (mfd->start % mfd->step == 0) mfd->boolstep = 0; else mfd->boolstep = 1; width = vob->ex_v_width; height = vob->ex_v_height; codec = vob->im_v_codec; if (codec == CODEC_RGB) size = width*3; else size = width*3/2; if((buf = (char *)malloc (height*size)) == NULL) return (-1); if (codec == CODEC_RGB) memset (buf, 0, height*size); else { memset (buf, 16, height*width); memset (buf+height*width, 128, height*width/2); } // init lib error = FT_Init_FreeType (&mfd->library); if (error) { fprintf(stderr, "[%s] ERROR: init lib!\n", MOD_NAME); return -1;} error = FT_New_Face (mfd->library, mfd->font, 0, &mfd->face); if (error == FT_Err_Unknown_File_Format) { fprintf(stderr, "[%s] ERROR: Unsupported font format\n", MOD_NAME); return -1; } else if (error) { fprintf(stderr, "[%s] ERROR: Cannot handle file\n", MOD_NAME); return -1; } error = FT_Set_Char_Size( mfd->face, /* handle to face object */ 0, /* char_width in 1/64th of points */ mfd->points*64, /* char_height in 1/64th of points */ mfd->dpi, /* horizontal device resolution */ mfd->dpi ); /* vertical device resolution */ if (error) { fprintf(stderr, "[%s] ERROR: Cannot set char size\n", MOD_NAME); return -1; } // guess where the the groundline is // find the bounding box for (i=0; istring); i++) { error = FT_Load_Char( mfd->face, mfd->string[i], FT_LOAD_RENDER); mfd->slot = mfd->face->glyph; if (mfd->top_space < mfd->slot->bitmap_top) mfd->top_space = mfd->slot->bitmap_top; // if you think about it, its somehow correct ;) /* if (mfd->boundY < 2*mfd->slot->bitmap.rows - mfd->slot->bitmap_top) mfd->boundY = 2*mfd->slot->bitmap.rows - mfd->slot->bitmap_top; */ if (mfd->boundY < 2*(mfd->slot->bitmap.rows) - mfd->slot->bitmap_top) mfd->boundY = 2*(mfd->slot->bitmap.rows) - mfd->slot->bitmap_top; /* printf ("`%c\': rows(%2d) width(%2d) pitch(%2d) left(%2d) top(%2d) " "METRIC: width(%2d) height(%2d) bearX(%2d) bearY(%2d)\n", mfd->string[i], mfd->slot->bitmap.rows, mfd->slot->bitmap.width, mfd->slot->bitmap.pitch, mfd->slot->bitmap_left, mfd->slot->bitmap_top, mfd->slot->metrics.width>>6, mfd->slot->metrics.height>>6, mfd->slot->metrics.horiBearingX>>6, mfd->slot->metrics.horiBearingY>>6); */ mfd->boundX += mfd->slot->advance.x >> 6; } switch (mfd->pos) { case NONE: /* 0 */ break; case TOP_LEFT: mfd->posx = 0; mfd->posy = 0; break; case TOP_RIGHT: mfd->posx = width - mfd->boundX; mfd->posy = 0; break; case BOT_LEFT: mfd->posx = 0; mfd->posy = height - mfd->boundY; break; case BOT_RIGHT: mfd->posx = width - mfd->boundX; mfd->posy = height - mfd->boundY; break; case CENTER: mfd->posx = (width - mfd->boundX)/2; mfd->posy = (height- mfd->boundY)/2; /* align to not cause color disruption */ if (mfd->posx&1) mfd->posx++; if (mfd->posy&1) mfd->posy++; break; case BOT_CENTER: mfd->posx = (width - mfd->boundX)/2; mfd->posy = height - mfd->boundY; if (mfd->posx&1) mfd->posx++; break; } if ( mfd->posy < 0 || mfd->posx < 0 || mfd->posx+mfd->boundX > width || mfd->posy+mfd->boundY > height) { fprintf(stderr, "[%s] ERROR invalid position\n", MOD_NAME); return (-1); } font_render(width,height,size,codec,w,h,i,p,q,buf); // filter init ok. if (verbose) printf("[%s] %s %s %dx%d-%d\n", MOD_NAME, MOD_VERSION, MOD_CAP, mfd->boundX, mfd->boundY, mfd->top_space); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (mfd) { FT_Done_Face (mfd->face ); FT_Done_FreeType (mfd->library); free(mfd->font); if (!mfd->do_time) free(mfd->string); free(mfd); free(buf); } mfd=NULL; buf=NULL; return(0); } /* filter close */ //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if((ptr->tag & TC_POST_PROCESS) && (ptr->tag & TC_VIDEO) && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { if (mfd->start <= ptr->id && ptr->id <= mfd->end && ptr->id%mfd->step == mfd->boolstep) { if(mfd->do_time && time(NULL)!=mytime) { mytime = time(NULL); mfd->string = ctime(&mytime); mfd->string[strlen(mfd->string)-1] = '\0'; font_render(width,height,size,codec,w,h,i,p,q,buf); } else if (mfd->tstamp) { elapsed_ss = ptr->id / vob->fps; hh = elapsed_ss / 3600; mm = (elapsed_ss - (3600 * hh)) / 60; ss = (elapsed_ss - (3600 * hh) - (60 * mm)); ss_frame = (ptr->id - (((hh * 3600) + (mm * 60) + ss) * vob->fps)); sprintf(mfd->string, "%02i:%02i:%02i.%02i", hh, mm, ss, ss_frame); font_render(width,height,size,codec,w,h,i,p,q,buf); } if (mfd->start == ptr->id && mfd->fade) { mfd->fade_in = 1; mfd->fade_out= 0; mfd->opaque = 0; mfd->start_fade_out = mfd->end - MAX_OPACITY/mfd->fade - 1; //if (mfd->start_fade_out < mfd->start) mfd->start_fade_out = mfd->start; } if (ptr->id == mfd->start_fade_out && mfd->fade) { mfd->fade_in = 0; mfd->fade_out = 1; } if (codec == CODEC_YUV) { char *U, *V; p = ptr->video_buf + mfd->posy*width + mfd->posx; q = buf + mfd->posy*width + mfd->posx; U = ptr->video_buf + mfd->posy/2*width/2 + mfd->posx/2 + ptr->v_width*ptr->v_height; V = U + ptr->v_width*ptr->v_height/4; for (h=0; hboundY; h++) { for (w=0; wboundX; w++) { unsigned int c = q[h*width+w]&0xff; unsigned int d = p[h*width+w]&0xff; unsigned int e = 0; // transparency if (mfd->transparent && (c <= 16)) continue; // opacity e = ((MAX_OPACITY-mfd->opaque)*d + mfd->opaque*c)/MAX_OPACITY; //e &= (mfd->Y&0xff); // write to image p[h*width+w] = e&0xff; U[h/2*width/2+w/2] = mfd->U&0xff; V[h/2*width/2+w/2] = mfd->V&0xff; } } } else if (codec == CODEC_RGB) { // FIXME p = ptr->video_buf + 3*(height-mfd->posy)*width + 3*mfd->posx; q = buf + 3*(height-mfd->posy)*width + 3*mfd->posx; //tc_memcpy(ptr->video_buf, buf, 3*width*height); for (h=0; h>-mfd->boundY; h--) { for (w=0; wboundX; w++) { for (i=0; i<3; i++) { unsigned int c = q[3*(h*width+w)-(2-i)]&0xff; unsigned int d = p[3*(h*width+w)-(2-i)]&0xff; unsigned int e; if (mfd->transparent && c <= 16) continue; // opacity e = ((MAX_OPACITY-mfd->opaque)*d + mfd->opaque*c)/MAX_OPACITY; switch (i){ case 0: e &= (mfd->G); break; case 1: e &= (mfd->R); break; case 2: e &= (mfd->B); break; } // write to image p[3*(h*width+w)-(2-i)] = e&0xff; } } } } if (mfd->fade && mfd->opaque>0 && mfd->fade_out) { mfd->opaque -= mfd->fade; if (mfd->opaque<0) mfd->opaque=0; } if (mfd->fade && mfd->opaquefade_in) { mfd->opaque += mfd->fade; if (mfd->opaque>MAX_OPACITY) mfd->opaque=MAX_OPACITY; } if (mfd->flip) { switch (codec) { case CODEC_RGB: rgb_flip(ptr->video_buf, ptr->v_width, ptr->v_height); break; case CODEC_YUV: yuv_flip(ptr->video_buf, ptr->v_width, ptr->v_height); break; case CODEC_YUV422: yuv422_flip(ptr->video_buf, ptr->v_width, ptr->v_height); break; default: printf("unsupported\n"); break; } } } } return(0); } #else int tc_filter(vframe_list_t *ptr, char *options) { fprintf(stderr, "[%s] Your freetype installation is missing header files\n"); return -1; } #endif // FT_FREETYPE_H transcode-1.0.0beta2/filter/filter_unsharp.c100644 001750 000000 00000027406 10157425235 0014570/* Copyright (C) 2002 Rmi Guyomarch This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define MOD_NAME "filter_unsharp.so" #define MOD_CAP "unsharp mask & gaussian blur" #define MOD_AUTHOR "Rmi Guyomarch" #define MOD_VERSION "v1.0.1 (2003-10-27)" #include #include #include #include #include #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "filter.h" #include "optstr.h" #ifndef SYS_BSD # ifdef HAVE_MALLOC_H # include # endif #endif #ifndef MIN #define MIN(a,b) (((a)<(b))?(a):(b)) #endif #ifndef MAX #define MAX(a,b) (((a)>(b))?(a):(b)) #endif //===========================================================================// #define MIN_MATRIX_SIZE 3 #define MAX_MATRIX_SIZE 63 typedef struct FilterParam { int msizeX, msizeY; double amount; uint32_t *SC[MAX_MATRIX_SIZE-1]; uint32_t *SC_unaligned[MAX_MATRIX_SIZE-1]; } FilterParam; typedef struct vf_priv_s { FilterParam lumaParam; FilterParam chromaParam; int pre; } MyFilterData; static void *bufalloc(size_t size) { #ifdef HAVE_GETPAGESIZE long buffer_align=getpagesize(); #else long buffer_align=16; #endif return malloc(size + buffer_align); } static void *bufalign(char *buf) { #ifdef HAVE_GETPAGESIZE long buffer_align=getpagesize(); #else long buffer_align=16; #endif long adjust; if (buf == NULL) { fprintf(stderr, "(%s) out of memory", __FILE__); } adjust = buffer_align - ((long) buf) % buffer_align; if (adjust == buffer_align) adjust = 0; return (void *) (buf + adjust); } //===========================================================================// /* This code is based on : An Efficient algorithm for Gaussian blur using finite-state machines Frederick M. Waltz and John W. V. Miller SPIE Conf. on Machine Vision Systems for Inspection and Metrology VII Originally published Boston, Nov 98 */ static void unsharp( uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int width, int height, FilterParam *fp ) { uint32_t **SC = fp->SC; uint32_t SR[MAX_MATRIX_SIZE-1], Tmp1, Tmp2; uint8_t* src2 = src; // avoid gcc warning int32_t res; int x, y, z; int amount = fp->amount * 65536.0; int stepsX = fp->msizeX/2; int stepsY = fp->msizeY/2; int scalebits = (stepsX+stepsY)*2; int32_t halfscale = 1 << ((stepsX+stepsY)*2-1); if( !fp->amount ) { if( src == dst ) return; if( dstStride == srcStride ) tc_memcpy( dst, src, srcStride*height ); else for( y=0; y=width ? src2[width-1] : src2[x]; for( z=0; z=stepsX && y>=stepsY ) { uint8_t* srx = src - stepsY*srcStride + x - stepsX; uint8_t* dsx = dst - stepsY*dstStride + x - stepsX; res = (int32_t)*srx + ( ( ( (int32_t)*srx - (int32_t)((Tmp1+halfscale) >> scalebits) ) * amount ) >> 16 ); *dsx = res>255 ? 255 : res<0 ? 0 : (uint8_t)res; } } if( y >= 0 ) { dst += dstStride; src += srcStride; } } } //===========================================================================// static void help_optstr() { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" This filter blurs or sharpens an image depending on\n"); printf (" the sign of \"amount\". You can either set amount for\n"); printf (" both luma and chroma or you can set it individually\n"); printf (" (recommended). A positive value for amount will sharpen\n"); printf (" the image, a negative value will blur it. A sane range\n"); printf (" for amount is -1.5 to 1.5.\n"); printf (" The matrix sizes must be odd and define the\n"); printf (" range/strength of the effect. Sensible ranges are 3x3\n"); printf (" to 7x7.\n"); printf (" It sometimes makes sense to sharpen the sharpen the\n"); printf (" luma and to blur the chroma. Sample string is:\n"); printf (" \n"); printf (" luma=0.8:luma_matrix=7x5:chroma=-0.2:chroma_matrix=3x3\n"); printf ("* Options\n"); printf (" amount : Luma and chroma (un)sharpness amount (%f)\n", 0.0); printf (" matrix : Luma and chroma search matrix size (%dx%d)\n", 0, 0); printf (" luma : Luma (un)sharpness amount (%02.2f)\n", 0.0); printf (" chroma : Chroma (un)sharpness amount (%02.2f)\n", 0.0); printf (" luma_matrix : Luma search matrix size (%dx%d)\n", 0, 0); printf (" chroma_matrix : Chroma search matrix size (%dx%d)\n", 0, 0); printf (" pre : run as a pre filter (0)\n"); printf ("\n"); } //===========================================================================// int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; static MyFilterData *mfd=NULL; static char *buffer; if(ptr->tag & TC_AUDIO) return 0; if(ptr->tag & TC_FILTER_GET_CONFIG) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VYO", "1"); optstr_param (options, "amount", "Luma and chroma (un)sharpness amount", "%f", "0.0", "-2.0", "2.0" ); optstr_param (options, "matrix", "Luma and chroma search matrix size", "%dx%d", "0x0", "3", "63", "3", "63"); optstr_param (options, "luma", "Luma (un)sharpness amount", "%f", "0.0", "-2.0", "2.0" ); optstr_param (options, "chroma", "Chroma (un)sharpness amount", "%f", "0.0", "-2.0", "2.0" ); optstr_param (options, "luma_matrix", "Luma search matrix size", "%dx%d", "0x0", "3", "63", "3", "63"); optstr_param (options, "chroma_matrix", "Chroma search matrix size", "%dx%d", "0x0", "3", "63", "3", "63"); optstr_param (options, "pre", "run as a pre filter", "%d", "0", "0", "1" ); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { int width, height; int z, stepsX, stepsY; FilterParam *fp; char *effect; double amount=0.0; int msizeX=0, msizeY=0; if((vob = tc_get_vob())==NULL) return(-1); if (vob->im_v_codec != CODEC_YUV) { fprintf(stderr, "[%s] This filter is only capable of YUV mode\n", MOD_NAME); return -1; } mfd = malloc( sizeof(MyFilterData) ); memset( mfd, 0, sizeof(MyFilterData) ); buffer = (char *)malloc(SIZE_RGB_FRAME); memset(buffer, 0, SIZE_RGB_FRAME); // GET OPTIONS if (options) { // l7x5:0.8:c3x3:-0.2 if (optstr_lookup (options, "help")) { help_optstr(); } optstr_get (options, "amount", "%lf", &amount); optstr_get (options, "matrix", "%dx%d", &msizeX, &msizeY); optstr_get (options, "luma", "%lf", &mfd->lumaParam.amount); optstr_get (options, "luma_matrix", "%dx%d", &mfd->lumaParam.msizeX, &mfd->lumaParam.msizeY); optstr_get (options, "chroma", "%lf", &mfd->chromaParam.amount); optstr_get (options, "chroma_matrix", "%dx%d", &mfd->chromaParam.msizeX, &mfd->chromaParam.msizeY); optstr_get (options, "pre", "%d", &mfd->pre); if (amount!=0.0 && msizeX && msizeY) { msizeX = 1 | MIN( MAX( msizeX, MIN_MATRIX_SIZE), MAX_MATRIX_SIZE ); msizeY = 1 | MIN( MAX( msizeY, MIN_MATRIX_SIZE), MAX_MATRIX_SIZE ); mfd->lumaParam.msizeX = msizeX; mfd->lumaParam.msizeY = msizeY; mfd->chromaParam.msizeX = msizeX; mfd->chromaParam.msizeY = msizeY; mfd->lumaParam.amount = mfd->chromaParam.amount = amount; } else { // min/max & odd mfd->lumaParam.msizeX = 1 | MIN( MAX( mfd->lumaParam.msizeX, MIN_MATRIX_SIZE ), MAX_MATRIX_SIZE ); mfd->lumaParam.msizeY = 1 | MIN( MAX( mfd->lumaParam.msizeY, MIN_MATRIX_SIZE ), MAX_MATRIX_SIZE ); mfd->chromaParam.msizeX = 1 | MIN( MAX( mfd->chromaParam.msizeX, MIN_MATRIX_SIZE ), MAX_MATRIX_SIZE ); mfd->chromaParam.msizeY = 1 | MIN( MAX( mfd->chromaParam.msizeY, MIN_MATRIX_SIZE ), MAX_MATRIX_SIZE ); } } if (mfd->pre) { width = vob->im_v_width; height = vob->im_v_height; } else { width = vob->ex_v_width; height = vob->ex_v_height; } // allocate buffers fp = &mfd->lumaParam; effect = fp->amount == 0 ? "don't touch" : fp->amount < 0 ? "blur" : "sharpen"; fprintf(stderr, "[%s] unsharp: %dx%d:%0.2f (%s luma)\n", MOD_NAME, fp->msizeX, fp->msizeY, fp->amount, effect ); memset( fp->SC, 0, sizeof( fp->SC ) ); stepsX = fp->msizeX/2; stepsY = fp->msizeY/2; for( z=0; z<2*stepsY; z++ ) { fp->SC_unaligned[z] = bufalloc(sizeof(*(fp->SC[z])) * (width+2*stepsX) ); fp->SC[z] = bufalign((char *)(fp->SC_unaligned[z])); } fp = &mfd->chromaParam; effect = fp->amount == 0 ? "don't touch" : fp->amount < 0 ? "blur" : "sharpen"; fprintf(stderr, "[%s] unsharp: %dx%d:%0.2f (%s chroma)\n", MOD_NAME, fp->msizeX, fp->msizeY, fp->amount, effect ); memset( fp->SC, 0, sizeof( fp->SC ) ); stepsX = fp->msizeX/2; stepsY = fp->msizeY/2; for( z=0; z<2*stepsY; z++ ) { fp->SC_unaligned[z] = bufalloc( sizeof(*(fp->SC[z])) * (width+2*stepsX) ); fp->SC[z] = bufalign((char *)(fp->SC_unaligned[z])); } if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return 0; } if (ptr->tag & TC_FILTER_CLOSE) { unsigned int z; FilterParam *fp; if( !mfd ) return -1; fp = &mfd->lumaParam; for( z=0; zSC)/sizeof(fp->SC[0]); z++ ) { if( fp->SC_unaligned[z] ) free( fp->SC_unaligned[z] ); fp->SC_unaligned[z] = NULL; fp->SC[z] = NULL; } fp = &mfd->chromaParam; for( z=0; zSC)/sizeof(fp->SC[0]); z++ ) { if( fp->SC_unaligned[z] ) free( fp->SC_unaligned[z] ); fp->SC_unaligned[z] = NULL; fp->SC[z] = NULL; } free( mfd ); mfd = NULL; return 0; } if( mfd && !mfd->lumaParam.msizeX && !mfd->chromaParam.msizeX ) { return 0; // nothing to do } if(((ptr->tag & TC_PRE_PROCESS && mfd->pre) || (ptr->tag & TC_POST_PROCESS && !mfd->pre)) && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { int off = ptr->v_width * ptr->v_height; int h2 = ptr->v_height>>1, w2 = ptr->v_width>>1; tc_memcpy (buffer, ptr->video_buf, ptr->video_size); unsharp( ptr->video_buf, buffer, ptr->v_width, ptr->v_width, ptr->v_width, ptr->v_height, &mfd->lumaParam ); unsharp( ptr->video_buf+off, buffer+off, w2, w2, w2, h2, &mfd->chromaParam ); unsharp( ptr->video_buf+5*off/4, buffer+5*off/4, w2, w2, w2, h2, &mfd->chromaParam ); return 0; } return 0; } // tc_filter transcode-1.0.0beta2/filter/filter_videocore.c100644 001750 000000 00000021203 10161261377 0015054/* * filter_videocore * * Copyright (C) Tilmann Bitterberg - June 2002 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_videocore.so" #define MOD_VERSION "v0.0.4 (2003-02-01)" #define MOD_CAP "Core video transformations" #define MOD_AUTHOR "Thomas, Tilmann" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "transcode.h" #include "framebuffer.h" #include "optstr.h" #include "filter.h" #include "src/video_trans.h" // basic parameter unsigned char gamma_table[256]; static int gamma_table_flag; typedef struct MyFilterData { int deinterlace; int flip; int mirror; int rgbswap; int decolor; float dgamma; int antialias; double aa_weight; double aa_bias; } MyFilterData; static MyFilterData *mfd = NULL; /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ #if 0 // unused, EMS static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); } #endif int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob=NULL; //---------------------------------- // // filter init // //---------------------------------- if (ptr->tag & TC_AUDIO) { return 0; } if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); if((mfd = (MyFilterData *)malloc (sizeof(MyFilterData))) == NULL) return (-1); memset (mfd, 0, sizeof(MyFilterData)); mfd->deinterlace = 0; mfd->flip = 0; mfd->mirror = 0; mfd->rgbswap = 0; mfd->decolor = 0; mfd->dgamma = 0.0; mfd->antialias = 0; mfd->aa_weight = TC_DEFAULT_AAWEIGHT; mfd->aa_bias = TC_DEFAULT_AABIAS; if (options != NULL) { optstr_get (options, "deinterlace", "%d", &mfd->deinterlace); if (optstr_get (options, "flip", "") >= 0) mfd->flip = !mfd->flip; if (optstr_get (options, "mirror", "") >= 0) mfd->mirror = !mfd->mirror; if (optstr_get (options, "rgbswap", "") >= 0) mfd->rgbswap = !mfd->rgbswap; if (optstr_get (options, "decolor", "") >= 0) mfd->decolor = !mfd->decolor; optstr_get (options, "dgamma", "%f", &mfd->dgamma); optstr_get (options, "antialias", "%d/%f/%f", &mfd->antialias, &mfd->aa_weight, &mfd->aa_bias); if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); } // filter init ok. if (verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return(0); } //---------------------------------- // // filter get config // //---------------------------------- if(ptr->tag & TC_FILTER_GET_CONFIG && options) { char buf[255]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYE", "1"); snprintf (buf, sizeof(buf), "%d", mfd->deinterlace); optstr_param (options, "deinterlace", "same as -I", "%d", buf, "0", "5"); snprintf (buf, sizeof(buf), "%d", mfd->flip); optstr_param (options, "flip", "same as -z", "", buf); snprintf (buf, sizeof(buf), "%d", mfd->mirror); optstr_param (options, "mirror", "same as -l", "", buf); snprintf (buf, sizeof(buf), "%d", mfd->rgbswap); optstr_param (options, "rgbswap", "same as -k", "", buf); snprintf (buf, sizeof(buf), "%d", mfd->decolor); optstr_param (options, "decolor", "same as -K", "", buf); snprintf (buf, sizeof(buf), "%f", mfd->dgamma); optstr_param (options, "dgamma", "same as -G", "%f", buf, "0.0", "3.0"); snprintf (buf, sizeof(buf), "%d/%.2f/%.2f", mfd->antialias, mfd->aa_weight, mfd->aa_bias); optstr_param (options, "antialias", "same as -C/weight/bias", "%d/%f/%f", buf, "0", "3", "0.0", "1.0", "0.0", "1.0"); return 0; } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { if (mfd) free(mfd); mfd = NULL; return(0); } /* filter close */ //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if((ptr->tag & TC_PRE_PROCESS) && (vob->im_v_codec == CODEC_YUV) && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { if (mfd->deinterlace) { switch (mfd->deinterlace) { case 1: yuv_deinterlace_linear(ptr->video_buf, ptr->v_width, ptr->v_height); break; case 2: //handled by encoder break; case 3: deinterlace_yuv_zoom(ptr->video_buf, ptr->v_width, ptr->v_height); break; case 4: deinterlace_yuv_nozoom(ptr->video_buf, ptr->v_width, ptr->v_height); break; case 5: yuv_deinterlace_linear_blend(ptr->video_buf, ptr->video_buf_Y[ptr->free], ptr->v_width, ptr->v_height); break; } } if (mfd->flip) { yuv_flip(ptr->video_buf, ptr->v_width, ptr->v_height); } if (mfd->mirror) { yuv_mirror(ptr->video_buf, ptr->v_width, ptr->v_height); } if (mfd->rgbswap) { yuv_swap(ptr->video_buf, ptr->v_width, ptr->v_height); } if (mfd->dgamma > 0.0) { if(!gamma_table_flag) { init_gamma_table(gamma_table, mfd->dgamma); gamma_table_flag = 1; } yuv_gamma(ptr->video_buf, ptr->v_width * ptr->v_height); } if (mfd->decolor) { yuv_decolor(ptr->video_buf, ptr->v_width * ptr->v_height); } if (mfd->antialias) { init_aa_table(vob->aa_weight, vob->aa_bias); //UV components unchanged tc_memcpy(ptr->video_buf_Y[ptr->free]+ptr->v_width*ptr->v_height, ptr->video_buf + ptr->v_width*ptr->v_height, ptr->v_width*ptr->v_height/2); yuv_antialias(ptr->video_buf, ptr->video_buf_Y[ptr->free], ptr->v_width, ptr->v_height, mfd->antialias); // adjust pointer, zoomed frame in tmp buffer ptr->video_buf = ptr->video_buf_Y[ptr->free]; ptr->free = (ptr->free) ? 0:1; // no update for frame_list_t *ptr required } } else if((ptr->tag & TC_PRE_PROCESS) && (vob->im_v_codec == CODEC_RGB)) { if (mfd->deinterlace) { switch (mfd->deinterlace) { case 1: rgb_deinterlace_linear(ptr->video_buf, ptr->v_width, ptr->v_height); break; case 2: //handled by encoder break; case 3: deinterlace_rgb_zoom(ptr->video_buf, ptr->v_width, ptr->v_height); break; case 4: deinterlace_rgb_nozoom(ptr->video_buf, ptr->v_width, ptr->v_height); break; case 5: rgb_deinterlace_linear_blend(ptr->video_buf, ptr->video_buf_RGB[ptr->free], ptr->v_width, ptr->v_height); break; } } if (mfd->flip) { rgb_flip(ptr->video_buf, ptr->v_width, ptr->v_height); } if (mfd->mirror) { rgb_mirror(ptr->video_buf, ptr->v_width, ptr->v_height); } if (mfd->rgbswap) { rgb_swap(ptr->video_buf, ptr->v_width * ptr->v_height); } if (mfd->dgamma > 0.0) { if(!gamma_table_flag) { init_gamma_table(gamma_table, mfd->dgamma); gamma_table_flag = 1; } rgb_gamma(ptr->video_buf, ptr->v_width * ptr->v_height * ptr->v_bpp>>3); } if (mfd->decolor) { rgb_decolor(ptr->video_buf, ptr->v_width * ptr->v_height * ptr->v_bpp>>3); } if (mfd->antialias) { init_aa_table(vob->aa_weight, vob->aa_bias); rgb_antialias(ptr->video_buf, ptr->video_buf_RGB[ptr->free], ptr->v_width, ptr->v_height, vob->antialias); // adjust pointer, zoomed frame in tmp buffer ptr->video_buf = ptr->video_buf_RGB[ptr->free]; ptr->free = (ptr->free) ? 0:1; } } return(0); } transcode-1.0.0beta2/filter/filter_whitebalance.c100644 001750 000000 00000012167 10134622237 0015530/* filter_whitebalance.c This file is part of transcode, a linux video stream processing tool White Balance Filter - correct images with a broken white balance (typically, images from a dv camcorder with an unset white balance or wrongly forced to indoor or outdoor) Copyright (C) 2003 Guillaume Cottenceau This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define MOD_NAME "filter_whitebalance.so" #define MOD_VERSION "v0.1 (2003-10-01)" #define MOD_CAP "White Balance Filter - correct images with a broken white balance" #define MOD_AUTHOR "Guillaume Cottenceau" #include #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" #include "export/vid_aux.h" static unsigned char * buffer = NULL; static int level = 40; static char limit[PATH_MAX]; static double factor; static int state = 1; static int next_switchoff = -1; static int next_switchon = -1; static void update_switches(void) { static char * ptr = limit; int next = 0; if (!ptr) return; ptr = strchr(ptr, state ? '-' : '+'); if (ptr) { ptr++; while (*ptr && isdigit(*ptr)) { next = (next * 10) + (*ptr - '0'); ptr++; } } else { next = -1; ptr = NULL; return; } if (state) next_switchoff = next; else next_switchon = next; } int tc_filter(vframe_list_t *ptr, char *options) { static vob_t *vob = NULL; static unsigned char red_filter[256]; static unsigned char blue_filter[256]; if (ptr->tag & TC_FILTER_GET_CONFIG) { char buf[32]; optstr_filter_desc(options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYE", "1"); snprintf(buf, 32, "%d", level); optstr_param(options, "level", "Level of blue-to-yellow white balance shifting (can be negative)", "%d", buf, "-1000", "+1000"); optstr_param(options, "limit", "Limit to specified ranges (+fnumber toggles on, -fnumber toggles off)", "%s", ""); return 0; } if (ptr->tag & TC_FILTER_INIT) { unsigned int width, height; int i; if (verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); if (!(vob = tc_get_vob())) { fprintf(stderr, "[%s] ERROR: Could not get vob\n", MOD_NAME); return -1; } width = vob->im_v_width; height = vob->im_v_height; if (options != NULL) { if (verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get(options, "level", "%d", &level); memset(limit, 0, PATH_MAX); optstr_get(options, "limit", "%[^:]", &limit); } if (verbose) printf("[%s] options set to: level=%d limit=%s\n", MOD_NAME, level, limit); factor = 1 + ((double)abs(level))/100; if (level < 0) factor = 1/factor; /* preprocess filters for performance */ for (i=0; i<=255; i++) { red_filter[i] = pow(((double) i)/255, 1/factor) * 255; blue_filter[i] = pow(((double) i)/255, factor) * 255; } update_switches(); if (vob->im_v_codec == CODEC_YUV) { if (verbose) printf("[%s] will need to convert YUV to RGB before filtering\n", MOD_NAME); tc_rgb2yuv_init(width, height); tc_yuv2rgb_init(width, height); } if (!buffer) buffer = malloc(SIZE_RGB_FRAME); if (!buffer) { fprintf(stderr, "[%s] ERROR: Could not malloc %d bytes\n", MOD_NAME, SIZE_RGB_FRAME); return -1; } return 0; } if (ptr->tag & TC_FILTER_CLOSE) { if (buffer) free(buffer); buffer = NULL; if (vob->im_v_codec == CODEC_YUV) { tc_rgb2yuv_close(); tc_yuv2rgb_close(); } return 0; } if (ptr->tag & TC_PRE_M_PROCESS && ptr->tag & TC_VIDEO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { int x, y; if (!state && ptr->id == next_switchon) { state = 1; update_switches(); } else if (state && ptr->id == next_switchoff) { state = 0; update_switches(); } if (state) { if (vob->im_v_codec == CODEC_YUV) tc_yuv2rgb_core(ptr->video_buf); tc_memcpy(buffer, ptr->video_buf, ptr->v_width*ptr->v_height*3); for (y = 0; y < vob->im_v_height; y++) { unsigned char * line = &buffer[y * (vob->im_v_width * 3)]; for (x = 0; x < vob->im_v_width*3; x += 3) { /* we modify red and blue curves to enhance/reduce mostly mediums */ line[x] = red_filter[line[x]]; line[x+2] = blue_filter[line[x+2]]; } } tc_memcpy(ptr->video_buf, buffer, ptr->v_width*ptr->v_height*3); if (vob->im_v_codec == CODEC_YUV) tc_rgb2yuv_core(ptr->video_buf); } } return 0; } transcode-1.0.0beta2/filter/filter_xsharpen.c100644 001750 000000 00000036321 10161261377 0014734/* filter_xsharpen.c Copyright (C) 1999-2000 Donald A. Graft modified 2002 by Tilmann Bitterberg for use with transcode This file is part of transcode, a linux video stream processing tool Xsharpen Filter for VirtualDub -- sharpen by mapping pixels to the closest of window max or min. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author can be contacted at: Donald Graft http://sauron.mordor.net/dgraft/ neuron2@home.com. */ #define MOD_NAME "filter_xharpen.so" #define MOD_VERSION "(1.0b2) (2003-02-12)" #define MOD_CAP "VirtualDub's XSharpen Filter" #define MOD_AUTHOR "Donald Graft, Tilmann Bitterberg" #include #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "transcode.h" #include "framebuffer.h" #include "optstr.h" static vob_t *vob=NULL; /* vdub compat */ typedef unsigned int Pixel; typedef unsigned int Pixel32; typedef unsigned char Pixel8; typedef int PixCoord; typedef int PixDim; typedef int PixOffset; #define R_MASK (0x00ff0000) #define G_MASK (0x0000ff00) #define B_MASK (0x000000ff) #define R_SHIFT (16) #define G_SHIFT (8) #define B_SHIFT (0) /* convert transcode RGB (3*8 Bit) to vdub ARGB (32Bit) */ void convert_rgb2argb (char * in, Pixel32 *out, int width, int height) { int run; int size = width*height; for (run = 0; run < size; run++) { *out = (((((Pixel32) *(in+0)) & 0xff) << R_SHIFT) | ((((Pixel32) *(in+1)) & 0xff) << G_SHIFT) | ((((Pixel32) *(in+2)) & 0xff))) & 0x00ffffff; out++; in += 3; } } /* convert vdub ARGB (32Bit) to transcode RGB (3*8 Bit) */ void convert_argb2rgb (Pixel32 *in, char * out, int width, int height) { int run; int size = width*height; for (run = 0; run < size; run++) { *(out+0) = ((*in & R_MASK) >> R_SHIFT); *(out+1) = ((*in & G_MASK) >> G_SHIFT); *(out+2) = (*in) & B_MASK; in++; out += 3; } } /////////////////////////////////////////////////////////////////////////// typedef struct MyFilterData { Pixel32 *convertFrameIn; Pixel32 *convertFrameOut; int strength; int strengthInv; int threshold; int srcPitch; int dstPitch; } MyFilterData; static MyFilterData *mfd; static void help_optstr(void) { printf ("[%s] (%s) help\n", MOD_NAME, MOD_CAP); printf ("* Overview\n"); printf (" This filter performs a subtle but useful sharpening effect. The\n"); printf (" result is a sharpening effect that not only avoids amplifying\n"); printf (" noise, but also tends to reduce it. A welcome side effect is that\n"); printf (" files processed with this filter tend to compress to smaller files.\n"); printf ("* Options\n"); printf (" * Strength 'strength' (0-255) [200]\n"); printf (" When this value is 255, mapped pixels are not blended with the\n"); printf (" original pixel values, so a full-strength effect is\n"); printf (" obtained. As the value is reduced, each mapped pixel is\n"); printf (" blended with more of the original pixel. At a value of 0,\n"); printf (" the original pixels are passed through and there is no sharpening\n"); printf (" effect.\n"); printf (" * Threshold 'threshold' (0-255) [255]\n"); printf (" This value determines how close a pixel must be to the brightest or\n"); printf (" dimmest pixel to be mapped. If a pixel is more than threshold away\n"); printf (" from the brightest or dimmest pixel, it is not mapped. Thus, as\n"); printf (" the threshold is reduced, pixels in the mid range start to be\n"); printf (" spared.\n"); } int tc_filter(vframe_list_t *ptr, char *options) { //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { int width, height; if((vob = tc_get_vob())==NULL) return(-1); mfd = (MyFilterData *) malloc(sizeof(MyFilterData)); if (!mfd) { fprintf(stderr, "[%s] No memory at %d!\n", MOD_NAME, __LINE__); return (-1); } height = vob->ex_v_height; width = vob->ex_v_width; /* default values */ mfd->strength = 200; /* 255 is too much */ mfd->strengthInv = 255 - mfd->strength; mfd->threshold = 255; mfd->srcPitch = 0; mfd->dstPitch = 0; if (options != NULL) { if(verbose) printf("[%s] options=%s\n", MOD_NAME, options); optstr_get (options, "strength", "%d", &mfd->strength); optstr_get (options, "threshold", "%d", &mfd->threshold); } mfd->strengthInv = 255 - mfd->strength; if (verbose > 1) { printf (" XSharpen Filter Settings (%dx%d):\n", width,height); printf (" strength = %d\n", mfd->strength); printf (" threshold = %d\n", mfd->threshold); } if (options) if ( optstr_get(options, "help", "") >= 0) { help_optstr(); } /* fetch memory */ mfd->convertFrameIn = (Pixel32 *) malloc (width*height*sizeof(Pixel32)); if (!mfd->convertFrameIn) { fprintf(stderr, "[%s] No memory at %d!\n", MOD_NAME, __LINE__); return (-1); } memset(mfd->convertFrameIn, 0, width*height*sizeof(Pixel32)); mfd->convertFrameOut = (Pixel32 *) malloc (width*height*sizeof(Pixel32)); if (!mfd->convertFrameOut) { fprintf(stderr, "[%s] No memory at %d!\n", MOD_NAME, __LINE__); return (-1); } memset(mfd->convertFrameOut, 0, width*height*sizeof(Pixel32)); // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return 0; } /* TC_FILTER_INIT */ if(ptr->tag & TC_FILTER_GET_CONFIG) { if (options) { char buf[256]; optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, MOD_AUTHOR, "VRYO", "1"); snprintf (buf, sizeof(buf), "%d", mfd->strength); optstr_param (options, "strength", "How much of the effect", "%d", buf, "0", "255"); snprintf (buf, sizeof(buf), "%d", mfd->threshold); optstr_param (options, "threshold", "How close a pixel must be to the brightest or dimmest pixel to be mapped", "%d", buf, "0", "255"); } } if(ptr->tag & TC_FILTER_CLOSE) { if (mfd->convertFrameIn) free (mfd->convertFrameIn); mfd->convertFrameIn = NULL; if (mfd->convertFrameOut) free (mfd->convertFrameOut); mfd->convertFrameOut = NULL; if (mfd) free(mfd); mfd = NULL; return 0; } /* TC_FILTER_CLOSE */ /////////////////////////////////////////////////////////////////////////// if(ptr->tag & TC_POST_PROCESS && ptr->tag & TC_VIDEO && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { if (vob->im_v_codec == CODEC_RGB) { const PixDim width = ptr->v_width; const PixDim height = ptr->v_height; Pixel32 *src, *dst; int x, y; int r, g, b, R, G, B; Pixel32 p, min=1000, max=-1; int luma, lumac, lumamax, lumamin, mindiff, maxdiff; const int srcpitch = ptr->v_width*sizeof(Pixel32); const int dstpitch = ptr->v_width*sizeof(Pixel32); Pixel32 * dst_buf; Pixel32 * src_buf; convert_rgb2argb (ptr->video_buf, mfd->convertFrameIn, ptr->v_width, ptr->v_height); src_buf = mfd->convertFrameIn; dst_buf = mfd->convertFrameOut; /* First copy through the four border lines. */ src = src_buf; dst = dst_buf; for (x = 0; x < width; x++) { dst[x] = src[x]; } src = (Pixel *)((char *)src_buf + (height - 1) * srcpitch); dst = (Pixel *)((char *)dst_buf + (height - 1) * dstpitch); for (x = 0; x < width; x++) { dst[x] = src[x]; } src = src_buf; dst = dst_buf; for (y = 0; y < height; y++) { dst[0] = src[0]; dst[width-1] = src[width-1]; src = (Pixel *)((char *)src + srcpitch); dst = (Pixel *)((char *)dst + dstpitch); } /* Now calculate and store the pixel luminances for the remaining pixels. */ src = src_buf; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { r = (src[x] >> 16) & 0xff; g = (src[x] >> 8) & 0xff; b = src[x] & 0xff; luma = (55 * r + 182 * g + 19 * b) >> 8; src[x] &= 0x00ffffff; src[x] |= (luma << 24); } src = (Pixel *)((char *)src + srcpitch); } /* Finally run the 3x3 rank-order sharpening kernel over the pixels. */ src = (Pixel *)((char *)src_buf + srcpitch); dst = (Pixel *)((char *)dst_buf + dstpitch); for (y = 1; y < height - 1; y++) { for (x = 1; x < width - 1; x++) { /* Find the brightest and dimmest pixels in the 3x3 window surrounding the current pixel. */ lumamax = -1; lumamin = 1000; p = ((Pixel32 *)((char *)src - srcpitch))[x-1]; luma = p >> 24; if (luma > lumamax) { lumamax = luma; max = p; } if (luma < lumamin) { lumamin = luma; min = p; } p = ((Pixel32 *)((char *)src - srcpitch))[x]; luma = p >> 24; if (luma > lumamax) { lumamax = luma; max = p; } if (luma < lumamin) { lumamin = luma; min = p; } p = ((Pixel32 *)((char *)src - srcpitch))[x+1]; luma = p >> 24; if (luma > lumamax) { lumamax = luma; max = p; } if (luma < lumamin) { lumamin = luma; min = p; } p = src[x-1]; luma = p >> 24; if (luma > lumamax) { lumamax = luma; max = p; } if (luma < lumamin) { lumamin = luma; min = p; } p = src[x]; lumac = luma = p >> 24; if (luma > lumamax) { lumamax = luma; max = p; } if (luma < lumamin) { lumamin = luma; min = p; } p = src[x+1]; luma = p >> 24; if (luma > lumamax) { lumamax = luma; max = p; } if (luma < lumamin) { lumamin = luma; min = p; } p = ((Pixel32 *)((char *)src + srcpitch))[x-1]; luma = p >> 24; if (luma > lumamax) { lumamax = luma; max = p; } if (luma < lumamin) { lumamin = luma; min = p; } p = ((Pixel32 *)((char *)src + srcpitch))[x]; luma = p >> 24; if (luma > lumamax) { lumamax = luma; max = p; } if (luma < lumamin) { lumamin = luma; min = p; } p = ((Pixel32 *)((char *)src + srcpitch))[x+1]; luma = p >> 24; if (luma > lumamax) { lumamax = luma; max = p; } if (luma < lumamin) { lumamin = luma; min = p; } /* Determine whether the current pixel is closer to the brightest or the dimmest pixel. Then compare the current pixel to that closest pixel. If the difference is within threshold, map the current pixel to the closest pixel; otherwise pass it through. */ p = -1; if (mfd->strength != 0) { mindiff = lumac - lumamin; maxdiff = lumamax - lumac; if (mindiff > maxdiff) { if (maxdiff < mfd->threshold) { p = max; } } else { if (mindiff < mfd->threshold) { p = min; } } } if (p == -1) { dst[x] = src[x]; } else { R = (src[x] >> 16) & 0xff; G = (src[x] >> 8) & 0xff; B = src[x] & 0xff; r = (p >> 16) & 0xff; g = (p >> 8) & 0xff; b = p & 0xff; r = (mfd->strength * r + mfd->strengthInv * R) / 255; g = (mfd->strength * g + mfd->strengthInv * G) / 255; b = (mfd->strength * b + mfd->strengthInv * B) / 255; dst[x] = (r << 16) | (g << 8) | b; } } src = (Pixel *)((char *)src + srcpitch); dst = (Pixel *)((char *)dst + dstpitch); } convert_argb2rgb (mfd->convertFrameOut, ptr->video_buf, ptr->v_width, ptr->v_height); return 0; } if (vob->im_v_codec == CODEC_YUV) { const PixDim width = ptr->v_width; const PixDim height = ptr->v_height; char *src, *dst; int x, y; int luma, lumac, lumamax, lumamin; int p, mindiff, maxdiff; const int srcpitch = ptr->v_width; const int dstpitch = ptr->v_width; char * src_buf = ptr->video_buf; static char * dst_buf = NULL; if (!dst_buf) dst_buf = (char *) malloc (width*height*3/2); /* First copy through the four border lines. */ /* first */ src = src_buf; dst = dst_buf; tc_memcpy (dst, src, width); /* last */ src = src_buf+srcpitch*(height-1); dst = dst_buf+dstpitch*(height-1); tc_memcpy (dst, src, width); /* copy Cb and Cr */ tc_memcpy (dst_buf+dstpitch*height, src_buf+srcpitch*height, width*height>>1); src = src_buf; dst = dst_buf; for (y = 0; y < height; y++) { *dst = *src; *(dst+width-1) = *(src+width-1); dst += dstpitch; src += srcpitch; } src = src_buf+srcpitch; dst = dst_buf+dstpitch; /* Finally run the 3x3 rank-order sharpening kernel over the pixels. */ for (y = 1; y < height - 1; y++) { for (x = 1; x < width - 1; x++) { /* Find the brightest and dimmest pixels in the 3x3 window surrounding the current pixel. */ lumamax = -1000; lumamin = 1000; luma = (src - srcpitch)[x-1] &0xff; if (luma > lumamax) lumamax = luma; if (luma < lumamin) lumamin = luma; luma = (src - srcpitch)[x] &0xff; if (luma > lumamax) lumamax = luma; if (luma < lumamin) lumamin = luma; luma = (src - srcpitch)[x+1] &0xff; if (luma > lumamax) lumamax = luma; if (luma < lumamin) lumamin = luma; luma = src[x-1] &0xff; if (luma > lumamax) lumamax = luma; if (luma < lumamin) lumamin = luma; luma = src[x] &0xff; lumac = luma; if (luma > lumamax) lumamax = luma; if (luma < lumamin) lumamin = luma; luma = src[x+1] &0xff; if (luma > lumamax) lumamax = luma; if (luma < lumamin) lumamin = luma; luma = (src + srcpitch)[x-1] &0xff; if (luma > lumamax) lumamax = luma; if (luma < lumamin) lumamin = luma; luma = (src + srcpitch)[x] &0xff; if (luma > lumamax) lumamax = luma; if (luma < lumamin) lumamin = luma; luma = (src + srcpitch)[x+1] &0xff; if (luma > lumamax) lumamax = luma; if (luma < lumamin) lumamin = luma; /* Determine whether the current pixel is closer to the brightest or the dimmest pixel. Then compare the current pixel to that closest pixel. If the difference is within threshold, map the current pixel to the closest pixel; otherwise pass it through. */ p = -1; if (mfd->strength != 0) { mindiff = lumac - lumamin; maxdiff = lumamax - lumac; if (mindiff > maxdiff) { if (maxdiff < mfd->threshold) p = lumamax&0xff; } else { if (mindiff < mfd->threshold) p = lumamin&0xff; } } if (p == -1) { dst[x] = src[x]; } else { int t; lumac = src[x] &0xff; t = ((mfd->strength*p + mfd->strengthInv*lumac)/255) & 0xff; if (t>240) t = 240; if (t<16) t = 16; dst[x] = t&0xff; } } src += srcpitch; dst += dstpitch; } tc_memcpy (ptr->video_buf, dst_buf, width*height*3/2); return 0; } } return 0; } transcode-1.0.0beta2/filter/filter_yuy2toyv12.c100644 001750 000000 00000007246 10134572655 0015111/* * filter_yuy2tov12.c * * Copyright (C) Thomas streich - June 2001 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_yuy2tov12.so" #define MOD_VERSION "v0.0.2 (2003-09-04)" #define MOD_CAP "YUY2 to YV12 converter plugin" #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include "transcode.h" #include "framebuffer.h" #include "optstr.h" void yuy2toyv12(char *dest, char *input, int width, int height) { int i,j,w2; char *y, *u, *v; w2 = width/2; //I420 y = dest; v = dest+width*height; u = dest+width*height*5/4; for (i=0; itag & TC_FILTER_GET_CONFIG && options) { optstr_filter_desc (options, MOD_NAME, MOD_CAP, MOD_VERSION, "Thomas Oestreich", "VYE", "1"); return 0; } //---------------------------------- // // filter init // //---------------------------------- if(ptr->tag & TC_FILTER_INIT) { if((vob = tc_get_vob())==NULL) return(-1); if((video_buffer = (char *)calloc(1, SIZE_RGB_FRAME))==NULL) { fprintf(stderr, "(%s) out of memory", __FILE__); return(-1); } // filter init ok. if(verbose) printf("[%s] %s %s\n", MOD_NAME, MOD_VERSION, MOD_CAP); return(0); } //---------------------------------- // // filter close // //---------------------------------- if(ptr->tag & TC_FILTER_CLOSE) { free(video_buffer); return(0); } //---------------------------------- // // filter frame routine // //---------------------------------- // tag variable indicates, if we are called before // transcodes internal video/audo frame processing routines // or after and determines video/audio context if((ptr->tag & TC_PRE_PROCESS) && (ptr->tag & TC_VIDEO) && vob->im_v_codec==CODEC_YUV && !(ptr->attributes & TC_FRAME_IS_SKIPPED)) { bytes = ptr->v_width * ptr->v_height * 3/2; yuy2toyv12(video_buffer, ptr->video_buf, ptr->v_width, ptr->v_height); tc_memcpy(ptr->video_buf, video_buffer, bytes); } return(0); } transcode-1.0.0beta2/filter/pp/Makefile.am100644 001750 000000 00000000767 10160205523 0014041# # Process this file with automake to produce Makefile.in. AM_CPPFLAGS = \ $(PTHREAD_CFLAGS) \ -I$(top_srcdir) \ -I$(top_srcdir)/filter \ -I$(top_srcdir)/src \ $(LIBVO_CFLAGS) if HAVE_GCC if HAVE_FOMIT_FP AM_CFLAGS = -fomit-frame-pointer endif endif pkgdir = $(MOD_PATH) pkg_LTLIBRARIES = filter_pp.la filter_pp_la_SOURCES = filter_pp.c postprocess.c filter_pp_la_LDFLAGS = -module -avoid-version EXTRA_DIST = \ postprocess.h \ postprocess_internal.h \ postprocess_template.c \ mangle.h transcode-1.0.0beta2/filter/pp/Makefile.in100644 001750 000000 00000052730 10203520426 0014047# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # Process this file with automake to produce Makefile.in. SOURCES = $(filter_pp_la_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = filter/pp DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(pkgdir)" pkgLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(pkg_LTLIBRARIES) filter_pp_la_LIBADD = am_filter_pp_la_OBJECTS = filter_pp.lo postprocess.lo filter_pp_la_OBJECTS = $(am_filter_pp_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/autotools/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/filter_pp.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/postprocess.Plo COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(filter_pp_la_SOURCES) DIST_SOURCES = $(filter_pp_la_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A52_CFLAGS = @A52_CFLAGS@ A52_LIBS = @A52_LIBS@ AC3_CFLAGS = @AC3_CFLAGS@ AC3_LIBS = @AC3_LIBS@ ACLIB_CFLAGS = @ACLIB_CFLAGS@ ACLIB_LIBS = @ACLIB_LIBS@ ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ ALTIVEC_CFLAGS = @ALTIVEC_CFLAGS@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AR = @AR@ ARCH_PPC_FALSE = @ARCH_PPC_FALSE@ ARCH_PPC_TRUE = @ARCH_PPC_TRUE@ ARCH_X86_64_FALSE = @ARCH_X86_64_FALSE@ ARCH_X86_64_TRUE = @ARCH_X86_64_TRUE@ ARCH_X86_FALSE = @ARCH_X86_FALSE@ ARCH_X86_TRUE = @ARCH_X86_TRUE@ ASFLAGS = @ASFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AVIFILE_CFLAGS = @AVIFILE_CFLAGS@ AVIFILE_LIBS = @AVIFILE_LIBS@ AVILIB_CFLAGS = @AVILIB_CFLAGS@ AVILIB_LIBS = @AVILIB_LIBS@ AWK = @AWK@ CAN_COMPILE_C_ALTIVEC_FALSE = @CAN_COMPILE_C_ALTIVEC_FALSE@ CAN_COMPILE_C_ALTIVEC_TRUE = @CAN_COMPILE_C_ALTIVEC_TRUE@ CC = @CC@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLDARWININCL = @DLDARWININCL@ DLDARWINLIB = @DLDARWINLIB@ DLDARWINOBJECTS = @DLDARWINOBJECTS@ ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ FFMPEG_LIBS_BUILD = @FFMPEG_LIBS_BUILD@ FFMPEG_LIBS_CFLAGS = @FFMPEG_LIBS_CFLAGS@ FFMPEG_LIBS_LIBS = @FFMPEG_LIBS_LIBS@ FFMPEG_LIBS_VERSION = @FFMPEG_LIBS_VERSION@ FT2_CFLAGS = @FT2_CFLAGS@ FT2_CONFIG = @FT2_CONFIG@ FT2_LIBS = @FT2_LIBS@ GTK_CFLAGS = @GTK_CFLAGS@ GTK_LIBS = @GTK_LIBS@ HAVE_3DNOW_FALSE = @HAVE_3DNOW_FALSE@ HAVE_3DNOW_TRUE = @HAVE_3DNOW_TRUE@ HAVE_A52_FALSE = @HAVE_A52_FALSE@ HAVE_A52_TRUE = @HAVE_A52_TRUE@ HAVE_AVIFILE_FALSE = @HAVE_AVIFILE_FALSE@ HAVE_AVIFILE_TRUE = @HAVE_AVIFILE_TRUE@ HAVE_BKTR_FALSE = @HAVE_BKTR_FALSE@ HAVE_BKTR_TRUE = @HAVE_BKTR_TRUE@ HAVE_DIVX_DECORE_FALSE = @HAVE_DIVX_DECORE_FALSE@ HAVE_DIVX_DECORE_TRUE = @HAVE_DIVX_DECORE_TRUE@ HAVE_DIVX_ENCORE2_FALSE = @HAVE_DIVX_ENCORE2_FALSE@ HAVE_DIVX_ENCORE2_TRUE = @HAVE_DIVX_ENCORE2_TRUE@ HAVE_FFMPEG_FALSE = @HAVE_FFMPEG_FALSE@ HAVE_FFMPEG_TRUE = @HAVE_FFMPEG_TRUE@ HAVE_FOMIT_FP_FALSE = @HAVE_FOMIT_FP_FALSE@ HAVE_FOMIT_FP_TRUE = @HAVE_FOMIT_FP_TRUE@ HAVE_FREETYPE2_FALSE = @HAVE_FREETYPE2_FALSE@ HAVE_FREETYPE2_TRUE = @HAVE_FREETYPE2_TRUE@ HAVE_GCC2_FALSE = @HAVE_GCC2_FALSE@ HAVE_GCC2_TRUE = @HAVE_GCC2_TRUE@ HAVE_GCC_FALSE = @HAVE_GCC_FALSE@ HAVE_GCC_TRUE = @HAVE_GCC_TRUE@ HAVE_GTK_FALSE = @HAVE_GTK_FALSE@ HAVE_GTK_TRUE = @HAVE_GTK_TRUE@ HAVE_IBP_FALSE = @HAVE_IBP_FALSE@ HAVE_IBP_TRUE = @HAVE_IBP_TRUE@ HAVE_IMAGEMAGICK_FALSE = @HAVE_IMAGEMAGICK_FALSE@ HAVE_IMAGEMAGICK_TRUE = @HAVE_IMAGEMAGICK_TRUE@ HAVE_LAME_FALSE = @HAVE_LAME_FALSE@ HAVE_LAME_TRUE = @HAVE_LAME_TRUE@ HAVE_LIBDVDREAD_FALSE = @HAVE_LIBDVDREAD_FALSE@ HAVE_LIBDVDREAD_TRUE = @HAVE_LIBDVDREAD_TRUE@ HAVE_LIBDV_FALSE = @HAVE_LIBDV_FALSE@ HAVE_LIBDV_TRUE = @HAVE_LIBDV_TRUE@ HAVE_LIBFAME_FALSE = @HAVE_LIBFAME_FALSE@ HAVE_LIBFAME_TRUE = @HAVE_LIBFAME_TRUE@ HAVE_LIBICONV_FALSE = @HAVE_LIBICONV_FALSE@ HAVE_LIBICONV_TRUE = @HAVE_LIBICONV_TRUE@ HAVE_LIBJPEG_FALSE = @HAVE_LIBJPEG_FALSE@ HAVE_LIBJPEG_TRUE = @HAVE_LIBJPEG_TRUE@ HAVE_LIBLVE_FALSE = @HAVE_LIBLVE_FALSE@ HAVE_LIBLVE_TRUE = @HAVE_LIBLVE_TRUE@ HAVE_LIBMPEG3_FALSE = @HAVE_LIBMPEG3_FALSE@ HAVE_LIBMPEG3_TRUE = @HAVE_LIBMPEG3_TRUE@ HAVE_LIBQUICKTIME_FALSE = @HAVE_LIBQUICKTIME_FALSE@ HAVE_LIBQUICKTIME_TRUE = @HAVE_LIBQUICKTIME_TRUE@ HAVE_LIBXML2_FALSE = @HAVE_LIBXML2_FALSE@ HAVE_LIBXML2_TRUE = @HAVE_LIBXML2_TRUE@ HAVE_LIBXPM_FALSE = @HAVE_LIBXPM_FALSE@ HAVE_LIBXPM_TRUE = @HAVE_LIBXPM_TRUE@ HAVE_LIBXV_FALSE = @HAVE_LIBXV_FALSE@ HAVE_LIBXV_TRUE = @HAVE_LIBXV_TRUE@ HAVE_LZO_FALSE = @HAVE_LZO_FALSE@ HAVE_LZO_TRUE = @HAVE_LZO_TRUE@ HAVE_MJPEGTOOLS_FALSE = @HAVE_MJPEGTOOLS_FALSE@ HAVE_MJPEGTOOLS_TRUE = @HAVE_MJPEGTOOLS_TRUE@ HAVE_MMX_FALSE = @HAVE_MMX_FALSE@ HAVE_MMX_TRUE = @HAVE_MMX_TRUE@ HAVE_OGG_FALSE = @HAVE_OGG_FALSE@ HAVE_OGG_TRUE = @HAVE_OGG_TRUE@ HAVE_PVM3_FALSE = @HAVE_PVM3_FALSE@ HAVE_PVM3_TRUE = @HAVE_PVM3_TRUE@ HAVE_SDL_FALSE = @HAVE_SDL_FALSE@ HAVE_SDL_TRUE = @HAVE_SDL_TRUE@ HAVE_SSE2_FALSE = @HAVE_SSE2_FALSE@ HAVE_SSE2_TRUE = @HAVE_SSE2_TRUE@ HAVE_SSE_FALSE = @HAVE_SSE_FALSE@ HAVE_SSE_TRUE = @HAVE_SSE_TRUE@ HAVE_SUNAU_FALSE = @HAVE_SUNAU_FALSE@ HAVE_SUNAU_TRUE = @HAVE_SUNAU_TRUE@ HAVE_THEORA_FALSE = @HAVE_THEORA_FALSE@ HAVE_THEORA_TRUE = @HAVE_THEORA_TRUE@ HAVE_V4L_FALSE = @HAVE_V4L_FALSE@ HAVE_V4L_TRUE = @HAVE_V4L_TRUE@ HAVE_VORBIS_FALSE = @HAVE_VORBIS_FALSE@ HAVE_VORBIS_TRUE = @HAVE_VORBIS_TRUE@ HAVE_X11_FALSE = @HAVE_X11_FALSE@ HAVE_X11_TRUE = @HAVE_X11_TRUE@ HAVE_XAW_SIMPLE_FALSE = @HAVE_XAW_SIMPLE_FALSE@ HAVE_XAW_SIMPLE_TRUE = @HAVE_XAW_SIMPLE_TRUE@ IBP_LIBS = @IBP_LIBS@ IMAGEMAGICK_CFLAGS = @IMAGEMAGICK_CFLAGS@ IMAGEMAGICK_LIBS = @IMAGEMAGICK_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LAME_CFLAGS = @LAME_CFLAGS@ LAME_LIBS = @LAME_LIBS@ LDFLAGS = @LDFLAGS@ LIBDVDREAD_CFLAGS = @LIBDVDREAD_CFLAGS@ LIBDVDREAD_LIBS = @LIBDVDREAD_LIBS@ LIBDV_CFLAGS = @LIBDV_CFLAGS@ LIBDV_LIBS = @LIBDV_LIBS@ LIBFAME_CFLAGS = @LIBFAME_CFLAGS@ LIBFAME_CONFIG = @LIBFAME_CONFIG@ LIBFAME_LIBS = @LIBFAME_LIBS@ LIBICONV_CFLAGS = @LIBICONV_CFLAGS@ LIBICONV_LIBS = @LIBICONV_LIBS@ LIBJPEG_CFLAGS = @LIBJPEG_CFLAGS@ LIBJPEG_LIBS = @LIBJPEG_LIBS@ LIBMPEG3_CFLAGS = @LIBMPEG3_CFLAGS@ LIBMPEG3_LIBS = @LIBMPEG3_LIBS@ LIBOBJS = @LIBOBJS@ LIBQUICKTIME_CFLAGS = @LIBQUICKTIME_CFLAGS@ LIBQUICKTIME_LIBS = @LIBQUICKTIME_LIBS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBVO_CFLAGS = @LIBVO_CFLAGS@ LIBVO_LIBS = @LIBVO_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ LIBXML2_LIBS = @LIBXML2_LIBS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LVE_CFLAGS = @LVE_CFLAGS@ LVE_LIBS = @LVE_LIBS@ LZO_CFLAGS = @LZO_CFLAGS@ LZO_LIBS = @LZO_LIBS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ MJPEGTOOLS_CFLAGS = @MJPEGTOOLS_CFLAGS@ MJPEGTOOLS_LIBS = @MJPEGTOOLS_LIBS@ MOD_PATH = @MOD_PATH@ MPEG2CVS_CFLAGS = @MPEG2CVS_CFLAGS@ MPEG2CVS_LIBS = @MPEG2CVS_LIBS@ NET_STREAM_FALSE = @NET_STREAM_FALSE@ NET_STREAM_TRUE = @NET_STREAM_TRUE@ OBJEXT = @OBJEXT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_TO_AWK = @PATH_TO_AWK@ PKG_CONFIG = @PKG_CONFIG@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ PVM3_CFLAGS = @PVM3_CFLAGS@ PVM3_LIB = @PVM3_LIB@ PVM3_PVMGS = @PVM3_PVMGS@ RANLIB = @RANLIB@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SUPPORT_INCLUDES = @SUPPORT_INCLUDES@ SUPPORT_LIBS = @SUPPORT_LIBS@ SUPPORT_OBJECTS = @SUPPORT_OBJECTS@ SYSTEM_DARWIN_FALSE = @SYSTEM_DARWIN_FALSE@ SYSTEM_DARWIN_TRUE = @SYSTEM_DARWIN_TRUE@ TCIOAUX_CFLAGS = @TCIOAUX_CFLAGS@ TCIOAUX_LIBS = @TCIOAUX_LIBS@ THEORA_CFLAGS = @THEORA_CFLAGS@ THEORA_LIBS = @THEORA_LIBS@ VERSION = @VERSION@ VORBIS_CFLAGS = @VORBIS_CFLAGS@ VORBIS_LIBS = @VORBIS_LIBS@ WORDS_BIGENDIAN_FALSE = @WORDS_BIGENDIAN_FALSE@ WORDS_BIGENDIAN_TRUE = @WORDS_BIGENDIAN_TRUE@ XIO_CFLAGS = @XIO_CFLAGS@ XIO_LIBS = @XIO_LIBS@ XVID_DEFAULT = @XVID_DEFAULT@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ a52_config = @a52_config@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ avifile_config = @avifile_config@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ exec_prefix = @exec_prefix@ ffmpeg_bin = @ffmpeg_bin@ ffmpeg_libs_config = @ffmpeg_libs_config@ gtk_config = @gtk_config@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ imagemagick_config = @imagemagick_config@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ lame_config = @lame_config@ libdir = @libdir@ libdv_config = @libdv_config@ libdvdread_config = @libdvdread_config@ libexecdir = @libexecdir@ libiconv_config = @libiconv_config@ libmpeg3_config = @libmpeg3_config@ libquicktime_config = @libquicktime_config@ libxml2_config = @libxml2_config@ localstatedir = @localstatedir@ lzo_config = @lzo_config@ mandir = @mandir@ mjpegtools_config = @mjpegtools_config@ mkdir_p = @mkdir_p@ ogg_config = @ogg_config@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ theora_config = @theora_config@ vorbis_config = @vorbis_config@ x_includes = @x_includes@ x_libraries = @x_libraries@ AM_CPPFLAGS = \ $(PTHREAD_CFLAGS) \ -I$(top_srcdir) \ -I$(top_srcdir)/filter \ -I$(top_srcdir)/src \ $(LIBVO_CFLAGS) @HAVE_FOMIT_FP_TRUE@@HAVE_GCC_TRUE@AM_CFLAGS = -fomit-frame-pointer pkgdir = $(MOD_PATH) pkg_LTLIBRARIES = filter_pp.la filter_pp_la_SOURCES = filter_pp.c postprocess.c filter_pp_la_LDFLAGS = -module -avoid-version EXTRA_DIST = \ postprocess.h \ postprocess_internal.h \ postprocess_template.c \ mangle.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu filter/pp/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu filter/pp/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(pkgdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdir)" @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(pkgdir)/$$f'"; \ $(LIBTOOL) --mode=install $(pkgLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(pkgdir)/$$f"; \ else :; fi; \ done uninstall-pkgLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ p="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$p"; \ done clean-pkgLTLIBRARIES: -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ test "$$dir" = "$$p" && dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done filter_pp.la: $(filter_pp_la_OBJECTS) $(filter_pp_la_DEPENDENCIES) $(LINK) -rpath $(pkgdir) $(filter_pp_la_LDFLAGS) $(filter_pp_la_OBJECTS) $(filter_pp_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter_pp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/postprocess.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(pkgdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-pkgLTLIBRARIES install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-info-am uninstall-pkgLTLIBRARIES .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkgLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-pkgLTLIBRARIES install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-info-am \ uninstall-pkgLTLIBRARIES # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: transcode-1.0.0beta2/filter/pp/filter_pp.c100644 001750 000000 00000025325 07754407232 0014152/* * filter_pp.c * * Copyright (C) Gerhard Monzel - Januar 2002 * * This file is part of transcode, a linux video stream processing tool * * transcode is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * transcode is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * */ #define MOD_NAME "filter_pp.so" #define MOD_VERSION "v1.2.4 (2003-01-24)" #define MOD_CAP "Mplayers postprocess filters" #define MOD_AUTHOR "Michael Niedermayer et al, Gerhard Monzel" #include #include #include #include #include /* ------------------------------------------------- * * mandatory include files * *-------------------------------------------------*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "transcode.h" #include "filter.h" #include "optstr.h" #include "framebuffer.h" #include "postprocess.h" #include "aclib/ac.h" static pp_mode_t *mode[MAX_FILTER]; static pp_context_t *context[MAX_FILTER]; static int width[MAX_FILTER], height[MAX_FILTER]; static int pre[MAX_FILTER]; /*------------------------------------------------- * * single function interface * *-------------------------------------------------*/ static void optstr_help (void) { fprintf(stderr, "[: