From 09584311f15732d9de7a76b2854578a43844ce74 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 26 Apr 2015 14:09:57 +0200 Subject: [PATCH] ffmpeg: fix undefined references * We need to manually remove some function calls in dead code that gcc2 can't optimize itself. --- media-video/ffmpeg/ffmpeg-0.10.14.recipe | 10 +- .../ffmpeg/patches/ffmpeg-0.10.14-gcc2.patch | 1235 +++++++++++++++-- 2 files changed, 1138 insertions(+), 107 deletions(-) diff --git a/media-video/ffmpeg/ffmpeg-0.10.14.recipe b/media-video/ffmpeg/ffmpeg-0.10.14.recipe index cbd3d0b4c..f861459e2 100644 --- a/media-video/ffmpeg/ffmpeg-0.10.14.recipe +++ b/media-video/ffmpeg/ffmpeg-0.10.14.recipe @@ -14,7 +14,7 @@ COPYRIGHT=" " SRC_URI="http://www.ffmpeg.org/releases/ffmpeg-0.10.14.tar.bz2" CHECKSUM_SHA256="1ef77533f3803b8630403df413005c1c41b18c50b16895815182fd70d2f833bb" -REVISION="2" +REVISION="3" ARCHITECTURES="x86_gcc2 x86 x86_64" SECONDARY_ARCHITECTURES="x86_gcc2 x86" @@ -117,11 +117,9 @@ INSTALL() { make install - rm $binDir/ffprobe - # TODO: Determine and fix what is wrong with ffprobe! The executable - # seems to be broken. The NEEDED entries in the dynamic section look - # weird and the runtime loader fails relocating with "Operation not - # allowed". + if [ $effectiveTargetArchitecture == x86_gcc2 ]; then + rm $binDir/ffprobe + fi prepareInstalledDevelLibs \ libavcodec \ diff --git a/media-video/ffmpeg/patches/ffmpeg-0.10.14-gcc2.patch b/media-video/ffmpeg/patches/ffmpeg-0.10.14-gcc2.patch index 733f38c46..6931722d9 100644 --- a/media-video/ffmpeg/patches/ffmpeg-0.10.14-gcc2.patch +++ b/media-video/ffmpeg/patches/ffmpeg-0.10.14-gcc2.patch @@ -1,6 +1,6 @@ -From da55da8c61522776ebb01e3cb6c1f8225c97383b Mon Sep 17 00:00:00 2001 +From 9505d904591a7776bae7547018f8e01a4fb5deec Mon Sep 17 00:00:00 2001 From: Adrien Destugues -Date: Sat, 30 Aug 2014 22:50:29 +0200 +Date: Fri, 19 Sep 2014 10:19:42 +0200 Subject: applying patch ffmpeg-0.10.14-gcc2.patch @@ -200,105 +200,6 @@ index d36914a..103b742 100644 switch(bits_per_pixel) { case 1: memset(dst, 0, row_size); -diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c -index e73fbfe..3cde56c 100644 ---- a/libavutil/pixdesc.c -+++ b/libavutil/pixdesc.c -@@ -1096,12 +1096,6 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { - .log2_chroma_h = 1, - .flags = PIX_FMT_HWACCEL, - }, -- [PIX_FMT_VDA_VLD] = { -- .name = "vda_vld", -- .log2_chroma_w = 1, -- .log2_chroma_h = 1, -- .flags = PIX_FMT_HWACCEL, -- }, - [PIX_FMT_GRAY8A] = { - .name = "gray8a", - .nb_components = 2, -@@ -1110,16 +1104,6 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { - { 0, 1, 2, 0, 7 }, /* A */ - }, - }, -- [PIX_FMT_GBR24P] = { -- .name = "gbr24p", -- .nb_components= 3, -- .comp = { -- { 1, 0, 1, 0, 7 }, /* B */ -- { 0, 0, 1, 0, 7 }, /* G */ -- { 2, 0, 1, 0, 7 }, /* R */ -- }, -- .flags = PIX_FMT_PLANAR | PIX_FMT_RGB, -- }, - [PIX_FMT_GBRP] = { - .name = "gbrp", - .nb_components = 3, -diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c -index d4b39f4..b98d38a 100644 ---- a/libswscale/swscale_unscaled.c -+++ b/libswscale/swscale_unscaled.c -@@ -370,30 +370,38 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStr - } - - switch (c->dstFormat) { -- case PIX_FMT_BGR24: -- gbr24ptopacked24((const uint8_t* []) {src[1], src[0], src[2]}, (int []) {srcStride[1], srcStride[0], srcStride[2]}, -+ case PIX_FMT_BGR24: { -+ const uint8_t* src2[] = {src[1], src[0], src[2]}; -+ int srcStride2[] = {srcStride[1], srcStride[0], srcStride[2]}; -+ gbr24ptopacked24(src2, srcStride2, - dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, c->srcW); - break; -- -- case PIX_FMT_RGB24: -- gbr24ptopacked24((const uint8_t* []) {src[2], src[0], src[1]}, (int []) {srcStride[2], srcStride[0], srcStride[1]}, -+ } -+ case PIX_FMT_RGB24: { -+ const uint8_t* src2[] = {src[2], src[0], src[1]}; -+ int srcStride2[] = {srcStride[2], srcStride[0], srcStride[1]}; -+ gbr24ptopacked24(src2, srcStride2, - dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, c->srcW); - break; -- -+ } - case PIX_FMT_ARGB: - alpha_first = 1; -- case PIX_FMT_RGBA: -- gbr24ptopacked32((const uint8_t* []) {src[2], src[0], src[1]}, (int []) {srcStride[2], srcStride[0], srcStride[1]}, -+ case PIX_FMT_RGBA: { -+ const uint8_t* src2[] = {src[2], src[0], src[1]}; -+ int srcStride2[] = {srcStride[2], srcStride[0], srcStride[1]}; -+ gbr24ptopacked32(src2, srcStride2, - dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, alpha_first, c->srcW); - break; -- -+ } - case PIX_FMT_ABGR: - alpha_first = 1; -- case PIX_FMT_BGRA: -- gbr24ptopacked32((const uint8_t* []) {src[1], src[0], src[2]}, (int []) {srcStride[1], srcStride[0], srcStride[2]}, -+ case PIX_FMT_BGRA: { -+ const uint8_t* src2[] = {src[1], src[0], src[2]}; -+ int srcStride2[] = {srcStride[1], srcStride[0], srcStride[2]}; -+ gbr24ptopacked32(src2, srcStride2, - dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, alpha_first, c->srcW); - break; -- -+ } - default: - av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", - av_get_pix_fmt_name(c->srcFormat), av_get_pix_fmt_name(c->dstFormat)); --- -1.8.3.4 - - -From 445a786ab5ddf109c669285fa4c68d8ebf3502e9 Mon Sep 17 00:00:00 2001 -From: Adrien Destugues -Date: Wed, 3 Sep 2014 22:14:36 +0200 -Subject: More gcc2 fixes (for the GPL licenced parts) - - diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c index 96b2a4c..3043204 100644 --- a/libavfilter/vsrc_mptestsrc.c @@ -466,6 +367,1138 @@ index 0b60526..cc6f6a8 100644 FILTER #undef prev2 #undef next2 +diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c +index e73fbfe..3cde56c 100644 +--- a/libavutil/pixdesc.c ++++ b/libavutil/pixdesc.c +@@ -1096,12 +1096,6 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { + .log2_chroma_h = 1, + .flags = PIX_FMT_HWACCEL, + }, +- [PIX_FMT_VDA_VLD] = { +- .name = "vda_vld", +- .log2_chroma_w = 1, +- .log2_chroma_h = 1, +- .flags = PIX_FMT_HWACCEL, +- }, + [PIX_FMT_GRAY8A] = { + .name = "gray8a", + .nb_components = 2, +@@ -1110,16 +1104,6 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { + { 0, 1, 2, 0, 7 }, /* A */ + }, + }, +- [PIX_FMT_GBR24P] = { +- .name = "gbr24p", +- .nb_components= 3, +- .comp = { +- { 1, 0, 1, 0, 7 }, /* B */ +- { 0, 0, 1, 0, 7 }, /* G */ +- { 2, 0, 1, 0, 7 }, /* R */ +- }, +- .flags = PIX_FMT_PLANAR | PIX_FMT_RGB, +- }, + [PIX_FMT_GBRP] = { + .name = "gbrp", + .nb_components = 3, +diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c +index d4b39f4..b98d38a 100644 +--- a/libswscale/swscale_unscaled.c ++++ b/libswscale/swscale_unscaled.c +@@ -370,30 +370,38 @@ static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStr + } + + switch (c->dstFormat) { +- case PIX_FMT_BGR24: +- gbr24ptopacked24((const uint8_t* []) {src[1], src[0], src[2]}, (int []) {srcStride[1], srcStride[0], srcStride[2]}, ++ case PIX_FMT_BGR24: { ++ const uint8_t* src2[] = {src[1], src[0], src[2]}; ++ int srcStride2[] = {srcStride[1], srcStride[0], srcStride[2]}; ++ gbr24ptopacked24(src2, srcStride2, + dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, c->srcW); + break; +- +- case PIX_FMT_RGB24: +- gbr24ptopacked24((const uint8_t* []) {src[2], src[0], src[1]}, (int []) {srcStride[2], srcStride[0], srcStride[1]}, ++ } ++ case PIX_FMT_RGB24: { ++ const uint8_t* src2[] = {src[2], src[0], src[1]}; ++ int srcStride2[] = {srcStride[2], srcStride[0], srcStride[1]}; ++ gbr24ptopacked24(src2, srcStride2, + dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, c->srcW); + break; +- ++ } + case PIX_FMT_ARGB: + alpha_first = 1; +- case PIX_FMT_RGBA: +- gbr24ptopacked32((const uint8_t* []) {src[2], src[0], src[1]}, (int []) {srcStride[2], srcStride[0], srcStride[1]}, ++ case PIX_FMT_RGBA: { ++ const uint8_t* src2[] = {src[2], src[0], src[1]}; ++ int srcStride2[] = {srcStride[2], srcStride[0], srcStride[1]}; ++ gbr24ptopacked32(src2, srcStride2, + dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, alpha_first, c->srcW); + break; +- ++ } + case PIX_FMT_ABGR: + alpha_first = 1; +- case PIX_FMT_BGRA: +- gbr24ptopacked32((const uint8_t* []) {src[1], src[0], src[2]}, (int []) {srcStride[1], srcStride[0], srcStride[2]}, ++ case PIX_FMT_BGRA: { ++ const uint8_t* src2[] = {src[1], src[0], src[2]}; ++ int srcStride2[] = {srcStride[1], srcStride[0], srcStride[2]}; ++ gbr24ptopacked32(src2, srcStride2, + dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, alpha_first, c->srcW); + break; +- ++ } + default: + av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", + av_get_pix_fmt_name(c->srcFormat), av_get_pix_fmt_name(c->dstFormat)); +-- +1.8.3.4 + + +From 9d9419ac69fb662487b172508ba4f85e14549f6b Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Fri, 7 Nov 2014 12:28:02 +0100 +Subject: Backport http://trac.ffmpeg.org/ticket/452 + +* Support for APE files with different sample bit widths. + +diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c +index 89d023b..464adc8 100644 +--- a/libavcodec/apedec.c ++++ b/libavcodec/apedec.c +@@ -133,6 +133,7 @@ typedef struct APEContext { + DSPContext dsp; + int channels; + int samples; ///< samples left to decode in current frame ++ int bps; + + int fileversion; ///< codec version, very important in decoding process + int compression_level; ///< compression levels +@@ -183,14 +184,25 @@ static av_cold int ape_decode_init(AVCodecContext *avctx) + av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n"); + return AVERROR(EINVAL); + } +- if (avctx->bits_per_coded_sample != 16) { +- av_log(avctx, AV_LOG_ERROR, "Only 16-bit samples are supported\n"); +- return AVERROR(EINVAL); +- } + if (avctx->channels > 2) { + av_log(avctx, AV_LOG_ERROR, "Only mono and stereo is supported\n"); + return AVERROR(EINVAL); + } ++ s->bps = avctx->bits_per_coded_sample; ++ switch(s->bps) { ++ case 8: ++ avctx->sample_fmt = AV_SAMPLE_FMT_U8; ++ break; ++ case 16: ++ avctx->sample_fmt = AV_SAMPLE_FMT_S16; ++ break; ++ case 24: ++ avctx->sample_fmt = AV_SAMPLE_FMT_S32; ++ break; ++ default: ++ av_log_ask_for_sample(avctx, "Unsupported bits per decoded sample %d\n", s->bps); ++ return AVERROR_PATCHWELCOME; ++ } + s->avctx = avctx; + s->channels = avctx->channels; + s->fileversion = AV_RL16(avctx->extradata); +@@ -214,7 +226,6 @@ static av_cold int ape_decode_init(AVCodecContext *avctx) + } + + dsputil_init(&s->dsp, avctx); +- avctx->sample_fmt = AV_SAMPLE_FMT_S16; + avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; + + avcodec_get_frame_defaults(&s->frame); +@@ -819,7 +830,9 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data, + const uint8_t *buf = avpkt->data; + int buf_size = avpkt->size; + APEContext *s = avctx->priv_data; +- int16_t *samples; ++ uint8_t *samples8; ++ int16_t *samples16; ++ int32_t *samples24; + int i, ret; + int blockstodecode; + +@@ -891,7 +904,6 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data, + av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + return ret; + } +- samples = (int16_t *)s->frame.data[0]; + + s->error=0; + +@@ -907,11 +919,32 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data, + return AVERROR_INVALIDDATA; + } + +- for (i = 0; i < blockstodecode; i++) { +- *samples++ = s->decoded0[i]; +- if(s->channels == 2) +- *samples++ = s->decoded1[i]; +- } ++ switch(s->bps) { ++ case 8: ++ samples8 = (uint8_t*)s->frame.data[0]; ++ for (i = 0; i < blockstodecode; i++) { ++ *samples8++ = (s->decoded0[i] + 0x80) & 0xff; ++ if (s->channels == 2) ++ *samples8++ = (s->decoded1[i] + 0x80) & 0xff; ++ } ++ break; ++ case 16: ++ samples16 = (int16_t*)s->frame.data[0]; ++ for (i = 0; i < blockstodecode; i++) { ++ *samples16++ = s->decoded0[i]; ++ if (s->channels == 2) ++ *samples16++ = s->decoded1[i]; ++ } ++ break; ++ case 24: ++ samples24 = (int32_t*)s->frame.data[0]; ++ for (i = 0; i < blockstodecode; i++) { ++ *samples24++ = s->decoded0[i] << 8; ++ if (s->channels == 2) ++ *samples24++ = s->decoded1[i] << 8; ++ } ++ break; ++ } + + s->samples -= blockstodecode; + +-- +1.8.3.4 + + +From 370f9377134aac06ad163b79446e841eda96698e Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +Date: Thu, 4 Dec 2014 13:31:12 +0100 +Subject: Fix undefined symbols for gcc2 + +ffmpeg relies on the compiler to optimize "if(0) function()" and not +emit a reference to the function. Gcc2 doesn't always figure this out so +switch everything to using #ifdef. + +diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c +index 581e5f5..cf7dedc 100644 +--- a/libavcodec/ac3dsp.c ++++ b/libavcodec/ac3dsp.c +@@ -228,8 +228,10 @@ av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact) + c->sum_square_butterfly_int32 = ac3_sum_square_butterfly_int32_c; + c->sum_square_butterfly_float = ac3_sum_square_butterfly_float_c; + +- if (ARCH_ARM) ++#if ARCH_ARM + ff_ac3dsp_init_arm(c, bit_exact); +- if (HAVE_MMX) ++#endif ++#if HAVE_MMX + ff_ac3dsp_init_x86(c, bit_exact); ++#endif + } +diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c +index 32f3f52..970c5ed 100644 +--- a/libavcodec/allcodecs.c ++++ b/libavcodec/allcodecs.c +@@ -54,6 +54,7 @@ void avcodec_register_all(void) + initialized = 1; + + /* hardware accelerators */ ++#if 0 + REGISTER_HWACCEL (H263_VAAPI, h263_vaapi); + REGISTER_HWACCEL (H264_DXVA2, h264_dxva2); + REGISTER_HWACCEL (H264_VAAPI, h264_vaapi); +@@ -67,6 +68,7 @@ void avcodec_register_all(void) + REGISTER_HWACCEL (VC1_VAAPI, vc1_vaapi); + REGISTER_HWACCEL (WMV3_DXVA2, wmv3_dxva2); + REGISTER_HWACCEL (WMV3_VAAPI, wmv3_vaapi); ++#endif + + /* video codecs */ + REGISTER_ENCODER (A64MULTI, a64multi); +@@ -126,8 +128,10 @@ void avcodec_register_all(void) + REGISTER_DECODER (H263I, h263i); + REGISTER_ENCODER (H263P, h263p); + REGISTER_DECODER (H264, h264); ++#ifndef __HAIKU__ + REGISTER_DECODER (H264_CRYSTALHD, h264_crystalhd); + REGISTER_DECODER (H264_VDPAU, h264_vdpau); ++#endif + REGISTER_ENCDEC (HUFFYUV, huffyuv); + REGISTER_DECODER (IDCIN, idcin); + REGISTER_DECODER (IFF_BYTERUN1, iff_byterun1); +diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c +index 464adc8..cd99900 100644 +--- a/libavcodec/apedec.c ++++ b/libavcodec/apedec.c +@@ -193,6 +193,7 @@ static av_cold int ape_decode_init(AVCodecContext *avctx) + case 8: + avctx->sample_fmt = AV_SAMPLE_FMT_U8; + break; ++ case 0: + case 16: + avctx->sample_fmt = AV_SAMPLE_FMT_S16; + break; +diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c +index dd4994d..7a980a1 100644 +--- a/libavcodec/dcadsp.c ++++ b/libavcodec/dcadsp.c +@@ -47,5 +47,7 @@ static void dca_lfe_fir_c(float *out, const float *in, const float *coefs, + void ff_dcadsp_init(DCADSPContext *s) + { + s->lfe_fir = dca_lfe_fir_c; +- if (ARCH_ARM) ff_dcadsp_init_arm(s); ++#if ARCH_ARM ++ ff_dcadsp_init_arm(s); ++#endif + } +diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c +index dab74cc..0d6d2d0 100644 +--- a/libavcodec/dsputil.c ++++ b/libavcodec/dsputil.c +@@ -3174,15 +3174,31 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) + } + + +- if (HAVE_MMX) dsputil_init_mmx (c, avctx); +- if (ARCH_ARM) dsputil_init_arm (c, avctx); +- if (CONFIG_MLIB) dsputil_init_mlib (c, avctx); +- if (HAVE_VIS) dsputil_init_vis (c, avctx); +- if (ARCH_ALPHA) dsputil_init_alpha (c, avctx); +- if (ARCH_PPC) dsputil_init_ppc (c, avctx); +- if (HAVE_MMI) dsputil_init_mmi (c, avctx); +- if (ARCH_SH4) dsputil_init_sh4 (c, avctx); +- if (ARCH_BFIN) dsputil_init_bfin (c, avctx); ++#if HAVE_MMX ++ dsputil_init_mmx (c, avctx); ++#endif ++#if ARCH_ARM ++ dsputil_init_arm (c, avctx); ++#endif ++#if CONFIG_MLIB ++ dsputil_init_mlib (c, avctx); ++#endif ++#if HAVE_VIS ++ dsputil_init_vis (c, avctx); ++#endif ++#if ARCH_ALPHA ++ dsputil_init_alpha (c, avctx); ++#elif ARCH_PPC ++ dsputil_init_ppc (c, avctx); ++#endif ++#if HAVE_MMI ++ dsputil_init_mmi (c, avctx); ++#endif ++#if ARCH_SH4 ++ dsputil_init_sh4 (c, avctx); ++#elif ARCH_BFIN ++ dsputil_init_bfin (c, avctx); ++#endif + + for (i = 0; i < 4; i++) { + for (j = 0; j < 16; j++) { +diff --git a/libavcodec/fft.c b/libavcodec/fft.c +index 4eb46f1..6197bd0 100644 +--- a/libavcodec/fft.c ++++ b/libavcodec/fft.c +@@ -158,13 +158,21 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) + #endif + + #if CONFIG_FFT_FLOAT +- if (ARCH_ARM) ff_fft_init_arm(s); +- if (HAVE_ALTIVEC) ff_fft_init_altivec(s); +- if (HAVE_MMX) ff_fft_init_mmx(s); ++#if ARCH_ARM ++ ff_fft_init_arm(s); ++#endif ++#if HAVE_ALTIVEC ++ ff_fft_init_altivec(s); ++#endif ++#if HAVE_MMX ++ ff_fft_init_mmx(s); ++#endif + if (CONFIG_MDCT) s->mdct_calcw = s->mdct_calc; + #else + if (CONFIG_MDCT) s->mdct_calcw = ff_mdct_calcw_c; +- if (ARCH_ARM) ff_fft_fixed_init_arm(s); ++#if ARCH_ARM ++ ff_fft_fixed_init_arm(s); ++#endif + #endif + + for(j=4; j<=nbits; j++) { +diff --git a/libavcodec/fmtconvert.c b/libavcodec/fmtconvert.c +index c03117c..037bdf5 100644 +--- a/libavcodec/fmtconvert.c ++++ b/libavcodec/fmtconvert.c +@@ -82,9 +82,15 @@ av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx) + c->float_to_int16_interleave = float_to_int16_interleave_c; + c->float_interleave = ff_float_interleave_c; + +- if (ARCH_ARM) ff_fmt_convert_init_arm(c, avctx); +- if (HAVE_ALTIVEC) ff_fmt_convert_init_altivec(c, avctx); +- if (HAVE_MMX) ff_fmt_convert_init_x86(c, avctx); ++#if ARCH_ARM ++ ff_fmt_convert_init_arm(c, avctx); ++#endif ++#if HAVE_ALTIVEC ++ ff_fmt_convert_init_altivec(c, avctx); ++#endif ++#if HAVE_MMX ++ ff_fmt_convert_init_x86(c, avctx); ++#endif + } + + /* ffdshow custom code */ +diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c +index 07fa430..0e3b2d9 100644 +--- a/libavcodec/h263dec.c ++++ b/libavcodec/h263dec.c +@@ -643,10 +643,12 @@ retry: + + if (!s->divx_packed) ff_thread_finish_setup(avctx); + +- if (CONFIG_MPEG4_VDPAU_DECODER && (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)) { ++#if CONFIG_MPEG4_VDPAU_DECODER ++ if ((s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)) { + ff_vdpau_mpeg4_decode_picture(s, s->gb.buffer, s->gb.buffer_end - s->gb.buffer); + goto frame_end; + } ++#endif + + if (avctx->hwaccel) { + if (avctx->hwaccel->start_frame(avctx, s->gb.buffer, s->gb.buffer_end - s->gb.buffer) < 0) +diff --git a/libavcodec/h264.c b/libavcodec/h264.c +index 981adb4..3315ff4 100644 +--- a/libavcodec/h264.c ++++ b/libavcodec/h264.c +@@ -2509,8 +2509,10 @@ static int field_end(H264Context *h, int in_setup){ + ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, + s->picture_structure == PICT_BOTTOM_FIELD); + +- if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) ++#if CONFIG_H264_VDPAU_DECODER ++ if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) + ff_vdpau_h264_set_reference_frames(s); ++#endif + + if(in_setup || !(avctx->active_thread_type&FF_THREAD_FRAME)){ + if(!s->dropable) { +@@ -2528,8 +2530,10 @@ static int field_end(H264Context *h, int in_setup){ + av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n"); + } + +- if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) ++#if CONFIG_H264_VDPAU_DECODER ++ if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) + ff_vdpau_h264_picture_complete(s); ++#endif + + /* + * FIXME: Error handling code does not seem to support interlaced +@@ -4085,8 +4089,10 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ + + if (s->avctx->hwaccel && s->avctx->hwaccel->start_frame(s->avctx, NULL, 0) < 0) + return -1; +- if(CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) ++#if CONFIG_H264_VDPAU_DECODER ++ if(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) + ff_vdpau_h264_picture_start(s); ++#endif + } + + if(hx->redundant_pic_count==0 +@@ -4098,11 +4104,13 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ + if (avctx->hwaccel->decode_slice(avctx, &buf[buf_index - consumed], consumed) < 0) + return -1; + }else +- if(CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU){ ++#if CONFIG_H264_VDPAU_DECODER ++ if(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU){ + static const uint8_t start_code[] = {0x00, 0x00, 0x01}; + ff_vdpau_add_data_chunk(s, start_code, sizeof(start_code)); + ff_vdpau_add_data_chunk(s, &buf[buf_index - consumed], consumed ); + }else ++#endif + context_count++; + } + break; +diff --git a/libavcodec/h264dsp.c b/libavcodec/h264dsp.c +index eeee6a2..5340347 100644 +--- a/libavcodec/h264dsp.c ++++ b/libavcodec/h264dsp.c +@@ -111,7 +111,13 @@ void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, const int chroma_fo + break; + } + +- if (ARCH_ARM) ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc); +- if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc); +- if (HAVE_MMX) ff_h264dsp_init_x86(c, bit_depth, chroma_format_idc); ++#if ARCH_ARM ++ ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc); ++#endif ++#if HAVE_ALTIVEC ++ ff_h264dsp_init_ppc(c, bit_depth, chroma_format_idc); ++#endif ++#if HAVE_MMX ++ ff_h264dsp_init_x86(c, bit_depth, chroma_format_idc); ++#endif + } +diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c +index e3efdf9..be57d63 100644 +--- a/libavcodec/h264pred.c ++++ b/libavcodec/h264pred.c +@@ -532,6 +532,10 @@ void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, co + break; + } + +- if (ARCH_ARM) ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc); +- if (HAVE_MMX) ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc); ++#if ARCH_ARM ++ ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc); ++#endif ++#if HAVE_MMX ++ ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc); ++#endif + } +diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c +index 58456a6..8e0568e 100644 +--- a/libavcodec/mpeg12.c ++++ b/libavcodec/mpeg12.c +@@ -843,12 +843,14 @@ static int mpeg_decode_mb(MpegEncContext *s, DCTELEM block[12][64]) + memset(s->last_mv, 0, sizeof(s->last_mv)); /* reset mv prediction */ + s->mb_intra = 1; + // if 1, we memcpy blocks in xvmcvideo +- if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) { ++#if CONFIG_MPEG_XVMC_DECODER ++ if (s->avctx->xvmc_acceleration > 1) { + ff_xvmc_pack_pblocks(s, -1); // inter are always full blocks + if (s->swap_uv) { + exchange_uv(s); + } + } ++#endif + + if (s->codec_id == CODEC_ID_MPEG2VIDEO) { + if (s->flags2 & CODEC_FLAG2_FAST) { +@@ -1061,12 +1063,14 @@ static int mpeg_decode_mb(MpegEncContext *s, DCTELEM block[12][64]) + } + + //if 1, we memcpy blocks in xvmcvideo +- if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) { ++#if CONFIG_MPEG_XVMC_DECODER ++ if (s->avctx->xvmc_acceleration > 1) { + ff_xvmc_pack_pblocks(s, cbp); + if (s->swap_uv) { + exchange_uv(s); + } + } ++#endif + + if (s->codec_id == CODEC_ID_MPEG2VIDEO) { + if (s->flags2 & CODEC_FLAG2_FAST) { +@@ -1654,9 +1658,11 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) + + // MPV_frame_start will call this function too, + // but we need to call it on every field +- if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) ++#if CONFIG_MPEG_XVMC_DECODER ++ if (s->avctx->xvmc_acceleration) + if (ff_xvmc_field_start(s, avctx) < 0) + return -1; ++#endif + + return 0; + } +@@ -1758,8 +1764,10 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, + + for (;;) { + // If 1, we memcpy blocks in xvmcvideo. +- if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1) ++#if CONFIG_MPEG_XVMC_DECODER ++ if (s->avctx->xvmc_acceleration > 1) + ff_xvmc_init_block(s); // set s->block ++#endif + + if (mpeg_decode_mb(s, s->block) < 0) + return -1; +@@ -1947,8 +1955,10 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) + av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n"); + } + +- if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) ++#if CONFIG_MPEG_XVMC_DECODER ++ if (s->avctx->xvmc_acceleration) + ff_xvmc_field_end(s); ++#endif + + /* end of slice reached */ + if (/*s->mb_y << field_pic == s->mb_height &&*/ !s->first_field && !s->first_slice) { +diff --git a/libavcodec/mpegaudiodsp.c b/libavcodec/mpegaudiodsp.c +index cc12dd9..b7b95fd 100644 +--- a/libavcodec/mpegaudiodsp.c ++++ b/libavcodec/mpegaudiodsp.c +@@ -40,7 +40,13 @@ void ff_mpadsp_init(MPADSPContext *s) + s->imdct36_blocks_float = ff_imdct36_blocks_float; + s->imdct36_blocks_fixed = ff_imdct36_blocks_fixed; + +- if (ARCH_ARM) ff_mpadsp_init_arm(s); +- if (HAVE_MMX) ff_mpadsp_init_mmx(s); +- if (HAVE_ALTIVEC) ff_mpadsp_init_altivec(s); ++#if ARCH_ARM ++ ff_mpadsp_init_arm(s); ++#endif ++#if HAVE_MMX ++ ff_mpadsp_init_mmx(s); ++#endif ++#if HAVE_ALTIVEC ++ ff_mpadsp_init_altivec(s); ++#endif + } +diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c +index 9bb862a..0bedbeb 100644 +--- a/libavcodec/mpegvideo.c ++++ b/libavcodec/mpegvideo.c +@@ -1330,8 +1330,10 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) + update_noise_reduction(s); + } + +- if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) ++#if CONFIG_MPEG_XVMC_DECODER ++ if (s->avctx->xvmc_acceleration) + return ff_xvmc_field_start(s, avctx); ++#endif + + return 0; + } +@@ -1343,9 +1345,12 @@ void MPV_frame_end(MpegEncContext *s) + int i; + /* redraw edges for the frame if decoding didn't complete */ + // just to make sure that all data is rendered. ++#if CONFIG_MPEG_XVMC_DECODER + if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { + ff_xvmc_field_end(s); +- } else if((s->error_count || s->encoding || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) && ++ } else ++#endif ++ if((s->error_count || s->encoding || !(s->avctx->codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND)) && + !s->avctx->hwaccel && + !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) && + s->unrestricted_mv && +diff --git a/libavcodec/rdft.c b/libavcodec/rdft.c +index ebddd8b..66918f9 100644 +--- a/libavcodec/rdft.c ++++ b/libavcodec/rdft.c +@@ -122,7 +122,9 @@ av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) + #endif + s->rdft_calc = ff_rdft_calc_c; + +- if (ARCH_ARM) ff_rdft_init_arm(s); ++#if ARCH_ARM ++ ff_rdft_init_arm(s); ++#endif + + return 0; + } +diff --git a/libavcodec/rv34dsp.c b/libavcodec/rv34dsp.c +index 919703d..4f4918d 100644 +--- a/libavcodec/rv34dsp.c ++++ b/libavcodec/rv34dsp.c +@@ -134,8 +134,10 @@ av_cold void ff_rv34dsp_init(RV34DSPContext *c, DSPContext* dsp) { + c->rv34_idct_add = rv34_idct_add_c; + c->rv34_idct_dc_add = rv34_idct_dc_add_c; + +- if (HAVE_NEON) ++#if HAVE_NEON + ff_rv34dsp_init_neon(c, dsp); +- if (HAVE_MMX) ++#endif ++#if HAVE_MMX + ff_rv34dsp_init_x86(c, dsp); ++#endif + } +diff --git a/libavcodec/rv40dsp.c b/libavcodec/rv40dsp.c +index 913ced0..e16f1e6 100644 +--- a/libavcodec/rv40dsp.c ++++ b/libavcodec/rv40dsp.c +@@ -588,8 +588,10 @@ av_cold void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp) { + c->rv40_loop_filter_strength[0] = rv40_h_loop_filter_strength; + c->rv40_loop_filter_strength[1] = rv40_v_loop_filter_strength; + +- if (HAVE_MMX) ++#if HAVE_MMX + ff_rv40dsp_init_x86(c, dsp); +- if (HAVE_NEON) ++#endif ++#if HAVE_NEON + ff_rv40dsp_init_neon(c, dsp); ++#endif + } +diff --git a/libavcodec/synth_filter.c b/libavcodec/synth_filter.c +index 5f10530..1009c53 100644 +--- a/libavcodec/synth_filter.c ++++ b/libavcodec/synth_filter.c +@@ -60,5 +60,7 @@ av_cold void ff_synth_filter_init(SynthFilterContext *c) + { + c->synth_filter_float = synth_filter_float; + +- if (ARCH_ARM) ff_synth_filter_init_arm(c); ++#if ARCH_ARM ++ ff_synth_filter_init_arm(c); ++#endif + } +diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c +index 5f745ad..849ab69 100644 +--- a/libavcodec/vc1dec.c ++++ b/libavcodec/vc1dec.c +@@ -5571,10 +5571,12 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, + s->me.qpel_put = s->dsp.put_qpel_pixels_tab; + s->me.qpel_avg = s->dsp.avg_qpel_pixels_tab; + +- if ((CONFIG_VC1_VDPAU_DECODER) +- &&s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) ++#if CONFIG_VC1_VDPAU_DECODER ++ if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) + ff_vdpau_vc1_decode_picture(s, buf_start, (buf + buf_size) - buf_start); +- else if (avctx->hwaccel) { ++ else ++#endif ++ if (avctx->hwaccel) { + if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0) + goto err; + if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0) +diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c +index da7593f..38a28aa 100644 +--- a/libavcodec/vc1dsp.c ++++ b/libavcodec/vc1dsp.c +@@ -846,8 +846,10 @@ av_cold void ff_vc1dsp_init(VC1DSPContext* dsp) { + dsp->sprite_v_double_twoscale = sprite_v_double_twoscale_c; + #endif + +- if (HAVE_ALTIVEC) ++#if (HAVE_ALTIVEC) + ff_vc1dsp_init_altivec(dsp); +- if (HAVE_MMX) ++#endif ++#if (HAVE_MMX) + ff_vc1dsp_init_mmx(dsp); ++#endif + } +diff --git a/libavcodec/vp56dsp.c b/libavcodec/vp56dsp.c +index c629343..782bb39 100644 +--- a/libavcodec/vp56dsp.c ++++ b/libavcodec/vp56dsp.c +@@ -88,6 +88,10 @@ void ff_vp56dsp_init(VP56DSPContext *s, enum CodecID codec) + } + } + +- if (ARCH_ARM) ff_vp56dsp_init_arm(s, codec); +- if (HAVE_MMX) ff_vp56dsp_init_x86(s, codec); ++#if ARCH_ARM ++ ff_vp56dsp_init_arm(s, codec); ++#endif ++#if HAVE_MMX ++ ff_vp56dsp_init_x86(s, codec); ++#endif + } +diff --git a/libavcodec/vp8dsp.c b/libavcodec/vp8dsp.c +index af46b28..8f7564e 100644 +--- a/libavcodec/vp8dsp.c ++++ b/libavcodec/vp8dsp.c +@@ -520,10 +520,13 @@ av_cold void ff_vp8dsp_init(VP8DSPContext *dsp) + VP8_BILINEAR_MC_FUNC(1, 8); + VP8_BILINEAR_MC_FUNC(2, 4); + +- if (HAVE_MMX) ++#if (HAVE_MMX) + ff_vp8dsp_init_x86(dsp); +- if (HAVE_ALTIVEC) ++#endif ++#if (HAVE_ALTIVEC) + ff_vp8dsp_init_altivec(dsp); +- if (ARCH_ARM) ++#endif ++#if (ARCH_ARM) + ff_vp8dsp_init_arm(dsp); ++#endif + } +diff --git a/libavcodec/x86/ac3dsp_mmx.c b/libavcodec/x86/ac3dsp_mmx.c +index df5e77a..ea66b43 100644 +--- a/libavcodec/x86/ac3dsp_mmx.c ++++ b/libavcodec/x86/ac3dsp_mmx.c +@@ -57,20 +57,25 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact) + c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx; + c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx; + } +- if (mm_flags & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) { ++#if HAVE_AMD3DNOW ++ if (mm_flags & AV_CPU_FLAG_3DNOW) { + c->extract_exponents = ff_ac3_extract_exponents_3dnow; + if (!bit_exact) { + c->float_to_fixed24 = ff_float_to_fixed24_3dnow; + } + } +- if (mm_flags & AV_CPU_FLAG_MMX2 && HAVE_MMX2) { ++#endif ++#if HAVE_MMX2 ++ if (mm_flags & AV_CPU_FLAG_MMX2) { + c->ac3_exponent_min = ff_ac3_exponent_min_mmxext; + c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmxext; + } +- if (mm_flags & AV_CPU_FLAG_SSE && HAVE_SSE) { ++#endif ++#if HAVE_SSE ++ if (mm_flags & AV_CPU_FLAG_SSE) { + c->float_to_fixed24 = ff_float_to_fixed24_sse; + } +- if (mm_flags & AV_CPU_FLAG_SSE2 && HAVE_SSE) { ++ if (mm_flags & AV_CPU_FLAG_SSE2) { + c->ac3_exponent_min = ff_ac3_exponent_min_sse2; + c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2; + c->float_to_fixed24 = ff_float_to_fixed24_sse2; +@@ -81,11 +86,14 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact) + c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2; + } + } +- if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) { ++#endif ++#if HAVE_SSSE3 ++ if (mm_flags & AV_CPU_FLAG_SSSE3) { + c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3; + if (!(mm_flags & AV_CPU_FLAG_ATOM)) { + c->extract_exponents = ff_ac3_extract_exponents_ssse3; + } + } + #endif ++#endif + } +diff --git a/libavcodec/x86/fft.c b/libavcodec/x86/fft.c +index 7918fcb..cf81caa 100644 +--- a/libavcodec/x86/fft.c ++++ b/libavcodec/x86/fft.c +@@ -25,6 +25,7 @@ av_cold void ff_fft_init_mmx(FFTContext *s) + { + #if HAVE_YASM + int has_vectors = av_get_cpu_flags(); ++#if HAVE_AVX + if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX && s->nbits >= 5) { + /* AVX for SB */ + s->imdct_calc = ff_imdct_calc_sse; +@@ -32,7 +33,10 @@ av_cold void ff_fft_init_mmx(FFTContext *s) + s->fft_permute = ff_fft_permute_sse; + s->fft_calc = ff_fft_calc_avx; + s->fft_permutation = FF_FFT_PERM_AVX; +- } else if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) { ++ } else ++#endif ++#if HAVE_SSE ++ if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) { + /* SSE for P3/P4/K8 */ + s->imdct_calc = ff_imdct_calc_sse; + s->imdct_half = ff_imdct_half_sse; +@@ -41,6 +45,7 @@ av_cold void ff_fft_init_mmx(FFTContext *s) + s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; + } + #endif ++#endif + } + + #if CONFIG_DCT +@@ -48,13 +53,18 @@ av_cold void ff_dct_init_mmx(DCTContext *s) + { + #if HAVE_YASM + int has_vectors = av_get_cpu_flags(); +- if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX) ++#if HAVE_AVX ++ if (has_vectors & AV_CPU_FLAG_AVX) + s->dct32 = ff_dct32_float_avx; +- else if (has_vectors & AV_CPU_FLAG_SSE2 && HAVE_SSE) ++ else ++#endif ++#if HAVE_SSE ++ if (has_vectors & AV_CPU_FLAG_SSE2) + s->dct32 = ff_dct32_float_sse2; +- else if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) ++ else if (has_vectors & AV_CPU_FLAG_SSE) + s->dct32 = ff_dct32_float_sse; + #endif ++#endif + } + #endif + +diff --git a/libavcodec/x86/h264dsp_mmx.c b/libavcodec/x86/h264dsp_mmx.c +index fdf44c5..7bc1c18 100644 +--- a/libavcodec/x86/h264dsp_mmx.c ++++ b/libavcodec/x86/h264dsp_mmx.c +@@ -419,6 +419,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth, const int chrom + c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16_ssse3; + c->biweight_h264_pixels_tab[1]= ff_h264_biweight_8_ssse3; + } ++#if HAVE_AVX + if (HAVE_AVX && mm_flags&AV_CPU_FLAG_AVX) { + #if HAVE_ALIGNED_STACK + c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_avx; +@@ -427,6 +428,7 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth, const int chrom + c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_avx; + #endif + } ++#endif + } + } + #endif +diff --git a/libavcodec/x86/v210-init.c b/libavcodec/x86/v210-init.c +index 425c628..b881624 100644 +--- a/libavcodec/x86/v210-init.c ++++ b/libavcodec/x86/v210-init.c +@@ -34,15 +34,19 @@ av_cold void v210_x86_init(V210DecContext *s) + if (cpu_flags & AV_CPU_FLAG_SSSE3) + s->unpack_frame = ff_v210_planar_unpack_aligned_ssse3; + +- if (HAVE_AVX && cpu_flags & AV_CPU_FLAG_AVX) ++#if HAVE_AVX ++ if (cpu_flags & AV_CPU_FLAG_AVX) + s->unpack_frame = ff_v210_planar_unpack_aligned_avx; ++#endif + } + else { + if (cpu_flags & AV_CPU_FLAG_SSSE3) + s->unpack_frame = ff_v210_planar_unpack_unaligned_ssse3; + +- if (HAVE_AVX && cpu_flags & AV_CPU_FLAG_AVX) ++#if HAVE_AVX ++ if (cpu_flags & AV_CPU_FLAG_AVX) + s->unpack_frame = ff_v210_planar_unpack_unaligned_avx; ++#endif + } + #endif + } +diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c +index 161c3b4..7dfe988 100644 +--- a/libavdevice/alldevices.c ++++ b/libavdevice/alldevices.c +@@ -38,22 +38,22 @@ void avdevice_register_all(void) + initialized = 1; + + /* devices */ +- REGISTER_INOUTDEV (ALSA, alsa); ++ //REGISTER_INOUTDEV (ALSA, alsa); + REGISTER_INDEV (BKTR, bktr); +- REGISTER_INDEV (DSHOW, dshow); +- REGISTER_INDEV (DV1394, dv1394); ++ //REGISTER_INDEV (DSHOW, dshow); ++ //REGISTER_INDEV (DV1394, dv1394); + REGISTER_INDEV (FBDEV, fbdev); +- REGISTER_INDEV (JACK, jack); ++ //REGISTER_INDEV (JACK, jack); + REGISTER_INDEV (LAVFI, lavfi); + REGISTER_INDEV (OPENAL, openal); + REGISTER_INOUTDEV (OSS, oss); + REGISTER_INDEV (PULSE, pulse); + REGISTER_OUTDEV (SDL, sdl); + REGISTER_INOUTDEV (SNDIO, sndio); +- REGISTER_INDEV (V4L2, v4l2); +- REGISTER_INDEV (V4L, v4l); +- REGISTER_INDEV (VFWCAP, vfwcap); +- REGISTER_INDEV (X11_GRAB_DEVICE, x11_grab_device); ++ //REGISTER_INDEV (V4L2, v4l2); ++ //REGISTER_INDEV (V4L, v4l); ++ //REGISTER_INDEV (VFWCAP, vfwcap); ++ //REGISTER_INDEV (X11_GRAB_DEVICE, x11_grab_device); + + /* external libraries */ + REGISTER_INDEV (LIBCDIO, libcdio); +diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c +index ef99298..e083934 100644 +--- a/libavfilter/allfilters.c ++++ b/libavfilter/allfilters.c +@@ -55,7 +55,7 @@ void avfilter_register_all(void) + REGISTER_FILTER (ABUFFERSINK, abuffersink, asink); + REGISTER_FILTER (ANULLSINK, anullsink, asink); + +- REGISTER_FILTER (ASS, ass, vf); ++ //REGISTER_FILTER (ASS, ass, vf); + REGISTER_FILTER (BLACKFRAME, blackframe, vf); + REGISTER_FILTER (BOXBLUR, boxblur, vf); + REGISTER_FILTER (COPY, copy, vf); +diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c +index 3a96373..d813ecf 100644 +--- a/libavfilter/vf_yadif.c ++++ b/libavfilter/vf_yadif.c +@@ -380,12 +380,20 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) + if (args) sscanf(args, "%d:%d:%d", &yadif->mode, &yadif->parity, &yadif->auto_enable); + + yadif->filter_line = filter_line_c; ++#if HAVE_SSSE3 + if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3) + yadif->filter_line = ff_yadif_filter_line_ssse3; +- else if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) ++ else ++#endif ++#if HAVE_SSE ++ if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) + yadif->filter_line = ff_yadif_filter_line_sse2; +- else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ++ else ++#endif ++#if HAVE_MMX ++ if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) + yadif->filter_line = ff_yadif_filter_line_mmx; ++#endif + + av_log(ctx, AV_LOG_INFO, "mode:%d parity:%d auto_enable:%d\n", yadif->mode, yadif->parity, yadif->auto_enable); + +diff --git a/libavformat/allformats.c b/libavformat/allformats.c +index 134839f..7b3d63d 100644 +--- a/libavformat/allformats.c ++++ b/libavformat/allformats.c +@@ -48,7 +48,9 @@ void av_register_all(void) + avcodec_register_all(); + + /* (de)muxers */ ++#ifndef __HAIKU__ + REGISTER_MUXER (A64, a64); ++#endif + REGISTER_DEMUXER (AAC, aac); + REGISTER_MUXDEMUX (AC3, ac3); + REGISTER_DEMUXER (ACT, act); +@@ -67,7 +69,9 @@ void av_register_all(void) + REGISTER_MUXER (ASF_STREAM, asf_stream); + REGISTER_MUXDEMUX (AU, au); + REGISTER_MUXDEMUX (AVI, avi); ++#if CONFIG_AVISYNTH_DEMUXER + REGISTER_DEMUXER (AVISYNTH, avisynth); ++#endif + REGISTER_MUXER (AVM2, avm2); + REGISTER_DEMUXER (AVS, avs); + REGISTER_DEMUXER (BETHSOFTVID, bethsoftvid); +diff --git a/libavutil/cpu.c b/libavutil/cpu.c +index fa64a83..c05196f 100644 +--- a/libavutil/cpu.c ++++ b/libavutil/cpu.c +@@ -31,9 +31,13 @@ int av_get_cpu_flags(void) + if (checked) + return flags; + +- if (ARCH_ARM) flags = ff_get_cpu_flags_arm(); +- if (ARCH_PPC) flags = ff_get_cpu_flags_ppc(); ++#if ARCH_ARM ++ flags = ff_get_cpu_flags_arm(); ++#elif ARCH_PPC ++ flags = ff_get_cpu_flags_ppc(); ++#else + if (ARCH_X86) flags = ff_get_cpu_flags_x86(); ++#endif + + checked = 1; + return flags; +diff --git a/libswscale/swscale.c b/libswscale/swscale.c +index a98a389..eca61ce 100644 +--- a/libswscale/swscale.c ++++ b/libswscale/swscale.c +@@ -3045,10 +3045,11 @@ SwsFunc ff_getSwsFunc(SwsContext *c) + { + sws_init_swScale_c(c); + +- if (HAVE_MMX) ++#if (HAVE_MMX) + ff_sws_init_swScale_mmx(c); +- if (HAVE_ALTIVEC) ++#elif (HAVE_ALTIVEC) + ff_sws_init_swScale_altivec(c); ++#endif + + return swScale; + } +diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c +index b98d38a..520fcba 100644 +--- a/libswscale/swscale_unscaled.c ++++ b/libswscale/swscale_unscaled.c +@@ -877,10 +877,11 @@ void ff_get_unscaled_swscale(SwsContext *c) + c->swScale = planarCopyWrapper; + } + +- if (ARCH_BFIN) ++#if (ARCH_BFIN) + ff_bfin_get_unscaled_swscale(c); +- if (HAVE_ALTIVEC) ++#elif (HAVE_ALTIVEC) + ff_swscale_get_unscaled_altivec(c); ++#endif + } + + static void reset_ptr(const uint8_t *src[], int format) +diff --git a/libswscale/utils.c b/libswscale/utils.c +index abd9993..c679ff4 100644 +--- a/libswscale/utils.c ++++ b/libswscale/utils.c +@@ -719,8 +719,10 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], + ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation); + //FIXME factorize + +- if (HAVE_ALTIVEC && av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) ++#if HAVE_ALTIVEC ++ if (av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) + ff_yuv2rgb_init_tables_altivec(c, inv_table, brightness, contrast, saturation); ++#endif + return 0; + } + +diff --git a/libswscale/x86/swscale_mmx.c b/libswscale/x86/swscale_mmx.c +index fdfd1f2..ded55ac 100644 +--- a/libswscale/x86/swscale_mmx.c ++++ b/libswscale/x86/swscale_mmx.c +@@ -503,7 +503,8 @@ switch(c->dstBpc){ \ + c->yuv2plane1 = ff_yuv2plane1_16_sse4; + } + +- if (HAVE_AVX && cpu_flags & AV_CPU_FLAG_AVX) { ++#if HAVE_AVX ++ if (cpu_flags & AV_CPU_FLAG_AVX) { + ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx,); + ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1); + +@@ -525,4 +526,5 @@ switch(c->dstBpc){ \ + } + } + #endif ++#endif + } +diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c +index 6100fbc..bb36732 100644 +--- a/libswscale/yuv2rgb.c ++++ b/libswscale/yuv2rgb.c +@@ -507,17 +507,17 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c) + { + SwsFunc t = NULL; + +- if (HAVE_MMX) { ++#if (HAVE_MMX) + t = ff_yuv2rgb_init_mmx(c); +- } else if (HAVE_VIS) { ++#elif (HAVE_VIS) + t = ff_yuv2rgb_init_vis(c); +- } else if (CONFIG_MLIB) { ++#elif (CONFIG_MLIB) + t = ff_yuv2rgb_init_mlib(c); +- } else if (HAVE_ALTIVEC) { ++#elif (HAVE_ALTIVEC) + t = ff_yuv2rgb_init_altivec(c); +- } else if (ARCH_BFIN) { ++#elif (ARCH_BFIN) + t = ff_yuv2rgb_get_func_ptr_bfin(c); +- } ++#endif + + if (t) + return t; -- 1.8.3.4