[FFmpeg-cvslog] avcodec/lossless_videodsp: use ptrdiff_t for length parameters

James Almer git at videolan.org
Wed Mar 22 23:42:19 EET 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Mar 22 18:27:53 2017 -0300| [30cadfe071ad353b60144d235a347a57ada7998c] | committer: James Almer

avcodec/lossless_videodsp: use ptrdiff_t for length parameters

Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavcodec/lossless_videodsp.c             |  8 ++++----
 libavcodec/lossless_videodsp.h             | 11 +++++++----
 libavcodec/ppc/lossless_videodsp_altivec.c |  2 +-
 libavcodec/x86/lossless_videodsp_init.c    | 18 +++++++++---------
 tests/checkasm/llviddsp.c                  |  2 +-
 5 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/libavcodec/lossless_videodsp.c b/libavcodec/lossless_videodsp.c
index 1de288b..b5b96e6 100644
--- a/libavcodec/lossless_videodsp.c
+++ b/libavcodec/lossless_videodsp.c
@@ -25,7 +25,7 @@
 #define pb_7f (~0UL / 255 * 0x7f)
 #define pb_80 (~0UL / 255 * 0x80)
 
-static void add_bytes_c(uint8_t *dst, uint8_t *src, intptr_t w)
+static void add_bytes_c(uint8_t *dst, uint8_t *src, ptrdiff_t w)
 {
     long i;
 
@@ -39,7 +39,7 @@ static void add_bytes_c(uint8_t *dst, uint8_t *src, intptr_t w)
 }
 
 static void add_median_pred_c(uint8_t *dst, const uint8_t *src1,
-                              const uint8_t *diff, intptr_t w,
+                              const uint8_t *diff, ptrdiff_t w,
                               int *left, int *left_top)
 {
     int i;
@@ -58,7 +58,7 @@ static void add_median_pred_c(uint8_t *dst, const uint8_t *src1,
     *left_top = lt;
 }
 
-static int add_left_pred_c(uint8_t *dst, const uint8_t *src, intptr_t w,
+static int add_left_pred_c(uint8_t *dst, const uint8_t *src, ptrdiff_t w,
                            int acc)
 {
     int i;
@@ -79,7 +79,7 @@ static int add_left_pred_c(uint8_t *dst, const uint8_t *src, intptr_t w,
     return acc;
 }
 
-static int add_left_pred_int16_c(uint16_t *dst, const uint16_t *src, unsigned mask, int w, unsigned acc){
+static int add_left_pred_int16_c(uint16_t *dst, const uint16_t *src, unsigned mask, ptrdiff_t w, unsigned acc){
     int i;
 
     for(i=0; i<w-1; i++){
diff --git a/libavcodec/lossless_videodsp.h b/libavcodec/lossless_videodsp.h
index 32f3fba..cecf0fe 100644
--- a/libavcodec/lossless_videodsp.h
+++ b/libavcodec/lossless_videodsp.h
@@ -22,20 +22,23 @@
 #ifndef AVCODEC_LOSSLESS_VIDEODSP_H
 #define AVCODEC_LOSSLESS_VIDEODSP_H
 
+#include <stdint.h>
+#include <stddef.h>
+
 #include "avcodec.h"
 #include "libavutil/cpu.h"
 
 typedef struct LLVidDSPContext {
     void (*add_bytes)(uint8_t *dst /* align 16 */, uint8_t *src /* align 16 */,
-                      intptr_t w);
+                      ptrdiff_t w);
     void (*add_median_pred)(uint8_t *dst, const uint8_t *top,
-                            const uint8_t *diff, intptr_t w,
+                            const uint8_t *diff, ptrdiff_t w,
                             int *left, int *left_top);
     int (*add_left_pred)(uint8_t *dst, const uint8_t *src,
-                         intptr_t w, int left);
+                         ptrdiff_t w, int left);
 
     int  (*add_left_pred_int16)(uint16_t *dst, const uint16_t *src,
-                                unsigned mask, int w, unsigned left);
+                                unsigned mask, ptrdiff_t w, unsigned left);
 } LLVidDSPContext;
 
 void ff_llviddsp_init(LLVidDSPContext *llviddsp);
diff --git a/libavcodec/ppc/lossless_videodsp_altivec.c b/libavcodec/ppc/lossless_videodsp_altivec.c
index c388dc3..16dd99f 100644
--- a/libavcodec/ppc/lossless_videodsp_altivec.c
+++ b/libavcodec/ppc/lossless_videodsp_altivec.c
@@ -33,7 +33,7 @@
 #include "libavcodec/lossless_videodsp.h"
 
 #if HAVE_ALTIVEC
-static void add_bytes_altivec(uint8_t *dst, uint8_t *src, intptr_t w)
+static void add_bytes_altivec(uint8_t *dst, uint8_t *src, ptrdiff_t w)
 {
     register int i;
     register vector unsigned char vdst, vsrc;
diff --git a/libavcodec/x86/lossless_videodsp_init.c b/libavcodec/x86/lossless_videodsp_init.c
index 8d58344..21bbd12 100644
--- a/libavcodec/x86/lossless_videodsp_init.c
+++ b/libavcodec/x86/lossless_videodsp_init.c
@@ -23,27 +23,27 @@
 #include "../lossless_videodsp.h"
 #include "libavutil/x86/cpu.h"
 
-void ff_add_bytes_mmx(uint8_t *dst, uint8_t *src, intptr_t w);
-void ff_add_bytes_sse2(uint8_t *dst, uint8_t *src, intptr_t w);
+void ff_add_bytes_mmx(uint8_t *dst, uint8_t *src, ptrdiff_t w);
+void ff_add_bytes_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t w);
 
 void ff_add_median_pred_mmxext(uint8_t *dst, const uint8_t *top,
-                               const uint8_t *diff, intptr_t w,
+                               const uint8_t *diff, ptrdiff_t w,
                                int *left, int *left_top);
 void ff_add_median_pred_sse2(uint8_t *dst, const uint8_t *top,
-                             const uint8_t *diff, intptr_t w,
+                             const uint8_t *diff, ptrdiff_t w,
                              int *left, int *left_top);
 
 int  ff_add_left_pred_ssse3(uint8_t *dst, const uint8_t *src,
-                            intptr_t w, int left);
+                            ptrdiff_t w, int left);
 int  ff_add_left_pred_unaligned_ssse3(uint8_t *dst, const uint8_t *src,
-                                      intptr_t w, int left);
+                                      ptrdiff_t w, int left);
 
-int ff_add_left_pred_int16_ssse3(uint16_t *dst, const uint16_t *src, unsigned mask, int w, unsigned acc);
-int ff_add_left_pred_int16_sse4(uint16_t *dst, const uint16_t *src, unsigned mask, int w, unsigned acc);
+int ff_add_left_pred_int16_ssse3(uint16_t *dst, const uint16_t *src, unsigned mask, ptrdiff_t w, unsigned acc);
+int ff_add_left_pred_int16_sse4(uint16_t *dst, const uint16_t *src, unsigned mask, ptrdiff_t w, unsigned acc);
 
 #if HAVE_INLINE_ASM && HAVE_7REGS && ARCH_X86_32
 static void add_median_pred_cmov(uint8_t *dst, const uint8_t *top,
-                                 const uint8_t *diff, intptr_t w,
+                                 const uint8_t *diff, ptrdiff_t w,
                                  int *left, int *left_top)
 {
     x86_reg w2 = -w;
diff --git a/tests/checkasm/llviddsp.c b/tests/checkasm/llviddsp.c
index e42873b..b1f3b83 100644
--- a/tests/checkasm/llviddsp.c
+++ b/tests/checkasm/llviddsp.c
@@ -41,7 +41,7 @@ static void check_add_bytes(LLVidDSPContext c, int width)
     uint8_t *src1 = av_mallocz(width);
     uint8_t *dst0 = av_mallocz(width);
     uint8_t *dst1 = av_mallocz(width);
-    declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, uint8_t *src, int w);
+    declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, uint8_t *src, ptrdiff_t w);
 
     if (!src0 || !src1 || !dst0 || !dst1)
         fail();



More information about the ffmpeg-cvslog mailing list