diff options
Diffstat (limited to '')
-rw-r--r-- | externals/CMakeLists.txt | 27 | ||||
m--------- | externals/Vulkan-Headers | 0 | ||||
m--------- | externals/dynarmic | 0 | ||||
-rw-r--r-- | externals/find-modules/FindLibUSB.cmake | 43 | ||||
m--------- | externals/libressl | 0 | ||||
-rw-r--r-- | externals/libusb/CMakeLists.txt | 150 | ||||
-rw-r--r-- | externals/libusb/config.h.in | 90 | ||||
m--------- | externals/libusb/libusb | 0 | ||||
-rw-r--r-- | externals/microprofile/microprofile.h | 59 | ||||
-rw-r--r-- | externals/microprofile/microprofileui.h | 212 | ||||
-rw-r--r-- | externals/opus/CMakeLists.txt | 254 | ||||
m--------- | externals/opus/opus | 0 | ||||
m--------- | externals/sirit | 0 | ||||
m--------- | externals/xbyak | 0 |
14 files changed, 701 insertions, 134 deletions
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index df7a5e0a9..d1dcc403b 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -4,6 +4,13 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/externals/find-modules") include(DownloadExternals) +# xbyak +if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) + add_library(xbyak INTERFACE) + target_include_directories(xbyak SYSTEM INTERFACE ./xbyak/xbyak) + target_compile_definitions(xbyak INTERFACE XBYAK_NO_OP_NAMES) +endif() + # Catch add_library(catch-single-include INTERFACE) target_include_directories(catch-single-include INTERFACE catch/single_include) @@ -66,6 +73,15 @@ if (NOT LIBZIP_FOUND) endif() if (ENABLE_WEB_SERVICE) + # LibreSSL + set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "") + add_subdirectory(libressl EXCLUDE_FROM_ALL) + target_include_directories(ssl INTERFACE ./libressl/include) + target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP) + get_directory_property(OPENSSL_LIBRARIES + DIRECTORY libressl + DEFINITION OPENSSL_LIBS) + # lurlparser add_subdirectory(lurlparser EXCLUDE_FROM_ALL) @@ -73,13 +89,8 @@ if (ENABLE_WEB_SERVICE) add_library(httplib INTERFACE) target_include_directories(httplib INTERFACE ./httplib) target_compile_definitions(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT) - target_link_libraries(httplib INTERFACE OpenSSL::SSL OpenSSL::Crypto) + target_link_libraries(httplib INTERFACE ${OPENSSL_LIBRARIES}) endif() -if (NOT TARGET xbyak) - if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) - add_library(xbyak INTERFACE) - target_include_directories(xbyak SYSTEM INTERFACE ./xbyak/xbyak) - target_compile_definitions(xbyak INTERFACE XBYAK_NO_OP_NAMES) - endif() -endif() +# Opus +add_subdirectory(opus) diff --git a/externals/Vulkan-Headers b/externals/Vulkan-Headers -Subproject 9250d5ae8f50202005233dc0512a1d460c8b483 +Subproject 8188e3fbbc105591064093440f88081fb957d4f diff --git a/externals/dynarmic b/externals/dynarmic -Subproject e7166e8ba74d7b9c85e87afc0aaf667e7e84cfe +Subproject 0e1112b7df77ae55a62a51622940d5c8f9e8c84 diff --git a/externals/find-modules/FindLibUSB.cmake b/externals/find-modules/FindLibUSB.cmake new file mode 100644 index 000000000..dec0b98b0 --- /dev/null +++ b/externals/find-modules/FindLibUSB.cmake @@ -0,0 +1,43 @@ +# - Find libusb-1.0 library +# This module defines +# LIBUSB_INCLUDE_DIR, where to find bluetooth.h +# LIBUSB_LIBRARIES, the libraries needed to use libusb-1.0. +# LIBUSB_FOUND, If false, do not try to use libusb-1.0. +# +# Copyright (c) 2009, Michal Cihar, <michal@cihar.com> +# +# vim: expandtab sw=4 ts=4 sts=4: + +if(ANDROID) + set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found") + message(STATUS "libusb-1.0 not found.") +elseif (NOT LIBUSB_FOUND) + pkg_check_modules (LIBUSB_PKG libusb-1.0) + + find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h + PATHS + ${LIBUSB_PKG_INCLUDE_DIRS} + /usr/include/libusb-1.0 + /usr/include + /usr/local/include/libusb-1.0 + /usr/local/include + ) + + find_library(LIBUSB_LIBRARIES NAMES usb-1.0 usb + PATHS + ${LIBUSB_PKG_LIBRARY_DIRS} + /usr/lib + /usr/local/lib + ) + + if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) + set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found") + message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}") + else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) + set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found") + message(STATUS "libusb-1.0 not found.") + endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) + + mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES) +endif () + diff --git a/externals/libressl b/externals/libressl new file mode 160000 +Subproject 7d01cb01cb1a926ecb4c9c98b107ef3c26f59df diff --git a/externals/libusb/CMakeLists.txt b/externals/libusb/CMakeLists.txt new file mode 100644 index 000000000..c0d24b126 --- /dev/null +++ b/externals/libusb/CMakeLists.txt @@ -0,0 +1,150 @@ +add_library(usb STATIC EXCLUDE_FROM_ALL + libusb/libusb/core.c + libusb/libusb/core.c + libusb/libusb/descriptor.c + libusb/libusb/hotplug.c + libusb/libusb/io.c + libusb/libusb/strerror.c + libusb/libusb/sync.c +) +set_target_properties(usb PROPERTIES VERSION 1.0.23) +if(WIN32) + target_include_directories(usb + BEFORE + PUBLIC + libusb/libusb + + PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}" + ) + + if (NOT MINGW) + target_include_directories(usb BEFORE PRIVATE libusb/msvc) + endif() + + # Works around other libraries providing their own definition of USB GUIDs (e.g. SDL2) + target_compile_definitions(usb PRIVATE "-DGUID_DEVINTERFACE_USB_DEVICE=(GUID){ 0xA5DCBF10, 0x6530, 0x11D2, {0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED}}") +else() +target_include_directories(usb + # turns out other projects also have "config.h", so make sure the + # LibUSB one comes first + BEFORE + + PUBLIC + libusb/libusb + + PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}" +) +endif() + +if(WIN32 OR CYGWIN) + target_sources(usb PRIVATE + libusb/libusb/os/threads_windows.c + libusb/libusb/os/windows_winusb.c + libusb/libusb/os/windows_usbdk.c + libusb/libusb/os/windows_nt_common.c + ) + set(OS_WINDOWS TRUE) +elseif(APPLE) + target_sources(usb PRIVATE + libusb/libusb/os/darwin_usb.c + ) + find_library(COREFOUNDATION_LIBRARY CoreFoundation) + find_library(IOKIT_LIBRARY IOKit) + find_library(OBJC_LIBRARY objc) + target_link_libraries(usb PRIVATE + ${COREFOUNDATION_LIBRARY} + ${IOKIT_LIBRARY} + ${OBJC_LIBRARY} + ) + set(OS_DARWIN TRUE) +elseif(ANDROID) + target_sources(usb PRIVATE + libusb/libusb/os/linux_usbfs.c + libusb/libusb/os/linux_netlink.c + ) + find_library(LOG_LIBRARY log) + target_link_libraries(usb PRIVATE ${LOG_LIBRARY}) + set(OS_LINUX TRUE) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + target_sources(usb PRIVATE + libusb/libusb/os/linux_usbfs.c + ) + find_package(Libudev) + if(LIBUDEV_FOUND) + target_sources(usb PRIVATE + libusb/libusb/os/linux_udev.c + ) + target_link_libraries(usb PRIVATE "${LIBUDEV_LIBRARIES}") + target_include_directories(usb PRIVATE "${LIBUDEV_INCLUDE_DIR}") + set(HAVE_LIBUDEV TRUE) + set(USE_UDEV TRUE) + else() + target_sources(usb PRIVATE + libusb/libusb/os/linux_netlink.c + ) + endif() + set(OS_LINUX TRUE) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") + target_sources(usb PRIVATE + libusb/libusb/os/netbsd_usb.c + ) + set(OS_NETBSD TRUE) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") + target_sources(usb PRIVATE + libusb/libusb/os/openbsd_usb.c + ) + set(OS_OPENBSD TRUE) +endif() + +if(UNIX) + target_sources(usb PRIVATE + libusb/libusb/os/poll_posix.c + libusb/libusb/os/threads_posix.c + ) + find_package(Threads REQUIRED) + if(THREADS_HAVE_PTHREAD_ARG) + target_compile_options(usb PUBLIC "-pthread") + endif() + if(CMAKE_THREAD_LIBS_INIT) + target_link_libraries(usb PRIVATE "${CMAKE_THREAD_LIBS_INIT}") + endif() + set(THREADS_POSIX TRUE) +elseif(WIN32) + target_sources(usb PRIVATE + libusb/libusb/os/poll_windows.c + libusb/libusb/os/threads_windows.c + ) +endif() + +include(CheckFunctionExists) +include(CheckIncludeFiles) +include(CheckTypeSize) +check_include_files(asm/types.h HAVE_ASM_TYPES_H) +check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) +check_include_files(linux/filter.h HAVE_LINUX_FILTER_H) +check_include_files(linux/netlink.h HAVE_LINUX_NETLINK_H) +check_include_files(poll.h HAVE_POLL_H) +check_include_files(signal.h HAVE_SIGNAL_H) +check_include_files(strings.h HAVE_STRINGS_H) +check_type_size("struct timespec" STRUCT_TIMESPEC) +check_function_exists(syslog HAVE_SYSLOG_FUNC) +check_include_files(syslog.h HAVE_SYSLOG_H) +check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) +check_include_files(sys/time.h HAVE_SYS_TIME_H) +check_include_files(sys/types.h HAVE_SYS_TYPES_H) + +set(CMAKE_EXTRA_INCLUDE_FILES poll.h) +check_type_size("nfds_t" nfds_t) +unset(CMAKE_EXTRA_INCLUDE_FILES) +if(HAVE_NFDS_T) + set(POLL_NFDS_TYPE "nfds_t") +else() + set(POLL_NFDS_TYPE "unsigned int") +endif() + +check_include_files(sys/timerfd.h USBI_TIMERFD_AVAILABLE) + + +configure_file(config.h.in config.h) diff --git a/externals/libusb/config.h.in b/externals/libusb/config.h.in new file mode 100644 index 000000000..915b7390f --- /dev/null +++ b/externals/libusb/config.h.in @@ -0,0 +1,90 @@ +/* Default visibility */ +#if defined(__GNUC__) || defined(__clang__) + #define DEFAULT_VISIBILITY __attribute__((visibility("default"))) +#elif defined(_MSC_VER) + #define DEFAULT_VISIBILITY __declspec(dllexport) +#endif + +/* Start with debug message logging enabled */ +#undef ENABLE_DEBUG_LOGGING + +/* Message logging */ +#undef ENABLE_LOGGING + +/* Define to 1 if you have the <asm/types.h> header file. */ +#cmakedefine HAVE_ASM_TYPES_H 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#cmakedefine HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `udev' library (-ludev). */ +#cmakedefine HAVE_LIBUDEV 1 + +/* Define to 1 if you have the <linux/filter.h> header file. */ +#cmakedefine HAVE_LINUX_FILTER_H 1 + +/* Define to 1 if you have the <linux/netlink.h> header file. */ +#cmakedefine HAVE_LINUX_NETLINK_H 1 + +/* Define to 1 if you have the <poll.h> header file. */ +#cmakedefine HAVE_POLL_H 1 + +/* Define to 1 if you have the <signal.h> header file. */ +#cmakedefine HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#cmakedefine HAVE_STRINGS_H 1 + +/* Define to 1 if the system has the type `struct timespec'. */ +#cmakedefine HAVE_STRUCT_TIMESPEC 1 + +/* syslog() function available */ +#cmakedefine HAVE_SYSLOG_FUNC 1 + +/* Define to 1 if you have the <syslog.h> header file. */ +#cmakedefine HAVE_SYSLOG_H 1 + +/* Define to 1 if you have the <sys/socket.h> header file. */ +#cmakedefine HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the <sys/time.h> header file. */ +#cmakedefine HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#cmakedefine HAVE_SYS_TYPES_H 1 + +/* Darwin backend */ +#cmakedefine OS_DARWIN 1 + +/* Linux backend */ +#cmakedefine OS_LINUX 1 + +/* NetBSD backend */ +#cmakedefine OS_NETBSD 1 + +/* OpenBSD backend */ +#cmakedefine OS_OPENBSD 1 + +/* Windows backend */ +#cmakedefine OS_WINDOWS 1 + +/* type of second poll() argument */ +#define POLL_NFDS_TYPE @POLL_NFDS_TYPE@ + +/* Use POSIX Threads */ +#cmakedefine THREADS_POSIX + +/* timerfd headers available */ +#cmakedefine USBI_TIMERFD_AVAILABLE 1 + +/* Enable output to system log */ +#define USE_SYSTEM_LOGGING_FACILITY 1 + +/* Use udev for device enumeration/hotplug */ +#cmakedefine USE_UDEV 1 + +/* Use GNU extensions */ +#define _GNU_SOURCE + +/* Oldest Windows version supported */ +#define WINVER 0x0501 diff --git a/externals/libusb/libusb b/externals/libusb/libusb new file mode 160000 +Subproject e782eeb2514266f6738e242cdcb18e3ae1ed06f diff --git a/externals/microprofile/microprofile.h b/externals/microprofile/microprofile.h index 0c0d0a4d3..85d5bd5de 100644 --- a/externals/microprofile/microprofile.h +++ b/externals/microprofile/microprofile.h @@ -152,9 +152,11 @@ typedef uint16_t MicroProfileGroupId; #include <stdint.h> #include <string.h> -#include <thread> -#include <mutex> +#include <algorithm> +#include <array> #include <atomic> +#include <mutex> +#include <thread> #ifndef MICROPROFILE_API #define MICROPROFILE_API @@ -605,28 +607,45 @@ struct MicroProfileFrameState struct MicroProfileThreadLog { - MicroProfileLogEntry Log[MICROPROFILE_BUFFER_SIZE]; + std::array<MicroProfileLogEntry, MICROPROFILE_BUFFER_SIZE> Log{}; - std::atomic<uint32_t> nPut; - std::atomic<uint32_t> nGet; - uint32_t nActive; - uint32_t nGpu; - ThreadIdType nThreadId; + std::atomic<uint32_t> nPut{0}; + std::atomic<uint32_t> nGet{0}; + uint32_t nActive = 0; + uint32_t nGpu = 0; + ThreadIdType nThreadId{}; - uint32_t nStack[MICROPROFILE_STACK_MAX]; - int64_t nChildTickStack[MICROPROFILE_STACK_MAX]; - uint32_t nStackPos; + std::array<uint32_t, MICROPROFILE_STACK_MAX> nStack{}; + std::array<int64_t, MICROPROFILE_STACK_MAX> nChildTickStack{}; + uint32_t nStackPos = 0; - uint8_t nGroupStackPos[MICROPROFILE_MAX_GROUPS]; - int64_t nGroupTicks[MICROPROFILE_MAX_GROUPS]; - int64_t nAggregateGroupTicks[MICROPROFILE_MAX_GROUPS]; + std::array<uint8_t, MICROPROFILE_MAX_GROUPS> nGroupStackPos{}; + std::array<int64_t, MICROPROFILE_MAX_GROUPS> nGroupTicks{}; + std::array<int64_t, MICROPROFILE_MAX_GROUPS> nAggregateGroupTicks{}; enum { THREAD_MAX_LEN = 64, }; - char ThreadName[64]; - int nFreeListNext; + char ThreadName[64]{}; + int nFreeListNext = 0; + + void Reset() { + Log.fill({}); + nPut = 0; + nGet = 0; + nActive = 0; + nGpu = 0; + nThreadId = {}; + nStack.fill(0); + nChildTickStack.fill(0); + nStackPos = 0; + nGroupStackPos.fill(0); + nGroupTicks.fill(0); + nAggregateGroupTicks.fill(0); + std::fill(std::begin(ThreadName), std::end(ThreadName), '\0'); + nFreeListNext = 0; + } }; #if MICROPROFILE_GPU_TIMERS_D3D11 @@ -1018,7 +1037,7 @@ static void MicroProfileCreateThreadLogKey() #else MP_THREAD_LOCAL MicroProfileThreadLog* g_MicroProfileThreadLog = 0; #endif -static bool g_bUseLock = false; /// This is used because windows does not support using mutexes under dll init(which is where global initialization is handled) +static std::atomic<bool> g_bUseLock{false}; /// This is used because windows does not support using mutexes under dll init(which is where global initialization is handled) MICROPROFILE_DEFINE(g_MicroProfileFlip, "MicroProfile", "MicroProfileFlip", 0x3355ee); @@ -1151,6 +1170,7 @@ MicroProfileThreadLog* MicroProfileCreateThreadLog(const char* pName) MP_ASSERT(pLog->nPut.load() == 0); MP_ASSERT(pLog->nGet.load() == 0); S.nFreeListHead = S.Pool[S.nFreeListHead]->nFreeListNext; + pLog->Reset(); } else { @@ -1158,7 +1178,6 @@ MicroProfileThreadLog* MicroProfileCreateThreadLog(const char* pName) S.nMemUsage += sizeof(MicroProfileThreadLog); S.Pool[S.nNumLogs++] = pLog; } - memset(pLog, 0, sizeof(*pLog)); int len = (int)strlen(pName); int maxlen = sizeof(pLog->ThreadName)-1; len = len < maxlen ? len : maxlen; @@ -1206,8 +1225,8 @@ void MicroProfileOnThreadExit() { S.Frames[i].nLogStart[nLogIndex] = 0; } - memset(pLog->nGroupStackPos, 0, sizeof(pLog->nGroupStackPos)); - memset(pLog->nGroupTicks, 0, sizeof(pLog->nGroupTicks)); + pLog->nGroupStackPos.fill(0); + pLog->nGroupTicks.fill(0); } } diff --git a/externals/microprofile/microprofileui.h b/externals/microprofile/microprofileui.h index fe2410cf4..85fbf2cb9 100644 --- a/externals/microprofile/microprofileui.h +++ b/externals/microprofile/microprofileui.h @@ -169,14 +169,13 @@ MICROPROFILEUI_API void MicroProfileCustomGroup(const char* pCustomName, uint32_ MICROPROFILEUI_API void MicroProfileCustomGroupAddTimer(const char* pCustomName, const char* pGroup, const char* pTimer); #ifdef MICROPROFILEUI_IMPL -#ifdef _WIN32 -#define snprintf _snprintf -#endif +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <math.h> #include <algorithm> +#include <array> MICROPROFILE_DEFINE(g_MicroProfileDetailed, "MicroProfile", "Detailed View", 0x8888000); MICROPROFILE_DEFINE(g_MicroProfileDrawGraph, "MicroProfile", "Draw Graph", 0xff44ee00); @@ -227,10 +226,10 @@ struct SOptionDesc uint8_t nIndex; bool bSelected; }; -static uint32_t g_MicroProfileAggregatePresets[] = {0, 10, 20, 30, 60, 120}; -static float g_MicroProfileReferenceTimePresets[] = {5.f, 10.f, 15.f,20.f, 33.33f, 66.66f, 100.f, 250.f, 500.f, 1000.f}; -static uint32_t g_MicroProfileOpacityPresets[] = {0x40, 0x80, 0xc0, 0xff}; -static const char* g_MicroProfilePresetNames[] = +static const std::array<uint32_t, 6> g_MicroProfileAggregatePresets{0, 10, 20, 30, 60, 120}; +static const std::array<float, 10> g_MicroProfileReferenceTimePresets{5.f, 10.f, 15.f,20.f, 33.33f, 66.66f, 100.f, 250.f, 500.f, 1000.f}; +static const std::array<uint32_t, 4> g_MicroProfileOpacityPresets{0x40, 0x80, 0xc0, 0xff}; +static const std::array<const char*, 7> g_MicroProfilePresetNames { MICROPROFILE_DEFAULT_PRESET, "Render", @@ -243,8 +242,8 @@ static const char* g_MicroProfilePresetNames[] = enum { - MICROPROFILE_NUM_REFERENCE_PRESETS = sizeof(g_MicroProfileReferenceTimePresets)/sizeof(g_MicroProfileReferenceTimePresets[0]), - MICROPROFILE_NUM_OPACITY_PRESETS = sizeof(g_MicroProfileOpacityPresets)/sizeof(g_MicroProfileOpacityPresets[0]), + MICROPROFILE_NUM_REFERENCE_PRESETS = g_MicroProfileReferenceTimePresets.size(), + MICROPROFILE_NUM_OPACITY_PRESETS = g_MicroProfileOpacityPresets.size(), #if MICROPROFILE_CONTEXT_SWITCH_TRACE MICROPROFILE_OPTION_SIZE = MICROPROFILE_NUM_REFERENCE_PRESETS + MICROPROFILE_NUM_OPACITY_PRESETS * 2 + 2 + 7, #else @@ -326,9 +325,9 @@ struct MicroProfileUI MicroProfileUI g_MicroProfileUI; #define UI g_MicroProfileUI -static uint32_t g_nMicroProfileBackColors[2] = { 0x474747, 0x313131 }; +static const std::array<uint32_t, 2> g_nMicroProfileBackColors{ 0x474747, 0x313131 }; #define MICROPROFILE_NUM_CONTEXT_SWITCH_COLORS 16 -static uint32_t g_nMicroProfileContextSwitchThreadColors[MICROPROFILE_NUM_CONTEXT_SWITCH_COLORS] = //palette generated by http://tools.medialab.sciences-po.fr/iwanthue/index.php +static const std::array<uint32_t, MICROPROFILE_NUM_CONTEXT_SWITCH_COLORS> g_nMicroProfileContextSwitchThreadColors //palette generated by http://tools.medialab.sciences-po.fr/iwanthue/index.php { 0x63607B, 0x755E2B, @@ -356,7 +355,7 @@ void MicroProfileInitUI() { bInitialized = true; memset(&g_MicroProfileUI, 0, sizeof(g_MicroProfileUI)); - UI.nActiveMenu = (uint32_t)-1; + UI.nActiveMenu = UINT32_MAX; UI.fDetailedOffsetTarget = UI.fDetailedOffset = 0.f; UI.fDetailedRangeTarget = UI.fDetailedRange = 50.f; @@ -368,7 +367,7 @@ void MicroProfileInitUI() UI.nWidth = 100; UI.nHeight = 100; - UI.nCustomActive = (uint32_t)-1; + UI.nCustomActive = UINT32_MAX; UI.nCustomTimerCount = 0; UI.nCustomCount = 0; @@ -498,8 +497,8 @@ inline void MicroProfileDrawFloatWindow(uint32_t nX, uint32_t nY, const char** p { MicroProfileDrawBox(nX-MICROPROFILE_TEXT_WIDTH, nY, nX, nY + MICROPROFILE_TEXT_WIDTH, pColors[i]|0xff000000); } - MicroProfileDrawText(nX + 1, nY + 1, (uint32_t)-1, ppStrings[i0], (uint32_t)strlen(ppStrings[i0])); - MicroProfileDrawText(nX + nWidth - nStringLengths[i0+1] * (MICROPROFILE_TEXT_WIDTH+1), nY + 1, (uint32_t)-1, ppStrings[i0+1], (uint32_t)strlen(ppStrings[i0+1])); + MicroProfileDrawText(nX + 1, nY + 1, UINT32_MAX, ppStrings[i0], (uint32_t)strlen(ppStrings[i0])); + MicroProfileDrawText(nX + nWidth - nStringLengths[i0+1] * (MICROPROFILE_TEXT_WIDTH+1), nY + 1, UINT32_MAX, ppStrings[i0+1], (uint32_t)strlen(ppStrings[i0+1])); nY += (MICROPROFILE_TEXT_HEIGHT+1); } } @@ -522,7 +521,7 @@ inline void MicroProfileDrawTextBox(uint32_t nX, uint32_t nY, const char** ppStr MicroProfileDrawBox(nX, nY, nX + nWidth, nY + nHeight, 0xff000000); for(uint32_t i = 0; i < nNumStrings; ++i) { - MicroProfileDrawText(nX + 1, nY + 1, (uint32_t)-1, ppStrings[i], (uint32_t)strlen(ppStrings[i])); + MicroProfileDrawText(nX + 1, nY + 1, UINT32_MAX, ppStrings[i], (uint32_t)strlen(ppStrings[i])); nY += (MICROPROFILE_TEXT_HEIGHT+1); } } @@ -781,7 +780,7 @@ inline void MicroProfileDrawDetailedContextSwitchBars(uint32_t nY, uint32_t nThr { MicroProfile& S = *MicroProfileGet(); int64_t nTickIn = -1; - uint32_t nThreadBefore = -1; + uint32_t nThreadBefore = UINT32_MAX; float fToMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()); float fMsToScreen = UI.nWidth / UI.fDetailedRange; float fMouseX = (float)UI.nMouseX; @@ -949,10 +948,10 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int uint32_t nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadAfter; uint32_t nContextSwitchHoverThreadBefore = S.nContextSwitchHoverThreadBefore; - S.nContextSwitchHoverThread = S.nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadBefore = -1; + S.nContextSwitchHoverThread = S.nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadBefore = UINT32_MAX; - uint32_t nContextSwitchStart = -1; - uint32_t nContextSwitchEnd = -1; + uint32_t nContextSwitchStart = UINT32_MAX; + uint32_t nContextSwitchEnd = UINT32_MAX; S.nContextSwitchHoverCpuNext = 0xff; S.nContextSwitchHoverTickIn = -1; S.nContextSwitchHoverTickOut = -1; @@ -1005,9 +1004,10 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int }while(pFrameLogFirst != pFrameFirst); - if(nGet == (uint32_t)-1) + if (nGet == UINT32_MAX) { continue; - MP_ASSERT(nGet != (uint32_t)-1); + } + MP_ASSERT(nGet != UINT32_MAX); nPut = pFrameLogLast->nLogStart[i]; @@ -1023,9 +1023,9 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int int64_t nBaseTicks = bGpu ? nBaseTicksGpu : nBaseTicksCpu; char ThreadName[MicroProfileThreadLog::THREAD_MAX_LEN + 16]; uint64_t nThreadId = pLog->nThreadId; - snprintf(ThreadName, sizeof(ThreadName)-1, "%04llx: %s", nThreadId, &pLog->ThreadName[0] ); + snprintf(ThreadName, sizeof(ThreadName)-1, "%04" PRIx64 ": %s", nThreadId, &pLog->ThreadName[0] ); nY += 3; - uint32_t nThreadColor = -1; + uint32_t nThreadColor = UINT32_MAX; if(pLog->nThreadId == nContextSwitchHoverThreadAfter || pLog->nThreadId == nContextSwitchHoverThreadBefore) nThreadColor = UI.nHoverColorShared|0x906060; MicroProfileDrawText(0, nY, nThreadColor, &ThreadName[0], (uint32_t)strlen(&ThreadName[0])); @@ -1048,7 +1048,7 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int uint32_t nEnd = nRange[j][1]; for(uint32_t k = nStart; k < nEnd; ++k) { - MicroProfileLogEntry* pEntry = pLog->Log + k; + MicroProfileLogEntry* pEntry = &pLog->Log[k]; int nType = MicroProfileLogType(*pEntry); if(MP_LOG_ENTER == nType) { @@ -1066,7 +1066,7 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int continue; } - MicroProfileLogEntry* pEntryEnter = pLog->Log + nStack[nStackPos-1]; + MicroProfileLogEntry* pEntryEnter = &pLog->Log[nStack[nStackPos-1]]; if(MicroProfileLogTimerIndex(*pEntryEnter) != MicroProfileLogTimerIndex(*pEntry)) { //uprintf("mismatch %llx %llx\n", pEntryEnter->nToken, pEntry->nToken); @@ -1126,7 +1126,7 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int uint32_t nIntegerWidth = (uint32_t)(fXEnd - fXStart); if(nIntegerWidth) { - if(bHover && UI.nActiveMenu == -1) + if(bHover && UI.nActiveMenu == UINT32_MAX) { nHoverToken = MicroProfileLogTimerIndex(*pEntry); #if MICROPROFILE_DEBUG @@ -1146,7 +1146,7 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int int nCharacters = (nTextWidth - 2*MICROPROFILE_TEXT_WIDTH) / MICROPROFILE_TEXT_WIDTH; if(nCharacters>0) { - MicroProfileDrawText(fXStartText+1, fYStart+1, -1, S.TimerInfo[nTimerIndex].pName, MicroProfileMin<uint32_t>(S.TimerInfo[nTimerIndex].nNameLen, nCharacters)); + MicroProfileDrawText(fXStartText + 1, fYStart + 1, UINT32_MAX, S.TimerInfo[nTimerIndex].pName, MicroProfileMin<uint32_t>(S.TimerInfo[nTimerIndex].nNameLen, nCharacters)); } } #endif @@ -1158,7 +1158,7 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int int nLineX = (int)floor(fXAvg+0.5f); if(nLineX != (int)nLinesDrawn[nStackPos]) { - if(bHover && UI.nActiveMenu == -1) + if(bHover && UI.nActiveMenu == UINT32_MAX) { nHoverToken = (uint32_t)MicroProfileLogTimerIndex(*pEntry); nHoverTime = MicroProfileLogTickDifference(nTickStart, nTickEnd); @@ -1235,9 +1235,9 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int // nThreadId is 32-bit on Windows int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04x: %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) ); #else - int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04llx: %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) ); + int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04" PRIx64 ": %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) ); #endif - uint32_t nThreadColor = -1; + uint32_t nThreadColor = UINT32_MAX; if(nThreadId == nContextSwitchHoverThreadAfter || nThreadId == nContextSwitchHoverThreadBefore) nThreadColor = UI.nHoverColorShared|0x906060; MicroProfileDrawDetailedContextSwitchBars(nY+2, nThreadId, nContextSwitchStart, nContextSwitchEnd, nBaseTicksCpu, nBaseY); @@ -1249,9 +1249,6 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int S.nContextSwitchHoverCpu = S.nContextSwitchHoverCpuNext; - - - UI.pDisplayMouseOver = pMouseOverNext; if(!S.nRunning) @@ -1286,10 +1283,10 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart); float fStartTextX = fXStart - fStartTextWidth - 2; MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); - MicroProfileDrawText(fStartTextX+1, nBaseY, (uint32_t)-1, sBuffer, nLenStart); + MicroProfileDrawText(fStartTextX+1, nBaseY, UINT32_MAX, sBuffer, nLenStart); uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd); MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); - MicroProfileDrawText(fXEnd+2, nBaseY+1, (uint32_t)-1, sBuffer, nLenEnd); + MicroProfileDrawText(fXEnd+2, nBaseY+1, UINT32_MAX, sBuffer, nLenEnd); if(UI.nMouseRight) { @@ -1316,10 +1313,10 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart); float fStartTextX = fXStart - fStartTextWidth - 2; MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); - MicroProfileDrawText(fStartTextX+1, nBaseY, (uint32_t)-1, sBuffer, nLenStart); + MicroProfileDrawText(fStartTextX+1, nBaseY, UINT32_MAX, sBuffer, nLenStart); uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd); MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); - MicroProfileDrawText(fXEnd+2, nBaseY+1, (uint32_t)-1, sBuffer, nLenEnd); + MicroProfileDrawText(fXEnd+2, nBaseY+1, UINT32_MAX, sBuffer, nLenEnd); } } } @@ -1365,7 +1362,7 @@ inline void MicroProfileDrawDetailedFrameHistory(uint32_t nWidth, uint32_t nHeig fBaseX = fXStart; uint32_t nColor = MICROPROFILE_FRAME_HISTORY_COLOR_CPU; if(nIndex == nSelectedFrame) - nColor = (uint32_t)-1; + nColor = UINT32_MAX; MicroProfileDrawBox(fXStart, nBaseY + fScale * nBarHeight, fXEnd, nBaseY+MICROPROFILE_FRAME_HISTORY_HEIGHT, nColor, MicroProfileBoxTypeBar); if(pNext->nFrameStartCpu > nCpuStart) { @@ -1387,7 +1384,7 @@ inline void MicroProfileDrawDetailedView(uint32_t nWidth, uint32_t nHeight) uint32_t nBaseY = MICROPROFILE_TEXT_HEIGHT + 1; int nSelectedFrame = -1; - if(UI.nMouseY > nBaseY && UI.nMouseY <= nBaseY + MICROPROFILE_FRAME_HISTORY_HEIGHT && UI.nActiveMenu == -1) + if(UI.nMouseY > nBaseY && UI.nMouseY <= nBaseY + MICROPROFILE_FRAME_HISTORY_HEIGHT && UI.nActiveMenu == UINT32_MAX) { nSelectedFrame = ((MICROPROFILE_NUM_FRAMES) * (UI.nWidth-UI.nMouseX) / UI.nWidth); @@ -1425,7 +1422,7 @@ inline void MicroProfileDrawHeader(int32_t nX, uint32_t nWidth, const char* pNam if(pName) { MicroProfileDrawBox(nX-8, MICROPROFILE_TEXT_HEIGHT + 2, nX + nWidth+5, MICROPROFILE_TEXT_HEIGHT + 2 + (MICROPROFILE_TEXT_HEIGHT+1), 0xff000000|g_nMicroProfileBackColors[1]); - MicroProfileDrawText(nX, MICROPROFILE_TEXT_HEIGHT + 2, (uint32_t)-1, pName, (uint32_t)strlen(pName)); + MicroProfileDrawText(nX, MICROPROFILE_TEXT_HEIGHT + 2, UINT32_MAX, pName, (uint32_t)strlen(pName)); } } @@ -1440,7 +1437,7 @@ inline void MicroProfileLoopActiveGroupsDraw(int32_t nX, int32_t nY, const char* uint32_t nCount = 0; for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) { - uint64_t nMask = 1ll << j; + uint64_t nMask = 1ULL << j; if(nMask & nGroup) { nY += MICROPROFILE_TEXT_HEIGHT + 1; @@ -1521,7 +1518,7 @@ inline void MicroProfileCalcTimers(float* pTimers, float* pAverage, float* pMax, } } } - nMask <<= 1ll; + nMask <<= 1; } } @@ -1543,7 +1540,7 @@ inline void MicroProfileDrawBarArrayCallback(uint32_t nTimer, uint32_t nIdx, uin snprintf(sBuffer, SBUF_MAX-1, "%5.2f", pTimers[nIdx]); if (!pTimers2) MicroProfileDrawBox(nX + nTextWidth, nY, nX + nTextWidth + fWidth * pTimers[nIdx+1], nY + nHeight, UI.nOpacityForeground|S.TimerInfo[nTimer].nColor, MicroProfileBoxTypeBar); - MicroProfileDrawText(nX, nY, (uint32_t)-1, sBuffer, (uint32_t)strlen(sBuffer)); + MicroProfileDrawText(nX, nY, UINT32_MAX, sBuffer, (uint32_t)strlen(sBuffer)); } @@ -1564,7 +1561,7 @@ inline void MicroProfileDrawBarCallCountCallback(uint32_t nTimer, uint32_t nIdx, MicroProfile& S = *MicroProfileGet(); char sBuffer[SBUF_MAX]; int nLen = snprintf(sBuffer, SBUF_MAX-1, "%5d", S.Frame[nTimer].nCount);//fix - MicroProfileDrawText(nX, nY, (uint32_t)-1, sBuffer, nLen); + MicroProfileDrawText(nX, nY, UINT32_MAX, sBuffer, nLen); } inline uint32_t MicroProfileDrawBarCallCount(int32_t nX, int32_t nY, const char* pName) @@ -1588,7 +1585,7 @@ inline void MicroProfileDrawBarMetaAverageCallback(uint32_t nTimer, uint32_t nId float fRcpFrames = pArgs->fRcpFrames; char sBuffer[SBUF_MAX]; int nLen = snprintf(sBuffer, SBUF_MAX-1, "%5.2f", pCounters[nTimer] * fRcpFrames); - MicroProfileDrawText(nX - nLen * (MICROPROFILE_TEXT_WIDTH+1), nY, (uint32_t)-1, sBuffer, nLen); + MicroProfileDrawText(nX - nLen * (MICROPROFILE_TEXT_WIDTH+1), nY, UINT32_MAX, sBuffer, nLen); } inline uint32_t MicroProfileDrawBarMetaAverage(int32_t nX, int32_t nY, uint64_t* pCounters, const char* pName, uint32_t nTotalHeight) @@ -1609,8 +1606,8 @@ inline void MicroProfileDrawBarMetaCountCallback(uint32_t nTimer, uint32_t nIdx, { uint64_t* pCounters = (uint64_t*)pExtra; char sBuffer[SBUF_MAX]; - int nLen = snprintf(sBuffer, SBUF_MAX-1, "%5llu", pCounters[nTimer]); - MicroProfileDrawText(nX - nLen * (MICROPROFILE_TEXT_WIDTH+1), nY, (uint32_t)-1, sBuffer, nLen); + int nLen = snprintf(sBuffer, SBUF_MAX-1, "%5" PRIu64, pCounters[nTimer]); + MicroProfileDrawText(nX - nLen * (MICROPROFILE_TEXT_WIDTH+1), nY, UINT32_MAX, sBuffer, nLen); } inline uint32_t MicroProfileDrawBarMetaCount(int32_t nX, int32_t nY, uint64_t* pCounters, const char* pName, uint32_t nTotalHeight) @@ -1667,7 +1664,7 @@ bool MicroProfileDrawGraph(uint32_t nScreenWidth, uint32_t nScreenHeight) if(bMouseOver) { float fXAvg = fMouseXPrc * MICROPROFILE_GRAPH_WIDTH + nX; - MicroProfileDrawLineVertical(fXAvg, nY, nY + MICROPROFILE_GRAPH_HEIGHT, (uint32_t)-1); + MicroProfileDrawLineVertical(fXAvg, nY, nY + MICROPROFILE_GRAPH_HEIGHT, UINT32_MAX); } @@ -1706,7 +1703,7 @@ bool MicroProfileDrawGraph(uint32_t nScreenWidth, uint32_t nScreenHeight) char buf[32]; int nLen = snprintf(buf, sizeof(buf)-1, "%5.2fms", S.fReferenceTime); - MicroProfileDrawText(nX+1, fY1 - (2+MICROPROFILE_TEXT_HEIGHT), (uint32_t)-1, buf, nLen); + MicroProfileDrawText(nX+1, fY1 - (2+MICROPROFILE_TEXT_HEIGHT), UINT32_MAX, buf, nLen); } @@ -1782,7 +1779,7 @@ void MicroProfileDumpTimers() for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) { - uint64_t nMask = 1ll << j; + uint64_t nMask = 1ULL << j; if(nMask & nActiveGroup) { MICROPROFILE_PRINTF("%s\n", S.GroupInfo[j].pName); @@ -1823,7 +1820,7 @@ inline void MicroProfileDrawBarView(uint32_t nScreenWidth, uint32_t nScreenHeigh uint32_t nNumGroups = 0; for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) { - if(nActiveGroup & (1ll << j)) + if(nActiveGroup & (1ULL << j)) { nNumTimers += S.GroupInfo[j].nNumTimers; nNumGroups += 1; @@ -1878,7 +1875,7 @@ inline void MicroProfileDrawBarView(uint32_t nScreenWidth, uint32_t nScreenHeigh for(uint32_t i = 0; i < nNumTimers+nNumGroups+1; ++i) { uint32_t nY0 = nY + i * (nHeight + 1); - bool bInside = (UI.nActiveMenu == -1) && ((UI.nMouseY >= nY0) && (UI.nMouseY < (nY0 + nHeight + 1))); + bool bInside = (UI.nActiveMenu == UINT32_MAX) && ((UI.nMouseY >= nY0) && (UI.nMouseY < (nY0 + nHeight + 1))); MicroProfileDrawBox(nX, nY0, nWidth+nX, nY0 + (nHeight+1)+1, UI.nOpacityBackground | (g_nMicroProfileBackColors[nColorIndex++ & 1] + ((bInside) ? 0x002c2c2c : 0))); } nX += 10; @@ -1927,22 +1924,22 @@ inline void MicroProfileDrawBarView(uint32_t nScreenWidth, uint32_t nScreenHeigh nY = nHeight + 3 - UI.nOffsetY; for(uint32_t i = 0; i < nNumTimers+nNumGroups+1; ++i) { - uint32_t nY0 = nY + i * (nHeight + 1); - bool bInside = (UI.nActiveMenu == -1) && ((UI.nMouseY >= nY0) && (UI.nMouseY < (nY0 + nHeight + 1))); + const uint32_t nY0 = nY + i * (nHeight + 1); + const bool bInside = (UI.nActiveMenu == UINT32_MAX) && ((UI.nMouseY >= nY0) && (UI.nMouseY < (nY0 + nHeight + 1))); MicroProfileDrawBox(nX, nY0, nTimerWidth, nY0 + (nHeight+1)+1, 0xff0000000 | (g_nMicroProfileBackColors[nColorIndex++ & 1] + ((bInside) ? 0x002c2c2c : 0))); } nX += MicroProfileDrawBarLegend(nX, nY, nTotalHeight, nTimerWidth-5) + 1; for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) { - if(nActiveGroup & (1ll << j)) + if(nActiveGroup & (1ULL << j)) { - MicroProfileDrawText(nX, nY + (1+nHeight) * nLegendOffset, (uint32_t)-1, S.GroupInfo[j].pName, S.GroupInfo[j].nNameLen); + MicroProfileDrawText(nX, nY + (1+nHeight) * nLegendOffset, UINT32_MAX, S.GroupInfo[j].pName, S.GroupInfo[j].nNameLen); nLegendOffset += S.GroupInfo[j].nNumTimers+1; } } MicroProfileDrawHeader(nX, nTimerWidth-5, "Group"); - MicroProfileDrawTextRight(nTimerWidth-3, MICROPROFILE_TEXT_HEIGHT + 2, (uint32_t)-1, "Timer", 5); + MicroProfileDrawTextRight(nTimerWidth-3, MICROPROFILE_TEXT_HEIGHT + 2, UINT32_MAX, "Timer", 5); MicroProfileDrawLineVertical(nTimerWidth, 0, nTotalHeight+nY, UI.nOpacityBackground|g_nMicroProfileBackColors[0]|g_nMicroProfileBackColors[1]); MicroProfileDrawLineHorizontal(0, nWidth, 2*MICROPROFILE_TEXT_HEIGHT + 3, UI.nOpacityBackground|g_nMicroProfileBackColors[0]|g_nMicroProfileBackColors[1]); } @@ -2003,7 +2000,7 @@ inline const char* MicroProfileUIMenuGroups(int nIndex, bool* bSelected) } else { - *bSelected = 0 != (S.nActiveGroupWanted & (1ll << Item.nIndex)); + *bSelected = 0 != (S.nActiveGroupWanted & (1ULL << Item.nIndex)); snprintf(buffer, sizeof(buffer)-1, " %s", Item.pName); } return buffer; @@ -2015,16 +2012,18 @@ inline const char* MicroProfileUIMenuGroups(int nIndex, bool* bSelected) inline const char* MicroProfileUIMenuAggregate(int nIndex, bool* bSelected) { MicroProfile& S = *MicroProfileGet(); - if(nIndex < sizeof(g_MicroProfileAggregatePresets)/sizeof(g_MicroProfileAggregatePresets[0])) + if(static_cast<uint32_t>(nIndex) < g_MicroProfileAggregatePresets.size()) { - int val = g_MicroProfileAggregatePresets[nIndex]; - *bSelected = (int)S.nAggregateFlip == val; - if(0 == val) + uint32_t val = g_MicroProfileAggregatePresets[nIndex]; + *bSelected = S.nAggregateFlip == val; + if (0 == val) + { return "Infinite"; + } else { static char buf[128]; - snprintf(buf, sizeof(buf)-1, "%7d", val); + snprintf(buf, sizeof(buf)-1, "%7u", val); return buf; } } @@ -2098,11 +2097,13 @@ inline const char* MicroProfileUIMenuPreset(int nIndex, bool* bSelected) { static char buf[128]; *bSelected = false; - int nNumPresets = sizeof(g_MicroProfilePresetNames) / sizeof(g_MicroProfilePresetNames[0]); + int nNumPresets = static_cast<int>(g_MicroProfilePresetNames.size()); int nIndexSave = nIndex - nNumPresets - 1; - if(nIndex == nNumPresets) + if (nIndex == nNumPresets) + { return "--"; - else if(nIndexSave >=0 && nIndexSave <nNumPresets) + } + else if(nIndexSave >=0 && nIndexSave < nNumPresets) { snprintf(buf, sizeof(buf)-1, "Save '%s'", g_MicroProfilePresetNames[nIndexSave]); return buf; @@ -2120,13 +2121,13 @@ inline const char* MicroProfileUIMenuPreset(int nIndex, bool* bSelected) inline const char* MicroProfileUIMenuCustom(int nIndex, bool* bSelected) { - if((uint32_t)-1 == UI.nCustomActive) + if(UINT32_MAX == UI.nCustomActive) { *bSelected = nIndex == 0; } else { - *bSelected = nIndex-2 == UI.nCustomActive; + *bSelected = nIndex-2 == static_cast<int>(UI.nCustomActive); } switch(nIndex) { @@ -2202,7 +2203,7 @@ inline void MicroProfileUIClickGroups(int nIndex) else { MP_ASSERT(Item.nIndex < S.nGroupCount); - S.nActiveGroupWanted ^= (1ll << Item.nIndex); + S.nActiveGroupWanted ^= (1ULL << Item.nIndex); } } } @@ -2273,7 +2274,7 @@ inline void MicroProfileUIClickOptions(int nIndex) inline void MicroProfileUIClickPreset(int nIndex) { - int nNumPresets = sizeof(g_MicroProfilePresetNames) / sizeof(g_MicroProfilePresetNames[0]); + int nNumPresets = static_cast<int>(g_MicroProfilePresetNames.size()); int nIndexSave = nIndex - nNumPresets - 1; if(nIndexSave >= 0 && nIndexSave < nNumPresets) { @@ -2310,7 +2311,7 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight) uint32_t nX = 0; uint32_t nY = 0; - bool bMouseOver = UI.nMouseY < MICROPROFILE_TEXT_HEIGHT + 1; + #define SBUF_SIZE 256 char buffer[256]; MicroProfileDrawBox(nX, nY, nX + nWidth, nY + (MICROPROFILE_TEXT_HEIGHT+1)+1, 0xff000000|g_nMicroProfileBackColors[1]); @@ -2321,7 +2322,7 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight) uint32_t nNumMenuItems = 0; int nLen = snprintf(buffer, 127, "MicroProfile"); - MicroProfileDrawText(nX, nY, (uint32_t)-1, buffer, nLen); + MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nLen); nX += (sizeof("MicroProfile")+2) * (MICROPROFILE_TEXT_WIDTH+1); pMenuText[nNumMenuItems++] = "Mode"; pMenuText[nNumMenuItems++] = "Groups"; @@ -2409,7 +2410,7 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight) }; - uint32_t nSelectMenu = (uint32_t)-1; + uint32_t nSelectMenu = UINT32_MAX; for(uint32_t i = 0; i < nNumMenuItems; ++i) { nMenuX[i] = nX; @@ -2419,17 +2420,17 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight) { MicroProfileDrawBox(nX-1, nY, nX + nLen * (MICROPROFILE_TEXT_WIDTH+1), nY +(MICROPROFILE_TEXT_HEIGHT+1)+1, 0xff888888); nSelectMenu = i; - if((UI.nMouseLeft || UI.nMouseRight) && i == (int)nPauseIndex) + if((UI.nMouseLeft || UI.nMouseRight) && i == (uint32_t)nPauseIndex) { S.nToggleRunning = 1; } } - MicroProfileDrawText(nX, nY, (uint32_t)-1, pMenuText[i], (uint32_t)strlen(pMenuText[i])); + MicroProfileDrawText(nX, nY, UINT32_MAX, pMenuText[i], (uint32_t)strlen(pMenuText[i])); nX += (nLen+1) * (MICROPROFILE_TEXT_WIDTH+1); } - uint32_t nMenu = nSelectMenu != (uint32_t)-1 ? nSelectMenu : UI.nActiveMenu; + uint32_t nMenu = nSelectMenu != UINT32_MAX ? nSelectMenu : UI.nActiveMenu; UI.nActiveMenu = nMenu; - if((uint32_t)-1 != nMenu) + if(UINT32_MAX != nMenu) { nX = nMenuX[nMenu]; nY += MICROPROFILE_TEXT_HEIGHT+1; @@ -2450,9 +2451,9 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight) { UI.nActiveMenu = nMenu; } - else if(nSelectMenu == (uint32_t)-1) + else if(nSelectMenu == UINT32_MAX) { - UI.nActiveMenu = (uint32_t)-1; + UI.nActiveMenu = UINT32_MAX; } MicroProfileDrawBox(nX, nY, nX + nWidth, nY + nHeight, 0xff000000|g_nMicroProfileBackColors[1]); for(int i = 0; i < nNumLines; ++i) @@ -2461,7 +2462,6 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight) const char* pString = CB(i, &bSelected); if(UI.nMouseY >= nY && UI.nMouseY < nY + MICROPROFILE_TEXT_HEIGHT + 1) { - bMouseOver = true; if(UI.nMouseLeft || UI.nMouseRight) { CBClick[nMenu](i); @@ -2469,7 +2469,7 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight) MicroProfileDrawBox(nX, nY, nX + nWidth, nY + MICROPROFILE_TEXT_HEIGHT + 1, 0xff888888); } int nLen = snprintf(buffer, SBUF_SIZE-1, "%c %s", bSelected ? '*' : ' ' ,pString); - MicroProfileDrawText(nX, nY, (uint32_t)-1, buffer, nLen); + MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nLen); nY += MICROPROFILE_TEXT_HEIGHT+1; } } @@ -2484,7 +2484,7 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight) float fMaxMs = fToMs * S.nFlipMaxDisplay; int nLen = snprintf(FrameTimeMessage, sizeof(FrameTimeMessage)-1, "Time[%6.2f] Avg[%6.2f] Max[%6.2f]", fMs, fAverageMs, fMaxMs); pMenuText[nNumMenuItems++] = &FrameTimeMessage[0]; - MicroProfileDrawText(nWidth - nLen * (MICROPROFILE_TEXT_WIDTH+1), 0, -1, FrameTimeMessage, nLen); + MicroProfileDrawText(nWidth - nLen * (MICROPROFILE_TEXT_WIDTH+1), 0, UINT32_MAX, FrameTimeMessage, nLen); } } @@ -2538,7 +2538,7 @@ inline void MicroProfileMoveGraph() inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight) { - if((uint32_t)-1 != UI.nCustomActive) + if(UINT32_MAX != UI.nCustomActive) { MicroProfile& S = *MicroProfileGet(); MP_ASSERT(UI.nCustomActive < MICROPROFILE_CUSTOM_MAX); @@ -2571,8 +2571,8 @@ inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight) pColors[i] = S.TimerInfo[nTimerIndex].nColor; } - MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING + 3*MICROPROFILE_TEXT_WIDTH, nOffsetY, (uint32_t)-1, "Avg", sizeof("Avg")-1); - MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING + 13*MICROPROFILE_TEXT_WIDTH, nOffsetY, (uint32_t)-1, "Max", sizeof("Max")-1); + MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING + 3*MICROPROFILE_TEXT_WIDTH, nOffsetY, UINT32_MAX, "Avg", sizeof("Avg")-1); + MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING + 13*MICROPROFILE_TEXT_WIDTH, nOffsetY, UINT32_MAX, "Max", sizeof("Max")-1); for(uint32_t i = 0; i < nCount; ++i) { nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT); @@ -2582,10 +2582,10 @@ inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight) int nSize; uint32_t nOffsetX = MICROPROFILE_CUSTOM_PADDING; nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2f", pTimeAvg[i]); - MicroProfileDrawText(nOffsetX, nOffsetY, (uint32_t)-1, Buffer, nSize); + MicroProfileDrawText(nOffsetX, nOffsetY, UINT32_MAX, Buffer, nSize); nOffsetX += (nSize+2) * (MICROPROFILE_TEXT_WIDTH+1); nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2f", pTimeMax[i]); - MicroProfileDrawText(nOffsetX, nOffsetY, (uint32_t)-1, Buffer, nSize); + MicroProfileDrawText(nOffsetX, nOffsetY, UINT32_MAX, Buffer, nSize); nOffsetX += (nSize+2) * (MICROPROFILE_TEXT_WIDTH+1); nSize = snprintf(Buffer, sizeof(Buffer)-1, "%s:%s", S.GroupInfo[nGroupIndex].pName, pTimerInfo->pName); MicroProfileDrawText(nOffsetX, nOffsetY, pTimerInfo->nColor, Buffer, nSize); @@ -2599,9 +2599,9 @@ inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight) nOffsetY = nOffsetYBase; float* pMs = pCustom->nFlags & MICROPROFILE_CUSTOM_BAR_SOURCE_MAX ? pTimeMax : pTimeAvg; const char* pString = pCustom->nFlags & MICROPROFILE_CUSTOM_BAR_SOURCE_MAX ? "Max" : "Avg"; - MicroProfileDrawText(nMaxOffsetX, nOffsetY, (uint32_t)-1, pString, static_cast<uint32_t>(strlen(pString))); + MicroProfileDrawText(nMaxOffsetX, nOffsetY, UINT32_MAX, pString, static_cast<uint32_t>(strlen(pString))); int nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2fms", fReference); - MicroProfileDrawText(nReducedWidth - (1+nSize) * (MICROPROFILE_TEXT_WIDTH+1), nOffsetY, (uint32_t)-1, Buffer, nSize); + MicroProfileDrawText(nReducedWidth - (1+nSize) * (MICROPROFILE_TEXT_WIDTH+1), nOffsetY, UINT32_MAX, Buffer, nSize); for(uint32_t i = 0; i < nCount; ++i) { nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT); @@ -2613,9 +2613,9 @@ inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight) { nOffsetY += 2*(1+MICROPROFILE_TEXT_HEIGHT); const char* pString = pCustom->nFlags & MICROPROFILE_CUSTOM_STACK_SOURCE_MAX ? "Max" : "Avg"; - MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING, nOffsetY, (uint32_t)-1, pString, static_cast<uint32_t>(strlen(pString))); + MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING, nOffsetY, UINT32_MAX, pString, static_cast<uint32_t>(strlen(pString))); int nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2fms", fReference); - MicroProfileDrawText(nReducedWidth - (1+nSize) * (MICROPROFILE_TEXT_WIDTH+1), nOffsetY, (uint32_t)-1, Buffer, nSize); + MicroProfileDrawText(nReducedWidth - (1+nSize) * (MICROPROFILE_TEXT_WIDTH+1), nOffsetY, UINT32_MAX, Buffer, nSize); nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT); float fPosX = MICROPROFILE_CUSTOM_PADDING; float* pMs = pCustom->nFlags & MICROPROFILE_CUSTOM_STACK_SOURCE_MAX ? pTimeMax : pTimeAvg; @@ -2668,7 +2668,7 @@ inline void MicroProfileDraw(uint32_t nWidth, uint32_t nHeight) UI.nHoverTime = 0; UI.nHoverFrame = -1; if(S.nDisplay != MP_DRAW_DETAILED) - S.nContextSwitchHoverThread = S.nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadBefore = -1; + S.nContextSwitchHoverThread = S.nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadBefore = UINT32_MAX; MicroProfileMoveGraph(); @@ -2798,13 +2798,13 @@ inline void MicroProfileDraw(uint32_t nWidth, uint32_t nHeight) - if(UI.nActiveMenu == -1 && !bMouseOverGraph) + if(UI.nActiveMenu == UINT32_MAX && !bMouseOverGraph) { if(UI.nHoverToken != MICROPROFILE_INVALID_TOKEN) { MicroProfileDrawFloatTooltip(UI.nMouseX, UI.nMouseY, UI.nHoverToken, UI.nHoverTime); } - else if(S.nContextSwitchHoverThreadAfter != -1 && S.nContextSwitchHoverThreadBefore != -1) + else if(S.nContextSwitchHoverThreadAfter != UINT32_MAX && S.nContextSwitchHoverThreadBefore != UINT32_MAX) { float fToMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()); MicroProfileStringArray ToolTip; @@ -2820,7 +2820,7 @@ inline void MicroProfileDraw(uint32_t nWidth, uint32_t nHeight) MicroProfileStringArrayFormat(&ToolTip, "%6.2fms", fToMs * nDifference ); MicroProfileStringArrayAddLiteral(&ToolTip, "CPU"); MicroProfileStringArrayFormat(&ToolTip, "%d", S.nContextSwitchHoverCpu); - MicroProfileDrawFloatWindow(UI.nMouseX, UI.nMouseY+20, &ToolTip.ppStrings[0], ToolTip.nNumStrings, -1); + MicroProfileDrawFloatWindow(UI.nMouseX, UI.nMouseY+20, &ToolTip.ppStrings[0], ToolTip.nNumStrings, UINT32_MAX); } @@ -2858,7 +2858,7 @@ inline void MicroProfileDraw(uint32_t nWidth, uint32_t nHeight) } } #endif - MicroProfileDrawFloatWindow(UI.nMouseX, UI.nMouseY+20, &ToolTip.ppStrings[0], ToolTip.nNumStrings, -1); + MicroProfileDrawFloatWindow(UI.nMouseX, UI.nMouseY+20, &ToolTip.ppStrings[0], ToolTip.nNumStrings, UINT32_MAX); } if(UI.nMouseLeft) { @@ -2883,7 +2883,7 @@ inline void MicroProfileDraw(uint32_t nWidth, uint32_t nHeight) #endif m.unlock(); } - else if(UI.nCustomActive != (uint32_t)-1) + else if(UI.nCustomActive != UINT32_MAX) { std::recursive_mutex& m = MicroProfileGetMutex(); m.lock(); @@ -3179,7 +3179,7 @@ void MicroProfileLoadPreset(const char* pSuffix) { if(0 == MP_STRCASECMP(pGroupName, S.GroupInfo[j].pName)) { - S.nActiveGroupWanted |= (1ll << j); + S.nActiveGroupWanted |= (1ULL << j); } } } @@ -3212,7 +3212,7 @@ void MicroProfileLoadPreset(const char* pSuffix) uint64_t nGroupIndex = S.TimerInfo[j].nGroupIndex; if(0 == MP_STRCASECMP(pGraphName, S.TimerInfo[j].pName) && 0 == MP_STRCASECMP(pGraphGroupName, S.GroupInfo[nGroupIndex].pName)) { - MicroProfileToken nToken = MicroProfileMakeToken(1ll << nGroupIndex, (uint16_t)j); + MicroProfileToken nToken = MicroProfileMakeToken(1ULL << nGroupIndex, (uint16_t)j); S.Graph[i].nToken = nToken; // note: group index is stored here but is checked without in MicroProfileToggleGraph()! S.TimerInfo[j].bGraph = true; if(nToken != nPrevToken) @@ -3235,7 +3235,7 @@ inline uint32_t MicroProfileCustomGroupFind(const char* pCustomName) return i; } } - return (uint32_t)-1; + return UINT32_MAX; } inline uint32_t MicroProfileCustomGroup(const char* pCustomName) @@ -3251,7 +3251,7 @@ inline uint32_t MicroProfileCustomGroup(const char* pCustomName) uint32_t nIndex = UI.nCustomCount; UI.nCustomCount++; memset(&UI.Custom[nIndex], 0, sizeof(UI.Custom[nIndex])); - uint32_t nLen = (uint32_t)strlen(pCustomName); + size_t nLen = strlen(pCustomName); if(nLen > MICROPROFILE_NAME_MAX_LEN-1) nLen = MICROPROFILE_NAME_MAX_LEN-1; memcpy(&UI.Custom[nIndex].pName[0], pCustomName, nLen); @@ -3309,7 +3309,7 @@ inline void MicroProfileCustomGroupEnable(uint32_t nIndex) void MicroProfileCustomGroupToggle(const char* pCustomName) { uint32_t nIndex = MicroProfileCustomGroupFind(pCustomName); - if(nIndex == (uint32_t)-1 || nIndex == UI.nCustomActive) + if(nIndex == UINT32_MAX || nIndex == UI.nCustomActive) { MicroProfileCustomGroupDisable(); } @@ -3328,13 +3328,13 @@ void MicroProfileCustomGroupDisable() { MicroProfile& S = *MicroProfileGet(); S.nForceGroupUI = 0; - UI.nCustomActive = (uint32_t)-1; + UI.nCustomActive = UINT32_MAX; } void MicroProfileCustomGroupAddTimer(const char* pCustomName, const char* pGroup, const char* pTimer) { uint32_t nIndex = MicroProfileCustomGroupFind(pCustomName); - if((uint32_t)-1 == nIndex) + if(UINT32_MAX == nIndex) { return; } @@ -3344,7 +3344,7 @@ void MicroProfileCustomGroupAddTimer(const char* pCustomName, const char* pGroup MP_ASSERT(nToken != MICROPROFILE_INVALID_TOKEN); //Timer must be registered first. UI.Custom[nIndex].pTimers[nTimerIndex] = nToken; uint16_t nGroup = MicroProfileGetGroupIndex(nToken); - UI.Custom[nIndex].nGroupMask |= (1ll << nGroup); + UI.Custom[nIndex].nGroupMask |= (1ULL << nGroup); UI.Custom[nIndex].nNumTimers++; } diff --git a/externals/opus/CMakeLists.txt b/externals/opus/CMakeLists.txt new file mode 100644 index 000000000..94a86551f --- /dev/null +++ b/externals/opus/CMakeLists.txt @@ -0,0 +1,254 @@ +cmake_minimum_required(VERSION 3.8) + +project(opus) + +option(OPUS_STACK_PROTECTOR "Use stack protection" OFF) +option(OPUS_USE_ALLOCA "Use alloca for stack arrays (on non-C99 compilers)" OFF) +option(OPUS_CUSTOM_MODES "Enable non-Opus modes, e.g. 44.1 kHz & 2^n frames" OFF) +option(OPUS_FIXED_POINT "Compile as fixed-point (for machines without a fast enough FPU)" OFF) +option(OPUS_ENABLE_FLOAT_API "Compile with the floating point API (for machines with float library" ON) + +include(opus/opus_functions.cmake) + +if(OPUS_STACK_PROTECTOR) + if(NOT MSVC) # GC on by default on MSVC + check_and_set_flag(STACK_PROTECTION_STRONG -fstack-protector-strong) + endif() +else() + if(MSVC) + check_and_set_flag(BUFFER_SECURITY_CHECK /GS-) + endif() +endif() + +add_library(opus STATIC + # CELT sources + opus/celt/bands.c + opus/celt/celt.c + opus/celt/celt_decoder.c + opus/celt/celt_encoder.c + opus/celt/celt_lpc.c + opus/celt/cwrs.c + opus/celt/entcode.c + opus/celt/entdec.c + opus/celt/entenc.c + opus/celt/kiss_fft.c + opus/celt/laplace.c + opus/celt/mathops.c + opus/celt/mdct.c + opus/celt/modes.c + opus/celt/pitch.c + opus/celt/quant_bands.c + opus/celt/rate.c + opus/celt/vq.c + + # SILK sources + opus/silk/A2NLSF.c + opus/silk/CNG.c + opus/silk/HP_variable_cutoff.c + opus/silk/LPC_analysis_filter.c + opus/silk/LPC_fit.c + opus/silk/LPC_inv_pred_gain.c + opus/silk/LP_variable_cutoff.c + opus/silk/NLSF2A.c + opus/silk/NLSF_VQ.c + opus/silk/NLSF_VQ_weights_laroia.c + opus/silk/NLSF_decode.c + opus/silk/NLSF_del_dec_quant.c + opus/silk/NLSF_encode.c + opus/silk/NLSF_stabilize.c + opus/silk/NLSF_unpack.c + opus/silk/NSQ.c + opus/silk/NSQ_del_dec.c + opus/silk/PLC.c + opus/silk/VAD.c + opus/silk/VQ_WMat_EC.c + opus/silk/ana_filt_bank_1.c + opus/silk/biquad_alt.c + opus/silk/bwexpander.c + opus/silk/bwexpander_32.c + opus/silk/check_control_input.c + opus/silk/code_signs.c + opus/silk/control_SNR.c + opus/silk/control_audio_bandwidth.c + opus/silk/control_codec.c + opus/silk/dec_API.c + opus/silk/decode_core.c + opus/silk/decode_frame.c + opus/silk/decode_indices.c + opus/silk/decode_parameters.c + opus/silk/decode_pitch.c + opus/silk/decode_pulses.c + opus/silk/decoder_set_fs.c + opus/silk/enc_API.c + opus/silk/encode_indices.c + opus/silk/encode_pulses.c + opus/silk/gain_quant.c + opus/silk/init_decoder.c + opus/silk/init_encoder.c + opus/silk/inner_prod_aligned.c + opus/silk/interpolate.c + opus/silk/lin2log.c + opus/silk/log2lin.c + opus/silk/pitch_est_tables.c + opus/silk/process_NLSFs.c + opus/silk/quant_LTP_gains.c + opus/silk/resampler.c + opus/silk/resampler_down2.c + opus/silk/resampler_down2_3.c + opus/silk/resampler_private_AR2.c + opus/silk/resampler_private_IIR_FIR.c + opus/silk/resampler_private_down_FIR.c + opus/silk/resampler_private_up2_HQ.c + opus/silk/resampler_rom.c + opus/silk/shell_coder.c + opus/silk/sigm_Q15.c + opus/silk/sort.c + opus/silk/stereo_LR_to_MS.c + opus/silk/stereo_MS_to_LR.c + opus/silk/stereo_decode_pred.c + opus/silk/stereo_encode_pred.c + opus/silk/stereo_find_predictor.c + opus/silk/stereo_quant_pred.c + opus/silk/sum_sqr_shift.c + opus/silk/table_LSF_cos.c + opus/silk/tables_LTP.c + opus/silk/tables_NLSF_CB_NB_MB.c + opus/silk/tables_NLSF_CB_WB.c + opus/silk/tables_gain.c + opus/silk/tables_other.c + opus/silk/tables_pitch_lag.c + opus/silk/tables_pulses_per_block.c + + # Opus sources + opus/src/analysis.c + opus/src/mapping_matrix.c + opus/src/mlp.c + opus/src/mlp_data.c + opus/src/opus.c + opus/src/opus_decoder.c + opus/src/opus_encoder.c + opus/src/opus_multistream.c + opus/src/opus_multistream_decoder.c + opus/src/opus_multistream_encoder.c + opus/src/opus_projection_decoder.c + opus/src/opus_projection_encoder.c + opus/src/repacketizer.c +) + +if (DEBUG) + target_sources(opus PRIVATE opus/silk/debug.c) +endif() + +if (OPUS_FIXED_POINT) + target_sources(opus PRIVATE + opus/silk/fixed/LTP_analysis_filter_FIX.c + opus/silk/fixed/LTP_scale_ctrl_FIX.c + opus/silk/fixed/apply_sine_window_FIX.c + opus/silk/fixed/autocorr_FIX.c + opus/silk/fixed/burg_modified_FIX.c + opus/silk/fixed/corrMatrix_FIX.c + opus/silk/fixed/encode_frame_FIX.c + opus/silk/fixed/find_LPC_FIX.c + opus/silk/fixed/find_LTP_FIX.c + opus/silk/fixed/find_pitch_lags_FIX.c + opus/silk/fixed/find_pred_coefs_FIX.c + opus/silk/fixed/k2a_FIX.c + opus/silk/fixed/k2a_Q16_FIX.c + opus/silk/fixed/noise_shape_analysis_FIX.c + opus/silk/fixed/pitch_analysis_core_FIX.c + opus/silk/fixed/prefilter_FIX.c + opus/silk/fixed/process_gains_FIX.c + opus/silk/fixed/regularize_correlations_FIX.c + opus/silk/fixed/residual_energy16_FIX.c + opus/silk/fixed/residual_energy_FIX.c + opus/silk/fixed/schur64_FIX.c + opus/silk/fixed/schur_FIX.c + opus/silk/fixed/solve_LS_FIX.c + opus/silk/fixed/vector_ops_FIX.c + opus/silk/fixed/warped_autocorrelation_FIX.c + ) +else() + target_sources(opus PRIVATE + opus/silk/float/LPC_analysis_filter_FLP.c + opus/silk/float/LPC_inv_pred_gain_FLP.c + opus/silk/float/LTP_analysis_filter_FLP.c + opus/silk/float/LTP_scale_ctrl_FLP.c + opus/silk/float/apply_sine_window_FLP.c + opus/silk/float/autocorrelation_FLP.c + opus/silk/float/burg_modified_FLP.c + opus/silk/float/bwexpander_FLP.c + opus/silk/float/corrMatrix_FLP.c + opus/silk/float/encode_frame_FLP.c + opus/silk/float/energy_FLP.c + opus/silk/float/find_LPC_FLP.c + opus/silk/float/find_LTP_FLP.c + opus/silk/float/find_pitch_lags_FLP.c + opus/silk/float/find_pred_coefs_FLP.c + opus/silk/float/inner_product_FLP.c + opus/silk/float/k2a_FLP.c + opus/silk/float/noise_shape_analysis_FLP.c + opus/silk/float/pitch_analysis_core_FLP.c + opus/silk/float/process_gains_FLP.c + opus/silk/float/regularize_correlations_FLP.c + opus/silk/float/residual_energy_FLP.c + opus/silk/float/scale_copy_vector_FLP.c + opus/silk/float/scale_vector_FLP.c + opus/silk/float/schur_FLP.c + opus/silk/float/sort_FLP.c + opus/silk/float/warped_autocorrelation_FLP.c + opus/silk/float/wrappers_FLP.c + ) +endif() + +target_compile_definitions(opus PRIVATE OPUS_BUILD ENABLE_HARDENING) + +if(NOT MSVC) + if(MINGW) + target_compile_definitions(opus PRIVATE _FORTIFY_SOURCE=0) + else() + target_compile_definitions(opus PRIVATE _FORTIFY_SOURCE=2) + endif() +endif() + +# It is strongly recommended to uncomment one of these VAR_ARRAYS: Use C99 +# variable-length arrays for stack allocation USE_ALLOCA: Use alloca() for stack +# allocation If none is defined, then the fallback is a non-threadsafe global +# array +if(OPUS_USE_ALLOCA OR MSVC) + target_compile_definitions(opus PRIVATE USE_ALLOCA) +else() + target_compile_definitions(opus PRIVATE VAR_ARRAYS) +endif() + +if(OPUS_CUSTOM_MODES) + target_compile_definitions(opus PRIVATE CUSTOM_MODES) +endif() + +if(NOT OPUS_ENABLE_FLOAT_API) + target_compile_definitions(opus PRIVATE DISABLE_FLOAT_API) +endif() + +target_compile_definitions(opus +PUBLIC + -DOPUS_VERSION="\\"1.3.1\\"" + +PRIVATE + # Use C99 intrinsics to speed up float-to-int conversion + HAVE_LRINTF +) + +if (FIXED_POINT) + target_compile_definitions(opus PRIVATE -DFIXED_POINT=1 -DDISABLE_FLOAT_API) +endif() + +target_include_directories(opus +PUBLIC + opus/include + +PRIVATE + opus/celt + opus/silk + opus/silk/fixed + opus/silk/float + opus/src +) diff --git a/externals/opus/opus b/externals/opus/opus new file mode 160000 +Subproject ad8fe90db79b7d2a135e3dfd2ed6631b0c5662a diff --git a/externals/sirit b/externals/sirit -Subproject a62c5bbc100a5e5a31ea0ccc4a78d8fa6a4167c +Subproject eefca56afd49379bdebc97ded8b480839f93088 diff --git a/externals/xbyak b/externals/xbyak -Subproject 82b70e665918efc2ee348091742fd0237b3b68c +Subproject c306b8e5786eeeb87b8925a8af5c3bf057ff5a9 |