[FFmpeg-cvslog] mpegaudiodsp: Change type of array stride parameters to ptrdiff_t

Diego Biurrun git at videolan.org
Tue Mar 21 21:05:50 EET 2017


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Tue Sep 20 14:09:43 2016 +0200| [2caa93b813adc5dbb7771dfe615da826a2947d18] | committer: Diego Biurrun

mpegaudiodsp: Change type of array stride parameters to ptrdiff_t

This avoids SIMD-optimized functions having to sign-extend their
stride argument manually to be able to do pointer arithmetic.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2caa93b813adc5dbb7771dfe615da826a2947d18
---

 libavcodec/aarch64/mpegaudiodsp_neon.S |  1 -
 libavcodec/mpegaudiodsp.h              | 16 ++++++++++------
 libavcodec/mpegaudiodsp_template.c     |  4 ++--
 libavcodec/ppc/mpegaudiodsp_altivec.c  |  2 +-
 libavcodec/x86/mpegaudiodsp.c          |  2 +-
 5 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/libavcodec/aarch64/mpegaudiodsp_neon.S b/libavcodec/aarch64/mpegaudiodsp_neon.S
index c1edc64..34181d9 100644
--- a/libavcodec/aarch64/mpegaudiodsp_neon.S
+++ b/libavcodec/aarch64/mpegaudiodsp_neon.S
@@ -34,7 +34,6 @@ endconst
 .macro   apply_window   type, st
 function ff_mpadsp_apply_window_\type\()_neon, export=1
         mov             x7,  x0
-        sxtw            x4,  w4  // incr
         add             x8,  x0,  #512<<2
         ld1             {v0.4s,v1.4s,v2.4s,v3.4s},  [x7],  #64
         ld1             {v4.4s,v5.4s,v6.4s,v7.4s},  [x7],  #64
diff --git a/libavcodec/mpegaudiodsp.h b/libavcodec/mpegaudiodsp.h
index 909c652..e0e872f 100644
--- a/libavcodec/mpegaudiodsp.h
+++ b/libavcodec/mpegaudiodsp.h
@@ -19,14 +19,18 @@
 #ifndef AVCODEC_MPEGAUDIODSP_H
 #define AVCODEC_MPEGAUDIODSP_H
 
+#include <stddef.h>
 #include <stdint.h>
+
 #include "libavutil/common.h"
 
 typedef struct MPADSPContext {
     void (*apply_window_float)(float *synth_buf, float *window,
-                               int *dither_state, float *samples, int incr);
+                               int *dither_state, float *samples,
+                               ptrdiff_t incr);
     void (*apply_window_fixed)(int32_t *synth_buf, int32_t *window,
-                               int *dither_state, int16_t *samples, int incr);
+                               int *dither_state, int16_t *samples,
+                               ptrdiff_t incr);
     void (*dct32_float)(float *dst, const float *src);
     void (*dct32_fixed)(int *dst, const int *src);
     void (*imdct36_blocks_float)(float *out, float *buf, float *in,
@@ -45,13 +49,13 @@ extern const int32_t ff_mpa_enwindow[257];
 void ff_mpa_synth_filter_fixed(MPADSPContext *s,
                                int32_t *synth_buf_ptr, int *synth_buf_offset,
                                int32_t *window, int *dither_state,
-                               int16_t *samples, int incr,
+                               int16_t *samples, ptrdiff_t incr,
                                int32_t *sb_samples);
 
 void ff_mpa_synth_filter_float(MPADSPContext *s,
                                float *synth_buf_ptr, int *synth_buf_offset,
                                float *window, int *dither_state,
-                               float *samples, int incr,
+                               float *samples, ptrdiff_t incr,
                                float *sb_samples);
 
 void ff_mpadsp_init_aarch64(MPADSPContext *s);
@@ -64,10 +68,10 @@ void ff_mpa_synth_init_fixed(int32_t *window);
 
 void ff_mpadsp_apply_window_float(float *synth_buf, float *window,
                                   int *dither_state, float *samples,
-                                  int incr);
+                                  ptrdiff_t incr);
 void ff_mpadsp_apply_window_fixed(int32_t *synth_buf, int32_t *window,
                                   int *dither_state, int16_t *samples,
-                                  int incr);
+                                  ptrdiff_t incr);
 
 void ff_imdct36_blocks_float(float *out, float *buf, float *in,
                              int count, int switch_point, int block_type);
diff --git a/libavcodec/mpegaudiodsp_template.c b/libavcodec/mpegaudiodsp_template.c
index 621bbd4..b8836c9 100644
--- a/libavcodec/mpegaudiodsp_template.c
+++ b/libavcodec/mpegaudiodsp_template.c
@@ -120,7 +120,7 @@ DECLARE_ALIGNED(16, MPA_INT, RENAME(ff_mpa_synth_window))[512+256];
 
 void RENAME(ff_mpadsp_apply_window)(MPA_INT *synth_buf, MPA_INT *window,
                                   int *dither_state, OUT_INT *samples,
-                                  int incr)
+                                  ptrdiff_t incr)
 {
     register const MPA_INT *w, *w2, *p;
     int j;
@@ -176,7 +176,7 @@ void RENAME(ff_mpadsp_apply_window)(MPA_INT *synth_buf, MPA_INT *window,
 void RENAME(ff_mpa_synth_filter)(MPADSPContext *s, MPA_INT *synth_buf_ptr,
                                  int *synth_buf_offset,
                                  MPA_INT *window, int *dither_state,
-                                 OUT_INT *samples, int incr,
+                                 OUT_INT *samples, ptrdiff_t incr,
                                  MPA_INT *sb_samples)
 {
     MPA_INT *synth_buf;
diff --git a/libavcodec/ppc/mpegaudiodsp_altivec.c b/libavcodec/ppc/mpegaudiodsp_altivec.c
index b3d3ed4..4c07131 100644
--- a/libavcodec/ppc/mpegaudiodsp_altivec.c
+++ b/libavcodec/ppc/mpegaudiodsp_altivec.c
@@ -90,7 +90,7 @@ static void apply_window(const float *buf, const float *win1,
 }
 
 static void apply_window_mp3(float *in, float *win, int *unused, float *out,
-                             int incr)
+                             ptrdiff_t incr)
 {
     LOCAL_ALIGNED_16(float, suma, [17]);
     LOCAL_ALIGNED_16(float, sumb, [17]);
diff --git a/libavcodec/x86/mpegaudiodsp.c b/libavcodec/x86/mpegaudiodsp.c
index 533b4a7..591f527 100644
--- a/libavcodec/x86/mpegaudiodsp.c
+++ b/libavcodec/x86/mpegaudiodsp.c
@@ -100,7 +100,7 @@ static void apply_window(const float *buf, const float *win1,
 }
 
 static void apply_window_mp3(float *in, float *win, int *unused, float *out,
-                             int incr)
+                             ptrdiff_t incr)
 {
     LOCAL_ALIGNED_16(float, suma, [17]);
     LOCAL_ALIGNED_16(float, sumb, [17]);



More information about the ffmpeg-cvslog mailing list