summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bimg/src
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bimg/src')
-rw-r--r--3rdparty/bimg/src/bimg_p.h2
-rw-r--r--3rdparty/bimg/src/image.cpp137
-rw-r--r--3rdparty/bimg/src/image_cubemap_filter.cpp60
-rw-r--r--3rdparty/bimg/src/image_decode.cpp7
-rw-r--r--3rdparty/bimg/src/image_encode.cpp57
-rw-r--r--3rdparty/bimg/src/image_gnf.cpp2
6 files changed, 162 insertions, 103 deletions
diff --git a/3rdparty/bimg/src/bimg_p.h b/3rdparty/bimg/src/bimg_p.h
index c74531d2b5e..a9a4b2ae42f 100644
--- a/3rdparty/bimg/src/bimg_p.h
+++ b/3rdparty/bimg/src/bimg_p.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2018 Branimir Karadzic. All rights reserved.
+ * Copyright 2011-2019 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bimg#license-bsd-2-clause
*/
diff --git a/3rdparty/bimg/src/image.cpp b/3rdparty/bimg/src/image.cpp
index 6bf0d5245da..9ef2e3a6656 100644
--- a/3rdparty/bimg/src/image.cpp
+++ b/3rdparty/bimg/src/image.cpp
@@ -1,14 +1,14 @@
/*
- * Copyright 2011-2018 Branimir Karadzic. All rights reserved.
+ * Copyright 2011-2019 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bimg#license-bsd-2-clause
*/
#include "bimg_p.h"
#include <bx/hash.h>
-#if BIMG_CONFIG_ASTC_DECODE
-# include "../3rdparty/astc/astc_lib.h"
-#endif // BIMG_CONFIG_ASTC_DECODE
+#include <astc-codec/astc-codec.h>
+
+#include <bx/debug.h>
namespace bimg
{
@@ -252,6 +252,11 @@ namespace bimg
const char* getName(TextureFormat::Enum _format)
{
+ if (_format >= TextureFormat::Count)
+ {
+ return "Unknown?!";
+ }
+
return s_textureFormatName[_format];
}
@@ -928,7 +933,7 @@ namespace bimg
xyz[1] += rgba1[5];
xyz[2] += rgba1[6];
- bx::store(dst, bx::normalize(bx::load(xyz) ) );
+ bx::store(dst, bx::normalize(bx::load<bx::Vec3>(xyz) ) );
}
}
}
@@ -1014,7 +1019,7 @@ namespace bimg
for (uint32_t zz = 0; zz < _depth; ++zz, src += _srcPitch*_height, dst += _dstPitch*_height)
{
- bx::memCopy(dst, src, pitch, _height, _srcPitch, _dstPitch);
+ bx::memCopy(dst, _dstPitch, src, _srcPitch, pitch, _height);
}
}
@@ -1060,7 +1065,7 @@ namespace bimg
{ NULL, NULL }, // ASTC10x5
{ NULL, NULL }, // Unknown
{ NULL, NULL }, // R1
- { bx::packR8, bx::unpackR8 }, // A8
+ { bx::packA8, bx::unpackA8 }, // A8
{ bx::packR8, bx::unpackR8 }, // R8
{ bx::packR8I, bx::unpackR8I }, // R8I
{ bx::packR8U, bx::unpackR8U }, // R8U
@@ -1154,16 +1159,14 @@ namespace bimg
}
}
- void imageConvert(void* _dst, uint32_t _dstBpp, PackFn _pack, const void* _src, uint32_t _srcBpp, UnpackFn _unpack, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch)
+ void imageConvert(void* _dst, uint32_t _dstBpp, PackFn _pack, const void* _src, uint32_t _srcBpp, UnpackFn _unpack, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch, uint32_t _dstPitch)
{
const uint8_t* src = (uint8_t*)_src;
uint8_t* dst = (uint8_t*)_dst;
- const uint32_t dstPitch = _width * _dstBpp / 8;
-
for (uint32_t zz = 0; zz < _depth; ++zz)
{
- for (uint32_t yy = 0; yy < _height; ++yy, src += _srcPitch, dst += dstPitch)
+ for (uint32_t yy = 0; yy < _height; ++yy, src += _srcPitch, dst += _dstPitch)
{
for (uint32_t xx = 0; xx < _width; ++xx)
{
@@ -1175,7 +1178,7 @@ namespace bimg
}
}
- bool imageConvert(bx::AllocatorI* _allocator, void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch)
+ bool imageConvert(bx::AllocatorI* _allocator, void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _srcPitch, uint32_t _dstPitch)
{
UnpackFn unpack = s_packUnpack[_srcFormat].unpack;
PackFn pack = s_packUnpack[_dstFormat].pack;
@@ -1205,7 +1208,7 @@ namespace bimg
const uint32_t srcBpp = s_imageBlockInfo[_srcFormat].bitsPerPixel;
const uint32_t dstBpp = s_imageBlockInfo[_dstFormat].bitsPerPixel;
- imageConvert(_dst, dstBpp, pack, _src, srcBpp, unpack, _width, _height, _depth, _srcPitch);
+ imageConvert(_dst, dstBpp, pack, _src, srcBpp, unpack, _width, _height, _depth, _srcPitch, _dstPitch);
return true;
}
@@ -1220,7 +1223,10 @@ namespace bimg
return true;
}
- return imageConvert(_allocator, _dst, _dstFormat, _src, _srcFormat, _width, _height, _depth, _width*srcBpp/8);
+ const uint32_t dstBpp = s_imageBlockInfo[_dstFormat].bitsPerPixel;
+ const uint32_t dstPitch = _width * dstBpp / 8;
+
+ return imageConvert(_allocator, _dst, _dstFormat, _src, _srcFormat, _width, _height, _depth, _width*srcBpp/8, dstPitch);
}
ImageContainer* imageConvert(bx::AllocatorI* _allocator, TextureFormat::Enum _dstFormat, const ImageContainer& _input, bool _convertMips)
@@ -4226,12 +4232,12 @@ namespace bimg
uint32_t size = imageGetSize(NULL, uint16_t(_width), uint16_t(_height), 0, false, false, 1, TextureFormat::RGBA8);
void* temp = BX_ALLOC(_allocator, size);
imageDecodeToRgba8(_allocator, temp, _src, _width, _height, _width*4, _srcFormat);
- imageConvert(_allocator, dst, TextureFormat::R8, temp, TextureFormat::RGBA8, _width, _height, 1, _width*4);
+ imageConvert(_allocator, dst, TextureFormat::R8, temp, TextureFormat::RGBA8, _width, _height, 1, _width*4, _dstPitch);
BX_FREE(_allocator, temp);
}
else
{
- imageConvert(_allocator, dst, TextureFormat::R8, src, _srcFormat, _width, _height, 1, srcPitch);
+ imageConvert(_allocator, dst, TextureFormat::R8, src, _srcFormat, _width, _height, 1, srcPitch, _dstPitch);
}
}
}
@@ -4360,7 +4366,7 @@ namespace bimg
, false
);
imageDecodeToRgba32f(_allocator, rgba32f->m_data, _src, _width, _height, 1, _width*16, _srcFormat);
- imageConvert(_allocator, _dst, TextureFormat::BGRA8, rgba32f->m_data, TextureFormat::RGBA32F, _width, _height, 1, _width*16);
+ imageConvert(_allocator, _dst, TextureFormat::BGRA8, rgba32f->m_data, TextureFormat::RGBA32F, _width, _height, 1, _width*16, _dstPitch);
imageFree(rgba32f);
}
break;
@@ -4523,24 +4529,8 @@ namespace bimg
case TextureFormat::ASTC8x5:
case TextureFormat::ASTC8x6:
case TextureFormat::ASTC10x5:
-#if BIMG_CONFIG_ASTC_DECODE
- astc_decompress
- (
- (const uint8_t*) _src,
- s_imageBlockInfo[_srcFormat].blockWidth,
- s_imageBlockInfo[_srcFormat].blockHeight,
- ASTC_DECODE_LDR_LINEAR,
-
- _width,
- _height,
- (uint8_t*) _dst,
- ASTC_BGRA,
- _dstPitch
- );
-#else
- BX_WARN(false, "ASTC decoder is not implemented.");
- imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffff00) );
-#endif
+ imageDecodeToRgba8(_allocator, _dst, _src, _width, _height, _dstPitch, _srcFormat);
+ imageSwizzleBgra8(_dst, _dstPitch, _width, _height, _dst, _dstPitch);
break;
case TextureFormat::RGBA8:
@@ -4554,7 +4544,7 @@ namespace bimg
{
const uint32_t srcPitch = _width * 4;
const uint32_t size = bx::uint32_min(srcPitch, _dstPitch);
- bx::memCopy(_dst, _src, size, _height, srcPitch, _dstPitch);
+ bx::memCopy(_dst, _dstPitch, _src, srcPitch, size, _height);
}
break;
@@ -4562,7 +4552,7 @@ namespace bimg
{
const uint32_t srcBpp = s_imageBlockInfo[_srcFormat].bitsPerPixel;
const uint32_t srcPitch = _width * srcBpp / 8;
- if (!imageConvert(_allocator, _dst, TextureFormat::BGRA8, _src, _srcFormat, _width, _height, 1, srcPitch) )
+ if (!imageConvert(_allocator, _dst, TextureFormat::BGRA8, _src, _srcFormat, _width, _height, 1, srcPitch, _dstPitch) )
{
// Failed to convert, just make ugly red-yellow checkerboard texture.
imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xffff0000), UINT32_C(0xffffff00) );
@@ -4580,7 +4570,7 @@ namespace bimg
{
const uint32_t srcPitch = _width * 4;
const uint32_t size = bx::uint32_min(srcPitch, _dstPitch);
- bx::memCopy(_dst, _src, size, _height, srcPitch, _dstPitch);
+ bx::memCopy(_dst, _dstPitch, _src, srcPitch, size, _height);
}
break;
@@ -4591,6 +4581,32 @@ namespace bimg
}
break;
+ case TextureFormat::ASTC4x4:
+ case TextureFormat::ASTC5x5:
+ case TextureFormat::ASTC6x6:
+ case TextureFormat::ASTC8x5:
+ case TextureFormat::ASTC8x6:
+ case TextureFormat::ASTC10x5:
+ if (!astc_codec::ASTCDecompressToRGBA(
+ (const uint8_t*)_src
+ , imageGetSize(NULL, uint16_t(_width), uint16_t(_height), 0, false, false, 1, _srcFormat)
+ , _width
+ , _height
+ , TextureFormat::ASTC4x4 == _srcFormat ? astc_codec::FootprintType::k4x4
+ : TextureFormat::ASTC5x5 == _srcFormat ? astc_codec::FootprintType::k5x5
+ : TextureFormat::ASTC6x6 == _srcFormat ? astc_codec::FootprintType::k6x6
+ : TextureFormat::ASTC8x5 == _srcFormat ? astc_codec::FootprintType::k8x5
+ : TextureFormat::ASTC8x6 == _srcFormat ? astc_codec::FootprintType::k8x6
+ : astc_codec::FootprintType::k10x5
+ , (uint8_t*)_dst
+ , _width*_height*4
+ , _dstPitch
+ ) )
+ {
+ imageCheckerboard(_dst, _width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffff00) );
+ }
+ break;
+
default:
{
const uint32_t srcPitch = _width * 4;
@@ -4753,7 +4769,7 @@ namespace bimg
}
else
{
- imageConvert(_allocator, dst, TextureFormat::RGBA32F, src, _srcFormat, _width, _height, 1, srcPitch);
+ imageConvert(_allocator, dst, TextureFormat::RGBA32F, src, _srcFormat, _width, _height, 1, srcPitch, _dstPitch);
}
break;
}
@@ -4802,12 +4818,7 @@ namespace bimg
depth = bx::max<uint32_t>(1, depth);
const uint32_t mipSize = width/blockWidth * height/blockHeight * depth * blockSize;
- if (mipSize != width*height*depth*bpp/8)
- {
- BX_TRACE("x");
- }
-
- const uint32_t size = mipSize*numSides;
+ const uint32_t size = mipSize*numSides;
uint32_t imageSize = bx::toHostEndian(*(const uint32_t*)&data[offset], _imageContainer.m_ktxLE);
BX_CHECK(size == imageSize, "KTX: Image size mismatch %d (expected %d).", size, imageSize);
BX_UNUSED(size, imageSize);
@@ -5267,23 +5278,25 @@ namespace bimg
}
}
- if (UINT32_MAX == ddspf && UINT32_MAX == dxgiFormat)
- {
- for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateDdsFourccFormat); ++ii)
- {
- if (s_translateDdsFourccFormat[ii].m_textureFormat == _format)
- {
- fourccFormat = s_translateDdsFourccFormat[ii].m_format;
- break;
- }
- }
- }
-
- if (UINT32_MAX == ddspf && UINT32_MAX == dxgiFormat && UINT32_MAX == fourccFormat)
- {
- BX_ERROR_SET(_err, BIMG_ERROR, "DDS: output format not supported.");
- return 0;
- }
+ if (UINT32_MAX == ddspf && UINT32_MAX == dxgiFormat)
+ {
+ for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateDdsFourccFormat); ++ii)
+ {
+ if (s_translateDdsFourccFormat[ii].m_textureFormat == _format)
+ {
+ fourccFormat = s_translateDdsFourccFormat[ii].m_format;
+ break;
+ }
+ }
+ }
+
+ if (UINT32_MAX == ddspf
+ && UINT32_MAX == dxgiFormat
+ && UINT32_MAX == fourccFormat)
+ {
+ BX_ERROR_SET(_err, BIMG_ERROR, "DDS: output format not supported.");
+ return 0;
+ }
const uint32_t bpp = getBitsPerPixel(_format);
diff --git a/3rdparty/bimg/src/image_cubemap_filter.cpp b/3rdparty/bimg/src/image_cubemap_filter.cpp
index a967926aa1c..b8e4b372507 100644
--- a/3rdparty/bimg/src/image_cubemap_filter.cpp
+++ b/3rdparty/bimg/src/image_cubemap_filter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2018 Branimir Karadzic. All rights reserved.
+ * Copyright 2011-2019 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bimg#license-bsd-2-clause
*/
@@ -259,22 +259,46 @@ namespace bimg
const float* src2 = (const float*)&srcData[y1*srcPitch + x0*16];
const float* src3 = (const float*)&srcData[y1*srcPitch + x1*16];
- const float tx = srcU - float(int32_t(x0) );
- const float ty = srcV - float(int32_t(y0) );
- const float omtx = 1.0f - tx;
- const float omty = 1.0f - ty;
+ const float tx = srcU - float(int32_t(x0) );
+ const float ty = srcV - float(int32_t(y0) );
+ const float omtx = 1.0f - tx;
+ const float omty = 1.0f - ty;
- float p0[4];
- bx::vec4Mul(p0, src0, omtx*omty);
-
- float p1[4];
- bx::vec4Mul(p1, src1, tx*omty);
-
- float p2[4];
- bx::vec4Mul(p2, src2, omtx*ty);
-
- float p3[4];
- bx::vec4Mul(p3, src3, tx*ty);
+ const float p0x = omtx*omty;
+ const float p0[4] =
+ {
+ src0[0] * p0x,
+ src0[1] * p0x,
+ src0[2] * p0x,
+ src0[3] * p0x,
+ };
+
+ const float p1x = tx*omty;
+ const float p1[4] =
+ {
+ src1[0] * p1x,
+ src1[1] * p1x,
+ src1[2] * p1x,
+ src1[3] * p1x,
+ };
+
+ const float p2x = omtx*ty;
+ const float p2[4] =
+ {
+ src2[0] * p2x,
+ src2[1] * p2x,
+ src2[2] * p2x,
+ src2[3] * p2x,
+ };
+
+ const float p3x = tx*ty;
+ const float p3[4] =
+ {
+ src3[0] * p3x,
+ src3[1] * p3x,
+ src3[2] * p3x,
+ src3[3] * p3x,
+ };
const float rr = p0[0] + p1[0] + p2[0] + p3[0];
const float gg = p0[1] + p1[1] + p2[1] + p3[1];
@@ -339,7 +363,7 @@ namespace bimg
ImageMip dstMip;
imageGetRawData(*output, side, 0, output->m_data, output->m_size, dstMip);
- bx::memCopy(const_cast<uint8_t*>(dstMip.m_data), srcData, dstPitch, dstWidth, srcPitch, dstPitch);
+ bx::memCopy(const_cast<uint8_t*>(dstMip.m_data), dstPitch, srcData, srcPitch, dstPitch, dstWidth);
}
return output;
@@ -954,7 +978,7 @@ namespace bimg
{
const float* normal = (const float*)&nsaMip.m_data[(yy*nsaMip.m_width+xx)*(nsaMip.m_bpp/8)];
const float solidAngle = normal[3];
- const float ndotl = bx::clamp(bx::dot(bx::load(normal), _dir), 0.0f, 1.0f);
+ const float ndotl = bx::clamp(bx::dot(bx::load<bx::Vec3>(normal), _dir), 0.0f, 1.0f);
if (ndotl >= _specularAngle)
{
diff --git a/3rdparty/bimg/src/image_decode.cpp b/3rdparty/bimg/src/image_decode.cpp
index 0ce4023e89a..e58c2703eb9 100644
--- a/3rdparty/bimg/src/image_decode.cpp
+++ b/3rdparty/bimg/src/image_decode.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2018 Branimir Karadzic. All rights reserved.
+ * Copyright 2011-2019 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bimg#license-bsd-2-clause
*/
@@ -647,7 +647,10 @@ namespace bimg
for (uint32_t ii = 0; err.isOk() && ii < numEntries; ++ii)
{
- // https://sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html
+ // Reference(s):
+ // - EXIF Tags
+ // https://web.archive.org/web/20190218005249/https://sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html
+ //
uint16_t tag;
bx::readHE(&reader, tag, littleEndian, &err);
diff --git a/3rdparty/bimg/src/image_encode.cpp b/3rdparty/bimg/src/image_encode.cpp
index 09586fe5105..7d24cc5d672 100644
--- a/3rdparty/bimg/src/image_encode.cpp
+++ b/3rdparty/bimg/src/image_encode.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2018 Branimir Karadzic. All rights reserved.
+ * Copyright 2011-2019 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bimg#license-bsd-2-clause
*/
@@ -30,19 +30,29 @@ namespace bimg
{
static uint32_t s_squishQuality[] =
{
+ // Standard
+ squish::kColourClusterFit, // Default
+ squish::kColourIterativeClusterFit, // Highest
+ squish::kColourRangeFit, // Fastest
+ // Normal map
squish::kColourClusterFit, // Default
squish::kColourIterativeClusterFit, // Highest
squish::kColourRangeFit, // Fastest
};
BX_STATIC_ASSERT(Quality::Count == BX_COUNTOF(s_squishQuality) );
- static const ASTC_COMPRESS_MODE s_astcQuality[] =
- {
- ASTC_COMPRESS_MEDIUM, // Default
- ASTC_COMPRESS_THOROUGH, // Highest
- ASTC_COMPRESS_FAST, // Fastest
- };
- BX_STATIC_ASSERT(Quality::Count == BX_COUNTOF(s_astcQuality));
+ static const ASTC_COMPRESS_MODE s_astcQuality[] =
+ {
+ // Standard
+ ASTC_COMPRESS_MEDIUM, // Default
+ ASTC_COMPRESS_THOROUGH, // Highest
+ ASTC_COMPRESS_FAST, // Fastest
+ // Normal map
+ ASTC_COMPRESS_MEDIUM, // Default
+ ASTC_COMPRESS_THOROUGH, // Highest
+ ASTC_COMPRESS_FAST, // Fastest
+ };
+ BX_STATIC_ASSERT(Quality::Count == BX_COUNTOF(s_astcQuality));
void imageEncodeFromRgba8(bx::AllocatorI* _allocator, void* _dst, const void* _src, uint32_t _width, uint32_t _height, uint32_t _depth, TextureFormat::Enum _format, Quality::Enum _quality, bx::Error* _err)
{
@@ -138,12 +148,19 @@ namespace bimg
case TextureFormat::ASTC8x6:
case TextureFormat::ASTC10x5:
{
- const bimg::ImageBlockInfo& astcBlockInfo = bimg::getBlockInfo(_format);
+ const bimg::ImageBlockInfo& astcBlockInfo = bimg::getBlockInfo(_format);
- ASTC_COMPRESS_MODE compress_mode = s_astcQuality[_quality];
- ASTC_DECODE_MODE decode_mode = ASTC_DECODE_LDR_LINEAR;
+ ASTC_COMPRESS_MODE compress_mode = s_astcQuality[_quality];
+ ASTC_DECODE_MODE decode_mode = ASTC_DECODE_LDR_LINEAR;
- astc_compress(_width, _height, src, ASTC_RGBA, srcPitch, astcBlockInfo.blockWidth, astcBlockInfo.blockHeight, compress_mode, decode_mode, dst);
+ if (Quality::NormalMapDefault <= _quality)
+ {
+ astc_compress(_width, _height, src, ASTC_ENC_NORMAL_RA, srcPitch, astcBlockInfo.blockWidth, astcBlockInfo.blockHeight, compress_mode, decode_mode, dst);
+ }
+ else
+ {
+ astc_compress(_width, _height, src, ASTC_RGBA, srcPitch, astcBlockInfo.blockWidth, astcBlockInfo.blockHeight, compress_mode, decode_mode, dst);
+ }
}
break;
@@ -152,7 +169,7 @@ namespace bimg
break;
case TextureFormat::RGBA8:
- bx::memCopy(_dst, _src, srcPitch, _height, srcPitch, dstPitch);
+ bx::memCopy(_dst, dstPitch, _src, srcPitch, srcPitch, _height);
break;
default:
@@ -490,7 +507,7 @@ namespace bimg
return rgba[3];
}
- float imageAlphaTestCoverage(TextureFormat::Enum _format, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, float _alphaRef, float _scale)
+ float imageAlphaTestCoverage(TextureFormat::Enum _format, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, float _alphaRef, float _scale, uint32_t _upscale)
{
UnpackFn unpack = getUnpack(_format);
if (NULL == unpack)
@@ -501,7 +518,8 @@ namespace bimg
float coverage = 0.0f;
const uint8_t* src = (const uint8_t*)_src;
const uint32_t xstep = getBitsPerPixel(_format) / 8;
- const float numSamples = 8.0f;
+ const uint32_t numSamples = _upscale;
+ const float sampleStep = 1.0f / numSamples;
for (uint32_t yy = 0, ystep = _srcPitch; yy < _height-1; ++yy, src += ystep)
{
@@ -513,9 +531,9 @@ namespace bimg
float alpha01 = _scale * getAlpha(unpack, data+ystep);
float alpha11 = _scale * getAlpha(unpack, data+ystep+xstep);
- for (float fy = 0.5f/numSamples; fy < 1.0f; fy += 1.0f)
+ for (float fy = 0.0f; fy < 1.0f; fy += sampleStep)
{
- for (float fx = 0.5f/numSamples; fx < 1.0f; fx += 1.0f)
+ for (float fx = 0.0f; fx < 1.0f; fx += sampleStep)
{
float alpha = 0.0f
+ alpha00 * (1.0f - fx) * (1.0f - fy)
@@ -536,7 +554,7 @@ namespace bimg
return coverage / float(_width*_height*numSamples*numSamples);
}
- void imageScaleAlphaToCoverage(TextureFormat::Enum _format, uint32_t _width, uint32_t _height, uint32_t _srcPitch, void* _src, float _desiredCoverage, float _alphaRef)
+ void imageScaleAlphaToCoverage(TextureFormat::Enum _format, uint32_t _width, uint32_t _height, uint32_t _srcPitch, void* _src, float _desiredCoverage, float _alphaRef, uint32_t _upscale)
{
PackFn pack = getPack(_format);
UnpackFn unpack = getUnpack(_format);
@@ -550,7 +568,7 @@ namespace bimg
float max = 4.0f;
float scale = 1.0f;
- for (uint32_t ii = 0; ii < 8; ++ii)
+ for (uint32_t ii = 0; ii < 10; ++ii)
{
float coverage = imageAlphaTestCoverage(
_format
@@ -560,6 +578,7 @@ namespace bimg
, _src
, _alphaRef
, scale
+ , _upscale
);
if (coverage < _desiredCoverage)
diff --git a/3rdparty/bimg/src/image_gnf.cpp b/3rdparty/bimg/src/image_gnf.cpp
index 77c6d0a6332..aefccb21682 100644
--- a/3rdparty/bimg/src/image_gnf.cpp
+++ b/3rdparty/bimg/src/image_gnf.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2018 Branimir Karadzic. All rights reserved.
+ * Copyright 2011-2019 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bimg#license-bsd-2-clause
*/