From 304a1ed1e86429eb4e20a48d887546b1072ed4da Mon Sep 17 00:00:00 2001
From: Nedeljko Babic <nbabic@mips.com>
Date: Fri, 9 Nov 2012 12:45:40 +0100
Subject: [PATCH] mips: Add dependencies on HAVE_INLINE_ASM

Add dependencies on HAVE_INLINE_ASM for files and parts of code
 where it is necessary.

Signed-off-by: Nedeljko Babic <nbabic@mips.com>
Reviewed-by: Vitor Sessak <vitor1001@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
 libavcodec/mips/Makefile                  | 4 ++--
 libavcodec/mips/acelp_filters_mips.c      | 5 +++++
 libavcodec/mips/acelp_vectors_mips.c      | 5 +++++
 libavcodec/mips/amrwbdec_mips.c           | 2 ++
 libavcodec/mips/celp_filters_mips.c       | 5 +++++
 libavcodec/mips/celp_math_mips.c          | 5 +++++
 libavcodec/mips/compute_antialias_fixed.h | 2 ++
 libavcodec/mips/compute_antialias_float.h | 2 ++
 libavcodec/mips/dsputil_mips.c            | 4 ++++
 libavcodec/mips/fft_mips.c                | 4 ++--
 libavcodec/mips/fmtconvert_mips.c         | 4 ++++
 11 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index 2f053c99c82..f4c6ac83b96 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -11,5 +11,5 @@ MIPSFPU-OBJS-$(CONFIG_MPEGAUDIODSP)       += mips/mpegaudiodsp_mips_float.o
 MIPSDSPR1-OBJS-$(CONFIG_MPEGAUDIODSP)     += mips/mpegaudiodsp_mips_fixed.o
 OBJS-$(CONFIG_FFT)                        += mips/fft_init_table.o
 MIPSFPU-OBJS-$(CONFIG_FFT)                += mips/fft_mips.o
-MIPSFPU-OBJS-$(HAVE_INLINE_ASM)           += mips/fmtconvert_mips.o
-MIPSFPU-OBJS-$(HAVE_INLINE_ASM)           += mips/dsputil_mips.o
+MIPSFPU-OBJS                              += mips/dsputil_mips.o           \
+                                             mips/fmtconvert_mips.o
diff --git a/libavcodec/mips/acelp_filters_mips.c b/libavcodec/mips/acelp_filters_mips.c
index 498660b4488..1e0845c3b4c 100644
--- a/libavcodec/mips/acelp_filters_mips.c
+++ b/libavcodec/mips/acelp_filters_mips.c
@@ -51,9 +51,11 @@
  * @file
  * Reference: libavcodec/acelp_filters.c
  */
+#include "config.h"
 #include "libavutil/attributes.h"
 #include "libavcodec/acelp_filters.h"
 
+#if HAVE_INLINE_ASM
 static void ff_acelp_interpolatef_mips(float *out, const float *in,
                            const float *filter_coeffs, int precision,
                            int frac_pos, int filter_length, int length)
@@ -202,9 +204,12 @@ static void ff_acelp_apply_order_2_transfer_function_mips(float *out, const floa
            "$f12", "$f13", "$f14", "$f15", "$f16"
     );
 }
+#endif /* HAVE_INLINE_ASM */
 
 void ff_acelp_filter_init_mips(ACELPFContext *c)
 {
+#if HAVE_INLINE_ASM
     c->acelp_interpolatef                      = ff_acelp_interpolatef_mips;
     c->acelp_apply_order_2_transfer_function   = ff_acelp_apply_order_2_transfer_function_mips;
+#endif
 }
diff --git a/libavcodec/mips/acelp_vectors_mips.c b/libavcodec/mips/acelp_vectors_mips.c
index 6f9390f225f..e00b34eaf67 100644
--- a/libavcodec/mips/acelp_vectors_mips.c
+++ b/libavcodec/mips/acelp_vectors_mips.c
@@ -52,8 +52,10 @@
  * @file
  * Reference: libavcodec/acelp_vectors.c
  */
+#include "config.h"
 #include "libavcodec/acelp_vectors.h"
 
+#if HAVE_INLINE_ASM
 static void ff_weighted_vector_sumf_mips(
                   float *out, const float *in_a, const float *in_b,
                   float weight_coeff_a, float weight_coeff_b, int length)
@@ -89,8 +91,11 @@ static void ff_weighted_vector_sumf_mips(
         : "$f0", "$f1", "$f2", "$f3", "$f4", "$f5"
     );
 }
+#endif /* HAVE_INLINE_ASM */
 
 void ff_acelp_vectors_init_mips(ACELPVContext *c)
 {
+#if HAVE_INLINE_ASM
     c->weighted_vector_sumf = ff_weighted_vector_sumf_mips;
+#endif
 }
diff --git a/libavcodec/mips/amrwbdec_mips.c b/libavcodec/mips/amrwbdec_mips.c
index 4bfbb8c6b99..77fae6c60a6 100644
--- a/libavcodec/mips/amrwbdec_mips.c
+++ b/libavcodec/mips/amrwbdec_mips.c
@@ -53,6 +53,7 @@
 #include "libavcodec/amrwbdata.h"
 #include "amrwbdec_mips.h"
 
+#if HAVE_INLINE_ASM
 void hb_fir_filter_mips(float *out, const float fir_coef[HB_FIR_SIZE + 1],
                           float mem[HB_FIR_SIZE], const float *in)
 {
@@ -183,3 +184,4 @@ void hb_fir_filter_mips(float *out, const float fir_coef[HB_FIR_SIZE + 1],
     }
     memcpy(mem, data + AMRWB_SFR_SIZE_16k, HB_FIR_SIZE * sizeof(float));
 }
+#endif /* HAVE_INLINE_ASM */
diff --git a/libavcodec/mips/celp_filters_mips.c b/libavcodec/mips/celp_filters_mips.c
index 06e0127b191..5ecde000c25 100644
--- a/libavcodec/mips/celp_filters_mips.c
+++ b/libavcodec/mips/celp_filters_mips.c
@@ -51,10 +51,12 @@
  * @file
  * Reference: libavcodec/celp_filters.c
  */
+#include "config.h"
 #include "libavutil/attributes.h"
 #include "libavutil/common.h"
 #include "libavcodec/celp_filters.h"
 
+#if HAVE_INLINE_ASM
 static void ff_celp_lp_synthesis_filterf_mips(float *out,
                                   const float *filter_coeffs,
                                   const float* in, int buffer_length,
@@ -273,9 +275,12 @@ static void ff_celp_lp_zero_synthesis_filterf_mips(float *out,
         out[n] = sum_out1;
     }
 }
+#endif /* HAVE_INLINE_ASM */
 
 void ff_celp_filter_init_mips(CELPFContext *c)
 {
+#if HAVE_INLINE_ASM
     c->celp_lp_synthesis_filterf        = ff_celp_lp_synthesis_filterf_mips;
     c->celp_lp_zero_synthesis_filterf   = ff_celp_lp_zero_synthesis_filterf_mips;
+#endif
 }
diff --git a/libavcodec/mips/celp_math_mips.c b/libavcodec/mips/celp_math_mips.c
index 6ab1823d776..f0335c9e9e6 100644
--- a/libavcodec/mips/celp_math_mips.c
+++ b/libavcodec/mips/celp_math_mips.c
@@ -51,8 +51,10 @@
  * @file
  * Reference: libavcodec/celp_math.c
  */
+#include "config.h"
 #include "libavcodec/celp_math.h"
 
+#if HAVE_INLINE_ASM
 static float ff_dot_productf_mips(const float* a, const float* b,
                                               int length)
 {
@@ -77,8 +79,11 @@ static float ff_dot_productf_mips(const float* a, const float* b,
     );
     return sum;
 }
+#endif /* HAVE_INLINE_ASM */
 
 void ff_celp_math_init_mips(CELPMContext *c)
 {
+#if HAVE_INLINE_ASM
     c->dot_productf = ff_dot_productf_mips;
+#endif
 }
diff --git a/libavcodec/mips/compute_antialias_fixed.h b/libavcodec/mips/compute_antialias_fixed.h
index 528411fff2a..13684f66bbe 100644
--- a/libavcodec/mips/compute_antialias_fixed.h
+++ b/libavcodec/mips/compute_antialias_fixed.h
@@ -55,6 +55,7 @@
 #ifndef AVCODEC_MIPS_COMPUTE_ANTIALIAS_FIXED_H
 #define AVCODEC_MIPS_COMPUTE_ANTIALIAS_FIXED_H
 
+#if HAVE_INLINE_ASM
 static void compute_antialias_mips_fixed(MPADecodeContext *s,
                                         GranuleDef *g)
 {
@@ -242,5 +243,6 @@ static void compute_antialias_mips_fixed(MPADecodeContext *s,
     }
 }
 #define compute_antialias compute_antialias_mips_fixed
+#endif /* HAVE_INLINE_ASM */
 
 #endif /* AVCODEC_MIPS_COMPUTE_ANTIALIAS_FIXED_H */
diff --git a/libavcodec/mips/compute_antialias_float.h b/libavcodec/mips/compute_antialias_float.h
index 3a3f5d6dde4..289150ddb9e 100644
--- a/libavcodec/mips/compute_antialias_float.h
+++ b/libavcodec/mips/compute_antialias_float.h
@@ -55,6 +55,7 @@
 #ifndef AVCODEC_MIPS_COMPUTE_ANTIALIAS_FLOAT_H
 #define AVCODEC_MIPS_COMPUTE_ANTIALIAS_FLOAT_H
 
+#if HAVE_INLINE_ASM
 static void compute_antialias_mips_float(MPADecodeContext *s,
                                         GranuleDef *g)
 {
@@ -178,5 +179,6 @@ static void compute_antialias_mips_float(MPADecodeContext *s,
     );
 }
 #define compute_antialias compute_antialias_mips_float
+#endif /* HAVE_INLINE_ASM */
 
 #endif /* AVCODEC_MIPS_COMPUTE_ANTIALIAS_FLOAT_H */
diff --git a/libavcodec/mips/dsputil_mips.c b/libavcodec/mips/dsputil_mips.c
index e46a0a949f6..76dc664e608 100644
--- a/libavcodec/mips/dsputil_mips.c
+++ b/libavcodec/mips/dsputil_mips.c
@@ -47,6 +47,7 @@
 #include "config.h"
 #include "libavcodec/dsputil.h"
 
+#if HAVE_INLINE_ASM
 static void vector_fmul_window_mips(float *dst, const float *src0,
         const float *src1, const float *win, int len)
 {
@@ -157,8 +158,11 @@ static void vector_fmul_window_mips(float *dst, const float *src0,
         );
     }
 }
+#endif /* HAVE_INLINE_ASM */
 
 av_cold void ff_dsputil_init_mips( DSPContext* c, AVCodecContext *avctx )
 {
+#if HAVE_INLINE_ASM
     c->vector_fmul_window = vector_fmul_window_mips;
+#endif
 }
diff --git a/libavcodec/mips/fft_mips.c b/libavcodec/mips/fft_mips.c
index 2b1c50899c9..8a2d86e8195 100644
--- a/libavcodec/mips/fft_mips.c
+++ b/libavcodec/mips/fft_mips.c
@@ -485,7 +485,6 @@ static void ff_imdct_half_mips(FFTContext *s, FFTSample *output, const FFTSample
         z2[1].im = temp12;
     }
 }
-#endif /* HAVE_INLINE_ASM */
 
 /**
  * Compute inverse MDCT of size N = 2^nbits
@@ -513,6 +512,7 @@ static void ff_imdct_calc_mips(FFTContext *s, FFTSample *output, const FFTSample
         output[n-k-4] = output[n2+k+3];
     }
 }
+#endif /* HAVE_INLINE_ASM */
 
 av_cold void ff_fft_init_mips(FFTContext *s)
 {
@@ -522,9 +522,9 @@ av_cold void ff_fft_init_mips(FFTContext *s)
 
 #if HAVE_INLINE_ASM
     s->fft_calc     = ff_fft_calc_mips;
-#endif
 #if CONFIG_MDCT
     s->imdct_calc   = ff_imdct_calc_mips;
     s->imdct_half   = ff_imdct_half_mips;
 #endif
+#endif
 }
diff --git a/libavcodec/mips/fmtconvert_mips.c b/libavcodec/mips/fmtconvert_mips.c
index f89d3b6d648..8a0265f070a 100644
--- a/libavcodec/mips/fmtconvert_mips.c
+++ b/libavcodec/mips/fmtconvert_mips.c
@@ -51,6 +51,7 @@
 #include "libavcodec/avcodec.h"
 #include "libavcodec/fmtconvert.h"
 
+#if HAVE_INLINE_ASM
 #if HAVE_MIPSDSPR1
 static void float_to_int16_mips(int16_t *dst, const float *src, long len)
 {
@@ -327,12 +328,15 @@ static void int32_to_float_fmul_scalar_mips(float *dst, const int *src,
         : "memory"
     );
 }
+#endif /* HAVE_INLINE_ASM */
 
 av_cold void ff_fmt_convert_init_mips(FmtConvertContext *c)
 {
+#if HAVE_INLINE_ASM
 #if HAVE_MIPSDSPR1
     c->float_to_int16_interleave = float_to_int16_interleave_mips;
     c->float_to_int16 = float_to_int16_mips;
 #endif
     c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_mips;
+#endif
 }
-- 
GitLab