Commit 790c9ca7 authored by Luca Abeni's avatar Luca Abeni

Enable swscale usage in ffmpeg

Originally committed as revision 5959 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b9b18fbd
...@@ -11,6 +11,10 @@ CFLAGS=$(OPTFLAGS) -I. -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \ ...@@ -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 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE
LDFLAGS+= -g LDFLAGS+= -g
ifeq ($(CONFIG_SWSCALER),yes)
CFLAGS := -I$(SRC_PATH)/libswscale $(CFLAGS)
endif
MANPAGES=doc/ffmpeg.1 MANPAGES=doc/ffmpeg.1
PROGS_G+=ffmpeg_g$(EXESUF) PROGS_G+=ffmpeg_g$(EXESUF)
PROGS+=ffmpeg$(EXESUF) PROGS+=ffmpeg$(EXESUF)
...@@ -58,6 +62,11 @@ SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s) ...@@ -58,6 +62,11 @@ SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
FFLIBDIRS = -L./libavformat -L./libavcodec -L./libavutil FFLIBDIRS = -L./libavformat -L./libavcodec -L./libavutil
FFLIBS = -lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) 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) all: version.h lib $(PROGS_G) $(PROGS) $(PROGTEST) $(VHOOK) $(QTFASTSTART) $(DOC)
lib: lib:
...@@ -67,6 +76,9 @@ lib: ...@@ -67,6 +76,9 @@ lib:
ifeq ($(CONFIG_PP),yes) ifeq ($(CONFIG_PP),yes)
$(MAKE) -C libpostproc all $(MAKE) -C libpostproc all
endif endif
ifeq ($(CONFIG_SWSCALER),yes)
$(MAKE) -C libswscale all
endif
ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs ffmpeg_g$(EXESUF): ffmpeg.o cmdutils.o .libs
$(CC) $(FFLIBDIRS) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS) $(CC) $(FFLIBDIRS) $(LDFLAGS) -o $@ ffmpeg.o cmdutils.o $(FFLIBS) $(EXTRALIBS)
...@@ -141,6 +153,10 @@ install-libs: ...@@ -141,6 +153,10 @@ install-libs:
ifeq ($(CONFIG_PP),yes) ifeq ($(CONFIG_PP),yes)
$(MAKE) -C libpostproc install-libs $(MAKE) -C libpostproc install-libs
endif endif
ifeq ($(CONFIG_SWSCALER),yes)
$(MAKE) -C libswscale install-libs
endif
ifeq ($(BUILD_SHARED),yes) ifeq ($(BUILD_SHARED),yes)
-$(LDCONFIG) -$(LDCONFIG)
endif endif
...@@ -152,6 +168,9 @@ install-headers: ...@@ -152,6 +168,9 @@ install-headers:
ifeq ($(CONFIG_PP),yes) ifeq ($(CONFIG_PP),yes)
$(MAKE) -C libpostproc install-headers $(MAKE) -C libpostproc install-headers
endif endif
ifeq ($(CONFIG_SWSCALER),yes)
$(MAKE) -C libswscale install-headers
endif
uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook uninstall: uninstall-progs uninstall-libs uninstall-headers uninstall-man uninstall-vhook
...@@ -202,6 +221,7 @@ clean: ...@@ -202,6 +221,7 @@ clean:
$(MAKE) -C libavcodec clean $(MAKE) -C libavcodec clean
$(MAKE) -C libavformat clean $(MAKE) -C libavformat clean
$(MAKE) -C libpostproc clean $(MAKE) -C libpostproc clean
$(MAKE) -C libswscale clean
$(MAKE) -C tests clean $(MAKE) -C tests clean
$(MAKE) -C vhook clean $(MAKE) -C vhook clean
$(MAKE) -C doc clean $(MAKE) -C doc clean
...@@ -214,6 +234,7 @@ distclean: clean ...@@ -214,6 +234,7 @@ distclean: clean
$(MAKE) -C libavcodec distclean $(MAKE) -C libavcodec distclean
$(MAKE) -C libavformat distclean $(MAKE) -C libavformat distclean
$(MAKE) -C libpostproc distclean $(MAKE) -C libpostproc distclean
$(MAKE) -C libswscale distclean
$(MAKE) -C tests distclean $(MAKE) -C tests distclean
$(MAKE) -C vhook distclean $(MAKE) -C vhook distclean
rm -f .depend version.h config.* *.pc rm -f .depend version.h config.* *.pc
......
...@@ -57,6 +57,7 @@ show_help(){ ...@@ -57,6 +57,7 @@ show_help(){
echo " --enable-pthreads use pthreads [default=no]" echo " --enable-pthreads use pthreads [default=no]"
echo " --enable-dc1394 enable IIDC-1394 grabbing using libdc1394" echo " --enable-dc1394 enable IIDC-1394 grabbing using libdc1394"
echo " and libraw1394 [default=no]" 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 " --enable-gpl allow use of GPL code, the resulting libav*"
echo " and ffmpeg will be under GPL [default=no]" echo " and ffmpeg will be under GPL [default=no]"
echo "" echo ""
...@@ -464,6 +465,7 @@ amr_nb_fixed="no" ...@@ -464,6 +465,7 @@ amr_nb_fixed="no"
amr_if2="no" amr_if2="no"
sunmlib="no" sunmlib="no"
pthreads="no" pthreads="no"
swscaler="no"
gpl="no" gpl="no"
memalignhack="no" memalignhack="no"
...@@ -802,6 +804,8 @@ for opt do ...@@ -802,6 +804,8 @@ for opt do
;; ;;
--enable-pthreads) pthreads="yes" --enable-pthreads) pthreads="yes"
;; ;;
--enable-swscaler) swscaler="yes"
;;
--enable-gpl) gpl="yes" --enable-gpl) gpl="yes"
;; ;;
--enable-memalign-hack) memalignhack="yes" --enable-memalign-hack) memalignhack="yes"
...@@ -963,6 +967,10 @@ EOF ...@@ -963,6 +967,10 @@ EOF
fi fi
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 if test "$fail" = "yes"; then
exit 1 exit 1
...@@ -1501,6 +1509,7 @@ echo "a52 support $a52" ...@@ -1501,6 +1509,7 @@ echo "a52 support $a52"
echo "a52 dlopened $a52bin" echo "a52 dlopened $a52bin"
echo "DTS support $dts" echo "DTS support $dts"
echo "pp support $pp" echo "pp support $pp"
echo "Software Scaler enabled $swscaler"
echo "debug symbols $debug" echo "debug symbols $debug"
echo "strip symbols $dostrip" echo "strip symbols $dostrip"
echo "optimize $optimize" echo "optimize $optimize"
...@@ -1718,6 +1727,7 @@ if test "$vhook" = "yes" ; then ...@@ -1718,6 +1727,7 @@ if test "$vhook" = "yes" ; then
echo "#define HAVE_VHOOK 1" >> $TMPH echo "#define HAVE_VHOOK 1" >> $TMPH
fi 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'` 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'` 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'` 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 ...@@ -1737,6 +1747,8 @@ if test "$lshared" = "yes" ; then
echo "LAVFVERSION=$lavf_version" >> config.mak echo "LAVFVERSION=$lavf_version" >> config.mak
echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
echo "LAVUVERSION=$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=${SLIBNAME}" >> config.mak
echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
...@@ -1791,6 +1803,11 @@ if test "$pp" = "yes" ; then ...@@ -1791,6 +1803,11 @@ if test "$pp" = "yes" ; then
echo "CONFIG_PP=yes" >> config.mak echo "CONFIG_PP=yes" >> config.mak
fi fi
if test "$swscaler" = "yes" ; then
echo "#define CONFIG_SWSCALER 1" >> $TMPH
echo "CONFIG_SWSCALER=yes" >> config.mak
fi
# MPEG audio high precision mode # MPEG audio high precision mode
if test "$mpegaudio_hp" = "yes" ; then if test "$mpegaudio_hp" = "yes" ; then
echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
...@@ -2011,6 +2028,7 @@ if test "$source_path_used" = "yes" ; then ...@@ -2011,6 +2028,7 @@ if test "$source_path_used" = "yes" ; then
libavcodec/liba52 \ libavcodec/liba52 \
libpostproc \ libpostproc \
libavutil \ libavutil \
libswscale \
tests \ tests \
vhook \ vhook \
" "
...@@ -2020,6 +2038,7 @@ if test "$source_path_used" = "yes" ; then ...@@ -2020,6 +2038,7 @@ if test "$source_path_used" = "yes" ; then
libavcodec/Makefile \ libavcodec/Makefile \
libpostproc/Makefile \ libpostproc/Makefile \
libavutil/Makefile \ libavutil/Makefile \
libswscale/Makefile \
tests/Makefile \ tests/Makefile \
vhook/Makefile \ vhook/Makefile \
doc/Makefile \ doc/Makefile \
...@@ -2219,3 +2238,34 @@ Conflicts: ...@@ -2219,3 +2238,34 @@ Conflicts:
Libs: \${libdir}/${LIBPREF}postproc${LIBSUF} Libs: \${libdir}/${LIBPREF}postproc${LIBSUF}
Cflags: -I\${includedir} Cflags: -I\${includedir}
EOF 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
...@@ -11,7 +11,7 @@ CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -I$(SRC_PATH)/libavutil \ ...@@ -11,7 +11,7 @@ CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -I$(SRC_PATH)/libavutil \
OBJS= bitstream.o utils.o allcodecs.o \ OBJS= bitstream.o utils.o allcodecs.o \
mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\ mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o\
mjpeg.o resample.o resample2.o dsputil.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 \ mpeg12.o mpegaudiodec.o simple_idct.o \
ratecontrol.o eval.o error_resilience.o \ ratecontrol.o eval.o error_resilience.o \
fft.o mdct.o raw.o golomb.o cabac.o\ fft.o mdct.o raw.o golomb.o cabac.o\
...@@ -22,6 +22,9 @@ OBJS= bitstream.o utils.o allcodecs.o \ ...@@ -22,6 +22,9 @@ OBJS= bitstream.o utils.o allcodecs.o \
HEADERS = avcodec.h HEADERS = avcodec.h
ifneq ($(CONFIG_SWSCALER),yes)
HEADERS += swscale.h
endif
OBJS-$(CONFIG_AASC_DECODER) += aasc.o OBJS-$(CONFIG_AASC_DECODER) += aasc.o
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc.o OBJS-$(CONFIG_AC3_ENCODER) += ac3enc.o
...@@ -277,6 +280,10 @@ OBJS-$(HAVE_BEOSTHREADS) += beosthread.o ...@@ -277,6 +280,10 @@ OBJS-$(HAVE_BEOSTHREADS) += beosthread.o
OBJS-$(HAVE_XVMC_ACCEL) += xvmcvideo.o OBJS-$(HAVE_XVMC_ACCEL) += xvmcvideo.o
ifneq ($(CONFIG_SWSCALER),yes)
OBJS += imgresample.o
endif
# i386 mmx specific stuff # i386 mmx specific stuff
ifeq ($(TARGET_MMX),yes) ifeq ($(TARGET_MMX),yes)
OBJS += i386/fdct_mmx.o i386/cputest.o \ OBJS += i386/fdct_mmx.o i386/cputest.o \
......
...@@ -2048,6 +2048,7 @@ int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix ...@@ -2048,6 +2048,7 @@ int img_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix
return 0; return 0;
} }
#ifndef CONFIG_SWSCALER
/* XXX: always use linesize. Return -1 if not supported */ /* XXX: always use linesize. Return -1 if not supported */
int img_convert(AVPicture *dst, int dst_pix_fmt, int img_convert(AVPicture *dst, int dst_pix_fmt,
const AVPicture *src, int src_pix_fmt, const AVPicture *src, int src_pix_fmt,
...@@ -2289,6 +2290,7 @@ int img_convert(AVPicture *dst, int dst_pix_fmt, ...@@ -2289,6 +2290,7 @@ int img_convert(AVPicture *dst, int dst_pix_fmt,
avpicture_free(tmp); avpicture_free(tmp);
return ret; return ret;
} }
#endif
/* NOTE: we scan all the pixels to have an exact information */ /* NOTE: we scan all the pixels to have an exact information */
static int get_alpha_info_pal8(const AVPicture *src, int width, int height) static int get_alpha_info_pal8(const AVPicture *src, int width, int height)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment