From: Rudolf Polzer Date: Tue, 19 Jul 2011 18:11:01 +0000 (+0200) Subject: it probably isn't worth to have MODE_NORMAL and MODE_RANDOM separately compiled X-Git-Tag: android-x86-6.0-r1~25 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=09d34f83cb8bb867e5bd320b9a8a933fcb878649;p=android-x86%2Fexternal-s2tc.git it probably isn't worth to have MODE_NORMAL and MODE_RANDOM separately compiled these modes are already quite slow, no need to have the compiler waste a lot of compile runs for their templates --- diff --git a/s2tc_algorithm.cpp b/s2tc_algorithm.cpp index 7f0c221..20d8e33 100644 --- a/s2tc_algorithm.cpp +++ b/s2tc_algorithm.cpp @@ -312,7 +312,6 @@ namespace enum CompressionMode { MODE_NORMAL, - MODE_RANDOM, MODE_FAST }; @@ -345,8 +344,8 @@ namespace template inline void s2tc_encode_block(unsigned char *out, const unsigned char *rgba, int iw, int w, int h, int nrandom) { - color_t c[16 + (mode == MODE_RANDOM ? nrandom : 0)]; - unsigned char ca[16 + (mode == MODE_RANDOM ? nrandom : 0)]; + color_t c[16 + (nrandom >= 0 ? nrandom : 0)]; + unsigned char ca[16 + (nrandom >= 0 ? nrandom : 0)]; int n = 0, m = 0; int x, y; @@ -431,7 +430,7 @@ namespace } m = n; - if(mode == MODE_RANDOM) + if(nrandom > 0) { color_t mins = c[0]; color_t maxs = c[0]; @@ -822,9 +821,7 @@ namespace template inline s2tc_encode_block_func_t s2tc_encode_block_func(int nrandom, RefinementMode refine) { - if(nrandom > 0) - return s2tc_encode_block_func(refine); - else if(!supports_fast::value || nrandom == 0) // MODE_FAST not supported for normalmaps, sorry + if(!supports_fast::value || nrandom >= 0) return s2tc_encode_block_func(refine); else return s2tc_encode_block_func(refine);