diff --git a/simd/powerpc/jccolext-altivec.c b/simd/powerpc/jccolext-altivec.c index 170f90ff..a51b4be7 100644 --- a/simd/powerpc/jccolext-altivec.c +++ b/simd/powerpc/jccolext-altivec.c @@ -1,7 +1,7 @@ /* * AltiVec optimizations for libjpeg-turbo * - * Copyright (C) 2014-2015, D. R. Commander. All Rights Reserved. + * Copyright (C) 2014-2015, 2024, D. R. Commander. All Rights Reserved. * Copyright (C) 2014, Jay Foad. All Rights Reserved. * * This software is provided 'as-is', without any express or implied @@ -30,17 +30,17 @@ void jsimd_rgb_ycc_convert_altivec(JDIMENSION img_width, JSAMPARRAY input_buf, { JSAMPROW inptr, outptr0, outptr1, outptr2; int pitch = img_width * RGB_PIXELSIZE, num_cols; -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ int offset; #endif unsigned char __attribute__((aligned(16))) tmpbuf[RGB_PIXELSIZE * 16]; __vector unsigned char rgb0, rgb1 = { 0 }, rgb2 = { 0 }, rgbg0, rgbg1, rgbg2, rgbg3, y, cb, cr; -#if __BIG_ENDIAN__ || RGB_PIXELSIZE == 4 +#if defined(__BIG_ENDIAN__) || RGB_PIXELSIZE == 4 __vector unsigned char rgb3 = { 0 }; #endif -#if __BIG_ENDIAN__ && RGB_PIXELSIZE == 4 +#if defined(__BIG_ENDIAN__) && RGB_PIXELSIZE == 4 __vector unsigned char rgb4 = { 0 }; #endif __vector short rg0, rg1, rg2, rg3, bg0, bg1, bg2, bg3; @@ -56,7 +56,7 @@ void jsimd_rgb_ycc_convert_altivec(JDIMENSION img_width, JSAMPARRAY input_buf, __vector int pd_onehalf = { __4X(ONE_HALF) }, pd_onehalfm1_cj = { __4X(ONE_HALF - 1 + (CENTERJSAMPLE << SCALEBITS)) }; __vector unsigned char pb_zero = { __16X(0) }, -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ shift_pack_index = { 0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29 }; #else @@ -75,7 +75,7 @@ void jsimd_rgb_ycc_convert_altivec(JDIMENSION img_width, JSAMPARRAY input_buf, num_cols -= RGB_PIXELSIZE * 16, inptr += RGB_PIXELSIZE * 16, outptr0 += 16, outptr1 += 16, outptr2 += 16) { -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ /* Load 16 pixels == 48 or 64 bytes */ offset = (size_t)inptr & 15; if (offset) { @@ -141,7 +141,7 @@ void jsimd_rgb_ycc_convert_altivec(JDIMENSION img_width, JSAMPARRAY input_buf, rgb3 = VEC_LD(48, inptr); #endif } -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ } #endif diff --git a/simd/powerpc/jcgryext-altivec.c b/simd/powerpc/jcgryext-altivec.c index b280cbbd..550e239a 100644 --- a/simd/powerpc/jcgryext-altivec.c +++ b/simd/powerpc/jcgryext-altivec.c @@ -1,7 +1,7 @@ /* * AltiVec optimizations for libjpeg-turbo * - * Copyright (C) 2014-2015, D. R. Commander. All Rights Reserved. + * Copyright (C) 2014-2015, 2024, D. R. Commander. All Rights Reserved. * Copyright (C) 2014, Jay Foad. All Rights Reserved. * * This software is provided 'as-is', without any express or implied @@ -30,17 +30,17 @@ void jsimd_rgb_gray_convert_altivec(JDIMENSION img_width, JSAMPARRAY input_buf, { JSAMPROW inptr, outptr; int pitch = img_width * RGB_PIXELSIZE, num_cols; -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ int offset; unsigned char __attribute__((aligned(16))) tmpbuf[RGB_PIXELSIZE * 16]; #endif __vector unsigned char rgb0, rgb1 = { 0 }, rgb2 = { 0 }, rgbg0, rgbg1, rgbg2, rgbg3, y; -#if __BIG_ENDIAN__ || RGB_PIXELSIZE == 4 +#if defined(__BIG_ENDIAN__) || RGB_PIXELSIZE == 4 __vector unsigned char rgb3 = { 0 }; #endif -#if __BIG_ENDIAN__ && RGB_PIXELSIZE == 4 +#if defined(__BIG_ENDIAN__) && RGB_PIXELSIZE == 4 __vector unsigned char rgb4 = { 0 }; #endif __vector short rg0, rg1, rg2, rg3, bg0, bg1, bg2, bg3; @@ -52,7 +52,7 @@ void jsimd_rgb_gray_convert_altivec(JDIMENSION img_width, JSAMPARRAY input_buf, pw_f0114_f0250 = { __4X2(F_0_114, F_0_250) }; __vector int pd_onehalf = { __4X(ONE_HALF) }; __vector unsigned char pb_zero = { __16X(0) }, -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ shift_pack_index = { 0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29 }; #else @@ -69,7 +69,7 @@ void jsimd_rgb_gray_convert_altivec(JDIMENSION img_width, JSAMPARRAY input_buf, num_cols -= RGB_PIXELSIZE * 16, inptr += RGB_PIXELSIZE * 16, outptr += 16) { -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ /* Load 16 pixels == 48 or 64 bytes */ offset = (size_t)inptr & 15; if (offset) { diff --git a/simd/powerpc/jcsample-altivec.c b/simd/powerpc/jcsample-altivec.c index 6e25b8db..6bda03a8 100644 --- a/simd/powerpc/jcsample-altivec.c +++ b/simd/powerpc/jcsample-altivec.c @@ -1,7 +1,7 @@ /* * AltiVec optimizations for libjpeg-turbo * - * Copyright (C) 2015, D. R. Commander. All Rights Reserved. + * Copyright (C) 2015, 2024, D. R. Commander. All Rights Reserved. * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -50,7 +50,7 @@ void jsimd_h2v1_downsample_altivec(JDIMENSION image_width, expand_right_edge(input_data, max_v_samp_factor, image_width, output_cols * 2); - for (outrow = 0; outrow < v_samp_factor; outrow++) { + for (outrow = 0; outrow < (int)v_samp_factor; outrow++) { outptr = output_data[outrow]; inptr = input_data[outrow]; @@ -107,7 +107,7 @@ jsimd_h2v2_downsample_altivec(JDIMENSION image_width, int max_v_samp_factor, expand_right_edge(input_data, max_v_samp_factor, image_width, output_cols * 2); - for (inrow = 0, outrow = 0; outrow < v_samp_factor; + for (inrow = 0, outrow = 0; outrow < (int)v_samp_factor; inrow += 2, outrow++) { inptr0 = input_data[inrow]; diff --git a/simd/powerpc/jdcolext-altivec.c b/simd/powerpc/jdcolext-altivec.c index 68d52bd8..7e3a2049 100644 --- a/simd/powerpc/jdcolext-altivec.c +++ b/simd/powerpc/jdcolext-altivec.c @@ -1,7 +1,7 @@ /* * AltiVec optimizations for libjpeg-turbo * - * Copyright (C) 2015, D. R. Commander. All Rights Reserved. + * Copyright (C) 2015, 2024, D. R. Commander. All Rights Reserved. * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -29,14 +29,14 @@ void jsimd_ycc_rgb_convert_altivec(JDIMENSION out_width, JSAMPIMAGE input_buf, { JSAMPROW outptr, inptr0, inptr1, inptr2; int pitch = out_width * RGB_PIXELSIZE, num_cols; -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ int offset; #endif unsigned char __attribute__((aligned(16))) tmpbuf[RGB_PIXELSIZE * 16]; __vector unsigned char rgb0, rgb1, rgb2, rgbx0, rgbx1, rgbx2, rgbx3, y, cb, cr; -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ __vector unsigned char edgel, edgeh, edges, out0, out1, out2, out3; #if RGB_PIXELSIZE == 4 __vector unsigned char out4; @@ -60,7 +60,7 @@ void jsimd_ycc_rgb_convert_altivec(JDIMENSION out_width, JSAMPIMAGE input_buf, pw_cj = { __8X(CENTERJSAMPLE) }; __vector int pd_onehalf = { __4X(ONE_HALF) }; __vector unsigned char pb_zero = { __16X(0) }, -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ shift_pack_index = { 0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29 }; #else @@ -196,7 +196,7 @@ void jsimd_ycc_rgb_convert_altivec(JDIMENSION out_width, JSAMPIMAGE input_buf, rgb3 = vec_perm(rgbx3, rgbx3, (__vector unsigned char)RGB_INDEX); #endif -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ offset = (size_t)outptr & 15; if (offset) { __vector unsigned char unaligned_shift_index; @@ -268,7 +268,7 @@ void jsimd_ycc_rgb_convert_altivec(JDIMENSION out_width, JSAMPIMAGE input_buf, VEC_ST(rgb3, 48, outptr); #endif } -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ } #endif } diff --git a/simd/powerpc/jdmrgext-altivec.c b/simd/powerpc/jdmrgext-altivec.c index 40f02c33..167b7380 100644 --- a/simd/powerpc/jdmrgext-altivec.c +++ b/simd/powerpc/jdmrgext-altivec.c @@ -1,7 +1,7 @@ /* * AltiVec optimizations for libjpeg-turbo * - * Copyright (C) 2015, D. R. Commander. All Rights Reserved. + * Copyright (C) 2015, 2024, D. R. Commander. All Rights Reserved. * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -30,14 +30,14 @@ void jsimd_h2v1_merged_upsample_altivec(JDIMENSION output_width, { JSAMPROW outptr, inptr0, inptr1, inptr2; int pitch = output_width * RGB_PIXELSIZE, num_cols, yloop; -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ int offset; #endif unsigned char __attribute__((aligned(16))) tmpbuf[RGB_PIXELSIZE * 16]; __vector unsigned char rgb0, rgb1, rgb2, rgbx0, rgbx1, rgbx2, rgbx3, y, cb, cr; -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ __vector unsigned char edgel, edgeh, edges, out0, out1, out2, out3; #if RGB_PIXELSIZE == 4 __vector unsigned char out4; @@ -62,7 +62,7 @@ void jsimd_h2v1_merged_upsample_altivec(JDIMENSION output_width, pw_cj = { __8X(CENTERJSAMPLE) }; __vector int pd_onehalf = { __4X(ONE_HALF) }; __vector unsigned char pb_zero = { __16X(0) }, -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ shift_pack_index = { 0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29 }, even_index = @@ -225,7 +225,7 @@ void jsimd_h2v1_merged_upsample_altivec(JDIMENSION output_width, rgb3 = vec_perm(rgbx3, rgbx3, (__vector unsigned char)RGB_INDEX); #endif -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ offset = (size_t)outptr & 15; if (offset) { __vector unsigned char unaligned_shift_index; @@ -297,7 +297,7 @@ void jsimd_h2v1_merged_upsample_altivec(JDIMENSION output_width, VEC_ST(rgb3, 48, outptr); #endif } -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ } #endif } diff --git a/simd/powerpc/jdsample-altivec.c b/simd/powerpc/jdsample-altivec.c index 04df0cf1..b04f830b 100644 --- a/simd/powerpc/jdsample-altivec.c +++ b/simd/powerpc/jdsample-altivec.c @@ -1,7 +1,7 @@ /* * AltiVec optimizations for libjpeg-turbo * - * Copyright (C) 2015, D. R. Commander. All Rights Reserved. + * Copyright (C) 2015, 2024, D. R. Commander. All Rights Reserved. * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -49,7 +49,7 @@ void jsimd_h2v1_fancy_upsample_altivec(int max_v_samp_factor, { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, next_index_lastcol = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15 }, -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ merge_pack_index = { 1, 17, 3, 19, 5, 21, 7, 23, 9, 25, 11, 27, 13, 29, 15, 31 }; #else @@ -155,7 +155,7 @@ void jsimd_h2v2_fancy_upsample_altivec(int max_v_samp_factor, { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }, next_index_lastcol = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 15 }, -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ merge_pack_index = { 1, 17, 3, 19, 5, 21, 7, 23, 9, 25, 11, 27, 13, 29, 15, 31 }; #else diff --git a/simd/powerpc/jidctfst-altivec.c b/simd/powerpc/jidctfst-altivec.c index 456c6c61..06839c79 100644 --- a/simd/powerpc/jidctfst-altivec.c +++ b/simd/powerpc/jidctfst-altivec.c @@ -1,7 +1,7 @@ /* * AltiVec optimizations for libjpeg-turbo * - * Copyright (C) 2014-2015, D. R. Commander. All Rights Reserved. + * Copyright (C) 2014-2015, 2024, D. R. Commander. All Rights Reserved. * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -127,12 +127,12 @@ void jsimd_idct_ifast_altivec(void *dct_table_, JCOEFPTR coef_block, __vector short pw_zero = { __8X(0) }, pw_F1414 = { __8X(F_1_414 << CONST_SHIFT) }, pw_F1847 = { __8X(F_1_847 << CONST_SHIFT) }, - pw_MF1613 = { __8X(-F_1_613 << CONST_SHIFT) }, + pw_MF1613 = { __8X((short)((unsigned short)(-F_1_613) << CONST_SHIFT)) }, pw_F1082 = { __8X(F_1_082 << CONST_SHIFT) }; __vector unsigned short pre_multiply_scale_bits = { __8X(PRE_MULTIPLY_SCALE_BITS) }, pass1_bits3 = { __8X(PASS1_BITS + 3) }; - __vector signed char pb_centerjsamp = { __16X(CENTERJSAMPLE) }; + __vector signed char pb_centerjsamp = { __16X((signed char)CENTERJSAMPLE) }; /* Pass 1: process columns */ diff --git a/simd/powerpc/jidctint-altivec.c b/simd/powerpc/jidctint-altivec.c index 60e619f1..52e37d90 100644 --- a/simd/powerpc/jidctint-altivec.c +++ b/simd/powerpc/jidctint-altivec.c @@ -1,7 +1,7 @@ /* * AltiVec optimizations for libjpeg-turbo * - * Copyright (C) 2014-2015, 2020, D. R. Commander. All Rights Reserved. + * Copyright (C) 2014-2015, 2020, 2024, D. R. Commander. All Rights Reserved. * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -241,7 +241,7 @@ void jsimd_idct_islow_altivec(void *dct_table_, JCOEFPTR coef_block, __vector unsigned int descale_p1 = { __4X(DESCALE_P1) }, descale_p2 = { __4X(DESCALE_P2) }, const_bits = { __4X(CONST_BITS) }; - __vector signed char pb_centerjsamp = { __16X(CENTERJSAMPLE) }; + __vector signed char pb_centerjsamp = { __16X((signed char)CENTERJSAMPLE) }; /* Pass 1: process columns */ diff --git a/simd/powerpc/jquanti-altivec.c b/simd/powerpc/jquanti-altivec.c index 7d6e3254..05ea13e7 100644 --- a/simd/powerpc/jquanti-altivec.c +++ b/simd/powerpc/jquanti-altivec.c @@ -1,7 +1,7 @@ /* * AltiVec optimizations for libjpeg-turbo * - * Copyright (C) 2014-2015, D. R. Commander. All Rights Reserved. + * Copyright (C) 2014-2015, 2024, D. R. Commander. All Rights Reserved. * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ * always get the data we want by using a single vector load (although we may * have to permute the result.) */ -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ #define LOAD_ROW(row) { \ elemptr = sample_data[row] + start_col; \ @@ -125,7 +125,7 @@ void jsimd_quantize_altivec(JCOEFPTR coef_block, DCTELEM *divisors, /* Constants */ __vector unsigned short pw_word_bit_m1 = { __8X(WORD_BIT - 1) }; -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ __vector unsigned char shift_pack_index = { 0, 1, 16, 17, 4, 5, 20, 21, 8, 9, 24, 25, 12, 13, 28, 29 }; #else diff --git a/simd/powerpc/jsimd_altivec.h b/simd/powerpc/jsimd_altivec.h index e8bdb06a..29c81964 100644 --- a/simd/powerpc/jsimd_altivec.h +++ b/simd/powerpc/jsimd_altivec.h @@ -81,7 +81,7 @@ /* Macros to abstract big/little endian bit twiddling */ -#if __BIG_ENDIAN__ +#ifdef __BIG_ENDIAN__ #define VEC_LD(a, b) vec_ld(a, b) #define VEC_ST(a, b, c) vec_st(a, b, c) @@ -96,3 +96,12 @@ #define VEC_UNPACKLU(a) vec_mergel(a, pb_zero) #endif + + +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wc99-extensions" +#pragma clang diagnostic ignored "-Wshadow" +#elif defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wpedantic" +#pragma GCC diagnostic ignored "-Wshadow" +#endif