[FFmpeg-devel] [PATCH] Add const to arguments to dsputil scalarproduct_int16 and scalarproduct_and_madd_int16

Eli Friedman eli.friedman
Sun Jun 27 06:47:02 CEST 2010


On Sat, Jun 26, 2010 at 9:44 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> Attached; fixes a couple warnings in libavcodec/acelp_pitch_delay.c
> and makes the const-ness of the arguments more obvious.

With a typo fix in the changes to int_altivec.c.

-Eli
-------------- next part --------------
Index: libavcodec/dsputil.c
===================================================================
--- libavcodec/dsputil.c	(revision 23802)
+++ libavcodec/dsputil.c	(working copy)
@@ -3988,7 +3988,7 @@
     }
 }
 
-static int32_t scalarproduct_int16_c(int16_t * v1, int16_t * v2, int order, int shift)
+static int32_t scalarproduct_int16_c(const int16_t * v1, const int16_t * v2, int order, int shift)
 {
     int res = 0;
 
@@ -3998,7 +3998,7 @@
     return res;
 }
 
-static int32_t scalarproduct_and_madd_int16_c(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul)
+static int32_t scalarproduct_and_madd_int16_c(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul)
 {
     int res = 0;
     while (order--) {
Index: libavcodec/dsputil.h
===================================================================
--- libavcodec/dsputil.h	(revision 23802)
+++ libavcodec/dsputil.h	(working copy)
@@ -544,14 +544,14 @@
      * @param len length of vectors, should be multiple of 16
      * @param shift number of bits to discard from product
      */
-    int32_t (*scalarproduct_int16)(int16_t *v1, int16_t *v2/*align 16*/, int len, int shift);
+    int32_t (*scalarproduct_int16)(const int16_t *v1, const int16_t *v2/*align 16*/, int len, int shift);
     /* ape functions */
     /**
      * Calculate scalar product of v1 and v2,
      * and v1[i] += v3[i] * mul
      * @param len length of vectors, should be multiple of 16
      */
-    int32_t (*scalarproduct_and_madd_int16)(int16_t *v1/*align 16*/, int16_t *v2, int16_t *v3, int len, int mul);
+    int32_t (*scalarproduct_and_madd_int16)(int16_t *v1/*align 16*/, const int16_t *v2, const int16_t *v3, int len, int mul);
 
     /* rv30 functions */
     qpel_mc_func put_rv30_tpel_pixels_tab[4][16];
Index: libavcodec/ppc/int_altivec.c
===================================================================
--- libavcodec/ppc/int_altivec.c	(revision 23802)
+++ libavcodec/ppc/int_altivec.c	(working copy)
@@ -79,7 +79,7 @@
     return u.score[3];
 }
 
-static int32_t scalarproduct_int16_altivec(int16_t * v1, int16_t * v2, int order, const int shift)
+static int32_t scalarproduct_int16_altivec(const int16_t * v1, const int16_t * v2, int order, const int shift)
 {
     int i;
     LOAD_ZERO;
@@ -109,7 +109,7 @@
     return ires;
 }
 
-static int32_t scalarproduct_and_madd_int16_altivec(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul)
+static int32_t scalarproduct_and_madd_int16_altivec(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul)
 {
     LOAD_ZERO;
     vec_s16 *pv1 = (vec_s16*)v1;
Index: libavcodec/arm/dsputil_init_neon.c
===================================================================
--- libavcodec/arm/dsputil_init_neon.c	(revision 23802)
+++ libavcodec/arm/dsputil_init_neon.c	(working copy)
@@ -168,10 +168,10 @@
 
 void ff_vorbis_inverse_coupling_neon(float *mag, float *ang, int blocksize);
 
-int32_t ff_scalarproduct_int16_neon(int16_t *v1, int16_t *v2, int len,
+int32_t ff_scalarproduct_int16_neon(const int16_t *v1, const int16_t *v2, int len,
                                     int shift);
-int32_t ff_scalarproduct_and_madd_int16_neon(int16_t *v1, int16_t *v2,
-                                             int16_t *v3, int len, int mul);
+int32_t ff_scalarproduct_and_madd_int16_neon(int16_t *v1, const int16_t *v2,
+                                             const int16_t *v3, int len, int mul);
 
 void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
 {
Index: libavcodec/x86/dsputil_mmx.c
===================================================================
--- libavcodec/x86/dsputil_mmx.c	(revision 23802)
+++ libavcodec/x86/dsputil_mmx.c	(working copy)
@@ -2374,11 +2374,11 @@
 void ff_float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len);
 void ff_float_to_int16_interleave6_3dnow(int16_t *dst, const float **src, int len);
 void ff_float_to_int16_interleave6_3dn2(int16_t *dst, const float **src, int len);
-int32_t ff_scalarproduct_int16_mmx2(int16_t *v1, int16_t *v2, int order, int shift);
-int32_t ff_scalarproduct_int16_sse2(int16_t *v1, int16_t *v2, int order, int shift);
-int32_t ff_scalarproduct_and_madd_int16_mmx2(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul);
-int32_t ff_scalarproduct_and_madd_int16_sse2(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul);
-int32_t ff_scalarproduct_and_madd_int16_ssse3(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul);
+int32_t ff_scalarproduct_int16_mmx2(const int16_t *v1, const int16_t *v2, int order, int shift);
+int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2, int order, int shift);
+int32_t ff_scalarproduct_and_madd_int16_mmx2(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul);
+int32_t ff_scalarproduct_and_madd_int16_sse2(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul);
+int32_t ff_scalarproduct_and_madd_int16_ssse3(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul);
 void ff_add_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top);
 int  ff_add_hfyu_left_prediction_ssse3(uint8_t *dst, const uint8_t *src, int w, int left);
 int  ff_add_hfyu_left_prediction_sse4(uint8_t *dst, const uint8_t *src, int w, int left);



More information about the ffmpeg-devel mailing list