From 7f4dfbd0809db97f6abafba7b9361278dfa2e994 Mon Sep 17 00:00:00 2001 From: James Almer Date: Sat, 14 Jun 2014 19:21:44 -0300 Subject: [PATCH] swr: add prototypes for resample dsp functions Should fix compilation failures with MSVC and any other compiler without inline asm support. Signed-off-by: James Almer Signed-off-by: Michael Niedermayer --- libswresample/resample_dsp.c | 25 +++++++++++++++------- libswresample/resample_template.c | 12 +++++------ libswresample/x86/resample_x86_dsp.c | 31 +++++++++++++++++++--------- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/libswresample/resample_dsp.c b/libswresample/resample_dsp.c index a48a5a98cf..a3b600f12f 100644 --- a/libswresample/resample_dsp.c +++ b/libswresample/resample_dsp.c @@ -27,6 +27,15 @@ #include "resample.h" +int swri_resample_common_int16 (ResampleContext *c, int16_t *dst, const int16_t *src, int n, int update_ctx); +int swri_resample_common_int32 (ResampleContext *c, int32_t *dst, const int32_t *src, int n, int update_ctx); +int swri_resample_common_float (ResampleContext *c, float *dst, const float *src, int n, int update_ctx); +int swri_resample_common_double(ResampleContext *c, double *dst, const double *src, int n, int update_ctx); +int swri_resample_linear_int16 (ResampleContext *c, int16_t *dst, const int16_t *src, int n, int update_ctx); +int swri_resample_linear_int32 (ResampleContext *c, int32_t *dst, const int32_t *src, int n, int update_ctx); +int swri_resample_linear_float (ResampleContext *c, float *dst, const float *src, int n, int update_ctx); +int swri_resample_linear_double(ResampleContext *c, double *dst, const double *src, int n, int update_ctx); + #define DO_RESAMPLE_ONE 1 #define TEMPLATE_RESAMPLE_S16 @@ -55,15 +64,15 @@ void swresample_dsp_init(ResampleContext *c) c->dsp.resample_one[FNIDX(FLTP)] = (resample_one_fn) resample_one_float; c->dsp.resample_one[FNIDX(DBLP)] = (resample_one_fn) resample_one_double; - c->dsp.resample_common[FNIDX(S16P)] = (resample_fn) resample_common_int16; - c->dsp.resample_common[FNIDX(S32P)] = (resample_fn) resample_common_int32; - c->dsp.resample_common[FNIDX(FLTP)] = (resample_fn) resample_common_float; - c->dsp.resample_common[FNIDX(DBLP)] = (resample_fn) resample_common_double; + c->dsp.resample_common[FNIDX(S16P)] = (resample_fn) swri_resample_common_int16; + c->dsp.resample_common[FNIDX(S32P)] = (resample_fn) swri_resample_common_int32; + c->dsp.resample_common[FNIDX(FLTP)] = (resample_fn) swri_resample_common_float; + c->dsp.resample_common[FNIDX(DBLP)] = (resample_fn) swri_resample_common_double; - c->dsp.resample_linear[FNIDX(S16P)] = (resample_fn) resample_linear_int16; - c->dsp.resample_linear[FNIDX(S32P)] = (resample_fn) resample_linear_int32; - c->dsp.resample_linear[FNIDX(FLTP)] = (resample_fn) resample_linear_float; - c->dsp.resample_linear[FNIDX(DBLP)] = (resample_fn) resample_linear_double; + c->dsp.resample_linear[FNIDX(S16P)] = (resample_fn) swri_resample_linear_int16; + c->dsp.resample_linear[FNIDX(S32P)] = (resample_fn) swri_resample_linear_int32; + c->dsp.resample_linear[FNIDX(FLTP)] = (resample_fn) swri_resample_linear_float; + c->dsp.resample_linear[FNIDX(DBLP)] = (resample_fn) swri_resample_linear_double; if (ARCH_X86) swresample_dsp_x86_init(c); } diff --git a/libswresample/resample_template.c b/libswresample/resample_template.c index 6773e3ecc4..a13235154c 100644 --- a/libswresample/resample_template.c +++ b/libswresample/resample_template.c @@ -119,9 +119,9 @@ static void RENAME(resample_one)(DELEM *dst, const DELEM *src, } #endif -static int RENAME(resample_common)(ResampleContext *c, - DELEM *dst, const DELEM *src, - int n, int update_ctx) +int RENAME(swri_resample_common)(ResampleContext *c, + DELEM *dst, const DELEM *src, + int n, int update_ctx) { int dst_index; int index= c->index; @@ -163,9 +163,9 @@ static int RENAME(resample_common)(ResampleContext *c, return sample_index; } -static int RENAME(resample_linear)(ResampleContext *c, - DELEM *dst, const DELEM *src, - int n, int update_ctx) +int RENAME(swri_resample_linear)(ResampleContext *c, + DELEM *dst, const DELEM *src, + int n, int update_ctx) { int dst_index; int index= c->index; diff --git a/libswresample/x86/resample_x86_dsp.c b/libswresample/x86/resample_x86_dsp.c index 02a7db51c2..e03713816b 100644 --- a/libswresample/x86/resample_x86_dsp.c +++ b/libswresample/x86/resample_x86_dsp.c @@ -27,6 +27,17 @@ #include "libswresample/resample.h" +int swri_resample_common_int16_mmx2 (ResampleContext *c, int16_t *dst, const int16_t *src, int n, int update_ctx); +int swri_resample_linear_int16_mmx2 (ResampleContext *c, int16_t *dst, const int16_t *src, int n, int update_ctx); +int swri_resample_common_int16_sse2 (ResampleContext *c, int16_t *dst, const int16_t *src, int n, int update_ctx); +int swri_resample_linear_int16_sse2 (ResampleContext *c, int16_t *dst, const int16_t *src, int n, int update_ctx); +int swri_resample_common_float_sse (ResampleContext *c, float *dst, const float *src, int n, int update_ctx); +int swri_resample_linear_float_sse (ResampleContext *c, float *dst, const float *src, int n, int update_ctx); +int swri_resample_common_float_avx (ResampleContext *c, float *dst, const float *src, int n, int update_ctx); +int swri_resample_linear_float_avx (ResampleContext *c, float *dst, const float *src, int n, int update_ctx); +int swri_resample_common_double_sse2(ResampleContext *c, double *dst, const double *src, int n, int update_ctx); +int swri_resample_linear_double_sse2(ResampleContext *c, double *dst, const double *src, int n, int update_ctx); + #if HAVE_MMXEXT_INLINE #define DO_RESAMPLE_ONE 0 @@ -69,21 +80,21 @@ void swresample_dsp_x86_init(ResampleContext *c) #define FNIDX(fmt) (AV_SAMPLE_FMT_##fmt - AV_SAMPLE_FMT_S16P) if (ARCH_X86_32 && HAVE_MMXEXT_INLINE && mm_flags & AV_CPU_FLAG_MMX2) { - c->dsp.resample_common[FNIDX(S16P)] = (resample_fn) resample_common_int16_mmx2; - c->dsp.resample_linear[FNIDX(S16P)] = (resample_fn) resample_linear_int16_mmx2; + c->dsp.resample_common[FNIDX(S16P)] = (resample_fn) swri_resample_common_int16_mmx2; + c->dsp.resample_linear[FNIDX(S16P)] = (resample_fn) swri_resample_linear_int16_mmx2; } if (HAVE_SSE_INLINE && mm_flags & AV_CPU_FLAG_SSE) { - c->dsp.resample_common[FNIDX(FLTP)] = (resample_fn) resample_common_float_sse; - c->dsp.resample_linear[FNIDX(FLTP)] = (resample_fn) resample_linear_float_sse; + c->dsp.resample_common[FNIDX(FLTP)] = (resample_fn) swri_resample_common_float_sse; + c->dsp.resample_linear[FNIDX(FLTP)] = (resample_fn) swri_resample_linear_float_sse; } if (HAVE_SSE2_INLINE && mm_flags & AV_CPU_FLAG_SSE2) { - c->dsp.resample_common[FNIDX(S16P)] = (resample_fn) resample_common_int16_sse2; - c->dsp.resample_linear[FNIDX(S16P)] = (resample_fn) resample_linear_int16_sse2; - c->dsp.resample_common[FNIDX(DBLP)] = (resample_fn) resample_common_double_sse2; - c->dsp.resample_linear[FNIDX(DBLP)] = (resample_fn) resample_linear_double_sse2; + c->dsp.resample_common[FNIDX(S16P)] = (resample_fn) swri_resample_common_int16_sse2; + c->dsp.resample_linear[FNIDX(S16P)] = (resample_fn) swri_resample_linear_int16_sse2; + c->dsp.resample_common[FNIDX(DBLP)] = (resample_fn) swri_resample_common_double_sse2; + c->dsp.resample_linear[FNIDX(DBLP)] = (resample_fn) swri_resample_linear_double_sse2; } if (HAVE_AVX_INLINE && mm_flags & AV_CPU_FLAG_AVX) { - c->dsp.resample_common[FNIDX(FLTP)] = (resample_fn) resample_common_float_avx; - c->dsp.resample_linear[FNIDX(FLTP)] = (resample_fn) resample_linear_float_avx; + c->dsp.resample_common[FNIDX(FLTP)] = (resample_fn) swri_resample_common_float_avx; + c->dsp.resample_linear[FNIDX(FLTP)] = (resample_fn) swri_resample_linear_float_avx; } }