Enable swscale usage in ffmpeg

Originally committed as revision 5959 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Luca Abeni 2006-08-08 18:51:38 +00:00
parent b9b18fbdea
commit 790c9ca72a
4 changed files with 81 additions and 1 deletions

View File

@ -11,6 +11,10 @@ CFLAGS=$(OPTFLAGS) -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE
LDFLAGS+= -g
ifeq ($(CONFIG_SWSCALER),yes)
CFLAGS := -I$(SRC_PATH)/libswscale $(CFLAGS)
endif
MANPAGES=doc/ffmpeg.1
PROGS_G+=ffmpeg_g$(EXESUF)
PROGS+=ffmpeg$(EXESUF)
@ -58,6 +62,11 @@ SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
FFLIBDIRS = -L./libavformat -L./libavcodec -L./libavutil
FFLIBS = -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF)
ifeq ($(CONFIG_SWSCALER),yes)
FFLIBDIRS+=-L./libswscale
FFLIBS+=-lswscale$(BUILDSUF)
endif
all: version.h lib $(PROGS_G) $(PROGS) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
lib:
@ -67,6 +76,9 @@ lib:
ifeq ($(CONFIG_PP),yes)
$(MAKE) -C libpostproc all
endif
ifeq ($(CONFIG_SWSCALER),yes)
$(MAKE) -C libswscale all
endif
ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
$(CC) $(FFLIBDIRS) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
@ -141,6 +153,10 @@ install-libs:
ifeq ($(CONFIG_PP),yes)
$(MAKE) -C libpostproc install-libs
endif
ifeq ($(CONFIG_SWSCALER),yes)
$(MAKE) -C libswscale install-libs
endif
ifeq ($(BUILD_SHARED),yes)
-$(LDCONFIG)
endif
@ -152,6 +168,9 @@ install-headers:
ifeq ($(CONFIG_PP),yes)
$(MAKE) -C libpostproc install-headers
endif
ifeq ($(CONFIG_SWSCALER),yes)
$(MAKE) -C libswscale install-headers
endif
uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
@ -202,6 +221,7 @@ clean:
$(MAKE) -C libavcodec clean
$(MAKE) -C libavformat clean
$(MAKE) -C libpostproc clean
$(MAKE) -C libswscale clean
$(MAKE) -C tests clean
$(MAKE) -C vhook clean
$(MAKE) -C doc clean
@ -214,6 +234,7 @@ distclean: clean
$(MAKE) -C libavcodec distclean
$(MAKE) -C libavformat distclean
$(MAKE) -C libpostproc distclean
$(MAKE) -C libswscale distclean
$(MAKE) -C tests distclean
$(MAKE) -C vhook distclean
rm -f .depend version.h config.* *.pc

50
configure vendored
View File

@ -57,6 +57,7 @@ show_help(){
echo " --enable-pthreads use pthreads [default=no]"
echo " --enable-dc1394 enable IIDC-1394 grabbing using libdc1394"
echo " and libraw1394 [default=no]"
echo " --enable-swscaler software scaler support [default=no]"
echo " --enable-gpl allow use of GPL code, the resulting libav*"
echo " and ffmpeg will be under GPL [default=no]"
echo ""
@ -464,6 +465,7 @@ amr_nb_fixed="no"
amr_if2="no"
sunmlib="no"
pthreads="no"
swscaler="no"
gpl="no"
memalignhack="no"
@ -802,6 +804,8 @@ for opt do
;;
--enable-pthreads) pthreads="yes"
;;
--enable-swscaler) swscaler="yes"
;;
--enable-gpl) gpl="yes"
;;
--enable-memalign-hack) memalignhack="yes"
@ -963,6 +967,10 @@ EOF
fi
fi
if test "$swscaler" != "no"; then
echo "The software scaler is under GPL and --enable-gpl is not specified."
fail="yes"
fi
if test "$fail" = "yes"; then
exit 1
@ -1501,6 +1509,7 @@ echo "a52 support $a52"
echo "a52 dlopened $a52bin"
echo "DTS support $dts"
echo "pp support $pp"
echo "Software Scaler enabled $swscaler"
echo "debug symbols $debug"
echo "strip symbols $dostrip"
echo "optimize $optimize"
@ -1718,6 +1727,7 @@ if test "$vhook" = "yes" ; then
echo "#define HAVE_VHOOK 1" >> $TMPH
fi
sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
@ -1737,6 +1747,8 @@ if test "$lshared" = "yes" ; then
echo "LAVFVERSION=$lavf_version" >> config.mak
echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
echo "LAVUVERSION=$lavu_version" >> config.mak
echo "SWSMAJOR=${sws_version%%.*}" >> config.mak
echo "SWSVERSION=$sws_version" >> config.mak
echo "SLIBNAME=${SLIBNAME}" >> config.mak
echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
@ -1791,6 +1803,11 @@ if test "$pp" = "yes" ; then
echo "CONFIG_PP=yes" >> config.mak
fi
if test "$swscaler" = "yes" ; then
echo "#define CONFIG_SWSCALER 1" >> $TMPH
echo "CONFIG_SWSCALER=yes" >> config.mak
fi
# MPEG audio high precision mode
if test "$mpegaudio_hp" = "yes" ; then
echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
@ -2011,6 +2028,7 @@ if test "$source_path_used" = "yes" ; then
libavcodec/liba52 \
libpostproc \
libavutil \
libswscale \
tests \
vhook \
"
@ -2020,6 +2038,7 @@ if test "$source_path_used" = "yes" ; then
libavcodec/Makefile \
libpostproc/Makefile \
libavutil/Makefile \
libswscale/Makefile \
tests/Makefile \
vhook/Makefile \
doc/Makefile \
@ -2219,3 +2238,34 @@ Conflicts:
Libs: \${libdir}/${LIBPREF}postproc${LIBSUF}
Cflags: -I\${includedir}
EOF
# libswscale.pc
cat <<EOF >libswscale.pc
prefix=$PREFIX
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include
Name: libswscale
Description: FFmpeg image rescaling library
Version: $sws_version
Requires: $pkg_requires libavutil = $lavu_version
Conflicts:
Libs: -L\${libdir} -lswscale
Cflags: -I\${includedir} -I\${includedir}/swscale
EOF
cat <<EOF >libswscale-uninstalled.pc
prefix=
exec_prefix=
libdir=\${pcfiledir}/libswscale
includedir=\${pcfiledir}/libswscale
Name: libswscale
Description: FFmpeg image rescaling library
Version: $sws_version
Requires: $pkg_requires libavutil = $lavu_version
Conflicts:
Libs: \${libdir}/${LIBPREF}swscale${LIBSUF}
Cflags: -I\${includedir}
EOF

View File

@ -11,7 +11,7 @@ CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -I$(SRC_PATH)/libavutil \
OBJS= bitstream.o utils.o allcodecs.o \
mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
mjpeg.o resample.o resample2.o dsputil.o \
motion_est.o imgconvert.o imgresample.o \
motion_est.o imgconvert.o \
mpeg12.o mpegaudiodec.o simple_idct.o \
ratecontrol.o eval.o error_resilience.o \
fft.o mdct.o raw.o golomb.o cabac.o\
@ -22,6 +22,9 @@ OBJS= bitstream.o utils.o allcodecs.o \
HEADERS = avcodec.h
ifneq ($(CONFIG_SWSCALER),yes)
HEADERS += swscale.h
endif
OBJS-$(CONFIG_AASC_DECODER) += aasc.o
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc.o
@ -277,6 +280,10 @@ OBJS-$(HAVE_BEOSTHREADS) += beosthread.o
OBJS-$(HAVE_XVMC_ACCEL) += xvmcvideo.o
ifneq ($(CONFIG_SWSCALER),yes)
OBJS += imgresample.o
endif
# i386 mmx specific stuff
ifeq ($(TARGET_MMX),yes)
OBJS += i386/fdct_mmx.o i386/cputest.o \

View File

@ -2048,6 +2048,7 @@ int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix
return 0;
}
#ifndef CONFIG_SWSCALER
/* XXX: always use linesize. Return -1 if not supported */
int img_convert(AVPicture *dst, int dst_pix_fmt,
const AVPicture *src, int src_pix_fmt,
@ -2289,6 +2290,7 @@ int img_convert(AVPicture *dst, int dst_pix_fmt,
avpicture_free(tmp);
return ret;
}
#endif
/* NOTE: we scan all the pixels to have an exact information */
static int get_alpha_info_pal8(const AVPicture *src, int width, int height)