X-Git-Url: https://harrygodden.com/git/?p=convexer.git;a=blobdiff_plain;f=nbvtf%2Frgbcx.h;fp=nbvtf%2Frgbcx.h;h=620441b3fc7c98b678a5c355e0223aad8091ef5e;hp=dd199b781471d6ce432b798b9549048d0e332454;hb=12102f7b89f21fe5148e9a4506f505fcaef98da2;hpb=7a7000b2a485ca28219d3c7449db9d9291398902 diff --git a/nbvtf/rgbcx.h b/nbvtf/rgbcx.h index dd199b7..620441b 100644 --- a/nbvtf/rgbcx.h +++ b/nbvtf/rgbcx.h @@ -58,8 +58,17 @@ #include #include -#include #include + +#ifndef RGBCX_NO_ALGORITHM + #include +#else +int std_sort_int (const void * a, const void * b) +{ + return ( *(int*)a - *(int*)b ); +} +#endif + #include // By default, the table used to accelerate cluster fit on 4 color blocks uses a 969x128 entry table. @@ -2818,7 +2827,11 @@ namespace rgbcx dots[i] = (d << 4) + i; } - std::sort(dots, dots + 16); +#ifdef RGBCX_NO_ALGORITHM + qsort( dots, 16, sizeof(int), std_sort_int ); +#else + std::sort(dots, dots + 16); +#endif uint32_t r_sum[17], g_sum[17], b_sum[17]; uint32_t r = 0, g = 0, b = 0; @@ -3716,9 +3729,13 @@ namespace rgbcx assert(d >= 0); dots[i] = (d << 4) + i; } + +#ifdef RGBCX_NO_ALGORITHM + qsort( dots, 16, sizeof(int), std_sort_int ); +#else + std::sort(dots, dots + 16); +#endif - std::sort(dots, dots + 16); - uint32_t r_sum[17], g_sum[17], b_sum[17]; uint32_t r = 0, g = 0, b = 0; for (uint32_t i = 0; i < 16; i++)