audiodsp: reorder arguments for vector_clipf

This will make the x86 asm simpler.

ARM conversion by Martin Storsjö <martin@martin.st> and Janne Grunau
<janne-libav@jannau.net>
This commit is contained in:
Anton Khirnov 2016-09-04 14:45:48 +02:00
parent bf58545aac
commit 683da86aab
9 changed files with 15 additions and 16 deletions

View File

@ -111,7 +111,7 @@ static void scale_coefficients(AC3EncodeContext *s)
static void clip_coefficients(AudioDSPContext *adsp, float *coef, static void clip_coefficients(AudioDSPContext *adsp, float *coef,
unsigned int len) unsigned int len)
{ {
adsp->vector_clipf(coef, coef, COEF_MIN, COEF_MAX, len); adsp->vector_clipf(coef, coef, len, COEF_MIN, COEF_MAX);
} }

View File

@ -25,8 +25,7 @@
#include "libavcodec/audiodsp.h" #include "libavcodec/audiodsp.h"
#include "audiodsp_arm.h" #include "audiodsp_arm.h"
void ff_vector_clipf_neon(float *dst, const float *src, float min, float max, void ff_vector_clipf_neon(float *dst, const float *src, int len, float min, float max);
int len);
void ff_vector_clip_int32_neon(int32_t *dst, const int32_t *src, int32_t min, void ff_vector_clip_int32_neon(int32_t *dst, const int32_t *src, int32_t min,
int32_t max, unsigned int len); int32_t max, unsigned int len);

View File

@ -24,9 +24,8 @@
function ff_vector_clipf_neon, export=1 function ff_vector_clipf_neon, export=1
VFP vdup.32 q1, d0[1] VFP vdup.32 q1, d0[1]
VFP vdup.32 q0, d0[0] VFP vdup.32 q0, d0[0]
NOVFP vdup.32 q0, r2 NOVFP vdup.32 q0, r3
NOVFP vdup.32 q1, r3 NOVFP vld1.32 {d2[],d3[]}, [sp]
NOVFP ldr r2, [sp]
vld1.f32 {q2},[r1,:128]! vld1.f32 {q2},[r1,:128]!
vmin.f32 q10, q2, q1 vmin.f32 q10, q2, q1
vld1.f32 {q3},[r1,:128]! vld1.f32 {q3},[r1,:128]!

View File

@ -55,8 +55,8 @@ static void vector_clipf_c_opposite_sign(float *dst, const float *src,
} }
} }
static void vector_clipf_c(float *dst, const float *src, static void vector_clipf_c(float *dst, const float *src, int len,
float min, float max, int len) float min, float max)
{ {
int i; int i;

View File

@ -48,7 +48,8 @@ typedef struct AudioDSPContext {
/* assume len is a multiple of 16, and arrays are 16-byte aligned */ /* assume len is a multiple of 16, and arrays are 16-byte aligned */
void (*vector_clipf)(float *dst /* align 16 */, void (*vector_clipf)(float *dst /* align 16 */,
const float *src /* align 16 */, const float *src /* align 16 */,
float min, float max, int len /* align 16 */); int len /* align 16 */,
float min, float max);
} AudioDSPContext; } AudioDSPContext;
void ff_audiodsp_init(AudioDSPContext *c); void ff_audiodsp_init(AudioDSPContext *c);

View File

@ -867,7 +867,7 @@ static inline void decode_bytes_and_gain(COOKContext *q, COOKSubpacket *p,
static void saturate_output_float(COOKContext *q, float *out) static void saturate_output_float(COOKContext *q, float *out)
{ {
q->adsp.vector_clipf(out, q->mono_mdct_output + q->samples_per_channel, q->adsp.vector_clipf(out, q->mono_mdct_output + q->samples_per_channel,
-1.0f, 1.0f, FFALIGN(q->samples_per_channel, 8)); FFALIGN(q->samples_per_channel, 8), -1.0f, 1.0f);
} }

View File

@ -20,6 +20,6 @@
#define AVCODEC_X86_AUDIODSP_H #define AVCODEC_X86_AUDIODSP_H
void ff_vector_clipf_sse(float *dst, const float *src, void ff_vector_clipf_sse(float *dst, const float *src,
float min, float max, int len); int len, float min, float max);
#endif /* AVCODEC_X86_AUDIODSP_H */ #endif /* AVCODEC_X86_AUDIODSP_H */

View File

@ -23,7 +23,7 @@
#if HAVE_INLINE_ASM #if HAVE_INLINE_ASM
void ff_vector_clipf_sse(float *dst, const float *src, void ff_vector_clipf_sse(float *dst, const float *src,
float min, float max, int len) int len, float min, float max)
{ {
x86_reg i = (len - 16) * 4; x86_reg i = (len - 16) * 4;
__asm__ volatile ( __asm__ volatile (

View File

@ -120,7 +120,7 @@ void checkasm_check_audiodsp(void)
int i, len; int i, len;
declare_func_emms(AV_CPU_FLAG_MMX, void, float *dst, const float *src, declare_func_emms(AV_CPU_FLAG_MMX, void, float *dst, const float *src,
float min, float max, unsigned int len); int len, float min, float max);
val1 = (float)rnd() / (UINT_MAX >> 1) - 1.0f; val1 = (float)rnd() / (UINT_MAX >> 1) - 1.0f;
val2 = (float)rnd() / (UINT_MAX >> 1) - 1.0f; val2 = (float)rnd() / (UINT_MAX >> 1) - 1.0f;
@ -133,13 +133,13 @@ void checkasm_check_audiodsp(void)
len = rnd() % 128; len = rnd() % 128;
len = 16 * FFMAX(len, 1); len = 16 * FFMAX(len, 1);
call_ref(dst0, src, min, max, len); call_ref(dst0, src, len, min, max);
call_new(dst1, src, min, max, len); call_new(dst1, src, len, min, max);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
if (!float_near_ulp_array(dst0, dst1, 3, len)) if (!float_near_ulp_array(dst0, dst1, 3, len))
fail(); fail();
} }
bench_new(dst1, src, min, max, MAX_SIZE); bench_new(dst1, src, MAX_SIZE, min, max);
} }
report("audiodsp"); report("audiodsp");