diff --git a/hecl/.gitmodules b/hecl/.gitmodules index ef1e6d60e..6fc402c1b 100644 --- a/hecl/.gitmodules +++ b/hecl/.gitmodules @@ -7,3 +7,7 @@ [submodule "extern/boo"] path = extern/boo url = https://github.com/AxioDL/boo.git +[submodule "extern/libjpeg-turbo"] + path = extern/libjpeg-turbo + url = https://github.com/jackoalan/libjpeg-turbo.git + branch = thp diff --git a/hecl/extern/CMakeLists.txt b/hecl/extern/CMakeLists.txt index c1fefa493..329baea28 100644 --- a/hecl/extern/CMakeLists.txt +++ b/hecl/extern/CMakeLists.txt @@ -3,3 +3,4 @@ add_subdirectory(libSquish) add_subdirectory(xxhash) add_subdirectory(athena) add_subdirectory(libpng) +add_subdirectory(libjpeg-turbo) diff --git a/hecl/extern/libjpeg-turbo b/hecl/extern/libjpeg-turbo new file mode 160000 index 000000000..51d62f5cd --- /dev/null +++ b/hecl/extern/libjpeg-turbo @@ -0,0 +1 @@ +Subproject commit 51d62f5cdf7bd2a9dc0c41f9e7eddd6c186c2cc1 diff --git a/hecl/include/hecl/hecl.hpp b/hecl/include/hecl/hecl.hpp index 9f459e328..b45f76e13 100644 --- a/hecl/include/hecl/hecl.hpp +++ b/hecl/include/hecl/hecl.hpp @@ -1205,6 +1205,16 @@ static inline int32_t SBig(int32_t val) {return bswap32(val);} static inline uint32_t SBig(uint32_t val) {return bswap32(val);} static inline int64_t SBig(int64_t val) {return bswap64(val);} static inline uint64_t SBig(uint64_t val) {return bswap64(val);} +static inline float SBig(float val) +{ + int32_t ival = bswap32(*((int32_t*)(&val))); + return *((float*)(&ival)); +} +static inline double SBig(double val) +{ + int64_t ival = bswap64(*((int64_t*)(&val))); + return *((double*)(&ival)); +} #define SBIG(q) ( ( (q) & 0x000000FF ) << 24 | ( (q) & 0x0000FF00 ) << 8 \ | ( (q) & 0x00FF0000 ) >> 8 | ( (q) & 0xFF000000 ) >> 24 ) @@ -1214,6 +1224,8 @@ static inline int32_t SLittle(int32_t val) {return val;} static inline uint32_t SLittle(uint32_t val) {return val;} static inline int64_t SLittle(int64_t val) {return val;} static inline uint64_t SLittle(uint64_t val) {return val;} +static inline float SLittle(float val) {return val;} +static inline double SLittle(double val) {return val;} #define SLITTLE(q) (q) #else static inline int16_t SLittle(int16_t val) {return bswap16(val);} @@ -1222,6 +1234,16 @@ static inline int32_t SLittle(int32_t val) {return bswap32(val);} static inline uint32_t SLittle(uint32_t val) {return bswap32(val);} static inline int64_t SLittle(int64_t val) {return bswap64(val);} static inline uint64_t SLittle(uint64_t val) {return bswap64(val);} +static inline float SLittle(float val) +{ + int32_t ival = bswap32(*((int32_t*)(&val))); + return *((float*)(&ival)); +} +static inline double SLittle(double val) +{ + int64_t ival = bswap64(*((int64_t*)(&val))); + return *((double*)(&ival)); +} #define SLITTLE(q) ( ( (q) & 0x000000FF ) << 24 | ( (q) & 0x0000FF00 ) << 8 \ | ( (q) & 0x00FF0000 ) >> 8 | ( (q) & 0xFF000000 ) >> 24 ) @@ -1231,6 +1253,8 @@ static inline int32_t SBig(int32_t val) {return val;} static inline uint32_t SBig(uint32_t val) {return val;} static inline int64_t SBig(int64_t val) {return val;} static inline uint64_t SBig(uint64_t val) {return val;} +static inline float SBig(float val) {return val;} +static inline double SBig(double val) {return val;} #define SBIG(q) (q) #endif