Update stb_image version 2.12 -> 2.28

stb_image v2.12 has a memory corruption bug, updated to v2.28 to fix.

The only real API change is stb_image_resize.h is now stb_image_resize2.h, and stbir_resize_uint8_srgb() doesnt take alpha channels or flags as params.
This commit is contained in:
jathoma98
2023-11-11 13:07:25 +00:00
committed by Baldur Karlsson
parent 73c604d2f0
commit bcb7dfd3ae
11 changed files with 15159 additions and 3705 deletions
+2042 -813
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+803 -127
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -17,8 +17,9 @@
#pragma warning(disable:4189) // local variable is initialized but not referenced
#pragma warning(disable:4244) // <narrowing conversion>, possible loss of data
#pragma warning(disable:4702) // unreachable code
#pragma warning(disable:4204) // nonstandard extension used: non-constant aggregate initializer
#include "stb_image.h"
#include "stb_image_write.h"
#include "stb_image_resize.h"
#include "stb_image_resize2.h"
#include "stb_truetype.h"
+1989 -179
View File
File diff suppressed because it is too large Load Diff
+13 -1
View File
@@ -282,7 +282,7 @@ set(sources
3rdparty/zstd/zstdmt_compress.h
3rdparty/stb/stb_image.h
3rdparty/stb/stb_image_write.h
3rdparty/stb/stb_image_resize.h
3rdparty/stb/stb_image_resize2.h
3rdparty/stb/stb_impl.c
3rdparty/stb/stb_truetype.h
3rdparty/tinyexr/tinyexr.cpp
@@ -417,6 +417,12 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR APPLE)
set_property(SOURCE strings/utf8printf.cpp
APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-unknown-warning -Wno-format-truncation")
# stb_image requires these flags to enable ARM SIMD (NEON) for arm32
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm" AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set_source_files_properties(3rdparty/stb/stb_impl.c
PROPERTIES COMPILE_FLAGS "-mfpu=neon-vfpv4 -mfp16-format=ieee")
endif()
endif()
# Need to add -Wno-unknown-warning-option since only newer clang versions have
@@ -438,6 +444,12 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR APPLE)
# We are deliberately testing self-assign here
set_source_files_properties(replay/basic_types_tests.cpp
PROPERTIES COMPILE_FLAGS "-Wno-unknown-warning-option -Wno-self-assign-overloaded")
# stb_image requires these flags to enable ARM SIMD (NEON) for arm32
if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm" AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set_source_files_properties(3rdparty/stb/stb_impl.c
PROPERTIES COMPILE_FLAGS "-mfpu=neon-vfpv4")
endif()
endif()
endif()
+3 -2
View File
@@ -38,7 +38,8 @@
#include "maths/formatpacking.h"
#include "maths/half_convert.h"
#include "serialise/rdcfile.h"
#include "stb/stb_image_resize.h"
#include "stb/stb_image_resize2.h"
// {5D6BF029-A6BA-417A-8523-120492B1DCE3}
static const GUID CLSID_RDCThumbnailProvider = {0x5d6bf029,
@@ -625,7 +626,7 @@ struct RDCThumbnailProvider : public IThumbnailProvider, IInitializeWithStream
byte *resizedpixels = (byte *)malloc(3 * bi.bV5Width * bi.bV5Height);
stbir_resize_uint8_srgb(thumbpixels, thumbwidth, thumbheight, 0, resizedpixels, bi.bV5Width,
bi.bV5Height, 0, 3, -1, 0);
bi.bV5Height, 0, STBIR_RGB);
free(thumbpixels);
+1 -1
View File
@@ -140,7 +140,7 @@
<ClInclude Include="3rdparty\pugixml\pugiconfig.hpp" />
<ClInclude Include="3rdparty\pugixml\pugixml.hpp" />
<ClInclude Include="3rdparty\stb\stb_image.h" />
<ClInclude Include="3rdparty\stb\stb_image_resize.h" />
<ClInclude Include="3rdparty\stb\stb_image_resize2.h" />
<ClInclude Include="3rdparty\stb\stb_image_write.h" />
<ClInclude Include="3rdparty\stb\stb_truetype.h" />
<ClInclude Include="3rdparty\superluminal\PerformanceAPI_capi.h" />
+1 -1
View File
@@ -294,7 +294,7 @@
<ClInclude Include="3rdparty\plthook\plthook.h">
<Filter>3rdparty\plthook</Filter>
</ClInclude>
<ClInclude Include="3rdparty\stb\stb_image_resize.h">
<ClInclude Include="3rdparty\stb\stb_image_resize2.h">
<Filter>3rdparty\stb</Filter>
</ClInclude>
<ClInclude Include="api\replay\version.h">
+2 -2
View File
@@ -29,7 +29,7 @@
#include "serialise/rdcfile.h"
#include "serialise/serialiser.h"
#include "stb/stb_image.h"
#include "stb/stb_image_resize.h"
#include "stb/stb_image_resize2.h"
#include "stb/stb_image_write.h"
static void writeToBytebuf(void *context, void *data, int size)
@@ -624,7 +624,7 @@ Thumbnail CaptureFile::GetThumbnail(FileType type, uint32_t maxsize)
byte *resizedpixels = (byte *)malloc(3 * clampedWidth * clampedHeight);
stbir_resize_uint8_srgb(thumbpixels, thumbwidth, thumbheight, 0, resizedpixels,
clampedWidth, clampedHeight, 0, 3, -1, 0);
clampedWidth, clampedHeight, 0, STBIR_RGB);
free(allocatedBuffer);