changeset 10276:06d4e87718b1 libavcodec

ARM: NEON optimised vector_clipf
author mru
date Sat, 26 Sep 2009 19:55:21 +0000
parents ae08043eb532
children ddd69069dfa5
files arm/dsputil_neon.c arm/dsputil_neon_s.S
diffstat 2 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/arm/dsputil_neon.c	Sat Sep 26 19:23:27 2009 +0000
+++ b/arm/dsputil_neon.c	Sat Sep 26 19:55:21 2009 +0000
@@ -174,6 +174,8 @@
 void ff_vector_fmul_reverse_neon(float *dst, const float *src0,
                                  const float *src1, int len);
 
+void ff_vector_clipf_neon(float *dst, const float *src, float min, float max,
+                          int len);
 void ff_float_to_int16_neon(int16_t *, const float *, long);
 void ff_float_to_int16_interleave_neon(int16_t *, const float **, long, int);
 
@@ -297,6 +299,8 @@
     c->sv_fmul_scalar[0] = ff_sv_fmul_scalar_2_neon;
     c->sv_fmul_scalar[1] = ff_sv_fmul_scalar_4_neon;
 
+    c->vector_clipf = ff_vector_clipf_neon;
+
     if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
         c->float_to_int16 = ff_float_to_int16_neon;
         c->float_to_int16_interleave = ff_float_to_int16_interleave_neon;
--- a/arm/dsputil_neon_s.S	Sat Sep 26 19:23:27 2009 +0000
+++ b/arm/dsputil_neon_s.S	Sat Sep 26 19:55:21 2009 +0000
@@ -1075,3 +1075,29 @@
 2:      vst1.32         {q8-q9},  [r0,:128]!
         bx              lr
         .endfunc
+
+function ff_vector_clipf_neon, export=1
+VFP     vdup.32         q1,  d0[1]
+VFP     vdup.32         q0,  d0[0]
+NOVFP   vdup.32         q0,  r2
+NOVFP   vdup.32         q1,  r3
+NOVFP   ldr             r2,  [sp]
+        vld1.f32        {q2},[r1,:128]!
+        vmin.f32        q10, q2,  q1
+        vld1.f32        {q3},[r1,:128]!
+        vmin.f32        q11, q3,  q1
+1:      vmax.f32        q8,  q10, q0
+        vmax.f32        q9,  q11, q0
+        subs            r2,  r2,  #8
+        beq             2f
+        vld1.f32        {q2},[r1,:128]!
+        vmin.f32        q10, q2,  q1
+        vld1.f32        {q3},[r1,:128]!
+        vmin.f32        q11, q3,  q1
+        vst1.f32        {q8},[r0,:128]!
+        vst1.f32        {q9},[r0,:128]!
+        b               1b
+2:      vst1.f32        {q8},[r0,:128]!
+        vst1.f32        {q9},[r0,:128]!
+        bx              lr
+        .endfunc