summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-05-05 21:15:28 +0300
committerAndrei Karas <akaras@inbox.ru>2018-05-05 23:52:00 +0300
commit9874a6311c6b51247caed248cfcf2d2e72095923 (patch)
tree0a1810721ddf2cb6ed4e1740e8bcf3da1cd21171 /src/resources
parent55d8a832786175c5ff9c9ab2eaa31296d342490a (diff)
downloadmanaplus-9874a6311c6b51247caed248cfcf2d2e72095923.tar.gz
manaplus-9874a6311c6b51247caed248cfcf2d2e72095923.tar.bz2
manaplus-9874a6311c6b51247caed248cfcf2d2e72095923.tar.xz
manaplus-9874a6311c6b51247caed248cfcf2d2e72095923.zip
Remove support for CILK plus.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/dye/dye.cpp125
-rw-r--r--src/resources/dye/dyepalette_replaceacolor.cpp42
-rw-r--r--src/resources/dye/dyepalette_replaceaoglcolor.cpp126
-rw-r--r--src/resources/dye/dyepalette_replacescolor.cpp39
-rw-r--r--src/resources/dye/dyepalette_replacesoglcolor.cpp126
-rw-r--r--src/resources/sdlimagehelper.cpp2
6 files changed, 1 insertions, 459 deletions
diff --git a/src/resources/dye/dye.cpp b/src/resources/dye/dye.cpp
index 4b6c3e593..0e8f87a78 100644
--- a/src/resources/dye/dye.cpp
+++ b/src/resources/dye/dye.cpp
@@ -159,68 +159,6 @@ void Dye::normalDye(uint32_t *restrict pixels,
if (pixels == nullptr)
return;
-#ifdef ENABLE_CILKPLUS
- cilk_for (int ptr = 0; ptr < bufSize; ptr ++)
- {
- const uint32_t p = pixels[ptr];
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const int alpha = p & 0xff000000;
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const int alpha = p & 0xff;
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- if (alpha)
- {
- unsigned int color[3];
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- color[0] = (p) & 255U;
- color[1] = (p >> 8U) & 255U;
- color[2] = (p >> 16U) & 255U;
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- color[0] = (p >> 24U) & 255U;
- color[1] = (p >> 16U) & 255U;
- color[2] = (p >> 8U) & 255U;
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const unsigned int cmax = std::max(
- color[0], std::max(color[1], color[2]));
- if (cmax == 0)
- goto endlabel;
-
- const unsigned int cmin = std::min(
- color[0], std::min(color[1], color[2]));
- const unsigned int intensity = color[0] + color[1] + color[2];
- unsigned int i;
-
- if (cmin != cmax && (cmin != 0 || (intensity != cmax
- && intensity != 2 * cmax)))
- {
- // not pure
- goto endlabel;
- }
-
- i = (color[0] != 0) | ((color[1] != 0) << 1)
- | ((color[2] != 0) << 2);
-
- if (mDyePalettes[i - 1])
- mDyePalettes[i - 1]->getColor(cmax, color);
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- pixels[ptr] = (color[0]) | (color[1] << 8)
- | (color[2] << 16) | alpha;
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- pixels[ptr] = (color[0] << 24) | (color[1] << 16)
- | (color[2] << 8) | alpha;
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
- }
-endlabel:{}
- }
-
-#else // ENABLE_CILKPLUS
-
for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++ pixels)
@@ -279,7 +217,6 @@ endlabel:{}
| (color[2] << 8) | alpha;
#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
}
-#endif // ENABLE_CILKPLUS
}
void Dye::normalOGLDye(uint32_t *restrict pixels,
@@ -288,67 +225,6 @@ void Dye::normalOGLDye(uint32_t *restrict pixels,
if (pixels == nullptr)
return;
-#ifdef ENABLE_CILKPLUS
- cilk_for (int ptr = 0; ptr < bufSize; ptr ++)
- {
- const uint32_t p = pixels[ptr];
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const int alpha = p & 255;
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const int alpha = p & 0xff000000;
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- if (alpha)
- {
- unsigned int color[3];
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- color[0] = (p >> 24U) & 255U;
- color[1] = (p >> 16U) & 255U;
- color[2] = (p >> 8U) & 255U;
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- color[0] = (p) & 255U;
- color[1] = (p >> 8U) & 255U;
- color[2] = (p >> 16U) & 255U;
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const unsigned int cmax = std::max(
- color[0], std::max(color[1], color[2]));
- if (cmax == 0)
- goto endlabel;
-
- const unsigned int cmin = std::min(
- color[0], std::min(color[1], color[2]));
- const unsigned int intensity = color[0] + color[1] + color[2];
-
- if (cmin != cmax && (cmin != 0 || (intensity != cmax
- && intensity != 2 * cmax)))
- {
- // not pure
- goto endlabel;
- }
-
- const unsigned int i = (color[0] != 0) | ((color[1] != 0) << 1)
- | ((color[2] != 0) << 2);
-
- if (mDyePalettes[i - 1])
- mDyePalettes[i - 1]->getColor(cmax, color);
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- pixels[ptr] = (color[0] << 24) | (color[1] << 16)
- | (color[2] << 8) | alpha;
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- pixels[ptr] = (color[0]) | (color[1] << 8)
- | (color[2] << 16) | alpha;
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
- }
-endlabel:{}
- }
-
-#else // ENABLE_CILKPLUS
-
for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++ pixels)
@@ -407,5 +283,4 @@ endlabel:{}
| (color[2] << 16) | alpha;
#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
}
-#endif // ENABLE_CILKPLUS
}
diff --git a/src/resources/dye/dyepalette_replaceacolor.cpp b/src/resources/dye/dyepalette_replaceacolor.cpp
index 86c4e600f..5d94d9a1f 100644
--- a/src/resources/dye/dyepalette_replaceacolor.cpp
+++ b/src/resources/dye/dyepalette_replaceacolor.cpp
@@ -46,47 +46,6 @@ void DyePalette::replaceAColorDefault(uint32_t *restrict pixels,
if ((sz % 2) != 0u)
-- it_end;
-#ifdef ENABLE_CILKPLUS
- cilk_for (int ptr = 0; ptr < bufSize; ptr ++)
- {
- uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]);
- const unsigned int data = pixels[ptr];
-
- STD_VECTOR<DyeColor>::const_iterator it = mColors.begin();
- while (it != it_end)
- {
- const DyeColor &col = *it;
- ++ it;
- const DyeColor &col2 = *it;
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const unsigned int coldata = (col.value[3] << 24U)
- | (col.value[2] << 16U)
- | (col.value[1] << 8U)
- | (col.value[0]);
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const unsigned int coldata = (col.value[3])
- | (col.value[2] << 8U)
- | (col.value[1] << 16U) |
- (col.value[0] << 24U);
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- if (data == coldata)
- {
- p[3] = col2.value[0];
- p[2] = col2.value[1];
- p[1] = col2.value[2];
- p[0] = col2.value[3];
- break;
- }
-
- ++ it;
- }
- }
-
-#else // ENABLE_CILKPLUS
-
for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++pixels)
@@ -125,7 +84,6 @@ void DyePalette::replaceAColorDefault(uint32_t *restrict pixels,
++ it;
}
}
-#endif // ENABLE_CILKPLUS
}
#ifdef SIMD_SUPPORTED
diff --git a/src/resources/dye/dyepalette_replaceaoglcolor.cpp b/src/resources/dye/dyepalette_replaceaoglcolor.cpp
index 938d648eb..ec999812a 100644
--- a/src/resources/dye/dyepalette_replaceaoglcolor.cpp
+++ b/src/resources/dye/dyepalette_replaceaoglcolor.cpp
@@ -48,47 +48,6 @@ void DyePalette::replaceAOGLColorDefault(uint32_t *restrict pixels,
if ((sz % 2) != 0u)
-- it_end;
-#ifdef ENABLE_CILKPLUS
- cilk_for (int ptr = 0; ptr < bufSize; ptr ++)
- {
- uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]);
- const unsigned int data = pixels[ptr];
-
- STD_VECTOR<DyeColor>::const_iterator it = mColors.begin();
- while (it != it_end)
- {
- const DyeColor &col = *it;
- ++ it;
- const DyeColor &col2 = *it;
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const unsigned int coldata = (col.value[0] << 24U)
- | (col.value[1] << 16U)
- | (col.value[2] << 8U)
- | col.value[3];
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const unsigned int coldata = (col.value[0])
- | (col.value[1] << 8U)
- | (col.value[2] << 16U)
- | (col.value[3] << 24U);
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- if (data == coldata)
- {
- p[0] = col2.value[0];
- p[1] = col2.value[1];
- p[2] = col2.value[2];
- p[3] = col2.value[3];
- break;
- }
-
- ++ it;
- }
- }
-
-#else // ENABLE_CILKPLUS
-
for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++pixels)
@@ -128,7 +87,6 @@ void DyePalette::replaceAOGLColorDefault(uint32_t *restrict pixels,
++ it;
}
}
-#endif // ENABLE_CILKPLUS
}
#ifdef SIMD_SUPPORTED
@@ -182,47 +140,6 @@ void DyePalette::replaceAOGLColorSse2(uint32_t *restrict pixels,
}
else
{
-#ifdef ENABLE_CILKPLUS
- cilk_for (int ptr = 0; ptr < bufSize; ptr ++)
- {
- uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]);
- const unsigned int data = pixels[ptr];
-
- STD_VECTOR<DyeColor>::const_iterator it = mColors.begin();
- while (it != it_end)
- {
- const DyeColor &col = *it;
- ++ it;
- const DyeColor &col2 = *it;
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const unsigned int coldata = (col.value[0] << 24U)
- | (col.value[1] << 16U)
- | (col.value[2] << 8U)
- | col.value[3];
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const unsigned int coldata = (col.value[0])
- | (col.value[1] << 8U)
- | (col.value[2] << 16U)
- | (col.value[3] << 24U);
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- if (data == coldata)
- {
- p[0] = col2.value[0];
- p[1] = col2.value[1];
- p[2] = col2.value[2];
- p[3] = col2.value[3];
- break;
- }
-
- ++ it;
- }
- }
-
-#else // ENABLE_CILKPLUS
-
for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++pixels)
@@ -262,7 +179,6 @@ void DyePalette::replaceAOGLColorSse2(uint32_t *restrict pixels,
++ it;
}
}
-#endif // ENABLE_CILKPLUS
}
}
@@ -310,47 +226,6 @@ void DyePalette::replaceAOGLColorAvx2(uint32_t *restrict pixels,
}
else
{
-#ifdef ENABLE_CILKPLUS
- cilk_for (int ptr = 0; ptr < bufSize; ptr ++)
- {
- uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]);
- const unsigned int data = pixels[ptr];
-
- STD_VECTOR<DyeColor>::const_iterator it = mColors.begin();
- while (it != it_end)
- {
- const DyeColor &col = *it;
- ++ it;
- const DyeColor &col2 = *it;
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const unsigned int coldata = (col.value[0] << 24U)
- | (col.value[1] << 16U)
- | (col.value[2] << 8U)
- | col.value[3];
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const unsigned int coldata = (col.value[0])
- | (col.value[1] << 8U)
- | (col.value[2] << 16U)
- | (col.value[3] << 24U);
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- if (data == coldata)
- {
- p[0] = col2.value[0];
- p[1] = col2.value[1];
- p[2] = col2.value[2];
- p[3] = col2.value[3];
- break;
- }
-
- ++ it;
- }
- }
-
-#else // ENABLE_CILKPLUS
-
for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++pixels)
@@ -390,7 +265,6 @@ void DyePalette::replaceAOGLColorAvx2(uint32_t *restrict pixels,
++ it;
}
}
-#endif // ENABLE_CILKPLUS
}
}
diff --git a/src/resources/dye/dyepalette_replacescolor.cpp b/src/resources/dye/dyepalette_replacescolor.cpp
index 2899ba3f3..80b82751d 100644
--- a/src/resources/dye/dyepalette_replacescolor.cpp
+++ b/src/resources/dye/dyepalette_replacescolor.cpp
@@ -46,44 +46,6 @@ void DyePalette::replaceSColorDefault(uint32_t *restrict pixels,
if ((sz % 2) != 0u)
-- it_end;
-#ifdef ENABLE_CILKPLUS
- cilk_for (int ptr = 0; ptr < bufSize; ptr ++)
- {
- uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]);
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const unsigned int data = pixels[ptr] & 0x00ffffff;
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const unsigned int data = pixels[ptr] & 0xffffff00;
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- STD_VECTOR<DyeColor>::const_iterator it = mColors.begin();
- while (it != it_end)
- {
- const DyeColor &col = *it;
- ++ it;
- const DyeColor &col2 = *it;
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const unsigned int coldata = (col.value[2] << 16U)
- | (col.value[1] << 8U) | (col.value[0]);
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
- const unsigned int coldata = (col.value[2] << 8U)
- | (col.value[1] << 16U) | (col.value[0] << 24U);
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- if (data == coldata)
- {
- p[3] = col2.value[0];
- p[2] = col2.value[1];
- p[1] = col2.value[2];
- break;
- }
- ++ it;
- }
- }
-#else // ENABLE_CILKPLUS
-
for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++ pixels)
@@ -123,7 +85,6 @@ void DyePalette::replaceSColorDefault(uint32_t *restrict pixels,
++ it;
}
}
-#endif // ENABLE_CILKPLUS
}
#ifdef SIMD_SUPPORTED
diff --git a/src/resources/dye/dyepalette_replacesoglcolor.cpp b/src/resources/dye/dyepalette_replacesoglcolor.cpp
index 2ba19b0bf..7e435d936 100644
--- a/src/resources/dye/dyepalette_replacesoglcolor.cpp
+++ b/src/resources/dye/dyepalette_replacesoglcolor.cpp
@@ -48,47 +48,6 @@ void DyePalette::replaceSOGLColorDefault(uint32_t *restrict pixels,
if ((sz % 2) != 0u)
-- it_end;
-#ifdef ENABLE_CILKPLUS
- cilk_for (int ptr = 0; ptr < bufSize; ptr ++)
- {
- uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]);
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const unsigned int data = (pixels[ptr]) & 0xffffff00;
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const unsigned int data = (pixels[ptr]) & 0x00ffffff;
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- STD_VECTOR<DyeColor>::const_iterator it = mColors.begin();
- while (it != it_end)
- {
- const DyeColor &col = *it;
- ++ it;
- const DyeColor &col2 = *it;
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const unsigned int coldata = (col.value[0] << 24)
- | (col.value[1] << 16) | (col.value[2] << 8);
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const unsigned int coldata = (col.value[0])
- | (col.value[1] << 8) | (col.value[2] << 16);
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- if (data == coldata)
- {
- p[0] = col2.value[0];
- p[1] = col2.value[1];
- p[2] = col2.value[2];
- break;
- }
-
- ++ it;
- }
- }
-
-#else // ENABLE_CILKPLUS
-
for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++pixels)
@@ -128,7 +87,6 @@ void DyePalette::replaceSOGLColorDefault(uint32_t *restrict pixels,
++ it;
}
}
-#endif // ENABLE_CILKPLUS
}
#ifdef SIMD_SUPPORTED
@@ -184,47 +142,6 @@ void DyePalette::replaceSOGLColorSse2(uint32_t *restrict pixels,
}
else
{
-#ifdef ENABLE_CILKPLUS
- cilk_for (int ptr = 0; ptr < bufSize; ptr ++)
- {
- uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]);
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const unsigned int data = (pixels[ptr]) & 0xffffff00;
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const unsigned int data = (pixels[ptr]) & 0x00ffffff;
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- STD_VECTOR<DyeColor>::const_iterator it = mColors.begin();
- while (it != it_end)
- {
- const DyeColor &col = *it;
- ++ it;
- const DyeColor &col2 = *it;
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const unsigned int coldata = (col.value[0] << 24)
- | (col.value[1] << 16) | (col.value[2] << 8);
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const unsigned int coldata = (col.value[0])
- | (col.value[1] << 8) | (col.value[2] << 16);
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- if (data == coldata)
- {
- p[0] = col2.value[0];
- p[1] = col2.value[1];
- p[2] = col2.value[2];
- break;
- }
-
- ++ it;
- }
- }
-
-#else // ENABLE_CILKPLUS
-
for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++pixels)
@@ -264,7 +181,6 @@ void DyePalette::replaceSOGLColorSse2(uint32_t *restrict pixels,
++ it;
}
}
-#endif // ENABLE_CILKPLUS
}
}
@@ -314,47 +230,6 @@ void DyePalette::replaceSOGLColorAvx2(uint32_t *restrict pixels,
}
else
{
-#ifdef ENABLE_CILKPLUS
- cilk_for (int ptr = 0; ptr < bufSize; ptr ++)
- {
- uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]);
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const unsigned int data = (pixels[ptr]) & 0xffffff00;
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const unsigned int data = (pixels[ptr]) & 0x00ffffff;
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- STD_VECTOR<DyeColor>::const_iterator it = mColors.begin();
- while (it != it_end)
- {
- const DyeColor &col = *it;
- ++ it;
- const DyeColor &col2 = *it;
-
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
- const unsigned int coldata = (col.value[0] << 24)
- | (col.value[1] << 16) | (col.value[2] << 8);
-#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- const unsigned int coldata = (col.value[0])
- | (col.value[1] << 8) | (col.value[2] << 16);
-#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
-
- if (data == coldata)
- {
- p[0] = col2.value[0];
- p[1] = col2.value[1];
- p[2] = col2.value[2];
- break;
- }
-
- ++ it;
- }
- }
-
-#else // ENABLE_CILKPLUS
-
for (const uint32_t *const p_end = pixels + CAST_SIZE(bufSize);
pixels != p_end;
++pixels)
@@ -394,7 +269,6 @@ void DyePalette::replaceSOGLColorAvx2(uint32_t *restrict pixels,
++ it;
}
}
-#endif // ENABLE_CILKPLUS
}
}
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index 9cc9ba8f0..1d51bb4cc 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -247,7 +247,7 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage)
const uint8_t ashift = fmt->Ashift;
const uint8_t aloss = fmt->Aloss;
const uint32_t *pixels = static_cast<uint32_t*>(tmpImage->pixels);
- cilk_for (size_t i = 0; i < sz; ++ i)
+ for (size_t i = 0; i < sz; ++ i)
{
const unsigned v = (pixels[i] & amask) >> ashift;
const uint8_t a = static_cast<uint8_t>((v << aloss)