[x264-devel] [PATCH] ppc: use correct return type for pixel_sad* altivec functions

Dominik 'Rathann' Mierzejewski dominik at greysector.net
Mon Mar 11 10:17:44 UTC 2024


Applies to both master and stable branch, so please backport.

Fixes the following error when building with GCC 14:
```
common/ppc/pixel.c: In function ‘x264_8_pixel_init_altivec’:
common/ppc/pixel.c:1576:31: error: assignment to ‘x264_pixel_cmp_x3_t’ {aka ‘void (*)(unsigned char *, unsigned char *, unsigned char *, unsigned char *, long int,  int *)’} from incompatible pointer type ‘int (*)(uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t,  int *)’ {aka ‘int (*)(unsigned char *, unsigned char *, unsigned char *, unsigned char *, long int,  int *)’} [-Wincompatible-pointer-types]
 1576 |     pixf->sad_x3[PIXEL_8x16]  = pixel_sad_x3_8x16_altivec;
      |                               ^
common/ppc/pixel.c:1578:31: error: assignment to ‘x264_pixel_cmp_x3_t’ {aka ‘void (*)(unsigned char *, unsigned char *, unsigned char *, unsigned char *, long int,  int *)’} from incompatible pointer type ‘int (*)(uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t,  int *)’ {aka ‘int (*)(unsigned char *, unsigned char *, unsigned char *, unsigned char *, long int,  int *)’} [-Wincompatible-pointer-types]
 1578 |     pixf->sad_x3[PIXEL_8x8]   = pixel_sad_x3_8x8_altivec;
      |                               ^
common/ppc/pixel.c:1581:31: error: assignment to ‘x264_pixel_cmp_x4_t’ {aka ‘void (*)(unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, long int,  int *)’} from incompatible pointer type ‘int (*)(uint8_t *, uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t,  int *)’ {aka ‘int (*)(unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, long int,  int *)’} [-Wincompatible-pointer-types]
 1581 |     pixf->sad_x4[PIXEL_8x16]  = pixel_sad_x4_8x16_altivec;
      |                               ^
common/ppc/pixel.c:1583:31: error: assignment to ‘x264_pixel_cmp_x4_t’ {aka ‘void (*)(unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, long int,  int *)’} from incompatible pointer type ‘int (*)(uint8_t *, uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t,  int *)’ {aka ‘int (*)(unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned char *, long int,  int *)’} [-Wincompatible-pointer-types]
 1583 |     pixf->sad_x4[PIXEL_8x8]   = pixel_sad_x4_8x8_altivec;
      |                               ^
make: *** [Makefile:284: common/ppc/pixel-8.o] Error 1
```
---
 common/ppc/pixel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/ppc/pixel.c b/common/ppc/pixel.c
index 715148d9..f74c9d42 100644
--- a/common/ppc/pixel.c
+++ b/common/ppc/pixel.c
@@ -855,7 +855,7 @@ static void pixel_sad_x4_16x8_altivec( uint8_t *fenc, uint8_t *pix0, uint8_t *pi
         sum2v = (vec_s32_t) vec_sum4s( vec_absd( fencv, pix2v ), (vec_u32_t) sum2v );
 
 #define PIXEL_SAD_X3_ALTIVEC( name, ly )            \
-static int name( uint8_t *fenc, uint8_t *pix0,      \
+static void name( uint8_t *fenc, uint8_t *pix0,      \
                  uint8_t *pix1, uint8_t *pix2,      \
                  intptr_t i_stride, int scores[3] ) \
 {                                                   \
@@ -965,7 +965,7 @@ static void pixel_sad_x3_16x8_altivec( uint8_t *fenc, uint8_t *pix0,
 }
 
 #define PIXEL_SAD_X4_ALTIVEC( name, ly )                                              \
-static int name( uint8_t *fenc,                                                       \
+static void name( uint8_t *fenc,                                                       \
                  uint8_t *pix0, uint8_t *pix1,                                        \
                  uint8_t *pix2, uint8_t *pix3,                                        \
                  intptr_t i_stride, int scores[4] )                                   \
-- 
2.44.0

Regards,
Dominik
-- 
Fedora   https://fedoraproject.org
Deep in the human unconscious is a pervasive need for a logical universe that
makes sense. But the real universe is always one step beyond logic.
        -- from "The Sayings of Muad'Dib" by the Princess Irulan


More information about the x264-devel mailing list