[FFmpeg-devel] [PATCH] Change block_size type from int to intptr_t.

Ronald S. Bultje rsbultje at gmail.com
Thu Jan 17 17:25:49 CET 2013


From: "Ronald S. Bultje" <rsbultje at gmail.com>

This saves one instruction in the x86-64 assembly.
---
 libavcodec/arm/vorbisdsp_init_arm.c | 3 ++-
 libavcodec/ppc/vorbisdsp_altivec.c  | 2 +-
 libavcodec/vorbis.h                 | 2 +-
 libavcodec/vorbisdec.c              | 2 +-
 libavcodec/vorbisdsp.h              | 5 ++++-
 libavcodec/x86/vorbisdsp.asm        | 1 -
 libavcodec/x86/vorbisdsp_init.c     | 6 ++++--
 7 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/libavcodec/arm/vorbisdsp_init_arm.c b/libavcodec/arm/vorbisdsp_init_arm.c
index 056291b..854ab1f 100644
--- a/libavcodec/arm/vorbisdsp_init_arm.c
+++ b/libavcodec/arm/vorbisdsp_init_arm.c
@@ -24,7 +24,8 @@
 #include "libavutil/arm/cpu.h"
 #include "libavcodec/vorbisdsp.h"
 
-void ff_vorbis_inverse_coupling_neon(float *mag, float *ang, int blocksize);
+void ff_vorbis_inverse_coupling_neon(float *mag, float *ang,
+                                     intptr_t blocksize);
 
 void ff_vorbisdsp_init_arm(DSPContext *c)
 {
diff --git a/libavcodec/ppc/vorbisdsp_altivec.c b/libavcodec/ppc/vorbisdsp_altivec.c
index cebf0f7..b43295e 100644
--- a/libavcodec/ppc/vorbisdsp_altivec.c
+++ b/libavcodec/ppc/vorbisdsp_altivec.c
@@ -28,7 +28,7 @@
 
 #if HAVE_ALTIVEC
 static void vorbis_inverse_coupling_altivec(float *mag, float *ang,
-                                            int blocksize)
+                                            intptr_t blocksize)
 {
     int i;
     vector float m, a;
diff --git a/libavcodec/vorbis.h b/libavcodec/vorbis.h
index 6b72f6a..e4d7dd4 100644
--- a/libavcodec/vorbis.h
+++ b/libavcodec/vorbis.h
@@ -43,7 +43,7 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num);
 void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
                                   uint16_t *y_list, int *flag,
                                   int multiplier, float * out, int samples);
-void ff_vorbis_inverse_coupling(float *mag, float *ang, int blocksize);
+void ff_vorbis_inverse_coupling(float *mag, float *ang, intptr_t blocksize);
 
 #define ilog(i) av_log2(2*(i))
 
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 6b75ae3..791314e 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -1450,7 +1450,7 @@ static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr,
     }
 }
 
-void ff_vorbis_inverse_coupling(float *mag, float *ang, int blocksize)
+void ff_vorbis_inverse_coupling(float *mag, float *ang, intptr_t blocksize)
 {
     int i;
     for (i = 0;  i < blocksize;  i++) {
diff --git a/libavcodec/vorbisdsp.h b/libavcodec/vorbisdsp.h
index 98153a0..32fcfef 100644
--- a/libavcodec/vorbisdsp.h
+++ b/libavcodec/vorbisdsp.h
@@ -19,9 +19,12 @@
 #ifndef AVCODEC_VORBISDSP_H
 #define AVCODEC_VORBISDSP_H
 
+#include <stdint.h>
+
 typedef struct VorbisDSPContext {
     /* assume len is a multiple of 4, and arrays are 16-byte aligned */
-    void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize);    
+    void (*vorbis_inverse_coupling)(float *mag, float *ang,
+                                    intptr_t blocksize);
 } VorbisDSPContext;
 
 void ff_vorbisdsp_init(VorbisDSPContext *dsp);
diff --git a/libavcodec/x86/vorbisdsp.asm b/libavcodec/x86/vorbisdsp.asm
index e2168ef..4f71045 100644
--- a/libavcodec/x86/vorbisdsp.asm
+++ b/libavcodec/x86/vorbisdsp.asm
@@ -58,7 +58,6 @@ cglobal vorbis_inverse_coupling, 3, 3, 6, mag, ang, block_size
 
 INIT_XMM sse
 cglobal vorbis_inverse_coupling, 3, 3, 6, mag, ang, block_size
-    movsxdifnidn    block_sizeq, block_sized
     mova                     m5, [pdw_80000000]
     lea                    magq, [magq+block_sizeq*4]
     lea                    angq, [angq+block_sizeq*4]
diff --git a/libavcodec/x86/vorbisdsp_init.c b/libavcodec/x86/vorbisdsp_init.c
index 1272636..703cd93 100644
--- a/libavcodec/x86/vorbisdsp_init.c
+++ b/libavcodec/x86/vorbisdsp_init.c
@@ -22,8 +22,10 @@
 #include "libavutil/cpu.h"
 #include "libavcodec/vorbisdsp.h"
 
-void ff_vorbis_inverse_coupling_3dnow(float *mag, float *ang, int blocksize);
-void ff_vorbis_inverse_coupling_sse(float *mag, float *ang, int blocksize);
+void ff_vorbis_inverse_coupling_3dnow(float *mag, float *ang,
+                                      intptr_t blocksize);
+void ff_vorbis_inverse_coupling_sse(float *mag, float *ang,
+                                    intptr_t blocksize);
 
 void ff_vorbisdsp_init_x86(VorbisDSPContext *dsp)
 {
-- 
1.7.11.3



More information about the ffmpeg-devel mailing list