On 2012-10-10 23:47:27 +0200, Diego Biurrun wrote:
> ---
> Now tested to work with --disable-mmx, which required reshuffling
> OBJS/MMX-OBJS handling as well as a few ifdefs.
> 
>  libavcodec/dsputil.c          |    2 +-
>  libavcodec/dsputil.h          |    2 +-
>  libavcodec/dwt.c              |    2 +-
>  libavcodec/x86/Makefile       |   19 +++++++++----------
>  libavcodec/x86/dsputil_mmx.c  |    2 +-
>  libavfilter/vf_gradfun.c      |    2 +-
>  libavfilter/vf_yadif.c        |    2 +-
>  libavfilter/x86/Makefile      |    5 +++--
>  libswscale/rgb2rgb.c          |    2 +-
>  libswscale/swscale.c          |    4 ++--
>  libswscale/swscale_internal.h |    4 ++--
>  libswscale/x86/Makefile       |    6 +++---
>  libswscale/x86/swscale.c      |    6 +++---
>  libswscale/x86/yuv2rgb.c      |    6 +++---
>  libswscale/yuv2rgb.c          |    4 ++--
>  15 files changed, 34 insertions(+), 34 deletions(-)
> 
> diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
> index 5c705ea..3060deb 100644
> --- a/libavcodec/dsputil.c
> +++ b/libavcodec/dsputil.c
> @@ -2975,7 +2975,7 @@ av_cold void ff_dsputil_init(DSPContext* c, 
> AVCodecContext *avctx)
>      }
>  
>  
> -    if (HAVE_MMX)        ff_dsputil_init_mmx   (c, avctx);
> +    if (ARCH_X86)        ff_dsputil_init_x86   (c, avctx);
>      if (ARCH_ARM)        ff_dsputil_init_arm   (c, avctx);
>      if (HAVE_VIS)        ff_dsputil_init_vis   (c, avctx);
>      if (ARCH_ALPHA)      ff_dsputil_init_alpha (c, avctx);
> diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
> index 6ce41df..9f336f6 100644
> --- a/libavcodec/dsputil.h
> +++ b/libavcodec/dsputil.h
> @@ -606,10 +606,10 @@ void ff_dsputil_init_alpha(DSPContext* c, 
> AVCodecContext *avctx);
>  void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx);
>  void ff_dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx);
>  void ff_dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx);
> -void ff_dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
>  void ff_dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);
>  void ff_dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);
>  void ff_dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
> +void ff_dsputil_init_x86(DSPContext* c, AVCodecContext *avctx);
>  
>  void ff_dsputil_init_dwt(DSPContext *c);
>  void ff_mlp_init(DSPContext* c, AVCodecContext *avctx);
> diff --git a/libavcodec/dwt.c b/libavcodec/dwt.c
> index 93cf2c6..277dd68 100644
> --- a/libavcodec/dwt.c
> +++ b/libavcodec/dwt.c
> @@ -856,6 +856,6 @@ void ff_dwt_init(DWTContext *c)
>      c->horizontal_compose97i = ff_snow_horizontal_compose97i;
>      c->inner_add_yblock      = ff_snow_inner_add_yblock;
>  
> -    if (HAVE_MMX)
> +    if (ARCH_X86)
>          ff_dwt_init_x86(c);
>  }
> diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
> index 053290b..92bb375 100644
> --- a/libavcodec/x86/Makefile
> +++ b/libavcodec/x86/Makefile
> @@ -1,9 +1,17 @@
> -OBJS                                   += x86/fmtconvert_init.o
> +OBJS                                   += x86/dsputil_mmx.o             \
> +                                          x86/fdct.o                    \
> +                                          x86/fmtconvert_init.o         \
> +                                          x86/idct_mmx_xvid.o           \
> +                                          x86/idct_sse2_xvid.o          \
> +                                          x86/simple_idct.o             \

all added files have inline mmx*/sse2 asm only under #if HAVE_INLINE_ASM
resulting in bloat or build errors with historic compilers not
supporting those instructions. That's arguably already the case if only
MMX is enabled/supported. But unconditionally compiling unused code
seems wrong.

>  OBJS-$(CONFIG_AAC_DECODER)             += x86/sbrdsp_init.o
>  OBJS-$(CONFIG_AC3DSP)                  += x86/ac3dsp_init.o
>  OBJS-$(CONFIG_CAVS_DECODER)            += x86/cavsdsp.o
>  OBJS-$(CONFIG_DNXHD_ENCODER)           += x86/dnxhdenc.o
> +OBJS-$(CONFIG_DWT)                     += x86/snowdsp.o
> +OBJS-$(CONFIG_ENCODERS)                += x86/dsputilenc_mmx.o          \
> +                                          x86/motion_est.o
>  OBJS-$(CONFIG_FFT)                     += x86/fft_init.o
>  OBJS-$(CONFIG_H264DSP)                 += x86/h264dsp_init.o
>  OBJS-$(CONFIG_H264PRED)                += x86/h264_intrapred_init.o
> @@ -25,15 +33,6 @@ OBJS-$(CONFIG_VP6_DECODER)             += 
> x86/vp56dsp_init.o
>  OBJS-$(CONFIG_VP8_DECODER)             += x86/vp8dsp_init.o
>  OBJS-$(CONFIG_XMM_CLOBBER_TEST)        += x86/w64xmmtest.o
>  
> -MMX-OBJS                               += x86/dsputil_mmx.o             \
> -                                          x86/fdct.o                    \
> -                                          x86/idct_mmx_xvid.o           \
> -                                          x86/idct_sse2_xvid.o          \
> -                                          x86/simple_idct.o             \
> -
> -MMX-OBJS-$(CONFIG_DWT)                 += x86/snowdsp.o
> -MMX-OBJS-$(CONFIG_ENCODERS)            += x86/dsputilenc_mmx.o          \
> -                                          x86/motion_est.o
>  MMX-OBJS-$(CONFIG_VC1_DECODER)         += x86/vc1dsp_mmx.o
>  
>  YASM-OBJS-$(CONFIG_AAC_DECODER)        += x86/sbrdsp.o
> diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
> index 86a08cb..c4d05a7 100644
> --- a/libavcodec/x86/dsputil_mmx.c
> +++ b/libavcodec/x86/dsputil_mmx.c
> @@ -2848,7 +2848,7 @@ static void dsputil_init_avx(DSPContext *c, 
> AVCodecContext *avctx, int mm_flags)
>  #endif /* HAVE_AVX_EXTERNAL */
>  }
>  
> -void ff_dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx)
> +void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx)
>  {
>      int mm_flags = av_get_cpu_flags();
>  
> diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c
> index 78568fb..cd5c59f 100644
> --- a/libavfilter/vf_gradfun.c
> +++ b/libavfilter/vf_gradfun.c
> @@ -135,7 +135,7 @@ static av_cold int init(AVFilterContext *ctx, const char 
> *args)
>      gf->blur_line = ff_gradfun_blur_line_c;
>      gf->filter_line = ff_gradfun_filter_line_c;
>  
> -    if (HAVE_MMX)
> +    if (ARCH_X86)
>          ff_gradfun_init_x86(gf);
>  
>      av_log(ctx, AV_LOG_VERBOSE, "threshold:%.2f radius:%d\n", thresh, 
> gf->radius);
> diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
> index abb7812..227bf00 100644
> --- a/libavfilter/vf_yadif.c
> +++ b/libavfilter/vf_yadif.c
> @@ -400,7 +400,7 @@ static av_cold int init(AVFilterContext *ctx, const char 
> *args)
>  
>      yadif->filter_line = filter_line_c;
>  
> -    if (HAVE_MMX)
> +    if (ARCH_X86)
>          ff_yadif_init_x86(yadif);
>  
>      av_log(ctx, AV_LOG_VERBOSE, "mode:%d parity:%d auto_enable:%d\n",
> diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile
> index 46fc84f..4289f92 100644
> --- a/libavfilter/x86/Makefile
> +++ b/libavfilter/x86/Makefile
> @@ -1,3 +1,4 @@
> -MMX-OBJS-$(CONFIG_YADIF_FILTER)              += x86/yadif.o
> -MMX-OBJS-$(CONFIG_GRADFUN_FILTER)            += x86/gradfun.o
> +OBJS-$(CONFIG_GRADFUN_FILTER)                += x86/gradfun.o
> +OBJS-$(CONFIG_YADIF_FILTER)                  += x86/yadif.o
> +
>  YASM-OBJS-$(CONFIG_HQDN3D_FILTER)            += x86/hqdn3d.o

libavfilter changes are ok

> diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
> index 26ef648..b7a1df1 100644
> --- a/libswscale/rgb2rgb.c
> +++ b/libswscale/rgb2rgb.c
> @@ -129,7 +129,7 @@ void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, 
> uint8_t *vdst,
>  av_cold void sws_rgb2rgb_init(void)
>  {
>      rgb2rgb_init_c();
> -    if (HAVE_MMX)
> +    if (ARCH_X86)
>          rgb2rgb_init_x86();
>  }
>  
> diff --git a/libswscale/swscale.c b/libswscale/swscale.c
> index 4c74e18..9afcd8a 100644
> --- a/libswscale/swscale.c
> +++ b/libswscale/swscale.c
> @@ -729,8 +729,8 @@ SwsFunc ff_getSwsFunc(SwsContext *c)
>  {
>      sws_init_swScale_c(c);
>  
> -    if (HAVE_MMX)
> -        ff_sws_init_swScale_mmx(c);
> +    if (ARCH_X86)
> +        ff_sws_init_swscale_x86(c);
>      if (HAVE_ALTIVEC)
>          ff_sws_init_swScale_altivec(c);
>  
> diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
> index 20caba0..6b15422 100644
> --- a/libswscale/swscale_internal.h
> +++ b/libswscale/swscale_internal.h
> @@ -534,7 +534,7 @@ void ff_yuv2rgb_init_tables_altivec(SwsContext *c, const 
> int inv_table[4],
>  void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int 
> chrBufIndex,
>                             int lastInLumBuf, int lastInChrBuf);
>  
> -SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c);
> +SwsFunc ff_yuv2rgb_init_x86(SwsContext *c);
>  SwsFunc ff_yuv2rgb_init_vis(SwsContext *c);
>  SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c);
>  SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c);
> @@ -668,6 +668,6 @@ void ff_sws_init_output_funcs(SwsContext *c,
>                                yuv2packed2_fn *yuv2packed2,
>                                yuv2packedX_fn *yuv2packedX);
>  void ff_sws_init_swScale_altivec(SwsContext *c);
> -void ff_sws_init_swScale_mmx(SwsContext *c);
> +void ff_sws_init_swscale_x86(SwsContext *c);
>  
>  #endif /* SWSCALE_SWSCALE_INTERNAL_H */
> diff --git a/libswscale/x86/Makefile b/libswscale/x86/Makefile
> index 5416d48..b94b14a 100644
> --- a/libswscale/x86/Makefile
> +++ b/libswscale/x86/Makefile
> @@ -1,9 +1,9 @@
> -OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o
> -
> -MMX-OBJS                        += x86/rgb2rgb.o                        \
> +OBJS                            += x86/rgb2rgb.o                        \

this one has the same problem as the libavcodec files
>                                     x86/swscale.o                        \
>                                     x86/yuv2rgb.o                        \

those are ok after fixing my remark below

> +OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o
> +
>  YASM-OBJS                       += x86/input.o                          \
>                                     x86/output.o                         \
>                                     x86/scale.o                          \
> diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
> index ba7990e..4b9ed19 100644
> --- a/libswscale/x86/swscale.c
> +++ b/libswscale/x86/swscale.c
> @@ -302,18 +302,18 @@ INPUT_FUNCS(sse2);
>  INPUT_FUNCS(ssse3);
>  INPUT_FUNCS(avx);

updateMMXDitherTables further above in the file should be wrapped with
#if HAVE_MMX_INLINE

> -av_cold void ff_sws_init_swScale_mmx(SwsContext *c)
> +av_cold void ff_sws_init_swscale_x86(SwsContext *c)
>  {
>      int cpu_flags = av_get_cpu_flags();
>  
> -#if HAVE_INLINE_ASM
> +#if HAVE_MMX_INLINE
>      if (cpu_flags & AV_CPU_FLAG_MMX)
>          sws_init_swScale_MMX(c);
> +#endif
>  #if HAVE_MMXEXT_INLINE
>      if (cpu_flags & AV_CPU_FLAG_MMXEXT)
>          sws_init_swScale_MMX2(c);
>  #endif
> -#endif /* HAVE_INLINE_ASM */
>  
>  #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
>      if (c->srcBpc == 8) { \
> diff --git a/libswscale/x86/yuv2rgb.c b/libswscale/x86/yuv2rgb.c
> index b7d8f42..7dc6147 100644
> --- a/libswscale/x86/yuv2rgb.c
> +++ b/libswscale/x86/yuv2rgb.c
> @@ -69,9 +69,9 @@ DECLARE_ASM_CONST(8, uint64_t, pb_07) = 
> 0x0707070707070707ULL;
>  
>  #endif /* HAVE_INLINE_ASM */
>  
> -av_cold SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
> +av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c)
>  {
> -#if HAVE_INLINE_ASM
> +#if HAVE_MMX_INLINE
>      int cpu_flags = av_get_cpu_flags();
>  
>      if (c->srcFormat != AV_PIX_FMT_YUV420P &&
> @@ -109,7 +109,7 @@ av_cold SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
>              case AV_PIX_FMT_RGB555: return yuv420_rgb15_MMX;
>          }
>      }
> -#endif /* HAVE_INLINE_ASM */
> +#endif /* HAVE_MMX_INLINE */
>  
>      return NULL;
>  }
> diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
> index 1dbd0d8..3d70991 100644
> --- a/libswscale/yuv2rgb.c
> +++ b/libswscale/yuv2rgb.c
> @@ -565,8 +565,8 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
>  {
>      SwsFunc t = NULL;
>  
> -    if (HAVE_MMX)
> -        t = ff_yuv2rgb_init_mmx(c);
> +    if (ARCH_X86)
> +        t = ff_yuv2rgb_init_x86(c);
>      else if (HAVE_VIS)
>          t = ff_yuv2rgb_init_vis(c);
>      else if (HAVE_ALTIVEC)

Janne
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to