From 2c6df2c12019d363990b9eb2aec0e8954d8587ed Mon Sep 17 00:00:00 2001 From: diego Date: Tue, 19 Jan 2010 18:53:16 +0000 Subject: [PATCH 01/10] Create libavutil/avconfig.h, required for FFmpeg compilation. based on a patch by Etienne Buira, etienne.buira free fr git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30376 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/configure b/configure index 1feed88be4..85a3b7a314 100755 --- a/configure +++ b/configure @@ -2432,10 +2432,12 @@ if test "$_big_endian" = yes ; then _byte_order='big-endian' def_words_endian='#define WORDS_BIGENDIAN 1' def_bigendian='#define HAVE_BIGENDIAN 1' + def_av_bigendian='#define AV_HAVE_BIGENDIAN 1' else _byte_order='little-endian' def_words_endian='#undef WORDS_BIGENDIAN' def_bigendian='#define HAVE_BIGENDIAN 0' + def_av_bigendian='#define AV_HAVE_BIGENDIAN 0' fi echores "$_byte_order" @@ -9225,6 +9227,20 @@ EOF # Do not overwrite an unchanged config.h to avoid superfluous rebuilds. cmp -s "$TMPH" config.h || mv -f "$TMPH" config.h +############################################################################ + +# Create avconfig.h for FFmpeg. +cat > "$TMPH" << EOF +/* Generated by mpconfigure */ +#ifndef AVUTIL_AVCONFIG_H +#define AVUTIL_AVCONFIG_H +$def_av_bigendian +#endif /* AVUTIL_AVCONFIG_H */ +EOF + +# Do not overwrite an unchanged avconfig.h to avoid superfluous rebuilds. +cmp -s "$TMPH" libavutil/avconfig.h || mv -f "$TMPH" libavutil/avconfig.h + ############################################################################# cat << EOF From 85d89af72ebae6adf054918f4e9b42cbde81fa1e Mon Sep 17 00:00:00 2001 From: stefano Date: Tue, 19 Jan 2010 21:52:00 +0000 Subject: [PATCH 02/10] Make selfTest() perform tests where both the input and output formats are supported, avoid pointless loops. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30377 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale-example.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libswscale/swscale-example.c b/libswscale/swscale-example.c index 7c43a39467..c8faf80f55 100644 --- a/libswscale/swscale-example.c +++ b/libswscale/swscale-example.c @@ -198,10 +198,16 @@ static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h) enum PixelFormat srcFormat, dstFormat; for (srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) { + if (!sws_isSupportedInput(srcFormat)) + continue; + for (dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) { int i, j, k; int res = 0; + if (!sws_isSupportedOutput(dstFormat)) + continue; + printf("%s -> %s\n", sws_format_name(srcFormat), sws_format_name(dstFormat)); From e8da74db1ffca11afcff15e5d7c55c09257332d5 Mon Sep 17 00:00:00 2001 From: stefano Date: Tue, 19 Jan 2010 22:36:46 +0000 Subject: [PATCH 03/10] Split overly long line. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30378 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 1f276cbf22..b27fbb0851 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -2373,7 +2373,8 @@ static int handle_jpeg(enum PixelFormat *format) } } -SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int dstW, int dstH, enum PixelFormat dstFormat, int flags, +SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, + int dstW, int dstH, enum PixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param) { From 39bcd6edcf82f15f11b123ee2179c41f7b4d6b9f Mon Sep 17 00:00:00 2001 From: stefano Date: Wed, 20 Jan 2010 00:22:31 +0000 Subject: [PATCH 04/10] Avoid more pointless tests, the input and output formats need to be supported both as input and as output, as the conversion performed is: yuva420p -> src -> dst -> yuva420p. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30379 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale-example.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale-example.c b/libswscale/swscale-example.c index c8faf80f55..a812ee5963 100644 --- a/libswscale/swscale-example.c +++ b/libswscale/swscale-example.c @@ -198,14 +198,14 @@ static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h) enum PixelFormat srcFormat, dstFormat; for (srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) { - if (!sws_isSupportedInput(srcFormat)) + if (!sws_isSupportedInput(srcFormat) || !sws_isSupportedOutput(srcFormat)) continue; for (dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) { int i, j, k; int res = 0; - if (!sws_isSupportedOutput(dstFormat)) + if (!sws_isSupportedInput(dstFormat) || !sws_isSupportedOutput(dstFormat)) continue; printf("%s -> %s\n", From 06c49d538d788c0d441744683bfe2e113a854f2c Mon Sep 17 00:00:00 2001 From: ramiro Date: Wed, 20 Jan 2010 03:26:12 +0000 Subject: [PATCH 05/10] Document some more of SwsContext. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30380 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale_internal.h | 80 +++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 26 deletions(-) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 65174fdd45..9e48010c36 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -86,35 +86,67 @@ typedef struct SwsContext { int lumYInc, chrYInc; enum PixelFormat dstFormat; ///< Destination pixel format. enum PixelFormat srcFormat; ///< Source pixel format. - int chrSrcHSubSample, chrSrcVSubSample; - int chrDstHSubSample, chrDstVSubSample; - int vChrDrop; - int sliceDir; + int chrSrcHSubSample; ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in source image. + int chrSrcVSubSample; ///< Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in source image. + int chrDstHSubSample; ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in destination image. + int chrDstVSubSample; ///< Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in destination image. + int vChrDrop; ///< Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user. + int sliceDir; ///< Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top). double param[2]; ///< Input parameters for scaling algorithms that need them. uint32_t pal_yuv[256]; uint32_t pal_rgb[256]; - int16_t **lumPixBuf; - int16_t **chrPixBuf; - int16_t **alpPixBuf; - int16_t *hLumFilter; - int16_t *hLumFilterPos; - int16_t *hChrFilter; - int16_t *hChrFilterPos; - int16_t *vLumFilter; - int16_t *vLumFilterPos; - int16_t *vChrFilter; - int16_t *vChrFilterPos; + /** + * @name Scaled horizontal lines ring buffer. + * The horizontal scaler keeps just enough scaled lines in a ring buffer + * so they may be passed to the vertical scaler. The pointers to the + * allocated buffers for each line are duplicated in sequence in the ring + * buffer to simplify indexing and avoid wrapping around between lines + * inside the vertical scaler code. The wrapping is done before the + * vertical scaler is called. + */ + //@{ + int16_t **lumPixBuf; ///< Ring buffer for scaled horizontal luma plane lines to be fed to the vertical scaler. + int16_t **chrPixBuf; ///< Ring buffer for scaled horizontal chroma plane lines to be fed to the vertical scaler. + int16_t **alpPixBuf; ///< Ring buffer for scaled horizontal alpha plane lines to be fed to the vertical scaler. + int vLumBufSize; ///< Number of vertical luma/alpha lines allocated in the ring buffer. + int vChrBufSize; ///< Number of vertical chroma lines allocated in the ring buffer. + int lastInLumBuf; ///< Last scaled horizontal luma/alpha line from source in the ring buffer. + int lastInChrBuf; ///< Last scaled horizontal chroma line from source in the ring buffer. + int lumBufIndex; ///< Index in ring buffer of the last scaled horizontal luma/alpha line from source. + int chrBufIndex; ///< Index in ring buffer of the last scaled horizontal chroma line from source. + //@} uint8_t formatConvBuffer[VOF]; //FIXME dynamic allocation, but we have to change a lot of code for this to be useful - int hLumFilterSize; - int hChrFilterSize; - int vLumFilterSize; - int vChrFilterSize; - int vLumBufSize; - int vChrBufSize; + /** + * @name Horizontal and vertical filters. + * To better understand the following fields, here is a pseudo-code of + * their usage in filtering a horizontal line: + * @code + * for (i = 0; i < width; i++) { + * dst[i] = 0; + * for (j = 0; j < filterSize; j++) + * dst[i] += src[ filterPos[i] + j ] * filter[ filterSize * i + j ]; + * dst[i] >>= FRAC_BITS; // The actual implementation is fixed-point. + * } + * @endcode + */ + //@{ + int16_t *hLumFilter; ///< Array of horizontal filter coefficients for luma/alpha planes. + int16_t *hChrFilter; ///< Array of horizontal filter coefficients for chroma planes. + int16_t *vLumFilter; ///< Array of vertical filter coefficients for luma/alpha planes. + int16_t *vChrFilter; ///< Array of vertical filter coefficients for chroma planes. + int16_t *hLumFilterPos; ///< Array of horizontal filter starting positions for each dst[i] for luma/alpha planes. + int16_t *hChrFilterPos; ///< Array of horizontal filter starting positions for each dst[i] for chroma planes. + int16_t *vLumFilterPos; ///< Array of vertical filter starting positions for each dst[i] for luma/alpha planes. + int16_t *vChrFilterPos; ///< Array of vertical filter starting positions for each dst[i] for chroma planes. + int hLumFilterSize; ///< Horizontal filter size for luma/alpha pixels. + int hChrFilterSize; ///< Horizontal filter size for chroma pixels. + int vLumFilterSize; ///< Vertical filter size for luma/alpha pixels. + int vChrFilterSize; ///< Vertical filter size for chroma pixels. + //@} int lumMmx2FilterCodeSize; ///< Runtime-generated MMX2 horizontal fast bilinear scaler code size for luma/alpha planes. int chrMmx2FilterCodeSize; ///< Runtime-generated MMX2 horizontal fast bilinear scaler code size for chroma planes. @@ -123,10 +155,6 @@ typedef struct SwsContext { int canMMX2BeUsed; - int lastInLumBuf; - int lastInChrBuf; - int lumBufIndex; - int chrBufIndex; int dstY; ///< Last destination vertical line output from last slice. int flags; ///< Flags passed by the user to select scaler algorithm, optimizations, subsampling, etc... void * yuvTable; // pointer to the yuv->rgb table start so it can be freed() @@ -183,7 +211,7 @@ typedef struct SwsContext { DECLARE_ALIGNED(8, uint64_t, vOffset); int32_t lumMmxFilter[4*MAX_FILTER_SIZE]; int32_t chrMmxFilter[4*MAX_FILTER_SIZE]; - int dstW; + int dstW; ///< Width of destination luma/alpha planes. DECLARE_ALIGNED(8, uint64_t, esp); DECLARE_ALIGNED(8, uint64_t, vRounder); DECLARE_ALIGNED(8, uint64_t, u_temp); From 450cef62b0dc15f70fa2949b5db547b668397924 Mon Sep 17 00:00:00 2001 From: conrad Date: Thu, 21 Jan 2010 09:52:11 +0000 Subject: [PATCH 06/10] More const-correctness for sws_scale git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30381 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 4 ++-- libswscale/swscale.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index b27fbb0851..62fa78d7b5 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -2927,8 +2927,8 @@ static void reset_ptr(const uint8_t* src[], int format) * swscale wrapper, so we don't need to export the SwsContext. * Assumes planar YUV to be in YUV order instead of YVU. */ -int sws_scale(SwsContext *c, const uint8_t* const src[], int srcStride[], int srcSliceY, - int srcSliceH, uint8_t* dst[], int dstStride[]) +int sws_scale(SwsContext *c, const uint8_t* const src[], const int srcStride[], int srcSliceY, + int srcSliceH, uint8_t* const dst[], const int dstStride[]) { int i; const uint8_t* src2[4]= {src[0], src[1], src[2], src[3]}; diff --git a/libswscale/swscale.h b/libswscale/swscale.h index 4127454945..9e14262d30 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -30,7 +30,7 @@ #include "libavutil/avutil.h" #define LIBSWSCALE_VERSION_MAJOR 0 -#define LIBSWSCALE_VERSION_MINOR 8 +#define LIBSWSCALE_VERSION_MINOR 9 #define LIBSWSCALE_VERSION_MICRO 0 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ @@ -184,8 +184,8 @@ struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat * the destination image * @return the height of the output slice */ -int sws_scale(struct SwsContext *context, const uint8_t* const srcSlice[], int srcStride[], - int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]); +int sws_scale(struct SwsContext *context, const uint8_t* const srcSlice[], const int srcStride[], + int srcSliceY, int srcSliceH, uint8_t* const dst[], const int dstStride[]); #if LIBSWSCALE_VERSION_MAJOR < 1 /** * @deprecated Use sws_scale() instead. From 4e92beb4eaa44157a2635c22216c7c01f85d431b Mon Sep 17 00:00:00 2001 From: cehoyos Date: Thu, 21 Jan 2010 10:31:34 +0000 Subject: [PATCH 07/10] Fix compilation after FFmpeg r21353. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30382 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 85a3b7a314..5c311e53f5 100755 --- a/configure +++ b/configure @@ -9220,6 +9220,7 @@ $(ff_config_enable "$_libavbsfs_all" "$_libavbsfs") #define CONFIG_H264_VAAPI_HWACCEL 0 #define CONFIG_VC1_VAAPI_HWACCEL 0 #define CONFIG_WMV3_VAAPI_HWACCEL 0 +#define CONFIG_H264_DXVA2_HWACCEL 0 #endif /* MPLAYER_CONFIG_H */ EOF From 34db438211aa5f734cc526fe3c55afb69e80d0cb Mon Sep 17 00:00:00 2001 From: cehoyos Date: Thu, 21 Jan 2010 10:37:35 +0000 Subject: [PATCH 08/10] x264 version 0.83 is required. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30383 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 5c311e53f5..281cd463e9 100755 --- a/configure +++ b/configure @@ -7465,7 +7465,7 @@ if test "$_x264" = auto ; then cat > $TMPC << EOF #include #include -#if X264_BUILD < 79 +#if X264_BUILD < 83 #error We do not support old versions of x264. Get the latest from git. #endif int main(void) { x264_encoder_open((void*)0); return 0; } From 937c4fab19b5eec3ff2f6cfa4eeae3b809e63f19 Mon Sep 17 00:00:00 2001 From: diego Date: Thu, 21 Jan 2010 11:16:03 +0000 Subject: [PATCH 09/10] Disable all hwaccel glue code from FFmpeg. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30384 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 281cd463e9..2e5f5bd75b 100755 --- a/configure +++ b/configure @@ -554,6 +554,9 @@ _libavparsers_all=$(sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' libavco _libavparsers=$_libavparsers_all _libavbsfs_all=$(sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') _libavbsfs=$_libavbsfs_all +_libavhwaccels_all=$(sed -n 's/^[^#]*HWACCEL.*(.*, *\(.*\)).*/\1_hwaccel/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') +# Disable all hardware accelerators for now. +_libavhwaccels= _libavdemuxers_all=$(sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' libavformat/allformats.c | tr '[a-z]' '[A-Z]') _libavdemuxers=$(echo $_libavdemuxers_all | sed -e 's/ LIB[A-Z0-9_]*_DEMUXER//g' -e s/REDIR_DEMUXER// -e s/RTSP_DEMUXER// -e s/SDP_DEMUXER// -e s/AVISYNTH_DEMUXER//) _libavmuxers_all=$(sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' libavformat/allformats.c | tr '[a-z]' '[A-Z]') @@ -8713,6 +8716,7 @@ $(echo $_libavdemuxers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/') $(echo $_libavmuxers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/') $(echo $_libavprotocols | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/') $(echo $_libavbsfs | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/') +$(echo $_libavhwaccels | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/') EOF ############################################################################# @@ -9213,14 +9217,7 @@ $(ff_config_enable "$_libavdemuxers_all" "$_libavdemuxers") $(ff_config_enable "$_libavmuxers_all" "$_libavmuxers") $(ff_config_enable "$_libavprotocols_all" "$_libavprotocols") $(ff_config_enable "$_libavbsfs_all" "$_libavbsfs") - -#define CONFIG_H263_VAAPI_HWACCEL 0 -#define CONFIG_MPEG2_VAAPI_HWACCEL 0 -#define CONFIG_MPEG4_VAAPI_HWACCEL 0 -#define CONFIG_H264_VAAPI_HWACCEL 0 -#define CONFIG_VC1_VAAPI_HWACCEL 0 -#define CONFIG_WMV3_VAAPI_HWACCEL 0 -#define CONFIG_H264_DXVA2_HWACCEL 0 +$(ff_config_enable "$_libavhwaccels_all" "$_libavhwaccels") #endif /* MPLAYER_CONFIG_H */ EOF From 134976ee4d0f58fca20aa2b79d874d035b0bc30b Mon Sep 17 00:00:00 2001 From: mru Date: Fri, 22 Jan 2010 03:26:30 +0000 Subject: [PATCH 10/10] Move array specifiers outside DECLARE_ALIGNED() invocations git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30385 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/ppc/swscale_altivec_template.c | 8 ++++---- libswscale/ppc/yuv2rgb_altivec.c | 4 ++-- libswscale/swscale.c | 22 +++++++++++----------- libswscale/swscale_internal.h | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libswscale/ppc/swscale_altivec_template.c b/libswscale/ppc/swscale_altivec_template.c index 23da6b0178..a438e4cb37 100644 --- a/libswscale/ppc/swscale_altivec_template.c +++ b/libswscale/ppc/swscale_altivec_template.c @@ -93,7 +93,7 @@ yuv2yuvX_altivec_real(const int16_t *lumFilter, int16_t **lumSrc, int lumFilterS const vector signed int vini = {(1 << 18), (1 << 18), (1 << 18), (1 << 18)}; register int i, j; { - DECLARE_ALIGNED(16, int, val[dstW]); + DECLARE_ALIGNED(16, int, val)[dstW]; for (i = 0; i < (dstW -7); i+=4) { vec_st(vini, i << 2, val); @@ -141,8 +141,8 @@ yuv2yuvX_altivec_real(const int16_t *lumFilter, int16_t **lumSrc, int lumFilterS altivec_packIntArrayToCharArray(val, dest, dstW); } if (uDest != 0) { - DECLARE_ALIGNED(16, int, u[chrDstW]); - DECLARE_ALIGNED(16, int, v[chrDstW]); + DECLARE_ALIGNED(16, int, u)[chrDstW]; + DECLARE_ALIGNED(16, int, v)[chrDstW]; for (i = 0; i < (chrDstW -7); i+=4) { vec_st(vini, i << 2, u); @@ -215,7 +215,7 @@ static inline void hScale_altivec_real(int16_t *dst, int dstW, const int16_t *filterPos, int filterSize) { register int i; - DECLARE_ALIGNED(16, int, tempo[4]); + DECLARE_ALIGNED(16, int, tempo)[4]; if (filterSize % 4) { for (i=0; i