1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
|
From 3c417bbde3864cb57ddc5407472083fa741084ae Mon Sep 17 00:00:00 2001
From: yangfl <yangfl@users.noreply.github.com>
Date: Sat, 27 Jul 2024 12:26:22 +0800
Subject: [PATCH 11/11] stb_image_resize2.h: fix gcc unroll errors
---
stb_image_resize2.h | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/stb_image_resize2.h b/stb_image_resize2.h
index 2a59c95..751bd25 100644
--- a/stb_image_resize2.h
+++ b/stb_image_resize2.h
@@ -1059,7 +1059,7 @@ struct stbir__info
#define stbir__small_float ((float)1 / (1 << 20) / (1 << 20) / (1 << 20) / (1 << 20) / (1 << 20) / (1 << 20))
// min/max friendly
-#define STBIR_CLAMP(x, xmin, xmax) for(;;) { \
+#define STBIR_CLAMP(x, xmin, xmax) while(1) { \
if ( (x) < (xmin) ) (x) = (xmin); \
if ( (x) > (xmax) ) (x) = (xmax); \
break; \
@@ -2613,7 +2613,7 @@ static void stbir_simd_memcpy( void * dest, void const * src, size_t bytes )
d = (char*)( ( ( (size_t)d ) + 16 ) & ~15 );
STBIR_SIMD_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
STBIR_SIMD_NO_UNROLL(d);
@@ -2646,7 +2646,7 @@ static void stbir_simd_memcpy( void * dest, void const * src, size_t bytes )
d = (char*)( ( ( (size_t)d ) + (16*stbir__simdfX_float_count) ) & ~((16*stbir__simdfX_float_count)-1) );
STBIR_SIMD_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
STBIR_SIMD_NO_UNROLL(d);
@@ -7050,7 +7050,7 @@ static stbir__info * stbir__alloc_internal_mem_and_build_samplers( stbir__sample
vertical_buffer_size = (size_t)horizontal->scale_info.output_sub_size * (size_t)effective_channels * sizeof(float) + sizeof(float); // extra float for padding
// we make two passes through this loop, 1st to add everything up, 2nd to allocate and init
- for(;;)
+ while(1)
{
int i;
void * advance_mem = alloced;
@@ -7500,7 +7500,7 @@ static int stbir__double_to_rational(double f, stbir_uint32 limit, stbir_uint32
bot = 1 << 25;
// keep refining, but usually stops in a few loops - usually 5 for bad cases
- for(;;)
+ while(1)
{
stbir_uint64 est, temp;
@@ -8253,7 +8253,7 @@ static float * STBIR__CODER_NAME( stbir__decode_uint8_linear_scaled )( float * d
{
decode_end -= 16;
STBIR_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
#ifdef STBIR_SIMD8
stbir__simdi i; stbir__simdi8 o0,o1;
@@ -8354,7 +8354,7 @@ static void STBIR__CODER_NAME( stbir__encode_uint8_linear_scaled )( void * outpu
float const * end_encode_m8 = encode + width_times_channels - stbir__simdfX_float_count*2;
end_output -= stbir__simdfX_float_count*2;
STBIR_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
stbir__simdfX e0, e1;
stbir__simdi i;
@@ -8472,7 +8472,7 @@ static float * STBIR__CODER_NAME(stbir__decode_uint8_linear)( float * decodep, i
{
decode_end -= 16;
STBIR_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
#ifdef STBIR_SIMD8
stbir__simdi i; stbir__simdi8 o0,o1;
@@ -8566,7 +8566,7 @@ static void STBIR__CODER_NAME( stbir__encode_uint8_linear )( void * outputp, int
float const * end_encode_m8 = encode + width_times_channels - stbir__simdfX_float_count*2;
end_output -= stbir__simdfX_float_count*2;
STBIR_SIMD_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
stbir__simdfX e0, e1;
stbir__simdi i;
@@ -8770,7 +8770,7 @@ static void STBIR__CODER_NAME( stbir__encode_uint8_srgb )( void * outputp, int w
float const * end_encode_m16 = encode + width_times_channels - 16;
end_output -= 16;
STBIR_SIMD_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
stbir__simdf f0, f1, f2, f3;
stbir__simdi i0, i1, i2, i3;
@@ -8875,7 +8875,7 @@ static void STBIR__CODER_NAME( stbir__encode_uint8_srgb4_linearalpha )( void * o
float const * end_encode_m16 = encode + width_times_channels - 16;
end_output -= 16;
STBIR_SIMD_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
stbir__simdf f0, f1, f2, f3;
stbir__simdi i0, i1, i2, i3;
@@ -8969,7 +8969,7 @@ static void STBIR__CODER_NAME( stbir__encode_uint8_srgb2_linearalpha )( void * o
float const * end_encode_m16 = encode + width_times_channels - 16;
end_output -= 16;
STBIR_SIMD_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
stbir__simdf f0, f1, f2, f3;
stbir__simdi i0, i1, i2, i3;
@@ -9032,7 +9032,7 @@ static float * STBIR__CODER_NAME(stbir__decode_uint16_linear_scaled)( float * de
{
decode_end -= 8;
STBIR_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
#ifdef STBIR_SIMD8
stbir__simdi i; stbir__simdi8 o;
@@ -9122,7 +9122,7 @@ static void STBIR__CODER_NAME(stbir__encode_uint16_linear_scaled)( void * output
float const * end_encode_m8 = encode + width_times_channels - stbir__simdfX_float_count*2;
end_output -= stbir__simdfX_float_count*2;
STBIR_SIMD_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
stbir__simdfX e0, e1;
stbir__simdiX i;
@@ -9238,7 +9238,7 @@ static float * STBIR__CODER_NAME(stbir__decode_uint16_linear)( float * decodep,
{
decode_end -= 8;
STBIR_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
#ifdef STBIR_SIMD8
stbir__simdi i; stbir__simdi8 o;
@@ -9324,7 +9324,7 @@ static void STBIR__CODER_NAME(stbir__encode_uint16_linear)( void * outputp, int
float const * end_encode_m8 = encode + width_times_channels - stbir__simdfX_float_count*2;
end_output -= stbir__simdfX_float_count*2;
STBIR_SIMD_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
stbir__simdfX e0, e1;
stbir__simdiX i;
@@ -9422,7 +9422,7 @@ static float * STBIR__CODER_NAME(stbir__decode_half_float_linear)( float * decod
stbir__FP16 const * end_input_m8 = input + width_times_channels - 8;
decode_end -= 8;
STBIR_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
STBIR_NO_UNROLL(decode);
@@ -9508,7 +9508,7 @@ static void STBIR__CODER_NAME( stbir__encode_half_float_linear )( void * outputp
float const * end_encode_m8 = encode + width_times_channels - 8;
end_output -= 8;
STBIR_SIMD_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
STBIR_SIMD_NO_UNROLL(encode);
#ifdef stbir__decode_swizzle
@@ -9594,7 +9594,7 @@ static float * STBIR__CODER_NAME(stbir__decode_float_linear)( float * decodep, i
float const * end_input_m16 = input + width_times_channels - 16;
decode_end -= 16;
STBIR_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
STBIR_NO_UNROLL(decode);
#ifdef stbir__decode_swizzle
@@ -9722,7 +9722,7 @@ static void STBIR__CODER_NAME( stbir__encode_float_linear )( void * outputp, int
float const * end_encode_m8 = encode + width_times_channels - ( stbir__simdfX_float_count * 2 );
end_output -= ( stbir__simdfX_float_count * 2 );
STBIR_SIMD_NO_UNROLL_LOOP_START_INF_FOR
- for(;;)
+ while(1)
{
stbir__simdfX e0, e1;
STBIR_SIMD_NO_UNROLL(encode);
--
2.50.1
|